TRACE and DEBUG Statements

Documentation (not function) added October 2011

This group of statements is useful for outputting tracing or debugging messages without interfering with the existing screen display or program logic. (The messages go to the Debug Message Window; see Opening the Message Window.

TRACE.OPEN <string expression>

TRACE.PRINT <string expression>

TRACE.PAUSE <string expression>

TRACE.CLOSE

DEBUG.OPEN

DEBUG.PRINT

DEBUG.PAUSE

DEBUG.CLOSE

 

TRACE.OPEN is optional, since the TRACE.PRINT and TRACE.PAUSE statements will open the window automatically if it is not already open. The only point of it would be the ability to set the window title (which otherwise defaults to "A-Shell Debug Messages").

TRACE.PRINT <text> outputs the specified text to the debug window. The text string may contain the following special macros:

$# (displays the running message count as a message id #)

$T (displays the time in HH:MM:SS format)

$P (displays the program name in brackets, e.g. <MYPROG>)

For example, the following statement

TRACE.PRINT "$# $T $P The value of X is: " + X

would appear something like:

27 11:25:01 <MYPROG> The value of X is: 25

TRACE.PAUSE is identical to TRACE.PRINT except that it causes the application to pause, with a message in the debug message window prompting the operator:

<Application paused - Double-click here to resume>

As suggested by the message, the application is then suspended while waiting for the user to double-click the message window. This is intended as alternative to the usual practice of display message boxes which require a click on the OK button to proceed (or the venerable and primitive STOP statement). Note: Ctrl+C will abort the pause and pass the Ctrl+C to the program.

The actual wording of that message and the acknowledgement message when the double-click is received may be customized via the strings 005,002 and 005,003 in SYS:SYSMSG.xxx.

The DEBUG.xxx statements are equivalent to the TRACE.xxx statements, except that they are ignored if the DEBUG flag is not set. The DEBUG flag may be set via the SET.LIT command, the MX_DEBUG call, or by clicking on the Set Debug Mode option in the Debug Message Window context menu:

   this is a linked image

See also

The description of the DEBUG system variable in the A-Shell Extensions table.

EVTWIN.SBR