Fork me on GitHub

source: git/external/tcl/panic.c@ a0f5d71

3.4.3pre03
Last change on this file since a0f5d71 was d7d2da3, checked in by pavel <pavel@…>, 12 years ago

move branches/ModularDelphes to trunk

  • Property mode set to 100644
File size: 2.4 KB
RevLine 
[d7d2da3]1/*
2 * panic.c --
3 *
4 * Source code for the "panic" library procedure for Tcl;
5 * individual applications will probably override this with
6 * an application-specific panic procedure.
7 *
8 * Copyright (c) 1988-1993 The Regents of the University of California.
9 * Copyright (c) 1994 Sun Microsystems, Inc.
10 *
11 * See the file "license.terms" for information on usage and redistribution
12 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 *
14 * RCS: @(#) $Id: panic.c,v 1.1 2008-06-04 13:58:02 demin Exp $
15 */
16
17#include <stdio.h>
18#ifdef NO_STDLIB_H
19# include "../compat/stdlib.h"
20#else
21# include <stdlib.h>
22#endif
23
24#define panic panicDummy
25#include "tcl.h"
26#undef panic
27
28# undef TCL_STORAGE_CLASS
29# define TCL_STORAGE_CLASS DLLEXPORT
30
31EXTERN void panic _ANSI_ARGS_((char *format, char *arg1,
32 char *arg2, char *arg3, char *arg4, char *arg5,
33 char *arg6, char *arg7, char *arg8));
34
35/*
36 * The panicProc variable contains a pointer to an application
37 * specific panic procedure.
38 */
39
40void (*panicProc) _ANSI_ARGS_(TCL_VARARGS(char *,format)) = NULL;
41
42
43/*
44 *----------------------------------------------------------------------
45 *
46 * Tcl_SetPanicProc --
47 *
48 * Replace the default panic behavior with the specified functiion.
49 *
50 * Results:
51 * None.
52 *
53 * Side effects:
54 * Sets the panicProc variable.
55 *
56 *----------------------------------------------------------------------
57 */
58
59void
60Tcl_SetPanicProc(proc)
61 void (*proc) _ANSI_ARGS_(TCL_VARARGS(char *,format));
62{
63 panicProc = proc;
64}
65
66
67/*
68 *----------------------------------------------------------------------
69 *
70 * panic --
71 *
72 * Print an error message and kill the process.
73 *
74 * Results:
75 * None.
76 *
77 * Side effects:
78 * The process dies, entering the debugger if possible.
79 *
80 *----------------------------------------------------------------------
81 */
82
83 /* VARARGS ARGSUSED */
84void
85panic(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
86 char *format; /* Format string, suitable for passing to
87 * fprintf. */
88 char *arg1, *arg2, *arg3; /* Additional arguments (variable in number)
89 * to pass to fprintf. */
90 char *arg4, *arg5, *arg6, *arg7, *arg8;
91{
92 if (panicProc != NULL) {
93 (void) (*panicProc)(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
94 } else {
95 (void) fprintf(stderr, format, arg1, arg2, arg3, arg4, arg5, arg6,
96 arg7, arg8);
97 (void) fprintf(stderr, "\n");
98 (void) fflush(stderr);
99 abort();
100 }
101}
Note: See TracBrowser for help on using the repository browser.