10.2.3. - Points to remember
The control characters
^D
or
^N
should be represented
in the command file by the combination of the printing characters
^
and
D
or
N
instead of the literal control characters.
However, the two-character sequences are only interpreted as control
characters if they appear as the first two characters on a line.
When using command files, remember that commands that toggle states or plotter functions (
eb
, vt
, etc.) should be used to
select a known state by giving an argument of
0
or
1
. Otherwise, the command will simply toggle the function to the opposite
state, which may not be the one desired.
The
ra
and
ro
commands need differing numbers of input
lines, depending on the prior input.
For instance, if you use
ra x
to set the range of only the
x-axis
and there is data
present, you will be asked if you wish to have the
y-axis
ranged
for the included points.
If there is no data present, the question
won't be asked.
Or, if you select user-defined tick spacing with
ro
, you will be prompted for the spacing specifications.
When the commands
wi
, pn
or
pk
are used without
arguments to specify the window size or pen position, the program
will not pause to let you set those values on the pen plotter.
To create a file that includes the argument-substitution feature, you will probably have to use an editor rather than the
mk
command,
since the characters
$1
, etc., will be treated literally by
the plot program.
If, for example, you enter
ty $1 $2 $3
at
the keyboard, the program will prompt you for plot types since it
won't recognize the arguments as valid numbers.
When the plot command
gd 7
is encountered during execution of
a command file, input reverts to the keyboard.
You may enter the appropriate
commands for this
get-data
mode from the keyboard, and input
will revert back to the command file when you exit the mode.
Likewise, when the subshell command,
u
, is encountered,
input again reverts to the keyboard and stays there until you exit
the subshell.
Ordinary user functions (but not necessarily fits) are unable to take input from command files, although there are provisions for passing information to the functions on the command line (see Chapter 11).
Typing a
^C
during execution of a command file or while making
a command file will terminate the command or make-file mode and the
PLOT->
prompt will reappear.
However, a
^C
during a type
5 (fitting) user function invoked from a command file will leave you
within the fit interactive program.
If the command file had turned
on quiet mode with the
zq
command, the
^C
will not only
leave you within the fit, but terminal echo mode will be off.
Type
ex
or
^D
to exit the fit and return to the plot program.
Echoing will be turned back on.
Certain errors also will bring back
the
PLOT->
prompt, such as trying to initialize a nonexistent
filter with
zi
. Within user functions, you also can abort a command file by invoking the macro
set_error()
(see Appendix E).
A command file can be
run when C-PLOT is first invoked by giving the
name of the file as an argument in the shell command line.
When invoking type 5 (fitting) user functions from a command file, you can arrange to have the fitting function read commands from
cmd_file
for a while and then have control returned to C-PLOT.
If
cmd_file
contains the lines
fn fitfunc.5 - ... exor (to use the same fitting function as last time)
fn - ... exthe commands between the
fn
and
ex
will be executed by
the fitting function.
Any commands following
ex
will be read
by C-PLOT.