[0e1846] | 1 | #ifndef IPID_H |
---|
| 2 | #define IPID_H |
---|
| 3 | /**************************************** |
---|
| 4 | * Computer Algebra System SINGULAR * |
---|
| 5 | ****************************************/ |
---|
[5812c69] | 6 | /* $Id: ipid.h,v 1.16 1998-09-24 09:59:45 Singular Exp $ */ |
---|
[0e1846] | 7 | /* |
---|
[6ae4f5] | 8 | * ABSTRACT: identfier handling |
---|
[0e1846] | 9 | */ |
---|
| 10 | #include <string.h> |
---|
| 11 | #include "structs.h" |
---|
| 12 | #include "subexpr.h" |
---|
[954622] | 13 | //#include "polys-impl.h" |
---|
[0e1846] | 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 */ |
---|
[8d12f5] | 24 | char ** names; /* array of variable names */ |
---|
| 25 | /* extension to the ring structure: qring */ |
---|
[0e1846] | 26 | ideal qideal; |
---|
| 27 | #ifdef SDRING |
---|
| 28 | short partN; |
---|
| 29 | #endif |
---|
| 30 | short ch; /* characteristic */ |
---|
| 31 | short N; /* number of vars */ |
---|
[47faf56] | 32 | |
---|
[0e1846] | 33 | short P; /* number of pars */ |
---|
| 34 | short OrdSgn; /* 1 for polynomial rings, -1 otherwise */ |
---|
[47faf56] | 35 | |
---|
[0e1846] | 36 | short ref; |
---|
[47faf56] | 37 | |
---|
| 38 | // what follows below here should be set by rComplete, _only_ |
---|
[e78cce] | 39 | short VarOffset; /* controls indexing of exponents */ |
---|
[f003a9] | 40 | short VarCompIndex; /* controls locations of component in exp vector */ |
---|
[47faf56] | 41 | |
---|
[0e1846] | 42 | #ifdef RDEBUG |
---|
[fca547] | 43 | short no; /* unique id for rings */ |
---|
[e9ad8a6] | 44 | #endif |
---|
[0e1846] | 45 | }; |
---|
| 46 | |
---|
| 47 | struct sip_sideal |
---|
| 48 | { |
---|
| 49 | poly* m; |
---|
| 50 | long rank; |
---|
| 51 | int nrows; |
---|
| 52 | int ncols; |
---|
| 53 | #define IDELEMS(i) ((i)->ncols) |
---|
| 54 | inline int& idelems(void) { return ncols; } |
---|
| 55 | }; |
---|
| 56 | |
---|
| 57 | struct sip_smap |
---|
| 58 | { |
---|
| 59 | poly *m; |
---|
| 60 | char *preimage; |
---|
| 61 | int nrows; |
---|
| 62 | int ncols; |
---|
| 63 | }; |
---|
| 64 | |
---|
| 65 | struct sip_command |
---|
| 66 | { |
---|
| 67 | sleftv arg1; /*arg1 to build_in, proc to proc_call*/ |
---|
| 68 | sleftv arg2; /*NULL or arg2 to build_in, args to proc_call*/ |
---|
| 69 | sleftv arg3; /*NULL or arg3*/ |
---|
| 70 | short argc; /*0,1,2,3 to build_in, -1 otherwise*/ |
---|
| 71 | short op; /* build_in or PROC_CMD*/ |
---|
| 72 | }; |
---|
| 73 | |
---|
| 74 | struct sip_package |
---|
| 75 | { |
---|
| 76 | idhdl idroot; /* local objects */ |
---|
| 77 | }; |
---|
| 78 | |
---|
| 79 | union uutypes; |
---|
| 80 | |
---|
| 81 | union uutypes |
---|
| 82 | { |
---|
| 83 | int i; |
---|
| 84 | ring uring; |
---|
| 85 | poly p; |
---|
| 86 | number n; |
---|
| 87 | ideal uideal; |
---|
| 88 | map umap; |
---|
| 89 | matrix umatrix; |
---|
| 90 | char * ustring; |
---|
| 91 | intvec * iv; |
---|
| 92 | lists l; |
---|
| 93 | si_link li; |
---|
| 94 | package pack; |
---|
[2ba9a6] | 95 | procinfo * pinf; |
---|
[0e1846] | 96 | }; |
---|
| 97 | |
---|
| 98 | class idrec |
---|
| 99 | { |
---|
| 100 | public: |
---|
| 101 | /* !! do not change the first 6 entries !! (see subexpr.h: sleftv) */ |
---|
| 102 | idhdl next; |
---|
| 103 | char * id; |
---|
| 104 | utypes data; |
---|
| 105 | BITSET flag; |
---|
| 106 | attr attribute; |
---|
| 107 | idtyp typ; |
---|
| 108 | |
---|
| 109 | short lev; |
---|
[46d09b] | 110 | short ref; |
---|
[0e1846] | 111 | |
---|
| 112 | #define IDNEXT(a) ((a)->next) |
---|
| 113 | #define IDTYP(a) ((a)->typ) |
---|
| 114 | #define IDFLAG(a) ((a)->flag) |
---|
| 115 | #define IDLEV(a) ((a)->lev) |
---|
| 116 | #define IDID(a) ((a)->id) |
---|
| 117 | #define IDATTR(a) ((a)->attribute) |
---|
| 118 | |
---|
| 119 | #define IDINT(a) ((a)->data.i) |
---|
| 120 | #define IDDATA(a) ((a)->data.ustring) |
---|
| 121 | #define IDRING(a) ((a)->data.uring) |
---|
| 122 | #define IDINTVEC(a) ((a)->data.iv) |
---|
| 123 | #define IDPOLY(a) ((a)->data.p) |
---|
| 124 | #define IDNUMBER(a) ((a)->data.n) |
---|
| 125 | #define IDIDEAL(a) (((a)->data).uideal) |
---|
| 126 | #define IDMATRIX(a) (((a)->data).umatrix) |
---|
| 127 | #define IDMAP(a) (((a)->data).umap) |
---|
| 128 | #define IDSTRING(a) ((a)->data.ustring) |
---|
| 129 | #define IDLIST(a) ((a)->data.l) |
---|
| 130 | #define IDLINK(a) ((a)->data.li) |
---|
| 131 | #define IDPACKAGE(a) ((a)->data.pack) |
---|
[2ba9a6] | 132 | #define IDPROC(a) ((a)->data.pinf) |
---|
[0e1846] | 133 | |
---|
| 134 | idrec() { memset(this,0,sizeof(*this)); } |
---|
| 135 | idhdl get(const char * s, int lev); |
---|
| 136 | idhdl set(char * s, int lev, idtyp t, BOOLEAN init=TRUE); |
---|
| 137 | // ~idrec(); |
---|
| 138 | }; |
---|
| 139 | |
---|
[46d09b] | 140 | #ifdef HAVE_NAMESPACES |
---|
| 141 | class namerec { |
---|
| 142 | public: |
---|
| 143 | namehdl next; |
---|
| 144 | namehdl root; |
---|
| 145 | package pack; |
---|
[6d281ac] | 146 | idhdl currRingHdl; |
---|
[46d09b] | 147 | char * name; |
---|
| 148 | int lev; |
---|
[6d281ac] | 149 | BOOLEAN isroot; |
---|
[46d09b] | 150 | #define NSROOT(a) ((a)->pack->idroot) |
---|
[6d281ac] | 151 | #define NSPACK(a) ((a)->pack) |
---|
[5812c69] | 152 | |
---|
[6d281ac] | 153 | |
---|
| 154 | namerec() { memset(this,0,sizeof(*this)); } |
---|
[46d09b] | 155 | //namehdl Set(idhdl root); |
---|
| 156 | namehdl pop(); |
---|
| 157 | namehdl push(package pack, char *name, BOOLEAN init=FALSE); |
---|
[6d281ac] | 158 | idhdl get(const char * s, int lev, BOOLEAN root=FALSE); |
---|
[46d09b] | 159 | }; |
---|
[0e1846] | 160 | |
---|
[46d09b] | 161 | extern namehdl namespaceroot; |
---|
[6d281ac] | 162 | # define IDROOT (NSROOT(namespaceroot)) |
---|
[46d09b] | 163 | #else /* HAVE_NAMESPACES */ |
---|
[0e1846] | 164 | extern idhdl idroot; |
---|
[6d281ac] | 165 | # define IDROOT idroot |
---|
[46d09b] | 166 | #endif /* HAVE_NAMESPACES */ |
---|
| 167 | |
---|
[0e1846] | 168 | extern idhdl currRingHdl; |
---|
| 169 | /*extern ring currRing; in structs.h */ |
---|
| 170 | extern ideal currQuotient; |
---|
| 171 | |
---|
[6d281ac] | 172 | char *idhdl2id(idhdl pck, idhdl h); |
---|
| 173 | void iiname2hdl(char *name, idhdl *pck, idhdl *id); |
---|
[0e1846] | 174 | idhdl enterid(char * a, int lev, idtyp t, idhdl* root, BOOLEAN init=TRUE); |
---|
[6d281ac] | 175 | idhdl ggetid(const char *n, BOOLEAN local = FALSE); |
---|
| 176 | idhdl ggetid(const char *n, BOOLEAN local, idhdl *packhdl); |
---|
[0e1846] | 177 | void killid(char * a, idhdl * i); |
---|
| 178 | void killhdl(idhdl h); |
---|
| 179 | void killhdl(idhdl h, idhdl * ih); |
---|
| 180 | lists ipNameList(idhdl root); |
---|
| 181 | void ipMoveId(idhdl h); |
---|
| 182 | |
---|
| 183 | #define FLAG_STD 0 |
---|
| 184 | #define FLAG_DRING 1 |
---|
| 185 | #define FLAG_DOPERATOR 2 |
---|
| 186 | #define hasFlag(A,F) Sy_inset((F),(A)->flag) |
---|
| 187 | #define setFlag(A,F) (A)->flag|=Sy_bit(F) |
---|
| 188 | #define resetFlag(A,F) (A)->flag&=~Sy_bit(F) |
---|
| 189 | void ipListFlag(idhdl h); |
---|
| 190 | #endif |
---|
[47faf56] | 191 | |
---|
| 192 | |
---|