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

NAME

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

SYNOPSIS

12       #include <tcl.h>
13
14       void
15       Tcl_Panic(format, arg, arg, ...)
16
17       void
18       Tcl_PanicVA(format, argList)
19
20       void
21       Tcl_SetPanicProc(panicProc)
22
23       void
24       panic(format, arg, arg, ...)
25
26       void
27       panicVA(format, argList)
28
29

ARGUMENTS

31       CONST char*     format       (in)      A printf-style format string.
32
33                       arg          (in)      Arguments  matching  the  format
34                                              string.
35
36       va_list         argList      (in)      An  argument  list  of arguments
37                                              matching  the   format   string.
38                                              Must have been initialized using
39                                              TCL_VARARGS_START,  and  cleared
40                                              using va_end.
41
42       Tcl_PanicProc   *panicProc   (in)      Procedure  to report fatal error
43                                              message and abort.
44
45_________________________________________________________________
46
47

DESCRIPTION

49       When the Tcl library detects that its internal data structures  are  in
50       an  inconsistent  state, or that its C procedures have been called in a
51       manner inconsistent with their documentation,  it  calls  Tcl_Panic  to
52       display a message describing the error and abort the process.  The for‐
53       mat argument is a format string describing how to format the  remaining
54       arguments  arg  into an error message, according to the same formatting
55       rules used by the printf family  of  functions.   The  same  formatting
56       rules are also used by the builtin Tcl command format.
57
58       In  a  freshly loaded Tcl library, Tcl_Panic prints the formatted error
59       message to the standard error file of the process, and then calls abort
60       to terminate the process.  Tcl_Panic does not return.
61
62       Tcl_SetPanicProc  may be used to modify the behavior of Tcl_Panic.  The
63       panicProc argument should match the type Tcl_PanicProc:
64
65              typedef void Tcl_PanicProc(
66                CONST char *format,
67                arg, arg,...);
68
69       After Tcl_SetPanicProc returns, any future calls to Tcl_Panic will call
70       panicProc,  passing  along  the  format and arg arguments.  To maintain
71       consistency with the callers of Tcl_Panic, panicProc must  not  return;
72       it  must  call abort.  panicProc should avoid making calls into the Tcl
73       library, or into other libraries that may call the Tcl  library,  since
74       the  original  call  to Tcl_Panic indicates the Tcl library is not in a
75       state of reliable operation.
76
77       The typical use of Tcl_SetPanicProc arranges for the error  message  to
78       be  displayed or reported in a manner more suitable for the application
79       or the platform.  As an example, the  Windows  implementation  of  wish
80       calls Tcl_SetPanicProc to force all panic messages to be displayed in a
81       system dialog box, rather than to be printed to the standard error file
82       (usually not visible under Windows).
83
84       Although the primary callers of Tcl_Panic are the procedures of the Tcl
85       library, Tcl_Panic is a public function and may be called by any exten‐
86       sion  or  application that wishes to abort the process and have a panic
87       message displayed the same way that panic messages  from  Tcl  will  be
88       displayed.
89
90       Tcl_PanicVA  is  the  same as Tcl_Panic except that instead of taking a
91       variable number of arguments it takes an argument list.  The procedures
92       panic  and  panicVA  are synonyms (implemented as macros) for Tcl_Panic
93       and Tcl_PanicVA, respectively.  They exist to  support  old  code;  new
94       code should use direct calls to Tcl_Panic or Tcl_PanicVA.
95
96

SEE ALSO

98       abort(3), printf(3), exec(n), format(n)
99
100

KEYWORDS

102       abort, fatal, error
103
104
105
106
107Tcl                                   8.4                         Tcl_Panic(3)
Impressum