From adf1ec396408327b1e6e4bf70b2a1678b0ef1f7c Mon Sep 17 00:00:00 2001 From: tomo Date: Thu, 10 Jan 2002 05:38:52 +0000 Subject: [PATCH] (decoding_table_check_elements): New prototype [moved from mule-charset.c]. (decoding_table_remove_char): New inline function [moved from mule-charset.c]. (decoding_table_put_char): Likewise. --- src/char-ucs.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/src/char-ucs.h b/src/char-ucs.h index 199e4b7..d6e8298 100644 --- a/src/char-ucs.h +++ b/src/char-ucs.h @@ -501,6 +501,60 @@ extern Lisp_Object Vcharset_chinese_big5; extern Lisp_Object Vcharset_chinese_big5_1; extern Lisp_Object Vcharset_chinese_big5_2; +int decoding_table_check_elements (Lisp_Object v, int dim, int ccs_len); + +INLINE_HEADER void +decoding_table_remove_char (Lisp_Object v, int dim, int byte_offset, + int code_point); +INLINE_HEADER void +decoding_table_remove_char (Lisp_Object v, int dim, int byte_offset, + int code_point) +{ + int i = -1; + + while (dim > 0) + { + Lisp_Object nv; + + dim--; + i = ((code_point >> (8 * dim)) & 255) - byte_offset; + nv = XVECTOR_DATA(v)[i]; + if (!VECTORP (nv)) + break; + v = nv; + } + if (i >= 0) + XVECTOR_DATA(v)[i] = Qnil; +} + +INLINE_HEADER void +decoding_table_put_char (Lisp_Object v, int dim, int byte_offset, + int code_point, Lisp_Object character); +INLINE_HEADER void +decoding_table_put_char (Lisp_Object v, int dim, int byte_offset, + int code_point, Lisp_Object character) +{ + int i = -1; + Lisp_Object nv; + int ccs_len = XVECTOR_LENGTH (v); + + while (dim > 0) + { + dim--; + i = ((code_point >> (8 * dim)) & 255) - byte_offset; + nv = XVECTOR_DATA(v)[i]; + if (dim > 0) + { + if (!VECTORP (nv)) + nv = (XVECTOR_DATA(v)[i] = make_vector (ccs_len, Qnil)); + v = nv; + } + else + break; + } + XVECTOR_DATA(v)[i] = character; +} + INLINE_HEADER Emchar DECODE_DEFINED_CHAR (Lisp_Object charset, int code_point); INLINE_HEADER Emchar -- 1.7.10.4