source: git/kernel/mod2.h @ 8a5c49

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