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.6 2000-12-31 15:14:29 obachman 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 HAVE_CONFIG_H |
---|
18 | #include "omalloc.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #ifdef __cplusplus |
---|
22 | extern "C" |
---|
23 | { |
---|
24 | #endif |
---|
25 | |
---|
26 | extern unsigned long feVersionId; |
---|
27 | |
---|
28 | int dReportError(const char* fmt, ...) |
---|
29 | { |
---|
30 | va_list ap; |
---|
31 | va_start(ap, fmt); |
---|
32 | #ifndef MAKE_DISTRIBUTION |
---|
33 | fprintf(stderr, "\n// ***dErrror: "); |
---|
34 | vfprintf(stderr, fmt, ap); |
---|
35 | #if !defined(OM_NDEBUG) && defined(HAVE_CONFIG_H) |
---|
36 | fprintf(stderr, " occured at: \n"); |
---|
37 | omPrintCurrentBackTraceMax(stderr, 8); |
---|
38 | #endif |
---|
39 | dErrorBreak(); |
---|
40 | #else |
---|
41 | fprintf(stderr, "\n// !!! YOU HAVE FOUND A BUG IN SINGULAR."); |
---|
42 | fprintf(stderr, "// !!! Please, email the following output to singular@mathematik.uni-kl.de"); |
---|
43 | fprintf(stderr, "// !!! Singular Version: " S_UNAME S_VERSION1 " (%lu)\n", |
---|
44 | feVersionId); |
---|
45 | vfprintf(stderr, fmt, ap); |
---|
46 | #endif |
---|
47 | return 0; |
---|
48 | } |
---|
49 | |
---|
50 | |
---|
51 | #ifndef MAKE_DISTRIBUTION |
---|
52 | // dummy procedure for setting a breakpoint |
---|
53 | // within the debugger |
---|
54 | void dErrorBreak() |
---|
55 | {} |
---|
56 | #endif |
---|
57 | |
---|
58 | #ifdef __cplusplus |
---|
59 | } |
---|
60 | #endif |
---|
61 | |
---|
62 | #endif |
---|
63 | |
---|
64 | |
---|
65 | |
---|
66 | |
---|
67 | |
---|
68 | |
---|