/[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 96 by nigel, Fri Mar 2 13:10:43 2007 UTC revision 117 by ph10, Fri Mar 9 15:59:06 2007 UTC
# Line 6  Line 6 
6  and semantics are as close as possible to those of the Perl 5 language.  and semantics are as close as possible to those of the Perl 5 language.
7    
8                         Written by Philip Hazel                         Written by Philip Hazel
9             Copyright (c) 1997-2006 University of Cambridge             Copyright (c) 1997-2007 University of Cambridge
10    
11  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
12  Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
# Line 299  typedef struct heapframe { Line 299  typedef struct heapframe {
299    int Xprop_category;    int Xprop_category;
300    int Xprop_chartype;    int Xprop_chartype;
301    int Xprop_script;    int Xprop_script;
302      int Xoclength;
303      uschar Xocchars[8];
304  #endif  #endif
305    
306    int Xctype;    int Xctype;
# Line 441  HEAP_RECURSE: Line 443  HEAP_RECURSE:
443  #define prop_category      frame->Xprop_category  #define prop_category      frame->Xprop_category
444  #define prop_chartype      frame->Xprop_chartype  #define prop_chartype      frame->Xprop_chartype
445  #define prop_script        frame->Xprop_script  #define prop_script        frame->Xprop_script
446    #define oclength           frame->Xoclength
447    #define occhars            frame->Xocchars
448  #endif  #endif
449    
450  #define ctype              frame->Xctype  #define ctype              frame->Xctype
# Line 494  int prop_fail_result; Line 498  int prop_fail_result;
498  int prop_category;  int prop_category;
499  int prop_chartype;  int prop_chartype;
500  int prop_script;  int prop_script;
501    int oclength;
502    uschar occhars[8];
503  #endif  #endif
504    
505  int ctype;  int ctype;
# Line 2045  for (;;) Line 2051  for (;;)
2051    
2052        if (length > 1)        if (length > 1)
2053          {          {
         int oclength = 0;  
         uschar occhars[8];  
   
2054  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
2055          unsigned int othercase;          unsigned int othercase;
2056          if ((ims & PCRE_CASELESS) != 0 &&          if ((ims & PCRE_CASELESS) != 0 &&
2057              (othercase = _pcre_ucp_othercase(fc)) != NOTACHAR)              (othercase = _pcre_ucp_othercase(fc)) != NOTACHAR)
2058            oclength = _pcre_ord2utf8(othercase, occhars);            oclength = _pcre_ord2utf8(othercase, occhars);
2059            else oclength = 0;
2060  #endif  /* SUPPORT_UCP */  #endif  /* SUPPORT_UCP */
2061    
2062          for (i = 1; i <= min; i++)          for (i = 1; i <= min; i++)
2063            {            {
2064            if (memcmp(eptr, charptr, length) == 0) eptr += length;            if (memcmp(eptr, charptr, length) == 0) eptr += length;
2065    #ifdef SUPPORT_UCP
2066            /* Need braces because of following else */            /* Need braces because of following else */
2067            else if (oclength == 0) { RRETURN(MATCH_NOMATCH); }            else if (oclength == 0) { RRETURN(MATCH_NOMATCH); }
2068            else            else
# Line 2065  for (;;) Line 2070  for (;;)
2070              if (memcmp(eptr, occhars, oclength) != 0) RRETURN(MATCH_NOMATCH);              if (memcmp(eptr, occhars, oclength) != 0) RRETURN(MATCH_NOMATCH);
2071              eptr += oclength;              eptr += oclength;
2072              }              }
2073    #else   /* without SUPPORT_UCP */
2074              else { RRETURN(MATCH_NOMATCH); }
2075    #endif  /* SUPPORT_UCP */
2076            }            }
2077    
2078          if (min == max) continue;          if (min == max) continue;
# Line 2077  for (;;) Line 2085  for (;;)
2085              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2086              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
2087              if (memcmp(eptr, charptr, length) == 0) eptr += length;              if (memcmp(eptr, charptr, length) == 0) eptr += length;
2088    #ifdef SUPPORT_UCP
2089              /* Need braces because of following else */              /* Need braces because of following else */
2090              else if (oclength == 0) { RRETURN(MATCH_NOMATCH); }              else if (oclength == 0) { RRETURN(MATCH_NOMATCH); }
2091              else              else
# Line 2084  for (;;) Line 2093  for (;;)
2093                if (memcmp(eptr, occhars, oclength) != 0) RRETURN(MATCH_NOMATCH);                if (memcmp(eptr, occhars, oclength) != 0) RRETURN(MATCH_NOMATCH);
2094                eptr += oclength;                eptr += oclength;
2095                }                }
2096    #else   /* without SUPPORT_UCP */
2097                else { RRETURN (MATCH_NOMATCH); }
2098    #endif  /* SUPPORT_UCP */
2099              }              }
2100            /* Control never gets here */            /* Control never gets here */
2101            }            }
# Line 2095  for (;;) Line 2107  for (;;)
2107              {              {
2108              if (eptr > md->end_subject - length) break;              if (eptr > md->end_subject - length) break;
2109              if (memcmp(eptr, charptr, length) == 0) eptr += length;              if (memcmp(eptr, charptr, length) == 0) eptr += length;
2110    #ifdef SUPPORT_UCP
2111              else if (oclength == 0) break;              else if (oclength == 0) break;
2112              else              else
2113                {                {
2114                if (memcmp(eptr, occhars, oclength) != 0) break;                if (memcmp(eptr, occhars, oclength) != 0) break;
2115                eptr += oclength;                eptr += oclength;
2116                }                }
2117    #else   /* without SUPPORT_UCP */
2118                else break;
2119    #endif  /* SUPPORT_UCP */
2120              }              }
2121    
2122            if (possessive) continue;            if (possessive) continue;
# Line 2108  for (;;) Line 2124  for (;;)
2124             {             {
2125             RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);             RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
2126             if (rrc != MATCH_NOMATCH) RRETURN(rrc);             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2127    #ifdef SUPPORT_UCP
2128               eptr--;
2129               BACKCHAR(eptr);
2130    #else   /* without SUPPORT_UCP */
2131             eptr -= length;             eptr -= length;
2132    #endif  /* SUPPORT_UCP */
2133             }             }
2134            RRETURN(MATCH_NOMATCH);            RRETURN(MATCH_NOMATCH);
2135            }            }
# Line 3802  md->eptrchain = eptrchain; Line 3823  md->eptrchain = eptrchain;
3823  md->lcc = tables + lcc_offset;  md->lcc = tables + lcc_offset;
3824  md->ctypes = tables + ctypes_offset;  md->ctypes = tables + ctypes_offset;
3825    
3826  /* Handle different types of newline. The two bits give four cases. If nothing  /* Handle different types of newline. The three bits give eight cases. If
3827  is set at run time, whatever was used at compile time applies. */  nothing is set at run time, whatever was used at compile time applies. */
3828    
3829  switch ((((options & PCRE_NEWLINE_BITS) == 0)? re->options : options) &  switch ((((options & PCRE_NEWLINE_BITS) == 0)? re->options : options) &
3830         PCRE_NEWLINE_BITS)         PCRE_NEWLINE_BITS)

Legend:
Removed from v.96  
changed lines
  Added in v.117

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12