Changeset 5c187b in git for Singular/LIB/general.lib
- Timestamp:
- Oct 22, 1999, 11:07:08 AM (23 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 6f73cfacb2f11a3f3e9096814cdfee48026b890a
- Parents:
- 37c5b38924d40017b1e773d5675c259d1e72f3c4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/general.lib
r37c5b3 r5c187b 1 // $Id: general.lib,v 1.2 1 1999-09-27 17:54:57 SingularExp $1 // $Id: general.lib,v 1.22 1999-10-22 09:07:07 obachman Exp $ 2 2 //GMG, last modified 18.6.99 3 3 /////////////////////////////////////////////////////////////////////////////// 4 4 5 version="$Id: general.lib,v 1.2 1 1999-09-27 17:54:57 SingularExp $";5 version="$Id: general.lib,v 1.22 1999-10-22 09:07:07 obachman Exp $"; 6 6 info=" 7 7 LIBRARY: general.lib PROCEDURES OF GENERAL TYPE … … 413 413 killall(\"not\", \"type_name\"); kills all user-defined variables, 414 414 except those of type \"type_name\" and except loaded procedures 415 killall(\"not\", \"name_1\", \"name_2\", ...); 416 kills all user-defined variables, except those of name \"name_i\" 417 and except loaded procedures 415 418 RETURN: no return value 416 419 NOTE: killall should never be used inside a procedure … … 418 421 " 419 422 { 420 list L=names(); int joni=size(L); 421 if( size(#)==0 ) 422 { 423 for ( ; joni>0; joni-- ) 424 { 425 if( L[joni]!="LIB" and typeof(`L[joni]`)!="proc" ) { kill `L[joni]`; } 426 } 427 } 428 else 429 { 430 if( size(#)==1 ) 431 { 432 if( #[1] == "proc" ) 433 { 434 for ( joni=size(L); joni>0; joni-- ) 423 list L=names(); int joni=size(L); 424 int no_kill, j; 425 for (j=1; j<=size(#); j++) 426 { 427 if (typeof(#[j]) != "string") 428 { 429 ERROR("Need string as " + string(j) + "th argument"); 430 } 431 } 432 433 // kills all user-defined variables but not loaded procedures 434 if( size(#)==0 ) 435 { 436 for ( ; joni>0; joni-- ) 437 { 438 if( L[joni]!="LIB" and typeof(`L[joni]`)!="proc" ) { kill `L[joni]`; } 439 } 440 } 441 else 442 { 443 // kills all user-defined variables 444 if( size(#)==1 ) 445 { 446 // of type proc 447 if( #[1] == "proc" ) 448 { 449 for ( joni=size(L); joni>0; joni-- ) 450 { 451 if((L[joni]!="killall") and (L[joni]=="LIB" or typeof(`L[joni]`)=="proc")) 452 { kill `L[joni]`; } 453 } 454 } 455 else 456 { 457 // other types 458 for ( ; joni>2; joni-- ) 459 { 460 if(typeof(`L[joni]`)==#[1] and L[joni]!="LIB" and typeof(`L[joni]`)!="proc") { kill `L[joni]`; } 461 } 462 } 463 } 464 else 465 { 466 // kills all user-defined variables whose name or type is not #i 467 for ( ; joni>2; joni-- ) 468 { 469 if ( L[joni] != "LIB" && typeof(`L[joni]`) != "proc") 470 { 471 no_kill = 0; 472 for (j=2; j<= size(#); j++) 435 473 { 436 if((L[joni]!="killall") and (L[joni]=="LIB" or typeof(`L[joni]`)=="proc")) 437 { kill `L[joni]`; } 474 if (typeof(`L[joni]`)==#[j] or L[joni] == #[j]) 475 { 476 no_kill = 1; 477 break; 478 } 438 479 } 439 } 440 else 441 { 442 for ( ; joni>2; joni-- ) 480 if (! no_kill) 443 481 { 444 if(typeof(`L[joni]`)==#[1] and L[joni]!="LIB" and typeof(`L[joni]`)!="proc") { kill `L[joni]`; }482 kill `L[joni]`; 445 483 } 446 484 } 447 } 448 else 449 { 450 for ( ; joni>2; joni-- ) 451 { 452 if(typeof(`L[joni]`)!=#[2] and L[joni]!="LIB" and typeof(`L[joni]`)!="proc") { kill `L[joni]`; } 453 } 454 } 485 } 486 } 455 487 } 456 return();457 488 } 458 489 example
Note: See TracChangeset
for help on using the changeset viewer.