mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* include/ruby/encoding.h (rb_econv_result_t): moved from
transcode_data.h. (rb_econv_elem_t): ditto. (rb_econv_t): ditto. source_encoding and destination_encoding field is added. (rb_econv_open): declared. (rb_econv_convert): ditto. (rb_econv_close): ditto. * transcode.c (rb_econv_open_by_transcoder_entries): initialize source_encoding and destination_encoding field as NULL. (rb_econv_open): make it external linkage. (rb_econv_close): ditto. (rb_econv_convert): ditto. renamed from rb_econv_conv. (make_encoding): new function. (econv_init): use make_encoding and store rb_encoding* in rb_econv_t. (econv_source_encoding): new method Encoding::Converter#source_encoding. (econv_destination_encoding): new method Encoding::Converter#destination_encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
87779b507e
commit
c82aee31b4
5 changed files with 135 additions and 58 deletions
|
@ -111,33 +111,6 @@ struct rb_transcoder {
|
|||
int (*finish_func)(rb_transcoding*, unsigned char*); /* -> output */
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
econv_invalid_byte_sequence,
|
||||
econv_undefined_conversion,
|
||||
econv_destination_buffer_full,
|
||||
econv_source_buffer_empty,
|
||||
econv_finished,
|
||||
econv_output_followed_by_input,
|
||||
} rb_econv_result_t;
|
||||
|
||||
typedef struct {
|
||||
const char *from;
|
||||
const char *to;
|
||||
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 {
|
||||
rb_econv_elem_t *elems;
|
||||
int num_trans;
|
||||
int num_finished;
|
||||
rb_transcoding *last_tc;
|
||||
} rb_econv_t;
|
||||
|
||||
void rb_declare_transcoder(const char *enc1, const char *enc2, const char *lib);
|
||||
void rb_register_transcoder(const rb_transcoder *);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue