]> Creatis software - bbtk.git/blobdiff - kernel/appli/bbpConfigurator/bbpConfigurator.cpp
#3082 BBTK Bug New Normal - not compiling in CentOS 2.6
[bbtk.git] / kernel / appli / bbpConfigurator / bbpConfigurator.cpp
index fdabc26ed99cb56165e7c89f98c9e556baabac82..381ae326cc84917293574b9a41556181f9421359 100644 (file)
@@ -106,15 +106,46 @@ int main(int argc, char **argv)
   BoxesVector boxs;
 
 
-  for (int i = 0; i < (int)files.size(); ++i) {
+  for (int i = 0; i < (int)files.size(); ++i) 
+  {
     bbtk::BBPInterpreter::Pointer I = bbtk::BBPInterpreter::New();
     I->InterpretFile(files[i].string());
+
+
     boxs.push_back( ((bbtk::BBPInterpreter*)(I.get()))->boxName );
-    deps.push_back( ((bbtk::BBPInterpreter*)(I.get()))->dependencies );
 
-    //print box name and dependencies
+// EED 2016/02/19
+//    deps.push_back( ((bbtk::BBPInterpreter*)(I.get()))->dependencies );
+ //-->  Cleanning string package:boxname -> boxname
+    std::set<std::string> tmpDependencies1=  ((bbtk::BBPInterpreter*)(I.get()))->dependencies  ;
+    std::set<std::string> tmpDependencies2;
+    std::set<std::string>::const_iterator sit(tmpDependencies1.begin()), send(tmpDependencies1.end()); 
+       int pos;
+       std::string tmpStr;
+//    std::cout << ((bbtk::BBPInterpreter*)(I.get()))->boxName << ": ";
+    for(;sit!=send;++sit)
+    { 
+               pos=(*sit).find(":");   
+               if (pos== std::string::npos ) 
+               { 
+                       tmpDependencies2.insert( *sit );
+//                     std::cout << *sit << ' ';
+               } else {
+                       tmpStr=(*sit).substr(pos+1);
+                       tmpDependencies2.insert( tmpStr );
+//                     std::cout << tmpStr << ' ';
+               } // if
+
+    } // for
+//    std::cout << std::endl;
+    deps.push_back( tmpDependencies2 );
+ //<--
+
+
+
+//    //print box name and dependencies  OLD VERSION
 //    std::cout << ((bbtk::BBPInterpreter*)(I.get()))->boxName << ": ";
-//    for(
+//   for(
 //      Dependencies::iterator it = ((bbtk::BBPInterpreter*)(I.get()))->dependencies.begin();
 //      it != ((bbtk::BBPInterpreter*)(I.get()))->dependencies.end();
 //      it++) {
@@ -122,22 +153,21 @@ int main(int argc, char **argv)
 //    }
 //    std::cout << std::endl;
 
-  }
+  } // for i
 
   // Only keep dependencies from package
   Dependencies boxNamesSet(boxs.begin(), boxs.end());
 
-  //std::cout << "after: " << std::endl;
-  for (DependenciesVector::iterator it = deps.begin(); it != deps.end(); it++) {
+//std::cout << "after: " << std::endl;
+  for (DependenciesVector::iterator it = deps.begin(); it != deps.end(); it++) 
+  {
     BoxesVector tmp;
     std::set_intersection(it->begin(), it->end(), boxNamesSet.begin(), boxNamesSet.end(),std::back_inserter(tmp));
     Dependencies tmp1(tmp.begin(),tmp.end());
     it->swap( tmp1 );
-    //print clean dependencies
-//    for(
-//      Dependencies::iterator it1 = it->begin();
-//      it1 != it->end();
-//      it1++) {
+//    //print clean dependencies
+//    for( Dependencies::iterator it1 = it->begin();  it1 != it->end(); it1++) 
+//    {
 //      std::cout << *it1 << ", ";
 //    }
 //    std::cout << std::endl;
@@ -210,7 +240,9 @@ int main(int argc, char **argv)
     // find max priority level
     int mx_priority = 0;
     for (int i = 0; i < (int)priorities.size(); i++)
+    {
       mx_priority = std::max(mx_priority, priorities[i]);
+    }
 
     // for each priority level print scripts in that level.
     for (int i = 0; i <= mx_priority; i++)
@@ -219,7 +251,13 @@ int main(int argc, char **argv)
       {
         if(priorities[j] == i)
         {
+//EED 2017-03-28
+#if BOOST_MAJOR_VERSION <= 1 || BOOST_MINOR_VERSION <=41 
+          out << "include " << package_name << "/boxes/" << files[j].filename() << std::endl;
+#else
           out << "include " << package_name << "/boxes/" << files[j].filename().string() << std::endl;
+#endif
+
           out << "#-----------------------------------------" << std::endl;
         }
       }
@@ -307,11 +345,17 @@ std::vector<bf::path> getFileList(const std::string& path)
   if(bf::exists(pth) && bf::is_directory(pth))
   {
     bf::directory_iterator end_itr;
-    for(bf::directory_iterator itr(pth); itr != end_itr; ++itr)
+    bf::directory_iterator itr(pth);
+    for(itr; itr != end_itr; ++itr)
     {
       if(!is_directory(itr->status()))
       {
+//EED 2017-03-28
+#if BOOST_MAJOR_VERSION <= 1 || BOOST_MINOR_VERSION <=41 
+        std::string nm(itr->path().filename());
+#else
         std::string nm(itr->path().filename().string());
+#endif
         if(nm.substr(nm.size()-4) == ".bbs")
         {
           //std::cout << itr->path().filename().string() << std::endl;
@@ -329,7 +373,14 @@ std::vector<bf::path> getFileList(const std::string& path)
   // Order files by name
   for (int i = 0; i < (int)files.size()-1; ++i) {
     for (int j = i+1; j < (int)files.size(); ++j) {
+
+//EED 2017-03-28
+#if BOOST_MAJOR_VERSION <= 1 || BOOST_MINOR_VERSION <=41 
+      if(files[j].filename() < files[i].filename())
+#else
       if(files[j].filename().string() < files[i].filename().string())
+#endif
+
       {
         bf::path tmp = files[i];
         files[i] = files[j];