Lines Matching refs:rune
50 static char *wide_char_to_byte_str(int rune, size_t *outlen);
618 /* Convert (prefix of) utf8 string to utf-32 rune. */
619 /* Sets *rune to the value, returns the length. */
621 int u8_rune(int *rune, const char *s)
628 *rune = c;
634 *rune = ((c & 0x1F) << 6) | (s[1] & 0x3F); /* 110xxxxx 10xxxxxx */
638 *rune = ((c & 0xF) << 12) | ((s[1] & 0x3F) << 6) | (s[2] & 0x3F);
643 *rune = ((c & 0x7) << 18) | ((s[1] & 0x3F) << 12) | ((s[2] & 0x3F) << 6) | (s[3] & 0x3F);
647 *rune = c;
719 /* runetochar() adapted from rune.c in the Plan 9 distribution */
2840 static char *wide_char_to_byte_str(int rune, size_t *outlen)
2845 if (rune < 0 || rune > 0x10FFFF)
2851 if (rune <= 0x0000007F) {
2852 buf[len++] = rune;
2853 } else if (rune
2855 buf[len++] = 0xC0 | (rune >> 6);
2856 buf[len++] = 0x80 | (rune & 0x3F);
2857 } else if (rune <= 0x0000FFFF) {
2859 buf[len++] = 0xE0 | (rune >> 12);
2860 buf[len++] = 0x80 | ((rune >> 6) & 0x3F);
2861 buf[len++] = 0x80 | (rune & 0x3F);
2866 buf[len++] = 0xF0 | (rune >> 18);
2867 buf[len++] = 0x80 | ((rune >> 12) & 0x3F);
2868 buf[len++] = 0x80 | ((rune >> 6) & 0x3F);
2869 buf[len++] = 0x80 | (rune & 0x3F);