]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkInterpreter.cxx
*** empty log message ***
[bbtk.git] / kernel / src / bbtkInterpreter.cxx
index 5f6b3e65b9853a38c5f2e6316faf8e3a003a227c..7a57fe976f7e48bf687c8ce5e03700f388e76d80 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.cxx,v $ $
   Language:  C++
-  Date:      $Date: 2008/02/04 13:02:58 $
-  Version:   $Revision: 1.18 $
+  Date:      $Date: 2008/02/04 13:51:30 $
+  Version:   $Revision: 1.19 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -806,6 +806,9 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
 
         fullDirectoryName = Utilities::MakePkgnameFromPath(path, upath, false);
 //std::cout <<"fullpath [" <<   fullDirectoryName << "]" <<std::endl;
+//     std::cout << "== "<<fullDirectoryName<<" =="<<std::endl;
+       
+
       // Check if library exists           
         if ( ! Utilities::IsDirectory(fullDirectoryName) )
         {
@@ -824,6 +827,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
         nbBssFiles = 0;
         for (std::vector<std::string>::iterator i = Filenames.begin(); i!= Filenames.end(); ++i)
         {
+         //    std::cout << "=== "<<*i<<" =="<<std::endl;
            if ((*i).substr((*i).size()-4, 4) != ".bbs")
               continue;      // ignore non .bbs files
            LoadScript(*i);
@@ -833,7 +837,8 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
            if (verbose)
               std::cout << "WARNING : No '.bbs' file found in [" << fullDirectoryName << "]" << std::endl;
            
-        break; // a directory was found; we stop iterating
+        //break; // a directory was found; we stop iterating
+       // LG : No! We want all files included !
        }
        return;
     }
@@ -939,6 +944,13 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
 
   void Interpreter::LoadScript( std::string fullPathScriptName)
   {
+    if (find(mFileName.begin(),mFileName.end(),fullPathScriptName)
+       !=mFileName.end()) 
+      {
+       bbtkMessage("Interpreter",1,"file '"<<fullPathScriptName<<"' already open : do not open it once more to prevent recursive inclusion"<<std::endl);
+       return;
+      }
+
     bbtkMessage("Interpreter",1,fullPathScriptName<<" found"<<std::endl);
 
     std::ifstream* s;      
@@ -950,7 +962,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
         return;     
     }
     
-    if (verbose)
+    //if (verbose)
        std::cout << "   -->[" << fullPathScriptName << "] found" << std::endl;
 
     mFile.push_back(s);