/[pcre]/code/branches/pcre16/pcretest.c
ViewVC logotype

Diff of /code/branches/pcre16/pcretest.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 820 by zherczeg, Fri Dec 23 09:26:45 2011 UTC revision 821 by ph10, Fri Dec 23 16:38:13 2011 UTC
# Line 181  use these in the definitions of generic Line 181  use these in the definitions of generic
181    
182  #ifdef SUPPORT_PCRE8  #ifdef SUPPORT_PCRE8
183    
184  #define PCHARS8(lv, p, len, f) \  #define PCHARS8(lv, p, offset, len, f) \
185    lv = pchars((pcre_uint8 *)p, len, f)    lv = pchars((pcre_uint8 *)(p) + offset, len, f)
186    
187  #define PCHARSV8(p, len, f) \  #define PCHARSV8(p, offset, len, f) \
188    (void)pchars((pcre_uint8 *)p, len, f)    (void)pchars((pcre_uint8 *)(p) + offset, len, f)
189    
190    #define READ_CAPTURE_NAME8(p, cn8, cn16, re) \
191      p = read_capture_name8(p, cn8, re)
192    
193  #define SET_PCRE_CALLOUT8(callout) \  #define SET_PCRE_CALLOUT8(callout) \
194    pcre_callout = callout    pcre_callout = callout
# Line 199  use these in the definitions of generic Line 202  use these in the definitions of generic
202  #define PCRE_COPY_NAMED_SUBSTRING8(rc, re, bptr, offsets, count, \  #define PCRE_COPY_NAMED_SUBSTRING8(rc, re, bptr, offsets, count, \
203      namesptr, cbuffer, size) \      namesptr, cbuffer, size) \
204    rc = pcre_copy_named_substring(re, (char *)bptr, offsets, count, \    rc = pcre_copy_named_substring(re, (char *)bptr, offsets, count, \
205      (char *)copynamesptr, cbuffer, size)      (char *)namesptr, cbuffer, size)
206    
207  #define PCRE_COPY_SUBSTRING8(rc, bptr, offsets, count, i, cbuffer, size) \  #define PCRE_COPY_SUBSTRING8(rc, bptr, offsets, count, i, cbuffer, size) \
208    rc = pcre_copy_substring((char *)bptr, offsets, count, i, cbuffer, size)    rc = pcre_copy_substring((char *)bptr, offsets, count, i, cbuffer, size)
# Line 252  use these in the definitions of generic Line 255  use these in the definitions of generic
255    
256  #ifdef SUPPORT_PCRE16  #ifdef SUPPORT_PCRE16
257    
258  #define PCHARS16(lv, p, len, f) \  #define PCHARS16(lv, p, offset, len, f) \
259    lv = pchars16((PCRE_SPTR16)p, len, f)    lv = pchars16((PCRE_SPTR16)(p) + offset, len, f)
260    
261    #define PCHARSV16(p, offset, len, f) \
262      (void)pchars16((PCRE_SPTR16)(p) + offset, len, f)
263    
264  #define PCHARSV16(p, len, f) \  #define READ_CAPTURE_NAME16(p, cn8, cn16, re) \
265    (void)pchars16((PCRE_SPTR16)p, len, f)    p = read_capture_name16(p, cn16, re)
266    
267  #define STRLEN16(p) ((int)strlen16((PCRE_SPTR16)p))  #define STRLEN16(p) ((int)strlen16((PCRE_SPTR16)p))
268    
# Line 331  version is called. ----- */ Line 337  version is called. ----- */
337    
338  #define CHAR_SIZE (use_pcre16? 2:1)  #define CHAR_SIZE (use_pcre16? 2:1)
339    
340  #define PCHARS(lv, p, len, f) \  #define PCHARS(lv, p, offset, len, f) \
341    if (use_pcre16) \    if (use_pcre16) \
342      PCHARS16(lv, p, len, f); \      PCHARS16(lv, p, offset, len, f); \
343    else \    else \
344      PCHARS8(lv, p, len, f)      PCHARS8(lv, p, offset, len, f)
345    
346  #define PCHARSV(p, len, f) \  #define PCHARSV(p, offset, len, f) \
347      if (use_pcre16) \
348        PCHARSV16(p, offset, len, f); \
349      else \
350        PCHARSV8(p, offset, len, f)
351    
352    #define READ_CAPTURE_NAME(p, cn8, cn16, re) \
353    if (use_pcre16) \    if (use_pcre16) \
354      PCHARSV16(p, len, f); \      READ_CAPTURE_NAME16(p, cn8, cn16, re); \
355    else \    else \
356      PCHARSV8(p, len, f)      READ_CAPTURE_NAME8(p, cn8, cn16, re)
357    
358  #define SET_PCRE_CALLOUT(callout) \  #define SET_PCRE_CALLOUT(callout) \
359    if (use_pcre16) \    if (use_pcre16) \
# Line 469  version is called. ----- */ Line 481  version is called. ----- */
481  #define CHAR_SIZE                 1  #define CHAR_SIZE                 1
482  #define PCHARS                    PCHARS8  #define PCHARS                    PCHARS8
483  #define PCHARSV                   PCHARSV8  #define PCHARSV                   PCHARSV8
484    #define READ_CAPTURE_NAME         READ_CAPTURE_NAME8
485  #define SET_PCRE_CALLOUT          SET_PCRE_CALLOUT8  #define SET_PCRE_CALLOUT          SET_PCRE_CALLOUT8
486  #define STRLEN                    STRLEN8  #define STRLEN                    STRLEN8
487  #define PCRE_ASSIGN_JIT_STACK     pcre_assign_jit_stack  #define PCRE_ASSIGN_JIT_STACK     pcre_assign_jit_stack
# Line 498  version is called. ----- */ Line 511  version is called. ----- */
511  #define CHAR_SIZE                 1  #define CHAR_SIZE                 1
512  #define PCHARS                    PCHARS16  #define PCHARS                    PCHARS16
513  #define PCHARSV                   PCHARSV16  #define PCHARSV                   PCHARSV16
514    #define READ_CAPTURE_NAME         READ_CAPTURE_NAME16
515  #define SET_PCRE_CALLOUT          SET_PCRE_CALLOUT16  #define SET_PCRE_CALLOUT          SET_PCRE_CALLOUT16
516  #define STRLEN                    STRLEN16  #define STRLEN                    STRLEN16
517  #define PCRE_ASSIGN_JIT_STACK     pcre16_assign_jit_stack  #define PCRE_ASSIGN_JIT_STACK     pcre16_assign_jit_stack
# Line 1426  return yield; Line 1440  return yield;
1440    
1441    
1442    
1443    #ifdef SUPPORT_PCRE8
1444    /*************************************************
1445    *     Read a capture name (8-bit) and check it   *
1446    *************************************************/
1447    
1448    static pcre_uint8 *
1449    read_capture_name8(pcre_uint8 *p, pcre_uint8 **pp, pcre *re)
1450    {
1451    pcre_uint8 *npp = *pp;
1452    while (isalnum(*p)) *npp++ = *p++;
1453    *npp++ = 0;
1454    *npp = 0;
1455    if (pcre_get_stringnumber(re, (char *)(*pp)) < 0)
1456      {
1457      fprintf(outfile, "no parentheses with name \"");
1458      PCHARSV(*pp, 0, -1, outfile);
1459      fprintf(outfile, "\"\n");
1460      }
1461    
1462    *pp = npp;
1463    return p;
1464    }
1465    #endif
1466    
1467    
1468    
1469    #ifdef SUPPORT_PCRE16
1470    /*************************************************
1471    *     Read a capture name (16-bit) and check it  *
1472    *************************************************/
1473    
1474    /* Note that the text being read is 8-bit. */
1475    
1476    static pcre_uint8 *
1477    read_capture_name16(pcre_uint8 *p, pcre_uint16 **pp, pcre *re)
1478    {
1479    pcre_uint16 *npp = *pp;
1480    while (isalnum(*p)) *npp++ = *p++;
1481    *npp++ = 0;
1482    *npp = 0;
1483    if (pcre16_get_stringnumber(re, (PCRE_SPTR16)(*pp)) < 0)
1484      {
1485      fprintf(outfile, "no parentheses with name \"");
1486      PCHARSV(*pp, 0, -1, outfile);
1487      fprintf(outfile, "\"\n");
1488      }
1489    *pp = npp;
1490    return p;
1491    }
1492    #endif
1493    
1494    
1495    
1496  /*************************************************  /*************************************************
1497  *              Callout function                  *  *              Callout function                  *
1498  *************************************************/  *************************************************/
# Line 1451  if (callout_extra) Line 1518  if (callout_extra)
1518      else      else
1519        {        {
1520        fprintf(f, "%2d: ", i/2);        fprintf(f, "%2d: ", i/2);
1521        PCHARSV(cb->subject + cb->offset_vector[i],        PCHARSV(cb->subject, cb->offset_vector[i],
1522          cb->offset_vector[i+1] - cb->offset_vector[i], f);          cb->offset_vector[i+1] - cb->offset_vector[i], f);
1523        fprintf(f, "\n");        fprintf(f, "\n");
1524        }        }
# Line 1464  printed lengths of the substrings. */ Line 1531  printed lengths of the substrings. */
1531    
1532  if (f != NULL) fprintf(f, "--->");  if (f != NULL) fprintf(f, "--->");
1533    
1534  PCHARS(pre_start, cb->subject, cb->start_match, f);  PCHARS(pre_start, cb->subject, 0, cb->start_match, f);
1535  PCHARS(post_start, cb->subject + cb->start_match,  PCHARS(post_start, cb->subject, cb->start_match,
1536    cb->current_position - cb->start_match, f);    cb->current_position - cb->start_match, f);
1537    
1538  PCHARS(subject_length, cb->subject, cb->subject_length, NULL);  PCHARS(subject_length, cb->subject, 0, cb->subject_length, NULL);
1539    
1540  PCHARSV(cb->subject + cb->current_position,  PCHARSV(cb->subject, cb->current_position,
1541    cb->subject_length - cb->current_position, f);    cb->subject_length - cb->current_position, f);
1542    
1543  if (f != NULL) fprintf(f, "\n");  if (f != NULL) fprintf(f, "\n");
# Line 1514  if (cb->mark != last_callout_mark) Line 1581  if (cb->mark != last_callout_mark)
1581    else    else
1582      {      {
1583      fprintf(outfile, "Latest Mark: ");      fprintf(outfile, "Latest Mark: ");
1584      PCHARSV(cb->mark, -1, outfile);      PCHARSV(cb->mark, 0, -1, outfile);
1585      putc('\n', outfile);      putc('\n', outfile);
1586      }      }
1587    last_callout_mark = cb->mark;    last_callout_mark = cb->mark;
# Line 2020  int stack_size; Line 2087  int stack_size;
2087    
2088  pcre_jit_stack *jit_stack = NULL;  pcre_jit_stack *jit_stack = NULL;
2089    
2090  /* These vectors store, end-to-end, a list of captured substring names. Assume  /* These vectors store, end-to-end, a list of zero-terminated captured
2091  that 1024 is plenty long enough for the few names we'll be testing. */  substring names, each list itself being terminated by an empty name. Assume
2092    that 1024 is plenty long enough for the few names we'll be testing. It is
2093  pcre_uchar copynames[1024];  easiest to keep separate 8-bit and 16-bit versions, using the 16-bit version
2094  pcre_uchar getnames[1024];  for the actual memory, to ensure alignment. By defining these variables always
2095    (whether or not 8-bit or 16-bit is supported), we avoid too much mess with
2096  pcre_uchar *copynamesptr;  #ifdefs in the code. */
2097  pcre_uchar *getnamesptr;  
2098    pcre_uint16 copynames[1024];
2099    pcre_uint16 getnames[1024];
2100    
2101    pcre_uint16 *cn16ptr;
2102    pcre_uint16 *gn16ptr;
2103    
2104    pcre_uint8 *copynames8 = (pcre_uint8 *)copynames;
2105    pcre_uint8 *getnames8 = (pcre_uint8 *)getnames;
2106    pcre_uint8 *cn8ptr;
2107    pcre_uint8 *gn8ptr;
2108    
2109  /* Get buffers from malloc() so that valgrind will check their misuse when  /* Get buffers from malloc() so that valgrind will check their misuse when
2110  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 2812  while (!done) Line 2889  while (!done)
2889  #endif  #endif
2890            int length = (int)STRLEN(nametable + imm2_size);            int length = (int)STRLEN(nametable + imm2_size);
2891            fprintf(outfile, "  ");            fprintf(outfile, "  ");
2892            PCHARSV(nametable + imm2_size, length, outfile);            PCHARSV(nametable, imm2_size, length, outfile);
2893            while (length++ < nameentrysize - imm2_size) putc(' ', outfile);            while (length++ < nameentrysize - imm2_size) putc(' ', outfile);
2894  #if defined SUPPORT_PCRE8 && defined SUPPORT_PCRE16  #if defined SUPPORT_PCRE8 && defined SUPPORT_PCRE16
2895            fprintf(outfile, "%3d\n", use_pcre16?            fprintf(outfile, "%3d\n", use_pcre16?
# Line 3081  while (!done) Line 3158  while (!done)
3158      int g_notempty = 0;      int g_notempty = 0;
3159      int use_dfa = 0;      int use_dfa = 0;
3160    
     options = 0;  
   
 #if defined SUPPORT_PCRE8 && defined SUPPORT_PCRE16  
     if (use_pcre16)  
       {  
       *(PCRE_SCHAR16 *)copynames = 0;  
       *(PCRE_SCHAR16 *)getnames = 0;  
       }  
     else  
       {  
       *copynames = 0;  
       *getnames = 0;  
       }  
 #else  
3161      *copynames = 0;      *copynames = 0;
3162      *getnames = 0;      *getnames = 0;
3163  #endif  
3164        cn16ptr = copynames;
3165      copynamesptr = copynames;      gn16ptr = getnames;
3166      getnamesptr = getnames;      cn8ptr = copynames8;
3167        gn8ptr = getnames8;
3168    
3169      SET_PCRE_CALLOUT(callout);      SET_PCRE_CALLOUT(callout);
3170      first_callout = 1;      first_callout = 1;
# Line 3110  while (!done) Line 3174  while (!done)
3174      callout_fail_count = 999999;      callout_fail_count = 999999;
3175      callout_fail_id = -1;      callout_fail_id = -1;
3176      show_malloc = 0;      show_malloc = 0;
3177        options = 0;
3178    
3179      if (extra != NULL) extra->flags &=      if (extra != NULL) extra->flags &=
3180        ~(PCRE_EXTRA_MATCH_LIMIT|PCRE_EXTRA_MATCH_LIMIT_RECURSION);        ~(PCRE_EXTRA_MATCH_LIMIT|PCRE_EXTRA_MATCH_LIMIT_RECURSION);
# Line 3265  while (!done) Line 3330  while (!done)
3330            }            }
3331          else if (isalnum(*p))          else if (isalnum(*p))
3332            {            {
3333            pcre_uchar *namestart = copynamesptr;            READ_CAPTURE_NAME(p, &cn8ptr, &cn16ptr, re);
 #if defined SUPPORT_PCRE8 && defined SUPPORT_PCRE16  
           if (use_pcre16)  
             {  
             PCRE_SCHAR16 *npp = (PCRE_SCHAR16 *)copynamesptr;  
             while (isalnum(*p)) *npp++ = *p++;  
             *npp++ = 0;  
             *npp = 0;  
             PCRE_GET_STRINGNUMBER(n, re, copynamesptr);  
             copynamesptr = (pcre_uchar *)npp;  
             }  
           else  
             {  
 #endif  
             pcre_uchar *npp = copynamesptr;  
             while (isalnum(*p)) *npp++ = *p++;  
             *npp++ = 0;  
             *npp = 0;  
             PCRE_GET_STRINGNUMBER(n, re, copynamesptr);  
             copynamesptr = npp;  
 #if defined SUPPORT_PCRE8 && defined SUPPORT_PCRE16  
             }  
 #endif  
           if (n < 0)  
             {  
             fprintf(outfile, "no parentheses with name \"");  
             PCHARSV(namestart, -1, outfile);  
             fprintf(outfile, "\"\n");  
             }  
3334            }            }
3335          else if (*p == '+')          else if (*p == '+')
3336            {            {
# Line 3356  while (!done) Line 3393  while (!done)
3393            }            }
3394          else if (isalnum(*p))          else if (isalnum(*p))
3395            {            {
3396            pcre_uchar *namestart = getnamesptr;            READ_CAPTURE_NAME(p, &gn8ptr, &gn16ptr, re);
 #if defined SUPPORT_PCRE8 && defined SUPPORT_PCRE16  
           if (use_pcre16)  
             {  
             PCRE_SCHAR16 *npp = (PCRE_SCHAR16 *)getnamesptr;  
             while (isalnum(*p)) *npp++ = *p++;  
             *npp++ = 0;  
             *npp = 0;  
             PCRE_GET_STRINGNUMBER(n, re, getnamesptr);  
             getnamesptr = (pcre_uchar *)npp;  
             }  
           else  
             {  
 #endif  
             pcre_uchar *npp = getnamesptr;  
             while (isalnum(*p)) *npp++ = *p++;  
             *npp++ = 0;  
             *npp = 0;  
             PCRE_GET_STRINGNUMBER(n, re, getnamesptr);  
             getnamesptr = npp;  
 #if defined SUPPORT_PCRE8 && defined SUPPORT_PCRE16  
             }  
 #endif  
           if (n < 0)  
             {  
             fprintf(outfile, "no parentheses with name \"");  
             PCHARSV(namestart, -1, outfile);  
             fprintf(outfile, "\"\n");  
             }  
3397            }            }
3398          continue;          continue;
3399    
# Line 3555  while (!done) Line 3564  while (!done)
3564            if (pmatch[i].rm_so >= 0)            if (pmatch[i].rm_so >= 0)
3565              {              {
3566              fprintf(outfile, "%2d: ", (int)i);              fprintf(outfile, "%2d: ", (int)i);
3567              PCHARSV(dbuffer + pmatch[i].rm_so,              PCHARSV(dbuffer, pmatch[i].rm_so,
3568                pmatch[i].rm_eo - pmatch[i].rm_so, outfile);                pmatch[i].rm_eo - pmatch[i].rm_so, outfile);
3569              fprintf(outfile, "\n");              fprintf(outfile, "\n");
3570              if (do_showcaprest || (i == 0 && do_showrest))              if (do_showcaprest || (i == 0 && do_showrest))
3571                {                {
3572                fprintf(outfile, "%2d+ ", (int)i);                fprintf(outfile, "%2d+ ", (int)i);
3573                PCHARSV(dbuffer + pmatch[i].rm_eo, len - pmatch[i].rm_eo,                PCHARSV(dbuffer, pmatch[i].rm_eo, len - pmatch[i].rm_eo,
3574                  outfile);                  outfile);
3575                fprintf(outfile, "\n");                fprintf(outfile, "\n");
3576                }                }
# Line 3702  while (!done) Line 3711  while (!done)
3711        if (count >= 0)        if (count >= 0)
3712          {          {
3713          int i, maxcount;          int i, maxcount;
3714            void *cnptr, *gnptr;
3715    
3716  #if !defined NODFA  #if !defined NODFA
3717          if (all_use_dfa || use_dfa) maxcount = use_size_offsets/2; else          if (all_use_dfa || use_dfa) maxcount = use_size_offsets/2; else
# Line 3750  while (!done) Line 3760  while (!done)
3760            else            else
3761              {              {
3762              fprintf(outfile, "%2d: ", i/2);              fprintf(outfile, "%2d: ", i/2);
3763              PCHARSV(bptr + use_offsets[i],              PCHARSV(bptr, use_offsets[i],
3764                use_offsets[i+1] - use_offsets[i], outfile);                use_offsets[i+1] - use_offsets[i], outfile);
3765              fprintf(outfile, "\n");              fprintf(outfile, "\n");
3766              if (do_showcaprest || (i == 0 && do_showrest))              if (do_showcaprest || (i == 0 && do_showrest))
3767                {                {
3768                fprintf(outfile, "%2d+ ", i/2);                fprintf(outfile, "%2d+ ", i/2);
3769                PCHARSV(bptr + use_offsets[i+1], len - use_offsets[i+1],                PCHARSV(bptr, use_offsets[i+1], len - use_offsets[i+1],
3770                  outfile);                  outfile);
3771                fprintf(outfile, "\n");                fprintf(outfile, "\n");
3772                }                }
# Line 3766  while (!done) Line 3776  while (!done)
3776          if (markptr != NULL)          if (markptr != NULL)
3777            {            {
3778            fprintf(outfile, "MK: ");            fprintf(outfile, "MK: ");
3779            PCHARSV(markptr, -1, outfile);            PCHARSV(markptr, 0, -1, outfile);
3780            fprintf(outfile, "\n");            fprintf(outfile, "\n");
3781            }            }
3782    
# Line 3783  while (!done) Line 3793  while (!done)
3793              else              else
3794                {                {
3795                fprintf(outfile, "%2dC ", i);                fprintf(outfile, "%2dC ", i);
3796                PCHARSV(copybuffer, rc, outfile);                PCHARSV(copybuffer, 0, rc, outfile);
3797                fprintf(outfile, " (%d)\n", rc);                fprintf(outfile, " (%d)\n", rc);
3798                }                }
3799              }              }
3800            }            }
3801    
3802          for (copynamesptr = copynames;          cnptr = copynames;
3803            for (;;)
 #if defined SUPPORT_PCRE8 && defined SUPPORT_PCRE16  
              use_pcre16?  
                (*(PCRE_SCHAR16*)copynamesptr) != 0 : *copynamesptr != 0;  
 #else  
              *copynamesptr != 0;  
 #endif  
              copynamesptr += (int)(STRLEN(copynamesptr) + 1) * CHAR_SIZE)  
3804            {            {
3805            int rc;            int rc;
3806            char copybuffer[256];            char copybuffer[256];
3807    
3808              if (use_pcre16)
3809                {
3810                if (*(pcre_uint16 *)cnptr == 0) break;
3811                }
3812              else
3813                {
3814                if (*(pcre_uint8 *)cnptr == 0) break;
3815                }
3816    
3817            PCRE_COPY_NAMED_SUBSTRING(rc, re, bptr, use_offsets, count,            PCRE_COPY_NAMED_SUBSTRING(rc, re, bptr, use_offsets, count,
3818              copynamesptr, copybuffer, sizeof(copybuffer));              cnptr, copybuffer, sizeof(copybuffer));
3819    
3820            if (rc < 0)            if (rc < 0)
3821              {              {
3822              fprintf(outfile, "copy substring ");              fprintf(outfile, "copy substring ");
3823              PCHARSV(copynamesptr, -1, outfile);              PCHARSV(cnptr, 0, -1, outfile);
3824              fprintf(outfile, " failed %d\n", rc);              fprintf(outfile, " failed %d\n", rc);
3825              }              }
3826            else            else
3827              {              {
3828              fprintf(outfile, "  C ");              fprintf(outfile, "  C ");
3829              PCHARSV(copybuffer, rc, outfile);              PCHARSV(copybuffer, 0, rc, outfile);
3830              fprintf(outfile, " (%d) ", rc);              fprintf(outfile, " (%d) ", rc);
3831              PCHARSV(copynamesptr, -1, outfile);              PCHARSV(cnptr, 0, -1, outfile);
3832              putc('\n', outfile);              putc('\n', outfile);
3833              }              }
3834    
3835              cnptr = (char *)cnptr + (STRLEN(cnptr) + 1) * CHAR_SIZE;
3836            }            }
3837    
3838          for (i = 0; i < 32; i++)          for (i = 0; i < 32; i++)
# Line 3831  while (!done) Line 3847  while (!done)
3847              else              else
3848                {                {
3849                fprintf(outfile, "%2dG ", i);                fprintf(outfile, "%2dG ", i);
3850                PCHARSV(substring, rc, outfile);                PCHARSV(substring, 0, rc, outfile);
3851                fprintf(outfile, " (%d)\n", rc);                fprintf(outfile, " (%d)\n", rc);
3852                PCRE_FREE_SUBSTRING(substring);                PCRE_FREE_SUBSTRING(substring);
3853                }                }
3854              }              }
3855            }            }
3856    
3857          for (getnamesptr = getnames;          gnptr = getnames;
3858  #if defined SUPPORT_PCRE8 && defined SUPPORT_PCRE16          for (;;)
              use_pcre16?  
                (*(PCRE_SCHAR16*)getnamesptr) != 0 : *getnamesptr != 0;  
 #else  
              *getnamesptr != 0;  
 #endif  
              getnamesptr += (int)(STRLEN(getnamesptr) + 1) * CHAR_SIZE)  
3859            {            {
3860            int rc;            int rc;
3861            const char *substring;            const char *substring;
3862    
3863              if (use_pcre16)
3864                {
3865                if (*(pcre_uint16 *)gnptr == 0) break;
3866                }
3867              else
3868                {
3869                if (*(pcre_uint8 *)gnptr == 0) break;
3870                }
3871    
3872            PCRE_GET_NAMED_SUBSTRING(rc, re, bptr, use_offsets, count,            PCRE_GET_NAMED_SUBSTRING(rc, re, bptr, use_offsets, count,
3873              getnamesptr, &substring);              gnptr, &substring);
3874            if (rc < 0)            if (rc < 0)
3875              {              {
3876              fprintf(outfile, "get substring ");              fprintf(outfile, "get substring ");
3877              PCHARSV(getnamesptr, -1, outfile);              PCHARSV(gnptr, 0, -1, outfile);
3878              fprintf(outfile, " failed %d\n", rc);              fprintf(outfile, " failed %d\n", rc);
3879              }              }
3880            else            else
3881              {              {
3882              fprintf(outfile, "  G ");              fprintf(outfile, "  G ");
3883              PCHARSV(substring, rc, outfile);              PCHARSV(substring, 0, rc, outfile);
3884              fprintf(outfile, " (%d) ", rc);              fprintf(outfile, " (%d) ", rc);
3885              PCHARSV(getnamesptr, -1, outfile);              PCHARSV(gnptr, 0, -1, outfile);
3886              PCRE_FREE_SUBSTRING(substring);              PCRE_FREE_SUBSTRING(substring);
3887              putc('\n', outfile);              putc('\n', outfile);
3888              }              }
3889    
3890              gnptr = (char *)gnptr + (STRLEN(gnptr) + 1) * CHAR_SIZE;
3891            }            }
3892    
3893          if (getlist)          if (getlist)
# Line 3880  while (!done) Line 3902  while (!done)
3902              for (i = 0; i < count; i++)              for (i = 0; i < count; i++)
3903                {                {
3904                fprintf(outfile, "%2dL ", i);                fprintf(outfile, "%2dL ", i);
3905                PCHARSV(stringlist[i], -1, outfile);                PCHARSV(stringlist[i], 0, -1, outfile);
3906                putc('\n', outfile);                putc('\n', outfile);
3907                }                }
3908              if (stringlist[i] != NULL)              if (stringlist[i] != NULL)
# Line 3898  while (!done) Line 3920  while (!done)
3920          else          else
3921            {            {
3922            fprintf(outfile, "Partial match, mark=");            fprintf(outfile, "Partial match, mark=");
3923            PCHARSV(markptr, -1, outfile);            PCHARSV(markptr, 0, -1, outfile);
3924            }            }
3925          if (use_size_offsets > 1)          if (use_size_offsets > 1)
3926            {            {
3927            fprintf(outfile, ": ");            fprintf(outfile, ": ");
3928            PCHARSV(bptr + use_offsets[0], use_offsets[1] - use_offsets[0],            PCHARSV(bptr, use_offsets[0], use_offsets[1] - use_offsets[0],
3929              outfile);              outfile);
3930            }            }
3931          fprintf(outfile, "\n");          fprintf(outfile, "\n");
# Line 3987  while (!done) Line 4009  while (!done)
4009                else                else
4010                  {                  {
4011                  fprintf(outfile, "No match, mark = ");                  fprintf(outfile, "No match, mark = ");
4012                  PCHARSV(markptr, -1, outfile);                  PCHARSV(markptr, 0, -1, outfile);
4013                  putc('\n', outfile);                  putc('\n', outfile);
4014                  }                  }
4015                }                }

Legend:
Removed from v.820  
changed lines
  Added in v.821

  ViewVC Help
Powered by ViewVC 1.1.5