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