next up previous contents
Next: Expressions Up: Variables and expressions Previous: Variables and expressions   Contents


Variables

SCL includes a symbol table, which gives access to predeclared and user-defined variables. User variables may be of type real, double precision, logical, integer or character, and may be scalars or one-dimensional arrays (vectors). They must be created using the DECLARE command before they can be accessed. Pre-defined variables exist for almost all items in the current scan (header and data items), for many of the useful flags (i.e. the set of defaults which characterize the current environment), and for a number of derived quantities, such as the results of gaussian and sinusoidal fits etc. Variables also exist which contain the number of scans in the current file, the number of spectra in a GSD file, and the no of entries in the map file. The six integer counting variables i,j,k,l,m,n, and logical constants TRUE & FALSE, are also predefined.

The full set of currently defined variables, together with their type and vector length, may be inspected using the SHOW-VARIABLES command. You will note that several of the variables have a ``*" as their first character. This is SCL's way of knowing that the variables are read-only, and must not (cannot) be altered by the SPECX user. In general things are only read-only if the result of changing them would be to risk damage to your files etc, but (for example) the logical variable TRUE is readonly too; the consequences of redefining TRUE to be false may be imagined.

Variables may be set using the = command (see below), and inspected using the PRINT command (also described later). It is possible to give any variable or arithmetic expression involving defined variables in response to a prompt. Thus, for example, 4*x + 5 would be a valid response to the OFFSET? prompt, provided that x had already been declared. Note that variable names are not case sensitive (or are not meant to be - let me know of any that appear to be!)


next up previous contents
Next: Expressions Up: Variables and expressions Previous: Variables and expressions   Contents
Jamie Leech 2004-08-16