Lines Matching defs:rune
45 static char *wide_char_to_byte_str(int rune, size_t *outlen);
626 /* Convert (prefix of) utf8 string to utf-32 rune. */
627 /* Sets *rune to the value, returns the length. */
629 int u8_rune(int *rune, const char *s)
636 *rune = c;
642 *rune = ((c & 0x1F) << 6) | (s[1] & 0x3F); /* 110xxxxx 10xxxxxx */
646 *rune = ((c & 0xF) << 12) | ((s[1] & 0x3F) << 6) | (s[2] & 0x3F);
651 *rune = ((c & 0x7) << 18) | ((s[1] & 0x3F) << 12) | ((s[2] & 0x3F) << 6) | (s[3] & 0x3F);
655 *rune = c;
727 /* runetochar() adapted from rune.c in the Plan 9 distribution */
2838 static char *wide_char_to_byte_str(int rune, size_t *outlen)
2843 if (rune < 0 || rune > 0x10FFFF)
2849 if (rune <= 0x0000007F) {
2850 buf[len++] = rune;
2851 } else if (rune <= 0x000007FF) {
2853 buf[len++] = 0xC0 | (rune >> 6);
2854 buf[len++] = 0x80 | (rune & 0x3F);
2855 } else if (rune <= 0x0000FFFF) {
2857 buf[len++] = 0xE0 | (rune >> 12);
2858 buf[len++] = 0x80 | ((rune >> 6) & 0x3F);
2859 buf[len++] = 0x80 | (rune & 0x3F);
2864 buf[len++] = 0xF0 | (rune >> 18);
2865 buf[len++] = 0x80 | ((rune >> 12) & 0x3F);
2866 buf[len++] = 0x80 | ((rune >> 6) & 0x3F);
2867 buf[len++] = 0x80 | (rune & 0x3F);