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.

Files changed (156) hide show
  1. data.tar.gz.asc +7 -7
  2. data/.gitignore +1 -0
  3. data/NEWS +22 -0
  4. data/build/preprocessor.rb +10 -0
  5. data/build/rpm.rb +74 -65
  6. data/debian.template/rules.template +8 -0
  7. data/dev/copy_boost_headers.rb +11 -2
  8. data/doc/Users guide Apache.idmap.txt +161 -145
  9. data/doc/Users guide Apache.txt +12 -1
  10. data/doc/Users guide Nginx.idmap.txt +142 -126
  11. data/doc/Users guide Nginx.txt +14 -1
  12. data/doc/Users guide Standalone.txt +1 -0
  13. data/doc/users_guide_snippets/environment_variables.txt +1 -1
  14. data/doc/users_guide_snippets/installation.txt +2 -0
  15. data/doc/users_guide_snippets/tips.txt +118 -0
  16. data/ext/apache2/Configuration.cpp +0 -6
  17. data/ext/apache2/Configuration.hpp +0 -5
  18. data/ext/apache2/ConfigurationCommands.cpp +7 -0
  19. data/ext/apache2/ConfigurationFields.hpp +2 -0
  20. data/ext/apache2/ConfigurationSetters.cpp +24 -0
  21. data/ext/apache2/CreateDirConfig.cpp +1 -0
  22. data/ext/apache2/Hooks.cpp +0 -1
  23. data/ext/apache2/MergeDirConfig.cpp +7 -0
  24. data/ext/apache2/SetHeaders.cpp +5 -1
  25. data/ext/boost/cregex.hpp +39 -0
  26. data/ext/boost/libs/regex/src/c_regex_traits.cpp +193 -0
  27. data/ext/boost/libs/regex/src/cpp_regex_traits.cpp +117 -0
  28. data/ext/boost/libs/regex/src/cregex.cpp +660 -0
  29. data/ext/boost/libs/regex/src/instances.cpp +32 -0
  30. data/ext/boost/libs/regex/src/internals.hpp +35 -0
  31. data/ext/boost/libs/regex/src/posix_api.cpp +296 -0
  32. data/ext/boost/libs/regex/src/regex.cpp +227 -0
  33. data/ext/boost/libs/regex/src/regex_debug.cpp +59 -0
  34. data/ext/boost/libs/regex/src/regex_raw_buffer.cpp +72 -0
  35. data/ext/boost/libs/regex/src/regex_traits_defaults.cpp +692 -0
  36. data/ext/boost/libs/regex/src/static_mutex.cpp +179 -0
  37. data/ext/boost/libs/regex/src/wc_regex_traits.cpp +301 -0
  38. data/ext/boost/libs/regex/src/wide_posix_api.cpp +315 -0
  39. data/ext/boost/libs/regex/src/winstances.cpp +35 -0
  40. data/ext/boost/regex.h +100 -0
  41. data/ext/boost/regex.hpp +37 -0
  42. data/ext/boost/regex/concepts.hpp +1128 -0
  43. data/ext/boost/regex/config.hpp +435 -0
  44. data/ext/boost/regex/config/borland.hpp +72 -0
  45. data/ext/boost/regex/config/cwchar.hpp +207 -0
  46. data/ext/boost/regex/mfc.hpp +190 -0
  47. data/ext/boost/regex/pattern_except.hpp +100 -0
  48. data/ext/boost/regex/pending/object_cache.hpp +165 -0
  49. data/ext/boost/regex/pending/static_mutex.hpp +179 -0
  50. data/ext/boost/regex/pending/unicode_iterator.hpp +776 -0
  51. data/ext/boost/regex/regex_traits.hpp +35 -0
  52. data/ext/boost/regex/user.hpp +93 -0
  53. data/ext/boost/regex/v4/basic_regex.hpp +782 -0
  54. data/ext/boost/regex/v4/basic_regex_creator.hpp +1571 -0
  55. data/ext/boost/regex/v4/basic_regex_parser.hpp +2874 -0
  56. data/ext/boost/regex/v4/c_regex_traits.hpp +211 -0
  57. data/ext/boost/regex/v4/char_regex_traits.hpp +81 -0
  58. data/ext/boost/regex/v4/cpp_regex_traits.hpp +1099 -0
  59. data/ext/boost/regex/v4/cregex.hpp +330 -0
  60. data/ext/boost/regex/v4/error_type.hpp +59 -0
  61. data/ext/boost/regex/v4/fileiter.hpp +455 -0
  62. data/ext/boost/regex/v4/instances.hpp +222 -0
  63. data/ext/boost/regex/v4/iterator_category.hpp +91 -0
  64. data/ext/boost/regex/v4/iterator_traits.hpp +135 -0
  65. data/ext/boost/regex/v4/match_flags.hpp +138 -0
  66. data/ext/boost/regex/v4/match_results.hpp +702 -0
  67. data/ext/boost/regex/v4/mem_block_cache.hpp +99 -0
  68. data/ext/boost/regex/v4/perl_matcher.hpp +587 -0
  69. data/ext/boost/regex/v4/perl_matcher_common.hpp +996 -0
  70. data/ext/boost/regex/v4/perl_matcher_non_recursive.hpp +1642 -0
  71. data/ext/boost/regex/v4/perl_matcher_recursive.hpp +991 -0
  72. data/ext/boost/regex/v4/primary_transform.hpp +146 -0
  73. data/ext/boost/regex/v4/protected_call.hpp +81 -0
  74. data/ext/boost/regex/v4/regbase.hpp +180 -0
  75. data/ext/boost/regex/v4/regex.hpp +202 -0
  76. data/ext/boost/regex/v4/regex_format.hpp +1156 -0
  77. data/ext/boost/regex/v4/regex_fwd.hpp +73 -0
  78. data/ext/boost/regex/v4/regex_grep.hpp +155 -0
  79. data/ext/boost/regex/v4/regex_iterator.hpp +201 -0
  80. data/ext/boost/regex/v4/regex_match.hpp +382 -0
  81. data/ext/boost/regex/v4/regex_merge.hpp +93 -0
  82. data/ext/boost/regex/v4/regex_raw_buffer.hpp +210 -0
  83. data/ext/boost/regex/v4/regex_replace.hpp +99 -0
  84. data/ext/boost/regex/v4/regex_search.hpp +217 -0
  85. data/ext/boost/regex/v4/regex_split.hpp +172 -0
  86. data/ext/boost/regex/v4/regex_token_iterator.hpp +342 -0
  87. data/ext/boost/regex/v4/regex_traits.hpp +189 -0
  88. data/ext/boost/regex/v4/regex_traits_defaults.hpp +371 -0
  89. data/ext/boost/regex/v4/regex_workaround.hpp +232 -0
  90. data/ext/boost/regex/v4/states.hpp +301 -0
  91. data/ext/boost/regex/v4/sub_match.hpp +512 -0
  92. data/ext/boost/regex/v4/syntax_type.hpp +105 -0
  93. data/ext/boost/regex/v4/u32regex_iterator.hpp +193 -0
  94. data/ext/boost/regex/v4/u32regex_token_iterator.hpp +377 -0
  95. data/ext/boost/regex/v4/w32_regex_traits.hpp +741 -0
  96. data/ext/boost/regex_fwd.hpp +33 -0
  97. data/ext/common/AgentsStarter.h +0 -11
  98. data/ext/common/ApplicationPool2/Common.h +1 -7
  99. data/ext/common/ApplicationPool2/DirectSpawner.h +3 -3
  100. data/ext/common/ApplicationPool2/Group.h +166 -69
  101. data/ext/common/ApplicationPool2/Implementation.cpp +55 -10
  102. data/ext/common/ApplicationPool2/Options.h +45 -10
  103. data/ext/common/ApplicationPool2/PipeWatcher.h +1 -2
  104. data/ext/common/ApplicationPool2/Pool.h +29 -7
  105. data/ext/common/ApplicationPool2/Process.h +22 -3
  106. data/ext/common/ApplicationPool2/Session.h +1 -0
  107. data/ext/common/ApplicationPool2/SmartSpawner.h +5 -10
  108. data/ext/common/ApplicationPool2/Spawner.h +10 -15
  109. data/ext/common/ApplicationPool2/SuperGroup.h +10 -9
  110. data/ext/common/Constants.h +1 -3
  111. data/ext/common/Hooks.h +193 -0
  112. data/ext/common/Logging.cpp +67 -2
  113. data/ext/common/Logging.h +23 -1
  114. data/ext/common/Utils.cpp +0 -21
  115. data/ext/common/Utils.h +0 -42
  116. data/ext/common/Utils/CachedFileStat.hpp +1 -1
  117. data/ext/common/Utils/StrIntUtils.h +61 -14
  118. data/ext/common/Utils/StringMap.h +4 -0
  119. data/ext/common/agents/HelperAgent/AgentOptions.h +4 -4
  120. data/ext/common/agents/HelperAgent/Main.cpp +2 -3
  121. data/ext/common/agents/HelperAgent/RequestHandler.h +65 -2
  122. data/ext/common/agents/LoggingAgent/FilterSupport.h +3 -1
  123. data/ext/common/agents/Watchdog/Main.cpp +8 -72
  124. data/ext/nginx/CacheLocationConfig.c +29 -1
  125. data/ext/nginx/Configuration.c +0 -12
  126. data/ext/nginx/Configuration.h +0 -1
  127. data/ext/nginx/ConfigurationCommands.c +10 -0
  128. data/ext/nginx/ConfigurationFields.h +2 -0
  129. data/ext/nginx/CreateLocationConfig.c +4 -0
  130. data/ext/nginx/MergeLocationConfig.c +6 -0
  131. data/ext/oxt/system_calls.cpp +7 -1
  132. data/ext/oxt/system_calls.hpp +7 -7
  133. data/helper-scripts/node-loader.js +6 -2
  134. data/helper-scripts/rack-loader.rb +5 -2
  135. data/helper-scripts/rack-preloader.rb +5 -2
  136. data/lib/phusion_passenger.rb +1 -1
  137. data/lib/phusion_passenger/apache2/config_options.rb +8 -0
  138. data/lib/phusion_passenger/constants.rb +0 -1
  139. data/lib/phusion_passenger/nginx/config_options.rb +9 -2
  140. data/lib/phusion_passenger/platform_info/apache.rb +2 -1
  141. data/lib/phusion_passenger/platform_info/compiler.rb +15 -1
  142. data/lib/phusion_passenger/platform_info/cxx_portability.rb +2 -0
  143. data/node_lib/phusion_passenger/httplib_emulation.js +85 -17
  144. data/node_lib/phusion_passenger/request_handler.js +10 -2
  145. data/rpm/Vagrantfile +32 -0
  146. data/rpm/get_distro_id.py +4 -0
  147. data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +2 -2
  148. data/test/cxx/ApplicationPool2/PoolTest.cpp +60 -9
  149. data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +2 -6
  150. data/test/cxx/CachedFileStatTest.cpp +5 -5
  151. data/test/cxx/RequestHandlerTest.cpp +3 -6
  152. data/test/cxx/UtilsTest.cpp +30 -0
  153. data/test/node/httplib_emulation_spec.js +491 -0
  154. data/test/node/spec_helper.js +25 -0
  155. metadata +78 -2
  156. metadata.gz.asc +7 -7
