Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74896 - in trunk/libs/regex: src test
From: john_at_[hidden]
Date: 2011-10-10 11:09:41


Author: johnmaddock
Date: 2011-10-10 11:09:40 EDT (Mon, 10 Oct 2011)
New Revision: 74896
URL: http://svn.boost.org/trac/boost/changeset/74896

Log:
Allow source to be built by #including all the source files in a single TU.
Fixes #5736.
Added:
   trunk/libs/regex/src/internals.hpp (contents, props changed)
   trunk/libs/regex/test/test_consolidated.cpp (contents, props changed)
Text files modified:
   trunk/libs/regex/src/c_regex_traits.cpp | 21 +--------------------
   trunk/libs/regex/src/wc_regex_traits.cpp | 21 +--------------------
   trunk/libs/regex/src/wide_posix_api.cpp | 16 ++++++++--------
   trunk/libs/regex/test/Jamfile.v2 | 2 ++
   4 files changed, 12 insertions(+), 48 deletions(-)

Modified: trunk/libs/regex/src/c_regex_traits.cpp
==============================================================================
--- trunk/libs/regex/src/c_regex_traits.cpp (original)
+++ trunk/libs/regex/src/c_regex_traits.cpp 2011-10-10 11:09:40 EDT (Mon, 10 Oct 2011)
@@ -21,6 +21,7 @@
 
 #include <boost/config.hpp>
 #include <boost/detail/workaround.hpp>
+#include "internals.hpp"
 
 #if !BOOST_WORKAROUND(__BORLANDC__, < 0x560)
 
@@ -107,26 +108,6 @@
    return result;
 }
 
-enum
-{
- char_class_space=1<<0,
- char_class_print=1<<1,
- char_class_cntrl=1<<2,
- char_class_upper=1<<3,
- char_class_lower=1<<4,
- char_class_alpha=1<<5,
- char_class_digit=1<<6,
- char_class_punct=1<<7,
- char_class_xdigit=1<<8,
- char_class_alnum=char_class_alpha|char_class_digit,
- char_class_graph=char_class_alnum|char_class_punct,
- char_class_blank=1<<9,
- char_class_word=1<<10,
- char_class_unicode=1<<11,
- char_class_horizontal=1<<12,
- char_class_vertical=1<<13
-};
-
 c_regex_traits<char>::char_class_type BOOST_REGEX_CALL c_regex_traits<char>::lookup_classname(const char* p1, const char* p2)
 {
    static const char_class_type masks[] =

Added: trunk/libs/regex/src/internals.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/regex/src/internals.hpp 2011-10-10 11:09:40 EDT (Mon, 10 Oct 2011)
@@ -0,0 +1,35 @@
+/*
+ *
+ * Copyright (c) 2011
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to 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)
+ *
+ */
+
+#ifndef BOOST_REGEX_SRC_INTERNALS_HPP
+#define BOOST_REGEX_SRC_INTERNALS_HPP
+
+enum
+{
+ char_class_space=1<<0,
+ char_class_print=1<<1,
+ char_class_cntrl=1<<2,
+ char_class_upper=1<<3,
+ char_class_lower=1<<4,
+ char_class_alpha=1<<5,
+ char_class_digit=1<<6,
+ char_class_punct=1<<7,
+ char_class_xdigit=1<<8,
+ char_class_alnum=char_class_alpha|char_class_digit,
+ char_class_graph=char_class_alnum|char_class_punct,
+ char_class_blank=1<<9,
+ char_class_word=1<<10,
+ char_class_unicode=1<<11,
+ char_class_horizontal=1<<12,
+ char_class_vertical=1<<13
+};
+
+#endif // BOOST_REGEX_SRC_INTERNALS_HPP

Modified: trunk/libs/regex/src/wc_regex_traits.cpp
==============================================================================
--- trunk/libs/regex/src/wc_regex_traits.cpp (original)
+++ trunk/libs/regex/src/wc_regex_traits.cpp 2011-10-10 11:09:40 EDT (Mon, 10 Oct 2011)
@@ -22,6 +22,7 @@
 #include <boost/detail/workaround.hpp>
 #include <memory>
 #include <string>
+#include "internals.hpp"
 
 #if defined(_DLL_CPPLIB) && !defined(_M_CEE_PURE) && defined(_NATIVE_WCHAR_T_DEFINED) \
    && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) || defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER))\
@@ -147,26 +148,6 @@
    return result;
 }
 
