summaryrefslogtreecommitdiff
path: root/lib9p/core_gen/c.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib9p/core_gen/c.py')
-rw-r--r--lib9p/core_gen/c.py19
1 files changed, 5 insertions, 14 deletions
diff --git a/lib9p/core_gen/c.py b/lib9p/core_gen/c.py
index 393766b..60ceb70 100644
--- a/lib9p/core_gen/c.py
+++ b/lib9p/core_gen/c.py
@@ -7,7 +7,7 @@ import sys
import idl
-from . import c9util, c_format, c_marshal, c_unmarshal, c_validate, cutil
+from . import c9util, c_fmt_print, c_marshal, c_unmarshal, c_validate, cutil
# This strives to be "general-purpose" in that it just acts on the
# *.9p inputs; but (unfortunately?) there are a few special-cases in
@@ -35,15 +35,6 @@ def gen_c(versions: set[str], typs: list[idl.UserType]) -> str:
#include "core_tables.h"
#include "core_utf8.h"
"""
- # libmisc/obj.h vtables ####################################################
- ret += """
-/* libmisc/obj.h vtables ******************************************************/
-"""
- for typ in typs:
- ret += cutil.ifdef_push(1, c9util.ver_ifdef(typ.in_versions))
- ret += f"LO_IMPLEMENTATION_C(fmt_formatter, {c9util.typename(typ)}, {c9util.basename(typ)}, static);\n"
- ret += cutil.ifdef_pop(0)
-
# utilities ################################################################
ret += """
/* utilities ******************************************************************/
@@ -111,8 +102,8 @@ def gen_c(versions: set[str], typs: list[idl.UserType]) -> str:
# marshal_* ################################################################
ret += c_marshal.gen_c_marshal(versions, typs)
- # *_format #################################################################
- ret += c_format.gen_c_format(versions, typs)
+ # fmt_print_* ##############################################################
+ ret += c_fmt_print.gen_c_fmt_print(versions, typs)
# tables.h #################################################################
ret += """
@@ -156,8 +147,8 @@ def gen_c(versions: set[str], typs: list[idl.UserType]) -> str:
ret += "\n"
ret += cutil.macro(
f"#define _MSG(typ) [{c9util.Ident('TYP_')}##typ] = {{\n"
- f"\t\t.name = #typ,\n"
- f"\t\t.box_as_fmt_formatter = (_box_as_fmt_formatter_fn_t)lo_box_{c9util.ident('msg_')}##typ##_as_fmt_formatter,\n"
+ f"\t\t.name = #typ,\n"
+ f"\t\t.print = (_print_fn_t)fmt_print_##typ,\n"
f"\t}}\n"
)
ret += msg_table("_msg_tentry", "_table_msg", "_MSG", (0, 0x100, 1))