source: git/kernel/mod2.h @ 6c19d8

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