@@ -1,8 +1,8 @@
%{module: C3.Facts.Dump,
version: 1}
replace {GL.Object, :is_a, :module}
-replace {GL.Object, :defstruct, [vertex: (GL.Vertex) {},
- triangle: (GL.Triangle) {},
+replace {GL.Object, :defstruct, [vertex: (GL.Vertex[]) {},
+ triangle: (GL.Triangle[]) {},
gl_mode: (U32) 0,
gl_vao: (U32) 0,
gl_vbo: (U32) 0,
@@ -15,7 +15,8 @@
sw data_buf_inspect (const s_sym *type, s_buf *buf, const void *data)
{
const s_struct_type *st;
- if (type == &g_sym_Array)
+ if (type == &g_sym_Array ||
+ sym_is_array_type(type))
return buf_inspect_array(buf, data);
if (type == &g_sym_Bool)
return buf_inspect_bool(buf, data);
@@ -79,9 +80,6 @@ sw data_buf_inspect (const s_sym *type, s_buf *buf, const void *data)
return buf_inspect_var(buf, data);
if (type == &g_sym_Void)
return buf_inspect_void(buf, data);
- /*
- if (sym_is_array_type(type)) {
- */
st = struct_type_find(type);
if (st) {
s_struct s = {0};
@@ -99,7 +97,8 @@ sw data_buf_inspect (const s_sym *type, s_buf *buf, const void *data)
sw data_buf_inspect_size (const s_sym *type, const void *data)
{
const s_struct_type *st;
- if (type == &g_sym_Array)
+ if (type == &g_sym_Array ||
+ sym_is_array_type(type))
return buf_inspect_array_size(data);
if (type == &g_sym_Bool)
return buf_inspect_bool_size(data);
@@ -163,9 +162,6 @@ sw data_buf_inspect_size (const s_sym *type, const void *data)
return buf_inspect_var_size(data);
if (type == &g_sym_Void)
return buf_inspect_void_size(data);
- /*
- if (sym_is_array_type(type)) {
- */
st = struct_type_find(type);
if (st) {
s_struct s = {0};
@@ -184,7 +180,8 @@ bool data_clean (const s_sym *type, void *data)
{
const s_struct_type *st;
assert(type);
- if (type == &g_sym_Array) {
+ if (type == &g_sym_Array ||
+ sym_is_array_type(type)) {
array_clean(data);
return true;
}
@@ -295,9 +292,6 @@ bool data_clean (const s_sym *type, void *data)
if (type == &g_sym_Void) {
return true;
}
- /*
- if (sym_is_array_type(type)) {
- */
st = struct_type_find(type);
if (st) {
s_struct s = {0};
@@ -316,7 +310,8 @@ bool data_clean (const s_sym *type, void *data)
bool data_compare (const s_sym *type, const void *a, const void *b)
{
const s_struct_type *st;
- if (type == &g_sym_Array)
+ if (type == &g_sym_Array ||
+ sym_is_array_type(type))
return compare_array(a, b);
if (type == &g_sym_Bool)
return compare_bool(*(bool *) a, *(bool *) b);
@@ -380,9 +375,6 @@ bool data_compare (const s_sym *type, const void *a, const void *b)
return compare_ptr(a, b);
if (type == &g_sym_Void)
return 0;
- /*
- if (sym_is_array_type(type)) {
- */
st = struct_type_find(type);
if (st) {
s_struct sa = {0};
@@ -403,7 +395,8 @@ bool data_compare (const s_sym *type, const void *a, const void *b)
bool data_hash_update (const s_sym *type, t_hash *hash, const void *data)
{
const s_struct_type *st;
- if (type == &g_sym_Array)
+ if (type == &g_sym_Array ||
+ sym_is_array_type(type))
return hash_update_array(hash, data);
if (type == &g_sym_Bool)
return hash_update_bool(hash, data);
@@ -467,9 +460,6 @@ bool data_hash_update (const s_sym *type, t_hash *hash, const void *data)
return hash_update_var(hash, data);
if (type == &g_sym_Void)
return hash_update_void(hash, data);
- /*
- if (sym_is_array_type(type)) {
- */
st = struct_type_find(type);
if (st) {
s_struct s = {0};
@@ -487,7 +477,8 @@ bool data_hash_update (const s_sym *type, t_hash *hash, const void *data)
void * data_init_cast (const s_sym *type, void *data, const s_tag *tag)
{
const s_struct_type *st;
- if (type == &g_sym_Array)
+ if (type == &g_sym_Array ||
+ sym_is_array_type(type))
return array_init_cast(data, tag);
if (type == &g_sym_Bool)
return bool_init_cast(data, tag);
@@ -571,7 +562,8 @@ void * data_init_cast (const s_sym *type, void *data, const s_tag *tag)
void * data_init_copy (const s_sym *type, void *data, const void *src)
{
const s_struct_type *st;
- if (type == &g_sym_Array)
+ if (type == &g_sym_Array ||
+ sym_is_array_type(type))
return array_init_copy(data, src);
if (type == &g_sym_Bool)
return bool_init_copy(data, src);
@@ -571,7 +571,8 @@ bool sym_to_ffi_type (const s_sym *sym, ffi_type *result_type,
*dest = result_type;
return true;
}
- if (sym == &g_sym_Array) {
+ if (sym == &g_sym_Array ||
+ sym_is_array_type(sym)) {
*dest = &ffi_type_pointer;
return true;
}
@@ -692,7 +693,8 @@ bool sym_to_ffi_type (const s_sym *sym, ffi_type *result_type,
bool sym_to_tag_type (const s_sym *sym, e_tag_type *dest)
{
- if (sym == &g_sym_Array) {
+ if (sym == &g_sym_Array ||
+ sym_is_array_type(sym)) {
*dest = TAG_ARRAY;
return true;
}
@@ -838,7 +840,8 @@ bool sym_to_tag_type (const s_sym *sym, e_tag_type *dest)
bool sym_type_size (const s_sym *type, uw *dest)
{
const s_struct_type *st;
- if (type == &g_sym_Array) {
+ if (type == &g_sym_Array ||
+ sym_is_array_type(type)) {
*dest = sizeof(s_array);
return true;
}
@@ -61,7 +61,7 @@ bool flies_load (s_sequence *seq)
tag_map(&seq->tag, 4);
map = &seq->tag.data.map;
tag_init_sym( map->key + 0, sym_1("board"));
- tag_init_array(map->value + 0, sym_1("U8"),
+ tag_init_array(map->value + 0, sym_1("U8[]"),
2, (uw[]) {BOARD_SIZE, BOARD_SIZE});
tag_init_sym(map->key + 1, sym_1("in"));
tag_init_uw( map->value + 1, 0);
@@ -73,7 +73,7 @@ bool mandelbrot_f128_load (s_sequence *seq)
tag_init_sym( map->key + 3, sym_1("next_z"));
tag_init_f128( map->value + 3, 0.01);
tag_init_sym( map->key + 4, sym_1("pixels"));
- tag_init_array(map->value + 4, sym_1("U8"), 0, NULL);
+ tag_init_array(map->value + 4, sym_1("U8[]"), 0, NULL);
tag_init_sym( map->key + 5, sym_1("w"));
tag_init_uw( map->value + 5, 0);
tag_init_sym( map->key + 6, sym_1("x"));
@@ -66,7 +66,7 @@ bool flies_load (s_sequence *seq)
tag_map(&seq->tag, 4);
map = &seq->tag.data.map;
tag_init_sym( map->key + 0, sym_1("board"));
- tag_init_array(map->value + 0, sym_1("U8"),
+ tag_init_array(map->value + 0, sym_1("U8[]"),
2, (uw[]) {BOARD_SIZE, BOARD_SIZE});
tag_init_sym( map->key + 1, sym_1("in"));
tag_init_uw( map->value + 1, 0);
@@ -40,7 +40,7 @@ bool mandelbrot_f128_load (s_sequence *seq)
tag_init_sym( map->key + 3, sym_1("next_z"));
tag_init_f128( map->value + 3, 0.01);
tag_init_sym( map->key + 4, sym_1("pixels"));
- tag_init_array(map->value + 4, sym_1("U8"), 0, NULL);
+ tag_init_array(map->value + 4, sym_1("U8[]"), 0, NULL);
tag_init_sym( map->key + 5, sym_1("w"));
tag_init_uw( map->value + 5, 0);
tag_init_sym( map->key + 6, sym_1("x"));
@@ -141,7 +141,7 @@ static bool mandelbrot_f128_resize (s_sequence *seq)
dim[0] = win->h;
dim[1] = win->w;
dim[2] = 4;
- if (! array_init(pixels, &g_sym_U8, 3, dim))
+ if (! array_init(pixels, sym_1("U8[]"), 3, dim))
return false;
if (! array_allocate(pixels))
return false;
@@ -20,7 +20,7 @@ s_gl_lines * gl_lines_allocate (s_gl_lines *lines, uw lines_count)
assert(lines);
assert(lines_count);
vertex_count = lines_count * 2;
- if (! array_init(&lines->vertex, sym_1("GL.Vertex"), 1,
+ if (! array_init(&lines->vertex, sym_1("GL.Vertex[]"), 1,
&vertex_count) ||
! array_allocate(&lines->vertex))
return NULL;
@@ -21,10 +21,10 @@ s_gl_object * gl_object_allocate (s_gl_object *object, uw vertex_count,
assert(object);
assert(vertex_count);
assert(triangle_count);
- if (! array_init(&object->vertex, sym_1("GL.Vertex"), 1,
+ if (! array_init(&object->vertex, sym_1("GL.Vertex[]"), 1,
&vertex_count) ||
! array_allocate(&object->vertex) ||
- ! array_init(&object->triangle, sym_1("GL.Triangle"), 1,
+ ! array_init(&object->triangle, sym_1("GL.Triangle[]"), 1,
&triangle_count) ||
! array_allocate(&object->triangle))
return NULL;