Changeset 2180 in Sophya for trunk/SophyaPI/PIext/basexecut.cc


Ignore:
Timestamp:
Aug 13, 2002, 12:43:33 PM (23 years ago)
Author:
cmv
Message:

command eval dans spiapp cmv 13/8/02

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/basexecut.cc

    r2176 r2180  
    716716  }
    717717
     718// >>>>>>>>>>>  Calcul d'expression arithmetique
     719else if ( (kw == "eval") ) {
     720  if(tokens.size()<2)
     721    {cout<<"Usage: eval resultvarname arithmetic expression...."<<endl; return(0);}
     722  string expval = "";
     723  for(unsigned int i=1;i<tokens.size();i++) expval+=tokens[i];
     724  string resultvarname = "";
     725  if(isalpha(tokens[0][0])) resultvarname=tokens[0];
     726  mObjMgr->GetServiceObj()->ExpVal(expval,resultvarname);
     727  }
    718728
    719729else  {
     
    12301240mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
    12311241
     1242
     1243kw = "eval";
     1244usage = "Compute arithmetic expression\n";
     1245usage += "\n Usage: eval resultvarname arithmetic expression....";
     1246usage += "\n  resultvarname: store result in variable resultvarname";
     1247usage += "\n    - If first character is not alphabetic, just print result";
     1248usage += "\n  arithmetic expression:";
     1249usage += "\n      ex: x + sqrt(y)+z +3.14    (x,y,z are variables)";
     1250usage += "\n      ex: $x + sqrt($y)+$z +3.14 (x,y,z are variables)";
     1251usage += "\n      ex: 360 * M_PI / 180.";
     1252mpiac->RegisterCommand(kw, usage, this, "Expr. Arithmetic");
     1253
    12321254}
    12331255
Note: See TracChangeset for help on using the changeset viewer.