source: git/kernel/mod2.h @ 952b159

spielwiese
Last change on this file since 952b159 was 83192d, checked in by Oleksandr Motsak <motsak@…>, 11 years ago
Fixing the including of "config.h"-files before any other headers + include reordering... fix: also syzextra
  • Property mode set to 100644
File size: 13.3 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#ifndef CXXFLAGS
13#error "PLEASE '#include \"config.h\"' using before mod2.h!!!"
14#endif
15
16
17#include <misc/auxiliary.h>
18
19#define SINGULAR_MAJOR_VERSION 0
20#define SINGULAR_MINOR_VERSION 0
21#define SINGULAR_SUB_VERSION 0
22#define S_ROOT_DIR ""
23
24/* Define version date as a string - temporarily*/
25#define S_VERSION2 ""
26
27/*******************************************************************
28 * Defines which are not set by configure
29 ******************************************************************/
30
31/*defines, which should be set by configure */
32#define HAVE_GETTIMEOFDAY 1
33#define TIME_WITH_SYS_TIME 1
34#define HAVE_SYS_TIME_H 1
35#define PROC_BUG 1
36/* Default value for timer resolution in ticks per second */
37/* set to 10 for resolution of tenth of a second, etc */
38#define TIMER_RESOLUTION 1
39
40/* Undefine to disable the quote/eval of expressions */
41#define SIQ 1
42
43/* Undefine to disable Gerhard's and Wilfried's fast and dirty std computations */
44#define FAST_AND_DIRTY
45
46#if 0
47/* defined(HAVE_DYNAMIC_LOADING)? TODO: the following features are not tested in legacy Singular! :( */
48
49/* eigenvalues */
50#define HAVE_EIGENVAL 1
51
52/* Gauss-Manin system */
53#define HAVE_GMS 1
54
55#endif
56
57/* linear algebra extensions from pcv.h/pcv.cc */
58#define HAVE_PCV 1
59
60/* procedures to compute groebner bases with the f5 implementation */
61/* still testing */
62#undef HAVE_F5
63
64/* procedures to compute groebner bases with the f5c implementation */
65/* still testing */
66#undef HAVE_F5C
67
68/* procedures to compute with units */
69#define HAVE_UNITS
70
71/* Define to use scanner when loading libraries */
72#define HAVE_LIBPARSER
73
74/*#define PROFILING*/
75#ifdef PROFILING
76#define PROFILER ,0,0
77#else
78#define PROFILER
79#endif
80
81/*******************************************************************
82 * Evaluate the set defines
83 ******************************************************************/
84/* Spectrum needs GMP */
85#define HAVE_SPECTRUM 1
86
87#if SIZEOF_VOIDP == 8
88/* SIZEOF_LONG == SIZEOF_VOIDP is guaranteed by configure */
89#define ALIGN_8
90#endif
91
92#define SINGULAR_PATCHLEVEL 0
93#define SINGULAR_VERSION ((SINGULAR_MAJOR_VERSION*1000 + SINGULAR_MINOR_VERSION*100 + SINGULAR_SUB_VERSION*10)+SINGULAR_PATCHLEVEL)
94
95/*******************************************************************
96 * Miscellanous Defines
97 ******************************************************************/
98#ifndef HAVE_LIBPARSER
99#  undef YYLPDEBUG
100#else
101#  define YYLPDEBUG 1
102#endif
103
104#ifndef FALSE
105#define FALSE       0
106#endif
107
108#ifndef TRUE
109#define TRUE        1
110#endif
111
112#ifndef NULL
113#define NULL        (0)
114#endif
115
116#ifndef SEEK_END
117#define SEEK_END 2
118#endif
119
120#ifndef SEEK_SET
121#define SEEK_SET 0
122#endif
123
124#define HALT() m2_end(2)
125
126/* define OLD_RES for res/sres/mres(i,j,k) */
127#undef OLD_RES
128
129/* the maximal ascii length of an int number + 1 = 11 for 32 bit int */
130/* #define MAX_INT_LEN 11 */
131
132
133#ifdef DO_PROFILE
134/* define to enable explicit profiling of some crucial inline
135 * routines and defines  */
136#undef DO_DEEP_PROFILE
137#endif
138
139/* define to enable assume */
140#ifndef HAVE_ASSUME
141#undef HAVE_ASSUME
142#endif
143
144/* define LINKAGE to "extern C" if compiling for shared libs */
145#ifndef LINKAGE
146#if defined(PIC)
147#define LINKAGE extern "C"
148#else
149#define LINKAGE
150#endif
151#endif
152
153
154/*******************************************************************
155 * DEBUG OPTIONS
156 * -- only significant for for compiling without -DNDEBUG
157 * -- you better know what your are doing, if you touch this
158 ******************************************************************/
159#ifndef NDEBUG
160
161/* undefine to enable inline */
162#define NO_INLINE
163
164/* undefine to disable assume -- should normally be defined for NDEBUG */
165#define HAVE_ASSUME
166
167/* undef PDEBUG to disable checks of polys
168
169 define PDEBUG to
170  0 for enabling pTest
171  1 plus tests in Level 1 poly routines (operations on monomials)
172  2 plus tests in Level 2 poly routines (operations on single exponents)
173 -- see also polys.h for more info
174
175 NOTE: you can set the value of PDEBUG on a per-file basis, before
176       including mod2.h, provided ! PDEBUG is defined in mod2.h E.g.:
177
178       #define PDEBUG 2
179       #include "mod2.h"
180       ...
181
182       makes sure that all poly operations in your file are done with
183       PDEBUG == 2
184 To break after an error occured, set a debugger breakpoint on
185 dErrorBreak.
186*/
187#ifndef PDEBUG
188#define PDEBUG 0
189#endif
190
191/* define MDEBUG to enable memory checks */
192#define MDEBUG 0
193
194#ifdef MDEBUG
195/* If ! defined(OM_NDEBUG) and (defined(OM_TRACK) or defined(OM_CHECK)
196   then omDebug routines are used for memory allocation/free:
197
198   The omDebug routines are controlled by the values of OM_TRACK, OM_CHECK
199   and OM_KEEP.  There meaning is roughly as follows:
200   OM_TRACK: strored with address                              : extra space
201     0     : no additional info is stored                      : 0
202     1     : file:line of location where address was allocated : 1 word
203     2     : plus backtrace of stack where adress was allocated: 6 words
204     3     : plus size/bin info and front-, and back padding   : 9 words
205     4     : plus file:line of location where adress was freed : 10 words
206     5     : plus backtrace of stack where adress was allocated: 15 words
207   OM_CHECK: checks done
208     0     : no checks
209     1     : constant-time checks: i.e. addr checks only
210     2     : plus linear-time checks and constant related bin check
211     3     : plus quadratic-time checks and linear-time related bin checks and
212             constant time all memory checks
213     4     : and so on
214     ==> for OM_CHECK >= 3 it gets rather slow
215   OM_KEEP:  determines whether addresses are really freed  (
216     0     : addresses are really freed
217     1     : addresses are only marked as free and not really freed.
218
219   OM_CHECK, OM_TRACK, and OM_KEEP can be set on a per-file basis
220   (as can OM_NDEBUG),  e.g.:
221     #define OM_CHECK 3
222     #define OM_TRACK 5
223     #define OM_KEEP  1
224     #include "mod2.h"
225     #include <omalloc/omalloc.h>
226   ensures that all memory allocs/free in this file are done with
227   OM_CHECK==3 and OM_TRACK==5, and that all addresses allocated/freed
228   in this file are only marked as free and never really freed.
229 
230   To set OM_CHECK, OM_TRACK and OM_KEEP under dynamic scope, set
231   om_Opts.MinCheck, om_Opts.MinTrack to the respectiv values and
232   om_Opts.Keep to the number of addresses which are kept before they are
233   actually freed. E.g.:
234     int check=om_Opts.MinCheck, track=om_Opts.MinTrack, keep= m_OPts.Keep;
235     om_Opts.MinCheck = 3; om_Opts.MinTrack = 5; omOpts.Keep = LONG_MAX;
236     ExternalRoutine();
237     om_Opts.MinCheck = check; omOpts.MinTrack = track; omOpts.Keep = keep;
238   ensures that all calls omDebug routines  occuring during the computation of
239   ExternalRoutine() are done with OM_CHECK==3 and OM_TRACK==5, and
240   calls to omFree only mark addresses as free and not really free them.
241
242   Furthermore, the value of OM_SING_KEEP (resp. om_Opts.Keep) specifies
243   how many addresses are kept before they are actually freed, independently
244   of the value of OM_KEEP.
245
246   Some tips on possible values of OM_TRACK, OM_CHECK, OM_KEEP:
247   + To find out about an address that has been freed twice, first locate the
248     file(s) where the error occured, and then at the beginning of these files:
249       #define OM_CHECK 3
250       #define OM_TRACK 5
251       #define OM_KEEP  1
252       #include "mod2.h"
253       #include <omalloc/omalloc.h>
254     Under dynamic scope, do (e.g., from within the debugger):
255       om_Opts.MinCheck = 3; om_Opts.MinTrack = 5; omOpts.Keep = LONG_MAX;
256   + to find out where "memory corruption" occured, increase value of
257     OM_CHECK - the higher this value is, the more consistency checks are
258     done (However a value > 3 checks the entire memory each time an omalloc
259     routine is used!)
260   
261   Some more tips on the usage of omalloc:
262   + omAlloc*, omRealloc*, omFree*, omCheck* omDebug* omTest* rotuines
263     assume that sizes are > 0 and pointers are != NULL
264   + omalloc*, omrealloc*, omfree* omcheck*, omdebug* omtest* routines allow
265     NULL pointers and sizes == 0
266   + You can safely use any free/realloc routine in combination with any alloc
267     routine (including the debug versions): E.g., an address allocated with
268     omAllocBin can be freed with omfree, or an adress allocated with
269     om(Debug)Alloc can be freed with omfree, or omFree, or omFreeSize, etc.
270     However, keep in mind that the efficiency decreases from
271     Bin over Size to General routines (i.e., omFreeBin is more efficient than
272     omFreeSize which is more efficient than omFree, likewise with the alloc
273     routines).
274   + if OM_CHECK is undefined or 0, then all omCheck routines do nothing
275   + if OM_CHECK and OM_TRACK are both undefined (or 0), or if OM_NDEBUG is
276     defined, then the "real" alloc/realloc/free macros are used, and all
277     omTest, omDebug and omCheck routines are undefined
278   + to break after an omError occured within a debugger,
279     set a breakpoint on dErrorBreak
280   + to do checks from within the debugger, or to do checks with explicit
281     check level, use omTest routines.
282*/
283
284/* by default, store alloc info and file/line where addr was freed */
285#ifndef OM_TRACK
286#define OM_TRACK 4
287#endif
288/* only do constant-time memory checks */
289#ifndef OM_CHECK
290#define OM_CHECK 1
291#endif
292/* Do actually free memory:
293   (be careful: if this is set, memory is never really freed,
294    but only marked as free) */
295#ifndef OM_KEEP
296#define OM_KEEP 0
297#endif
298/* but only after you have freed 1000 more addresses
299   (this is actually independent of the value of OM_KEEP and used
300   to initialize om_Opts.Keep) */
301#ifndef OM_SING_KEEP
302#define OM_SING_KEEP 1000
303#endif
304
305#endif /* MDEBUG */
306
307
308/* undef KDEBUG for check of data during std computations
309 *
310 * define KDEBUG to
311 * 0 for basic tests
312 * 1 for tests in kSpoly
313 * NOTE: You can locally enable tests in kspoly by setting the
314 *       define at the beginning of kspoly.cc
315 */
316#define KDEBUG 0
317
318/* define LDEBUG checking numbers, undefine otherwise */
319#define LDEBUG
320/* define RDEBUG checking rings (together with TRACE=9) */
321#define RDEBUG
322/* define TEST for non time critical tests, undefine otherwise */
323#define TEST
324
325/* #define PAGE_TEST */
326
327/* define YYDEBUG 1 for debugging bison texts, 0 otherwise */
328#define YYDEBUG 1
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) do {} while (0)
395#define r_assume(x) do {} while (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.