OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tcl/] [generic/] [panic.c] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/*
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.1.1 2002-01-16 10:25:25 markom 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
 
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));
34
 
35
/*
36
 * The panicProc variable contains a pointer to an application
37
 * specific panic procedure.
38
 */
39
 
40
void (*panicProc) _ANSI_ARGS_(TCL_VARARGS(char *,format)) = NULL;
41
 
42
/*
43
 *----------------------------------------------------------------------
44
 *
45
 * Tcl_SetPanicProc --
46
 *
47
 *      Replace the default panic behavior with the specified functiion.
48
 *
49
 * Results:
50
 *      None.
51
 *
52
 * Side effects:
53
 *      Sets the panicProc variable.
54
 *
55
 *----------------------------------------------------------------------
56
 */
57
 
58
void
59
Tcl_SetPanicProc(proc)
60
    void (*proc) _ANSI_ARGS_(TCL_VARARGS(char *,format));
61
{
62
    panicProc = proc;
63
}
64
 
65
/*
66
 *----------------------------------------------------------------------
67
 *
68
 * panic --
69
 *
70
 *      Print an error message and kill the process.
71
 *
72
 * Results:
73
 *      None.
74
 *
75
 * Side effects:
76
 *      The process dies, entering the debugger if possible.
77
 *
78
 *----------------------------------------------------------------------
79
 */
80
 
81
        /* VARARGS ARGSUSED */
82
void
83
panic(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
84
    char *format;               /* Format string, suitable for passing to
85
                                 * fprintf. */
86
    char *arg1, *arg2, *arg3;   /* Additional arguments (variable in number)
87
                                 * to pass to fprintf. */
88
    char *arg4, *arg5, *arg6, *arg7, *arg8;
89
{
90
    if (panicProc != NULL) {
91
        (void) (*panicProc)(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
92
    } else {
93
        (void) fprintf(stderr, format, arg1, arg2, arg3, arg4, arg5, arg6,
94
                arg7, arg8);
95
        (void) fprintf(stderr, "\n");
96
        (void) fflush(stderr);
97
        abort();
98
    }
99
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.