[35aab3] | 1 | /* -*-c++-*- */ |
---|
| 2 | /******************************************************************* |
---|
| 3 | * Computer Algebra System SINGULAR |
---|
| 4 | * |
---|
| 5 | * mod2.h: Main configuration file for Singular |
---|
| 6 | * DO NOT EDIT! |
---|
| 7 | * |
---|
[a8826a6] | 8 | * Version: $Id: mod2.h.in,v 1.3 2005-03-09 13:53:26 bricken Exp $ |
---|
[35aab3] | 9 | *******************************************************************/ |
---|
| 10 | #ifndef MOD2_H |
---|
| 11 | #define MOD2_H |
---|
| 12 | |
---|
| 13 | /******************************************************************* |
---|
| 14 | * Defines which are set by configure |
---|
| 15 | ******************************************************************/ |
---|
| 16 | /* Define to use dynamic linking */ |
---|
| 17 | #undef HAVE_DL |
---|
| 18 | /* Define to use readline lib for fancy display: configure result */ |
---|
| 19 | #undef HAVE_LIBREADLINE |
---|
| 20 | /* Define to use static readline lib for fancy display */ |
---|
| 21 | #undef HAVE_READLINE |
---|
| 22 | /* define to use dynamic version of readline lib */ |
---|
| 23 | #undef HAVE_DYN_RL |
---|
| 24 | /* Define to have dbm links */ |
---|
| 25 | #undef HAVE_DBM |
---|
| 26 | /* Define to have smallgmp */ |
---|
| 27 | #undef HAVE_SMALLGMP |
---|
| 28 | /* Define to have MP links */ |
---|
| 29 | #undef HAVE_MPSR |
---|
| 30 | /* Define to have factory functionality added */ |
---|
| 31 | #undef HAVE_FACTORY |
---|
| 32 | /* Define to have libfac functionality added */ |
---|
| 33 | #undef HAVE_LIBFAC_P |
---|
| 34 | /* Define if you have stdc headers */ |
---|
| 35 | #undef STDC_HEADERS |
---|
| 36 | /* Define if you have asm/sigcontext.h */ |
---|
| 37 | #undef HAVE_ASM_SIGCONTEXT_H |
---|
| 38 | /* Define if you have sys/file.h */ |
---|
| 39 | #undef HAVE_SYS_FILE_H |
---|
| 40 | /* Define if you have sys/stat.h */ |
---|
| 41 | #undef HAVE_SYS_STAT_H |
---|
| 42 | /* Define if you have sys/param.h */ |
---|
| 43 | #undef HAVE_SYS_PARAM_H |
---|
| 44 | /* Define if you have sys/file.h */ |
---|
| 45 | #undef HAVE_SYS_TYPES_H |
---|
| 46 | /* Define if you have sys/ioctl.h */ |
---|
| 47 | #undef HAVE_SYS_IOCTL_H |
---|
| 48 | /* Define if you have sys/time.h */ |
---|
| 49 | #undef HAVE_SYS_TIME_H |
---|
| 50 | /* Define if you have sys/times.h */ |
---|
| 51 | #undef HAVE_SYS_TIMES_H |
---|
| 52 | /* io header: */ |
---|
| 53 | /* Define if you have termcap.h */ |
---|
| 54 | #undef HAVE_TERMCAP_H |
---|
| 55 | /* Define if you have termios.h */ |
---|
| 56 | #undef HAVE_TERMIOS_H |
---|
| 57 | /* Define if you have term.h */ |
---|
| 58 | #undef HAVE_TERM_H |
---|
| 59 | /* Define if you have readline/history.h */ |
---|
| 60 | #undef HAVE_READLINE_HISTORY_H |
---|
| 61 | /* Define if readline/readline.h is ok */ |
---|
| 62 | #undef READLINE_READLINE_H_OK |
---|
| 63 | /* Define if time.h and sys/time.h can be included at the same time */ |
---|
| 64 | #undef TIME_WITH_SYS_TIME |
---|
| 65 | /* Define if you have alloca.h */ |
---|
| 66 | #undef HAVE_ALLOCA_H |
---|
| 67 | /* Define if you have pwd.h */ |
---|
| 68 | #undef HAVE_PWD_H |
---|
| 69 | /* Define if you have unistd.h */ |
---|
| 70 | #undef HAVE_UNISTD_H |
---|
| 71 | /* define if you have malloc.h */ |
---|
| 72 | #undef HAVE_MALLOC_H |
---|
| 73 | /* define if you have pwd.h*/ |
---|
| 74 | #undef HAVE_PWD_H |
---|
| 75 | /* Define if you have alloca */ |
---|
| 76 | #undef HAVE_ALLOCA |
---|
| 77 | /* Define if you have getpagesize */ |
---|
| 78 | #undef GETPAGESIZE |
---|
| 79 | /* Define if you have vprintf */ |
---|
| 80 | #undef HAVE_VPRINTF |
---|
| 81 | /* Define if you have gettimeofday */ |
---|
| 82 | #undef HAVE_GETTIMEOFDAY |
---|
| 83 | /* Define if you have atexit */ |
---|
| 84 | #undef HAVE_ATEXIT |
---|
| 85 | /* Define if you have bcopy, bzero and bcmp |
---|
| 86 | Linux needs that define! */ |
---|
| 87 | #undef HAVE_BCOPY |
---|
| 88 | /* Define if sprintf does not return number of printed chars */ |
---|
| 89 | #undef BSD_SPRINTF |
---|
| 90 | /* define if you have explicit C++ constructors */ |
---|
| 91 | #undef HAVE_EXPLICIT_CONSTR |
---|
| 92 | /* Define if you have the getcwd function. */ |
---|
| 93 | #undef HAVE_GETCWD |
---|
| 94 | /* Define if you have the getwd function. */ |
---|
| 95 | #undef HAVE_GETWD |
---|
| 96 | /* Define if you have snprintf */ |
---|
| 97 | #undef HAVE_VSNPRINTF |
---|
| 98 | /* Define if you have readlink */ |
---|
| 99 | #undef HAVE_READLINK |
---|
| 100 | /* Define if you have usleep */ |
---|
| 101 | #undef HAVE_USLEEP |
---|
| 102 | /* Define if you have sleep */ |
---|
| 103 | #undef HAVE_SLEEP |
---|
| 104 | /* Define if you have setenv */ |
---|
| 105 | #undef HAVE_SETENV |
---|
| 106 | /* Define if you have petpwnam */ |
---|
| 107 | #undef HAVE_GETPWNAM |
---|
| 108 | /* Define if you have popen */ |
---|
| 109 | #undef HAVE_POPEN |
---|
| 110 | /* Define sizeof(char) */ |
---|
| 111 | #define SIZEOF_CHAR 1 |
---|
| 112 | /* Define sizeof(short) */ |
---|
| 113 | #define SIZEOF_SHORT 2 |
---|
| 114 | /* Define sizeof(int) */ |
---|
| 115 | #define SIZEOF_INT 4 |
---|
| 116 | /* Define sizeof(long) */ |
---|
| 117 | #define SIZEOF_LONG 4 |
---|
| 118 | /* Define sizeof(void*) */ |
---|
| 119 | #define SIZEOF_VOIDP 4 |
---|
| 120 | /* Define sizeof(double) */ |
---|
| 121 | #define SIZEOF_DOUBLE 8 |
---|
| 122 | /* Define if your integer format is big endian */ |
---|
| 123 | #undef WORDS_BIGENDIAN |
---|
| 124 | /* Define major version of Singular -- should be set in ../configure.in!!!*/ |
---|
| 125 | #define SINGULAR_MAJOR_VERSION 0 |
---|
| 126 | /* Define minor version of Singular -- should be set in ../configure.in!!! */ |
---|
| 127 | #define SINGULAR_MINOR_VERSION 0 |
---|
| 128 | /* Define sub version of Singular -- should be set in ../configure.in!!! */ |
---|
| 129 | #define SINGULAR_SUB_VERSION 0 |
---|
| 130 | /* Define version as a string */ |
---|
| 131 | #define S_VERSION1 "" |
---|
| 132 | /* Define version date as a string */ |
---|
| 133 | #define S_VERSION2 "" |
---|
| 134 | /* Define uname identifier as a string */ |
---|
| 135 | #define S_UNAME "" |
---|
| 136 | /* Absolute pathname of root directory of Singular source */ |
---|
| 137 | #define S_ROOT_DIR "" |
---|
| 138 | /* Define to use new namespaces techniks */ |
---|
| 139 | #undef HAVE_NAMESPACES |
---|
| 140 | #undef HAVE_NS |
---|
| 141 | /* Define to enable dynamic module code */ |
---|
| 142 | #undef HAVE_DYNAMIC_LOADING |
---|
| 143 | /* Define to enable plural */ |
---|
| 144 | #undef HAVE_PLURAL |
---|
| 145 | |
---|
| 146 | /******************************************************************* |
---|
| 147 | * Defines which are not set by configure |
---|
| 148 | ******************************************************************/ |
---|
| 149 | |
---|
| 150 | /* Default value for timer resolution in ticks per second */ |
---|
| 151 | /* set to 10 for resolution of tenth of a second, etc */ |
---|
| 152 | #define TIMER_RESOLUTION 1 |
---|
| 153 | |
---|
| 154 | /* Undefine to disable the quote/eval of expressions */ |
---|
| 155 | #define SIQ 1 |
---|
| 156 | |
---|
| 157 | /* Define to enable TCL interface */ |
---|
| 158 | #undef HAVE_TCL |
---|
| 159 | |
---|
| 160 | /* Undefine to disable Gerhard's and Wilfried's fast and dirty std computations */ |
---|
| 161 | #define FAST_AND_DIRTY |
---|
| 162 | #ifdef __MWERKS__ |
---|
| 163 | /* includes for Metrowerks */ |
---|
| 164 | #include "mod2.mwerks.h" |
---|
| 165 | #else |
---|
| 166 | /* works around a quirk in gcc in the generation of parser tables */ |
---|
[a8826a6] | 167 | #define INIT_BUG |
---|
[35aab3] | 168 | #endif |
---|
| 169 | |
---|
| 170 | /* eigenvalues */ |
---|
| 171 | #ifndef HAVE_DYNAMIC_LOADING |
---|
| 172 | #define HAVE_EIGENVAL 1 |
---|
| 173 | |
---|
| 174 | /* Gauss-Manin system */ |
---|
| 175 | #define HAVE_GMS 1 |
---|
| 176 | #endif |
---|
| 177 | |
---|
| 178 | /* linear algebra extensions from pcv.h/pcv.cc */ |
---|
| 179 | #define HAVE_PCV 1 |
---|
| 180 | |
---|
| 181 | // procedures to compute with units |
---|
| 182 | #define HAVE_UNITS |
---|
| 183 | |
---|
| 184 | /* Define to use old mechanismen for saving currRing with procedures |
---|
| 185 | * Does not work with HAVE_NAMESPACES enabled |
---|
| 186 | */ |
---|
| 187 | #undef USE_IILOCALRING |
---|
| 188 | |
---|
| 189 | |
---|
| 190 | /* Define to use scanner when loading libraries */ |
---|
| 191 | #define HAVE_LIBPARSER |
---|
| 192 | |
---|
| 193 | /*#define PROFILING*/ |
---|
| 194 | #ifdef PROFILING |
---|
| 195 | #define PROFILER ,0,0 |
---|
| 196 | #else |
---|
| 197 | #define PROFILER |
---|
| 198 | #endif |
---|
| 199 | |
---|
| 200 | /* Define to use gmp for rational arithmetic */ |
---|
| 201 | #define HAVE_GMP |
---|
| 202 | |
---|
| 203 | /******************************************************************* |
---|
| 204 | * Evaluate the set defines |
---|
| 205 | ******************************************************************/ |
---|
| 206 | /* FGLM needs factory */ |
---|
| 207 | #ifdef HAVE_FACTORY |
---|
| 208 | #define HAVE_FGLM |
---|
| 209 | #endif |
---|
| 210 | |
---|
| 211 | /* Define if you want fglm for homogeneous case */ |
---|
| 212 | #ifdef HAVE_FGLM |
---|
| 213 | #undef HAVE_FGLM_HOME |
---|
| 214 | #endif |
---|
| 215 | |
---|
| 216 | /* Spectrum needs GMP */ |
---|
| 217 | #ifdef HAVE_GMP |
---|
| 218 | #define HAVE_SPECTRUM 1 |
---|
| 219 | #endif |
---|
| 220 | |
---|
| 221 | /* Undefine to disable real time measurments */ |
---|
| 222 | #ifdef HAVE_GETTIMEOFDAY |
---|
| 223 | #if ! defined(__MWERKS__) && ! defined(MSDOS) |
---|
| 224 | #define HAVE_RTIMER |
---|
| 225 | #else |
---|
| 226 | #undef HAVE_RTIMER |
---|
| 227 | #endif |
---|
| 228 | #endif |
---|
| 229 | |
---|
| 230 | #if SIZEOF_VOIDP == 8 |
---|
| 231 | /* SIZEOF_LONG == SIZEOF_VOIDP is guaranteed by configure */ |
---|
| 232 | #define ALIGN_8 |
---|
| 233 | #define LOG_SIZEOF_LONG 3 |
---|
| 234 | #define LOG_SIZEOF_VOIDP 3 |
---|
| 235 | #else |
---|
| 236 | #define LOG_SIZEOF_LONG 2 |
---|
| 237 | #define LOG_SIZEOF_VOIDP 2 |
---|
| 238 | #endif |
---|
| 239 | |
---|
| 240 | #ifndef CHAR_BIT |
---|
| 241 | #define CHAR_BIT 8 |
---|
| 242 | #endif |
---|
| 243 | |
---|
| 244 | #define BIT_SIZEOF_LONG CHAR_BIT*SIZEOF_LONG |
---|
| 245 | |
---|
| 246 | #define SINGULAR_VERSION (SINGULAR_MAJOR_VERSION*1000 + SINGULAR_MINOR_VERSION*100 + SINGULAR_SUB_VERSION) |
---|
| 247 | |
---|
| 248 | #if SIZEOF_EXPONENT == 1 |
---|
| 249 | #define MAX_EXPONENT 0x7f |
---|
| 250 | #define MAX_COMPONENT 0xff |
---|
| 251 | #elif SIZEOF_EXPONENT == 2 |
---|
| 252 | #define MAX_EXPONENT 0x7fff |
---|
| 253 | #define MAX_COMPONENT 0xffff |
---|
| 254 | #else /* SIZEOF_EXPONENT == 4 */ |
---|
| 255 | #define MAX_EXPONENT 0x7fffffff |
---|
| 256 | #define MAX_COMPONENT 0xffffffff |
---|
| 257 | #endif |
---|
| 258 | |
---|
| 259 | /******************************************************************* |
---|
| 260 | * Miscellanous Defines |
---|
| 261 | ******************************************************************/ |
---|
| 262 | /* Under HPUX 9, system(...) returns -1 if SIGCHLD does not equal |
---|
| 263 | SIG_DFL. However, if it stays at SIG_DFL we get zombie processes |
---|
| 264 | for terminated childs generated by fork. Therefors some special treatment |
---|
| 265 | is necessary */ |
---|
| 266 | #ifdef HPUX_9 |
---|
| 267 | #include <stdlib.h> |
---|
| 268 | #define system hpux9_system |
---|
| 269 | #ifdef __cplusplus |
---|
| 270 | extern "C" { |
---|
| 271 | #endif |
---|
| 272 | int hpux9_system(const char* system); |
---|
| 273 | #ifdef __cplusplus |
---|
| 274 | } |
---|
| 275 | #endif |
---|
| 276 | #endif |
---|
| 277 | |
---|
| 278 | #ifndef HAVE_LIBPARSER |
---|
| 279 | # undef YYLPDEBUG |
---|
| 280 | #else |
---|
| 281 | # define YYLPDEBUG 1 |
---|
| 282 | #endif |
---|
| 283 | |
---|
| 284 | #ifndef FALSE |
---|
| 285 | #define FALSE 0 |
---|
| 286 | #endif |
---|
| 287 | |
---|
| 288 | #ifndef TRUE |
---|
| 289 | #define TRUE 1 |
---|
| 290 | #endif |
---|
| 291 | |
---|
| 292 | #ifndef NULL |
---|
| 293 | #define NULL (0) |
---|
| 294 | #endif |
---|
| 295 | |
---|
| 296 | #ifndef SEEK_END |
---|
| 297 | #define SEEK_END 2 |
---|
| 298 | #endif |
---|
| 299 | |
---|
| 300 | #ifndef SEEK_SET |
---|
| 301 | #define SEEK_SET 0 |
---|
| 302 | #endif |
---|
| 303 | |
---|
| 304 | #define HALT() m2_end(2) |
---|
| 305 | |
---|
| 306 | #define memcpy4 memcpy |
---|
| 307 | |
---|
| 308 | /* define OLD_RES for res/sres/mres(i,j,k) */ |
---|
| 309 | #undef OLD_RES |
---|
| 310 | |
---|
| 311 | /* the maximal ascii length of an int number + 1 = 11 for 32 bit int */ |
---|
| 312 | #define MAX_INT_LEN 11 |
---|
| 313 | #define MAX_INT_VAL 0x7fffffff |
---|
| 314 | |
---|
| 315 | #ifdef DO_PROFILE |
---|
| 316 | /* define to enable explicit profiling of some crucial inline |
---|
| 317 | * routines and defines */ |
---|
| 318 | #undef DO_DEEP_PROFILE |
---|
| 319 | #endif |
---|
| 320 | |
---|
| 321 | #define buildin_rand 1 |
---|
| 322 | |
---|
| 323 | /* define to enable assume */ |
---|
| 324 | #ifndef HAVE_ASSUME |
---|
| 325 | #undef HAVE_ASSUME |
---|
| 326 | #endif |
---|
| 327 | |
---|
| 328 | /* define LINKAGE to "extern C" if compiling for shared libs */ |
---|
| 329 | #ifndef LINKAGE |
---|
| 330 | #if defined(PIC) |
---|
| 331 | #define LINKAGE extern "C" |
---|
| 332 | #else |
---|
| 333 | #define LINKAGE |
---|
| 334 | #endif |
---|
| 335 | #endif |
---|
| 336 | |
---|
| 337 | |
---|
| 338 | /******************************************************************* |
---|
| 339 | * DEBUG OPTIONS |
---|
| 340 | * -- only significant for for compiling without -DNDEBUG |
---|
| 341 | * -- you better know what your are doing, if you touch this |
---|
| 342 | ******************************************************************/ |
---|
| 343 | #ifndef NDEBUG |
---|
| 344 | |
---|
| 345 | /* undefine to enable inline */ |
---|
| 346 | #define NO_INLINE |
---|
| 347 | |
---|
| 348 | /* undefine to disable assume -- should normally be defined for NDEBUG */ |
---|
| 349 | #define HAVE_ASSUME |
---|
| 350 | |
---|
| 351 | /* undef PDEBUG to disable checks of polys |
---|
| 352 | |
---|
| 353 | define PDEBUG to |
---|
| 354 | 0 for enabling pTest |
---|
| 355 | 1 plus tests in Level 1 poly routines (operations on monomials) |
---|
| 356 | 2 plus tests in Level 2 poly routines (operations on single exponents) |
---|
| 357 | -- see also polys.h for more info |
---|
| 358 | |
---|
| 359 | NOTE: you can set the value of PDEBUG on a per-file basis, before |
---|
| 360 | including mod2.h, provided ! PDEBUG is defined in mod2.h E.g.: |
---|
| 361 | |
---|
| 362 | #define PDEBUG 2 |
---|
| 363 | #include "mod2.h" |
---|
| 364 | ... |
---|
| 365 | |
---|
| 366 | makes sure that all poly operations in your file are done with |
---|
| 367 | PDEBUG == 2 |
---|
| 368 | To break after an error occured, set a debugger breakpoint on |
---|
| 369 | dErrorBreak. |
---|
| 370 | */ |
---|
| 371 | #ifndef PDEBUG |
---|
| 372 | #define PDEBUG 0 |
---|
| 373 | #endif |
---|
| 374 | |
---|
| 375 | /* define MDEBUG to enable memory checks */ |
---|
| 376 | #define MDEBUG 0 |
---|
| 377 | |
---|
| 378 | #ifdef MDEBUG |
---|
| 379 | /* If ! defined(OM_NDEBUG) and (defined(OM_TRACK) or defined(OM_CHECK) |
---|
| 380 | then omDebug routines are used for memory allocation/free: |
---|
| 381 | |
---|
| 382 | The omDebug routines are controlled by the values of OM_TRACK, OM_CHECK |
---|
| 383 | and OM_KEEP. There meaning is roughly as follows: |
---|
| 384 | OM_TRACK: strored with address : extra space |
---|
| 385 | 0 : no additional info is stored : 0 |
---|
| 386 | 1 : file:line of location where address was allocated : 1 word |
---|
| 387 | 2 : plus backtrace of stack where adress was allocated: 6 words |
---|
| 388 | 3 : plus size/bin info and front-, and back padding : 9 words |
---|
| 389 | 4 : plus file:line of location where adress was freed : 10 words |
---|
| 390 | 5 : plus backtrace of stack where adress was allocated: 15 words |
---|
| 391 | OM_CHECK: checks done |
---|
| 392 | 0 : no checks |
---|
| 393 | 1 : constant-time checks: i.e. addr checks only |
---|
| 394 | 2 : plus linear-time checks and constant related bin check |
---|
| 395 | 3 : plus quadratic-time checks and linear-time related bin checks and |
---|
| 396 | constant time all memory checks |
---|
| 397 | 4 : and so on |
---|
| 398 | ==> for OM_CHECK >= 3 it gets rather slow |
---|
| 399 | OM_KEEP: determines whether addresses are really freed ( |
---|
| 400 | 0 : addresses are really freed |
---|
| 401 | 1 : addresses are only marked as free and not really freed. |
---|
| 402 | |
---|
| 403 | OM_CHECK, OM_TRACK, and OM_KEEP can be set on a per-file basis |
---|
| 404 | (as can OM_NDEBUG), e.g.: |
---|
| 405 | #define OM_CHECK 3 |
---|
| 406 | #define OM_TRACK 5 |
---|
| 407 | #define OM_KEEP 1 |
---|
| 408 | #include "mod2.h" |
---|
| 409 | #include "omalloc.h" |
---|
| 410 | ensures that all memory allocs/free in this file are done with |
---|
| 411 | OM_CHECK==3 and OM_TRACK==5, and that all addresses allocated/freed |
---|
| 412 | in this file are only marked as free and never really freed. |
---|
| 413 | |
---|
| 414 | To set OM_CHECK, OM_TRACK and OM_KEEP under dynamic scope, set |
---|
| 415 | om_Opts.MinCheck, om_Opts.MinTrack to the respectiv values and |
---|
| 416 | om_Opts.Keep to the number of addresses which are kept before they are |
---|
| 417 | actually freed. E.g.: |
---|
| 418 | int check=om_Opts.MinCheck, track=om_Opts.MinTrack, keep= m_OPts.Keep; |
---|
| 419 | om_Opts.MinCheck = 3; om_Opts.MinTrack = 5; omOpts.Keep = LONG_MAX; |
---|
| 420 | ExternalRoutine(); |
---|
| 421 | om_Opts.MinCheck = check; omOpts.MinTrack = track; omOpts.Keep = keep; |
---|
| 422 | ensures that all calls omDebug routines occuring during the computation of |
---|
| 423 | ExternalRoutine() are done with OM_CHECK==3 and OM_TRACK==5, and |
---|
| 424 | calls to omFree only mark addresses as free and not really free them. |
---|
| 425 | |
---|
| 426 | Furthermore, the value of OM_SING_KEEP (resp. om_Opts.Keep) specifies |
---|
| 427 | how many addresses are kept before they are actually freed, independently |
---|
| 428 | of the value of OM_KEEP. |
---|
| 429 | |
---|
| 430 | Some tips on possible values of OM_TRACK, OM_CHECK, OM_KEEP: |
---|
| 431 | + To find out about an address that has been freed twice, first locate the |
---|
| 432 | file(s) where the error occured, and then at the beginning of these files: |
---|
| 433 | #define OM_CHECK 3 |
---|
| 434 | #define OM_TRACK 5 |
---|
| 435 | #define OM_KEEP 1 |
---|
| 436 | #include "mod2.h" |
---|
| 437 | #include "omalloc.h" |
---|
| 438 | Under dynamic scope, do (e.g., from within the debugger): |
---|
| 439 | om_Opts.MinCheck = 3; om_Opts.MinTrack = 5; omOpts.Keep = LONG_MAX; |
---|
| 440 | + to find out where "memory corruption" occured, increase value of |
---|
| 441 | OM_CHECK - the higher this value is, the more consistency checks are |
---|
| 442 | done (However a value > 3 checks the entire memory each time an omalloc |
---|
| 443 | routine is used!) |
---|
| 444 | |
---|
| 445 | Some more tips on the usage of omalloc: |
---|
| 446 | + omAlloc*, omRealloc*, omFree*, omCheck* omDebug* omTest* rotuines |
---|
| 447 | assume that sizes are > 0 and pointers are != NULL |
---|
| 448 | + omalloc*, omrealloc*, omfree* omcheck*, omdebug* omtest* routines allow |
---|
| 449 | NULL pointers and sizes == 0 |
---|
| 450 | + You can safely use any free/realloc routine in combination with any alloc |
---|
| 451 | routine (including the debug versions): E.g., an address allocated with |
---|
| 452 | omAllocBin can be freed with omfree, or an adress allocated with |
---|
| 453 | om(Debug)Alloc can be freed with omfree, or omFree, or omFreeSize, etc. |
---|
| 454 | However, keep in mind that the efficiency decreases from |
---|
| 455 | Bin over Size to General routines (i.e., omFreeBin is more efficient than |
---|
| 456 | omFreeSize which is more efficient than omFree, likewise with the alloc |
---|
| 457 | routines). |
---|
| 458 | + if OM_CHECK is undefined or 0, then all omCheck routines do nothing |
---|
| 459 | + if OM_CHECK and OM_TRACK are both undefined (or 0), or if OM_NDEBUG is |
---|
| 460 | defined, then the "real" alloc/realloc/free macros are used, and all |
---|
| 461 | omTest, omDebug and omCheck routines are undefined |
---|
| 462 | + to break after an omError occured within a debugger, |
---|
| 463 | set a breakpoint on dErrorBreak |
---|
| 464 | + to do checks from within the debugger, or to do checks with explicit |
---|
| 465 | check level, use omTest routines. |
---|
| 466 | */ |
---|
| 467 | |
---|
| 468 | /* by default, store alloc info and file/line where addr was freed */ |
---|
| 469 | #ifndef OM_TRACK |
---|
| 470 | #define OM_TRACK 4 |
---|
| 471 | #endif |
---|
| 472 | /* only do constant-time memory checks */ |
---|
| 473 | #ifndef OM_CHECK |
---|
| 474 | #define OM_CHECK 1 |
---|
| 475 | #endif |
---|
| 476 | /* Do actually free memory: |
---|
| 477 | (be careful: if this is set, memory is never really freed, |
---|
| 478 | but only marked as free) */ |
---|
| 479 | #ifndef OM_KEEP |
---|
| 480 | #define OM_KEEP 0 |
---|
| 481 | #endif |
---|
| 482 | /* but only after you have freed 1000 more addresses |
---|
| 483 | (this is actually independent of the value of OM_KEEP and used |
---|
| 484 | to initialize om_Opts.Keep) */ |
---|
| 485 | #ifndef OM_SING_KEEP |
---|
| 486 | #define OM_SING_KEEP 1000 |
---|
| 487 | #endif |
---|
| 488 | |
---|
| 489 | #endif /* MDEBUG */ |
---|
| 490 | |
---|
| 491 | |
---|
| 492 | /* undef KDEBUG for check of data during std computations |
---|
| 493 | * |
---|
| 494 | * define KDEBUG to |
---|
| 495 | * 0 for basic tests |
---|
| 496 | * 1 for tests in kSpoly |
---|
| 497 | * NOTE: You can locally enable tests in kspoly by setting the |
---|
| 498 | * define at the beginning of kspoly.cc |
---|
| 499 | */ |
---|
| 500 | #define KDEBUG 0 |
---|
| 501 | |
---|
| 502 | /* define LDEBUG checking numbers, undefine otherwise */ |
---|
| 503 | #define LDEBUG |
---|
| 504 | /* define RDEBUG checking rings (together with TRACE=9) */ |
---|
| 505 | #define RDEBUG |
---|
| 506 | /* define TEST for non time critical tests, undefine otherwise */ |
---|
| 507 | #define TEST |
---|
| 508 | |
---|
| 509 | /* #define PAGE_TEST */ |
---|
| 510 | |
---|
| 511 | /* define YYDEBUG 1 for debugging bison texts, 0 otherwise */ |
---|
| 512 | #define YYDEBUG 1 |
---|
| 513 | |
---|
| 514 | /* Undefine to disable debugging of MP stuff */ |
---|
| 515 | #ifdef HAVE_MPSR |
---|
| 516 | #define MPSR_DEBUG |
---|
| 517 | #endif |
---|
| 518 | |
---|
| 519 | |
---|
| 520 | #ifdef TEST |
---|
| 521 | #ifndef buildin_rand |
---|
| 522 | #define buildin_rand 1 |
---|
| 523 | #endif |
---|
| 524 | #endif |
---|
| 525 | |
---|
| 526 | /* define SPECTRUM_DEBUG and SPECTRUM_PRINT for debugging the spectrum code */ |
---|
| 527 | /* define SPECTRUM_IOSTREAM to use C++ iostream for error messages */ |
---|
| 528 | |
---|
| 529 | /* #define SPECTRUM_DEBUG */ |
---|
| 530 | /* #define SPECTRUM_PRINT */ |
---|
| 531 | #undef SPECTRUM_IOSTREAM |
---|
| 532 | |
---|
| 533 | #ifdef SPECTRUM_DEBUG |
---|
| 534 | #define MULTICNT_DEBUG |
---|
| 535 | #define GMPRAT_DEBUG |
---|
| 536 | #define KMATRIX_DEBUG |
---|
| 537 | #define SPLIST_DEBUG |
---|
| 538 | #define NPOLYGON_DEBUG |
---|
| 539 | #define SEMIC_DEBUG |
---|
| 540 | #endif |
---|
| 541 | |
---|
| 542 | #ifdef SPECTRUM_PRINT |
---|
| 543 | #define MULTICNT_PRINT |
---|
| 544 | #define GMPRAT_PRINT |
---|
| 545 | #define KMATRIX_PRINT |
---|
| 546 | #define SPLIST_PRINT |
---|
| 547 | #define NPOLYGON_PRINT |
---|
| 548 | #define SEMIC_PRINT |
---|
| 549 | #endif |
---|
| 550 | |
---|
| 551 | #ifdef SPECTRUM_IOSTREAM |
---|
| 552 | #define MULTICNT_IOSTREAM |
---|
| 553 | #define GMPRAT_IOSTREAM |
---|
| 554 | #define KMATRIX_IOSTREAM |
---|
| 555 | #define SPLIST_IOSTREAM |
---|
| 556 | #define NPOLYGON_IOSTREAM |
---|
| 557 | #define SEMIC_IOSTREAM |
---|
| 558 | #endif |
---|
| 559 | |
---|
| 560 | |
---|
| 561 | #else /* not NDEBUG **************************************************** */ |
---|
| 562 | |
---|
| 563 | #define NO_PDEBUG |
---|
| 564 | |
---|
| 565 | /* define YYDEBUG 1 for debugging bison texts, 0 otherwise */ |
---|
| 566 | #define YYDEBUG 0 |
---|
| 567 | |
---|
| 568 | #endif /* not NDEBUG */ |
---|
| 569 | |
---|
| 570 | #ifdef HAVE_NAMESPACES |
---|
| 571 | # undef USE_IILOCALRING |
---|
| 572 | #endif |
---|
| 573 | |
---|
| 574 | /******************************************************************* |
---|
| 575 | * |
---|
| 576 | * assume(x) -- a handy macro for assumptions |
---|
| 577 | * |
---|
| 578 | ******************************************************************/ |
---|
| 579 | |
---|
| 580 | #ifdef __cplusplus |
---|
| 581 | extern "C" { |
---|
| 582 | #endif |
---|
| 583 | // routine which is used to report the error |
---|
| 584 | // returns 0 |
---|
| 585 | extern int dReportError(const char* fmt, ...); |
---|
| 586 | // within a debugger, set a breakpoint on dErrorBreak |
---|
| 587 | // which is called after the error has been reported |
---|
| 588 | extern void dErrorBreak(); |
---|
| 589 | #ifdef __cplusplus |
---|
| 590 | } |
---|
| 591 | #endif |
---|
| 592 | |
---|
| 593 | #ifndef HAVE_ASSUME |
---|
| 594 | #define assume(x) ((void) 0) |
---|
| 595 | #define r_assume(x) ((void) 0) |
---|
| 596 | #else /* ! HAVE_ASSUME */ |
---|
| 597 | |
---|
| 598 | #define assume_violation(s,f,l) \ |
---|
| 599 | dReportError("assume violation at %s:%d condition: %s", f,l,s) |
---|
| 600 | |
---|
| 601 | #define assume(x) _assume(x, __FILE__, __LINE__) |
---|
| 602 | #define r_assume(x) _r_assume(x, __FILE__, __LINE__) |
---|
| 603 | |
---|
| 604 | #define _assume(x, f, l) \ |
---|
| 605 | do \ |
---|
| 606 | { \ |
---|
| 607 | if (! (x)) \ |
---|
| 608 | { \ |
---|
| 609 | assume_violation(#x, f, l); \ |
---|
| 610 | } \ |
---|
| 611 | } \ |
---|
| 612 | while (0) |
---|
| 613 | |
---|
| 614 | #define _r_assume(x, f, l) \ |
---|
| 615 | do \ |
---|
| 616 | { \ |
---|
| 617 | if (! (x)) \ |
---|
| 618 | { \ |
---|
| 619 | assume_violation(#x, f, l); \ |
---|
| 620 | return 0; \ |
---|
| 621 | } \ |
---|
| 622 | } \ |
---|
| 623 | while (0) |
---|
| 624 | #endif /* HAVE_ASSUME */ |
---|
| 625 | |
---|
| 626 | /* do have RDEBUG, unless we are doing the very real thing */ |
---|
| 627 | #ifdef HAVE_ASSUME |
---|
| 628 | #ifndef RDEBUG |
---|
| 629 | #define RDEBUG |
---|
| 630 | #endif |
---|
| 631 | #endif |
---|
| 632 | |
---|
| 633 | #endif /* MOD2_H */ |
---|