- Introduction
- ENVironmental variables
- CIO variables
- CIO program flow
- commands LOAD, LGO, RUN, and CALL
- LGO command
- CALL command
- LOad command
- RUN command
- loops and conditional statements
- DO command
- IF command
- REPeat command
- WHile command
- ENDDo command
- ENDIF command
- ENDRep command
- ENDWhile command
- CIO program: exit, continue, debugging
- ERROR command
- EXit command
- Continue command
- PAUSE command
- STEPp command
- TRace command
- CIO array manipulations
- CIO arithmetic tools
- CIO graphics
- CIO system sommands
- CIO console input/output
- CIO file input/output
- CIO spectra
Introduction
Last update: 10 December 1998CIO is the command language used in interactive programs such as control, mctl, pctl, and others The CIO syntax is described in CIO comand language.
This is the on-line help file, giving short descriptions of each of the CIO commands.
For further details:
- try out program control - in program control, give command HELP <command> - man 1 cio - man 1 showmenu - man 1 svc - man 5 cio - man 3 cio
HELP command
cio on-line helphelp * , or ( help ; ), give a list of available commands.
help command gives a short description of the command.
syntax used in these descriptions:
<text> : text enclosed by < > indicates the type of an argument, and should be replaced by an actual argument. A B C : capital letters indicate reference to a variable, usually an array. ... : three dots indicate that the preceding type of argument may be repeated. (<value[i]>, i:= <first> to <last>) : Indicates a set of elements <value[i]>, with i ranging from <first> to <last>Example:
if <condition> ; <statement> ... ; endif means that several statements may be present between the commands IF and ENDIF.Help on expressions is given by command 'help kalk'
Further help may be found in the documents
EDITING
cio offers the facility of command line editing. The editing functions are similar to those of the emacs editor and the tcsh. Some useful functions are:left - right arrows: move left/right over the line
up - down arrows: get next/previous command line from history list
CTRL-A: goto the beginning of the line.
CTRL-E: goto the end of line.
CTRL-K: delete to end of line.
notes
- see also SUBSTitution
- for a complete overview of the command line editing possibilities, see the manpages of the readline library, e.g. man readline.
- Command line editing is not implemented in the OS-9 version of CIO
SUBSTitution
In an interactive session, (t)csh style history substitution may be applied. In combination with the 'command line editor' (see EDITING) the history can thus be used to recall, modify, and execute previous commands.!! refers to the previous command.
!-N refers to the command N lines back. !<string> refers to the most recent command starting with <string>.
for details see 'info history', best viewed by xemacsnotes
- see also EDITING
- History substitution is not implemented in the OS-9 version of CIO
VERSION command
versionShow information on the version of the current program
STATUS command
statusDisplay the values of some parameters.
ENVironmental variables
XSCALE AND GEPSCALEThe size of the graphics display window may be varied by the environmental variable GEPSCALE. The size of the menu window can be varied by the environmental variable XSCALE. Defaults for both are 0.5. To increase this size give Unix commands:
setenv GEPSCALE 0.7 setenv XSCALE 0.7These commands should be given before starting mctl or other cio application, and are best included in your '.cshrc' file.
Other environmental variables used in CIO:
TMPDIR directory for temporary files PRO directory for CIO scripts ("pro" files) LIST program called by CIO command more EDITOR program called by CIO command edit SHELL shell forked by CIO command shellenvironmental variables for the menu subprogram
SHOWMENU program called by CIO command menu MENUDIR general CIO menu directory CONTROLMENUDIR program-specific menu directories MCTLMENUDIR " GAUSSMENUDIR " example: setenv MCTLMENUDIR ~/menu/MCTL:/usr/local/menu/MCTLEnvironmental variables, prefixed with the symbol $, may be used in general when a string is expected.
CIO VARIABLES
defining CIO variables: char, int, float, double ...
ALIAS command
alias [<level>] <varname> <text> alias [<level>] <varname>[<size>] <text>Declare a variable, or an array of variables, of type char. <level> is an optional argument, with possible values -p,-g,-l, which defines the variable as permanent, global, or local. <text> is a 'raw' line of text: special symbols are not interpreted as such. Difference with command char: <varname> is separated from <text> by the first character ` ' (space). Further spaces, if any, are considered to be part of <text>!
CHAR command
char [<level>] <varname>char [<level>] <varname>=<text> char [<level>] <varname>[<size>] char [<level>] <varname>[<size>]=<text> Declare a variable, or an array of variables, of type char. <text> is a 'raw' line of text: special symbols are not interpreted as such. <level> is an optional argument, with possible values -p,-g,-l, which defines the variable as permanent, global, or local. Difference with command alias: <varname> is separated from <text> by the first character `='. Space characters (` ') before this `=' are ignored. Spaces after the `=', if any, are considered to be part of <text>!
DOUBLE command
double [<level>] <declarator> ...<declarator> may be of the forms: <varname> <varname>=<expression> <varname>[<size>] Declare variable(s) and/or array(s) of variables of type double. <level> is an optional argument, with possible values -p,-g,-l, which defines the variable as permanent, global, or local.
FLOAT command
float [<level>] <declarator> ...<declarator> may be of the forms: <varname> <varname>=<expression> <varname>[<size>] Declare variable(s) and/or array(s) of variables of type float. <level> is an optional argument, with possible values -p,-g,-l, which defines the variable as permanent, global, or local.
INT command
int [<level>] <declarator> ...<declarator> may be of the forms: <varname> <varname>=<expression> <varname>[<size>] Declare variable(s) and/or array(s) of variables of type int. <level> is an optional argument, with possible values -p,-g,-l, which defines the variable as permanent, global, or local.
OVAR command
ovar [<level>] <new_name> <original_name> <offset> <nelements>Define a variable of type `o' (overlap). The new variable <new_name> is a subset of an existing variable <original_name>. It starts at element <offset> of the original variable, and has a length of <nelements>. The original variable should be large enough to accommodate the new one. <level> is an optional argument, with possible values -p,-g,-l, which defines the variable as permanent, global, or local. ----------------------------------------------------------------- Example: float -g sp[4k] ovar -g a1 sp 0k 2k ovar -g a2 sp 2k 2k ovar -g r1 a1 1k 1k ovar -g r2 a2 1k 1k Now a1 and a2 are subarrays of length 2k, of array sp. r1 is a subarray of a1, and r2 a subarray of a2. r2[j] coincides with a2[j+1k], and with sp[j+3k].
VAR command
The command VAR serves to define variables of type `v', ( i.e. lists of variables), as well as to set values for members of such arrays.var def [<level>] <varlist_declarator> ...
<varlist_declarator> may be of the forms: <varlist_name> <varlist_name>[<size>] <level> is an optional argument, with possible values -p,-g,-l, which defines the variable as permanent, global, or local.var set <varlist_name> (<name[i]>,i=0 to size-1)
var mset <varlist_name> <first> <last> (<name[i]>,i=first to last).
In the first form (var set) all names of the varlist are set. The second form sets or modifies a restricted number of names. The actual variable corresponding to <name[i]> may be declared before or after 'var set' or 'var mset' is given.var list <varlist_name>.
Gives a survey of the current contents of a varlist.var keep <varlist_name>.
Make the specified varlist a global variable.var wipe <varlist_name>.
Delete a varlist. Var keep <varlist_name> and var wipe <varlist_name> may be used to prevent ambiguities between the varlist itself, or its members. Strictly speaking, these two commands are only needed for varlists of size 1, where this ambiguity occurs. ---------------------------------------------------------------------- Variables of this type may be useful in CIO programs. example: float sp1[1k], sp2[1k]; var def sp[2]; var set sp sp1,sp2; ... dis sp[j] 0 255; As shown in the example, the construct <varlist_name>[<subscript>] may be used to indicate the members of the list. In the example sp[0] is equivalent with sp1; sp[0][j] is equivalent with sp1[j]. To address the sole member of a varlist of size 1, [<subscript>] should be omitted. example: float sp1[1k]; var def from; var set from sp1; Now from[j] is equivalent to sp1[j]. Do not use from[0][j] !
DEFsp command
defsp [<options>] <spectrum_declarator> ...<spectrum_declarator> may be of the forms: <spectrum_name> <size> <spectrum_name>[<size>] Define a spectrum, or several spectra. A spectrum is a structure containing a numerical array of length <size>, a label record, and some other information. When a spectrum is defined, the associated numerical array is automatically declared as a p e r m a n e n t cio variable. Thus, a spectrum, defined in a sub-program, remains defined when this sub-program is left. A spectrum may be deleted from memory by the command UNDEFsp. Valid options are -e -i, or a combination of these, e.g. -ie. If present, options should be given before other arguments. -e Indicates that the associated numerical array exists already. If it doesn't, or has the wrong type or length, an error occurs. If the array exists it is promoted to a permanent variable. -i The numerical array should be of type int. The default type is float. Spectra of type int should only be used for special purposes, such as data acquisition.
deleting CIO variables
WIPE command
wipe <varname> ... wipe -l <varname> ... wipe -g <varname> ... wipe -P <varname> ...The command WIPE may be used to delete variables: If option -l is given, (default) only local variables can be deleted. If option -g is given, also deletion of global variables is allowed. If option -P is given, even 'permanent' variables may be deleted.Do not use WIPE to delete CIO spectra, see UNDefsp command.
UNDefsp command
undefsp <spectrum_name> ...Delete a spectrum, or several spectra.see also WIPE command.
KEep command
keep <varname> ...keep -g <varname> ...
keep -p <varname> ...
Option -g (default): make <varname> a global variable. Option -p : make <varname> a permanent variable.The command KEEP is obsolete and will be removed in the future! The function of KEEP is taken over by the <level> argument of declaration commands (int, double, alias, var, ovar ...)
LIst command
listDisplays a list of all currently defined cio variables.
CIO program flow
commands LOAD, LGO, RUN, and CALL.
LGO command
All of these commands are variations on the same theme: To read a script from a file and execute it.LGO <filename> (load and go) reads and stores the script, and starts execution right away. LOAD <filename> reads the script and stores it in a CIO variable, but does not execute it yet. RUN <subfile-name> loads and starts a subfile. CALL <CIO-variable-name> starts a CIO program, previously loaded by LOAD or LGO. If the variable is not found, look for a subfile of the same name in the last file accessed by LOAD, LGO, or RUN.The main difference between these commands is the type of argument expected: A filename (load and lgo), a subfile (run), or a variable (call).
The choice between LGO and RUN is a matter of taste and convenience.
Using LGO one typically has a number of different files for different tasks. After the file has been read, by LGO or LOAD, its name can be used as a normal command.
Using RUN it is convenient to group different tasks into one larger file. Each task may be invoked with 'run <subfile>', thus the difference between a normal command and a script is larger.
OPTIONS The default behaviour may be modified by extra flags and parameters. Each option must be a
separate(!)
input argument,
starting with a `-' character. Possibilities are:
LOAD <filename> [-s <subfile>] [-v <varname>] [-w|-c|-u] [-k] LGO <filename> [-s <subfile>] [-v <varname>] [-w|-c|-u] [-k] RUN [<subfile>] [-f <filename>] [-v <varname>] [-w|-c|-u] [-k] CALL <varname> [-s <subfile>] [-f <filename>] [-w|-c|-u] [-k] LOAD -L <filename> LGO -L <filename> RUN -L [-f <filename>] LOAD -r <filename> -f <filename> Search in the current directory and if this fails in directories: $HOME/pro $GROUP/pro $PRO for a file of name <filename>, or <filename>.pro. When the file is found, create a variable of type char, and, read and store the file in this array. -s <subfile> read a specified subfile, instead of the whole file, into an array of type char. In the text a subfile starts after a header line ####<subfile> and is terminated by the next line beginning with ####. -v <varname> Specify a name for the variable. If not given the name will be the same as <filename> or <subfile>, except for command RUN. -w, -c, -u What to do if a variable of the same name exists already. -w The old variable is first deleted. Use with caution, do not use this to replace a cio program that has a return pending!!! -c The old variable is kept and an error message is given. -u The old variable is used. -k Promote the cio variable to a permanent variable. -l The file name and all its subfile labels are listed. No file is loaded or executed. -r:The file name is registered as the default file for subsequent RUN commands. No file is loaded or executed.FURTHER DETAILS.
A cio program loaded into variable <varname> can always be (re)started by typing <varname> as a command.
LGO lgo <filename>. Load a cio program from disk, and start that program. Default for varname is the filename (minus directories and extension) Default behaviour when varname clashes is to replace the contents of the variable. If option -w is given this replacement is forced, even if the variable was declared at a higher context level. LOAD load <filename>. Load an array of type char, to be interpreted as a cio program, but don't start it yet. Defaults as for LGO. load -r <filename>. This option checks if the file can be found, and registers it as the default file for subsequent RUN commands. CALL call <varname>. Default for <subfile> is <varname>. Default for <filename> is the last file used by LGO or LOAD. Default behaviour when varname clashes is option -u. Thus if the variable exists already, it is not reloaded, otherwise, read the specified subfile, into an array of type char. Interpret this array as a cio program, and start that program. "CALL" is equivalent to "LGO -u -s". RUN run <subfile>. Default for <varname> is Run, or RunA, RunB ... Default for <filename> is the file attached to LU 15, or the last file specified via run -f . Default for <subfile> is the whole file. RUN rereads the script for every invocation. The command LOAD -r <filename> may be used to open a new file without running it yet.
CALL command
call <varname> [-s <subfile>] [-f <filename>] [-w|-c|-u] [-k]The filename is usually given by a previous command LOAD, LGO or RUN, but may also be specified by the -f option.For details, see LGO command
LOad command
load <filename> [-s <subfile>] [-v <varname>] [-w|-c|-u] [-k]load -l <filename>
load -r <filename>
Search in the current directory and if this fails in the directories:
$HOME/pro $GROUP/pro $PROfor a file of name <filename>, or <filename>.pro.
When the file is found, create a variable of type char, and, read and store the file in this array, except for option -L. In contrast to LGO the filed is not executed right away, but can be started later on by typing the name of the variable.
The filename becomes the default in subsequent CALL commands.
see LGO command for an explanation of the options.
RUN command
run [<subfile>] [-f <filename>] [-v <varname>] [-w|-c|-u] [-k]run -L
The subfile is read from a file, and executed as a cio program. If no subfile is specified, the whole file is read and executed. The (sub)file is stored in an cio variable, with default name Run.
This name may be overruled by the option -v <varname>.
If a filename is specified (option -f) that file becomes the default in subsequent RUN and CALL commands. The default RUN file may also be specified by a command LOAD -r, or, by opening LU 15.
If the option -L or -l (list) is given, the file name and all its subfile labels are listed. No file is loaded or executed.
A subfile starts after a header line ####<subfile> and is terminated by the next line beginning with ####.
see LGO command for further details.
loops and conditional statements
DO command
do <index> <first> <last>; [<statement> ...]; enddoExecute the statements between DO and ENDDo repeatedly, with values for <index> of <first>, <first>+1, ... <last>. <index> should be a cio variable of type int. If <last> is smaller then <first> the statements are skipped.
In interactive mode: DO and ENDDo must be on the same line. In cio program: DO and ENDDo must be in the same module.
IF command
if <condition> ; <statement> ... ; endifStatements between commands IF and ENDIF are only executed if <condition> is non-zero, and skipped when <condition> is zero.
In interactive mode: IF and ENDIF must be on the same line.
In a cio program: IF and ENDIF must be in the same module.
<condition> can be:
- an integer expression
-
Any non-zero result is 'true'.
- a test on the existence or the type of a variable
- of the form
<option> <variable_name>
where <option> is one of the set:{ =exist =d =f =i =c =v !exist !d !f !i !c !v }
whered f i c and v
indicate CIO variable types.
The test on type `v' works only for variables of type `v' with a size larger than 1, see VAR command.
- comparison of two strings:
-
=string <string1> <string2> !string <string1> <string2>
The <string>'s may be a literal string, a cio variable of type char, or an environmental variable.
example:if =s $HOST os91;
Keywords 'exist' and 'string' may be abbreviated, as in the example.
REPeat command
repeat <count>; [<statement> ...]; endrepExecute the statements between REPeat and ENDRep <count> times. If count is absent it is set to a very large number. In interactive mode: REPeat and ENDRep must be on the same line. In cio program: REPeat and ENDRep must be in the same module.
WHile command
while <condition> ; <statement> ... ; endwhileStatements between commands WHile and ENDWhile are repeatedly executed if, and as long as, <condition> is non-zero. In interactive mode: WHile and ENDWhile must be on the same line. In cio program: WHile and ENDWhile must be in the same module.For a description of <condition>, see command IF command.
ENDDo command
see DO commandENDIF command
see IF commandENDRep command
see REPeat commandENDWhile command
see WHile commandCIO program: exit, continue, debugging
ERROR command
error <text>Give an error message and exit cio program.
EXit command
exitLeave a cio program. Return to the calling program. example: if i > 99; exit; endif The command may not be used to exit a 'while', 'do', or 'repeat' loop.
Continue command
continueContinue cio program, that was interrupted, by '^C' or because STEP is enabled.
PAUSE command
pausePause command input. For use in CIO programs. The program is suspended until a single character is typed in. If the character is a q the CIO program exits.
STEPp command
step yesstep no
The commands 'step;' or 'step yes' enable step-wise execution of cio programs. After every line the cio program is interrupted. It may subsequently be continued by the command 'continue'. Command 'step no' disables the STEP feature. Note: In program GAUSS, use 'stepp' to distinguish from gauss command 'step'.
TRace command
trace yestrace no
The commands 'trace;' or 'trace yes' enable tracing of cio programs. When TRACE is enabled, every line of the cio program is echoed to the terminal before it is executed. Command 'trace no' disables the trace feature.
CIO array manipulationa
ADD command
add A B CC[i]:= A[i] + B[i] Add numerical arrays A and B, result in C.
ADDF command
addf A B C <factor>C[i]:= A[i] + (B[i] * factor) Add numerical array A and (B * factor), result in C.
DIFF command
diff A B <nsmooth>B[i]:= (derivative of A)[i] Calculate the 'derivative' of array A, result in B. The derivative is approximated by convolution with a differentiating filter function. The width of this filter, and hence the degree of smoothing, is determined by the value of <nsmooth>.
DIVS command
divs A B CC[i]:= A[i] / B[i] Divide each element of array A by corresponding element of B, result in C
INC command
inc A <first> <last> <expression>A[i]+= <expression>, i:= <first> to <last> Increment the elements <first> to <last> of numerical array A by the resulting value of the <expression>.
INPut command
input A <first> <last> (<value[i]>, i:= <first> to <last>)Read a value for each of the elements of the specified region of a numerical array A.input A <text>
Read a line of text into an array of type char. Special symbols such as `$', or a leading `?', are recognized.
INTEG command
integ A BB[i]:= sum (A[j], j:=0,i) Calculate the 'integral' of array A, result in B.
MOve command
move A B <offset_A> <offset_B> <length>Copy a selective region from array A to array B, with optional shift. The action can be represented as B[n+i]:= A[m+i], i:= 0 to <length> -1 where m = <offset_A> and n = <offset_B> Defaults: <offset> = 0, <length> is maximally possible length. Restriction: A and B must be of the same type.
MULR command
mulr A <first> <last> <factor>Multiply each element of the specified region of numerical array A by a constant <factor>.see also MULT command
MULS command
muls A B CC[i]:= A[i] * B[i] Multiply each element of A with the corresponding element of B, result in C.
MULT command
mult A B <factor>B[i]:= A[i] * factor Multiply each element of numerical array A by a constant <factor>. Result in B.see also MULR command
NORM command
norm A <first> <last> <newsum>A[i]:= A[i] * normalizing_factor Multiply each element of numerical array A by a constant factor, chosen such that the sum over the specified region of A becomes <newsum>.
RESet command
reset <variable> ...Clears the specified variables. Most often used for numerical arrays, but may also be used for arrays of type char.see also TRUNC command: TRUNC may be used to reset a subregion of an array.
SHift command
shift <oldsp> <newsp> <old ch1> <new ch1> <old ch2> <new ch2>Array newsp receives a shifted and/or stretched or compressed version of array oldsp. The transformation is such that a peak at old ch1 of old sp will be found at new ch1 of newsp, and similar for old ch2 and new ch2. To move a spectrum, give 'SHIFT oldsp,newsp;'. The defaults for old/new ch1 are -0.5, and for old/new ch2 they are length-0.5. Thus if defaults are taken, the spectrum is just stretched or compressed, depending on the relative lengths of old and new sp.
SUB command
sub A B CC[i]:= A[i] - B[i] Subtract numerical arrays A and B, result in C.
TRUNC command
trunc A <first> <last> <minimum> <maximum>Truncate the specified region of numerical array A. That is, each element A[i] smaller than <minimum> is set equal to <minimum>; each element larger than <maximum> is set equal to <maximum>.
TYPesp command
type A <first> <last> <yes/no>Type the contents, for the specified region, of a numerical array. After input of the array name, and the first and last channel numbers, the question asked is "suppress channel numbers, Yes or No?". If the answer is 'no', a channel number is output at the begin of each line.type A
In this form, the command type can be used for arrays of type char.
VLG command
vlg A BB[i]:= log10 (A[i]) Calculate the 10-logarithm of each element of array A, result in B
VLN command
vln A BB[i]:= ln (A[i]) Calculate the natural logarithm of each element of array A, result in B
VSQRT command
vsqrt A BB[i]:= sqrt (A[i]) Calculate the square root of each element of array A, result in B
SPRint command
sprint <char variable> <text>The line of text, following the name of a variable of type char, is written to that variable. The variable should exist already. Special symbols such as `$', or a leading `?', are recognized. Numerical values may be converted to text with the $(expression,format) feature. Useful to store results of computations.
CIO arithmetic tools
calculations with simple variables
EVal command
eval <expression>Evaluate a numerical expression. Difference with KALK: the result is not printed.see KALK command for rules for expressions.
KALK command
kalk <expression>Evaluate a numerical expression, and display the result. RULES FOR EXPRESSIONS: 1. NUMBERS. Numbers may consist of the following parts sign | 0x | digits | . | digits | e | sign | digits | k where 0x means 'hexadecimal' and k means '*1024' 2. OPERATORS. a. Arithmetic operators: + - * / ** b. Relational operators: > < >= <= == != c. Assignment operators: := += -= *= /= Assignment operators have the lowest priority, but ... all arithmetic and relational operators have equal priority!!! Relational operators yield 0 (=false) or 1 (=true). Notice there is no `=' operator, but ':=' instead! 3. EXPRESSIONS. Expressions (except assignments) are evaluated from left to right. Brackets ( and ) may be used to group sub-expressions. Embedded assignments must be surrounded by (). Example a:=b+(c:=5*d) End-of-line and semicolon `;' delimit expressions. Example: r:=a*b-(c*d)/(a-c) [would be in C: r=(a*b-c*d)/(a-c)] 4. FUNCTIONS. The following functions are available: Sin Cos Tan ASin ACos ATan EXp LN SQrt Abbreviations are allowed, the required letters are written in uppercase. Example: sqrt(5) may be shortened to sq(5). 5. VARIABLES. Variables of type int, double or float may be used in expressions For more details give unix command 'man cio'
PRINTX command
printx <expression>The line of text following the command printx is evaluated as a numerical expression, and the resulting value is displayed.see KALK command for rules for expressions.
calculations with arrays
see also CIO array manipulationsMINmax command
minmax A <first> <last>Calculate and type the minimum value, the maximum, the sum, and the average value, of the specified region of a numerical array. The results are stored in the following cio variables of type double spchmax, spchmin, spvalmax, spvalmin These variables will be created if they don't exist yet.
SUM command
sum A <first> <last>Calculate and type the sum over the specified region of numerical array A. The result is also stored in local variable spsum. Local variable spsum is created if it does not yet exist.
CTR command
ctr <spectrum> <mark[i]>, for i:=0 to 5Compute the area and centroid of a peak in a spectrum. <spectrum> is a numerical array. Further input is: 6 indices (channel numbers) of the array. Two background regions are defined by mark[0] to mark[1] and by mark[4] to mark[5]. The peak region is mark[2] to mark[3]. A straight line is fitted through the background, and the centroid and area of the background corrected peak are calculated. Also calculated is an estimate of the width, i.e. 2.35 * the standard deviation of the distribution. If, (and only if!) the peak is gaussian, this correponds to the FWHM. Error estimates of these parameters are also calculated and printed. The last used input parameters are saved and used as default values for the next command CTR. The results are stored in the following cio variables of type double ctrsum, ctrbackg, ctrcentr, ctrwidth These variables will be created if they don't exist yet.
INTERPOL command
interpol <xvalue> <xarray> <yarray> <first> <last> <yresult>quadratic interpolation. xarray[first..last] is an array of x-values, yarray[first..last] an array of y-values. Both arrays xarray and yarray should be of type `f', and monotonously increasing or decreasing. interpol returns the value of y corresponding to <xvalue>, i.e. y(xvalue). No extrapolation is done. If extrapolation is attempted the value at the the end of the range (either y[first] or y[last]) is returned. Default values for <first> is 0, default for <last> is determined by the size of <xarray> and <yarray>. <yresult> is the name of a numeric cio variable where the result should be stored. This may be a subscripted variable, such as c[i+3]. If an empty name is given the result is stored in cio variable INTERPOL.
ZERO command
zero A <first> <last> <+/-/Both> <Noise level> [ <result array> ]Search the specified region of the array A, for zero crossings, that is, places where sign(A[i]) differs from sign(A[i-1]). The parameter <+/-/Both> is a single character +, -, or B, and specifies the value that the first derivative should have, +, -, or 'does not matter'. A zero crossing is ignored if the absolute value of the difference between A[i] and A[i-1] is less then <Noise level>. The steepest zero crossing that meets these criteria is typed and also stored in a local variable named spzero. If <result array> , an existing array of type `f', say F, is specified, the number of zeroes found is stored in F[0], and the channel number where the zero crossings occur are stored in F[1] and further. Local variable spzero is automatically created if it does not exist.
CIO graphics
CURsor command
cursorActivate graphics cursor, and wait for user response in the form of a keyboard stroke or a mouse click. Prints the cursor coordinates in user units and in 'cm'. Further action depends on which key is pressed: keyboard `S' or `s' stop graphics cursor input mode If the current picture is a 'y = f(x)' graph: keyboard `m' or middle mouse set left border of display region keyboard `r' or right mouse set right border of display region and redraw the display. [this does not work for option Xarray of command DIS if the x values were in decreasing order]. If the current picture is a two-dimensional display: keyboard `m' or middle mouse no action keyboard `r' or right mouse redraw a small area around the cursor position.
DISplay command
display <spectrum> <first> <last> <display option> ...Display the specified spectrum region, channels <first> .. <last>. <spectrum> can be any numerical array. Possible options are: scale <min> <max> specify the vertical scale xscale <min> <max> specify the horizontal scale log logarithmic display (vertical scale only) Xarray <xarray> use <xarray> as x coordinates if absent, x coordinate is channel nr. sym <symbol number> display spectrum as symbols (overrules grint style option) saf use current picture and axes symsize <size> specify size, in cm, of symbols font <font number> specify font number, 1..16 style <style option> <style option> is one of LINE SYMbols DASH ERRorbars HIStogram - For option ERRorbars the length of the error bars is the square root of the channel contents. title <text> specify top title for graphsFor meaningful values of symbol numbers and font numbers, see GRint command.
see also GRint command, DIX command, CURsor command, PLOT command, and GEPPOST command.
See also: ENVironmental variables
DIX command
dix <spectrum> <dix option> ...Display the specified spectrum, in the current picture, using the same region and axes as specified through a previous display command. Possible options are: sym <symbol number> display spectrum as symbols (overrules grint style option) style <style option> <style option> is one of LINE SYMbols DASH ERRorbars HIStogramFor meaningful values of symbol numbers and font numbers, see GRint command.
see also GRint command, DISplay command, and CURsor command
GRint command
grint <grint option> ...Graphics options, and parameters for the display program grint. Possible options are: grint symsize <size> specify size, in cm, of symbols grint font <font number> specify font number, 1..16 grint height <height> <angle> specify font size in cm, angle in deg grint style <style option> <style option> is one of LINE SYMbols DASH ERRorbars HIStogram grint title <text> specify top title for graphs grint xtext <text> specify text for x axis grint ytext <text> specify text for y axis grint text cm/xy <x> <y> <text>: plot text at position (x,y) specify either 'cm' or 'xy' for coordinates in cm or xy-units. grint text cur <text> <cursor event>: plot text at position specified using the graphics cursor grint line <x1> <y1> <x2> <y2> cm/xy: plot a straight line from (x1,y1) to (x2,y2) specify either 'cm' or 'xy' for coordinates in cm or xy-units. grint plnames yes/no specify whether to write the name of the spectrum above each graph. (default is yes). grint idev <idev> specify type of graphics output device (usually the default values will do) grint display <DISPLAY> specify X11 display. grint host <host name> specify the host name. Only needed if 'remote grint' is used. grint stop Stops the program grint. grint post <PostScript filename> Same as command 'geppo' grint gfile <grint log file> Record all grint commands. May be played back with "grint < file".Note: the directory used if a relative pathname is given for <PostScript filename> or <grint log file> is the current directory from which program grint was launched.
Fonts, idev, and symbol numbers:
Font 1 is the default font, and uses X11 and PostScript fonts. Fonts 2 to 16 are software generated Hershey fonts.idev values (also displayed at the start-up of geppost):
1 = display mode: Tektronix 401X / PC-emulation 1000 = X11 10 = file mode: GEP-plotfile (HPGL) 40 = file mode: PostScript 11, 41, 1010, 1040: display mode + (optional) plotfilesymbol numbers:
0: square 1: o 3: + 4: x 5: diamond 12: jojo 13: |
PLOT command
plotProduce graphics output, on a plot file, of the current picture. May be given at any time after a DISPLAY command, and before the next DISPLAY command. Extra graphics output, such as due to DIX or GRINT TEXT, is also written to the plot file. The plot file, usually named plfile, may be processed later with program geppost
GEPPOST command
geppost <PostScript filename>Send the currently displayed picture to a PostScript file. Default for <PostScript filename> is 'plfile.ps' If the terminal used is an Xwindows terminal the PostScript file is displayed by program ghostview. If the result looks satisfactory a hardcopy can be made using the 'print' option of ghostview. The action of command 'geppost' is equivalent to the sequence: cio command 'PLOT' cio command 'GRINT STOP' unix command 'geppost' (with sensible defaults for parameters) unix command 'ghostview' Note: the directory used if a relative pathname is given for <PostScript filename> is the current directory from which program grint was launched.
MAP command
map <spectrum name> <first x> <first y> <nx> <ny> <ydim>Graphics display (false colour map) of a two-dimensional spectrum. <spectrum_name> refers to an array, in which the value f(x,y) is stored in element x * ydim + y, where x and y are integers ranging from 0 upwards. The range (x = firstx .. firstx+nx-1, y = firsty .. firsty+ny-1) of the spectrum is displayed. Options for MAP may be set by command MAPOPT
MAPOPT command
mapopt <mincounts> <maxcounts> <mincolor> <maxcolor> <ncolors> <linlog>Provide options for command MAP. <mincounts> and <maxcounts> specify two values f(x,y) to be associated with colors <mincolor> and <maxcolor>. <mincolor> and <maxcolor> are integers in the range [0..31], with 0 = white, 31 = black. If <mincount> and <maxcount> have the same value, the minimum and the maximum of the displayed values f(x,y) is used. <ncolors> is the number of subregions, each with its own color, in which to divide the region given by <mincounts> and <maxcounts>. <ncolors> should not be greater then abs(<maxcolor>-<mincolor>). <linlog> is a flag with values 0 (linear display) or 1 (logarithmic).
SLICE command
slice <x1> <y1> <x2> <y2> <display option>...Presumes that a previous MAP command was given and takes the parameters <spectrum name> and <ydim> from there. Take a slice through the function f(x,y) for a straight line through the points (x,y) = (x1,y1) and (x2,y2), and show as a one-parameter graph,
see DISplay command.
REDRaw command
redrawRedraw the current picture. May be used when the picture got clobbered due to overlapping windows.
CIO system commands
CDIR command
cdir <directory>Change working directory. Default for <directory> is the current working directory. Thus 'cdir ;' prints the name of the current directory.
DIR command
dir <arguments>Display directories, as specified by the arguments. In Unix "ls" is called, in OS9 "dir" is called.
EDit command
edit <filename>Edit a file. The file is processed by the program specified in environmental variable $EDITOR, or if this variable is not found, by 'vi'.
MORE command
more <filename>View a file. The file is processed by the program specified in environmental variable $LIST, or if this variable is not found, by 'more'.
SHell command
shellFork a shell. The current program is suspended an a new shell is started. When the user logs out from this shell the current program is resumed.
See also: ENVironmental variables
SLEEP command
sleep <seconds>Wait the specified time, before proceeding with the program. This sleep may be interrupted by a keyboard signal (ctrl-C), or by other signals (e.g. dmidma ready).
STOP command
stopStop the program and return to the shell.
SYStem command
system <shell_command>Read a line of text, then execute this line as a shell command line.
TIMe command
time [<variable>]Display the date and time If <variable> is given it should specify an existing numerical cio variable. The number of seconds, elapsed since the start of the program, is assigned to this variable.
CIO console input/output
CLEAR command
clearclears the terminal screen
LOG command
log OFF/ON [<logfile_name>]Turn logging ON or OFF. When on, screen output is also written to a log file [LU 14]. The name of the log file can be specified in various ways: - when starting up the program, e.g. 'control -l <logfile_name>', - by a separate command 'open 14 <logfile_name> write ascii', - or via a command 'log on <logfile_name>'. The <logfile_name> argument is only needed if the logfile name was not specified before. Note1 Only input/output via routines from the CIO library are captured. Output from other routines (e.g. printf(), or Fortran WRITE statements) will not be logged. Also output from commands that fork an external process (such as 'more') will not be logged. Note2 command 'log <logfile_name>' works the same as 'log ON <logfile_name>'.
History command
history ;history <filename>
history -s yes/no
Print the last portion of the keyboard input (the 'history'). If no <filename> is given the history is written to the screen. If <filename> is given, the history is written to the file, overwriting its previous contents (if any). Such a file is a useful basis for the creation of a cio program. The history is not an exact copy of the input, but instead, regrouped to 'one line per command'. The form 'history -s' controls the way empty default input lines are represented in the history. After '-s' the options are "Yes": empty default lines are substituted by the default value. This is the default behaviour after starting the program. "No": empty default lines are represented as empty arguments. This only affects the future 'history'!
PRint command
print <text>The line of text following the command print is echoed to the terminal. Special symbols such as `$', or a leading `?', are recognized. Numerical values may be converted to text with the $(expression,format) feature. Useful to output results of computations.
SILENT command
silent yessilent no
After command 'silent yes' output to the screen is suppressed. The screen output is resumed by command 'silent no', and also if an error in a cio program occurs.
Note. Only the output via standard cio output routines is intercepted. Output from Fortran write statements is not affected. A more rigorous suppression of console output may be obtained using the ALTIO command.
MENU command
menuStart up the graphical user interface 'showmenu', and replace the standard input stream (the terminal keyboard) by input from this interface. When program 'showmenu' is terminated, the standard input is resumed from the original terminal. If command menu is given in program 'control' on an OS9 system some preparations are necessary: - on the X11 host computer, command 'svc' should given. - In control, the host should be defined with the command 'grint host <hostname>'. Mouse buttons: left = select menu option middle = go to main menu right = give help on command (if a valid command is clicked on)see also Showmenu help.
To scale the menu window, or use an alternate GUI, see ENVironmental variables
ALTIO command
altio <input> <output>Redirect standard input and output. <input> and <output> are names of a device or pseudo-device. They may be 'named pipes', enabling the current program to work in conjunction with a program that generates the input stream. Default values for each of the parameters <input> and <output> is the original terminal. Therefore the command "altio;" restores stdin and stdout to their original state. Notes. It is possible to redirect standard input to a disk file with ALTIO. The command LGO is preferred, however. To suppress all console output one may use the command "altio ,, /dev/null" (where /dev/null is the null device, in OS9 use /nil). However in that case one may also lose error messages.
CIO file input/output
CLose command
close <lu>Close a file, and the associated 'logical unit number' <lu>.
DLU command
dluDisplay the 'logical units' (LU) in use, and the associated file names
FPRint command
fprint <lu> <text>The line of text following the number <lu> is written to the file associated with that LU number. Special symbols such as `$', or a leading `?', are recognized. Numerical values may be converted to text with the $(expression,format) feature. Useful to output results of computations.
IMPort command
import <lu> <N_Y_arrays> <X_array> <Y_array1> (<Y_array2> ...)Read Ascii data in the format as used by program xgraph. The first column of data is read into <X_array>, further columns into <Y_array1>, <Y_array2> ... <Y_arrayN>.
Open command
open <lu> <file> <Read/Write> <filetype>Open a file, and associate it with a 'logical unit number' <lu>. <lu>: an integer in the range [0..15]. In other commands the file will be addressed by this number. Certain values have special applications: LU 15 : cio program file for command RUN LU 14 : log file File name expansion is applied to <file>: ~ is interpreted as the current home directory, ~<user> is interpreted as <user>'s home directory (not in OS9), $<string> is interpreted as an environmental variable. The parameter <Read/Write>, with options Read and Write, specifies 'read only' permission or 'read and write' permission. The parameter <filetype> has options Ascii The file contains Ascii text Spectrum The file is a packed binary spectrum file PE The file is a packed binary spectrum file in PE format. Should be used if the file was made on the PE computer. Option PE is not permitted in combination with Write. If the file does not exist, and Write was specified, a new file is created. If the file is of type Spectrum it is also initialized.
RDAscii command
rdas <LU> <Narrays> <Nchannels> <sp_name> ...rdas <LU> 0 rdas <LU> -1 <string> Read an Ascii coded file, associated with LU, and decode as numerical data. Somewhat more versatile then command IMPORT. If Narrays > 0, the next line, and as many following lines as needed, are interpreted as ascii coded numeric data. The numbers read are stored in the specified arrays. The ordering of the data in the file should be: Narrays contents for channel number 0, .... Narrays contents for channel number (Nchannels - 1). If Narrays = 0 (default), one line is read and printed. If Narrays < 0, a string is asked, and the file is scanned for a line starting with this string. The comparison is not sensitive to case, and leading spaces are ignored. Note: The file associated with LU is not rewound by this command.
REWind command
rewind <lu>Rewind the file, connected to logical unit <lu>. Useful in combination with command RDAS.
Xport command
xport <lu> <xflag> <nspectra> <spectrum_name> (<spectrumname> ...) <first_channel> <last_channel>Write data in the Ascii format used by program xgraph. <xflag> refers to the question 'Use channel nrs as x-coord', valid options for <xflag> are Yes and No. If Yes nspectra spectrum_names are asked If No nspectra+1 spectrum_names are asked, the first one is the X spectrum.
CIO spectra
SPList command
splistDisplay the names and length of currently defined spectra. see DEFsp command and UNDefsp command.
PLAB command
plab <spectrum_name>Show the contents of the labelrecord of a spectrum in memory.
PUT command
put <spectrum> <lu> <factor> <notes>write a spectrum to a file <spectrum> is the name of the spectrum in memory <lu> specifies the file <factor> is an integer scaling factor. In the file the numbers are represented as integers; <factor> is the multiplier applied before conversion to integers. It should be large enough to prevent unwanted rounding, and not so large that any number exceeds the integer capacity (= 2**31, about 2E9). Example: if <factor> = 1000, numbers are accurate to 0.001. If <factor> = -1, this conversion does not take place and numbers are stored in floating point representation. This is an inefficient use of PUT. <notes> is a line of text, 128 characters maximum, stored with the spectrum.
Get command
get <spectrum> <seqnr> <lu>Read a spectrum from the file associated with <lu>, see Open command.
<seqnr> specifies the sequence number in this file. <spectrum> specifies the name of the spectrum in memory, and must be the name of a previously declared spectrum,see DEFsp command.
LABGET command
labget <spectrum> <label field> <variable>copy parameters of a spectrum label to cio variables. <spectrum>: the name of the spectrum whose label should be accessed. Possible options for <label field> are Timers/Rvars/Notes Timers: <variable> must be an int array of size 5 or larger. Rvars: <variable> must be a double or float array of size 16 or larger. Notes: <variable> must be a char array of size 128 or larger. Length: <variable> must be int The contents of <variable> are copied from the corresponding field of the spectrum label, i.e.: Timers: seconds, "real time", "live time 0" ... "live time 2". Rvars: 16 float numbers. Notes: a line of notes. Length: length of original spectrum
LABlst command
lablst <lu> <seqnr> <nspectra> <Short/Full>List labels of spectra on the file associated with <lu>. <seqnr> specifies the first sequence number in this file. <nspectra> specifies the number of labels to be listed. <Short/Full> is a flag that specifies the amount of information to be listed for each spectrum.See also the Open command.
LABSET command
labset <spectrum> <label field> <variable>copy parameters from cio variables to a spectrum label. <spectrum>: the name of the spectrum whose label should be accessed. Possible options for <label field> are Timers/Rvars/Notes Timers: <variable> must be an int array of size 5 or larger. Rvars: <variable> must be a float or double array of size 16 or larger. Notes: <variable> must be a char array of size 128 or larger. The contents of <variable> are copied to the corresponding field of the spectrum label, i.e.: Timers: seconds, "real time", "live time 0" ... "live time 2". Rvars: 16 float numbers. Notes: a line of notes. Note. The label field "Notes" is overwritten by command PUT.
SPCOPY command
spcopy <input_LU> <output_LU> <first> <last>Copy spectra from one file to another. <input_LU> and <output-LU> should have been opened beforehand, and assigned to 'spectrum files'. <first> and <last> are the first and last sequence number to be copied of the input file.