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,330 @@
1
+ /*
2
+ *
3
+ * Copyright (c) 1998-2002
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 cregex.cpp
15
+ * VERSION see <boost/version.hpp>
16
+ * DESCRIPTION: Declares POSIX API functions
17
+ * + boost::RegEx high level wrapper.
18
+ */
19
+
20
+ #ifndef BOOST_RE_CREGEX_HPP_INCLUDED
21
+ #define BOOST_RE_CREGEX_HPP_INCLUDED
22
+
23
+ #ifndef BOOST_REGEX_CONFIG_HPP
24
+ #include <boost/regex/config.hpp>
25
+ #endif
26
+ #include <boost/regex/v4/match_flags.hpp>
27
+ #include <boost/regex/v4/error_type.hpp>
28
+
29
+ #ifdef __cplusplus
30
+ #include <cstddef>
31
+ #else
32
+ #include <stddef.h>
33
+ #endif
34
+
35
+ #ifdef BOOST_MSVC
36
+ #pragma warning(push)
37
+ #pragma warning(disable: 4103)
38
+ #endif
39
+ #ifdef BOOST_HAS_ABI_HEADERS
40
+ # include BOOST_ABI_PREFIX
41
+ #endif
42
+ #ifdef BOOST_MSVC
43
+ #pragma warning(pop)
44
+ #endif
45
+
46
+ /* include these defs only for POSIX compatablity */
47
+ #ifdef __cplusplus
48
+ namespace boost{
49
+ extern "C" {
50
+ #endif
51
+
52
+ #if defined(__cplusplus) && !defined(BOOST_NO_STDC_NAMESPACE)
53
+ typedef std::ptrdiff_t regoff_t;
54
+ typedef std::size_t regsize_t;
55
+ #else
56
+ typedef ptrdiff_t regoff_t;
57
+ typedef size_t regsize_t;
58
+ #endif
59
+
60
+ typedef struct
61
+ {
62
+ unsigned int re_magic;
63
+ #ifdef __cplusplus
64
+ std::size_t re_nsub; /* number of parenthesized subexpressions */
65
+ #else
66
+ size_t re_nsub;
67
+ #endif
68
+ const char* re_endp; /* end pointer for REG_PEND */
69
+ void* guts; /* none of your business :-) */
70
+ match_flag_type eflags; /* none of your business :-) */
71
+ } regex_tA;
72
+
73
+ #ifndef BOOST_NO_WREGEX
74
+ typedef struct
75
+ {
76
+ unsigned int re_magic;
77
+ #ifdef __cplusplus
78
+ std::size_t re_nsub; /* number of parenthesized subexpressions */
79
+ #else
80
+ size_t re_nsub;
81
+ #endif
82
+ const wchar_t* re_endp; /* end pointer for REG_PEND */
83
+ void* guts; /* none of your business :-) */
84
+ match_flag_type eflags; /* none of your business :-) */
85
+ } regex_tW;
86
+ #endif
87
+
88
+ typedef struct
89
+ {
90
+ regoff_t rm_so; /* start of match */
91
+ regoff_t rm_eo; /* end of match */
92
+ } regmatch_t;
93
+
94
+ /* regcomp() flags */
95
+ typedef enum{
96
+ REG_BASIC = 0000,
97
+ REG_EXTENDED = 0001,
98
+ REG_ICASE = 0002,
99
+ REG_NOSUB = 0004,
100
+ REG_NEWLINE = 0010,
101
+ REG_NOSPEC = 0020,
102
+ REG_PEND = 0040,
103
+ REG_DUMP = 0200,
104
+ REG_NOCOLLATE = 0400,
105
+ REG_ESCAPE_IN_LISTS = 01000,
106
+ REG_NEWLINE_ALT = 02000,
107
+ REG_PERLEX = 04000,
108
+
109
+ REG_PERL = REG_EXTENDED | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS | REG_PERLEX,
110
+ REG_AWK = REG_EXTENDED | REG_ESCAPE_IN_LISTS,
111
+ REG_GREP = REG_BASIC | REG_NEWLINE_ALT,
112
+ REG_EGREP = REG_EXTENDED | REG_NEWLINE_ALT,
113
+
114
+ REG_ASSERT = 15,
115
+ REG_INVARG = 16,
116
+ REG_ATOI = 255, /* convert name to number (!) */
117
+ REG_ITOA = 0400 /* convert number to name (!) */
118
+ } reg_comp_flags;
119
+
120
+ /* regexec() flags */
121
+ typedef enum{
122
+ REG_NOTBOL = 00001,
123
+ REG_NOTEOL = 00002,
124
+ REG_STARTEND = 00004
125
+ } reg_exec_flags;
126
+
127
+ /*
128
+ * POSIX error codes:
129
+ */
130
+ typedef unsigned reg_error_t;
131
+ typedef reg_error_t reg_errcode_t; /* backwards compatibility */
132
+
133
+ static const reg_error_t REG_NOERROR = 0; /* Success. */
134
+ static const reg_error_t REG_NOMATCH = 1; /* Didn't find a match (for regexec). */
135
+
136
+ /* POSIX regcomp return error codes. (In the order listed in the
137
+ standard.) */
138
+ static const reg_error_t REG_BADPAT = 2; /* Invalid pattern. */
139
+ static const reg_error_t REG_ECOLLATE = 3; /* Undefined collating element. */
140
+ static const reg_error_t REG_ECTYPE = 4; /* Invalid character class name. */
141
+ static const reg_error_t REG_EESCAPE = 5; /* Trailing backslash. */
142
+ static const reg_error_t REG_ESUBREG = 6; /* Invalid back reference. */
143
+ static const reg_error_t REG_EBRACK = 7; /* Unmatched left bracket. */
144
+ static const reg_error_t REG_EPAREN = 8; /* Parenthesis imbalance. */
145
+ static const reg_error_t REG_EBRACE = 9; /* Unmatched \{. */
146
+ static const reg_error_t REG_BADBR = 10; /* Invalid contents of \{\}. */
147
+ static const reg_error_t REG_ERANGE = 11; /* Invalid range end. */
148
+ static const reg_error_t REG_ESPACE = 12; /* Ran out of memory. */
149
+ static const reg_error_t REG_BADRPT = 13; /* No preceding re for repetition op. */
150
+ static const reg_error_t REG_EEND = 14; /* unexpected end of expression */
151
+ static const reg_error_t REG_ESIZE = 15; /* expression too big */
152
+ static const reg_error_t REG_ERPAREN = 8; /* = REG_EPAREN : unmatched right parenthesis */
153
+ static const reg_error_t REG_EMPTY = 17; /* empty expression */
154
+ static const reg_error_t REG_E_MEMORY = 15; /* = REG_ESIZE : out of memory */
155
+ static const reg_error_t REG_ECOMPLEXITY = 18; /* complexity too high */
156
+ static const reg_error_t REG_ESTACK = 19; /* out of stack space */
157
+ static const reg_error_t REG_E_PERL = 20; /* Perl (?...) error */
158
+ static const reg_error_t REG_E_UNKNOWN = 21; /* unknown error */
159
+ static const reg_error_t REG_ENOSYS = 21; /* = REG_E_UNKNOWN : Reserved. */
160
+
161
+ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA*, const char*, int);
162
+ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int, const regex_tA*, char*, regsize_t);
163
+ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA*, const char*, regsize_t, regmatch_t*, int);
164
+ BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeA(regex_tA*);
165
+
166
+ #ifndef BOOST_NO_WREGEX
167
+ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW*, const wchar_t*, int);
168
+ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int, const regex_tW*, wchar_t*, regsize_t);
169
+ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecW(const regex_tW*, const wchar_t*, regsize_t, regmatch_t*, int);
170
+ BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW*);
171
+ #endif
172
+
173
+ #ifdef UNICODE
174
+ #define regcomp regcompW
175
+ #define regerror regerrorW
176
+ #define regexec regexecW
177
+ #define regfree regfreeW
178
+ #define regex_t regex_tW
179
+ #else
180
+ #define regcomp regcompA
181
+ #define regerror regerrorA
182
+ #define regexec regexecA
183
+ #define regfree regfreeA
184
+ #define regex_t regex_tA
185
+ #endif
186
+
187
+ #ifdef BOOST_MSVC
188
+ #pragma warning(push)
189
+ #pragma warning(disable: 4103)
190
+ #endif
191
+ #ifdef BOOST_HAS_ABI_HEADERS
192
+ # include BOOST_ABI_SUFFIX
193
+ #endif
194
+ #ifdef BOOST_MSVC
195
+ #pragma warning(pop)
196
+ #endif
197
+
198
+ #ifdef __cplusplus
199
+ } /* extern "C" */
200
+ } /* namespace */
201
+ #endif
202
+
203
+ #if defined(__cplusplus)
204
+ /*
205
+ * C++ high level wrapper goes here:
206
+ */
207
+ #include <string>
208
+ #include <vector>
209
+ namespace boost{
210
+
211
+ #ifdef BOOST_MSVC
212
+ #pragma warning(push)
213
+ #pragma warning(disable: 4103)
214
+ #endif
215
+ #ifdef BOOST_HAS_ABI_HEADERS
216
+ # include BOOST_ABI_PREFIX
217
+ #endif
218
+ #ifdef BOOST_MSVC
219
+ #pragma warning(pop)
220
+ #endif
221
+
222
+ class RegEx;
223
+
224
+ namespace re_detail{
225
+
226
+ class RegExData;
227
+ struct pred1;
228
+ struct pred2;
229
+ struct pred3;
230
+ struct pred4;
231
+
232
+ } /* namespace re_detail */
233
+
234
+ #if (defined(BOOST_MSVC) || defined(__BORLANDC__)) && !defined(BOOST_DISABLE_WIN32)
235
+ typedef bool (__cdecl *GrepCallback)(const RegEx& expression);
236
+ typedef bool (__cdecl *GrepFileCallback)(const char* file, const RegEx& expression);
237
+ typedef bool (__cdecl *FindFilesCallback)(const char* file);
238
+ #else
239
+ typedef bool (*GrepCallback)(const RegEx& expression);
240
+ typedef bool (*GrepFileCallback)(const char* file, const RegEx& expression);
241
+ typedef bool (*FindFilesCallback)(const char* file);
242
+ #endif
243
+
244
+ class BOOST_REGEX_DECL RegEx
245
+ {
246
+ private:
247
+ re_detail::RegExData* pdata;
248
+ public:
249
+ RegEx();
250
+ RegEx(const RegEx& o);
251
+ ~RegEx();
252
+ explicit RegEx(const char* c, bool icase = false);
253
+ explicit RegEx(const std::string& s, bool icase = false);
254
+ RegEx& operator=(const RegEx& o);
255
+ RegEx& operator=(const char* p);
256
+ RegEx& operator=(const std::string& s){ return this->operator=(s.c_str()); }
257
+ unsigned int SetExpression(const char* p, bool icase = false);
258
+ unsigned int SetExpression(const std::string& s, bool icase = false){ return SetExpression(s.c_str(), icase); }
259
+ std::string Expression()const;
260
+ unsigned int error_code()const;
261
+ /*
262
+ * now matching operators:
263
+ */
264
+ bool Match(const char* p, match_flag_type flags = match_default);
265
+ bool Match(const std::string& s, match_flag_type flags = match_default) { return Match(s.c_str(), flags); }
266
+ bool Search(const char* p, match_flag_type flags = match_default);
267
+ bool Search(const std::string& s, match_flag_type flags = match_default) { return Search(s.c_str(), flags); }
268
+ unsigned int Grep(GrepCallback cb, const char* p, match_flag_type flags = match_default);
269
+ unsigned int Grep(GrepCallback cb, const std::string& s, match_flag_type flags = match_default) { return Grep(cb, s.c_str(), flags); }
270
+ unsigned int Grep(std::vector<std::string>& v, const char* p, match_flag_type flags = match_default);
271
+ unsigned int Grep(std::vector<std::string>& v, const std::string& s, match_flag_type flags = match_default) { return Grep(v, s.c_str(), flags); }
272
+ unsigned int Grep(std::vector<std::size_t>& v, const char* p, match_flag_type flags = match_default);
273
+ unsigned int Grep(std::vector<std::size_t>& v, const std::string& s, match_flag_type flags = match_default) { return Grep(v, s.c_str(), flags); }
274
+ #ifndef BOOST_REGEX_NO_FILEITER
275
+ unsigned int GrepFiles(GrepFileCallback cb, const char* files, bool recurse = false, match_flag_type flags = match_default);
276
+ unsigned int GrepFiles(GrepFileCallback cb, const std::string& files, bool recurse = false, match_flag_type flags = match_default) { return GrepFiles(cb, files.c_str(), recurse, flags); }
277
+ unsigned int FindFiles(FindFilesCallback cb, const char* files, bool recurse = false, match_flag_type flags = match_default);
278
+ unsigned int FindFiles(FindFilesCallback cb, const std::string& files, bool recurse = false, match_flag_type flags = match_default) { return FindFiles(cb, files.c_str(), recurse, flags); }
279
+ #endif
280
+
281
+ std::string Merge(const std::string& in, const std::string& fmt,
282
+ bool copy = true, match_flag_type flags = match_default);
283
+ std::string Merge(const char* in, const char* fmt,
284
+ bool copy = true, match_flag_type flags = match_default);
285
+
286
+ std::size_t Split(std::vector<std::string>& v, std::string& s, match_flag_type flags = match_default, unsigned max_count = ~0);
287
+ /*
288
+ * now operators for returning what matched in more detail:
289
+ */
290
+ std::size_t Position(int i = 0)const;
291
+ std::size_t Length(int i = 0)const;
292
+ bool Matched(int i = 0)const;
293
+ std::size_t Marks()const;
294
+ std::string What(int i = 0)const;
295
+ std::string operator[](int i)const { return What(i); }
296
+
297
+ static const std::size_t npos;
298
+
299
+ friend struct re_detail::pred1;
300
+ friend struct re_detail::pred2;
301
+ friend struct re_detail::pred3;
302
+ friend struct re_detail::pred4;
303
+ };
304
+
305
+ #ifdef BOOST_MSVC
306
+ #pragma warning(push)
307
+ #pragma warning(disable: 4103)
308
+ #endif
309
+ #ifdef BOOST_HAS_ABI_HEADERS
310
+ # include BOOST_ABI_SUFFIX
311
+ #endif
312
+ #ifdef BOOST_MSVC
313
+ #pragma warning(pop)
314
+ #endif
315
+
316
+ } /* namespace boost */
317
+
318
+ #endif /* __cplusplus */
319
+
320
+ #endif /* include guard */
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+
329
+
330
+
@@ -0,0 +1,59 @@
1
+ /*
2
+ *
3
+ * Copyright (c) 2003-2005
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 error_type.hpp
15
+ * VERSION see <boost/version.hpp>
16
+ * DESCRIPTION: Declares regular expression error type enumerator.
17
+ */
18
+
19
+ #ifndef BOOST_REGEX_ERROR_TYPE_HPP
20
+ #define BOOST_REGEX_ERROR_TYPE_HPP
21
+
22
+ #ifdef __cplusplus
23
+ namespace boost{
24
+ #endif
25
+
26
+ #ifdef __cplusplus
27
+ namespace regex_constants{
28
+
29
+ enum error_type{
30
+
31
+ error_ok = 0, /* not used */
32
+ error_no_match = 1, /* not used */
33
+ error_bad_pattern = 2,
34
+ error_collate = 3,
35
+ error_ctype = 4,
36
+ error_escape = 5,
37
+ error_backref = 6,
38
+ error_brack = 7,
39
+ error_paren = 8,
40
+ error_brace = 9,
41
+ error_badbrace = 10,
42
+ error_range = 11,
43
+ error_space = 12,
44
+ error_badrepeat = 13,
45
+ error_end = 14, /* not used */
46
+ error_size = 15,
47
+ error_right_paren = 16, /* not used */
48
+ error_empty = 17,
49
+ error_complexity = 18,
50
+ error_stack = 19,
51
+ error_perl_extension = 20,
52
+ error_unknown = 21
53
+ };
54
+
55
+ }
56
+ }
57
+ #endif /* __cplusplus */
58
+
59
+ #endif
@@ -0,0 +1,455 @@
1
+ /*
2
+ *
3
+ * Copyright (c) 1998-2002
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 fileiter.hpp
15
+ * VERSION see <boost/version.hpp>
16
+ * DESCRIPTION: Declares various platform independent file and
17
+ * directory iterators, plus binary file input in
18
+ * the form of class map_file.
19
+ */
20
+
21
+ #ifndef BOOST_RE_FILEITER_HPP_INCLUDED
22
+ #define BOOST_RE_FILEITER_HPP_INCLUDED
23
+
24
+ #ifndef BOOST_REGEX_CONFIG_HPP
25
+ #include <boost/regex/config.hpp>
26
+ #endif
27
+ #include <boost/assert.hpp>
28
+
29
+ #ifndef BOOST_REGEX_NO_FILEITER
30
+
31
+ #if (defined(__CYGWIN__) || defined(__CYGWIN32__)) && !defined(BOOST_REGEX_NO_W32)
32
+ #error "Sorry, can't mix <windows.h> with STL code and gcc compiler: if you ran configure, try again with configure --disable-ms-windows"
33
+ #define BOOST_REGEX_FI_WIN32_MAP
34
+ #define BOOST_REGEX_FI_POSIX_DIR
35
+ #elif (defined(__WIN32__) || defined(_WIN32) || defined(WIN32)) && !defined(BOOST_REGEX_NO_W32)
36
+ #define BOOST_REGEX_FI_WIN32_MAP
37
+ #define BOOST_REGEX_FI_WIN32_DIR
38
+ #else
39
+ #define BOOST_REGEX_FI_POSIX_MAP
40
+ #define BOOST_REGEX_FI_POSIX_DIR
41
+ #endif
42
+
43
+ #if defined(BOOST_REGEX_FI_WIN32_MAP)||defined(BOOST_REGEX_FI_WIN32_DIR)
44
+ #include <windows.h>
45
+ #endif
46
+
47
+ #if defined(BOOST_REGEX_FI_WIN32_DIR)
48
+
49
+ #include <cstddef>
50
+
51
+ namespace boost{
52
+ namespace re_detail{
53
+
54
+ #ifndef BOOST_NO_ANSI_APIS
55
+ typedef WIN32_FIND_DATAA _fi_find_data;
56
+ #else
57
+ typedef WIN32_FIND_DATAW _fi_find_data;
58
+ #endif
59
+ typedef HANDLE _fi_find_handle;
60
+
61
+ } // namespace re_detail
62
+
63
+ } // namespace boost
64
+
65
+ #define _fi_invalid_handle INVALID_HANDLE_VALUE
66
+ #define _fi_dir FILE_ATTRIBUTE_DIRECTORY
67
+
68
+ #elif defined(BOOST_REGEX_FI_POSIX_DIR)
69
+
70
+ #include <cstddef>
71
+ #include <cstdio>
72
+ #include <cctype>
73
+ #include <iterator>
74
+ #include <list>
75
+ #include <cassert>
76
+ #include <dirent.h>
77
+
78
+ #if defined(__SUNPRO_CC)
79
+ using std::list;
80
+ #endif
81
+
82
+ #ifndef MAX_PATH
83
+ #define MAX_PATH 256
84
+ #endif
85
+
86
+ namespace boost{
87
+ namespace re_detail{
88
+
89
+ #ifdef BOOST_HAS_ABI_HEADERS
90
+ # include BOOST_ABI_PREFIX
91
+ #endif
92
+
93
+ struct _fi_find_data
94
+ {
95
+ unsigned dwFileAttributes;
96
+ char cFileName[MAX_PATH];
97
+ };
98
+
99
+ struct _fi_priv_data;
100
+
101
+ typedef _fi_priv_data* _fi_find_handle;
102
+ #define _fi_invalid_handle 0
103
+ #define _fi_dir 1
104
+
105
+ _fi_find_handle _fi_FindFirstFile(const char* lpFileName, _fi_find_data* lpFindFileData);
106
+ bool _fi_FindNextFile(_fi_find_handle hFindFile, _fi_find_data* lpFindFileData);
107
+ bool _fi_FindClose(_fi_find_handle hFindFile);
108
+
109
+ #ifdef BOOST_HAS_ABI_HEADERS
110
+ # include BOOST_ABI_SUFFIX
111
+ #endif
112
+
113
+ } // namespace re_detail
114
+ } // namespace boost
115
+
116
+ #ifdef FindFirstFile
117
+ #undef FindFirstFile
118
+ #endif
119
+ #ifdef FindNextFile
120
+ #undef FindNextFile
121
+ #endif
122
+ #ifdef FindClose
123
+ #undef FindClose
124
+ #endif
125
+
126
+ #define FindFirstFileA _fi_FindFirstFile
127
+ #define FindNextFileA _fi_FindNextFile
128
+ #define FindClose _fi_FindClose
129
+
130
+ #endif
131
+
132
+ namespace boost{
133
+ namespace re_detail{
134
+
135
+ #ifdef BOOST_HAS_ABI_HEADERS
136
+ # include BOOST_ABI_PREFIX
137
+ #endif
138
+
139
+ #ifdef BOOST_REGEX_FI_WIN32_MAP // win32 mapfile
140
+
141
+ class BOOST_REGEX_DECL mapfile
142
+ {
143
+ HANDLE hfile;
144
+ HANDLE hmap;
145
+ const char* _first;
146
+ const char* _last;
147
+ public:
148
+
149
+ typedef const char* iterator;
150
+
151
+ mapfile(){ hfile = hmap = 0; _first = _last = 0; }
152
+ mapfile(const char* file){ hfile = hmap = 0; _first = _last = 0; open(file); }
153
+ ~mapfile(){ close(); }
154
+ void open(const char* file);
155
+ void close();
156
+ const char* begin(){ return _first; }
157
+ const char* end(){ return _last; }
158
+ size_t size(){ return _last - _first; }
159
+ bool valid(){ return (hfile != 0) && (hfile != INVALID_HANDLE_VALUE); }
160
+ };
161
+
162
+
163
+ #else
164
+
165
+ class BOOST_REGEX_DECL mapfile_iterator;
166
+
167
+ class BOOST_REGEX_DECL mapfile
168
+ {
169
+ typedef char* pointer;
170
+ std::FILE* hfile;
171
+ long int _size;
172
+ pointer* _first;
173
+ pointer* _last;
174
+ mutable std::list<pointer*> condemed;
175
+ enum sizes
176
+ {
177
+ buf_size = 4096
178
+ };
179
+ void lock(pointer* node)const;
180
+ void unlock(pointer* node)const;
181
+ public:
182
+
183
+ typedef mapfile_iterator iterator;
184
+
185
+ mapfile(){ hfile = 0; _size = 0; _first = _last = 0; }
186
+ mapfile(const char* file){ hfile = 0; _size = 0; _first = _last = 0; open(file); }
187
+ ~mapfile(){ close(); }
188
+ void open(const char* file);
189
+ void close();
190
+ iterator begin()const;
191
+ iterator end()const;
192
+ unsigned long size()const{ return _size; }
193
+ bool valid()const{ return hfile != 0; }
194
+ friend class mapfile_iterator;
195
+ };
196
+
197
+ class BOOST_REGEX_DECL mapfile_iterator
198
+ #if !defined(BOOST_NO_STD_ITERATOR) || defined(BOOST_MSVC_STD_ITERATOR)
199
+ : public std::iterator<std::random_access_iterator_tag, char>
200
+ #endif
201
+ {
202
+ typedef mapfile::pointer internal_pointer;
203
+ internal_pointer* node;
204
+ const mapfile* file;
205
+ unsigned long offset;
206
+ long position()const
207
+ {
208
+ return file ? ((node - file->_first) * mapfile::buf_size + offset) : 0;
209
+ }
210
+ void position(long pos)
211
+ {
212
+ if(file)
213
+ {
214
+ node = file->_first + (pos / mapfile::buf_size);
215
+ offset = pos % mapfile::buf_size;
216
+ }
217
+ }
218
+ public:
219
+ typedef std::ptrdiff_t difference_type;
220
+ typedef char value_type;
221
+ typedef const char* pointer;
222
+ typedef const char& reference;
223
+ typedef std::random_access_iterator_tag iterator_category;
224
+
225
+ mapfile_iterator() { node = 0; file = 0; offset = 0; }
226
+ mapfile_iterator(const mapfile* f, long arg_position)
227
+ {
228
+ file = f;
229
+ node = f->_first + arg_position / mapfile::buf_size;
230
+ offset = arg_position % mapfile::buf_size;
231
+ if(file)
232
+ file->lock(node);
233
+ }
234
+ mapfile_iterator(const mapfile_iterator& i)
235
+ {
236
+ file = i.file;
237
+ node = i.node;
238
+ offset = i.offset;
239
+ if(file)
240
+ file->lock(node);
241
+ }
242
+ ~mapfile_iterator()
243
+ {
244
+ if(file && node)
245
+ file->unlock(node);
246
+ }
247
+ mapfile_iterator& operator = (const mapfile_iterator& i);
248
+ char operator* ()const
249
+ {
250
+ BOOST_ASSERT(node >= file->_first);
251
+ BOOST_ASSERT(node < file->_last);
252
+ return file ? *(*node + sizeof(int) + offset) : char(0);
253
+ }
254
+ char operator[] (long off)const
255
+ {
256
+ mapfile_iterator tmp(*this);
257
+ tmp += off;
258
+ return *tmp;
259
+ }
260
+ mapfile_iterator& operator++ ();
261
+ mapfile_iterator operator++ (int);
262
+ mapfile_iterator& operator-- ();
263
+ mapfile_iterator operator-- (int);
264
+
265
+ mapfile_iterator& operator += (long off)
266
+ {
267
+ position(position() + off);
268
+ return *this;
269
+ }
270
+ mapfile_iterator& operator -= (long off)
271
+ {
272
+ position(position() - off);
273
+ return *this;
274
+ }
275
+
276
+ friend inline bool operator==(const mapfile_iterator& i, const mapfile_iterator& j)
277
+ {
278
+ return (i.file == j.file) && (i.node == j.node) && (i.offset == j.offset);
279
+ }
280
+
281
+ friend inline bool operator!=(const mapfile_iterator& i, const mapfile_iterator& j)
282
+ {
283
+ return !(i == j);
284
+ }
285
+
286
+ friend inline bool operator<(const mapfile_iterator& i, const mapfile_iterator& j)
287
+ {
288
+ return i.position() < j.position();
289
+ }
290
+ friend inline bool operator>(const mapfile_iterator& i, const mapfile_iterator& j)
291
+ {
292
+ return i.position() > j.position();
293
+ }
294
+ friend inline bool operator<=(const mapfile_iterator& i, const mapfile_iterator& j)
295
+ {
296
+ return i.position() <= j.position();
297
+ }
298
+ friend inline bool operator>=(const mapfile_iterator& i, const mapfile_iterator& j)
299
+ {
300
+ return i.position() >= j.position();
301
+ }
302
+
303
+ friend mapfile_iterator operator + (const mapfile_iterator& i, long off);
304
+ friend mapfile_iterator operator + (long off, const mapfile_iterator& i)
305
+ {
306
+ mapfile_iterator tmp(i);
307
+ return tmp += off;
308
+ }
309
+ friend mapfile_iterator operator - (const mapfile_iterator& i, long off);
310
+ friend inline long operator - (const mapfile_iterator& i, const mapfile_iterator& j)
311
+ {
312
+ return i.position() - j.position();
313
+ }
314
+ };
315
+
316
+ #endif
317
+
318
+ // _fi_sep determines the directory separator, either '\\' or '/'
319
+ BOOST_REGEX_DECL extern const char* _fi_sep;
320
+
321
+ struct file_iterator_ref
322
+ {
323
+ _fi_find_handle hf;
324
+ _fi_find_data _data;
325
+ long count;
326
+ };
327
+
328
+
329
+ class BOOST_REGEX_DECL file_iterator
330
+ {
331
+ char* _root;
332
+ char* _path;
333
+ char* ptr;
334
+ file_iterator_ref* ref;
335
+
336
+ public:
337
+ typedef std::ptrdiff_t difference_type;
338
+ typedef const char* value_type;
339
+ typedef const char** pointer;
340
+ typedef const char*& reference;
341
+ typedef std::input_iterator_tag iterator_category;
342
+
343
+ file_iterator();
344
+ file_iterator(const char* wild);
345
+ ~file_iterator();
346
+ file_iterator(const file_iterator&);
347
+ file_iterator& operator=(const file_iterator&);
348
+ const char* root()const { return _root; }
349
+ const char* path()const { return _path; }
350
+ const char* name()const { return ptr; }
351
+ _fi_find_data* data() { return &(ref->_data); }
352
+ void next();
353
+ file_iterator& operator++() { next(); return *this; }
354
+ file_iterator operator++(int);
355
+ const char* operator*() { return path(); }
356
+
357
+ friend inline bool operator == (const file_iterator& f1, const file_iterator& f2)
358
+ {
359
+ return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
360
+ }
361
+
362
+ friend inline bool operator != (const file_iterator& f1, const file_iterator& f2)
363
+ {
364
+ return !(f1 == f2);
365
+ }
366
+
367
+ };
368
+
369
+ // dwa 9/13/00 - suppress unused parameter warning
370
+ inline bool operator < (const file_iterator&, const file_iterator&)
371
+ {
372
+ return false;
373
+ }
374
+
375
+
376
+ class BOOST_REGEX_DECL directory_iterator
377
+ {
378
+ char* _root;
379
+ char* _path;
380
+ char* ptr;
381
+ file_iterator_ref* ref;
382
+
383
+ public:
384
+ typedef std::ptrdiff_t difference_type;
385
+ typedef const char* value_type;
386
+ typedef const char** pointer;
387
+ typedef const char*& reference;
388
+ typedef std::input_iterator_tag iterator_category;
389
+
390
+ directory_iterator();
391
+ directory_iterator(const char* wild);
392
+ ~directory_iterator();
393
+ directory_iterator(const directory_iterator& other);
394
+ directory_iterator& operator=(const directory_iterator& other);
395
+
396
+ const char* root()const { return _root; }
397
+ const char* path()const { return _path; }
398
+ const char* name()const { return ptr; }
399
+ _fi_find_data* data() { return &(ref->_data); }
400
+ void next();
401
+ directory_iterator& operator++() { next(); return *this; }
402
+ directory_iterator operator++(int);
403
+ const char* operator*() { return path(); }
404
+
405
+ static const char* separator() { return _fi_sep; }
406
+
407
+ friend inline bool operator == (const directory_iterator& f1, const directory_iterator& f2)
408
+ {
409
+ return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
410
+ }
411
+
412
+
413
+ friend inline bool operator != (const directory_iterator& f1, const directory_iterator& f2)
414
+ {
415
+ return !(f1 == f2);
416
+ }
417
+
418
+ };
419
+
420
+ inline bool operator < (const directory_iterator&, const directory_iterator&)
421
+ {
422
+ return false;
423
+ }
424
+
425
+ #ifdef BOOST_HAS_ABI_HEADERS
426
+ # include BOOST_ABI_SUFFIX
427
+ #endif
428
+
429
+
430
+ } // namespace re_detail
431
+ using boost::re_detail::directory_iterator;
432
+ using boost::re_detail::file_iterator;
433
+ using boost::re_detail::mapfile;
434
+ } // namespace boost
435
+
436
+ #endif // BOOST_REGEX_NO_FILEITER
437
+ #endif // BOOST_RE_FILEITER_HPP
438
+
439
+
440
+
441
+
442
+
443
+
444
+
445
+
446
+
447
+
448
+
449
+
450
+
451
+
452
+
453
+
454
+
455
+