Macros | Functions | Variables
reporter.h File Reference
#include <stdio.h>
#include <string.h>
#include <misc/auxiliary.h>
#include <resources/feFopen.h>

Go to the source code of this file.

Macros

#define TRACE_SHOW_PROC   1
 
#define TRACE_SHOW_LINENO   2
 
#define TRACE_SHOW_LINE   4
 
#define TRACE_SHOW_RINGS   8
 
#define TRACE_SHOW_LINE1   16
 
#define TRACE_BREAKPOINT   32
 
#define TRACE_TMP_BREAKPOINT   64
 
#define TRACE_CALL   128
 
#define TRACE_ASSIGN   256
 
#define TRACE_CONV   512
 
#define TRACE_PROFILING   1024
 
#define SI_PROT_I   1
 
#define SI_PROT_O   2
 
#define SI_PROT_IO   3
 
#define mflush()   fflush(stdout)
 
#define dReportBug(s)   dReportError("Bug reported: %s\n occurred at %s,%d\n", s, __FILE__, __LINE__)
 
#define assume_violation(s, f, l)   dReportError("assume violation at %s:%d condition: %s", f,l,s)
 
#define assume(x)   _assume(x, __FILE__, __LINE__)
 
#define r_assume(x)   _r_assume(x, __FILE__, __LINE__)
 
#define _assume(x, f, l)
 
#define _r_assume(x, f, l)
 

Functions

