source: git/Singular/structs.h @ b7b08c

fieker-DuValspielwiese
Last change on this file since b7b08c was b7b08c, checked in by Olaf Bachmann <obachman@…>, 25 years ago
* us short exponent vectors in divisbility tests * AllocSizeOf * garbage collection * scanner/gmp: allow .0 and 1. input of reals git-svn-id: file:///usr/local/Singular/svn/trunk@3711 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 8.7 KB
Line 
1#ifndef STRUCTS_H
2#define STRUCTS_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: structs.h,v 1.28 1999-10-14 14:27:32 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};
211
212typedef struct sro_syz sro_syz;
213
214struct sro_ord
215{
216  ro_typ  ord_typ;
217  union
218  {
219     sro_dp dp;
220     sro_wp wp;
221     sro_cp cp;
222     sro_syzcomp syzcomp;
223     sro_syz syz;
224  } data;
225};
226
227struct sip_sring
228{
229  idhdl      idroot; /* local objects */
230  int*       order;  /* array of orderings */
231  int*       block0; /* starting pos.*/
232  int*       block1; /* ending pos.*/
233  char**     parameter; /* names of parameters */
234  number     minpoly;
235  int**      wvhdl;  /* array of weight vectors */
236  char **    names;  /* array of variable names */
237
238  // what follows below here should be set by rComplete, _only_
239  long      *ordsgn;  /* array of +/- 1 (or 0) for comparing monomials */
240                       /*  ExpLSize entries*/
241
242  // is NULL for lp or N == 1, otherwise non-NULL (with OrdSize > 0 entries) */
243  sro_ord *  typ;   /* array of orderings + sizes, OrdSize entries */
244
245  ideal      qideal; /* extension to the ring structure: qring */
246
247#ifdef HAVE_SHIFTED_EXPONENTS
248  unsigned long bitmask;
249#endif
250
251  int      *VarOffset;
252  /* mapping exp. of var(i) -> p->exp.l */
253#ifdef HAVE_SHIFTED_EXPONENTS
254  /* mapping exp. of var(i) ->
255  p->exp.l[(VarOffset[i] & 0xffffff)] >> (VarOffset[i] >> 24) & bitmask */
256#else
257  /* mapping exp. of var(i) -> p->exp.e[VarOffset[i]] */
258#endif
259
260  memHeap   mm_specHeap; /* Heap from where monoms are allocated */
261  short      ch;     /* characteristic */
262  short      ch_flags; /* additional char-flags */
263
264  short      N;      /* number of vars */
265
266  short      P;      /* number of pars */
267  short      OrdSgn; /* 1 for polynomial rings, -1 otherwise */
268  // what follows below here should be set by rComplete, _only_
269  short      pVarLowIndex;  /* lowest index of a variable */
270  short      pVarHighIndex; /* highest index of a variable */
271                            /* pVarLow to pVarHigh */
272  // contains component, but no weight fields in E */
273  // better: pVarLowIndexE / pVarLowIndexL
274  short      pDivLow;
275  short      pDivHigh; /* the same as pVarLow..pVarHigh, */
276                       /* but as index in the 'long' field */
277
278  short      pCompLowIndex; // better: use pCompareLowIndexL
279  short      pCompHighIndex; /* use p->exp.l[pCompLowIndex..ppCompHighIndex] */
280                             /* for comparing monomials */
281  short      pCompLSize; // pCompHighIndex - pCompLowIndex + 1
282
283  short      pCompIndex; /* p->exp.e[pCompIndex] is the component */
284  short      pOrdIndex; /* p->exp.l[pOrdIndex] is pGetOrd(p) */
285
286  short      ExpESize; /* size of exponent vector in Exponent_t */
287  short      ExpLSize; /* size of exponent vector in long */
288  short      OrdSize; /* size of ord vector (in sro_ord) */
289
290  short      ref; /* reference counter to the ring */
291};
292
293struct sip_sideal
294{
295  poly*  m;
296  long rank;
297  int nrows;
298  int ncols;
299  #define IDELEMS(i) ((i)->ncols)
300  inline int& idelems(void) { return ncols; }
301};
302
303struct sip_smap
304{
305  poly *m;
306  char *preimage;
307  int nrows;
308  int ncols;
309};
310#endif /* __cplusplus */
311
312/* the function pointer types */
313typedef number (*numberfunc)(number a,number b);
314
315typedef void    (*pSetmProc)(poly p);
316typedef int     (*pLDegProc)(poly p, int *length);
317typedef int     (*pFDegProc)(poly p);
318typedef int     (*pCompProc)(poly p1, poly p2);
319
320extern ring      currRing;
321
322/*
323**  7. runtime procedures/global data
324*/
325
326/* 7.1 C-routines : */
327
328#ifdef __cplusplus
329extern "C" {
330#endif
331void  m2_end(short i);
332#ifdef __cplusplus
333}
334#endif
335
336/* 7.2 C++-routines : */
337
338#ifdef __cplusplus
339int   inits(void);
340#ifdef buildin_rand
341extern int siSeed;
342int siRand();
343#endif
344#endif
345
346/*the general set of std-options --> kutil.cc */
347extern BITSET test;
348/*the general set of verbose-options --> febase.cc */
349#ifdef __cplusplus
350extern "C" BITSET verbose;
351#else
352extern BITSET verbose;
353#endif
354/*debugging the bison grammar --> grammar.cc*/
355#ifdef YYDEBUG
356#if YYDEBUG
357extern int    yydebug;
358#endif
359#endif
360
361#ifdef HAVE_LIBPARSER
362#ifdef __cplusplus
363class libstack;
364typedef libstack *  libstackv;
365#endif
366#endif /* HAVE_LIBPARSER */
367
368#if HAVE_ASO == 1
369#include "structs.aso"
370#endif
371
372#endif
373
Note: See TracBrowser for help on using the repository browser.