Skip to content

Instantly share code, notes, and snippets.

@methodmissing
Created August 5, 2009 11:56
Show Gist options
  • Select an option

  • Save methodmissing/162653 to your computer and use it in GitHub Desktop.

Select an option

Save methodmissing/162653 to your computer and use it in GitHub Desktop.
typedef struct rb_io_t {
int fd; /* file descriptor */
FILE *stdio_file; /* stdio ptr for read/write if available */
int mode; /* mode flags: FMODE_XXXs */
rb_pid_t pid; /* child's pid (for pipes) */
int lineno; /* number of lines read */
VALUE pathv; /* pathname for file */
void (*finalize)(struct rb_io_t*,int); /* finalize proc */
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;
/*
* enc enc2 read action write action
* NULL NULL force_encoding(default_external) write the byte sequence of str
* e1 NULL force_encoding(e1) convert str.encoding to e1
* e1 e2 convert from e2 to e1 convert str.encoding to e2
*/
struct rb_io_enc_t {
rb_encoding *enc;
rb_encoding *enc2;
int ecflags;
VALUE ecopts;
} encs;
rb_econv_t *readconv;
char *cbuf; /* cbuf_off + cbuf_len <= cbuf_capa */
int cbuf_off;
int cbuf_len;
int cbuf_capa;
rb_econv_t *writeconv;
VALUE writeconv_asciicompat;
int writeconv_pre_ecflags;
VALUE writeconv_pre_ecopts;
int writeconv_initialized;
VALUE write_lock;
} rb_io_t;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment