- Added tabledrive: table driven path for MARS
- Initial MARS development - Upgraded Manager Manual SKIPPED: psi/make_gen psi/psi.c psi/tabledrive.c psi/tabledrive.h psi/tabledrive.w psi/utils/SerPortServer.c
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
<TITLE>Programming SICS Macros</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<H2>Programming SICS Macros</H2>
|
||||
<H1>Programming SICS Macros</H1>
|
||||
<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.
|
||||
@ -13,7 +13,7 @@ language can be used for the following purposes:
|
||||
<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.
|
||||
<LI>Building of more 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
|
||||
@ -28,7 +28,7 @@ In the following sections a few pecularities of the SICS macro system will be
|
||||
discussed.
|
||||
</P>
|
||||
|
||||
<h3>Input/Output</h3>
|
||||
<h2>Input/Output</h2>
|
||||
<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.
|
||||
@ -39,19 +39,25 @@ 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.
|
||||
user documentation.
|
||||
</p>
|
||||
<h3>Error Handling</h3>
|
||||
<h2>Error Handling</h2>
|
||||
<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
|
||||
this can be achieved by using the Tcl catch mechanism.
|
||||
</p>
|
||||
<P>
|
||||
If things are seriously wrong or the users wishes to interrupt an operation
|
||||
SICS interrupts are used. Scripts implementing measurement procedures may
|
||||
need to test and even modify interrupt values.
|
||||
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>
|
||||
<h2>Interacting with SICS within a Script</h2>
|
||||
<p>
|
||||
There exist a few commands which allow to inquire or manipulate SICS
|
||||
internals. Most of these commands are only available in macro scripts.
|
||||
@ -73,10 +79,69 @@ the object var. var must be a drivable or countable object. The integer code ret
|
||||
are defined in the SICS programmers documentation.
|
||||
</DL>
|
||||
</p>
|
||||
<h2>SICS Interfaces in Tcl</h2>
|
||||
<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.
|
||||
Work has begun to implement SICS internal interfaces in Tcl. This opens the
|
||||
port for writing even device drivers in Tcl. Another use is to define
|
||||
virtual motors quickly in Tcl. At the time of writing, July 2005, this
|
||||
is only developed for the object interface and the drivable interface.
|
||||
For the meaning of internal SICS interfaces please consult the SICS
|
||||
programmers documentation. Be warned: with the feautures described in this
|
||||
section, you can mess up SICS badly.
|
||||
</p>
|
||||
<h3>The Object Interface</h3>
|
||||
<p>
|
||||
<dl>
|
||||
<dt>MakeTclInt name
|
||||
<dd>Creates an object name. This object then understands the following
|
||||
commands:
|
||||
<dl>
|
||||
<dt> name savescript scriptname
|
||||
<dd>Configures a script which will be called when it is time to dump
|
||||
the status of the SICS server. This script will be called with the
|
||||
name of the object as its only parameter.
|
||||
<dt>name backup bla bla bla....
|
||||
<dd>To be used from savescripts. Writes everything behind backup into the
|
||||
status file.
|
||||
</dl>
|
||||
The use of this facility is to place special commands into the status file
|
||||
which may, for instance, request calculations to be made or drive parameters
|
||||
not caught in the standard SICS objects to special values. For example:
|
||||
at SANS2 this is used in order to store attenuator and collimator
|
||||
values. Both are implemented as scripted commands and thus do take part
|
||||
in the standard SICS object saving scheme.
|
||||
</dl>
|
||||
</p>
|
||||
<h3>Overriding the Drivable Interface with Tcl</h3>
|
||||
<p>
|
||||
The drivable interface of any given drivable object can be overriden with
|
||||
tcl functions. This includes an object created with MakeTclInt. The syntax is:
|
||||
<dl>
|
||||
<dt>TclReplaceDrivable objname key scriptname tclName
|
||||
<dd>This replaces the drivable interface function defined by key with the
|
||||
script scriptname in the driveable interface of the SICS object object.
|
||||
tclName is the name of an arbitrary Tcl object which can hold user data.
|
||||
Possible function keys and their function signatures are:
|
||||
<dl>
|
||||
<dt>halt
|
||||
<dd> haltscript, no parameters
|
||||
<dt>checklimits
|
||||
<dd>checklimitsscript targetvalue
|
||||
<dt>setvalue
|
||||
<dd>setvaluscript targetvalue
|
||||
<dt>checkstatus
|
||||
<dd>checkstatusscript, no parameters
|
||||
<dt>getvalue
|
||||
<dd>getvaluescript, no parameters
|
||||
</dl>
|
||||
All procedures, excpet getvaluescript, are supposed to return the
|
||||
approriate SICS return codes (HW*) as integer numbers. Getvaluescript
|
||||
is supposed to return the position of the device.
|
||||
<dt>TclDrivableInvoke objname key
|
||||
<dd>A debugging aid: Invokes the scripted function denoted by key of the
|
||||
object objname and prints the results. The function keys are the same
|
||||
as given above.
|
||||
</dl>
|
||||
</p>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
Reference in New Issue
Block a user