annotate src/mule-charset.c @ 578:190b164ddcac

[xemacs-hg @ 2001-05-25 11:26:50 by ben] device-msw.c, eldap.c, emodules.c, hpplay.c, process-unix.c, sound.h, tooltalk.c, win32.c: Revert Martin's attempted compile-warnings fix. It does fix the warnings, but not the right way. We are trying to eliminate the raw use of `char' and `unsigned char' absolutely everywhere. There is never an occasion to reintroduce these. buffer.h: Instead, we fix these macros so they don't care about the type of their lvalues. We already do this for the non-C-string equivalents of these, and it's correct because it should be OK to pass in an SBufbyte *, for example. In any case, we do not need any type-correctness checking here -- errors will be caught for sure as soon as we remove the -Wno-sign-compare switch. mule-charset.c: Use invalid_argument, not generic signal_error (Qerror, ). alloc.c, chartab.c, console-gtk.c, console-msw.c, console-stream.c, console-stream.h, console-tty.c, console-tty.h, console-x.c, console.c, console.h, device-x.c, device.c, elhash.c, eval.c, faces.c, faces.h, fns.c, glyphs.c, glyphs.h, gui.c, gui.h, lisp.h, lread.c, nt.c, objects-gtk.c, objects-gtk.h, objects-msw.c, objects-tty.c, objects-x.c, objects.c, process-unix.c, rangetab.c, search.c, specifier.c, toolbar.c, window.c, window.h: Rename Error_behavior to Error_Behavior, to be consistent with general naming practices (Lisp_Object, Char_Binary, etc.).
author ben
date Fri, 25 May 2001 11:27:01 +0000
parents e9162e1ea200
children b39c14581166
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.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 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
9 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 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
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 /* Synched up with: FSF 20.3. Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 /* Rewritten by Ben Wing <ben@xemacs.org>. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 #include "buffer.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 #include "chartab.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 #include "elhash.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #include "lstream.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"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include "mule-ccl.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 /* The various pre-defined charsets. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 Lisp_Object Vcharset_ascii;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 Lisp_Object Vcharset_control_1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 Lisp_Object Vcharset_latin_iso8859_1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 Lisp_Object Vcharset_latin_iso8859_2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 Lisp_Object Vcharset_latin_iso8859_3;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 Lisp_Object Vcharset_latin_iso8859_4;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 Lisp_Object Vcharset_thai_tis620;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 Lisp_Object Vcharset_greek_iso8859_7;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 Lisp_Object Vcharset_arabic_iso8859_6;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 Lisp_Object Vcharset_hebrew_iso8859_8;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 Lisp_Object Vcharset_katakana_jisx0201;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 Lisp_Object Vcharset_latin_jisx0201;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 Lisp_Object Vcharset_cyrillic_iso8859_5;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 Lisp_Object Vcharset_latin_iso8859_9;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 Lisp_Object Vcharset_japanese_jisx0208_1978;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 Lisp_Object Vcharset_chinese_gb2312;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 Lisp_Object Vcharset_japanese_jisx0208;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 Lisp_Object Vcharset_korean_ksc5601;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 Lisp_Object Vcharset_japanese_jisx0212;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 Lisp_Object Vcharset_chinese_cns11643_1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 Lisp_Object Vcharset_chinese_cns11643_2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 Lisp_Object Vcharset_chinese_big5_1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 Lisp_Object Vcharset_chinese_big5_2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 #ifdef ENABLE_COMPOSITE_CHARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 Lisp_Object Vcharset_composite;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 /* Hash tables for composite chars. One maps string representing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 composed chars to their equivalent chars; one goes the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 other way. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 Lisp_Object Vcomposite_char_char2string_hash_table;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 Lisp_Object Vcomposite_char_string2char_hash_table;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 static int composite_char_row_next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 static int composite_char_col_next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 #endif /* ENABLE_COMPOSITE_CHARS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 struct charset_lookup *chlook;
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 static const struct lrecord_description charset_lookup_description_1[] = {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
80 { XD_LISP_OBJECT_ARRAY, offsetof (struct charset_lookup, charset_by_leading_byte), 128+4*128*2 },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 { XD_END }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 static const struct struct_description charset_lookup_description = {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
85 sizeof (struct charset_lookup),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 charset_lookup_description_1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 /* Table of number of bytes in the string representation of a character
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 indexed by the first byte of that representation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 rep_bytes_by_first_byte(c) is more efficient than the equivalent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 canonical computation:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
95 XCHARSET_REP_BYTES (CHARSET_BY_LEADING_BYTE (c)) */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
97 const Bytecount rep_bytes_by_first_byte[0xA0] =
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 { /* 0x00 - 0x7f are for straight ASCII */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 /* 0x80 - 0x8f are for Dimension-1 official charsets */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 /* 0x90 - 0x9d are for Dimension-2 official charsets */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 /* 0x9e is for Dimension-1 private charsets */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 /* 0x9f is for Dimension-2 private charsets */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 };
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 Qcharsetp;
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 /* Qdoc_string, Qdimension, Qchars defined in general.c */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 Lisp_Object Qregistry, Qfinal, Qgraphic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 Lisp_Object Qdirection;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 Lisp_Object Qreverse_direction_charset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 Lisp_Object Qleading_byte;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 Lisp_Object Qshort_name, Qlong_name;
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 Lisp_Object Qascii,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 Qcontrol_1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 Qlatin_iso8859_1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 Qlatin_iso8859_2,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 Qlatin_iso8859_3,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 Qlatin_iso8859_4,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 Qthai_tis620,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 Qgreek_iso8859_7,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 Qarabic_iso8859_6,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 Qhebrew_iso8859_8,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 Qkatakana_jisx0201,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 Qlatin_jisx0201,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 Qcyrillic_iso8859_5,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 Qlatin_iso8859_9,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 Qjapanese_jisx0208_1978,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 Qchinese_gb2312,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 Qjapanese_jisx0208,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 Qkorean_ksc5601,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 Qjapanese_jisx0212,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 Qchinese_cns11643_1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 Qchinese_cns11643_2,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 Qchinese_big5_1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 Qchinese_big5_2,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 Qcomposite;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 Lisp_Object Ql2r, Qr2l;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 Lisp_Object Vcharset_hash_table;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 /* Composite characters are characters constructed by overstriking two
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 or more regular characters.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 1) The old Mule implementation involves storing composite characters
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 in a buffer as a tag followed by all of the actual characters
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 used to make up the composite character. I think this is a bad
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 idea; it greatly complicates code that wants to handle strings
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 one character at a time because it has to deal with the possibility
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 of great big ungainly characters. It's much more reasonable to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 simply store an index into a table of composite characters.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 2) The current implementation only allows for 16,384 separate
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 composite characters over the lifetime of the XEmacs process.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 This could become a potential problem if the user
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 edited lots of different files that use composite characters.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 Due to FSF bogosity, increasing the number of allowable
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 composite characters under Mule would decrease the number
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 of possible faces that can exist. Mule already has shrunk
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 this to 2048, and further shrinkage would become uncomfortable.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 No such problems exist in XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 Composite characters could be represented as 0x80 C1 C2 C3,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 where each C[1-3] is in the range 0xA0 - 0xFF. This allows
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 for slightly under 2^20 (one million) composite characters
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 over the XEmacs process lifetime, and you only need to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 increase the size of a Mule character from 19 to 21 bits.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 Or you could use 0x80 C1 C2 C3 C4, allowing for about
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 85 million (slightly over 2^26) composite characters. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 /* Basic Emchar functions */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 /* Convert a non-ASCII Mule character C into a one-character Mule-encoded
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 string in STR. Returns the number of bytes stored.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 Do not call this directly. Use the macro set_charptr_emchar() instead.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 Bytecount
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 non_ascii_set_charptr_emchar (Bufbyte *str, Emchar c)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 Bufbyte *p;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 Bufbyte lb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 int c1, c2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 Lisp_Object charset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 p = str;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 BREAKUP_CHAR (c, charset, c1, c2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 lb = CHAR_LEADING_BYTE (c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 if (LEADING_BYTE_PRIVATE_P (lb))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 *p++ = PRIVATE_LEADING_BYTE_PREFIX (lb);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 *p++ = lb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 if (EQ (charset, Vcharset_control_1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 c1 += 0x20;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 *p++ = c1 | 0x80;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 if (c2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 *p++ = c2 | 0x80;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 return (p - str);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 /* Return the first character from a Mule-encoded string in STR,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 assuming it's non-ASCII. Do not call this directly.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 Use the macro charptr_emchar() instead. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 Emchar
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
220 non_ascii_charptr_emchar (const Bufbyte *str)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 Bufbyte i0 = *str, i1, i2 = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 Lisp_Object charset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 if (i0 == LEADING_BYTE_CONTROL_1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 return (Emchar) (*++str - 0x20);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 if (LEADING_BYTE_PREFIX_P (i0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 i0 = *++str;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 i1 = *++str & 0x7F;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 charset = CHARSET_BY_LEADING_BYTE (i0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 if (XCHARSET_DIMENSION (charset) == 2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 i2 = *++str & 0x7F;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 return MAKE_CHAR (charset, i1, i2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 /* Return whether CH is a valid Emchar, assuming it's non-ASCII.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 Do not call this directly. Use the macro valid_char_p() instead. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 non_ascii_valid_char_p (Emchar ch)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 int f1, f2, f3;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 /* Must have only lowest 19 bits set */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 if (ch & ~0x7FFFF)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 f1 = CHAR_FIELD1 (ch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 f2 = CHAR_FIELD2 (ch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 f3 = CHAR_FIELD3 (ch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 if (f1 == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 Lisp_Object charset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 if (f2 < MIN_CHAR_FIELD2_OFFICIAL ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 (f2 > MAX_CHAR_FIELD2_OFFICIAL && f2 < MIN_CHAR_FIELD2_PRIVATE) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 f2 > MAX_CHAR_FIELD2_PRIVATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 if (f3 < 0x20)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 if (f3 != 0x20 && f3 != 0x7F && !(f2 >= MIN_CHAR_FIELD2_PRIVATE &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 f2 <= MAX_CHAR_FIELD2_PRIVATE))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 NOTE: This takes advantage of the fact that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 FIELD2_TO_OFFICIAL_LEADING_BYTE and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 FIELD2_TO_PRIVATE_LEADING_BYTE are the same.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 charset = CHARSET_BY_LEADING_BYTE (f2 + FIELD2_TO_OFFICIAL_LEADING_BYTE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 if (EQ (charset, Qnil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 return (XCHARSET_CHARS (charset) == 96);
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 else
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 Lisp_Object charset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 if (f1 < MIN_CHAR_FIELD1_OFFICIAL ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 (f1 > MAX_CHAR_FIELD1_OFFICIAL && f1 < MIN_CHAR_FIELD1_PRIVATE) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 f1 > MAX_CHAR_FIELD1_PRIVATE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 if (f2 < 0x20 || f3 < 0x20)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 #ifdef ENABLE_COMPOSITE_CHARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 if (f1 + FIELD1_TO_OFFICIAL_LEADING_BYTE == LEADING_BYTE_COMPOSITE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 if (UNBOUNDP (Fgethash (make_int (ch),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 Vcomposite_char_char2string_hash_table,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 Qunbound)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 #endif /* ENABLE_COMPOSITE_CHARS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 if (f2 != 0x20 && f2 != 0x7F && f3 != 0x20 && f3 != 0x7F
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 && !(f1 >= MIN_CHAR_FIELD1_PRIVATE && f1 <= MAX_CHAR_FIELD1_PRIVATE))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 if (f1 <= MAX_CHAR_FIELD1_OFFICIAL)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 charset =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 CHARSET_BY_LEADING_BYTE (f1 + FIELD1_TO_OFFICIAL_LEADING_BYTE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 charset =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 CHARSET_BY_LEADING_BYTE (f1 + FIELD1_TO_PRIVATE_LEADING_BYTE);
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 if (EQ (charset, Qnil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 return (XCHARSET_CHARS (charset) == 96);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 /* Basic string functions */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
325 /* Copy the character pointed to by SRC into DST. Do not call this
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
326 directly. Use the macro charptr_copy_char() instead.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
327 Return the number of bytes copied. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 Bytecount
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
330 non_ascii_charptr_copy_char (const Bufbyte *src, Bufbyte *dst)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
332 unsigned int bytes = REP_BYTES_BY_FIRST_BYTE (*src);
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
333 unsigned int i;
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
334 for (i = bytes; i; i--, dst++, src++)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
335 *dst = *src;
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
336 return bytes;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 /* streams of Emchars */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 /************************************************************************/
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 /* Treat a stream as a stream of Emchar's rather than a stream of bytes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 The functions below are not meant to be called directly; use
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 the macros in insdel.h. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 Emchar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 Lstream_get_emchar_1 (Lstream *stream, int ch)
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 Bufbyte str[MAX_EMCHAR_LEN];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 Bufbyte *strptr = str;
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
353 unsigned int bytes;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 str[0] = (Bufbyte) ch;
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
356
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
357 for (bytes = REP_BYTES_BY_FIRST_BYTE (ch) - 1; bytes; bytes--)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
359 int c = Lstream_getc (stream);
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
360 bufpos_checking_assert (c >= 0);
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
361 *++strptr = (Bufbyte) c;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 return charptr_emchar (str);
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 Lstream_fput_emchar (Lstream *stream, Emchar ch)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 Bufbyte str[MAX_EMCHAR_LEN];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 Bytecount len = set_charptr_emchar (str, ch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 return Lstream_write (stream, str, len);
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 Lstream_funget_emchar (Lstream *stream, Emchar ch)
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 Bufbyte str[MAX_EMCHAR_LEN];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 Bytecount len = set_charptr_emchar (str, ch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 Lstream_unread (stream, str, len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 }
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 /* charset object */
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 mark_charset (Lisp_Object obj)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
390 Lisp_Charset *cs = XCHARSET (obj);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 mark_object (cs->short_name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 mark_object (cs->long_name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 mark_object (cs->doc_string);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 mark_object (cs->registry);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 mark_object (cs->ccl_program);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 return cs->name;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 print_charset (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
403 Lisp_Charset *cs = XCHARSET (obj);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 char buf[200];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 if (print_readably)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
407 printing_unreadable_object ("#<charset %s 0x%x>",
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
408 string_data (XSYMBOL (CHARSET_NAME (cs))->
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
409 name),
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
410 cs->header.uid);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 write_c_string ("#<charset ", printcharfun);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 print_internal (CHARSET_NAME (cs), printcharfun, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 write_c_string (" ", printcharfun);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 print_internal (CHARSET_SHORT_NAME (cs), printcharfun, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 write_c_string (" ", printcharfun);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 print_internal (CHARSET_LONG_NAME (cs), printcharfun, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 write_c_string (" ", printcharfun);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 print_internal (CHARSET_DOC_STRING (cs), printcharfun, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 sprintf (buf, " %s %s cols=%d g%d final='%c' reg=",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 CHARSET_TYPE (cs) == CHARSET_TYPE_94 ? "94" :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 CHARSET_TYPE (cs) == CHARSET_TYPE_96 ? "96" :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 CHARSET_TYPE (cs) == CHARSET_TYPE_94X94 ? "94x94" :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 "96x96",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 CHARSET_DIRECTION (cs) == CHARSET_LEFT_TO_RIGHT ? "l2r" : "r2l",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 CHARSET_COLUMNS (cs),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 CHARSET_GRAPHIC (cs),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 CHARSET_FINAL (cs));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 write_c_string (buf, printcharfun);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 print_internal (CHARSET_REGISTRY (cs), printcharfun, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 sprintf (buf, " 0x%x>", cs->header.uid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 write_c_string (buf, printcharfun);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 static const struct lrecord_description charset_description[] = {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
436 { XD_LISP_OBJECT, offsetof (Lisp_Charset, name) },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
437 { XD_LISP_OBJECT, offsetof (Lisp_Charset, doc_string) },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
438 { XD_LISP_OBJECT, offsetof (Lisp_Charset, registry) },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
439 { XD_LISP_OBJECT, offsetof (Lisp_Charset, short_name) },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
440 { XD_LISP_OBJECT, offsetof (Lisp_Charset, long_name) },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
441 { XD_LISP_OBJECT, offsetof (Lisp_Charset, reverse_direction_charset) },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
442 { XD_LISP_OBJECT, offsetof (Lisp_Charset, ccl_program) },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 { XD_END }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 DEFINE_LRECORD_IMPLEMENTATION ("charset", charset,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 mark_charset, print_charset, 0, 0, 0, charset_description,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
448 Lisp_Charset);
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
449
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 /* Make a new charset. */
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
451 /* #### SJT Should generic properties be allowed? */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 make_charset (int id, Lisp_Object name, unsigned char rep_bytes,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 unsigned char type, unsigned char columns, unsigned char graphic,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 Bufbyte final, unsigned char direction, Lisp_Object short_name,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 Lisp_Object long_name, Lisp_Object doc,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 Lisp_Object reg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 Lisp_Object obj;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
460 Lisp_Charset *cs = alloc_lcrecord_type (Lisp_Charset, &lrecord_charset);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
461
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
462 zero_lcrecord (cs);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
463
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 XSETCHARSET (obj, cs);
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 CHARSET_ID (cs) = id;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 CHARSET_NAME (cs) = name;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 CHARSET_SHORT_NAME (cs) = short_name;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 CHARSET_LONG_NAME (cs) = long_name;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 CHARSET_REP_BYTES (cs) = rep_bytes;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 CHARSET_DIRECTION (cs) = direction;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 CHARSET_TYPE (cs) = type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 CHARSET_COLUMNS (cs) = columns;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 CHARSET_GRAPHIC (cs) = graphic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 CHARSET_FINAL (cs) = final;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 CHARSET_DOC_STRING (cs) = doc;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 CHARSET_REGISTRY (cs) = reg;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 CHARSET_CCL_PROGRAM (cs) = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 CHARSET_REVERSE_DIRECTION_CHARSET (cs) = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 CHARSET_DIMENSION (cs) = (CHARSET_TYPE (cs) == CHARSET_TYPE_94 ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 CHARSET_TYPE (cs) == CHARSET_TYPE_96) ? 1 : 2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 CHARSET_CHARS (cs) = (CHARSET_TYPE (cs) == CHARSET_TYPE_94 ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 CHARSET_TYPE (cs) == CHARSET_TYPE_94X94) ? 94 : 96;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 if (final)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 /* some charsets do not have final characters. This includes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 ASCII, Control-1, Composite, and the two faux private
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 charsets. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 assert (NILP (chlook->charset_by_attributes[type][final][direction]));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 chlook->charset_by_attributes[type][final][direction] = obj;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 assert (NILP (chlook->charset_by_leading_byte[id - 128]));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 chlook->charset_by_leading_byte[id - 128] = obj;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 /* 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
499 all except in the leading-byte table. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 if (!NILP (name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 Fputhash (name, obj, Vcharset_hash_table);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 return obj;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 get_unallocated_leading_byte (int dimension)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 int lb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 if (dimension == 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
512 if (chlook->next_allocated_1_byte_leading_byte > MAX_LEADING_BYTE_PRIVATE_1)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 lb = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 else
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
515 lb = chlook->next_allocated_1_byte_leading_byte++;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
519 if (chlook->next_allocated_2_byte_leading_byte > MAX_LEADING_BYTE_PRIVATE_2)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 lb = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 else
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
522 lb = chlook->next_allocated_2_byte_leading_byte++;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 if (!lb)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
526 invalid_operation
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 ("No more character sets free for this dimension",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 make_int (dimension));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 return lb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 /* Basic charset Lisp functions */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 DEFUN ("charsetp", Fcharsetp, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 Return non-nil if OBJECT is a charset.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 (object))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 return CHARSETP (object) ? Qt : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 DEFUN ("find-charset", Ffind_charset, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 Retrieve the charset of the given name.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 If CHARSET-OR-NAME is a charset object, it is simply returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 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
550 nil is returned. Otherwise the associated charset object is returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552 (charset_or_name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 if (CHARSETP (charset_or_name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 return charset_or_name;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 CHECK_SYMBOL (charset_or_name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 return Fgethash (charset_or_name, Vcharset_hash_table, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 DEFUN ("get-charset", Fget_charset, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562 Retrieve the charset of the given name.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 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
564 charset instead of returning nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 (name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568 Lisp_Object charset = Ffind_charset (name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 if (NILP (charset))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
571 invalid_argument ("No such charset", name);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 return charset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 /* 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
576 actual charset object as the value. Occasionally we need to use them
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 in a list format. These routines provide us with that. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 struct charset_list_closure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580 Lisp_Object *charset_list;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 add_charset_to_list_mapper (Lisp_Object key, Lisp_Object value,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 void *charset_list_closure)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587 /* This function can GC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 struct charset_list_closure *chcl =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 (struct charset_list_closure*) charset_list_closure;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 Lisp_Object *charset_list = chcl->charset_list;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 *charset_list = Fcons (XCHARSET_NAME (value), *charset_list);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 DEFUN ("charset-list", Fcharset_list, 0, 0, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 Return a list of the names of all defined charsets.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 ())
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 Lisp_Object charset_list = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 struct gcpro gcpro1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 struct charset_list_closure charset_list_closure;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 GCPRO1 (charset_list);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 charset_list_closure.charset_list = &charset_list;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 elisp_maphash (add_charset_to_list_mapper, Vcharset_hash_table,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 &charset_list_closure);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 return charset_list;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 DEFUN ("charset-name", Fcharset_name, 1, 1, 0, /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
615 Return the name of charset CHARSET.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 (charset))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
618 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619 return XCHARSET_NAME (Fget_charset (charset));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
622 /* #### SJT Should generic properties be allowed? */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623 DEFUN ("make-charset", Fmake_charset, 3, 3, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 Define a new character set.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 This function is for use with Mule support.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 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
627 DOC-STRING is a string describing the character set.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 PROPS is a property list, describing the specific nature of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629 character set. Recognized properties are:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631 'short-name Short version of the charset name (ex: Latin-1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 'long-name Long version of the charset name (ex: ISO8859-1 (Latin-1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 'registry A regular expression matching the font registry field for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 this character set.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635 'dimension Number of octets used to index a character in this charset.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
636 Either 1 or 2. Defaults to 1.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
637 'columns Number of columns used to display a character in this charset.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
638 Only used in TTY mode. (Under X, the actual width of a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
639 character can be derived from the font used to display the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
640 characters.) If unspecified, defaults to the dimension
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641 (this is almost always the correct value).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642 'chars Number of characters in each dimension (94 or 96).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 Defaults to 94. Note that if the dimension is 2, the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 character set thus described is 94x94 or 96x96.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
645 'final Final byte of ISO 2022 escape sequence. Must be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 supplied. Each combination of (DIMENSION, CHARS) defines a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647 separate namespace for final bytes. Note that ISO
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648 2022 restricts the final byte to the range
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649 0x30 - 0x7E if dimension == 1, and 0x30 - 0x5F if
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
650 dimension == 2. Note also that final bytes in the range
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651 0x30 - 0x3F are reserved for user-defined (not official)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652 character sets.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653 'graphic 0 (use left half of font on output) or 1 (use right half
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654 of font on output). Defaults to 0. For example, for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
655 a font whose registry is ISO8859-1, the left half
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
656 (octets 0x20 - 0x7F) is the `ascii' character set, while
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
657 the right half (octets 0xA0 - 0xFF) is the `latin-1'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
658 character set. With 'graphic set to 0, the octets
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 will have their high bit cleared; with it set to 1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
660 the octets will have their high bit set.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661 'direction 'l2r (left-to-right) or 'r2l (right-to-left).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662 Defaults to 'l2r.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663 'ccl-program A compiled CCL program used to convert a character in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664 this charset into an index into the font. This is in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665 addition to the 'graphic property. The CCL program
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666 is passed the octets of the character, with the high
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667 bit cleared and set depending upon whether the value
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
668 of the 'graphic property is 0 or 1.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
669 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670 (name, doc_string, props))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672 int id, dimension = 1, chars = 94, graphic = 0, final = 0, columns = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673 int direction = CHARSET_LEFT_TO_RIGHT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
674 int type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
675 Lisp_Object registry = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
676 Lisp_Object charset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
677 Lisp_Object ccl_program = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678 Lisp_Object short_name = Qnil, long_name = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
680 CHECK_SYMBOL (name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 if (!NILP (doc_string))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682 CHECK_STRING (doc_string);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
684 charset = Ffind_charset (name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
685 if (!NILP (charset))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
686 invalid_operation ("Cannot redefine existing charset", name);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
688 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
689 EXTERNAL_PROPERTY_LIST_LOOP_3 (keyword, value, props)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
690 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
691 if (EQ (keyword, Qshort_name))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
692 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
693 CHECK_STRING (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
694 short_name = value;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
695 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
696
519
1c3b60121364 [xemacs-hg @ 2001-05-08 06:00:32 by martinb]
martinb
parents: 510
diff changeset
697 else if (EQ (keyword, Qlong_name))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
698 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
699 CHECK_STRING (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
700 long_name = value;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
701 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
702
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
703 else if (EQ (keyword, Qdimension))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
704 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
705 CHECK_INT (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
706 dimension = XINT (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
707 if (dimension < 1 || dimension > 2)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
708 invalid_constant ("Invalid value for 'dimension", value);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
709 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
710
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
711 else if (EQ (keyword, Qchars))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
712 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
713 CHECK_INT (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
714 chars = XINT (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
715 if (chars != 94 && chars != 96)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
716 invalid_constant ("Invalid value for 'chars", value);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
717 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
718
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
719 else if (EQ (keyword, Qcolumns))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
720 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
721 CHECK_INT (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
722 columns = XINT (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
723 if (columns != 1 && columns != 2)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
724 invalid_constant ("Invalid value for 'columns", value);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
725 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
726
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
727 else if (EQ (keyword, Qgraphic))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
728 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
729 CHECK_INT (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
730 graphic = XINT (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
731 if (graphic < 0 || graphic > 1)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
732 invalid_constant ("Invalid value for 'graphic", value);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
733 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
734
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
735 else if (EQ (keyword, Qregistry))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
736 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
737 CHECK_STRING (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
738 registry = value;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
739 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
740
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
741 else if (EQ (keyword, Qdirection))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
742 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
743 if (EQ (value, Ql2r))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
744 direction = CHARSET_LEFT_TO_RIGHT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
745 else if (EQ (value, Qr2l))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
746 direction = CHARSET_RIGHT_TO_LEFT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
747 else
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
748 invalid_constant ("Invalid value for 'direction", value);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
749 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
750
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
751 else if (EQ (keyword, Qfinal))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
752 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
753 CHECK_CHAR_COERCE_INT (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
754 final = XCHAR (value);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
755 if (final < '0' || final > '~')
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
756 invalid_constant ("Invalid value for 'final", value);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
757 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
758
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
759 else if (EQ (keyword, Qccl_program))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
760 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
761 struct ccl_program test_ccl;
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
762
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
763 if (setup_ccl_program (&test_ccl, value) < 0)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
764 invalid_argument ("Invalid value for 'ccl-program", value);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
765 ccl_program = value;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
766 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
767
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
768 else
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
769 invalid_constant ("Unrecognized property", keyword);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
770 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
771 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
772
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
773 if (!final)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
774 invalid_argument ("'final must be specified", Qunbound);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
775 if (dimension == 2 && final > 0x5F)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
776 invalid_constant
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
777 ("Final must be in the range 0x30 - 0x5F for dimension == 2",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
778 make_char (final));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
779
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
780 if (dimension == 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
781 type = (chars == 94) ? CHARSET_TYPE_94 : CHARSET_TYPE_96;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
782 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
783 type = (chars == 94) ? CHARSET_TYPE_94X94 : CHARSET_TYPE_96X96;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
784
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
785 if (!NILP (CHARSET_BY_ATTRIBUTES (type, final, CHARSET_LEFT_TO_RIGHT)) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
786 !NILP (CHARSET_BY_ATTRIBUTES (type, final, CHARSET_RIGHT_TO_LEFT)))
578
190b164ddcac [xemacs-hg @ 2001-05-25 11:26:50 by ben]
ben
parents: 565
diff changeset
787 invalid_argument
190b164ddcac [xemacs-hg @ 2001-05-25 11:26:50 by ben]
ben
parents: 565
diff changeset
788 ("Character set already defined for this DIMENSION/CHARS/FINAL combo",
565
e9162e1ea200 [xemacs-hg @ 2001-05-24 09:53:05 by yoshiki]
yoshiki
parents: 563
diff changeset
789 Qunbound);
428
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 id = get_unallocated_leading_byte (dimension);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
792
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
793 if (NILP (doc_string))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
794 doc_string = build_string ("");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
795
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
796 if (NILP (registry))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
797 registry = build_string ("");
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 if (NILP (short_name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
800 XSETSTRING (short_name, XSYMBOL (name)->name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
801
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
802 if (NILP (long_name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
803 long_name = doc_string;
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 if (columns == -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
806 columns = dimension;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
807 charset = make_charset (id, name, dimension + 2, type, columns, graphic,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
808 final, direction, short_name, long_name, doc_string, registry);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
809 if (!NILP (ccl_program))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
810 XCHARSET_CCL_PROGRAM (charset) = ccl_program;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
811 return 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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
814 DEFUN ("make-reverse-direction-charset", Fmake_reverse_direction_charset,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
815 2, 2, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
816 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
817 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
818 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
819 (charset, new_name))
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 Lisp_Object new_charset = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
822 int id, dimension, columns, graphic, final;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
823 int direction, type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
824 Lisp_Object registry, doc_string, short_name, long_name;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
825 Lisp_Charset *cs;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
826
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
827 charset = Fget_charset (charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
828 if (!NILP (XCHARSET_REVERSE_DIRECTION_CHARSET (charset)))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
829 invalid_operation ("Charset already has reverse-direction charset",
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
830 charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
831
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
832 CHECK_SYMBOL (new_name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
833 if (!NILP (Ffind_charset (new_name)))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
834 invalid_operation ("Cannot redefine existing charset", new_name);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
835
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
836 cs = XCHARSET (charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
837
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
838 type = CHARSET_TYPE (cs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
839 columns = CHARSET_COLUMNS (cs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
840 dimension = CHARSET_DIMENSION (cs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
841 id = get_unallocated_leading_byte (dimension);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
842
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
843 graphic = CHARSET_GRAPHIC (cs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
844 final = CHARSET_FINAL (cs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
845 direction = CHARSET_RIGHT_TO_LEFT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
846 if (CHARSET_DIRECTION (cs) == CHARSET_RIGHT_TO_LEFT)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
847 direction = CHARSET_LEFT_TO_RIGHT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
848 doc_string = CHARSET_DOC_STRING (cs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
849 short_name = CHARSET_SHORT_NAME (cs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
850 long_name = CHARSET_LONG_NAME (cs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
851 registry = CHARSET_REGISTRY (cs);
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 new_charset = make_charset (id, new_name, dimension + 2, type, columns,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
854 graphic, final, direction, short_name, long_name,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
855 doc_string, registry);
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_REVERSE_DIRECTION_CHARSET (cs) = new_charset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
858 XCHARSET_REVERSE_DIRECTION_CHARSET (new_charset) = charset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
859
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
860 return new_charset;
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
863 /* #### Reverse direction charsets not yet implemented. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
864 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
865 DEFUN ("charset-reverse-direction-charset", Fcharset_reverse_direction_charset,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
866 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
867 Return the reverse-direction charset parallel to CHARSET, if any.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
868 This is the charset with the same properties (in particular, the same
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
869 dimension, number of characters per dimension, and final byte) as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
870 CHARSET but whose characters are displayed in the opposite direction.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
871 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
872 (charset))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
873 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
874 charset = Fget_charset (charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
875 return XCHARSET_REVERSE_DIRECTION_CHARSET (charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
876 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
877 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
878
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
879 DEFUN ("charset-from-attributes", Fcharset_from_attributes, 3, 4, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
880 Return a charset with the given DIMENSION, CHARS, FINAL, and DIRECTION.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
881 If DIRECTION is omitted, both directions will be checked (left-to-right
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
882 will be returned if character sets exist for both directions).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
883 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
884 (dimension, chars, final, direction))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
885 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
886 int dm, ch, fi, di = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
887 int type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
888 Lisp_Object obj = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
889
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
890 CHECK_INT (dimension);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
891 dm = XINT (dimension);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
892 if (dm < 1 || dm > 2)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
893 invalid_constant ("Invalid value for DIMENSION", dimension);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
894
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
895 CHECK_INT (chars);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
896 ch = XINT (chars);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
897 if (ch != 94 && ch != 96)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
898 invalid_constant ("Invalid value for CHARS", chars);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
899
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
900 CHECK_CHAR_COERCE_INT (final);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
901 fi = XCHAR (final);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
902 if (fi < '0' || fi > '~')
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
903 invalid_constant ("Invalid value for FINAL", final);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
904
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
905 if (EQ (direction, Ql2r))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
906 di = CHARSET_LEFT_TO_RIGHT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
907 else if (EQ (direction, Qr2l))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
908 di = CHARSET_RIGHT_TO_LEFT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
909 else if (!NILP (direction))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
910 invalid_constant ("Invalid value for DIRECTION", direction);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
911
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
912 if (dm == 2 && fi > 0x5F)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
913 invalid_constant
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
914 ("Final must be in the range 0x30 - 0x5F for dimension == 2", final);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
916 if (dm == 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
917 type = (ch == 94) ? CHARSET_TYPE_94 : CHARSET_TYPE_96;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
918 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
919 type = (ch == 94) ? CHARSET_TYPE_94X94 : CHARSET_TYPE_96X96;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
920
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
921 if (di == -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
922 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
923 obj = CHARSET_BY_ATTRIBUTES (type, fi, CHARSET_LEFT_TO_RIGHT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
924 if (NILP (obj))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
925 obj = CHARSET_BY_ATTRIBUTES (type, fi, CHARSET_RIGHT_TO_LEFT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
926 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
927 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
928 obj = CHARSET_BY_ATTRIBUTES (type, fi, di);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
929
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
930 if (CHARSETP (obj))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
931 return XCHARSET_NAME (obj);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
932 return obj;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
933 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
934
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
935 DEFUN ("charset-short-name", Fcharset_short_name, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
936 Return short name of CHARSET.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
937 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
938 (charset))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
939 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
940 return XCHARSET_SHORT_NAME (Fget_charset (charset));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
941 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
942
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
943 DEFUN ("charset-long-name", Fcharset_long_name, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
944 Return long name of CHARSET.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
945 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
946 (charset))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
947 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
948 return XCHARSET_LONG_NAME (Fget_charset (charset));
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
951 DEFUN ("charset-description", Fcharset_description, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
952 Return description of CHARSET.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
953 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
954 (charset))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
955 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
956 return XCHARSET_DOC_STRING (Fget_charset (charset));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
957 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
958
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
959 DEFUN ("charset-dimension", Fcharset_dimension, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
960 Return dimension of CHARSET.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
961 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
962 (charset))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
963 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
964 return make_int (XCHARSET_DIMENSION (Fget_charset (charset)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
965 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
966
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
967 DEFUN ("charset-property", Fcharset_property, 2, 2, 0, /*
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
968 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
969 Recognized properties are those listed in `make-charset', as well as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
970 'name and 'doc-string.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
971 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
972 (charset, prop))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
973 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
974 Lisp_Charset *cs;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
975
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
976 charset = Fget_charset (charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
977 cs = XCHARSET (charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
978
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
979 CHECK_SYMBOL (prop);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
980 if (EQ (prop, Qname)) return CHARSET_NAME (cs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
981 if (EQ (prop, Qshort_name)) return CHARSET_SHORT_NAME (cs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
982 if (EQ (prop, Qlong_name)) return CHARSET_LONG_NAME (cs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
983 if (EQ (prop, Qdoc_string)) return CHARSET_DOC_STRING (cs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
984 if (EQ (prop, Qdimension)) return make_int (CHARSET_DIMENSION (cs));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
985 if (EQ (prop, Qcolumns)) return make_int (CHARSET_COLUMNS (cs));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
986 if (EQ (prop, Qgraphic)) return make_int (CHARSET_GRAPHIC (cs));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
987 if (EQ (prop, Qfinal)) return make_char (CHARSET_FINAL (cs));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
988 if (EQ (prop, Qchars)) return make_int (CHARSET_CHARS (cs));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
989 if (EQ (prop, Qregistry)) return CHARSET_REGISTRY (cs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
990 if (EQ (prop, Qccl_program)) return CHARSET_CCL_PROGRAM (cs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
991 if (EQ (prop, Qdirection))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
992 return CHARSET_DIRECTION (cs) == CHARSET_LEFT_TO_RIGHT ? Ql2r : Qr2l;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
993 if (EQ (prop, Qreverse_direction_charset))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
994 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
995 Lisp_Object obj = CHARSET_REVERSE_DIRECTION_CHARSET (cs);
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
996 /* #### Is this translation OK? If so, error checking sufficient? */
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
997 return CHARSETP (obj) ? XCHARSET_NAME (obj) : obj;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
998 }
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
999 invalid_constant ("Unrecognized charset property name", prop);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1000 return Qnil; /* not reached */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1001 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1002
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1003 DEFUN ("charset-id", Fcharset_id, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1004 Return charset identification number of CHARSET.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1005 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1006 (charset))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1007 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1008 return make_int(XCHARSET_LEADING_BYTE (Fget_charset (charset)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1009 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1010
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1011 /* #### We need to figure out which properties we really want to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1012 allow to be set. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1013
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1014 DEFUN ("set-charset-ccl-program", Fset_charset_ccl_program, 2, 2, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1015 Set the 'ccl-program property of CHARSET to CCL-PROGRAM.
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 (charset, ccl_program))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1018 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1019 struct ccl_program test_ccl;
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1020
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1021 charset = Fget_charset (charset);
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1022 if (setup_ccl_program (&test_ccl, ccl_program) < 0)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1023 invalid_argument ("Invalid ccl-program", ccl_program);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1024 XCHARSET_CCL_PROGRAM (charset) = ccl_program;
510
5bdbc721d46a [xemacs-hg @ 2001-05-06 08:33:35 by ben]
ben
parents: 452
diff changeset
1025 face_property_was_changed (Vdefault_face, Qfont, Qglobal);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1026 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1027 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1028
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1029 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1030 invalidate_charset_font_caches (Lisp_Object charset)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1031 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1032 /* Invalidate font cache entries for charset on all devices. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1033 Lisp_Object devcons, concons, hash_table;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1034 DEVICE_LOOP_NO_BREAK (devcons, concons)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1036 struct device *d = XDEVICE (XCAR (devcons));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1037 hash_table = Fgethash (charset, d->charset_font_cache, Qunbound);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1038 if (!UNBOUNDP (hash_table))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1039 Fclrhash (hash_table);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1040 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1041 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1042
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1043 /* Japanese folks may want to (set-charset-registry 'ascii "jisx0201") */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1044 DEFUN ("set-charset-registry", Fset_charset_registry, 2, 2, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1045 Set the 'registry property of CHARSET to REGISTRY.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1046 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1047 (charset, registry))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1048 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1049 charset = Fget_charset (charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1050 CHECK_STRING (registry);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1051 XCHARSET_REGISTRY (charset) = registry;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1052 invalidate_charset_font_caches (charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053 face_property_was_changed (Vdefault_face, Qfont, Qglobal);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1054 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1055 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1056
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059 /* Lisp primitives for working with characters */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1060 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1061
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1062 DEFUN ("make-char", Fmake_char, 2, 3, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1063 Make a character from CHARSET and octets ARG1 and ARG2.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1064 ARG2 is required only for characters from two-dimensional charsets.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1065 For example, (make-char 'latin-iso8859-2 185) will return the Latin 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1066 character s with caron.
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 (charset, arg1, arg2))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1069 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1070 Lisp_Charset *cs;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1071 int a1, a2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1072 int lowlim, highlim;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1073
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1074 charset = Fget_charset (charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1075 cs = XCHARSET (charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1076
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1077 if (EQ (charset, Vcharset_ascii)) lowlim = 0, highlim = 127;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1078 else if (EQ (charset, Vcharset_control_1)) lowlim = 0, highlim = 31;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1079 else if (CHARSET_CHARS (cs) == 94) lowlim = 33, highlim = 126;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1080 else /* CHARSET_CHARS (cs) == 96) */ lowlim = 32, highlim = 127;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1081
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1082 CHECK_INT (arg1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1083 /* It is useful (and safe, according to Olivier Galibert) to strip
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1084 the 8th bit off ARG1 and ARG2 because it allows programmers to
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1085 write (make-char 'latin-iso8859-2 CODE) where code is the actual
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1086 Latin 2 code of the character. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1087 a1 = XINT (arg1) & 0x7f;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1088 if (a1 < lowlim || a1 > highlim)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1089 args_out_of_range_3 (arg1, make_int (lowlim), make_int (highlim));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1090
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1091 if (CHARSET_DIMENSION (cs) == 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1092 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1093 if (!NILP (arg2))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1094 invalid_argument
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1095 ("Charset is of dimension one; second octet must be nil", arg2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1096 return make_char (MAKE_CHAR (charset, a1, 0));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1097 }
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 CHECK_INT (arg2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1100 a2 = XINT (arg2) & 0x7f;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1101 if (a2 < lowlim || a2 > highlim)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1102 args_out_of_range_3 (arg2, make_int (lowlim), make_int (highlim));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1103
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1104 return make_char (MAKE_CHAR (charset, a1, a2));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1105 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1106
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1107 DEFUN ("char-charset", Fchar_charset, 1, 1, 0, /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1108 Return the character set of CHARACTER.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1109 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1110 (character))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1111 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1112 CHECK_CHAR_COERCE_INT (character);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1113
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1114 return XCHARSET_NAME (CHARSET_BY_LEADING_BYTE
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1115 (CHAR_LEADING_BYTE (XCHAR (character))));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1116 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1117
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1118 DEFUN ("char-octet", Fchar_octet, 1, 2, 0, /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1119 Return the octet numbered N (should be 0 or 1) of CHARACTER.
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1120 N defaults to 0 if omitted.
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1121 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1122 (character, n))
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1123 {
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1124 Lisp_Object charset;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1125 int octet0, octet1;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1126
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1127 CHECK_CHAR_COERCE_INT (character);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1128
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1129 BREAKUP_CHAR (XCHAR (character), charset, octet0, octet1);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1130
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1131 if (NILP (n) || EQ (n, Qzero))
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1132 return make_int (octet0);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1133 else if (EQ (n, make_int (1)))
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1134 return make_int (octet1);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1135 else
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1136 invalid_constant ("Octet number must be 0 or 1", n);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1137 }
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1138
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1139 DEFUN ("split-char", Fsplit_char, 1, 1, 0, /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1140 Return list of charset and one or two position-codes of CHARACTER.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1141 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1142 (character))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1143 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1144 /* This function can GC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1145 struct gcpro gcpro1, gcpro2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1146 Lisp_Object charset = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1147 Lisp_Object rc = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1148 int c1, c2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1149
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1150 GCPRO2 (charset, rc);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1151 CHECK_CHAR_COERCE_INT (character);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1152
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1153 BREAKUP_CHAR (XCHAR (character), charset, c1, c2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1154
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1155 if (XCHARSET_DIMENSION (Fget_charset (charset)) == 2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1156 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1157 rc = list3 (XCHARSET_NAME (charset), make_int (c1), make_int (c2));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1158 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1159 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1160 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1161 rc = list2 (XCHARSET_NAME (charset), make_int (c1));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1162 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1163 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1164
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1165 return rc;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1166 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1167
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1168
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1169 #ifdef ENABLE_COMPOSITE_CHARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1170 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1171 /* composite character functions */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1172 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1173
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1174 Emchar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1175 lookup_composite_char (Bufbyte *str, int len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1176 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1177 Lisp_Object lispstr = make_string (str, len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1178 Lisp_Object ch = Fgethash (lispstr,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1179 Vcomposite_char_string2char_hash_table,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1180 Qunbound);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1181 Emchar emch;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1182
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1183 if (UNBOUNDP (ch))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1184 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1185 if (composite_char_row_next >= 128)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1186 invalid_operation ("No more composite chars available", lispstr);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1187 emch = MAKE_CHAR (Vcharset_composite, composite_char_row_next,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1188 composite_char_col_next);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1189 Fputhash (make_char (emch), lispstr,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1190 Vcomposite_char_char2string_hash_table);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1191 Fputhash (lispstr, make_char (emch),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1192 Vcomposite_char_string2char_hash_table);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1193 composite_char_col_next++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1194 if (composite_char_col_next >= 128)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1195 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1196 composite_char_col_next = 32;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1197 composite_char_row_next++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1198 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1199 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1200 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1201 emch = XCHAR (ch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1202 return emch;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1203 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1204
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1205 Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1206 composite_char_string (Emchar ch)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1207 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1208 Lisp_Object str = Fgethash (make_char (ch),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1209 Vcomposite_char_char2string_hash_table,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1210 Qunbound);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1211 assert (!UNBOUNDP (str));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1212 return str;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1213 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1214
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1215 xxDEFUN ("make-composite-char", Fmake_composite_char, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1216 Convert a string into a single composite character.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1217 The character is the result of overstriking all the characters in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1218 the string.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1219 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1220 (string))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1221 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1222 CHECK_STRING (string);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1223 return make_char (lookup_composite_char (XSTRING_DATA (string),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1224 XSTRING_LENGTH (string)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1225 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1226
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1227 xxDEFUN ("composite-char-string", Fcomposite_char_string, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1228 Return a string of the characters comprising a composite character.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1229 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1230 (ch))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1231 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1232 Emchar emch;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1233
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1234 CHECK_CHAR (ch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1235 emch = XCHAR (ch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1236 if (CHAR_LEADING_BYTE (emch) != LEADING_BYTE_COMPOSITE)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1237 invalid_argument ("Must be composite char", ch);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1238 return composite_char_string (emch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1239 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1240 #endif /* ENABLE_COMPOSITE_CHARS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1241
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1242
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1243 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1244 /* initialization */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1245 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1246
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1247 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1248 syms_of_mule_charset (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1249 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1250 INIT_LRECORD_IMPLEMENTATION (charset);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1251
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1252 DEFSUBR (Fcharsetp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1253 DEFSUBR (Ffind_charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1254 DEFSUBR (Fget_charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1255 DEFSUBR (Fcharset_list);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1256 DEFSUBR (Fcharset_name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1257 DEFSUBR (Fmake_charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1258 DEFSUBR (Fmake_reverse_direction_charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1259 /* DEFSUBR (Freverse_direction_charset); */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1260 DEFSUBR (Fcharset_from_attributes);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1261 DEFSUBR (Fcharset_short_name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1262 DEFSUBR (Fcharset_long_name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1263 DEFSUBR (Fcharset_description);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1264 DEFSUBR (Fcharset_dimension);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1265 DEFSUBR (Fcharset_property);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1266 DEFSUBR (Fcharset_id);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1267 DEFSUBR (Fset_charset_ccl_program);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1268 DEFSUBR (Fset_charset_registry);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1269
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1270 DEFSUBR (Fmake_char);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1271 DEFSUBR (Fchar_charset);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1272 DEFSUBR (Fchar_octet);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1273 DEFSUBR (Fsplit_char);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1274
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1275 #ifdef ENABLE_COMPOSITE_CHARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1276 DEFSUBR (Fmake_composite_char);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1277 DEFSUBR (Fcomposite_char_string);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1278 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1279
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1280 DEFSYMBOL (Qcharsetp);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1281 DEFSYMBOL (Qregistry);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1282 DEFSYMBOL (Qfinal);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1283 DEFSYMBOL (Qgraphic);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1284 DEFSYMBOL (Qdirection);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1285 DEFSYMBOL (Qreverse_direction_charset);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1286 DEFSYMBOL (Qshort_name);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1287 DEFSYMBOL (Qlong_name);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1288
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1289 DEFSYMBOL (Ql2r);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1290 DEFSYMBOL (Qr2l);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1291
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1292 /* Charsets, compatible with FSF 20.3
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1293 Naming convention is Script-Charset[-Edition] */
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1294 DEFSYMBOL (Qascii);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1295 DEFSYMBOL (Qcontrol_1);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1296 DEFSYMBOL (Qlatin_iso8859_1);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1297 DEFSYMBOL (Qlatin_iso8859_2);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1298 DEFSYMBOL (Qlatin_iso8859_3);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1299 DEFSYMBOL (Qlatin_iso8859_4);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1300 DEFSYMBOL (Qthai_tis620);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1301 DEFSYMBOL (Qgreek_iso8859_7);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1302 DEFSYMBOL (Qarabic_iso8859_6);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1303 DEFSYMBOL (Qhebrew_iso8859_8);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1304 DEFSYMBOL (Qkatakana_jisx0201);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1305 DEFSYMBOL (Qlatin_jisx0201);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1306 DEFSYMBOL (Qcyrillic_iso8859_5);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1307 DEFSYMBOL (Qlatin_iso8859_9);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1308 DEFSYMBOL (Qjapanese_jisx0208_1978);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1309 DEFSYMBOL (Qchinese_gb2312);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1310 DEFSYMBOL (Qjapanese_jisx0208);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1311 DEFSYMBOL (Qkorean_ksc5601);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1312 DEFSYMBOL (Qjapanese_jisx0212);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1313 DEFSYMBOL (Qchinese_cns11643_1);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1314 DEFSYMBOL (Qchinese_cns11643_2);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1315 DEFSYMBOL (Qchinese_big5_1);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1316 DEFSYMBOL (Qchinese_big5_2);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1317
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 519
diff changeset
1318 DEFSYMBOL (Qcomposite);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1319 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1320
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1321 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1322 vars_of_mule_charset (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1323 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1324 int i, j, k;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1325
452
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
1326 chlook = xnew_and_zero (struct charset_lookup); /* zero for Purify. */
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
1327 dump_add_root_struct_ptr (&chlook, &charset_lookup_description);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1328
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1329 /* Table of charsets indexed by leading byte. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1330 for (i = 0; i < countof (chlook->charset_by_leading_byte); i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1331 chlook->charset_by_leading_byte[i] = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1332
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1333 /* Table of charsets indexed by type/final-byte/direction. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1334 for (i = 0; i < countof (chlook->charset_by_attributes); i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1335 for (j = 0; j < countof (chlook->charset_by_attributes[0]); j++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1336 for (k = 0; k < countof (chlook->charset_by_attributes[0][0]); k++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1337 chlook->charset_by_attributes[i][j][k] = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1338
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1339 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
1340 chlook->next_allocated_2_byte_leading_byte = MIN_LEADING_BYTE_PRIVATE_2;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1341 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1342
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1343 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1344 complex_vars_of_mule_charset (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1345 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1346 staticpro (&Vcharset_hash_table);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1347 Vcharset_hash_table =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1348 make_lisp_hash_table (50, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1349
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1350 /* Predefined character sets. We store them into variables for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1351 ease of access. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1352
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1353 staticpro (&Vcharset_ascii);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1354 Vcharset_ascii =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1355 make_charset (LEADING_BYTE_ASCII, Qascii, 1,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1356 CHARSET_TYPE_94, 1, 0, 'B',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1357 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1358 build_string ("ASCII"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1359 build_string ("ASCII)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1360 build_string ("ASCII (ISO646 IRV)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1361 build_string ("\\(iso8859-[0-9]*\\|-ascii\\)"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1362 staticpro (&Vcharset_control_1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1363 Vcharset_control_1 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1364 make_charset (LEADING_BYTE_CONTROL_1, Qcontrol_1, 2,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1365 CHARSET_TYPE_94, 1, 1, 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1366 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1367 build_string ("C1"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1368 build_string ("Control characters"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1369 build_string ("Control characters 128-191"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1370 build_string (""));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1371 staticpro (&Vcharset_latin_iso8859_1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1372 Vcharset_latin_iso8859_1 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1373 make_charset (LEADING_BYTE_LATIN_ISO8859_1, Qlatin_iso8859_1, 2,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1374 CHARSET_TYPE_96, 1, 1, 'A',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1375 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1376 build_string ("Latin-1"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1377 build_string ("ISO8859-1 (Latin-1)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1378 build_string ("ISO8859-1 (Latin-1)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1379 build_string ("iso8859-1"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1380 staticpro (&Vcharset_latin_iso8859_2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1381 Vcharset_latin_iso8859_2 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1382 make_charset (LEADING_BYTE_LATIN_ISO8859_2, Qlatin_iso8859_2, 2,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1383 CHARSET_TYPE_96, 1, 1, 'B',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1384 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1385 build_string ("Latin-2"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1386 build_string ("ISO8859-2 (Latin-2)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1387 build_string ("ISO8859-2 (Latin-2)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1388 build_string ("iso8859-2"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1389 staticpro (&Vcharset_latin_iso8859_3);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1390 Vcharset_latin_iso8859_3 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1391 make_charset (LEADING_BYTE_LATIN_ISO8859_3, Qlatin_iso8859_3, 2,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1392 CHARSET_TYPE_96, 1, 1, 'C',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1393 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1394 build_string ("Latin-3"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1395 build_string ("ISO8859-3 (Latin-3)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1396 build_string ("ISO8859-3 (Latin-3)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1397 build_string ("iso8859-3"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1398 staticpro (&Vcharset_latin_iso8859_4);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1399 Vcharset_latin_iso8859_4 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1400 make_charset (LEADING_BYTE_LATIN_ISO8859_4, Qlatin_iso8859_4, 2,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1401 CHARSET_TYPE_96, 1, 1, 'D',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1402 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1403 build_string ("Latin-4"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1404 build_string ("ISO8859-4 (Latin-4)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1405 build_string ("ISO8859-4 (Latin-4)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1406 build_string ("iso8859-4"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1407 staticpro (&Vcharset_thai_tis620);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1408 Vcharset_thai_tis620 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1409 make_charset (LEADING_BYTE_THAI_TIS620, Qthai_tis620, 2,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1410 CHARSET_TYPE_96, 1, 1, 'T',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1411 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1412 build_string ("TIS620"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1413 build_string ("TIS620 (Thai)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1414 build_string ("TIS620.2529 (Thai)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1415 build_string ("tis620"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1416 staticpro (&Vcharset_greek_iso8859_7);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1417 Vcharset_greek_iso8859_7 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1418 make_charset (LEADING_BYTE_GREEK_ISO8859_7, Qgreek_iso8859_7, 2,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1419 CHARSET_TYPE_96, 1, 1, 'F',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1420 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1421 build_string ("ISO8859-7"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1422 build_string ("ISO8859-7 (Greek)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1423 build_string ("ISO8859-7 (Greek)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1424 build_string ("iso8859-7"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1425 staticpro (&Vcharset_arabic_iso8859_6);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1426 Vcharset_arabic_iso8859_6 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1427 make_charset (LEADING_BYTE_ARABIC_ISO8859_6, Qarabic_iso8859_6, 2,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1428 CHARSET_TYPE_96, 1, 1, 'G',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1429 CHARSET_RIGHT_TO_LEFT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1430 build_string ("ISO8859-6"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1431 build_string ("ISO8859-6 (Arabic)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1432 build_string ("ISO8859-6 (Arabic)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1433 build_string ("iso8859-6"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1434 staticpro (&Vcharset_hebrew_iso8859_8);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1435 Vcharset_hebrew_iso8859_8 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1436 make_charset (LEADING_BYTE_HEBREW_ISO8859_8, Qhebrew_iso8859_8, 2,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1437 CHARSET_TYPE_96, 1, 1, 'H',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1438 CHARSET_RIGHT_TO_LEFT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1439 build_string ("ISO8859-8"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1440 build_string ("ISO8859-8 (Hebrew)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1441 build_string ("ISO8859-8 (Hebrew)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1442 build_string ("iso8859-8"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1443 staticpro (&Vcharset_katakana_jisx0201);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1444 Vcharset_katakana_jisx0201 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1445 make_charset (LEADING_BYTE_KATAKANA_JISX0201, Qkatakana_jisx0201, 2,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1446 CHARSET_TYPE_94, 1, 1, 'I',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1447 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1448 build_string ("JISX0201 Kana"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1449 build_string ("JISX0201.1976 (Japanese Kana)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1450 build_string ("JISX0201.1976 Japanese Kana"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1451 build_string ("jisx0201.1976"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1452 staticpro (&Vcharset_latin_jisx0201);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1453 Vcharset_latin_jisx0201 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1454 make_charset (LEADING_BYTE_LATIN_JISX0201, Qlatin_jisx0201, 2,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1455 CHARSET_TYPE_94, 1, 0, 'J',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1456 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1457 build_string ("JISX0201 Roman"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1458 build_string ("JISX0201.1976 (Japanese Roman)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1459 build_string ("JISX0201.1976 Japanese Roman"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1460 build_string ("jisx0201.1976"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1461 staticpro (&Vcharset_cyrillic_iso8859_5);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1462 Vcharset_cyrillic_iso8859_5 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1463 make_charset (LEADING_BYTE_CYRILLIC_ISO8859_5, Qcyrillic_iso8859_5, 2,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1464 CHARSET_TYPE_96, 1, 1, 'L',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1465 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1466 build_string ("ISO8859-5"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1467 build_string ("ISO8859-5 (Cyrillic)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1468 build_string ("ISO8859-5 (Cyrillic)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1469 build_string ("iso8859-5"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1470 staticpro (&Vcharset_latin_iso8859_9);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1471 Vcharset_latin_iso8859_9 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1472 make_charset (LEADING_BYTE_LATIN_ISO8859_9, Qlatin_iso8859_9, 2,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1473 CHARSET_TYPE_96, 1, 1, 'M',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1474 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1475 build_string ("Latin-5"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1476 build_string ("ISO8859-9 (Latin-5)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1477 build_string ("ISO8859-9 (Latin-5)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1478 build_string ("iso8859-9"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1479 staticpro (&Vcharset_japanese_jisx0208_1978);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1480 Vcharset_japanese_jisx0208_1978 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1481 make_charset (LEADING_BYTE_JAPANESE_JISX0208_1978, Qjapanese_jisx0208_1978, 3,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1482 CHARSET_TYPE_94X94, 2, 0, '@',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1483 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1484 build_string ("JISX0208.1978"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1485 build_string ("JISX0208.1978 (Japanese)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1486 build_string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1487 ("JISX0208.1978 Japanese Kanji (so called \"old JIS\")"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1488 build_string ("\\(jisx0208\\|jisc6226\\)\\.1978"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1489 staticpro (&Vcharset_chinese_gb2312);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1490 Vcharset_chinese_gb2312 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1491 make_charset (LEADING_BYTE_CHINESE_GB2312, Qchinese_gb2312, 3,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1492 CHARSET_TYPE_94X94, 2, 0, 'A',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1493 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1494 build_string ("GB2312"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1495 build_string ("GB2312)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1496 build_string ("GB2312 Chinese simplified"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1497 build_string ("gb2312"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1498 staticpro (&Vcharset_japanese_jisx0208);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1499 Vcharset_japanese_jisx0208 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1500 make_charset (LEADING_BYTE_JAPANESE_JISX0208, Qjapanese_jisx0208, 3,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1501 CHARSET_TYPE_94X94, 2, 0, 'B',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1502 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1503 build_string ("JISX0208"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1504 build_string ("JISX0208.1983/1990 (Japanese)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1505 build_string ("JISX0208.1983/1990 Japanese Kanji"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1506 build_string ("jisx0208.19\\(83\\|90\\)"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1507 staticpro (&Vcharset_korean_ksc5601);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1508 Vcharset_korean_ksc5601 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1509 make_charset (LEADING_BYTE_KOREAN_KSC5601, Qkorean_ksc5601, 3,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1510 CHARSET_TYPE_94X94, 2, 0, 'C',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1511 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1512 build_string ("KSC5601"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1513 build_string ("KSC5601 (Korean"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1514 build_string ("KSC5601 Korean Hangul and Hanja"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1515 build_string ("ksc5601"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1516 staticpro (&Vcharset_japanese_jisx0212);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1517 Vcharset_japanese_jisx0212 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1518 make_charset (LEADING_BYTE_JAPANESE_JISX0212, Qjapanese_jisx0212, 3,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1519 CHARSET_TYPE_94X94, 2, 0, 'D',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1520 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1521 build_string ("JISX0212"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1522 build_string ("JISX0212 (Japanese)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1523 build_string ("JISX0212 Japanese Supplement"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1524 build_string ("jisx0212"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1525
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1526 #define CHINESE_CNS_PLANE_RE(n) "cns11643[.-]\\(.*[.-]\\)?" n "$"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1527 staticpro (&Vcharset_chinese_cns11643_1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1528 Vcharset_chinese_cns11643_1 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1529 make_charset (LEADING_BYTE_CHINESE_CNS11643_1, Qchinese_cns11643_1, 3,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1530 CHARSET_TYPE_94X94, 2, 0, 'G',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1531 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1532 build_string ("CNS11643-1"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1533 build_string ("CNS11643-1 (Chinese traditional)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1534 build_string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1535 ("CNS 11643 Plane 1 Chinese traditional"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1536 build_string (CHINESE_CNS_PLANE_RE("1")));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1537 staticpro (&Vcharset_chinese_cns11643_2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1538 Vcharset_chinese_cns11643_2 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1539 make_charset (LEADING_BYTE_CHINESE_CNS11643_2, Qchinese_cns11643_2, 3,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1540 CHARSET_TYPE_94X94, 2, 0, 'H',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1541 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1542 build_string ("CNS11643-2"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1543 build_string ("CNS11643-2 (Chinese traditional)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1544 build_string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1545 ("CNS 11643 Plane 2 Chinese traditional"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1546 build_string (CHINESE_CNS_PLANE_RE("2")));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1547 staticpro (&Vcharset_chinese_big5_1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1548 Vcharset_chinese_big5_1 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1549 make_charset (LEADING_BYTE_CHINESE_BIG5_1, Qchinese_big5_1, 3,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1550 CHARSET_TYPE_94X94, 2, 0, '0',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1551 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1552 build_string ("Big5"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1553 build_string ("Big5 (Level-1)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1554 build_string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1555 ("Big5 Level-1 Chinese traditional"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1556 build_string ("big5"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1557 staticpro (&Vcharset_chinese_big5_2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1558 Vcharset_chinese_big5_2 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1559 make_charset (LEADING_BYTE_CHINESE_BIG5_2, Qchinese_big5_2, 3,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1560 CHARSET_TYPE_94X94, 2, 0, '1',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1561 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1562 build_string ("Big5"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1563 build_string ("Big5 (Level-2)"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1564 build_string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1565 ("Big5 Level-2 Chinese traditional"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1566 build_string ("big5"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1567
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1568
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1569 #ifdef ENABLE_COMPOSITE_CHARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1570 /* #### For simplicity, we put composite chars into a 96x96 charset.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1571 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
1572 room, esp. as we don't yet recycle numbers. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1573 staticpro (&Vcharset_composite);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1574 Vcharset_composite =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1575 make_charset (LEADING_BYTE_COMPOSITE, Qcomposite, 3,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1576 CHARSET_TYPE_96X96, 2, 0, 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1577 CHARSET_LEFT_TO_RIGHT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1578 build_string ("Composite"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1579 build_string ("Composite characters"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1580 build_string ("Composite characters"),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1581 build_string (""));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1582
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1583 /* #### not dumped properly */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1584 composite_char_row_next = 32;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1585 composite_char_col_next = 32;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1586
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1587 Vcomposite_char_string2char_hash_table =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1588 make_lisp_hash_table (500, HASH_TABLE_NON_WEAK, HASH_TABLE_EQUAL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1589 Vcomposite_char_char2string_hash_table =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1590 make_lisp_hash_table (500, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1591 staticpro (&Vcomposite_char_string2char_hash_table);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1592 staticpro (&Vcomposite_char_char2string_hash_table);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1593 #endif /* ENABLE_COMPOSITE_CHARS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1594
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1595 }