/[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 842 by ph10, Sat Dec 31 15:19:04 2011 UTC revision 882 by ph10, Sun Jan 15 18:45:27 2012 UTC
# Line 626  the alternative names that are used. */ Line 626  the alternative names that are used. */
626  #define condassert    condition  #define condassert    condition
627  #define matched_once  prev_is_word  #define matched_once  prev_is_word
628  #define foc           number  #define foc           number
629    #define save_mark     data
630    
631  /* These statements are here to stop the compiler complaining about unitialized  /* These statements are here to stop the compiler complaining about unitialized
632  variables. */  variables. */
# Line 818  for (;;) Line 819  for (;;)
819      case OP_ONCE_NC:      case OP_ONCE_NC:
820      prev = ecode;      prev = ecode;
821      saved_eptr = eptr;      saved_eptr = eptr;
822        save_mark = md->mark;
823      do      do
824        {        {
825        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, eptrb, RM64);        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, eptrb, RM64);
# Line 836  for (;;) Line 838  for (;;)
838    
839        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
840        ecode += GET(ecode,1);        ecode += GET(ecode,1);
841          md->mark = save_mark;
842        }        }
843      while (*ecode == OP_ALT);      while (*ecode == OP_ALT);
844    
# Line 915  for (;;) Line 918  for (;;)
918        save_offset2 = md->offset_vector[offset+1];        save_offset2 = md->offset_vector[offset+1];
919        save_offset3 = md->offset_vector[md->offset_end - number];        save_offset3 = md->offset_vector[md->offset_end - number];
920        save_capture_last = md->capture_last;        save_capture_last = md->capture_last;
921          save_mark = md->mark;
922    
923        DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3));        DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3));
924        md->offset_vector[md->offset_end - number] =        md->offset_vector[md->offset_end - number] =
# Line 951  for (;;) Line 955  for (;;)
955          if (rrc != MATCH_NOMATCH) RRETURN(rrc);          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
956          md->capture_last = save_capture_last;          md->capture_last = save_capture_last;
957          ecode += GET(ecode, 1);          ecode += GET(ecode, 1);
958            md->mark = save_mark;
959          if (*ecode != OP_ALT) break;          if (*ecode != OP_ALT) break;
960          }          }
961    
# Line 1016  for (;;) Line 1021  for (;;)
1021    
1022        /* In all other cases, we have to make another call to match(). */        /* In all other cases, we have to make another call to match(). */
1023    
1024          save_mark = md->mark;
1025        RMATCH(eptr, ecode + PRIV(OP_lengths)[*ecode], offset_top, md, eptrb,        RMATCH(eptr, ecode + PRIV(OP_lengths)[*ecode], offset_top, md, eptrb,
1026          RM2);          RM2);
1027    
1028        /* See comment in the code for capturing groups above about handling        /* See comment in the code for capturing groups above about handling
1029        THEN. */        THEN. */
1030    
# Line 1045  for (;;) Line 1051  for (;;)
1051          RRETURN(rrc);          RRETURN(rrc);
1052          }          }
1053        ecode += GET(ecode, 1);        ecode += GET(ecode, 1);
1054          md->mark = save_mark;
1055        if (*ecode != OP_ALT) break;        if (*ecode != OP_ALT) break;
1056        }        }
1057    
# Line 1223  for (;;) Line 1230  for (;;)
1230        {        {
1231        if (PUBL(callout) != NULL)        if (PUBL(callout) != NULL)
1232          {          {
1233          pcre_callout_block cb;          PUBL(callout_block) cb;
1234          cb.version          = 2;   /* Version 1 of the callout block */          cb.version          = 2;   /* Version 1 of the callout block */
1235          cb.callout_number   = ecode[LINK_SIZE+2];          cb.callout_number   = ecode[LINK_SIZE+2];
1236          cb.offset_vector    = md->offset_vector;          cb.offset_vector    = md->offset_vector;
1237    #ifdef COMPILE_PCRE8
1238          cb.subject          = (PCRE_SPTR)md->start_subject;          cb.subject          = (PCRE_SPTR)md->start_subject;
1239    #else
1240            cb.subject          = (PCRE_SPTR16)md->start_subject;
1241    #endif
1242          cb.subject_length   = (int)(md->end_subject - md->start_subject);          cb.subject_length   = (int)(md->end_subject - md->start_subject);
1243          cb.start_match      = (int)(mstart - md->start_subject);          cb.start_match      = (int)(mstart - md->start_subject);
1244          cb.current_position = (int)(eptr - md->start_subject);          cb.current_position = (int)(eptr - md->start_subject);
# Line 1633  for (;;) Line 1644  for (;;)
1644      case OP_CALLOUT:      case OP_CALLOUT:
1645      if (PUBL(callout) != NULL)      if (PUBL(callout) != NULL)
1646        {        {
1647        pcre_callout_block cb;        PUBL(callout_block) cb;
1648        cb.version          = 2;   /* Version 1 of the callout block */        cb.version          = 2;   /* Version 1 of the callout block */
1649        cb.callout_number   = ecode[1];        cb.callout_number   = ecode[1];
1650        cb.offset_vector    = md->offset_vector;        cb.offset_vector    = md->offset_vector;
1651    #ifdef COMPILE_PCRE8
1652        cb.subject          = (PCRE_SPTR)md->start_subject;        cb.subject          = (PCRE_SPTR)md->start_subject;
1653    #else
1654          cb.subject          = (PCRE_SPTR16)md->start_subject;
1655    #endif
1656        cb.subject_length   = (int)(md->end_subject - md->start_subject);        cb.subject_length   = (int)(md->end_subject - md->start_subject);
1657        cb.start_match      = (int)(mstart - md->start_subject);        cb.start_match      = (int)(mstart - md->start_subject);
1658        cb.current_position = (int)(eptr - md->start_subject);        cb.current_position = (int)(eptr - md->start_subject);
# Line 6139  pcre_exec(const pcre *argument_re, const Line 6154  pcre_exec(const pcre *argument_re, const
6154    int offsetcount)    int offsetcount)
6155  #else  #else
6156  PCRE_EXP_DEFN int PCRE_CALL_CONVENTION  PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
6157  pcre16_exec(const pcre *argument_re, const pcre_extra *extra_data,  pcre16_exec(const pcre16 *argument_re, const pcre16_extra *extra_data,
6158    PCRE_SPTR16 subject, int length, int start_offset, int options, int *offsets,    PCRE_SPTR16 subject, int length, int start_offset, int options, int *offsets,
6159    int offsetcount)    int offsetcount)
6160  #endif  #endif
# Line 6167  PCRE_PUCHAR start_partial = NULL; Line 6182  PCRE_PUCHAR start_partial = NULL;
6182  PCRE_PUCHAR req_char_ptr = start_match - 1;  PCRE_PUCHAR req_char_ptr = start_match - 1;
6183    
6184  const pcre_study_data *study;  const pcre_study_data *study;
6185  const real_pcre *external_re = (const real_pcre *)argument_re;  const REAL_PCRE *re = (const REAL_PCRE *)argument_re;
 const real_pcre *re = external_re;  
6186    
6187  /* Plausibility checks */  /* Plausibility checks */
6188    
# Line 6255  md->callout_data = NULL; Line 6269  md->callout_data = NULL;
6269    
6270  /* The table pointer is always in native byte order. */  /* The table pointer is always in native byte order. */
6271    
6272  tables = external_re->tables;  tables = re->tables;
6273    
6274  if (extra_data != NULL)  if (extra_data != NULL)
6275    {    {
# Line 6295  firstline = (re->options & PCRE_FIRSTLIN Line 6309  firstline = (re->options & PCRE_FIRSTLIN
6309    
6310  /* The code starts after the real_pcre block and the capture name table. */  /* The code starts after the real_pcre block and the capture name table. */
6311    
6312  md->start_code = (const pcre_uchar *)external_re + re->name_table_offset +  md->start_code = (const pcre_uchar *)re + re->name_table_offset +
6313    re->name_count * re->name_entry_size;    re->name_count * re->name_entry_size;
6314    
6315  md->start_subject = (PCRE_PUCHAR)subject;  md->start_subject = (PCRE_PUCHAR)subject;
# Line 6858  if (rc == MATCH_MATCH || rc == MATCH_ACC Line 6872  if (rc == MATCH_MATCH || rc == MATCH_ACC
6872    /* Return MARK data if requested */    /* Return MARK data if requested */
6873    
6874    if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_MARK) != 0)    if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_MARK) != 0)
6875      *(extra_data->mark) = (unsigned char *)(md->mark);      *(extra_data->mark) = (pcre_uchar *)md->mark;
6876    DPRINTF((">>>> returning %d\n", rc));    DPRINTF((">>>> returning %d\n", rc));
6877    return rc;    return rc;
6878    }    }
# Line 6905  else Line 6919  else
6919  /* Return the MARK data if it has been requested. */  /* Return the MARK data if it has been requested. */
6920    
6921  if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_MARK) != 0)  if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_MARK) != 0)
6922    *(extra_data->mark) = (unsigned char *)(md->nomatch_mark);    *(extra_data->mark) = (pcre_uchar *)md->nomatch_mark;
6923  return rc;  return rc;
6924  }  }
6925    

Legend:
Removed from v.842  
changed lines
  Added in v.882

  ViewVC Help
Powered by ViewVC 1.1.5