Diff for /embedaddon/pcre/pcretest.c between versions 1.1.1.4 and 1.1.1.5

version 1.1.1.4, 2013/07/22 08:25:55 version 1.1.1.5, 2014/06/15 19:46:03
Line 1016  static int jit_was_used; Line 1016  static int jit_was_used;
 static int locale_set = 0;  static int locale_set = 0;
 static int show_malloc;  static int show_malloc;
 static int use_utf;  static int use_utf;
 static size_t gotten_store;  
 static size_t first_gotten_store = 0;  
 static const unsigned char *last_callout_mark = NULL;  static const unsigned char *last_callout_mark = NULL;
   
 /* The buffers grow automatically if very long input lines are encountered. */  /* The buffers grow automatically if very long input lines are encountered. */
Line 1290  graph, print, punct, and cntrl. Other classes are buil Line 1288  graph, print, punct, and cntrl. Other classes are buil
 */  */
   
   0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*   0-  7 */    0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*   0-  7 */
  0x00,0x01,0x01,0x00,0x01,0x01,0x00,0x00, /*   8- 15 */  0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00, /*   8- 15 */
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*  16- 23 */    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*  16- 23 */
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*  24- 31 */    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*  24- 31 */
   0x01,0x00,0x00,0x00,0x80,0x00,0x00,0x00, /*    - '  */    0x01,0x00,0x00,0x00,0x80,0x00,0x00,0x00, /*    - '  */
Line 1322  graph, print, punct, and cntrl. Other classes are buil Line 1320  graph, print, punct, and cntrl. Other classes are buil
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 240-247 */    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 240-247 */
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};/* 248-255 */    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};/* 248-255 */
   
/* This is a set of tables that came originally from a Windows user. It seems to/* This is a set of tables that came originally from a Windows user. It seems
be at least an approximation of ISO 8859. In particular, there are charactersto be at least an approximation of ISO 8859. In particular, there are
greater than 128 that are marked as spaces, letters, etc. */characters greater than 128 that are marked as spaces, letters, etc. */
   
 static const pcre_uint8 tables1[] = {  static const pcre_uint8 tables1[] = {
 0,1,2,3,4,5,6,7,  0,1,2,3,4,5,6,7,
Line 1916  for (;;) Line 1914  for (;;)
     }      }
   }    }
   
return NULL;  /* Control never gets here *//* Control never gets here */
 }  }
   
   
Line 2031  return yield; Line 2029  return yield;
   
 static int strlen16(PCRE_SPTR16 p)  static int strlen16(PCRE_SPTR16 p)
 {  {
int len = 0;PCRE_SPTR16 pp = p;
while (*p++ != 0) len++;while (*pp != 0) pp++;
return len;return (int)(pp - p);
 }  }
 #endif  /* SUPPORT_PCRE16 */  #endif  /* SUPPORT_PCRE16 */
   
Line 2046  return len; Line 2044  return len;
   
 static int strlen32(PCRE_SPTR32 p)  static int strlen32(PCRE_SPTR32 p)
 {  {
int len = 0;PCRE_SPTR32 pp = p;
while (*p++ != 0) len++;while (*pp != 0) pp++;
return len;return (int)(pp - p);
 }  }
 #endif  /* SUPPORT_PCRE32 */  #endif  /* SUPPORT_PCRE32 */
   
