source: git/kernel/structs.h @ 3332cc6

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