source: git/kernel/structs.h @ 86016d

spielwiese
Last change on this file since 86016d was 86016d, checked in by Motsak Oleksandr <motsak@…>, 17 years ago
*motsak: !+!: factors of SCA, debug print for SCA, "kill squares" in std. * : ncRingType, naming, formatting, unified NC setup. git-svn-id: file:///usr/local/Singular/svn/trunk@9792 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 23.8 KB
Line 
1#ifndef STRUCTS_H
2#define STRUCTS_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: structs.h,v 1.30 2007-01-31 23:51:25 motsak Exp $ */
7/*
8* ABSTRACT
9*/
10
11#include <string.h> /* for memset */
12
13/* standard types */
14typedef unsigned char  uchar;
15typedef unsigned short CARDINAL;
16#if (SIZEOF_LONG == 8)
17typedef int BOOLEAN;
18/* testet on x86_64, gcc 3.4.6: 2 % */
19/* testet on IA64, gcc 3.4.6: 1 % */
20#else
21/* testet on athlon, gcc 2.95.4: 1 % */
22typedef short BOOLEAN;
23#endif
24
25typedef void * Sy_reference;
26#define ADDRESS Sy_reference
27#define BITSET  unsigned int
28
29/* EXPONENT_TYPE is determined by configure und defined in mod2.h */
30/* the following defines should really go into mod2.h,
31   but configure dislikes it */
32
33
34#if defined(i386) || defined(x86_64_Linux) || defined(ix86_SunOS)
35// the following settings seems to be better on i386 and x86_64 processors
36// define if a*b is with mod instead of tables
37#define HAVE_MULT_MOD
38// #define HAVE_GENERIC_ADD
39// #ifdef HAVE_MULT_MOD
40// #define HAVE_DIV_MOD
41// #endif
42#endif
43
44#ifdef IA64_Linux
45// the following settings seems to be better on itanium processors
46// #define HAVE_MULT_MOD
47#define HAVE_GENERIC_ADD
48// #ifdef HAVE_MULT_MOD
49// #define HAVE_DIV_MOD
50// #endif
51#endif
52
53#ifdef SunOS_5
54// #define HAVE_GENERIC_ADD
55#define HAVE_MULT_MOD
56#ifdef HAVE_MULT_MOD
57#define HAVE_DIV_MOD
58#endif
59#endif
60
61#if SIZEOF_LONG == 4
62typedef long long int64;
63#elif SIZEOF_LONG == 8
64typedef long int64;
65#else
66#error int64 undefined
67#endif
68
69
70typedef long Exponent_t;
71typedef long Order_t;
72
73enum tHomog
74{
75   isNotHomog = FALSE,
76   isHomog    = TRUE,
77   testHomog
78};
79enum noeof_t
80{
81  noeof_brace = 1,
82  noeof_asstring,
83  noeof_block,
84  noeof_bracket,
85  noeof_comment,
86  noeof_procname,
87  noeof_string
88};
89
90enum n_coeffType
91{
92  n_unknown=0,
93  n_Zp,
94  n_Q,
95  n_R,
96  n_GF,
97  n_long_R,
98  n_Zp_a,
99  n_Q_a,
100  n_long_C
101};
102
103// #ifdef HAVE_PLURAL
104enum nc_type
105{
106  nc_error = -1, // Something's gone wrong!
107  nc_general = 0, /* yx=q xy+... */
108  nc_skew, /*1*/ /* yx=q xy */
109  nc_comm, /*2*/ /* yx= xy */
110  nc_lie,  /*3*/ /* yx=xy+... */
111  nc_undef, /*4*/  /* for internal reasons */
112
113  nc_exterior /*5*/ // Exterior Algebra(SCA): yx= -xy & (!:) x^2 = 0
114};
115// #endif
116
117typedef enum { LT_NONE, LT_NOTFOUND, LT_SINGULAR, LT_ELF, LT_HPUX, LT_MACH_O} lib_types;
118
119/* C++-part */
120#ifdef __cplusplus
121class ip_smatrix;
122class idrec;
123class intvec;
124class sleftv;
125class slists;
126class sattr;
127class skStrategy;
128class ssyStrategy;
129class procinfo;
130class namerec;
131class kBucket;
132class sBucket;
133#endif
134
135struct n_Procs_s;
136struct sip_sring;
137struct sip_sideal;
138struct sip_link;
139struct spolynom;
140struct _ssubexpr;
141struct _sssym;
142struct snumber;
143struct sip_command;
144struct sip_package;
145struct s_si_link_extension;
146
147typedef struct  n_Procs_s  n_Procs_s;
148
149// #ifdef HAVE_PLURAL
150struct nc_struct;
151typedef struct nc_struct   nc_struct;
152// #endif
153
154typedef struct _ssubexpr   sSubexpr;
155typedef struct _sssym      ssym;
156typedef struct spolyrec    polyrec;
157typedef struct sip_sideal  ip_sideal;
158typedef struct sip_smap    ip_smap;
159typedef struct sip_sring   ip_sring;
160typedef struct sip_link    ip_link;
161typedef struct sip_command ip_command;
162typedef struct sip_package ip_package;
163
164/* the pointer types */
165typedef char *             char_ptr;
166typedef int  *             int_ptr;
167typedef short *            short_ptr;
168typedef void *             void_ptr;
169typedef ip_sring *         ring;
170typedef int                idtyp;
171typedef struct snumber *   number;
172typedef polyrec *          poly;
173typedef poly *             polyset;
174typedef ip_sideal *        ideal;
175typedef ip_smap *          map;
176typedef struct sideal_list *      ideal_list;
177typedef ideal *            resolvente;
178typedef union uutypes      utypes;
179typedef ip_command *       command;
180typedef struct s_si_link_extension *si_link_extension;
181typedef polyrec *   napoly;
182
183#ifdef __cplusplus
184typedef idrec *            idhdl;
185typedef ip_smatrix *       matrix;
186typedef ip_link *          si_link;
187typedef sleftv *           leftv;
188typedef slists *           lists;
189typedef sSubexpr *         Subexpr;
190typedef sattr *            attr;
191typedef skStrategy *       kStrategy;
192typedef ip_package *       package;
193typedef ssyStrategy *      syStrategy;
194typedef procinfo *         procinfov;
195typedef namerec *          namehdl;
196typedef kBucket*           kBucket_pt;
197typedef sBucket*           sBucket_pt;
198typedef struct p_Procs_s p_Procs_s;
199
200// for hdegree.cc
201typedef struct sindlist indlist;
202typedef indlist * indset;
203struct sindlist
204{
205  indset nx;
206  intvec * set;
207};
208
209// for longalg.cc
210struct snaIdeal
211{
212  int anz;
213  napoly *liste;
214};
215typedef struct snaIdeal * naIdeal;
216
217
218// for sparsemat.cc
219typedef struct smprec sm_prec;
220typedef sm_prec * smpoly;
221struct smprec
222{
223  smpoly n;            // the next element
224  int pos;             // position
225  int e;               // level
226  poly m;              // the element
227  float f;             // complexity of the element
228};
229
230struct _scmdnames
231{
232  char *name;
233  short alias;
234  short tokval;
235  short toktype;
236};
237typedef struct _scmdnames cmdnames;
238
239typedef number (*numberfunc)(number a,number b);
240typedef number (*nMapFunc)(number a);
241struct n_Procs_s
242{
243   n_Procs_s* next;
244   // the union stuff
245   // Zp:
246   int npPrimeM;
247   int npPminus1M;
248   #ifdef HAVE_DIV_MOD
249   CARDINAL *npInvTable;
250   #endif
251   #if !defined(HAVE_DIV_MOD) || !defined(HAVE_MULT_MOD)
252   CARDINAL *npExpTable;
253   CARDINAL *npLogTable;
254   #endif
255   // Zp_a, Q_a
256
257   // general stuff
258   numberfunc nMult, nSub ,nAdd ,nDiv, nIntDiv, nIntMod, nExactDiv;
259   void    (*nNew)(number * a);
260   number  (*nInit)(int i);
261   number  (*nPar)(int i);
262   int     (*nParDeg)(number n);
263   int     (*nSize)(number n);
264   int     (*nInt)(number &n);
265   number  (*nNeg)(number a);
266   number  (*nInvers)(number a);
267   number  (*nCopy)(number a);
268   number  (*cfCopy)(number a, const ring r);
269   number  (*nRePart)(number a);
270   number  (*nImPart)(number a);
271   void    (*nWrite)(number &a);
272   char *  (*nRead)(char * s, number * a);
273   void    (*nNormalize)(number &a);
274   BOOLEAN (*nGreater)(number a,number b),
275           (*nEqual)(number a,number b),
276           (*nIsZero)(number a),
277           (*nIsOne)(number a),
278           (*nIsMOne)(number a),
279           (*nGreaterZero)(number a);
280   void    (*nPower)(number a, int i, number * result);
281   number  (*n_GetDenom)(number &n, const ring r);
282   number  (*nGcd)(number a, number b, const ring r);
283   number  (*nLcm)(number a, number b, const ring r);
284   void    (*cfDelete)(number * a, const ring r);
285   nMapFunc (*cfSetMap)(ring src, ring dst);
286   char *  (*nName)(number n);
287   void    (*nInpMult)(number &a, number b, ring r);
288//extern number  (*nMap)(number from);
289
290   number nNULL; /* the 0 as constant */
291   int     char_flag;
292   int     ref;
293   short   nChar;
294   n_coeffType type;
295};
296/* current ring stuff */
297
298extern ring      currRing;
299extern ideal     currQuotient;
300extern idhdl      currRingHdl;
301
302#ifndef HAVE_NS
303extern idhdl      idroot;
304#define IDROOT idroot
305#endif /* ! HAVE_NS */
306
307#ifdef HAVE_NS
308extern idhdl currPackHdl;
309extern idhdl basePackHdl;
310extern package currPack;
311extern package basePack;
312#define IDROOT (currPack->idroot)
313#endif /* HAVE_NS */
314
315/* the function pointer types */
316
317typedef long     (*pLDegProc)(poly p, int *length, ring r);
318typedef long     (*pFDegProc)(poly p, ring r);
319typedef void     (*p_SetmProc)(poly p, const ring r);
320
321typedef enum
322{
323  ro_dp, // ordering is a degree ordering
324  ro_wp, // ordering is a weighted degree ordering
325  ro_wp64, // ordering is a weighted64 degree ordering
326  ro_wp_neg, // ordering is a weighted degree ordering
327             // with possibly negative weights
328  ro_cp,    // ordering duplicates variables
329  ro_syzcomp, // ordering indicates "subset" of component number
330  ro_syz, // ordering  with component number >syzcomp is lower
331  ro_none
332}
333ro_typ;
334
335// ordering is a degree ordering
336struct sro_dp
337{
338  short place;  // where degree is stored (in L):
339  short start;  // bounds of ordering (in E):
340  short end;
341};
342typedef struct sro_dp sro_dp;
343
344// ordering is a weighted degree ordering
345struct sro_wp
346{
347  short place;  // where weighted degree is stored (in L)
348  short start;  // bounds of ordering (in E)
349  short end;
350  int *weights; // pointers into wvhdl field
351};
352typedef struct sro_wp sro_wp;
353
354// ordering is a weighted degree ordering
355struct sro_wp64
356{
357    short place;  // where weighted degree is stored (in L)
358    short start;  // bounds of ordering (in E)
359    short end;
360    int64 *weights64; // pointers into wvhdl field
361};
362typedef struct sro_wp64 sro_wp64;
363
364// ordering duplicates variables
365struct sro_cp
366{
367  short place;  // where start is copied to (in E)
368  short start;  // bounds of sources of copied variables (in E)
369  short end;
370};
371typedef struct sro_cp sro_cp;
372
373// ordering indicates "subset" of component number
374struct sro_syzcomp
375{
376  short place;  // where the index is stored (in L)
377  long *ShiftedComponents; // pointer into index field
378  int* Components;
379#ifdef PDEBUG
380  long length;
381#endif
382};
383typedef struct sro_syzcomp sro_syzcomp;
384
385// ordering  with component number >syzcomp is lower
386struct sro_syz
387{
388  short place;       // where the index is stored (in L)
389  int limit;         // syzcomp
390  int* syz_index;    // mapping Component -> SyzIndex for Comp <= limit
391  int  curr_index;   // SyzIndex for Component > limit
392};
393
394typedef struct sro_syz sro_syz;
395
396#ifndef OM_ALLOC_H
397struct omBin_s;
398#endif
399
400struct sro_ord
401{
402  ro_typ  ord_typ;
403  int     order_index; // comes from r->order[order_index]
404  union
405  {
406     sro_dp dp;
407     sro_wp wp;
408     sro_wp64 wp64;
409     sro_cp cp;
410     sro_syzcomp syzcomp;
411     sro_syz syz;
412  } data;
413};
414
415#ifdef HAVE_PLURAL
416// NC pProcs:
417typedef poly (*mm_Mult_p_Proc_Ptr)(const poly m, poly p, const ring r);
418typedef poly (*mm_Mult_pp_Proc_Ptr)(const poly m, const poly p, const ring r);
419
420typedef ideal (*GB_Proc_Ptr)(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat);
421
422typedef poly (*SPoly_Proc_Ptr)(const poly p1, const poly p2, const ring r);
423typedef poly (*SPolyReduce_Proc_Ptr)(const poly p1, poly p2, const ring r);
424
425typedef void (*bucket_Proc_Ptr)(kBucket_pt b, poly p, number *c);
426
427struct nc_pProcs
428{
429public:
430  mm_Mult_p_Proc_Ptr                    mm_Mult_p;
431  mm_Mult_pp_Proc_Ptr                   mm_Mult_pp;
432
433  bucket_Proc_Ptr                       BucketPolyRed;
434  bucket_Proc_Ptr                       BucketPolyRed_Z;
435
436  SPoly_Proc_Ptr                        SPoly;
437  SPolyReduce_Proc_Ptr                  ReduceSPoly;
438
439  GB_Proc_Ptr                           GB;
440//                                         GlobalGB, // BBA
441//                                         LocalGB;  // MORA
442};
443
444
445struct nc_struct
446{
447  short ref;
448  nc_type type;
449  ring basering; // the ring C,D,.. live in
450  matrix C;
451  matrix D;
452  matrix *MT;
453  matrix COM;
454  int *MTsize;
455
456  // IsSkewConstantindicates whethere coeffs C_ij are all equal, effective together with nc_type=nc_skew
457  int IsSkewConstant;
458
459  private:
460    // treat variables from iAltVarsStart till iAltVarsEnd as alternating vars.
461    // these variables should have odd degree, though that will not be checked
462    // iAltVarsStart, iAltVarsEnd are only used together with nc_type=nc_exterior
463    // 1 <= iAltVarsStart <= iAltVarsEnd <= r->N
464    unsigned int iFirstAltVar, iLastAltVar; // = 0 by default
465   
466    // for factors of super-commutative algebras we need
467    // the part of general quotient ideal modulo squares!   
468    ideal idSCAQuotient; // = NULL by default.
469
470  public:
471    inline unsigned int& FirstAltVar() { return (iFirstAltVar); };
472    inline unsigned int& LastAltVar () { return (iLastAltVar ); };
473
474    inline unsigned int FirstAltVar() const { return (iFirstAltVar); };
475    inline unsigned int LastAltVar () const { return (iLastAltVar ); };
476
477    inline ideal& SCAQuotient() { return (idSCAQuotient); };
478
479  public:
480    nc_pProcs p_Procs; // NC procedures.
481
482};
483#endif
484#if 0
485struct nc_struct
486{
487  short ref;
488  nc_type type;
489  ring basering; // the ring C,D,.. live in
490  matrix C;
491  matrix D;
492  matrix *MT;
493  matrix COM;
494  int *MTsize;
495  int IsSkewConstant; /* indicates whethere coeffs C_ij are all equal */
496  /* effective together with nc_type=nc_skew */
497};
498#endif
499
500
501struct sip_sring
502{
503  idhdl      idroot; /* local objects */
504  int*       order;  /* array of orderings */
505  int*       block0; /* starting pos.*/
506  int*       block1; /* ending pos.*/
507  char**     parameter; /* names of parameters */
508  number     minpoly;
509  ideal      minideal;
510  int**      wvhdl;  /* array of weight vectors */
511  char **    names;  /* array of variable names */
512
513  unsigned long options; /* ring dependent options */
514
515  // what follows below here should be set by rComplete, _only_
516  long      *ordsgn;  /* array of +/- 1 (or 0) for comparing monomials */
517                       /*  ExpL_Size entries*/
518
519  // is NULL for lp or N == 1, otherwise non-NULL (with OrdSize > 0 entries) */
520  sro_ord*   typ;   /* array of orderings + sizes, OrdSize entries */
521
522  ideal      qideal; /* extension to the ring structure: qring */
523
524
525  int*     VarOffset;
526  int*     firstwv;
527
528  struct omBin_s*   PolyBin; /* Bin from where monoms are allocated */
529  int        ch;     /* characteristic */
530#ifdef HAVE_RING2TOM
531  int        cring;  /* cring = 0 => coefficient field, cring = 1 => coeffs from Z/2^m */
532#endif
533  int        ref; /* reference counter to the ring */
534
535  short      float_len; /* additional char-flags */
536  short      float_len2; /* additional char-flags */
537
538  short      N;      /* number of vars */
539
540  short      P;      /* number of pars */
541  short      OrdSgn; /* 1 for polynomial rings, -1 otherwise */
542
543  short     firstBlockEnds;
544
545
546  BOOLEAN   VectorOut;
547  BOOLEAN   ShortOut;
548  BOOLEAN   CanShortOut;
549  BOOLEAN   LexOrder;
550  // TRUE if the monomial ordering has polynomial and power series blocks
551  BOOLEAN   MixedOrder;
552  // 1 for lex ordering (except ls), -1 otherwise
553  BOOLEAN   ComponentOrder;
554
555
556  // what follows below here should be set by rComplete, _only_
557  // contains component, but no weight fields in E */
558  short      ExpL_Size; // size of exponent vector in long
559  short      CmpL_Size; // portions which need to be compared
560  /* number of long vars in exp vector:
561     long vars are those longs in the exponent vector which are
562     occupied by variables, only */
563  short     VarL_Size;
564
565  short      BitsPerExp; /* number of bits per exponent */
566  short      ExpPerLong; /* maximal number of Exponents per long */
567
568  short      pCompIndex; /* p->exp.e[pCompIndex] is the component */
569  short      pOrdIndex; /* p->exp[pOrdIndex] is pGetOrd(p) */
570
571  short      OrdSize; /* size of ord vector (in sro_ord) */
572
573
574  /* if >= 0, long vars in exp vector are consecutive and start there
575     if <  0, long vars in exp vector are not consecutive */
576  short     VarL_LowIndex;
577  // number of exponents in r->VarL_Offset[0]
578  // is minimal number of exponents in a long var
579  short     MinExpPerLong;
580
581  /* if this is > 0, then NegWeightL_Offset[0..size_1] is index of longs in
582   ExpVector whose values need an offset due to negative weights */
583  short     NegWeightL_Size;
584  /* array of NegWeigtL_Size indicies */
585  int*      NegWeightL_Offset;
586
587  /* array of size VarL_Size,
588     VarL_Offset[i] gets i-th long var in exp vector */
589  int*      VarL_Offset;
590
591  /* mask for getting single exponents */
592  unsigned long bitmask;
593  /* mask used for divisiblity tests */
594  unsigned long divmask;
595
596  p_Procs_s*    p_Procs;
597
598  /* FDeg and LDeg */
599  pFDegProc     pFDeg;
600  pLDegProc     pLDeg;
601
602  /* as it was determined by rComplete */
603  pFDegProc     pFDegOrig;
604  /* and as it was determined before rOptimizeLDeg */
605  pLDegProc     pLDegOrig;
606
607  p_SetmProc    p_Setm;
608  n_Procs_s*    cf;
609  ring          algring;
610#ifdef HAVE_PLURAL
611  nc_struct     *nc;
612#endif
613};
614
615struct sip_sideal
616{
617  poly*  m;
618  long rank;
619  int nrows;
620  int ncols;
621  #define IDELEMS(i) ((i)->ncols)
622  inline int& idelems(void) { return ncols; }
623};
624
625struct sip_smap
626{
627  poly *m;
628  char *preimage;
629  int nrows;
630  int ncols;
631};
632
633struct sideal_list
634{
635  ideal_list next;
636  ideal      d;
637#ifndef NDEBUG
638  int nr;
639#endif
640};
641#endif /* __cplusplus */
642
643
644
645/*
646**  7. runtime procedures/global data
647*/
648
649/* 7.1 C-routines : */
650
651
652#ifdef __cplusplus
653extern "C" {
654#endif
655void  m2_end(int i);
656#ifdef __cplusplus
657}
658#endif
659
660/* 7.2 C++-routines : */
661
662#ifdef __cplusplus
663int   inits(void);
664int   IsPrime(int i);
665#ifdef buildin_rand
666extern int siSeed;
667int siRand();
668#endif
669#endif
670
671/*the general set of std-options --> kutil.cc */
672extern BITSET test;
673/*the general set of verbose-options --> febase.cc */
674#ifdef __cplusplus
675extern "C" BITSET verbose;
676#else
677extern BITSET verbose;
678#endif
679/*debugging the bison grammar --> grammar.cc*/
680#ifdef YYDEBUG
681#if YYDEBUG
682extern int    yydebug;
683#endif
684#endif
685
686extern int      yylineno;
687extern char     my_yylinebuf[80];
688
689#define loop for(;;)
690
691#ifndef ABS
692#define ABS(x) ((x)<0?(-(x)):(x))
693#endif
694
695#if defined(__cplusplus)
696inline int si_max(const int a, const int b)  { return (a>b) ? a : b; }
697inline int si_min(const int a, const int b)  { return (a<b) ? a : b; }
698#if defined(DecAlpha_Linux) || defined(IA64_Linux)
699inline long si_max(const long a, const long b)  { return (a>b) ? a : b; }
700inline long si_min(const long a, const long b)  { return (a<b) ? a : b; }
701#endif
702#else
703#define si_max(A,B) ((A) > (B) ? (A) : (B))
704#define si_min(A,B) ((A) < (B) ? (A) : (B))
705#endif
706
707/*
708**  Set operations (small sets only)
709*/
710
711#define Sy_bit(x)     ((unsigned)1<<(x))
712#define Sy_inset(x,s) ((Sy_bit(x)&(s))?TRUE:FALSE)
713#define BTEST1(a)     Sy_inset((a), test)
714#define BVERBOSE(a)   Sy_inset((a), verbose)
715
716/*
717** defines for BITSETs
718*/
719
720#define V_SHOW_MEM    2
721#define V_YACC        3
722#define V_REDEFINE    4
723#define V_READING     5
724#define V_LOAD_LIB    6
725#define V_DEBUG_LIB   7
726#define V_LOAD_PROC   8
727#define V_DEF_RES     9
728#define V_DEBUG_MEM  10
729#define V_SHOW_USE   11
730#define V_IMAP       12
731#define V_PROMPT     13
732#define V_NSB        14
733#define V_CONTENTSB  15
734#define V_CANCELUNIT 16
735#define V_MODPSOLVSB 17
736#define V_UPTORADICAL 18
737#define V_FINDMONOM  19
738#define V_COEFSTRAT  20
739#define V_IDLIFT     21
740#define V_LENGTH     22
741#define V_DEG_STOP   31
742
743
744#define OPT_PROT           0
745#define OPT_REDSB          1
746#define OPT_NOT_BUCKETS    2
747#define OPT_NOT_SUGAR      3
748#define OPT_INTERRUPT      4
749#define OPT_SUGARCRIT      5
750#define OPT_DEBUG          6
751#define OPT_REDTHROUGH     7
752#define OPT_RETURN_SB      9
753#define OPT_FASTHC        10
754#define OPT_OLDSTD        20
755#define OPT_KEEPVARS      21
756#define OPT_STAIRCASEBOUND 22
757#define OPT_MULTBOUND     23
758#define OPT_DEGBOUND      24
759#define OPT_REDTAIL       25
760#define OPT_INTSTRATEGY   26
761#define OPT_INFREDTAIL    28
762#define OPT_SB_1          29
763#define OPT_NOTREGULARITY 30
764#define OPT_WEIGHTM       31
765
766/* define ring dependent options */
767#define TEST_RINGDEP_OPTS \
768 (Sy_bit(OPT_INTSTRATEGY) | Sy_bit(OPT_REDTHROUGH) | Sy_bit(OPT_REDTAIL))
769
770#define TEST_OPT_PROT              BTEST1(OPT_PROT)
771#define TEST_OPT_REDSB             BTEST1(OPT_REDSB)
772#define TEST_OPT_NOT_BUCKETS       BTEST1(OPT_NOT_BUCKETS)
773#define TEST_OPT_NOT_SUGAR         BTEST1(OPT_NOT_SUGAR)
774#define TEST_OPT_SUGARCRIT         BTEST1(OPT_SUGARCRIT)
775#define TEST_OPT_DEBUG             BTEST1(OPT_DEBUG)
776#define TEST_OPT_FASTHC            BTEST1(OPT_FASTHC)
777#define TEST_OPT_INTSTRATEGY       BTEST1(OPT_INTSTRATEGY)
778#define TEST_OPT_RETURN_SB         BTEST1(OPT_RETURN_SB)
779#define TEST_OPT_KEEPVARS          BTEST1(OPT_KEEPVARS)
780#define TEST_OPT_DEGBOUND          BTEST1(OPT_DEGBOUND)
781#define TEST_OPT_MULTBOUND         BTEST1(OPT_MULTBOUND)
782#define TEST_OPT_STAIRCASEBOUND    BTEST1(OPT_STAIRCASEBOUND)
783#define TEST_OPT_REDTAIL           BTEST1(OPT_REDTAIL)
784#define TEST_OPT_INFREDTAIL        BTEST1(OPT_INFREDTAIL)
785#define TEST_OPT_SB_1              BTEST1(OPT_SB_1)
786#define TEST_OPT_NOTREGULARITY     BTEST1(OPT_NOTREGULARITY)
787#define TEST_OPT_WEIGHTM           BTEST1(OPT_WEIGHTM)
788#define TEST_OPT_REDTHROUGH        BTEST1(OPT_REDTHROUGH)
789#define TEST_OPT_OLDSTD            BTEST1(OPT_OLDSTD)
790#define TEST_OPT_CONTENTSB         BVERBOSE(V_CONTENTSB)
791#define TEST_OPT_CANCELUNIT        BVERBOSE(V_CANCELUNIT)
792#define TEST_OPT_IDLIFT            BVERBOSE(V_IDLIFT)
793#define TEST_OPT_LENGTH            BVERBOSE(V_LENGTH)
794
795#define TEST_VERB_NSB              BVERBOSE(V_NSB)
796#define TEST_V_DEG_STOP            BVERBOSE(V_DEG_STOP)
797#define TEST_V_MODPSOLVSB          BVERBOSE(V_MODPSOLVSB)
798#define TEST_V_COEFSTRAT           BVERBOSE(V_COEFSTRAT)
799#define TEST_V_UPTORADICAL         BVERBOSE(V_UPTORADICAL)
800#define TEST_V_FINDMONOM           BVERBOSE(V_FINDMONOM)
801#ifdef HAVE_LIBPARSER
802#ifdef __cplusplus
803class libstack;
804typedef libstack *  libstackv;
805#endif
806#endif /* HAVE_LIBPARSER */
807
808extern struct omBin_s* MP_INT_bin;
809extern struct omBin_s* char_ptr_bin;
810extern struct omBin_s* ideal_bin;
811extern struct omBin_s* int_bin;
812extern struct omBin_s* poly_bin;
813extern struct omBin_s* void_ptr_bin;
814extern struct omBin_s* indlist_bin;
815extern struct omBin_s* naIdeal_bin;
816extern struct omBin_s* snaIdeal_bin;
817extern struct omBin_s* sm_prec_bin;
818extern struct omBin_s* smprec_bin;
819extern struct omBin_s* sip_sideal_bin;
820extern struct omBin_s* sip_smap_bin;
821extern struct omBin_s* sip_sring_bin;
822extern struct omBin_s* ip_sideal_bin;
823extern struct omBin_s* ip_smap_bin;
824extern struct omBin_s* ip_sring_bin;
825extern struct omBin_s* sleftv_bin;
826
827#ifdef __cplusplus
828union uutypes
829{
830  int           i;
831  ring          uring;
832  poly          p;
833  number        n;
834  ideal         uideal;
835  map           umap;
836  matrix        umatrix;
837  char *        ustring;
838  intvec *      iv;
839  lists         l;
840  si_link       li;
841  package       pack;
842  procinfo *    pinf;
843};
844
845class idrec
846{
847  public:
848  /* !! do not change the first 6 entries !! (see subexpr.h: sleftv) */
849  idhdl      next;
850  char *     id;
851  utypes     data;
852  attr       attribute;
853  BITSET     flag;
854  idtyp      typ;
855
856  short      lev;
857  short      ref;
858
859#define IDNEXT(a)    ((a)->next)
860#define IDTYP(a)     ((a)->typ)
861#define IDFLAG(a)    ((a)->flag)
862#define IDLEV(a)     ((a)->lev)
863#define IDID(a)      ((a)->id)
864#define IDATTR(a)    ((a)->attribute)
865
866#define IDINT(a)    ((int)(long)((a)->data.ustring))
867#define IDDATA(a)   ((a)->data.ustring)
868#define IDRING(a)   ((a)->data.uring)
869#define IDINTVEC(a) ((a)->data.iv)
870#define IDPOLY(a)   ((a)->data.p)
871#define IDBIGINT(a) ((a)->data.n)
872#define IDNUMBER(a) ((a)->data.n)
873#define IDIDEAL(a)  (((a)->data).uideal)
874#define IDMATRIX(a) (((a)->data).umatrix)
875#define IDMAP(a)    (((a)->data).umap)
876#define IDSTRING(a) ((a)->data.ustring)
877#define IDLIST(a)   ((a)->data.l)
878#define IDLINK(a)   ((a)->data.li)
879#define IDPACKAGE(a) ((a)->data.pack)
880#define IDPROC(a)   ((a)->data.pinf)
881
882  idrec() { memset(this,0,sizeof(*this)); }
883  idhdl get(const char * s, int lev);
884  idhdl set(char * s, int lev, idtyp t, BOOLEAN init=TRUE);
885  char * String();
886//  ~idrec();
887};
888
889class proc_singular
890{
891public:
892  long   proc_start;       // position where proc is starting
893  long   def_end;          // position where proc header is ending
894  long   help_start;       // position where help is starting
895  long   help_end;         // position where help is starting
896  long   body_start;       // position where proc-body is starting
897  long   body_end;         // position where proc-body is ending
898  long   example_start;    // position where example is starting
899  long   proc_end;         // position where proc is ending
900  int    proc_lineno;
901  int    body_lineno;
902  int    example_lineno;
903  char   *body;
904  long help_chksum;
905};
906
907struct proc_object
908{
909//public:
910  BOOLEAN (*function)(leftv res, leftv v);
911};
912
913union uprocinfodata;
914
915union uprocinfodata
916{
917public:
918  proc_singular  s;        // data of Singular-procedure
919  struct proc_object    o; // pointer to binary-function
920};
921
922typedef union uprocinfodata procinfodata;
923
924typedef enum { LANG_NONE, LANG_TOP, LANG_SINGULAR, LANG_C, LANG_MAX} language_defs;
925// LANG_TOP     : Toplevel package only
926// LANG_SINGULAR:
927// LANG_C       :
928class procinfo
929{
930public:
931  char          *libname;
932  char          *procname;
933#ifdef HAVE_NS
934  package       pack;
935#endif
936  language_defs language;
937  short         ref;
938  char          is_static;        // if set, proc not accessible for user
939  char          trace_flag;
940  procinfodata  data;
941};
942
943#endif
944
945#endif
946
Note: See TracBrowser for help on using the repository browser.