/* Definition of leading bytes */
/************************************************************************/
+typedef unsigned char Charset_ID;
+
#define MIN_LEADING_BYTE 0x80
/* These need special treatment in a string and/or character */
#define LEADING_BYTE_ASCII 0x8E /* Omitted in a buffer */
CHARSET_REVERSE_DIRECTION_CHARSET (XCHARSET (cs))
struct charset_lookup {
- /* Table of charsets indexed by leading byte. */
- Lisp_Object charset_by_leading_byte[128];
+ /* Table of charsets indexed by (leading byte - MIN_LEADING_BYTE). */
+ Lisp_Object charset_by_leading_byte[NUM_LEADING_BYTES];
/* Table of charsets indexed by type/final-byte/direction. */
Lisp_Object charset_by_attributes[4][128][2];
+
+ Charset_ID next_allocated_1_byte_leading_byte;
+ Charset_ID next_allocated_2_byte_leading_byte;
};
extern struct charset_lookup *chlook;
INLINE_HEADER Lisp_Object
CHARSET_BY_LEADING_BYTE (int lb)
{
- assert (lb >= 0x80 && lb <= 0xFF);
- return chlook->charset_by_leading_byte[lb - 128];
+ assert (lb >= MIN_LEADING_BYTE &&
+ lb < (MIN_LEADING_BYTE + NUM_LEADING_BYTES));
+ return chlook->charset_by_leading_byte[lb - MIN_LEADING_BYTE];
}
#else
-#define CHARSET_BY_LEADING_BYTE(lb) (chlook->charset_by_leading_byte[(lb) - 128])
+#define CHARSET_BY_LEADING_BYTE(lb) \
+ (chlook->charset_by_leading_byte[(lb) - MIN_LEADING_BYTE])
#endif
-#define CHARSET_BY_ATTRIBUTES(type, final, dir) \
- (chlook->charset_by_attributes[type][final][dir])
-
+INLINE_HEADER Lisp_Object
+CHARSET_BY_ATTRIBUTES (int chars, int multi, int final, int dir);
+INLINE_HEADER Lisp_Object
+CHARSET_BY_ATTRIBUTES (int chars, int dimension, int final, int dir)
+{
+ return chlook->charset_by_attributes[(dimension == 1 ? 0 : 2)
+ + (chars == 94 ? 0 : 1)][final][dir];
+}
/* Table of number of bytes in the string representation of a character
indexed by the first byte of that representation.
/* Dealing with characters */
/************************************************************************/
-/* Is this character represented by more than one byte in a string? */
-
-#define CHAR_MULTIBYTE_P(c) ((c) >= 0x80)
-
-#define CHAR_ASCII_P(c) (!CHAR_MULTIBYTE_P (c))
+#define CHAR_ASCII_P(ch) ((ch) <= 0x7F)
/* The bit fields of character are divided into 3 parts:
FIELD1(5bits):FIELD2(7bits):FIELD3(7bits) */