[0e1846] | 1 | #ifndef IPID_H |
---|
| 2 | #define IPID_H |
---|
| 3 | /**************************************** |
---|
| 4 | * Computer Algebra System SINGULAR * |
---|
| 5 | ****************************************/ |
---|
[47faf56] | 6 | /* $Id: ipid.h,v 1.7 1998-01-12 18:59:49 obachman 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 */ |
---|
| 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 */ |
---|
[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_ |
---|
[51c163] | 39 | #ifdef COMP_FAST |
---|
[e78cce] | 40 | short VarOffset; /* controls indexing of exponents */ |
---|
| 41 | short CompIndex; /* index of component in exponent vector */ |
---|
[51c163] | 42 | #endif |
---|
[47faf56] | 43 | |
---|
[0e1846] | 44 | #ifdef RDEBUG |
---|
| 45 | short no; |
---|
| 46 | #endif |
---|
| 47 | }; |
---|
| 48 | |
---|
| 49 | struct sip_sideal |
---|
| 50 | { |
---|
| 51 | poly* m; |
---|
| 52 | long rank; |
---|
| 53 | int nrows; |
---|
| 54 | int ncols; |
---|
| 55 | #define IDELEMS(i) ((i)->ncols) |
---|
| 56 | inline int& idelems(void) { return ncols; } |
---|
| 57 | }; |
---|
| 58 | |
---|
| 59 | struct sip_smap |
---|
| 60 | { |
---|
| 61 | poly *m; |
---|
| 62 | char *preimage; |
---|
| 63 | int nrows; |
---|
| 64 | int ncols; |
---|
| 65 | }; |
---|
| 66 | |
---|
| 67 | struct sip_command |
---|
| 68 | { |
---|
| 69 | sleftv arg1; /*arg1 to build_in, proc to proc_call*/ |
---|
| 70 | sleftv arg2; /*NULL or arg2 to build_in, args to proc_call*/ |
---|
| 71 | sleftv arg3; /*NULL or arg3*/ |
---|
| 72 | short argc; /*0,1,2,3 to build_in, -1 otherwise*/ |
---|
| 73 | short op; /* build_in or PROC_CMD*/ |
---|
| 74 | }; |
---|
| 75 | |
---|
| 76 | struct sip_package |
---|
| 77 | { |
---|
| 78 | idhdl idroot; /* local objects */ |
---|
| 79 | }; |
---|
| 80 | |
---|
| 81 | union uutypes; |
---|
| 82 | |
---|
| 83 | union uutypes |
---|
| 84 | { |
---|
| 85 | int i; |
---|
| 86 | ring uring; |
---|
| 87 | poly p; |
---|
| 88 | number n; |
---|
| 89 | ideal uideal; |
---|
| 90 | map umap; |
---|
| 91 | matrix umatrix; |
---|
| 92 | char * ustring; |
---|
| 93 | intvec * iv; |
---|
| 94 | lists l; |
---|
| 95 | si_link li; |
---|
| 96 | package pack; |
---|
| 97 | }; |
---|
| 98 | |
---|
| 99 | class idrec |
---|
| 100 | { |
---|
| 101 | public: |
---|
| 102 | /* !! do not change the first 6 entries !! (see subexpr.h: sleftv) */ |
---|
| 103 | idhdl next; |
---|
| 104 | char * id; |
---|
| 105 | utypes data; |
---|
| 106 | BITSET flag; |
---|
| 107 | attr attribute; |
---|
| 108 | idtyp typ; |
---|
| 109 | |
---|
| 110 | short lev; |
---|
| 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) |
---|
| 132 | |
---|
| 133 | idrec() { memset(this,0,sizeof(*this)); } |
---|
| 134 | idhdl get(const char * s, int lev); |
---|
| 135 | idhdl set(char * s, int lev, idtyp t, BOOLEAN init=TRUE); |
---|
| 136 | // ~idrec(); |
---|
| 137 | }; |
---|
| 138 | |
---|
| 139 | |
---|
| 140 | extern idhdl idroot; |
---|
| 141 | extern idhdl currRingHdl; |
---|
| 142 | /*extern ring currRing; in structs.h */ |
---|
| 143 | extern ideal currQuotient; |
---|
| 144 | |
---|
| 145 | idhdl enterid(char * a, int lev, idtyp t, idhdl* root, BOOLEAN init=TRUE); |
---|
| 146 | idhdl ggetid(const char *n); |
---|
| 147 | void killid(char * a, idhdl * i); |
---|
| 148 | void killhdl(idhdl h); |
---|
| 149 | void killhdl(idhdl h, idhdl * ih); |
---|
| 150 | lists ipNameList(idhdl root); |
---|
| 151 | void ipMoveId(idhdl h); |
---|
| 152 | |
---|
| 153 | #define FLAG_STD 0 |
---|
| 154 | #define FLAG_DRING 1 |
---|
| 155 | #define FLAG_DOPERATOR 2 |
---|
| 156 | #define hasFlag(A,F) Sy_inset((F),(A)->flag) |
---|
| 157 | #define setFlag(A,F) (A)->flag|=Sy_bit(F) |
---|
| 158 | #define resetFlag(A,F) (A)->flag&=~Sy_bit(F) |
---|
| 159 | void ipListFlag(idhdl h); |
---|
| 160 | #endif |
---|
[47faf56] | 161 | |
---|
| 162 | |
---|