/[pcre]/code/trunk/pcre_exec.c
ViewVC logotype

Diff of /code/trunk/pcre_exec.c

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

revision 527 by ph10, Sat May 29 15:50:39 2010 UTC revision 534 by ph10, Thu Jun 3 18:26:05 2010 UTC
# Line 295  argument of match(), which never changes Line 295  argument of match(), which never changes
295  #define RMATCH(ra,rb,rc,rd,re,rf,rg,rw)\  #define RMATCH(ra,rb,rc,rd,re,rf,rg,rw)\
296    {\    {\
297    heapframe *newframe = (pcre_stack_malloc)(sizeof(heapframe));\    heapframe *newframe = (pcre_stack_malloc)(sizeof(heapframe));\
298      if (newframe == NULL) RRETURN(PCRE_ERROR_NOMEMORY);\
299    frame->Xwhere = rw; \    frame->Xwhere = rw; \
300    newframe->Xeptr = ra;\    newframe->Xeptr = ra;\
301    newframe->Xecode = rb;\    newframe->Xecode = rb;\
# Line 488  heap whenever RMATCH() does a "recursion Line 489  heap whenever RMATCH() does a "recursion
489    
490  #ifdef NO_RECURSE  #ifdef NO_RECURSE
491  heapframe *frame = (pcre_stack_malloc)(sizeof(heapframe));  heapframe *frame = (pcre_stack_malloc)(sizeof(heapframe));
492    if (frame == NULL) RRETURN(PCRE_ERROR_NOMEMORY);
493  frame->Xprevframe = NULL;            /* Marks the top level */  frame->Xprevframe = NULL;            /* Marks the top level */
494    
495  /* Copy in the original argument variables */  /* Copy in the original argument variables */
# Line 794  for (;;) Line 796  for (;;)
796        save_capture_last = md->capture_last;        save_capture_last = md->capture_last;
797    
798        DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3));        DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3));
799        md->offset_vector[md->offset_end - number] = eptr - md->start_subject;        md->offset_vector[md->offset_end - number] =
800            (int)(eptr - md->start_subject);
801    
802        flags = (op == OP_SCBRA)? match_cbegroup : 0;        flags = (op == OP_SCBRA)? match_cbegroup : 0;
803        do        do
# Line 889  for (;;) Line 892  for (;;)
892          cb.callout_number   = ecode[LINK_SIZE+2];          cb.callout_number   = ecode[LINK_SIZE+2];
893          cb.offset_vector    = md->offset_vector;          cb.offset_vector    = md->offset_vector;
894          cb.subject          = (PCRE_SPTR)md->start_subject;          cb.subject          = (PCRE_SPTR)md->start_subject;
895          cb.subject_length   = md->end_subject - md->start_subject;          cb.subject_length   = (int)(md->end_subject - md->start_subject);
896          cb.start_match      = mstart - md->start_subject;          cb.start_match      = (int)(mstart - md->start_subject);
897          cb.current_position = eptr - md->start_subject;          cb.current_position = (int)(eptr - md->start_subject);
898          cb.pattern_position = GET(ecode, LINK_SIZE + 3);          cb.pattern_position = GET(ecode, LINK_SIZE + 3);
899          cb.next_item_length = GET(ecode, 3 + 2*LINK_SIZE);          cb.next_item_length = GET(ecode, 3 + 2*LINK_SIZE);
900          cb.capture_top      = offset_top/2;          cb.capture_top      = offset_top/2;
# Line 1117  for (;;) Line 1120  for (;;)
1120        {        {
1121        md->offset_vector[offset] =        md->offset_vector[offset] =
1122          md->offset_vector[md->offset_end - number];          md->offset_vector[md->offset_end - number];
1123        md->offset_vector[offset+1] = eptr - md->start_subject;        md->offset_vector[offset+1] = (int)(eptr - md->start_subject);
1124        if (offset_top <= offset) offset_top = offset + 2;        if (offset_top <= offset) offset_top = offset + 2;
1125        }        }
1126      ecode += 3;      ecode += 3;
# Line 1280  for (;;) Line 1283  for (;;)
1283        cb.callout_number   = ecode[1];        cb.callout_number   = ecode[1];
1284        cb.offset_vector    = md->offset_vector;        cb.offset_vector    = md->offset_vector;
1285        cb.subject          = (PCRE_SPTR)md->start_subject;        cb.subject          = (PCRE_SPTR)md->start_subject;
1286        cb.subject_length   = md->end_subject - md->start_subject;        cb.subject_length   = (int)(md->end_subject - md->start_subject);
1287        cb.start_match      = mstart - md->start_subject;        cb.start_match      = (int)(mstart - md->start_subject);
1288        cb.current_position = eptr - md->start_subject;        cb.current_position = (int)(eptr - md->start_subject);
1289        cb.pattern_position = GET(ecode, 2);        cb.pattern_position = GET(ecode, 2);
1290        cb.next_item_length = GET(ecode, 2 + LINK_SIZE);        cb.next_item_length = GET(ecode, 2 + LINK_SIZE);
1291        cb.capture_top      = offset_top/2;        cb.capture_top      = offset_top/2;
# Line 1559  for (;;) Line 1562  for (;;)
1562          {          {
1563          md->offset_vector[offset] =          md->offset_vector[offset] =
1564            md->offset_vector[md->offset_end - number];            md->offset_vector[md->offset_end - number];
1565          md->offset_vector[offset+1] = eptr - md->start_subject;          md->offset_vector[offset+1] = (int)(eptr - md->start_subject);
1566          if (offset_top <= offset) offset_top = offset + 2;          if (offset_top <= offset) offset_top = offset + 2;
1567          }          }
1568    
# Line 2233  for (;;) Line 2236  for (;;)
2236        referenced subpattern. */        referenced subpattern. */
2237    
2238        if (offset >= offset_top || md->offset_vector[offset] < 0)        if (offset >= offset_top || md->offset_vector[offset] < 0)
2239          length = (md->jscript_compat)? 0 : md->end_subject - eptr + 1;          length = (md->jscript_compat)? 0 : (int)(md->end_subject - eptr + 1);
2240        else        else
2241          length = md->offset_vector[offset+1] - md->offset_vector[offset];          length = md->offset_vector[offset+1] - md->offset_vector[offset];
2242    
# Line 4213  for (;;) Line 4216  for (;;)
4216                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4217                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
4218                }                }
4219              GETCHARINC(c, eptr);              GETCHARINCTEST(c, eptr);
4220              if (prop_fail_result) MRRETURN(MATCH_NOMATCH);              if (prop_fail_result) MRRETURN(MATCH_NOMATCH);
4221              }              }
4222            /* Control never gets here */            /* Control never gets here */
# Line 4229  for (;;) Line 4232  for (;;)
4232                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4233                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
4234                }                }
4235              GETCHARINC(c, eptr);              GETCHARINCTEST(c, eptr);
4236              prop_chartype = UCD_CHARTYPE(c);              prop_chartype = UCD_CHARTYPE(c);
4237              if ((prop_chartype == ucp_Lu ||              if ((prop_chartype == ucp_Lu ||
4238                   prop_chartype == ucp_Ll ||                   prop_chartype == ucp_Ll ||
# Line 4249  for (;;) Line 4252  for (;;)
4252                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4253                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
4254                }                }
4255              GETCHARINC(c, eptr);              GETCHARINCTEST(c, eptr);
4256              prop_category = UCD_CATEGORY(c);              prop_category = UCD_CATEGORY(c);
4257              if ((prop_category == prop_value) == prop_fail_result)              if ((prop_category == prop_value) == prop_fail_result)
4258                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
# Line 4267  for (;;) Line 4270  for (;;)
4270                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4271                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
4272                }                }
4273              GETCHARINC(c, eptr);              GETCHARINCTEST(c, eptr);
4274              prop_chartype = UCD_CHARTYPE(c);              prop_chartype = UCD_CHARTYPE(c);
4275              if ((prop_chartype == prop_value) == prop_fail_result)              if ((prop_chartype == prop_value) == prop_fail_result)
4276                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
# Line 4285  for (;;) Line 4288  for (;;)
4288                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4289                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
4290                }                }
4291              GETCHARINC(c, eptr);              GETCHARINCTEST(c, eptr);
4292              prop_script = UCD_SCRIPT(c);              prop_script = UCD_SCRIPT(c);
4293              if ((prop_script == prop_value) == prop_fail_result)              if ((prop_script == prop_value) == prop_fail_result)
4294                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
# Line 4303  for (;;) Line 4306  for (;;)
4306                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4307                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
4308                }                }
4309              GETCHARINC(c, eptr);              GETCHARINCTEST(c, eptr);
4310              prop_category = UCD_CATEGORY(c);              prop_category = UCD_CATEGORY(c);
4311              if ((prop_category == ucp_L || prop_category == ucp_N)              if ((prop_category == ucp_L || prop_category == ucp_N)
4312                     == prop_fail_result)                     == prop_fail_result)
# Line 4322  for (;;) Line 4325  for (;;)
4325                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4326                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
4327                }                }
4328              GETCHARINC(c, eptr);              GETCHARINCTEST(c, eptr);
4329              prop_category = UCD_CATEGORY(c);              prop_category = UCD_CATEGORY(c);
4330              if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||              if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
4331                   c == CHAR_FF || c == CHAR_CR)                   c == CHAR_FF || c == CHAR_CR)
# Line 4342  for (;;) Line 4345  for (;;)
4345                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4346                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
4347                }                }
4348              GETCHARINC(c, eptr);              GETCHARINCTEST(c, eptr);
4349              prop_category = UCD_CATEGORY(c);              prop_category = UCD_CATEGORY(c);
4350              if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||              if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
4351                   c == CHAR_VT || c == CHAR_FF || c == CHAR_CR)                   c == CHAR_VT || c == CHAR_FF || c == CHAR_CR)
# Line 4362  for (;;) Line 4365  for (;;)
4365                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4366                MRRETURN(MATCH_NOMATCH);                MRRETURN(MATCH_NOMATCH);
4367                }                }
4368              GETCHARINC(c, eptr);              GETCHARINCTEST(c, eptr);
4369              prop_category = UCD_CATEGORY(c);              prop_category = UCD_CATEGORY(c);
4370              if ((prop_category == ucp_L ||              if ((prop_category == ucp_L ||
4371                   prop_category == ucp_N ||                   prop_category == ucp_N ||
# Line 4720  for (;;) Line 4723  for (;;)
4723                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4724                break;                break;
4725                }                }
4726              GETCHARLEN(c, eptr, len);              GETCHARLENTEST(c, eptr, len);
4727              if (prop_fail_result) break;              if (prop_fail_result) break;
4728              eptr+= len;              eptr+= len;
4729              }              }
# Line 4735  for (;;) Line 4738  for (;;)
4738                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4739                break;                break;
4740                }                }
4741              GETCHARLEN(c, eptr, len);              GETCHARLENTEST(c, eptr, len);
4742              prop_chartype = UCD_CHARTYPE(c);              prop_chartype = UCD_CHARTYPE(c);
4743              if ((prop_chartype == ucp_Lu ||              if ((prop_chartype == ucp_Lu ||
4744                   prop_chartype == ucp_Ll ||                   prop_chartype == ucp_Ll ||
# Line 4754  for (;;) Line 4757  for (;;)
4757                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4758                break;                break;
4759                }                }
4760              GETCHARLEN(c, eptr, len);              GETCHARLENTEST(c, eptr, len);
4761              prop_category = UCD_CATEGORY(c);              prop_category = UCD_CATEGORY(c);
4762              if ((prop_category == prop_value) == prop_fail_result)              if ((prop_category == prop_value) == prop_fail_result)
4763                break;                break;
# Line 4771  for (;;) Line 4774  for (;;)
4774                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4775                break;                break;
4776                }                }
4777              GETCHARLEN(c, eptr, len);              GETCHARLENTEST(c, eptr, len);
4778              prop_chartype = UCD_CHARTYPE(c);              prop_chartype = UCD_CHARTYPE(c);
4779              if ((prop_chartype == prop_value) == prop_fail_result)              if ((prop_chartype == prop_value) == prop_fail_result)
4780                break;                break;
# Line 4788  for (;;) Line 4791  for (;;)
4791                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4792                break;                break;
4793                }                }
4794              GETCHARLEN(c, eptr, len);              GETCHARLENTEST(c, eptr, len);
4795              prop_script = UCD_SCRIPT(c);              prop_script = UCD_SCRIPT(c);
4796              if ((prop_script == prop_value) == prop_fail_result)              if ((prop_script == prop_value) == prop_fail_result)
4797                break;                break;
# Line 4805  for (;;) Line 4808  for (;;)
4808                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4809                break;                break;
4810                }                }
4811              GETCHARLEN(c, eptr, len);              GETCHARLENTEST(c, eptr, len);
4812              prop_category = UCD_CATEGORY(c);              prop_category = UCD_CATEGORY(c);
4813              if ((prop_category == ucp_L || prop_category == ucp_N)              if ((prop_category == ucp_L || prop_category == ucp_N)
4814                   == prop_fail_result)                   == prop_fail_result)
# Line 4823  for (;;) Line 4826  for (;;)
4826                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4827                break;                break;
4828                }                }
4829              GETCHARLEN(c, eptr, len);              GETCHARLENTEST(c, eptr, len);
4830              prop_category = UCD_CATEGORY(c);              prop_category = UCD_CATEGORY(c);
4831              if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||              if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
4832                   c == CHAR_FF || c == CHAR_CR)                   c == CHAR_FF || c == CHAR_CR)
# Line 4842  for (;;) Line 4845  for (;;)
4845                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4846                break;                break;
4847                }                }
4848              GETCHARLEN(c, eptr, len);              GETCHARLENTEST(c, eptr, len);
4849              prop_category = UCD_CATEGORY(c);              prop_category = UCD_CATEGORY(c);
4850              if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||              if ((prop_category == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
4851                   c == CHAR_VT || c == CHAR_FF || c == CHAR_CR)                   c == CHAR_VT || c == CHAR_FF || c == CHAR_CR)
# Line 4861  for (;;) Line 4864  for (;;)
4864                SCHECK_PARTIAL();                SCHECK_PARTIAL();
4865                break;                break;
4866                }                }
4867              GETCHARLEN(c, eptr, len);              GETCHARLENTEST(c, eptr, len);
4868              prop_category = UCD_CATEGORY(c);              prop_category = UCD_CATEGORY(c);
4869              if ((prop_category == ucp_L || prop_category == ucp_N ||              if ((prop_category == ucp_L || prop_category == ucp_N ||
4870                   c == CHAR_UNDERSCORE) == prop_fail_result)                   c == CHAR_UNDERSCORE) == prop_fail_result)
# Line 6176  if (rc == MATCH_MATCH || rc == MATCH_ACC Line 6179  if (rc == MATCH_MATCH || rc == MATCH_ACC
6179    
6180    if (offsetcount < 2) rc = 0; else    if (offsetcount < 2) rc = 0; else
6181      {      {
6182      offsets[0] = md->start_match_ptr - md->start_subject;      offsets[0] = (int)(md->start_match_ptr - md->start_subject);
6183      offsets[1] = md->end_match_ptr - md->start_subject;      offsets[1] = (int)(md->end_match_ptr - md->start_subject);
6184      }      }
6185    
6186    DPRINTF((">>>> returning %d\n", rc));    DPRINTF((">>>> returning %d\n", rc));
# Line 6209  if (start_partial != NULL) Line 6212  if (start_partial != NULL)
6212    md->mark = NULL;    md->mark = NULL;
6213    if (offsetcount > 1)    if (offsetcount > 1)
6214      {      {
6215      offsets[0] = start_partial - (USPTR)subject;      offsets[0] = (int)(start_partial - (USPTR)subject);
6216      offsets[1] = end_subject - (USPTR)subject;      offsets[1] = (int)(end_subject - (USPTR)subject);
6217      }      }
6218    rc = PCRE_ERROR_PARTIAL;    rc = PCRE_ERROR_PARTIAL;
6219    }    }

Legend:
Removed from v.527  
changed lines
  Added in v.534

  ViewVC Help
Powered by ViewVC 1.1.5