Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 956 lines (842 sloc) 29.824 kB
5770336 Initial revision
ksaito authored
1 /**********************************************************************
0424e15 @nurse * Merge Onigmo-5.13.1. [ruby-dev:45057] [Feature #5820]
nurse authored
2 regenc.c - Onigmo (Oniguruma-mod) (regular expression library)
5770336 Initial revision
ksaito authored
3 **********************************************************************/
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
4 /*-
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
5 * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
0424e15 @nurse * Merge Onigmo-5.13.1. [ruby-dev:45057] [Feature #5820]
nurse authored
6 * Copyright (c) 2011 K.Takata <kentkt AT csc DOT jp>
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
7d765e5 This commit was generated by cvs2svn to compensate for changes in r7843,
ksaito authored
31 #include "regint.h"
5770336 Initial revision
ksaito authored
32
33 OnigEncoding OnigEncDefaultCharEncoding = ONIG_ENCODING_INIT_DEFAULT;
34
35 extern int
33163ad * regparse.c, etc.: K&R to ANSI code cleanup patch from Stefan
matz authored
36 onigenc_init(void)
5770336 Initial revision
ksaito authored
37 {
38 return 0;
39 }
40
41 extern OnigEncoding
33163ad * regparse.c, etc.: K&R to ANSI code cleanup patch from Stefan
matz authored
42 onigenc_get_default_encoding(void)
5770336 Initial revision
ksaito authored
43 {
44 return OnigEncDefaultCharEncoding;
45 }
46
47 extern int
48 onigenc_set_default_encoding(OnigEncoding enc)
49 {
50 OnigEncDefaultCharEncoding = enc;
51 return 0;
52 }
53
fc208c1 @akr * include/ruby/oniguruma.h: precise mbclen API redesigned to avoid
akr authored
54 extern int
55 onigenc_mbclen_approximate(const OnigUChar* p,const OnigUChar* e, struct OnigEncodingTypeST* enc)
56 {
57 int ret = ONIGENC_PRECISE_MBC_ENC_LEN(enc,p,e);
58 if (ONIGENC_MBCLEN_CHARFOUND_P(ret))
59 return ONIGENC_MBCLEN_CHARFOUND_LEN(ret);
60 else if (ONIGENC_MBCLEN_NEEDMORE_P(ret))
23a32d6 @nobu * include/ruby/oniguruma.h, include/ruby/re.h, re.c, regcomp.c,
nobu authored
61 return (int)(e-p)+ONIGENC_MBCLEN_NEEDMORE_LEN(ret);
fc208c1 @akr * include/ruby/oniguruma.h: precise mbclen API redesigned to avoid
akr authored
62 return 1;
63 }
64
5770336 Initial revision
ksaito authored
65 extern UChar*
c965010 @akr * include/ruby/oniguruma.h (onigenc_get_right_adjust_char_head): add
akr authored
66 onigenc_get_right_adjust_char_head(OnigEncoding enc, const UChar* start, const UChar* s, const UChar* end)
5770336 Initial revision
ksaito authored
67 {
1941660 @akr * include/ruby/oniguruma.h (OnigEncodingTypeST): add end argument for
akr authored
68 UChar* p = ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s, end);
5770336 Initial revision
ksaito authored
69 if (p < s) {
0424e15 @nurse * Merge Onigmo-5.13.1. [ruby-dev:45057] [Feature #5820]
nurse authored
70 p += enclen(enc, p, end);
5770336 Initial revision
ksaito authored
71 }
72 return p;
73 }
74
75 extern UChar*
76 onigenc_get_right_adjust_char_head_with_prev(OnigEncoding enc,
d397457 @akr * include/ruby/oniguruma.h
akr authored
77 const UChar* start, const UChar* s, const UChar* end, const UChar** prev)
5770336 Initial revision
ksaito authored
78 {
1941660 @akr * include/ruby/oniguruma.h (OnigEncodingTypeST): add end argument for
akr authored
79 UChar* p = ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s, end);
5770336 Initial revision
ksaito authored
80
81 if (p < s) {
f052429 This commit was generated by cvs2svn to compensate for changes in r8021,
ksaito authored
82 if (prev) *prev = (const UChar* )p;
d397457 @akr * include/ruby/oniguruma.h
akr authored
83 p += enclen(enc, p, end);
5770336 Initial revision
ksaito authored
84 }
85 else {
f052429 This commit was generated by cvs2svn to compensate for changes in r8021,
ksaito authored
86 if (prev) *prev = (const UChar* )NULL; /* Sorry */
5770336 Initial revision
ksaito authored
87 }
88 return p;
89 }
90
91 extern UChar*
a953d28 @akr * include/ruby/oniguruma.h (onigenc_get_prev_char_head): add end
akr authored
92 onigenc_get_prev_char_head(OnigEncoding enc, const UChar* start, const UChar* s, const UChar* end)
5770336 Initial revision
ksaito authored
93 {
94 if (s <= start)
95 return (UChar* )NULL;
96
1941660 @akr * include/ruby/oniguruma.h (OnigEncodingTypeST): add end argument for
akr authored
97 return ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s - 1, end);
5770336 Initial revision
ksaito authored
98 }
99
100 extern UChar*
10ff0f2 @akr * include/ruby/oniguruma.h (ONIGENC_STEP_BACK): add end argument.
akr authored
101 onigenc_step_back(OnigEncoding enc, const UChar* start, const UChar* s, const UChar* end, int n)
5770336 Initial revision
ksaito authored
102 {
103 while (ONIG_IS_NOT_NULL(s) && n-- > 0) {
104 if (s <= start)
105 return (UChar* )NULL;
106
1941660 @akr * include/ruby/oniguruma.h (OnigEncodingTypeST): add end argument for
akr authored
107 s = ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s - 1, end);
5770336 Initial revision
ksaito authored
108 }
f052429 This commit was generated by cvs2svn to compensate for changes in r8021,
ksaito authored
109 return (UChar* )s;
5770336 Initial revision
ksaito authored
110 }
111
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
112 extern UChar*
f052429 This commit was generated by cvs2svn to compensate for changes in r8021,
ksaito authored
113 onigenc_step(OnigEncoding enc, const UChar* p, const UChar* end, int n)
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
114 {
f052429 This commit was generated by cvs2svn to compensate for changes in r8021,
ksaito authored
115 UChar* q = (UChar* )p;
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
116 while (n-- > 0) {
edd7c78 * array.c (rb_ary_cycle): typo in rdoc. a patch from Yugui
matz authored
117 q += ONIGENC_MBC_ENC_LEN(enc, q, end);
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
118 }
f052429 This commit was generated by cvs2svn to compensate for changes in r8021,
ksaito authored
119 return (q <= end ? q : NULL);
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
120 }
121
122 extern int
f052429 This commit was generated by cvs2svn to compensate for changes in r8021,
ksaito authored
123 onigenc_strlen(OnigEncoding enc, const UChar* p, const UChar* end)
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
124 {
125 int n = 0;
f052429 This commit was generated by cvs2svn to compensate for changes in r8021,
ksaito authored
126 UChar* q = (UChar* )p;
12d2c8b @nobu stripped trailing spaces.
nobu authored
127
f052429 This commit was generated by cvs2svn to compensate for changes in r8021,
ksaito authored
128 while (q < end) {
edd7c78 * array.c (rb_ary_cycle): typo in rdoc. a patch from Yugui
matz authored
129 q += ONIGENC_MBC_ENC_LEN(enc, q, end);
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
130 n++;
131 }
132 return n;
133 }
134
135 extern int
f052429 This commit was generated by cvs2svn to compensate for changes in r8021,
ksaito authored
136 onigenc_strlen_null(OnigEncoding enc, const UChar* s)
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
137 {
138 int n = 0;
f052429 This commit was generated by cvs2svn to compensate for changes in r8021,
ksaito authored
139 UChar* p = (UChar* )s;
3711c63 @nobu * regenc.c (onigenc_strlen_null, onigenc_str_bytelen_null): fixed
nobu authored
140 UChar* e;
12d2c8b @nobu stripped trailing spaces.
nobu authored
141
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
142 while (1) {
143 if (*p == '\0') {
144 UChar* q;
145 int len = ONIGENC_MBC_MINLEN(enc);
146
147 if (len == 1) return n;
148 q = p + 1;
149 while (len > 1) {
150 if (*q != '\0') break;
151 q++;
152 len--;
153 }
154 if (len == 1) return n;
155 }
3711c63 @nobu * regenc.c (onigenc_strlen_null, onigenc_str_bytelen_null): fixed
nobu authored
156 e = p + ONIGENC_MBC_MAXLEN(enc);
edd7c78 * array.c (rb_ary_cycle): typo in rdoc. a patch from Yugui
matz authored
157 p += ONIGENC_MBC_ENC_LEN(enc, p, e);
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
158 n++;
159 }
160 }
161
162 extern int
f052429 This commit was generated by cvs2svn to compensate for changes in r8021,
ksaito authored
163 onigenc_str_bytelen_null(OnigEncoding enc, const UChar* s)
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
164 {
f052429 This commit was generated by cvs2svn to compensate for changes in r8021,
ksaito authored
165 UChar* start = (UChar* )s;
166 UChar* p = (UChar* )s;
3711c63 @nobu * regenc.c (onigenc_strlen_null, onigenc_str_bytelen_null): fixed
nobu authored
167 UChar* e;
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
168
169 while (1) {
170 if (*p == '\0') {
171 UChar* q;
172 int len = ONIGENC_MBC_MINLEN(enc);
173
174 if (len == 1) return (int )(p - start);
175 q = p + 1;
176 while (len > 1) {
177 if (*q != '\0') break;
178 q++;
179 len--;
180 }
181 if (len == 1) return (int )(p - start);
182 }
3711c63 @nobu * regenc.c (onigenc_strlen_null, onigenc_str_bytelen_null): fixed
nobu authored
183 e = p + ONIGENC_MBC_MAXLEN(enc);
edd7c78 * array.c (rb_ary_cycle): typo in rdoc. a patch from Yugui
matz authored
184 p += ONIGENC_MBC_ENC_LEN(enc, p, e);
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
185 }
186 }
5770336 Initial revision
ksaito authored
187
e1def8a * include/ruby/oniguruma.h: upgrade to Oniguruma 5.9.0. fixes
matz authored
188 const UChar OnigEncAsciiToLowerCaseTable[] = {
5770336 Initial revision
ksaito authored
189 '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
190 '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
191 '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
192 '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
193 '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
194 '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
195 '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
196 '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
197 '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
198 '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
199 '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
200 '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
201 '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
202 '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
203 '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
204 '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
205 '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
206 '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
207 '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
208 '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
209 '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
210 '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
211 '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
212 '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
213 '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307',
214 '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317',
215 '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
216 '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337',
217 '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
218 '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
219 '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
220 '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377',
221 };
222
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
223 #ifdef USE_UPPER_CASE_TABLE
086e235 * oniguruma.h: merge Oniguruma 4.0.0 [ruby-dev:28290]
matz authored
224 const UChar OnigEncAsciiToUpperCaseTable[256] = {
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
225 '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
226 '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
227 '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
228 '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
229 '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
230 '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
231 '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
232 '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
233 '\100', '\101', '\102', '\103', '\104', '\105', '\106', '\107',
234 '\110', '\111', '\112', '\113', '\114', '\115', '\116', '\117',
235 '\120', '\121', '\122', '\123', '\124', '\125', '\126', '\127',
236 '\130', '\131', '\132', '\133', '\134', '\135', '\136', '\137',
237 '\140', '\101', '\102', '\103', '\104', '\105', '\106', '\107',
238 '\110', '\111', '\112', '\113', '\114', '\115', '\116', '\117',
239 '\120', '\121', '\122', '\123', '\124', '\125', '\126', '\127',
240 '\130', '\131', '\132', '\173', '\174', '\175', '\176', '\177',
241 '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
242 '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
243 '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
244 '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
245 '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
246 '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
247 '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
248 '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
249 '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307',
250 '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317',
251 '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
252 '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337',
253 '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
254 '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
255 '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
256 '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377',
257 };
258 #endif
259
086e235 * oniguruma.h: merge Oniguruma 4.0.0 [ruby-dev:28290]
matz authored
260 const unsigned short OnigEncAsciiCtypeTable[256] = {
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
261 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
262 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008,
263 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
264 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
265 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
266 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
267 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0,
268 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
269 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2,
270 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
271 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
272 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0,
273 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2,
274 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
275 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
276 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008,
5770336 Initial revision
ksaito authored
277 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
278 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
279 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
280 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
281 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
282 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
283 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
284 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
285 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
286 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
287 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
288 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
289 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
290 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
291 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
292 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
293 };
294
086e235 * oniguruma.h: merge Oniguruma 4.0.0 [ruby-dev:28290]
matz authored
295 const UChar OnigEncISO_8859_1_ToLowerCaseTable[256] = {
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
296 '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
297 '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
298 '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
299 '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
300 '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
301 '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
302 '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
303 '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
304 '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
305 '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
306 '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
307 '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
308 '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
309 '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
310 '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
311 '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
312 '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
313 '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
314 '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
315 '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
316 '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
317 '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
318 '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
319 '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
320 '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
321 '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
322 '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\327',
323 '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337',
324 '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
325 '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
326 '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
327 '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377'
328 };
329
330 #ifdef USE_UPPER_CASE_TABLE
086e235 * oniguruma.h: merge Oniguruma 4.0.0 [ruby-dev:28290]
matz authored
331 const UChar OnigEncISO_8859_1_ToUpperCaseTable[256] = {
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
332 '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
333 '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
334 '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
335 '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
336 '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
337 '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
338 '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
339 '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
340 '\100', '\101', '\102', '\103', '\104', '\105', '\106', '\107',
341 '\110', '\111', '\112', '\113', '\114', '\115', '\116', '\117',
342 '\120', '\121', '\122', '\123', '\124', '\125', '\126', '\127',
343 '\130', '\131', '\132', '\133', '\134', '\135', '\136', '\137',
344 '\140', '\101', '\102', '\103', '\104', '\105', '\106', '\107',
345 '\110', '\111', '\112', '\113', '\114', '\115', '\116', '\117',
346 '\120', '\121', '\122', '\123', '\124', '\125', '\126', '\127',
347 '\130', '\131', '\132', '\173', '\174', '\175', '\176', '\177',
348 '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
349 '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
350 '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
351 '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
352 '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
353 '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
354 '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
355 '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
356 '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307',
357 '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317',
358 '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
359 '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337',
360 '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307',
361 '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317',
362 '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\367',
363 '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\377',
364 };
365 #endif
366
5770336 Initial revision
ksaito authored
367 extern void
52ed8c4 * include/ruby/oniguruma.h: Oniguruma 1.9.1 merged.
matz authored
368 onigenc_set_default_caseconv_table(const UChar* table ARG_UNUSED)
5770336 Initial revision
ksaito authored
369 {
e1def8a * include/ruby/oniguruma.h: upgrade to Oniguruma 5.9.0. fixes
matz authored
370 /* nothing */
371 /* obsoleted. */
5770336 Initial revision
ksaito authored
372 }
373
374 extern UChar*
1941660 @akr * include/ruby/oniguruma.h (OnigEncodingTypeST): add end argument for
akr authored
375 onigenc_get_left_adjust_char_head(OnigEncoding enc, const UChar* start, const UChar* s, const UChar* end)
5770336 Initial revision
ksaito authored
376 {
1941660 @akr * include/ruby/oniguruma.h (OnigEncodingTypeST): add end argument for
akr authored
377 return ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s, end);
5770336 Initial revision
ksaito authored
378 }
379
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
380 const OnigPairCaseFoldCodes OnigAsciiLowerMap[] = {
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
381 { 0x41, 0x61 },
382 { 0x42, 0x62 },
383 { 0x43, 0x63 },
384 { 0x44, 0x64 },
385 { 0x45, 0x65 },
386 { 0x46, 0x66 },
387 { 0x47, 0x67 },
388 { 0x48, 0x68 },
389 { 0x49, 0x69 },
390 { 0x4a, 0x6a },
391 { 0x4b, 0x6b },
392 { 0x4c, 0x6c },
393 { 0x4d, 0x6d },
394 { 0x4e, 0x6e },
395 { 0x4f, 0x6f },
396 { 0x50, 0x70 },
397 { 0x51, 0x71 },
398 { 0x52, 0x72 },
399 { 0x53, 0x73 },
400 { 0x54, 0x74 },
401 { 0x55, 0x75 },
402 { 0x56, 0x76 },
403 { 0x57, 0x77 },
404 { 0x58, 0x78 },
405 { 0x59, 0x79 },
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
406 { 0x5a, 0x7a }
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
407 };
408
409 extern int
52ed8c4 * include/ruby/oniguruma.h: Oniguruma 1.9.1 merged.
matz authored
410 onigenc_ascii_apply_all_case_fold(OnigCaseFoldType flag ARG_UNUSED,
5fc7312 * include/ruby/oniguruma.h (OnigEncodingTypeST): add OnigEncoding
matz authored
411 OnigApplyAllCaseFoldFunc f, void* arg,
6e1c3a0 @nurse * enc/koi8_u.c: added.
nurse authored
412 OnigEncoding enc ARG_UNUSED)
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
413 {
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
414 OnigCodePoint code;
415 int i, r;
416
52ed8c4 * include/ruby/oniguruma.h: Oniguruma 1.9.1 merged.
matz authored
417 for (i = 0;
418 i < (int )(sizeof(OnigAsciiLowerMap)/sizeof(OnigPairCaseFoldCodes));
419 i++) {
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
420 code = OnigAsciiLowerMap[i].to;
421 r = (*f)(OnigAsciiLowerMap[i].from, &code, 1, arg);
422 if (r != 0) return r;
423
424 code = OnigAsciiLowerMap[i].from;
425 r = (*f)(OnigAsciiLowerMap[i].to, &code, 1, arg);
426 if (r != 0) return r;
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
427 }
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
428
429 return 0;
430 }
431
432 extern int
6e1c3a0 @nurse * enc/koi8_u.c: added.
nurse authored
433 onigenc_ascii_get_case_fold_codes_by_str(OnigCaseFoldType flag ARG_UNUSED,
434 const OnigUChar* p, const OnigUChar* end ARG_UNUSED, OnigCaseFoldCodeItem items[],
435 OnigEncoding enc ARG_UNUSED)
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
436 {
437 if (0x41 <= *p && *p <= 0x5a) {
438 items[0].byte_len = 1;
439 items[0].code_len = 1;
440 items[0].code[0] = (OnigCodePoint )(*p + 0x20);
441 return 1;
442 }
443 else if (0x61 <= *p && *p <= 0x7a) {
444 items[0].byte_len = 1;
445 items[0].code_len = 1;
446 items[0].code[0] = (OnigCodePoint )(*p - 0x20);
447 return 1;
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
448 }
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
449 else
450 return 0;
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
451 }
452
52ed8c4 * include/ruby/oniguruma.h: Oniguruma 1.9.1 merged.
matz authored
453 static int
454 ss_apply_all_case_fold(OnigCaseFoldType flag ARG_UNUSED,
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
455 OnigApplyAllCaseFoldFunc f, void* arg)
5770336 Initial revision
ksaito authored
456 {
4f57266 @nobu * regexec.c (stack_double): use MatchStackLimitSize atomically.
nobu authored
457 OnigCodePoint ss[] = { 0x73, 0x73 };
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
458
459 return (*f)((OnigCodePoint )0xdf, ss, 2, arg);
5770336 Initial revision
ksaito authored
460 }
461
462 extern int
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
463 onigenc_apply_all_case_fold_with_map(int map_size,
464 const OnigPairCaseFoldCodes map[],
465 int ess_tsett_flag, OnigCaseFoldType flag,
466 OnigApplyAllCaseFoldFunc f, void* arg)
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
467 {
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
468 OnigCodePoint code;
469 int i, r;
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
470
5fc7312 * include/ruby/oniguruma.h (OnigEncodingTypeST): add OnigEncoding
matz authored
471 r = onigenc_ascii_apply_all_case_fold(flag, f, arg, 0);
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
472 if (r != 0) return r;
473
474 for (i = 0; i < map_size; i++) {
475 code = map[i].to;
476 r = (*f)(map[i].from, &code, 1, arg);
477 if (r != 0) return r;
478
479 code = map[i].from;
480 r = (*f)(map[i].to, &code, 1, arg);
481 if (r != 0) return r;
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
482 }
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
483
484 if (ess_tsett_flag != 0)
485 return ss_apply_all_case_fold(flag, f, arg);
486
487 return 0;
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
488 }
489
490 extern int
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
491 onigenc_get_case_fold_codes_by_str_with_map(int map_size,
492 const OnigPairCaseFoldCodes map[],
52ed8c4 * include/ruby/oniguruma.h: Oniguruma 1.9.1 merged.
matz authored
493 int ess_tsett_flag, OnigCaseFoldType flag ARG_UNUSED,
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
494 const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
5770336 Initial revision
ksaito authored
495 {
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
496 if (0x41 <= *p && *p <= 0x5a) {
497 items[0].byte_len = 1;
498 items[0].code_len = 1;
499 items[0].code[0] = (OnigCodePoint )(*p + 0x20);
500 if (*p == 0x53 && ess_tsett_flag != 0 && end > p + 1
501 && (*(p+1) == 0x53 || *(p+1) == 0x73)) {
502 /* SS */
503 items[1].byte_len = 2;
504 items[1].code_len = 1;
505 items[1].code[0] = (OnigCodePoint )0xdf;
506 return 2;
507 }
508 else
509 return 1;
510 }
511 else if (0x61 <= *p && *p <= 0x7a) {
512 items[0].byte_len = 1;
513 items[0].code_len = 1;
514 items[0].code[0] = (OnigCodePoint )(*p - 0x20);
515 if (*p == 0x73 && ess_tsett_flag != 0 && end > p + 1
516 && (*(p+1) == 0x73 || *(p+1) == 0x53)) {
517 /* ss */
518 items[1].byte_len = 2;
519 items[1].code_len = 1;
520 items[1].code[0] = (OnigCodePoint )0xdf;
521 return 2;
522 }
523 else
524 return 1;
525 }
526 else if (*p == 0xdf && ess_tsett_flag != 0) {
527 items[0].byte_len = 1;
528 items[0].code_len = 2;
529 items[0].code[0] = (OnigCodePoint )'s';
530 items[0].code[1] = (OnigCodePoint )'s';
531
532 items[1].byte_len = 1;
533 items[1].code_len = 2;
534 items[1].code[0] = (OnigCodePoint )'S';
535 items[1].code[1] = (OnigCodePoint )'S';
536
537 items[2].byte_len = 1;
538 items[2].code_len = 2;
539 items[2].code[0] = (OnigCodePoint )'s';
540 items[2].code[1] = (OnigCodePoint )'S';
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
541
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
542 items[3].byte_len = 1;
543 items[3].code_len = 2;
544 items[3].code[0] = (OnigCodePoint )'S';
545 items[3].code[1] = (OnigCodePoint )'s';
546
547 return 4;
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
548 }
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
549 else {
550 int i;
551
552 for (i = 0; i < map_size; i++) {
553 if (*p == map[i].from) {
554 items[0].byte_len = 1;
555 items[0].code_len = 1;
556 items[0].code[0] = map[i].to;
557 return 1;
558 }
559 else if (*p == map[i].to) {
560 items[0].byte_len = 1;
561 items[0].code_len = 1;
562 items[0].code[0] = map[i].from;
563 return 1;
564 }
565 }
566 }
567
568 return 0;
5770336 Initial revision
ksaito authored
569 }
570
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
571
5770336 Initial revision
ksaito authored
572 extern int
52ed8c4 * include/ruby/oniguruma.h: Oniguruma 1.9.1 merged.
matz authored
573 onigenc_not_support_get_ctype_code_range(OnigCtype ctype,
5fc7312 * include/ruby/oniguruma.h (OnigEncodingTypeST): add OnigEncoding
matz authored
574 OnigCodePoint* sb_out, const OnigCodePoint* ranges[],
575 OnigEncoding enc)
5770336 Initial revision
ksaito authored
576 {
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
577 return ONIG_NO_SUPPORT_CONFIG;
578 }
579
580 extern int
6e1c3a0 @nurse * enc/koi8_u.c: added.
nurse authored
581 onigenc_is_mbc_newline_0x0a(const UChar* p, const UChar* end, OnigEncoding enc ARG_UNUSED)
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
582 {
583 if (p < end) {
584 if (*p == 0x0a) return 1;
585 }
586 return 0;
5770336 Initial revision
ksaito authored
587 }
588
589 /* for single byte encodings */
590 extern int
6e1c3a0 @nurse * enc/koi8_u.c: added.
nurse authored
591 onigenc_ascii_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED, const UChar** p,
592 const UChar*end, UChar* lower, OnigEncoding enc ARG_UNUSED)
5770336 Initial revision
ksaito authored
593 {
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
594 *lower = ONIGENC_ASCII_CODE_TO_LOWER_CASE(**p);
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
595
596 (*p)++;
5770336 Initial revision
ksaito authored
597 return 1; /* return byte length of converted char to lower */
598 }
599
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
600 #if 0
5770336 Initial revision
ksaito authored
601 extern int
6e1c3a0 @nurse * enc/koi8_u.c: added.
nurse authored
602 onigenc_ascii_is_mbc_ambiguous(OnigCaseFoldType flag ARG_UNUSED,
603 const UChar** pp, const UChar* end ARG_UNUSED)
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
604 {
f052429 This commit was generated by cvs2svn to compensate for changes in r8021,
ksaito authored
605 const UChar* p = *pp;
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
606
607 (*pp)++;
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
608 return ONIGENC_IS_ASCII_CODE_CASE_AMBIG(*p);
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
609 }
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
610 #endif
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
611
612 extern int
6e1c3a0 @nurse * enc/koi8_u.c: added.
nurse authored
613 onigenc_single_byte_mbc_enc_len(const UChar* p ARG_UNUSED, const UChar* e ARG_UNUSED,
614 OnigEncoding enc ARG_UNUSED)
5770336 Initial revision
ksaito authored
615 {
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
616 return 1;
5770336 Initial revision
ksaito authored
617 }
618
619 extern OnigCodePoint
6e1c3a0 @nurse * enc/koi8_u.c: added.
nurse authored
620 onigenc_single_byte_mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED,
621 OnigEncoding enc ARG_UNUSED)
5770336 Initial revision
ksaito authored
622 {
623 return (OnigCodePoint )(*p);
624 }
625
626 extern int
6e1c3a0 @nurse * enc/koi8_u.c: added.
nurse authored
627 onigenc_single_byte_code_to_mbclen(OnigCodePoint code ARG_UNUSED, OnigEncoding enc ARG_UNUSED)
5770336 Initial revision
ksaito authored
628 {
629 return 1;
630 }
631
632 extern int
6e1c3a0 @nurse * enc/koi8_u.c: added.
nurse authored
633 onigenc_single_byte_code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc ARG_UNUSED)
5770336 Initial revision
ksaito authored
634 {
420e61c @nurse * regenc.c (code_to_mbc): raise RangeError Integer#chr
nurse authored
635 if (code > 0xff)
2af2eb2 @akr * regenc.c (onigenc_single_byte_code_to_mbc): follow OnigEncoding
akr authored
636 rb_raise(rb_eRangeError, "%u out of char range", code);
5770336 Initial revision
ksaito authored
637 *buf = (UChar )(code & 0xff);
638 return 1;
639 }
640
641 extern UChar*
6e1c3a0 @nurse * enc/koi8_u.c: added.
nurse authored
642 onigenc_single_byte_left_adjust_char_head(const UChar* start ARG_UNUSED, const UChar* s,
1941660 @akr * include/ruby/oniguruma.h (OnigEncodingTypeST): add end argument for
akr authored
643 const UChar* end,
6e1c3a0 @nurse * enc/koi8_u.c: added.
nurse authored
644 OnigEncoding enc ARG_UNUSED)
5770336 Initial revision
ksaito authored
645 {
f052429 This commit was generated by cvs2svn to compensate for changes in r8021,
ksaito authored
646 return (UChar* )s;
5770336 Initial revision
ksaito authored
647 }
648
649 extern int
6e1c3a0 @nurse * enc/koi8_u.c: added.
nurse authored
650 onigenc_always_true_is_allowed_reverse_match(const UChar* s ARG_UNUSED, const UChar* end ARG_UNUSED,
651 OnigEncoding enc ARG_UNUSED)
5770336 Initial revision
ksaito authored
652 {
653 return TRUE;
654 }
655
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
656 extern int
6e1c3a0 @nurse * enc/koi8_u.c: added.
nurse authored
657 onigenc_always_false_is_allowed_reverse_match(const UChar* s ARG_UNUSED, const UChar* end ARG_UNUSED,
658 OnigEncoding enc ARG_UNUSED)
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
659 {
660 return FALSE;
661 }
662
bcb064e @akr * regenc.c (onigenc_ascii_is_code_ctype): moved from enc/ascii.c.
akr authored
663 extern int
664 onigenc_ascii_is_code_ctype(OnigCodePoint code, unsigned int ctype,
6e1c3a0 @nurse * enc/koi8_u.c: added.
nurse authored
665 OnigEncoding enc ARG_UNUSED)
bcb064e @akr * regenc.c (onigenc_ascii_is_code_ctype): moved from enc/ascii.c.
akr authored
666 {
667 if (code < 128)
668 return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
669 else
670 return FALSE;
671 }
672
5770336 Initial revision
ksaito authored
673 extern OnigCodePoint
081c802 @akr * grapheme cluster implementation reverted. [ruby-dev:36375]
akr authored
674 onigenc_mbn_mbc_to_code(OnigEncoding enc, const UChar* p, const UChar* end)
5770336 Initial revision
ksaito authored
675 {
081c802 @akr * grapheme cluster implementation reverted. [ruby-dev:36375]
akr authored
676 int c, i, len;
5770336 Initial revision
ksaito authored
677 OnigCodePoint n;
678
081c802 @akr * grapheme cluster implementation reverted. [ruby-dev:36375]
akr authored
679 len = enclen(enc, p, end);
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
680 n = (OnigCodePoint )(*p++);
5770336 Initial revision
ksaito authored
681 if (len == 1) return n;
682
683 for (i = 1; i < len; i++) {
684 if (p >= end) break;
685 c = *p++;
686 n <<= 8; n += c;
687 }
688 return n;
689 }
690
691 extern int
52ed8c4 * include/ruby/oniguruma.h: Oniguruma 1.9.1 merged.
matz authored
692 onigenc_mbn_mbc_case_fold(OnigEncoding enc, OnigCaseFoldType flag ARG_UNUSED,
693 const UChar** pp, const UChar* end ARG_UNUSED,
694 UChar* lower)
5770336 Initial revision
ksaito authored
695 {
696 int len;
f052429 This commit was generated by cvs2svn to compensate for changes in r8021,
ksaito authored
697 const UChar *p = *pp;
5770336 Initial revision
ksaito authored
698
699 if (ONIGENC_IS_MBC_ASCII(p)) {
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
700 *lower = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*p);
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
701 (*pp)++;
5770336 Initial revision
ksaito authored
702 return 1;
703 }
704 else {
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
705 int i;
706
52ed8c4 * include/ruby/oniguruma.h: Oniguruma 1.9.1 merged.
matz authored
707 len = enclen(enc, p, end);
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
708 for (i = 0; i < len; i++) {
709 *lower++ = *p++;
5770336 Initial revision
ksaito authored
710 }
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
711 (*pp) += len;
5770336 Initial revision
ksaito authored
712 return len; /* return byte length of converted to lower char */
713 }
714 }
715
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
716 #if 0
5770336 Initial revision
ksaito authored
717 extern int
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
718 onigenc_mbn_is_mbc_ambiguous(OnigEncoding enc, OnigCaseFoldType flag,
6e1c3a0 @nurse * enc/koi8_u.c: added.
nurse authored
719 const UChar** pp ARG_UNUSED, const UChar* end ARG_UNUSED)
5770336 Initial revision
ksaito authored
720 {
f052429 This commit was generated by cvs2svn to compensate for changes in r8021,
ksaito authored
721 const UChar* p = *pp;
5770336 Initial revision
ksaito authored
722
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
723 if (ONIGENC_IS_MBC_ASCII(p)) {
724 (*pp)++;
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
725 return ONIGENC_IS_ASCII_CODE_CASE_AMBIG(*p);
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
726 }
727
52ed8c4 * include/ruby/oniguruma.h: Oniguruma 1.9.1 merged.
matz authored
728 (*pp) += enclen(enc, p);
5770336 Initial revision
ksaito authored
729 return FALSE;
730 }
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
731 #endif
5770336 Initial revision
ksaito authored
732
733 extern int
6e1c3a0 @nurse * enc/koi8_u.c: added.
nurse authored
734 onigenc_mb2_code_to_mbclen(OnigCodePoint code, OnigEncoding enc ARG_UNUSED)
5770336 Initial revision
ksaito authored
735 {
800f04c @nurse * numeric.c (rb_enc_uint_char): raise RangeError when added codepoint
nurse authored
736 if (code <= 0xff) return 1;
737 if (code <= 0xffff) return 2;
738 return ONIGERR_TOO_BIG_WIDE_CHAR_VALUE;
5770336 Initial revision
ksaito authored
739 }
740
741 extern int
6e1c3a0 @nurse * enc/koi8_u.c: added.
nurse authored
742 onigenc_mb4_code_to_mbclen(OnigCodePoint code, OnigEncoding enc ARG_UNUSED)
5770336 Initial revision
ksaito authored
743 {
744 if ((code & 0xff000000) != 0) return 4;
745 else if ((code & 0xff0000) != 0) return 3;
746 else if ((code & 0xff00) != 0) return 2;
747 else return 1;
748 }
749
750 extern int
751 onigenc_mb2_code_to_mbc(OnigEncoding enc, OnigCodePoint code, UChar *buf)
752 {
753 UChar *p = buf;
754
755 if ((code & 0xff00) != 0) {
756 *p++ = (UChar )((code >> 8) & 0xff);
757 }
758 *p++ = (UChar )(code & 0xff);
759
760 #if 1
52ed8c4 * include/ruby/oniguruma.h: Oniguruma 1.9.1 merged.
matz authored
761 if (enclen(enc, buf, p) != (p - buf))
762 return ONIGERR_INVALID_CODE_POINT_VALUE;
5770336 Initial revision
ksaito authored
763 #endif
0424e15 @nurse * Merge Onigmo-5.13.1. [ruby-dev:45057] [Feature #5820]
nurse authored
764 return (int )(p - buf);
5770336 Initial revision
ksaito authored
765 }
766
767 extern int
768 onigenc_mb4_code_to_mbc(OnigEncoding enc, OnigCodePoint code, UChar *buf)
769 {
770 UChar *p = buf;
771
772 if ((code & 0xff000000) != 0) {
773 *p++ = (UChar )((code >> 24) & 0xff);
774 }
086e235 * oniguruma.h: merge Oniguruma 4.0.0 [ruby-dev:28290]
matz authored
775 if ((code & 0xff0000) != 0 || p != buf) {
5770336 Initial revision
ksaito authored
776 *p++ = (UChar )((code >> 16) & 0xff);
777 }
086e235 * oniguruma.h: merge Oniguruma 4.0.0 [ruby-dev:28290]
matz authored
778 if ((code & 0xff00) != 0 || p != buf) {
5770336 Initial revision
ksaito authored
779 *p++ = (UChar )((code >> 8) & 0xff);
780 }
781 *p++ = (UChar )(code & 0xff);
782
783 #if 1
52ed8c4 * include/ruby/oniguruma.h: Oniguruma 1.9.1 merged.
matz authored
784 if (enclen(enc, buf, p) != (p - buf))
785 return ONIGERR_INVALID_CODE_POINT_VALUE;
5770336 Initial revision
ksaito authored
786 #endif
0424e15 @nurse * Merge Onigmo-5.13.1. [ruby-dev:45057] [Feature #5820]
nurse authored
787 return (int )(p - buf);
5770336 Initial revision
ksaito authored
788 }
789
790 extern int
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
791 onigenc_minimum_property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
792 {
4f57266 @nobu * regexec.c (stack_double): use MatchStackLimitSize atomically.
nobu authored
793 static const PosixBracketEntryType PBS[] = {
46970b2 @nobu * regenc.h (PosixBracketEntryType): constified.
nobu authored
794 PosixBracketEntryInit("Alnum", ONIGENC_CTYPE_ALNUM),
795 PosixBracketEntryInit("Alpha", ONIGENC_CTYPE_ALPHA),
796 PosixBracketEntryInit("Blank", ONIGENC_CTYPE_BLANK),
797 PosixBracketEntryInit("Cntrl", ONIGENC_CTYPE_CNTRL),
798 PosixBracketEntryInit("Digit", ONIGENC_CTYPE_DIGIT),
799 PosixBracketEntryInit("Graph", ONIGENC_CTYPE_GRAPH),
800 PosixBracketEntryInit("Lower", ONIGENC_CTYPE_LOWER),
801 PosixBracketEntryInit("Print", ONIGENC_CTYPE_PRINT),
802 PosixBracketEntryInit("Punct", ONIGENC_CTYPE_PUNCT),
803 PosixBracketEntryInit("Space", ONIGENC_CTYPE_SPACE),
804 PosixBracketEntryInit("Upper", ONIGENC_CTYPE_UPPER),
805 PosixBracketEntryInit("XDigit", ONIGENC_CTYPE_XDIGIT),
806 PosixBracketEntryInit("ASCII", ONIGENC_CTYPE_ASCII),
807 PosixBracketEntryInit("Word", ONIGENC_CTYPE_WORD),
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
808 };
809
46970b2 @nobu * regenc.h (PosixBracketEntryType): constified.
nobu authored
810 const PosixBracketEntryType *pb, *pbe;
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
811 int len;
812
813 len = onigenc_strlen(enc, p, end);
46970b2 @nobu * regenc.h (PosixBracketEntryType): constified.
nobu authored
814 for (pbe = (pb = PBS) + sizeof(PBS)/sizeof(PBS[0]); pb < pbe; ++pb) {
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
815 if (len == pb->len &&
0424e15 @nurse * Merge Onigmo-5.13.1. [ruby-dev:45057] [Feature #5820]
nurse authored
816 onigenc_with_ascii_strnicmp(enc, p, end, pb->name, pb->len) == 0)
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
817 return pb->ctype;
818 }
819
820 return ONIGERR_INVALID_CHAR_PROPERTY_NAME;
821 }
822
823 extern int
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
824 onigenc_mb2_is_code_ctype(OnigEncoding enc, OnigCodePoint code,
5770336 Initial revision
ksaito authored
825 unsigned int ctype)
826 {
086e235 * oniguruma.h: merge Oniguruma 4.0.0 [ruby-dev:28290]
matz authored
827 if (code < 128)
828 return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
829 else {
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
830 if (CTYPE_IS_WORD_GRAPH_PRINT(ctype)) {
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
831 return (ONIGENC_CODE_TO_MBCLEN(enc, code) > 1 ? TRUE : FALSE);
086e235 * oniguruma.h: merge Oniguruma 4.0.0 [ruby-dev:28290]
matz authored
832 }
5770336 Initial revision
ksaito authored
833 }
834
086e235 * oniguruma.h: merge Oniguruma 4.0.0 [ruby-dev:28290]
matz authored
835 return FALSE;
5770336 Initial revision
ksaito authored
836 }
837
838 extern int
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
839 onigenc_mb4_is_code_ctype(OnigEncoding enc, OnigCodePoint code,
5770336 Initial revision
ksaito authored
840 unsigned int ctype)
841 {
086e235 * oniguruma.h: merge Oniguruma 4.0.0 [ruby-dev:28290]
matz authored
842 if (code < 128)
843 return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
844 else {
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
845 if (CTYPE_IS_WORD_GRAPH_PRINT(ctype)) {
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
846 return (ONIGENC_CODE_TO_MBCLEN(enc, code) > 1 ? TRUE : FALSE);
086e235 * oniguruma.h: merge Oniguruma 4.0.0 [ruby-dev:28290]
matz authored
847 }
5770336 Initial revision
ksaito authored
848 }
849
086e235 * oniguruma.h: merge Oniguruma 4.0.0 [ruby-dev:28290]
matz authored
850 return FALSE;
5770336 Initial revision
ksaito authored
851 }
852
853 extern int
f052429 This commit was generated by cvs2svn to compensate for changes in r8021,
ksaito authored
854 onigenc_with_ascii_strncmp(OnigEncoding enc, const UChar* p, const UChar* end,
855 const UChar* sascii /* ascii */, int n)
5770336 Initial revision
ksaito authored
856 {
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
857 int x, c;
5770336 Initial revision
ksaito authored
858
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
859 while (n-- > 0) {
860 if (p >= end) return (int )(*sascii);
5770336 Initial revision
ksaito authored
861
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
862 c = (int )ONIGENC_MBC_TO_CODE(enc, p, end);
863 x = *sascii - c;
864 if (x) return x;
5770336 Initial revision
ksaito authored
865
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
866 sascii++;
52ed8c4 * include/ruby/oniguruma.h: Oniguruma 1.9.1 merged.
matz authored
867 p += enclen(enc, p, end);
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
868 }
869 return 0;
5770336 Initial revision
ksaito authored
870 }
871
0424e15 @nurse * Merge Onigmo-5.13.1. [ruby-dev:45057] [Feature #5820]
nurse authored
872 extern int
873 onigenc_with_ascii_strnicmp(OnigEncoding enc, const UChar* p, const UChar* end,
874 const UChar* sascii /* ascii */, int n)
875 {
876 int x, c;
877
878 while (n-- > 0) {
879 if (p >= end) return (int )(*sascii);
880
881 c = (int )ONIGENC_MBC_TO_CODE(enc, p, end);
882 if (ONIGENC_IS_ASCII_CODE(c))
883 c = ONIGENC_ASCII_CODE_TO_LOWER_CASE(c);
884 x = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*sascii) - c;
885 if (x) return x;
886
887 sascii++;
888 p += enclen(enc, p, end);
889 }
890 return 0;
891 }
892
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
893 /* Property management */
894 static int
895 resize_property_list(int new_size, const OnigCodePoint*** plist, int* psize)
5770336 Initial revision
ksaito authored
896 {
23a32d6 @nobu * include/ruby/oniguruma.h, include/ruby/re.h, re.c, regcomp.c,
nobu authored
897 size_t size;
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
898 const OnigCodePoint **list = *plist;
899
900 size = sizeof(OnigCodePoint*) * new_size;
901 if (IS_NULL(list)) {
902 list = (const OnigCodePoint** )xmalloc(size);
903 }
904 else {
905 list = (const OnigCodePoint** )xrealloc((void* )list, size);
5770336 Initial revision
ksaito authored
906 }
907
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
908 if (IS_NULL(list)) return ONIGERR_MEMORY;
5770336 Initial revision
ksaito authored
909
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
910 *plist = list;
911 *psize = new_size;
5770336 Initial revision
ksaito authored
912
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
913 return 0;
5770336 Initial revision
ksaito authored
914 }
915
916 extern int
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
917 onigenc_property_list_add_property(UChar* name, const OnigCodePoint* prop,
918 hash_table_type **table, const OnigCodePoint*** plist, int *pnum,
919 int *psize)
5770336 Initial revision
ksaito authored
920 {
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
921 #define PROP_INIT_SIZE 16
5770336 Initial revision
ksaito authored
922
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
923 int r;
5770336 Initial revision
ksaito authored
924
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
925 if (*psize <= *pnum) {
926 int new_size = (*psize == 0 ? PROP_INIT_SIZE : *psize * 2);
927 r = resize_property_list(new_size, plist, psize);
928 if (r != 0) return r;
929 }
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
930
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
931 (*plist)[*pnum] = prop;
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
932
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
933 if (ONIG_IS_NULL(*table)) {
934 *table = onig_st_init_strend_table_with_size(PROP_INIT_SIZE);
935 if (ONIG_IS_NULL(*table)) return ONIGERR_MEMORY;
5e853c8 This commit was generated by cvs2svn to compensate for changes in r7203,
ksaito authored
936 }
5770336 Initial revision
ksaito authored
937
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
938 *pnum = *pnum + 1;
939 onig_st_insert_strend(*table, name, name + strlen((char* )name),
940 (hash_data_type )(*pnum + ONIGENC_MAX_STD_CTYPE));
941 return 0;
5770336 Initial revision
ksaito authored
942 }
943
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
944 extern int
52ed8c4 * include/ruby/oniguruma.h: Oniguruma 1.9.1 merged.
matz authored
945 onigenc_property_list_init(int (*f)(void))
5770336 Initial revision
ksaito authored
946 {
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
947 int r;
5770336 Initial revision
ksaito authored
948
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
949 THREAD_ATOMIC_START;
5770336 Initial revision
ksaito authored
950
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
951 r = f();
5770336 Initial revision
ksaito authored
952
6ee2e54 * oniguruma.h: updated to Oniguruma 5.7.0.
matz authored
953 THREAD_ATOMIC_END;
954 return r;
5770336 Initial revision
ksaito authored
955 }
Something went wrong with that request. Please try again.