source: git/kernel/mod2.h @ fbc7cb

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