source: git/kernel/mod2.h @ 8ecb43

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