Line 2322  show_malloc variable is set only during matching. */ Line 2320  show_malloc variable is set only during matching. */
 static void *new_malloc(size_t size)  static void *new_malloc(size_t size)
 {  {
 void *block = malloc(size);  void *block = malloc(size);
 gotten_store = size;  
 if (first_gotten_store == 0) first_gotten_store = size;  
 if (show_malloc)  if (show_malloc)
   fprintf(outfile, "malloc       %3d %p\n", (int)size, block);    fprintf(outfile, "malloc       %3d %p\n", (int)size, block);
 return block;  return block;
Line 2827  return 0; Line 2823  return 0;
   
   
 /*************************************************  /*************************************************
*         Check newline indicator                **         Check multicharacter option            *
 *************************************************/  *************************************************/
   
 /* This is used both at compile and run-time to check for <xxx> escapes. Print  /* This is used both at compile and run-time to check for <xxx> escapes. Print
Line 2836  a message and return 0 if there is no match. Line 2832  a message and return 0 if there is no match.
 Arguments:  Arguments:
   p           points after the leading '<'    p           points after the leading '<'
   f           file for error message    f           file for error message
     nl          TRUE to check only for newline settings
     stype       "modifier" or "escape sequence"
   
 Returns:      appropriate PCRE_NEWLINE_xxx flags, or 0  Returns:      appropriate PCRE_NEWLINE_xxx flags, or 0
 */  */
   
 static int  static int
check_newline(pcre_uint8 *p, FILE *f)check_mc_option(pcre_uint8 *p, FILE *f, BOOL nl, const char *stype)
 {  {
 if (strncmpic(p, (pcre_uint8 *)"cr>", 3) == 0) return PCRE_NEWLINE_CR;  if (strncmpic(p, (pcre_uint8 *)"cr>", 3) == 0) return PCRE_NEWLINE_CR;
 if (strncmpic(p, (pcre_uint8 *)"lf>", 3) == 0) return PCRE_NEWLINE_LF;  if (strncmpic(p, (pcre_uint8 *)"lf>", 3) == 0) return PCRE_NEWLINE_LF;
Line 2850  if (strncmpic(p, (pcre_uint8 *)"anycrlf>", 8) == 0) re Line 2848  if (strncmpic(p, (pcre_uint8 *)"anycrlf>", 8) == 0) re
 if (strncmpic(p, (pcre_uint8 *)"any>", 4) == 0) return PCRE_NEWLINE_ANY;  if (strncmpic(p, (pcre_uint8 *)"any>", 4) == 0) return PCRE_NEWLINE_ANY;
 if (strncmpic(p, (pcre_uint8 *)"bsr_anycrlf>", 12) == 0) return PCRE_BSR_ANYCRLF;  if (strncmpic(p, (pcre_uint8 *)"bsr_anycrlf>", 12) == 0) return PCRE_BSR_ANYCRLF;
 if (strncmpic(p, (pcre_uint8 *)"bsr_unicode>", 12) == 0) return PCRE_BSR_UNICODE;  if (strncmpic(p, (pcre_uint8 *)"bsr_unicode>", 12) == 0) return PCRE_BSR_UNICODE;
fprintf(f, "Unknown newline type at: <%s\n", p);
 if (!nl)
   {
   if (strncmpic(p, (pcre_uint8 *)"JS>", 3) == 0) return PCRE_JAVASCRIPT_COMPAT;
   }
 
 fprintf(f, "Unknown %s at: <%s\n", stype, p);
 return 0;  return 0;
 }  }
   
Line 2897  printf("  -help    show usage information\n"); Line 2901  printf("  -help    show usage information\n");
 printf("  -i       show information about compiled patterns\n"  printf("  -i       show information about compiled patterns\n"
        "  -M       find MATCH_LIMIT minimum for each subject\n"         "  -M       find MATCH_LIMIT minimum for each subject\n"
        "  -m       output memory used information\n"         "  -m       output memory used information\n"
          "  -O       set PCRE_NO_AUTO_POSSESS on each pattern\n"
        "  -o <n>   set size of offsets vector to <n>\n");         "  -o <n>   set size of offsets vector to <n>\n");
 #if !defined NOPOSIX  #if !defined NOPOSIX
 printf("  -p       use POSIX interface\n");  printf("  -p       use POSIX interface\n");
Line 2913  printf("  -s       force each pattern to be studied at Line 2918  printf("  -s       force each pattern to be studied at
 printf("  -t <n>   time compilation and execution, repeating <n> times\n");  printf("  -t <n>   time compilation and execution, repeating <n> times\n");
 printf("  -tm      time execution (matching) only\n");  printf("  -tm      time execution (matching) only\n");
 printf("  -tm <n>  time execution (matching) only, repeating <n> times\n");  printf("  -tm <n>  time execution (matching) only, repeating <n> times\n");
   printf("  -T       same as -t, but show total times at the end\n");
   printf("  -TM      same as -tm, but show total time at the end\n");
 }  }
   
   
Line 2932  const char *version; Line 2939  const char *version;
 int options = 0;  int options = 0;
 int study_options = 0;  int study_options = 0;
 int default_find_match_limit = FALSE;  int default_find_match_limit = FALSE;
   pcre_uint32 default_options = 0;
 int op = 1;  int op = 1;
 int timeit = 0;  int timeit = 0;
 int timeitm = 0;  int timeitm = 0;
   int showtotaltimes = 0;
 int showinfo = 0;  int showinfo = 0;
 int showstore = 0;  int showstore = 0;
 int force_study = -1;  int force_study = -1;
Line 2950  int verify_jit = 0; Line 2959  int verify_jit = 0;
 int yield = 0;  int yield = 0;
 int stack_size;  int stack_size;
 pcre_uint8 *dbuffer = NULL;  pcre_uint8 *dbuffer = NULL;
   pcre_uint8 lockout[24] = { 0 };
 size_t dbuffer_size = 1u << 14;  size_t dbuffer_size = 1u << 14;
   clock_t total_compile_time = 0;
   clock_t total_study_time = 0;
   clock_t total_match_time = 0;
   
 #if !defined NOPOSIX  #if !defined NOPOSIX
 int posix = 0;  int posix = 0;
Line 3073  while (argc > 1 && argv[op][0] == '-') Line 3086  while (argc > 1 && argv[op][0] == '-')
   else if (strcmp(arg, "-i") == 0) showinfo = 1;    else if (strcmp(arg, "-i") == 0) showinfo = 1;
   else if (strcmp(arg, "-d") == 0) showinfo = debug = 1;    else if (strcmp(arg, "-d") == 0) showinfo = debug = 1;
   else if (strcmp(arg, "-M") == 0) default_find_match_limit = TRUE;    else if (strcmp(arg, "-M") == 0) default_find_match_limit = TRUE;
     else if (strcmp(arg, "-O") == 0) default_options |= PCRE_NO_AUTO_POSSESS;
 #if !defined NODFA  #if !defined NODFA
   else if (strcmp(arg, "-dfa") == 0) all_use_dfa = 1;    else if (strcmp(arg, "-dfa") == 0) all_use_dfa = 1;
 #endif  #endif
Line 3083  while (argc > 1 && argv[op][0] == '-') Line 3097  while (argc > 1 && argv[op][0] == '-')
     op++;      op++;
     argc--;      argc--;
     }      }
  else if (strcmp(arg, "-t") == 0 || strcmp(arg, "-tm") == 0)  else if (strcmp(arg, "-t") == 0 || strcmp(arg, "-tm") == 0 ||
            strcmp(arg, "-T") == 0 || strcmp(arg, "-TM") == 0)
     {      {
     int both = arg[2] == 0;  
     int temp;      int temp;
       int both = arg[2] == 0;
       showtotaltimes = arg[1] == 'T';
     if (argc > 2 && (temp = get_value((pcre_uint8 *)argv[op+1], &endptr),      if (argc > 2 && (temp = get_value((pcre_uint8 *)argv[op+1], &endptr),
                      *endptr == 0))                       *endptr == 0))
       {        {
Line 3287  are set, either both UTFs are supported or both are no Line 3303  are set, either both UTFs are supported or both are no
     printf("  Internal link size = %d\n", rc);      printf("  Internal link size = %d\n", rc);
     (void)PCRE_CONFIG(PCRE_CONFIG_POSIX_MALLOC_THRESHOLD, &rc);      (void)PCRE_CONFIG(PCRE_CONFIG_POSIX_MALLOC_THRESHOLD, &rc);
     printf("  POSIX malloc threshold = %d\n", rc);      printf("  POSIX malloc threshold = %d\n", rc);
       (void)PCRE_CONFIG(PCRE_CONFIG_PARENS_LIMIT, &lrc);
       printf("  Parentheses nest limit = %ld\n", lrc);
     (void)PCRE_CONFIG(PCRE_CONFIG_MATCH_LIMIT, &lrc);      (void)PCRE_CONFIG(PCRE_CONFIG_MATCH_LIMIT, &lrc);
     printf("  Default match limit = %ld\n", lrc);      printf("  Default match limit = %ld\n", lrc);
     (void)PCRE_CONFIG(PCRE_CONFIG_MATCH_LIMIT_RECURSION, &lrc);      (void)PCRE_CONFIG(PCRE_CONFIG_MATCH_LIMIT_RECURSION, &lrc);
Line 3378  pcre32_stack_malloc = stack_malloc; Line 3396  pcre32_stack_malloc = stack_malloc;
 pcre32_stack_free = stack_free;  pcre32_stack_free = stack_free;
 #endif  #endif
   
/* Heading line unless quiet, then prompt for first regex if stdin *//* Heading line unless quiet */
   
 if (!quiet) fprintf(outfile, "PCRE version %s\n\n", version);  if (!quiet) fprintf(outfile, "PCRE version %s\n\n", version);
   
Line 3401  while (!done) Line 3419  while (!done)
   const pcre_uint8 *tables = NULL;    const pcre_uint8 *tables = NULL;
   unsigned long int get_options;    unsigned long int get_options;
   unsigned long int true_size, true_study_size = 0;    unsigned long int true_size, true_study_size = 0;
  size_t size, regex_gotten_store;  size_t size;
   int do_allcaps = 0;    int do_allcaps = 0;
   int do_mark = 0;    int do_mark = 0;
   int do_study = 0;    int do_study = 0;
Line 3430  while (!done) Line 3448  while (!done)
   while (isspace(*p)) p++;    while (isspace(*p)) p++;
   if (*p == 0) continue;    if (*p == 0) continue;
   
     /* Handle option lock-out setting */
   
     if (*p == '<' && p[1] == ' ')
       {
       p += 2;
       while (isspace(*p)) p++;
       if (strncmp((char *)p, "forbid ", 7) == 0)
         {
         p += 7;
         while (isspace(*p)) p++;
         pp = lockout;
         while (!isspace(*p) && pp < lockout + sizeof(lockout) - 1)
           *pp++ = *p++;
         *pp = 0;
         }
       else
         {
         printf("** Unrecognized special command '%s'\n", p);
         yield = 1;
         goto EXIT;
         }
       continue;
       }
   
   /* See if the pattern is to be loaded pre-compiled from a file. */    /* See if the pattern is to be loaded pre-compiled from a file. */
   
   if (*p == '<' && strchr((char *)(p+1), '<') == NULL)    if (*p == '<' && strchr((char *)(p+1), '<') == NULL)
Line 3456  while (!done) Line 3498  while (!done)
       fprintf(outfile, "Failed to open %s: %s\n", p, strerror(errno));        fprintf(outfile, "Failed to open %s: %s\n", p, strerror(errno));
       continue;        continue;
       }        }
   
     first_gotten_store = 0;  
     if (fread(sbuf, 1, 8, f) != 8) goto FAIL_READ;      if (fread(sbuf, 1, 8, f) != 8) goto FAIL_READ;
   
     true_size =      true_size =
Line 3473  while (!done) Line 3513  while (!done)
       yield = 1;        yield = 1;
       goto EXIT;        goto EXIT;
       }        }
     regex_gotten_store = first_gotten_store;  
   
     if (fread(re, 1, true_size, f) != true_size) goto FAIL_READ;      if (fread(re, 1, true_size, f) != true_size) goto FAIL_READ;
   
     magic = REAL_PCRE_MAGIC(re);      magic = REAL_PCRE_MAGIC(re);
