ANN void m_vector_add(const M_Vector, const void*);
ANN m_bit* m_vector_addr(const M_Vector, const m_uint);
ANN void m_vector_rem(const M_Vector, const m_uint);
-ANEW M_Vector new_m_vector(MemPool, const m_uint);
+ANEW M_Vector new_m_vector(MemPool, const m_uint size, const m_uint len);
ANN void free_m_vector(MemPool, M_Vector);
#endif
return ARRAY_LEN(v);
}
-M_Vector new_m_vector(MemPool p, const m_uint size) {
- const M_Vector array = mp_calloc(p, M_Vector);
- const size_t sz = (ARRAY_OFFSET*SZ_INT) + (2*size);
- array->ptr = (m_bit*)xcalloc(1, sz);
- ARRAY_CAP(array) = 2;
- ARRAY_SIZE(array) = size;
- return array;
-}
-
-M_Vector new_m_vector2(MemPool p, const m_uint size, const m_uint len) {
+M_Vector new_m_vector(MemPool p, const m_uint size, const m_uint len) {
const M_Vector array = mp_calloc(p, M_Vector);
const size_t sz = (ARRAY_OFFSET*SZ_INT) + (len*size);
array->ptr = (m_bit*)xcalloc(1, sz);
const M_Object a = new_object(p, NULL, t);
const m_uint depth = t->array_depth;
const m_uint size = depth > 1 ? SZ_INT : array_base(t)->size;
- ARRAY(a) = new_m_vector2(p, size,length);
+ ARRAY(a) = new_m_vector(p, size,length);
return a;
}
}
static MFUN(vm_vector_rem) {
- const m_int index = *(m_int*)(shred->reg + SZ_INT);
+ const m_int index = *(m_int*)(shred->mem + SZ_INT);
const M_Vector v = ARRAY(o);
if(index < 0 || (m_uint)index >= ARRAY_LEN(v))
return;
if(bin->lhs->type->array_depth != bin->rhs->type->array_depth)
ERR_N(exp_self(bin)->pos, _("array depths do not match."))
if(bin->rhs->exp_type == ae_exp_decl) {
- if(bin->rhs->d.exp_decl.list->self->array->exp)
+ if(bin->rhs->d.exp_decl.list->self->array &&
+ bin->rhs->d.exp_decl.list->self->array->exp)
ERR_N(exp_self(bin)->pos, _("do not provide array for 'xxx @=> declaration'."))
}
bin->rhs->emit_var = 1;
static OP_CHECK(opck_array_shift) {
ARRAY_OPCK
if(bin->lhs->type->array_depth != bin->rhs->type->array_depth + 1)
- return t_null;
+ ERR_N(exp_self(bin)->pos, "array depths do not match for '<<'.");
return bin->lhs->type;
}
gwi_reserve(gwi, "now");
return GW_OK;
}
-
+/*
static OP_CHECK(opck_chuck_now) {
Exp_Binary* bin = (Exp_Binary*)data;
- ERR_O(exp_self(bin)->pos, _("can't assign 'now' to 'now'"))
- return NULL;
+ ERR_N(exp_self(bin)->pos, _("can't assign 'now' to 'now'"))
}
-
+*/
static OP_CHECK(opck_implicit_f2i) {
return t_null;
}
CHECK_BB(gwi_oper_end(gwi, "+", FloatPlus))
CHECK_BB(gwi_oper_ini(gwi, "dur", "@now", "time"))
_CHECK_OP("=>", rhs_emit_var, Time_Advance)
- CHECK_BB(gwi_oper_ini(gwi, "@now", "@now", NULL))
- _CHECK_OP("=>", chuck_now, NULL)
- CHECK_BB(gwi_oper_ini(gwi, NULL, "@now", NULL))
- CHECK_BB(gwi_oper_end(gwi, "!", NULL))
CHECK_BB(gwi_oper_ini(gwi, "time", "time", "int"))
CHECK_BB(gwi_oper_end(gwi, ">", float_gt))
CHECK_BB(gwi_oper_end(gwi, ">=", float_ge))
CHECK_BB(isres(env, var->xid, exp_self(decl)->pos))
Type t = decl->type;
const Value former = nspc_lookup_value0(env->curr, var->xid);
- if(former && !decl->td->exp &&
+ if(former && !(decl->td->exp || decl->td->xid)&&
(!env->class_def || !(GET_FLAG(env->class_def, template) || GET_FLAG(env->class_def, scan1))))
ERR_B(var->pos, _("variable %s has already been defined in the same scope..."),
s_name(var->xid))
--- /dev/null
+fun void test(int i) {}
+2.3 => test;
-#! [contains] array types do not match
-int i[2];
-i << 2.3;
+#! [contains] array depths do not match
+int i[2][2];
+i << 2;