source: git/kernel/structs.h @ d351d8

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