next up previous contents index
Next: Index Up: Trace Previous: name,shortName   Contents   Index


traceActivate,traceStop


Usage

traceActivate()
traceActivate(abbr?)
traceStop()


Signatures

traceActivate: Boolean $\to$ ()
traceStop: () $\to$ ()


Parameter Type Description
abbr? Boolean A flag to control type names (optional)


Description

Tracing of functions from source files compiled with the -Wdebug option is enabled between calls to traceActivate() and traceStop(). If abbr? is missing or false, then full type names are printed, otherwise the arguments to types are not printed, see name for details.


Example

Suppose that foo.as contains the following code:
#include "aldor"
#include "aldorio"

local fact(n:Integer):Integer == {
    assert(n >= 0);
    zero? n or one? n => 1;
    n * fact(n-1);
}

main():() == {
    import from Boolean, Integer, Trace;
    traceActivate();
    stdout << "5! = " << fact 5 << newline;
    traceStop();
    stdout << "20! = " << fact 20 << newline;
}

main();
Compiling and running it with aldor -grun -Wdebug -laldor foo.as yields the following output:
{Line: 7 Entering: fact
{Line: 7 Entering: fact
{Line: 7 Entering: fact
{Line: 7 Entering: fact
{Line: 7 Entering: fact
Line: 11 Return: AldorInteger is: 1}
Line: 11 Return: AldorInteger is: 2}
Line: 11 Return: AldorInteger is: 6}
Line: 11 Return: AldorInteger is: 24}
Line: 11 Return: AldorInteger is: 120}
5! = 120
20! = 2432902008176640000
Note that the call to fact 20 is not traced because it is done after the call to traceStop().



Manuel Bronstein 2004-06-28