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. |
7 |
|
|
8 |
Written by Philip Hazel |
Written by Philip Hazel |
9 |
Copyright (c) 1997-2007 University of Cambridge |
Copyright (c) 1997-2009 University of Cambridge |
10 |
|
|
11 |
----------------------------------------------------------------------------- |
----------------------------------------------------------------------------- |
12 |
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
44 |
|
|
45 |
|
|
46 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
47 |
#include <config.h> |
#include "config.h" |
48 |
#endif |
#endif |
49 |
|
|
50 |
#include "pcre_internal.h" |
#include "pcre_internal.h" |
72 |
or negative values on error |
or negative values on error |
73 |
*/ |
*/ |
74 |
|
|
75 |
PCRE_EXP_DEFN int |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
76 |
pcre_info(const pcre *argument_re, int *optptr, int *first_byte) |
pcre_info(const pcre *argument_re, int *optptr, int *first_byte) |
77 |
{ |
{ |
78 |
real_pcre internal_re; |
real_pcre internal_re; |
80 |
if (re == NULL) return PCRE_ERROR_NULL; |
if (re == NULL) return PCRE_ERROR_NULL; |
81 |
if (re->magic_number != MAGIC_NUMBER) |
if (re->magic_number != MAGIC_NUMBER) |
82 |
{ |
{ |
83 |
re = _pcre_try_flipped(re, &internal_re, NULL, NULL); |
re = PRIV(try_flipped)(re, &internal_re, NULL, NULL); |
84 |
if (re == NULL) return PCRE_ERROR_BADMAGIC; |
if (re == NULL) return PCRE_ERROR_BADMAGIC; |
85 |
} |
} |
86 |
if (optptr != NULL) *optptr = (int)(re->options & PUBLIC_OPTIONS); |
if (optptr != NULL) *optptr = (int)(re->options & PUBLIC_COMPILE_OPTIONS); |
87 |
if (first_byte != NULL) |
if (first_byte != NULL) |
88 |
*first_byte = ((re->flags & PCRE_FIRSTSET) != 0)? re->first_byte : |
*first_byte = ((re->flags & PCRE_FIRSTSET) != 0)? re->first_char : |
89 |
((re->flags & PCRE_STARTLINE) != 0)? -1 : -2; |
((re->flags & PCRE_STARTLINE) != 0)? -1 : -2; |
90 |
return re->top_bracket; |
return re->top_bracket; |
91 |
} |
} |