source: git/kernel/structs.h @ 171950

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