1 | /**************************************** |
---|
2 | * Computer Algebra System SINGULAR * |
---|
3 | ****************************************/ |
---|
4 | /*************************************************************** |
---|
5 | * File: dError.c |
---|
6 | * Purpose: implementation for debug error handling |
---|
7 | * Author: obachman (Olaf Bachmann) |
---|
8 | * Created: 9/00 |
---|
9 | * Version: $Id$ |
---|
10 | *******************************************************************/ |
---|
11 | #ifndef DERROR_C |
---|
12 | #define DERROR_C |
---|
13 | |
---|
14 | #include <stdarg.h> |
---|
15 | #include <stdio.h> |
---|
16 | |
---|
17 | #include "config.h" |
---|
18 | |
---|
19 | #include <reporter/reporter.h> |
---|
20 | #ifdef HAVE_CONFIG_H |
---|
21 | #include <omalloc/omalloc.h> |
---|
22 | #endif |
---|
23 | |
---|
24 | #ifndef MAKE_DISTRIBUTION |
---|
25 | // dummy procedure for setting a breakpoint |
---|
26 | // within the debugger |
---|
27 | void dErrorBreak() |
---|
28 | {} |
---|
29 | #endif |
---|
30 | |
---|
31 | int dReportError(const char* fmt, ...) |
---|
32 | { |
---|
33 | va_list ap; |
---|
34 | va_start(ap, fmt); |
---|
35 | #ifndef MAKE_DISTRIBUTION |
---|
36 | fprintf(stderr, "\n// ***dError: "); |
---|
37 | vfprintf(stderr, fmt, ap); |
---|
38 | #if (!defined(NDEBUG)) && (!defined(OM_NDEBUG)) && defined(HAVE_CONFIG_H) |
---|
39 | fprintf(stderr, " occured at: \n"); |
---|
40 | omPrintCurrentBackTraceMax(stderr, 8); |
---|
41 | #endif |
---|
42 | dErrorBreak(); |
---|
43 | #else |
---|
44 | fprintf(stderr, "\n// !!! YOU HAVE FOUND A BUG IN SINGULAR."); |
---|
45 | fprintf(stderr, "// !!! Please, email the input\n// and the following error message to singular@mathematik.uni-kl.de"); |
---|
46 | vfprintf(stderr, fmt, ap); |
---|
47 | #endif |
---|
48 | return 0; |
---|
49 | } |
---|
50 | |
---|
51 | |
---|
52 | #endif |
---|
53 | |
---|
54 | |
---|
55 | |
---|
56 | |
---|
57 | |
---|
58 | |
---|