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

spielwiese
Last change on this file since 6ce030f was 6ce030f, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
removal of the $Id$ svn tag from everywhere NOTE: the git SHA1 may be used instead (only on special places) NOTE: the libraries Singular/LIB/*.lib still contain the marker due to our current use of svn
  • 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 <misc/auxiliary.h>
13
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/*defines, which should be set by configure */
27#define HAVE_GETTIMEOFDAY 1
28#define TIME_WITH_SYS_TIME 1
29#define HAVE_SYS_TIME_H 1
30#define PROC_BUG 1
31/* Default value for timer resolution in ticks per second */
32/* set to 10 for resolution of tenth of a second, etc */
33#define TIMER_RESOLUTION 1
34
35/* Undefine to disable the quote/eval of expressions */
36#define SIQ 1
37
38/* Undefine to disable Gerhard's and Wilfried's fast and dirty std computations */
39#define FAST_AND_DIRTY
40
41#ifndef HAVE_DYNAMIC_LOADING
42/* eigenvalues */
43#define HAVE_EIGENVAL 1
44
45/* Gauss-Manin system */
46#define HAVE_GMS 1
47#endif
48
49/* linear algebra extensions from pcv.h/pcv.cc */
50#define HAVE_PCV 1
51
52/* procedures to compute groebner bases with the f5 implementation */
53/* still testing */
54#undef HAVE_F5
55
56/* procedures to compute groebner bases with the f5c implementation */
57/* still testing */
58#undef HAVE_F5C
59
60/* procedures to compute with units */
61#define HAVE_UNITS
62
63/* Define to use scanner when loading libraries */
64#define HAVE_LIBPARSER
65
66/*#define PROFILING*/
67#ifdef PROFILING
68#define PROFILER ,0,0
69#else
70#define PROFILER
71#endif
72
73/*******************************************************************
74 * Evaluate the set defines
75 ******************************************************************/
76/* Spectrum needs GMP */
77#define HAVE_SPECTRUM 1
78
79#if SIZEOF_VOIDP == 8
80/* SIZEOF_LONG == SIZEOF_VOIDP is guaranteed by configure */
81#define ALIGN_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#undef HAVE_MPSR
324// #define MPSR_DEBUG
325#endif
326
327#ifdef MPSR_DEBUG
328#undef MPSR_DEBUG
329#endif
330
331
332/* define SPECTRUM_DEBUG and SPECTRUM_PRINT for debugging the spectrum code */
333/* define SPECTRUM_IOSTREAM to use C++ iostream for error messages          */
334
335/* #define SPECTRUM_DEBUG */
336/* #define SPECTRUM_PRINT */
337#undef  SPECTRUM_IOSTREAM
338
339#ifdef  SPECTRUM_DEBUG
340#define MULTICNT_DEBUG
341#define GMPRAT_DEBUG
342#define KMATRIX_DEBUG
343#define SPLIST_DEBUG
344#define NPOLYGON_DEBUG
345#define SEMIC_DEBUG
346#endif
347
348#ifdef  SPECTRUM_PRINT
349#define MULTICNT_PRINT
350#define GMPRAT_PRINT
351#define KMATRIX_PRINT
352#define SPLIST_PRINT
353#define NPOLYGON_PRINT
354#define SEMIC_PRINT
355#endif
356
357#ifdef  SPECTRUM_IOSTREAM
358#define MULTICNT_IOSTREAM
359#define GMPRAT_IOSTREAM
360#define KMATRIX_IOSTREAM
361#define SPLIST_IOSTREAM
362#define NPOLYGON_IOSTREAM
363#define SEMIC_IOSTREAM
364#endif
365
366
367#else /* not NDEBUG **************************************************** */
368
369#define NO_PDEBUG
370
371/* define YYDEBUG 1 for debugging bison texts, 0 otherwise */
372#define YYDEBUG 0
373
374#endif /* not NDEBUG */
375
376/*******************************************************************
377 *
378 * assume(x) -- a handy macro for assumptions
379 *
380 ******************************************************************/
381
382#ifdef __cplusplus
383extern "C" {
384#endif
385// routine which is used to report the error
386// returns 0
387extern int dReportError(const char* fmt, ...);
388// within a debugger, set a breakpoint on dErrorBreak
389// which is called after the error has been reported
390extern void dErrorBreak();
391#ifdef __cplusplus
392}
393#endif
394
395#ifndef HAVE_ASSUME
396#define assume(x) ((void) 0)
397#define r_assume(x) ((void) 0)
398#else /* ! HAVE_ASSUME */
399
400#define assume_violation(s,f,l) \
401  dReportError("assume violation at %s:%d condition: %s", f,l,s)
402
403#define assume(x)   _assume(x, __FILE__, __LINE__)
404#define r_assume(x) _r_assume(x, __FILE__, __LINE__)
405
406#define _assume(x, f, l)                        \
407do                                              \
408{                                               \
409  if (! (x))                                    \
410  {                                             \
411    assume_violation(#x, f, l);                 \
412  }                                             \
413}                                               \
414while (0)
415
416#define _r_assume(x, f, l)                      \
417do                                              \
418{                                               \
419  if (! (x))                                    \
420  {                                             \
421    assume_violation(#x, f, l);                 \
422    return 0;                                   \
423  }                                             \
424}                                               \
425while (0)
426#endif /* HAVE_ASSUME */
427
428/* do have RDEBUG, unless we are doing the very real thing */
429#ifdef HAVE_ASSUME
430#ifndef RDEBUG
431#define RDEBUG
432#endif
433#endif
434
435#if SIZEOF_VOIDP == 8
436#ifndef OM_CHECK
437#define OM_CHECK 0
438#endif
439#endif
440
441/* If we're not using GNU C, elide __attribute__ */
442#ifndef __GNUC__
443#  define  __attribute__(x)  /*NOTHING*/
444#endif
445
446#define STRINGIFY(name) #name
447#define EXPANDED_STRINGIFY(name) STRINGIFY(name)
448
449#endif /* MOD2_H  */
Note: See TracBrowser for help on using the repository browser.