/[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 1041 by ph10, Sun Sep 16 10:16:27 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 1060  for (;;) Line 1060  for (;;)
1060        if (clen > 0)        if (clen > 0)
1061          {          {
1062          BOOL OK;          BOOL OK;
1063            const pcre_uint32 *cp;
1064          const ucd_record * prop = GET_UCD(c);          const ucd_record * prop = GET_UCD(c);
1065          switch(code[1])          switch(code[1])
1066            {            {
# Line 1107  for (;;) Line 1108  for (;;)
1108                 PRIV(ucp_gentype)[prop->chartype] == ucp_N ||                 PRIV(ucp_gentype)[prop->chartype] == ucp_N ||
1109                 c == CHAR_UNDERSCORE;                 c == CHAR_UNDERSCORE;
1110            break;            break;
1111    
1112              case PT_CLIST:
1113              cp = PRIV(ucd_caseless_sets) + prop->caseset;
1114              for (;;)
1115                {
1116                if (c < *cp) { OK = FALSE; break; }
1117                if (c == *cp++) { OK = TRUE; break; }
1118                }
1119              break;
1120    
1121            /* Should never occur, but keep compilers from grumbling. */            /* Should never occur, but keep compilers from grumbling. */
1122    
# Line 1294  for (;;) Line 1304  for (;;)
1304        if (clen > 0)        if (clen > 0)
1305          {          {
1306          BOOL OK;          BOOL OK;
1307            const pcre_uint32 *cp;
1308          const ucd_record * prop = GET_UCD(c);          const ucd_record * prop = GET_UCD(c);
1309          switch(code[2])          switch(code[2])
1310            {            {
# Line 1342  for (;;) Line 1353  for (;;)
1353                 c == CHAR_UNDERSCORE;                 c == CHAR_UNDERSCORE;
1354            break;            break;
1355    
1356              case PT_CLIST:
1357              cp = PRIV(ucd_caseless_sets) + prop->caseset;
1358              for (;;)
1359                {
1360                if (c < *cp) { OK = FALSE; break; }
1361                if (c == *cp++) { OK = TRUE; break; }
1362                }
1363              break;
1364    
1365            /* Should never occur, but keep compilers from grumbling. */            /* Should never occur, but keep compilers from grumbling. */
1366    
1367            default:            default:
# Line 1522  for (;;) Line 1542  for (;;)
1542        if (clen > 0)        if (clen > 0)
1543          {          {
1544          BOOL OK;          BOOL OK;
1545            const pcre_uint32 *cp;
1546          const ucd_record * prop = GET_UCD(c);          const ucd_record * prop = GET_UCD(c);
1547          switch(code[2])          switch(code[2])
1548            {            {
# Line 1570  for (;;) Line 1591  for (;;)
1591                 c == CHAR_UNDERSCORE;                 c == CHAR_UNDERSCORE;
1592            break;            break;
1593    
1594              case PT_CLIST:
1595              cp = PRIV(ucd_caseless_sets) + prop->caseset;
1596              for (;;)
1597                {
1598                if (c < *cp) { OK = FALSE; break; }
1599                if (c == *cp++) { OK = TRUE; break; }
1600                }
1601              break;
1602    
1603            /* Should never occur, but keep compilers from grumbling. */            /* Should never occur, but keep compilers from grumbling. */
1604    
1605            default:            default:
# Line 1775  for (;;) Line 1805  for (;;)
1805        if (clen > 0)        if (clen > 0)
1806          {          {
1807          BOOL OK;          BOOL OK;
1808            const pcre_uint32 *cp;
1809          const ucd_record * prop = GET_UCD(c);          const ucd_record * prop = GET_UCD(c);
1810          switch(code[1 + IMM2_SIZE + 1])          switch(code[1 + IMM2_SIZE + 1])
1811            {            {
# Line 1823  for (;;) Line 1854  for (;;)
1854                 c == CHAR_UNDERSCORE;                 c == CHAR_UNDERSCORE;
1855            break;            break;
1856    
1857              case PT_CLIST:
1858              cp = PRIV(ucd_caseless_sets) + prop->caseset;
1859              for (;;)
1860                {
1861                if (c < *cp) { OK = FALSE; break; }
1862                if (c == *cp++) { OK = TRUE; break; }
1863                }
1864              break;
1865    
1866            /* Should never occur, but keep compilers from grumbling. */            /* Should never occur, but keep compilers from grumbling. */
1867    
1868            default:            default:
# Line 2567  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 2701  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 2805  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 2887  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 2916  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 3035  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 3119  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 3205  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.1041  
changed lines
  Added in v.1055

  ViewVC Help
Powered by ViewVC 1.1.5