Trace is a useful debugging tool. We want to introduce you to
Trace at this point because you can see how boolean expressions and other expressions are evaluated.DEFINE Parenth
LET P1 (0,0) {parentheses not necessary}
LET P2 (10,0) {parentheses not necessary}
LET X (1) {parentheses not necessary}
WHILE ( X < 5 ) {parentheses necessary}
LET P1 (P1 + 0,10) {parentheses necessary}
LET P2 (P2 + 0,10) {parentheses necessary}
LINE TWO_PTS P1 P2 END
LET X ( X + 1) {parentheses necessary}
END_WHILE
END_DEFINE
Trace on our macro, and store the results in a file called trace.
Trace, change the second line in parenth from this:LET P1 (0,0)
LET P1 0,0
Trace:
Trace.
Off.
in the status bar indicates that Trace is inactive.|
|
If your trace file is unexpectedly empty or incomplete, you may have forgotten to disable
Trace. |
Trace operation to an existing file:
Trace.
On.
Append.
in the status bar indicates that
Trace is active.
Trace.
On.
New.
in the status bar indicates that
Trace is active.
Trace operation:
Trace.
Edit.
Trace operation are displayed in the standard text editor.Parenth
LET P1 0,0
LET P2 ( 10,0 ) 10,0
LET X ( 1 ) 1
WHILE ( X 1 < 5 ) 1
LET P1 ( P1 0,0 + 0,10 ) 0,10
LET P2 ( P2 10,0 + 0,10 ) 10,10
LINE TWO_PTS P1 0,10 P2 10,10
END
LET X ( X 1 + 1 ) 2
END_WHILE ( X 2 < 5 ) 1
LET P1 ( P1 0,10 + 0,10 ) 0,20
LET P2 ( P2 10,10 + 0,10 ) 10,20
LINE TWO_PTS P1 0,20 P2 10,20
END
LET X ( X 2 + 1 ) 3
END_WHILE ( X 3 < 5 ) 1
LET P1 ( P1 0,20 + 0,10 ) 0,30
LET P2 ( P2 10,20 + 0,10 ) 10,30
LINE TWO_PTS P1 0,30 P2 10,30
END
LET X ( X 3 + 1 ) 4
END_WHILE ( X 4 < 5 ) 1
LET P1 ( P1 0,30 + 0,10 ) 0,40
LET P2 ( P2 10,30 + 0,10 ) 10,40
LINE TWO_PTS P1 0,40 P2 10,40
END
LET X ( X 4 + 1 ) 5
END_WHILE ( X 5 < 5 ) 0
TRACE
LET P1 0,0
WHILE ( X 1 < 5 ) 1
DEFINE Parenth_2
LET P1 (0,0) {parentheses not necessary}
LET P2 (10,0) {parentheses not necessary}
WHILE (1) {parentheses necessary}
LET P1 (P1 + 0,10) {parentheses necessary}
LET P2 (P2 + 0,10) {parentheses necessary}
LINE TWO_PTS P1 P2 END
END_WHILE
END_DEFINE
DEFINE Parenth
LET P1 0,0
LET P2 (10,0)
LET X (5)
WHILE (X)
LET P1 (P1 + 0,10)
LET P2 (P2 + 0,10)
LINE TWO_PTS (P1) (P2) END
LET X ( X - 1)
END_WHILE
DISPLAY_NO_WAIT 'something has changed'
WAIT 3
LET X ( X - 1 )
WHILE (X)
LET P1 (P1 + 0,10)
LET P2 (P2 + 0,10)
LINE (TWO_PTS) P1 P2 END
LET X ( X + 1)
END_WHILE
END_DEFINE