diff options
author | Kenichi Handa <handa@m17n.org> | 1998-08-31 03:50:17 +0000 |
---|---|---|
committer | Kenichi Handa <handa@m17n.org> | 1998-08-31 03:50:17 +0000 |
commit | bbf12bb32b0f4d0a6e6fc2d4228173b4a1b51a8b (patch) | |
tree | 8af3411753d7ff9e65c0042086bab5fc4f90245c | |
parent | d4e57bcd5bedb4868574821064788561819690e7 (diff) | |
download | emacs-bbf12bb32b0f4d0a6e6fc2d4228173b4a1b51a8b.tar.gz emacs-bbf12bb32b0f4d0a6e6fc2d4228173b4a1b51a8b.tar.bz2 emacs-bbf12bb32b0f4d0a6e6fc2d4228173b4a1b51a8b.zip |
(unibyte_char_to_multibyte):
Vnonacii_translation_table will convert a 7-bit charcater.
(multibyte_char_to_unibyte): Handle the case that
Vnonacii_translation_table converts a multibyte charcater to a
unibyte charcter of less than 128.
(init_charset_once): Initialize nonascii_insert_offset and
Vnonacii_translation_table.
-rw-r--r-- | src/charset.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/charset.c b/src/charset.c index a9c79fe169d..55cfe717d3d 100644 --- a/src/charset.c +++ b/src/charset.c @@ -329,15 +329,23 @@ int unibyte_char_to_multibyte (c) int c; { - if (c >= 0240 && c < 0400) + if (c < 0400) { int c_save = c; if (! NILP (Vnonascii_translation_table)) - c = XINT (Faref (Vnonascii_translation_table, make_number (c))); - else if (nonascii_insert_offset > 0) - c += nonascii_insert_offset; - if (c >= 0240 && (c < 0400 || ! VALID_MULTIBYTE_CHAR_P (c))) + { + c = XINT (Faref (Vnonascii_translation_table, make_number (c))); + if (c >= 0400 && ! VALID_MULTIBYTE_CHAR_P (c)) + c = c_save + DEFAULT_NONASCII_INSERT_OFFSET; + } + else if (c >= 0240 && nonascii_insert_offset > 0) + { + c += nonascii_insert_offset; + if (c < 0400 || ! VALID_MULTIBYTE_CHAR_P (c)) + c = c_save + DEFAULT_NONASCII_INSERT_OFFSET; + } + else if (c >= 0240) c = c_save + DEFAULT_NONASCII_INSERT_OFFSET; } return c; @@ -369,11 +377,16 @@ multibyte_char_to_unibyte (c, rev_tbl) temp = Faref (rev_tbl, make_number (c)); if (INTEGERP (temp)) c = XINT (temp); + if (c >= 256) + c = (c_save & 0177) + 0200; + } + else + { + if (nonascii_insert_offset > 0) + c -= nonascii_insert_offset; + if (c < 128 || c >= 256) + c = (c_save & 0177) + 0200; } - else if (nonascii_insert_offset > 0) - c -= nonascii_insert_offset; - if (c < 128 || c >= 256) - c = (c_save & 0177) + 0200; } return c; @@ -1806,6 +1819,9 @@ init_charset_once () val = Fcons (make_number (GENERIC_COMPOSITION_CHAR), val); Vgeneric_character_list = Fnreverse (val); } + + nonascii_insert_offset = 0; + Vnonascii_translation_table = Qnil; } #ifdef emacs |