source: git/kernel/mod2.h @ 45b4e7

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