From a68e409eaab13ed85df4308a5a3bbb045dbbd639 Mon Sep 17 00:00:00 2001 From: akr Date: Tue, 26 Aug 2008 15:01:11 +0000 Subject: * include/ruby/encoding.h (rb_econv_elem_t): move to transcode.c (rb_econv_t): defined as an incomplete type. * transcode.c (rb_econv_elem_t): moved from encoding.h. (rb_econv_t): complete type defined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ include/ruby/encoding.h | 42 +----------------------------------------- transcode.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 969c47fa89..32f1ddcd4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Tue Aug 26 23:52:24 2008 Tanaka Akira + + * include/ruby/encoding.h (rb_econv_elem_t): move to transcode.c + (rb_econv_t): defined as an incomplete type. + + * transcode.c (rb_econv_elem_t): moved from encoding.h. + (rb_econv_t): complete type defined. + Tue Aug 26 22:44:12 2008 NAKAMURA Usaku * time.c (time_asctime): workaround for MSVCRT's bug. diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h index fa3ebeff1d..3c0fcd2572 100644 --- a/include/ruby/encoding.h +++ b/include/ruby/encoding.h @@ -205,52 +205,12 @@ typedef enum { econv_output_followed_by_input, } rb_econv_result_t; -typedef struct { - struct rb_transcoding *tc; - unsigned char *out_buf_start; - unsigned char *out_data_start; - unsigned char *out_data_end; - unsigned char *out_buf_end; - rb_econv_result_t last_result; -} rb_econv_elem_t; - typedef struct { int flags; /* replacement character, etc. */ } rb_econv_option_t; -typedef struct { - rb_econv_option_t opts; - const char *source_encoding_name; - const char *destination_encoding_name; - - unsigned char *in_buf_start; - unsigned char *in_data_start; - unsigned char *in_data_end; - unsigned char *in_buf_end; - rb_econv_elem_t *elems; - int num_trans; - int num_finished; - int last_trans_index; /* last trans, not including universal newline */ - struct rb_transcoding *last_tc; - - /* last error */ - struct { - rb_econv_result_t result; - struct rb_transcoding *error_tc; - const char *source_encoding; - const char *destination_encoding; - const unsigned char *error_bytes_start; - size_t error_bytes_len; - size_t readagain_len; - int partial_input; - } last_error; - - /* The following fields are only for Encoding::Converter. - * rb_econv_open set them NULL. */ - rb_encoding *source_encoding; - rb_encoding *destination_encoding; -} rb_econv_t; +typedef struct rb_econv_t rb_econv_t; VALUE rb_str_transcode(VALUE str, VALUE to, rb_econv_option_t *ecopts); diff --git a/transcode.c b/transcode.c index a35db7c0cb..78efb93c22 100644 --- a/transcode.c +++ b/transcode.c @@ -23,6 +23,48 @@ VALUE rb_cEncodingConverter; static VALUE sym_invalid, sym_undef, sym_ignore, sym_replace; +typedef struct { + struct rb_transcoding *tc; + unsigned char *out_buf_start; + unsigned char *out_data_start; + unsigned char *out_data_end; + unsigned char *out_buf_end; + rb_econv_result_t last_result; +} rb_econv_elem_t; + +struct rb_econv_t { + rb_econv_option_t opts; + const char *source_encoding_name; + const char *destination_encoding_name; + + unsigned char *in_buf_start; + unsigned char *in_data_start; + unsigned char *in_data_end; + unsigned char *in_buf_end; + rb_econv_elem_t *elems; + int num_trans; + int num_finished; + int last_trans_index; /* last trans, not including universal newline */ + struct rb_transcoding *last_tc; + + /* last error */ + struct { + rb_econv_result_t result; + struct rb_transcoding *error_tc; + const char *source_encoding; + const char *destination_encoding; + const unsigned char *error_bytes_start; + size_t error_bytes_len; + size_t readagain_len; + int partial_input; + } last_error; + + /* The following fields are only for Encoding::Converter. + * rb_econv_open set them NULL. */ + rb_encoding *source_encoding; + rb_encoding *destination_encoding; +}; + /* * Dispatch data and logic */ -- cgit v1.2.3