diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-02 20:44:59 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-02 20:44:59 -0600 |
commit | ff88c4cc9bfdc91c3af390ab6a7588f5a8ade40a (patch) | |
tree | ae18e6d4576fa594be94e8278877fbdedfa1d4ba /lib9p/protogen/h.py | |
parent | 13b8cafb7e28784f037ecd24876c225ddcf48d76 (diff) | |
parent | 8cc87f8c1f25c9d3fec00561237891650a91b47a (diff) |
Diffstat (limited to 'lib9p/protogen/h.py')
-rw-r--r-- | lib9p/protogen/h.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib9p/protogen/h.py b/lib9p/protogen/h.py index 13c3f89..3b33419 100644 --- a/lib9p/protogen/h.py +++ b/lib9p/protogen/h.py @@ -165,6 +165,7 @@ def gen_h(versions: set[str], typs: list[idl.UserType]) -> str: #include <stdint.h> /* for uint{{n}}_t types */ +#include <libfmt/fmt.h> /* for fmt_formatter */ #include <libhw/generic/net.h> /* for struct iovec */ """ @@ -206,6 +207,7 @@ enum {c9util.ident('version')} {{ ret += cutil.ifdef_pop(0) ret += f"\t{c9util.ver_enum('NUM')},\n" ret += "};\n" + ret += f"LO_IMPLEMENTATION_H(fmt_formatter, enum {c9util.ident('version')}, {c9util.ident('version')});\n" ret += """ /* enum msg_type **************************************************************/ @@ -221,6 +223,7 @@ enum {c9util.ident('version')} {{ ret += f"\t{c9util.Ident(f'TYP_{msg.typname:<{namewidth}}')} = {msg.msgid},\n" ret += cutil.ifdef_pop(0) ret += "};\n" + ret += f"LO_IMPLEMENTATION_H(fmt_formatter, enum {c9util.ident('msg_type')}, {c9util.ident('msg_type')});\n" ret += """ /* payload types **************************************************************/ @@ -361,6 +364,7 @@ enum {c9util.ident('version')} {{ def gen_number(typ: idl.Number) -> str: ret = f"typedef {c9util.typename(typ.prim)} {c9util.typename(typ)};\n" + ret += f"LO_IMPLEMENTATION_H(fmt_formatter, {c9util.typename(typ)}, {c9util.basename(typ)});\n" def lookup_sym(sym: str) -> str: assert False @@ -379,6 +383,7 @@ def gen_number(typ: idl.Number) -> str: def gen_bitfield(typ: idl.Bitfield) -> str: ret = f"typedef {c9util.typename(typ.prim)} {c9util.typename(typ)};\n" + ret += f"LO_IMPLEMENTATION_H(fmt_formatter, {c9util.typename(typ)}, {c9util.basename(typ)});\n" def lookup_sym(sym: str) -> str: assert False @@ -526,4 +531,5 @@ def gen_struct(typ: idl.Struct) -> str: # and idl.Message ret += f"\t{c9util.typename(member.typ, member):<{typewidth}} {'*' if member.cnt else ' '}{member.membname};\n" ret += cutil.ifdef_pop(1) ret += "};\n" + ret += f"LO_IMPLEMENTATION_H(fmt_formatter, {c9util.typename(typ)}, {c9util.basename(typ)});\n" return ret |