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 $
=========================================================================*/
/* ---------------------------------------------------------------------
}
//=======================================================================
+ 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 )
{
}
//std::cout<<" mVirtualExecuter->Create(words[1],words[2]); "<<line<<std::endl;
// other cammands
+
switch (command.code)
{
case cNew :
- mVirtualExecuter->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 :
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)