source: git/kernel/mod2.h @ 1d9b39

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