diff options
Diffstat (limited to 'genplugin.awk')
-rw-r--r-- | genplugin.awk | 20 |
1 files changed, 20 insertions, 0 deletions
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 +} |