-Subproject commit e44ed608c3017151511c1ec23db9a4fd97007729
+Subproject commit 288d889c1479bc51f413836bbebeb63031742215
} DL_Func;
typedef struct {
- Operator op;
+ Symbol op;
m_str ret, lhs, rhs;
Type (*ck)(Env, void*, m_bool*);
m_bool (*em)(Emitter, void*);
- m_bool mut;
} DL_Oper;
typedef struct {
#define ALLOC_PTR(p, a, b, c) b* a = (b*)_mp_calloc(p, sizeof(b)); *a = (b)c
#define _CHECK_OP(op, check, func)\
CHECK_BB(gwi_oper_add(gwi, opck_##check))\
- CHECK_BB(gwi_oper_end(gwi, op_##op, func))
+ CHECK_BB(gwi_oper_end(gwi, op, func))
#define GWI_LOC new_loc(gwi->gwion->mp, __LINE__)
ANN2(1) m_int gwi_oper_ini(const Gwi gwi, const m_str l, const m_str r, const m_str t);
ANN m_int gwi_oper_add(const Gwi gwi, opck);
ANN m_int gwi_oper_emi(const Gwi gwi, opem);
-ANN2(1) m_int gwi_oper_end(const Gwi gwi, const Operator op, const f_instr f);
+ANN2(1) m_int gwi_oper_end(const Gwi gwi, const m_str op, const f_instr f);
ANN Type_Decl* str2decl(const Env, const m_str, m_uint* depth);
opem em;
uintptr_t data;
loc_t pos;
- Operator op;
+ Symbol op;
};
struct Implicit {
}
ANN static m_bool emit_exp_cast(const Emitter emit, const Exp_Cast* cast) {
- struct Op_Import opi = { .op=op_cast, .lhs=cast->exp->type, .rhs=exp_self(cast)->type, .data=(uintptr_t)cast};
+ struct Op_Import opi = { .op=insert_symbol("$"), .lhs=cast->exp->type, .rhs=exp_self(cast)->type, .data=(uintptr_t)cast};
CHECK_BB(emit_exp(emit, cast->exp, 0))
(void)op_emit(emit, &opi);
return GW_OK;
}
ANN m_bool emit_exp_spork(const Emitter emit, const Exp_Unary* unary) {
- const m_bool is_spork = unary->op == op_spork;
+ const m_bool is_spork = unary->op == insert_symbol("spork");
const Func f = !unary->code ? unary->exp->d.exp_call.m_func : NULL;
if(!f) {
emit_add_instr(emit, RegPushImm);
CHECK_BB(spork_func(emit, &unary->exp->d.exp_call))
}
const VM_Code code = finalyze(emit);
- const Instr ini = emit_add_instr(emit, unary->op == op_spork ? SporkIni : ForkIni);
+ const Instr ini = emit_add_instr(emit, unary->op == insert_symbol("spork") ? SporkIni : ForkIni);
ini->m_val = (m_uint)code;
ini->m_val2 = is_spork;
if(!f) {
ANN static m_bool emit_exp_unary(const Emitter emit, const Exp_Unary* unary) {
struct Op_Import opi = { .op=unary->op, .data=(uintptr_t)unary };
- if(unary->op != op_spork && unary->op != op_fork && unary->exp) {
+ if(unary->op != insert_symbol("spork") && unary->op != insert_symbol("fork") && unary->exp) {
CHECK_BB(emit_exp(emit, unary->exp, 1))
opi.rhs = unary->exp->type;
}
ANN static m_bool emit_implicit_cast(const Emitter emit,
const restrict Exp from, const restrict Type to) {
const struct Implicit imp = { from, to };
- struct Op_Import opi = { .op=op_impl, .lhs=from->type, .rhs=to, .data=(m_uint)&imp };
+ struct Op_Import opi = { .op=insert_symbol("@implicit"), .lhs=from->type, .rhs=to, .data=(m_uint)&imp };
return op_emit(emit, &opi);
}
CHECK_BB(gwi_class_end(gwi))
CHECK_BB(gwi_oper_ini(gwi, "@Array", (m_str)OP_ANY_TYPE, NULL))
CHECK_BB(gwi_oper_add(gwi, opck_array_at))
- CHECK_BB(gwi_oper_end(gwi, op_ref, ObjectAssign))
+ CHECK_BB(gwi_oper_end(gwi, "@=>", ObjectAssign))
CHECK_BB(gwi_oper_add(gwi, opck_array_shift))
CHECK_BB(gwi_oper_emi(gwi, opem_array_shift))
- CHECK_BB(gwi_oper_end(gwi, op_shl, NULL))
+ CHECK_BB(gwi_oper_end(gwi, "<<", NULL))
CHECK_BB(gwi_oper_ini(gwi, "@Array", "Array", NULL))
CHECK_BB(gwi_oper_add(gwi, opck_array_cast))
CHECK_BB(gwi_oper_emi(gwi, opem_basic_cast))
- CHECK_BB(gwi_oper_end(gwi, op_cast, NULL))
+ CHECK_BB(gwi_oper_end(gwi, "$", NULL))
register_freearg(gwi, ArrayAlloc, freearg_array);
return GW_OK;
}
CHECK_BB(gwi_item_end(gwi, ae_flag_member, NULL))
CHECK_BB(gwi_class_end(gwi))
CHECK_BB(gwi_oper_ini(gwi, "complex", "complex", "complex"))
- CHECK_BB(gwi_oper_end(gwi, op_add, ComplexAdd))
- CHECK_BB(gwi_oper_end(gwi, op_sub, ComplexSub))
- CHECK_BB(gwi_oper_end(gwi, op_mul, ComplexMul))
- CHECK_BB(gwi_oper_end(gwi, op_div, ComplexDiv))
+ CHECK_BB(gwi_oper_end(gwi, "+", ComplexAdd))
+ CHECK_BB(gwi_oper_end(gwi, "-", ComplexSub))
+ CHECK_BB(gwi_oper_end(gwi, "*", ComplexMul))
+ CHECK_BB(gwi_oper_end(gwi, "/", ComplexDiv))
CHECK_BB(gwi_oper_add(gwi, opck_rassign))
- CHECK_BB(gwi_oper_end(gwi, op_chuck, ComplexRAssign))
+ CHECK_BB(gwi_oper_end(gwi, "=>", ComplexRAssign))
CHECK_BB(gwi_oper_add(gwi, opck_rassign))
- CHECK_BB(gwi_oper_end(gwi, op_radd, ComplexRAdd))
+ CHECK_BB(gwi_oper_end(gwi, "+=>", ComplexRAdd))
CHECK_BB(gwi_oper_add(gwi, opck_rassign))
- CHECK_BB(gwi_oper_end(gwi, op_rsub, ComplexRSub))
+ CHECK_BB(gwi_oper_end(gwi, "-=>", ComplexRSub))
CHECK_BB(gwi_oper_add(gwi, opck_rassign))
- CHECK_BB(gwi_oper_end(gwi, op_rmul, ComplexRMul))
+ CHECK_BB(gwi_oper_end(gwi, "*=>", ComplexRMul))
CHECK_BB(gwi_oper_add(gwi, opck_rassign))
- CHECK_BB(gwi_oper_end(gwi, op_rdiv, ComplexRDiv))
+ CHECK_BB(gwi_oper_end(gwi, "/=>", ComplexRDiv))
CHECK_BB(gwi_oper_ini(gwi, "polar", "polar", "polar"))
CHECK_BB(gwi_oper_add(gwi, opck_rassign))
- CHECK_BB(gwi_oper_end(gwi, op_chuck, ComplexRAssign))
- CHECK_BB(gwi_oper_end(gwi, op_add, PolarAdd))
- CHECK_BB(gwi_oper_end(gwi, op_sub, PolarSub))
- CHECK_BB(gwi_oper_end(gwi, op_mul, PolarMul))
- CHECK_BB(gwi_oper_end(gwi, op_div, PolarDiv))
+ CHECK_BB(gwi_oper_end(gwi, "=>", ComplexRAssign))
+ CHECK_BB(gwi_oper_end(gwi, "+", PolarAdd))
+ CHECK_BB(gwi_oper_end(gwi, "-", PolarSub))
+ CHECK_BB(gwi_oper_end(gwi, "*", PolarMul))
+ CHECK_BB(gwi_oper_end(gwi, "/", PolarDiv))
CHECK_BB(gwi_oper_add(gwi, opck_rassign))
- CHECK_BB(gwi_oper_end(gwi, op_radd, PolarRAdd))
+ CHECK_BB(gwi_oper_end(gwi, "+=>", PolarRAdd))
CHECK_BB(gwi_oper_add(gwi, opck_rassign))
- CHECK_BB(gwi_oper_end(gwi, op_rsub, PolarRSub))
+ CHECK_BB(gwi_oper_end(gwi, "-=>", PolarRSub))
CHECK_BB(gwi_oper_add(gwi, opck_rassign))
- CHECK_BB(gwi_oper_end(gwi, op_rmul, PolarRMul))
+ CHECK_BB(gwi_oper_end(gwi, "*=>", PolarRMul))
CHECK_BB(gwi_oper_add(gwi, opck_rassign))
- CHECK_BB(gwi_oper_end(gwi, op_rdiv, PolarRDiv))
+ CHECK_BB(gwi_oper_end(gwi, "/=>", PolarRDiv))
return GW_OK;
}
CHECK_BB(gwi_oper_ini(gwi, NULL, (m_str)OP_ANY_TYPE, NULL))
CHECK_BB(gwi_oper_add(gwi, opck_new))
CHECK_BB(gwi_oper_emi(gwi, opem_new))
- CHECK_BB(gwi_oper_end(gwi, op_new, NULL))
+ CHECK_BB(gwi_oper_end(gwi, "new", NULL))
CHECK_BB(import_prim(gwi))
CHECK_BB(import_complex(gwi))
CHECK_BB(import_vec3(gwi))
CHECK_BB(gwi_func_end(gwi, 0))
CHECK_BB(gwi_class_end(gwi))
CHECK_BB(gwi_oper_ini(gwi, "Event", "@now", "int"))
- _CHECK_OP(chuck, eventwait, EventWait)
+ _CHECK_OP("=>", eventwait, EventWait)
return GW_OK;
}
static OP_CHECK(opck_spork) {
const Exp_Unary* unary = (Exp_Unary*)data;
- if(unary->op == op_fork && !unary->fork_ok)
+ if(unary->op == insert_symbol("fork") && !unary->fork_ok)
ERR_O(exp_self(unary)->pos, _("forks must be stored in a value:\n"
"fork xxx @=> Fork f"))
if(unary->exp && unary->exp->exp_type == ae_exp_call)
- return unary->op == op_spork ? t_shred : t_fork;
+ return unary->op == insert_symbol("spork") ? t_shred : t_fork;
else if(unary->code) {
++env->scope->depth;
nspc_push_value(env->gwion->mp, env->curr);
nspc_pop_value(env->gwion->mp, env->curr);
--env->scope->depth;
CHECK_BO(ret)
- return unary->op == op_spork ? t_shred : t_fork;
+ return unary->op == insert_symbol("spork") ? t_shred : t_fork;
} else
ERR_O(exp_self(unary)->pos, _("only function calls can be sporked..."))
return NULL;
GWION_IMPORT(func) {
CHECK_BB(gwi_oper_ini(gwi, (m_str)OP_ANY_TYPE, "@function", NULL))
CHECK_BB(gwi_oper_add(gwi, opck_func_call))
- CHECK_BB(gwi_oper_end(gwi, op_chuck, NULL))
+ CHECK_BB(gwi_oper_end(gwi, "=>", NULL))
CHECK_BB(gwi_oper_ini(gwi, "@function", "@func_ptr", NULL))
CHECK_BB(gwi_oper_add(gwi, opck_fptr_at))
CHECK_BB(gwi_oper_emi(gwi, opem_func_assign))
- CHECK_BB(gwi_oper_end(gwi, op_ref, NULL /*FuncAssign*/))
+ CHECK_BB(gwi_oper_end(gwi, "@=>", NULL /*FuncAssign*/))
CHECK_BB(gwi_oper_add(gwi, opck_fptr_cast))
CHECK_BB(gwi_oper_emi(gwi, opem_fptr_cast))
- CHECK_BB(gwi_oper_end(gwi, op_cast, NULL))
+ CHECK_BB(gwi_oper_end(gwi, "$", NULL))
CHECK_BB(gwi_oper_add(gwi, opck_fptr_impl))
CHECK_BB(gwi_oper_emi(gwi, opem_fptr_impl))
- CHECK_BB(gwi_oper_end(gwi, op_impl, NULL))
+ CHECK_BB(gwi_oper_end(gwi, "@implicit", NULL))
CHECK_BB(gwi_oper_ini(gwi, NULL, (m_str)OP_ANY_TYPE, NULL))
CHECK_BB(gwi_oper_add(gwi, opck_spork))
CHECK_BB(gwi_oper_emi(gwi, opem_spork))
- CHECK_BB(gwi_oper_end(gwi, op_spork, NULL))
+ CHECK_BB(gwi_oper_end(gwi, "spork", NULL))
CHECK_BB(gwi_oper_add(gwi, opck_spork))
CHECK_BB(gwi_oper_emi(gwi, opem_spork))
- CHECK_BB(gwi_oper_end(gwi, op_fork, NULL))
+ CHECK_BB(gwi_oper_end(gwi, "fork", NULL))
register_freearg(gwi, SporkIni, freearg_xork);
register_freearg(gwi, ForkIni, freearg_xork);
register_freearg(gwi, DotTmpl, freearg_dottmpl);
ANN2(1) m_int gwi_oper_ini(const Gwi gwi, const restrict m_str l,
const restrict m_str r, const restrict m_str t) {
- gwi->oper.mut = 0;
gwi->oper.ret = t;
gwi->oper.rhs = r;
gwi->oper.lhs = l;
return GW_OK;
}
-ANN m_int gwi_oper_end(const Gwi gwi, const Operator op, const f_instr f) {
- gwi->oper.op = op;
+ANN m_int gwi_oper_end(const Gwi gwi, const m_str op, const f_instr f) {
+ gwi->oper.op = insert_symbol(gwi->gwion->st, op);
const m_bool ret = import_op(gwi, &gwi->oper, f);
gwi->oper.ck = NULL;
gwi->oper.em = NULL;
CHECK_BB(gwi_class_end(gwi))
CHECK_BB(gwi_oper_ini(gwi, "@null", "Object", "Object"))
CHECK_BB(gwi_oper_add(gwi, at_object))
- CHECK_BB(gwi_oper_end(gwi, op_ref, ObjectAssign))
+ CHECK_BB(gwi_oper_end(gwi, "@=>", ObjectAssign))
CHECK_BB(gwi_oper_ini(gwi, "Object", "Object", NULL))
CHECK_BB(gwi_oper_add(gwi, at_object))
- CHECK_BB(gwi_oper_end(gwi, op_ref, ObjectAssign))
+ CHECK_BB(gwi_oper_end(gwi, "@=>", ObjectAssign))
CHECK_BB(gwi_oper_ini(gwi, "Object", "Object", "int"))
- CHECK_BB(gwi_oper_end(gwi, op_eq, EqObject))
- CHECK_BB(gwi_oper_end(gwi, op_ne, NeqObject))
+ CHECK_BB(gwi_oper_end(gwi, "==", EqObject))
+ CHECK_BB(gwi_oper_end(gwi, "!=", NeqObject))
CHECK_BB(gwi_oper_add(gwi, opck_object_cast))
CHECK_BB(gwi_oper_emi(gwi, opem_basic_cast))
- CHECK_BB(gwi_oper_end(gwi, op_cast, NULL))
+ CHECK_BB(gwi_oper_end(gwi, "$", NULL))
CHECK_BB(gwi_oper_ini(gwi, "@null", "Object", "int"))
- CHECK_BB(gwi_oper_end(gwi, op_eq, EqObject))
- CHECK_BB(gwi_oper_end(gwi, op_ne, NeqObject))
+ CHECK_BB(gwi_oper_end(gwi, "==", EqObject))
+ CHECK_BB(gwi_oper_end(gwi, "!=", NeqObject))
CHECK_BB(gwi_oper_add(gwi, opck_basic_cast))
CHECK_BB(gwi_oper_emi(gwi, opem_basic_cast))
- CHECK_BB(gwi_oper_end(gwi, op_cast, NULL))
+ CHECK_BB(gwi_oper_end(gwi, "$", NULL))
CHECK_BB(gwi_oper_add(gwi, opck_implicit_null2obj))
- CHECK_BB(gwi_oper_end(gwi, op_impl, NULL))
+ CHECK_BB(gwi_oper_end(gwi, "@implicit", NULL))
CHECK_BB(gwi_oper_ini(gwi, "Object", "@null", "int"))
- CHECK_BB(gwi_oper_end(gwi, op_eq, EqObject))
- CHECK_BB(gwi_oper_end(gwi, op_ne, NeqObject))
+ CHECK_BB(gwi_oper_end(gwi, "==", EqObject))
+ CHECK_BB(gwi_oper_end(gwi, "!=", NeqObject))
CHECK_BB(gwi_oper_ini(gwi, NULL, "Object", "int"))
CHECK_BB(gwi_oper_add(gwi, opck_unary_meta2))
- CHECK_BB(gwi_oper_end(gwi, op_not, IntNot))
+ CHECK_BB(gwi_oper_end(gwi, "!", IntNot))
gwi_item_ini(gwi, "@null", "null");
gwi_item_end(gwi, 0, NULL);
gwi_reserve(gwi, "this");
if(bin->rhs->meta != ae_meta_var)
ERR_N(bin->rhs->pos, _("cannot assign '%s' on types '%s' and '%s'.\n"
" ... (reason: --- right-side operand is %s.)"),
- op2str(bin->op), bin->lhs->type->name, bin->rhs->type->name,
+ s_name(bin->op), bin->lhs->type->name, bin->rhs->type->name,
access(bin->rhs->meta))
return bin->rhs->type;
}
CHECK_OO(opck_unary_meta2(env, data, mut))
if(unary->exp->next)
ERR_N(exp_self(unary)->pos,
- _("'%s' must be applied to a unique expression"), op2str(unary->op))
+ _("'%s' must be applied to a unique expression"), s_name(unary->op))
return t_int;
}
if(unary->exp->meta != ae_meta_var)
ERR_N(unary->exp->pos,
_("unary operator '%s' cannot be used on %s data-types."),
- op2str(unary->op), access(unary->exp->meta))
+ s_name(unary->op), access(unary->exp->meta))
unary->exp->emit_var = 1;
exp_self(unary)->meta = ae_meta_value;
return unary->exp->type;
const Exp_Postfix* post = (Exp_Postfix*)data;
if(post->exp->meta != ae_meta_var)
ERR_N(post->exp->pos, _("post operator '%s' cannot be used on %s data-type."),
- op2str(post->op), access(post->exp->meta))
+ s_name(post->op), access(post->exp->meta))
post->exp->emit_var = 1;
exp_self(post)->meta = ae_meta_value;
return post->exp->type;
GWION_IMPORT(int_op) {
CHECK_BB(gwi_oper_ini(gwi, "int", "int", "int"))
- CHECK_BB(gwi_oper_end(gwi, op_add, int_plus))
- CHECK_BB(gwi_oper_end(gwi, op_sub, int_minus))
- CHECK_BB(gwi_oper_end(gwi, op_mul, int_mul))
- CHECK_BB(gwi_oper_end(gwi, op_div, int_div))
- return gwi_oper_end(gwi, op_mod, int_modulo);
+ CHECK_BB(gwi_oper_end(gwi, "+", int_plus))
+ CHECK_BB(gwi_oper_end(gwi, "-", int_minus))
+ CHECK_BB(gwi_oper_end(gwi, "*", int_mul))
+ CHECK_BB(gwi_oper_end(gwi, "/", int_div))
+ return gwi_oper_end(gwi, "%", int_modulo);
}
static GWION_IMPORT(int_logical) {
- CHECK_BB(gwi_oper_end(gwi, op_and, int_and))
- CHECK_BB(gwi_oper_end(gwi, op_or, int_or))
- CHECK_BB(gwi_oper_end(gwi, op_eq, int_eq))
- CHECK_BB(gwi_oper_end(gwi, op_ne, int_neq))
- CHECK_BB(gwi_oper_end(gwi, op_gt, int_gt))
- CHECK_BB(gwi_oper_end(gwi, op_ge, int_ge))
- CHECK_BB(gwi_oper_end(gwi, op_lt, int_lt))
- CHECK_BB(gwi_oper_end(gwi, op_le, int_le))
- CHECK_BB(gwi_oper_end(gwi, op_shr, int_sr))
- CHECK_BB(gwi_oper_end(gwi, op_shl, int_sl))
- CHECK_BB(gwi_oper_end(gwi, op_sand, int_sand))
- CHECK_BB(gwi_oper_end(gwi, op_sor, int_sor))
- return gwi_oper_end(gwi, op_sxor, int_xor);
+ CHECK_BB(gwi_oper_end(gwi, "&&", int_and))
+ CHECK_BB(gwi_oper_end(gwi, "||", int_or))
+ CHECK_BB(gwi_oper_end(gwi, "==", int_eq))
+ CHECK_BB(gwi_oper_end(gwi, "!=", int_neq))
+ CHECK_BB(gwi_oper_end(gwi, ">", int_gt))
+ CHECK_BB(gwi_oper_end(gwi, ">=", int_ge))
+ CHECK_BB(gwi_oper_end(gwi, "<", int_lt))
+ CHECK_BB(gwi_oper_end(gwi, "<=", int_le))
+ CHECK_BB(gwi_oper_end(gwi, ">>", int_sr))
+ CHECK_BB(gwi_oper_end(gwi, "<<", int_sl))
+ CHECK_BB(gwi_oper_end(gwi, "&", int_sand))
+ CHECK_BB(gwi_oper_end(gwi, "|", int_sor))
+ return gwi_oper_end(gwi, "^", int_xor);
}
static GWION_IMPORT(int_r) {
- CHECK_OP(chuck, rassign, r_assign)
- CHECK_OP(radd, rassign, r_plus)
- CHECK_OP(rsub, rassign, r_minus)
- CHECK_OP(rmul, rassign, r_mul)
- CHECK_OP(rdiv, rassign, r_div)
- CHECK_OP(rmod, rassign, r_modulo)
- CHECK_OP(rsl, rassign, r_sl)
- CHECK_OP(rsr, rassign, r_sr)
- CHECK_OP(rsand, rassign, r_sand)
- CHECK_OP(rsor, rassign, r_sor)
- CHECK_OP(rsxor, rassign, r_sxor)
+ CHECK_OP("=>", rassign, r_assign)
+ CHECK_OP("+=>", rassign, r_plus)
+ CHECK_OP("-=>", rassign, r_minus)
+ CHECK_OP("*=>", rassign, r_mul)
+ CHECK_OP("/=>", rassign, r_div)
+ CHECK_OP("%=>", rassign, r_modulo)
+ CHECK_OP("<<=>", rassign, r_sl)
+ CHECK_OP(">>=>", rassign, r_sr)
+ CHECK_OP("&=>", rassign, r_sand)
+ CHECK_OP("|=>", rassign, r_sor)
+ CHECK_OP("^=>", rassign, r_sxor)
return GW_OK;
}
static GWION_IMPORT(int_unary) {
CHECK_BB(gwi_oper_ini(gwi, NULL, "int", "int"))
CHECK_BB(gwi_oper_add(gwi, opck_unary_meta))
- CHECK_BB(gwi_oper_end(gwi, op_sub, int_negate))
+ CHECK_BB(gwi_oper_end(gwi, "-", int_negate))
CHECK_BB(gwi_oper_add(gwi, opck_unary_meta2_uniq))
- CHECK_BB(gwi_oper_end(gwi, op_not, IntNot))
- CHECK_OP(inc, unary, pre_inc)
- CHECK_OP(dec, unary, pre_dec)
- CHECK_BB(gwi_oper_end(gwi, op_cmp, int_cmp))
+ CHECK_BB(gwi_oper_end(gwi, "!", IntNot))
+ CHECK_OP("++", unary, pre_inc)
+ CHECK_OP("--", unary, pre_dec)
+ CHECK_BB(gwi_oper_end(gwi, "~", int_cmp))
CHECK_BB(gwi_oper_ini(gwi, "int", NULL, "int"))
- CHECK_OP(inc, post, post_inc)
+ CHECK_OP("++", post, post_inc)
CHECK_BB(gwi_oper_add(gwi, opck_post))
- CHECK_BB(gwi_oper_end(gwi, op_dec, int_post_dec))
+ CHECK_BB(gwi_oper_end(gwi, "--", int_post_dec))
return GW_OK;
}
static GWION_IMPORT(intfloat) {
CHECK_BB(gwi_oper_ini(gwi, "int", "float", "int"))
- CHECK_BB(gwi_oper_end(gwi, op_and, int_float_and))
- CHECK_BB(gwi_oper_end(gwi, op_or, int_float_or))
- CHECK_BB(gwi_oper_end(gwi, op_eq, int_float_eq))
- CHECK_BB(gwi_oper_end(gwi, op_ne, int_float_neq))
- CHECK_BB(gwi_oper_end(gwi, op_gt, int_float_gt))
- CHECK_BB(gwi_oper_end(gwi, op_ge, int_float_ge))
- CHECK_BB(gwi_oper_end(gwi, op_lt, int_float_lt))
- CHECK_BB(gwi_oper_end(gwi, op_le, int_float_le))
+ CHECK_BB(gwi_oper_end(gwi, "&&", int_float_and))
+ CHECK_BB(gwi_oper_end(gwi, "||", int_float_or))
+ CHECK_BB(gwi_oper_end(gwi, "==", int_float_eq))
+ CHECK_BB(gwi_oper_end(gwi, "!=", int_float_neq))
+ CHECK_BB(gwi_oper_end(gwi, ">", int_float_gt))
+ CHECK_BB(gwi_oper_end(gwi, ">=", int_float_ge))
+ CHECK_BB(gwi_oper_end(gwi, "<", int_float_lt))
+ CHECK_BB(gwi_oper_end(gwi, "<=", int_float_le))
CHECK_BB(gwi_oper_ini(gwi, "int", "float", "float"))
- CHECK_BB(gwi_oper_end(gwi, op_add, int_float_plus))
- CHECK_BB(gwi_oper_end(gwi, op_mul, int_float_mul))
- CHECK_BB(gwi_oper_end(gwi, op_sub, int_float_minus))
- CHECK_BB(gwi_oper_end(gwi, op_div, int_float_div))
- CHECK_IF(chuck, rassign, r_assign)
- CHECK_IF(radd, rassign, r_plus)
- CHECK_IF(rsub, rassign, r_minus)
- CHECK_IF(rmul, rassign, r_mul)
- CHECK_IF(rdiv, rassign, r_div)
+ CHECK_BB(gwi_oper_end(gwi, "+", int_float_plus))
+ CHECK_BB(gwi_oper_end(gwi, "*", int_float_mul))
+ CHECK_BB(gwi_oper_end(gwi, "-", int_float_minus))
+ CHECK_BB(gwi_oper_end(gwi, "/", int_float_div))
+ CHECK_IF("=>", rassign, r_assign)
+ CHECK_IF("+=>", rassign, r_plus)
+ CHECK_IF("-=>", rassign, r_minus)
+ CHECK_IF("*=>", rassign, r_mul)
+ CHECK_IF("/=>", rassign, r_div)
CHECK_BB(gwi_oper_emi(gwi, opem_i2f))
- _CHECK_OP(cast, basic_cast, CastI2F)
- _CHECK_OP(impl, implicit_i2f, CastI2F)
+ _CHECK_OP("$", basic_cast, CastI2F)
+ _CHECK_OP("@implicit", implicit_i2f, CastI2F)
return GW_OK;
}
static GWION_IMPORT(floatint) {
CHECK_BB(gwi_oper_ini(gwi, "float", "int", "float"))
- CHECK_BB(gwi_oper_end(gwi, op_add, float_int_plus))
- CHECK_BB(gwi_oper_end(gwi, op_sub, float_int_minus))
- CHECK_BB(gwi_oper_end(gwi, op_mul, float_int_mul))
- CHECK_BB(gwi_oper_end(gwi, op_div, float_int_div))
+ CHECK_BB(gwi_oper_end(gwi, "+", float_int_plus))
+ CHECK_BB(gwi_oper_end(gwi, "-", float_int_minus))
+ CHECK_BB(gwi_oper_end(gwi, "*", float_int_mul))
+ CHECK_BB(gwi_oper_end(gwi, "/", float_int_div))
CHECK_BB(gwi_oper_ini(gwi, "float", "int", "int"))
- CHECK_BB(gwi_oper_end(gwi, op_and, float_int_and))
- CHECK_BB(gwi_oper_end(gwi, op_or, float_int_or))
- CHECK_BB(gwi_oper_end(gwi, op_eq, float_int_eq))
- CHECK_BB(gwi_oper_end(gwi, op_ne, float_int_neq))
- CHECK_BB(gwi_oper_end(gwi, op_gt, float_int_gt))
- CHECK_BB(gwi_oper_end(gwi, op_ge, float_int_ge))
- CHECK_BB(gwi_oper_end(gwi, op_lt, float_int_lt))
- CHECK_BB(gwi_oper_end(gwi, op_le, float_int_le))
- CHECK_FI(chuck, rassign, r_assign)
- CHECK_FI(radd, rassign, r_plus)
- CHECK_FI(rsub, rassign, r_minus)
- CHECK_FI(rmul, rassign, r_mul)
- CHECK_FI(rdiv, rassign, r_div)
+ CHECK_BB(gwi_oper_end(gwi, "&&", float_int_and))
+ CHECK_BB(gwi_oper_end(gwi, "||", float_int_or))
+ CHECK_BB(gwi_oper_end(gwi, "==", float_int_eq))
+ CHECK_BB(gwi_oper_end(gwi, "!=", float_int_neq))
+ CHECK_BB(gwi_oper_end(gwi, ">", float_int_gt))
+ CHECK_BB(gwi_oper_end(gwi, ">=", float_int_ge))
+ CHECK_BB(gwi_oper_end(gwi, "<", float_int_lt))
+ CHECK_BB(gwi_oper_end(gwi, "<=", float_int_le))
+ CHECK_FI("=>", rassign, r_assign)
+ CHECK_FI("+=>", rassign, r_plus)
+ CHECK_FI("-=>", rassign, r_minus)
+ CHECK_FI("*=>", rassign, r_mul)
+ CHECK_FI("/=>", rassign, r_div)
CHECK_BB(gwi_oper_emi(gwi, opem_f2i))
- _CHECK_OP(cast, basic_cast, CastF2I)
- _CHECK_OP(impl, implicit_f2i, CastF2I)
+ _CHECK_OP("$", basic_cast, CastF2I)
+ _CHECK_OP("@implicit", implicit_f2i, CastF2I)
return GW_OK;
}
static GWION_IMPORT(dur) {
CHECK_BB(gwi_oper_ini(gwi, "dur", "dur", "dur"))
- CHECK_FF(chuck, rassign, r_assign)
- CHECK_BB(gwi_oper_end(gwi, op_add, FloatPlus))
- CHECK_BB(gwi_oper_end(gwi, op_sub, FloatMinus))
- CHECK_BB(gwi_oper_end(gwi, op_mul, FloatTimes))
+ CHECK_FF("=>", rassign, r_assign)
+ CHECK_BB(gwi_oper_end(gwi, "+", FloatPlus))
+ CHECK_BB(gwi_oper_end(gwi, "-", FloatMinus))
+ CHECK_BB(gwi_oper_end(gwi, "*", FloatTimes))
CHECK_BB(gwi_oper_ini(gwi, "dur", "dur", "float"))
- CHECK_BB(gwi_oper_end(gwi, op_div, FloatDivide))
+ CHECK_BB(gwi_oper_end(gwi, "/", FloatDivide))
CHECK_BB(gwi_oper_ini(gwi, "dur", "dur", "int"))
- CHECK_BB(gwi_oper_end(gwi, op_gt, float_gt))
- CHECK_BB(gwi_oper_end(gwi, op_ge, float_ge))
- CHECK_BB(gwi_oper_end(gwi, op_lt, float_lt))
- return gwi_oper_end(gwi, op_le, float_le);
+ CHECK_BB(gwi_oper_end(gwi, ">", float_gt))
+ CHECK_BB(gwi_oper_end(gwi, ">=", float_ge))
+ CHECK_BB(gwi_oper_end(gwi, "<", float_lt))
+ return gwi_oper_end(gwi, "<=", float_le);
}
static GWION_IMPORT(time) {
CHECK_BB(gwi_oper_ini(gwi, "time", "time", "time"))
- CHECK_FF(chuck, rassign, r_assign)
+ CHECK_FF("=>", rassign, r_assign)
CHECK_BB(gwi_oper_ini(gwi, "time", "dur", "time"))
- CHECK_BB(gwi_oper_end(gwi, op_add, FloatPlus))
+ CHECK_BB(gwi_oper_end(gwi, "+", FloatPlus))
CHECK_BB(gwi_oper_ini(gwi, "dur", "time", "time"))
- CHECK_FF(chuck, rassign, r_assign)
- CHECK_BB(gwi_oper_end(gwi, op_add, FloatPlus))
+ CHECK_FF("=>", rassign, r_assign)
+ CHECK_BB(gwi_oper_end(gwi, "+", FloatPlus))
CHECK_BB(gwi_oper_ini(gwi, "dur", "@now", "time"))
- _CHECK_OP(chuck, rhs_emit_var, Time_Advance)
+ _CHECK_OP("=>", rhs_emit_var, Time_Advance)
CHECK_BB(gwi_oper_ini(gwi, "@now", "@now", NULL))
- _CHECK_OP(chuck, chuck_now, NULL)
+ _CHECK_OP("=>", chuck_now, NULL)
CHECK_BB(gwi_oper_ini(gwi, NULL, "@now", NULL))
- CHECK_BB(gwi_oper_end(gwi, op_not, NULL))
+ CHECK_BB(gwi_oper_end(gwi, "!", NULL))
CHECK_BB(gwi_oper_ini(gwi, "time", "time", "int"))
- CHECK_BB(gwi_oper_end(gwi, op_gt, float_gt))
- CHECK_BB(gwi_oper_end(gwi, op_ge, float_ge))
- CHECK_BB(gwi_oper_end(gwi, op_lt, float_lt))
- return gwi_oper_end(gwi, op_le, float_le);
+ CHECK_BB(gwi_oper_end(gwi, ">", float_gt))
+ CHECK_BB(gwi_oper_end(gwi, ">=", float_ge))
+ CHECK_BB(gwi_oper_end(gwi, "<", float_lt))
+ return gwi_oper_end(gwi, "<=", float_le);
}
static GWION_IMPORT(float) {
CHECK_BB(gwi_oper_ini(gwi, "float", "float", "float"))
- CHECK_BB(gwi_oper_end(gwi, op_add, FloatPlus))
- CHECK_BB(gwi_oper_end(gwi, op_sub, FloatMinus))
- CHECK_BB(gwi_oper_end(gwi, op_mul, FloatTimes))
- CHECK_BB(gwi_oper_end(gwi, op_div, FloatDivide))
- CHECK_FF(chuck, rassign, r_assign)
- CHECK_FF(radd, rassign, r_plus)
- CHECK_FF(rsub, rassign, r_minus)
- CHECK_FF(rmul, rassign, r_mul)
- CHECK_FF(rdiv, rassign, r_div)
+ CHECK_BB(gwi_oper_end(gwi, "+", FloatPlus))
+ CHECK_BB(gwi_oper_end(gwi, "-", FloatMinus))
+ CHECK_BB(gwi_oper_end(gwi, "*", FloatTimes))
+ CHECK_BB(gwi_oper_end(gwi, "/", FloatDivide))
+ CHECK_FF("=>", rassign, r_assign)
+ CHECK_FF("+=>", rassign, r_plus)
+ CHECK_FF("-=>", rassign, r_minus)
+ CHECK_FF("*=>", rassign, r_mul)
+ CHECK_FF("/=>", rassign, r_div)
CHECK_BB(gwi_oper_ini(gwi, "float", "float", "int"))
- CHECK_BB(gwi_oper_end(gwi, op_and, float_and))
- CHECK_BB(gwi_oper_end(gwi, op_or, float_or))
- CHECK_BB(gwi_oper_end(gwi, op_eq, float_eq))
- CHECK_BB(gwi_oper_end(gwi, op_ne, float_neq))
- CHECK_BB(gwi_oper_end(gwi, op_gt, float_gt))
- CHECK_BB(gwi_oper_end(gwi, op_ge, float_ge))
- CHECK_BB(gwi_oper_end(gwi, op_lt, float_lt))
- CHECK_BB(gwi_oper_end(gwi, op_le, float_le))
+ CHECK_BB(gwi_oper_end(gwi, "&&", float_and))
+ CHECK_BB(gwi_oper_end(gwi, "||", float_or))
+ CHECK_BB(gwi_oper_end(gwi, "==", float_eq))
+ CHECK_BB(gwi_oper_end(gwi, "!=", float_neq))
+ CHECK_BB(gwi_oper_end(gwi, ">", float_gt))
+ CHECK_BB(gwi_oper_end(gwi, ">=", float_ge))
+ CHECK_BB(gwi_oper_end(gwi, "<", float_lt))
+ CHECK_BB(gwi_oper_end(gwi, "<=", float_le))
CHECK_BB(gwi_oper_ini(gwi, NULL, "float", "float"))
- CHECK_FF(sub, unary_meta, negate)
+ CHECK_FF("-", unary_meta, negate)
CHECK_BB(gwi_oper_ini(gwi, NULL, "float", "int"))
- CHECK_FF(not, unary_meta2_uniq, not)
+ CHECK_FF("!", unary_meta2_uniq, not)
CHECK_BB(gwi_oper_ini(gwi, NULL, "time", "int"))
- CHECK_FF(not, unary_meta2_uniq, not)
+ CHECK_FF("!", unary_meta2_uniq, not)
CHECK_BB(gwi_oper_ini(gwi, NULL, "dur", "int"))
- CHECK_FF(not, unary_meta2_uniq, not)
+ CHECK_FF("!", unary_meta2_uniq, not)
CHECK_BB(gwi_oper_ini(gwi, "int", "dur", "dur"))
- CHECK_BB(gwi_oper_end(gwi, op_coloncolon, int_float_mul))
+ CHECK_BB(gwi_oper_end(gwi, "::", int_float_mul))
CHECK_BB(gwi_oper_ini(gwi, "float", "dur", "dur"))
- CHECK_BB(gwi_oper_end(gwi, op_coloncolon, FloatTimes))
+ CHECK_BB(gwi_oper_end(gwi, "::", FloatTimes))
return GW_OK;
}
CHECK_BB(gwi_class_end(gwi))
CHECK_BB(gwi_oper_ini(gwi, (m_str)OP_ANY_TYPE, "Ptr", NULL))
CHECK_BB(gwi_oper_add(gwi, opck_ptr_assign))
- CHECK_BB(gwi_oper_end(gwi, op_trig, instr_ptr_assign))
+ CHECK_BB(gwi_oper_end(gwi, "]=>", instr_ptr_assign))
CHECK_BB(gwi_oper_add(gwi, opck_implicit_ptr))
- CHECK_BB(gwi_oper_end(gwi, op_impl, Cast2Ptr))
+ CHECK_BB(gwi_oper_end(gwi, "@implicit", Cast2Ptr))
CHECK_BB(gwi_oper_ini(gwi, NULL, "Ptr", NULL))
CHECK_BB(gwi_oper_add(gwi, opck_ptr_deref))
CHECK_BB(gwi_oper_emi(gwi, opem_ptr_deref))
- CHECK_BB(gwi_oper_end(gwi, op_mul, instr_ptr_deref))
+ CHECK_BB(gwi_oper_end(gwi, "*", instr_ptr_deref))
return GW_OK;
}
CHECK_BB(gwi_oper_ini(gwi, "string", "string", "string"))
CHECK_BB(gwi_oper_add(gwi, opck_const_rhs))
- CHECK_BB(gwi_oper_end(gwi, op_chuck, String_Assign))
- CHECK_BB(gwi_oper_end(gwi, op_add, String_String))
+ CHECK_BB(gwi_oper_end(gwi, "=>", String_Assign))
+ CHECK_BB(gwi_oper_end(gwi, "+", String_String))
CHECK_BB(gwi_oper_add(gwi, opck_const_rhs))
- CHECK_BB(gwi_oper_end(gwi, op_radd, String_Plus))
+ CHECK_BB(gwi_oper_end(gwi, "+=>", String_Plus))
CHECK_BB(gwi_oper_ini(gwi, "string", "string", "int"))
- CHECK_BB(gwi_oper_end(gwi, op_eq, String_eq))
- CHECK_BB(gwi_oper_end(gwi, op_ne, String_neq))
+ CHECK_BB(gwi_oper_end(gwi, "==", String_eq))
+ CHECK_BB(gwi_oper_end(gwi, "!=", String_neq))
CHECK_BB(gwi_oper_ini(gwi, "int", "string", "string"))
CHECK_BB(gwi_oper_add(gwi, opck_const_rhs))
- CHECK_BB(gwi_oper_end(gwi, op_chuck, Int_String_Assign))
- CHECK_BB(gwi_oper_end(gwi, op_add, Int_String))
+ CHECK_BB(gwi_oper_end(gwi, "=>", Int_String_Assign))
+ CHECK_BB(gwi_oper_end(gwi, "+", Int_String))
CHECK_BB(gwi_oper_add(gwi, opck_const_rhs))
- CHECK_BB(gwi_oper_end(gwi, op_radd, Int_String_Plus))
+ CHECK_BB(gwi_oper_end(gwi, "+=>", Int_String_Plus))
CHECK_BB(gwi_oper_ini(gwi, "float", "string", "string"))
CHECK_BB(gwi_oper_add(gwi, opck_const_rhs))
- CHECK_BB(gwi_oper_end(gwi, op_chuck, Float_String_Assign))
- CHECK_BB(gwi_oper_end(gwi, op_add, Float_String))
+ CHECK_BB(gwi_oper_end(gwi, "=>", Float_String_Assign))
+ CHECK_BB(gwi_oper_end(gwi, "+", Float_String))
CHECK_BB(gwi_oper_add(gwi, opck_const_rhs))
- CHECK_BB(gwi_oper_end(gwi, op_radd, Float_String_Plus))
+ CHECK_BB(gwi_oper_end(gwi, "+=>", Float_String_Plus))
CHECK_BB(gwi_oper_ini(gwi, "complex", "string", "string"))
CHECK_BB(gwi_oper_add(gwi, opck_const_rhs))
- CHECK_BB(gwi_oper_end(gwi, op_chuck, Complex_String_Assign))
- CHECK_BB(gwi_oper_end(gwi, op_add, Complex_String))
+ CHECK_BB(gwi_oper_end(gwi, "=>", Complex_String_Assign))
+ CHECK_BB(gwi_oper_end(gwi, "+", Complex_String))
CHECK_BB(gwi_oper_add(gwi, opck_const_rhs))
- CHECK_BB(gwi_oper_end(gwi, op_radd, Complex_String_Plus))
+ CHECK_BB(gwi_oper_end(gwi, "+=>", Complex_String_Plus))
CHECK_BB(gwi_oper_ini(gwi, "polar", "string", "string"))
CHECK_BB(gwi_oper_add(gwi, opck_const_rhs))
- CHECK_BB(gwi_oper_end(gwi, op_chuck, Polar_String_Assign))
- CHECK_BB(gwi_oper_end(gwi, op_add, Polar_String))
+ CHECK_BB(gwi_oper_end(gwi, "=>", Polar_String_Assign))
+ CHECK_BB(gwi_oper_end(gwi, "+", Polar_String))
CHECK_BB(gwi_oper_add(gwi, opck_const_rhs))
- CHECK_BB(gwi_oper_end(gwi, op_radd, Polar_String_Plus))
+ CHECK_BB(gwi_oper_end(gwi, "+=>", Polar_String_Plus))
CHECK_BB(gwi_oper_ini(gwi,"Vec3", "string", "string"))
CHECK_BB(gwi_oper_add(gwi, opck_const_rhs))
- CHECK_BB(gwi_oper_end(gwi, op_chuck, Vec3_String_Assign))
- CHECK_BB(gwi_oper_end(gwi, op_add, Vec3_String))
+ CHECK_BB(gwi_oper_end(gwi, "=>", Vec3_String_Assign))
+ CHECK_BB(gwi_oper_end(gwi, "+", Vec3_String))
CHECK_BB(gwi_oper_add(gwi, opck_const_rhs))
- CHECK_BB(gwi_oper_end(gwi, op_radd, Vec3_String_Plus))
+ CHECK_BB(gwi_oper_end(gwi, "+=>", Vec3_String_Plus))
CHECK_BB(gwi_oper_ini(gwi, "Vec4", "string", "string"))
CHECK_BB(gwi_oper_add(gwi, opck_const_rhs))
- CHECK_BB(gwi_oper_end(gwi, op_chuck, Vec4_String_Assign))
- CHECK_BB(gwi_oper_end(gwi, op_add, Vec4_String))
+ CHECK_BB(gwi_oper_end(gwi, "=>", Vec4_String_Assign))
+ CHECK_BB(gwi_oper_end(gwi, "+", Vec4_String))
CHECK_BB(gwi_oper_add(gwi, opck_const_rhs))
- CHECK_BB(gwi_oper_end(gwi, op_radd, Vec4_String_Plus))
+ CHECK_BB(gwi_oper_end(gwi, "+=>", Vec4_String_Plus))
CHECK_BB(gwi_oper_ini(gwi, "Object", "string", "string"))
CHECK_BB(gwi_oper_add(gwi, opck_const_rhs))
- CHECK_BB(gwi_oper_end(gwi, op_chuck, Object_String_Assign))
- CHECK_BB(gwi_oper_end(gwi, op_add, Object_String))
+ CHECK_BB(gwi_oper_end(gwi, "=>", Object_String_Assign))
+ CHECK_BB(gwi_oper_end(gwi, "+", Object_String))
CHECK_BB(gwi_oper_add(gwi, opck_const_rhs))
- CHECK_BB(gwi_oper_end(gwi, op_radd, Object_String_Plus))
+ CHECK_BB(gwi_oper_end(gwi, "+=>", Object_String_Plus))
CHECK_BB(gwi_oper_ini(gwi, "@null", "string", "string"))
CHECK_BB(gwi_oper_add(gwi, opck_const_rhs))
- CHECK_BB(gwi_oper_end(gwi, op_chuck, Object_String_Assign))
- CHECK_BB(gwi_oper_end(gwi, op_add, Object_String))
+ CHECK_BB(gwi_oper_end(gwi, "=>", Object_String_Assign))
+ CHECK_BB(gwi_oper_end(gwi, "+", Object_String))
CHECK_BB(gwi_oper_add(gwi, opck_const_rhs))
- CHECK_BB(gwi_oper_end(gwi, op_radd, Object_String_Plus))
+ CHECK_BB(gwi_oper_end(gwi, "+=>", Object_String_Plus))
gwi_item_ini(gwi, "string", "__func__");
gwi_item_end(gwi, ae_flag_const, NULL);
CHECK_BB(gwi_class_end(gwi))
CHECK_BB(gwi_oper_ini(gwi, "UGen", "UGen", "UGen"))
- _CHECK_OP(chuck, chuck_ugen, UgenConnect)
- _CHECK_OP(unchuck, chuck_ugen, UgenDisconnect)
- _CHECK_OP(trig, chuck_ugen, TrigConnect)
- _CHECK_OP(untrig, chuck_ugen, TrigDisconnect)
+ _CHECK_OP("=>", chuck_ugen, UgenConnect)
+ _CHECK_OP("=<", chuck_ugen, UgenDisconnect)
+ _CHECK_OP("]=>", chuck_ugen, TrigConnect)
+ _CHECK_OP("}=<", chuck_ugen, TrigDisconnect)
return import_global_ugens(gwi);
}
CHECK_BB(gwi_class_end(gwi))
CHECK_BB(gwi_oper_ini(gwi, "VarObject", "Object", NULL))
CHECK_BB(gwi_oper_add(gwi, at_varobj))
- CHECK_BB(gwi_oper_end(gwi, op_ref, VarargAssign))
+ CHECK_BB(gwi_oper_end(gwi, "@=>", VarargAssign))
CHECK_BB(gwi_oper_ini(gwi, "Object", "VarObject", NULL))
CHECK_BB(gwi_oper_add(gwi, at_varobj))
- CHECK_BB(gwi_oper_end(gwi, op_ref, VarargAssign))
+ CHECK_BB(gwi_oper_end(gwi, "@=>", VarargAssign))
register_freearg(gwi, VarargIni, freearg_vararg);
gwi_reserve(gwi, "vararg");
return GW_OK;
CHECK_BB(gwi_class_end(gwi))
CHECK_BB(gwi_oper_ini(gwi, "Vec3", "Vec3", "Vec3"))
- CHECK_BB(gwi_oper_end(gwi, op_add, Vec3Add))
- CHECK_BB(gwi_oper_end(gwi, op_sub, Vec3Sub))
- CHECK_BB(gwi_oper_end(gwi, op_mul, Vec3Mul))
- CHECK_BB(gwi_oper_end(gwi, op_div, Vec3Div))
+ CHECK_BB(gwi_oper_end(gwi, "+", Vec3Add))
+ CHECK_BB(gwi_oper_end(gwi, "-", Vec3Sub))
+ CHECK_BB(gwi_oper_end(gwi, "*", Vec3Mul))
+ CHECK_BB(gwi_oper_end(gwi, "/", Vec3Div))
CHECK_BB(gwi_oper_add(gwi, opck_rassign))
- CHECK_BB(gwi_oper_end(gwi, op_chuck, Vec3RAssign))
+ CHECK_BB(gwi_oper_end(gwi, "=>", Vec3RAssign))
CHECK_BB(gwi_oper_ini(gwi, "Vec3", "float", "Vec3"))
- CHECK_BB(gwi_oper_end(gwi, op_add, Vec3AddFloat))
- CHECK_BB(gwi_oper_end(gwi, op_sub, Vec3SubFloat))
- CHECK_BB(gwi_oper_end(gwi, op_mul, Vec3MulFloat))
- CHECK_BB(gwi_oper_end(gwi, op_div, Vec3DivFloat))
+ CHECK_BB(gwi_oper_end(gwi, "+", Vec3AddFloat))
+ CHECK_BB(gwi_oper_end(gwi, "-", Vec3SubFloat))
+ CHECK_BB(gwi_oper_end(gwi, "*", Vec3MulFloat))
+ CHECK_BB(gwi_oper_end(gwi, "/", Vec3DivFloat))
CHECK_BB(gwi_oper_ini(gwi, "float", "Vec3", "Vec3"))
- CHECK_BB(gwi_oper_end(gwi, op_add, FloatAddVec3))
- CHECK_BB(gwi_oper_end(gwi, op_sub, FloatSubVec3))
- CHECK_BB(gwi_oper_end(gwi, op_mul, FloatMulVec3))
- CHECK_BB(gwi_oper_end(gwi, op_div, FloatDivVec3))
+ CHECK_BB(gwi_oper_end(gwi, "+", FloatAddVec3))
+ CHECK_BB(gwi_oper_end(gwi, "-", FloatSubVec3))
+ CHECK_BB(gwi_oper_end(gwi, "*", FloatMulVec3))
+ CHECK_BB(gwi_oper_end(gwi, "/", FloatDivVec3))
return GW_OK;
}
CHECK_BB(gwi_func_end(gwi, 0))
CHECK_BB(gwi_class_end(gwi))
CHECK_BB(gwi_oper_ini(gwi, "Vec4", "Vec4", "Vec4"))
- CHECK_BB(gwi_oper_end(gwi, op_add, Vec4Add))
- CHECK_BB(gwi_oper_end(gwi, op_sub, Vec4Sub))
- CHECK_BB(gwi_oper_end(gwi, op_mul, Vec4Mul))
- CHECK_BB(gwi_oper_end(gwi, op_div, Vec4Div))
+ CHECK_BB(gwi_oper_end(gwi, "+", Vec4Add))
+ CHECK_BB(gwi_oper_end(gwi, "-", Vec4Sub))
+ CHECK_BB(gwi_oper_end(gwi, "*", Vec4Mul))
+ CHECK_BB(gwi_oper_end(gwi, "/", Vec4Div))
CHECK_BB(gwi_oper_add(gwi, opck_rassign))
- CHECK_BB(gwi_oper_end(gwi, op_chuck, Vec4RAssign))
+ CHECK_BB(gwi_oper_end(gwi, "=>", Vec4RAssign))
CHECK_BB(gwi_oper_ini(gwi, "Vec4", "float", "Vec4"))
- CHECK_BB(gwi_oper_end(gwi, op_add, Vec4AddFloat))
- CHECK_BB(gwi_oper_end(gwi, op_sub, Vec4SubFloat))
- CHECK_BB(gwi_oper_end(gwi, op_mul, Vec4MulFloat))
- CHECK_BB(gwi_oper_end(gwi, op_div, Vec4DivFloat))
+ CHECK_BB(gwi_oper_end(gwi, "+", Vec4AddFloat))
+ CHECK_BB(gwi_oper_end(gwi, "-", Vec4SubFloat))
+ CHECK_BB(gwi_oper_end(gwi, "*", Vec4MulFloat))
+ CHECK_BB(gwi_oper_end(gwi, "/", Vec4DivFloat))
CHECK_BB(gwi_oper_ini(gwi, "float", "Vec4", "Vec4"))
- CHECK_BB(gwi_oper_end(gwi, op_add, FloatAddVec4))
- CHECK_BB(gwi_oper_end(gwi, op_sub, FloatSubVec4))
- CHECK_BB(gwi_oper_end(gwi, op_mul, FloatMulVec4))
- return (m_bool)gwi_oper_end(gwi, op_div, FloatDivVec4);
+ CHECK_BB(gwi_oper_end(gwi, "+", FloatAddVec4))
+ CHECK_BB(gwi_oper_end(gwi, "-", FloatSubVec4))
+ CHECK_BB(gwi_oper_end(gwi, "*", FloatMulVec4))
+ return (m_bool)gwi_oper_end(gwi, "/", FloatDivVec4);
}
}
if(implicit) {
const struct Implicit imp = { e, t };
- struct Op_Import opi = { .op=op_impl, .lhs=e->type, .rhs=t, .data=(m_uint)&imp, .pos=e->pos };
+ struct Op_Import opi = { .op=insert_symbol("@implicit"), .lhs=e->type, .rhs=t, .data=(m_uint)&imp, .pos=e->pos };
return op_check(env, &opi) ? 1 : -1;
}
}
}
ANN static Type check_exp_binary(const Env env, const Exp_Binary* bin) {
- if(bin->lhs->exp_type == ae_exp_unary && bin->lhs->d.exp_unary.op == op_fork &&
+ if(bin->lhs->exp_type == ae_exp_unary && bin->lhs->d.exp_unary.op == insert_symbol("fork") &&
bin->rhs->exp_type == ae_exp_decl)
bin->lhs->d.exp_unary.fork_ok = 1;
CHECK_OO(check_exp(env, bin->lhs))
ANN static Type check_exp_cast(const Env env, const Exp_Cast* cast) {
DECL_OO(const Type, t, = check_exp(env, cast->exp))
CHECK_OO((exp_self(cast)->type = cast->td->xid ? known_type(env, cast->td) : check_td(env, cast->td)))
- struct Op_Import opi = { .op=op_cast, .lhs=t, .rhs=exp_self(cast)->type, .data=(uintptr_t)cast, .pos=exp_self(cast)->pos };
+ struct Op_Import opi = { .op=insert_symbol("$"), .lhs=t, .rhs=exp_self(cast)->type, .data=(uintptr_t)cast, .pos=exp_self(cast)->pos };
return op_check(env, &opi);
}
const m_bool is_unary = GET_FLAG(f->def, unary);
const Type l = is_unary ? NULL : a->type;
const Type r = is_unary ? a->type : a->next ? a->next->type : NULL;
- const Operator op = name2op(s_name(f->def->base->xid));
- struct Op_Import opi = { .op=op, .lhs=l, .rhs=r, .data=(m_uint)f, .pos=f->def->pos };
+ struct Op_Import opi = { .op=f->def->base->xid, .lhs=l, .rhs=r, .data=(m_uint)f, .pos=f->def->pos };
operator_set_func(&opi);
}
const Vector v = (Vector)map_get(&n->info->op_map, (vtype)ock->opi->op);
if(!v || !operator_find(v, ock->opi->lhs, ock->opi->rhs))
return GW_OK;
- env_err(ock->env, ock->opi->pos, _("operator '%s', for type '%s' and '%s' already imported"),
- op2str(ock->opi->op), ock->opi->lhs ? ock->opi->lhs->name : NULL,
- ock->opi->rhs ? ock->opi->rhs->name : NULL);
+// TODO: get me back
+// env_err(ock->env, ock->opi->pos, _("operator '%s', for type '%s' and '%s' already imported"),
+// s_name(ock->opi->op), ock->opi->lhs ? ock->opi->lhs->name : NULL,
+// ock->opi->rhs ? ock->opi->rhs->name : NULL);
return GW_ERROR;
}
return GW_OK;
}
-ANN static void set_nspc(struct Op_Import* opi, const Nspc nspc) {
- if(opi->op == op_impl)return;
- if(opi->op == op_cast)
- ((Exp_Cast*)opi->data)->nspc = nspc;
- if(opi->lhs) {
- if(opi->rhs)
- ((Exp_Binary*)opi->data)->nspc = nspc;
+ANN static void set_nspc(struct OpChecker* ock, const Nspc nspc) {
+ if(ock->opi->op == insert_symbol(ock->env->gwion->st, "@implicit"))return;
+ if(ock->opi->op == insert_symbol(ock->env->gwion->st, "$"))
+ ((Exp_Cast*)ock->opi->data)->nspc = nspc;
+ if(ock->opi->lhs) {
+ if(ock->opi->rhs)
+ ((Exp_Binary*)ock->opi->data)->nspc = nspc;
else
- ((Exp_Postfix*)opi->data)->nspc = nspc;
+ ((Exp_Postfix*)ock->opi->data)->nspc = nspc;
} else
- ((Exp_Unary*)opi->data)->nspc = nspc;
+ ((Exp_Unary*)ock->opi->data)->nspc = nspc;
}
ANN static Type op_check_inner(struct OpChecker* ock) {
if(ret == t_null)
break;
if(!ock.mut)
- set_nspc(opi, nspc);
+ set_nspc(&ock, nspc);// TODO check me
return ret;
}
} while(l && (l = op_parent(env, l)));
}
nspc = nspc->parent;
} while(nspc);
- if(opi->op == op_cast || (ret != t_null && opi->op != op_impl))
+ if(opi->op == insert_symbol(env->gwion->st, "$") ||
+ (ret != t_null && opi->op != insert_symbol(env->gwion->st, "@implicit")))
env_err(env, opi->pos, _("%s %s %s: no match found for operator"),
- type_name(opi->lhs), op2str(opi->op), type_name(opi->rhs));
+ type_name(opi->lhs), s_name(opi->op), type_name(opi->rhs));
return NULL;
}
ANN m_bool operator_set_func(const struct Op_Import* opi) {
const Nspc nspc = ((Func)opi->data)->value_ref->owner;
- const Vector v = (Vector)map_get(&nspc->info->op_map, opi->op);
+ 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))
mo->func = (Func)opi->data;
return GW_OK;
return GW_OK;
}
-ANN static Nspc get_nspc(const struct Op_Import* opi) {
- if(opi->op == op_impl)
+ANN static Nspc get_nspc(SymTable *st, const struct Op_Import* opi) {
+ if(opi->op == insert_symbol(st, "@implicit"))
return opi->rhs->e->owner;
- if(opi->op == op_cast)
+ if(opi->op == insert_symbol(st, "$"))
return ((Exp_Cast*)opi->data)->nspc;
if(opi->lhs) {
if(opi->rhs)
}
ANN m_bool op_emit(const Emitter emit, const struct Op_Import* opi) {
- Nspc nspc = get_nspc(opi);
+ Nspc nspc = get_nspc(emit->gwion->st, opi);
do {
Type l = opi->lhs;
do {
if(post->exp->meta == ae_meta_var)
return GW_OK;
ERR_B(post->exp->pos, _("post operator '%s' cannot be used"
- " on non-mutable data-type..."), op2str(post->op));
+ " on non-mutable data-type..."), s_name(post->op));
}
ANN static m_bool scan1_exp_call(const Env env, const Exp_Call* exp_call) {
}
ANN static inline m_bool scan1_exp_unary(const restrict Env env, const Exp_Unary *unary) {
- if((unary->op == op_spork || unary->op == op_fork) && unary->code)
+ if((unary->op == insert_symbol("spork") || unary->op == insert_symbol("fork")) && unary->code)
{ RET_NSPC(scan1_stmt(env, unary->code)) }
return unary->exp ? scan1_exp(env, unary->exp) : GW_OK;
}
}
-ANN static m_bool multi_decl(const Env env, const Exp e, const Operator op) {
+ANN static m_bool multi_decl(const Env env, const Exp e, const Symbol op) {
if(e->exp_type == ae_exp_decl) {
if(e->d.exp_decl.list->next)
- ERR_B(e->pos, _("cant '%s' from/to a multi-variable declaration."), op2str(op))
+ ERR_B(e->pos, _("cant '%s' from/to a multi-variable declaration."), s_name(op))
SET_FLAG(e->d.exp_decl.list->self->value, used);
}
return GW_OK;
}
ANN static m_bool scan2_exp_unary(const Env env, const Exp_Unary * unary) {
- if((unary->op == op_spork || unary->op == op_fork) && unary->code) {
+ if((unary->op == insert_symbol("spork") || unary->op == insert_symbol("fork")) && unary->code) {
RET_NSPC(scan2_stmt(env, unary->code))
} else if(unary->exp)
return scan2_exp(env, unary->exp);
ANN static m_bool scan2_func_def_op(const Env env, const Func_Def f) {
assert(f->base->args);
- const Operator op = name2op(s_name(f->base->xid));
const Type l = GET_FLAG(f, unary) ? NULL :
f->base->args->var_decl->value->type;
const Type r = GET_FLAG(f, unary) ? f->base->args->var_decl->value->type :
f->base->args->next ? f->base->args->next->var_decl->value->type : NULL;
- struct Op_Import opi = { .op=op, .lhs=l, .rhs=r, .ret=f->base->ret_type, .pos=f->pos };
+ struct Op_Import opi = { .op=f->base->xid, .lhs=l, .rhs=r, .ret=f->base->ret_type, .pos=f->pos };
CHECK_BB(add_op(env->gwion, &opi))
return GW_OK;
}
-Subproject commit 5e175eff5cc60ef509ede0378891850feee1cc13
+Subproject commit dc6040ef47f0e9b03c3a2d4dbf4c551c54a299eb