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 | /******************************************************************* |
---|
13 | * Defines which are set by configure |
---|
14 | ******************************************************************/ |
---|
15 | /* Define to use dynamic linking */ |
---|
16 | #cmakedefine HAVE_DL 1 |
---|
17 | /* Define to use readline lib for fancy display: configure result */ |
---|
18 | #cmakedefine HAVE_LIBREADLINE 1 |
---|
19 | /* Define to use static readline lib for fancy display */ |
---|
20 | #cmakedefine HAVE_READLINE 1 |
---|
21 | /* define to use dynamic version of readline lib */ |
---|
22 | #cmakedefine HAVE_DYN_RL 1 |
---|
23 | /* Define to have dbm links */ |
---|
24 | #cmakedefine HAVE_DBM 1 |
---|
25 | /* Define to have MP links */ |
---|
26 | #cmakedefine HAVE_MPSR 1 |
---|
27 | /* Define to have factory functionality added */ |
---|
28 | #cmakedefine HAVE_FACTORY 1 |
---|
29 | /* Define if you have stdc headers */ |
---|
30 | #cmakedefine STDC_HEADERS 1 |
---|
31 | /* Define if you have asm/sigcontext.h */ |
---|
32 | #cmakedefine HAVE_ASM_SIGCONTEXT_H 1 |
---|
33 | /* Define if you have sys/file.h */ |
---|
34 | #cmakedefine HAVE_SYS_FILE_H 1 |
---|
35 | /* Define if you have sys/stat.h */ |
---|
36 | #cmakedefine HAVE_SYS_STAT_H 1 |
---|
37 | /* Define if you have sys/param.h */ |
---|
38 | #cmakedefine HAVE_SYS_PARAM_H 1 |
---|
39 | /* Define if you have sys/file.h */ |
---|
40 | #cmakedefine HAVE_SYS_TYPES_H 1 |
---|
41 | /* Define if you have sys/ioctl.h */ |
---|
42 | #cmakedefine HAVE_SYS_IOCTL_H 1 |
---|
43 | /* Define if you have sys/time.h */ |
---|
44 | #cmakedefine HAVE_SYS_TIME_H 1 |
---|
45 | /* Define if you have sys/times.h */ |
---|
46 | #cmakedefine HAVE_SYS_TIMES_H 1 |
---|
47 | /* io header: */ |
---|
48 | /* Define if you have termcap.h */ |
---|
49 | #cmakedefine HAVE_TERMCAP_H 1 |
---|
50 | /* Define if you have termios.h */ |
---|
51 | #cmakedefine HAVE_TERMIOS_H 1 |
---|
52 | /* Define if you have term.h */ |
---|
53 | #cmakedefine HAVE_TERM_H 1 |
---|
54 | /* Define if you have readline/history.h */ |
---|
55 | #cmakedefine HAVE_READLINE_HISTORY_H 1 |
---|
56 | /* Define if readline/readline.h is ok */ |
---|
57 | #cmakedefine READLINE_READLINE_H_OK 1 |
---|
58 | /* Define if time.h and sys/time.h can be included at the same time */ |
---|
59 | #cmakedefine TIME_WITH_SYS_TIME 1 |
---|
60 | /* Define if you have alloca.h */ |
---|
61 | #cmakedefine HAVE_ALLOCA_H 1 |
---|
62 | /* Define if you have pwd.h */ |
---|
63 | #cmakedefine HAVE_PWD_H 1 |
---|
64 | /* Define if you have unistd.h */ |
---|
65 | #cmakedefine HAVE_UNISTD_H 1 |
---|
66 | /* define if you have malloc.h */ |
---|
67 | #cmakedefine HAVE_MALLOC_H 1 |
---|
68 | /* Define if you have alloca */ |
---|
69 | #cmakedefine HAVE_ALLOCA 1 |
---|
70 | /* Define if you have getpagesize */ |
---|
71 | #cmakedefine GETPAGESIZE 1 |
---|
72 | /* Define if you have vprintf */ |
---|
73 | #cmakedefine HAVE_VPRINTF 1 |
---|
74 | /* Define if you have gettimeofday */ |
---|
75 | #cmakedefine HAVE_GETTIMEOFDAY 1 |
---|
76 | /* Define if you have atexit */ |
---|
77 | #cmakedefine HAVE_ATEXIT 1 |
---|
78 | /* Define if you have bcopy, bzero and bcmp |
---|
79 | Linux needs that define! */ |
---|
80 | #cmakedefine HAVE_BCOPY 1 |
---|
81 | /* Define if sprintf does not return number of printed chars */ |
---|
82 | #cmakedefine BSD_SPRINTF 1 |
---|
83 | /* define if you have explicit C++ constructors */ |
---|
84 | #cmakedefine HAVE_EXPLICIT_CONSTR 1 |
---|
85 | /* Define if you have the getcwd function. */ |
---|
86 | #cmakedefine HAVE_GETCWD 1 |
---|
87 | /* Define if you have the getwd function. */ |
---|
88 | #cmakedefine HAVE_GETWD 1 |
---|
89 | /* Define if you have snprintf */ |
---|
90 | #cmakedefine HAVE_VSNPRINTF 1 |
---|
91 | /* Define if you have readlink */ |
---|
92 | #cmakedefine HAVE_READLINK 1 |
---|
93 | /* Define if you have usleep */ |
---|
94 | #cmakedefine HAVE_USLEEP 1 |
---|
95 | /* Define if you have sleep */ |
---|
96 | #cmakedefine HAVE_SLEEP 1 |
---|
97 | /* Define if you have setenv */ |
---|
98 | #cmakedefine HAVE_SETENV 1 |
---|
99 | /* Define if you have petpwnam */ |
---|
100 | #cmakedefine HAVE_GETPWNAM 1 |
---|
101 | /* Define if you have popen */ |
---|
102 | #cmakedefine HAVE_POPEN 1 |
---|
103 | /* Define if you have sysconf */ |
---|
104 | #cmakedefine HAVE_SYSCONF 1 |
---|
105 | /* Define if you have siginterrupt (BSD4.3) */ |
---|
106 | #cmakedefine HAVE_SIGINTERRUPT 1 |
---|
107 | /* define for boost includes and lib */ |
---|
108 | //////////////////////// #undef HAVE_BOOST_DYNAMIC_BITSET_HPP |
---|
109 | /* define for std:vector includes */ |
---|
110 | #cmakedefine USE_STDVECBOOL 1 |
---|
111 | /* Define sizeof(char) */ |
---|
112 | #define SIZEOF_CHAR 1 |
---|
113 | /* Define sizeof(short) */ |
---|
114 | #define SIZEOF_SHORT 2 |
---|
115 | /* Define sizeof(int) */ |
---|
116 | #define SIZEOF_INT 4 |
---|
117 | /* Define sizeof(long) */ |
---|
118 | #define SIZEOF_LONG 4 |
---|
119 | /* Define sizeof(void*) */ |
---|
120 | #define SIZEOF_VOIDP 4 |
---|
121 | /* Define sizeof(double) */ |
---|
122 | #define SIZEOF_DOUBLE 8 |
---|
123 | /* Define if your integer format is big endian */ |
---|
124 | #cmakedefine WORDS_BIGENDIAN 1 |
---|
125 | /* Define major version of Singular -- should be set in ../configure.in!!!*/ |
---|
126 | #define SINGULAR_MAJOR_VERSION 0 |
---|
127 | /* Define minor version of Singular -- should be set in ../configure.in!!! */ |
---|
128 | #define SINGULAR_MINOR_VERSION 0 |
---|
129 | /* Define sub version of Singular -- should be set in ../configure.in!!! */ |
---|
130 | #define SINGULAR_SUB_VERSION 0 |
---|
131 | /* Define version as a string */ |
---|
132 | #define S_VERSION1 "" |
---|
133 | /* Define version date as a string */ |
---|
134 | #define S_VERSION2 "" |
---|
135 | /* Define uname identifier as a string */ |
---|
136 | #define S_UNAME "" |
---|
137 | /* Absolute pathname of root directory of Singular source */ |
---|
138 | #define S_ROOT_DIR "" |
---|
139 | /* Define to enable dynamic module code */ |
---|
140 | #cmakedefine HAVE_DYNAMIC_LOADING 1 |
---|
141 | /* Define to enable plural */ |
---|
142 | #cmakedefine HAVE_PLURAL 1 |
---|
143 | /* Define to enable ratGB/ ratGRING */ |
---|
144 | #cmakedefine HAVE_RATGRING 1 |
---|
145 | /* Define to enable shiftbba */ |
---|
146 | #cmakedefine HAVE_SHIFTBBA 1 |
---|
147 | /* Define to enable libsvd */ |
---|
148 | #cmakedefine HAVE_SVD 1 |
---|
149 | /* CPU type: i[3456]86: */ |
---|
150 | #cmakedefine SI_CPU_I386 1 |
---|
151 | /* CPU type: sparc: */ |
---|
152 | #cmakedefine SI_CPU_SPARC 1 |
---|
153 | /* CPU type: ppc: */ |
---|
154 | #cmakedefine SI_CPU_PPC 1 |
---|
155 | /* CPU type: IA64: */ |
---|
156 | #cmakedefine SI_CPU_IA64 1 |
---|
157 | /* CPU type: x86_64: */ |
---|
158 | #cmakedefine SI_CPU_X86_64 1 |
---|
159 | |
---|
160 | /******************************************************************* |
---|
161 | * Defines which are not set by configure |
---|
162 | ******************************************************************/ |
---|
163 | |
---|
164 | /* Default value for timer resolution in ticks per second */ |
---|
165 | /* set to 10 for resolution of tenth of a second, etc */ |
---|
166 | #define TIMER_RESOLUTION 1 |
---|
167 | |
---|
168 | /* Undefine to disable the quote/eval of expressions */ |
---|
169 | #define SIQ 1 |
---|
170 | |
---|
171 | /* Define to enable TCL interface */ |
---|
172 | #cmakedefine HAVE_TCL 1 |
---|
173 | |
---|
174 | /* Undefine to disable Gerhard's and Wilfried's fast and dirty std computations */ |
---|
175 | #define FAST_AND_DIRTY |
---|
176 | |
---|
177 | /* eigenvalues */ |
---|
178 | #ifndef HAVE_DYNAMIC_LOADING |
---|
179 | #define HAVE_EIGENVAL 1 |
---|
180 | |
---|
181 | /* Gauss-Manin system */ |
---|
182 | #define HAVE_GMS 1 |
---|
183 | #endif |
---|
184 | |
---|
185 | /* linear algebra extensions from pcv.h/pcv.cc */ |
---|
186 | #define HAVE_PCV 1 |
---|
187 | |
---|
188 | /* procedures to compute groebner bases with the f5 implementation */ |
---|
189 | /* still testing */ |
---|
190 | #cmakedefine HAVE_F5 1 |
---|
191 | |
---|
192 | /* procedures to compute groebner bases with the f5c implementation */ |
---|
193 | /* still testing */ |
---|
194 | #cmakedefine HAVE_F5C 1 |
---|
195 | |
---|
196 | /* letterplace gb:*/ |
---|
197 | #define HAVE_SHIFTBBA 1 |
---|
198 | |
---|
199 | /* rings as coefficients */ |
---|
200 | #define HAVE_RINGS |
---|
201 | |
---|
202 | /* procedures to compute with units */ |
---|
203 | #define HAVE_UNITS |
---|
204 | |
---|
205 | /* Define to use old mechanismen for saving currRing with procedures |
---|
206 | */ |
---|
207 | #cmakedefine USE_IILOCALRING |
---|
208 | |
---|
209 | |
---|
210 | /* Define to use scanner when loading libraries */ |
---|
211 | #define HAVE_LIBPARSER |
---|
212 | |
---|
213 | /*#define PROFILING*/ |
---|
214 | #ifdef PROFILING |
---|
215 | #define PROFILER ,0,0 |
---|
216 | #else |
---|
217 | #define PROFILER |
---|
218 | #endif |
---|
219 | |
---|
220 | /******************************************************************* |
---|
221 | * Evaluate the set defines |
---|
222 | ******************************************************************/ |
---|
223 | /* FGLM needs factory */ |
---|
224 | #ifdef HAVE_FACTORY |
---|
225 | #define HAVE_FGLM |
---|
226 | #endif |
---|
227 | |
---|
228 | /* Define if you want fglm for homogeneous case */ |
---|
229 | #ifdef HAVE_FGLM |
---|
230 | #undef HAVE_FGLM_HOME |
---|
231 | #endif |
---|
232 | |
---|
233 | /* Spectrum needs GMP */ |
---|
234 | #define HAVE_SPECTRUM 1 |
---|
235 | |
---|
236 | /* Undefine to disable real time measurments */ |
---|
237 | #ifdef HAVE_GETTIMEOFDAY |
---|
238 | #define HAVE_RTIMER |
---|
239 | #endif |
---|
240 | |
---|
241 | #if SIZEOF_VOIDP == 8 |
---|
242 | /* SIZEOF_LONG == SIZEOF_VOIDP is guaranteed by configure */ |
---|
243 | #define ALIGN_8 |
---|
244 | #define LOG_SIZEOF_LONG 3 |
---|
245 | #define LOG_SIZEOF_VOIDP 3 |
---|
246 | #else |
---|
247 | #define LOG_SIZEOF_LONG 2 |
---|
248 | #define LOG_SIZEOF_VOIDP 2 |
---|
249 | #endif |
---|
250 | |
---|
251 | #ifndef CHAR_BIT |
---|
252 | #define CHAR_BIT 8 |
---|
253 | #endif |
---|
254 | |
---|
255 | #define BIT_SIZEOF_LONG CHAR_BIT*SIZEOF_LONG |
---|
256 | |
---|
257 | #define SINGULAR_PATCHLEVEL 6 |
---|
258 | #define SINGULAR_VERSION ((SINGULAR_MAJOR_VERSION*1000 + SINGULAR_MINOR_VERSION*100 + SINGULAR_SUB_VERSION*10)+SINGULAR_PATCHLEVEL) |
---|
259 | |
---|
260 | /******************************************************************* |
---|
261 | * Miscellanous Defines |
---|
262 | ******************************************************************/ |
---|
263 | /* Under HPUX 9, system(...) returns -1 if SIGCHLD does not equal |
---|
264 | SIG_DFL. However, if it stays at SIG_DFL we get zombie processes |
---|
265 | for terminated childs generated by fork. Therefors some special treatment |
---|
266 | is necessary */ |
---|
267 | #ifdef HPUX_9 |
---|
268 | #include <stdlib.h> |
---|
269 | #define system hpux9_system |
---|
270 | #ifdef __cplusplus |
---|
271 | extern "C" { |
---|
272 | #endif |
---|
273 | int hpux9_system(const char* system); |
---|
274 | #ifdef __cplusplus |
---|
275 | } |
---|
276 | #endif |
---|
277 | #endif |
---|
278 | |
---|
279 | #ifndef HAVE_LIBPARSER |
---|
280 | # undef YYLPDEBUG |
---|
281 | #else |
---|
282 | # define YYLPDEBUG 1 |
---|
283 | #endif |
---|
284 | |
---|
285 | #ifndef FALSE |
---|
286 | #define FALSE 0 |
---|
287 | #endif |
---|
288 | |
---|
289 | #ifndef TRUE |
---|
290 | #define TRUE 1 |
---|
291 | #endif |
---|
292 | |
---|
293 | #ifndef NULL |
---|
294 | #define NULL (0) |
---|
295 | #endif |
---|
296 | |
---|
297 | #ifndef SEEK_END |
---|
298 | #define SEEK_END 2 |
---|
299 | #endif |
---|
300 | |
---|
301 | #ifndef SEEK_SET |
---|
302 | #define SEEK_SET 0 |
---|
303 | #endif |
---|
304 | |
---|
305 | #define HALT() m2_end(2) |
---|
306 | |
---|
307 | #define memcpy4 memcpy |
---|
308 | |
---|
309 | /* define OLD_RES for res/sres/mres(i,j,k) */ |
---|
310 | #cmakedefine OLD_RES |
---|
311 | |
---|
312 | /* the maximal ascii length of an int number + 1 = 11 for 32 bit int */ |
---|
313 | #define MAX_INT_LEN 11 |
---|
314 | #define MAX_INT_VAL 0x7fffffff |
---|
315 | |
---|
316 | #ifdef DO_PROFILE |
---|
317 | /* define to enable explicit profiling of some crucial inline |
---|
318 | * routines and defines */ |
---|
319 | #cmakedefine DO_DEEP_PROFILE |
---|
320 | #endif |
---|
321 | |
---|
322 | #define buildin_rand 1 |
---|
323 | |
---|
324 | /* define to enable assume */ |
---|
325 | #ifndef HAVE_ASSUME |
---|
326 | #cmakedefine HAVE_ASSUME |
---|
327 | #endif |
---|
328 | |
---|
329 | /* define LINKAGE to "extern C" if compiling for shared libs */ |
---|
330 | #ifndef LINKAGE |
---|
331 | #if defined(PIC) |
---|
332 | #define LINKAGE extern "C" |
---|
333 | #else |
---|
334 | #define LINKAGE |
---|
335 | #endif |
---|
336 | #endif |
---|
337 | |
---|
338 | |
---|
339 | /******************************************************************* |
---|
340 | * DEBUG OPTIONS |
---|
341 | * -- only significant for for compiling without -DNDEBUG |
---|
342 | * -- you better know what your are doing, if you touch this |
---|
343 | ******************************************************************/ |
---|
344 | #ifndef NDEBUG |
---|
345 | |
---|
346 | /* undefine to enable inline */ |
---|
347 | #define NO_INLINE |
---|
348 | |
---|
349 | /* undefine to disable assume -- should normally be defined for NDEBUG */ |
---|
350 | #define HAVE_ASSUME |
---|
351 | |
---|
352 | /* undef PDEBUG to disable checks of polys |
---|
353 | |
---|
354 | define PDEBUG to |
---|
355 | 0 for enabling pTest |
---|
356 | 1 plus tests in Level 1 poly routines (operations on monomials) |
---|
357 | 2 plus tests in Level 2 poly routines (operations on single exponents) |
---|
358 | -- see also polys.h for more info |
---|
359 | |
---|
360 | NOTE: you can set the value of PDEBUG on a per-file basis, before |
---|
361 | including mod2.h, provided ! PDEBUG is defined in mod2.h E.g.: |
---|
362 | |
---|
363 | #define PDEBUG 2 |
---|
364 | #include <kernel/mod2.h> |
---|
365 | ... |
---|
366 | |
---|
367 | makes sure that all poly operations in your file are done with |
---|
368 | PDEBUG == 2 |
---|
369 | To break after an error occured, set a debugger breakpoint on |
---|
370 | dErrorBreak. |
---|
371 | */ |
---|
372 | #ifndef PDEBUG |
---|
373 | #define PDEBUG 0 |
---|
374 | #endif |
---|
375 | |
---|
376 | /* define MDEBUG to enable memory checks */ |
---|
377 | #define MDEBUG 0 |
---|
378 | |
---|
379 | #ifdef MDEBUG |
---|
380 | /* If ! defined(OM_NDEBUG) and (defined(OM_TRACK) or defined(OM_CHECK) |
---|
381 | then omDebug routines are used for memory allocation/free: |
---|
382 | |
---|
383 | The omDebug routines are controlled by the values of OM_TRACK, OM_CHECK |
---|
384 | and OM_KEEP. There meaning is roughly as follows: |
---|
385 | OM_TRACK: strored with address : extra space |
---|
386 | 0 : no additional info is stored : 0 |
---|
387 | 1 : file:line of location where address was allocated : 1 word |
---|
388 | 2 : plus backtrace of stack where adress was allocated: 6 words |
---|
389 | 3 : plus size/bin info and front-, and back padding : 9 words |
---|
390 | 4 : plus file:line of location where adress was freed : 10 words |
---|
391 | 5 : plus backtrace of stack where adress was allocated: 15 words |
---|
392 | OM_CHECK: checks done |
---|
393 | 0 : no checks |
---|
394 | 1 : constant-time checks: i.e. addr checks only |
---|
395 | 2 : plus linear-time checks and constant related bin check |
---|
396 | 3 : plus quadratic-time checks and linear-time related bin checks and |
---|
397 | constant time all memory checks |
---|
398 | 4 : and so on |
---|
399 | ==> for OM_CHECK >= 3 it gets rather slow |
---|
400 | OM_KEEP: determines whether addresses are really freed ( |
---|
401 | 0 : addresses are really freed |
---|
402 | 1 : addresses are only marked as free and not really freed. |
---|
403 | |
---|
404 | OM_CHECK, OM_TRACK, and OM_KEEP can be set on a per-file basis |
---|
405 | (as can OM_NDEBUG), e.g.: |
---|
406 | #define OM_CHECK 3 |
---|
407 | #define OM_TRACK 5 |
---|
408 | #define OM_KEEP 1 |
---|
409 | #include <kernel/mod2.h> |
---|
410 | #include <omalloc/omalloc.h> |
---|
411 | ensures that all memory allocs/free in this file are done with |
---|
412 | OM_CHECK==3 and OM_TRACK==5, and that all addresses allocated/freed |
---|
413 | in this file are only marked as free and never really freed. |
---|
414 | |
---|
415 | To set OM_CHECK, OM_TRACK and OM_KEEP under dynamic scope, set |
---|
416 | om_Opts.MinCheck, om_Opts.MinTrack to the respectiv values and |
---|
417 | om_Opts.Keep to the number of addresses which are kept before they are |
---|
418 | actually freed. E.g.: |
---|
419 | int check=om_Opts.MinCheck, track=om_Opts.MinTrack, keep= m_OPts.Keep; |
---|
420 | om_Opts.MinCheck = 3; om_Opts.MinTrack = 5; omOpts.Keep = LONG_MAX; |
---|
421 | ExternalRoutine(); |
---|
422 | om_Opts.MinCheck = check; omOpts.MinTrack = track; omOpts.Keep = keep; |
---|
423 | ensures that all calls omDebug routines occuring during the computation of |
---|
424 | ExternalRoutine() are done with OM_CHECK==3 and OM_TRACK==5, and |
---|
425 | calls to omFree only mark addresses as free and not really free them. |
---|
426 | |
---|
427 | Furthermore, the value of OM_SING_KEEP (resp. om_Opts.Keep) specifies |
---|
428 | how many addresses are kept before they are actually freed, independently |
---|
429 | of the value of OM_KEEP. |
---|
430 | |
---|
431 | Some tips on possible values of OM_TRACK, OM_CHECK, OM_KEEP: |
---|
432 | + To find out about an address that has been freed twice, first locate the |
---|
433 | file(s) where the error occured, and then at the beginning of these files: |
---|
434 | #define OM_CHECK 3 |
---|
435 | #define OM_TRACK 5 |
---|
436 | #define OM_KEEP 1 |
---|
437 | #include <kernel/mod2.h> |
---|
438 | #include <omalloc/omalloc.h> |
---|
439 | Under dynamic scope, do (e.g., from within the debugger): |
---|
440 | om_Opts.MinCheck = 3; om_Opts.MinTrack = 5; omOpts.Keep = LONG_MAX; |
---|
441 | + to find out where "memory corruption" occured, increase value of |
---|
442 | OM_CHECK - the higher this value is, the more consistency checks are |
---|
443 | done (However a value > 3 checks the entire memory each time an omalloc |
---|
444 | routine is used!) |
---|
445 | |
---|
446 | Some more tips on the usage of omalloc: |
---|
447 | + omAlloc*, omRealloc*, omFree*, omCheck* omDebug* omTest* rotuines |
---|
448 | assume that sizes are > 0 and pointers are != NULL |
---|
449 | + omalloc*, omrealloc*, omfree* omcheck*, omdebug* omtest* routines allow |
---|
450 | NULL pointers and sizes == 0 |
---|
451 | + You can safely use any free/realloc routine in combination with any alloc |
---|
452 | routine (including the debug versions): E.g., an address allocated with |
---|
453 | omAllocBin can be freed with omfree, or an adress allocated with |
---|
454 | om(Debug)Alloc can be freed with omfree, or omFree, or omFreeSize, etc. |
---|
455 | However, keep in mind that the efficiency decreases from |
---|
456 | Bin over Size to General routines (i.e., omFreeBin is more efficient than |
---|
457 | omFreeSize which is more efficient than omFree, likewise with the alloc |
---|
458 | routines). |
---|
459 | + if OM_CHECK is undefined or 0, then all omCheck routines do nothing |
---|
460 | + if OM_CHECK and OM_TRACK are both undefined (or 0), or if OM_NDEBUG is |
---|
461 | defined, then the "real" alloc/realloc/free macros are used, and all |
---|
462 | omTest, omDebug and omCheck routines are undefined |
---|
463 | + to break after an omError occured within a debugger, |
---|
464 | set a breakpoint on dErrorBreak |
---|
465 | + to do checks from within the debugger, or to do checks with explicit |
---|
466 | check level, use omTest routines. |
---|
467 | */ |
---|
468 | |
---|
469 | /* by default, store alloc info and file/line where addr was freed */ |
---|
470 | #ifndef OM_TRACK |
---|
471 | #define OM_TRACK 4 |
---|
472 | #endif |
---|
473 | /* only do constant-time memory checks */ |
---|
474 | #ifndef OM_CHECK |
---|
475 | #define OM_CHECK 1 |
---|
476 | #endif |
---|
477 | /* Do actually free memory: |
---|
478 | (be careful: if this is set, memory is never really freed, |
---|
479 | but only marked as free) */ |
---|
480 | #ifndef OM_KEEP |
---|
481 | #define OM_KEEP 0 |
---|
482 | #endif |
---|
483 | /* but only after you have freed 1000 more addresses |
---|
484 | (this is actually independent of the value of OM_KEEP and used |
---|
485 | to initialize om_Opts.Keep) */ |
---|
486 | #ifndef OM_SING_KEEP |
---|
487 | #define OM_SING_KEEP 1000 |
---|
488 | #endif |
---|
489 | |
---|
490 | #endif /* MDEBUG */ |
---|
491 | |
---|
492 | |
---|
493 | /* undef KDEBUG for check of data during std computations |
---|
494 | * |
---|
495 | * define KDEBUG to |
---|
496 | * 0 for basic tests |
---|
497 | * 1 for tests in kSpoly |
---|
498 | * NOTE: You can locally enable tests in kspoly by setting the |
---|
499 | * define at the beginning of kspoly.cc |
---|
500 | */ |
---|
501 | #define KDEBUG 0 |
---|
502 | |
---|
503 | /* define LDEBUG checking numbers, undefine otherwise */ |
---|
504 | #define LDEBUG |
---|
505 | /* define RDEBUG checking rings (together with TRACE=9) */ |
---|
506 | //#define RDEBUG |
---|
507 | /* define TEST for non time critical tests, undefine otherwise */ |
---|
508 | #define TEST |
---|
509 | |
---|
510 | /* #define PAGE_TEST */ |
---|
511 | |
---|
512 | /* define YYDEBUG 1 for debugging bison texts, 0 otherwise */ |
---|
513 | #define YYDEBUG 1 |
---|
514 | |
---|
515 | /* Undefine to disable debugging of MP stuff */ |
---|
516 | #ifdef HAVE_MPSR |
---|
517 | #define MPSR_DEBUG |
---|
518 | #endif |
---|
519 | |
---|
520 | |
---|
521 | #ifdef TEST |
---|
522 | #ifndef buildin_rand |
---|
523 | #define buildin_rand 1 |
---|
524 | #endif |
---|
525 | #endif |
---|
526 | |
---|
527 | /* define SPECTRUM_DEBUG and SPECTRUM_PRINT for debugging the spectrum code */ |
---|
528 | /* define SPECTRUM_IOSTREAM to use C++ iostream for error messages */ |
---|
529 | |
---|
530 | /* #define SPECTRUM_DEBUG */ |
---|
531 | /* #define SPECTRUM_PRINT */ |
---|
532 | #cmakedefine SPECTRUM_IOSTREAM |
---|
533 | |
---|
534 | #ifdef SPECTRUM_DEBUG |
---|
535 | #define MULTICNT_DEBUG |
---|
536 | #define GMPRAT_DEBUG |
---|
537 | #define KMATRIX_DEBUG |
---|
538 | #define SPLIST_DEBUG |
---|
539 | #define NPOLYGON_DEBUG |
---|
540 | #define SEMIC_DEBUG |
---|
541 | #endif |
---|
542 | |
---|
543 | #ifdef SPECTRUM_PRINT |
---|
544 | #define MULTICNT_PRINT |
---|
545 | #define GMPRAT_PRINT |
---|
546 | #define KMATRIX_PRINT |
---|
547 | #define SPLIST_PRINT |
---|
548 | #define NPOLYGON_PRINT |
---|
549 | #define SEMIC_PRINT |
---|
550 | #endif |
---|
551 | |
---|
552 | #ifdef SPECTRUM_IOSTREAM |
---|
553 | #define MULTICNT_IOSTREAM |
---|
554 | #define GMPRAT_IOSTREAM |
---|
555 | #define KMATRIX_IOSTREAM |
---|
556 | #define SPLIST_IOSTREAM |
---|
557 | #define NPOLYGON_IOSTREAM |
---|
558 | #define SEMIC_IOSTREAM |
---|
559 | #endif |
---|
560 | |
---|
561 | |
---|
562 | #else /* not NDEBUG **************************************************** */ |
---|
563 | |
---|
564 | #define NO_PDEBUG |
---|
565 | |
---|
566 | /* define YYDEBUG 1 for debugging bison texts, 0 otherwise */ |
---|
567 | #define YYDEBUG 0 |
---|
568 | |
---|
569 | #endif /* not NDEBUG */ |
---|
570 | |
---|
571 | /******************************************************************* |
---|
572 | * |
---|
573 | * assume(x) -- a handy macro for assumptions |
---|
574 | * |
---|
575 | ******************************************************************/ |
---|
576 | |
---|
577 | #ifdef __cplusplus |
---|
578 | extern "C" { |
---|
579 | #endif |
---|
580 | // routine which is used to report the error |
---|
581 | // returns 0 |
---|
582 | extern int dReportError(const char* fmt, ...); |
---|
583 | // within a debugger, set a breakpoint on dErrorBreak |
---|
584 | // which is called after the error has been reported |
---|
585 | extern void dErrorBreak(); |
---|
586 | #ifdef __cplusplus |
---|
587 | } |
---|
588 | #endif |
---|
589 | |
---|
590 | #ifndef HAVE_ASSUME |
---|
591 | #define assume(x) ((void) 0) |
---|
592 | #define r_assume(x) ((void) 0) |
---|
593 | #else /* ! HAVE_ASSUME */ |
---|
594 | |
---|
595 | #define assume_violation(s,f,l) \ |
---|
596 | dReportError("assume violation at %s:%d condition: %s", f,l,s) |
---|
597 | |
---|
598 | #define assume(x) _assume(x, __FILE__, __LINE__) |
---|
599 | #define r_assume(x) _r_assume(x, __FILE__, __LINE__) |
---|
600 | |
---|
601 | #define _assume(x, f, l) \ |
---|
602 | do \ |
---|
603 | { \ |
---|
604 | if (! (x)) \ |
---|
605 | { \ |
---|
606 | assume_violation(#x, f, l); \ |
---|
607 | } \ |
---|
608 | } \ |
---|
609 | while (0) |
---|
610 | |
---|
611 | #define _r_assume(x, f, l) \ |
---|
612 | do \ |
---|
613 | { \ |
---|
614 | if (! (x)) \ |
---|
615 | { \ |
---|
616 | assume_violation(#x, f, l); \ |
---|
617 | return 0; \ |
---|
618 | } \ |
---|
619 | } \ |
---|
620 | while (0) |
---|
621 | #endif /* HAVE_ASSUME */ |
---|
622 | |
---|
623 | /* do have RDEBUG, unless we are doing the very real thing */ |
---|
624 | #ifdef HAVE_ASSUME |
---|
625 | #ifndef RDEBUG |
---|
626 | #define RDEBUG |
---|
627 | #endif |
---|
628 | #endif |
---|
629 | |
---|
630 | #if SIZEOF_VOIDP == 8 |
---|
631 | #ifndef OM_CHECK |
---|
632 | #define OM_CHECK 0 |
---|
633 | #endif |
---|
634 | #endif |
---|
635 | |
---|
636 | /* If we're not using GNU C, elide __attribute__ */ |
---|
637 | #ifndef __GNUC__ |
---|
638 | # define __attribute__(x) /*NOTHING*/ |
---|
639 | #endif |
---|
640 | |
---|
641 | #endif /* MOD2_H */ |
---|
642 | /* -*-c++-*- */ |
---|
643 | /******************************************************************* |
---|
644 | * Computer Algebra System SINGULAR |
---|
645 | * |
---|
646 | * mod2.h: Main configuration file for Singular |
---|
647 | * DO NOT EDIT! |
---|
648 | * |
---|
649 | *******************************************************************/ |
---|
650 | #ifndef MOD2_H |
---|
651 | #define MOD2_H |
---|
652 | |
---|
653 | /******************************************************************* |
---|
654 | * Defines which are set by configure |
---|
655 | ******************************************************************/ |
---|
656 | /* Define to use dynamic linking */ |
---|
657 | #cmakedefine HAVE_DL 1 |
---|
658 | /* Define to use readline lib for fancy display: configure result */ |
---|
659 | #cmakedefine HAVE_LIBREADLINE 1 |
---|
660 | /* Define to use static readline lib for fancy display */ |
---|
661 | #cmakedefine HAVE_READLINE 1 |
---|
662 | /* define to use dynamic version of readline lib */ |
---|
663 | #cmakedefine HAVE_DYN_RL 1 |
---|
664 | /* Define to have dbm links */ |
---|
665 | #cmakedefine HAVE_DBM 1 |
---|
666 | /* Define to have MP links */ |
---|
667 | #cmakedefine HAVE_MPSR 1 |
---|
668 | /* Define to have factory functionality added */ |
---|
669 | #cmakedefine HAVE_FACTORY 1 |
---|
670 | /* Define if you have stdc headers */ |
---|
671 | #cmakedefine STDC_HEADERS 1 |
---|
672 | /* Define if you have asm/sigcontext.h */ |
---|
673 | #cmakedefine HAVE_ASM_SIGCONTEXT_H 1 |
---|
674 | /* Define if you have sys/file.h */ |
---|
675 | #cmakedefine HAVE_SYS_FILE_H 1 |
---|
676 | /* Define if you have sys/stat.h */ |
---|
677 | #cmakedefine HAVE_SYS_STAT_H 1 |
---|
678 | /* Define if you have sys/param.h */ |
---|
679 | #cmakedefine HAVE_SYS_PARAM_H 1 |
---|
680 | /* Define if you have sys/file.h */ |
---|
681 | #cmakedefine HAVE_SYS_TYPES_H 1 |
---|
682 | /* Define if you have sys/ioctl.h */ |
---|
683 | #cmakedefine HAVE_SYS_IOCTL_H 1 |
---|
684 | /* Define if you have sys/time.h */ |
---|
685 | #cmakedefine HAVE_SYS_TIME_H 1 |
---|
686 | /* Define if you have sys/times.h */ |
---|
687 | #cmakedefine HAVE_SYS_TIMES_H 1 |
---|
688 | /* io header: */ |
---|
689 | /* Define if you have termcap.h */ |
---|
690 | #cmakedefine HAVE_TERMCAP_H 1 |
---|
691 | /* Define if you have termios.h */ |
---|
692 | #cmakedefine HAVE_TERMIOS_H 1 |
---|
693 | /* Define if you have term.h */ |
---|
694 | #cmakedefine HAVE_TERM_H 1 |
---|
695 | /* Define if you have readline/history.h */ |
---|
696 | #cmakedefine HAVE_READLINE_HISTORY_H 1 |
---|
697 | /* Define if readline/readline.h is ok */ |
---|
698 | #cmakedefine READLINE_READLINE_H_OK 1 |
---|
699 | /* Define if time.h and sys/time.h can be included at the same time */ |
---|
700 | #cmakedefine TIME_WITH_SYS_TIME 1 |
---|
701 | /* Define if you have alloca.h */ |
---|
702 | #cmakedefine HAVE_ALLOCA_H 1 |
---|
703 | /* Define if you have pwd.h */ |
---|
704 | #cmakedefine HAVE_PWD_H 1 |
---|
705 | /* Define if you have unistd.h */ |
---|
706 | #cmakedefine HAVE_UNISTD_H 1 |
---|
707 | /* define if you have malloc.h */ |
---|
708 | #cmakedefine HAVE_MALLOC_H 1 |
---|
709 | /* Define if you have alloca */ |
---|
710 | #cmakedefine HAVE_ALLOCA 1 |
---|
711 | /* Define if you have getpagesize */ |
---|
712 | #cmakedefine GETPAGESIZE 1 |
---|
713 | /* Define if you have vprintf */ |
---|
714 | #cmakedefine HAVE_VPRINTF 1 |
---|
715 | /* Define if you have gettimeofday */ |
---|
716 | #cmakedefine HAVE_GETTIMEOFDAY 1 |
---|
717 | /* Define if you have atexit */ |
---|
718 | #cmakedefine HAVE_ATEXIT 1 |
---|
719 | /* Define if you have bcopy, bzero and bcmp |
---|
720 | Linux needs that define! */ |
---|
721 | #cmakedefine HAVE_BCOPY 1 |
---|
722 | /* Define if sprintf does not return number of printed chars */ |
---|
723 | #cmakedefine BSD_SPRINTF 1 |
---|
724 | /* define if you have explicit C++ constructors */ |
---|
725 | #cmakedefine HAVE_EXPLICIT_CONSTR 1 |
---|
726 | /* Define if you have the getcwd function. */ |
---|
727 | #cmakedefine HAVE_GETCWD 1 |
---|
728 | /* Define if you have the getwd function. */ |
---|
729 | #cmakedefine HAVE_GETWD 1 |
---|
730 | /* Define if you have snprintf */ |
---|
731 | #cmakedefine HAVE_VSNPRINTF 1 |
---|
732 | /* Define if you have readlink */ |
---|
733 | #cmakedefine HAVE_READLINK 1 |
---|
734 | /* Define if you have usleep */ |
---|
735 | #cmakedefine HAVE_USLEEP 1 |
---|
736 | /* Define if you have sleep */ |
---|
737 | #cmakedefine HAVE_SLEEP 1 |
---|
738 | /* Define if you have setenv */ |
---|
739 | #cmakedefine HAVE_SETENV 1 |
---|
740 | /* Define if you have petpwnam */ |
---|
741 | #cmakedefine HAVE_GETPWNAM 1 |
---|
742 | /* Define if you have popen */ |
---|
743 | #cmakedefine HAVE_POPEN 1 |
---|
744 | /* Define if you have sysconf */ |
---|
745 | #cmakedefine HAVE_SYSCONF 1 |
---|
746 | /* Define if you have siginterrupt (BSD4.3) */ |
---|
747 | #cmakedefine HAVE_SIGINTERRUPT 1 |
---|
748 | /* define for boost includes and lib */ |
---|
749 | //////////////////////// #undef HAVE_BOOST_DYNAMIC_BITSET_HPP |
---|
750 | /* define for std:vector includes */ |
---|
751 | #cmakedefine USE_STDVECBOOL 1 |
---|
752 | /* Define sizeof(char) */ |
---|
753 | #define SIZEOF_CHAR 1 |
---|
754 | /* Define sizeof(short) */ |
---|
755 | #define SIZEOF_SHORT 2 |
---|
756 | /* Define sizeof(int) */ |
---|
757 | #define SIZEOF_INT 4 |
---|
758 | /* Define sizeof(long) */ |
---|
759 | #define SIZEOF_LONG 4 |
---|
760 | /* Define sizeof(void*) */ |
---|
761 | #define SIZEOF_VOIDP 4 |
---|
762 | /* Define sizeof(double) */ |
---|
763 | #define SIZEOF_DOUBLE 8 |
---|
764 | /* Define if your integer format is big endian */ |
---|
765 | #cmakedefine WORDS_BIGENDIAN 1 |
---|
766 | /* Define major version of Singular -- should be set in ../configure.in!!!*/ |
---|
767 | #define SINGULAR_MAJOR_VERSION 0 |
---|
768 | /* Define minor version of Singular -- should be set in ../configure.in!!! */ |
---|
769 | #define SINGULAR_MINOR_VERSION 0 |
---|
770 | /* Define sub version of Singular -- should be set in ../configure.in!!! */ |
---|
771 | #define SINGULAR_SUB_VERSION 0 |
---|
772 | /* Define version as a string */ |
---|
773 | #define S_VERSION1 "" |
---|
774 | /* Define version date as a string */ |
---|
775 | #define S_VERSION2 "" |
---|
776 | /* Define uname identifier as a string */ |
---|
777 | #define S_UNAME "" |
---|
778 | /* Absolute pathname of root directory of Singular source */ |
---|
779 | #define S_ROOT_DIR "" |
---|
780 | /* Define to enable dynamic module code */ |
---|
781 | #cmakedefine HAVE_DYNAMIC_LOADING 1 |
---|
782 | /* Define to enable plural */ |
---|
783 | #cmakedefine HAVE_PLURAL 1 |
---|
784 | /* Define to enable ratGB/ ratGRING */ |
---|
785 | #cmakedefine HAVE_RATGRING 1 |
---|
786 | /* Define to enable shiftbba */ |
---|
787 | #cmakedefine HAVE_SHIFTBBA 1 |
---|
788 | /* Define to enable libsvd */ |
---|
789 | #cmakedefine HAVE_SVD 1 |
---|
790 | /* CPU type: i[3456]86: */ |
---|
791 | #cmakedefine SI_CPU_I386 1 |
---|
792 | /* CPU type: sparc: */ |
---|
793 | #cmakedefine SI_CPU_SPARC 1 |
---|
794 | /* CPU type: ppc: */ |
---|
795 | #cmakedefine SI_CPU_PPC 1 |
---|
796 | /* CPU type: IA64: */ |
---|
797 | #cmakedefine SI_CPU_IA64 1 |
---|
798 | /* CPU type: x86_64: */ |
---|
799 | #cmakedefine SI_CPU_X86_64 1 |
---|
800 | |
---|
801 | /******************************************************************* |
---|
802 | * Defines which are not set by configure |
---|
803 | ******************************************************************/ |
---|
804 | |
---|
805 | /* Default value for timer resolution in ticks per second */ |
---|
806 | /* set to 10 for resolution of tenth of a second, etc */ |
---|
807 | #define TIMER_RESOLUTION 1 |
---|
808 | |
---|
809 | /* Undefine to disable the quote/eval of expressions */ |
---|
810 | #define SIQ 1 |
---|
811 | |
---|
812 | /* Define to enable TCL interface */ |
---|
813 | #cmakedefine HAVE_TCL 1 |
---|
814 | |
---|
815 | /* Undefine to disable Gerhard's and Wilfried's fast and dirty std computations */ |
---|
816 | #define FAST_AND_DIRTY |
---|
817 | |
---|
818 | /* eigenvalues */ |
---|
819 | #ifndef HAVE_DYNAMIC_LOADING |
---|
820 | #define HAVE_EIGENVAL 1 |
---|
821 | |
---|
822 | /* Gauss-Manin system */ |
---|
823 | #define HAVE_GMS 1 |
---|
824 | #endif |
---|
825 | |
---|
826 | /* linear algebra extensions from pcv.h/pcv.cc */ |
---|
827 | #define HAVE_PCV 1 |
---|
828 | |
---|
829 | /* procedures to compute groebner bases with the f5 implementation */ |
---|
830 | /* still testing */ |
---|
831 | #cmakedefine HAVE_F5 1 |
---|
832 | |
---|
833 | /* procedures to compute groebner bases with the f5c implementation */ |
---|
834 | /* still testing */ |
---|
835 | #cmakedefine HAVE_F5C 1 |
---|
836 | |
---|
837 | /* letterplace gb:*/ |
---|
838 | #define HAVE_SHIFTBBA 1 |
---|
839 | |
---|
840 | /* rings as coefficients */ |
---|
841 | #define HAVE_RINGS |
---|
842 | |
---|
843 | /* procedures to compute with units */ |
---|
844 | #define HAVE_UNITS |
---|
845 | |
---|
846 | /* Define to use old mechanismen for saving currRing with procedures |
---|
847 | */ |
---|
848 | #cmakedefine USE_IILOCALRING |
---|
849 | |
---|
850 | |
---|
851 | /* Define to use scanner when loading libraries */ |
---|
852 | #define HAVE_LIBPARSER |
---|
853 | |
---|
854 | /*#define PROFILING*/ |
---|
855 | #ifdef PROFILING |
---|
856 | #define PROFILER ,0,0 |
---|
857 | #else |
---|
858 | #define PROFILER |
---|
859 | #endif |
---|
860 | |
---|
861 | /******************************************************************* |
---|
862 | * Evaluate the set defines |
---|
863 | ******************************************************************/ |
---|
864 | /* FGLM needs factory */ |
---|
865 | #ifdef HAVE_FACTORY |
---|
866 | #define HAVE_FGLM |
---|
867 | #endif |
---|
868 | |
---|
869 | /* Define if you want fglm for homogeneous case */ |
---|
870 | #ifdef HAVE_FGLM |
---|
871 | #undef HAVE_FGLM_HOME |
---|
872 | #endif |
---|
873 | |
---|
874 | /* Spectrum needs GMP */ |
---|
875 | #define HAVE_SPECTRUM 1 |
---|
876 | |
---|
877 | /* Undefine to disable real time measurments */ |
---|
878 | #ifdef HAVE_GETTIMEOFDAY |
---|
879 | #define HAVE_RTIMER |
---|
880 | #endif |
---|
881 | |
---|
882 | #if SIZEOF_VOIDP == 8 |
---|
883 | /* SIZEOF_LONG == SIZEOF_VOIDP is guaranteed by configure */ |
---|
884 | #define ALIGN_8 |
---|
885 | #define LOG_SIZEOF_LONG 3 |
---|
886 | #define LOG_SIZEOF_VOIDP 3 |
---|
887 | #else |
---|
888 | #define LOG_SIZEOF_LONG 2 |
---|
889 | #define LOG_SIZEOF_VOIDP 2 |
---|
890 | #endif |
---|
891 | |
---|
892 | #ifndef CHAR_BIT |
---|
893 | #define CHAR_BIT 8 |
---|
894 | #endif |
---|
895 | |
---|
896 | #define BIT_SIZEOF_LONG CHAR_BIT*SIZEOF_LONG |
---|
897 | |
---|
898 | #define SINGULAR_PATCHLEVEL 6 |
---|
899 | #define SINGULAR_VERSION ((SINGULAR_MAJOR_VERSION*1000 + SINGULAR_MINOR_VERSION*100 + SINGULAR_SUB_VERSION*10)+SINGULAR_PATCHLEVEL) |
---|
900 | |
---|
901 | /******************************************************************* |
---|
902 | * Miscellanous Defines |
---|
903 | ******************************************************************/ |
---|
904 | /* Under HPUX 9, system(...) returns -1 if SIGCHLD does not equal |
---|
905 | SIG_DFL. However, if it stays at SIG_DFL we get zombie processes |
---|
906 | for terminated childs generated by fork. Therefors some special treatment |
---|
907 | is necessary */ |
---|
908 | #ifdef HPUX_9 |
---|
909 | #include <stdlib.h> |
---|
910 | #define system hpux9_system |
---|
911 | #ifdef __cplusplus |
---|
912 | extern "C" { |
---|
913 | #endif |
---|
914 | int hpux9_system(const char* system); |
---|
915 | #ifdef __cplusplus |
---|
916 | } |
---|
917 | #endif |
---|
918 | #endif |
---|
919 | |
---|
920 | #ifndef HAVE_LIBPARSER |
---|
921 | # undef YYLPDEBUG |
---|
922 | #else |
---|
923 | # define YYLPDEBUG 1 |
---|
924 | #endif |
---|
925 | |
---|
926 | #ifndef FALSE |
---|
927 | #define FALSE 0 |
---|
928 | #endif |
---|
929 | |
---|
930 | #ifndef TRUE |
---|
931 | #define TRUE 1 |
---|
932 | #endif |
---|
933 | |
---|
934 | #ifndef NULL |
---|
935 | #define NULL (0) |
---|
936 | #endif |
---|
937 | |
---|
938 | #ifndef SEEK_END |
---|
939 | #define SEEK_END 2 |
---|
940 | #endif |
---|
941 | |
---|
942 | #ifndef SEEK_SET |
---|
943 | #define SEEK_SET 0 |
---|
944 | #endif |
---|
945 | |
---|
946 | #define HALT() m2_end(2) |
---|
947 | |
---|
948 | #define memcpy4 memcpy |
---|
949 | |
---|
950 | /* define OLD_RES for res/sres/mres(i,j,k) */ |
---|
951 | #cmakedefine OLD_RES |
---|
952 | |
---|
953 | /* the maximal ascii length of an int number + 1 = 11 for 32 bit int */ |
---|
954 | #define MAX_INT_LEN 11 |
---|
955 | #define MAX_INT_VAL 0x7fffffff |
---|
956 | |
---|
957 | #ifdef DO_PROFILE |
---|
958 | /* define to enable explicit profiling of some crucial inline |
---|
959 | * routines and defines */ |
---|
960 | #cmakedefine DO_DEEP_PROFILE |
---|
961 | #endif |
---|
962 | |
---|
963 | #define buildin_rand 1 |
---|
964 | |
---|
965 | /* define to enable assume */ |
---|
966 | #ifndef HAVE_ASSUME |
---|
967 | #cmakedefine HAVE_ASSUME |
---|
968 | #endif |
---|
969 | |
---|
970 | /* define LINKAGE to "extern C" if compiling for shared libs */ |
---|
971 | #ifndef LINKAGE |
---|
972 | #if defined(PIC) |
---|
973 | #define LINKAGE extern "C" |
---|
974 | #else |
---|
975 | #define LINKAGE |
---|
976 | #endif |
---|
977 | #endif |
---|
978 | |
---|
979 | |
---|
980 | /******************************************************************* |
---|
981 | * DEBUG OPTIONS |
---|
982 | * -- only significant for for compiling without -DNDEBUG |
---|
983 | * -- you better know what your are doing, if you touch this |
---|
984 | ******************************************************************/ |
---|
985 | #ifndef NDEBUG |
---|
986 | |
---|
987 | /* undefine to enable inline */ |
---|
988 | #define NO_INLINE |
---|
989 | |
---|
990 | /* undefine to disable assume -- should normally be defined for NDEBUG */ |
---|
991 | #define HAVE_ASSUME |
---|
992 | |
---|
993 | /* undef PDEBUG to disable checks of polys |
---|
994 | |
---|
995 | define PDEBUG to |
---|
996 | 0 for enabling pTest |
---|
997 | 1 plus tests in Level 1 poly routines (operations on monomials) |
---|
998 | 2 plus tests in Level 2 poly routines (operations on single exponents) |
---|
999 | -- see also polys.h for more info |
---|
1000 | |
---|
1001 | NOTE: you can set the value of PDEBUG on a per-file basis, before |
---|
1002 | including mod2.h, provided ! PDEBUG is defined in mod2.h E.g.: |
---|
1003 | |
---|
1004 | #define PDEBUG 2 |
---|
1005 | #include <kernel/mod2.h> |
---|
1006 | ... |
---|
1007 | |
---|
1008 | makes sure that all poly operations in your file are done with |
---|
1009 | PDEBUG == 2 |
---|
1010 | To break after an error occured, set a debugger breakpoint on |
---|
1011 | dErrorBreak. |
---|
1012 | */ |
---|
1013 | #ifndef PDEBUG |
---|
1014 | #define PDEBUG 0 |
---|
1015 | #endif |
---|
1016 | |
---|
1017 | /* define MDEBUG to enable memory checks */ |
---|
1018 | #define MDEBUG 0 |
---|
1019 | |
---|
1020 | #ifdef MDEBUG |
---|
1021 | /* If ! defined(OM_NDEBUG) and (defined(OM_TRACK) or defined(OM_CHECK) |
---|
1022 | then omDebug routines are used for memory allocation/free: |
---|
1023 | |
---|
1024 | The omDebug routines are controlled by the values of OM_TRACK, OM_CHECK |
---|
1025 | and OM_KEEP. There meaning is roughly as follows: |
---|
1026 | OM_TRACK: strored with address : extra space |
---|
1027 | 0 : no additional info is stored : 0 |
---|
1028 | 1 : file:line of location where address was allocated : 1 word |
---|
1029 | 2 : plus backtrace of stack where adress was allocated: 6 words |
---|
1030 | 3 : plus size/bin info and front-, and back padding : 9 words |
---|
1031 | 4 : plus file:line of location where adress was freed : 10 words |
---|
1032 | 5 : plus backtrace of stack where adress was allocated: 15 words |
---|
1033 | OM_CHECK: checks done |
---|
1034 | 0 : no checks |
---|
1035 | 1 : constant-time checks: i.e. addr checks only |
---|
1036 | 2 : plus linear-time checks and constant related bin check |
---|
1037 | 3 : plus quadratic-time checks and linear-time related bin checks and |
---|
1038 | constant time all memory checks |
---|
1039 | 4 : and so on |
---|
1040 | ==> for OM_CHECK >= 3 it gets rather slow |
---|
1041 | OM_KEEP: determines whether addresses are really freed ( |
---|
1042 | 0 : addresses are really freed |
---|
1043 | 1 : addresses are only marked as free and not really freed. |
---|
1044 | |
---|
1045 | OM_CHECK, OM_TRACK, and OM_KEEP can be set on a per-file basis |
---|
1046 | (as can OM_NDEBUG), e.g.: |
---|
1047 | #define OM_CHECK 3 |
---|
1048 | #define OM_TRACK 5 |
---|
1049 | #define OM_KEEP 1 |
---|
1050 | #include <kernel/mod2.h> |
---|
1051 | #include <omalloc/omalloc.h> |
---|
1052 | ensures that all memory allocs/free in this file are done with |
---|
1053 | OM_CHECK==3 and OM_TRACK==5, and that all addresses allocated/freed |
---|
1054 | in this file are only marked as free and never really freed. |
---|
1055 | |
---|
1056 | To set OM_CHECK, OM_TRACK and OM_KEEP under dynamic scope, set |
---|
1057 | om_Opts.MinCheck, om_Opts.MinTrack to the respectiv values and |
---|
1058 | om_Opts.Keep to the number of addresses which are kept before they are |
---|
1059 | actually freed. E.g.: |
---|
1060 | int check=om_Opts.MinCheck, track=om_Opts.MinTrack, keep= m_OPts.Keep; |
---|
1061 | om_Opts.MinCheck = 3; om_Opts.MinTrack = 5; omOpts.Keep = LONG_MAX; |
---|
1062 | ExternalRoutine(); |
---|
1063 | om_Opts.MinCheck = check; omOpts.MinTrack = track; omOpts.Keep = keep; |
---|
1064 | ensures that all calls omDebug routines occuring during the computation of |
---|
1065 | ExternalRoutine() are done with OM_CHECK==3 and OM_TRACK==5, and |
---|
1066 | calls to omFree only mark addresses as free and not really free them. |
---|
1067 | |
---|
1068 | Furthermore, the value of OM_SING_KEEP (resp. om_Opts.Keep) specifies |
---|
1069 | how many addresses are kept before they are actually freed, independently |
---|
1070 | of the value of OM_KEEP. |
---|
1071 | |
---|
1072 | Some tips on possible values of OM_TRACK, OM_CHECK, OM_KEEP: |
---|
1073 | + To find out about an address that has been freed twice, first locate the |
---|
1074 | file(s) where the error occured, and then at the beginning of these files: |
---|
1075 | #define OM_CHECK 3 |
---|
1076 | #define OM_TRACK 5 |
---|
1077 | #define OM_KEEP 1 |
---|
1078 | #include <kernel/mod2.h> |
---|
1079 | #include <omalloc/omalloc.h> |
---|
1080 | Under dynamic scope, do (e.g., from within the debugger): |
---|
1081 | om_Opts.MinCheck = 3; om_Opts.MinTrack = 5; omOpts.Keep = LONG_MAX; |
---|
1082 | + to find out where "memory corruption" occured, increase value of |
---|
1083 | OM_CHECK - the higher this value is, the more consistency checks are |
---|
1084 | done (However a value > 3 checks the entire memory each time an omalloc |
---|
1085 | routine is used!) |
---|
1086 | |
---|
1087 | Some more tips on the usage of omalloc: |
---|
1088 | + omAlloc*, omRealloc*, omFree*, omCheck* omDebug* omTest* rotuines |
---|
1089 | assume that sizes are > 0 and pointers are != NULL |
---|
1090 | + omalloc*, omrealloc*, omfree* omcheck*, omdebug* omtest* routines allow |
---|
1091 | NULL pointers and sizes == 0 |
---|
1092 | + You can safely use any free/realloc routine in combination with any alloc |
---|
1093 | routine (including the debug versions): E.g., an address allocated with |
---|
1094 | omAllocBin can be freed with omfree, or an adress allocated with |
---|
1095 | om(Debug)Alloc can be freed with omfree, or omFree, or omFreeSize, etc. |
---|
1096 | However, keep in mind that the efficiency decreases from |
---|
1097 | Bin over Size to General routines (i.e., omFreeBin is more efficient than |
---|
1098 | omFreeSize which is more efficient than omFree, likewise with the alloc |
---|
1099 | routines). |
---|
1100 | + if OM_CHECK is undefined or 0, then all omCheck routines do nothing |
---|
1101 | + if OM_CHECK and OM_TRACK are both undefined (or 0), or if OM_NDEBUG is |
---|
1102 | defined, then the "real" alloc/realloc/free macros are used, and all |
---|
1103 | omTest, omDebug and omCheck routines are undefined |
---|
1104 | + to break after an omError occured within a debugger, |
---|
1105 | set a breakpoint on dErrorBreak |
---|
1106 | + to do checks from within the debugger, or to do checks with explicit |
---|
1107 | check level, use omTest routines. |
---|
1108 | */ |
---|
1109 | |
---|
1110 | /* by default, store alloc info and file/line where addr was freed */ |
---|
1111 | #ifndef OM_TRACK |
---|
1112 | #define OM_TRACK 4 |
---|
1113 | #endif |
---|
1114 | /* only do constant-time memory checks */ |
---|
1115 | #ifndef OM_CHECK |
---|
1116 | #define OM_CHECK 1 |
---|
1117 | #endif |
---|
1118 | /* Do actually free memory: |
---|
1119 | (be careful: if this is set, memory is never really freed, |
---|
1120 | but only marked as free) */ |
---|
1121 | #ifndef OM_KEEP |
---|
1122 | #define OM_KEEP 0 |
---|
1123 | #endif |
---|
1124 | /* but only after you have freed 1000 more addresses |
---|
1125 | (this is actually independent of the value of OM_KEEP and used |
---|
1126 | to initialize om_Opts.Keep) */ |
---|
1127 | #ifndef OM_SING_KEEP |
---|
1128 | #define OM_SING_KEEP 1000 |
---|
1129 | #endif |
---|
1130 | |
---|
1131 | #endif /* MDEBUG */ |
---|
1132 | |
---|
1133 | |
---|
1134 | /* undef KDEBUG for check of data during std computations |
---|
1135 | * |
---|
1136 | * define KDEBUG to |
---|
1137 | * 0 for basic tests |
---|
1138 | * 1 for tests in kSpoly |
---|
1139 | * NOTE: You can locally enable tests in kspoly by setting the |
---|
1140 | * define at the beginning of kspoly.cc |
---|
1141 | */ |
---|
1142 | #define KDEBUG 0 |
---|
1143 | |
---|
1144 | /* define LDEBUG checking numbers, undefine otherwise */ |
---|
1145 | #define LDEBUG |
---|
1146 | /* define RDEBUG checking rings (together with TRACE=9) */ |
---|
1147 | //#define RDEBUG |
---|
1148 | /* define TEST for non time critical tests, undefine otherwise */ |
---|
1149 | #define TEST |
---|
1150 | |
---|
1151 | /* #define PAGE_TEST */ |
---|
1152 | |
---|
1153 | /* define YYDEBUG 1 for debugging bison texts, 0 otherwise */ |
---|
1154 | #define YYDEBUG 1 |
---|
1155 | |
---|
1156 | /* Undefine to disable debugging of MP stuff */ |
---|
1157 | #ifdef HAVE_MPSR |
---|
1158 | #define MPSR_DEBUG |
---|
1159 | #endif |
---|
1160 | |
---|
1161 | |
---|
1162 | #ifdef TEST |
---|
1163 | #ifndef buildin_rand |
---|
1164 | #define buildin_rand 1 |
---|
1165 | #endif |
---|
1166 | #endif |
---|
1167 | |
---|
1168 | /* define SPECTRUM_DEBUG and SPECTRUM_PRINT for debugging the spectrum code */ |
---|
1169 | /* define SPECTRUM_IOSTREAM to use C++ iostream for error messages */ |
---|
1170 | |
---|
1171 | /* #define SPECTRUM_DEBUG */ |
---|
1172 | /* #define SPECTRUM_PRINT */ |
---|
1173 | #cmakedefine SPECTRUM_IOSTREAM |
---|
1174 | |
---|
1175 | #ifdef SPECTRUM_DEBUG |
---|
1176 | #define MULTICNT_DEBUG |
---|
1177 | #define GMPRAT_DEBUG |
---|
1178 | #define KMATRIX_DEBUG |
---|
1179 | #define SPLIST_DEBUG |
---|
1180 | #define NPOLYGON_DEBUG |
---|
1181 | #define SEMIC_DEBUG |
---|
1182 | #endif |
---|
1183 | |
---|
1184 | #ifdef SPECTRUM_PRINT |
---|
1185 | #define MULTICNT_PRINT |
---|
1186 | #define GMPRAT_PRINT |
---|
1187 | #define KMATRIX_PRINT |
---|
1188 | #define SPLIST_PRINT |
---|
1189 | #define NPOLYGON_PRINT |
---|
1190 | #define SEMIC_PRINT |
---|
1191 | #endif |
---|
1192 | |
---|
1193 | #ifdef SPECTRUM_IOSTREAM |
---|
1194 | #define MULTICNT_IOSTREAM |
---|
1195 | #define GMPRAT_IOSTREAM |
---|
1196 | #define KMATRIX_IOSTREAM |
---|
1197 | #define SPLIST_IOSTREAM |
---|
1198 | #define NPOLYGON_IOSTREAM |
---|
1199 | #define SEMIC_IOSTREAM |
---|
1200 | #endif |
---|
1201 | |
---|
1202 | |
---|
1203 | #else /* not NDEBUG **************************************************** */ |
---|
1204 | |
---|
1205 | #define NO_PDEBUG |
---|
1206 | |
---|
1207 | /* define YYDEBUG 1 for debugging bison texts, 0 otherwise */ |
---|
1208 | #define YYDEBUG 0 |
---|
1209 | |
---|
1210 | #endif /* not NDEBUG */ |
---|
1211 | |
---|
1212 | /******************************************************************* |
---|
1213 | * |
---|
1214 | * assume(x) -- a handy macro for assumptions |
---|
1215 | * |
---|
1216 | ******************************************************************/ |
---|
1217 | |
---|
1218 | #ifdef __cplusplus |
---|
1219 | extern "C" { |
---|
1220 | #endif |
---|
1221 | // routine which is used to report the error |
---|
1222 | // returns 0 |
---|
1223 | extern int dReportError(const char* fmt, ...); |
---|
1224 | // within a debugger, set a breakpoint on dErrorBreak |
---|
1225 | // which is called after the error has been reported |
---|
1226 | extern void dErrorBreak(); |
---|
1227 | #ifdef __cplusplus |
---|
1228 | } |
---|
1229 | #endif |
---|
1230 | |
---|
1231 | #ifndef HAVE_ASSUME |
---|
1232 | #define assume(x) ((void) 0) |
---|
1233 | #define r_assume(x) ((void) 0) |
---|
1234 | #else /* ! HAVE_ASSUME */ |
---|
1235 | |
---|
1236 | #define assume_violation(s,f,l) \ |
---|
1237 | dReportError("assume violation at %s:%d condition: %s", f,l,s) |
---|
1238 | |
---|
1239 | #define assume(x) _assume(x, __FILE__, __LINE__) |
---|
1240 | #define r_assume(x) _r_assume(x, __FILE__, __LINE__) |
---|
1241 | |
---|
1242 | #define _assume(x, f, l) \ |
---|
1243 | do \ |
---|
1244 | { \ |
---|
1245 | if (! (x)) \ |
---|
1246 | { \ |
---|
1247 | assume_violation(#x, f, l); \ |
---|
1248 | } \ |
---|
1249 | } \ |
---|
1250 | while (0) |
---|
1251 | |
---|
1252 | #define _r_assume(x, f, l) \ |
---|
1253 | do \ |
---|
1254 | { \ |
---|
1255 | if (! (x)) \ |
---|
1256 | { \ |
---|
1257 | assume_violation(#x, f, l); \ |
---|
1258 | return 0; \ |
---|
1259 | } \ |
---|
1260 | } \ |
---|
1261 | while (0) |
---|
1262 | #endif /* HAVE_ASSUME */ |
---|
1263 | |
---|
1264 | /* do have RDEBUG, unless we are doing the very real thing */ |
---|
1265 | #ifdef HAVE_ASSUME |
---|
1266 | #ifndef RDEBUG |
---|
1267 | #define RDEBUG |
---|
1268 | #endif |
---|
1269 | #endif |
---|
1270 | |
---|
1271 | #if SIZEOF_VOIDP == 8 |
---|
1272 | #ifndef OM_CHECK |
---|
1273 | #define OM_CHECK 0 |
---|
1274 | #endif |
---|
1275 | #endif |
---|
1276 | |
---|
1277 | /* If we're not using GNU C, elide __attribute__ */ |
---|
1278 | #ifndef __GNUC__ |
---|
1279 | # define __attribute__(x) /*NOTHING*/ |
---|
1280 | #endif |
---|
1281 | |
---|
1282 | #endif /* MOD2_H */ |
---|