[Pcre-svn] [850] code/trunk: add pcre16_callout_block and pc…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [850] code/trunk: add pcre16_callout_block and pcre16_extra
Revision: 850
          http://vcs.pcre.org/viewvc?view=rev&revision=850
Author:   zherczeg
Date:     2012-01-04 17:29:11 +0000 (Wed, 04 Jan 2012)


Log Message:
-----------
add pcre16_callout_block and pcre16_extra

Modified Paths:
--------------
    code/trunk/pcre.h.in
    code/trunk/pcre_byte_order.c
    code/trunk/pcre_dfa_exec.c
    code/trunk/pcre_exec.c
    code/trunk/pcre_fullinfo.c
    code/trunk/pcre_globals.c
    code/trunk/pcre_internal.h
    code/trunk/pcre_jit_compile.c
    code/trunk/pcre_jit_test.c
    code/trunk/pcre_study.c
    code/trunk/pcretest.c
    code/trunk/sljit/sljitLir.h
    code/trunk/sljit/sljitNativeARM_Thumb2.c
    code/trunk/sljit/sljitNativeARM_v5.c


Modified: code/trunk/pcre.h.in
===================================================================
--- code/trunk/pcre.h.in    2012-01-04 17:02:01 UTC (rev 849)
+++ code/trunk/pcre.h.in    2012-01-04 17:29:11 UTC (rev 850)
@@ -255,7 +255,7 @@


 #define PCRE_STUDY_JIT_COMPILE            0x0001


-/* Bit flags for the pcre_extra structure. Do not re-arrange or redefine
+/* Bit flags for the pcre[16]_extra structure. Do not re-arrange or redefine
these bits, just add new ones on the end, in order to remain compatible. */

 #define PCRE_EXTRA_STUDY_DATA             0x0001
@@ -308,6 +308,19 @@
   void *executable_jit;           /* Contains a pointer to a compiled jit code */
 } pcre_extra;


+/* Same structure as above, but with 16 bit char pointers. */
+
+typedef struct pcre16_extra {
+  unsigned long int flags;        /* Bits for which fields are set */
+  void *study_data;               /* Opaque data from pcre_study() */
+  unsigned long int match_limit;  /* Maximum number of calls to match() */
+  void *callout_data;             /* Data passed back in callouts */
+  const unsigned char *tables;    /* Pointer to character tables */
+  unsigned long int match_limit_recursion; /* Max recursive calls to match() */
+  PCRE_SCHAR16 **mark;            /* For passing back a mark pointer */
+  void *executable_jit;           /* Contains a pointer to a compiled jit code */
+} pcre16_extra;
+
 /* The structure for passing out data via the pcre_callout_function. We use a
 structure so that new fields can be added on the end in future versions,
 without changing the API of the function, thereby allowing old clients to work
@@ -329,10 +342,32 @@
   int          pattern_position;  /* Offset to next item in the pattern */
   int          next_item_length;  /* Length of next item in the pattern */
   /* ------------------- Added for Version 2 -------------------------- */
-  const void  *mark;              /* Pointer to current mark or NULL    */
+  const unsigned char *mark;      /* Pointer to current mark or NULL    */
   /* ------------------------------------------------------------------ */
 } pcre_callout_block;


+/* Same structure as above, but with 16 bit char pointers. */
+
+typedef struct pcre16_callout_block {
+  int          version;           /* Identifies version of block */
+  /* ------------------------ Version 0 ------------------------------- */
+  int          callout_number;    /* Number compiled into pattern */
+  int         *offset_vector;     /* The offset vector */
+  PCRE_SPTR    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 */
+  int          capture_top;       /* Max current capture */
+  int          capture_last;      /* Most recently closed capture */
+  void        *callout_data;      /* Data passed in with the call */
+  /* ------------------- Added for Version 1 -------------------------- */
+  int          pattern_position;  /* Offset to next item in the pattern */
+  int          next_item_length;  /* Length of next item in the pattern */
+  /* ------------------- Added for Version 2 -------------------------- */
+  const PCRE_SCHAR16 *mark;       /* Pointer to current mark or NULL    */
+  /* ------------------------------------------------------------------ */
+} pcre16_callout_block;
+
 /* Indirection for store get and free functions. These can be set to
 alternative malloc/free functions if required. Special ones are used in the
 non-recursive case for "frames". There is also an optional callout function
@@ -350,7 +385,7 @@
 PCRE_EXP_DECL void  (*pcre16_free)(void *);
 PCRE_EXP_DECL void *(*pcre16_stack_malloc)(size_t);
 PCRE_EXP_DECL void  (*pcre16_stack_free)(void *);
-PCRE_EXP_DECL int   (*pcre16_callout)(pcre_callout_block *);
+PCRE_EXP_DECL int   (*pcre16_callout)(pcre16_callout_block *);
 #else   /* VPCOMPAT */
 PCRE_EXP_DECL void *pcre_malloc(size_t);
 PCRE_EXP_DECL void  pcre_free(void *);
