mod2.h
Go to the documentation of this file.
1 /* -*-c++-*- */
2 /*******************************************************************
3  * Computer Algebra System SINGULAR
4  *
5  * mod2.h: Main configuration file for Singular
6  * DO NOT EDIT!
7  *
8  *******************************************************************/
9 #ifndef MOD2_H
10 #define MOD2_H
11 
12 /* please include singularconfig.h exclusively via <kernel/mod2.h> and before any other header */
13 # include <singularconfig.h>
14 
15 # include <misc/auxiliary.h>
16 
17 #define SINGULAR_MAJOR_VERSION 4
18 
19 #ifdef SINGULAR_4_1
20 #undef VERSION
21 #define VERSION "4.1.0"
22 #define SINGULAR_MINOR_VERSION 1
23 #define SINGULAR_SUB_VERSION 0
24 #else
25 #define SINGULAR_MINOR_VERSION 0
26 #define SINGULAR_SUB_VERSION 3
27 #endif
28 #define S_ROOT_DIR ""
29 
30 /*******************************************************************
31  * Defines which are not set by configure
32  ******************************************************************/
33 
34 /*defines, which should be set by configure */
35 #define HAVE_GETTIMEOFDAY 1
36 #define TIME_WITH_SYS_TIME 1
37 #define HAVE_SYS_TIME_H 1
38 /* Default value for timer resolution in ticks per second */
39 /* set to 10 for resolution of tenth of a second, etc */
40 #define TIMER_RESOLUTION 1
41 
42 /* Undefine to disable the quote/eval of expressions */
43 #define SIQ 1
44 
45 /* Undefine to disable Gerhard's and Wilfried's fast and dirty std computations */
46 #define FAST_AND_DIRTY
47 
48 /* eigenvalues */
49 #define HAVE_EIGENVAL 1
50 
51 /* Gauss-Manin system */
52 #define HAVE_GMS 1
53 
54 /* include simpleipc/semaphore code, link against librt/libpthread */
55 #define HAVE_SIMPLEIPC 1
56 
57 
58 /* linear algebra extensions from pcv.h/pcv.cc */
59 #define HAVE_PCV 1
60 
61 /* procedures to compute groebner bases with the f5 implementation */
62 /* still testing */
63 #undef HAVE_F5
64 
65 /* procedures to compute groebner bases with the f5c implementation */
66 /* still testing */
67 #undef HAVE_F5C
68 
69 /* procedures to compute with units */
70 #define HAVE_UNITS
71 
72 /* Define to use scanner when loading libraries */
73 #define HAVE_LIBPARSER
74 
75 /*#define PROFILING*/
76 #ifdef PROFILING
77 #define PROFILER ,0,0
78 #else
79 #define PROFILER
80 #endif
81 
82 /*******************************************************************
83  * Evaluate the set defines
84  ******************************************************************/
85 /* Spectrum needs GMP */
86 #define HAVE_SPECTRUM 1
87 
88 #if SIZEOF_VOIDP == 8
89 /* SIZEOF_LONG == SIZEOF_VOIDP is guaranteed by configure */
90 #define ALIGN_8
91 #endif
92 
93 #ifdef SINGULAR_4_1
94 #define SINGULAR_VERSION 4100
95 #else
96 #define SINGULAR_PATCHLEVEL 1
97 #define SINGULAR_VERSION ((SINGULAR_MAJOR_VERSION*1000 + SINGULAR_MINOR_VERSION*100 + SINGULAR_SUB_VERSION*10)+SINGULAR_PATCHLEVEL)
98 #endif
99 /*******************************************************************
100  * Miscellanous Defines
101  ******************************************************************/
102 #ifndef HAVE_LIBPARSER
103 # undef YYLPDEBUG
104 #else
105 # define YYLPDEBUG 1
106 #endif
107 
108 #ifndef FALSE
109 #define FALSE 0
110 #endif
111 
112 #ifndef TRUE
113 #define TRUE 1
114 #endif
115 
116 #ifndef NULL
117 #define NULL (0)
118 #endif
119 
120 #ifndef SEEK_END
121 #define SEEK_END 2
122 #endif
123 
124 #ifndef SEEK_SET
125 #define SEEK_SET 0
126 #endif
127 
128 #define HALT() m2_end(2)
129 
130 /* define OLD_RES for res/sres/mres(i,j,k) */
131 #undef OLD_RES
132 
133 /* the maximal ascii length of an int number + 1 = 11 for 32 bit int */
134 /* #define MAX_INT_LEN 11 */
135 
136 
137 #ifdef DO_PROFILE
138 /* define to enable explicit profiling of some crucial inline
139  * routines and defines */
140 #undef DO_DEEP_PROFILE
141 #endif
142 
143 /* define to enable assume */
144 #ifndef HAVE_ASSUME
145 #undef HAVE_ASSUME
146 #endif
147 
148 /* define LINKAGE to "extern C" if compiling for shared libs */
149 #ifndef LINKAGE
150 #if defined(PIC)
151 #define LINKAGE extern "C"
152 #else
153 #define LINKAGE
154 #endif
155 #endif
156 
157 
158 /*******************************************************************
159  * DEBUG OPTIONS
160  * -- only significant for for compiling without -DSING_NDEBUG
161  * -- you better know what your are doing, if you touch this
162  ******************************************************************/
163 #ifndef SING_NDEBUG
164 
165 /* undefine to enable inline */
166 #define NO_INLINE
167 
168 /* undefine to disable assume -- should normally be defined for SING_NDEBUG */
169 #define HAVE_ASSUME
170 
171 /* undef PDEBUG to disable checks of polys
172 
173  define PDEBUG to
174  0 for enabling pTest
175  1 plus tests in Level 1 poly routines (operations on monomials)
176  2 plus tests in Level 2 poly routines (operations on single exponents)
177  -- see also polys.h for more info
178 
179  NOTE: you can set the value of PDEBUG on a per-file basis, before
180  including mod2.h, provided ! PDEBUG is defined in mod2.h E.g.:
181 
182  #define PDEBUG 2
183  #include "mod2.h"
184  ...
185 
186  makes sure that all poly operations in your file are done with
187  PDEBUG == 2
188  To break after an error occurred, set a debugger breakpoint on
189  dErrorBreak.
190 */
191 #ifndef PDEBUG
192 #define PDEBUG 0
193 #endif
194 
195 /* define MDEBUG to enable memory checks */
196 #define MDEBUG 0
197 
198 #ifdef MDEBUG
199 /* If ! defined(OM_NDEBUG) and (defined(OM_TRACK) or defined(OM_CHECK)
200  then omDebug routines are used for memory allocation/free:
201 
202  The omDebug routines are controlled by the values of OM_TRACK, OM_CHECK
203  and OM_KEEP. There meaning is roughly as follows:
204  OM_TRACK: strored with address : extra space
205  0 : no additional info is stored : 0
206  1 : file:line of location where address was allocated : 1 word
207  2 : plus backtrace of stack where adress was allocated: 6 words
208  3 : plus size/bin info and front-, and back padding : 9 words
209  4 : plus file:line of location where adress was freed : 10 words
210  5 : plus backtrace of stack where adress was allocated: 15 words
211  OM_CHECK: checks done
212  0 : no checks
213  1 : constant-time checks: i.e. addr checks only
214  2 : plus linear-time checks and constant related bin check
215  3 : plus quadratic-time checks and linear-time related bin checks and
216  constant time all memory checks
217  4 : and so on
218  ==> for OM_CHECK >= 3 it gets rather slow
219  OM_KEEP: determines whether addresses are really freed (
220  0 : addresses are really freed
221  1 : addresses are only marked as free and not really freed.
222 
223  OM_CHECK, OM_TRACK, and OM_KEEP can be set on a per-file basis
224  (as can OM_NDEBUG), e.g.:
225  #define OM_CHECK 3
226  #define OM_TRACK 5
227  #define OM_KEEP 1
228  #include "mod2.h"
229  #include <omalloc/omalloc.h>
230  ensures that all memory allocs/free in this file are done with
231  OM_CHECK==3 and OM_TRACK==5, and that all addresses allocated/freed
232  in this file are only marked as free and never really freed.
233 
234  To set OM_CHECK, OM_TRACK and OM_KEEP under dynamic scope, set
235  om_Opts.MinCheck, om_Opts.MinTrack to the respectiv values and
236  om_Opts.Keep to the number of addresses which are kept before they are
237  actually freed. E.g.:
238  int check=om_Opts.MinCheck, track=om_Opts.MinTrack, keep= m_OPts.Keep;
239  om_Opts.MinCheck = 3; om_Opts.MinTrack = 5; omOpts.Keep = LONG_MAX;
240  ExternalRoutine();
241  om_Opts.MinCheck = check; omOpts.MinTrack = track; omOpts.Keep = keep;
242  ensures that all calls omDebug routines occuring during the computation of
243  ExternalRoutine() are done with OM_CHECK==3 and OM_TRACK==5, and
244  calls to omFree only mark addresses as free and not really free them.
245 
246  Furthermore, the value of OM_SING_KEEP (resp. om_Opts.Keep) specifies
247  how many addresses are kept before they are actually freed, independently
248  of the value of OM_KEEP.
249 
250  Some tips on possible values of OM_TRACK, OM_CHECK, OM_KEEP:
251  + To find out about an address that has been freed twice, first locate the
252  file(s) where the error occurred, and then at the beginning of these files:
253  #define OM_CHECK 3
254  #define OM_TRACK 5
255  #define OM_KEEP 1
256  #include "mod2.h"
257  #include <omalloc/omalloc.h>
258  Under dynamic scope, do (e.g., from within the debugger):
259  om_Opts.MinCheck = 3; om_Opts.MinTrack = 5; omOpts.Keep = LONG_MAX;
260  + to find out where "memory corruption" occurred, increase value of
261  OM_CHECK - the higher this value is, the more consistency checks are
262  done (However a value > 3 checks the entire memory each time an omalloc
263  routine is used!)
264 
265  Some more tips on the usage of omalloc:
266  + omAlloc*, omRealloc*, omFree*, omCheck* omDebug* omTest* rotuines
267  assume that sizes are > 0 and pointers are != NULL
268  + omalloc*, omrealloc*, omfree* omcheck*, omdebug* omtest* routines allow
269  NULL pointers and sizes == 0
270  + You can safely use any free/realloc routine in combination with any alloc
271  routine (including the debug versions): E.g., an address allocated with
272  omAllocBin can be freed with omfree, or an adress allocated with
273  om(Debug)Alloc can be freed with omfree, or omFree, or omFreeSize, etc.
274  However, keep in mind that the efficiency decreases from
275  Bin over Size to General routines (i.e., omFreeBin is more efficient than
276  omFreeSize which is more efficient than omFree, likewise with the alloc
277  routines).
278  + if OM_CHECK is undefined or 0, then all omCheck routines do nothing
279  + if OM_CHECK and OM_TRACK are both undefined (or 0), or if OM_NDEBUG is
280  defined, then the "real" alloc/realloc/free macros are used, and all
281  omTest, omDebug and omCheck routines are undefined
282  + to break after an omError occurred within a debugger,
283  set a breakpoint on dErrorBreak
284  + to do checks from within the debugger, or to do checks with explicit
285  check level, use omTest routines.
286 */
287 
288 /* by default, store alloc info and file/line where addr was freed */
289 #ifndef OM_TRACK
290 #define OM_TRACK 4
291 #endif
292 /* only do constant-time memory checks */
293 #ifndef OM_CHECK
294 #define OM_CHECK 1
295 #endif
296 /* Do actually free memory:
297  (be careful: if this is set, memory is never really freed,
298  but only marked as free) */
299 #ifndef OM_KEEP
300 #define OM_KEEP 0
301 #endif
302 /* but only after you have freed 1000 more addresses
303  (this is actually independent of the value of OM_KEEP and used
304  to initialize om_Opts.Keep) */
305 #ifndef OM_SING_KEEP
306 #define OM_SING_KEEP 1000
307 #endif
308 
309 #endif /* MDEBUG */
310 
311 
312 /* undef KDEBUG for check of data during std computations
313  *
314  * define KDEBUG to
315  * 0 for basic tests
316  * 1 for tests in kSpoly
317  * NOTE: You can locally enable tests in kspoly by setting the
318  * define at the beginning of kspoly.cc
319  */
320 #define KDEBUG 0
321 
322 /* define LDEBUG checking numbers, undefine otherwise */
323 #define LDEBUG
324 /* define RDEBUG checking rings (together with TRACE=9) */
325 #define RDEBUG
326 /* define TEST for non time critical tests, undefine otherwise */
327 #define TEST
328 
329 /* #define PAGE_TEST */
330 
331 /* define YYDEBUG 1 for debugging bison texts, 0 otherwise */
332 #define YYDEBUG 1
333 
334 /* define SPECTRUM_DEBUG and SPECTRUM_PRINT for debugging the spectrum code */
335 /* define SPECTRUM_IOSTREAM to use C++ iostream for error messages */
336 
337 /* #define SPECTRUM_DEBUG */
338 /* #define SPECTRUM_PRINT */
339 #undef SPECTRUM_IOSTREAM
340 
341 #ifdef SPECTRUM_DEBUG
342 #define MULTICNT_DEBUG
343 #define GMPRAT_DEBUG
344 #define KMATRIX_DEBUG
345 #define SPLIST_DEBUG
346 #define NPOLYGON_DEBUG
347 #define SEMIC_DEBUG
348 #endif
349 
350 #ifdef SPECTRUM_PRINT
351 #define MULTICNT_PRINT
352 #define GMPRAT_PRINT
353 #define KMATRIX_PRINT
354 #define SPLIST_PRINT
355 #define NPOLYGON_PRINT
356 #define SEMIC_PRINT
357 #endif
358 
359 #ifdef SPECTRUM_IOSTREAM
360 #define MULTICNT_IOSTREAM
361 #define GMPRAT_IOSTREAM
362 #define KMATRIX_IOSTREAM
363 #define SPLIST_IOSTREAM
364 #define NPOLYGON_IOSTREAM
365 #define SEMIC_IOSTREAM
366 #endif
367 
368 
369 #else /* not SING_NDEBUG **************************************************** */
370 
371 #define NO_PDEBUG
372 
373 /* define YYDEBUG 1 for debugging bison texts, 0 otherwise */
374 #define YYDEBUG 0
375 
376 #endif /* not SING_NDEBUG */
377 
378 /*******************************************************************
379  *
380  * assume(x) -- a handy macro for assumptions
381  *
382  ******************************************************************/
383 
384 #ifdef __cplusplus
385 extern "C" {
386 #endif
387 /* routine which is used to report the error/
388 * returns 0 */
389 extern int dReportError(const char* fmt, ...);
390 /* within a debugger, set a breakpoint on dErrorBreak
391 * which is called after the error has been reported */
392 extern void dErrorBreak();
393 #ifdef __cplusplus
394 }
395 #endif
396 
397 #ifndef HAVE_ASSUME
398 #define assume(x) do {} while (0)
399 #define r_assume(x) do {} while (0)
400 #else /* ! HAVE_ASSUME */
401 
402 #define assume_violation(s,f,l) \
403  dReportError("assume violation at %s:%d condition: %s", f,l,s)
404 
405 #define assume(x) _assume(x, __FILE__, __LINE__)
406 #define r_assume(x) _r_assume(x, __FILE__, __LINE__)
407 
408 #define _assume(x, f, l) \
409 do \
410 { \
411  if (! (x)) \
412  { \
413  assume_violation(#x, f, l); \
414  } \
415 } \
416 while (0)
417 
418 #define _r_assume(x, f, l) \
419 do \
420 { \
421  if (! (x)) \
422  { \
423  assume_violation(#x, f, l); \
424  return 0; \
425  } \
426 } \
427 while (0)
428 #endif /* HAVE_ASSUME */
429 
430 /* do have RDEBUG, unless we are doing the very real thing */
431 #ifdef HAVE_ASSUME
432 #ifndef RDEBUG
433 #define RDEBUG
434 #endif
435 #endif
436 
437 #if SIZEOF_VOIDP == 8
438 #ifndef OM_CHECK
439 #define OM_CHECK 0
440 #endif
441 #endif
442 
443 /* If we're not using GNU C, elide __attribute__ */
444 #ifndef __GNUC__
445 # define __attribute__(x) /*NOTHING*/
446 #endif
447 
448 #define STRINGIFY(name) #name
449 #define EXPANDED_STRINGIFY(name) STRINGIFY(name)
450 
451 #endif /* MOD2_H */
All the auxiliary stuff.
int dReportError(const char *fmt,...)
Definition: dError.cc:45
void dErrorBreak()
Definition: dError.cc:141