Submissions from Brad Castalia Planning & Systems IDAEIM Corp. Computer Imaging & Analysis 712 N. Seventh Ave. Tucson, Arizona 85705 602-628 7737 These are "miscellaneous" items used at IDAEIM, mostly in libraries. Each file has ample commenting on its purpose/use, but the pieces below are especially comment-worthy: TTP - Tape Transfer Program. This is a generic tape handling program modified from one taken from an old RSX SIG tape. ARG - Argument Processing. This collection has DOARGS as its root. It provides a standard means of processing the argument vector provided to main by the C language run-time system (or any string which is to be treated as command arguments). The user provides a module that defines a list of paired keywords-function names, and the definitions of the functions of course. For each string in an argument vector (i.e., array of string pointers) that matches a keyword (according to a default or user supplied matching function) the ARGS module will direct program control to the corresponding function. These "argument handlers" become objects allowing dynamic modification of any keyword, associated function, or swapping out of entire lists (which may be considered as command environments). An associated module - ARGVALUES - will filldata vectors (of any specified type) with values found in suffix qualifiers to an argument string. Syntax checking (corresponding to the specified data type) and error reporting handles are included. This module is called on by the user's argument handler functions. Associated with this category are several string manipulation functions that find common use. Whenever an argument string begins with the '@' character the remainder of the argument string is taken as the name of a file containing command lines (this provides another standard command line argument qualifier character like the '<' and '>' characters that automatically redirect stdin and stdout to the files named by the remainder of the string). This command line indirection capability is in another module. INDIRECT - Indirect command files. This module is provided the name of a file and a pointer to a function that processes an argument vector. The file is opened and command lines (string records) are read (into a dynamically allocated buffer) and parsed into an argument vector (by ARGPARSE) which is passed on to the specified function for processing. INDIRECT provides for recursion (obviously DOARGS is going to pass INDIRECT a pointer to itself) by putting the interrupted command file (if one is currently being processed) into a LIFO queue for resumption when the new indirect command file has finished. This allows for virtually unlimited nested indirect command files. This file queueing capability is in another module. QFILE - file processing LIFO queue. An open file is suspended and a named file is put in its place. The open file's location pointer and name are placed in a dynamically allocated LIFO queue and the named file is used to reopen the currently open file. The user maintains the queue pointer (several may be managed simultaneously). Queued files may be dequeued, in which the last file queued (if any) is used to reopen the currently open file specified and the file location pointer is set to its previous value (allowing input to resume from its suspended point). RECQUEUE - Record queue file management. A doubly linked queue of arbitrary (but uniform) size data records may be created or reaccessed in a named file. Records may be queued (FIFO), inserted (at any location), dequeued, or removed (from any location) with the file's memory pool being allocated and expanded as needed by the module. Since record queues are expected to be shared by multiple tasks (for job spooling, for example) the module only hoolds a file open while it needs it, and will wait and try again (with a default or globally set delay and retry count) if the file is busy. A standalone record queue manager is provided. KEYBRD - keyboard character trap. Sets up a trap for an unsolicited character (only one is buffered in this version) from the keyboard (a FORTRAN version refers to logical I/O unit 5, a C version to unit 1, and both default to TI:) without ingerfering with normal solicited input. The trapped character, if any, may be tested at a synchronous point in the program.