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