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

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

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

revision 794 by zherczeg, Thu Dec 8 07:36:41 2011 UTC revision 795 by zherczeg, Sat Dec 10 02:20:06 2011 UTC
# Line 413  const pcre_uchar *start_subject = md->st Line 413  const pcre_uchar *start_subject = md->st
413  const pcre_uchar *end_subject = md->end_subject;  const pcre_uchar *end_subject = md->end_subject;
414  const pcre_uchar *start_code = md->start_code;  const pcre_uchar *start_code = md->start_code;
415    
416  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
417  BOOL utf = (md->poptions & PCRE_UTF8) != 0;  BOOL utf = (md->poptions & PCRE_UTF8) != 0;
418  #else  #else
419  BOOL utf = FALSE;  BOOL utf = FALSE;
# Line 471  if (*first_op == OP_REVERSE) Line 471  if (*first_op == OP_REVERSE)
471    /* If we can't go back the amount required for the longest lookbehind    /* If we can't go back the amount required for the longest lookbehind
472    pattern, go back as far as we can; some alternatives may still be viable. */    pattern, go back as far as we can; some alternatives may still be viable. */
473    
474  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
475    /* In character mode we have to step back character by character */    /* In character mode we have to step back character by character */
476    
477    if (utf)    if (utf)
# Line 603  for (;;) Line 603  for (;;)
603    if (ptr < end_subject)    if (ptr < end_subject)
604      {      {
605      clen = 1;        /* Number of bytes in the character */      clen = 1;        /* Number of bytes in the character */
606  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
607      if (utf) { GETCHARLEN(c, ptr, clen); } else      if (utf) { GETCHARLEN(c, ptr, clen); } else
608  #endif  /* SUPPORT_UTF8 */  #endif  /* SUPPORT_UTF */
609      c = *ptr;      c = *ptr;
610      }      }
611    else    else
# Line 692  for (;;) Line 692  for (;;)
692      if (coptable[codevalue] > 0)      if (coptable[codevalue] > 0)
693        {        {
694        dlen = 1;        dlen = 1;
695  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
696        if (utf) { GETCHARLEN(d, (code + coptable[codevalue]), dlen); } else        if (utf) { GETCHARLEN(d, (code + coptable[codevalue]), dlen); } else
697  #endif  /* SUPPORT_UTF8 */  #endif  /* SUPPORT_UTF */
698        d = code[coptable[codevalue]];        d = code[coptable[codevalue]];
699        if (codevalue >= OP_TYPESTAR)        if (codevalue >= OP_TYPESTAR)
700          {          {
# Line 957  for (;;) Line 957  for (;;)
957            {            {
958            const pcre_uchar *temp = ptr - 1;            const pcre_uchar *temp = ptr - 1;
959            if (temp < md->start_used_ptr) md->start_used_ptr = temp;            if (temp < md->start_used_ptr) md->start_used_ptr = temp;
960  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
961            if (utf) BACKCHAR(temp);            if (utf) { BACKCHAR(temp); }
962  #endif  #endif
963            GETCHARTEST(d, temp);            GETCHARTEST(d, temp);
964  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
# Line 1983  for (;;) Line 1983  for (;;)
1983        case OP_CHARI:        case OP_CHARI:
1984        if (clen == 0) break;        if (clen == 0) break;
1985    
1986  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
1987        if (utf)        if (utf)
1988          {          {
1989          if (c == d) { ADD_NEW(state_offset + dlen + 1, 0); } else          if (c == d) { ADD_NEW(state_offset + dlen + 1, 0); } else
1990            {            {
1991            unsigned int othercase;            unsigned int othercase;
1992            if (c < 128) othercase = fcc[c]; else            if (c < 128)
1993                othercase = fcc[c];
1994            /* If we have Unicode property support, we can use it to test the            else
1995            other case of the character. */              /* If we have Unicode property support, we can use it to test the
1996                other case of the character. */
1997  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
1998            othercase = UCD_OTHERCASE(c);              othercase = UCD_OTHERCASE(c);
1999  #else  #else
2000            othercase = NOTACHAR;              othercase = NOTACHAR;
2001  #endif  #endif
2002    
2003            if (d == othercase) { ADD_NEW(state_offset + dlen + 1, 0); }            if (d == othercase) { ADD_NEW(state_offset + dlen + 1, 0); }
2004            }            }
2005          }          }
2006        else        else
2007  #endif  /* SUPPORT_UTF8 */  #endif  /* SUPPORT_UTF */
2008        /* Not UTF mode */        /* Not UTF mode */
2009          {          {
2010          if (lcc[c] == lcc[d]) { ADD_NEW(state_offset + 2, 0); }          if (lcc[c] == lcc[d]) { ADD_NEW(state_offset + 2, 0); }
# Line 2207  for (;;) Line 2207  for (;;)
2207          unsigned int otherd = NOTACHAR;          unsigned int otherd = NOTACHAR;
2208          if (caseless)          if (caseless)
2209            {            {
2210  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
2211            if (utf && d >= 128)            if (utf && d >= 128)
2212              {              {
2213  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
# Line 2215  for (;;) Line 2215  for (;;)
2215  #endif  /* SUPPORT_UCP */  #endif  /* SUPPORT_UCP */
2216              }              }
2217            else            else
2218  #endif  /* SUPPORT_UTF8 */  #endif  /* SUPPORT_UTF */
2219            otherd = fcc[d];            otherd = fcc[d];
2220            }            }
2221          if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))          if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
# Line 2254  for (;;) Line 2254  for (;;)
2254          unsigned int otherd = NOTACHAR;          unsigned int otherd = NOTACHAR;
2255          if (caseless)          if (caseless)
2256            {            {
2257  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
2258            if (utf && d >= 128)            if (utf && d >= 128)
2259              {              {
2260  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
# Line 2262  for (;;) Line 2262  for (;;)
2262  #endif  /* SUPPORT_UCP */  #endif  /* SUPPORT_UCP */
2263              }              }
2264            else            else
2265  #endif  /* SUPPORT_UTF8 */  #endif  /* SUPPORT_UTF */
2266            otherd = fcc[d];            otherd = fcc[d];
2267            }            }
2268          if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))          if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
# Line 2299  for (;;) Line 2299  for (;;)
2299          unsigned int otherd = NOTACHAR;          unsigned int otherd = NOTACHAR;
2300          if (caseless)          if (caseless)
2301            {            {
2302  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
2303            if (utf && d >= 128)            if (utf && d >= 128)
2304              {              {
2305  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
# Line 2307  for (;;) Line 2307  for (;;)
2307  #endif  /* SUPPORT_UCP */  #endif  /* SUPPORT_UCP */
2308              }              }
2309            else            else
2310  #endif  /* SUPPORT_UTF8 */  #endif  /* SUPPORT_UTF */
2311            otherd = fcc[d];            otherd = fcc[d];
2312            }            }
2313          if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))          if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
# Line 2336  for (;;) Line 2336  for (;;)
2336          unsigned int otherd = NOTACHAR;          unsigned int otherd = NOTACHAR;
2337          if (caseless)          if (caseless)
2338            {            {
2339  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
2340            if (utf && d >= 128)            if (utf && d >= 128)
2341              {              {
2342  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
# Line 2344  for (;;) Line 2344  for (;;)
2344  #endif  /* SUPPORT_UCP */  #endif  /* SUPPORT_UCP */
2345              }              }
2346            else            else
2347  #endif  /* SUPPORT_UTF8 */  #endif  /* SUPPORT_UTF */
2348            otherd = fcc[d];            otherd = fcc[d];
2349            }            }
2350          if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))          if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
# Line 2380  for (;;) Line 2380  for (;;)
2380          unsigned int otherd = NOTACHAR;          unsigned int otherd = NOTACHAR;
2381          if (caseless)          if (caseless)
2382            {            {
2383  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
2384            if (utf && d >= 128)            if (utf && d >= 128)
2385              {              {
2386  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
# Line 2388  for (;;) Line 2388  for (;;)
2388  #endif  /* SUPPORT_UCP */  #endif  /* SUPPORT_UCP */
2389              }              }
2390            else            else
2391  #endif  /* SUPPORT_UTF8 */  #endif  /* SUPPORT_UTF */
2392            otherd = fcc[d];            otherd = fcc[d];
2393            }            }
2394          if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))          if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
# Line 2438  for (;;) Line 2438  for (;;)
2438          else          else
2439           {           {
2440           ecode = code + GET(code, 1);           ecode = code + GET(code, 1);
2441           if (clen > 0) isinclass = PRIV(xclass)(c, code + 1 + LINK_SIZE);           if (clen > 0) isinclass = PRIV(xclass)(c, code + 1 + LINK_SIZE, utf);
2442           }           }
2443    
2444          /* At this point, isinclass is set for all kinds of class, and ecode          /* At this point, isinclass is set for all kinds of class, and ecode
# Line 2994  Returns: > 0 => number of match Line 2994  Returns: > 0 => number of match
2994                   < -1 => some kind of unexpected problem                   < -1 => some kind of unexpected problem
2995  */  */
2996    
2997    #ifdef COMPILE_PCRE8
2998  PCRE_EXP_DEFN int PCRE_CALL_CONVENTION  PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
2999  pcre_dfa_exec(const pcre *argument_re, const pcre_extra *extra_data,  pcre_dfa_exec(const pcre *argument_re, const pcre_extra *extra_data,
3000    const char *subject, int length, int start_offset, int options, int *offsets,    const char *subject, int length, int start_offset, int options, int *offsets,
3001    int offsetcount, int *workspace, int wscount)    int offsetcount, int *workspace, int wscount)
3002    #else
3003    PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
3004    pcre16_dfa_exec(const pcre *argument_re, const pcre_extra *extra_data,
3005      PCRE_SPTR16 subject, int length, int start_offset, int options, int *offsets,
3006      int offsetcount, int *workspace, int wscount)
3007    #endif
3008  {  {
3009  real_pcre *re = (real_pcre *)argument_re;  real_pcre *re = (real_pcre *)argument_re;
3010  dfa_match_data match_block;  dfa_match_data match_block;
# Line 3062  if (re->magic_number != MAGIC_NUMBER) Line 3069  if (re->magic_number != MAGIC_NUMBER)
3069    if (re == NULL) return PCRE_ERROR_BADMAGIC;    if (re == NULL) return PCRE_ERROR_BADMAGIC;
3070    if (study != NULL) study = &internal_study;    if (study != NULL) study = &internal_study;
3071    }    }
3072    if ((re->flags & PCRE_MODE) == 0) return PCRE_ERROR_BADMODE;
3073    
3074  /* Set some local values */  /* Set some local values */
3075    
3076  current_subject = (const unsigned char *)subject + start_offset;  current_subject = (const pcre_uchar *)subject + start_offset;
3077  end_subject = (const unsigned char *)subject + length;  end_subject = (const pcre_uchar *)subject + length;
3078  req_char_ptr = current_subject - 1;  req_char_ptr = current_subject - 1;
3079    
3080  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
3081  /* PCRE_UTF16 has the same value as PCRE_UTF8. */  /* PCRE_UTF16 has the same value as PCRE_UTF8. */
3082  utf = (re->options & PCRE_UTF8) != 0;  utf = (re->options & PCRE_UTF8) != 0;
3083  #else  #else
# Line 3083  anchored = (options & (PCRE_ANCHORED|PCR Line 3091  anchored = (options & (PCRE_ANCHORED|PCR
3091    
3092  md->start_code = (const pcre_uchar *)argument_re +  md->start_code = (const pcre_uchar *)argument_re +
3093      re->name_table_offset + re->name_count * re->name_entry_size;      re->name_table_offset + re->name_count * re->name_entry_size;
3094  md->start_subject = (const unsigned char *)subject;  md->start_subject = (const pcre_uchar *)subject;
3095  md->end_subject = end_subject;  md->end_subject = end_subject;
3096  md->start_offset = start_offset;  md->start_offset = start_offset;
3097  md->moptions = options;  md->moptions = options;

Legend:
Removed from v.794  
changed lines
  Added in v.795

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12