changeset 88681:2cdfbffa8a0d

(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.
author Kenichi Handa <handa@m17n.org>
date Thu, 30 May 2002 11:02:01 +0000
parents e574f078b30d
children e2170fdb6abc
files src/coding.c
diffstat 1 files changed, 36 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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
 	{