spec

Software for Diffraction

2.4.4.2. - Built-In Macro Names



The following macro names are built-in to spec. They are run at the specified times only if they have been given a definition.


begin_mac
If a macro by this name exists, it will be run after reading the hardware configuration file and all the start-up command files, but before reading commands from the keyboard.

end_mac
If a macro by this name exists, it will be run when spec exits from either a ^D or a quit command.

config_mac
If a macro by this name exists, it will be run after reading the configuration file at start up and after the reconfig command is executed.

prompt_mac
If a macro by this name exists, it will always be run just before spec issues the main, level-zero prompt. If an error occurs while running prompt_mac, it will be automatically undefined.

cleanup, cleanup1
If either or both exists, they will be run whenever an error is encountered, the exit command is encountered, or a user types ^C. The cleanup macro is run first. After running the clean-up macros, spec gives the standard prompt and waits for the next command from the keyboard.

cleanup_once
A clean-up macro that is always deleted before a new spec main prompt is issued. If defined, its definition will be pushed on to the input stream whenever an error is encountered, the exit command is encountered, or a user types ^C.

cleanup_always
Like cleanup_once, but its definition is not removed except by an explicit undef command.

The cleanup and cleanup1 macros are no longer used in the standard macros. The more recent cleanup_once and cleanup_always macros are preferred.

Macro definitions for these built-in macros should be maintained using cdef() so that independent macro packages can make use of the macros without interference.