67 |
type the newline type |
type the newline type |
68 |
endptr pointer to the end of the string |
endptr pointer to the end of the string |
69 |
lenptr where to return the length |
lenptr where to return the length |
70 |
utf8 TRUE if in utf8 mode |
utf TRUE if in utf mode |
71 |
|
|
72 |
Returns: TRUE or FALSE |
Returns: TRUE or FALSE |
73 |
*/ |
*/ |
74 |
|
|
75 |
BOOL |
BOOL |
76 |
PRIV(is_newline)(PCRE_PUCHAR ptr, int type, PCRE_PUCHAR endptr, int *lenptr, |
PRIV(is_newline)(PCRE_PUCHAR ptr, int type, PCRE_PUCHAR endptr, int *lenptr, |
77 |
BOOL utf8) |
BOOL utf) |
78 |
{ |
{ |
79 |
int c; |
int c; |
80 |
if (utf8) { GETCHAR(c, ptr); } else c = *ptr; |
if (utf) { GETCHAR(c, ptr); } else c = *ptr; |
81 |
|
|
82 |
if (type == NLTYPE_ANYCRLF) switch(c) |
if (type == NLTYPE_ANYCRLF) switch(c) |
83 |
{ |
{ |
96 |
case 0x000c: *lenptr = 1; return TRUE; /* FF */ |
case 0x000c: *lenptr = 1; return TRUE; /* FF */ |
97 |
case 0x000d: *lenptr = (ptr < endptr - 1 && ptr[1] == 0x0a)? 2 : 1; |
case 0x000d: *lenptr = (ptr < endptr - 1 && ptr[1] == 0x0a)? 2 : 1; |
98 |
return TRUE; /* CR */ |
return TRUE; /* CR */ |
99 |
case 0x0085: *lenptr = utf8? 2 : 1; return TRUE; /* NEL */ |
case 0x0085: *lenptr = utf? 2 : 1; return TRUE; /* NEL */ |
100 |
case 0x2028: /* LS */ |
case 0x2028: /* LS */ |
101 |
case 0x2029: *lenptr = 3; return TRUE; /* PS */ |
case 0x2029: *lenptr = 3; return TRUE; /* PS */ |
102 |
default: return FALSE; |
default: return FALSE; |
117 |
type the newline type |
type the newline type |
118 |
startptr pointer to the start of the string |
startptr pointer to the start of the string |
119 |
lenptr where to return the length |
lenptr where to return the length |
120 |
utf8 TRUE if in utf8 mode |
utf TRUE if in utf mode |
121 |
|
|
122 |
Returns: TRUE or FALSE |
Returns: TRUE or FALSE |
123 |
*/ |
*/ |
124 |
|
|
125 |
BOOL |
BOOL |
126 |
PRIV(was_newline)(PCRE_PUCHAR ptr, int type, PCRE_PUCHAR startptr, int *lenptr, |
PRIV(was_newline)(PCRE_PUCHAR ptr, int type, PCRE_PUCHAR startptr, int *lenptr, |
127 |
BOOL utf8) |
BOOL utf) |
128 |
{ |
{ |
129 |
int c; |
int c; |
130 |
ptr--; |
ptr--; |
131 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
132 |
if (utf8) |
if (utf) |
133 |
{ |
{ |
134 |
BACKCHAR(ptr); |
BACKCHAR(ptr); |
135 |
GETCHAR(c, ptr); |
GETCHAR(c, ptr); |
154 |
case 0x000b: /* VT */ |
case 0x000b: /* VT */ |
155 |
case 0x000c: /* FF */ |
case 0x000c: /* FF */ |
156 |
case 0x000d: *lenptr = 1; return TRUE; /* CR */ |
case 0x000d: *lenptr = 1; return TRUE; /* CR */ |
157 |
case 0x0085: *lenptr = utf8? 2 : 1; return TRUE; /* NEL */ |
case 0x0085: *lenptr = utf? 2 : 1; return TRUE; /* NEL */ |
158 |
case 0x2028: /* LS */ |
case 0x2028: /* LS */ |
159 |
case 0x2029: *lenptr = 3; return TRUE; /* PS */ |
case 0x2029: *lenptr = 3; return TRUE; /* PS */ |
160 |
default: return FALSE; |
default: return FALSE; |