Mercurial > emacs
comparison src/coding.h @ 89886:623a853556f1
*** empty log message ***
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Mon, 12 Apr 2004 04:48:01 +0000 |
| parents | b06a8c2162e5 |
| children | c4c848b80f86 |
comparison
equal
deleted
inserted
replaced
| 89885:5214b8405cc6 | 89886:623a853556f1 |
|---|---|
| 67 coding_arg_ccl_encoder, | 67 coding_arg_ccl_encoder, |
| 68 coding_arg_ccl_valids, | 68 coding_arg_ccl_valids, |
| 69 coding_arg_ccl_max | 69 coding_arg_ccl_max |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 /* Hash table for all coding systems. Keys are coding system symbols | |
| 73 and values are spec vectors of the corresponding coding system. A | |
| 74 spec vector has the form [ ATTRS ALIASES EOL-TYPE ]. ATTRS is a | |
| 75 vector of attribute of the coding system. ALIASES is a list of | |
| 76 aliases (symbols) of the coding system. EOL-TYPE is `unix', `dos', | |
| 77 `mac' or a vector of coding systems (symbols). */ | |
| 78 | |
| 72 extern Lisp_Object Vcoding_system_hash_table; | 79 extern Lisp_Object Vcoding_system_hash_table; |
| 80 | |
| 73 | 81 |
| 74 /* Enumeration of coding system type. */ | 82 /* Enumeration of coding system type. */ |
| 75 | 83 |
| 76 enum coding_system_type | 84 enum coding_system_type |
| 77 { | 85 { |
| 144 coding_attr_emacs_mule_full, | 152 coding_attr_emacs_mule_full, |
| 145 | 153 |
| 146 coding_attr_last_index | 154 coding_attr_last_index |
| 147 }; | 155 }; |
| 148 | 156 |
| 157 | |
| 158 /* Macros to access an element of an attribute vector. */ | |
| 149 | 159 |
| 150 #define CODING_ATTR_BASE_NAME(attrs) AREF (attrs, coding_attr_base_name) | 160 #define CODING_ATTR_BASE_NAME(attrs) AREF (attrs, coding_attr_base_name) |
| 151 #define CODING_ATTR_TYPE(attrs) AREF (attrs, coding_attr_type) | 161 #define CODING_ATTR_TYPE(attrs) AREF (attrs, coding_attr_type) |
| 152 #define CODING_ATTR_CHARSET_LIST(attrs) AREF (attrs, coding_attr_charset_list) | 162 #define CODING_ATTR_CHARSET_LIST(attrs) AREF (attrs, coding_attr_charset_list) |
| 153 #define CODING_ATTR_MNEMONIC(attrs) AREF (attrs, coding_attr_mnemonic) | 163 #define CODING_ATTR_MNEMONIC(attrs) AREF (attrs, coding_attr_mnemonic) |
| 164 #define CODING_ATTR_PLIST(attrs) AREF (attrs, coding_attr_plist) | 174 #define CODING_ATTR_PLIST(attrs) AREF (attrs, coding_attr_plist) |
| 165 #define CODING_ATTR_CATEGORY(attrs) AREF (attrs, coding_attr_category) | 175 #define CODING_ATTR_CATEGORY(attrs) AREF (attrs, coding_attr_category) |
| 166 #define CODING_ATTR_SAFE_CHARSETS(attrs)AREF (attrs, coding_attr_safe_charsets) | 176 #define CODING_ATTR_SAFE_CHARSETS(attrs)AREF (attrs, coding_attr_safe_charsets) |
| 167 | 177 |
| 168 | 178 |
| 179 /* Return the name of a coding system specified by ID. */ | |
| 180 #define CODING_ID_NAME(id) \ | |
| 181 (HASH_KEY (XHASH_TABLE (Vcoding_system_hash_table), id)) | |
| 182 | |
| 183 /* Return the attribute vector of a coding system specified by ID. */ | |
| 184 | |
| 169 #define CODING_ID_ATTRS(id) \ | 185 #define CODING_ID_ATTRS(id) \ |
| 170 (AREF (HASH_VALUE (XHASH_TABLE (Vcoding_system_hash_table), id), 0)) | 186 (AREF (HASH_VALUE (XHASH_TABLE (Vcoding_system_hash_table), id), 0)) |
| 171 | 187 |
| 188 /* Return the list of aliases of a coding system specified by ID. */ | |
| 189 | |
| 172 #define CODING_ID_ALIASES(id) \ | 190 #define CODING_ID_ALIASES(id) \ |
| 173 (AREF (HASH_VALUE (XHASH_TABLE (Vcoding_system_hash_table), id), 1)) | 191 (AREF (HASH_VALUE (XHASH_TABLE (Vcoding_system_hash_table), id), 1)) |
| 174 | 192 |
| 193 /* Return the eol-type of a coding system specified by ID. */ | |
| 194 | |
| 175 #define CODING_ID_EOL_TYPE(id) \ | 195 #define CODING_ID_EOL_TYPE(id) \ |
| 176 (AREF (HASH_VALUE (XHASH_TABLE (Vcoding_system_hash_table), id), 2)) | 196 (AREF (HASH_VALUE (XHASH_TABLE (Vcoding_system_hash_table), id), 2)) |
| 177 | 197 |
| 178 #define CODING_ID_NAME(id) \ | 198 |
| 179 (HASH_KEY (XHASH_TABLE (Vcoding_system_hash_table), id)) | 199 /* Return the spec vector of CODING_SYSTEM_SYMBOL. */ |
| 180 | 200 |
| 181 #define CODING_SYSTEM_SPEC(coding_system_symbol) \ | 201 #define CODING_SYSTEM_SPEC(coding_system_symbol) \ |
| 182 (Fgethash (coding_system_symbol, Vcoding_system_hash_table, Qnil)) | 202 (Fgethash (coding_system_symbol, Vcoding_system_hash_table, Qnil)) |
| 203 | |
| 204 | |
| 205 /* Return the ID of CODING_SYSTEM_SYMBOL. */ | |
| 183 | 206 |
| 184 #define CODING_SYSTEM_ID(coding_system_symbol) \ | 207 #define CODING_SYSTEM_ID(coding_system_symbol) \ |
| 185 hash_lookup (XHASH_TABLE (Vcoding_system_hash_table), \ | 208 hash_lookup (XHASH_TABLE (Vcoding_system_hash_table), \ |
| 186 coding_system_symbol, NULL) | 209 coding_system_symbol, NULL) |
| 187 | 210 |
| 211 /* Return 1 iff CODING_SYSTEM_SYMBOL is a coding system. */ | |
| 212 | |
| 188 #define CODING_SYSTEM_P(coding_system_symbol) \ | 213 #define CODING_SYSTEM_P(coding_system_symbol) \ |
| 189 (! NILP (CODING_SYSTEM_SPEC (coding_system_symbol))) | 214 (! NILP (CODING_SYSTEM_SPEC (coding_system_symbol))) |
| 215 | |
| 216 /* Check if X is a coding system or not. */ | |
| 190 | 217 |
| 191 #define CHECK_CODING_SYSTEM(x) \ | 218 #define CHECK_CODING_SYSTEM(x) \ |
| 192 do { \ | 219 do { \ |
| 193 if (!CODING_SYSTEM_P (x)) \ | 220 if (!CODING_SYSTEM_P (x)) \ |
| 194 wrong_type_argument (Qcoding_system_p, (x)); \ | 221 wrong_type_argument (Qcoding_system_p, (x)); \ |
| 195 } while (0) | 222 } while (0) |
| 196 | 223 |
| 224 | |
| 225 /* Check if X is a coding system or not. If it is, set SEPC to the | |
| 226 spec vector of the coding system. */ | |
| 197 | 227 |
| 198 #define CHECK_CODING_SYSTEM_GET_SPEC(x, spec) \ | 228 #define CHECK_CODING_SYSTEM_GET_SPEC(x, spec) \ |
| 199 do { \ | 229 do { \ |
| 200 spec = CODING_SYSTEM_SPEC (x); \ | 230 spec = CODING_SYSTEM_SPEC (x); \ |
| 201 if (NILP (spec)) \ | 231 if (NILP (spec)) \ |
| 202 x = wrong_type_argument (Qcoding_system_p, (x)); \ | 232 x = wrong_type_argument (Qcoding_system_p, (x)); \ |
| 203 } while (0) | 233 } while (0) |
| 204 | 234 |
| 235 | |
| 236 /* Check if X is a coding system or not. If it is, set ID to the | |
| 237 ID of the coding system. */ | |
| 205 | 238 |
| 206 #define CHECK_CODING_SYSTEM_GET_ID(x, id) \ | 239 #define CHECK_CODING_SYSTEM_GET_ID(x, id) \ |
| 207 do \ | 240 do \ |
| 208 { \ | 241 { \ |
| 209 id = CODING_SYSTEM_ID (x); \ | 242 id = CODING_SYSTEM_ID (x); \ |
| 246 set, it means that right-to-left text is being processed. */ | 279 set, it means that right-to-left text is being processed. */ |
| 247 #define CODING_MODE_DIRECTION 0x08 | 280 #define CODING_MODE_DIRECTION 0x08 |
| 248 | 281 |
| 249 #define CODING_MODE_FIXED_DESTINATION 0x10 | 282 #define CODING_MODE_FIXED_DESTINATION 0x10 |
| 250 | 283 |
| 284 /* If set, it means that the encoding routines produces some safe | |
| 285 ASCII characters (usually '?') for unsupported characters. */ | |
| 251 #define CODING_MODE_SAFE_ENCODING 0x20 | 286 #define CODING_MODE_SAFE_ENCODING 0x20 |
| 252 | 287 |
| 253 /* Structure of the field `spec.iso_2022' in the structure | 288 /* Structure of the field `spec.iso_2022' in the structure |
| 254 `coding_system'. */ | 289 `coding_system'. */ |
| 255 struct iso_2022_spec | 290 struct iso_2022_spec |
| 372 | 407 |
| 373 EMACS_INT dst_pos, dst_pos_byte, dst_bytes; | 408 EMACS_INT dst_pos, dst_pos_byte, dst_bytes; |
| 374 Lisp_Object dst_object; | 409 Lisp_Object dst_object; |
| 375 unsigned char *destination; | 410 unsigned char *destination; |
| 376 | 411 |
| 412 /* Set to 1 iff the source of conversion is not in the member | |
| 413 `charbuf', but at `src_object'. */ | |
| 377 int chars_at_source; | 414 int chars_at_source; |
| 378 | 415 |
| 379 /* If an element is non-negative, it is a character code. | 416 /* If an element is non-negative, it is a character code. |
| 380 | 417 |
| 381 If it is in the range -128..-1, it is a 8-bit character code | 418 If it is in the range -128..-1, it is a 8-bit character code |
| 620 EMACS_INT, EMACS_INT, Lisp_Object)); | 657 EMACS_INT, EMACS_INT, Lisp_Object)); |
| 621 extern void encode_coding_object P_ ((struct coding_system *, | 658 extern void encode_coding_object P_ ((struct coding_system *, |
| 622 Lisp_Object, EMACS_INT, EMACS_INT, | 659 Lisp_Object, EMACS_INT, EMACS_INT, |
| 623 EMACS_INT, EMACS_INT, Lisp_Object)); | 660 EMACS_INT, EMACS_INT, Lisp_Object)); |
| 624 | 661 |
| 662 /* Macros for backward compatibility. */ | |
| 663 | |
| 625 #define decode_coding_region(coding, from, to) \ | 664 #define decode_coding_region(coding, from, to) \ |
| 626 decode_coding_object (coding, Fcurrent_buffer (), \ | 665 decode_coding_object (coding, Fcurrent_buffer (), \ |
| 627 from, CHAR_TO_BYTE (from), \ | 666 from, CHAR_TO_BYTE (from), \ |
| 628 to, CHAR_TO_BYTE (to), Fcurrent_buffer ()) | 667 to, CHAR_TO_BYTE (to), Fcurrent_buffer ()) |
| 629 | 668 |
