comparison toys.h @ 1634:5fac2769a159 draft

Redo option parsing infrastructure so #define FORCE_FLAGS can unzero flag macros for a disabled command (needed when multiple commands share infrastructure with a common set of flags). This means the flag space is no longer packed, but leaves gaps where the zeroes go. (Actual flag bit positions are the same for all configs.) Since the option parsing needs to know where the holes are, the OPTSTR values are now generated as part of flags.h with ascii 1 values for the disabled values. (So generated/oldflags.h went away.) This also means that the option string argument for OLDTOY() went away, it now uses the same arguments as the NEWTOY() it references.
author Rob Landley <rob@landley.net>
date Wed, 31 Dec 2014 21:30:59 -0600
parents aafd2f28245a
children 988f3d13b925
comparison
equal deleted inserted replaced
1633:556d8cbfeb08 1634:5fac2769a159
71 #include "toys/e2fs.h" 71 #include "toys/e2fs.h"
72 72
73 // Get list of function prototypes for all enabled command_main() functions. 73 // Get list of function prototypes for all enabled command_main() functions.
74 74
75 #define NEWTOY(name, opts, flags) void name##_main(void); 75 #define NEWTOY(name, opts, flags) void name##_main(void);
76 #define OLDTOY(name, oldname, opts, flags) void oldname##_main(void); 76 #define OLDTOY(name, oldname, flags) void oldname##_main(void);
77 #include "generated/newtoys.h" 77 #include "generated/newtoys.h"
78 #include "generated/oldtoys.h"
79 #include "generated/flags.h" 78 #include "generated/flags.h"
80 #include "generated/globals.h" 79 #include "generated/globals.h"
81 80
82 // These live in main.c 81 // These live in main.c
83 82