Line 3613  while (!done) Line 3651  while (!done)
   *pp++ = 0;    *pp++ = 0;
   strcpy((char *)pbuffer, (char *)p);    strcpy((char *)pbuffer, (char *)p);
   
  /* Look for options after final delimiter */  /* Look for modifiers and options after the final delimiter. */
   
  options = 0;  options = default_options;
   study_options = force_study_options;    study_options = force_study_options;
   log_store = showstore;  /* default from command line */    log_store = showstore;  /* default from command line */
   
   while (*pp != 0)    while (*pp != 0)
     {      {
       /* Check to see whether this modifier has been locked out for this file.
       This is complicated for the multi-character options that begin with '<'.
       If there is no '>' in the lockout string, all multi-character modifiers are
       locked out. */
   
       if (strchr((char *)lockout, *pp) != NULL)
         {
         if (*pp == '<' && strchr((char *)lockout, '>') != NULL)
           {
           int x = check_mc_option(pp+1, outfile, FALSE, "modifier");
           if (x == 0) goto SKIP_DATA;
   
           for (ppp = lockout; *ppp != 0; ppp++)
             {
             if (*ppp == '<')
               {
               int y = check_mc_option(ppp+1, outfile, FALSE, "modifier");
               if (y == 0)
                 {
                 printf("** Error in modifier forbid data - giving up.\n");
                 yield = 1;
                 goto EXIT;
                 }
               if (x == y)
                 {
                 ppp = pp;
                 while (*ppp != '>') ppp++;
                 printf("** The %.*s modifier is locked out - giving up.\n",
                   (int)(ppp - pp + 1), pp);
                 yield = 1;
                 goto EXIT;
                 }
               }
             }
           }
   
         /* The single-character modifiers are straightforward. */
   
         else
           {
           printf("** The /%c modifier is locked out - giving up.\n", *pp);
           yield = 1;
           goto EXIT;
           }
         }
   
       /* The modifier is not locked out; handle it. */
   
     switch (*pp++)      switch (*pp++)
       {        {
       case 'f': options |= PCRE_FIRSTLINE; break;        case 'f': options |= PCRE_FIRSTLINE; break;
Line 3647  while (!done) Line 3733  while (!done)
       case 'K': do_mark = 1; break;        case 'K': do_mark = 1; break;
       case 'M': log_store = 1; break;        case 'M': log_store = 1; break;
       case 'N': options |= PCRE_NO_AUTO_CAPTURE; break;        case 'N': options |= PCRE_NO_AUTO_CAPTURE; break;
         case 'O': options |= PCRE_NO_AUTO_POSSESS; break;
   
 #if !defined NOPOSIX  #if !defined NOPOSIX
       case 'P': do_posix = 1; break;        case 'P': do_posix = 1; break;
Line 3744  while (!done) Line 3831  while (!done)
   
       case '<':        case '<':
         {          {
        if (strncmpic(pp, (pcre_uint8 *)"JS>", 3) == 0)        int x = check_mc_option(pp, outfile, FALSE, "modifier");
          {        if (x == 0) goto SKIP_DATA;
          options |= PCRE_JAVASCRIPT_COMPAT;        options |= x;
          pp += 3;        while (*pp++ != '>');
          } 
        else 
          { 
          int x = check_newline(pp, outfile); 
          if (x == 0) goto SKIP_DATA; 
          options |= x; 
          while (*pp++ != '>'); 
          } 
         }          }
       break;        break;
   
Line 3765  while (!done) Line 3844  while (!done)
       break;        break;
   
       default:        default:
      fprintf(outfile, "** Unknown option '%c'\n", pp[-1]);      fprintf(outfile, "** Unknown modifier '%c'\n", pp[-1]);
       goto SKIP_DATA;        goto SKIP_DATA;
       }        }
     }      }
