/[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 616 by ph10, Mon Jul 11 15:55:25 2011 UTC revision 645 by ph10, Sun Jul 31 17:02:18 2011 UTC
# Line 189  static int locale_set = 0; Line 189  static int locale_set = 0;
189  static int show_malloc;  static int show_malloc;
190  static int use_utf8;  static int use_utf8;
191  static size_t gotten_store;  static size_t gotten_store;
192    static const unsigned char *last_callout_mark = NULL;
193    
194  /* The buffers grow automatically if very long input lines are encountered. */  /* The buffers grow automatically if very long input lines are encountered. */
195    
# Line 225  static const char *errtexts[] = { Line 226  static const char *errtexts[] = {
226    "not used - internal error",    "not used - internal error",
227    "invalid combination of newline options",    "invalid combination of newline options",
228    "bad offset value",    "bad offset value",
229    NULL  /* SHORTUTF8 is handled specially */    NULL,  /* SHORTUTF8 is handled specially */
230      "nested recursion at the same subject position"
231  };  };
232    
233    
# Line 959  fprintf(outfile, "%.*s", (cb->next_item_ Line 961  fprintf(outfile, "%.*s", (cb->next_item_
961  fprintf(outfile, "\n");  fprintf(outfile, "\n");
962  first_callout = 0;  first_callout = 0;
963    
964    if (cb->mark != last_callout_mark)
965      {
966      fprintf(outfile, "Latest Mark: %s\n",
967        (cb->mark == NULL)? "<unset>" : (char *)(cb->mark));
968      last_callout_mark = cb->mark;
969      }
970    
971  if (cb->callout_data != NULL)  if (cb->callout_data != NULL)
972    {    {
973    int callout_data = *((int *)(cb->callout_data));    int callout_data = *((int *)(cb->callout_data));
# Line 1298  while (argc > 1 && argv[op][0] == '-') Line 1307  while (argc > 1 && argv[op][0] == '-')
1307        ((stack_size = get_value((unsigned char *)argv[op+1], &endptr)),        ((stack_size = get_value((unsigned char *)argv[op+1], &endptr)),
1308          *endptr == 0))          *endptr == 0))
1309      {      {
1310  #if defined(_WIN32) || defined(WIN32)  #if defined(_WIN32) || defined(WIN32) || defined(__minix)
1311      printf("PCRE: -S not supported on this OS\n");      printf("PCRE: -S not supported on this OS\n");
1312      exit(1);      exit(1);
1313  #else  #else
# Line 1434  while (!done) Line 1443  while (!done)
1443    const unsigned char *tables = NULL;    const unsigned char *tables = NULL;
1444    unsigned long int true_size, true_study_size = 0;    unsigned long int true_size, true_study_size = 0;
1445    size_t size, regex_gotten_store;    size_t size, regex_gotten_store;
1446      int do_allcaps = 0;
1447    int do_mark = 0;    int do_mark = 0;
1448    int do_study = 0;    int do_study = 0;
1449    int no_force_study = 0;    int no_force_study = 0;
# Line 1611  while (!done) Line 1621  while (!done)
1621        case '+':        case '+':
1622        if (do_showrest) do_showcaprest = 1; else do_showrest = 1;        if (do_showrest) do_showcaprest = 1; else do_showrest = 1;
1623        break;        break;
1624    
1625          case '=': do_allcaps = 1; break;
1626        case 'A': options |= PCRE_ANCHORED; break;        case 'A': options |= PCRE_ANCHORED; break;
1627        case 'B': do_debug = 1; break;        case 'B': do_debug = 1; break;
1628        case 'C': options |= PCRE_AUTO_CALLOUT; break;        case 'C': options |= PCRE_AUTO_CALLOUT; break;
# Line 2208  while (!done) Line 2219  while (!done)
2219    
2220      pcre_callout = callout;      pcre_callout = callout;
2221      first_callout = 1;      first_callout = 1;
2222        last_callout_mark = NULL;
2223      callout_extra = 0;      callout_extra = 0;
2224      callout_count = 0;      callout_count = 0;
2225      callout_fail_count = 999999;      callout_fail_count = 999999;
# Line 2734  while (!done) Line 2746  while (!done)
2746              do_g = do_G = FALSE;        /* Break g/G loop */              do_g = do_G = FALSE;        /* Break g/G loop */
2747              }              }
2748            }            }
2749    
2750            /* do_allcaps requests showing of all captures in the pattern, to check
2751            unset ones at the end. */
2752    
2753            if (do_allcaps)
2754              {
2755              new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count);
2756              count++;   /* Allow for full match */
2757              if (count * 2 > use_size_offsets) count = use_size_offsets/2;
2758              }
2759    
2760            /* Output the captured substrings */
2761    
2762          for (i = 0; i < count * 2; i += 2)          for (i = 0; i < count * 2; i += 2)
2763            {            {
2764            if (use_offsets[i] < 0)            if (use_offsets[i] < 0)
2765                {
2766                if (use_offsets[i] != -1)
2767                  fprintf(outfile, "ERROR: bad negative value %d for offset %d\n",
2768                    use_offsets[i], i);
2769                if (use_offsets[i+1] != -1)
2770                  fprintf(outfile, "ERROR: bad negative value %d for offset %d\n",
2771                    use_offsets[i+1], i+1);
2772              fprintf(outfile, "%2d: <unset>\n", i/2);              fprintf(outfile, "%2d: <unset>\n", i/2);
2773                }
2774            else            else
2775              {              {
2776              fprintf(outfile, "%2d: ", i/2);              fprintf(outfile, "%2d: ", i/2);

Legend:
Removed from v.616  
changed lines
  Added in v.645

  ViewVC Help
Powered by ViewVC 1.1.5