# HG changeset patch # User Kenichi Handa # Date 1081745281 0 # Node ID 623a853556f1238042541a58f70da75c0cf52081 # Parent 5214b8405cc64b00879ef2f97c4eaeac83111106 *** empty log message *** diff -r 5214b8405cc6 -r 623a853556f1 src/coding.h --- a/src/coding.h Sun Apr 11 23:30:51 2004 +0000 +++ b/src/coding.h Mon Apr 12 04:48:01 2004 +0000 @@ -69,8 +69,16 @@ coding_arg_ccl_max }; +/* Hash table for all coding systems. Keys are coding system symbols + and values are spec vectors of the corresponding coding system. A + spec vector has the form [ ATTRS ALIASES EOL-TYPE ]. ATTRS is a + vector of attribute of the coding system. ALIASES is a list of + aliases (symbols) of the coding system. EOL-TYPE is `unix', `dos', + `mac' or a vector of coding systems (symbols). */ + extern Lisp_Object Vcoding_system_hash_table; + /* Enumeration of coding system type. */ enum coding_system_type @@ -147,6 +155,8 @@ }; +/* Macros to access an element of an attribute vector. */ + #define CODING_ATTR_BASE_NAME(attrs) AREF (attrs, coding_attr_base_name) #define CODING_ATTR_TYPE(attrs) AREF (attrs, coding_attr_type) #define CODING_ATTR_CHARSET_LIST(attrs) AREF (attrs, coding_attr_charset_list) @@ -166,28 +176,45 @@ #define CODING_ATTR_SAFE_CHARSETS(attrs)AREF (attrs, coding_attr_safe_charsets) +/* Return the name of a coding system specified by ID. */ +#define CODING_ID_NAME(id) \ + (HASH_KEY (XHASH_TABLE (Vcoding_system_hash_table), id)) + +/* Return the attribute vector of a coding system specified by ID. */ + #define CODING_ID_ATTRS(id) \ (AREF (HASH_VALUE (XHASH_TABLE (Vcoding_system_hash_table), id), 0)) +/* Return the list of aliases of a coding system specified by ID. */ + #define CODING_ID_ALIASES(id) \ (AREF (HASH_VALUE (XHASH_TABLE (Vcoding_system_hash_table), id), 1)) +/* Return the eol-type of a coding system specified by ID. */ + #define CODING_ID_EOL_TYPE(id) \ (AREF (HASH_VALUE (XHASH_TABLE (Vcoding_system_hash_table), id), 2)) -#define CODING_ID_NAME(id) \ - (HASH_KEY (XHASH_TABLE (Vcoding_system_hash_table), id)) + +/* Return the spec vector of CODING_SYSTEM_SYMBOL. */ #define CODING_SYSTEM_SPEC(coding_system_symbol) \ (Fgethash (coding_system_symbol, Vcoding_system_hash_table, Qnil)) + +/* Return the ID of CODING_SYSTEM_SYMBOL. */ + #define CODING_SYSTEM_ID(coding_system_symbol) \ hash_lookup (XHASH_TABLE (Vcoding_system_hash_table), \ coding_system_symbol, NULL) +/* Return 1 iff CODING_SYSTEM_SYMBOL is a coding system. */ + #define CODING_SYSTEM_P(coding_system_symbol) \ (! NILP (CODING_SYSTEM_SPEC (coding_system_symbol))) +/* Check if X is a coding system or not. */ + #define CHECK_CODING_SYSTEM(x) \ do { \ if (!CODING_SYSTEM_P (x)) \ @@ -195,6 +222,9 @@ } while (0) +/* Check if X is a coding system or not. If it is, set SEPC to the + spec vector of the coding system. */ + #define CHECK_CODING_SYSTEM_GET_SPEC(x, spec) \ do { \ spec = CODING_SYSTEM_SPEC (x); \ @@ -203,6 +233,9 @@ } while (0) +/* Check if X is a coding system or not. If it is, set ID to the + ID of the coding system. */ + #define CHECK_CODING_SYSTEM_GET_ID(x, id) \ do \ { \ @@ -248,6 +281,8 @@ #define CODING_MODE_FIXED_DESTINATION 0x10 +/* If set, it means that the encoding routines produces some safe + ASCII characters (usually '?') for unsupported characters. */ #define CODING_MODE_SAFE_ENCODING 0x20 /* Structure of the field `spec.iso_2022' in the structure @@ -374,6 +409,8 @@ Lisp_Object dst_object; unsigned char *destination; + /* Set to 1 iff the source of conversion is not in the member + `charbuf', but at `src_object'. */ int chars_at_source; /* If an element is non-negative, it is a character code. @@ -622,6 +659,8 @@ Lisp_Object, EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, Lisp_Object)); +/* Macros for backward compatibility. */ + #define decode_coding_region(coding, from, to) \ decode_coding_object (coding, Fcurrent_buffer (), \ from, CHAR_TO_BYTE (from), \