Please enable JavaScript to view this site.

A-Shell Development History

Compiler/language (edit 861) and runtime tracing enhancement: syntax for the xxxxxx.PRINT and xxxxxx.PAUSE statements (e.g. TRACE.PRINT, DEBUG.PAUSE) expanded to support a debug level, selection tags, multiple expressions, and automatic labeling of traced variables.

<TRACE|DEBUG>.<PRINT|PAUSE> {({level},{tags})} expr1{,expr2,...,exprN}

The optional (level, tags) clause may be used to specify the minimum debug level needed to activate this trace, and/or a list of tags that can be used for selecting or filtering which of these statements is enabled at runtime. If not specified, the default level is 0 for TRACE.xxx and 1 for DEBUG.xxx. Tags, if specified, must be in the form of a string literal (quoted) comma-delimited list of case (not case sensitive). Some examples:

debug.print "var1"=var1

trace.print (1) "var1"=var1

debug.print ("beta,i/o,2.0") var3,var4

trace.pause (27,"fn'foo,alpha") "total="+totx

 

The first example demonstrates the prior syntax and the fact that the new clauses are entirely optional.

The second example uses the new clause to specify a debug level of 1, which makes the trace.print equivalent to debug.print (illustrating that the only difference between trace.xxx and debug.xxx is the default debug level). It also illustrates that you can specify just the level without the tags argument.

The third example illustrates the use of a tags list without an explicit level (which defaults to 1 for debug.print). It also illustrates the use of multiple values (i.e. a comma delimited list of values, as allowed in a normal PRINT statement). Although not obvious from the syntax, another enhancement in this release is that any variable appearing by itself as a term in the expression list will automatically be prefixed by a label indicating the name of the variable being traced. In other words, if var3=30 and var4="foo", then the trace will look something like: "var3=[30], var4=[foo]". Note that these automatic print labels are only created for variables that appear as terms by themselves in the list of expressions to trace.

The last example shows the case where both a level (27) and a set of tags "fn'foo,alpha" are specified. Note that the totx in the expression list will not get an automatic label because it is already part of a string expression.

Backwards compatibility note: while the new tracing capabilities do rely partly on updates to the runtime system, programs using the new syntax and compiled with the new compiler will remain compatible with older runtimes. (The output will not be as pretty, and the level and tags arguments will display at the end of each output line, but they won't otherwise interfere.)