Debian Codegraph @

vendor/onigmo-source/enc/utf_32le.c

raw symbols SCIP
1 /**********************************************************************
2 utf_32le.c - Oniguruma (regular expression library)
3 **********************************************************************/
4 /*-
5 * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30 #include "regenc.h"cxx . . $ `<file>/vendor/onigmo-source/regenc.h`/
31 #include "iso_8859.h"cxx . . $ `<file>/vendor/onigmo-source/enc/iso_8859.h`/
32
33 static int
34 utf32le_mbc_enc_lencxx . . $ utf32le_mbc_enc_len(d6816dd497b890ca).(const UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`!* p ARG_UNUSEDcxx . . $ `vendor/onigmo-source/regenc.h:82:11`!, const OnigUCharcxx . . $ OnigUChar#* e ARG_UNUSEDcxx . . $ `vendor/onigmo-source/regenc.h:82:11`!,
35 OnigEncodingcxx . . $ OnigEncoding# enc ARG_UNUSEDcxx . . $ `vendor/onigmo-source/regenc.h:82:11`!)
36 {
37 return 4;
38 }
39
40 static int
41 utf32le_is_mbc_newlinecxx . . $ utf32le_is_mbc_newline(d6816dd497b890ca).(const UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`!* p, const UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`!* end,
42 OnigEncodingcxx . . $ OnigEncoding# enc ARG_UNUSEDcxx . . $ `vendor/onigmo-source/regenc.h:82:11`!)
43 {
44 if (p + 3 < end) {
45 if (*p == 0x0a && *(p+1) == 0 && *(p+2) == 0 && *(p+3) == 0)
46 return 1;
47 #ifdef USE_UNICODE_ALL_LINE_TERMINATORS
48 if ((*p == 0x0b ||*p == 0x0c ||*p == 0x0d || *p == 0x85)
49 && *(p+1) == 0x00 && (p+2) == 0x00 && *(p+3) == 0x00)
50 return 1;
51 if (*(p+1) == 0x20 && (*p == 0x29 || *p == 0x28)
52 && *(p+2) == 0x00 && *(p+3) == 0x00)
53 return 1;
54 #endif
55 }
56 return 0;
57 }
58
59 static OnigCodePointcxx . . $ OnigCodePoint#
60 utf32le_mbc_to_codecxx . . $ utf32le_mbc_to_code(542d90b8bf35e660).(const UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`!* p, const UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`!* end ARG_UNUSEDcxx . . $ `vendor/onigmo-source/regenc.h:82:11`!,
61 OnigEncodingcxx . . $ OnigEncoding# enc ARG_UNUSEDcxx . . $ `vendor/onigmo-source/regenc.h:82:11`!)
62 {
63 return (OnigCodePointcxx . . $ OnigCodePoint# )(((p[3] * 256 + p[2]) * 256 + p[1]) * 256 + p[0]);
64 }
65
66 static int
67 utf32le_code_to_mbclencxx . . $ utf32le_code_to_mbclen(ed1ebf883eff915d).(OnigCodePointcxx . . $ OnigCodePoint# code ARG_UNUSEDcxx . . $ `vendor/onigmo-source/regenc.h:82:11`!,
68 OnigEncodingcxx . . $ OnigEncoding# enc ARG_UNUSEDcxx . . $ `vendor/onigmo-source/regenc.h:82:11`!)
69 {
70 return 4;
71 }
72
73 static int
74 utf32le_code_to_mbccxx . . $ utf32le_code_to_mbc(cc36a00e84837546).(OnigCodePointcxx . . $ OnigCodePoint# code, UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`! *buf,
75 OnigEncodingcxx . . $ OnigEncoding# enc ARG_UNUSEDcxx . . $ `vendor/onigmo-source/regenc.h:82:11`!)
76 {
77 UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`!* p = buf;
78
79 *p++ = (UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`! ) (code & 0xff);
80 *p++ = (UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`! )((code & 0xff00) >> 8);
81 *p++ = (UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`! )((code & 0xff0000) >>16);
82 *p++ = (UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`! )((code & 0xff000000) >>24);
83 return 4;
84 }
85
86 static int
87 utf32le_mbc_case_foldcxx . . $ utf32le_mbc_case_fold(c1ec0ee5809b8ef8).(OnigCaseFoldTypecxx . . $ OnigCaseFoldType# flag,
88 const UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`!** pp, const UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`!* end, UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`!* fold,
89 OnigEncodingcxx . . $ OnigEncoding# enc)
90 {
91 const UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`!* p = *pp;
92
93 if (ONIGENC_IS_ASCII_CODEcxx . . $ `vendor/onigmo-source/regenc.h:213:9`!(*p) && *(p+1) == 0 && *(p+2) == 0 && *(p+3) == 0) {
94 #ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI
95 if ((flag & ONIGENC_CASE_FOLD_TURKISH_AZERI) != 0) {
96 if (*p == 0x49) {
97 *fold++ = 0x31;
98 *fold++ = 0x01;
99 }
100 }
101 else {
102 #endif
103 *fold++ = ONIGENC_ASCII_CODE_TO_LOWER_CASEcxx . . $ `vendor/onigmo-source/regenc.h:214:9`!(*p);
104 *fold++ = 0;
105 #ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI
106 }
107 #endif
108
109 *fold++ = 0;
110 *fold = 0;
111 *pp += 4;
112 return 4;
113 }
114 else
115 return onigenc_unicode_mbc_case_foldcxx . . $ onigenc_unicode_mbc_case_fold(971301441d819429).(enc, flag, pp,
116 end, fold);
117 }
118
119 #if 0
120 static int
121 utf32le_is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
122 {
123 const UChar* p = *pp;
124
125 (*pp) += 4;
126
127 if (*(p+1) == 0 && *(p+2) == 0 && *(p+3) == 0) {
128 int c, v;
129
130 if (*p == SHARP_s && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
131 return TRUE;
132 }
133
134 c = *p;
135 v = ONIGENC_IS_UNICODE_ISO_8859_1_BIT_CTYPE(c,
136 (BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
137 if ((v | BIT_CTYPE_LOWER) != 0) {
138 /* 0xaa, 0xb5, 0xba are lower case letter, but can't convert. */
139 if (c >= 0xaa && c <= 0xba)
140 return FALSE;
141 else
142 return TRUE;
143 }
144 return (v != 0 ? TRUE : FALSE);
145 }
146
147 return FALSE;
148 }
149 #endif
150
151 static UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`!*
152 utf32le_left_adjust_char_headcxx . . $ utf32le_left_adjust_char_head(e837d4bf7cdd11f9).(const UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`!* start, const UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`!* s, const UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`!* end,
153 OnigEncodingcxx . . $ OnigEncoding# enc ARG_UNUSEDcxx . . $ `vendor/onigmo-source/regenc.h:82:11`!)
154 {
155 ptrdiff_tcxx . . $ ptrdiff_t# rem;
156
157 if (s <= start) return (UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`!* )s;
158
159 rem = (int )((s - start) % 4);
160 return (UCharcxx . . $ `vendor/onigmo-source/onigmo.h:76:10`!* )(s - rem);
161 }
162
163 static int
164 utf32le_get_case_fold_codes_by_strcxx . . $ utf32le_get_case_fold_codes_by_str(915325dbff6e96ee).(OnigCaseFoldTypecxx . . $ OnigCaseFoldType# flag,
165 const OnigUCharcxx . . $ OnigUChar#* p, const OnigUCharcxx . . $ OnigUChar#* end,
166 OnigCaseFoldCodeItemcxx . . $ OnigCaseFoldCodeItem# items[],
167 OnigEncodingcxx . . $ OnigEncoding# enc)
168 {
169 return onigenc_unicode_get_case_fold_codes_by_strcxx . . $ onigenc_unicode_get_case_fold_codes_by_str(1749d66e1d069997).(enc,
170 flag, p, end, items);
171 }
172
173 OnigEncodingDefinecxx . . $ `vendor/onigmo-source/regenc.h:241:10`!(utf_32le, UTF_32LE) = {
174 utf32le_mbc_enc_lencxx . . $ utf32le_mbc_enc_len(d6816dd497b890ca).,
175 "UTF-32LE", /* name */
176 4, /* max byte length */
177 4, /* min byte length */
178 utf32le_is_mbc_newlinecxx . . $ utf32le_is_mbc_newline(d6816dd497b890ca).,
179 utf32le_mbc_to_codecxx . . $ utf32le_mbc_to_code(542d90b8bf35e660).,
180 utf32le_code_to_mbclencxx . . $ utf32le_code_to_mbclen(ed1ebf883eff915d).,
181 utf32le_code_to_mbccxx . . $ utf32le_code_to_mbc(cc36a00e84837546).,
182 utf32le_mbc_case_foldcxx . . $ utf32le_mbc_case_fold(c1ec0ee5809b8ef8).,
183 onigenc_unicode_apply_all_case_foldcxx . . $ onigenc_unicode_apply_all_case_fold(52943f35c546f971).,
184 utf32le_get_case_fold_codes_by_strcxx . . $ utf32le_get_case_fold_codes_by_str(915325dbff6e96ee).,
185 onigenc_unicode_property_name_to_ctypecxx . . $ onigenc_unicode_property_name_to_ctype(fb2245aa60ebfd32).,
186 onigenc_unicode_is_code_ctypecxx . . $ onigenc_unicode_is_code_ctype(7f36058cb237933f).,
187 onigenc_utf16_32_get_ctype_code_rangecxx . . $ onigenc_utf16_32_get_ctype_code_range(f3da0df4ba860021).,
188 utf32le_left_adjust_char_headcxx . . $ utf32le_left_adjust_char_head(e837d4bf7cdd11f9).,
189 onigenc_always_false_is_allowed_reverse_matchcxx . . $ onigenc_always_false_is_allowed_reverse_match(d6816dd497b890ca).,
190 onigenc_unicode_case_mapcxx . . $ onigenc_unicode_case_map(963ee2b6f1418456).,
191 0,
192 ONIGENC_FLAG_UNICODEcxx . . $ `vendor/onigmo-source/onigmo.h:313:9`!,
193 };
194 ENC_ALIAScxx . . $ `vendor/onigmo-source/regenc.h:246:9`!("UCS-4LE", "UTF-32LE")