@@ -362,7 +397,7 @@
 PCRE_EXP_DECL void  pcre16_free(void *);
 PCRE_EXP_DECL void *pcre16_stack_malloc(size_t);
 PCRE_EXP_DECL void  pcre16_stack_free(void *);
-PCRE_EXP_DECL int   pcre16_callout(pcre_callout_block *);
+PCRE_EXP_DECL int   pcre16_callout(pcre16_callout_block *);
 #endif  /* VPCOMPAT */


 /* User defined callback which provides a stack just before the match starts. */
@@ -391,11 +426,11 @@
                   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 pcre_extra *,
+PCRE_EXP_DECL int  pcre16_dfa_exec(const pcre *, 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 pcre_extra *, PCRE_SPTR16,
+PCRE_EXP_DECL int  pcre16_exec(const pcre *, 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);
@@ -403,7 +438,7 @@
 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 pcre_extra *, int,
+PCRE_EXP_DECL int  pcre16_fullinfo(const pcre *, const pcre16_extra *, int,
                   void *);
 PCRE_EXP_DECL int  pcre_get_named_substring(const pcre *, const char *,
                   int *, int, const char *, const char **);
@@ -428,16 +463,16 @@
 PCRE_EXP_DECL int  pcre_refcount(pcre *, int);
 PCRE_EXP_DECL int  pcre16_refcount(pcre *, int);
 PCRE_EXP_DECL pcre_extra *pcre_study(const pcre *, int, const char **);
-PCRE_EXP_DECL pcre_extra *pcre16_study(const pcre *, int, const char **);
+PCRE_EXP_DECL pcre16_extra *pcre16_study(const pcre *, int, const char **);
 PCRE_EXP_DECL void pcre_free_study(pcre_extra *);
-PCRE_EXP_DECL void pcre16_free_study(pcre_extra *);
+PCRE_EXP_DECL void pcre16_free_study(pcre16_extra *);
 PCRE_EXP_DECL const char *pcre_version(void);
 PCRE_EXP_DECL const char *pcre16_version(void);


 /* 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 *, pcre_extra *,
+PCRE_EXP_DECL int  pcre16_pattern_to_host_byte_order(pcre *, pcre16_extra *,
                   const unsigned char *);
 PCRE_EXP_DECL int  pcre16_utf16_to_host_byte_order(PCRE_SCHAR16 *,
                   PCRE_SPTR16, int, int *, int);
@@ -450,7 +485,7 @@
 PCRE_EXP_DECL void pcre16_jit_stack_free(pcre_jit_stack *);
 PCRE_EXP_DECL void pcre_assign_jit_stack(pcre_extra *,
                   pcre_jit_callback, void *);
-PCRE_EXP_DECL void pcre16_assign_jit_stack(pcre_extra *,
+PCRE_EXP_DECL void pcre16_assign_jit_stack(pcre16_extra *,
                   pcre_jit_callback, void *);


#ifdef __cplusplus

Modified: code/trunk/pcre_byte_order.c
===================================================================
--- code/trunk/pcre_byte_order.c    2012-01-04 17:02:01 UTC (rev 849)
+++ code/trunk/pcre_byte_order.c    2012-01-04 17:29:11 UTC (rev 850)
@@ -100,7 +100,7 @@
   pcre_extra *extra_data, const unsigned char *tables)
 #else
 PCRE_EXP_DECL int pcre16_pattern_to_host_byte_order(pcre *argument_re,
-  pcre_extra *extra_data, const unsigned char *tables)
+  pcre16_extra *extra_data, const unsigned char *tables)
 #endif
 {
 real_pcre *re = (real_pcre *)argument_re;


Modified: code/trunk/pcre_dfa_exec.c
===================================================================
--- code/trunk/pcre_dfa_exec.c    2012-01-04 17:02:01 UTC (rev 849)
+++ code/trunk/pcre_dfa_exec.c    2012-01-04 17:29:11 UTC (rev 850)
@@ -2553,7 +2553,7 @@
           rrc = 0;
           if (PUBL(callout) != NULL)
             {
-            pcre_callout_block cb;
+            PUBL(callout_block) cb;
             cb.version          = 1;   /* Version 1 of the callout block */
             cb.callout_number   = code[LINK_SIZE+2];
             cb.offset_vector    = offsets;
@@ -2892,7 +2892,7 @@
       rrc = 0;
       if (PUBL(callout) != NULL)
         {
-        pcre_callout_block cb;
+        PUBL(callout_block) cb;
         cb.version          = 1;   /* Version 1 of the callout block */
         cb.callout_number   = code[1];
         cb.offset_vector    = offsets;
@@ -3013,7 +3013,7 @@
   int offsetcount, int *workspace, int wscount)
 #else
 PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
-pcre16_dfa_exec(const pcre *argument_re, const pcre_extra *extra_data,
+pcre16_dfa_exec(const pcre *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


Modified: code/trunk/pcre_exec.c
===================================================================
--- code/trunk/pcre_exec.c    2012-01-04 17:02:01 UTC (rev 849)
+++ code/trunk/pcre_exec.c    2012-01-04 17:29:11 UTC (rev 850)
@@ -1223,7 +1223,7 @@
       {
       if (PUBL(callout) != NULL)
         {
-        pcre_callout_block cb;
+        PUBL(callout_block) cb;
         cb.version          = 2;   /* Version 1 of the callout block */
         cb.callout_number   = ecode[LINK_SIZE+2];
         cb.offset_vector    = md->offset_vector;
@@ -1633,7 +1633,7 @@
     case OP_CALLOUT:
     if (PUBL(callout) != NULL)
       {
-      pcre_callout_block cb;
+      PUBL(callout_block) cb;
       cb.version          = 2;   /* Version 1 of the callout block */
       cb.callout_number   = ecode[1];
       cb.offset_vector    = md->offset_vector;
@@ -6139,7 +6139,7 @@
   int offsetcount)
 #else
 PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
-pcre16_exec(const pcre *argument_re, const pcre_extra *extra_data,
+pcre16_exec(const pcre *argument_re, const pcre16_extra *extra_data,
   PCRE_SPTR16 subject, int length, int start_offset, int options, int *offsets,
   int offsetcount)
 #endif
@@ -6858,7 +6858,7 @@
   /* Return MARK data if requested */


   if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_MARK) != 0)
-    *(extra_data->mark) = (unsigned char *)(md->mark);
+    *(extra_data->mark) = (pcre_uchar *)md->mark;
   DPRINTF((">>>> returning %d\n", rc));
   return rc;
   }
@@ -6905,7 +6905,7 @@
 /* Return the MARK data if it has been requested. */


if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_MARK) != 0)
- *(extra_data->mark) = (unsigned char *)(md->nomatch_mark);
+ *(extra_data->mark) = (pcre_uchar *)md->nomatch_mark;
return rc;
}


