summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-03 18:18:10 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-03 18:18:10 +0000
commit58964e324975a924947157ac933d11815f1b2483 (patch)
tree3e678b124aaea7a5cfd319f47ff7214d8862b489 /include
parent0ebcad6a7b59819f6b65e6578b28e00dd6a6a4fe (diff)
* include/ruby/io.h (rb_io_t): new fields: encs.ecopts and
writeconv_pre_ecopts. (MakeOpenFile): initialize them. * include/ruby/encoding.h (rb_str_transcode): take ecopts argument. (rb_econv_flags): removed. (rb_econv_prepare_opts): declared. (rb_econv_open_opts): declared. * io.c (make_writeconv): use rb_econv_open_opts. (make_readconv): ditto. (io_fwrite): follow rb_str_transcode change. (rb_io_extract_modeenc): use rb_econv_prepare_opts. (rb_file_open_generic): initialize encs.ecopts. (rb_file_open_internal): ditto. (rb_io_reopen): ditto. (argf_ecopts): defined. (argf_next_argv): set encs.ecopts. (io_encoding_set): use rb_econv_prepare_opts. (argf_set_encoding): set argf_ecopts. * gc.c (gc_mark_children): mark encs.ecopts and writeconv_pre_ecopts in T_FILE. * transcode.c (transcode_loop): take ecopts argument. use rb_econv_open_opts. (rb_econv_flags): removed. (rb_econv_prepare_opts): defined. (rb_econv_open_opts): defined. (str_transcode0): take ecopts. (str_transcode): use rb_econv_prepare_opts. (rb_str_transcode): take ecopts. (econv_init): accept hash argument. (econv_insert_output): follow rb_str_transcode change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include')
-rw-r--r--include/ruby/encoding.h6
-rw-r--r--include/ruby/io.h5
2 files changed, 9 insertions, 2 deletions
diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h
index 7919347199..10a7b95229 100644
--- a/include/ruby/encoding.h
+++ b/include/ruby/encoding.h
@@ -208,11 +208,13 @@ typedef enum {
typedef struct rb_econv_t rb_econv_t;
-VALUE rb_str_transcode(VALUE str, VALUE to, int ecflags);
+VALUE rb_str_transcode(VALUE str, VALUE to, int ecflags, VALUE ecopts);
-int rb_econv_flags(VALUE hash);
+int rb_econv_prepare_opts(VALUE opthash, VALUE *ecopts);
rb_econv_t *rb_econv_open(const char *source_encoding, const char *destination_encoding, int ecflags);
+rb_econv_t *rb_econv_open_opts(const char *source_encoding, const char *destination_encoding, int ecflags, VALUE ecopts);
+
rb_econv_result_t rb_econv_convert(rb_econv_t *ec,
const unsigned char **source_buffer_ptr, const unsigned char *source_buffer_end,
unsigned char **destination_buffer_ptr, unsigned char *destination_buffer_end,
diff --git a/include/ruby/io.h b/include/ruby/io.h
index cdef496a93..676fd05ae3 100644
--- a/include/ruby/io.h
+++ b/include/ruby/io.h
@@ -58,6 +58,7 @@ typedef struct rb_io_t {
rb_encoding *enc;
rb_encoding *enc2;
int flags;
+ VALUE ecopts;
} encs;
rb_econv_t *readconv;
@@ -69,6 +70,7 @@ typedef struct rb_io_t {
rb_econv_t *writeconv;
VALUE writeconv_stateless;
int writeconv_pre_flags;
+ VALUE writeconv_pre_ecopts;
int writeconv_initialized;
} rb_io_t;
@@ -123,11 +125,14 @@ typedef struct rb_io_t {
fp->cbuf_capa = 0;\
fp->writeconv = NULL;\
fp->writeconv_stateless = Qnil;\
+ fp->writeconv_pre_flags = 0;\
+ fp->writeconv_pre_ecopts = Qnil;\
fp->writeconv_initialized = 0;\
fp->tied_io_for_writing = 0;\
fp->encs.enc = NULL;\
fp->encs.enc2 = NULL;\
fp->encs.flags = 0;\
+ fp->encs.ecopts = Qnil;\
} while (0)
FILE *rb_io_stdio_file(rb_io_t *fptr);