ANN2(1,3) static inline M_Object new_object_str(const Gwion gwion, const VM_Shred shred, const m_str str) {
struct loc_t_ loc = {};
- DECL_OO(const Type, t, = str2type(gwion, str, loc))
+ DECL_OO(const Type, t, = str2type(gwion, str, loc));
return new_object(gwion->mp, shred, t);
}
#endif
-Subproject commit 9386165c3380116963344573104bcb97678297c7
+Subproject commit 109a1b84ab2b525d475dbca811325cc6b5adf693
ANN static m_int _frame_pop(const Emitter emit) {
Frame *frame = emit->code->frame;
- DECL_OB(const Local*, l, = (Local*)vector_pop(&frame->stack))
+ DECL_OB(const Local*, l, = (Local*)vector_pop(&frame->stack));
frame->curr_offset -= l->type->size;
if(l->skip)
return _frame_pop(emit);
const Array_Sub array, const m_bool is_ref) {
emit_notpure(emit);
if(type->array_depth) {
- DECL_OB(ArrayInfo*, info, = emit_array_extend_inner(emit, type, array ? array->exp : NULL, is_ref))
+ DECL_OB(ArrayInfo*, info, = emit_array_extend_inner(emit, type, array ? array->exp : NULL, is_ref));
return GW_OK;
} else if(!is_ref) {
const Instr instr = emit_add_instr(emit, ObjectInstantiate);
exp_setvar(e, 1);
exp_setvar(exp_if->else_exp, 1);
}
- DECL_OB(const Instr, op, = emit_flow(emit, exp_if->cond))
+ DECL_OB(const Instr, op, = emit_flow(emit, exp_if->cond));
CHECK_BB(emit_exp_pop_next(emit, exp_if->if_exp ?: exp_if->cond));
const Instr op2 = emit_add_instr(emit, Goto);
op->m_val = emit_code_size(emit);
ANN static m_bool emit_if(const Emitter emit, const Stmt_If stmt) {
if(stmt->cond->exp_type == ae_exp_primary && stmt->cond->d.prim.prim_type == ae_prim_num)
return emit_if_const(emit, stmt);
- DECL_OB(const Instr, op, = emit_flow(emit, stmt->cond))
+ DECL_OB(const Instr, op, = emit_flow(emit, stmt->cond));
CHECK_BB(scoped_stmt(emit, stmt->if_body, 1));
const Instr op2 = emit_add_instr(emit, Goto);
op->m_val = emit_code_size(emit);
ANN static m_bool _emit_stmt_for(const Emitter emit, const Stmt_For stmt, m_uint *action_index) {
CHECK_BB(emit_stmt(emit, stmt->c1, 1));
const m_uint index = emit_code_size(emit);
- DECL_OB(const Instr, op, = emit_flow(emit, stmt->c2->d.stmt_exp.val))
+ DECL_OB(const Instr, op, = emit_flow(emit, stmt->c2->d.stmt_exp.val));
CHECK_BB(scoped_stmt(emit, stmt->body, 1));
*action_index = emit_code_size(emit);
if(stmt->c3) {
#undef RETURN_TYPE
ANN Type find_type(const Env env, Type_Decl *path) {
- DECL_OO(const Type, type, = find_initial(env, path->xid))
+ DECL_OO(const Type, type, = find_initial(env, path->xid));
while((path = path->next) && type && type->nspc) {
const Nspc nspc = type->nspc;
const Type child = find_in_parent(type, path->xid);
ANN2(1,2) Type gwi_class_ini(const Gwi gwi, const m_str name, const m_str parent) {
struct ImportCK ck = { .name=name };
CHECK_BO(check_typename_def(gwi, &ck));
- DECL_OO(Type_Decl *,td, = gwi_str2td(gwi, parent ?: "Object"))
+ DECL_OO(Type_Decl *,td, = gwi_str2td(gwi, parent ?: "Object"));
Tmpl* tmpl = ck.tmpl ? new_tmpl_base(gwi->gwion->mp, ck.tmpl) : NULL;
if(tmpl)
CHECK_BO(template_push_types(gwi->gwion->env, tmpl));
// only in enum.c
ANN ID_List str2symlist(const Gwion gwion, const m_str path, const loc_t pos) {
- DECL_OO(const Symbol, sym, = str2sym(gwion, path, pos))
+ DECL_OO(const Symbol, sym, = str2sym(gwion, path, pos));
return new_id_list(gwion->mp, sym);
}
ANN Var_Decl str2var(const Gwion gwion, const m_str path, const loc_t pos) {
struct td_checker tdc = { .str=path, .pos=pos };
- DECL_OO(const Symbol, sym, = __str2sym(gwion, &tdc))
+ DECL_OO(const Symbol, sym, = __str2sym(gwion, &tdc));
struct AC ac = { .str = tdc.str, .pos=pos };
CHECK_BO(ac_run(gwion, &ac));
const Array_Sub array = ac.depth ?
// only in udef.c
ANN Var_Decl_List str2varlist(const Gwion gwion, const m_str path, const loc_t pos) {
- DECL_OO(const Var_Decl, var, = str2var(gwion, path, pos))
+ DECL_OO(const Var_Decl, var, = str2var(gwion, path, pos));
return new_var_decl_list(gwion->mp, var, NULL);
}
ANN static ID_List _tmpl_list(const Gwion gwion, struct td_checker *tdc) {
- DECL_OO(const Symbol, sym, = __str2sym(gwion, tdc))
+ DECL_OO(const Symbol, sym, = __str2sym(gwion, tdc));
ID_List next = NULL;
if(*tdc->str == ',') {
++tdc->str;
ANN static Type_Decl* _str2td(const Gwion gwion, struct td_checker *tdc) {
const uint ref = get_n(tdc, '&');
- DECL_OO(const Symbol, sym, = __str2sym(gwion, tdc))
+ DECL_OO(const Symbol, sym, = __str2sym(gwion, tdc));
struct AC ac = { .str = tdc->str, .pos=tdc->pos };
CHECK_BO(ac_run(gwion, &ac));
tdc->str = ac.str;
ANN Type_Decl* str2td(const Gwion gwion, const m_str str, const loc_t pos) {
struct td_checker tdc = { .str=str, .pos=pos };
- DECL_OO(Type_Decl *, td, = _str2td(gwion, &tdc))
+ DECL_OO(Type_Decl *, td, = _str2td(gwion, &tdc));
if(*tdc.str) {
free_type_decl(gwion->mp, td);
GWION_ERR_O(pos, "excedental character '%c'", *tdc.str);
}
ANN Type str2type(const Gwion gwion, const m_str str, const loc_t pos) {
- DECL_OO(Type_Decl *, td, = str2td(gwion, str, pos))
+ DECL_OO(Type_Decl *, td, = str2td(gwion, str, pos));
const Type t = known_type(gwion->env, td);
free_type_decl(gwion->mp, td);
return t;
ANN static m_bool td_info_run(const Env env, struct td_info* info) {
Type_List tl = info->tl;
do {
- DECL_OB(const Type, t, = known_type(env, tl->td))
+ DECL_OB(const Type, t, = known_type(env, tl->td));
td_fullname(env, &info->text, t);
if(tl->next)
text_add(&info->text, ",");
//! TODO: change return type to m_bool
ANN m_int gwi_enum_add(const Gwi gwi, const m_str name, const m_uint i) {
CHECK_BB(ck_ok(gwi, ck_edef));
- DECL_OB(const ID_List, list, = gwi_str2symlist(gwi, name))
+ DECL_OB(const ID_List, list, = gwi_str2symlist(gwi, name));
add2list(gwi->ck, list);
vector_add(&gwi->ck->v, (vtype)i);
return GW_OK;
gwi->ck->variadic = 1;
return GW_OK;
}
- DECL_OB(Type_Decl*, td, = gwi_str2td(gwi, t))
+ DECL_OB(Type_Decl*, td, = gwi_str2td(gwi, t));
const Var_Decl var = gwi_str2var(gwi, n);
if(var) {
const Arg_List arg = new_arg_list(gwi->gwion->mp, td, var, NULL);
ANN Type gwi_fptr_end(const Gwi gwi, const ae_flag flag) {
CHECK_BO(ck_ok(gwi, ck_fdef));
- DECL_OO(const Fptr_Def, fptr, = import_fptr(gwi))
+ DECL_OO(const Fptr_Def, fptr, = import_fptr(gwi));
fptr->base->flag |= flag;
if(safe_tflag(gwi->gwion->env->class_def, tflag_tmpl)/* && !fptr->base->tmpl*/) {
section_fptr(gwi, fptr);
// move me
ANN Exp make_exp(const Gwi gwi, const m_str type, const m_str name) {
- DECL_OO(Type_Decl*, td, = gwi_str2td(gwi, type))
+ DECL_OO(Type_Decl*, td, = gwi_str2td(gwi, type));
const Var_Decl_List vlist = gwi_str2varlist(gwi, name);
if(vlist)
return new_exp_decl(gwi->gwion->mp, td, vlist, gwi->loc);
ANN m_int gwi_union_add(const Gwi gwi, const restrict m_str type, const restrict m_str name) {
CHECK_BB(ck_ok(gwi, ck_udef));
- DECL_OB(Type_Decl*, td, = str2td(gwi->gwion, type, gwi->loc))
- DECL_OB(const Symbol, xid, = str2sym(gwi->gwion, name, gwi->loc))
+ DECL_OB(Type_Decl*, td, = str2td(gwi->gwion, type, gwi->loc));
+ DECL_OB(const Symbol, xid, = str2sym(gwi->gwion, name, gwi->loc));
const Union_List l = new_union_list(gwi->gwion->mp, td, xid, gwi->loc);
l->next = gwi->ck->list;
gwi->ck->list = l;
const Func_Def fdef = dt->def ?: dt->base;
const Symbol sym = func_symbol(env, nspc->name, s_name(fdef->base->xid),
"template", dt->base->base->tmpl->base);
- DECL_OO(const Value, v, = nspc_lookup_value0(nspc, sym) ?: nspc_lookup_value0(nspc, fdef->base->xid))
+ DECL_OO(const Value, v, = nspc_lookup_value0(nspc, sym) ?: nspc_lookup_value0(nspc, fdef->base->xid));
if(is_class(env->gwion, v->type))
return NULL;
if(vflag(v, vflag_builtin)) {
}
ANN static Func_Def traverse_tmpl(const Emitter emit, struct dottmpl_ *const dt, const Nspc nspc) {
- DECL_OO(const Func_Def, def, = from_base(emit->env, dt, nspc))
+ DECL_OO(const Func_Def, def, = from_base(emit->env, dt, nspc));
CHECK_BO(traverse_dot_tmpl(emit, dt));
if(dt->xfun)
builtin_func(emit->gwion->mp, def->base->func, dt->xfun);
}
static m_bool td_match(const Env env, Type_Decl *id[2]) {
- DECL_OB(const Type, t0, = known_type(env, id[0]))
- DECL_OB(const Type, t1, = known_type(env, id[1]))
+ DECL_OB(const Type, t0, = known_type(env, id[0]));
+ DECL_OB(const Type, t1, = known_type(env, id[1]));
if(isa(t0, t1) > 0)
return GW_OK;
return t1 == env->gwion->type[et_auto] ? GW_OK:GW_ERROR;
info->lhs = v->type->info->func;
}
} else {
- DECL_OO(const Type, t, = nspc_lookup_type1(nspc, info->lhs->def->base->xid))
+ DECL_OO(const Type, t, = nspc_lookup_type1(nspc, info->lhs->def->base->xid));
info->lhs = actual_type(env->gwion, t)->info->func;
}
Type type = NULL;
}
ANN static ssize_t template_size(const Env env, struct tmpl_info* info) {
- DECL_OB(const m_str, str, = tl2str(env->gwion, info->td->types, info->td->pos))
+ DECL_OB(const m_str, str, = tl2str(env->gwion, info->td->types, info->td->pos));
const size_t tmpl_sz = tmpl_set(info, str);
const m_str base = type2str(env->gwion, info->base, info->td->pos);
return tmpl_sz + tmpl_set(info, base) + 4;
Exp_Call *exp, const Tmpl *tm) {
Tmpl tmpl = { .call=tm->call };
exp->tmpl = &tmpl;
- DECL_OO(const Func, func, = get_template_func(env, exp, v))
+ DECL_OO(const Func, func, = get_template_func(env, exp, v));
return v->d.func_ref = func;
}
ANN static Type check_predefined(const Env env, Exp_Call *exp, const Value v, const Tmpl *tm, const Func_Def fdef) {
- DECL_OO(const Func, func, = v->d.func_ref ?: predefined_func(env, v, exp, tm))
+ DECL_OO(const Func, func, = v->d.func_ref ?: predefined_func(env, v, exp, tm));
if(!fdef->base->ret_type) { // template fptr
struct EnvSet es = { .env=env, .data=env, .func=(_exp_func)check_cdef,
.scope=env->scope->depth, .flag=tflag_check };
ANN static Type check_exp_call_template(const Env env, Exp_Call *exp) {
const Type t = exp->func->type;
- DECL_OO(const Value, value, = type_value(env->gwion, t))
+ DECL_OO(const Value, value, = type_value(env->gwion, t));
const Func_Def fdef = value->d.func_ref ? value->d.func_ref->def : t->info->func->def;
Tmpl *tm = fdef->base->tmpl;
if(tm->call)
return check_predefined(env, exp, value, tm, fdef);
- DECL_OO(const Type_List, tl, = check_template_args(env, exp, tm, fdef));
+ DECL_OO(const Type_List, tl, = check_template_args(env, exp, tm, fdef));;
Tmpl tmpl = { .call=tl };
((Exp_Call*)exp)->tmpl = &tmpl;
- DECL_OO(const Func,func, = get_template_func(env, exp, value))
+ DECL_OO(const Func,func, = get_template_func(env, exp, value));
return func->def->base->ret_type;
}
}
}
ANN Type check_exp_call1(const Env env, Exp_Call *const exp) {
- DECL_BO(const m_bool, ret, = func_check(env, exp))
+ DECL_BO(const m_bool, ret, = func_check(env, exp));
if(!ret)
return exp_self(exp)->type;
const Type t = actual_type(env->gwion, exp->func->type);
}
ANN static Type check_exp_cast(const Env env, const Exp_Cast* cast) {
- DECL_OO(const Type, t, = check_exp(env, cast->exp))
+ DECL_OO(const Type, t, = check_exp(env, cast->exp));
CHECK_OO((exp_self(cast)->type = known_type(env, cast->td)));
struct Op_Import opi = { .op=insert_symbol("$"), .lhs=t, .rhs=exp_self(cast)->type,
.data=(uintptr_t)cast, .pos=exp_self(cast)->pos };
ANN static Type check_exp_call(const Env env, Exp_Call* exp) {
if(exp->tmpl) {
- DECL_BO(const m_bool, ret, = func_check(env, exp))
+ DECL_BO(const m_bool, ret, = func_check(env, exp));
if(!ret)
return exp_self(exp)->type;
const Type t = actual_type(env->gwion, exp->func->type);
CHECK_BO(predefined_call(env, t, exp_self(exp)->pos));
}
const Value v = type_value(env->gwion, t);
- DECL_OO(const Func, f, = find_template_match(env, v, exp))
+ DECL_OO(const Func, f, = find_template_match(env, v, exp));
exp->func->type = f->value_ref->type;
return f->def->base->ret_type;
}
}
struct Op_Import opi = { .op=unary->op, .rhs=rhs,
.data=(uintptr_t)unary, .pos=exp_self(unary)->pos };
- DECL_OO(const Type, ret, = op_check(env, &opi))
+ DECL_OO(const Type, ret, = op_check(env, &opi));
const Type t = actual_type(env->gwion, ret);
CHECK_BO(ensure_traverse(env, t));
return ret;
}
ANN static Type _flow(const Env env, const Exp e, const m_bool b) {
- DECL_OO(const Type, type, = check_exp(env, e))
+ DECL_OO(const Type, type, = check_exp(env, e));
struct Op_Import opi = { .op=insert_symbol(b ? "@conditionnal" : "@unconditionnal"),
.rhs=type, .pos=e->pos, .data=(uintptr_t)e };
return op_check(env, &opi);
ANN static Type check_exp_if(const Env env, const Exp_If* exp_if) {
const Exp e = exp_if->if_exp ?: exp_if->cond;
- DECL_OO(const Type, cond, = check_flow(env, exp_if->cond))
- DECL_OO(const Type, if_exp, = (exp_if->if_exp ? check_exp(env, exp_if->if_exp) : cond))
- DECL_OO(const Type, else_exp, = check_exp(env, exp_if->else_exp))
+ DECL_OO(const Type, cond, = check_flow(env, exp_if->cond));
+ DECL_OO(const Type, if_exp, = (exp_if->if_exp ? check_exp(env, exp_if->if_exp) : cond));
+ DECL_OO(const Type, else_exp, = check_exp(env, exp_if->else_exp));
const uint meta = exp_getmeta(e) || exp_getmeta(exp_if->else_exp);
exp_setmeta(exp_self(exp_if), meta);
const Exp_If* exp_if NUSED) { return env->gwion->type[et_lambda]; }
ANN static Type check_exp_td(const Env env, Type_Decl **td) {
- DECL_OO(const Type, t, = known_type(env, *td))
+ DECL_OO(const Type, t, = known_type(env, *td));
return type_class(env->gwion, t);
}
}
ANN static inline Type foreach_type(const Env env, const Exp exp) {
- DECL_OO(Type, et, = check_exp(env, exp))
+ DECL_OO(Type, et, = check_exp(env, exp));
if(isa(et, env->gwion->type[et_array]) < 0)
ERR_O(exp->pos, _("type '%s' is not array.\n"
" This is not allowed in foreach loop"), et->name)
- DECL_OO(Type, base, = typedef_base(et))
- DECL_OO(const Type, t, = array_base(base))
+ DECL_OO(Type, base, = typedef_base(et));
+ DECL_OO(const Type, t, = array_base(base));
const m_uint depth = base->array_depth - 1;
return depth ? array_type(env, t, depth) : t;
}
ANN static m_bool do_stmt_each(const Env env, const Stmt_Each stmt) {
- DECL_OB(const Type, base, = foreach_type(env, stmt->exp))
+ DECL_OB(const Type, base, = foreach_type(env, stmt->exp));
CHECK_BB(ensure_traverse(env, base));
const m_str basename = type2str(env->gwion, base, stmt->exp->pos);
char c[15 + strlen(basename)];
ERR_B(stmt_self(stmt)->pos, _("'return' statement found outside function definition"))
if(env->scope->depth == 1) // so ops no dot set scope->depth ?
set_fflag(env->func, fflag_return);
- DECL_OB(const Type, ret_type, = stmt->val ? check_exp(env, stmt->val) : env->gwion->type[et_void])
+ DECL_OB(const Type, ret_type, = stmt->val ? check_exp(env, stmt->val) : env->gwion->type[et_void]);
if(!env->func->def->base->ret_type) {
assert(isa(env->func->value_ref->type, env->gwion->type[et_lambda]) > 0);
env->func->def->base->ret_type = ret_type;
return GW_OK;
Value override = NULL;
CHECK_BB(check_func_def_override(env, fdef, &override));
- DECL_BB(const m_int, scope, = GET_FLAG(fdef->base, global) ? env_push_global(env) : env->scope->depth)
+ DECL_BB(const m_int, scope, = GET_FLAG(fdef->base, global) ? env_push_global(env) : env->scope->depth);
const Func former = env->func;
env->func = func;
++env->scope->depth;
}
ANN static Func _find_template_match(const Env env, const Value v, Exp_Call *const exp) {
- DECL_OO(const m_str, tmpl_name, = tl2str(env->gwion, exp->tmpl->call, exp->func->pos))
+ DECL_OO(const m_str, tmpl_name, = tl2str(env->gwion, exp->tmpl->call, exp->func->pos));
const Func f = find_tmpl(env, v, exp, tmpl_name);
free_mstr(env->gwion->mp, tmpl_name);
return f;
ANN m_bool operator_set_func(const struct Op_Import* opi) {
const Nspc nspc = ((Func)opi->data)->value_ref->from->owner;
const Vector v = (Vector)map_get(&nspc->info->op_map, (vtype)opi->op);
- DECL_OB(M_Operator*, mo, = operator_find(v, opi->lhs, opi->rhs))
+ DECL_OB(M_Operator*, mo, = operator_find(v, opi->lhs, opi->rhs));
mo->func = (Func)opi->data;
return GW_OK;
}
ANN m_bool scan0_type_def(const Env env, const Type_Def tdef) {
CHECK_BB(env_access(env, tdef->ext->flag, tdef->ext->pos));
- DECL_OB(const Type, base, = tdef->tmpl ? find_type(env, tdef->ext) : known_type(env, tdef->ext))
+ DECL_OB(const Type, base, = tdef->tmpl ? find_type(env, tdef->ext) : known_type(env, tdef->ext));
CHECK_BB(scan0_defined(env, tdef->xid, tdef->ext->pos));
const bool global = GET_FLAG(tdef->ext, global); // TODO: handle global in class
if(global) {
}
ANN static Type get_parent_base(const Env env, Type_Decl *td) {
- DECL_OO(const Type, t, = find_type(env, td))
+ DECL_OO(const Type, t, = find_type(env, td));
Type owner = env->class_def;
while(owner) {
if(t == owner)
}
ANN static inline Type scan0_final(const Env env, Type_Decl *td) {
- DECL_OO(const Type, t, = known_type(env, td))
+ DECL_OO(const Type, t, = known_type(env, td));
if(!GET_FLAG(t, final))
return t;
ERR_O(td->pos, _("can't inherit from final parent class '%s'\n."), t->name);
#define scan0_func_def dummy_func
ANN static m_bool scan0_extend_def(const Env env, const Extend_Def xdef) {
- DECL_OB(const Type, t, = known_type(env, xdef->td))
+ DECL_OB(const Type, t, = known_type(env, xdef->td));
if(isa(t, env->gwion->type[et_compound]) < 0)
ERR_B(xdef->td->pos, _("only compound types can be extended"))
if(GET_FLAG(t, final)) // TODO: add type initial declaration
}
ANN static Type scan1_type(const Env env, Type_Decl* td) {
- DECL_OO(const Type, t, = known_type(env, td))
+ DECL_OO(const Type, t, = known_type(env, td));
if(!env->func && env->class_def && !GET_FLAG(td, late))
CHECK_BO(type_cyclic(env, t, td));
CHECK_BO(ensure_scan1(env, t));
}
ANN static Type void_type(const Env env, Type_Decl* td) {
- DECL_OO(const Type, type, = scan1_type(env, td))
+ DECL_OO(const Type, type, = scan1_type(env, td));
if(type->size)
return type;
ERR_O(td->pos, _("cannot declare variables of size '0' (i.e. 'void')..."))
ANN static Type scan1_exp_decl_type(const Env env, Exp_Decl* decl) {
if(decl->type)
return decl->type;
- DECL_OO(const Type ,t, = void_type(env, decl->td))
+ DECL_OO(const Type ,t, = void_type(env, decl->td));
if(decl->td->xid == insert_symbol("auto") && decl->type)
return decl->type;
if(GET_FLAG(t, private) && t->info->value->from->owner != env->curr)
nspc_add_value_front(env->curr, insert_symbol("@index"), v);
valuefrom(env, v->from, udef->pos);
do {
- DECL_OB(const Type, t, = known_type(env, l->td))
+ DECL_OB(const Type, t, = known_type(env, l->td));
if(nspc_lookup_value0(env->curr, l->xid))
ERR_B(l->pos, _("'%s' already declared in union"), s_name(l->xid))
const Value v = new_value(env->gwion->mp, t, s_name(l->xid));
const loc_t pos = cdef->base.ext->pos;
if(cdef->base.ext->array && cdef->base.ext->array->exp)
CHECK_BB(scan1_exp(env, cdef->base.ext->array->exp));
- DECL_OB(const Type , parent, = scan1_get_parent(env, &cdef->base))
+ DECL_OB(const Type , parent, = scan1_get_parent(env, &cdef->base));
if(isa(parent, env->gwion->type[et_object]) < 0)
ERR_B(pos, _("cannot extend primitive type '%s'"), parent->name)
CHECK_BB(ensure_scan1(env, parent));
}
ANN static inline m_int _push(const Env env, const Class_Def c) {
- DECL_BB(const m_int, scope, = env_push_type(env, c->base.type))
+ DECL_BB(const m_int, scope, = env_push_type(env, c->base.type));
return (!c->base.tmpl || tmpl_push(env, c->base.tmpl)) ?
scope : GW_ERROR;
}
// TODO: 'v' should be 2° argument
ANN m_bool
scanx_body(const Env e, const Class_Def c, const _exp_func f, void* d) {
- DECL_BB(const m_int, scope, = _push(e, c))
+ DECL_BB(const m_int, scope, = _push(e, c));
const m_bool ret = _body(d, c->body, f);
_pop(e, c, scope);
return ret;
}
static ANN Type scan_func(const Env env, const Type t, const Type_Decl* td) {
- DECL_OO(const m_str, tl_name, = tl2str(env->gwion, td->types, td->pos))
+ DECL_OO(const m_str, tl_name, = tl2str(env->gwion, td->types, td->pos));
const Symbol sym = func_symbol(env, t->info->value->from->owner->name, t->info->func->name, tl_name, 0);
free_mstr(env->gwion->mp, tl_name);
const Type base_type = nspc_lookup_type1(t->info->value->from->owner, sym);
while(last->next)
last = last->next;
Array_Sub array = last->array;
- DECL_OO(const Type, base, = find_type(env, td))
+ DECL_OO(const Type, base, = find_type(env, td));
const Context ctx = base->info->value->from->ctx;
if(ctx && ctx->error)
ERR_O(td->pos, _("type '%s' is invalid"), base->name)
- DECL_OO(const Type, type, = scan_type(env, base, td))
+ DECL_OO(const Type, type, = scan_type(env, base, td));
const Type t = !td->ref ? type : ref(env, td);
const Type ret = !td->option ? t : option(env, td);
return !array ? ret: array_type(env, ret, array->depth);
ANN2(2) static int gw_vasprintf(MemPool mp, char **str, const char *fmt, va_list args) {
char *base = *str;
const size_t base_len = base ? strlen(base) : 0;
- DECL_BB(const int, size, = fmtlen(fmt, args))
+ DECL_BB(const int, size, = fmtlen(fmt, args));
char *ret = mp_malloc2(mp, base_len + size + 1);
if(base)
strcpy(ret, base);
GWION_IMPORT(dummy_module) {
set_module(gwi->gwion, "get_module", (void*)1);
- CHECK_OB(get_module(gwi->gwion, "get_module"))
+ GWI_OB(get_module(gwi->gwion, "get_module"))
puts("test passed");
get_module(gwi->gwion, "non_existant_module");
return GW_OK;
#define _XOPEN_SOURCE 500
#include <string.h>
GWION_IMPORT(compile_string) {
- DECL_OB(FILE *,file, = fopen("rm_me.gw", "w+"))
+ DECL_OB(FILE *,file, = fopen("rm_me.gw", "w+"));
fprintf(file, "1;");
rewind(file);
const m_bool ret = compile_file(gwi->gwion, __FILE__, file) ?
#include "gwi.h"
GWION_IMPORT(trig) {
- DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T~", SZ_INT, NULL))
+ DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T~", SZ_INT, NULL));
gwi_add_type(gwi, t0);
const Type t1 = gwi_mk_type(gwi, "T,", SZ_INT, NULL);
#include "gwi.h"
GWION_IMPORT(trig) {
- DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T~", SZ_INT, NULL))
+ DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T~", SZ_INT, NULL));
gwi_add_type(gwi, t0);
return GW_OK;
}
#include "gwi.h"
GWION_IMPORT(trig) {
- DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T,", SZ_INT, NULL))
+ DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T,", SZ_INT, NULL));
gwi_add_type(gwi, t0);
return GW_OK;
}
#include "gwi.h"
GWION_IMPORT(trig) {
- DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T<a>", SZ_INT, NULL))
+ DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T<a>", SZ_INT, NULL));
gwi_add_type(gwi, t0);
return GW_OK;
}
#include "gwi.h"
GWION_IMPORT(trig) {
- DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T:[a]", SZ_INT, NULL))
+ DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T:[a]", SZ_INT, NULL));
gwi_add_type(gwi, t0);
return GW_OK;
}