From 03218faf94030b5dcb3268a0da61a45d3d6f609b Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Tue, 15 Dec 2020 14:56:13 +0100 Subject: [PATCH] :art: Rename str2decl => str2td --- include/import/checker.h | 4 ++-- src/import/import_cdef.c | 2 +- src/import/import_checker.c | 14 +++++++------- src/import/import_fdef.c | 4 ++-- src/import/import_oper.c | 2 +- src/import/import_tdef.c | 2 +- src/import/import_type.c | 2 +- src/import/import_udef.c | 4 ++-- tests/plug/str2decl.c | 2 +- tests/plug/str2decl.gw | 2 +- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/import/checker.h b/include/import/checker.h index 38564c09..f7adeb71 100644 --- a/include/import/checker.h +++ b/include/import/checker.h @@ -51,14 +51,14 @@ ANN Symbol str2sym(const Gwion gwi, const m_str path, const loc_t pos); 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); diff --git a/src/import/import_cdef.c b/src/import/import_cdef.c index de3bdcd1..7b9c5a2f 100644 --- a/src/import/import_cdef.c +++ b/src/import/import_cdef.c @@ -57,7 +57,7 @@ ANN static Type type_finish(const Gwi gwi, const Type t) { 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)) diff --git a/src/import/import_checker.c b/src/import/import_checker.c index 214fb755..9fea976f 100644 --- a/src/import/import_checker.c +++ b/src/import/import_checker.c @@ -137,9 +137,9 @@ ANN m_bool check_typename_def(const Gwi gwi, ImportCK *ck) { } -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; @@ -174,7 +174,7 @@ ANN static Type_List td_tmpl(const Gwion gwion, struct td_checker *tdc) { 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)) @@ -185,7 +185,7 @@ ANN static Type_Decl* _str2decl(const Gwion gwion, struct td_checker *tdc) { 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) @@ -201,9 +201,9 @@ ANN static Type_Decl* _str2decl(const Gwion gwion, struct td_checker *tdc) { 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); @@ -212,7 +212,7 @@ ANN Type_Decl* str2decl(const Gwion gwion, const m_str str, const loc_t pos) { } 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; diff --git a/src/import/import_fdef.c b/src/import/import_fdef.c index 32d2a8c3..ac296345 100644 --- a/src/import/import_fdef.c +++ b/src/import/import_fdef.c @@ -20,7 +20,7 @@ ANN2(1,2,3) static m_bool dl_func_init(const Gwi gwi, const restrict m_str 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; } @@ -97,7 +97,7 @@ ANN m_int gwi_func_arg(const Gwi gwi, const restrict m_str t, const restrict m_s 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); diff --git a/src/import/import_oper.c b/src/import/import_oper.c index 01df4c0e..e7b87470 100644 --- a/src/import/import_oper.c +++ b/src/import/import_oper.c @@ -20,7 +20,7 @@ ANN static Type _get_type(const Gwi gwi, const m_str s) { 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; diff --git a/src/import/import_tdef.c b/src/import/import_tdef.c index cfd2b7bf..77e4764e 100644 --- a/src/import/import_tdef.c +++ b/src/import/import_tdef.c @@ -20,7 +20,7 @@ ANN m_int gwi_typedef_ini(const Gwi gwi, const restrict m_str type, const restri 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) { diff --git a/src/import/import_type.c b/src/import/import_type.c index 44e58ac8..75ee489b 100644 --- a/src/import/import_type.c +++ b/src/import/import_type.c @@ -15,7 +15,7 @@ #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"; diff --git a/src/import/import_udef.c b/src/import/import_udef.c index 029ca26a..c3435a31 100644 --- a/src/import/import_udef.c +++ b/src/import/import_udef.c @@ -16,7 +16,7 @@ // 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)); @@ -33,7 +33,7 @@ ANN m_int gwi_union_ini(const Gwi gwi, const m_str name) { 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; diff --git a/tests/plug/str2decl.c b/tests/plug/str2decl.c index c8d9d9d9..416c8ecd 100644 --- a/tests/plug/str2decl.c +++ b/tests/plug/str2decl.c @@ -12,7 +12,7 @@ #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)) diff --git a/tests/plug/str2decl.gw b/tests/plug/str2decl.gw index 9532ca7d..715f0565 100644 --- a/tests/plug/str2decl.gw +++ b/tests/plug/str2decl.gw @@ -1,2 +1,2 @@ -#require str2decl +#require str2td <<< __file__ >>>; -- 2.43.0