Mercurial > emacs
comparison src/coding.c @ 89648:d5641a606e08
(Fdefine_coding_system_internal): Fix checking of ascii compatibility.
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Sun, 23 Nov 2003 02:17:20 +0000 |
| parents | fc9cda144ffc |
| children | cbaa9fd1aa5c |
comparison
equal
deleted
inserted
replaced
| 89647:b1e7c4bffed1 | 89648:d5641a606e08 |
|---|---|
| 8105 CHECK_LIST (val); | 8105 CHECK_LIST (val); |
| 8106 CODING_ATTR_PLIST (attrs) = val; | 8106 CODING_ATTR_PLIST (attrs) = val; |
| 8107 | 8107 |
| 8108 if (EQ (coding_type, Qcharset)) | 8108 if (EQ (coding_type, Qcharset)) |
| 8109 { | 8109 { |
| 8110 Lisp_Object list; | |
| 8111 /* Generate a lisp vector of 256 elements. Each element is nil, | 8110 /* Generate a lisp vector of 256 elements. Each element is nil, |
| 8112 integer, or a list of charset IDs. | 8111 integer, or a list of charset IDs. |
| 8113 | 8112 |
| 8114 If Nth element is nil, the byte code N is invalid in this | 8113 If Nth element is nil, the byte code N is invalid in this |
| 8115 coding system. | 8114 coding system. |
| 8117 If Nth element is a number NUM, N is the first byte of a | 8116 If Nth element is a number NUM, N is the first byte of a |
| 8118 charset whose ID is NUM. | 8117 charset whose ID is NUM. |
| 8119 | 8118 |
| 8120 If Nth element is a list of charset IDs, N is the first byte | 8119 If Nth element is a list of charset IDs, N is the first byte |
| 8121 of one of them. The list is sorted by dimensions of the | 8120 of one of them. The list is sorted by dimensions of the |
| 8122 charsets. A charset of smaller dimension comes firtst. | 8121 charsets. A charset of smaller dimension comes firtst. */ |
| 8123 */ | 8122 Lisp_Object list; |
| 8123 int maybe_ascii_compatible = 1; | |
| 8124 | |
| 8124 for (list = Qnil, tail = charset_list; CONSP (tail); tail = XCDR (tail)) | 8125 for (list = Qnil, tail = charset_list; CONSP (tail); tail = XCDR (tail)) |
| 8125 { | 8126 { |
| 8126 struct charset *charset = CHARSET_FROM_ID (XFASTINT (XCAR (tail))); | 8127 struct charset *charset = CHARSET_FROM_ID (XFASTINT (XCAR (tail))); |
| 8127 | 8128 |
| 8128 if (charset->method == CHARSET_METHOD_SUPERSET) | 8129 if (charset->method == CHARSET_METHOD_SUPERSET) |
| 8129 { | 8130 { |
| 8130 val = CHARSET_SUPERSET (charset); | 8131 val = CHARSET_SUPERSET (charset); |
| 8131 for (; CONSP (val); val = XCDR (val)) | 8132 for (; CONSP (val); val = XCDR (val)) |
| 8132 list = Fcons (XCAR (XCAR (val)), list); | 8133 list = Fcons (XCAR (XCAR (val)), list); |
| 8134 maybe_ascii_compatible = 0; | |
| 8133 } | 8135 } |
| 8134 else | 8136 else |
| 8135 list = Fcons (XCAR (tail), list); | 8137 list = Fcons (XCAR (tail), list); |
| 8136 } | 8138 } |
| 8137 | 8139 |
| 8141 { | 8143 { |
| 8142 struct charset *charset = CHARSET_FROM_ID (XFASTINT (XCAR (tail))); | 8144 struct charset *charset = CHARSET_FROM_ID (XFASTINT (XCAR (tail))); |
| 8143 int dim = CHARSET_DIMENSION (charset); | 8145 int dim = CHARSET_DIMENSION (charset); |
| 8144 int idx = (dim - 1) * 4; | 8146 int idx = (dim - 1) * 4; |
| 8145 | 8147 |
| 8146 if (CHARSET_ASCII_COMPATIBLE_P (charset)) | 8148 if (CHARSET_ASCII_COMPATIBLE_P (charset) |
| 8149 && maybe_ascii_compatible) | |
| 8147 CODING_ATTR_ASCII_COMPAT (attrs) = Qt; | 8150 CODING_ATTR_ASCII_COMPAT (attrs) = Qt; |
| 8148 | 8151 |
| 8149 for (i = charset->code_space[idx]; | 8152 for (i = charset->code_space[idx]; |
| 8150 i <= charset->code_space[idx + 1]; i++) | 8153 i <= charset->code_space[idx + 1]; i++) |
| 8151 { | 8154 { |
