Please enable JavaScript to view this site.

A-Shell Development History

Compiler enhancement (included in edit 861) : new ++PRAGMAs to support enhanced tracing:

++PRAGMA TRACE_BEGIN {optionlist}

++PRAGMA TRACE.END {optionlist}

++PRAGMA TRACE.OPTIONS  optionlist}

TRACE_BEGIN and TRACE_END may be used to bracket a section of code for which automatic TRACE.PRINT statements will be generated after each program statement. Each auto-generated trace will consist of two lines: first the source code, then the trace of the variables in that statement. Note that not all statements will be traced; primarily it is limited to those statements which operate on variables. Also note that the trace generally occurs after the statement execution, which means that function and procedure call statements show up in the trace output after the routine returns. IF statements are an exception in that they get traced prior to execution (so you can see the IF statement regardless of whether the condition is true or false).

TRACE_BEGIN / TRACE_END blocks cannot be nested, but a TRACE_BEGIN doesn't necessarily require a corresponding TRACE_END (the end of the source code will imply as much). This allows you to simply insert a ++PRAGMA TRACE_BEGIN anywhere in a program, including the very top, to trace everything from that point on.

The TRACE_OPTIONS pragma only establishes default options for subsequent manually typed xxxxx.PRINT and xxxxx.PAUSE statements (except for those which already include their own explicit options).

The optionlist, which is optional in all three cases, consists of:

(dbglvl, tags, prefix)

Each field is itself optional, although in order to specify a subsequent field, you must specify the prior ones. The parentheses are optional if only the dbglvl field is specified; otherwise they are mandatory.

dbglvl sets the debug level for the statement; the higher the level, the higher the corresponding DEBUG system variable must be in order to activate the statement.

tags is a quoted literal string consisting of comma-delimited symbols to be associated with each xxxxx.PRINT or xxxxx.PAUSE statement.

prefix is a quoted literal string which, if specified, is inserted at the start of each xxxxx.PRINT / xxxxx.PAUSE statement, typically used to specify macros like $#, $T, $P, $L, etc. It comes in handy in situations where you already have a lot of xxxxx.PRINT statement in the program, but are having trouble identifying them in the trace output. Rather than manually modifying each statement to include additional contextual identifiers, you could simply specify ++PRAGMA TRACE_OPTIONS (0,"","$L") to insert the location counter into each trace.

For all three PRAGMAs, the optionlist establishes the default options for subsequent manual or auto-generated xxxxx.PRINT statements.