2.3.13.1. - Built-In Variables
The following is a list of most of spec's built-in variables. Some site-dependent code, along with most of the standard diffractometer geometry code, will create additional built-in variables. Also, motor and counter mnemonics entered in the hardware configuration file become built-in variables when the config file is read by spec.
A[]-
is an array dimensioned to the number of motors as obtained
from the
config
file.
The function
read_motors(0)fills the array with user angles. The user can assign values to any of the elements. The commandsmove_allandmove_cntuse the values in the array. Also, the various site-dependent, geometry-specific calculations, accessed through thecalc()user-hook function, base their results on the values in this array or place new values in it. COLS-
is a number-valued variable set to the number of text columns on the
user terminal or workstation window.
The value is used for formatting text-mode plots and on-line help files.
COLSis generally automatically assigned a value from the system terminal data base when spec starts up, or, if available, by using theTIOCGWINSZcommand in the ioctl() system call whenever a value forCOLSis needed. COUNTERS-
is the number of counters being used as determined from
reading the
config
file.
CWD-
is a string-valued variable that contains the name of the user's current
working directory.
It is assigned a value when spec starts up, and is updated each time the
chdir()function is executed. DEBUG-
is a user-assignable numeric variable that determines the
level of debugging messages printed.
The level
is determined by the sum of the values given
in this table:
Hex Decimal What is shown 0x1 1 Show input tokens during parsing. 0x2 2 Show node execution while running. 0x4 4 Show node allocate and free. 0x8 8 Show symbol table creation and lookup. 0x10 16 Show value get and set. 0x20 32 Show misc info. 0x40 64 Show hardware related info. 0x80 128 Show more hardware related info. 0x100 256 Show macro substitution. 0x200 512 Show memory allocate and free. 0x400 1024 Show input after macro expansion. 0x800 2048 Print warning messages. 0x1000 4096 Show certain low level hardware info. 0x2000 8192 Show data array allocation. 0x4000 Show signal blocking. 0x8000 Show sleeps and other low level hardware info. 0x10000 Show input file queuing. 0x20000 Show readable runtime debugging. 0x40000 Print input context on execution-time errors.
A change in the value ofDEBUGonly takes effect after the complete mini-program in which the new value is assigned has been executed. If a debugging log file is open (any file that begins with the charactersdlogor ends with the characters.dlog), debugging messages are only written to that file, not to the screen or any other file or device. DISPLAY-
is a user-assignable, string-valued variable.
Its value at the time an
X-Windows graphics filter process is spawned with the
plot_cntl("open")function (withGTERMset to"x11") determines on which host and screen the plot window will be displayed. The initial value forDISPLAYis taken from the environment variable of the same name. FRESH-
is a built-in variable
that has an initial nonzero value if spec was invoked with the
-f (fresh start) flag or if a fresh start was forced by an incompatible
state file version.
The value is zero otherwise, and is set to zero in any case after all
start-up command files and macros have been read and their commands
executed.
In the standard start-up macros, the value of
FRESHis checked to see if initial default parameter assignments should be made. GTERM-
is a user-assignable, string-valued variable containing a value
describing the display type to use for high-resolution graphics.
Its value will be taken from an environment variable of the same name
when spec starts up, if
such a variable exists.
Currently supported
GTERMtypes arevga,vpc,ega,epc,hercandcgafor various PC console graphics (not linux);x11for X Window System graphics; andsunfor SunView graphics. IfGTERMis not set in the environment or has not been assigned a value, it defaults tox11. HOME-
is string valued and is initialized to the user's home
directory as taken from the environment variable
HOME.
If not found in the environment, its value is set to
the current directory.
MOTORS-
is the number of motors being used as determined from
reading the
config
file.
PAGER-
can contain the name of a program to use for paging through
spec help files.
Such a program can be
an alternative to spec's built-in paging code, allowing, for example,
searching
and line-by-line perusal.
On start up,
spec examines the environment variables
SPEC_PAGERandPAGER, in turn. If one exists, its value is assigned toPAGER. Also, if a version of the less utility greater than version 332 is installed on the spec platform, the standard macros will assign toPAGERa string that invokes less with special flags. Otherwise,PAGERis left unset. PI-
is a number-valued symbol with the value 3.14159....
ROWS-
is a number-valued variable set to the number of text rows on the
user terminal or workstation window.
The value is used for formatting text-mode plots and on-line help files.
ROWSis generally automatically assigned a value from the system terminal data base when spec starts up, or, if available, by using theTIOCGWINSZcommand in the ioctl() system call whenever a value forROWSis needed. S[]-
is an array that will be filled with the hardware scaler contents when the
command
getcountsis executed. SPEC-
is string valued and set to the name by which
spec is invoked, such as
fourc.
SPECD-
is string valued and set to spec's auxiliary file directory.
The default name is compiled in when spec is installed,
but can be overridden by the
-D invocation option or by the
SPECD
environment variable.
TERM-
is a user-assignable, string-valued variable.
It is initialized to the user's terminal
type as taken from the environment variable
TERM.
If not found in the environment, it is set to terminal-type
vt100.
USER-
is string valued and is set to the login name of the
current user.
VERSION-
is string valued and is set to the version number of spec, as in
3.03.11.
The values of
A[], S[], DEBUG, TERM, GTERM, ROWS and
COLS can be changed by the user.
The other variables are
immutable
and cannot have their value changed.
Motor mnemonics obtained from the config file become built-in, immutable variables. User-added code, such as the X-ray diffractometer geometry code, typically creates other built-in variables, such as
G[],
Q[],
U[]
and
Z[].
