aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2002-10-09 05:16:05 +0000
committerKenichi Handa2002-10-09 05:16:05 +0000
commiteb41da4cb95b6715df1f76e185625144d37b5653 (patch)
tree4abfb38b3df62d619d9a6c50cdec5f1c668de65a
parent1693359a535279c5ee7acdd2ed243ea645afa244 (diff)
downloademacs-eb41da4cb95b6715df1f76e185625144d37b5653.tar.gz
emacs-eb41da4cb95b6715df1f76e185625144d37b5653.zip
(CHAR_STRING): Call char_string if C is greater than
MAX_3_BYTE_CHAR. (CHAR_STRING_ADVANCE): Likewise. (STRING_CHAR): Call string_char instead of string_char_with_unification. (STRING_CHAR_AND_LENGTH): Likewise. (STRING_CHAR_ADVANCE): Likewise.
-rw-r--r--src/character.h58
1 files changed, 27 insertions, 31 deletions
diff --git a/src/character.h b/src/character.h
index b2ddccde542..0d41f5a0982 100644
--- a/src/character.h
+++ b/src/character.h
@@ -161,15 +161,11 @@ extern int unibyte_to_multibyte_table[256];
161 (p)[1] = (0x80 | (((c) >> 6) & 0x3F)), \ 161 (p)[1] = (0x80 | (((c) >> 6) & 0x3F)), \
162 (p)[2] = (0x80 | ((c) & 0x3F)), \ 162 (p)[2] = (0x80 | ((c) & 0x3F)), \
163 3) \ 163 3) \
164 : (unsigned) (c) <= MAX_5_BYTE_CHAR \ 164 : char_string (c, p))
165 ? char_string_with_unification (c, p) \
166 : ((p)[0] = (0xC0 | (((c) >> 6) & 0x01)), \
167 (p)[1] = (0x80 | ((c) & 0x3F)), \
168 2))
169 165
170/* Store multibyte form of eight-bit char B in P. The caller should 166/* Store multibyte form of byte B in P. The caller should allocate at
171 allocate at least MAX_MULTIBYTE_LENGTH bytes area at P in advance. 167 least MAX_MULTIBYTE_LENGTH bytes area at P in advance. Returns the
172 Returns the length of the multibyte form. */ 168 length of the multibyte form. */
173 169
174#define BYTE8_STRING(b, p) \ 170#define BYTE8_STRING(b, p) \
175 ((p)[0] = (0xC0 | (((b) >> 6) & 0x01)), \ 171 ((p)[0] = (0xC0 | (((b) >> 6) & 0x01)), \
@@ -181,24 +177,22 @@ extern int unibyte_to_multibyte_table[256];
181 allocate at least MAX_MULTIBYTE_LENGTH bytes area at P in advance. 177 allocate at least MAX_MULTIBYTE_LENGTH bytes area at P in advance.
182 And, advance P to the end of the multibyte form. */ 178 And, advance P to the end of the multibyte form. */
183 179
184#define CHAR_STRING_ADVANCE(c, p) \ 180#define CHAR_STRING_ADVANCE(c, p) \
185 do { \ 181 do { \
186 if ((c) <= MAX_1_BYTE_CHAR) \ 182 if ((c) <= MAX_1_BYTE_CHAR) \
187 *(p)++ = (c); \ 183 *(p)++ = (c); \
188 else if ((c) <= MAX_2_BYTE_CHAR) \ 184 else if ((c) <= MAX_2_BYTE_CHAR) \
189 *(p)++ = (0xC0 | ((c) >> 6)), \ 185 *(p)++ = (0xC0 | ((c) >> 6)), \
190 *(p)++ = (0x80 | ((c) & 0x3F)); \ 186 *(p)++ = (0x80 | ((c) & 0x3F)); \
191 else if ((c) <= MAX_3_BYTE_CHAR) \ 187 else if ((c) <= MAX_3_BYTE_CHAR) \
192 *(p)++ = (0xE0 | ((c) >> 12)), \ 188 *(p)++ = (0xE0 | ((c) >> 12)), \
193 *(p)++ = (0x80 | (((c) >> 6) & 0x3F)), \ 189 *(p)++ = (0x80 | (((c) >> 6) & 0x3F)), \
194 *(p)++ = (0x80 | ((c) & 0x3F)); \ 190 *(p)++ = (0x80 | ((c) & 0x3F)); \
195 else if ((c) <= MAX_5_BYTE_CHAR) \ 191 else \
196 (p) += char_string_with_unification ((c), (p)); \ 192 (p) += char_string ((c), (p)); \
197 else \
198 *(p)++ = (0xC0 | (((c) >> 6) & 0x01)), \
199 *(p)++ = (0x80 | ((c) & 0x3F)); \
200 } while (0) 193 } while (0)
201 194
195
202/* Nonzero iff BYTE starts a non-ASCII character in a multibyte 196/* Nonzero iff BYTE starts a non-ASCII character in a multibyte
203 form. */ 197 form. */
204#define LEADING_CODE_P(byte) (((byte) & 0xC0) == 0xC0) 198#define LEADING_CODE_P(byte) (((byte) & 0xC0) == 0xC0)
@@ -290,7 +284,7 @@ extern int unibyte_to_multibyte_table[256];
290 ? ((((p)[0] & 0x0F) << 12) \ 284 ? ((((p)[0] & 0x0F) << 12) \
291 | (((p)[1] & 0x3F) << 6) \ 285 | (((p)[1] & 0x3F) << 6) \
292 | ((p)[2] & 0x3F)) \ 286 | ((p)[2] & 0x3F)) \
293 : string_char_with_unification ((p), NULL, NULL)) 287 : string_char ((p), NULL, NULL))
294 288
295 289
296/* Like STRING_CHAR but set ACTUAL_LEN to the length of multibyte 290/* Like STRING_CHAR but set ACTUAL_LEN to the length of multibyte
@@ -310,7 +304,7 @@ extern int unibyte_to_multibyte_table[256];
310 ((((p)[0] & 0x0F) << 12) \ 304 ((((p)[0] & 0x0F) << 12) \
311 | (((p)[1] & 0x3F) << 6) \ 305 | (((p)[1] & 0x3F) << 6) \
312 | ((p)[2] & 0x3F))) \ 306 | ((p)[2] & 0x3F))) \
313 : string_char_with_unification ((p), NULL, &actual_len)) 307 : string_char ((p), NULL, &actual_len))
314 308
315 309
316/* Like STRING_CHAR but advacen P to the end of multibyte form. */ 310/* Like STRING_CHAR but advacen P to the end of multibyte form. */
@@ -328,7 +322,7 @@ extern int unibyte_to_multibyte_table[256];
328 ((((p)[-3] & 0x0F) << 12) \ 322 ((((p)[-3] & 0x0F) << 12) \
329 | (((p)[-2] & 0x3F) << 6) \ 323 | (((p)[-2] & 0x3F) << 6) \
330 | ((p)[-1] & 0x3F))) \ 324 | ((p)[-1] & 0x3F))) \
331 : string_char_with_unification ((p), &(p), NULL)) 325 : string_char ((p), &(p), NULL))
332 326
333 327
334/* Fetch the "next" character from Lisp string STRING at byte position 328/* Fetch the "next" character from Lisp string STRING at byte position
@@ -521,7 +515,8 @@ extern int unibyte_to_multibyte_table[256];
521 515
522 516
523#define MAYBE_UNIFY_CHAR(c) \ 517#define MAYBE_UNIFY_CHAR(c) \
524 if (CHAR_TABLE_P (Vchar_unify_table)) \ 518 if (c > MAX_UNICODE_CHAR \
519 && CHAR_TABLE_P (Vchar_unify_table)) \
525 { \ 520 { \
526 Lisp_Object val; \ 521 Lisp_Object val; \
527 int unified; \ 522 int unified; \
@@ -563,9 +558,10 @@ extern int unibyte_to_multibyte_table[256];
563 ? ASCII_CHAR_WIDTH (c) \ 558 ? ASCII_CHAR_WIDTH (c) \
564 : XINT (CHAR_TABLE_REF (Vchar_width_table, c))) 559 : XINT (CHAR_TABLE_REF (Vchar_width_table, c)))
565 560
566extern int char_string_with_unification P_ ((int, unsigned char *)); 561extern int char_resolve_modifier_mask P_ ((int));
567extern int string_char_with_unification P_ ((const unsigned char *, 562extern int char_string P_ ((int, unsigned char *));
568 const unsigned char **, int *)); 563extern int string_char P_ ((const unsigned char *,
564 const unsigned char **, int *));
569 565
570extern int translate_char P_ ((Lisp_Object, int c)); 566extern int translate_char P_ ((Lisp_Object, int c));
571extern int char_printable_p P_ ((int c)); 567extern int char_printable_p P_ ((int c));