Changeset c4dab4 in git for Singular/subexpr.cc
- Timestamp:
- Mar 15, 2011, 1:31:39 PM (13 years ago)
- Branches:
- (u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
- Children:
- dd5534a607684bd18fa828b336e69ddaf1ce55d1
- Parents:
- aa2a4e7bda99071f7c4636b115e0c2f765522836
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/subexpr.cc
raa2a4e rc4dab4 234 234 235 235 default: 236 237 238 236 if (t>MAX_TOK) 237 { 238 blackbox * bb=getBlackboxStuff(t); 239 239 PrintNSpaces(spaces); 240 241 242 243 240 if (bb!=NULL) { bb->blackbox_Print(bb,d); } 241 else { ::Print("Print: blackbox %d(bb=NULL)",t); } 242 } 243 else 244 244 ::Print("Print:unknown type %s(%d)", Tok2Cmdname(t),t); 245 245 } /* end switch: (Typ()) */ … … 292 292 if (data!=NULL) 293 293 { 294 switch (rtyp) 295 { 296 case INTVEC_CMD: 297 case INTMAT_CMD: 298 delete (intvec *)data; 299 break; 300 case MAP_CMD: 301 omFree((ADDRESS)((map)data)->preimage); 302 ((map)data)->preimage=NULL; 303 // no break: kill the image as an ideal 304 case MATRIX_CMD: 305 case MODUL_CMD: 306 case IDEAL_CMD: 307 if ((((long)data) & 3)==0) 308 { 309 if(r!=NULL) id_Delete((ideal *)(&data),r); 310 } 311 break; 312 case STRING_CMD: 313 omFree((ADDRESS)data); 314 break; 315 case POLY_CMD: 316 case VECTOR_CMD: 317 if (r!=NULL) p_Delete((poly *)(&data),r); 318 break; 319 case NUMBER_CMD: 320 if (r!=NULL) n_Delete((number *)(&data),r); 321 break; 322 case BIGINT_CMD: 323 nlDelete((number *)(&data),r); 324 break; 325 case LIST_CMD: 326 ((lists)data)->Clean(r); // may contain ring-dep data 327 break; 328 case QRING_CMD: 329 case RING_CMD: 330 rKill((ring)data); 331 break; 332 case PROC_CMD: 333 piKill((procinfov)data); 334 break; 335 case LINK_CMD: 336 slKill((si_link)data); 337 break; 338 case COMMAND: 339 { 340 command cmd=(command)data; 341 if (cmd->arg1.rtyp!=0) cmd->arg1.CleanUp(); 342 if (cmd->arg2.rtyp!=0) cmd->arg2.CleanUp(); 343 if (cmd->arg3.rtyp!=0) cmd->arg3.CleanUp(); 344 omFreeBin((ADDRESS)data, sip_command_bin); 345 break; 346 } 347 case RESOLUTION_CMD: 348 if (r!=NULL) syKillComputation((syStrategy)data,r); 349 break; 350 case IDHDL: 351 attribute=NULL; // is only a pointer to attribute of id 352 break; 353 // the following types do not take memory 354 // or are not copied 355 case PACKAGE_CMD: 356 case ANY_TYPE: 357 case VECHO: 358 case VPRINTLEVEL: 359 case VCOLMAX: 360 case VTIMER: 361 case VRTIMER: 362 case VOICE: 363 case VMAXDEG: 364 case VMAXMULT: 365 case TRACE: 366 case VSHORTOUT: 367 case VNOETHER: 368 case VMINPOLY: 369 case 0: 370 case INT_CMD: 371 break; 372 default: 373 { 374 if (rtyp<=MAX_TOK) 375 ::Print("CleanUp: unknown type %d\n",rtyp); /* DEBUG */ 376 else if (data!=NULL) 377 { 378 blackbox *b=getBlackboxStuff(rtyp); 379 if (b!=NULL) b->blackbox_destroy(b,data); 380 data=NULL; 381 } 382 } 383 } /* end switch: (rtyp) */ 294 if (rtyp==IDHDL) attribute=NULL; // is only a pointer to attribute of id 295 else s_internalDelete(rtyp,data,r); 384 296 //data=NULL; // will be done by Init() at the end 385 297 } … … 410 322 default: 411 323 { 412 attr t; 413 while (attribute!=NULL) 414 { 415 t=attribute->next; 416 attribute->kill(currRing); 417 attribute=t; 418 } 324 if (attribute!=NULL) attribute->killAll(r); 419 325 } 420 326 } … … 508 414 { 509 415 blackbox *b=getBlackboxStuff(t); 510 416 if (b!=NULL) return b->blackbox_Copy(b,d); 511 417 return NULL; 512 418 } … … 519 425 } 520 426 521 427 void s_internalDelete(const int t, void *d, const ring r) 428 { 429 switch (t) 430 { 431 case INTVEC_CMD: 432 case INTMAT_CMD: 433 { 434 intvec *v=(intvec*)d; 435 delete v; 436 break; 437 } 438 case MAP_CMD: 439 { 440 map m=(map)d; 441 omFree((ADDRESS)m->preimage); 442 m->preimage=NULL; 443 /* no break: continue as IDEAL*/ 444 } 445 case MATRIX_CMD: 446 case IDEAL_CMD: 447 case MODUL_CMD: 448 { 449 ideal i=(ideal)d; 450 id_Delete(&i,r); 451 break; 452 } 453 case STRING_CMD: 454 omFree(d); 455 break; 456 //case POINTER_CMD: 457 // return d; 458 //case PACKAGE_CMD: 459 // return (void *)paCopy((package) d); 460 case PROC_CMD: 461 piKill((procinfo*)d); 462 break; 463 case POLY_CMD: 464 case VECTOR_CMD: 465 { 466 poly p=(poly)d; 467 p_Delete(&p,r); 468 break; 469 } 470 case NUMBER_CMD: 471 { 472 number n=(number)d; 473 n_Delete(&n,r); 474 break; 475 } 476 case BIGINT_CMD: 477 { 478 number n=(number)d; 479 nlDelete(&n,NULL); 480 break; 481 } 482 case LIST_CMD: 483 { 484 lists l=(lists)d; 485 l->Clean(r); 486 break; 487 } 488 case LINK_CMD: 489 { 490 si_link l=(si_link)d; 491 slKill(l); 492 break; 493 } 494 case RING_CMD: 495 case QRING_CMD: 496 { 497 ring R=(ring)d; 498 #ifdef TEST 499 if (R==currRing) 500 PrintS("currRing?\n"); 501 else 502 #endif 503 rKill(R); 504 break; 505 } 506 case RESOLUTION_CMD: 507 { 508 syStrategy s=(syStrategy)d; 509 if (s!=NULL) syKillComputation(s,r); 510 break; 511 } 512 case COMMAND: 513 { 514 command cmd=(command)d; 515 if (cmd->arg1.rtyp!=0) cmd->arg1.CleanUp(r); 516 if (cmd->arg2.rtyp!=0) cmd->arg2.CleanUp(r); 517 if (cmd->arg3.rtyp!=0) cmd->arg3.CleanUp(r); 518 omFreeBin((ADDRESS)d, sip_command_bin); 519 break; 520 } 521 case INT_CMD: 522 case DEF_CMD: 523 case ALIAS_CMD: 524 case POINTER_CMD: 525 case PACKAGE_CMD: 526 case IDHDL: 527 case NONE: 528 case ANY_TYPE: 529 case VECHO: 530 case VPRINTLEVEL: 531 case VCOLMAX: 532 case VTIMER: 533 case VRTIMER: 534 case VOICE: 535 case VMAXDEG: 536 case VMAXMULT: 537 case TRACE: 538 case VSHORTOUT: 539 case VNOETHER: 540 case VMINPOLY: 541 case LIB_CMD: 542 case 0: /* type in error case */ 543 break; /* error recovery: do nothing */ 544 //case COMMAND: 545 //case COMMAND: 546 default: 547 { 548 if (t>MAX_TOK) 549 { 550 blackbox *b=getBlackboxStuff(t); 551 if (b!=NULL) b->blackbox_destroy(b,d); 552 break; 553 } 554 else 555 Warn("s_internalDelete: cannot delete type %s(%d)", 556 Tok2Cmdname(t),t); 557 } 558 } 559 } 522 560 523 561 void * slInternalCopy(leftv source, const int t, void *d, Subexpr e) … … 823 861 824 862 default: 825 826 827 828 829 863 if(t> MAX_TOK) 864 { 865 blackbox *bb=getBlackboxStuff(t); 866 if (bb!=NULL) return bb->blackbox_String(bb,d); 867 } 830 868 } /* end switch: (Typ()) */ 831 869 }
Note: See TracChangeset
for help on using the changeset viewer.