At 04:13 PM 2/19/2006, Frank Brickle wrote:
Jim Lux wrote:

update.[ch]. The list of commands is in command-vocabulary.

I think we need a bit more help here, Frank. Is there a list of commands and their syntax, anywhere?

It's in the file "command-vocabulary."

Where is this file? Not in ..../source/dttsp ? Or, are you using file in the sense of a compiled table?



A bit of explanation of how do_update works might also be useful. What parses the commands into substrings?

See split.c. It works by close analogy with the "split" functions in perl and awk. The first thing that happens to an update string is for it to be broken into a list of tokens using split().

Do you mean splitfields.c?
Can you elaborate (or point to where you drew it form) on what split, splitonto, spliton do and how they fit together? I assume that newSplit,delSplit are constructors and destructors for SPLIT objects, and NF, Fptr, and F are "helper" functions that retrieve parts/properties of a SPLIT object, so that consumers of SPLITs don't need to know the structure?

thunk.c/thunk.h has no comments other than that it will be kicked up a notch with gperf, but it kind of looks like some sort of parser. Or, at least, it uses things called CTE (= Command Table Entry?) and CTB (=?)

"Thunk" is a term commonly used to refer to a class of functions of a fixed number of arguments, which can be invoked anonymously through pointers. For example the "cmp" argument to qsort() is a "thunk."

The routines in thunk.[ch] do nothing but (1) install a (string, function-pointer) pair into a table and (2) look up in a table the function pointer associated with a string, if any.

I only find one (public) routine in thunk.c: Thunk_lookup, and from the code in update.c, the table is static (defined using _cmd_tbl_entry). Is this correct?

Are the various command execution routines structured like c main progams with (int argc, char *argv[]) kind of parameters?

All of the update routines expect a pair of arguments (int n, char **p) exactly analogous to (argc, argv). A command string immediately gets split into constituent tokens and is passed in the split form to the update routine named in p[0]. The number of tokens is 'n'.

The substitution of (n, p) for (argc, argv) is also conventional, in order to distinguish it from the arguments to a main() function. A main() has an optional third argument, **envp, which points to the list of environment strings.
OK, then.

Thanks

Jim


Reply via email to