@@ -0,0 +1,189 @@
1
+ /*
2
+ *
3
+ * Copyright (c) 2003
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 regex_traits.hpp
15
+ * VERSION see <boost/version.hpp>
16
+ * DESCRIPTION: Declares regular expression traits classes.
17
+ */
18
+
19
+ #ifndef BOOST_REGEX_TRAITS_HPP_INCLUDED
20
+ #define BOOST_REGEX_TRAITS_HPP_INCLUDED
21
+
22
+ #ifndef BOOST_REGEX_CONFIG_HPP
23
+ #include <boost/regex/config.hpp>
24
+ #endif
25
+ #ifndef BOOST_REGEX_WORKAROUND_HPP
26
+ #include <boost/regex/v4/regex_workaround.hpp>
27
+ #endif
28
+ #ifndef BOOST_REGEX_SYNTAX_TYPE_HPP
29
+ #include <boost/regex/v4/syntax_type.hpp>
30
+ #endif
31
+ #ifndef BOOST_REGEX_ERROR_TYPE_HPP
32
+ #include <boost/regex/v4/error_type.hpp>
33
+ #endif
34
+ #ifndef BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED
35
+ #include <boost/regex/v4/regex_traits_defaults.hpp>
36
+ #endif
37
+ #ifndef BOOST_NO_STD_LOCALE
38
+ # ifndef BOOST_CPP_REGEX_TRAITS_HPP_INCLUDED
39
+ # include <boost/regex/v4/cpp_regex_traits.hpp>
40
+ # endif
41
+ #endif
42
+ #if !BOOST_WORKAROUND(__BORLANDC__, < 0x560)
43
+ # ifndef BOOST_C_REGEX_TRAITS_HPP_INCLUDED
44
+ # include <boost/regex/v4/c_regex_traits.hpp>
45
+ # endif
46
+ #endif
47
+ #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
48
+ # ifndef BOOST_W32_REGEX_TRAITS_HPP_INCLUDED
49
+ # include <boost/regex/v4/w32_regex_traits.hpp>
50
+ # endif
51
+ #endif
52
+ #ifndef BOOST_REGEX_FWD_HPP_INCLUDED
53
+ #include <boost/regex_fwd.hpp>
54
+ #endif
55
+
56
+ #include "boost/mpl/has_xxx.hpp"
57
+ #include <boost/static_assert.hpp>
58
+
59
+ #ifdef BOOST_MSVC
60
+ #pragma warning(push)
61
+ #pragma warning(disable: 4103)
62
+ #endif
63
+ #ifdef BOOST_HAS_ABI_HEADERS
64
+ # include BOOST_ABI_PREFIX
65
+ #endif
66
+ #ifdef BOOST_MSVC
67
+ #pragma warning(pop)
68
+ #endif
69
+
70
+ namespace boost{
71
+
72
+ template <class charT, class implementationT >
73
+ struct regex_traits : public implementationT
74
+ {
75
+ regex_traits() : implementationT() {}
76
+ };
77
+
78
+ //
79
+ // class regex_traits_wrapper.
80
+ // this is what our implementation will actually store;
81
+ // it provides default implementations of the "optional"
82
+ // interfaces that we support, in addition to the
83
+ // required "standard" ones:
84
+ //
85
+ namespace re_detail{
86
+ #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__HP_aCC, < 60000)
87
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(boost_extensions_tag)
88
+ #else
89
+ template<class T>
90
+ struct has_boost_extensions_tag
91
+ {
92
+ BOOST_STATIC_CONSTANT(bool, value = false);
93
+ };
94
+ #endif
95
+
96
+ template <class BaseT>
97
+ struct default_wrapper : public BaseT
98
+ {
99
+ typedef typename BaseT::char_type char_type;
100
+ std::string error_string(::boost::regex_constants::error_type e)const
101
+ {
102
+ return ::boost::re_detail::get_default_error_string(e);
103
+ }
104
+ ::boost::regex_constants::syntax_type syntax_type(char_type c)const
105
+ {
106
+ return ((c & 0x7f) == c) ? get_default_syntax_type(static_cast<char>(c)) : ::boost::regex_constants::syntax_char;
107
+ }
108
+ ::boost::regex_constants::escape_syntax_type escape_syntax_type(char_type c)const
109
+ {
110
+ return ((c & 0x7f) == c) ? get_default_escape_syntax_type(static_cast<char>(c)) : ::boost::regex_constants::escape_type_identity;
111
+ }
112
+ int toi(const char_type*& p1, const char_type* p2, int radix)const
113
+ {
114
+ return ::boost::re_detail::global_toi(p1, p2, radix, *this);
115
+ }
116
+ char_type translate(char_type c, bool icase)const
117
+ {
118
+ return (icase ? this->translate_nocase(c) : this->translate(c));
119
+ }
120
+ char_type translate(char_type c)const
121
+ {
122
+ return BaseT::translate(c);
123
+ }
124
+ char_type tolower(char_type c)const
125
+ {
126
+ return ::boost::re_detail::global_lower(c);
127
+ }
128
+ char_type toupper(char_type c)const
129
+ {
130
+ return ::boost::re_detail::global_upper(c);
131
+ }
132
+ };
133
+
134
+ template <class BaseT, bool has_extensions>
135
+ struct compute_wrapper_base
136
+ {
137
+ typedef BaseT type;
138
+ };
139
+ #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__HP_aCC, < 60000)
140
+ template <class BaseT>
141
+ struct compute_wrapper_base<BaseT, false>
142
+ {
143
+ typedef default_wrapper<BaseT> type;
144
+ };
145
+ #else
146
+ template <>
147
+ struct compute_wrapper_base<c_regex_traits<char>, false>
148
+ {
149
+ typedef default_wrapper<c_regex_traits<char> > type;
150
+ };
151
+ #ifndef BOOST_NO_WREGEX
152
+ template <>
153
+ struct compute_wrapper_base<c_regex_traits<wchar_t>, false>
154
+ {
155
+ typedef default_wrapper<c_regex_traits<wchar_t> > type;
156
+ };
157
+ #endif
158
+ #endif
159
+
160
+ } // namespace re_detail
161
+
162
+ template <class BaseT>
163
+ struct regex_traits_wrapper
164
+ : public ::boost::re_detail::compute_wrapper_base<
165
+ BaseT,
166
+ ::boost::re_detail::has_boost_extensions_tag<BaseT>::value
167
+ >::type
168
+ {
169
+ regex_traits_wrapper(){}
170
+ private:
171
+ regex_traits_wrapper(const regex_traits_wrapper&);
172
+ regex_traits_wrapper& operator=(const regex_traits_wrapper&);
173
+ };
174
+
175
+ } // namespace boost
176
+
177
+ #ifdef BOOST_MSVC
178
+ #pragma warning(push)
179
+ #pragma warning(disable: 4103)
180
+ #endif
181
+ #ifdef BOOST_HAS_ABI_HEADERS
182
+ # include BOOST_ABI_SUFFIX
183
+ #endif
184
+ #ifdef BOOST_MSVC
185
+ #pragma warning(pop)
186
+ #endif
187
+
188
+ #endif // include
189
+
@@ -0,0 +1,371 @@
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 regex_traits_defaults.hpp
15
+ * VERSION see <boost/version.hpp>
16
+ * DESCRIPTION: Declares API's for access to regex_traits default properties.
17
+ */
18
+
19
+ #ifndef BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED
20
+ #define BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED
21
+
22
+ #ifdef BOOST_MSVC
23
+ #pragma warning(push)
24
+ #pragma warning(disable: 4103)
25
+ #endif
26
+ #ifdef BOOST_HAS_ABI_HEADERS
27
+ # include BOOST_ABI_PREFIX
28
+ #endif
29
+ #ifdef BOOST_MSVC
30
+ #pragma warning(pop)
31
+ #endif
32
+
33
+ #ifndef BOOST_REGEX_SYNTAX_TYPE_HPP
34
+ #include <boost/regex/v4/syntax_type.hpp>
35
+ #endif
36
+ #ifndef BOOST_REGEX_ERROR_TYPE_HPP
37
+ #include <boost/regex/v4/error_type.hpp>
38
+ #endif
39
+
40
+ #ifdef BOOST_NO_STDC_NAMESPACE
41
+ namespace std{
42
+ using ::strlen;
43
+ }
44
+ #endif
45
+
46
+ namespace boost{ namespace re_detail{
47
+
48
+
49
+ //
50
+ // helpers to suppress warnings:
51
+ //
52
+ template <class charT>
53
+ inline bool is_extended(charT c)
54
+ { return c > 256; }
55
+ inline bool is_extended(char)
56
+ { return false; }
57
+
58
+
59
+ BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_syntax(regex_constants::syntax_type n);
60
+ BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_error_string(regex_constants::error_type n);
61
+ BOOST_REGEX_DECL regex_constants::syntax_type BOOST_REGEX_CALL get_default_syntax_type(char c);
62
+ BOOST_REGEX_DECL regex_constants::escape_syntax_type BOOST_REGEX_CALL get_default_escape_syntax_type(char c);
63
+
64
+ // is charT c a combining character?
65
+ BOOST_REGEX_DECL bool BOOST_REGEX_CALL is_combining_implementation(uint_least16_t s);
66
+
67
+ template <class charT>
68
+ inline bool is_combining(charT c)
69
+ {
70
+ return (c <= static_cast<charT>(0)) ? false : ((c >= static_cast<charT>((std::numeric_limits<uint_least16_t>::max)())) ? false : is_combining_implementation(static_cast<unsigned short>(c)));
71
+ }
72
+ template <>
73
+ inline bool is_combining<char>(char)
74
+ {
75
+ return false;
76
+ }
77
+ template <>
78
+ inline bool is_combining<signed char>(signed char)
79
+ {
80
+ return false;
81
+ }
82
+ template <>
83
+ inline bool is_combining<unsigned char>(unsigned char)
84
+ {
85
+ return false;
86
+ }
87
+ #if !defined(__hpux) && !defined(__WINSCW__) // can't use WCHAR_MAX/MIN in pp-directives
88
+ #ifdef _MSC_VER
89
+ template<>
90
+ inline bool is_combining<wchar_t>(wchar_t c)
91
+ {
92
+ return is_combining_implementation(static_cast<unsigned short>(c));
93
+ }
94
+ #elif !defined(__DECCXX) && !defined(__osf__) && !defined(__OSF__) && defined(WCHAR_MIN) && (WCHAR_MIN == 0) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
95
+ #if defined(WCHAR_MAX) && (WCHAR_MAX <= USHRT_MAX)
96
+ template<>
97
+ inline bool is_combining<wchar_t>(wchar_t c)
98
+ {
99
+ return is_combining_implementation(static_cast<unsigned short>(c));
100
+ }
101
+ #else
102
+ template<>
103
+ inline bool is_combining<wchar_t>(wchar_t c)
104
+ {
105
+ return (c >= (std::numeric_limits<uint_least16_t>::max)()) ? false : is_combining_implementation(static_cast<unsigned short>(c));
106
+ }
107
+ #endif
108
+ #endif
109
+ #endif
110
+
111
+ //
112
+ // is a charT c a line separator?
113
+ //
114
+ template <class charT>
115
+ inline bool is_separator(charT c)
116
+ {
117
+ return BOOST_REGEX_MAKE_BOOL(
118
+ (c == static_cast<charT>('\n'))
119
+ || (c == static_cast<charT>('\r'))
120
+ || (c == static_cast<charT>('\f'))
121
+ || (static_cast<boost::uint16_t>(c) == 0x2028u)
122
+ || (static_cast<boost::uint16_t>(c) == 0x2029u)
123
+ || (static_cast<boost::uint16_t>(c) == 0x85u));
124
+ }
125
+ template <>
126
+ inline bool is_separator<char>(char c)
127
+ {
128
+ return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r') || (c == '\f'));
129
+ }
130
+
131
+ //
132
+ // get a default collating element:
133
+ //
134
+ BOOST_REGEX_DECL std::string BOOST_REGEX_CALL lookup_default_collate_name(const std::string& name);
135
+
136
+ //
137
+ // get the state_id of a character clasification, the individual
138
+ // traits classes then transform that state_id into a bitmask:
139
+ //
140
+ template <class charT>
141
+ struct character_pointer_range
142
+ {
143
+ const charT* p1;
144
+ const charT* p2;
145
+
146
+ bool operator < (const character_pointer_range& r)const
147
+ {
148
+ return std::lexicographical_compare(p1, p2, r.p1, r.p2);
149
+ }
150
+ bool operator == (const character_pointer_range& r)const
151
+ {
152
+ // Not only do we check that the ranges are of equal size before
153
+ // calling std::equal, but there is no other algorithm available:
154
+ // not even a non-standard MS one. So forward to unchecked_equal
155
+ // in the MS case.
156
+ return ((p2 - p1) == (r.p2 - r.p1)) && re_detail::equal(p1, p2, r.p1);
157
+ }
158
+ };
159
+ template <class charT>
160
+ int get_default_class_id(const charT* p1, const charT* p2)
161
+ {
162
+ static const charT data[73] = {
163
+ 'a', 'l', 'n', 'u', 'm',
164
+ 'a', 'l', 'p', 'h', 'a',
165
+ 'b', 'l', 'a', 'n', 'k',
166
+ 'c', 'n', 't', 'r', 'l',
167
+ 'd', 'i', 'g', 'i', 't',
168
+ 'g', 'r', 'a', 'p', 'h',
169
+ 'l', 'o', 'w', 'e', 'r',
170
+ 'p', 'r', 'i', 'n', 't',
171
+ 'p', 'u', 'n', 'c', 't',
172
+ 's', 'p', 'a', 'c', 'e',
173
+ 'u', 'n', 'i', 'c', 'o', 'd', 'e',
174
+ 'u', 'p', 'p', 'e', 'r',
175
+ 'v',
176
+ 'w', 'o', 'r', 'd',
177
+ 'x', 'd', 'i', 'g', 'i', 't',
178
+ };
179
+
180
+ static const character_pointer_range<charT> ranges[21] =
181
+ {
182
+ {data+0, data+5,}, // alnum
183
+ {data+5, data+10,}, // alpha
184
+ {data+10, data+15,}, // blank
185
+ {data+15, data+20,}, // cntrl
186
+ {data+20, data+21,}, // d
187
+ {data+20, data+25,}, // digit
188
+ {data+25, data+30,}, // graph
189
+ {data+29, data+30,}, // h
190
+ {data+30, data+31,}, // l
191
+ {data+30, data+35,}, // lower
192
+ {data+35, data+40,}, // print
193
+ {data+40, data+45,}, // punct
194
+ {data+45, data+46,}, // s
195
+ {data+45, data+50,}, // space
196
+ {data+57, data+58,}, // u
197
+ {data+50, data+57,}, // unicode
198
+ {data+57, data+62,}, // upper
199
+ {data+62, data+63,}, // v
200
+ {data+63, data+64,}, // w
201
+ {data+63, data+67,}, // word
202
+ {data+67, data+73,}, // xdigit
203
+ };
204
+ static const character_pointer_range<charT>* ranges_begin = ranges;
205
+ static const character_pointer_range<charT>* ranges_end = ranges + (sizeof(ranges)/sizeof(ranges[0]));
206
+
207
+ character_pointer_range<charT> t = { p1, p2, };
208
+ const character_pointer_range<charT>* p = std::lower_bound(ranges_begin, ranges_end, t);
209
+ if((p != ranges_end) && (t == *p))
210
+ return static_cast<int>(p - ranges);
211
+ return -1;
212
+ }
213
+
214
+ //
215
+ // helper functions:
216
+ //
217
+ template <class charT>
218
+ std::ptrdiff_t global_length(const charT* p)
219
+ {
220
+ std::ptrdiff_t n = 0;
221
+ while(*p)
222
+ {
223
+ ++p;
224
+ ++n;
225
+ }
226
+ return n;
227
+ }
228
+ template<>
229
+ inline std::ptrdiff_t global_length<char>(const char* p)
230
+ {
231
+ return (std::strlen)(p);
232
+ }
233
+ #ifndef BOOST_NO_WREGEX
234
+ template<>
235
+ inline std::ptrdiff_t global_length<wchar_t>(const wchar_t* p)
236
+ {
237
+ return (std::wcslen)(p);
238
+ }
239
+ #endif
240
+ template <class charT>
241
+ inline charT BOOST_REGEX_CALL global_lower(charT c)
242
+ {
243
+ return c;
244
+ }
245
+ template <class charT>
246
+ inline charT BOOST_REGEX_CALL global_upper(charT c)
247
+ {
248
+ return c;
249
+ }
250
+
251
+ BOOST_REGEX_DECL char BOOST_REGEX_CALL do_global_lower(char c);
252
+ BOOST_REGEX_DECL char BOOST_REGEX_CALL do_global_upper(char c);
253
+ #ifndef BOOST_NO_WREGEX
254
+ BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL do_global_lower(wchar_t c);
255
+ BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL do_global_upper(wchar_t c);
256
+ #endif
257
+ #ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
258
+ BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL do_global_lower(unsigned short c);
259
+ BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL do_global_upper(unsigned short c);
260
+ #endif
261
+ //
262
+ // This sucks: declare template specialisations of global_lower/global_upper
263
+ // that just forward to the non-template implementation functions. We do
264
+ // this because there is one compiler (Compaq Tru64 C++) that doesn't seem
265
+ // to differentiate between templates and non-template overloads....
266
+ // what's more, the primary template, plus all overloads have to be
267
+ // defined in the same translation unit (if one is inline they all must be)
268
+ // otherwise the "local template instantiation" compiler option can pick
269
+ // the wrong instantiation when linking:
270
+ //
271
+ template<> inline char BOOST_REGEX_CALL global_lower<char>(char c){ return do_global_lower(c); }
272
+ template<> inline char BOOST_REGEX_CALL global_upper<char>(char c){ return do_global_upper(c); }
273
+ #ifndef BOOST_NO_WREGEX
274
+ template<> inline wchar_t BOOST_REGEX_CALL global_lower<wchar_t>(wchar_t c){ return do_global_lower(c); }
275
+ template<> inline wchar_t BOOST_REGEX_CALL global_upper<wchar_t>(wchar_t c){ return do_global_upper(c); }
276
+ #endif
277
+ #ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
278
+ template<> inline unsigned short BOOST_REGEX_CALL global_lower<unsigned short>(unsigned short c){ return do_global_lower(c); }
279
+ template<> inline unsigned short BOOST_REGEX_CALL global_upper<unsigned short>(unsigned short c){ return do_global_upper(c); }
280
+ #endif
281
+
282
+ template <class charT>
283
+ int global_value(charT c)
284
+ {
285
+ static const charT zero = '0';
286
+ static const charT nine = '9';
287
+ static const charT a = 'a';
288
+ static const charT f = 'f';
289
+ static const charT A = 'A';
290
+ static const charT F = 'F';
291
+
292
+ if(c > f) return -1;
293
+ if(c >= a) return 10 + (c - a);
294
+ if(c > F) return -1;
295
+ if(c >= A) return 10 + (c - A);
296
+ if(c > nine) return -1;
297
+ if(c >= zero) return c - zero;
298
+ return -1;
299
+ }
300
+ template <class charT, class traits>
301
+ int global_toi(const charT*& p1, const charT* p2, int radix, const traits& t)
302
+ {
303
+ (void)t; // warning suppression
304
+ int next_value = t.value(*p1, radix);
305
+ if((p1 == p2) || (next_value < 0) || (next_value >= radix))
306
+ return -1;
307
+ int result = 0;
308
+ while(p1 != p2)
309
+ {
310
+ next_value = t.value(*p1, radix);
311
+ if((next_value < 0) || (next_value >= radix))
312
+ break;
313
+ result *= radix;
314
+ result += next_value;
315
+ ++p1;
316
+ }
317
+ return result;
318
+ }
319
+
320
+ template <class charT>
321
+ inline const charT* get_escape_R_string()
322
+ {
323
+ #ifdef BOOST_MSVC
324
+ # pragma warning(push)
325
+ # pragma warning(disable:4309 4245)
326
+ #endif
327
+ static const charT e1[] = { '(', '?', '>', '\x0D', '\x0A', '?',
328
+ '|', '[', '\x0A', '\x0B', '\x0C', static_cast<unsigned char>('\x85'), '\\', 'x', '{', '2', '0', '2', '8', '}',
329
+ '\\', 'x', '{', '2', '0', '2', '9', '}', ']', ')', '\0' };
330
+ static const charT e2[] = { '(', '?', '>', '\x0D', '\x0A', '?',
331
+ '|', '[', '\x0A', '\x0B', '\x0C', static_cast<unsigned char>('\x85'), ']', ')', '\0' };
332
+
333
+ charT c = static_cast<charT>(0x2029u);
334
+ bool b = (static_cast<unsigned>(c) == 0x2029u);
335
+
336
+ return (b ? e1 : e2);
337
+ #ifdef BOOST_MSVC
338
+ # pragma warning(pop)
339
+ #endif
340
+ }
341
+
342
+ template <>
343
+ inline const char* get_escape_R_string<char>()
344
+ {
345
+ #ifdef BOOST_MSVC
346
+ # pragma warning(push)
347
+ # pragma warning(disable:4309)
348
+ #endif
349
+ static const char e2[] = { '(', '?', '>', '\x0D', '\x0A', '?',
350
+ '|', '[', '\x0A', '\x0B', '\x0C', '\x85', ']', ')', '\0' };
351
+ return e2;
352
+ #ifdef BOOST_MSVC
353
+ # pragma warning(pop)
354
+ #endif
355
+ }
356
+
357
+ } // re_detail
358
+ } // boost
359
+
360
+ #ifdef BOOST_MSVC
361
+ #pragma warning(push)
362
+ #pragma warning(disable: 4103)
363
+ #endif
364
+ #ifdef BOOST_HAS_ABI_HEADERS
365
+ # include BOOST_ABI_SUFFIX
366
+ #endif
367
+ #ifdef BOOST_MSVC
368
+ #pragma warning(pop)
369
+ #endif
370
+
371
+ #endif