spec

Software for Diffraction

1.3.7. - Command Files



Macros are generally defined and maintained using the command file facility. In addition, sequences of experimental scans are often called up using command files. Command files are ASCII files of text, created with any of the UNIX text editors, and contain input just as it would be typed interactively. Command files are read line by line by spec when invoked with the functions dofile() or qdofile(). For example,
4.FOURC> dofile("spec.mac")
Opened command file `spec.mac' at level 1. FOURC.1> (Commands from file echoed as read ...)
The .1 extension to the prompt indicates the level of nesting. Command files can be nested to five levels.

The function qdofile() is identical to the function dofile() except that the commands are not echoed as they are read.
1.FOURC> qdofile("spec.mac")
Opened command file `spec.mac' at level 1. 2.FOURC>

If a file named spec.mac exists in your current directory, it is read as a command file each time you run spec. You can have private initialization code and macros in this file.

Two standard macros are defined to simplify reading command files. The macros do and qdo are normally used in place of the above functions. In addition to supplying the parentheses and quotation marks around the file name and recording the do command on the printer and in the data file, these macros also allow you to repeat the last command file when a dot is given as the argument:
1.FOURC> qdo .
qdo spec.mac Opened command file `spec.mac' at level 1. 2.FOURC>



Just as with keyboard input, comments can be included in a command file. Everything following a # up to a newline is ignored by spec.