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: dError.c,v 1.3 2005-05-24 08:05:07 Singular Exp $ |
---|
10 | *******************************************************************/ |
---|
11 | #ifndef DERROR_C |
---|
12 | #define DERROR_C |
---|
13 | #include <stdarg.h> |
---|
14 | #include <stdio.h> |
---|
15 | #include "mod2.h" |
---|
16 | #include "distrib.h" |
---|
17 | #ifdef p_Procs_Static |
---|
18 | #include "kversion.h" |
---|
19 | #endif |
---|
20 | #ifdef HAVE_CONFIG_H |
---|
21 | #include "omalloc.h" |
---|
22 | #endif |
---|
23 | #ifdef MAKE_DISTRIBUTION |
---|
24 | #include "kversion.h" |
---|
25 | #endif |
---|
26 | |
---|
27 | #ifdef __cplusplus |
---|
28 | extern "C" |
---|
29 | { |
---|
30 | #endif |
---|
31 | |
---|
32 | int dReportError(const char* fmt, ...) |
---|
33 | { |
---|
34 | va_list ap; |
---|
35 | va_start(ap, fmt); |
---|
36 | #ifndef MAKE_DISTRIBUTION |
---|
37 | fprintf(stderr, "\n// ***dError: "); |
---|
38 | vfprintf(stderr, fmt, ap); |
---|
39 | #if 0 |
---|
40 | if !defined(OM_NDEBUG) && defined(HAVE_CONFIG_H) |
---|
41 | #endif |
---|
42 | #if defined(HAVE_CONFIG_H) |
---|
43 | fprintf(stderr, " occured at: \n"); |
---|
44 | omPrintCurrentBackTraceMax(stderr, 8); |
---|
45 | #endif |
---|
46 | dErrorBreak(); |
---|
47 | #else |
---|
48 | fprintf(stderr, "\n// !!! YOU HAVE FOUND A BUG IN SINGULAR."); |
---|
49 | fprintf(stderr, "// !!! Please, email the following output to singular@mathematik.uni-kl.de"); |
---|
50 | fprintf(stderr, "// !!! Singular Version: " S_UNAME S_VERSION1 " (%d)\n", |
---|
51 | feVersionId0); |
---|
52 | vfprintf(stderr, fmt, ap); |
---|
53 | #endif |
---|
54 | return 0; |
---|
55 | } |
---|
56 | |
---|
57 | |
---|
58 | #ifndef MAKE_DISTRIBUTION |
---|
59 | // dummy procedure for setting a breakpoint |
---|
60 | // within the debugger |
---|
61 | void dErrorBreak() |
---|
62 | {} |
---|
63 | #endif |
---|
64 | |
---|
65 | #ifdef __cplusplus |
---|
66 | } |
---|
67 | #endif |
---|
68 | |
---|
69 | #endif |
---|
70 | |
---|
71 | |
---|
72 | |
---|
73 | |
---|
74 | |
---|
75 | |
---|