From b2fada1dd19211d71e04557653d08e697134a6ce Mon Sep 17 00:00:00 2001 From: Erik K Date: Fri, 13 May 2022 17:24:26 +0000 Subject: initial commit --- genplugin.awk | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 genplugin.awk (limited to 'genplugin.awk') diff --git a/genplugin.awk b/genplugin.awk new file mode 100644 index 0000000..e6f99ac --- /dev/null +++ b/genplugin.awk @@ -0,0 +1,20 @@ +#!/usr/bin/awk -f + +BEGIN { + f = "plugins.h" + printf "#ifndef PLUGIN_H\n#define PLUGIN_H\n#include \"sm.h\"\n" >f +} + +# We read the list of plugins from stdin +{ + plugins[i++] = $0 + printf "extern Plugin %s;\n", $0 >f +} + +END { + printf "#define NPLUGINS %d\n#ifdef MAIN\nPlugin *plugins[%d] = {\n", NR, NR >f + for (i in plugins) { + printf "\t&%s,\n", plugins[i] >f + } + printf "};\n#endif /* MAIN */\n\n#endif /* ! PLUGIN_H */" >f +} -- cgit v1.2.3