source: git/kernel/mod2.h @ e0c8e34

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