4 * Source code for the "panic" library procedure for Tcl;
5 * individual applications will probably override this with
6 * an application-specific panic procedure.
8 * Copyright (c) 1988-1993 The Regents of the University of California.
9 * Copyright (c) 1994 Sun Microsystems, Inc.
11 * See the file "license.terms" for information on usage and redistribution
12 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
19 # include "../compat/stdlib.h"
24 #define panic panicDummy
28 # undef TCL_STORAGE_CLASS
29 # define TCL_STORAGE_CLASS DLLEXPORT
31 EXTERN void panic _ANSI_ARGS_((char *format, char *arg1,
32 char *arg2, char *arg3, char *arg4, char *arg5,
33 char *arg6, char *arg7, char *arg8));
36 * The panicProc variable contains a pointer to an application
37 * specific panic procedure.
40 void (*panicProc) _ANSI_ARGS_(TCL_VARARGS(char *,format)) = NULL;
43 *----------------------------------------------------------------------
47 * Replace the default panic behavior with the specified functiion.
53 * Sets the panicProc variable.
55 *----------------------------------------------------------------------
59 Tcl_SetPanicProc(proc)
60 void (*proc) _ANSI_ARGS_(TCL_VARARGS(char *,format));
66 *----------------------------------------------------------------------
70 * Print an error message and kill the process.
76 * The process dies, entering the debugger if possible.
78 *----------------------------------------------------------------------
81 /* VARARGS ARGSUSED */
83 panic(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
84 char *format; /* Format string, suitable for passing to
86 char *arg1, *arg2, *arg3; /* Additional arguments (variable in number)
87 * to pass to fprintf. */
88 char *arg4, *arg5, *arg6, *arg7, *arg8;
90 if (panicProc != NULL) {
91 (void) (*panicProc)(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
93 (void) fprintf(stderr, format, arg1, arg2, arg3, arg4, arg5, arg6,
95 (void) fprintf(stderr, "\n");
96 (void) fflush(stderr);