X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=kernel%2Fsrc%2FbbtkInterpreter.cxx;h=d791462c9464d2a338f819fd01317aada1a88b8b;hb=a4fe3363034ebb3d905fc1cdbc6725539bf272a1;hp=e9bf1e8c8cef24bb0af3c64b2162b637a33acb73;hpb=c03be5662c1ea498e612cbaa9f9b7a9988a65765;p=bbtk.git diff --git a/kernel/src/bbtkInterpreter.cxx b/kernel/src/bbtkInterpreter.cxx index e9bf1e8..d791462 100644 --- a/kernel/src/bbtkInterpreter.cxx +++ b/kernel/src/bbtkInterpreter.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkInterpreter.cxx,v $ $ Language: C++ - Date: $Date: 2008/03/07 08:40:14 $ - Version: $Revision: 1.40 $ + 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 @@ -313,16 +313,24 @@ std::cout << "=========================================~Interpreter()" << std::e try { SwitchToFile(filename); + /* + printf("EED Interpreter::InterpretFile 0001\n" ); +int ii,ssize = mFileName.size(); +for (ii=0;ii0) { + //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 ) @@ -331,6 +339,7 @@ std::cout << "=========================================~Interpreter()" << std::e } InterpretLine(str, insideComment); + //printf("EED Interpreter::InterpretFile %s\n", str.c_str() ); } //if (mFile.size()>0) CloseCurrentFile(); @@ -795,7 +804,11 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& { if ((*i).substr((*i).size()-4, 4) != ".bbs") continue; // ignore non .bbs files - LoadScript(*i,name); + std::string command("include "); + command += *i; + // LoadScript(*i,name); + bool tmp; + InterpretLine(command,tmp); nbBssFiles++; } if (nbBssFiles==0) @@ -838,15 +851,20 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& } foundFile = true; - + Filenames.clear(); int nbFiles = Utilities::Explore(fullDirectoryName, false, Filenames); nbBssFiles = 0; for (std::vector::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 - LoadScript(*i,name); + std::string command("include "); + command += *i; + bool tmp; + InterpretLine(command,tmp); + // LoadScript(*i,name); nbBssFiles++; } if (nbBssFiles==0) @@ -964,9 +982,25 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& 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>__ %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 '"<& mFileName.push_back(fullPathScriptName); mIncludeFileName.push_back(includeScriptName); mLine.push_back(0); +//EED printf("EED Interpreter::LoadScript >>02\n"); return; } @@ -1006,15 +1041,23 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& return; } + bbtkDebugMessage("Interpreter",9," Closing file '"<close(); delete mFile.back(); mFile.pop_back(); - bbtkDebugMessage("Interpreter",9, - " Closing file '"<close(); + delete mFile[0]; + mFile.erase( mFile.begin() ); + mFileName.erase( mFileName.begin() ); + mIncludeFileName.erase( mIncludeFileName.begin() ); + mLine.erase( mLine.begin() ); +*/ + bbtkDebugMessage("Interpreter",9," Remains " <