source: git/kernel/mod2.h @ cd5fefc

fieker-DuValspielwiese
Last change on this file since cd5fefc was 9f7665, checked in by Oleksandr Motsak <motsak@…>, 10 years ago
Removed HAVE_CONFIG guards fix: fixed the inclusion of configure-generated *config.h's
  • Property mode set to 100644
File size: 13.4 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 *******************************************************************/
9#ifndef MOD2_H
10#define MOD2_H
11
12/* please include singularconfig.h exclusively via <kernel/mod2.h> and before any other header */
13# include <singularconfig.h>
14
15# include <misc/auxiliary.h>
16
17#define SINGULAR_MAJOR_VERSION 4
18#define SINGULAR_MINOR_VERSION 0
19#define SINGULAR_SUB_VERSION 0
20#define S_ROOT_DIR ""
21
22/*******************************************************************
23 * Defines which are not set by configure
24 ******************************************************************/
25
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
30#define PROC_BUG 1
31/* Default value for timer resolution in ticks per second */
32/* set to 10 for resolution of tenth of a second, etc */
33#define TIMER_RESOLUTION 1
34
35/* Undefine to disable the quote/eval of expressions */
36#define SIQ 1
37
38/* Undefine to disable Gerhard's and Wilfried's fast and dirty std computations */
39#define FAST_AND_DIRTY
40
41#if 0
42/* defined(HAVE_DYNAMIC_LOADING)? TODO: the following features are not tested in legacy Singular! :( */
43
44/* eigenvalues */
45#define HAVE_EIGENVAL 1
46
47/* Gauss-Manin system */
48#define HAVE_GMS 1
49
50#endif
51
52/* include simpleipc/semaphore code, link against librt/libpthread */
53#define HAVE_SIMPLEIPC 1
54
55
56/* linear algebra extensions from pcv.h/pcv.cc */
57#define HAVE_PCV 1
58
59/* procedures to compute groebner bases with the f5 implementation */
60/* still testing */
61#undef HAVE_F5
62
63/* procedures to compute groebner bases with the f5c implementation */
64/* still testing */
65#undef HAVE_F5C
66
67/* procedures to compute with units */
68#define HAVE_UNITS
69
70/* Define to use scanner when loading libraries */
71#define HAVE_LIBPARSER
72
73/*#define PROFILING*/
74#ifdef PROFILING
75#define PROFILER ,0,0
76#else
77#define PROFILER
78#endif
79
80/*******************************************************************
81 * Evaluate the set defines
82 ******************************************************************/
83/* Spectrum needs GMP */
84#define HAVE_SPECTRUM 1
85
86#if SIZEOF_VOIDP == 8
87/* SIZEOF_LONG == SIZEOF_VOIDP is guaranteed by configure */
88#define ALIGN_8
89#endif
90
91#define SINGULAR_PATCHLEVEL 1
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
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 -DSING_NDEBUG
156 * -- you better know what your are doing, if you touch this
157 ******************************************************************/
158#ifndef SING_NDEBUG
159
160/* undefine to enable inline */
161#define NO_INLINE
162
163/* undefine to disable assume -- should normally be defined for SING_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/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/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/* 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 SING_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 SING_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) do {} while (0)
394#define r_assume(x) do {} while (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.