source: git/kernel/mod2.h @ 22a09d

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