Changeset 5816c3 in git
- Timestamp:
- Feb 9, 2011, 2:45:48 PM (13 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 23bd397bbff8593671e8e421d0747627f9bf54bd
- Parents:
- 0d79037c401120881c29d840dfc3bb8352563fbe
- Location:
- Singular
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/ipid.cc
r0d7903 r5816c3 121 121 //} 122 122 123 void *idrecDataInit(int t) 124 { 125 switch (t) 126 { 127 //the type with init routines: 128 case INTVEC_CMD: 129 case INTMAT_CMD: 130 return (void *)new intvec(); 131 case NUMBER_CMD: 132 return (void *) nInit(0); 133 case BIGINT_CMD: 134 return (void *) nlInit(0, NULL /* dummy for nlInit*/); 135 case IDEAL_CMD: 136 case MODUL_CMD: 137 case MATRIX_CMD: 138 return (void*) idInit(1,1); 139 case MAP_CMD: 140 { 141 map m = (map)idInit(1,1); 142 m->preimage = omStrDup(IDID(currRingHdl)); 143 return (void *)m; 144 } 145 case STRING_CMD: 146 return (void *)omAlloc0(1); 147 case LIST_CMD: 148 { 149 lists l=(lists)omAllocBin(slists_bin); 150 l->Init(); 151 return (void*)l; 152 } 153 #ifdef HAVE_FANS 154 case FAN_CMD: 155 return (void*)(new gfan::ZFan(0)); 156 case CONE_CMD: 157 return (void*)(new gfan::ZCone()); 158 #endif 159 //the types with the standard init: set the struct to zero 160 case LINK_CMD: 161 return (void*) omAlloc0Bin(sip_link_bin); 162 case RING_CMD: 163 return (void*) omAlloc0Bin(sip_sring_bin); 164 case PACKAGE_CMD: 165 return (void*) omAlloc0Bin(sip_package_bin); 166 case PROC_CMD: 167 return (void *) omAlloc0Bin(procinfo_bin); 168 case RESOLUTION_CMD: 169 return (void *)omAlloc0(sizeof(ssyStrategy)); 170 //other types: without init (int,script,poly,def,package) 171 case INT_CMD: 172 case DEF_CMD: 173 case POLY_CMD: 174 case VECTOR_CMD: 175 case QRING_CMD: 176 return (void*)0L; 177 default: 178 { 179 if (t>MAX_TOK) 180 { 181 #ifdef BLACKBOX_DEVEL 182 Print("bb-type %d\n",t); 183 #endif 184 blackbox *bb=getBlackboxStuff(t); 185 if (bb!=NULL) 186 return (void *)bb->blackbox_Init(bb); 187 } 188 else 189 Werror("unknown type %d",t); 190 break; 191 } 192 } 193 return (void *)0L; 194 } 123 195 idhdl idrec::set(const char * s, int lev, int t, BOOLEAN init) 124 196 { … … 132 204 if (init) 133 205 { 134 switch (t) 135 { 136 //the type with init routines: 137 case INTVEC_CMD: 138 case INTMAT_CMD: 139 IDINTVEC(h) = new intvec(); 140 break; 141 case NUMBER_CMD: 142 IDNUMBER(h) = nInit(0); 143 break; 144 case BIGINT_CMD: 145 IDNUMBER(h) = nlInit(0, NULL /* dummy for nlInit*/); 146 break; 147 case IDEAL_CMD: 148 case MODUL_CMD: 149 IDFLAG(h) = Sy_bit(FLAG_STD); 150 case MATRIX_CMD: 151 IDIDEAL(h) = idInit(1,1); 152 break; 153 case MAP_CMD: 154 IDIDEAL(h) = idInit(1,1); 155 IDMAP(h)->preimage = omStrDup(IDID(currRingHdl)); 156 break; 157 case STRING_CMD: 158 IDSTRING(h) = (char *)omAlloc0(1); 159 break; 160 case LIST_CMD: 161 IDLIST(h)=(lists)omAllocBin(slists_bin); 162 IDLIST(h)->Init(); 163 break; 164 case LINK_CMD: 165 IDLINK(h)=(si_link) omAlloc0Bin(sip_link_bin); 166 break; 167 case RING_CMD: 168 IDRING(h) = (ring) omAlloc0Bin(sip_sring_bin); 169 break; 170 case PACKAGE_CMD: 171 IDPACKAGE(h) = (package) omAlloc0Bin(sip_package_bin); 172 break; 173 case PROC_CMD: 174 IDPROC(h) = (procinfo*) omAlloc0Bin(procinfo_bin); 175 break; 176 //the types with the standard init: set the struct to zero 177 case RESOLUTION_CMD: 178 IDSTRING(h) = (char *)omAlloc0(sizeof(ssyStrategy)); 179 break; 180 //other types: without init (int,script,poly,def,package) 181 case INT_CMD: 182 case DEF_CMD: 183 case POLY_CMD: 184 case VECTOR_CMD: 185 case QRING_CMD: 186 #ifdef HAVE_FANS 187 case FAN_CMD: 188 case CONE_CMD: 206 if ((t==IDEAL_CMD)||(t==MODUL_CMD)) 207 IDFLAG(h) = Sy_bit(FLAG_STD); 208 IDSTRING(h)=(char *)idrecDataInit(t); 209 } 210 // additional settings:-------------------------------------- 211 #if 0 212 // this leads to a memory leak 213 if (t == QRING_CMD) 214 { 215 // IDRING(h)=rCopy(currRing); 216 /* QRING_CMD is ring dep => currRing !=NULL */ 217 } 218 else 189 219 #endif 190 break; 191 default: 192 { 193 if (t>MAX_TOK) 194 { 195 #ifdef BLACKBOX_DEVEL 196 Print("bb-type %d\n",t); 197 #endif 198 blackbox *bb=getBlackboxStuff(t); 199 if (bb!=NULL) 200 IDSTRING(h)=(char *)bb->blackbox_Init(bb); 201 } 202 else 203 Werror("unknown type %d",t); 204 break; 205 } 206 } 207 // additional settings:-------------------------------------- 208 #if 0 209 // this leads to a memory leak 210 if (t == QRING_CMD) 211 { 212 // IDRING(h)=rCopy(currRing); 213 /* QRING_CMD is ring dep => currRing !=NULL */ 214 } 215 else 216 #endif 217 if (t == PROC_CMD) 218 { 219 IDPROC(h)->language=LANG_NONE; 220 } 221 else if (t == PACKAGE_CMD) 222 { 223 IDPACKAGE(h)->language=LANG_NONE; 224 IDPACKAGE(h)->loaded = FALSE; 225 } 226 #ifdef HAVE_FANS 227 else if (t == FAN_CMD) 228 { 229 IDSTRING(h) = (char*)(new gfan::ZFan(0)); 230 } 231 else if (t == CONE_CMD) 232 { 233 IDSTRING(h) = (char*)(new gfan::ZCone()); 234 } 235 #endif /* HAVE_FANS */ 220 if (t == PROC_CMD) 221 { 222 IDPROC(h)->language=LANG_NONE; 223 } 224 else if (t == PACKAGE_CMD) 225 { 226 IDPACKAGE(h)->language=LANG_NONE; 227 IDPACKAGE(h)->loaded = FALSE; 236 228 } 237 229 // -------------------------------------------------------- -
Singular/ipid.h
r0d7903 r5816c3 94 94 void jjNormalizeQRingId(leftv I); 95 95 void jjNormalizeQRingP(leftv I); 96 void *idrecDataInit(int t); 96 97 97 98 #define FLAG_STD 0
Note: See TracChangeset
for help on using the changeset viewer.