/[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 9 by nigel, Sat Feb 24 21:38:13 2007 UTC revision 13 by nigel, Sat Feb 24 21:38:21 2007 UTC
# Line 38  static const char *OP_names[] = { Line 38  static const char *OP_names[] = {
38    "*", "*?", "+", "+?", "?", "??", "{", "{", "{",    "*", "*?", "+", "+?", "?", "??", "{", "{", "{",
39    "*", "*?", "+", "+?", "?", "??", "{", "{", "{",    "*", "*?", "+", "+?", "?", "??", "{", "{", "{",
40    "*", "*?", "+", "+?", "?", "??", "{", "{",    "*", "*?", "+", "+?", "?", "??", "{", "{",
41    "class", "Ref",    "class", "negclass", "Ref",
42    "Alt", "Ket", "KetRmax", "KetRmin", "Assert", "Assert not", "Once",    "Alt", "Ket", "KetRmax", "KetRmin", "Assert", "Assert not", "Once",
43    "Brazero", "Braminzero", "Bra"    "Brazero", "Braminzero", "Bra"
44  };  };
# Line 122  for(;;) Line 122  for(;;)
122      case OP_TYPEUPTO:      case OP_TYPEUPTO:
123      case OP_TYPEMINUPTO:      case OP_TYPEMINUPTO:
124      printf("    %s{", OP_names[code[3]]);      printf("    %s{", OP_names[code[3]]);
125      if (*code != OP_TYPEEXACT) printf(",");      if (*code != OP_TYPEEXACT) printf("0,");
126      printf("%d}", (code[1] << 8) + code[2]);      printf("%d}", (code[1] << 8) + code[2]);
127      if (*code == OP_TYPEMINUPTO) printf("?");      if (*code == OP_TYPEMINUPTO) printf("?");
128      code += 3;      code += 3;
# Line 161  for(;;) Line 161  for(;;)
161      goto CLASS_REF_REPEAT;      goto CLASS_REF_REPEAT;
162    
163      case OP_CLASS:      case OP_CLASS:
164        case OP_NEGCLASS:
165        {        {
166        int i, min, max;        int i, min, max;
167          if (*code++ == OP_CLASS) printf("    [");
168        code++;          else printf("   ^[");
       printf("    [");  
169    
170        for (i = 0; i < 256; i++)        for (i = 0; i < 256; i++)
171          {          {
# Line 268  int timeit = 0; Line 268  int timeit = 0;
268  int showinfo = 0;  int showinfo = 0;
269  int posix = 0;  int posix = 0;
270  int debug = 0;  int debug = 0;
271    int done = 0;
272  unsigned char buffer[30000];  unsigned char buffer[30000];
273  unsigned char dbuffer[1024];  unsigned char dbuffer[1024];
274    
# Line 326  fprintf(outfile, "PCRE version %s\n\n", Line 327  fprintf(outfile, "PCRE version %s\n\n",
327    
328  /* Main loop */  /* Main loop */
329    
330  for (;;)  while (!done)
331    {    {
332    pcre *re = NULL;    pcre *re = NULL;
333    pcre_extra *extra = NULL;    pcre_extra *extra = NULL;
# Line 375  for (;;) Line 376  for (;;)
376      if (fgets((char *)pp, len, infile) == NULL)      if (fgets((char *)pp, len, infile) == NULL)
377        {        {
378        fprintf(outfile, "** Unexpected EOF\n");        fprintf(outfile, "** Unexpected EOF\n");
379        goto END_OFF;        done = 1;
380          goto CONTINUE;
381        }        }
382      if (infile != stdin) fprintf(outfile, (char *)pp);      if (infile != stdin) fprintf(outfile, (char *)pp);
383      }      }
# Line 410  for (;;) Line 412  for (;;)
412        }        }
413      }      }
414    
415    /* Handle compiing via the POSIX interface, which doesn't support the    /* Handle compiling via the POSIX interface, which doesn't support the
416    timing, showing, or debugging options. */    timing, showing, or debugging options. */
417    
418    if (posix || do_posix)    if (posix || do_posix)
# Line 465  for (;;) Line 467  for (;;)
467          for (;;)          for (;;)
468            {            {
469            if (fgets((char *)buffer, sizeof(buffer), infile) == NULL)            if (fgets((char *)buffer, sizeof(buffer), infile) == NULL)
470              goto END_OFF;              {
471                done = 1;
472                goto CONTINUE;
473                }
474            len = (int)strlen((char *)buffer);            len = (int)strlen((char *)buffer);
475            while (len > 0 && isspace(buffer[len-1])) len--;            while (len > 0 && isspace(buffer[len-1])) len--;
476            if (len == 0) break;            if (len == 0) break;
# Line 592  for (;;) Line 597  for (;;)
597      options = 0;      options = 0;
598    
599      if (infile == stdin) printf("  data> ");      if (infile == stdin) printf("  data> ");
600      if (fgets((char *)buffer, sizeof(buffer), infile) == NULL) goto END_OFF;      if (fgets((char *)buffer, sizeof(buffer), infile) == NULL)
601          {
602          done = 1;
603          goto CONTINUE;
604          }
605      if (infile != stdin) fprintf(outfile, (char *)buffer);      if (infile != stdin) fprintf(outfile, (char *)buffer);
606    
607      len = (int)strlen((char *)buffer);      len = (int)strlen((char *)buffer);
# Line 762  for (;;) Line 771  for (;;)
771        }        }
772      }      }
773    
774      CONTINUE:
775    if (posix || do_posix) regfree(&preg);    if (posix || do_posix) regfree(&preg);
776    if (re != NULL) free(re);    if (re != NULL) free(re);
777    if (extra != NULL) free(extra);    if (extra != NULL) free(extra);
778    }    }
779    
 END_OFF:  
780  fprintf(outfile, "\n");  fprintf(outfile, "\n");
781  return 0;  return 0;
782  }  }

Legend:
Removed from v.9  
changed lines
  Added in v.13

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12