From 8dcbea820b5aa9258b3696ba74138ddbe512dac5 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Thu, 30 Jan 2003 02:23:40 +0000 Subject: [PATCH] (decode_coding_ccl, encode_coding_ccl): Call ccl_driver with the last arg charset_list acquired from coding. (Fdefine_coding_system_internal): For ccl-based coding system, fix the attribute coding_attr_ccl_valids. --- src/ChangeLog | 18 ++++++++++++++++++ src/coding.c | 29 ++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index aa77e0b28e..9f10851ae8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,21 @@ +2003-01-30 Kenichi Handa + + * coding.c (decode_coding_ccl, encode_coding_ccl): Call ccl_driver + with the last arg charset_list acquired from coding. + (Fdefine_coding_system_internal): For ccl-based coding system, fix + the attribute coding_attr_ccl_valids. + + * coding.h (enum define_coding_ccl_arg_index): Set the first + member coding_arg_ccl_decoder to coding_arg_max. + + * ccl.h (ccl_driver): Prototype adjusted. + + * ccl.c (CCL_DECODE_CHAR, CCL_ENCODE_CHAR): New macros. + (ccl_driver): New arg CHARSET_LIST. Use the above macros instead + of DECODE_CAHR, ENCODE_CHAR, CHAR_CHARSET. + (Fccl_execute): Call ccl_driver with the last arg Qnil. + (Fccl_execute_on_string): Likewise. + 2003-01-11 Kenichi Handa * charset.h (ENCODE_CHAR): If the method is SUBSET or SUPERSET, diff --git a/src/coding.c b/src/coding.c index 8340e8dc27..cd44b24698 100644 --- a/src/coding.c +++ b/src/coding.c @@ -4302,7 +4302,9 @@ decode_coding_ccl (coding) struct ccl_program ccl; int source_charbuf[1024]; int source_byteidx[1024]; + Lisp_Object attrs, eol_type, charset_list, valids; + CODING_GET_INFO (coding, attrs, eol_type, charset_list); setup_ccl_program (&ccl, CODING_CCL_DECODER (coding)); while (src < src_end) @@ -4329,7 +4331,8 @@ decode_coding_ccl (coding) while (source < source_end) { ccl_driver (&ccl, source, charbuf, - source_end - source, charbuf_end - charbuf); + source_end - source, charbuf_end - charbuf, + charset_list); source += ccl.consumed; charbuf += ccl.produced; if (ccl.status != CCL_STAT_SUSPEND_BY_DST) @@ -4379,7 +4382,9 @@ encode_coding_ccl (coding) unsigned char *adjusted_dst_end = dst_end - 1; int destination_charbuf[1024]; int i, produced_chars = 0; + Lisp_Object attrs, eol_type, charset_list; + CODING_GET_INFO (coding, attrs, eol_type, charset_list); setup_ccl_program (&ccl, CODING_CCL_ENCODER (coding)); ccl.last_block = coding->mode & CODING_MODE_LAST_BLOCK; @@ -4392,7 +4397,7 @@ encode_coding_ccl (coding) dst_bytes = 1024; ccl_driver (&ccl, charbuf, destination_charbuf, - charbuf_end - charbuf, dst_bytes); + charbuf_end - charbuf, dst_bytes, charset_list); charbuf += ccl.consumed; if (multibytep) for (i = 0; i < ccl.produced; i++) @@ -7909,21 +7914,31 @@ usage: (define-coding-system-internal ...) */) valids = Fmake_string (make_number (256), make_number (0)); for (tail = val; !NILP (tail); tail = Fcdr (tail)) { + int from, to; + val = Fcar (tail); if (INTEGERP (val)) - ASET (valids, XINT (val), make_number (1)); + { + from = to = XINT (val); + if (from < 0 || from > 255) + args_out_of_range_3 (val, make_number (0), make_number (255)); + } else { - int from, to; - CHECK_CONS (val); CHECK_NUMBER (XCAR (val)); CHECK_NUMBER (XCDR (val)); from = XINT (XCAR (val)); + if (from < 0 || from > 255) + args_out_of_range_3 (XCAR (val), + make_number (0), make_number (255)); to = XINT (XCDR (val)); - for (i = from; i <= to; i++) - ASET (valids, i, make_number (1)); + if (to < from || to > 255) + args_out_of_range_3 (XCDR (val), + XCAR (val), make_number (255)); } + for (i = from; i <= to; i++) + XSTRING (valids)->data[i] = 1; } ASET (attrs, coding_attr_ccl_valids, valids); -- 2.20.1