Initial revision
This commit is contained in:
82
doc/manager/macroman.htm
Normal file
82
doc/manager/macroman.htm
Normal file
@ -0,0 +1,82 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Programming SICS Macros</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<H2>Programming SICS Macros</H2>
|
||||
<P>
|
||||
The SICS server has a built in macro language. This macro language is basically
|
||||
John Ousterhout's Tool Command Language Tcl. Tcl is described elsewhere.
|
||||
A sound knowledge of Tcl is required for programming SICS macros. The SICS macro
|
||||
language can be used for the following purposes:
|
||||
<UL>
|
||||
<li>Add hoc measurement procedures.
|
||||
<LI>Trial measurement procedures.
|
||||
<LI>Syntax adaptions to one's own favourite syntax.
|
||||
<LI>Building of cmore complex commands from the SICS primitives.
|
||||
</ul>
|
||||
The general procedure for defining a macro requires defining the macro in a new
|
||||
file, source this file from the configuration script and the use of the Publish
|
||||
command to make it available. New commands can best be defined as Tcl procedures,
|
||||
but the obTcl object oriented extension to Tcl is known to work as well. The SICS
|
||||
macro language allows to access:
|
||||
<ul>
|
||||
<li>Most Tcl commands.
|
||||
<li>All SICS commands.
|
||||
</ul>
|
||||
In the following sections a few pecularities of the SICS macro system will be
|
||||
discussed.
|
||||
</P>
|
||||
|
||||
<h3>Input/Output</h3>
|
||||
<p>
|
||||
It would be quite verbose and confusing for the user if all output from SICS
|
||||
commands called from a macro would appear on the screen during macro execution.
|
||||
Therefore all
|
||||
normal SICS output to a client is suppressed while executing a macro. Except
|
||||
error messages and warnings which will always be written to the
|
||||
client executing the macro. The output of a SICS command is available within the
|
||||
macro script through the normal Tcl mechanism as a return value. This allows for
|
||||
processing of SICS output within a macro. If the output to the client executing
|
||||
the macro is required this can be done with the ClientPut command, detailed in the
|
||||
user documantation.
|
||||
</p>
|
||||
<h3>Error Handling</h3>
|
||||
<p>
|
||||
Tcl has the feature that it aborts execution of a script when an error occurs.
|
||||
If a macro script needs to handle errors either from Tcl or from SICS commands
|
||||
this can be achieved by using the Tcl catch mechanism. A script can inquire the current interrupt value of the
|
||||
connection with the command <b>GetInt</b>. If a script can handle an error condition
|
||||
it may set the interrupt on the connection object with the <b>SetInt</b> command.
|
||||
The textual representations of interrupts for these commands are:
|
||||
continue, abortop, abortscan, abortbatch, halt, free, end.
|
||||
</p>
|
||||
<h3>Interacting with SICS within a Script</h3>
|
||||
<p>
|
||||
There exist a few commands which allow to inquire or manipulate SICS
|
||||
internals. Most of these commands are only available in macro scripts.
|
||||
<DL>
|
||||
<DT>SICSType thing.
|
||||
<DD> SICSType lets SICS find out if thing has some meaning within SICS. Possible return
|
||||
values are: DRIV for a drivable variable, COM for a SICS command, NUM for a numeric
|
||||
value and TEXT for anything else.
|
||||
<DT>SICSBounds var newval
|
||||
<DD>SICSBounds checks if newval violates the hardware or software limits of
|
||||
the variable var.
|
||||
<DT>SetStatus newval
|
||||
<DD>SetStatus sets the SICS status line to a new value. Possible values for
|
||||
newval are: Eager, UserWait, Count, NoBeam, Paused, Driving, Running,
|
||||
Scanning, Batch, Halt, Dead.
|
||||
<DT>SICSStatus var
|
||||
<DD>SICSStatus returns a integer value representing the current status of
|
||||
the object var. var must be a drivable or countable object. The integer code returned
|
||||
are defined in the SICS programmers documentation.
|
||||
</DL>
|
||||
</p>
|
||||
<p>
|
||||
Currently it is not possible to define object interfaces from within the SICS
|
||||
macro language. For the notion of object interfaces see the
|
||||
SICS programmers documentation. This may be implemented in future when needed.
|
||||
</p>
|
||||
</BODY>
|
||||
</HTML>
|
Reference in New Issue
Block a user