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
This commit is contained in:
Jean-Marc Lasgouttes 2010-06-30 11:04:30 +00:00
parent 69036ced37
commit af928c503d
5 changed files with 36 additions and 48 deletions

View File

@ -289,6 +289,15 @@ char * strerror(int n);
#define BOOST_NO_WREGEX 1 #define BOOST_NO_WREGEX 1
#define BOOST_NO_WSTRING 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__ #ifdef __CYGWIN__
# define NOMINMAX # define NOMINMAX
# define BOOST_POSIX 1 # define BOOST_POSIX 1

View File

@ -35,7 +35,6 @@ liblyxsupport_a_SOURCES = \
FileMonitor.cpp \ FileMonitor.cpp \
RandomAccessList.h \ RandomAccessList.h \
bind.h \ bind.h \
checktr1.h \
convert.cpp \ convert.cpp \
convert.h \ convert.h \
copied_ptr.h \ copied_ptr.h \

View File

@ -12,9 +12,6 @@
#ifndef LYX_BIND_H #ifndef LYX_BIND_H
#define LYX_BIND_H #define LYX_BIND_H
#include "config.h"
#ifdef LYX_USE_TR1 #ifdef LYX_USE_TR1
#include <functional> #include <functional>
@ -33,7 +30,7 @@ namespace lyx
#else #else
#include "boost/bind.hpp" #include <boost/bind.hpp>
namespace lyx namespace lyx
{ {

View File

@ -12,53 +12,39 @@
#ifndef LYX_REGEXP_H #ifndef LYX_REGEXP_H
#define 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) #if defined(LYX_USE_TR1) && defined(LYX_USE_TR1_REGEX)
# ifdef _MSC_VER
#ifdef _MSC_VER # include <regex>
#include <regex> # define match_partial _Match_partial
#define match_partial _Match_partial # else
#else # include <tr1/regex>
#include <tr1/regex> // TODO no match_partial in gcc, how to replace?
// TODO no match_partial in gcc, how to replace? # define match_partial match_default
#define match_partial match_default # endif
#endif # define LR_NS std::tr1
namespace lyx
{
LYX_REGEX_TO_LYX(std::tr1);
}
#else #else
# include <boost/regex.hpp>
# 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 #endif

View File

@ -12,9 +12,6 @@
#ifndef LYX_SHARED_PTR_H #ifndef LYX_SHARED_PTR_H
#define LYX_SHARED_PTR_H #define LYX_SHARED_PTR_H
#include "config.h"
#ifdef LYX_USE_TR1 #ifdef LYX_USE_TR1
#include <memory> #include <memory>