Changeset 3aa622a in git
- Timestamp:
- Aug 14, 2009, 2:43:18 PM (14 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
- Children:
- 1cdea1474eb911057f6a4df3eaecab9f8395417b
- Parents:
- 5d51ebca9405eec278f66c54d48b99b74b78425c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/attrib.cc
r5d51ebc r3aa622a 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: attrib.cc,v 1.3 4 2009-05-05 09:54:38 Singular Exp $ */4 /* $Id: attrib.cc,v 1.35 2009-08-14 12:43:18 Singular Exp $ */ 5 5 6 6 /* … … 55 55 //} 56 56 57 static void attr_free(attr h, const ring r=currRing) 58 { 59 switch (h->atyp) 60 { 61 case INTVEC_CMD: 62 case INTMAT_CMD: 63 delete (intvec *)(h->data); 64 break; 65 case IDEAL_CMD: 66 case MODUL_CMD: 67 case MATRIX_CMD: 68 id_Delete((ideal *)&(h->data),r); 69 break; 70 case POLY_CMD: 71 case VECTOR_CMD: 72 p_Delete((poly *)&(h->data),r); 73 break; 74 case INT_CMD: 75 break; 76 case STRING_CMD: 77 omFree((ADDRESS)(h->data)); 78 break; 79 #ifdef TEST 80 default: 81 ::Print("atKill: unknown type(%d)\n",h->atyp); /* DEBUG */ 82 #endif 83 } /* end switch: (atyp) */ 84 h->data=NULL; 85 } 86 57 87 attr sattr::set(const char * s, void * data, int t) 58 88 { 59 89 attr h = get(s); 90 attr result=this; 60 91 if (h!=NULL) 61 92 { 62 switch (h->atyp) 63 { 64 case INTVEC_CMD: 65 delete (intvec *)h->data; 66 break; 67 case IDEAL_CMD: 68 case MODUL_CMD: 69 case MATRIX_CMD: 70 idDelete((ideal *)&h->data); 71 break; 72 case POLY_CMD: 73 case VECTOR_CMD: 74 pDelete((poly *)&h->data); 75 break; 76 case INT_CMD: 77 break; 78 case STRING_CMD: 79 omFree((ADDRESS)h->data); 80 break; 81 #ifdef TEST 82 default: 83 ::Print("at-set: unknown type(%d)\n",atyp); /* DEBUG */ 84 #endif 85 } /* end switch: (atyp) */ 86 omFree((ADDRESS)s); 87 } 88 else 89 { 90 h = (attr)omAlloc0Bin(sattr_bin); 91 h->name = s; 92 h->next = this; 93 h->data = data; 94 h->atyp = t; 95 return h; 96 } 97 //::Print("set attr >>%s<< of type %d\n",h->name,t); 93 attr_free(h); 94 } 95 else 96 { 97 h = (attr)omAlloc0Bin(sattr_bin); 98 h->next = this; 99 result=h; 100 } 101 h->name = s; 98 102 h->data = data; 99 103 h->atyp = t; 100 return this; 104 //::Print("set attr >>%s<< of type %d\n",h->name,t); 105 return result; 101 106 } 102 107 … … 198 203 omFree((ADDRESS)name); 199 204 name=NULL; 200 switch (atyp) 201 { 202 case INTVEC_CMD: 203 delete (intvec *)data; 204 break; 205 case IDEAL_CMD: 206 case MODUL_CMD: 207 case MATRIX_CMD: 208 id_Delete((ideal *)&data,r); 209 break; 210 case POLY_CMD: 211 case VECTOR_CMD: 212 p_Delete((poly *)&data,r); 213 break; 214 case INT_CMD: 215 break; 216 case STRING_CMD: 217 omFree((ADDRESS)data); 218 break; 219 #ifdef TEST 220 default: 221 ::Print("atKill: unknown type(%d)\n",atyp); /* DEBUG */ 222 #endif 223 } /* end switch: (atyp) */ 224 data=NULL; 205 attr_free(this,r); 225 206 omFreeBin((ADDRESS)this, sattr_bin); 226 207 } … … 274 255 } 275 256 attr at=v->attribute; 257 BOOLEAN haveNoAttribute=TRUE; 276 258 if (hasFlag(v,FLAG_STD)) 277 259 { 278 260 PrintS("attr:isSB, type int\n"); 279 if (at!=NULL) at->Print();261 haveNoAttribute=FALSE; 280 262 } 281 263 else if (((t=v->Typ())==RING_CMD)||(t==QRING_CMD)) 282 264 { 283 265 PrintS("attr:global, type int\n"); 284 if (at!=NULL) at->Print(); 285 } 286 else 287 { 288 if (at!=NULL) at->Print(); 289 else PrintS("no attributes\n"); 290 } 266 haveNoAttribute=FALSE; 267 } 268 if (at!=NULL) at->Print(); 269 else if(haveNoAttribute) PrintS("no attributes\n"); 291 270 return FALSE; 292 271 } … … 450 429 return FALSE; 451 430 } 431
Note: See TracChangeset
for help on using the changeset viewer.