source: git/kernel/mod2.h @ cc94f7e

fieker-DuValspielwiese
Last change on this file since cc94f7e was 9bb030, checked in by Hans Schoenemann <hannes@…>, 8 years ago
libpolys/misc/auxiliary.h.in -> libpolys/misc/auxiliary.h
  • 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 *
7 *******************************************************************/
8#ifndef MOD2_H
9#define MOD2_H
10
11/* please include singularconfig.h exclusively via <kernel/mod2.h> and before any other header */
12# include <singularconfig.h>
13# include <misc/auxiliary.h>
14
15#define SINGULAR_MAJOR_VERSION 4
16
17#ifdef SINGULAR_4_1
18#undef VERSION
19#define VERSION "4.1.0"
20#define SINGULAR_MINOR_VERSION 1
21#define SINGULAR_SUB_VERSION 0
22#else
23#define SINGULAR_MINOR_VERSION 0
24#define SINGULAR_SUB_VERSION 3
25#endif
26#define S_ROOT_DIR ""
27
28/*******************************************************************
29 * Defines which are not set by configure
30 ******************************************************************/
31
32/*defines, which should be set by configure */
33#define HAVE_GETTIMEOFDAY 1
34#define TIME_WITH_SYS_TIME 1
35#define HAVE_SYS_TIME_H 1
36/* Default value for timer resolution in ticks per second */
37/* set to 10 for resolution of tenth of a second, etc */
38#define TIMER_RESOLUTION 1
39
40/* Undefine to disable the quote/eval of expressions */
41#define SIQ 1
42
43/* Undefine to disable Gerhard's and Wilfried's fast and dirty std computations */
44#define FAST_AND_DIRTY
45
46/* eigenvalues */
47#define HAVE_EIGENVAL 1
48
49/* Gauss-Manin system */
50#define HAVE_GMS 1
51
52/* include simpleipc/semaphore code, link against librt/libpthread */
53#define HAVE_SIMPLEIPC 1
54
55
56/* linear algebra extensions from pcv.h/pcv.cc */
57#define HAVE_PCV 1
58
59/* procedures to compute groebner bases with the f5 implementation */
60/* still testing */
61#undef HAVE_F5
62
63/* procedures to compute groebner bases with the f5c implementation */
64/* still testing */
65#undef HAVE_F5C
66
67/* procedures to compute with units */
68#define HAVE_UNITS
69
70/* Define to use scanner when loading libraries */
71#define HAVE_LIBPARSER
72
73/*#define PROFILING*/
74#ifdef PROFILING
75#define PROFILER ,0,0
76#else
77#define PROFILER
78#endif
79
80/*******************************************************************
81 * Evaluate the set defines
82 ******************************************************************/
83/* Spectrum needs GMP */
84#define HAVE_SPECTRUM 1
85
86#if SIZEOF_VOIDP == 8
87/* SIZEOF_LONG == SIZEOF_VOIDP is guaranteed by configure */
88#define ALIGN_8
89#endif
90
91#ifdef SINGULAR_4_1
92#define SINGULAR_VERSION 4100
93#else
94#define SINGULAR_PATCHLEVEL 1
95#define SINGULAR_VERSION ((SINGULAR_MAJOR_VERSION*1000 + SINGULAR_MINOR_VERSION*100 + SINGULAR_SUB_VERSION*10)+SINGULAR_PATCHLEVEL)
96#endif
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
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 -DSING_NDEBUG
159 * -- you better know what your are doing, if you touch this
160 ******************************************************************/
161#ifndef SING_NDEBUG
162
163/* undefine to enable inline */
164#define NO_INLINE
165
166/* undefine to disable assume -- should normally be defined for SING_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 occurred, 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/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 occurred, 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/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" occurred, 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 occurred 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/* 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 SING_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 SING_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) do {} while (0)
397#define r_assume(x) do {} while (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.