/[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 3 by nigel, Sat Feb 24 21:38:01 2007 UTC revision 9 by nigel, Sat Feb 24 21:38:13 2007 UTC
# Line 30  static int log_store = 0; Line 30  static int log_store = 0;
30  /* Debugging function to print the internal form of the regex. This is the same  /* Debugging function to print the internal form of the regex. This is the same
31  code as contained in pcre.c under the DEBUG macro. */  code as contained in pcre.c under the DEBUG macro. */
32    
33  static char *OP_names[] = { "End", "\\A", "\\B", "\\b", "\\D", "\\d",  static const char *OP_names[] = {
34      "End", "\\A", "\\B", "\\b", "\\D", "\\d",
35    "\\S", "\\s", "\\W", "\\w", "Cut", "\\Z", "^", "$", "Any", "chars",    "\\S", "\\s", "\\W", "\\w", "Cut", "\\Z", "^", "$", "Any", "chars",
36    "not",    "not",
37    "*", "*?", "+", "+?", "?", "??", "{", "{", "{",    "*", "*?", "+", "+?", "?", "??", "{", "{", "{",
# Line 156  for(;;) Line 157  for(;;)
157    
158      case OP_REF:      case OP_REF:
159      printf("    \\%d", *(++code));      printf("    \\%d", *(++code));
160      break;      code++;
161        goto CLASS_REF_REPEAT;
162    
163      case OP_CLASS:      case OP_CLASS:
164        {        {
# Line 186  for(;;) Line 188  for(;;)
188        printf("]");        printf("]");
189        code += 32;        code += 32;
190    
191          CLASS_REF_REPEAT:
192    
193        switch(*code)        switch(*code)
194          {          {
195          case OP_CRSTAR:          case OP_CRSTAR:
# Line 327  for (;;) Line 331  for (;;)
331    pcre *re = NULL;    pcre *re = NULL;
332    pcre_extra *extra = NULL;    pcre_extra *extra = NULL;
333    regex_t preg;    regex_t preg;
334    char *error;    const char *error;
335    unsigned char *p, *pp;    unsigned char *p, *pp;
336    int do_study = 0;    int do_study = 0;
337    int do_debug = 0;    int do_debug = 0;
# Line 580  for (;;) Line 584  for (;;)
584    
585    for (;;)    for (;;)
586      {      {
587      unsigned char *pp;      unsigned char *q;
588      int count, c;      int count, c;
589      int offsets[30];      int offsets[30];
590      int size_offsets = sizeof(offsets)/sizeof(int);      int size_offsets = sizeof(offsets)/sizeof(int);
# Line 599  for (;;) Line 603  for (;;)
603      p = buffer;      p = buffer;
604      while (isspace(*p)) p++;      while (isspace(*p)) p++;
605    
606      pp = dbuffer;      q = dbuffer;
607      while ((c = *p++) != 0)      while ((c = *p++) != 0)
608        {        {
609        int i = 0;        int i = 0;
# Line 661  for (;;) Line 665  for (;;)
665    
666          case 'O':          case 'O':
667          while(isdigit(*p)) n = n * 10 + *p++ - '0';          while(isdigit(*p)) n = n * 10 + *p++ - '0';
668          if (n <= sizeof(offsets)/sizeof(int)) size_offsets = n;          if (n <= (int)(sizeof(offsets)/sizeof(int))) size_offsets = n;
669          continue;          continue;
670    
671          case 'Z':          case 'Z':
672          options |= PCRE_NOTEOL;          options |= PCRE_NOTEOL;
673          continue;          continue;
674          }          }
675        *pp++ = c;        *q++ = c;
676        }        }
677      *pp = 0;      *q = 0;
678      len = pp - dbuffer;      len = q - dbuffer;
679    
680      /* Handle matching via the POSIX interface, which does not      /* Handle matching via the POSIX interface, which does not
681      support timing. */      support timing. */
# Line 694  for (;;) Line 698  for (;;)
698          }          }
699        else        else
700          {          {
701          int i;          size_t i;
702          for (i = 0; i < sizeof(pmatch)/sizeof(regmatch_t); i++)          for (i = 0; i < sizeof(pmatch)/sizeof(regmatch_t); i++)
703            {            {
704            if (pmatch[i].rm_so >= 0)            if (pmatch[i].rm_so >= 0)

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12