|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r51679 - in trunk: boost/wave/util libs/wave libs/wave/build libs/wave/src/cpplexer/re2clex libs/wave/test/build libs/wave/test/testwave libs/wave/test/testwave/testfiles tools/wave
From: hartmut.kaiser_at_[hidden]
Date: 2009-03-09 21:35:55
Author: hkaiser
Date: 2009-03-09 21:35:54 EDT (Mon, 09 Mar 2009)
New Revision: 51679
URL: http://svn.boost.org/trac/boost/changeset/51679
Log:
Wave: now compiles even with BOOST_FILESYSTEM_NO_DEPRECATED defined
Added:
trunk/boost/wave/util/filesystem_compatibility.hpp (contents, props changed)
Text files modified:
trunk/boost/wave/util/cpp_include_paths.hpp | 45 ++++++++++----------
trunk/boost/wave/util/cpp_iterator.hpp | 19 +++++---
trunk/boost/wave/util/cpp_macromap.hpp | 13 +++--
trunk/libs/wave/ChangeLog | 7 ++
trunk/libs/wave/build/Jamfile.v2 | 2
trunk/libs/wave/src/cpplexer/re2clex/cpp.re | 2
trunk/libs/wave/src/cpplexer/re2clex/strict_cpp.re | 2
trunk/libs/wave/test/build/Jamfile.v2 | 2
trunk/libs/wave/test/testwave/testfiles/test.cfg | 2
trunk/libs/wave/test/testwave/testwave.cpp | 28 +++++++-----
trunk/libs/wave/test/testwave/testwave_app.cpp | 24 +++++-----
trunk/tools/wave/cpp.cpp | 88 +++++++++++++++++++++------------------
trunk/tools/wave/cpp_version.hpp | 4
trunk/tools/wave/trace_macro_expansion.hpp | 10 ++--
14 files changed, 137 insertions(+), 111 deletions(-)
Modified: trunk/boost/wave/util/cpp_include_paths.hpp
==============================================================================
--- trunk/boost/wave/util/cpp_include_paths.hpp (original)
+++ trunk/boost/wave/util/cpp_include_paths.hpp 2009-03-09 21:35:54 EDT (Mon, 09 Mar 2009)
@@ -16,6 +16,7 @@
#include <utility>
#include <boost/wave/wave_config.hpp>
+#include <boost/wave/util/filesystem_compatibility.hpp>
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
#include <boost/multi_index_container.hpp>
@@ -148,8 +149,8 @@
public:
include_paths()
: was_sys_include_path(false),
- current_dir(boost::filesystem::initial_path()),
- current_rel_dir(boost::filesystem::initial_path())
+ current_dir(initial_path()),
+ current_rel_dir(initial_path())
{}
bool add_include_path(char const *path_, bool is_system = false)
@@ -271,7 +272,7 @@
{
namespace fs = boost::filesystem;
if (path_) {
- fs::path newpath = fs::complete(fs::path(path_, fs::native), current_dir);
+ fs::path newpath = fs::complete(create_path(path_), current_dir);
if (!fs::exists(newpath) || !fs::is_directory(newpath)) {
// the given path does not form a name of a valid file system directory
@@ -307,9 +308,9 @@
// with the directory in the search path after the one where the current
// file was found.
- fs::path file_path (current_file, fs::native);
+ fs::path file_path (create_path(current_file));
for (/**/; it != include_paths_end; ++it) {
- fs::path currpath ((*it).first.string(), fs::native);
+ fs::path currpath (create_path((*it).first.string()));
if (std::equal(currpath.begin(), currpath.end(), file_path.begin()))
{
++it; // start searching with the next directory
@@ -320,21 +321,21 @@
#endif
for (/**/; it != include_paths_end; ++it) {
- fs::path currpath (s, fs::native);
+ fs::path currpath (create_path(s));
if (!currpath.has_root_directory()) {
- currpath = fs::path((*it).first.string(), fs::native);
- currpath /= fs::path(s, fs::native); // append filename
+ currpath = create_path((*it).first.string());
+ currpath /= create_path(s); // append filename
}
if (fs::exists(currpath)) {
- fs::path dirpath (s, fs::native);
+ fs::path dirpath (create_path(s));
if (!dirpath.has_root_directory()) {
- dirpath = fs::path((*it).second, fs::native);
- dirpath /= fs::path(s, fs::native);
+ dirpath = create_path((*it).second);
+ dirpath /= create_path(s);
}
dir = dirpath.string();
- s = currpath.normalize().string(); // found the required file
+ s = normalize(currpath).string(); // found the required file
return true;
}
}
@@ -354,23 +355,23 @@
if (!is_system) {
if (!was_sys_include_path) { // set_sys_include_delimiter() not called
// first have a look at the current directory
- fs::path currpath (s, fs::native);
+ fs::path currpath (create_path(s));
if (!currpath.has_root_directory()) {
- currpath = fs::path(current_dir.string(), fs::native);
- currpath /= fs::path(s, fs::native);
+ currpath = create_path(current_dir.string());
+ currpath /= create_path(s);
}
if (fs::exists(currpath) && 0 == current_file) {
// if 0 != current_path (#include_next handling) it can't be
// the file in the current directory
- fs::path dirpath (s, fs::native);
+ fs::path dirpath (create_path(s));
if (!dirpath.has_root_directory()) {
- dirpath = fs::path(current_rel_dir.string(), fs::native);
- dirpath /= fs::path(s, fs::native);
+ dirpath = create_path(current_rel_dir.string());
+ dirpath /= create_path(s);
}
dir = dirpath.string();
- s = currpath.normalize().string(); // found in local directory
+ s = normalize(currpath).string(); // found in local directory
return true;
}
@@ -402,15 +403,15 @@
{
namespace fs = boost::filesystem;
- fs::path filepath (path_, fs::native);
+ fs::path filepath (create_path(path_));
fs::path filename = fs::complete(filepath, current_dir);
if (fs::exists(filename) && fs::is_directory(filename)) {
current_dir = filename;
current_rel_dir = filepath;
}
else {
- current_dir = filename.branch_path();
- current_rel_dir = filepath.branch_path();
+ current_dir = branch_path(filename);
+ current_rel_dir = branch_path(filepath);
}
}
Modified: trunk/boost/wave/util/cpp_iterator.hpp
==============================================================================
--- trunk/boost/wave/util/cpp_iterator.hpp (original)
+++ trunk/boost/wave/util/cpp_iterator.hpp 2009-03-09 21:35:54 EDT (Mon, 09 Mar 2009)
@@ -35,6 +35,7 @@
#include <boost/wave/util/interpret_pragma.hpp>
#include <boost/wave/util/transform_iterator.hpp>
#include <boost/wave/util/functor_input.hpp>
+#include <boost/wave/util/filesystem_compatibility.hpp>
#include <boost/wave/grammars/cpp_grammar_gen.hpp>
#include <boost/wave/grammars/cpp_expression_grammar_gen.hpp>
@@ -755,11 +756,11 @@
// unput the complete #line directive in reverse order
std::string file("\"");
- boost::filesystem::path filename(act_pos.get_file().c_str(),
- boost::filesystem::native);
+ boost::filesystem::path filename(
+ wave::util::create_path(act_pos.get_file().c_str()));
- using boost::wave::util::impl::escape_lit;
- file += escape_lit(filename.native_file_string()) + "\"";
+ using wave::util::impl::escape_lit;
+ file += escape_lit(wave::util::native_file_string(filename)) + "\"";
// 21 is the max required size for a 64 bit integer represented as a
// string
@@ -1513,7 +1514,7 @@
return false;
}
-fs::path native_path(file_path, fs::native);
+fs::path native_path(wave::util::create_path(file_path));
if (!fs::exists(native_path)) {
BOOST_WAVE_THROW_CTX(ctx, preprocess_exception, bad_include_file,
@@ -1523,15 +1524,17 @@
// test, if this file is known through a #pragma once directive
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
- if (!ctx.has_pragma_once(native_path.native_file_string()))
+ if (!ctx.has_pragma_once(wave::util::native_file_string(native_path)))
#endif
{
// the new include file determines the actual current directory
- ctx.set_current_directory(native_path.native_file_string().c_str());
+ ctx.set_current_directory(
+ wave::util::native_file_string(native_path).c_str());
// preprocess the opened file
boost::shared_ptr<base_iteration_context_type> new_iter_ctx (
- new iteration_context_type(ctx, native_path.native_file_string().c_str(),
+ new iteration_context_type(ctx,
+ wave::util::native_file_string(native_path).c_str(),
act_pos, boost::wave::enable_prefer_pp_numbers(ctx.get_language())));
// call the include policy trace function
Modified: trunk/boost/wave/util/cpp_macromap.hpp
==============================================================================
--- trunk/boost/wave/util/cpp_macromap.hpp (original)
+++ trunk/boost/wave/util/cpp_macromap.hpp 2009-03-09 21:35:54 EDT (Mon, 09 Mar 2009)
@@ -40,6 +40,7 @@
#include <boost/wave/util/symbol_table.hpp>
#include <boost/wave/util/cpp_macromap_utils.hpp>
#include <boost/wave/util/cpp_macromap_predef.hpp>
+#include <boost/wave/util/filesystem_compatibility.hpp>
#include <boost/wave/grammars/cpp_defined_grammar_gen.hpp>
#include <boost/wave/wave_version.hpp>
@@ -1414,10 +1415,10 @@
namespace fs = boost::filesystem;
std::string file("\"");
- fs::path filename(main_pos.get_file().c_str(), fs::native);
+ fs::path filename(wave::util::create_path(main_pos.get_file().c_str()));
using boost::wave::util::impl::escape_lit;
- file += escape_lit(filename.native_file_string()) + "\"";
+ file += escape_lit(wave::util::native_file_string(filename)) + "\"";
expanded.push_back(token_type(T_STRINGLIT, file.c_str(),
curr_token.get_position()));
return true;
@@ -1846,21 +1847,21 @@
// predefine the __BASE_FILE__ macro which contains the main file name
namespace fs = boost::filesystem;
if (string_type(fname) != "<Unknown>") {
- fs::path filename(fname, fs::native);
+ fs::path filename(create_path(fname));
using boost::wave::util::impl::escape_lit;
predefine_macro(current_scope, "__BASE_FILE__",
token_type(T_STRINGLIT, string_type("\"") +
- escape_lit(filename.native_file_string()).c_str() + "\"", pos));
+ escape_lit(native_file_string(filename)).c_str() + "\"", pos));
base_name = fname;
}
else if (!base_name.empty()) {
- fs::path filename(base_name.c_str(), fs::native);
+ fs::path filename(create_path(base_name.c_str()));
using boost::wave::util::impl::escape_lit;
predefine_macro(current_scope, "__BASE_FILE__",
token_type(T_STRINGLIT, string_type("\"") +
- escape_lit(filename.native_file_string()).c_str() + "\"", pos));
+ escape_lit(native_file_string(filename)).c_str() + "\"", pos));
}
// now add the dynamic macros
Added: trunk/boost/wave/util/filesystem_compatibility.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/wave/util/filesystem_compatibility.hpp 2009-03-09 21:35:54 EDT (Mon, 09 Mar 2009)
@@ -0,0 +1,103 @@
+/*=============================================================================
+ Boost.Wave: A Standard compliant C++ preprocessor library
+
+ http://www.boost.org/
+
+ Copyright (c) 2001-2009 Hartmut Kaiser. Distributed under the Boost
+ Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+#if !defined(BOOST_WAVE_FILESYSTEM_COMPATIBILITY_MAR_09_2009_0142PM)
+#define BOOST_WAVE_FILESYSTEM_COMPATIBILITY_MAR_09_2009_0142PM
+
+#include <string>
+
+#include <boost/filesystem/path.hpp>
+#include <boost/filesystem/operations.hpp>
+
+namespace boost { namespace wave { namespace util
+{
+///////////////////////////////////////////////////////////////////////////////
+// filesystem wrappers allowing to handle different Boost versions
+#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
+// interface wrappers for older Boost versions
+ inline boost::filesystem::path initial_path()
+ {
+ return boost::filesystem::initial_path();
+ }
+
+ inline boost::filesystem::path current_path()
+ {
+ return boost::filesystem::current_path();
+ }
+
+ template <typename String>
+ inline boost::filesystem::path create_path(String const& p)
+ {
+ return boost::filesystem::path(p, boost::filesystem::native);
+ }
+
+ inline std::string leaf(boost::filesystem::path const& p)
+ {
+ return p.leaf();
+ }
+
+ inline boost::filesystem::path branch_path(boost::filesystem::path const& p)
+ {
+ return p.branch_path();
+ }
+
+ inline boost::filesystem::path normalize(boost::filesystem::path& p)
+ {
+ return p.normalize();
+ }
+
+ inline std::string native_file_string(boost::filesystem::path const& p)
+ {
+ return p.native_file_string();
+ }
+
+#else
+// interface wrappers if deprecated functions do not exist
+ inline boost::filesystem::path initial_path()
+ {
+ return boost::filesystem::initial_path<boost::filesystem::path>();
+ }
+
+ inline boost::filesystem::path current_path()
+ {
+ return boost::filesystem::current_path<boost::filesystem::path>();
+ }
+
+ template <typename String>
+ inline boost::filesystem::path create_path(String const& p)
+ {
+ return boost::filesystem::path(p);
+ }
+
+ inline std::string leaf(boost::filesystem::path const& p)
+ {
+ return p.filename();
+ }
+
+ inline boost::filesystem::path branch_path(boost::filesystem::path const& p)
+ {
+ return p.parent_path();
+ }
+
+ inline boost::filesystem::path normalize(boost::filesystem::path& p)
+ {
+ return p; // function doesn't exist anymore
+ }
+
+ inline std::string native_file_string(boost::filesystem::path const& p)
+ {
+ return p.file_string();
+ }
+
+#endif
+
+}}}
+
+#endif
Modified: trunk/libs/wave/ChangeLog
==============================================================================
--- trunk/libs/wave/ChangeLog (original)
+++ trunk/libs/wave/ChangeLog 2009-03-09 21:35:54 EDT (Mon, 09 Mar 2009)
@@ -1,7 +1,7 @@
Boost.Wave: A Standard compliant C++ preprocessor library
http://www.boost.org/
-Copyright (c) 2001-2008 Hartmut Kaiser. Distributed under the Boost
+Copyright (c) 2001-2009 Hartmut Kaiser. Distributed under the Boost
Software License, Version 1.0. (See accompanying file
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-------------------------------------------------------------------------------
@@ -22,6 +22,11 @@
CHANGELOG
+Boost V1.39.0
+- V2.0.1
+- Fixed Wave to compile with BOOST_FILESYSTEM_NO_DEPRECATED defined (i.e. the
+ library doesn't use the depracated filesystem interface anymore).
+
Boost V1.37.0
- Updated examples to reflect the recent changes in the used multi_pass
iterator.
Modified: trunk/libs/wave/build/Jamfile.v2
==============================================================================
--- trunk/libs/wave/build/Jamfile.v2 (original)
+++ trunk/libs/wave/build/Jamfile.v2 2009-03-09 21:35:54 EDT (Mon, 09 Mar 2009)
@@ -4,7 +4,7 @@
#
# http://www.boost.org/
#
-# Copyright (c) 2001-2008 Hartmut Kaiser. Distributed under the Boost
+# Copyright (c) 2001-2009 Hartmut Kaiser. Distributed under the Boost
# Software License, Version 1.0. (See accompanying file
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Modified: trunk/libs/wave/src/cpplexer/re2clex/cpp.re
==============================================================================
--- trunk/libs/wave/src/cpplexer/re2clex/cpp.re (original)
+++ trunk/libs/wave/src/cpplexer/re2clex/cpp.re 2009-03-09 21:35:54 EDT (Mon, 09 Mar 2009)
@@ -2,7 +2,7 @@
Boost.Wave: A Standard compliant C++ preprocessor library
Copyright (c) 2001 Daniel C. Nuffer
- Copyright (c) 2001-2008 Hartmut Kaiser.
+ Copyright (c) 2001-2009 Hartmut Kaiser.
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Modified: trunk/libs/wave/src/cpplexer/re2clex/strict_cpp.re
==============================================================================
--- trunk/libs/wave/src/cpplexer/re2clex/strict_cpp.re (original)
+++ trunk/libs/wave/src/cpplexer/re2clex/strict_cpp.re 2009-03-09 21:35:54 EDT (Mon, 09 Mar 2009)
@@ -2,7 +2,7 @@
Boost.Wave: A Standard compliant C++ preprocessor library
Copyright (c) 2001 Daniel C. Nuffer
- Copyright (c) 2001-2008 Hartmut Kaiser.
+ Copyright (c) 2001-2009 Hartmut Kaiser.
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Modified: trunk/libs/wave/test/build/Jamfile.v2
==============================================================================
--- trunk/libs/wave/test/build/Jamfile.v2 (original)
+++ trunk/libs/wave/test/build/Jamfile.v2 2009-03-09 21:35:54 EDT (Mon, 09 Mar 2009)
@@ -4,7 +4,7 @@
#
# http://www.boost.org/
#
-# Copyright (c) 2001-2008 Hartmut Kaiser. Distributed under the Boost
+# Copyright (c) 2001-2009 Hartmut Kaiser. Distributed under the Boost
# Software License, Version 1.0. (See accompanying file
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Modified: trunk/libs/wave/test/testwave/testfiles/test.cfg
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/test.cfg (original)
+++ trunk/libs/wave/test/testwave/testfiles/test.cfg 2009-03-09 21:35:54 EDT (Mon, 09 Mar 2009)
@@ -2,7 +2,7 @@
# Boost.Wave: A Standard compliant C++ preprocessor library
# http://www.boost.org/
#
-# Copyright (c) 2003-2008 Hartmut Kaiser. Distributed under the Boost
+# Copyright (c) 2003-2009 Hartmut Kaiser. Distributed under the Boost
# Software License, Version 1.0. (See accompanying file
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
Modified: trunk/libs/wave/test/testwave/testwave.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testwave.cpp (original)
+++ trunk/libs/wave/test/testwave/testwave.cpp 2009-03-09 21:35:54 EDT (Mon, 09 Mar 2009)
@@ -14,6 +14,7 @@
// include boost
#include <boost/config.hpp>
+#include <boost/wave.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
@@ -178,29 +179,33 @@
{
// correct the file name (pre-pend the config file path)
fs::path cfgpath = fs::complete(
- fs::path(*cit, fs::native), fs::current_path());
+ boost::wave::util::create_path(*cit),
+ boost::wave::util::current_path());
fs::path filepath =
- cfgpath.branch_path() / fs::path(*iit, fs::native);
+ boost::wave::util::branch_path(cfgpath) /
+ boost::wave::util::create_path(*iit);
if (9 == app.get_debuglevel()) {
std::cerr << std::string(79, '-') << std::endl;
std::cerr << "executing test: "
- << filepath.native_file_string()
+ << boost::wave::util::native_file_string(filepath)
<< std::endl;
}
// execute this unit test case
- if (!app.test_a_file(filepath.native_file_string())) {
+ if (!app.test_a_file(
+ boost::wave::util::native_file_string(filepath)))
+ {
if (9 == app.get_debuglevel()) {
std::cerr << "failed to execute test: "
- << filepath.native_file_string()
+ << boost::wave::util::native_file_string(filepath)
<< std::endl;
}
++error_count;
}
else if (9 == app.get_debuglevel()) {
std::cerr << "succeeded to execute test: "
- << filepath.native_file_string()
+ << boost::wave::util::native_file_string(filepath)
<< std::endl;
}
++input_count;
@@ -231,26 +236,27 @@
for (std::vector<po::option>::const_iterator arg = arguments.begin();
arg != arg_end; ++arg)
{
- fs::path filepath((*arg).value[0], fs::native);
+ fs::path filepath(boost::wave::util::create_path((*arg).value[0]));
if (9 == app.get_debuglevel()) {
std::cerr << std::string(79, '-') << std::endl;
std::cerr << "executing test: "
- << filepath.native_file_string()
+ << boost::wave::util::native_file_string(filepath)
<< std::endl;
}
- if (!app.test_a_file(filepath.native_file_string())) {
+ if (!app.test_a_file(boost::wave::util::native_file_string(filepath)))
+ {
if (9 == app.get_debuglevel()) {
std::cerr << "failed to execute test: "
- << filepath.native_file_string()
+ << boost::wave::util::native_file_string(filepath)
<< std::endl;
}
++error_count;
}
else if (9 == app.get_debuglevel()) {
std::cerr << "succeeded to execute test: "
- << filepath.native_file_string()
+ << boost::wave::util::native_file_string(filepath)
<< std::endl;
}
Modified: trunk/libs/wave/test/testwave/testwave_app.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testwave_app.cpp (original)
+++ trunk/libs/wave/test/testwave/testwave_app.cpp 2009-03-09 21:35:54 EDT (Mon, 09 Mar 2009)
@@ -66,9 +66,9 @@
using boost::wave::util::impl::unescape_lit;
String unesc_name = unescape_lit(name.substr(1, name.size()-2));
- fs::path p (unesc_name.c_str(), fs::native);
+ fs::path p (boost::wave::util::create_path(unesc_name.c_str()));
- name = String("\"") + p.leaf().c_str() + String("\"");
+ name = String("\"") + boost::wave::util::leaf(p).c_str() + String("\"");
return name;
}
@@ -180,7 +180,8 @@
{
fs::path fullpath (
fs::complete(
- fs::path(filename, fs::native), fs::current_path())
+ boost::wave::util::create_path(filename),
+ boost::wave::util::current_path())
);
if ('(' == expected[pos1+2]) {
@@ -193,16 +194,17 @@
return false;
}
std::string base = expected.substr(pos1+3, p-pos1-3);
- fullpath = fullpath.branch_path() /
- fs::path(base, fs::native);
+ fullpath = boost::wave::util::branch_path(fullpath) /
+ boost::wave::util::create_path(base);
full_result += expected.substr(pos, pos1-pos);
if ('P' == expected[pos1+1]) {
- full_result +=
- escape_lit(fullpath.normalize().native_file_string());
+ full_result += escape_lit(
+ boost::wave::util::native_file_string(
+ boost::wave::util::normalize(fullpath)));
}
else {
- full_result +=
- escape_lit(fullpath.normalize().string());
+ full_result += escape_lit(
+ boost::wave::util::normalize(fullpath).string());
}
pos1 = expected.find_first_of ("$",
pos = pos1 + 4 + base.size());
@@ -211,8 +213,8 @@
// the $P is used on its own
full_result += expected.substr(pos, pos1-pos);
if ('P' == expected[pos1+1]) {
- full_result +=
- escape_lit(fullpath.native_file_string());
+ full_result += escape_lit(
+ boost::wave::util::native_file_string(fullpath));
}
else {
full_result +=
Modified: trunk/tools/wave/cpp.cpp
==============================================================================
--- trunk/tools/wave/cpp.cpp (original)
+++ trunk/tools/wave/cpp.cpp 2009-03-09 21:35:54 EDT (Mon, 09 Mar 2009)
@@ -78,7 +78,6 @@
// Import required names
using namespace boost::spirit::classic;
-using std::string;
using std::pair;
using std::vector;
using std::getline;
@@ -113,11 +112,11 @@
///////////////////////////////////////////////////////////////////////////////
// print the current version
-string get_version()
+std::string get_version()
{
- string version (context_type::get_version_string());
+ std::string version (context_type::get_version_string());
version = version.substr(1, version.size()-2); // strip quotes
- version += string(" (" CPP_VERSION_DATE_STR ")"); // add date
+ version += std::string(" (" CPP_VERSION_DATE_STR ")"); // add date
return version;
}
@@ -139,7 +138,7 @@
"Wave: A Standard conformant C++ preprocessor based on the Boost.Wave library",
"http://www.boost.org/",
"",
- "Copyright (c) 2001-2008 Hartmut Kaiser, Distributed under the Boost",
+ "Copyright (c) 2001-2009 Hartmut Kaiser, Distributed under the Boost",
"Software License, Version 1.0. (See accompanying file",
"LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)",
0
@@ -176,13 +175,13 @@
// Additional command line parser which interprets '@something' as an
// option "config-file" with the value "something".
- inline pair<string, string>
- at_option_parser(string const&s)
+ inline pair<std::string, std::string>
+ at_option_parser(std::string const&s)
{
if ('@' == s[0])
- return std::make_pair(string("config-file"), s.substr(1));
+ return std::make_pair(std::string("config-file"), s.substr(1));
else
- return pair<string, string>();
+ return pair<std::string, std::string>();
}
// class, which keeps include file information read from the command line
@@ -190,13 +189,13 @@
public:
include_paths() : seen_separator(false) {}
- vector<string> paths; // stores user paths
- vector<string> syspaths; // stores system paths
+ vector<std::string> paths; // stores user paths
+ vector<std::string> syspaths; // stores system paths
bool seen_separator; // command line contains a '-I-' option
// Function which validates additional tokens from command line.
static void
- validate(boost::any &v, vector<string> const &tokens)
+ validate(boost::any &v, vector<std::string> const &tokens)
{
if (v.empty())
v = boost::any(include_paths());
@@ -205,7 +204,7 @@
BOOST_ASSERT(p);
// Assume only one path per '-I' occurrence.
- string const& t = po::validators::get_single_string(tokens);
+ std::string const& t = po::validators::get_single_string(tokens);
if (t == "-") {
// found -I- option, so switch behaviour
p->seen_separator = true;
@@ -223,7 +222,7 @@
// Read all options from a given config file, parse and add them to the
// given variables_map
- bool read_config_file_options(string const &filename,
+ bool read_config_file_options(std::string const &filename,
po::options_description const &desc, po::variables_map &vm,
bool may_fail = false)
{
@@ -238,20 +237,20 @@
return false;
}
- vector<string> options;
- string line;
+ vector<std::string> options;
+ std::string line;
while (std::getline(ifs, line)) {
// skip empty lines
- string::size_type pos = line.find_first_not_of(" \t");
- if (pos == string::npos)
+ std::string::size_type pos = line.find_first_not_of(" \t");
+ if (pos == std::string::npos)
continue;
// skip comment lines
if ('#' != line[pos]) {
// strip leading and trailing whitespace
- string::size_type endpos = line.find_last_not_of(" \t");
- BOOST_ASSERT(endpos != string::npos);
+ std::string::size_type endpos = line.find_last_not_of(" \t");
+ BOOST_ASSERT(endpos != std::string::npos);
options.push_back(line.substr(pos, endpos-pos+1));
}
}
@@ -454,9 +453,10 @@
#if BOOST_WAVE_SERIALIZATION != 0
try {
if (vm.count("state") > 0) {
- fs::path state_file (vm["state"].as<string>(), fs::native);
+ fs::path state_file (
+ boost::wave::util::create_path(vm["state"].as<string>()));
if (state_file == "-")
- state_file = fs::path("wave.state", fs::native);
+ state_file = boost::wave::util::create_path("wave.state");
std::ios::openmode mode = std::ios::in;
@@ -498,9 +498,10 @@
#if BOOST_WAVE_SERIALIZATION != 0
try {
if (vm.count("state") > 0) {
- fs::path state_file (vm["state"].as<string>(), fs::native);
+ fs::path state_file (boost::wave::util::create_path(
+ vm["state"].as<string>()));
if (state_file == "-")
- state_file = fs::path("wave.state", fs::native);
+ state_file = boost::wave::util::create_path("wave.state");
std::ios::openmode mode = std::ios::out;
@@ -535,11 +536,11 @@
{
// open file for macro names listing
std::ofstream macronames_out;
- fs::path macronames_file (filename, fs::native);
+ fs::path macronames_file (boost::wave::util::create_path(filename));
if (macronames_file != "-") {
macronames_file = fs::complete(macronames_file);
- fs::create_directories(macronames_file.branch_path());
+ fs::create_directories(boost::wave::util::branch_path(macronames_file));
macronames_out.open(macronames_file.string().c_str());
if (!macronames_out.is_open()) {
cerr << "wave: could not open file for macro name listing: "
@@ -640,10 +641,11 @@
if (vm.count("traceto")) {
// try to open the file, where to put the trace output
- fs::path trace_file (vm["traceto"].as<string>(), fs::native);
+ fs::path trace_file (boost::wave::util::create_path(
+ vm["traceto"].as<string>()));
if (trace_file != "-") {
- fs::create_directories(trace_file.branch_path());
+ fs::create_directories(boost::wave::util::branch_path(trace_file));
traceout.open(trace_file.string().c_str());
if (!traceout.is_open()) {
cerr << "wave: could not open trace file: " << trace_file
@@ -663,10 +665,11 @@
// Open the stream where to output the list of included file names
if (vm.count("listincludes")) {
// try to open the file, where to put the include list
- fs::path includes_file(vm["listincludes"].as<string>(), fs::native);
+ fs::path includes_file(boost::wave::util::create_path(
+ vm["listincludes"].as<string>()));
if (includes_file != "-") {
- fs::create_directories(includes_file.branch_path());
+ fs::create_directories(boost::wave::util::branch_path(includes_file));
includelistout.open(includes_file.string().c_str());
if (!includelistout.is_open()) {
cerr << "wave: could not open include list file: "
@@ -880,7 +883,8 @@
// open the output file
if (vm.count("output")) {
// try to open the file, where to put the preprocessed output
- fs::path out_file (vm["output"].as<string>(), fs::native);
+ fs::path out_file (boost::wave::util::create_path(
+ vm["output"].as<string>()));
if (out_file == "-") {
allow_output = false; // inhibit output initially
@@ -888,7 +892,7 @@
}
else {
out_file = fs::complete(out_file);
- fs::create_directories(out_file.branch_path());
+ fs::create_directories(boost::wave::util::branch_path(out_file));
output.open(out_file.string().c_str());
if (!output.is_open()) {
cerr << "wave: could not open output file: "
@@ -900,15 +904,15 @@
}
else if (!input_is_stdin && vm.count("autooutput")) {
// generate output in the file <input_base_name>.i
- fs::path out_file (file_name, fs::native);
- std::string basename (out_file.leaf());
+ fs::path out_file (boost::wave::util::create_path(file_name));
+ std::string basename (boost::wave::util::leaf(out_file));
std::string::size_type pos = basename.find_last_of(".");
if (std::string::npos != pos)
basename = basename.substr(0, pos);
- out_file = out_file.branch_path() / (basename + ".i");
+ out_file = boost::wave::util::branch_path(out_file) / (basename + ".i");
- fs::create_directories(out_file.branch_path());
+ fs::create_directories(boost::wave::util::branch_path(out_file));
output.open(out_file.string().c_str());
if (!output.is_open()) {
cerr << "wave: could not open output file: "
@@ -1182,7 +1186,7 @@
// // Try to find a wave.cfg in the same directory as the executable was
// // started from. If this exists, treat it as a wave config file
-// fs::path filename(argv[0], fs::native);
+// fs::path filename(argv[0]);
//
// filename = filename.branch_path() / "wave.cfg";
// cmd_line_utils::read_config_file_options(filename.string(),
@@ -1199,8 +1203,12 @@
// file for all files in a certain project.
if (arguments.size() > 0 && arguments[0].value[0] != "-") {
// construct full path of input file
- fs::path input_dir (fs::complete(fs::path(arguments[0].value[0], fs::native)));
- input_dir = input_dir.normalize().branch_path(); // chop of file name
+ fs::path input_dir (fs::complete(
+ boost::wave::util::create_path(arguments[0].value[0])));
+
+ // chop of file name
+ input_dir = boost::wave::util::branch_path(
+ boost::wave::util::normalize(input_dir));
// walk up the hierarchy, trying to find a file wave.cfg
while (!input_dir.empty()) {
@@ -1210,7 +1218,7 @@
{
break; // break on the first cfg file found
}
- input_dir = input_dir.branch_path();
+ input_dir = boost::wave::util::branch_path(input_dir);
}
}
Modified: trunk/tools/wave/cpp_version.hpp
==============================================================================
--- trunk/tools/wave/cpp_version.hpp (original)
+++ trunk/tools/wave/cpp_version.hpp 2009-03-09 21:35:54 EDT (Mon, 09 Mar 2009)
@@ -19,7 +19,7 @@
#define CPP_VERSION_FULL_STR BOOST_PP_STRINGIZE(CPP_VERSION_FULL)
-#define CPP_VERSION_DATE 20080407L
-#define CPP_VERSION_DATE_STR "20080407"
+#define CPP_VERSION_DATE 20090309L
+#define CPP_VERSION_DATE_STR "20090309"
#endif // !defined(CPP_VERSION_HPP_CE4FE67F_63F9_468D_8364_C855F89D3C5D_INCLUDED)
Modified: trunk/tools/wave/trace_macro_expansion.hpp
==============================================================================
--- trunk/tools/wave/trace_macro_expansion.hpp (original)
+++ trunk/tools/wave/trace_macro_expansion.hpp 2009-03-09 21:35:54 EDT (Mon, 09 Mar 2009)
@@ -26,6 +26,7 @@
#include <boost/wave/token_ids.hpp>
#include <boost/wave/util/macro_helpers.hpp>
+#include <boost/wave/util/filesystem_compatibility.hpp>
#include <boost/wave/preprocessing_hooks.hpp>
#include <boost/wave/whitespace_handling.hpp>
#include <boost/wave/language_support.hpp>
@@ -820,7 +821,7 @@
namespace fs = boost::filesystem;
// ensure all directories for this file do exist
- fs::create_directories(fpath.branch_path());
+ fs::create_directories(boost::wave::util::branch_path(fpath));
// figure out, whether the file to open was last accessed by us
std::ios::openmode mode = std::ios::out;
@@ -873,9 +874,8 @@
namespace fs = boost::filesystem;
string_type fname ((*it).get_value());
- fs::path fpath (
- util::impl::unescape_lit(fname.substr(1, fname.size()-2)).c_str(),
- fs::native);
+ fs::path fpath (boost::wave::util::create_path(
+ util::impl::unescape_lit(fname.substr(1, fname.size()-2)).c_str()));
fpath = fs::complete(fpath, ctx.get_current_directory());
result = interpret_pragma_option_output_open(fpath, ctx, act_token);
}
@@ -932,7 +932,7 @@
}
else {
// there was a file name on the command line
- fs::path fpath(default_outfile, fs::native);
+ fs::path fpath(boost::wave::util::create_path(default_outfile));
result = interpret_pragma_option_output_open(fpath, ctx,
act_token);
}
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