APL provides the ability to trace or stop execution of user-defined functions, pro-
viding the functions are not locked (see Locked Functions in this chapter).
Trace Control
Trace control is used to display the results of selected statements as a function
executes. The display consists of the function name followed by the number and
results of the selected statement. For example:
,STEVE[l I Z-ResuIt
Function ' Statement
Name Name
Statements to be traced are specified by a trace vector. The format of the trace
control function is TA STEVE'I, where STEVE is the name of the function and
I is the vector specifying the statement numbers to be traced. For example, if
TA STEVEc2 3 5 is entered, the statements 2, 3, and 5 are traced each time
function STEVE is executed. TA STEVEtiO must be entered to discontinlie
the tracing of function STEVE. To trace each statement of the function, enter
TA STEVEciN, where N is the number of statements in the function:
1 52
Trace control can also be set by statements within a function. These statements
initiate tracing when a variable contains a certain value. For example:
Note: The following instruction will establish trace control for the first statement
of each user-defined function in the active workspace:
This instruction can be used to find out what functions are called by another
The following user-defined function named TRACE will establish a trace vector
for each statement in a specified user-defined function:
Previous Page Next Page