#ifndef EMACS_CHARSET_H
#define EMACS_CHARSET_H
+#include <verify.h>
+
/* Index to arguments of Fdefine_charset_internal. */
enum define_charset_arg_index
int id;
/* Index to Vcharset_hash_table. */
- int hash_index;
+ ptrdiff_t hash_index;
/* Dimension of the charset: 1, 2, 3, or 4. */
int dimension;
byte code of the (N+1)th dimension, <code_space>[4N+1] is a
maximum byte code of the (N+1)th dimension, <code_space>[4N+2] is
(<code_space>[4N+1] - <code_space>[4N] + 1), <code_space>[4N+3]
- is a number of characters containd in the first to (N+1)th
- dismesions. We get `char-index' of a `code-point' from this
+ is the number of characters contained in the first through (N+1)th
+ dimensions, except that there is no <code_space>[15].
+ We get `char-index' of a `code-point' from this
information. */
- int code_space[16];
+ int code_space[15];
/* If B is a byte of Nth dimension of a code-point, the (N-1)th bit
of code_space_mask[B] is set. This array is used to quickly
number of the charset. Otherwise, signal an error. */
#define CHECK_CHARSET_GET_ID(x, id) \
do { \
- int idx; \
+ ptrdiff_t idx; \
\
if (! SYMBOLP (x) || (idx = CHARSET_SYMBOL_HASH_INDEX (x)) < 0) \
wrong_type_argument (Qcharsetp, (x)); \
/* Return a code point of CHAR in CHARSET.
Try some optimization before calling encode_char. */
-#define ENCODE_CHAR(charset, c) \
- ((ASCII_CHAR_P (c) && (charset)->ascii_compatible_p) \
- ? (c) \
- : ((charset)->unified_p \
- || (charset)->method == CHARSET_METHOD_SUBSET \
- || (charset)->method == CHARSET_METHOD_SUPERSET) \
- ? encode_char ((charset), (c)) \
- : ((c) < (charset)->min_char || (c) > (charset)->max_char) \
- ? (charset)->invalid_code \
- : (charset)->method == CHARSET_METHOD_OFFSET \
- ? ((charset)->code_linear_p \
- ? (c) - (charset)->code_offset + (charset)->min_code \
- : encode_char ((charset), (c))) \
- : (charset)->method == CHARSET_METHOD_MAP \
- ? (((charset)->compact_codes_p \
- && CHAR_TABLE_P (CHARSET_ENCODER (charset))) \
- ? (charset_work = CHAR_TABLE_REF (CHARSET_ENCODER (charset), (c)), \
- (NILP (charset_work) \
- ? (charset)->invalid_code \
- : XFASTINT (charset_work))) \
- : encode_char ((charset), (c))) \
- : encode_char ((charset), (c)))
+#define ENCODE_CHAR(charset, c) \
+ (verify_expr \
+ (sizeof (c) <= sizeof (int), \
+ (ASCII_CHAR_P (c) && (charset)->ascii_compatible_p \
+ ? (c) \
+ : ((charset)->unified_p \
+ || (charset)->method == CHARSET_METHOD_SUBSET \
+ || (charset)->method == CHARSET_METHOD_SUPERSET) \
+ ? encode_char (charset, c) \
+ : (c) < (charset)->min_char || (c) > (charset)->max_char \
+ ? (charset)->invalid_code \
+ : (charset)->method == CHARSET_METHOD_OFFSET \
+ ? ((charset)->code_linear_p \
+ ? (c) - (charset)->code_offset + (charset)->min_code \
+ : encode_char (charset, c)) \
+ : (charset)->method == CHARSET_METHOD_MAP \
+ ? (((charset)->compact_codes_p \
+ && CHAR_TABLE_P (CHARSET_ENCODER (charset))) \
+ ? (charset_work = CHAR_TABLE_REF (CHARSET_ENCODER (charset), c), \
+ (NILP (charset_work) \
+ ? (charset)->invalid_code \
+ : XFASTINT (charset_work))) \
+ : encode_char (charset, c)) \
+ : encode_char (charset, c))))
/* Set to 1 when a charset map is loaded to warn that a buffer text
extern Lisp_Object Qascii;
extern int charset_ascii, charset_eight_bit;
-extern int charset_iso_8859_1;
extern int charset_unicode;
extern int charset_jisx0201_roman;
extern int charset_jisx0208_1978;