diff --git a/lib/c3/0.1/u8.facts b/lib/c3/0.1/u8.facts
new file mode 100644
index 0000000..8726861
--- /dev/null
+++ b/lib/c3/0.1/u8.facts
@@ -0,0 +1,7 @@
+%{module: C3.Facts.Dump,
+ version: 1}
+add {U8, :is_a, :module}
+add {U8, :symbol, U8.cast}
+add {U8, :symbol, U8.size}
+replace {U8.cast, :cfn, cfn :u8 "u8_cast" (:tag, :&result)}
+replace {U8.size, :value, 1}
diff --git a/libc3/array.c b/libc3/array.c
index 66d3dd5..8cc7ba8 100644
--- a/libc3/array.c
+++ b/libc3/array.c
@@ -16,7 +16,9 @@
#include <err.h>
#include "array.h"
#include "buf.h"
+#include "buf_inspect.h"
#include "buf_parse.h"
+#include "sym.h"
#include "tag.h"
#include "type.h"
@@ -52,8 +54,18 @@ s_array * array_copy (const s_array *src, s_array *dest)
src->dimension * sizeof(s_array_dimension));
dest->size = src->size;
dest->type = src->type;
- dest->data = calloc(1, src->size);
- memcpy(dest->data, src->data, dest->size);
+ if (src->data) {
+ dest->data = calloc(1, src->size);
+ memcpy(dest->data, src->data, dest->size);
+ }
+ if (src->tags) {
+ dest->tags = calloc(src->count, sizeof(s_tag));
+ i = 0;
+ while (i < src->count) {
+ tag_copy(src->tags + i, dest->tags + i);
+ i++;
+ }
+ }
return dest;
}
@@ -85,14 +97,14 @@ s_tag * array_data_tag (s_tag *a, const s_tag *address, s_tag *dest)
a_data = array_data(&a->data.array,
address->data.array.data);
tag_init(dest);
- dest->type = a->data.array.type;
+ dest->type = array_type_to_tag_type(a->data.array.type);
dest_data = tag_to_pointer(dest, dest->type);
size = tag_type_size(dest->type);
memcpy(dest_data, a_data, size);
return dest;
}
-s_array * array_init (s_array *a, e_tag_type type, uw dimension,
+s_array * array_init (s_array *a, const s_sym *type, uw dimension,
const uw *dimensions)
{
uw i = 0;
@@ -119,7 +131,7 @@ s_array * array_init (s_array *a, e_tag_type type, uw dimension,
}
i--;
a->type = type;
- a->dimensions[i].item_size = tag_type_size(type);
+ a->dimensions[i].item_size = array_type_size(type);
while (i > 0) {
i--;
a->dimensions[i].item_size = a->dimensions[i + 1].count *
@@ -145,3 +157,247 @@ s_array * array_init_1 (s_array *a, s8 *p)
buf_clean(&buf);
return a;
}
+
+uw array_type_size (const s_sym *type)
+{
+ if (type == sym_1("Bool"))
+ return sizeof(bool);
+ if (type == sym_1("Call"))
+ return sizeof(s_call);
+ if (type == sym_1("Cfn"))
+ return sizeof(s_cfn);
+ if (type == sym_1("Character"))
+ return sizeof(character);
+ if (type == sym_1("F32"))
+ return sizeof(f32);
+ if (type == sym_1("F64"))
+ return sizeof(f64);
+ if (type == sym_1("Fact"))
+ return sizeof(s_fact);
+ if (type == sym_1("Fn"))
+ return sizeof(s_fn);
+ if (type == sym_1("Ident"))
+ return sizeof(s_ident);
+ if (type == sym_1("Integer"))
+ return sizeof(s_integer);
+ if (type == sym_1("Sw"))
+ return sizeof(sw);
+ if (type == sym_1("S64"))
+ return sizeof(s64);
+ if (type == sym_1("S32"))
+ return sizeof(s32);
+ if (type == sym_1("S16"))
+ return sizeof(s16);
+ if (type == sym_1("S8"))
+ return sizeof(s8);
+ if (type == sym_1("U8"))
+ return sizeof(u8);
+ if (type == sym_1("U16"))
+ return sizeof(u16);
+ if (type == sym_1("U32"))
+ return sizeof(u32);
+ if (type == sym_1("U64"))
+ return sizeof(u64);
+ if (type == sym_1("Uw"))
+ return sizeof(uw);
+ if (type == sym_1("List"))
+ return sizeof(s_list *);
+ if (type == sym_1("Ptag"))
+ return sizeof(p_tag);
+ if (type == sym_1("Quote"))
+ return sizeof(s_quote);
+ if (type == sym_1("Str"))
+ return sizeof(s_str);
+ if (type == sym_1("Sym"))
+ return sizeof(s_sym *);
+ if (type == sym_1("Tuple"))
+ return sizeof(s_tuple);
+ if (type == sym_1("Var"))
+ return sizeof(s_tag);
+ assert(! "array_type_size: unknown type");
+ errx(1, "array_type_size: unknown type: %s", type->str.ptr.ps8);
+ return 0;
+}
+
+f_buf_inspect array_type_to_buf_inspect (const s_sym *type)
+{
+ if (type == sym_1("Bool"))
+ return (f_buf_inspect) buf_inspect_bool;
+ if (type == sym_1("Call"))
+ return (f_buf_inspect) buf_inspect_call;
+ if (type == sym_1("Cfn"))
+ return (f_buf_inspect) buf_inspect_cfn;
+ if (type == sym_1("Character"))
+ return (f_buf_inspect) buf_inspect_character;
+ if (type == sym_1("F32"))
+ return (f_buf_inspect) buf_inspect_f32;
+ if (type == sym_1("F64"))
+ return (f_buf_inspect) buf_inspect_f64;
+ if (type == sym_1("Fact"))
+ return (f_buf_inspect) buf_inspect_fact;
+ if (type == sym_1("Fn"))
+ return (f_buf_inspect) buf_inspect_fn;
+ if (type == sym_1("Ident"))
+ return (f_buf_inspect) buf_inspect_ident;
+ if (type == sym_1("Integer"))
+ return (f_buf_inspect) buf_inspect_integer;
+ if (type == sym_1("Sw"))
+ return (f_buf_inspect) buf_inspect_sw;
+ if (type == sym_1("S64"))
+ return (f_buf_inspect) buf_inspect_s64;
+ if (type == sym_1("S32"))
+ return (f_buf_inspect) buf_inspect_s32;
+ if (type == sym_1("S16"))
+ return (f_buf_inspect) buf_inspect_s16;
+ if (type == sym_1("S8"))
+ return (f_buf_inspect) buf_inspect_s8;
+ if (type == sym_1("U8"))
+ return (f_buf_inspect) buf_inspect_u8;
+ if (type == sym_1("U16"))
+ return (f_buf_inspect) buf_inspect_u16;
+ if (type == sym_1("U32"))
+ return (f_buf_inspect) buf_inspect_u32;
+ if (type == sym_1("U64"))
+ return (f_buf_inspect) buf_inspect_u64;
+ if (type == sym_1("Uw"))
+ return (f_buf_inspect) buf_inspect_uw;
+ if (type == sym_1("List"))
+ return (f_buf_inspect) buf_inspect_list;
+ if (type == sym_1("Ptag"))
+ return (f_buf_inspect) buf_inspect_ptag;
+ if (type == sym_1("Quote"))
+ return (f_buf_inspect) buf_inspect_quote;
+ if (type == sym_1("Str"))
+ return (f_buf_inspect) buf_inspect_str;
+ if (type == sym_1("Sym"))
+ return (f_buf_inspect) buf_inspect_sym;
+ if (type == sym_1("Tuple"))
+ return (f_buf_inspect) buf_inspect_tuple;
+ if (type == sym_1("Var"))
+ return (f_buf_inspect) buf_inspect_var;
+ assert(! "array_type_to_buf_inspect: unknown type");
+ errx(1, "array_type_to_buf_inspect: unknown type");
+ return NULL;
+}
+
+f_buf_inspect_size array_type_to_buf_inspect_size (const s_sym *type)
+{
+ if (type == sym_1("Bool"))
+ return (f_buf_inspect_size) buf_inspect_bool_size;
+ if (type == sym_1("Call"))
+ return (f_buf_inspect_size) buf_inspect_call_size;
+ if (type == sym_1("Cfn"))
+ return (f_buf_inspect_size) buf_inspect_cfn_size;
+ if (type == sym_1("Character"))
+ return (f_buf_inspect_size) buf_inspect_character_size;
+ if (type == sym_1("F32"))
+ return (f_buf_inspect_size) buf_inspect_f32_size;
+ if (type == sym_1("F64"))
+ return (f_buf_inspect_size) buf_inspect_f64_size;
+ if (type == sym_1("Fact"))
+ return (f_buf_inspect_size) buf_inspect_fact_size;
+ if (type == sym_1("Fn"))
+ return (f_buf_inspect_size) buf_inspect_fn_size;
+ if (type == sym_1("Ident"))
+ return (f_buf_inspect_size) buf_inspect_ident_size;
+ if (type == sym_1("Integer"))
+ return (f_buf_inspect_size) buf_inspect_integer_size;
+ if (type == sym_1("Sw"))
+ return (f_buf_inspect_size) buf_inspect_sw_size;
+ if (type == sym_1("S64"))
+ return (f_buf_inspect_size) buf_inspect_s64_size;
+ if (type == sym_1("S32"))
+ return (f_buf_inspect_size) buf_inspect_s32_size;
+ if (type == sym_1("S16"))
+ return (f_buf_inspect_size) buf_inspect_s16_size;
+ if (type == sym_1("S8"))
+ return (f_buf_inspect_size) buf_inspect_s8_size;
+ if (type == sym_1("U8"))
+ return (f_buf_inspect_size) buf_inspect_u8_size;
+ if (type == sym_1("U16"))
+ return (f_buf_inspect_size) buf_inspect_u16_size;
+ if (type == sym_1("U32"))
+ return (f_buf_inspect_size) buf_inspect_u32_size;
+ if (type == sym_1("U64"))
+ return (f_buf_inspect_size) buf_inspect_u64_size;
+ if (type == sym_1("Uw"))
+ return (f_buf_inspect_size) buf_inspect_uw_size;
+ if (type == sym_1("List"))
+ return (f_buf_inspect_size) buf_inspect_list_size;
+ if (type == sym_1("Ptag"))
+ return (f_buf_inspect_size) buf_inspect_ptag_size;
+ if (type == sym_1("Quote"))
+ return (f_buf_inspect_size) buf_inspect_quote_size;
+ if (type == sym_1("Str"))
+ return (f_buf_inspect_size) buf_inspect_str_size;
+ if (type == sym_1("Sym"))
+ return (f_buf_inspect_size) buf_inspect_sym_size;
+ if (type == sym_1("Tuple"))
+ return (f_buf_inspect_size) buf_inspect_tuple_size;
+ if (type == sym_1("Var"))
+ return (f_buf_inspect_size) buf_inspect_var_size;
+ assert(! "array_type_to_buf_inspect: unknown type");
+ errx(1, "array_type_to_buf_inspect: unknown type");
+ return NULL;
+}
+
+e_tag_type array_type_to_tag_type (const s_sym *type)
+{
+ if (type == sym_1("Bool"))
+ return TAG_BOOL;
+ if (type == sym_1("Call"))
+ return TAG_CALL;
+ if (type == sym_1("Cfn"))
+ return TAG_CFN;
+ if (type == sym_1("Character"))
+ return TAG_CHARACTER;
+ if (type == sym_1("F32"))
+ return TAG_F32;
+ if (type == sym_1("F64"))
+ return TAG_F64;
+ if (type == sym_1("Fact"))
+ return TAG_FACT;
+ if (type == sym_1("Fn"))
+ return TAG_FN;
+ if (type == sym_1("Ident"))
+ return TAG_IDENT;
+ if (type == sym_1("Integer"))
+ return TAG_INTEGER;
+ if (type == sym_1("Sw"))
+ return TAG_SW;
+ if (type == sym_1("S64"))
+ return TAG_S64;
+ if (type == sym_1("S32"))
+ return TAG_S32;
+ if (type == sym_1("S16"))
+ return TAG_S16;
+ if (type == sym_1("S8"))
+ return TAG_S8;
+ if (type == sym_1("U8"))
+ return TAG_U8;
+ if (type == sym_1("U16"))
+ return TAG_U16;
+ if (type == sym_1("U32"))
+ return TAG_U32;
+ if (type == sym_1("U64"))
+ return TAG_U64;
+ if (type == sym_1("Uw"))
+ return TAG_UW;
+ if (type == sym_1("List"))
+ return TAG_LIST;
+ if (type == sym_1("Ptag"))
+ return TAG_PTAG;
+ if (type == sym_1("Quote"))
+ return TAG_QUOTE;
+ if (type == sym_1("Str"))
+ return TAG_STR;
+ if (type == sym_1("Sym"))
+ return TAG_SYM;
+ if (type == sym_1("Tuple"))
+ return TAG_TUPLE;
+ if (type == sym_1("Var"))
+ return TAG_VAR;
+ assert(! "array_type_to_tag_type: invalid type");
+ errx(1, "array_type_to_tag_type: invalid type: %s", type->str.ptr.ps8);
+ return TAG_VOID;
+}
diff --git a/libc3/array.h b/libc3/array.h
index e68b09b..cf33a98 100644
--- a/libc3/array.h
+++ b/libc3/array.h
@@ -15,12 +15,17 @@
#include "types.h"
-void array_clean (s_array *a);
-s_array * array_copy (const s_array *src, s_array *dest);
-s_array * array_init (s_array *a, e_tag_type type, uw dimension,
- const uw *dimensions);
-s_array * array_init_1 (s_array *a, s8 *p);
-void * array_data (const s_array *a, const uw *address);
-s_tag * array_data_tag (s_tag *a, const s_tag *address, s_tag *dest);
+void array_clean (s_array *a);
+s_array * array_copy (const s_array *src, s_array *dest);
+s_array * array_init (s_array *a, const s_sym *type,
+ uw dimension, const uw *dimensions);
+s_array * array_init_1 (s_array *a, s8 *p);
+void * array_data (const s_array *a, const uw *address);
+s_tag * array_data_tag (s_tag *a, const s_tag *address,
+ s_tag *dest);
+uw array_type_size (const s_sym *type);
+f_buf_inspect array_type_to_buf_inspect (const s_sym *type);
+f_buf_inspect_size array_type_to_buf_inspect_size (const s_sym *type);
+e_tag_type array_type_to_tag_type (const s_sym *type);
#endif /* ARRAY_H */
diff --git a/libc3/buf_inspect.c b/libc3/buf_inspect.c
index b75721e..d8c987a 100644
--- a/libc3/buf_inspect.c
+++ b/libc3/buf_inspect.c
@@ -35,8 +35,6 @@ sw buf_inspect_array_data_size_rec (const s_array *array,
uw dimension, uw *address,
f_buf_inspect_size inspect,
u8 **data);
-sw buf_inspect_array_type (s_buf *buf, const s_array *array);
-sw buf_inspect_array_type_size (const s_array *array);
sw buf_inspect_tag_type (s_buf *buf, e_tag_type type);
sw buf_inspect_array (s_buf *buf, const s_array *array)
@@ -45,7 +43,7 @@ sw buf_inspect_array (s_buf *buf, const s_array *array)
sw result = 0;
assert(buf);
assert(array);
- if ((r = buf_inspect_array_type(buf, array)) <= 0)
+ if ((r = buf_inspect_paren_sym(buf, array->type)) <= 0)
goto clean;
result += r;
if ((r = buf_write_1(buf, " ")) < 0)
@@ -70,7 +68,7 @@ sw buf_inspect_array_data (s_buf *buf, const s_array *array)
assert(buf);
assert(array);
address = calloc(array->dimension, sizeof(uw));
- inspect = tag_type_to_buf_inspect(array->type);
+ inspect = array_type_to_buf_inspect(array->type);
data = array->data;
r = buf_inspect_array_data_rec(buf, array, 0, address,
inspect, &data);
@@ -124,7 +122,7 @@ sw buf_inspect_array_data_size (const s_array *array)
sw r;
assert(array);
address = calloc(array->dimension, sizeof(uw));
- inspect = tag_type_to_buf_inspect_size(array->type);
+ inspect = array_type_to_buf_inspect_size(array->type);
data = array->data;
r = buf_inspect_array_data_size_rec(array, 0, address,
inspect, &data);
@@ -173,7 +171,7 @@ sw buf_inspect_array_size (const s_array *array)
sw r;
sw result = 0;
assert(array);
- if ((r = buf_inspect_array_type_size(array)) <= 0)
+ if ((r = buf_inspect_paren_sym_size(array->type)) <= 0)
goto clean;
result += r;
r = strlen(" ");
@@ -188,43 +186,6 @@ sw buf_inspect_array_size (const s_array *array)
return r;
}
-sw buf_inspect_array_type (s_buf *buf, const s_array *array)
-{
- sw r;
- sw result = 0;
- assert(buf);
- assert(array);
- if ((r = buf_write_1(buf, "(")) <= 0)
- goto clean;
- result += r;
- if ((r = buf_inspect_tag_type(buf, array->type)) <= 0)
- goto clean;
- result += r;
- if ((r = buf_write_1(buf, ")")) <= 0)
- goto clean;
- result += r;
- r = result;
- clean:
- return r;
-}
-
-sw buf_inspect_array_type_size (const s_array *array)
-{
- sw r;
- sw result = 0;
- assert(array);
- r = strlen("(");
- result += r;
- if ((r = buf_inspect_tag_type_size(array->type)) <= 0)
- goto clean;
- result += r;
- r = strlen(")");
- result += r;
- r = result;
- clean:
- return r;
-}
-
sw buf_inspect_bool (s_buf *buf, const bool *b)
{
if (*b)
@@ -493,17 +454,16 @@ sw buf_inspect_cast_size (const s_call *call)
const s_sym *module;
sw r;
sw result = 0;
- assert(buf);
assert(call);
assert(call->arguments);
assert(! list_next(call->arguments));
module = call->ident.module_name;
- if ((r = buf_inspect_paren_sym_size(module)) < 0)
+ if ((r = buf_inspect_paren_sym_size(module)) <= 0)
return r;
result += r;
result += strlen(" ");
arg = &call->arguments->tag;
- if ((r = buf_inspect_tag_size(arg)) < 0)
+ if ((r = buf_inspect_tag_size(arg)) <= 0)
return r;
result += r;
return result;
diff --git a/libc3/buf_parse.c b/libc3/buf_parse.c
index 91be70f..d54b96a 100644
--- a/libc3/buf_parse.c
+++ b/libc3/buf_parse.c
@@ -15,6 +15,7 @@
#include <string.h>
#include <math.h>
#include "../libtommath/tommath.h"
+#include "array.h"
#include "buf.h"
#include "buf_inspect.h"
#include "buf_parse.h"
@@ -34,12 +35,10 @@
#include "tag.h"
#include "tuple.h"
-sw buf_parse_array_data_rec (s_buf *buf, s_array *dest,
- uw dimension, uw *address,
- f_buf_parse parse, u8 **data);
+sw buf_parse_array_data_rec (s_buf *buf, s_array *dest, uw *address,
+ s_tag **tag, uw dimension);
sw buf_parse_array_dimensions_rec (s_buf *buf, s_array *dest,
- uw dimension, uw *address,
- f_buf_parse parse, void *data);
+ uw *address,uw dimension);
sw buf_peek_array_dimension_count (s_buf *buf, s_array *dest);
sw buf_parse_array (s_buf *buf, s_array *dest)
@@ -48,15 +47,13 @@ sw buf_parse_array (s_buf *buf, s_array *dest)
sw result = 0;
s_buf_save save;
s_array tmp;
- const s_sym *type;
assert(buf);
assert(dest);
buf_save_init(buf, &save);
tmp = *dest;
- if ((r = buf_parse_paren_sym(buf, &type)) <= 0)
+ if ((r = buf_parse_paren_sym(buf, &tmp.type)) <= 0)
goto clean;
result += r;
- sym_to_tag_type(type, &tmp.type);
if ((r = buf_ignore_spaces(buf)) < 0)
goto restore;
result += r;
@@ -83,20 +80,19 @@ sw buf_parse_array (s_buf *buf, s_array *dest)
sw buf_parse_array_data (s_buf *buf, s_array *dest)
{
uw *address;
- u8 *data;
- f_buf_parse parse;
sw r;
+ s_tag *tag;
s_array tmp;
assert(buf);
assert(dest);
tmp = *dest;
address = calloc(tmp.dimension, sizeof(sw));
- parse = tag_type_to_buf_parse(tmp.type);
- tmp.data = calloc(tmp.dimensions[0].count, tmp.dimensions[0].item_size);
tmp.size = tmp.dimensions[0].count * tmp.dimensions[0].item_size;
- data = tmp.data;
- if ((r = buf_parse_array_data_rec(buf, &tmp, 0, address,
- parse, &data)) <= 0) {
+ tmp.count = tmp.size / tmp.dimensions[tmp.dimension - 1].item_size;
+ tmp.tags = calloc(tmp.count, sizeof(s_tag));
+ tag = tmp.tags;
+ if ((r = buf_parse_array_data_rec(buf, &tmp, address, &tag,
+ 0)) <= 0) {
warnx("buf_parse_array_data: buf_parse_array_data_rec:"
" %ld", r);
goto clean;
@@ -107,9 +103,8 @@ sw buf_parse_array_data (s_buf *buf, s_array *dest)
return r;
}
-sw buf_parse_array_data_rec (s_buf *buf, s_array *dest,
- uw dimension, uw *address,
- f_buf_parse parse, u8 **data)
+sw buf_parse_array_data_rec (s_buf *buf, s_array *dest, uw *address,
+ s_tag **tag, uw dimension)
{
sw r;
sw result = 0;
@@ -133,17 +128,16 @@ sw buf_parse_array_data_rec (s_buf *buf, s_array *dest,
address[dimension] = 0;
while (1) {
if (dimension == tmp.dimension - 1) {
- if ((r = parse(buf, *data)) < 0) {
+ if ((r = buf_parse_tag(buf, *tag)) < 0) {
warnx("buf_parse_array_data_rec: parse");
goto clean;
}
result += r;
- *data += tmp.dimensions[dimension].item_size;
+ (*tag)++;
}
else {
- if ((r = buf_parse_array_data_rec(buf, &tmp, dimension + 1,
- address, parse,
- data)) <= 0) {
+ if ((r = buf_parse_array_data_rec(buf, &tmp, address, tag,
+ dimension + 1)) <= 0) {
warnx("buf_parse_array_data_rec: buf_parse_array_data_rec");
goto restore;
}
@@ -237,8 +231,6 @@ sw buf_parse_array_dimension_count (s_buf *buf, s_array *dest)
sw buf_parse_array_dimensions (s_buf *buf, s_array *dest)
{
uw *address;
- u8 *data;
- f_buf_parse parse;
sw r;
uw size;
s_array tmp;
@@ -246,30 +238,27 @@ sw buf_parse_array_dimensions (s_buf *buf, s_array *dest)
assert(dest);
tmp = *dest;
address = calloc(tmp.dimension, sizeof(sw));
- size = tag_type_size(tmp.type);
- parse = tag_type_to_buf_parse(tmp.type);
- data = calloc(1, size);
+ size = array_type_size(tmp.type);
tmp.dimensions[tmp.dimension - 1].item_size = size;
- if ((r = buf_parse_array_dimensions_rec(buf, &tmp, 0, address,
- parse, data)) <= 0) {
+ if ((r = buf_parse_array_dimensions_rec(buf, &tmp, address,
+ 0)) <= 0) {
warnx("buf_parse_array_dimensions: buf_parse_array_dimensions_rec:"
" %ld", r);
goto clean;
}
*dest = tmp;
clean:
- free(data);
free(address);
return r;
}
sw buf_parse_array_dimensions_rec (s_buf *buf, s_array *dest,
- uw dimension, uw *address,
- f_buf_parse parse, void *data)
+ uw *address, uw dimension)
{
sw r;
sw result = 0;
s_buf_save save;
+ s_tag tag;
s_array tmp;
assert(buf);
assert(dest);
@@ -289,17 +278,17 @@ sw buf_parse_array_dimensions_rec (s_buf *buf, s_array *dest,
address[dimension] = 0;
while (1) {
if (dimension == dest->dimension - 1) {
- if ((r = parse(buf, data)) < 0) {
- warnx("buf_parse_array_dimensions_rec: parse");
+ if ((r = buf_parse_tag(buf, &tag)) <= 0) {
+ warnx("buf_parse_array_dimensions_rec: buf_parse_tag");
goto clean;
}
result += r;
}
else {
- if ((r = buf_parse_array_dimensions_rec(buf, &tmp, dimension + 1,
- address, parse,
- data)) <= 0) {
- warnx("buf_parse_array_dimensions_rec: buf_parse_array_dimensions_rec");
+ if ((r = buf_parse_array_dimensions_rec(buf, &tmp, address,
+ dimension + 1)) <= 0) {
+ warnx("buf_parse_array_dimensions_rec:"
+ " buf_parse_array_dimensions_rec");
goto restore;
}
result += r;
@@ -433,7 +422,7 @@ sw buf_parse_brackets (s_buf *buf, s_call *dest)
goto restore;
}
arg_dimensions->type = TAG_ARRAY;
- if (! list_to_array(dimensions, TAG_UW, &arg_dimensions->data.array))
+ if (! list_to_array(dimensions, sym_1("Uw"), &arg_dimensions->data.array))
goto restore;
*dest = tmp;
r = result;
diff --git a/libc3/call.c b/libc3/call.c
index c9a99a8..798404a 100644
--- a/libc3/call.c
+++ b/libc3/call.c
@@ -140,6 +140,15 @@ s_call * call_init_1 (s_call *call, const s8 *p)
return call;
}
+s_call * call_init_cast (s_call *call, const s_sym *type, s_tag *tag)
+{
+ assert(call);
+ bzero(call, sizeof(s_call));
+ ident_init(&call->ident, type, sym_1("cast"));
+ call->arguments = list_new(tag, NULL);
+ return call;
+}
+
s_call * call_init_op (s_call *call)
{
assert(call);
diff --git a/libc3/call.h b/libc3/call.h
index 13eabeb..11c1ca9 100644
--- a/libc3/call.h
+++ b/libc3/call.h
@@ -19,6 +19,7 @@
void call_clean (s_call *call);
s_call * call_init (s_call *call);
s_call * call_init_1 (s_call *call, const s8 *p);
+s_call * call_init_cast (s_call *call, const s_sym *type, s_tag *tag);
s_call * call_init_op (s_call *call);
s_call * call_init_op_unary (s_call *call);
diff --git a/libc3/env.c b/libc3/env.c
index 2087529..0777515 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -14,6 +14,7 @@
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <time.h>
#include <unistd.h>
#include "array.h"
@@ -44,6 +45,9 @@
s_env g_c3_env;
+bool env_eval_array_cast (s_env *env, s_array *tmp, s_tag *tag,
+ u8 *data, uw size);
+
void env_clean (s_env *env)
{
assert(env);
@@ -94,12 +98,52 @@ void env_error_tag (s_env *env, const s_tag *tag)
bool env_eval_array (s_env *env, const s_array *array, s_tag *dest)
{
+ u8 *data;
+ uw i = 0;
+ uw size;
+ s_tag *tag;
+ s_array tmp;
assert(env);
assert(array);
assert(dest);
- (void) env;
+ array_copy(array, &tmp);
+ size = tmp.dimensions[tmp.dimension - 1].item_size;
+ if (! tmp.data &&
+ ! (data = tmp.data = calloc(tmp.dimensions[0].count,
+ tmp.dimensions[0].item_size))) {
+ assert(! "env_eval_array: out of memory");
+ errx(1, "env_eval_array: out of memory");
+ }
+ tag = tmp.tags;
+ while (i < tmp.count) {
+ env_eval_array_cast(env, &tmp, tag, data, size);
+ data += size;
+ tag++;
+ i++;
+ }
dest->type = TAG_ARRAY;
- array_copy(array, &dest->data.array);
+ dest->data.array = tmp;
+ return true;
+}
+
+bool env_eval_array_cast (s_env *env, s_array *tmp, s_tag *tag,
+ u8 *data, uw size)
+{
+ s_call call;
+ s_tag tag_eval;
+ void *data_eval;
+ assert(env);
+ assert(tmp);
+ assert(tag);
+ assert(data);
+ assert(size);
+ if (! call_init_cast(&call, tmp->type, tag))
+ return false;
+ if (! env_eval_call(env, &call, &tag_eval))
+ return false;
+ data_eval = tag_to_pointer(&tag_eval,
+ array_type_to_tag_type(tmp->type));
+ memcpy(data, data_eval, size);
return true;
}
diff --git a/libc3/list.c b/libc3/list.c
index cbb9edd..8adee3a 100644
--- a/libc3/list.c
+++ b/libc3/list.c
@@ -13,6 +13,7 @@
#include <assert.h>
#include <stdlib.h>
#include <string.h>
+#include "array.h"
#include "buf.h"
#include "buf_inspect.h"
#include "buf_parse.h"
@@ -140,7 +141,7 @@ s_list * list_new (const s_tag *tag, s_list *next)
return list_init(list, tag, next);
}
-s_array * list_to_array (s_list *list, e_tag_type type,
+s_array * list_to_array (s_list *list, const s_sym *type,
s_array *dest)
{
s8 *data;
@@ -151,7 +152,7 @@ s_array * list_to_array (s_list *list, e_tag_type type,
assert(list);
assert(dest);
len = list_length(list);
- size = tag_type_size(type);
+ size = array_type_size(type);
dest->dimension = 1;
dest->type = type;
if (! (dest->dimensions = calloc(1, sizeof(s_array_dimension))))
@@ -163,7 +164,7 @@ s_array * list_to_array (s_list *list, e_tag_type type,
errx(1, "list_to_array: out of memory: 2");
l = list;
while (l) {
- data_list = tag_to_pointer(&l->tag, type);
+ data_list = tag_to_pointer(&l->tag, array_type_to_tag_type(type));
memcpy(data, data_list, size);
data += size;
l = list_next(l);
diff --git a/libc3/list.h b/libc3/list.h
index acf394f..e7a9ae3 100644
--- a/libc3/list.h
+++ b/libc3/list.h
@@ -40,7 +40,7 @@ void list_delete_all (s_list *list);
s_list * list_copy (const s_list *src, s_list **dest);
sw list_length (const s_list *list);
s_list * list_next (const s_list *list);
-s_array * list_to_array (s_list *list, e_tag_type type,
+s_array * list_to_array (s_list *list, const s_sym *type,
s_array *dest);
s_tuple * list_to_tuple_reverse (const s_list *list, s_tuple *dest);
/* Call str_delete after use. */
diff --git a/libc3/sources.mk b/libc3/sources.mk
index 09ca73c..0bd378a 100644
--- a/libc3/sources.mk
+++ b/libc3/sources.mk
@@ -241,6 +241,7 @@ SOURCES = \
timespec.c \
tuple.c \
type.c \
+ u8.c \
ucd.c \
LO_SOURCES = \
@@ -360,6 +361,7 @@ LO_SOURCES = \
timespec.c \
tuple.c \
type.c \
+ u8.c \
ucd.c \
../libtommath/bn_cutoffs.c \
../libtommath/bn_mp_2expt.c \
diff --git a/libc3/sources.sh b/libc3/sources.sh
index c03e5f1..5efae3e 100644
--- a/libc3/sources.sh
+++ b/libc3/sources.sh
@@ -1,4 +1,4 @@
# sources.sh generated by update_sources
HEADERS='abs.h arg.h array.h binding.h bool.h buf.h buf_file.h buf_inspect.h buf_inspect_s16.h buf_inspect_s16_binary.h buf_inspect_s16_decimal.h buf_inspect_s16_hexadecimal.h buf_inspect_s16_octal.h buf_inspect_s32.h buf_inspect_s32_binary.h buf_inspect_s32_decimal.h buf_inspect_s32_hexadecimal.h buf_inspect_s32_octal.h buf_inspect_s64.h buf_inspect_s64_binary.h buf_inspect_s64_decimal.h buf_inspect_s64_hexadecimal.h buf_inspect_s64_octal.h buf_inspect_s8.h buf_inspect_s8_binary.h buf_inspect_s8_decimal.h buf_inspect_s8_hexadecimal.h buf_inspect_s8_octal.h buf_inspect_sw.h buf_inspect_sw_binary.h buf_inspect_sw_decimal.h buf_inspect_sw_hexadecimal.h buf_inspect_sw_octal.h buf_inspect_u16.h buf_inspect_u16_binary.h buf_inspect_u16_decimal.h buf_inspect_u16_hexadecimal.h buf_inspect_u16_octal.h buf_inspect_u32.h buf_inspect_u32_binary.h buf_inspect_u32_decimal.h buf_inspect_u32_hexadecimal.h buf_inspect_u32_octal.h buf_inspect_u64.h buf_inspect_u64_binary.h buf_inspect_u64_decimal.h buf_inspect_u64_hexadecimal.h buf_inspect_u64_octal.h buf_inspect_u8.h buf_inspect_u8_binary.h buf_inspect_u8_decimal.h buf_inspect_u8_hexadecimal.h buf_inspect_u8_octal.h buf_inspect_uw.h buf_inspect_uw_binary.h buf_inspect_uw_decimal.h buf_inspect_uw_hexadecimal.h buf_inspect_uw_octal.h buf_parse.h buf_parse_c.h buf_parse_s16.h buf_parse_s32.h buf_parse_s64.h buf_parse_s8.h buf_parse_sw.h buf_parse_u16.h buf_parse_u32.h buf_parse_u64.h buf_parse_u8.h buf_parse_uw.h buf_save.h c3.h c3_main.h c_types.h call.h ceiling.h cfn.h character.h compare.h config.h env.h error.h error_handler.h eval.h fact.h facts.h facts_cursor.h facts_spec.h facts_spec_cursor.h facts_with.h facts_with_cursor.h file.h float.h fn.h fn_clause.h frame.h hash.h ident.h integer.h io.h list.h log.h module.h operator.h quote.h set__fact.h set__tag.h set_cursor__fact.h set_cursor__tag.h set_item__fact.h set_item__tag.h sha1.h sign.h skiplist__fact.h skiplist_node__fact.h str.h sym.h tag.h timespec.h tuple.h type.h types.h ucd.h '
-SOURCES='abs.c arg.c array.c binding.c bool.c buf.c buf_file.c buf_inspect.c buf_inspect_s16.c buf_inspect_s16_binary.c buf_inspect_s16_decimal.c buf_inspect_s16_hexadecimal.c buf_inspect_s16_octal.c buf_inspect_s32.c buf_inspect_s32_binary.c buf_inspect_s32_decimal.c buf_inspect_s32_hexadecimal.c buf_inspect_s32_octal.c buf_inspect_s64.c buf_inspect_s64_binary.c buf_inspect_s64_decimal.c buf_inspect_s64_hexadecimal.c buf_inspect_s64_octal.c buf_inspect_s8.c buf_inspect_s8_binary.c buf_inspect_s8_decimal.c buf_inspect_s8_hexadecimal.c buf_inspect_s8_octal.c buf_inspect_sw.c buf_inspect_sw_binary.c buf_inspect_sw_decimal.c buf_inspect_sw_hexadecimal.c buf_inspect_sw_octal.c buf_inspect_u16.c buf_inspect_u16_binary.c buf_inspect_u16_decimal.c buf_inspect_u16_hexadecimal.c buf_inspect_u16_octal.c buf_inspect_u32.c buf_inspect_u32_binary.c buf_inspect_u32_decimal.c buf_inspect_u32_hexadecimal.c buf_inspect_u32_octal.c buf_inspect_u64.c buf_inspect_u64_binary.c buf_inspect_u64_decimal.c buf_inspect_u64_hexadecimal.c buf_inspect_u64_octal.c buf_inspect_u8.c buf_inspect_u8_binary.c buf_inspect_u8_decimal.c buf_inspect_u8_hexadecimal.c buf_inspect_u8_octal.c buf_inspect_uw.c buf_inspect_uw_binary.c buf_inspect_uw_decimal.c buf_inspect_uw_hexadecimal.c buf_inspect_uw_octal.c buf_parse.c buf_parse_c.c buf_parse_s16.c buf_parse_s32.c buf_parse_s64.c buf_parse_s8.c buf_parse_sw.c buf_parse_u16.c buf_parse_u32.c buf_parse_u64.c buf_parse_u8.c buf_parse_uw.c buf_save.c c3.c call.c ceiling.c cfn.c character.c compare.c env.c error.c error_handler.c eval.c fact.c facts.c facts_cursor.c facts_spec.c facts_spec_cursor.c facts_with.c facts_with_cursor.c file.c fn.c fn_clause.c frame.c hash.c ident.c integer.c io.c list.c log.c module.c operator.c quote.c set__fact.c set__tag.c set_cursor__fact.c set_cursor__tag.c set_item__fact.c set_item__tag.c sign.c skiplist__fact.c skiplist_node__fact.c str.c sym.c tag.c timespec.c tuple.c type.c ucd.c '
-LO_SOURCES='abs.c arg.c array.c binding.c bool.c buf.c buf_file.c buf_inspect.c buf_inspect_s16.c buf_inspect_s16_binary.c buf_inspect_s16_decimal.c buf_inspect_s16_hexadecimal.c buf_inspect_s16_octal.c buf_inspect_s32.c buf_inspect_s32_binary.c buf_inspect_s32_decimal.c buf_inspect_s32_hexadecimal.c buf_inspect_s32_octal.c buf_inspect_s64.c buf_inspect_s64_binary.c buf_inspect_s64_decimal.c buf_inspect_s64_hexadecimal.c buf_inspect_s64_octal.c buf_inspect_s8.c buf_inspect_s8_binary.c buf_inspect_s8_decimal.c buf_inspect_s8_hexadecimal.c buf_inspect_s8_octal.c buf_inspect_sw.c buf_inspect_sw_binary.c buf_inspect_sw_decimal.c buf_inspect_sw_hexadecimal.c buf_inspect_sw_octal.c buf_inspect_u16.c buf_inspect_u16_binary.c buf_inspect_u16_decimal.c buf_inspect_u16_hexadecimal.c buf_inspect_u16_octal.c buf_inspect_u32.c buf_inspect_u32_binary.c buf_inspect_u32_decimal.c buf_inspect_u32_hexadecimal.c buf_inspect_u32_octal.c buf_inspect_u64.c buf_inspect_u64_binary.c buf_inspect_u64_decimal.c buf_inspect_u64_hexadecimal.c buf_inspect_u64_octal.c buf_inspect_u8.c buf_inspect_u8_binary.c buf_inspect_u8_decimal.c buf_inspect_u8_hexadecimal.c buf_inspect_u8_octal.c buf_inspect_uw.c buf_inspect_uw_binary.c buf_inspect_uw_decimal.c buf_inspect_uw_hexadecimal.c buf_inspect_uw_octal.c buf_parse.c buf_parse_c.c buf_parse_s16.c buf_parse_s32.c buf_parse_s64.c buf_parse_s8.c buf_parse_sw.c buf_parse_u16.c buf_parse_u32.c buf_parse_u64.c buf_parse_u8.c buf_parse_uw.c buf_save.c c3.c call.c ceiling.c cfn.c character.c compare.c env.c error.c error_handler.c eval.c fact.c facts.c facts_cursor.c facts_spec.c facts_spec_cursor.c facts_with.c facts_with_cursor.c file.c fn.c fn_clause.c frame.c hash.c ident.c integer.c io.c list.c log.c module.c operator.c quote.c set__fact.c set__tag.c set_cursor__fact.c set_cursor__tag.c set_item__fact.c set_item__tag.c sign.c skiplist__fact.c skiplist_node__fact.c str.c sym.c tag.c timespec.c tuple.c type.c ucd.c ../libtommath/bn_cutoffs.c ../libtommath/bn_mp_2expt.c ../libtommath/bn_mp_abs.c ../libtommath/bn_mp_add.c ../libtommath/bn_mp_add_d.c ../libtommath/bn_mp_and.c ../libtommath/bn_mp_clamp.c ../libtommath/bn_mp_clear.c ../libtommath/bn_mp_clear_multi.c ../libtommath/bn_mp_cmp.c ../libtommath/bn_mp_cmp_d.c ../libtommath/bn_mp_cmp_mag.c ../libtommath/bn_mp_cnt_lsb.c ../libtommath/bn_mp_complement.c ../libtommath/bn_mp_copy.c ../libtommath/bn_mp_count_bits.c ../libtommath/bn_mp_div.c ../libtommath/bn_mp_div_2.c ../libtommath/bn_mp_div_2d.c ../libtommath/bn_mp_div_3.c ../libtommath/bn_mp_div_d.c ../libtommath/bn_mp_dr_is_modulus.c ../libtommath/bn_mp_dr_reduce.c ../libtommath/bn_mp_dr_setup.c ../libtommath/bn_mp_error_to_string.c ../libtommath/bn_mp_exch.c ../libtommath/bn_mp_exptmod.c ../libtommath/bn_mp_gcd.c ../libtommath/bn_mp_get_double.c ../libtommath/bn_mp_get_i32.c ../libtommath/bn_mp_get_i64.c ../libtommath/bn_mp_get_mag_u32.c ../libtommath/bn_mp_get_mag_u64.c ../libtommath/bn_mp_grow.c ../libtommath/bn_mp_init.c ../libtommath/bn_mp_init_copy.c ../libtommath/bn_mp_init_multi.c ../libtommath/bn_mp_init_size.c ../libtommath/bn_mp_invmod.c ../libtommath/bn_mp_lcm.c ../libtommath/bn_mp_lshd.c ../libtommath/bn_mp_mod.c ../libtommath/bn_mp_mod_2d.c ../libtommath/bn_mp_montgomery_calc_normalization.c ../libtommath/bn_mp_montgomery_reduce.c ../libtommath/bn_mp_montgomery_setup.c ../libtommath/bn_mp_mul.c ../libtommath/bn_mp_mul_2.c ../libtommath/bn_mp_mul_2d.c ../libtommath/bn_mp_mul_d.c ../libtommath/bn_mp_mulmod.c ../libtommath/bn_mp_neg.c ../libtommath/bn_mp_or.c ../libtommath/bn_mp_radix_size.c ../libtommath/bn_mp_reduce.c ../libtommath/bn_mp_reduce_2k.c ../libtommath/bn_mp_reduce_2k_l.c ../libtommath/bn_mp_reduce_2k_setup.c ../libtommath/bn_mp_reduce_2k_setup_l.c ../libtommath/bn_mp_reduce_is_2k.c ../libtommath/bn_mp_reduce_is_2k_l.c ../libtommath/bn_mp_reduce_setup.c ../libtommath/bn_mp_rshd.c ../libtommath/bn_mp_set.c ../libtommath/bn_mp_set_double.c ../libtommath/bn_mp_set_i32.c ../libtommath/bn_mp_set_i64.c ../libtommath/bn_mp_set_l.c ../libtommath/bn_mp_set_u32.c ../libtommath/bn_mp_set_u64.c ../libtommath/bn_mp_set_ul.c ../libtommath/bn_mp_sqr.c ../libtommath/bn_mp_sqrt.c ../libtommath/bn_mp_sub.c ../libtommath/bn_mp_sub_d.c ../libtommath/bn_mp_xor.c ../libtommath/bn_mp_zero.c ../libtommath/bn_s_mp_add.c ../libtommath/bn_s_mp_balance_mul.c ../libtommath/bn_s_mp_exptmod.c ../libtommath/bn_s_mp_exptmod_fast.c ../libtommath/bn_s_mp_invmod_fast.c ../libtommath/bn_s_mp_invmod_slow.c ../libtommath/bn_s_mp_karatsuba_mul.c ../libtommath/bn_s_mp_karatsuba_sqr.c ../libtommath/bn_s_mp_montgomery_reduce_fast.c ../libtommath/bn_s_mp_mul_digs.c ../libtommath/bn_s_mp_mul_digs_fast.c ../libtommath/bn_s_mp_mul_high_digs.c ../libtommath/bn_s_mp_mul_high_digs_fast.c ../libtommath/bn_s_mp_rand_platform.c ../libtommath/bn_s_mp_sqr.c ../libtommath/bn_s_mp_sqr_fast.c ../libtommath/bn_s_mp_sub.c ../libtommath/bn_s_mp_toom_mul.c ../libtommath/bn_s_mp_toom_sqr.c '
+SOURCES='abs.c arg.c array.c binding.c bool.c buf.c buf_file.c buf_inspect.c buf_inspect_s16.c buf_inspect_s16_binary.c buf_inspect_s16_decimal.c buf_inspect_s16_hexadecimal.c buf_inspect_s16_octal.c buf_inspect_s32.c buf_inspect_s32_binary.c buf_inspect_s32_decimal.c buf_inspect_s32_hexadecimal.c buf_inspect_s32_octal.c buf_inspect_s64.c buf_inspect_s64_binary.c buf_inspect_s64_decimal.c buf_inspect_s64_hexadecimal.c buf_inspect_s64_octal.c buf_inspect_s8.c buf_inspect_s8_binary.c buf_inspect_s8_decimal.c buf_inspect_s8_hexadecimal.c buf_inspect_s8_octal.c buf_inspect_sw.c buf_inspect_sw_binary.c buf_inspect_sw_decimal.c buf_inspect_sw_hexadecimal.c buf_inspect_sw_octal.c buf_inspect_u16.c buf_inspect_u16_binary.c buf_inspect_u16_decimal.c buf_inspect_u16_hexadecimal.c buf_inspect_u16_octal.c buf_inspect_u32.c buf_inspect_u32_binary.c buf_inspect_u32_decimal.c buf_inspect_u32_hexadecimal.c buf_inspect_u32_octal.c buf_inspect_u64.c buf_inspect_u64_binary.c buf_inspect_u64_decimal.c buf_inspect_u64_hexadecimal.c buf_inspect_u64_octal.c buf_inspect_u8.c buf_inspect_u8_binary.c buf_inspect_u8_decimal.c buf_inspect_u8_hexadecimal.c buf_inspect_u8_octal.c buf_inspect_uw.c buf_inspect_uw_binary.c buf_inspect_uw_decimal.c buf_inspect_uw_hexadecimal.c buf_inspect_uw_octal.c buf_parse.c buf_parse_c.c buf_parse_s16.c buf_parse_s32.c buf_parse_s64.c buf_parse_s8.c buf_parse_sw.c buf_parse_u16.c buf_parse_u32.c buf_parse_u64.c buf_parse_u8.c buf_parse_uw.c buf_save.c c3.c call.c ceiling.c cfn.c character.c compare.c env.c error.c error_handler.c eval.c fact.c facts.c facts_cursor.c facts_spec.c facts_spec_cursor.c facts_with.c facts_with_cursor.c file.c fn.c fn_clause.c frame.c hash.c ident.c integer.c io.c list.c log.c module.c operator.c quote.c set__fact.c set__tag.c set_cursor__fact.c set_cursor__tag.c set_item__fact.c set_item__tag.c sign.c skiplist__fact.c skiplist_node__fact.c str.c sym.c tag.c timespec.c tuple.c type.c u8.c ucd.c '
+LO_SOURCES='abs.c arg.c array.c binding.c bool.c buf.c buf_file.c buf_inspect.c buf_inspect_s16.c buf_inspect_s16_binary.c buf_inspect_s16_decimal.c buf_inspect_s16_hexadecimal.c buf_inspect_s16_octal.c buf_inspect_s32.c buf_inspect_s32_binary.c buf_inspect_s32_decimal.c buf_inspect_s32_hexadecimal.c buf_inspect_s32_octal.c buf_inspect_s64.c buf_inspect_s64_binary.c buf_inspect_s64_decimal.c buf_inspect_s64_hexadecimal.c buf_inspect_s64_octal.c buf_inspect_s8.c buf_inspect_s8_binary.c buf_inspect_s8_decimal.c buf_inspect_s8_hexadecimal.c buf_inspect_s8_octal.c buf_inspect_sw.c buf_inspect_sw_binary.c buf_inspect_sw_decimal.c buf_inspect_sw_hexadecimal.c buf_inspect_sw_octal.c buf_inspect_u16.c buf_inspect_u16_binary.c buf_inspect_u16_decimal.c buf_inspect_u16_hexadecimal.c buf_inspect_u16_octal.c buf_inspect_u32.c buf_inspect_u32_binary.c buf_inspect_u32_decimal.c buf_inspect_u32_hexadecimal.c buf_inspect_u32_octal.c buf_inspect_u64.c buf_inspect_u64_binary.c buf_inspect_u64_decimal.c buf_inspect_u64_hexadecimal.c buf_inspect_u64_octal.c buf_inspect_u8.c buf_inspect_u8_binary.c buf_inspect_u8_decimal.c buf_inspect_u8_hexadecimal.c buf_inspect_u8_octal.c buf_inspect_uw.c buf_inspect_uw_binary.c buf_inspect_uw_decimal.c buf_inspect_uw_hexadecimal.c buf_inspect_uw_octal.c buf_parse.c buf_parse_c.c buf_parse_s16.c buf_parse_s32.c buf_parse_s64.c buf_parse_s8.c buf_parse_sw.c buf_parse_u16.c buf_parse_u32.c buf_parse_u64.c buf_parse_u8.c buf_parse_uw.c buf_save.c c3.c call.c ceiling.c cfn.c character.c compare.c env.c error.c error_handler.c eval.c fact.c facts.c facts_cursor.c facts_spec.c facts_spec_cursor.c facts_with.c facts_with_cursor.c file.c fn.c fn_clause.c frame.c hash.c ident.c integer.c io.c list.c log.c module.c operator.c quote.c set__fact.c set__tag.c set_cursor__fact.c set_cursor__tag.c set_item__fact.c set_item__tag.c sign.c skiplist__fact.c skiplist_node__fact.c str.c sym.c tag.c timespec.c tuple.c type.c u8.c ucd.c ../libtommath/bn_cutoffs.c ../libtommath/bn_mp_2expt.c ../libtommath/bn_mp_abs.c ../libtommath/bn_mp_add.c ../libtommath/bn_mp_add_d.c ../libtommath/bn_mp_and.c ../libtommath/bn_mp_clamp.c ../libtommath/bn_mp_clear.c ../libtommath/bn_mp_clear_multi.c ../libtommath/bn_mp_cmp.c ../libtommath/bn_mp_cmp_d.c ../libtommath/bn_mp_cmp_mag.c ../libtommath/bn_mp_cnt_lsb.c ../libtommath/bn_mp_complement.c ../libtommath/bn_mp_copy.c ../libtommath/bn_mp_count_bits.c ../libtommath/bn_mp_div.c ../libtommath/bn_mp_div_2.c ../libtommath/bn_mp_div_2d.c ../libtommath/bn_mp_div_3.c ../libtommath/bn_mp_div_d.c ../libtommath/bn_mp_dr_is_modulus.c ../libtommath/bn_mp_dr_reduce.c ../libtommath/bn_mp_dr_setup.c ../libtommath/bn_mp_error_to_string.c ../libtommath/bn_mp_exch.c ../libtommath/bn_mp_exptmod.c ../libtommath/bn_mp_gcd.c ../libtommath/bn_mp_get_double.c ../libtommath/bn_mp_get_i32.c ../libtommath/bn_mp_get_i64.c ../libtommath/bn_mp_get_mag_u32.c ../libtommath/bn_mp_get_mag_u64.c ../libtommath/bn_mp_grow.c ../libtommath/bn_mp_init.c ../libtommath/bn_mp_init_copy.c ../libtommath/bn_mp_init_multi.c ../libtommath/bn_mp_init_size.c ../libtommath/bn_mp_invmod.c ../libtommath/bn_mp_lcm.c ../libtommath/bn_mp_lshd.c ../libtommath/bn_mp_mod.c ../libtommath/bn_mp_mod_2d.c ../libtommath/bn_mp_montgomery_calc_normalization.c ../libtommath/bn_mp_montgomery_reduce.c ../libtommath/bn_mp_montgomery_setup.c ../libtommath/bn_mp_mul.c ../libtommath/bn_mp_mul_2.c ../libtommath/bn_mp_mul_2d.c ../libtommath/bn_mp_mul_d.c ../libtommath/bn_mp_mulmod.c ../libtommath/bn_mp_neg.c ../libtommath/bn_mp_or.c ../libtommath/bn_mp_radix_size.c ../libtommath/bn_mp_reduce.c ../libtommath/bn_mp_reduce_2k.c ../libtommath/bn_mp_reduce_2k_l.c ../libtommath/bn_mp_reduce_2k_setup.c ../libtommath/bn_mp_reduce_2k_setup_l.c ../libtommath/bn_mp_reduce_is_2k.c ../libtommath/bn_mp_reduce_is_2k_l.c ../libtommath/bn_mp_reduce_setup.c ../libtommath/bn_mp_rshd.c ../libtommath/bn_mp_set.c ../libtommath/bn_mp_set_double.c ../libtommath/bn_mp_set_i32.c ../libtommath/bn_mp_set_i64.c ../libtommath/bn_mp_set_l.c ../libtommath/bn_mp_set_u32.c ../libtommath/bn_mp_set_u64.c ../libtommath/bn_mp_set_ul.c ../libtommath/bn_mp_sqr.c ../libtommath/bn_mp_sqrt.c ../libtommath/bn_mp_sub.c ../libtommath/bn_mp_sub_d.c ../libtommath/bn_mp_xor.c ../libtommath/bn_mp_zero.c ../libtommath/bn_s_mp_add.c ../libtommath/bn_s_mp_balance_mul.c ../libtommath/bn_s_mp_exptmod.c ../libtommath/bn_s_mp_exptmod_fast.c ../libtommath/bn_s_mp_invmod_fast.c ../libtommath/bn_s_mp_invmod_slow.c ../libtommath/bn_s_mp_karatsuba_mul.c ../libtommath/bn_s_mp_karatsuba_sqr.c ../libtommath/bn_s_mp_montgomery_reduce_fast.c ../libtommath/bn_s_mp_mul_digs.c ../libtommath/bn_s_mp_mul_digs_fast.c ../libtommath/bn_s_mp_mul_high_digs.c ../libtommath/bn_s_mp_mul_high_digs_fast.c ../libtommath/bn_s_mp_rand_platform.c ../libtommath/bn_s_mp_sqr.c ../libtommath/bn_s_mp_sqr_fast.c ../libtommath/bn_s_mp_sub.c ../libtommath/bn_s_mp_toom_mul.c ../libtommath/bn_s_mp_toom_sqr.c '
diff --git a/libc3/tag.c b/libc3/tag.c
index 51f10c6..42c08fe 100644
--- a/libc3/tag.c
+++ b/libc3/tag.c
@@ -3948,7 +3948,7 @@ sw tag_type_size (e_tag_type type)
return sizeof(s_tag);
}
assert(! "tag_type_size: invalid tag type");
- errx(1, "tag_type_size: invalid tag type");
+ errx(1, "tag_type_size: invalid tag type: %d", type);
return -1;
}
diff --git a/libc3/types.h b/libc3/types.h
index a7cd61d..fd51755 100644
--- a/libc3/types.h
+++ b/libc3/types.h
@@ -327,11 +327,13 @@ struct type {
/* 4 */
struct array {
+ uw count;
uw dimension;
- e_tag_type type;
s_array_dimension *dimensions;
- uw size;
void *data;
+ uw size;
+ s_tag *tags;
+ const s_sym *type;
};
diff --git a/libc3/u8.c b/libc3/u8.c
new file mode 100644
index 0000000..0902351
--- /dev/null
+++ b/libc3/u8.c
@@ -0,0 +1,80 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#include <assert.h>
+#include <err.h>
+#include "integer.h"
+#include "tag.h"
+#include "u8.h"
+
+u8 u8_cast (s_tag *tag)
+{
+ switch (tag->type) {
+ case TAG_VOID:
+ return 0;
+ case TAG_ARRAY:
+ goto ko;
+ case TAG_BOOL:
+ return tag->data.bool ? 1 : 0;
+ case TAG_CALL:
+ goto ko;
+ case TAG_CFN:
+ goto ko;
+ case TAG_CHARACTER:
+ return (u8) tag->data.character;
+ case TAG_F32:
+ return (u8) tag->data.f32;
+ case TAG_F64:
+ return (u8) tag->data.f64;
+ case TAG_FACT:
+ case TAG_FN:
+ case TAG_IDENT:
+ goto ko;
+ case TAG_INTEGER:
+ return integer_to_u8(&tag->data.integer);
+ case TAG_SW:
+ return (u8) tag->data.sw;
+ case TAG_S64:
+ return (u8) tag->data.s64;
+ case TAG_S32:
+ return (u8) tag->data.s32;
+ case TAG_S16:
+ return (u8) tag->data.s16;
+ case TAG_S8:
+ return (u8) tag->data.s8;
+ case TAG_U8:
+ return tag->data.u8;
+ case TAG_U16:
+ return (u8) tag->data.u16;
+ case TAG_U32:
+ return (u8) tag->data.u32;
+ case TAG_U64:
+ return (u8) tag->data.u64;
+ case TAG_UW:
+ return (u8) tag->data.uw;
+ case TAG_LIST:
+ case TAG_PTAG:
+ case TAG_QUOTE:
+ case TAG_STR:
+ case TAG_SYM:
+ case TAG_TUPLE:
+ case TAG_VAR:
+ goto ko;
+ }
+ assert(! "u8_cast: unknown tag type");
+ errx(1, "u8_cast: unknown tag type: %d", tag->type);
+ return 0;
+ ko:
+ warnx("u8_cast: cannot cast %s to u8",
+ tag_type_to_sym(tag->type)->str.ptr.ps8);
+ return 0;
+}
diff --git a/libc3/u8.h b/libc3/u8.h
new file mode 100644
index 0000000..1b39093
--- /dev/null
+++ b/libc3/u8.h
@@ -0,0 +1,26 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/**
+ * @file u8.h
+ * @brief U8 operations.
+ *
+ * Structure to manipulate u8 (unsigned 8-bit) data.
+ */
+#ifndef U8_H
+#define U8_H
+
+#include "types.h"
+
+u8 u8_cast (s_tag *tag);
+
+#endif /* U8_H */
diff --git a/sources.mk b/sources.mk
index d523517..576d4d5 100644
--- a/sources.mk
+++ b/sources.mk
@@ -5,8 +5,8 @@ C3_CONFIGURES = \
c3s/update_sources \
ic3/configure \
ic3/update_sources \
- libc3/update_sources \
libc3/configure \
+ libc3/update_sources \
libtommath/configure \
libtommath/update_sources \
test/configure \
@@ -28,314 +28,315 @@ C3_C_SOURCES = \
c3s/buf_readline.c \
c3s/c3s.c \
c3s/buf_readline.h \
- ic3/buf_linenoise.c \
ic3/ic3.c \
+ ic3/buf_linenoise.c \
ic3/buf_linenoise.h \
ic3/linenoise.c \
- libc3/buf_parse_u64.h \
- libc3/buf_parse_uw.c \
- libc3/buf_parse_uw.h \
+ libc3/abs.c \
+ libc3/abs.h \
+ libc3/buf.c \
+ libc3/buf.h \
+ libc3/buf_inspect_s8_decimal.c \
+ libc3/buf_inspect_s8_decimal.h \
+ libc3/buf_inspect_s8_hexadecimal.c \
+ libc3/buf_inspect_s8_hexadecimal.h \
+ libc3/buf_inspect_s16.c \
+ libc3/buf_inspect_s16.h \
+ libc3/buf_inspect_s16_binary.c \
+ libc3/buf_parse_s8.c \
+ libc3/call.c \
libc3/arg.c \
libc3/arg.h \
- libc3/set__fact.c \
- libc3/set__fact.h \
- libc3/set__tag.c \
- libc3/set__tag.h \
- libc3/set_cursor__fact.c \
- libc3/set_cursor__fact.h \
- libc3/set_cursor__tag.c \
- libc3/set_cursor__tag.h \
- libc3/set_item__fact.c \
- libc3/set_item__fact.h \
- libc3/set_item__tag.c \
- libc3/set_item__tag.h \
- libc3/integer.c \
- libc3/binding.c \
- libc3/binding.h \
- libc3/facts_with_cursor.c \
libc3/array.c \
libc3/array.h \
- libc3/buf.c \
- libc3/buf_parse.c \
- libc3/integer.h \
- libc3/types.h \
- libc3/type.c \
- libc3/buf_inspect_s8.c \
- libc3/buf_inspect_s8.h \
- libc3/buf_inspect_s16.c \
- libc3/buf_inspect_s16.h \
+ libc3/binding.c \
+ libc3/c3.c \
+ libc3/buf_inspect_s16_binary.h \
+ libc3/buf_inspect_s16_octal.c \
+ libc3/buf_inspect_s16_octal.h \
+ libc3/buf_inspect_s16_decimal.c \
+ libc3/binding.h \
+ libc3/buf_inspect_s16_decimal.h \
+ libc3/buf_inspect_s16_hexadecimal.c \
+ libc3/buf_inspect_s16_hexadecimal.h \
libc3/buf_inspect_s32.c \
libc3/buf_inspect_s32.h \
- libc3/buf_file.c \
- libc3/buf_file.h \
+ libc3/buf_inspect_s32_binary.c \
+ libc3/buf_inspect_s32_binary.h \
libc3/bool.c \
- libc3/io.h \
- libc3/skiplist__fact.c \
- libc3/skiplist__fact.h \
- libc3/skiplist_node__fact.c \
- libc3/skiplist_node__fact.h \
- libc3/io.c \
- libc3/abs.h \
- libc3/fn_clause.c \
- libc3/file.c \
- libc3/ceiling.c \
- libc3/buf_parse_c.c \
- libc3/buf_parse_c.h \
- libc3/buf_save.c \
- libc3/buf_parse.h \
- libc3/compare.c \
- libc3/buf_inspect_u64_hexadecimal.h \
- libc3/buf_inspect_uw.h \
- libc3/buf_parse_s8.c \
- libc3/buf_parse_s8.h \
- libc3/buf_parse_s16.c \
- libc3/buf_parse_s16.h \
- libc3/buf_parse_s32.c \
- libc3/buf_parse_s32.h \
- libc3/buf_parse_s64.c \
- libc3/call.h \
libc3/bool.h \
- libc3/buf_save.h \
- libc3/fact.h \
- libc3/error.c \
- libc3/error.h \
- libc3/env.h \
- libc3/character.h \
- libc3/compare.h \
- libc3/operator.h \
- libc3/operator.c \
- libc3/tag.h \
- libc3/sign.h \
- libc3/buf.h \
+ libc3/buf_file.c \
+ libc3/buf_file.h \
+ libc3/buf_inspect_s32_octal.c \
+ libc3/buf_inspect_s32_octal.h \
+ libc3/buf_inspect_s32_decimal.c \
+ libc3/buf_inspect_s32_decimal.h \
+ libc3/buf_inspect_s32_hexadecimal.c \
+ libc3/buf_inspect_s32_hexadecimal.h \
libc3/buf_inspect_s64.c \
libc3/buf_inspect_s64.h \
+ libc3/buf_inspect_s64_binary.c \
+ libc3/buf_inspect_s64_binary.h \
+ libc3/buf_inspect_s64_octal.c \
+ libc3/buf_inspect_s64_octal.h \
+ libc3/buf_parse.h \
+ libc3/buf_parse_c.c \
+ libc3/buf_save.c \
+ libc3/buf_inspect_s64_decimal.c \
+ libc3/facts_spec_cursor.c \
+ libc3/buf_inspect_s64_decimal.h \
+ libc3/buf_inspect_s64_hexadecimal.c \
+ libc3/buf_inspect_s64_hexadecimal.h \
libc3/buf_inspect_sw.c \
libc3/buf_inspect_sw.h \
+ libc3/buf_inspect_sw_binary.c \
+ libc3/buf_inspect_sw_binary.h \
+ libc3/buf_inspect_sw_octal.c \
+ libc3/buf_inspect_sw_octal.h \
+ libc3/buf_inspect_sw_decimal.c \
+ libc3/buf_inspect_sw_decimal.h \
+ libc3/buf_parse_c.h \
+ libc3/buf_save.h \
+ libc3/c3.h \
+ libc3/c_types.h \
+ libc3/call.h \
+ libc3/buf_inspect_sw_hexadecimal.c \
+ libc3/buf_inspect_sw_hexadecimal.h \
libc3/buf_inspect_u8.c \
libc3/buf_inspect_u8.h \
+ libc3/buf_inspect_u8_binary.c \
+ libc3/buf_inspect_u8_binary.h \
+ libc3/buf_inspect_u8_octal.c \
+ libc3/buf_inspect_u8_octal.h \
+ libc3/buf_inspect_u8_decimal.c \
+ libc3/buf_inspect_u8_decimal.h \
+ libc3/buf_inspect_u8_hexadecimal.c \
+ libc3/buf_inspect_u8_hexadecimal.h \
+ libc3/ceiling.c \
+ libc3/ceiling.h \
+ libc3/cfn.c \
+ libc3/cfn.h \
+ libc3/character.c \
+ libc3/character.h \
libc3/buf_inspect_u16.c \
+ libc3/buf_inspect_u16.h \
+ libc3/buf_inspect_u16_binary.c \
+ libc3/buf_inspect_u16_binary.h \
+ libc3/buf_inspect_u16_octal.c \
+ libc3/buf_inspect_u16_octal.h \
+ libc3/buf_inspect_u16_decimal.c \
+ libc3/buf_inspect_u16_decimal.h \
+ libc3/buf_inspect_u16_hexadecimal.c \
+ libc3/buf_inspect_u16_hexadecimal.h \
+ libc3/buf_inspect_u32.c \
+ libc3/buf_inspect_u32.h \
+ libc3/compare.c \
+ libc3/buf_inspect.c \
+ libc3/compare.h \
+ libc3/buf_parse.c \
+ libc3/timespec.h \
+ libc3/operator.c \
+ libc3/operator.h \
+ libc3/sym.c \
+ libc3/buf_inspect_s8.c \
+ libc3/buf_inspect_s8.h \
+ libc3/buf_inspect_s8_binary.c \
+ libc3/buf_inspect_s8_binary.h \
+ libc3/buf_inspect_s8_octal.c \
+ libc3/buf_inspect_s8_octal.h \
+ libc3/error.c \
+ libc3/error.h \
libc3/error_handler.c \
- libc3/set_cursor.c.in \
- libc3/set_cursor.h.in \
- libc3/set_item.c.in \
- libc3/set_item.h.in \
libc3/error_handler.h \
libc3/eval.c \
libc3/eval.h \
+ libc3/buf_inspect_u32_binary.c \
+ libc3/buf_inspect_u32_binary.h \
+ libc3/buf_inspect_u32_octal.c \
+ libc3/buf_inspect_u32_octal.h \
+ libc3/buf_inspect_u32_decimal.c \
+ libc3/buf_inspect_u32_decimal.h \
+ libc3/buf_inspect_u32_hexadecimal.c \
+ libc3/buf_inspect_u32_hexadecimal.h \
+ libc3/buf_inspect_u64.c \
+ libc3/buf_inspect_u64.h \
+ libc3/buf_inspect_u64_binary.c \
+ libc3/set__fact.c \
libc3/fact.c \
- libc3/facts.h \
+ libc3/fact.h \
libc3/facts_cursor.c \
- libc3/fn.h \
- libc3/ceiling.h \
libc3/buf_inspect_u64_binary.h \
libc3/buf_inspect_u64_octal.c \
libc3/buf_inspect_u64_octal.h \
libc3/buf_inspect_u64_decimal.c \
libc3/buf_inspect_u64_decimal.h \
libc3/buf_inspect_u64_hexadecimal.c \
- libc3/sym.c \
+ libc3/buf_inspect_u64_hexadecimal.h \
+ libc3/buf_inspect_uw.c \
+ libc3/buf_inspect_uw.h \
+ libc3/buf_inspect_uw_binary.c \
+ libc3/buf_inspect_uw_binary.h \
+ libc3/buf_inspect_uw_octal.c \
+ libc3/buf_inspect_uw_octal.h \
+ libc3/set__fact.h \
libc3/facts_cursor.h \
libc3/facts_spec.c \
- libc3/frame.h \
- libc3/sign.c \
- libc3/skiplist.c.in \
- libc3/timespec.h \
libc3/facts_spec.h \
- libc3/facts_spec_cursor.c \
- libc3/hash.c \
libc3/facts_spec_cursor.h \
- libc3/buf_inspect_s16_binary.h \
- libc3/buf_inspect_s16_decimal.c \
- libc3/buf_inspect_s16_decimal.h \
- libc3/buf_inspect_s16_hexadecimal.c \
- libc3/buf_inspect_s16_hexadecimal.h \
- libc3/c3.c \
- libc3/facts_with.c \
- libc3/facts_with.h \
- libc3/ident.c \
- libc3/buf_parse_u.c.in \
- libc3/fn_clause.h \
- libc3/abs.c \
- libc3/facts_with_cursor.h \
- libc3/ident.h \
- libc3/str.c \
- libc3/c_types.h \
+ libc3/buf_inspect_uw_decimal.c \
+ libc3/buf_inspect_uw_decimal.h \
+ libc3/buf_inspect_uw_hexadecimal.c \
+ libc3/buf_inspect_uw_hexadecimal.h \
+ libc3/buf_parse_s8.h \
+ libc3/buf_parse_s16.c \
+ libc3/buf_parse_s16.h \
+ libc3/buf_parse_s32.c \
+ libc3/buf_parse_s32.h \
+ libc3/buf_parse_s64.c \
libc3/buf_parse_s64.h \
libc3/buf_parse_sw.c \
libc3/buf_parse_sw.h \
libc3/buf_parse_u8.c \
+ libc3/set__tag.c \
+ libc3/facts_with.c \
+ libc3/facts_with.h \
+ libc3/facts_with_cursor.c \
libc3/buf_parse_u8.h \
- libc3/buf_parse_s.c.in \
libc3/buf_parse_u16.c \
libc3/buf_parse_u16.h \
libc3/buf_parse_u32.c \
libc3/buf_parse_u32.h \
libc3/buf_parse_u64.c \
- libc3/buf_inspect.c \
- libc3/set.c.in \
+ libc3/buf_parse_u64.h \
+ libc3/buf_parse_uw.c \
+ libc3/buf_parse_uw.h \
+ libc3/set__tag.h \
+ libc3/set_cursor__fact.c \
+ libc3/set_cursor__fact.h \
+ libc3/set_cursor__tag.c \
+ libc3/set_cursor__tag.h \
+ libc3/set_item__fact.c \
+ libc3/set_item__fact.h \
+ libc3/set_item__tag.c \
+ libc3/facts_with_cursor.h \
+ libc3/float.h \
+ libc3/frame.c \
+ libc3/frame.h \
+ libc3/set_item__tag.h \
+ libc3/skiplist__fact.c \
+ libc3/skiplist__fact.h \
+ libc3/skiplist_node__fact.c \
+ libc3/skiplist_node__fact.h \
+ libc3/types.h \
+ libc3/hash.h \
+ libc3/ident.h \
+ libc3/integer.c \
+ libc3/integer.h \
+ libc3/io.c \
+ libc3/io.h \
libc3/list.c \
+ libc3/list.h \
libc3/log.c \
libc3/log.h \
- libc3/sym.h \
- libc3/c3.h \
+ libc3/buf_inspect_s.h.in \
libc3/module.c \
+ libc3/str.c \
+ libc3/module.h \
+ libc3/buf_parse_u.c.in \
libc3/quote.c \
libc3/quote.h \
- libc3/character.c \
- libc3/cfn.c \
- libc3/fn.c \
- libc3/module.h \
+ libc3/set.c.in \
libc3/set.h.in \
- libc3/tag.c \
- libc3/skiplist.h.in \
+ libc3/buf_inspect_s_base.h.in \
libc3/sha1.h \
+ libc3/set_cursor.c.in \
+ libc3/set_cursor.h.in \
+ libc3/buf_inspect.h \
+ libc3/set_item.c.in \
+ libc3/set_item.h.in \
+ libc3/sign.c \
+ libc3/sign.h \
+ libc3/skiplist.c.in \
+ libc3/skiplist.h.in \
+ libc3/type.h \
libc3/skiplist_node.c.in \
libc3/skiplist_node.h.in \
+ libc3/str.h \
+ libc3/ucd.c \
+ libc3/sym.h \
libc3/tuple.c \
libc3/tuple.h \
- libc3/ucd.c \
+ libc3/type.c \
libc3/ucd.h \
- libc3/str.h \
- libc3/type.h \
+ libc3/buf_parse_s.c.in \
libc3/buf_parse_s.h.in \
+ libc3/buf_inspect_s.c.in \
libc3/buf_parse_u.h.in \
- libc3/facts.c \
- libc3/float.h \
- libc3/frame.c \
+ libc3/env.c \
+ libc3/ident.c \
libc3/buf_inspect_s_base.c.in \
- libc3/buf_inspect_s.c.in \
- libc3/buf_inspect_u16.h \
- libc3/buf_inspect_s.h.in \
- libc3/buf_inspect_u32.c \
- libc3/buf_inspect_u32.h \
- libc3/buf_inspect_u64.c \
- libc3/buf_inspect_u64.h \
libc3/buf_inspect_u.c.in \
- libc3/buf_inspect_u64_binary.c \
- libc3/buf_inspect_uw.c \
- libc3/buf_inspect_u_base.c.in \
libc3/buf_inspect_u.h.in \
+ libc3/env.h \
+ libc3/buf_inspect_u_base.c.in \
libc3/buf_inspect_u_base.h.in \
- libc3/cfn.h \
- libc3/buf_inspect_s16_binary.c \
- libc3/file.h \
- libc3/buf_inspect_s16_octal.c \
- libc3/buf_inspect_s16_octal.h \
- libc3/buf_inspect_s32_binary.c \
- libc3/buf_inspect_s32_binary.h \
- libc3/buf_inspect_s32_decimal.c \
- libc3/buf_inspect_s32_decimal.h \
- libc3/buf_inspect_s32_hexadecimal.c \
- libc3/buf_inspect_s32_hexadecimal.h \
- libc3/buf_inspect_s32_octal.c \
- libc3/buf_inspect_s32_octal.h \
- libc3/buf_inspect_s64_binary.c \
- libc3/buf_inspect_s64_binary.h \
- libc3/buf_inspect_s64_decimal.c \
- libc3/buf_inspect_s64_decimal.h \
- libc3/buf_inspect_s64_hexadecimal.c \
- libc3/buf_inspect_s64_hexadecimal.h \
- libc3/buf_inspect_s64_octal.c \
- libc3/buf_inspect_s64_octal.h \
- libc3/buf_inspect_s8_binary.c \
- libc3/buf_inspect_s8_binary.h \
- libc3/buf_inspect_s8_decimal.c \
- libc3/buf_inspect_s8_decimal.h \
- libc3/buf_inspect_s8_hexadecimal.c \
- libc3/buf_inspect_s8_hexadecimal.h \
- libc3/buf_inspect_s8_octal.c \
- libc3/buf_inspect_s8_octal.h \
- libc3/buf_inspect_sw_binary.c \
- libc3/buf_inspect_sw_binary.h \
- libc3/buf_inspect_sw_decimal.c \
- libc3/buf_inspect_sw_decimal.h \
- libc3/buf_inspect_sw_hexadecimal.c \
- libc3/buf_inspect_sw_hexadecimal.h \
- libc3/buf_inspect_sw_octal.c \
- libc3/buf_inspect_sw_octal.h \
- libc3/buf_inspect_u16_binary.c \
- libc3/buf_inspect_u16_binary.h \
- libc3/buf_inspect_u16_decimal.c \
- libc3/buf_inspect_u16_decimal.h \
- libc3/buf_inspect.h \
- libc3/buf_inspect_u16_hexadecimal.c \
- libc3/buf_inspect_u16_hexadecimal.h \
- libc3/buf_inspect_u16_octal.c \
- libc3/buf_inspect_u16_octal.h \
- libc3/buf_inspect_u32_binary.c \
- libc3/buf_inspect_u32_binary.h \
- libc3/buf_inspect_u32_decimal.c \
- libc3/buf_inspect_u32_decimal.h \
- libc3/buf_inspect_u32_hexadecimal.c \
- libc3/buf_inspect_u32_hexadecimal.h \
- libc3/buf_inspect_u32_octal.c \
- libc3/buf_inspect_u32_octal.h \
- libc3/buf_inspect_uw_binary.c \
- libc3/buf_inspect_uw_binary.h \
- libc3/buf_inspect_uw_decimal.c \
- libc3/buf_inspect_uw_decimal.h \
- libc3/buf_inspect_uw_hexadecimal.c \
- libc3/buf_inspect_uw_hexadecimal.h \
- libc3/buf_inspect_uw_octal.c \
- libc3/buf_inspect_uw_octal.h \
- libc3/env.c \
libc3/timespec.c \
- libc3/buf_inspect_s_base.h.in \
- libc3/buf_inspect_u8_binary.c \
- libc3/buf_inspect_u8_binary.h \
- libc3/buf_inspect_u8_decimal.c \
- libc3/buf_inspect_u8_decimal.h \
- libc3/buf_inspect_u8_hexadecimal.c \
- libc3/buf_inspect_u8_hexadecimal.h \
- libc3/buf_inspect_u8_octal.c \
- libc3/buf_inspect_u8_octal.h \
- libc3/list.h \
+ libc3/fn.c \
+ libc3/fn.h \
+ libc3/tag.h \
+ libc3/fn_clause.h \
+ libc3/fn_clause.c \
+ libc3/facts.c \
+ libc3/u8.c \
+ libc3/facts.h \
+ libc3/file.c \
libc3/c3_main.h \
- libc3/call.c \
- libc3/hash.h \
- test/facts_cursor_test.c \
- test/facts_test.c \
- test/facts_with_test.c \
- test/set__fact_test.c \
- test/fn_test.c \
- test/test.c \
+ libc3/file.h \
+ libc3/hash.c \
+ libc3/tag.c \
+ test/buf_inspect_test.c \
+ test/bool_test.c \
test/buf_parse_test.c \
- test/array_test.c \
- test/compare_test.c \
- test/set__tag_test.c \
- test/tag_test.c \
- test/sym_test.c \
- test/tag_test.h \
- test/tuple_test.c \
- test/types_test.c \
- test/call_test.c \
- test/skiplist__fact_test.c \
- test/fact_test.c \
- test/compare_test.h \
- test/fact_test.h \
- test/str_test.c \
+ test/facts_test.c \
+ test/buf_file_test.c \
test/list_test.c \
- test/env_test.c \
- test/hash_test.c \
- test/ident_test.c \
- test/libc3_test.c \
- test/buf_inspect_test.c \
+ test/test.c \
test/test.h \
- test/bool_test.c \
- test/cfn_test.c \
- test/buf_parse_test_s8.c \
+ test/buf_parse_test_u8.c \
+ test/buf_parse_test.h \
+ test/buf_parse_test_s16.c \
test/buf_parse_test_s32.c \
test/buf_parse_test_s64.c \
+ test/buf_parse_test_s8.c \
+ test/buf_parse_test_su.h \
test/buf_parse_test_u16.c \
- test/buf_parse_test_u8.c \
test/buf_parse_test_u32.c \
- test/buf_parse_test_u64.c \
- test/buf_parse_test.h \
test/buf_test.c \
- test/buf_parse_test_su.h \
+ test/buf_parse_test_u64.c \
+ test/call_test.c \
+ test/facts_cursor_test.c \
+ test/cfn_test.c \
test/character_test.c \
- test/buf_parse_test_s16.c \
- test/buf_file_test.c \
+ test/compare_test.c \
+ test/compare_test.h \
+ test/env_test.c \
+ test/fact_test.c \
+ test/fact_test.h \
+ test/facts_with_test.c \
+ test/hash_test.c \
+ test/ident_test.c \
+ test/set__fact_test.c \
+ test/set__tag_test.c \
+ test/skiplist__fact_test.c \
+ test/str_test.c \
+ test/sym_test.c \
+ test/tag_test.c \
+ test/tag_test.h \
+ test/array_test.c \
+ test/fn_test.c \
+ test/tuple_test.c \
+ test/types_test.c \
+ test/libc3_test.c \
ucd2c/ucd.h \
ucd2c/ucd2c.c \
diff --git a/sources.sh b/sources.sh
index 3eecf10..dba946a 100644
--- a/sources.sh
+++ b/sources.sh
@@ -1,4 +1,4 @@
# sources.sh generated by update_sources
-C3_CONFIGURES='c3c/configure c3s/configure c3s/update_sources ic3/configure ic3/update_sources libc3/update_sources libc3/configure libtommath/configure libtommath/update_sources test/configure test/update_sources ucd2c/configure '
+C3_CONFIGURES='c3c/configure c3s/configure c3s/update_sources ic3/configure ic3/update_sources libc3/configure libc3/update_sources libtommath/configure libtommath/update_sources test/configure test/update_sources ucd2c/configure '
C3_MAKEFILES='c3c/Makefile c3s/Makefile ic3/Makefile libc3/Makefile libc3/gen.mk libtommath/Makefile test/Makefile ucd2c/Makefile '
-C3_C_SOURCES='c3c/c3c.c c3s/buf_readline.c c3s/c3s.c c3s/buf_readline.h ic3/buf_linenoise.c ic3/ic3.c ic3/buf_linenoise.h ic3/linenoise.c libc3/buf_parse_u64.h libc3/buf_parse_uw.c libc3/buf_parse_uw.h libc3/arg.c libc3/arg.h libc3/set__fact.c libc3/set__fact.h libc3/set__tag.c libc3/set__tag.h libc3/set_cursor__fact.c libc3/set_cursor__fact.h libc3/set_cursor__tag.c libc3/set_cursor__tag.h libc3/set_item__fact.c libc3/set_item__fact.h libc3/set_item__tag.c libc3/set_item__tag.h libc3/integer.c libc3/binding.c libc3/binding.h libc3/facts_with_cursor.c libc3/array.c libc3/array.h libc3/buf.c libc3/buf_parse.c libc3/integer.h libc3/types.h libc3/type.c libc3/buf_inspect_s8.c libc3/buf_inspect_s8.h libc3/buf_inspect_s16.c libc3/buf_inspect_s16.h libc3/buf_inspect_s32.c libc3/buf_inspect_s32.h libc3/buf_file.c libc3/buf_file.h libc3/bool.c libc3/io.h libc3/skiplist__fact.c libc3/skiplist__fact.h libc3/skiplist_node__fact.c libc3/skiplist_node__fact.h libc3/io.c libc3/abs.h libc3/fn_clause.c libc3/file.c libc3/ceiling.c libc3/buf_parse_c.c libc3/buf_parse_c.h libc3/buf_save.c libc3/buf_parse.h libc3/compare.c libc3/buf_inspect_u64_hexadecimal.h libc3/buf_inspect_uw.h libc3/buf_parse_s8.c libc3/buf_parse_s8.h libc3/buf_parse_s16.c libc3/buf_parse_s16.h libc3/buf_parse_s32.c libc3/buf_parse_s32.h libc3/buf_parse_s64.c libc3/call.h libc3/bool.h libc3/buf_save.h libc3/fact.h libc3/error.c libc3/error.h libc3/env.h libc3/character.h libc3/compare.h libc3/operator.h libc3/operator.c libc3/tag.h libc3/sign.h libc3/buf.h libc3/buf_inspect_s64.c libc3/buf_inspect_s64.h libc3/buf_inspect_sw.c libc3/buf_inspect_sw.h libc3/buf_inspect_u8.c libc3/buf_inspect_u8.h libc3/buf_inspect_u16.c libc3/error_handler.c libc3/set_cursor.c.in libc3/set_cursor.h.in libc3/set_item.c.in libc3/set_item.h.in libc3/error_handler.h libc3/eval.c libc3/eval.h libc3/fact.c libc3/facts.h libc3/facts_cursor.c libc3/fn.h libc3/ceiling.h libc3/buf_inspect_u64_binary.h libc3/buf_inspect_u64_octal.c libc3/buf_inspect_u64_octal.h libc3/buf_inspect_u64_decimal.c libc3/buf_inspect_u64_decimal.h libc3/buf_inspect_u64_hexadecimal.c libc3/sym.c libc3/facts_cursor.h libc3/facts_spec.c libc3/frame.h libc3/sign.c libc3/skiplist.c.in libc3/timespec.h libc3/facts_spec.h libc3/facts_spec_cursor.c libc3/hash.c libc3/facts_spec_cursor.h libc3/buf_inspect_s16_binary.h libc3/buf_inspect_s16_decimal.c libc3/buf_inspect_s16_decimal.h libc3/buf_inspect_s16_hexadecimal.c libc3/buf_inspect_s16_hexadecimal.h libc3/c3.c libc3/facts_with.c libc3/facts_with.h libc3/ident.c libc3/buf_parse_u.c.in libc3/fn_clause.h libc3/abs.c libc3/facts_with_cursor.h libc3/ident.h libc3/str.c libc3/c_types.h libc3/buf_parse_s64.h libc3/buf_parse_sw.c libc3/buf_parse_sw.h libc3/buf_parse_u8.c libc3/buf_parse_u8.h libc3/buf_parse_s.c.in libc3/buf_parse_u16.c libc3/buf_parse_u16.h libc3/buf_parse_u32.c libc3/buf_parse_u32.h libc3/buf_parse_u64.c libc3/buf_inspect.c libc3/set.c.in libc3/list.c libc3/log.c libc3/log.h libc3/sym.h libc3/c3.h libc3/module.c libc3/quote.c libc3/quote.h libc3/character.c libc3/cfn.c libc3/fn.c libc3/module.h libc3/set.h.in libc3/tag.c libc3/skiplist.h.in libc3/sha1.h libc3/skiplist_node.c.in libc3/skiplist_node.h.in libc3/tuple.c libc3/tuple.h libc3/ucd.c libc3/ucd.h libc3/str.h libc3/type.h libc3/buf_parse_s.h.in libc3/buf_parse_u.h.in libc3/facts.c libc3/float.h libc3/frame.c libc3/buf_inspect_s_base.c.in libc3/buf_inspect_s.c.in libc3/buf_inspect_u16.h libc3/buf_inspect_s.h.in libc3/buf_inspect_u32.c libc3/buf_inspect_u32.h libc3/buf_inspect_u64.c libc3/buf_inspect_u64.h libc3/buf_inspect_u.c.in libc3/buf_inspect_u64_binary.c libc3/buf_inspect_uw.c libc3/buf_inspect_u_base.c.in libc3/buf_inspect_u.h.in libc3/buf_inspect_u_base.h.in libc3/cfn.h libc3/buf_inspect_s16_binary.c libc3/file.h libc3/buf_inspect_s16_octal.c libc3/buf_inspect_s16_octal.h libc3/buf_inspect_s32_binary.c libc3/buf_inspect_s32_binary.h libc3/buf_inspect_s32_decimal.c libc3/buf_inspect_s32_decimal.h libc3/buf_inspect_s32_hexadecimal.c libc3/buf_inspect_s32_hexadecimal.h libc3/buf_inspect_s32_octal.c libc3/buf_inspect_s32_octal.h libc3/buf_inspect_s64_binary.c libc3/buf_inspect_s64_binary.h libc3/buf_inspect_s64_decimal.c libc3/buf_inspect_s64_decimal.h libc3/buf_inspect_s64_hexadecimal.c libc3/buf_inspect_s64_hexadecimal.h libc3/buf_inspect_s64_octal.c libc3/buf_inspect_s64_octal.h libc3/buf_inspect_s8_binary.c libc3/buf_inspect_s8_binary.h libc3/buf_inspect_s8_decimal.c libc3/buf_inspect_s8_decimal.h libc3/buf_inspect_s8_hexadecimal.c libc3/buf_inspect_s8_hexadecimal.h libc3/buf_inspect_s8_octal.c libc3/buf_inspect_s8_octal.h libc3/buf_inspect_sw_binary.c libc3/buf_inspect_sw_binary.h libc3/buf_inspect_sw_decimal.c libc3/buf_inspect_sw_decimal.h libc3/buf_inspect_sw_hexadecimal.c libc3/buf_inspect_sw_hexadecimal.h libc3/buf_inspect_sw_octal.c libc3/buf_inspect_sw_octal.h libc3/buf_inspect_u16_binary.c libc3/buf_inspect_u16_binary.h libc3/buf_inspect_u16_decimal.c libc3/buf_inspect_u16_decimal.h libc3/buf_inspect.h libc3/buf_inspect_u16_hexadecimal.c libc3/buf_inspect_u16_hexadecimal.h libc3/buf_inspect_u16_octal.c libc3/buf_inspect_u16_octal.h libc3/buf_inspect_u32_binary.c libc3/buf_inspect_u32_binary.h libc3/buf_inspect_u32_decimal.c libc3/buf_inspect_u32_decimal.h libc3/buf_inspect_u32_hexadecimal.c libc3/buf_inspect_u32_hexadecimal.h libc3/buf_inspect_u32_octal.c libc3/buf_inspect_u32_octal.h libc3/buf_inspect_uw_binary.c libc3/buf_inspect_uw_binary.h libc3/buf_inspect_uw_decimal.c libc3/buf_inspect_uw_decimal.h libc3/buf_inspect_uw_hexadecimal.c libc3/buf_inspect_uw_hexadecimal.h libc3/buf_inspect_uw_octal.c libc3/buf_inspect_uw_octal.h libc3/env.c libc3/timespec.c libc3/buf_inspect_s_base.h.in libc3/buf_inspect_u8_binary.c libc3/buf_inspect_u8_binary.h libc3/buf_inspect_u8_decimal.c libc3/buf_inspect_u8_decimal.h libc3/buf_inspect_u8_hexadecimal.c libc3/buf_inspect_u8_hexadecimal.h libc3/buf_inspect_u8_octal.c libc3/buf_inspect_u8_octal.h libc3/list.h libc3/c3_main.h libc3/call.c libc3/hash.h test/facts_cursor_test.c test/facts_test.c test/facts_with_test.c test/set__fact_test.c test/fn_test.c test/test.c test/buf_parse_test.c test/array_test.c test/compare_test.c test/set__tag_test.c test/tag_test.c test/sym_test.c test/tag_test.h test/tuple_test.c test/types_test.c test/call_test.c test/skiplist__fact_test.c test/fact_test.c test/compare_test.h test/fact_test.h test/str_test.c test/list_test.c test/env_test.c test/hash_test.c test/ident_test.c test/libc3_test.c test/buf_inspect_test.c test/test.h test/bool_test.c test/cfn_test.c test/buf_parse_test_s8.c test/buf_parse_test_s32.c test/buf_parse_test_s64.c test/buf_parse_test_u16.c test/buf_parse_test_u8.c test/buf_parse_test_u32.c test/buf_parse_test_u64.c test/buf_parse_test.h test/buf_test.c test/buf_parse_test_su.h test/character_test.c test/buf_parse_test_s16.c test/buf_file_test.c ucd2c/ucd.h ucd2c/ucd2c.c '
+C3_C_SOURCES='c3c/c3c.c c3s/buf_readline.c c3s/c3s.c c3s/buf_readline.h ic3/ic3.c ic3/buf_linenoise.c ic3/buf_linenoise.h ic3/linenoise.c libc3/abs.c libc3/abs.h libc3/buf.c libc3/buf.h libc3/buf_inspect_s8_decimal.c libc3/buf_inspect_s8_decimal.h libc3/buf_inspect_s8_hexadecimal.c libc3/buf_inspect_s8_hexadecimal.h libc3/buf_inspect_s16.c libc3/buf_inspect_s16.h libc3/buf_inspect_s16_binary.c libc3/buf_parse_s8.c libc3/call.c libc3/arg.c libc3/arg.h libc3/array.c libc3/array.h libc3/binding.c libc3/c3.c libc3/buf_inspect_s16_binary.h libc3/buf_inspect_s16_octal.c libc3/buf_inspect_s16_octal.h libc3/buf_inspect_s16_decimal.c libc3/binding.h libc3/buf_inspect_s16_decimal.h libc3/buf_inspect_s16_hexadecimal.c libc3/buf_inspect_s16_hexadecimal.h libc3/buf_inspect_s32.c libc3/buf_inspect_s32.h libc3/buf_inspect_s32_binary.c libc3/buf_inspect_s32_binary.h libc3/bool.c libc3/bool.h libc3/buf_file.c libc3/buf_file.h libc3/buf_inspect_s32_octal.c libc3/buf_inspect_s32_octal.h libc3/buf_inspect_s32_decimal.c libc3/buf_inspect_s32_decimal.h libc3/buf_inspect_s32_hexadecimal.c libc3/buf_inspect_s32_hexadecimal.h libc3/buf_inspect_s64.c libc3/buf_inspect_s64.h libc3/buf_inspect_s64_binary.c libc3/buf_inspect_s64_binary.h libc3/buf_inspect_s64_octal.c libc3/buf_inspect_s64_octal.h libc3/buf_parse.h libc3/buf_parse_c.c libc3/buf_save.c libc3/buf_inspect_s64_decimal.c libc3/facts_spec_cursor.c libc3/buf_inspect_s64_decimal.h libc3/buf_inspect_s64_hexadecimal.c libc3/buf_inspect_s64_hexadecimal.h libc3/buf_inspect_sw.c libc3/buf_inspect_sw.h libc3/buf_inspect_sw_binary.c libc3/buf_inspect_sw_binary.h libc3/buf_inspect_sw_octal.c libc3/buf_inspect_sw_octal.h libc3/buf_inspect_sw_decimal.c libc3/buf_inspect_sw_decimal.h libc3/buf_parse_c.h libc3/buf_save.h libc3/c3.h libc3/c_types.h libc3/call.h libc3/buf_inspect_sw_hexadecimal.c libc3/buf_inspect_sw_hexadecimal.h libc3/buf_inspect_u8.c libc3/buf_inspect_u8.h libc3/buf_inspect_u8_binary.c libc3/buf_inspect_u8_binary.h libc3/buf_inspect_u8_octal.c libc3/buf_inspect_u8_octal.h libc3/buf_inspect_u8_decimal.c libc3/buf_inspect_u8_decimal.h libc3/buf_inspect_u8_hexadecimal.c libc3/buf_inspect_u8_hexadecimal.h libc3/ceiling.c libc3/ceiling.h libc3/cfn.c libc3/cfn.h libc3/character.c libc3/character.h libc3/buf_inspect_u16.c libc3/buf_inspect_u16.h libc3/buf_inspect_u16_binary.c libc3/buf_inspect_u16_binary.h libc3/buf_inspect_u16_octal.c libc3/buf_inspect_u16_octal.h libc3/buf_inspect_u16_decimal.c libc3/buf_inspect_u16_decimal.h libc3/buf_inspect_u16_hexadecimal.c libc3/buf_inspect_u16_hexadecimal.h libc3/buf_inspect_u32.c libc3/buf_inspect_u32.h libc3/compare.c libc3/buf_inspect.c libc3/compare.h libc3/buf_parse.c libc3/timespec.h libc3/operator.c libc3/operator.h libc3/sym.c libc3/buf_inspect_s8.c libc3/buf_inspect_s8.h libc3/buf_inspect_s8_binary.c libc3/buf_inspect_s8_binary.h libc3/buf_inspect_s8_octal.c libc3/buf_inspect_s8_octal.h libc3/error.c libc3/error.h libc3/error_handler.c libc3/error_handler.h libc3/eval.c libc3/eval.h libc3/buf_inspect_u32_binary.c libc3/buf_inspect_u32_binary.h libc3/buf_inspect_u32_octal.c libc3/buf_inspect_u32_octal.h libc3/buf_inspect_u32_decimal.c libc3/buf_inspect_u32_decimal.h libc3/buf_inspect_u32_hexadecimal.c libc3/buf_inspect_u32_hexadecimal.h libc3/buf_inspect_u64.c libc3/buf_inspect_u64.h libc3/buf_inspect_u64_binary.c libc3/set__fact.c libc3/fact.c libc3/fact.h libc3/facts_cursor.c libc3/buf_inspect_u64_binary.h libc3/buf_inspect_u64_octal.c libc3/buf_inspect_u64_octal.h libc3/buf_inspect_u64_decimal.c libc3/buf_inspect_u64_decimal.h libc3/buf_inspect_u64_hexadecimal.c libc3/buf_inspect_u64_hexadecimal.h libc3/buf_inspect_uw.c libc3/buf_inspect_uw.h libc3/buf_inspect_uw_binary.c libc3/buf_inspect_uw_binary.h libc3/buf_inspect_uw_octal.c libc3/buf_inspect_uw_octal.h libc3/set__fact.h libc3/facts_cursor.h libc3/facts_spec.c libc3/facts_spec.h libc3/facts_spec_cursor.h libc3/buf_inspect_uw_decimal.c libc3/buf_inspect_uw_decimal.h libc3/buf_inspect_uw_hexadecimal.c libc3/buf_inspect_uw_hexadecimal.h libc3/buf_parse_s8.h libc3/buf_parse_s16.c libc3/buf_parse_s16.h libc3/buf_parse_s32.c libc3/buf_parse_s32.h libc3/buf_parse_s64.c libc3/buf_parse_s64.h libc3/buf_parse_sw.c libc3/buf_parse_sw.h libc3/buf_parse_u8.c libc3/set__tag.c libc3/facts_with.c libc3/facts_with.h libc3/facts_with_cursor.c libc3/buf_parse_u8.h libc3/buf_parse_u16.c libc3/buf_parse_u16.h libc3/buf_parse_u32.c libc3/buf_parse_u32.h libc3/buf_parse_u64.c libc3/buf_parse_u64.h libc3/buf_parse_uw.c libc3/buf_parse_uw.h libc3/set__tag.h libc3/set_cursor__fact.c libc3/set_cursor__fact.h libc3/set_cursor__tag.c libc3/set_cursor__tag.h libc3/set_item__fact.c libc3/set_item__fact.h libc3/set_item__tag.c libc3/facts_with_cursor.h libc3/float.h libc3/frame.c libc3/frame.h libc3/set_item__tag.h libc3/skiplist__fact.c libc3/skiplist__fact.h libc3/skiplist_node__fact.c libc3/skiplist_node__fact.h libc3/types.h libc3/hash.h libc3/ident.h libc3/integer.c libc3/integer.h libc3/io.c libc3/io.h libc3/list.c libc3/list.h libc3/log.c libc3/log.h libc3/buf_inspect_s.h.in libc3/module.c libc3/str.c libc3/module.h libc3/buf_parse_u.c.in libc3/quote.c libc3/quote.h libc3/set.c.in libc3/set.h.in libc3/buf_inspect_s_base.h.in libc3/sha1.h libc3/set_cursor.c.in libc3/set_cursor.h.in libc3/buf_inspect.h libc3/set_item.c.in libc3/set_item.h.in libc3/sign.c libc3/sign.h libc3/skiplist.c.in libc3/skiplist.h.in libc3/type.h libc3/skiplist_node.c.in libc3/skiplist_node.h.in libc3/str.h libc3/ucd.c libc3/sym.h libc3/tuple.c libc3/tuple.h libc3/type.c libc3/ucd.h libc3/buf_parse_s.c.in libc3/buf_parse_s.h.in libc3/buf_inspect_s.c.in libc3/buf_parse_u.h.in libc3/env.c libc3/ident.c libc3/buf_inspect_s_base.c.in libc3/buf_inspect_u.c.in libc3/buf_inspect_u.h.in libc3/env.h libc3/buf_inspect_u_base.c.in libc3/buf_inspect_u_base.h.in libc3/timespec.c libc3/fn.c libc3/fn.h libc3/tag.h libc3/fn_clause.h libc3/fn_clause.c libc3/facts.c libc3/u8.c libc3/facts.h libc3/file.c libc3/c3_main.h libc3/file.h libc3/hash.c libc3/tag.c test/buf_inspect_test.c test/bool_test.c test/buf_parse_test.c test/facts_test.c test/buf_file_test.c test/list_test.c test/test.c test/test.h test/buf_parse_test_u8.c test/buf_parse_test.h test/buf_parse_test_s16.c test/buf_parse_test_s32.c test/buf_parse_test_s64.c test/buf_parse_test_s8.c test/buf_parse_test_su.h test/buf_parse_test_u16.c test/buf_parse_test_u32.c test/buf_test.c test/buf_parse_test_u64.c test/call_test.c test/facts_cursor_test.c test/cfn_test.c test/character_test.c test/compare_test.c test/compare_test.h test/env_test.c test/fact_test.c test/fact_test.h test/facts_with_test.c test/hash_test.c test/ident_test.c test/set__fact_test.c test/set__tag_test.c test/skiplist__fact_test.c test/str_test.c test/sym_test.c test/tag_test.c test/tag_test.h test/array_test.c test/fn_test.c test/tuple_test.c test/types_test.c test/libc3_test.c ucd2c/ucd.h ucd2c/ucd2c.c '
diff --git a/test/array_test.c b/test/array_test.c
index 1e6cea1..e0d42b2 100644
--- a/test/array_test.c
+++ b/test/array_test.c
@@ -12,6 +12,7 @@
*/
#include <string.h>
#include "../libc3/array.h"
+#include "../libc3/sym.h"
#include "test.h"
#define ARRAY_TEST_INIT_CLEAN(type, dimension, dimensions) \
@@ -53,15 +54,15 @@ TEST_CASE_END(array_data)
TEST_CASE(array_init_clean)
{
- ARRAY_TEST_INIT_CLEAN(TAG_U8, 1, (uw []) {1});
- ARRAY_TEST_INIT_CLEAN(TAG_U8, 1, (uw []) {10});
- ARRAY_TEST_INIT_CLEAN(TAG_U8, 1, (uw []) {100});
- ARRAY_TEST_INIT_CLEAN(TAG_U8, 2, ((uw []) {1, 1}));
- ARRAY_TEST_INIT_CLEAN(TAG_U8, 2, ((uw []) {10, 10}));
- ARRAY_TEST_INIT_CLEAN(TAG_U8, 2, ((uw []) {100, 100}));
- ARRAY_TEST_INIT_CLEAN(TAG_U8, 3, ((uw []) {1, 1, 1}));
- ARRAY_TEST_INIT_CLEAN(TAG_U8, 3, ((uw []) {10, 10, 10}));
- ARRAY_TEST_INIT_CLEAN(TAG_U8, 3, ((uw []) {100, 100, 100}));
+ ARRAY_TEST_INIT_CLEAN(sym_1("U8"), 1, (uw []) {1});
+ ARRAY_TEST_INIT_CLEAN(sym_1("U8"), 1, (uw []) {10});
+ ARRAY_TEST_INIT_CLEAN(sym_1("U8"), 1, (uw []) {100});
+ ARRAY_TEST_INIT_CLEAN(sym_1("U8"), 2, ((uw []) {1, 1}));
+ ARRAY_TEST_INIT_CLEAN(sym_1("U8"), 2, ((uw []) {10, 10}));
+ ARRAY_TEST_INIT_CLEAN(sym_1("U8"), 2, ((uw []) {100, 100}));
+ ARRAY_TEST_INIT_CLEAN(sym_1("U8"), 3, ((uw []) {1, 1, 1}));
+ ARRAY_TEST_INIT_CLEAN(sym_1("U8"), 3, ((uw []) {10, 10, 10}));
+ ARRAY_TEST_INIT_CLEAN(sym_1("U8"), 3, ((uw []) {100, 100, 100}));
}
TEST_CASE_END(array_init_clean)
diff --git a/test/ic3/array.out.expected b/test/ic3/array.out.expected
index 45f30e2..87c3510 100644
--- a/test/ic3/array.out.expected
+++ b/test/ic3/array.out.expected
@@ -1,11 +1,11 @@
-(u8) {0, 1}
-(u8) {0, 1}
+(U8) {0, 1}
+(U8) {0, 1}
a[0]
a[1]
0
1
-(u8) {{0, 1}, {2, 3}}
-(u8) {{0, 1}, {2, 3}}
+(U8) {{0, 1}, {2, 3}}
+(U8) {{0, 1}, {2, 3}}
b[0][0]
b[0][1]
b[1][0]
@@ -14,7 +14,7 @@ b[1][1]
1
2
3
-(u8) {{{0, 1}, {2, 3}}, {{4, 5}, {6, 7}}}
+(U8) {{{0, 1}, {2, 3}}, {{4, 5}, {6, 7}}}
c[0][0][0]
c[0][0][1]
c[0][1][0]
@@ -31,7 +31,7 @@ c[1][1][1]
5
6
7
-(u8) {{{{0, 1}, {2, 3}}, {{4, 5}, {6, 7}}}, {{{8, 9}, {10, 11}}, {{12, 13}, {14, 15}}}}
+(U8) {{{{0, 1}, {2, 3}}, {{4, 5}, {6, 7}}}, {{{8, 9}, {10, 11}}, {{12, 13}, {14, 15}}}}
d[0][0][0][0]
d[0][0][0][1]
d[0][0][1][0]