NAME
nst_error - routines for NST diagnostics
PROTOTYPES
void nst_message(int iLevel, const char *pcErr, ...)
void nst_warning(const char *pcErr, ...)
void nst_error(const char *pcErr, ...)
ARGUMENTS
- int iLevel
- print threshold for this message
- const char *pcErr
- format string, see below
- ...
- further arguments
DESCRIPTION:
All three functions print the value(s) specified in their parameter list.
The parameter(s) are treated in the same way as by the usual
C-printf function. The only difference is that the resulting output
string is not sent to stdout but is instead passed to NST's
error handler routine (This is by default the routine
fprintf(stderr,"%s",.), but it can be set to a user-specified
error handle by calling the function nst_set_errorhandler()).
To facilitate the printing of diagnostics, three non-standard
format tokens are recognized in the format string pcFmt:
- %L
- is equivalent to one of the strings
"Line #X ", "Warning in line #X "
"Error in line #X " (depending on which
routine was chosen),
where in all three cases X is
replaced by the value of ERROR_LINE.
- %F
- is equivalent to "of file X", where
X will be replaced by value of ERROR_FILE
- %S
- is equivalent to %Li%F(routine %s),
and consumes one string argument for %s
EXAMPLE:
fValue = 4.56;
ERROR_LINE = 124;
ERROR_FILE = "TheFile";
nst_warning("%S:\nargument %d has illegal value (=%g)!",
"funnybug",2,fValue);
will produce a warning text
Warning in Line 124 of file "TheFile" (routine "funnybug"):
argument 2 has illegal value (=4.56)
Note that usually the setting of
the variables ERROR_LINE and ERROR_FILE occurs usually automatically
by NST and has been made explicit here only for the sake of the example.
SEE ALSO:
nst_error_handler
FILE
/local/homes/rhaschke/nst7/man/../o.linx86//../nstsrc/nst_dbug.c