Declaration fixes.
[emacs.git] / src / character.h
blob864882db7f6aa70aa75c49a6ebf2acc1c9e1589e
1 /* Header for multibyte character handler.
2 Copyright (C) 1995, 1997, 1998 Electrotechnical Laboratory, JAPAN.
3 Licensed to the Free Software Foundation.
4 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
5 National Institute of Advanced Industrial Science and Technology (AIST)
6 Registration Number H13PRO009
8 This file is part of GNU Emacs.
10 GNU Emacs is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
15 GNU Emacs is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23 #ifndef EMACS_CHARACTER_H
24 #define EMACS_CHARACTER_H
26 /* character code 1st byte byte sequence
27 -------------- -------- -------------
28 0-7F 00..7F 0xxxxxxx
29 80-7FF C2..DF 110xxxxx 10xxxxxx
30 800-FFFF E0..EF 1110xxxx 10xxxxxx 10xxxxxx
31 10000-1FFFFF F0..F7 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
32 200000-3FFF7F F8 11111000 1000xxxx 10xxxxxx 10xxxxxx 10xxxxxx
33 3FFF80-3FFFFF C0..C1 1100000x 10xxxxxx (for eight-bit-char)
34 400000-... invalid
36 invalid 1st byte 80..BF 10xxxxxx
37 F9..FF 11111xxx (xxx != 000)
40 /* Maximum character code ((1 << CHARACTERBITS) - 1). */
41 #define MAX_CHAR 0x3FFFFF
43 /* Maximum Unicode character code. */
44 #define MAX_UNICODE_CHAR 0x10FFFF
46 /* Maximum N-byte character codes. */
47 #define MAX_1_BYTE_CHAR 0x7F
48 #define MAX_2_BYTE_CHAR 0x7FF
49 #define MAX_3_BYTE_CHAR 0xFFFF
50 #define MAX_4_BYTE_CHAR 0x1FFFFF
51 #define MAX_5_BYTE_CHAR 0x3FFF7F
53 /* Minimum leading code of multibyte characters. */
54 #define MIN_MULTIBYTE_LEADING_CODE 0xC0
55 /* Maximum leading code of multibyte characters. */
56 #define MAX_MULTIBYTE_LEADING_CODE 0xF8
58 /* Nonzero iff C is a character that corresponds to a raw 8-bit
59 byte. */
60 #define CHAR_BYTE8_P(c) ((c) > MAX_5_BYTE_CHAR)
62 /* Return the character code for raw 8-bit byte BYTE. */
63 #define BYTE8_TO_CHAR(byte) ((byte) + 0x3FFF00)
65 #define UNIBYTE_TO_CHAR(byte) \
66 (ASCII_BYTE_P (byte) ? (byte) : BYTE8_TO_CHAR (byte))
68 /* Return the raw 8-bit byte for character C. */
69 #define CHAR_TO_BYTE8(c) \
70 (CHAR_BYTE8_P (c) \
71 ? (c) - 0x3FFF00 \
72 : multibyte_char_to_unibyte (c))
74 /* Return the raw 8-bit byte for character C,
75 or -1 if C doesn't correspond to a byte. */
76 #define CHAR_TO_BYTE_SAFE(c) \
77 (CHAR_BYTE8_P (c) \
78 ? (c) - 0x3FFF00 \
79 : multibyte_char_to_unibyte_safe (c))
81 /* Nonzero iff BYTE is the 1st byte of a multibyte form of a character
82 that corresponds to a raw 8-bit byte. */
83 #define CHAR_BYTE8_HEAD_P(byte) ((byte) == 0xC0 || (byte) == 0xC1)
85 /* If C is not ASCII, make it unibyte. */
86 #define MAKE_CHAR_UNIBYTE(c) \
87 do { \
88 if (! ASCII_CHAR_P (c)) \
89 c = CHAR_TO_BYTE8 (c); \
90 } while (0)
93 /* If C is not ASCII, make it multibyte. Assumes C < 256. */
94 #define MAKE_CHAR_MULTIBYTE(c) \
95 (eassert ((c) >= 0 && (c) < 256), (c) = UNIBYTE_TO_CHAR (c))
97 /* This is the maximum byte length of multibyte form. */
98 #define MAX_MULTIBYTE_LENGTH 5
100 /* Return a Lisp character whose character code is C. Assumes C is
101 a valid character code. */
102 #define make_char(c) make_number (c)
104 /* Nonzero iff C is an ASCII byte. */
105 #define ASCII_BYTE_P(c) ((unsigned) (c) < 0x80)
107 /* Nonzero iff X is a character. */
108 #define CHARACTERP(x) (NATNUMP (x) && XFASTINT (x) <= MAX_CHAR)
110 /* Nonzero iff C is valid as a character code. GENERICP is not used. */
111 #define CHAR_VALID_P(c, genericp) ((unsigned) (c) <= MAX_CHAR)
113 /* Check if Lisp object X is a character or not. */
114 #define CHECK_CHARACTER(x) \
115 CHECK_TYPE (CHARACTERP (x), Qcharacterp, x)
117 #define CHECK_CHARACTER_CAR(x) \
118 do { \
119 Lisp_Object tmp = XCAR (x); \
120 CHECK_CHARACTER (tmp); \
121 XSETCAR ((x), tmp); \
122 } while (0)
124 #define CHECK_CHARACTER_CDR(x) \
125 do { \
126 Lisp_Object tmp = XCDR (x); \
127 CHECK_CHARACTER (tmp); \
128 XSETCDR ((x), tmp); \
129 } while (0)
131 /* Nonzero iff C is a character of code less than 0x100. */
132 #define SINGLE_BYTE_CHAR_P(c) ((unsigned) (c) < 0x100)
134 /* Nonzero if character C has a printable glyph. */
135 #define CHAR_PRINTABLE_P(c) \
136 (((c) >= 32 && (c) < 127) \
137 || ! NILP (CHAR_TABLE_REF (Vprintable_chars, (c))))
139 /* Return byte length of multibyte form for character C. */
140 #define CHAR_BYTES(c) \
141 ( (c) <= MAX_1_BYTE_CHAR ? 1 \
142 : (c) <= MAX_2_BYTE_CHAR ? 2 \
143 : (c) <= MAX_3_BYTE_CHAR ? 3 \
144 : (c) <= MAX_4_BYTE_CHAR ? 4 \
145 : (c) <= MAX_5_BYTE_CHAR ? 5 \
146 : 2)
149 /* Return the leading code of multibyte form of C. */
150 #define CHAR_LEADING_CODE(c) \
151 ((c) <= MAX_1_BYTE_CHAR ? c \
152 : (c) <= MAX_2_BYTE_CHAR ? (0xC0 | ((c) >> 6)) \
153 : (c) <= MAX_3_BYTE_CHAR ? (0xE0 | ((c) >> 12)) \
154 : (c) <= MAX_4_BYTE_CHAR ? (0xF0 | ((c) >> 18)) \
155 : (c) <= MAX_5_BYTE_CHAR ? 0xF8 \
156 : (0xC0 | (((c) >> 6) & 0x01)))
159 /* Store multibyte form of the character C in P. The caller should
160 allocate at least MAX_MULTIBYTE_LENGTH bytes area at P in advance.
161 Returns the length of the multibyte form. */
163 #define CHAR_STRING(c, p) \
164 ((unsigned) (c) <= MAX_1_BYTE_CHAR \
165 ? ((p)[0] = (c), \
166 1) \
167 : (unsigned) (c) <= MAX_2_BYTE_CHAR \
168 ? ((p)[0] = (0xC0 | ((c) >> 6)), \
169 (p)[1] = (0x80 | ((c) & 0x3F)), \
170 2) \
171 : (unsigned) (c) <= MAX_3_BYTE_CHAR \
172 ? ((p)[0] = (0xE0 | ((c) >> 12)), \
173 (p)[1] = (0x80 | (((c) >> 6) & 0x3F)), \
174 (p)[2] = (0x80 | ((c) & 0x3F)), \
175 3) \
176 : char_string ((unsigned) c, p))
178 /* Store multibyte form of byte B in P. The caller should allocate at
179 least MAX_MULTIBYTE_LENGTH bytes area at P in advance. Returns the
180 length of the multibyte form. */
182 #define BYTE8_STRING(b, p) \
183 ((p)[0] = (0xC0 | (((b) >> 6) & 0x01)), \
184 (p)[1] = (0x80 | ((b) & 0x3F)), \
188 /* Store multibyte form of the character C in P and advance P to the
189 end of the multibyte form. The caller should allocate at least
190 MAX_MULTIBYTE_LENGTH bytes area at P in advance. */
192 #define CHAR_STRING_ADVANCE(c, p) \
193 do { \
194 if ((c) <= MAX_1_BYTE_CHAR) \
195 *(p)++ = (c); \
196 else if ((c) <= MAX_2_BYTE_CHAR) \
197 *(p)++ = (0xC0 | ((c) >> 6)), \
198 *(p)++ = (0x80 | ((c) & 0x3F)); \
199 else if ((c) <= MAX_3_BYTE_CHAR) \
200 *(p)++ = (0xE0 | ((c) >> 12)), \
201 *(p)++ = (0x80 | (((c) >> 6) & 0x3F)), \
202 *(p)++ = (0x80 | ((c) & 0x3F)); \
203 else \
204 (p) += char_string ((c), (p)); \
205 } while (0)
208 /* Nonzero iff BYTE starts a non-ASCII character in a multibyte
209 form. */
210 #define LEADING_CODE_P(byte) (((byte) & 0xC0) == 0xC0)
212 /* Nonzero iff BYTE is a trailing code of a non-ASCII character in a
213 multibyte form. */
214 #define TRAILING_CODE_P(byte) (((byte) & 0xC0) == 0x80)
216 /* Nonzero iff BYTE starts a character in a multibyte form.
217 This is equivalent to:
218 (ASCII_BYTE_P (byte) || LEADING_CODE_P (byte)) */
219 #define CHAR_HEAD_P(byte) (((byte) & 0xC0) != 0x80)
221 /* How many bytes a character that starts with BYTE occupies in a
222 multibyte form. */
223 #define BYTES_BY_CHAR_HEAD(byte) \
224 (!((byte) & 0x80) ? 1 \
225 : !((byte) & 0x20) ? 2 \
226 : !((byte) & 0x10) ? 3 \
227 : !((byte) & 0x08) ? 4 \
228 : 5)
231 /* The byte length of multibyte form at unibyte string P ending at
232 PEND. If STR doesn't point to a valid multibyte form, return 0. */
234 #define MULTIBYTE_LENGTH(p, pend) \
235 (p >= pend ? 0 \
236 : !((p)[0] & 0x80) ? 1 \
237 : ((p + 1 >= pend) || (((p)[1] & 0xC0) != 0x80)) ? 0 \
238 : ((p)[0] & 0xE0) == 0xC0 ? 2 \
239 : ((p + 2 >= pend) || (((p)[2] & 0xC0) != 0x80)) ? 0 \
240 : ((p)[0] & 0xF0) == 0xE0 ? 3 \
241 : ((p + 3 >= pend) || (((p)[3] & 0xC0) != 0x80)) ? 0 \
242 : ((p)[0] & 0xF8) == 0xF0 ? 4 \
243 : ((p + 4 >= pend) || (((p)[4] & 0xC0) != 0x80)) ? 0 \
244 : (p)[0] == 0xF8 && ((p)[1] & 0xF0) == 0x80 ? 5 \
245 : 0)
248 /* Like MULTIBYTE_LENGTH, but don't check the ending address. */
250 #define MULTIBYTE_LENGTH_NO_CHECK(p) \
251 (!((p)[0] & 0x80) ? 1 \
252 : ((p)[1] & 0xC0) != 0x80 ? 0 \
253 : ((p)[0] & 0xE0) == 0xC0 ? 2 \
254 : ((p)[2] & 0xC0) != 0x80 ? 0 \
255 : ((p)[0] & 0xF0) == 0xE0 ? 3 \
256 : ((p)[3] & 0xC0) != 0x80 ? 0 \
257 : ((p)[0] & 0xF8) == 0xF0 ? 4 \
258 : ((p)[4] & 0xC0) != 0x80 ? 0 \
259 : (p)[0] == 0xF8 && ((p)[1] & 0xF0) == 0x80 ? 5 \
260 : 0)
262 /* If P is before LIMIT, advance P to the next character boundary.
263 Assumes that P is already at a character boundary of the same
264 multibyte form whose end address is LIMIT. */
266 #define NEXT_CHAR_BOUNDARY(p, limit) \
267 do { \
268 if ((p) < (limit)) \
269 (p) += BYTES_BY_CHAR_HEAD (*(p)); \
270 } while (0)
273 /* If P is after LIMIT, advance P to the previous character boundary.
274 Assumes that P is already at a character boundary of the same
275 multibyte form whose beginning address is LIMIT. */
277 #define PREV_CHAR_BOUNDARY(p, limit) \
278 do { \
279 if ((p) > (limit)) \
281 const unsigned char *chp = (p); \
282 do { \
283 chp--; \
284 } while (chp >= limit && ! CHAR_HEAD_P (*chp)); \
285 (p) = (BYTES_BY_CHAR_HEAD (*chp) == (p) - chp) ? chp : (p) - 1; \
287 } while (0)
289 /* Return the character code of character whose multibyte form is at
290 P. */
292 #define STRING_CHAR(p) \
293 (!((p)[0] & 0x80) \
294 ? (p)[0] \
295 : ! ((p)[0] & 0x20) \
296 ? (((((p)[0] & 0x1F) << 6) \
297 | ((p)[1] & 0x3F)) \
298 + (((unsigned char) (p)[0]) < 0xC2 ? 0x3FFF80 : 0)) \
299 : ! ((p)[0] & 0x10) \
300 ? ((((p)[0] & 0x0F) << 12) \
301 | (((p)[1] & 0x3F) << 6) \
302 | ((p)[2] & 0x3F)) \
303 : string_char ((p), NULL, NULL))
306 /* Like STRING_CHAR, but set ACTUAL_LEN to the length of multibyte
307 form. */
309 #define STRING_CHAR_AND_LENGTH(p, actual_len) \
310 (!((p)[0] & 0x80) \
311 ? ((actual_len) = 1, (p)[0]) \
312 : ! ((p)[0] & 0x20) \
313 ? ((actual_len) = 2, \
314 (((((p)[0] & 0x1F) << 6) \
315 | ((p)[1] & 0x3F)) \
316 + (((unsigned char) (p)[0]) < 0xC2 ? 0x3FFF80 : 0))) \
317 : ! ((p)[0] & 0x10) \
318 ? ((actual_len) = 3, \
319 ((((p)[0] & 0x0F) << 12) \
320 | (((p)[1] & 0x3F) << 6) \
321 | ((p)[2] & 0x3F))) \
322 : string_char ((p), NULL, &actual_len))
325 /* Like STRING_CHAR, but advance P to the end of multibyte form. */
327 #define STRING_CHAR_ADVANCE(p) \
328 (!((p)[0] & 0x80) \
329 ? *(p)++ \
330 : ! ((p)[0] & 0x20) \
331 ? ((p) += 2, \
332 ((((p)[-2] & 0x1F) << 6) \
333 | ((p)[-1] & 0x3F) \
334 | ((unsigned char) ((p)[-2]) < 0xC2 ? 0x3FFF80 : 0))) \
335 : ! ((p)[0] & 0x10) \
336 ? ((p) += 3, \
337 ((((p)[-3] & 0x0F) << 12) \
338 | (((p)[-2] & 0x3F) << 6) \
339 | ((p)[-1] & 0x3F))) \
340 : string_char ((p), &(p), NULL))
343 /* Fetch the "next" character from Lisp string STRING at byte position
344 BYTEIDX, character position CHARIDX. Store it into OUTPUT.
346 All the args must be side-effect-free.
347 BYTEIDX and CHARIDX must be lvalues;
348 we increment them past the character fetched. */
350 #define FETCH_STRING_CHAR_ADVANCE(OUTPUT, STRING, CHARIDX, BYTEIDX) \
351 do \
353 CHARIDX++; \
354 if (STRING_MULTIBYTE (STRING)) \
356 unsigned char *chp = &SDATA (STRING)[BYTEIDX]; \
357 int chlen; \
359 OUTPUT = STRING_CHAR_AND_LENGTH (chp, chlen); \
360 BYTEIDX += chlen; \
362 else \
364 OUTPUT = SREF (STRING, BYTEIDX); \
365 BYTEIDX++; \
368 while (0)
370 /* Like FETCH_STRING_CHAR_ADVANCE, but return a multibyte character
371 even if STRING is unibyte. */
373 #define FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE(OUTPUT, STRING, CHARIDX, BYTEIDX) \
374 do \
376 CHARIDX++; \
377 if (STRING_MULTIBYTE (STRING)) \
379 unsigned char *chp = &SDATA (STRING)[BYTEIDX]; \
380 int chlen; \
382 OUTPUT = STRING_CHAR_AND_LENGTH (chp, chlen); \
383 BYTEIDX += chlen; \
385 else \
387 OUTPUT = SREF (STRING, BYTEIDX); \
388 BYTEIDX++; \
389 MAKE_CHAR_MULTIBYTE (OUTPUT); \
392 while (0)
395 /* Like FETCH_STRING_CHAR_ADVANCE, but assumes STRING is multibyte. */
397 #define FETCH_STRING_CHAR_ADVANCE_NO_CHECK(OUTPUT, STRING, CHARIDX, BYTEIDX) \
398 do \
400 unsigned char *fetch_ptr = &SDATA (STRING)[BYTEIDX]; \
401 int fetch_len; \
403 OUTPUT = STRING_CHAR_AND_LENGTH (fetch_ptr, fetch_len); \
404 BYTEIDX += fetch_len; \
405 CHARIDX++; \
407 while (0)
410 /* Like FETCH_STRING_CHAR_ADVANCE, but fetch character from the current
411 buffer. */
413 #define FETCH_CHAR_ADVANCE(OUTPUT, CHARIDX, BYTEIDX) \
414 do \
416 CHARIDX++; \
417 if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) \
419 unsigned char *chp = BYTE_POS_ADDR (BYTEIDX); \
420 int chlen; \
422 OUTPUT= STRING_CHAR_AND_LENGTH (chp, chlen); \
423 BYTEIDX += chlen; \
425 else \
427 OUTPUT = *(BYTE_POS_ADDR (BYTEIDX)); \
428 BYTEIDX++; \
431 while (0)
434 /* Like FETCH_CHAR_ADVANCE, but assumes the current buffer is multibyte. */
436 #define FETCH_CHAR_ADVANCE_NO_CHECK(OUTPUT, CHARIDX, BYTEIDX) \
437 do \
439 unsigned char *chp = BYTE_POS_ADDR (BYTEIDX); \
440 int chlen; \
442 OUTPUT = STRING_CHAR_AND_LENGTH (chp, chlen); \
443 BYTEIDX += chlen; \
444 CHARIDX++; \
446 while (0)
449 /* Increment the buffer byte position POS_BYTE of the current buffer to
450 the next character boundary. No range checking of POS. */
452 #define INC_POS(pos_byte) \
453 do { \
454 unsigned char *chp = BYTE_POS_ADDR (pos_byte); \
455 pos_byte += BYTES_BY_CHAR_HEAD (*chp); \
456 } while (0)
459 /* Decrement the buffer byte position POS_BYTE of the current buffer to
460 the previous character boundary. No range checking of POS. */
462 #define DEC_POS(pos_byte) \
463 do { \
464 unsigned char *chp; \
466 pos_byte--; \
467 if (pos_byte < GPT_BYTE) \
468 chp = BEG_ADDR + pos_byte - BEG_BYTE; \
469 else \
470 chp = BEG_ADDR + GAP_SIZE + pos_byte - BEG_BYTE; \
471 while (!CHAR_HEAD_P (*chp)) \
473 chp--; \
474 pos_byte--; \
476 } while (0)
478 /* Increment both CHARPOS and BYTEPOS, each in the appropriate way. */
480 #define INC_BOTH(charpos, bytepos) \
481 do \
483 (charpos)++; \
484 if (NILP (BVAR (current_buffer, enable_multibyte_characters))) \
485 (bytepos)++; \
486 else \
487 INC_POS ((bytepos)); \
489 while (0)
492 /* Decrement both CHARPOS and BYTEPOS, each in the appropriate way. */
494 #define DEC_BOTH(charpos, bytepos) \
495 do \
497 (charpos)--; \
498 if (NILP (BVAR (current_buffer, enable_multibyte_characters))) \
499 (bytepos)--; \
500 else \
501 DEC_POS ((bytepos)); \
503 while (0)
506 /* Increment the buffer byte position POS_BYTE of the current buffer to
507 the next character boundary. This macro relies on the fact that
508 *GPT_ADDR and *Z_ADDR are always accessible and the values are
509 '\0'. No range checking of POS_BYTE. */
511 #define BUF_INC_POS(buf, pos_byte) \
512 do { \
513 unsigned char *chp = BUF_BYTE_ADDRESS (buf, pos_byte); \
514 pos_byte += BYTES_BY_CHAR_HEAD (*chp); \
515 } while (0)
518 /* Decrement the buffer byte position POS_BYTE of the current buffer to
519 the previous character boundary. No range checking of POS_BYTE. */
521 #define BUF_DEC_POS(buf, pos_byte) \
522 do { \
523 unsigned char *chp; \
524 pos_byte--; \
525 if (pos_byte < BUF_GPT_BYTE (buf)) \
526 chp = BUF_BEG_ADDR (buf) + pos_byte - BEG_BYTE; \
527 else \
528 chp = BUF_BEG_ADDR (buf) + BUF_GAP_SIZE (buf) + pos_byte - BEG_BYTE;\
529 while (!CHAR_HEAD_P (*chp)) \
531 chp--; \
532 pos_byte--; \
534 } while (0)
537 /* If C is a character to be unified with a Unicode character, return
538 the unified Unicode character. */
540 #define MAYBE_UNIFY_CHAR(c) \
541 do { \
542 if (c > MAX_UNICODE_CHAR && c <= MAX_5_BYTE_CHAR) \
544 Lisp_Object val; \
545 val = CHAR_TABLE_REF (Vchar_unify_table, c); \
546 if (INTEGERP (val)) \
547 c = XINT (val); \
548 else if (! NILP (val)) \
549 c = maybe_unify_char (c, val); \
551 } while (0)
554 /* Return the width of ASCII character C. The width is measured by
555 how many columns C will occupy on the screen when displayed in the
556 current buffer. */
558 #define ASCII_CHAR_WIDTH(c) \
559 (c < 0x20 \
560 ? (c == '\t' \
561 ? XFASTINT (BVAR (current_buffer, tab_width)) \
562 : (c == '\n' ? 0 : (NILP (BVAR (current_buffer, ctl_arrow)) ? 4 : 2))) \
563 : (c < 0x7f \
564 ? 1 \
565 : ((NILP (BVAR (current_buffer, ctl_arrow)) ? 4 : 2))))
567 /* Return the width of character C. The width is measured by how many
568 columns C will occupy on the screen when displayed in the current
569 buffer. */
571 #define CHAR_WIDTH(c) \
572 (ASCII_CHAR_P (c) \
573 ? ASCII_CHAR_WIDTH (c) \
574 : XINT (CHAR_TABLE_REF (Vchar_width_table, c)))
576 /* If C is a variation selector, return the index numnber of the
577 variation selector (1..256). Otherwise, return 0. */
579 #define CHAR_VARIATION_SELECTOR_P(c) \
580 ((c) < 0xFE00 ? 0 \
581 : (c) <= 0xFE0F ? (c) - 0xFE00 + 1 \
582 : (c) < 0xE0100 ? 0 \
583 : (c) <= 0xE01EF ? (c) - 0xE0100 + 17 \
584 : 0)
586 /* If C is a high surrogate, return 1. If C is a low surrogate,
587 return 0. Otherwise, return 0. */
589 #define CHAR_SURROGATE_PAIR_P(c) \
590 ((c) < 0xD800 ? 0 \
591 : (c) <= 0xDBFF ? 1 \
592 : (c) <= 0xDFFF ? 2 \
593 : 0)
596 extern int char_resolve_modifier_mask (int);
597 extern int char_string (unsigned, unsigned char *);
598 extern int string_char (const unsigned char *,
599 const unsigned char **, int *);
601 extern int translate_char (Lisp_Object, int c);
602 extern int char_printable_p (int c);
603 extern void parse_str_as_multibyte (const unsigned char *,
604 EMACS_INT, EMACS_INT *, EMACS_INT *);
605 extern EMACS_INT parse_str_to_multibyte (const unsigned char *, EMACS_INT);
606 extern EMACS_INT str_as_multibyte (unsigned char *, EMACS_INT, EMACS_INT,
607 EMACS_INT *);
608 extern EMACS_INT str_to_multibyte (unsigned char *, EMACS_INT, EMACS_INT);
609 extern EMACS_INT str_as_unibyte (unsigned char *, EMACS_INT);
610 extern EMACS_INT str_to_unibyte (const unsigned char *, unsigned char *,
611 EMACS_INT, int);
612 extern EMACS_INT strwidth (const char *, EMACS_INT);
613 extern EMACS_INT c_string_width (const unsigned char *, EMACS_INT, int,
614 EMACS_INT *, EMACS_INT *);
615 extern EMACS_INT lisp_string_width (Lisp_Object, int,
616 EMACS_INT *, EMACS_INT *);
618 extern Lisp_Object Qcharacterp;
619 extern Lisp_Object Vchar_unify_table;
620 extern Lisp_Object string_escape_byte8 (Lisp_Object);
622 /* Return a translation table of id number ID. */
623 #define GET_TRANSLATION_TABLE(id) \
624 (XCDR(XVECTOR(Vtranslation_table_vector)->contents[(id)]))
626 #define DEFSYM(sym, name) \
627 do { (sym) = intern_c_string ((name)); staticpro (&(sym)); } while (0)
629 #endif /* EMACS_CHARACTER_H */