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,472 @@
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
+
36
+ /* Include the internals header, which itself includes Standard C headers plus
37
+ the external pcre header. */
38
+
39
+ #include "internal.h"
40
+
41
+
42
+
43
+ /*************************************************
44
+ * Set a bit and maybe its alternate case *
45
+ *************************************************/
46
+
47
+ /* Given a character, set its bit in the table, and also the bit for the other
48
+ version of a letter if we are caseless.
49
+
50
+ Arguments:
51
+ start_bits points to the bit map
52
+ c is the character
53
+ caseless the caseless flag
54
+ cd the block with char table pointers
55
+
56
+ Returns: nothing
57
+ */
58
+
59
+ static void
60
+ set_bit(uschar *start_bits, int c, BOOL caseless, compile_data *cd)
61
+ {
62
+ start_bits[c/8] |= (1 << (c&7));
63
+ if (caseless && (cd->ctypes[c] & ctype_letter) != 0)
64
+ start_bits[cd->fcc[c]/8] |= (1 << (cd->fcc[c]&7));
65
+ }
66
+
67
+
68
+
69
+ /*************************************************
70
+ * Create bitmap of starting chars *
71
+ *************************************************/
72
+
73
+ /* This function scans a compiled unanchored expression and attempts to build a
74
+ bitmap of the set of initial characters. If it can't, it returns FALSE. As time
75
+ goes by, we may be able to get more clever at doing this.
76
+
77
+ Arguments:
78
+ code points to an expression
79
+ start_bits points to a 32-byte table, initialized to 0
80
+ caseless the current state of the caseless flag
81
+ utf8 TRUE if in UTF-8 mode
82
+ cd the block with char table pointers
83
+
84
+ Returns: TRUE if table built, FALSE otherwise
85
+ */
86
+
87
+ static BOOL
88
+ set_start_bits(const uschar *code, uschar *start_bits, BOOL caseless,
89
+ BOOL utf8, compile_data *cd)
90
+ {
91
+ register int c;
92
+
93
+ /* This next statement and the later reference to dummy are here in order to
94
+ trick the optimizer of the IBM C compiler for OS/2 into generating correct
95
+ code. Apparently IBM isn't going to fix the problem, and we would rather not
96
+ disable optimization (in this module it actually makes a big difference, and
97
+ the pcre module can use all the optimization it can get). */
98
+
99
+ volatile int dummy;
100
+
101
+ do
102
+ {
103
+ const uschar *tcode = code + 1 + LINK_SIZE;
104
+ BOOL try_next = TRUE;
105
+
106
+ while (try_next)
107
+ {
108
+ /* If a branch starts with a bracket or a positive lookahead assertion,
109
+ recurse to set bits from within them. That's all for this branch. */
110
+
111
+ if ((int)*tcode >= OP_BRA || *tcode == OP_ASSERT)
112
+ {
113
+ if (!set_start_bits(tcode, start_bits, caseless, utf8, cd))
114
+ return FALSE;
115
+ try_next = FALSE;
116
+ }
117
+
118
+ else switch(*tcode)
119
+ {
120
+ default:
121
+ return FALSE;
122
+
123
+ /* Skip over callout */
124
+
125
+ case OP_CALLOUT:
126
+ tcode += 2;
127
+ break;
128
+
129
+ /* Skip over extended extraction bracket number */
130
+
131
+ case OP_BRANUMBER:
132
+ tcode += 3;
133
+ break;
134
+
135
+ /* Skip over lookbehind and negative lookahead assertions */
136
+
137
+ case OP_ASSERT_NOT:
138
+ case OP_ASSERTBACK:
139
+ case OP_ASSERTBACK_NOT:
140
+ do tcode += GET(tcode, 1); while (*tcode == OP_ALT);
141
+ tcode += 1+LINK_SIZE;
142
+ break;
143
+
144
+ /* Skip over an option setting, changing the caseless flag */
145
+
146
+ case OP_OPT:
147
+ caseless = (tcode[1] & PCRE_CASELESS) != 0;
148
+ tcode += 2;
149
+ break;
150
+
151
+ /* BRAZERO does the bracket, but carries on. */
152
+
153
+ case OP_BRAZERO:
154
+ case OP_BRAMINZERO:
155
+ if (!set_start_bits(++tcode, start_bits, caseless, utf8, cd))
156
+ return FALSE;
157
+ dummy = 1;
158
+ do tcode += GET(tcode,1); while (*tcode == OP_ALT);
159
+ tcode += 1+LINK_SIZE;
160
+ break;
161
+
162
+ /* Single-char * or ? sets the bit and tries the next item */
163
+
164
+ case OP_STAR:
165
+ case OP_MINSTAR:
166
+ case OP_QUERY:
167
+ case OP_MINQUERY:
168
+ set_bit(start_bits, tcode[1], caseless, cd);
169
+ tcode += 2;
170
+ #ifdef SUPPORT_UTF8
171
+ if (utf8) while ((*tcode & 0xc0) == 0x80) tcode++;
172
+ #endif
173
+ break;
174
+
175
+ /* Single-char upto sets the bit and tries the next */
176
+
177
+ case OP_UPTO:
178
+ case OP_MINUPTO:
179
+ set_bit(start_bits, tcode[3], caseless, cd);
180
+ tcode += 4;
181
+ #ifdef SUPPORT_UTF8
182
+ if (utf8) while ((*tcode & 0xc0) == 0x80) tcode++;
183
+ #endif
184
+ break;
185
+
186
+ /* At least one single char sets the bit and stops */
187
+
188
+ case OP_EXACT: /* Fall through */
189
+ tcode++;
190
+
191
+ case OP_CHARS: /* Fall through */
192
+ tcode++;
193
+
194
+ case OP_PLUS:
195
+ case OP_MINPLUS:
196
+ set_bit(start_bits, tcode[1], caseless, cd);
197
+ try_next = FALSE;
198
+ break;
199
+
200
+ /* Single character type sets the bits and stops */
201
+
202
+ case OP_NOT_DIGIT:
203
+ for (c = 0; c < 32; c++)
204
+ start_bits[c] |= ~cd->cbits[c+cbit_digit];
205
+ try_next = FALSE;
206
+ break;
207
+
208
+ case OP_DIGIT:
209
+ for (c = 0; c < 32; c++)
210
+ start_bits[c] |= cd->cbits[c+cbit_digit];
211
+ try_next = FALSE;
212
+ break;
213
+
214
+ case OP_NOT_WHITESPACE:
215
+ for (c = 0; c < 32; c++)
216
+ start_bits[c] |= ~cd->cbits[c+cbit_space];
217
+ try_next = FALSE;
218
+ break;
219
+
220
+ case OP_WHITESPACE:
221
+ for (c = 0; c < 32; c++)
222
+ start_bits[c] |= cd->cbits[c+cbit_space];
223
+ try_next = FALSE;
224
+ break;
225
+
226
+ case OP_NOT_WORDCHAR:
227
+ for (c = 0; c < 32; c++)
228
+ start_bits[c] |= ~cd->cbits[c+cbit_word];
229
+ try_next = FALSE;
230
+ break;
231
+
232
+ case OP_WORDCHAR:
233
+ for (c = 0; c < 32; c++)
234
+ start_bits[c] |= cd->cbits[c+cbit_word];
235
+ try_next = FALSE;
236
+ break;
237
+
238
+ /* One or more character type fudges the pointer and restarts, knowing
239
+ it will hit a single character type and stop there. */
240
+
241
+ case OP_TYPEPLUS:
242
+ case OP_TYPEMINPLUS:
243
+ tcode++;
244
+ break;
245
+
246
+ case OP_TYPEEXACT:
247
+ tcode += 3;
248
+ break;
249
+
250
+ /* Zero or more repeats of character types set the bits and then
251
+ try again. */
252
+
253
+ case OP_TYPEUPTO:
254
+ case OP_TYPEMINUPTO:
255
+ tcode += 2; /* Fall through */
256
+
257
+ case OP_TYPESTAR:
258
+ case OP_TYPEMINSTAR:
259
+ case OP_TYPEQUERY:
260
+ case OP_TYPEMINQUERY:
261
+ switch(tcode[1])
262
+ {
263
+ case OP_ANY:
264
+ return FALSE;
265
+
266
+ case OP_NOT_DIGIT:
267
+ for (c = 0; c < 32; c++)
268
+ start_bits[c] |= ~cd->cbits[c+cbit_digit];
269
+ break;
270
+
271
+ case OP_DIGIT:
272
+ for (c = 0; c < 32; c++)
273
+ start_bits[c] |= cd->cbits[c+cbit_digit];
274
+ break;
275
+
276
+ case OP_NOT_WHITESPACE:
277
+ for (c = 0; c < 32; c++)
278
+ start_bits[c] |= ~cd->cbits[c+cbit_space];
279
+ break;
280
+
281
+ case OP_WHITESPACE:
282
+ for (c = 0; c < 32; c++)
283
+ start_bits[c] |= cd->cbits[c+cbit_space];
284
+ break;
285
+
286
+ case OP_NOT_WORDCHAR:
287
+ for (c = 0; c < 32; c++)
288
+ start_bits[c] |= ~cd->cbits[c+cbit_word];
289
+ break;
290
+
291
+ case OP_WORDCHAR:
292
+ for (c = 0; c < 32; c++)
293
+ start_bits[c] |= cd->cbits[c+cbit_word];
294
+ break;
295
+ }
296
+
297
+ tcode += 2;
298
+ break;
299
+
300
+ /* Character class where all the information is in a bit map: set the
301
+ bits and either carry on or not, according to the repeat count. If it was
302
+ a negative class, and we are operating with UTF-8 characters, any byte
303
+ with a value >= 0xc4 is a potentially valid starter because it starts a
304
+ character with a value > 255. */
305
+
306
+ case OP_NCLASS:
307
+ if (utf8)
308
+ {
309
+ start_bits[24] |= 0xf0; /* Bits for 0xc4 - 0xc8 */
310
+ memset(start_bits+25, 0xff, 7); /* Bits for 0xc9 - 0xff */
311
+ }
312
+ /* Fall through */
313
+
314
+ case OP_CLASS:
315
+ {
316
+ tcode++;
317
+
318
+ /* In UTF-8 mode, the bits in a bit map correspond to character
319
+ values, not to byte values. However, the bit map we are constructing is
320
+ for byte values. So we have to do a conversion for characters whose
321
+ value is > 127. In fact, there are only two possible starting bytes for
322
+ characters in the range 128 - 255. */
323
+
324
+ if (utf8)
325
+ {
326
+ for (c = 0; c < 16; c++) start_bits[c] |= tcode[c];
327
+ for (c = 128; c < 256; c++)
328
+ {
329
+ if ((tcode[c/8] && (1 << (c&7))) != 0)
330
+ {
331
+ int d = (c >> 6) | 0xc0; /* Set bit for this starter */
332
+ start_bits[d/8] |= (1 << (d&7)); /* and then skip on to the */
333
+ c = (c & 0xc0) + 0x40 - 1; /* next relevant character. */
334
+ }
335
+ }
336
+ }
337
+
338
+ /* In non-UTF-8 mode, the two bit maps are completely compatible. */
339
+
340
+ else
341
+ {
342
+ for (c = 0; c < 32; c++) start_bits[c] |= tcode[c];
343
+ }
344
+
345
+ /* Advance past the bit map, and act on what follows */
346
+
347
+ tcode += 32;
348
+ switch (*tcode)
349
+ {
350
+ case OP_CRSTAR:
351
+ case OP_CRMINSTAR:
352
+ case OP_CRQUERY:
353
+ case OP_CRMINQUERY:
354
+ tcode++;
355
+ break;
356
+
357
+ case OP_CRRANGE:
358
+ case OP_CRMINRANGE:
359
+ if (((tcode[1] << 8) + tcode[2]) == 0) tcode += 5;
360
+ else try_next = FALSE;
361
+ break;
362
+
363
+ default:
364
+ try_next = FALSE;
365
+ break;
366
+ }
367
+ }
368
+ break; /* End of bitmap class handling */
369
+
370
+ } /* End of switch */
371
+ } /* End of try_next loop */
372
+
373
+ code += GET(code, 1); /* Advance to next branch */
374
+ }
375
+ while (*code == OP_ALT);
376
+ return TRUE;
377
+ }
378
+
379
+
380
+
381
+ /*************************************************
382
+ * Study a compiled expression *
383
+ *************************************************/
384
+
385
+ /* This function is handed a compiled expression that it must study to produce
386
+ information that will speed up the matching. It returns a pcre_extra block
387
+ which then gets handed back to pcre_exec().
388
+
389
+ Arguments:
390
+ re points to the compiled expression
391
+ options contains option bits
392
+ errorptr points to where to place error messages;
393
+ set NULL unless error
394
+
395
+ Returns: pointer to a pcre_extra block, with study_data filled in and the
396
+ appropriate flag set;
397
+ NULL on error or if no optimization possible
398
+ */
399
+
400
+ EXPORT pcre_extra *
401
+ pcre_study(const pcre *external_re, int options, const char **errorptr)
402
+ {
403
+ uschar start_bits[32];
404
+ pcre_extra *extra;
405
+ pcre_study_data *study;
406
+ const real_pcre *re = (const real_pcre *)external_re;
407
+ uschar *code = (uschar *)re + sizeof(real_pcre) +
408
+ (re->name_count * re->name_entry_size);
409
+ compile_data compile_block;
410
+
411
+ *errorptr = NULL;
412
+
413
+ if (re == NULL || re->magic_number != MAGIC_NUMBER)
414
+ {
415
+ *errorptr = "argument is not a compiled regular expression";
416
+ return NULL;
417
+ }
418
+
419
+ if ((options & ~PUBLIC_STUDY_OPTIONS) != 0)
420
+ {
421
+ *errorptr = "unknown or incorrect option bit(s) set";
422
+ return NULL;
423
+ }
424
+
425
+ /* For an anchored pattern, or an unanchored pattern that has a first char, or
426
+ a multiline pattern that matches only at "line starts", no further processing
427
+ at present. */
428
+
429
+ if ((re->options & (PCRE_ANCHORED|PCRE_FIRSTSET|PCRE_STARTLINE)) != 0)
430
+ return NULL;
431
+
432
+ /* Set the character tables in the block which is passed around */
433
+
434
+ compile_block.lcc = re->tables + lcc_offset;
435
+ compile_block.fcc = re->tables + fcc_offset;
436
+ compile_block.cbits = re->tables + cbits_offset;
437
+ compile_block.ctypes = re->tables + ctypes_offset;
438
+
439
+ /* See if we can find a fixed set of initial characters for the pattern. */
440
+
441
+ memset(start_bits, 0, 32 * sizeof(uschar));
442
+ if (!set_start_bits(code, start_bits, (re->options & PCRE_CASELESS) != 0,
443
+ (re->options & PCRE_UTF8) != 0, &compile_block)) return NULL;
444
+
445
+ /* Get a pcre_extra block and a pcre_study_data block. The study data is put in
446
+ the latter, which is pointed to by the former, which may also get additional
447
+ data set later by the calling program. At the moment, the size of
448
+ pcre_study_data is fixed. We nevertheless save it in a field for returning via
449
+ the pcre_fullinfo() function so that if it becomes variable in the future, we
450
+ don't have to change that code. */
451
+
452
+ extra = (pcre_extra *)(pcre_malloc)
453
+ (sizeof(pcre_extra) + sizeof(pcre_study_data));
454
+
455
+ if (extra == NULL)
456
+ {
457
+ *errorptr = "failed to get memory";
458
+ return NULL;
459
+ }
460
+
461
+ study = (pcre_study_data *)((char *)extra + sizeof(pcre_extra));
462
+ extra->flags = PCRE_EXTRA_STUDY_DATA;
463
+ extra->study_data = study;
464
+
465
+ study->size = sizeof(pcre_study_data);
466
+ study->options = PCRE_STUDY_MAPPED;
467
+ memcpy(study->start_bits, start_bits, sizeof(start_bits));
468
+
469
+ return extra;
470
+ }
471
+
472
+ /* End of study.c */
@@ -0,0 +1,14 @@
1
+ require 'mxx_ru/cpp'
2
+
3
+ class Build < Mxx_ru::Cpp::Composite_target
4
+ def initialize( a_alias = Mxx_ru::BUILD_ROOT )
5
+ super( a_alias )
6
+
7
+ global_include_path( "h" )
8
+
9
+ required_prj( "main.rb" )
10
+
11
+ end
12
+ end
13
+
14
+ Mxx_ru::setup_target( Build.new )
@@ -0,0 +1,17 @@
1
+ #define WIN32_LEAN_AND_MEAN
2
+ #include <windows.h>
3
+
4
+ #include <dll.hpp>
5
+
6
+ SPEC
7
+ int say_hello()
8
+ {
9
+ MessageBox( GetDesktopWindow(),
10
+ "mswin_res_dll successfully started",
11
+ "Hello!",
12
+ MB_OK | MB_ICONINFORMATION );
13
+
14
+ return 0;
15
+ }
16
+
17
+
@@ -0,0 +1,30 @@
1
+ require 'mxx_ru/cpp'
2
+
3
+ class Dll < Mxx_ru::Cpp::Dll_target
4
+ def initialize( a_alias = "dll.rb" )
5
+ super( a_alias )
6
+
7
+ target( "dll" )
8
+ implib_path( "o" )
9
+
10
+ cpp_source( "dll.cpp" )
11
+
12
+ define( "DLL_PRJ" )
13
+
14
+ mswin_rc_include_path( "h" )
15
+ mswin_rc_file( "dll.rc",
16
+ [ "h/res.h",
17
+ "res/tree_fol.bmp",
18
+ "res/tree_state_1.bmp",
19
+ "res/tree_state_2.bmp" ] )
20
+
21
+ lib( "user32.lib" )
22
+
23
+ if "bcc" == toolset.name
24
+ mswin_rc_include_path( "d:\\usr\\bin\\bc6\\include" )
25
+ end
26
+
27
+ end
28
+ end
29
+
30
+ Mxx_ru::setup_target( Dll.new )
@@ -0,0 +1,48 @@
1
+ #include <windows.h>
2
+
3
+ #include <res.h>
4
+
5
+ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
6
+ #ifdef _WIN32
7
+ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
8
+ #pragma code_page(1251)
9
+ #endif //_WIN32
10
+ #endif
11
+
12
+ IDB_TREE_STATE_NORMAL BITMAP MOVEABLE PURE "res\\tree_state_1.bmp"
13
+ IDB_TREE_STATE_MASK BITMAP MOVEABLE PURE "res\\tree_state_2.bmp"
14
+ IDB_TREE_FOLDER BITMAP MOVEABLE PURE "res\\tree_fol.bmp"
15
+
16
+ VS_VERSION_INFO VERSIONINFO
17
+ FILEVERSION 1,0,0,0
18
+ PRODUCTVERSION 1,0,0,0
19
+ FILEFLAGSMASK 0x3fL
20
+ #ifdef _DEBUG
21
+ FILEFLAGS 0x1L
22
+ #else
23
+ FILEFLAGS 0x0L
24
+ #endif
25
+ FILEOS 0x4L
26
+ FILETYPE 0x1L
27
+ FILESUBTYPE 0x0L
28
+ BEGIN
29
+ BLOCK "StringFileInfo"
30
+ BEGIN
31
+ BLOCK "040904b0"
32
+ BEGIN
33
+ VALUE "CompanyName", "org.eao197\0"
34
+ VALUE "FileDescription", "Mxx_ru mswin_res_dll test\0"
35
+ VALUE "FileVersion", "1, 0, 0, 0\0"
36
+ VALUE "InternalName", "mswin_res_dll\0"
37
+ VALUE "LegalCopyright", "Copyright (C) 2004 Yauheni A. Akhotnikau\0"
38
+ VALUE "LegalTrademarks", "Mxx_ru (R)\0"
39
+ VALUE "OriginalFilename", "dll.dll\0"
40
+ VALUE "ProductName", "Mxx_ru\0"
41
+ VALUE "ProductVersion", "1, 0, 0, 0\0"
42
+ END
43
+ END
44
+ BLOCK "VarFileInfo"
45
+ BEGIN
46
+ VALUE "Translation", 0x409, 1200
47
+ END
48
+ END
@@ -0,0 +1,8 @@
1
+ #if !defined( DLL_PRJ )
2
+ #define SPEC __declspec(dllimport)
3
+ #else
4
+ #define SPEC __declspec(dllexport)
5
+ #endif
6
+
7
+ SPEC
8
+ int say_hello();
@@ -0,0 +1,3 @@
1
+ #define IDB_TREE_STATE_NORMAL 1001
2
+ #define IDB_TREE_STATE_MASK 1002
3
+ #define IDB_TREE_FOLDER 1003
@@ -0,0 +1,13 @@
1
+ #define WIN32_LEAN_AND_MEAN
2
+ #include <windows.h>
3
+
4
+ #include <dll.hpp>
5
+
6
+ int CALLBACK WinMain(
7
+ HINSTANCE hInstance,
8
+ HINSTANCE hPrevInstance,
9
+ LPSTR lpCmdLine,
10
+ int nCmdShow )
11
+ {
12
+ return say_hello();
13
+ }
@@ -0,0 +1,20 @@
1
+ require 'mxx_ru/cpp'
2
+
3
+ class Exe < Mxx_ru::Cpp::Exe_target
4
+ def initialize( a_alias = "main.rb" )
5
+ super( a_alias )
6
+
7
+ target( "mswin_res_dll" )
8
+ screen_mode( Mxx_ru::Cpp::SCREEN_WINDOW )
9
+
10
+ required_prj( "dll.rb" )
11
+
12
+ cpp_source( "main.cpp" )
13
+
14
+ if "vc" == toolset.name
15
+ lib( "user32.lib" )
16
+ end
17
+ end
18
+ end
19
+
20
+ Mxx_ru::setup_target( Exe.new )
@@ -0,0 +1,23 @@
1
+ require 'mxx_ru/cpp'
2
+
3
+ Mxx_ru::setup_target(
4
+ Mxx_ru::Cpp::Exe_target.new( Mxx_ru::BUILD_ROOT ) {
5
+ target( "mswin_res_exe" )
6
+ screen_mode( Mxx_ru::Cpp::SCREEN_WINDOW )
7
+
8
+ cpp_source( "main.cpp" )
9
+
10
+ mswin_rc_include_path( "h" )
11
+ mswin_rc_file( "main.rc",
12
+ [ "h/res.h",
13
+ "res/tree_fol.bmp",
14
+ "res/tree_state_1.bmp",
15
+ "res/tree_state_2.bmp" ] )
16
+
17
+ lib( "user32.lib" )
18
+
19
+ if "bcc" == toolset.name
20
+ mswin_rc_include_path( "d:\\usr\\bin\\bc6\\include" )
21
+ end
22
+ }
23
+ )
@@ -0,0 +1,3 @@
1
+ #define IDB_TREE_STATE_NORMAL 1001
2
+ #define IDB_TREE_STATE_MASK 1002
3
+ #define IDB_TREE_FOLDER 1003
@@ -0,0 +1,17 @@
1
+ #define WIN32_LEAN_AND_MEAN
2
+ #include <windows.h>
3
+
4
+ int CALLBACK WinMain(
5
+ HINSTANCE hInstance,
6
+ HINSTANCE hPrevInstance,
7
+ LPSTR lpCmdLine,
8
+ int nCmdShow )
9
+ {
10
+
11
+ MessageBox( GetDesktopWindow(),
12
+ "mswin_res_exe successfully started",
13
+ "Hello!",
14
+ MB_OK | MB_ICONINFORMATION );
15
+
16
+ return 0;
17
+ }