diff options
| author | Kenichi Handa | 2004-04-12 04:48:01 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2004-04-12 04:48:01 +0000 |
| commit | 933373ed1ab945dd29423b90ee2b76011ffbe64c (patch) | |
| tree | f15d3e5d0cfbdb987b0da2fc1181262645143713 /src/coding.h | |
| parent | 3f610986878cd69daf43d05eaa10be9ccf069e68 (diff) | |
| download | emacs-933373ed1ab945dd29423b90ee2b76011ffbe64c.tar.gz emacs-933373ed1ab945dd29423b90ee2b76011ffbe64c.zip | |
*** empty log message ***
Diffstat (limited to 'src/coding.h')
| -rw-r--r-- | src/coding.h | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/src/coding.h b/src/coding.h index 4988a1218fd..f5aae3467a0 100644 --- a/src/coding.h +++ b/src/coding.h | |||
| @@ -69,8 +69,16 @@ enum define_coding_ccl_arg_index | |||
| 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; |
| 73 | 80 | ||
| 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 |
| @@ -147,6 +155,8 @@ enum coding_attr_index | |||
| 147 | }; | 155 | }; |
| 148 | 156 | ||
| 149 | 157 | ||
| 158 | /* Macros to access an element of an attribute vector. */ | ||
| 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) |
| @@ -166,28 +176,45 @@ enum coding_attr_index | |||
| 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)) |
| 183 | 203 | ||
| 204 | |||
| 205 | /* Return the ID of CODING_SYSTEM_SYMBOL. */ | ||
| 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))) |
| 190 | 215 | ||
| 216 | /* Check if X is a coding system or not. */ | ||
| 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)) \ |
| @@ -195,6 +222,9 @@ enum coding_attr_index | |||
| 195 | } while (0) | 222 | } while (0) |
| 196 | 223 | ||
| 197 | 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. */ | ||
| 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); \ |
| @@ -203,6 +233,9 @@ enum coding_attr_index | |||
| 203 | } while (0) | 233 | } while (0) |
| 204 | 234 | ||
| 205 | 235 | ||
| 236 | /* Check if X is a coding system or not. If it is, set ID to the | ||
| 237 | ID of the coding system. */ | ||
| 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 | { \ |
| @@ -248,6 +281,8 @@ enum coding_result_code | |||
| 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 |
| @@ -374,6 +409,8 @@ struct coding_system | |||
| 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. |
| @@ -622,6 +659,8 @@ 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), \ |