[Toybox] Hello world.

Rob Landley rob at landley.net
Fri Oct 4 19:56:50 PDT 2013


Sorry for the radio silence and general stress, job hunting isn't fun  
for me. That's why I went looking for a long-term permanent position  
here in Austin this time, so hopefully I won't have to do it again for  
a while. I've still got a week or two while they grind through the  
background check so I'm slowly catching up on the past couple weeks'  
accumulated email.

_Mostly_ my goal for the next release is reviewing code that's  
currently in pending (and the remaining half-dozen files like  
toys/other/login.c that would have gone into pending if we'd had it  
yet). There's a giant backlog of stuff I need to go through, and  
writing or merging more stuff before dealing with that is starting to  
get overwhelming.

That said, you may have noticed the flag generation rewrite in C. This  
speeds up and simplifies the build a bit, but the main reason to do it  
was so I could start collating commands together more intelligently:  
"install.c" really wants to be part of mv/cp but it needs different  
command line options. The new config thing is doing CLEANUP_command  
blobs, so in theory I can go:

   #define CLEANUP_cp
   #define FOR_install
   #include "generated/flags.h"

In practice it's about 2/3 there. The new infrastructure does what the  
old one does and slightly more, but it's still not quite right for two  
reasons:

1) At the moment you have to do these in alphabetical order. The  
CLEANUP block has to come before the FOR block in flags.h or it'll  
#define TT twice than then #undefine it, and the command names are  
sorted, so the command implementations sharing a file have to be in  
alphabetical order. I can fix that by putting all the CLEANUP blocks at  
the start of the file and then all the FOR blocks at the end, I just  
haven't yet. (Two passes, complicates the code a bit. This is one of  
those "change the code rather than document the sharp edge" things...)

2) The header generation isn't taking file collating into account. The  
seddy bits that harvest NEWTOY() macros only grab ones that are enabled  
in the current config, so if I have CONFIG_CP on but CONFIG_INSTALL off  
and they're in the same file, I get "undefined FLAG_x" warnings from  
the install code because the CLEANUP block removes the cp stuff but  
there's no FOR_install block #defining all the disabled constants to 0.

I could fix this by having it output FOR blocks defining everything to  
0 for all disabled commands, or by having it use the "which C files do  
we feed to the compiler" logic (which the makefile already has) and  
extract all NEWTOY() blocks out of enabled source files. The second is  
slightly more complicated but reuses existing code and is more  
"correct" I think. (And should compile slightly faster.)

So what I checked in wasn't complete, but I'm working on it, and the  
motivation was to do cleanup on existing commands. (The install  
contribution I got is shelling out to cp on the command line, when it  
should just call cp_main()...)

Rob
 1380941810.0


More information about the Toybox mailing list