From 9d1fbe8e4257dd57f05e11520f52b059de9265fe Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Tue, 24 Sep 2019 22:57:45 +0200 Subject: [PATCH] :art: Fix compiler warning --- include/type.h | 4 ++-- src/emit/emit.c | 16 ++++++++-------- src/gwion.c | 2 +- src/lib/complex.c | 6 ++++-- src/lib/engine.c | 30 +++++++++++++++++++----------- src/lib/event.c | 2 +- src/lib/gack.c | 16 ++++++++-------- src/lib/import.c | 2 +- src/lib/opfunc.c | 2 +- src/lib/prim.c | 15 +++++---------- src/lib/vec.c | 5 +++-- src/oo/type.c | 2 +- src/parse/check.c | 32 ++++++++++++++++---------------- src/parse/scan0.c | 6 +++--- tests/import/end_class.c | 1 + tests/import/specialid_emit.c | 3 ++- 16 files changed, 76 insertions(+), 68 deletions(-) diff --git a/include/type.h b/include/type.h index 05f79e1f..9e6c17b9 100644 --- a/include/type.h +++ b/include/type.h @@ -24,7 +24,7 @@ struct Type_ { ae_flag flag; }; -extern Type t_void, t_int, t_bool, t_float, t_dur, t_time, t_now, t_complex, t_polar, t_vec3, t_vec4, +extern Type t_null, t_object, t_shred, t_fork, t_event, t_ugen, t_string, t_ptr, t_array, t_gack, t_function, t_fptr, t_varloop, t_vararg, t_lambda, t_class, t_union, t_undefined, t_auto, t_tuple; @@ -54,7 +54,7 @@ ANN static inline m_bool is_fptr(const Type t) { ANN m_uint get_depth(const Type type); typedef enum { - et_void, et_int, et_bool, et_float, et_dur, et_time, et_now, et_complex, et_polar, et_vec3, et_vec4, + et_void, et_int, et_bool, et_float, et_complex, et_polar, et_vec3, et_vec4, et_null, et_object, et_shred, et_fork, et_event, et_ugen, et_string, et_ptr, et_array, zt_gack, et_function, et_fptr, et_varloop, et_vararg, et_lambda, et_class, et_union, et_undefined, et_auto, et_tuple, MAX_TYPE diff --git a/src/emit/emit.c b/src/emit/emit.c index 42deaa1d..bc59a5ba 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -823,9 +823,9 @@ ANN static m_bool emit_exp_post(const Emitter emit, const Exp_Postfix* post) { return op_emit_bool(emit, &opi); } -ANN static m_bool is_special(const Type t) { - if(isa(t, t_complex) > 0 || isa(t, t_polar) > 0 || - isa(t, t_vec3) > 0 || isa(t, t_vec4) > 0 || +ANN static m_bool is_special(const Emitter emit, const Type t) { + if(isa(t, emit->gwion->type[et_complex]) > 0 || isa(t, emit->gwion->type[et_polar]) > 0 || + isa(t, emit->gwion->type[et_vec3]) > 0 || isa(t, emit->gwion->type[et_vec4]) > 0 || isa(t, t_vararg) > 0) return GW_OK; return GW_ERROR; @@ -965,7 +965,7 @@ ANN Instr emit_exp_call1(const Emitter emit, const Func f) { const Instr back = !GET_FLAG(f->def, op) ? emit_add_instr(emit, PushStaticCode) : (Instr)vector_back(&emit->code->instr); back->m_val = (m_uint)f; } - } else if((f->value_ref->owner_class && is_special(f->value_ref->owner_class) > 0) || + } else if((f->value_ref->owner_class && is_special(emit, f->value_ref->owner_class) > 0) || !f->value_ref->owner_class || (GET_FLAG(f, template) && isa(f->value_ref->type, t_fptr) < 0)) push_func_code(emit, f); @@ -1566,7 +1566,7 @@ ANN static m_bool emit_complex_member(const Emitter emit, const Exp_Dot* member) const Exp base = member->base; base->emit_var = 1; CHECK_BB(emit_exp(emit, base, 0)) - const m_bool is_complex = !strcmp((isa(base->type, t_complex) > 0 ? "re" : "phase") , + const m_bool is_complex = !strcmp((isa(base->type, emit->gwion->type[et_complex]) > 0 ? "re" : "phase") , s_name(member->xid)); if(is_complex && exp_self(member)->emit_var) return GW_OK; @@ -1643,9 +1643,9 @@ ANN static m_bool emit_vararg(const Emitter emit, const Exp_Dot* member) { ANN static m_bool emit_exp_dot_special(const Emitter emit, const Exp_Dot* member) { const Type t = member->t_base; - if(isa(t, t_complex) > 0 || isa(t, t_polar) > 0) + if(isa(t, emit->gwion->type[et_complex]) > 0 || isa(t, emit->gwion->type[et_polar]) > 0) return emit_complex_member(emit, member); - else if(isa(t, t_vec3) > 0 || isa(t, t_vec4) > 0) + else if(isa(t, emit->gwion->type[et_vec3]) > 0 || isa(t, emit->gwion->type[et_vec4]) > 0) return emit_VecMember(emit, member); return emit_vararg(emit, member); } @@ -1680,7 +1680,7 @@ ANN static m_bool emit_exp_dot(const Emitter emit, const Exp_Dot* member) { emit_add_instr(emit, RegPushImm); return GW_OK; } - if(is_special(member->t_base) > 0) + if(is_special(emit, member->t_base) > 0) return emit_exp_dot_special(emit, member); const Value value = find_value(actual_type(member->t_base), member->xid); if(isa(member->t_base, t_class) < 0 && (GET_FLAG(value, member) || diff --git a/src/gwion.c b/src/gwion.c index e5948975..df91d0af 100644 --- a/src/gwion.c +++ b/src/gwion.c @@ -73,7 +73,7 @@ ANN m_bool gwion_ini(const Gwion gwion, Arg* arg) { gwion->env->gwion = gwion; gwion->vm->bbq->si = new_soundinfo(gwion->mp); gwion->data = new_gwiondata(gwion->mp); - gwion->type = xmalloc(MAX_TYPE * sizeof(struct Type_)); + gwion->type = (Type*)xmalloc(MAX_TYPE * sizeof(struct Type_)); pass_default(gwion); arg->si = gwion->vm->bbq->si; const m_bool ret = arg_parse(gwion, arg); diff --git a/src/lib/complex.c b/src/lib/complex.c index bcd65861..07629856 100644 --- a/src/lib/complex.c +++ b/src/lib/complex.c @@ -11,6 +11,8 @@ #include "operator.h" #include "import.h" +#include "gwi.h" + #define describe(name, op) \ static INSTR(Complex##name) {\ POP_REG(shred, SZ_COMPLEX); \ @@ -114,13 +116,13 @@ polar_def2_r(Mul, *, +) polar_def2_r(Div, /, -) GWION_IMPORT(complex) { - GWI_BB(gwi_class_ini(gwi, t_complex, NULL, NULL)) + GWI_BB(gwi_class_ini(gwi, gwi->gwion->type[et_complex], NULL, NULL)) gwi_item_ini(gwi, "float", "re"); GWI_BB(gwi_item_end(gwi, ae_flag_member, NULL)) gwi_item_ini(gwi, "float", "im"); GWI_BB(gwi_item_end(gwi, ae_flag_member, NULL)) GWI_BB(gwi_class_end(gwi)) - GWI_BB(gwi_class_ini(gwi, t_polar, NULL, NULL)) + GWI_BB(gwi_class_ini(gwi, gwi->gwion->type[et_polar], NULL, NULL)) GWI_BB(gwi_item_ini(gwi, "float", "mod")) GWI_BB(gwi_item_end(gwi, ae_flag_member, NULL)) GWI_BB(gwi_item_ini(gwi, "float", "phase")) diff --git a/src/lib/engine.c b/src/lib/engine.c index 9780f1ad..a25b4b49 100644 --- a/src/lib/engine.c +++ b/src/lib/engine.c @@ -18,6 +18,7 @@ #include "engine.h" #include "parser.h" #include "lang_private.h" +#include "specialid.h" static FREEARG(freearg_gack) { free_vector(((Gwion)gwion)->mp, (Vector)instr->m_val2); @@ -56,20 +57,27 @@ ANN static m_bool import_core_libs(const Gwi gwi) { GWI_BB(gwi_add_type(gwi, t_lambda)) GWI_OB((t_gack = gwi_mk_type(gwi, "@Gack", SZ_INT, NULL))) GWI_BB(gwi_add_type(gwi, t_gack)) - GWI_OB((t_int = gwi_mk_type(gwi, "int", SZ_INT, NULL))) - GWI_BB(gwi_add_type(gwi, t_int)) - GWI_OB((t_float = gwi_mk_type(gwi, "float", SZ_FLOAT, NULL))) - GWI_BB(gwi_add_type(gwi, t_float)) - GWI_OB((t_dur = gwi_mk_type(gwi, "dur", SZ_FLOAT, NULL))) + const Type t_int = gwi_mk_type(gwi, "int", SZ_INT, NULL); + GWI_BB(gwi_set_global_type(gwi, t_int, et_int)) + const Type t_float = gwi_mk_type(gwi, "float", SZ_FLOAT, NULL); + GWI_BB(gwi_set_global_type(gwi, t_float, et_float)) + const Type t_dur = gwi_mk_type(gwi, "dur", SZ_FLOAT, NULL); GWI_BB(gwi_add_type(gwi, t_dur)) - GWI_OB((t_time = gwi_mk_type(gwi, "time", SZ_FLOAT, NULL))) + const Type t_time = gwi_mk_type(gwi, "time", SZ_FLOAT, NULL); GWI_BB(gwi_add_type(gwi, t_time)) - GWI_OB((t_now = gwi_mk_type(gwi, "@now", SZ_FLOAT, t_time))) + const Type t_now = gwi_mk_type(gwi, "@now", SZ_FLOAT, t_time); GWI_BB(gwi_add_type(gwi, t_now)) - GWI_OB((t_complex = gwi_mk_type(gwi, "complex", SZ_COMPLEX , NULL))) - GWI_OB((t_polar = gwi_mk_type(gwi, "polar", SZ_COMPLEX , NULL))) - GWI_OB((t_vec3 = gwi_mk_type(gwi, "Vec3", SZ_VEC3, NULL))) - GWI_OB((t_vec4 = gwi_mk_type(gwi, "Vec4", SZ_VEC4, NULL))) + struct SpecialId_ spid = { .type=t_now, .exec=RegPushNow, .is_const=1 }; + gwi_specialid(gwi, "now", &spid); + gwi_reserve(gwi, "now"); + const Type t_complex = gwi_mk_type(gwi, "complex", SZ_COMPLEX , NULL); + gwi->gwion->type[et_complex] = t_complex; + const Type t_polar = gwi_mk_type(gwi, "polar", SZ_COMPLEX , NULL); + gwi->gwion->type[et_polar] = t_polar; + const Type t_vec3 = gwi_mk_type(gwi, "Vec3", SZ_VEC3, NULL); + gwi->gwion->type[et_vec3] = t_vec3; + const Type t_vec4 = gwi_mk_type(gwi, "Vec4", SZ_VEC4, NULL); + gwi->gwion->type[et_vec4] = t_vec4; GWI_BB(import_object(gwi)) GWI_OB((t_union = gwi_mk_type(gwi, "@Union", SZ_INT, t_object))) GWI_BB(gwi_class_ini(gwi, t_union, NULL, NULL)) diff --git a/src/lib/event.c b/src/lib/event.c index 9b8990c2..693b5a01 100644 --- a/src/lib/event.c +++ b/src/lib/event.c @@ -19,7 +19,7 @@ static DTOR(event_dtor) { } static OP_CHECK(opck_eventwait) { - return t_int; + return env->gwion->type[et_int]; } static INSTR(EventWait) { diff --git a/src/lib/gack.c b/src/lib/gack.c index 174be2fc..a830373a 100644 --- a/src/lib/gack.c +++ b/src/lib/gack.c @@ -89,18 +89,18 @@ ANN static inline void print_func(const Type type, const m_bit* stack) { gw_out("%p", NULL); } -ANN static void print_prim(const Type type, const m_bit* stack) { - if(isa(type, t_bool) > 0) +ANN static void print_prim(const Gwion gwion, const Type type, const m_bit* stack) { + if(isa(type, gwion->type[et_bool]) > 0) print_bool(*(m_int*)stack); - else if(isa(type, t_int) > 0) + else if(isa(type, gwion->type[et_int]) > 0) print_int(*(m_int*)stack); - else if(isa(type, t_complex) > 0) + else if(isa(type, gwion->type[et_complex]) > 0) print_complex(*(m_complex*)stack); - else if(isa(type, t_polar) > 0) + else if(isa(type, gwion->type[et_polar]) > 0) print_polar(*(m_complex*)stack); - else if(isa(type, t_vec3) > 0) + else if(isa(type, gwion->type[et_vec3]) > 0) print_vec(stack, 3); - else if(isa(type, t_vec4) > 0) + else if(isa(type, gwion->type[et_vec4]) > 0) print_vec(stack, 4); else print_float(*(m_float*)stack); @@ -125,7 +125,7 @@ ANN void gack(const Gwion gwion, const m_bit* reg, const Instr instr) { else if(isa(type, gwion->type[et_void]) > 0) print_string1("void"); else - print_prim(type, (reg-offset)); + print_prim(gwion, type, (reg-offset)); offset -= type->size; } gw_out("\n"); diff --git a/src/lib/import.c b/src/lib/import.c index e9c8cefa..26429232 100644 --- a/src/lib/import.c +++ b/src/lib/import.c @@ -622,7 +622,7 @@ ANN Type gwi_union_end(const Gwi gwi, const ae_flag flag) { gwi->gwion->env->class_def->nspc->info->offset = udef->o + udef->s; const Type t = udef->xid ? udef->value->type : - udef->type_xid ? udef->type : t_int; + udef->type_xid ? udef->type : gwi->gwion->type[et_int]; free_union_def(gwi->gwion->mp, udef); gwi->union_data.list = NULL; gwi->union_data.xid = NULL; diff --git a/src/lib/opfunc.c b/src/lib/opfunc.c index 5053d515..a30074f7 100644 --- a/src/lib/opfunc.c +++ b/src/lib/opfunc.c @@ -66,7 +66,7 @@ OP_CHECK(opck_unary_meta) { OP_CHECK(opck_unary_meta2) { const Exp_Unary* unary = (Exp_Unary*)data; exp_self(unary)->meta = ae_meta_value; - return t_int; + return env->gwion->type[et_int]; } OP_CHECK(opck_unary) { diff --git a/src/lib/prim.c b/src/lib/prim.c index 1992d86a..82114d10 100644 --- a/src/lib/prim.c +++ b/src/lib/prim.c @@ -76,11 +76,10 @@ static GWION_IMPORT(int_values) { GWI_BB(gwi_enum_ini(gwi, "bool")) GWI_BB(gwi_enum_add(gwi, "false", 0)) GWI_BB(gwi_enum_add(gwi, "true", 1)) - t_bool = gwi_enum_end(gwi); + const Type t_bool = gwi_enum_end(gwi); + gwi->gwion->type[et_bool] = t_bool; GWI_BB(gwi_oper_ini(gwi, NULL, "int", "bool")) GWI_BB(gwi_oper_end(gwi, "!", IntNot)) -// GWI_BB(gwi_item_ini(gwi, "bool", "maybe")) -// GWI_BB(gwi_item_end(gwi, 0, NULL)) gwi_reserve(gwi, "maybe"); struct SpecialId_ spid = { .type=t_bool, .exec=RegPushMaybe, .is_const=1 }; gwi_specialid(gwi, "maybe", &spid); @@ -126,11 +125,8 @@ static GWION_IMPORT(values) { gwi_item_end(gwi, ae_flag_const, hour); gwi_item_ini(gwi, "time", "t_zero"); gwi_item_end(gwi, ae_flag_const, t_zero); - gwi_item_ini(gwi, "@now", "now"); - gwi_item_end(gwi, ae_flag_const, NULL); - gwi_reserve(gwi, "now"); - struct SpecialId_ spid = { .type=t_now, .exec=RegPushNow, .is_const=1 }; - gwi_specialid(gwi, "now", &spid); +// gwi_item_ini(gwi, "@now", "now"); +// gwi_item_end(gwi, ae_flag_const, NULL); return GW_OK; } /* @@ -145,8 +141,7 @@ static OP_CHECK(opck_implicit_f2i) { static OP_CHECK(opck_implicit_i2f) { struct Implicit* imp = (struct Implicit*)data; - imp->e->cast_to = t_float; - return t_float; + return imp->e->cast_to = env->gwion->type[et_float]; } // can't it be just declared? diff --git a/src/lib/vec.c b/src/lib/vec.c index 6fd7ad63..20597042 100644 --- a/src/lib/vec.c +++ b/src/lib/vec.c @@ -10,6 +10,7 @@ #include "operator.h" #include "import.h" #include "driver.h" +#include "gwi.h" INSTR(VecCpy) { POP_REG(shred, instr->m_val2); @@ -158,7 +159,7 @@ static void vecx_base(const Gwi gwi) { } GWION_IMPORT(vec3) { - GWI_BB(gwi_class_ini(gwi, t_vec3, NULL, NULL)) + GWI_BB(gwi_class_ini(gwi, gwi->gwion->type[et_vec3], NULL, NULL)) vecx_base(gwi); gwi_func_ini(gwi, "void", "set", vec3_set); gwi_func_arg(gwi, "float", "x"); @@ -296,7 +297,7 @@ static INSTR(Vec4RAssign) { } GWION_IMPORT(vec4) { - CHECK_BB(gwi_class_ini(gwi, t_vec4, NULL, NULL)) + CHECK_BB(gwi_class_ini(gwi, gwi->gwion->type[et_vec4], NULL, NULL)) vecx_base(gwi); gwi_item_ini(gwi, "float", "w"); gwi_item_end(gwi, ae_flag_member, NULL); diff --git a/src/oo/type.c b/src/oo/type.c index be611145..c3d6e78c 100644 --- a/src/oo/type.c +++ b/src/oo/type.c @@ -197,6 +197,6 @@ ANN m_uint get_depth(const Type type) { return depth; } -Type t_int, t_bool, t_float, t_dur, t_time, t_now, t_complex, t_polar, t_vec3, t_vec4, +Type t_null, t_object, t_shred, t_fork, t_event, t_ugen, t_string, t_ptr, t_array, t_gack, t_function, t_fptr, t_varloop, t_vararg, t_lambda, t_class, t_union, t_undefined, t_auto, t_tuple; diff --git a/src/parse/check.c b/src/parse/check.c index 18b3343d..1d87b180 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -29,7 +29,7 @@ ANN m_bool check_class_def(const Env env, const Class_Def class_def); ANN m_bool check_exp_array_subscripts(Env env, Exp exp) { CHECK_OB(check_exp(env, exp)) - do if(isa(exp->type, t_int) < 0) + do if(isa(exp->type, env->gwion->type[et_int]) < 0) ERR_B(exp->pos, _("incompatible array subscript type '%s' ..."), exp->type->name) while((exp = exp->next)); return GW_OK; @@ -167,7 +167,7 @@ ANN static m_bool prim_array_inner(const Env env, Type type, const Exp e) { const Type common = find_common_anc(e->type, type); if(common) return GW_OK; - else if(!(isa(e->type, t_int) > 0 && isa(type, t_float) > 0)) + else if(!(isa(e->type, env->gwion->type[et_int]) > 0 && isa(type, env->gwion->type[et_float]) > 0)) ERR_B(e->pos, _("array init [...] contains incompatible types ...")) set_cast(env, type, e); return GW_OK; @@ -270,9 +270,9 @@ ANN static m_bool vec_value(const Env env, Exp e, const m_str s) { CHECK_OB(check_exp(env, e)) do { const Type t = e->type; - if(isa(t, t_float) < 0) { - if(isa(t, t_int) > 0) - set_cast(env, t_float, e); + if(isa(t, env->gwion->type[et_float]) < 0) { + if(isa(t, env->gwion->type[et_int]) > 0) + set_cast(env, env->gwion->type[et_float], e); else ERR_B(e->pos, _("invalid type '%s' in %s value #%d...\n" " (must be of type 'int' or 'float')"), t->name, s, count) @@ -288,18 +288,18 @@ struct VecInfo { m_uint n; }; -ANN static void vec_info(const ae_prim_t t, struct VecInfo* v) { +ANN static void vec_info(const Env env, const ae_prim_t t, struct VecInfo* v) { if(t == ae_primary_complex) { v->s = "complex"; - v->t = t_complex; + v->t = env->gwion->type[et_complex]; v->n = 2; } else if(t == ae_primary_vec) { - v->t = v->n == 4 ? t_vec4 : t_vec3; + v->t = env->gwion->type[v->n == 4 ? et_vec4 : et_vec3]; v->n = 4; v->s = "vector"; } else { v->s = "polar"; - v->t = t_polar; + v->t = env->gwion->type[et_polar]; v->n = 2; } } @@ -308,7 +308,7 @@ ANN static Type prim_vec(const Env env, const Exp_Primary* primary) { const Vec * vec = &primary->d.vec; const ae_prim_t t = primary->primary_type; struct VecInfo info = { .n=vec->dim }; - vec_info(t, &info); + vec_info(env, t, &info); if(vec->dim > info.n) ERR_O(vec->exp->pos, _("extraneous component of %s value..."), info.s) CHECK_BO(vec_value(env, vec->exp, info.s)) @@ -338,8 +338,8 @@ ANN static Type prim_tuple(const Env env, const Exp_Primary * primary) { ANN static Type prim_##name(const Env env NUSED, const Exp_Primary * primary NUSED) {\ return type; \ } -describe_prim_xxx(num, t_int) -describe_prim_xxx(float, t_float) +describe_prim_xxx(num, env->gwion->type[et_int]) +describe_prim_xxx(float, env->gwion->type[et_float]) describe_prim_xxx(nil, env->gwion->type[et_void]) describe_prim_xxx(unpack, t_tuple) @@ -396,7 +396,7 @@ ANN static Type at_depth(const Env env, const Array_Sub array) { } static inline m_bool index_is_int(const Env env, Exp e, m_uint *depth) { - do if(isa(e->type, t_int) < 0) + do if(isa(e->type, env->gwion->type[et_int]) < 0) ERR_B(e->pos, _("array index %i must be of type 'int', not '%s'"), *depth, e->type->name) while(++(*depth) && (e = e->next)); @@ -1041,10 +1041,10 @@ ANN static m_bool cond_type(const Env env, const Exp e) { if(e->next) ERR_B(e->pos, _("conditional must be a single expression")) const Type t = e->type; - if(isa(t, t_int) > 0) + if(isa(t, env->gwion->type[et_int]) > 0) return GW_OK; - if(isa(t, t_float) > 0) { - e->cast_to = t_int; + if(isa(t, env->gwion->type[et_float]) > 0) { + e->cast_to = env->gwion->type[et_int]; e->nspc = env->curr; return GW_OK; } diff --git a/src/parse/scan0.c b/src/parse/scan0.c index e5615a21..5b0ca0f2 100644 --- a/src/parse/scan0.c +++ b/src/parse/scan0.c @@ -164,10 +164,10 @@ ANN m_bool scan0_enum_def(const Env env, const Enum_Def edef) { s_name(edef->xid), v->type->name) CHECK_BB(scan0_defined(env, edef->xid, edef->pos)) } - const Type t = type_copy(env->gwion->mp, t_int); + const Type t = type_copy(env->gwion->mp, env->gwion->type[et_int]); t->xid = ++env->scope->type_xid; t->name = edef->xid ? s_name(edef->xid) : "int"; - t->e->parent = t_int; + t->e->parent = env->gwion->type[et_int]; const Nspc nspc = GET_FLAG(edef, global) ? env->global_nspc : env->curr; t->e->owner = nspc; edef->t = t; @@ -175,7 +175,7 @@ ANN m_bool scan0_enum_def(const Env env, const Enum_Def edef) { add_type(env, nspc, t); mk_class(env, t); } - scan0_implicit_similar(env, t_int, t); + scan0_implicit_similar(env, env->gwion->type[et_int], t); return GW_OK; } diff --git a/tests/import/end_class.c b/tests/import/end_class.c index 87a91353..c9b9528d 100644 --- a/tests/import/end_class.c +++ b/tests/import/end_class.c @@ -4,6 +4,7 @@ #include "oo.h" #include "vm.h" #include "env.h" +#include "type.h" #include "gwion.h" #include "operator.h" #include "object.h" diff --git a/tests/import/specialid_emit.c b/tests/import/specialid_emit.c index 4069b078..5c0d6e04 100644 --- a/tests/import/specialid_emit.c +++ b/tests/import/specialid_emit.c @@ -11,6 +11,7 @@ #include "import.h" #include "emit.h" #include "specialid.h" +#include "gwi.h" static ID_EMIT(spidem) { @@ -20,7 +21,7 @@ static ID_EMIT(spidem) { } GWION_IMPORT(spid_test) { - struct SpecialId_ spid = { .type=t_int, .em=spidem, .is_const = 1 }; + struct SpecialId_ spid = { .type=gwi->gwion->type[et_int], .em=spidem, .is_const = 1 }; gwi_specialid(gwi, "testid", &spid); return GW_OK; } -- 2.43.0