Line 3788  while (!done) Line 3867  while (!done)
     if ((options & PCRE_UCP) != 0) cflags |= REG_UCP;      if ((options & PCRE_UCP) != 0) cflags |= REG_UCP;
     if ((options & PCRE_UNGREEDY) != 0) cflags |= REG_UNGREEDY;      if ((options & PCRE_UNGREEDY) != 0) cflags |= REG_UNGREEDY;
   
     first_gotten_store = 0;  
     rc = regcomp(&preg, (char *)p, cflags);      rc = regcomp(&preg, (char *)p, cflags);
   
     /* Compilation failed; go back for another re, skipping to blank line      /* Compilation failed; go back for another re, skipping to blank line
Line 3875  while (!done) Line 3953  while (!done)
         PCRE_COMPILE(re, p, options, &error, &erroroffset, tables);          PCRE_COMPILE(re, p, options, &error, &erroroffset, tables);
         if (re != NULL) free(re);          if (re != NULL) free(re);
         }          }
      time_taken = clock() - start_time;      total_compile_time += (time_taken = clock() - start_time);
       fprintf(outfile, "Compile time %.4f milliseconds\n",        fprintf(outfile, "Compile time %.4f milliseconds\n",
         (((double)time_taken * 1000.0) / (double)timeit) /          (((double)time_taken * 1000.0) / (double)timeit) /
           (double)CLOCKS_PER_SEC);            (double)CLOCKS_PER_SEC);
       }        }
   
     first_gotten_store = 0;  
     PCRE_COMPILE(re, p, options, &error, &erroroffset, tables);      PCRE_COMPILE(re, p, options, &error, &erroroffset, tables);
   
     /* Compilation failed; go back for another re, skipping to blank line      /* Compilation failed; go back for another re, skipping to blank line
Line 3921  while (!done) Line 3998  while (!done)
     and remember the store that was got. */      and remember the store that was got. */
   
     true_size = REAL_PCRE_SIZE(re);      true_size = REAL_PCRE_SIZE(re);
     regex_gotten_store = first_gotten_store;  
   
     /* Output code size information if requested */      /* Output code size information if requested */
   
