source: git/kernel/mod2.h @ f3ea6ce

spielwiese
Last change on this file since f3ea6ce was f3ea6ce, checked in by Oleksandr Motsak <motsak@…>, 13 years ago
ADD: defining DISABLE_GMP_CPP makes cf_gmp.h to use our UGLY! hack to disable C++ functionality from gmp.h FIX: libpolys should define SINGULAR and NOSTREAMIO before using factory => went to misc/auxiliary.h
  • Property mode set to 100644
File size: 13.3 KB
RevLine 
[6c19d8]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>
[f3ea6ce]14
[6c19d8]15#define SINGULAR_MAJOR_VERSION 0
16#define SINGULAR_MINOR_VERSION 0
17#define SINGULAR_SUB_VERSION 0
18#define S_ROOT_DIR ""
19
[88479ff]20/* Define version date as a string - temporarily*/
21#define S_VERSION2 ""
22
[6c19d8]23/*******************************************************************
24 * Defines which are not set by configure
25 ******************************************************************/
26
[8a5c49]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
[15ff9a]31#define PROC_BUG 1
[6c19d8]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/* letterplace gb:*/
60#define HAVE_SHIFTBBA 1
61
62/* procedures to compute with units */
63#define HAVE_UNITS
64
65/* Define to use scanner when loading libraries */
66#define HAVE_LIBPARSER
67
68/*#define PROFILING*/
69#ifdef PROFILING
70#define PROFILER ,0,0
71#else
72#define PROFILER
73#endif
74
75/*******************************************************************
76 * Evaluate the set defines
77 ******************************************************************/
78/* Spectrum needs GMP */
79#define HAVE_SPECTRUM 1
80
81#if SIZEOF_VOIDP == 8
82/* SIZEOF_LONG == SIZEOF_VOIDP is guaranteed by configure */
83#define ALIGN_8
84#endif
85
86#ifndef CHAR_BIT
87#define CHAR_BIT 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#ifdef DO_PROFILE
131/* define to enable explicit profiling of some crucial inline
132 * routines and defines  */
133#undef DO_DEEP_PROFILE
134#endif
135
136/* define to enable assume */
137#ifndef HAVE_ASSUME
138#undef HAVE_ASSUME
139#endif
140
141/* define LINKAGE to "extern C" if compiling for shared libs */
142#ifndef LINKAGE
143#if defined(PIC)
144#define LINKAGE extern "C"
145#else
146#define LINKAGE
147#endif
148#endif
149
150
151/*******************************************************************
152 * DEBUG OPTIONS
153 * -- only significant for for compiling without -DNDEBUG
154 * -- you better know what your are doing, if you touch this
155 ******************************************************************/
156#ifndef NDEBUG
157
158/* undefine to enable inline */
159#define NO_INLINE
160
161/* undefine to disable assume -- should normally be defined for NDEBUG */
162#define HAVE_ASSUME
163
164/* undef PDEBUG to disable checks of polys
165
166 define PDEBUG to
167  0 for enabling pTest
168  1 plus tests in Level 1 poly routines (operations on monomials)
169  2 plus tests in Level 2 poly routines (operations on single exponents)
170 -- see also polys.h for more info
171
172 NOTE: you can set the value of PDEBUG on a per-file basis, before
173       including mod2.h, provided ! PDEBUG is defined in mod2.h E.g.:
174
175       #define PDEBUG 2
176       #include "mod2.h"
177       ...
178
179       makes sure that all poly operations in your file are done with
180       PDEBUG == 2
181 To break after an error occured, set a debugger breakpoint on
182 dErrorBreak.
183*/
184#ifndef PDEBUG
185#define PDEBUG 0
186#endif
187
188/* define MDEBUG to enable memory checks */
189#define MDEBUG 0
190
191#ifdef MDEBUG
192/* If ! defined(OM_NDEBUG) and (defined(OM_TRACK) or defined(OM_CHECK)
193   then omDebug routines are used for memory allocation/free:
194
195   The omDebug routines are controlled by the values of OM_TRACK, OM_CHECK
196   and OM_KEEP.  There meaning is roughly as follows:
197   OM_TRACK: strored with address                              : extra space
198     0     : no additional info is stored                      : 0
199     1     : file:line of location where address was allocated : 1 word
200     2     : plus backtrace of stack where adress was allocated: 6 words
201     3     : plus size/bin info and front-, and back padding   : 9 words
202     4     : plus file:line of location where adress was freed : 10 words
203     5     : plus backtrace of stack where adress was allocated: 15 words
204   OM_CHECK: checks done
205     0     : no checks
206     1     : constant-time checks: i.e. addr checks only
207     2     : plus linear-time checks and constant related bin check
208     3     : plus quadratic-time checks and linear-time related bin checks and
209             constant time all memory checks
210     4     : and so on
211     ==> for OM_CHECK >= 3 it gets rather slow
212   OM_KEEP:  determines whether addresses are really freed  (
213     0     : addresses are really freed
214     1     : addresses are only marked as free and not really freed.
215
216   OM_CHECK, OM_TRACK, and OM_KEEP can be set on a per-file basis
217   (as can OM_NDEBUG),  e.g.:
218     #define OM_CHECK 3
219     #define OM_TRACK 5
220     #define OM_KEEP  1
221     #include "mod2.h"
[76cfef]222     #include <omalloc/omalloc.h>
[6c19d8]223   ensures that all memory allocs/free in this file are done with
224   OM_CHECK==3 and OM_TRACK==5, and that all addresses allocated/freed
225   in this file are only marked as free and never really freed.
226 
227   To set OM_CHECK, OM_TRACK and OM_KEEP under dynamic scope, set
228   om_Opts.MinCheck, om_Opts.MinTrack to the respectiv values and
229   om_Opts.Keep to the number of addresses which are kept before they are
230   actually freed. E.g.:
231     int check=om_Opts.MinCheck, track=om_Opts.MinTrack, keep= m_OPts.Keep;
232     om_Opts.MinCheck = 3; om_Opts.MinTrack = 5; omOpts.Keep = LONG_MAX;
233     ExternalRoutine();
234     om_Opts.MinCheck = check; omOpts.MinTrack = track; omOpts.Keep = keep;
235   ensures that all calls omDebug routines  occuring during the computation of
236   ExternalRoutine() are done with OM_CHECK==3 and OM_TRACK==5, and
237   calls to omFree only mark addresses as free and not really free them.
238
239   Furthermore, the value of OM_SING_KEEP (resp. om_Opts.Keep) specifies
240   how many addresses are kept before they are actually freed, independently
241   of the value of OM_KEEP.
242
243   Some tips on possible values of OM_TRACK, OM_CHECK, OM_KEEP:
244   + To find out about an address that has been freed twice, first locate the
245     file(s) where the error occured, and then at the beginning of these files:
246       #define OM_CHECK 3
247       #define OM_TRACK 5
248       #define OM_KEEP  1
249       #include "mod2.h"
[76cfef]250       #include <omalloc/omalloc.h>
[6c19d8]251     Under dynamic scope, do (e.g., from within the debugger):
252       om_Opts.MinCheck = 3; om_Opts.MinTrack = 5; omOpts.Keep = LONG_MAX;
253   + to find out where "memory corruption" occured, increase value of
254     OM_CHECK - the higher this value is, the more consistency checks are
255     done (However a value > 3 checks the entire memory each time an omalloc
256     routine is used!)
257   
258   Some more tips on the usage of omalloc:
259   + omAlloc*, omRealloc*, omFree*, omCheck* omDebug* omTest* rotuines
260     assume that sizes are > 0 and pointers are != NULL
261   + omalloc*, omrealloc*, omfree* omcheck*, omdebug* omtest* routines allow
262     NULL pointers and sizes == 0
263   + You can safely use any free/realloc routine in combination with any alloc
264     routine (including the debug versions): E.g., an address allocated with
265     omAllocBin can be freed with omfree, or an adress allocated with
266     om(Debug)Alloc can be freed with omfree, or omFree, or omFreeSize, etc.
267     However, keep in mind that the efficiency decreases from
268     Bin over Size to General routines (i.e., omFreeBin is more efficient than
269     omFreeSize which is more efficient than omFree, likewise with the alloc
270     routines).
271   + if OM_CHECK is undefined or 0, then all omCheck routines do nothing
272   + if OM_CHECK and OM_TRACK are both undefined (or 0), or if OM_NDEBUG is
273     defined, then the "real" alloc/realloc/free macros are used, and all
274     omTest, omDebug and omCheck routines are undefined
275   + to break after an omError occured within a debugger,
276     set a breakpoint on dErrorBreak
277   + to do checks from within the debugger, or to do checks with explicit
278     check level, use omTest routines.
279*/
280
281/* by default, store alloc info and file/line where addr was freed */
282#ifndef OM_TRACK
283#define OM_TRACK 4
284#endif
285/* only do constant-time memory checks */
286#ifndef OM_CHECK
287#define OM_CHECK 1
288#endif
289/* Do actually free memory:
290   (be careful: if this is set, memory is never really freed,
291    but only marked as free) */
292#ifndef OM_KEEP
293#define OM_KEEP 0
294#endif
295/* but only after you have freed 1000 more addresses
296   (this is actually independent of the value of OM_KEEP and used
297   to initialize om_Opts.Keep) */
298#ifndef OM_SING_KEEP
299#define OM_SING_KEEP 1000
300#endif
301
302#endif /* MDEBUG */
303
304
305/* undef KDEBUG for check of data during std computations
306 *
307 * define KDEBUG to
308 * 0 for basic tests
309 * 1 for tests in kSpoly
310 * NOTE: You can locally enable tests in kspoly by setting the
311 *       define at the beginning of kspoly.cc
312 */
313#define KDEBUG 0
314
315/* define LDEBUG checking numbers, undefine otherwise */
316#define LDEBUG
317/* define RDEBUG checking rings (together with TRACE=9) */
318#define RDEBUG
319/* define TEST for non time critical tests, undefine otherwise */
320#define TEST
321
322/* #define PAGE_TEST */
323
324/* define YYDEBUG 1 for debugging bison texts, 0 otherwise */
325#define YYDEBUG 1
326
327/* Undefine to disable debugging of MP stuff */
328#ifdef HAVE_MPSR
329#define MPSR_DEBUG
330#endif
331
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 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 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) ((void) 0)
398#define r_assume(x) ((void) 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.