xerror package routines
XERROR or
XERRWV
can be obtained or manipulated by these S-PLUS functions.
xerror.summary
outputs the internal table of error messages encountered, together with
their error number, severity level and occurrence counts.
xerror.clear
will
clear, and optionally output the internal table.
xerror.maxpr limits the
number of times any single error message will be output.
xerror.setfile
establishes one or more of
stderr and
stdout
to receive
xerror generated output.
xerror.summary() xerror.clear(doprint=F) xerror.maxpr(times=10) xerror.setfile(files="stderr")
xerror table of accumulated errors before clearing the table.
In the default case the table is cleared but no output is generated.
times previous
occurences of a message, no output is generated.
stderr or
stdout, specifying the
files to which
xerror generated output will be sent. If
stdout
appears in the vector, then any use of
sink(filename) will cause
xerror messages destined for
stdout to appear in
filename.
xerror.setfiles returns any value: a vector of integers designating
the currently open
xerror output files: 0 --
stderr, 1 --
stdout.
From within S-PLUS the actions and tables of the adapted
xerror package can be
controlled and accessed by the functions listed above under
xerror.
T the table is printed
before it is cleared.
times the number of times any specific message will be queued or
printed. The initial (default) value for
times is 10.
The internal table is still updated after
times occurences of
a message, but no output is generated.
xerror messages will be sent.
options()$warn and the severity level of the particular message,
as shown in the following table:
warn
type level 0 1 2
value
fatal 2 stop stop stop
recover 1 not printed* printed stop
warning 0 not printed* printed printed
single -1 not printed** printed printed
warn only once only once
* -- message passed to S-PLUS warning queue
** -- message passed once to S-PLUS warning queue
When messages are passed to the S-PLUS
warning queue,
they may be printed at the termination of the outer-most S-PLUS function.
Note that
recover level messages are promoted to
fatal when
warn is 2 or -2. Also all output is suppressed if
warn is negative.
In addition, no single message will be printed (or passed to the warning
queue) more than
maxpr times.
XERROR,
XERRWV and
the SLATEC
xerror package for further details.
Jones R. E., Kahaner D. K., Xerror, the Slatec Error-Handling Package,
sand82-0800, Sandia Laboratories, 1982.
Netlib reference.
#normal use of xerror.clear and xerror.summary to
#control a subroutine package that uses 'xerror' control
function(arg1,.....) {
#process args
...
xerror.clear() #initialize the error tables
#invoke the routines using 'xerror' or 'xerrwv'
.Fortran("routinename",...)
...
#if errors have been hidden, print summary
if(options()$warn==0) xerror.summary()
...
}