aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2010-11-25 12:55:14 +0900
committerKenichi Handa2010-11-25 12:55:14 +0900
commitb84ae584330c940010bc543fd925eddeb13fd9e2 (patch)
treec0a1ef38fd720674080b3ef1fc8e5f3cad6e7145
parentcf5314c93a722b73cbf0f3607bea152d79c3df7b (diff)
downloademacs-b84ae584330c940010bc543fd925eddeb13fd9e2.tar.gz
emacs-b84ae584330c940010bc543fd925eddeb13fd9e2.zip
Fix decoding of emacs-mule coding system.
-rw-r--r--src/ChangeLog16
-rw-r--r--src/charset.c6
-rw-r--r--src/charset.h4
-rw-r--r--src/coding.c20
-rw-r--r--src/lread.c8
5 files changed, 34 insertions, 20 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d33f9dd4f0b..7daa09c703f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,19 @@
12010-11-25 Kenichi Handa <handa@m17n.org>
2
3 * charset.c (emacs_mule_charset): Make it an array of charset ID;
4 i.e. integer.
5 (Fdefine_charset_internal): Adjusted for the above change.
6 (init_charset_once): Likewise.
7
8 * charset.h (emacs_mule_charset): Adjust the prototype. Delete
9 duplicated extern.
10
11 * coding.c (emacs_mule_char): Adjust for the change of
12 emacs_mule_charset.
13
14 * lread.c (read_emacs_mule_char): Adjust for the change of
15 emacs_mule_charset.
16
12010-10-18 Ken Brown <kbrown@cornell.edu> 172010-10-18 Ken Brown <kbrown@cornell.edu>
2 18
3 * s/cygwin.h (SIGNALS_VIA_CHARACTERS): New define (bug#7225). 19 * s/cygwin.h (SIGNALS_VIA_CHARACTERS): New define (bug#7225).
diff --git a/src/charset.c b/src/charset.c
index 3b45dc348ed..60203d6a532 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -115,7 +115,7 @@ Lisp_Object Viso_2022_charset_list;
115/* List of emacs-mule charsets. */ 115/* List of emacs-mule charsets. */
116Lisp_Object Vemacs_mule_charset_list; 116Lisp_Object Vemacs_mule_charset_list;
117 117
118struct charset *emacs_mule_charset[256]; 118int emacs_mule_charset[256];
119 119
120/* Mapping table from ISO2022's charset (specified by DIMENSION, 120/* Mapping table from ISO2022's charset (specified by DIMENSION,
121 CHARS, and FINAL-CHAR) to Emacs' charset. */ 121 CHARS, and FINAL-CHAR) to Emacs' charset. */
@@ -1248,7 +1248,7 @@ usage: (define-charset-internal ...) */)
1248 1248
1249 if (charset.emacs_mule_id >= 0) 1249 if (charset.emacs_mule_id >= 0)
1250 { 1250 {
1251 emacs_mule_charset[charset.emacs_mule_id] = CHARSET_FROM_ID (id); 1251 emacs_mule_charset[charset.emacs_mule_id] = id;
1252 if (charset.emacs_mule_id < 0xA0) 1252 if (charset.emacs_mule_id < 0xA0)
1253 emacs_mule_bytes[charset.emacs_mule_id] = charset.dimension + 1; 1253 emacs_mule_bytes[charset.emacs_mule_id] = charset.dimension + 1;
1254 else 1254 else
@@ -2405,7 +2405,7 @@ init_charset_once ()
2405 iso_charset_table[i][j][k] = -1; 2405 iso_charset_table[i][j][k] = -1;
2406 2406
2407 for (i = 0; i < 256; i++) 2407 for (i = 0; i < 256; i++)
2408 emacs_mule_charset[i] = NULL; 2408 emacs_mule_charset[i] = -1;
2409 2409
2410 charset_jisx0201_roman = -1; 2410 charset_jisx0201_roman = -1;
2411 charset_jisx0208_1978 = -1; 2411 charset_jisx0208_1978 = -1;
diff --git a/src/charset.h b/src/charset.h
index 718859929df..7afe6546908 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -255,7 +255,7 @@ extern Lisp_Object Vcharset_list;
255extern Lisp_Object Viso_2022_charset_list; 255extern Lisp_Object Viso_2022_charset_list;
256extern Lisp_Object Vemacs_mule_charset_list; 256extern Lisp_Object Vemacs_mule_charset_list;
257 257
258extern struct charset *emacs_mule_charset[256]; 258extern int emacs_mule_charset[256];
259 259
260extern Lisp_Object Vcurrent_iso639_language; 260extern Lisp_Object Vcurrent_iso639_language;
261 261
@@ -517,8 +517,6 @@ extern int iso_charset_table[ISO_MAX_DIMENSION][ISO_MAX_CHARS][ISO_MAX_FINAL];
517#define EMACS_MULE_LEADING_CODE_PRIVATE_21 0x9C /* 2/2 */ 517#define EMACS_MULE_LEADING_CODE_PRIVATE_21 0x9C /* 2/2 */
518#define EMACS_MULE_LEADING_CODE_PRIVATE_22 0x9D /* 2/2 */ 518#define EMACS_MULE_LEADING_CODE_PRIVATE_22 0x9D /* 2/2 */
519 519
520extern struct charset *emacs_mule_charset[256];
521
522 520
523 521
524extern Lisp_Object Qcharsetp; 522extern Lisp_Object Qcharsetp;
diff --git a/src/coding.c b/src/coding.c
index 137e72a0ba4..9c989e1c39e 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -2078,7 +2078,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status)
2078 const unsigned char *src_end = coding->source + coding->src_bytes; 2078 const unsigned char *src_end = coding->source + coding->src_bytes;
2079 const unsigned char *src_base = src; 2079 const unsigned char *src_base = src;
2080 int multibytep = coding->src_multibyte; 2080 int multibytep = coding->src_multibyte;
2081 struct charset *charset; 2081 int charset_id;
2082 unsigned code; 2082 unsigned code;
2083 int c; 2083 int c;
2084 int consumed_chars = 0; 2084 int consumed_chars = 0;
@@ -2088,7 +2088,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status)
2088 if (c < 0) 2088 if (c < 0)
2089 { 2089 {
2090 c = -c; 2090 c = -c;
2091 charset = emacs_mule_charset[0]; 2091 charset_id = emacs_mule_charset[0];
2092 } 2092 }
2093 else 2093 else
2094 { 2094 {
@@ -2124,7 +2124,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status)
2124 switch (emacs_mule_bytes[c]) 2124 switch (emacs_mule_bytes[c])
2125 { 2125 {
2126 case 2: 2126 case 2:
2127 if (! (charset = emacs_mule_charset[c])) 2127 if ((charset_id = emacs_mule_charset[c]) < 0)
2128 goto invalid_code; 2128 goto invalid_code;
2129 ONE_MORE_BYTE (c); 2129 ONE_MORE_BYTE (c);
2130 if (c < 0xA0) 2130 if (c < 0xA0)
@@ -2137,7 +2137,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status)
2137 || c == EMACS_MULE_LEADING_CODE_PRIVATE_12) 2137 || c == EMACS_MULE_LEADING_CODE_PRIVATE_12)
2138 { 2138 {
2139 ONE_MORE_BYTE (c); 2139 ONE_MORE_BYTE (c);
2140 if (c < 0xA0 || ! (charset = emacs_mule_charset[c])) 2140 if (c < 0xA0 || (charset_id = emacs_mule_charset[c]) < 0)
2141 goto invalid_code; 2141 goto invalid_code;
2142 ONE_MORE_BYTE (c); 2142 ONE_MORE_BYTE (c);
2143 if (c < 0xA0) 2143 if (c < 0xA0)
@@ -2146,7 +2146,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status)
2146 } 2146 }
2147 else 2147 else
2148 { 2148 {
2149 if (! (charset = emacs_mule_charset[c])) 2149 if ((charset_id = emacs_mule_charset[c]) < 0)
2150 goto invalid_code; 2150 goto invalid_code;
2151 ONE_MORE_BYTE (c); 2151 ONE_MORE_BYTE (c);
2152 if (c < 0xA0) 2152 if (c < 0xA0)
@@ -2161,7 +2161,7 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status)
2161 2161
2162 case 4: 2162 case 4:
2163 ONE_MORE_BYTE (c); 2163 ONE_MORE_BYTE (c);
2164 if (c < 0 || ! (charset = emacs_mule_charset[c])) 2164 if (c < 0 || (charset_id = emacs_mule_charset[c]) < 0)
2165 goto invalid_code; 2165 goto invalid_code;
2166 ONE_MORE_BYTE (c); 2166 ONE_MORE_BYTE (c);
2167 if (c < 0xA0) 2167 if (c < 0xA0)
@@ -2175,21 +2175,21 @@ emacs_mule_char (coding, src, nbytes, nchars, id, cmp_status)
2175 2175
2176 case 1: 2176 case 1:
2177 code = c; 2177 code = c;
2178 charset = CHARSET_FROM_ID (ASCII_BYTE_P (code) 2178 charset_id = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit;
2179 ? charset_ascii : charset_eight_bit);
2180 break; 2179 break;
2181 2180
2182 default: 2181 default:
2183 abort (); 2182 abort ();
2184 } 2183 }
2185 CODING_DECODE_CHAR (coding, src, src_base, src_end, charset, code, c); 2184 CODING_DECODE_CHAR (coding, src, src_base, src_end,
2185 CHARSET_FROM_ID (charset_id), code, c);
2186 if (c < 0) 2186 if (c < 0)
2187 goto invalid_code; 2187 goto invalid_code;
2188 } 2188 }
2189 *nbytes = src - src_base; 2189 *nbytes = src - src_base;
2190 *nchars = consumed_chars; 2190 *nchars = consumed_chars;
2191 if (id) 2191 if (id)
2192 *id = charset->id; 2192 *id = charset_id;
2193 return (mseq_found ? -c : c); 2193 return (mseq_found ? -c : c);
2194 2194
2195 no_more_source: 2195 no_more_source:
diff --git a/src/lread.c b/src/lread.c
index c96e391a2d3..13de4d01317 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -616,7 +616,7 @@ read_emacs_mule_char (c, readbyte, readcharfun)
616 616
617 if (len == 2) 617 if (len == 2)
618 { 618 {
619 charset = emacs_mule_charset[buf[0]]; 619 charset = CHARSET_FROM_ID (emacs_mule_charset[buf[0]]);
620 code = buf[1] & 0x7F; 620 code = buf[1] & 0x7F;
621 } 621 }
622 else if (len == 3) 622 else if (len == 3)
@@ -624,18 +624,18 @@ read_emacs_mule_char (c, readbyte, readcharfun)
624 if (buf[0] == EMACS_MULE_LEADING_CODE_PRIVATE_11 624 if (buf[0] == EMACS_MULE_LEADING_CODE_PRIVATE_11
625 || buf[0] == EMACS_MULE_LEADING_CODE_PRIVATE_12) 625 || buf[0] == EMACS_MULE_LEADING_CODE_PRIVATE_12)
626 { 626 {
627 charset = emacs_mule_charset[buf[1]]; 627 charset = CHARSET_FROM_ID (emacs_mule_charset[buf[1]]);
628 code = buf[2] & 0x7F; 628 code = buf[2] & 0x7F;
629 } 629 }
630 else 630 else
631 { 631 {
632 charset = emacs_mule_charset[buf[0]]; 632 charset = CHARSET_FROM_ID (emacs_mule_charset[buf[0]]);
633 code = ((buf[1] << 8) | buf[2]) & 0x7F7F; 633 code = ((buf[1] << 8) | buf[2]) & 0x7F7F;
634 } 634 }
635 } 635 }
636 else 636 else
637 { 637 {
638 charset = emacs_mule_charset[buf[1]]; 638 charset = CHARSET_FROM_ID (emacs_mule_charset[buf[1]]);
639 code = ((buf[2] << 8) | buf[3]) & 0x7F7F; 639 code = ((buf[2] << 8) | buf[3]) & 0x7F7F;
640 } 640 }
641 c = DECODE_CHAR (charset, code); 641 c = DECODE_CHAR (charset, code);