Changeset d6065b5 in tol


Ignore:
Timestamp:
Jun 10, 2009, 4:07:24 PM (17 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
510f3f8
Parents:
3109e3a
Message:

Allowing type NameBlock or Set por argument optArgs of function getOptArg

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@1063 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/stdlib/general/various/_tools.tol

    r3109e3a rd6065b5  
    4949
    5050////////////////////////////////////////////////////////////////////////////////
    51   Anything getOptArg(Set optArgs, Text name, Anything defValue)
     51  Anything getOptArg(Anything optArgs, Text name, Anything defValue)
    5252////////////////////////////////////////////////////////////////////////////////
    5353{
    54   If(!Card(optArgs), defValue,
    55   {
    56     Real Do If(Card(optArgs),!HasIndexByName(optArgs),SetIndexByName(optArgs));
    57     Real idx = FindIndexByName(optArgs,name);
    58     If(!idx, defValue, optArgs[idx])
    59   })
     54  Text g = Grammar(optArgs);
     55  Case(
     56    g=="Set",
     57    If(!Card(optArgs), defValue,
     58    {
     59      Real Do If(Card(optArgs),!HasIndexByName(optArgs),SetIndexByName(optArgs));
     60      Real idx = FindIndexByName(optArgs,name);
     61      If(!idx, defValue, optArgs[idx])
     62    }),
     63    g=="NameBlock",
     64    If(!ObjectExist("Anything","optArgs::"+name), defValue,
     65       Eval("optArgs::"+name)),
     66    1==1,
     67    {
     68      WriteLn("Non allowed type "+g+" for argument optArgs of function getOptArg",
     69              "E")
     70    }
     71  )
    6072};
    6173////////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.