Download X-Ray Diffraction Software USER MANUAL and TUTORIALS

Transcript
macros from one of the .src files above. For example, /usr/lib/spec.d/four.mac is created for the four-circle geometry and contains the macros from fourc.src.
The macro definitions are the least stable part of the spec package. The macros are
easy to change — no recompilation of C code is necessary — and the intent of the
designers of the spec package was to put its flexibility in the macros. Thus, the definitions presented below may differ with the macro definitions in your current version
of spec.
You may find the existing macros do not accomplish what you want. A simple procedure for modifying a standard macro is to use the macro savmac to copy the definition
of the existing macro into a file. You then edit the macro definition in that file and
read it back in using the do macro. You can gather your customized macros into a file
named spec.mac in your current directory or into the file /usr/lib/spec.d/site.mac.
Both of these files are read every time you start spec, whether or not you are starting fresh.
If you have made generally useful modifications to the standard macros, or if you
have developed your own macros, please send copies to Certified Scientific Software.
We include many user-contributed macros in each new release of the spec package.
Some Tips
The syntax rules for defining macros are given in the Reference Manual on page 90.
The suggestions that follow offer some additional guidance for writing macros that
will fit in well with the standard library.
When a macro requires arguments, it is a good idea to check that the right number of
arguments have been given, and if not, print a usage message and exit to command
level. The symbol $# will be set to the number of arguments when the macro is run.
For example,
def ascan ’
if ($# != 5) {
print "Usage:
exit
}
...
’
ascan
motor start finish
intervals time"
If an argument is supposed to be a motor number or mnemonic, use the _check0
macro before operating on the motor. The _check0 macro exits to command level if
124
STANDARD MACRO GUIDE