/[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 852 by zherczeg, Thu Jan 5 19:18:12 2012 UTC revision 895 by ph10, Fri Jan 20 12:12:03 2012 UTC
# Line 307  argument, the casting might be incorrect Line 307  argument, the casting might be incorrect
307  #define PCRE_COPY_NAMED_SUBSTRING16(rc, re, bptr, offsets, count, \  #define PCRE_COPY_NAMED_SUBSTRING16(rc, re, bptr, offsets, count, \
308      namesptr, cbuffer, size) \      namesptr, cbuffer, size) \
309    rc = pcre16_copy_named_substring((pcre16 *)re, (PCRE_SPTR16)bptr, offsets, \    rc = pcre16_copy_named_substring((pcre16 *)re, (PCRE_SPTR16)bptr, offsets, \
310      count, (PCRE_SPTR16)namesptr, (PCRE_SCHAR16 *)cbuffer, size/2)      count, (PCRE_SPTR16)namesptr, (PCRE_UCHAR16 *)cbuffer, size/2)
311    
312  #define PCRE_COPY_SUBSTRING16(rc, bptr, offsets, count, i, cbuffer, size) \  #define PCRE_COPY_SUBSTRING16(rc, bptr, offsets, count, i, cbuffer, size) \
313    rc = pcre16_copy_substring((PCRE_SPTR16)bptr, offsets, count, i, \    rc = pcre16_copy_substring((PCRE_SPTR16)bptr, offsets, count, i, \
314      (PCRE_SCHAR16 *)cbuffer, size/2)      (PCRE_UCHAR16 *)cbuffer, size/2)
315    
316  #define PCRE_DFA_EXEC16(count, re, extra, bptr, len, start_offset, options, \  #define PCRE_DFA_EXEC16(count, re, extra, bptr, len, start_offset, options, \
317      offsets, size_offsets, workspace, size_workspace) \      offsets, size_offsets, workspace, size_workspace) \
# Line 2104  printf("This version of pcretest is not Line 2104  printf("This version of pcretest is not
2104  #endif  #endif
2105  printf("\nOptions:\n");  printf("\nOptions:\n");
2106  #ifdef SUPPORT_PCRE16  #ifdef SUPPORT_PCRE16
2107  printf("  -16      use 16-bit interface\n");  printf("  -16      use the 16-bit library\n");
2108  #endif  #endif
2109  printf("  -b       show compiled code (bytecode)\n");  printf("  -b       show compiled code\n");
2110  printf("  -C       show PCRE compile-time options and exit\n");  printf("  -C       show PCRE compile-time options and exit\n");
2111  printf("  -C arg   show a specific compile-time option\n");  printf("  -C arg   show a specific compile-time option\n");
2112  printf("           and exit with its value. The arg can be:\n");  printf("           and exit with its value. The arg can be:\n");
# Line 2182  pcre_jit_stack *jit_stack = NULL; Line 2182  pcre_jit_stack *jit_stack = NULL;
2182  substring names, each list itself being terminated by an empty name. Assume  substring names, each list itself being terminated by an empty name. Assume
2183  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
2184  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
2185  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. */  
2186    
2187  pcre_uint16 copynames[1024];  pcre_uint16 copynames[1024];
2188  pcre_uint16 getnames[1024];  pcre_uint16 getnames[1024];
2189    
2190    #ifdef SUPPORT_PCRE16
2191  pcre_uint16 *cn16ptr;  pcre_uint16 *cn16ptr;
2192  pcre_uint16 *gn16ptr;  pcre_uint16 *gn16ptr;
2193    #endif
2194    
2195    #ifdef SUPPORT_PCRE8
2196  pcre_uint8 *copynames8 = (pcre_uint8 *)copynames;  pcre_uint8 *copynames8 = (pcre_uint8 *)copynames;
2197  pcre_uint8 *getnames8 = (pcre_uint8 *)getnames;  pcre_uint8 *getnames8 = (pcre_uint8 *)getnames;
2198  pcre_uint8 *cn8ptr;  pcre_uint8 *cn8ptr;
2199  pcre_uint8 *gn8ptr;  pcre_uint8 *gn8ptr;
2200    #endif
2201    
2202  /* Get buffers from malloc() so that valgrind will check their misuse when  /* Get buffers from malloc() so that valgrind will check their misuse when
2203  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 2410  are set, either both UTFs are supported
2410      printf("  %sUnicode properties support\n", rc? "" : "No ");      printf("  %sUnicode properties support\n", rc? "" : "No ");
2411      (void)PCRE_CONFIG(PCRE_CONFIG_JIT, &rc);      (void)PCRE_CONFIG(PCRE_CONFIG_JIT, &rc);
2412      if (rc)      if (rc)
2413        printf("  Just-in-time compiler support\n");        {
2414          const char *arch;
2415          (void)PCRE_CONFIG(PCRE_CONFIG_JITTARGET, &arch);
2416          printf("  Just-in-time compiler support: %s\n", arch);
2417          }
2418      else      else
2419        printf("  No just-in-time compiler support\n");        printf("  No just-in-time compiler support\n");
2420      (void)PCRE_CONFIG(PCRE_CONFIG_NEWLINE, &rc);      (void)PCRE_CONFIG(PCRE_CONFIG_NEWLINE, &rc);
# Line 2430  are set, either both UTFs are supported Line 2436  are set, either both UTFs are supported
2436      (void)PCRE_CONFIG(PCRE_CONFIG_MATCH_LIMIT_RECURSION, &lrc);      (void)PCRE_CONFIG(PCRE_CONFIG_MATCH_LIMIT_RECURSION, &lrc);
2437      printf("  Default recursion depth limit = %ld\n", lrc);      printf("  Default recursion depth limit = %ld\n", lrc);
2438      (void)PCRE_CONFIG(PCRE_CONFIG_STACKRECURSE, &rc);      (void)PCRE_CONFIG(PCRE_CONFIG_STACKRECURSE, &rc);
2439      printf("  Match recursion uses %s\n", rc? "stack" : "heap");      printf("  Match recursion uses %s", rc? "stack" : "heap");
2440        if (showstore)
2441          {
2442          PCRE_EXEC(stack_size, NULL, NULL, NULL, -1, -1, 0, NULL, 0);
2443          printf(": %sframe size = %d bytes", rc? "approximate " : "", -stack_size);
2444          }
2445        printf("\n");
2446      goto EXIT;      goto EXIT;
2447      }      }
2448    else if (strcmp(argv[op], "-help") == 0 ||    else if (strcmp(argv[op], "-help") == 0 ||
# Line 3369  while (!done) Line 3381  while (!done)
3381      *copynames = 0;      *copynames = 0;
3382      *getnames = 0;      *getnames = 0;
3383    
3384    #ifdef SUPPORT_PCRE16
3385      cn16ptr = copynames;      cn16ptr = copynames;
3386      gn16ptr = getnames;      gn16ptr = getnames;
3387    #endif
3388    #ifdef SUPPORT_PCRE8
3389      cn8ptr = copynames8;      cn8ptr = copynames8;
3390      gn8ptr = getnames8;      gn8ptr = getnames8;
3391    #endif
3392    
3393      SET_PCRE_CALLOUT(callout);      SET_PCRE_CALLOUT(callout);
3394      first_callout = 1;      first_callout = 1;
# Line 3464  while (!done) Line 3480  while (!done)
3480            least one MacOS environment. */            least one MacOS environment. */
3481    
3482            for (pt++; isxdigit(*pt); pt++)            for (pt++; isxdigit(*pt); pt++)
3483              c = c * 16 + tolower(*pt) - ((isdigit(*pt))? '0' : 'a' - 10);              {
3484                if (++i == 9)
3485                  fprintf(outfile, "** Too many hex digits in \\x{...} item; "
3486                                   "using only the first eight.\n");
3487                else c = c * 16 + tolower(*pt) - ((isdigit(*pt))? '0' : 'a' - 10);
3488                }
3489            if (*pt == '}')            if (*pt == '}')
3490              {              {
3491              p = pt + 1;              p = pt + 1;

Legend:
Removed from v.852  
changed lines
  Added in v.895

  ViewVC Help
Powered by ViewVC 1.1.5