version 1.1.1.1, 2012/02/21 23:05:51
|
version 1.1.1.2, 2012/02/21 23:50:25
|
Line 6
|
Line 6
|
and semantics are as close as possible to those of the Perl 5 language. |
and semantics are as close as possible to those of the Perl 5 language. |
|
|
Written by Philip Hazel |
Written by Philip Hazel |
Copyright (c) 1997-2011 University of Cambridge | Copyright (c) 1997-2012 University of Cambridge |
|
|
----------------------------------------------------------------------------- |
----------------------------------------------------------------------------- |
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
Line 65 Arguments:
|
Line 65 Arguments:
|
Returns: 0 if data returned, negative on error |
Returns: 0 if data returned, negative on error |
*/ |
*/ |
|
|
|
#ifdef COMPILE_PCRE8 |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
pcre_fullinfo(const pcre *argument_re, const pcre_extra *extra_data, int what, | pcre_fullinfo(const pcre *argument_re, const pcre_extra *extra_data, |
void *where) | int what, void *where) |
| #else |
| PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
| pcre16_fullinfo(const pcre16 *argument_re, const pcre16_extra *extra_data, |
| int what, void *where) |
| #endif |
{ |
{ |
real_pcre internal_re; | const REAL_PCRE *re = (const REAL_PCRE *)argument_re; |
pcre_study_data internal_study; | |
const real_pcre *re = (const real_pcre *)argument_re; | |
const pcre_study_data *study = NULL; |
const pcre_study_data *study = NULL; |
|
|
if (re == NULL || where == NULL) return PCRE_ERROR_NULL; |
if (re == NULL || where == NULL) return PCRE_ERROR_NULL; |
Line 79 if (re == NULL || where == NULL) return PCRE_ERROR_NUL
|
Line 83 if (re == NULL || where == NULL) return PCRE_ERROR_NUL
|
if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_STUDY_DATA) != 0) |
if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_STUDY_DATA) != 0) |
study = (const pcre_study_data *)extra_data->study_data; |
study = (const pcre_study_data *)extra_data->study_data; |
|
|
|
/* Check that the first field in the block is the magic number. If it is not, |
|
return with PCRE_ERROR_BADMAGIC. However, if the magic number is equal to |
|
REVERSED_MAGIC_NUMBER we return with PCRE_ERROR_BADENDIANNESS, which |
|
means that the pattern is likely compiled with different endianness. */ |
|
|
if (re->magic_number != MAGIC_NUMBER) |
if (re->magic_number != MAGIC_NUMBER) |
{ | return re->magic_number == REVERSED_MAGIC_NUMBER? |
re = _pcre_try_flipped(re, &internal_re, study, &internal_study); | PCRE_ERROR_BADENDIANNESS:PCRE_ERROR_BADMAGIC; |
if (re == NULL) return PCRE_ERROR_BADMAGIC; | |
if (study != NULL) study = &internal_study; | |
} | |
|
|
|
/* Check that this pattern was compiled in the correct bit mode */ |
|
|
|
if ((re->flags & PCRE_MODE) == 0) return PCRE_ERROR_BADMODE; |
|
|
switch (what) |
switch (what) |
{ |
{ |
case PCRE_INFO_OPTIONS: |
case PCRE_INFO_OPTIONS: |
Line 106 switch (what)
|
Line 116 switch (what)
|
(extra_data != NULL && |
(extra_data != NULL && |
(extra_data->flags & PCRE_EXTRA_EXECUTABLE_JIT) != 0 && |
(extra_data->flags & PCRE_EXTRA_EXECUTABLE_JIT) != 0 && |
extra_data->executable_jit != NULL)? |
extra_data->executable_jit != NULL)? |
_pcre_jit_get_size(extra_data->executable_jit) : 0; | PRIV(jit_get_size)(extra_data->executable_jit) : 0; |
#else |
#else |
*((size_t *)where) = 0; |
*((size_t *)where) = 0; |
#endif |
#endif |
|
|
break; |
break; |
|
|
case PCRE_INFO_CAPTURECOUNT: |
case PCRE_INFO_CAPTURECOUNT: |
Line 123 switch (what)
|
Line 132 switch (what)
|
|
|
case PCRE_INFO_FIRSTBYTE: |
case PCRE_INFO_FIRSTBYTE: |
*((int *)where) = |
*((int *)where) = |
((re->flags & PCRE_FIRSTSET) != 0)? re->first_byte : | ((re->flags & PCRE_FIRSTSET) != 0)? re->first_char : |
((re->flags & PCRE_STARTLINE) != 0)? -1 : -2; |
((re->flags & PCRE_STARTLINE) != 0)? -1 : -2; |
break; |
break; |
|
|
Line 131 switch (what)
|
Line 140 switch (what)
|
block, not the internal copy (with flipped integer fields). */ |
block, not the internal copy (with flipped integer fields). */ |
|
|
case PCRE_INFO_FIRSTTABLE: |
case PCRE_INFO_FIRSTTABLE: |
*((const uschar **)where) = | *((const pcre_uint8 **)where) = |
(study != NULL && (study->flags & PCRE_STUDY_MAPPED) != 0)? |
(study != NULL && (study->flags & PCRE_STUDY_MAPPED) != 0)? |
((const pcre_study_data *)extra_data->study_data)->start_bits : NULL; |
((const pcre_study_data *)extra_data->study_data)->start_bits : NULL; |
break; |
break; |
Line 139 switch (what)
|
Line 148 switch (what)
|
case PCRE_INFO_MINLENGTH: |
case PCRE_INFO_MINLENGTH: |
*((int *)where) = |
*((int *)where) = |
(study != NULL && (study->flags & PCRE_STUDY_MINLEN) != 0)? |
(study != NULL && (study->flags & PCRE_STUDY_MINLEN) != 0)? |
study->minlength : -1; | (int)(study->minlength) : -1; |
break; |
break; |
|
|
case PCRE_INFO_JIT: |
case PCRE_INFO_JIT: |
Line 150 switch (what)
|
Line 159 switch (what)
|
|
|
case PCRE_INFO_LASTLITERAL: |
case PCRE_INFO_LASTLITERAL: |
*((int *)where) = |
*((int *)where) = |
((re->flags & PCRE_REQCHSET) != 0)? re->req_byte : -1; | ((re->flags & PCRE_REQCHSET) != 0)? re->req_char : -1; |
break; |
break; |
|
|
case PCRE_INFO_NAMEENTRYSIZE: |
case PCRE_INFO_NAMEENTRYSIZE: |
Line 162 switch (what)
|
Line 171 switch (what)
|
break; |
break; |
|
|
case PCRE_INFO_NAMETABLE: |
case PCRE_INFO_NAMETABLE: |
*((const uschar **)where) = (const uschar *)re + re->name_table_offset; | *((const pcre_uchar **)where) = (const pcre_uchar *)re + re->name_table_offset; |
break; |
break; |
|
|
case PCRE_INFO_DEFAULT_TABLES: |
case PCRE_INFO_DEFAULT_TABLES: |
*((const uschar **)where) = (const uschar *)(_pcre_default_tables); | *((const pcre_uint8 **)where) = (const pcre_uint8 *)(PRIV(default_tables)); |
break; |
break; |
|
|
/* From release 8.00 this will always return TRUE because NOPARTIAL is |
/* From release 8.00 this will always return TRUE because NOPARTIAL is |