| 201 |
#define PCRE_FREE_STUDY8(extra) \ |
#define PCRE_FREE_STUDY8(extra) \ |
| 202 |
pcre_free_study(extra) |
pcre_free_study(extra) |
| 203 |
|
|
| 204 |
|
#define PCRE_PATTERN_TO_HOST_BYTE_ORDER8(re, extra, tables) \ |
| 205 |
|
pcre_pattern_to_host_byte_order(re, extra, tables) |
| 206 |
|
|
| 207 |
#endif /* SUPPORT_PCRE8 */ |
#endif /* SUPPORT_PCRE8 */ |
| 208 |
|
|
| 209 |
|
|
| 228 |
#define PCRE_STUDY16(extra, re, options, error) \ |
#define PCRE_STUDY16(extra, re, options, error) \ |
| 229 |
extra = pcre16_study(re, options, error) |
extra = pcre16_study(re, options, error) |
| 230 |
|
|
| 231 |
|
#define PCRE_PATTERN_TO_HOST_BYTE_ORDER16(re, extra, tables) \ |
| 232 |
|
pcre16_pattern_to_host_byte_order(re, extra, tables) |
| 233 |
|
|
| 234 |
#endif /* SUPPORT_PCRE16 */ |
#endif /* SUPPORT_PCRE16 */ |
| 235 |
|
|
| 236 |
|
|
| 277 |
else \ |
else \ |
| 278 |
PCRE_STUDY8(extra, re, options, error) |
PCRE_STUDY8(extra, re, options, error) |
| 279 |
|
|
| 280 |
|
#define PCRE_PATTERN_TO_HOST_BYTE_ORDER(re, extra, tables) \ |
| 281 |
|
if (use_pcre16) \ |
| 282 |
|
PCRE_PATTERN_TO_HOST_BYTE_ORDER16(re, extra, tables); \ |
| 283 |
|
else \ |
| 284 |
|
PCRE_PATTERN_TO_HOST_BYTE_ORDER8(re, extra, tables) |
| 285 |
|
|
| 286 |
/* ----- Only 8-bit mode is supported ----- */ |
/* ----- Only 8-bit mode is supported ----- */ |
| 287 |
|
|
| 288 |
#elif defined SUPPORT_PCRE8 |
#elif defined SUPPORT_PCRE8 |
| 292 |
#define PCRE_EXEC PCRE_EXEC8 |
#define PCRE_EXEC PCRE_EXEC8 |
| 293 |
#define PCRE_FREE_STUDY PCRE_FREE_STUDY8 |
#define PCRE_FREE_STUDY PCRE_FREE_STUDY8 |
| 294 |
#define PCRE_STUDY PCRE_STUDY8 |
#define PCRE_STUDY PCRE_STUDY8 |
| 295 |
|
#define PCRE_PATTERN_TO_HOST_BYTE_ORDER PCRE_PATTERN_TO_HOST_BYTE_ORDER8 |
| 296 |
|
|
| 297 |
/* ----- Only 16-bit mode is supported ----- */ |
/* ----- Only 16-bit mode is supported ----- */ |
| 298 |
|
|
| 303 |
#define PCRE_EXEC PCRE_EXEC16 |
#define PCRE_EXEC PCRE_EXEC16 |
| 304 |
#define PCRE_FREE_STUDY PCRE_FREE_STUDY16 |
#define PCRE_FREE_STUDY PCRE_FREE_STUDY16 |
| 305 |
#define PCRE_STUDY PCRE_STUDY16 |
#define PCRE_STUDY PCRE_STUDY16 |
| 306 |
|
#define PCRE_PATTERN_TO_HOST_BYTE_ORDER PCRE_PATTERN_TO_HOST_BYTE_ORDER16 |
| 307 |
#endif |
#endif |
| 308 |
|
|
| 309 |
/* ----- End of mode-specific function call macros ----- */ |
/* ----- End of mode-specific function call macros ----- */ |
| 1869 |
fprintf(outfile, "Compiled pattern%s loaded from %s\n", |
fprintf(outfile, "Compiled pattern%s loaded from %s\n", |
| 1870 |
do_flip? " (byte-inverted)" : "", p); |
do_flip? " (byte-inverted)" : "", p); |
| 1871 |
|
|
|
/* Need to know if UTF-8 for printing data strings */ |
|
|
|
|
|
new_info(re, NULL, PCRE_INFO_OPTIONS, &get_options); |
|
|
use_utf = (get_options & PCRE_UTF8) != 0; |
|
|
|
|
| 1872 |
/* Now see if there is any following study data. */ |
/* Now see if there is any following study data. */ |
| 1873 |
|
|
| 1874 |
if (true_study_size != 0) |
if (true_study_size != 0) |
| 1898 |
} |
} |
| 1899 |
else fprintf(outfile, "No study data\n"); |
else fprintf(outfile, "No study data\n"); |
| 1900 |
|
|
| 1901 |
|
/* Flip the necessary bytes. */ |
| 1902 |
|
if (do_flip != 0) |
| 1903 |
|
{ |
| 1904 |
|
PCRE_PATTERN_TO_HOST_BYTE_ORDER(re, extra, NULL); |
| 1905 |
|
} |
| 1906 |
|
|
| 1907 |
|
/* Need to know if UTF-8 for printing data strings */ |
| 1908 |
|
|
| 1909 |
|
new_info(re, NULL, PCRE_INFO_OPTIONS, &get_options); |
| 1910 |
|
use_utf = (get_options & PCRE_UTF8) != 0; |
| 1911 |
|
|
| 1912 |
fclose(f); |
fclose(f); |
| 1913 |
goto SHOW_INFO; |
goto SHOW_INFO; |
| 1914 |
} |
} |
| 1915 |
|
|
| 1916 |
/* In-line pattern (the usual case). Get the delimiter and seek the end of |
/* In-line pattern (the usual case). Get the delimiter and seek the end of |
| 1917 |
the pattern; if is isn't complete, read more. */ |
the pattern; if it isn't complete, read more. */ |
| 1918 |
|
|
| 1919 |
delimiter = *p++; |
delimiter = *p++; |
| 1920 |
|
|
| 2272 |
extra->flags |= PCRE_EXTRA_MARK; |
extra->flags |= PCRE_EXTRA_MARK; |
| 2273 |
} |
} |
| 2274 |
|
|
|
/* If the 'F' option was present, we flip the bytes of all the integer |
|
|
fields in the regex data block and the study block. This is to make it |
|
|
possible to test PCRE's handling of byte-flipped patterns, e.g. those |
|
|
compiled on a different architecture. */ |
|
|
|
|
|
if (do_flip) |
|
|
{ |
|
|
real_pcre *rre = (real_pcre *)re; |
|
|
rre->magic_number = |
|
|
byteflip(rre->magic_number, sizeof(rre->magic_number)); |
|
|
rre->size = byteflip(rre->size, sizeof(rre->size)); |
|
|
rre->options = byteflip(rre->options, sizeof(rre->options)); |
|
|
rre->flags = (pcre_uint16)byteflip(rre->flags, sizeof(rre->flags)); |
|
|
rre->top_bracket = |
|
|
(pcre_uint16)byteflip(rre->top_bracket, sizeof(rre->top_bracket)); |
|
|
rre->top_backref = |
|
|
(pcre_uint16)byteflip(rre->top_backref, sizeof(rre->top_backref)); |
|
|
rre->first_char = |
|
|
(pcre_uint16)byteflip(rre->first_char, sizeof(rre->first_char)); |
|
|
rre->req_char = |
|
|
(pcre_uint16)byteflip(rre->req_char, sizeof(rre->req_char)); |
|
|
rre->name_table_offset = (pcre_uint16)byteflip(rre->name_table_offset, |
|
|
sizeof(rre->name_table_offset)); |
|
|
rre->name_entry_size = (pcre_uint16)byteflip(rre->name_entry_size, |
|
|
sizeof(rre->name_entry_size)); |
|
|
rre->name_count = (pcre_uint16)byteflip(rre->name_count, |
|
|
sizeof(rre->name_count)); |
|
|
|
|
|
if (extra != NULL) |
|
|
{ |
|
|
pcre_study_data *rsd = (pcre_study_data *)(extra->study_data); |
|
|
rsd->size = byteflip(rsd->size, sizeof(rsd->size)); |
|
|
rsd->flags = byteflip(rsd->flags, sizeof(rsd->flags)); |
|
|
rsd->minlength = byteflip(rsd->minlength, sizeof(rsd->minlength)); |
|
|
} |
|
|
} |
|
|
|
|
| 2275 |
/* Extract and display information from the compiled data if required. */ |
/* Extract and display information from the compiled data if required. */ |
| 2276 |
|
|
| 2277 |
SHOW_INFO: |
SHOW_INFO: |
| 2533 |
|
|
| 2534 |
if (to_file != NULL) |
if (to_file != NULL) |
| 2535 |
{ |
{ |
| 2536 |
|
/* If the 'F' option was present, we flip the bytes of all the integer |
| 2537 |
|
fields in the regex data block and the study block. This is to make it |
| 2538 |
|
possible to test PCRE's handling of byte-flipped patterns, e.g. those |
| 2539 |
|
compiled on a different architecture. */ |
| 2540 |
|
|
| 2541 |
|
if (do_flip) |
| 2542 |
|
{ |
| 2543 |
|
real_pcre *rre = (real_pcre *)re; |
| 2544 |
|
rre->magic_number = |
| 2545 |
|
byteflip(rre->magic_number, sizeof(rre->magic_number)); |
| 2546 |
|
rre->size = byteflip(rre->size, sizeof(rre->size)); |
| 2547 |
|
rre->options = byteflip(rre->options, sizeof(rre->options)); |
| 2548 |
|
rre->flags = (pcre_uint16)byteflip(rre->flags, sizeof(rre->flags)); |
| 2549 |
|
rre->top_bracket = |
| 2550 |
|
(pcre_uint16)byteflip(rre->top_bracket, sizeof(rre->top_bracket)); |
| 2551 |
|
rre->top_backref = |
| 2552 |
|
(pcre_uint16)byteflip(rre->top_backref, sizeof(rre->top_backref)); |
| 2553 |
|
rre->first_char = |
| 2554 |
|
(pcre_uint16)byteflip(rre->first_char, sizeof(rre->first_char)); |
| 2555 |
|
rre->req_char = |
| 2556 |
|
(pcre_uint16)byteflip(rre->req_char, sizeof(rre->req_char)); |
| 2557 |
|
rre->name_table_offset = (pcre_uint16)byteflip(rre->name_table_offset, |
| 2558 |
|
sizeof(rre->name_table_offset)); |
| 2559 |
|
rre->name_entry_size = (pcre_uint16)byteflip(rre->name_entry_size, |
| 2560 |
|
sizeof(rre->name_entry_size)); |
| 2561 |
|
rre->name_count = (pcre_uint16)byteflip(rre->name_count, |
| 2562 |
|
sizeof(rre->name_count)); |
| 2563 |
|
|
| 2564 |
|
if (extra != NULL) |
| 2565 |
|
{ |
| 2566 |
|
pcre_study_data *rsd = (pcre_study_data *)(extra->study_data); |
| 2567 |
|
rsd->size = byteflip(rsd->size, sizeof(rsd->size)); |
| 2568 |
|
rsd->flags = byteflip(rsd->flags, sizeof(rsd->flags)); |
| 2569 |
|
rsd->minlength = byteflip(rsd->minlength, sizeof(rsd->minlength)); |
| 2570 |
|
} |
| 2571 |
|
} |
| 2572 |
|
|
| 2573 |
FILE *f = fopen((char *)to_file, "wb"); |
FILE *f = fopen((char *)to_file, "wb"); |
| 2574 |
if (f == NULL) |
if (f == NULL) |
| 2575 |
{ |
{ |