$debug - Macro debugging flag
$debug debugLevel; Default is 0
-2 <= debugLevel <= 2
$debug is a flag to trigger macro debugging. A setting of 1 or 2 enables debugging, 0 disables debugging (default). A $debug setting of 2 debugs all macro lines encountered, whereas a setting of 1 debugs only the lines executed, i.e. if a false !if was encountered the lines within the !if would not be printed. Problems arise with !elif and !else and a debugLevel setting of 1 as the !elif and !else lines are never printed.
A -ve setting disables debugging and has no immediate effect. However as soon as the bell is rung the value is inverted (-1 to 1, -2 to 2) enabling debugging. This can be invaluable when tracing problems, for example the following macro code will loop infinitely:-
!repeat beginning-of-line backward-char !force forward-line !until ¬ $status
This is a fairly obvious bug, but if buried in a thousand lines of macro code it could be very difficult to spot and to find it during execution would be very tedious if not impossible. But by setting $debug to -1 the macro can be executed as normal and as soon as the macro is stuck the user can simply press "C-g" (abort-command) which rings the bell and starts macro debugging at the current execution point.
(c) Copyright JASSPA 1999
Last Modified: 1999/02/15
Generated On: 1999/12/01