From c0fb50eb13239a18578948684c34af0fb212cd2e Mon Sep 17 00:00:00 2001 From: Eduardo Davila Date: Tue, 14 Sep 2010 07:18:46 +0000 Subject: [PATCH] no message --- kernel/src/bbtkInterpreter.cxx | 276 ++++++++++++++++++++++++++------- kernel/src/bbtkInterpreter.h | 25 ++- 2 files changed, 241 insertions(+), 60 deletions(-) diff --git a/kernel/src/bbtkInterpreter.cxx b/kernel/src/bbtkInterpreter.cxx index ea9adc9..961b42e 100644 --- a/kernel/src/bbtkInterpreter.cxx +++ b/kernel/src/bbtkInterpreter.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkInterpreter.cxx,v $ Language: C++ - Date: $Date: 2009/10/05 22:44:48 $ - Version: $Revision: 1.87 $ + Date: $Date: 2010/09/14 07:18:46 $ + Version: $Revision: 1.88 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -733,7 +733,143 @@ namespace bbtk } //======================================================================= + void Interpreter::commandNew(std::string boxType, std::string boxName) + { + mVirtualExecuter->Create(boxType,boxName); + } + + void Interpreter::commandDelete(std::string boxName) + { + mVirtualExecuter->Destroy(boxName); + } + void Interpreter::commandConnection(std::string nodeFrom, std::string outputLabel, std::string nodeTo, std::string inputLabel) + { + mVirtualExecuter->Connect(nodeFrom,outputLabel,nodeTo,inputLabel); + } + + void Interpreter::commandPackage(std::string packageName) + { + mVirtualExecuter->BeginPackage(packageName); + } + + void Interpreter::commandEndPackage() + { + mVirtualExecuter->EndPackage(); + } + + void Interpreter::commandDefine(std::string name, std::string pack, std::string scriptfilename) + { + mVirtualExecuter->Define(name,pack,scriptfilename); + } + + void Interpreter::commandEndDefine() + { + mVirtualExecuter->EndDefine(); + } + + void Interpreter::commandKind(std::string kind) + { + mVirtualExecuter->Kind(kind); + } + + void Interpreter::commandPrint(std::string value) + { + mVirtualExecuter->Print(value); + } + + + void Interpreter::commandExec(std::string word) + { + if (word=="freeze") + { + mVirtualExecuter->SetNoExecMode(true); + mThrow = false; + } + else if (word=="freeze_no_error") + { + mVirtualExecuter->SetNoExecMode(true); + mVirtualExecuter->SetNoErrorMode(true); + mThrow = false; + } + else if (word=="unfreeze") + { + mVirtualExecuter->SetNoExecMode(false); + mVirtualExecuter->SetNoErrorMode(false); + } + else + { + mVirtualExecuter->Execute(word); + } // if + } + + + void Interpreter::commandInput(std::string name, std::string box, std::string input,std::string help) + { + mVirtualExecuter->DefineInput(name,box,input,help); + } + + void Interpreter::commandOutput(std::string name, std::string box, std::string output,std::string help) + { + mVirtualExecuter->DefineOutput(name,box,output,help); + } + + void Interpreter::commandSet(std::string box, std::string input, std::string value) + { + mVirtualExecuter->Set(box,input,value); + } + + void Interpreter::commandAuthor(std::string author) + { + mVirtualExecuter->Author(author); + } + + void Interpreter::commandCategory(std::string categorytype) + { + mVirtualExecuter->Category(categorytype); + } + + + + void Interpreter::commandDescription(std::string description) + { + mVirtualExecuter->Description(description); + } + + + void Interpreter::commandClear() + { + mVirtualExecuter->Clear(); + } + + void Interpreter::commandInclude(std::string word, bool ok) + { + // if 'source' was given (words.size()==3) then tell to set the + // source file name of the current complex box with the full file name included + if (mCommandLine) + { + InterpretFile(word, ok ); + } + else + { + SwitchToFile(word , ok ); + } + } + + + void Interpreter::commandLoad(std::string packageName) + { + GetExecuter()->LoadPackage(packageName); + } + + void Interpreter::commandUnload(std::string packageName) + { + GetExecuter()->UnLoadPackage(packageName); + } + + //ups2 EED Borrame + + //======================================================================= void Interpreter::DoInterpretLine( const std::string& line ) { @@ -850,118 +986,138 @@ namespace bbtk } //std::cout<<" mVirtualExecuter->Create(words[1],words[2]); "<Create(words[1],words[2]); + commandNew(words[1],words[2]); +//EED Borrame mVirtualExecuter->Create(words[1],words[2]); break; case cDelete : - mVirtualExecuter->Destroy(words[1]); + commandDelete(words[1]); +//EED Borrame mVirtualExecuter->Destroy(words[1]); break; case cConnect : Utilities::SplitAroundFirstDot(words[1],left,right); Utilities::SplitAroundFirstDot(words[2],left2,right2); - mVirtualExecuter->Connect(left,right,left2,right2); + commandConnection(left,right,left2,right2); +//EED Borrame mVirtualExecuter->Connect(left,right,left2,right2); break; case cPackage : - mVirtualExecuter->BeginPackage(words[1]); + commandPackage(words[1]); +//EED Borrame mVirtualExecuter->BeginPackage(words[1]); break; case cEndPackage : - mVirtualExecuter->EndPackage(); + commandEndPackage(); +//EED Borrame mVirtualExecuter->EndPackage(); break; case cDefine : if (mFileName.size()>0) { +//??? commandDefine(????); filename = mFileName.back(); //mIncludeFileName.back(); //Utilities::get_file_name(mFileName.back()); } if (words.size()==2) { - mVirtualExecuter->Define(words[1],"",filename); + commandDefine(words[1],"",filename); +//EED Borrame mVirtualExecuter->Define(words[1],"",filename); } else { - mVirtualExecuter->Define(words[1],words[2],filename); + commandDefine(words[1],words[2],filename); +//EED Borrame mVirtualExecuter->Define(words[1],words[2],filename); } break; case cEndDefine : - mVirtualExecuter->EndDefine(); + commandEndDefine(); +//EED Borrame mVirtualExecuter->EndDefine(); break; case cKind : - mVirtualExecuter->Kind(words[1]); + commandKind(words[1]); +//EED Borrame mVirtualExecuter->Kind(words[1]); break; case cPrint : - mVirtualExecuter->Print(words[1]); + commandPrint(words[1]); +//EED Borrame mVirtualExecuter->Print(words[1]); break; - + case cExec : - if (words[1]=="freeze") - { - mVirtualExecuter->SetNoExecMode(true); - mThrow = false; - } - else if (words[1]=="freeze_no_error") - { - mVirtualExecuter->SetNoExecMode(true); - mVirtualExecuter->SetNoErrorMode(true); - mThrow = false; - } - else if (words[1]=="unfreeze") - { - mVirtualExecuter->SetNoExecMode(false); - mVirtualExecuter->SetNoErrorMode(false); - } - else - { - mVirtualExecuter->Execute(words[1]); - } + commandExec(words[1]); +//EED Borrame if (words[1]=="freeze") +//EED Borrame { +//EED Borrame mVirtualExecuter->SetNoExecMode(true); +//EED Borrame mThrow = false; +//EED Borrame } +//EED Borrame else if (words[1]=="freeze_no_error") +//EED Borrame { +//EED Borrame mVirtualExecuter->SetNoExecMode(true); +//EED Borrame mVirtualExecuter->SetNoErrorMode(true); +//EED Borrame mThrow = false; +//EED Borrame } +//EED Borrame else if (words[1]=="unfreeze") +//EED Borrame { +//EED Borrame mVirtualExecuter->SetNoExecMode(false); +//EED Borrame mVirtualExecuter->SetNoErrorMode(false); +//EED Borrame } +//EED Borrame else +//EED Borrame { +//EED Borrame mVirtualExecuter->Execute(words[1]); +//EED Borrame } + break; case cInput : Utilities::SplitAroundFirstDot(words[2],left,right); - mVirtualExecuter->DefineInput(words[1],left,right,words[3]); + commandInput(words[1],left,right,words[3]); +//EED Borrame mVirtualExecuter->DefineInput(words[1],left,right,words[3]); break; case cOutput : Utilities::SplitAroundFirstDot(words[2],left,right); - mVirtualExecuter->DefineOutput(words[1],left,right,words[3]); + commandOutput(words[1],left,right,words[3]); +//EED Borrame mVirtualExecuter->DefineOutput(words[1],left,right,words[3]); break; case cSet : Utilities::SplitAroundFirstDot(words[1],left,right); - mVirtualExecuter->Set(left,right,words[2]); + commandSet(left,right,words[1]); +//EED Borrame mVirtualExecuter->Set(left,right,words[2]); break; case cAuthor : - mVirtualExecuter->Author(words[1]); + commandAuthor(words[1]); +//EED Borrame mVirtualExecuter->Author(words[1]); break; case cNewGUI : - NewGUI(words[1],words[2]); + NewGUI(words[1],words[2]); break; case cCategory : - mVirtualExecuter->Category(words[1]); + commandCategory(words[1]); +//EED Borrame mVirtualExecuter->Category(words[1]); break; case cIndex : if (words.size()==1) - Index("tmp_index.html"); + Index("tmp_index.html"); else if (words.size()==2) - Index(words[1]); + Index(words[1]); else if (words.size()==3) - Index(words[1],words[2]); + Index(words[1],words[2]); break; case cDescription : - mVirtualExecuter->Description(words[1]); + commandDescription(words[1]); +//EED Borrame mVirtualExecuter->Description(words[1]); break; case cHelp : @@ -982,34 +1138,38 @@ namespace bbtk break; case cClear : - mVirtualExecuter->Clear(); + commandClear(); +//EED Borrame mVirtualExecuter->Clear(); break; case cInclude : - // if 'source' was given (words.size()==3) then tell to set the - // source file name of the current complex box with the full file name included - if (mCommandLine) - { - InterpretFile(words[1],(words.size()==3)); - } - else - { - SwitchToFile(words[1],(words.size()==3) ); - } + commandInclude( words[1] , (words.size()==3) ); +//EED Borrame // if 'source' was given (words.size()==3) then tell to set the +//EED Borrame // source file name of the current complex box with the full file name included +//EED Borrame if (mCommandLine) +//EED Borrame { +//EED Borrame InterpretFile(words[1],(words.size()==3)); +//EED Borrame } else{ +//EED Borrame SwitchToFile(words[1],(words.size()==3) ); +//EED Borrame } break; case cLoad: - GetExecuter()->LoadPackage(words[1]); + commandLoad( words[1] ); +//EED Borrame GetExecuter()->LoadPackage(words[1]); break; case cUnload: - GetExecuter()->UnLoadPackage(words[1]); + commandUnload( words[1] ); +//EED Borrame GetExecuter()->UnLoadPackage(words[1]); break; + //ups1 EED borrame case cDebug : - if (words.size()==2) Debug(words[1]); - else Debug(""); + if (words.size()==2) Debug(words[1]); + else Debug(""); break; + /* obsolete case cWorkspace : if (words.size() == 2) diff --git a/kernel/src/bbtkInterpreter.h b/kernel/src/bbtkInterpreter.h index 0437064..e94da2a 100644 --- a/kernel/src/bbtkInterpreter.h +++ b/kernel/src/bbtkInterpreter.h @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkInterpreter.h,v $ Language: C++ - Date: $Date: 2010/09/12 23:15:15 $ - Version: $Revision: 1.40 $ + Date: $Date: 2010/09/14 07:18:47 $ + Version: $Revision: 1.41 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -327,6 +327,27 @@ namespace bbtk void Debug(const std::string& arg); + void commandNew(std::string boxType, std::string boxName); + void commandDelete(std::string boxName); + void commandConnection(std::string nodeFrom, std::string outputLabel, std::string nodeTo, std::string inputLabel); + void commandPackage(std::string packageName); + void commandEndPackage(); + void commandDefine(std::string name, std::string pack, std::string scriptfilename); + void commandEndDefine(); + void commandKind(std::string kind); + void commandPrint(std::string value); + void commandExec(std::string word); + void commandInput(std::string name, std::string box, std::string input,std::string help); + void commandOutput(std::string name, std::string box, std::string output,std::string help); + void commandSet(std::string box, std::string input, std::string value); + void commandAuthor(std::string author); + void commandCategory(std::string categorytype); + void commandDescription(std::string description); + void commandClear(); + void commandInclude(std::string word, bool ok); + void commandLoad(std::string packageName); + void commandUnload(std::string packageName); + /// Constructor Interpreter(const std::string& cpp_file = ""); -- 2.45.1