source: git/kernel/mod2.h @ 35d0c19

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