161 |
(p)[1] = (0x80 | (((c) >> 6) & 0x3F)), \ |
(p)[1] = (0x80 | (((c) >> 6) & 0x3F)), \ |
162 |
(p)[2] = (0x80 | ((c) & 0x3F)), \ |
(p)[2] = (0x80 | ((c) & 0x3F)), \ |
163 |
3) \ |
3) \ |
164 |
: (unsigned) (c) <= MAX_5_BYTE_CHAR \ |
: char_string (c, p)) |
|
? char_string_with_unification (c, p) \ |
|
|
: ((p)[0] = (0xC0 | (((c) >> 6) & 0x01)), \ |
|
|
(p)[1] = (0x80 | ((c) & 0x3F)), \ |
|
|
2)) |
|
165 |
|
|
166 |
/* Store multibyte form of eight-bit char B in P. The caller should |
/* Store multibyte form of byte B in P. The caller should allocate at |
167 |
allocate at least MAX_MULTIBYTE_LENGTH bytes area at P in advance. |
least MAX_MULTIBYTE_LENGTH bytes area at P in advance. Returns the |
168 |
Returns the length of the multibyte form. */ |
length of the multibyte form. */ |
169 |
|
|
170 |
#define BYTE8_STRING(b, p) \ |
#define BYTE8_STRING(b, p) \ |
171 |
((p)[0] = (0xC0 | (((b) >> 6) & 0x01)), \ |
((p)[0] = (0xC0 | (((b) >> 6) & 0x01)), \ |
177 |
allocate at least MAX_MULTIBYTE_LENGTH bytes area at P in advance. |
allocate at least MAX_MULTIBYTE_LENGTH bytes area at P in advance. |
178 |
And, advance P to the end of the multibyte form. */ |
And, advance P to the end of the multibyte form. */ |
179 |
|
|
180 |
#define CHAR_STRING_ADVANCE(c, p) \ |
#define CHAR_STRING_ADVANCE(c, p) \ |
181 |
do { \ |
do { \ |
182 |
if ((c) <= MAX_1_BYTE_CHAR) \ |
if ((c) <= MAX_1_BYTE_CHAR) \ |
183 |
*(p)++ = (c); \ |
*(p)++ = (c); \ |
184 |
else if ((c) <= MAX_2_BYTE_CHAR) \ |
else if ((c) <= MAX_2_BYTE_CHAR) \ |
185 |
*(p)++ = (0xC0 | ((c) >> 6)), \ |
*(p)++ = (0xC0 | ((c) >> 6)), \ |
186 |
*(p)++ = (0x80 | ((c) & 0x3F)); \ |
*(p)++ = (0x80 | ((c) & 0x3F)); \ |
187 |
else if ((c) <= MAX_3_BYTE_CHAR) \ |
else if ((c) <= MAX_3_BYTE_CHAR) \ |
188 |
*(p)++ = (0xE0 | ((c) >> 12)), \ |
*(p)++ = (0xE0 | ((c) >> 12)), \ |
189 |
*(p)++ = (0x80 | (((c) >> 6) & 0x3F)), \ |
*(p)++ = (0x80 | (((c) >> 6) & 0x3F)), \ |
190 |
*(p)++ = (0x80 | ((c) & 0x3F)); \ |
*(p)++ = (0x80 | ((c) & 0x3F)); \ |
191 |
else if ((c) <= MAX_5_BYTE_CHAR) \ |
else \ |
192 |
(p) += char_string_with_unification ((c), (p)); \ |
(p) += char_string ((c), (p)); \ |
|
else \ |
|
|
*(p)++ = (0xC0 | (((c) >> 6) & 0x01)), \ |
|
|
*(p)++ = (0x80 | ((c) & 0x3F)); \ |
|
193 |
} while (0) |
} while (0) |
194 |
|
|
195 |
|
|
196 |
/* Nonzero iff BYTE starts a non-ASCII character in a multibyte |
/* Nonzero iff BYTE starts a non-ASCII character in a multibyte |
197 |
form. */ |
form. */ |
198 |
#define LEADING_CODE_P(byte) (((byte) & 0xC0) == 0xC0) |
#define LEADING_CODE_P(byte) (((byte) & 0xC0) == 0xC0) |
284 |
? ((((p)[0] & 0x0F) << 12) \ |
? ((((p)[0] & 0x0F) << 12) \ |
285 |
| (((p)[1] & 0x3F) << 6) \ |
| (((p)[1] & 0x3F) << 6) \ |
286 |
| ((p)[2] & 0x3F)) \ |
| ((p)[2] & 0x3F)) \ |
287 |
: string_char_with_unification ((p), NULL, NULL)) |
: string_char ((p), NULL, NULL)) |
288 |
|
|
289 |
|
|
290 |
/* Like STRING_CHAR but set ACTUAL_LEN to the length of multibyte |
/* Like STRING_CHAR but set ACTUAL_LEN to the length of multibyte |
304 |
((((p)[0] & 0x0F) << 12) \ |
((((p)[0] & 0x0F) << 12) \ |
305 |
| (((p)[1] & 0x3F) << 6) \ |
| (((p)[1] & 0x3F) << 6) \ |
306 |
| ((p)[2] & 0x3F))) \ |
| ((p)[2] & 0x3F))) \ |
307 |
: string_char_with_unification ((p), NULL, &actual_len)) |
: string_char ((p), NULL, &actual_len)) |
308 |
|
|
309 |
|
|
310 |
/* Like STRING_CHAR but advacen P to the end of multibyte form. */ |
/* Like STRING_CHAR but advacen P to the end of multibyte form. */ |
322 |
((((p)[-3] & 0x0F) << 12) \ |
((((p)[-3] & 0x0F) << 12) \ |
323 |
| (((p)[-2] & 0x3F) << 6) \ |
| (((p)[-2] & 0x3F) << 6) \ |
324 |
| ((p)[-1] & 0x3F))) \ |
| ((p)[-1] & 0x3F))) \ |
325 |
: string_char_with_unification ((p), &(p), NULL)) |
: string_char ((p), &(p), NULL)) |
326 |
|
|
327 |
|
|
328 |
/* Fetch the "next" character from Lisp string STRING at byte position |
/* Fetch the "next" character from Lisp string STRING at byte position |
515 |
|
|
516 |
|
|
517 |
#define MAYBE_UNIFY_CHAR(c) \ |
#define MAYBE_UNIFY_CHAR(c) \ |
518 |
if (CHAR_TABLE_P (Vchar_unify_table)) \ |
if (c > MAX_UNICODE_CHAR \ |
519 |
|
&& CHAR_TABLE_P (Vchar_unify_table)) \ |
520 |
{ \ |
{ \ |
521 |
Lisp_Object val; \ |
Lisp_Object val; \ |
522 |
int unified; \ |
int unified; \ |
558 |
? ASCII_CHAR_WIDTH (c) \ |
? ASCII_CHAR_WIDTH (c) \ |
559 |
: XINT (CHAR_TABLE_REF (Vchar_width_table, c))) |
: XINT (CHAR_TABLE_REF (Vchar_width_table, c))) |
560 |
|
|
561 |
extern int char_string_with_unification P_ ((int, unsigned char *)); |
extern int char_resolve_modifier_mask P_ ((int)); |
562 |
extern int string_char_with_unification P_ ((const unsigned char *, |
extern int char_string P_ ((int, unsigned char *)); |
563 |
const unsigned char **, int *)); |
extern int string_char P_ ((const unsigned char *, |
564 |
|
const unsigned char **, int *)); |
565 |
|
|
566 |
extern int translate_char P_ ((Lisp_Object, int c)); |
extern int translate_char P_ ((Lisp_Object, int c)); |
567 |
extern int char_printable_p P_ ((int c)); |
extern int char_printable_p P_ ((int c)); |