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

Diff of /code/trunk/pcre_dfa_exec.c

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

revision 1046 by ph10, Tue Sep 25 16:27:58 2012 UTC revision 1055 by chpe, Tue Oct 16 15:53:30 2012 UTC
# Line 1007  for (;;) Line 1007  for (;;)
1007            {            {
1008            const pcre_uchar *temp = ptr - 1;            const pcre_uchar *temp = ptr - 1;
1009            if (temp < md->start_used_ptr) md->start_used_ptr = temp;            if (temp < md->start_used_ptr) md->start_used_ptr = temp;
1010  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
1011            if (utf) { BACKCHAR(temp); }            if (utf) { BACKCHAR(temp); }
1012  #endif  #endif
1013            GETCHARTEST(d, temp);            GETCHARTEST(d, temp);
# Line 2607  for (;;) Line 2607  for (;;)
2607              cb.version          = 1;   /* Version 1 of the callout block */              cb.version          = 1;   /* Version 1 of the callout block */
2608              cb.callout_number   = code[LINK_SIZE+2];              cb.callout_number   = code[LINK_SIZE+2];
2609              cb.offset_vector    = offsets;              cb.offset_vector    = offsets;
2610  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
2611              cb.subject          = (PCRE_SPTR)start_subject;              cb.subject          = (PCRE_SPTR)start_subject;
2612  #else  #elif defined COMPILE_PCRE16
2613              cb.subject          = (PCRE_SPTR16)start_subject;              cb.subject          = (PCRE_SPTR16)start_subject;
2614    #elif defined COMPILE_PCRE32
2615                cb.subject          = (PCRE_SPTR32)start_subject;
2616  #endif  #endif
2617              cb.subject_length   = (int)(end_subject - start_subject);              cb.subject_length   = (int)(end_subject - start_subject);
2618              cb.start_match      = (int)(current_subject - start_subject);              cb.start_match      = (int)(current_subject - start_subject);
# Line 2741  for (;;) Line 2743  for (;;)
2743            for (rc = rc*2 - 2; rc >= 0; rc -= 2)            for (rc = rc*2 - 2; rc >= 0; rc -= 2)
2744              {              {
2745              int charcount = local_offsets[rc+1] - local_offsets[rc];              int charcount = local_offsets[rc+1] - local_offsets[rc];
2746  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
2747              if (utf)              if (utf)
2748                {                {
2749                const pcre_uchar *p = start_subject + local_offsets[rc];                const pcre_uchar *p = start_subject + local_offsets[rc];
# Line 2845  for (;;) Line 2847  for (;;)
2847              const pcre_uchar *p = ptr;              const pcre_uchar *p = ptr;
2848              const pcre_uchar *pp = local_ptr;              const pcre_uchar *pp = local_ptr;
2849              charcount = (int)(pp - p);              charcount = (int)(pp - p);
2850  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
2851              if (utf) while (p < pp) if (NOT_FIRSTCHAR(*p++)) charcount--;              if (utf) while (p < pp) if (NOT_FIRSTCHAR(*p++)) charcount--;
2852  #endif  #endif
2853              ADD_NEW_DATA(-next_state_offset, 0, (charcount - 1));              ADD_NEW_DATA(-next_state_offset, 0, (charcount - 1));
# Line 2927  for (;;) Line 2929  for (;;)
2929              }              }
2930            else            else
2931              {              {
2932  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
2933              if (utf)              if (utf)
2934                {                {
2935                const pcre_uchar *p = start_subject + local_offsets[0];                const pcre_uchar *p = start_subject + local_offsets[0];
# Line 2956  for (;;) Line 2958  for (;;)
2958          cb.version          = 1;   /* Version 1 of the callout block */          cb.version          = 1;   /* Version 1 of the callout block */
2959          cb.callout_number   = code[1];          cb.callout_number   = code[1];
2960          cb.offset_vector    = offsets;          cb.offset_vector    = offsets;
2961  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
2962          cb.subject          = (PCRE_SPTR)start_subject;          cb.subject          = (PCRE_SPTR)start_subject;
2963  #else  #elif defined COMPILE_PCRE16
2964          cb.subject          = (PCRE_SPTR16)start_subject;          cb.subject          = (PCRE_SPTR16)start_subject;
2965    #elif defined COMPILE_PCRE32
2966            cb.subject          = (PCRE_SPTR32)start_subject;
2967  #endif  #endif
2968          cb.subject_length   = (int)(end_subject - start_subject);          cb.subject_length   = (int)(end_subject - start_subject);
2969          cb.start_match      = (int)(current_subject - start_subject);          cb.start_match      = (int)(current_subject - start_subject);
# Line 3075  Returns:          > 0 => number of match Line 3079  Returns:          > 0 => number of match
3079                   < -1 => some kind of unexpected problem                   < -1 => some kind of unexpected problem
3080  */  */
3081    
3082  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
3083  PCRE_EXP_DEFN int PCRE_CALL_CONVENTION  PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
3084  pcre_dfa_exec(const pcre *argument_re, const pcre_extra *extra_data,  pcre_dfa_exec(const pcre *argument_re, const pcre_extra *extra_data,
3085    const char *subject, int length, int start_offset, int options, int *offsets,    const char *subject, int length, int start_offset, int options, int *offsets,
3086    int offsetcount, int *workspace, int wscount)    int offsetcount, int *workspace, int wscount)
3087  #else  #elif defined COMPILE_PCRE16
3088  PCRE_EXP_DEFN int PCRE_CALL_CONVENTION  PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
3089  pcre16_dfa_exec(const pcre16 *argument_re, const pcre16_extra *extra_data,  pcre16_dfa_exec(const pcre16 *argument_re, const pcre16_extra *extra_data,
3090    PCRE_SPTR16 subject, int length, int start_offset, int options, int *offsets,    PCRE_SPTR16 subject, int length, int start_offset, int options, int *offsets,
3091    int offsetcount, int *workspace, int wscount)    int offsetcount, int *workspace, int wscount)
3092    #elif defined COMPILE_PCRE32
3093    PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
3094    pcre32_dfa_exec(const pcre32 *argument_re, const pcre32_extra *extra_data,
3095      PCRE_SPTR32 subject, int length, int start_offset, int options, int *offsets,
3096      int offsetcount, int *workspace, int wscount)
3097  #endif  #endif
3098  {  {
3099  REAL_PCRE *re = (REAL_PCRE *)argument_re;  REAL_PCRE *re = (REAL_PCRE *)argument_re;
# Line 3159  end_subject = (const pcre_uchar *)subjec Line 3168  end_subject = (const pcre_uchar *)subjec
3168  req_char_ptr = current_subject - 1;  req_char_ptr = current_subject - 1;
3169    
3170  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3171  /* PCRE_UTF16 has the same value as PCRE_UTF8. */  /* PCRE_UTF(16|32) have the same value as PCRE_UTF8. */
3172  utf = (re->options & PCRE_UTF8) != 0;  utf = (re->options & PCRE_UTF8) != 0;
3173  #else  #else
3174  utf = FALSE;  utf = FALSE;
# Line 3245  if (utf && (options & PCRE_NO_UTF8_CHECK Line 3254  if (utf && (options & PCRE_NO_UTF8_CHECK
3254        offsets[0] = erroroffset;        offsets[0] = erroroffset;
3255        offsets[1] = errorcode;        offsets[1] = errorcode;
3256        }        }
3257      return (errorcode <= PCRE_UTF8_ERR5 && (options & PCRE_PARTIAL_HARD) != 0)?  #if defined COMPILE_PCRE8
3258        return (errorcode <= PCRE_UTF8_ERR5 && (options & PCRE_PARTIAL_HARD) != 0) ?
3259        PCRE_ERROR_SHORTUTF8 : PCRE_ERROR_BADUTF8;        PCRE_ERROR_SHORTUTF8 : PCRE_ERROR_BADUTF8;
3260    #elif defined COMPILE_PCRE16
3261        return (errorcode <= PCRE_UTF16_ERR1 && (options & PCRE_PARTIAL_HARD) != 0) ?
3262          PCRE_ERROR_SHORTUTF16 : PCRE_ERROR_BADUTF16;
3263    #elif defined COMPILE_PCRE32
3264        return PCRE_ERROR_BADUTF32;
3265    #endif
3266      }      }
3267    #if defined COMPILE_PCRE8 || defined COMPILE_PCRE16
3268    if (start_offset > 0 && start_offset < length &&    if (start_offset > 0 && start_offset < length &&
3269          NOT_FIRSTCHAR(((PCRE_PUCHAR)subject)[start_offset]))          NOT_FIRSTCHAR(((PCRE_PUCHAR)subject)[start_offset]))
3270      return PCRE_ERROR_BADUTF8_OFFSET;      return PCRE_ERROR_BADUTF8_OFFSET;
3271    #endif
3272    }    }
3273  #endif  #endif
3274    

Legend:
Removed from v.1046  
changed lines
  Added in v.1055

  ViewVC Help
Powered by ViewVC 1.1.5