Program: bbtk
Module: $RCSfile: bbtkInterpreter.cxx,v $
Language: C++
- Date: $Date: 2009/06/08 14:50:03 $
- Version: $Revision: 1.86 $
+ Date: $Date: 2009/10/05 22:44:48 $
+ Version: $Revision: 1.87 $
=========================================================================*/
/* ---------------------------------------------------------------------
char buf[500];
mFile.back()->getline(buf,500);
std::string str(buf);
-
+ //size 0 JCP 21-09-2009
int size=str.length();
- if ( str[ size-1 ]==13 )
+ if(size != 0){
+ if ( str[ size-1 ]==13 )
{
str.erase(size-1,1);
}
- try
- {
- DoInterpretLine(str);
- }
- CATCH_MACRO;
+ try
+ {
+ DoInterpretLine(str);
+ }
+ CATCH_MACRO;
+ }
+
}
CloseCurrentFile();
}
{
mStatus = Interpreter_OK;
mInsideComment = false;
+//std::cout<<"JCP bbtkInterpreter.cxx Interpreter::InterpretLine("<<std::endl;
DoInterpretLine(line );
}
CATCH_MACRO;
{
bbtkDebugMessage("interpreter",6,"==> Interpreter::DoInterpretLine(\""
<<line<<"\")"<<std::endl);
-
std::vector<std::string> words;
SplitLine(line,words);
// Command
CommandInfoType command;
InterpretCommand(words,command);
-
+//std::cout<<"JCP bbtkInterpreter command.keyword ="<<command.keyword<<std::endl;
bbtkDebugMessage("interpreter",9,
"Command='"<<command.keyword
<<"' code="<<command.code<<std::endl);
bool in_script = false;
std::string file("");
int line = 0;
+
if (mFileName.size())
{
std::ifstream* fs = dynamic_cast<std::ifstream*>(mFile.back());
}
return;
}
-
+//std::cout<<" mVirtualExecuter->Create(words[1],words[2]); "<<line<<std::endl;
// other cammands
switch (command.code)
{
}
std::string tfullPathScriptName = Utilities::MakePkgnameFromPath(path, name, false);
- if (tfullPathScriptName.substr(tfullPathScriptName.size()-4, 3)==".bb")
- {
- fullPathScriptName = tfullPathScriptName;
- if ( ! Utilities::FileExists(fullPathScriptName) )
+//Addition JCP tfullPathScriptName.size()>=4
+ if(tfullPathScriptName.size()>=4){
+ if (tfullPathScriptName.substr(tfullPathScriptName.size()-4, 3)==".bb")
{
- // The following is *NOT* a debug time message :
- // It's a user intended message.
- // Please don't remove it.
- bbtkMessage("interpreter",2,
- " [" <<fullPathScriptName <<"] : does not exist"
- <<std::endl);
- continue; // try next path
- }
- bbtkMessage("interpreter",2,
- " [" <<fullPathScriptName
- <<"] : found" <<std::endl);
- foundFile = true;
- break; // a script was found; we stop iterating
- }
- else
- {
- fullPathScriptName = tfullPathScriptName + ".bbs";
- // Check if library exists
- if ( ! Utilities::FileExists(fullPathScriptName) )
- {
- fullPathScriptName = tfullPathScriptName + ".bbp";
+ fullPathScriptName = tfullPathScriptName;
if ( ! Utilities::FileExists(fullPathScriptName) )
{
// The following is *NOT* a debug time message :
// It's a user intended message.
// Please don't remove it.
bbtkMessage("interpreter",2,
- " [" <<tfullPathScriptName <<".bbs/.bbp] : do not exist"
- <<std::endl);
+ " [" <<fullPathScriptName <<"] : does not exist"
+ <<std::endl);
continue; // try next path
}
+ bbtkMessage("interpreter",2,
+ " [" <<fullPathScriptName
+ <<"] : found" <<std::endl);
+ foundFile = true;
+ break; // a script was found; we stop iterating
}
- bbtkMessage("interpreter",2,
- " [" <<fullPathScriptName
- <<"] : found" <<std::endl);
- foundFile = true;
- break; // a script was found; we stop iterating
- }
+ else
+ {
+ fullPathScriptName = tfullPathScriptName + ".bbs";
+ // Check if library exists
+ if ( ! Utilities::FileExists(fullPathScriptName) )
+ {
+ fullPathScriptName = tfullPathScriptName + ".bbp";
+ if ( ! Utilities::FileExists(fullPathScriptName) )
+ {
+ // The following is *NOT* a debug time message :
+ // It's a user intended message.
+ // Please don't remove it.
+ bbtkMessage("interpreter",2,
+ " [" <<tfullPathScriptName <<".bbs/.bbp] : do not exist"
+ <<std::endl);
+ continue; // try next path
+ }
+ }
+ bbtkMessage("interpreter",2,
+ " [" <<fullPathScriptName
+ <<"] : found" <<std::endl);
+ foundFile = true;
+ break; // a script was found; we stop iterating
+ }
+ }
} //------------------ // end for ( package_paths.begin();i!=package_paths.end() )
}
HelpCommand(words[0]);
bbtkError(words[0]<<" : wrong number of arguments");
}
-
+//std::cout<<"Interpreter::InterpretCommand( const std::vector<std::string>& words,"<<std::endl;
info = c->second;
bbtkDebugMessage("interpreter",9,"<== Interpreter::InterpretCommand(...)"<<std::endl);