/[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 1189 by ph10, Tue Oct 30 16:34:17 2012 UTC revision 1313 by ph10, Wed Apr 24 12:07:09 2013 UTC
# Line 36  POSSIBILITY OF SUCH DAMAGE. Line 36  POSSIBILITY OF SUCH DAMAGE.
36  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
37  */  */
38    
39  /* This program now supports the testing of all of the 8-bit, 16-bit, and  /* This program now supports the testing of all of the 8-bit, 16-bit, and
40  32-bit PCRE libraries in a single program. This is different from the modules  32-bit PCRE libraries in a single program. This is different from the modules
41  such as pcre_compile.c in the library itself, which are compiled separately for  such as pcre_compile.c in the library itself, which are compiled separately for
42  each mode. If two modes are enabled, for example, pcre_compile.c is compiled  each mode. If two modes are enabled, for example, pcre_compile.c is compiled
# Line 121  input mode under Windows. */ Line 121  input mode under Windows. */
121  #endif  #endif
122  #endif  #endif
123    
124    #ifdef __VMS
125    #include <ssdef.h>
126    void vms_setsymbol( char *, char *, int );
127    #endif
128    
129    
130  #define PRIV(name) name  #define PRIV(name) name
131    
132  /* We have to include pcre_internal.h because we need the internal info for  /* We have to include pcre_internal.h because we need the internal info for
# Line 288  argument, the casting might be incorrect Line 294  argument, the casting might be incorrect
294    
295  #define PCRE_JIT_STACK_FREE8(stack) \  #define PCRE_JIT_STACK_FREE8(stack) \
296    pcre_jit_stack_free(stack)    pcre_jit_stack_free(stack)
297    
298  #define pcre8_maketables pcre_maketables  #define pcre8_maketables pcre_maketables
299    
300  #endif /* SUPPORT_PCRE8 */  #endif /* SUPPORT_PCRE8 */
301    
# Line 1131  static const char *errtexts[] = { Line 1137  static const char *errtexts[] = {
1137    "pattern compiled with other endianness",    "pattern compiled with other endianness",
1138    "invalid data in workspace for DFA restart",    "invalid data in workspace for DFA restart",
1139    "bad JIT option",    "bad JIT option",
1140    "bad length"    "bad length"
1141  };  };
1142    
1143    
# Line 1790  Returns:       TRUE  if the string is a Line 1796  Returns:       TRUE  if the string is a
1796                 FALSE otherwise                 FALSE otherwise
1797  */  */
1798    
1799    #ifdef NEVER   /* Not used */
1800  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
1801  static BOOL  static BOOL
1802  valid_utf32(pcre_uint32 *string, int length)  valid_utf32(pcre_uint32 *string, int length)
# Line 1800  register pcre_uint32 c; Line 1807  register pcre_uint32 c;
1807  for (p = string; length-- > 0; p++)  for (p = string; length-- > 0; p++)
1808    {    {
1809    c = *p;    c = *p;
1810      if (c > 0x10ffffu) return FALSE;                 /* Too big */
1811    if (c > 0x10ffffu)    if ((c & 0xfffff800u) == 0xd800u) return FALSE;  /* Surrogate */
     return FALSE;  
   
   /* A surrogate */  
   if ((c & 0xfffff800u) == 0xd800u)  
     return FALSE;  
   
   /* Non-character */  
   if ((c & 0xfffeu) == 0xfffeu || (c >= 0xfdd0u && c <= 0xfdefu))  
     return FALSE;  
1812    }    }
1813    
1814  return TRUE;  return TRUE;
1815  }  }
1816  #endif /* SUPPORT_UTF */  #endif /* SUPPORT_UTF */
1817    #endif /* NEVER */
1818    #endif /* SUPPORT_PCRE32 */
1819    
 #endif  
