9.3.2 `sic_syntax.c'
The syntax of the commands in the shell I am writing is defined by a set
of syntax handlers which are loaded into `libsic' at startup. I
can get the C preprocessor to do most of the repetitive code for me, and
just fill in the function bodies:
This code writes the prototypes for the syntax handler functions, and
creates a table which associates each with one or more characters that
might occur in the input stream. The advantage of writing the code this
way is that when I want to add a new syntax handler later, it is a simple
matter of adding a new row to the syntax_functions macro, and
writing the function itself.
|