/[pcre]/code/trunk/pcretest.c
ViewVC logotype

Diff of /code/trunk/pcretest.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1127 by chpe, Thu Oct 18 18:35:05 2012 UTC revision 1140 by ph10, Fri Oct 19 13:41:32 2012 UTC
# Line 302  argument, the casting might be incorrect Line 302  argument, the casting might be incorrect
302    
303  #define PCRE_JIT_STACK_FREE8(stack) \  #define PCRE_JIT_STACK_FREE8(stack) \
304    pcre_jit_stack_free(stack)    pcre_jit_stack_free(stack)
305    
306    #define pcre8_maketables pcre_maketables
307    
308  #endif /* SUPPORT_PCRE8 */  #endif /* SUPPORT_PCRE8 */
309    
# Line 486  argument, the casting might be incorrect Line 488  argument, the casting might be incorrect
488    
489  /* ----- More than one mode is supported; a runtime test is needed, except for  /* ----- More than one mode is supported; a runtime test is needed, except for
490  pcre_config(), and the JIT stack functions, when it doesn't matter which  pcre_config(), and the JIT stack functions, when it doesn't matter which
491  version is called. ----- */  available version is called. ----- */
492    
493  enum {  enum {
494    PCRE8_MODE,    PCRE8_MODE,
# Line 706  cases separately. */ Line 708  cases separately. */
708      PCRE_STUDY8(extra, re, options, error)      PCRE_STUDY8(extra, re, options, error)
709    
710    
711  /* ----- 32-bit and 16-bit but not 8-bit supported ----- */  /* ----- Two out of three modes are supported ----- */
   
 #elif defined(SUPPORT_PCRE32) && defined(SUPPORT_PCRE16)  
 #define PCHARS(lv, p, offset, len, f) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCHARS32(lv, p, offset, len, f); \  
   else \  
     PCHARS16(lv, p, offset, len, f)  
   
 #define PCHARSV(p, offset, len, f) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCHARSV32(p, offset, len, f); \  
   else \  
     PCHARSV16(p, offset, len, f)  
   
 #define READ_CAPTURE_NAME(p, cn8, cn16, cn32, re) \  
   if (pcre_mode == PCRE32_MODE) \  
     READ_CAPTURE_NAME32(p, cn8, cn16, cn32, re); \  
   else \  
     READ_CAPTURE_NAME16(p, cn8, cn16, cn32, re)  
   
 #define SET_PCRE_CALLOUT(callout) \  
   if (pcre_mode == PCRE32_MODE) \  
     SET_PCRE_CALLOUT32(callout); \  
   else \  
     SET_PCRE_CALLOUT16(callout)  
712    
713  #define STRLEN(p) (pcre_mode == PCRE32_MODE ? STRLEN32(p) : STRLEN16(p)  #else
   
 #define PCRE_ASSIGN_JIT_STACK(extra, callback, userdata) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_ASSIGN_JIT_STACK32(extra, callback, userdata); \  
   else \  
     PCRE_ASSIGN_JIT_STACK16(extra, callback, userdata)  
   
 #define PCRE_COMPILE(re, pat, options, error, erroffset, tables) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_COMPILE32(re, pat, options, error, erroffset, tables); \  
   else \  
     PCRE_COMPILE16(re, pat, options, error, erroffset, tables)  
   
 #define PCRE_CONFIG pcre_config  
   
 #define PCRE_COPY_NAMED_SUBSTRING(rc, re, bptr, offsets, count, \  
     namesptr, cbuffer, size) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_COPY_NAMED_SUBSTRING32(rc, re, bptr, offsets, count, \  
       namesptr, cbuffer, size); \  
   else \  
     PCRE_COPY_NAMED_SUBSTRING16(rc, re, bptr, offsets, count, \  
       namesptr, cbuffer, size)  
   
 #define PCRE_COPY_SUBSTRING(rc, bptr, offsets, count, i, cbuffer, size) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_COPY_SUBSTRING32(rc, bptr, offsets, count, i, cbuffer, size); \  
   else \  
     PCRE_COPY_SUBSTRING16(rc, bptr, offsets, count, i, cbuffer, size)  
   
 #define PCRE_DFA_EXEC(count, re, extra, bptr, len, start_offset, options, \  
     offsets, size_offsets, workspace, size_workspace) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_DFA_EXEC32(count, re, extra, bptr, len, start_offset, options, \  
       offsets, size_offsets, workspace, size_workspace); \  
   else \  
     PCRE_DFA_EXEC16(count, re, extra, bptr, len, start_offset, options, \  
       offsets, size_offsets, workspace, size_workspace)  
   
 #define PCRE_EXEC(count, re, extra, bptr, len, start_offset, options, \  
     offsets, size_offsets) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_EXEC32(count, re, extra, bptr, len, start_offset, options, \  
       offsets, size_offsets); \  
   else \  
     PCRE_EXEC16(count, re, extra, bptr, len, start_offset, options, \  
       offsets, size_offsets)  
   
 #define PCRE_FREE_STUDY(extra) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_FREE_STUDY32(extra); \  
   else \  
     PCRE_FREE_STUDY16(extra)  
   
 #define PCRE_FREE_SUBSTRING(substring) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_FREE_SUBSTRING32(substring); \  
   else \  
     PCRE_FREE_SUBSTRING16(substring)  
   
 #define PCRE_FREE_SUBSTRING_LIST(listptr) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_FREE_SUBSTRING_LIST32(listptr); \  
   else \  
     PCRE_FREE_SUBSTRING_LIST16(listptr)  
   
 #define PCRE_GET_NAMED_SUBSTRING(rc, re, bptr, offsets, count, \  
     getnamesptr, subsptr) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_GET_NAMED_SUBSTRING32(rc, re, bptr, offsets, count, \  
       getnamesptr, subsptr); \  
   else \  
     PCRE_GET_NAMED_SUBSTRING16(rc, re, bptr, offsets, count, \  
       getnamesptr, subsptr)  
   
 #define PCRE_GET_STRINGNUMBER(n, rc, ptr) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_GET_STRINGNUMBER32(n, rc, ptr); \  
   else \  
     PCRE_GET_STRINGNUMBER16(n, rc, ptr)  
   
 #define PCRE_GET_SUBSTRING(rc, bptr, use_offsets, count, i, subsptr) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_GET_SUBSTRING32(rc, bptr, use_offsets, count, i, subsptr); \  
   else \  
     PCRE_GET_SUBSTRING16(rc, bptr, use_offsets, count, i, subsptr)  
   
 #define PCRE_GET_SUBSTRING_LIST(rc, bptr, offsets, count, listptr) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_GET_SUBSTRING_LIST32(rc, bptr, offsets, count, listptr); \  
   else \  
     PCRE_GET_SUBSTRING_LIST16(rc, bptr, offsets, count, listptr)  
   
 #define PCRE_JIT_STACK_ALLOC(startsize, maxsize) \  
   (pcre_mode == PCRE32_MODE ? \  
      PCRE_JIT_STACK_ALLOC32(startsize, maxsize) \  
     : PCRE_JIT_STACK_ALLOC16(startsize, maxsize)  
   
 #define PCRE_JIT_STACK_FREE(stack) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_JIT_STACK_FREE32(stack); \  
   else \  
     PCRE_JIT_STACK_FREE16(stack)  
   
 #define PCRE_MAKETABLES \  
   (pcre_mode == PCRE32_MODE ? pcre32_maketables() : pcre16_maketables())  
   
 #define PCRE_PATTERN_TO_HOST_BYTE_ORDER(rc, re, extra, tables) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_PATTERN_TO_HOST_BYTE_ORDER32(rc, re, extra, tables); \  
   else \  
     PCRE_PATTERN_TO_HOST_BYTE_ORDER16(rc, re, extra, tables)  
714    
715  #define PCRE_PRINTINT(re, outfile, debug_lengths) \  /* We can use some macro trickery to make a single set of definitions work in
716    if (pcre_mode == PCRE32_MODE) \  the three different cases. */
     PCRE_PRINTINT32(re, outfile, debug_lengths); \  
   else \  
     PCRE_PRINTINT16(re, outfile, debug_lengths)  
717    
718  #define PCRE_STUDY(extra, re, options, error) \  /* ----- 32-bit and 16-bit but not 8-bit supported ----- */
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_STUDY32(extra, re, options, error); \  
   else \  
     PCRE_STUDY16(extra, re, options, error)  
719    
720    #if defined(SUPPORT_PCRE32) && defined(SUPPORT_PCRE16)
721    #define BITONE 32
722    #define BITTWO 16
723    
724  /* ----- 32-bit and 8-bit but not 16-bit supported ----- */  /* ----- 32-bit and 8-bit but not 16-bit supported ----- */
725    
726  #elif defined(SUPPORT_PCRE32) && defined(SUPPORT_PCRE8)  #elif defined(SUPPORT_PCRE32) && defined(SUPPORT_PCRE8)
727    #define BITONE 32
728    #define BITTWO 8
729    
730  #define PCHARS(lv, p, offset, len, f) \  /* ----- 16-bit and 8-bit but not 32-bit supported ----- */
   if (pcre_mode == PCRE32_MODE) \  
     PCHARS32(lv, p, offset, len, f); \  
   else \  
     PCHARS8(lv, p, offset, len, f)  
   
 #define PCHARSV(p, offset, len, f) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCHARSV32(p, offset, len, f); \  
   else \  
     PCHARSV8(p, offset, len, f)  
   
 #define READ_CAPTURE_NAME(p, cn8, cn16, cn32, re) \  
   if (pcre_mode == PCRE32_MODE) \  
     READ_CAPTURE_NAME32(p, cn8, cn16, cn32, re); \  
   else \  
     READ_CAPTURE_NAME8(p, cn8, cn16, cn32, re)  
   
 #define SET_PCRE_CALLOUT(callout) \  
   if (pcre_mode == PCRE32_MODE) \  
     SET_PCRE_CALLOUT32(callout); \  
   else \  
     SET_PCRE_CALLOUT8(callout)  
   
 #define STRLEN(p) (pcre_mode == PCRE32_MODE ? STRLEN32(p) : STRLEN8(p))  
   
 #define PCRE_ASSIGN_JIT_STACK(extra, callback, userdata) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_ASSIGN_JIT_STACK32(extra, callback, userdata); \  
   else \  
     PCRE_ASSIGN_JIT_STACK8(extra, callback, userdata)  
   
 #define PCRE_COMPILE(re, pat, options, error, erroffset, tables) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_COMPILE32(re, pat, options, error, erroffset, tables); \  
   else \  
     PCRE_COMPILE8(re, pat, options, error, erroffset, tables)  
   
 #define PCRE_CONFIG pcre_config  
   
 #define PCRE_COPY_NAMED_SUBSTRING(rc, re, bptr, offsets, count, \  
     namesptr, cbuffer, size) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_COPY_NAMED_SUBSTRING32(rc, re, bptr, offsets, count, \  
       namesptr, cbuffer, size); \  
   else \  
     PCRE_COPY_NAMED_SUBSTRING8(rc, re, bptr, offsets, count, \  
       namesptr, cbuffer, size)  
   
 #define PCRE_COPY_SUBSTRING(rc, bptr, offsets, count, i, cbuffer, size) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_COPY_SUBSTRING32(rc, bptr, offsets, count, i, cbuffer, size); \  
   else \  
     PCRE_COPY_SUBSTRING8(rc, bptr, offsets, count, i, cbuffer, size)  
   
 #define PCRE_DFA_EXEC(count, re, extra, bptr, len, start_offset, options, \  
     offsets, size_offsets, workspace, size_workspace) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_DFA_EXEC32(count, re, extra, bptr, len, start_offset, options, \  
       offsets, size_offsets, workspace, size_workspace); \  
   else \  
     PCRE_DFA_EXEC8(count, re, extra, bptr, len, start_offset, options, \  
       offsets, size_offsets, workspace, size_workspace)  
   
 #define PCRE_EXEC(count, re, extra, bptr, len, start_offset, options, \  
     offsets, size_offsets) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_EXEC32(count, re, extra, bptr, len, start_offset, options, \  
       offsets, size_offsets); \  
   else \  
     PCRE_EXEC8(count, re, extra, bptr, len, start_offset, options, \  
       offsets, size_offsets)  
   
 #define PCRE_FREE_STUDY(extra) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_FREE_STUDY32(extra); \  
   else \  
     PCRE_FREE_STUDY8(extra)  
   
 #define PCRE_FREE_SUBSTRING(substring) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_FREE_SUBSTRING32(substring); \  
   else \  
     PCRE_FREE_SUBSTRING8(substring)  
   
 #define PCRE_FREE_SUBSTRING_LIST(listptr) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_FREE_SUBSTRING_LIST32(listptr); \  
   else \  
     PCRE_FREE_SUBSTRING_LIST8(listptr)  
   
 #define PCRE_GET_NAMED_SUBSTRING(rc, re, bptr, offsets, count, \  
     getnamesptr, subsptr) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_GET_NAMED_SUBSTRING32(rc, re, bptr, offsets, count, \  
       getnamesptr, subsptr); \  
   else \  
     PCRE_GET_NAMED_SUBSTRING8(rc, re, bptr, offsets, count, \  
       getnamesptr, subsptr)  
   
 #define PCRE_GET_STRINGNUMBER(n, rc, ptr) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_GET_STRINGNUMBER32(n, rc, ptr); \  
   else \  
     PCRE_GET_STRINGNUMBER8(n, rc, ptr)  
   
 #define PCRE_GET_SUBSTRING(rc, bptr, use_offsets, count, i, subsptr) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_GET_SUBSTRING32(rc, bptr, use_offsets, count, i, subsptr); \  
   else \  
     PCRE_GET_SUBSTRING8(rc, bptr, use_offsets, count, i, subsptr)  
   
 #define PCRE_GET_SUBSTRING_LIST(rc, bptr, offsets, count, listptr) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_GET_SUBSTRING_LIST32(rc, bptr, offsets, count, listptr); \  
   else \  
     PCRE_GET_SUBSTRING_LIST8(rc, bptr, offsets, count, listptr)  
   
 #define PCRE_JIT_STACK_ALLOC(startsize, maxsize) \  
   (pcre_mode == PCRE32_MODE ? \  
      PCRE_JIT_STACK_ALLOC32(startsize, maxsize) \  
       : PCRE_JIT_STACK_ALLOC8(startsize, maxsize))  
   
 #define PCRE_JIT_STACK_FREE(stack) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_JIT_STACK_FREE32(stack); \  
   else \  
     PCRE_JIT_STACK_FREE8(stack)  
   
 #define PCRE_MAKETABLES \  
   (pcre_mode == PCRE32_MODE ? pcre32_maketables() : pcre_maketables())  
   
 #define PCRE_PATTERN_TO_HOST_BYTE_ORDER(rc, re, extra, tables) \  
   if (pcre_mode == PCRE32_MODE) \  
     PCRE_PATTERN_TO_HOST_BYTE_ORDER32(rc, re, extra, tables); \  
   else \  
     PCRE_PATTERN_TO_HOST_BYTE_ORDER8(rc, re, extra, tables)  
