Macro Commands

SICS has a built in macro facility. This macro facility is aimed at instrument managers and users alike. Instrument managers may provide customised measurement procedures in this language, users may write batch files in this language. The macro language is John Ousterhout's Tool Command Language (TCL). Tcl has control constructs, variables of its own, loop constructs, associative arrays and procedures. Tcl is well documented by several books and online tutorials, therefore no details on Tcl will be given here. All SICS commands are available in the macro language. Some potentially harmful Tcl commands have been deleted from the standard Tcl interpreter. These are: exec, source, puts, vwait, exit,gets and socket. A macro or batch file can be executed with the command:

exe name tries to open the file name and executes the script in this file.

batchrun name prepends to name a directory name configured in the variable batchroot and then executes that batchfile. The usage scenerio is that you have a directory where you keep batch files. Then the variable batcroot is set to contain the path to that directory. Batchrun then allows to start scripts in that directory without specifying the full path. Please note that fileeval and batchrun are obsolete and to be replaced by the new batch manager command, exe, as described below.

Then there are some special commands which can be used within macro-sripts:

ClientPut sometext1 ... Usally SICS suppresses any messages from SICS during the processing of batch files. This is in order not to confuse users with the output of intermediate results during the processing of batch files. Error messages and warnings, however, come through always. Clientput now allows to send messages to the user on purpose from within scripts.

SICSType object allows to query the type of the object specified by object. Possible return values are

SICSbounds var newval checks if the new value newval lies within the limits for variable var(example: SICSbounds D1HL 10). Returns an error or OK depending on the result of the test.

SICSStatus var SICS devices such as counters or motor may be started and left running while the program is free to do something else. This command inquires the status of such a running device. Return values are internal SICS integer codes. This command is only of use for SICS programmers.

SetStatus newval sets the SICS status to one of: Eager, UserWait, Count, NoBeam, Driving, Running, Scanning, Batch Hatl or Dead. This command is only available in macros.

SetInt newval, GetInt sets SICS interrupts from macro scripts. Not recommended! Possible return values or new values are: continue, abortop, abortscan, abortbatch, halt, free, end. This command is only permitted in macros. Should only be used by SICS programmers.