|
|
1.1 root 1: #ifndef lint
2: static char rcsid[] = "$Header: Error.c,v 1.3 87/09/11 21:19:06 haynes Rel $";
3: #endif lint
4:
5: /*
6: * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
7: *
8: * All Rights Reserved
9: *
10: * Permission to use, copy, modify, and distribute this software and its
11: * documentation for any purpose and without fee is hereby granted,
12: * provided that the above copyright notice appear in all copies and that
13: * both that copyright notice and this permission notice appear in
14: * supporting documentation, and that the name of Digital Equipment
15: * Corporation not be used in advertising or publicity pertaining to
16: * distribution of the software without specific, written prior permission.
17: *
18: *
19: * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
20: * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
21: * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
22: * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
23: * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
24: * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
25: * SOFTWARE.
26: */
27: #include "Xlib.h"
28: #include <stdio.h>
29: #include "Intrinsic.h"
30:
31: void _XtError (message)
32: String message;
33: {
34: extern void exit();
35: (void) fprintf(stderr, "X Toolkit Error: %s\n", message);
36: exit(1);
37: }
38:
39: void _XtWarning (message)
40: String message;
41: { (void) fprintf(stderr, "X Toolkit Warning: %s\n", message); }
42:
43: static void (*errorFunction)() = _XtError;
44: static void (*warningFunction)() = _XtWarning;
45:
46: void XtError(message) String message; { (*errorFunction)(message); }
47:
48: void XtWarning(message) String message; { (*warningFunction)(message); }
49:
50: void XtSetErrorHandler(handler)
51: register void (*handler)();
52: {
53: if (handler != NULL) errorFunction = handler;
54: else errorFunction = _XtError;
55: }
56:
57:
58: void XtSetWarningHandler(handler)
59: register void (*handler)();
60: {
61: if (handler != NULL) warningFunction = handler;
62: else warningFunction = _XtWarning;
63: }
64:
65:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.