Clear an error condition
_clear_error ()
This function may be used in error-blocks to clear the error that triggered execution of the error block. Execution resumes following the statement, in the scope of the error-block, that triggered the error.
Consider the following wrapper around the putenv
function:
define try_putenv (name, value)
{
variable status;
ERROR_BLOCK
{
_clear_error ();
status = -1;
}
status = 0;
putenv (sprintf ("%s=%s", name, value);
return status;
}
If putenv
fails, it generates an error condition, which the
try_putenv
function catches and clears. Thus try_putenv
is a function that returns -1
upon failure and 0
upon
success.
_trace_function, _slangtrace, _traceback
Configure debugging information
Integer_Type _debug_info
The _debug_info
variable controls whether or not extra code
should be generated for additional debugging and traceback
information. Currently, if _debug_info
is zero, no extra code
will be generated; otherwise extra code will be inserted into the
compiled bytecode for additional debugging data.
The value of this variable is is local to each compilation unit and setting its value in one unit has no effect upon its value in other units.
_debug_info = 1; % Enable debugging information
Setting this variable to a non-zero value may slow down the interpreter somewhat.
_traceback, _slangtrace
Turn function tracing on or off.
Integer_Type _slangtrace
The _slangtrace
variable is a debugging aid that when set to a
non-zero value enables tracing when function declared by
_trace_function
is entered. If the value is greater than
zero, both intrinsic and user defined functions will get traced.
However, if set to a value less than zero, intrinsic functions will
not get traced.
_trace_function, _traceback, _print_stack
Set the function to trace
_trace_function (String_Type f)
_trace_function
declares that the S-lang function with name
f
is to be traced when it is called. Calling
_trace_function
does not in itself turn tracing on. Tracing
is turned on only when the variable _slangtrace
is non-zero.
_slangtrace, _traceback
Generate a traceback upon error
Integer_Type _traceback
_traceback
is an intrinsic integer variable whose value
controls whether or not a traceback of the call stack is to be
generated upon error. If _traceback
is greater than zero, a
full traceback will be generated, which includes the values of local
variables. If the value is less than zero, a traceback will be
generated without local variable information, and if
_traceback
is zero the traceback will not be generated.
Local variables are represented in the form $n
where n
is an
integer numbered from zero. More explicitly, $0
represents the
first local variable, $1
represents the second, and so on.
Please note that function parameters are local variables and that the
first parameter corresponds to $0
.
_slangtrace, error