source: git/kernel/structs.h @ 098f98f

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