source: git/kernel/mod2.h @ 0f401f

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