From cbe88c9c73d930b1348b2ed3415e7ef40692a784 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Tue, 7 Jul 2009 01:41:44 +0000 Subject: [PATCH] (Fset_charset_priority): Update charset_unibyte and charset_unibyte_decoder. (init_charset_once): Initialize charset_unibyte_decoder. (syms_of_charset): Initialize charset_unibyte. --- src/charset.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/charset.c b/src/charset.c index 6674861f133..8fb78fa0dc8 100644 --- a/src/charset.c +++ b/src/charset.c @@ -2260,6 +2260,7 @@ usage: (set-charset-priority &rest charsets) */) Vcharset_ordered_list = Fnconc (2, arglist); charset_ordered_list_tick++; + charset_unibyte = -1; for (old_list = Vcharset_ordered_list, list_2022 = list_emacs_mule = Qnil; CONSP (old_list); old_list = XCDR (old_list)) { @@ -2267,9 +2268,25 @@ usage: (set-charset-priority &rest charsets) */) list_2022 = Fcons (XCAR (old_list), list_2022); if (! NILP (Fmemq (XCAR (old_list), Vemacs_mule_charset_list))) list_emacs_mule = Fcons (XCAR (old_list), list_emacs_mule); + if (charset_unibyte < 0) + { + struct charset *charset = CHARSET_FROM_ID (XINT (XCAR (old_list))); + + if (CHARSET_DIMENSION (charset) == 1 + && CHARSET_ASCII_COMPATIBLE_P (charset) + && CHARSET_MAX_CHAR (charset) >= 0x80) + charset_unibyte = CHARSET_ID (charset); + } } Viso_2022_charset_list = Fnreverse (list_2022); Vemacs_mule_charset_list = Fnreverse (list_emacs_mule); + if (charset_unibyte < 0) + charset_unibyte = charset_iso_8859_1; + { + struct charset *charset = CHARSET_FROM_ID (charset_unibyte); + for (i = 128; i < 256; i++) + charset_unibyte_decoder[i - 128] = DECODE_CHAR (charset, i); + } return Qnil; } @@ -2328,6 +2345,10 @@ init_charset_once () unibyte_to_multibyte_table[i] = i; for (; i < 256; i++) unibyte_to_multibyte_table[i] = BYTE8_TO_CHAR (i); + for (i = 0; i < 32; i++) + charset_unibyte_decoder[i] = -1; + for (; i < 128; i++) + charset_unibyte_decoder[i] = 128 + i; } #ifdef emacs @@ -2429,6 +2450,7 @@ the value may be a list of mnemonics. */); = define_charset_internal (Qeight_bit, 1, "\x80\xFF\x00\x00\x00\x00", 128, 255, -1, 0, -1, 0, 1, MAX_5_BYTE_CHAR + 1); + charset_unibyte = charset_iso_8859_1; } #endif /* emacs */ -- 2.39.2