diff options
| author | Kenichi Handa | 2009-07-07 06:26:18 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2009-07-07 06:26:18 +0000 |
| commit | 2e5db15c9da54febad8adcb72d3a33688f3171b2 (patch) | |
| tree | d77f8d861481d1e07219bc139d9e78367a767bdc /src | |
| parent | af800dc07518034c070aff803c24fe5cdc8e44b7 (diff) | |
| download | emacs-2e5db15c9da54febad8adcb72d3a33688f3171b2.tar.gz emacs-2e5db15c9da54febad8adcb72d3a33688f3171b2.zip | |
(unibyte_has_multibyte_table): Delete it.
(multibyte_char_to_unibyte): Use CHAR_TO_BYTE8 instead of checking
charset_unibyte.
(multibyte_char_to_unibyte_safe): Likewise.
(Funibyte_char_to_multibyte): Don't check charset_unibyte.
Diffstat (limited to 'src')
| -rw-r--r-- | src/character.c | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/src/character.c b/src/character.c index 50ca6521262..509a14789ad 100644 --- a/src/character.c +++ b/src/character.c | |||
| @@ -90,10 +90,6 @@ Lisp_Object Vunicode_category_table; | |||
| 90 | /* Mapping table from unibyte chars to multibyte chars. */ | 90 | /* Mapping table from unibyte chars to multibyte chars. */ |
| 91 | int unibyte_to_multibyte_table[256]; | 91 | int unibyte_to_multibyte_table[256]; |
| 92 | 92 | ||
| 93 | /* Nth element is 1 iff unibyte char N can be mapped to a multibyte | ||
| 94 | char. */ | ||
| 95 | char unibyte_has_multibyte_table[256]; | ||
| 96 | |||
| 97 | 93 | ||
| 98 | 94 | ||
| 99 | /* If character code C has modifier masks, reflect them to the | 95 | /* If character code C has modifier masks, reflect them to the |
| @@ -270,9 +266,8 @@ translate_char (table, c) | |||
| 270 | return c; | 266 | return c; |
| 271 | } | 267 | } |
| 272 | 268 | ||
| 273 | /* Convert the multibyte character C to unibyte 8-bit character based | 269 | /* Convert ASCII or 8-bit character C to unibyte. If C is none of |
| 274 | on the current value of charset_unibyte. If dimension of | 270 | them, return (C & 0xFF). |
| 275 | charset_unibyte is more than one, return (C & 0xFF). | ||
| 276 | 271 | ||
| 277 | The argument REV_TBL is now ignored. It will be removed in the | 272 | The argument REV_TBL is now ignored. It will be removed in the |
| 278 | future. */ | 273 | future. */ |
| @@ -282,14 +277,11 @@ multibyte_char_to_unibyte (c, rev_tbl) | |||
| 282 | int c; | 277 | int c; |
| 283 | Lisp_Object rev_tbl; | 278 | Lisp_Object rev_tbl; |
| 284 | { | 279 | { |
| 285 | struct charset *charset; | 280 | if (c < 0x80) |
| 286 | unsigned c1; | 281 | return c; |
| 287 | |||
| 288 | if (CHAR_BYTE8_P (c)) | 282 | if (CHAR_BYTE8_P (c)) |
| 289 | return CHAR_TO_BYTE8 (c); | 283 | return CHAR_TO_BYTE8 (c); |
| 290 | charset = CHARSET_FROM_ID (charset_unibyte); | 284 | return (c & 0xFF); |
| 291 | c1 = ENCODE_CHAR (charset, c); | ||
| 292 | return ((c1 != CHARSET_INVALID_CODE (charset)) ? c1 : c & 0xFF); | ||
| 293 | } | 285 | } |
| 294 | 286 | ||
| 295 | /* Like multibyte_char_to_unibyte, but return -1 if C is not supported | 287 | /* Like multibyte_char_to_unibyte, but return -1 if C is not supported |
| @@ -299,14 +291,11 @@ int | |||
| 299 | multibyte_char_to_unibyte_safe (c) | 291 | multibyte_char_to_unibyte_safe (c) |
| 300 | int c; | 292 | int c; |
| 301 | { | 293 | { |
| 302 | struct charset *charset; | 294 | if (c < 0x80) |
| 303 | unsigned c1; | 295 | return c; |
| 304 | |||
| 305 | if (CHAR_BYTE8_P (c)) | 296 | if (CHAR_BYTE8_P (c)) |
| 306 | return CHAR_TO_BYTE8 (c); | 297 | return CHAR_TO_BYTE8 (c); |
| 307 | charset = CHARSET_FROM_ID (charset_unibyte); | 298 | return -1; |
| 308 | c1 = ENCODE_CHAR (charset, c); | ||
| 309 | return ((c1 != CHARSET_INVALID_CODE (charset)) ? c1 : -1); | ||
| 310 | } | 299 | } |
| 311 | 300 | ||
| 312 | DEFUN ("characterp", Fcharacterp, Scharacterp, 1, 2, 0, | 301 | DEFUN ("characterp", Fcharacterp, Scharacterp, 1, 2, 0, |
| @@ -331,16 +320,13 @@ DEFUN ("unibyte-char-to-multibyte", Funibyte_char_to_multibyte, | |||
| 331 | Lisp_Object ch; | 320 | Lisp_Object ch; |
| 332 | { | 321 | { |
| 333 | int c; | 322 | int c; |
| 334 | struct charset *charset; | ||
| 335 | 323 | ||
| 336 | CHECK_CHARACTER (ch); | 324 | CHECK_CHARACTER (ch); |
| 337 | c = XFASTINT (ch); | 325 | c = XFASTINT (ch); |
| 338 | if (c >= 0400) | 326 | if (c >= 0x100) |
| 339 | error ("Invalid unibyte character: %d", c); | 327 | error ("Not a unibyte character: %d", c); |
| 340 | charset = CHARSET_FROM_ID (charset_unibyte); | 328 | if (c >= 0x80) |
| 341 | c = DECODE_CHAR (charset, c); | 329 | c = BYTE8_TO_CHAR (c); |
| 342 | if (c < 0) | ||
| 343 | c = BYTE8_TO_CHAR (XFASTINT (ch)); | ||
| 344 | return make_number (c); | 330 | return make_number (c); |
| 345 | } | 331 | } |
| 346 | 332 | ||