Revision: 852
http://vcs.pcre.org/viewvc?view=rev&revision=852
Author: zherczeg
Date: 2012-01-05 19:18:12 +0000 (Thu, 05 Jan 2012)
Log Message:
-----------
Add pcre16 prefix to 16 bit structs
Modified Paths:
--------------
code/trunk/pcre.h.in
code/trunk/pcre_byte_order.c
code/trunk/pcre_compile.c
code/trunk/pcre_dfa_exec.c
code/trunk/pcre_exec.c
code/trunk/pcre_fullinfo.c
code/trunk/pcre_get.c
code/trunk/pcre_internal.h
code/trunk/pcre_jit_compile.c
code/trunk/pcre_jit_test.c
code/trunk/pcre_printint.c
code/trunk/pcre_refcount.c
code/trunk/pcre_study.c
code/trunk/pcretest.c
Modified: code/trunk/pcre.h.in
===================================================================
--- code/trunk/pcre.h.in 2012-01-05 17:57:28 UTC (rev 851)
+++ code/trunk/pcre.h.in 2012-01-05 19:18:12 UTC (rev 852)
@@ -271,9 +271,15 @@
struct real_pcre; /* declaration; the definition is private */
typedef struct real_pcre pcre;
+struct real_pcre16; /* declaration; the definition is private */
+typedef struct real_pcre16 pcre16;
+
struct real_pcre_jit_stack; /* declaration; the definition is private */
typedef struct real_pcre_jit_stack pcre_jit_stack;
+struct real_pcre16_jit_stack; /* declaration; the definition is private */
+typedef struct real_pcre16_jit_stack pcre16_jit_stack;
+
/* If PCRE is compiled with 16 bit character support, PCRE_SCHAR16 must contain
a 16 bit wide signed data type. Otherwise it can be a dummy data type since
pcre16 functions are not implemented. There is a check for this in pcre_internal.h. */
@@ -353,7 +359,7 @@
/* ------------------------ Version 0 ------------------------------- */
int callout_number; /* Number compiled into pattern */
int *offset_vector; /* The offset vector */
- PCRE_SPTR subject; /* The subject being matched */
+ PCRE_SPTR16 subject; /* The subject being matched */
int subject_length; /* The length of the subject */
int start_match; /* Offset to start of this match attempt */
int current_position; /* Where we currently are in the subject */
@@ -403,22 +409,23 @@
/* User defined callback which provides a stack just before the match starts. */
typedef pcre_jit_stack *(*pcre_jit_callback)(void *);
+typedef pcre16_jit_stack *(*pcre16_jit_callback)(void *);
/* Exported PCRE functions */
PCRE_EXP_DECL pcre *pcre_compile(const char *, int, const char **, int *,
const unsigned char *);
-PCRE_EXP_DECL pcre *pcre16_compile(PCRE_SPTR16, int, const char **, int *,
+PCRE_EXP_DECL pcre16 *pcre16_compile(PCRE_SPTR16, int, const char **, int *,
const unsigned char *);
PCRE_EXP_DECL pcre *pcre_compile2(const char *, int, int *, const char **,
int *, const unsigned char *);
-PCRE_EXP_DECL pcre *pcre16_compile2(PCRE_SPTR16, int, int *, const char **,
+PCRE_EXP_DECL pcre16 *pcre16_compile2(PCRE_SPTR16, int, int *, const char **,
int *, const unsigned char *);
PCRE_EXP_DECL int pcre_config(int, void *);
PCRE_EXP_DECL int pcre16_config(int, void *);
PCRE_EXP_DECL int pcre_copy_named_substring(const pcre *, const char *,
int *, int, const char *, char *, int);
-PCRE_EXP_DECL int pcre16_copy_named_substring(const pcre *, PCRE_SPTR16,
+PCRE_EXP_DECL int pcre16_copy_named_substring(const pcre16 *, PCRE_SPTR16,
int *, int, PCRE_SPTR16, PCRE_SCHAR16 *, int);
PCRE_EXP_DECL int pcre_copy_substring(const char *, int *, int, int,
char *, int);
@@ -426,29 +433,29 @@
PCRE_SCHAR16 *, int);
PCRE_EXP_DECL int pcre_dfa_exec(const pcre *, const pcre_extra *,
const char *, int, int, int, int *, int , int *, int);
-PCRE_EXP_DECL int pcre16_dfa_exec(const pcre *, const pcre16_extra *,
+PCRE_EXP_DECL int pcre16_dfa_exec(const pcre16 *, const pcre16_extra *,
PCRE_SPTR16, int, int, int, int *, int , int *, int);
PCRE_EXP_DECL int pcre_exec(const pcre *, const pcre_extra *, PCRE_SPTR,
int, int, int, int *, int);
-PCRE_EXP_DECL int pcre16_exec(const pcre *, const pcre16_extra *, PCRE_SPTR16,
- int, int, int, int *, int);
+PCRE_EXP_DECL int pcre16_exec(const pcre16 *, const pcre16_extra *,
+ PCRE_SPTR16, int, int, int, int *, int);
PCRE_EXP_DECL void pcre_free_substring(const char *);
PCRE_EXP_DECL void pcre16_free_substring(PCRE_SPTR16);
PCRE_EXP_DECL void pcre_free_substring_list(const char **);
PCRE_EXP_DECL void pcre16_free_substring_list(PCRE_SPTR16 *);
PCRE_EXP_DECL int pcre_fullinfo(const pcre *, const pcre_extra *, int,
void *);
-PCRE_EXP_DECL int pcre16_fullinfo(const pcre *, const pcre16_extra *, int,
+PCRE_EXP_DECL int pcre16_fullinfo(const pcre16 *, const pcre16_extra *, int,
void *);
PCRE_EXP_DECL int pcre_get_named_substring(const pcre *, const char *,
int *, int, const char *, const char **);
-PCRE_EXP_DECL int pcre16_get_named_substring(const pcre *, PCRE_SPTR16,
+PCRE_EXP_DECL int pcre16_get_named_substring(const pcre16 *, PCRE_SPTR16,
int *, int, PCRE_SPTR16, PCRE_SPTR16 *);
PCRE_EXP_DECL int pcre_get_stringnumber(const pcre *, const char *);
-PCRE_EXP_DECL int pcre16_get_stringnumber(const pcre *, PCRE_SPTR16);
+PCRE_EXP_DECL int pcre16_get_stringnumber(const pcre16 *, PCRE_SPTR16);
PCRE_EXP_DECL int pcre_get_stringtable_entries(const pcre *, const char *,
char **, char **);
-PCRE_EXP_DECL int pcre16_get_stringtable_entries(const pcre *, PCRE_SPTR16,
+PCRE_EXP_DECL int pcre16_get_stringtable_entries(const pcre16 *, PCRE_SPTR16,
PCRE_SCHAR16 **, PCRE_SCHAR16 **);
PCRE_EXP_DECL int pcre_get_substring(const char *, int *, int, int,
const char **);
@@ -461,9 +468,9 @@
PCRE_EXP_DECL const unsigned char *pcre_maketables(void);
PCRE_EXP_DECL const unsigned char *pcre16_maketables(void);
PCRE_EXP_DECL int pcre_refcount(pcre *, int);
-PCRE_EXP_DECL int pcre16_refcount(pcre *, int);
+PCRE_EXP_DECL int pcre16_refcount(pcre16 *, int);
PCRE_EXP_DECL pcre_extra *pcre_study(const pcre *, int, const char **);
-PCRE_EXP_DECL pcre16_extra *pcre16_study(const pcre *, int, const char **);
+PCRE_EXP_DECL pcre16_extra *pcre16_study(const pcre16 *, int, const char **);
PCRE_EXP_DECL void pcre_free_study(pcre_extra *);
PCRE_EXP_DECL void pcre16_free_study(pcre16_extra *);
PCRE_EXP_DECL const char *pcre_version(void);
@@ -472,7 +479,7 @@
/* Utility functions for byte order swaps. */
PCRE_EXP_DECL int pcre_pattern_to_host_byte_order(pcre *, pcre_extra *,
const unsigned char *);
-PCRE_EXP_DECL int pcre16_pattern_to_host_byte_order(pcre *, pcre16_extra *,
+PCRE_EXP_DECL int pcre16_pattern_to_host_byte_order(pcre16 *, pcre16_extra *,
const unsigned char *);
PCRE_EXP_DECL int pcre16_utf16_to_host_byte_order(PCRE_SCHAR16 *,
PCRE_SPTR16, int, int *, int);
@@ -480,13 +487,13 @@
/* JIT compiler related functions. */
PCRE_EXP_DECL pcre_jit_stack *pcre_jit_stack_alloc(int, int);
-PCRE_EXP_DECL pcre_jit_stack *pcre16_jit_stack_alloc(int, int);
+PCRE_EXP_DECL pcre16_jit_stack *pcre16_jit_stack_alloc(int, int);
PCRE_EXP_DECL void pcre_jit_stack_free(pcre_jit_stack *);
-PCRE_EXP_DECL void pcre16_jit_stack_free(pcre_jit_stack *);
+PCRE_EXP_DECL void pcre16_jit_stack_free(pcre16_jit_stack *);
PCRE_EXP_DECL void pcre_assign_jit_stack(pcre_extra *,
pcre_jit_callback, void *);
PCRE_EXP_DECL void pcre16_assign_jit_stack(pcre16_extra *,
- pcre_jit_callback, void *);
+ pcre16_jit_callback, void *);
#ifdef __cplusplus
} /* extern "C" */
Modified: code/trunk/pcre_byte_order.c
===================================================================
--- code/trunk/pcre_byte_order.c 2012-01-05 17:57:28 UTC (rev 851)
+++ code/trunk/pcre_byte_order.c 2012-01-05 19:18:12 UTC (rev 852)
@@ -99,11 +99,11 @@
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(pcre *argument_re,
+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;
+REAL_PCRE *re = (REAL_PCRE *)argument_re;
pcre_study_data *study;
#ifndef COMPILE_PCRE8
pcre_uchar *ptr;
Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c 2012-01-05 17:57:28 UTC (rev 851)
+++ code/trunk/pcre_compile.c 2012-01-05 19:18:12 UTC (rev 852)
@@ -7563,7 +7563,7 @@
pcre_compile(const char *pattern, int options, const char **errorptr,
int *erroroffset, const unsigned char *tables)
#else
-PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION
+PCRE_EXP_DEFN pcre16 * PCRE_CALL_CONVENTION
pcre16_compile(PCRE_SPTR16 pattern, int options, const char **errorptr,
int *erroroffset, const unsigned char *tables)
#endif
@@ -7581,12 +7581,12 @@
pcre_compile2(const char *pattern, int options, int *errorcodeptr,
const char **errorptr, int *erroroffset, const unsigned char *tables)
#else
-PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION
+PCRE_EXP_DEFN pcre16 * PCRE_CALL_CONVENTION
pcre16_compile2(PCRE_SPTR16 pattern, int options, int *errorcodeptr,
const char **errorptr, int *erroroffset, const unsigned char *tables)
#endif
{
-real_pcre *re;
+REAL_PCRE *re;
int length = 1; /* For final END opcode */
pcre_int32 firstchar, reqchar;
int newline;
@@ -7848,8 +7848,8 @@
because nowadays we limit the maximum value of cd->names_found and
cd->name_entry_size. */
-size = sizeof(real_pcre) + (length + cd->names_found * cd->name_entry_size) * sizeof(pcre_uchar);
-re = (real_pcre *)(PUBL(malloc))(size);
+size = sizeof(REAL_PCRE) + (length + cd->names_found * cd->name_entry_size) * sizeof(pcre_uchar);
+re = (REAL_PCRE *)(PUBL(malloc))(size);
if (re == NULL)
{
@@ -7870,7 +7870,7 @@
re->dummy1 = 0;
re->first_char = 0;
re->req_char = 0;
-re->name_table_offset = sizeof(real_pcre) / sizeof(pcre_uchar);
+re->name_table_offset = sizeof(REAL_PCRE) / sizeof(pcre_uchar);
re->name_entry_size = cd->name_entry_size;
re->name_count = cd->names_found;
re->ref_count = 0;
@@ -8152,7 +8152,11 @@
}
#endif /* PCRE_DEBUG */
+#ifdef COMPILE_PCRE8
return (pcre *)re;
+#else
+return (pcre16 *)re;
+#endif
}
/* End of pcre_compile.c */
Modified: code/trunk/pcre_dfa_exec.c
===================================================================
--- code/trunk/pcre_dfa_exec.c 2012-01-05 17:57:28 UTC (rev 851)
+++ code/trunk/pcre_dfa_exec.c 2012-01-05 19:18:12 UTC (rev 852)
@@ -2557,7 +2557,11 @@
cb.version = 1; /* Version 1 of the callout block */
cb.callout_number = code[LINK_SIZE+2];
cb.offset_vector = offsets;
+#ifdef COMPILE_PCRE8
cb.subject = (PCRE_SPTR)start_subject;
+#else
+ cb.subject = (PCRE_SPTR16)start_subject;
+#endif
cb.subject_length = (int)(end_subject - start_subject);
cb.start_match = (int)(current_subject - start_subject);
cb.current_position = (int)(ptr - start_subject);
@@ -2896,7 +2900,11 @@
cb.version = 1; /* Version 1 of the callout block */
cb.callout_number = code[1];
cb.offset_vector = offsets;
+#ifdef COMPILE_PCRE8
cb.subject = (PCRE_SPTR)start_subject;
+#else
+ cb.subject = (PCRE_SPTR16)start_subject;
+#endif
cb.subject_length = (int)(end_subject - start_subject);
cb.start_match = (int)(current_subject - start_subject);
cb.current_position = (int)(ptr - start_subject);
@@ -3013,12 +3021,12 @@
int offsetcount, int *workspace, int wscount)
#else
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
-pcre16_dfa_exec(const pcre *argument_re, const pcre16_extra *extra_data,
+pcre16_dfa_exec(const pcre16 *argument_re, const pcre16_extra *extra_data,
PCRE_SPTR16 subject, int length, int start_offset, int options, int *offsets,
int offsetcount, int *workspace, int wscount)
#endif
{
-real_pcre *re = (real_pcre *)argument_re;
+REAL_PCRE *re = (REAL_PCRE *)argument_re;
dfa_match_data match_block;
dfa_match_data *md = &match_block;
BOOL utf, anchored, startline, firstline;
Modified: code/trunk/pcre_exec.c
===================================================================
--- code/trunk/pcre_exec.c 2012-01-05 17:57:28 UTC (rev 851)
+++ code/trunk/pcre_exec.c 2012-01-05 19:18:12 UTC (rev 852)
@@ -1227,7 +1227,11 @@
cb.version = 2; /* Version 1 of the callout block */
cb.callout_number = ecode[LINK_SIZE+2];
cb.offset_vector = md->offset_vector;
+#ifdef COMPILE_PCRE8
cb.subject = (PCRE_SPTR)md->start_subject;
+#else
+ cb.subject = (PCRE_SPTR16)md->start_subject;
+#endif
cb.subject_length = (int)(md->end_subject - md->start_subject);
cb.start_match = (int)(mstart - md->start_subject);
cb.current_position = (int)(eptr - md->start_subject);
@@ -1637,7 +1641,11 @@
cb.version = 2; /* Version 1 of the callout block */
cb.callout_number = ecode[1];
cb.offset_vector = md->offset_vector;
+#ifdef COMPILE_PCRE8
cb.subject = (PCRE_SPTR)md->start_subject;
+#else
+ cb.subject = (PCRE_SPTR16)md->start_subject;
+#endif
cb.subject_length = (int)(md->end_subject - md->start_subject);
cb.start_match = (int)(mstart - md->start_subject);
cb.current_position = (int)(eptr - md->start_subject);
@@ -6139,7 +6147,7 @@
int offsetcount)
#else
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
-pcre16_exec(const pcre *argument_re, const pcre16_extra *extra_data,
+pcre16_exec(const pcre16 *argument_re, const pcre16_extra *extra_data,
PCRE_SPTR16 subject, int length, int start_offset, int options, int *offsets,
int offsetcount)
#endif
@@ -6167,8 +6175,7 @@
PCRE_PUCHAR req_char_ptr = start_match - 1;
const pcre_study_data *study;
-const real_pcre *external_re = (const real_pcre *)argument_re;
-const real_pcre *re = external_re;
+const REAL_PCRE *re = (const REAL_PCRE *)argument_re;
/* Plausibility checks */
@@ -6255,7 +6262,7 @@
/* The table pointer is always in native byte order. */
-tables = external_re->tables;
+tables = re->tables;
if (extra_data != NULL)
{
@@ -6295,7 +6302,7 @@
/* The code starts after the real_pcre block and the capture name table. */
-md->start_code = (const pcre_uchar *)external_re + re->name_table_offset +
+md->start_code = (const pcre_uchar *)re + re->name_table_offset +
re->name_count * re->name_entry_size;
md->start_subject = (PCRE_PUCHAR)subject;
Modified: code/trunk/pcre_fullinfo.c
===================================================================
--- code/trunk/pcre_fullinfo.c 2012-01-05 17:57:28 UTC (rev 851)
+++ code/trunk/pcre_fullinfo.c 2012-01-05 19:18:12 UTC (rev 852)
@@ -67,15 +67,15 @@
#ifdef COMPILE_PCRE8
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
-pcre_fullinfo(const pcre *argument_re, const pcre_extra *extra_data, int what,
- void *where)
+pcre_fullinfo(const pcre *argument_re, const pcre_extra *extra_data,
+ int what, void *where)
#else
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
-pcre16_fullinfo(const pcre *argument_re, const pcre16_extra *extra_data, int what,
- void *where)
+pcre16_fullinfo(const pcre16 *argument_re, const pcre16_extra *extra_data,
+ int what, void *where)
#endif
{
-const real_pcre *re = (const real_pcre *)argument_re;
+const REAL_PCRE *re = (const REAL_PCRE *)argument_re;
const pcre_study_data *study = NULL;
if (re == NULL || where == NULL) return PCRE_ERROR_NULL;
Modified: code/trunk/pcre_get.c
===================================================================
--- code/trunk/pcre_get.c 2012-01-05 17:57:28 UTC (rev 851)
+++ code/trunk/pcre_get.c 2012-01-05 19:18:12 UTC (rev 852)
@@ -70,7 +70,7 @@
pcre_get_stringnumber(const pcre *code, const char *stringname)
#else
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
-pcre16_get_stringnumber(const pcre *code, PCRE_SPTR16 stringname)
+pcre16_get_stringnumber(const pcre16 *code, PCRE_SPTR16 stringname)
#endif
{
int rc;
@@ -138,7 +138,7 @@
char **firstptr, char **lastptr)
#else
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
-pcre16_get_stringtable_entries(const pcre *code, PCRE_SPTR16 stringname,
+pcre16_get_stringtable_entries(const pcre16 *code, PCRE_SPTR16 stringname,
PCRE_SCHAR16 **firstptr, PCRE_SCHAR16 **lastptr)
#endif
{
@@ -231,10 +231,10 @@
get_first_set(const pcre *code, const char *stringname, int *ovector)
#else
static int
-get_first_set(const pcre *code, PCRE_SPTR16 stringname, int *ovector)
+get_first_set(const pcre16 *code, PCRE_SPTR16 stringname, int *ovector)
#endif
{
-const real_pcre *re = (const real_pcre *)code;
+const REAL_PCRE *re = (const REAL_PCRE *)code;
int entrysize;
pcre_uchar *first, *last;
pcre_uchar *entry;
@@ -341,12 +341,14 @@
#ifdef COMPILE_PCRE8
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
-pcre_copy_named_substring(const pcre *code, const char *subject, int *ovector,
- int stringcount, const char *stringname, char *buffer, int size)
+pcre_copy_named_substring(const pcre *code, const char *subject,
+ int *ovector, int stringcount, const char *stringname,
+ char *buffer, int size)
#else
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
-pcre16_copy_named_substring(const pcre *code, PCRE_SPTR16 subject, int *ovector,
- int stringcount, PCRE_SPTR16 stringname, PCRE_SCHAR16 *buffer, int size)
+pcre16_copy_named_substring(const pcre16 *code, PCRE_SPTR16 subject,
+ int *ovector, int stringcount, PCRE_SPTR16 stringname,
+ PCRE_SCHAR16 *buffer, int size)
#endif
{
int n = get_first_set(code, stringname, ovector);
@@ -534,12 +536,14 @@
#ifdef COMPILE_PCRE8
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
-pcre_get_named_substring(const pcre *code, const char *subject, int *ovector,
- int stringcount, const char *stringname, const char **stringptr)
+pcre_get_named_substring(const pcre *code, const char *subject,
+ int *ovector, int stringcount, const char *stringname,
+ const char **stringptr)
#else
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
-pcre16_get_named_substring(const pcre *code, PCRE_SPTR16 subject, int *ovector,
- int stringcount, PCRE_SPTR16 stringname, PCRE_SPTR16 *stringptr)
+pcre16_get_named_substring(const pcre16 *code, PCRE_SPTR16 subject,
+ int *ovector, int stringcount, PCRE_SPTR16 stringname,
+ PCRE_SPTR16 *stringptr)
#endif
{
int n = get_first_set(code, stringname, ovector);
Modified: code/trunk/pcre_internal.h
===================================================================
--- code/trunk/pcre_internal.h 2012-01-05 17:57:28 UTC (rev 851)
+++ code/trunk/pcre_internal.h 2012-01-05 19:18:12 UTC (rev 852)
@@ -1958,7 +1958,13 @@
NOTE NOTE NOTE
*/
-typedef struct real_pcre {
+#ifdef COMPILE_PCRE8
+#define REAL_PCRE real_pcre
+#else
+#define REAL_PCRE real_pcre16
+#endif
+
+typedef struct REAL_PCRE {
pcre_uint32 magic_number;
pcre_uint32 size; /* Total that was malloced */
pcre_uint32 options; /* Public options */
@@ -1975,7 +1981,7 @@
const pcre_uint8 *tables; /* Pointer to tables or NULL for std */
const pcre_uint8 *nullpad; /* NULL padding */
-} real_pcre;
+} REAL_PCRE;
/* The format of the block used to store data from pcre_study(). The same
remark (see NOTE above) about extending this structure applies. */
@@ -2274,8 +2280,8 @@
extern BOOL PRIV(xclass)(int, const pcre_uchar *, BOOL);
#ifdef SUPPORT_JIT
-extern void PRIV(jit_compile)(const real_pcre *, PUBL(extra) *);
-extern int PRIV(jit_exec)(const real_pcre *, void *,
+extern void PRIV(jit_compile)(const REAL_PCRE *, PUBL(extra) *);
+extern int PRIV(jit_exec)(const REAL_PCRE *, void *,
const pcre_uchar *, int, int, int, int, int *, int);
extern void PRIV(jit_free)(void *);
extern int PRIV(jit_get_size)(void *);
Modified: code/trunk/pcre_jit_compile.c
===================================================================
--- code/trunk/pcre_jit_compile.c 2012-01-05 17:57:28 UTC (rev 851)
+++ code/trunk/pcre_jit_compile.c 2012-01-05 19:18:12 UTC (rev 852)
@@ -164,7 +164,7 @@
typedef struct executable_function {
void *executable_func;
- pcre_jit_callback callback;
+ PUBL(jit_callback) callback;
void *userdata;
sljit_uw executable_size;
} executable_function;
@@ -6354,7 +6354,7 @@
#undef CURRENT_AS
void
-PRIV(jit_compile)(const real_pcre *re, PUBL(extra) *extra)
+PRIV(jit_compile)(const REAL_PCRE *re, PUBL(extra) *extra)
{
struct sljit_compiler *compiler;
fallback_common rootfallback;
@@ -6741,7 +6741,7 @@
}
int
-PRIV(jit_exec)(const real_pcre *re, void *executable_func,
+PRIV(jit_exec)(const REAL_PCRE *re, void *executable_func,
const pcre_uchar *subject, int length, int start_offset, int options,
int match_limit, int *offsets, int offsetcount)
{
@@ -6814,7 +6814,7 @@
PCRE_EXP_DECL pcre_jit_stack *
pcre_jit_stack_alloc(int startsize, int maxsize)
#else
-PCRE_EXP_DECL pcre_jit_stack *
+PCRE_EXP_DECL pcre16_jit_stack *
pcre16_jit_stack_alloc(int startsize, int maxsize)
#endif
{
@@ -6824,7 +6824,7 @@
startsize = maxsize;
startsize = (startsize + STACK_GROWTH_RATE - 1) & ~(STACK_GROWTH_RATE - 1);
maxsize = (maxsize + STACK_GROWTH_RATE - 1) & ~(STACK_GROWTH_RATE - 1);
-return (pcre_jit_stack*)sljit_allocate_stack(startsize, maxsize);
+return (PUBL(jit_stack)*)sljit_allocate_stack(startsize, maxsize);
}
#ifdef COMPILE_PCRE8
@@ -6832,7 +6832,7 @@
pcre_jit_stack_free(pcre_jit_stack *stack)
#else
PCRE_EXP_DECL void
-pcre16_jit_stack_free(pcre_jit_stack *stack)
+pcre16_jit_stack_free(pcre16_jit_stack *stack)
#endif
{
sljit_free_stack((struct sljit_stack*)stack);
@@ -6843,7 +6843,7 @@
pcre_assign_jit_stack(pcre_extra *extra, pcre_jit_callback callback, void *userdata)
#else
PCRE_EXP_DECL void
-pcre16_assign_jit_stack(pcre16_extra *extra, pcre_jit_callback callback, void *userdata)
+pcre16_assign_jit_stack(pcre16_extra *extra, pcre16_jit_callback callback, void *userdata)
#endif
{
executable_function *function;
@@ -6866,7 +6866,7 @@
PCRE_EXP_DECL pcre_jit_stack *
pcre_jit_stack_alloc(int startsize, int maxsize)
#else
-PCRE_EXP_DECL pcre_jit_stack *
+PCRE_EXP_DECL pcre16_jit_stack *
pcre16_jit_stack_alloc(int startsize, int maxsize)
#endif
{
@@ -6880,7 +6880,7 @@
pcre_jit_stack_free(pcre_jit_stack *stack)
#else
PCRE_EXP_DECL void
-pcre16_jit_stack_free(pcre_jit_stack *stack)
+pcre16_jit_stack_free(pcre16_jit_stack *stack)
#endif
{
(void)stack;
@@ -6891,7 +6891,7 @@
pcre_assign_jit_stack(pcre_extra *extra, pcre_jit_callback callback, void *userdata)
#else
PCRE_EXP_DECL void
-pcre16_assign_jit_stack(pcre16_extra *extra, pcre_jit_callback callback, void *userdata)
+pcre16_assign_jit_stack(pcre16_extra *extra, pcre16_jit_callback callback, void *userdata)
#endif
{
(void)extra;
Modified: code/trunk/pcre_jit_test.c
===================================================================
--- code/trunk/pcre_jit_test.c 2012-01-05 17:57:28 UTC (rev 851)
+++ code/trunk/pcre_jit_test.c 2012-01-05 19:18:12 UTC (rev 852)
@@ -672,13 +672,14 @@
/* The purpose of this function to allow valgrind
for reporting invalid reads and writes. */
static unsigned char *tables_copy;
- pcre *regex;
const char *errorptr;
int erroroffset;
const unsigned char *default_tables;
#ifdef SUPPORT_PCRE8
+ pcre *regex;
char null_str[1] = { 0 };
#else
+ pcre16 *regex;
PCRE_SCHAR16 null_str[1] = { 0 };
#endif
@@ -720,11 +721,16 @@
return tables_copy;
}
-static pcre_jit_stack* callback(void *arg)
+static pcre_jit_stack* callback8(void *arg)
{
return (pcre_jit_stack *)arg;
}
+static pcre16_jit_stack* callback16(void *arg)
+{
+ return (pcre16_jit_stack *)arg;
+}
+
#ifdef SUPPORT_PCRE8
static void setstack8(pcre_extra *extra)
{
@@ -740,14 +746,14 @@
if (!stack)
stack = pcre_jit_stack_alloc(1, 1024 * 1024);
/* Extra can be NULL. */
- pcre_assign_jit_stack(extra, callback, stack);
+ pcre_assign_jit_stack(extra, callback8, stack);
}
#endif /* SUPPORT_PCRE8 */
#ifdef SUPPORT_PCRE16
static void setstack16(pcre16_extra *extra)
{
- static pcre_jit_stack *stack;
+ static pcre16_jit_stack *stack;
if (!extra) {
if (stack)
@@ -759,7 +765,7 @@
if (!stack)
stack = pcre16_jit_stack_alloc(1, 1024 * 1024);
/* Extra can be NULL. */
- pcre16_assign_jit_stack(extra, callback, stack);
+ pcre16_assign_jit_stack(extra, callback16, stack);
}
#endif /* SUPPORT_PCRE8 */
@@ -865,7 +871,7 @@
int disabled_flags8 = 0;
#endif
#ifdef SUPPORT_PCRE16
- pcre *re16;
+ pcre16 *re16;
pcre16_extra *extra16;
int ovector16_1[32];
int ovector16_2[32];
Modified: code/trunk/pcre_printint.c
===================================================================
--- code/trunk/pcre_printint.c 2012-01-05 17:57:28 UTC (rev 851)
+++ code/trunk/pcre_printint.c 2012-01-05 19:18:12 UTC (rev 852)
@@ -250,7 +250,7 @@
pcre16_printint(pcre *external_re, FILE *f, BOOL print_lengths)
#endif
{
-real_pcre *re = (real_pcre *)external_re;
+REAL_PCRE *re = (REAL_PCRE *)external_re;
pcre_uchar *codestart, *code;
BOOL utf;
Modified: code/trunk/pcre_refcount.c
===================================================================
--- code/trunk/pcre_refcount.c 2012-01-05 17:57:28 UTC (rev 851)
+++ code/trunk/pcre_refcount.c 2012-01-05 19:18:12 UTC (rev 852)
@@ -73,10 +73,10 @@
pcre_refcount(pcre *argument_re, int adjust)
#else
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
-pcre16_refcount(pcre *argument_re, int adjust)
+pcre16_refcount(pcre16 *argument_re, int adjust)
#endif
{
-real_pcre *re = (real_pcre *)argument_re;
+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;
Modified: code/trunk/pcre_study.c
===================================================================
--- code/trunk/pcre_study.c 2012-01-05 17:57:28 UTC (rev 851)
+++ code/trunk/pcre_study.c 2012-01-05 19:18:12 UTC (rev 852)
@@ -1317,7 +1317,7 @@
pcre_study(const pcre *external_re, int options, const char **errorptr)
#else
PCRE_EXP_DEFN pcre16_extra * PCRE_CALL_CONVENTION
-pcre16_study(const pcre *external_re, int options, const char **errorptr)
+pcre16_study(const pcre16 *external_re, int options, const char **errorptr)
#endif
{
int min;
@@ -1328,7 +1328,7 @@
const pcre_uint8 *tables;
pcre_uchar *code;
compile_data compile_block;
-const real_pcre *re = (const real_pcre *)external_re;
+const REAL_PCRE *re = (const REAL_PCRE *)external_re;
*errorptr = NULL;
Modified: code/trunk/pcretest.c
===================================================================
--- code/trunk/pcretest.c 2012-01-05 17:57:28 UTC (rev 851)
+++ code/trunk/pcretest.c 2012-01-05 19:18:12 UTC (rev 852)
@@ -209,12 +209,14 @@
#define READ_CAPTURE_NAME8(p, cn8, cn16, re) \
p = read_capture_name8(p, cn8, re)
+#define STRLEN8(p) ((int)strlen((char *)p))
+
#define SET_PCRE_CALLOUT8(callout) \
pcre_callout = callout
-#define STRLEN8(p) ((int)strlen((char *)p))
+#define PCRE_ASSIGN_JIT_STACK8(extra, callback, userdata) \
+ pcre_assign_jit_stack(extra, callback, userdata)
-
#define PCRE_COMPILE8(re, pat, options, error, erroffset, tables) \
re = pcre_compile((char *)pat, options, error, erroffset, tables)
@@ -268,6 +270,12 @@
#define PCRE_STUDY8(extra, re, options, error) \
extra = pcre_study(re, options, error)
+#define PCRE_JIT_STACK_ALLOC8(startsize, maxsize) \
+ pcre_jit_stack_alloc(startsize, maxsize)
+
+#define PCRE_JIT_STACK_FREE8(stack) \
+ pcre_jit_stack_free(stack)
+
#endif /* SUPPORT_PCRE8 */
/* -----------------------------------------------------------*/
@@ -288,14 +296,18 @@
#define SET_PCRE_CALLOUT16(callout) \
pcre16_callout = (int (*)(pcre16_callout_block *))callout
+#define PCRE_ASSIGN_JIT_STACK16(extra, callback, userdata) \
+ pcre16_assign_jit_stack((pcre16_extra *)extra, \
+ (pcre16_jit_callback)callback, userdata)
#define PCRE_COMPILE16(re, pat, options, error, erroffset, tables) \
- re = pcre16_compile((PCRE_SPTR16)pat, options, error, erroffset, tables)
+ re = (pcre *)pcre16_compile((PCRE_SPTR16)pat, options, error, erroffset, \
+ tables)
#define PCRE_COPY_NAMED_SUBSTRING16(rc, re, bptr, offsets, count, \
namesptr, cbuffer, size) \
- rc = pcre16_copy_named_substring(re, (PCRE_SPTR16)bptr, offsets, count, \
- (PCRE_SPTR16)namesptr, (PCRE_SCHAR16 *)cbuffer, size/2)
+ rc = pcre16_copy_named_substring((pcre16 *)re, (PCRE_SPTR16)bptr, offsets, \
+ count, (PCRE_SPTR16)namesptr, (PCRE_SCHAR16 *)cbuffer, size/2)
#define PCRE_COPY_SUBSTRING16(rc, bptr, offsets, count, i, cbuffer, size) \
rc = pcre16_copy_substring((PCRE_SPTR16)bptr, offsets, count, i, \
@@ -303,13 +315,14 @@
#define PCRE_DFA_EXEC16(count, re, extra, bptr, len, start_offset, options, \
offsets, size_offsets, workspace, size_workspace) \
- count = pcre16_dfa_exec(re, (pcre16_extra *)extra, (PCRE_SPTR16)bptr, len, \
- start_offset, options, offsets, size_offsets, workspace, size_workspace)
+ count = pcre16_dfa_exec((pcre16 *)re, (pcre16_extra *)extra, \
+ (PCRE_SPTR16)bptr, len, start_offset, options, offsets, size_offsets, \
+ workspace, size_workspace)
#define PCRE_EXEC16(count, re, extra, bptr, len, start_offset, options, \
offsets, size_offsets) \
- count = pcre16_exec(re, (pcre16_extra *)extra, (PCRE_SPTR16)bptr, len, \
- start_offset, options, offsets, size_offsets)
+ count = pcre16_exec((pcre16 *)re, (pcre16_extra *)extra, (PCRE_SPTR16)bptr, \
+ len, start_offset, options, offsets, size_offsets)
#define PCRE_FREE_STUDY16(extra) \
pcre16_free_study((pcre16_extra *)extra)
@@ -322,8 +335,8 @@
#define PCRE_GET_NAMED_SUBSTRING16(rc, re, bptr, offsets, count, \
getnamesptr, subsptr) \
- rc = pcre16_get_named_substring(re, (PCRE_SPTR16)bptr, offsets, count, \
- (PCRE_SPTR16)getnamesptr, (PCRE_SPTR16 *)(void*)subsptr)
+ rc = pcre16_get_named_substring((pcre16 *)re, (PCRE_SPTR16)bptr, offsets, \
+ count, (PCRE_SPTR16)getnamesptr, (PCRE_SPTR16 *)(void*)subsptr)
#define PCRE_GET_STRINGNUMBER16(n, rc, ptr) \
n = pcre16_get_stringnumber(re, (PCRE_SPTR16)ptr)
@@ -337,14 +350,21 @@
(PCRE_SPTR16 **)(void*)listptr)
#define PCRE_PATTERN_TO_HOST_BYTE_ORDER16(rc, re, extra, tables) \
- rc = pcre16_pattern_to_host_byte_order(re, (pcre16_extra *)extra, tables)
+ rc = pcre16_pattern_to_host_byte_order((pcre16 *)re, (pcre16_extra *)extra, \
+ tables)
#define PCRE_PRINTINT16(re, outfile, debug_lengths) \
pcre16_printint(re, outfile, debug_lengths)
#define PCRE_STUDY16(extra, re, options, error) \
- extra = (pcre_extra *)pcre16_study(re, options, error)
+ extra = (pcre_extra *)pcre16_study((pcre16 *)re, options, error)
+#define PCRE_JIT_STACK_ALLOC16(startsize, maxsize) \
+ (pcre_jit_stack *)pcre16_jit_stack_alloc(startsize, maxsize)
+
+#define PCRE_JIT_STACK_FREE16(stack) \
+ pcre16_jit_stack_free((pcre16_jit_stack *)stack)
+
#endif /* SUPPORT_PCRE16 */
@@ -382,7 +402,11 @@
#define STRLEN(p) (use_pcre16? STRLEN16(p) : STRLEN8(p))
-#define PCRE_ASSIGN_JIT_STACK pcre_assign_jit_stack
+#define PCRE_ASSIGN_JIT_STACK(extra, callback, userdata) \
+ if (use_pcre16) \
+ PCRE_ASSIGN_JIT_STACK16(extra, callback, userdata); \
+ else \
+ PCRE_ASSIGN_JIT_STACK8(extra, callback, userdata)
#define PCRE_COMPILE(re, pat, options, error, erroffset, tables) \
if (use_pcre16) \
@@ -470,9 +494,17 @@
else \
PCRE_GET_SUBSTRING_LIST8(rc, bptr, offsets, count, listptr)
-#define PCRE_JIT_STACK_ALLOC pcre_jit_stack_alloc
-#define PCRE_JIT_STACK_FREE pcre_jit_stack_free
+#define PCRE_JIT_STACK_ALLOC(startsize, maxsize) \
+ (use_pcre16 ? \
+ PCRE_JIT_STACK_ALLOC16(startsize, maxsize) \
+ :PCRE_JIT_STACK_ALLOC8(startsize, maxsize))
+#define PCRE_JIT_STACK_FREE(stack) \
+ if (use_pcre16) \
+ PCRE_JIT_STACK_FREE16(stack); \
+ else \
+ PCRE_JIT_STACK_FREE8(stack)
+
#define PCRE_MAKETABLES \
(use_pcre16? pcre16_maketables() : pcre_maketables())
@@ -503,7 +535,7 @@
#define READ_CAPTURE_NAME READ_CAPTURE_NAME8
#define SET_PCRE_CALLOUT SET_PCRE_CALLOUT8
#define STRLEN STRLEN8
-#define PCRE_ASSIGN_JIT_STACK pcre_assign_jit_stack
+#define PCRE_ASSIGN_JIT_STACK PCRE_ASSIGN_JIT_STACK8
#define PCRE_COMPILE PCRE_COMPILE8
#define PCRE_CONFIG pcre_config
#define PCRE_COPY_NAMED_SUBSTRING PCRE_COPY_NAMED_SUBSTRING8
@@ -517,8 +549,8 @@
#define PCRE_GET_STRINGNUMBER PCRE_GET_STRINGNUMBER8
#define PCRE_GET_SUBSTRING PCRE_GET_SUBSTRING8
#define PCRE_GET_SUBSTRING_LIST PCRE_GET_SUBSTRING_LIST8
-#define PCRE_JIT_STACK_ALLOC pcre_jit_stack_alloc
-#define PCRE_JIT_STACK_FREE pcre_jit_stack_free
+#define PCRE_JIT_STACK_ALLOC PCRE_JIT_STACK_ALLOC8
+#define PCRE_JIT_STACK_FREE PCRE_JIT_STACK_FREE8
#define PCRE_MAKETABLES pcre_maketables()
#define PCRE_PATTERN_TO_HOST_BYTE_ORDER PCRE_PATTERN_TO_HOST_BYTE_ORDER8
#define PCRE_PRINTINT PCRE_PRINTINT8
@@ -533,7 +565,7 @@
#define READ_CAPTURE_NAME READ_CAPTURE_NAME16
#define SET_PCRE_CALLOUT SET_PCRE_CALLOUT16
#define STRLEN STRLEN16
-#define PCRE_ASSIGN_JIT_STACK pcre16_assign_jit_stack
+#define PCRE_ASSIGN_JIT_STACK PCRE_ASSIGN_JIT_STACK16
#define PCRE_COMPILE PCRE_COMPILE16
#define PCRE_CONFIG pcre16_config
#define PCRE_COPY_NAMED_SUBSTRING PCRE_COPY_NAMED_SUBSTRING16
@@ -547,8 +579,8 @@
#define PCRE_GET_STRINGNUMBER PCRE_GET_STRINGNUMBER16
#define PCRE_GET_SUBSTRING PCRE_GET_SUBSTRING16
#define PCRE_GET_SUBSTRING_LIST PCRE_GET_SUBSTRING_LIST16
-#define PCRE_JIT_STACK_ALLOC pcre16_jit_stack_alloc
-#define PCRE_JIT_STACK_FREE pcre16_jit_stack_free
+#define PCRE_JIT_STACK_ALLOC PCRE_JIT_STACK_ALLOC16
+#define PCRE_JIT_STACK_FREE PCRE_JIT_STACK_FREE16
#define PCRE_MAKETABLES pcre16_maketables()
#define PCRE_PATTERN_TO_HOST_BYTE_ORDER PCRE_PATTERN_TO_HOST_BYTE_ORDER16
#define PCRE_PRINTINT PCRE_PRINTINT16
@@ -1513,7 +1545,7 @@
while (isalnum(*p)) *npp++ = *p++;
*npp++ = 0;
*npp = 0;
-if (pcre16_get_stringnumber(re, (PCRE_SPTR16)(*pp)) < 0)
+if (pcre16_get_stringnumber((pcre16 *)re, (PCRE_SPTR16)(*pp)) < 0)
{
fprintf(outfile, "no parentheses with name \"");
PCHARSV(*pp, 0, -1, outfile);
@@ -1702,7 +1734,7 @@
if (use_pcre16)
#ifdef SUPPORT_PCRE16
- rc = pcre16_fullinfo(re, (pcre16_extra *)study, option, ptr);
+ rc = pcre16_fullinfo((pcre16 *)re, (pcre16_extra *)study, option, ptr);
#else
rc = PCRE_ERROR_BADMODE;
#endif
@@ -1771,7 +1803,7 @@
static void
regexflip(pcre *ere, pcre_extra *extra)
{
-real_pcre *re = (real_pcre *)ere;
+REAL_PCRE *re = (REAL_PCRE *)ere;
#ifdef SUPPORT_PCRE16
int op;
pcre_uint16 *ptr = (pcre_uint16 *)re + re->name_table_offset;
@@ -2553,12 +2585,12 @@
true_study_size =
(sbuf[4] << 24) | (sbuf[5] << 16) | (sbuf[6] << 8) | sbuf[7];
- re = (real_pcre *)new_malloc(true_size);
+ re = (pcre *)new_malloc(true_size);
regex_gotten_store = first_gotten_store;
if (fread(re, 1, true_size, f) != true_size) goto FAIL_READ;
- magic = ((real_pcre *)re)->magic_number;
+ magic = ((REAL_PCRE *)re)->magic_number;
if (magic != MAGIC_NUMBER)
{
if (swap_uint32(magic) == MAGIC_NUMBER)
@@ -2938,7 +2970,7 @@
/* Extract the size for possible writing before possibly flipping it,
and remember the store that was got. */
- true_size = ((real_pcre *)re)->size;
+ true_size = ((REAL_PCRE *)re)->size;
regex_gotten_store = first_gotten_store;
/* Output code size information if requested */
@@ -2946,8 +2978,8 @@
if (log_store)
fprintf(outfile, "Memory allocation (code space): %d\n",
(int)(first_gotten_store -
- sizeof(real_pcre) -
- ((real_pcre *)re)->name_count * ((real_pcre *)re)->name_entry_size));
+ sizeof(REAL_PCRE) -
+ ((REAL_PCRE *)re)->name_count * ((REAL_PCRE *)re)->name_entry_size));
/* If -s or /S was present, study the regex to generate additional info to
help with the matching, unless the pattern has the SS option, which
@@ -3078,7 +3110,7 @@
if (!okpartial) fprintf(outfile, "Partial matching not supported\n");
if (hascrorlf) fprintf(outfile, "Contains explicit CR or LF match\n");
- all_options = ((real_pcre *)re)->options;
+ all_options = ((REAL_PCRE *)re)->options;
if (do_flip) all_options = swap_uint32(all_options);
if (get_options == 0) fprintf(outfile, "No options\n");
@@ -3140,7 +3172,7 @@
else
{
const char *caseless =
- ((((real_pcre *)re)->flags & PCRE_FCH_CASELESS) == 0)?
+ ((((REAL_PCRE *)re)->flags & PCRE_FCH_CASELESS) == 0)?
"" : " (caseless)";
if (PRINTOK(first_char))
@@ -3160,7 +3192,7 @@
else
{
const char *caseless =
- ((((real_pcre *)re)->flags & PCRE_RCH_CASELESS) == 0)?
+ ((((REAL_PCRE *)re)->flags & PCRE_RCH_CASELESS) == 0)?
"" : " (caseless)";
if (PRINTOK(need_char))
@@ -3563,7 +3595,7 @@
&& (extra->flags & PCRE_EXTRA_EXECUTABLE_JIT) != 0
&& extra->executable_jit != NULL)
{
- if (jit_stack != NULL) PCRE_JIT_STACK_FREE(jit_stack);
+ if (jit_stack != NULL) { PCRE_JIT_STACK_FREE(jit_stack); }
jit_stack = PCRE_JIT_STACK_ALLOC(1, n * 1024);
PCRE_ASSIGN_JIT_STACK(extra, jit_callback, jit_stack);
}
@@ -3778,7 +3810,7 @@
#ifdef SUPPORT_PCRE16
if (use_pcre16)
{
- len = to16(TRUE, bptr, (((real_pcre *)re)->options) & PCRE_UTF8, len);
+ len = to16(TRUE, bptr, (((REAL_PCRE *)re)->options) & PCRE_UTF8, len);
switch(len)
{
case -1:
@@ -4158,7 +4190,7 @@
if (g_notempty != 0)
{
int onechar = 1;
- unsigned int obits = ((real_pcre *)re)->options;
+ unsigned int obits = ((REAL_PCRE *)re)->options;
use_offsets[0] = start_offset;
if ((obits & PCRE_NEWLINE_BITS) == 0)
{