# HG changeset patch # User Kenichi Handa # Date 1022756521 0 # Node ID 2cdfbffa8a0db6db645a48d554348d911cd1e9b5 # Parent e574f078b30d2789b121b2b267b34d9759f99ddb (CODING_ISO_FLAG_USE_ROMAN): New macro (CODING_ISO_FLAG_USE_OLDJIS): New macro. (CODING_ISO_FLAG_FULL_SUPPORT): Macro definition changed. (setup_iso_safe_charsets): Fix arguemtns to Fassq. (DECODE_DESIGNATION): Pay attention to CODING_ISO_FLAG_USE_ROMAN and CODING_ISO_FLAG_USE_OLDJIS. (ENCODE_ISO_CHARACTER_DIMENSION1): Likewise. (ENCODE_ISO_CHARACTER_DIMENSION2): Likewise. (encode_coding_iso_2022): Change the 1st arg to ENCODE_ISO_CHARACTER to a variable. diff -r e574f078b30d -r 2cdfbffa8a0d src/coding.c --- a/src/coding.c Thu May 30 00:32:34 2002 +0000 +++ b/src/coding.c Thu May 30 11:02:01 2002 +0000 @@ -556,7 +556,11 @@ #define CODING_ISO_FLAG_EUC_TW_SHIFT 0x4000 -#define CODING_ISO_FLAG_FULL_SUPPORT 0x8000 +#define CODING_ISO_FLAG_USE_ROMAN 0x8000 + +#define CODING_ISO_FLAG_USE_OLDJIS 0x10000 + +#define CODING_ISO_FLAG_FULL_SUPPORT 0x100000 /* A character to be produced on output if encoding of the original character is prohibited by CODING_ISO_FLAG_SAFE. */ @@ -2268,7 +2272,7 @@ id = XCAR (tail); charset = CHARSET_FROM_ID (XINT (id)); - reg = Fcdr (Fassq (request, id)); + reg = Fcdr (Fassq (id, request)); if (! NILP (reg)) XSTRING (safe_charsets)->data[XINT (id)] = XINT (reg); else if (charset->iso_chars_96) @@ -2562,6 +2566,16 @@ goto invalid_code; \ } \ prev = CODING_ISO_DESIGNATION (coding, reg); \ + if (id == charset_jisx0201_roman) \ + { \ + if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_USE_ROMAN) \ + id = charset_ascii; \ + } \ + else if (id == charset_jisx0208_1978) \ + { \ + if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_USE_OLDJIS) \ + id = charset_jisx0208; \ + } \ CODING_ISO_DESIGNATION (coding, reg) = id; \ /* If there was an invalid designation to REG previously, and this \ designation is ASCII to REG, we should keep this designation \ @@ -3201,6 +3215,14 @@ #define ENCODE_ISO_CHARACTER_DIMENSION1(charset, c1) \ do { \ int id = CHARSET_ID (charset); \ + \ + if ((CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_USE_ROMAN) \ + && id == charset_ascii) \ + { \ + id = charset_jisx0201_roman; \ + charset = CHARSET_FROM_ID (id); \ + } \ + \ if (CODING_ISO_SINGLE_SHIFTING (coding)) \ { \ if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_SEVEN_BITS) \ @@ -3237,6 +3259,14 @@ #define ENCODE_ISO_CHARACTER_DIMENSION2(charset, c1, c2) \ do { \ int id = CHARSET_ID (charset); \ + \ + if ((CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_USE_OLDJIS) \ + && id == charset_jisx0208) \ + { \ + id = charset_jisx0208_1978; \ + charset = CHARSET_FROM_ID (id); \ + } \ + \ if (CODING_ISO_SINGLE_SHIFTING (coding)) \ { \ if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_SEVEN_BITS) \ @@ -3520,7 +3550,10 @@ if (ascii_compatible) EMIT_ONE_ASCII_BYTE (c); else - ENCODE_ISO_CHARACTER (CHARSET_FROM_ID (charset_ascii), c); + { + struct charset *charset = CHARSET_FROM_ID (charset_ascii); + ENCODE_ISO_CHARACTER (charset, c); + } } else {