/[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 606 by ph10, Mon Jun 6 17:46:22 2011 UTC revision 612 by ph10, Sat Jul 2 15:20:59 2011 UTC
# Line 1436  while (!done) Line 1436  while (!done)
1436    size_t size, regex_gotten_store;    size_t size, regex_gotten_store;
1437    int do_mark = 0;    int do_mark = 0;
1438    int do_study = 0;    int do_study = 0;
1439      int no_force_study = 0;
1440    int do_debug = debug;    int do_debug = debug;
1441    int do_G = 0;    int do_G = 0;
1442    int do_g = 0;    int do_g = 0;
# Line 1502  while (!done) Line 1503  while (!done)
1503          }          }
1504        }        }
1505    
1506      fprintf(outfile, "Compiled regex%s loaded from %s\n",      fprintf(outfile, "Compiled pattern%s loaded from %s\n",
1507        do_flip? " (byte-inverted)" : "", p);        do_flip? " (byte-inverted)" : "", p);
1508    
1509      /* Need to know if UTF-8 for printing data strings */      /* Need to know if UTF-8 for printing data strings */
# Line 1510  while (!done) Line 1511  while (!done)
1511      new_info(re, NULL, PCRE_INFO_OPTIONS, &get_options);      new_info(re, NULL, PCRE_INFO_OPTIONS, &get_options);
1512      use_utf8 = (get_options & PCRE_UTF8) != 0;      use_utf8 = (get_options & PCRE_UTF8) != 0;
1513    
1514      /* Now see if there is any following study data */      /* Now see if there is any following study data. */
1515    
1516      if (true_study_size != 0)      if (true_study_size != 0)
1517        {        {
# Line 1624  while (!done) Line 1625  while (!done)
1625        case 'P': do_posix = 1; break;        case 'P': do_posix = 1; break;
1626  #endif  #endif
1627    
1628        case 'S': do_study = 1; break;        case 'S':
1629          if (do_study == 0) do_study = 1; else
1630            {
1631            do_study = 0;
1632            no_force_study = 1;
1633            }
1634          break;
1635    
1636        case 'U': options |= PCRE_UNGREEDY; break;        case 'U': options |= PCRE_UNGREEDY; break;
1637        case 'W': options |= PCRE_UCP; break;        case 'W': options |= PCRE_UCP; break;
1638        case 'X': options |= PCRE_EXTRA; break;        case 'X': options |= PCRE_EXTRA; break;
# Line 1808  while (!done) Line 1816  while (!done)
1816      true_size = ((real_pcre *)re)->size;      true_size = ((real_pcre *)re)->size;
1817      regex_gotten_store = gotten_store;      regex_gotten_store = gotten_store;
1818    
1819      /* If -s or /S was present, study the regexp to generate additional info to      /* If -s or /S was present, study the regex to generate additional info to
1820      help with the matching. */      help with the matching, unless the pattern has the SS option, which
1821        suppresses the effect of /S (used for a few test patterns where studying is
1822        never sensible). */
1823    
1824      if (do_study || force_study)      if (do_study || (force_study && !no_force_study))
1825        {        {
1826        if (timeit > 0)        if (timeit > 0)
1827          {          {
# Line 2049  while (!done) Line 2059  while (!done)
2059        /* 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
2060        value, but it varies, depending on the computer architecture, and        value, but it varies, depending on the computer architecture, and
2061        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
2062        flipped.) */        flipped.) If study was forced by an external -s, don't show this
2063          information unless -i or -d was also present. This means that, except
2064          when auto-callouts are involved, the output from runs with and without
2065          -s should be identical. */
2066    
2067        if (do_study || force_study)        if (do_study || (force_study && showinfo && !no_force_study))
2068          {          {
2069          if (extra == NULL)          if (extra == NULL)
2070            fprintf(outfile, "Study returned NULL\n");            fprintf(outfile, "Study returned NULL\n");
# Line 2129  while (!done) Line 2142  while (!done)
2142            }            }
2143          else          else
2144            {            {
2145            fprintf(outfile, "Compiled regex written to %s\n", to_file);            fprintf(outfile, "Compiled pattern written to %s\n", to_file);
2146    
2147              /* If there is study data, write it, but verify the writing only
2148              if the studying was requested by /S, not just by -s. */
2149    
2150            if (extra != NULL)            if (extra != NULL)
2151              {              {
2152              if (fwrite(extra->study_data, 1, true_study_size, f) <              if (fwrite(extra->study_data, 1, true_study_size, f) <
# Line 2139  while (!done) Line 2156  while (!done)
2156                  strerror(errno));                  strerror(errno));
2157                }                }
2158              else fprintf(outfile, "Study data written to %s\n", to_file);              else fprintf(outfile, "Study data written to %s\n", to_file);
   
2159              }              }
2160            }            }
2161          fclose(f);          fclose(f);

Legend:
Removed from v.606  
changed lines
  Added in v.612

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12