Many SPECX commands require further input in order to specify fully the action to take place. For example, in order to read a spectrum from a file it is necessary to specify which file, and the spectrum number. If no parameters are specified following a command name the program will prompt for them explicitly. Input is free-format, so that it is not necessary (for example) to include a decimal point in a floating-point value. Suppose you do want to read a spectrum. The dialogue might go like this:
>> read-spectrum
File number? 1
Scan number? 27
For many input parameters the program has sensible defaults,
which may be either constants or the last value input in response to this
prompt. The default, if it exists, is included in the prompt, enclosed in
square brackets []. The default is accepted if the response to the prompt is a
carriage return <CR>. If a default is not indicated, but a <CR>
is given as the response generally the value or option likely to do the least
damage is used, although in some instances a <CR> alone will bring a
request for clarification or a list of the options.
A single prompt may require either a single value, or an array, as input.
Multiple values may be separated by spaces, by a combination
of spaces and a single comma or by a single comma alone. Tabs are
replaced by blanks before processing, so that these are also acceptable
separators. If there are fewer values specified in the input line than are
required by the program the unspecified values
are set to 0 or 0.0 as necessary. The double delimiter
sequences ``,," or \\ (with or without additional spaces) instruct the
GENLIB routines to accept the default value for the omitted array
element or line of input respectively. Defaults may also optionally be
indicated by using the placeholder character
# in place of the individual items.
Some commands request a character string as input.
Problems could arise if the string includes a separator ( blank, ',', Tab,
'\'. `:' or ';'), or if it includes certain operators, such as the
minus sign (`-'). If the string does include any of these characters it
should be enclosed in apostrophes (i.e., single inverted commas, ' ). Within a
string an apostrophe can be represented by a double apostrophe, ''). Thus the response 'Rachael''s file' would be
interpreted as ``Rachael's file". Note that without the enclosing apostrophes
only the first part of the string (``Rachael'') would have been accepted.
Some commands require input of a list of variables, where
the list length is not determined in advance. In general such lists use the
# character as a prompt, and can be terminated by a
CTRL(Z) (the FORTRAN end-of-file character). The initial prompt
for the list will always specify the terminating character. CTRL(Z) terminates
input immediately, so it can't be used as part of a longer command line - the
two 2-character sequences ^z and ^Z are interpreted as CTRL(Z) by
the command interpreter.
Once you are used to the program and know the prompts for each command,
you will probably not want to wait for them all
to appear. It is possible to include the equivalent of several
lines of terminal input in one terminal line, by separating them by the
line terminating character '\'. If input is available in the command line
buffer the prompt will not appear. Thus, for the example of reading the
spectrum we could just type
>> read-spectrum \1\27
instead of going through the whole works as before.
The space character functions both as an item separator (for array
input) and as an end of line separator when the terminal is not asking
for the input of an array (i.e of multiple values in response to one prompt).
The use of space or \\ all sounds much more confusing than it really is
- the main reason for this complexity is the desire to allow input of only the
first few elements of a long array (thus the need for an end-of-array-input
character) and null responses in a long command line (thus
the need for an end-of-line character). In the simple case above we could
therefore also type:
>> read-spectrum 1 27
The first prompt (for the scalar value of file number) picks up the 1, while
the second (for the scalar value of the scan number) picks up the 27. But note
that if the first prompt had been for an array, as in the set-channels
command then the backslash separator would still have been
necessary to indicate the final array element being set (the first prompt in
SET-CHANNELS asks for a channel number or range, [n1,n2]). Thus:
>> set-channels 33 \ 2.5
In this case we wish only to set the single channel number 33, but in the
absence of the backslash it would think we were trying to set all channels
between 33 and 2.5!
The semicolon (;) is used to separate one command
from another when multiple commands are entered on a single command line.
SCL reads in complete commands (i.e. to the next ``;") in response
to the >> prompt, removes the actual command name, and places the
remainder of the command line in a separate buffer, which
the GENLIB routines then read from in response to subsequent
requests for terminal input within that command. If the buffer empties before
the end of the command the remaining queries are directed to the terminal
directly; if the buffer is not empty at the end of the command the remainder is
discarded.
Example:
>> multiply-spectrum 5.1; offset-spectrum 2; new-plot
Because the command line you want to type may be longer than 80 characters the continuation character `-' is provided. A line terminated with a `-' is just pushed into the command-line buffer and more input awaited. The maximum length of a command line is 256 characters, which should be more than adequate. So we could, if we wished, type
>> read-spectrum\1\- <CR> 27 <CR>instead of the single line above.