Tron, Troff Command

Purpose

Lists commands during program execution.

Syntax

Tron procedure

Troff

Description

The Tron command (TRACE On) causes each command that follows it to be redirected to the specified procedure. The procedure is executed before each command. Troff switches the redirection off. In the Tron procedure the following variables are available to inspect the program.

TraceLnr Returns the current program line.
Trace$ Returns the source code text of the current line
TraceReg Returns the processor register in the pseudo register variables _EAX, _ECX, etc. (8 registers)
SrcCode$(n) Returns the specified source code line n.
ProcLnr(procname) Returns the first line number of the specified subroutine (Procedure/Sub/Function).
ProcLineCnt(procname) Returns the number of lines of the specified subroutine (Procedure/Sub/Function).

Example

Local i%

OpenW # 1 : Debug.Show

Print "Test program"

Tron db

For i% = 1 To 5

Print Sin(i%)

Next i%

Troff

Print "Program end"

 

Proc db

Debug.Print Trace$

// In the Debug output window each line (Trace$) is displayed.

EndProc

Remarks

The Troff turns the Tron off.

See Also

Debug, Trace, TraceLnr, TraceReg, SrcCode$, ProcLnr, ProcLineCnt

{Created by Sjouke Hamstra; Last updated: 11/05/2021 by James Gaite; Other Contributors: Jean-Marie Melanson}