]> Nishi Git Mirror - gwion.git/commitdiff
:art: renaming
authorfennecdjay <fennecdjay@gmail.com>
Sun, 22 Jan 2023 07:46:16 +0000 (08:46 +0100)
committerfennecdjay <fennecdjay@gmail.com>
Sun, 22 Jan 2023 07:46:16 +0000 (08:46 +0100)
13 files changed:
fmt
include/gwi.h
src/import/import_cdef.c
src/import/import_enum.c
src/import/import_fdef.c
src/import/import_internals.c
src/import/import_item.c
src/import/import_oper.c
src/import/import_prim.c
src/import/import_special.c
src/import/import_tdef.c
src/import/import_type.c
src/import/import_udef.c

diff --git a/fmt b/fmt
index 91b3c4e658b095dc9784946bb2829e7bf5f28907..024e9cab0b87c5cbb105d757a82b5d18337c5e0d 160000 (submodule)
--- a/fmt
+++ b/fmt
@@ -1 +1 @@
-Subproject commit 91b3c4e658b095dc9784946bb2829e7bf5f28907
+Subproject commit 024e9cab0b87c5cbb105d757a82b5d18337c5e0d
index 95f45651c5b77f6331f8a72d860fb63d6b2588af..9493b1880c7508cfa7c115dd6c823ab54dbcadb2 100644 (file)
@@ -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;
 };
 
index 9c6aa44113eb1de4222806d10d2583233bfcf4e8..9473972edbb64fbc7de0595c12980eff70547b43 100644 (file)
@@ -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."))
index f2f87d5b42003bbdf99fc91350a3cd5de8e326d7..4461c8874e306ea11f58105fd786a448aaa9f25e 100644 (file)
@@ -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);
index 9e643b41b70e59635f3f513dddecf3fcec49a5d6..d12d20956306c33cbf8df09fd7e1cc5d664b6d09 100644 (file)
@@ -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*/) {
index 0346d8e6da4ffc7ccce4599553217beedeeb7331..8b670e7c4ace5d910167cfeb4aed940fa604074d 100644 (file)
@@ -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;
index fbf78b3e5534715701e6835b854c365404c1b938..dc18be6dc7c5155ad949a7d04df00e5a7792e2b2 100644 (file)
@@ -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);
index 57bff00293a84d63cd963449cf2a22461032989a..9d0be4f16d87319ce303fc1c1ef2ea6d64d4869d 100644 (file)
@@ -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);
index 7a99ff821903ffc51070c55ec6b01f19d168b56f..987f701da7057425c43b7f754e24964fa6781337 100644 (file)
@@ -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);
index 1927ac2a42ffd1b198d75b1145c109cb7102d98e..eacc236c6277fc1eefe333d57810450db43ead91 100644 (file)
@@ -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_));
index 22030732c0bfb9580bd17563c5159399fec34c90..336d79296a2322ef40d322dcae81b4cf70520e37 100644 (file)
@@ -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)
index f2ddca06090d01a29dd92454445d5670101a79e5..b304a710263885afc3440c530628d15951c73da2 100644 (file)
@@ -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);
index df1b9b2e502753fa02ed5d164ac8eee529f3bd53..1da63f56c3647f5442db9b2932397f8ad7c940e8 100644 (file)
@@ -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;
 }