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