1820    
1821  /*************************************************  /*************************************************
1822  *        Read or extend an input line            *  *        Read or extend an input line            *
# Line 2077  while (length-- > 0) Line 2076  while (length-- > 0)
2076    if (use_utf && c >= 0xD800 && c < 0xDC00 && length > 0)    if (use_utf && c >= 0xD800 && c < 0xDC00 && length > 0)
2077      {      {
2078      int d = *p & 0xffff;      int d = *p & 0xffff;
2079      if (d >= 0xDC00 && d < 0xDFFF)      if (d >= 0xDC00 && d <= 0xDFFF)
2080        {        {
2081        c = ((c & 0x3ff) << 10) + (d & 0x3ff) + 0x10000;        c = ((c & 0x3ff) << 10) + (d & 0x3ff) + 0x10000;
2082        length--;        length--;
# Line 2102  return yield; Line 2101  return yield;
2101  /* Must handle UTF-32 strings in utf mode. Yields number of characters printed.  /* Must handle UTF-32 strings in utf mode. Yields number of characters printed.
2102  If handed a NULL file, just counts chars without printing. */  If handed a NULL file, just counts chars without printing. */
2103    
 #define UTF32_MASK (0x1fffffu)  
   
2104  static int pchars32(PCRE_SPTR32 p, int length, BOOL utf, FILE *f)  static int pchars32(PCRE_SPTR32 p, int length, BOOL utf, FILE *f)
2105  {  {
2106  int yield = 0;  int yield = 0;
2107    
2108    (void)(utf);  /* Avoid compiler warning */
2109    
2110  if (length < 0)  if (length < 0)
2111    length = strlen32(p);    length = strlen32(p);
2112    
2113  while (length-- > 0)  while (length-- > 0)
2114    {    {
2115    pcre_uint32 c = *p++;    pcre_uint32 c = *p++;
   if (utf) c &= UTF32_MASK;  
2116    yield += pchar(c, f);    yield += pchar(c, f);
2117    }    }
2118    
# Line 2397  else Line 2395  else
2395    rc = PCRE_ERROR_BADMODE;    rc = PCRE_ERROR_BADMODE;
2396  #endif  #endif
2397    
2398  if (rc < 0)  if (rc < 0 && rc != PCRE_ERROR_UNSET)
2399    {    {
2400    fprintf(outfile, "Error %d from pcre%s_fullinfo(%d)\n", rc,    fprintf(outfile, "Error %d from pcre%s_fullinfo(%d)\n", rc,
2401      pcre_mode == PCRE32_MODE ? "32" : pcre_mode == PCRE16_MODE ? "16" : "", option);      pcre_mode == PCRE32_MODE ? "32" : pcre_mode == PCRE16_MODE ? "16" : "", option);
# Line 2473  BOOL utf16_char = FALSE; Line 2471  BOOL utf16_char = FALSE;
2471  re->magic_number = REVERSED_MAGIC_NUMBER;  re->magic_number = REVERSED_MAGIC_NUMBER;
2472  re->size = swap_uint32(re->size);  re->size = swap_uint32(re->size);
2473  re->options = swap_uint32(re->options);  re->options = swap_uint32(re->options);
2474  re->flags = swap_uint16(re->flags);  re->flags = swap_uint32(re->flags);
2475  re->top_bracket = swap_uint16(re->top_bracket);  re->limit_match = swap_uint32(re->limit_match);
2476  re->top_backref = swap_uint16(re->top_backref);  re->limit_recursion = swap_uint32(re->limit_recursion);
2477  re->first_char = swap_uint16(re->first_char);  re->first_char = swap_uint16(re->first_char);
2478  re->req_char = swap_uint16(re->req_char);  re->req_char = swap_uint16(re->req_char);
2479    re->max_lookbehind = swap_uint16(re->max_lookbehind);
2480    re->top_bracket = swap_uint16(re->top_bracket);
2481    re->top_backref = swap_uint16(re->top_backref);
2482  re->name_table_offset = swap_uint16(re->name_table_offset);  re->name_table_offset = swap_uint16(re->name_table_offset);
2483  re->name_entry_size = swap_uint16(re->name_entry_size);  re->name_entry_size = swap_uint16(re->name_entry_size);
2484  re->name_count = swap_uint16(re->name_count);  re->name_count = swap_uint16(re->name_count);
2485    re->ref_count = swap_uint16(re->ref_count);
2486    
2487  if (extra != NULL)  if (extra != NULL)
2488    {    {
# Line 2650  int length = re->name_count * re->name_e Line 2652  int length = re->name_count * re->name_e
2652  re->magic_number = REVERSED_MAGIC_NUMBER;  re->magic_number = REVERSED_MAGIC_NUMBER;
2653  re->size = swap_uint32(re->size);  re->size = swap_uint32(re->size);
2654  re->options = swap_uint32(re->options);  re->options = swap_uint32(re->options);
2655  re->flags = swap_uint16(re->flags);  re->flags = swap_uint32(re->flags);
2656  re->top_bracket = swap_uint16(re->top_bracket);  re->limit_match = swap_uint32(re->limit_match);
2657  re->top_backref = swap_uint16(re->top_backref);  re->limit_recursion = swap_uint32(re->limit_recursion);
2658  re->first_char = swap_uint32(re->first_char);  re->first_char = swap_uint32(re->first_char);
2659  re->req_char = swap_uint32(re->req_char);  re->req_char = swap_uint32(re->req_char);
2660    re->max_lookbehind = swap_uint16(re->max_lookbehind);
2661    re->top_bracket = swap_uint16(re->top_bracket);
2662    re->top_backref = swap_uint16(re->top_backref);
2663  re->name_table_offset = swap_uint16(re->name_table_offset);  re->name_table_offset = swap_uint16(re->name_table_offset);
2664  re->name_entry_size = swap_uint16(re->name_entry_size);  re->name_entry_size = swap_uint16(re->name_entry_size);
2665  re->name_count = swap_uint16(re->name_count);  re->name_count = swap_uint16(re->name_count);
2666    re->ref_count = swap_uint16(re->ref_count);
2667    
2668  if (extra != NULL)  if (extra != NULL)
2669    {    {
# Line 2942  int done = 0; Line 2948  int done = 0;
2948  int all_use_dfa = 0;  int all_use_dfa = 0;
2949  int verify_jit = 0;  int verify_jit = 0;
2950  int yield = 0;  int yield = 0;
 #ifdef SUPPORT_PCRE32  
 int mask_utf32 = 0;  
 #endif  
2951  int stack_size;  int stack_size;
2952  pcre_uint8 *dbuffer = NULL;  pcre_uint8 *dbuffer = NULL;
2953  size_t dbuffer_size = 1u << 14;  size_t dbuffer_size = 1u << 14;
# Line 3056  while (argc > 1 && argv[op][0] == '-') Line 3059  while (argc > 1 && argv[op][0] == '-')
3059      exit(1);      exit(1);
3060  #endif  #endif
3061      }      }
3062    else if (strcmp(arg, "-32") == 0 || strcmp(arg, "-32+") == 0)    else if (strcmp(arg, "-32") == 0)
3063      {      {
3064  #ifdef SUPPORT_PCRE32  #ifdef SUPPORT_PCRE32
3065      pcre_mode = PCRE32_MODE;      pcre_mode = PCRE32_MODE;
     mask_utf32 = (strcmp(arg, "-32+") == 0);  
3066  #else  #else
3067      printf("** This version of PCRE was built without 32-bit support\n");      printf("** This version of PCRE was built without 32-bit support\n");
3068      exit(1);      exit(1);
# Line 3099  while (argc > 1 && argv[op][0] == '-') Line 3101  while (argc > 1 && argv[op][0] == '-')
3101        ((stack_size = get_value((pcre_uint8 *)argv[op+1], &endptr)),        ((stack_size = get_value((pcre_uint8 *)argv[op+1], &endptr)),
3102          *endptr == 0))          *endptr == 0))
3103      {      {
3104  #if defined(_WIN32) || defined(WIN32) || defined(__minix) || defined(NATIVE_ZOS)  #if defined(_WIN32) || defined(WIN32) || defined(__minix) || defined(NATIVE_ZOS) || defined(__VMS)
3105      printf("PCRE: -S not supported on this OS\n");      printf("PCRE: -S not supported on this OS\n");
3106      exit(1);      exit(1);
3107  #else  #else
# Line 3132  while (argc > 1 && argv[op][0] == '-') Line 3134  while (argc > 1 && argv[op][0] == '-')
3134          (void)PCRE_CONFIG(PCRE_CONFIG_LINK_SIZE, &rc);          (void)PCRE_CONFIG(PCRE_CONFIG_LINK_SIZE, &rc);
3135          printf("%d\n", rc);          printf("%d\n", rc);
3136          yield = rc;          yield = rc;
3137    
3138    #ifdef __VMS
3139            vms_setsymbol("LINKSIZE",0,yield );
3140    #endif
3141          }          }
3142        else if (strcmp(argv[op + 1], "pcre8") == 0)        else if (strcmp(argv[op + 1], "pcre8") == 0)
3143          {          {
# Line 3142  while (argc > 1 && argv[op][0] == '-') Line 3148  while (argc > 1 && argv[op][0] == '-')
3148          printf("0\n");          printf("0\n");
3149          yield = 0;          yield = 0;
3150  #endif  #endif
3151    #ifdef __VMS
3152            vms_setsymbol("PCRE8",0,yield );
3153    #endif
3154          }          }
3155        else if (strcmp(argv[op + 1], "pcre16") == 0)        else if (strcmp(argv[op + 1], "pcre16") == 0)
3156          {          {
# Line 3152  while (argc > 1 && argv[op][0] == '-') Line 3161  while (argc > 1 && argv[op][0] == '-')
3161          printf("0\n");          printf("0\n");
3162          yield = 0;          yield = 0;
3163  #endif  #endif
3164    #ifdef __VMS
3165            vms_setsymbol("PCRE16",0,yield );
3166    #endif
3167          }          }
3168        else if (strcmp(argv[op + 1], "pcre32") == 0)        else if (strcmp(argv[op + 1], "pcre32") == 0)
3169          {          {
# Line 3162  while (argc > 1 && argv[op][0] == '-') Line 3174  while (argc > 1 && argv[op][0] == '-')
3174          printf("0\n");          printf("0\n");
3175          yield = 0;          yield = 0;
3176  #endif  #endif
3177          goto EXIT;  #ifdef __VMS
3178            vms_setsymbol("PCRE32",0,yield );
3179    #endif
3180          }          }
3181        if (strcmp(argv[op + 1], "utf") == 0)        else if (strcmp(argv[op + 1], "utf") == 0)
3182          {          {
3183  #ifdef SUPPORT_PCRE8  #ifdef SUPPORT_PCRE8
3184          if (pcre_mode == PCRE8_MODE)          if (pcre_mode == PCRE8_MODE)
# Line 3180  while (argc > 1 && argv[op][0] == '-') Line 3194  while (argc > 1 && argv[op][0] == '-')
3194  #endif  #endif
3195          printf("%d\n", rc);          printf("%d\n", rc);
3196          yield = rc;          yield = rc;
3197          goto EXIT;  #ifdef __VMS
3198            vms_setsymbol("UTF",0,yield );
3199    #endif
3200          }          }
3201        else if (strcmp(argv[op + 1], "ucp") == 0)        else if (strcmp(argv[op + 1], "ucp") == 0)
3202          {          {
# Line 3517  while (!done) Line 3533  while (!done)
3533        PCRE_PATTERN_TO_HOST_BYTE_ORDER(rc, re, extra, NULL);        PCRE_PATTERN_TO_HOST_BYTE_ORDER(rc, re, extra, NULL);
3534        if (rc == PCRE_ERROR_BADMODE)        if (rc == PCRE_ERROR_BADMODE)
3535          {          {
3536          pcre_uint16 flags_in_host_byte_order;          pcre_uint32 flags_in_host_byte_order;
3537          if (REAL_PCRE_MAGIC(re) == MAGIC_NUMBER)          if (REAL_PCRE_MAGIC(re) == MAGIC_NUMBER)
3538            flags_in_host_byte_order = REAL_PCRE_FLAGS(re);            flags_in_host_byte_order = REAL_PCRE_FLAGS(re);
3539          else          else
3540            flags_in_host_byte_order = swap_uint16(REAL_PCRE_FLAGS(re));            flags_in_host_byte_order = swap_uint32(REAL_PCRE_FLAGS(re));
3541          /* Simulate the result of the function call below. */          /* Simulate the result of the function call below. */
3542          fprintf(outfile, "Error %d from pcre%s_fullinfo(%d)\n", rc,          fprintf(outfile, "Error %d from pcre%s_fullinfo(%d)\n", rc,
3543            pcre_mode == PCRE32_MODE ? "32" : pcre_mode == PCRE16_MODE ? "16" : "",            pcre_mode == PCRE32_MODE ? "32" : pcre_mode == PCRE16_MODE ? "16" : "",
# Line 3681  while (!done) Line 3697  while (!done)
3697        case 'Y': options |= PCRE_NO_START_OPTIMISE; break;        case 'Y': options |= PCRE_NO_START_OPTIMISE; break;
3698        case 'Z': debug_lengths = 0; break;        case 'Z': debug_lengths = 0; break;
3699        case '8': options |= PCRE_UTF8; use_utf = 1; break;        case '8': options |= PCRE_UTF8; use_utf = 1; break;
3700          case '9': options |= PCRE_NEVER_UTF; break;
3701        case '?': options |= PCRE_NO_UTF8_CHECK; break;        case '?': options |= PCRE_NO_UTF8_CHECK; break;
3702    
3703        case 'T':        case 'T':
# Line 4001  while (!done) Line 4018  while (!done)
4018        {        {
4019        unsigned long int all_options;        unsigned long int all_options;
4020        pcre_uint32 first_char, need_char;        pcre_uint32 first_char, need_char;
4021          pcre_uint32 match_limit, recursion_limit;
4022        int count, backrefmax, first_char_set, need_char_set, okpartial, jchanged,        int count, backrefmax, first_char_set, need_char_set, okpartial, jchanged,
4023          hascrorlf, maxlookbehind;          hascrorlf, maxlookbehind;
4024        int nameentrysize, namecount;        int nameentrysize, namecount;
# Line 4028  while (!done) Line 4046  while (!done)
4046          (int)size, (int)regex_gotten_store);          (int)size, (int)regex_gotten_store);
4047    
4048        fprintf(outfile, "Capturing subpattern count = %d\n", count);        fprintf(outfile, "Capturing subpattern count = %d\n", count);
4049    
4050        if (backrefmax > 0)        if (backrefmax > 0)
4051          fprintf(outfile, "Max back reference = %d\n", backrefmax);          fprintf(outfile, "Max back reference = %d\n", backrefmax);
4052    
4053          if (maxlookbehind > 0)
4054            fprintf(outfile, "Max lookbehind = %d\n", maxlookbehind);
4055    
4056          if (new_info(re, NULL, PCRE_INFO_MATCHLIMIT, &match_limit) == 0)
4057            fprintf(outfile, "Match limit = %u\n", match_limit);
4058    
4059          if (new_info(re, NULL, PCRE_INFO_RECURSIONLIMIT, &recursion_limit) == 0)
4060            fprintf(outfile, "Recursion limit = %u\n", recursion_limit);
4061    
4062        if (namecount > 0)        if (namecount > 0)
4063          {          {
4064          fprintf(outfile, "Named capturing subpatterns:\n");          fprintf(outfile, "Named capturing subpatterns:\n");
# Line 4064  while (!done) Line 4092  while (!done)
4092        if (do_flip) all_options = swap_uint32(all_options);        if (do_flip) all_options = swap_uint32(all_options);
4093    
4094        if (get_options == 0) fprintf(outfile, "No options\n");        if (get_options == 0) fprintf(outfile, "No options\n");
4095          else fprintf(outfile, "Options:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",          else fprintf(outfile, "Options:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
4096            ((get_options & PCRE_ANCHORED) != 0)? " anchored" : "",            ((get_options & PCRE_ANCHORED) != 0)? " anchored" : "",
4097            ((get_options & PCRE_CASELESS) != 0)? " caseless" : "",            ((get_options & PCRE_CASELESS) != 0)? " caseless" : "",
4098            ((get_options & PCRE_EXTENDED) != 0)? " extended" : "",            ((get_options & PCRE_EXTENDED) != 0)? " extended" : "",
# Line 4081  while (!done) Line 4109  while (!done)
4109            ((get_options & PCRE_UCP) != 0)? " ucp" : "",            ((get_options & PCRE_UCP) != 0)? " ucp" : "",
4110            ((get_options & PCRE_NO_UTF8_CHECK) != 0)? " no_utf_check" : "",            ((get_options & PCRE_NO_UTF8_CHECK) != 0)? " no_utf_check" : "",
4111            ((get_options & PCRE_NO_START_OPTIMIZE) != 0)? " no_start_optimize" : "",            ((get_options & PCRE_NO_START_OPTIMIZE) != 0)? " no_start_optimize" : "",
4112            ((get_options & PCRE_DUPNAMES) != 0)? " dupnames" : "");            ((get_options & PCRE_DUPNAMES) != 0)? " dupnames" : "",
4113              ((get_options & PCRE_NEVER_UTF) != 0)? " never_utf" : "");
4114    
4115        if (jchanged) fprintf(outfile, "Duplicate name status changes\n");        if (jchanged) fprintf(outfile, "Duplicate name status changes\n");
4116    
# Line 4155  while (!done) Line 4184  while (!done)
4184            }            }
4185          }          }
4186    
       if (maxlookbehind > 0)  
         fprintf(outfile, "Max lookbehind = %d\n", maxlookbehind);  
   
4187        /* Don't output study size; at present it is in any case a fixed        /* Don't output study size; at present it is in any case a fixed
4188        value, but it varies, depending on the computer architecture, and        value, but it varies, depending on the computer architecture, and
4189        so messes up the test suite. (And with the /F option, it might be        so messes up the test suite. (And with the /F option, it might be
# Line 4719  while (!done) Line 4745  while (!done)
4745          continue;          continue;
4746          }          }
4747    
4748        /* We now have a character value in c that may be greater than 255.        /* We now have a character value in c that may be greater than 255.
4749        In 8-bit mode we convert to UTF-8 if we are in UTF mode. Values greater        In 8-bit mode we convert to UTF-8 if we are in UTF mode. Values greater
4750        than 127 in UTF mode must have come from \x{...} or octal constructs        than 127 in UTF mode must have come from \x{...} or octal constructs
4751        because values from \x.. get this far only in non-UTF mode. */        because values from \x.. get this far only in non-UTF mode. */
# Line 4730  while (!done) Line 4756  while (!done)
4756  #ifndef NOUTF  #ifndef NOUTF
4757          if (use_utf)          if (use_utf)
4758            {            {
4759              if (c > 0x7fffffff)
4760                {
4761                fprintf(outfile, "** Character \\x{%x} is greater than 0x7fffffff "
4762                  "and so cannot be converted to UTF-8\n", c);
4763                goto NEXT_DATA;
4764                }
4765            q8 += ord2utf8(c, q8);            q8 += ord2utf8(c, q8);
4766            }            }
4767          else          else
# Line 4815  while (!done) Line 4847  while (!done)
4847      }      }
4848  #endif  #endif
4849    
 #if defined SUPPORT_UTF && defined SUPPORT_PCRE32  
     /* If we're requsted to test UTF-32 masking of high bits, change the data  
     string to have high bits set, unless the string is invalid UTF-32.  
     Since the JIT doesn't support this yet, only do it when not JITing. */  
     if (use_utf && mask_utf32 && (study_options & PCRE_STUDY_ALLJIT) == 0 &&  
         valid_utf32((pcre_uint32 *)dbuffer, len))  
       {  
       for (q32 = (pcre_uint32 *)dbuffer; *q32; q32++)  
         *q32 |= ~(pcre_uint32)UTF32_MASK;  
   
       /* Need to pass NO_UTF32_CHECK so the high bits are allowed */  
       options |= PCRE_NO_UTF32_CHECK;  
       }  
 #endif  
   
4850      /* If we're compiling with explicit valgrind support, Mark the data from after      /* If we're compiling with explicit valgrind support, Mark the data from after
4851      its end to the end of the buffer as unaddressable, so that a read over the end      its end to the end of the buffer as unaddressable, so that a read over the end
4852      of the buffer will be seen by valgrind, even if it doesn't cause a crash.      of the buffer will be seen by valgrind, even if it doesn't cause a crash.
# Line 5036  while (!done) Line 5053  while (!done)
5053          if (count == 0)          if (count == 0)
5054            {            {
5055            fprintf(outfile, "Matched, but too many substrings\n");            fprintf(outfile, "Matched, but too many substrings\n");
5056            count = use_size_offsets/3;            /* 2 is a special case; match can be returned */
5057              count = (use_size_offsets == 2)? 1 : use_size_offsets/3;
5058            }            }
5059          }          }
5060    
# Line 5050  while (!done) Line 5068  while (!done)
5068  #if !defined NODFA  #if !defined NODFA
5069          if (all_use_dfa || use_dfa) maxcount = use_size_offsets/2; else          if (all_use_dfa || use_dfa) maxcount = use_size_offsets/2; else
5070  #endif  #endif
5071            maxcount = use_size_offsets/3;            /* 2 is a special case; match can be returned */
5072              maxcount = (use_size_offsets == 2)? 1 : use_size_offsets/3;
5073    
5074          /* This is a check against a lunatic return value. */          /* This is a check against a lunatic return value. */
5075    
# Line 5268  while (!done) Line 5287  while (!done)
5287            }            }
5288          }          }
5289    
5290        /* There was a partial match */        /* There was a partial match. If the bumpalong point is not the same as
5291          the first inspected character, show the offset explicitly. */
5292    
5293        else if (count == PCRE_ERROR_PARTIAL)        else if (count == PCRE_ERROR_PARTIAL)
5294          {          {
5295          if (markptr == NULL) fprintf(outfile, "Partial match");          fprintf(outfile, "Partial match");
5296          else          if (use_size_offsets > 2 && use_offsets[0] != use_offsets[2])
5297              fprintf(outfile, " at offset %d", use_offsets[2]);
5298            if (markptr != NULL)
5299            {            {
5300            fprintf(outfile, "Partial match, mark=");            fprintf(outfile, ", mark=");
5301            PCHARSV(markptr, 0, -1, outfile);            PCHARSV(markptr, 0, -1, outfile);
5302            }            }
5303          if (use_size_offsets > 1)          if (use_size_offsets > 1)
# Line 5489  if (dfa_workspace != NULL) Line 5511  if (dfa_workspace != NULL)
5511    free(dfa_workspace);    free(dfa_workspace);
5512  #endif  #endif
5513    
5514    #if defined(__VMS)
5515      yield = SS$_NORMAL;  /* Return values via DCL symbols */
5516    #endif
5517    
5518  return yield;  return yield;
5519  }  }
5520    

Legend:
Removed from v.1189  
changed lines
  Added in v.1313

  ViewVC Help
Powered by ViewVC 1.1.5