[PATCH 2/5] Mirror prefix-stripping from myrglue in cglue
[Thread Prev] | [Thread Next]
- Subject: [PATCH 2/5] Mirror prefix-stripping from myrglue in cglue
- From: "S. Gilles" <sgilles@xxxxxxx>
- Reply-to: myrddin-dev@xxxxxxxxxxxxxx
- Date: Sun, 10 May 2020 20:38:04 -0400
- To: "myrddin-dev" <myrddin-dev@xxxxxxxxxxxxxx>
- Cc: "S. Gilles" <sgilles@xxxxxxx>
---
cglue.myr | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/cglue.myr b/cglue.myr
index c25f561..fe9a512 100644
--- a/cglue.myr
+++ b/cglue.myr
@@ -24,7 +24,7 @@ const emitcglue = {f, ctx
bio.put(f, "\n")
for (name, fn) : ctx.funcs
- n = std.bfmt(namebuf[:], "{}${}", ctx.bindpkg, name)
+ n = std.bfmt(namebuf[:], "{}${}", ctx.bindpkg, pfxstrip(ctx, name))
d = declare(dclbuf[:], n, &`Tyfunc fn, 0)
bio.put(f, "{}\n", d)
bio.put(f, "{{\n")
@@ -33,6 +33,16 @@ const emitcglue = {f, ctx
;;
}
+const pfxstrip = {ctx, name
+ for p : ctx.strippfx
+ if std.hasprefix(name, p)
+ name = name[p.len:]
+ break
+ ;;
+ ;;
+ -> name
+}
+
const forwardcall = {f, name, params
var narg
var sep
--
2.26.2
| [PATCH 0/5] mcbind patches, round 2 | "S. Gilles" <sgilles@xxxxxxx> |
- Prev by Date: [PATCH 1/5] Re-use typename sanitiziation to handle identifiers
- Next by Date: [PATCH 3/5] Wrap function argument type name emissions in getname
- Previous by thread: [PATCH 1/5] Re-use typename sanitiziation to handle identifiers
- Next by thread: [PATCH 3/5] Wrap function argument type name emissions in getname
- Index(es):