updated boost on windows

This commit is contained in:
Bassem Girgis
2019-08-13 21:48:48 -05:00
parent 7d77d485fd
commit b40a3bee82
5162 changed files with 473027 additions and 116452 deletions

View File

@@ -30,23 +30,23 @@ class if_block
{
public:
if_block() :
status(true), some_part_status(true),
status(true), some_part_status(true),
enclosing_status(true), is_in_else(false)
{
}
if_block(bool status_, bool enclosing_status_) :
status(status_),
if_block(bool status_, bool enclosing_status_) :
status(status_),
some_part_status(status_),
enclosing_status(enclosing_status_),
is_in_else(false)
{
}
void set_status(bool status_)
{
status = status_;
if (status_)
some_part_status = true;
void set_status(bool status_)
{
status = status_;
if (status_)
some_part_status = true;
}
bool get_status() const { return status; }
bool get_some_part_status() const { return some_part_status; }
@@ -63,8 +63,8 @@ private:
///////////////////////////////////////////////////////////////////////////////
// stack of conditional compilation contexts
class if_block_stack
: private std::stack<if_block>
class if_block_stack
: private std::stack<if_block>
{
public:
typedef std::stack<if_block>::size_type size_type;
@@ -84,7 +84,7 @@ public:
if (get_status()) {
// entered a (false) #elif block from a true block
this->top().set_status(false);
}
}
else if (new_status && !this->top().get_some_part_status()) {
// Entered true #elif block and no previous block was true
this->top().set_status(new_status);
@@ -101,7 +101,7 @@ public:
if (!this->top().get_some_part_status()) {
// Entered (true) #else block and no previous block was true
this->top().set_status(true);
}
}
else if (get_status()) {
// Entered (false) #else block from true block
this->top().set_status(false);
@@ -123,12 +123,12 @@ public:
// return, whether the top (innermost) condition is true or false
bool get_status() const
{
return 0 == this->size() || this->top().get_status();
{
return 0 == this->size() || this->top().get_status();
}
bool get_some_part_status() const
{
return 0 == this->size() || this->top().get_some_part_status();
{
return 0 == this->size() || this->top().get_some_part_status();
}
bool get_enclosing_status() const
{

View File

@@ -15,6 +15,7 @@
#include <list>
#include <utility>
#include <boost/assert.hpp>
#include <boost/wave/wave_config.hpp>
#include <boost/wave/util/filesystem_compatibility.hpp>
@@ -58,10 +59,9 @@ struct bidirectional_map
typedef std::pair<FromType, ToType> value_type;
#if defined(BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS) || \
(defined(BOOST_MSVC) && \
( (BOOST_MSVC < 1300) || (BOOST_MSVC == 1600) )) || \
(defined(BOOST_MSVC) && (BOOST_MSVC == 1600) ) || \
(defined(BOOST_INTEL_CXX_VERSION) && \
(defined(_MSC_VER) && (BOOST_INTEL_CXX_VERSION <= 700)))
(defined(_MSC_VER) && (BOOST_INTEL_CXX_VERSION <= 700)))
BOOST_STATIC_CONSTANT(unsigned, from_offset = offsetof(value_type, first));
BOOST_STATIC_CONSTANT(unsigned, to_offset = offsetof(value_type, second));
@@ -70,12 +70,12 @@ struct bidirectional_map
value_type,
boost::multi_index::indexed_by<
boost::multi_index::ordered_unique<
boost::multi_index::tag<from>,
boost::multi_index::member_offset<value_type, FromType, from_offset>
boost::multi_index::tag<from>,
boost::multi_index::member_offset<value_type, FromType, from_offset>
>,
boost::multi_index::ordered_non_unique<
boost::multi_index::tag<to>,
boost::multi_index::member_offset<value_type, ToType, to_offset>
boost::multi_index::tag<to>,
boost::multi_index::member_offset<value_type, ToType, to_offset>
>
>
> type;
@@ -87,11 +87,11 @@ struct bidirectional_map
boost::multi_index::indexed_by<
boost::multi_index::ordered_unique<
boost::multi_index::tag<from>,
boost::multi_index::member<value_type, FromType, &value_type::first>
boost::multi_index::member<value_type, FromType, &value_type::first>
>,
boost::multi_index::ordered_non_unique<
boost::multi_index::tag<to>,
boost::multi_index::member<value_type, ToType, &value_type::second>
boost::multi_index::tag<to>,
boost::multi_index::member<value_type, ToType, &value_type::second>
>
>
> type;
@@ -115,35 +115,35 @@ struct load_filepos
//
// General notes:
//
// Any directories specified with the 'add_include_path()' function before
// the function 'set_sys_include_delimiter()' is called are searched only
// for the case of '#include "file"' directives, they are not searched for
// '#include <file>' directives. If additional directories are specified
// with the 'add_include_path()' function after a call to the function
// 'set_sys_include_delimiter()', these directories are searched for all
// '#include' directives.
// Any directories specified with the 'add_include_path()' function before
// the function 'set_sys_include_delimiter()' is called are searched only
// for the case of '#include "file"' directives, they are not searched for
// '#include <file>' directives. If additional directories are specified
// with the 'add_include_path()' function after a call to the function
// 'set_sys_include_delimiter()', these directories are searched for all
// '#include' directives.
//
// In addition, a call to the function 'set_sys_include_delimiter()'
// inhibits the use of the current directory as the first search directory
// for '#include "file"' directives. Therefore, the current directory is
// In addition, a call to the function 'set_sys_include_delimiter()'
// inhibits the use of the current directory as the first search directory
// for '#include "file"' directives. Therefore, the current directory is
// searched only if it is requested explicitly with a call to the function
// 'add_include_path(".")'.
// 'add_include_path(".")'.
//
// Calling both functions, the 'set_sys_include_delimiter()' and
// 'add_include_path(".")' allows you to control precisely which
// directories are searched before the current one and which are searched
// Calling both functions, the 'set_sys_include_delimiter()' and
// 'add_include_path(".")' allows you to control precisely which
// directories are searched before the current one and which are searched
// after.
//
///////////////////////////////////////////////////////////////////////////////
class include_paths
{
private:
typedef std::list<std::pair<boost::filesystem::path, std::string> >
typedef std::list<std::pair<boost::filesystem::path, std::string> >
include_list_type;
typedef include_list_type::value_type include_value_type;
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
typedef bidirectional_map<std::string, std::string>::type
typedef bidirectional_map<std::string, std::string>::type
pragma_once_set_type;
#endif
@@ -153,21 +153,21 @@ public:
current_dir(initial_path()),
current_rel_dir(initial_path())
{}
bool add_include_path(char const *path_, bool is_system = false)
{
return add_include_path(path_, (is_system || was_sys_include_path) ?
return add_include_path(path_, (is_system || was_sys_include_path) ?
system_include_paths : user_include_paths);
}
void set_sys_include_delimiter() { was_sys_include_path = true; }
bool find_include_file (std::string &s, std::string &dir, bool is_system,
bool find_include_file (std::string &s, std::string &dir, bool is_system,
char const *current_file) const;
void set_current_directory(char const *path_);
boost::filesystem::path get_current_directory() const
boost::filesystem::path get_current_directory() const
{ return current_dir; }
protected:
bool find_include_file (std::string &s, std::string &dir,
bool find_include_file (std::string &s, std::string &dir,
include_list_type const &pathes, char const *) const;
bool add_include_path(char const *path_, include_list_type &pathes_);
@@ -185,7 +185,7 @@ public:
using boost::multi_index::get;
return get<from>(pragma_once_files).find(filename) != pragma_once_files.end();
}
bool add_pragma_once_header(std::string const &filename,
bool add_pragma_once_header(std::string const &filename,
std::string const& guard_name)
{
typedef pragma_once_set_type::value_type value_type;
@@ -195,7 +195,7 @@ public:
{
typedef pragma_once_set_type::index_iterator<to>::type to_iterator;
typedef std::pair<to_iterator, to_iterator> range_type;
range_type r = pragma_once_files.get<to>().equal_range(guard_name);
if (r.first != r.second) {
using boost::multi_index::get;
@@ -232,7 +232,7 @@ private:
{
using namespace boost::serialization;
if (version != (loaded_version & ~version_mask)) {
BOOST_WAVE_THROW(preprocess_exception, incompatible_config,
BOOST_WAVE_THROW(preprocess_exception, incompatible_config,
"cpp_include_path state version", load_filepos());
return;
}
@@ -247,13 +247,13 @@ private:
if (user_paths != user_include_paths)
{
BOOST_WAVE_THROW(preprocess_exception, incompatible_config,
BOOST_WAVE_THROW(preprocess_exception, incompatible_config,
"user include paths", load_filepos());
return;
}
if (system_paths != system_include_paths)
{
BOOST_WAVE_THROW(preprocess_exception, incompatible_config,
BOOST_WAVE_THROW(preprocess_exception, incompatible_config,
"system include paths", load_filepos());
return;
}
@@ -265,7 +265,7 @@ private:
};
///////////////////////////////////////////////////////////////////////////////
// Add an include path to one of the search lists (user include path or system
// Add an include path to one of the search lists (user include path or system
// include path).
inline
bool include_paths::add_include_path (
@@ -290,7 +290,7 @@ bool include_paths::add_include_path (
///////////////////////////////////////////////////////////////////////////////
// Find an include file by traversing the list of include directories
inline
bool include_paths::find_include_file (std::string &s, std::string &dir,
bool include_paths::find_include_file (std::string &s, std::string &dir,
include_list_type const &pathes, char const *current_file) const
{
namespace fs = boost::filesystem;
@@ -299,7 +299,7 @@ bool include_paths::find_include_file (std::string &s, std::string &dir,
const_include_list_iter_t it = pathes.begin();
const_include_list_iter_t include_paths_end = pathes.end();
#if BOOST_WAVE_SUPPORT_INCLUDE_NEXT != 0
#if BOOST_WAVE_SUPPORT_INCLUDE_NEXT != 0
if (0 != current_file) {
// re-locate the directory of the current file (#include_next handling)
@@ -312,7 +312,7 @@ bool include_paths::find_include_file (std::string &s, std::string &dir,
fs::path file_path (create_path(current_file));
for (/**/; it != include_paths_end; ++it) {
fs::path currpath (create_path((*it).first.string()));
if (std::equal(currpath.begin(), currpath.end(), file_path.begin()))
if (std::equal(currpath.begin(), currpath.end(), file_path.begin()))
{
++it; // start searching with the next directory
break;
@@ -327,7 +327,7 @@ bool include_paths::find_include_file (std::string &s, std::string &dir,
currpath = create_path((*it).first.string());
currpath /= create_path(s); // append filename
}
if (fs::exists(currpath)) {
fs::path dirpath (create_path(s));
if (!dirpath.has_root_directory()) {
@@ -344,10 +344,10 @@ bool include_paths::find_include_file (std::string &s, std::string &dir,
}
///////////////////////////////////////////////////////////////////////////////
// Find an include file by searching the user and system includes in the
// Find an include file by searching the user and system includes in the
// correct sequence (as it was configured by the user of the driver program)
inline bool
include_paths::find_include_file (std::string &s, std::string &dir,
inline bool
include_paths::find_include_file (std::string &s, std::string &dir,
bool is_system, char const *current_file) const
{
namespace fs = boost::filesystem;
@@ -361,7 +361,7 @@ include_paths::find_include_file (std::string &s, std::string &dir,
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
@@ -374,7 +374,7 @@ include_paths::find_include_file (std::string &s, std::string &dir,
dir = dirpath.string();
s = normalize(currpath).string(); // found in local directory
return true;
}
}
// iterate all user include file directories to find the file
if (find_include_file(s, dir, user_include_paths, current_file))
@@ -387,7 +387,7 @@ include_paths::find_include_file (std::string &s, std::string &dir,
// are searched in the user search path only
return find_include_file(s, dir, user_include_paths, current_file);
}
// if nothing found, fall through
// ...
}
@@ -400,26 +400,26 @@ include_paths::find_include_file (std::string &s, std::string &dir,
// Set current directory from a given file name
inline bool
as_relative_to(boost::filesystem::path const& path,
boost::filesystem::path const& base, boost::filesystem::path& result)
as_relative_to(boost::filesystem::path const& path,
boost::filesystem::path const& base, boost::filesystem::path& result)
{
if (path.has_root_path()) {
if (path.root_path() == base.root_path())
if (path.root_path() == base.root_path())
return as_relative_to(path.relative_path(), base.relative_path(), result);
result = path; // that's our result
}
}
else {
if (base.has_root_path()) {
// cannot find relative path from a relative path and a rooted base
return false;
}
}
else {
typedef boost::filesystem::path::const_iterator path_iterator;
path_iterator path_it = path.begin();
path_iterator base_it = base.begin();
while (path_it != path.end() && base_it != base.end() ) {
if (*path_it != *base_it)
if (*path_it != *base_it)
break;
++path_it; ++base_it;
}
@@ -439,21 +439,16 @@ inline
void include_paths::set_current_directory(char const *path_)
{
namespace fs = boost::filesystem;
fs::path filepath (create_path(path_));
fs::path filename = util::complete_path(filepath, current_dir);
if (fs::exists(filename) && fs::is_directory(filename)) {
current_rel_dir.clear();
if (!as_relative_to(filepath, current_dir, current_rel_dir))
current_rel_dir = filepath;
current_dir = filename;
}
else {
current_rel_dir.clear();
if (!as_relative_to(branch_path(filepath), current_dir, current_rel_dir))
current_rel_dir = branch_path(filepath);
current_dir = branch_path(filename);
}
BOOST_ASSERT(!(fs::exists(filename) && fs::is_directory(filename)));
current_rel_dir.clear();
if (!as_relative_to(branch_path(filepath), current_dir, current_rel_dir))
current_rel_dir = branch_path(filepath);
current_dir = branch_path(filename);
}
///////////////////////////////////////////////////////////////////////////////
@@ -466,7 +461,7 @@ namespace boost { namespace serialization {
///////////////////////////////////////////////////////////////////////////////
// Serialization support for boost::filesystem::path
template<class Archive>
inline void save (Archive & ar, boost::filesystem::path const& p,
inline void save (Archive & ar, boost::filesystem::path const& p,
const unsigned int /* file_version */)
{
using namespace boost::serialization;
@@ -503,7 +498,7 @@ inline void save (Archive & ar,
const unsigned int /* file_version */)
{
boost::serialization::stl::save_collection<
Archive,
Archive,
typename boost::wave::util::bidirectional_map<
std::string, std::string
>::type
@@ -528,7 +523,7 @@ inline void load (Archive & ar,
// split non-intrusive serialization function member into separate
// non intrusive save/load member functions
template<class Archive>
inline void serialize (Archive & ar,
inline void serialize (Archive & ar,
typename boost::wave::util::bidirectional_map<
std::string, std::string
>::type &t,
@@ -540,7 +535,7 @@ inline void serialize (Archive & ar,
///////////////////////////////////////////////////////////////////////////////
}} // namespace boost::serialization
BOOST_CLASS_VERSION(boost::wave::util::include_paths,
BOOST_CLASS_VERSION(boost::wave::util::include_paths,
boost::wave::util::include_paths::version);
#endif // BOOST_WAVE_SERIALIZATION != 0

View File

@@ -23,6 +23,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/spirit/include/classic_multi_pass.hpp>
#include <boost/spirit/include/classic_parse_tree_utils.hpp>
@@ -546,7 +547,7 @@ pp_iterator_functor<ContextT>::operator()()
// cleanup of certain tokens required
seen_newline = false;
switch (static_cast<unsigned int>(id)) {
switch (id) {
case T_NONREPLACABLE_IDENTIFIER:
act_token.set_token_id(id = T_IDENTIFIER);
break;
@@ -607,7 +608,7 @@ pp_iterator_functor<ContextT>::operator()()
break;
}
if (whitespace.must_insert(id, act_token.get_value())) {
if (token_is_valid(act_token) && whitespace.must_insert(id, act_token.get_value())) {
// must insert some whitespace into the output stream to avoid adjacent
// tokens, which would form different (and wrong) tokens
whitespace.shift_tokens(T_SPACE);
@@ -668,9 +669,19 @@ bool returned_from_include_file = returned_from_include();
if ((!seen_newline || act_pos.get_column() > 1) &&
!need_single_line(ctx.get_language()))
{
// warn, if this file does not end with a newline
BOOST_WAVE_THROW_CTX(ctx, preprocess_exception,
last_line_not_terminated, "", act_pos);
if (need_no_newline_at_end_of_file(ctx.get_language()))
{
seen_newline = true;
pending_queue.push_back(
result_type(T_NEWLINE, "\n", act_pos)
);
}
else
{
// warn, if this file does not end with a newline
BOOST_WAVE_THROW_CTX(ctx, preprocess_exception,
last_line_not_terminated, "", act_pos);
}
}
continue; // if this is the main file, the while loop breaks
}
@@ -695,6 +706,11 @@ bool returned_from_include_file = returned_from_include();
// pending_queue.push_back(result_type(T_NEWLINE, "\n", act_pos));
// seen_newline = true;
// must_emit_line_directive = true;
if (iter_ctx->first == iter_ctx->last)
{
seen_newline = true;
act_token = result_type(T_NEWLINE, "\n", act_pos);
}
// loop to the next token to analyze
// simply fall through, since the iterator was already adjusted
@@ -780,7 +796,7 @@ typename ContextT::position_type pos = act_token.get_position();
if (!ctx.get_hooks().emit_line_directive(ctx, pending, act_token))
{
unsigned int column = 6;
unsigned int column = 6;
// the hook did not generate anything, emit default #line
pos.set_column(1);
@@ -789,22 +805,20 @@ typename ContextT::position_type pos = act_token.get_position();
pos.set_column(column); // account for '#line'
pending.push_back(result_type(T_SPACE, " ", pos));
// 21 is the max required size for a 64 bit integer represented as a
// string
char buffer[22];
// 21 is the max required size for a 64 bit integer represented as a
// string
using namespace std; // for some systems sprintf is in namespace std
sprintf (buffer, "%ld", pos.get_line());
std::string buffer = lexical_cast<std::string>(pos.get_line());
pos.set_column(++column); // account for ' '
pending.push_back(result_type(T_INTLIT, buffer, pos));
pos.set_column(column += (unsigned int)strlen(buffer)); // account for <number>
pending.push_back(result_type(T_INTLIT, buffer.c_str(), pos));
pos.set_column(column += (unsigned int)buffer.size()); // account for <number>
pending.push_back(result_type(T_SPACE, " ", pos));
pos.set_column(++column); // account for ' '
std::string file("\"");
boost::filesystem::path filename(
wave::util::create_path(act_pos.get_file().c_str()));
std::string file("\"");
boost::filesystem::path filename(
wave::util::create_path(act_pos.get_file().c_str()));
using wave::util::impl::escape_lit;
file += escape_lit(wave::util::native_file_string(filename)) + "\"";
@@ -962,7 +976,7 @@ namespace impl {
if (call_hook)
util::impl::call_skipped_token_hook(ctx, *it);
}
return false;
return need_no_newline_at_end_of_file(ctx.get_language());
}
///////////////////////////////////////////////////////////////////////////
@@ -1060,10 +1074,13 @@ pp_iterator_functor<ContextT>::ensure_is_last_on_line(IteratorT& it, bool call_h
seen_newline = true; // allow to resume after warning
iter_ctx->first = it;
// Trigger a warning that the last line was not terminated with a
// newline.
BOOST_WAVE_THROW_CTX(ctx, preprocess_exception,
last_line_not_terminated, "", act_pos);
if (!need_no_newline_at_end_of_file(ctx.get_language()))
{
// Trigger a warning that the last line was not terminated with a
// newline.
BOOST_WAVE_THROW_CTX(ctx, preprocess_exception,
last_line_not_terminated, "", act_pos);
}
return false;
}
@@ -1083,10 +1100,13 @@ pp_iterator_functor<ContextT>::skip_to_eol_with_check(IteratorT &it, bool call_h
seen_newline = true; // allow to resume after warning
iter_ctx->first = it;
// Trigger a warning, that the last line was not terminated with a
// newline.
BOOST_WAVE_THROW_CTX(ctx, preprocess_exception,
last_line_not_terminated, "", act_pos);
if (!need_no_newline_at_end_of_file(ctx.get_language()))
{
// Trigger a warning, that the last line was not terminated with a
// newline.
BOOST_WAVE_THROW_CTX(ctx, preprocess_exception,
last_line_not_terminated, "", act_pos);
}
return false;
}
@@ -1109,7 +1129,7 @@ pp_iterator_functor<ContextT>::handle_pp_directive(IteratorT &it)
if (!ctx.get_if_block_status()) {
if (IS_EXTCATEGORY(*it, PPConditionalTokenType)) {
// simulate the if block hierarchy
switch (static_cast<unsigned int>(id)) {
switch (id) {
case T_PP_IFDEF: // #ifdef
case T_PP_IFNDEF: // #ifndef
case T_PP_IF: // #if
@@ -1163,7 +1183,7 @@ pp_iterator_functor<ContextT>::handle_pp_directive(IteratorT &it)
// try to handle the simple pp directives without parsing
result_type directive = *it;
bool include_next = false;
switch (static_cast<unsigned int>(id)) {
switch (id) {
case T_PP_QHEADER: // #include "..."
#if BOOST_WAVE_SUPPORT_INCLUDE_NEXT != 0
case T_PP_QHEADER_NEXT:
@@ -1368,7 +1388,9 @@ tree_parse_info_type hit = cpp_grammar_type::parse_cpp_grammar(
// the found pp directive
bool result = dispatch_directive (hit, found_directive, found_eoltokens);
if (found_eof && !need_single_line(ctx.get_language())) {
if (found_eof && !need_single_line(ctx.get_language()) &&
!need_no_newline_at_end_of_file(ctx.get_language()))
{
// The line was terminated with an end of file token.
// So trigger a warning, that the last line was not terminated with a
// newline.
@@ -1424,7 +1446,7 @@ token_id id = token_id(found_directive);
if (impl::call_found_directive_hook(ctx, found_directive))
return true; // skip this directive and return newline only
switch (static_cast<unsigned int>(id)) {
switch (id) {
// case T_PP_QHEADER: // #include "..."
// #if BOOST_WAVE_SUPPORT_INCLUDE_NEXT != 0
// case T_PP_QHEADER_NEXT: // #include_next "..."
@@ -2316,7 +2338,10 @@ token_sequence_type toexpand;
act_pos.set_file(unescape_lit(file_name).c_str());
}
act_pos.set_line(line);
iter_ctx->first.set_position(act_pos);
if (iter_ctx->first != iter_ctx->last)
{
iter_ctx->first.set_position(act_pos);
}
}
///////////////////////////////////////////////////////////////////////////////

View File

@@ -32,6 +32,7 @@
#endif
#include <boost/filesystem/path.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/wave/util/time_conversion_helper.hpp>
#include <boost/wave/util/unput_queue_iterator.hpp>
@@ -582,7 +583,6 @@ macromap<ContextT>::expand_tokensequence_worker(
// analyze the next element of the given sequence, if it is an
// T_IDENTIFIER token, try to replace this as a macro etc.
using namespace boost::wave;
typedef unput_queue_iterator<IteratorT, token_type, ContainerT> iterator_type;
if (first != last) {
token_id id = token_id(*first);
@@ -742,7 +742,7 @@ token_type startof_argument_list = *next;
return 0;
}
switch (static_cast<unsigned int>(id)) {
switch (id) {
case T_LEFTPAREN:
++nested_parenthesis_level;
argument->push_back(*next);
@@ -1411,11 +1411,9 @@ string_type const &value = curr_token.get_value();
if (value == "__LINE__") {
// expand the __LINE__ macro
char buffer[22]; // 21 bytes holds all NUL-terminated unsigned 64-bit numbers
std::string buffer = lexical_cast<std::string>(main_pos.get_line());
using namespace std; // for some systems sprintf is in namespace std
sprintf(buffer, "%ld", main_pos.get_line());
expanded.push_back(token_type(T_INTLIT, buffer, curr_token.get_position()));
expanded.push_back(token_type(T_INTLIT, buffer.c_str(), curr_token.get_position()));
return true;
}
else if (value == "__FILE__") {

View File

@@ -2,7 +2,7 @@
Boost.Wave: A Standard compliant C++ preprocessor library
Definition of the predefined macros
http://www.boost.org/
Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
@@ -19,7 +19,7 @@
#include <boost/wave/wave_config.hpp>
#include <boost/wave/wave_config_constant.hpp>
#include <boost/wave/token_ids.hpp>
#include <boost/wave/util/time_conversion_helper.hpp> // time_conversion_helper
#include <boost/wave/util/time_conversion_helper.hpp> // time_conversion_helper
// this must occur after all of the includes and before any code appears
#ifdef BOOST_HAS_ABI_HEADERS
@@ -42,10 +42,10 @@ namespace wave {
namespace util {
///////////////////////////////////////////////////////////////////////////
class predefined_macros
class predefined_macros
{
typedef BOOST_WAVE_STRINGTYPE string_type;
public:
// list of static predefined macros
struct static_macros {
@@ -107,7 +107,7 @@ namespace util {
char buffer[sizeof("\"12:34:56\"")+1];
tb = localtime (&tt);
sprintf (buffer, "\"%02d:%02d:%02d\"", tb->tm_hour,
sprintf (buffer, "\"%02d:%02d:%02d\"", tb->tm_hour,
tb->tm_min, tb->tm_sec);
timestr_ = buffer;
}
@@ -123,7 +123,7 @@ namespace util {
// for some systems sprintf, time_t etc. is in namespace std
using namespace std;
// calculate the number of days since Dec 13 2001
// calculate the number of days since Dec 13 2001
// (the day the Wave project was started)
tm first_day;
@@ -136,7 +136,7 @@ namespace util {
long seconds = long(difftime(compilation_time_.get_time(), mktime(&first_day)));
sprintf(buffer, "0x%02d%1d%1d%04ld", BOOST_WAVE_VERSION_MAJOR,
BOOST_WAVE_VERSION_MINOR, BOOST_WAVE_VERSION_SUBMINOR,
BOOST_WAVE_VERSION_MINOR, BOOST_WAVE_VERSION_SUBMINOR,
seconds/(3600*24));
version_ = buffer;
}
@@ -148,7 +148,7 @@ namespace util {
// for some systems sprintf, time_t etc. is in namespace std
using namespace std;
// calculate the number of days since Dec 13 2001
// calculate the number of days since Dec 13 2001
// (the day the Wave project was started)
tm first_day;
@@ -160,13 +160,13 @@ namespace util {
long seconds = long(difftime(compilation_time_.get_time(), mktime(&first_day)));
sprintf(buffer, "\"%d.%d.%d.%ld [%s/%s]\"", BOOST_WAVE_VERSION_MAJOR,
BOOST_WAVE_VERSION_MINOR, BOOST_WAVE_VERSION_SUBMINOR,
BOOST_WAVE_VERSION_MINOR, BOOST_WAVE_VERSION_SUBMINOR,
seconds/(3600*24), BOOST_PLATFORM, BOOST_COMPILER);
versionstr_ = buffer;
}
// dynamic predefined macros
string_type get_date() const { return datestr_; } // __DATE__
string_type get_date() const { return datestr_; } // __DATE__
string_type get_time() const { return timestr_; } // __TIME__
// __SPIRIT_PP__/__WAVE__
@@ -175,7 +175,7 @@ namespace util {
char buffer[sizeof("0x0000")+1];
using namespace std; // for some systems sprintf is in namespace std
sprintf(buffer, "0x%02d%1d%1d", BOOST_WAVE_VERSION_MAJOR,
sprintf(buffer, "0x%02d%1d%1d", BOOST_WAVE_VERSION_MAJOR,
BOOST_WAVE_VERSION_MINOR, BOOST_WAVE_VERSION_SUBMINOR);
return buffer;
}
@@ -191,10 +191,10 @@ namespace util {
}
public:
predefined_macros()
predefined_macros()
: compilation_time_(__DATE__ " " __TIME__)
{
reset();
{
reset();
reset_version();
reset_versionstr();
}
@@ -211,20 +211,20 @@ namespace util {
// __SPIRIT_PP_VERSION_STR__/__WAVE_VERSION_STR__
string_type get_versionstr() const { return versionstr_; }
// C++ mode
// C++ mode
static_macros const& static_data_cpp(std::size_t i) const
{
static static_macros data[] = {
{ "__STDC__", T_INTLIT, "1" },
{ "__cplusplus", T_INTLIT, "199711L" },
{ 0, T_EOF, 0 }
};
};
BOOST_ASSERT(i < sizeof(data)/sizeof(data[0]));
return data[i];
}
#if BOOST_WAVE_SUPPORT_CPP0X != 0
// C++11 mode
// C++11 mode
static_macros const& static_data_cpp0x(std::size_t i) const
{
static static_macros data[] = {
@@ -234,7 +234,7 @@ namespace util {
{ "__STDC_HOSTED__", T_INTLIT, "0" },
{ "__WAVE_HAS_VARIADICS__", T_INTLIT, "1" },
{ 0, T_EOF, 0 }
};
};
BOOST_ASSERT(i < sizeof(data)/sizeof(data[0]));
return data[i];
}
@@ -250,11 +250,11 @@ namespace util {
{ "__STDC_HOSTED__", T_INTLIT, "0" },
{ "__WAVE_HAS_VARIADICS__", T_INTLIT, "1" },
{ 0, T_EOF, 0 }
};
};
BOOST_ASSERT(i < sizeof(data)/sizeof(data[0]));
return data[i];
}
#endif
#endif
dynamic_macros const& dynamic_data(std::size_t i) const
{

View File

@@ -17,7 +17,7 @@
#include <boost/wave/wave_config.hpp>
#include <boost/wave/token_ids.hpp>
#include <boost/wave/util/unput_queue_iterator.hpp>
#include <boost/wave/util/unput_queue_iterator.hpp>
// this must occur after all of the includes and before any code appears
#ifdef BOOST_HAS_ABI_HEADERS
@@ -26,7 +26,7 @@
///////////////////////////////////////////////////////////////////////////////
//
// This file contains the definition of several token sequence analyze
// This file contains the definition of several token sequence analyze
// and transformation utility functions needed during macro handling.
//
///////////////////////////////////////////////////////////////////////////////
@@ -41,7 +41,7 @@ namespace on_exit {
///////////////////////////////////////////////////////////////////////////
//
// On destruction pop the first element of the list given as the argument
// On destruction pop the first element of the list given as the argument
//
///////////////////////////////////////////////////////////////////////////
template <typename ContainerT>
@@ -56,15 +56,15 @@ namespace on_exit {
///////////////////////////////////////////////////////////////////////////
//
// Append a given list to the list given as argument
// On destruction pop the first element of the list given as argument
// Append a given list to the list given as argument
// On destruction pop the first element of the list given as argument
//
///////////////////////////////////////////////////////////////////////////
template <typename ContainerT>
class splice_pop_front {
public:
splice_pop_front(ContainerT &list_, ContainerT &queue)
: list(list_)
splice_pop_front(ContainerT &list_, ContainerT &queue)
: list(list_)
{
list.splice(list.end(), queue);
}
@@ -103,7 +103,7 @@ namespace on_exit {
class assign
{
public:
assign(IteratorT &it_, UnputIteratorT const &uit_)
assign(IteratorT &it_, UnputIteratorT const &uit_)
: it(it_), uit(uit_) {}
~assign() { it = uit.base(); }
@@ -115,7 +115,7 @@ namespace on_exit {
template <typename IteratorT>
class assign<IteratorT, IteratorT> {
public:
assign(IteratorT &it_, IteratorT const &uit_)
assign(IteratorT &it_, IteratorT const &uit_)
: it(it_), uit(uit_) {}
~assign() { it = uit; }
@@ -136,7 +136,7 @@ namespace impl {
//
///////////////////////////////////////////////////////////////////////////////
template <typename StringT>
inline bool
inline bool
is_special_macroname (StringT const &name)
{
if (name.size() < 7)
@@ -148,7 +148,7 @@ is_special_macroname (StringT const &name)
if ('_' == name[0] && '_' == name[1]) {
StringT str = name.substr(2);
if (str == "cplusplus" || str == "STDC__" ||
if (str == "cplusplus" || str == "STDC__" ||
str == "TIME__" || str == "DATE__" ||
str == "LINE__" || str == "FILE__" ||
str == "INCLUDE_LEVEL__")
@@ -166,20 +166,20 @@ is_special_macroname (StringT const &name)
//
///////////////////////////////////////////////////////////////////////////////
template <typename TokenT>
inline bool
inline bool
token_equals(TokenT const &left, TokenT const &right)
{
using namespace boost::wave;
if (IS_CATEGORY(left, ParameterTokenType)) {
// if the existing token is of type T_PARAMETERBASE, then the right token
// if the existing token is of type T_PARAMETERBASE, then the right token
// must be of type T_IDENTIFIER or a keyword
token_id id = token_id(right);
return (T_IDENTIFIER == id ||
return (T_IDENTIFIER == id ||
IS_CATEGORY(id, KeywordTokenType) ||
IS_EXTCATEGORY(id, OperatorTokenType|AltExtTokenType) ||
IS_CATEGORY(id, BoolLiteralTokenType)) &&
IS_CATEGORY(id, BoolLiteralTokenType)) &&
left.get_value() == right.get_value();
}
@@ -196,8 +196,8 @@ token_equals(TokenT const &left, TokenT const &right)
//
///////////////////////////////////////////////////////////////////////////////
template <typename ContainerT>
inline bool
definition_equals(ContainerT const &definition,
inline bool
definition_equals(ContainerT const &definition,
ContainerT const &new_definition)
{
typedef typename ContainerT::const_iterator const_iterator_type;
@@ -207,22 +207,22 @@ const_iterator_type last1 = definition.end();
const_iterator_type first2 = new_definition.begin();
const_iterator_type last2 = new_definition.end();
while (first1 != last1 && first2 != last2 && token_equals(*first1, *first2))
while (first1 != last1 && first2 != last2 && token_equals(*first1, *first2))
{
// skip whitespace, if both sequences have a whitespace next
token_id id1 = next_token<const_iterator_type>::peek(first1, last1, false);
token_id id2 = next_token<const_iterator_type>::peek(first2, last2, false);
if (IS_CATEGORY(id1, WhiteSpaceTokenType) &&
IS_CATEGORY(id2, WhiteSpaceTokenType))
if (IS_CATEGORY(id1, WhiteSpaceTokenType) &&
IS_CATEGORY(id2, WhiteSpaceTokenType))
{
// all consecutive whitespace tokens count as one whitespace
// adjust first1 and first2 accordingly
skip_whitespace(first1, last1);
skip_whitespace(first2, last2);
}
else if (!IS_CATEGORY(id1, WhiteSpaceTokenType) &&
!IS_CATEGORY(id2, WhiteSpaceTokenType))
else if (!IS_CATEGORY(id1, WhiteSpaceTokenType) &&
!IS_CATEGORY(id2, WhiteSpaceTokenType))
{
++first1;
++first2;
@@ -241,7 +241,7 @@ const_iterator_type last2 = new_definition.end();
//
///////////////////////////////////////////////////////////////////////////////
template <typename ContainerT>
inline bool
inline bool
parameters_equal(ContainerT const &parameters, ContainerT const &new_parameters)
{
if (parameters.size() != new_parameters.size())
@@ -284,7 +284,7 @@ trim_replacement_list (ContainerT &replacement_list)
typename ContainerT::iterator end = replacement_list.end();
typename ContainerT::iterator it = replacement_list.begin();
while (it != end && IS_CATEGORY(*it, WhiteSpaceTokenType)) {
while (it != end && IS_CATEGORY(*it, WhiteSpaceTokenType)) {
token_id id(*it);
if (T_PLACEHOLDER != id && T_PLACEMARKER != id) {
typename ContainerT::iterator next = it;
@@ -303,13 +303,13 @@ trim_replacement_list (ContainerT &replacement_list)
typename ContainerT::reverse_iterator rend = replacement_list.rend();
typename ContainerT::reverse_iterator rit = replacement_list.rbegin();
while (rit != rend && IS_CATEGORY(*rit, WhiteSpaceTokenType))
while (rit != rend && IS_CATEGORY(*rit, WhiteSpaceTokenType))
++rit;
typename ContainerT::iterator end = replacement_list.end();
typename ContainerT::iterator it = rit.base();
while (it != end && IS_CATEGORY(*it, WhiteSpaceTokenType)) {
while (it != end && IS_CATEGORY(*it, WhiteSpaceTokenType)) {
token_id id(*it);
if (T_PLACEHOLDER != id && T_PLACEMARKER != id) {
typename ContainerT::iterator next = it;
@@ -372,7 +372,7 @@ remove_placeholders (ContainerT &replacement_list)
}
}
// remove all 'new' leading and trailing whitespace
// remove all 'new' leading and trailing whitespace
if (is_whitespace_only(replacement_list))
trim_replacement_list(replacement_list);
}
@@ -396,7 +396,7 @@ trim_sequence_left (ContainerT &argument)
argument.pop_front();
}
}
///////////////////////////////////////////////////////////////////////////////
//
// Remove all whitespace tokens on the right side of the given token sequence
@@ -418,7 +418,7 @@ trim_sequence_right (ContainerT &argument)
///////////////////////////////////////////////////////////////////////////////
//
// Remove all whitespace tokens on the left and right sides of the given token
// Remove all whitespace tokens on the left and right sides of the given token
// sequence
//
///////////////////////////////////////////////////////////////////////////////
@@ -433,11 +433,11 @@ trim_sequence (ContainerT &argument)
///////////////////////////////////////////////////////////////////////////////
// call 'skipped_token' preprocessing hook
template <typename ContextT>
void call_skipped_token_hook(ContextT& ctx,
void call_skipped_token_hook(ContextT& ctx,
typename ContextT::token_type const& skipped)
{
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
ctx.get_hooks().skipped_token(skipped);
ctx.get_hooks().skipped_token(skipped);
#else
ctx.get_hooks().skipped_token(ctx.derived(), skipped);
#endif
@@ -449,20 +449,20 @@ void call_skipped_token_hook(ContextT& ctx,
//
///////////////////////////////////////////////////////////////////////////////
template <typename ContextT, typename IteratorT>
inline bool
skip_to_token(ContextT& ctx, IteratorT &it, IteratorT const &end,
inline bool
skip_to_token(ContextT& ctx, IteratorT &it, IteratorT const &end,
token_id id, bool& seen_newline)
{
using namespace boost::wave;
if (token_id(*it) == id)
if (token_id(*it) == id)
return true;
// call_skipped_token_hook(ctx, *it);
if (++it == end)
if (++it == end)
return false;
while (IS_CATEGORY(*it, WhiteSpaceTokenType) ||
T_NEWLINE == token_id(*it))
while (IS_CATEGORY(*it, WhiteSpaceTokenType) ||
T_NEWLINE == token_id(*it))
{
if (T_NEWLINE == token_id(*it))
seen_newline = true;
@@ -476,7 +476,7 @@ skip_to_token(ContextT& ctx, IteratorT &it, IteratorT const &end,
///////////////////////////////////////////////////////////////////////////////
//
// Get the full name of a given macro name (concatenate the string
// Get the full name of a given macro name (concatenate the string
// representations of the single tokens).
//
///////////////////////////////////////////////////////////////////////////////
@@ -485,7 +485,7 @@ inline std::string
get_full_name(IteratorT const &begin, IteratorT const &end)
{
std::string full_name;
for (IteratorT err_it = begin; err_it != end; ++err_it)
for (IteratorT err_it = begin; err_it != end; ++err_it)
full_name += (*err_it).get_value().c_str();
return full_name;
@@ -516,7 +516,7 @@ private:
};
///////////////////////////////////////////////////////////////////////////////
// Convert a string of an arbitrary string compatible type to a internal
// Convert a string of an arbitrary string compatible type to a internal
// string (BOOST_WAVE_STRING)
template <typename Target, typename Src>
struct to_string_helper

View File

@@ -2,7 +2,7 @@
Boost.Wave: A Standard compliant C++ preprocessor library
Definition of the position_iterator and file_position templates
http://www.boost.org/
Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
@@ -52,7 +52,7 @@ public:
file_position()
: file(), line(1), column(1)
{}
explicit file_position(string_type const& file_, std::size_t line_ = 1,
explicit file_position(string_type const& file_, std::size_t line_ = 1,
std::size_t column_ = 1)
: file(file_), line(line_), column(column_)
{}
@@ -62,9 +62,9 @@ public:
std::size_t get_line() const { return line; }
std::size_t get_column() const { return column; }
void set_file(string_type const &file_)
{
file = file_;
void set_file(string_type const &file_)
{
file = file_;
}
void set_line(std::size_t line_) { line = line_; }
void set_column(std::size_t column_) { column = column_; }
@@ -88,10 +88,10 @@ private:
};
template <typename StringT>
bool operator== (file_position<StringT> const &lhs,
bool operator== (file_position<StringT> const &lhs,
file_position<StringT> const &rhs)
{
return lhs.get_column() == rhs.get_column() &&
return lhs.get_column() == rhs.get_column() &&
lhs.get_line() == rhs.get_line() && lhs.get_file() == rhs.get_file();
}
@@ -109,15 +109,15 @@ typedef file_position<BOOST_WAVE_STRINGTYPE> file_position_type;
//
// position_iterator
//
// The position_iterator used by Wave is now based on the corresponding Spirit
// The position_iterator used by Wave is now based on the corresponding Spirit
// type. This type is used with our own file_position though. The needed
// specialization of the boost::spirit::classic::position_policy class is
// specialization of the boost::spirit::classic::position_policy class is
// provided below.
//
///////////////////////////////////////////////////////////////////////////////
template <typename IteratorT, typename PositionT>
struct position_iterator
struct position_iterator
: boost::spirit::classic::position_iterator<IteratorT, PositionT>
{
typedef boost::spirit::classic::position_iterator<IteratorT, PositionT> base_type;
@@ -143,7 +143,7 @@ namespace spirit { namespace classic {
///////////////////////////////////////////////////////////////////////////////
//
// The boost::spirit::classic::position_policy has to be specialized for our
// The boost::spirit::classic::position_policy has to be specialized for our
// file_position class
//
///////////////////////////////////////////////////////////////////////////////
@@ -172,9 +172,9 @@ namespace spirit { namespace classic {
pos.set_column(pos.get_column() + 1);
}
void tabulation(boost::wave::util::file_position_type &pos)
void tabulation(boost::wave::util::file_position_type &pos)
{
pos.set_column(pos.get_column() + m_CharsPerTab -
pos.set_column(pos.get_column() + m_CharsPerTab -
(pos.get_column() - 1) % m_CharsPerTab);
}
@@ -185,7 +185,7 @@ namespace spirit { namespace classic {
///////////////////////////////////////////////////////////////////////////////
}} // namespace spirit::classic
} // namespace boost
} // namespace boost
// the suffix header occurs after all of the code
#ifdef BOOST_HAS_ABI_HEADERS

View File

@@ -59,7 +59,7 @@ namespace boost { namespace wave { namespace util
inline boost::filesystem::path normalize(boost::filesystem::path& p)
{
return p.normalize();
return p.normalize().make_preferred();
}
inline std::string native_file_string(boost::filesystem::path const& p)

File diff suppressed because it is too large Load Diff

View File

@@ -26,18 +26,18 @@ namespace wave {
namespace util {
///////////////////////////////////////////////////////////////////////////////
//
//
// class functor_input
//
// Implementation of the InputPolicy used by multi_pass
//
// Implementation of the InputPolicy used by multi_pass
// functor_input gets tokens from a functor
// Note: the functor must have a typedef for result_type
// It also must have a static variable of type result_type defined
// It also must have a static variable of type result_type defined
// to represent eof that is called eof.
//
// This functor input policy template is essentially the same as the
// predefined multi_pass functor_input policy. The difference is,
// that the first token is not read at initialization time, but only
// This functor input policy template is essentially the same as the
// predefined multi_pass functor_input policy. The difference is,
// that the first token is not read at initialization time, but only
// just before returning the first token. Additionally it does not
// call operator new() twice but only once.
//
@@ -54,10 +54,10 @@ struct functor_input {
private:
struct Data {
Data(FunctorT const &ftor_)
Data(FunctorT const &ftor_)
: ftor(ftor_), was_initialized(false)
{}
FunctorT ftor;
value_type curtok;
bool was_initialized;
@@ -145,7 +145,7 @@ struct functor_input {
///////////////////////////////////////////////////////////////////////////////
} // namespace util
} // namespace wave
} // namespace boost
} // namespace boost
// the suffix header occurs after all of the code
#ifdef BOOST_HAS_ABI_HEADERS

View File

@@ -2,7 +2,7 @@
Boost.Wave: A Standard compliant C++ preprocessor library
Detect the need to insert a whitespace token into the output stream
http://www.boost.org/
Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
@@ -12,8 +12,8 @@
#if !defined(INSERT_WHITESPACE_DETECTION_HPP_765EF77B_0513_4967_BDD6_6A38148C4C96_INCLUDED)
#define INSERT_WHITESPACE_DETECTION_HPP_765EF77B_0513_4967_BDD6_6A38148C4C96_INCLUDED
#include <boost/wave/wave_config.hpp>
#include <boost/wave/token_ids.hpp>
#include <boost/wave/wave_config.hpp>
#include <boost/wave/token_ids.hpp>
// this must occur after all of the includes and before any code appears
#ifdef BOOST_HAS_ABI_HEADERS
@@ -38,11 +38,11 @@ namespace impl {
return false;
if ('U' == value[0] && value.size() < 9)
return false;
typename StringT::size_type pos =
typename StringT::size_type pos =
value.find_first_not_of("0123456789abcdefABCDEF", 1);
if (StringT::npos == pos ||
if (StringT::npos == pos ||
('u' == value[0] && pos > 5) ||
('U' == value[0] && pos > 9))
{
@@ -51,12 +51,12 @@ namespace impl {
return false;
}
template <typename StringT>
inline bool
handle_identifier(boost::wave::token_id prev,
inline bool
handle_identifier(boost::wave::token_id prev,
boost::wave::token_id before, StringT const &value)
{
using namespace boost::wave;
switch (static_cast<unsigned int>(prev)) {
switch (prev) {
case T_IDENTIFIER:
case T_NONREPLACABLE_IDENTIFIER:
case T_COMPL_ALT:
@@ -75,19 +75,22 @@ namespace impl {
case T_INTLIT:
case T_PP_NUMBER:
return (value.size() > 1 || (value[0] != 'e' && value[0] != 'E'));
// avoid constructing universal characters (\u1234)
case TOKEN_FROM_ID('\\', UnknownTokenType):
case T_UNKNOWN_UNIVERSALCHAR:
return would_form_universal_char(value);
default:
break;
}
return false;
}
// T_INTLIT
inline bool
inline bool
handle_intlit(boost::wave::token_id prev, boost::wave::token_id /*before*/)
{
using namespace boost::wave;
switch (static_cast<unsigned int>(prev)) {
switch (prev) {
case T_IDENTIFIER:
case T_NONREPLACABLE_IDENTIFIER:
case T_INTLIT:
@@ -95,16 +98,19 @@ namespace impl {
case T_FIXEDPOINTLIT:
case T_PP_NUMBER:
return true;
default:
break;
}
return false;
}
// T_FLOATLIT
inline bool
handle_floatlit(boost::wave::token_id prev,
inline bool
handle_floatlit(boost::wave::token_id prev,
boost::wave::token_id /*before*/)
{
using namespace boost::wave;
switch (static_cast<unsigned int>(prev)) {
switch (prev) {
case T_IDENTIFIER:
case T_NONREPLACABLE_IDENTIFIER:
case T_INTLIT:
@@ -112,42 +118,51 @@ namespace impl {
case T_FIXEDPOINTLIT:
case T_PP_NUMBER:
return true;
default:
break;
}
return false;
}
// <% T_LEFTBRACE
inline bool
handle_alt_leftbrace(boost::wave::token_id prev,
inline bool
handle_alt_leftbrace(boost::wave::token_id prev,
boost::wave::token_id /*before*/)
{
using namespace boost::wave;
switch (static_cast<unsigned int>(prev)) {
switch (prev) {
case T_LESS: // <<%
case T_SHIFTLEFT: // <<<%
return true;
default:
break;
}
return false;
}
// <: T_LEFTBRACKET
inline bool
handle_alt_leftbracket(boost::wave::token_id prev,
inline bool
handle_alt_leftbracket(boost::wave::token_id prev,
boost::wave::token_id /*before*/)
{
using namespace boost::wave;
switch (static_cast<unsigned int>(prev)) {
switch (prev) {
case T_LESS: // <<:
case T_SHIFTLEFT: // <<<:
return true;
default:
break;
}
return false;
}
// T_FIXEDPOINTLIT
inline bool
handle_fixedpointlit(boost::wave::token_id prev,
inline bool
handle_fixedpointlit(boost::wave::token_id prev,
boost::wave::token_id /*before*/)
{
using namespace boost::wave;
switch (static_cast<unsigned int>(prev)) {
switch (prev) {
case T_IDENTIFIER:
case T_NONREPLACABLE_IDENTIFIER:
case T_INTLIT:
@@ -155,55 +170,67 @@ namespace impl {
case T_FIXEDPOINTLIT:
case T_PP_NUMBER:
return true;
default:
break;
}
return false;
}
// T_DOT
inline bool
inline bool
handle_dot(boost::wave::token_id prev, boost::wave::token_id before)
{
using namespace boost::wave;
switch (static_cast<unsigned int>(prev)) {
switch (prev) {
case T_DOT:
if (T_DOT == before)
return true; // ...
break;
default:
break;
}
return false;
}
// T_QUESTION_MARK
inline bool
handle_questionmark(boost::wave::token_id prev,
inline bool
handle_questionmark(boost::wave::token_id prev,
boost::wave::token_id /*before*/)
{
using namespace boost::wave;
switch(static_cast<unsigned int>(prev)) {
case TOKEN_FROM_ID('\\', UnknownTokenType): // \?
switch(prev) {
case T_UNKNOWN_UNIVERSALCHAR: // \?
case T_QUESTION_MARK: // ??
return true;
default:
break;
}
return false;
}
// T_NEWLINE
inline bool
handle_newline(boost::wave::token_id prev,
handle_newline(boost::wave::token_id prev,
boost::wave::token_id before)
{
using namespace boost::wave;
switch(static_cast<unsigned int>(prev)) {
switch(prev) {
case TOKEN_FROM_ID('\\', UnknownTokenType): // \ \n
case T_DIVIDE:
if (T_QUESTION_MARK == before)
return true; // ?/\n // may be \\n
break;
default:
break;
}
return false;
}
inline bool
inline bool
handle_parens(boost::wave::token_id prev)
{
switch (static_cast<unsigned int>(prev)) {
switch (prev) {
case T_LEFTPAREN:
case T_RIGHTPAREN:
case T_LEFTBRACKET:
@@ -214,56 +241,56 @@ namespace impl {
case T_COMMA:
case T_COLON:
// no insertion between parens/brackets/braces and operators
return false;
return false;
default:
break;
}
return true;
}
} // namespace impl
class insert_whitespace_detection
class insert_whitespace_detection
{
public:
insert_whitespace_detection(bool insert_whitespace_ = true)
insert_whitespace_detection(bool insert_whitespace_ = true)
: insert_whitespace(insert_whitespace_),
prev(boost::wave::T_EOF), beforeprev(boost::wave::T_EOF)
prev(boost::wave::T_EOF), beforeprev(boost::wave::T_EOF)
{}
template <typename StringT>
bool must_insert(boost::wave::token_id current, StringT const &value)
{
if (!insert_whitespace)
return false; // skip whitespace insertion alltogether
using namespace boost::wave;
switch (static_cast<unsigned int>(current)) {
switch (current) {
case T_NONREPLACABLE_IDENTIFIER:
case T_IDENTIFIER:
return impl::handle_identifier(prev, beforeprev, value);
case T_IDENTIFIER:
return impl::handle_identifier(prev, beforeprev, value);
case T_PP_NUMBER:
case T_INTLIT:
return impl::handle_intlit(prev, beforeprev);
return impl::handle_intlit(prev, beforeprev);
case T_FLOATLIT:
return impl::handle_floatlit(prev, beforeprev);
return impl::handle_floatlit(prev, beforeprev);
case T_STRINGLIT:
if (TOKEN_FROM_ID('L', IdentifierTokenType) == prev) // 'L'
return true;
break;
case T_LEFTBRACE_ALT:
return impl::handle_alt_leftbrace(prev, beforeprev);
return impl::handle_alt_leftbrace(prev, beforeprev);
case T_LEFTBRACKET_ALT:
return impl::handle_alt_leftbracket(prev, beforeprev);
return impl::handle_alt_leftbracket(prev, beforeprev);
case T_FIXEDPOINTLIT:
return impl::handle_fixedpointlit(prev, beforeprev);
return impl::handle_fixedpointlit(prev, beforeprev);
case T_DOT:
return impl::handle_dot(prev, beforeprev);
return impl::handle_dot(prev, beforeprev);
case T_QUESTION_MARK:
return impl::handle_questionmark(prev, beforeprev);
return impl::handle_questionmark(prev, beforeprev);
case T_NEWLINE:
return impl::handle_newline(prev, beforeprev);
return impl::handle_newline(prev, beforeprev);
case T_LEFTPAREN:
case T_RIGHTPAREN:
@@ -272,7 +299,7 @@ public:
case T_SEMICOLON:
case T_COMMA:
case T_COLON:
switch (static_cast<unsigned int>(prev)) {
switch (prev) {
case T_LEFTPAREN:
case T_RIGHTPAREN:
case T_LEFTBRACKET:
@@ -285,12 +312,12 @@ public:
if (IS_CATEGORY(prev, OperatorTokenType))
return false;
break;
}
}
break;
case T_LEFTBRACE:
case T_RIGHTBRACE:
switch (static_cast<unsigned int>(prev)) {
switch (prev) {
case T_LEFTPAREN:
case T_RIGHTPAREN:
case T_LEFTBRACKET:
@@ -308,12 +335,12 @@ public:
if (IS_CATEGORY(prev, OperatorTokenType))
return false;
break;
default:
break;
}
break;
case T_MINUS:
case T_MINUSMINUS:
case T_MINUSASSIGN:
@@ -324,7 +351,7 @@ public:
if (T_QUESTION_MARK == prev && T_QUESTION_MARK == beforeprev)
return true;
break;
case T_PLUS:
case T_PLUSPLUS:
case T_PLUSASSIGN:
@@ -335,7 +362,7 @@ public:
if (T_QUESTION_MARK == prev && T_QUESTION_MARK == beforeprev)
return true;
break;
case T_DIVIDE:
case T_DIVIDEASSIGN:
if (T_DIVIDE == prev)
@@ -345,10 +372,10 @@ public:
if (T_QUESTION_MARK == prev && T_QUESTION_MARK == beforeprev)
return true;
break;
case T_EQUAL:
case T_ASSIGN:
switch (static_cast<unsigned int>(prev)) {
switch (prev) {
case T_PLUSASSIGN:
case T_MINUSASSIGN:
case T_DIVIDEASSIGN:
@@ -379,7 +406,7 @@ public:
if (T_QUESTION_MARK == beforeprev)
return true;
break;
default:
if (!impl::handle_parens(prev))
return false;
@@ -416,21 +443,21 @@ public:
if (T_AND == prev || T_ANDAND == prev)
return true;
break;
case T_OR:
if (!impl::handle_parens(prev))
return false;
if (T_OR == prev)
return true;
break;
case T_XOR:
if (!impl::handle_parens(prev))
return false;
if (T_XOR == prev)
return true;
break;
case T_COMPL_ALT:
case T_OR_ALT:
case T_AND_ALT:
@@ -440,7 +467,7 @@ public:
case T_ORASSIGN_ALT:
case T_XORASSIGN_ALT:
case T_NOTEQUAL_ALT:
switch (static_cast<unsigned int>(prev)) {
switch (prev) {
case T_LEFTPAREN:
case T_RIGHTPAREN:
case T_LEFTBRACKET:
@@ -451,7 +478,7 @@ public:
case T_COMMA:
case T_COLON:
// no insertion between parens/brackets/braces and operators
return false;
return false;
case T_IDENTIFIER:
if (T_NONREPLACABLE_IDENTIFIER == prev ||
@@ -460,16 +487,16 @@ public:
return true;
}
break;
default:
break;
}
break;
case T_STAR:
if (T_STAR == prev)
return false; // '*****' do not need to be separated
if (T_GREATER== prev &&
if (T_GREATER== prev &&
(T_MINUS == beforeprev || T_MINUSMINUS == beforeprev)
)
{
@@ -481,10 +508,13 @@ public:
if (T_POUND == prev)
return true;
break;
default:
break;
}
// FIXME: else, handle operators separately (will catch to many cases)
// if (IS_CATEGORY(current, OperatorTokenType) &&
// if (IS_CATEGORY(current, OperatorTokenType) &&
// IS_CATEGORY(prev, OperatorTokenType))
// {
// return true; // operators must be delimited always
@@ -498,7 +528,7 @@ public:
prev = next_id;
}
}
private:
bool insert_whitespace; // enable this component
boost::wave::token_id prev; // the previous analyzed token
@@ -507,7 +537,7 @@ private:
///////////////////////////////////////////////////////////////////////////////
} // namespace util
} // namespace wave
} // namespace wave
} // namespace boost
// the suffix header occurs after all of the code

View File

@@ -47,12 +47,12 @@ namespace util {
///////////////////////////////////////////////////////////////////////////////
//
// The function interpret_pragma interprets the given token sequence as the
// body of a #pragma directive (or parameter to the _Pragma operator) and
// body of a #pragma directive (or parameter to the _Pragma operator) and
// executes the actions associated with recognized Wave specific options.
//
///////////////////////////////////////////////////////////////////////////////
template <typename ContextT, typename IteratorT, typename ContainerT>
inline bool
inline bool
interpret_pragma(ContextT &ctx, typename ContextT::token_type const &act_token,
IteratorT it, IteratorT const &end, ContainerT &pending)
{
@@ -62,44 +62,44 @@ interpret_pragma(ContextT &ctx, typename ContextT::token_type const &act_token,
using namespace cpplexer;
if (T_IDENTIFIER == token_id(*it)) {
// check for pragma wave ...
if ((*it).get_value() == BOOST_WAVE_PRAGMA_KEYWORD)
if ((*it).get_value() == BOOST_WAVE_PRAGMA_KEYWORD)
{
// this is a wave specific option, it should have the form:
//
// #pragma command option(value)
//
// where
// where
// 'command' is the value of the preprocessor constant
// BOOST_WAVE_PRAGMA_KEYWORD (defaults to "wave") and
// '(value)' is required only for some pragma directives (this is
// '(value)' is required only for some pragma directives (this is
// optional)
//
// All recognized #pragma operators are forwarded to the supplied
// All recognized #pragma operators are forwarded to the supplied
// preprocessing hook.
using namespace boost::spirit::classic;
token_type option;
ContainerT values;
if (!parse (++it, end,
if (!parse (++it, end,
( ch_p(T_IDENTIFIER)
[
spirit_assign_actor(option)
]
| pattern_p(KeywordTokenType,
]
| pattern_p(KeywordTokenType,
TokenTypeMask|PPTokenFlag)
[
spirit_assign_actor(option)
]
| pattern_p(OperatorTokenType|AltExtTokenType,
]
| pattern_p(OperatorTokenType|AltExtTokenType,
ExtTokenTypeMask|PPTokenFlag) // and, bit_and etc.
[
spirit_assign_actor(option)
]
| pattern_p(BoolLiteralTokenType,
]
| pattern_p(BoolLiteralTokenType,
TokenTypeMask|PPTokenFlag)
[
spirit_assign_actor(option)
]
]
)
>> !comment_nest_p(
ch_p(T_LEFTPAREN),
@@ -109,7 +109,7 @@ interpret_pragma(ContextT &ctx, typename ContextT::token_type const &act_token,
{
typename ContextT::string_type msg(
impl::as_string<string_type>(it, end));
BOOST_WAVE_THROW_CTX(ctx, preprocess_exception,
BOOST_WAVE_THROW_CTX(ctx, preprocess_exception,
ill_formed_pragma_option,
msg.c_str(), act_token.get_position());
return false;
@@ -125,9 +125,9 @@ interpret_pragma(ContextT &ctx, typename ContextT::token_type const &act_token,
// decode the option (call the context_policy hook)
if (!ctx.get_hooks().interpret_pragma(
ctx.derived(), pending, option, values, act_token))
ctx.derived(), pending, option, values, act_token))
{
// unknown #pragma option
// unknown #pragma option
string_type option_str ((*it).get_value());
option_str += option.get_value();
@@ -136,7 +136,7 @@ interpret_pragma(ContextT &ctx, typename ContextT::token_type const &act_token,
option_str += impl::as_string(values);
option_str += ")";
}
BOOST_WAVE_THROW_CTX(ctx, preprocess_exception,
BOOST_WAVE_THROW_CTX(ctx, preprocess_exception,
ill_formed_pragma_option,
option_str.c_str(), act_token.get_position());
return false;
@@ -148,15 +148,15 @@ interpret_pragma(ContextT &ctx, typename ContextT::token_type const &act_token,
// #pragma once
return ctx.add_pragma_once_header(act_token, ctx.get_current_filename());
}
#endif
#endif
#if BOOST_WAVE_SUPPORT_PRAGMA_MESSAGE != 0
else if ((*it).get_value() == "message") {
// #pragma message(...) or #pragma message ...
using namespace boost::spirit::classic;
ContainerT values;
if (!parse (++it, end,
( ( ch_p(T_LEFTPAREN)
if (!parse (++it, end,
( ( ch_p(T_LEFTPAREN)
>> lexeme_d[
*(anychar_p[spirit_append_actor(values)] - ch_p(T_RIGHTPAREN))
]
@@ -172,7 +172,7 @@ interpret_pragma(ContextT &ctx, typename ContextT::token_type const &act_token,
{
typename ContextT::string_type msg(
impl::as_string<string_type>(it, end));
BOOST_WAVE_THROW_CTX(ctx, preprocess_exception,
BOOST_WAVE_THROW_CTX(ctx, preprocess_exception,
ill_formed_pragma_message,
msg.c_str(), act_token.get_position());
return false;
@@ -187,8 +187,8 @@ interpret_pragma(ContextT &ctx, typename ContextT::token_type const &act_token,
// output the message itself
typename ContextT::string_type msg(impl::as_string(values));
BOOST_WAVE_THROW_CTX(ctx, preprocess_exception,
pragma_message_directive,
BOOST_WAVE_THROW_CTX(ctx, preprocess_exception,
pragma_message_directive,
msg.c_str(), act_token.get_position());
return false;
}

View File

@@ -40,7 +40,7 @@ namespace util {
//
// macro_definition
//
// This class containes all infos for a defined macro.
// This class containes all infos for a defined macro.
//
///////////////////////////////////////////////////////////////////////////////
template <typename TokenT, typename ContainerT>
@@ -49,14 +49,14 @@ struct macro_definition {
typedef std::vector<TokenT> parameter_container_type;
typedef ContainerT definition_container_type;
typedef typename parameter_container_type::const_iterator
typedef typename parameter_container_type::const_iterator
const_parameter_iterator_t;
typedef typename definition_container_type::const_iterator
typedef typename definition_container_type::const_iterator
const_definition_iterator_t;
macro_definition(TokenT const &token_, bool has_parameters,
macro_definition(TokenT const &token_, bool has_parameters,
bool is_predefined_, long uid_)
: macroname(token_), uid(uid_), is_functionlike(has_parameters),
: macroname(token_), uid(uid_), is_functionlike(has_parameters),
replaced_parameters(false), is_available_for_replacement(true),
is_predefined(is_predefined_)
#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
@@ -79,29 +79,29 @@ struct macro_definition {
if (!replaced_parameters) {
typename definition_container_type::iterator end = macrodefinition.end();
typename definition_container_type::iterator it = macrodefinition.begin();
typename definition_container_type::iterator it = macrodefinition.begin();
for (/**/; it != end; ++it) {
token_id id = *it;
if (T_IDENTIFIER == id ||
if (T_IDENTIFIER == id ||
IS_CATEGORY(id, KeywordTokenType) ||
IS_EXTCATEGORY(id, OperatorTokenType|AltExtTokenType) ||
IS_CATEGORY(id, OperatorTokenType))
IS_CATEGORY(id, OperatorTokenType))
{
// may be a parameter to replace
const_parameter_iterator_t cend = macroparameters.end();
const_parameter_iterator_t cit = macroparameters.begin();
for (typename parameter_container_type::size_type i = 0;
cit != cend; ++cit, ++i)
for (typename parameter_container_type::size_type i = 0;
cit != cend; ++cit, ++i)
{
if ((*it).get_value() == (*cit).get_value()) {
(*it).set_token_id(token_id(T_PARAMETERBASE+i));
break;
}
#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
else if (T_ELLIPSIS == token_id(*cit) &&
"__VA_ARGS__" == (*it).get_value())
else if (T_ELLIPSIS == token_id(*cit) &&
"__VA_ARGS__" == (*it).get_value())
{
// __VA_ARGS__ requires special handling
(*it).set_token_id(token_id(T_EXTPARAMETERBASE+i));
@@ -112,14 +112,14 @@ struct macro_definition {
}
}
#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
// we need to know, if the last of the formal arguments is an ellipsis
if (macroparameters.size() > 0 &&
T_ELLIPSIS == token_id(macroparameters.back()))
T_ELLIPSIS == token_id(macroparameters.back()))
{
has_ellipsis = true;
}
#endif
#endif
replaced_parameters = true; // do it only once
}
}
@@ -139,7 +139,7 @@ struct macro_definition {
#if BOOST_WAVE_SERIALIZATION != 0
// default constructor is needed for serialization only
macro_definition()
macro_definition()
: uid(0), is_functionlike(false), replaced_parameters(false),
is_available_for_replacement(false), is_predefined(false)
#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0

View File

@@ -41,8 +41,8 @@ namespace impl {
typename StringT::size_type pos1 = value.find_first_of ("\"\\?", 0);
if (StringT::npos != pos1) {
do {
result += value.substr(pos, pos1-pos)
+ StringT("\\")
result += value.substr(pos, pos1-pos)
+ StringT("\\")
+ StringT(1, value[pos1]);
pos1 = value.find_first_of ("\"\\?", pos = pos1+1);
} while (StringT::npos != pos1);
@@ -104,16 +104,16 @@ namespace impl {
string_type result("\"");
bool was_whitespace = false;
typename ContainerT::const_iterator end = token_sequence.end();
for (typename ContainerT::const_iterator it = token_sequence.begin();
it != end; ++it)
for (typename ContainerT::const_iterator it = token_sequence.begin();
it != end; ++it)
{
token_id id = token_id(*it);
if (IS_CATEGORY(*it, WhiteSpaceTokenType) || T_NEWLINE == id) {
if (!was_whitespace) {
// C++ standard 16.3.2.2 [cpp.stringize]
// Each occurrence of white space between the argument's
// preprocessing tokens becomes a single space character in the
// Each occurrence of white space between the argument's
// preprocessing tokens becomes a single space character in the
// character string literal.
result += " ";
was_whitespace = true;
@@ -124,10 +124,10 @@ namespace impl {
result += impl::escape_lit((*it).get_value());
was_whitespace = false;
}
else
else
#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
if (T_PLACEMARKER != id)
#endif
if (T_PLACEMARKER != id)
#endif
{
// now append this token to the string
result += (*it).get_value();
@@ -138,8 +138,8 @@ namespace impl {
// validate the resulting literal to contain no invalid universal character
// value (throws if invalid chars found)
boost::wave::cpplexer::impl::validate_literal(result, pos.get_line(),
pos.get_column(), pos.get_file());
boost::wave::cpplexer::impl::validate_literal(result, pos.get_line(),
pos.get_column(), pos.get_file());
return result;
}
@@ -147,7 +147,7 @@ namespace impl {
// return the string representation of a token sequence
template <typename ContainerT, typename PositionT>
inline typename ContainerT::value_type::string_type
as_stringlit (std::vector<ContainerT> const &arguments,
as_stringlit (std::vector<ContainerT> const &arguments,
typename std::vector<ContainerT>::size_type i, PositionT const &pos)
{
using namespace boost::wave;
@@ -161,16 +161,16 @@ namespace impl {
for (/**/; i < arguments.size(); ++i) {
// stringize all remaining arguments
typename ContainerT::const_iterator end = arguments[i].end();
for (typename ContainerT::const_iterator it = arguments[i].begin();
it != end; ++it)
for (typename ContainerT::const_iterator it = arguments[i].begin();
it != end; ++it)
{
token_id id = token_id(*it);
if (IS_CATEGORY(*it, WhiteSpaceTokenType) || T_NEWLINE == id) {
if (!was_whitespace) {
// C++ standard 16.3.2.2 [cpp.stringize]
// Each occurrence of white space between the argument's
// preprocessing tokens becomes a single space character in the
// Each occurrence of white space between the argument's
// preprocessing tokens becomes a single space character in the
// character string literal.
result += " ";
was_whitespace = true;
@@ -198,8 +198,8 @@ namespace impl {
// validate the resulting literal to contain no invalid universal character
// value (throws if invalid chars found)
boost::wave::cpplexer::impl::validate_literal(result, pos.get_line(),
pos.get_column(), pos.get_file());
boost::wave::cpplexer::impl::validate_literal(result, pos.get_line(),
pos.get_column(), pos.get_file());
return result;
}
#endif // BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
@@ -210,7 +210,7 @@ namespace impl {
as_string(IteratorT it, IteratorT const& end)
{
StringT result;
for (/**/; it != end; ++it)
for (/**/; it != end; ++it)
{
result += (*it).get_value();
}
@@ -223,32 +223,32 @@ namespace impl {
as_string (ContainerT const &token_sequence)
{
typedef typename ContainerT::value_type::string_type string_type;
return as_string<string_type>(token_sequence.begin(),
return as_string<string_type>(token_sequence.begin(),
token_sequence.end());
}
#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
///////////////////////////////////////////////////////////////////////////
//
// Copies all arguments beginning with the given index to the output
// Copies all arguments beginning with the given index to the output
// sequence. The arguments are separated by commas.
//
template <typename ContainerT, typename PositionT>
void replace_ellipsis (std::vector<ContainerT> const &arguments,
typename ContainerT::size_type index,
typename ContainerT::size_type index,
ContainerT &expanded, PositionT const &pos)
{
using namespace cpplexer;
typedef typename ContainerT::value_type token_type;
token_type comma(T_COMMA, ",", pos);
for (/**/; index < arguments.size(); ++index) {
ContainerT const &arg = arguments[index];
std::copy(arg.begin(), arg.end(),
std::copy(arg.begin(), arg.end(),
std::inserter(expanded, expanded.end()));
if (index < arguments.size()-1)
if (index < arguments.size()-1)
expanded.push_back(comma);
}
}
@@ -257,7 +257,7 @@ namespace impl {
// Skip all whitespace characters and queue the skipped characters into the
// given container
template <typename IteratorT>
inline boost::wave::token_id
inline boost::wave::token_id
skip_whitespace(IteratorT &first, IteratorT const &last)
{
token_id id = util::impl::next_token<IteratorT>::peek(first, last, false);
@@ -272,7 +272,7 @@ namespace impl {
}
template <typename IteratorT, typename ContainerT>
inline boost::wave::token_id
inline boost::wave::token_id
skip_whitespace(IteratorT &first, IteratorT const &last, ContainerT &queue)
{
queue.push_back (*first); // queue up the current token
@@ -280,7 +280,7 @@ namespace impl {
token_id id = util::impl::next_token<IteratorT>::peek(first, last, false);
if (IS_CATEGORY(id, WhiteSpaceTokenType)) {
do {
queue.push_back(*++first); // queue up the next whitespace
queue.push_back(*++first); // queue up the next whitespace
id = util::impl::next_token<IteratorT>::peek(first, last, false);
} while (IS_CATEGORY(id, WhiteSpaceTokenType));
}

View File

@@ -2,7 +2,7 @@
Boost.Wave: A Standard compliant C++ preprocessor library
Global application configuration
http://www.boost.org/
Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
@@ -32,12 +32,12 @@ namespace util {
//
///////////////////////////////////////////////////////////////////////////
template <typename CharT = char>
struct pattern_and
struct pattern_and
: public boost::spirit::classic::char_parser<pattern_and<CharT> >
{
pattern_and(CharT pattern_, unsigned long pattern_mask_ = 0UL)
: pattern(pattern_),
pattern_mask((0UL != pattern_mask_) ?
: pattern(pattern_),
pattern_mask((0UL != pattern_mask_) ?
pattern_mask_ : (unsigned long)pattern_)
{}

View File

@@ -14,14 +14,14 @@
#include <map>
#include <boost/wave/wave_config.hpp>
#include <boost/intrusive_ptr.hpp>
#include <boost/intrusive_ptr.hpp>
#if BOOST_WAVE_SERIALIZATION != 0
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/map.hpp>
#include <boost/shared_ptr.hpp>
#else
#include <boost/intrusive_ptr.hpp>
#include <boost/intrusive_ptr.hpp>
#endif
#include <boost/iterator/transform_iterator.hpp>
@@ -38,16 +38,16 @@ namespace util {
///////////////////////////////////////////////////////////////////////////////
//
// The symbol_table class is used for the storage of defined macros.
// The symbol_table class is used for the storage of defined macros.
//
///////////////////////////////////////////////////////////////////////////////
template <typename StringT, typename MacroDefT>
struct symbol_table
struct symbol_table
#if BOOST_WAVE_SERIALIZATION != 0
: public std::map<StringT, boost::shared_ptr<MacroDefT> >
: public std::map<StringT, boost::shared_ptr<MacroDefT> >
#else
: public std::map<StringT, boost::intrusive_ptr<MacroDefT> >
: public std::map<StringT, boost::intrusive_ptr<MacroDefT> >
#endif
{
#if BOOST_WAVE_SERIALIZATION != 0
@@ -58,7 +58,7 @@ struct symbol_table
typedef typename base_type::iterator iterator_type;
typedef typename base_type::const_iterator const_iterator_type;
symbol_table(long uid_ = 0)
symbol_table(long uid_ = 0)
{}
#if BOOST_WAVE_SERIALIZATION != 0
@@ -68,7 +68,7 @@ private:
void serialize(Archive &ar, const unsigned int version)
{
using namespace boost::serialization;
ar & make_nvp("symbol_table",
ar & make_nvp("symbol_table",
boost::serialization::base_object<base_type>(*this));
}
#endif
@@ -76,7 +76,7 @@ private:
private:
///////////////////////////////////////////////////////////////////////////
//
// This is a special iterator allowing to iterate the names of all defined
// This is a special iterator allowing to iterate the names of all defined
// macros.
//
///////////////////////////////////////////////////////////////////////////
@@ -94,13 +94,13 @@ private:
typedef get_first<StringT> unary_functor;
public:
typedef transform_iterator<unary_functor, iterator_type>
typedef transform_iterator<unary_functor, iterator_type>
name_iterator;
typedef transform_iterator<unary_functor, const_iterator_type>
typedef transform_iterator<unary_functor, const_iterator_type>
const_name_iterator;
template <typename Iterator>
static
static
transform_iterator<unary_functor, Iterator> make_iterator(Iterator it)
{
return boost::make_transform_iterator<unary_functor>(it);

View File

@@ -38,7 +38,7 @@ namespace util {
namespace time_conversion {
using namespace std; // some systems have std::tm etc. in namespace std
///////////////////////////////////////////////////////////////////////////////
// define, whether the rule's should generate some debug output
#define TRACE_CPP_TIME_CONVERSION \
@@ -47,7 +47,7 @@ namespace time_conversion {
///////////////////////////////////////////////////////////////////////////////
// Grammar for parsing a date/time string generated by the C++ compiler from
// __DATE__ and __TIME__
// __DATE__ and __TIME__
class time_conversion_grammar :
public boost::spirit::classic::grammar<time_conversion_grammar>
{
@@ -59,17 +59,17 @@ namespace time_conversion {
BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME(*this, "time_conversion_grammar",
TRACE_CPP_TIME_CONVERSION);
}
template <typename ScannerT>
struct definition {
definition(time_conversion_grammar const &self)
{
using boost::spirit::classic::int_p;
using boost::spirit::classic::add;
char const *m[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
@@ -77,26 +77,26 @@ namespace time_conversion {
add (month, m[i], i);
time_rule // expected format is 'Dec 29 2001 11:23:59'
= month[spirit_assign_actor(self.time_stamp.tm_mon)]
>> int_p[spirit_assign_actor(self.time_stamp.tm_mday)]
= month[spirit_assign_actor(self.time_stamp.tm_mon)]
>> int_p[spirit_assign_actor(self.time_stamp.tm_mday)]
>> int_p[spirit_assign_actor(self.time_stamp.tm_year)]
>> int_p[spirit_assign_actor(self.time_stamp.tm_hour)] >> ':'
>> int_p[spirit_assign_actor(self.time_stamp.tm_hour)] >> ':'
>> int_p[spirit_assign_actor(self.time_stamp.tm_min)] >> ':'
>> int_p[spirit_assign_actor(self.time_stamp.tm_sec)]
;
BOOST_SPIRIT_DEBUG_TRACE_RULE(time_rule, TRACE_CPP_TIME_CONVERSION);
}
boost::spirit::classic::rule<ScannerT> time_rule;
boost::spirit::classic::symbols<> month;
boost::spirit::classic::rule<ScannerT> const&
start() const { return time_rule; }
};
void correct_year()
{
void correct_year()
{
if (!fYearIsCorrected) {
time_stamp.tm_year -= 1900;
fYearIsCorrected = true;
@@ -106,36 +106,36 @@ namespace time_conversion {
mutable tm time_stamp;
bool fYearIsCorrected;
};
///////////////////////////////////////////////////////////////////////////////
// calculate the time of the compilation as a std::time_t to ensure correctness
// of the saved dfa table
// calculate the time of the compilation as a std::time_t to ensure correctness
// of the saved dfa table
class time_conversion_helper
{
public:
time_conversion_helper(char const *act_time) : compile_time(0)
{
using namespace boost::spirit::classic;
time_conversion_grammar g;
parse_info<> pi = parse (act_time, g, space_p);
if (pi.hit) {
g.correct_year();
compile_time = mktime(&g.time_stamp);
}
BOOST_ASSERT(0 != compile_time);
BOOST_ASSERT(0 != compile_time);
}
time_t get_time() const { return compile_time; }
private:
time_t compile_time;
time_t compile_time;
};
///////////////////////////////////////////////////////////////////////////////
#undef TRACE_CPP_TIME_CONVERSION
} // namespace time_conversion
} // namespace time_conversion
// import time_conversion into the boost::wave::util namespace
using namespace time_conversion;

View File

@@ -24,12 +24,12 @@
///////////////////////////////////////////////////////////////////////////////
namespace boost {
namespace wave {
namespace wave {
namespace impl {
///////////////////////////////////////////////////////////////////////////////
//
// The new Boost.Iterator library already conatins a transform_iterator usable
// The new Boost.Iterator library already conatins a transform_iterator usable
// for our needs. The code below wraps this up.
//
///////////////////////////////////////////////////////////////////////////////
@@ -46,7 +46,7 @@ namespace impl {
};
template <class AdaptableUnaryFunctionT, class IteratorT>
inline
inline
typename ref_transform_iterator_generator<
AdaptableUnaryFunctionT, IteratorT>::type
make_ref_transform_iterator(
@@ -68,9 +68,9 @@ namespace impl {
typedef ParseTreeNodeT const &argument_type;
static result_type
transform (argument_type node)
transform (argument_type node)
{
BOOST_ASSERT(1 == std::distance(node.value.begin(),
BOOST_ASSERT(1 == std::distance(node.value.begin(),
node.value.end()));
return *node.value.begin();
}

View File

@@ -2,7 +2,7 @@
Boost.Wave: A Standard compliant C++ preprocessor library
Definition of the unput queue iterator
http://www.boost.org/
Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
@@ -18,7 +18,7 @@
#include <boost/iterator_adaptors.hpp>
#include <boost/wave/wave_config.hpp>
#include <boost/wave/token_ids.hpp> // token_id
#include <boost/wave/token_ids.hpp> // token_id
// this must occur after all of the includes and before any code appears
#ifdef BOOST_HAS_ABI_HEADERS
@@ -42,13 +42,13 @@ namespace util {
//
///////////////////////////////////////////////////////////////////////////////
template <typename IteratorT, typename TokenT, typename ContainerT>
class unput_queue_iterator
class unput_queue_iterator
: public boost::iterator_adaptor<
unput_queue_iterator<IteratorT, TokenT, ContainerT>,
unput_queue_iterator<IteratorT, TokenT, ContainerT>,
IteratorT, TokenT const, std::forward_iterator_tag>
{
typedef boost::iterator_adaptor<
unput_queue_iterator<IteratorT, TokenT, ContainerT>,
unput_queue_iterator<IteratorT, TokenT, ContainerT>,
IteratorT, TokenT const, std::forward_iterator_tag>
base_type;
@@ -59,62 +59,62 @@ public:
unput_queue_iterator(IteratorT const &it, ContainerT &queue)
: base_type(it), unput_queue(queue)
{}
ContainerT &get_unput_queue()
ContainerT &get_unput_queue()
{ return unput_queue; }
ContainerT const &get_unput_queue() const
ContainerT const &get_unput_queue() const
{ return unput_queue; }
IteratorT &get_base_iterator()
IteratorT &get_base_iterator()
{ return base_type::base_reference(); }
IteratorT const &get_base_iterator() const
IteratorT const &get_base_iterator() const
{ return base_type::base_reference(); }
unput_queue_iterator &operator= (unput_queue_iterator const &rhs)
{
{
if (this != &rhs) {
unput_queue = rhs.unput_queue;
unput_queue = rhs.unput_queue;
base_type::operator=(rhs);
}
return *this;
return *this;
}
typename base_type::reference dereference() const
{
if (!unput_queue.empty())
return unput_queue.front();
return *base_type::base_reference();
return *base_type::base_reference();
}
void increment()
{
{
if (!unput_queue.empty()) {
// there exist pending tokens in the unput queue
unput_queue.pop_front();
}
else {
// the unput_queue is empty, so advance the base iterator
++base_type::base_reference();
++base_type::base_reference();
}
}
template <
typename OtherDerivedT, typename OtherIteratorT,
typename OtherDerivedT, typename OtherIteratorT,
typename V, typename C, typename R, typename D
>
>
bool equal(
boost::iterator_adaptor<OtherDerivedT, OtherIteratorT, V, C, R, D>
boost::iterator_adaptor<OtherDerivedT, OtherIteratorT, V, C, R, D>
const &x) const
{
// two iterators are equal, if both begin() iterators of the queue
// two iterators are equal, if both begin() iterators of the queue
// objects are equal and the base iterators are equal as well
OtherDerivedT const &rhs = static_cast<OtherDerivedT const &>(x);
return
return
((unput_queue.empty() && rhs.unput_queue.empty()) ||
(&unput_queue == &rhs.unput_queue &&
unput_queue.begin() == rhs.unput_queue.begin()
)
) &&
(get_base_iterator() == rhs.get_base_iterator());
(get_base_iterator() == rhs.get_base_iterator());
}
private:
@@ -125,11 +125,11 @@ namespace impl {
///////////////////////////////////////////////////////////////////////////
template <typename IteratorT, typename TokenT, typename ContainerT>
struct gen_unput_queue_iterator
struct gen_unput_queue_iterator
{
typedef ContainerT container_type;
typedef IteratorT iterator_type;
typedef unput_queue_iterator<IteratorT, TokenT, ContainerT>
typedef unput_queue_iterator<IteratorT, TokenT, ContainerT>
return_type;
static container_type last;
@@ -149,32 +149,32 @@ namespace impl {
template <typename IteratorT, typename TokenT, typename ContainerT>
typename gen_unput_queue_iterator<IteratorT, TokenT, ContainerT>::
container_type
gen_unput_queue_iterator<IteratorT, TokenT, ContainerT>::last =
container_type
gen_unput_queue_iterator<IteratorT, TokenT, ContainerT>::last =
typename gen_unput_queue_iterator<IteratorT, TokenT, ContainerT>::
container_type();
///////////////////////////////////////////////////////////////////////////
template <typename IteratorT, typename TokenT, typename ContainerT>
struct gen_unput_queue_iterator<
unput_queue_iterator<IteratorT, TokenT, ContainerT>,
TokenT, ContainerT>
unput_queue_iterator<IteratorT, TokenT, ContainerT>,
TokenT, ContainerT>
{
typedef ContainerT container_type;
typedef unput_queue_iterator<IteratorT, TokenT, ContainerT>
typedef unput_queue_iterator<IteratorT, TokenT, ContainerT>
iterator_type;
typedef unput_queue_iterator<IteratorT, TokenT, ContainerT>
typedef unput_queue_iterator<IteratorT, TokenT, ContainerT>
return_type;
static container_type last;
static return_type
static return_type
generate(iterator_type &it)
{
return return_type(it.base(), last);
}
static return_type
static return_type
generate(ContainerT &queue, iterator_type &it)
{
return return_type(it.base(), queue);
@@ -183,9 +183,9 @@ namespace impl {
///////////////////////////////////////////////////////////////////////////
template <typename IteratorT>
struct assign_iterator
struct assign_iterator
{
static void
static void
do_ (IteratorT &dest, IteratorT const &src)
{
dest = src;
@@ -198,9 +198,9 @@ namespace impl {
// Note though, that the embedded unput_queues are not touched in any way!
//
template <typename IteratorT>
struct next_token
struct next_token
{
static boost::wave::token_id
static boost::wave::token_id
peek(IteratorT it, IteratorT end, bool skip_whitespace = true)
{
using namespace boost::wave;
@@ -216,7 +216,7 @@ namespace impl {
else {
++it; // we have at least to look ahead
}
if (it != end)
if (it != end)
return token_id(*it);
return T_EOI;
}
@@ -228,7 +228,7 @@ namespace impl {
typedef unput_queue_iterator<IteratorT, TokenT, ContainerT> iterator_type;
static boost::wave::token_id
static boost::wave::token_id
peek(iterator_type it, iterator_type end, bool skip_whitespace = true)
{
using namespace boost::wave;
@@ -252,7 +252,7 @@ namespace impl {
else {
++cit; // we have at least to look ahead
}
if (cit != cend)
if (cit != cend)
return token_id(*cit);
}