Lines Matching refs:code
123 code_to_mbclen(OnigCodePoint code) in code_to_mbclen() argument
125 if ((code & 0xffffff80) == 0) return 1; in code_to_mbclen()
126 else if ((code & 0xfffff800) == 0) return 2; in code_to_mbclen()
127 else if ((code & 0xffff0000) == 0) return 3; in code_to_mbclen()
128 else if ((code & 0xffe00000) == 0) return 4; in code_to_mbclen()
129 else if ((code & 0xfc000000) == 0) return 5; in code_to_mbclen()
130 else if ((code & 0x80000000) == 0) return 6; in code_to_mbclen()
132 else if (code == INVALID_CODE_FE) return 1; in code_to_mbclen()
133 else if (code == INVALID_CODE_FF) return 1; in code_to_mbclen()
140 code_to_mbc(OnigCodePoint code, UChar *buf) in code_to_mbc() argument
142 #define UTF8_TRAILS(code, shift) (UChar )((((code) >> (shift)) & 0x3f) | 0x80) in code_to_mbc() argument
143 #define UTF8_TRAIL0(code) (UChar )(((code) & 0x3f) | 0x80) in code_to_mbc() argument
145 if ((code & 0xffffff80) == 0) { in code_to_mbc()
146 *buf = (UChar )code; in code_to_mbc()
152 if ((code & 0xfffff800) == 0) { in code_to_mbc()
153 *p++ = (UChar )(((code>>6)& 0x1f) | 0xc0); in code_to_mbc()
155 else if ((code & 0xffff0000) == 0) { in code_to_mbc()
156 *p++ = (UChar )(((code>>12) & 0x0f) | 0xe0); in code_to_mbc()
157 *p++ = UTF8_TRAILS(code, 6); in code_to_mbc()
159 else if ((code & 0xffe00000) == 0) { in code_to_mbc()
160 *p++ = (UChar )(((code>>18) & 0x07) | 0xf0); in code_to_mbc()
161 *p++ = UTF8_TRAILS(code, 12); in code_to_mbc()
162 *p++ = UTF8_TRAILS(code, 6); in code_to_mbc()
164 else if ((code & 0xfc000000) == 0) { in code_to_mbc()
165 *p++ = (UChar )(((code>>24) & 0x03) | 0xf8); in code_to_mbc()
166 *p++ = UTF8_TRAILS(code, 18); in code_to_mbc()
167 *p++ = UTF8_TRAILS(code, 12); in code_to_mbc()
168 *p++ = UTF8_TRAILS(code, 6); in code_to_mbc()
170 else if ((code & 0x80000000) == 0) { in code_to_mbc()
171 *p++ = (UChar )(((code>>30) & 0x01) | 0xfc); in code_to_mbc()
172 *p++ = UTF8_TRAILS(code, 24); in code_to_mbc()
173 *p++ = UTF8_TRAILS(code, 18); in code_to_mbc()
174 *p++ = UTF8_TRAILS(code, 12); in code_to_mbc()
175 *p++ = UTF8_TRAILS(code, 6); in code_to_mbc()
178 else if (code == INVALID_CODE_FE) { in code_to_mbc()
182 else if (code == INVALID_CODE_FF) { in code_to_mbc()
191 *p++ = UTF8_TRAIL0(code); in code_to_mbc()