Line 3944  while (!done) Line 4020  while (!done)
       if (REAL_PCRE_FLAGS(re) & PCRE_MODE32)        if (REAL_PCRE_FLAGS(re) & PCRE_MODE32)
         real_pcre_size = sizeof(real_pcre32);          real_pcre_size = sizeof(real_pcre32);
 #endif  #endif
         new_info(re, NULL, PCRE_INFO_SIZE, &size);
       fprintf(outfile, "Memory allocation (code space): %d\n",        fprintf(outfile, "Memory allocation (code space): %d\n",
        (int)(first_gotten_store - real_pcre_size - name_count * name_entry_size));        (int)(size - real_pcre_size - name_count * name_entry_size));
       }        }
   
     /* If -s or /S was present, study the regex to generate additional info to      /* If -s or /S was present, study the regex to generate additional info to
Line 3964  while (!done) Line 4041  while (!done)
           {            {
           PCRE_STUDY(extra, re, study_options, &error);            PCRE_STUDY(extra, re, study_options, &error);
           }            }
        time_taken = clock() - start_time;        total_study_time = (time_taken = clock() - start_time);
         if (extra != NULL)          if (extra != NULL)
           {            {
           PCRE_FREE_STUDY(extra);            PCRE_FREE_STUDY(extra);
Line 4020  while (!done) Line 4097  while (!done)
       pcre_uint32 first_char, need_char;        pcre_uint32 first_char, need_char;
       pcre_uint32 match_limit, recursion_limit;        pcre_uint32 match_limit, recursion_limit;
       int count, backrefmax, first_char_set, need_char_set, okpartial, jchanged,        int count, backrefmax, first_char_set, need_char_set, okpartial, jchanged,
        hascrorlf, maxlookbehind;        hascrorlf, maxlookbehind, match_empty;
       int nameentrysize, namecount;        int nameentrysize, namecount;
       const pcre_uint8 *nametable;        const pcre_uint8 *nametable;
   
      if (new_info(re, NULL, PCRE_INFO_SIZE, &size) +      if (new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count) +
          new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count) + 
           new_info(re, NULL, PCRE_INFO_BACKREFMAX, &backrefmax) +            new_info(re, NULL, PCRE_INFO_BACKREFMAX, &backrefmax) +
           new_info(re, NULL, PCRE_INFO_FIRSTCHARACTER, &first_char) +            new_info(re, NULL, PCRE_INFO_FIRSTCHARACTER, &first_char) +
           new_info(re, NULL, PCRE_INFO_FIRSTCHARACTERFLAGS, &first_char_set) +            new_info(re, NULL, PCRE_INFO_FIRSTCHARACTERFLAGS, &first_char_set) +
Line 4037  while (!done) Line 4113  while (!done)
           new_info(re, NULL, PCRE_INFO_OKPARTIAL, &okpartial) +            new_info(re, NULL, PCRE_INFO_OKPARTIAL, &okpartial) +
           new_info(re, NULL, PCRE_INFO_JCHANGED, &jchanged) +            new_info(re, NULL, PCRE_INFO_JCHANGED, &jchanged) +
           new_info(re, NULL, PCRE_INFO_HASCRORLF, &hascrorlf) +            new_info(re, NULL, PCRE_INFO_HASCRORLF, &hascrorlf) +
             new_info(re, NULL, PCRE_INFO_MATCH_EMPTY, &match_empty) +
           new_info(re, NULL, PCRE_INFO_MAXLOOKBEHIND, &maxlookbehind)            new_info(re, NULL, PCRE_INFO_MAXLOOKBEHIND, &maxlookbehind)
           != 0)            != 0)
         goto SKIP_DATA;          goto SKIP_DATA;
   
       if (size != regex_gotten_store) fprintf(outfile,  
         "Size disagreement: pcre_fullinfo=%d call to malloc for %d\n",  
         (int)size, (int)regex_gotten_store);  
   
       fprintf(outfile, "Capturing subpattern count = %d\n", count);        fprintf(outfile, "Capturing subpattern count = %d\n", count);
   
       if (backrefmax > 0)        if (backrefmax > 0)
Line 4085  while (!done) Line 4158  while (!done)
           }            }
         }          }
   
      if (!okpartial) fprintf(outfile, "Partial matching not supported\n");      if (!okpartial)  fprintf(outfile, "Partial matching not supported\n");
      if (hascrorlf) fprintf(outfile, "Contains explicit CR or LF match\n");      if (hascrorlf)   fprintf(outfile, "Contains explicit CR or LF match\n");
       if (match_empty) fprintf(outfile, "May match empty string\n");
   
       all_options = REAL_PCRE_OPTIONS(re);        all_options = REAL_PCRE_OPTIONS(re);
       if (do_flip) all_options = swap_uint32(all_options);        if (do_flip) all_options = swap_uint32(all_options);
   
       if (get_options == 0) fprintf(outfile, "No options\n");        if (get_options == 0) fprintf(outfile, "No options\n");
        else fprintf(outfile, "Options:%s%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%s\n",
           ((get_options & PCRE_ANCHORED) != 0)? " anchored" : "",            ((get_options & PCRE_ANCHORED) != 0)? " anchored" : "",
           ((get_options & PCRE_CASELESS) != 0)? " caseless" : "",            ((get_options & PCRE_CASELESS) != 0)? " caseless" : "",
           ((get_options & PCRE_EXTENDED) != 0)? " extended" : "",            ((get_options & PCRE_EXTENDED) != 0)? " extended" : "",
Line 4105  while (!done) Line 4179  while (!done)
           ((get_options & PCRE_EXTRA) != 0)? " extra" : "",            ((get_options & PCRE_EXTRA) != 0)? " extra" : "",
           ((get_options & PCRE_UNGREEDY) != 0)? " ungreedy" : "",            ((get_options & PCRE_UNGREEDY) != 0)? " ungreedy" : "",
           ((get_options & PCRE_NO_AUTO_CAPTURE) != 0)? " no_auto_capture" : "",            ((get_options & PCRE_NO_AUTO_CAPTURE) != 0)? " no_auto_capture" : "",
             ((get_options & PCRE_NO_AUTO_POSSESS) != 0)? " no_auto_possessify" : "",
           ((get_options & PCRE_UTF8) != 0)? " utf" : "",            ((get_options & PCRE_UTF8) != 0)? " utf" : "",
           ((get_options & PCRE_UCP) != 0)? " ucp" : "",            ((get_options & PCRE_UCP) != 0)? " ucp" : "",
           ((get_options & PCRE_NO_UTF8_CHECK) != 0)? " no_utf_check" : "",            ((get_options & PCRE_NO_UTF8_CHECK) != 0)? " no_utf_check" : "",
Line 4498  while (!done) Line 4573  while (!done)
           c = c * 8 + *p++ - '0';            c = c * 8 + *p++ - '0';
         break;          break;
   
           case 'o':
           if (*p == '{')
             {
             pcre_uint8 *pt = p;
             c = 0;
             for (pt++; isdigit(*pt) && *pt != '8' && *pt != '9'; pt++)
               {
               if (++i == 12)
                 fprintf(outfile, "** Too many octal digits in \\o{...} item; "
                                  "using only the first twelve.\n");
               else c = c * 8 + *pt - '0';
               }
             if (*pt == '}') p = pt + 1;
               else fprintf(outfile, "** Missing } after \\o{ (assumed)\n");
             }
           break;
   
         case 'x':          case 'x':
         if (*p == '{')          if (*p == '{')
           {            {
Line 4740  while (!done) Line 4832  while (!done)
   
         case '<':          case '<':
           {            {
          int x = check_newline(p, outfile);          int x = check_mc_option(p, outfile, TRUE, "escape sequence");
           if (x == 0) goto NEXT_DATA;            if (x == 0) goto NEXT_DATA;
           options |= x;            options |= x;
           while (*p++ != '>');            while (*p++ != '>');
Line 4982  while (!done) Line 5074  while (!done)
           PCRE_EXEC(count, re, extra, bptr, len, start_offset,            PCRE_EXEC(count, re, extra, bptr, len, start_offset,
             (options | g_notempty), use_offsets, use_size_offsets);              (options | g_notempty), use_offsets, use_size_offsets);
           }            }
        time_taken = clock() - start_time;        total_match_time += (time_taken = clock() - start_time);
         fprintf(outfile, "Execute time %.4f milliseconds\n",          fprintf(outfile, "Execute time %.4f milliseconds\n",
           (((double)time_taken * 1000.0) / (double)timeitm) /            (((double)time_taken * 1000.0) / (double)timeitm) /
             (double)CLOCKS_PER_SEC);              (double)CLOCKS_PER_SEC);
Line 5491  while (!done) Line 5583  while (!done)
   }    }
   
 if (infile == stdin) fprintf(outfile, "\n");  if (infile == stdin) fprintf(outfile, "\n");
   
   if (showtotaltimes)
     {
     fprintf(outfile, "--------------------------------------\n");
     if (timeit > 0)
       {
       fprintf(outfile, "Total compile time %.4f milliseconds\n",
         (((double)total_compile_time * 1000.0) / (double)timeit) /
           (double)CLOCKS_PER_SEC);
       fprintf(outfile, "Total study time   %.4f milliseconds\n",
         (((double)total_study_time * 1000.0) / (double)timeit) /
           (double)CLOCKS_PER_SEC);
       }
     fprintf(outfile, "Total execute time %.4f milliseconds\n",
       (((double)total_match_time * 1000.0) / (double)timeitm) /
         (double)CLOCKS_PER_SEC);
     }
   
 EXIT:  EXIT:
   

Removed from v.1.1.1.4  
changed lines
  Added in v.1.1.1.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>