Tcl Library Procedures TclPanic(3TCL)
NAME
TclPanic, TclPanicVA, TclSetPanicProc, panic, panicVA -
report fatal error and abort
SYNOPSIS
#include
void
TclPanic(format, arg, arg, ...)
void
TclPanicVA(format, argList)
void
TclSetPanicProc(panicProc)
void
panic(format, arg, arg, ...)
void
panicVA(format, argList)
ARGUMENTS
CONST char* format (in) A printf-style format
string.
arg (in) Arguments matching
the format string.
valist argList (in) An argument list of
arguments matching
the format string.
Must have been ini-
tialized using
TCLVARARGSTART,
and cleared using
vaend.
TclPanicProc *panicProc (in) Procedure to report
fatal error message
and abort.
DESCRIPTION
When the Tcl library detects that its internal data struc-
tures are in an inconsistent state, or that its C procedures
have been called in a manner inconsistent with their
Tcl Last change: 8.4 1
Tcl Library Procedures TclPanic(3TCL)
documentation, it calls TclPanic to display a message
describing the error and abort the process. The format
argument is a format string describing how to format the
remaining arguments arg into an error message, according to
the same formatting rules used by the printf family of func-
tions. The same formatting rules are also used by the buil-
tin Tcl command format.
In a freshly loaded Tcl library, TclPanic prints the for-
matted error message to the standard error file of the pro-
cess, and then calls abort to terminate the process.
TclPanic does not return.
TclSetPanicProc may be used to modify the behavior of
TclPanic. The panicProc argument should match the type
TclPanicProc:
typedef void TclPanicProc(
CONST char *format,
arg, arg,...);
After TclSetPanicProc returns, any future calls to
TclPanic will call panicProc, passing along the format and
arg arguments. To maintain consistency with the callers of
TclPanic, panicProc must not return; it must call abort.
panicProc should avoid making calls into the Tcl library, or
into other libraries that may call the Tcl library, since
the original call to TclPanic indicates the Tcl library is
not in a state of reliable operation.
The typical use of TclSetPanicProc arranges for the error
message to be displayed or reported in a manner more suit-
able for the application or the platform. As an example,
the Windows implementation of wish calls TclSetPanicProc to
force all panic messages to be displayed in a system dialog
box, rather than to be printed to the standard error file
(usually not visible under Windows).
Although the primary callers of TclPanic are the procedures
of the Tcl library, TclPanic is a public function and may
be called by any extension or application that wishes to
abort the process and have a panic message displayed the
same way that panic messages from Tcl will be displayed.
TclPanicVA is the same as TclPanic except that instead of
taking a variable number of arguments it takes an argument
list. The procedures panic and panicVA are synonyms (imple-
mented as macros) for TclPanic and TclPanicVA, respec-
tively. They exist to support old code; new code should use
direct calls to TclPanic or TclPanicVA.
Tcl Last change: 8.4 2
Tcl Library Procedures TclPanic(3TCL)
SEE ALSO
abort(3TCL), printf(3TCL), exec(1T), format(1T)
KEYWORDS
abort, fatal, error
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Availability SUNWTcl
Interface Stability Uncommitted
NOTES
Source for Tcl is available on http:/opensolaris.org.
Tcl Last change: 8.4 3
|