Debug applied to a function, Debug on startup – Crunch CRiSP File Editor 6 User Manual

Page 32

Advertising
background image

Page 32

:/home/fox/bin:/usr/openwin/bin:/usr/openwin/demo:/usr/local/crisp/bin.
sun4:/develop/sun4/bin:/develop/scripts:/develop/scripts:/develop/scrip
ts/init.d:/develop/scripts/lmfdbase:/develop/scripts/logclient:/develop
/scripts/logger:/develop/scripts/newsbase:/develop/scripts/ticker1
TERM=xterm
End of Environment
*** DEBUG ON (0x0001) ***
04:......... iACC=0
03:........ iACC=0
iACC=0
Returning to macro: exec_macro
*** TRIGGER=REG_KEYBOARD ***
01:......(status_update 9 )
Execute macro: status_update
02:.......(int obj_id )
(get_parm 0 obj_id )
obj_id := 9
iACC=1
(int curscr perc col line )

The first section "Environment" up until "End of Environment" is for technical support and includes useful
information about the current version of CRiSP. You can normally just ignore this section.

When debug is turned on the log file is annotated with the "DEBUG ON" message. Thereafter you can see
each primitive as it is executed. The lines that say something like "iACC=" show the result of executing a
previous macro or primitive. For instance, "iACC" means the accumulator contains an integer value. The
internal execution engine has an accumulator which can contain integers, floats, strings, lists or NULL
values.

Assignments to variables are shown by a line like:

obj_id := 9

A lookup of a symbols value is shown as an '=' as opposed to a ':='. The actual details and amount of
information available in the crisp.log file is subject to change so you may encounter differences as future
versions of CRiSP are released.

Debug applied to a function

One of the problems with the crisp.log file generated with the crisp.log file is the volume of information
presented to you. To reduce the size of the output you can simply place debug() function calls in your
macros closer to the point of the area of interest.

Another alternatively is to trigger the enabling of the debug information when a specific macro is executed.
To do this, execute the debug command with the name of a macro as its parameter. For example:

Command: debug fred

This would turn on debugging as soon as the macro "fred" is executed.

Debug on startup

Sometimes you may need to turn on debug when CRiSP starts, e.g. because you may have written your
own macro which gets loaded at startup and cannot get to the Command: prompt early enough to execute
the debug command.

CRiSP provides a '-d' switch on the command line to turn on debug before the first macro is ever executed.
Be careful: the -d switch is an acceptable abbreviation for '-display' and if you are using an X11 version of
switch the X11 libraries will intercept the '-d' switch if it is followed by anything. This usually results in a
cryptic error message of:

Error: Can't open display: ....

CRiSP supports a -debug switch as an alias for -d to overcome this problem. Alternatively, ensure the -d

Advertising