Lines Matching refs:codepoint
222 static void encode_utf8(VSTRING *buffer, int codepoint) in encode_utf8() argument
227 if (codepoint < 0x80) { in encode_utf8()
228 VSTRING_ADDCH(buffer, codepoint); in encode_utf8()
229 } else if (codepoint < 0x800) { in encode_utf8()
230 VSTRING_ADDCH(buffer, 0xc0 | (codepoint >> 6)); in encode_utf8()
231 VSTRING_ADDCH(buffer, 0x80 | (codepoint & 0x3f)); in encode_utf8()
232 } else if (codepoint < 0x10000) { in encode_utf8()
233 VSTRING_ADDCH(buffer, 0xe0 | (codepoint >> 12)); in encode_utf8()
234 VSTRING_ADDCH(buffer, 0x80 | ((codepoint >> 6) & 0x3f)); in encode_utf8()
235 VSTRING_ADDCH(buffer, 0x80 | (codepoint & 0x3f)); in encode_utf8()
236 } else if (codepoint <= 0x10FFFF) { in encode_utf8()
237 VSTRING_ADDCH(buffer, 0xf0 | (codepoint >> 18)); in encode_utf8()
238 VSTRING_ADDCH(buffer, 0x80 | ((codepoint >> 12) & 0x3f)); in encode_utf8()
239 VSTRING_ADDCH(buffer, 0x80 | ((codepoint >> 6) & 0x3f)); in encode_utf8()
240 VSTRING_ADDCH(buffer, 0x80 | (codepoint & 0x3f)); in encode_utf8()
242 msg_panic("%s: out-of-range codepoint U+%X", myname, codepoint); in encode_utf8()
262 int codepoint, first, last; in main() local
297 for (codepoint = first; codepoint <= last; codepoint++) { in main()
298 if (codepoint >= 0xD800 && codepoint <= 0xDFFF) { in main()
300 codepoint = 0xDFFF; in main()
302 encode_utf8(buffer, codepoint); in main()
304 vstream_printf("U+%X -> %s\n", codepoint, STR(buffer)); in main()
306 msg_fatal("bad utf-8 encoding for U+%X\n", codepoint); in main()