#define CHAR_ASCII_P(ch) ((ch) <= 0x7F)
\f
-typedef struct
+DECLARE_LRECORD (char_byte_table, struct Lisp_Char_Byte_Table);
+#define XCHAR_BYTE_TABLE(x) \
+ XRECORD (x, char_byte_table, struct Lisp_Char_Byte_Table)
+#define XSETCHAR_BYTE_TABLE(x, p) XSETRECORD (x, p, char_byte_table)
+#define CHAR_BYTE_TABLE_P(x) RECORDP (x, char_byte_table)
+#define GC_CHAR_BYTE_TABLE_P(x) GC_RECORDP (x, char_byte_table)
+/* #define CHECK_CHAR_BYTE_TABLE(x) CHECK_RECORD (x, char_byte_table)
+ char table entries should never escape to Lisp */
+
+struct Lisp_Char_Byte_Table
{
- unsigned char *base;
- size_t offset;
- size_t size;
-} Emchar_to_byte_table;
+ struct lcrecord_header header;
+
+ Lisp_Object property[256];
+};
+
+
+DECLARE_LRECORD (char_code_table, struct Lisp_Char_Code_Table);
+#define XCHAR_CODE_TABLE(x) \
+ XRECORD (x, char_code_table, struct Lisp_Char_Code_Table)
+#define XSETCHAR_CODE_TABLE(x, p) XSETRECORD (x, p, char_code_table)
+#define CHAR_CODE_TABLE_P(x) RECORDP (x, char_code_table)
+#define GC_CHAR_CODE_TABLE_P(x) GC_RECORDP (x, char_code_table)
+/* #define CHECK_CHAR_CODE_TABLE(x) CHECK_RECORD (x, char_code_table)
+ char table entries should never escape to Lisp */
+
+struct Lisp_Char_Code_Table
+{
+ struct lcrecord_header header;
+
+ Lisp_Object table;
+};
-unsigned char
-get_byte_from_character_table (Emchar ch, Emchar_to_byte_table* table);
+Lisp_Object get_char_code_table (Emchar ch, Lisp_Object table);
extern Lisp_Object Vcharset_ucs_bmp;
typedef int Charset_ID;
-#define MIN_LEADING_BYTE 0x80
+#define MIN_LEADING_BYTE -0x40
+#define CHARSET_ID_OFFSET 0x00
+
+/* represent normal 80-9F */
+#define LEADING_BYTE_CONTROL_1 (CHARSET_ID_OFFSET - 1)
+
+/* ISO/IEC 10646 BMP */
+#define LEADING_BYTE_UCS_BMP (CHARSET_ID_OFFSET - 2)
-#define LEADING_BYTE_UCS_BMP 0x80
-#define LEADING_BYTE_CONTROL_1 0x81 /* represent normal 80-9F */
+/* VISCII 1.1 */
+#define LEADING_BYTE_LATIN_VISCII (CHARSET_ID_OFFSET - 3)
+/* MULE VISCII-LOWER (CHARSET_ID_OFFSET_96 + '1') */
+#define LEADING_BYTE_LATIN_VISCII_LOWER (CHARSET_ID_OFFSET - 4)
-#define CHARSET_ID_OFFSET_94 0x55
+/* MULE VISCII-UPPER (CHARSET_ID_OFFSET_96 + '2') */
+#define LEADING_BYTE_LATIN_VISCII_UPPER (CHARSET_ID_OFFSET - 5)
-#define MIN_CHARSET_ID_PRIVATE_94 (CHARSET_ID_OFFSET_94 + '0')
-#define MAX_CHARSET_ID_PRIVATE_94 (CHARSET_ID_OFFSET_94 + '?')
+/* Big5 Level 1 2/4 2/{(8),9,10,11} 4/0 '0' */
+#define LEADING_BYTE_CHINESE_BIG5_1 (CHARSET_ID_OFFSET - 6)
+
+/* Big5 Level 2 2/4 2/{(8),9,10,11} 4/0 '1' */
+#define LEADING_BYTE_CHINESE_BIG5_2 (CHARSET_ID_OFFSET - 7)
+
+#define LEADING_BYTE_ETHIOPIC_UCS (CHARSET_ID_OFFSET - 8)
+
+#define LEADING_BYTE_DAIKANWA (CHARSET_ID_OFFSET - 9)
+
+#define MIN_LEADING_BYTE_PRIVATE MIN_LEADING_BYTE
+#define MAX_LEADING_BYTE_PRIVATE (CHARSET_ID_OFFSET - 10)
+
+
+/* #define CHARSET_ID_OFFSET_94 (CHARSET_ID_OFFSET - '0') */
+
+/* #define MIN_CHARSET_ID_PRIVATE_94 (CHARSET_ID_OFFSET_94 + '0') */
+/* #define MAX_CHARSET_ID_PRIVATE_94 (CHARSET_ID_OFFSET_94 + '?') */
/* ISO 646 IRV */
-#define LEADING_BYTE_ASCII (CHARSET_ID_OFFSET_94 + 'B')
+#define LEADING_BYTE_ASCII 6 /* (CHARSET_ID_OFFSET_94 + 'B') */
/* Right half of JIS X0201-1976 */
-#define LEADING_BYTE_KATAKANA_JISX0201 (CHARSET_ID_OFFSET_94 + 'I')
+#define LEADING_BYTE_KATAKANA_JISX0201 13 /* (CHARSET_ID_OFFSET_94 + 'I') */
/* Left half of JIS X0201-1976 */
-#define LEADING_BYTE_LATIN_JISX0201 (CHARSET_ID_OFFSET_94 + 'J')
-
+#define LEADING_BYTE_LATIN_JISX0201 14 /* (CHARSET_ID_OFFSET_94 + 'J') */
-#define CHARSET_ID_OFFSET_96 0x70
-#define LEADING_BYTE_LATIN_VISCII_LOWER (CHARSET_ID_OFFSET_96 + '1')
-#define LEADING_BYTE_LATIN_VISCII_UPPER (CHARSET_ID_OFFSET_96 + '2')
+/* #define CHARSET_ID_OFFSET_96 (CHARSET_ID_OFFSET_94 + 80) */
/* Right half of ISO 8859-1 */
-#define LEADING_BYTE_LATIN_ISO8859_1 (CHARSET_ID_OFFSET_96 + 'A')
+#define LEADING_BYTE_LATIN_ISO8859_1 100 /* (CHARSET_ID_OFFSET_96 + 'A') */
/* Right half of ISO 8859-2 */
-#define LEADING_BYTE_LATIN_ISO8859_2 (CHARSET_ID_OFFSET_96 + 'B')
+#define LEADING_BYTE_LATIN_ISO8859_2 101 /* (CHARSET_ID_OFFSET_96 + 'B') */
/* Right half of ISO 8859-3 */
-#define LEADING_BYTE_LATIN_ISO8859_3 (CHARSET_ID_OFFSET_96 + 'C')
+#define LEADING_BYTE_LATIN_ISO8859_3 109 /* (CHARSET_ID_OFFSET_96 + 'C') */
/* Right half of ISO 8859-4 */
-#define LEADING_BYTE_LATIN_ISO8859_4 (CHARSET_ID_OFFSET_96 + 'D')
+#define LEADING_BYTE_LATIN_ISO8859_4 110 /* (CHARSET_ID_OFFSET_96 + 'D') */
/* Right half of ISO 8859-7 */
-#define LEADING_BYTE_GREEK_ISO8859_7 (CHARSET_ID_OFFSET_96 + 'F')
+#define LEADING_BYTE_GREEK_ISO8859_7 126 /* (CHARSET_ID_OFFSET_96 + 'F') */
/* Right half of ISO 8859-6 */
-#define LEADING_BYTE_ARABIC_ISO8859_6 (CHARSET_ID_OFFSET_96 + 'G')
+#define LEADING_BYTE_ARABIC_ISO8859_6 127 /* (CHARSET_ID_OFFSET_96 + 'G') */
/* Right half of ISO 8859-8 */
-#define LEADING_BYTE_HEBREW_ISO8859_8 (CHARSET_ID_OFFSET_96 + 'H')
+#define LEADING_BYTE_HEBREW_ISO8859_8 138 /* (CHARSET_ID_OFFSET_96 + 'H') */
/* Right half of ISO 8859-5 */
-#define LEADING_BYTE_CYRILLIC_ISO8859_5 (CHARSET_ID_OFFSET_96 + 'L')
+#define LEADING_BYTE_CYRILLIC_ISO8859_5 144 /* (CHARSET_ID_OFFSET_96 + 'L') */
/* Right half of ISO 8859-9 */
-#define LEADING_BYTE_LATIN_ISO8859_9 (CHARSET_ID_OFFSET_96 + 'M')
+#define LEADING_BYTE_LATIN_ISO8859_9 148 /* (CHARSET_ID_OFFSET_96 + 'M') */
/* TIS620-2533 */
-#define LEADING_BYTE_THAI_TIS620 (CHARSET_ID_OFFSET_96 + 'T')
-
+#define LEADING_BYTE_THAI_TIS620 166 /* (CHARSET_ID_OFFSET_96 + 'T') */
-#define MIN_LEADING_BYTE_PRIVATE_1 0xD0
-#define MAX_LEADING_BYTE_PRIVATE_1 0xDF
+/* #define CHARSET_ID_OFFSET_94x94 (CHARSET_ID_OFFSET_96 + 80) */
-#define CHARSET_ID_OFFSET_94x94 0xB0
-/* Big5 Level 1 */
-#define LEADING_BYTE_CHINESE_BIG5_1 ('0' + CHARSET_ID_OFFSET_94x94)
+/* #define MIN_LEADING_BYTE_PRIVATE_2 ('0' + CHARSET_ID_OFFSET_94x94) */
+/* #define MAX_LEADING_BYTE_PRIVATE_2 ('?' + CHARSET_ID_OFFSET_94x94) */
-/* Big5 Level 2 */
-#define LEADING_BYTE_CHINESE_BIG5_2 ('1' + CHARSET_ID_OFFSET_94x94)
+/* Japanese JIS X0208-1978 2/4 2/{(8),9,10,11} 4/0 (@) */
+#define LEADING_BYTE_JAPANESE_JISX0208_1978 42
-#define MIN_LEADING_BYTE_PRIVATE_2 ('0' + CHARSET_ID_OFFSET_94x94)
-#define MAX_LEADING_BYTE_PRIVATE_2 ('?' + CHARSET_ID_OFFSET_94x94)
+/* Chinese Hanzi GB2312-1980 2/4 2/{(8),9,10,11} 4/1 (A) */
+#define LEADING_BYTE_CHINESE_GB2312 58
-/* Japanese JIS X0208-1978 */
-#define LEADING_BYTE_JAPANESE_JISX0208_1978 \
- ('@' + CHARSET_ID_OFFSET_94x94)
+/* Japanese JIS X0208-1983 2/4 2/{(8),9,10,11} 4/2 (B) */
+#define LEADING_BYTE_JAPANESE_JISX0208 87
-/* Chinese Hanzi GB2312-1980 */
-#define LEADING_BYTE_CHINESE_GB2312 ('A' + CHARSET_ID_OFFSET_94x94)
+/* Hangul KS C5601-1987 2/4 2/{8,9,10,11} 4/3 (C) */
+#define LEADING_BYTE_KOREAN_KSC5601 149
-/* Japanese JIS X0208-1983 */
-#define LEADING_BYTE_JAPANESE_JISX0208 ('B' + CHARSET_ID_OFFSET_94x94)
+/* Japanese JIS X0212-1990 2/4 2/{8,9,10,11} 4/4 (D) */
+#define LEADING_BYTE_JAPANESE_JISX0212 159
-/* Hangul KS C5601-1987 */
-#define LEADING_BYTE_KOREAN_KSC5601 ('C' + CHARSET_ID_OFFSET_94x94)
+/* CCITT Extended GB 2/4 2/{8,9,10,11} 4/5 (E) */
+#define LEADING_BYTE_CHINESE_CCITT_GB 165
-/* Japanese JIS X0212-1990 */
-#define LEADING_BYTE_JAPANESE_JISX0212 ('D' + CHARSET_ID_OFFSET_94x94)
+/* Chinese CNS11643 Set 1 2/4 2/{8,9,10,11} 4/7 (G) */
+#define LEADING_BYTE_CHINESE_CNS11643_1 171
-/* CCITT Extended GB */
-#define LEADING_BYTE_CHINESE_CCITT_GB ('E' + CHARSET_ID_OFFSET_94x94)
+/* Chinese CNS11643 Set 2 2/4 2/{8,9,10,11} 4/8 (H) */
+#define LEADING_BYTE_CHINESE_CNS11643_2 172
-/* Chinese CNS11643 Set 1 */
-#define LEADING_BYTE_CHINESE_CNS11643_1 ('G' + CHARSET_ID_OFFSET_94x94)
+/* Chinese CNS11643 Set 3 2/4 2/{8,9,10,11} 4/9 (I) */
+#define LEADING_BYTE_CHINESE_CNS11643_3 183
-/* Chinese CNS11643 Set 2 */
-#define LEADING_BYTE_CHINESE_CNS11643_2 ('H' + CHARSET_ID_OFFSET_94x94)
+/* Chinese CNS11643 Set 4 2/4 2/{8,9,10,11} 4/10 (J) */
+#define LEADING_BYTE_CHINESE_CNS11643_4 184
-/* Chinese CNS11643 Set 3 */
-#define LEADING_BYTE_CHINESE_CNS11643_3 ('I' + CHARSET_ID_OFFSET_94x94)
+/* Chinese CNS11643 Set 5 2/4 2/{8,9,10,11} 4/11 (K) */
+#define LEADING_BYTE_CHINESE_CNS11643_5 185
-/* Chinese CNS11643 Set 4 */
-#define LEADING_BYTE_CHINESE_CNS11643_4 ('J' + CHARSET_ID_OFFSET_94x94)
+/* Chinese CNS11643 Set 6 2/4 2/{8,9,10,11} 4/12 (L) */
+#define LEADING_BYTE_CHINESE_CNS11643_6 186
-/* Chinese CNS11643 Set 5 */
-#define LEADING_BYTE_CHINESE_CNS11643_5 ('K' + CHARSET_ID_OFFSET_94x94)
+/* Chinese CNS11643 Set 7 2/4 2/{8,9,10,11} 4/13 (M) */
+#define LEADING_BYTE_CHINESE_CNS11643_7 187
-/* Chinese CNS11643 Set 6 */
-#define LEADING_BYTE_CHINESE_CNS11643_6 ('L' + CHARSET_ID_OFFSET_94x94)
+/* DPRK Hangul KPS 9566-1997 2/4 2/{8,9,10,11} 4/14 (N) */
+#define LEADING_BYTE_KOREAN_KPS9566 202
-/* Chinese CNS11643 Set 7 */
-#define LEADING_BYTE_CHINESE_CNS11643_7 ('M' + CHARSET_ID_OFFSET_94x94)
-/* DPRK Hangul KPS 9566-1997 */
-#define LEADING_BYTE_KOREAN_KPS9566 ('N' + CHARSET_ID_OFFSET_94x94)
-
-#define MIN_LEADING_BYTE_OFFICIAL_2 LEADING_BYTE_JAPANESE_JISX0208_1978
-#define MAX_LEADING_BYTE_OFFICIAL_2 LEADING_BYTE_KOREAN_KPS9566
-
-#define NUM_LEADING_BYTES 256
+#define NUM_LEADING_BYTES (80 * 3 - MIN_LEADING_BYTE)
\f
/************************************************************************/
unsigned int graphic;
/* Byte->character mapping table */
- Emchar* decoding_table;
-
- /* Character->byte mapping table */
- Emchar_to_byte_table* to_byte1_table;
- Emchar_to_byte_table* to_byte2_table;
+ Lisp_Object decoding_table;
/* Range of character code */
Emchar ucs_min, ucs_max;
- /* Offset for external representation */
+ /* Offset for external code */
Emchar code_offset;
+
+ /* Offset for each byte */
+ Emchar byte_offset;
};
DECLARE_LRECORD (charset, struct Lisp_Charset);
#define CHECK_CHARSET(x) CHECK_RECORD (x, charset)
#define CONCHECK_CHARSET(x) CONCHECK_RECORD (x, charset)
-#define CHARSET_TYPE_94 0 /* This charset includes 94 characters. */
-#define CHARSET_TYPE_96 1 /* This charset includes 96 characters. */
-#define CHARSET_TYPE_94X94 2 /* This charset includes 94x94 characters. */
-#define CHARSET_TYPE_96X96 3 /* This charset includes 96x96 characters. */
-#define CHARSET_TYPE_128X128 4 /* This charset includes 128x128 characters. */
-#define CHARSET_TYPE_256X256 5 /* This charset includes 256x256 characters. */
+#define CHARSET_TYPE_94 0 /* This charset includes 94 characters. */
+#define CHARSET_TYPE_94X94 1 /* This charset includes 94x94 characters. */
+#define CHARSET_TYPE_96 2 /* This charset includes 96 characters. */
+#define CHARSET_TYPE_96X96 3 /* This charset includes 96x96 characters. */
+#define CHARSET_TYPE_128 4 /* This charset includes 128 characters. */
+#define CHARSET_TYPE_128X128 5 /* This charset includes 128x128 characters. */
+#define CHARSET_TYPE_256 6 /* This charset includes 256 characters. */
+#define CHARSET_TYPE_256X256 7 /* This charset includes 256x256 characters. */
#define CHARSET_LEFT_TO_RIGHT 0
#define CHARSET_RIGHT_TO_LEFT 1
/* Leading byte and id have been regrouped. -- OG */
#define CHARSET_ID(cs) ((cs)->id)
-#define CHARSET_LEADING_BYTE(cs) ((Bufbyte)(CHARSET_ID(cs)))
+#define CHARSET_LEADING_BYTE(cs) (CHARSET_ID(cs))
#define CHARSET_NAME(cs) ((cs)->name)
#define CHARSET_SHORT_NAME(cs) ((cs)->short_name)
#define CHARSET_LONG_NAME(cs) ((cs)->long_name)
#define CHARSET_CHARS(cs) ((cs)->chars)
#define CHARSET_REVERSE_DIRECTION_CHARSET(cs) ((cs)->reverse_direction_charset)
#define CHARSET_DECODING_TABLE(cs) ((cs)->decoding_table)
-#define CHARSET_TO_BYTE1_TABLE(cs) ((cs)->to_byte1_table)
-#define CHARSET_TO_BYTE2_TABLE(cs) ((cs)->to_byte2_table)
#define CHARSET_UCS_MIN(cs) ((cs)->ucs_min)
#define CHARSET_UCS_MAX(cs) ((cs)->ucs_max)
#define CHARSET_CODE_OFFSET(cs) ((cs)->code_offset)
+#define CHARSET_BYTE_OFFSET(cs) ((cs)->byte_offset)
#define XCHARSET_ID(cs) CHARSET_ID (XCHARSET (cs))
#define XCHARSET_REVERSE_DIRECTION_CHARSET(cs) \
CHARSET_REVERSE_DIRECTION_CHARSET (XCHARSET (cs))
#define XCHARSET_DECODING_TABLE(cs) CHARSET_DECODING_TABLE(XCHARSET(cs))
-#define XCHARSET_TO_BYTE1_TABLE(cs) CHARSET_TO_BYTE1_TABLE(XCHARSET(cs))
-#define XCHARSET_TO_BYTE2_TABLE(cs) CHARSET_TO_BYTE2_TABLE(XCHARSET(cs))
+#define XCHARSET_UCS_MIN(cs) CHARSET_UCS_MIN(XCHARSET(cs))
+#define XCHARSET_UCS_MAX(cs) CHARSET_UCS_MAX(XCHARSET(cs))
+#define XCHARSET_CODE_OFFSET(cs) CHARSET_CODE_OFFSET(XCHARSET(cs))
+#define XCHARSET_BYTE_OFFSET(cs) CHARSET_BYTE_OFFSET(XCHARSET(cs))
/* Table of charsets indexed by (leading byte - 128). */
extern Lisp_Object charset_by_leading_byte[NUM_LEADING_BYTES];
#define MIN_CHAR_THAI 0x0E00
#define MAX_CHAR_THAI 0x0E5F
-#define MIN_CHAR_HALFWIDTH_KATAKANA 0xFF60
+#define MIN_CHAR_HIRAGANA 0x3041
+#define MAX_CHAR_HIRAGANA 0x3093
+
+#define MIN_CHAR_KATAKANA 0x30A1
+#define MAX_CHAR_KATAKANA 0x30F6
+
+#define MIN_CHAR_HALFWIDTH_KATAKANA 0xFF61
#define MAX_CHAR_HALFWIDTH_KATAKANA 0xFF9F
+#define MIN_CHAR_OBS_94x94 0xE00000
+#define MAX_CHAR_OBS_94x94 (0xE00000 + 94 * 94 * 14 - 1)
+
+#define MIN_CHAR_DAIKANWA 0xE50000
+#define MAX_CHAR_DAIKANWA 0xE5FFFF
+
#define MIN_CHAR_94 0xE90940
#define MAX_CHAR_94 (MIN_CHAR_94 + 94 * 80 - 1)
#define MIN_CHAR_96 (MIN_CHAR_94 + 94 * 80)
INLINE Emchar
MAKE_CHAR (Lisp_Object charset, int c1, int c2)
{
- Emchar* decoding_table;
-
- if ((decoding_table = XCHARSET_DECODING_TABLE (charset)) != NULL)
- return decoding_table[c1 - (XCHARSET_CHARS (charset) == 94 ? 33 : 32)];
- else if (EQ (charset, Vcharset_katakana_jisx0201))
+ Lisp_Object decoding_table = XCHARSET_DECODING_TABLE (charset);
+ int idx;
+ Lisp_Object ch;
+
+ if (!EQ (decoding_table, Qnil)
+ && (0 <= (idx = c1 - XCHARSET_BYTE_OFFSET (charset)))
+ && (idx < XVECTOR_LENGTH (decoding_table))
+ && !EQ (ch = XVECTOR_DATA(decoding_table)[idx], Qnil))
+ {
+ if (VECTORP (ch))
+ {
+ if ((0 <= (idx = c2 - XCHARSET_BYTE_OFFSET (charset)))
+ && (idx < XVECTOR_LENGTH (ch))
+ && !EQ (ch = XVECTOR_DATA(ch)[idx], Qnil))
+ return XCHAR (ch);
+ }
+ else
+ return XCHAR (ch);
+ }
+ if (EQ (charset, Vcharset_katakana_jisx0201))
if (c1 < 0x60)
- return c1 + MIN_CHAR_HALFWIDTH_KATAKANA - 0x20;
+ return c1 + MIN_CHAR_HALFWIDTH_KATAKANA - 33;
else
/* return MIN_CHAR_94 + ('I' - '0') * 94 + (c1 - 33); */
return ' ';
- else if (CHARSET_UCS_MAX (XCHARSET (charset)))
- return c1 - CHARSET_CODE_OFFSET (XCHARSET (charset))
- + CHARSET_UCS_MIN (XCHARSET (charset));
+ else if (XCHARSET_UCS_MAX (charset))
+ {
+ Emchar code
+ = (XCHARSET_DIMENSION (charset) == 1
+ ?
+ c1 - XCHARSET_BYTE_OFFSET (charset)
+ :
+ (c1 - XCHARSET_BYTE_OFFSET (charset)) * XCHARSET_CHARS (charset)
+ + c2 - XCHARSET_BYTE_OFFSET (charset))
+ - XCHARSET_CODE_OFFSET (charset) + XCHARSET_UCS_MIN (charset);
+ if ((code < XCHARSET_UCS_MIN (charset))
+ || (XCHARSET_UCS_MAX (charset) < code))
+ signal_simple_error ("Arguments makes invalid character",
+ make_char (code));
+ return code;
+ }
else if (XCHARSET_DIMENSION (charset) == 1)
{
switch (XCHARSET_CHARS (charset))
}
}
-unsigned char charset_get_byte1 (Lisp_Object charset, Emchar ch);
-unsigned char charset_get_byte2 (Lisp_Object charset, Emchar ch);
+extern Lisp_Object Vcharacter_attribute_table;
+
+Lisp_Object split_builtin_char (Emchar c);
+Lisp_Object range_charset_code_point (Lisp_Object charset, Emchar ch);
+Lisp_Object charset_code_point (Lisp_Object charset, Emchar ch);
extern Lisp_Object Vdefault_coded_charset_priority_list;
EXFUN (Ffind_charset, 1);
-INLINE void breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2);
-INLINE void
-breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2)
+INLINE Lisp_Object SPLIT_CHAR (Emchar c);
+INLINE Lisp_Object
+SPLIT_CHAR (Emchar c)
{
- if (c <= MAX_CHAR_GREEK)
- {
- Lisp_Object charsets = Vdefault_coded_charset_priority_list;
- while (!EQ (charsets, Qnil))
- {
- *charset = Ffind_charset (Fcar (charsets));
- if (!EQ (*charset, Qnil)
- && (*c1 = charset_get_byte1 (*charset, c)) )
- {
- *c2 = charset_get_byte2 (*charset, c);
- return;
- }
- charsets = Fcdr (charsets);
- }
- /* otherwise */
- if (c <= MAX_CHAR_BASIC_LATIN)
- {
- *charset = Vcharset_ascii;
- *c1 = charset_get_byte1 (*charset, c);
- *c2 = charset_get_byte2 (*charset, c);
- }
- else if (c < 0xA0)
- {
- *charset = Vcharset_control_1;
- *c1 = charset_get_byte1 (*charset, c);
- *c2 = charset_get_byte2 (*charset, c);
- }
- else if (c <= 0xff)
- {
- *charset = Vcharset_latin_iso8859_1;
- *c1 = charset_get_byte1 (*charset, c);
- *c2 = charset_get_byte2 (*charset, c);
- }
- else if ((MIN_CHAR_GREEK <= c) && (c <= MAX_CHAR_GREEK))
- {
- *charset = Vcharset_greek_iso8859_7;
- *c1 = c - MIN_CHAR_GREEK + 0x20;
- *c2 = 0;
- }
- else
- {
- *charset = Vcharset_ucs_bmp;
- *c1 = c >> 8;
- *c2 = c & 0xff;
- }
- }
- else if (c < MIN_CHAR_CYRILLIC)
- {
- *charset = Vcharset_ucs_bmp;
- *c1 = c >> 8;
- *c2 = c & 0xff;
- }
- else if (c <= MAX_CHAR_CYRILLIC)
- {
- *charset = Vcharset_cyrillic_iso8859_5;
- *c1 = c - MIN_CHAR_CYRILLIC + 0x20;
- *c2 = 0;
- }
- else if (c < MIN_CHAR_HEBREW)
- {
- *charset = Vcharset_ucs_bmp;
- *c1 = c >> 8;
- *c2 = c & 0xff;
- }
- else if (c <= MAX_CHAR_HEBREW)
- {
- *charset = Vcharset_hebrew_iso8859_8;
- *c1 = c - MIN_CHAR_HEBREW + 0x20;
- *c2 = 0;
- }
- else if (c < MIN_CHAR_THAI)
- {
- *charset = Vcharset_ucs_bmp;
- *c1 = c >> 8;
- *c2 = c & 0xff;
- }
- else if (c <= MAX_CHAR_THAI)
- {
- *charset = Vcharset_thai_tis620;
- *c1 = c - MIN_CHAR_THAI + 0x20;
- *c2 = 0;
- }
- else if (c < MIN_CHAR_HALFWIDTH_KATAKANA)
+ Lisp_Object cdef = get_char_code_table (c, Vcharacter_attribute_table);
+
+ if (!EQ (cdef, Qnil))
{
Lisp_Object charsets = Vdefault_coded_charset_priority_list;
+ Lisp_Object field;
+
while (!EQ (charsets, Qnil))
{
- *charset = Ffind_charset (Fcar (charsets));
- if (!EQ (*charset, Qnil)
- && (*c1 = charset_get_byte1 (*charset, c)) )
+ Lisp_Object charset = Ffind_charset (Fcar (charsets));
+
+ if (!EQ (charset, Qnil))
{
- *c2 = charset_get_byte2 (*charset, c);
- return;
+ if (!NILP (field = Fassq (charset, cdef)))
+ return field;
+ else if (!NILP (field = range_charset_code_point (charset, c)))
+ return Fcons (charset, field);
}
charsets = Fcdr (charsets);
}
- /* otherwise */
- *charset = Vcharset_ucs_bmp;
- *c1 = c >> 8;
- *c2 = c & 0xff;
- }
- else if (c <= MAX_CHAR_HALFWIDTH_KATAKANA)
- {
- *charset = Vcharset_katakana_jisx0201;
- *c1 = c - MIN_CHAR_HALFWIDTH_KATAKANA + 0x20;
- *c2 = 0;
- }
- else if (c <= MAX_CHAR_94)
- {
- *charset
- = CHARSET_BY_ATTRIBUTES (CHARSET_TYPE_94,
- ((c - MIN_CHAR_94) / 94) + '0',
- CHARSET_LEFT_TO_RIGHT);
- *c1 = ((c - MIN_CHAR_94) % 94) + 33;
- *c2 = 0;
}
- else if (c <= MAX_CHAR_96)
- {
- *charset
- = CHARSET_BY_ATTRIBUTES (CHARSET_TYPE_96,
- ((c - MIN_CHAR_96) / 96) + '0',
- CHARSET_LEFT_TO_RIGHT);
- *c1 = ((c - MIN_CHAR_96) % 96) + 32;
- *c2 = 0;
- }
- else if (c <= MAX_CHAR_94x94)
- {
- *charset
- = CHARSET_BY_ATTRIBUTES (CHARSET_TYPE_94X94,
- ((c - MIN_CHAR_94x94) / (94 * 94)) + '0',
- CHARSET_LEFT_TO_RIGHT);
- *c1 = (((c - MIN_CHAR_94x94) / 94) % 94) + 33;
- *c2 = ((c - MIN_CHAR_94x94) % 94) + 33;
- }
- else if (c <= MAX_CHAR_96x96)
+
+ /* otherwise --- maybe for bootstrap */
+ return split_builtin_char (c);
+}
+
+INLINE void breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2);
+INLINE void
+breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2)
+{
+ Lisp_Object ret = SPLIT_CHAR (c);
+
+ *charset = Fcar (ret);
+ ret = Fcdr (ret);
+ if (INTP (Fcar (ret)))
{
- *charset
- = CHARSET_BY_ATTRIBUTES (CHARSET_TYPE_96X96,
- ((c - MIN_CHAR_96x96) / (96 * 96)) + '0',
- CHARSET_LEFT_TO_RIGHT);
- *c1 = (((c - MIN_CHAR_96x96) / 96) % 96) + 32;
- *c2 = ((c - MIN_CHAR_96x96) % 96) + 32;
+ *c1 = XINT (Fcar (ret));
+ ret = Fcdr (ret);
+ if (INTP (Fcar (ret)))
+ *c2 = XINT (Fcar (ret));
+ else
+ *c2 = 0;
}
else
{
- printf("u+%x", c);
- abort();
+ *c1 = *c2 = 0;
}
}
return charset;
}
-#define CHAR_LEADING_BYTE(c) (XCHARSET_LEADING_BYTE(CHAR_CHARSET(c)))
-
+#define CHAR_CHARSET_ID(c) (XCHARSET_ID(CHAR_CHARSET(c)))
#define CHAR_COLUMNS(c) (CHARSET_COLUMNS(XCHARSET(CHAR_CHARSET(c))))
\f