Changeset 2287 in Sophya
- Timestamp:
- Dec 5, 2002, 12:16:52 PM (23 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/cxxexecutor.cc
r2182 r2287 15 15 : mUserCodeFn(""), mUserFctFn("") 16 16 , mCompOpt(""), mLinkOpt(""), mMyLibs("") 17 , mDefRoot("cxx_spiapp"), mDefFunc("usercxx"), mPrtLevel(2) 17 , mDefRoot("cxx_spiapp"), mDefFunc("usercxx"), mPrtLevel(2), mFgPutVar(false) 18 18 { 19 19 mIncList.resize(0); … … 121 121 usage+= " c++import -?? : list of available modules for executor\n"; 122 122 usage+= "Warning: to be used before c++create c++compile c++exec ..."; 123 mpiac->RegisterCommand(kw, usage, this, hgrp); 124 125 kw = "c++declareomgvar"; 126 usage = "c++declareomgvar: Activate/Deactivate ObjectManager variables declaration \n"; 127 usage+= "Usage: c++declareomgvar [false/true] \n"; 128 usage+= " if true, the ObjectManager variables are declared as $varname \n"; 129 usage+= " no arguments: display the current status of the flag (default=false\n"; 123 130 mpiac->RegisterCommand(kw, usage, this, hgrp); 124 131 … … 234 241 } 235 242 FillModuleImport(tokens); 236 243 } else if(kw == "c++declareomgvar") { 244 if (tokens.size() <1) { 245 string fgstat = (mFgPutVar) ? "TRUE" : "FALSE" ; 246 cout << " c++declareomgvar: Current flag status: " << fgstat << endl; 247 } 248 else { 249 if (tokens[0] == "true") DeclareObjMgrVar(true); 250 else if (tokens[0] == "false") DeclareObjMgrVar(false); 251 } 237 252 } else if(kw == "c++prtlevel") { 238 253 if(tokens.size()==1) if(tokens[0]=="-?") … … 300 315 os<<endl; 301 316 302 PutVar(os);317 if (mFgPutVar) PutVar(os); 303 318 os<<endl; 304 319 … … 388 403 <<" om.DisplayObj(name, opt); \n" 389 404 <<"} \n" << endl; 390 391 os<<"//---- Objects and variables saving"<<endl 392 <<"#define KeepObj(obj) Keep_Object(obj, #obj);"<<endl 393 <<"#define KeepVar(var) ___nomobj = #var; omg.GetVarList().Get(___nomobj) = var ;"<<endl 405 os<<"//---- function for getting and setting ObjectManager variables " << endl; 406 os<<"void Set_ObjMgrVar(MuTyV v, string const & nom) \n{ \n" 407 <<" NamedObjMgr om; \n" 408 <<" om.SetVar(nom, (string)v); \n" 409 <<"} \n" << endl; 410 os<<"MuTyV Get_ObjMgrVar(const char * nom) \n{ \n" 411 <<" string name = nom; NamedObjMgr om; \n" 412 <<" MuTyV v = om.GetVar(name); \n" 413 <<" return v; \n" 414 <<"} \n" << endl; 415 416 os<<"//---- Macro for Objects and variables saving"<<endl 417 <<"#define KeepObj(obj) Keep_Object(obj, #obj)"<<endl 418 <<"#define GetOMVar(var) Get_ObjMgrVar( #var )"<<endl 419 <<"#define SetOMVar(var) Set_ObjMgrVar(var, #var )"<<endl 394 420 <<endl; 395 421 396 os<<"//---- Displaying objects and command execution"<<endl;422 os<<"//---- Macro Displaying objects and command execution"<<endl; 397 423 os<<"#define DisplayObj(obj, att) Display_Object(obj, att, #obj); \n" << endl; 398 424 os<<"#define ExecuteCommand(cmd) srvo.ExecuteCommand(cmd); \n" << endl; -
trunk/SophyaPI/PIext/cxxexecutor.h
r2181 r2287 28 28 29 29 int ExecuteCXX(string usercode,string userfct=""); 30 31 // if true , declare ObjMgr variables as $varname 32 inline void DeclareObjMgrVar(bool fg=false) { mFgPutVar=fg; } 30 33 31 34 int CrFile(string cfilename="",string func=""); … … 92 95 93 96 uint_2 mPrtLevel; 97 bool mFgPutVar; // if true , declare ObjMgr variables as $varname, default=false 94 98 }; 95 99 -
trunk/SophyaPI/PIext/piacmd.cc
r2285 r2287 431 431 usage += " > rpneval varname RPNExpression # Reverse Polish Notation evaluation \n"; 432 432 usage += " > echo string # output string \n"; 433 usage += " > echo2file filename string # Append the string to the specified file \n"; 433 434 usage += " > alias name string # define a command alias \n"; 434 435 usage += " > readstdin varname # reads a line from stdin into $varname \n"; … … 1528 1529 cout << endl; 1529 1530 } 1531 else if (kw == "echo2file") { 1532 if (tokens.size() < 1) { 1533 cout << "PIACmd::Interpret() Usage: echo2file filename [string ] " << endl; 1534 return(0); 1535 } 1536 ofstream ofs(tokens[0].c_str(), ios::app); 1537 for (int ii=1; ii<tokens.size(); ii++) 1538 ofs << tokens[ii] << " " ; 1539 ofs << endl; 1540 } 1530 1541 else if (kw == "readstdin") { 1531 1542 if (tokens.size() < 1) { cout << "PIACmd::Interpret() Usage: readstdin varname" << endl; return(0); }
Note:
See TracChangeset
for help on using the changeset viewer.