Next: , Previous: Parameter Mode Interface, Up: Parameter Mode Interface


2.6.1 Input Data Structure

The data structure that is used as the argument to the parameter mode application incorporates all the information about the command line and the environment variables. It is in the form of a triple ((files,options),environs). The fields have these interpretations.

files
is a list of quadruples ((date,path),(preamble,contents)), with one quadruple for each input file named on the command line (but not the virtual code file or the avram executable). The list will be in the same order as the filenames on the command line, and is not affected by options interspersed with them. The fields in each item have the following interpretations.
date
is the time stamp of the file in as a character string in the usual Unix format, for example, Fri Jan 19 14:34:44 GMT 2001. If the file corresponds to standard input, the current system time and date are used.
path
is the full path of the file, expressed as a list of strings. If the file corresponds to standard input, the list is empty. Otherwise, the first string in the list is the file name. The next is the name of the file's parent directory, if any. The next is the parent of the parent, and so on. The root directory is indicated by the empty string, so that any path ending with the empty string is an absolute path, while any path ending with a non-empty string is relative to the current working directory. Path separators (i.e., slashes) are omitted.
preamble
In the case of a text file, or any file not conforming to the format in File Format, this field is nil. Otherwise, this field contains the preamble of the file expressed as a list of strings, or contains just the empty string if the file has no preamble. Any leading hashes in the preamble of the file are stripped.
contents
In the case of a text file (as indicated by the preamble field), this field will contain a list of character strings, with each line of the file contained in a character string. Otherwise, it can contain data in any format, which are obtained by converting the data section of the file to a tree.

options
is a list of quadruples of the form ((position,longform),(keyword,params)) with one quadruple for each option appearing on the command line after the name of the virtual code file.
position
is a natural number indicating the position of the option on the command line. The position numbers of all the options will form an ascending sequence, but not necessarily consecutive nor starting with zero. The missing numbers in the sequence will correspond to the positions of the file names on the command line, allowing their positions to be inferred by applications for which the position matters.
longform
is a boolean value which is true if the option starts with two or more dashes but false otherwise.
keyword
is the key word of the option expressed as a character string. For example in the case of a command line option --foo=bar,baz, the keyword is foo. Leading dashes are stripped.
params
is a list of character strings identifying the parameters for the command line option in question. In the case of an option of the form --foo=bar,baz, the first character string in the list will be bar and the next will be baz. The same applies if the option is written --foo bar,baz or --foo =bar,baz. If there are no parameters associated with the option, the list is empty.

environs
is a list of pairs of character strings, with one pair in the list for each environment variable. The identifier is the left string in the pair, and the value is the right. For example, if the environment contains the definition OSTYPE=linux-gnu, there will be a pair in the list whose left side is the string OSTYPE and whose right side is the string linux-gnu.