2012-02-08 02:02 UTC+0100 Viktor Szakats (harbour syenar.net)
* src/3rd/pcre/Makefile
* src/3rd/pcre/pcre.dif
+ src/3rd/pcre/pcrebyte.c
+ added missing file
! adjusted Makefile list after prev commit
This commit is contained in:
@@ -16,6 +16,13 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-02-08 02:02 UTC+0100 Viktor Szakats (harbour syenar.net)
|
||||
* src/3rd/pcre/Makefile
|
||||
* src/3rd/pcre/pcre.dif
|
||||
+ src/3rd/pcre/pcrebyte.c
|
||||
+ added missing file
|
||||
! adjusted Makefile list after prev commit
|
||||
|
||||
2012-02-08 01:51 UTC+0100 Viktor Szakats (harbour syenar.net)
|
||||
* src/3rd/pcre/pcre.dif
|
||||
* deleted patch applied upstream
|
||||
|
||||
@@ -11,6 +11,7 @@ HB_BUILD_MODE := c
|
||||
|
||||
C_SOURCES := \
|
||||
chartabs.c \
|
||||
pcrebyte.c \
|
||||
pcrecomp.c \
|
||||
pcreconf.c \
|
||||
pcredfa.c \
|
||||
@@ -18,7 +19,6 @@ C_SOURCES := \
|
||||
pcrefinf.c \
|
||||
pcreget.c \
|
||||
pcreglob.c \
|
||||
pcreinfo.c \
|
||||
pcrejitc.c \
|
||||
pcremktb.c \
|
||||
pcrenewl.c \
|
||||
@@ -26,7 +26,6 @@ C_SOURCES := \
|
||||
pcrerefc.c \
|
||||
pcrestud.c \
|
||||
pcretabs.c \
|
||||
pcretryf.c \
|
||||
pcreucd.c \
|
||||
pcrever.c \
|
||||
pcrevutf.c \
|
||||
@@ -91,6 +90,7 @@ endif
|
||||
# MAP pcre_internal.h pcreinal.h
|
||||
# MAP ucp.h
|
||||
# MAP pcre_chartables.c.dist chartabs.c
|
||||
# MAP pcre_byte_order.c pcrebyte.c
|
||||
# MAP pcre_compile.c pcrecomp.c
|
||||
# MAP pcre_config.c pcreconf.c
|
||||
# MAP pcre_dfa_exec.c pcredfa.c
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -urN pcre.orig\pcreglob.c.rej pcre\pcreglob.c.rej
|
||||
--- pcre.orig\pcreglob.c.rej Thu Jan 01 01:00:00 1970
|
||||
+++ pcre\pcreglob.c.rej Wed Feb 08 01:46:37 2012
|
||||
+++ pcre\pcreglob.c.rej Wed Feb 08 02:01:44 2012
|
||||
@@ -0,0 +1,31 @@
|
||||
+***************
|
||||
+*** 74,84 ****
|
||||
@@ -34,8 +34,8 @@ diff -urN pcre.orig\pcreglob.c.rej pcre\pcreglob.c.rej
|
||||
+
|
||||
+ /* End of pcre_globals.c */
|
||||
diff -urN pcre.orig\pcrejitc.c pcre\pcrejitc.c
|
||||
--- pcre.orig\pcrejitc.c Wed Feb 08 01:46:37 2012
|
||||
+++ pcre\pcrejitc.c Wed Feb 08 01:46:37 2012
|
||||
--- pcre.orig\pcrejitc.c Wed Feb 08 02:01:44 2012
|
||||
+++ pcre\pcrejitc.c Wed Feb 08 02:01:44 2012
|
||||
@@ -59,7 +59,7 @@
|
||||
#define SLJIT_VERBOSE 0
|
||||
#define SLJIT_DEBUG 0
|
||||
|
||||
288
harbour/src/3rd/pcre/pcrebyte.c
Normal file
288
harbour/src/3rd/pcre/pcrebyte.c
Normal file
@@ -0,0 +1,288 @@
|
||||
/*************************************************
|
||||
* 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 an internal function that tests a compiled pattern to
|
||||
see if it was compiled with the opposite endianness. If so, it uses an
|
||||
auxiliary local function to flip the appropriate bytes. */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "pcreinal.h"
|
||||
|
||||
|
||||
/*************************************************
|
||||
* Swap byte functions *
|
||||
*************************************************/
|
||||
|
||||
/* The following functions swap the bytes of a pcre_uint16
|
||||
and pcre_uint32 value.
|
||||
|
||||
Arguments:
|
||||
value any number
|
||||
|
||||
Returns: the byte swapped value
|
||||
*/
|
||||
|
||||
static pcre_uint32
|
||||
swap_uint32(pcre_uint32 value)
|
||||
{
|
||||
return ((value & 0x000000ff) << 24) |
|
||||
((value & 0x0000ff00) << 8) |
|
||||
((value & 0x00ff0000) >> 8) |
|
||||
(value >> 24);
|
||||
}
|
||||
|
||||
static pcre_uint16
|
||||
swap_uint16(pcre_uint16 value)
|
||||
{
|
||||
return (value >> 8) | (value << 8);
|
||||
}
|
||||
|
||||
|
||||
/*************************************************
|
||||
* Test for a byte-flipped compiled regex *
|
||||
*************************************************/
|
||||
|
||||
/* This function swaps the bytes of a compiled pattern usually
|
||||
loaded form the disk. It also sets the tables pointer, which
|
||||
is likely an invalid pointer after reload.
|
||||
|
||||
Arguments:
|
||||
argument_re points to the compiled expression
|
||||
extra_data points to extra data or is NULL
|
||||
tables points to the character tables or NULL
|
||||
|
||||
Returns: 0 if the swap is successful, negative on error
|
||||
*/
|
||||
|
||||
#ifdef COMPILE_PCRE8
|
||||
PCRE_EXP_DECL int pcre_pattern_to_host_byte_order(pcre *argument_re,
|
||||
pcre_extra *extra_data, const unsigned char *tables)
|
||||
#else
|
||||
PCRE_EXP_DECL int pcre16_pattern_to_host_byte_order(pcre16 *argument_re,
|
||||
pcre16_extra *extra_data, const unsigned char *tables)
|
||||
#endif
|
||||
{
|
||||
REAL_PCRE *re = (REAL_PCRE *)argument_re;
|
||||
pcre_study_data *study;
|
||||
#ifndef COMPILE_PCRE8
|
||||
pcre_uchar *ptr;
|
||||
int length;
|
||||
#ifdef SUPPORT_UTF
|
||||
BOOL utf;
|
||||
BOOL utf16_char;
|
||||
#endif /* SUPPORT_UTF */
|
||||
#endif /* !COMPILE_PCRE8 */
|
||||
|
||||
if (re == NULL) return PCRE_ERROR_NULL;
|
||||
if (re->magic_number == MAGIC_NUMBER)
|
||||
{
|
||||
if ((re->flags & PCRE_MODE) == 0) return PCRE_ERROR_BADMODE;
|
||||
re->tables = tables;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (re->magic_number != REVERSED_MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC;
|
||||
if ((swap_uint16(re->flags) & PCRE_MODE) == 0) return PCRE_ERROR_BADMODE;
|
||||
|
||||
re->magic_number = MAGIC_NUMBER;
|
||||
re->size = swap_uint32(re->size);
|
||||
re->options = swap_uint32(re->options);
|
||||
re->flags = swap_uint16(re->flags);
|
||||
re->top_bracket = swap_uint16(re->top_bracket);
|
||||
re->top_backref = swap_uint16(re->top_backref);
|
||||
re->first_char = swap_uint16(re->first_char);
|
||||
re->req_char = swap_uint16(re->req_char);
|
||||
re->name_table_offset = swap_uint16(re->name_table_offset);
|
||||
re->name_entry_size = swap_uint16(re->name_entry_size);
|
||||
re->name_count = swap_uint16(re->name_count);
|
||||
re->ref_count = swap_uint16(re->ref_count);
|
||||
re->tables = tables;
|
||||
|
||||
if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_STUDY_DATA) != 0)
|
||||
{
|
||||
study = (pcre_study_data *)extra_data->study_data;
|
||||
study->size = swap_uint32(study->size);
|
||||
study->flags = swap_uint32(study->flags);
|
||||
study->minlength = swap_uint32(study->minlength);
|
||||
}
|
||||
|
||||
#ifndef COMPILE_PCRE8
|
||||
ptr = (pcre_uchar *)re + re->name_table_offset;
|
||||
length = re->name_count * re->name_entry_size;
|
||||
#ifdef SUPPORT_UTF
|
||||
utf = (re->options & PCRE_UTF16) != 0;
|
||||
utf16_char = FALSE;
|
||||
#endif
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
/* Swap previous characters. */
|
||||
while (length-- > 0)
|
||||
{
|
||||
*ptr = swap_uint16(*ptr);
|
||||
ptr++;
|
||||
}
|
||||
#ifdef SUPPORT_UTF
|
||||
if (utf16_char)
|
||||
{
|
||||
if (HAS_EXTRALEN(ptr[-1]))
|
||||
{
|
||||
/* We know that there is only one extra character in UTF-16. */
|
||||
*ptr = swap_uint16(*ptr);
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
utf16_char = FALSE;
|
||||
#endif /* SUPPORT_UTF */
|
||||
|
||||
/* Get next opcode. */
|
||||
length = 0;
|
||||
*ptr = swap_uint16(*ptr);
|
||||
switch (*ptr)
|
||||
{
|
||||
case OP_END:
|
||||
return 0;
|
||||
|
||||
#ifdef SUPPORT_UTF
|
||||
case OP_CHAR:
|
||||
case OP_CHARI:
|
||||
case OP_NOT:
|
||||
case OP_NOTI:
|
||||
case OP_STAR:
|
||||
case OP_MINSTAR:
|
||||
case OP_PLUS:
|
||||
case OP_MINPLUS:
|
||||
case OP_QUERY:
|
||||
case OP_MINQUERY:
|
||||
case OP_UPTO:
|
||||
case OP_MINUPTO:
|
||||
case OP_EXACT:
|
||||
case OP_POSSTAR:
|
||||
case OP_POSPLUS:
|
||||
case OP_POSQUERY:
|
||||
case OP_POSUPTO:
|
||||
case OP_STARI:
|
||||
case OP_MINSTARI:
|
||||
case OP_PLUSI:
|
||||
case OP_MINPLUSI:
|
||||
case OP_QUERYI:
|
||||
case OP_MINQUERYI:
|
||||
case OP_UPTOI:
|
||||
case OP_MINUPTOI:
|
||||
case OP_EXACTI:
|
||||
case OP_POSSTARI:
|
||||
case OP_POSPLUSI:
|
||||
case OP_POSQUERYI:
|
||||
case OP_POSUPTOI:
|
||||
case OP_NOTSTAR:
|
||||
case OP_NOTMINSTAR:
|
||||
case OP_NOTPLUS:
|
||||
case OP_NOTMINPLUS:
|
||||
case OP_NOTQUERY:
|
||||
case OP_NOTMINQUERY:
|
||||
case OP_NOTUPTO:
|
||||
case OP_NOTMINUPTO:
|
||||
case OP_NOTEXACT:
|
||||
case OP_NOTPOSSTAR:
|
||||
case OP_NOTPOSPLUS:
|
||||
case OP_NOTPOSQUERY:
|
||||
case OP_NOTPOSUPTO:
|
||||
case OP_NOTSTARI:
|
||||
case OP_NOTMINSTARI:
|
||||
case OP_NOTPLUSI:
|
||||
case OP_NOTMINPLUSI:
|
||||
case OP_NOTQUERYI:
|
||||
case OP_NOTMINQUERYI:
|
||||
case OP_NOTUPTOI:
|
||||
case OP_NOTMINUPTOI:
|
||||
case OP_NOTEXACTI:
|
||||
case OP_NOTPOSSTARI:
|
||||
case OP_NOTPOSPLUSI:
|
||||
case OP_NOTPOSQUERYI:
|
||||
case OP_NOTPOSUPTOI:
|
||||
if (utf) utf16_char = TRUE;
|
||||
#endif
|
||||
/* Fall through. */
|
||||
|
||||
default:
|
||||
length = PRIV(OP_lengths)[*ptr] - 1;
|
||||
break;
|
||||
|
||||
case OP_CLASS:
|
||||
case OP_NCLASS:
|
||||
/* Skip the character bit map. */
|
||||
ptr += 32/sizeof(pcre_uchar);
|
||||
length = 0;
|
||||
break;
|
||||
|
||||
case OP_XCLASS:
|
||||
/* Reverse the size of the XCLASS instance. */
|
||||
ptr++;
|
||||
*ptr = swap_uint16(*ptr);
|
||||
if (LINK_SIZE > 1)
|
||||
{
|
||||
/* LINK_SIZE can be 1 or 2 in 16 bit mode. */
|
||||
ptr++;
|
||||
*ptr = swap_uint16(*ptr);
|
||||
}
|
||||
ptr++;
|
||||
length = (GET(ptr, -LINK_SIZE)) - (1 + LINK_SIZE + 1);
|
||||
*ptr = swap_uint16(*ptr);
|
||||
if ((*ptr & XCL_MAP) != 0)
|
||||
{
|
||||
/* Skip the character bit map. */
|
||||
ptr += 32/sizeof(pcre_uchar);
|
||||
length -= 32/sizeof(pcre_uchar);
|
||||
}
|
||||
break;
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
/* Control should never reach here in 16 bit mode. */
|
||||
#endif /* !COMPILE_PCRE8 */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* End of pcre_byte_order.c */
|
||||
Reference in New Issue
Block a user