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