Changeset 353 in Sophya for trunk/SophyaPI
- Timestamp:
- Aug 5, 1999, 3:40:42 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/piacmd.cc
r349 r353 291 291 usage += " > unset varname # clear variable definition \n"; 292 292 usage += " > echo string # output string \n"; 293 usage += " > alias name string # define a command alias \n"; 294 usage += " > readstdin varname # reads a line from stdin into $varname \n"; 293 295 usage += " > foreach varname string-list # Loop \n"; 294 296 usage += " > foreach varname i1:i2[:di] # Integer loop \n"; 295 297 usage += " > foreach varname f1:f2[:df] # Float loop \n"; 296 298 usage += " > end # end loops \n"; 297 usage += " > listvars # List of variable names and values \n"; 298 usage += " > listcommands # List of all known commands \n"; 299 usage += " > exec filename # Execute commands from file \n"; 299 usage += " > listvars # List of variable names and values \n"; 300 usage += " > listalias # List of alias names and values \n"; 301 usage += " > listcommands # List of all known commands \n"; 302 usage += " > exec filename # Execute commands from file \n"; 300 303 usage += " > shell comand_string # Execute shell command \n"; 301 304 usage += " > help <command_name> # <command_name> usage info \n"; … … 488 491 else { 489 492 char prompt[64]; 490 sprintf(prompt, "foreach-%d >", felevel);493 sprintf(prompt, "foreach-%d? ", felevel); 491 494 mImgApp->GetConsole()->SetPrompt(prompt); 492 495 } … … 673 676 cout << endl; 674 677 } 678 679 else if (kw == "readstdin") { 680 if (tokens.size() < 1) { cout << "PIACmd::Interpret() Usage: readstdin varname" << endl; return(0); } 681 if ((tokens[0].length() < 1) || !isalpha((int)tokens[0][0]) ) { 682 cerr << "PIACmd::Interpret()/Error Variable name should start with alphabetic" << endl; 683 return(0); 684 } 685 char buff[128]; 686 fgets(buff, 128, stdin); 687 buff[127] = '\0'; 688 mVars[tokens[0]] = buff; 689 } 690 675 691 else if (kw == "listvars") { 676 692 cout << "PIACmd::Interpret() Variable List , VarName = Value \n"; … … 680 696 cout << endl; 681 697 } 682 else if (kw == "listvars") { 698 else if (kw == "listalias") { 699 cout << "PIACmd::Interpret() Alias List , AliasName = Value \n"; 700 CmdVarList::iterator it; 701 for(it = mAliases.begin(); it != mAliases.end(); it++) 702 cout << (*it).first << " = " << (*it).second << "\n"; 703 cout << endl; 704 } 705 else if (kw == "listcommands") { 683 706 cout << "---- PIACmd::Interpret() Command Variable List ----- \n"; 684 707 CmdExmap::iterator it;
Note:
See TracChangeset
for help on using the changeset viewer.