diff --git a/libc3/array.c b/libc3/array.c
index d78c862..9f0ad69 100644
--- a/libc3/array.c
+++ b/libc3/array.c
@@ -15,13 +15,41 @@
#include <string.h>
#include <err.h>
#include "array.h"
+#include "bool.h"
#include "buf.h"
#include "buf_inspect.h"
#include "buf_parse.h"
+#include "call.h"
+#include "cfn.h"
+#include "character.h"
#include "env.h"
+#include "f32.h"
+#include "f64.h"
+#include "fact.h"
+#include "fn.h"
+#include "ident.h"
+#include "integer.h"
+#include "list.h"
+#include "ptag.h"
+#include "quote.h"
+#include "s8.h"
+#include "s16.h"
+#include "s32.h"
+#include "s64.h"
+#include "str.h"
+#include "sw.h"
#include "sym.h"
#include "tag.h"
+#include "tuple.h"
#include "type.h"
+#include "u8.h"
+#include "u16.h"
+#include "u32.h"
+#include "u64.h"
+#include "uw.h"
+#include "var.h"
+
+bool array_copy_data (f_copy copy, const u8 *src, u8 *dest);
void array_clean (s_array *a)
{
@@ -41,12 +69,18 @@ void array_clean (s_array *a)
s_array * array_copy (const s_array *src, s_array *dest)
{
+ f_copy copy;
+ u8 *data_dest;
+ u8 *data_src;
uw i = 0;
+ uw item_size;
+ s_array tmp;
assert(dest);
assert(src);
assert(src->dimension);
assert(src->dimensions);
(void) i;
+ bzero(&tmp, sizeof(s_array));
if (! src->dimension) {
assert(! "array_copy: zero dimension");
errx(1, "array_copy: zero dimension");
@@ -58,35 +92,48 @@ s_array * array_copy (const s_array *src, s_array *dest)
i++;
}
#endif
- dest->dimension = src->dimension;
- if (! (dest->dimensions = calloc(src->dimension,
- sizeof(s_array_dimension)))) {
+ tmp.dimension = src->dimension;
+ if (! (tmp.dimensions = calloc(src->dimension,
+ sizeof(s_array_dimension)))) {
assert(! "array_copy: out of memory: dimensions");
warnx("array_copy: out of memory: dimensions");
return NULL;
}
- memcpy(dest->dimensions, src->dimensions,
+ memcpy(tmp.dimensions, src->dimensions,
src->dimension * sizeof(s_array_dimension));
- dest->count = src->count;
- dest->size = src->size;
- dest->type = src->type;
+ tmp.count = src->count;
+ tmp.size = src->size;
+ tmp.type = src->type;
if (src->data) {
- if (! (dest->data = calloc(1, src->size)))
+ if (! (tmp.data = calloc(1, src->size)))
errx(1, "array_copy: out of memory");
- memcpy(dest->data, src->data, dest->size);
+ copy = array_type_to_copy(src->type);
+ data_dest = tmp.data;
+ data_src = src->data;
+ i = 0;
+ item_size = src->dimensions[src->dimension - 1].item_size;
+ while (i < src->count) {
+ if (copy(data_src, data_dest) != data_dest) {
+ return NULL;
+ }
+ data_dest += item_size;
+ data_src += item_size;
+ i++;
+ }
}
else
- dest->data = NULL;
+ tmp.data = NULL;
if (src->tags) {
- dest->tags = calloc(src->count, sizeof(s_tag));
+ tmp.tags = calloc(src->count, sizeof(s_tag));
i = 0;
while (i < src->count) {
- tag_copy(src->tags + i, dest->tags + i);
+ tag_copy(src->tags + i, tmp.tags + i);
i++;
}
}
else
- dest->tags = NULL;
+ tmp.tags = NULL;
+ *dest = tmp;
return dest;
}
@@ -131,6 +178,7 @@ s_tag * array_data_tag (s_tag *a, const s_tag *address, s_tag *dest)
s_array * array_init (s_array *a, const s_sym *type, uw dimension,
const uw *dimensions)
{
+ uw count = 1;
uw i = 0;
uw item_size;
assert(a);
@@ -152,6 +200,7 @@ s_array * array_init (s_array *a, const s_sym *type, uw dimension,
i = 0;
while (i < dimension) {
a->dimensions[i].count = dimensions[i];
+ count *= dimensions[i];
i++;
}
i--;
@@ -164,7 +213,7 @@ s_array * array_init (s_array *a, const s_sym *type, uw dimension,
a->dimensions[i + 1].item_size;
}
a->size = a->dimensions[0].count * a->dimensions[0].item_size;
- a->count = a->size / item_size;
+ a->count = count;
a->data = NULL;
a->tags = NULL;
return a;
@@ -397,6 +446,67 @@ f_buf_inspect_size array_type_to_buf_inspect_size (const s_sym *type)
return NULL;
}
+f_copy array_type_to_copy (const s_sym *type)
+{
+ if (type == sym_1("Bool"))
+ return (f_copy) bool_copy;
+ if (type == sym_1("Call"))
+ return (f_copy) call_copy;
+ if (type == sym_1("Cfn"))
+ return (f_copy) cfn_copy;
+ if (type == sym_1("Character"))
+ return (f_copy) character_copy;
+ if (type == sym_1("F32"))
+ return (f_copy) f32_copy;
+ if (type == sym_1("F64"))
+ return (f_copy) f64_copy;
+ if (type == sym_1("Fact"))
+ return (f_copy) fact_copy;
+ if (type == sym_1("Fn"))
+ return (f_copy) fn_copy;
+ if (type == sym_1("Ident"))
+ return (f_copy) ident_copy;
+ if (type == sym_1("Integer"))
+ return (f_copy) integer_copy;
+ if (type == sym_1("Sw"))
+ return (f_copy) sw_copy;
+ if (type == sym_1("S64"))
+ return (f_copy) s64_copy;
+ if (type == sym_1("S32"))
+ return (f_copy) s32_copy;
+ if (type == sym_1("S16"))
+ return (f_copy) s16_copy;
+ if (type == sym_1("S8"))
+ return (f_copy) s8_copy;
+ if (type == sym_1("U8"))
+ return (f_copy) u8_copy;
+ if (type == sym_1("U16"))
+ return (f_copy) u16_copy;
+ if (type == sym_1("U32"))
+ return (f_copy) u32_copy;
+ if (type == sym_1("U64"))
+ return (f_copy) u64_copy;
+ if (type == sym_1("Uw"))
+ return (f_copy) uw_copy;
+ if (type == sym_1("List"))
+ return (f_copy) list_copy;
+ if (type == sym_1("Ptag"))
+ return (f_copy) ptag_copy;
+ if (type == sym_1("Quote"))
+ return (f_copy) quote_copy;
+ if (type == sym_1("Str"))
+ return (f_copy) str_copy;
+ if (type == sym_1("Sym"))
+ return (f_copy) sym_copy;
+ if (type == sym_1("Tuple"))
+ return (f_copy) tuple_copy;
+ if (type == sym_1("Var"))
+ return (f_copy) var_copy;
+ assert(! "array_type_to_copy: unknown type");
+ errx(1, "array_type_to_copy: unknown type");
+ return NULL;
+}
+
e_tag_type array_type_to_tag_type (const s_sym *type)
{
if (type == sym_1("Bool"))
diff --git a/libc3/array.h b/libc3/array.h
index c91970b..fdb2f52 100644
--- a/libc3/array.h
+++ b/libc3/array.h
@@ -27,6 +27,7 @@ s_tag * array_data_tag (s_tag *a, const s_tag *address,
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);
+f_copy array_type_to_copy (const s_sym *type);
e_tag_type array_type_to_tag_type (const s_sym *type);
#endif /* ARRAY_H */
diff --git a/libc3/bool.c b/libc3/bool.c
index 9ad5136..83b8988 100644
--- a/libc3/bool.c
+++ b/libc3/bool.c
@@ -14,6 +14,12 @@
#include "buf.h"
#include "buf_inspect.h"
+bool * bool_copy (const bool *src, bool *dest)
+{
+ *dest = *src;
+ return dest;
+}
+
s_str * bool_inspect (bool *b, s_str *dest)
{
sw size;
diff --git a/libc3/bool.h b/libc3/bool.h
index ac65e0b..4cc307b 100644
--- a/libc3/bool.h
+++ b/libc3/bool.h
@@ -22,6 +22,7 @@
#include "types.h"
/* Observers */
+bool * bool_copy (const bool *src, bool *dest);
s_str * bool_inspect (bool *b, s_str *dest);
#endif /* BOOL_H */
diff --git a/libc3/buf_parse.c b/libc3/buf_parse.c
index cf2abb2..720ba10 100644
--- a/libc3/buf_parse.c
+++ b/libc3/buf_parse.c
@@ -81,6 +81,7 @@ sw buf_parse_array (s_buf *buf, s_array *dest)
sw buf_parse_array_data (s_buf *buf, s_array *dest)
{
uw *address;
+ uw i = 0;
sw r;
s_tag *tag;
s_array tmp;
@@ -91,8 +92,12 @@ sw buf_parse_array_data (s_buf *buf, s_array *dest)
warnx("buf_parse_array_data: out of memory: address");
return -1;
}
+ tmp.count = 1;
+ while (i < tmp.dimension) {
+ tmp.count *= tmp.dimensions[i].count;
+ i++;
+ }
tmp.size = tmp.dimensions[0].count * tmp.dimensions[0].item_size;
- tmp.count = tmp.size / tmp.dimensions[tmp.dimension - 1].item_size;
assert(tmp.count);
if (! (tmp.tags = calloc(tmp.count, sizeof(s_tag)))) {
free(address);
@@ -389,11 +394,11 @@ sw buf_parse_bool (s_buf *buf, bool *p)
sw buf_parse_brackets (s_buf *buf, s_call *dest)
{
- s_tag *arg_dimensions;
+ s_tag *arg_addr;
uw d;
- uw dimension = 0;
- s_list *dimensions = NULL;
- s_list **dimensions_last = &dimensions;
+ uw address = 0;
+ s_list *addr = NULL;
+ s_list **addr_last = &addr;
sw r;
sw result = 0;
s_buf_save save;
@@ -404,7 +409,7 @@ sw buf_parse_brackets (s_buf *buf, s_call *dest)
call_init(&tmp);
ident_init(&tmp.ident, NULL, sym_1("[]"));
tmp.arguments = list_new(NULL, list_new(NULL, NULL));
- arg_dimensions = &(list_next(tmp.arguments)->tag);
+ arg_addr = &(list_next(tmp.arguments)->tag);
if ((r = buf_parse_tag_primary(buf, &tmp.arguments->tag)) <= 0)
goto restore;
result += r;
@@ -426,16 +431,16 @@ sw buf_parse_brackets (s_buf *buf, s_call *dest)
if ((r = buf_read_1(buf, "]")) <= 0)
goto restore;
result += r;
- *dimensions_last = list_new(NULL, NULL);
- tag_init_uw(&(*dimensions_last)->tag, d);
- dimensions_last = &(*dimensions_last)->next.data.list;
- dimension++;
+ *addr_last = list_new(NULL, NULL);
+ tag_init_uw(&(*addr_last)->tag, d);
+ addr_last = &(*addr_last)->next.data.list;
+ address++;
}
- if (! dimension) {
+ if (! address) {
goto restore;
}
- arg_dimensions->type = TAG_ARRAY;
- if (! list_to_array(dimensions, sym_1("Uw"), &arg_dimensions->data.array))
+ arg_addr->type = TAG_ARRAY;
+ if (! list_to_array(addr, sym_1("Uw"), &arg_addr->data.array))
goto restore;
*dest = tmp;
r = result;
@@ -445,7 +450,7 @@ sw buf_parse_brackets (s_buf *buf, s_call *dest)
buf_save_restore_rpos(buf, &save);
call_clean(&tmp);
clean:
- list_delete_all(dimensions);
+ list_delete_all(addr);
buf_save_clean(buf, &save);
return r;
}
diff --git a/libc3/cfn.c b/libc3/cfn.c
index 3dab138..dceb46d 100644
--- a/libc3/cfn.c
+++ b/libc3/cfn.c
@@ -44,9 +44,9 @@ s_tag * cfn_apply (s_cfn *cfn, s_list *args, s_tag *dest)
arity, num_args);
return NULL;
}
- cfn_tag_init(&tmp, cfn->result_type);
if (cfn->arg_result)
cfn_tag_init(&tmp2, cfn->result_type);
+ cfn_tag_init(&tmp, cfn->result_type);
/* make result point to tmp value */
result = tag_to_ffi_pointer(&tmp, cfn->result_type);
if (cfn->arity) {
@@ -84,7 +84,6 @@ s_tag * cfn_apply (s_cfn *cfn, s_list *args, s_tag *dest)
ffi_call(&cfn->cif, cfn->ptr.f, result, arg_values);
if (cfn->arg_result) {
*dest = tmp2;
- tag_clean(&tmp);
}
else
*dest = tmp;
diff --git a/libc3/character.c b/libc3/character.c
index db06e08..86db852 100644
--- a/libc3/character.c
+++ b/libc3/character.c
@@ -25,6 +25,14 @@ character character_1 (const s8 *p)
return c;
}
+character * character_copy (const character *src, character *dest)
+{
+ assert(src);
+ assert(dest);
+ *dest = *src;
+ return dest;
+}
+
bool character_is_digit (character c)
{
return ('0' <= c && c <= '9');
diff --git a/libc3/character.h b/libc3/character.h
index fc4b87a..50743a1 100644
--- a/libc3/character.h
+++ b/libc3/character.h
@@ -16,19 +16,20 @@
#include "hash.h"
#include "types.h"
-character character_1 (const s8 *p);
-void character_hash_update (character c, t_hash *hash);
-bool character_is_digit (character c);
-bool character_is_lowercase (character c);
-bool character_is_printable (character c);
-bool character_is_space (character c);
-bool character_is_uppercase (character c);
-sw character_read (s_buf *buf, character *c);
-character character_switch_case (character c);
-character character_to_lower (character c);
-character character_to_upper (character c);
-sw character_write (s_buf *buf, character c);
-sw character_utf8 (character c, s8 *dest);
-sw character_utf8_size (character c);
+character character_1 (const s8 *p);
+character * character_copy (const character *src, character *dest);
+void character_hash_update (character c, t_hash *hash);
+bool character_is_digit (character c);
+bool character_is_lowercase (character c);
+bool character_is_printable (character c);
+bool character_is_space (character c);
+bool character_is_uppercase (character c);
+sw character_read (s_buf *buf, character *c);
+character character_switch_case (character c);
+character character_to_lower (character c);
+character character_to_upper (character c);
+sw character_write (s_buf *buf, character c);
+sw character_utf8 (character c, s8 *dest);
+sw character_utf8_size (character c);
#endif /* CHARACTER_H */
diff --git a/libc3/env.c b/libc3/env.c
index 9ae581f..c11e962 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -108,6 +108,11 @@ bool env_eval_array (s_env *env, const s_array *array, s_array *dest)
assert(dest);
array_copy(array, &tmp);
item_size = tmp.dimensions[tmp.dimension - 1].item_size;
+ if (tmp.data) {
+ *dest = tmp;
+ return true;
+ }
+ assert(array->tags);
if (! tmp.data &&
! (tmp.data = calloc(tmp.dimensions[0].count,
tmp.dimensions[0].item_size))) {
@@ -131,17 +136,7 @@ bool env_eval_array (s_env *env, const s_array *array, s_array *dest)
return true;
}
-bool env_eval_array_tag (s_env *env, const s_array *array, s_tag *dest)
-{
- s_array tmp;
- if (! env_eval_array(env, array, &tmp))
- return false;
- dest->type = TAG_ARRAY;
- dest->data.array = tmp;
- return true;
-}
-
-bool env_eval_array_cast (s_env *env, s_array *tmp, const s_tag *tag,
+bool env_eval_array_cast (s_env *env, s_array *array, const s_tag *tag,
u8 *data, uw size)
{
s_call call;
@@ -149,17 +144,17 @@ bool env_eval_array_cast (s_env *env, s_array *tmp, const s_tag *tag,
e_tag_type tag_type;
void *data_eval;
assert(env);
- assert(tmp);
+ assert(array);
assert(tag);
assert(data);
assert(size);
- if (! call_init_cast(&call, tmp->type, tag))
+ if (! call_init_cast(&call, array->type, tag))
return false;
if (! env_eval_call(env, &call, &tag_eval)) {
call_clean(&call);
return false;
}
- tag_type = array_type_to_tag_type(tmp->type);
+ tag_type = array_type_to_tag_type(array->type);
data_eval = tag_to_pointer(&tag_eval, tag_type);
memcpy(data, data_eval, size);
call_clean(&call);
@@ -167,6 +162,16 @@ bool env_eval_array_cast (s_env *env, s_array *tmp, const s_tag *tag,
return true;
}
+bool env_eval_array_tag (s_env *env, const s_array *array, s_tag *dest)
+{
+ s_array tmp;
+ if (! env_eval_array(env, array, &tmp))
+ return false;
+ dest->type = TAG_ARRAY;
+ dest->data.array = tmp;
+ return true;
+}
+
bool env_eval_call (s_env *env, const s_call *call, s_tag *dest)
{
s_call c;
diff --git a/libc3/f32.c b/libc3/f32.c
new file mode 100644
index 0000000..85fef64
--- /dev/null
+++ b/libc3/f32.c
@@ -0,0 +1,88 @@
+/* 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 "f32.h"
+
+f32 f32_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 (f32) tag->data.character;
+ case TAG_F32:
+ return (f32) tag->data.f32;
+ case TAG_F64:
+ return (f32) tag->data.f64;
+ case TAG_FACT:
+ case TAG_FN:
+ case TAG_IDENT:
+ goto ko;
+ case TAG_INTEGER:
+ return integer_to_f32(&tag->data.integer);
+ case TAG_SW:
+ return (f32) tag->data.sw;
+ case TAG_S64:
+ return (f32) tag->data.s64;
+ case TAG_S32:
+ return (f32) tag->data.s32;
+ case TAG_S16:
+ return (f32) tag->data.s16;
+ case TAG_S8:
+ return (f32) tag->data.s8;
+ case TAG_U8:
+ return (f32) tag->data.u8;
+ case TAG_U16:
+ return (f32) tag->data.u16;
+ case TAG_U32:
+ return (f32) tag->data.u32;
+ case TAG_U64:
+ return (f32) tag->data.u64;
+ case TAG_UW:
+ return (f32) 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(! "f32_cast: unknown tag type");
+ errx(1, "f32_cast: unknown tag type: %d", tag->type);
+ return 0;
+ ko:
+ warnx("f32_cast: cannot cast %s to f32",
+ tag_type_to_sym(tag->type)->str.ptr.ps8);
+ return 0;
+}
+
+f32 * f32_copy (const f32 *src, f32 *dest)
+{
+ assert(src);
+ assert(dest);
+ *dest = *src;
+ return dest;
+}
diff --git a/libc3/f32.h b/libc3/f32.h
new file mode 100644
index 0000000..08f692c
--- /dev/null
+++ b/libc3/f32.h
@@ -0,0 +1,21 @@
+/* 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.
+ */
+#ifndef F32_H
+#define F32_H
+
+#include "types.h"
+
+f32 f32_cast (s_tag *tag);
+f32 * f32_copy (const f32 *src, f32 *dest);
+
+#endif /* F32_H */
diff --git a/libc3/f64.c b/libc3/f64.c
new file mode 100644
index 0000000..02e5e1b
--- /dev/null
+++ b/libc3/f64.c
@@ -0,0 +1,88 @@
+/* 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 "f64.h"
+
+f64 f64_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 (f64) tag->data.character;
+ case TAG_F32:
+ return (f64) tag->data.f32;
+ case TAG_F64:
+ return (f64) tag->data.f64;
+ case TAG_FACT:
+ case TAG_FN:
+ case TAG_IDENT:
+ goto ko;
+ case TAG_INTEGER:
+ return integer_to_f64(&tag->data.integer);
+ case TAG_SW:
+ return (f64) tag->data.sw;
+ case TAG_S64:
+ return (f64) tag->data.s64;
+ case TAG_S32:
+ return (f64) tag->data.s32;
+ case TAG_S16:
+ return (f64) tag->data.s16;
+ case TAG_S8:
+ return (f64) tag->data.s8;
+ case TAG_U8:
+ return (f64) tag->data.u8;
+ case TAG_U16:
+ return (f64) tag->data.u16;
+ case TAG_U32:
+ return (f64) tag->data.u32;
+ case TAG_U64:
+ return (f64) tag->data.u64;
+ case TAG_UW:
+ return (f64) 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(! "f64_cast: unknown tag type");
+ errx(1, "f64_cast: unknown tag type: %d", tag->type);
+ return 0;
+ ko:
+ warnx("f64_cast: cannot cast %s to f64",
+ tag_type_to_sym(tag->type)->str.ptr.ps8);
+ return 0;
+}
+
+f64 * f64_copy (const f64 *src, f64 *dest)
+{
+ assert(src);
+ assert(dest);
+ *dest = *src;
+ return dest;
+}
diff --git a/libc3/f64.h b/libc3/f64.h
new file mode 100644
index 0000000..2158d7a
--- /dev/null
+++ b/libc3/f64.h
@@ -0,0 +1,21 @@
+/* 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.
+ */
+#ifndef F64_H
+#define F64_H
+
+#include "types.h"
+
+f64 f64_cast (s_tag *tag);
+f64 * f64_copy (const f64 *src, f64 *dest);
+
+#endif /* F64_H */
diff --git a/libc3/integer.c b/libc3/integer.c
index ee02546..593d49e 100644
--- a/libc3/integer.c
+++ b/libc3/integer.c
@@ -177,7 +177,7 @@ s_integer * integer_copy (const s_integer *a, s_integer *dest)
sw r;
assert(a);
assert(dest);
- if ((r = mp_copy(&a->mp_int, &dest->mp_int)) != MP_OKAY)
+ if ((r = mp_init_copy(&dest->mp_int, &a->mp_int)) != MP_OKAY)
errx(1, "integer_copy: %s", mp_error_to_string(r));
return dest;
}
@@ -493,6 +493,12 @@ s_integer * integer_sub (const s_integer *a, const s_integer *b,
return dest;
}
+f32 integer_to_f32 (const s_integer *i)
+{
+ assert(i);
+ return (f32) mp_get_double(&i->mp_int);
+}
+
f64 integer_to_f64 (const s_integer *i)
{
assert(i);
diff --git a/libc3/integer.h b/libc3/integer.h
index 151509d..74d6c80 100644
--- a/libc3/integer.h
+++ b/libc3/integer.h
@@ -93,6 +93,7 @@ uw integer_bits (const s_integer *i);
uw integer_bytes (const s_integer *i);
bool integer_is_negative (const s_integer *i);
bool integer_is_zero (const s_integer *i);
+f32 integer_to_f32 (const s_integer *i);
f64 integer_to_f64 (const s_integer *i);
s8 integer_to_s8 (const s_integer *i);
s16 integer_to_s16 (const s_integer *i);
diff --git a/libc3/list.c b/libc3/list.c
index 8adee3a..474ab99 100644
--- a/libc3/list.c
+++ b/libc3/list.c
@@ -144,6 +144,7 @@ s_list * list_new (const s_tag *tag, s_list *next)
s_array * list_to_array (s_list *list, const s_sym *type,
s_array *dest)
{
+ f_copy copy;
s8 *data;
void *data_list;
s_list *l;
@@ -157,15 +158,17 @@ s_array * list_to_array (s_list *list, const s_sym *type,
dest->type = type;
if (! (dest->dimensions = calloc(1, sizeof(s_array_dimension))))
errx(1, "list_to_array: out of memory: 1");
+ dest->count = len;
dest->dimensions[0].count = len;
dest->dimensions[0].item_size = size;
dest->size = len * size;
if (! (data = dest->data = calloc(len, size)))
errx(1, "list_to_array: out of memory: 2");
+ copy = array_type_to_copy(type);
l = list;
while (l) {
data_list = tag_to_pointer(&l->tag, array_type_to_tag_type(type));
- memcpy(data, data_list, size);
+ copy(data_list, data);
data += size;
l = list_next(l);
}
diff --git a/libc3/ptag.c b/libc3/ptag.c
new file mode 100644
index 0000000..cdcfb14
--- /dev/null
+++ b/libc3/ptag.c
@@ -0,0 +1,23 @@
+/* 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 "ptag.h"
+
+p_tag * ptag_copy (const p_tag *src, p_tag *dest)
+{
+ assert(src);
+ assert(dest);
+ *dest = *src;
+ return dest;
+}
diff --git a/libc3/ptag.h b/libc3/ptag.h
new file mode 100644
index 0000000..1ea09a7
--- /dev/null
+++ b/libc3/ptag.h
@@ -0,0 +1,20 @@
+/* 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.
+ */
+#ifndef PTAG_H
+#define PTAG_H
+
+#include "types.h"
+
+p_tag * ptag_copy (const p_tag *src, p_tag *dest);
+
+#endif /* PTAG_H */
diff --git a/libc3/s.c.in b/libc3/s.c.in
index 1c4eabb..44a9c81 100644
--- a/libc3/s.c.in
+++ b/libc3/s.c.in
@@ -79,3 +79,11 @@ s_bits$ s_bits$_cast (s_tag *tag)
tag_type_to_sym(tag->type)->str.ptr.ps8);
return 0;
}
+
+s_bits$ * s_bits$_copy (const s_bits$ *src, s_bits$ *dest)
+{
+ assert(src);
+ assert(dest);
+ *dest = *src;
+ return dest;
+}
diff --git a/libc3/s.h.in b/libc3/s.h.in
index 0363f1d..074eca2 100644
--- a/libc3/s.h.in
+++ b/libc3/s.h.in
@@ -16,6 +16,7 @@
#include "types.h"
-s_bits$ s_bits$_cast (s_tag *tag);
+s_bits$ s_bits$_cast (s_tag *tag);
+s_bits$ * s_bits$_copy (const s_bits$ *src, s_bits$ *dest);
#endif /* S8_H */
diff --git a/libc3/s16.c b/libc3/s16.c
index 9786a64..e0d1301 100644
--- a/libc3/s16.c
+++ b/libc3/s16.c
@@ -79,3 +79,11 @@ s16 s16_cast (s_tag *tag)
tag_type_to_sym(tag->type)->str.ptr.ps8);
return 0;
}
+
+s16 * s16_copy (const s16 *src, s16 *dest)
+{
+ assert(src);
+ assert(dest);
+ *dest = *src;
+ return dest;
+}
diff --git a/libc3/s16.h b/libc3/s16.h
index 8eaf64e..7385b59 100644
--- a/libc3/s16.h
+++ b/libc3/s16.h
@@ -16,6 +16,7 @@
#include "types.h"
-s16 s16_cast (s_tag *tag);
+s16 s16_cast (s_tag *tag);
+s16 * s16_copy (const s16 *src, s16 *dest);
#endif /* S8_H */
diff --git a/libc3/s32.c b/libc3/s32.c
index 989a9ec..38022e3 100644
--- a/libc3/s32.c
+++ b/libc3/s32.c
@@ -79,3 +79,11 @@ s32 s32_cast (s_tag *tag)
tag_type_to_sym(tag->type)->str.ptr.ps8);
return 0;
}
+
+s32 * s32_copy (const s32 *src, s32 *dest)
+{
+ assert(src);
+ assert(dest);
+ *dest = *src;
+ return dest;
+}
diff --git a/libc3/s32.h b/libc3/s32.h
index 7f82bb7..bf99894 100644
--- a/libc3/s32.h
+++ b/libc3/s32.h
@@ -16,6 +16,7 @@
#include "types.h"
-s32 s32_cast (s_tag *tag);
+s32 s32_cast (s_tag *tag);
+s32 * s32_copy (const s32 *src, s32 *dest);
#endif /* S8_H */
diff --git a/libc3/s64.c b/libc3/s64.c
index fc00a34..222e464 100644
--- a/libc3/s64.c
+++ b/libc3/s64.c
@@ -79,3 +79,11 @@ s64 s64_cast (s_tag *tag)
tag_type_to_sym(tag->type)->str.ptr.ps8);
return 0;
}
+
+s64 * s64_copy (const s64 *src, s64 *dest)
+{
+ assert(src);
+ assert(dest);
+ *dest = *src;
+ return dest;
+}
diff --git a/libc3/s64.h b/libc3/s64.h
index b1d1af7..2b48859 100644
--- a/libc3/s64.h
+++ b/libc3/s64.h
@@ -16,6 +16,7 @@
#include "types.h"
-s64 s64_cast (s_tag *tag);
+s64 s64_cast (s_tag *tag);
+s64 * s64_copy (const s64 *src, s64 *dest);
#endif /* S8_H */
diff --git a/libc3/s8.c b/libc3/s8.c
index b0b3b85..4f5057b 100644
--- a/libc3/s8.c
+++ b/libc3/s8.c
@@ -79,3 +79,11 @@ s8 s8_cast (s_tag *tag)
tag_type_to_sym(tag->type)->str.ptr.ps8);
return 0;
}
+
+s8 * s8_copy (const s8 *src, s8 *dest)
+{
+ assert(src);
+ assert(dest);
+ *dest = *src;
+ return dest;
+}
diff --git a/libc3/s8.h b/libc3/s8.h
index c869234..7d6f3da 100644
--- a/libc3/s8.h
+++ b/libc3/s8.h
@@ -16,6 +16,7 @@
#include "types.h"
-s8 s8_cast (s_tag *tag);
+s8 s8_cast (s_tag *tag);
+s8 * s8_copy (const s8 *src, s8 *dest);
#endif /* S8_H */
diff --git a/libc3/sources.mk b/libc3/sources.mk
index a4a1a18..c87fc5e 100644
--- a/libc3/sources.mk
+++ b/libc3/sources.mk
@@ -84,6 +84,8 @@ HEADERS = \
error.h \
error_handler.h \
eval.h \
+ f32.h \
+ f64.h \
fact.h \
facts.h \
facts_cursor.h \
@@ -104,6 +106,7 @@ HEADERS = \
log.h \
module.h \
operator.h \
+ ptag.h \
quote.h \
s16.h \
s32.h \
@@ -133,6 +136,7 @@ HEADERS = \
u8.h \
ucd.h \
uw.h \
+ var.h \
SOURCES = \
abs.c \
@@ -216,6 +220,8 @@ SOURCES = \
error.c \
error_handler.c \
eval.c \
+ f32.c \
+ f64.c \
fact.c \
facts.c \
facts_cursor.c \
@@ -235,6 +241,7 @@ SOURCES = \
log.c \
module.c \
operator.c \
+ ptag.c \
quote.c \
s16.c \
s32.c \
@@ -262,6 +269,7 @@ SOURCES = \
u8.c \
ucd.c \
uw.c \
+ var.c \
LO_SOURCES = \
abs.c \
@@ -345,6 +353,8 @@ LO_SOURCES = \
error.c \
error_handler.c \
eval.c \
+ f32.c \
+ f64.c \
fact.c \
facts.c \
facts_cursor.c \
@@ -364,6 +374,7 @@ LO_SOURCES = \
log.c \
module.c \
operator.c \
+ ptag.c \
quote.c \
s16.c \
s32.c \
@@ -391,6 +402,7 @@ LO_SOURCES = \
u8.c \
ucd.c \
uw.c \
+ var.c \
../libtommath/bn_cutoffs.c \
../libtommath/bn_mp_2expt.c \
../libtommath/bn_mp_abs.c \
diff --git a/libc3/sources.sh b/libc3/sources.sh
index c7a5b1b..894d3dd 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 s16.h s32.h s64.h s8.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 sw.h sym.h tag.h timespec.h tuple.h type.h types.h u16.h u32.h u64.h u8.h ucd.h uw.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 s16.c s32.c s64.c s8.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 sw.c sym.c tag.c timespec.c tuple.c type.c u16.c u32.c u64.c u8.c ucd.c uw.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 s16.c s32.c s64.c s8.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 sw.c sym.c tag.c timespec.c tuple.c type.c u16.c u32.c u64.c u8.c ucd.c uw.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 '
+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 f32.h f64.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 ptag.h quote.h s16.h s32.h s64.h s8.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 sw.h sym.h tag.h timespec.h tuple.h type.h types.h u16.h u32.h u64.h u8.h ucd.h uw.h var.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 f32.c f64.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 ptag.c quote.c s16.c s32.c s64.c s8.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 sw.c sym.c tag.c timespec.c tuple.c type.c u16.c u32.c u64.c u8.c ucd.c uw.c var.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 f32.c f64.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 ptag.c quote.c s16.c s32.c s64.c s8.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 sw.c sym.c tag.c timespec.c tuple.c type.c u16.c u32.c u64.c u8.c ucd.c uw.c var.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/sw.c b/libc3/sw.c
index 396ec19..99132fa 100644
--- a/libc3/sw.c
+++ b/libc3/sw.c
@@ -79,3 +79,11 @@ sw sw_cast (s_tag *tag)
tag_type_to_sym(tag->type)->str.ptr.ps8);
return 0;
}
+
+sw * sw_copy (const sw *src, sw *dest)
+{
+ assert(src);
+ assert(dest);
+ *dest = *src;
+ return dest;
+}
diff --git a/libc3/sw.h b/libc3/sw.h
index 4481b26..9c869bf 100644
--- a/libc3/sw.h
+++ b/libc3/sw.h
@@ -16,6 +16,7 @@
#include "types.h"
-sw sw_cast (s_tag *tag);
+sw sw_cast (s_tag *tag);
+sw * sw_copy (const sw *src, sw *dest);
#endif /* S8_H */
diff --git a/libc3/sym.c b/libc3/sym.c
index c6192ed..0c8018f 100644
--- a/libc3/sym.c
+++ b/libc3/sym.c
@@ -50,6 +50,14 @@ bool sym_character_is_reserved (character c)
c == '}');
}
+const s_sym ** sym_copy (const s_sym **src, const s_sym **dest)
+{
+ assert(src);
+ assert(dest);
+ *dest = *src;
+ return dest;
+}
+
void sym_delete (s_sym *sym)
{
str_clean(&sym->str);
diff --git a/libc3/sym.h b/libc3/sym.h
index 7b849ca..2303446 100644
--- a/libc3/sym.h
+++ b/libc3/sym.h
@@ -33,6 +33,8 @@ const s_sym * sym_1 (const s8 *p);
bool sym_character_is_reserved (character c);
+const s_sym ** sym_copy (const s_sym **src, const s_sym **dest);
+
/** @brief Call when exiting program. */
void sym_delete_all ();
diff --git a/libc3/types.h b/libc3/types.h
index fd51755..297f936 100644
--- a/libc3/types.h
+++ b/libc3/types.h
@@ -151,7 +151,10 @@ typedef const s_tag *p_tag;
typedef u64 t_skiplist_height;
/* function typedefs */
+typedef sw (* f_buf_inspect) (s_buf *buf, const void *x);
+typedef sw (* f_buf_inspect_size) (const void *x);
typedef sw (* f_buf_parse) (s_buf *buf, void *dest);
+typedef void * (* f_copy) (const void *a, void *b);
#define CHARACTER_MAX S32_MAX
#define SKIPLIST_HEIGHT_MAX U64_MAX
@@ -510,8 +513,4 @@ struct facts_with_cursor {
pthread_mutex_t mutex;
};
-/* Functions */
-typedef sw (* f_buf_inspect) (s_buf *buf, const void *x);
-typedef sw (* f_buf_inspect_size) (const void *x);
-
#endif /* TYPES_H */
diff --git a/libc3/u.c.in b/libc3/u.c.in
index df6d89b..2e8c9d8 100644
--- a/libc3/u.c.in
+++ b/libc3/u.c.in
@@ -79,3 +79,11 @@ u_bits$ u_bits$_cast (s_tag *tag)
tag_type_to_sym(tag->type)->str.ptr.ps8);
return 0;
}
+
+u_bits$ * u_bits$_copy (const u_bits$ *src, u_bits$ *dest)
+{
+ assert(src);
+ assert(dest);
+ *dest = *src;
+ return dest;
+}
diff --git a/libc3/u.h.in b/libc3/u.h.in
index a178ffb..76861d2 100644
--- a/libc3/u.h.in
+++ b/libc3/u.h.in
@@ -16,6 +16,7 @@
#include "types.h"
-u_bits$ u_bits$_cast (s_tag *tag);
+u_bits$ u_bits$_cast (s_tag *tag);
+u_bits$ * u_bits$_copy (const u_bits$ *src, u_bits$ *dest);
#endif /* U8_H */
diff --git a/libc3/u16.c b/libc3/u16.c
index ef90723..8772877 100644
--- a/libc3/u16.c
+++ b/libc3/u16.c
@@ -79,3 +79,11 @@ u16 u16_cast (s_tag *tag)
tag_type_to_sym(tag->type)->str.ptr.ps8);
return 0;
}
+
+u16 * u16_copy (const u16 *src, u16 *dest)
+{
+ assert(src);
+ assert(dest);
+ *dest = *src;
+ return dest;
+}
diff --git a/libc3/u16.h b/libc3/u16.h
index 33cc86b..05b5ab4 100644
--- a/libc3/u16.h
+++ b/libc3/u16.h
@@ -16,6 +16,7 @@
#include "types.h"
-u16 u16_cast (s_tag *tag);
+u16 u16_cast (s_tag *tag);
+u16 * u16_copy (const u16 *src, u16 *dest);
#endif /* U8_H */
diff --git a/libc3/u32.c b/libc3/u32.c
index 1f3cb10..c6fc325 100644
--- a/libc3/u32.c
+++ b/libc3/u32.c
@@ -79,3 +79,11 @@ u32 u32_cast (s_tag *tag)
tag_type_to_sym(tag->type)->str.ptr.ps8);
return 0;
}
+
+u32 * u32_copy (const u32 *src, u32 *dest)
+{
+ assert(src);
+ assert(dest);
+ *dest = *src;
+ return dest;
+}
diff --git a/libc3/u32.h b/libc3/u32.h
index c4d204d..c54a3a6 100644
--- a/libc3/u32.h
+++ b/libc3/u32.h
@@ -16,6 +16,7 @@
#include "types.h"
-u32 u32_cast (s_tag *tag);
+u32 u32_cast (s_tag *tag);
+u32 * u32_copy (const u32 *src, u32 *dest);
#endif /* U8_H */
diff --git a/libc3/u64.c b/libc3/u64.c
index ef22e46..0c65ba8 100644
--- a/libc3/u64.c
+++ b/libc3/u64.c
@@ -79,3 +79,11 @@ u64 u64_cast (s_tag *tag)
tag_type_to_sym(tag->type)->str.ptr.ps8);
return 0;
}
+
+u64 * u64_copy (const u64 *src, u64 *dest)
+{
+ assert(src);
+ assert(dest);
+ *dest = *src;
+ return dest;
+}
diff --git a/libc3/u64.h b/libc3/u64.h
index 0999141..e4f188d 100644
--- a/libc3/u64.h
+++ b/libc3/u64.h
@@ -16,6 +16,7 @@
#include "types.h"
-u64 u64_cast (s_tag *tag);
+u64 u64_cast (s_tag *tag);
+u64 * u64_copy (const u64 *src, u64 *dest);
#endif /* U8_H */
diff --git a/libc3/u8.c b/libc3/u8.c
index 29fba4a..6f00b8d 100644
--- a/libc3/u8.c
+++ b/libc3/u8.c
@@ -79,3 +79,11 @@ u8 u8_cast (s_tag *tag)
tag_type_to_sym(tag->type)->str.ptr.ps8);
return 0;
}
+
+u8 * u8_copy (const u8 *src, u8 *dest)
+{
+ assert(src);
+ assert(dest);
+ *dest = *src;
+ return dest;
+}
diff --git a/libc3/u8.h b/libc3/u8.h
index 4a7654d..2767023 100644
--- a/libc3/u8.h
+++ b/libc3/u8.h
@@ -16,6 +16,7 @@
#include "types.h"
-u8 u8_cast (s_tag *tag);
+u8 u8_cast (s_tag *tag);
+u8 * u8_copy (const u8 *src, u8 *dest);
#endif /* U8_H */
diff --git a/libc3/uw.c b/libc3/uw.c
index 94145b3..a43e148 100644
--- a/libc3/uw.c
+++ b/libc3/uw.c
@@ -79,3 +79,11 @@ uw uw_cast (s_tag *tag)
tag_type_to_sym(tag->type)->str.ptr.ps8);
return 0;
}
+
+uw * uw_copy (const uw *src, uw *dest)
+{
+ assert(src);
+ assert(dest);
+ *dest = *src;
+ return dest;
+}
diff --git a/libc3/uw.h b/libc3/uw.h
index 823bad0..d8f656c 100644
--- a/libc3/uw.h
+++ b/libc3/uw.h
@@ -16,6 +16,7 @@
#include "types.h"
-uw uw_cast (s_tag *tag);
+uw uw_cast (s_tag *tag);
+uw * uw_copy (const uw *src, uw *dest);
#endif /* U8_H */
diff --git a/libc3/var.c b/libc3/var.c
new file mode 100644
index 0000000..e1834e4
--- /dev/null
+++ b/libc3/var.c
@@ -0,0 +1,25 @@
+/* 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 "tag.h"
+#include "var.h"
+
+s_tag * var_copy (const s_tag *src, s_tag *dest)
+{
+ assert(src);
+ assert(dest);
+ (void) src;
+ tag_init_void(dest);
+ return dest;
+}
diff --git a/libc3/var.h b/libc3/var.h
new file mode 100644
index 0000000..1797bf7
--- /dev/null
+++ b/libc3/var.h
@@ -0,0 +1,20 @@
+/* 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.
+ */
+#ifndef VAR_H
+#define VAR_H
+
+#include "types.h"
+
+s_tag * var_copy (const s_tag *src, s_tag *dest);
+
+#endif /* VAR_H */
diff --git a/sources.mk b/sources.mk
index 9e67933..f5fe05f 100644
--- a/sources.mk
+++ b/sources.mk
@@ -229,6 +229,9 @@ C3_C_SOURCES = \
libc3/skiplist_node__fact.c \
libc3/skiplist_node__fact.h \
libc3/types.h \
+ libc3/f64.h \
+ libc3/f32.c \
+ libc3/f64.c \
libc3/hash.h \
libc3/ident.h \
libc3/integer.c \
@@ -260,6 +263,7 @@ C3_C_SOURCES = \
libc3/buf_inspect.h \
libc3/set_item.c.in \
libc3/set_item.h.in \
+ libc3/tag.c \
libc3/s.h.in \
libc3/sign.c \
libc3/sign.h \
@@ -306,9 +310,14 @@ C3_C_SOURCES = \
libc3/u32.c \
libc3/u64.c \
libc3/uw.c \
+ libc3/ptag.h \
+ libc3/f32.h \
libc3/fn_clause.h \
libc3/s.c.in \
libc3/fn_clause.c \
+ libc3/ptag.c \
+ libc3/var.h \
+ libc3/var.c \
libc3/facts.c \
libc3/u8.c \
libc3/facts.h \
@@ -316,7 +325,6 @@ C3_C_SOURCES = \
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 \
diff --git a/sources.sh b/sources.sh
index f624beb..2286a5c 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/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/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.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/buf_inspect_s8_decimal.c libc3/buf_inspect_s8_decimal.h libc3/call.c libc3/arg.c libc3/arg.h libc3/array.c libc3/array.h libc3/binding.c libc3/c3.c libc3/buf_inspect_s8_hexadecimal.c libc3/buf_inspect_s8_hexadecimal.h libc3/buf_inspect_s16.c libc3/binding.h libc3/buf_inspect_s16.h libc3/buf_inspect_s16_binary.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/buf_inspect_s16_decimal.h libc3/buf_inspect_s16_hexadecimal.c libc3/bool.c libc3/bool.h libc3/buf_file.c libc3/buf_file.h 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/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_parse.h libc3/buf_parse_c.c libc3/buf_save.c libc3/buf_inspect_s64.h libc3/facts_spec_cursor.c 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_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_sw.c libc3/buf_inspect_sw.h libc3/buf_inspect_sw_binary.c libc3/buf_parse_c.h libc3/buf_save.h libc3/c3.h libc3/c_types.h libc3/call.h 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_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/ceiling.c libc3/ceiling.h libc3/cfn.c libc3/cfn.h libc3/character.c libc3/character.h 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/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_parse_s8.c 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_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/u8.h libc3/buf_inspect_u32.h libc3/buf_inspect_u32_binary.c libc3/buf_inspect_u32_binary.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_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/buf_inspect_u64_binary.h libc3/buf_inspect_u64_octal.c libc3/buf_parse_s8.h libc3/fact.c libc3/fact.h libc3/facts_cursor.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/buf_inspect_uw_decimal.c libc3/buf_inspect_uw_decimal.h libc3/facts_cursor.h libc3/facts_spec.c libc3/facts_spec.h libc3/facts_spec_cursor.h libc3/buf_inspect_uw_hexadecimal.c libc3/buf_inspect_uw_hexadecimal.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/buf_parse_u8.h libc3/buf_parse_u16.c libc3/buf_parse_u16.h libc3/buf_parse_u32.c libc3/set__fact.c libc3/facts_with.c libc3/facts_with.h libc3/facts_with_cursor.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__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/skiplist__fact.c libc3/facts_with_cursor.h libc3/float.h libc3/frame.c libc3/frame.h 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/s32.h libc3/s64.c libc3/s64.h libc3/sw.c libc3/sw.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/s.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/s8.c 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/s8.h libc3/s16.c libc3/buf_inspect_u_base.c.in libc3/buf_inspect_u_base.h.in libc3/timespec.c libc3/s16.h libc3/s32.c libc3/u16.h libc3/u.c.in libc3/fn.c libc3/u.h.in libc3/fn.h libc3/tag.h libc3/u32.h libc3/u64.h libc3/uw.h libc3/u16.c libc3/u32.c libc3/u64.c libc3/uw.c libc3/fn_clause.h libc3/s.c.in 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 '
+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.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/buf_inspect_s8_decimal.c libc3/buf_inspect_s8_decimal.h libc3/call.c libc3/arg.c libc3/arg.h libc3/array.c libc3/array.h libc3/binding.c libc3/c3.c libc3/buf_inspect_s8_hexadecimal.c libc3/buf_inspect_s8_hexadecimal.h libc3/buf_inspect_s16.c libc3/binding.h libc3/buf_inspect_s16.h libc3/buf_inspect_s16_binary.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/buf_inspect_s16_decimal.h libc3/buf_inspect_s16_hexadecimal.c libc3/bool.c libc3/bool.h libc3/buf_file.c libc3/buf_file.h 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/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_parse.h libc3/buf_parse_c.c libc3/buf_save.c libc3/buf_inspect_s64.h libc3/facts_spec_cursor.c 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_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_sw.c libc3/buf_inspect_sw.h libc3/buf_inspect_sw_binary.c libc3/buf_parse_c.h libc3/buf_save.h libc3/c3.h libc3/c_types.h libc3/call.h 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_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/ceiling.c libc3/ceiling.h libc3/cfn.c libc3/cfn.h libc3/character.c libc3/character.h 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/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_parse_s8.c 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_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/u8.h libc3/buf_inspect_u32.h libc3/buf_inspect_u32_binary.c libc3/buf_inspect_u32_binary.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_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/buf_inspect_u64_binary.h libc3/buf_inspect_u64_octal.c libc3/buf_parse_s8.h libc3/fact.c libc3/fact.h libc3/facts_cursor.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/buf_inspect_uw_decimal.c libc3/buf_inspect_uw_decimal.h libc3/facts_cursor.h libc3/facts_spec.c libc3/facts_spec.h libc3/facts_spec_cursor.h libc3/buf_inspect_uw_hexadecimal.c libc3/buf_inspect_uw_hexadecimal.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/buf_parse_u8.h libc3/buf_parse_u16.c libc3/buf_parse_u16.h libc3/buf_parse_u32.c libc3/set__fact.c libc3/facts_with.c libc3/facts_with.h libc3/facts_with_cursor.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__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/skiplist__fact.c libc3/facts_with_cursor.h libc3/float.h libc3/frame.c libc3/frame.h libc3/skiplist__fact.h libc3/skiplist_node__fact.c libc3/skiplist_node__fact.h libc3/types.h libc3/f64.h libc3/f32.c libc3/f64.c 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/s32.h libc3/s64.c libc3/s64.h libc3/sw.c libc3/sw.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/tag.c libc3/s.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/s8.c 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/s8.h libc3/s16.c libc3/buf_inspect_u_base.c.in libc3/buf_inspect_u_base.h.in libc3/timespec.c libc3/s16.h libc3/s32.c libc3/u16.h libc3/u.c.in libc3/fn.c libc3/u.h.in libc3/fn.h libc3/tag.h libc3/u32.h libc3/u64.h libc3/uw.h libc3/u16.c libc3/u32.c libc3/u64.c libc3/uw.c libc3/ptag.h libc3/f32.h libc3/fn_clause.h libc3/s.c.in libc3/fn_clause.c libc3/ptag.c libc3/var.h libc3/var.c libc3/facts.c libc3/u8.c libc3/facts.h libc3/file.c libc3/c3_main.h libc3/file.h libc3/hash.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 b7c224d..f282c79 100644
--- a/test/array_test.c
+++ b/test/array_test.c
@@ -116,5 +116,13 @@ TEST_CASE(array_inspect)
"(U8) {{{0, 0}, {0, 0}}, {{0, 0}, {0, 0}}, {{0, 0}, {0, 0}}}");
ARRAY_TEST_INSPECT("(U8) {1, 2, 3}", "(U8) {1, 2, 3}");
ARRAY_TEST_INSPECT("(U8) {1 + 1, 2 + 2, 3 + 3}", "(U8) {2, 4, 6}");
+ ARRAY_TEST_INSPECT("(U8) {255 + 1, 255 + 2, 255 + 3}", "(U8) {0, 1, 2}");
+ ARRAY_TEST_INSPECT("(U16) {255 + 1, 255 + 2, 255 + 3}", "(U16) {256, 257, 258}");
+ ARRAY_TEST_INSPECT("(U16) {65535 + 1, 65535 + 2, 65535 + 3}", "(U16) {0, 1, 2}");
+ ARRAY_TEST_INSPECT("(U32) {65535 + 1, 65535 + 2, 65535 + 3}", "(U32) {65536, 65537, 65538}");
+ ARRAY_TEST_INSPECT("(U32) {4294967295 + 1, 4294967295 + 2, 4294967295 + 3}", "(U32) {0, 1, 2}");
+ ARRAY_TEST_INSPECT("(U64) {4294967295 + 1, 4294967295 + 2, 4294967295 + 3}", "(U64) {4294967296, 4294967297, 4294967298}");
+ ARRAY_TEST_INSPECT("(U64) {18446744073709551615 + 1, 18446744073709551615 + 2, 18446744073709551615 + 3}", "(U64) {0, 1, 2}");
+ ARRAY_TEST_INSPECT("(Integer) {18446744073709551615 + 1, 18446744073709551615 + 2, 18446744073709551615 + 3}", "(Integer) {18446744073709551616, 18446744073709551617, 18446744073709551618}");
}
TEST_CASE_END(array_inspect)
diff --git a/test/ic3/cast.in b/test/ic3/cast.in
index ad06b8e..e9b3683 100644
--- a/test/ic3/cast.in
+++ b/test/ic3/cast.in
@@ -1,2 +1,26 @@
+quote (U8) 0
+(U8) 0
+quote (U8) 1
+(U8) 1
+quote (U8) 255
+(U8) 255
quote (U8) 256
+(U8) 256
+quote (U16) 256
+(U16) 256
+quote (U16) 65535
+(U16) 65535
quote (U16) 65536
+(U16) 65536
+quote (U32) 65536
+(U32) 65536
+quote (U32) 4294967296
+(U32) 4294967296
+quote (U64) 4294967296
+(U64) 4294967296
+quote (U64) 18446744073709551616
+(U64) 18446744073709551616
+quote (Integer) 18446744073709551616
+(Integer) 18446744073709551616
+quote (Integer) 340282366920938463463374607431768211455
+(Integer) 340282366920938463463374607431768211455
diff --git a/test/ic3/cast.out.expected b/test/ic3/cast.out.expected
index 6944714..bcf07a7 100644
--- a/test/ic3/cast.out.expected
+++ b/test/ic3/cast.out.expected
@@ -1,2 +1,26 @@
+(U8) 0
+0
+(U8) 1
+1
+(U8) 255
+255
(U8) 256
+0
+(U16) 256
+256
+(U16) 65535
+65535
(U16) 65536
+0
+(U32) 65536
+65536
+(U32) 4294967296
+0
+(U64) 4294967296
+4294967296
+(U64) 18446744073709551616
+0
+(Integer) 18446744073709551616
+18446744073709551616
+(Integer) 340282366920938463463374607431768211455
+340282366920938463463374607431768211455