<* TRACE trace-proc *>
The TRACE pragma may appear at the end of any variable or formal declaration. This pragma will generate tracing calls whenever the declared variable is modified. The trace-proc must evaluate to a procedure of two arguments. The first argument is the name of the traced variable, a TEXT. The second argument is the traced variable. Note that any of the formal passing modes may be used with the second argument.
The pragma <*TRACE stmt-list*> may appear immediately after any BEGIN. The specified "stmt-list" will be inserted after each statement of the block started by the BEGIN.
MODULE M; VAR x: Foo <* TRACE MyTrace.FooChanged *>;
will cause
MyTrace.FooChanged ("M.x", x)
to be generated after each statement that modifies x. Variable aliasing is not tracked, so
WITH alias = x DO INC(alias) END
will not generate any tracing.
The fragment:
BEGIN <* TRACE INC(cnt); MyTrace(cnt) *> i := j; j := i; END;
will generate INC(cnt); MyTrace(cnt) after each of the assignment statements.