Changeset 5c187b in git for Singular/LIB/general.lib


Ignore:
Timestamp:
Oct 22, 1999, 11:07:08 AM (23 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
6f73cfacb2f11a3f3e9096814cdfee48026b890a
Parents:
37c5b38924d40017b1e773d5675c259d1e72f3c4
Message:
* system("mtrack", <filename>)
* linalg.lib included in a;ll.lib
* killall functionality extended to killall("not", name1, name2,...)


git-svn-id: file:///usr/local/Singular/svn/trunk@3763 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/general.lib

    r37c5b3 r5c187b  
    1 // $Id: general.lib,v 1.21 1999-09-27 17:54:57 Singular Exp $
     1// $Id: general.lib,v 1.22 1999-10-22 09:07:07 obachman Exp $
    22//GMG, last modified 18.6.99
    33///////////////////////////////////////////////////////////////////////////////
    44
    5 version="$Id: general.lib,v 1.21 1999-09-27 17:54:57 Singular Exp $";
     5version="$Id: general.lib,v 1.22 1999-10-22 09:07:07 obachman Exp $";
    66info="
    77LIBRARY:  general.lib   PROCEDURES OF GENERAL TYPE
     
    413413         killall(\"not\", \"type_name\"); kills all user-defined variables,
    414414         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
    415418RETURN:  no return value
    416419NOTE:    killall should never be used inside a procedure
     
    418421"
    419422{
    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++)
    435473          {
    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            }
    438479          }
    439        }
    440        else
    441        {
    442           for ( ; joni>2; joni-- )
     480          if (! no_kill)
    443481          {
    444             if(typeof(`L[joni]`)==#[1] and L[joni]!="LIB" and typeof(`L[joni]`)!="proc") { kill `L[joni]`; }
     482            kill `L[joni]`;
    445483          }
    446484        }
    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    }
    455487  }
    456   return();
    457488}
    458489example
Note: See TracChangeset for help on using the changeset viewer.