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

Diff of /code/trunk/pcre_newline.c

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

revision 1093 by chpe, Tue Oct 16 15:55:59 2012 UTC revision 1221 by ph10, Sun Nov 11 20:27:03 2012 UTC
# Line 60  http://unicode.org/unicode/reports/tr18/ Line 60  http://unicode.org/unicode/reports/tr18/
60  *************************************************/  *************************************************/
61    
62  /* It is guaranteed that the initial value of ptr is less than the end of the  /* It is guaranteed that the initial value of ptr is less than the end of the
63  string that is being processed.  string that is being processed.
64    
65  Arguments:  Arguments:
66    ptr          pointer to possible newline    ptr          pointer to possible newline
# Line 86  if (utf) Line 86  if (utf)
86  else  else
87  #endif  /* SUPPORT_UTF */  #endif  /* SUPPORT_UTF */
88    c = *ptr;    c = *ptr;
89    
90  /* Note that this function is called only for ANY or ANYCRLF. */  /* Note that this function is called only for ANY or ANYCRLF. */
91    
92  if (type == NLTYPE_ANYCRLF) switch(c)  if (type == NLTYPE_ANYCRLF) switch(c)
93    {    {
# Line 103  else switch(c) Line 103  else switch(c)
103    {    {
104  #ifdef EBCDIC  #ifdef EBCDIC
105    case CHAR_NEL:    case CHAR_NEL:
106  #endif  #endif
107    case CHAR_LF:    case CHAR_LF:
108    case CHAR_VT:    case CHAR_VT:
109    case CHAR_FF: *lenptr = 1; return TRUE;    case CHAR_FF: *lenptr = 1; return TRUE;
110    
111    case CHAR_CR:    case CHAR_CR:
112    *lenptr = (ptr < endptr - 1 && ptr[1] == CHAR_LF)? 2 : 1;    *lenptr = (ptr < endptr - 1 && ptr[1] == CHAR_LF)? 2 : 1;
113    return TRUE;    return TRUE;
114    
# Line 164  else Line 164  else
164  #endif  /* SUPPORT_UTF */  #endif  /* SUPPORT_UTF */
165    c = *ptr;    c = *ptr;
166    
167  /* Note that this function is called only for ANY or ANYCRLF. */  /* Note that this function is called only for ANY or ANYCRLF. */
168    
169  if (type == NLTYPE_ANYCRLF) switch(c)  if (type == NLTYPE_ANYCRLF) switch(c)
170    {    {
171    case CHAR_LF:    case CHAR_LF:
172    *lenptr = (ptr > startptr && ptr[-1] == CHAR_CR)? 2 : 1;    *lenptr = (ptr > startptr && ptr[-1] == CHAR_CR)? 2 : 1;
173    return TRUE;    return TRUE;
174    
175    case CHAR_CR: *lenptr = 1; return TRUE;    case CHAR_CR: *lenptr = 1; return TRUE;
176    default: return FALSE;    default: return FALSE;
177    }    }
# Line 180  if (type == NLTYPE_ANYCRLF) switch(c) Line 180  if (type == NLTYPE_ANYCRLF) switch(c)
180    
181  else switch(c)  else switch(c)
182    {    {
183    case CHAR_LF:    case CHAR_LF:
184    *lenptr = (ptr > startptr && ptr[-1] == CHAR_CR)? 2 : 1;    *lenptr = (ptr > startptr && ptr[-1] == CHAR_CR)? 2 : 1;
185    return TRUE;    return TRUE;
186    
187  #ifdef EBCDIC  #ifdef EBCDIC
188    case CHAR_NEL:    case CHAR_NEL:
189  #endif  #endif
190    case CHAR_VT:    case CHAR_VT:
191    case CHAR_FF:    case CHAR_FF:
192    case CHAR_CR: *lenptr = 1; return TRUE;    case CHAR_CR: *lenptr = 1; return TRUE;
193    
194  #ifndef EBCDIC  #ifndef EBCDIC
195  #ifdef COMPILE_PCRE8  #ifdef COMPILE_PCRE8
196    case CHAR_NEL: *lenptr = utf? 2 : 1; return TRUE;    case CHAR_NEL: *lenptr = utf? 2 : 1; return TRUE;
197    case 0x2028:                                       /* LS */    case 0x2028:                                       /* LS */

Legend:
Removed from v.1093  
changed lines
  Added in v.1221

  ViewVC Help
Powered by ViewVC 1.1.5