comparison src/coding.c @ 90289:72d8a45f6c9f

(Fdefine_coding_system_internal): Avoid a duplicated element in Vcoding_system_alist. (Fdefine_coding_system_alias): Likewise.
author Kenichi Handa <handa@m17n.org>
date Fri, 03 Feb 2006 07:37:09 +0000
parents f1df126ec7de
children d6f8fe3307c8
comparison
equal deleted inserted replaced
90288:7432ca837c8d 90289:72d8a45f6c9f
8931 this_spec = Fmake_vector (make_number (3), attrs); 8931 this_spec = Fmake_vector (make_number (3), attrs);
8932 ASET (this_spec, 1, this_aliases); 8932 ASET (this_spec, 1, this_aliases);
8933 ASET (this_spec, 2, this_eol_type); 8933 ASET (this_spec, 2, this_eol_type);
8934 Fputhash (this_name, this_spec, Vcoding_system_hash_table); 8934 Fputhash (this_name, this_spec, Vcoding_system_hash_table);
8935 Vcoding_system_list = Fcons (this_name, Vcoding_system_list); 8935 Vcoding_system_list = Fcons (this_name, Vcoding_system_list);
8936 Vcoding_system_alist = Fcons (Fcons (Fsymbol_name (this_name), Qnil), 8936 val = Fassoc (Fsymbol_name (this_name), Vcoding_system_alist);
8937 Vcoding_system_alist); 8937 if (NILP (val))
8938 Vcoding_system_alist
8939 = Fcons (Fcons (Fsymbol_name (this_name), Qnil),
8940 Vcoding_system_alist);
8938 } 8941 }
8939 } 8942 }
8940 8943
8941 spec_vec = Fmake_vector (make_number (3), attrs); 8944 spec_vec = Fmake_vector (make_number (3), attrs);
8942 ASET (spec_vec, 1, aliases); 8945 ASET (spec_vec, 1, aliases);
8943 ASET (spec_vec, 2, eol_type); 8946 ASET (spec_vec, 2, eol_type);
8944 8947
8945 Fputhash (name, spec_vec, Vcoding_system_hash_table); 8948 Fputhash (name, spec_vec, Vcoding_system_hash_table);
8946 Vcoding_system_list = Fcons (name, Vcoding_system_list); 8949 Vcoding_system_list = Fcons (name, Vcoding_system_list);
8947 Vcoding_system_alist = Fcons (Fcons (Fsymbol_name (name), Qnil), 8950 val = Fassoc (Fsymbol_name (name), Vcoding_system_alist);
8948 Vcoding_system_alist); 8951 if (NILP (val))
8952 Vcoding_system_alist = Fcons (Fcons (Fsymbol_name (name), Qnil),
8953 Vcoding_system_alist);
8949 8954
8950 { 8955 {
8951 int id = coding_categories[category].id; 8956 int id = coding_categories[category].id;
8952 8957
8953 if (id < 0 || EQ (name, CODING_ID_NAME (id))) 8958 if (id < 0 || EQ (name, CODING_ID_NAME (id)))
9024 Sdefine_coding_system_alias, 2, 2, 0, 9029 Sdefine_coding_system_alias, 2, 2, 0,
9025 doc: /* Define ALIAS as an alias for CODING-SYSTEM. */) 9030 doc: /* Define ALIAS as an alias for CODING-SYSTEM. */)
9026 (alias, coding_system) 9031 (alias, coding_system)
9027 Lisp_Object alias, coding_system; 9032 Lisp_Object alias, coding_system;
9028 { 9033 {
9029 Lisp_Object spec, aliases, eol_type; 9034 Lisp_Object spec, aliases, eol_type, val;
9030 9035
9031 CHECK_SYMBOL (alias); 9036 CHECK_SYMBOL (alias);
9032 CHECK_CODING_SYSTEM_GET_SPEC (coding_system, spec); 9037 CHECK_CODING_SYSTEM_GET_SPEC (coding_system, spec);
9033 aliases = AREF (spec, 1); 9038 aliases = AREF (spec, 1);
9034 /* ALISES should be a list of length more than zero, and the first 9039 /* ALISES should be a list of length more than zero, and the first
9050 AREF (eol_type, i)); 9055 AREF (eol_type, i));
9051 } 9056 }
9052 9057
9053 Fputhash (alias, spec, Vcoding_system_hash_table); 9058 Fputhash (alias, spec, Vcoding_system_hash_table);
9054 Vcoding_system_list = Fcons (alias, Vcoding_system_list); 9059 Vcoding_system_list = Fcons (alias, Vcoding_system_list);
9055 Vcoding_system_alist = Fcons (Fcons (Fsymbol_name (alias), Qnil), 9060 val = Fassoc (Fsymbol_name (alias), Vcoding_system_alist);
9056 Vcoding_system_alist); 9061 if (NILP (val))
9062 Vcoding_system_alist = Fcons (Fcons (Fsymbol_name (alias), Qnil),
9063 Vcoding_system_alist);
9057 9064
9058 return Qnil; 9065 return Qnil;
9059 } 9066 }
9060 9067
9061 DEFUN ("coding-system-base", Fcoding_system_base, Scoding_system_base, 9068 DEFUN ("coding-system-base", Fcoding_system_base, Scoding_system_base,