[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> |
---|
[2d805a] | 15 | #include <reporter/config.h> |
---|
| 16 | #include <reporter/reporter.h> |
---|
[35aab3] | 17 | #ifdef HAVE_CONFIG_H |
---|
[f093ba] | 18 | #include <omalloc/omalloc.h> |
---|
[35aab3] | 19 | #endif |
---|
| 20 | |
---|
[3a4bda] | 21 | #ifndef MAKE_DISTRIBUTION |
---|
| 22 | // dummy procedure for setting a breakpoint |
---|
| 23 | // within the debugger |
---|
| 24 | void dErrorBreak() |
---|
| 25 | {} |
---|
| 26 | #endif |
---|
| 27 | |
---|
[35aab3] | 28 | int dReportError(const char* fmt, ...) |
---|
| 29 | { |
---|
| 30 | va_list ap; |
---|
| 31 | va_start(ap, fmt); |
---|
| 32 | #ifndef MAKE_DISTRIBUTION |
---|
| 33 | fprintf(stderr, "\n// ***dError: "); |
---|
| 34 | vfprintf(stderr, fmt, ap); |
---|
[3f5086] | 35 | #if (!defined(NDEBUG)) && (!defined(OM_NDEBUG)) && defined(HAVE_CONFIG_H) |
---|
[35aab3] | 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."); |
---|
[508610a] | 42 | fprintf(stderr, "// !!! Please, email the input\n// and the following error message to singular@mathematik.uni-kl.de"); |
---|
[35aab3] | 43 | vfprintf(stderr, fmt, ap); |
---|
| 44 | #endif |
---|
| 45 | return 0; |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | #endif |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | |
---|
| 54 | |
---|
| 55 | |
---|