From 63daa7c07d6c10c1a47a4578e5fa015760967e84 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 16 Aug 2008 17:06:35 +0000 Subject: * include/ruby/io.h (rb_io_t): new fields: readconv, crbuf, crbuf_off, crbuf_len, crbuf_capa. (MakeOpenFile): initialize them. * io.c (io_shift_crbuf): new function. (io_getc): use econv. (rb_io_fptr_finalize): finalize readconv and crbuf. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- include/ruby/io.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'include/ruby') diff --git a/include/ruby/io.h b/include/ruby/io.h index 95be788c08..da7589f60c 100644 --- a/include/ruby/io.h +++ b/include/ruby/io.h @@ -36,17 +36,26 @@ typedef struct rb_io_t { char *path; /* pathname for file */ void (*finalize)(struct rb_io_t*,int); /* finalize proc */ long refcnt; + char *wbuf; /* wbuf_off + wbuf_len <= wbuf_capa */ int wbuf_off; int wbuf_len; int wbuf_capa; + char *rbuf; /* rbuf_off + rbuf_len <= rbuf_capa */ int rbuf_off; int rbuf_len; int rbuf_capa; + VALUE tied_io_for_writing; - rb_encoding *enc; - rb_encoding *enc2; + rb_encoding *enc; /* int_enc if enc2. ext_enc otherwise. */ + rb_encoding *enc2; /* ext_enc if not NULL. */ + + rb_econv_t *readconv; + char *crbuf; /* crbuf_off + crbuf_len <= crbuf_capa */ + int crbuf_off; + int crbuf_len; + int crbuf_capa; } rb_io_t; #define HAVE_RB_IO_T 1 @@ -89,6 +98,11 @@ typedef struct rb_io_t { fp->rbuf_off = 0;\ fp->rbuf_len = 0;\ fp->rbuf_capa = 0;\ + fp->readconv = NULL;\ + fp->crbuf = NULL;\ + fp->crbuf_off = 0;\ + fp->crbuf_len = 0;\ + fp->crbuf_capa = 0;\ fp->tied_io_for_writing = 0;\ fp->enc = 0;\ fp->enc2 = 0;\ -- cgit v1.2.3