diff --git a/libc3/buf_inspect.c b/libc3/buf_inspect.c
index f6e8c3c..b03fb82 100644
--- a/libc3/buf_inspect.c
+++ b/libc3/buf_inspect.c
@@ -1858,7 +1858,7 @@ sw buf_inspect_tag (s_buf *buf, const s_tag *tag)
case TAG_STR: return buf_inspect_str(buf, &tag->data.str);
case TAG_STRUCT: return buf_inspect_struct(buf, &tag->data.struct_);
case TAG_STRUCT_TYPE:
- return buf_inspect_struct_type(buf, tag->data.struct_type);
+ return buf_inspect_struct_type(buf, &tag->data.struct_type);
case TAG_SYM: return buf_inspect_sym(buf, &tag->data.sym);
case TAG_TUPLE: return buf_inspect_tuple(buf, &tag->data.tuple);
case TAG_U8: return buf_inspect_u8(buf, &tag->data.u8);
@@ -1907,7 +1907,7 @@ sw buf_inspect_tag_size (const s_tag *tag)
case TAG_STR: return buf_inspect_str_size(&tag->data.str);
case TAG_STRUCT: return buf_inspect_struct_size(&tag->data.struct_);
case TAG_STRUCT_TYPE:
- return buf_inspect_struct_type_size(tag->data.struct_type);
+ return buf_inspect_struct_type_size(&tag->data.struct_type);
case TAG_SYM: return buf_inspect_sym_size(&tag->data.sym);
case TAG_TUPLE: return buf_inspect_tuple_size(&tag->data.tuple);
case TAG_U8: return buf_inspect_u8_size(&tag->data.u8);
diff --git a/libc3/env.c b/libc3/env.c
index 5d52e7e..6c55dd4 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -1216,7 +1216,7 @@ s_struct_type * env_struct_type_find (s_env *env, const s_sym *module)
assert(! "env_struct_type_find: invalid struct_type");
return NULL;
}
- result = tag_var.data.struct_type;
+ result = &tag_var.data.struct_type;
facts_cursor_clean(&cursor);
return result;
}
diff --git a/libc3/hash.c b/libc3/hash.c
index c09fb68..cc16942 100644
--- a/libc3/hash.c
+++ b/libc3/hash.c
@@ -420,7 +420,7 @@ bool hash_update_tag (t_hash *hash, const s_tag *tag)
case TAG_STRUCT:
return hash_update_struct(hash, &tag->data.struct_);
case TAG_STRUCT_TYPE:
- return hash_update_struct_type(hash, tag->data.struct_type);
+ return hash_update_struct_type(hash, &tag->data.struct_type);
case TAG_SYM: return hash_update_sym(hash, &tag->data.sym);
case TAG_TUPLE: return hash_update_tuple(hash, &tag->data.tuple);
case TAG_U8: return hash_update_u8(hash, &tag->data.u8);
diff --git a/libc3/tag.c b/libc3/tag.c
index d0429b7..65346c3 100644
--- a/libc3/tag.c
+++ b/libc3/tag.c
@@ -36,6 +36,7 @@
#include "quote.h"
#include "str.h"
#include "struct.h"
+#include "struct_type.h"
#include "tag.h"
#include "tag_type.h"
#include "time.h"
@@ -185,7 +186,8 @@ void tag_clean (s_tag *tag)
case TAG_QUOTE: quote_clean(&tag->data.quote); break;
case TAG_STR: str_clean(&tag->data.str); break;
case TAG_STRUCT: struct_clean(&tag->data.struct_); break;
- case TAG_STRUCT_TYPE: struct_type_clean(tag->data.struct_type); break;
+ case TAG_STRUCT_TYPE:
+ struct_type_clean(&tag->data.struct_type); break;
case TAG_TUPLE: tuple_clean(&tag->data.tuple); break;
case TAG_BOOL:
case TAG_CHARACTER:
@@ -289,6 +291,7 @@ s_tag * tag_init_copy (s_tag *tag, const s_tag *src)
case TAG_S16:
case TAG_S32:
case TAG_S64:
+ case TAG_STRUCT_TYPE:
case TAG_SW:
case TAG_SYM:
case TAG_U8:
@@ -660,39 +663,40 @@ bool tag_to_const_pointer (const s_tag *tag, const s_sym *type,
return false;
}
switch (tag_type) {
- case TAG_ARRAY: *dest = &tag->data.array; return true;
- case TAG_BOOL: *dest = &tag->data.bool; return true;
- case TAG_CALL: *dest = &tag->data.call; return true;
- case TAG_CFN: *dest = &tag->data.cfn; return true;
- case TAG_CHARACTER: *dest = &tag->data.character; return true;
- case TAG_F32: *dest = &tag->data.f32; return true;
- case TAG_F64: *dest = &tag->data.f64; return true;
- case TAG_FACT: *dest = &tag->data.fact; return true;
- case TAG_FN: *dest = &tag->data.fn; return true;
- case TAG_IDENT: *dest = &tag->data.ident; return true;
- case TAG_INTEGER: *dest = &tag->data.integer; return true;
- case TAG_SW: *dest = &tag->data.sw; return true;
- case TAG_S64: *dest = &tag->data.s64; return true;
- case TAG_S32: *dest = &tag->data.s32; return true;
- case TAG_S16: *dest = &tag->data.s16; return true;
- case TAG_S8: *dest = &tag->data.s8; return true;
- case TAG_U8: *dest = &tag->data.u8; return true;
- case TAG_U16: *dest = &tag->data.u16; return true;
- case TAG_U32: *dest = &tag->data.u32; return true;
- case TAG_U64: *dest = &tag->data.u64; return true;
- case TAG_UW: *dest = &tag->data.uw; return true;
- case TAG_LIST: *dest = &tag->data.list; return true;
- case TAG_MAP: *dest = &tag->data.map; return true;
- case TAG_PTAG: *dest = &tag->data.ptag; return true;
- case TAG_PTR: *dest = &tag->data.ptr.p; return true;
- case TAG_PTR_FREE: *dest = &tag->data.ptr_free.p; return true;
- case TAG_QUOTE: *dest = &tag->data.quote; return true;
- case TAG_STR: *dest = &tag->data.str; return true;
- case TAG_STRUCT: *dest = &tag->data.struct_; return true;
- case TAG_SYM: *dest = &tag->data.sym; return true;
- case TAG_TUPLE: *dest = &tag->data.tuple; return true;
- case TAG_VAR: *dest = NULL; return true;
- case TAG_VOID: *dest = NULL; return true;
+ case TAG_ARRAY: *dest = &tag->data.array; return true;
+ case TAG_BOOL: *dest = &tag->data.bool; return true;
+ case TAG_CALL: *dest = &tag->data.call; return true;
+ case TAG_CFN: *dest = &tag->data.cfn; return true;
+ case TAG_CHARACTER: *dest = &tag->data.character; return true;
+ case TAG_F32: *dest = &tag->data.f32; return true;
+ case TAG_F64: *dest = &tag->data.f64; return true;
+ case TAG_FACT: *dest = &tag->data.fact; return true;
+ case TAG_FN: *dest = &tag->data.fn; return true;
+ case TAG_IDENT: *dest = &tag->data.ident; return true;
+ case TAG_INTEGER: *dest = &tag->data.integer; return true;
+ case TAG_SW: *dest = &tag->data.sw; return true;
+ case TAG_S64: *dest = &tag->data.s64; return true;
+ case TAG_S32: *dest = &tag->data.s32; return true;
+ case TAG_S16: *dest = &tag->data.s16; return true;
+ case TAG_S8: *dest = &tag->data.s8; return true;
+ case TAG_U8: *dest = &tag->data.u8; return true;
+ case TAG_U16: *dest = &tag->data.u16; return true;
+ case TAG_U32: *dest = &tag->data.u32; return true;
+ case TAG_U64: *dest = &tag->data.u64; return true;
+ case TAG_UW: *dest = &tag->data.uw; return true;
+ case TAG_LIST: *dest = &tag->data.list; return true;
+ case TAG_MAP: *dest = &tag->data.map; return true;
+ case TAG_PTAG: *dest = &tag->data.ptag; return true;
+ case TAG_PTR: *dest = &tag->data.ptr.p; return true;
+ case TAG_PTR_FREE: *dest = &tag->data.ptr_free.p; return true;
+ case TAG_QUOTE: *dest = &tag->data.quote; return true;
+ case TAG_STR: *dest = &tag->data.str; return true;
+ case TAG_STRUCT: *dest = &tag->data.struct_; return true;
+ case TAG_STRUCT_TYPE: *dest = &tag->data.struct_type; return true;
+ case TAG_SYM: *dest = &tag->data.sym; return true;
+ case TAG_TUPLE: *dest = &tag->data.tuple; return true;
+ case TAG_VAR: *dest = NULL; return true;
+ case TAG_VOID: *dest = NULL; return true;
}
warnx("tag_to_const_pointer: invalid tag type: %s",
tag_type_to_string(tag_type));
@@ -891,11 +895,17 @@ bool tag_to_ffi_pointer (s_tag *tag, const s_sym *type, void **dest)
*dest = &tag->data.struct_;
return true;
}
- if (type == tag->data.struct_.type.module) {
+ if (type == tag->data.struct_.type->module) {
*dest = tag->data.struct_.data;
return true;
}
goto invalid_cast;
+ case TAG_STRUCT_TYPE:
+ if (type == sym_1("StructType")) {
+ *dest = &tag->data.struct_type;
+ return true;
+ }
+ goto invalid_cast;
case TAG_SYM:
if (type == sym_1("Sym")) {
*dest = (void *) &tag->data.sym;
@@ -942,39 +952,40 @@ bool tag_to_pointer (s_tag *tag, const s_sym *type, void **dest)
return false;
}
switch (tag_type) {
- case TAG_VOID: *dest = NULL; return true;
- case TAG_ARRAY: *dest = &tag->data.array; return true;
- case TAG_BOOL: *dest = &tag->data.bool; return true;
- case TAG_CALL: *dest = &tag->data.call; return true;
- case TAG_CFN: *dest = &tag->data.cfn; return true;
- case TAG_CHARACTER: *dest = &tag->data.character; return true;
- case TAG_F32: *dest = &tag->data.f32; return true;
- case TAG_F64: *dest = &tag->data.f64; return true;
- case TAG_FACT: *dest = &tag->data.fact; return true;
- case TAG_FN: *dest = &tag->data.fn; return true;
- case TAG_IDENT: *dest = &tag->data.ident; return true;
- case TAG_INTEGER: *dest = &tag->data.integer; return true;
- case TAG_SW: *dest = &tag->data.sw; return true;
- case TAG_S64: *dest = &tag->data.s64; return true;
- case TAG_S32: *dest = &tag->data.s32; return true;
- case TAG_S16: *dest = &tag->data.s16; return true;
- case TAG_S8: *dest = &tag->data.s8; return true;
- case TAG_U8: *dest = &tag->data.u8; return true;
- case TAG_U16: *dest = &tag->data.u16; return true;
- case TAG_U32: *dest = &tag->data.u32; return true;
- case TAG_U64: *dest = &tag->data.u64; return true;
- case TAG_UW: *dest = &tag->data.uw; return true;
- case TAG_LIST: *dest = &tag->data.list; return true;
- case TAG_MAP: *dest = &tag->data.map; return true;
- case TAG_PTAG: *dest = &tag->data.ptag; return true;
- case TAG_PTR: *dest = &tag->data.ptr.p; return true;
- case TAG_PTR_FREE: *dest = &tag->data.ptr_free.p; return true;
- case TAG_QUOTE: *dest = &tag->data.quote; return true;
- case TAG_STR: *dest = &tag->data.str; return true;
- case TAG_STRUCT: *dest = &tag->data.struct_; return true;
- case TAG_SYM: *dest = &tag->data.sym; return true;
- case TAG_TUPLE: *dest = &tag->data.tuple; return true;
- case TAG_VAR: *dest = NULL; return true;
+ case TAG_VOID: *dest = NULL; return true;
+ case TAG_ARRAY: *dest = &tag->data.array; return true;
+ case TAG_BOOL: *dest = &tag->data.bool; return true;
+ case TAG_CALL: *dest = &tag->data.call; return true;
+ case TAG_CFN: *dest = &tag->data.cfn; return true;
+ case TAG_CHARACTER: *dest = &tag->data.character; return true;
+ case TAG_F32: *dest = &tag->data.f32; return true;
+ case TAG_F64: *dest = &tag->data.f64; return true;
+ case TAG_FACT: *dest = &tag->data.fact; return true;
+ case TAG_FN: *dest = &tag->data.fn; return true;
+ case TAG_IDENT: *dest = &tag->data.ident; return true;
+ case TAG_INTEGER: *dest = &tag->data.integer; return true;
+ case TAG_SW: *dest = &tag->data.sw; return true;
+ case TAG_S64: *dest = &tag->data.s64; return true;
+ case TAG_S32: *dest = &tag->data.s32; return true;
+ case TAG_S16: *dest = &tag->data.s16; return true;
+ case TAG_S8: *dest = &tag->data.s8; return true;
+ case TAG_U8: *dest = &tag->data.u8; return true;
+ case TAG_U16: *dest = &tag->data.u16; return true;
+ case TAG_U32: *dest = &tag->data.u32; return true;
+ case TAG_U64: *dest = &tag->data.u64; return true;
+ case TAG_UW: *dest = &tag->data.uw; return true;
+ case TAG_LIST: *dest = &tag->data.list; return true;
+ case TAG_MAP: *dest = &tag->data.map; return true;
+ case TAG_PTAG: *dest = &tag->data.ptag; return true;
+ case TAG_PTR: *dest = &tag->data.ptr.p; return true;
+ case TAG_PTR_FREE: *dest = &tag->data.ptr_free.p; return true;
+ case TAG_QUOTE: *dest = &tag->data.quote; return true;
+ case TAG_STR: *dest = &tag->data.str; return true;
+ case TAG_STRUCT: *dest = &tag->data.struct_; return true;
+ case TAG_STRUCT_TYPE: *dest = &tag->data.struct_type; return true;
+ case TAG_SYM: *dest = &tag->data.sym; return true;
+ case TAG_TUPLE: *dest = &tag->data.tuple; return true;
+ case TAG_VAR: *dest = NULL; return true;
}
warnx("tag_to_pointer: invalid tag type: %d", tag_type);
assert(! "tag_to_pointer: invalid tag type");
@@ -986,40 +997,41 @@ const s_sym ** tag_type (const s_tag *tag, const s_sym **dest)
assert(tag);
assert(dest);
switch (tag->type) {
- case TAG_VOID: *dest = sym_1("Void"); return dest;
- case TAG_ARRAY: *dest = sym_1("Array"); return dest;
- case TAG_BOOL: *dest = sym_1("Bool"); return dest;
- case TAG_CALL: *dest = sym_1("Call"); return dest;
- case TAG_CFN: *dest = sym_1("Cfn"); return dest;
- case TAG_CHARACTER: *dest = sym_1("Character"); return dest;
- case TAG_F32: *dest = sym_1("F32"); return dest;
- case TAG_F64: *dest = sym_1("F64"); return dest;
- case TAG_FACT: *dest = sym_1("Fact"); return dest;
- case TAG_FN: *dest = sym_1("Fn"); return dest;
- case TAG_IDENT: *dest = sym_1("Ident"); return dest;
- case TAG_INTEGER: *dest = sym_1("Integer"); return dest;
- case TAG_SW: *dest = sym_1("Sw"); return dest;
- case TAG_S64: *dest = sym_1("S64"); return dest;
- case TAG_S32: *dest = sym_1("S32"); return dest;
- case TAG_S16: *dest = sym_1("S16"); return dest;
- case TAG_S8: *dest = sym_1("S8"); return dest;
- case TAG_U8: *dest = sym_1("U8"); return dest;
- case TAG_U16: *dest = sym_1("U16"); return dest;
- case TAG_U32: *dest = sym_1("U32"); return dest;
- case TAG_U64: *dest = sym_1("U64"); return dest;
- case TAG_UW: *dest = sym_1("Uw"); return dest;
- case TAG_LIST: *dest = sym_1("List"); return dest;
- case TAG_MAP: *dest = sym_1("Map"); return dest;
- case TAG_PTAG: *dest = sym_1("Ptag"); return dest;
- case TAG_PTR: *dest = sym_1("Ptr"); return dest;
- case TAG_PTR_FREE: *dest = sym_1("PtrFree"); return dest;
- case TAG_QUOTE: *dest = sym_1("Quote"); return dest;
- case TAG_STR: *dest = sym_1("Str"); return dest;
- case TAG_STRUCT: *dest = tag->data.struct_.type.module;
- return dest;
- case TAG_SYM: *dest = sym_1("Sym"); return dest;
- case TAG_TUPLE: *dest = sym_1("Tuple"); return dest;
- case TAG_VAR: *dest = sym_1("Var"); return dest;
+ case TAG_VOID: *dest = sym_1("Void"); return dest;
+ case TAG_ARRAY: *dest = sym_1("Array"); return dest;
+ case TAG_BOOL: *dest = sym_1("Bool"); return dest;
+ case TAG_CALL: *dest = sym_1("Call"); return dest;
+ case TAG_CFN: *dest = sym_1("Cfn"); return dest;
+ case TAG_CHARACTER: *dest = sym_1("Character"); return dest;
+ case TAG_F32: *dest = sym_1("F32"); return dest;
+ case TAG_F64: *dest = sym_1("F64"); return dest;
+ case TAG_FACT: *dest = sym_1("Fact"); return dest;
+ case TAG_FN: *dest = sym_1("Fn"); return dest;
+ case TAG_IDENT: *dest = sym_1("Ident"); return dest;
+ case TAG_INTEGER: *dest = sym_1("Integer"); return dest;
+ case TAG_SW: *dest = sym_1("Sw"); return dest;
+ case TAG_S64: *dest = sym_1("S64"); return dest;
+ case TAG_S32: *dest = sym_1("S32"); return dest;
+ case TAG_S16: *dest = sym_1("S16"); return dest;
+ case TAG_S8: *dest = sym_1("S8"); return dest;
+ case TAG_U8: *dest = sym_1("U8"); return dest;
+ case TAG_U16: *dest = sym_1("U16"); return dest;
+ case TAG_U32: *dest = sym_1("U32"); return dest;
+ case TAG_U64: *dest = sym_1("U64"); return dest;
+ case TAG_UW: *dest = sym_1("Uw"); return dest;
+ case TAG_LIST: *dest = sym_1("List"); return dest;
+ case TAG_MAP: *dest = sym_1("Map"); return dest;
+ case TAG_PTAG: *dest = sym_1("Ptag"); return dest;
+ case TAG_PTR: *dest = sym_1("Ptr"); return dest;
+ case TAG_PTR_FREE: *dest = sym_1("PtrFree"); return dest;
+ case TAG_QUOTE: *dest = sym_1("Quote"); return dest;
+ case TAG_STR: *dest = sym_1("Str"); return dest;
+ case TAG_STRUCT: *dest = tag->data.struct_.type->module;
+ return dest;
+ case TAG_STRUCT_TYPE: *dest = sym_1("StructType"); return dest;
+ case TAG_SYM: *dest = sym_1("Sym"); return dest;
+ case TAG_TUPLE: *dest = sym_1("Tuple"); return dest;
+ case TAG_VAR: *dest = sym_1("Var"); return dest;
}
warnx("tag_type: unknown tag type: %d", tag->type);
assert(! "tag_type: unknown tag type");
diff --git a/libc3/tag_type.c b/libc3/tag_type.c
index 852ca47..c1545e2 100644
--- a/libc3/tag_type.c
+++ b/libc3/tag_type.c
@@ -16,538 +16,128 @@
bool tag_type_size (e_tag_type type, uw *dest)
{
switch (type) {
- case TAG_VOID: *dest = 0; return true;
- case TAG_ARRAY: *dest = sizeof(s_array); return true;
- case TAG_BOOL: *dest = sizeof(bool); return true;
- case TAG_CALL: *dest = sizeof(s_call); return true;
- case TAG_CFN: *dest = sizeof(s_cfn); return true;
- case TAG_CHARACTER: *dest = sizeof(character); return true;
- case TAG_F32: *dest = sizeof(f32); return true;
- case TAG_F64: *dest = sizeof(f64); return true;
- case TAG_FACT: *dest = sizeof(s_fact); return true;
- case TAG_FN: *dest = sizeof(s_fn); return true;
- case TAG_IDENT: *dest = sizeof(s_ident); return true;
- case TAG_INTEGER: *dest = sizeof(s_integer); return true;
- case TAG_SW: *dest = sizeof(sw); return true;
- case TAG_S64: *dest = sizeof(s64); return true;
- case TAG_S32: *dest = sizeof(s32); return true;
- case TAG_S16: *dest = sizeof(s16); return true;
- case TAG_S8: *dest = sizeof(s8); return true;
- case TAG_U8: *dest = sizeof(u8); return true;
- case TAG_U16: *dest = sizeof(u16); return true;
- case TAG_U32: *dest = sizeof(u32); return true;
- case TAG_U64: *dest = sizeof(u64); return true;
- case TAG_UW: *dest = sizeof(uw); return true;
- case TAG_LIST: *dest = sizeof(s_list *); return true;
- case TAG_MAP: *dest = sizeof(s_map); return true;
- case TAG_PTAG: *dest = sizeof(p_tag); return true;
+ case TAG_VOID: *dest = 0; return true;
+ case TAG_ARRAY: *dest = sizeof(s_array); return true;
+ case TAG_BOOL: *dest = sizeof(bool); return true;
+ case TAG_CALL: *dest = sizeof(s_call); return true;
+ case TAG_CFN: *dest = sizeof(s_cfn); return true;
+ case TAG_CHARACTER: *dest = sizeof(character); return true;
+ case TAG_F32: *dest = sizeof(f32); return true;
+ case TAG_F64: *dest = sizeof(f64); return true;
+ case TAG_FACT: *dest = sizeof(s_fact); return true;
+ case TAG_FN: *dest = sizeof(s_fn); return true;
+ case TAG_IDENT: *dest = sizeof(s_ident); return true;
+ case TAG_INTEGER: *dest = sizeof(s_integer); return true;
+ case TAG_SW: *dest = sizeof(sw); return true;
+ case TAG_S64: *dest = sizeof(s64); return true;
+ case TAG_S32: *dest = sizeof(s32); return true;
+ case TAG_S16: *dest = sizeof(s16); return true;
+ case TAG_S8: *dest = sizeof(s8); return true;
+ case TAG_U8: *dest = sizeof(u8); return true;
+ case TAG_U16: *dest = sizeof(u16); return true;
+ case TAG_U32: *dest = sizeof(u32); return true;
+ case TAG_U64: *dest = sizeof(u64); return true;
+ case TAG_UW: *dest = sizeof(uw); return true;
+ case TAG_LIST: *dest = sizeof(s_list *); return true;
+ case TAG_MAP: *dest = sizeof(s_map); return true;
+ case TAG_PTAG: *dest = sizeof(p_tag); return true;
case TAG_PTR:
- case TAG_PTR_FREE: *dest = sizeof(void *); return true;
- case TAG_QUOTE: *dest = sizeof(s_quote); return true;
- case TAG_STR: *dest = sizeof(s_str); return true;
- case TAG_STRUCT: *dest = sizeof(s_struct); return true;
- case TAG_SYM: *dest = sizeof(s_sym *); return true;
- case TAG_TUPLE: *dest = sizeof(s_tuple); return true;
- case TAG_VAR: *dest = 0; return true;
+ case TAG_PTR_FREE: *dest = sizeof(void *); return true;
+ case TAG_QUOTE: *dest = sizeof(s_quote); return true;
+ case TAG_STR: *dest = sizeof(s_str); return true;
+ case TAG_STRUCT: *dest = sizeof(s_struct); return true;
+ case TAG_STRUCT_TYPE: *dest = sizeof(s_struct_type); return true;
+ case TAG_SYM: *dest = sizeof(s_sym *); return true;
+ case TAG_TUPLE: *dest = sizeof(s_tuple); return true;
+ case TAG_VAR: *dest = 0; return true;
}
warnx("tag_type_size: invalid tag type: %d", type);
assert(! "tag_type_size: invalid tag type");
return false;
}
-/*
-bool tag_type_to_buf_inspect (e_tag_type type, f_buf_inspect *dest)
-{
- switch (type) {
- case TAG_VOID:
- *dest = (f_buf_inspect) buf_inspect_void; return true;
- case TAG_ARRAY:
- *dest = (f_buf_inspect) buf_inspect_array; return true;
- case TAG_BOOL:
- *dest = (f_buf_inspect) buf_inspect_bool; return true;
- case TAG_CALL:
- *dest = (f_buf_inspect) buf_inspect_call; return true;
- case TAG_CFN:
- *dest = (f_buf_inspect) buf_inspect_cfn; return true;
- case TAG_CHARACTER:
- *dest = (f_buf_inspect) buf_inspect_character; return true;
- case TAG_F32:
- *dest = (f_buf_inspect) buf_inspect_f32; return true;
- case TAG_F64:
- *dest = (f_buf_inspect) buf_inspect_f64; return true;
- case TAG_FACT:
- *dest = (f_buf_inspect) buf_inspect_fact; return true;
- case TAG_FN:
- *dest = (f_buf_inspect) buf_inspect_fn; return true;
- case TAG_IDENT:
- *dest = (f_buf_inspect) buf_inspect_ident; return true;
- case TAG_INTEGER:
- *dest = (f_buf_inspect) buf_inspect_integer; return true;
- case TAG_SW:
- *dest = (f_buf_inspect) buf_inspect_sw; return true;
- case TAG_S64:
- *dest = (f_buf_inspect) buf_inspect_s64; return true;
- case TAG_S32:
- *dest = (f_buf_inspect) buf_inspect_s32; return true;
- case TAG_S16:
- *dest = (f_buf_inspect) buf_inspect_s16; return true;
- case TAG_S8:
- *dest = (f_buf_inspect) buf_inspect_s8; return true;
- case TAG_U8:
- *dest = (f_buf_inspect) buf_inspect_u8; return true;
- case TAG_U16:
- *dest = (f_buf_inspect) buf_inspect_u16; return true;
- case TAG_U32:
- *dest = (f_buf_inspect) buf_inspect_u32; return true;
- case TAG_U64:
- *dest = (f_buf_inspect) buf_inspect_u64; return true;
- case TAG_UW:
- *dest = (f_buf_inspect) buf_inspect_uw; return true;
- case TAG_LIST:
- *dest = (f_buf_inspect) buf_inspect_list; return true;
- case TAG_MAP:
- *dest = (f_buf_inspect) buf_inspect_map; return true;
- case TAG_PTAG:
- *dest = (f_buf_inspect) buf_inspect_ptag; return true;
- case TAG_PTR:
- *dest = (f_buf_inspect) buf_inspect_ptr; return true;
- case TAG_PTR_FREE:
- *dest = (f_buf_inspect) buf_inspect_ptr_free; return true;
- case TAG_QUOTE:
- *dest = (f_buf_inspect) buf_inspect_quote; return true;
- case TAG_STR:
- *dest = (f_buf_inspect) buf_inspect_str; return true;
- case TAG_STRUCT:
- *dest = (f_buf_inspect) buf_inspect_struct; return true;
- case TAG_SYM:
- *dest = (f_buf_inspect) buf_inspect_sym; return true;
- case TAG_TUPLE:
- *dest = (f_buf_inspect) buf_inspect_tuple; return true;
- case TAG_VAR:
- *dest = (f_buf_inspect) buf_inspect_var; return true;
- }
- warnx("buf_inspect: unknown tag type: %d", type);
- assert(! "buf_inspect: unknown tag type");
- return false;
-}
-
-bool tag_type_to_buf_inspect_size (e_tag_type type,
- f_buf_inspect_size *p)
-{
- switch (type) {
- case TAG_VOID:
- *p = (f_buf_inspect_size) buf_inspect_void_size; return true;
- case TAG_ARRAY:
- *p = (f_buf_inspect_size) buf_inspect_array_size; return true;
- case TAG_BOOL:
- *p = (f_buf_inspect_size) buf_inspect_bool_size; return true;
- case TAG_CALL:
- *p = (f_buf_inspect_size) buf_inspect_call_size; return true;
- case TAG_CFN:
- *p = (f_buf_inspect_size) buf_inspect_cfn_size; return true;
- case TAG_CHARACTER:
- *p = (f_buf_inspect_size) buf_inspect_character_size; return true;
- case TAG_F32:
- *p = (f_buf_inspect_size) buf_inspect_f32_size; return true;
- case TAG_F64:
- *p = (f_buf_inspect_size) buf_inspect_f64_size; return true;
- case TAG_FACT:
- *p = (f_buf_inspect_size) buf_inspect_fact_size; return true;
- case TAG_FN:
- *p = (f_buf_inspect_size) buf_inspect_fn_size; return true;
- case TAG_IDENT:
- *p = (f_buf_inspect_size) buf_inspect_ident_size; return true;
- case TAG_INTEGER:
- *p = (f_buf_inspect_size) buf_inspect_integer_size; return true;
- case TAG_SW:
- *p = (f_buf_inspect_size) buf_inspect_sw_size; return true;
- case TAG_S64:
- *p = (f_buf_inspect_size) buf_inspect_s64_size; return true;
- case TAG_S32:
- *p = (f_buf_inspect_size) buf_inspect_s32_size; return true;
- case TAG_S16:
- *p = (f_buf_inspect_size) buf_inspect_s16_size; return true;
- case TAG_S8:
- *p = (f_buf_inspect_size) buf_inspect_s8_size; return true;
- case TAG_U8:
- *p = (f_buf_inspect_size) buf_inspect_u8_size; return true;
- case TAG_U16:
- *p = (f_buf_inspect_size) buf_inspect_u16_size; return true;
- case TAG_U32:
- *p = (f_buf_inspect_size) buf_inspect_u32_size; return true;
- case TAG_U64:
- *p = (f_buf_inspect_size) buf_inspect_u64_size; return true;
- case TAG_UW:
- *p = (f_buf_inspect_size) buf_inspect_uw_size; return true;
- case TAG_LIST:
- *p = (f_buf_inspect_size) buf_inspect_list_size; return true;
- case TAG_MAP:
- *p = (f_buf_inspect_size) buf_inspect_map_size; return true;
- case TAG_PTAG:
- *p = (f_buf_inspect_size) buf_inspect_ptag_size; return true;
- case TAG_PTR:
- *p = (f_buf_inspect_size) buf_inspect_ptr_size; return true;
- case TAG_PTR_FREE:
- *p = (f_buf_inspect_size) buf_inspect_ptr_free_size; return true;
- case TAG_QUOTE:
- *p = (f_buf_inspect_size) buf_inspect_quote_size; return true;
- case TAG_STR:
- *p = (f_buf_inspect_size) buf_inspect_str_size; return true;
- case TAG_STRUCT:
- *p = (f_buf_inspect_size) buf_inspect_struct_size; return true;
- case TAG_SYM:
- *p = (f_buf_inspect_size) buf_inspect_sym_size; return true;
- case TAG_TUPLE:
- *p = (f_buf_inspect_size) buf_inspect_tuple_size; return true;
- case TAG_VAR:
- *p = (f_buf_inspect_size) buf_inspect_var_size; return true;
- }
- warnx("tag_type_to_buf_inspect_size: unknown tag type: %d", type);
- assert(! "tag_type_to_buf_inspect_size: unknown tag type");
- return false;
-}
-
-bool tag_type_to_buf_parse (e_tag_type type, f_buf_parse *p)
-{
- switch (type) {
- case TAG_VOID: *p = (f_buf_parse) buf_parse_void; return true;
- case TAG_ARRAY: *p = (f_buf_parse) buf_parse_array; return true;
- case TAG_BOOL: *p = (f_buf_parse) buf_parse_bool; return true;
- case TAG_CALL: *p = (f_buf_parse) buf_parse_call; return true;
- case TAG_CFN: *p = (f_buf_parse) buf_parse_cfn; return true;
- case TAG_CHARACTER: *p = (f_buf_parse) buf_parse_character; return 1;
- case TAG_F32: *p = (f_buf_parse) buf_parse_f32; return true;
- case TAG_F64: *p = (f_buf_parse) buf_parse_f64; return true;
- case TAG_FACT: *p = (f_buf_parse) buf_parse_fact; return true;
- case TAG_FN: *p = (f_buf_parse) buf_parse_fn; return true;
- case TAG_IDENT: *p = (f_buf_parse) buf_parse_ident; return true;
- case TAG_INTEGER: *p = (f_buf_parse) buf_parse_integer; return true;
- case TAG_SW: *p = (f_buf_parse) buf_parse_sw; return true;
- case TAG_S64: *p = (f_buf_parse) buf_parse_s64; return true;
- case TAG_S32: *p = (f_buf_parse) buf_parse_s32; return true;
- case TAG_S16: *p = (f_buf_parse) buf_parse_s16; return true;
- case TAG_S8: *p = (f_buf_parse) buf_parse_s8; return true;
- case TAG_U8: *p = (f_buf_parse) buf_parse_u8; return true;
- case TAG_U16: *p = (f_buf_parse) buf_parse_u16; return true;
- case TAG_U32: *p = (f_buf_parse) buf_parse_u32; return true;
- case TAG_U64: *p = (f_buf_parse) buf_parse_u64; return true;
- case TAG_UW: *p = (f_buf_parse) buf_parse_uw; return true;
- case TAG_LIST: *p = (f_buf_parse) buf_parse_list; return true;
- case TAG_MAP: *p = (f_buf_parse) buf_parse_map; return true;
- case TAG_PTAG: *p = (f_buf_parse) buf_parse_ptag; return true;
- case TAG_PTR: *p = (f_buf_parse) buf_parse_ptr; return true;
- case TAG_PTR_FREE: *p = (f_buf_parse) buf_parse_ptr_free; return 1;
- case TAG_QUOTE: *p = (f_buf_parse) buf_parse_quote; return true;
- case TAG_STR: *p = (f_buf_parse) buf_parse_str; return true;
- case TAG_STRUCT: *p = (f_buf_parse) buf_parse_struct; return true;
- case TAG_SYM: *p = (f_buf_parse) buf_parse_sym; return true;
- case TAG_TUPLE: *p = (f_buf_parse) buf_parse_tuple; return true;
- case TAG_VAR: *p = (f_buf_parse) buf_parse_var; return true;
- }
- warnx("tag_type_to_buf_parse: invalid tag type: %d", type);
- assert(! "tag_type_to_buf_parse: invalid tag type");
- return false;
-}
-
-bool tag_type_to_env_eval (e_tag_type type, f_env_eval *dest)
-{
- switch (type) {
- case TAG_VOID: *dest = (f_env_eval) env_eval_void; return true;
- case TAG_ARRAY: *dest = (f_env_eval) env_eval_array_tag; return true;
- case TAG_CALL: *dest = (f_env_eval) env_eval_call; return true;
- case TAG_IDENT: *dest = (f_env_eval) env_eval_ident; return true;
- case TAG_LIST: *dest = (f_env_eval) env_eval_list; return true;
- case TAG_MAP: *dest = (f_env_eval) env_eval_map; return true;
- case TAG_QUOTE: *dest = (f_env_eval) env_eval_quote; return true;
- case TAG_STRUCT: *dest = (f_env_eval) env_eval_struct; return true;
- case TAG_TUPLE: *dest = (f_env_eval) env_eval_tuple; return true;
- case TAG_BOOL:
- case TAG_CFN:
- case TAG_CHARACTER:
- case TAG_F32:
- case TAG_F64:
- case TAG_FACT:
- case TAG_FN:
- case TAG_INTEGER:
- case TAG_PTAG:
- case TAG_PTR:
- case TAG_PTR_FREE:
- case TAG_S8:
- case TAG_S16:
- case TAG_S32:
- case TAG_S64:
- case TAG_SW:
- case TAG_STR:
- case TAG_SYM:
- case TAG_U8:
- case TAG_U16:
- case TAG_U32:
- case TAG_U64:
- case TAG_UW:
- case TAG_VAR: *dest = NULL; return true;
- }
- warnx("tag_type_to_env_eval: unknown tag type: %d", type);
- assert(! "tag_type_to_env_eval: unknown tag type");
- return false;
-}
-*/
-
bool tag_type_to_ffi_type (e_tag_type type, ffi_type **dest)
{
switch (type) {
- case TAG_ARRAY: *dest = &ffi_type_pointer; return true;
- case TAG_BOOL: *dest = &ffi_type_uint8; return true;
- case TAG_CALL: *dest = &ffi_type_pointer; return true;
- case TAG_CFN: *dest = &ffi_type_pointer; return true;
- case TAG_CHARACTER: *dest = &ffi_type_schar; return true;
- case TAG_F32: *dest = &ffi_type_float; return true;
- case TAG_F64: *dest = &ffi_type_double; return true;
- case TAG_FACT: *dest = &ffi_type_pointer; return true;
- case TAG_FN: *dest = &ffi_type_pointer; return true;
- case TAG_IDENT: *dest = &ffi_type_pointer; return true;
- case TAG_INTEGER: *dest = &ffi_type_sint; return true;
- case TAG_LIST: *dest = &ffi_type_pointer; return true;
- case TAG_MAP: *dest = &ffi_type_pointer; return true;
- case TAG_PTAG: *dest = &ffi_type_pointer; return true;
- case TAG_PTR: *dest = &ffi_type_pointer; return true;
- case TAG_PTR_FREE: *dest = &ffi_type_pointer; return true;
- case TAG_QUOTE: *dest = &ffi_type_pointer; return true;
- case TAG_S8: *dest = &ffi_type_sint8; return true;
- case TAG_S16: *dest = &ffi_type_sint16; return true;
- case TAG_S32: *dest = &ffi_type_sint32; return true;
- case TAG_S64: *dest = &ffi_type_sint64; return true;
- case TAG_SW: *dest = &ffi_type_slong; return true;
- case TAG_STR: *dest = &ffi_type_pointer; return true;
- case TAG_STRUCT: *dest = &ffi_type_pointer; return true;
- case TAG_SYM: *dest = &ffi_type_pointer; return true;
- case TAG_TUPLE: *dest = &ffi_type_pointer; return true;
- case TAG_U8: *dest = &ffi_type_uint8; return true;
- case TAG_U16: *dest = &ffi_type_uint16; return true;
- case TAG_U32: *dest = &ffi_type_uint32; return true;
- case TAG_U64: *dest = &ffi_type_uint64; return true;
- case TAG_UW: *dest = &ffi_type_ulong; return true;
- case TAG_VAR: *dest = &ffi_type_pointer; return true;
- case TAG_VOID: *dest = &ffi_type_void; return true;
+ case TAG_ARRAY: *dest = &ffi_type_pointer; return true;
+ case TAG_BOOL: *dest = &ffi_type_uint8; return true;
+ case TAG_CALL: *dest = &ffi_type_pointer; return true;
+ case TAG_CFN: *dest = &ffi_type_pointer; return true;
+ case TAG_CHARACTER: *dest = &ffi_type_schar; return true;
+ case TAG_F32: *dest = &ffi_type_float; return true;
+ case TAG_F64: *dest = &ffi_type_double; return true;
+ case TAG_FACT: *dest = &ffi_type_pointer; return true;
+ case TAG_FN: *dest = &ffi_type_pointer; return true;
+ case TAG_IDENT: *dest = &ffi_type_pointer; return true;
+ case TAG_INTEGER: *dest = &ffi_type_sint; return true;
+ case TAG_LIST: *dest = &ffi_type_pointer; return true;
+ case TAG_MAP: *dest = &ffi_type_pointer; return true;
+ case TAG_PTAG: *dest = &ffi_type_pointer; return true;
+ case TAG_PTR: *dest = &ffi_type_pointer; return true;
+ case TAG_PTR_FREE: *dest = &ffi_type_pointer; return true;
+ case TAG_QUOTE: *dest = &ffi_type_pointer; return true;
+ case TAG_S8: *dest = &ffi_type_sint8; return true;
+ case TAG_S16: *dest = &ffi_type_sint16; return true;
+ case TAG_S32: *dest = &ffi_type_sint32; return true;
+ case TAG_S64: *dest = &ffi_type_sint64; return true;
+ case TAG_SW: *dest = &ffi_type_slong; return true;
+ case TAG_STR: *dest = &ffi_type_pointer; return true;
+ case TAG_STRUCT: *dest = &ffi_type_pointer; return true;
+ case TAG_STRUCT_TYPE: *dest = &ffi_type_pointer; return true;
+ case TAG_SYM: *dest = &ffi_type_pointer; return true;
+ case TAG_TUPLE: *dest = &ffi_type_pointer; return true;
+ case TAG_U8: *dest = &ffi_type_uint8; return true;
+ case TAG_U16: *dest = &ffi_type_uint16; return true;
+ case TAG_U32: *dest = &ffi_type_uint32; return true;
+ case TAG_U64: *dest = &ffi_type_uint64; return true;
+ case TAG_UW: *dest = &ffi_type_ulong; return true;
+ case TAG_VAR: *dest = &ffi_type_pointer; return true;
+ case TAG_VOID: *dest = &ffi_type_void; return true;
}
warnx("tag_type_to_ffi_type: unknown tag type: %d", type);
assert(! "tag_type_to_ffi_type: unknown tag type");
return false;
}
-/*
-bool tag_type_to_hash_update (e_tag_type type, f_hash_update *p)
-{
- switch (type) {
- case TAG_VOID: *p = (f_hash_update) hash_update_void; return true;
- case TAG_ARRAY: *p = (f_hash_update) hash_update_array; return true;
- case TAG_BOOL: *p = (f_hash_update) hash_update_bool; return true;
- case TAG_CALL: *p = (f_hash_update) hash_update_call; return true;
- case TAG_CFN: *p = (f_hash_update) hash_update_cfn; return true;
- case TAG_CHARACTER:
- *p = (f_hash_update) hash_update_character; return true;
- case TAG_F32: *p = (f_hash_update) hash_update_f32; return true;
- case TAG_F64: *p = (f_hash_update) hash_update_f64; return true;
- case TAG_FACT: *p = (f_hash_update) hash_update_fact; return true;
- case TAG_FN: *p = (f_hash_update) hash_update_fn; return true;
- case TAG_IDENT: *p = (f_hash_update) hash_update_ident; return true;
- case TAG_INTEGER:
- *p = (f_hash_update) hash_update_integer; return true;
- case TAG_SW: *p = (f_hash_update) hash_update_sw; return true;
- case TAG_S64: *p = (f_hash_update) hash_update_s64; return true;
- case TAG_S32: *p = (f_hash_update) hash_update_s32; return true;
- case TAG_S16: *p = (f_hash_update) hash_update_s16; return true;
- case TAG_S8: *p = (f_hash_update) hash_update_s8; return true;
- case TAG_U8: *p = (f_hash_update) hash_update_u8; return true;
- case TAG_U16: *p = (f_hash_update) hash_update_u16; return true;
- case TAG_U32: *p = (f_hash_update) hash_update_u32; return true;
- case TAG_U64: *p = (f_hash_update) hash_update_u64; return true;
- case TAG_UW: *p = (f_hash_update) hash_update_uw; return true;
- case TAG_LIST: *p = (f_hash_update) hash_update_list; return true;
- case TAG_MAP: *p = (f_hash_update) hash_update_map; return true;
- case TAG_PTAG: *p = (f_hash_update) hash_update_ptag; return true;
- case TAG_PTR: *p = (f_hash_update) hash_update_ptr; return true;
- case TAG_PTR_FREE:
- *p = (f_hash_update) hash_update_ptr_free; return true;
- case TAG_QUOTE: *p = (f_hash_update) hash_update_quote; return true;
- case TAG_STR: *p = (f_hash_update) hash_update_str; return true;
- case TAG_STRUCT: *p = (f_hash_update) hash_update_struct; return true;
- case TAG_SYM: *p = (f_hash_update) hash_update_sym; return true;
- case TAG_TUPLE: *p = (f_hash_update) hash_update_tuple; return true;
- case TAG_VAR: *p = (f_hash_update) hash_update_var; return true;
- }
- warnx("tag_type_to_hash_update: unknown tag type: %d", type);
- assert(! "tag_type_to_hash_update: unknown tag type");
- return false;
-}
-
-bool tag_type_to_init_cast (e_tag_type type, f_init_cast *p)
-{
- switch (type) {
- case TAG_VOID: *p = NULL; return true;
- case TAG_ARRAY: *p = (f_init_cast) array_init_cast; return true;
- case TAG_BOOL: *p = (f_init_cast) bool_init_cast; return true;
- case TAG_CALL: *p = (f_init_cast) call_init_cast; return true;
- case TAG_CFN: *p = (f_init_cast) cfn_init_cast; return true;
- case TAG_CHARACTER:
- *p = (f_init_cast) character_init_cast; return true;
- case TAG_F32: *p = (f_init_cast) f32_init_cast; return true;
- case TAG_F64: *p = (f_init_cast) f64_init_cast; return true;
- case TAG_FACT: *p = (f_init_cast) fact_init_cast; return true;
- case TAG_FN: *p = (f_init_cast) fn_init_cast; return true;
- case TAG_IDENT: *p = (f_init_cast) ident_init_cast; return true;
- case TAG_INTEGER: *p = (f_init_cast) integer_init_cast; return true;
- case TAG_SW: *p = (f_init_cast) sw_init_cast; return true;
- case TAG_S64: *p = (f_init_cast) s64_init_cast; return true;
- case TAG_S32: *p = (f_init_cast) s32_init_cast; return true;
- case TAG_S16: *p = (f_init_cast) s16_init_cast; return true;
- case TAG_S8: *p = (f_init_cast) s8_init_cast; return true;
- case TAG_U8: *p = (f_init_cast) u8_init_cast; return true;
- case TAG_U16: *p = (f_init_cast) u16_init_cast; return true;
- case TAG_U32: *p = (f_init_cast) u32_init_cast; return true;
- case TAG_U64: *p = (f_init_cast) u64_init_cast; return true;
- case TAG_UW: *p = (f_init_cast) uw_init_cast; return true;
- case TAG_LIST: *p = (f_init_cast) list_init_cast; return true;
- case TAG_MAP: *p = (f_init_cast) map_init_cast; return true;
- case TAG_PTAG: *p = (f_init_cast) ptag_init_cast; return true;
- case TAG_PTR: *p = (f_init_cast) ptr_init_cast; return true;
- case TAG_PTR_FREE: *p = (f_init_cast) ptr_free_init_cast; return true;
- case TAG_QUOTE: *p = (f_init_cast) quote_init_cast; return true;
- case TAG_STR: *p = (f_init_cast) str_init_cast; return true;
- case TAG_STRUCT: *p = (f_init_cast) struct_init_cast; return true;
- case TAG_SYM: *p = (f_init_cast) sym_init_cast; return true;
- case TAG_TUPLE: *p = (f_init_cast) tuple_init_cast; return true;
- case TAG_VAR: *p = NULL; return true;
- }
- warnx("tag_type_to_init_cast: invalid tag type: %d", type);
- assert(! "tag_type_to_init_cast: invalid tag type");
- return false;
-}
-
-bool tag_type_to_init_copy (e_tag_type type, f_init_copy *p)
-{
- switch (type) {
- case TAG_ARRAY: *p = (f_init_copy) array_init_copy; return true;
- case TAG_BOOL: *p = (f_init_copy) bool_init_copy; return true;
- case TAG_CALL: *p = (f_init_copy) call_init_copy; return true;
- case TAG_CFN: *p = (f_init_copy) cfn_init_copy; return true;
- case TAG_CHARACTER: *p = (f_init_copy) character_init_copy; return 1;
- case TAG_F32: *p = (f_init_copy) f32_init_copy; return true;
- case TAG_F64: *p = (f_init_copy) f64_init_copy; return true;
- case TAG_FACT: *p = (f_init_copy) fact_init_copy; return true;
- case TAG_FN: *p = (f_init_copy) fn_init_copy; return true;
- case TAG_IDENT: *p = (f_init_copy) ident_init_copy; return true;
- case TAG_INTEGER: *p = (f_init_copy) integer_init_copy; return true;
- case TAG_SW: *p = (f_init_copy) sw_init_copy; return true;
- case TAG_S64: *p = (f_init_copy) s64_init_copy; return true;
- case TAG_S32: *p = (f_init_copy) s32_init_copy; return true;
- case TAG_S16: *p = (f_init_copy) s16_init_copy; return true;
- case TAG_S8: *p = (f_init_copy) s8_init_copy; return true;
- case TAG_U8: *p = (f_init_copy) u8_init_copy; return true;
- case TAG_U16: *p = (f_init_copy) u16_init_copy; return true;
- case TAG_U32: *p = (f_init_copy) u32_init_copy; return true;
- case TAG_U64: *p = (f_init_copy) u64_init_copy; return true;
- case TAG_UW: *p = (f_init_copy) uw_init_copy; return true;
- case TAG_LIST: *p = (f_init_copy) list_init_copy; return true;
- case TAG_MAP: *p = (f_init_copy) map_init_copy; return true;
- case TAG_PTAG: *p = (f_init_copy) ptag_init_copy; return true;
- case TAG_PTR: *p = (f_init_copy) ptr_init_copy; return true;
- case TAG_PTR_FREE: *p = (f_init_copy) ptr_free_init_copy; return 1;
- case TAG_QUOTE: *p = (f_init_copy) quote_init_copy; return true;
- case TAG_STR: *p = (f_init_copy) str_init_copy; return true;
- case TAG_STRUCT: *p = (f_init_copy) struct_init_copy; return true;
- case TAG_SYM: *p = (f_init_copy) sym_init_copy; return true;
- case TAG_TUPLE: *p = (f_init_copy) tuple_init_copy; return true;
- case TAG_VAR: *p = NULL; return true;
- case TAG_VOID: *p = NULL; return true;
- }
- warnx("tag_type_to_init_copy: invalid tag type: %d", type);
- assert(! "tag_type_to_init_copy: invalid tag type");
- return false;
-}
-*/
-
const s8 * tag_type_to_string (e_tag_type tag_type)
{
switch (tag_type) {
- case TAG_VOID: return "Void";
- case TAG_ARRAY: return "Array";
- case TAG_BOOL: return "Bool";
- case TAG_CALL: return "Call";
- case TAG_CFN: return "Cfn";
- case TAG_CHARACTER: return "Character";
- case TAG_F32: return "F32";
- case TAG_F64: return "F64";
- case TAG_FACT: return "Fact";
- case TAG_FN: return "Fn";
- case TAG_IDENT: return "Ident";
- case TAG_INTEGER: return "Integer";
- case TAG_SW: return "Sw";
- case TAG_S64: return "S64";
- case TAG_S32: return "S32";
- case TAG_S16: return "S16";
- case TAG_S8: return "S8";
- case TAG_U8: return "U8";
- case TAG_U16: return "U16";
- case TAG_U32: return "U32";
- case TAG_U64: return "U64";
- case TAG_UW: return "Uw";
- case TAG_LIST: return "List";
- case TAG_MAP: return "Map";
- case TAG_PTAG: return "Ptag";
- case TAG_PTR: return "Ptr";
- case TAG_PTR_FREE: return "PtrFree";
- case TAG_QUOTE: return "Quote";
- case TAG_STR: return "Str";
- case TAG_STRUCT: return "Struct";
- case TAG_SYM: return "Sym";
- case TAG_TUPLE: return "Tuple";
- case TAG_VAR: return "Var";
+ case TAG_VOID: return "Void";
+ case TAG_ARRAY: return "Array";
+ case TAG_BOOL: return "Bool";
+ case TAG_CALL: return "Call";
+ case TAG_CFN: return "Cfn";
+ case TAG_CHARACTER: return "Character";
+ case TAG_F32: return "F32";
+ case TAG_F64: return "F64";
+ case TAG_FACT: return "Fact";
+ case TAG_FN: return "Fn";
+ case TAG_IDENT: return "Ident";
+ case TAG_INTEGER: return "Integer";
+ case TAG_SW: return "Sw";
+ case TAG_S64: return "S64";
+ case TAG_S32: return "S32";
+ case TAG_S16: return "S16";
+ case TAG_S8: return "S8";
+ case TAG_U8: return "U8";
+ case TAG_U16: return "U16";
+ case TAG_U32: return "U32";
+ case TAG_U64: return "U64";
+ case TAG_UW: return "Uw";
+ case TAG_LIST: return "List";
+ case TAG_MAP: return "Map";
+ case TAG_PTAG: return "Ptag";
+ case TAG_PTR: return "Ptr";
+ case TAG_PTR_FREE: return "PtrFree";
+ case TAG_QUOTE: return "Quote";
+ case TAG_STR: return "Str";
+ case TAG_STRUCT: return "Struct";
+ case TAG_STRUCT_TYPE: return "StructType";
+ case TAG_SYM: return "Sym";
+ case TAG_TUPLE: return "Tuple";
+ case TAG_VAR: return "Var";
}
warnx("tag_type_to_string: unknown tag type: %d", tag_type);
assert(! "tag_type_to_string: unknown tag type");
return NULL;
}
-
-/*
-const s_sym * tag_type_to_sym (e_tag_type tag_type)
-{
- switch (tag_type) {
- case TAG_VOID: return sym_1("Void");
- case TAG_ARRAY: return sym_1("Array");
- case TAG_BOOL: return sym_1("Bool");
- case TAG_CALL: return sym_1("Call");
- case TAG_CFN: return sym_1("Cfn");
- case TAG_CHARACTER: return sym_1("Character");
- case TAG_F32: return sym_1("F32");
- case TAG_F64: return sym_1("F64");
- case TAG_FACT: return sym_1("Fact");
- case TAG_FN: return sym_1("Fn");
- case TAG_IDENT: return sym_1("Ident");
- case TAG_INTEGER: return sym_1("Integer");
- case TAG_SW: return sym_1("Sw");
- case TAG_S64: return sym_1("S64");
- case TAG_S32: return sym_1("S32");
- case TAG_S16: return sym_1("S16");
- case TAG_S8: return sym_1("S8");
- case TAG_U8: return sym_1("U8");
- case TAG_U16: return sym_1("U16");
- case TAG_U32: return sym_1("U32");
- case TAG_U64: return sym_1("U64");
- case TAG_UW: return sym_1("Uw");
- case TAG_LIST: return sym_1("List");
- case TAG_MAP: return sym_1("Map");
- case TAG_PTAG: return sym_1("Ptag");
- case TAG_PTR: return sym_1("Ptr");
- case TAG_PTR_FREE: return sym_1("PtrFree");
- case TAG_QUOTE: return sym_1("Quote");
- case TAG_STR: return sym_1("Str");
- case TAG_STRUCT: return sym_1("Struct");
- case TAG_SYM: return sym_1("Sym");
- case TAG_TUPLE: return sym_1("Tuple");
- case TAG_VAR: return sym_1("Var");
- }
- assert(! "tag_type_to_sym: invalid tag type");
- errx(1, "tag_type_to_sym: invalid tag type: %d", tag_type);
- return NULL;
-}
-*/
diff --git a/libc3/types.h b/libc3/types.h
index cf67e5c..659d875 100644
--- a/libc3/types.h
+++ b/libc3/types.h
@@ -387,38 +387,38 @@ struct float_s {
/* 5 */
union tag_data {
- s_array array;
- bool bool;
- s_call call;
- s_cfn cfn;
- character character;
- f32 f32;
- f64 f64;
- s_fact fact;
- s_fn fn;
- s_ident ident;
- s_integer integer;
- s_list *list;
- s_map map;
- p_tag ptag;
- u_ptr_w ptr;
- u_ptr_w ptr_free;
- s_quote quote;
- s_str str;
- s_struct struct_;
- s_struct_type *struct_type;
- const s_sym *sym;
- s8 s8;
- s16 s16;
- s32 s32;
- s64 s64;
- sw sw;
- s_tuple tuple;
- u8 u8;
- u16 u16;
- u32 u32;
- u64 u64;
- uw uw;
+ s_array array;
+ bool bool;
+ s_call call;
+ s_cfn cfn;
+ character character;
+ f32 f32;
+ f64 f64;
+ s_fact fact;
+ s_fn fn;
+ s_ident ident;
+ s_integer integer;
+ s_list *list;
+ s_map map;
+ p_tag ptag;
+ u_ptr_w ptr;
+ u_ptr_w ptr_free;
+ s_quote quote;
+ s_str str;
+ s_struct struct_;
+ s_struct_type struct_type;
+ const s_sym *sym;
+ s8 s8;
+ s16 s16;
+ s32 s32;
+ s64 s64;
+ sw sw;
+ s_tuple tuple;
+ u8 u8;
+ u16 u16;
+ u32 u32;
+ u64 u64;
+ uw uw;
};
/* 6 */