Eigenstate: myrddin-dev mailing list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/5] Mirror prefix-stripping from myrglue in cglue


---
 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


References:
[PATCH 0/5] mcbind patches, round 2"S. Gilles" <sgilles@xxxxxxx>