MIAMEX 144: Get / Set DEBUG Control Variable

xcall MIAMEX, MX_DEBUG, opcode, dbgflg

MX_DEBUG queries or sets the DEBUG control variable.

Parameters

opcode  [in, numeric]

0 to retrieve the current value of the system variable DEBUG (into the ordinary variable dbgflg), 1 to set it.

dbgflg  [in/out, numeric]

For opcode 0, returns the current value of the DEBUG control variable.  For opcode 1, supplies the new value you want to set.

Comments

The DEBUG control variable is useful for embedding debugging code into applications that can be enabled or disabled without modifying the programs. Other ways to modify the variable are via the SET DEBUG command or by compiling with the /DEBUG compile switch. Ways to use the variable within a program include:

IF DEBUG THEN …

IF DEBUG > N THEN …

DEBUG.OPEN              ! open debug message window (if DEBUG variable set)

DEBUG.PRINT msg         ! output msg to debug window (if DEBUG variable set)

DEBUG.PAUSE msg         ! output msg and wait (if DEBUG variable set)

DEBUG.CLOSE             ! close debug message window (if DEBUG variable set)

See the Event Tracing for more information on the debug message window.