diff options
Diffstat (limited to 'lib9p/protogen/c.py')
-rw-r--r-- | lib9p/protogen/c.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib9p/protogen/c.py b/lib9p/protogen/c.py index 0cc5815..5e67939 100644 --- a/lib9p/protogen/c.py +++ b/lib9p/protogen/c.py @@ -76,12 +76,12 @@ def gen_c(versions: set[str], typs: list[idl.UserType]) -> str: ret += "#endif\n" ret += "\n" ret += "/**\n" - ret += f" * is_ver(ctx, ver) is essentially `(ctx->ctx->version == {c9util.Ident('VER_')}##ver)`,\n" - ret += f" * but compiles correctly (to `false`) even if `{c9util.Ident('VER_')}##ver` isn't defined\n" + ret += f" * is_ver(ctx, ver) is essentially `(ctx->version == {c9util.Ident('VER_')}##ver)`, but\n" + ret += f" * compiles correctly (to `false`) even if `{c9util.Ident('VER_')}##ver` isn't defined\n" ret += " * (because `!CONFIG_9P_ENABLE_##ver`). This is useful when `||`ing\n" ret += " * several version checks together.\n" ret += " */\n" - ret += "#define is_ver(CTX, ver) _is_ver_##ver(CTX->ctx->version)\n" + ret += "#define is_ver(ctx, ver) _is_ver_##ver((ctx)->version)\n" # strings ################################################################## ret += f""" @@ -185,14 +185,14 @@ const char *const {c9util.ident('_table_ver_name')}[{c9util.ver_enum('NUM')}] = ) ret += f""" -LM_FLATTEN ssize_t {c9util.ident('_stat_validate')}(struct _validate_ctx *ctx, uint32_t *ret_net_size) {{ -\treturn validate_stat(ctx, ret_net_size); +LM_FLATTEN ssize_t {c9util.ident('_stat_validate')}(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes, uint32_t *ret_net_size) {{ +\treturn validate_stat(ctx, net_size, net_bytes, ret_net_size); }} -LM_FLATTEN void {c9util.ident('_stat_unmarshal')}(struct _unmarshal_ctx *ctx, struct {c9util.ident('stat')} *out) {{ -\tunmarshal_stat(ctx, out); +LM_FLATTEN void {c9util.ident('_stat_unmarshal')}(struct lib9p_ctx *ctx, uint8_t *net_bytes, void *out) {{ +\tunmarshal_stat(ctx, net_bytes, out); }} -LM_FLATTEN bool {c9util.ident('_stat_marshal')}(struct _marshal_ctx *ctx, struct {c9util.ident('stat')} *val) {{ -\treturn marshal_stat(ctx, val); +LM_FLATTEN bool {c9util.ident('_stat_marshal')}(struct lib9p_ctx *ctx, struct {c9util.ident('stat')} *val, struct _marshal_ret *ret) {{ +\treturn marshal_stat(ctx, val, ret); }} """ |