tflag_distinct = 1 << 17,
tflag_noret = 1 << 18,
tflag_contract = 1 << 19,
+ tflag_float = 1 << 20,
} __attribute__((packed));
struct Type_ {
const Type parent = get_parent(gwi, parent_name);
const Type t = new_type(gwi->gwion->mp, name, parent);
t->size = size;
+ if(safe_tflag(parent, tflag_float))
+ set_tflag(t, tflag_float);
return t;
}
ANN static M_Object do_alloc_array(const VM_Shred shred, ArrayInfo *info) {
const m_int cap = *(m_int *)REG(info->depth * SZ_INT);
if (cap < 0) {
- gw_err("[gwion](VM): NegativeArraySize: while allocating arrays...\n");
+ gw_err("{-}[{0}{+}Gwion{0}{-}](VM):{0} NegativeArraySize: while allocating arrays...\n");
return NULL;
}
const M_Object base = do_alloc_array_object(shred->info->mp, info, cap);
if (info->is_obj) aai.data = init_array(shred, info, &num_obj);
const M_Object ref = do_alloc_array(shred, &aai);
if (!ref) {
- gw_err("[Gwion](VM): (note: in shred[id=%" UINT_F ":%s])\n",
+ gw_err("{-}[{0}{+}Gwion{0}{-}](VM):{0} (note: in shred[id=%" UINT_F ":%s])\n",
shred->tick->xid, shred->code->name);
vm_shred_exit(shred);
if (info->is_obj) free(aai.data);
const Type t_float = gwi_mk_type(gwi, "float", SZ_FLOAT, NULL);
GWI_BB(gwi_gack(gwi, t_float, gack_float))
GWI_BB(gwi_set_global_type(gwi, t_float, et_float))
+ set_tflag(t_float, tflag_float);
gwidoc(gwi, "represent duration.");
const Type t_dur = gwi_mk_type(gwi, "dur", SZ_FLOAT, NULL);
GWI_BB(gwi_gack(gwi, t_dur, gack_float))
GWI_BB(gwi_add_type(gwi, t_dur))
+ set_tflag(t_dur, tflag_float);
gwidoc(gwi, "represent time.");
const Type t_time = gwi_mk_type(gwi, "time", SZ_FLOAT, NULL);
GWI_BB(gwi_gack(gwi, t_time, gack_float))
GWI_BB(gwi_add_type(gwi, t_time))
+ set_tflag(t_time, tflag_float);
gwidoc(gwi, "internal time for `{/}now{0}{-}`.");
const Type t_now = gwi_mk_type(gwi, "@now", SZ_FLOAT, "time");
CHECK_FF("*=>", rassign, r_mul)
CHECK_FF("/=>", rassign, r_div)
- GWI_BB(gwi_oper_ini(gwi, "dur", "dur", "int"))
+ GWI_BB(gwi_oper_ini(gwi, "dur", "dur", "bool"))
+ GWI_BB(gwi_oper_end(gwi, "==", float_eq))
+ GWI_BB(gwi_oper_end(gwi, "!=", float_neq))
GWI_BB(gwi_oper_end(gwi, ">", float_gt))
GWI_BB(gwi_oper_end(gwi, ">=", float_ge))
GWI_BB(gwi_oper_end(gwi, "<", float_lt))
GWI_BB(gwi_oper_end(gwi, "+", float_add))
GWI_BB(gwi_oper_ini(gwi, "dur", "@now", "time"))
_CHECK_OP("=>", now, Time_Advance)
- GWI_BB(gwi_oper_ini(gwi, "time", "time", "int"))
+ GWI_BB(gwi_oper_ini(gwi, "time", "time", "bool"))
GWI_BB(gwi_oper_end(gwi, ">", float_gt))
GWI_BB(gwi_oper_end(gwi, ">=", float_ge))
GWI_BB(gwi_oper_end(gwi, "<", float_lt))