source: git/kernel/mod2.h @ 7fe9e13

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