TRACE

Synopsis
TRACE contentslist
Description

Marks the named items for tracing. A message is printed whenever a traced procedure is invoked, giving the actual input values, and whenever a traced procedure runs STOP or OUTPUT. A message is printed whenever a new value is assigned to a traced variable using MAKE. A message is printed whenever a new property is given to a traced property list using PPROP.

It is possible to trace a procedure, variable, or property list before it is defined. If you trace something that is not defined, it does not appear in the output of TRACED, but if it is later defined, it will then appear in the output of TRACED. That is, it behaves as traced as soon as it is defined. For example, if you trace a variable that doesn't yet exist, a trace message is printed when the variable is first assigned a value. Similarly, if you ERASE something that is traced then redefine it, it will also reappear as traced as soon as it is redefined.

TRACE does not throw an error if asked to trace a primitive.

See the Workspace Queries section for an explanation of the contentslist input.

Example

The following example shows the effect of tracing a procedure

TO MYPRINT :a
  PRINT :a
END

MYPRINT "Hello
Hello

TRACE "MYPRINT
MYPRINT "Hello
( MYPRINT "Hello )
Hello
UNTRACE "MYPRINT
MYPRINT "Hello
Hello

The next example shows the effect of tracing a variable before it exists

TRACE NAMELIST "x
SHOW ITEM 2 TRACED
[]

MAKE "x 1
Make "x 1
SHOW ITEM 2 TRACED
[x]

MAKE "x 2
Make "x 2

UNTRACE NAMELIST "x
MAKE "x 3
See Also
UNTRACE
The Trace Button

SourceForge.net Logo