/[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 541 by ph10, Mon Jun 14 15:19:33 2010 UTC revision 558 by ph10, Tue Oct 26 15:26:45 2010 UTC
# Line 194  static uschar *pbuffer = NULL; Line 194  static uschar *pbuffer = NULL;
194  *         Alternate character tables             *  *         Alternate character tables             *
195  *************************************************/  *************************************************/
196    
197  /* By default, the "tables" pointer when calling PCRE is set to NULL, thereby  /* By default, the "tables" pointer when calling PCRE is set to NULL, thereby
198  using the default tables of the library. However, the T option can be used to  using the default tables of the library. However, the T option can be used to
199  select alternate sets of tables, for different kinds of testing. Note also that  select alternate sets of tables, for different kinds of testing. Note also that
200  the L (locale) option also adjusts the tables. */  the L (locale) option also adjusts the tables. */
201    
202  /* This is the set of tables distributed as default with PCRE. It recognizes  /* This is the set of tables distributed as default with PCRE. It recognizes
203  only ASCII characters. */  only ASCII characters. */
204    
205  static const unsigned char tables0[] = {  static const unsigned char tables0[] = {
# Line 371  graph, print, punct, and cntrl. Other cl Line 371  graph, print, punct, and cntrl. Other cl
371    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 240-247 */    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 240-247 */
372    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};/* 248-255 */    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};/* 248-255 */
373    
374  /* This is a set of tables that came orginally from a Windows user. It seems to  /* This is a set of tables that came orginally from a Windows user. It seems to
375  be at least an approximation of ISO 8859. In particular, there are characters  be at least an approximation of ISO 8859. In particular, there are characters
376  greater than 128 that are marked as spaces, letters, etc. */  greater than 128 that are marked as spaces, letters, etc. */
377    
378  static const unsigned char tables1[] = {  static const unsigned char tables1[] = {
# Line 516  static const unsigned char tables1[] = { Line 516  static const unsigned char tables1[] = {
516    
517    
518    
519    
520    #ifndef HAVE_STRERROR
521    /*************************************************
522    *     Provide strerror() for non-ANSI libraries  *
523    *************************************************/
524    
525    /* Some old-fashioned systems still around (e.g. SunOS4) don't have strerror()
526    in their libraries, but can provide the same facility by this simple
527    alternative function. */
528    
529    extern int   sys_nerr;
530    extern char *sys_errlist[];
531    
532    char *
533    strerror(int n)
534    {
535    if (n < 0 || n >= sys_nerr) return "unknown error number";
536    return sys_errlist[n];
537    }
538    #endif /* HAVE_STRERROR */
539    
540    
541    
542    
543  /*************************************************  /*************************************************
544  *        Read or extend an input line            *  *        Read or extend an input line            *
545  *************************************************/  *************************************************/
# Line 1567  while (!done) Line 1591  while (!done)
1591        case 'Z': debug_lengths = 0; break;        case 'Z': debug_lengths = 0; break;
1592        case '8': options |= PCRE_UTF8; use_utf8 = 1; break;        case '8': options |= PCRE_UTF8; use_utf8 = 1; break;
1593        case '?': options |= PCRE_NO_UTF8_CHECK; break;        case '?': options |= PCRE_NO_UTF8_CHECK; break;
1594    
1595        case 'T':        case 'T':
1596        switch (*pp++)        switch (*pp++)
1597          {          {
1598          case '0': tables = tables0; break;          case '0': tables = tables0; break;
1599          case '1': tables = tables1; break;          case '1': tables = tables1; break;
1600    
1601          case '\r':          case '\r':
1602          case '\n':          case '\n':
1603          case ' ':          case ' ':
1604          case 0:          case 0:
1605          fprintf(outfile, "** Missing table number after /T\n");          fprintf(outfile, "** Missing table number after /T\n");
1606          goto SKIP_DATA;          goto SKIP_DATA;
1607    
1608          default:          default:
1609          fprintf(outfile, "** Bad table number \"%c\" after /T\n", pp[-1]);          fprintf(outfile, "** Bad table number \"%c\" after /T\n", pp[-1]);
1610          goto SKIP_DATA;          goto SKIP_DATA;
1611          }          }
1612        break;        break;
1613    
1614        case 'L':        case 'L':
1615        ppp = pp;        ppp = pp;
# Line 2081  while (!done) Line 2105  while (!done)
2105    
2106        new_free(re);        new_free(re);
2107        if (extra != NULL) new_free(extra);        if (extra != NULL) new_free(extra);
2108        if (locale_set)        if (locale_set)
2109          {          {
2110          new_free((void *)tables);          new_free((void *)tables);
2111          setlocale(LC_CTYPE, "C");          setlocale(LC_CTYPE, "C");
2112          locale_set = 0;          locale_set = 0;
2113          }          }
2114        continue;  /* With next regex */        continue;  /* With next regex */
2115        }        }
2116      }        /* End of non-POSIX compile */      }        /* End of non-POSIX compile */
# Line 2137  while (!done) Line 2161  while (!done)
2161          {          {
2162          if (len > 0)    /* Reached EOF without hitting a newline */          if (len > 0)    /* Reached EOF without hitting a newline */
2163            {            {
2164            fprintf(outfile, "\n");            fprintf(outfile, "\n");
2165            break;            break;
2166            }            }
2167          done = 1;          done = 1;
2168          goto CONTINUE;          goto CONTINUE;
2169          }          }
# Line 2313  while (!done) Line 2337  while (!done)
2337  #endif  #endif
2338            use_dfa = 1;            use_dfa = 1;
2339          continue;          continue;
2340    #endif
2341    
2342    #if !defined NODFA
2343          case 'F':          case 'F':
2344          options |= PCRE_DFA_SHORTEST;          options |= PCRE_DFA_SHORTEST;
2345          continue;          continue;
# Line 2434  while (!done) Line 2460  while (!done)
2460        }        }
2461      *q = 0;      *q = 0;
2462      len = (int)(q - dbuffer);      len = (int)(q - dbuffer);
2463    
2464      /* Move the data to the end of the buffer so that a read over the end of      /* Move the data to the end of the buffer so that a read over the end of
2465      the buffer will be seen by valgrind, even if it doesn't cause a crash. If      the buffer will be seen by valgrind, even if it doesn't cause a crash. If
2466      we are using the POSIX interface, we must include the terminating zero. */      we are using the POSIX interface, we must include the terminating zero. */

Legend:
Removed from v.541  
changed lines
  Added in v.558

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12