Program: bbtk
Module: $RCSfile: bbtkInterpreter.cxx,v $ $
Language: C++
- Date: $Date: 2008/03/07 11:15:15 $
- Version: $Revision: 1.41 $
+ Date: $Date: 2008/03/11 12:27:21 $
+ Version: $Revision: 1.43 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
try
{
SwitchToFile(filename);
+ /*
+ printf("EED Interpreter::InterpretFile 0001\n" );
+int ii,ssize = mFileName.size();
+for (ii=0;ii<ssize;ii++)
+{
+ printf("EED RRR Interpreter::InterpretFile %s\n", mFileName[ii].c_str() );
+}
+ */
bool insideComment = false; // for multiline comment
while (mFile.size()>0)
{
+ //printf("EED --- %s --- Interpreter::InterpretFile \n", mFileName[0].c_str() );
while ((mFile.size()>0) &&
(!mFile.back()->eof()))
{
mLine.back()++;
char buf[500];
mFile.back()->getline(buf,500);
-
std::string str(buf);
int size=str.length();
if ( str[ size-1 ]==13 )
}
InterpretLine(str, insideComment);
+ //printf("EED Interpreter::InterpretFile %s\n", str.c_str() );
}
//if (mFile.size()>0)
CloseCurrentFile();
}
foundFile = true;
-
+ Filenames.clear();
int nbFiles = Utilities::Explore(fullDirectoryName, false, Filenames);
nbBssFiles = 0;
for (std::vector<std::string>::iterator i = Filenames.begin(); i!= Filenames.end(); ++i)
{
+//EEDprintf("EED Interpreter::SwitchToFile %s\n",(*i).c_str() );
if ((*i).substr((*i).size()-4, 4) != ".bbs")
continue; // ignore non .bbs files
std::string command("include ");
void Interpreter::LoadScript( std::string fullPathScriptName,
std::string includeScriptName)
{
- if (find(mFileName.begin(),mFileName.end(),fullPathScriptName)
- !=mFileName.end())
+//EED printf("EED Interpreter::LoadScript >>01\n");
+ Utilities::replace( fullPathScriptName , INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
+
+ bool okScriptExist=false;
+ int iStrScript,sizeVecStricpt=mFileName.size();
+ for ( iStrScript=0;iStrScript<sizeVecStricpt;iStrScript++)
+ {
+//EED printf(" EED %d Interpreter::LoadScript %s __>>__ %s\n", iStrScript,mFileName[iStrScript].c_str(),fullPathScriptName.c_str() );
+ if (mFileName[iStrScript] == fullPathScriptName )
+ {
+ // printf(" EED %d Interpreter::LoadScript iguales\n",iStrScript );
+ okScriptExist=true;
+ } // if
+ } // for
+
+ if (find(mFileName.begin(),mFileName.end(),fullPathScriptName)!=mFileName.end())
+// if (okScriptExist==true)
{
+//EED printf("EED Interpreter::LoadScript Exit method\n");
bbtkMessage("Interpreter",1,"file '"<<fullPathScriptName
<<"' already open : I do not open it once more to prevent recursive inclusion"<<std::endl);
return;
mFileName.push_back(fullPathScriptName);
mIncludeFileName.push_back(includeScriptName);
mLine.push_back(0);
+//EED printf("EED Interpreter::LoadScript >>02\n");
return;
}
return;
}
+ bbtkDebugMessage("Interpreter",9," Closing file '"<<mFileName.back()<<"'"<<std::endl);
mFile.back()->close();
delete mFile.back();
mFile.pop_back();
- bbtkDebugMessage("Interpreter",9,
- " Closing file '"<<mFileName.back()<<"'"<<std::endl);
-
mFileName.pop_back();
mIncludeFileName.pop_back();
- mLine.pop_back();
+ mLine.pop_back();
+/*EED3
+ bbtkDebugMessage("Interpreter",9," Closing file '"<<mFileName[0]<<"'"<<std::endl);
+ mFile[0]->close();
+ delete mFile[0];
+ mFile.erase( mFile.begin() );
+ mFileName.erase( mFileName.begin() );
+ mIncludeFileName.erase( mIncludeFileName.begin() );
+ mLine.erase( mLine.begin() );
+*/
+
bbtkDebugMessage("Interpreter",9," Remains "
<<mFile.size()
<<" open"<<std::endl);