731    
732  #define PCRE_PRINTINT(re, outfile, debug_lengths) \  #else
733    if (pcre_mode == PCRE32_MODE) \  #define BITONE 16
734      PCRE_PRINTINT32(re, outfile, debug_lengths); \  #define BITTWO 8
735    else \  #endif
     PCRE_PRINTINT8(re, outfile, debug_lengths)  
736    
737  #define PCRE_STUDY(extra, re, options, error) \  #define glue(a,b) a##b
738    if (pcre_mode == PCRE32_MODE) \  #define G(a,b) glue(a,b)
     PCRE_STUDY32(extra, re, options, error); \  
   else \  
     PCRE_STUDY8(extra, re, options, error)  
739    
740    
741  /* ----- 16-bit and 8-bit but not 32-bit supported ----- */  /* ----- Common macros for two-mode cases ----- */
742    
 #else  
743  #define PCHARS(lv, p, offset, len, f) \  #define PCHARS(lv, p, offset, len, f) \
744    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
745      PCHARS16(lv, p, offset, len, f); \      G(PCHARS,BITONE)(lv, p, offset, len, f); \
746    else \    else \
747      PCHARS8(lv, p, offset, len, f)      G(PCHARS,BITTWO)(lv, p, offset, len, f)
748    
749  #define PCHARSV(p, offset, len, f) \  #define PCHARSV(p, offset, len, f) \
750    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
751      PCHARSV16(p, offset, len, f); \      G(PCHARSV,BITONE)(p, offset, len, f); \
752    else \    else \
753      PCHARSV8(p, offset, len, f)      G(PCHARSV,BITTWO)(p, offset, len, f)
754    
755  #define READ_CAPTURE_NAME(p, cn8, cn16, cn32, re) \  #define READ_CAPTURE_NAME(p, cn8, cn16, cn32, re) \
756    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
757      READ_CAPTURE_NAME16(p, cn8, cn16, cn32, re); \      G(READ_CAPTURE_NAME,BITONE)(p, cn8, cn16, cn32, re); \
758    else \    else \
759      READ_CAPTURE_NAME8(p, cn8, cn16, cn32, re)      G(READ_CAPTURE_NAME,BITTWO)(p, cn8, cn16, cn32, re)
760    
761  #define SET_PCRE_CALLOUT(callout) \  #define SET_PCRE_CALLOUT(callout) \
762    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
763      SET_PCRE_CALLOUT16(callout); \      G(SET_PCRE_CALLOUT,BITONE)(callout); \
764    else \    else \
765      SET_PCRE_CALLOUT8(callout)      G(SET_PCRE_CALLOUT,BITTWO)(callout)
766    
767  #define STRLEN(p) (pcre_mode == PCRE16_MODE ? STRLEN16(p) : STRLEN8(p))  #define STRLEN(p) ((pcre_mode == G(G(PCRE,BITONE),_MODE)) ? \
768      G(STRLEN,BITONE)(p) : G(STRLEN,BITTWO)(p))
769    
770  #define PCRE_ASSIGN_JIT_STACK(extra, callback, userdata) \  #define PCRE_ASSIGN_JIT_STACK(extra, callback, userdata) \
771    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
772      PCRE_ASSIGN_JIT_STACK16(extra, callback, userdata); \      G(PCRE_ASSIGN_JIT_STACK,BITONE)(extra, callback, userdata); \
773    else \    else \
774      PCRE_ASSIGN_JIT_STACK8(extra, callback, userdata)      G(PCRE_ASSIGN_JIT_STACK,BITTWO)(extra, callback, userdata)
775    
776  #define PCRE_COMPILE(re, pat, options, error, erroffset, tables) \  #define PCRE_COMPILE(re, pat, options, error, erroffset, tables) \
777    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
778      PCRE_COMPILE16(re, pat, options, error, erroffset, tables); \      G(PCRE_COMPILE,BITONE)(re, pat, options, error, erroffset, tables); \
779    else \    else \
780      PCRE_COMPILE8(re, pat, options, error, erroffset, tables)      G(PCRE_COMPILE,BITTWO)(re, pat, options, error, erroffset, tables)
781    
782  #define PCRE_CONFIG pcre_config  #define PCRE_CONFIG G(G(pcre,BITONE),_config)
783    
784  #define PCRE_COPY_NAMED_SUBSTRING(rc, re, bptr, offsets, count, \  #define PCRE_COPY_NAMED_SUBSTRING(rc, re, bptr, offsets, count, \
785      namesptr, cbuffer, size) \      namesptr, cbuffer, size) \
786    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
787      PCRE_COPY_NAMED_SUBSTRING16(rc, re, bptr, offsets, count, \      G(PCRE_COPY_NAMED_SUBSTRING,BITONE)(rc, re, bptr, offsets, count, \
788        namesptr, cbuffer, size); \        namesptr, cbuffer, size); \
789    else \    else \
790      PCRE_COPY_NAMED_SUBSTRING8(rc, re, bptr, offsets, count, \      G(PCRE_COPY_NAMED_SUBSTRING,BITTWO)(rc, re, bptr, offsets, count, \
791        namesptr, cbuffer, size)        namesptr, cbuffer, size)
792    
793  #define PCRE_COPY_SUBSTRING(rc, bptr, offsets, count, i, cbuffer, size) \  #define PCRE_COPY_SUBSTRING(rc, bptr, offsets, count, i, cbuffer, size) \
794    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
795      PCRE_COPY_SUBSTRING16(rc, bptr, offsets, count, i, cbuffer, size); \      G(PCRE_COPY_SUBSTRING,BITONE)(rc, bptr, offsets, count, i, cbuffer, size); \
796    else \    else \
797      PCRE_COPY_SUBSTRING8(rc, bptr, offsets, count, i, cbuffer, size)      G(PCRE_COPY_SUBSTRING,BITTWO)(rc, bptr, offsets, count, i, cbuffer, size)
798    
799  #define PCRE_DFA_EXEC(count, re, extra, bptr, len, start_offset, options, \  #define PCRE_DFA_EXEC(count, re, extra, bptr, len, start_offset, options, \
800      offsets, size_offsets, workspace, size_workspace) \      offsets, size_offsets, workspace, size_workspace) \
801    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
802      PCRE_DFA_EXEC16(count, re, extra, bptr, len, start_offset, options, \      G(PCRE_DFA_EXEC,BITONE)(count, re, extra, bptr, len, start_offset, options, \
803        offsets, size_offsets, workspace, size_workspace); \        offsets, size_offsets, workspace, size_workspace); \
804    else \    else \
805      PCRE_DFA_EXEC8(count, re, extra, bptr, len, start_offset, options, \      G(PCRE_DFA_EXEC,BITTWO)(count, re, extra, bptr, len, start_offset, options, \
806        offsets, size_offsets, workspace, size_workspace)        offsets, size_offsets, workspace, size_workspace)
807    
808  #define PCRE_EXEC(count, re, extra, bptr, len, start_offset, options, \  #define PCRE_EXEC(count, re, extra, bptr, len, start_offset, options, \
809      offsets, size_offsets) \      offsets, size_offsets) \
810    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
811      PCRE_EXEC16(count, re, extra, bptr, len, start_offset, options, \      G(PCRE_EXEC,BITONE)(count, re, extra, bptr, len, start_offset, options, \
812        offsets, size_offsets); \        offsets, size_offsets); \
813    else \    else \
814      PCRE_EXEC8(count, re, extra, bptr, len, start_offset, options, \      G(PCRE_EXEC,BITTWO)(count, re, extra, bptr, len, start_offset, options, \
815        offsets, size_offsets)        offsets, size_offsets)
816    
817  #define PCRE_FREE_STUDY(extra) \  #define PCRE_FREE_STUDY(extra) \
818    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
819      PCRE_FREE_STUDY16(extra); \      G(PCRE_FREE_STUDY,BITONE)(extra); \
820    else \    else \
821      PCRE_FREE_STUDY8(extra)      G(PCRE_FREE_STUDY,BITTWO)(extra)
822    
823  #define PCRE_FREE_SUBSTRING(substring) \  #define PCRE_FREE_SUBSTRING(substring) \
824    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
825      PCRE_FREE_SUBSTRING16(substring); \      G(PCRE_FREE_SUBSTRING,BITONE)(substring); \
826    else \    else \
827      PCRE_FREE_SUBSTRING8(substring)      G(PCRE_FREE_SUBSTRING,BITTWO)(substring)
828    
829  #define PCRE_FREE_SUBSTRING_LIST(listptr) \  #define PCRE_FREE_SUBSTRING_LIST(listptr) \
830    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
831      PCRE_FREE_SUBSTRING_LIST16(listptr); \      G(PCRE_FREE_SUBSTRING_LIST,BITONE)(listptr); \
832    else \    else \
833      PCRE_FREE_SUBSTRING_LIST8(listptr)      G(PCRE_FREE_SUBSTRING_LIST,BITTWO)(listptr)
834    
835  #define PCRE_GET_NAMED_SUBSTRING(rc, re, bptr, offsets, count, \  #define PCRE_GET_NAMED_SUBSTRING(rc, re, bptr, offsets, count, \
836      getnamesptr, subsptr) \      getnamesptr, subsptr) \
837    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
838      PCRE_GET_NAMED_SUBSTRING16(rc, re, bptr, offsets, count, \      G(PCRE_GET_NAMED_SUBSTRING,BITONE)(rc, re, bptr, offsets, count, \
839        getnamesptr, subsptr); \        getnamesptr, subsptr); \
840    else \    else \
841      PCRE_GET_NAMED_SUBSTRING8(rc, re, bptr, offsets, count, \      G(PCRE_GET_NAMED_SUBSTRING,BITTWO)(rc, re, bptr, offsets, count, \
842        getnamesptr, subsptr)        getnamesptr, subsptr)
843    
844  #define PCRE_GET_STRINGNUMBER(n, rc, ptr) \  #define PCRE_GET_STRINGNUMBER(n, rc, ptr) \
845    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
846      PCRE_GET_STRINGNUMBER16(n, rc, ptr); \      G(PCRE_GET_STRINGNUMBER,BITONE)(n, rc, ptr); \
847    else \    else \
848      PCRE_GET_STRINGNUMBER8(n, rc, ptr)      G(PCRE_GET_STRINGNUMBER,BITTWO)(n, rc, ptr)
849    
850  #define PCRE_GET_SUBSTRING(rc, bptr, use_offsets, count, i, subsptr) \  #define PCRE_GET_SUBSTRING(rc, bptr, use_offsets, count, i, subsptr) \
851    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
852      PCRE_GET_SUBSTRING16(rc, bptr, use_offsets, count, i, subsptr); \      G(PCRE_GET_SUBSTRING,BITONE)(rc, bptr, use_offsets, count, i, subsptr); \
853    else \    else \
854      PCRE_GET_SUBSTRING8(rc, bptr, use_offsets, count, i, subsptr)      G(PCRE_GET_SUBSTRING,BITTWO)(rc, bptr, use_offsets, count, i, subsptr)
855    
856  #define PCRE_GET_SUBSTRING_LIST(rc, bptr, offsets, count, listptr) \  #define PCRE_GET_SUBSTRING_LIST(rc, bptr, offsets, count, listptr) \
857    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
858      PCRE_GET_SUBSTRING_LIST16(rc, bptr, offsets, count, listptr); \      G(PCRE_GET_SUBSTRING_LIST,BITONE)(rc, bptr, offsets, count, listptr); \
859    else \    else \
860      PCRE_GET_SUBSTRING_LIST8(rc, bptr, offsets, count, listptr)      G(PCRE_GET_SUBSTRING_LIST,BITTWO)(rc, bptr, offsets, count, listptr)
861    
862  #define PCRE_JIT_STACK_ALLOC(startsize, maxsize) \  #define PCRE_JIT_STACK_ALLOC(startsize, maxsize) \
863    (pcre_mode == PCRE16_MODE ? \    (pcre_mode == G(G(PCRE,BITONE),_MODE)) ? \
864        PCRE_JIT_STACK_ALLOC16(startsize, maxsize) \       G(PCRE_JIT_STACK_ALLOC,BITONE)(startsize, maxsize) \
865        : PCRE_JIT_STACK_ALLOC8(startsize, maxsize))      : G(PCRE_JIT_STACK_ALLOC,BITTWO)(startsize, maxsize)
866    
867  #define PCRE_JIT_STACK_FREE(stack) \  #define PCRE_JIT_STACK_FREE(stack) \
868    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
869      PCRE_JIT_STACK_FREE16(stack); \      G(PCRE_JIT_STACK_FREE,BITONE)(stack); \
870    else \    else \
871      PCRE_JIT_STACK_FREE8(stack)      G(PCRE_JIT_STACK_FREE,BITTWO)(stack)
872    
873  #define PCRE_MAKETABLES \  #define PCRE_MAKETABLES \
874    (pcre_mode == PCRE16_MODE ? pcre16_maketables() : pcre_maketables())    (pcre_mode == G(G(PCRE,BITONE),_MODE)) ? \
875        G(G(pcre,BITONE),_maketables)() : G(G(pcre,BITTWO),_maketables)()
876    
877  #define PCRE_PATTERN_TO_HOST_BYTE_ORDER(rc, re, extra, tables) \  #define PCRE_PATTERN_TO_HOST_BYTE_ORDER(rc, re, extra, tables) \
878    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
879      PCRE_PATTERN_TO_HOST_BYTE_ORDER16(rc, re, extra, tables); \      G(PCRE_PATTERN_TO_HOST_BYTE_ORDER,BITONE)(rc, re, extra, tables); \
880    else \    else \
881      PCRE_PATTERN_TO_HOST_BYTE_ORDER8(rc, re, extra, tables)      G(PCRE_PATTERN_TO_HOST_BYTE_ORDER,BITTWO)(rc, re, extra, tables)
882    
883  #define PCRE_PRINTINT(re, outfile, debug_lengths) \  #define PCRE_PRINTINT(re, outfile, debug_lengths) \
884    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
885      PCRE_PRINTINT16(re, outfile, debug_lengths); \      G(PCRE_PRINTINT,BITONE)(re, outfile, debug_lengths); \
886    else \    else \
887      PCRE_PRINTINT8(re, outfile, debug_lengths)      G(PCRE_PRINTINT,BITTWO)(re, outfile, debug_lengths)
888    
889  #define PCRE_STUDY(extra, re, options, error) \  #define PCRE_STUDY(extra, re, options, error) \
890    if (pcre_mode == PCRE16_MODE) \    if (pcre_mode == G(G(PCRE,BITONE),_MODE)) \
891      PCRE_STUDY16(extra, re, options, error); \      G(PCRE_STUDY,BITONE)(extra, re, options, error); \
892    else \    else \
893      PCRE_STUDY8(extra, re, options, error)      G(PCRE_STUDY,BITTWO)(extra, re, options, error)
894    
895  #endif  #endif  /* Two out of three modes */
896    
897  /* ----- End of cases where more than one mode is supported ----- */  /* ----- End of cases where more than one mode is supported ----- */
898    
# Line 1315  obtained and extended as required. */ Line 1039  obtained and extended as required. */
1039    
1040  #if defined SUPPORT_PCRE8 && (defined SUPPORT_PCRE16 || defined SUPPORT_PCRE32)  #if defined SUPPORT_PCRE8 && (defined SUPPORT_PCRE16 || defined SUPPORT_PCRE32)
1041    
1042  /* We need the table of operator lengths that is used for 16/32-bit compiling, in  /* We need the table of operator lengths that is used for 16/32-bit compiling,
1043  order to swap bytes in a pattern for saving/reloading testing. Luckily, the  in order to swap bytes in a pattern for saving/reloading testing. Luckily, the
1044  data is defined as a macro. However, we must ensure that LINK_SIZE is adjusted  data is defined as a macro. However, we must ensure that LINK_SIZE is adjusted
1045  appropriately for the 16/32-bit world. Just as a safety check, make sure that  appropriately for the 16/32-bit world. Just as a safety check, make sure that
1046  COMPILE_PCRE[16|32] is *not* set. */  COMPILE_PCRE[16|32] is *not* set. */
# Line 1344  COMPILE_PCRE[16|32] is *not* set. */ Line 1068  COMPILE_PCRE[16|32] is *not* set. */
1068    
1069  #endif /* SUPPORT_PCRE8 && (SUPPORT_PCRE16 || SUPPORT_PCRE32) */  #endif /* SUPPORT_PCRE8 && (SUPPORT_PCRE16 || SUPPORT_PCRE32) */
1070    
1071    
1072  #ifdef SUPPORT_PCRE16  #ifdef SUPPORT_PCRE16
1073  static int buffer16_size = 0;  static int buffer16_size = 0;
1074  static pcre_uint16 *buffer16 = NULL;  static pcre_uint16 *buffer16 = NULL;
# Line 1356  static pcre_uint32 *buffer32 = NULL; Line 1081  static pcre_uint32 *buffer32 = NULL;
1081  static const pcre_uint32 OP_lengths32[] = { OP_LENGTHS };  static const pcre_uint32 OP_lengths32[] = { OP_LENGTHS };
1082  #endif  /* SUPPORT_PCRE32 */  #endif  /* SUPPORT_PCRE32 */
1083    
1084  /* If we have 8-bit support, default to it; if there is also  /* If we have 8-bit support, default to it; if there is also 16-or 32-bit
1085  16-or 32-bit support, it can be changed by an option. If there is no 8-bit support,  support, it can be changed by an option. If there is no 8-bit support, there
1086  there must be 16-or 32-bit support, so default it to 1. */  must be 16-or 32-bit support, so default it to 1. */
1087    
1088  #if defined SUPPORT_PCRE8  #if defined SUPPORT_PCRE8
1089  static int pcre_mode = PCRE8_MODE;  static int pcre_mode = PCRE8_MODE;
# Line 1876  return i+1; Line 1601  return i+1;
1601    
1602    
1603    
1604  #if !defined NOUTF || defined SUPPORT_PCRE16 || defined SUPPORT_PCRE32  #if defined SUPPORT_PCRE8 && !defined NOUTF
1605  /*************************************************  /*************************************************
1606  *       Convert character value to UTF-8         *  *       Convert character value to UTF-8         *
1607  *************************************************/  *************************************************/
# Line 2954  if (extra != NULL) Line 2679  if (extra != NULL)
2679    rsd->minlength = swap_uint32(rsd->minlength);    rsd->minlength = swap_uint32(rsd->minlength);
2680    }    }
2681    
2682  /* In 32-bit mode we must swap bytes  /* In 32-bit mode we must swap bytes in the name table, if present, and then in
2683  in the name table, if present, and then in the pattern itself. */  the pattern itself. */
2684    
2685  while(TRUE)  while(TRUE)
2686    {    {
# Line 4994  while (!done) Line 4719  while (!done)
4719          continue;          continue;
4720          }          }
4721    
4722        /* We now have a character value in c that may be greater than 255. In        /* We now have a character value in c that may be greater than 255.
4723        16-bit or 32-bit mode, we always convert characters to UTF-8 so that        In 8-bit mode we convert to UTF-8 if we are in UTF mode. Values greater
4724        values greater than 255 can be passed to non-UTF 16- or 32-bit strings.        than 127 in UTF mode must have come from \x{...} or octal constructs
       In 8-bit       mode we convert to UTF-8 if we are in UTF mode. Values greater  
       than 127       in UTF mode must have come from \x{...} or octal constructs  
4725        because values from \x.. get this far only in non-UTF mode. */        because values from \x.. get this far only in non-UTF mode. */
4726    
4727  #ifdef SUPPORT_PCRE8  #ifdef SUPPORT_PCRE8
# Line 5019  while (!done) Line 4742  while (!done)
4742              fprintf(outfile, "** Truncation will probably give the wrong "              fprintf(outfile, "** Truncation will probably give the wrong "
4743                "result.\n");                "result.\n");
4744              }              }
   
4745            *q8++ = c;            *q8++ = c;
4746            }            }
4747          }          }

Legend:
Removed from v.1127  
changed lines
  Added in v.1140

  ViewVC Help
Powered by ViewVC 1.1.5