-Subproject commit 0572c7f619a0b3377efa07a77a3f3b369b2c6e39
+Subproject commit c405f31eb2ffaf5a26b4ae92165d14784b2f2287
const Value v = (Value)vector_at(&edef->values, i);
*(m_uint *)(v->from->owner->class_data + v->from->offset) = i;
}
- set_tflag(edef->t, tflag_emit);
+ set_tflag(edef->type, tflag_emit);
return GW_OK;
}
lint_indent(gwi->lint);
lint_enum_def(gwi->lint, edef);
}
- const Type t = ret > 0 ? edef->t : NULL;
+ const Type t = ret > 0 ? edef->type : NULL;
if (edef->values.ptr) vector_release(&edef->values);
free_enum_def(gwion->mp, edef);
vector_release(&gwi->ck->v);
GWI_BB(gwi_oper_add(gwi, opck_new))
GWI_BB(gwi_oper_emi(gwi, opem_new))
GWI_BB(gwi_oper_end(gwi, "new", NULL))
+ GWI_BB(import_ref(gwi))
GWI_BB(import_string(gwi))
GWI_BB(import_shred(gwi))
GWI_BB(import_modules(gwi))
- GWI_BB(import_ref(gwi))
gwidoc(gwi, "allow member access.");
GWI_BB(gwi_oper_ini(gwi, "@Compound", (m_str)OP_ANY_TYPE, NULL))
const m_str str = STRING(obj);
*(m_float*)RETURN = (m_float)atof(str);
}
-/*
+ #include <errno.h>
static MFUN(string_atoi2) {
const M_Object obj = *(M_Object*)MEM(0);
const m_str str = STRING(obj);
- char *endptr;
- *(m_int*)RETURN = strtol(str, &endptr, 10);
+puts(str);
+ char *endptr = NULL;
+ if(!(*(m_int*)RETURN = strtol(str, &endptr, 10))) {
+printf("lkjlk j %i\n", errno);
+ if(errno == EINVAL) {
+ handle(shred, "ErrorInvalidValue");
+ return;
+ }
+ if(errno == ERANGE) {
+ handle(shred, "ValueOutOfRange");
+ return;
+ }
+ }
+printf("ret: %li\n", *(m_int*)RETURN);
**(m_uint**)MEM(SZ_INT) = endptr - str;
}
-*/
ANN Type check_array_access(const Env env, const Array_Sub array);
gwi_func_ini(gwi, "int", "atoi");
GWI_BB(gwi_func_end(gwi, string_atoi, ae_flag_none))
+ gwi_func_ini(gwi, "int", "atoi2");
+ gwi_func_arg(gwi, "&int", "offset");
+ GWI_BB(gwi_func_end(gwi, string_atoi2, ae_flag_none))
+
gwi_func_ini(gwi, "float", "atof");
GWI_BB(gwi_func_end(gwi, string_atof, ae_flag_none))
}
ANN m_bool check_enum_def(const Env env, const Enum_Def edef) {
- const m_uint scope = env_push_type(env, edef->t);
+ const m_uint scope = env_push_type(env, edef->type);
ID_List list = edef->list;
for(uint32_t i = 0; i < list->len; i++) {
Symbol xid = *mp_vector_at(list, Symbol, i);
decl_static(env, nspc_lookup_value0(env->curr, xid));
}
env_pop(env, scope);
- nspc_allocdata(env->gwion->mp, edef->t->nspc);
+ nspc_allocdata(env->gwion->mp, edef->type->nspc);
return GW_OK;
}
ANN bool check_trait_requests(const Env env, const Type t, const ID_List list, const ValueFrom *from);
ANN static m_bool check_extend_def(const Env env, const Extend_Def xdef) {
+ const Type t = xdef->type;
ValueFrom from = { .filename = env->name, .loc=xdef->td->pos, .ctx=env->context,
.owner = env->curr, .owner_class = env->class_def
};
- const bool ret = check_trait_requests(env, xdef->t, xdef->traits, &from);
+ const bool ret = check_trait_requests(env, t, xdef->traits, &from);
if(ret) {
- if(!xdef->t->info->traits) {
- xdef->t->info->traits = new_mp_vector(env->gwion->mp, Symbol, xdef->traits->len);
+ if(!t->info->traits) {
+ t->info->traits = new_mp_vector(env->gwion->mp, Symbol, xdef->traits->len);
for(uint32_t i = 0; i < xdef->traits->len; i++) {
- const Symbol sym = *mp_vector_at(xdef->t->info->traits, Symbol, i);
- mp_vector_set(xdef->t->info->traits, Symbol, i, sym);
+ const Symbol sym = *mp_vector_at(t->info->traits, Symbol, i);
+ mp_vector_set(t->info->traits, Symbol, i, sym);
}
} else {
for(uint32_t i = 0; i < xdef->traits->len; i++) {
- const Symbol sym = *mp_vector_at(xdef->t->info->traits, Symbol, i);
- mp_vector_add(env->gwion->mp, &xdef->t->info->traits, Symbol, sym);
+ const Symbol sym = *mp_vector_at(t->info->traits, Symbol, i);
+ mp_vector_add(env->gwion->mp, &t->info->traits, Symbol, sym);
}
}
return GW_OK;
CHECK_BB(env_storage(env, edef->flag, edef->pos));
CHECK_BB(scan0_defined(env, edef->xid, edef->pos));
CHECK_BB(scan0_global(env, edef->flag, edef->pos));
- edef->t = enum_type(env, edef);
+ edef->type = enum_type(env, edef);
vector_init(&edef->values);
if (GET_FLAG(edef, global)) context_global(env);
return GW_OK;
}
}
}
- xdef->t = t;
+ xdef->type = t;
return GW_OK;
}
}
ANN m_bool scan1_enum_def(const Env env, const Enum_Def edef) {
- edef->t->nspc = new_nspc(env->gwion->mp, edef->t->name);
- const m_uint scope = env_push_type(env, edef->t);
+ const Type t = edef->type;
+ t->nspc = new_nspc(env->gwion->mp, t->name);
+ const m_uint scope = env_push_type(env, t);
ID_List list = edef->list;
for(uint32_t i = 0; i < list->len; i++) {
Symbol xid = *mp_vector_at(list, Symbol, i);
- const Value v = new_value(env, edef->t, s_name(xid), edef->pos);
+ const Value v = new_value(env, t, s_name(xid), edef->pos);
valuefrom(env, v->from);
nspc_add_value(env->curr, xid, v);
if (env->class_def) {
SET_FLAG(v, static);
SET_ACCESS(edef, v)
- SET_ACCESS(edef, edef->t)
+ SET_ACCESS(edef, t)
} else
set_vflag(v, vflag_builtin);
SET_FLAG(v, const);