source: git/Singular/structs.h @ 551fd7

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