source: git/kernel/structs.h @ de7394

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