1Tcl_Panic(3) Tcl Library Procedures Tcl_Panic(3)
2
3
4
5______________________________________________________________________________
6
8 Tcl_Panic, Tcl_PanicVA, Tcl_SetPanicProc - report fatal error and abort
9
11 #include <tcl.h>
12
13 void
14 Tcl_Panic(format, arg, arg, ...)
15
16 void
17 Tcl_PanicVA(format, argList)
18
19 void
20 Tcl_SetPanicProc(panicProc)
21
22
24 const char* format (in) A printf-style format string.
25
26 arg (in) Arguments matching the format
27 string.
28
29 va_list argList (in) An argument list of arguments
30 matching the format string.
31 Must have been initialized using
32 va_start, and cleared using
33 va_end.
34
35 Tcl_PanicProc *panicProc (in) Procedure to report fatal error
36 message and abort.
37
38_________________________________________________________________
39
40
42 When the Tcl library detects that its internal data structures are in
43 an inconsistent state, or that its C procedures have been called in a
44 manner inconsistent with their documentation, it calls Tcl_Panic to
45 display a message describing the error and abort the process. The for‐
46 mat argument is a format string describing how to format the remaining
47 arguments arg into an error message, according to the same formatting
48 rules used by the printf family of functions. The same formatting
49 rules are also used by the built-in Tcl command format.
50
51 In a freshly loaded Tcl library, Tcl_Panic prints the formatted error
52 message to the standard error file of the process, and then calls abort
53 to terminate the process. Tcl_Panic does not return.
54
55 Tcl_SetPanicProc may be used to modify the behavior of Tcl_Panic. The
56 panicProc argument should match the type Tcl_PanicProc:
57
58 typedef void Tcl_PanicProc(
59 const char *format,
60 arg, arg,...);
61
62 After Tcl_SetPanicProc returns, any future calls to Tcl_Panic will call
63 panicProc, passing along the format and arg arguments. To maintain
64 consistency with the callers of Tcl_Panic, panicProc must not return;
65 it must call abort. panicProc should avoid making calls into the Tcl
66 library, or into other libraries that may call the Tcl library, since
67 the original call to Tcl_Panic indicates the Tcl library is not in a
68 state of reliable operation.
69
70 The typical use of Tcl_SetPanicProc arranges for the error message to
71 be displayed or reported in a manner more suitable for the application
72 or the platform. As an example, the Windows implementation of wish
73 calls Tcl_SetPanicProc to force all panic messages to be displayed in a
74 system dialog box, rather than to be printed to the standard error file
75 (usually not visible under Windows).
76
77 Although the primary callers of Tcl_Panic are the procedures of the Tcl
78 library, Tcl_Panic is a public function and may be called by any exten‐
79 sion or application that wishes to abort the process and have a panic
80 message displayed the same way that panic messages from Tcl will be
81 displayed.
82
83 Tcl_PanicVA is the same as Tcl_Panic except that instead of taking a
84 variable number of arguments it takes an argument list.
85
86
88 abort(3), printf(3), exec(n), format(n)
89
90
92 abort, fatal, error
93
94
95
96
97Tcl 8.4 Tcl_Panic(3)