]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkInterpreterVirtual.cxx
Feature #1774
[bbtk.git] / kernel / src / bbtkInterpreterVirtual.cxx
index e3ce34b0450383baa9e671cdb6db17e4c7f563a8..2498e9018e0738f08468ba04ecd6a6975851bd78 100644 (file)
@@ -1,4 +1,31 @@
-/*=========================================================================                                                                               
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ #                        pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ #  This software is governed by the CeCILL-B license under French law and
+ #  abiding by the rules of distribution of free software. You can  use,
+ #  modify and/ or redistribute the software under the terms of the CeCILL-B
+ #  license as circulated by CEA, CNRS and INRIA at the following URL
+ #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ #  or in the file LICENSE.txt.
+ #
+ #  As a counterpart to the access to the source code and  rights to copy,
+ #  modify and redistribute granted by the license, users are provided only
+ #  with a limited warranty  and the software's author,  the holder of the
+ #  economic rights,  and the successive licensors  have only  limited
+ #  liability.
+ #
+ #  The fact that you are presently reading this means that you have had
+ #  knowledge of the CeCILL-B license and that you accept its terms.
+ # ------------------------------------------------------------------------ */
+
+
+/*=========================================================================
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.cxx,v $
   Language:  C++
@@ -6,27 +33,7 @@
   Version:   $Revision: 1.88 $
 =========================================================================*/
 
-/* ---------------------------------------------------------------------
-
-* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
-* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
-*
-*  This software is governed by the CeCILL-B license under French law and 
-*  abiding by the rules of distribution of free software. You can  use, 
-*  modify and/ or redistribute the software under the terms of the CeCILL-B 
-*  license as circulated by CEA, CNRS and INRIA at the following URL 
-*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
-*  or in the file LICENSE.txt.
-*
-*  As a counterpart to the access to the source code and  rights to copy,
-*  modify and redistribute granted by the license, users are provided only
-*  with a limited warranty  and the software's author,  the holder of the
-*  economic rights,  and the successive licensors  have only  limited
-*  liability. 
-*
-*  The fact that you are presently reading this means that you have had
-*  knowledge of the CeCILL-B license and that you accept its terms.
-* ------------------------------------------------------------------------ */                                                                         
+
 
 /**
  *  \file 
@@ -1270,7 +1277,8 @@ namespace bbtk
     std::string fullPathScriptName;  // full path script name
     std::string pkgname;             // e.g. <scriptname>.bbs
     std::vector<std::string> Filenames;
-
+         std::string tmpFilenames;
+         
     // The following is *NOT* a debug time message :
     // It's a user intended message.
     // Please don't remove it.
@@ -1373,6 +1381,27 @@ printf("EED InterpreterVirtual::SwitchToFile jaja >>  %s\n", (*i).c_str() );
            //int nbFiles = 
            Utilities::Explore(*i, false, Filenames);
 
+                 int iFilesnames,jFilesnames,sizeFilenames;
+                 sizeFilenames=Filenames.size();
+                 
+                 
+                 // EEDd 30 sept 2012
+                 //Sorting list of files
+                 for (iFilesnames=0;iFilesnames<sizeFilenames; iFilesnames++)
+             {
+                         for (jFilesnames=iFilesnames;jFilesnames<sizeFilenames; jFilesnames++)
+                         {
+                                 if ( Filenames[iFilesnames] > Filenames[jFilesnames] )
+                                 {
+                                         tmpFilenames                          = Filenames[iFilesnames];
+                                         Filenames[iFilesnames]        = Filenames[jFilesnames];
+                                         Filenames[jFilesnames]        = tmpFilenames;
+                                 } // if Filesnames
+                         } // for iFilesnames
+             } // for iFilesnames
+                 
+                 
+                 
            for (std::vector<std::string>::iterator j = Filenames.begin(); 
                 j!= Filenames.end(); ++j)
              {
@@ -1537,7 +1566,12 @@ printf("EED InterpreterVirtual::SwitchToFile kkkkk     >>  %s\n", (*j).c_str() )
 //EED printf("EED D. SwitchToFile %s\n", fullPathScriptName.c_str() );   
                LoadScript(fullPathScriptName,name);
 //EED Borrame    if (source) GetExecuter()->SetCurrentFileName(fullPathScriptName);
-               if (source) SetCurrentFileName(fullPathScriptName);
+                 if (source) 
+                 {
+                         // Over writing the fullpath of the bbp file.
+                         SetCurrentFileName( fullPathScriptName );
+                         SetTypeOfScript_Application();
+                 }
        }    
                  
     return;
@@ -1550,6 +1584,14 @@ printf("EED InterpreterVirtual::SwitchToFile kkkkk     >>  %s\n", (*j).c_str() )
        }       
        //=======================================================================
        
+       
+       //=======================================================================
+       void InterpreterVirtual::SetTypeOfScript_Application( )
+       {
+       }
+       //=======================================================================
+
+       
   //=======================================================================
 void InterpreterVirtual::SwitchToStream( std::stringstream* stream )
 {