mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-10-31 00:12:19 +01:00 
			
		
		
		
	Drop some unused PCRE sources
There is no point in compiling these, since we are not calling any of the functions in them.
This commit is contained in:
		| @@ -44,15 +44,12 @@ libpcre_la_SOURCES = \ | |||||||
| 	pcre_get.c \ | 	pcre_get.c \ | ||||||
| 	pcre_globals.c \ | 	pcre_globals.c \ | ||||||
| 	pcre_jit_compile.c \ | 	pcre_jit_compile.c \ | ||||||
| 	pcre_maketables.c \ |  | ||||||
| 	pcre_newline.c \ | 	pcre_newline.c \ | ||||||
| 	pcre_ord2utf8.c \ | 	pcre_ord2utf8.c \ | ||||||
| 	pcre_refcount.c \ |  | ||||||
| 	pcre_string_utils.c \ | 	pcre_string_utils.c \ | ||||||
| 	pcre_study.c \ | 	pcre_study.c \ | ||||||
| 	pcre_tables.c \ | 	pcre_tables.c \ | ||||||
| 	pcre_valid_utf8.c \ | 	pcre_valid_utf8.c \ | ||||||
| 	pcre_version.c \ |  | ||||||
| 	pcre_xclass.c \ | 	pcre_xclass.c \ | ||||||
| 	pcre.h \ | 	pcre.h \ | ||||||
| 	pcre_internal.h \ | 	pcre_internal.h \ | ||||||
|   | |||||||
| @@ -1,148 +0,0 @@ | |||||||
| /************************************************* |  | ||||||
| *      Perl-Compatible Regular Expressions       * |  | ||||||
| *************************************************/ |  | ||||||
|  |  | ||||||
| /* PCRE is a library of functions to support regular expressions whose syntax |  | ||||||
| and semantics are as close as possible to those of the Perl 5 language. |  | ||||||
|  |  | ||||||
|                        Written by Philip Hazel |  | ||||||
|            Copyright (c) 1997-2012 University of Cambridge |  | ||||||
|  |  | ||||||
| ----------------------------------------------------------------------------- |  | ||||||
| Redistribution and use in source and binary forms, with or without |  | ||||||
| modification, are permitted provided that the following conditions are met: |  | ||||||
|  |  | ||||||
|     * Redistributions of source code must retain the above copyright notice, |  | ||||||
|       this list of conditions and the following disclaimer. |  | ||||||
|  |  | ||||||
|     * Redistributions in binary form must reproduce the above copyright |  | ||||||
|       notice, this list of conditions and the following disclaimer in the |  | ||||||
|       documentation and/or other materials provided with the distribution. |  | ||||||
|  |  | ||||||
|     * Neither the name of the University of Cambridge nor the names of its |  | ||||||
|       contributors may be used to endorse or promote products derived from |  | ||||||
|       this software without specific prior written permission. |  | ||||||
|  |  | ||||||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |  | ||||||
| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |  | ||||||
| LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |  | ||||||
| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |  | ||||||
| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |  | ||||||
| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |  | ||||||
| CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |  | ||||||
| ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |  | ||||||
| POSSIBILITY OF SUCH DAMAGE. |  | ||||||
| ----------------------------------------------------------------------------- |  | ||||||
| */ |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* This module contains the external function pcre_maketables(), which builds |  | ||||||
| character tables for PCRE in the current locale. The file is compiled on its |  | ||||||
| own as part of the PCRE library. However, it is also included in the |  | ||||||
| compilation of dftables.c, in which case the macro DFTABLES is defined. */ |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #ifndef DFTABLES |  | ||||||
| #  ifdef HAVE_CONFIG_H |  | ||||||
| #  include "config.h" |  | ||||||
| #  endif |  | ||||||
| #  include "pcre_internal.h" |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /************************************************* |  | ||||||
| *           Create PCRE character tables         * |  | ||||||
| *************************************************/ |  | ||||||
|  |  | ||||||
| /* This function builds a set of character tables for use by PCRE and returns |  | ||||||
| a pointer to them. They are build using the ctype functions, and consequently |  | ||||||
| their contents will depend upon the current locale setting. When compiled as |  | ||||||
| part of the library, the store is obtained via PUBL(malloc)(), but when |  | ||||||
| compiled inside dftables, use malloc(). |  | ||||||
|  |  | ||||||
| Arguments:   none |  | ||||||
| Returns:     pointer to the contiguous block of data |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| #ifdef COMPILE_PCRE8 |  | ||||||
| const unsigned char * |  | ||||||
| pcre_maketables(void) |  | ||||||
| #else |  | ||||||
| const unsigned char * |  | ||||||
| pcre16_maketables(void) |  | ||||||
| #endif |  | ||||||
| { |  | ||||||
| unsigned char *yield, *p; |  | ||||||
| int i; |  | ||||||
|  |  | ||||||
| #ifndef DFTABLES |  | ||||||
| yield = (unsigned char*)(PUBL(malloc))(tables_length); |  | ||||||
| #else |  | ||||||
| yield = (unsigned char*)malloc(tables_length); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| if (yield == NULL) return NULL; |  | ||||||
| p = yield; |  | ||||||
|  |  | ||||||
| /* First comes the lower casing table */ |  | ||||||
|  |  | ||||||
| for (i = 0; i < 256; i++) *p++ = tolower(i); |  | ||||||
|  |  | ||||||
| /* Next the case-flipping table */ |  | ||||||
|  |  | ||||||
| for (i = 0; i < 256; i++) *p++ = islower(i)? toupper(i) : tolower(i); |  | ||||||
|  |  | ||||||
| /* Then the character class tables. Don't try to be clever and save effort on |  | ||||||
| exclusive ones - in some locales things may be different. Note that the table |  | ||||||
| for "space" includes everything "isspace" gives, including VT in the default |  | ||||||
| locale. This makes it work for the POSIX class [:space:]. Note also that it is |  | ||||||
| possible for a character to be alnum or alpha without being lower or upper, |  | ||||||
| such as "male and female ordinals" (\xAA and \xBA) in the fr_FR locale (at |  | ||||||
| least under Debian Linux's locales as of 12/2005). So we must test for alnum |  | ||||||
| specially. */ |  | ||||||
|  |  | ||||||
| memset(p, 0, cbit_length); |  | ||||||
| for (i = 0; i < 256; i++) |  | ||||||
|   { |  | ||||||
|   if (isdigit(i)) p[cbit_digit  + i/8] |= 1 << (i&7); |  | ||||||
|   if (isupper(i)) p[cbit_upper  + i/8] |= 1 << (i&7); |  | ||||||
|   if (islower(i)) p[cbit_lower  + i/8] |= 1 << (i&7); |  | ||||||
|   if (isalnum(i)) p[cbit_word   + i/8] |= 1 << (i&7); |  | ||||||
|   if (i == '_')   p[cbit_word   + i/8] |= 1 << (i&7); |  | ||||||
|   if (isspace(i)) p[cbit_space  + i/8] |= 1 << (i&7); |  | ||||||
|   if (isxdigit(i))p[cbit_xdigit + i/8] |= 1 << (i&7); |  | ||||||
|   if (isgraph(i)) p[cbit_graph  + i/8] |= 1 << (i&7); |  | ||||||
|   if (isprint(i)) p[cbit_print  + i/8] |= 1 << (i&7); |  | ||||||
|   if (ispunct(i)) p[cbit_punct  + i/8] |= 1 << (i&7); |  | ||||||
|   if (iscntrl(i)) p[cbit_cntrl  + i/8] |= 1 << (i&7); |  | ||||||
|   } |  | ||||||
| p += cbit_length; |  | ||||||
|  |  | ||||||
| /* Finally, the character type table. In this, we exclude VT from the white |  | ||||||
| space chars, because Perl doesn't recognize it as such for \s and for comments |  | ||||||
| within regexes. */ |  | ||||||
|  |  | ||||||
| for (i = 0; i < 256; i++) |  | ||||||
|   { |  | ||||||
|   int x = 0; |  | ||||||
|   if (i != 0x0b && isspace(i)) x += ctype_space; |  | ||||||
|   if (isalpha(i)) x += ctype_letter; |  | ||||||
|   if (isdigit(i)) x += ctype_digit; |  | ||||||
|   if (isxdigit(i)) x += ctype_xdigit; |  | ||||||
|   if (isalnum(i) || i == '_') x += ctype_word; |  | ||||||
|  |  | ||||||
|   /* Note: strchr includes the terminating zero in the characters it considers. |  | ||||||
|   In this instance, that is ok because we want binary zero to be flagged as a |  | ||||||
|   meta-character, which in this sense is any character that terminates a run |  | ||||||
|   of data characters. */ |  | ||||||
|  |  | ||||||
|   if (strchr("\\*+?{^.$|()[", i) != 0) x += ctype_meta; |  | ||||||
|   *p++ = x; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
| return yield; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* End of pcre_maketables.c */ |  | ||||||
| @@ -1,89 +0,0 @@ | |||||||
| /************************************************* |  | ||||||
| *      Perl-Compatible Regular Expressions       * |  | ||||||
| *************************************************/ |  | ||||||
|  |  | ||||||
| /* PCRE is a library of functions to support regular expressions whose syntax |  | ||||||
| and semantics are as close as possible to those of the Perl 5 language. |  | ||||||
|  |  | ||||||
|                        Written by Philip Hazel |  | ||||||
|            Copyright (c) 1997-2012 University of Cambridge |  | ||||||
|  |  | ||||||
| ----------------------------------------------------------------------------- |  | ||||||
| Redistribution and use in source and binary forms, with or without |  | ||||||
| modification, are permitted provided that the following conditions are met: |  | ||||||
|  |  | ||||||
|     * Redistributions of source code must retain the above copyright notice, |  | ||||||
|       this list of conditions and the following disclaimer. |  | ||||||
|  |  | ||||||
|     * Redistributions in binary form must reproduce the above copyright |  | ||||||
|       notice, this list of conditions and the following disclaimer in the |  | ||||||
|       documentation and/or other materials provided with the distribution. |  | ||||||
|  |  | ||||||
|     * Neither the name of the University of Cambridge nor the names of its |  | ||||||
|       contributors may be used to endorse or promote products derived from |  | ||||||
|       this software without specific prior written permission. |  | ||||||
|  |  | ||||||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |  | ||||||
| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |  | ||||||
| LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |  | ||||||
| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |  | ||||||
| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |  | ||||||
| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |  | ||||||
| CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |  | ||||||
| ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |  | ||||||
| POSSIBILITY OF SUCH DAMAGE. |  | ||||||
| ----------------------------------------------------------------------------- |  | ||||||
| */ |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* This module contains the external function pcre_refcount(), which is an |  | ||||||
| auxiliary function that can be used to maintain a reference count in a compiled |  | ||||||
| pattern data block. This might be helpful in applications where the block is |  | ||||||
| shared by different users. */ |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #ifdef HAVE_CONFIG_H |  | ||||||
| #include "config.h" |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #include "pcre_internal.h" |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /************************************************* |  | ||||||
| *           Maintain reference count             * |  | ||||||
| *************************************************/ |  | ||||||
|  |  | ||||||
| /* The reference count is a 16-bit field, initialized to zero. It is not |  | ||||||
| possible to transfer a non-zero count from one host to a different host that |  | ||||||
| has a different byte order - though I can't see why anyone in their right mind |  | ||||||
| would ever want to do that! |  | ||||||
|  |  | ||||||
| Arguments: |  | ||||||
|   argument_re   points to compiled code |  | ||||||
|   adjust        value to add to the count |  | ||||||
|  |  | ||||||
| Returns:        the (possibly updated) count value (a non-negative number), or |  | ||||||
|                 a negative error number |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| #ifdef COMPILE_PCRE8 |  | ||||||
| PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |  | ||||||
| pcre_refcount(pcre *argument_re, int adjust) |  | ||||||
| #else |  | ||||||
| PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |  | ||||||
| pcre16_refcount(pcre16 *argument_re, int adjust) |  | ||||||
| #endif |  | ||||||
| { |  | ||||||
| REAL_PCRE *re = (REAL_PCRE *)argument_re; |  | ||||||
| if (re == NULL) return PCRE_ERROR_NULL; |  | ||||||
| if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC; |  | ||||||
| if ((re->flags & PCRE_MODE) == 0) return PCRE_ERROR_BADMODE; |  | ||||||
| re->ref_count = (-adjust > re->ref_count)? 0 : |  | ||||||
|                 (adjust + re->ref_count > 65535)? 65535 : |  | ||||||
|                 re->ref_count + adjust; |  | ||||||
| return re->ref_count; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* End of pcre_refcount.c */ |  | ||||||
| @@ -1,95 +0,0 @@ | |||||||
| /************************************************* |  | ||||||
| *      Perl-Compatible Regular Expressions       * |  | ||||||
| *************************************************/ |  | ||||||
|  |  | ||||||
| /* PCRE is a library of functions to support regular expressions whose syntax |  | ||||||
| and semantics are as close as possible to those of the Perl 5 language. |  | ||||||
|  |  | ||||||
|                        Written by Philip Hazel |  | ||||||
|            Copyright (c) 1997-2012 University of Cambridge |  | ||||||
|  |  | ||||||
| ----------------------------------------------------------------------------- |  | ||||||
| Redistribution and use in source and binary forms, with or without |  | ||||||
| modification, are permitted provided that the following conditions are met: |  | ||||||
|  |  | ||||||
|     * Redistributions of source code must retain the above copyright notice, |  | ||||||
|       this list of conditions and the following disclaimer. |  | ||||||
|  |  | ||||||
|     * Redistributions in binary form must reproduce the above copyright |  | ||||||
|       notice, this list of conditions and the following disclaimer in the |  | ||||||
|       documentation and/or other materials provided with the distribution. |  | ||||||
|  |  | ||||||
|     * Neither the name of the University of Cambridge nor the names of its |  | ||||||
|       contributors may be used to endorse or promote products derived from |  | ||||||
|       this software without specific prior written permission. |  | ||||||
|  |  | ||||||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |  | ||||||
| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |  | ||||||
| LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |  | ||||||
| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |  | ||||||
| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |  | ||||||
| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |  | ||||||
| CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |  | ||||||
| ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |  | ||||||
| POSSIBILITY OF SUCH DAMAGE. |  | ||||||
| ----------------------------------------------------------------------------- |  | ||||||
| */ |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* This module contains the external function pcre_version(), which returns a |  | ||||||
| string that identifies the PCRE version that is in use. */ |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #ifdef HAVE_CONFIG_H |  | ||||||
| #include "config.h" |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #include "pcre_internal.h" |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /************************************************* |  | ||||||
| *          Return version string                 * |  | ||||||
| *************************************************/ |  | ||||||
|  |  | ||||||
| /* These macros are the standard way of turning unquoted text into C strings. |  | ||||||
| They allow macros like PCRE_MAJOR to be defined without quotes, which is |  | ||||||
| convenient for user programs that want to test its value. */ |  | ||||||
|  |  | ||||||
| #define STRING(a)  # a |  | ||||||
| #define XSTRING(s) STRING(s) |  | ||||||
|  |  | ||||||
| /* A problem turned up with PCRE_PRERELEASE, which is defined empty for |  | ||||||
| production releases. Originally, it was used naively in this code: |  | ||||||
|  |  | ||||||
|   return XSTRING(PCRE_MAJOR) |  | ||||||
|          "." XSTRING(PCRE_MINOR) |  | ||||||
|              XSTRING(PCRE_PRERELEASE) |  | ||||||
|          " " XSTRING(PCRE_DATE); |  | ||||||
|  |  | ||||||
| However, when PCRE_PRERELEASE is empty, this leads to an attempted expansion of |  | ||||||
| STRING(). The C standard states: "If (before argument substitution) any |  | ||||||
| argument consists of no preprocessing tokens, the behavior is undefined." It |  | ||||||
| turns out the gcc treats this case as a single empty string - which is what we |  | ||||||
| really want - but Visual C grumbles about the lack of an argument for the |  | ||||||
| macro. Unfortunately, both are within their rights. To cope with both ways of |  | ||||||
| handling this, I had resort to some messy hackery that does a test at run time. |  | ||||||
| I could find no way of detecting that a macro is defined as an empty string at |  | ||||||
| pre-processor time. This hack uses a standard trick for avoiding calling |  | ||||||
| the STRING macro with an empty argument when doing the test. */ |  | ||||||
|  |  | ||||||
| #ifdef COMPILE_PCRE8 |  | ||||||
| PCRE_EXP_DEFN const char * PCRE_CALL_CONVENTION |  | ||||||
| pcre_version(void) |  | ||||||
| #else |  | ||||||
| PCRE_EXP_DEFN const char * PCRE_CALL_CONVENTION |  | ||||||
| pcre16_version(void) |  | ||||||
| #endif |  | ||||||
| { |  | ||||||
| return (XSTRING(Z PCRE_PRERELEASE)[1] == 0)? |  | ||||||
|   XSTRING(PCRE_MAJOR.PCRE_MINOR PCRE_DATE) : |  | ||||||
|   XSTRING(PCRE_MAJOR.PCRE_MINOR) XSTRING(PCRE_PRERELEASE PCRE_DATE); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* End of pcre_version.c */ |  | ||||||
| @@ -1,146 +0,0 @@ | |||||||
| /************************************************* |  | ||||||
| *       Perl-Compatible Regular Expressions      * |  | ||||||
| *************************************************/ |  | ||||||
|  |  | ||||||
| #ifndef _PCREPOSIX_H |  | ||||||
| #define _PCREPOSIX_H |  | ||||||
|  |  | ||||||
| /* This is the header for the POSIX wrapper interface to the PCRE Perl- |  | ||||||
| Compatible Regular Expression library. It defines the things POSIX says should |  | ||||||
| be there. I hope. |  | ||||||
|  |  | ||||||
|             Copyright (c) 1997-2012 University of Cambridge |  | ||||||
|  |  | ||||||
| ----------------------------------------------------------------------------- |  | ||||||
| Redistribution and use in source and binary forms, with or without |  | ||||||
| modification, are permitted provided that the following conditions are met: |  | ||||||
|  |  | ||||||
|     * Redistributions of source code must retain the above copyright notice, |  | ||||||
|       this list of conditions and the following disclaimer. |  | ||||||
|  |  | ||||||
|     * Redistributions in binary form must reproduce the above copyright |  | ||||||
|       notice, this list of conditions and the following disclaimer in the |  | ||||||
|       documentation and/or other materials provided with the distribution. |  | ||||||
|  |  | ||||||
|     * Neither the name of the University of Cambridge nor the names of its |  | ||||||
|       contributors may be used to endorse or promote products derived from |  | ||||||
|       this software without specific prior written permission. |  | ||||||
|  |  | ||||||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |  | ||||||
| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |  | ||||||
| LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |  | ||||||
| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |  | ||||||
| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |  | ||||||
| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |  | ||||||
| CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |  | ||||||
| ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |  | ||||||
| POSSIBILITY OF SUCH DAMAGE. |  | ||||||
| ----------------------------------------------------------------------------- |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| /* Have to include stdlib.h in order to ensure that size_t is defined. */ |  | ||||||
|  |  | ||||||
| #include <stdlib.h> |  | ||||||
|  |  | ||||||
| /* Allow for C++ users */ |  | ||||||
|  |  | ||||||
| #ifdef __cplusplus |  | ||||||
| extern "C" { |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| /* Options, mostly defined by POSIX, but with some extras. */ |  | ||||||
|  |  | ||||||
| #define REG_ICASE     0x0001   /* Maps to PCRE_CASELESS */ |  | ||||||
| #define REG_NEWLINE   0x0002   /* Maps to PCRE_MULTILINE */ |  | ||||||
| #define REG_NOTBOL    0x0004   /* Maps to PCRE_NOTBOL */ |  | ||||||
| #define REG_NOTEOL    0x0008   /* Maps to PCRE_NOTEOL */ |  | ||||||
| #define REG_DOTALL    0x0010   /* NOT defined by POSIX; maps to PCRE_DOTALL */ |  | ||||||
| #define REG_NOSUB     0x0020   /* Maps to PCRE_NO_AUTO_CAPTURE */ |  | ||||||
| #define REG_UTF8      0x0040   /* NOT defined by POSIX; maps to PCRE_UTF8 */ |  | ||||||
| #define REG_STARTEND  0x0080   /* BSD feature: pass subject string by so,eo */ |  | ||||||
| #define REG_NOTEMPTY  0x0100   /* NOT defined by POSIX; maps to PCRE_NOTEMPTY */ |  | ||||||
| #define REG_UNGREEDY  0x0200   /* NOT defined by POSIX; maps to PCRE_UNGREEDY */ |  | ||||||
| #define REG_UCP       0x0400   /* NOT defined by POSIX; maps to PCRE_UCP */ |  | ||||||
|  |  | ||||||
| /* This is not used by PCRE, but by defining it we make it easier |  | ||||||
| to slot PCRE into existing programs that make POSIX calls. */ |  | ||||||
|  |  | ||||||
| #define REG_EXTENDED  0 |  | ||||||
|  |  | ||||||
| /* Error values. Not all these are relevant or used by the wrapper. */ |  | ||||||
|  |  | ||||||
| enum { |  | ||||||
|   REG_ASSERT = 1,  /* internal error ? */ |  | ||||||
|   REG_BADBR,       /* invalid repeat counts in {} */ |  | ||||||
|   REG_BADPAT,      /* pattern error */ |  | ||||||
|   REG_BADRPT,      /* ? * + invalid */ |  | ||||||
|   REG_EBRACE,      /* unbalanced {} */ |  | ||||||
|   REG_EBRACK,      /* unbalanced [] */ |  | ||||||
|   REG_ECOLLATE,    /* collation error - not relevant */ |  | ||||||
|   REG_ECTYPE,      /* bad class */ |  | ||||||
|   REG_EESCAPE,     /* bad escape sequence */ |  | ||||||
|   REG_EMPTY,       /* empty expression */ |  | ||||||
|   REG_EPAREN,      /* unbalanced () */ |  | ||||||
|   REG_ERANGE,      /* bad range inside [] */ |  | ||||||
|   REG_ESIZE,       /* expression too big */ |  | ||||||
|   REG_ESPACE,      /* failed to get memory */ |  | ||||||
|   REG_ESUBREG,     /* bad back reference */ |  | ||||||
|   REG_INVARG,      /* bad argument */ |  | ||||||
|   REG_NOMATCH      /* match failed */ |  | ||||||
| }; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /* The structure representing a compiled regular expression. */ |  | ||||||
|  |  | ||||||
| typedef struct { |  | ||||||
|   void *re_pcre; |  | ||||||
|   size_t re_nsub; |  | ||||||
|   size_t re_erroffset; |  | ||||||
| } regex_t; |  | ||||||
|  |  | ||||||
| /* The structure in which a captured offset is returned. */ |  | ||||||
|  |  | ||||||
| typedef int regoff_t; |  | ||||||
|  |  | ||||||
| typedef struct { |  | ||||||
|   regoff_t rm_so; |  | ||||||
|   regoff_t rm_eo; |  | ||||||
| } regmatch_t; |  | ||||||
|  |  | ||||||
| /* When an application links to a PCRE DLL in Windows, the symbols that are |  | ||||||
| imported have to be identified as such. When building PCRE, the appropriate |  | ||||||
| export settings are needed, and are set in pcreposix.c before including this |  | ||||||
| file. */ |  | ||||||
|  |  | ||||||
| #if defined(_WIN32) && !defined(PCRE_STATIC) && !defined(PCREPOSIX_EXP_DECL) |  | ||||||
| #  define PCREPOSIX_EXP_DECL  extern __declspec(dllimport) |  | ||||||
| #  define PCREPOSIX_EXP_DEFN  __declspec(dllimport) |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| /* By default, we use the standard "extern" declarations. */ |  | ||||||
|  |  | ||||||
| #ifndef PCREPOSIX_EXP_DECL |  | ||||||
| #  ifdef __cplusplus |  | ||||||
| #    define PCREPOSIX_EXP_DECL  extern "C" |  | ||||||
| #    define PCREPOSIX_EXP_DEFN  extern "C" |  | ||||||
| #  else |  | ||||||
| #    define PCREPOSIX_EXP_DECL  extern |  | ||||||
| #    define PCREPOSIX_EXP_DEFN  extern |  | ||||||
| #  endif |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| /* The functions */ |  | ||||||
|  |  | ||||||
| PCREPOSIX_EXP_DECL int regcomp(regex_t *, const char *, int); |  | ||||||
| PCREPOSIX_EXP_DECL int regexec(const regex_t *, const char *, size_t, |  | ||||||
|                      regmatch_t *, int); |  | ||||||
| PCREPOSIX_EXP_DECL size_t regerror(int, const regex_t *, char *, size_t); |  | ||||||
| PCREPOSIX_EXP_DECL void regfree(regex_t *); |  | ||||||
|  |  | ||||||
| #ifdef __cplusplus |  | ||||||
| }   /* extern "C" */ |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #endif /* End of pcreposix.h */ |  | ||||||
		Reference in New Issue
	
	Block a user