Spec Startup & Macro Organization – February 2005

 

Arthur Woll, Phil Sorenson, Detlef Smilgies

 

Features:

1. Combines CHESS and Gline standard macro sets.

2. Streamlines macro development, testing, backup, and distribution by establishing a simple, flexbile directory structure and startup protocol.

3. Separate macro files from the spec distribution directory.

4. New lab-wide tools for macro development and spec troubleshooting

5. New lab-wide macros for printing spec plots and spec output.

 

Overview:

 

On startup, spec calls site.mac in SPECD (/usr/local/lib/spec.d/).  In the past, CHESS and Gline have used this file to load a series of macros that perform hardware setup and load specialized scans and other macros.  With this distribution, site.mac calls four other 'master' macros: chess.mac, station.mac, and userlist.mac.  These, in turn, handle the details of customizing spec.  These files are distinguished by the scope of their customizations: chess.mac is the same lab-wide, station.mac is different for each station, while userlist.mac handles user-specific customizations.

 

Lab-wide macros (cdo, udo, station, and umedit) for macro maintenance and trouble-shooting have been added.  These facilitate tracking spec start-up and transferring macros from station to station.

 

Detail:

 

STARTUP

 

On startup, spec calls site.mac in SPECD (/usr/local/lib/spec.d/). Next,  site.mac calls three other macros.  These macros are distinguished by scope, which is reflected by their location on the directory tree:

 

1.chess.mac (SPECD/../Macros/dist/): loads macro files that are common to ALL stations, such as standard printing macros (prout) and scans.

2.station.mac (SPECD/../Macros/nondist/): loads a single macro, e.g.  g1.mac, for station-specific setup. 

3.userlist.mac (~specuser/Macros/): loads macro sets associated with a particular user, also useful for testing new macros or over-writing standard macro functions.

 

MACRO LOADING

 

The macro site.mac defines two special forms of the spec 'do' function, 'cdo' and 'udo', for loading macro files. 'cdo' looks for macros in the two non-user-writable directories, SPECD/../Macros/dist and SPECD/../Macros/nondist only.  The contents of these directories are read-only by specuser.  'udo' is similar except that it also searches the ~/specuser/Macros/ directory before searchin the other two. In both cases, the search is performed from lowest to highest scope.  For example, test versions of any macro file in SPECD/../Macros/dist can be superceded by placing a different copy of that file in ~specuser/Macros and calling it using 'udo'.

 

MACRO DIRECTORIES

 

The broadest-level macro directory, SPECD/../Macros/dist, will be maintained by the CHESS administrator.  This directory will house all chess standard macro packages, plus the files site.mac, discussed above, and chess.mac, which loads only those macro packages common to all stations. It may also be used for other static packages that staff or users want to safeguard and/or make available to all stations.  For example, mca macros contributed to the CHESS admnistrator to be part of the macro distribution will thereafter appear in the SPECD/../Macros/dist directory of every station computer, and be available via cdo or udo.  Since the CHESS admin may issue new macro distributions at any time,  this directory's contents   should not be edited by anyone else, since such changes may be lost without warning due to a new upload of the whole directory. 

 

The directory  SPECD/../Macros/nondist is maintained by the staff scientist for that station. It houses station.mac, which loads all station-specific setups  common to all experiments.

 

The directory ~specuser/Macros can be used for user-specific customizations, which should be called from userlist.mac.

 

MACRO EDITING

 

Two commands have been added to ease macro maintenance and development:

                        SPEC> station [filename]

With no argument, edits SPECD/../Macros/nondist/station.mac for editing. When the editor is exited, executes station.mac.  If called with the filename argument, station opens the file filename within SPECD/../Macros/nondist/ for editing, then executes.

                        SPEC> umedit [filename]

Umedit behaves the same as station, except that it searches for the file filename in ~specuser/Macros if invoked with an argument, or ~specuser/Macros/userlist.mac if no argument is given.