| 67 |
#endif |
#endif |
| 68 |
|
|
| 69 |
|
|
| 70 |
#define PCRE_SPY /* For Win32 build, import data, not export */ |
/* We have to include pcre_internal.h because we need the internal info for |
| 71 |
|
displaying the results of pcre_study() and we also need to know about the |
| 72 |
/* We include pcre_internal.h because we need the internal info for displaying |
internal macros, structures, and other internal data values; pcretest has |
| 73 |
the results of pcre_study() and we also need to know about the internal |
"inside information" compared to a program that strictly follows the PCRE API. |
| 74 |
macros, structures, and other internal data values; pcretest has "inside |
|
| 75 |
information" compared to a program that strictly follows the PCRE API. */ |
Although pcre_internal.h does itself include pcre.h, we explicitly include it |
| 76 |
|
here before pcre_internal.h so that the PCRE_EXP_xxx macros get set |
| 77 |
|
appropriately for an application, not for building PCRE. */ |
| 78 |
|
|
| 79 |
|
#include "pcre.h" |
| 80 |
#include "pcre_internal.h" |
#include "pcre_internal.h" |
| 81 |
|
|
| 82 |
/* We need access to the data tables that PCRE uses. So as not to have to keep |
/* We need access to the data tables that PCRE uses. So as not to have to keep |
| 2223 |
advance of one character just passes the \r, whereas we should prefer the |
advance of one character just passes the \r, whereas we should prefer the |
| 2224 |
longer newline sequence, as does the code in pcre_exec(). Fudge the |
longer newline sequence, as does the code in pcre_exec(). Fudge the |
| 2225 |
offset value to achieve this. |
offset value to achieve this. |
| 2226 |
|
|
| 2227 |
Otherwise, in the case of UTF-8 matching, the advance must be one |
Otherwise, in the case of UTF-8 matching, the advance must be one |
| 2228 |
character, not one byte. */ |
character, not one byte. */ |
| 2229 |
|
|
| 2232 |
if (g_notempty != 0) |
if (g_notempty != 0) |
| 2233 |
{ |
{ |
| 2234 |
int onechar = 1; |
int onechar = 1; |
| 2235 |
|
unsigned int obits = ((real_pcre *)re)->options; |
| 2236 |
use_offsets[0] = start_offset; |
use_offsets[0] = start_offset; |
| 2237 |
if ((((real_pcre *)re)->options & PCRE_NEWLINE_BITS) == |
if ((obits & PCRE_NEWLINE_BITS) == 0) |
| 2238 |
PCRE_NEWLINE_ANY && |
{ |
| 2239 |
|
int d; |
| 2240 |
|
(void)pcre_config(PCRE_CONFIG_NEWLINE, &d); |
| 2241 |
|
obits = (d == '\r')? PCRE_NEWLINE_CR : |
| 2242 |
|
(d == '\n')? PCRE_NEWLINE_LF : |
| 2243 |
|
(d == ('\r'<<8 | '\n'))? PCRE_NEWLINE_CRLF : |
| 2244 |
|
(d == -1)? PCRE_NEWLINE_ANY : 0; |
| 2245 |
|
} |
| 2246 |
|
if ((obits & PCRE_NEWLINE_BITS) == PCRE_NEWLINE_ANY && |
| 2247 |
start_offset < len - 1 && |
start_offset < len - 1 && |
| 2248 |
bptr[start_offset] == '\r' && |
bptr[start_offset] == '\r' && |
| 2249 |
bptr[start_offset+1] == '\n') |
bptr[start_offset+1] == '\n') |
| 2250 |
onechar++; |
onechar++; |
| 2251 |
else if (use_utf8) |
else if (use_utf8) |
| 2252 |
{ |
{ |
| 2253 |
while (start_offset + onechar < len) |
while (start_offset + onechar < len) |