annotate src/mule-charset.c @ 5178:97eb4942aec8

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