Modified: code/trunk/pcre_fullinfo.c
===================================================================
--- code/trunk/pcre_fullinfo.c    2012-01-04 17:02:01 UTC (rev 849)
+++ code/trunk/pcre_fullinfo.c    2012-01-04 17:29:11 UTC (rev 850)
@@ -71,7 +71,7 @@
   void *where)
 #else
 PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
-pcre16_fullinfo(const pcre *argument_re, const pcre_extra *extra_data, int what,
+pcre16_fullinfo(const pcre *argument_re, const pcre16_extra *extra_data, int what,
   void *where)
 #endif
 {


Modified: code/trunk/pcre_globals.c
===================================================================
--- code/trunk/pcre_globals.c    2012-01-04 17:02:01 UTC (rev 849)
+++ code/trunk/pcre_globals.c    2012-01-04 17:29:11 UTC (rev 850)
@@ -71,14 +71,14 @@
 PCRE_EXP_DATA_DEFN void  (*PUBL(free))(void *) = LocalPcreFree;
 PCRE_EXP_DATA_DEFN void *(*PUBL(stack_malloc))(size_t) = LocalPcreMalloc;
 PCRE_EXP_DATA_DEFN void  (*PUBL(stack_free))(void *) = LocalPcreFree;
-PCRE_EXP_DATA_DEFN int   (*PUBL(callout))(pcre_callout_block *) = NULL;
+PCRE_EXP_DATA_DEFN int   (*PUBL(callout))(PUBL(callout_block) *) = NULL;


#elif !defined VPCOMPAT
PCRE_EXP_DATA_DEFN void *(*PUBL(malloc))(size_t) = malloc;
PCRE_EXP_DATA_DEFN void (*PUBL(free))(void *) = free;
PCRE_EXP_DATA_DEFN void *(*PUBL(stack_malloc))(size_t) = malloc;
PCRE_EXP_DATA_DEFN void (*PUBL(stack_free))(void *) = free;
-PCRE_EXP_DATA_DEFN int (*PUBL(callout))(pcre_callout_block *) = NULL;
+PCRE_EXP_DATA_DEFN int (*PUBL(callout))(PUBL(callout_block) *) = NULL;
#endif

/* End of pcre_globals.c */

Modified: code/trunk/pcre_internal.h
===================================================================
--- code/trunk/pcre_internal.h    2012-01-04 17:02:01 UTC (rev 849)
+++ code/trunk/pcre_internal.h    2012-01-04 17:29:11 UTC (rev 850)
@@ -2274,7 +2274,7 @@
 extern BOOL              PRIV(xclass)(int, const pcre_uchar *, BOOL);


 #ifdef SUPPORT_JIT
-extern void              PRIV(jit_compile)(const real_pcre *, pcre_extra *);
+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 *);


Modified: code/trunk/pcre_jit_compile.c
===================================================================
--- code/trunk/pcre_jit_compile.c    2012-01-04 17:02:01 UTC (rev 849)
+++ code/trunk/pcre_jit_compile.c    2012-01-04 17:29:11 UTC (rev 850)
@@ -6354,7 +6354,7 @@
 #undef CURRENT_AS


void
-PRIV(jit_compile)(const real_pcre *re, pcre_extra *extra)
+PRIV(jit_compile)(const real_pcre *re, PUBL(extra) *extra)
{
struct sljit_compiler *compiler;
fallback_common rootfallback;
@@ -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(pcre_extra *extra, pcre_jit_callback callback, void *userdata)
+pcre16_assign_jit_stack(pcre16_extra *extra, pcre_jit_callback callback, void *userdata)
#endif
{
executable_function *function;
@@ -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(pcre_extra *extra, pcre_jit_callback callback, void *userdata)
+pcre16_assign_jit_stack(pcre16_extra *extra, pcre_jit_callback callback, void *userdata)
#endif
{
(void)extra;

Modified: code/trunk/pcre_jit_test.c
===================================================================
--- code/trunk/pcre_jit_test.c    2012-01-04 17:02:01 UTC (rev 849)
+++ code/trunk/pcre_jit_test.c    2012-01-04 17:29:11 UTC (rev 850)
@@ -745,7 +745,7 @@
 #endif /* SUPPORT_PCRE8 */


 #ifdef SUPPORT_PCRE16
-static void setstack16(pcre_extra *extra)
+static void setstack16(pcre16_extra *extra)
 {
     static pcre_jit_stack *stack;


@@ -866,7 +866,7 @@
 #endif
 #ifdef SUPPORT_PCRE16
     pcre *re16;
-    pcre_extra *extra16;
+    pcre16_extra *extra16;
     int ovector16_1[32];
     int ovector16_2[32];
     int return_value16_1, return_value16_2;


Modified: code/trunk/pcre_study.c
===================================================================
--- code/trunk/pcre_study.c    2012-01-04 17:02:01 UTC (rev 849)
+++ code/trunk/pcre_study.c    2012-01-04 17:29:11 UTC (rev 850)
@@ -1298,7 +1298,7 @@
 *************************************************/


/* This function is handed a compiled expression that it must study to produce
-information that will speed up the matching. It returns a pcre_extra block
+information that will speed up the matching. It returns a pcre[16]_extra block
which then gets handed back to pcre_exec().

 Arguments:
@@ -1307,8 +1307,8 @@
   errorptr  points to where to place error messages;
             set NULL unless error


-Returns:    pointer to a pcre_extra block, with study_data filled in and the
-              appropriate flags set;
+Returns:    pointer to a pcre[16]_extra block, with study_data filled in and
+              the appropriate flags set;
             NULL on error or if no optimization possible
 */


@@ -1316,14 +1316,14 @@
PCRE_EXP_DEFN pcre_extra * PCRE_CALL_CONVENTION
pcre_study(const pcre *external_re, int options, const char **errorptr)
#else
-PCRE_EXP_DEFN pcre_extra * PCRE_CALL_CONVENTION
+PCRE_EXP_DEFN pcre16_extra * PCRE_CALL_CONVENTION
pcre16_study(const pcre *external_re, int options, const char **errorptr)
#endif
{
int min;
BOOL bits_set = FALSE;
pcre_uint8 start_bits[32];
-pcre_extra *extra = NULL;
+PUBL(extra) *extra = NULL;
pcre_study_data *study;
const pcre_uint8 *tables;
pcre_uchar *code;
@@ -1408,13 +1408,13 @@
}

/* If a set of starting bytes has been identified, or if the minimum length is
-greater than zero, or if JIT optimization has been requested, get a pcre_extra
-block and a pcre_study_data block. The study data is put in the latter, which
-is pointed to by the former, which may also get additional data set later by
-the calling program. At the moment, the size of pcre_study_data is fixed. We
-nevertheless save it in a field for returning via the pcre_fullinfo() function
-so that if it becomes variable in the future, we don't have to change that
-code. */
+greater than zero, or if JIT optimization has been requested, get a
+pcre[16]_extra block and a pcre_study_data block. The study data is put in the
+latter, which is pointed to by the former, which may also get additional data
+set later by the calling program. At the moment, the size of pcre_study_data
+is fixed. We nevertheless save it in a field for returning via the
+pcre_fullinfo() function so that if it becomes variable in the future,
+we don't have to change that code. */

 if (bits_set || min > 0
 #ifdef SUPPORT_JIT
@@ -1422,15 +1422,15 @@
 #endif
   )
   {
-  extra = (pcre_extra *)(PUBL(malloc))
-    (sizeof(pcre_extra) + sizeof(pcre_study_data));
+  extra = (PUBL(extra) *)(PUBL(malloc))
+    (sizeof(PUBL(extra)) + sizeof(pcre_study_data));
   if (extra == NULL)
     {
     *errorptr = "failed to get memory";
     return NULL;
     }


- study = (pcre_study_data *)((char *)extra + sizeof(pcre_extra));
+ study = (pcre_study_data *)((char *)extra + sizeof(PUBL(extra)));
extra->flags = PCRE_EXTRA_STUDY_DATA;
extra->study_data = study;

@@ -1502,7 +1502,7 @@

/* This function frees the memory that was obtained by pcre_study().

-Argument:   a pointer to the pcre_extra block
+Argument:   a pointer to the pcre[16]_extra block
 Returns:    nothing
 */


@@ -1511,7 +1511,7 @@
pcre_free_study(pcre_extra *extra)
#else
PCRE_EXP_DEFN void
-pcre16_free_study(pcre_extra *extra)
+pcre16_free_study(pcre16_extra *extra)
#endif
{
if (extra == NULL)

Modified: code/trunk/pcretest.c
===================================================================
--- code/trunk/pcretest.c    2012-01-04 17:02:01 UTC (rev 849)
+++ code/trunk/pcretest.c    2012-01-04 17:29:11 UTC (rev 850)
@@ -286,7 +286,7 @@
 #define STRLEN16(p) ((int)strlen16((PCRE_SPTR16)p))


#define SET_PCRE_CALLOUT16(callout) \
- pcre16_callout = callout
+ pcre16_callout = (int (*)(pcre16_callout_block *))callout


#define PCRE_COMPILE16(re, pat, options, error, erroffset, tables) \
@@ -303,16 +303,16 @@

 #define PCRE_DFA_EXEC16(count, re, extra, bptr, len, start_offset, options, \
     offsets, size_offsets, workspace, size_workspace) \
-  count = pcre16_dfa_exec(re, extra, (PCRE_SPTR16)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)


 #define PCRE_EXEC16(count, re, extra, bptr, len, start_offset, options, \
     offsets, size_offsets) \
-  count = pcre16_exec(re, extra, (PCRE_SPTR16)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)


#define PCRE_FREE_STUDY16(extra) \
- pcre16_free_study(extra)
+ pcre16_free_study((pcre16_extra *)extra)

 #define PCRE_FREE_SUBSTRING16(substring) \
   pcre16_free_substring((PCRE_SPTR16)substring)
@@ -337,13 +337,13 @@
     (PCRE_SPTR16 **)(void*)listptr)


#define PCRE_PATTERN_TO_HOST_BYTE_ORDER16(rc, re, extra, tables) \
- rc = pcre16_pattern_to_host_byte_order(re, extra, tables)
+ rc = pcre16_pattern_to_host_byte_order(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 = pcre16_study(re, options, error)
+ extra = (pcre_extra *)pcre16_study(re, options, error)

#endif /* SUPPORT_PCRE16 */

@@ -1702,7 +1702,7 @@

if (use_pcre16)
#ifdef SUPPORT_PCRE16
- rc = pcre16_fullinfo(re, study, option, ptr);
+ rc = pcre16_fullinfo(re, (pcre16_extra *)study, option, ptr);
#else
rc = PCRE_ERROR_BADMODE;
#endif

Modified: code/trunk/sljit/sljitLir.h
===================================================================
--- code/trunk/sljit/sljitLir.h    2012-01-04 17:02:01 UTC (rev 849)
+++ code/trunk/sljit/sljitLir.h    2012-01-04 17:29:11 UTC (rev 850)
@@ -462,14 +462,14 @@
    Result goes to SLJIT_TEMPORARY_REG2:SLJIT_TEMPORARY_REG1 (high:low) word */
 #define SLJIT_SMUL            3
 /* Flags: I | may destroy flags
-   Unsigned divide the value in SLJIT_TEMPORARY_REG1 by SLJIT_TEMPORARY_REG2.
-   Result goes to SLJIT_TEMPORARY_REG1 and remainder goes to SLJIT_TEMPORARY_REG2.
-   Note: if SLJIT_TEMPORARY_REG2 is equal to 0, the behaviour is undefined. */
+   Unsigned divide of the value in SLJIT_TEMPORARY_REG1 by the value in SLJIT_TEMPORARY_REG2.
+   The result is placed in SLJIT_TEMPORARY_REG1 and the remainder goes to SLJIT_TEMPORARY_REG2.
+   Note: if SLJIT_TEMPORARY_REG2 contains 0, the behaviour is undefined. */
 #define SLJIT_UDIV            4
 /* Flags: I | may destroy flags
-   Signed divide the value in SLJIT_TEMPORARY_REG1 by SLJIT_TEMPORARY_REG2.
-   Result goes to SLJIT_TEMPORARY_REG1 and remainder goes to SLJIT_TEMPORARY_REG2.
-   Note: if SLJIT_TEMPORARY_REG2 is equal to 0, the behaviour is undefined. */
+   Signed divide of the value in SLJIT_TEMPORARY_REG1 by the value in SLJIT_TEMPORARY_REG2.
+   The result is placed in SLJIT_TEMPORARY_REG1 and the remainder goes to SLJIT_TEMPORARY_REG2.
+   Note: if SLJIT_TEMPORARY_REG2 contains 0, the behaviour is undefined. */
 #define SLJIT_SDIV            5


SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op0(struct sljit_compiler *compiler, int op);

Modified: code/trunk/sljit/sljitNativeARM_Thumb2.c
===================================================================
--- code/trunk/sljit/sljitNativeARM_Thumb2.c    2012-01-04 17:02:01 UTC (rev 849)
+++ code/trunk/sljit/sljitNativeARM_Thumb2.c    2012-01-04 17:29:11 UTC (rev 850)
@@ -1226,16 +1226,23 @@
             | reg_map[SLJIT_TEMPORARY_REG2]);
     case SLJIT_UDIV:
     case SLJIT_SDIV:
-        FAIL_IF(push_inst32(compiler, 0xf84d2d04 /* str r2, [sp, #-4]! */));
-        FAIL_IF(push_inst32(compiler, 0xf84dcd04 /* str ip, [sp, #-4]! */));
+        if (compiler->temporaries >= 4) {
+            FAIL_IF(push_inst32(compiler, 0xf84d2d04 /* str r2, [sp, #-4]! */));
+            FAIL_IF(push_inst32(compiler, 0xf84dcd04 /* str ip, [sp, #-4]! */));
+        } else if (compiler->temporaries >= 3)
+            FAIL_IF(push_inst32(compiler, 0xf84d2d08 /* str r2, [sp, #-8]! */));
 #if defined(__GNUC__)
         FAIL_IF(sljit_emit_ijump(compiler, SLJIT_FAST_CALL, SLJIT_IMM,
             (op == SLJIT_UDIV ? SLJIT_FUNC_OFFSET(__aeabi_uidivmod) : SLJIT_FUNC_OFFSET(__aeabi_idivmod))));
 #else
 #error "Software divmod functions are needed"
 #endif
-        FAIL_IF(push_inst32(compiler, 0xf85dcb04 /* ldr ip, [sp], #4 */));
-        return push_inst32(compiler, 0xf85d2b04 /* ldr r2, [sp], #4 */);
+        if (compiler->temporaries >= 4) {
+            FAIL_IF(push_inst32(compiler, 0xf85dcb04 /* ldr ip, [sp], #4 */));
+            return push_inst32(compiler, 0xf85d2b04 /* ldr r2, [sp], #4 */);
+        } else if (compiler->temporaries >= 3)
+            return push_inst32(compiler, 0xf85d2b08 /* ldr r2, [sp], #8 */);
+        return SLJIT_SUCCESS;
     }


     return SLJIT_SUCCESS;


Modified: code/trunk/sljit/sljitNativeARM_v5.c
===================================================================
--- code/trunk/sljit/sljitNativeARM_v5.c    2012-01-04 17:02:01 UTC (rev 849)
+++ code/trunk/sljit/sljitNativeARM_v5.c    2012-01-04 17:29:11 UTC (rev 850)
@@ -1802,14 +1802,17 @@
 #endif
     case SLJIT_UDIV:
     case SLJIT_SDIV:
-        EMIT_INSTRUCTION(0xe52d2008 /* str r2, [sp, #-8]! */);
+        if (compiler->temporaries >= 3)
+            EMIT_INSTRUCTION(0xe52d2008 /* str r2, [sp, #-8]! */);
 #if defined(__GNUC__)
         FAIL_IF(sljit_emit_ijump(compiler, SLJIT_FAST_CALL, SLJIT_IMM,
             (op == SLJIT_UDIV ? SLJIT_FUNC_OFFSET(__aeabi_uidivmod) : SLJIT_FUNC_OFFSET(__aeabi_idivmod))));
 #else
 #error "Software divmod functions are needed"
 #endif
-        return push_inst(compiler, 0xe49d2008 /* ldr r2, [sp], #8 */);
+        if (compiler->temporaries >= 3)
+            return push_inst(compiler, 0xe49d2008 /* ldr r2, [sp], #8 */);
+        return SLJIT_SUCCESS;
     }


     return SLJIT_SUCCESS;