struct GwionData_ *data;
SymTable *st;
MemPool mp;
+ Type *type;
};
ANN m_bool gwion_ini(const Gwion, struct Arg_*);
ANN VM* gwi_vm(const Gwi);
ANN2(1,2) ANEW Type gwi_mk_type(const Gwi, const m_str, const m_uint, const Type);
ANN m_int gwi_add_type(const Gwi gwi, Type type);
+ANN m_int gwi_set_global_type(const Gwi gwi, const Type type, const type_enum te);
ANN2(1,2)m_int gwi_class_ini(const Gwi gwi, const Type type, const f_xtor pre_ctor, const f_xtor dtor);
ANN m_int gwi_class_ext(const Gwi gwi, Type_Decl* td);
ANN m_int gwi_class_end(const Gwi gwi);
return isa(actual_type(t), t_fptr) > 0;
}
ANN m_uint get_depth(const Type type);
-#endif
+typedef enum {
+ et_void, et_int, et_bool, et_float, et_dur, et_time, et_now, et_complex, et_polar, et_vec3, et_vec4,
+ et_null, et_object, et_shred, et_fork, et_event, et_ugen, et_string, et_ptr, et_array, zt_gack,
+ et_function, et_fptr, et_varloop, et_vararg, et_lambda, et_class, et_union, et_undefined, et_auto, et_tuple,
+ MAX_TYPE
+} type_enum;
+#endif
gwion->data = src->gwion->data;
gwion->st = src->gwion->st;
gwion->mp = src->gwion->mp;
+ gwion->type = src->gwion->type;
return gwion->vm;
}
gwion->env->gwion = gwion;
gwion->vm->bbq->si = new_soundinfo(gwion->mp);
gwion->data = new_gwiondata(gwion->mp);
+ gwion->type = xmalloc(MAX_TYPE * sizeof(struct Type_));
pass_default(gwion);
arg->si = gwion->vm->bbq->si;
const m_bool ret = arg_parse(gwion, arg);
free_plug(gwion);
free_gwiondata(gwion->mp, gwion->data);
free_symbols(gwion->st);
+ xfree(gwion->type);
mempool_end(gwion->mp);
}
GWI_BB(gwi_add_type(gwi, t_auto))
SET_FLAG(t_class, abstract);
GWI_OB((t_void = gwi_mk_type(gwi, "void", 0, NULL)))
- GWI_BB(gwi_add_type(gwi, t_void))
+ GWI_BB(gwi_set_global_type(gwi, t_void, et_void))
GWI_OB((t_null = gwi_mk_type(gwi, "@null", SZ_INT, NULL)))
GWI_BB(gwi_add_type(gwi, t_null))
GWI_OB((t_function = gwi_mk_type(gwi, "@function", SZ_INT, NULL)))
return (m_int)type->xid;
}
+ANN m_int gwi_set_global_type(const Gwi gwi, const Type type, const type_enum te) {
+ GWI_BB(gwi_add_type(gwi, type))
+ gwi->gwion->type[te] = type;
+ return GW_OK;
+}
+
ANN2(1,2) static void import_class_ini(const Env env, const Type type,
const f_xtor pre_ctor, const f_xtor dtor) {
type->nspc = new_nspc(env->gwion->mp, type->name);
#include "operator.h"
#include "instr.h"
#include "object.h"
+#include "type.h"
#include "import.h"
typedef m_bool (*import)(Gwi);