source: git/kernel/mod2.h @ 6a9f2e

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