diff options
| author | Dmitry Antipov | 2014-06-23 08:11:29 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2014-06-23 08:11:29 +0400 |
| commit | 200fc9496f7e2d53610e31634fdcd750d1870279 (patch) | |
| tree | 50114538abd0729d13d05e95a3f48dbb742f5528 /src | |
| parent | 33848c48a5e8823f44994624443fabdf615292dc (diff) | |
| download | emacs-200fc9496f7e2d53610e31634fdcd750d1870279.tar.gz emacs-200fc9496f7e2d53610e31634fdcd750d1870279.zip | |
Simplify and cleanup character conversion stuff.
* lisp.h (multibyte_char_to_unibyte, multibyte_char_to_unibyte_safe):
Remove prototypes.
* character.c (multibyte_char_to_unibyte)
(multibyte_char_to_unibyte_safe): Remove; no longer used.
* character.h (make_char): Remove; unused.
(CHAR_TO_BYTE8, CHAR_TO_BYTE_SAFE): Simplify.
(ASCII_BYTE_P): Remove; ASCII_CHAR_P does the same thing.
* buffer.c, charset.c, charset.h, cmds.c, coding.c, editfns.c:
* fileio.c, indent.c, insdel.c, keyboard.c, lread.c, print.c:
* search.c, term.c, xdisp.c, xterm.c: Related users changed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 14 | ||||
| -rw-r--r-- | src/buffer.c | 4 | ||||
| -rw-r--r-- | src/character.c | 26 | ||||
| -rw-r--r-- | src/character.h | 22 | ||||
| -rw-r--r-- | src/charset.c | 6 | ||||
| -rw-r--r-- | src/charset.h | 2 | ||||
| -rw-r--r-- | src/cmds.c | 4 | ||||
| -rw-r--r-- | src/coding.c | 36 | ||||
| -rw-r--r-- | src/editfns.c | 14 | ||||
| -rw-r--r-- | src/fileio.c | 2 | ||||
| -rw-r--r-- | src/indent.c | 2 | ||||
| -rw-r--r-- | src/insdel.c | 2 | ||||
| -rw-r--r-- | src/keyboard.c | 2 | ||||
| -rw-r--r-- | src/lisp.h | 2 | ||||
| -rw-r--r-- | src/lread.c | 6 | ||||
| -rw-r--r-- | src/print.c | 2 | ||||
| -rw-r--r-- | src/search.c | 8 | ||||
| -rw-r--r-- | src/term.c | 2 | ||||
| -rw-r--r-- | src/xdisp.c | 8 | ||||
| -rw-r--r-- | src/xterm.c | 2 |
20 files changed, 68 insertions, 98 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index fe3a570ee3b..0fc0401265c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2014-06-23 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | Simplify and cleanup character conversion stuff. | ||
| 4 | * lisp.h (multibyte_char_to_unibyte, multibyte_char_to_unibyte_safe): | ||
| 5 | Remove prototypes. | ||
| 6 | * character.c (multibyte_char_to_unibyte) | ||
| 7 | (multibyte_char_to_unibyte_safe): Remove; no longer used. | ||
| 8 | * character.h (make_char): Remove; unused. | ||
| 9 | (CHAR_TO_BYTE8, CHAR_TO_BYTE_SAFE): Simplify. | ||
| 10 | (ASCII_BYTE_P): Remove; ASCII_CHAR_P does the same thing. | ||
| 11 | * buffer.c, charset.c, charset.h, cmds.c, coding.c, editfns.c: | ||
| 12 | * fileio.c, indent.c, insdel.c, keyboard.c, lread.c, print.c: | ||
| 13 | * search.c, term.c, xdisp.c, xterm.c: Related users changed. | ||
| 14 | |||
| 1 | 2014-06-22 Mario Lang <mlang@delysid.org> | 15 | 2014-06-22 Mario Lang <mlang@delysid.org> |
| 2 | 16 | ||
| 3 | * w32fns.c (Fw32_shell_execute): The the -> the. | 17 | * w32fns.c (Fw32_shell_execute): The the -> the. |
diff --git a/src/buffer.c b/src/buffer.c index 909b3779b06..d6f6b2c7703 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -2530,7 +2530,7 @@ current buffer is cleared. */) | |||
| 2530 | p = GAP_END_ADDR; | 2530 | p = GAP_END_ADDR; |
| 2531 | stop = Z; | 2531 | stop = Z; |
| 2532 | } | 2532 | } |
| 2533 | if (ASCII_BYTE_P (*p)) | 2533 | if (ASCII_CHAR_P (*p)) |
| 2534 | p++, pos++; | 2534 | p++, pos++; |
| 2535 | else if (CHAR_BYTE8_HEAD_P (*p)) | 2535 | else if (CHAR_BYTE8_HEAD_P (*p)) |
| 2536 | { | 2536 | { |
| @@ -2602,7 +2602,7 @@ current buffer is cleared. */) | |||
| 2602 | stop = Z; | 2602 | stop = Z; |
| 2603 | } | 2603 | } |
| 2604 | 2604 | ||
| 2605 | if (ASCII_BYTE_P (*p)) | 2605 | if (ASCII_CHAR_P (*p)) |
| 2606 | p++, pos++; | 2606 | p++, pos++; |
| 2607 | else if (EQ (flag, Qt) | 2607 | else if (EQ (flag, Qt) |
| 2608 | && ! CHAR_BYTE8_HEAD_P (*p) | 2608 | && ! CHAR_BYTE8_HEAD_P (*p) |
diff --git a/src/character.c b/src/character.c index 12a95203527..a8e48dfd774 100644 --- a/src/character.c +++ b/src/character.c | |||
| @@ -233,32 +233,6 @@ translate_char (Lisp_Object table, int c) | |||
| 233 | return c; | 233 | return c; |
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | /* Convert ASCII or 8-bit character C to unibyte. If C is none of | ||
| 237 | them, return (C & 0xFF). */ | ||
| 238 | |||
| 239 | int | ||
| 240 | multibyte_char_to_unibyte (int c) | ||
| 241 | { | ||
| 242 | if (c < 0x80) | ||
| 243 | return c; | ||
| 244 | if (CHAR_BYTE8_P (c)) | ||
| 245 | return CHAR_TO_BYTE8 (c); | ||
| 246 | return (c & 0xFF); | ||
| 247 | } | ||
| 248 | |||
| 249 | /* Like multibyte_char_to_unibyte, but return -1 if C is not supported | ||
| 250 | by charset_unibyte. */ | ||
| 251 | |||
| 252 | int | ||
| 253 | multibyte_char_to_unibyte_safe (int c) | ||
| 254 | { | ||
| 255 | if (c < 0x80) | ||
| 256 | return c; | ||
| 257 | if (CHAR_BYTE8_P (c)) | ||
| 258 | return CHAR_TO_BYTE8 (c); | ||
| 259 | return -1; | ||
| 260 | } | ||
| 261 | |||
| 262 | DEFUN ("characterp", Fcharacterp, Scharacterp, 1, 2, 0, | 236 | DEFUN ("characterp", Fcharacterp, Scharacterp, 1, 2, 0, |
| 263 | doc: /* Return non-nil if OBJECT is a character. | 237 | doc: /* Return non-nil if OBJECT is a character. |
| 264 | In Emacs Lisp, characters are represented by character codes, which | 238 | In Emacs Lisp, characters are represented by character codes, which |
diff --git a/src/character.h b/src/character.h index 6f243a1392d..18aad5b8f41 100644 --- a/src/character.h +++ b/src/character.h | |||
| @@ -67,20 +67,15 @@ INLINE_HEADER_BEGIN | |||
| 67 | #define BYTE8_TO_CHAR(byte) ((byte) + 0x3FFF00) | 67 | #define BYTE8_TO_CHAR(byte) ((byte) + 0x3FFF00) |
| 68 | 68 | ||
| 69 | #define UNIBYTE_TO_CHAR(byte) \ | 69 | #define UNIBYTE_TO_CHAR(byte) \ |
| 70 | (ASCII_BYTE_P (byte) ? (byte) : BYTE8_TO_CHAR (byte)) | 70 | (ASCII_CHAR_P (byte) ? (byte) : BYTE8_TO_CHAR (byte)) |
| 71 | 71 | ||
| 72 | /* Return the raw 8-bit byte for character C. */ | 72 | /* Return the raw 8-bit byte for character C. */ |
| 73 | #define CHAR_TO_BYTE8(c) \ | 73 | #define CHAR_TO_BYTE8(c) (CHAR_BYTE8_P (c) ? (c) - 0x3FFF00 : (c & 0xFF)) |
| 74 | (CHAR_BYTE8_P (c) \ | ||
| 75 | ? (c) - 0x3FFF00 \ | ||
| 76 | : multibyte_char_to_unibyte (c)) | ||
| 77 | 74 | ||
| 78 | /* Return the raw 8-bit byte for character C, | 75 | /* Return the raw 8-bit byte for character C, |
| 79 | or -1 if C doesn't correspond to a byte. */ | 76 | or -1 if C doesn't correspond to a byte. */ |
| 80 | #define CHAR_TO_BYTE_SAFE(c) \ | 77 | #define CHAR_TO_BYTE_SAFE(c) \ |
| 81 | (CHAR_BYTE8_P (c) \ | 78 | (ASCII_CHAR_P (c) ? c : (CHAR_BYTE8_P (c) ? (c) - 0x3FFF00 : -1)) |
| 82 | ? (c) - 0x3FFF00 \ | ||
| 83 | : multibyte_char_to_unibyte_safe (c)) | ||
| 84 | 79 | ||
| 85 | /* Nonzero iff BYTE is the 1st byte of a multibyte form of a character | 80 | /* Nonzero iff BYTE is the 1st byte of a multibyte form of a character |
| 86 | that corresponds to a raw 8-bit byte. */ | 81 | that corresponds to a raw 8-bit byte. */ |
| @@ -101,13 +96,6 @@ INLINE_HEADER_BEGIN | |||
| 101 | /* This is the maximum byte length of multibyte form. */ | 96 | /* This is the maximum byte length of multibyte form. */ |
| 102 | #define MAX_MULTIBYTE_LENGTH 5 | 97 | #define MAX_MULTIBYTE_LENGTH 5 |
| 103 | 98 | ||
| 104 | /* Return a Lisp character whose character code is C. Assumes C is | ||
| 105 | a valid character code. */ | ||
| 106 | #define make_char(c) make_number (c) | ||
| 107 | |||
| 108 | /* Nonzero iff C is an ASCII byte. */ | ||
| 109 | #define ASCII_BYTE_P(c) UNSIGNED_CMP (c, <, 0x80) | ||
| 110 | |||
| 111 | /* Nonzero iff X is a character. */ | 99 | /* Nonzero iff X is a character. */ |
| 112 | #define CHARACTERP(x) (NATNUMP (x) && XFASTINT (x) <= MAX_CHAR) | 100 | #define CHARACTERP(x) (NATNUMP (x) && XFASTINT (x) <= MAX_CHAR) |
| 113 | 101 | ||
| @@ -222,7 +210,7 @@ INLINE_HEADER_BEGIN | |||
| 222 | 210 | ||
| 223 | /* Nonzero iff BYTE starts a character in a multibyte form. | 211 | /* Nonzero iff BYTE starts a character in a multibyte form. |
| 224 | This is equivalent to: | 212 | This is equivalent to: |
| 225 | (ASCII_BYTE_P (byte) || LEADING_CODE_P (byte)) */ | 213 | (ASCII_CHAR_P (byte) || LEADING_CODE_P (byte)) */ |
| 226 | #define CHAR_HEAD_P(byte) (((byte) & 0xC0) != 0x80) | 214 | #define CHAR_HEAD_P(byte) (((byte) & 0xC0) != 0x80) |
| 227 | 215 | ||
| 228 | /* How many bytes a character that starts with BYTE occupies in a | 216 | /* How many bytes a character that starts with BYTE occupies in a |
diff --git a/src/charset.c b/src/charset.c index baa692232c7..341ac356aff 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -389,12 +389,12 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries, | |||
| 389 | { | 389 | { |
| 390 | if (ascii_compatible_p) | 390 | if (ascii_compatible_p) |
| 391 | { | 391 | { |
| 392 | if (! ASCII_BYTE_P (from_c)) | 392 | if (! ASCII_CHAR_P (from_c)) |
| 393 | { | 393 | { |
| 394 | if (from_c < nonascii_min_char) | 394 | if (from_c < nonascii_min_char) |
| 395 | nonascii_min_char = from_c; | 395 | nonascii_min_char = from_c; |
| 396 | } | 396 | } |
| 397 | else if (! ASCII_BYTE_P (to_c)) | 397 | else if (! ASCII_CHAR_P (to_c)) |
| 398 | { | 398 | { |
| 399 | nonascii_min_char = 0x80; | 399 | nonascii_min_char = 0x80; |
| 400 | } | 400 | } |
| @@ -1522,7 +1522,7 @@ find_charsets_in_text (const unsigned char *ptr, ptrdiff_t nchars, | |||
| 1522 | 1522 | ||
| 1523 | if (!NILP (table)) | 1523 | if (!NILP (table)) |
| 1524 | c = translate_char (table, c); | 1524 | c = translate_char (table, c); |
| 1525 | if (ASCII_BYTE_P (c)) | 1525 | if (ASCII_CHAR_P (c)) |
| 1526 | ASET (charsets, charset_ascii, Qt); | 1526 | ASET (charsets, charset_ascii, Qt); |
| 1527 | else | 1527 | else |
| 1528 | ASET (charsets, charset_eight_bit, Qt); | 1528 | ASET (charsets, charset_eight_bit, Qt); |
diff --git a/src/charset.h b/src/charset.h index 32c624beff8..4176ce5ecc6 100644 --- a/src/charset.h +++ b/src/charset.h | |||
| @@ -403,7 +403,7 @@ extern Lisp_Object Vchar_charset_set; | |||
| 403 | Try some optimization before calling decode_char. */ | 403 | Try some optimization before calling decode_char. */ |
| 404 | 404 | ||
| 405 | #define DECODE_CHAR(charset, code) \ | 405 | #define DECODE_CHAR(charset, code) \ |
| 406 | ((ASCII_BYTE_P (code) && (charset)->ascii_compatible_p) \ | 406 | ((ASCII_CHAR_P (code) && (charset)->ascii_compatible_p) \ |
| 407 | ? (code) \ | 407 | ? (code) \ |
| 408 | : ((code) < (charset)->min_code || (code) > (charset)->max_code) \ | 408 | : ((code) < (charset)->min_code || (code) > (charset)->max_code) \ |
| 409 | ? -1 \ | 409 | ? -1 \ |
diff --git a/src/cmds.c b/src/cmds.c index 828fea3d753..20234638778 100644 --- a/src/cmds.c +++ b/src/cmds.c | |||
| @@ -359,9 +359,7 @@ internal_self_insert (int c, EMACS_INT n) | |||
| 359 | } | 359 | } |
| 360 | else | 360 | else |
| 361 | { | 361 | { |
| 362 | str[0] = (SINGLE_BYTE_CHAR_P (c) | 362 | str[0] = SINGLE_BYTE_CHAR_P (c) ? c : CHAR_TO_BYTE8 (c); |
| 363 | ? c | ||
| 364 | : multibyte_char_to_unibyte (c)); | ||
| 365 | len = 1; | 363 | len = 1; |
| 366 | } | 364 | } |
| 367 | if (!NILP (overwrite) | 365 | if (!NILP (overwrite) |
diff --git a/src/coding.c b/src/coding.c index fbe14f1695f..16dc37a3f20 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -1485,7 +1485,7 @@ decode_coding_utf_8 (struct coding_system *coding) | |||
| 1485 | src = src_base; | 1485 | src = src_base; |
| 1486 | consumed_chars = consumed_chars_base; | 1486 | consumed_chars = consumed_chars_base; |
| 1487 | ONE_MORE_BYTE (c); | 1487 | ONE_MORE_BYTE (c); |
| 1488 | *charbuf++ = ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c); | 1488 | *charbuf++ = ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c); |
| 1489 | coding->errors++; | 1489 | coding->errors++; |
| 1490 | } | 1490 | } |
| 1491 | 1491 | ||
| @@ -1725,7 +1725,7 @@ decode_coding_utf_16 (struct coding_system *coding) | |||
| 1725 | ONE_MORE_BYTE (c2); | 1725 | ONE_MORE_BYTE (c2); |
| 1726 | if (c2 < 0) | 1726 | if (c2 < 0) |
| 1727 | { | 1727 | { |
| 1728 | *charbuf++ = ASCII_BYTE_P (c1) ? c1 : BYTE8_TO_CHAR (c1); | 1728 | *charbuf++ = ASCII_CHAR_P (c1) ? c1 : BYTE8_TO_CHAR (c1); |
| 1729 | *charbuf++ = -c2; | 1729 | *charbuf++ = -c2; |
| 1730 | continue; | 1730 | continue; |
| 1731 | } | 1731 | } |
| @@ -2108,7 +2108,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, | |||
| 2108 | 2108 | ||
| 2109 | case 1: | 2109 | case 1: |
| 2110 | code = c; | 2110 | code = c; |
| 2111 | charset_ID = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit; | 2111 | charset_ID = ASCII_CHAR_P (code) ? charset_ascii : charset_eight_bit; |
| 2112 | break; | 2112 | break; |
| 2113 | 2113 | ||
| 2114 | default: | 2114 | default: |
| @@ -2596,7 +2596,7 @@ decode_coding_emacs_mule (struct coding_system *coding) | |||
| 2596 | src = src_base; | 2596 | src = src_base; |
| 2597 | consumed_chars = consumed_chars_base; | 2597 | consumed_chars = consumed_chars_base; |
| 2598 | ONE_MORE_BYTE (c); | 2598 | ONE_MORE_BYTE (c); |
| 2599 | *charbuf++ = ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c); | 2599 | *charbuf++ = ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c); |
| 2600 | char_offset++; | 2600 | char_offset++; |
| 2601 | coding->errors++; | 2601 | coding->errors++; |
| 2602 | } | 2602 | } |
| @@ -3573,7 +3573,7 @@ decode_coding_iso_2022 (struct coding_system *coding) | |||
| 3573 | 3573 | ||
| 3574 | if (CODING_ISO_EXTSEGMENT_LEN (coding) > 0) | 3574 | if (CODING_ISO_EXTSEGMENT_LEN (coding) > 0) |
| 3575 | { | 3575 | { |
| 3576 | *charbuf++ = ASCII_BYTE_P (c1) ? c1 : BYTE8_TO_CHAR (c1); | 3576 | *charbuf++ = ASCII_CHAR_P (c1) ? c1 : BYTE8_TO_CHAR (c1); |
| 3577 | char_offset++; | 3577 | char_offset++; |
| 3578 | CODING_ISO_EXTSEGMENT_LEN (coding)--; | 3578 | CODING_ISO_EXTSEGMENT_LEN (coding)--; |
| 3579 | continue; | 3579 | continue; |
| @@ -3600,7 +3600,7 @@ decode_coding_iso_2022 (struct coding_system *coding) | |||
| 3600 | } | 3600 | } |
| 3601 | else | 3601 | else |
| 3602 | { | 3602 | { |
| 3603 | *charbuf++ = ASCII_BYTE_P (c1) ? c1 : BYTE8_TO_CHAR (c1); | 3603 | *charbuf++ = ASCII_CHAR_P (c1) ? c1 : BYTE8_TO_CHAR (c1); |
| 3604 | char_offset++; | 3604 | char_offset++; |
| 3605 | } | 3605 | } |
| 3606 | continue; | 3606 | continue; |
| @@ -3974,7 +3974,7 @@ decode_coding_iso_2022 (struct coding_system *coding) | |||
| 3974 | MAYBE_FINISH_COMPOSITION (); | 3974 | MAYBE_FINISH_COMPOSITION (); |
| 3975 | for (; src_base < src; src_base++, char_offset++) | 3975 | for (; src_base < src; src_base++, char_offset++) |
| 3976 | { | 3976 | { |
| 3977 | if (ASCII_BYTE_P (*src_base)) | 3977 | if (ASCII_CHAR_P (*src_base)) |
| 3978 | *charbuf++ = *src_base; | 3978 | *charbuf++ = *src_base; |
| 3979 | else | 3979 | else |
| 3980 | *charbuf++ = BYTE8_TO_CHAR (*src_base); | 3980 | *charbuf++ = BYTE8_TO_CHAR (*src_base); |
| @@ -4004,7 +4004,7 @@ decode_coding_iso_2022 (struct coding_system *coding) | |||
| 4004 | src = src_base; | 4004 | src = src_base; |
| 4005 | consumed_chars = consumed_chars_base; | 4005 | consumed_chars = consumed_chars_base; |
| 4006 | ONE_MORE_BYTE (c); | 4006 | ONE_MORE_BYTE (c); |
| 4007 | *charbuf++ = c < 0 ? -c : ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c); | 4007 | *charbuf++ = c < 0 ? -c : ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c); |
| 4008 | char_offset++; | 4008 | char_offset++; |
| 4009 | coding->errors++; | 4009 | coding->errors++; |
| 4010 | /* Reset the invocation and designation status to the safest | 4010 | /* Reset the invocation and designation status to the safest |
| @@ -5640,7 +5640,7 @@ decode_coding_charset (struct coding_system *coding) | |||
| 5640 | src = src_base; | 5640 | src = src_base; |
| 5641 | consumed_chars = consumed_chars_base; | 5641 | consumed_chars = consumed_chars_base; |
| 5642 | ONE_MORE_BYTE (c); | 5642 | ONE_MORE_BYTE (c); |
| 5643 | *charbuf++ = c < 0 ? -c : ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c); | 5643 | *charbuf++ = c < 0 ? -c : ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c); |
| 5644 | char_offset++; | 5644 | char_offset++; |
| 5645 | coding->errors++; | 5645 | coding->errors++; |
| 5646 | } | 5646 | } |
| @@ -9031,13 +9031,13 @@ DEFUN ("find-coding-systems-region-internal", | |||
| 9031 | p = pbeg = BYTE_POS_ADDR (start_byte); | 9031 | p = pbeg = BYTE_POS_ADDR (start_byte); |
| 9032 | pend = p + (end_byte - start_byte); | 9032 | pend = p + (end_byte - start_byte); |
| 9033 | 9033 | ||
| 9034 | while (p < pend && ASCII_BYTE_P (*p)) p++; | 9034 | while (p < pend && ASCII_CHAR_P (*p)) p++; |
| 9035 | while (p < pend && ASCII_BYTE_P (*(pend - 1))) pend--; | 9035 | while (p < pend && ASCII_CHAR_P (*(pend - 1))) pend--; |
| 9036 | 9036 | ||
| 9037 | work_table = Fmake_char_table (Qnil, Qnil); | 9037 | work_table = Fmake_char_table (Qnil, Qnil); |
| 9038 | while (p < pend) | 9038 | while (p < pend) |
| 9039 | { | 9039 | { |
| 9040 | if (ASCII_BYTE_P (*p)) | 9040 | if (ASCII_CHAR_P (*p)) |
| 9041 | p++; | 9041 | p++; |
| 9042 | else | 9042 | else |
| 9043 | { | 9043 | { |
| @@ -9169,7 +9169,7 @@ to the string. */) | |||
| 9169 | int c; | 9169 | int c; |
| 9170 | 9170 | ||
| 9171 | if (ascii_compatible) | 9171 | if (ascii_compatible) |
| 9172 | while (p < stop && ASCII_BYTE_P (*p)) | 9172 | while (p < stop && ASCII_CHAR_P (*p)) |
| 9173 | p++, from++; | 9173 | p++, from++; |
| 9174 | if (p >= stop) | 9174 | if (p >= stop) |
| 9175 | { | 9175 | { |
| @@ -9285,12 +9285,12 @@ is nil. */) | |||
| 9285 | p = pbeg = BYTE_POS_ADDR (start_byte); | 9285 | p = pbeg = BYTE_POS_ADDR (start_byte); |
| 9286 | pend = p + (end_byte - start_byte); | 9286 | pend = p + (end_byte - start_byte); |
| 9287 | 9287 | ||
| 9288 | while (p < pend && ASCII_BYTE_P (*p)) p++, pos++; | 9288 | while (p < pend && ASCII_CHAR_P (*p)) p++, pos++; |
| 9289 | while (p < pend && ASCII_BYTE_P (*(pend - 1))) pend--; | 9289 | while (p < pend && ASCII_CHAR_P (*(pend - 1))) pend--; |
| 9290 | 9290 | ||
| 9291 | while (p < pend) | 9291 | while (p < pend) |
| 9292 | { | 9292 | { |
| 9293 | if (ASCII_BYTE_P (*p)) | 9293 | if (ASCII_CHAR_P (*p)) |
| 9294 | p++; | 9294 | p++; |
| 9295 | else | 9295 | else |
| 9296 | { | 9296 | { |
| @@ -9598,7 +9598,7 @@ Return the corresponding character. */) | |||
| 9598 | CHECK_CODING_SYSTEM_GET_SPEC (Vsjis_coding_system, spec); | 9598 | CHECK_CODING_SYSTEM_GET_SPEC (Vsjis_coding_system, spec); |
| 9599 | attrs = AREF (spec, 0); | 9599 | attrs = AREF (spec, 0); |
| 9600 | 9600 | ||
| 9601 | if (ASCII_BYTE_P (ch) | 9601 | if (ASCII_CHAR_P (ch) |
| 9602 | && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs))) | 9602 | && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs))) |
| 9603 | return code; | 9603 | return code; |
| 9604 | 9604 | ||
| @@ -9679,7 +9679,7 @@ Return the corresponding character. */) | |||
| 9679 | CHECK_CODING_SYSTEM_GET_SPEC (Vbig5_coding_system, spec); | 9679 | CHECK_CODING_SYSTEM_GET_SPEC (Vbig5_coding_system, spec); |
| 9680 | attrs = AREF (spec, 0); | 9680 | attrs = AREF (spec, 0); |
| 9681 | 9681 | ||
| 9682 | if (ASCII_BYTE_P (ch) | 9682 | if (ASCII_CHAR_P (ch) |
| 9683 | && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs))) | 9683 | && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs))) |
| 9684 | return code; | 9684 | return code; |
| 9685 | 9685 | ||
diff --git a/src/editfns.c b/src/editfns.c index 40fac27ba47..e8d4478f2f6 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -2238,7 +2238,7 @@ general_insert_function (void (*insert_func) | |||
| 2238 | len = CHAR_STRING (c, str); | 2238 | len = CHAR_STRING (c, str); |
| 2239 | else | 2239 | else |
| 2240 | { | 2240 | { |
| 2241 | str[0] = ASCII_CHAR_P (c) ? c : multibyte_char_to_unibyte (c); | 2241 | str[0] = CHAR_TO_BYTE8 (c); |
| 2242 | len = 1; | 2242 | len = 1; |
| 2243 | } | 2243 | } |
| 2244 | (*insert_func) ((char *) str, len); | 2244 | (*insert_func) ((char *) str, len); |
| @@ -2852,7 +2852,7 @@ Both characters must have the same length of multi-byte form. */) | |||
| 2852 | len = CHAR_STRING (fromc, fromstr); | 2852 | len = CHAR_STRING (fromc, fromstr); |
| 2853 | if (CHAR_STRING (toc, tostr) != len) | 2853 | if (CHAR_STRING (toc, tostr) != len) |
| 2854 | error ("Characters in `subst-char-in-region' have different byte-lengths"); | 2854 | error ("Characters in `subst-char-in-region' have different byte-lengths"); |
| 2855 | if (!ASCII_BYTE_P (*tostr)) | 2855 | if (!ASCII_CHAR_P (*tostr)) |
| 2856 | { | 2856 | { |
| 2857 | /* If *TOSTR is in the range 0x80..0x9F and TOCHAR is not a | 2857 | /* If *TOSTR is in the range 0x80..0x9F and TOCHAR is not a |
| 2858 | complete multibyte character, it may be combined with the | 2858 | complete multibyte character, it may be combined with the |
| @@ -2945,7 +2945,7 @@ Both characters must have the same length of multi-byte form. */) | |||
| 2945 | : ((pos_byte_next < Z_BYTE | 2945 | : ((pos_byte_next < Z_BYTE |
| 2946 | && ! CHAR_HEAD_P (FETCH_BYTE (pos_byte_next))) | 2946 | && ! CHAR_HEAD_P (FETCH_BYTE (pos_byte_next))) |
| 2947 | || (pos_byte > BEG_BYTE | 2947 | || (pos_byte > BEG_BYTE |
| 2948 | && ! ASCII_BYTE_P (FETCH_BYTE (pos_byte - 1)))))) | 2948 | && ! ASCII_CHAR_P (FETCH_BYTE (pos_byte - 1)))))) |
| 2949 | { | 2949 | { |
| 2950 | Lisp_Object tem, string; | 2950 | Lisp_Object tem, string; |
| 2951 | 2951 | ||
| @@ -3126,7 +3126,7 @@ It returns the number of characters changed. */) | |||
| 3126 | else | 3126 | else |
| 3127 | { | 3127 | { |
| 3128 | nc = tt[oc]; | 3128 | nc = tt[oc]; |
| 3129 | if (! ASCII_BYTE_P (nc) && multibyte) | 3129 | if (! ASCII_CHAR_P (nc) && multibyte) |
| 3130 | { | 3130 | { |
| 3131 | str_len = BYTE8_STRING (nc, buf); | 3131 | str_len = BYTE8_STRING (nc, buf); |
| 3132 | str = buf; | 3132 | str = buf; |
| @@ -3877,7 +3877,7 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 3877 | 3877 | ||
| 3878 | if (p > buf | 3878 | if (p > buf |
| 3879 | && multibyte | 3879 | && multibyte |
| 3880 | && !ASCII_BYTE_P (*((unsigned char *) p - 1)) | 3880 | && !ASCII_CHAR_P (*((unsigned char *) p - 1)) |
| 3881 | && STRING_MULTIBYTE (args[n]) | 3881 | && STRING_MULTIBYTE (args[n]) |
| 3882 | && !CHAR_HEAD_P (SREF (args[n], 0))) | 3882 | && !CHAR_HEAD_P (SREF (args[n], 0))) |
| 3883 | maybe_combine_byte = 1; | 3883 | maybe_combine_byte = 1; |
| @@ -4167,7 +4167,7 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 4167 | { | 4167 | { |
| 4168 | /* Copy a whole multibyte character. */ | 4168 | /* Copy a whole multibyte character. */ |
| 4169 | if (p > buf | 4169 | if (p > buf |
| 4170 | && !ASCII_BYTE_P (*((unsigned char *) p - 1)) | 4170 | && !ASCII_CHAR_P (*((unsigned char *) p - 1)) |
| 4171 | && !CHAR_HEAD_P (*format)) | 4171 | && !CHAR_HEAD_P (*format)) |
| 4172 | maybe_combine_byte = 1; | 4172 | maybe_combine_byte = 1; |
| 4173 | 4173 | ||
| @@ -4181,7 +4181,7 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 4181 | else | 4181 | else |
| 4182 | { | 4182 | { |
| 4183 | unsigned char uc = *format++; | 4183 | unsigned char uc = *format++; |
| 4184 | if (! multibyte || ASCII_BYTE_P (uc)) | 4184 | if (! multibyte || ASCII_CHAR_P (uc)) |
| 4185 | convbytes = 1; | 4185 | convbytes = 1; |
| 4186 | else | 4186 | else |
| 4187 | { | 4187 | { |
diff --git a/src/fileio.c b/src/fileio.c index c7736661207..f0bd75b170e 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -990,7 +990,7 @@ filesystem tree, not (expand-file-name ".." dirname). */) | |||
| 990 | { | 990 | { |
| 991 | unsigned char *p = SDATA (name); | 991 | unsigned char *p = SDATA (name); |
| 992 | 992 | ||
| 993 | while (*p && ASCII_BYTE_P (*p)) | 993 | while (*p && ASCII_CHAR_P (*p)) |
| 994 | p++; | 994 | p++; |
| 995 | if (*p == '\0') | 995 | if (*p == '\0') |
| 996 | { | 996 | { |
diff --git a/src/indent.c b/src/indent.c index 711792f75cd..79af42c5f7e 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -920,7 +920,7 @@ position_indentation (ptrdiff_t pos_byte) | |||
| 920 | column += tab_width - column % tab_width; | 920 | column += tab_width - column % tab_width; |
| 921 | break; | 921 | break; |
| 922 | default: | 922 | default: |
| 923 | if (ASCII_BYTE_P (p[-1]) | 923 | if (ASCII_CHAR_P (p[-1]) |
| 924 | || NILP (BVAR (current_buffer, enable_multibyte_characters))) | 924 | || NILP (BVAR (current_buffer, enable_multibyte_characters))) |
| 925 | return column; | 925 | return column; |
| 926 | { | 926 | { |
diff --git a/src/insdel.c b/src/insdel.c index 2894af75348..876e2869978 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -701,7 +701,7 @@ count_combining_after (const unsigned char *string, | |||
| 701 | (2) POS is the last of the current buffer. | 701 | (2) POS is the last of the current buffer. |
| 702 | (3) A character at POS can't be a following byte of multibyte | 702 | (3) A character at POS can't be a following byte of multibyte |
| 703 | character. */ | 703 | character. */ |
| 704 | if (length > 0 && ASCII_BYTE_P (string[length - 1])) /* case (1) */ | 704 | if (length > 0 && ASCII_CHAR_P (string[length - 1])) /* case (1) */ |
| 705 | return 0; | 705 | return 0; |
| 706 | if (pos_byte == Z_BYTE) /* case (2) */ | 706 | if (pos_byte == Z_BYTE) /* case (2) */ |
| 707 | return 0; | 707 | return 0; |
diff --git a/src/keyboard.c b/src/keyboard.c index 1da300b77cc..936d6687908 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -2084,7 +2084,7 @@ make_ctrl_char (int c) | |||
| 2084 | /* Save the upper bits here. */ | 2084 | /* Save the upper bits here. */ |
| 2085 | int upper = c & ~0177; | 2085 | int upper = c & ~0177; |
| 2086 | 2086 | ||
| 2087 | if (! ASCII_BYTE_P (c)) | 2087 | if (! ASCII_CHAR_P (c)) |
| 2088 | return c |= ctrl_modifier; | 2088 | return c |= ctrl_modifier; |
| 2089 | 2089 | ||
| 2090 | c &= 0177; | 2090 | c &= 0177; |
diff --git a/src/lisp.h b/src/lisp.h index 8ad8e80da4b..0b9d3565433 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3433,8 +3433,6 @@ extern void syms_of_coding (void); | |||
| 3433 | /* Defined in character.c. */ | 3433 | /* Defined in character.c. */ |
| 3434 | extern ptrdiff_t chars_in_text (const unsigned char *, ptrdiff_t); | 3434 | extern ptrdiff_t chars_in_text (const unsigned char *, ptrdiff_t); |
| 3435 | extern ptrdiff_t multibyte_chars_in_text (const unsigned char *, ptrdiff_t); | 3435 | extern ptrdiff_t multibyte_chars_in_text (const unsigned char *, ptrdiff_t); |
| 3436 | extern int multibyte_char_to_unibyte (int) ATTRIBUTE_CONST; | ||
| 3437 | extern int multibyte_char_to_unibyte_safe (int) ATTRIBUTE_CONST; | ||
| 3438 | extern void syms_of_character (void); | 3436 | extern void syms_of_character (void); |
| 3439 | 3437 | ||
| 3440 | /* Defined in charset.c. */ | 3438 | /* Defined in charset.c. */ |
diff --git a/src/lread.c b/src/lread.c index 41ea1f19227..f252993207d 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -213,7 +213,7 @@ readchar (Lisp_Object readcharfun, bool *multibyte) | |||
| 213 | else | 213 | else |
| 214 | { | 214 | { |
| 215 | c = BUF_FETCH_BYTE (inbuffer, pt_byte); | 215 | c = BUF_FETCH_BYTE (inbuffer, pt_byte); |
| 216 | if (! ASCII_BYTE_P (c)) | 216 | if (! ASCII_CHAR_P (c)) |
| 217 | c = BYTE8_TO_CHAR (c); | 217 | c = BYTE8_TO_CHAR (c); |
| 218 | pt_byte++; | 218 | pt_byte++; |
| 219 | } | 219 | } |
| @@ -242,7 +242,7 @@ readchar (Lisp_Object readcharfun, bool *multibyte) | |||
| 242 | else | 242 | else |
| 243 | { | 243 | { |
| 244 | c = BUF_FETCH_BYTE (inbuffer, bytepos); | 244 | c = BUF_FETCH_BYTE (inbuffer, bytepos); |
| 245 | if (! ASCII_BYTE_P (c)) | 245 | if (! ASCII_CHAR_P (c)) |
| 246 | c = BYTE8_TO_CHAR (c); | 246 | c = BYTE8_TO_CHAR (c); |
| 247 | bytepos++; | 247 | bytepos++; |
| 248 | } | 248 | } |
| @@ -324,7 +324,7 @@ readchar (Lisp_Object readcharfun, bool *multibyte) | |||
| 324 | return c; | 324 | return c; |
| 325 | if (multibyte) | 325 | if (multibyte) |
| 326 | *multibyte = 1; | 326 | *multibyte = 1; |
| 327 | if (ASCII_BYTE_P (c)) | 327 | if (ASCII_CHAR_P (c)) |
| 328 | return c; | 328 | return c; |
| 329 | if (emacs_mule_encoding) | 329 | if (emacs_mule_encoding) |
| 330 | return read_emacs_mule_char (c, readbyte, readcharfun); | 330 | return read_emacs_mule_char (c, readbyte, readcharfun); |
diff --git a/src/print.c b/src/print.c index 475be9ec285..9050a0cb773 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -1472,7 +1472,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) | |||
| 1472 | strout (outbuf, len, len, printcharfun); | 1472 | strout (outbuf, len, len, printcharfun); |
| 1473 | } | 1473 | } |
| 1474 | else if (! multibyte | 1474 | else if (! multibyte |
| 1475 | && SINGLE_BYTE_CHAR_P (c) && ! ASCII_BYTE_P (c) | 1475 | && SINGLE_BYTE_CHAR_P (c) && ! ASCII_CHAR_P (c) |
| 1476 | && print_escape_nonascii) | 1476 | && print_escape_nonascii) |
| 1477 | { | 1477 | { |
| 1478 | /* When printing in a multibyte buffer | 1478 | /* When printing in a multibyte buffer |
diff --git a/src/search.c b/src/search.c index dc4820d8588..ecfb2352144 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -1416,7 +1416,7 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, | |||
| 1416 | 1416 | ||
| 1417 | while (boyer_moore_ok) | 1417 | while (boyer_moore_ok) |
| 1418 | { | 1418 | { |
| 1419 | if (ASCII_BYTE_P (inverse)) | 1419 | if (ASCII_CHAR_P (inverse)) |
| 1420 | { | 1420 | { |
| 1421 | if (this_char_base > 0) | 1421 | if (this_char_base > 0) |
| 1422 | boyer_moore_ok = 0; | 1422 | boyer_moore_ok = 0; |
| @@ -1827,7 +1827,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat, | |||
| 1827 | matching with CHAR_BASE are to be checked. */ | 1827 | matching with CHAR_BASE are to be checked. */ |
| 1828 | int ch = -1; | 1828 | int ch = -1; |
| 1829 | 1829 | ||
| 1830 | if (ASCII_BYTE_P (*ptr) || ! multibyte) | 1830 | if (ASCII_CHAR_P (*ptr) || ! multibyte) |
| 1831 | ch = *ptr; | 1831 | ch = *ptr; |
| 1832 | else if (char_base | 1832 | else if (char_base |
| 1833 | && ((pat_end - ptr) == 1 || CHAR_HEAD_P (ptr[1]))) | 1833 | && ((pat_end - ptr) == 1 || CHAR_HEAD_P (ptr[1]))) |
| @@ -2596,7 +2596,7 @@ since only regular expressions have distinguished subexpressions. */) | |||
| 2596 | { | 2596 | { |
| 2597 | FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext, pos, pos_byte); | 2597 | FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext, pos, pos_byte); |
| 2598 | if (!buf_multibyte) | 2598 | if (!buf_multibyte) |
| 2599 | c = multibyte_char_to_unibyte (c); | 2599 | c = CHAR_TO_BYTE8 (c); |
| 2600 | } | 2600 | } |
| 2601 | else | 2601 | else |
| 2602 | { | 2602 | { |
| @@ -2619,7 +2619,7 @@ since only regular expressions have distinguished subexpressions. */) | |||
| 2619 | FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext, | 2619 | FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext, |
| 2620 | pos, pos_byte); | 2620 | pos, pos_byte); |
| 2621 | if (!buf_multibyte && !ASCII_CHAR_P (c)) | 2621 | if (!buf_multibyte && !ASCII_CHAR_P (c)) |
| 2622 | c = multibyte_char_to_unibyte (c); | 2622 | c = CHAR_TO_BYTE8 (c); |
| 2623 | } | 2623 | } |
| 2624 | else | 2624 | else |
| 2625 | { | 2625 | { |
diff --git a/src/term.c b/src/term.c index 642907979aa..d4bb7e1bd32 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -1861,7 +1861,7 @@ produce_glyphless_glyph (struct it *it, Lisp_Object acronym) | |||
| 1861 | acronym = XCDR (acronym); | 1861 | acronym = XCDR (acronym); |
| 1862 | buf[0] = '['; | 1862 | buf[0] = '['; |
| 1863 | str = STRINGP (acronym) ? SSDATA (acronym) : ""; | 1863 | str = STRINGP (acronym) ? SSDATA (acronym) : ""; |
| 1864 | for (len = 0; len < 6 && str[len] && ASCII_BYTE_P (str[len]); len++) | 1864 | for (len = 0; len < 6 && str[len] && ASCII_CHAR_P (str[len]); len++) |
| 1865 | buf[1 + len] = str[len]; | 1865 | buf[1 + len] = str[len]; |
| 1866 | buf[1 + len] = ']'; | 1866 | buf[1 + len] = ']'; |
| 1867 | len += 2; | 1867 | len += 2; |
diff --git a/src/xdisp.c b/src/xdisp.c index 8711487780c..31d293143f3 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -8269,7 +8269,7 @@ next_element_from_buffer (struct it *it) | |||
| 8269 | 8269 | ||
| 8270 | /* Get the next character, maybe multibyte. */ | 8270 | /* Get the next character, maybe multibyte. */ |
| 8271 | p = BYTE_POS_ADDR (IT_BYTEPOS (*it)); | 8271 | p = BYTE_POS_ADDR (IT_BYTEPOS (*it)); |
| 8272 | if (it->multibyte_p && !ASCII_BYTE_P (*p)) | 8272 | if (it->multibyte_p && !ASCII_CHAR_P (*p)) |
| 8273 | it->c = STRING_CHAR_AND_LENGTH (p, it->len); | 8273 | it->c = STRING_CHAR_AND_LENGTH (p, it->len); |
| 8274 | else | 8274 | else |
| 8275 | it->c = *p, it->len = 1; | 8275 | it->c = *p, it->len = 1; |
| @@ -9932,9 +9932,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool nlflag, bool multibyte) | |||
| 9932 | for (i = 0; i < nbytes; i += char_bytes) | 9932 | for (i = 0; i < nbytes; i += char_bytes) |
| 9933 | { | 9933 | { |
| 9934 | c = string_char_and_length (msg + i, &char_bytes); | 9934 | c = string_char_and_length (msg + i, &char_bytes); |
| 9935 | work[0] = (ASCII_CHAR_P (c) | 9935 | work[0] = CHAR_TO_BYTE8 (c); |
| 9936 | ? c | ||
| 9937 | : multibyte_char_to_unibyte (c)); | ||
| 9938 | insert_1_both (work, 1, 1, 1, 0, 0); | 9936 | insert_1_both (work, 1, 1, 1, 0, 0); |
| 9939 | } | 9937 | } |
| 9940 | } | 9938 | } |
| @@ -25781,7 +25779,7 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) | |||
| 25781 | sprintf (buf, "%0*X", it->c < 0x10000 ? 4 : 6, it->c); | 25779 | sprintf (buf, "%0*X", it->c < 0x10000 ? 4 : 6, it->c); |
| 25782 | str = buf; | 25780 | str = buf; |
| 25783 | } | 25781 | } |
| 25784 | for (len = 0; str[len] && ASCII_BYTE_P (str[len]) && len < 6; len++) | 25782 | for (len = 0; str[len] && ASCII_CHAR_P (str[len]) && len < 6; len++) |
| 25785 | code[len] = font->driver->encode_char (font, str[len]); | 25783 | code[len] = font->driver->encode_char (font, str[len]); |
| 25786 | upper_len = (len + 1) / 2; | 25784 | upper_len = (len + 1) / 2; |
| 25787 | font->driver->text_extents (font, code, upper_len, | 25785 | font->driver->text_extents (font, code, upper_len, |
diff --git a/src/xterm.c b/src/xterm.c index a7f77bdb282..45bb7b2a918 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -6460,7 +6460,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 6460 | 6460 | ||
| 6461 | for (i = 0, nchars = 0; i < nbytes; i++) | 6461 | for (i = 0, nchars = 0; i < nbytes; i++) |
| 6462 | { | 6462 | { |
| 6463 | if (ASCII_BYTE_P (copy_bufptr[i])) | 6463 | if (ASCII_CHAR_P (copy_bufptr[i])) |
| 6464 | nchars++; | 6464 | nchars++; |
| 6465 | STORE_KEYSYM_FOR_DEBUG (copy_bufptr[i]); | 6465 | STORE_KEYSYM_FOR_DEBUG (copy_bufptr[i]); |
| 6466 | } | 6466 | } |