1Tcl_Panic(3)                Tcl Library Procedures                Tcl_Panic(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tcl_Panic, Tcl_PanicVA, Tcl_SetPanicProc - report fatal error and abort
9

SYNOPSIS

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

ARGUMENTS

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

DESCRIPTION

40       When  the  Tcl library detects that its internal data structures are in
41       an inconsistent state, or that its C procedures have been called  in  a
42       manner  inconsistent  with  their  documentation, it calls Tcl_Panic to
43       display a message describing the error and abort the process.  The for‐
44       mat  argument is a format string describing how to format the remaining
45       arguments arg into an error message, according to the  same  formatting
46       rules  used  by  the  printf  family of functions.  The same formatting
47       rules are also used by the built-in Tcl command format.
48
49       In a freshly loaded Tcl library, Tcl_Panic prints the  formatted  error
50       message to the standard error file of the process, and then calls abort
51       to terminate the process.  Tcl_Panic does not return. On Windows,  when
52       a  debugger  is  running,  the  formatted  error message is sent to the
53       debugger in stead. If the windows executable does  not  have  a  stderr
54       channel  (e.g.  wish.exe),  then a system dialog box is used to display
55       the panic message.
56
57       Tcl_SetPanicProc may be used to modify the behavior of Tcl_Panic.   The
58       panicProc argument should match the type Tcl_PanicProc:
59
60              typedef void Tcl_PanicProc(
61                      const char *format,
62                      arg, arg,...);
63
64       After Tcl_SetPanicProc returns, any future calls to Tcl_Panic will call
65       panicProc, passing along the format and arg arguments. panicProc should
66       avoid  making  calls into the Tcl library, or into other libraries that
67       may call the Tcl library, since the original call  to  Tcl_Panic  indi‐
68       cates the Tcl library is not in a 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.
73
74       Although the primary callers of Tcl_Panic are the procedures of the Tcl
75       library, Tcl_Panic is a public function and may be called by any exten‐
76       sion  or  application that wishes to abort the process and have a panic
77       message displayed the same way that panic messages  from  Tcl  will  be
78       displayed.
79
80       Tcl_PanicVA  is  the  same as Tcl_Panic except that instead of taking a
81       variable number of arguments it takes an argument list.
82

SEE ALSO

84       abort(3), printf(3), exec(n), format(n)
85

KEYWORDS

87       abort, fatal, error
88
89
90
91Tcl                                   8.4                         Tcl_Panic(3)
Impressum