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 CHARSET_ID_OFFSET_94 0x55
77 #define MIN_CHARSET_ID_PRIVATE_94 (CHARSET_ID_OFFSET_94 + '0')
78 #define MAX_CHARSET_ID_PRIVATE_94 (CHARSET_ID_OFFSET_94 + '?')
81 #define LEADING_BYTE_ASCII (CHARSET_ID_OFFSET_94 + 'B')
83 /* Right half of JIS X0201-1976 */
84 #define LEADING_BYTE_KATAKANA_JISX0201 (CHARSET_ID_OFFSET_94 + 'I')
86 /* Left half of JIS X0201-1976 */
87 #define LEADING_BYTE_LATIN_JISX0201 (CHARSET_ID_OFFSET_94 + 'J')
90 #define CHARSET_ID_OFFSET_96 0x70
92 #define LEADING_BYTE_LATIN_VISCII_LOWER (CHARSET_ID_OFFSET_96 + '1')
93 #define LEADING_BYTE_LATIN_VISCII_UPPER (CHARSET_ID_OFFSET_96 + '2')
95 /* Right half of ISO 8859-1 */
96 #define LEADING_BYTE_LATIN_ISO8859_1 (CHARSET_ID_OFFSET_96 + 'A')
98 /* Right half of ISO 8859-2 */
99 #define LEADING_BYTE_LATIN_ISO8859_2 (CHARSET_ID_OFFSET_96 + 'B')
101 /* Right half of ISO 8859-3 */
102 #define LEADING_BYTE_LATIN_ISO8859_3 (CHARSET_ID_OFFSET_96 + 'C')
104 /* Right half of ISO 8859-4 */
105 #define LEADING_BYTE_LATIN_ISO8859_4 (CHARSET_ID_OFFSET_96 + 'D')
107 /* Right half of ISO 8859-7 */
108 #define LEADING_BYTE_GREEK_ISO8859_7 (CHARSET_ID_OFFSET_96 + 'F')
110 /* Right half of ISO 8859-6 */
111 #define LEADING_BYTE_ARABIC_ISO8859_6 (CHARSET_ID_OFFSET_96 + 'G')
113 /* Right half of ISO 8859-8 */
114 #define LEADING_BYTE_HEBREW_ISO8859_8 (CHARSET_ID_OFFSET_96 + 'H')
116 /* Right half of ISO 8859-5 */
117 #define LEADING_BYTE_CYRILLIC_ISO8859_5 (CHARSET_ID_OFFSET_96 + 'L')
119 /* Right half of ISO 8859-9 */
120 #define LEADING_BYTE_LATIN_ISO8859_9 (CHARSET_ID_OFFSET_96 + 'M')
123 #define LEADING_BYTE_THAI_TIS620 (CHARSET_ID_OFFSET_96 + 'T')
126 #define MIN_LEADING_BYTE_PRIVATE_1 0xD0
127 #define MAX_LEADING_BYTE_PRIVATE_1 0xDF
130 #define CHARSET_ID_OFFSET_94x94 0xB0
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)
184 #define MIN_LEADING_BYTE_OFFICIAL_2 LEADING_BYTE_JAPANESE_JISX0208_1978
185 #define MAX_LEADING_BYTE_OFFICIAL_2 LEADING_BYTE_KOREAN_KPS9566
187 #define NUM_LEADING_BYTES 256
190 /************************************************************************/
191 /* Information about a particular character set */
192 /************************************************************************/
196 struct lcrecord_header header;
200 Lisp_Object doc_string, registry, short_name, long_name;
202 Lisp_Object reverse_direction_charset;
204 Lisp_Object ccl_program;
206 /* Final byte of this character set in ISO2022 designating escape sequence */
209 /* Number of columns a character in this charset takes up, on TTY
210 devices. Not used for X devices. */
211 unsigned int columns;
213 /* Direction of this character set */
214 unsigned int direction;
216 /* Type of this character set (94, 96, 94x94, 96x96) */
219 /* Number of bytes used in encoding of this character set (1 or 2) */
220 unsigned int dimension;
222 /* Number of chars in each dimension (usually 94 or 96) */
225 /* Which half of font to be used to display this character set */
226 unsigned int graphic;
228 /* Byte->character mapping table */
229 Lisp_Object decoding_table;
231 /* Character->byte mapping table */
232 Lisp_Object encoding_table;
234 /* Range of character code */
235 Emchar ucs_min, ucs_max;
237 /* Offset for external code */
240 /* Offset for each byte */
244 DECLARE_LRECORD (charset, struct Lisp_Charset);
245 #define XCHARSET(x) XRECORD (x, charset, struct Lisp_Charset)
246 #define XSETCHARSET(x, p) XSETRECORD (x, p, charset)
247 #define CHARSETP(x) RECORDP (x, charset)
248 #define GC_CHARSETP(x) GC_RECORDP (x, charset)
249 #define CHECK_CHARSET(x) CHECK_RECORD (x, charset)
250 #define CONCHECK_CHARSET(x) CONCHECK_RECORD (x, charset)
252 #define CHARSET_TYPE_94 0 /* This charset includes 94 characters. */
253 #define CHARSET_TYPE_94X94 1 /* This charset includes 94x94 characters. */
254 #define CHARSET_TYPE_96 2 /* This charset includes 96 characters. */
255 #define CHARSET_TYPE_96X96 3 /* This charset includes 96x96 characters. */
256 #define CHARSET_TYPE_128 4 /* This charset includes 128 characters. */
257 #define CHARSET_TYPE_128X128 5 /* This charset includes 128x128 characters. */
258 #define CHARSET_TYPE_256 6 /* This charset includes 256 characters. */
259 #define CHARSET_TYPE_256X256 7 /* This charset includes 256x256 characters. */
261 #define CHARSET_LEFT_TO_RIGHT 0
262 #define CHARSET_RIGHT_TO_LEFT 1
264 /* Leading byte and id have been regrouped. -- OG */
265 #define CHARSET_ID(cs) ((cs)->id)
266 #define CHARSET_LEADING_BYTE(cs) ((Bufbyte)(CHARSET_ID(cs)))
267 #define CHARSET_NAME(cs) ((cs)->name)
268 #define CHARSET_SHORT_NAME(cs) ((cs)->short_name)
269 #define CHARSET_LONG_NAME(cs) ((cs)->long_name)
270 #define CHARSET_COLUMNS(cs) ((cs)->columns)
271 #define CHARSET_GRAPHIC(cs) ((cs)->graphic)
272 #define CHARSET_TYPE(cs) ((cs)->type)
273 #define CHARSET_DIRECTION(cs) ((cs)->direction)
274 #define CHARSET_FINAL(cs) ((cs)->final)
275 #define CHARSET_DOC_STRING(cs) ((cs)->doc_string)
276 #define CHARSET_REGISTRY(cs) ((cs)->registry)
277 #define CHARSET_CCL_PROGRAM(cs) ((cs)->ccl_program)
278 #define CHARSET_DIMENSION(cs) ((cs)->dimension)
279 #define CHARSET_CHARS(cs) ((cs)->chars)
280 #define CHARSET_REVERSE_DIRECTION_CHARSET(cs) ((cs)->reverse_direction_charset)
281 #define CHARSET_DECODING_TABLE(cs) ((cs)->decoding_table)
282 #define CHARSET_ENCODING_TABLE(cs) ((cs)->encoding_table)
283 #define CHARSET_UCS_MIN(cs) ((cs)->ucs_min)
284 #define CHARSET_UCS_MAX(cs) ((cs)->ucs_max)
285 #define CHARSET_CODE_OFFSET(cs) ((cs)->code_offset)
286 #define CHARSET_BYTE_OFFSET(cs) ((cs)->byte_offset)
289 #define XCHARSET_ID(cs) CHARSET_ID (XCHARSET (cs))
290 #define XCHARSET_NAME(cs) CHARSET_NAME (XCHARSET (cs))
291 #define XCHARSET_SHORT_NAME(cs) CHARSET_SHORT_NAME (XCHARSET (cs))
292 #define XCHARSET_LONG_NAME(cs) CHARSET_LONG_NAME (XCHARSET (cs))
293 #define XCHARSET_GRAPHIC(cs) CHARSET_GRAPHIC (XCHARSET (cs))
294 #define XCHARSET_TYPE(cs) CHARSET_TYPE (XCHARSET (cs))
295 #define XCHARSET_DIRECTION(cs) CHARSET_DIRECTION (XCHARSET (cs))
296 #define XCHARSET_FINAL(cs) CHARSET_FINAL (XCHARSET (cs))
297 #define XCHARSET_DOC_STRING(cs) CHARSET_DOC_STRING (XCHARSET (cs))
298 #define XCHARSET_REGISTRY(cs) CHARSET_REGISTRY (XCHARSET (cs))
299 #define XCHARSET_LEADING_BYTE(cs) CHARSET_LEADING_BYTE (XCHARSET (cs))
300 #define XCHARSET_CCL_PROGRAM(cs) CHARSET_CCL_PROGRAM (XCHARSET (cs))
301 #define XCHARSET_DIMENSION(cs) CHARSET_DIMENSION (XCHARSET (cs))
302 #define XCHARSET_CHARS(cs) CHARSET_CHARS (XCHARSET (cs))
303 #define XCHARSET_REVERSE_DIRECTION_CHARSET(cs) \
304 CHARSET_REVERSE_DIRECTION_CHARSET (XCHARSET (cs))
305 #define XCHARSET_DECODING_TABLE(cs) CHARSET_DECODING_TABLE(XCHARSET(cs))
306 #define XCHARSET_ENCODING_TABLE(cs) CHARSET_ENCODING_TABLE(XCHARSET(cs))
307 #define XCHARSET_UCS_MIN(cs) CHARSET_UCS_MIN(XCHARSET(cs))
308 #define XCHARSET_UCS_MAX(cs) CHARSET_UCS_MAX(XCHARSET(cs))
309 #define XCHARSET_CODE_OFFSET(cs) CHARSET_CODE_OFFSET(XCHARSET(cs))
310 #define XCHARSET_BYTE_OFFSET(cs) CHARSET_BYTE_OFFSET(XCHARSET(cs))
312 /* Table of charsets indexed by (leading byte - 128). */
313 extern Lisp_Object charset_by_leading_byte[NUM_LEADING_BYTES];
315 /* Table of charsets indexed by type/final-byte. */
316 extern Lisp_Object charset_by_attributes[4][128];
318 #ifdef ERROR_CHECK_TYPECHECK
319 /* int not Bufbyte even though that is the actual type of a leading byte.
320 This way, out-ot-range values will get caught rather than automatically
322 INLINE Lisp_Object CHARSET_BY_LEADING_BYTE (Charset_ID lb);
324 CHARSET_BY_LEADING_BYTE (Charset_ID lb)
326 assert (lb >= MIN_LEADING_BYTE &&
327 lb < (MIN_LEADING_BYTE + NUM_LEADING_BYTES));
328 return charset_by_leading_byte[lb - MIN_LEADING_BYTE];
333 #define CHARSET_BY_LEADING_BYTE(lb) \
334 (charset_by_leading_byte[(lb) - MIN_LEADING_BYTE])
338 #define CHARSET_BY_ATTRIBUTES(type, final, dir) \
339 (charset_by_attributes[type][final])
342 /************************************************************************/
343 /* Dealing with characters */
344 /************************************************************************/
346 #define MAX_CHAR_BASIC_LATIN 0x007F
348 #define MIN_CHAR_GREEK 0x0370
349 #define MAX_CHAR_GREEK 0x03CF
351 #define MIN_CHAR_CYRILLIC 0x0400
352 #define MAX_CHAR_CYRILLIC 0x045F
354 #define MIN_CHAR_HEBREW 0x0590
355 #define MAX_CHAR_HEBREW 0x05EF
357 #define MIN_CHAR_THAI 0x0E00
358 #define MAX_CHAR_THAI 0x0E5F
360 #define MIN_CHAR_HIRAGANA 0x3041
361 #define MAX_CHAR_HIRAGANA 0x3093
363 #define MIN_CHAR_KATAKANA 0x30A1
364 #define MAX_CHAR_KATAKANA 0x30F6
366 #define MIN_CHAR_HALFWIDTH_KATAKANA 0xFF61
367 #define MAX_CHAR_HALFWIDTH_KATAKANA 0xFF9F
369 #define MIN_CHAR_OBS_94x94 0xE00000
370 #define MAX_CHAR_OBS_94x94 (0xE00000 + 94 * 94 * 14 - 1)
372 #define MIN_CHAR_94 0xE90940
373 #define MAX_CHAR_94 (MIN_CHAR_94 + 94 * 80 - 1)
374 #define MIN_CHAR_96 (MIN_CHAR_94 + 94 * 80)
375 #define MAX_CHAR_96 (MIN_CHAR_96 + 96 * 80 - 1)
377 #define MIN_CHAR_94x94 0xE9F6C0
378 #define MAX_CHAR_94x94 (MIN_CHAR_94x94 + 94 * 94 * 80 - 1)
379 #define MIN_CHAR_96x96 0xF4C000
380 #define MAX_CHAR_96x96 (MIN_CHAR_96x96 + 96 * 96 * 80 - 1)
383 /* Return a character whose charset is CHARSET and position-codes
384 are C1 and C2. TYPE9N character ignores C2. */
386 INLINE Emchar MAKE_CHAR (Lisp_Object charset, int c1, int c2);
388 MAKE_CHAR (Lisp_Object charset, int c1, int c2)
390 Lisp_Object decoding_table = XCHARSET_DECODING_TABLE (charset);
394 if (!EQ (decoding_table, Qnil)
395 && (0 <= (idx = c1 - XCHARSET_BYTE_OFFSET (charset)))
396 && (idx < XVECTOR_LENGTH (decoding_table))
397 && !EQ (ch = XVECTOR_DATA(decoding_table)[idx], Qnil))
401 if ((0 <= (idx = c2 - XCHARSET_BYTE_OFFSET (charset)))
402 && (idx < XVECTOR_LENGTH (ch))
403 && !EQ (ch = XVECTOR_DATA(ch)[idx], Qnil))
409 if (EQ (charset, Vcharset_katakana_jisx0201))
411 return c1 + MIN_CHAR_HALFWIDTH_KATAKANA - 33;
413 /* return MIN_CHAR_94 + ('I' - '0') * 94 + (c1 - 33); */
415 else if (XCHARSET_UCS_MAX (charset))
418 = (XCHARSET_DIMENSION (charset) == 1
420 c1 - XCHARSET_BYTE_OFFSET (charset)
422 (c1 - XCHARSET_BYTE_OFFSET (charset)) * XCHARSET_CHARS (charset)
423 + c2 - XCHARSET_BYTE_OFFSET (charset))
424 - XCHARSET_CODE_OFFSET (charset) + XCHARSET_UCS_MIN (charset);
425 if ((code < XCHARSET_UCS_MIN (charset))
426 || (XCHARSET_UCS_MAX (charset) < code))
427 signal_simple_error ("Arguments makes invalid character",
431 else if (XCHARSET_DIMENSION (charset) == 1)
433 switch (XCHARSET_CHARS (charset))
437 + (XCHARSET_FINAL (charset) - '0') * 94 + (c1 - 33);
440 + (XCHARSET_FINAL (charset) - '0') * 96 + (c1 - 32);
447 switch (XCHARSET_CHARS (charset))
450 return MIN_CHAR_94x94
451 + (XCHARSET_FINAL (charset) - '0') * 94 * 94
452 + (c1 - 33) * 94 + (c2 - 33);
454 return MIN_CHAR_96x96
455 + (XCHARSET_FINAL (charset) - '0') * 96 * 96
456 + (c1 - 32) * 96 + (c2 - 32);
463 unsigned char charset_get_byte1 (Lisp_Object charset, Emchar ch);
464 unsigned char charset_get_byte2 (Lisp_Object charset, Emchar ch);
466 extern Lisp_Object Vdefault_coded_charset_priority_list;
467 EXFUN (Ffind_charset, 1);
469 INLINE void breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2);
471 breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2)
473 if (c < MIN_CHAR_OBS_94x94)
475 Lisp_Object charsets = Vdefault_coded_charset_priority_list;
476 while (!EQ (charsets, Qnil))
478 *charset = Ffind_charset (Fcar (charsets));
479 if (!EQ (*charset, Qnil)
480 && (*c1 = charset_get_byte1 (*charset, c)) )
482 *c2 = charset_get_byte2 (*charset, c);
485 charsets = Fcdr (charsets);
487 /* otherwise --- maybe for bootstrap */
488 if (c <= MAX_CHAR_BASIC_LATIN)
490 *charset = Vcharset_ascii;
491 *c1 = charset_get_byte1 (*charset, c);
492 *c2 = charset_get_byte2 (*charset, c);
496 *charset = Vcharset_control_1;
497 *c1 = charset_get_byte1 (*charset, c);
498 *c2 = charset_get_byte2 (*charset, c);
502 *charset = Vcharset_latin_iso8859_1;
503 *c1 = charset_get_byte1 (*charset, c);
504 *c2 = charset_get_byte2 (*charset, c);
506 else if ((MIN_CHAR_GREEK <= c) && (c <= MAX_CHAR_GREEK))
508 *charset = Vcharset_greek_iso8859_7;
509 *c1 = c - MIN_CHAR_GREEK + 0x20;
512 else if ((MIN_CHAR_CYRILLIC <= c) && (c <= MAX_CHAR_CYRILLIC))
514 *charset = Vcharset_cyrillic_iso8859_5;
515 *c1 = c - MIN_CHAR_CYRILLIC + 0x20;
518 else if ((MIN_CHAR_HEBREW <= c) && (c <= MAX_CHAR_HEBREW))
520 *charset = Vcharset_hebrew_iso8859_8;
521 *c1 = c - MIN_CHAR_HEBREW + 0x20;
524 else if ((MIN_CHAR_THAI <= c) && (c <= MAX_CHAR_THAI))
526 *charset = Vcharset_thai_tis620;
527 *c1 = c - MIN_CHAR_THAI + 0x20;
530 else if ((MIN_CHAR_HALFWIDTH_KATAKANA <= c)
531 && (c <= MAX_CHAR_HALFWIDTH_KATAKANA))
533 *charset = Vcharset_katakana_jisx0201;
534 *c1 = c - MIN_CHAR_HALFWIDTH_KATAKANA + 33;
539 *charset = Vcharset_ucs_bmp;
544 else if (c <= MAX_CHAR_OBS_94x94)
547 = CHARSET_BY_ATTRIBUTES (CHARSET_TYPE_94X94,
548 ((c - MIN_CHAR_OBS_94x94) / (94 * 94)) + '@',
549 CHARSET_LEFT_TO_RIGHT);
550 *c1 = (((c - MIN_CHAR_OBS_94x94) / 94) % 94) + 33;
551 *c2 = ((c - MIN_CHAR_OBS_94x94) % 94) + 33;
553 else if (c <= MAX_CHAR_94)
556 = CHARSET_BY_ATTRIBUTES (CHARSET_TYPE_94,
557 ((c - MIN_CHAR_94) / 94) + '0',
558 CHARSET_LEFT_TO_RIGHT);
559 *c1 = ((c - MIN_CHAR_94) % 94) + 33;
562 else if (c <= MAX_CHAR_96)
565 = CHARSET_BY_ATTRIBUTES (CHARSET_TYPE_96,
566 ((c - MIN_CHAR_96) / 96) + '0',
567 CHARSET_LEFT_TO_RIGHT);
568 *c1 = ((c - MIN_CHAR_96) % 96) + 32;
571 else if (c <= MAX_CHAR_94x94)
574 = CHARSET_BY_ATTRIBUTES (CHARSET_TYPE_94X94,
575 ((c - MIN_CHAR_94x94) / (94 * 94)) + '0',
576 CHARSET_LEFT_TO_RIGHT);
577 *c1 = (((c - MIN_CHAR_94x94) / 94) % 94) + 33;
578 *c2 = ((c - MIN_CHAR_94x94) % 94) + 33;
580 else if (c <= MAX_CHAR_96x96)
583 = CHARSET_BY_ATTRIBUTES (CHARSET_TYPE_96X96,
584 ((c - MIN_CHAR_96x96) / (96 * 96)) + '0',
585 CHARSET_LEFT_TO_RIGHT);
586 *c1 = (((c - MIN_CHAR_96x96) / 96) % 96) + 32;
587 *c2 = ((c - MIN_CHAR_96x96) % 96) + 32;
596 #define BREAKUP_CHAR(ch, charset, b1, b2) \
597 breakup_char_1 (ch, &(charset), &(b1), &(b2))
599 INLINE Lisp_Object CHAR_CHARSET (Emchar ch);
601 CHAR_CHARSET (Emchar ch)
606 BREAKUP_CHAR(ch, charset, b1, b2);
610 #define CHAR_LEADING_BYTE(c) (XCHARSET_LEADING_BYTE(CHAR_CHARSET(c)))
612 #define CHAR_COLUMNS(c) (CHARSET_COLUMNS(XCHARSET(CHAR_CHARSET(c))))
615 /************************************************************************/
616 /* Exported functions */
617 /************************************************************************/
619 EXFUN (Fget_charset, 1);
621 extern Lisp_Object Vcharset_chinese_big5_1;
622 extern Lisp_Object Vcharset_chinese_big5_2;
623 extern Lisp_Object Vcharset_japanese_jisx0208;
624 extern Lisp_Object Vcharset_japanese_jisx0212;
626 #endif /* _XEMACS_CHAR_UCS_H */