Mxx_ru 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. data/COPYING +26 -0
  2. data/NEWS +52 -0
  3. data/README +21 -0
  4. data/Rakefile +32 -0
  5. data/examples/exe_and_lib/main.cpp +15 -0
  6. data/examples/exe_and_lib/prj.rb +11 -0
  7. data/examples/exe_and_lib/say.cpp +13 -0
  8. data/examples/exe_and_lib/say.hpp +11 -0
  9. data/examples/exe_and_lib/say.rb +7 -0
  10. data/examples/exe_dll_lib/inout.cpp +15 -0
  11. data/examples/exe_dll_lib/inout.hpp +26 -0
  12. data/examples/exe_dll_lib/inout.rb +18 -0
  13. data/examples/exe_dll_lib/main.cpp +23 -0
  14. data/examples/exe_dll_lib/prj.rb +11 -0
  15. data/examples/exe_dll_lib/say.cpp +13 -0
  16. data/examples/exe_dll_lib/say.hpp +12 -0
  17. data/examples/exe_dll_lib/say.rb +9 -0
  18. data/examples/exe_dll_lib_2/build.rb +7 -0
  19. data/examples/exe_dll_lib_2/inout/inout.cpp +15 -0
  20. data/examples/exe_dll_lib_2/inout/inout.hpp +26 -0
  21. data/examples/exe_dll_lib_2/inout/prj.rb +16 -0
  22. data/examples/exe_dll_lib_2/main/main.cpp +23 -0
  23. data/examples/exe_dll_lib_2/main/prj.rb +9 -0
  24. data/examples/exe_dll_lib_2/say/prj.rb +8 -0
  25. data/examples/exe_dll_lib_2/say/say.cpp +13 -0
  26. data/examples/exe_dll_lib_2/say/say.hpp +12 -0
  27. data/examples/simple_exe/main.cpp +26 -0
  28. data/examples/simple_exe/prj.rb +7 -0
  29. data/lib/mxx_ru/abstract_target.rb +283 -0
  30. data/lib/mxx_ru/binary_target.rb +89 -0
  31. data/lib/mxx_ru/binary_unittest.rb +130 -0
  32. data/lib/mxx_ru/cpp/analyzer.rb +230 -0
  33. data/lib/mxx_ru/cpp/composite.rb +106 -0
  34. data/lib/mxx_ru/cpp/detect_toolset.rb +122 -0
  35. data/lib/mxx_ru/cpp/mode.rb +85 -0
  36. data/lib/mxx_ru/cpp/obj_placement.rb +321 -0
  37. data/lib/mxx_ru/cpp/qt.rb +333 -0
  38. data/lib/mxx_ru/cpp/rucodegen.rb +114 -0
  39. data/lib/mxx_ru/cpp/source_file.rb +71 -0
  40. data/lib/mxx_ru/cpp/target.rb +1371 -0
  41. data/lib/mxx_ru/cpp/toolset.rb +1029 -0
  42. data/lib/mxx_ru/cpp/toolsets/bcc_win32_5.rb +52 -0
  43. data/lib/mxx_ru/cpp/toolsets/bcc_win32_family.rb +451 -0
  44. data/lib/mxx_ru/cpp/toolsets/c89_etk_nsk.rb +56 -0
  45. data/lib/mxx_ru/cpp/toolsets/c89_nsk.rb +56 -0
  46. data/lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb +273 -0
  47. data/lib/mxx_ru/cpp/toolsets/gcc_cygwin.rb +54 -0
  48. data/lib/mxx_ru/cpp/toolsets/gcc_family.rb +382 -0
  49. data/lib/mxx_ru/cpp/toolsets/gcc_linux.rb +60 -0
  50. data/lib/mxx_ru/cpp/toolsets/gcc_mingw.rb +144 -0
  51. data/lib/mxx_ru/cpp/toolsets/gcc_sparc_solaris.rb +87 -0
  52. data/lib/mxx_ru/cpp/toolsets/vc7.rb +62 -0
  53. data/lib/mxx_ru/cpp/toolsets/vc8.rb +452 -0
  54. data/lib/mxx_ru/cpp/toolsets/vc_family.rb +428 -0
  55. data/lib/mxx_ru/cpp.rb +36 -0
  56. data/lib/mxx_ru/ex.rb +134 -0
  57. data/lib/mxx_ru/makestyle_generator.rb +138 -0
  58. data/lib/mxx_ru/textfile_unittest.rb +284 -0
  59. data/lib/mxx_ru/util.rb +258 -0
  60. data/tests/c/pcre/chartables.c +183 -0
  61. data/tests/c/pcre/config.h +99 -0
  62. data/tests/c/pcre/dftables.c +167 -0
  63. data/tests/c/pcre/get.c +349 -0
  64. data/tests/c/pcre/internal.h +677 -0
  65. data/tests/c/pcre/maketables.c +140 -0
  66. data/tests/c/pcre/pcre.c +8304 -0
  67. data/tests/c/pcre/pcre.h +193 -0
  68. data/tests/c/pcre/pcre.rb +14 -0
  69. data/tests/c/pcre/pcredemo.c +316 -0
  70. data/tests/c/pcre/pcregrep.c +642 -0
  71. data/tests/c/pcre/pcreposix.c +305 -0
  72. data/tests/c/pcre/pcreposix.h +88 -0
  73. data/tests/c/pcre/pcretest.c +1483 -0
  74. data/tests/c/pcre/perltest +211 -0
  75. data/tests/c/pcre/printint.c +360 -0
  76. data/tests/c/pcre/study.c +472 -0
  77. data/tests/cpp/mswin_res_dll/build.rb +14 -0
  78. data/tests/cpp/mswin_res_dll/dll.cpp +17 -0
  79. data/tests/cpp/mswin_res_dll/dll.rb +30 -0
  80. data/tests/cpp/mswin_res_dll/dll.rc +48 -0
  81. data/tests/cpp/mswin_res_dll/h/dll.hpp +8 -0
  82. data/tests/cpp/mswin_res_dll/h/res.h +3 -0
  83. data/tests/cpp/mswin_res_dll/main.cpp +13 -0
  84. data/tests/cpp/mswin_res_dll/main.rb +20 -0
  85. data/tests/cpp/mswin_res_dll/res/tree_fol.bmp +0 -0
  86. data/tests/cpp/mswin_res_dll/res/tree_state_1.bmp +0 -0
  87. data/tests/cpp/mswin_res_dll/res/tree_state_2.bmp +0 -0
  88. data/tests/cpp/mswin_res_exe/build.rb +23 -0
  89. data/tests/cpp/mswin_res_exe/h/res.h +3 -0
  90. data/tests/cpp/mswin_res_exe/main.cpp +17 -0
  91. data/tests/cpp/mswin_res_exe/main.rc +48 -0
  92. data/tests/cpp/mswin_res_exe/res/tree_fol.bmp +0 -0
  93. data/tests/cpp/mswin_res_exe/res/tree_state_1.bmp +0 -0
  94. data/tests/cpp/mswin_res_exe/res/tree_state_2.bmp +0 -0
  95. data/tests/cpp/rucodegen/host_config.cpp +20 -0
  96. data/tests/cpp/rucodegen/host_config.rb +14 -0
  97. data/tests/cpp/rucodegen/impl/conn_params.cpp +7 -0
  98. data/tests/cpp/rucodegen/impl/conn_params.rb +14 -0
  99. data/tests/cpp/rucodegen/impl/h/conn_params.hpp +10 -0
  100. data/tests/cpp/rucodegen/prj.rb +17 -0
  101. data/tests/cpp/textfile_unittest/build.rb +8 -0
  102. data/tests/cpp/textfile_unittest/etalons/out_0.txt +0 -0
  103. data/tests/cpp/textfile_unittest/etalons/out_1.txt +1 -0
  104. data/tests/cpp/textfile_unittest/etalons/out_128.txt +128 -0
  105. data/tests/cpp/textfile_unittest/main.cpp +89 -0
  106. data/tests/cpp/textfile_unittest/prj.rb +8 -0
  107. data/tests/cpp/textfile_unittest/prj.ut.rb +18 -0
  108. data/tests/cpp/toolset_name.rb +6 -0
  109. data/tests/cpp/vc_cleanup/cout.log +72 -0
  110. data/tests/cpp/vc_cleanup/dll_hi.cpp +5 -0
  111. data/tests/cpp/vc_cleanup/exe_hi.cpp +10 -0
  112. data/tests/cpp/vc_cleanup/lib_hi.cpp +5 -0
  113. data/tests/cpp/vc_cleanup/prj_dll_no_implib.rb +10 -0
  114. data/tests/cpp/vc_cleanup/prj_dll_no_implib_simple_target_root.rb +11 -0
  115. data/tests/cpp/vc_cleanup/prj_dll_with_implib.rb +11 -0
  116. data/tests/cpp/vc_cleanup/prj_dll_with_implib_simple_target_root.rb +14 -0
  117. data/tests/cpp/vc_cleanup/prj_exe_no_implib.rb +10 -0
  118. data/tests/cpp/vc_cleanup/prj_exe_no_implib_simple_target_root.rb +11 -0
  119. data/tests/cpp/vc_cleanup/prj_lib.rb +10 -0
  120. data/tests/cpp/vc_cleanup/prj_lib_with_simple_target_root.rb +11 -0
  121. data/tests/cpp/vc_cleanup/tc_vc_cleanup.rb +60 -0
  122. data/tests/mxx_ru/change_default_value/ignoring_by_build_root/build.rb +8 -0
  123. data/tests/mxx_ru/change_default_value/ignoring_by_build_root/child_1.rb +5 -0
  124. data/tests/mxx_ru/change_default_value/ignoring_by_child_1/build.rb +7 -0
  125. data/tests/mxx_ru/change_default_value/ignoring_by_child_1/child_1.rb +5 -0
  126. data/tests/mxx_ru/change_default_value/ignoring_by_child_1/child_2.rb +5 -0
  127. data/tests/mxx_ru/change_default_value/ok/build.rb +8 -0
  128. data/tests/mxx_ru/change_default_value/ok/child_1.rb +8 -0
  129. data/tests/mxx_ru/tc_makestyle_generator.rb +117 -0
  130. data/tests/mxx_ru/vc8/tc_actual_manifest.rb +230 -0
  131. data/tests/mxx_ru/vc8/tc_append_mt_commands.rb +104 -0
  132. data/tests/mxx_ru/vc8/tc_default_manifest.rb +17 -0
  133. data/tests/mxx_ru/vc8/tc_define_manifest.rb +173 -0
  134. data/tests/mxx_ru/vc8/tc_drop_default_manifest.rb +16 -0
  135. data/tests/mxx_ru/vc8/tc_invalid_params.rb +81 -0
  136. data/tests/mxx_ru/vc8/ts_vc8.rb +10 -0
  137. data/tests/qt/aclock/aclock.cpp +148 -0
  138. data/tests/qt/aclock/aclock.h +45 -0
  139. data/tests/qt/aclock/main.cpp +28 -0
  140. data/tests/qt/aclock/prj.rb +21 -0
  141. data/tests/qt/iconview/main.cpp +76 -0
  142. data/tests/qt/iconview/prj.rb +21 -0
  143. data/tests/qt/toplevel/main.cpp +9 -0
  144. data/tests/qt/toplevel/options.ui +587 -0
  145. data/tests/qt/toplevel/options.ui.h +98 -0
  146. data/tests/qt/toplevel/prj.rb +21 -0
  147. metadata +241 -0
