1 From: Mark Baker <mark@mnb.org.uk>
2 Description: Restore obsolete pcre_info() API for compatiblity
4 Index: pcre-8.30/Makefile.am
5 ===================================================================
6 --- pcre-8.30.orig/Makefile.am 2012-03-23 22:33:00.000000000 +0000
7 +++ pcre-8.30/Makefile.am 2012-03-23 22:38:00.000000000 +0000
17 # nice DLL for Windows use". (It is used by the pcre.dll target.)
18 DLL_OBJS= pcre_byte_order.o pcre_compile.o pcre_config.o \
19 pcre_dfa_exec.o pcre_exec.o pcre_fullinfo.o pcre_get.o \
20 - pcre_globals.o pcre_jit_compile.o pcre_maketables.o \
21 + pcre_globals.o pcre_info.o pcre_jit_compile.o pcre_maketables.o \
22 pcre_newline.o pcre_ord2utf8.o pcre_refcount.o \
23 pcre_study.o pcre_tables.o pcre_ucd.o \
24 pcre_valid_utf8.o pcre_version.o pcre_chartables.o \
25 Index: pcre-8.30/Makefile.in
26 ===================================================================
27 --- pcre-8.30.orig/Makefile.in 2012-03-23 22:33:00.000000000 +0000
28 +++ pcre-8.30/Makefile.in 2012-03-23 22:38:00.000000000 +0000
31 am__libpcre_la_SOURCES_DIST = pcre_byte_order.c pcre_compile.c \
32 pcre_config.c pcre_dfa_exec.c pcre_exec.c pcre_fullinfo.c \
33 - pcre_get.c pcre_globals.c pcre_internal.h pcre_jit_compile.c \
34 + pcre_get.c pcre_globals.c pcre_info.c pcre_internal.h pcre_jit_compile.c \
35 pcre_maketables.c pcre_newline.c pcre_ord2utf8.c \
36 pcre_refcount.c pcre_string_utils.c pcre_study.c pcre_tables.c \
37 pcre_ucd.c pcre_valid_utf8.c pcre_version.c pcre_xclass.c \
39 @WITH_PCRE8_TRUE@ pcre_compile.lo pcre_config.lo \
40 @WITH_PCRE8_TRUE@ pcre_dfa_exec.lo pcre_exec.lo \
41 @WITH_PCRE8_TRUE@ pcre_fullinfo.lo pcre_get.lo pcre_globals.lo \
42 +@WITH_PCRE8_TRUE@ pcre_info.lo \
43 @WITH_PCRE8_TRUE@ pcre_jit_compile.lo pcre_maketables.lo \
44 @WITH_PCRE8_TRUE@ pcre_newline.lo pcre_ord2utf8.lo \
45 @WITH_PCRE8_TRUE@ pcre_refcount.lo pcre_string_utils.lo \
47 @WITH_PCRE8_TRUE@ pcre_fullinfo.c \
48 @WITH_PCRE8_TRUE@ pcre_get.c \
49 @WITH_PCRE8_TRUE@ pcre_globals.c \
50 +@WITH_PCRE8_TRUE@ pcre_info.c \
51 @WITH_PCRE8_TRUE@ pcre_internal.h \
52 @WITH_PCRE8_TRUE@ pcre_jit_compile.c \
53 @WITH_PCRE8_TRUE@ pcre_maketables.c \
55 # nice DLL for Windows use". (It is used by the pcre.dll target.)
56 DLL_OBJS = pcre_byte_order.o pcre_compile.o pcre_config.o \
57 pcre_dfa_exec.o pcre_exec.o pcre_fullinfo.o pcre_get.o \
58 - pcre_globals.o pcre_jit_compile.o pcre_maketables.o \
59 + pcre_globals.o pcre_info.o pcre_jit_compile.o pcre_maketables.o \
60 pcre_newline.o pcre_ord2utf8.o pcre_refcount.o \
61 pcre_study.o pcre_tables.o pcre_ucd.o \
62 pcre_valid_utf8.o pcre_version.o pcre_chartables.o \
64 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcre_fullinfo.Plo@am__quote@
65 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcre_get.Plo@am__quote@
66 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcre_globals.Plo@am__quote@
67 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcre_info.Plo@am__quote@
68 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcre_jit_compile.Plo@am__quote@
69 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcre_jit_test.Po@am__quote@
70 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcre_maketables.Plo@am__quote@
71 Index: pcre-8.30/pcre_info.c
72 ===================================================================
73 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
74 +++ pcre-8.30/pcre_info.c 2012-03-23 23:54:06.000000000 +0000
76 +/*************************************************
77 +* Perl-Compatible Regular Expressions *
78 +*************************************************/
80 +/* PCRE is a library of functions to support regular expressions whose syntax
81 +and semantics are as close as possible to those of the Perl 5 language.
83 + Written by Philip Hazel
84 + Copyright (c) 1997-2009 University of Cambridge
86 +-----------------------------------------------------------------------------
87 +Redistribution and use in source and binary forms, with or without
88 +modification, are permitted provided that the following conditions are met:
90 + * Redistributions of source code must retain the above copyright notice,
91 + this list of conditions and the following disclaimer.
93 + * Redistributions in binary form must reproduce the above copyright
94 + notice, this list of conditions and the following disclaimer in the
95 + documentation and/or other materials provided with the distribution.
97 + * Neither the name of the University of Cambridge nor the names of its
98 + contributors may be used to endorse or promote products derived from
99 + this software without specific prior written permission.
101 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
102 +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
103 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
104 +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
105 +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
106 +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
107 +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
108 +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
109 +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
110 +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
111 +POSSIBILITY OF SUCH DAMAGE.
112 +-----------------------------------------------------------------------------
116 +/* This module contains the external function pcre_info(), which gives some
117 +information about a compiled pattern. However, use of this function is now
118 +deprecated, as it has been superseded by pcre_fullinfo(). */
121 +#ifdef HAVE_CONFIG_H
125 +#include "pcre_internal.h"
128 +/*************************************************
129 +* (Obsolete) Return info about compiled pattern *
130 +*************************************************/
132 +/* This is the original "info" function. It picks potentially useful data out
133 +of the private structure, but its interface was too rigid. It remains for
134 +backwards compatibility. The public options are passed back in an int - though
135 +the re->options field has been expanded to a long int, all the public options
136 +at the low end of it, and so even on 16-bit systems this will still be OK.
137 +Therefore, I haven't changed the API for pcre_info().
140 + argument_re points to compiled code
141 + optptr where to pass back the options
142 + first_byte where to pass back the first character,
143 + or -1 if multiline and all branches start ^,
146 +Returns: number of capturing subpatterns
147 + or negative values on error
150 +PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
151 +pcre_info(const pcre *argument_re, int *optptr, int *first_byte)
153 +const real_pcre *re = (const real_pcre *)argument_re;
154 +if (re == NULL) return PCRE_ERROR_NULL;
155 +if (re->magic_number != MAGIC_NUMBER)
156 + return PCRE_ERROR_BADMAGIC;
158 +if (optptr != NULL) *optptr = (int)(re->options & PUBLIC_COMPILE_OPTIONS);
159 +if (first_byte != NULL)
160 + *first_byte = ((re->flags & PCRE_FIRSTSET) != 0)? re->first_char :
161 + ((re->flags & PCRE_STARTLINE) != 0)? -1 : -2;
162 +return re->top_bracket;
165 +/* End of pcre_info.c */