Mercurial > emacs
annotate src/charset.h @ 38093:06cfc79202d7
(Text): Fix a cross-reference to autotype.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Mon, 18 Jun 2001 07:02:50 +0000 |
parents | 6f52e8c1039f |
children | b7a9187751b2 |
rev | line source |
---|---|
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
1 /* Header for multibyte character handler. |
20708 | 2 Copyright (C) 1995, 1997, 1998 Electrotechnical Laboratory, JAPAN. |
18341
33e78cc7f058
Change copyright notices.
Richard M. Stallman <rms@gnu.org>
parents:
17833
diff
changeset
|
3 Licensed to the Free Software Foundation. |
17052 | 4 |
17071 | 5 This file is part of GNU Emacs. |
6 | |
7 GNU Emacs is free software; you can redistribute it and/or modify | |
8 it under the terms of the GNU General Public License as published by | |
9 the Free Software Foundation; either version 2, or (at your option) | |
10 any later version. | |
17052 | 11 |
17071 | 12 GNU Emacs is distributed in the hope that it will be useful, |
13 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 GNU General Public License for more details. | |
17052 | 16 |
17071 | 17 You should have received a copy of the GNU General Public License |
18 along with GNU Emacs; see the file COPYING. If not, write to | |
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
20 Boston, MA 02111-1307, USA. */ | |
17052 | 21 |
29570
825505ff211e
(EMACS_CHARSET_H): Renamed from _CHARSET_H.
Kenichi Handa <handa@m17n.org>
parents:
29539
diff
changeset
|
22 #ifndef EMACS_CHARSET_H |
825505ff211e
(EMACS_CHARSET_H): Renamed from _CHARSET_H.
Kenichi Handa <handa@m17n.org>
parents:
29539
diff
changeset
|
23 #define EMACS_CHARSET_H |
17052 | 24 |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
25 /* #define BYTE_COMBINING_DEBUG */ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
26 |
17052 | 27 /*** GENERAL NOTE on CHARACTER SET (CHARSET) *** |
28 | |
29 A character set ("charset" hereafter) is a meaningful collection | |
30 (i.e. language, culture, functionality, etc) of characters. Emacs | |
31 handles multiple charsets at once. Each charset corresponds to one | |
35478 | 32 of the ISO charsets. Emacs identifies a charset by a unique |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
33 identification number, whereas ISO identifies a charset by a triplet |
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
34 of DIMENSION, CHARS and FINAL-CHAR. So, hereafter, just saying |
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
35 "charset" means an identification number (integer value). |
17052 | 36 |
35478 | 37 The value range of charsets is 0x00, 0x81..0xFE. There are four |
17052 | 38 kinds of charset depending on DIMENSION (1 or 2) and CHARS (94 or |
39 96). For instance, a charset of DIMENSION2_CHARS94 contains 94x94 | |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
40 characters. |
17052 | 41 |
42 Within Emacs Lisp, a charset is treated as a symbol which has a | |
43 property `charset'. The property value is a vector containing | |
35478 | 44 various information about the charset. For readability of C code, |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
45 we use the following convention for C variable names: |
17052 | 46 charset_symbol: Emacs Lisp symbol of a charset |
47 charset_id: Emacs Lisp integer of an identification number of a charset | |
48 charset: C integer of an identification number of a charset | |
49 | |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
50 Each charset (except for ascii) is assigned a base leading-code |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
51 (range 0x80..0x9E). In addition, a charset of greater than 0xA0 |
17052 | 52 (whose base leading-code is 0x9A..0x9D) is assigned an extended |
53 leading-code (range 0xA0..0xFE). In this case, each base | |
35478 | 54 leading-code specifies the allowable range of extended leading-code |
55 as shown in the table below. A leading-code is used to represent a | |
17052 | 56 character in Emacs' buffer and string. |
57 | |
35478 | 58 We call a charset which has extended leading-code a "private |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
59 charset" because those are mainly for a charset which is not yet |
17052 | 60 registered by ISO. On the contrary, we call a charset which does |
35478 | 61 not have extended leading-code an "official charset". |
17052 | 62 |
63 --------------------------------------------------------------------------- | |
64 charset dimension base leading-code extended leading-code | |
65 --------------------------------------------------------------------------- | |
66 0x00 official dim1 -- none -- -- none -- | |
67 (ASCII) | |
68 0x01..0x7F --never used-- | |
29539
a6f1d75744d8
(CHARSET_8_BIT_GRAPHIC): Define as 0x80.
Kenichi Handa <handa@m17n.org>
parents:
29004
diff
changeset
|
69 0x80 official dim1 -- none -- -- none -- |
a6f1d75744d8
(CHARSET_8_BIT_GRAPHIC): Define as 0x80.
Kenichi Handa <handa@m17n.org>
parents:
29004
diff
changeset
|
70 (eight-bit-graphic) |
17052 | 71 0x81..0x8F official dim1 same as charset -- none -- |
72 0x90..0x99 official dim2 same as charset -- none -- | |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
73 0x9A..0x9D --never used-- |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
74 0x9E official dim1 same as charset -- none -- |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
75 (eight-bit-control) |
29539
a6f1d75744d8
(CHARSET_8_BIT_GRAPHIC): Define as 0x80.
Kenichi Handa <handa@m17n.org>
parents:
29004
diff
changeset
|
76 0x9F --never used-- |
17052 | 77 0xA0..0xDF private dim1 0x9A same as charset |
78 of 1-column width | |
79 0xE0..0xEF private dim1 0x9B same as charset | |
80 of 2-column width | |
81 0xF0..0xF4 private dim2 0x9C same as charset | |
82 of 1-column width | |
83 0xF5..0xFE private dim2 0x9D same as charset | |
84 of 2-column width | |
85 0xFF --never used-- | |
86 --------------------------------------------------------------------------- | |
87 | |
88 */ | |
89 | |
90 /* Definition of special leading-codes. */ | |
91 /* Leading-code followed by extended leading-code. */ | |
92 #define LEADING_CODE_PRIVATE_11 0x9A /* for private DIMENSION1 of 1-column */ | |
93 #define LEADING_CODE_PRIVATE_12 0x9B /* for private DIMENSION1 of 2-column */ | |
94 #define LEADING_CODE_PRIVATE_21 0x9C /* for private DIMENSION2 of 1-column */ | |
19643
1defeafe575b
(LEADING_CODE_PRIVATE_22): Comment fixed.
Kenichi Handa <handa@m17n.org>
parents:
19319
diff
changeset
|
95 #define LEADING_CODE_PRIVATE_22 0x9D /* for private DIMENSION2 of 2-column */ |
17052 | 96 |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
97 #define LEADING_CODE_8_BIT_CONTROL 0x9E /* for `eight-bit-control' */ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
98 |
17052 | 99 /* Extended leading-code. */ |
100 /* Start of each extended leading-codes. */ | |
101 #define LEADING_CODE_EXT_11 0xA0 /* follows LEADING_CODE_PRIVATE_11 */ | |
102 #define LEADING_CODE_EXT_12 0xE0 /* follows LEADING_CODE_PRIVATE_12 */ | |
103 #define LEADING_CODE_EXT_21 0xF0 /* follows LEADING_CODE_PRIVATE_21 */ | |
104 #define LEADING_CODE_EXT_22 0xF5 /* follows LEADING_CODE_PRIVATE_22 */ | |
105 /* Maximum value of extended leading-codes. */ | |
106 #define LEADING_CODE_EXT_MAX 0xFE | |
107 | |
108 /* Definition of minimum/maximum charset of each DIMENSION. */ | |
31460
30806f88340f
(MIN_CHARSET_OFFICIAL_DIMENSION1): Define it as 0x80, not 0x81.
Kenichi Handa <handa@m17n.org>
parents:
31434
diff
changeset
|
109 #define MIN_CHARSET_OFFICIAL_DIMENSION1 0x80 |
17052 | 110 #define MAX_CHARSET_OFFICIAL_DIMENSION1 0x8F |
111 #define MIN_CHARSET_OFFICIAL_DIMENSION2 0x90 | |
112 #define MAX_CHARSET_OFFICIAL_DIMENSION2 0x99 | |
113 #define MIN_CHARSET_PRIVATE_DIMENSION1 LEADING_CODE_EXT_11 | |
114 #define MIN_CHARSET_PRIVATE_DIMENSION2 LEADING_CODE_EXT_21 | |
115 | |
17185
0d5a1bae9d73
(MAX_CHARSET): Definition changed to the actual
Kenichi Handa <handa@m17n.org>
parents:
17120
diff
changeset
|
116 /* Maximum value of overall charset identification number. */ |
0d5a1bae9d73
(MAX_CHARSET): Definition changed to the actual
Kenichi Handa <handa@m17n.org>
parents:
17120
diff
changeset
|
117 #define MAX_CHARSET 0xFE |
0d5a1bae9d73
(MAX_CHARSET): Definition changed to the actual
Kenichi Handa <handa@m17n.org>
parents:
17120
diff
changeset
|
118 |
17052 | 119 /* Definition of special charsets. */ |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
120 #define CHARSET_ASCII 0 /* 0x00..0x7F */ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
121 #define CHARSET_8_BIT_CONTROL 0x9E /* 0x80..0x9F */ |
29539
a6f1d75744d8
(CHARSET_8_BIT_GRAPHIC): Define as 0x80.
Kenichi Handa <handa@m17n.org>
parents:
29004
diff
changeset
|
122 #define CHARSET_8_BIT_GRAPHIC 0x80 /* 0xA0..0xFF */ |
17052 | 123 |
124 extern int charset_latin_iso8859_1; /* ISO8859-1 (Latin-1) */ | |
125 extern int charset_jisx0208_1978; /* JISX0208.1978 (Japanese Kanji old set) */ | |
126 extern int charset_jisx0208; /* JISX0208.1983 (Japanese Kanji) */ | |
127 extern int charset_katakana_jisx0201; /* JISX0201.Kana (Japanese Katakana) */ | |
128 extern int charset_latin_jisx0201; /* JISX0201.Roman (Japanese Roman) */ | |
129 extern int charset_big5_1; /* Big5 Level 1 (Chinese Traditional) */ | |
130 extern int charset_big5_2; /* Big5 Level 2 (Chinese Traditional) */ | |
131 | |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
132 /* Check if CH is an ASCII character or a base leading-code. |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
133 Nowadays, any byte can be the first byte of a character in a |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
134 multibyte buffer/string. So this macro name is not appropriate. */ |
20531
f019e056ad9a
(CHAR_HEAD_P): Take char, not pointer, as arg.
Richard M. Stallman <rms@gnu.org>
parents:
20352
diff
changeset
|
135 #define CHAR_HEAD_P(ch) ((unsigned char) (ch) < 0xA0) |
17052 | 136 |
137 /*** GENERAL NOTE on CHARACTER REPRESENTATION *** | |
138 | |
35478 | 139 Firstly, the term "character" or "char" is used for a multilingual |
140 character (of course, including ASCII characters), not for a byte in | |
17052 | 141 computer memory. We use the term "code" or "byte" for the latter |
142 case. | |
143 | |
144 A character is identified by charset and one or two POSITION-CODEs. | |
145 POSITION-CODE is the position of the character in the charset. A | |
146 character of DIMENSION1 charset has one POSITION-CODE: POSITION-CODE-1. | |
147 A character of DIMENSION2 charset has two POSITION-CODE: | |
148 POSITION-CODE-1 and POSITION-CODE-2. The code range of | |
149 POSITION-CODE is 0x20..0x7F. | |
150 | |
151 Emacs has two kinds of representation of a character: multi-byte | |
35478 | 152 form (for buffers and strings) and single-word form (for character |
153 objects in Emacs Lisp). The latter is called "character code" | |
154 hereafter. Both representations encode the information of charset | |
155 and POSITION-CODE but in a different way (for instance, the MSB of | |
17052 | 156 POSITION-CODE is set in multi-byte form). |
157 | |
35478 | 158 For details of the multi-byte form, see the section "2. Emacs |
159 internal format handlers" of `coding.c'. | |
17052 | 160 |
161 Emacs uses 19 bits for a character code. The bits are divided into | |
162 3 fields: FIELD1(5bits):FIELD2(7bits):FIELD3(7bits). | |
163 | |
164 A character code of DIMENSION1 character uses FIELD2 to hold charset | |
165 and FIELD3 to hold POSITION-CODE-1. A character code of DIMENSION2 | |
166 character uses FIELD1 to hold charset, FIELD2 and FIELD3 to hold | |
167 POSITION-CODE-1 and POSITION-CODE-2 respectively. | |
168 | |
169 More precisely... | |
170 | |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
171 FIELD2 of DIMENSION1 character (except for ascii, eight-bit-control, |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
172 and eight-bit-graphic) is "charset - 0x70". This is to make all |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
173 character codes except for ASCII and 8-bit codes greater than 256. |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
174 So, the range of FIELD2 of DIMENSION1 character is 0, 1, or |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
175 0x11..0x7F. |
17052 | 176 |
177 FIELD1 of DIMENSION2 character is "charset - 0x8F" for official | |
178 charset and "charset - 0xE0" for private charset. So, the range of | |
179 FIELD1 of DIMENSION2 character is 0x01..0x1E. | |
180 | |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
181 ----------------------------------------------------------------------------- |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
182 charset FIELD1 (5-bit) FIELD2 (7-bit) FIELD3 (7-bit) |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
183 ----------------------------------------------------------------------------- |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
184 ascii 0 0 0x00..0x7F |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
185 eight-bit-control 0 1 0x00..0x1F |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
186 eight-bit-graphic 0 1 0x20..0x7F |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
187 DIMENSION1 0 charset - 0x70 POSITION-CODE-1 |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
188 DIMENSION2(o) charset - 0x8F POSITION-CODE-1 POSITION-CODE-2 |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
189 DIMENSION2(p) charset - 0xE0 POSITION-CODE-1 POSITION-CODE-2 |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
190 ----------------------------------------------------------------------------- |
17052 | 191 "(o)": official, "(p)": private |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
192 ----------------------------------------------------------------------------- |
17052 | 193 */ |
194 | |
195 /* Masks of each field of character code. */ | |
196 #define CHAR_FIELD1_MASK (0x1F << 14) | |
197 #define CHAR_FIELD2_MASK (0x7F << 7) | |
198 #define CHAR_FIELD3_MASK 0x7F | |
199 | |
200 /* Macros to access each field of character C. */ | |
201 #define CHAR_FIELD1(c) (((c) & CHAR_FIELD1_MASK) >> 14) | |
202 #define CHAR_FIELD2(c) (((c) & CHAR_FIELD2_MASK) >> 7) | |
203 #define CHAR_FIELD3(c) ((c) & CHAR_FIELD3_MASK) | |
204 | |
205 /* Minimum character code of character of each DIMENSION. */ | |
206 #define MIN_CHAR_OFFICIAL_DIMENSION1 \ | |
31460
30806f88340f
(MIN_CHARSET_OFFICIAL_DIMENSION1): Define it as 0x80, not 0x81.
Kenichi Handa <handa@m17n.org>
parents:
31434
diff
changeset
|
207 ((0x81 - 0x70) << 7) |
17052 | 208 #define MIN_CHAR_PRIVATE_DIMENSION1 \ |
209 ((MIN_CHARSET_PRIVATE_DIMENSION1 - 0x70) << 7) | |
210 #define MIN_CHAR_OFFICIAL_DIMENSION2 \ | |
211 ((MIN_CHARSET_OFFICIAL_DIMENSION2 - 0x8F) << 14) | |
212 #define MIN_CHAR_PRIVATE_DIMENSION2 \ | |
213 ((MIN_CHARSET_PRIVATE_DIMENSION2 - 0xE0) << 14) | |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
214 /* Maximum character code currently used plus 1. */ |
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
215 #define MAX_CHAR (0x1F << 14) |
17052 | 216 |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
217 /* 1 if C is a single byte character, else 0. */ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
218 #define SINGLE_BYTE_CHAR_P(c) ((unsigned) (c) < 0x100) |
17052 | 219 |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
220 /* 1 if BYTE is an ASCII character in itself, in multibyte mode. */ |
20257 | 221 #define ASCII_BYTE_P(byte) ((byte) < 0x80) |
222 | |
35478 | 223 /* A char-table containing information on each character set. |
17052 | 224 |
35478 | 225 Unlike ordinary char-tables, this doesn't contain any nested tables. |
17052 | 226 Only the top level elements are used. Each element is a vector of |
227 the following information: | |
228 CHARSET-ID, BYTES, DIMENSION, CHARS, WIDTH, DIRECTION, | |
229 LEADING-CODE-BASE, LEADING-CODE-EXT, | |
230 ISO-FINAL-CHAR, ISO-GRAPHIC-PLANE, | |
231 REVERSE-CHARSET, SHORT-NAME, LONG-NAME, DESCRIPTION, | |
232 PLIST. | |
233 | |
234 CHARSET-ID (integer) is the identification number of the charset. | |
235 | |
35478 | 236 BYTES (integer) is the length of the multi-byte form of a character |
237 in the charset: one of 1, 2, 3, and 4. | |
17052 | 238 |
239 DIMENSION (integer) is the number of bytes to represent a character: 1 or 2. | |
240 | |
241 CHARS (integer) is the number of characters in a dimension: 94 or 96. | |
242 | |
243 WIDTH (integer) is the number of columns a character in the charset | |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
244 occupies on the screen: one of 0, 1, and 2.. |
17052 | 245 |
246 DIRECTION (integer) is the rendering direction of characters in the | |
24777
d9d0dd9ebcb5
(Vcharset_table): Comment fixed.
Kenichi Handa <handa@m17n.org>
parents:
23882
diff
changeset
|
247 charset when rendering. If 0, render from left to right, else |
d9d0dd9ebcb5
(Vcharset_table): Comment fixed.
Kenichi Handa <handa@m17n.org>
parents:
23882
diff
changeset
|
248 render from right to left. |
17052 | 249 |
250 LEADING-CODE-BASE (integer) is the base leading-code for the | |
251 charset. | |
252 | |
253 LEADING-CODE-EXT (integer) is the extended leading-code for the | |
35478 | 254 charset. All charsets of less than 0xA0 have the value 0. |
17052 | 255 |
256 ISO-FINAL-CHAR (character) is the final character of the | |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
257 corresponding ISO 2022 charset. It is -1 for such a character |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
258 that is used only internally (e.g. `eight-bit-control'). |
17052 | 259 |
260 ISO-GRAPHIC-PLANE (integer) is the graphic plane to be invoked | |
261 while encoding to variants of ISO 2022 coding system, one of the | |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
262 following: 0/graphic-plane-left(GL), 1/graphic-plane-right(GR). It |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
263 is -1 for such a character that is used only internally |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
264 (e.g. `eight-bit-control'). |
17052 | 265 |
266 REVERSE-CHARSET (integer) is the charset which differs only in | |
267 LEFT-TO-RIGHT value from the charset. If there's no such a | |
268 charset, the value is -1. | |
35478 | 269 |
17052 | 270 SHORT-NAME (string) is the short name to refer to the charset. |
271 | |
272 LONG-NAME (string) is the long name to refer to the charset. | |
273 | |
274 DESCRIPTION (string) is the description string of the charset. | |
275 | |
276 PLIST (property list) may contain any type of information a user | |
35478 | 277 wants to put and get by functions `put-charset-property' and |
17052 | 278 `get-charset-property' respectively. */ |
279 extern Lisp_Object Vcharset_table; | |
280 | |
281 /* Macros to access various information of CHARSET in Vcharset_table. | |
282 We provide these macros for efficiency. No range check of CHARSET. */ | |
283 | |
28513
1fec001e68c5
(CHARSET_TABLE_ENTRY): Fix comment -- argument is a C int, not a lisp integer.
Ken Raeburn <raeburn@raeburn.org>
parents:
28473
diff
changeset
|
284 /* Return entry of CHARSET (C integer) in Vcharset_table. */ |
17321
9f837bea89e3
(CHARSET_TABLE_ENTRY): Handle ASCII charset correctly.
Kenichi Handa <handa@m17n.org>
parents:
17185
diff
changeset
|
285 #define CHARSET_TABLE_ENTRY(charset) \ |
9f837bea89e3
(CHARSET_TABLE_ENTRY): Handle ASCII charset correctly.
Kenichi Handa <handa@m17n.org>
parents:
17185
diff
changeset
|
286 XCHAR_TABLE (Vcharset_table)->contents[((charset) == CHARSET_ASCII \ |
9f837bea89e3
(CHARSET_TABLE_ENTRY): Handle ASCII charset correctly.
Kenichi Handa <handa@m17n.org>
parents:
17185
diff
changeset
|
287 ? 0 : (charset) + 128)] |
17052 | 288 |
289 /* Return information INFO-IDX of CHARSET. */ | |
290 #define CHARSET_TABLE_INFO(charset, info_idx) \ | |
291 XVECTOR (CHARSET_TABLE_ENTRY (charset))->contents[info_idx] | |
292 | |
293 #define CHARSET_ID_IDX (0) | |
294 #define CHARSET_BYTES_IDX (1) | |
295 #define CHARSET_DIMENSION_IDX (2) | |
296 #define CHARSET_CHARS_IDX (3) | |
297 #define CHARSET_WIDTH_IDX (4) | |
298 #define CHARSET_DIRECTION_IDX (5) | |
299 #define CHARSET_LEADING_CODE_BASE_IDX (6) | |
300 #define CHARSET_LEADING_CODE_EXT_IDX (7) | |
301 #define CHARSET_ISO_FINAL_CHAR_IDX (8) | |
302 #define CHARSET_ISO_GRAPHIC_PLANE_IDX (9) | |
303 #define CHARSET_REVERSE_CHARSET_IDX (10) | |
304 #define CHARSET_SHORT_NAME_IDX (11) | |
305 #define CHARSET_LONG_NAME_IDX (12) | |
306 #define CHARSET_DESCRIPTION_IDX (13) | |
307 #define CHARSET_PLIST_IDX (14) | |
308 /* Size of a vector of each entry of Vcharset_table. */ | |
309 #define CHARSET_MAX_IDX (15) | |
310 | |
311 /* And several more macros to be used frequently. */ | |
312 #define CHARSET_BYTES(charset) \ | |
313 XFASTINT (CHARSET_TABLE_INFO (charset, CHARSET_BYTES_IDX)) | |
314 #define CHARSET_DIMENSION(charset) \ | |
315 XFASTINT (CHARSET_TABLE_INFO (charset, CHARSET_DIMENSION_IDX)) | |
316 #define CHARSET_CHARS(charset) \ | |
317 XFASTINT (CHARSET_TABLE_INFO (charset, CHARSET_CHARS_IDX)) | |
318 #define CHARSET_WIDTH(charset) \ | |
319 XFASTINT (CHARSET_TABLE_INFO (charset, CHARSET_WIDTH_IDX)) | |
320 #define CHARSET_DIRECTION(charset) \ | |
321 XFASTINT (CHARSET_TABLE_INFO (charset, CHARSET_DIRECTION_IDX)) | |
322 #define CHARSET_LEADING_CODE_BASE(charset) \ | |
323 XFASTINT (CHARSET_TABLE_INFO (charset, CHARSET_LEADING_CODE_BASE_IDX)) | |
324 #define CHARSET_LEADING_CODE_EXT(charset) \ | |
325 XFASTINT (CHARSET_TABLE_INFO (charset, CHARSET_LEADING_CODE_EXT_IDX)) | |
326 #define CHARSET_ISO_FINAL_CHAR(charset) \ | |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
327 XINT (CHARSET_TABLE_INFO (charset, CHARSET_ISO_FINAL_CHAR_IDX)) |
17052 | 328 #define CHARSET_ISO_GRAPHIC_PLANE(charset) \ |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
329 XINT (CHARSET_TABLE_INFO (charset, CHARSET_ISO_GRAPHIC_PLANE_IDX)) |
17052 | 330 #define CHARSET_REVERSE_CHARSET(charset) \ |
331 XINT (CHARSET_TABLE_INFO (charset, CHARSET_REVERSE_CHARSET_IDX)) | |
332 | |
333 /* Macros to specify direction of a charset. */ | |
334 #define CHARSET_DIRECTION_LEFT_TO_RIGHT 0 | |
335 #define CHARSET_DIRECTION_RIGHT_TO_LEFT 1 | |
336 | |
337 /* A vector of charset symbol indexed by charset-id. This is used | |
338 only for returning charset symbol from C functions. */ | |
339 extern Lisp_Object Vcharset_symbol_table; | |
340 | |
341 /* Return symbol of CHARSET. */ | |
342 #define CHARSET_SYMBOL(charset) \ | |
343 XVECTOR (Vcharset_symbol_table)->contents[charset] | |
344 | |
25505
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
345 /* 1 if CHARSET is in valid value range, else 0. */ |
17052 | 346 #define CHARSET_VALID_P(charset) \ |
347 ((charset) == 0 \ | |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
348 || ((charset) > 0x80 && (charset) <= MAX_CHARSET_OFFICIAL_DIMENSION2) \ |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
349 || ((charset) >= MIN_CHARSET_PRIVATE_DIMENSION1 \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
350 && (charset) <= MAX_CHARSET) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
351 || ((charset) == CHARSET_8_BIT_CONTROL) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
352 || ((charset) == CHARSET_8_BIT_GRAPHIC)) |
17052 | 353 |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
354 /* 1 if CHARSET is already defined, else 0. */ |
17052 | 355 #define CHARSET_DEFINED_P(charset) \ |
17185
0d5a1bae9d73
(MAX_CHARSET): Definition changed to the actual
Kenichi Handa <handa@m17n.org>
parents:
17120
diff
changeset
|
356 (((charset) >= 0) && ((charset) <= MAX_CHARSET) \ |
17052 | 357 && !NILP (CHARSET_TABLE_ENTRY (charset))) |
358 | |
359 /* Since the information CHARSET-BYTES and CHARSET-WIDTH of | |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
360 Vcharset_table can be retrieved only by the first byte of |
17052 | 361 multi-byte form (an ASCII code or a base leading-code), we provide |
362 here tables to be used by macros BYTES_BY_CHAR_HEAD and | |
363 WIDTH_BY_CHAR_HEAD for faster information retrieval. */ | |
364 extern int bytes_by_char_head[256]; | |
365 extern int width_by_char_head[256]; | |
366 | |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
367 #define BYTES_BY_CHAR_HEAD(char_head) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
368 (ASCII_BYTE_P (char_head) ? 1 : bytes_by_char_head[char_head]) |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
369 #define WIDTH_BY_CHAR_HEAD(char_head) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
370 (ASCII_BYTE_P (char_head) ? 1 : width_by_char_head[char_head]) |
17052 | 371 |
372 /* Charset of the character C. */ | |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
373 #define CHAR_CHARSET(c) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
374 (SINGLE_BYTE_CHAR_P (c) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
375 ? (ASCII_BYTE_P (c) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
376 ? CHARSET_ASCII \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
377 : (c) < 0xA0 ? CHARSET_8_BIT_CONTROL : CHARSET_8_BIT_GRAPHIC) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
378 : ((c) < MIN_CHAR_OFFICIAL_DIMENSION2 \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
379 ? CHAR_FIELD2 (c) + 0x70 \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
380 : ((c) < MIN_CHAR_PRIVATE_DIMENSION2 \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
381 ? CHAR_FIELD1 (c) + 0x8F \ |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
382 : CHAR_FIELD1 (c) + 0xE0))) |
17052 | 383 |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
384 /* Check if two characters C1 and C2 belong to the same charset. */ |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
385 #define SAME_CHARSET_P(c1, c2) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
386 (c1 < MIN_CHAR_OFFICIAL_DIMENSION2 \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
387 ? (c1 & CHAR_FIELD2_MASK) == (c2 & CHAR_FIELD2_MASK) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
388 : (c1 & CHAR_FIELD1_MASK) == (c2 & CHAR_FIELD1_MASK)) |
17052 | 389 |
390 /* Return a character of which charset is CHARSET and position-codes | |
391 are C1 and C2. DIMENSION1 character ignores C2. */ | |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
392 #define MAKE_CHAR(charset, c1, c2) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
393 ((charset) == CHARSET_ASCII \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
394 ? (c1) & 0x7F \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
395 : (((charset) == CHARSET_8_BIT_CONTROL \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
396 || (charset) == CHARSET_8_BIT_GRAPHIC) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
397 ? ((c1) & 0x7F) | 0x80 \ |
30282
3d210892f575
(MAKE_CHAR): Return reasonable code even if CHARSET is undefined.
Kenichi Handa <handa@m17n.org>
parents:
29570
diff
changeset
|
398 : ((CHARSET_DEFINED_P (charset) \ |
3d210892f575
(MAKE_CHAR): Return reasonable code even if CHARSET is undefined.
Kenichi Handa <handa@m17n.org>
parents:
29570
diff
changeset
|
399 ? CHARSET_DIMENSION (charset) == 1 \ |
3d210892f575
(MAKE_CHAR): Return reasonable code even if CHARSET is undefined.
Kenichi Handa <handa@m17n.org>
parents:
29570
diff
changeset
|
400 : (charset) < MIN_CHARSET_PRIVATE_DIMENSION2) \ |
31434
28f0d4e9cbb2
(MAKE_CHAR): Be sure to set MSB of C1 to 0.
Kenichi Handa <handa@m17n.org>
parents:
30282
diff
changeset
|
401 ? (((charset) - 0x70) << 7) | ((c1) <= 0 ? 0 : ((c1) & 0x7F)) \ |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
402 : ((((charset) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
403 - ((charset) < MIN_CHARSET_PRIVATE_DIMENSION2 ? 0x8F : 0xE0)) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
404 << 14) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
405 | ((c2) <= 0 ? 0 : ((c2) & 0x7F)) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
406 | ((c1) <= 0 ? 0 : (((c1) & 0x7F) << 7)))))) |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
407 |
17052 | 408 |
20151
82ca32c55fa3
(CHAR_VALID_P): Renamed from VALID_CHAR_P, new
Kenichi Handa <handa@m17n.org>
parents:
19643
diff
changeset
|
409 /* If GENERICP is nonzero, return nonzero iff C is a valid normal or |
82ca32c55fa3
(CHAR_VALID_P): Renamed from VALID_CHAR_P, new
Kenichi Handa <handa@m17n.org>
parents:
19643
diff
changeset
|
410 generic character. If GENERICP is zero, return nonzero iff C is a |
82ca32c55fa3
(CHAR_VALID_P): Renamed from VALID_CHAR_P, new
Kenichi Handa <handa@m17n.org>
parents:
19643
diff
changeset
|
411 valid normal character. */ |
82ca32c55fa3
(CHAR_VALID_P): Renamed from VALID_CHAR_P, new
Kenichi Handa <handa@m17n.org>
parents:
19643
diff
changeset
|
412 #define CHAR_VALID_P(c, genericp) \ |
82ca32c55fa3
(CHAR_VALID_P): Renamed from VALID_CHAR_P, new
Kenichi Handa <handa@m17n.org>
parents:
19643
diff
changeset
|
413 ((c) >= 0 \ |
82ca32c55fa3
(CHAR_VALID_P): Renamed from VALID_CHAR_P, new
Kenichi Handa <handa@m17n.org>
parents:
19643
diff
changeset
|
414 && (SINGLE_BYTE_CHAR_P (c) || char_valid_p (c, genericp))) |
17833
59aa4a0772f6
(VALID_CHAR_P): New macro.
Kenichi Handa <handa@m17n.org>
parents:
17726
diff
changeset
|
415 |
22184
003ac1231096
(STRING_CHAR_AND_CHAR_LENGTH): New macro.
Kenichi Handa <handa@m17n.org>
parents:
22167
diff
changeset
|
416 /* This default value is used when nonascii-translation-table or |
21033
9f32198e0d9f
(NONASCII_INSERT_OFFSET): New macro.
Kenichi Handa <handa@m17n.org>
parents:
20932
diff
changeset
|
417 nonascii-insert-offset fail to convert unibyte character to a valid |
9f32198e0d9f
(NONASCII_INSERT_OFFSET): New macro.
Kenichi Handa <handa@m17n.org>
parents:
20932
diff
changeset
|
418 multibyte character. This makes a Latin-1 character. */ |
9f32198e0d9f
(NONASCII_INSERT_OFFSET): New macro.
Kenichi Handa <handa@m17n.org>
parents:
20932
diff
changeset
|
419 |
9f32198e0d9f
(NONASCII_INSERT_OFFSET): New macro.
Kenichi Handa <handa@m17n.org>
parents:
20932
diff
changeset
|
420 #define DEFAULT_NONASCII_INSERT_OFFSET 0x800 |
9f32198e0d9f
(NONASCII_INSERT_OFFSET): New macro.
Kenichi Handa <handa@m17n.org>
parents:
20932
diff
changeset
|
421 |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
422 /* Parse multibyte string STR of length LENGTH and set BYTES to the |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
423 byte length of a character at STR. */ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
424 |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
425 #ifdef BYTE_COMBINING_DEBUG |
25505
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
426 |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
427 #define PARSE_MULTIBYTE_SEQ(str, length, bytes) \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
428 do { \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
429 int i = 1; \ |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
430 while (i < (length) && ! CHAR_HEAD_P ((str)[i])) i++; \ |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
431 (bytes) = BYTES_BY_CHAR_HEAD ((str)[0]); \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
432 if ((bytes) > i) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
433 abort (); \ |
25505
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
434 } while (0) |
21033
9f32198e0d9f
(NONASCII_INSERT_OFFSET): New macro.
Kenichi Handa <handa@m17n.org>
parents:
20932
diff
changeset
|
435 |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
436 #else /* not BYTE_COMBINING_DEBUG */ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
437 |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
438 #define PARSE_MULTIBYTE_SEQ(str, length, bytes) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
439 (bytes) = BYTES_BY_CHAR_HEAD ((str)[0]) |
19319 | 440 |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
441 #endif /* not BYTE_COMBINING_DEBUG */ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
442 |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
443 /* Return 1 iff the byte sequence at unibyte string STR (LENGTH bytes) |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
444 is valid as a multibyte form. If valid, by a side effect, BYTES is |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
445 set to the byte length of the multibyte form. */ |
19319 | 446 |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
447 #define UNIBYTE_STR_AS_MULTIBYTE_P(str, length, bytes) \ |
29539
a6f1d75744d8
(CHARSET_8_BIT_GRAPHIC): Define as 0x80.
Kenichi Handa <handa@m17n.org>
parents:
29004
diff
changeset
|
448 (((str)[0] < 0x80 || (str)[0] >= 0xA0) \ |
a6f1d75744d8
(CHARSET_8_BIT_GRAPHIC): Define as 0x80.
Kenichi Handa <handa@m17n.org>
parents:
29004
diff
changeset
|
449 ? (bytes) = 1 \ |
a6f1d75744d8
(CHARSET_8_BIT_GRAPHIC): Define as 0x80.
Kenichi Handa <handa@m17n.org>
parents:
29004
diff
changeset
|
450 : (((bytes) = BYTES_BY_CHAR_HEAD ((str)[0])), \ |
31703
b5664da02625
(UNIBYTE_STR_AS_MULTIBYTE_P): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
31460
diff
changeset
|
451 ((bytes) > 1 && (bytes) <= (length) \ |
b5664da02625
(UNIBYTE_STR_AS_MULTIBYTE_P): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
31460
diff
changeset
|
452 && (str)[0] != LEADING_CODE_8_BIT_CONTROL \ |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
453 && !CHAR_HEAD_P ((str)[1]) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
454 && ((bytes) == 2 \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
455 || (!CHAR_HEAD_P ((str)[2]) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
456 && ((bytes) == 3 \ |
29539
a6f1d75744d8
(CHARSET_8_BIT_GRAPHIC): Define as 0x80.
Kenichi Handa <handa@m17n.org>
parents:
29004
diff
changeset
|
457 || !CHAR_HEAD_P ((str)[3]))))))) |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
458 |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
459 /* Return 1 iff the byte sequence at multibyte string STR is valid as |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
460 a unibyte form. By a side effect, BYTES is set to the byte length |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
461 of one character at STR. */ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
462 |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
463 #define MULTIBYTE_STR_AS_UNIBYTE_P(str, bytes) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
464 ((bytes) = BYTES_BY_CHAR_HEAD ((str)[0]), \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
465 (str)[0] != LEADING_CODE_8_BIT_CONTROL) |
17052 | 466 |
19319 | 467 /* The charset of character C is stored in CHARSET, and the |
468 position-codes of C are stored in C1 and C2. | |
25583 | 469 We store -1 in C2 if the dimension of the charset is 1. */ |
19319 | 470 |
30282
3d210892f575
(MAKE_CHAR): Return reasonable code even if CHARSET is undefined.
Kenichi Handa <handa@m17n.org>
parents:
29570
diff
changeset
|
471 #define SPLIT_CHAR(c, charset, c1, c2) \ |
3d210892f575
(MAKE_CHAR): Return reasonable code even if CHARSET is undefined.
Kenichi Handa <handa@m17n.org>
parents:
29570
diff
changeset
|
472 (SINGLE_BYTE_CHAR_P (c) \ |
3d210892f575
(MAKE_CHAR): Return reasonable code even if CHARSET is undefined.
Kenichi Handa <handa@m17n.org>
parents:
29570
diff
changeset
|
473 ? ((charset \ |
3d210892f575
(MAKE_CHAR): Return reasonable code even if CHARSET is undefined.
Kenichi Handa <handa@m17n.org>
parents:
29570
diff
changeset
|
474 = (ASCII_BYTE_P (c) \ |
3d210892f575
(MAKE_CHAR): Return reasonable code even if CHARSET is undefined.
Kenichi Handa <handa@m17n.org>
parents:
29570
diff
changeset
|
475 ? CHARSET_ASCII \ |
3d210892f575
(MAKE_CHAR): Return reasonable code even if CHARSET is undefined.
Kenichi Handa <handa@m17n.org>
parents:
29570
diff
changeset
|
476 : ((c) < 0xA0 ? CHARSET_8_BIT_CONTROL : CHARSET_8_BIT_GRAPHIC))), \ |
3d210892f575
(MAKE_CHAR): Return reasonable code even if CHARSET is undefined.
Kenichi Handa <handa@m17n.org>
parents:
29570
diff
changeset
|
477 c1 = (c), c2 = -1) \ |
3d210892f575
(MAKE_CHAR): Return reasonable code even if CHARSET is undefined.
Kenichi Handa <handa@m17n.org>
parents:
29570
diff
changeset
|
478 : ((c) & CHAR_FIELD1_MASK \ |
3d210892f575
(MAKE_CHAR): Return reasonable code even if CHARSET is undefined.
Kenichi Handa <handa@m17n.org>
parents:
29570
diff
changeset
|
479 ? (charset = (CHAR_FIELD1 (c) \ |
3d210892f575
(MAKE_CHAR): Return reasonable code even if CHARSET is undefined.
Kenichi Handa <handa@m17n.org>
parents:
29570
diff
changeset
|
480 + ((c) < MIN_CHAR_PRIVATE_DIMENSION2 ? 0x8F : 0xE0)), \ |
3d210892f575
(MAKE_CHAR): Return reasonable code even if CHARSET is undefined.
Kenichi Handa <handa@m17n.org>
parents:
29570
diff
changeset
|
481 c1 = CHAR_FIELD2 (c), \ |
3d210892f575
(MAKE_CHAR): Return reasonable code even if CHARSET is undefined.
Kenichi Handa <handa@m17n.org>
parents:
29570
diff
changeset
|
482 c2 = CHAR_FIELD3 (c)) \ |
3d210892f575
(MAKE_CHAR): Return reasonable code even if CHARSET is undefined.
Kenichi Handa <handa@m17n.org>
parents:
29570
diff
changeset
|
483 : (charset = CHAR_FIELD2 (c) + 0x70, \ |
3d210892f575
(MAKE_CHAR): Return reasonable code even if CHARSET is undefined.
Kenichi Handa <handa@m17n.org>
parents:
29570
diff
changeset
|
484 c1 = CHAR_FIELD3 (c), \ |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
485 c2 = -1))) |
17052 | 486 |
25505
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
487 /* Return 1 iff character C has valid printable glyph. */ |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
488 #define CHAR_PRINTABLE_P(c) (ASCII_BYTE_P (c) || char_printable_p (c)) |
25505
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
489 |
19319 | 490 /* The charset of the character at STR is stored in CHARSET, and the |
491 position-codes are stored in C1 and C2. | |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
492 We store -1 in C2 if the character is just 2 bytes. */ |
19319 | 493 |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
494 #define SPLIT_STRING(str, len, charset, c1, c2) \ |
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
495 ((BYTES_BY_CHAR_HEAD ((unsigned char) *(str)) < 2 \ |
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
496 || BYTES_BY_CHAR_HEAD ((unsigned char) *(str)) > len \ |
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
497 || split_string (str, len, &charset, &c1, &c2) < 0) \ |
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
498 ? c1 = *(str), charset = CHARSET_ASCII \ |
17052 | 499 : charset) |
500 | |
501 /* Mapping table from ISO2022's charset (specified by DIMENSION, | |
502 CHARS, and FINAL_CHAR) to Emacs' charset. Should be accessed by | |
503 macro ISO_CHARSET_TABLE (DIMENSION, CHARS, FINAL_CHAR). */ | |
504 extern int iso_charset_table[2][2][128]; | |
505 | |
506 #define ISO_CHARSET_TABLE(dimension, chars, final_char) \ | |
507 iso_charset_table[XINT (dimension) - 1][XINT (chars) > 94][XINT (final_char)] | |
508 | |
509 #define BASE_LEADING_CODE_P(c) (BYTES_BY_CHAR_HEAD ((unsigned char) (c)) > 1) | |
510 | |
23130 | 511 /* Return how many bytes C will occupy in a multibyte buffer. */ |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
512 #define CHAR_BYTES(c) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
513 (SINGLE_BYTE_CHAR_P (c) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
514 ? ((ASCII_BYTE_P (c) || (c) >= 0xA0) ? 1 : 2) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
515 : char_bytes (c)) |
23130 | 516 |
17052 | 517 /* The following two macros CHAR_STRING and STRING_CHAR are the main |
35478 | 518 entry points to convert between Emacs's two types of character |
17052 | 519 representations: multi-byte form and single-word form (character |
520 code). */ | |
521 | |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
522 /* Store multi-byte form of the character C in STR. The caller should |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
523 allocate at least MAX_MULTIBYTE_LENGTH bytes area at STR in |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
524 advance. Returns the length of the multi-byte form. If C is an |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
525 invalid character code, signal an error. */ |
17052 | 526 |
32353
803ca8bc08b2
(CHAR_STRING): Optimized for single byte characters.
Kenichi Handa <handa@m17n.org>
parents:
31703
diff
changeset
|
527 #define CHAR_STRING(c, str) \ |
803ca8bc08b2
(CHAR_STRING): Optimized for single byte characters.
Kenichi Handa <handa@m17n.org>
parents:
31703
diff
changeset
|
528 (SINGLE_BYTE_CHAR_P (c) \ |
803ca8bc08b2
(CHAR_STRING): Optimized for single byte characters.
Kenichi Handa <handa@m17n.org>
parents:
31703
diff
changeset
|
529 ? ((ASCII_BYTE_P (c) || c >= 0xA0) \ |
803ca8bc08b2
(CHAR_STRING): Optimized for single byte characters.
Kenichi Handa <handa@m17n.org>
parents:
31703
diff
changeset
|
530 ? (*(str) = (unsigned char)(c), 1) \ |
803ca8bc08b2
(CHAR_STRING): Optimized for single byte characters.
Kenichi Handa <handa@m17n.org>
parents:
31703
diff
changeset
|
531 : (*(str) = LEADING_CODE_8_BIT_CONTROL, *((str)+ 1) = c + 0x20, 2)) \ |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
532 : char_to_string (c, (unsigned char *) str)) |
17052 | 533 |
534 /* Return a character code of the character of which multi-byte form | |
535 is at STR and the length is LEN. If STR doesn't contain valid | |
536 multi-byte form, only the first byte in STR is returned. */ | |
537 | |
23653
67907ea2c6ac
(SPLIT_NON_ASCII_CHAR): Check dimension of an invalid
Kenichi Handa <handa@m17n.org>
parents:
23648
diff
changeset
|
538 #define STRING_CHAR(str, len) \ |
67907ea2c6ac
(SPLIT_NON_ASCII_CHAR): Check dimension of an invalid
Kenichi Handa <handa@m17n.org>
parents:
23648
diff
changeset
|
539 (BYTES_BY_CHAR_HEAD ((unsigned char) *(str)) == 1 \ |
67907ea2c6ac
(SPLIT_NON_ASCII_CHAR): Check dimension of an invalid
Kenichi Handa <handa@m17n.org>
parents:
23648
diff
changeset
|
540 ? (unsigned char) *(str) \ |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
541 : string_to_char (str, len, 0)) |
17052 | 542 |
25505
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
543 /* This is like STRING_CHAR but the third arg ACTUAL_LEN is set to the |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
544 length of the multi-byte form. Just to know the length, use |
17052 | 545 MULTIBYTE_FORM_LENGTH. */ |
546 | |
25505
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
547 #define STRING_CHAR_AND_LENGTH(str, len, actual_len) \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
548 (BYTES_BY_CHAR_HEAD ((unsigned char) *(str)) == 1 \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
549 ? ((actual_len) = 1), (unsigned char) *(str) \ |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
550 : string_to_char (str, len, &(actual_len))) |
22184
003ac1231096
(STRING_CHAR_AND_CHAR_LENGTH): New macro.
Kenichi Handa <handa@m17n.org>
parents:
22167
diff
changeset
|
551 |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
552 /* Fetch the "next" character from Lisp string STRING at byte position |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
553 BYTEIDX, character position CHARIDX. Store it into OUTPUT. |
20589
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
554 |
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
555 All the args must be side-effect-free. |
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
556 BYTEIDX and CHARIDX must be lvalues; |
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
557 we increment them past the character fetched. */ |
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
558 |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
559 #define FETCH_STRING_CHAR_ADVANCE(OUTPUT, STRING, CHARIDX, BYTEIDX) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
560 if (1) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
561 { \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
562 CHARIDX++; \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
563 if (STRING_MULTIBYTE (STRING)) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
564 { \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
565 unsigned char *ptr = &XSTRING (STRING)->data[BYTEIDX]; \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
566 int space_left = XSTRING (STRING)->size_byte - BYTEIDX; \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
567 int actual_len; \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
568 \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
569 OUTPUT = STRING_CHAR_AND_LENGTH (ptr, space_left, actual_len); \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
570 BYTEIDX += actual_len; \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
571 } \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
572 else \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
573 OUTPUT = XSTRING (STRING)->data[BYTEIDX++]; \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
574 } \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
575 else |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
576 |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
577 /* Like FETCH_STRING_CHAR_ADVANCE but assume STRING is multibyte. */ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
578 |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
579 #define FETCH_STRING_CHAR_ADVANCE_NO_CHECK(OUTPUT, STRING, CHARIDX, BYTEIDX) \ |
20589
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
580 if (1) \ |
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
581 { \ |
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
582 unsigned char *fetch_string_char_ptr = &XSTRING (STRING)->data[BYTEIDX]; \ |
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
583 int fetch_string_char_space_left = XSTRING (STRING)->size_byte - BYTEIDX; \ |
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
584 int actual_len; \ |
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
585 \ |
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
586 OUTPUT \ |
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
587 = STRING_CHAR_AND_LENGTH (fetch_string_char_ptr, \ |
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
588 fetch_string_char_space_left, actual_len); \ |
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
589 \ |
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
590 BYTEIDX += actual_len; \ |
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
591 CHARIDX++; \ |
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
592 } \ |
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
593 else |
3acb053e757e
(FETCH_STRING_CHAR_ADVANCE): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20531
diff
changeset
|
594 |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
595 /* Like FETCH_STRING_CHAR_ADVANCE but fetch character from the current |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
596 buffer. */ |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
597 |
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
598 #define FETCH_CHAR_ADVANCE(OUTPUT, CHARIDX, BYTEIDX) \ |
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
599 if (1) \ |
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
600 { \ |
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
601 CHARIDX++; \ |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
602 if (!NILP (current_buffer->enable_multibyte_characters)) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
603 { \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
604 unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
605 int space_left = ((CHARIDX < GPT ? GPT_BYTE : Z_BYTE) - BYTEIDX); \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
606 int actual_len; \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
607 \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
608 OUTPUT= STRING_CHAR_AND_LENGTH (ptr, space_left, actual_len); \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
609 BYTEIDX += actual_len; \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
610 } \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
611 else \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
612 { \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
613 OUTPUT = *(BYTE_POS_ADDR (BYTEIDX)); \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
614 BYTEIDX++; \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
615 } \ |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
616 } \ |
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
617 else |
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
618 |
17052 | 619 /* Return the length of the multi-byte form at string STR of length LEN. */ |
620 | |
21444
0cba6f211d7c
(MULTIBYTE_FORM_LENGTH): Don't check LEN here.
Kenichi Handa <handa@m17n.org>
parents:
21419
diff
changeset
|
621 #define MULTIBYTE_FORM_LENGTH(str, len) \ |
0cba6f211d7c
(MULTIBYTE_FORM_LENGTH): Don't check LEN here.
Kenichi Handa <handa@m17n.org>
parents:
21419
diff
changeset
|
622 (BYTES_BY_CHAR_HEAD (*(unsigned char *)(str)) == 1 \ |
0cba6f211d7c
(MULTIBYTE_FORM_LENGTH): Don't check LEN here.
Kenichi Handa <handa@m17n.org>
parents:
21419
diff
changeset
|
623 ? 1 \ |
17052 | 624 : multibyte_form_length (str, len)) |
625 | |
626 #ifdef emacs | |
627 | |
25505
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
628 /* Increase the buffer byte position POS_BYTE of the current buffer to |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
629 the next character boundary. This macro relies on the fact that |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
630 *GPT_ADDR and *Z_ADDR are always accessible and the values are |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
631 '\0'. No range checking of POS. */ |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
632 |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
633 #ifdef BYTE_COMBINING_DEBUG |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
634 |
25505
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
635 #define INC_POS(pos_byte) \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
636 do { \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
637 unsigned char *p = BYTE_POS_ADDR (pos_byte); \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
638 if (BASE_LEADING_CODE_P (*p)) \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
639 { \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
640 int len, bytes; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
641 len = Z_BYTE - pos_byte; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
642 PARSE_MULTIBYTE_SEQ (p, len, bytes); \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
643 pos_byte += bytes; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
644 } \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
645 else \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
646 pos_byte++; \ |
17052 | 647 } while (0) |
648 | |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
649 #else /* not BYTE_COMBINING_DEBUG */ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
650 |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
651 #define INC_POS(pos_byte) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
652 do { \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
653 unsigned char *p = BYTE_POS_ADDR (pos_byte); \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
654 pos_byte += BYTES_BY_CHAR_HEAD (*p); \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
655 } while (0) |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
656 |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
657 #endif /* not BYTE_COMBINING_DEBUG */ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
658 |
25505
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
659 /* Decrease the buffer byte position POS_BYTE of the current buffer to |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
660 the previous character boundary. No range checking of POS. */ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
661 #define DEC_POS(pos_byte) \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
662 do { \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
663 unsigned char *p, *p_min; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
664 \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
665 pos_byte--; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
666 if (pos_byte < GPT_BYTE) \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
667 p = BEG_ADDR + pos_byte - 1, p_min = BEG_ADDR; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
668 else \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
669 p = BEG_ADDR + GAP_SIZE + pos_byte - 1, p_min = GAP_END_ADDR; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
670 if (p > p_min && !CHAR_HEAD_P (*p)) \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
671 { \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
672 unsigned char *pend = p--; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
673 int len, bytes; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
674 while (p > p_min && !CHAR_HEAD_P (*p)) p--; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
675 len = pend + 1 - p; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
676 PARSE_MULTIBYTE_SEQ (p, len, bytes); \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
677 if (bytes == len) \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
678 pos_byte -= len - 1; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
679 } \ |
20531
f019e056ad9a
(CHAR_HEAD_P): Take char, not pointer, as arg.
Richard M. Stallman <rms@gnu.org>
parents:
20352
diff
changeset
|
680 } while (0) |
f019e056ad9a
(CHAR_HEAD_P): Take char, not pointer, as arg.
Richard M. Stallman <rms@gnu.org>
parents:
20352
diff
changeset
|
681 |
f019e056ad9a
(CHAR_HEAD_P): Take char, not pointer, as arg.
Richard M. Stallman <rms@gnu.org>
parents:
20352
diff
changeset
|
682 /* Increment both CHARPOS and BYTEPOS, each in the appropriate way. */ |
f019e056ad9a
(CHAR_HEAD_P): Take char, not pointer, as arg.
Richard M. Stallman <rms@gnu.org>
parents:
20352
diff
changeset
|
683 |
20904
79d73f468e38
(INC_BOTH, DEC_BOTH): In unibyte mode, simply increment bytepos.
Richard M. Stallman <rms@gnu.org>
parents:
20759
diff
changeset
|
684 #define INC_BOTH(charpos, bytepos) \ |
79d73f468e38
(INC_BOTH, DEC_BOTH): In unibyte mode, simply increment bytepos.
Richard M. Stallman <rms@gnu.org>
parents:
20759
diff
changeset
|
685 do \ |
79d73f468e38
(INC_BOTH, DEC_BOTH): In unibyte mode, simply increment bytepos.
Richard M. Stallman <rms@gnu.org>
parents:
20759
diff
changeset
|
686 { \ |
79d73f468e38
(INC_BOTH, DEC_BOTH): In unibyte mode, simply increment bytepos.
Richard M. Stallman <rms@gnu.org>
parents:
20759
diff
changeset
|
687 (charpos)++; \ |
79d73f468e38
(INC_BOTH, DEC_BOTH): In unibyte mode, simply increment bytepos.
Richard M. Stallman <rms@gnu.org>
parents:
20759
diff
changeset
|
688 if (NILP (current_buffer->enable_multibyte_characters)) \ |
79d73f468e38
(INC_BOTH, DEC_BOTH): In unibyte mode, simply increment bytepos.
Richard M. Stallman <rms@gnu.org>
parents:
20759
diff
changeset
|
689 (bytepos)++; \ |
79d73f468e38
(INC_BOTH, DEC_BOTH): In unibyte mode, simply increment bytepos.
Richard M. Stallman <rms@gnu.org>
parents:
20759
diff
changeset
|
690 else \ |
79d73f468e38
(INC_BOTH, DEC_BOTH): In unibyte mode, simply increment bytepos.
Richard M. Stallman <rms@gnu.org>
parents:
20759
diff
changeset
|
691 INC_POS ((bytepos)); \ |
79d73f468e38
(INC_BOTH, DEC_BOTH): In unibyte mode, simply increment bytepos.
Richard M. Stallman <rms@gnu.org>
parents:
20759
diff
changeset
|
692 } \ |
20531
f019e056ad9a
(CHAR_HEAD_P): Take char, not pointer, as arg.
Richard M. Stallman <rms@gnu.org>
parents:
20352
diff
changeset
|
693 while (0) |
f019e056ad9a
(CHAR_HEAD_P): Take char, not pointer, as arg.
Richard M. Stallman <rms@gnu.org>
parents:
20352
diff
changeset
|
694 |
f019e056ad9a
(CHAR_HEAD_P): Take char, not pointer, as arg.
Richard M. Stallman <rms@gnu.org>
parents:
20352
diff
changeset
|
695 /* Decrement both CHARPOS and BYTEPOS, each in the appropriate way. */ |
f019e056ad9a
(CHAR_HEAD_P): Take char, not pointer, as arg.
Richard M. Stallman <rms@gnu.org>
parents:
20352
diff
changeset
|
696 |
20904
79d73f468e38
(INC_BOTH, DEC_BOTH): In unibyte mode, simply increment bytepos.
Richard M. Stallman <rms@gnu.org>
parents:
20759
diff
changeset
|
697 #define DEC_BOTH(charpos, bytepos) \ |
79d73f468e38
(INC_BOTH, DEC_BOTH): In unibyte mode, simply increment bytepos.
Richard M. Stallman <rms@gnu.org>
parents:
20759
diff
changeset
|
698 do \ |
79d73f468e38
(INC_BOTH, DEC_BOTH): In unibyte mode, simply increment bytepos.
Richard M. Stallman <rms@gnu.org>
parents:
20759
diff
changeset
|
699 { \ |
79d73f468e38
(INC_BOTH, DEC_BOTH): In unibyte mode, simply increment bytepos.
Richard M. Stallman <rms@gnu.org>
parents:
20759
diff
changeset
|
700 (charpos)--; \ |
79d73f468e38
(INC_BOTH, DEC_BOTH): In unibyte mode, simply increment bytepos.
Richard M. Stallman <rms@gnu.org>
parents:
20759
diff
changeset
|
701 if (NILP (current_buffer->enable_multibyte_characters)) \ |
79d73f468e38
(INC_BOTH, DEC_BOTH): In unibyte mode, simply increment bytepos.
Richard M. Stallman <rms@gnu.org>
parents:
20759
diff
changeset
|
702 (bytepos)--; \ |
79d73f468e38
(INC_BOTH, DEC_BOTH): In unibyte mode, simply increment bytepos.
Richard M. Stallman <rms@gnu.org>
parents:
20759
diff
changeset
|
703 else \ |
79d73f468e38
(INC_BOTH, DEC_BOTH): In unibyte mode, simply increment bytepos.
Richard M. Stallman <rms@gnu.org>
parents:
20759
diff
changeset
|
704 DEC_POS ((bytepos)); \ |
79d73f468e38
(INC_BOTH, DEC_BOTH): In unibyte mode, simply increment bytepos.
Richard M. Stallman <rms@gnu.org>
parents:
20759
diff
changeset
|
705 } \ |
20531
f019e056ad9a
(CHAR_HEAD_P): Take char, not pointer, as arg.
Richard M. Stallman <rms@gnu.org>
parents:
20352
diff
changeset
|
706 while (0) |
f019e056ad9a
(CHAR_HEAD_P): Take char, not pointer, as arg.
Richard M. Stallman <rms@gnu.org>
parents:
20352
diff
changeset
|
707 |
25505
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
708 /* Increase the buffer byte position POS_BYTE of the current buffer to |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
709 the next character boundary. This macro relies on the fact that |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
710 *GPT_ADDR and *Z_ADDR are always accessible and the values are |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
711 '\0'. No range checking of POS_BYTE. */ |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
712 |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
713 #ifdef BYTE_COMBINING_DEBUG |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
714 |
25505
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
715 #define BUF_INC_POS(buf, pos_byte) \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
716 do { \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
717 unsigned char *p = BUF_BYTE_ADDRESS (buf, pos_byte); \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
718 if (BASE_LEADING_CODE_P (*p)) \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
719 { \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
720 int len, bytes; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
721 len = BUF_Z_BYTE (buf) - pos_byte; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
722 PARSE_MULTIBYTE_SEQ (p, len, bytes); \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
723 pos_byte += bytes; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
724 } \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
725 else \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
726 pos_byte++; \ |
20531
f019e056ad9a
(CHAR_HEAD_P): Take char, not pointer, as arg.
Richard M. Stallman <rms@gnu.org>
parents:
20352
diff
changeset
|
727 } while (0) |
f019e056ad9a
(CHAR_HEAD_P): Take char, not pointer, as arg.
Richard M. Stallman <rms@gnu.org>
parents:
20352
diff
changeset
|
728 |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
729 #else /* not BYTE_COMBINING_DEBUG */ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
730 |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
731 #define BUF_INC_POS(buf, pos_byte) \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
732 do { \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
733 unsigned char *p = BUF_BYTE_ADDRESS (buf, pos_byte); \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
734 pos_byte += BYTES_BY_CHAR_HEAD (*p); \ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
735 } while (0) |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
736 |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
737 #endif /* not BYTE_COMBINING_DEBUG */ |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
738 |
25505
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
739 /* Decrease the buffer byte position POS_BYTE of the current buffer to |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
740 the previous character boundary. No range checking of POS_BYTE. */ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
741 #define BUF_DEC_POS(buf, pos_byte) \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
742 do { \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
743 unsigned char *p, *p_min; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
744 pos_byte--; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
745 if (pos_byte < BUF_GPT_BYTE (buf)) \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
746 { \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
747 p = BUF_BEG_ADDR (buf) + pos_byte - 1; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
748 p_min = BUF_BEG_ADDR (buf); \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
749 } \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
750 else \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
751 { \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
752 p = BUF_BEG_ADDR (buf) + BUF_GAP_SIZE (buf) + pos_byte - 1; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
753 p_min = BUF_GAP_END_ADDR (buf); \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
754 } \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
755 if (p > p_min && !CHAR_HEAD_P (*p)) \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
756 { \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
757 unsigned char *pend = p--; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
758 int len, bytes; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
759 while (p > p_min && !CHAR_HEAD_P (*p)) p--; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
760 len = pend + 1 - p; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
761 PARSE_MULTIBYTE_SEQ (p, len, bytes); \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
762 if (bytes == len) \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
763 pos_byte -= len - 1; \ |
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
764 } \ |
17052 | 765 } while (0) |
766 | |
767 #endif /* emacs */ | |
768 | |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
769 /* This is the maximum byte length of multi-byte sequence. */ |
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
770 #define MAX_MULTIBYTE_LENGTH 4 |
17185
0d5a1bae9d73
(MAX_CHARSET): Definition changed to the actual
Kenichi Handa <handa@m17n.org>
parents:
17120
diff
changeset
|
771 |
20932
3c2c8431c51d
(INC_POS): Use macro BASE_LEADING_CODE_P.
Kenichi Handa <handa@m17n.org>
parents:
20904
diff
changeset
|
772 extern void invalid_character P_ ((int)); |
3c2c8431c51d
(INC_POS): Use macro BASE_LEADING_CODE_P.
Kenichi Handa <handa@m17n.org>
parents:
20904
diff
changeset
|
773 |
22120
90f77c401689
Change terms unify/unification to
Kenichi Handa <handa@m17n.org>
parents:
21444
diff
changeset
|
774 extern int translate_char P_ ((Lisp_Object, int, int, int, int)); |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
775 extern int split_string P_ ((const unsigned char *, int, int *, |
20308
8d520e3dcb86
Add more prototypes and function declarations.
Andreas Schwab <schwab@suse.de>
parents:
20257
diff
changeset
|
776 unsigned char *, unsigned char *)); |
26843
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
777 extern int char_to_string P_ ((int, unsigned char *)); |
0aadeca4a4a7
In this entry, just `Modified' means that codes for a
Kenichi Handa <handa@m17n.org>
parents:
25637
diff
changeset
|
778 extern int string_to_char P_ ((const unsigned char *, int, int *)); |
25505
4d5f87073d63
(MAKE_NON_ASCII_CHAR): Handle the case that C1 or C2
Kenichi Handa <handa@m17n.org>
parents:
25234
diff
changeset
|
779 extern int char_printable_p P_ ((int c)); |
21419
95aae2ff5fcd
(string_to_non_ascii_char, multibyte_form_length)
Karl Heuer <kwzh@gnu.org>
parents:
21416
diff
changeset
|
780 extern int multibyte_form_length P_ ((const unsigned char *, int)); |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
781 extern void parse_str_as_multibyte P_ ((unsigned char *, int, int *, int *)); |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
782 extern int str_as_multibyte P_ ((unsigned char *, int, int, int *)); |
35949
6f52e8c1039f
(parse_str_to_multibyte): Extern it.
Kenichi Handa <handa@m17n.org>
parents:
35478
diff
changeset
|
783 extern int parse_str_to_multibyte P_ ((unsigned char *, int)); |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
784 extern int str_to_multibyte P_ ((unsigned char *, int, int)); |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
785 extern int str_as_unibyte P_ ((unsigned char *, int)); |
20308
8d520e3dcb86
Add more prototypes and function declarations.
Andreas Schwab <schwab@suse.de>
parents:
20257
diff
changeset
|
786 extern int get_charset_id P_ ((Lisp_Object)); |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
787 extern int find_charset_in_text P_ ((unsigned char *, int, int, int *, |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
788 Lisp_Object)); |
20308
8d520e3dcb86
Add more prototypes and function declarations.
Andreas Schwab <schwab@suse.de>
parents:
20257
diff
changeset
|
789 extern int strwidth P_ ((unsigned char *, int)); |
35408
9a2cf1e0032c
(c_string_width, lisp_string_width): Extern them.
Kenichi Handa <handa@m17n.org>
parents:
32353
diff
changeset
|
790 extern int c_string_width P_ ((unsigned char *, int, int, int *, int *)); |
9a2cf1e0032c
(c_string_width, lisp_string_width): Extern them.
Kenichi Handa <handa@m17n.org>
parents:
32353
diff
changeset
|
791 extern int lisp_string_width P_ ((Lisp_Object, int, int *, int *)); |
23130 | 792 extern int char_bytes P_ ((int)); |
23810 | 793 extern int char_valid_p P_ ((int, int)); |
17726 | 794 |
22184
003ac1231096
(STRING_CHAR_AND_CHAR_LENGTH): New macro.
Kenichi Handa <handa@m17n.org>
parents:
22167
diff
changeset
|
795 extern Lisp_Object Vtranslation_table_vector; |
22120
90f77c401689
Change terms unify/unification to
Kenichi Handa <handa@m17n.org>
parents:
21444
diff
changeset
|
796 |
22184
003ac1231096
(STRING_CHAR_AND_CHAR_LENGTH): New macro.
Kenichi Handa <handa@m17n.org>
parents:
22167
diff
changeset
|
797 /* Return a translation table of id number ID. */ |
22120
90f77c401689
Change terms unify/unification to
Kenichi Handa <handa@m17n.org>
parents:
21444
diff
changeset
|
798 #define GET_TRANSLATION_TABLE(id) \ |
25637
2e3ab6dece24
(GET_TRANSLATION_TABLE): Use XCDR.
Ken Raeburn <raeburn@raeburn.org>
parents:
25583
diff
changeset
|
799 (XCDR(XVECTOR(Vtranslation_table_vector)->contents[(id)])) |
20719 | 800 |
23488
958ab288116d
(Vauto_fill_chars): Extern it.
Kenichi Handa <handa@m17n.org>
parents:
23202
diff
changeset
|
801 /* A char-table for characters which may invoke auto-filling. */ |
958ab288116d
(Vauto_fill_chars): Extern it.
Kenichi Handa <handa@m17n.org>
parents:
23202
diff
changeset
|
802 extern Lisp_Object Vauto_fill_chars; |
958ab288116d
(Vauto_fill_chars): Extern it.
Kenichi Handa <handa@m17n.org>
parents:
23202
diff
changeset
|
803 |
20719 | 804 /* Copy LEN bytes from FROM to TO. This macro should be used only |
805 when a caller knows that LEN is short and the obvious copy loop is | |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
806 faster than calling bcopy which has some overhead. Copying a |
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
807 multibyte sequence of a multibyte character is the typical case. */ |
20719 | 808 |
809 #define BCOPY_SHORT(from, to, len) \ | |
810 do { \ | |
811 int i = len; \ | |
25234
17336b4fc693
(BCOPY_SHORT): Fix typo `unsigined'.
Karl Heuer <kwzh@gnu.org>
parents:
25016
diff
changeset
|
812 unsigned char *from_p = from, *to_p = to; \ |
29004
383e4e21306a
(LEADING_CODE_8_BIT_CONTROL, CHARSET_8_BIT_CONTROL,
Kenichi Handa <handa@m17n.org>
parents:
28513
diff
changeset
|
813 while (i--) *to_p++ = *from_p++; \ |
20719 | 814 } while (0) |
815 | |
29570
825505ff211e
(EMACS_CHARSET_H): Renamed from _CHARSET_H.
Kenichi Handa <handa@m17n.org>
parents:
29539
diff
changeset
|
816 #endif /* EMACS_CHARSET_H */ |