Mercurial > emacs
comparison src/coding.c @ 88497:d2b9e0d4c2f6
(Fdecode_sjis_char): Fix typo (0x7F->0xFF). Fix the
handling of charset list.
(encode_coding_iso_2022): Setup coding->safe_charsets in advance.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Tue, 14 May 2002 08:00:53 +0000 |
parents | e92f62c0073e |
children | a7f0d13affa5 |
comparison
equal
deleted
inserted
replaced
88496:959dea33a8d5 | 88497:d2b9e0d4c2f6 |
---|---|
3431 Lisp_Object attrs, eol_type, charset_list; | 3431 Lisp_Object attrs, eol_type, charset_list; |
3432 int ascii_compatible; | 3432 int ascii_compatible; |
3433 int c; | 3433 int c; |
3434 | 3434 |
3435 CODING_GET_INFO (coding, attrs, eol_type, charset_list); | 3435 CODING_GET_INFO (coding, attrs, eol_type, charset_list); |
3436 setup_iso_safe_charsets (attrs); | |
3437 coding->safe_charsets | |
3438 = (char *) XSTRING (CODING_ATTR_SAFE_CHARSETS(attrs))->data; | |
3436 | 3439 |
3437 ascii_compatible = ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)); | 3440 ascii_compatible = ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)); |
3438 | 3441 |
3439 while (charbuf < charbuf_end) | 3442 while (charbuf < charbuf_end) |
3440 { | 3443 { |
6809 && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs))) | 6812 && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs))) |
6810 return code; | 6813 return code; |
6811 | 6814 |
6812 val = CODING_ATTR_CHARSET_LIST (attrs); | 6815 val = CODING_ATTR_CHARSET_LIST (attrs); |
6813 charset_roman = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val); | 6816 charset_roman = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val); |
6814 charset_kanji = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val); | 6817 charset_kana = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val); |
6815 charset_kana = CHARSET_FROM_ID (XINT (XCAR (val))); | 6818 charset_kanji = CHARSET_FROM_ID (XINT (XCAR (val))); |
6816 | 6819 |
6817 if (c <= 0x7F) | 6820 if (c <= 0x7F) |
6818 charset = charset_roman; | 6821 charset = charset_roman; |
6819 else if (c >= 0xA0 && c < 0xDF) | 6822 else if (c >= 0xA0 && c < 0xDF) |
6820 { | 6823 { |
6821 charset = charset_kana; | 6824 charset = charset_kana; |
6822 c -= 0x80; | 6825 c -= 0x80; |
6823 } | 6826 } |
6824 else | 6827 else |
6825 { | 6828 { |
6826 int s1 = c >> 8, s2 = c & 0x7F; | 6829 int s1 = c >> 8, s2 = c & 0xFF; |
6827 | 6830 |
6828 if (s1 < 0x81 || (s1 > 0x9F && s1 < 0xE0) || s1 > 0xEF | 6831 if (s1 < 0x81 || (s1 > 0x9F && s1 < 0xE0) || s1 > 0xEF |
6829 || s2 < 0x40 || s2 == 0x7F || s2 > 0xFC) | 6832 || s2 < 0x40 || s2 == 0x7F || s2 > 0xFC) |
6830 error ("Invalid code: %d", code); | 6833 error ("Invalid code: %d", code); |
6831 SJIS_TO_JIS (c); | 6834 SJIS_TO_JIS (c); |