Mercurial > hg > xemacs-beta
comparison src/mule-charset.c @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | b8cc9ab3f761 |
children | da8ed4261e83 |
comparison
equal
deleted
inserted
replaced
411:12e008d41344 | 412:697ef44129c6 |
---|---|
30 #include "chartab.h" | 30 #include "chartab.h" |
31 #include "elhash.h" | 31 #include "elhash.h" |
32 #include "lstream.h" | 32 #include "lstream.h" |
33 #include "device.h" | 33 #include "device.h" |
34 #include "faces.h" | 34 #include "faces.h" |
35 #include "mule-ccl.h" | |
36 | 35 |
37 /* The various pre-defined charsets. */ | 36 /* The various pre-defined charsets. */ |
38 | 37 |
39 Lisp_Object Vcharset_ascii; | 38 Lisp_Object Vcharset_ascii; |
40 Lisp_Object Vcharset_control_1; | 39 Lisp_Object Vcharset_control_1; |
72 static int composite_char_row_next; | 71 static int composite_char_row_next; |
73 static int composite_char_col_next; | 72 static int composite_char_col_next; |
74 | 73 |
75 #endif /* ENABLE_COMPOSITE_CHARS */ | 74 #endif /* ENABLE_COMPOSITE_CHARS */ |
76 | 75 |
77 struct charset_lookup *chlook; | 76 /* Table of charsets indexed by leading byte. */ |
78 | 77 Lisp_Object charset_by_leading_byte[128]; |
79 static const struct lrecord_description charset_lookup_description_1[] = { | 78 |
80 { XD_LISP_OBJECT_ARRAY, offsetof (struct charset_lookup, charset_by_leading_byte), 128+4*128*2 }, | 79 /* Table of charsets indexed by type/final-byte/direction. */ |
81 { XD_END } | 80 Lisp_Object charset_by_attributes[4][128][2]; |
82 }; | |
83 | |
84 static const struct struct_description charset_lookup_description = { | |
85 sizeof (struct charset_lookup), | |
86 charset_lookup_description_1 | |
87 }; | |
88 | 81 |
89 /* Table of number of bytes in the string representation of a character | 82 /* Table of number of bytes in the string representation of a character |
90 indexed by the first byte of that representation. | 83 indexed by the first byte of that representation. |
91 | 84 |
92 rep_bytes_by_first_byte(c) is more efficient than the equivalent | 85 rep_bytes_by_first_byte(c) is more efficient than the equivalent |
93 canonical computation: | 86 canonical computation: |
94 | 87 |
95 XCHARSET_REP_BYTES (CHARSET_BY_LEADING_BYTE (c)) */ | 88 (BYTE_ASCII_P (c) ? 1 : XCHARSET_REP_BYTES (CHARSET_BY_LEADING_BYTE (c))) */ |
96 | 89 |
97 const Bytecount rep_bytes_by_first_byte[0xA0] = | 90 Bytecount rep_bytes_by_first_byte[0xA0] = |
98 { /* 0x00 - 0x7f are for straight ASCII */ | 91 { /* 0x00 - 0x7f are for straight ASCII */ |
99 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 92 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
100 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 93 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
101 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 94 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
102 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 95 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
116 | 109 |
117 /* Qdoc_string, Qdimension, Qchars defined in general.c */ | 110 /* Qdoc_string, Qdimension, Qchars defined in general.c */ |
118 Lisp_Object Qregistry, Qfinal, Qgraphic; | 111 Lisp_Object Qregistry, Qfinal, Qgraphic; |
119 Lisp_Object Qdirection; | 112 Lisp_Object Qdirection; |
120 Lisp_Object Qreverse_direction_charset; | 113 Lisp_Object Qreverse_direction_charset; |
114 Lisp_Object Qccl_program; | |
121 Lisp_Object Qleading_byte; | 115 Lisp_Object Qleading_byte; |
122 Lisp_Object Qshort_name, Qlong_name; | 116 Lisp_Object Qshort_name, Qlong_name; |
123 | 117 |
124 Lisp_Object Qascii, | 118 Lisp_Object Qascii, |
125 Qcontrol_1, | 119 Qcontrol_1, |
148 | 142 |
149 Lisp_Object Ql2r, Qr2l; | 143 Lisp_Object Ql2r, Qr2l; |
150 | 144 |
151 Lisp_Object Vcharset_hash_table; | 145 Lisp_Object Vcharset_hash_table; |
152 | 146 |
147 static Bufbyte next_allocated_1_byte_leading_byte; | |
148 static Bufbyte next_allocated_2_byte_leading_byte; | |
149 | |
153 /* Composite characters are characters constructed by overstriking two | 150 /* Composite characters are characters constructed by overstriking two |
154 or more regular characters. | 151 or more regular characters. |
155 | 152 |
156 1) The old Mule implementation involves storing composite characters | 153 1) The old Mule implementation involves storing composite characters |
157 in a buffer as a tag followed by all of the actual characters | 154 in a buffer as a tag followed by all of the actual characters |
215 /* Return the first character from a Mule-encoded string in STR, | 212 /* Return the first character from a Mule-encoded string in STR, |
216 assuming it's non-ASCII. Do not call this directly. | 213 assuming it's non-ASCII. Do not call this directly. |
217 Use the macro charptr_emchar() instead. */ | 214 Use the macro charptr_emchar() instead. */ |
218 | 215 |
219 Emchar | 216 Emchar |
220 non_ascii_charptr_emchar (const Bufbyte *str) | 217 non_ascii_charptr_emchar (CONST Bufbyte *str) |
221 { | 218 { |
222 Bufbyte i0 = *str, i1, i2 = 0; | 219 Bufbyte i0 = *str, i1, i2 = 0; |
223 Lisp_Object charset; | 220 Lisp_Object charset; |
224 | 221 |
225 if (i0 == LEADING_BYTE_CONTROL_1) | 222 if (i0 == LEADING_BYTE_CONTROL_1) |
262 f2 > MAX_CHAR_FIELD2_PRIVATE) | 259 f2 > MAX_CHAR_FIELD2_PRIVATE) |
263 return 0; | 260 return 0; |
264 if (f3 < 0x20) | 261 if (f3 < 0x20) |
265 return 0; | 262 return 0; |
266 | 263 |
267 if (f3 != 0x20 && f3 != 0x7F && !(f2 >= MIN_CHAR_FIELD2_PRIVATE && | 264 if (f3 != 0x20 && f3 != 0x7F) |
268 f2 <= MAX_CHAR_FIELD2_PRIVATE)) | |
269 return 1; | 265 return 1; |
270 | 266 |
271 /* | 267 /* |
272 NOTE: This takes advantage of the fact that | 268 NOTE: This takes advantage of the fact that |
273 FIELD2_TO_OFFICIAL_LEADING_BYTE and | 269 FIELD2_TO_OFFICIAL_LEADING_BYTE and |
274 FIELD2_TO_PRIVATE_LEADING_BYTE are the same. | 270 FIELD2_TO_PRIVATE_LEADING_BYTE are the same. |
275 */ | 271 */ |
276 charset = CHARSET_BY_LEADING_BYTE (f2 + FIELD2_TO_OFFICIAL_LEADING_BYTE); | 272 charset = CHARSET_BY_LEADING_BYTE (f2 + FIELD2_TO_OFFICIAL_LEADING_BYTE); |
277 if (EQ (charset, Qnil)) | |
278 return 0; | |
279 return (XCHARSET_CHARS (charset) == 96); | 273 return (XCHARSET_CHARS (charset) == 96); |
280 } | 274 } |
281 else | 275 else |
282 { | 276 { |
283 Lisp_Object charset; | 277 Lisp_Object charset; |
298 return 0; | 292 return 0; |
299 return 1; | 293 return 1; |
300 } | 294 } |
301 #endif /* ENABLE_COMPOSITE_CHARS */ | 295 #endif /* ENABLE_COMPOSITE_CHARS */ |
302 | 296 |
303 if (f2 != 0x20 && f2 != 0x7F && f3 != 0x20 && f3 != 0x7F | 297 if (f2 != 0x20 && f2 != 0x7F && f3 != 0x20 && f3 != 0x7F) |
304 && !(f1 >= MIN_CHAR_FIELD1_PRIVATE && f1 <= MAX_CHAR_FIELD1_PRIVATE)) | |
305 return 1; | 298 return 1; |
306 | 299 |
307 if (f1 <= MAX_CHAR_FIELD1_OFFICIAL) | 300 if (f1 <= MAX_CHAR_FIELD1_OFFICIAL) |
308 charset = | 301 charset = |
309 CHARSET_BY_LEADING_BYTE (f1 + FIELD1_TO_OFFICIAL_LEADING_BYTE); | 302 CHARSET_BY_LEADING_BYTE (f1 + FIELD1_TO_OFFICIAL_LEADING_BYTE); |
310 else | 303 else |
311 charset = | 304 charset = |
312 CHARSET_BY_LEADING_BYTE (f1 + FIELD1_TO_PRIVATE_LEADING_BYTE); | 305 CHARSET_BY_LEADING_BYTE (f1 + FIELD1_TO_PRIVATE_LEADING_BYTE); |
313 | 306 |
314 if (EQ (charset, Qnil)) | |
315 return 0; | |
316 return (XCHARSET_CHARS (charset) == 96); | 307 return (XCHARSET_CHARS (charset) == 96); |
317 } | 308 } |
318 } | 309 } |
319 | 310 |
320 | 311 |
325 /* Copy the character pointed to by PTR into STR, assuming it's | 316 /* Copy the character pointed to by PTR into STR, assuming it's |
326 non-ASCII. Do not call this directly. Use the macro | 317 non-ASCII. Do not call this directly. Use the macro |
327 charptr_copy_char() instead. */ | 318 charptr_copy_char() instead. */ |
328 | 319 |
329 Bytecount | 320 Bytecount |
330 non_ascii_charptr_copy_char (const Bufbyte *ptr, Bufbyte *str) | 321 non_ascii_charptr_copy_char (CONST Bufbyte *ptr, Bufbyte *str) |
331 { | 322 { |
332 Bufbyte *strptr = str; | 323 Bufbyte *strptr = str; |
333 *strptr = *ptr++; | 324 *strptr = *ptr++; |
334 switch (REP_BYTES_BY_FIRST_BYTE (*strptr)) | 325 switch (REP_BYTES_BY_FIRST_BYTE (*strptr)) |
335 { | 326 { |
402 /************************************************************************/ | 393 /************************************************************************/ |
403 /* charset object */ | 394 /* charset object */ |
404 /************************************************************************/ | 395 /************************************************************************/ |
405 | 396 |
406 static Lisp_Object | 397 static Lisp_Object |
407 mark_charset (Lisp_Object obj) | 398 mark_charset (Lisp_Object obj, void (*markobj) (Lisp_Object)) |
408 { | 399 { |
409 Lisp_Charset *cs = XCHARSET (obj); | 400 struct Lisp_Charset *cs = XCHARSET (obj); |
410 | 401 |
411 mark_object (cs->short_name); | 402 markobj (cs->short_name); |
412 mark_object (cs->long_name); | 403 markobj (cs->long_name); |
413 mark_object (cs->doc_string); | 404 markobj (cs->doc_string); |
414 mark_object (cs->registry); | 405 markobj (cs->registry); |
415 mark_object (cs->ccl_program); | 406 markobj (cs->ccl_program); |
416 return cs->name; | 407 return cs->name; |
417 } | 408 } |
418 | 409 |
419 static void | 410 static void |
420 print_charset (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) | 411 print_charset (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) |
421 { | 412 { |
422 Lisp_Charset *cs = XCHARSET (obj); | 413 struct Lisp_Charset *cs = XCHARSET (obj); |
423 char buf[200]; | 414 char buf[200]; |
424 | 415 |
425 if (print_readably) | 416 if (print_readably) |
426 error ("printing unreadable object #<charset %s 0x%x>", | 417 error ("printing unreadable object #<charset %s 0x%x>", |
427 string_data (XSYMBOL (CHARSET_NAME (cs))->name), | 418 string_data (XSYMBOL (CHARSET_NAME (cs))->name), |
448 print_internal (CHARSET_REGISTRY (cs), printcharfun, 0); | 439 print_internal (CHARSET_REGISTRY (cs), printcharfun, 0); |
449 sprintf (buf, " 0x%x>", cs->header.uid); | 440 sprintf (buf, " 0x%x>", cs->header.uid); |
450 write_c_string (buf, printcharfun); | 441 write_c_string (buf, printcharfun); |
451 } | 442 } |
452 | 443 |
453 static const struct lrecord_description charset_description[] = { | |
454 { XD_LISP_OBJECT, offsetof (Lisp_Charset, name) }, | |
455 { XD_LISP_OBJECT, offsetof (Lisp_Charset, doc_string) }, | |
456 { XD_LISP_OBJECT, offsetof (Lisp_Charset, registry) }, | |
457 { XD_LISP_OBJECT, offsetof (Lisp_Charset, short_name) }, | |
458 { XD_LISP_OBJECT, offsetof (Lisp_Charset, long_name) }, | |
459 { XD_LISP_OBJECT, offsetof (Lisp_Charset, reverse_direction_charset) }, | |
460 { XD_LISP_OBJECT, offsetof (Lisp_Charset, ccl_program) }, | |
461 { XD_END } | |
462 }; | |
463 | |
464 DEFINE_LRECORD_IMPLEMENTATION ("charset", charset, | 444 DEFINE_LRECORD_IMPLEMENTATION ("charset", charset, |
465 mark_charset, print_charset, 0, 0, 0, charset_description, | 445 mark_charset, print_charset, 0, 0, 0, |
466 Lisp_Charset); | 446 struct Lisp_Charset); |
467 /* Make a new charset. */ | 447 /* Make a new charset. */ |
468 | 448 |
469 static Lisp_Object | 449 static Lisp_Object |
470 make_charset (int id, Lisp_Object name, unsigned char rep_bytes, | 450 make_charset (int id, Lisp_Object name, unsigned char rep_bytes, |
471 unsigned char type, unsigned char columns, unsigned char graphic, | 451 unsigned char type, unsigned char columns, unsigned char graphic, |
472 Bufbyte final, unsigned char direction, Lisp_Object short_name, | 452 Bufbyte final, unsigned char direction, Lisp_Object short_name, |
473 Lisp_Object long_name, Lisp_Object doc, | 453 Lisp_Object long_name, Lisp_Object doc, |
474 Lisp_Object reg) | 454 Lisp_Object reg) |
475 { | 455 { |
476 Lisp_Object obj; | 456 Lisp_Object obj; |
477 Lisp_Charset *cs = alloc_lcrecord_type (Lisp_Charset, &lrecord_charset); | 457 struct Lisp_Charset *cs = |
478 | 458 alloc_lcrecord_type (struct Lisp_Charset, &lrecord_charset); |
479 zero_lcrecord (cs); | |
480 | |
481 XSETCHARSET (obj, cs); | 459 XSETCHARSET (obj, cs); |
482 | 460 |
483 CHARSET_ID (cs) = id; | 461 CHARSET_ID (cs) = id; |
484 CHARSET_NAME (cs) = name; | 462 CHARSET_NAME (cs) = name; |
485 CHARSET_SHORT_NAME (cs) = short_name; | 463 CHARSET_SHORT_NAME (cs) = short_name; |
503 if (final) | 481 if (final) |
504 { | 482 { |
505 /* some charsets do not have final characters. This includes | 483 /* some charsets do not have final characters. This includes |
506 ASCII, Control-1, Composite, and the two faux private | 484 ASCII, Control-1, Composite, and the two faux private |
507 charsets. */ | 485 charsets. */ |
508 assert (NILP (chlook->charset_by_attributes[type][final][direction])); | 486 assert (NILP (charset_by_attributes[type][final][direction])); |
509 chlook->charset_by_attributes[type][final][direction] = obj; | 487 charset_by_attributes[type][final][direction] = obj; |
510 } | 488 } |
511 | 489 |
512 assert (NILP (chlook->charset_by_leading_byte[id - 128])); | 490 assert (NILP (charset_by_leading_byte[id - 128])); |
513 chlook->charset_by_leading_byte[id - 128] = obj; | 491 charset_by_leading_byte[id - 128] = obj; |
492 if (id < 0xA0) | |
493 /* official leading byte */ | |
494 rep_bytes_by_first_byte[id] = rep_bytes; | |
514 | 495 |
515 /* Some charsets are "faux" and don't have names or really exist at | 496 /* Some charsets are "faux" and don't have names or really exist at |
516 all except in the leading-byte table. */ | 497 all except in the leading-byte table. */ |
517 if (!NILP (name)) | 498 if (!NILP (name)) |
518 Fputhash (name, obj, Vcharset_hash_table); | 499 Fputhash (name, obj, Vcharset_hash_table); |
524 { | 505 { |
525 int lb; | 506 int lb; |
526 | 507 |
527 if (dimension == 1) | 508 if (dimension == 1) |
528 { | 509 { |
529 if (chlook->next_allocated_1_byte_leading_byte > MAX_LEADING_BYTE_PRIVATE_1) | 510 if (next_allocated_1_byte_leading_byte > MAX_LEADING_BYTE_PRIVATE_1) |
530 lb = 0; | 511 lb = 0; |
531 else | 512 else |
532 lb = chlook->next_allocated_1_byte_leading_byte++; | 513 lb = next_allocated_1_byte_leading_byte++; |
533 } | 514 } |
534 else | 515 else |
535 { | 516 { |
536 if (chlook->next_allocated_2_byte_leading_byte > MAX_LEADING_BYTE_PRIVATE_2) | 517 if (next_allocated_2_byte_leading_byte > MAX_LEADING_BYTE_PRIVATE_2) |
537 lb = 0; | 518 lb = 0; |
538 else | 519 else |
539 lb = chlook->next_allocated_2_byte_leading_byte++; | 520 lb = next_allocated_2_byte_leading_byte++; |
540 } | 521 } |
541 | 522 |
542 if (!lb) | 523 if (!lb) |
543 signal_simple_error | 524 signal_simple_error |
544 ("No more character sets free for this dimension", | 525 ("No more character sets free for this dimension", |
831 { | 812 { |
832 Lisp_Object new_charset = Qnil; | 813 Lisp_Object new_charset = Qnil; |
833 int id, dimension, columns, graphic, final; | 814 int id, dimension, columns, graphic, final; |
834 int direction, type; | 815 int direction, type; |
835 Lisp_Object registry, doc_string, short_name, long_name; | 816 Lisp_Object registry, doc_string, short_name, long_name; |
836 Lisp_Charset *cs; | 817 struct Lisp_Charset *cs; |
837 | 818 |
838 charset = Fget_charset (charset); | 819 charset = Fget_charset (charset); |
839 if (!NILP (XCHARSET_REVERSE_DIRECTION_CHARSET (charset))) | 820 if (!NILP (XCHARSET_REVERSE_DIRECTION_CHARSET (charset))) |
840 signal_simple_error ("Charset already has reverse-direction charset", | 821 signal_simple_error ("Charset already has reverse-direction charset", |
841 charset); | 822 charset); |
980 Recognized properties are those listed in `make-charset', as well as | 961 Recognized properties are those listed in `make-charset', as well as |
981 'name and 'doc-string. | 962 'name and 'doc-string. |
982 */ | 963 */ |
983 (charset, prop)) | 964 (charset, prop)) |
984 { | 965 { |
985 Lisp_Charset *cs; | 966 struct Lisp_Charset *cs; |
986 | 967 |
987 charset = Fget_charset (charset); | 968 charset = Fget_charset (charset); |
988 cs = XCHARSET (charset); | 969 cs = XCHARSET (charset); |
989 | 970 |
990 CHECK_SYMBOL (prop); | 971 CHECK_SYMBOL (prop); |
1067 /************************************************************************/ | 1048 /************************************************************************/ |
1068 /* Lisp primitives for working with characters */ | 1049 /* Lisp primitives for working with characters */ |
1069 /************************************************************************/ | 1050 /************************************************************************/ |
1070 | 1051 |
1071 DEFUN ("make-char", Fmake_char, 2, 3, 0, /* | 1052 DEFUN ("make-char", Fmake_char, 2, 3, 0, /* |
1072 Make a character from CHARSET and octets ARG1 and ARG2. | 1053 Make a multi-byte character from CHARSET and octets ARG1 and ARG2. |
1073 ARG2 is required only for characters from two-dimensional charsets. | |
1074 For example, (make-char 'latin-iso8859-2 185) will return the Latin 2 | |
1075 character s with caron. | |
1076 */ | 1054 */ |
1077 (charset, arg1, arg2)) | 1055 (charset, arg1, arg2)) |
1078 { | 1056 { |
1079 Lisp_Charset *cs; | 1057 struct Lisp_Charset *cs; |
1080 int a1, a2; | 1058 int a1, a2; |
1081 int lowlim, highlim; | 1059 int lowlim, highlim; |
1082 | 1060 |
1083 charset = Fget_charset (charset); | 1061 charset = Fget_charset (charset); |
1084 cs = XCHARSET (charset); | 1062 cs = XCHARSET (charset); |
1087 else if (EQ (charset, Vcharset_control_1)) lowlim = 0, highlim = 31; | 1065 else if (EQ (charset, Vcharset_control_1)) lowlim = 0, highlim = 31; |
1088 else if (CHARSET_CHARS (cs) == 94) lowlim = 33, highlim = 126; | 1066 else if (CHARSET_CHARS (cs) == 94) lowlim = 33, highlim = 126; |
1089 else /* CHARSET_CHARS (cs) == 96) */ lowlim = 32, highlim = 127; | 1067 else /* CHARSET_CHARS (cs) == 96) */ lowlim = 32, highlim = 127; |
1090 | 1068 |
1091 CHECK_INT (arg1); | 1069 CHECK_INT (arg1); |
1092 /* It is useful (and safe, according to Olivier Galibert) to strip | 1070 a1 = XINT (arg1); |
1093 the 8th bit off ARG1 and ARG2 becaue it allows programmers to | |
1094 write (make-char 'latin-iso8859-2 CODE) where code is the actual | |
1095 Latin 2 code of the character. */ | |
1096 a1 = XINT (arg1) & 0x7f; | |
1097 if (a1 < lowlim || a1 > highlim) | 1071 if (a1 < lowlim || a1 > highlim) |
1098 args_out_of_range_3 (arg1, make_int (lowlim), make_int (highlim)); | 1072 args_out_of_range_3 (arg1, make_int (lowlim), make_int (highlim)); |
1099 | 1073 |
1100 if (CHARSET_DIMENSION (cs) == 1) | 1074 if (CHARSET_DIMENSION (cs) == 1) |
1101 { | 1075 { |
1104 ("Charset is of dimension one; second octet must be nil", arg2); | 1078 ("Charset is of dimension one; second octet must be nil", arg2); |
1105 return make_char (MAKE_CHAR (charset, a1, 0)); | 1079 return make_char (MAKE_CHAR (charset, a1, 0)); |
1106 } | 1080 } |
1107 | 1081 |
1108 CHECK_INT (arg2); | 1082 CHECK_INT (arg2); |
1109 a2 = XINT (arg2) & 0x7f; | 1083 a2 = XINT (arg2); |
1110 if (a2 < lowlim || a2 > highlim) | 1084 if (a2 < lowlim || a2 > highlim) |
1111 args_out_of_range_3 (arg2, make_int (lowlim), make_int (highlim)); | 1085 args_out_of_range_3 (arg2, make_int (lowlim), make_int (highlim)); |
1112 | 1086 |
1113 return make_char (MAKE_CHAR (charset, a1, a2)); | 1087 return make_char (MAKE_CHAR (charset, a1, a2)); |
1114 } | 1088 } |
1129 N defaults to 0 if omitted. | 1103 N defaults to 0 if omitted. |
1130 */ | 1104 */ |
1131 (ch, n)) | 1105 (ch, n)) |
1132 { | 1106 { |
1133 Lisp_Object charset; | 1107 Lisp_Object charset; |
1134 int octet0, octet1; | 1108 int c1, c2, int_n; |
1135 | 1109 |
1136 CHECK_CHAR_COERCE_INT (ch); | 1110 CHECK_CHAR_COERCE_INT (ch); |
1137 | 1111 if (NILP (n)) |
1138 BREAKUP_CHAR (XCHAR (ch), charset, octet0, octet1); | 1112 int_n = 0; |
1139 | |
1140 if (NILP (n) || EQ (n, Qzero)) | |
1141 return make_int (octet0); | |
1142 else if (EQ (n, make_int (1))) | |
1143 return make_int (octet1); | |
1144 else | |
1145 signal_simple_error ("Octet number must be 0 or 1", n); | |
1146 } | |
1147 | |
1148 DEFUN ("split-char", Fsplit_char, 1, 1, 0, /* | |
1149 Return list of charset and one or two position-codes of CHAR. | |
1150 */ | |
1151 (character)) | |
1152 { | |
1153 /* This function can GC */ | |
1154 struct gcpro gcpro1, gcpro2; | |
1155 Lisp_Object charset = Qnil; | |
1156 Lisp_Object rc = Qnil; | |
1157 int c1, c2; | |
1158 | |
1159 GCPRO2 (charset, rc); | |
1160 CHECK_CHAR_COERCE_INT (character); | |
1161 | |
1162 BREAKUP_CHAR (XCHAR (character), charset, c1, c2); | |
1163 | |
1164 if (XCHARSET_DIMENSION (Fget_charset (charset)) == 2) | |
1165 { | |
1166 rc = list3 (XCHARSET_NAME (charset), make_int (c1), make_int (c2)); | |
1167 } | |
1168 else | 1113 else |
1169 { | 1114 { |
1170 rc = list2 (XCHARSET_NAME (charset), make_int (c1)); | 1115 CHECK_INT (n); |
1116 int_n = XINT (n); | |
1117 if (int_n != 0 && int_n != 1) | |
1118 signal_simple_error ("Octet number must be 0 or 1", n); | |
1171 } | 1119 } |
1172 UNGCPRO; | 1120 BREAKUP_CHAR (XCHAR (ch), charset, c1, c2); |
1173 | 1121 return make_int (int_n == 0 ? c1 : c2); |
1174 return rc; | |
1175 } | 1122 } |
1176 | 1123 |
1177 | 1124 |
1178 #ifdef ENABLE_COMPOSITE_CHARS | 1125 #ifdef ENABLE_COMPOSITE_CHARS |
1179 /************************************************************************/ | 1126 /************************************************************************/ |
1254 /************************************************************************/ | 1201 /************************************************************************/ |
1255 | 1202 |
1256 void | 1203 void |
1257 syms_of_mule_charset (void) | 1204 syms_of_mule_charset (void) |
1258 { | 1205 { |
1259 INIT_LRECORD_IMPLEMENTATION (charset); | |
1260 | |
1261 DEFSUBR (Fcharsetp); | 1206 DEFSUBR (Fcharsetp); |
1262 DEFSUBR (Ffind_charset); | 1207 DEFSUBR (Ffind_charset); |
1263 DEFSUBR (Fget_charset); | 1208 DEFSUBR (Fget_charset); |
1264 DEFSUBR (Fcharset_list); | 1209 DEFSUBR (Fcharset_list); |
1265 DEFSUBR (Fcharset_name); | 1210 DEFSUBR (Fcharset_name); |
1277 DEFSUBR (Fset_charset_registry); | 1222 DEFSUBR (Fset_charset_registry); |
1278 | 1223 |
1279 DEFSUBR (Fmake_char); | 1224 DEFSUBR (Fmake_char); |
1280 DEFSUBR (Fchar_charset); | 1225 DEFSUBR (Fchar_charset); |
1281 DEFSUBR (Fchar_octet); | 1226 DEFSUBR (Fchar_octet); |
1282 DEFSUBR (Fsplit_char); | |
1283 | 1227 |
1284 #ifdef ENABLE_COMPOSITE_CHARS | 1228 #ifdef ENABLE_COMPOSITE_CHARS |
1285 DEFSUBR (Fmake_composite_char); | 1229 DEFSUBR (Fmake_composite_char); |
1286 DEFSUBR (Fcomposite_char_string); | 1230 DEFSUBR (Fcomposite_char_string); |
1287 #endif | 1231 #endif |
1290 defsymbol (&Qregistry, "registry"); | 1234 defsymbol (&Qregistry, "registry"); |
1291 defsymbol (&Qfinal, "final"); | 1235 defsymbol (&Qfinal, "final"); |
1292 defsymbol (&Qgraphic, "graphic"); | 1236 defsymbol (&Qgraphic, "graphic"); |
1293 defsymbol (&Qdirection, "direction"); | 1237 defsymbol (&Qdirection, "direction"); |
1294 defsymbol (&Qreverse_direction_charset, "reverse-direction-charset"); | 1238 defsymbol (&Qreverse_direction_charset, "reverse-direction-charset"); |
1239 defsymbol (&Qccl_program, "ccl-program"); | |
1295 defsymbol (&Qshort_name, "short-name"); | 1240 defsymbol (&Qshort_name, "short-name"); |
1296 defsymbol (&Qlong_name, "long-name"); | 1241 defsymbol (&Qlong_name, "long-name"); |
1297 | 1242 |
1298 defsymbol (&Ql2r, "l2r"); | 1243 defsymbol (&Ql2r, "l2r"); |
1299 defsymbol (&Qr2l, "r2l"); | 1244 defsymbol (&Qr2l, "r2l"); |
1330 void | 1275 void |
1331 vars_of_mule_charset (void) | 1276 vars_of_mule_charset (void) |
1332 { | 1277 { |
1333 int i, j, k; | 1278 int i, j, k; |
1334 | 1279 |
1335 chlook = xnew (struct charset_lookup); | |
1336 dumpstruct (&chlook, &charset_lookup_description); | |
1337 | |
1338 /* Table of charsets indexed by leading byte. */ | 1280 /* Table of charsets indexed by leading byte. */ |
1339 for (i = 0; i < countof (chlook->charset_by_leading_byte); i++) | 1281 for (i = 0; i < countof (charset_by_leading_byte); i++) |
1340 chlook->charset_by_leading_byte[i] = Qnil; | 1282 charset_by_leading_byte[i] = Qnil; |
1341 | 1283 |
1342 /* Table of charsets indexed by type/final-byte/direction. */ | 1284 /* Table of charsets indexed by type/final-byte/direction. */ |
1343 for (i = 0; i < countof (chlook->charset_by_attributes); i++) | 1285 for (i = 0; i < countof (charset_by_attributes); i++) |
1344 for (j = 0; j < countof (chlook->charset_by_attributes[0]); j++) | 1286 for (j = 0; j < countof (charset_by_attributes[0]); j++) |
1345 for (k = 0; k < countof (chlook->charset_by_attributes[0][0]); k++) | 1287 for (k = 0; k < countof (charset_by_attributes[0][0]); k++) |
1346 chlook->charset_by_attributes[i][j][k] = Qnil; | 1288 charset_by_attributes[i][j][k] = Qnil; |
1347 | 1289 |
1348 chlook->next_allocated_1_byte_leading_byte = MIN_LEADING_BYTE_PRIVATE_1; | 1290 next_allocated_1_byte_leading_byte = MIN_LEADING_BYTE_PRIVATE_1; |
1349 chlook->next_allocated_2_byte_leading_byte = MIN_LEADING_BYTE_PRIVATE_2; | 1291 next_allocated_2_byte_leading_byte = MIN_LEADING_BYTE_PRIVATE_2; |
1350 } | 1292 } |
1351 | 1293 |
1352 void | 1294 void |
1353 complex_vars_of_mule_charset (void) | 1295 complex_vars_of_mule_charset (void) |
1354 { | 1296 { |
1357 make_lisp_hash_table (50, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ); | 1299 make_lisp_hash_table (50, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ); |
1358 | 1300 |
1359 /* Predefined character sets. We store them into variables for | 1301 /* Predefined character sets. We store them into variables for |
1360 ease of access. */ | 1302 ease of access. */ |
1361 | 1303 |
1362 staticpro (&Vcharset_ascii); | |
1363 Vcharset_ascii = | 1304 Vcharset_ascii = |
1364 make_charset (LEADING_BYTE_ASCII, Qascii, 1, | 1305 make_charset (LEADING_BYTE_ASCII, Qascii, 1, |
1365 CHARSET_TYPE_94, 1, 0, 'B', | 1306 CHARSET_TYPE_94, 1, 0, 'B', |
1366 CHARSET_LEFT_TO_RIGHT, | 1307 CHARSET_LEFT_TO_RIGHT, |
1367 build_string ("ASCII"), | 1308 build_string ("ASCII"), |
1368 build_string ("ASCII)"), | 1309 build_string ("ASCII)"), |
1369 build_string ("ASCII (ISO646 IRV)"), | 1310 build_string ("ASCII (ISO646 IRV)"), |
1370 build_string ("\\(iso8859-[0-9]*\\|-ascii\\)")); | 1311 build_string ("\\(iso8859-[0-9]*\\|-ascii\\)")); |
1371 staticpro (&Vcharset_control_1); | |
1372 Vcharset_control_1 = | 1312 Vcharset_control_1 = |
1373 make_charset (LEADING_BYTE_CONTROL_1, Qcontrol_1, 2, | 1313 make_charset (LEADING_BYTE_CONTROL_1, Qcontrol_1, 2, |
1374 CHARSET_TYPE_94, 1, 1, 0, | 1314 CHARSET_TYPE_94, 1, 1, 0, |
1375 CHARSET_LEFT_TO_RIGHT, | 1315 CHARSET_LEFT_TO_RIGHT, |
1376 build_string ("C1"), | 1316 build_string ("C1"), |
1377 build_string ("Control characters"), | 1317 build_string ("Control characters"), |
1378 build_string ("Control characters 128-191"), | 1318 build_string ("Control characters 128-191"), |
1379 build_string ("")); | 1319 build_string ("")); |
1380 staticpro (&Vcharset_latin_iso8859_1); | |
1381 Vcharset_latin_iso8859_1 = | 1320 Vcharset_latin_iso8859_1 = |
1382 make_charset (LEADING_BYTE_LATIN_ISO8859_1, Qlatin_iso8859_1, 2, | 1321 make_charset (LEADING_BYTE_LATIN_ISO8859_1, Qlatin_iso8859_1, 2, |
1383 CHARSET_TYPE_96, 1, 1, 'A', | 1322 CHARSET_TYPE_96, 1, 1, 'A', |
1384 CHARSET_LEFT_TO_RIGHT, | 1323 CHARSET_LEFT_TO_RIGHT, |
1385 build_string ("Latin-1"), | 1324 build_string ("Latin-1"), |
1386 build_string ("ISO8859-1 (Latin-1)"), | 1325 build_string ("ISO8859-1 (Latin-1)"), |
1387 build_string ("ISO8859-1 (Latin-1)"), | 1326 build_string ("ISO8859-1 (Latin-1)"), |
1388 build_string ("iso8859-1")); | 1327 build_string ("iso8859-1")); |
1389 staticpro (&Vcharset_latin_iso8859_2); | |
1390 Vcharset_latin_iso8859_2 = | 1328 Vcharset_latin_iso8859_2 = |
1391 make_charset (LEADING_BYTE_LATIN_ISO8859_2, Qlatin_iso8859_2, 2, | 1329 make_charset (LEADING_BYTE_LATIN_ISO8859_2, Qlatin_iso8859_2, 2, |
1392 CHARSET_TYPE_96, 1, 1, 'B', | 1330 CHARSET_TYPE_96, 1, 1, 'B', |
1393 CHARSET_LEFT_TO_RIGHT, | 1331 CHARSET_LEFT_TO_RIGHT, |
1394 build_string ("Latin-2"), | 1332 build_string ("Latin-2"), |
1395 build_string ("ISO8859-2 (Latin-2)"), | 1333 build_string ("ISO8859-2 (Latin-2)"), |
1396 build_string ("ISO8859-2 (Latin-2)"), | 1334 build_string ("ISO8859-2 (Latin-2)"), |
1397 build_string ("iso8859-2")); | 1335 build_string ("iso8859-2")); |
1398 staticpro (&Vcharset_latin_iso8859_3); | |
1399 Vcharset_latin_iso8859_3 = | 1336 Vcharset_latin_iso8859_3 = |
1400 make_charset (LEADING_BYTE_LATIN_ISO8859_3, Qlatin_iso8859_3, 2, | 1337 make_charset (LEADING_BYTE_LATIN_ISO8859_3, Qlatin_iso8859_3, 2, |
1401 CHARSET_TYPE_96, 1, 1, 'C', | 1338 CHARSET_TYPE_96, 1, 1, 'C', |
1402 CHARSET_LEFT_TO_RIGHT, | 1339 CHARSET_LEFT_TO_RIGHT, |
1403 build_string ("Latin-3"), | 1340 build_string ("Latin-3"), |
1404 build_string ("ISO8859-3 (Latin-3)"), | 1341 build_string ("ISO8859-3 (Latin-3)"), |
1405 build_string ("ISO8859-3 (Latin-3)"), | 1342 build_string ("ISO8859-3 (Latin-3)"), |
1406 build_string ("iso8859-3")); | 1343 build_string ("iso8859-3")); |
1407 staticpro (&Vcharset_latin_iso8859_4); | |
1408 Vcharset_latin_iso8859_4 = | 1344 Vcharset_latin_iso8859_4 = |
1409 make_charset (LEADING_BYTE_LATIN_ISO8859_4, Qlatin_iso8859_4, 2, | 1345 make_charset (LEADING_BYTE_LATIN_ISO8859_4, Qlatin_iso8859_4, 2, |
1410 CHARSET_TYPE_96, 1, 1, 'D', | 1346 CHARSET_TYPE_96, 1, 1, 'D', |
1411 CHARSET_LEFT_TO_RIGHT, | 1347 CHARSET_LEFT_TO_RIGHT, |
1412 build_string ("Latin-4"), | 1348 build_string ("Latin-4"), |
1413 build_string ("ISO8859-4 (Latin-4)"), | 1349 build_string ("ISO8859-4 (Latin-4)"), |
1414 build_string ("ISO8859-4 (Latin-4)"), | 1350 build_string ("ISO8859-4 (Latin-4)"), |
1415 build_string ("iso8859-4")); | 1351 build_string ("iso8859-4")); |
1416 staticpro (&Vcharset_thai_tis620); | |
1417 Vcharset_thai_tis620 = | 1352 Vcharset_thai_tis620 = |
1418 make_charset (LEADING_BYTE_THAI_TIS620, Qthai_tis620, 2, | 1353 make_charset (LEADING_BYTE_THAI_TIS620, Qthai_tis620, 2, |
1419 CHARSET_TYPE_96, 1, 1, 'T', | 1354 CHARSET_TYPE_96, 1, 1, 'T', |
1420 CHARSET_LEFT_TO_RIGHT, | 1355 CHARSET_LEFT_TO_RIGHT, |
1421 build_string ("TIS620"), | 1356 build_string ("TIS620"), |
1422 build_string ("TIS620 (Thai)"), | 1357 build_string ("TIS620 (Thai)"), |
1423 build_string ("TIS620.2529 (Thai)"), | 1358 build_string ("TIS620.2529 (Thai)"), |
1424 build_string ("tis620")); | 1359 build_string ("tis620")); |
1425 staticpro (&Vcharset_greek_iso8859_7); | |
1426 Vcharset_greek_iso8859_7 = | 1360 Vcharset_greek_iso8859_7 = |
1427 make_charset (LEADING_BYTE_GREEK_ISO8859_7, Qgreek_iso8859_7, 2, | 1361 make_charset (LEADING_BYTE_GREEK_ISO8859_7, Qgreek_iso8859_7, 2, |
1428 CHARSET_TYPE_96, 1, 1, 'F', | 1362 CHARSET_TYPE_96, 1, 1, 'F', |
1429 CHARSET_LEFT_TO_RIGHT, | 1363 CHARSET_LEFT_TO_RIGHT, |
1430 build_string ("ISO8859-7"), | 1364 build_string ("ISO8859-7"), |
1431 build_string ("ISO8859-7 (Greek)"), | 1365 build_string ("ISO8859-7 (Greek)"), |
1432 build_string ("ISO8859-7 (Greek)"), | 1366 build_string ("ISO8859-7 (Greek)"), |
1433 build_string ("iso8859-7")); | 1367 build_string ("iso8859-7")); |
1434 staticpro (&Vcharset_arabic_iso8859_6); | |
1435 Vcharset_arabic_iso8859_6 = | 1368 Vcharset_arabic_iso8859_6 = |
1436 make_charset (LEADING_BYTE_ARABIC_ISO8859_6, Qarabic_iso8859_6, 2, | 1369 make_charset (LEADING_BYTE_ARABIC_ISO8859_6, Qarabic_iso8859_6, 2, |
1437 CHARSET_TYPE_96, 1, 1, 'G', | 1370 CHARSET_TYPE_96, 1, 1, 'G', |
1438 CHARSET_RIGHT_TO_LEFT, | 1371 CHARSET_RIGHT_TO_LEFT, |
1439 build_string ("ISO8859-6"), | 1372 build_string ("ISO8859-6"), |
1440 build_string ("ISO8859-6 (Arabic)"), | 1373 build_string ("ISO8859-6 (Arabic)"), |
1441 build_string ("ISO8859-6 (Arabic)"), | 1374 build_string ("ISO8859-6 (Arabic)"), |
1442 build_string ("iso8859-6")); | 1375 build_string ("iso8859-6")); |
1443 staticpro (&Vcharset_hebrew_iso8859_8); | |
1444 Vcharset_hebrew_iso8859_8 = | 1376 Vcharset_hebrew_iso8859_8 = |
1445 make_charset (LEADING_BYTE_HEBREW_ISO8859_8, Qhebrew_iso8859_8, 2, | 1377 make_charset (LEADING_BYTE_HEBREW_ISO8859_8, Qhebrew_iso8859_8, 2, |
1446 CHARSET_TYPE_96, 1, 1, 'H', | 1378 CHARSET_TYPE_96, 1, 1, 'H', |
1447 CHARSET_RIGHT_TO_LEFT, | 1379 CHARSET_RIGHT_TO_LEFT, |
1448 build_string ("ISO8859-8"), | 1380 build_string ("ISO8859-8"), |
1449 build_string ("ISO8859-8 (Hebrew)"), | 1381 build_string ("ISO8859-8 (Hebrew)"), |
1450 build_string ("ISO8859-8 (Hebrew)"), | 1382 build_string ("ISO8859-8 (Hebrew)"), |
1451 build_string ("iso8859-8")); | 1383 build_string ("iso8859-8")); |
1452 staticpro (&Vcharset_katakana_jisx0201); | |
1453 Vcharset_katakana_jisx0201 = | 1384 Vcharset_katakana_jisx0201 = |
1454 make_charset (LEADING_BYTE_KATAKANA_JISX0201, Qkatakana_jisx0201, 2, | 1385 make_charset (LEADING_BYTE_KATAKANA_JISX0201, Qkatakana_jisx0201, 2, |
1455 CHARSET_TYPE_94, 1, 1, 'I', | 1386 CHARSET_TYPE_94, 1, 1, 'I', |
1456 CHARSET_LEFT_TO_RIGHT, | 1387 CHARSET_LEFT_TO_RIGHT, |
1457 build_string ("JISX0201 Kana"), | 1388 build_string ("JISX0201 Kana"), |
1458 build_string ("JISX0201.1976 (Japanese Kana)"), | 1389 build_string ("JISX0201.1976 (Japanese Kana)"), |
1459 build_string ("JISX0201.1976 Japanese Kana"), | 1390 build_string ("JISX0201.1976 Japanese Kana"), |
1460 build_string ("jisx0201.1976")); | 1391 build_string ("jisx0201.1976")); |
1461 staticpro (&Vcharset_latin_jisx0201); | |
1462 Vcharset_latin_jisx0201 = | 1392 Vcharset_latin_jisx0201 = |
1463 make_charset (LEADING_BYTE_LATIN_JISX0201, Qlatin_jisx0201, 2, | 1393 make_charset (LEADING_BYTE_LATIN_JISX0201, Qlatin_jisx0201, 2, |
1464 CHARSET_TYPE_94, 1, 0, 'J', | 1394 CHARSET_TYPE_94, 1, 0, 'J', |
1465 CHARSET_LEFT_TO_RIGHT, | 1395 CHARSET_LEFT_TO_RIGHT, |
1466 build_string ("JISX0201 Roman"), | 1396 build_string ("JISX0201 Roman"), |
1467 build_string ("JISX0201.1976 (Japanese Roman)"), | 1397 build_string ("JISX0201.1976 (Japanese Roman)"), |
1468 build_string ("JISX0201.1976 Japanese Roman"), | 1398 build_string ("JISX0201.1976 Japanese Roman"), |
1469 build_string ("jisx0201.1976")); | 1399 build_string ("jisx0201.1976")); |
1470 staticpro (&Vcharset_cyrillic_iso8859_5); | |
1471 Vcharset_cyrillic_iso8859_5 = | 1400 Vcharset_cyrillic_iso8859_5 = |
1472 make_charset (LEADING_BYTE_CYRILLIC_ISO8859_5, Qcyrillic_iso8859_5, 2, | 1401 make_charset (LEADING_BYTE_CYRILLIC_ISO8859_5, Qcyrillic_iso8859_5, 2, |
1473 CHARSET_TYPE_96, 1, 1, 'L', | 1402 CHARSET_TYPE_96, 1, 1, 'L', |
1474 CHARSET_LEFT_TO_RIGHT, | 1403 CHARSET_LEFT_TO_RIGHT, |
1475 build_string ("ISO8859-5"), | 1404 build_string ("ISO8859-5"), |
1476 build_string ("ISO8859-5 (Cyrillic)"), | 1405 build_string ("ISO8859-5 (Cyrillic)"), |
1477 build_string ("ISO8859-5 (Cyrillic)"), | 1406 build_string ("ISO8859-5 (Cyrillic)"), |
1478 build_string ("iso8859-5")); | 1407 build_string ("iso8859-5")); |
1479 staticpro (&Vcharset_latin_iso8859_9); | |
1480 Vcharset_latin_iso8859_9 = | 1408 Vcharset_latin_iso8859_9 = |
1481 make_charset (LEADING_BYTE_LATIN_ISO8859_9, Qlatin_iso8859_9, 2, | 1409 make_charset (LEADING_BYTE_LATIN_ISO8859_9, Qlatin_iso8859_9, 2, |
1482 CHARSET_TYPE_96, 1, 1, 'M', | 1410 CHARSET_TYPE_96, 1, 1, 'M', |
1483 CHARSET_LEFT_TO_RIGHT, | 1411 CHARSET_LEFT_TO_RIGHT, |
1484 build_string ("Latin-5"), | 1412 build_string ("Latin-5"), |
1485 build_string ("ISO8859-9 (Latin-5)"), | 1413 build_string ("ISO8859-9 (Latin-5)"), |
1486 build_string ("ISO8859-9 (Latin-5)"), | 1414 build_string ("ISO8859-9 (Latin-5)"), |
1487 build_string ("iso8859-9")); | 1415 build_string ("iso8859-9")); |
1488 staticpro (&Vcharset_japanese_jisx0208_1978); | |
1489 Vcharset_japanese_jisx0208_1978 = | 1416 Vcharset_japanese_jisx0208_1978 = |
1490 make_charset (LEADING_BYTE_JAPANESE_JISX0208_1978, Qjapanese_jisx0208_1978, 3, | 1417 make_charset (LEADING_BYTE_JAPANESE_JISX0208_1978, Qjapanese_jisx0208_1978, 3, |
1491 CHARSET_TYPE_94X94, 2, 0, '@', | 1418 CHARSET_TYPE_94X94, 2, 0, '@', |
1492 CHARSET_LEFT_TO_RIGHT, | 1419 CHARSET_LEFT_TO_RIGHT, |
1493 build_string ("JISX0208.1978"), | 1420 build_string ("JISX0208.1978"), |
1494 build_string ("JISX0208.1978 (Japanese)"), | 1421 build_string ("JISX0208.1978 (Japanese)"), |
1495 build_string | 1422 build_string |
1496 ("JISX0208.1978 Japanese Kanji (so called \"old JIS\")"), | 1423 ("JISX0208.1978 Japanese Kanji (so called \"old JIS\")"), |
1497 build_string ("\\(jisx0208\\|jisc6226\\)\\.1978")); | 1424 build_string ("\\(jisx0208\\|jisc6226\\).19")); |
1498 staticpro (&Vcharset_chinese_gb2312); | |
1499 Vcharset_chinese_gb2312 = | 1425 Vcharset_chinese_gb2312 = |
1500 make_charset (LEADING_BYTE_CHINESE_GB2312, Qchinese_gb2312, 3, | 1426 make_charset (LEADING_BYTE_CHINESE_GB2312, Qchinese_gb2312, 3, |
1501 CHARSET_TYPE_94X94, 2, 0, 'A', | 1427 CHARSET_TYPE_94X94, 2, 0, 'A', |
1502 CHARSET_LEFT_TO_RIGHT, | 1428 CHARSET_LEFT_TO_RIGHT, |
1503 build_string ("GB2312"), | 1429 build_string ("GB2312"), |
1504 build_string ("GB2312)"), | 1430 build_string ("GB2312)"), |
1505 build_string ("GB2312 Chinese simplified"), | 1431 build_string ("GB2312 Chinese simplified"), |
1506 build_string ("gb2312")); | 1432 build_string ("gb2312")); |
1507 staticpro (&Vcharset_japanese_jisx0208); | |
1508 Vcharset_japanese_jisx0208 = | 1433 Vcharset_japanese_jisx0208 = |
1509 make_charset (LEADING_BYTE_JAPANESE_JISX0208, Qjapanese_jisx0208, 3, | 1434 make_charset (LEADING_BYTE_JAPANESE_JISX0208, Qjapanese_jisx0208, 3, |
1510 CHARSET_TYPE_94X94, 2, 0, 'B', | 1435 CHARSET_TYPE_94X94, 2, 0, 'B', |
1511 CHARSET_LEFT_TO_RIGHT, | 1436 CHARSET_LEFT_TO_RIGHT, |
1512 build_string ("JISX0208"), | 1437 build_string ("JISX0208"), |
1513 build_string ("JISX0208.1983/1990 (Japanese)"), | 1438 build_string ("JISX0208.1983/1990 (Japanese)"), |
1514 build_string ("JISX0208.1983/1990 Japanese Kanji"), | 1439 build_string ("JISX0208.1983/1990 Japanese Kanji"), |
1515 build_string ("jisx0208.19\\(83\\|90\\)")); | 1440 build_string ("jisx0208.19\\(83\\|90\\)")); |
1516 staticpro (&Vcharset_korean_ksc5601); | |
1517 Vcharset_korean_ksc5601 = | 1441 Vcharset_korean_ksc5601 = |
1518 make_charset (LEADING_BYTE_KOREAN_KSC5601, Qkorean_ksc5601, 3, | 1442 make_charset (LEADING_BYTE_KOREAN_KSC5601, Qkorean_ksc5601, 3, |
1519 CHARSET_TYPE_94X94, 2, 0, 'C', | 1443 CHARSET_TYPE_94X94, 2, 0, 'C', |
1520 CHARSET_LEFT_TO_RIGHT, | 1444 CHARSET_LEFT_TO_RIGHT, |
1521 build_string ("KSC5601"), | 1445 build_string ("KSC5601"), |
1522 build_string ("KSC5601 (Korean"), | 1446 build_string ("KSC5601 (Korean"), |
1523 build_string ("KSC5601 Korean Hangul and Hanja"), | 1447 build_string ("KSC5601 Korean Hangul and Hanja"), |
1524 build_string ("ksc5601")); | 1448 build_string ("ksc5601")); |
1525 staticpro (&Vcharset_japanese_jisx0212); | |
1526 Vcharset_japanese_jisx0212 = | 1449 Vcharset_japanese_jisx0212 = |
1527 make_charset (LEADING_BYTE_JAPANESE_JISX0212, Qjapanese_jisx0212, 3, | 1450 make_charset (LEADING_BYTE_JAPANESE_JISX0212, Qjapanese_jisx0212, 3, |
1528 CHARSET_TYPE_94X94, 2, 0, 'D', | 1451 CHARSET_TYPE_94X94, 2, 0, 'D', |
1529 CHARSET_LEFT_TO_RIGHT, | 1452 CHARSET_LEFT_TO_RIGHT, |
1530 build_string ("JISX0212"), | 1453 build_string ("JISX0212"), |
1531 build_string ("JISX0212 (Japanese)"), | 1454 build_string ("JISX0212 (Japanese)"), |
1532 build_string ("JISX0212 Japanese Supplement"), | 1455 build_string ("JISX0212 Japanese Supplement"), |
1533 build_string ("jisx0212")); | 1456 build_string ("jisx0212")); |
1534 | 1457 |
1535 #define CHINESE_CNS_PLANE_RE(n) "cns11643[.-]\\(.*[.-]\\)?" n "$" | 1458 #define CHINESE_CNS_PLANE_RE(n) "cns11643[.-]\\(.*[.-]\\)?" n "$" |
1536 staticpro (&Vcharset_chinese_cns11643_1); | |
1537 Vcharset_chinese_cns11643_1 = | 1459 Vcharset_chinese_cns11643_1 = |
1538 make_charset (LEADING_BYTE_CHINESE_CNS11643_1, Qchinese_cns11643_1, 3, | 1460 make_charset (LEADING_BYTE_CHINESE_CNS11643_1, Qchinese_cns11643_1, 3, |
1539 CHARSET_TYPE_94X94, 2, 0, 'G', | 1461 CHARSET_TYPE_94X94, 2, 0, 'G', |
1540 CHARSET_LEFT_TO_RIGHT, | 1462 CHARSET_LEFT_TO_RIGHT, |
1541 build_string ("CNS11643-1"), | 1463 build_string ("CNS11643-1"), |
1542 build_string ("CNS11643-1 (Chinese traditional)"), | 1464 build_string ("CNS11643-1 (Chinese traditional)"), |
1543 build_string | 1465 build_string |
1544 ("CNS 11643 Plane 1 Chinese traditional"), | 1466 ("CNS 11643 Plane 1 Chinese traditional"), |
1545 build_string (CHINESE_CNS_PLANE_RE("1"))); | 1467 build_string (CHINESE_CNS_PLANE_RE("1"))); |
1546 staticpro (&Vcharset_chinese_cns11643_2); | |
1547 Vcharset_chinese_cns11643_2 = | 1468 Vcharset_chinese_cns11643_2 = |
1548 make_charset (LEADING_BYTE_CHINESE_CNS11643_2, Qchinese_cns11643_2, 3, | 1469 make_charset (LEADING_BYTE_CHINESE_CNS11643_2, Qchinese_cns11643_2, 3, |
1549 CHARSET_TYPE_94X94, 2, 0, 'H', | 1470 CHARSET_TYPE_94X94, 2, 0, 'H', |
1550 CHARSET_LEFT_TO_RIGHT, | 1471 CHARSET_LEFT_TO_RIGHT, |
1551 build_string ("CNS11643-2"), | 1472 build_string ("CNS11643-2"), |
1552 build_string ("CNS11643-2 (Chinese traditional)"), | 1473 build_string ("CNS11643-2 (Chinese traditional)"), |
1553 build_string | 1474 build_string |
1554 ("CNS 11643 Plane 2 Chinese traditional"), | 1475 ("CNS 11643 Plane 2 Chinese traditional"), |
1555 build_string (CHINESE_CNS_PLANE_RE("2"))); | 1476 build_string (CHINESE_CNS_PLANE_RE("2"))); |
1556 staticpro (&Vcharset_chinese_big5_1); | |
1557 Vcharset_chinese_big5_1 = | 1477 Vcharset_chinese_big5_1 = |
1558 make_charset (LEADING_BYTE_CHINESE_BIG5_1, Qchinese_big5_1, 3, | 1478 make_charset (LEADING_BYTE_CHINESE_BIG5_1, Qchinese_big5_1, 3, |
1559 CHARSET_TYPE_94X94, 2, 0, '0', | 1479 CHARSET_TYPE_94X94, 2, 0, '0', |
1560 CHARSET_LEFT_TO_RIGHT, | 1480 CHARSET_LEFT_TO_RIGHT, |
1561 build_string ("Big5"), | 1481 build_string ("Big5"), |
1562 build_string ("Big5 (Level-1)"), | 1482 build_string ("Big5 (Level-1)"), |
1563 build_string | 1483 build_string |
1564 ("Big5 Level-1 Chinese traditional"), | 1484 ("Big5 Level-1 Chinese traditional"), |
1565 build_string ("big5")); | 1485 build_string ("big5")); |
1566 staticpro (&Vcharset_chinese_big5_2); | |
1567 Vcharset_chinese_big5_2 = | 1486 Vcharset_chinese_big5_2 = |
1568 make_charset (LEADING_BYTE_CHINESE_BIG5_2, Qchinese_big5_2, 3, | 1487 make_charset (LEADING_BYTE_CHINESE_BIG5_2, Qchinese_big5_2, 3, |
1569 CHARSET_TYPE_94X94, 2, 0, '1', | 1488 CHARSET_TYPE_94X94, 2, 0, '1', |
1570 CHARSET_LEFT_TO_RIGHT, | 1489 CHARSET_LEFT_TO_RIGHT, |
1571 build_string ("Big5"), | 1490 build_string ("Big5"), |
1577 | 1496 |
1578 #ifdef ENABLE_COMPOSITE_CHARS | 1497 #ifdef ENABLE_COMPOSITE_CHARS |
1579 /* #### For simplicity, we put composite chars into a 96x96 charset. | 1498 /* #### For simplicity, we put composite chars into a 96x96 charset. |
1580 This is going to lead to problems because you can run out of | 1499 This is going to lead to problems because you can run out of |
1581 room, esp. as we don't yet recycle numbers. */ | 1500 room, esp. as we don't yet recycle numbers. */ |
1582 staticpro (&Vcharset_composite); | |
1583 Vcharset_composite = | 1501 Vcharset_composite = |
1584 make_charset (LEADING_BYTE_COMPOSITE, Qcomposite, 3, | 1502 make_charset (LEADING_BYTE_COMPOSITE, Qcomposite, 3, |
1585 CHARSET_TYPE_96X96, 2, 0, 0, | 1503 CHARSET_TYPE_96X96, 2, 0, 0, |
1586 CHARSET_LEFT_TO_RIGHT, | 1504 CHARSET_LEFT_TO_RIGHT, |
1587 build_string ("Composite"), | 1505 build_string ("Composite"), |
1588 build_string ("Composite characters"), | 1506 build_string ("Composite characters"), |
1589 build_string ("Composite characters"), | 1507 build_string ("Composite characters"), |
1590 build_string ("")); | 1508 build_string ("")); |
1591 | 1509 |
1592 /* #### not dumped properly */ | |
1593 composite_char_row_next = 32; | 1510 composite_char_row_next = 32; |
1594 composite_char_col_next = 32; | 1511 composite_char_col_next = 32; |
1595 | 1512 |
1596 Vcomposite_char_string2char_hash_table = | 1513 Vcomposite_char_string2char_hash_table = |
1597 make_lisp_hash_table (500, HASH_TABLE_NON_WEAK, HASH_TABLE_EQUAL); | 1514 make_lisp_hash_table (500, HASH_TABLE_NON_WEAK, HASH_TABLE_EQUAL); |