source: git/kernel/mod2.h @ 88479ff

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