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