diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index a74f9ed2..08f98195 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -57,7 +57,7 @@ if ! $(disable-icu) if $(ICU_ICUUC_NAME) { - lib icuuc : : $(ICU_ICUUC_NAME) ; + lib icuuc : : $(ICU_ICUUC_NAME) @path_options ; } else { @@ -71,7 +71,7 @@ if ! $(disable-icu) } if $(ICU_ICUDT_NAME) { - lib icudt : : $(ICU_ICUDT_NAME) ; + lib icudt : : $(ICU_ICUDT_NAME) @path_options ; } else { @@ -85,7 +85,7 @@ if ! $(disable-icu) } if $(ICU_ICUIN_NAME) { - lib icuin : : $(ICU_ICUIN_NAME) ; + lib icuin : : $(ICU_ICUIN_NAME) @path_options ; } else { @@ -110,10 +110,33 @@ if ! $(disable-icu) static:icuuc static:icudt static:icuin + windows,clang:"advapi32.lib" BOOST_HAS_ICU=1 static:U_STATIC_IMPLEMENTATION=1 ; + if [ modules.peek : ICU_DATA_DIR ] + { + rule data-dir-options ( properties * ) + { + local result ; + local data_dir = [ modules.peek : ICU_DATA_DIR ] ; + if emscripten in $(properties) + { + result = ICU_DATA_DIR=\\\"/$(data_dir:BS)\\\" + "--embed-file $(data_dir)@/$(data_dir:BS)" + ; + } + else + { + result = ICU_DATA_DIR=\\\"$(data_dir)\\\" ; + } + return $(result) ; + } + + ICU_OPTS += @data-dir-options ; + } + } exe has_icu : has_icu_test.cpp : $(ICU_OPTS) ; diff --git a/build/has_icu_test.cpp b/build/has_icu_test.cpp index 31c964e7..36a919b4 100644 --- a/build/has_icu_test.cpp +++ b/build/has_icu_test.cpp @@ -28,6 +28,10 @@ void print_error(UErrorCode err, const char* func) int main() { +#ifdef ICU_DATA_DIR + ::u_setDataDirectory(ICU_DATA_DIR); +#endif + // To detect possible binary mismatches between the installed ICU build, and whatever // C++ std lib's we're using, we need to: // * Make sure we call ICU C++ API's diff --git a/include/boost/regex/concepts.hpp b/include/boost/regex/concepts.hpp index fe14f400..2eafac1b 100644 --- a/include/boost/regex/concepts.hpp +++ b/include/boost/regex/concepts.hpp @@ -29,7 +29,7 @@ #endif #include #include -#include +#include #ifdef BOOST_REGEX_CXX03 #define RW_NS boost diff --git a/include/boost/regex/v4/unicode_iterator.hpp b/include/boost/regex/v4/unicode_iterator.hpp index 25711fc7..985aa72b 100644 --- a/include/boost/regex/v4/unicode_iterator.hpp +++ b/include/boost/regex/v4/unicode_iterator.hpp @@ -62,7 +62,6 @@ Accepts UTF-32 code points and forwards them on as UTF-16 code points. #define BOOST_REGEX_V4_UNICODE_ITERATOR_HPP #include #include -#include #include #include #include @@ -145,10 +144,7 @@ inline void invalid_utf32_code_point(::boost::uint32_t val) template class u32_to_u16_iterator - : public boost::iterator_facade, U16Type, std::bidirectional_iterator_tag, const U16Type> { - typedef boost::iterator_facade, U16Type, std::bidirectional_iterator_tag, const U16Type> base_type; - #if !defined(BOOST_NO_STD_ITERATOR_TRAITS) typedef typename std::iterator_traits::value_type base_value_type; @@ -157,14 +153,19 @@ class u32_to_u16_iterator #endif public: - typename base_type::reference - dereference()const + typedef std::ptrdiff_t difference_type; + typedef U16Type value_type; + typedef value_type const* pointer; + typedef value_type const reference; + typedef std::bidirectional_iterator_tag iterator_category; + + reference operator*()const { if(m_current == 2) extract_current(); return m_values[m_current]; } - bool equal(const u32_to_u16_iterator& that)const + bool operator==(const u32_to_u16_iterator& that)const { if(m_position == that.m_position) { @@ -174,7 +175,11 @@ public: } return false; } - void increment() + bool operator!=(const u32_to_u16_iterator& that)const + { + return !(*this == that); + } + u32_to_u16_iterator& operator++() { // if we have a pending read then read now, so that we know whether // to skip a position, or move to a low-surrogate: @@ -191,8 +196,15 @@ public: m_current = 2; ++m_position; } + return *this; } - void decrement() + u32_to_u16_iterator operator++(int) + { + u32_to_u16_iterator r(*this); + ++(*this); + return r; + } + u32_to_u16_iterator& operator--() { if(m_current != 1) { @@ -205,6 +217,13 @@ public: { m_current = 0; } + return *this; + } + u32_to_u16_iterator operator--(int) + { + u32_to_u16_iterator r(*this); + --(*this); + return r; } BaseIterator base()const { @@ -258,9 +277,7 @@ private: template class u16_to_u32_iterator - : public boost::iterator_facade, U32Type, std::bidirectional_iterator_tag, const U32Type> { - typedef boost::iterator_facade, U32Type, std::bidirectional_iterator_tag, const U32Type> base_type; // special values for pending iterator reads: BOOST_STATIC_CONSTANT(U32Type, pending_read = 0xffffffffu); @@ -272,31 +289,54 @@ class u16_to_u32_iterator #endif public: - typename base_type::reference - dereference()const + typedef std::ptrdiff_t difference_type; + typedef U32Type value_type; + typedef value_type const* pointer; + typedef value_type const reference; + typedef std::bidirectional_iterator_tag iterator_category; + + reference operator*()const { if(m_value == pending_read) extract_current(); return m_value; } - bool equal(const u16_to_u32_iterator& that)const + bool operator==(const u16_to_u32_iterator& that)const { return m_position == that.m_position; } - void increment() + bool operator!=(const u16_to_u32_iterator& that)const + { + return !(*this == that); + } + u16_to_u32_iterator& operator++() { // skip high surrogate first if there is one: if(detail::is_high_surrogate(*m_position)) ++m_position; ++m_position; m_value = pending_read; + return *this; } - void decrement() + u16_to_u32_iterator operator++(int) + { + u16_to_u32_iterator r(*this); + ++(*this); + return r; + } + u16_to_u32_iterator& operator--() { --m_position; // if we have a low surrogate then go back one more: if(detail::is_low_surrogate(*m_position)) --m_position; m_value = pending_read; + return *this; + } + u16_to_u32_iterator operator--(int) + { + u16_to_u32_iterator r(*this); + --(*this); + return r; } BaseIterator base()const { @@ -375,10 +415,7 @@ private: template class u32_to_u8_iterator - : public boost::iterator_facade, U8Type, std::bidirectional_iterator_tag, const U8Type> { - typedef boost::iterator_facade, U8Type, std::bidirectional_iterator_tag, const U8Type> base_type; - #if !defined(BOOST_NO_STD_ITERATOR_TRAITS) typedef typename std::iterator_traits::value_type base_value_type; @@ -387,14 +424,19 @@ class u32_to_u8_iterator #endif public: - typename base_type::reference - dereference()const + typedef std::ptrdiff_t difference_type; + typedef U8Type value_type; + typedef value_type const* pointer; + typedef value_type const reference; + typedef std::bidirectional_iterator_tag iterator_category; + + reference operator*()const { if(m_current == 4) extract_current(); return m_values[m_current]; } - bool equal(const u32_to_u8_iterator& that)const + bool operator==(const u32_to_u8_iterator& that)const { if(m_position == that.m_position) { @@ -405,7 +447,11 @@ public: } return false; } - void increment() + bool operator!=(const u32_to_u8_iterator& that)const + { + return !(*this == that); + } + u32_to_u8_iterator& operator++() { // if we have a pending read then read now, so that we know whether // to skip a position, or move to a low-surrogate: @@ -422,8 +468,15 @@ public: m_current = 4; ++m_position; } + return *this; } - void decrement() + u32_to_u8_iterator operator++(int) + { + u32_to_u8_iterator r(*this); + ++(*this); + return r; + } + u32_to_u8_iterator& operator--() { if((m_current & 3) == 0) { @@ -435,6 +488,13 @@ public: } else --m_current; + return *this; + } + u32_to_u8_iterator operator--(int) + { + u32_to_u8_iterator r(*this); + --(*this); + return r; } BaseIterator base()const { @@ -501,9 +561,7 @@ private: template class u8_to_u32_iterator - : public boost::iterator_facade, U32Type, std::bidirectional_iterator_tag, const U32Type> { - typedef boost::iterator_facade, U32Type, std::bidirectional_iterator_tag, const U32Type> base_type; // special values for pending iterator reads: BOOST_STATIC_CONSTANT(U32Type, pending_read = 0xffffffffu); @@ -515,18 +573,27 @@ class u8_to_u32_iterator #endif public: - typename base_type::reference - dereference()const + typedef std::ptrdiff_t difference_type; + typedef U32Type value_type; + typedef value_type const* pointer; + typedef value_type const reference; + typedef std::bidirectional_iterator_tag iterator_category; + + reference operator*()const { if(m_value == pending_read) extract_current(); return m_value; } - bool equal(const u8_to_u32_iterator& that)const + bool operator==(const u8_to_u32_iterator& that)const { return m_position == that.m_position; } - void increment() + bool operator!=(const u8_to_u32_iterator& that)const + { + return !(*this == that); + } + u8_to_u32_iterator& operator++() { // We must not start with a continuation character: if((static_cast(*m_position) & 0xC0) == 0x80) @@ -549,8 +616,15 @@ public: std::advance(m_position, c); } m_value = pending_read; + return *this; } - void decrement() + u8_to_u32_iterator operator++(int) + { + u8_to_u32_iterator r(*this); + ++(*this); + return r; + } + u8_to_u32_iterator& operator--() { // Keep backtracking until we don't have a trailing character: unsigned count = 0; @@ -559,6 +633,13 @@ public: if(count != detail::utf8_trailing_byte_count(*m_position)) invalid_sequence(); m_value = pending_read; + return *this; + } + u8_to_u32_iterator operator--(int) + { + u8_to_u32_iterator r(*this); + --(*this); + return r; } BaseIterator base()const { diff --git a/include/boost/regex/v5/mem_block_cache.hpp b/include/boost/regex/v5/mem_block_cache.hpp index 0af4eae1..eb3ec776 100644 --- a/include/boost/regex/v5/mem_block_cache.hpp +++ b/include/boost/regex/v5/mem_block_cache.hpp @@ -85,10 +85,10 @@ struct mem_block_node struct mem_block_cache { // this member has to be statically initialsed: - mem_block_node* next; - unsigned cached_blocks; + mem_block_node* next { nullptr }; + unsigned cached_blocks { 0 }; #ifdef BOOST_HAS_THREADS - boost::static_mutex mut; + std::mutex mut; #endif ~mem_block_cache() @@ -133,11 +133,7 @@ struct mem_block_cache } static mem_block_cache& instance() { -#ifdef BOOST_HAS_THREADS - static mem_block_cache block_cache = { 0, 0, BOOST_STATIC_MUTEX_INIT, }; -#else - static mem_block_cache block_cache = { 0, 0, }; -#endif + static mem_block_cache block_cache; return block_cache; } }; diff --git a/include/boost/regex/v5/unicode_iterator.hpp b/include/boost/regex/v5/unicode_iterator.hpp index 07443609..9d3dd8b9 100644 --- a/include/boost/regex/v5/unicode_iterator.hpp +++ b/include/boost/regex/v5/unicode_iterator.hpp @@ -67,8 +67,6 @@ Accepts UTF-32 code points and forwards them on as UTF-16 code points. #include #include // CHAR_BIT -#include - #ifndef BOOST_REGEX_STANDALONE #include #endif diff --git a/include/boost/regex/v5/w32_regex_traits.hpp b/include/boost/regex/v5/w32_regex_traits.hpp index 7e90e4ba..5a9e93b6 100644 --- a/include/boost/regex/v5/w32_regex_traits.hpp +++ b/include/boost/regex/v5/w32_regex_traits.hpp @@ -29,8 +29,12 @@ #include #include -#define VC_EXTRALEAN -#define WIN32_LEAN_AND_MEAN +#ifndef VC_EXTRALEAN +# define VC_EXTRALEAN +#endif +#ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif #include #if defined(_MSC_VER) && !defined(_WIN32_WCE) && !defined(UNDER_CE)