ANN ID_List str2symlist(const Gwion gwi, const m_str path, const loc_t);
ANN Var_Decl str2var(const Gwion, const m_str, const loc_t);
ANN Var_Decl_List str2varlist(const Gwion, const m_str, const loc_t);
-ANN Type_Decl* str2decl(const Gwion, const m_str, const loc_t);
+ANN Type_Decl* str2td(const Gwion, const m_str, const loc_t);
ANN Type str2type(const Gwion, const m_str, const loc_t);
#define gwi_str2sym(gwi, path) str2sym(gwi->gwion, path, gwi->loc)
#define gwi_str2symlist(gwi, path) str2symlist(gwi->gwion, path, gwi->loc)
#define gwi_str2var(gwi, path) str2var(gwi->gwion, path, gwi->loc)
#define gwi_str2varlist(gwi, path) str2varlist(gwi->gwion, path, gwi->loc)
-#define gwi_str2decl(gwi, path) str2decl(gwi->gwion, path, gwi->loc)
+#define gwi_str2td(gwi, path) str2td(gwi->gwion, path, gwi->loc)
#define gwi_str2type(gwi, path) str2type(gwi->gwion, path, gwi->loc)
ANN m_bool ck_ini(const Gwi, const enum importck_type);
ANN2(1,2) Type gwi_class_ini(const Gwi gwi, const m_str name, const m_str parent) {
struct ImportCK ck = { .name=name };
CHECK_BO(check_typename_def(gwi, &ck))
- DECL_OO(Type_Decl *,td, = gwi_str2decl(gwi, parent ?: "Object"))
+ DECL_OO(Type_Decl *,td, = gwi_str2td(gwi, parent ?: "Object"))
Tmpl* tmpl = ck.tmpl ? new_tmpl_base(gwi->gwion->mp, ck.tmpl) : NULL;
if(tmpl)
CHECK_BO(template_push_types(gwi->gwion->env, tmpl))
}
-ANN static Type_Decl* _str2decl(const Gwion gwion, struct td_checker *tdc);
+ANN static Type_Decl* _str2td(const Gwion gwion, struct td_checker *tdc);
ANN Type_List __str2tl(const Gwion gwion, struct td_checker *tdc) {
- Type_Decl *td = _str2decl(gwion, tdc);
+ Type_Decl *td = _str2td(gwion, tdc);
if(!td)
GWION_ERR_O(tdc->pos, "invalid types");
Type_List next = NULL;
return tl;
}
-ANN static Type_Decl* _str2decl(const Gwion gwion, struct td_checker *tdc) {
+ANN static Type_Decl* _str2td(const Gwion gwion, struct td_checker *tdc) {
DECL_OO(const Symbol, sym, = __str2sym(gwion, tdc))
struct AC ac = { .str = tdc->str, .pos=tdc->pos };
CHECK_BO(ac_run(gwion, &ac))
Type_Decl *next = NULL;
if(*tdc->str == '.') {
++tdc->str;
- if(!(next = _str2decl(gwion, tdc))) {
+ if(!(next = _str2td(gwion, tdc))) {
if(tl)
free_type_list(gwion->mp, tl);
if(ac.base)
return td;
}
-ANN Type_Decl* str2decl(const Gwion gwion, const m_str str, const loc_t pos) {
+ANN Type_Decl* str2td(const Gwion gwion, const m_str str, const loc_t pos) {
struct td_checker tdc = { .str=str, .pos=pos };
- DECL_OO(Type_Decl *, td, = _str2decl(gwion, &tdc))
+ DECL_OO(Type_Decl *, td, = _str2td(gwion, &tdc))
if(*tdc.str) {
free_type_decl(gwion->mp, td);
GWION_ERR_O(pos, "excedental character '%c'", *tdc.str);
}
ANN Type str2type(const Gwion gwion, const m_str str, const loc_t pos) {
- DECL_OO(Type_Decl *, td, = str2decl(gwion, str, pos))
+ DECL_OO(Type_Decl *, td, = str2td(gwion, str, pos))
const Type t = known_type(gwion->env, td);
free_type_decl(gwion->mp, td);
return t;
CHECK_BB(ck_ini(gwi, ck_fdef))
gwi->ck->name = n;
CHECK_BB(check_typename_def(gwi, gwi->ck))
- CHECK_OB((gwi->ck->td = gwi_str2decl(gwi, t)))
+ CHECK_OB((gwi->ck->td = gwi_str2td(gwi, t)))
vector_init(&gwi->ck->v);
return GW_OK;
}
gwi->ck->variadic = 1;
return GW_OK;
}
- DECL_OB(Type_Decl*, td, = gwi_str2decl(gwi, t))
+ DECL_OB(Type_Decl*, td, = gwi_str2td(gwi, t))
const Var_Decl var = gwi_str2var(gwi, n);
if(var) {
const Arg_List arg = new_arg_list(gwi->gwion->mp, td, var, NULL);
if(s == (m_str)OP_ANY_TYPE)
return OP_ANY_TYPE;
// str2type
- Type_Decl *td = gwi_str2decl(gwi, s);
+ Type_Decl *td = gwi_str2td(gwi, s);
const Type t = known_type(gwi->gwion->env, td);
free_type_decl(gwi->gwion->mp, td);
return t;
CHECK_BB(ck_ini(gwi, ck_tdef))
gwi->ck->name = name;
CHECK_BB(check_typename_def(gwi, gwi->ck))
- return (gwi->ck->td = gwi_str2decl(gwi, type)) ? GW_OK : GW_ERROR;
+ return (gwi->ck->td = gwi_str2td(gwi, type)) ? GW_OK : GW_ERROR;
}
ANN Type gwi_typedef_end(const Gwi gwi, const ae_flag flag) {
#include "gwi.h"
ANN2(1) static Type get_parent(const Gwi gwi, const m_str parent_name) {
- Type_Decl* td = parent_name ? gwi_str2decl(gwi, parent_name) : NULL;
+ Type_Decl* td = parent_name ? gwi_str2td(gwi, parent_name) : NULL;
if(td) {
if(td->array || td->types) {
const m_str str = td->array ? "array" : "template";
// move me
ANN Exp make_exp(const Gwi gwi, const m_str type, const m_str name) {
- DECL_OO(Type_Decl*, td, = gwi_str2decl(gwi, type))
+ DECL_OO(Type_Decl*, td, = gwi_str2td(gwi, type))
const Var_Decl_List vlist = gwi_str2varlist(gwi, name);
if(vlist)
return new_exp_decl(gwi->gwion->mp, td, vlist, loc(gwi));
ANN m_int gwi_union_add(const Gwi gwi, const restrict m_str type, const restrict m_str name) {
CHECK_BB(ck_ok(gwi, ck_udef))
- DECL_OB(Type_Decl*, td, = str2decl(gwi->gwion, type, gwi->loc))
+ DECL_OB(Type_Decl*, td, = str2td(gwi->gwion, type, gwi->loc))
DECL_OB(const Symbol, xid, = str2sym(gwi->gwion, name, gwi->loc))
const Union_List l = new_union_list(gwi->gwion->mp, td, xid, loc(gwi));
l->next = gwi->ck->list;
#include "ugen.h"
#include "gwi.h"
-GWION_IMPORT(str2decl) {
+GWION_IMPORT(str2td) {
GWI_OB(gwi_class_ini(gwi, "Test", NULL))
GWI_OB(gwi_class_ini(gwi, "Child", NULL))
GWI_BB(gwi_class_end(gwi))
-#require str2decl
+#require str2td
<<< __file__ >>>;