ref: c97272f4042b1fd18e6fa9769ba2bba7d76fb07e
parent: b578f6fc6c2d7b99c42e6477e0fe8a86a0666e03
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Fri Jan 24 13:28:09 EST 2025
fix plan 9 build
--- a/builtins2h.sh
+++ b/builtins2h.sh
@@ -1,3 +1,7 @@
#!/bin/sh
set -e
-sed -nE 's/^BUILTIN[_]?(\(".*)/BUILTIN_FN\1/gp' $* | sort
+awk -F '[()]' '\
+ /^fl_.*fn/ {attr=$1; next} \
+ /^_Noreturn/ {attr=$1; next} \
+ /^BUILTIN[_]?/ {printf "BUILTIN_FN(%s, %s)\n", $2, attr} \
+ {attr=""}' $* | sort
--- a/flisp.c
+++ b/flisp.c
@@ -1277,7 +1277,7 @@
}
static const builtinspec_t builtin_fns[] = {
-#define BUILTIN_FN(l, c){l, fn_builtin_##c},
+#define BUILTIN_FN(l, c, attr){l, (builtin_t)fn_builtin_##c},
#include "builtin_fns.h"
#undef BUILTIN_FN
};
--- a/flisp.h
+++ b/flisp.h
@@ -326,7 +326,7 @@
#define BUILTIN(lname, cname) \
value_t fn_builtin_##cname(value_t *args, uint32_t nargs)
-#define BUILTIN_FN(l, c) extern BUILTIN(l, c);
+#define BUILTIN_FN(l, c, attr) attr BUILTIN(l, c);
#include "builtin_fns.h"
#undef BUILTIN_FN
--- a/mkfile
+++ b/mkfile
@@ -54,8 +54,12 @@
</sys/src/cmd/mkone
plan9/builtin_fns.h:D:
- sed -n 's/^BUILTIN[_]?(\(".*)/BUILTIN_FN\1/gp' \
- `{ls `{echo $OFILES | sed 's/\.'$O'/.c/g'} >[2]/dev/null} | sort >$target
+ awk -F '[()]' '\
+ /^fl_.*fn/ {attr=$1; next} \
+ /^_Noreturn/ {attr=$1; next} \
+ /^BUILTIN[_]?/ {printf "BUILTIN_FN(%s, %s)\n", $2, attr} \
+ {attr=""}' \
+ `{ls `{echo $OFILES | sed 's/\.'$O'/.c/g'} >[2]/dev/null} | sort >$target
cvalues.$O: fl_arith_any.inc
flisp.$O: maxstack.inc vm.inc