@@ -0,0 +1,677 @@
1
+ /*************************************************
2
+ * Perl-Compatible Regular Expressions *
3
+ *************************************************/
4
+
5
+
6
+ /* This is a library of functions to support regular expressions whose syntax
7
+ and semantics are as close as possible to those of the Perl 5 language. See
8
+ the file Tech.Notes for some information on the internals.
9
+
10
+ Written by: Philip Hazel <ph10@cam.ac.uk>
11
+
12
+ Copyright (c) 1997-2003 University of Cambridge
13
+
14
+ -----------------------------------------------------------------------------
15
+ Permission is granted to anyone to use this software for any purpose on any
16
+ computer system, and to redistribute it freely, subject to the following
17
+ restrictions:
18
+
19
+ 1. This software is distributed in the hope that it will be useful,
20
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22
+
23
+ 2. The origin of this software must not be misrepresented, either by
24
+ explicit claim or by omission.
25
+
26
+ 3. Altered versions must be plainly marked as such, and must not be
27
+ misrepresented as being the original software.
28
+
29
+ 4. If PCRE is embedded in any software that is released under the GNU
30
+ General Purpose Licence (GPL), then the terms of that licence shall
31
+ supersede any condition above with which it is incompatible.
32
+ -----------------------------------------------------------------------------
33
+ */
34
+
35
+ /* This header contains definitions that are shared between the different
36
+ modules, but which are not relevant to the outside. */
37
+
38
+ /* Get the definitions provided by running "configure" */
39
+
40
+ #include "config.h"
41
+
42
+ /* Standard C headers plus the external interface definition. The only time
43
+ setjmp and stdarg are used is when NO_RECURSE is set. */
44
+
45
+ #include <ctype.h>
46
+ #include <limits.h>
47
+ #include <setjmp.h>
48
+ #include <stdarg.h>
49
+ #include <stddef.h>
50
+ #include <stdio.h>
51
+ #include <stdlib.h>
52
+ #include <string.h>
53
+
54
+ #ifndef PCRE_SPY
55
+ #define PCRE_DEFINITION /* Win32 __declspec(export) trigger for .dll */
56
+ #endif
57
+
58
+ #include "pcre.h"
59
+
60
+ /* When compiling for use with the Virtual Pascal compiler, these functions
61
+ need to have their names changed. PCRE must be compiled with the -DVPCOMPAT
62
+ option on the command line. */
63
+
64
+ #ifdef VPCOMPAT
65
+ #define strncmp(s1,s2,m) _strncmp(s1,s2,m)
66
+ #define memcpy(d,s,n) _memcpy(d,s,n)
67
+ #define memmove(d,s,n) _memmove(d,s,n)
68
+ #define memset(s,c,n) _memset(s,c,n)
69
+ #else /* VPCOMPAT */
70
+
71
+ /* To cope with SunOS4 and other systems that lack memmove() but have bcopy(),
72
+ define a macro for memmove() if HAVE_MEMMOVE is false, provided that HAVE_BCOPY
73
+ is set. Otherwise, include an emulating function for those systems that have
74
+ neither (there some non-Unix environments where this is the case). This assumes
75
+ that all calls to memmove are moving strings upwards in store, which is the
76
+ case in PCRE. */
77
+
78
+ #if ! HAVE_MEMMOVE
79
+ #undef memmove /* some systems may have a macro */
80
+ #if HAVE_BCOPY
81
+ #define memmove(a, b, c) bcopy(b, a, c)
82
+ #else /* HAVE_BCOPY */
83
+ void *
84
+ pcre_memmove(unsigned char *dest, const unsigned char *src, size_t n)
85
+ {
86
+ int i;
87
+ dest += n;
88
+ src += n;
89
+ for (i = 0; i < n; ++i) *(--dest) = *(--src);
90
+ }
91
+ #define memmove(a, b, c) pcre_memmove(a, b, c)
92
+ #endif /* not HAVE_BCOPY */
93
+ #endif /* not HAVE_MEMMOVE */
94
+ #endif /* not VPCOMPAT */
95
+
96
+
97
+ /* PCRE keeps offsets in its compiled code as 2-byte quantities by default.
98
+ These are used, for example, to link from the start of a subpattern to its
99
+ alternatives and its end. The use of 2 bytes per offset limits the size of the
100
+ compiled regex to around 64K, which is big enough for almost everybody.
101
+ However, I received a request for an even bigger limit. For this reason, and
102
+ also to make the code easier to maintain, the storing and loading of offsets
103
+ from the byte string is now handled by the macros that are defined here.
104
+
105
+ The macros are controlled by the value of LINK_SIZE. This defaults to 2 in
106
+ the config.h file, but can be overridden by using -D on the command line. This
107
+ is automated on Unix systems via the "configure" command. */
108
+
109
+ #if LINK_SIZE == 2
110
+
111
+ #define PUT(a,n,d) \
112
+ (a[n] = (d) >> 8), \
113
+ (a[(n)+1] = (d) & 255)
114
+
115
+ #define GET(a,n) \
116
+ (((a)[n] << 8) | (a)[(n)+1])
117
+
118
+ #define MAX_PATTERN_SIZE (1 << 16)
119
+
120
+
121
+ #elif LINK_SIZE == 3
122
+
123
+ #define PUT(a,n,d) \
124
+ (a[n] = (d) >> 16), \
125
+ (a[(n)+1] = (d) >> 8), \
126
+ (a[(n)+2] = (d) & 255)
127
+
128
+ #define GET(a,n) \
129
+ (((a)[n] << 16) | ((a)[(n)+1] << 8) | (a)[(n)+2])
130
+
131
+ #define MAX_PATTERN_SIZE (1 << 24)
132
+
133
+
134
+ #elif LINK_SIZE == 4
135
+
136
+ #define PUT(a,n,d) \
137
+ (a[n] = (d) >> 24), \
138
+ (a[(n)+1] = (d) >> 16), \
139
+ (a[(n)+2] = (d) >> 8), \
140
+ (a[(n)+3] = (d) & 255)
141
+
142
+ #define GET(a,n) \
143
+ (((a)[n] << 24) | ((a)[(n)+1] << 16) | ((a)[(n)+2] << 8) | (a)[(n)+3])
144
+
145
+ #define MAX_PATTERN_SIZE (1 << 30) /* Keep it positive */
146
+
147
+
148
+ #else
149
+ #error LINK_SIZE must be either 2, 3, or 4
150
+ #endif
151
+
152
+
153
+ /* Convenience macro defined in terms of the others */
154
+
155
+ #define PUTINC(a,n,d) PUT(a,n,d), a += LINK_SIZE
156
+
157
+
158
+ /* PCRE uses some other 2-byte quantities that do not change when the size of
159
+ offsets changes. There are used for repeat counts and for other things such as
160
+ capturing parenthesis numbers in back references. */
161
+
162
+ #define PUT2(a,n,d) \
163
+ a[n] = (d) >> 8; \
164
+ a[(n)+1] = (d) & 255
165
+
166
+ #define GET2(a,n) \
167
+ (((a)[n] << 8) | (a)[(n)+1])
168
+
169
+ #define PUT2INC(a,n,d) PUT2(a,n,d), a += 2
170
+
171
+
172
+ /* In case there is no definition of offsetof() provided - though any proper
173
+ Standard C system should have one. */
174
+
175
+ #ifndef offsetof
176
+ #define offsetof(p_type,field) ((size_t)&(((p_type *)0)->field))
177
+ #endif
178
+
179
+ /* These are the public options that can change during matching. */
180
+
181
+ #define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL)
182
+
183
+ /* Private options flags start at the most significant end of the four bytes,
184
+ but skip the top bit so we can use ints for convenience without getting tangled
185
+ with negative values. The public options defined in pcre.h start at the least
186
+ significant end. Make sure they don't overlap, though now that we have expanded
187
+ to four bytes there is plenty of space. */
188
+
189
+ #define PCRE_FIRSTSET 0x40000000 /* first_byte is set */
190
+ #define PCRE_REQCHSET 0x20000000 /* req_byte is set */
191
+ #define PCRE_STARTLINE 0x10000000 /* start after \n for multiline */
192
+ #define PCRE_ICHANGED 0x08000000 /* i option changes within regex */
193
+
194
+ /* Options for the "extra" block produced by pcre_study(). */
195
+
196
+ #define PCRE_STUDY_MAPPED 0x01 /* a map of starting chars exists */
197
+
198
+ /* Masks for identifying the public options which are permitted at compile
199
+ time, run time or study time, respectively. */
200
+
201
+ #define PUBLIC_OPTIONS \
202
+ (PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \
203
+ PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY|PCRE_UTF8| \
204
+ PCRE_NO_AUTO_CAPTURE|PCRE_NO_UTF8_CHECK)
205
+
206
+ #define PUBLIC_EXEC_OPTIONS \
207
+ (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK)
208
+
209
+ #define PUBLIC_STUDY_OPTIONS 0 /* None defined */
210
+
211
+ /* Magic number to provide a small check against being handed junk. */
212
+
213
+ #define MAGIC_NUMBER 0x50435245UL /* 'PCRE' */
214
+
215
+ /* Negative values for the firstchar and reqchar variables */
216
+
217
+ #define REQ_UNSET (-2)
218
+ #define REQ_NONE (-1)
219
+
220
+ /* Flags added to firstbyte or reqbyte; a "non-literal" item is either a
221
+ variable-length repeat, or a anything other than literal characters. */
222
+
223
+ #define REQ_CASELESS 0x0100 /* indicates caselessness */
224
+ #define REQ_VARY 0x0200 /* reqbyte followed non-literal item */
225
+
226
+ /* Miscellaneous definitions */
227
+
228
+ typedef int BOOL;
229
+
230
+ #define FALSE 0
231
+ #define TRUE 1
232
+
233
+ /* Escape items that are just an encoding of a particular data value. Note that
234
+ ESC_n is defined as yet another macro, which is set in config.h to either \n
235
+ (the default) or \r (which some people want). */
236
+
237
+ #ifndef ESC_e
238
+ #define ESC_e 27
239
+ #endif
240
+
241
+ #ifndef ESC_f
242
+ #define ESC_f '\f'
243
+ #endif
244
+
245
+ #ifndef ESC_n
246
+ #define ESC_n NEWLINE
247
+ #endif
248
+
249
+ #ifndef ESC_r
250
+ #define ESC_r '\r'
251
+ #endif
252
+
253
+ /* We can't officially use ESC_t because it is a POSIX reserved identifier
254
+ (presumably because of all the others like size_t). */
255
+
256
+ #ifndef ESC_tee
257
+ #define ESC_tee '\t'
258
+ #endif
259
+
260
+ /* These are escaped items that aren't just an encoding of a particular data
261
+ value such as \n. They must have non-zero values, as check_escape() returns
262
+ their negation. Also, they must appear in the same order as in the opcode
263
+ definitions below, up to ESC_z. There's a dummy for OP_ANY because it
264
+ corresponds to "." rather than an escape sequence. The final one must be
265
+ ESC_REF as subsequent values are used for \1, \2, \3, etc. There is are two
266
+ tests in the code for an escape greater than ESC_b and less than ESC_Z to
267
+ detect the types that may be repeated. These are the types that consume a
268
+ character. If any new escapes are put in between that don't consume a
269
+ character, that code will have to change. */
270
+
271
+ enum { ESC_A = 1, ESC_G, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s, ESC_W,
272
+ ESC_w, ESC_dum1, ESC_C, ESC_Z, ESC_z, ESC_E, ESC_Q, ESC_REF };
273
+
274
+ /* Flag bits and data types for the extended class (OP_XCLASS) for classes that
275
+ contain UTF-8 characters with values greater than 255. */
276
+
277
+ #define XCL_NOT 0x01 /* Flag: this is a negative class */
278
+ #define XCL_MAP 0x02 /* Flag: a 32-byte map is present */
279
+
280
+ #define XCL_END 0 /* Marks end of individual items */
281
+ #define XCL_SINGLE 1 /* Single item (one multibyte char) follows */
282
+ #define XCL_RANGE 2 /* A range (two multibyte chars) follows */
283
+
284
+
285
+ /* Opcode table: OP_BRA must be last, as all values >= it are used for brackets
286
+ that extract substrings. Starting from 1 (i.e. after OP_END), the values up to
287
+ OP_EOD must correspond in order to the list of escapes immediately above.
288
+ Note that whenever this list is updated, the two macro definitions that follow
289
+ must also be updated to match. */
290
+
291
+ enum {
292
+ OP_END, /* 0 End of pattern */
293
+
294
+ /* Values corresponding to backslashed metacharacters */
295
+
296
+ OP_SOD, /* 1 Start of data: \A */
297
+ OP_SOM, /* 2 Start of match (subject + offset): \G */
298
+ OP_NOT_WORD_BOUNDARY, /* 3 \B */
299
+ OP_WORD_BOUNDARY, /* 4 \b */
300
+ OP_NOT_DIGIT, /* 5 \D */
301
+ OP_DIGIT, /* 6 \d */
302
+ OP_NOT_WHITESPACE, /* 7 \S */
303
+ OP_WHITESPACE, /* 8 \s */
304
+ OP_NOT_WORDCHAR, /* 9 \W */
305
+ OP_WORDCHAR, /* 10 \w */
306
+ OP_ANY, /* 11 Match any character */
307
+ OP_ANYBYTE, /* 12 Match any byte (\C); different to OP_ANY for UTF-8 */
308
+ OP_EODN, /* 13 End of data or \n at end of data: \Z. */
309
+ OP_EOD, /* 14 End of data: \z */
310
+
311
+ OP_OPT, /* 15 Set runtime options */
312
+ OP_CIRC, /* 16 Start of line - varies with multiline switch */
313
+ OP_DOLL, /* 17 End of line - varies with multiline switch */
314
+ OP_CHARS, /* 18 Match string of characters */
315
+ OP_NOT, /* 19 Match anything but the following char */
316
+
317
+ OP_STAR, /* 20 The maximizing and minimizing versions of */
318
+ OP_MINSTAR, /* 21 all these opcodes must come in pairs, with */
319
+ OP_PLUS, /* 22 the minimizing one second. */
320
+ OP_MINPLUS, /* 23 This first set applies to single characters */
321
+ OP_QUERY, /* 24 */
322
+ OP_MINQUERY, /* 25 */
323
+ OP_UPTO, /* 26 From 0 to n matches */
324
+ OP_MINUPTO, /* 27 */
325
+ OP_EXACT, /* 28 Exactly n matches */
326
+
327
+ OP_NOTSTAR, /* 29 The maximizing and minimizing versions of */
328
+ OP_NOTMINSTAR, /* 30 all these opcodes must come in pairs, with */
329
+ OP_NOTPLUS, /* 31 the minimizing one second. */
330
+ OP_NOTMINPLUS, /* 32 This set applies to "not" single characters */
331
+ OP_NOTQUERY, /* 33 */
332
+ OP_NOTMINQUERY, /* 34 */
333
+ OP_NOTUPTO, /* 35 From 0 to n matches */
334
+ OP_NOTMINUPTO, /* 36 */
335
+ OP_NOTEXACT, /* 37 Exactly n matches */
336
+
337
+ OP_TYPESTAR, /* 38 The maximizing and minimizing versions of */
338
+ OP_TYPEMINSTAR, /* 39 all these opcodes must come in pairs, with */
339
+ OP_TYPEPLUS, /* 40 the minimizing one second. These codes must */
340
+ OP_TYPEMINPLUS, /* 41 be in exactly the same order as those above. */
341
+ OP_TYPEQUERY, /* 42 This set applies to character types such as \d */
342
+ OP_TYPEMINQUERY, /* 43 */
343
+ OP_TYPEUPTO, /* 44 From 0 to n matches */
344
+ OP_TYPEMINUPTO, /* 45 */
345
+ OP_TYPEEXACT, /* 46 Exactly n matches */
346
+
347
+ OP_CRSTAR, /* 47 The maximizing and minimizing versions of */
348
+ OP_CRMINSTAR, /* 48 all these opcodes must come in pairs, with */
349
+ OP_CRPLUS, /* 49 the minimizing one second. These codes must */
350
+ OP_CRMINPLUS, /* 50 be in exactly the same order as those above. */
351
+ OP_CRQUERY, /* 51 These are for character classes and back refs */
352
+ OP_CRMINQUERY, /* 52 */
353
+ OP_CRRANGE, /* 53 These are different to the three seta above. */
354
+ OP_CRMINRANGE, /* 54 */
355
+
356
+ OP_CLASS, /* 55 Match a character class, chars < 256 only */
357
+ OP_NCLASS, /* 56 Same, but the bitmap was created from a negative
358
+ class - the difference is relevant only when a UTF-8
359
+ character > 255 is encountered. */
360
+
361
+ OP_XCLASS, /* 57 Extended class for handling UTF-8 chars within the
362
+ class. This does both positive and negative. */
363
+
364
+ OP_REF, /* 58 Match a back reference */
365
+ OP_RECURSE, /* 59 Match a numbered subpattern (possibly recursive) */
366
+ OP_CALLOUT, /* 60 Call out to external function if provided */
367
+
368
+ OP_ALT, /* 61 Start of alternation */
369
+ OP_KET, /* 62 End of group that doesn't have an unbounded repeat */
370
+ OP_KETRMAX, /* 63 These two must remain together and in this */
371
+ OP_KETRMIN, /* 64 order. They are for groups the repeat for ever. */
372
+
373
+ /* The assertions must come before ONCE and COND */
374
+
375
+ OP_ASSERT, /* 65 Positive lookahead */
376
+ OP_ASSERT_NOT, /* 66 Negative lookahead */
377
+ OP_ASSERTBACK, /* 67 Positive lookbehind */
378
+ OP_ASSERTBACK_NOT, /* 68 Negative lookbehind */
379
+ OP_REVERSE, /* 69 Move pointer back - used in lookbehind assertions */
380
+
381
+ /* ONCE and COND must come after the assertions, with ONCE first, as there's
382
+ a test for >= ONCE for a subpattern that isn't an assertion. */
383
+
384
+ OP_ONCE, /* 70 Once matched, don't back up into the subpattern */
385
+ OP_COND, /* 71 Conditional group */
386
+ OP_CREF, /* 72 Used to hold an extraction string number (cond ref) */
387
+
388
+ OP_BRAZERO, /* 73 These two must remain together and in this */
389
+ OP_BRAMINZERO, /* 74 order. */
390
+
391
+ OP_BRANUMBER, /* 75 Used for extracting brackets whose number is greater
392
+ than can fit into an opcode. */
393
+
394
+ OP_BRA /* 76 This and greater values are used for brackets that
395
+ extract substrings up to a basic limit. After that,
396
+ use is made of OP_BRANUMBER. */
397
+ };
398
+
399
+ /* WARNING: There is an implicit assumption in study.c that all opcodes are
400
+ less than 128 in value. This makes handling UTF-8 character sequences easier.
401
+ */
402
+
403
+
404
+ /* This macro defines textual names for all the opcodes. There are used only
405
+ for debugging, in pcre.c when DEBUG is defined, and also in pcretest.c. The
406
+ macro is referenced only in printint.c. */
407
+
408
+ #define OP_NAME_LIST \
409
+ "End", "\\A", "\\G", "\\B", "\\b", "\\D", "\\d", \
410
+ "\\S", "\\s", "\\W", "\\w", "Any", "Anybyte", "\\Z", "\\z", \
411
+ "Opt", "^", "$", "chars", "not", \
412
+ "*", "*?", "+", "+?", "?", "??", "{", "{", "{", \
413
+ "*", "*?", "+", "+?", "?", "??", "{", "{", "{", \
414
+ "*", "*?", "+", "+?", "?", "??", "{", "{", "{", \
415
+ "*", "*?", "+", "+?", "?", "??", "{", "{", \
416
+ "class", "nclass", "xclass", "Ref", "Recurse", "Callout", \
417
+ "Alt", "Ket", "KetRmax", "KetRmin", "Assert", "Assert not", \
418
+ "AssertB", "AssertB not", "Reverse", "Once", "Cond", "Cond ref",\
419
+ "Brazero", "Braminzero", "Branumber", "Bra"
420
+
421
+
422
+ /* This macro defines the length of fixed length operations in the compiled
423
+ regex. The lengths are used when searching for specific things, and also in the
424
+ debugging printing of a compiled regex. We use a macro so that it can be
425
+ incorporated both into pcre.c and pcretest.c without being publicly exposed.
426
+
427
+ As things have been extended, some of these are no longer fixed lenths, but are
428
+ minima instead. For example, the length of a single-character repeat may vary
429
+ in UTF-8 mode. The code that uses this table must know about such things. */
430
+
431
+ #define OP_LENGTHS \
432
+ 1, /* End */ \
433
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* \A, \G, \B, \B, \D, \d, \S, \s, \W, \w */ \
434
+ 1, 1, 1, 1, 2, 1, 1, /* Any, Anybyte, \Z, \z, Opt, ^, $ */ \
435
+ 2, /* Chars - the minimum length */ \
436
+ 2, /* not */ \
437
+ /* Positive single-char repeats ** These are */ \
438
+ 2, 2, 2, 2, 2, 2, /* *, *?, +, +?, ?, ?? ** minima in */ \
439
+ 4, 4, 4, /* upto, minupto, exact ** UTF-8 mode */ \
440
+ /* Negative single-char repeats - only for chars < 256 */ \
441
+ 2, 2, 2, 2, 2, 2, /* NOT *, *?, +, +?, ?, ?? */ \
442
+ 4, 4, 4, /* NOT upto, minupto, exact */ \
443
+ /* Positive type repeats */ \
444
+ 2, 2, 2, 2, 2, 2, /* Type *, *?, +, +?, ?, ?? */ \
445
+ 4, 4, 4, /* Type upto, minupto, exact */ \
446
+ /* Character class & ref repeats */ \
447
+ 1, 1, 1, 1, 1, 1, /* *, *?, +, +?, ?, ?? */ \
448
+ 5, 5, /* CRRANGE, CRMINRANGE */ \
449
+ 33, /* CLASS */ \
450
+ 33, /* NCLASS */ \
451
+ 0, /* XCLASS - variable length */ \
452
+ 3, /* REF */ \
453
+ 1+LINK_SIZE, /* RECURSE */ \
454
+ 2, /* CALLOUT */ \
455
+ 1+LINK_SIZE, /* Alt */ \
456
+ 1+LINK_SIZE, /* Ket */ \
457
+ 1+LINK_SIZE, /* KetRmax */ \
458
+ 1+LINK_SIZE, /* KetRmin */ \
459
+ 1+LINK_SIZE, /* Assert */ \
460
+ 1+LINK_SIZE, /* Assert not */ \
461
+ 1+LINK_SIZE, /* Assert behind */ \
462
+ 1+LINK_SIZE, /* Assert behind not */ \
463
+ 1+LINK_SIZE, /* Reverse */ \
464
+ 1+LINK_SIZE, /* Once */ \
465
+ 1+LINK_SIZE, /* COND */ \
466
+ 3, /* CREF */ \
467
+ 1, 1, /* BRAZERO, BRAMINZERO */ \
468
+ 3, /* BRANUMBER */ \
469
+ 1+LINK_SIZE /* BRA */ \
470
+
471
+
472
+ /* The highest extraction number before we have to start using additional
473
+ bytes. (Originally PCRE didn't have support for extraction counts highter than
474
+ this number.) The value is limited by the number of opcodes left after OP_BRA,
475
+ i.e. 255 - OP_BRA. We actually set it a bit lower to leave room for additional
476
+ opcodes. */
477
+
478
+ #define EXTRACT_BASIC_MAX 150
479
+
480
+ /* A magic value for OP_CREF to indicate the "in recursion" condition. */
481
+
482
+ #define CREF_RECURSE 0xffff
483
+
484
+ /* The texts of compile-time error messages are defined as macros here so that
485
+ they can be accessed by the POSIX wrapper and converted into error codes. Yes,
486
+ I could have used error codes in the first place, but didn't feel like changing
487
+ just to accommodate the POSIX wrapper. */
488
+
489
+ #define ERR1 "\\ at end of pattern"
490
+ #define ERR2 "\\c at end of pattern"
491
+ #define ERR3 "unrecognized character follows \\"
492
+ #define ERR4 "numbers out of order in {} quantifier"
493
+ #define ERR5 "number too big in {} quantifier"
494
+ #define ERR6 "missing terminating ] for character class"
495
+ #define ERR7 "invalid escape sequence in character class"
496
+ #define ERR8 "range out of order in character class"
497
+ #define ERR9 "nothing to repeat"
498
+ #define ERR10 "operand of unlimited repeat could match the empty string"
499
+ #define ERR11 "internal error: unexpected repeat"
500
+ #define ERR12 "unrecognized character after (?"
501
+ #define ERR13 "POSIX named classes are supported only within a class"
502
+ #define ERR14 "missing )"
503
+ #define ERR15 "reference to non-existent subpattern"
504
+ #define ERR16 "erroffset passed as NULL"
505
+ #define ERR17 "unknown option bit(s) set"
506
+ #define ERR18 "missing ) after comment"
507
+ #define ERR19 "parentheses nested too deeply"
508
+ #define ERR20 "regular expression too large"
509
+ #define ERR21 "failed to get memory"
510
+ #define ERR22 "unmatched parentheses"
511
+ #define ERR23 "internal error: code overflow"
512
+ #define ERR24 "unrecognized character after (?<"
513
+ #define ERR25 "lookbehind assertion is not fixed length"
514
+ #define ERR26 "malformed number after (?("
515
+ #define ERR27 "conditional group contains more than two branches"
516
+ #define ERR28 "assertion expected after (?("
517
+ #define ERR29 "(?R or (?digits must be followed by )"
518
+ #define ERR30 "unknown POSIX class name"
519
+ #define ERR31 "POSIX collating elements are not supported"
520
+ #define ERR32 "this version of PCRE is not compiled with PCRE_UTF8 support"
521
+ #define ERR33 "spare error"
522
+ #define ERR34 "character value in \\x{...} sequence is too large"
523
+ #define ERR35 "invalid condition (?(0)"
524
+ #define ERR36 "\\C not allowed in lookbehind assertion"
525
+ #define ERR37 "PCRE does not support \\L, \\l, \\N, \\P, \\p, \\U, \\u, or \\X"
526
+ #define ERR38 "number after (?C is > 255"
527
+ #define ERR39 "closing ) for (?C expected"
528
+ #define ERR40 "recursive call could loop indefinitely"
529
+ #define ERR41 "unrecognized character after (?P"
530
+ #define ERR42 "syntax error after (?P"
531
+ #define ERR43 "two named groups have the same name"
532
+ #define ERR44 "invalid UTF-8 string"
533
+
534
+ /* All character handling must be done as unsigned characters. Otherwise there
535
+ are problems with top-bit-set characters and functions such as isspace().
536
+ However, we leave the interface to the outside world as char *, because that
537
+ should make things easier for callers. We define a short type for unsigned char
538
+ to save lots of typing. I tried "uchar", but it causes problems on Digital
539
+ Unix, where it is defined in sys/types, so use "uschar" instead. */
540
+
541
+ typedef unsigned char uschar;
542
+
543
+ /* The real format of the start of the pcre block; the index of names and the
544
+ code vector run on as long as necessary after the end. */
545
+
546
+ typedef struct real_pcre {
547
+ unsigned long int magic_number;
548
+ size_t size; /* Total that was malloced */
549
+ const unsigned char *tables; /* Pointer to tables */
550
+ unsigned long int options;
551
+ unsigned short int top_bracket;
552
+ unsigned short int top_backref;
553
+ unsigned short int first_byte;
554
+ unsigned short int req_byte;
555
+ unsigned short int name_entry_size; /* Size of any name items; 0 => none */
556
+ unsigned short int name_count; /* Number of name items */
557
+ } real_pcre;
558
+
559
+ /* The format of the block used to store data from pcre_study(). */
560
+
561
+ typedef struct pcre_study_data {
562
+ size_t size; /* Total that was malloced */
563
+ uschar options;
564
+ uschar start_bits[32];
565
+ } pcre_study_data;
566
+
567
+ /* Structure for passing "static" information around between the functions
568
+ doing the compiling, so that they are thread-safe. */
569
+
570
+ typedef struct compile_data {
571
+ const uschar *lcc; /* Points to lower casing table */
572
+ const uschar *fcc; /* Points to case-flipping table */
573
+ const uschar *cbits; /* Points to character type table */
574
+ const uschar *ctypes; /* Points to table of type maps */
575
+ const uschar *start_code; /* The start of the compiled code */
576
+ uschar *name_table; /* The name/number table */
577
+ int names_found; /* Number of entries so far */
578
+ int name_entry_size; /* Size of each entry */
579
+ int top_backref; /* Maximum back reference */
580
+ unsigned int backref_map; /* Bitmap of low back refs */
581
+ int req_varyopt; /* "After variable item" flag for reqbyte */
582
+ } compile_data;
583
+
584
+ /* Structure for maintaining a chain of pointers to the currently incomplete
585
+ branches, for testing for left recursion. */
586
+
587
+ typedef struct branch_chain {
588
+ struct branch_chain *outer;
589
+ uschar *current;
590
+ } branch_chain;
591
+
592
+ /* Structure for items in a linked list that represents an explicit recursive
593
+ call within the pattern. */
594
+
595
+ typedef struct recursion_info {
596
+ struct recursion_info *prevrec; /* Previous recursion record (or NULL) */
597
+ int group_num; /* Number of group that was called */
598
+ const uschar *after_call; /* "Return value": points after the call in the expr */
599
+ const uschar *save_start; /* Old value of md->start_match */
600
+ int *offset_save; /* Pointer to start of saved offsets */
601
+ int saved_max; /* Number of saved offsets */
602
+ } recursion_info;
603
+
604
+ /* When compiling in a mode that doesn't use recursive calls to match(),
605
+ a structure is used to remember local variables on the heap. It is defined in
606
+ pcre.c, close to the match() function, so that it is easy to keep it in step
607
+ with any changes of local variable. However, the pointer to the current frame
608
+ must be saved in some "static" place over a longjmp(). We declare the
609
+ structure here so that we can put a pointer in the match_data structure.
610
+ NOTE: This isn't used for a "normal" compilation of pcre. */
611
+
612
+ struct heapframe;
613
+
614
+ /* Structure for passing "static" information around between the functions
615
+ doing the matching, so that they are thread-safe. */
616
+
617
+ typedef struct match_data {
618
+ unsigned long int match_call_count; /* As it says */
619
+ unsigned long int match_limit;/* As it says */
620
+ int *offset_vector; /* Offset vector */
621
+ int offset_end; /* One past the end */
622
+ int offset_max; /* The maximum usable for return data */
623
+ const uschar *lcc; /* Points to lower casing table */
624
+ const uschar *ctypes; /* Points to table of type maps */
625
+ BOOL offset_overflow; /* Set if too many extractions */
626
+ BOOL notbol; /* NOTBOL flag */
627
+ BOOL noteol; /* NOTEOL flag */
628
+ BOOL utf8; /* UTF8 flag */
629
+ BOOL endonly; /* Dollar not before final \n */
630
+ BOOL notempty; /* Empty string match not wanted */
631
+ const uschar *start_code; /* For use when recursing */
632
+ const uschar *start_subject; /* Start of the subject string */
633
+ const uschar *end_subject; /* End of the subject string */
634
+ const uschar *start_match; /* Start of this match attempt */
635
+ const uschar *end_match_ptr; /* Subject position at end match */
636
+ int end_offset_top; /* Highwater mark at end of match */
637
+ int capture_last; /* Most recent capture number */
638
+ int start_offset; /* The start offset value */
639
+ recursion_info *recursive; /* Linked list of recursion data */
640
+ void *callout_data; /* To pass back to callouts */
641
+ struct heapframe *thisframe; /* Used only when compiling for no recursion */
642
+ } match_data;
643
+
644
+ /* Bit definitions for entries in the pcre_ctypes table. */
645
+
646
+ #define ctype_space 0x01
647
+ #define ctype_letter 0x02
648
+ #define ctype_digit 0x04
649
+ #define ctype_xdigit 0x08
650
+ #define ctype_word 0x10 /* alphameric or '_' */
651
+ #define ctype_meta 0x80 /* regexp meta char or zero (end pattern) */
652
+
653
+ /* Offsets for the bitmap tables in pcre_cbits. Each table contains a set
654
+ of bits for a class map. Some classes are built by combining these tables. */
655
+
656
+ #define cbit_space 0 /* [:space:] or \s */
657
+ #define cbit_xdigit 32 /* [:xdigit:] */
658
+ #define cbit_digit 64 /* [:digit:] or \d */
659
+ #define cbit_upper 96 /* [:upper:] */
660
+ #define cbit_lower 128 /* [:lower:] */
661
+ #define cbit_word 160 /* [:word:] or \w */
662
+ #define cbit_graph 192 /* [:graph:] */
663
+ #define cbit_print 224 /* [:print:] */
664
+ #define cbit_punct 256 /* [:punct:] */
665
+ #define cbit_cntrl 288 /* [:cntrl:] */
666
+ #define cbit_length 320 /* Length of the cbits table */
667
+
668
+ /* Offsets of the various tables from the base tables pointer, and
669
+ total length. */
670
+
671
+ #define lcc_offset 0
672
+ #define fcc_offset 256
673
+ #define cbits_offset 512
674
+ #define ctypes_offset (cbits_offset + cbit_length)
675
+ #define tables_length (ctypes_offset + 256)
676
+
677
+ /* End of internal.h */