source: git/kernel/structs.h @ 52e2f6

spielwiese
Last change on this file since 52e2f6 was 52e2f6, checked in by Motsak Oleksandr <motsak@…>, 16 years ago
*motsak: major redesign of NC Subsystem, maybe something more... git-svn-id: file:///usr/local/Singular/svn/trunk@10739 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 24.9 KB
Line 
1#ifndef STRUCTS_H
2#define STRUCTS_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: structs.h,v 1.45 2008-06-10 10:17:33 motsak 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  // IsSkewConstant indicates whethere coeffs C_ij are all equal,
477  // effective together with nc_type=nc_skew
478  int IsSkewConstant;
479
480  private:
481    // treat variables from iAltVarsStart till iAltVarsEnd as alternating vars.
482    // these variables should have odd degree, though that will not be checked
483    // iAltVarsStart, iAltVarsEnd are only used together with nc_type=nc_exterior
484    // 1 <= iAltVarsStart <= iAltVarsEnd <= r->N
485    unsigned int iFirstAltVar, iLastAltVar; // = 0 by default
486   
487    // for factors of super-commutative algebras we need
488    // the part of general quotient ideal modulo squares!   
489    ideal idSCAQuotient; // = NULL by default.
490
491  public:
492    inline unsigned int& FirstAltVar() { return (iFirstAltVar); };
493    inline unsigned int& LastAltVar () { return (iLastAltVar ); };
494
495    inline unsigned int FirstAltVar() const { return (iFirstAltVar); };
496    inline unsigned int LastAltVar () const { return (iLastAltVar ); };
497
498    inline ideal& SCAQuotient() { return (idSCAQuotient); };
499
500  public:
501    nc_pProcs p_Procs; // NC procedures.
502
503};
504#endif
505#if 0
506struct nc_struct
507{
508  short ref;
509  nc_type type;
510  ring basering; // the ring C,D,.. live in
511  matrix C;
512  matrix D;
513  matrix *MT;
514  matrix COM;
515  int *MTsize;
516  int IsSkewConstant; /* indicates whethere coeffs C_ij are all equal */
517  /* effective together with nc_type=nc_skew */
518};
519#endif
520
521
522struct sip_sring
523{
524  idhdl      idroot; /* local objects */
525  int*       order;  /* array of orderings */
526  int*       block0; /* starting pos.*/
527  int*       block1; /* ending pos.*/
528  char**     parameter; /* names of parameters */
529  number     minpoly;
530  ideal      minideal;
531  int**      wvhdl;  /* array of weight vectors */
532  char **    names;  /* array of variable names */
533
534  unsigned long options; /* ring dependent options */
535
536  // what follows below here should be set by rComplete, _only_
537  long      *ordsgn;  /* array of +/- 1 (or 0) for comparing monomials */
538                       /*  ExpL_Size entries*/
539
540  // is NULL for lp or N == 1, otherwise non-NULL (with OrdSize > 0 entries) */
541  sro_ord*   typ;   /* array of orderings + sizes, OrdSize entries */
542
543  ideal      qideal; /* extension to the ring structure: qring */
544
545
546  int*     VarOffset;
547  int*     firstwv;
548
549  struct omBin_s*   PolyBin; /* Bin from where monoms are allocated */
550  int        ch;     /* characteristic */
551#ifdef HAVE_RINGS
552  unsigned int ringtype;  /* cring = 0 => coefficient field, cring = 1 => coeffs from Z/2^m */
553  unsigned long long ringflaga;
554  unsigned long ringflagb;
555#endif
556  int        ref; /* reference counter to the ring */
557
558  short      float_len; /* additional char-flags */
559  short      float_len2; /* additional char-flags */
560
561  short      N;      /* number of vars */
562
563  short      P;      /* number of pars */
564  short      OrdSgn; /* 1 for polynomial rings, -1 otherwise */
565
566  short     firstBlockEnds;
567
568
569  BOOLEAN   VectorOut;
570  BOOLEAN   ShortOut;
571  BOOLEAN   CanShortOut;
572  BOOLEAN   LexOrder;
573  // TRUE if the monomial ordering has polynomial and power series blocks
574  BOOLEAN   MixedOrder;
575  // 1 for lex ordering (except ls), -1 otherwise
576  BOOLEAN   ComponentOrder;
577
578
579  // what follows below here should be set by rComplete, _only_
580  // contains component, but no weight fields in E */
581  short      ExpL_Size; // size of exponent vector in long
582  short      CmpL_Size; // portions which need to be compared
583  /* number of long vars in exp vector:
584     long vars are those longs in the exponent vector which are
585     occupied by variables, only */
586  short     VarL_Size;
587
588  short      BitsPerExp; /* number of bits per exponent */
589  short      ExpPerLong; /* maximal number of Exponents per long */
590
591  short      pCompIndex; /* p->exp.e[pCompIndex] is the component */
592  short      pOrdIndex; /* p->exp[pOrdIndex] is pGetOrd(p) */
593
594  short      OrdSize; /* size of ord vector (in sro_ord) */
595
596
597  /* if >= 0, long vars in exp vector are consecutive and start there
598     if <  0, long vars in exp vector are not consecutive */
599  short     VarL_LowIndex;
600  // number of exponents in r->VarL_Offset[0]
601  // is minimal number of exponents in a long var
602  short     MinExpPerLong;
603
604  /* if this is > 0, then NegWeightL_Offset[0..size_1] is index of longs in
605   ExpVector whose values need an offset due to negative weights */
606  short     NegWeightL_Size;
607  /* array of NegWeigtL_Size indicies */
608  int*      NegWeightL_Offset;
609
610  /* array of size VarL_Size,
611     VarL_Offset[i] gets i-th long var in exp vector */
612  int*      VarL_Offset;
613
614  /* mask for getting single exponents */
615  unsigned long bitmask;
616  /* mask used for divisiblity tests */
617  unsigned long divmask;
618
619  p_Procs_s*    p_Procs;
620
621  /* FDeg and LDeg */
622  pFDegProc     pFDeg;
623  pLDegProc     pLDeg;
624
625  /* as it was determined by rComplete */
626  pFDegProc     pFDegOrig;
627  /* and as it was determined before rOptimizeLDeg */
628  pLDegProc     pLDegOrig;
629
630  p_SetmProc    p_Setm;
631  n_Procs_s*    cf;
632  ring          algring;
633#ifdef HAVE_PLURAL
634  private:
635    nc_struct*    _nc; // private
636  public:
637    inline const nc_struct* GetNC() const { return _nc; }; // public!!!
638    inline nc_struct*& GetNC() { return _nc; }; // public!!!
639#endif
640};
641
642struct sip_sideal
643{
644  poly*  m;
645  long rank;
646  int nrows;
647  int ncols;
648  #define IDELEMS(i) ((i)->ncols)
649  inline int& idelems(void) { return ncols; }
650};
651
652struct sip_smap
653{
654  poly *m;
655  char *preimage;
656  int nrows;
657  int ncols;
658};
659
660struct sideal_list
661{
662  ideal_list next;
663  ideal      d;
664#ifndef NDEBUG
665  int nr;
666#endif
667};
668#endif /* __cplusplus */
669
670
671
672/*
673**  7. runtime procedures/global data
674*/
675
676/* 7.1 C-routines : */
677
678
679#ifdef __cplusplus
680extern "C" {
681#endif
682void  m2_end(int i);
683#ifdef __cplusplus
684}
685#endif
686
687/* 7.2 C++-routines : */
688
689#ifdef __cplusplus
690int   inits(void);
691int   IsPrime(int i);
692#ifdef buildin_rand
693extern int siSeed;
694int siRand();
695#endif
696#endif
697
698/*the general set of std-options --> kutil.cc */
699extern BITSET test;
700/*the general set of verbose-options --> febase.cc */
701#ifdef __cplusplus
702extern "C" BITSET verbose;
703#else
704extern BITSET verbose;
705#endif
706/*debugging the bison grammar --> grammar.cc*/
707#ifdef YYDEBUG
708#if YYDEBUG
709extern int    yydebug;
710#endif
711#endif
712
713extern int      yylineno;
714extern char     my_yylinebuf[80];
715
716#define loop for(;;)
717
718#ifndef ABS
719#define ABS(x) ((x)<0?(-(x)):(x))
720#endif
721
722#if defined(__cplusplus)
723inline int si_max(const int a, const int b)  { return (a>b) ? a : b; }
724inline int si_min(const int a, const int b)  { return (a<b) ? a : b; }
725#if defined(DecAlpha_Linux) || defined(IA64_Linux)
726inline long si_max(const long a, const long b)  { return (a>b) ? a : b; }
727inline long si_min(const long a, const long b)  { return (a<b) ? a : b; }
728#endif
729#else
730#define si_max(A,B) ((A) > (B) ? (A) : (B))
731#define si_min(A,B) ((A) < (B) ? (A) : (B))
732#endif
733
734/*
735**  Set operations (small sets only)
736*/
737
738#define Sy_bit(x)     ((unsigned)1<<(x))
739#define Sy_inset(x,s) ((Sy_bit(x)&(s))?TRUE:FALSE)
740#define BTEST1(a)     Sy_inset((a), test)
741#define BVERBOSE(a)   Sy_inset((a), verbose)
742
743/*
744** defines for BITSETs
745*/
746
747#define V_SHOW_MEM    2
748#define V_YACC        3
749#define V_REDEFINE    4
750#define V_READING     5
751#define V_LOAD_LIB    6
752#define V_DEBUG_LIB   7
753#define V_LOAD_PROC   8
754#define V_DEF_RES     9
755#define V_DEBUG_MEM  10
756#define V_SHOW_USE   11
757#define V_IMAP       12
758#define V_PROMPT     13
759#define V_NSB        14
760#define V_CONTENTSB  15
761#define V_CANCELUNIT 16
762#define V_MODPSOLVSB 17
763#define V_UPTORADICAL 18
764#define V_FINDMONOM  19
765#define V_COEFSTRAT  20
766#define V_IDLIFT     21
767#define V_LENGTH     22
768#define V_DEG_STOP   31
769
770
771#define OPT_PROT           0
772#define OPT_REDSB          1
773#define OPT_NOT_BUCKETS    2
774#define OPT_NOT_SUGAR      3
775#define OPT_INTERRUPT      4
776#define OPT_SUGARCRIT      5
777#define OPT_DEBUG          6
778#define OPT_REDTHROUGH     7
779#define OPT_RETURN_SB      9
780#define OPT_FASTHC        10
781#define OPT_OLDSTD        20
782#define OPT_KEEPVARS      21
783#define OPT_STAIRCASEBOUND 22
784#define OPT_MULTBOUND     23
785#define OPT_DEGBOUND      24
786#define OPT_REDTAIL       25
787#define OPT_INTSTRATEGY   26
788#define OPT_INFREDTAIL    28
789#define OPT_SB_1          29
790#define OPT_NOTREGULARITY 30
791#define OPT_WEIGHTM       31
792
793/* define ring dependent options */
794#define TEST_RINGDEP_OPTS \
795 (Sy_bit(OPT_INTSTRATEGY) | Sy_bit(OPT_REDTHROUGH) | Sy_bit(OPT_REDTAIL))
796
797#define TEST_OPT_PROT              BTEST1(OPT_PROT)
798#define TEST_OPT_REDSB             BTEST1(OPT_REDSB)
799#define TEST_OPT_NOT_BUCKETS       BTEST1(OPT_NOT_BUCKETS)
800#define TEST_OPT_NOT_SUGAR         BTEST1(OPT_NOT_SUGAR)
801#define TEST_OPT_SUGARCRIT         BTEST1(OPT_SUGARCRIT)
802#define TEST_OPT_DEBUG             BTEST1(OPT_DEBUG)
803#define TEST_OPT_FASTHC            BTEST1(OPT_FASTHC)
804#define TEST_OPT_INTSTRATEGY       BTEST1(OPT_INTSTRATEGY)
805#define TEST_OPT_RETURN_SB         BTEST1(OPT_RETURN_SB)
806#define TEST_OPT_KEEPVARS          BTEST1(OPT_KEEPVARS)
807#define TEST_OPT_DEGBOUND          BTEST1(OPT_DEGBOUND)
808#define TEST_OPT_MULTBOUND         BTEST1(OPT_MULTBOUND)
809#define TEST_OPT_STAIRCASEBOUND    BTEST1(OPT_STAIRCASEBOUND)
810#define TEST_OPT_REDTAIL           BTEST1(OPT_REDTAIL)
811#define TEST_OPT_INFREDTAIL        BTEST1(OPT_INFREDTAIL)
812#define TEST_OPT_SB_1              BTEST1(OPT_SB_1)
813#define TEST_OPT_NOTREGULARITY     BTEST1(OPT_NOTREGULARITY)
814#define TEST_OPT_WEIGHTM           BTEST1(OPT_WEIGHTM)
815#define TEST_OPT_REDTHROUGH        BTEST1(OPT_REDTHROUGH)
816#define TEST_OPT_OLDSTD            BTEST1(OPT_OLDSTD)
817#define TEST_OPT_CONTENTSB         BVERBOSE(V_CONTENTSB)
818#define TEST_OPT_CANCELUNIT        BVERBOSE(V_CANCELUNIT)
819#define TEST_OPT_IDLIFT            BVERBOSE(V_IDLIFT)
820#define TEST_OPT_LENGTH            BVERBOSE(V_LENGTH)
821
822#define TEST_VERB_NSB              BVERBOSE(V_NSB)
823#define TEST_V_DEG_STOP            BVERBOSE(V_DEG_STOP)
824#define TEST_V_MODPSOLVSB          BVERBOSE(V_MODPSOLVSB)
825#define TEST_V_COEFSTRAT           BVERBOSE(V_COEFSTRAT)
826#define TEST_V_UPTORADICAL         BVERBOSE(V_UPTORADICAL)
827#define TEST_V_FINDMONOM           BVERBOSE(V_FINDMONOM)
828#ifdef HAVE_LIBPARSER
829#ifdef __cplusplus
830class libstack;
831typedef libstack *  libstackv;
832#endif
833#endif /* HAVE_LIBPARSER */
834
835extern struct omBin_s* MP_INT_bin;
836extern struct omBin_s* char_ptr_bin;
837extern struct omBin_s* ideal_bin;
838extern struct omBin_s* int_bin;
839extern struct omBin_s* poly_bin;
840extern struct omBin_s* void_ptr_bin;
841extern struct omBin_s* indlist_bin;
842extern struct omBin_s* naIdeal_bin;
843extern struct omBin_s* snaIdeal_bin;
844extern struct omBin_s* sm_prec_bin;
845extern struct omBin_s* smprec_bin;
846extern struct omBin_s* sip_sideal_bin;
847extern struct omBin_s* sip_smap_bin;
848extern struct omBin_s* sip_sring_bin;
849extern struct omBin_s* ip_sideal_bin;
850extern struct omBin_s* ip_smap_bin;
851extern struct omBin_s* ip_sring_bin;
852extern struct omBin_s* sleftv_bin;
853
854#ifdef __cplusplus
855union uutypes
856{
857  int           i;
858  ring          uring;
859  poly          p;
860  number        n;
861  ideal         uideal;
862  map           umap;
863  matrix        umatrix;
864  char *        ustring;
865  intvec *      iv;
866  lists         l;
867  si_link       li;
868  package       pack;
869  procinfo *    pinf;
870};
871
872class idrec
873{
874  public:
875  /* !! do not change the first 6 entries !! (see subexpr.h: sleftv) */
876  idhdl      next;
877  const char *id;
878  utypes     data;
879  attr       attribute;
880  BITSET     flag;
881  idtyp      typ;
882
883  short      lev;
884  short      ref;
885#ifdef HAVE_IDI
886  int        id_i;
887#endif
888
889#define IDNEXT(a)    ((a)->next)
890#define IDTYP(a)     ((a)->typ)
891#define IDFLAG(a)    ((a)->flag)
892#define IDLEV(a)     ((a)->lev)
893#define IDID(a)      ((a)->id)
894#define IDATTR(a)    ((a)->attribute)
895
896#define IDINT(a)    ((int)(long)((a)->data.ustring))
897#define IDDATA(a)   ((a)->data.ustring)
898#define IDRING(a)   ((a)->data.uring)
899#define IDINTVEC(a) ((a)->data.iv)
900#define IDPOLY(a)   ((a)->data.p)
901#define IDBIGINT(a) ((a)->data.n)
902#define IDNUMBER(a) ((a)->data.n)
903#define IDIDEAL(a)  (((a)->data).uideal)
904#define IDMATRIX(a) (((a)->data).umatrix)
905#define IDMAP(a)    (((a)->data).umap)
906#define IDSTRING(a) ((a)->data.ustring)
907#define IDLIST(a)   ((a)->data.l)
908#define IDLINK(a)   ((a)->data.li)
909#define IDPACKAGE(a) ((a)->data.pack)
910#define IDPROC(a)   ((a)->data.pinf)
911
912  idrec() { memset(this,0,sizeof(*this)); }
913  idhdl get(const char * s, int lev);
914  idhdl set(const char * s, int lev, idtyp t, BOOLEAN init=TRUE);
915  char * String();
916//  ~idrec();
917};
918
919class proc_singular
920{
921public:
922  long   proc_start;       // position where proc is starting
923  long   def_end;          // position where proc header is ending
924  long   help_start;       // position where help is starting
925  long   help_end;         // position where help is starting
926  long   body_start;       // position where proc-body is starting
927  long   body_end;         // position where proc-body is ending
928  long   example_start;    // position where example is starting
929  long   proc_end;         // position where proc is ending
930  int    proc_lineno;
931  int    body_lineno;
932  int    example_lineno;
933  char   *body;
934  long help_chksum;
935};
936
937struct proc_object
938{
939//public:
940  BOOLEAN (*function)(leftv res, leftv v);
941};
942
943union uprocinfodata;
944
945union uprocinfodata
946{
947public:
948  proc_singular  s;        // data of Singular-procedure
949  struct proc_object    o; // pointer to binary-function
950};
951
952typedef union uprocinfodata procinfodata;
953
954typedef enum { LANG_NONE, LANG_TOP, LANG_SINGULAR, LANG_C, LANG_MAX} language_defs;
955// LANG_TOP     : Toplevel package only
956// LANG_SINGULAR:
957// LANG_C       :
958class procinfo
959{
960public:
961  char          *libname;
962  char          *procname;
963#ifdef HAVE_NS
964  package       pack;
965#endif
966  language_defs language;
967  short         ref;
968  char          is_static;        // if set, proc not accessible for user
969  char          trace_flag;
970  procinfodata  data;
971};
972
973#endif
974
975#endif
976
Note: See TracBrowser for help on using the repository browser.