Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62738 - trunk/tools/bcp
From: john_at_[hidden]
Date: 2010-06-10 10:59:33


Author: johnmaddock
Date: 2010-06-10 10:59:32 EDT (Thu, 10 Jun 2010)
New Revision: 62738
URL: http://svn.boost.org/trac/boost/changeset/62738

Log:
Fix namespace renaming so that it works with current Trunk.
Text files modified:
   trunk/tools/bcp/add_path.cpp | 7 ++--
   trunk/tools/bcp/copy_path.cpp | 55 ++++++++++++++++++++++++++++++++-------
   2 files changed, 49 insertions(+), 13 deletions(-)

Modified: trunk/tools/bcp/add_path.cpp
==============================================================================
--- trunk/tools/bcp/add_path.cpp (original)
+++ trunk/tools/bcp/add_path.cpp 2010-06-10 10:59:32 EDT (Thu, 10 Jun 2010)
@@ -71,10 +71,11 @@
       std::string s(i->string());
       if(m_boost_path.string().size())
          s.erase(0, m_boost_path.string().size() + 1);
- if(!m_dependencies.count(fs::path(s)))
+ fs::path np = s;
+ if(!m_dependencies.count(np))
       {
- m_dependencies[fs::path(s)] = p; // set up dependency tree
- add_path(fs::path(s));
+ m_dependencies[np] = p; // set up dependency tree
+ add_path(np);
       }
       ++i;
    }

Modified: trunk/tools/bcp/copy_path.cpp
==============================================================================
--- trunk/tools/bcp/copy_path.cpp (original)
+++ trunk/tools/bcp/copy_path.cpp 2010-06-10 10:59:32 EDT (Thu, 10 Jun 2010)
@@ -58,7 +58,33 @@
    //
    // do text based copy if requested:
    //
- if(m_namespace_name.size() && m_lib_names.size() && is_jam_file(p))
+ if(p.leaf() == "Jamroot")
+ {
+ static std::vector<char> v1, v2;
+ v1.clear();
+ v2.clear();
+ std::ifstream is((m_boost_path / p).native_file_string().c_str());
+ std::copy(std::istreambuf_iterator<char>(is), std::istreambuf_iterator<char>(), std::back_inserter(v1));
+
+ static boost::regex libname_matcher;
+ if(libname_matcher.empty())
+ {
+ libname_matcher.assign("boost_");
+ }
+
+ regex_replace(std::back_inserter(v2), v1.begin(), v1.end(), libname_matcher, m_namespace_name + "_");
+ std::swap(v1, v2);
+ v2.clear();
+
+ std::ofstream os;
+ if(m_unix_lines)
+ os.open((m_dest_path / p).native_file_string().c_str(), std::ios_base::binary | std::ios_base::out);
+ else
+ os.open((m_dest_path / p).native_file_string().c_str(), std::ios_base::out);
+ os.write(&*v1.begin(), v1.size());
+ os.close();
+ }
+ else if(m_namespace_name.size() && m_lib_names.size() && is_jam_file(p))
    {
       static std::vector<char> v1, v2;
       v1.clear();
@@ -106,25 +132,33 @@
 
       static const boost::regex namespace_matcher(
          "(?|"
- "(namespace\\s+)boost(_\\w+)?"
+ "(namespace\\s+)boost(_\\w+)?(?:(\\s*::\\s*)phoenix)?"
          "|"
             "(namespace\\s+)(adstl|phoenix|rapidxml)\\>"
          "|"
- "()boost((?:_\\w+)?\\s*(?:::|,|\\)))"
+ "()\\<boost((?:_(?!intrusive_tags)\\w+)?\\s*(?:::))(?:(\\s*)phoenix)?"
          "|"
- "()((?:adstl|phoenix|rapidxml)\\s*(?:::|,|\\)))"
+ "()\\<((?:adstl|phoenix|rapidxml)\\s*(?:::))"
          "|"
- "(namespace\\s+\\w+\\s*=\\s*(?:::\\s*)?)boost(_\\w+)?"
+ "(namespace\\s+\\w+\\s*=\\s*(?:::\\s*)?)boost(_\\w+)?(?:(\\s*::\\s*)phoenix)?"
          "|"
- "(namespace\\s+\\w+\\s*=\\s*(?:::\\s*)?)(adstl|phoenix|rapidxml)\\>"
+ "(namespace\\s+\\w+\\s*=\\s*(?:::\\s*)?(?:\\w+\\s*::\\s*)?)(adstl|phoenix|rapidxml)\\>"
          "|"
- "(^\\s*#\\s*define[^\\n]+)boost((?:_\\w+)?\\s*)$"
+ "(^\\s*#\\s*define\\s+\\w+\\s+)boost((?:_\\w+)?\\s*)$"
          "|"
             "(^\\s*#\\s*define[^\\n]+)((?:adstl|phoenix|rapidxml)\\s*)$"
+ "|"
+ "()boost(_asio_detail_posix_thread_function|_regex_free_static_mutex)"
+ "|"
+ "()(lw_thread_routine|at_thread_exit|on_process_enter|on_process_exit|on_thread_enter|on_thread_exit|tss_cleanup_implemented)"
+ "|"
+ "(BOOST_CLASS_REQUIRE4?[^;]*)boost((?:_\\w+)?\\s*,)"
+ "|"
+ "(\\(\\s*)boost(\\s*\\))"
          ")"
- );
+ );
 
- regex_replace(std::back_inserter(v2), v1.begin(), v1.end(), namespace_matcher, "$1" + m_namespace_name + "$2");
+ regex_replace(std::back_inserter(v2), v1.begin(), v1.end(), namespace_matcher, "$1" + m_namespace_name + "$2(?3$3" + m_namespace_name + "phoenix)", boost::regex_constants::format_all);
       std::swap(v1, v2);
       v2.clear();
 
@@ -171,7 +205,8 @@
          os.open((m_dest_path / p).native_file_string().c_str(), std::ios_base::binary | std::ios_base::out);
       else
          os.open((m_dest_path / p).native_file_string().c_str(), std::ios_base::out);
- os.write(&*v1.begin(), v1.size());
+ if(v1.size())
+ os.write(&*v1.begin(), v1.size());
       os.close();
    }
    else if(m_unix_lines && !is_binary_file(p))


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk