comparison src/mule-charset.c @ 5118:e0db3c197671 ben-lisp-object

merge up to latest default branch, doesn't compile yet
author Ben Wing <ben@xemacs.org>
date Sat, 26 Dec 2009 21:18:49 -0600
parents 3742ea8250b5 0c54de4c4b9d
children d877c14318b3
comparison
equal deleted inserted replaced
5117:3742ea8250b5 5118:e0db3c197671
33 #include "device.h" 33 #include "device.h"
34 #include "faces.h" 34 #include "faces.h"
35 #include "lstream.h" 35 #include "lstream.h"
36 #include "mule-ccl.h" 36 #include "mule-ccl.h"
37 #include "objects.h" 37 #include "objects.h"
38 #include "specifier.h"
38 39
39 /* The various pre-defined charsets. */ 40 /* The various pre-defined charsets. */
40 41
41 Lisp_Object Vcharset_ascii; 42 Lisp_Object Vcharset_ascii;
42 Lisp_Object Vcharset_control_1; 43 Lisp_Object Vcharset_control_1;
44 Lisp_Object Vcharset_latin_iso8859_2; 45 Lisp_Object Vcharset_latin_iso8859_2;
45 Lisp_Object Vcharset_latin_iso8859_3; 46 Lisp_Object Vcharset_latin_iso8859_3;
46 Lisp_Object Vcharset_latin_iso8859_4; 47 Lisp_Object Vcharset_latin_iso8859_4;
47 Lisp_Object Vcharset_thai_tis620; 48 Lisp_Object Vcharset_thai_tis620;
48 Lisp_Object Vcharset_greek_iso8859_7; 49 Lisp_Object Vcharset_greek_iso8859_7;
49 Lisp_Object Vcharset_arabic_iso8859_6;
50 Lisp_Object Vcharset_hebrew_iso8859_8; 50 Lisp_Object Vcharset_hebrew_iso8859_8;
51 Lisp_Object Vcharset_katakana_jisx0201; 51 Lisp_Object Vcharset_katakana_jisx0201;
52 Lisp_Object Vcharset_latin_jisx0201; 52 Lisp_Object Vcharset_latin_jisx0201;
53 Lisp_Object Vcharset_cyrillic_iso8859_5; 53 Lisp_Object Vcharset_cyrillic_iso8859_5;
54 Lisp_Object Vcharset_latin_iso8859_9; 54 Lisp_Object Vcharset_latin_iso8859_9;
76 charset_lookup_description_1 76 charset_lookup_description_1
77 }; 77 };
78 78
79 Lisp_Object Qcharsetp; 79 Lisp_Object Qcharsetp;
80 80
81 /* Qdoc_string, Qdimension, Qchars defined in general.c */ 81 /* Qdoc_string, Qdimension, Qchars, Qfinal defined in general.c */
82 Lisp_Object Qregistry, Qfinal, Qgraphic; 82 Lisp_Object Qregistries, Qgraphic, Qregistry;
83 Lisp_Object Qdirection; 83 Lisp_Object Qdirection;
84 Lisp_Object Qreverse_direction_charset; 84 Lisp_Object Qreverse_direction_charset;
85 Lisp_Object Qshort_name, Qlong_name; 85 Lisp_Object Qshort_name, Qlong_name;
86 86
87 Lisp_Object Qfrom_unicode, Qto_unicode; 87 Lisp_Object Qto_unicode;
88 88
89 Lisp_Object 89 Lisp_Object
90 Qlatin_iso8859_1, 90 Qlatin_iso8859_1,
91 Qlatin_iso8859_2, 91 Qlatin_iso8859_2,
92 Qlatin_iso8859_3, 92 Qlatin_iso8859_3,
93 Qlatin_iso8859_4, 93 Qlatin_iso8859_4,
94 Qthai_tis620, 94 Qthai_tis620,
95 Qgreek_iso8859_7, 95 Qgreek_iso8859_7,
96 Qarabic_iso8859_6,
97 Qhebrew_iso8859_8, 96 Qhebrew_iso8859_8,
98 Qkatakana_jisx0201, 97 Qkatakana_jisx0201,
99 Qlatin_jisx0201, 98 Qlatin_jisx0201,
100 Qcyrillic_iso8859_5, 99 Qcyrillic_iso8859_5,
101 Qlatin_iso8859_9, 100 Qlatin_iso8859_9,
126 Lisp_Charset *cs = XCHARSET (obj); 125 Lisp_Charset *cs = XCHARSET (obj);
127 126
128 mark_object (cs->short_name); 127 mark_object (cs->short_name);
129 mark_object (cs->long_name); 128 mark_object (cs->long_name);
130 mark_object (cs->doc_string); 129 mark_object (cs->doc_string);
131 mark_object (cs->registry); 130 mark_object (cs->registries);
132 mark_object (cs->ccl_program); 131 mark_object (cs->ccl_program);
133 return cs->name; 132 return cs->name;
134 } 133 }
135 134
136 static void 135 static void
156 CHARSET_DIRECTION (cs) == CHARSET_LEFT_TO_RIGHT ? "l2r" : 155 CHARSET_DIRECTION (cs) == CHARSET_LEFT_TO_RIGHT ? "l2r" :
157 "r2l", 156 "r2l",
158 CHARSET_COLUMNS (cs), 157 CHARSET_COLUMNS (cs),
159 CHARSET_GRAPHIC (cs), 158 CHARSET_GRAPHIC (cs),
160 CHARSET_FINAL (cs)); 159 CHARSET_FINAL (cs));
161 print_internal (CHARSET_REGISTRY (cs), printcharfun, 0); 160 print_internal (CHARSET_REGISTRIES (cs), printcharfun, 0);
162 write_fmt_string (printcharfun, " 0x%x>", cs->header.uid); 161 write_fmt_string (printcharfun, " 0x%x>", cs->header.uid);
163 } 162 }
164 163
165 static const struct memory_description charset_description[] = { 164 static const struct memory_description charset_description[] = {
166 { XD_INT, offsetof (Lisp_Charset, dimension) }, 165 { XD_INT, offsetof (Lisp_Charset, dimension) },
167 { XD_INT, offsetof (Lisp_Charset, from_unicode_levels) }, 166 { XD_INT, offsetof (Lisp_Charset, from_unicode_levels) },
168 { XD_LISP_OBJECT, offsetof (Lisp_Charset, name) }, 167 { XD_LISP_OBJECT, offsetof (Lisp_Charset, name) },
169 { XD_LISP_OBJECT, offsetof (Lisp_Charset, doc_string) }, 168 { XD_LISP_OBJECT, offsetof (Lisp_Charset, doc_string) },
170 { XD_LISP_OBJECT, offsetof (Lisp_Charset, registry) }, 169 { XD_LISP_OBJECT, offsetof (Lisp_Charset, registries) },
171 { XD_LISP_OBJECT, offsetof (Lisp_Charset, short_name) }, 170 { XD_LISP_OBJECT, offsetof (Lisp_Charset, short_name) },
172 { XD_LISP_OBJECT, offsetof (Lisp_Charset, long_name) }, 171 { XD_LISP_OBJECT, offsetof (Lisp_Charset, long_name) },
173 { XD_LISP_OBJECT, offsetof (Lisp_Charset, reverse_direction_charset) }, 172 { XD_LISP_OBJECT, offsetof (Lisp_Charset, reverse_direction_charset) },
174 { XD_LISP_OBJECT, offsetof (Lisp_Charset, ccl_program) }, 173 { XD_LISP_OBJECT, offsetof (Lisp_Charset, ccl_program) },
175 { XD_UNION, offsetof (Lisp_Charset, to_unicode_table), 174 { XD_UNION, offsetof (Lisp_Charset, to_unicode_table),
177 { XD_UNION, offsetof (Lisp_Charset, from_unicode_table), 176 { XD_UNION, offsetof (Lisp_Charset, from_unicode_table),
178 XD_INDIRECT (1, 0), { &from_unicode_description }, XD_FLAG_NO_KKCC }, 177 XD_INDIRECT (1, 0), { &from_unicode_description }, XD_FLAG_NO_KKCC },
179 { XD_END } 178 { XD_END }
180 }; 179 };
181 180
182 DEFINE_LISP_OBJECT ("charset", charset, 181 DEFINE_DUMPABLE_LISP_OBJECT ("charset", charset,
183 mark_charset, print_charset, 0, 182 mark_charset, print_charset, 0,
184 0, 0, charset_description, Lisp_Charset); 183 0, 0, charset_description, Lisp_Charset);
185 /* Make a new charset. */ 184 /* Make a new charset. */
186 /* #### SJT Should generic properties be allowed? */ 185 /* #### SJT Should generic properties be allowed? */
187 static Lisp_Object 186 static Lisp_Object
188 make_charset (int id, Lisp_Object name, int rep_bytes, 187 make_charset (int id, Lisp_Object name, int rep_bytes,
189 int type, int columns, int graphic, 188 int type, int columns, int graphic,
190 Ibyte final, int direction, Lisp_Object short_name, 189 Ibyte final, int direction, Lisp_Object short_name,
191 Lisp_Object long_name, Lisp_Object doc, 190 Lisp_Object long_name, Lisp_Object doc,
192 Lisp_Object reg, int overwrite) 191 Lisp_Object reg, int overwrite, int encode_as_utf_8)
193 { 192 {
194 Lisp_Object obj; 193 Lisp_Object obj;
195 Lisp_Charset *cs; 194 Lisp_Charset *cs;
196 195
197 if (!overwrite) 196 if (!overwrite)
236 CHARSET_TYPE (cs) = type; 235 CHARSET_TYPE (cs) = type;
237 CHARSET_COLUMNS (cs) = columns; 236 CHARSET_COLUMNS (cs) = columns;
238 CHARSET_GRAPHIC (cs) = graphic; 237 CHARSET_GRAPHIC (cs) = graphic;
239 CHARSET_FINAL (cs) = final; 238 CHARSET_FINAL (cs) = final;
240 CHARSET_DOC_STRING (cs) = doc; 239 CHARSET_DOC_STRING (cs) = doc;
241 CHARSET_REGISTRY (cs) = reg; 240 CHECK_VECTOR(reg);
241 CHARSET_REGISTRIES (cs) = reg;
242 CHARSET_ENCODE_AS_UTF_8 (cs) = encode_as_utf_8 ? 1 : 0;
242 CHARSET_CCL_PROGRAM (cs) = Qnil; 243 CHARSET_CCL_PROGRAM (cs) = Qnil;
243 CHARSET_REVERSE_DIRECTION_CHARSET (cs) = Qnil; 244 CHARSET_REVERSE_DIRECTION_CHARSET (cs) = Qnil;
244 245
245 CHARSET_DIMENSION (cs) = (CHARSET_TYPE (cs) == CHARSET_TYPE_94 || 246 CHARSET_DIMENSION (cs) = (CHARSET_TYPE (cs) == CHARSET_TYPE_94 ||
246 CHARSET_TYPE (cs) == CHARSET_TYPE_96) ? 1 : 2; 247 CHARSET_TYPE (cs) == CHARSET_TYPE_96) ? 1 : 2;
267 assert (NILP (Fgethash (name, Vcharset_hash_table, Qnil))); 268 assert (NILP (Fgethash (name, Vcharset_hash_table, Qnil)));
268 Fputhash (name, obj, Vcharset_hash_table); 269 Fputhash (name, obj, Vcharset_hash_table);
269 } 270 }
270 271
271 recalculate_unicode_precedence (); 272 recalculate_unicode_precedence ();
273 setup_charset_initial_specifier_tags (obj);
274
272 return obj; 275 return obj;
273 } 276 }
274 277
275 static int 278 static int
276 get_unallocated_leading_byte (int dimension) 279 get_unallocated_leading_byte (int dimension)
415 PROPS is a property list, describing the specific nature of the 418 PROPS is a property list, describing the specific nature of the
416 character set. Recognized properties are: 419 character set. Recognized properties are:
417 420
418 `short-name' Short version of the charset name (ex: Latin-1) 421 `short-name' Short version of the charset name (ex: Latin-1)
419 `long-name' Long version of the charset name (ex: ISO8859-1 (Latin-1)) 422 `long-name' Long version of the charset name (ex: ISO8859-1 (Latin-1))
420 `registry' A regular expression matching the font registry field for 423 `registries' A vector of possible XLFD REGISTRY-ENCODING combinations for
421 this character set. 424 this character set. Note that this is not a regular expression.
422 `dimension' Number of octets used to index a character in this charset. 425 `dimension' Number of octets used to index a character in this charset.
423 Either 1 or 2. Defaults to 1. 426 Either 1 or 2. Defaults to 1.
424 `columns' Number of columns used to display a character in this charset. 427 `columns' Number of columns used to display a character in this charset.
425 Only used in TTY mode. (Under X, the actual width of a 428 Only used in TTY mode. (Under X, the actual width of a
426 character can be derived from the font used to display the 429 character can be derived from the font used to display the
451 this charset into an index into the font. This is in 454 this charset into an index into the font. This is in
452 addition to the `graphic' property. The CCL program 455 addition to the `graphic' property. The CCL program
453 is passed the octets of the character, with the high 456 is passed the octets of the character, with the high
454 bit cleared and set depending upon whether the value 457 bit cleared and set depending upon whether the value
455 of the `graphic' property is 0 or 1. 458 of the `graphic' property is 0 or 1.
459 `encode-as-utf-8'
460 If non-nil, the charset will be written out using the UTF-8
461 escape syntax in ISO 2022-oriented coding systems. Used for
462 supporting characters we know are part of Unicode but not of
463 any other known character set in escape-quoted and compound
464 text.
456 */ 465 */
457 (name, doc_string, props)) 466 (name, doc_string, props))
458 { 467 {
459 int id, dimension = 1, chars = 94, graphic = 0, columns = -1; 468 int id, dimension = 1, chars = 94, graphic = 0, columns = -1;
460 Ibyte final = 0; 469 Ibyte final = 0;
461 int direction = CHARSET_LEFT_TO_RIGHT; 470 int direction = CHARSET_LEFT_TO_RIGHT;
462 int type; 471 int type;
463 Lisp_Object registry = Qnil; 472 Lisp_Object registries = Qnil;
464 Lisp_Object charset = Qnil; 473 Lisp_Object charset = Qnil;
465 Lisp_Object ccl_program = Qnil; 474 Lisp_Object ccl_program = Qnil;
466 Lisp_Object short_name = Qnil, long_name = Qnil; 475 Lisp_Object short_name = Qnil, long_name = Qnil;
476 int encode_as_utf_8 = 0;
467 Lisp_Object existing_charset; 477 Lisp_Object existing_charset;
468 int temporary = UNBOUNDP (name); 478 int temporary = UNBOUNDP (name);
469 479
470 /* NOTE: name == Qunbound is a directive from the iso2022 code to 480 /* NOTE: name == Qunbound is a directive from the iso2022 code to
471 create a temporary charset for an unknown final. We allow the final 481 create a temporary charset for an unknown final. We allow the final
527 graphic = XINT (value); 537 graphic = XINT (value);
528 if (graphic < 0 || graphic > 1) 538 if (graphic < 0 || graphic > 1)
529 invalid_constant ("Invalid value for `graphic'", value); 539 invalid_constant ("Invalid value for `graphic'", value);
530 } 540 }
531 541
542 else if (EQ (keyword, Qregistries))
543 {
544 CHECK_VECTOR (value);
545 registries = value;
546 }
547
532 else if (EQ (keyword, Qregistry)) 548 else if (EQ (keyword, Qregistry))
533 { 549 {
550 Lisp_Object quoted_registry;
551
534 CHECK_STRING (value); 552 CHECK_STRING (value);
535 registry = value; 553 quoted_registry = Fregexp_quote(value);
554 if (qxestrcmp(XSTRING_DATA(quoted_registry),
555 XSTRING_DATA(value)))
556 {
557 warn_when_safe
558 (Qregistry, Qwarning,
559 "Regexps no longer allowed for charset-registry. "
560 "Treating %s as string", XSTRING_DATA(value));
561 }
562 registries = vector1(value);
536 } 563 }
537 564
538 else if (EQ (keyword, Qdirection)) 565 else if (EQ (keyword, Qdirection))
539 { 566 {
540 if (EQ (value, Ql2r)) 567 if (EQ (value, Ql2r))
543 direction = CHARSET_RIGHT_TO_LEFT; 570 direction = CHARSET_RIGHT_TO_LEFT;
544 else 571 else
545 invalid_constant ("Invalid value for `direction'", value); 572 invalid_constant ("Invalid value for `direction'", value);
546 } 573 }
547 574
575 else if (EQ (keyword, Qencode_as_utf_8))
576 {
577 encode_as_utf_8 = NILP (value) ? 0 : 1;
578 }
579
548 else if (EQ (keyword, Qfinal)) 580 else if (EQ (keyword, Qfinal))
549 { 581 {
550 CHECK_CHAR_COERCE_INT (value); 582 CHECK_CHAR_COERCE_INT (value);
551 final = XCHAR (value); 583 final = XCHAR (value);
552 if (final < '0' || final > '~') 584 if (final < '0' || final > '~')
553 invalid_constant ("Invalid value for `final'", value); 585 invalid_constant ("Invalid value for `final'", value);
554 } 586 }
555
556 else if (EQ (keyword, Qccl_program)) 587 else if (EQ (keyword, Qccl_program))
557 { 588 {
558 struct ccl_program test_ccl; 589 /* This errors if VALUE is not a valid CCL program. */
559 590 ccl_program = get_ccl_program (value);
560 if (setup_ccl_program (&test_ccl, value) < 0)
561 invalid_argument ("Invalid value for `ccl-program'", value);
562 ccl_program = value;
563 } 591 }
564 else 592 else
565 invalid_constant ("Unrecognized property", keyword); 593 invalid_constant ("Unrecognized property", keyword);
566 } 594 }
567 } 595 }
598 qxesprintf (tempname, "___temporary___%d__", id); 626 qxesprintf (tempname, "___temporary___%d__", id);
599 name = intern_int (tempname); 627 name = intern_int (tempname);
600 } 628 }
601 if (NILP (doc_string)) 629 if (NILP (doc_string))
602 doc_string = build_string (""); 630 doc_string = build_string ("");
603 if (NILP (registry)) 631 if (NILP (registries))
604 registry = build_string (""); 632 registries = make_vector(0, Qnil);
605 if (NILP (short_name)) 633 if (NILP (short_name))
606 short_name = XSYMBOL (name)->name; 634 short_name = XSYMBOL (name)->name;
607 if (NILP (long_name)) 635 if (NILP (long_name))
608 long_name = doc_string; 636 long_name = doc_string;
609 if (columns == -1) 637 if (columns == -1)
610 columns = dimension; 638 columns = dimension;
611 639
612 charset = make_charset (id, name, dimension + 2, type, columns, graphic, 640 charset = make_charset (id, name, dimension + 2, type, columns, graphic,
613 final, direction, short_name, long_name, 641 final, direction, short_name, long_name,
614 doc_string, registry, !NILP (existing_charset)); 642 doc_string, registries, !NILP (existing_charset),
643 encode_as_utf_8);
615 644
616 XCHARSET (charset)->temporary = temporary; 645 XCHARSET (charset)->temporary = temporary;
617 if (!NILP (ccl_program)) 646 if (!NILP (ccl_program))
618 XCHARSET_CCL_PROGRAM (charset) = ccl_program; 647 XCHARSET_CCL_PROGRAM (charset) = ccl_program;
619 648
638 NEW-NAME is the name of the new charset. Return the new charset. 667 NEW-NAME is the name of the new charset. Return the new charset.
639 */ 668 */
640 (charset, new_name)) 669 (charset, new_name))
641 { 670 {
642 Lisp_Object new_charset = Qnil; 671 Lisp_Object new_charset = Qnil;
643 int id, dimension, columns, graphic; 672 int id, dimension, columns, graphic, encode_as_utf_8;
644 Ibyte final; 673 Ibyte final;
645 int direction, type; 674 int direction, type;
646 Lisp_Object registry, doc_string, short_name, long_name; 675 Lisp_Object registries, doc_string, short_name, long_name;
647 Lisp_Charset *cs; 676 Lisp_Charset *cs;
648 677
649 charset = Fget_charset (charset); 678 charset = Fget_charset (charset);
650 if (!NILP (XCHARSET_REVERSE_DIRECTION_CHARSET (charset))) 679 if (!NILP (XCHARSET_REVERSE_DIRECTION_CHARSET (charset)))
651 invalid_operation ("Charset already has reverse-direction charset", 680 invalid_operation ("Charset already has reverse-direction charset",
668 if (CHARSET_DIRECTION (cs) == CHARSET_RIGHT_TO_LEFT) 697 if (CHARSET_DIRECTION (cs) == CHARSET_RIGHT_TO_LEFT)
669 direction = CHARSET_LEFT_TO_RIGHT; 698 direction = CHARSET_LEFT_TO_RIGHT;
670 doc_string = CHARSET_DOC_STRING (cs); 699 doc_string = CHARSET_DOC_STRING (cs);
671 short_name = CHARSET_SHORT_NAME (cs); 700 short_name = CHARSET_SHORT_NAME (cs);
672 long_name = CHARSET_LONG_NAME (cs); 701 long_name = CHARSET_LONG_NAME (cs);
673 registry = CHARSET_REGISTRY (cs); 702 registries = CHARSET_REGISTRIES (cs);
703 encode_as_utf_8 = CHARSET_ENCODE_AS_UTF_8 (cs);
674 704
675 new_charset = make_charset (id, new_name, dimension + 2, type, columns, 705 new_charset = make_charset (id, new_name, dimension + 2, type, columns,
676 graphic, final, direction, short_name, long_name, 706 graphic, final, direction, short_name, long_name,
677 doc_string, registry, 0); 707 doc_string, registries, 0, encode_as_utf_8);
678 708
679 CHARSET_REVERSE_DIRECTION_CHARSET (cs) = new_charset; 709 CHARSET_REVERSE_DIRECTION_CHARSET (cs) = new_charset;
680 XCHARSET_REVERSE_DIRECTION_CHARSET (new_charset) = charset; 710 XCHARSET_REVERSE_DIRECTION_CHARSET (new_charset) = charset;
681 711
682 return new_charset; 712 return new_charset;
803 if (EQ (prop, Qdimension)) return make_int (CHARSET_DIMENSION (cs)); 833 if (EQ (prop, Qdimension)) return make_int (CHARSET_DIMENSION (cs));
804 if (EQ (prop, Qcolumns)) return make_int (CHARSET_COLUMNS (cs)); 834 if (EQ (prop, Qcolumns)) return make_int (CHARSET_COLUMNS (cs));
805 if (EQ (prop, Qgraphic)) return make_int (CHARSET_GRAPHIC (cs)); 835 if (EQ (prop, Qgraphic)) return make_int (CHARSET_GRAPHIC (cs));
806 if (EQ (prop, Qfinal)) return make_char (CHARSET_FINAL (cs)); 836 if (EQ (prop, Qfinal)) return make_char (CHARSET_FINAL (cs));
807 if (EQ (prop, Qchars)) return make_int (CHARSET_CHARS (cs)); 837 if (EQ (prop, Qchars)) return make_int (CHARSET_CHARS (cs));
808 if (EQ (prop, Qregistry)) return CHARSET_REGISTRY (cs); 838 if (EQ (prop, Qregistries)) return CHARSET_REGISTRIES (cs);
839 if (EQ (prop, Qencode_as_utf_8))
840 return CHARSET_ENCODE_AS_UTF_8 (cs) ? Qt : Qnil;
809 if (EQ (prop, Qccl_program)) return CHARSET_CCL_PROGRAM (cs); 841 if (EQ (prop, Qccl_program)) return CHARSET_CCL_PROGRAM (cs);
810 if (EQ (prop, Qdirection)) 842 if (EQ (prop, Qdirection))
811 return CHARSET_DIRECTION (cs) == CHARSET_LEFT_TO_RIGHT ? Ql2r : Qr2l; 843 return CHARSET_DIRECTION (cs) == CHARSET_LEFT_TO_RIGHT ? Ql2r : Qr2l;
812 if (EQ (prop, Qreverse_direction_charset)) 844 if (EQ (prop, Qreverse_direction_charset))
813 { 845 {
836 (charset, ccl_program)) 868 (charset, ccl_program))
837 { 869 {
838 struct ccl_program test_ccl; 870 struct ccl_program test_ccl;
839 871
840 charset = Fget_charset (charset); 872 charset = Fget_charset (charset);
841 if (setup_ccl_program (&test_ccl, ccl_program) < 0) 873 XCHARSET_CCL_PROGRAM (charset) = get_ccl_program (ccl_program);
842 invalid_argument ("Invalid ccl-program", ccl_program); 874
843 XCHARSET_CCL_PROGRAM (charset) = ccl_program;
844 face_property_was_changed (Vdefault_face, Qfont, Qglobal); 875 face_property_was_changed (Vdefault_face, Qfont, Qglobal);
845 return Qnil; 876 return Qnil;
846 } 877 }
847 878
848 /* Japanese folks may want to (set-charset-registry 'ascii "jisx0201") */ 879 void
849 DEFUN ("set-charset-registry", Fset_charset_registry, 2, 2, 0, /* 880 set_charset_registries(Lisp_Object charset, Lisp_Object registries)
850 Set the `registry' property of CHARSET to REGISTRY. 881 {
851 */ 882 XCHARSET_REGISTRIES (charset) = registries;
852 (charset, registry))
853 {
854 charset = Fget_charset (charset);
855 CHECK_STRING (registry);
856 XCHARSET_REGISTRY (charset) = registry;
857 invalidate_charset_font_caches (charset); 883 invalidate_charset_font_caches (charset);
858 face_property_was_changed (Vdefault_face, Qfont, Qglobal); 884 face_property_was_changed (Vdefault_face, Qfont, Qglobal);
885 }
886
887 DEFUN ("set-charset-registries", Fset_charset_registries, 2, 3, 0, /*
888 Set the `registries' property of CHARSET to REGISTRIES.
889
890 REGISTRIES is an ordered vector of strings that describe the X11
891 CHARSET_REGISTRY and the CHARSET_ENCODINGs appropriate for this charset.
892 Separate each registry from the corresponding encoding with a dash. The
893 strings are not regular expressions, in contrast to the old behavior of
894 the `charset-registry' property.
895
896 One reason to call this function might be if you're in Japan and you'd
897 prefer the backslash to display as a Yen sign; the corresponding syntax
898 would be:
899
900 (set-charset-registries 'ascii ["jisx0201.1976-0"])
901
902 If optional argument FORCE is non-nil, avoid sanity-checking the elements of
903 REGISTRIES. Normally the strings are checked to make sure they contain no
904 XLFD wild cards and that they contain at least one hyphen; the only context
905 in which one might want not to do this is in order to use a font which
906 doesn't have a full XLFD--and thus, an effective
907 CHARSET_REGISTRY-CHARSET_ENCODING of ""--to display ASCII.
908
909 We recommend strongly that you specify a full XLFD, since this makes
910 multilingual and variant font handling work much better. To get the full
911 XLFD of any font, start xfd with the short name as the pattern argument:
912
913 xfd -fn 8x16kana
914
915 and use the text that appears at the top of the window.
916 */
917 (charset, registries, force))
918 {
919 int i;
920 charset = Fget_charset (charset);
921 CHECK_VECTOR (registries);
922
923 for (i = 0; i < XVECTOR_LENGTH(registries); ++i)
924 {
925 CHECK_STRING (XVECTOR_DATA(registries)[i]);
926
927 if (!NILP(force))
928 {
929 continue;
930 }
931
932 if (NULL == qxestrchr(XSTRING_DATA(XVECTOR_DATA(registries)[i]), '-'))
933 {
934 invalid_argument("Not an X11 REGISTRY-ENCODING combination",
935 XVECTOR_DATA(registries)[i]);
936 }
937
938 if (qxestrchr(XSTRING_DATA(XVECTOR_DATA(registries)[i]), '*') ||
939 qxestrchr(XSTRING_DATA(XVECTOR_DATA(registries)[i]), '?'))
940 {
941 invalid_argument
942 ("XLFD wildcards not allowed in charset-registries",
943 XVECTOR_DATA(registries)[i]);
944
945 }
946 }
947
948 set_charset_registries(charset, registries);
949
859 return Qnil; 950 return Qnil;
860 } 951 }
952
953 DEFUN ("charsets-in-region", Fcharsets_in_region, 2, 3, 0, /*
954 Return a list of the charsets in the region between START and END.
955 BUFFER defaults to the current buffer if omitted.
956 */
957 (start, end, buffer))
958 {
959 /* This function can GC */
960 struct buffer *buf = decode_buffer (buffer, 1);
961 Charbpos pos, stop; /* Limits of the region. */
962 Lisp_Object res = Qnil;
963 int charsets[NUM_LEADING_BYTES];
964 Ibyte lb;
965 struct gcpro gcpro1;
966
967 memset(charsets, 0, sizeof(charsets));
968 get_buffer_range_char (buf, start, end, &pos, &stop, 0);
969
970 GCPRO1 (res);
971 while (pos < stop)
972 {
973 lb = ichar_leading_byte(BUF_FETCH_CHAR (buf, pos));
974 if (0 == charsets[lb - MIN_LEADING_BYTE])
975 {
976 charsets[lb - MIN_LEADING_BYTE] = 1;
977 res = Fcons (XCHARSET_NAME(charset_by_leading_byte(lb)), res);
978 }
979 ++pos;
980 }
981 UNGCPRO;
982
983 return res;
984 }
861 985
862 986
863 /************************************************************************/ 987 /************************************************************************/
864 /* memory usage */ 988 /* memory usage */
865 /************************************************************************/ 989 /************************************************************************/
948 DEFSUBR (Fcharset_description); 1072 DEFSUBR (Fcharset_description);
949 DEFSUBR (Fcharset_dimension); 1073 DEFSUBR (Fcharset_dimension);
950 DEFSUBR (Fcharset_property); 1074 DEFSUBR (Fcharset_property);
951 DEFSUBR (Fcharset_id); 1075 DEFSUBR (Fcharset_id);
952 DEFSUBR (Fset_charset_ccl_program); 1076 DEFSUBR (Fset_charset_ccl_program);
953 DEFSUBR (Fset_charset_registry); 1077 DEFSUBR (Fset_charset_registries);
1078 DEFSUBR (Fcharsets_in_region);
954 1079
955 #ifdef MEMORY_USAGE_STATS 1080 #ifdef MEMORY_USAGE_STATS
956 DEFSUBR (Fcharset_memory_usage); 1081 DEFSUBR (Fcharset_memory_usage);
957 #endif 1082 #endif
958 1083
959 DEFSYMBOL (Qcharsetp); 1084 DEFSYMBOL (Qcharsetp);
960 DEFSYMBOL (Qregistry); 1085 DEFSYMBOL (Qregistries);
961 DEFSYMBOL (Qfinal); 1086 DEFSYMBOL (Qfinal);
962 DEFSYMBOL (Qgraphic); 1087 DEFSYMBOL (Qgraphic);
1088 DEFSYMBOL (Qregistry);
963 DEFSYMBOL (Qdirection); 1089 DEFSYMBOL (Qdirection);
964 DEFSYMBOL (Qreverse_direction_charset); 1090 DEFSYMBOL (Qreverse_direction_charset);
965 DEFSYMBOL (Qshort_name); 1091 DEFSYMBOL (Qshort_name);
966 DEFSYMBOL (Qlong_name); 1092 DEFSYMBOL (Qlong_name);
967 1093
968 DEFSYMBOL (Qfrom_unicode);
969 DEFSYMBOL (Qto_unicode); 1094 DEFSYMBOL (Qto_unicode);
970 1095
971 DEFSYMBOL (Ql2r); 1096 DEFSYMBOL (Ql2r);
972 DEFSYMBOL (Qr2l); 1097 DEFSYMBOL (Qr2l);
973 1098
977 DEFSYMBOL (Qlatin_iso8859_2); 1102 DEFSYMBOL (Qlatin_iso8859_2);
978 DEFSYMBOL (Qlatin_iso8859_3); 1103 DEFSYMBOL (Qlatin_iso8859_3);
979 DEFSYMBOL (Qlatin_iso8859_4); 1104 DEFSYMBOL (Qlatin_iso8859_4);
980 DEFSYMBOL (Qthai_tis620); 1105 DEFSYMBOL (Qthai_tis620);
981 DEFSYMBOL (Qgreek_iso8859_7); 1106 DEFSYMBOL (Qgreek_iso8859_7);
982 DEFSYMBOL (Qarabic_iso8859_6);
983 DEFSYMBOL (Qhebrew_iso8859_8); 1107 DEFSYMBOL (Qhebrew_iso8859_8);
984 DEFSYMBOL (Qkatakana_jisx0201); 1108 DEFSYMBOL (Qkatakana_jisx0201);
985 DEFSYMBOL (Qlatin_jisx0201); 1109 DEFSYMBOL (Qlatin_jisx0201);
986 DEFSYMBOL (Qcyrillic_iso8859_5); 1110 DEFSYMBOL (Qcyrillic_iso8859_5);
987 DEFSYMBOL (Qlatin_iso8859_9); 1111 DEFSYMBOL (Qlatin_iso8859_9);
1037 CHARSET_TYPE_94, 1, 0, 'B', 1161 CHARSET_TYPE_94, 1, 0, 'B',
1038 CHARSET_LEFT_TO_RIGHT, 1162 CHARSET_LEFT_TO_RIGHT,
1039 build_string ("ASCII"), 1163 build_string ("ASCII"),
1040 build_msg_string ("ASCII"), 1164 build_msg_string ("ASCII"),
1041 build_msg_string ("ASCII (ISO646 IRV)"), 1165 build_msg_string ("ASCII (ISO646 IRV)"),
1042 build_string ("\\(iso8859-[0-9]*\\|-ascii\\)"), 0); 1166 vector1(build_string("iso8859-1")), 0, 0);
1043 staticpro (&Vcharset_control_1); 1167 staticpro (&Vcharset_control_1);
1044 Vcharset_control_1 = 1168 Vcharset_control_1 =
1045 make_charset (LEADING_BYTE_CONTROL_1, Qcontrol_1, 2, 1169 make_charset (LEADING_BYTE_CONTROL_1, Qcontrol_1, 2,
1046 CHARSET_TYPE_94, 1, 1, 0, 1170 CHARSET_TYPE_94, 1, 1, 0,
1047 CHARSET_LEFT_TO_RIGHT, 1171 CHARSET_LEFT_TO_RIGHT,
1048 build_string ("C1"), 1172 build_string ("C1"),
1049 build_msg_string ("Control characters"), 1173 build_msg_string ("Control characters"),
1050 build_msg_string ("Control characters 128-191"), 1174 build_msg_string ("Control characters 128-191"),
1051 build_string (""), 0); 1175 vector1(build_string("iso8859-1")), 0, 0);
1052 staticpro (&Vcharset_latin_iso8859_1); 1176 staticpro (&Vcharset_latin_iso8859_1);
1053 Vcharset_latin_iso8859_1 = 1177 Vcharset_latin_iso8859_1 =
1054 make_charset (LEADING_BYTE_LATIN_ISO8859_1, Qlatin_iso8859_1, 2, 1178 make_charset (LEADING_BYTE_LATIN_ISO8859_1, Qlatin_iso8859_1, 2,
1055 CHARSET_TYPE_96, 1, 1, 'A', 1179 CHARSET_TYPE_96, 1, 1, 'A',
1056 CHARSET_LEFT_TO_RIGHT, 1180 CHARSET_LEFT_TO_RIGHT,
1057 build_string ("Latin-1"), 1181 build_string ("Latin-1"),
1058 build_msg_string ("ISO8859-1 (Latin-1)"), 1182 build_msg_string ("ISO8859-1 (Latin-1)"),
1059 build_msg_string ("ISO8859-1 (Latin-1)"), 1183 build_msg_string ("ISO8859-1 (Latin-1)"),
1060 build_string ("iso8859-1"), 0); 1184 vector1(build_string("iso8859-1")), 0, 0);
1061 staticpro (&Vcharset_latin_iso8859_2); 1185 staticpro (&Vcharset_latin_iso8859_2);
1062 Vcharset_latin_iso8859_2 = 1186 Vcharset_latin_iso8859_2 =
1063 make_charset (LEADING_BYTE_LATIN_ISO8859_2, Qlatin_iso8859_2, 2, 1187 make_charset (LEADING_BYTE_LATIN_ISO8859_2, Qlatin_iso8859_2, 2,
1064 CHARSET_TYPE_96, 1, 1, 'B', 1188 CHARSET_TYPE_96, 1, 1, 'B',
1065 CHARSET_LEFT_TO_RIGHT, 1189 CHARSET_LEFT_TO_RIGHT,
1066 build_string ("Latin-2"), 1190 build_string ("Latin-2"),
1067 build_msg_string ("ISO8859-2 (Latin-2)"), 1191 build_msg_string ("ISO8859-2 (Latin-2)"),
1068 build_msg_string ("ISO8859-2 (Latin-2)"), 1192 build_msg_string ("ISO8859-2 (Latin-2)"),
1069 build_string ("iso8859-2"), 0); 1193 vector1(build_string("iso8859-2")), 0, 0);
1070 staticpro (&Vcharset_latin_iso8859_3); 1194 staticpro (&Vcharset_latin_iso8859_3);
1071 Vcharset_latin_iso8859_3 = 1195 Vcharset_latin_iso8859_3 =
1072 make_charset (LEADING_BYTE_LATIN_ISO8859_3, Qlatin_iso8859_3, 2, 1196 make_charset (LEADING_BYTE_LATIN_ISO8859_3, Qlatin_iso8859_3, 2,
1073 CHARSET_TYPE_96, 1, 1, 'C', 1197 CHARSET_TYPE_96, 1, 1, 'C',
1074 CHARSET_LEFT_TO_RIGHT, 1198 CHARSET_LEFT_TO_RIGHT,
1075 build_string ("Latin-3"), 1199 build_string ("Latin-3"),
1076 build_msg_string ("ISO8859-3 (Latin-3)"), 1200 build_msg_string ("ISO8859-3 (Latin-3)"),
1077 build_msg_string ("ISO8859-3 (Latin-3)"), 1201 build_msg_string ("ISO8859-3 (Latin-3)"),
1078 build_string ("iso8859-3"), 0); 1202 vector1(build_string("iso8859-3")), 0, 0);
1079 staticpro (&Vcharset_latin_iso8859_4); 1203 staticpro (&Vcharset_latin_iso8859_4);
1080 Vcharset_latin_iso8859_4 = 1204 Vcharset_latin_iso8859_4 =
1081 make_charset (LEADING_BYTE_LATIN_ISO8859_4, Qlatin_iso8859_4, 2, 1205 make_charset (LEADING_BYTE_LATIN_ISO8859_4, Qlatin_iso8859_4, 2,
1082 CHARSET_TYPE_96, 1, 1, 'D', 1206 CHARSET_TYPE_96, 1, 1, 'D',
1083 CHARSET_LEFT_TO_RIGHT, 1207 CHARSET_LEFT_TO_RIGHT,
1084 build_string ("Latin-4"), 1208 build_string ("Latin-4"),
1085 build_msg_string ("ISO8859-4 (Latin-4)"), 1209 build_msg_string ("ISO8859-4 (Latin-4)"),
1086 build_msg_string ("ISO8859-4 (Latin-4)"), 1210 build_msg_string ("ISO8859-4 (Latin-4)"),
1087 build_string ("iso8859-4"), 0); 1211 vector1(build_string("iso8859-4")), 0, 0);
1088 staticpro (&Vcharset_thai_tis620); 1212 staticpro (&Vcharset_thai_tis620);
1089 Vcharset_thai_tis620 = 1213 Vcharset_thai_tis620 =
1090 make_charset (LEADING_BYTE_THAI_TIS620, Qthai_tis620, 2, 1214 make_charset (LEADING_BYTE_THAI_TIS620, Qthai_tis620, 2,
1091 CHARSET_TYPE_96, 1, 1, 'T', 1215 CHARSET_TYPE_96, 1, 1, 'T',
1092 CHARSET_LEFT_TO_RIGHT, 1216 CHARSET_LEFT_TO_RIGHT,
1093 build_string ("TIS620"), 1217 build_string ("TIS620"),
1094 build_msg_string ("TIS620 (Thai)"), 1218 build_msg_string ("TIS620 (Thai)"),
1095 build_msg_string ("TIS620.2529 (Thai)"), 1219 build_msg_string ("TIS620.2529 (Thai)"),
1096 build_string ("tis620"),0); 1220 vector1(build_string("tis620.2529-1")), 0, 0);
1097 staticpro (&Vcharset_greek_iso8859_7); 1221 staticpro (&Vcharset_greek_iso8859_7);
1098 Vcharset_greek_iso8859_7 = 1222 Vcharset_greek_iso8859_7 =
1099 make_charset (LEADING_BYTE_GREEK_ISO8859_7, Qgreek_iso8859_7, 2, 1223 make_charset (LEADING_BYTE_GREEK_ISO8859_7, Qgreek_iso8859_7, 2,
1100 CHARSET_TYPE_96, 1, 1, 'F', 1224 CHARSET_TYPE_96, 1, 1, 'F',
1101 CHARSET_LEFT_TO_RIGHT, 1225 CHARSET_LEFT_TO_RIGHT,
1102 build_string ("ISO8859-7"), 1226 build_string ("ISO8859-7"),
1103 build_msg_string ("ISO8859-7 (Greek)"), 1227 build_msg_string ("ISO8859-7 (Greek)"),
1104 build_msg_string ("ISO8859-7 (Greek)"), 1228 build_msg_string ("ISO8859-7 (Greek)"),
1105 build_string ("iso8859-7"), 0); 1229 vector1(build_string("iso8859-7")), 0, 0);
1106 staticpro (&Vcharset_arabic_iso8859_6);
1107 Vcharset_arabic_iso8859_6 =
1108 make_charset (LEADING_BYTE_ARABIC_ISO8859_6, Qarabic_iso8859_6, 2,
1109 CHARSET_TYPE_96, 1, 1, 'G',
1110 CHARSET_RIGHT_TO_LEFT,
1111 build_string ("ISO8859-6"),
1112 build_msg_string ("ISO8859-6 (Arabic)"),
1113 build_msg_string ("ISO8859-6 (Arabic)"),
1114 build_string ("iso8859-6"), 0);
1115 staticpro (&Vcharset_hebrew_iso8859_8); 1230 staticpro (&Vcharset_hebrew_iso8859_8);
1116 Vcharset_hebrew_iso8859_8 = 1231 Vcharset_hebrew_iso8859_8 =
1117 make_charset (LEADING_BYTE_HEBREW_ISO8859_8, Qhebrew_iso8859_8, 2, 1232 make_charset (LEADING_BYTE_HEBREW_ISO8859_8, Qhebrew_iso8859_8, 2,
1118 CHARSET_TYPE_96, 1, 1, 'H', 1233 CHARSET_TYPE_96, 1, 1, 'H',
1119 CHARSET_RIGHT_TO_LEFT, 1234 CHARSET_RIGHT_TO_LEFT,
1120 build_string ("ISO8859-8"), 1235 build_string ("ISO8859-8"),
1121 build_msg_string ("ISO8859-8 (Hebrew)"), 1236 build_msg_string ("ISO8859-8 (Hebrew)"),
1122 build_msg_string ("ISO8859-8 (Hebrew)"), 1237 build_msg_string ("ISO8859-8 (Hebrew)"),
1123 build_string ("iso8859-8"), 0); 1238 vector1(build_string ("iso8859-8")), 0, 0);
1124 staticpro (&Vcharset_katakana_jisx0201); 1239 staticpro (&Vcharset_katakana_jisx0201);
1125 Vcharset_katakana_jisx0201 = 1240 Vcharset_katakana_jisx0201 =
1126 make_charset (LEADING_BYTE_KATAKANA_JISX0201, Qkatakana_jisx0201, 2, 1241 make_charset (LEADING_BYTE_KATAKANA_JISX0201, Qkatakana_jisx0201, 2,
1127 CHARSET_TYPE_94, 1, 1, 'I', 1242 CHARSET_TYPE_94, 1, 1, 'I',
1128 CHARSET_LEFT_TO_RIGHT, 1243 CHARSET_LEFT_TO_RIGHT,
1129 build_string ("JISX0201 Kana"), 1244 build_string ("JISX0201 Kana"),
1130 build_msg_string ("JISX0201.1976 (Japanese Kana)"), 1245 build_msg_string ("JISX0201.1976 (Japanese Kana)"),
1131 build_msg_string ("JISX0201.1976 Japanese Kana"), 1246 build_msg_string ("JISX0201.1976 Japanese Kana"),
1132 build_string ("jisx0201.1976"), 0); 1247 vector1(build_string ("jisx0201.1976-0")), 0, 0);
1133 staticpro (&Vcharset_latin_jisx0201); 1248 staticpro (&Vcharset_latin_jisx0201);
1134 Vcharset_latin_jisx0201 = 1249 Vcharset_latin_jisx0201 =
1135 make_charset (LEADING_BYTE_LATIN_JISX0201, Qlatin_jisx0201, 2, 1250 make_charset (LEADING_BYTE_LATIN_JISX0201, Qlatin_jisx0201, 2,
1136 CHARSET_TYPE_94, 1, 0, 'J', 1251 CHARSET_TYPE_94, 1, 0, 'J',
1137 CHARSET_LEFT_TO_RIGHT, 1252 CHARSET_LEFT_TO_RIGHT,
1138 build_string ("JISX0201 Roman"), 1253 build_string ("JISX0201 Roman"),
1139 build_msg_string ("JISX0201.1976 (Japanese Roman)"), 1254 build_msg_string ("JISX0201.1976 (Japanese Roman)"),
1140 build_msg_string ("JISX0201.1976 Japanese Roman"), 1255 build_msg_string ("JISX0201.1976 Japanese Roman"),
1141 build_string ("jisx0201.1976"), 0); 1256 vector1(build_string ("jisx0201.1976-0")), 0, 0);
1142 staticpro (&Vcharset_cyrillic_iso8859_5); 1257 staticpro (&Vcharset_cyrillic_iso8859_5);
1143 Vcharset_cyrillic_iso8859_5 = 1258 Vcharset_cyrillic_iso8859_5 =
1144 make_charset (LEADING_BYTE_CYRILLIC_ISO8859_5, Qcyrillic_iso8859_5, 2, 1259 make_charset (LEADING_BYTE_CYRILLIC_ISO8859_5, Qcyrillic_iso8859_5, 2,
1145 CHARSET_TYPE_96, 1, 1, 'L', 1260 CHARSET_TYPE_96, 1, 1, 'L',
1146 CHARSET_LEFT_TO_RIGHT, 1261 CHARSET_LEFT_TO_RIGHT,
1147 build_string ("ISO8859-5"), 1262 build_string ("ISO8859-5"),
1148 build_msg_string ("ISO8859-5 (Cyrillic)"), 1263 build_msg_string ("ISO8859-5 (Cyrillic)"),
1149 build_msg_string ("ISO8859-5 (Cyrillic)"), 1264 build_msg_string ("ISO8859-5 (Cyrillic)"),
1150 build_string ("iso8859-5"), 0); 1265 vector1(build_string ("iso8859-5")), 0, 0);
1151 staticpro (&Vcharset_latin_iso8859_9); 1266 staticpro (&Vcharset_latin_iso8859_9);
1152 Vcharset_latin_iso8859_9 = 1267 Vcharset_latin_iso8859_9 =
1153 make_charset (LEADING_BYTE_LATIN_ISO8859_9, Qlatin_iso8859_9, 2, 1268 make_charset (LEADING_BYTE_LATIN_ISO8859_9, Qlatin_iso8859_9, 2,
1154 CHARSET_TYPE_96, 1, 1, 'M', 1269 CHARSET_TYPE_96, 1, 1, 'M',
1155 CHARSET_LEFT_TO_RIGHT, 1270 CHARSET_LEFT_TO_RIGHT,
1156 build_string ("Latin-5"), 1271 build_string ("Latin-5"),
1157 build_msg_string ("ISO8859-9 (Latin-5)"), 1272 build_msg_string ("ISO8859-9 (Latin-5)"),
1158 build_msg_string ("ISO8859-9 (Latin-5)"), 1273 build_msg_string ("ISO8859-9 (Latin-5)"),
1159 build_string ("iso8859-9"), 0); 1274 vector1(build_string ("iso8859-9")), 0, 0);
1160 staticpro (&Vcharset_latin_iso8859_15); 1275 staticpro (&Vcharset_latin_iso8859_15);
1161 Vcharset_latin_iso8859_15 = 1276 Vcharset_latin_iso8859_15 =
1162 make_charset (LEADING_BYTE_LATIN_ISO8859_15, Qlatin_iso8859_15, 2, 1277 make_charset (LEADING_BYTE_LATIN_ISO8859_15, Qlatin_iso8859_15, 2,
1163 CHARSET_TYPE_96, 1, 1, 'b', 1278 CHARSET_TYPE_96, 1, 1, 'b',
1164 CHARSET_LEFT_TO_RIGHT, 1279 CHARSET_LEFT_TO_RIGHT,
1165 build_string ("Latin-9"), 1280 build_string ("Latin-9"),
1166 build_msg_string ("ISO8859-15 (Latin-9)"), 1281 build_msg_string ("ISO8859-15 (Latin-9)"),
1167 build_msg_string ("ISO8859-15 (Latin-9)"), 1282 build_msg_string ("ISO8859-15 (Latin-9)"),
1168 build_string ("iso8859-15"), 0); 1283 vector1(build_string ("iso8859-15")), 0, 0);
1169 staticpro (&Vcharset_japanese_jisx0208_1978); 1284 staticpro (&Vcharset_japanese_jisx0208_1978);
1170 Vcharset_japanese_jisx0208_1978 = 1285 Vcharset_japanese_jisx0208_1978 =
1171 make_charset (LEADING_BYTE_JAPANESE_JISX0208_1978, Qjapanese_jisx0208_1978, 3, 1286 make_charset (LEADING_BYTE_JAPANESE_JISX0208_1978, Qjapanese_jisx0208_1978, 3,
1172 CHARSET_TYPE_94X94, 2, 0, '@', 1287 CHARSET_TYPE_94X94, 2, 0, '@',
1173 CHARSET_LEFT_TO_RIGHT, 1288 CHARSET_LEFT_TO_RIGHT,
1174 build_string ("JISX0208.1978"), 1289 build_string ("JISX0208.1978"),
1175 build_msg_string ("JISX0208.1978 (Japanese)"), 1290 build_msg_string ("JISX0208.1978 (Japanese)"),
1176 build_msg_string 1291 build_msg_string
1177 ("JISX0208.1978 Japanese Kanji (so called \"old JIS\")"), 1292 ("JISX0208.1978 Japanese Kanji (so called \"old JIS\")"),
1178 build_string ("\\(jisx0208\\|jisc6226\\)\\.1978"), 0); 1293 vector2(build_string("jisx0208.1978-0"),
1294 build_string("jisc6226.1978-0")), 0, 0);
1179 staticpro (&Vcharset_chinese_gb2312); 1295 staticpro (&Vcharset_chinese_gb2312);
1180 Vcharset_chinese_gb2312 = 1296 Vcharset_chinese_gb2312 =
1181 make_charset (LEADING_BYTE_CHINESE_GB2312, Qchinese_gb2312, 3, 1297 make_charset (LEADING_BYTE_CHINESE_GB2312, Qchinese_gb2312, 3,
1182 CHARSET_TYPE_94X94, 2, 0, 'A', 1298 CHARSET_TYPE_94X94, 2, 0, 'A',
1183 CHARSET_LEFT_TO_RIGHT, 1299 CHARSET_LEFT_TO_RIGHT,
1184 build_string ("GB2312"), 1300 build_string ("GB2312"),
1185 build_msg_string ("GB2312)"), 1301 build_msg_string ("GB2312)"),
1186 build_msg_string ("GB2312 Chinese simplified"), 1302 build_msg_string ("GB2312 Chinese simplified"),
1187 build_string ("gb2312"), 0); 1303 vector2(build_string("gb2312.1980-0"),
1304 build_string("gb2312.80&gb8565.88-0")), 0, 0);
1188 staticpro (&Vcharset_japanese_jisx0208); 1305 staticpro (&Vcharset_japanese_jisx0208);
1189 Vcharset_japanese_jisx0208 = 1306 Vcharset_japanese_jisx0208 =
1190 make_charset (LEADING_BYTE_JAPANESE_JISX0208, Qjapanese_jisx0208, 3, 1307 make_charset (LEADING_BYTE_JAPANESE_JISX0208, Qjapanese_jisx0208, 3,
1191 CHARSET_TYPE_94X94, 2, 0, 'B', 1308 CHARSET_TYPE_94X94, 2, 0, 'B',
1192 CHARSET_LEFT_TO_RIGHT, 1309 CHARSET_LEFT_TO_RIGHT,
1193 build_string ("JISX0208"), 1310 build_string ("JISX0208"),
1194 build_msg_string ("JISX0208.1983/1990 (Japanese)"), 1311 build_msg_string ("JISX0208.1983/1990 (Japanese)"),
1195 build_msg_string ("JISX0208.1983/1990 Japanese Kanji"), 1312 build_msg_string ("JISX0208.1983/1990 Japanese Kanji"),
1196 build_string ("jisx0208.19\\(83\\|90\\)"), 0); 1313 vector2(build_string("jisx0208.1983-0"),
1314 build_string("jisx0208.1990-0")), 0, 0);
1197 staticpro (&Vcharset_korean_ksc5601); 1315 staticpro (&Vcharset_korean_ksc5601);
1198 Vcharset_korean_ksc5601 = 1316 Vcharset_korean_ksc5601 =
1199 make_charset (LEADING_BYTE_KOREAN_KSC5601, Qkorean_ksc5601, 3, 1317 make_charset (LEADING_BYTE_KOREAN_KSC5601, Qkorean_ksc5601, 3,
1200 CHARSET_TYPE_94X94, 2, 0, 'C', 1318 CHARSET_TYPE_94X94, 2, 0, 'C',
1201 CHARSET_LEFT_TO_RIGHT, 1319 CHARSET_LEFT_TO_RIGHT,
1202 build_string ("KSC5601"), 1320 build_string ("KSC5601"),
1203 build_msg_string ("KSC5601 (Korean"), 1321 build_msg_string ("KSC5601 (Korean"),
1204 build_msg_string ("KSC5601 Korean Hangul and Hanja"), 1322 build_msg_string ("KSC5601 Korean Hangul and Hanja"),
1205 build_string ("ksc5601"), 0); 1323 vector1(build_string("ksc5601.1987-0")), 0, 0);
1206 staticpro (&Vcharset_japanese_jisx0212); 1324 staticpro (&Vcharset_japanese_jisx0212);
1207 Vcharset_japanese_jisx0212 = 1325 Vcharset_japanese_jisx0212 =
1208 make_charset (LEADING_BYTE_JAPANESE_JISX0212, Qjapanese_jisx0212, 3, 1326 make_charset (LEADING_BYTE_JAPANESE_JISX0212, Qjapanese_jisx0212, 3,
1209 CHARSET_TYPE_94X94, 2, 0, 'D', 1327 CHARSET_TYPE_94X94, 2, 0, 'D',
1210 CHARSET_LEFT_TO_RIGHT, 1328 CHARSET_LEFT_TO_RIGHT,
1211 build_string ("JISX0212"), 1329 build_string ("JISX0212"),
1212 build_msg_string ("JISX0212 (Japanese)"), 1330 build_msg_string ("JISX0212 (Japanese)"),
1213 build_msg_string ("JISX0212 Japanese Supplement"), 1331 build_msg_string ("JISX0212 Japanese Supplement"),
1214 build_string ("jisx0212"), 0); 1332 vector1(build_string("jisx0212.1990-0")), 0, 0);
1215 1333
1216 #define CHINESE_CNS_PLANE_RE(n) "cns11643[.-]\\(.*[.-]\\)?" n "$" 1334 #define CHINESE_CNS_PLANE(n) "cns11643.1992-" n
1217 staticpro (&Vcharset_chinese_cns11643_1); 1335 staticpro (&Vcharset_chinese_cns11643_1);
1218 Vcharset_chinese_cns11643_1 = 1336 Vcharset_chinese_cns11643_1 =
1219 make_charset (LEADING_BYTE_CHINESE_CNS11643_1, Qchinese_cns11643_1, 3, 1337 make_charset (LEADING_BYTE_CHINESE_CNS11643_1, Qchinese_cns11643_1, 3,
1220 CHARSET_TYPE_94X94, 2, 0, 'G', 1338 CHARSET_TYPE_94X94, 2, 0, 'G',
1221 CHARSET_LEFT_TO_RIGHT, 1339 CHARSET_LEFT_TO_RIGHT,
1222 build_string ("CNS11643-1"), 1340 build_string ("CNS11643-1"),
1223 build_msg_string ("CNS11643-1 (Chinese traditional)"), 1341 build_msg_string ("CNS11643-1 (Chinese traditional)"),
1224 build_msg_string 1342 build_msg_string
1225 ("CNS 11643 Plane 1 Chinese traditional"), 1343 ("CNS 11643 Plane 1 Chinese traditional"),
1226 build_string (CHINESE_CNS_PLANE_RE("1")), 0); 1344 vector1(build_string (CHINESE_CNS_PLANE("1"))), 0, 0);
1227 staticpro (&Vcharset_chinese_cns11643_2); 1345 staticpro (&Vcharset_chinese_cns11643_2);
1228 Vcharset_chinese_cns11643_2 = 1346 Vcharset_chinese_cns11643_2 =
1229 make_charset (LEADING_BYTE_CHINESE_CNS11643_2, Qchinese_cns11643_2, 3, 1347 make_charset (LEADING_BYTE_CHINESE_CNS11643_2, Qchinese_cns11643_2, 3,
1230 CHARSET_TYPE_94X94, 2, 0, 'H', 1348 CHARSET_TYPE_94X94, 2, 0, 'H',
1231 CHARSET_LEFT_TO_RIGHT, 1349 CHARSET_LEFT_TO_RIGHT,
1232 build_string ("CNS11643-2"), 1350 build_string ("CNS11643-2"),
1233 build_msg_string ("CNS11643-2 (Chinese traditional)"), 1351 build_msg_string ("CNS11643-2 (Chinese traditional)"),
1234 build_msg_string 1352 build_msg_string
1235 ("CNS 11643 Plane 2 Chinese traditional"), 1353 ("CNS 11643 Plane 2 Chinese traditional"),
1236 build_string (CHINESE_CNS_PLANE_RE("2")), 0); 1354 vector1(build_string (CHINESE_CNS_PLANE("2"))), 0, 0);
1237 staticpro (&Vcharset_chinese_big5_1); 1355 staticpro (&Vcharset_chinese_big5_1);
1238 Vcharset_chinese_big5_1 = 1356 Vcharset_chinese_big5_1 =
1239 make_charset (LEADING_BYTE_CHINESE_BIG5_1, Qchinese_big5_1, 3, 1357 make_charset (LEADING_BYTE_CHINESE_BIG5_1, Qchinese_big5_1, 3,
1240 CHARSET_TYPE_94X94, 2, 0, '0', 1358 CHARSET_TYPE_94X94, 2, 0, '0',
1241 CHARSET_LEFT_TO_RIGHT, 1359 CHARSET_LEFT_TO_RIGHT,
1242 build_string ("Big5"), 1360 build_string ("Big5"),
1243 build_msg_string ("Big5 (Level-1)"), 1361 build_msg_string ("Big5 (Level-1)"),
1244 build_msg_string 1362 build_msg_string
1245 ("Big5 Level-1 Chinese traditional"), 1363 ("Big5 Level-1 Chinese traditional"),
1246 build_string ("big5"), 0); 1364 vector1(build_string ("big5.eten-0")), 0, 0);
1247 staticpro (&Vcharset_chinese_big5_2); 1365 staticpro (&Vcharset_chinese_big5_2);
1248 Vcharset_chinese_big5_2 = 1366 Vcharset_chinese_big5_2 =
1249 make_charset (LEADING_BYTE_CHINESE_BIG5_2, Qchinese_big5_2, 3, 1367 make_charset (LEADING_BYTE_CHINESE_BIG5_2, Qchinese_big5_2, 3,
1250 CHARSET_TYPE_94X94, 2, 0, '1', 1368 CHARSET_TYPE_94X94, 2, 0, '1',
1251 CHARSET_LEFT_TO_RIGHT, 1369 CHARSET_LEFT_TO_RIGHT,
1252 build_string ("Big5"), 1370 build_string ("Big5"),
1253 build_msg_string ("Big5 (Level-2)"), 1371 build_msg_string ("Big5 (Level-2)"),
1254 build_msg_string 1372 build_msg_string
1255 ("Big5 Level-2 Chinese traditional"), 1373 ("Big5 Level-2 Chinese traditional"),
1256 build_string ("big5"), 0); 1374 vector1(build_string ("big5.eten-0")), 0, 0);
1257 1375
1258 1376
1259 #ifdef ENABLE_COMPOSITE_CHARS 1377 #ifdef ENABLE_COMPOSITE_CHARS
1260 /* #### For simplicity, we put composite chars into a 96x96 charset. 1378 /* #### For simplicity, we put composite chars into a 96x96 charset.
1261 This is going to lead to problems because you can run out of 1379 This is going to lead to problems because you can run out of
1266 CHARSET_TYPE_96X96, 2, 0, 0, 1384 CHARSET_TYPE_96X96, 2, 0, 0,
1267 CHARSET_LEFT_TO_RIGHT, 1385 CHARSET_LEFT_TO_RIGHT,
1268 build_string ("Composite"), 1386 build_string ("Composite"),
1269 build_msg_string ("Composite characters"), 1387 build_msg_string ("Composite characters"),
1270 build_msg_string ("Composite characters"), 1388 build_msg_string ("Composite characters"),
1271 build_string (""), 0); 1389 vector1(build_string ("")), 0, 0);
1272 #else 1390 #else
1273 /* We create a hack so that we have a way of storing ESC 0 and ESC 1 1391 /* We create a hack so that we have a way of storing ESC 0 and ESC 1
1274 sequences as "characters", so that they will be output correctly. */ 1392 sequences as "characters", so that they will be output correctly. */
1275 staticpro (&Vcharset_composite); 1393 staticpro (&Vcharset_composite);
1276 Vcharset_composite = 1394 Vcharset_composite =
1278 CHARSET_TYPE_96, 1, 1, '|', 1396 CHARSET_TYPE_96, 1, 1, '|',
1279 CHARSET_LEFT_TO_RIGHT, 1397 CHARSET_LEFT_TO_RIGHT,
1280 build_string ("Composite hack"), 1398 build_string ("Composite hack"),
1281 build_msg_string ("Composite characters hack"), 1399 build_msg_string ("Composite characters hack"),
1282 build_msg_string ("Composite characters hack"), 1400 build_msg_string ("Composite characters hack"),
1283 build_string (""), 0); 1401 vector1(build_string ("")), 0, 0);
1284 #endif /* ENABLE_COMPOSITE_CHARS */ 1402 #endif /* ENABLE_COMPOSITE_CHARS */
1285 } 1403 }