source: git/Singular/structs.h @ 9d72fe

spielwiese
Last change on this file since 9d72fe was 9d72fe, checked in by Olaf Bachmann <obachman@…>, 23 years ago
* new p_Procs stuff git-svn-id: file:///usr/local/Singular/svn/trunk@4559 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 9.7 KB
Line 
1#ifndef STRUCTS_H
2#define STRUCTS_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: structs.h,v 1.35 2000-08-24 14:42:46 obachman Exp $ */
7/*
8* ABSTRACT
9*/
10
11/* standard types */
12typedef unsigned char  uchar ;
13typedef unsigned short CARDINAL;
14typedef short BOOLEAN;
15
16typedef void * Sy_reference;
17#define ADDRESS Sy_reference
18#define BITSET  unsigned int
19
20/* EXPONENT_TYPE is determined by configure und defined in mod2.h */
21/* the following defines should really go into mod2.h,
22   but configure dislikes it */
23
24#ifdef HAVE_SHIFTED_EXPONENTS
25/* Define the type of the exponents to be used in monomials */
26#undef EXPONENT_TYPE
27#define EXPONENT_TYPE long
28/* Define the size of exponent */
29#undef SIZEOF_EXPONENT
30#define SIZEOF_EXPONENT SIZEOF_LONG
31#endif
32
33typedef EXPONENT_TYPE Exponent_t;
34
35enum tHomog
36{
37   isNotHomog = FALSE,
38   isHomog    = TRUE,
39   testHomog
40};
41enum noeof_t
42{
43  noeof_brace = 1,
44  noeof_asstring,
45  noeof_block,
46  noeof_bracket,
47  noeof_comment,
48  noeof_procname,
49  noeof_string
50};
51
52/* C++-part */
53#ifdef __cplusplus
54class ip_smatrix;
55class idrec;
56class intvec;
57class sleftv;
58class slists;
59class sattr;
60class skStrategy;
61class ssyStrategy;
62class procinfo;
63class namerec;
64class kBucket;
65#endif
66
67struct  sip_sring;
68struct  sip_sideal;
69struct  sip_link;
70struct  spolynom;
71struct _ssubexpr;
72struct _sssym;
73struct snumber;
74struct sip_command;
75struct sip_package;
76struct s_si_link_extension;
77struct reca;
78typedef struct _ssubexpr   sSubexpr;
79typedef struct _sssym      ssym;
80typedef struct spolyrec    polyrec;
81typedef struct snumber     rnumber;
82typedef struct sip_sideal  ip_sideal;
83typedef struct sip_smap    ip_smap;
84typedef struct sip_sring   ip_sring;
85typedef struct sip_link    ip_link;
86typedef struct sip_command ip_command;
87typedef struct sip_package ip_package;
88
89/* the pointer types */
90typedef char *              char_ptr;
91typedef int  *              int_ptr;
92typedef short *             short_ptr;
93typedef void *              void_ptr;
94typedef ip_sring *         ring;
95typedef int                idtyp;
96typedef rnumber *          number;
97typedef polyrec *          poly;
98typedef poly *             polyset;
99typedef ip_sideal *        ideal;
100typedef ip_smap *          map;
101typedef ideal *            resolvente;
102typedef union uutypes      utypes;
103typedef ip_command *       command;
104typedef struct s_si_link_extension *si_link_extension;
105typedef struct reca *      alg;
106
107#ifdef __cplusplus
108typedef idrec *            idhdl;
109typedef ip_smatrix *       matrix;
110typedef ip_link *          si_link;
111typedef sleftv *           leftv;
112typedef slists *           lists;
113typedef sSubexpr *         Subexpr;
114typedef sattr *            attr;
115typedef skStrategy *       kStrategy;
116typedef ip_package *       package;
117typedef ssyStrategy *      syStrategy;
118typedef procinfo *         procinfov;
119typedef namerec *          namehdl;
120typedef kBucket*           kBucket_pt;
121typedef struct p_Procs_s p_Procs_s;
122
123// for hdegree.cc   
124typedef struct sindlist indlist;
125typedef indlist * indset;
126struct sindlist
127{
128  indset nx;
129  intvec * set;
130};
131
132// for longalg.cc
133struct snaIdeal
134{
135  int anz;
136  alg *liste;
137};
138typedef struct snaIdeal * naIdeal;
139
140
141// for sparsemat.cc
142typedef struct smprec sm_prec;
143typedef sm_prec * smpoly;
144struct smprec
145{
146  smpoly n;            // the next element
147  int pos;             // position
148  int e;               // level
149  poly m;              // the element
150  float f;             // complexity of the element
151};
152
153struct _scmdnames
154{
155  char *name;
156  short alias;
157  short tokval;
158  short toktype;
159};
160typedef struct _scmdnames cmdnames;
161
162typedef enum
163{
164  ro_dp, // ordering is a degree ordering
165  ro_wp, // ordering is a weighted degree ordering
166  ro_cp, // ordering duplicates variables
167  ro_syzcomp, // ordering indicates "subset" of component number
168  ro_syz, // ordering  with component number >syzcomp is lower
169  ro_none
170}
171ro_typ;
172
173// ordering is a degree ordering
174struct sro_dp
175{
176  short place;  // where degree is stored (in L):
177  short start;  // bounds of ordering (in E):
178  short end;
179};
180typedef struct sro_dp sro_dp;
181
182// ordering is a weighted degree ordering
183struct sro_wp
184{
185  short place;  // where weighted degree is stored (in L)
186  short start;  // bounds of ordering (in E)
187  short end;
188  int *weights; // pointers into wvhdl field
189};
190typedef struct sro_wp sro_wp;
191
192// ordering duplicates variables
193struct sro_cp
194{
195  short place;  // where start is copied to (in E)
196  short start;  // bounds of sources of copied variables (in E)
197  short end;
198};
199typedef struct sro_cp sro_cp;
200
201// ordering indicates "subset" of component number
202struct sro_syzcomp
203{
204  short place;  // where the index is stored (in L)
205  long *ShiftedComponents; // pointer into index field
206  int* Components;
207#ifdef PDEBUG
208  long length;
209#endif
210};
211typedef struct sro_syzcomp sro_syzcomp;
212
213// ordering  with component number >syzcomp is lower
214struct sro_syz
215{
216  short place;       // where the index is stored (in L)
217  int limit;         // syzcomp
218  int* syz_index;    // mapping Component -> SyzIndex for Comp <= limit
219  int  curr_index;   // SyzIndex for Component > limit
220};
221
222typedef struct sro_syz sro_syz;
223
224#ifndef OM_ALLOC_H
225struct omBin_s;
226#endif
227
228struct sro_ord
229{
230  ro_typ  ord_typ;
231  union
232  {
233     sro_dp dp;
234     sro_wp wp;
235     sro_cp cp;
236     sro_syzcomp syzcomp;
237     sro_syz syz;
238  } data;
239};
240
241struct sip_sring
242{
243  idhdl      idroot; /* local objects */
244  int*       order;  /* array of orderings */
245  int*       block0; /* starting pos.*/
246  int*       block1; /* ending pos.*/
247  char**     parameter; /* names of parameters */
248  number     minpoly;
249  int**      wvhdl;  /* array of weight vectors */
250  char **    names;  /* array of variable names */
251
252  // what follows below here should be set by rComplete, _only_
253  long      *ordsgn;  /* array of +/- 1 (or 0) for comparing monomials */
254                       /*  ExpLSize entries*/
255
256  // is NULL for lp or N == 1, otherwise non-NULL (with OrdSize > 0 entries) */
257  sro_ord *  typ;   /* array of orderings + sizes, OrdSize entries */
258
259  ideal      qideal; /* extension to the ring structure: qring */
260
261#ifdef HAVE_SHIFTED_EXPONENTS
262  unsigned long bitmask;
263#endif
264
265  int      *VarOffset;
266  /* mapping exp. of var(i) -> p->exp.l */
267#ifdef HAVE_SHIFTED_EXPONENTS
268  /* mapping exp. of var(i) ->
269  p->exp.l[(VarOffset[i] & 0xffffff)] >> (VarOffset[i] >> 24) & bitmask */
270#else
271  /* mapping exp. of var(i) -> p->exp.e[VarOffset[i]] */
272#endif
273
274  struct omBin_s*   PolyBin; /* Bin from where monoms are allocated */
275  short      ch;     /* characteristic */
276  short      ch_flags; /* additional char-flags */
277
278  short      N;      /* number of vars */
279
280  short      P;      /* number of pars */
281  short      OrdSgn; /* 1 for polynomial rings, -1 otherwise */
282  // what follows below here should be set by rComplete, _only_
283  short      pVarLowIndex;  /* lowest index of a variable */
284  short      pVarHighIndex; /* highest index of a variable */
285                            /* pVarLow to pVarHigh */
286  // contains component, but no weight fields in E */
287  // better: pVarLowIndexE / pVarLowIndexL
288  #ifdef LONG_MONOMS
289  short      pDivLow;
290  short      pDivHigh; /* the same as pVarLow..pVarHigh, */
291                       /* but as index in the 'long' field */
292  #endif
293  #ifndef HAVE_SHIFTED_EXPONENTS
294  short      pCompLowIndex; // better: use pCompareLowIndexL
295  #endif
296  short      pCompHighIndex; /* use p->exp.l[pCompLowIndex..ppCompHighIndex] */
297                             /* for comparing monomials */
298  short      pCompLSize; // pCompHighIndex - pCompLowIndex + 1
299
300  short      pCompIndex; /* p->exp.e[pCompIndex] is the component */
301  short      pOrdIndex; /* p->exp.l[pOrdIndex] is pGetOrd(p) */
302
303  short      ExpESize; /* size of exponent vector in Exponent_t */
304  short      ExpLSize; /* size of exponent vector in long */
305  short      OrdSize; /* size of ord vector (in sro_ord) */
306
307  p_Procs_s* p_Procs;
308  short      ref; /* reference counter to the ring */
309};
310
311struct sip_sideal
312{
313  poly*  m;
314  long rank;
315  int nrows;
316  int ncols;
317  #define IDELEMS(i) ((i)->ncols)
318  inline int& idelems(void) { return ncols; }
319};
320
321struct sip_smap
322{
323  poly *m;
324  char *preimage;
325  int nrows;
326  int ncols;
327};
328#endif /* __cplusplus */
329
330/* the function pointer types */
331typedef number (*numberfunc)(number a,number b);
332
333typedef void    (*pSetmProc)(poly p);
334typedef int     (*pLDegProc)(poly p, int *length);
335typedef int     (*pFDegProc)(poly p);
336typedef int     (*pCompProc)(poly p1, poly p2);
337
338extern ring      currRing;
339
340/*
341**  7. runtime procedures/global data
342*/
343
344/* 7.1 C-routines : */
345
346#ifdef __cplusplus
347extern "C" {
348#endif
349void  m2_end(short i);
350#ifdef __cplusplus
351}
352#endif
353
354/* 7.2 C++-routines : */
355
356#ifdef __cplusplus
357int   inits(void);
358#ifdef buildin_rand
359extern int siSeed;
360int siRand();
361#endif
362#endif
363
364/*the general set of std-options --> kutil.cc */
365extern BITSET test;
366/*the general set of verbose-options --> febase.cc */
367#ifdef __cplusplus
368extern "C" BITSET verbose;
369#else
370extern BITSET verbose;
371#endif
372/*debugging the bison grammar --> grammar.cc*/
373#ifdef YYDEBUG
374#if YYDEBUG
375extern int    yydebug;
376#endif
377#endif
378
379#ifdef HAVE_LIBPARSER
380#ifdef __cplusplus
381class libstack;
382typedef libstack *  libstackv;
383#endif
384#endif /* HAVE_LIBPARSER */
385
386extern struct omBin_s* MP_INT_bin;
387extern struct omBin_s* char_ptr_bin;
388extern struct omBin_s* ideal_bin;
389extern struct omBin_s* int_bin;
390extern struct omBin_s* poly_bin;
391extern struct omBin_s* void_ptr_bin;
392extern struct omBin_s* indlist_bin;
393extern struct omBin_s* naIdeal_bin;
394extern struct omBin_s* snaIdeal_bin;
395extern struct omBin_s* sm_prec_bin;
396extern struct omBin_s* smprec_bin;
397extern struct omBin_s* sip_sideal_bin;
398extern struct omBin_s* sip_smap_bin;
399extern struct omBin_s* sip_sring_bin;
400extern struct omBin_s* ip_sideal_bin;
401extern struct omBin_s* ip_smap_bin;
402extern struct omBin_s* ip_sring_bin;
403
404#endif
405
Note: See TracBrowser for help on using the repository browser.