+INLINE_HEADER Lisp_Object
+put_ccs_octet_table (Lisp_Object table, Lisp_Object ccs, int code,
+ Lisp_Object value);
+INLINE_HEADER Lisp_Object
+put_ccs_octet_table (Lisp_Object table, Lisp_Object ccs, int code,
+ Lisp_Object value)
+{
+ int byte_offset = XCHARSET_BYTE_OFFSET (ccs);
+ int ccs_len = XCHARSET_BYTE_SIZE (ccs);
+
+ if (VECTORP (table))
+ {
+ XVECTOR_DATA(table)[code - byte_offset] = value;
+ return table;
+ }
+ else if (EQ (table, value))
+ return table;
+ else
+ {
+ table = make_vector (ccs_len, table);
+ XVECTOR_DATA(table)[code - byte_offset] = value;
+ return table;
+ }
+}
+
+INLINE_HEADER void
+decoding_table_put_char (Lisp_Object ccs,
+ int code_point, Lisp_Object character);
+INLINE_HEADER void
+decoding_table_put_char (Lisp_Object ccs,
+ int code_point, Lisp_Object character)
+{
+ Lisp_Object table1 = XCHARSET_DECODING_TABLE (ccs);
+ int dim = XCHARSET_DIMENSION (ccs);
+
+ if (dim == 1)
+ XCHARSET_DECODING_TABLE (ccs)
+ = put_ccs_octet_table (table1, ccs, code_point, character);
+ else if (dim == 2)
+ {
+ Lisp_Object table2
+ = get_ccs_octet_table (table1, ccs, (unsigned char)(code_point >> 8));
+
+ table2 = put_ccs_octet_table (table2, ccs,
+ (unsigned char)code_point, character);
+ XCHARSET_DECODING_TABLE (ccs)
+ = put_ccs_octet_table (table1, ccs,
+ (unsigned char)(code_point >> 8), table2);
+ }
+ else if (dim == 3)
+ {
+ Lisp_Object table2
+ = get_ccs_octet_table (table1, ccs, (unsigned char)(code_point >> 16));
+ Lisp_Object table3
+ = get_ccs_octet_table (table2, ccs, (unsigned char)(code_point >> 8));
+
+ table3 = put_ccs_octet_table (table3, ccs,
+ (unsigned char)code_point, character);
+ table2 = put_ccs_octet_table (table2, ccs,
+ (unsigned char)(code_point >> 8), table3);
+ XCHARSET_DECODING_TABLE (ccs)
+ = put_ccs_octet_table (table1, ccs,
+ (unsigned char)(code_point >> 16), table2);
+ }
+ else /* if (dim == 4) */
+ {
+ Lisp_Object table2
+ = get_ccs_octet_table (table1, ccs, (unsigned char)(code_point >> 24));
+ Lisp_Object table3
+ = get_ccs_octet_table (table2, ccs, (unsigned char)(code_point >> 16));
+ Lisp_Object table4
+ = get_ccs_octet_table (table3, ccs, (unsigned char)(code_point >> 8));
+
+ table4 = put_ccs_octet_table (table4, ccs,
+ (unsigned char)code_point, character);
+ table3 = put_ccs_octet_table (table3, ccs,
+ (unsigned char)(code_point >> 8), table4);
+ table2 = put_ccs_octet_table (table2, ccs,
+ (unsigned char)(code_point >> 16), table3);
+ XCHARSET_DECODING_TABLE (ccs)
+ = put_ccs_octet_table (table1, ccs,
+ (unsigned char)(code_point >> 24), table2);
+ }
+}
+
+INLINE_HEADER void
+decoding_table_remove_char (Lisp_Object ccs, int code_point);
+INLINE_HEADER void
+decoding_table_remove_char (Lisp_Object ccs, int code_point)
+{
+ decoding_table_put_char (ccs, code_point, Qunbound);
+}
+
+Emchar decode_defined_char (Lisp_Object charset, int code_point);