version 1.1.1.2, 2012/02/21 23:50:25
|
version 1.1.1.3, 2013/07/22 08:25:55
|
Line 65 Returns: the number of the named parentheses, or
|
Line 65 Returns: the number of the named parentheses, or
|
(PCRE_ERROR_NOSUBSTRING) if not found |
(PCRE_ERROR_NOSUBSTRING) if not found |
*/ |
*/ |
|
|
#ifdef COMPILE_PCRE8 | #if defined COMPILE_PCRE8 |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
pcre_get_stringnumber(const pcre *code, const char *stringname) |
pcre_get_stringnumber(const pcre *code, const char *stringname) |
#else | #elif defined COMPILE_PCRE16 |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
pcre16_get_stringnumber(const pcre16 *code, PCRE_SPTR16 stringname) |
pcre16_get_stringnumber(const pcre16 *code, PCRE_SPTR16 stringname) |
|
#elif defined COMPILE_PCRE32 |
|
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
|
pcre32_get_stringnumber(const pcre32 *code, PCRE_SPTR32 stringname) |
#endif |
#endif |
{ |
{ |
int rc; |
int rc; |
Line 98 if ((rc = pcre16_fullinfo(code, NULL, PCRE_INFO_NAMEEN
|
Line 101 if ((rc = pcre16_fullinfo(code, NULL, PCRE_INFO_NAMEEN
|
if ((rc = pcre16_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0) |
if ((rc = pcre16_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0) |
return rc; |
return rc; |
#endif |
#endif |
|
#ifdef COMPILE_PCRE32 |
|
if ((rc = pcre32_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0) |
|
return rc; |
|
if (top <= 0) return PCRE_ERROR_NOSUBSTRING; |
|
|
|
if ((rc = pcre32_fullinfo(code, NULL, PCRE_INFO_NAMEENTRYSIZE, &entrysize)) != 0) |
|
return rc; |
|
if ((rc = pcre32_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0) |
|
return rc; |
|
#endif |
|
|
bot = 0; |
bot = 0; |
while (top > bot) |
while (top > bot) |
{ |
{ |
Line 132 Returns: the length of each entry, or a negative
|
Line 145 Returns: the length of each entry, or a negative
|
(PCRE_ERROR_NOSUBSTRING) if not found |
(PCRE_ERROR_NOSUBSTRING) if not found |
*/ |
*/ |
|
|
#ifdef COMPILE_PCRE8 | #if defined COMPILE_PCRE8 |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
pcre_get_stringtable_entries(const pcre *code, const char *stringname, |
pcre_get_stringtable_entries(const pcre *code, const char *stringname, |
char **firstptr, char **lastptr) |
char **firstptr, char **lastptr) |
#else | #elif defined COMPILE_PCRE16 |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
pcre16_get_stringtable_entries(const pcre16 *code, PCRE_SPTR16 stringname, |
pcre16_get_stringtable_entries(const pcre16 *code, PCRE_SPTR16 stringname, |
PCRE_UCHAR16 **firstptr, PCRE_UCHAR16 **lastptr) |
PCRE_UCHAR16 **firstptr, PCRE_UCHAR16 **lastptr) |
|
#elif defined COMPILE_PCRE32 |
|
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
|
pcre32_get_stringtable_entries(const pcre32 *code, PCRE_SPTR32 stringname, |
|
PCRE_UCHAR32 **firstptr, PCRE_UCHAR32 **lastptr) |
#endif |
#endif |
{ |
{ |
int rc; |
int rc; |
Line 167 if ((rc = pcre16_fullinfo(code, NULL, PCRE_INFO_NAMEEN
|
Line 184 if ((rc = pcre16_fullinfo(code, NULL, PCRE_INFO_NAMEEN
|
if ((rc = pcre16_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0) |
if ((rc = pcre16_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0) |
return rc; |
return rc; |
#endif |
#endif |
|
#ifdef COMPILE_PCRE32 |
|
if ((rc = pcre32_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0) |
|
return rc; |
|
if (top <= 0) return PCRE_ERROR_NOSUBSTRING; |
|
|
|
if ((rc = pcre32_fullinfo(code, NULL, PCRE_INFO_NAMEENTRYSIZE, &entrysize)) != 0) |
|
return rc; |
|
if ((rc = pcre32_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0) |
|
return rc; |
|
#endif |
|
|
lastentry = nametable + entrysize * (top - 1); |
lastentry = nametable + entrysize * (top - 1); |
bot = 0; |
bot = 0; |
while (top > bot) |
while (top > bot) |
Line 192 while (top > bot)
|
Line 219 while (top > bot)
|
(pcre_uchar *)(last + entrysize + IMM2_SIZE)) != 0) break; |
(pcre_uchar *)(last + entrysize + IMM2_SIZE)) != 0) break; |
last += entrysize; |
last += entrysize; |
} |
} |
#ifdef COMPILE_PCRE8 | #if defined COMPILE_PCRE8 |
*firstptr = (char *)first; |
*firstptr = (char *)first; |
*lastptr = (char *)last; |
*lastptr = (char *)last; |
#else | #elif defined COMPILE_PCRE16 |
*firstptr = (PCRE_UCHAR16 *)first; |
*firstptr = (PCRE_UCHAR16 *)first; |
*lastptr = (PCRE_UCHAR16 *)last; |
*lastptr = (PCRE_UCHAR16 *)last; |
|
#elif defined COMPILE_PCRE32 |
|
*firstptr = (PCRE_UCHAR32 *)first; |
|
*lastptr = (PCRE_UCHAR32 *)last; |
#endif |
#endif |
return entrysize; |
return entrysize; |
} |
} |
Line 226 Returns: the number of the first that is set,
|
Line 256 Returns: the number of the first that is set,
|
or a negative number on error |
or a negative number on error |
*/ |
*/ |
|
|
#ifdef COMPILE_PCRE8 | #if defined COMPILE_PCRE8 |
static int |
static int |
get_first_set(const pcre *code, const char *stringname, int *ovector) |
get_first_set(const pcre *code, const char *stringname, int *ovector) |
#else | #elif defined COMPILE_PCRE16 |
static int |
static int |
get_first_set(const pcre16 *code, PCRE_SPTR16 stringname, int *ovector) |
get_first_set(const pcre16 *code, PCRE_SPTR16 stringname, int *ovector) |
|
#elif defined COMPILE_PCRE32 |
|
static int |
|
get_first_set(const pcre32 *code, PCRE_SPTR32 stringname, int *ovector) |
#endif |
#endif |
{ |
{ |
const REAL_PCRE *re = (const REAL_PCRE *)code; |
const REAL_PCRE *re = (const REAL_PCRE *)code; |
int entrysize; |
int entrysize; |
pcre_uchar *entry; |
pcre_uchar *entry; |
#ifdef COMPILE_PCRE8 | #if defined COMPILE_PCRE8 |
char *first, *last; |
char *first, *last; |
#else | #elif defined COMPILE_PCRE16 |
PCRE_UCHAR16 *first, *last; |
PCRE_UCHAR16 *first, *last; |
|
#elif defined COMPILE_PCRE32 |
|
PCRE_UCHAR32 *first, *last; |
#endif |
#endif |
|
|
#ifdef COMPILE_PCRE8 | #if defined COMPILE_PCRE8 |
if ((re->options & PCRE_DUPNAMES) == 0 && (re->flags & PCRE_JCHANGED) == 0) |
if ((re->options & PCRE_DUPNAMES) == 0 && (re->flags & PCRE_JCHANGED) == 0) |
return pcre_get_stringnumber(code, stringname); |
return pcre_get_stringnumber(code, stringname); |
entrysize = pcre_get_stringtable_entries(code, stringname, &first, &last); |
entrysize = pcre_get_stringtable_entries(code, stringname, &first, &last); |
#else | #elif defined COMPILE_PCRE16 |
if ((re->options & PCRE_DUPNAMES) == 0 && (re->flags & PCRE_JCHANGED) == 0) |
if ((re->options & PCRE_DUPNAMES) == 0 && (re->flags & PCRE_JCHANGED) == 0) |
return pcre16_get_stringnumber(code, stringname); |
return pcre16_get_stringnumber(code, stringname); |
entrysize = pcre16_get_stringtable_entries(code, stringname, &first, &last); |
entrysize = pcre16_get_stringtable_entries(code, stringname, &first, &last); |
|
#elif defined COMPILE_PCRE32 |
|
if ((re->options & PCRE_DUPNAMES) == 0 && (re->flags & PCRE_JCHANGED) == 0) |
|
return pcre32_get_stringnumber(code, stringname); |
|
entrysize = pcre32_get_stringtable_entries(code, stringname, &first, &last); |
#endif |
#endif |
if (entrysize <= 0) return entrysize; |
if (entrysize <= 0) return entrysize; |
for (entry = (pcre_uchar *)first; entry <= (pcre_uchar *)last; entry += entrysize) |
for (entry = (pcre_uchar *)first; entry <= (pcre_uchar *)last; entry += entrysize) |
Line 291 Returns: if successful:
|
Line 330 Returns: if successful:
|
PCRE_ERROR_NOSUBSTRING (-7) no such captured substring |
PCRE_ERROR_NOSUBSTRING (-7) no such captured substring |
*/ |
*/ |
|
|
#ifdef COMPILE_PCRE8 | #if defined COMPILE_PCRE8 |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
pcre_copy_substring(const char *subject, int *ovector, int stringcount, |
pcre_copy_substring(const char *subject, int *ovector, int stringcount, |
int stringnumber, char *buffer, int size) |
int stringnumber, char *buffer, int size) |
#else | #elif defined COMPILE_PCRE16 |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
pcre16_copy_substring(PCRE_SPTR16 subject, int *ovector, int stringcount, |
pcre16_copy_substring(PCRE_SPTR16 subject, int *ovector, int stringcount, |
int stringnumber, PCRE_UCHAR16 *buffer, int size) |
int stringnumber, PCRE_UCHAR16 *buffer, int size) |
|
#elif defined COMPILE_PCRE32 |
|
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
|
pcre32_copy_substring(PCRE_SPTR32 subject, int *ovector, int stringcount, |
|
int stringnumber, PCRE_UCHAR32 *buffer, int size) |
#endif |
#endif |
{ |
{ |
int yield; |
int yield; |
Line 342 Returns: if successful:
|
Line 385 Returns: if successful:
|
PCRE_ERROR_NOSUBSTRING (-7) no such captured substring |
PCRE_ERROR_NOSUBSTRING (-7) no such captured substring |
*/ |
*/ |
|
|
#ifdef COMPILE_PCRE8 | #if defined COMPILE_PCRE8 |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
pcre_copy_named_substring(const pcre *code, const char *subject, |
pcre_copy_named_substring(const pcre *code, const char *subject, |
int *ovector, int stringcount, const char *stringname, |
int *ovector, int stringcount, const char *stringname, |
char *buffer, int size) |
char *buffer, int size) |
#else | #elif defined COMPILE_PCRE16 |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
pcre16_copy_named_substring(const pcre16 *code, PCRE_SPTR16 subject, |
pcre16_copy_named_substring(const pcre16 *code, PCRE_SPTR16 subject, |
int *ovector, int stringcount, PCRE_SPTR16 stringname, |
int *ovector, int stringcount, PCRE_SPTR16 stringname, |
PCRE_UCHAR16 *buffer, int size) |
PCRE_UCHAR16 *buffer, int size) |
|
#elif defined COMPILE_PCRE32 |
|
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
|
pcre32_copy_named_substring(const pcre32 *code, PCRE_SPTR32 subject, |
|
int *ovector, int stringcount, PCRE_SPTR32 stringname, |
|
PCRE_UCHAR32 *buffer, int size) |
#endif |
#endif |
{ |
{ |
int n = get_first_set(code, stringname, ovector); |
int n = get_first_set(code, stringname, ovector); |
if (n <= 0) return n; |
if (n <= 0) return n; |
#ifdef COMPILE_PCRE8 | #if defined COMPILE_PCRE8 |
return pcre_copy_substring(subject, ovector, stringcount, n, buffer, size); |
return pcre_copy_substring(subject, ovector, stringcount, n, buffer, size); |
#else | #elif defined COMPILE_PCRE16 |
return pcre16_copy_substring(subject, ovector, stringcount, n, buffer, size); |
return pcre16_copy_substring(subject, ovector, stringcount, n, buffer, size); |
|
#elif defined COMPILE_PCRE32 |
|
return pcre32_copy_substring(subject, ovector, stringcount, n, buffer, size); |
#endif |
#endif |
} |
} |
|
|
Line 386 Returns: if successful: 0
|
Line 436 Returns: if successful: 0
|
PCRE_ERROR_NOMEMORY (-6) failed to get store |
PCRE_ERROR_NOMEMORY (-6) failed to get store |
*/ |
*/ |
|
|
#ifdef COMPILE_PCRE8 | #if defined COMPILE_PCRE8 |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
pcre_get_substring_list(const char *subject, int *ovector, int stringcount, |
pcre_get_substring_list(const char *subject, int *ovector, int stringcount, |
const char ***listptr) |
const char ***listptr) |
#else | #elif defined COMPILE_PCRE16 |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
pcre16_get_substring_list(PCRE_SPTR16 subject, int *ovector, int stringcount, |
pcre16_get_substring_list(PCRE_SPTR16 subject, int *ovector, int stringcount, |
PCRE_SPTR16 **listptr) |
PCRE_SPTR16 **listptr) |
|
#elif defined COMPILE_PCRE32 |
|
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
|
pcre32_get_substring_list(PCRE_SPTR32 subject, int *ovector, int stringcount, |
|
PCRE_SPTR32 **listptr) |
#endif |
#endif |
{ |
{ |
int i; |
int i; |
Line 408 for (i = 0; i < double_count; i += 2)
|
Line 462 for (i = 0; i < double_count; i += 2)
|
stringlist = (pcre_uchar **)(PUBL(malloc))(size); |
stringlist = (pcre_uchar **)(PUBL(malloc))(size); |
if (stringlist == NULL) return PCRE_ERROR_NOMEMORY; |
if (stringlist == NULL) return PCRE_ERROR_NOMEMORY; |
|
|
#ifdef COMPILE_PCRE8 | #if defined COMPILE_PCRE8 |
*listptr = (const char **)stringlist; |
*listptr = (const char **)stringlist; |
#else | #elif defined COMPILE_PCRE16 |
*listptr = (PCRE_SPTR16 *)stringlist; |
*listptr = (PCRE_SPTR16 *)stringlist; |
|
#elif defined COMPILE_PCRE32 |
|
*listptr = (PCRE_SPTR32 *)stringlist; |
#endif |
#endif |
p = (pcre_uchar *)(stringlist + stringcount + 1); |
p = (pcre_uchar *)(stringlist + stringcount + 1); |
|
|
Line 442 Argument: the result of a previous pcre_get_substrin
|
Line 498 Argument: the result of a previous pcre_get_substrin
|
Returns: nothing |
Returns: nothing |
*/ |
*/ |
|
|
#ifdef COMPILE_PCRE8 | #if defined COMPILE_PCRE8 |
PCRE_EXP_DEFN void PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN void PCRE_CALL_CONVENTION |
pcre_free_substring_list(const char **pointer) |
pcre_free_substring_list(const char **pointer) |
#else | #elif defined COMPILE_PCRE16 |
PCRE_EXP_DEFN void PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN void PCRE_CALL_CONVENTION |
pcre16_free_substring_list(PCRE_SPTR16 *pointer) |
pcre16_free_substring_list(PCRE_SPTR16 *pointer) |
|
#elif defined COMPILE_PCRE32 |
|
PCRE_EXP_DEFN void PCRE_CALL_CONVENTION |
|
pcre32_free_substring_list(PCRE_SPTR32 *pointer) |
#endif |
#endif |
{ |
{ |
(PUBL(free))((void *)pointer); |
(PUBL(free))((void *)pointer); |
Line 480 Returns: if successful:
|
Line 539 Returns: if successful:
|
PCRE_ERROR_NOSUBSTRING (-7) substring not present |
PCRE_ERROR_NOSUBSTRING (-7) substring not present |
*/ |
*/ |
|
|
#ifdef COMPILE_PCRE8 | #if defined COMPILE_PCRE8 |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
pcre_get_substring(const char *subject, int *ovector, int stringcount, |
pcre_get_substring(const char *subject, int *ovector, int stringcount, |
int stringnumber, const char **stringptr) |
int stringnumber, const char **stringptr) |
#else | #elif defined COMPILE_PCRE16 |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
pcre16_get_substring(PCRE_SPTR16 subject, int *ovector, int stringcount, |
pcre16_get_substring(PCRE_SPTR16 subject, int *ovector, int stringcount, |
int stringnumber, PCRE_SPTR16 *stringptr) |
int stringnumber, PCRE_SPTR16 *stringptr) |
|
#elif defined COMPILE_PCRE32 |
|
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
|
pcre32_get_substring(PCRE_SPTR32 subject, int *ovector, int stringcount, |
|
int stringnumber, PCRE_SPTR32 *stringptr) |
#endif |
#endif |
{ |
{ |
int yield; |
int yield; |
Line 500 substring = (pcre_uchar *)(PUBL(malloc))(IN_UCHARS(yie
|
Line 563 substring = (pcre_uchar *)(PUBL(malloc))(IN_UCHARS(yie
|
if (substring == NULL) return PCRE_ERROR_NOMEMORY; |
if (substring == NULL) return PCRE_ERROR_NOMEMORY; |
memcpy(substring, subject + ovector[stringnumber], IN_UCHARS(yield)); |
memcpy(substring, subject + ovector[stringnumber], IN_UCHARS(yield)); |
substring[yield] = 0; |
substring[yield] = 0; |
#ifdef COMPILE_PCRE8 | #if defined COMPILE_PCRE8 |
*stringptr = (const char *)substring; |
*stringptr = (const char *)substring; |
#else | #elif defined COMPILE_PCRE16 |
*stringptr = (PCRE_SPTR16)substring; |
*stringptr = (PCRE_SPTR16)substring; |
|
#elif defined COMPILE_PCRE32 |
|
*stringptr = (PCRE_SPTR32)substring; |
#endif |
#endif |
return yield; |
return yield; |
} |
} |
Line 537 Returns: if successful:
|
Line 602 Returns: if successful:
|
PCRE_ERROR_NOSUBSTRING (-7) no such captured substring |
PCRE_ERROR_NOSUBSTRING (-7) no such captured substring |
*/ |
*/ |
|
|
#ifdef COMPILE_PCRE8 | #if defined COMPILE_PCRE8 |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
pcre_get_named_substring(const pcre *code, const char *subject, |
pcre_get_named_substring(const pcre *code, const char *subject, |
int *ovector, int stringcount, const char *stringname, |
int *ovector, int stringcount, const char *stringname, |
const char **stringptr) |
const char **stringptr) |
#else | #elif defined COMPILE_PCRE16 |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
pcre16_get_named_substring(const pcre16 *code, PCRE_SPTR16 subject, |
pcre16_get_named_substring(const pcre16 *code, PCRE_SPTR16 subject, |
int *ovector, int stringcount, PCRE_SPTR16 stringname, |
int *ovector, int stringcount, PCRE_SPTR16 stringname, |
PCRE_SPTR16 *stringptr) |
PCRE_SPTR16 *stringptr) |
|
#elif defined COMPILE_PCRE32 |
|
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
|
pcre32_get_named_substring(const pcre32 *code, PCRE_SPTR32 subject, |
|
int *ovector, int stringcount, PCRE_SPTR32 stringname, |
|
PCRE_SPTR32 *stringptr) |
#endif |
#endif |
{ |
{ |
int n = get_first_set(code, stringname, ovector); |
int n = get_first_set(code, stringname, ovector); |
if (n <= 0) return n; |
if (n <= 0) return n; |
#ifdef COMPILE_PCRE8 | #if defined COMPILE_PCRE8 |
return pcre_get_substring(subject, ovector, stringcount, n, stringptr); |
return pcre_get_substring(subject, ovector, stringcount, n, stringptr); |
#else | #elif defined COMPILE_PCRE16 |
return pcre16_get_substring(subject, ovector, stringcount, n, stringptr); |
return pcre16_get_substring(subject, ovector, stringcount, n, stringptr); |
|
#elif defined COMPILE_PCRE32 |
|
return pcre32_get_substring(subject, ovector, stringcount, n, stringptr); |
#endif |
#endif |
} |
} |
|
|
Line 573 Argument: the result of a previous pcre_get_substrin
|
Line 645 Argument: the result of a previous pcre_get_substrin
|
Returns: nothing |
Returns: nothing |
*/ |
*/ |
|
|
#ifdef COMPILE_PCRE8 | #if defined COMPILE_PCRE8 |
PCRE_EXP_DEFN void PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN void PCRE_CALL_CONVENTION |
pcre_free_substring(const char *pointer) |
pcre_free_substring(const char *pointer) |
#else | #elif defined COMPILE_PCRE16 |
PCRE_EXP_DEFN void PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN void PCRE_CALL_CONVENTION |
pcre16_free_substring(PCRE_SPTR16 pointer) |
pcre16_free_substring(PCRE_SPTR16 pointer) |
|
#elif defined COMPILE_PCRE32 |
|
PCRE_EXP_DEFN void PCRE_CALL_CONVENTION |
|
pcre32_free_substring(PCRE_SPTR32 pointer) |
#endif |
#endif |
{ |
{ |
(PUBL(free))((void *)pointer); |
(PUBL(free))((void *)pointer); |