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