From af928c503de3dbed4575bc26f0b2894a1d7b7eb7 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Wed, 30 Jun 2010 11:04:30 +0000 Subject: [PATCH] rework regexp processor magic ; make tr1 work with autotools git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34730 a592a061-630c-0410-9148-cb99ea01b6c8 --- configure.ac | 9 ++++++ src/support/Makefile.am | 1 - src/support/bind.h | 5 +-- src/support/regex.h | 66 ++++++++++++++++------------------------ src/support/shared_ptr.h | 3 -- 5 files changed, 36 insertions(+), 48 deletions(-) diff --git a/configure.ac b/configure.ac index 8f56125a56..a087bd2de8 100644 --- a/configure.ac +++ b/configure.ac @@ -289,6 +289,15 @@ char * strerror(int n); #define BOOST_NO_WREGEX 1 #define BOOST_NO_WSTRING 1 +#ifndef LYX_USE_TR1 +# if defined(_MSC_VER) && (_MSC_VER >= 1600) +# define LYX_USE_TR1 +# endif +# if __GNUC__ == 4 && __GNUC_MINOR__ >= 4 +# define LYX_USE_TR1 +# endif +#endif + #ifdef __CYGWIN__ # define NOMINMAX # define BOOST_POSIX 1 diff --git a/src/support/Makefile.am b/src/support/Makefile.am index bf8a8bffed..6d8821e855 100644 --- a/src/support/Makefile.am +++ b/src/support/Makefile.am @@ -35,7 +35,6 @@ liblyxsupport_a_SOURCES = \ FileMonitor.cpp \ RandomAccessList.h \ bind.h \ - checktr1.h \ convert.cpp \ convert.h \ copied_ptr.h \ diff --git a/src/support/bind.h b/src/support/bind.h index 3a0837e80e..4d2968048d 100644 --- a/src/support/bind.h +++ b/src/support/bind.h @@ -12,9 +12,6 @@ #ifndef LYX_BIND_H #define LYX_BIND_H -#include "config.h" - - #ifdef LYX_USE_TR1 #include @@ -33,7 +30,7 @@ namespace lyx #else -#include "boost/bind.hpp" +#include namespace lyx { diff --git a/src/support/regex.h b/src/support/regex.h index 5a646189f1..0c85075882 100644 --- a/src/support/regex.h +++ b/src/support/regex.h @@ -12,53 +12,39 @@ #ifndef LYX_REGEXP_H #define LYX_REGEXP_H -#include "config.h" - - -#define LYX_REGEX_TO_LYX(X) \ - using X::regex; \ - using X::smatch; \ - using X::regex_replace; \ - using X::basic_regex; \ - using X::regex_error; \ - using X::regex_search; \ - using X::sregex_iterator; \ - using X::match_results; \ - \ - namespace regex_constants \ - { \ - using namespace X::regex_constants; \ - using X::regex_constants::match_flag_type; \ - } \ - - - #if defined(LYX_USE_TR1) && defined(LYX_USE_TR1_REGEX) - -#ifdef _MSC_VER -#include -#define match_partial _Match_partial -#else -#include -// TODO no match_partial in gcc, how to replace? -#define match_partial match_default -#endif - -namespace lyx -{ - LYX_REGEX_TO_LYX(std::tr1); -} - +# ifdef _MSC_VER +# include +# define match_partial _Match_partial +# else +# include +// TODO no match_partial in gcc, how to replace? +# define match_partial match_default +# endif +# define LR_NS std::tr1 #else +# include +# define LR_NS boost +#endif -#include "boost/regex.hpp" +namespace lyx { +using LR_NS::regex; +using LR_NS::smatch; +using LR_NS::regex_replace; +using LR_NS::basic_regex; +using LR_NS::regex_error; +using LR_NS::regex_search; +using LR_NS::sregex_iterator; +using LR_NS::match_results; -namespace lyx +namespace regex_constants { - LYX_REGEX_TO_LYX(boost); +using namespace LR_NS::regex_constants; +using LR_NS::regex_constants::match_flag_type; } -#endif +} +#undef LR_NS #endif diff --git a/src/support/shared_ptr.h b/src/support/shared_ptr.h index 6e4dbe6e6b..28ac3d7a23 100644 --- a/src/support/shared_ptr.h +++ b/src/support/shared_ptr.h @@ -12,9 +12,6 @@ #ifndef LYX_SHARED_PTR_H #define LYX_SHARED_PTR_H -#include "config.h" - - #ifdef LYX_USE_TR1 #include