void Werror (const char *fmt,...) __attribute__((format(printf
 
void void WerrorS_batch (const char *s)
 
void WarnS (const char *s)
 
void Print (const char *fmt,...) __attribute__((format(printf
 
void void PrintNSpaces (const int n)
 
void PrintLn ()
 
void PrintS (const char *s)
 
void StringAppend (const char *fmt,...)
 
void StringAppendS (const char *s)
 
void StringSetS (const char *s)
 
char * StringEndS ()
 
void Warn (const char *fmt,...)
 
const char * eati (const char *s, int *i)
 
void feStringAppendResources (int warn=-1)
 
void SPrintStart ()
 
char * SPrintEnd ()
 
int dReportError (const char *fmt,...)
 
void dErrorBreak ()
 

Variables

char * feErrors
 
int feErrorsLen
 
FILE * feProtFile
 
int pagelength
 
int colmax
 
int yy_blocklineno
 
int yy_noeof
 
const char feNotImplemented []
 
int feProt
 
BOOLEAN feWarn
 
BOOLEAN feOut
 
int traceit
 

Macro Definition Documentation

#define _assume (   x,
  f,
  l 
)
Value:
do \
{ \
if (! (x)) \
{ \
} \
} \
while (0)
if(0 > strat->sl)
Definition: myNF.cc:73
f
Definition: cfModGcd.cc:4022
while(1)
Definition: libparse.cc:1442
#define assume_violation(s, f, l)
Definition: reporter.h:126
Variable x
Definition: cfModGcd.cc:4023
int l
Definition: cfEzgcd.cc:94

Definition at line 132 of file reporter.h.

#define _r_assume (   x,
  f,
  l 
)
Value:
do \
{ \
if (! (x)) \
{ \
return 0; \
} \
} \
while (0)
return
Definition: syzextra.cc:280
if(0 > strat->sl)
Definition: myNF.cc:73
f
Definition: cfModGcd.cc:4022
while(1)
Definition: libparse.cc:1442
#define assume_violation(s, f, l)
Definition: reporter.h:126
Variable x
Definition: cfModGcd.cc:4023
int l
Definition: cfEzgcd.cc:94

Definition at line 142 of file reporter.h.

#define assume (   x)    _assume(x, __FILE__, __LINE__)

Definition at line 129 of file reporter.h.

#define assume_violation (   s,
  f,
  l 
)    dReportError("assume violation at %s:%d condition: %s", f,l,s)

Definition at line 126 of file reporter.h.

#define dReportBug (   s)    dReportError("Bug reported: %s\n occurred at %s,%d\n", s, __FILE__, __LINE__)

Definition at line 110 of file reporter.h.

#define mflush ( )    fflush(stdout)

Definition at line 55 of file reporter.h.

#define r_assume (   x)    _r_assume(x, __FILE__, __LINE__)

Definition at line 130 of file reporter.h.

#define SI_PROT_I   1

Definition at line 50 of file reporter.h.

#define SI_PROT_IO   3

Definition at line 52 of file reporter.h.

#define SI_PROT_O   2

Definition at line 51 of file reporter.h.

#define TRACE_ASSIGN   256

Definition at line 43 of file reporter.h.

#define TRACE_BREAKPOINT   32

Definition at line 37 of file reporter.h.

#define TRACE_CALL   128

Definition at line 41 of file reporter.h.

#define TRACE_CONV   512

Definition at line 45 of file reporter.h.

#define TRACE_PROFILING   1024

Definition at line 47 of file reporter.h.

#define TRACE_SHOW_LINE   4

Definition at line 30 of file reporter.h.

#define TRACE_SHOW_LINE1   16

Definition at line 35 of file reporter.h.

#define TRACE_SHOW_LINENO   2

Definition at line 28 of file reporter.h.

#define TRACE_SHOW_PROC   1

Definition at line 26 of file reporter.h.

#define TRACE_SHOW_RINGS   8

Definition at line 33 of file reporter.h.

#define TRACE_TMP_BREAKPOINT   64

Definition at line 39 of file reporter.h.

Function Documentation

void dErrorBreak ( )

Definition at line 141 of file dError.cc.

142 {}
int dReportError ( const char *  fmt,
  ... 
)

Definition at line 45 of file dError.cc.

46 {
47 #if 0
48 #ifdef HAVE_EXECINFO_H
49 #define SIZE 50
50  void *buffer[SIZE+1]; int ret;
51 #endif
52 #endif
53 
54  va_list ap;
55  va_start(ap, fmt);
56 #ifndef MAKE_DISTRIBUTION
57  fprintf(stderr, "\n// ***dError: ");
58  vfprintf(stderr, fmt, ap);
59 #if !defined(OM_NDEBUG)
60  #ifdef omPrintCurrentBackTraceMax
61  fprintf(stderr, " occurred at: \n");
62  omPrintCurrentBackTraceMax(stderr, 8);
63  #endif
64 #endif
65 
66 #if 0
67 #ifdef HAVE_EXECINFO_H
68  ret = backtrace( buffer, SIZE ); // execinfo.h
69  fprintf(stderr, "\nExecinfo backtrace (with %zd stack frames): \n", ret);
70 
71 #ifndef HAVE_GCC_ABI_DEMANGLE
72  backtrace_symbols_fd(buffer, ret, STDERR_FILENO); // execinfo.h
73 #else
74  char **ptr = backtrace_symbols( buffer, ret ); // execinfo.h
75 
76  int status;
77  char *demangledName;
78  char *s;
79  char *ss;
80  for (int i = 0; i < ret; i++)
81  {
82  status = -1;
83 
84  s = ptr[i];
85 // fprintf (stderr, " #%02d: %s\n", i, s);
86 
87  ss = index(s, '(');
88  ss[0] = 0;
89  fprintf (stderr, " #%02d: '%s': ", i, s);
90  ss[0] = '('; s = ss + 1;
91 
92  ss = index(s, '+');
93 
94  if ( ss != NULL )
95  {
96  ss[0] = 0;
97  demangledName = abi::__cxa_demangle( s, NULL, NULL, &status ); // cxxabi.h!
98  if( status == 0 && demangledName != NULL )
99  fprintf (stderr, " '%s'", (demangledName[0] != 0)? demangledName: s);
100  else
101  fprintf (stderr, " '%s'", s);
102 
103  malloc_free( demangledName );
104  ss[0] = '+';
105  s = ss + 1;
106  }
107 
108  ss = index(s, ')');
109  if( s != ss)
110  {
111  ss[0] = 0;
112  fprintf (stderr, " + %s", s);
113  ss[0] = ')';
114  }
115 
116  fprintf (stderr, " %s\n", ss + 2);
117  }
118  malloc_free (ptr);
119 #endif
120 #endif
121 
122 #undef SIZE
123 #endif
124 
125  dErrorBreak();
126 #else
127  fprintf(stderr, "\n// !!! YOU HAVE FOUND A BUG IN SINGULAR.");
128  fprintf(stderr, "// !!! Please, email the input\n// and the following error message to singular@mathematik.uni-kl.de")
129  vfprintf(stderr, fmt, ap);
130 #endif
131  return 0;
132 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
void dErrorBreak()
Definition: dError.cc:141
int omPrintCurrentBackTraceMax(FILE *fd, int max)
Definition: omRet2Info.c:165
static void malloc_free(void *ptr)
Definition: dError.cc:24
int i
Definition: cfEzgcd.cc:123
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:597
#define NULL
Definition: omList.c:10
int * status
Definition: si_signals.h:51
const char* eati ( const char *  s,
int *  i 
)

Definition at line 390 of file reporter.cc.

391 {
392  int l=0;
393 
394  if (*s >= '0' && *s <= '9')
395  {
396  *i = 0;
397  while (*s >= '0' && *s <= '9')
398  {
399  *i *= 10;
400  *i += *s++ - '0';
401  l++;
402  if ((l>=MAX_INT_LEN)||((*i) <0))
403  {
404  s-=l;
405  Werror("`%s` greater than %d(max. integer representation)",
406  s,MAX_INT_VAL);
407  return s;
408  }
409  }
410  }
411  else *i = 1;
412  return s;
413 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
const int MAX_INT_LEN
Definition: mylimits.h:13
const int MAX_INT_VAL
Definition: mylimits.h:12
int i
Definition: cfEzgcd.cc:123
void Werror(const char *fmt,...)
Definition: reporter.cc:199
int l
Definition: cfEzgcd.cc:94
void feStringAppendResources ( int  warn = -1)

Definition at line 415 of file reporter.cc.

416 {
417  int i = 0;
418  char* r;
419  StringAppend("%-10s:\t%s\n", "argv[0]", feArgv0);
420  while (feResourceConfigs[i].key != NULL)
421  {
422  r = feResource(feResourceConfigs[i].key, warn);
423  StringAppend("%-10s:\t%s\n", feResourceConfigs[i].key,
424  (r != NULL ? r : ""));
425  i++;
426  }
427 }
static char * feResource(feResourceConfig config, int warn)
Definition: feResource.cc:252
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
char * feArgv0
Definition: feResource.cc:19
#define NULL
Definition: omList.c:10
feResourceConfig_s feResourceConfigs[]
Definition: feResource.cc:54
void StringAppend(const char *fmt,...)
Definition: reporter.cc:61
void Print ( const char *  fmt,
  ... 
)
void PrintLn ( )

Definition at line 327 of file reporter.cc.

328 {
329  PrintS("\n");
330 }
void PrintS(const char *s)
Definition: reporter.cc:294
void void PrintNSpaces ( const int  n)

Definition at line 381 of file reporter.cc.

382 {
383  int l=n-1;
384  while(l>=0) { PrintS(" "); l--; }
385 }
void PrintS(const char *s)
Definition: reporter.cc:294
int l
Definition: cfEzgcd.cc:94
void PrintS ( const char *  s)

Definition at line 294 of file reporter.cc.

295 {
296  if (sprint != NULL)
297  {
298  SPrintS(s);
299  return;
300  }
301  else if (feOut) /* do not print when option --no-out was given */
302  {
303 
304  if (PrintS_callback!=NULL)
305  {
307  }
308  else
309 #ifdef HAVE_TCL
310  if (tclmode)
311  {
312  PrintTCLS('N',s);
313  }
314  else
315 #endif
316  {
317  fwrite(s,1,strlen(s),stdout);
318  fflush(stdout);
319  if (feProt&SI_PROT_O)
320  {
321  fwrite(s,1,strlen(s),feProtFile);
322  }
323  }
324  }
325 }
FILE * feProtFile
Definition: reporter.cc:57
const CanonicalForm int s
Definition: facAbsFact.cc:55
BOOLEAN feOut
Definition: reporter.cc:50
void(* PrintS_callback)(const char *s)
Definition: feFopen.cc:22
int feProt
Definition: reporter.cc:56
static void SPrintS(const char *s)
Definition: reporter.cc:266
#define NULL
Definition: omList.c:10
static char * sprint
Definition: reporter.cc:254
#define SI_PROT_O
Definition: reporter.h:51
char* SPrintEnd ( )

Definition at line 283 of file reporter.cc.

284 {
285  char* ns = sprint;
288  omCheckAddr(ns);
289  return ns;
290 }
static char * sprint_backup
Definition: reporter.cc:255
#define NULL
Definition: omList.c:10
static char * sprint
Definition: reporter.cc:254
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
void SPrintStart ( )

Definition at line 256 of file reporter.cc.

257 {
258  if (sprint!=NULL)
259  {
260  if (sprint_backup!=NULL) WerrorS("internal error: SPrintStart");
261  else sprint_backup=sprint;
262  }
263  sprint = omStrDup("");
264 }
void WerrorS(const char *s)
Definition: feFopen.cc:24
static char * sprint_backup
Definition: reporter.cc:255
#define NULL
Definition: omList.c:10
static char * sprint
Definition: reporter.cc:254
#define omStrDup(s)
Definition: omAllocDecl.h:263
void StringAppend ( const char *  fmt,
  ... 
)

Definition at line 61 of file reporter.cc.

62 {
63  va_list ap;
64  char *s = feBufferStart; /*feBuffer + strlen(feBuffer);*/
65  int vs;
66  long more;
67  va_start(ap, fmt);
68  if ((more=feBufferStart-feBuffer+strlen(fmt)+100)>feBufferLength)
69  {
70  more = ((more + (8*1024-1))/(8*1024))*(8*1024);
71  int l=s-feBuffer;
72  feBuffer=(char *)omReallocSize((void *)feBuffer,feBufferLength,
73  more);
74 #if (!defined(SING_NDEBUG)) && (!defined(OM_NDEBUG))
75  omMarkAsStaticAddr(feBuffer);
76 #endif
77  feBufferLength=more;
78  s=feBuffer+l;
79 #ifndef BSD_SPRINTF
81 #endif
82  }
83 #ifdef BSD_SPRINTF
84  vsprintf(s, fmt, ap);
85  while (*s!='\0') s++;
87 #else
88 #ifdef HAVE_VSNPRINTF
89  vs = vsnprintf(s, feBufferLength - (feBufferStart - feBuffer), fmt, ap);
90  if (vs == -1)
91  {
92  assume(0);
93  feBufferStart = feBuffer + feBufferLength -1;
94  }
95  else
96  {
97  feBufferStart += vs;
98  }
99 #else
100  feBufferStart += vsprintf(s, fmt, ap);
101 #endif
102 #endif
103  omCheckAddrSize(feBuffer, feBufferLength);
104  va_end(ap);
105 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define omCheckAddrSize(addr, size)
Definition: omAllocDecl.h:327
static char * feBufferStart
Definition: reporter.cc:59
static char * feBuffer
Definition: reporter.cc:40
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:405
static long feBufferLength
Definition: reporter.cc:39
void omMarkAsStaticAddr(void *addr)
int l
Definition: cfEzgcd.cc:94
void StringAppendS ( const char *  s)

Definition at line 107 of file reporter.cc.

108 {
109  if (*st!='\0')
110  {
111  /* feBufferStart is feBuffer + strlen(feBuffer);*/
112  int l;
113  long more;
114  int ll=feBufferStart-feBuffer;
115  if ((more=ll+2+(l=strlen(st)))>feBufferLength)
116  {
117  more = ((more + (8*1024-1))/(8*1024))*(8*1024);
118  feBuffer=(char *)omreallocSize((void *)feBuffer,feBufferLength,
119  more);
120  feBufferLength=more;
121  feBufferStart=feBuffer+ll;
122  }
123  strcat(feBufferStart, st);
124  feBufferStart +=l;
125  }
126 }
#define omreallocSize(addr, o_size, size)
Definition: omAllocDecl.h:231
static char * feBufferStart
Definition: reporter.cc:59
static char * feBuffer
Definition: reporter.cc:40
static long feBufferLength
Definition: reporter.cc:39
int l
Definition: cfEzgcd.cc:94
char* StringEndS ( )

Definition at line 151 of file reporter.cc.

152 {
153  char *r=feBuffer;
154  feBuffer_cnt--;
155  assume(feBuffer_cnt >=0);
159  if (strlen(r)<1024)
160  {
161  // if the used buffer is a "smal block",
162  // substitue the "large" initial block by a small one
163  char *s=omStrDup(r); omFree(r); r=s;
164  }
165  return r;
166 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
static char * feBufferStart
Definition: reporter.cc:59
static char * feBuffer_save[8]
Definition: reporter.cc:42
static char * feBuffer
Definition: reporter.cc:40
const ring r
Definition: syzextra.cc:208
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:405
static long feBufferLength
Definition: reporter.cc:39
static int feBuffer_cnt
Definition: reporter.cc:43
static long feBufferLength_save[8]
Definition: reporter.cc:41
static char * feBufferStart_save[8]
Definition: reporter.cc:44
#define omStrDup(s)
Definition: omAllocDecl.h:263
void StringSetS ( const char *  s)

Definition at line 128 of file reporter.cc.

129 {
136  feBuffer_cnt++;
137  assume(feBuffer_cnt<8);
138  int l;
139  long more;
140  if ((l=strlen(st))>feBufferLength)
141  {
142  more = ((l + (4*1024-1))/(4*1024))*(4*1024);
144  more);
145  feBufferLength=more;
146  }
147  strcpy(feBuffer,st);
149 }
static char * feBufferStart
Definition: reporter.cc:59
void * ADDRESS
Definition: auxiliary.h:161
#define INITIAL_PRINT_BUFFER
Definition: reporter.cc:34
static char * feBuffer_save[8]
Definition: reporter.cc:42
static char * feBuffer
Definition: reporter.cc:40
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:405
static long feBufferLength
Definition: reporter.cc:39
static int feBuffer_cnt
Definition: reporter.cc:43
static long feBufferLength_save[8]
Definition: reporter.cc:41
static char * feBufferStart_save[8]
Definition: reporter.cc:44
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
void Warn ( const char *  fmt,
  ... 
)

Definition at line 237 of file reporter.cc.

238 {
239  va_list ap;
240  va_start(ap, fmt);
241  char *s=(char *)omAlloc(256);
242 #ifdef HAVE_VSNPRINTF
243  vsnprintf(s, 256, fmt, ap);
244 #else
245  vsprintf(s, fmt, ap);
246 #endif
247  WarnS(s);
248  omFreeSize(s,256);
249  va_end(ap);
250 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define omAlloc(size)
Definition: omAllocDecl.h:210
void WarnS(const char *s)
Definition: reporter.cc:210
void WarnS ( const char *  s)

Definition at line 210 of file reporter.cc.

211 {
212  #define warn_str "// ** "
213 #ifdef HAVE_TCL
214  if (tclmode)
215  {
216  PrintTCLS('W',warn_str);
217  PrintTCLS('W',s);
218  PrintTCLS('W',"\n");
219  }
220  else
221 #endif
222  if (feWarn) /* ignore warnings if option --no-warn was given */
223  {
224  fwrite(warn_str,1,6,stdout);
225  fwrite(s,1,strlen(s),stdout);
226  fwrite("\n",1,1,stdout);
227  fflush(stdout);
228  if (feProt&SI_PROT_O)
229  {
230  fwrite(warn_str,1,6,feProtFile);
231  fwrite(s,1,strlen(s),feProtFile);
232  fwrite("\n",1,1,feProtFile);
233  }
234  }
235 }
FILE * feProtFile
Definition: reporter.cc:57
const CanonicalForm int s
Definition: facAbsFact.cc:55
int feProt
Definition: reporter.cc:56
#define warn_str
#define SI_PROT_O
Definition: reporter.h:51
BOOLEAN feWarn
Definition: reporter.cc:49
void Werror ( const char *  fmt,
  ... 
)
void void WerrorS_batch ( const char *  s)

Definition at line 178 of file reporter.cc.

179 {
180  if (feErrors==NULL)
181  {
182  feErrors=(char *)omAlloc(256);
183  feErrorsLen=256;
184  *feErrors = '\0';
185  }
186  else
187  {
188  if (((int)(strlen((char *)s)+ 20 +strlen(feErrors)))>=feErrorsLen)
189  {
191  feErrorsLen+=256;
192  }
193  }
194  strcat(feErrors, "Singular error: ");
195  strcat(feErrors, (char *)s);
197 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
int feErrorsLen
Definition: reporter.cc:48
#define TRUE
Definition: auxiliary.h:144
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
char * feErrors
Definition: reporter.cc:47
short errorreported
Definition: feFopen.cc:23
#define NULL
Definition: omList.c:10

Variable Documentation

int colmax

Definition at line 43 of file febase.cc.

char* feErrors

Definition at line 47 of file reporter.cc.

int feErrorsLen

Definition at line 48 of file reporter.cc.

const char feNotImplemented[]

Definition at line 54 of file reporter.cc.

BOOLEAN feOut

Definition at line 50 of file reporter.cc.

int feProt

Definition at line 56 of file reporter.cc.

FILE* feProtFile

Definition at line 57 of file reporter.cc.

BOOLEAN feWarn

Definition at line 49 of file reporter.cc.

int pagelength
int traceit

Definition at line 47 of file febase.cc.

int yy_blocklineno

Definition at line 56 of file fevoices.cc.

int yy_noeof

Definition at line 55 of file fevoices.cc.