source: git/kernel/structs.h @ 3f0210

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