-enum
-{
- char_class_space=1<<0,
- char_class_print=1<<1,
- char_class_cntrl=1<<2,
- char_class_upper=1<<3,
- char_class_lower=1<<4,
- char_class_alpha=1<<5,
- char_class_digit=1<<6,
- char_class_punct=1<<7,
- char_class_xdigit=1<<8,
- char_class_alnum=char_class_alpha|char_class_digit,
- char_class_graph=char_class_alnum|char_class_punct,
- char_class_blank=1<<9,
- char_class_word=1<<10,
- char_class_unicode=1<<11,
- char_class_horizontal=1<<12,
- char_class_vertical=1<<13
-};
-
 c_regex_traits<wchar_t>::char_class_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::lookup_classname(const wchar_t* p1, const wchar_t* p2)
 {
    static const char_class_type masks[] =

Modified: trunk/libs/regex/src/wide_posix_api.cpp
==============================================================================
--- trunk/libs/regex/src/wide_posix_api.cpp (original)
+++ trunk/libs/regex/src/wide_posix_api.cpp 2011-10-10 11:09:40 EDT (Mon, 10 Oct 2011)
@@ -74,7 +74,7 @@
 };
 }
 
-typedef boost::basic_regex<wchar_t, c_regex_traits<wchar_t> > c_regex_type;
+typedef boost::basic_regex<wchar_t, c_regex_traits<wchar_t> > wc_regex_type;
 
 BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wchar_t* ptr, int f)
 {
@@ -84,7 +84,7 @@
 #ifndef BOOST_NO_EXCEPTIONS
       try{
 #endif
- expression->guts = new c_regex_type();
+ expression->guts = new wc_regex_type();
 #ifndef BOOST_NO_EXCEPTIONS
       } catch(...)
       {
@@ -134,9 +134,9 @@
    try{
 #endif
       expression->re_magic = wmagic_value;
- static_cast<c_regex_type*>(expression->guts)->set_expression(ptr, p2, flags);
- expression->re_nsub = static_cast<c_regex_type*>(expression->guts)->mark_count() - 1;
- result = static_cast<c_regex_type*>(expression->guts)->error_code();
+ static_cast<wc_regex_type*>(expression->guts)->set_expression(ptr, p2, flags);
+ expression->re_nsub = static_cast<wc_regex_type*>(expression->guts)->mark_count() - 1;
+ result = static_cast<wc_regex_type*>(expression->guts)->error_code();
 #ifndef BOOST_NO_EXCEPTIONS
    }
    catch(const boost::regex_error& be)
@@ -215,7 +215,7 @@
    {
       std::string p;
       if((e) && (e->re_magic == wmagic_value))
- p = static_cast<c_regex_type*>(e->guts)->get_traits().error_string(static_cast< ::boost::regex_constants::error_type>(code));
+ p = static_cast<wc_regex_type*>(e->guts)->get_traits().error_string(static_cast< ::boost::regex_constants::error_type>(code));
       else
       {
          p = re_detail::get_default_error_string(static_cast< ::boost::regex_constants::error_type>(code));
@@ -264,7 +264,7 @@
 #endif
    if(expression->re_magic == wmagic_value)
    {
- result = regex_search(start, end, m, *static_cast<c_regex_type*>(expression->guts), flags);
+ result = regex_search(start, end, m, *static_cast<wc_regex_type*>(expression->guts), flags);
    }
    else
       return result;
@@ -301,7 +301,7 @@
 {
    if(expression->re_magic == wmagic_value)
    {
- delete static_cast<c_regex_type*>(expression->guts);
+ delete static_cast<wc_regex_type*>(expression->guts);
    }
    expression->re_magic = 0;
 }

Modified: trunk/libs/regex/test/Jamfile.v2
==============================================================================
--- trunk/libs/regex/test/Jamfile.v2 (original)
+++ trunk/libs/regex/test/Jamfile.v2 2011-10-10 11:09:40 EDT (Mon, 10 Oct 2011)
@@ -189,6 +189,8 @@
 
 ;
 
+compile test_consolidated.cpp ;
+
 build-project ../example ;
 
 

Added: trunk/libs/regex/test/test_consolidated.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/regex/test/test_consolidated.cpp 2011-10-10 11:09:40 EDT (Mon, 10 Oct 2011)
@@ -0,0 +1,29 @@
+/*
+ *
+ * Copyright (c) 2011
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to 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)
+ *
+ */
+
+
+#include <libs/regex/src/c_regex_traits.cpp>
+#include <libs/regex/src/cpp_regex_traits.cpp>
+#include <libs/regex/src/cregex.cpp>
+#include <libs/regex/src/fileiter.cpp>
+#include <libs/regex/src/icu.cpp>
+#include <libs/regex/src/instances.cpp>
+#include <libs/regex/src/posix_api.cpp>
+#include <libs/regex/src/regex.cpp>
+#include <libs/regex/src/regex_debug.cpp>
+#include <libs/regex/src/regex_raw_buffer.cpp>
+#include <libs/regex/src/regex_traits_defaults.cpp>
+#include <libs/regex/src/static_mutex.cpp>
+#include <libs/regex/src/usinstances.cpp>
+#include <libs/regex/src/wc_regex_traits.cpp>
+#include <libs/regex/src/w32_regex_traits.cpp>
+#include <libs/regex/src/wide_posix_api.cpp>
+#include <libs/regex/src/winstances.cpp>


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