From 084af757b49c0b1883e6a5cf2fcb904b4d0dd6c2 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sat, 18 May 2002 11:30:49 +0000 Subject: [PATCH] Misc. fixes and new config options. [SVN r13971] --- include/boost/cregex.hpp | 2 ++ include/boost/regex.hpp | 3 ++- include/boost/regex/config.hpp | 32 +++++++++++++++++------- include/boost/regex/detail/fileiter.hpp | 5 +++- include/boost/regex/detail/instances.hpp | 10 ++++---- 5 files changed, 36 insertions(+), 16 deletions(-) diff --git a/include/boost/cregex.hpp b/include/boost/cregex.hpp index fe0e2096..cd628559 100644 --- a/include/boost/cregex.hpp +++ b/include/boost/cregex.hpp @@ -262,10 +262,12 @@ public: unsigned int Grep(std::vector& v, const std::string& s, unsigned int flags = match_default) { return Grep(v, s.c_str(), flags); } unsigned int Grep(std::vector& v, const char* p, unsigned int flags = match_default); unsigned int Grep(std::vector& v, const std::string& s, unsigned int flags = match_default) { return Grep(v, s.c_str(), flags); } +#ifndef BOOST_REGEX_NO_FILEITER unsigned int GrepFiles(GrepFileCallback cb, const char* files, bool recurse = false, unsigned int flags = match_default); unsigned int GrepFiles(GrepFileCallback cb, const std::string& files, bool recurse = false, unsigned int flags = match_default) { return GrepFiles(cb, files.c_str(), recurse, flags); } unsigned int FindFiles(FindFilesCallback cb, const char* files, bool recurse = false, unsigned int flags = match_default); unsigned int FindFiles(FindFilesCallback cb, const std::string& files, bool recurse = false, unsigned int flags = match_default) { return FindFiles(cb, files.c_str(), recurse, flags); } +#endif std::string Merge(const std::string& in, const std::string& fmt, bool copy = true, unsigned int flags = match_default); diff --git a/include/boost/regex.hpp b/include/boost/regex.hpp index f7390222..329e671c 100644 --- a/include/boost/regex.hpp +++ b/include/boost/regex.hpp @@ -874,7 +874,8 @@ protected: sub_match head, tail, null; unsigned int lines; iterator line_pos, base; - c_reference(const Allocator& a) : c_alloc(a) { } + c_reference(const Allocator& a) + : c_alloc(a), cmatches(0), count(0), lines(0) { } bool operator==(const c_reference& that)const { diff --git a/include/boost/regex/config.hpp b/include/boost/regex/config.hpp index 7e0ffb6c..581327e3 100644 --- a/include/boost/regex/config.hpp +++ b/include/boost/regex/config.hpp @@ -54,15 +54,6 @@ # endif #endif -#ifdef __MWERKS__ -# define BOOST_REGEX_NO_EXTERNAL_TEMPLATES -#endif -#ifdef __IBMCPP__ -# define BOOST_REGEX_NO_EXTERNAL_TEMPLATES -#endif - - - /***************************************************************************** * * Include all the headers we need here: @@ -159,6 +150,19 @@ # define BOOST_REGEX_NO_BOOL #endif +// We don't make our templates external if the compiler +// can't handle it: +#if defined(BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS) || defined(__ICL) || defined(__ICC)\ + && !defined(BOOST_MSVC) && !defined(__BORLANDC__) +# define BOOST_REGEX_NO_EXTERNAL_TEMPLATES +#endif + +// disable our own file-iterators and mapfiles if we can't +// support them: +#if !defined(BOOST_HAS_DIRENT_H) && !(defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)) +# define BOOST_REGEX_NO_FILEITER +#endif + #ifdef __cplusplus #ifndef MB_CUR_MAX // yuk! @@ -599,10 +603,19 @@ namespace std{ #ifdef __cplusplus namespace boost{ namespace re_detail{ +#ifdef BOOST_MSVC +#pragma warning (push) +#pragma warning (disable : 4100) +#endif + template inline void pointer_destroy(T* p) { p->~T(); (void)p; } +#ifdef BOOST_MSVC +#pragma warning (pop) +#endif + template inline void pointer_construct(T* p, const T& t) { new (p) T(t); } @@ -614,3 +627,4 @@ inline void pointer_construct(T* p, const T& t) + diff --git a/include/boost/regex/detail/fileiter.hpp b/include/boost/regex/detail/fileiter.hpp index 2991f131..90d082a1 100644 --- a/include/boost/regex/detail/fileiter.hpp +++ b/include/boost/regex/detail/fileiter.hpp @@ -27,6 +27,8 @@ #include +#ifndef BOOST_REGEX_NO_FILEITER + #if (defined(__CYGWIN__) || defined(__CYGWIN32__)) && !defined(BOOST_REGEX_NO_W32) #error "Sorry, can't mix with STL code and gcc compiler: if you ran configure, try again with configure --disable-ms-windows" #define BOOST_REGEX_FI_WIN32_MAP @@ -431,7 +433,8 @@ using boost::re_detail::file_iterator; using boost::re_detail::mapfile; } // namespace boost -#endif // _FILEITER_H +#endif // BOOST_REGEX_NO_FILEITER +#endif // BOOST_RE_FILEITER_HPP diff --git a/include/boost/regex/detail/instances.hpp b/include/boost/regex/detail/instances.hpp index a0569efe..47618441 100644 --- a/include/boost/regex/detail/instances.hpp +++ b/include/boost/regex/detail/instances.hpp @@ -101,11 +101,11 @@ template class BOOST_REGEX_DECL match_results # endif -template reg_expression::reg_expression(const BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T)&); -template reg_expression::reg_expression(const BOOST_REGEX_CHAR_T* p, reg_expression::flag_type f, const BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T)& a); -template reg_expression::reg_expression(const BOOST_REGEX_CHAR_T* p, size_type len, reg_expression::flag_type f, const BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T)&); -template reg_expression::reg_expression(const reg_expression&); -template reg_expression::~reg_expression(); +template reg_expression::reg_expression(const BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T)&); +template reg_expression::reg_expression(const BOOST_REGEX_CHAR_T* p, reg_expression::flag_type f, const BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T)& a); +template reg_expression::reg_expression(const BOOST_REGEX_CHAR_T* p, size_type len, reg_expression::flag_type f, const BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T)&); +template reg_expression::reg_expression(const reg_expression&); +template reg_expression::~reg_expression(); template reg_expression& BOOST_REGEX_CALL reg_expression::operator=(const reg_expression&); template BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T) BOOST_REGEX_CALL reg_expression::get_allocator()const; template bool BOOST_REGEX_CALL reg_expression::operator==(const reg_expression&)const;