Lines Matching refs:rune
46 static char *wide_char_to_byte_str(int rune, size_t *outlen);
625 /* Convert (prefix of) utf8 string to utf-32 rune. */
626 /* Sets *rune to the value, returns the length. */
628 int u8_rune(int *rune, const char *s)
635 *rune = c;
641 *rune = ((c & 0x1F) << 6) | (s[1] & 0x3F); /* 110xxxxx 10xxxxxx */
645 *rune = ((c & 0xF) << 12) | ((s[1] & 0x3F) << 6) | (s[2] & 0x3F);
650 *rune = ((c & 0x7) << 18) | ((s[1] & 0x3F) << 12) | ((s[2] & 0x3F) << 6) | (s[3] & 0x3F);
654 *rune = c;
726 /* runetochar() adapted from rune.c in the Plan 9 distribution */
2828 static char *wide_char_to_byte_str(int rune, size_t *outlen)
2833 if (rune < 0 || rune > 0x10FFFF)
2839 if (rune <= 0x0000007F) {
2840 buf[len++] = rune;
2841 } else if (rune <= 0x000007FF) {
2843 buf[len++] = 0xC0 | (rune >> 6);
2844 buf[len++] = 0x80 | (rune & 0x3F);
2845 } else if (rune <= 0x0000FFFF) {
2847 buf[len++] = 0xE0 | (rune >> 12);
2848 buf[len++] = 0x80 | ((rune >> 6) & 0x3F);
2849 buf[len++] = 0x80 | (rune & 0x3F);
2854 buf[len++] = 0xF0 | (rune >> 18);
2855 buf[len++] = 0x80 | ((rune >> 12) & 0x3F);
2856 buf[len++] = 0x80 | ((rune >> 6) & 0x3F);
2857 buf[len++] = 0x80 | (rune & 0x3F);