source: git/kernel/mod2.h @ 7920d2

jengelh-datetimespielwiese
Last change on this file since 7920d2 was 7920d2, checked in by Oleksandr Motsak <motsak@…>, 11 years ago
further deprecation of MP-related stuff!
  • 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#undef HAVE_MPSR
325// #define MPSR_DEBUG
326#endif
327
328#ifdef MPSR_DEBUG
329#undef MPSR_DEBUG
330#endif
331
332
333/* define SPECTRUM_DEBUG and SPECTRUM_PRINT for debugging the spectrum code */
334/* define SPECTRUM_IOSTREAM to use C++ iostream for error messages          */
335
336/* #define SPECTRUM_DEBUG */
337/* #define SPECTRUM_PRINT */
338#undef  SPECTRUM_IOSTREAM
339
340#ifdef  SPECTRUM_DEBUG
341#define MULTICNT_DEBUG
342#define GMPRAT_DEBUG
343#define KMATRIX_DEBUG
344#define SPLIST_DEBUG
345#define NPOLYGON_DEBUG
346#define SEMIC_DEBUG
347#endif
348
349#ifdef  SPECTRUM_PRINT
350#define MULTICNT_PRINT
351#define GMPRAT_PRINT
352#define KMATRIX_PRINT
353#define SPLIST_PRINT
354#define NPOLYGON_PRINT
355#define SEMIC_PRINT
356#endif
357
358#ifdef  SPECTRUM_IOSTREAM
359#define MULTICNT_IOSTREAM
360#define GMPRAT_IOSTREAM
361#define KMATRIX_IOSTREAM
362#define SPLIST_IOSTREAM
363#define NPOLYGON_IOSTREAM
364#define SEMIC_IOSTREAM
365#endif
366
367
368#else /* not NDEBUG **************************************************** */
369
370#define NO_PDEBUG
371
372/* define YYDEBUG 1 for debugging bison texts, 0 otherwise */
373#define YYDEBUG 0
374
375#endif /* not NDEBUG */
376
377/*******************************************************************
378 *
379 * assume(x) -- a handy macro for assumptions
380 *
381 ******************************************************************/
382
383#ifdef __cplusplus
384extern "C" {
385#endif
386// routine which is used to report the error
387// returns 0
388extern int dReportError(const char* fmt, ...);
389// within a debugger, set a breakpoint on dErrorBreak
390// which is called after the error has been reported
391extern void dErrorBreak();
392#ifdef __cplusplus
393}
394#endif
395
396#ifndef HAVE_ASSUME
397#define assume(x) ((void) 0)
398#define r_assume(x) ((void) 0)
399#else /* ! HAVE_ASSUME */
400
401#define assume_violation(s,f,l) \
402  dReportError("assume violation at %s:%d condition: %s", f,l,s)
403
404#define assume(x)   _assume(x, __FILE__, __LINE__)
405#define r_assume(x) _r_assume(x, __FILE__, __LINE__)
406
407#define _assume(x, f, l)                        \
408do                                              \
409{                                               \
410  if (! (x))                                    \
411  {                                             \
412    assume_violation(#x, f, l);                 \
413  }                                             \
414}                                               \
415while (0)
416
417#define _r_assume(x, f, l)                      \
418do                                              \
419{                                               \
420  if (! (x))                                    \
421  {                                             \
422    assume_violation(#x, f, l);                 \
423    return 0;                                   \
424  }                                             \
425}                                               \
426while (0)
427#endif /* HAVE_ASSUME */
428
429/* do have RDEBUG, unless we are doing the very real thing */
430#ifdef HAVE_ASSUME
431#ifndef RDEBUG
432#define RDEBUG
433#endif
434#endif
435
436#if SIZEOF_VOIDP == 8
437#ifndef OM_CHECK
438#define OM_CHECK 0
439#endif
440#endif
441
442/* If we're not using GNU C, elide __attribute__ */
443#ifndef __GNUC__
444#  define  __attribute__(x)  /*NOTHING*/
445#endif
446
447#define STRINGIFY(name) #name
448#define EXPANDED_STRINGIFY(name) STRINGIFY(name)
449
450#endif /* MOD2_H  */
Note: See TracBrowser for help on using the repository browser.