428
|
1 /* Functions to handle multilingual characters.
|
|
2 Copyright (C) 1992, 1995 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1995 Sun Microsystems, Inc.
|
3025
|
4 Copyright (C) 2001, 2002, 2004, 2005 Ben Wing.
|
428
|
5
|
|
6 This file is part of XEmacs.
|
|
7
|
|
8 XEmacs is free software; you can redistribute it and/or modify it
|
|
9 under the terms of the GNU General Public License as published by the
|
|
10 Free Software Foundation; either version 2, or (at your option) any
|
|
11 later version.
|
|
12
|
|
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
16 for more details.
|
|
17
|
|
18 You should have received a copy of the GNU General Public License
|
|
19 along with XEmacs; see the file COPYING. If not, write to
|
|
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
21 Boston, MA 02111-1307, USA. */
|
|
22
|
|
23 /* Synched up with: FSF 20.3. Not in FSF. */
|
|
24
|
|
25 /* Rewritten by Ben Wing <ben@xemacs.org>. */
|
|
26
|
|
27 #include <config.h>
|
|
28 #include "lisp.h"
|
|
29
|
|
30 #include "buffer.h"
|
|
31 #include "chartab.h"
|
|
32 #include "elhash.h"
|
|
33 #include "device.h"
|
|
34 #include "faces.h"
|
771
|
35 #include "lstream.h"
|
428
|
36 #include "mule-ccl.h"
|
872
|
37 #include "objects.h"
|
3659
|
38 #include "specifier.h"
|
428
|
39
|
|
40 /* The various pre-defined charsets. */
|
|
41
|
|
42 Lisp_Object Vcharset_ascii;
|
|
43 Lisp_Object Vcharset_control_1;
|
|
44 Lisp_Object Vcharset_latin_iso8859_1;
|
|
45 Lisp_Object Vcharset_latin_iso8859_2;
|
|
46 Lisp_Object Vcharset_latin_iso8859_3;
|
|
47 Lisp_Object Vcharset_latin_iso8859_4;
|
|
48 Lisp_Object Vcharset_thai_tis620;
|
|
49 Lisp_Object Vcharset_greek_iso8859_7;
|
|
50 Lisp_Object Vcharset_arabic_iso8859_6;
|
|
51 Lisp_Object Vcharset_hebrew_iso8859_8;
|
|
52 Lisp_Object Vcharset_katakana_jisx0201;
|
|
53 Lisp_Object Vcharset_latin_jisx0201;
|
|
54 Lisp_Object Vcharset_cyrillic_iso8859_5;
|
|
55 Lisp_Object Vcharset_latin_iso8859_9;
|
728
|
56 Lisp_Object Vcharset_latin_iso8859_15;
|
428
|
57 Lisp_Object Vcharset_japanese_jisx0208_1978;
|
|
58 Lisp_Object Vcharset_chinese_gb2312;
|
|
59 Lisp_Object Vcharset_japanese_jisx0208;
|
|
60 Lisp_Object Vcharset_korean_ksc5601;
|
|
61 Lisp_Object Vcharset_japanese_jisx0212;
|
|
62 Lisp_Object Vcharset_chinese_cns11643_1;
|
|
63 Lisp_Object Vcharset_chinese_cns11643_2;
|
|
64 Lisp_Object Vcharset_chinese_big5_1;
|
|
65 Lisp_Object Vcharset_chinese_big5_2;
|
|
66 Lisp_Object Vcharset_composite;
|
|
67
|
|
68 struct charset_lookup *chlook;
|
|
69
|
1204
|
70 static const struct memory_description charset_lookup_description_1[] = {
|
771
|
71 { XD_LISP_OBJECT_ARRAY, offsetof (struct charset_lookup, charset_by_leading_byte), NUM_LEADING_BYTES+4*128*2 },
|
428
|
72 { XD_END }
|
|
73 };
|
|
74
|
1204
|
75 static const struct sized_memory_description charset_lookup_description = {
|
440
|
76 sizeof (struct charset_lookup),
|
428
|
77 charset_lookup_description_1
|
|
78 };
|
|
79
|
|
80 Lisp_Object Qcharsetp;
|
|
81
|
3664
|
82 /* Qdoc_string, Qdimension, Qchars, Qfinal defined in general.c */
|
|
83 Lisp_Object Qregistries, Qgraphic, Qregistry;
|
428
|
84 Lisp_Object Qdirection;
|
|
85 Lisp_Object Qreverse_direction_charset;
|
|
86 Lisp_Object Qshort_name, Qlong_name;
|
|
87
|
771
|
88 Lisp_Object Qfrom_unicode, Qto_unicode;
|
|
89
|
|
90 Lisp_Object
|
428
|
91 Qlatin_iso8859_1,
|
|
92 Qlatin_iso8859_2,
|
|
93 Qlatin_iso8859_3,
|
|
94 Qlatin_iso8859_4,
|
|
95 Qthai_tis620,
|
|
96 Qgreek_iso8859_7,
|
|
97 Qarabic_iso8859_6,
|
|
98 Qhebrew_iso8859_8,
|
|
99 Qkatakana_jisx0201,
|
|
100 Qlatin_jisx0201,
|
|
101 Qcyrillic_iso8859_5,
|
|
102 Qlatin_iso8859_9,
|
728
|
103 Qlatin_iso8859_15,
|
428
|
104 Qjapanese_jisx0208_1978,
|
|
105 Qchinese_gb2312,
|
|
106 Qjapanese_jisx0208,
|
|
107 Qkorean_ksc5601,
|
|
108 Qjapanese_jisx0212,
|
|
109 Qchinese_cns11643_1,
|
|
110 Qchinese_cns11643_2,
|
|
111 Qchinese_big5_1,
|
|
112 Qchinese_big5_2,
|
|
113 Qcomposite;
|
|
114
|
|
115 Lisp_Object Ql2r, Qr2l;
|
|
116
|
|
117 Lisp_Object Vcharset_hash_table;
|
|
118
|
|
119
|
|
120 /************************************************************************/
|
|
121 /* charset object */
|
|
122 /************************************************************************/
|
|
123
|
|
124 static Lisp_Object
|
|
125 mark_charset (Lisp_Object obj)
|
|
126 {
|
440
|
127 Lisp_Charset *cs = XCHARSET (obj);
|
428
|
128
|
|
129 mark_object (cs->short_name);
|
|
130 mark_object (cs->long_name);
|
|
131 mark_object (cs->doc_string);
|
3659
|
132 mark_object (cs->registries);
|
428
|
133 mark_object (cs->ccl_program);
|
|
134 return cs->name;
|
|
135 }
|
|
136
|
|
137 static void
|
2286
|
138 print_charset (Lisp_Object obj, Lisp_Object printcharfun,
|
|
139 int UNUSED (escapeflag))
|
428
|
140 {
|
440
|
141 Lisp_Charset *cs = XCHARSET (obj);
|
428
|
142
|
|
143 if (print_readably)
|
563
|
144 printing_unreadable_object ("#<charset %s 0x%x>",
|
793
|
145 XSTRING_DATA (XSYMBOL (CHARSET_NAME (cs))->
|
563
|
146 name),
|
|
147 cs->header.uid);
|
428
|
148
|
771
|
149 write_fmt_string_lisp (printcharfun, "#<charset %s %S %S %S", 4,
|
|
150 CHARSET_NAME (cs), CHARSET_SHORT_NAME (cs),
|
|
151 CHARSET_LONG_NAME (cs), CHARSET_DOC_STRING (cs));
|
|
152 write_fmt_string (printcharfun, " %s %s cols=%d g%d final='%c' reg=",
|
|
153 CHARSET_TYPE (cs) == CHARSET_TYPE_94 ? "94" :
|
|
154 CHARSET_TYPE (cs) == CHARSET_TYPE_96 ? "96" :
|
|
155 CHARSET_TYPE (cs) == CHARSET_TYPE_94X94 ? "94x94" :
|
|
156 "96x96",
|
|
157 CHARSET_DIRECTION (cs) == CHARSET_LEFT_TO_RIGHT ? "l2r" :
|
|
158 "r2l",
|
|
159 CHARSET_COLUMNS (cs),
|
|
160 CHARSET_GRAPHIC (cs),
|
|
161 CHARSET_FINAL (cs));
|
3659
|
162 print_internal (CHARSET_REGISTRIES (cs), printcharfun, 0);
|
771
|
163 write_fmt_string (printcharfun, " 0x%x>", cs->header.uid);
|
|
164 }
|
|
165
|
1204
|
166 static const struct memory_description charset_description[] = {
|
|
167 { XD_INT, offsetof (Lisp_Charset, dimension) },
|
|
168 { XD_INT, offsetof (Lisp_Charset, from_unicode_levels) },
|
440
|
169 { XD_LISP_OBJECT, offsetof (Lisp_Charset, name) },
|
|
170 { XD_LISP_OBJECT, offsetof (Lisp_Charset, doc_string) },
|
3659
|
171 { XD_LISP_OBJECT, offsetof (Lisp_Charset, registries) },
|
440
|
172 { XD_LISP_OBJECT, offsetof (Lisp_Charset, short_name) },
|
|
173 { XD_LISP_OBJECT, offsetof (Lisp_Charset, long_name) },
|
|
174 { XD_LISP_OBJECT, offsetof (Lisp_Charset, reverse_direction_charset) },
|
|
175 { XD_LISP_OBJECT, offsetof (Lisp_Charset, ccl_program) },
|
771
|
176 { XD_UNION, offsetof (Lisp_Charset, to_unicode_table),
|
2775
|
177 XD_INDIRECT (0, 0), { &to_unicode_description }, XD_FLAG_NO_KKCC },
|
771
|
178 { XD_UNION, offsetof (Lisp_Charset, from_unicode_table),
|
2775
|
179 XD_INDIRECT (1, 0), { &from_unicode_description }, XD_FLAG_NO_KKCC },
|
428
|
180 { XD_END }
|
|
181 };
|
|
182
|
934
|
183 DEFINE_LRECORD_IMPLEMENTATION ("charset", charset,
|
|
184 1, /* dumpable flag */
|
2367
|
185 mark_charset, print_charset, 0,
|
934
|
186 0, 0, charset_description, Lisp_Charset);
|
428
|
187 /* Make a new charset. */
|
446
|
188 /* #### SJT Should generic properties be allowed? */
|
428
|
189 static Lisp_Object
|
771
|
190 make_charset (int id, Lisp_Object name, int rep_bytes,
|
|
191 int type, int columns, int graphic,
|
867
|
192 Ibyte final, int direction, Lisp_Object short_name,
|
428
|
193 Lisp_Object long_name, Lisp_Object doc,
|
3439
|
194 Lisp_Object reg, int overwrite, int encode_as_utf_8)
|
428
|
195 {
|
|
196 Lisp_Object obj;
|
771
|
197 Lisp_Charset *cs;
|
|
198
|
|
199 if (!overwrite)
|
|
200 {
|
3017
|
201 cs = ALLOC_LCRECORD_TYPE (Lisp_Charset, &lrecord_charset);
|
793
|
202 obj = wrap_charset (cs);
|
771
|
203
|
|
204 if (final)
|
|
205 {
|
|
206 /* some charsets do not have final characters. This includes
|
|
207 ASCII, Control-1, Composite, and the two faux private
|
|
208 charsets. */
|
|
209 assert (NILP (chlook->
|
|
210 charset_by_attributes[type][final][direction]));
|
|
211 chlook->charset_by_attributes[type][final][direction] = obj;
|
|
212 }
|
440
|
213
|
771
|
214 assert (NILP (chlook->charset_by_leading_byte[id - MIN_LEADING_BYTE]));
|
|
215 chlook->charset_by_leading_byte[id - MIN_LEADING_BYTE] = obj;
|
|
216 }
|
|
217 else
|
|
218 {
|
|
219 Lisp_Object ret;
|
|
220 /* Actually overwrite the properties of the existing charset.
|
|
221 We do this because until now charsets could never be "deleted",
|
|
222 so parts of the code don't bother to GC charsets. */
|
|
223 obj = chlook->charset_by_leading_byte[id - MIN_LEADING_BYTE];
|
|
224 cs = XCHARSET (obj);
|
|
225 assert (EQ (chlook->charset_by_attributes[type][final][direction],
|
|
226 obj));
|
|
227
|
|
228 ret = Fremhash (XCHARSET_NAME (obj), Vcharset_hash_table);
|
|
229 assert (!NILP (ret));
|
|
230 }
|
428
|
231
|
|
232 CHARSET_ID (cs) = id;
|
|
233 CHARSET_NAME (cs) = name;
|
|
234 CHARSET_SHORT_NAME (cs) = short_name;
|
|
235 CHARSET_LONG_NAME (cs) = long_name;
|
|
236 CHARSET_REP_BYTES (cs) = rep_bytes;
|
|
237 CHARSET_DIRECTION (cs) = direction;
|
|
238 CHARSET_TYPE (cs) = type;
|
|
239 CHARSET_COLUMNS (cs) = columns;
|
|
240 CHARSET_GRAPHIC (cs) = graphic;
|
|
241 CHARSET_FINAL (cs) = final;
|
|
242 CHARSET_DOC_STRING (cs) = doc;
|
3659
|
243 CHECK_VECTOR(reg);
|
|
244 CHARSET_REGISTRIES (cs) = reg;
|
3439
|
245 CHARSET_ENCODE_AS_UTF_8 (cs) = encode_as_utf_8 ? 1 : 0;
|
428
|
246 CHARSET_CCL_PROGRAM (cs) = Qnil;
|
|
247 CHARSET_REVERSE_DIRECTION_CHARSET (cs) = Qnil;
|
|
248
|
771
|
249 CHARSET_DIMENSION (cs) = (CHARSET_TYPE (cs) == CHARSET_TYPE_94 ||
|
|
250 CHARSET_TYPE (cs) == CHARSET_TYPE_96) ? 1 : 2;
|
|
251 CHARSET_CHARS (cs) = (CHARSET_TYPE (cs) == CHARSET_TYPE_94 ||
|
|
252 CHARSET_TYPE (cs) == CHARSET_TYPE_94X94) ? 94 : 96;
|
428
|
253
|
771
|
254 if (id == LEADING_BYTE_ASCII || id == LEADING_BYTE_CONTROL_1
|
|
255 #ifdef ENABLE_COMPOSITE_CHARS
|
|
256 || id == LEADING_BYTE_COMPOSITE
|
|
257 #endif
|
|
258 )
|
|
259 assert (!overwrite);
|
|
260 else
|
428
|
261 {
|
771
|
262 if (overwrite)
|
|
263 free_charset_unicode_tables (obj);
|
|
264 init_charset_unicode_tables (obj);
|
428
|
265 }
|
|
266
|
|
267 /* Some charsets are "faux" and don't have names or really exist at
|
|
268 all except in the leading-byte table. */
|
|
269 if (!NILP (name))
|
771
|
270 {
|
|
271 assert (NILP (Fgethash (name, Vcharset_hash_table, Qnil)));
|
|
272 Fputhash (name, obj, Vcharset_hash_table);
|
|
273 }
|
|
274
|
|
275 recalculate_unicode_precedence ();
|
3659
|
276 setup_charset_initial_specifier_tags (obj);
|
|
277
|
428
|
278 return obj;
|
|
279 }
|
|
280
|
|
281 static int
|
|
282 get_unallocated_leading_byte (int dimension)
|
|
283 {
|
|
284 int lb;
|
|
285
|
|
286 if (dimension == 1)
|
|
287 {
|
771
|
288 if (chlook->next_allocated_1_byte_leading_byte >
|
|
289 MAX_LEADING_BYTE_PRIVATE_1)
|
428
|
290 lb = 0;
|
|
291 else
|
442
|
292 lb = chlook->next_allocated_1_byte_leading_byte++;
|
428
|
293 }
|
|
294 else
|
|
295 {
|
1747
|
296 /* awfully fragile, but correct */
|
|
297 #if MAX_LEADING_BYTE_PRIVATE_2 == 255
|
|
298 if (chlook->next_allocated_2_byte_leading_byte == 0)
|
1749
|
299 #else
|
771
|
300 if (chlook->next_allocated_2_byte_leading_byte >
|
|
301 MAX_LEADING_BYTE_PRIVATE_2)
|
1747
|
302 #endif
|
428
|
303 lb = 0;
|
|
304 else
|
442
|
305 lb = chlook->next_allocated_2_byte_leading_byte++;
|
428
|
306 }
|
|
307
|
|
308 if (!lb)
|
563
|
309 invalid_operation
|
771
|
310 ("No more character sets free for this dimension", make_int (dimension));
|
428
|
311
|
|
312 return lb;
|
|
313 }
|
|
314
|
|
315
|
|
316 /************************************************************************/
|
|
317 /* Basic charset Lisp functions */
|
|
318 /************************************************************************/
|
|
319
|
788
|
320 void
|
|
321 get_charset_limits (Lisp_Object charset, int *low, int *high)
|
|
322 {
|
|
323 Lisp_Charset *cs = XCHARSET (charset);
|
|
324
|
|
325 if (EQ (charset, Vcharset_ascii)) *low = 0, *high = 127;
|
|
326 else if (EQ (charset, Vcharset_control_1)) *low = 0, *high = 31;
|
|
327 else if (CHARSET_CHARS (cs) == 94) *low = 33, *high = 126;
|
|
328 else /* CHARSET_CHARS (cs) == 96) */ *low = 32, *high = 127;
|
|
329 }
|
|
330
|
428
|
331 DEFUN ("charsetp", Fcharsetp, 1, 1, 0, /*
|
|
332 Return non-nil if OBJECT is a charset.
|
|
333 */
|
|
334 (object))
|
|
335 {
|
|
336 return CHARSETP (object) ? Qt : Qnil;
|
|
337 }
|
|
338
|
|
339 DEFUN ("find-charset", Ffind_charset, 1, 1, 0, /*
|
|
340 Retrieve the charset of the given name.
|
|
341 If CHARSET-OR-NAME is a charset object, it is simply returned.
|
|
342 Otherwise, CHARSET-OR-NAME should be a symbol. If there is no such charset,
|
|
343 nil is returned. Otherwise the associated charset object is returned.
|
|
344 */
|
|
345 (charset_or_name))
|
|
346 {
|
|
347 if (CHARSETP (charset_or_name))
|
|
348 return charset_or_name;
|
|
349
|
|
350 CHECK_SYMBOL (charset_or_name);
|
|
351 return Fgethash (charset_or_name, Vcharset_hash_table, Qnil);
|
|
352 }
|
|
353
|
|
354 DEFUN ("get-charset", Fget_charset, 1, 1, 0, /*
|
|
355 Retrieve the charset of the given name.
|
|
356 Same as `find-charset' except an error is signalled if there is no such
|
|
357 charset instead of returning nil.
|
|
358 */
|
|
359 (name))
|
|
360 {
|
|
361 Lisp_Object charset = Ffind_charset (name);
|
|
362
|
|
363 if (NILP (charset))
|
563
|
364 invalid_argument ("No such charset", name);
|
428
|
365 return charset;
|
|
366 }
|
|
367
|
|
368 /* We store the charsets in hash tables with the names as the key and the
|
|
369 actual charset object as the value. Occasionally we need to use them
|
|
370 in a list format. These routines provide us with that. */
|
|
371 struct charset_list_closure
|
|
372 {
|
|
373 Lisp_Object *charset_list;
|
|
374 };
|
|
375
|
|
376 static int
|
2286
|
377 add_charset_to_list_mapper (Lisp_Object UNUSED (key), Lisp_Object value,
|
428
|
378 void *charset_list_closure)
|
|
379 {
|
|
380 /* This function can GC */
|
|
381 struct charset_list_closure *chcl =
|
|
382 (struct charset_list_closure*) charset_list_closure;
|
|
383 Lisp_Object *charset_list = chcl->charset_list;
|
|
384
|
|
385 *charset_list = Fcons (XCHARSET_NAME (value), *charset_list);
|
|
386 return 0;
|
|
387 }
|
|
388
|
|
389 DEFUN ("charset-list", Fcharset_list, 0, 0, 0, /*
|
|
390 Return a list of the names of all defined charsets.
|
|
391 */
|
|
392 ())
|
|
393 {
|
|
394 Lisp_Object charset_list = Qnil;
|
|
395 struct gcpro gcpro1;
|
|
396 struct charset_list_closure charset_list_closure;
|
|
397
|
|
398 GCPRO1 (charset_list);
|
|
399 charset_list_closure.charset_list = &charset_list;
|
|
400 elisp_maphash (add_charset_to_list_mapper, Vcharset_hash_table,
|
|
401 &charset_list_closure);
|
|
402 UNGCPRO;
|
|
403
|
|
404 return charset_list;
|
|
405 }
|
|
406
|
|
407 DEFUN ("charset-name", Fcharset_name, 1, 1, 0, /*
|
444
|
408 Return the name of charset CHARSET.
|
428
|
409 */
|
|
410 (charset))
|
|
411 {
|
|
412 return XCHARSET_NAME (Fget_charset (charset));
|
|
413 }
|
|
414
|
446
|
415 /* #### SJT Should generic properties be allowed? */
|
428
|
416 DEFUN ("make-charset", Fmake_charset, 3, 3, 0, /*
|
|
417 Define a new character set.
|
|
418 This function is for use with Mule support.
|
|
419 NAME is a symbol, the name by which the character set is normally referred.
|
|
420 DOC-STRING is a string describing the character set.
|
|
421 PROPS is a property list, describing the specific nature of the
|
|
422 character set. Recognized properties are:
|
|
423
|
3025
|
424 `short-name' Short version of the charset name (ex: Latin-1)
|
|
425 `long-name' Long version of the charset name (ex: ISO8859-1 (Latin-1))
|
3659
|
426 `registries' A vector of possible XLFD REGISTRY-ENCODING combinations for
|
|
427 this character set. Note that this is not a regular expression.
|
3025
|
428 `dimension' Number of octets used to index a character in this charset.
|
428
|
429 Either 1 or 2. Defaults to 1.
|
3025
|
430 `columns' Number of columns used to display a character in this charset.
|
428
|
431 Only used in TTY mode. (Under X, the actual width of a
|
|
432 character can be derived from the font used to display the
|
|
433 characters.) If unspecified, defaults to the dimension
|
|
434 (this is almost always the correct value).
|
3025
|
435 `chars' Number of characters in each dimension (94 or 96).
|
428
|
436 Defaults to 94. Note that if the dimension is 2, the
|
|
437 character set thus described is 94x94 or 96x96.
|
3025
|
438 `final' Final byte of ISO 2022 escape sequence. Must be
|
428
|
439 supplied. Each combination of (DIMENSION, CHARS) defines a
|
|
440 separate namespace for final bytes. Note that ISO
|
|
441 2022 restricts the final byte to the range
|
|
442 0x30 - 0x7E if dimension == 1, and 0x30 - 0x5F if
|
|
443 dimension == 2. Note also that final bytes in the range
|
|
444 0x30 - 0x3F are reserved for user-defined (not official)
|
|
445 character sets.
|
3025
|
446 `graphic' 0 (use left half of font on output) or 1 (use right half
|
428
|
447 of font on output). Defaults to 0. For example, for
|
|
448 a font whose registry is ISO8859-1, the left half
|
|
449 (octets 0x20 - 0x7F) is the `ascii' character set, while
|
|
450 the right half (octets 0xA0 - 0xFF) is the `latin-1'
|
3025
|
451 character set. With `graphic' set to 0, the octets
|
428
|
452 will have their high bit cleared; with it set to 1,
|
|
453 the octets will have their high bit set.
|
3025
|
454 `direction' `l2r' (left-to-right) or `r2l' (right-to-left).
|
|
455 Defaults to `l2r'.
|
|
456 `ccl-program' A compiled CCL program used to convert a character in
|
428
|
457 this charset into an index into the font. This is in
|
3025
|
458 addition to the `graphic' property. The CCL program
|
428
|
459 is passed the octets of the character, with the high
|
|
460 bit cleared and set depending upon whether the value
|
3025
|
461 of the `graphic' property is 0 or 1.
|
3439
|
462 `encode-as-utf-8'
|
|
463 If non-nil, the charset will be written out using the UTF-8
|
|
464 escape syntax in ISO 2022-oriented coding systems. Used for
|
|
465 supporting characters we know are part of Unicode but not of
|
|
466 any other known character set in escape-quoted and compound
|
|
467 text.
|
428
|
468 */
|
|
469 (name, doc_string, props))
|
|
470 {
|
771
|
471 int id, dimension = 1, chars = 94, graphic = 0, columns = -1;
|
867
|
472 Ibyte final = 0;
|
428
|
473 int direction = CHARSET_LEFT_TO_RIGHT;
|
|
474 int type;
|
3659
|
475 Lisp_Object registries = Qnil;
|
771
|
476 Lisp_Object charset = Qnil;
|
428
|
477 Lisp_Object ccl_program = Qnil;
|
|
478 Lisp_Object short_name = Qnil, long_name = Qnil;
|
3439
|
479 int encode_as_utf_8 = 0;
|
771
|
480 Lisp_Object existing_charset;
|
|
481 int temporary = UNBOUNDP (name);
|
428
|
482
|
771
|
483 /* NOTE: name == Qunbound is a directive from the iso2022 code to
|
|
484 create a temporary charset for an unknown final. We allow the final
|
|
485 to be overwritten with a real charset later on. */
|
|
486
|
428
|
487 if (!NILP (doc_string))
|
|
488 CHECK_STRING (doc_string);
|
771
|
489 if (!UNBOUNDP (name))
|
|
490 {
|
|
491 CHECK_SYMBOL (name);
|
428
|
492
|
771
|
493 charset = Ffind_charset (name);
|
|
494 if (!NILP (charset))
|
|
495 invalid_operation ("Cannot redefine existing charset", name);
|
|
496 }
|
428
|
497
|
442
|
498 {
|
|
499 EXTERNAL_PROPERTY_LIST_LOOP_3 (keyword, value, props)
|
|
500 {
|
|
501 if (EQ (keyword, Qshort_name))
|
|
502 {
|
|
503 CHECK_STRING (value);
|
|
504 short_name = value;
|
|
505 }
|
428
|
506
|
519
|
507 else if (EQ (keyword, Qlong_name))
|
442
|
508 {
|
|
509 CHECK_STRING (value);
|
|
510 long_name = value;
|
|
511 }
|
428
|
512
|
442
|
513 else if (EQ (keyword, Qdimension))
|
|
514 {
|
|
515 CHECK_INT (value);
|
|
516 dimension = XINT (value);
|
|
517 if (dimension < 1 || dimension > 2)
|
3025
|
518 invalid_constant ("Invalid value for `dimension'", value);
|
442
|
519 }
|
428
|
520
|
442
|
521 else if (EQ (keyword, Qchars))
|
|
522 {
|
|
523 CHECK_INT (value);
|
|
524 chars = XINT (value);
|
|
525 if (chars != 94 && chars != 96)
|
3025
|
526 invalid_constant ("Invalid value for `chars'", value);
|
442
|
527 }
|
428
|
528
|
442
|
529 else if (EQ (keyword, Qcolumns))
|
|
530 {
|
|
531 CHECK_INT (value);
|
|
532 columns = XINT (value);
|
|
533 if (columns != 1 && columns != 2)
|
3025
|
534 invalid_constant ("Invalid value for `columns'", value);
|
442
|
535 }
|
428
|
536
|
442
|
537 else if (EQ (keyword, Qgraphic))
|
|
538 {
|
|
539 CHECK_INT (value);
|
|
540 graphic = XINT (value);
|
|
541 if (graphic < 0 || graphic > 1)
|
3025
|
542 invalid_constant ("Invalid value for `graphic'", value);
|
442
|
543 }
|
428
|
544
|
3659
|
545 else if (EQ (keyword, Qregistries))
|
|
546 {
|
|
547 CHECK_VECTOR (value);
|
|
548 registries = value;
|
|
549 }
|
|
550
|
442
|
551 else if (EQ (keyword, Qregistry))
|
|
552 {
|
3659
|
553 Lisp_Object quoted_registry;
|
|
554
|
442
|
555 CHECK_STRING (value);
|
3659
|
556 quoted_registry = Fregexp_quote(value);
|
3662
|
557 if (qxestrcmp(XSTRING_DATA(quoted_registry),
|
3659
|
558 XSTRING_DATA(value)))
|
|
559 {
|
|
560 warn_when_safe
|
|
561 (Qregistry, Qwarning,
|
|
562 "Regexps no longer allowed for charset-registry. "
|
|
563 "Treating %s as string", XSTRING_DATA(value));
|
|
564 }
|
|
565 registries = vector1(value);
|
442
|
566 }
|
428
|
567
|
442
|
568 else if (EQ (keyword, Qdirection))
|
|
569 {
|
|
570 if (EQ (value, Ql2r))
|
|
571 direction = CHARSET_LEFT_TO_RIGHT;
|
|
572 else if (EQ (value, Qr2l))
|
|
573 direction = CHARSET_RIGHT_TO_LEFT;
|
|
574 else
|
3025
|
575 invalid_constant ("Invalid value for `direction'", value);
|
442
|
576 }
|
428
|
577
|
3439
|
578 else if (EQ (keyword, Qencode_as_utf_8))
|
|
579 {
|
|
580 encode_as_utf_8 = NILP (value) ? 0 : 1;
|
|
581 }
|
|
582
|
442
|
583 else if (EQ (keyword, Qfinal))
|
|
584 {
|
|
585 CHECK_CHAR_COERCE_INT (value);
|
|
586 final = XCHAR (value);
|
|
587 if (final < '0' || final > '~')
|
3025
|
588 invalid_constant ("Invalid value for `final'", value);
|
442
|
589 }
|
|
590 else if (EQ (keyword, Qccl_program))
|
|
591 {
|
444
|
592 struct ccl_program test_ccl;
|
|
593
|
|
594 if (setup_ccl_program (&test_ccl, value) < 0)
|
3025
|
595 invalid_argument ("Invalid value for `ccl-program'", value);
|
442
|
596 ccl_program = value;
|
|
597 }
|
|
598 else
|
563
|
599 invalid_constant ("Unrecognized property", keyword);
|
442
|
600 }
|
|
601 }
|
428
|
602
|
|
603 if (!final)
|
3025
|
604 invalid_argument ("`final' must be specified", Qunbound);
|
428
|
605 if (dimension == 2 && final > 0x5F)
|
563
|
606 invalid_constant
|
428
|
607 ("Final must be in the range 0x30 - 0x5F for dimension == 2",
|
|
608 make_char (final));
|
|
609
|
|
610 if (dimension == 1)
|
|
611 type = (chars == 94) ? CHARSET_TYPE_94 : CHARSET_TYPE_96;
|
|
612 else
|
|
613 type = (chars == 94) ? CHARSET_TYPE_94X94 : CHARSET_TYPE_96X96;
|
|
614
|
826
|
615 existing_charset = charset_by_attributes (type, final, direction);
|
771
|
616
|
|
617 if (!NILP (existing_charset) && !XCHARSET (existing_charset)->temporary)
|
578
|
618 invalid_argument
|
793
|
619 ("Character set already defined for this DIMENSION/CHARS/FINAL/DIRECTION combo",
|
771
|
620 existing_charset);
|
|
621
|
|
622 if (!NILP (existing_charset))
|
|
623 /* Reuse same leading byte */
|
|
624 id = XCHARSET_ID (existing_charset);
|
|
625 else
|
|
626 id = get_unallocated_leading_byte (dimension);
|
428
|
627
|
771
|
628 if (temporary)
|
|
629 {
|
867
|
630 Ibyte tempname[80];
|
428
|
631
|
771
|
632 qxesprintf (tempname, "___temporary___%d__", id);
|
|
633 name = intern_int (tempname);
|
|
634 }
|
428
|
635 if (NILP (doc_string))
|
|
636 doc_string = build_string ("");
|
3659
|
637 if (NILP (registries))
|
|
638 registries = make_vector(0, Qnil);
|
428
|
639 if (NILP (short_name))
|
793
|
640 short_name = XSYMBOL (name)->name;
|
428
|
641 if (NILP (long_name))
|
|
642 long_name = doc_string;
|
|
643 if (columns == -1)
|
|
644 columns = dimension;
|
771
|
645
|
428
|
646 charset = make_charset (id, name, dimension + 2, type, columns, graphic,
|
771
|
647 final, direction, short_name, long_name,
|
3659
|
648 doc_string, registries, !NILP (existing_charset),
|
3439
|
649 encode_as_utf_8);
|
771
|
650
|
|
651 XCHARSET (charset)->temporary = temporary;
|
428
|
652 if (!NILP (ccl_program))
|
|
653 XCHARSET_CCL_PROGRAM (charset) = ccl_program;
|
771
|
654
|
793
|
655 {
|
|
656 Lisp_Object revdircs =
|
826
|
657 charset_by_attributes (type, final,
|
793
|
658 direction == CHARSET_LEFT_TO_RIGHT ?
|
|
659 CHARSET_RIGHT_TO_LEFT : CHARSET_LEFT_TO_RIGHT);
|
|
660 if (!NILP (revdircs))
|
|
661 {
|
|
662 XCHARSET_REVERSE_DIRECTION_CHARSET (revdircs) = charset;
|
|
663 XCHARSET_REVERSE_DIRECTION_CHARSET (charset) = revdircs;
|
|
664 }
|
|
665 }
|
|
666
|
428
|
667 return charset;
|
|
668 }
|
|
669
|
|
670 DEFUN ("make-reverse-direction-charset", Fmake_reverse_direction_charset,
|
|
671 2, 2, 0, /*
|
|
672 Make a charset equivalent to CHARSET but which goes in the opposite direction.
|
|
673 NEW-NAME is the name of the new charset. Return the new charset.
|
|
674 */
|
|
675 (charset, new_name))
|
|
676 {
|
|
677 Lisp_Object new_charset = Qnil;
|
3439
|
678 int id, dimension, columns, graphic, encode_as_utf_8;
|
867
|
679 Ibyte final;
|
428
|
680 int direction, type;
|
3659
|
681 Lisp_Object registries, doc_string, short_name, long_name;
|
440
|
682 Lisp_Charset *cs;
|
428
|
683
|
|
684 charset = Fget_charset (charset);
|
|
685 if (!NILP (XCHARSET_REVERSE_DIRECTION_CHARSET (charset)))
|
563
|
686 invalid_operation ("Charset already has reverse-direction charset",
|
793
|
687 charset);
|
428
|
688
|
|
689 CHECK_SYMBOL (new_name);
|
|
690 if (!NILP (Ffind_charset (new_name)))
|
563
|
691 invalid_operation ("Cannot redefine existing charset", new_name);
|
428
|
692
|
|
693 cs = XCHARSET (charset);
|
|
694
|
|
695 type = CHARSET_TYPE (cs);
|
|
696 columns = CHARSET_COLUMNS (cs);
|
|
697 dimension = CHARSET_DIMENSION (cs);
|
|
698 id = get_unallocated_leading_byte (dimension);
|
|
699
|
|
700 graphic = CHARSET_GRAPHIC (cs);
|
|
701 final = CHARSET_FINAL (cs);
|
|
702 direction = CHARSET_RIGHT_TO_LEFT;
|
|
703 if (CHARSET_DIRECTION (cs) == CHARSET_RIGHT_TO_LEFT)
|
|
704 direction = CHARSET_LEFT_TO_RIGHT;
|
|
705 doc_string = CHARSET_DOC_STRING (cs);
|
|
706 short_name = CHARSET_SHORT_NAME (cs);
|
|
707 long_name = CHARSET_LONG_NAME (cs);
|
3659
|
708 registries = CHARSET_REGISTRIES (cs);
|
3439
|
709 encode_as_utf_8 = CHARSET_ENCODE_AS_UTF_8 (cs);
|
428
|
710
|
|
711 new_charset = make_charset (id, new_name, dimension + 2, type, columns,
|
|
712 graphic, final, direction, short_name, long_name,
|
3659
|
713 doc_string, registries, 0, encode_as_utf_8);
|
428
|
714
|
|
715 CHARSET_REVERSE_DIRECTION_CHARSET (cs) = new_charset;
|
|
716 XCHARSET_REVERSE_DIRECTION_CHARSET (new_charset) = charset;
|
|
717
|
|
718 return new_charset;
|
|
719 }
|
|
720
|
|
721 DEFUN ("charset-reverse-direction-charset", Fcharset_reverse_direction_charset,
|
|
722 1, 1, 0, /*
|
|
723 Return the reverse-direction charset parallel to CHARSET, if any.
|
|
724 This is the charset with the same properties (in particular, the same
|
|
725 dimension, number of characters per dimension, and final byte) as
|
|
726 CHARSET but whose characters are displayed in the opposite direction.
|
|
727 */
|
|
728 (charset))
|
|
729 {
|
|
730 charset = Fget_charset (charset);
|
|
731 return XCHARSET_REVERSE_DIRECTION_CHARSET (charset);
|
|
732 }
|
|
733
|
|
734 DEFUN ("charset-from-attributes", Fcharset_from_attributes, 3, 4, 0, /*
|
|
735 Return a charset with the given DIMENSION, CHARS, FINAL, and DIRECTION.
|
|
736 If DIRECTION is omitted, both directions will be checked (left-to-right
|
|
737 will be returned if character sets exist for both directions).
|
|
738 */
|
|
739 (dimension, chars, final, direction))
|
|
740 {
|
|
741 int dm, ch, fi, di = -1;
|
|
742 int type;
|
|
743 Lisp_Object obj = Qnil;
|
|
744
|
|
745 CHECK_INT (dimension);
|
|
746 dm = XINT (dimension);
|
|
747 if (dm < 1 || dm > 2)
|
563
|
748 invalid_constant ("Invalid value for DIMENSION", dimension);
|
428
|
749
|
|
750 CHECK_INT (chars);
|
|
751 ch = XINT (chars);
|
|
752 if (ch != 94 && ch != 96)
|
563
|
753 invalid_constant ("Invalid value for CHARS", chars);
|
428
|
754
|
|
755 CHECK_CHAR_COERCE_INT (final);
|
|
756 fi = XCHAR (final);
|
|
757 if (fi < '0' || fi > '~')
|
563
|
758 invalid_constant ("Invalid value for FINAL", final);
|
428
|
759
|
|
760 if (EQ (direction, Ql2r))
|
|
761 di = CHARSET_LEFT_TO_RIGHT;
|
|
762 else if (EQ (direction, Qr2l))
|
|
763 di = CHARSET_RIGHT_TO_LEFT;
|
|
764 else if (!NILP (direction))
|
563
|
765 invalid_constant ("Invalid value for DIRECTION", direction);
|
428
|
766
|
|
767 if (dm == 2 && fi > 0x5F)
|
563
|
768 invalid_constant
|
428
|
769 ("Final must be in the range 0x30 - 0x5F for dimension == 2", final);
|
|
770
|
|
771 if (dm == 1)
|
|
772 type = (ch == 94) ? CHARSET_TYPE_94 : CHARSET_TYPE_96;
|
|
773 else
|
|
774 type = (ch == 94) ? CHARSET_TYPE_94X94 : CHARSET_TYPE_96X96;
|
|
775
|
|
776 if (di == -1)
|
|
777 {
|
826
|
778 obj = charset_by_attributes (type, fi, CHARSET_LEFT_TO_RIGHT);
|
428
|
779 if (NILP (obj))
|
826
|
780 obj = charset_by_attributes (type, fi, CHARSET_RIGHT_TO_LEFT);
|
428
|
781 }
|
|
782 else
|
826
|
783 obj = charset_by_attributes (type, fi, di);
|
428
|
784
|
|
785 if (CHARSETP (obj))
|
|
786 return XCHARSET_NAME (obj);
|
|
787 return obj;
|
|
788 }
|
|
789
|
|
790 DEFUN ("charset-short-name", Fcharset_short_name, 1, 1, 0, /*
|
|
791 Return short name of CHARSET.
|
|
792 */
|
|
793 (charset))
|
|
794 {
|
|
795 return XCHARSET_SHORT_NAME (Fget_charset (charset));
|
|
796 }
|
|
797
|
|
798 DEFUN ("charset-long-name", Fcharset_long_name, 1, 1, 0, /*
|
|
799 Return long name of CHARSET.
|
|
800 */
|
|
801 (charset))
|
|
802 {
|
|
803 return XCHARSET_LONG_NAME (Fget_charset (charset));
|
|
804 }
|
|
805
|
|
806 DEFUN ("charset-description", Fcharset_description, 1, 1, 0, /*
|
|
807 Return description of CHARSET.
|
|
808 */
|
|
809 (charset))
|
|
810 {
|
|
811 return XCHARSET_DOC_STRING (Fget_charset (charset));
|
|
812 }
|
|
813
|
|
814 DEFUN ("charset-dimension", Fcharset_dimension, 1, 1, 0, /*
|
|
815 Return dimension of CHARSET.
|
|
816 */
|
|
817 (charset))
|
|
818 {
|
|
819 return make_int (XCHARSET_DIMENSION (Fget_charset (charset)));
|
|
820 }
|
|
821
|
|
822 DEFUN ("charset-property", Fcharset_property, 2, 2, 0, /*
|
446
|
823 Return property PROP of CHARSET, a charset object or symbol naming a charset.
|
428
|
824 Recognized properties are those listed in `make-charset', as well as
|
3025
|
825 `name' and `doc-string'.
|
428
|
826 */
|
|
827 (charset, prop))
|
|
828 {
|
440
|
829 Lisp_Charset *cs;
|
428
|
830
|
|
831 charset = Fget_charset (charset);
|
|
832 cs = XCHARSET (charset);
|
|
833
|
|
834 CHECK_SYMBOL (prop);
|
|
835 if (EQ (prop, Qname)) return CHARSET_NAME (cs);
|
|
836 if (EQ (prop, Qshort_name)) return CHARSET_SHORT_NAME (cs);
|
|
837 if (EQ (prop, Qlong_name)) return CHARSET_LONG_NAME (cs);
|
|
838 if (EQ (prop, Qdoc_string)) return CHARSET_DOC_STRING (cs);
|
|
839 if (EQ (prop, Qdimension)) return make_int (CHARSET_DIMENSION (cs));
|
|
840 if (EQ (prop, Qcolumns)) return make_int (CHARSET_COLUMNS (cs));
|
|
841 if (EQ (prop, Qgraphic)) return make_int (CHARSET_GRAPHIC (cs));
|
|
842 if (EQ (prop, Qfinal)) return make_char (CHARSET_FINAL (cs));
|
|
843 if (EQ (prop, Qchars)) return make_int (CHARSET_CHARS (cs));
|
3659
|
844 if (EQ (prop, Qregistries)) return CHARSET_REGISTRIES (cs);
|
3439
|
845 if (EQ (prop, Qencode_as_utf_8))
|
|
846 return CHARSET_ENCODE_AS_UTF_8 (cs) ? Qt : Qnil;
|
428
|
847 if (EQ (prop, Qccl_program)) return CHARSET_CCL_PROGRAM (cs);
|
|
848 if (EQ (prop, Qdirection))
|
|
849 return CHARSET_DIRECTION (cs) == CHARSET_LEFT_TO_RIGHT ? Ql2r : Qr2l;
|
|
850 if (EQ (prop, Qreverse_direction_charset))
|
|
851 {
|
|
852 Lisp_Object obj = CHARSET_REVERSE_DIRECTION_CHARSET (cs);
|
446
|
853 /* #### Is this translation OK? If so, error checking sufficient? */
|
|
854 return CHARSETP (obj) ? XCHARSET_NAME (obj) : obj;
|
428
|
855 }
|
563
|
856 invalid_constant ("Unrecognized charset property name", prop);
|
1204
|
857 RETURN_NOT_REACHED (Qnil);
|
428
|
858 }
|
|
859
|
|
860 DEFUN ("charset-id", Fcharset_id, 1, 1, 0, /*
|
|
861 Return charset identification number of CHARSET.
|
|
862 */
|
|
863 (charset))
|
|
864 {
|
793
|
865 return make_int (XCHARSET_LEADING_BYTE (Fget_charset (charset)));
|
428
|
866 }
|
|
867
|
|
868 /* #### We need to figure out which properties we really want to
|
|
869 allow to be set. */
|
|
870
|
|
871 DEFUN ("set-charset-ccl-program", Fset_charset_ccl_program, 2, 2, 0, /*
|
3025
|
872 Set the `ccl-program' property of CHARSET to CCL-PROGRAM.
|
428
|
873 */
|
|
874 (charset, ccl_program))
|
|
875 {
|
444
|
876 struct ccl_program test_ccl;
|
|
877
|
428
|
878 charset = Fget_charset (charset);
|
444
|
879 if (setup_ccl_program (&test_ccl, ccl_program) < 0)
|
563
|
880 invalid_argument ("Invalid ccl-program", ccl_program);
|
428
|
881 XCHARSET_CCL_PROGRAM (charset) = ccl_program;
|
510
|
882 face_property_was_changed (Vdefault_face, Qfont, Qglobal);
|
428
|
883 return Qnil;
|
|
884 }
|
|
885
|
3676
|
886 void
|
|
887 set_charset_registries(Lisp_Object charset, Lisp_Object registries)
|
|
888 {
|
|
889 XCHARSET_REGISTRIES (charset) = registries;
|
|
890 invalidate_charset_font_caches (charset);
|
|
891 face_property_was_changed (Vdefault_face, Qfont, Qglobal);
|
|
892 }
|
|
893
|
3659
|
894 DEFUN ("set-charset-registries", Fset_charset_registries, 2, 2, 0, /*
|
|
895 Set the `registries' property of CHARSET to REGISTRIES.
|
|
896
|
|
897 REGISTRIES is an ordered vector of strings that describe the X11
|
|
898 CHARSET_REGISTRY and the CHARSET_ENCODINGs appropriate for this charset.
|
|
899 Separate each registry from the corresponding encoding with a dash. The
|
|
900 strings are not regular expressions, in contrast to the old behavior of
|
|
901 the `charset-registry' property.
|
|
902
|
|
903 One reason to call this function might be if you're in Japan and you'd
|
|
904 prefer the backslash to display as a Yen sign; the corresponding syntax
|
|
905 would be:
|
|
906
|
|
907 (set-charset-registries 'ascii ["jisx0201.1976-0"])
|
|
908
|
428
|
909 */
|
3659
|
910 (charset, registries))
|
428
|
911 {
|
3659
|
912 int i;
|
428
|
913 charset = Fget_charset (charset);
|
3659
|
914 CHECK_VECTOR (registries);
|
|
915
|
|
916 for (i = 0; i < XVECTOR_LENGTH(registries); ++i)
|
|
917 {
|
|
918 CHECK_STRING (XVECTOR_DATA(registries)[i]);
|
|
919 if (NULL == qxestrchr(XSTRING_DATA(XVECTOR_DATA(registries)[i]), '-'))
|
|
920 {
|
|
921 invalid_argument("Not an X11 REGISTRY-ENCODING combination",
|
|
922 XVECTOR_DATA(registries)[i]);
|
|
923 }
|
3676
|
924
|
|
925 if (qxestrchr(XSTRING_DATA(XVECTOR_DATA(registries)[i]), '*') ||
|
|
926 qxestrchr(XSTRING_DATA(XVECTOR_DATA(registries)[i]), '?'))
|
|
927 {
|
|
928 invalid_argument
|
|
929 ("XLFD wildcards not allowed in charset-registries",
|
|
930 XVECTOR_DATA(registries)[i]);
|
|
931
|
|
932 }
|
3659
|
933 }
|
|
934
|
3676
|
935 set_charset_registries(charset, registries);
|
|
936
|
428
|
937 return Qnil;
|
|
938 }
|
|
939
|
3681
|
940 DEFUN ("charsets-in-region", Fcharsets_in_region, 2, 3, 0, /*
|
|
941 Return a list of the charsets in the region between START and END.
|
|
942 BUFFER defaults to the current buffer if omitted.
|
|
943 */
|
|
944 (start, end, buffer))
|
|
945 {
|
|
946 /* This function can GC */
|
|
947 struct buffer *buf = decode_buffer (buffer, 1);
|
|
948 Charbpos pos, stop; /* Limits of the region. */
|
|
949 Lisp_Object res = Qnil;
|
|
950 int charsets[NUM_LEADING_BYTES];
|
|
951 Ibyte lb;
|
|
952 struct gcpro gcpro1;
|
|
953
|
|
954 memset(charsets, 0, sizeof(charsets));
|
|
955 get_buffer_range_char (buf, start, end, &pos, &stop, 0);
|
|
956
|
|
957 GCPRO1 (res);
|
|
958 while (pos < stop)
|
|
959 {
|
|
960 lb = ichar_leading_byte(BUF_FETCH_CHAR (buf, pos));
|
|
961 if (0 == charsets[lb - MIN_LEADING_BYTE])
|
|
962 {
|
|
963 charsets[lb - MIN_LEADING_BYTE] = 1;
|
|
964 res = Fcons (XCHARSET_NAME(charset_by_leading_byte(lb)), res);
|
|
965 }
|
|
966 ++pos;
|
|
967 }
|
|
968 UNGCPRO;
|
|
969
|
|
970 return res;
|
|
971 }
|
|
972
|
428
|
973
|
|
974 /************************************************************************/
|
771
|
975 /* memory usage */
|
428
|
976 /************************************************************************/
|
|
977
|
771
|
978 #ifdef MEMORY_USAGE_STATS
|
428
|
979
|
771
|
980 struct charset_stats
|
|
981 {
|
|
982 int from_unicode;
|
|
983 int to_unicode;
|
|
984 int other;
|
|
985 };
|
428
|
986
|
771
|
987 static void
|
|
988 compute_charset_usage (Lisp_Object charset, struct charset_stats *stats,
|
|
989 struct overhead_stats *ovstats)
|
428
|
990 {
|
771
|
991 struct Lisp_Charset *c = XCHARSET (charset);
|
|
992 xzero (*stats);
|
3024
|
993 stats->other += LISPOBJ_STORAGE_SIZE (c, sizeof (*c), ovstats);
|
771
|
994 stats->from_unicode += compute_from_unicode_table_size (charset, ovstats);
|
|
995 stats->to_unicode += compute_to_unicode_table_size (charset, ovstats);
|
438
|
996 }
|
|
997
|
771
|
998 DEFUN ("charset-memory-usage", Fcharset_memory_usage, 1, 1, 0, /*
|
|
999 Return stats about the memory usage of charset CHARSET.
|
|
1000 The values returned are in the form of an alist of usage types and
|
|
1001 byte counts. The byte counts attempt to encompass all the memory used
|
|
1002 by the charset (separate from the memory logically associated with a
|
|
1003 charset or frame), including internal structures and any malloc()
|
|
1004 overhead associated with them. In practice, the byte counts are
|
|
1005 underestimated for various reasons, e.g. because certain memory usage
|
|
1006 is very hard to determine \(e.g. the amount of memory used inside the
|
|
1007 Xt library or inside the X server).
|
428
|
1008
|
771
|
1009 Multiple slices of the total memory usage may be returned, separated
|
|
1010 by a nil. Each slice represents a particular view of the memory, a
|
|
1011 particular way of partitioning it into groups. Within a slice, there
|
|
1012 is no overlap between the groups of memory, and each slice collectively
|
|
1013 represents all the memory concerned.
|
|
1014 */
|
|
1015 (charset))
|
|
1016 {
|
|
1017 struct charset_stats stats;
|
|
1018 struct overhead_stats ovstats;
|
|
1019 Lisp_Object val = Qnil;
|
428
|
1020
|
771
|
1021 charset = Fget_charset (charset);
|
|
1022 xzero (ovstats);
|
|
1023 compute_charset_usage (charset, &stats, &ovstats);
|
428
|
1024
|
771
|
1025 val = acons (Qfrom_unicode, make_int (stats.from_unicode), val);
|
|
1026 val = acons (Qto_unicode, make_int (stats.to_unicode), val);
|
|
1027 val = Fcons (Qnil, val);
|
|
1028 val = acons (Qactually_requested, make_int (ovstats.was_requested), val);
|
|
1029 val = acons (Qmalloc_overhead, make_int (ovstats.malloc_overhead), val);
|
|
1030 val = acons (Qgap_overhead, make_int (ovstats.gap_overhead), val);
|
|
1031 val = acons (Qdynarr_overhead, make_int (ovstats.dynarr_overhead), val);
|
|
1032
|
|
1033 return Fnreverse (val);
|
428
|
1034 }
|
|
1035
|
771
|
1036 #endif /* MEMORY_USAGE_STATS */
|
428
|
1037
|
|
1038
|
|
1039 /************************************************************************/
|
|
1040 /* initialization */
|
|
1041 /************************************************************************/
|
|
1042
|
|
1043 void
|
|
1044 syms_of_mule_charset (void)
|
|
1045 {
|
442
|
1046 INIT_LRECORD_IMPLEMENTATION (charset);
|
|
1047
|
428
|
1048 DEFSUBR (Fcharsetp);
|
|
1049 DEFSUBR (Ffind_charset);
|
|
1050 DEFSUBR (Fget_charset);
|
|
1051 DEFSUBR (Fcharset_list);
|
|
1052 DEFSUBR (Fcharset_name);
|
|
1053 DEFSUBR (Fmake_charset);
|
|
1054 DEFSUBR (Fmake_reverse_direction_charset);
|
793
|
1055 DEFSUBR (Fcharset_reverse_direction_charset);
|
428
|
1056 DEFSUBR (Fcharset_from_attributes);
|
|
1057 DEFSUBR (Fcharset_short_name);
|
|
1058 DEFSUBR (Fcharset_long_name);
|
|
1059 DEFSUBR (Fcharset_description);
|
|
1060 DEFSUBR (Fcharset_dimension);
|
|
1061 DEFSUBR (Fcharset_property);
|
|
1062 DEFSUBR (Fcharset_id);
|
|
1063 DEFSUBR (Fset_charset_ccl_program);
|
3659
|
1064 DEFSUBR (Fset_charset_registries);
|
3681
|
1065 DEFSUBR (Fcharsets_in_region);
|
428
|
1066
|
771
|
1067 #ifdef MEMORY_USAGE_STATS
|
|
1068 DEFSUBR (Fcharset_memory_usage);
|
428
|
1069 #endif
|
|
1070
|
563
|
1071 DEFSYMBOL (Qcharsetp);
|
3659
|
1072 DEFSYMBOL (Qregistries);
|
563
|
1073 DEFSYMBOL (Qfinal);
|
|
1074 DEFSYMBOL (Qgraphic);
|
3659
|
1075 DEFSYMBOL (Qregistry);
|
563
|
1076 DEFSYMBOL (Qdirection);
|
|
1077 DEFSYMBOL (Qreverse_direction_charset);
|
|
1078 DEFSYMBOL (Qshort_name);
|
|
1079 DEFSYMBOL (Qlong_name);
|
428
|
1080
|
771
|
1081 DEFSYMBOL (Qfrom_unicode);
|
|
1082 DEFSYMBOL (Qto_unicode);
|
|
1083
|
563
|
1084 DEFSYMBOL (Ql2r);
|
|
1085 DEFSYMBOL (Qr2l);
|
428
|
1086
|
|
1087 /* Charsets, compatible with FSF 20.3
|
|
1088 Naming convention is Script-Charset[-Edition] */
|
563
|
1089 DEFSYMBOL (Qlatin_iso8859_1);
|
|
1090 DEFSYMBOL (Qlatin_iso8859_2);
|
|
1091 DEFSYMBOL (Qlatin_iso8859_3);
|
|
1092 DEFSYMBOL (Qlatin_iso8859_4);
|
|
1093 DEFSYMBOL (Qthai_tis620);
|
|
1094 DEFSYMBOL (Qgreek_iso8859_7);
|
|
1095 DEFSYMBOL (Qarabic_iso8859_6);
|
|
1096 DEFSYMBOL (Qhebrew_iso8859_8);
|
|
1097 DEFSYMBOL (Qkatakana_jisx0201);
|
|
1098 DEFSYMBOL (Qlatin_jisx0201);
|
|
1099 DEFSYMBOL (Qcyrillic_iso8859_5);
|
|
1100 DEFSYMBOL (Qlatin_iso8859_9);
|
728
|
1101 DEFSYMBOL (Qlatin_iso8859_15);
|
563
|
1102 DEFSYMBOL (Qjapanese_jisx0208_1978);
|
|
1103 DEFSYMBOL (Qchinese_gb2312);
|
|
1104 DEFSYMBOL (Qjapanese_jisx0208);
|
|
1105 DEFSYMBOL (Qkorean_ksc5601);
|
|
1106 DEFSYMBOL (Qjapanese_jisx0212);
|
|
1107 DEFSYMBOL (Qchinese_cns11643_1);
|
|
1108 DEFSYMBOL (Qchinese_cns11643_2);
|
|
1109 DEFSYMBOL (Qchinese_big5_1);
|
|
1110 DEFSYMBOL (Qchinese_big5_2);
|
428
|
1111
|
563
|
1112 DEFSYMBOL (Qcomposite);
|
428
|
1113 }
|
|
1114
|
|
1115 void
|
|
1116 vars_of_mule_charset (void)
|
|
1117 {
|
|
1118 int i, j, k;
|
|
1119
|
452
|
1120 chlook = xnew_and_zero (struct charset_lookup); /* zero for Purify. */
|
2367
|
1121 dump_add_root_block_ptr (&chlook, &charset_lookup_description);
|
428
|
1122
|
|
1123 /* Table of charsets indexed by leading byte. */
|
|
1124 for (i = 0; i < countof (chlook->charset_by_leading_byte); i++)
|
|
1125 chlook->charset_by_leading_byte[i] = Qnil;
|
|
1126
|
|
1127 /* Table of charsets indexed by type/final-byte/direction. */
|
|
1128 for (i = 0; i < countof (chlook->charset_by_attributes); i++)
|
|
1129 for (j = 0; j < countof (chlook->charset_by_attributes[0]); j++)
|
|
1130 for (k = 0; k < countof (chlook->charset_by_attributes[0][0]); k++)
|
|
1131 chlook->charset_by_attributes[i][j][k] = Qnil;
|
|
1132
|
442
|
1133 chlook->next_allocated_1_byte_leading_byte = MIN_LEADING_BYTE_PRIVATE_1;
|
|
1134 chlook->next_allocated_2_byte_leading_byte = MIN_LEADING_BYTE_PRIVATE_2;
|
771
|
1135
|
|
1136 staticpro (&Vcharset_hash_table);
|
|
1137 Vcharset_hash_table =
|
|
1138 make_lisp_hash_table (50, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
|
428
|
1139 }
|
|
1140
|
|
1141 void
|
|
1142 complex_vars_of_mule_charset (void)
|
|
1143 {
|
|
1144 /* Predefined character sets. We store them into variables for
|
|
1145 ease of access. */
|
|
1146
|
|
1147 staticpro (&Vcharset_ascii);
|
|
1148 Vcharset_ascii =
|
|
1149 make_charset (LEADING_BYTE_ASCII, Qascii, 1,
|
|
1150 CHARSET_TYPE_94, 1, 0, 'B',
|
|
1151 CHARSET_LEFT_TO_RIGHT,
|
|
1152 build_string ("ASCII"),
|
771
|
1153 build_msg_string ("ASCII"),
|
|
1154 build_msg_string ("ASCII (ISO646 IRV)"),
|
3659
|
1155 vector1(build_string("iso8859-1")), 0, 0);
|
428
|
1156 staticpro (&Vcharset_control_1);
|
|
1157 Vcharset_control_1 =
|
|
1158 make_charset (LEADING_BYTE_CONTROL_1, Qcontrol_1, 2,
|
|
1159 CHARSET_TYPE_94, 1, 1, 0,
|
|
1160 CHARSET_LEFT_TO_RIGHT,
|
|
1161 build_string ("C1"),
|
771
|
1162 build_msg_string ("Control characters"),
|
|
1163 build_msg_string ("Control characters 128-191"),
|
3659
|
1164 vector1(build_string("iso8859-1")), 0, 0);
|
428
|
1165 staticpro (&Vcharset_latin_iso8859_1);
|
|
1166 Vcharset_latin_iso8859_1 =
|
|
1167 make_charset (LEADING_BYTE_LATIN_ISO8859_1, Qlatin_iso8859_1, 2,
|
|
1168 CHARSET_TYPE_96, 1, 1, 'A',
|
|
1169 CHARSET_LEFT_TO_RIGHT,
|
|
1170 build_string ("Latin-1"),
|
771
|
1171 build_msg_string ("ISO8859-1 (Latin-1)"),
|
|
1172 build_msg_string ("ISO8859-1 (Latin-1)"),
|
3659
|
1173 vector1(build_string("iso8859-1")), 0, 0);
|
428
|
1174 staticpro (&Vcharset_latin_iso8859_2);
|
|
1175 Vcharset_latin_iso8859_2 =
|
|
1176 make_charset (LEADING_BYTE_LATIN_ISO8859_2, Qlatin_iso8859_2, 2,
|
|
1177 CHARSET_TYPE_96, 1, 1, 'B',
|
|
1178 CHARSET_LEFT_TO_RIGHT,
|
|
1179 build_string ("Latin-2"),
|
771
|
1180 build_msg_string ("ISO8859-2 (Latin-2)"),
|
|
1181 build_msg_string ("ISO8859-2 (Latin-2)"),
|
3659
|
1182 vector1(build_string("iso8859-2")), 0, 0);
|
428
|
1183 staticpro (&Vcharset_latin_iso8859_3);
|
|
1184 Vcharset_latin_iso8859_3 =
|
|
1185 make_charset (LEADING_BYTE_LATIN_ISO8859_3, Qlatin_iso8859_3, 2,
|
|
1186 CHARSET_TYPE_96, 1, 1, 'C',
|
|
1187 CHARSET_LEFT_TO_RIGHT,
|
|
1188 build_string ("Latin-3"),
|
771
|
1189 build_msg_string ("ISO8859-3 (Latin-3)"),
|
|
1190 build_msg_string ("ISO8859-3 (Latin-3)"),
|
3659
|
1191 vector1(build_string("iso8859-3")), 0, 0);
|
428
|
1192 staticpro (&Vcharset_latin_iso8859_4);
|
|
1193 Vcharset_latin_iso8859_4 =
|
|
1194 make_charset (LEADING_BYTE_LATIN_ISO8859_4, Qlatin_iso8859_4, 2,
|
|
1195 CHARSET_TYPE_96, 1, 1, 'D',
|
|
1196 CHARSET_LEFT_TO_RIGHT,
|
|
1197 build_string ("Latin-4"),
|
771
|
1198 build_msg_string ("ISO8859-4 (Latin-4)"),
|
|
1199 build_msg_string ("ISO8859-4 (Latin-4)"),
|
3659
|
1200 vector1(build_string("iso8859-2")), 0, 0);
|
428
|
1201 staticpro (&Vcharset_thai_tis620);
|
|
1202 Vcharset_thai_tis620 =
|
|
1203 make_charset (LEADING_BYTE_THAI_TIS620, Qthai_tis620, 2,
|
|
1204 CHARSET_TYPE_96, 1, 1, 'T',
|
|
1205 CHARSET_LEFT_TO_RIGHT,
|
|
1206 build_string ("TIS620"),
|
771
|
1207 build_msg_string ("TIS620 (Thai)"),
|
|
1208 build_msg_string ("TIS620.2529 (Thai)"),
|
3659
|
1209 vector1(build_string("tis620.2529-1")), 0, 0);
|
428
|
1210 staticpro (&Vcharset_greek_iso8859_7);
|
|
1211 Vcharset_greek_iso8859_7 =
|
|
1212 make_charset (LEADING_BYTE_GREEK_ISO8859_7, Qgreek_iso8859_7, 2,
|
|
1213 CHARSET_TYPE_96, 1, 1, 'F',
|
|
1214 CHARSET_LEFT_TO_RIGHT,
|
|
1215 build_string ("ISO8859-7"),
|
771
|
1216 build_msg_string ("ISO8859-7 (Greek)"),
|
|
1217 build_msg_string ("ISO8859-7 (Greek)"),
|
3659
|
1218 vector1(build_string("iso8859-7")), 0, 0);
|
428
|
1219 staticpro (&Vcharset_arabic_iso8859_6);
|
|
1220 Vcharset_arabic_iso8859_6 =
|
|
1221 make_charset (LEADING_BYTE_ARABIC_ISO8859_6, Qarabic_iso8859_6, 2,
|
|
1222 CHARSET_TYPE_96, 1, 1, 'G',
|
|
1223 CHARSET_RIGHT_TO_LEFT,
|
|
1224 build_string ("ISO8859-6"),
|
771
|
1225 build_msg_string ("ISO8859-6 (Arabic)"),
|
|
1226 build_msg_string ("ISO8859-6 (Arabic)"),
|
3659
|
1227 vector1(build_string ("iso8859-6")), 0, 0);
|
428
|
1228 staticpro (&Vcharset_hebrew_iso8859_8);
|
|
1229 Vcharset_hebrew_iso8859_8 =
|
|
1230 make_charset (LEADING_BYTE_HEBREW_ISO8859_8, Qhebrew_iso8859_8, 2,
|
|
1231 CHARSET_TYPE_96, 1, 1, 'H',
|
|
1232 CHARSET_RIGHT_TO_LEFT,
|
|
1233 build_string ("ISO8859-8"),
|
771
|
1234 build_msg_string ("ISO8859-8 (Hebrew)"),
|
|
1235 build_msg_string ("ISO8859-8 (Hebrew)"),
|
3659
|
1236 vector1(build_string ("iso8859-8")), 0, 0);
|
428
|
1237 staticpro (&Vcharset_katakana_jisx0201);
|
|
1238 Vcharset_katakana_jisx0201 =
|
|
1239 make_charset (LEADING_BYTE_KATAKANA_JISX0201, Qkatakana_jisx0201, 2,
|
|
1240 CHARSET_TYPE_94, 1, 1, 'I',
|
|
1241 CHARSET_LEFT_TO_RIGHT,
|
|
1242 build_string ("JISX0201 Kana"),
|
771
|
1243 build_msg_string ("JISX0201.1976 (Japanese Kana)"),
|
|
1244 build_msg_string ("JISX0201.1976 Japanese Kana"),
|
3659
|
1245 vector1(build_string ("jisx0201.1976-0")), 0, 0);
|
428
|
1246 staticpro (&Vcharset_latin_jisx0201);
|
|
1247 Vcharset_latin_jisx0201 =
|
|
1248 make_charset (LEADING_BYTE_LATIN_JISX0201, Qlatin_jisx0201, 2,
|
|
1249 CHARSET_TYPE_94, 1, 0, 'J',
|
|
1250 CHARSET_LEFT_TO_RIGHT,
|
|
1251 build_string ("JISX0201 Roman"),
|
771
|
1252 build_msg_string ("JISX0201.1976 (Japanese Roman)"),
|
|
1253 build_msg_string ("JISX0201.1976 Japanese Roman"),
|
3659
|
1254 vector1(build_string ("jisx0201.1976-0")), 0, 0);
|
428
|
1255 staticpro (&Vcharset_cyrillic_iso8859_5);
|
|
1256 Vcharset_cyrillic_iso8859_5 =
|
|
1257 make_charset (LEADING_BYTE_CYRILLIC_ISO8859_5, Qcyrillic_iso8859_5, 2,
|
|
1258 CHARSET_TYPE_96, 1, 1, 'L',
|
|
1259 CHARSET_LEFT_TO_RIGHT,
|
|
1260 build_string ("ISO8859-5"),
|
771
|
1261 build_msg_string ("ISO8859-5 (Cyrillic)"),
|
|
1262 build_msg_string ("ISO8859-5 (Cyrillic)"),
|
3659
|
1263 vector1(build_string ("iso8859-5")), 0, 0);
|
428
|
1264 staticpro (&Vcharset_latin_iso8859_9);
|
|
1265 Vcharset_latin_iso8859_9 =
|
|
1266 make_charset (LEADING_BYTE_LATIN_ISO8859_9, Qlatin_iso8859_9, 2,
|
|
1267 CHARSET_TYPE_96, 1, 1, 'M',
|
|
1268 CHARSET_LEFT_TO_RIGHT,
|
|
1269 build_string ("Latin-5"),
|
771
|
1270 build_msg_string ("ISO8859-9 (Latin-5)"),
|
|
1271 build_msg_string ("ISO8859-9 (Latin-5)"),
|
3659
|
1272 vector1(build_string ("iso8859-9")), 0, 0);
|
728
|
1273 staticpro (&Vcharset_latin_iso8859_15);
|
|
1274 Vcharset_latin_iso8859_15 =
|
|
1275 make_charset (LEADING_BYTE_LATIN_ISO8859_15, Qlatin_iso8859_15, 2,
|
|
1276 CHARSET_TYPE_96, 1, 1, 'b',
|
|
1277 CHARSET_LEFT_TO_RIGHT,
|
|
1278 build_string ("Latin-9"),
|
771
|
1279 build_msg_string ("ISO8859-15 (Latin-9)"),
|
|
1280 build_msg_string ("ISO8859-15 (Latin-9)"),
|
3659
|
1281 vector1(build_string ("iso8859-15")), 0, 0);
|
428
|
1282 staticpro (&Vcharset_japanese_jisx0208_1978);
|
|
1283 Vcharset_japanese_jisx0208_1978 =
|
|
1284 make_charset (LEADING_BYTE_JAPANESE_JISX0208_1978, Qjapanese_jisx0208_1978, 3,
|
|
1285 CHARSET_TYPE_94X94, 2, 0, '@',
|
|
1286 CHARSET_LEFT_TO_RIGHT,
|
|
1287 build_string ("JISX0208.1978"),
|
771
|
1288 build_msg_string ("JISX0208.1978 (Japanese)"),
|
|
1289 build_msg_string
|
428
|
1290 ("JISX0208.1978 Japanese Kanji (so called \"old JIS\")"),
|
3659
|
1291 vector2(build_string("jisx0208.1978-0"),
|
|
1292 build_string("jisc6226.1978-0")), 0, 0);
|
428
|
1293 staticpro (&Vcharset_chinese_gb2312);
|
|
1294 Vcharset_chinese_gb2312 =
|
|
1295 make_charset (LEADING_BYTE_CHINESE_GB2312, Qchinese_gb2312, 3,
|
|
1296 CHARSET_TYPE_94X94, 2, 0, 'A',
|
|
1297 CHARSET_LEFT_TO_RIGHT,
|
|
1298 build_string ("GB2312"),
|
771
|
1299 build_msg_string ("GB2312)"),
|
|
1300 build_msg_string ("GB2312 Chinese simplified"),
|
3659
|
1301 vector2(build_string("gb2312.1980-0"),
|
|
1302 build_string("gb2312.80&gb8565.88-0")), 0, 0);
|
428
|
1303 staticpro (&Vcharset_japanese_jisx0208);
|
|
1304 Vcharset_japanese_jisx0208 =
|
|
1305 make_charset (LEADING_BYTE_JAPANESE_JISX0208, Qjapanese_jisx0208, 3,
|
|
1306 CHARSET_TYPE_94X94, 2, 0, 'B',
|
|
1307 CHARSET_LEFT_TO_RIGHT,
|
|
1308 build_string ("JISX0208"),
|
771
|
1309 build_msg_string ("JISX0208.1983/1990 (Japanese)"),
|
|
1310 build_msg_string ("JISX0208.1983/1990 Japanese Kanji"),
|
3659
|
1311 vector2(build_string("jisx0208.1983-0"),
|
|
1312 build_string("jisx0208.1990-0")), 0, 0);
|
428
|
1313 staticpro (&Vcharset_korean_ksc5601);
|
|
1314 Vcharset_korean_ksc5601 =
|
|
1315 make_charset (LEADING_BYTE_KOREAN_KSC5601, Qkorean_ksc5601, 3,
|
|
1316 CHARSET_TYPE_94X94, 2, 0, 'C',
|
|
1317 CHARSET_LEFT_TO_RIGHT,
|
|
1318 build_string ("KSC5601"),
|
771
|
1319 build_msg_string ("KSC5601 (Korean"),
|
|
1320 build_msg_string ("KSC5601 Korean Hangul and Hanja"),
|
3659
|
1321 vector1(build_string("ksc5601.1987-0")), 0, 0);
|
428
|
1322 staticpro (&Vcharset_japanese_jisx0212);
|
|
1323 Vcharset_japanese_jisx0212 =
|
|
1324 make_charset (LEADING_BYTE_JAPANESE_JISX0212, Qjapanese_jisx0212, 3,
|
|
1325 CHARSET_TYPE_94X94, 2, 0, 'D',
|
|
1326 CHARSET_LEFT_TO_RIGHT,
|
|
1327 build_string ("JISX0212"),
|
771
|
1328 build_msg_string ("JISX0212 (Japanese)"),
|
|
1329 build_msg_string ("JISX0212 Japanese Supplement"),
|
3659
|
1330 vector1(build_string("jisx0212.1990-0")), 0, 0);
|
428
|
1331
|
3659
|
1332 #define CHINESE_CNS_PLANE(n) "cns11643.1992-" n
|
428
|
1333 staticpro (&Vcharset_chinese_cns11643_1);
|
|
1334 Vcharset_chinese_cns11643_1 =
|
|
1335 make_charset (LEADING_BYTE_CHINESE_CNS11643_1, Qchinese_cns11643_1, 3,
|
|
1336 CHARSET_TYPE_94X94, 2, 0, 'G',
|
|
1337 CHARSET_LEFT_TO_RIGHT,
|
|
1338 build_string ("CNS11643-1"),
|
771
|
1339 build_msg_string ("CNS11643-1 (Chinese traditional)"),
|
|
1340 build_msg_string
|
428
|
1341 ("CNS 11643 Plane 1 Chinese traditional"),
|
3659
|
1342 vector1(build_string (CHINESE_CNS_PLANE("1"))), 0, 0);
|
428
|
1343 staticpro (&Vcharset_chinese_cns11643_2);
|
|
1344 Vcharset_chinese_cns11643_2 =
|
|
1345 make_charset (LEADING_BYTE_CHINESE_CNS11643_2, Qchinese_cns11643_2, 3,
|
|
1346 CHARSET_TYPE_94X94, 2, 0, 'H',
|
|
1347 CHARSET_LEFT_TO_RIGHT,
|
|
1348 build_string ("CNS11643-2"),
|
771
|
1349 build_msg_string ("CNS11643-2 (Chinese traditional)"),
|
|
1350 build_msg_string
|
428
|
1351 ("CNS 11643 Plane 2 Chinese traditional"),
|
3659
|
1352 vector1(build_string (CHINESE_CNS_PLANE("2"))), 0, 0);
|
428
|
1353 staticpro (&Vcharset_chinese_big5_1);
|
|
1354 Vcharset_chinese_big5_1 =
|
|
1355 make_charset (LEADING_BYTE_CHINESE_BIG5_1, Qchinese_big5_1, 3,
|
|
1356 CHARSET_TYPE_94X94, 2, 0, '0',
|
|
1357 CHARSET_LEFT_TO_RIGHT,
|
|
1358 build_string ("Big5"),
|
771
|
1359 build_msg_string ("Big5 (Level-1)"),
|
|
1360 build_msg_string
|
428
|
1361 ("Big5 Level-1 Chinese traditional"),
|
3659
|
1362 vector1(build_string ("big5.eten-0")), 0, 0);
|
428
|
1363 staticpro (&Vcharset_chinese_big5_2);
|
|
1364 Vcharset_chinese_big5_2 =
|
|
1365 make_charset (LEADING_BYTE_CHINESE_BIG5_2, Qchinese_big5_2, 3,
|
|
1366 CHARSET_TYPE_94X94, 2, 0, '1',
|
|
1367 CHARSET_LEFT_TO_RIGHT,
|
|
1368 build_string ("Big5"),
|
771
|
1369 build_msg_string ("Big5 (Level-2)"),
|
|
1370 build_msg_string
|
428
|
1371 ("Big5 Level-2 Chinese traditional"),
|
3659
|
1372 vector1(build_string ("big5.eten-0")), 0, 0);
|
428
|
1373
|
|
1374
|
|
1375 #ifdef ENABLE_COMPOSITE_CHARS
|
|
1376 /* #### For simplicity, we put composite chars into a 96x96 charset.
|
|
1377 This is going to lead to problems because you can run out of
|
|
1378 room, esp. as we don't yet recycle numbers. */
|
|
1379 staticpro (&Vcharset_composite);
|
|
1380 Vcharset_composite =
|
|
1381 make_charset (LEADING_BYTE_COMPOSITE, Qcomposite, 3,
|
|
1382 CHARSET_TYPE_96X96, 2, 0, 0,
|
|
1383 CHARSET_LEFT_TO_RIGHT,
|
|
1384 build_string ("Composite"),
|
771
|
1385 build_msg_string ("Composite characters"),
|
|
1386 build_msg_string ("Composite characters"),
|
3659
|
1387 vector1(build_string ("")), 0, 0);
|
771
|
1388 #else
|
|
1389 /* We create a hack so that we have a way of storing ESC 0 and ESC 1
|
|
1390 sequences as "characters", so that they will be output correctly. */
|
|
1391 staticpro (&Vcharset_composite);
|
|
1392 Vcharset_composite =
|
|
1393 make_charset (LEADING_BYTE_COMPOSITE_REPLACEMENT, Qcomposite, 2,
|
|
1394 CHARSET_TYPE_96, 1, 1, '|',
|
|
1395 CHARSET_LEFT_TO_RIGHT,
|
|
1396 build_string ("Composite hack"),
|
|
1397 build_msg_string ("Composite characters hack"),
|
|
1398 build_msg_string ("Composite characters hack"),
|
3659
|
1399 vector1(build_string ("")), 0, 0);
|
428
|
1400 #endif /* ENABLE_COMPOSITE_CHARS */
|
|
1401 }
|