From: tomo Date: Fri, 28 Jul 2000 10:07:41 +0000 (+0000) Subject: (expand_uint8_byte_table_to_uint16): New function. X-Git-Tag: r21-2-34-utf-2000-0_17-0~30 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=9b000a5e43f0c784bce4762531d19dbe6999124f;p=chise%2Fxemacs-chise.git (expand_uint8_byte_table_to_uint16): New function. (put_byte_table): Use `expand_uint8_byte_table_to_uint16'. --- diff --git a/src/mule-charset.c b/src/mule-charset.c index 6f350e7..1795c8c 100644 --- a/src/mule-charset.c +++ b/src/mule-charset.c @@ -229,7 +229,7 @@ mark_uint8_byte_table (Lisp_Object obj) static void print_uint8_byte_table (Lisp_Object obj, - Lisp_Object printcharfun, int escapeflag) + Lisp_Object printcharfun, int escapeflag) { Lisp_Uint8_Byte_Table *bte = XUINT8_BYTE_TABLE (obj); int i; @@ -487,6 +487,24 @@ make_uint16_byte_table (unsigned short initval) return obj; } +static Lisp_Object +expand_uint8_byte_table_to_uint16 (Lisp_Object table) +{ + Lisp_Object obj; + int i; + Lisp_Uint8_Byte_Table* bte = XUINT8_BYTE_TABLE(table); + Lisp_Uint16_Byte_Table* cte; + + cte = alloc_lcrecord_type (Lisp_Uint16_Byte_Table, + &lrecord_uint16_byte_table); + for (i = 0; i < 256; i++) + { + cte->property[i] = UINT8_TO_UINT16 (bte->property[i]); + } + XSETUINT16_BYTE_TABLE (obj, cte); + return obj; +} + static int uint16_byte_table_same_value_p (Lisp_Object obj) { @@ -652,14 +670,8 @@ put_byte_table (Lisp_Object table, unsigned char idx, Lisp_Object value) } else if (UINT16_VALUE_P (value)) { - Lisp_Object new = make_uint16_byte_table (Qnil); - int i; + Lisp_Object new = expand_uint8_byte_table_to_uint16 (table); - for (i = 0; i < 256; i++) - { - XUINT16_BYTE_TABLE(new)->property[i] - = UINT8_TO_UINT16 (XUINT8_BYTE_TABLE(table)->property[i]); - } XUINT16_BYTE_TABLE(new)->property[idx] = UINT16_ENCODE (value); return new; }