1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
akr 2008-08-26 15:01:11 +00:00
parent 8039100c0a
commit a68e409eaa
3 changed files with 51 additions and 41 deletions

View file

@ -1,3 +1,11 @@
Tue Aug 26 23:52:24 2008 Tanaka Akira <akr@fsij.org>
* 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 <usa@ruby-lang.org>
* time.c (time_asctime): workaround for MSVCRT's bug.

View file

@ -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);

View file

@ -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
*/