# HG changeset patch # User Rob Landley # Date 1392593493 21600 # Node ID 2a68f22aa286e03d680895b4e9148d2d3d3e9921 # Parent 4f080cdb2f6eee1cfeb871a9a7d35243ba4a441d Make CLEANUP transitions work, so multiple NEWTOY() can exist in the same file. Don't #undefine TT in the CLEANUP blocks of generated/flags.h, and #ifdef around the other TT definition. That way you can put a union at the start of your GLOBALS() with the arguments filled out by option parsing, and then have multiple main() functions with different argumetns and different FLAG_x macros, while sharing infrastructure that's not under lib. diff -r 4f080cdb2f6e -r 2a68f22aa286 scripts/mkflags.c --- a/scripts/mkflags.c Sun Feb 16 11:09:23 2014 -0600 +++ b/scripts/mkflags.c Sun Feb 16 17:31:33 2014 -0600 @@ -85,7 +85,7 @@ offlist = aflist = digest(allflags); - printf("#ifdef CLEANUP_%s\n#undef CLEANUP_%s\n#undef FOR_%s\n#undef TT\n", + printf("#ifdef CLEANUP_%s\n#undef CLEANUP_%s\n#undef FOR_%s\n", command, command, command); while (offlist) { @@ -99,7 +99,8 @@ } printf("#endif\n\n"); - printf("#ifdef FOR_%s\n#define TT this.%s\n", command, command); + printf("#ifdef FOR_%s\n#ifndef TT\n#define TT this.%s\n#endif\n", + command, command); while (aflist) { if (aflist->lopt) {