[Toybox] Autogeneration of FLAG_x macros.
Rob Landley
rob at landley.net
Thu Apr 12 04:19:00 PDT 2012
So I got distracted last night and did this instead of finishing up ls.
Alas, getting make/make.sh to generate
#define OPTFLAG_echo_n (1<<0)
was easy enough, but getting any variant of
#define FLAG_ OPTFLAG_echo_
To actually _work_ turns out to be beyond me. I've tried a half-dozen
combinations and it's just not happy. (The weird part is if I #define a
macro and then use the macro in another definition, it doesn't expand.
I dunno why.)
So the bits of the attached patch that touch toys.h and toys/echo.c just
don't work. Can anybody come up with a way?
I've also pondered having the script generate FLAG_n macros inside an
#ifdef block in the header, but #ifdef what? If I "#define TOY echo"
how do I do an #if with a string compare in it? (I don't want to
#define using_echo or similar, I want to #define TT this.TOY to at least
not _increase_ the number of separate things you have to set up in a
command's header block. It'd be nice if I could temporarily #define
main TOY##_main to eliminate another instance too.)
Sigh. I'm going to have to use enums, aren't I?
Right, shelving this for the moment, back to finishing up the dirtree/ls
stuff. Almost there!
Rob
--
GNU/Linux isn't: Linux=GPLv2, GNU=GPLv3+, they can't share code.
Either it's "mere aggregation", or a license violation. Pick one.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: blah.patch
Type: text/x-patch
Size: 3509 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20120412/567bc69d/attachment-0006.bin>
More information about the Toybox
mailing list