70
|
1 /* Functions to handle multilingual characters.
|
|
2 Copyright (C) 1992, 1995 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1995 Sun Microsystems, Inc.
|
|
4
|
|
5 This file is part of XEmacs.
|
|
6
|
|
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
|
|
10 later version.
|
|
11
|
|
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
|
|
15 for more details.
|
|
16
|
|
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. */
|
|
21
|
|
22 /* Synched up with: Mule 2.3. Not in FSF. */
|
|
23
|
298
|
24 /* Rewritten by Ben Wing <ben@xemacs.org>. */
|
70
|
25
|
|
26 #include <config.h>
|
|
27 #include "lisp.h"
|
|
28
|
|
29 #include "buffer.h"
|
|
30 #include "chartab.h"
|
|
31 #include "elhash.h"
|
|
32 #include "lstream.h"
|
|
33 #include "device.h"
|
|
34 #include "faces.h"
|
|
35
|
|
36 /* The various pre-defined charsets. */
|
|
37
|
|
38 Lisp_Object Vcharset_ascii;
|
|
39 Lisp_Object Vcharset_control_1;
|
74
|
40 Lisp_Object Vcharset_latin_iso8859_1;
|
|
41 Lisp_Object Vcharset_latin_iso8859_2;
|
|
42 Lisp_Object Vcharset_latin_iso8859_3;
|
|
43 Lisp_Object Vcharset_latin_iso8859_4;
|
|
44 Lisp_Object Vcharset_cyrillic_iso8859_5;
|
|
45 Lisp_Object Vcharset_arabic_iso8859_6;
|
|
46 Lisp_Object Vcharset_greek_iso8859_7;
|
|
47 Lisp_Object Vcharset_hebrew_iso8859_8;
|
|
48 Lisp_Object Vcharset_latin_iso8859_9;
|
|
49 Lisp_Object Vcharset_thai_tis620;
|
|
50 Lisp_Object Vcharset_katakana_jisx0201;
|
|
51 Lisp_Object Vcharset_latin_jisx0201;
|
70
|
52 Lisp_Object Vcharset_japanese_jisx0208_1978;
|
|
53 Lisp_Object Vcharset_japanese_jisx0208;
|
|
54 Lisp_Object Vcharset_japanese_jisx0212;
|
74
|
55 Lisp_Object Vcharset_chinese_gb2312;
|
70
|
56 Lisp_Object Vcharset_chinese_big5_1;
|
|
57 Lisp_Object Vcharset_chinese_big5_2;
|
|
58 Lisp_Object Vcharset_chinese_cns11643_1;
|
|
59 Lisp_Object Vcharset_chinese_cns11643_2;
|
|
60 Lisp_Object Vcharset_korean_ksc5601;
|
337
|
61
|
|
62 #ifdef ENABLE_COMPOSITE_CHARS
|
70
|
63 Lisp_Object Vcharset_composite;
|
|
64
|
|
65 /* Hashtables for composite chars. One maps string representing
|
|
66 composed chars to their equivalent chars; one goes the
|
|
67 other way. */
|
|
68 Lisp_Object Vcomposite_char_char2string_hashtable;
|
|
69 Lisp_Object Vcomposite_char_string2char_hashtable;
|
|
70
|
337
|
71 static int composite_char_row_next;
|
|
72 static int composite_char_col_next;
|
|
73
|
|
74 #endif /* ENABLE_COMPOSITE_CHARS */
|
|
75
|
70
|
76 /* Table of charsets indexed by leading byte. */
|
|
77 Lisp_Object charset_by_leading_byte[128];
|
|
78
|
|
79 /* Table of charsets indexed by type/final-byte/direction. */
|
|
80 Lisp_Object charset_by_attributes[4][128][2];
|
|
81
|
|
82 /* Table of number of bytes in the string representation of a character
|
|
83 indexed by the first byte of that representation.
|
|
84
|
183
|
85 rep_bytes_by_first_byte(c) is more efficient than the equivalent
|
|
86 canonical computation:
|
70
|
87
|
183
|
88 (BYTE_ASCII_P (c) ? 1 : XCHARSET_REP_BYTES (CHARSET_BY_LEADING_BYTE (c))) */
|
70
|
89
|
|
90 Bytecount rep_bytes_by_first_byte[0xA0] =
|
183
|
91 { /* 0x00 - 0x7f are for straight ASCII */
|
70
|
92 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
93 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
94 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
95 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
96 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
97 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
98 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
99 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
183
|
100 /* 0x80 - 0x8f are for Dimension-1 official charsets */
|
70
|
101 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
183
|
102 /* 0x90 - 0x9d are for Dimension-2 official charsets */
|
|
103 /* 0x9e is for Dimension-1 private charsets */
|
|
104 /* 0x9f is for Dimension-2 private charsets */
|
70
|
105 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4
|
|
106 };
|
|
107
|
|
108 Lisp_Object Qcharsetp;
|
|
109
|
|
110 /* Qdoc_string, Qdimension, Qchars defined in general.c */
|
|
111 Lisp_Object Qregistry, Qfinal, Qgraphic;
|
|
112 Lisp_Object Qdirection;
|
|
113 Lisp_Object Qreverse_direction_charset;
|
|
114 Lisp_Object Qccl_program;
|
|
115
|
74
|
116 Lisp_Object Qascii, Qcontrol_1,
|
183
|
117
|
74
|
118 Qlatin_iso8859_1,
|
|
119 Qlatin_iso8859_2,
|
|
120 Qlatin_iso8859_3,
|
|
121 Qlatin_iso8859_4,
|
|
122 Qcyrillic_iso8859_5,
|
|
123 Qarabic_iso8859_6,
|
|
124 Qgreek_iso8859_7,
|
|
125 Qhebrew_iso8859_8,
|
|
126 Qlatin_iso8859_9,
|
183
|
127
|
74
|
128 Qthai_tis620,
|
183
|
129
|
74
|
130 Qkatakana_jisx0201, Qlatin_jisx0201,
|
70
|
131 Qjapanese_jisx0208_1978,
|
|
132 Qjapanese_jisx0208,
|
|
133 Qjapanese_jisx0212,
|
183
|
134
|
74
|
135 Qchinese_gb2312,
|
|
136 Qchinese_big5_1, Qchinese_big5_2,
|
70
|
137 Qchinese_cns11643_1, Qchinese_cns11643_2,
|
183
|
138
|
70
|
139 Qkorean_ksc5601, Qcomposite;
|
|
140
|
|
141 Lisp_Object Ql2r, Qr2l;
|
|
142
|
|
143 Lisp_Object Vcharset_hashtable;
|
|
144
|
|
145 static Bufbyte next_allocated_1_byte_leading_byte;
|
|
146 static Bufbyte next_allocated_2_byte_leading_byte;
|
|
147
|
|
148 /* Composite characters are characters constructed by overstriking two
|
|
149 or more regular characters.
|
|
150
|
|
151 1) The old Mule implementation involves storing composite characters
|
|
152 in a buffer as a tag followed by all of the actual characters
|
|
153 used to make up the composite character. I think this is a bad
|
|
154 idea; it greatly complicates code that wants to handle strings
|
|
155 one character at a time because it has to deal with the possibility
|
|
156 of great big ungainly characters. It's much more reasonable to
|
|
157 simply store an index into a table of composite characters.
|
|
158
|
|
159 2) The current implementation only allows for 16,384 separate
|
|
160 composite characters over the lifetime of the XEmacs process.
|
|
161 This could become a potential problem if the user
|
|
162 edited lots of different files that use composite characters.
|
|
163 Due to FSF bogosity, increasing the number of allowable
|
|
164 composite characters under Mule would decrease the number
|
|
165 of possible faces that can exist. Mule already has shrunk
|
|
166 this to 2048, and further shrinkage would become uncomfortable.
|
|
167 No such problems exist in XEmacs.
|
|
168
|
|
169 Composite characters could be represented as 0x80 C1 C2 C3,
|
|
170 where each C[1-3] is in the range 0xA0 - 0xFF. This allows
|
|
171 for slightly under 2^20 (one million) composite characters
|
|
172 over the XEmacs process lifetime, and you only need to
|
|
173 increase the size of a Mule character from 19 to 21 bits.
|
|
174 Or you could use 0x80 C1 C2 C3 C4, allowing for about
|
|
175 85 million (slightly over 2^26) composite characters. */
|
|
176
|
|
177
|
|
178 /************************************************************************/
|
|
179 /* Basic Emchar functions */
|
|
180 /************************************************************************/
|
|
181
|
|
182 /* Convert a non-ASCII Mule character C into a one-character Mule-encoded
|
|
183 string in STR. Returns the number of bytes stored.
|
|
184 Do not call this directly. Use the macro set_charptr_emchar() instead.
|
|
185 */
|
|
186
|
|
187 Bytecount
|
|
188 non_ascii_set_charptr_emchar (Bufbyte *str, Emchar c)
|
|
189 {
|
|
190 Bufbyte *p;
|
|
191 Bufbyte lb;
|
|
192 int c1, c2;
|
|
193 Lisp_Object charset;
|
|
194
|
|
195 p = str;
|
|
196 BREAKUP_CHAR (c, charset, c1, c2);
|
|
197 lb = CHAR_LEADING_BYTE (c);
|
|
198 if (LEADING_BYTE_PRIVATE_P (lb))
|
|
199 *p++ = PRIVATE_LEADING_BYTE_PREFIX (lb);
|
|
200 *p++ = lb;
|
|
201 if (EQ (charset, Vcharset_control_1))
|
|
202 c1 += 0x20;
|
|
203 *p++ = c1 | 0x80;
|
|
204 if (c2)
|
|
205 *p++ = c2 | 0x80;
|
|
206
|
|
207 return (p - str);
|
|
208 }
|
|
209
|
|
210 /* Return the first character from a Mule-encoded string in STR,
|
|
211 assuming it's non-ASCII. Do not call this directly.
|
|
212 Use the macro charptr_emchar() instead. */
|
|
213
|
|
214 Emchar
|
|
215 non_ascii_charptr_emchar (CONST Bufbyte *str)
|
|
216 {
|
|
217 Bufbyte i0 = *str, i1, i2 = 0;
|
|
218 Lisp_Object charset;
|
|
219
|
|
220 if (i0 == LEADING_BYTE_CONTROL_1)
|
|
221 return (Emchar) (*++str - 0x20);
|
|
222
|
|
223 if (LEADING_BYTE_PREFIX_P (i0))
|
|
224 i0 = *++str;
|
|
225
|
|
226 i1 = *++str & 0x7F;
|
|
227
|
|
228 charset = CHARSET_BY_LEADING_BYTE (i0);
|
|
229 if (XCHARSET_DIMENSION (charset) == 2)
|
|
230 i2 = *++str & 0x7F;
|
|
231
|
|
232 return MAKE_CHAR (charset, i1, i2);
|
|
233 }
|
|
234
|
|
235 /* Return whether CH is a valid Emchar, assuming it's non-ASCII.
|
|
236 Do not call this directly. Use the macro valid_char_p() instead. */
|
|
237
|
|
238 int
|
|
239 non_ascii_valid_char_p (Emchar ch)
|
|
240 {
|
|
241 int f1, f2, f3;
|
|
242
|
|
243 /* Must have only lowest 19 bits set */
|
|
244 if (ch & ~0x7FFFF)
|
|
245 return 0;
|
|
246
|
|
247 f1 = CHAR_FIELD1 (ch);
|
|
248 f2 = CHAR_FIELD2 (ch);
|
|
249 f3 = CHAR_FIELD3 (ch);
|
|
250
|
|
251 if (f1 == 0)
|
|
252 {
|
|
253 Lisp_Object charset;
|
359
|
254 /* 0x8B checking is here to avoid the gap between
|
|
255 LEADING_BYTE_LATIN_JISX0201 and
|
|
256 LEADING_BYTE_CYRILLIC_ISO8859_5. See mule-charset.h */
|
70
|
257 if (f2 < MIN_CHAR_FIELD2_OFFICIAL ||
|
359
|
258 f2 == (0x8B - FIELD2_TO_OFFICIAL_LEADING_BYTE) ||
|
70
|
259 (f2 > MAX_CHAR_FIELD2_OFFICIAL && f2 < MIN_CHAR_FIELD2_PRIVATE) ||
|
|
260 f2 > MAX_CHAR_FIELD2_PRIVATE)
|
|
261 return 0;
|
|
262 if (f3 < 0x20)
|
|
263 return 0;
|
|
264
|
359
|
265 if (f3 != 0x20 && f3 != 0x7F && !(f2 >= MIN_CHAR_FIELD2_PRIVATE &&
|
|
266 f2 <= MAX_CHAR_FIELD2_PRIVATE))
|
70
|
267 return 1;
|
|
268
|
|
269 /*
|
|
270 NOTE: This takes advantage of the fact that
|
|
271 FIELD2_TO_OFFICIAL_LEADING_BYTE and
|
|
272 FIELD2_TO_PRIVATE_LEADING_BYTE are the same.
|
|
273 */
|
|
274 charset = CHARSET_BY_LEADING_BYTE (f2 + FIELD2_TO_OFFICIAL_LEADING_BYTE);
|
359
|
275 if (EQ (charset, Qnil))
|
|
276 return 0;
|
70
|
277 return (XCHARSET_CHARS (charset) == 96);
|
|
278 }
|
|
279 else
|
|
280 {
|
|
281 Lisp_Object charset;
|
|
282
|
|
283 if (f1 < MIN_CHAR_FIELD1_OFFICIAL ||
|
|
284 (f1 > MAX_CHAR_FIELD1_OFFICIAL && f1 < MIN_CHAR_FIELD1_PRIVATE) ||
|
|
285 f1 > MAX_CHAR_FIELD1_PRIVATE)
|
|
286 return 0;
|
|
287 if (f2 < 0x20 || f3 < 0x20)
|
|
288 return 0;
|
|
289
|
337
|
290
|
|
291 #ifdef ENABLE_COMPOSITE_CHARS
|
70
|
292 if (f1 + FIELD1_TO_OFFICIAL_LEADING_BYTE == LEADING_BYTE_COMPOSITE)
|
|
293 {
|
|
294 if (UNBOUNDP (Fgethash (make_int (ch),
|
|
295 Vcomposite_char_char2string_hashtable,
|
|
296 Qunbound)))
|
|
297 return 0;
|
|
298 return 1;
|
|
299 }
|
337
|
300 #endif /* ENABLE_COMPOSITE_CHARS */
|
70
|
301
|
359
|
302 if (f2 != 0x20 && f2 != 0x7F && f3 != 0x20 && f3 != 0x7F
|
|
303 && !(f1 >= MIN_CHAR_FIELD1_PRIVATE && f1 <= MAX_CHAR_FIELD1_PRIVATE))
|
70
|
304 return 1;
|
|
305
|
|
306 if (f1 <= MAX_CHAR_FIELD1_OFFICIAL)
|
|
307 charset =
|
|
308 CHARSET_BY_LEADING_BYTE (f1 + FIELD1_TO_OFFICIAL_LEADING_BYTE);
|
|
309 else
|
|
310 charset =
|
|
311 CHARSET_BY_LEADING_BYTE (f1 + FIELD1_TO_PRIVATE_LEADING_BYTE);
|
|
312
|
359
|
313 if (EQ (charset, Qnil))
|
|
314 return 0;
|
70
|
315 return (XCHARSET_CHARS (charset) == 96);
|
|
316 }
|
|
317 }
|
|
318
|
|
319
|
|
320 /************************************************************************/
|
|
321 /* Basic string functions */
|
|
322 /************************************************************************/
|
|
323
|
|
324 /* Copy the character pointed to by PTR into STR, assuming it's
|
|
325 non-ASCII. Do not call this directly. Use the macro
|
|
326 charptr_copy_char() instead. */
|
|
327
|
|
328 Bytecount
|
|
329 non_ascii_charptr_copy_char (CONST Bufbyte *ptr, Bufbyte *str)
|
|
330 {
|
|
331 Bufbyte *strptr = str;
|
|
332 *strptr = *ptr++;
|
|
333 switch (REP_BYTES_BY_FIRST_BYTE (*strptr))
|
|
334 {
|
|
335 /* Notice fallthrough. */
|
|
336 case 4: *++strptr = *ptr++;
|
|
337 case 3: *++strptr = *ptr++;
|
|
338 case 2: *++strptr = *ptr;
|
|
339 break;
|
|
340 default:
|
|
341 abort ();
|
|
342 }
|
|
343 return strptr + 1 - str;
|
|
344 }
|
|
345
|
|
346
|
|
347 /************************************************************************/
|
|
348 /* streams of Emchars */
|
|
349 /************************************************************************/
|
|
350
|
|
351 /* Treat a stream as a stream of Emchar's rather than a stream of bytes.
|
|
352 The functions below are not meant to be called directly; use
|
|
353 the macros in insdel.h. */
|
|
354
|
|
355 Emchar
|
|
356 Lstream_get_emchar_1 (Lstream *stream, int ch)
|
|
357 {
|
|
358 Bufbyte str[MAX_EMCHAR_LEN];
|
|
359 Bufbyte *strptr = str;
|
|
360
|
|
361 str[0] = (Bufbyte) ch;
|
|
362 switch (REP_BYTES_BY_FIRST_BYTE (ch))
|
|
363 {
|
|
364 /* Notice fallthrough. */
|
|
365 case 4:
|
|
366 ch = Lstream_getc (stream);
|
|
367 assert (ch >= 0);
|
|
368 *++strptr = (Bufbyte) ch;
|
|
369 case 3:
|
|
370 ch = Lstream_getc (stream);
|
|
371 assert (ch >= 0);
|
|
372 *++strptr = (Bufbyte) ch;
|
|
373 case 2:
|
|
374 ch = Lstream_getc (stream);
|
|
375 assert (ch >= 0);
|
|
376 *++strptr = (Bufbyte) ch;
|
|
377 break;
|
|
378 default:
|
|
379 abort ();
|
|
380 }
|
|
381 return charptr_emchar (str);
|
|
382 }
|
|
383
|
|
384 int
|
|
385 Lstream_fput_emchar (Lstream *stream, Emchar ch)
|
|
386 {
|
|
387 Bufbyte str[MAX_EMCHAR_LEN];
|
|
388 Bytecount len = set_charptr_emchar (str, ch);
|
|
389 return Lstream_write (stream, str, len);
|
|
390 }
|
|
391
|
|
392 void
|
|
393 Lstream_funget_emchar (Lstream *stream, Emchar ch)
|
|
394 {
|
|
395 Bufbyte str[MAX_EMCHAR_LEN];
|
|
396 Bytecount len = set_charptr_emchar (str, ch);
|
|
397 Lstream_unread (stream, str, len);
|
|
398 }
|
|
399
|
|
400
|
|
401 /************************************************************************/
|
|
402 /* charset object */
|
|
403 /************************************************************************/
|
|
404
|
|
405 static Lisp_Object
|
|
406 mark_charset (Lisp_Object obj, void (*markobj) (Lisp_Object))
|
|
407 {
|
|
408 struct Lisp_Charset *cs = XCHARSET (obj);
|
|
409
|
|
410 (markobj) (cs->doc_string);
|
|
411 (markobj) (cs->registry);
|
|
412 (markobj) (cs->ccl_program);
|
|
413 return cs->name;
|
|
414 }
|
|
415
|
|
416 static void
|
|
417 print_charset (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
|
|
418 {
|
|
419 struct Lisp_Charset *cs = XCHARSET (obj);
|
|
420 char buf[200];
|
183
|
421
|
70
|
422 if (print_readably)
|
|
423 error ("printing unreadable object #<charset %s 0x%x>",
|
|
424 string_data (XSYMBOL (CHARSET_NAME (cs))->name),
|
|
425 cs->header.uid);
|
|
426
|
|
427 write_c_string ("#<charset ", printcharfun);
|
|
428 print_internal (CHARSET_NAME (cs), printcharfun, 0);
|
|
429 write_c_string (" ", printcharfun);
|
|
430 print_internal (CHARSET_DOC_STRING (cs), printcharfun, 1);
|
|
431 sprintf (buf, " %s %s cols=%d g%d final='%c' reg=",
|
|
432 CHARSET_TYPE (cs) == CHARSET_TYPE_94 ? "94" :
|
|
433 CHARSET_TYPE (cs) == CHARSET_TYPE_96 ? "96" :
|
|
434 CHARSET_TYPE (cs) == CHARSET_TYPE_94X94 ? "94x94" :
|
|
435 "96x96",
|
|
436 CHARSET_DIRECTION (cs) == CHARSET_LEFT_TO_RIGHT ? "l2r" : "r2l",
|
|
437 CHARSET_COLUMNS (cs),
|
|
438 CHARSET_GRAPHIC (cs),
|
|
439 CHARSET_FINAL (cs));
|
|
440 write_c_string (buf, printcharfun);
|
|
441 print_internal (CHARSET_REGISTRY (cs), printcharfun, 0);
|
|
442 sprintf (buf, " 0x%x>", cs->header.uid);
|
|
443 write_c_string (buf, printcharfun);
|
|
444 }
|
|
445
|
272
|
446 DEFINE_LRECORD_IMPLEMENTATION ("charset", charset,
|
|
447 mark_charset, print_charset, 0, 0, 0,
|
|
448 struct Lisp_Charset);
|
70
|
449 /* Make a new charset. */
|
|
450
|
|
451 static Lisp_Object
|
213
|
452 make_charset (int id, Lisp_Object name, Bufbyte leading_byte, unsigned char rep_bytes,
|
70
|
453 unsigned char type, unsigned char columns, unsigned char graphic,
|
|
454 Bufbyte final, unsigned char direction, Lisp_Object doc,
|
|
455 Lisp_Object reg)
|
|
456 {
|
272
|
457 Lisp_Object obj;
|
|
458 struct Lisp_Charset *cs =
|
|
459 alloc_lcrecord_type (struct Lisp_Charset, lrecord_charset);
|
70
|
460 XSETCHARSET (obj, cs);
|
|
461
|
213
|
462 CHARSET_ID (cs) = id;
|
70
|
463 CHARSET_NAME (cs) = name;
|
|
464 CHARSET_LEADING_BYTE (cs) = leading_byte;
|
|
465 CHARSET_REP_BYTES (cs) = rep_bytes;
|
|
466 CHARSET_DIRECTION (cs) = direction;
|
|
467 CHARSET_TYPE (cs) = type;
|
|
468 CHARSET_COLUMNS (cs) = columns;
|
|
469 CHARSET_GRAPHIC (cs) = graphic;
|
|
470 CHARSET_FINAL (cs) = final;
|
|
471 CHARSET_DOC_STRING (cs) = doc;
|
|
472 CHARSET_REGISTRY (cs) = reg;
|
|
473 CHARSET_CCL_PROGRAM (cs) = Qnil;
|
|
474 CHARSET_REVERSE_DIRECTION_CHARSET (cs) = Qnil;
|
|
475
|
280
|
476 CHARSET_DIMENSION (cs) = (CHARSET_TYPE (cs) == CHARSET_TYPE_94 ||
|
|
477 CHARSET_TYPE (cs) == CHARSET_TYPE_96) ? 1 : 2;
|
|
478 CHARSET_CHARS (cs) = (CHARSET_TYPE (cs) == CHARSET_TYPE_94 ||
|
|
479 CHARSET_TYPE (cs) == CHARSET_TYPE_94X94) ? 94 : 96;
|
337
|
480
|
70
|
481 if (final)
|
|
482 {
|
|
483 /* some charsets do not have final characters. This includes
|
|
484 ASCII, Control-1, Composite, and the two faux private
|
|
485 charsets. */
|
|
486 assert (NILP (charset_by_attributes[type][final][direction]));
|
|
487 charset_by_attributes[type][final][direction] = obj;
|
|
488 }
|
|
489
|
|
490 assert (NILP (charset_by_leading_byte[leading_byte - 128]));
|
|
491 charset_by_leading_byte[leading_byte - 128] = obj;
|
|
492 if (leading_byte < 0xA0)
|
|
493 /* official leading byte */
|
|
494 rep_bytes_by_first_byte[leading_byte] = rep_bytes;
|
183
|
495
|
70
|
496 /* Some charsets are "faux" and don't have names or really exist at
|
|
497 all except in the leading-byte table. */
|
|
498 if (!NILP (name))
|
|
499 Fputhash (name, obj, Vcharset_hashtable);
|
|
500 return obj;
|
|
501 }
|
|
502
|
|
503 static int
|
|
504 get_unallocated_leading_byte (int dimension)
|
|
505 {
|
|
506 int lb;
|
|
507
|
|
508 if (dimension == 1)
|
|
509 {
|
|
510 if (next_allocated_1_byte_leading_byte > MAX_LEADING_BYTE_PRIVATE_1)
|
|
511 lb = 0;
|
|
512 else
|
|
513 lb = next_allocated_1_byte_leading_byte++;
|
|
514 }
|
|
515 else
|
|
516 {
|
|
517 if (next_allocated_2_byte_leading_byte > MAX_LEADING_BYTE_PRIVATE_2)
|
|
518 lb = 0;
|
|
519 else
|
|
520 lb = next_allocated_2_byte_leading_byte++;
|
|
521 }
|
|
522
|
|
523 if (!lb)
|
|
524 signal_simple_error
|
|
525 ("No more character sets free for this dimension",
|
|
526 make_int (dimension));
|
|
527
|
|
528 return lb;
|
|
529 }
|
|
530
|
|
531
|
|
532 /************************************************************************/
|
|
533 /* Basic charset Lisp functions */
|
|
534 /************************************************************************/
|
|
535
|
|
536 DEFUN ("charsetp", Fcharsetp, 1, 1, 0, /*
|
|
537 Return non-nil if OBJECT is a charset.
|
|
538 */
|
|
539 (object))
|
|
540 {
|
272
|
541 return CHARSETP (object) ? Qt : Qnil;
|
70
|
542 }
|
|
543
|
|
544 DEFUN ("find-charset", Ffind_charset, 1, 1, 0, /*
|
|
545 Retrieve the charset of the given name.
|
|
546 If CHARSET-OR-NAME is a charset object, it is simply returned.
|
|
547 Otherwise, CHARSET-OR-NAME should be a symbol. If there is no such charset,
|
|
548 nil is returned. Otherwise the associated charset object is returned.
|
|
549 */
|
|
550 (charset_or_name))
|
|
551 {
|
|
552 if (CHARSETP (charset_or_name))
|
|
553 return charset_or_name;
|
272
|
554
|
70
|
555 CHECK_SYMBOL (charset_or_name);
|
|
556 return Fgethash (charset_or_name, Vcharset_hashtable, Qnil);
|
|
557 }
|
|
558
|
|
559 DEFUN ("get-charset", Fget_charset, 1, 1, 0, /*
|
|
560 Retrieve the charset of the given name.
|
|
561 Same as `find-charset' except an error is signalled if there is no such
|
|
562 charset instead of returning nil.
|
|
563 */
|
|
564 (name))
|
|
565 {
|
|
566 Lisp_Object charset = Ffind_charset (name);
|
|
567
|
|
568 if (NILP (charset))
|
|
569 signal_simple_error ("No such charset", name);
|
|
570 return charset;
|
|
571 }
|
|
572
|
|
573 /* We store the charsets in hash tables with the names as the key and the
|
|
574 actual charset object as the value. Occasionally we need to use them
|
|
575 in a list format. These routines provide us with that. */
|
|
576 struct charset_list_closure
|
|
577 {
|
|
578 Lisp_Object *charset_list;
|
|
579 };
|
|
580
|
241
|
581 static int
|
70
|
582 add_charset_to_list_mapper (CONST void *hash_key, void *hash_contents,
|
|
583 void *charset_list_closure)
|
|
584 {
|
|
585 /* This function can GC */
|
|
586 Lisp_Object key, contents;
|
|
587 Lisp_Object *charset_list;
|
185
|
588 struct charset_list_closure *chcl =
|
|
589 (struct charset_list_closure*) charset_list_closure;
|
70
|
590 CVOID_TO_LISP (key, hash_key);
|
|
591 VOID_TO_LISP (contents, hash_contents);
|
|
592 charset_list = chcl->charset_list;
|
|
593
|
|
594 *charset_list = Fcons (XCHARSET_NAME (contents), *charset_list);
|
241
|
595 return 0;
|
70
|
596 }
|
|
597
|
|
598 DEFUN ("charset-list", Fcharset_list, 0, 0, 0, /*
|
|
599 Return a list of the names of all defined charsets.
|
|
600 */
|
|
601 ())
|
|
602 {
|
|
603 Lisp_Object charset_list = Qnil;
|
|
604 struct gcpro gcpro1;
|
|
605 struct charset_list_closure charset_list_closure;
|
|
606
|
|
607 GCPRO1 (charset_list);
|
|
608 charset_list_closure.charset_list = &charset_list;
|
|
609 elisp_maphash (add_charset_to_list_mapper, Vcharset_hashtable,
|
|
610 &charset_list_closure);
|
|
611 UNGCPRO;
|
|
612
|
|
613 return charset_list;
|
|
614 }
|
|
615
|
|
616 DEFUN ("charset-name", Fcharset_name, 1, 1, 0, /*
|
|
617 Return the name of the given charset.
|
|
618 */
|
|
619 (charset))
|
|
620 {
|
272
|
621 return XCHARSET_NAME (Fget_charset (charset));
|
70
|
622 }
|
|
623
|
|
624 DEFUN ("make-charset", Fmake_charset, 3, 3, 0, /*
|
|
625 Define a new character set.
|
|
626 This function is for use with Mule support.
|
|
627 NAME is a symbol, the name by which the character set is normally referred.
|
|
628 DOC-STRING is a string describing the character set.
|
|
629 PROPS is a property list, describing the specific nature of the
|
|
630 character set. Recognized properties are:
|
|
631
|
|
632 'registry A regular expression matching the font registry field for
|
|
633 this character set.
|
|
634 'dimension Number of octets used to index a character in this charset.
|
|
635 Either 1 or 2. Defaults to 1.
|
|
636 'columns Number of columns used to display a character in this charset.
|
|
637 Only used in TTY mode. (Under X, the actual width of a
|
|
638 character can be derived from the font used to display the
|
|
639 characters.) If unspecified, defaults to the dimension
|
|
640 (this is almost always the correct value).
|
|
641 'chars Number of characters in each dimension (94 or 96).
|
|
642 Defaults to 94. Note that if the dimension is 2, the
|
|
643 character set thus described is 94x94 or 96x96.
|
|
644 'final Final byte of ISO 2022 escape sequence. Must be
|
|
645 supplied. Each combination of (DIMENSION, CHARS) defines a
|
|
646 separate namespace for final bytes. Note that ISO
|
|
647 2022 restricts the final byte to the range
|
|
648 0x30 - 0x7E if dimension == 1, and 0x30 - 0x5F if
|
|
649 dimension == 2. Note also that final bytes in the range
|
|
650 0x30 - 0x3F are reserved for user-defined (not official)
|
|
651 character sets.
|
|
652 'graphic 0 (use left half of font on output) or 1 (use right half
|
|
653 of font on output). Defaults to 0. For example, for
|
|
654 a font whose registry is ISO8859-1, the left half
|
|
655 (octets 0x20 - 0x7F) is the `ascii' character set, while
|
|
656 the right half (octets 0xA0 - 0xFF) is the `latin-1'
|
|
657 character set. With 'graphic set to 0, the octets
|
|
658 will have their high bit cleared; with it set to 1,
|
|
659 the octets will have their high bit set.
|
|
660 'direction 'l2r (left-to-right) or 'r2l (right-to-left).
|
|
661 Defaults to 'l2r.
|
|
662 'ccl-program A compiled CCL program used to convert a character in
|
|
663 this charset into an index into the font. This is in
|
|
664 addition to the 'graphic property. The CCL program
|
|
665 is passed the octets of the character, with the high
|
|
666 bit cleared and set depending upon whether the value
|
|
667 of the 'graphic property is 0 or 1.
|
|
668 */
|
|
669 (name, doc_string, props))
|
|
670 {
|
|
671 int lb, dimension = 1, chars = 94, graphic = 0, final = 0, columns = -1;
|
|
672 int direction = CHARSET_LEFT_TO_RIGHT;
|
|
673 int type;
|
|
674 Lisp_Object registry = Qnil;
|
|
675 Lisp_Object charset;
|
|
676 Lisp_Object rest, keyword, value;
|
|
677 Lisp_Object ccl_program = Qnil;
|
|
678
|
|
679 CHECK_SYMBOL (name);
|
|
680 if (!NILP (doc_string))
|
|
681 CHECK_STRING (doc_string);
|
|
682
|
|
683 charset = Ffind_charset (name);
|
|
684 if (!NILP (charset))
|
|
685 signal_simple_error ("Cannot redefine existing charset", name);
|
|
686
|
|
687 EXTERNAL_PROPERTY_LIST_LOOP (rest, keyword, value, props)
|
|
688 {
|
|
689 if (EQ (keyword, Qdimension))
|
|
690 {
|
|
691 CHECK_INT (value);
|
|
692 dimension = XINT (value);
|
|
693 if (dimension < 1 || dimension > 2)
|
|
694 signal_simple_error ("Invalid value for 'dimension", value);
|
|
695 }
|
|
696
|
|
697 else if (EQ (keyword, Qchars))
|
|
698 {
|
|
699 CHECK_INT (value);
|
|
700 chars = XINT (value);
|
|
701 if (chars != 94 && chars != 96)
|
|
702 signal_simple_error ("Invalid value for 'chars", value);
|
|
703 }
|
|
704
|
|
705 else if (EQ (keyword, Qcolumns))
|
|
706 {
|
|
707 CHECK_INT (value);
|
|
708 columns = XINT (value);
|
|
709 if (columns != 1 && columns != 2)
|
|
710 signal_simple_error ("Invalid value for 'columns", value);
|
|
711 }
|
|
712
|
|
713 else if (EQ (keyword, Qgraphic))
|
|
714 {
|
|
715 CHECK_INT (value);
|
|
716 graphic = XINT (value);
|
|
717 if (graphic < 0 || graphic > 1)
|
|
718 signal_simple_error ("Invalid value for 'graphic", value);
|
|
719 }
|
|
720
|
|
721 else if (EQ (keyword, Qregistry))
|
|
722 {
|
|
723 CHECK_STRING (value);
|
|
724 registry = value;
|
|
725 }
|
|
726
|
|
727 else if (EQ (keyword, Qdirection))
|
|
728 {
|
|
729 if (EQ (value, Ql2r))
|
|
730 direction = CHARSET_LEFT_TO_RIGHT;
|
|
731 else if (EQ (value, Qr2l))
|
|
732 direction = CHARSET_RIGHT_TO_LEFT;
|
|
733 else
|
|
734 signal_simple_error ("Invalid value for 'direction", value);
|
|
735 }
|
|
736
|
|
737 else if (EQ (keyword, Qfinal))
|
|
738 {
|
|
739 CHECK_CHAR_COERCE_INT (value);
|
|
740 final = XCHAR (value);
|
|
741 if (final < '0' || final > '~')
|
|
742 signal_simple_error ("Invalid value for 'final", value);
|
|
743 }
|
|
744
|
|
745 else if (EQ (keyword, Qccl_program))
|
|
746 {
|
|
747 CHECK_VECTOR (value);
|
|
748 ccl_program = value;
|
|
749 }
|
|
750
|
|
751 else
|
|
752 signal_simple_error ("Unrecognized property", keyword);
|
|
753 }
|
|
754
|
|
755 if (!final)
|
|
756 error ("'final must be specified");
|
|
757 if (dimension == 2 && final > 0x5F)
|
|
758 signal_simple_error
|
|
759 ("Final must be in the range 0x30 - 0x5F for dimension == 2",
|
|
760 make_char (final));
|
|
761
|
|
762 if (dimension == 1)
|
|
763 type = (chars == 94) ? CHARSET_TYPE_94 : CHARSET_TYPE_96;
|
|
764 else
|
|
765 type = (chars == 94) ? CHARSET_TYPE_94X94 : CHARSET_TYPE_96X96;
|
|
766
|
|
767 if (!NILP (CHARSET_BY_ATTRIBUTES (type, final, CHARSET_LEFT_TO_RIGHT)) ||
|
|
768 !NILP (CHARSET_BY_ATTRIBUTES (type, final, CHARSET_RIGHT_TO_LEFT)))
|
|
769 error
|
|
770 ("Character set already defined for this DIMENSION/CHARS/FINAL combo");
|
|
771
|
|
772 lb = get_unallocated_leading_byte (dimension);
|
|
773
|
|
774 if (NILP (doc_string))
|
|
775 doc_string = build_string ("");
|
|
776
|
|
777 if (NILP (registry))
|
|
778 registry = build_string ("");
|
|
779
|
|
780 if (columns == -1)
|
|
781 columns = dimension;
|
213
|
782 charset = make_charset (-1, name, lb, dimension + 2, type, columns, graphic,
|
70
|
783 final, direction, doc_string, registry);
|
|
784 if (!NILP (ccl_program))
|
|
785 XCHARSET_CCL_PROGRAM (charset) = ccl_program;
|
|
786 return charset;
|
|
787 }
|
|
788
|
280
|
789 DEFUN ("make-reverse-direction-charset", Fmake_reverse_direction_charset,
|
|
790 2, 2, 0, /*
|
70
|
791 Make a charset equivalent to CHARSET but which goes in the opposite direction.
|
|
792 NEW-NAME is the name of the new charset. Return the new charset.
|
|
793 */
|
|
794 (charset, new_name))
|
|
795 {
|
|
796 Lisp_Object new_charset = Qnil;
|
|
797 int lb, dimension, columns, graphic, final;
|
|
798 int direction, type;
|
|
799 Lisp_Object registry, doc_string;
|
|
800 struct Lisp_Charset *cs;
|
|
801
|
|
802 charset = Fget_charset (charset);
|
|
803 if (!NILP (XCHARSET_REVERSE_DIRECTION_CHARSET (charset)))
|
|
804 signal_simple_error ("Charset already has reverse-direction charset",
|
|
805 charset);
|
|
806
|
|
807 CHECK_SYMBOL (new_name);
|
|
808 if (!NILP (Ffind_charset (new_name)))
|
|
809 signal_simple_error ("Cannot redefine existing charset", new_name);
|
|
810
|
|
811 cs = XCHARSET (charset);
|
183
|
812
|
70
|
813 type = CHARSET_TYPE (cs);
|
|
814 columns = CHARSET_COLUMNS (cs);
|
|
815 dimension = CHARSET_DIMENSION (cs);
|
|
816 lb = get_unallocated_leading_byte (dimension);
|
|
817
|
|
818 graphic = CHARSET_GRAPHIC (cs);
|
|
819 final = CHARSET_FINAL (cs);
|
|
820 direction = CHARSET_RIGHT_TO_LEFT;
|
|
821 if (CHARSET_DIRECTION (cs) == CHARSET_RIGHT_TO_LEFT)
|
|
822 direction = CHARSET_LEFT_TO_RIGHT;
|
|
823 doc_string = CHARSET_DOC_STRING (cs);
|
|
824 registry = CHARSET_REGISTRY (cs);
|
|
825
|
213
|
826 new_charset = make_charset (-1, new_name, lb, dimension + 2, type, columns,
|
70
|
827 graphic, final, direction, doc_string, registry);
|
|
828
|
|
829 CHARSET_REVERSE_DIRECTION_CHARSET (cs) = new_charset;
|
|
830 XCHARSET_REVERSE_DIRECTION_CHARSET (new_charset) = charset;
|
|
831
|
|
832 return new_charset;
|
|
833 }
|
|
834
|
284
|
835 /* #### Reverse direction charsets not yet implemented. */
|
70
|
836 #if 0
|
280
|
837 DEFUN ("charset-reverse-direction-charset", Fcharset_reverse_direction_charset,
|
|
838 1, 1, 0, /*
|
70
|
839 Return the reverse-direction charset parallel to CHARSET, if any.
|
|
840 This is the charset with the same properties (in particular, the same
|
|
841 dimension, number of characters per dimension, and final byte) as
|
|
842 CHARSET but whose characters are displayed in the opposite direction.
|
|
843 */
|
|
844 (charset))
|
|
845 {
|
|
846 charset = Fget_charset (charset);
|
|
847 return XCHARSET_REVERSE_DIRECTION_CHARSET (charset);
|
|
848 }
|
|
849 #endif
|
|
850
|
|
851 DEFUN ("charset-from-attributes", Fcharset_from_attributes, 3, 4, 0, /*
|
|
852 Return a charset with the given DIMENSION, CHARS, FINAL, and DIRECTION.
|
|
853 If DIRECTION is omitted, both directions will be checked (left-to-right
|
|
854 will be returned if character sets exist for both directions).
|
|
855 */
|
|
856 (dimension, chars, final, direction))
|
|
857 {
|
|
858 int dm, ch, fi, di = -1;
|
|
859 int type;
|
|
860 Lisp_Object obj = Qnil;
|
|
861
|
|
862 CHECK_INT (dimension);
|
|
863 dm = XINT (dimension);
|
|
864 if (dm < 1 || dm > 2)
|
|
865 signal_simple_error ("Invalid value for DIMENSION", dimension);
|
|
866
|
|
867 CHECK_INT (chars);
|
|
868 ch = XINT (chars);
|
|
869 if (ch != 94 && ch != 96)
|
|
870 signal_simple_error ("Invalid value for CHARS", chars);
|
|
871
|
|
872 CHECK_CHAR_COERCE_INT (final);
|
|
873 fi = XCHAR (final);
|
|
874 if (fi < '0' || fi > '~')
|
|
875 signal_simple_error ("Invalid value for FINAL", final);
|
|
876
|
|
877 if (EQ (direction, Ql2r))
|
|
878 di = CHARSET_LEFT_TO_RIGHT;
|
|
879 else if (EQ (direction, Qr2l))
|
|
880 di = CHARSET_RIGHT_TO_LEFT;
|
|
881 else if (!NILP (direction))
|
|
882 signal_simple_error ("Invalid value for DIRECTION", direction);
|
|
883
|
|
884 if (dm == 2 && fi > 0x5F)
|
|
885 signal_simple_error
|
|
886 ("Final must be in the range 0x30 - 0x5F for dimension == 2", final);
|
|
887
|
|
888 if (dm == 1)
|
|
889 type = (ch == 94) ? CHARSET_TYPE_94 : CHARSET_TYPE_96;
|
|
890 else
|
|
891 type = (ch == 94) ? CHARSET_TYPE_94X94 : CHARSET_TYPE_96X96;
|
|
892
|
|
893 if (di == -1)
|
|
894 {
|
|
895 obj = CHARSET_BY_ATTRIBUTES (type, fi, CHARSET_LEFT_TO_RIGHT);
|
|
896 if (NILP (obj))
|
|
897 obj = CHARSET_BY_ATTRIBUTES (type, fi, CHARSET_RIGHT_TO_LEFT);
|
|
898 }
|
|
899 else
|
|
900 obj = CHARSET_BY_ATTRIBUTES (type, fi, di);
|
|
901
|
|
902 if (CHARSETP (obj))
|
|
903 return XCHARSET_NAME (obj);
|
|
904 return obj;
|
|
905 }
|
|
906
|
|
907 DEFUN ("charset-doc-string", Fcharset_doc_string, 1, 1, 0, /*
|
|
908 Return doc string of CHARSET.
|
|
909 */
|
|
910 (charset))
|
|
911 {
|
|
912 return XCHARSET_DOC_STRING (Fget_charset (charset));
|
|
913 }
|
|
914
|
|
915 DEFUN ("charset-dimension", Fcharset_dimension, 1, 1, 0, /*
|
|
916 Return dimension of CHARSET.
|
|
917 */
|
|
918 (charset))
|
|
919 {
|
|
920 return make_int (XCHARSET_DIMENSION (Fget_charset (charset)));
|
|
921 }
|
|
922
|
|
923 DEFUN ("charset-property", Fcharset_property, 2, 2, 0, /*
|
|
924 Return property PROP of CHARSET.
|
|
925 Recognized properties are those listed in `make-charset', as well as
|
|
926 'name and 'doc-string.
|
|
927 */
|
|
928 (charset, prop))
|
|
929 {
|
|
930 struct Lisp_Charset *cs;
|
|
931
|
|
932 charset = Fget_charset (charset);
|
|
933 cs = XCHARSET (charset);
|
|
934
|
|
935 CHECK_SYMBOL (prop);
|
|
936 if (EQ (prop, Qname)) return CHARSET_NAME (cs);
|
|
937 if (EQ (prop, Qdoc_string)) return CHARSET_DOC_STRING (cs);
|
|
938 if (EQ (prop, Qdimension)) return make_int (CHARSET_DIMENSION (cs));
|
|
939 if (EQ (prop, Qcolumns)) return make_int (CHARSET_COLUMNS (cs));
|
|
940 if (EQ (prop, Qgraphic)) return make_int (CHARSET_GRAPHIC (cs));
|
|
941 if (EQ (prop, Qfinal)) return make_char (CHARSET_FINAL (cs));
|
|
942 if (EQ (prop, Qchars)) return make_int (CHARSET_CHARS (cs));
|
|
943 if (EQ (prop, Qregistry)) return CHARSET_REGISTRY (cs);
|
|
944 if (EQ (prop, Qccl_program)) return CHARSET_CCL_PROGRAM (cs);
|
|
945 if (EQ (prop, Qdirection))
|
272
|
946 return CHARSET_DIRECTION (cs) == CHARSET_LEFT_TO_RIGHT ? Ql2r : Qr2l;
|
70
|
947 if (EQ (prop, Qreverse_direction_charset))
|
|
948 {
|
|
949 Lisp_Object obj = CHARSET_REVERSE_DIRECTION_CHARSET (cs);
|
|
950 if (NILP (obj))
|
|
951 return Qnil;
|
|
952 else
|
|
953 return XCHARSET_NAME (obj);
|
|
954 }
|
|
955 signal_simple_error ("Unrecognized charset property name", prop);
|
|
956 return Qnil; /* not reached */
|
|
957 }
|
|
958
|
213
|
959 DEFUN ("charset-id", Fcharset_id, 1, 1, 0, /*
|
|
960 Return charset identification number of CHARSET.
|
|
961 */
|
|
962 (charset))
|
|
963 {
|
|
964 return make_int(XCHARSET_ID (Fget_charset (charset)));
|
|
965 }
|
|
966
|
70
|
967 /* #### We need to figure out which properties we really want to
|
|
968 allow to be set. */
|
|
969
|
|
970 DEFUN ("set-charset-ccl-program", Fset_charset_ccl_program, 2, 2, 0, /*
|
|
971 Set the 'ccl-program property of CHARSET to CCL-PROGRAM.
|
|
972 */
|
|
973 (charset, ccl_program))
|
|
974 {
|
|
975 charset = Fget_charset (charset);
|
|
976 CHECK_VECTOR (ccl_program);
|
|
977 XCHARSET_CCL_PROGRAM (charset) = ccl_program;
|
|
978 return Qnil;
|
|
979 }
|
|
980
|
|
981 static void
|
|
982 invalidate_charset_font_caches (Lisp_Object charset)
|
|
983 {
|
|
984 /* Invalidate font cache entries for charset on all devices. */
|
|
985 Lisp_Object devcons, concons, hashtab;
|
|
986 DEVICE_LOOP_NO_BREAK (devcons, concons)
|
|
987 {
|
|
988 struct device *d = XDEVICE (XCAR (devcons));
|
|
989 hashtab = Fgethash (charset, d->charset_font_cache, Qunbound);
|
|
990 if (!UNBOUNDP (hashtab))
|
|
991 Fclrhash (hashtab);
|
|
992 }
|
|
993 }
|
|
994
|
|
995 /* Japanese folks may want to (set-charset-registry 'ascii "jisx0201") */
|
|
996 DEFUN ("set-charset-registry", Fset_charset_registry, 2, 2, 0, /*
|
|
997 Set the 'registry property of CHARSET to REGISTRY.
|
|
998 */
|
|
999 (charset, registry))
|
|
1000 {
|
|
1001 charset = Fget_charset (charset);
|
|
1002 CHECK_STRING (registry);
|
|
1003 XCHARSET_REGISTRY (charset) = registry;
|
|
1004 invalidate_charset_font_caches (charset);
|
|
1005 face_property_was_changed (Vdefault_face, Qfont, Qglobal);
|
|
1006 return Qnil;
|
|
1007 }
|
183
|
1008
|
70
|
1009
|
|
1010 /************************************************************************/
|
|
1011 /* Lisp primitives for working with characters */
|
|
1012 /************************************************************************/
|
|
1013
|
|
1014 DEFUN ("make-char", Fmake_char, 2, 3, 0, /*
|
|
1015 Make a multi-byte character from CHARSET and octets ARG1 and ARG2.
|
|
1016 */
|
|
1017 (charset, arg1, arg2))
|
|
1018 {
|
|
1019 struct Lisp_Charset *cs;
|
|
1020 int a1, a2;
|
|
1021 int lowlim, highlim;
|
|
1022
|
|
1023 charset = Fget_charset (charset);
|
|
1024 cs = XCHARSET (charset);
|
|
1025
|
|
1026 if (EQ (charset, Vcharset_ascii)) lowlim = 0, highlim = 127;
|
|
1027 else if (EQ (charset, Vcharset_control_1)) lowlim = 0, highlim = 31;
|
|
1028 else if (CHARSET_CHARS (cs) == 94) lowlim = 33, highlim = 126;
|
|
1029 else /* CHARSET_CHARS (cs) == 96) */ lowlim = 32, highlim = 127;
|
|
1030
|
|
1031 CHECK_INT (arg1);
|
347
|
1032 /* It is useful (and safe, according to Olivier Galibert) to strip
|
|
1033 the 8th bit off ARG1 and ARG2 becaue it allows programmers to
|
|
1034 write (make-char 'latin-iso8859-2 CODE) where code is the actual
|
|
1035 Latin 2 code of the character. */
|
|
1036 a1 = XINT (arg1) & 0x7f;
|
70
|
1037 if (a1 < lowlim || a1 > highlim)
|
|
1038 args_out_of_range_3 (arg1, make_int (lowlim), make_int (highlim));
|
|
1039
|
|
1040 if (CHARSET_DIMENSION (cs) == 1)
|
|
1041 {
|
|
1042 if (!NILP (arg2))
|
|
1043 signal_simple_error
|
|
1044 ("Charset is of dimension one; second octet must be nil", arg2);
|
|
1045 return make_char (MAKE_CHAR (charset, a1, 0));
|
|
1046 }
|
|
1047
|
|
1048 CHECK_INT (arg2);
|
347
|
1049 a2 = XINT (arg2) & 0x7f;
|
70
|
1050 if (a2 < lowlim || a2 > highlim)
|
|
1051 args_out_of_range_3 (arg2, make_int (lowlim), make_int (highlim));
|
|
1052
|
|
1053 return make_char (MAKE_CHAR (charset, a1, a2));
|
|
1054 }
|
|
1055
|
|
1056 DEFUN ("char-charset", Fchar_charset, 1, 1, 0, /*
|
|
1057 Return the character set of char CH.
|
|
1058 */
|
|
1059 (ch))
|
|
1060 {
|
|
1061 CHECK_CHAR_COERCE_INT (ch);
|
|
1062
|
|
1063 return XCHARSET_NAME (CHARSET_BY_LEADING_BYTE
|
|
1064 (CHAR_LEADING_BYTE (XCHAR (ch))));
|
|
1065 }
|
|
1066
|
|
1067 DEFUN ("char-octet", Fchar_octet, 1, 2, 0, /*
|
|
1068 Return the octet numbered N (should be 0 or 1) of char CH.
|
|
1069 N defaults to 0 if omitted.
|
|
1070 */
|
|
1071 (ch, n))
|
|
1072 {
|
|
1073 Lisp_Object charset;
|
183
|
1074 int c1, c2, int_n;
|
70
|
1075
|
|
1076 CHECK_CHAR_COERCE_INT (ch);
|
|
1077 if (NILP (n))
|
183
|
1078 int_n = 0;
|
70
|
1079 else
|
|
1080 {
|
|
1081 CHECK_INT (n);
|
183
|
1082 int_n = XINT (n);
|
|
1083 if (int_n != 0 && int_n != 1)
|
70
|
1084 signal_simple_error ("Octet number must be 0 or 1", n);
|
|
1085 }
|
|
1086 BREAKUP_CHAR (XCHAR (ch), charset, c1, c2);
|
183
|
1087 return make_int (int_n == 0 ? c1 : c2);
|
70
|
1088 }
|
|
1089
|
|
1090
|
337
|
1091 #ifdef ENABLE_COMPOSITE_CHARS
|
70
|
1092 /************************************************************************/
|
|
1093 /* composite character functions */
|
|
1094 /************************************************************************/
|
|
1095
|
|
1096 Emchar
|
|
1097 lookup_composite_char (Bufbyte *str, int len)
|
|
1098 {
|
|
1099 Lisp_Object lispstr = make_string (str, len);
|
|
1100 Lisp_Object ch = Fgethash (lispstr,
|
|
1101 Vcomposite_char_string2char_hashtable,
|
|
1102 Qunbound);
|
|
1103 Emchar emch;
|
|
1104
|
|
1105 if (UNBOUNDP (ch))
|
|
1106 {
|
|
1107 if (composite_char_row_next >= 128)
|
|
1108 signal_simple_error ("No more composite chars available", lispstr);
|
|
1109 emch = MAKE_CHAR (Vcharset_composite, composite_char_row_next,
|
|
1110 composite_char_col_next);
|
|
1111 Fputhash (make_char (emch), lispstr,
|
|
1112 Vcomposite_char_char2string_hashtable);
|
|
1113 Fputhash (lispstr, make_char (emch),
|
|
1114 Vcomposite_char_string2char_hashtable);
|
|
1115 composite_char_col_next++;
|
|
1116 if (composite_char_col_next >= 128)
|
|
1117 {
|
|
1118 composite_char_col_next = 32;
|
|
1119 composite_char_row_next++;
|
|
1120 }
|
|
1121 }
|
|
1122 else
|
|
1123 emch = XCHAR (ch);
|
|
1124 return emch;
|
|
1125 }
|
|
1126
|
|
1127 Lisp_Object
|
|
1128 composite_char_string (Emchar ch)
|
|
1129 {
|
|
1130 Lisp_Object str = Fgethash (make_char (ch),
|
|
1131 Vcomposite_char_char2string_hashtable,
|
|
1132 Qunbound);
|
|
1133 assert (!UNBOUNDP (str));
|
|
1134 return str;
|
|
1135 }
|
|
1136
|
337
|
1137 xxDEFUN ("make-composite-char", Fmake_composite_char, 1, 1, 0, /*
|
70
|
1138 Convert a string into a single composite character.
|
|
1139 The character is the result of overstriking all the characters in
|
|
1140 the string.
|
|
1141 */
|
|
1142 (string))
|
|
1143 {
|
|
1144 CHECK_STRING (string);
|
|
1145 return make_char (lookup_composite_char (XSTRING_DATA (string),
|
|
1146 XSTRING_LENGTH (string)));
|
|
1147 }
|
|
1148
|
337
|
1149 xxDEFUN ("composite-char-string", Fcomposite_char_string, 1, 1, 0, /*
|
70
|
1150 Return a string of the characters comprising a composite character.
|
|
1151 */
|
|
1152 (ch))
|
|
1153 {
|
|
1154 Emchar emch;
|
|
1155
|
|
1156 CHECK_CHAR (ch);
|
|
1157 emch = XCHAR (ch);
|
|
1158 if (CHAR_LEADING_BYTE (emch) != LEADING_BYTE_COMPOSITE)
|
|
1159 signal_simple_error ("Must be composite char", ch);
|
|
1160 return composite_char_string (emch);
|
|
1161 }
|
337
|
1162 #endif /* ENABLE_COMPOSITE_CHARS */
|
70
|
1163
|
|
1164
|
|
1165 /************************************************************************/
|
|
1166 /* initialization */
|
|
1167 /************************************************************************/
|
|
1168
|
|
1169 void
|
|
1170 syms_of_mule_charset (void)
|
|
1171 {
|
|
1172 DEFSUBR (Fcharsetp);
|
|
1173 DEFSUBR (Ffind_charset);
|
|
1174 DEFSUBR (Fget_charset);
|
|
1175 DEFSUBR (Fcharset_list);
|
|
1176 DEFSUBR (Fcharset_name);
|
|
1177 DEFSUBR (Fmake_charset);
|
|
1178 DEFSUBR (Fmake_reverse_direction_charset);
|
|
1179 /* DEFSUBR (Freverse_direction_charset); */
|
|
1180 DEFSUBR (Fcharset_from_attributes);
|
|
1181 DEFSUBR (Fcharset_doc_string);
|
|
1182 DEFSUBR (Fcharset_dimension);
|
|
1183 DEFSUBR (Fcharset_property);
|
213
|
1184 DEFSUBR (Fcharset_id);
|
70
|
1185 DEFSUBR (Fset_charset_ccl_program);
|
|
1186 DEFSUBR (Fset_charset_registry);
|
|
1187
|
|
1188 DEFSUBR (Fmake_char);
|
|
1189 DEFSUBR (Fchar_charset);
|
|
1190 DEFSUBR (Fchar_octet);
|
|
1191
|
337
|
1192 #ifdef ENABLE_COMPOSITE_CHARS
|
70
|
1193 DEFSUBR (Fmake_composite_char);
|
|
1194 DEFSUBR (Fcomposite_char_string);
|
337
|
1195 #endif
|
70
|
1196
|
|
1197 defsymbol (&Qcharsetp, "charsetp");
|
|
1198 defsymbol (&Qregistry, "registry");
|
|
1199 defsymbol (&Qfinal, "final");
|
|
1200 defsymbol (&Qgraphic, "graphic");
|
|
1201 defsymbol (&Qdirection, "direction");
|
|
1202 defsymbol (&Qreverse_direction_charset, "reverse-direction-charset");
|
|
1203 defsymbol (&Qccl_program, "ccl-program");
|
|
1204
|
|
1205 defsymbol (&Ql2r, "l2r");
|
|
1206 defsymbol (&Qr2l, "r2l");
|
|
1207
|
74
|
1208 /* Charsets, compatible with Emacs/Mule 19.33-delta
|
|
1209 Naming convention is Script-Charset[-Edition] */
|
|
1210 defsymbol (&Qascii, "ascii");
|
|
1211 defsymbol (&Qcontrol_1, "control-1");
|
|
1212 defsymbol (&Qlatin_iso8859_1, "latin-iso8859-1");
|
|
1213 defsymbol (&Qlatin_iso8859_2, "latin-iso8859-2");
|
|
1214 defsymbol (&Qlatin_iso8859_3, "latin-iso8859-3");
|
|
1215 defsymbol (&Qlatin_iso8859_4, "latin-iso8859-4");
|
|
1216 defsymbol (&Qcyrillic_iso8859_5, "cyrillic-iso8859-5");
|
|
1217 defsymbol (&Qarabic_iso8859_6, "arabic-iso8859-6");
|
|
1218 defsymbol (&Qgreek_iso8859_7, "greek-iso8859-7");
|
|
1219 defsymbol (&Qhebrew_iso8859_8, "hebrew-iso8859-8");
|
|
1220 defsymbol (&Qlatin_iso8859_9, "latin-iso8859-9");
|
|
1221 defsymbol (&Qthai_tis620, "thai-tis620");
|
183
|
1222
|
74
|
1223 defsymbol (&Qkatakana_jisx0201, "katakana-jisx0201");
|
|
1224 defsymbol (&Qlatin_jisx0201, "latin-jisx0201");
|
70
|
1225 defsymbol (&Qjapanese_jisx0208_1978, "japanese-jisx0208-1978");
|
|
1226 defsymbol (&Qjapanese_jisx0208, "japanese-jisx0208");
|
|
1227 defsymbol (&Qjapanese_jisx0212, "japanese-jisx0212");
|
183
|
1228
|
74
|
1229 defsymbol (&Qchinese_gb2312, "chinese-gb2312");
|
|
1230 defsymbol (&Qchinese_big5_1, "chinese-big5-1");
|
|
1231 defsymbol (&Qchinese_big5_2, "chinese-big5-2");
|
|
1232 defsymbol (&Qchinese_cns11643_1, "chinese-cns11643-1");
|
|
1233 defsymbol (&Qchinese_cns11643_2, "chinese-cns11643-2");
|
183
|
1234
|
74
|
1235 defsymbol (&Qkorean_ksc5601, "korean-ksc5601");
|
|
1236 defsymbol (&Qcomposite, "composite");
|
70
|
1237 }
|
|
1238
|
|
1239 void
|
|
1240 vars_of_mule_charset (void)
|
|
1241 {
|
|
1242 int i, j, k;
|
|
1243
|
183
|
1244 /* Table of charsets indexed by leading byte. */
|
|
1245 for (i = 0; i < countof (charset_by_leading_byte); i++)
|
70
|
1246 charset_by_leading_byte[i] = Qnil;
|
183
|
1247
|
|
1248 /* Table of charsets indexed by type/final-byte/direction. */
|
|
1249 for (i = 0; i < countof (charset_by_attributes); i++)
|
|
1250 for (j = 0; j < countof (charset_by_attributes[0]); j++)
|
|
1251 for (k = 0; k < countof (charset_by_attributes[0][0]); k++)
|
70
|
1252 charset_by_attributes[i][j][k] = Qnil;
|
|
1253
|
|
1254 next_allocated_1_byte_leading_byte = MIN_LEADING_BYTE_PRIVATE_1;
|
|
1255 next_allocated_2_byte_leading_byte = MIN_LEADING_BYTE_PRIVATE_2;
|
|
1256 }
|
|
1257
|
|
1258 void
|
|
1259 complex_vars_of_mule_charset (void)
|
|
1260 {
|
|
1261 staticpro (&Vcharset_hashtable);
|
|
1262 Vcharset_hashtable = make_lisp_hashtable (50, HASHTABLE_NONWEAK,
|
|
1263 HASHTABLE_EQ);
|
183
|
1264
|
70
|
1265 /* Predefined character sets. We store them into variables for
|
|
1266 ease of access. */
|
|
1267
|
|
1268 Vcharset_ascii =
|
213
|
1269 make_charset (0, Qascii, LEADING_BYTE_ASCII, 1,
|
70
|
1270 CHARSET_TYPE_94, 1, 0, 'B',
|
|
1271 CHARSET_LEFT_TO_RIGHT,
|
167
|
1272 build_string ("ASCII (ISO 646 IRV)"),
|
78
|
1273 build_string ("iso8859-1"));
|
70
|
1274 Vcharset_control_1 =
|
213
|
1275 make_charset (-1, Qcontrol_1, LEADING_BYTE_CONTROL_1, 2,
|
321
|
1276 CHARSET_TYPE_94, 1, 1, 0,
|
70
|
1277 CHARSET_LEFT_TO_RIGHT,
|
|
1278 build_string ("Control characters"),
|
|
1279 build_string (""));
|
74
|
1280 Vcharset_latin_iso8859_1 =
|
213
|
1281 make_charset (129, Qlatin_iso8859_1, LEADING_BYTE_LATIN_ISO8859_1, 2,
|
70
|
1282 CHARSET_TYPE_96, 1, 1, 'A',
|
|
1283 CHARSET_LEFT_TO_RIGHT,
|
167
|
1284 build_string ("ISO 8859-1 (Latin-1)"),
|
78
|
1285 build_string ("iso8859-1"));
|
74
|
1286 Vcharset_latin_iso8859_2 =
|
213
|
1287 make_charset (130, Qlatin_iso8859_2, LEADING_BYTE_LATIN_ISO8859_2, 2,
|
70
|
1288 CHARSET_TYPE_96, 1, 1, 'B',
|
|
1289 CHARSET_LEFT_TO_RIGHT,
|
167
|
1290 build_string ("ISO 8859-2 (Latin-2)"),
|
78
|
1291 build_string ("iso8859-2"));
|
74
|
1292 Vcharset_latin_iso8859_3 =
|
213
|
1293 make_charset (131, Qlatin_iso8859_3, LEADING_BYTE_LATIN_ISO8859_3, 2,
|
70
|
1294 CHARSET_TYPE_96, 1, 1, 'C',
|
|
1295 CHARSET_LEFT_TO_RIGHT,
|
167
|
1296 build_string ("ISO 8859-3 (Latin-3)"),
|
78
|
1297 build_string ("iso8859-3"));
|
74
|
1298 Vcharset_latin_iso8859_4 =
|
213
|
1299 make_charset (132, Qlatin_iso8859_4, LEADING_BYTE_LATIN_ISO8859_4, 2,
|
70
|
1300 CHARSET_TYPE_96, 1, 1, 'D',
|
|
1301 CHARSET_LEFT_TO_RIGHT,
|
167
|
1302 build_string ("ISO 8859-4 (Latin-4)"),
|
78
|
1303 build_string ("iso8859-4"));
|
74
|
1304 Vcharset_cyrillic_iso8859_5 =
|
213
|
1305 make_charset (140, Qcyrillic_iso8859_5, LEADING_BYTE_CYRILLIC_ISO8859_5, 2,
|
70
|
1306 CHARSET_TYPE_96, 1, 1, 'L',
|
|
1307 CHARSET_LEFT_TO_RIGHT,
|
167
|
1308 build_string ("ISO 8859-5 (Cyrillic)"),
|
78
|
1309 build_string ("iso8859-5"));
|
74
|
1310 Vcharset_arabic_iso8859_6 =
|
213
|
1311 make_charset (135, Qarabic_iso8859_6, LEADING_BYTE_ARABIC_ISO8859_6, 2,
|
70
|
1312 CHARSET_TYPE_96, 1, 1, 'G',
|
|
1313 CHARSET_RIGHT_TO_LEFT,
|
167
|
1314 build_string ("ISO 8859-6 (Arabic)"),
|
78
|
1315 build_string ("iso8859-6"));
|
74
|
1316 Vcharset_greek_iso8859_7 =
|
213
|
1317 make_charset (134, Qgreek_iso8859_7, LEADING_BYTE_GREEK_ISO8859_7, 2,
|
70
|
1318 CHARSET_TYPE_96, 1, 1, 'F',
|
|
1319 CHARSET_LEFT_TO_RIGHT,
|
167
|
1320 build_string ("ISO 8859-7 (Greek)"),
|
78
|
1321 build_string ("iso8859-7"));
|
74
|
1322 Vcharset_hebrew_iso8859_8 =
|
213
|
1323 make_charset (136, Qhebrew_iso8859_8, LEADING_BYTE_HEBREW_ISO8859_8, 2,
|
70
|
1324 CHARSET_TYPE_96, 1, 1, 'H',
|
|
1325 CHARSET_RIGHT_TO_LEFT,
|
167
|
1326 build_string ("ISO 8859-8 (Hebrew)"),
|
78
|
1327 build_string ("iso8859-8"));
|
74
|
1328 Vcharset_latin_iso8859_9 =
|
213
|
1329 make_charset (141, Qlatin_iso8859_9, LEADING_BYTE_LATIN_ISO8859_9, 2,
|
70
|
1330 CHARSET_TYPE_96, 1, 1, 'M',
|
|
1331 CHARSET_LEFT_TO_RIGHT,
|
167
|
1332 build_string ("ISO 8859-9 (Latin-5)"),
|
78
|
1333 build_string ("iso8859-9"));
|
74
|
1334 Vcharset_thai_tis620 =
|
213
|
1335 make_charset (133, Qthai_tis620, LEADING_BYTE_THAI_TIS620, 2,
|
70
|
1336 CHARSET_TYPE_96, 1, 1, 'T',
|
|
1337 CHARSET_LEFT_TO_RIGHT,
|
167
|
1338 build_string ("TIS 620.2529 (Thai)"),
|
78
|
1339 build_string ("tis620"));
|
70
|
1340
|
|
1341 /* Japanese */
|
74
|
1342 Vcharset_katakana_jisx0201 =
|
213
|
1343 make_charset (137, Qkatakana_jisx0201,
|
74
|
1344 LEADING_BYTE_KATAKANA_JISX0201, 2,
|
70
|
1345 CHARSET_TYPE_94, 1, 1, 'I',
|
|
1346 CHARSET_LEFT_TO_RIGHT,
|
167
|
1347 build_string ("JIS X0201-Katakana"),
|
78
|
1348 build_string ("jisx0201.1976"));
|
74
|
1349 Vcharset_latin_jisx0201 =
|
213
|
1350 make_charset (138, Qlatin_jisx0201,
|
74
|
1351 LEADING_BYTE_LATIN_JISX0201, 2,
|
70
|
1352 CHARSET_TYPE_94, 1, 0, 'J',
|
|
1353 CHARSET_LEFT_TO_RIGHT,
|
167
|
1354 build_string ("JIS X0201-Latin"),
|
78
|
1355 build_string ("jisx0201.1976"));
|
70
|
1356 Vcharset_japanese_jisx0208_1978 =
|
213
|
1357 make_charset (144, Qjapanese_jisx0208_1978,
|
70
|
1358 LEADING_BYTE_JAPANESE_JISX0208_1978, 3,
|
|
1359 CHARSET_TYPE_94X94, 2, 0, '@',
|
|
1360 CHARSET_LEFT_TO_RIGHT,
|
167
|
1361 build_string
|
|
1362 ("JIS X0208-1978 (Japanese Kanji; Old Version)"),
|
347
|
1363 build_string ("\\(jisx0208\\|jisc6226\\).1978"));
|
70
|
1364 Vcharset_japanese_jisx0208 =
|
213
|
1365 make_charset (146, Qjapanese_jisx0208,
|
70
|
1366 LEADING_BYTE_JAPANESE_JISX0208, 3,
|
|
1367 CHARSET_TYPE_94X94, 2, 0, 'B',
|
|
1368 CHARSET_LEFT_TO_RIGHT,
|
167
|
1369 build_string ("JIS X0208-1983 (Japanese Kanji)"),
|
78
|
1370 build_string ("jisx0208.19\\(83\\|90\\)"));
|
70
|
1371 Vcharset_japanese_jisx0212 =
|
213
|
1372 make_charset (148, Qjapanese_jisx0212,
|
70
|
1373 LEADING_BYTE_JAPANESE_JISX0212, 3,
|
|
1374 CHARSET_TYPE_94X94, 2, 0, 'D',
|
|
1375 CHARSET_LEFT_TO_RIGHT,
|
167
|
1376 build_string ("JIS X0212 (Japanese Supplement)"),
|
78
|
1377 build_string ("jisx0212"));
|
70
|
1378
|
|
1379 /* Chinese */
|
74
|
1380 Vcharset_chinese_gb2312 =
|
213
|
1381 make_charset (145, Qchinese_gb2312, LEADING_BYTE_CHINESE_GB2312, 3,
|
70
|
1382 CHARSET_TYPE_94X94, 2, 0, 'A',
|
|
1383 CHARSET_LEFT_TO_RIGHT,
|
167
|
1384 build_string ("GB 2312 (Simplified Chinese)"),
|
78
|
1385 build_string ("gb2312"));
|
|
1386 #define CHINESE_CNS_PLANE_RE(n) "cns11643[.-]\\(.*[.-]\\)?" n "$"
|
70
|
1387 Vcharset_chinese_cns11643_1 =
|
213
|
1388 make_charset (149, Qchinese_cns11643_1,
|
70
|
1389 LEADING_BYTE_CHINESE_CNS11643_1, 3,
|
|
1390 CHARSET_TYPE_94X94, 2, 0, 'G',
|
|
1391 CHARSET_LEFT_TO_RIGHT,
|
167
|
1392 build_string
|
|
1393 ("CNS 11643 Plane 1 (Traditional Chinese for daily use)"),
|
70
|
1394 build_string (CHINESE_CNS_PLANE_RE("1")));
|
|
1395 Vcharset_chinese_cns11643_2 =
|
213
|
1396 make_charset (150, Qchinese_cns11643_2,
|
70
|
1397 LEADING_BYTE_CHINESE_CNS11643_2, 3,
|
|
1398 CHARSET_TYPE_94X94, 2, 0, 'H',
|
|
1399 CHARSET_LEFT_TO_RIGHT,
|
167
|
1400 build_string
|
|
1401 ("CNS 11643 Plane 2 (Traditional Chinese for daily use)"),
|
70
|
1402 build_string (CHINESE_CNS_PLANE_RE("2")));
|
|
1403 Vcharset_chinese_big5_1 =
|
213
|
1404 make_charset (152, Qchinese_big5_1, LEADING_BYTE_CHINESE_BIG5_1, 3,
|
70
|
1405 CHARSET_TYPE_94X94, 2, 0, '0',
|
|
1406 CHARSET_LEFT_TO_RIGHT,
|
167
|
1407 build_string
|
|
1408 ("Big5 Level 1 (Traditional Chinese for daily use)"),
|
78
|
1409 build_string ("big5"));
|
70
|
1410 Vcharset_chinese_big5_2 =
|
213
|
1411 make_charset (153, Qchinese_big5_2, LEADING_BYTE_CHINESE_BIG5_2, 3,
|
70
|
1412 CHARSET_TYPE_94X94, 2, 0, '1',
|
|
1413 CHARSET_LEFT_TO_RIGHT,
|
167
|
1414 build_string
|
|
1415 ("Big5 Level 2 (Traditional Chinese for daily use)"),
|
78
|
1416 build_string ("big5"));
|
70
|
1417
|
|
1418 Vcharset_korean_ksc5601 =
|
213
|
1419 make_charset (147, Qkorean_ksc5601, LEADING_BYTE_KOREAN_KSC5601, 3,
|
70
|
1420 CHARSET_TYPE_94X94, 2, 0, 'C',
|
|
1421 CHARSET_LEFT_TO_RIGHT,
|
167
|
1422 build_string ("KS C5601 (Hangul and Korean Hanja)"),
|
78
|
1423 build_string ("ksc5601"));
|
337
|
1424
|
|
1425 #ifdef ENABLE_COMPOSITE_CHARS
|
70
|
1426 /* #### For simplicity, we put composite chars into a 96x96 charset.
|
|
1427 This is going to lead to problems because you can run out of
|
|
1428 room, esp. as we don't yet recycle numbers. */
|
|
1429 Vcharset_composite =
|
213
|
1430 make_charset (-1, Qcomposite, LEADING_BYTE_COMPOSITE, 3,
|
70
|
1431 CHARSET_TYPE_96X96, 2, 0, 0,
|
|
1432 CHARSET_LEFT_TO_RIGHT,
|
|
1433 build_string ("Composite characters"),
|
|
1434 build_string (""));
|
|
1435
|
|
1436 composite_char_row_next = 32;
|
|
1437 composite_char_col_next = 32;
|
|
1438
|
|
1439 Vcomposite_char_string2char_hashtable =
|
183
|
1440 make_lisp_hashtable (500, HASHTABLE_NONWEAK, HASHTABLE_EQUAL);
|
70
|
1441 Vcomposite_char_char2string_hashtable =
|
183
|
1442 make_lisp_hashtable (500, HASHTABLE_NONWEAK, HASHTABLE_EQ);
|
70
|
1443 staticpro (&Vcomposite_char_string2char_hashtable);
|
|
1444 staticpro (&Vcomposite_char_char2string_hashtable);
|
337
|
1445 #endif /* ENABLE_COMPOSITE_CHARS */
|
70
|
1446
|
|
1447 }
|