From 064779328df288de055207f358560c1ab90ccdb7 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Sun, 22 Jan 2023 08:46:16 +0100 Subject: [PATCH] :art: renaming --- fmt | 2 +- include/gwi.h | 18 +++++++++--------- src/import/import_cdef.c | 14 +++++++------- src/import/import_enum.c | 4 ++-- src/import/import_fdef.c | 8 ++++---- src/import/import_internals.c | 10 +++++----- src/import/import_item.c | 8 ++++---- src/import/import_oper.c | 32 ++++++++++++++++---------------- src/import/import_prim.c | 2 +- src/import/import_special.c | 2 +- src/import/import_tdef.c | 4 ++-- src/import/import_type.c | 10 +++++----- src/import/import_udef.c | 4 ++-- 13 files changed, 59 insertions(+), 59 deletions(-) diff --git a/fmt b/fmt index 91b3c4e6..024e9cab 160000 --- a/fmt +++ b/fmt @@ -1 +1 @@ -Subproject commit 91b3c4e658b095dc9784946bb2829e7bf5f28907 +Subproject commit 024e9cab0b87c5cbb105d757a82b5d18337c5e0d diff --git a/include/gwi.h b/include/gwi.h index 95f45651..9493b188 100644 --- a/include/gwi.h +++ b/include/gwi.h @@ -4,20 +4,20 @@ #include "gwfmt.h" #define gwiheader(a, ...) \ if (a->gwion->data->cdoc) do { \ - lint_nl(gwi->lint); \ - lint_indent(gwi->lint); \ - lint_util(gwi->lint, (m_str)"{-}#!+ {/}%s{0}\n", __VA_ARGS__); \ + gwfmt_nl(gwi->gwfmt); \ + gwfmt_indent(gwi->gwfmt); \ + gwfmt_util(gwi->gwfmt, (m_str)"{-}#!+ {/}%s{0}\n", __VA_ARGS__); \ } while (0) #define gwidoc(a, ...) \ if (a->gwion->data->cdoc) do { \ - lint_nl(a->lint); \ - lint_indent(a->lint); \ - lint_util(a->lint, (m_str)"{-}#!- {/}%s{0}\n", __VA_ARGS__); \ + gwfmt_nl(a->gwfmt); \ + gwfmt_indent(a->gwfmt); \ + gwfmt_util(a->gwfmt, (m_str)"{-}#!- {/}%s{0}\n", __VA_ARGS__); \ } while (0) #define gwinote(a, ...) \ if (a->gwion->data->cdoc) do { \ - lint_indent(a->lint); \ - lint_util(a->lint, (m_str)"{-}#!- {/}%s{0}\n", __VA_ARGS__); \ + gwfmt_indent(a->gwfmt); \ + gwfmt_util(a->gwfmt, (m_str)"{-}#!- {/}%s{0}\n", __VA_ARGS__); \ } while (0) struct Gwi_ { @@ -27,7 +27,7 @@ struct Gwi_ { struct OperCK * oper; // _misc struct Vector_ effects; loc_t loc; - Lint * lint; + Gwfmt * gwfmt; uint8_t tmpls; }; diff --git a/src/import/import_cdef.c b/src/import/import_cdef.c index 9c6aa441..9473972e 100644 --- a/src/import/import_cdef.c +++ b/src/import/import_cdef.c @@ -66,9 +66,9 @@ ANN static Type type_finish(const Gwi gwi, const Type t) { set_tflag(t, tflag_cdef); } if (gwi->gwion->data->cdoc && t->info->cdef) { - lint_indent(gwi->lint); - gwi->lint->indent++; - lint_class_def(gwi->lint, t->info->cdef); + gwfmt_indent(gwi->gwfmt); + gwi->gwfmt->indent++; + gwfmt_class_def(gwi->gwfmt, t->info->cdef); } if(t->info->cdef && t->info->cdef->base.ext && t->info->cdef->base.ext->array) @@ -128,10 +128,10 @@ ANN Type gwi_struct_ini(const Gwi gwi, const m_str name) { ANN m_int gwi_class_end(const Gwi gwi) { if (gwi->gwion->data->cdoc && gwi->gwion->env->class_def->info->cdef) { - gwi->lint->indent--; - lint_indent(gwi->lint); - lint_rbrace(gwi->lint); - lint_nl(gwi->lint); + gwi->gwfmt->indent--; + gwfmt_indent(gwi->gwfmt); + gwfmt_rbrace(gwi->gwfmt); + gwfmt_nl(gwi->gwfmt); } if (!gwi->gwion->env->class_def) GWI_ERR_B(_("import: too many class_end called.")) diff --git a/src/import/import_enum.c b/src/import/import_enum.c index f2f87d5b..4461c887 100644 --- a/src/import/import_enum.c +++ b/src/import/import_enum.c @@ -82,8 +82,8 @@ ANN Type gwi_enum_end(const Gwi gwi) { const m_bool ret = traverse_enum_def(gwion->env, edef); if (ret > 0) import_enum_end(gwi, &edef->values); if (gwi->gwion->data->cdoc) { - lint_indent(gwi->lint); - lint_enum_def(gwi->lint, edef); + gwfmt_indent(gwi->gwfmt); + gwfmt_enum_def(gwi->gwfmt, edef); } const Type t = ret > 0 ? edef->type : NULL; if (edef->values.ptr) vector_release(&edef->values); diff --git a/src/import/import_fdef.c b/src/import/import_fdef.c index 9e643b41..d12d2095 100644 --- a/src/import/import_fdef.c +++ b/src/import/import_fdef.c @@ -47,8 +47,8 @@ ANEW ANN static Func_Def import_fdef(const Gwi gwi, ImportCK *ck) { Func_Base * base = gwi_func_base(gwi, ck); const Func_Def fdef = new_func_def(gwi->gwion->mp, base, NULL); if (gwi->gwion->data->cdoc) { - lint_indent(gwi->lint); - lint_func_def(gwi->lint, fdef); + gwfmt_indent(gwi->gwfmt); + gwfmt_func_def(gwi->gwfmt, fdef); } if (gwi->effects.ptr) { vector_init(&fdef->base->effects); @@ -133,8 +133,8 @@ ANN Type gwi_fptr_end(const Gwi gwi, const ae_flag flag) { DECL_OO(const Fptr_Def, fptr, = import_fptr(gwi)); fptr->base->flag |= flag; if (gwi->gwion->data->cdoc) { - lint_indent(gwi->lint); - lint_fptr_def(gwi->lint, fptr); + gwfmt_indent(gwi->gwfmt); + gwfmt_fptr_def(gwi->gwfmt, fptr); } if (safe_tflag(gwi->gwion->env->class_def, tflag_tmpl) /*&& !fptr->base->tmpl*/) { diff --git a/src/import/import_internals.c b/src/import/import_internals.c index 0346d8e6..8b670e7c 100644 --- a/src/import/import_internals.c +++ b/src/import/import_internals.c @@ -30,12 +30,12 @@ ANN void gwi_reset(const Gwi gwi) { } ANN static m_bool run_with_doc(const Gwi gwi, m_bool (*f)(const Gwi)) { - struct LintState ls = {.builtin = true, .nindent = 4}; + struct GwfmtState ls = {.builtin = true, .nindent = 4}; text_init(&ls.text, gwi->gwion->mp); - Lint linter = {.mp = gwi->gwion->mp, .ls = &ls }; - lint_indent(&linter); - lint_util(&linter, "{-}#!+ %s{0}\n", gwi->gwion->env->name); - gwi->lint = &linter; + Gwfmt gwfmter = {.mp = gwi->gwion->mp, .ls = &ls }; + gwfmt_indent(&gwfmter); + gwfmt_util(&gwfmter, "{-}#!+ %s{0}\n", gwi->gwion->env->name); + gwi->gwfmt = &gwfmter; const m_bool ret = f(gwi); fprintf(stdout, "%s", ls.text.str); return ret; diff --git a/src/import/import_item.c b/src/import/import_item.c index fbf78b3e..dc18be6d 100644 --- a/src/import/import_item.c +++ b/src/import/import_item.c @@ -44,10 +44,10 @@ m_int gwi_item_end(const Gwi gwi, const ae_flag flag, union value_data addr) { const Env env = gwi->gwion->env; gwi->ck->exp->d.exp_decl.td->flag = flag; if (gwi->gwion->data->cdoc) { - lint_indent(gwi->lint); - lint_exp(gwi->lint, gwi->ck->exp); - lint_sc(gwi->lint); - lint_nl(gwi->lint); + gwfmt_indent(gwi->gwfmt); + gwfmt_exp(gwi->gwfmt, gwi->ck->exp); + gwfmt_sc(gwi->gwfmt); + gwfmt_nl(gwi->gwfmt); } if (env->class_def && tflag(env->class_def, tflag_tmpl)) return gwi_item_tmpl(gwi); diff --git a/src/import/import_oper.c b/src/import/import_oper.c index 57bff002..9d0be4f1 100644 --- a/src/import/import_oper.c +++ b/src/import/import_oper.c @@ -73,33 +73,33 @@ ANN void gwi_oper_eff(const Gwi gwi, const m_str effect) { ANN m_int gwi_oper_end(const Gwi gwi, const m_str op, const f_instr f) { if (gwi->gwion->data->cdoc) { - lint_indent(gwi->lint); - lint_util(gwi->lint, "{+C}operator{0} "); + gwfmt_indent(gwi->gwfmt); + gwfmt_util(gwi->gwfmt, "{+C}operator{0} "); if (gwi->oper->lhs && !gwi->oper->rhs) { - lint_util(gwi->lint, "{+}%s{0}", + gwfmt_util(gwi->gwfmt, "{+}%s{0}", gwi->oper->lhs != (m_str)1 ? gwi->oper->lhs : "@Any"); - lint_space(gwi->lint); + gwfmt_space(gwi->gwfmt); } if (gwi->oper->ret) { - lint_util(gwi->lint, "{+}%s{0}", + gwfmt_util(gwi->gwfmt, "{+}%s{0}", gwi->oper->ret != (m_str)1 ? gwi->oper->ret : "@Any"); - lint_space(gwi->lint); + gwfmt_space(gwi->gwfmt); } - lint_util(gwi->lint, "{/}%s{0}", op); - lint_space(gwi->lint); - lint_lparen(gwi->lint); + gwfmt_util(gwi->gwfmt, "{/}%s{0}", op); + gwfmt_space(gwi->gwfmt); + gwfmt_lparen(gwi->gwfmt); if (gwi->oper->lhs && gwi->oper->rhs) { - lint_util(gwi->lint, "{+}%s{0}", + gwfmt_util(gwi->gwfmt, "{+}%s{0}", gwi->oper->lhs != (m_str)1 ? gwi->oper->lhs : "@Any"); - lint_comma(gwi->lint); - lint_space(gwi->lint); + gwfmt_comma(gwi->gwfmt); + gwfmt_space(gwi->gwfmt); } if (gwi->oper->rhs) - lint_util(gwi->lint, "{+}%s{0}", + gwfmt_util(gwi->gwfmt, "{+}%s{0}", gwi->oper->rhs != (m_str)1 ? gwi->oper->rhs : "@Any"); - lint_rparen(gwi->lint); - lint_sc(gwi->lint); - lint_nl(gwi->lint); + gwfmt_rparen(gwi->gwfmt); + gwfmt_sc(gwi->gwfmt); + gwfmt_nl(gwi->gwfmt); } gwi->oper->sym = insert_symbol(gwi->gwion->st, op); const m_bool ret = import_op(gwi, gwi->oper, f); diff --git a/src/import/import_prim.c b/src/import/import_prim.c index 7a99ff82..987f701d 100644 --- a/src/import/import_prim.c +++ b/src/import/import_prim.c @@ -217,7 +217,7 @@ ANN Type mk_primitive(const Env env, const m_str name, const m_uint size) { ANN m_bool gwi_primitive(const Gwi gwi, const m_str name, const m_uint size, const ae_flag flag) { const Env env = gwi->gwion->env; const Prim_Def pdef = new_prim_def(gwi->gwion->mp, insert_symbol(gwi->gwion->st, name), size, gwi->loc, flag); - if(gwi->gwion->data->cdoc)lint_prim_def(gwi->lint, pdef); + if(gwi->gwion->data->cdoc)gwfmt_prim_def(gwi->gwfmt, pdef); if(!env->class_def || !tflag(env->class_def, tflag_tmpl)) { const m_bool ret = scan0_prim_def(gwi->gwion->env, pdef); free_prim_def(gwi->gwion->mp, pdef); diff --git a/src/import/import_special.c b/src/import/import_special.c index 1927ac2a..eacc236c 100644 --- a/src/import/import_special.c +++ b/src/import/import_special.c @@ -29,7 +29,7 @@ ANN void gwi_register_pass(const Gwi gwi, const m_str name, ANN void gwi_specialid(const Gwi gwi, const m_str id, const SpecialId spid) { if (gwi->gwion->data->cdoc) - lint_util(gwi->lint, "{+C}specialid{0} %s{/}%s{0};\n", + gwfmt_util(gwi->gwfmt, "{+C}specialid{0} %s{/}%s{0};\n", spid->is_const ? "{+G}const{0} " : "", id); struct SpecialId_ *a = mp_calloc(gwi->gwion->mp, SpecialId); memcpy(a, spid, sizeof(struct SpecialId_)); diff --git a/src/import/import_tdef.c b/src/import/import_tdef.c index 22030732..336d7929 100644 --- a/src/import/import_tdef.c +++ b/src/import/import_tdef.c @@ -30,8 +30,8 @@ ANN Type gwi_typedef_end(const Gwi gwi, const ae_flag flag) { gwi->ck->tmpl = NULL; const m_bool ret = traverse_type_def(gwi->gwion->env, tdef); if (gwi->gwion->data->cdoc) { - lint_indent(gwi->lint); - lint_type_def(gwi->lint, tdef); + gwfmt_indent(gwi->gwfmt); + gwfmt_type_def(gwi->gwfmt, tdef); } const Type t = tdef->type; if (ret > 0) diff --git a/src/import/import_type.c b/src/import/import_type.c index f2ddca06..b304a710 100644 --- a/src/import/import_type.c +++ b/src/import/import_type.c @@ -32,11 +32,11 @@ ANN2(1, 2) Type gwi_mk_type(const Gwi gwi, const m_str name, const m_uint size, const m_str parent_name) { if (gwi->gwion->data->cdoc) { - lint_indent(gwi->lint); - lint_util(gwi->lint, "{+C}primitive{0} {+}%s{0}", name); - if (parent_name) lint_util(gwi->lint, " {+C}extends{0} {+}%s{0}", parent_name); - lint_sc(gwi->lint); - lint_nl(gwi->lint); + gwfmt_indent(gwi->gwfmt); + gwfmt_util(gwi->gwfmt, "{+C}primitive{0} {+}%s{0}", name); + if (parent_name) gwfmt_util(gwi->gwfmt, " {+C}extends{0} {+}%s{0}", parent_name); + gwfmt_sc(gwi->gwfmt); + gwfmt_nl(gwi->gwfmt); } CHECK_OO(gwi_str2sym(gwi, name)); const Type parent = get_parent(gwi, parent_name); diff --git a/src/import/import_udef.c b/src/import/import_udef.c index df1b9b2e..1da63f56 100644 --- a/src/import/import_udef.c +++ b/src/import/import_udef.c @@ -58,8 +58,8 @@ ANN static Type union_type(const Gwi gwi, const Union_Def udef) { // const M_Object o = new_object(gwi->gwion->mp, udef->value->type); // udef->value->d.ptr = (m_uint*)o; if (gwi->gwion->data->cdoc) { - lint_indent(gwi->lint); - lint_union_def(gwi->lint, udef); + gwfmt_indent(gwi->gwfmt); + gwfmt_union_def(gwi->gwfmt, udef); } return udef->type; } -- 2.43.0