passenger 4.0.27 → 4.0.28
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of passenger might be problematic. Click here for more details.
- data.tar.gz.asc +7 -7
- data/.gitignore +1 -0
- data/NEWS +22 -0
- data/build/preprocessor.rb +10 -0
- data/build/rpm.rb +74 -65
- data/debian.template/rules.template +8 -0
- data/dev/copy_boost_headers.rb +11 -2
- data/doc/Users guide Apache.idmap.txt +161 -145
- data/doc/Users guide Apache.txt +12 -1
- data/doc/Users guide Nginx.idmap.txt +142 -126
- data/doc/Users guide Nginx.txt +14 -1
- data/doc/Users guide Standalone.txt +1 -0
- data/doc/users_guide_snippets/environment_variables.txt +1 -1
- data/doc/users_guide_snippets/installation.txt +2 -0
- data/doc/users_guide_snippets/tips.txt +118 -0
- data/ext/apache2/Configuration.cpp +0 -6
- data/ext/apache2/Configuration.hpp +0 -5
- data/ext/apache2/ConfigurationCommands.cpp +7 -0
- data/ext/apache2/ConfigurationFields.hpp +2 -0
- data/ext/apache2/ConfigurationSetters.cpp +24 -0
- data/ext/apache2/CreateDirConfig.cpp +1 -0
- data/ext/apache2/Hooks.cpp +0 -1
- data/ext/apache2/MergeDirConfig.cpp +7 -0
- data/ext/apache2/SetHeaders.cpp +5 -1
- data/ext/boost/cregex.hpp +39 -0
- data/ext/boost/libs/regex/src/c_regex_traits.cpp +193 -0
- data/ext/boost/libs/regex/src/cpp_regex_traits.cpp +117 -0
- data/ext/boost/libs/regex/src/cregex.cpp +660 -0
- data/ext/boost/libs/regex/src/instances.cpp +32 -0
- data/ext/boost/libs/regex/src/internals.hpp +35 -0
- data/ext/boost/libs/regex/src/posix_api.cpp +296 -0
- data/ext/boost/libs/regex/src/regex.cpp +227 -0
- data/ext/boost/libs/regex/src/regex_debug.cpp +59 -0
- data/ext/boost/libs/regex/src/regex_raw_buffer.cpp +72 -0
- data/ext/boost/libs/regex/src/regex_traits_defaults.cpp +692 -0
- data/ext/boost/libs/regex/src/static_mutex.cpp +179 -0
- data/ext/boost/libs/regex/src/wc_regex_traits.cpp +301 -0
- data/ext/boost/libs/regex/src/wide_posix_api.cpp +315 -0
- data/ext/boost/libs/regex/src/winstances.cpp +35 -0
- data/ext/boost/regex.h +100 -0
- data/ext/boost/regex.hpp +37 -0
- data/ext/boost/regex/concepts.hpp +1128 -0
- data/ext/boost/regex/config.hpp +435 -0
- data/ext/boost/regex/config/borland.hpp +72 -0
- data/ext/boost/regex/config/cwchar.hpp +207 -0
- data/ext/boost/regex/mfc.hpp +190 -0
- data/ext/boost/regex/pattern_except.hpp +100 -0
- data/ext/boost/regex/pending/object_cache.hpp +165 -0
- data/ext/boost/regex/pending/static_mutex.hpp +179 -0
- data/ext/boost/regex/pending/unicode_iterator.hpp +776 -0
- data/ext/boost/regex/regex_traits.hpp +35 -0
- data/ext/boost/regex/user.hpp +93 -0
- data/ext/boost/regex/v4/basic_regex.hpp +782 -0
- data/ext/boost/regex/v4/basic_regex_creator.hpp +1571 -0
- data/ext/boost/regex/v4/basic_regex_parser.hpp +2874 -0
- data/ext/boost/regex/v4/c_regex_traits.hpp +211 -0
- data/ext/boost/regex/v4/char_regex_traits.hpp +81 -0
- data/ext/boost/regex/v4/cpp_regex_traits.hpp +1099 -0
- data/ext/boost/regex/v4/cregex.hpp +330 -0
- data/ext/boost/regex/v4/error_type.hpp +59 -0
- data/ext/boost/regex/v4/fileiter.hpp +455 -0
- data/ext/boost/regex/v4/instances.hpp +222 -0
- data/ext/boost/regex/v4/iterator_category.hpp +91 -0
- data/ext/boost/regex/v4/iterator_traits.hpp +135 -0
- data/ext/boost/regex/v4/match_flags.hpp +138 -0
- data/ext/boost/regex/v4/match_results.hpp +702 -0
- data/ext/boost/regex/v4/mem_block_cache.hpp +99 -0
- data/ext/boost/regex/v4/perl_matcher.hpp +587 -0
- data/ext/boost/regex/v4/perl_matcher_common.hpp +996 -0
- data/ext/boost/regex/v4/perl_matcher_non_recursive.hpp +1642 -0
- data/ext/boost/regex/v4/perl_matcher_recursive.hpp +991 -0
- data/ext/boost/regex/v4/primary_transform.hpp +146 -0
- data/ext/boost/regex/v4/protected_call.hpp +81 -0
- data/ext/boost/regex/v4/regbase.hpp +180 -0
- data/ext/boost/regex/v4/regex.hpp +202 -0
- data/ext/boost/regex/v4/regex_format.hpp +1156 -0
- data/ext/boost/regex/v4/regex_fwd.hpp +73 -0
- data/ext/boost/regex/v4/regex_grep.hpp +155 -0
- data/ext/boost/regex/v4/regex_iterator.hpp +201 -0
- data/ext/boost/regex/v4/regex_match.hpp +382 -0
- data/ext/boost/regex/v4/regex_merge.hpp +93 -0
- data/ext/boost/regex/v4/regex_raw_buffer.hpp +210 -0
- data/ext/boost/regex/v4/regex_replace.hpp +99 -0
- data/ext/boost/regex/v4/regex_search.hpp +217 -0
- data/ext/boost/regex/v4/regex_split.hpp +172 -0
- data/ext/boost/regex/v4/regex_token_iterator.hpp +342 -0
- data/ext/boost/regex/v4/regex_traits.hpp +189 -0
- data/ext/boost/regex/v4/regex_traits_defaults.hpp +371 -0
- data/ext/boost/regex/v4/regex_workaround.hpp +232 -0
- data/ext/boost/regex/v4/states.hpp +301 -0
- data/ext/boost/regex/v4/sub_match.hpp +512 -0
- data/ext/boost/regex/v4/syntax_type.hpp +105 -0
- data/ext/boost/regex/v4/u32regex_iterator.hpp +193 -0
- data/ext/boost/regex/v4/u32regex_token_iterator.hpp +377 -0
- data/ext/boost/regex/v4/w32_regex_traits.hpp +741 -0
- data/ext/boost/regex_fwd.hpp +33 -0
- data/ext/common/AgentsStarter.h +0 -11
- data/ext/common/ApplicationPool2/Common.h +1 -7
- data/ext/common/ApplicationPool2/DirectSpawner.h +3 -3
- data/ext/common/ApplicationPool2/Group.h +166 -69
- data/ext/common/ApplicationPool2/Implementation.cpp +55 -10
- data/ext/common/ApplicationPool2/Options.h +45 -10
- data/ext/common/ApplicationPool2/PipeWatcher.h +1 -2
- data/ext/common/ApplicationPool2/Pool.h +29 -7
- data/ext/common/ApplicationPool2/Process.h +22 -3
- data/ext/common/ApplicationPool2/Session.h +1 -0
- data/ext/common/ApplicationPool2/SmartSpawner.h +5 -10
- data/ext/common/ApplicationPool2/Spawner.h +10 -15
- data/ext/common/ApplicationPool2/SuperGroup.h +10 -9
- data/ext/common/Constants.h +1 -3
- data/ext/common/Hooks.h +193 -0
- data/ext/common/Logging.cpp +67 -2
- data/ext/common/Logging.h +23 -1
- data/ext/common/Utils.cpp +0 -21
- data/ext/common/Utils.h +0 -42
- data/ext/common/Utils/CachedFileStat.hpp +1 -1
- data/ext/common/Utils/StrIntUtils.h +61 -14
- data/ext/common/Utils/StringMap.h +4 -0
- data/ext/common/agents/HelperAgent/AgentOptions.h +4 -4
- data/ext/common/agents/HelperAgent/Main.cpp +2 -3
- data/ext/common/agents/HelperAgent/RequestHandler.h +65 -2
- data/ext/common/agents/LoggingAgent/FilterSupport.h +3 -1
- data/ext/common/agents/Watchdog/Main.cpp +8 -72
- data/ext/nginx/CacheLocationConfig.c +29 -1
- data/ext/nginx/Configuration.c +0 -12
- data/ext/nginx/Configuration.h +0 -1
- data/ext/nginx/ConfigurationCommands.c +10 -0
- data/ext/nginx/ConfigurationFields.h +2 -0
- data/ext/nginx/CreateLocationConfig.c +4 -0
- data/ext/nginx/MergeLocationConfig.c +6 -0
- data/ext/oxt/system_calls.cpp +7 -1
- data/ext/oxt/system_calls.hpp +7 -7
- data/helper-scripts/node-loader.js +6 -2
- data/helper-scripts/rack-loader.rb +5 -2
- data/helper-scripts/rack-preloader.rb +5 -2
- data/lib/phusion_passenger.rb +1 -1
- data/lib/phusion_passenger/apache2/config_options.rb +8 -0
- data/lib/phusion_passenger/constants.rb +0 -1
- data/lib/phusion_passenger/nginx/config_options.rb +9 -2
- data/lib/phusion_passenger/platform_info/apache.rb +2 -1
- data/lib/phusion_passenger/platform_info/compiler.rb +15 -1
- data/lib/phusion_passenger/platform_info/cxx_portability.rb +2 -0
- data/node_lib/phusion_passenger/httplib_emulation.js +85 -17
- data/node_lib/phusion_passenger/request_handler.js +10 -2
- data/rpm/Vagrantfile +32 -0
- data/rpm/get_distro_id.py +4 -0
- data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +2 -2
- data/test/cxx/ApplicationPool2/PoolTest.cpp +60 -9
- data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +2 -6
- data/test/cxx/CachedFileStatTest.cpp +5 -5
- data/test/cxx/RequestHandlerTest.cpp +3 -6
- data/test/cxx/UtilsTest.cpp +30 -0
- data/test/node/httplib_emulation_spec.js +491 -0
- data/test/node/spec_helper.js +25 -0
- metadata +78 -2
- metadata.gz.asc +7 -7
@@ -0,0 +1,179 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Copyright (c) 2004
|
4
|
+
* John Maddock
|
5
|
+
*
|
6
|
+
* Use, modification and distribution are subject to the
|
7
|
+
* Boost Software License, Version 1.0. (See accompanying file
|
8
|
+
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
9
|
+
*
|
10
|
+
*/
|
11
|
+
|
12
|
+
/*
|
13
|
+
* LOCATION: see http://www.boost.org for most recent version.
|
14
|
+
* FILE static_mutex.cpp
|
15
|
+
* VERSION see <boost/version.hpp>
|
16
|
+
* DESCRIPTION: Declares static_mutex lock type.
|
17
|
+
*/
|
18
|
+
|
19
|
+
#define BOOST_REGEX_SOURCE
|
20
|
+
#include <boost/config.hpp>
|
21
|
+
|
22
|
+
#ifdef BOOST_HAS_THREADS
|
23
|
+
|
24
|
+
#include <boost/regex/pending/static_mutex.hpp>
|
25
|
+
|
26
|
+
#if defined(BOOST_HAS_WINTHREADS)
|
27
|
+
#ifndef NOMINMAX
|
28
|
+
# define NOMINMAX
|
29
|
+
#endif
|
30
|
+
#define WIN32_LEAN_AND_MEAN
|
31
|
+
#include <windows.h>
|
32
|
+
#include <boost/static_assert.hpp>
|
33
|
+
#endif
|
34
|
+
|
35
|
+
|
36
|
+
namespace boost{
|
37
|
+
|
38
|
+
#if defined(BOOST_HAS_PTHREADS) && defined(PTHREAD_MUTEX_INITIALIZER)
|
39
|
+
|
40
|
+
scoped_static_mutex_lock::scoped_static_mutex_lock(static_mutex& m, bool lk)
|
41
|
+
: m_mutex(m), m_have_lock(false)
|
42
|
+
{
|
43
|
+
if(lk)
|
44
|
+
lock();
|
45
|
+
}
|
46
|
+
|
47
|
+
scoped_static_mutex_lock::~scoped_static_mutex_lock()
|
48
|
+
{
|
49
|
+
if(m_have_lock)
|
50
|
+
unlock();
|
51
|
+
}
|
52
|
+
|
53
|
+
void scoped_static_mutex_lock::lock()
|
54
|
+
{
|
55
|
+
if(0 == m_have_lock)
|
56
|
+
{
|
57
|
+
pthread_mutex_lock(&(m_mutex.m_mutex));
|
58
|
+
m_have_lock = true;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
void scoped_static_mutex_lock::unlock()
|
63
|
+
{
|
64
|
+
if(m_have_lock)
|
65
|
+
{
|
66
|
+
pthread_mutex_unlock(&(m_mutex.m_mutex));
|
67
|
+
m_have_lock = false;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
#elif defined(BOOST_HAS_WINTHREADS)
|
72
|
+
|
73
|
+
BOOST_STATIC_ASSERT(sizeof(LONG) == sizeof(boost::int32_t));
|
74
|
+
|
75
|
+
scoped_static_mutex_lock::scoped_static_mutex_lock(static_mutex& m, bool lk)
|
76
|
+
: m_mutex(m), m_have_lock(false)
|
77
|
+
{
|
78
|
+
if(lk)
|
79
|
+
lock();
|
80
|
+
}
|
81
|
+
|
82
|
+
scoped_static_mutex_lock::~scoped_static_mutex_lock()
|
83
|
+
{
|
84
|
+
if(m_have_lock)
|
85
|
+
unlock();
|
86
|
+
}
|
87
|
+
|
88
|
+
void scoped_static_mutex_lock::lock()
|
89
|
+
{
|
90
|
+
if(0 == m_have_lock)
|
91
|
+
{
|
92
|
+
#if !defined(InterlockedCompareExchangePointer)
|
93
|
+
while(0 != InterlockedCompareExchange(reinterpret_cast<void**>((boost::uint_least16_t*)&(m_mutex.m_mutex)), (void*)1, 0))
|
94
|
+
#else
|
95
|
+
while(0 != InterlockedCompareExchange(reinterpret_cast<LONG*>(&(m_mutex.m_mutex)), 1, 0))
|
96
|
+
#endif
|
97
|
+
{
|
98
|
+
Sleep(0);
|
99
|
+
}
|
100
|
+
m_have_lock = true;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
void scoped_static_mutex_lock::unlock()
|
105
|
+
{
|
106
|
+
if(m_have_lock)
|
107
|
+
{
|
108
|
+
#if !defined(InterlockedCompareExchangePointer)
|
109
|
+
InterlockedExchange((LONG*)&(m_mutex.m_mutex), 0);
|
110
|
+
#else
|
111
|
+
InterlockedExchange(reinterpret_cast<LONG*>(&(m_mutex.m_mutex)), 0);
|
112
|
+
#endif
|
113
|
+
m_have_lock = false;
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
#else
|
118
|
+
//
|
119
|
+
// Portable version of a static mutex based on Boost.Thread library:
|
120
|
+
//
|
121
|
+
#include <stdlib.h>
|
122
|
+
#include <boost/assert.hpp>
|
123
|
+
|
124
|
+
boost::recursive_mutex* static_mutex::m_pmutex = 0;
|
125
|
+
boost::once_flag static_mutex::m_once = BOOST_ONCE_INIT;
|
126
|
+
|
127
|
+
extern "C" BOOST_REGEX_DECL void boost_regex_free_static_mutex()
|
128
|
+
{
|
129
|
+
delete static_mutex::m_pmutex;
|
130
|
+
static_mutex::m_pmutex = 0;
|
131
|
+
}
|
132
|
+
|
133
|
+
void static_mutex::init()
|
134
|
+
{
|
135
|
+
m_pmutex = new boost::recursive_mutex();
|
136
|
+
int r = atexit(boost_regex_free_static_mutex);
|
137
|
+
BOOST_ASSERT(0 == r);
|
138
|
+
}
|
139
|
+
|
140
|
+
scoped_static_mutex_lock::scoped_static_mutex_lock(static_mutex& , bool lk)
|
141
|
+
: m_plock(0), m_have_lock(false)
|
142
|
+
{
|
143
|
+
if(lk)
|
144
|
+
lock();
|
145
|
+
}
|
146
|
+
|
147
|
+
scoped_static_mutex_lock::~scoped_static_mutex_lock()
|
148
|
+
{
|
149
|
+
if(m_have_lock)
|
150
|
+
unlock();
|
151
|
+
delete m_plock;
|
152
|
+
}
|
153
|
+
|
154
|
+
void scoped_static_mutex_lock::lock()
|
155
|
+
{
|
156
|
+
if(0 == m_have_lock)
|
157
|
+
{
|
158
|
+
boost::call_once(static_mutex::m_once,&static_mutex::init);
|
159
|
+
if(0 == m_plock)
|
160
|
+
m_plock = new boost::recursive_mutex::scoped_lock(*static_mutex::m_pmutex, boost::defer_lock);
|
161
|
+
m_plock->lock();
|
162
|
+
m_have_lock = true;
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
166
|
+
void scoped_static_mutex_lock::unlock()
|
167
|
+
{
|
168
|
+
if(m_have_lock)
|
169
|
+
{
|
170
|
+
m_plock->unlock();
|
171
|
+
m_have_lock = false;
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
#endif
|
176
|
+
|
177
|
+
}
|
178
|
+
|
179
|
+
#endif // BOOST_HAS_THREADS
|
@@ -0,0 +1,301 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Copyright (c) 2004
|
4
|
+
* John Maddock
|
5
|
+
*
|
6
|
+
* Use, modification and distribution are subject to the
|
7
|
+
* Boost Software License, Version 1.0. (See accompanying file
|
8
|
+
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
9
|
+
*
|
10
|
+
*/
|
11
|
+
|
12
|
+
/*
|
13
|
+
* LOCATION: see http://www.boost.org for most recent version.
|
14
|
+
* FILE: wc_regex_traits.cpp
|
15
|
+
* VERSION: see <boost/version.hpp>
|
16
|
+
* DESCRIPTION: Implements out of line members for c_regex_traits<wchar_t>
|
17
|
+
*/
|
18
|
+
|
19
|
+
|
20
|
+
#define BOOST_REGEX_SOURCE
|
21
|
+
|
22
|
+
#include <boost/detail/workaround.hpp>
|
23
|
+
#include <memory>
|
24
|
+
#include <string>
|
25
|
+
#include "internals.hpp"
|
26
|
+
|
27
|
+
#if defined(_DLL_CPPLIB) && !defined(_M_CEE_PURE) && defined(_NATIVE_WCHAR_T_DEFINED) \
|
28
|
+
&& !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) || defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER))\
|
29
|
+
&& BOOST_WORKAROUND(BOOST_MSVC, <1600)
|
30
|
+
//
|
31
|
+
// This is a horrible workaround, but without declaring these symbols extern we get
|
32
|
+
// duplicate symbol errors when linking if the application is built without
|
33
|
+
// /Zc:wchar_t
|
34
|
+
//
|
35
|
+
#ifdef _CRTIMP2_PURE
|
36
|
+
# define BOOST_REGEX_STDLIB_DECL _CRTIMP2_PURE
|
37
|
+
#else
|
38
|
+
# define BOOST_REGEX_STDLIB_DECL _CRTIMP2
|
39
|
+
#endif
|
40
|
+
|
41
|
+
namespace std{
|
42
|
+
|
43
|
+
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
44
|
+
template class BOOST_REGEX_STDLIB_DECL allocator<unsigned short>;
|
45
|
+
template class BOOST_REGEX_STDLIB_DECL _String_val<unsigned short, allocator<unsigned short> >;
|
46
|
+
template class BOOST_REGEX_STDLIB_DECL basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >;
|
47
|
+
#endif
|
48
|
+
|
49
|
+
#if BOOST_WORKAROUND(BOOST_MSVC, > 1300) && BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400))
|
50
|
+
template<> BOOST_REGEX_STDLIB_DECL std::size_t __cdecl char_traits<unsigned short>::length(unsigned short const*);
|
51
|
+
#endif
|
52
|
+
|
53
|
+
template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==(
|
54
|
+
const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,
|
55
|
+
const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);
|
56
|
+
template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==(
|
57
|
+
const unsigned short *,
|
58
|
+
const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);
|
59
|
+
template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==(
|
60
|
+
const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,
|
61
|
+
const unsigned short *);
|
62
|
+
template BOOST_REGEX_STDLIB_DECL bool __cdecl operator<(
|
63
|
+
const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,
|
64
|
+
const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);
|
65
|
+
template BOOST_REGEX_STDLIB_DECL bool __cdecl operator>(
|
66
|
+
const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,
|
67
|
+
const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);
|
68
|
+
}
|
69
|
+
#endif
|
70
|
+
|
71
|
+
#include <boost/regex/config.hpp>
|
72
|
+
#include <boost/detail/workaround.hpp>
|
73
|
+
|
74
|
+
#if !BOOST_WORKAROUND(__BORLANDC__, < 0x560)
|
75
|
+
|
76
|
+
#include <boost/regex/v4/c_regex_traits.hpp>
|
77
|
+
#ifndef BOOST_NO_WREGEX
|
78
|
+
#include <boost/regex/v4/primary_transform.hpp>
|
79
|
+
#include <boost/regex/v4/regex_traits_defaults.hpp>
|
80
|
+
|
81
|
+
#if defined(BOOST_NO_STDC_NAMESPACE)
|
82
|
+
namespace std{
|
83
|
+
using ::wcstol;
|
84
|
+
}
|
85
|
+
#endif
|
86
|
+
|
87
|
+
namespace boost{
|
88
|
+
|
89
|
+
c_regex_traits<wchar_t>::string_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::transform(const wchar_t* p1, const wchar_t* p2)
|
90
|
+
{
|
91
|
+
std::size_t r;
|
92
|
+
std::size_t s = 10;
|
93
|
+
std::wstring src(p1, p2);
|
94
|
+
std::wstring result(s, L' ');
|
95
|
+
while(s < (r = std::wcsxfrm(&*result.begin(), src.c_str(), s)))
|
96
|
+
{
|
97
|
+
result.append(r - s + 3, L' ');
|
98
|
+
s = result.size();
|
99
|
+
}
|
100
|
+
result.erase(r);
|
101
|
+
return result;
|
102
|
+
}
|
103
|
+
|
104
|
+
c_regex_traits<wchar_t>::string_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::transform_primary(const wchar_t* p1, const wchar_t* p2)
|
105
|
+
{
|
106
|
+
static wchar_t s_delim;
|
107
|
+
static const int s_collate_type = ::boost::re_detail::find_sort_syntax(static_cast<const c_regex_traits<wchar_t>*>(0), &s_delim);
|
108
|
+
std::wstring result;
|
109
|
+
//
|
110
|
+
// What we do here depends upon the format of the sort key returned by
|
111
|
+
// sort key returned by this->transform:
|
112
|
+
//
|
113
|
+
switch(s_collate_type)
|
114
|
+
{
|
115
|
+
case ::boost::re_detail::sort_C:
|
116
|
+
case ::boost::re_detail::sort_unknown:
|
117
|
+
// the best we can do is translate to lower case, then get a regular sort key:
|
118
|
+
{
|
119
|
+
result.assign(p1, p2);
|
120
|
+
for(std::wstring::size_type i = 0; i < result.size(); ++i)
|
121
|
+
result[i] = (std::towlower)(result[i]);
|
122
|
+
result = c_regex_traits<wchar_t>::transform(&*result.begin(), &*result.begin() + result.size());
|
123
|
+
break;
|
124
|
+
}
|
125
|
+
case ::boost::re_detail::sort_fixed:
|
126
|
+
{
|
127
|
+
// get a regular sort key, and then truncate it:
|
128
|
+
result = c_regex_traits<wchar_t>::transform(&*result.begin(), &*result.begin() + result.size());
|
129
|
+
result.erase(s_delim);
|
130
|
+
break;
|
131
|
+
}
|
132
|
+
case ::boost::re_detail::sort_delim:
|
133
|
+
// get a regular sort key, and then truncate everything after the delim:
|
134
|
+
result = c_regex_traits<wchar_t>::transform(&*result.begin(), &*result.begin() + result.size());
|
135
|
+
if(result.size() && (result[0] == s_delim))
|
136
|
+
break;
|
137
|
+
std::size_t i;
|
138
|
+
for(i = 0; i < result.size(); ++i)
|
139
|
+
{
|
140
|
+
if(result[i] == s_delim)
|
141
|
+
break;
|
142
|
+
}
|
143
|
+
result.erase(i);
|
144
|
+
break;
|
145
|
+
}
|
146
|
+
if(result.empty())
|
147
|
+
result = std::wstring(1, char(0));
|
148
|
+
return result;
|
149
|
+
}
|
150
|
+
|
151
|
+
c_regex_traits<wchar_t>::char_class_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::lookup_classname(const wchar_t* p1, const wchar_t* p2)
|
152
|
+
{
|
153
|
+
static const char_class_type masks[] =
|
154
|
+
{
|
155
|
+
0,
|
156
|
+
char_class_alnum,
|
157
|
+
char_class_alpha,
|
158
|
+
char_class_blank,
|
159
|
+
char_class_cntrl,
|
160
|
+
char_class_digit,
|
161
|
+
char_class_digit,
|
162
|
+
char_class_graph,
|
163
|
+
char_class_horizontal,
|
164
|
+
char_class_lower,
|
165
|
+
char_class_lower,
|
166
|
+
char_class_print,
|
167
|
+
char_class_punct,
|
168
|
+
char_class_space,
|
169
|
+
char_class_space,
|
170
|
+
char_class_upper,
|
171
|
+
char_class_unicode,
|
172
|
+
char_class_upper,
|
173
|
+
char_class_vertical,
|
174
|
+
char_class_alnum | char_class_word,
|
175
|
+
char_class_alnum | char_class_word,
|
176
|
+
char_class_xdigit,
|
177
|
+
};
|
178
|
+
|
179
|
+
int idx = ::boost::re_detail::get_default_class_id(p1, p2);
|
180
|
+
if(idx < 0)
|
181
|
+
{
|
182
|
+
std::wstring s(p1, p2);
|
183
|
+
for(std::wstring::size_type i = 0; i < s.size(); ++i)
|
184
|
+
s[i] = (std::towlower)(s[i]);
|
185
|
+
idx = ::boost::re_detail::get_default_class_id(&*s.begin(), &*s.begin() + s.size());
|
186
|
+
}
|
187
|
+
BOOST_ASSERT(idx+1 < static_cast<int>(sizeof(masks) / sizeof(masks[0])));
|
188
|
+
return masks[idx+1];
|
189
|
+
}
|
190
|
+
|
191
|
+
bool BOOST_REGEX_CALL c_regex_traits<wchar_t>::isctype(wchar_t c, char_class_type mask)
|
192
|
+
{
|
193
|
+
return
|
194
|
+
((mask & char_class_space) && (std::iswspace)(c))
|
195
|
+
|| ((mask & char_class_print) && (std::iswprint)(c))
|
196
|
+
|| ((mask & char_class_cntrl) && (std::iswcntrl)(c))
|
197
|
+
|| ((mask & char_class_upper) && (std::iswupper)(c))
|
198
|
+
|| ((mask & char_class_lower) && (std::iswlower)(c))
|
199
|
+
|| ((mask & char_class_alpha) && (std::iswalpha)(c))
|
200
|
+
|| ((mask & char_class_digit) && (std::iswdigit)(c))
|
201
|
+
|| ((mask & char_class_punct) && (std::iswpunct)(c))
|
202
|
+
|| ((mask & char_class_xdigit) && (std::iswxdigit)(c))
|
203
|
+
|| ((mask & char_class_blank) && (std::iswspace)(c) && !::boost::re_detail::is_separator(c))
|
204
|
+
|| ((mask & char_class_word) && (c == '_'))
|
205
|
+
|| ((mask & char_class_unicode) && (c & ~static_cast<wchar_t>(0xff)))
|
206
|
+
|| ((mask & char_class_vertical) && (::boost::re_detail::is_separator(c) || (c == L'\v')))
|
207
|
+
|| ((mask & char_class_horizontal) && (std::iswspace)(c) && !::boost::re_detail::is_separator(c) && (c != L'\v'));
|
208
|
+
}
|
209
|
+
|
210
|
+
c_regex_traits<wchar_t>::string_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::lookup_collatename(const wchar_t* p1, const wchar_t* p2)
|
211
|
+
{
|
212
|
+
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\
|
213
|
+
&& !BOOST_WORKAROUND(BOOST_MSVC, < 1300)\
|
214
|
+
&& !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)
|
215
|
+
std::string name(p1, p2);
|
216
|
+
#else
|
217
|
+
std::string name;
|
218
|
+
const wchar_t* p0 = p1;
|
219
|
+
while(p0 != p2)
|
220
|
+
name.append(1, char(*p0++));
|
221
|
+
#endif
|
222
|
+
name = ::boost::re_detail::lookup_default_collate_name(name);
|
223
|
+
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\
|
224
|
+
&& !BOOST_WORKAROUND(BOOST_MSVC, < 1300)\
|
225
|
+
&& !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)
|
226
|
+
if(name.size())
|
227
|
+
return string_type(name.begin(), name.end());
|
228
|
+
#else
|
229
|
+
if(name.size())
|
230
|
+
{
|
231
|
+
string_type result;
|
232
|
+
typedef std::string::const_iterator iter;
|
233
|
+
iter b = name.begin();
|
234
|
+
iter e = name.end();
|
235
|
+
while(b != e)
|
236
|
+
result.append(1, wchar_t(*b++));
|
237
|
+
return result;
|
238
|
+
}
|
239
|
+
#endif
|
240
|
+
if(p2 - p1 == 1)
|
241
|
+
return string_type(1, *p1);
|
242
|
+
return string_type();
|
243
|
+
}
|
244
|
+
|
245
|
+
int BOOST_REGEX_CALL c_regex_traits<wchar_t>::value(wchar_t c, int radix)
|
246
|
+
{
|
247
|
+
#ifdef __BORLANDC__
|
248
|
+
// workaround for broken wcstol:
|
249
|
+
if((std::iswxdigit)(c) == 0)
|
250
|
+
return -1;
|
251
|
+
#endif
|
252
|
+
wchar_t b[2] = { c, '\0', };
|
253
|
+
wchar_t* ep;
|
254
|
+
int result = std::wcstol(b, &ep, radix);
|
255
|
+
if(ep == b)
|
256
|
+
return -1;
|
257
|
+
return result;
|
258
|
+
}
|
259
|
+
|
260
|
+
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
|
261
|
+
c_regex_traits<unsigned short>::string_type BOOST_REGEX_CALL c_regex_traits<unsigned short>::transform(const unsigned short* p1, const unsigned short* p2)
|
262
|
+
{
|
263
|
+
std::wstring result = c_regex_traits<wchar_t>::transform((const wchar_t*)p1, (const wchar_t*)p2);
|
264
|
+
return string_type(result.begin(), result.end());
|
265
|
+
}
|
266
|
+
|
267
|
+
c_regex_traits<unsigned short>::string_type BOOST_REGEX_CALL c_regex_traits<unsigned short>::transform_primary(const unsigned short* p1, const unsigned short* p2)
|
268
|
+
{
|
269
|
+
std::wstring result = c_regex_traits<wchar_t>::transform_primary((const wchar_t*)p1, (const wchar_t*)p2);
|
270
|
+
return string_type(result.begin(), result.end());
|
271
|
+
}
|
272
|
+
|
273
|
+
c_regex_traits<unsigned short>::char_class_type BOOST_REGEX_CALL c_regex_traits<unsigned short>::lookup_classname(const unsigned short* p1, const unsigned short* p2)
|
274
|
+
{
|
275
|
+
return c_regex_traits<wchar_t>::lookup_classname((const wchar_t*)p1, (const wchar_t*)p2);
|
276
|
+
}
|
277
|
+
|
278
|
+
c_regex_traits<unsigned short>::string_type BOOST_REGEX_CALL c_regex_traits<unsigned short>::lookup_collatename(const unsigned short* p1, const unsigned short* p2)
|
279
|
+
{
|
280
|
+
std::wstring result = c_regex_traits<wchar_t>::lookup_collatename((const wchar_t*)p1, (const wchar_t*)p2);
|
281
|
+
return string_type(result.begin(), result.end());
|
282
|
+
}
|
283
|
+
|
284
|
+
bool BOOST_REGEX_CALL c_regex_traits<unsigned short>::isctype(unsigned short c, char_class_type m)
|
285
|
+
{
|
286
|
+
return c_regex_traits<wchar_t>::isctype(c, m);
|
287
|
+
}
|
288
|
+
|
289
|
+
int BOOST_REGEX_CALL c_regex_traits<unsigned short>::value(unsigned short c, int radix)
|
290
|
+
{
|
291
|
+
return c_regex_traits<wchar_t>::value(c, radix);
|
292
|
+
}
|
293
|
+
|
294
|
+
#endif
|
295
|
+
|
296
|
+
}
|
297
|
+
|
298
|
+
#endif // BOOST_NO_WREGEX
|
299
|
+
|
300
|
+
#endif // __BORLANDC__
|
301
|
+
|