/[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 862 by ph10, Wed Jan 11 16:07:32 2012 UTC revision 908 by ph10, Mon Jan 30 12:19:29 2012 UTC
# Line 105  input mode under Windows. */ Line 105  input mode under Windows. */
105  #define OUTPUT_MODE  "wb"  #define OUTPUT_MODE  "wb"
106  #endif  #endif
107    
108    #define PRIV(name) name
109    
110  /* We have to include pcre_internal.h because we need the internal info for  /* We have to include pcre_internal.h because we need the internal info for
111  displaying the results of pcre_study() and we also need to know about the  displaying the results of pcre_study() and we also need to know about the
# Line 141  to keep two copies, we include the sourc Line 142  to keep two copies, we include the sourc
142  external symbols to prevent clashes. */  external symbols to prevent clashes. */
143    
144  #define PCRE_INCLUDED  #define PCRE_INCLUDED
 #undef PRIV  
 #define PRIV(name) name  
145    
146  #include "pcre_tables.c"  #include "pcre_tables.c"
147    
# Line 1271  pcre_uint8 *here = start; Line 1270  pcre_uint8 *here = start;
1270    
1271  for (;;)  for (;;)
1272    {    {
1273    int rlen = (int)(buffer_size - (here - buffer));    size_t rlen = (size_t)(buffer_size - (here - buffer));
1274    
1275    if (rlen > 1000)    if (rlen > 1000)
1276      {      {
# Line 2182  pcre_jit_stack *jit_stack = NULL; Line 2181  pcre_jit_stack *jit_stack = NULL;
2181  substring names, each list itself being terminated by an empty name. Assume  substring names, each list itself being terminated by an empty name. Assume
2182  that 1024 is plenty long enough for the few names we'll be testing. It is  that 1024 is plenty long enough for the few names we'll be testing. It is
2183  easiest to keep separate 8-bit and 16-bit versions, using the 16-bit version  easiest to keep separate 8-bit and 16-bit versions, using the 16-bit version
2184  for the actual memory, to ensure alignment. By defining these variables always  for the actual memory, to ensure alignment. */
 (whether or not 8-bit or 16-bit is supported), we avoid too much mess with  
 #ifdefs in the code. */  
2185    
2186  pcre_uint16 copynames[1024];  pcre_uint16 copynames[1024];
2187  pcre_uint16 getnames[1024];  pcre_uint16 getnames[1024];
2188    
2189    #ifdef SUPPORT_PCRE16
2190  pcre_uint16 *cn16ptr;  pcre_uint16 *cn16ptr;
2191  pcre_uint16 *gn16ptr;  pcre_uint16 *gn16ptr;
2192    #endif
2193    
2194    #ifdef SUPPORT_PCRE8
2195  pcre_uint8 *copynames8 = (pcre_uint8 *)copynames;  pcre_uint8 *copynames8 = (pcre_uint8 *)copynames;
2196  pcre_uint8 *getnames8 = (pcre_uint8 *)getnames;  pcre_uint8 *getnames8 = (pcre_uint8 *)getnames;
2197  pcre_uint8 *cn8ptr;  pcre_uint8 *cn8ptr;
2198  pcre_uint8 *gn8ptr;  pcre_uint8 *gn8ptr;
2199    #endif
2200    
2201  /* Get buffers from malloc() so that valgrind will check their misuse when  /* Get buffers from malloc() so that valgrind will check their misuse when
2202  debugging. They grow automatically when very long lines are read. The 16-bit  debugging. They grow automatically when very long lines are read. The 16-bit
# Line 2408  are set, either both UTFs are supported Line 2409  are set, either both UTFs are supported
2409      printf("  %sUnicode properties support\n", rc? "" : "No ");      printf("  %sUnicode properties support\n", rc? "" : "No ");
2410      (void)PCRE_CONFIG(PCRE_CONFIG_JIT, &rc);      (void)PCRE_CONFIG(PCRE_CONFIG_JIT, &rc);
2411      if (rc)      if (rc)
2412        printf("  Just-in-time compiler support\n");        {
2413          const char *arch;
2414          (void)PCRE_CONFIG(PCRE_CONFIG_JITTARGET, (void *)(&arch));
2415          printf("  Just-in-time compiler support: %s\n", arch);
2416          }
2417      else      else
2418        printf("  No just-in-time compiler support\n");        printf("  No just-in-time compiler support\n");
2419      (void)PCRE_CONFIG(PCRE_CONFIG_NEWLINE, &rc);      (void)PCRE_CONFIG(PCRE_CONFIG_NEWLINE, &rc);
# Line 2430  are set, either both UTFs are supported Line 2435  are set, either both UTFs are supported
2435      (void)PCRE_CONFIG(PCRE_CONFIG_MATCH_LIMIT_RECURSION, &lrc);      (void)PCRE_CONFIG(PCRE_CONFIG_MATCH_LIMIT_RECURSION, &lrc);
2436      printf("  Default recursion depth limit = %ld\n", lrc);      printf("  Default recursion depth limit = %ld\n", lrc);
2437      (void)PCRE_CONFIG(PCRE_CONFIG_STACKRECURSE, &rc);      (void)PCRE_CONFIG(PCRE_CONFIG_STACKRECURSE, &rc);
2438      printf("  Match recursion uses %s\n", rc? "stack" : "heap");      printf("  Match recursion uses %s", rc? "stack" : "heap");
2439        if (showstore)
2440          {
2441          PCRE_EXEC(stack_size, NULL, NULL, NULL, -999, -999, 0, NULL, 0);
2442          printf(": %sframe size = %d bytes", rc? "approximate " : "", -stack_size);
2443          }
2444        printf("\n");
2445      goto EXIT;      goto EXIT;
2446      }      }
2447    else if (strcmp(argv[op], "-help") == 0 ||    else if (strcmp(argv[op], "-help") == 0 ||
# Line 3369  while (!done) Line 3380  while (!done)
3380      *copynames = 0;      *copynames = 0;
3381      *getnames = 0;      *getnames = 0;
3382    
3383    #ifdef SUPPORT_PCRE16
3384      cn16ptr = copynames;      cn16ptr = copynames;
3385      gn16ptr = getnames;      gn16ptr = getnames;
3386    #endif
3387    #ifdef SUPPORT_PCRE8
3388      cn8ptr = copynames8;      cn8ptr = copynames8;
3389      gn8ptr = getnames8;      gn8ptr = getnames8;
3390    #endif
3391    
3392      SET_PCRE_CALLOUT(callout);      SET_PCRE_CALLOUT(callout);
3393      first_callout = 1;      first_callout = 1;
# Line 3467  while (!done) Line 3482  while (!done)
3482              {              {
3483              if (++i == 9)              if (++i == 9)
3484                fprintf(outfile, "** Too many hex digits in \\x{...} item; "                fprintf(outfile, "** Too many hex digits in \\x{...} item; "
3485                                 "using only the first eight.\n");                                 "using only the first eight.\n");
3486              else c = c * 16 + tolower(*pt) - ((isdigit(*pt))? '0' : 'a' - 10);              else c = c * 16 + tolower(*pt) - ((isdigit(*pt))? '0' : 'a' - 10);
3487              }              }
3488            if (*pt == '}')            if (*pt == '}')
3489              {              {
3490              p = pt + 1;              p = pt + 1;
# Line 4277  while (!done) Line 4292  while (!done)
4292              break;              break;
4293    
4294              default:              default:
4295              if (count < 0 && (-count) < sizeof(errtexts)/sizeof(const char *))              if (count < 0 &&
4296                    (-count) < (int)(sizeof(errtexts)/sizeof(const char *)))
4297                fprintf(outfile, "Error %d (%s)\n", count, errtexts[-count]);                fprintf(outfile, "Error %d (%s)\n", count, errtexts[-count]);
4298              else              else
4299                fprintf(outfile, "Error %d (Unexpected value)\n", count);                fprintf(outfile, "Error %d (Unexpected value)\n", count);

Legend:
Removed from v.862  
changed lines
  Added in v.908

  ViewVC Help
Powered by ViewVC 1.1.5