1 | #ifndef IPID_H |
---|
2 | #define IPID_H |
---|
3 | /**************************************** |
---|
4 | * Computer Algebra System SINGULAR * |
---|
5 | ****************************************/ |
---|
6 | /* $Id: ipid.h,v 1.5 1997-12-15 22:46:28 obachman Exp $ */ |
---|
7 | /* |
---|
8 | * ABSTRACT: identfier handling |
---|
9 | */ |
---|
10 | #include <string.h> |
---|
11 | #include "structs.h" |
---|
12 | #include "subexpr.h" |
---|
13 | #include "polys-impl.h" |
---|
14 | |
---|
15 | struct sip_sring |
---|
16 | { |
---|
17 | idhdl idroot; /* local objects */ |
---|
18 | int* order; /* array of orderings */ |
---|
19 | int* block0; /* starting pos.*/ |
---|
20 | int* block1; /* ending pos.*/ |
---|
21 | char** parameter; /* names of parameters */ |
---|
22 | number minpoly; |
---|
23 | short** wvhdl; /* array of weight vectors */ |
---|
24 | char ** names; /* array of varibale names */ |
---|
25 | /* extension to the ring structure: */ |
---|
26 | ideal qideal; |
---|
27 | #ifdef SDRING |
---|
28 | short partN; |
---|
29 | #endif |
---|
30 | short ch; /* characteristic */ |
---|
31 | short N; /* number of vars */ |
---|
32 | short P; /* number of pars */ |
---|
33 | short OrdSgn; /* 1 for polynomial rings, -1 otherwise */ |
---|
34 | short ref; |
---|
35 | #ifdef COMP_FAST |
---|
36 | short VarOffset; /* controls indexing of exponents */ |
---|
37 | short CompIndex; /* index of component in exponent vector */ |
---|
38 | #endif |
---|
39 | #ifdef RDEBUG |
---|
40 | short no; |
---|
41 | #endif |
---|
42 | }; |
---|
43 | |
---|
44 | struct sip_sideal |
---|
45 | { |
---|
46 | poly* m; |
---|
47 | long rank; |
---|
48 | int nrows; |
---|
49 | int ncols; |
---|
50 | #define IDELEMS(i) ((i)->ncols) |
---|
51 | inline int& idelems(void) { return ncols; } |
---|
52 | }; |
---|
53 | |
---|
54 | struct sip_smap |
---|
55 | { |
---|
56 | poly *m; |
---|
57 | char *preimage; |
---|
58 | int nrows; |
---|
59 | int ncols; |
---|
60 | }; |
---|
61 | |
---|
62 | struct sip_command |
---|
63 | { |
---|
64 | sleftv arg1; /*arg1 to build_in, proc to proc_call*/ |
---|
65 | sleftv arg2; /*NULL or arg2 to build_in, args to proc_call*/ |
---|
66 | sleftv arg3; /*NULL or arg3*/ |
---|
67 | short argc; /*0,1,2,3 to build_in, -1 otherwise*/ |
---|
68 | short op; /* build_in or PROC_CMD*/ |
---|
69 | }; |
---|
70 | |
---|
71 | struct sip_package |
---|
72 | { |
---|
73 | idhdl idroot; /* local objects */ |
---|
74 | }; |
---|
75 | |
---|
76 | union uutypes; |
---|
77 | |
---|
78 | union uutypes |
---|
79 | { |
---|
80 | int i; |
---|
81 | ring uring; |
---|
82 | poly p; |
---|
83 | number n; |
---|
84 | ideal uideal; |
---|
85 | map umap; |
---|
86 | matrix umatrix; |
---|
87 | char * ustring; |
---|
88 | intvec * iv; |
---|
89 | lists l; |
---|
90 | si_link li; |
---|
91 | package pack; |
---|
92 | }; |
---|
93 | |
---|
94 | class idrec |
---|
95 | { |
---|
96 | public: |
---|
97 | /* !! do not change the first 6 entries !! (see subexpr.h: sleftv) */ |
---|
98 | idhdl next; |
---|
99 | char * id; |
---|
100 | utypes data; |
---|
101 | BITSET flag; |
---|
102 | attr attribute; |
---|
103 | idtyp typ; |
---|
104 | |
---|
105 | short lev; |
---|
106 | |
---|
107 | #define IDNEXT(a) ((a)->next) |
---|
108 | #define IDTYP(a) ((a)->typ) |
---|
109 | #define IDFLAG(a) ((a)->flag) |
---|
110 | #define IDLEV(a) ((a)->lev) |
---|
111 | #define IDID(a) ((a)->id) |
---|
112 | #define IDATTR(a) ((a)->attribute) |
---|
113 | |
---|
114 | #define IDINT(a) ((a)->data.i) |
---|
115 | #define IDDATA(a) ((a)->data.ustring) |
---|
116 | #define IDRING(a) ((a)->data.uring) |
---|
117 | #define IDINTVEC(a) ((a)->data.iv) |
---|
118 | #define IDPOLY(a) ((a)->data.p) |
---|
119 | #define IDNUMBER(a) ((a)->data.n) |
---|
120 | #define IDIDEAL(a) (((a)->data).uideal) |
---|
121 | #define IDMATRIX(a) (((a)->data).umatrix) |
---|
122 | #define IDMAP(a) (((a)->data).umap) |
---|
123 | #define IDSTRING(a) ((a)->data.ustring) |
---|
124 | #define IDLIST(a) ((a)->data.l) |
---|
125 | #define IDLINK(a) ((a)->data.li) |
---|
126 | #define IDPACKAGE(a) ((a)->data.pack) |
---|
127 | |
---|
128 | idrec() { memset(this,0,sizeof(*this)); } |
---|
129 | idhdl get(const char * s, int lev); |
---|
130 | idhdl set(char * s, int lev, idtyp t, BOOLEAN init=TRUE); |
---|
131 | // ~idrec(); |
---|
132 | }; |
---|
133 | |
---|
134 | |
---|
135 | extern idhdl idroot; |
---|
136 | extern idhdl currRingHdl; |
---|
137 | /*extern ring currRing; in structs.h */ |
---|
138 | extern ideal currQuotient; |
---|
139 | |
---|
140 | idhdl enterid(char * a, int lev, idtyp t, idhdl* root, BOOLEAN init=TRUE); |
---|
141 | idhdl ggetid(const char *n); |
---|
142 | void killid(char * a, idhdl * i); |
---|
143 | void killhdl(idhdl h); |
---|
144 | void killhdl(idhdl h, idhdl * ih); |
---|
145 | lists ipNameList(idhdl root); |
---|
146 | void ipMoveId(idhdl h); |
---|
147 | |
---|
148 | #define FLAG_STD 0 |
---|
149 | #define FLAG_DRING 1 |
---|
150 | #define FLAG_DOPERATOR 2 |
---|
151 | #define hasFlag(A,F) Sy_inset((F),(A)->flag) |
---|
152 | #define setFlag(A,F) (A)->flag|=Sy_bit(F) |
---|
153 | #define resetFlag(A,F) (A)->flag&=~Sy_bit(F) |
---|
154 | void ipListFlag(idhdl h); |
---|
155 | #endif |
---|