]> Creatis software - bbtk.git/commitdiff
Bug #1498
authorEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Tue, 16 Oct 2012 06:31:04 +0000 (06:31 +0000)
committerEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Tue, 16 Oct 2012 06:31:04 +0000 (06:31 +0000)
Load Package order.

kernel/src/bbtkFactory.cxx
kernel/src/bbtkInterpreter.cxx
kernel/src/bbtkInterpreterVirtual.cxx

index 3d4aef1d4d45ca196f30c85f81bcad68c16bd6d4..7c55c7f00ed9fd7dc33769cc2503098364e725b2 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkFactory.cxx,v $
   Language:  C++
-  Date:      $Date: 2012/05/30 17:17:00 $
-  Version:   $Revision: 1.52 $
+  Date:      $Date: 2012/10/16 06:31:04 $
+  Version:   $Revision: 1.53 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -115,7 +115,6 @@ namespace bbtk
        bbtkMessage("output",2,p->GetDescription()<<std::endl);
        //===================================================================
        p->AddFactory(GetThisPointer<Factory>());
-printf("EED Factory::DoLoadPackage > %s %s  %s \n",libname.c_str(), pkgname.c_str(),path.c_str());               
        mPackageMap[pkgname] = p;
        return true;
       }
@@ -164,26 +163,23 @@ printf("EED Factory::DoLoadPackage > %s %s  %s \n",libname.c_str(), pkgname.c_st
 
                std::string upath;
 
-               
                pkgname = Utilities::ExtractPackageName(name,upath);
-               
-               printf("EED Factory::LoadPackage A. %s\n", name.c_str());
-               printf("EED Factory::LoadPackage A. %s\n", upath.c_str());
-               printf("EED Factory::LoadPackage A. %s\n", pkgname.c_str());
-               
+                               
                bbtkMessage("debug",1,"Package name ["<<pkgname<<"]"<<std::endl);
                bbtkMessage("debug",1,"Package path ["<<upath<<"]"<<std::endl);
 
                // no loading package if already loaded
                PackageMapType::iterator iUnload;
                iUnload = mPackageMap.find(pkgname);
-               
-               PackageMapType::iterator it;
-std::cout << "EED Factory::LoadPackage PackageMap ";
-               for ( it=mPackageMap.begin() ; it != mPackageMap.end(); it++ )
-                       std::cout << (*it).first << " ";
-               std::cout << std::endl;
 
+//EED Debuging message
+     std::cout << "EED Factory::LoadPackage " <<  std::endl;
+//             PackageMapType::iterator it;
+//             for ( it=mPackageMap.begin() ; it != mPackageMap.end(); it++ )
+//                     std::cout << (*it).first << " ";
+//             std::cout << std::endl;
+
+               
                if (iUnload != mPackageMap.end())
                {
                  bbtkMessage("output",2,"["<< pkgname <<"] already loaded" << std::endl);
@@ -197,9 +193,6 @@ std::cout << "EED Factory::LoadPackage PackageMap ";
        // *all* the cases. JP
        //==================================================
 
-               printf("\nEED Factory::LoadPackage B. %s\n\n", name.c_str());
-       //std::cout << "upath [" << name << "]" << std::endl;
-
                bool ok = false;
                bool foundFile = false;
 
index 99a751447ae18c3cf0be902e357fd4a7dab8c8a3..5a3fd71a46c1c9e8edbc5a2b4d999ff0fa7176a1 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.cxx,v $
   Language:  C++
-  Date:      $Date: 2012/05/30 17:17:00 $
-  Version:   $Revision: 1.92 $
+  Date:      $Date: 2012/10/16 06:31:04 $
+  Version:   $Revision: 1.93 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -498,7 +498,6 @@ namespace bbtk
        
        void Interpreter::commandLoad(const std::string &packageName) //virtual
     {
-               printf("EED Interpreter::commandLoad %s\n", packageName.c_str());
                GetExecuter()->LoadPackage(packageName);
     }
 
index e3ce34b0450383baa9e671cdb6db17e4c7f563a8..35a87464b311639d28bd23b655cc26870cc58d2c 100644 (file)
@@ -1270,7 +1270,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 +1374,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)
              {