Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/doc/Panic.3 @ 25

Last change on this file since 25 was 25, checked in by landauf, 16 years ago

added tcl to libs

File size: 3.5 KB
Line 
1'\"
2'\" See the file "license.terms" for information on usage and redistribution
3'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
4'\"
5'\" RCS: @(#) $Id: Panic.3,v 1.8 2005/09/13 21:23:51 dgp Exp $
6'\"
7.so man.macros
8.TH Tcl_Panic 3 8.4 Tcl "Tcl Library Procedures"
9.BS
10'\"  Note:  do not modify the .SH NAME line immediately below!
11.SH NAME
12Tcl_Panic, Tcl_PanicVA, Tcl_SetPanicProc \- report fatal error and abort
13.SH SYNOPSIS
14.nf
15\fB#include <tcl.h>\fR
16.sp
17void
18\fBTcl_Panic\fR(\fIformat\fR, \fIarg\fR, \fIarg\fR, \fI...\fR)
19.sp
20void
21\fBTcl_PanicVA\fR(\fIformat\fR, \fIargList\fR)
22.sp
23void
24\fBTcl_SetPanicProc\fR(\fIpanicProc\fR)
25.sp
26.SH ARGUMENTS
27.AS Tcl_PanicProc *panicProc
28.AP "const char*" format in
29A printf-style format string.
30.AP "" arg in
31Arguments matching the format string.
32.AP va_list argList in
33An argument list of arguments matching the format string.
34Must have been initialized using \fBva_start\fR,
35and cleared using \fBva_end\fR.
36.AP Tcl_PanicProc *panicProc in
37Procedure to report fatal error message and abort.
38
39.BE
40
41.SH DESCRIPTION
42.PP
43When the Tcl library detects that its internal data structures are in an
44inconsistent state, or that its C procedures have been called in a
45manner inconsistent with their documentation, it calls \fBTcl_Panic\fR
46to display a message describing the error and abort the process.  The
47\fIformat\fR argument is a format string describing how to format the
48remaining arguments \fIarg\fR into an error message, according to the
49same formatting rules used by the \fBprintf\fR family of functions.  The
50same formatting rules are also used by the built-in Tcl command
51\fBformat\fR.
52.PP
53In a freshly loaded Tcl library, \fBTcl_Panic\fR prints the formatted
54error message to the standard error file of the process, and then
55calls \fBabort\fR to terminate the process.  \fBTcl_Panic\fR does not
56return.
57.PP
58\fBTcl_SetPanicProc\fR may be used to modify the behavior of
59\fBTcl_Panic\fR.  The \fIpanicProc\fR argument should match the
60type \fBTcl_PanicProc\fR:
61.PP
62.CS
63typedef void Tcl_PanicProc(
64        const char *\fBformat\fR,
65        \fBarg\fR, \fBarg\fR,...);
66.CE
67.PP
68After \fBTcl_SetPanicProc\fR returns, any future calls to
69\fBTcl_Panic\fR will call \fIpanicProc\fR, passing along the
70\fIformat\fR and \fIarg\fR arguments.  To maintain consistency with the
71callers of \fBTcl_Panic\fR, \fIpanicProc\fR must not return; it must
72call \fBabort\fR.  \fIpanicProc\fR should avoid making calls into the
73Tcl library, or into other libraries that may call the Tcl library,
74since the original call to \fBTcl_Panic\fR indicates the Tcl library is
75not in a state of reliable operation. 
76.PP
77The typical use of \fBTcl_SetPanicProc\fR arranges for the error message
78to be displayed or reported in a manner more suitable for the
79application or the platform.  As an example, the Windows implementation
80of \fBwish\fR calls \fBTcl_SetPanicProc\fR to force all panic messages
81to be displayed in a system dialog box, rather than to be printed to the
82standard error file (usually not visible under Windows).
83.PP
84Although the primary callers of \fBTcl_Panic\fR are the procedures of
85the Tcl library, \fBTcl_Panic\fR is a public function and may be called
86by any extension or application that wishes to abort the process and
87have a panic message displayed the same way that panic messages from Tcl
88will be displayed.
89.PP
90\fBTcl_PanicVA\fR is the same as \fBTcl_Panic\fR except that instead of
91taking a variable number of arguments it takes an argument list.
92
93.SH "SEE ALSO"
94abort(3), printf(3), exec(n), format(n)
95
96.SH KEYWORDS
97abort, fatal, error
98
Note: See TracBrowser for help on using the repository browser.