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 */ |
---|
12 | typedef unsigned char uchar ; |
---|
13 | typedef unsigned short CARDINAL; |
---|
14 | typedef short BOOLEAN; |
---|
15 | |
---|
16 | typedef 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 | typedef EXPONENT_TYPE Exponent_t; |
---|
22 | |
---|
23 | enum tHomog |
---|
24 | { |
---|
25 | isNotHomog = FALSE, |
---|
26 | isHomog = TRUE, |
---|
27 | testHomog |
---|
28 | }; |
---|
29 | enum 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 |
---|
42 | class ip_smatrix; |
---|
43 | class idrec; |
---|
44 | class intvec; |
---|
45 | class sleftv; |
---|
46 | class slists; |
---|
47 | class sattr; |
---|
48 | class skStrategy; |
---|
49 | class ssyStrategy; |
---|
50 | class procinfo; |
---|
51 | class namerec; |
---|
52 | class kBucket; |
---|
53 | #endif |
---|
54 | |
---|
55 | struct sip_sring; |
---|
56 | struct sip_sideal; |
---|
57 | struct sip_link; |
---|
58 | struct spolynom; |
---|
59 | struct _ssubexpr; |
---|
60 | struct _sssym; |
---|
61 | struct snumber; |
---|
62 | struct sip_command; |
---|
63 | struct sip_package; |
---|
64 | struct s_si_link_extension; |
---|
65 | struct reca; |
---|
66 | struct sip_memHeap; |
---|
67 | struct sip_memHeapPage; |
---|
68 | typedef struct _ssubexpr sSubexpr; |
---|
69 | typedef struct _sssym ssym; |
---|
70 | typedef struct spolyrec polyrec; |
---|
71 | typedef struct snumber rnumber; |
---|
72 | typedef struct sip_sideal ip_sideal; |
---|
73 | typedef struct sip_smap ip_smap; |
---|
74 | typedef struct sip_sring ip_sring; |
---|
75 | typedef struct sip_link ip_link; |
---|
76 | typedef struct sip_command ip_command; |
---|
77 | typedef struct sip_package ip_package; |
---|
78 | typedef struct sip_memHeap ip_memHeap; |
---|
79 | |
---|
80 | /* the pointer types */ |
---|
81 | typedef char * char_ptr; |
---|
82 | typedef int * int_ptr; |
---|
83 | typedef short * short_ptr; |
---|
84 | typedef void * void_ptr; |
---|
85 | typedef ip_sring * ring; |
---|
86 | typedef int idtyp; |
---|
87 | typedef rnumber * number; |
---|
88 | typedef polyrec * poly; |
---|
89 | typedef poly * polyset; |
---|
90 | typedef ip_sideal * ideal; |
---|
91 | typedef ip_smap * map; |
---|
92 | typedef ideal * resolvente; |
---|
93 | typedef union uutypes utypes; |
---|
94 | typedef ip_command * command; |
---|
95 | typedef struct s_si_link_extension *si_link_extension; |
---|
96 | typedef struct reca * alg; |
---|
97 | typedef struct sip_memHeap * memHeap; |
---|
98 | typedef struct sip_memHeapPage * memHeapPage; |
---|
99 | |
---|
100 | |
---|
101 | #ifdef __cplusplus |
---|
102 | typedef idrec * idhdl; |
---|
103 | typedef ip_smatrix * matrix; |
---|
104 | typedef ip_link * si_link; |
---|
105 | typedef sleftv * leftv; |
---|
106 | typedef slists * lists; |
---|
107 | typedef sSubexpr * Subexpr; |
---|
108 | typedef sattr * attr; |
---|
109 | typedef skStrategy * kStrategy; |
---|
110 | typedef ip_package * package; |
---|
111 | typedef ssyStrategy * syStrategy; |
---|
112 | typedef procinfo * procinfov; |
---|
113 | typedef namerec * namehdl; |
---|
114 | typedef kBucket* kBucket_pt; |
---|
115 | |
---|
116 | // for hdegree.cc |
---|
117 | typedef struct sindlist indlist; |
---|
118 | typedef indlist * indset; |
---|
119 | struct sindlist |
---|
120 | { |
---|
121 | indset nx; |
---|
122 | intvec * set; |
---|
123 | }; |
---|
124 | |
---|
125 | // for longalg.cc |
---|
126 | struct snaIdeal |
---|
127 | { |
---|
128 | int anz; |
---|
129 | alg *liste; |
---|
130 | }; |
---|
131 | typedef struct snaIdeal * naIdeal; |
---|
132 | |
---|
133 | |
---|
134 | // for sparsemat.cc |
---|
135 | typedef struct smprec sm_prec; |
---|
136 | typedef sm_prec * smpoly; |
---|
137 | struct 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 | |
---|
145 | struct _scmdnames |
---|
146 | { |
---|
147 | char *name; |
---|
148 | short alias; |
---|
149 | short tokval; |
---|
150 | short toktype; |
---|
151 | }; |
---|
152 | typedef struct _scmdnames cmdnames; |
---|
153 | |
---|
154 | typedef 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 | } |
---|
163 | ro_typ; |
---|
164 | |
---|
165 | // ordering is a degree ordering |
---|
166 | struct sro_dp |
---|
167 | { |
---|
168 | short place; // where degree is stored (in L): |
---|
169 | short start; // bounds of ordering (in E): |
---|
170 | short end; |
---|
171 | }; |
---|
172 | typedef struct sro_dp sro_dp; |
---|
173 | |
---|
174 | // ordering is a weighted degree ordering |
---|
175 | struct 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 | }; |
---|
182 | typedef struct sro_wp sro_wp; |
---|
183 | |
---|
184 | // ordering duplicates variables |
---|
185 | struct 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 | }; |
---|
191 | typedef struct sro_cp sro_cp; |
---|
192 | |
---|
193 | // ordering indicates "subset" of component number |
---|
194 | struct 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 | }; |
---|
203 | typedef struct sro_syzcomp sro_syzcomp; |
---|
204 | |
---|
205 | // ordering with component number >syzcomp is lower |
---|
206 | struct 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 | |
---|
214 | typedef struct sro_syz sro_syz; |
---|
215 | |
---|
216 | struct 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 | |
---|
229 | struct 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 | |
---|
295 | struct 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 | |
---|
305 | struct 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 */ |
---|
315 | typedef number (*numberfunc)(number a,number b); |
---|
316 | |
---|
317 | typedef void (*pSetmProc)(poly p); |
---|
318 | typedef int (*pLDegProc)(poly p, int *length); |
---|
319 | typedef int (*pFDegProc)(poly p); |
---|
320 | typedef int (*pCompProc)(poly p1, poly p2); |
---|
321 | |
---|
322 | extern ring currRing; |
---|
323 | |
---|
324 | /* |
---|
325 | ** 7. runtime procedures/global data |
---|
326 | */ |
---|
327 | |
---|
328 | /* 7.1 C-routines : */ |
---|
329 | |
---|
330 | #ifdef __cplusplus |
---|
331 | extern "C" { |
---|
332 | #endif |
---|
333 | void m2_end(short i); |
---|
334 | #ifdef __cplusplus |
---|
335 | } |
---|
336 | #endif |
---|
337 | |
---|
338 | /* 7.2 C++-routines : */ |
---|
339 | |
---|
340 | #ifdef __cplusplus |
---|
341 | int inits(void); |
---|
342 | #ifdef buildin_rand |
---|
343 | extern int siSeed; |
---|
344 | int siRand(); |
---|
345 | #endif |
---|
346 | #endif |
---|
347 | |
---|
348 | /*the general set of std-options --> kutil.cc */ |
---|
349 | extern BITSET test; |
---|
350 | /*the general set of verbose-options --> febase.cc */ |
---|
351 | #ifdef __cplusplus |
---|
352 | extern "C" BITSET verbose; |
---|
353 | #else |
---|
354 | extern BITSET verbose; |
---|
355 | #endif |
---|
356 | /*debugging the bison grammar --> grammar.cc*/ |
---|
357 | #ifdef YYDEBUG |
---|
358 | #if YYDEBUG |
---|
359 | extern int yydebug; |
---|
360 | #endif |
---|
361 | #endif |
---|
362 | |
---|
363 | #ifdef HAVE_LIBPARSER |
---|
364 | #ifdef __cplusplus |
---|
365 | class libstack; |
---|
366 | typedef libstack * libstackv; |
---|
367 | #endif |
---|
368 | #endif /* HAVE_LIBPARSER */ |
---|
369 | |
---|
370 | #if HAVE_ASO == 1 |
---|
371 | #include "structs.aso" |
---|
372 | #endif |
---|
373 | |
---|
374 | #endif |
---|
375 | |
---|