Ruby
3.3.0dev (2023-06-01 revision 957b6a491fe6a9a2df467f83a37e7c34861f995c)
|
Ruby's IO, metadata and buffers. More...
#include <io.h>
Data Fields | |
VALUE | self |
The IO's Ruby level counterpart. More... | |
FILE * | stdio_file |
stdio ptr for read/write, if available. More... | |
int | fd |
file descriptor. More... | |
int | mode |
mode flags: FMODE_XXXs More... | |
rb_pid_t | pid |
child's pid (for pipes) More... | |
int | lineno |
number of lines read More... | |
VALUE | pathv |
pathname for file More... | |
void(* | finalize )(struct rb_io_t *, int) |
finalize proc More... | |
rb_io_buffer_t | wbuf |
Write buffer. More... | |
rb_io_buffer_t | rbuf |
(Byte) read buffer. More... | |
VALUE | tied_io_for_writing |
Duplex IO object, if set. More... | |
struct rb_io_enc_t | encs |
Decomposed encoding flags. More... | |
rb_econv_t * | readconv |
Encoding converter used when reading from this IO. More... | |
rb_io_buffer_t | cbuf |
rb_io_ungetc() destination. More... | |
rb_econv_t * | writeconv |
Encoding converter used when writing to this IO. More... | |
VALUE | writeconv_asciicompat |
This is, when set, an instance of rb_cString which holds the "common" encoding. More... | |
int | writeconv_initialized |
Whether rb_io_t::writeconv is already set up. More... | |
int | writeconv_pre_ecflags |
Value of ::rb_io_t::rb_io_enc_t::ecflags stored right before initialising rb_io_t::writeconv. More... | |
VALUE | writeconv_pre_ecopts |
Value of ::rb_io_t::rb_io_enc_t::ecopts stored right before initialising rb_io_t::writeconv. More... | |
VALUE | write_lock |
This is a Ruby level mutex. More... | |
VALUE | timeout |
The timeout associated with this IO when performing blocking operations. More... | |
rb_io_buffer_t rb_io_t::cbuf |
rb_io_ungetc() destination.
This buffer is read before checking rb_io_t::rbuf
Definition at line 190 of file io.h.
Referenced by rb_io_ungetc().
struct rb_io_enc_t rb_io_t::encs |
Decomposed encoding flags.
Definition at line 179 of file io.h.
Referenced by rb_io_open_descriptor().
int rb_io_t::fd |
file descriptor.
Definition at line 148 of file io.h.
Referenced by rb_file_size(), rb_io_binmode(), rb_io_check_closed(), rb_io_closed_p(), rb_io_descriptor(), rb_io_eof(), rb_io_getbyte(), rb_io_open_descriptor(), rb_io_set_nonblock(), rb_io_stdio_file(), and rb_io_wait().
void(* rb_io_t::finalize) (struct rb_io_t *, int) |
int rb_io_t::mode |
mode flags: FMODE_XXXs
Definition at line 151 of file io.h.
Referenced by rb_file_size(), rb_io_binmode(), rb_io_check_char_readable(), rb_io_check_writable(), rb_io_getbyte(), rb_io_mode(), rb_io_open_descriptor(), rb_io_stdio_file(), and rb_io_synchronized().
VALUE rb_io_t::pathv |
pathname for file
Definition at line 160 of file io.h.
Referenced by rb_file_size(), rb_io_open_descriptor(), rb_io_path(), and rb_io_set_nonblock().
rb_io_buffer_t rb_io_t::rbuf |
(Byte) read buffer.
Note also that there is a field called rb_io_t::cbuf, which also concerns read IO.
Definition at line 172 of file io.h.
Referenced by rb_io_check_writable(), and rb_io_getbyte().
rb_econv_t* rb_io_t::readconv |
Encoding converter used when reading from this IO.
Definition at line 184 of file io.h.
Referenced by rb_io_binmode().
VALUE rb_io_t::self |
The IO's Ruby level counterpart.
Definition at line 142 of file io.h.
Referenced by rb_io_open_descriptor(), and rb_io_read_check().
FILE* rb_io_t::stdio_file |
stdio ptr for read/write, if available.
Definition at line 145 of file io.h.
Referenced by rb_io_stdio_file().
VALUE rb_io_t::tied_io_for_writing |
Duplex IO object, if set.
Definition at line 179 of file io.h.
Referenced by rb_io_check_char_readable(), rb_io_get_write_io(), and rb_io_set_write_io().
VALUE rb_io_t::timeout |
The timeout associated with this IO when performing blocking operations.
Definition at line 230 of file io.h.
Referenced by rb_io_open_descriptor(), rb_io_set_timeout(), rb_io_timeout(), and rb_io_wait().
rb_io_buffer_t rb_io_t::wbuf |
VALUE rb_io_t::write_lock |
This is a Ruby level mutex.
It avoids multiple threads to write to an IO at once; helps for instance rb_io_puts() to ensure newlines right next to its arguments.
This of course doesn't help inter-process IO interleaves, though.
rb_econv_t* rb_io_t::writeconv |
Encoding converter used when writing to this IO.
Definition at line 193 of file io.h.
Referenced by rb_io_binmode().
VALUE rb_io_t::writeconv_asciicompat |
This is, when set, an instance of rb_cString which holds the "common" encoding.
Write conversion can convert strings twice... In case conversion from encoding X to encoding Y does not exist, Ruby finds an encoding Z that bridges the two, so that X to Z to Y conversion happens.
int rb_io_t::writeconv_initialized |
Whether rb_io_t::writeconv is already set up.
int rb_io_t::writeconv_pre_ecflags |
Value of ::rb_io_t::rb_io_enc_t::ecflags stored right before initialising rb_io_t::writeconv.
Definition at line 210 of file io.h.
Referenced by rb_io_binmode().
VALUE rb_io_t::writeconv_pre_ecopts |
Value of ::rb_io_t::rb_io_enc_t::ecopts stored right before initialising rb_io_t::writeconv.