forked from boostorg/regex
Remove outdated C++03 code.
This commit is contained in:
@ -1,35 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* 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
|
120
src/regex.cpp
120
src/regex.cpp
@ -1,120 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2004
|
||||
* 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)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE: regex.cpp
|
||||
* VERSION: see <boost/version.hpp>
|
||||
* DESCRIPTION: Misc boost::regbase member funnctions.
|
||||
*/
|
||||
|
||||
|
||||
#define BOOST_REGEX_SOURCE
|
||||
|
||||
#include <boost/regex/config.hpp>
|
||||
|
||||
#ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#ifndef NOMINMAX
|
||||
# define NOMINMAX
|
||||
#endif
|
||||
#define NOGDI
|
||||
#define NOUSER
|
||||
#include <windows.h>
|
||||
#include <stdexcept>
|
||||
#include <boost/regex/pattern_except.hpp>
|
||||
#include <boost/regex/v4/protected_call.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace BOOST_REGEX_DETAIL_NS {
|
||||
|
||||
static void execute_eror()
|
||||
{
|
||||
// we only get here after a stack overflow,
|
||||
// this has to be a separate proceedure because we
|
||||
// can't mix __try{}__except block with local objects
|
||||
// that have destructors:
|
||||
reset_stack_guard_page();
|
||||
std::runtime_error err("Out of stack space, while attempting to match a regular expression.");
|
||||
raise_runtime_error(err);
|
||||
}
|
||||
|
||||
bool BOOST_REGEX_CALL abstract_protected_call::execute()const
|
||||
{
|
||||
__try{
|
||||
return this->call();
|
||||
}__except(EXCEPTION_STACK_OVERFLOW == GetExceptionCode())
|
||||
{
|
||||
execute_eror();
|
||||
}
|
||||
// We never really get here at all:
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOST_REGEX_DECL void BOOST_REGEX_CALL reset_stack_guard_page()
|
||||
{
|
||||
#if defined(BOOST_REGEX_HAS_MS_STACK_GUARD) && defined(_MSC_VER) && (_MSC_VER >= 1300)
|
||||
_resetstkoflw();
|
||||
#else
|
||||
//
|
||||
// We need to locate the current page being used by the stack,
|
||||
// move to the page below it and then deallocate and protect
|
||||
// that page. Note that ideally we would protect only the lowest
|
||||
// stack page that has been allocated: in practice there
|
||||
// seems to be no easy way to locate this page, in any case as
|
||||
// long as the next page is protected, then Windows will figure
|
||||
// the rest out for us...
|
||||
//
|
||||
SYSTEM_INFO si;
|
||||
GetSystemInfo(&si);
|
||||
MEMORY_BASIC_INFORMATION mi;
|
||||
DWORD previous_protection_status;
|
||||
//
|
||||
// this is an address in our stack space:
|
||||
//
|
||||
LPBYTE page = (LPBYTE)&page;
|
||||
//
|
||||
// Get the current memory page in use:
|
||||
//
|
||||
VirtualQuery(page, &mi, sizeof(mi));
|
||||
//
|
||||
// Go to the page one below this:
|
||||
//
|
||||
page = (LPBYTE)(mi.BaseAddress)-si.dwPageSize;
|
||||
//
|
||||
// Free and protect everything from the start of the
|
||||
// allocation range, to the end of the page below the
|
||||
// one in use:
|
||||
//
|
||||
if (!VirtualFree(mi.AllocationBase, (LPBYTE)page - (LPBYTE)mi.AllocationBase, MEM_DECOMMIT)
|
||||
|| !VirtualProtect(page, si.dwPageSize, PAGE_GUARD | PAGE_READWRITE, &previous_protection_status))
|
||||
{
|
||||
throw std::bad_exception();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} // namspaces
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_RE_USE_VCL) && defined(BOOST_REGEX_DYN_LINK)
|
||||
|
||||
int WINAPI DllEntryPoint(HINSTANCE , unsigned long , void*)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2004
|
||||
* 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)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE: regex_debug.cpp
|
||||
* VERSION: see <boost/version.hpp>
|
||||
* DESCRIPTION: Misc. debugging helpers.
|
||||
*/
|
||||
|
||||
|
||||
#define BOOST_REGEX_SOURCE
|
||||
|
||||
#include <boost/regex/config.hpp>
|
||||
|
||||
|
||||
//
|
||||
// regex configuration information: this prints out the settings used
|
||||
// when the library was built - include in debugging builds only:
|
||||
//
|
||||
#ifdef BOOST_REGEX_CONFIG_INFO
|
||||
|
||||
#define print_macro regex_lib_print_macro
|
||||
#define print_expression regex_lib_print_expression
|
||||
#define print_byte_order regex_lib_print_byte_order
|
||||
#define print_sign regex_lib_print_sign
|
||||
#define print_compiler_macros regex_lib_print_compiler_macros
|
||||
#define print_stdlib_macros regex_lib_print_stdlib_macros
|
||||
#define print_platform_macros regex_lib_print_platform_macros
|
||||
#define print_boost_macros regex_lib_print_boost_macros
|
||||
#define print_separator regex_lib_print_separator
|
||||
#define OLD_MAIN regex_lib_main
|
||||
#define NEW_MAIN regex_lib_main2
|
||||
#define NO_RECURSE
|
||||
|
||||
#include <libs/regex/test/config_info/regex_config_info.cpp>
|
||||
|
||||
BOOST_REGEX_DECL void BOOST_REGEX_CALL print_regex_library_info()
|
||||
{
|
||||
std::cout << "\n\n";
|
||||
print_separator();
|
||||
std::cout << "Regex library build configuration:\n\n";
|
||||
regex_lib_main2();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,189 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2004
|
||||
* 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)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE static_mutex.cpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Declares static_mutex lock type.
|
||||
*/
|
||||
|
||||
#define BOOST_REGEX_SOURCE
|
||||
#include <boost/regex/config.hpp>
|
||||
|
||||
#if defined(BOOST_REGEX_CXX03)
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
|
||||
#include <boost/regex/pending/static_mutex.hpp>
|
||||
|
||||
#if defined(BOOST_HAS_WINTHREADS)
|
||||
#ifndef NOMINMAX
|
||||
# define NOMINMAX
|
||||
#endif
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <boost/static_assert.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost{
|
||||
|
||||
#if defined(BOOST_HAS_PTHREADS) && defined(PTHREAD_MUTEX_INITIALIZER)
|
||||
|
||||
scoped_static_mutex_lock::scoped_static_mutex_lock(static_mutex& m, bool lk)
|
||||
: m_mutex(m), m_have_lock(false)
|
||||
{
|
||||
if(lk)
|
||||
lock();
|
||||
}
|
||||
|
||||
scoped_static_mutex_lock::~scoped_static_mutex_lock()
|
||||
{
|
||||
if(m_have_lock)
|
||||
unlock();
|
||||
}
|
||||
|
||||
void scoped_static_mutex_lock::lock()
|
||||
{
|
||||
if(0 == m_have_lock)
|
||||
{
|
||||
// Client code will throw if this fails:
|
||||
m_have_lock = (pthread_mutex_lock(&(m_mutex.m_mutex)) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
void scoped_static_mutex_lock::unlock()
|
||||
{
|
||||
if(m_have_lock)
|
||||
{
|
||||
// If this fails there's nothing we can do except assert,
|
||||
// exceptions are out of the question as this code is called
|
||||
// from the lock's destructor:
|
||||
BOOST_VERIFY(pthread_mutex_unlock(&(m_mutex.m_mutex)) == 0);
|
||||
m_have_lock = false;
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(BOOST_HAS_WINTHREADS)
|
||||
|
||||
BOOST_STATIC_ASSERT(sizeof(LONG) == sizeof(boost::int32_t));
|
||||
|
||||
scoped_static_mutex_lock::scoped_static_mutex_lock(static_mutex& m, bool lk)
|
||||
: m_mutex(m), m_have_lock(false)
|
||||
{
|
||||
if(lk)
|
||||
lock();
|
||||
}
|
||||
|
||||
scoped_static_mutex_lock::~scoped_static_mutex_lock()
|
||||
{
|
||||
if(m_have_lock)
|
||||
unlock();
|
||||
}
|
||||
|
||||
void scoped_static_mutex_lock::lock()
|
||||
{
|
||||
if(0 == m_have_lock)
|
||||
{
|
||||
#if !defined(InterlockedCompareExchangePointer)
|
||||
while(0 != InterlockedCompareExchange(reinterpret_cast<void**>((boost::uint_least16_t*)&(m_mutex.m_mutex)), (void*)1, 0))
|
||||
#else
|
||||
while(0 != InterlockedCompareExchange(reinterpret_cast<LONG*>(&(m_mutex.m_mutex)), 1, 0))
|
||||
#endif
|
||||
{
|
||||
Sleep(0);
|
||||
}
|
||||
m_have_lock = true;
|
||||
}
|
||||
}
|
||||
|
||||
void scoped_static_mutex_lock::unlock()
|
||||
{
|
||||
if(m_have_lock)
|
||||
{
|
||||
#if !defined(InterlockedCompareExchangePointer)
|
||||
InterlockedExchange((LONG*)&(m_mutex.m_mutex), 0);
|
||||
#else
|
||||
InterlockedExchange(reinterpret_cast<LONG*>(&(m_mutex.m_mutex)), 0);
|
||||
#endif
|
||||
m_have_lock = false;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Portable version of a static mutex based on Boost.Thread library:
|
||||
//
|
||||
#include <stdlib.h>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
boost::recursive_mutex* static_mutex::m_pmutex = 0;
|
||||
boost::once_flag static_mutex::m_once = BOOST_ONCE_INIT;
|
||||
|
||||
extern "C" BOOST_REGEX_DECL void boost_regex_free_static_mutex()
|
||||
{
|
||||
delete static_mutex::m_pmutex;
|
||||
static_mutex::m_pmutex = 0;
|
||||
}
|
||||
|
||||
void static_mutex::init()
|
||||
{
|
||||
m_pmutex = new boost::recursive_mutex();
|
||||
int r = atexit(boost_regex_free_static_mutex);
|
||||
BOOST_ASSERT(0 == r);
|
||||
}
|
||||
|
||||
scoped_static_mutex_lock::scoped_static_mutex_lock(static_mutex& , bool lk)
|
||||
: m_plock(0), m_have_lock(false)
|
||||
{
|
||||
if(lk)
|
||||
lock();
|
||||
}
|
||||
|
||||
scoped_static_mutex_lock::~scoped_static_mutex_lock()
|
||||
{
|
||||
if(m_have_lock)
|
||||
unlock();
|
||||
delete m_plock;
|
||||
}
|
||||
|
||||
void scoped_static_mutex_lock::lock()
|
||||
{
|
||||
if(0 == m_have_lock)
|
||||
{
|
||||
boost::call_once(static_mutex::m_once,&static_mutex::init);
|
||||
if(0 == m_plock)
|
||||
m_plock = new boost::unique_lock<boost::recursive_mutex>(*static_mutex::m_pmutex, boost::defer_lock);
|
||||
m_plock->lock();
|
||||
m_have_lock = true;
|
||||
}
|
||||
}
|
||||
|
||||
void scoped_static_mutex_lock::unlock()
|
||||
{
|
||||
if(m_have_lock)
|
||||
{
|
||||
m_plock->unlock();
|
||||
m_have_lock = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif // BOOST_HAS_THREADS
|
||||
#endif
|
Reference in New Issue
Block a user