diff options
| author | Stefan Monnier | 2008-06-12 20:25:47 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-06-12 20:25:47 +0000 |
| commit | 2afc21f5f6d8963301913c5aed515e567b8e3986 (patch) | |
| tree | 887ca764f829fd7bf1bd86db8b498551c9f9cf4b /src | |
| parent | 667adde1607cd29244213d76624c085083245796 (diff) | |
| download | emacs-2afc21f5f6d8963301913c5aed515e567b8e3986.tar.gz emacs-2afc21f5f6d8963301913c5aed515e567b8e3986.zip | |
* character.h (CHAR_TO_BYTE_SAFE): New macro.
* character.c (Fmultibyte_char_to_unibyte): Obey the docstring.
* regex.c (RE_CHAR_TO_UNIBYTE): Use the new macro.
(WEAK_ALIAS): Simplify.
* syntax.c (skip_chars): Don't mark non-byte chars in the fastmap
when searching a unibyte buffer.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 17 | ||||
| -rw-r--r-- | src/character.c | 2 | ||||
| -rw-r--r-- | src/character.h | 7 | ||||
| -rw-r--r-- | src/regex.c | 10 | ||||
| -rw-r--r-- | src/syntax.c | 6 |
5 files changed, 28 insertions, 14 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b5951beb09a..6361f522fe7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2008-06-12 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * character.h (CHAR_TO_BYTE_SAFE): New macro. | ||
| 4 | * character.c (Fmultibyte_char_to_unibyte): Obey the docstring. | ||
| 5 | * regex.c (RE_CHAR_TO_UNIBYTE): Use the new macro. | ||
| 6 | (WEAK_ALIAS): Simplify. | ||
| 7 | * syntax.c (skip_chars): Don't mark non-byte chars in the fastmap | ||
| 8 | when searching a unibyte buffer. | ||
| 9 | |||
| 1 | 2008-06-12 Chong Yidong <cyd@stupidchicken.com> | 10 | 2008-06-12 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 11 | ||
| 3 | * xfns.c (Fx_select_font): Rename from x-font-dialog. | 12 | * xfns.c (Fx_select_font): Rename from x-font-dialog. |
| @@ -8,10 +17,10 @@ | |||
| 8 | 17 | ||
| 9 | 2008-06-11 Jason Rumney <jasonr@gnu.org> | 18 | 2008-06-11 Jason Rumney <jasonr@gnu.org> |
| 10 | 19 | ||
| 11 | * w32font.c (w32font_encode_char): Detect missing glyphs that are | 20 | * w32font.c (w32font_encode_char): Detect missing glyphs that are |
| 12 | misreported as space. | 21 | misreported as space. |
| 13 | (add_font_entity_to_list): Support unicode-bmp and unicode-sip | 22 | (add_font_entity_to_list): Support unicode-bmp and unicode-sip |
| 14 | as aliases for registry iso10646-1. | 23 | as aliases for registry iso10646-1. |
| 15 | 24 | ||
| 16 | 2008-06-11 Stefan Monnier <monnier@iro.umontreal.ca> | 25 | 2008-06-11 Stefan Monnier <monnier@iro.umontreal.ca> |
| 17 | 26 | ||
diff --git a/src/character.c b/src/character.c index 7f09ecd4857..5e2a3590563 100644 --- a/src/character.c +++ b/src/character.c | |||
| @@ -359,7 +359,7 @@ If the multibyte character does not represent a byte, return -1. */) | |||
| 359 | return ch; | 359 | return ch; |
| 360 | else | 360 | else |
| 361 | { | 361 | { |
| 362 | int cu = CHAR_TO_BYTE8 (cm); | 362 | int cu = CHAR_TO_BYTE_SAFE (cm); |
| 363 | return make_number (cu); | 363 | return make_number (cu); |
| 364 | } | 364 | } |
| 365 | } | 365 | } |
diff --git a/src/character.h b/src/character.h index ae87b3885d9..cf73083dd04 100644 --- a/src/character.h +++ b/src/character.h | |||
| @@ -68,6 +68,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 68 | ? (c) - 0x3FFF00 \ | 68 | ? (c) - 0x3FFF00 \ |
| 69 | : multibyte_char_to_unibyte (c, Qnil)) | 69 | : multibyte_char_to_unibyte (c, Qnil)) |
| 70 | 70 | ||
| 71 | /* Return the raw 8-bit byte for character C, | ||
| 72 | or -1 if C doesn't correspond to a byte. */ | ||
| 73 | #define CHAR_TO_BYTE_SAFE(c) \ | ||
| 74 | (CHAR_BYTE8_P (c) \ | ||
| 75 | ? (c) - 0x3FFF00 \ | ||
| 76 | : multibyte_char_to_unibyte_safe (c, Qnil)) | ||
| 77 | |||
| 71 | /* Nonzero iff BYTE is the 1st byte of a multibyte form of a character | 78 | /* Nonzero iff BYTE is the 1st byte of a multibyte form of a character |
| 72 | that corresponds to a raw 8-bit byte. */ | 79 | that corresponds to a raw 8-bit byte. */ |
| 73 | #define CHAR_BYTE8_HEAD_P(byte) ((byte) == 0xC0 || (byte) == 0xC1) | 80 | #define CHAR_BYTE8_HEAD_P(byte) ((byte) == 0xC0 || (byte) == 0xC1) |
diff --git a/src/regex.c b/src/regex.c index 8ffd2be6ded..ff43fc85008 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -153,10 +153,7 @@ | |||
| 153 | 153 | ||
| 154 | # define RE_CHAR_TO_MULTIBYTE(c) unibyte_to_multibyte_table[(c)] | 154 | # define RE_CHAR_TO_MULTIBYTE(c) unibyte_to_multibyte_table[(c)] |
| 155 | 155 | ||
| 156 | # define RE_CHAR_TO_UNIBYTE(c) \ | 156 | # define RE_CHAR_TO_UNIBYTE(c) CHAR_TO_BYTE_SAFE (c) |
| 157 | (ASCII_CHAR_P (c) ? (c) \ | ||
| 158 | : CHAR_BYTE8_P (c) ? CHAR_TO_BYTE8 (c) \ | ||
| 159 | : multibyte_char_to_unibyte_safe (c)) | ||
| 160 | 157 | ||
| 161 | /* Set C a (possibly converted to multibyte) character before P. P | 158 | /* Set C a (possibly converted to multibyte) character before P. P |
| 162 | points into a string which is the virtual concatenation of STR1 | 159 | points into a string which is the virtual concatenation of STR1 |
| @@ -5574,10 +5571,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5574 | if (multibyte) | 5571 | if (multibyte) |
| 5575 | { | 5572 | { |
| 5576 | pat_ch = STRING_CHAR_AND_LENGTH (p, pend - p, pat_charlen); | 5573 | pat_ch = STRING_CHAR_AND_LENGTH (p, pend - p, pat_charlen); |
| 5577 | if (CHAR_BYTE8_P (pat_ch)) | 5574 | pat_ch = RE_CHAR_TO_UNIBYTE (pat_ch); |
| 5578 | pat_ch = CHAR_TO_BYTE8 (pat_ch); | ||
| 5579 | else | ||
| 5580 | pat_ch = RE_CHAR_TO_UNIBYTE (pat_ch); | ||
| 5581 | } | 5575 | } |
| 5582 | else | 5576 | else |
| 5583 | { | 5577 | { |
diff --git a/src/syntax.c b/src/syntax.c index 8c5ebb96f28..6dc63c25537 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -1711,7 +1711,11 @@ skip_chars (forwardp, string, lim, handle_iso_classes) | |||
| 1711 | int c2 = char_ranges[i + 1]; | 1711 | int c2 = char_ranges[i + 1]; |
| 1712 | 1712 | ||
| 1713 | for (; c1 <= c2; c1++) | 1713 | for (; c1 <= c2; c1++) |
| 1714 | fastmap[CHAR_TO_BYTE8 (c1)] = 1; | 1714 | { |
| 1715 | int b = CHAR_TO_BYTE_SAFE (c1); | ||
| 1716 | if (b >= 0) | ||
| 1717 | fastmap[b] = 1; | ||
| 1718 | } | ||
| 1715 | } | 1719 | } |
| 1716 | } | 1720 | } |
| 1717 | } | 1721 | } |