1 /* Header for UCS-4 character representation.
2 Copyright (C) 1999 Electrotechnical Laboratory, JAPAN.
3 Licensed to the Free Software Foundation.
5 This file is part of XEmacs.
7 XEmacs is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with XEmacs; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 /* Rewritten by MORIOKA Tomohiko <tomo@m17n.org>. */
24 #ifndef _XEMACS_CHAR_UCS_H
25 #define _XEMACS_CHAR_UCS_H
27 #define valid_char_p(ch) 1
29 #define CHAR_ASCII_P(ch) ((ch) <= 0x7F)
32 DECLARE_LRECORD (char_byte_table, struct Lisp_Char_Byte_Table);
33 #define XCHAR_BYTE_TABLE(x) \
34 XRECORD (x, char_byte_table, struct Lisp_Char_Byte_Table)
35 #define XSETCHAR_BYTE_TABLE(x, p) XSETRECORD (x, p, char_byte_table)
36 #define CHAR_BYTE_TABLE_P(x) RECORDP (x, char_byte_table)
37 #define GC_CHAR_BYTE_TABLE_P(x) GC_RECORDP (x, char_byte_table)
38 /* #define CHECK_CHAR_BYTE_TABLE(x) CHECK_RECORD (x, char_byte_table)
39 char table entries should never escape to Lisp */
41 struct Lisp_Char_Byte_Table
43 struct lcrecord_header header;
45 Lisp_Object property[256];
48 Lisp_Object get_char_code_table (Emchar ch, Lisp_Object table);
51 extern Lisp_Object Vcharset_ucs_bmp;
52 extern Lisp_Object Vcharset_latin_jisx0201;
53 extern Lisp_Object Vcharset_latin_iso8859_2;
54 extern Lisp_Object Vcharset_latin_iso8859_3;
55 extern Lisp_Object Vcharset_latin_iso8859_4;
56 extern Lisp_Object Vcharset_latin_iso8859_9;
57 extern Lisp_Object Vcharset_latin_viscii_lower;
58 extern Lisp_Object Vcharset_latin_viscii_upper;
61 /************************************************************************/
62 /* Definition of leading bytes */
63 /************************************************************************/
65 typedef int Charset_ID;
67 #define MIN_LEADING_BYTE 0x80
69 #define LEADING_BYTE_UCS_BMP 0x80
70 #define LEADING_BYTE_CONTROL_1 0x81 /* represent normal 80-9F */
71 #define LEADING_BYTE_HIRAGANA_JISX0208 0x82
72 #define LEADING_BYTE_KATAKANA_JISX0208 0x83
73 #define LEADING_BYTE_LATIN_VISCII 0x84
75 #define MIN_LEADING_BYTE_PRIVATE 0x85
76 #define MAX_LEADING_BYTE_PRIVATE 0x94
79 #define CHARSET_ID_OFFSET_94 (0x95 - '0')
81 #define MIN_CHARSET_ID_PRIVATE_94 (CHARSET_ID_OFFSET_94 + '0')
82 #define MAX_CHARSET_ID_PRIVATE_94 (CHARSET_ID_OFFSET_94 + '?')
85 #define LEADING_BYTE_ASCII (CHARSET_ID_OFFSET_94 + 'B')
87 /* Right half of JIS X0201-1976 */
88 #define LEADING_BYTE_KATAKANA_JISX0201 (CHARSET_ID_OFFSET_94 + 'I')
90 /* Left half of JIS X0201-1976 */
91 #define LEADING_BYTE_LATIN_JISX0201 (CHARSET_ID_OFFSET_94 + 'J')
94 #define CHARSET_ID_OFFSET_96 (0xB0 - '0')
96 #define LEADING_BYTE_LATIN_VISCII_LOWER (CHARSET_ID_OFFSET_96 + '1')
97 #define LEADING_BYTE_LATIN_VISCII_UPPER (CHARSET_ID_OFFSET_96 + '2')
99 /* Right half of ISO 8859-1 */
100 #define LEADING_BYTE_LATIN_ISO8859_1 (CHARSET_ID_OFFSET_96 + 'A')
102 /* Right half of ISO 8859-2 */
103 #define LEADING_BYTE_LATIN_ISO8859_2 (CHARSET_ID_OFFSET_96 + 'B')
105 /* Right half of ISO 8859-3 */
106 #define LEADING_BYTE_LATIN_ISO8859_3 (CHARSET_ID_OFFSET_96 + 'C')
108 /* Right half of ISO 8859-4 */
109 #define LEADING_BYTE_LATIN_ISO8859_4 (CHARSET_ID_OFFSET_96 + 'D')
111 /* Right half of ISO 8859-7 */
112 #define LEADING_BYTE_GREEK_ISO8859_7 (CHARSET_ID_OFFSET_96 + 'F')
114 /* Right half of ISO 8859-6 */
115 #define LEADING_BYTE_ARABIC_ISO8859_6 (CHARSET_ID_OFFSET_96 + 'G')
117 /* Right half of ISO 8859-8 */
118 #define LEADING_BYTE_HEBREW_ISO8859_8 (CHARSET_ID_OFFSET_96 + 'H')
120 /* Right half of ISO 8859-5 */
121 #define LEADING_BYTE_CYRILLIC_ISO8859_5 (CHARSET_ID_OFFSET_96 + 'L')
123 /* Right half of ISO 8859-9 */
124 #define LEADING_BYTE_LATIN_ISO8859_9 (CHARSET_ID_OFFSET_96 + 'M')
127 #define LEADING_BYTE_THAI_TIS620 (CHARSET_ID_OFFSET_96 + 'T')
130 #define CHARSET_ID_OFFSET_94x94 (0xE0 - '0')
133 #define LEADING_BYTE_CHINESE_BIG5_1 ('0' + CHARSET_ID_OFFSET_94x94)
136 #define LEADING_BYTE_CHINESE_BIG5_2 ('1' + CHARSET_ID_OFFSET_94x94)
138 #define MIN_LEADING_BYTE_PRIVATE_2 ('0' + CHARSET_ID_OFFSET_94x94)
139 #define MAX_LEADING_BYTE_PRIVATE_2 ('?' + CHARSET_ID_OFFSET_94x94)
141 /* Japanese JIS X0208-1978 */
142 #define LEADING_BYTE_JAPANESE_JISX0208_1978 \
143 ('@' + CHARSET_ID_OFFSET_94x94)
145 /* Chinese Hanzi GB2312-1980 */
146 #define LEADING_BYTE_CHINESE_GB2312 ('A' + CHARSET_ID_OFFSET_94x94)
148 /* Japanese JIS X0208-1983 */
149 #define LEADING_BYTE_JAPANESE_JISX0208 ('B' + CHARSET_ID_OFFSET_94x94)
151 /* Hangul KS C5601-1987 */
152 #define LEADING_BYTE_KOREAN_KSC5601 ('C' + CHARSET_ID_OFFSET_94x94)
154 /* Japanese JIS X0212-1990 */
155 #define LEADING_BYTE_JAPANESE_JISX0212 ('D' + CHARSET_ID_OFFSET_94x94)
157 /* CCITT Extended GB */
158 #define LEADING_BYTE_CHINESE_CCITT_GB ('E' + CHARSET_ID_OFFSET_94x94)
160 /* Chinese CNS11643 Set 1 */
161 #define LEADING_BYTE_CHINESE_CNS11643_1 ('G' + CHARSET_ID_OFFSET_94x94)
163 /* Chinese CNS11643 Set 2 */
164 #define LEADING_BYTE_CHINESE_CNS11643_2 ('H' + CHARSET_ID_OFFSET_94x94)
166 /* Chinese CNS11643 Set 3 */
167 #define LEADING_BYTE_CHINESE_CNS11643_3 ('I' + CHARSET_ID_OFFSET_94x94)
169 /* Chinese CNS11643 Set 4 */
170 #define LEADING_BYTE_CHINESE_CNS11643_4 ('J' + CHARSET_ID_OFFSET_94x94)
172 /* Chinese CNS11643 Set 5 */
173 #define LEADING_BYTE_CHINESE_CNS11643_5 ('K' + CHARSET_ID_OFFSET_94x94)
175 /* Chinese CNS11643 Set 6 */
176 #define LEADING_BYTE_CHINESE_CNS11643_6 ('L' + CHARSET_ID_OFFSET_94x94)
178 /* Chinese CNS11643 Set 7 */
179 #define LEADING_BYTE_CHINESE_CNS11643_7 ('M' + CHARSET_ID_OFFSET_94x94)
181 /* DPRK Hangul KPS 9566-1997 */
182 #define LEADING_BYTE_KOREAN_KPS9566 ('N' + CHARSET_ID_OFFSET_94x94)
185 #define NUM_LEADING_BYTES 256
188 /************************************************************************/
189 /* Information about a particular character set */
190 /************************************************************************/
194 struct lcrecord_header header;
198 Lisp_Object doc_string, registry, short_name, long_name;
200 Lisp_Object reverse_direction_charset;
202 Lisp_Object ccl_program;
204 /* Final byte of this character set in ISO2022 designating escape sequence */
207 /* Number of columns a character in this charset takes up, on TTY
208 devices. Not used for X devices. */
209 unsigned int columns;
211 /* Direction of this character set */
212 unsigned int direction;
214 /* Type of this character set (94, 96, 94x94, 96x96) */
217 /* Number of bytes used in encoding of this character set (1 or 2) */
218 unsigned int dimension;
220 /* Number of chars in each dimension (usually 94 or 96) */
223 /* Which half of font to be used to display this character set */
224 unsigned int graphic;
226 /* Byte->character mapping table */
227 Lisp_Object decoding_table;
229 /* Character->byte mapping table */
230 Lisp_Object encoding_table;
232 /* Range of character code */
233 Emchar ucs_min, ucs_max;
235 /* Offset for external code */
238 /* Offset for each byte */
242 DECLARE_LRECORD (charset, struct Lisp_Charset);
243 #define XCHARSET(x) XRECORD (x, charset, struct Lisp_Charset)
244 #define XSETCHARSET(x, p) XSETRECORD (x, p, charset)
245 #define CHARSETP(x) RECORDP (x, charset)
246 #define GC_CHARSETP(x) GC_RECORDP (x, charset)
247 #define CHECK_CHARSET(x) CHECK_RECORD (x, charset)
248 #define CONCHECK_CHARSET(x) CONCHECK_RECORD (x, charset)
250 #define CHARSET_TYPE_94 0 /* This charset includes 94 characters. */
251 #define CHARSET_TYPE_94X94 1 /* This charset includes 94x94 characters. */
252 #define CHARSET_TYPE_96 2 /* This charset includes 96 characters. */
253 #define CHARSET_TYPE_96X96 3 /* This charset includes 96x96 characters. */
254 #define CHARSET_TYPE_128 4 /* This charset includes 128 characters. */
255 #define CHARSET_TYPE_128X128 5 /* This charset includes 128x128 characters. */
256 #define CHARSET_TYPE_256 6 /* This charset includes 256 characters. */
257 #define CHARSET_TYPE_256X256 7 /* This charset includes 256x256 characters. */
259 #define CHARSET_LEFT_TO_RIGHT 0
260 #define CHARSET_RIGHT_TO_LEFT 1
262 /* Leading byte and id have been regrouped. -- OG */
263 #define CHARSET_ID(cs) ((cs)->id)
264 #define CHARSET_LEADING_BYTE(cs) ((Bufbyte)(CHARSET_ID(cs)))
265 #define CHARSET_NAME(cs) ((cs)->name)
266 #define CHARSET_SHORT_NAME(cs) ((cs)->short_name)
267 #define CHARSET_LONG_NAME(cs) ((cs)->long_name)
268 #define CHARSET_COLUMNS(cs) ((cs)->columns)
269 #define CHARSET_GRAPHIC(cs) ((cs)->graphic)
270 #define CHARSET_TYPE(cs) ((cs)->type)
271 #define CHARSET_DIRECTION(cs) ((cs)->direction)
272 #define CHARSET_FINAL(cs) ((cs)->final)
273 #define CHARSET_DOC_STRING(cs) ((cs)->doc_string)
274 #define CHARSET_REGISTRY(cs) ((cs)->registry)
275 #define CHARSET_CCL_PROGRAM(cs) ((cs)->ccl_program)
276 #define CHARSET_DIMENSION(cs) ((cs)->dimension)
277 #define CHARSET_CHARS(cs) ((cs)->chars)
278 #define CHARSET_REVERSE_DIRECTION_CHARSET(cs) ((cs)->reverse_direction_charset)
279 #define CHARSET_DECODING_TABLE(cs) ((cs)->decoding_table)
280 #define CHARSET_ENCODING_TABLE(cs) ((cs)->encoding_table)
281 #define CHARSET_UCS_MIN(cs) ((cs)->ucs_min)
282 #define CHARSET_UCS_MAX(cs) ((cs)->ucs_max)
283 #define CHARSET_CODE_OFFSET(cs) ((cs)->code_offset)
284 #define CHARSET_BYTE_OFFSET(cs) ((cs)->byte_offset)
287 #define XCHARSET_ID(cs) CHARSET_ID (XCHARSET (cs))
288 #define XCHARSET_NAME(cs) CHARSET_NAME (XCHARSET (cs))
289 #define XCHARSET_SHORT_NAME(cs) CHARSET_SHORT_NAME (XCHARSET (cs))
290 #define XCHARSET_LONG_NAME(cs) CHARSET_LONG_NAME (XCHARSET (cs))
291 #define XCHARSET_GRAPHIC(cs) CHARSET_GRAPHIC (XCHARSET (cs))
292 #define XCHARSET_TYPE(cs) CHARSET_TYPE (XCHARSET (cs))
293 #define XCHARSET_DIRECTION(cs) CHARSET_DIRECTION (XCHARSET (cs))
294 #define XCHARSET_FINAL(cs) CHARSET_FINAL (XCHARSET (cs))
295 #define XCHARSET_DOC_STRING(cs) CHARSET_DOC_STRING (XCHARSET (cs))
296 #define XCHARSET_REGISTRY(cs) CHARSET_REGISTRY (XCHARSET (cs))
297 #define XCHARSET_LEADING_BYTE(cs) CHARSET_LEADING_BYTE (XCHARSET (cs))
298 #define XCHARSET_CCL_PROGRAM(cs) CHARSET_CCL_PROGRAM (XCHARSET (cs))
299 #define XCHARSET_DIMENSION(cs) CHARSET_DIMENSION (XCHARSET (cs))
300 #define XCHARSET_CHARS(cs) CHARSET_CHARS (XCHARSET (cs))
301 #define XCHARSET_REVERSE_DIRECTION_CHARSET(cs) \
302 CHARSET_REVERSE_DIRECTION_CHARSET (XCHARSET (cs))
303 #define XCHARSET_DECODING_TABLE(cs) CHARSET_DECODING_TABLE(XCHARSET(cs))
304 #define XCHARSET_ENCODING_TABLE(cs) CHARSET_ENCODING_TABLE(XCHARSET(cs))
305 #define XCHARSET_UCS_MIN(cs) CHARSET_UCS_MIN(XCHARSET(cs))
306 #define XCHARSET_UCS_MAX(cs) CHARSET_UCS_MAX(XCHARSET(cs))
307 #define XCHARSET_CODE_OFFSET(cs) CHARSET_CODE_OFFSET(XCHARSET(cs))
308 #define XCHARSET_BYTE_OFFSET(cs) CHARSET_BYTE_OFFSET(XCHARSET(cs))
310 /* Table of charsets indexed by (leading byte - 128). */
311 extern Lisp_Object charset_by_leading_byte[NUM_LEADING_BYTES];
313 /* Table of charsets indexed by type/final-byte. */
314 extern Lisp_Object charset_by_attributes[4][128];
316 #ifdef ERROR_CHECK_TYPECHECK
317 /* int not Bufbyte even though that is the actual type of a leading byte.
318 This way, out-ot-range values will get caught rather than automatically
320 INLINE Lisp_Object CHARSET_BY_LEADING_BYTE (Charset_ID lb);
322 CHARSET_BY_LEADING_BYTE (Charset_ID lb)
324 assert (lb >= MIN_LEADING_BYTE &&
325 lb < (MIN_LEADING_BYTE + NUM_LEADING_BYTES));
326 return charset_by_leading_byte[lb - MIN_LEADING_BYTE];
331 #define CHARSET_BY_LEADING_BYTE(lb) \
332 (charset_by_leading_byte[(lb) - MIN_LEADING_BYTE])
336 #define CHARSET_BY_ATTRIBUTES(type, final, dir) \
337 (charset_by_attributes[type][final])
340 /************************************************************************/
341 /* Dealing with characters */
342 /************************************************************************/
344 #define MAX_CHAR_BASIC_LATIN 0x007F
346 #define MIN_CHAR_GREEK 0x0370
347 #define MAX_CHAR_GREEK 0x03CF
349 #define MIN_CHAR_CYRILLIC 0x0400
350 #define MAX_CHAR_CYRILLIC 0x045F
352 #define MIN_CHAR_HEBREW 0x0590
353 #define MAX_CHAR_HEBREW 0x05EF
355 #define MIN_CHAR_THAI 0x0E00
356 #define MAX_CHAR_THAI 0x0E5F
358 #define MIN_CHAR_HIRAGANA 0x3041
359 #define MAX_CHAR_HIRAGANA 0x3093
361 #define MIN_CHAR_KATAKANA 0x30A1
362 #define MAX_CHAR_KATAKANA 0x30F6
364 #define MIN_CHAR_HALFWIDTH_KATAKANA 0xFF61
365 #define MAX_CHAR_HALFWIDTH_KATAKANA 0xFF9F
367 #define MIN_CHAR_OBS_94x94 0xE00000
368 #define MAX_CHAR_OBS_94x94 (0xE00000 + 94 * 94 * 14 - 1)
370 #define MIN_CHAR_94 0xE90940
371 #define MAX_CHAR_94 (MIN_CHAR_94 + 94 * 80 - 1)
372 #define MIN_CHAR_96 (MIN_CHAR_94 + 94 * 80)
373 #define MAX_CHAR_96 (MIN_CHAR_96 + 96 * 80 - 1)
375 #define MIN_CHAR_94x94 0xE9F6C0
376 #define MAX_CHAR_94x94 (MIN_CHAR_94x94 + 94 * 94 * 80 - 1)
377 #define MIN_CHAR_96x96 0xF4C000
378 #define MAX_CHAR_96x96 (MIN_CHAR_96x96 + 96 * 96 * 80 - 1)
381 /* Return a character whose charset is CHARSET and position-codes
382 are C1 and C2. TYPE9N character ignores C2. */
384 INLINE Emchar MAKE_CHAR (Lisp_Object charset, int c1, int c2);
386 MAKE_CHAR (Lisp_Object charset, int c1, int c2)
388 Lisp_Object decoding_table = XCHARSET_DECODING_TABLE (charset);
392 if (!EQ (decoding_table, Qnil)
393 && (0 <= (idx = c1 - XCHARSET_BYTE_OFFSET (charset)))
394 && (idx < XVECTOR_LENGTH (decoding_table))
395 && !EQ (ch = XVECTOR_DATA(decoding_table)[idx], Qnil))
399 if ((0 <= (idx = c2 - XCHARSET_BYTE_OFFSET (charset)))
400 && (idx < XVECTOR_LENGTH (ch))
401 && !EQ (ch = XVECTOR_DATA(ch)[idx], Qnil))
407 if (EQ (charset, Vcharset_katakana_jisx0201))
409 return c1 + MIN_CHAR_HALFWIDTH_KATAKANA - 33;
411 /* return MIN_CHAR_94 + ('I' - '0') * 94 + (c1 - 33); */
413 else if (XCHARSET_UCS_MAX (charset))
416 = (XCHARSET_DIMENSION (charset) == 1
418 c1 - XCHARSET_BYTE_OFFSET (charset)
420 (c1 - XCHARSET_BYTE_OFFSET (charset)) * XCHARSET_CHARS (charset)
421 + c2 - XCHARSET_BYTE_OFFSET (charset))
422 - XCHARSET_CODE_OFFSET (charset) + XCHARSET_UCS_MIN (charset);
423 if ((code < XCHARSET_UCS_MIN (charset))
424 || (XCHARSET_UCS_MAX (charset) < code))
425 signal_simple_error ("Arguments makes invalid character",
429 else if (XCHARSET_DIMENSION (charset) == 1)
431 switch (XCHARSET_CHARS (charset))
435 + (XCHARSET_FINAL (charset) - '0') * 94 + (c1 - 33);
438 + (XCHARSET_FINAL (charset) - '0') * 96 + (c1 - 32);
445 switch (XCHARSET_CHARS (charset))
448 return MIN_CHAR_94x94
449 + (XCHARSET_FINAL (charset) - '0') * 94 * 94
450 + (c1 - 33) * 94 + (c2 - 33);
452 return MIN_CHAR_96x96
453 + (XCHARSET_FINAL (charset) - '0') * 96 * 96
454 + (c1 - 32) * 96 + (c2 - 32);
461 unsigned char charset_get_byte1 (Lisp_Object charset, Emchar ch);
462 unsigned char charset_get_byte2 (Lisp_Object charset, Emchar ch);
464 extern Lisp_Object Vdefault_coded_charset_priority_list;
465 EXFUN (Ffind_charset, 1);
467 INLINE void breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2);
469 breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2)
471 if (c < MIN_CHAR_OBS_94x94)
473 Lisp_Object charsets = Vdefault_coded_charset_priority_list;
474 while (!EQ (charsets, Qnil))
476 *charset = Ffind_charset (Fcar (charsets));
477 if (!EQ (*charset, Qnil)
478 && (*c1 = charset_get_byte1 (*charset, c)) )
480 *c2 = charset_get_byte2 (*charset, c);
483 charsets = Fcdr (charsets);
485 /* otherwise --- maybe for bootstrap */
486 if (c <= MAX_CHAR_BASIC_LATIN)
488 *charset = Vcharset_ascii;
489 *c1 = charset_get_byte1 (*charset, c);
490 *c2 = charset_get_byte2 (*charset, c);
494 *charset = Vcharset_control_1;
495 *c1 = charset_get_byte1 (*charset, c);
496 *c2 = charset_get_byte2 (*charset, c);
500 *charset = Vcharset_latin_iso8859_1;
501 *c1 = charset_get_byte1 (*charset, c);
502 *c2 = charset_get_byte2 (*charset, c);
504 else if ((MIN_CHAR_GREEK <= c) && (c <= MAX_CHAR_GREEK))
506 *charset = Vcharset_greek_iso8859_7;
507 *c1 = c - MIN_CHAR_GREEK + 0x20;
510 else if ((MIN_CHAR_CYRILLIC <= c) && (c <= MAX_CHAR_CYRILLIC))
512 *charset = Vcharset_cyrillic_iso8859_5;
513 *c1 = c - MIN_CHAR_CYRILLIC + 0x20;
516 else if ((MIN_CHAR_HEBREW <= c) && (c <= MAX_CHAR_HEBREW))
518 *charset = Vcharset_hebrew_iso8859_8;
519 *c1 = c - MIN_CHAR_HEBREW + 0x20;
522 else if ((MIN_CHAR_THAI <= c) && (c <= MAX_CHAR_THAI))
524 *charset = Vcharset_thai_tis620;
525 *c1 = c - MIN_CHAR_THAI + 0x20;
528 else if ((MIN_CHAR_HALFWIDTH_KATAKANA <= c)
529 && (c <= MAX_CHAR_HALFWIDTH_KATAKANA))
531 *charset = Vcharset_katakana_jisx0201;
532 *c1 = c - MIN_CHAR_HALFWIDTH_KATAKANA + 33;
537 *charset = Vcharset_ucs_bmp;
542 else if (c <= MAX_CHAR_OBS_94x94)
545 = CHARSET_BY_ATTRIBUTES (CHARSET_TYPE_94X94,
546 ((c - MIN_CHAR_OBS_94x94) / (94 * 94)) + '@',
547 CHARSET_LEFT_TO_RIGHT);
548 *c1 = (((c - MIN_CHAR_OBS_94x94) / 94) % 94) + 33;
549 *c2 = ((c - MIN_CHAR_OBS_94x94) % 94) + 33;
551 else if (c <= MAX_CHAR_94)
554 = CHARSET_BY_ATTRIBUTES (CHARSET_TYPE_94,
555 ((c - MIN_CHAR_94) / 94) + '0',
556 CHARSET_LEFT_TO_RIGHT);
557 *c1 = ((c - MIN_CHAR_94) % 94) + 33;
560 else if (c <= MAX_CHAR_96)
563 = CHARSET_BY_ATTRIBUTES (CHARSET_TYPE_96,
564 ((c - MIN_CHAR_96) / 96) + '0',
565 CHARSET_LEFT_TO_RIGHT);
566 *c1 = ((c - MIN_CHAR_96) % 96) + 32;
569 else if (c <= MAX_CHAR_94x94)
572 = CHARSET_BY_ATTRIBUTES (CHARSET_TYPE_94X94,
573 ((c - MIN_CHAR_94x94) / (94 * 94)) + '0',
574 CHARSET_LEFT_TO_RIGHT);
575 *c1 = (((c - MIN_CHAR_94x94) / 94) % 94) + 33;
576 *c2 = ((c - MIN_CHAR_94x94) % 94) + 33;
578 else if (c <= MAX_CHAR_96x96)
581 = CHARSET_BY_ATTRIBUTES (CHARSET_TYPE_96X96,
582 ((c - MIN_CHAR_96x96) / (96 * 96)) + '0',
583 CHARSET_LEFT_TO_RIGHT);
584 *c1 = (((c - MIN_CHAR_96x96) / 96) % 96) + 32;
585 *c2 = ((c - MIN_CHAR_96x96) % 96) + 32;
594 #define BREAKUP_CHAR(ch, charset, b1, b2) \
595 breakup_char_1 (ch, &(charset), &(b1), &(b2))
597 INLINE Lisp_Object CHAR_CHARSET (Emchar ch);
599 CHAR_CHARSET (Emchar ch)
604 BREAKUP_CHAR(ch, charset, b1, b2);
608 #define CHAR_LEADING_BYTE(c) (XCHARSET_LEADING_BYTE(CHAR_CHARSET(c)))
610 #define CHAR_COLUMNS(c) (CHARSET_COLUMNS(XCHARSET(CHAR_CHARSET(c))))
613 /************************************************************************/
614 /* Exported functions */
615 /************************************************************************/
617 EXFUN (Fget_charset, 1);
619 extern Lisp_Object Vcharset_chinese_big5_1;
620 extern Lisp_Object Vcharset_chinese_big5_2;
621 extern Lisp_Object Vcharset_japanese_jisx0208;
622 extern Lisp_Object Vcharset_japanese_jisx0212;
624 #endif /* _XEMACS_CHAR_UCS_H */