Lines Matching refs:c

126 static int dbcs_char2len(int c);
127 static int dbcs_char2bytes(int c, char_u *buf);
131 static int dbcs_char2cells(int c);
136 static int cw_value(int c);
1030 latin_char2len(int c UNUSED) in latin_char2len()
1037 int c) in dbcs_char2len() argument
1039 if (c >= 0x100) in dbcs_char2len()
1050 latin_char2bytes(int c, char_u *buf) in latin_char2bytes() argument
1052 buf[0] = c; in latin_char2bytes()
1057 dbcs_char2bytes(int c, char_u *buf) in dbcs_char2bytes() argument
1059 if (c >= 0x100) in dbcs_char2bytes()
1061 buf[0] = (unsigned)c >> 8; in dbcs_char2bytes()
1062 buf[1] = c; in dbcs_char2bytes()
1069 buf[0] = c; in dbcs_char2bytes()
1138 intable(struct interval *table, size_t size, int c) in intable() argument
1143 if (c < table[0].first) in intable()
1152 if (table[mid].last < c) in intable()
1154 else if (table[mid].first > c) in intable()
1352 utf_uint2cells(UINT32_T c) in utf_uint2cells() argument
1354 if (c >= 0x100 && utf_iscomposing((int)c)) in utf_uint2cells()
1356 return utf_char2cells((int)c); in utf_uint2cells()
1368 utf_char2cells(int c) in utf_char2cells() argument
1562 if (c >= 0x100) in utf_char2cells()
1569 n = cw_value(c); in utf_char2cells()
1579 n = wcwidth(c); in utf_char2cells()
1586 if (!utf_printable(c)) in utf_char2cells()
1588 if (intable(doublewidth, sizeof(doublewidth), c)) in utf_char2cells()
1591 if (p_emoji && intable(emoji_wide, sizeof(emoji_wide), c)) in utf_char2cells()
1596 else if (c >= 0x80 && !vim_isprintc(c)) in utf_char2cells()
1599 if (c >= 0x80 && *p_ambw == 'd' && intable(ambiguous, sizeof(ambiguous), c)) in utf_char2cells()
1620 int c; in utf_ptr2cells() local
1625 c = utf_ptr2char(p); in utf_ptr2cells()
1627 if (utf_ptr2len(p) == 1 || c == NUL) in utf_ptr2cells()
1630 if (c < 0x80) in utf_ptr2cells()
1631 return char2cells(c); in utf_ptr2cells()
1632 return utf_char2cells(c); in utf_ptr2cells()
1661 int c; in utf_ptr2cells_len() local
1668 c = utf_ptr2char(p); in utf_ptr2cells_len()
1670 if (utf_ptr2len(p) == 1 || c == NUL) in utf_ptr2cells_len()
1673 if (c < 0x80) in utf_ptr2cells_len()
1674 return char2cells(c); in utf_ptr2cells_len()
1675 return utf_char2cells(c); in utf_ptr2cells_len()
1696 latin_char2cells(int c UNUSED) in latin_char2cells()
1702 dbcs_char2cells(int c) in dbcs_char2cells() argument
1706 if (enc_dbcs == DBCS_JPNU && ((unsigned)c >> 8) == 0x8e) in dbcs_char2cells()
1709 return MB_BYTE2LEN((unsigned)c >> 8); in dbcs_char2cells()
1843 int c, k; in utf_safe_read_char_adv() local
1862 c = utf_ptr2char(*s); in utf_safe_read_char_adv()
1869 if (c != (int)(**s) || (c == 0xC3 && (*s)[1] == 0x83)) in utf_safe_read_char_adv()
1874 return c; in utf_safe_read_char_adv()
1889 int c; in mb_ptr2char_adv() local
1891 c = (*mb_ptr2char)(*pp); in mb_ptr2char_adv()
1893 return c; in mb_ptr2char_adv()
1903 int c; in mb_cptr2char_adv() local
1905 c = (*mb_ptr2char)(*pp); in mb_cptr2char_adv()
1910 return c; in mb_cptr2char_adv()
1943 int c; in utfc_ptr2char() local
1947 c = utf_ptr2char(p); in utfc_ptr2char()
1970 return c; in utfc_ptr2char()
1984 int c; in utfc_ptr2char_len() local
1988 c = utf_ptr2char(p); in utfc_ptr2char_len()
2013 return c; in utfc_ptr2char_len()
2209 utf_char2len(int c) in utf_char2len() argument
2211 if (c < 0x80) in utf_char2len()
2213 if (c < 0x800) in utf_char2len()
2215 if (c < 0x10000) in utf_char2len()
2217 if (c < 0x200000) in utf_char2len()
2219 if (c < 0x4000000) in utf_char2len()
2229 utf_char2bytes(int c, char_u *buf) in utf_char2bytes() argument
2231 if (c < 0x80) // 7 bits in utf_char2bytes()
2233 buf[0] = c; in utf_char2bytes()
2236 if (c < 0x800) // 11 bits in utf_char2bytes()
2238 buf[0] = 0xc0 + ((unsigned)c >> 6); in utf_char2bytes()
2239 buf[1] = 0x80 + (c & 0x3f); in utf_char2bytes()
2242 if (c < 0x10000) // 16 bits in utf_char2bytes()
2244 buf[0] = 0xe0 + ((unsigned)c >> 12); in utf_char2bytes()
2245 buf[1] = 0x80 + (((unsigned)c >> 6) & 0x3f); in utf_char2bytes()
2246 buf[2] = 0x80 + (c & 0x3f); in utf_char2bytes()
2249 if (c < 0x200000) // 21 bits in utf_char2bytes()
2251 buf[0] = 0xf0 + ((unsigned)c >> 18); in utf_char2bytes()
2252 buf[1] = 0x80 + (((unsigned)c >> 12) & 0x3f); in utf_char2bytes()
2253 buf[2] = 0x80 + (((unsigned)c >> 6) & 0x3f); in utf_char2bytes()
2254 buf[3] = 0x80 + (c & 0x3f); in utf_char2bytes()
2257 if (c < 0x4000000) // 26 bits in utf_char2bytes()
2259 buf[0] = 0xf8 + ((unsigned)c >> 24); in utf_char2bytes()
2260 buf[1] = 0x80 + (((unsigned)c >> 18) & 0x3f); in utf_char2bytes()
2261 buf[2] = 0x80 + (((unsigned)c >> 12) & 0x3f); in utf_char2bytes()
2262 buf[3] = 0x80 + (((unsigned)c >> 6) & 0x3f); in utf_char2bytes()
2263 buf[4] = 0x80 + (c & 0x3f); in utf_char2bytes()
2267 buf[0] = 0xfc + ((unsigned)c >> 30); in utf_char2bytes()
2268 buf[1] = 0x80 + (((unsigned)c >> 24) & 0x3f); in utf_char2bytes()
2269 buf[2] = 0x80 + (((unsigned)c >> 18) & 0x3f); in utf_char2bytes()
2270 buf[3] = 0x80 + (((unsigned)c >> 12) & 0x3f); in utf_char2bytes()
2271 buf[4] = 0x80 + (((unsigned)c >> 6) & 0x3f); in utf_char2bytes()
2272 buf[5] = 0x80 + (c & 0x3f); in utf_char2bytes()
2281 utf_iscomposing_uint(UINT32_T c) in utf_iscomposing_uint() argument
2283 return utf_iscomposing((int)c); in utf_iscomposing_uint()
2293 utf_iscomposing(int c) in utf_iscomposing() argument
2591 return intable(combining, sizeof(combining), c); in utf_iscomposing()
2599 utf_printable(int c) in utf_printable() argument
2605 return iswprint(c); in utf_printable()
2616 return !intable(nonprint, sizeof(nonprint), c); in utf_printable()
2782 utf_class(int c) in utf_class() argument
2784 return utf_class_buf(c, curbuf); in utf_class()
2788 utf_class_buf(int c, buf_T *buf) in utf_class_buf() argument
2876 if (c < 0x100) in utf_class_buf()
2878 if (c == ' ' || c == '\t' || c == NUL || c == 0xa0) in utf_class_buf()
2880 if (vim_iswordc_buf(c, buf)) in utf_class_buf()
2886 if (intable(emoji_all, sizeof(emoji_all), c)) in utf_class_buf()
2893 if (classes[mid].last < (unsigned int)c) in utf_class_buf()
2895 else if (classes[mid].first > (unsigned int)c) in utf_class_buf()
2906 utf_ambiguous_width(int c) in utf_ambiguous_width() argument
2908 return c >= 0x80 && (intable(ambiguous, sizeof(ambiguous), c) in utf_ambiguous_width()
2909 || intable(emoji_all, sizeof(emoji_all), c)); in utf_ambiguous_width()
3855 int c; in utf_head_off() local
3883 c = utf_ptr2char(q); in utf_head_off()
3884 if (utf_iscomposing(c)) in utf_head_off()
3888 if (arabic_maycombine(c)) in utf_head_off()
3896 if (arabic_combine(utf_ptr2char(j), c)) in utf_head_off()
5222 int c; in string_convert_ext() local
5240 c = ptr[i]; in string_convert_ext()
5241 if (c < 0x80) in string_convert_ext()
5242 *d++ = c; in string_convert_ext()
5245 *d++ = 0xc0 + ((unsigned)c >> 6); in string_convert_ext()
5246 *d++ = 0x80 + (c & 0x3f); in string_convert_ext()
5261 c = ptr[i]; in string_convert_ext()
5262 switch (c) in string_convert_ext()
5264 case 0xa4: c = 0x20ac; break; // euro in string_convert_ext()
5265 case 0xa6: c = 0x0160; break; // S hat in string_convert_ext()
5266 case 0xa8: c = 0x0161; break; // S -hat in string_convert_ext()
5267 case 0xb4: c = 0x017d; break; // Z hat in string_convert_ext()
5268 case 0xb8: c = 0x017e; break; // Z -hat in string_convert_ext()
5269 case 0xbc: c = 0x0152; break; // OE in string_convert_ext()
5270 case 0xbd: c = 0x0153; break; // oe in string_convert_ext()
5271 case 0xbe: c = 0x0178; break; // Y in string_convert_ext()
5273 d += utf_char2bytes(c, d); in string_convert_ext()
5311 c = utf_ptr2char(ptr + i); in string_convert_ext()
5313 switch (c) in string_convert_ext()
5315 case 0x20ac: c = 0xa4; break; // euro in string_convert_ext()
5316 case 0x0160: c = 0xa6; break; // S hat in string_convert_ext()
5317 case 0x0161: c = 0xa8; break; // S -hat in string_convert_ext()
5318 case 0x017d: c = 0xb4; break; // Z hat in string_convert_ext()
5319 case 0x017e: c = 0xb8; break; // Z -hat in string_convert_ext()
5320 case 0x0152: c = 0xbc; break; // OE in string_convert_ext()
5321 case 0x0153: c = 0xbd; break; // oe in string_convert_ext()
5322 case 0x0178: c = 0xbe; break; // Y in string_convert_ext()
5330 case 0xbe: c = 0x100; break; // not in latin9 in string_convert_ext()
5332 if (!utf_iscomposing(c)) // skip composing chars in string_convert_ext()
5334 if (c < 0x100) in string_convert_ext()
5335 *d++ = c; in string_convert_ext()
5344 if (utf_char2cells(c) > 1) in string_convert_ext()
5468 cw_value(int c) in cw_value() argument
5476 if (c < cw_table[0].first) in cw_value()
5485 if (cw_table[mid].last < c) in cw_value()
5487 else if (cw_table[mid].first > c) in cw_value()