Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

Data Structures | Macros | Typedefs | Functions
stringio.c File Reference
`#include "ruby.h"`
`#include "ruby/io.h"`
`#include "ruby/encoding.h"`

Go to the source code of this file.

## Data Structures
struct | StringIO
struct | getline_arg

## Macros
#define | STRINGIO_VERSION "0.1.0"
#define | rb_io_extract_modeenc strio_extract_modeenc
#define | IS_STRIO(obj) (rb_typeddata_is_kind_of((obj), &strio_data_type))
#define | error_inval(msg) (rb_syserr_fail(EINVAL, msg))
#define | get_enc(ptr) ((ptr)->enc ? (ptr)->enc : rb_enc_get((ptr)->string))
#define | check_strio(self) ((struct StringIO*)rb_check_typeddata((self), &strio_data_type))
#define | StringIO(obj) get_strio(obj)
#define | STRIO_READABLE FL_USER4
#define | STRIO_WRITABLE FL_USER5
#define | STRIO_READWRITE (STRIO_READABLE|STRIO_WRITABLE)
#define | STRIO_MODE_SET_P(strio, mode)
#define | CLOSED(strio) (!STRIO_MODE_SET_P(strio, READWRITE))
#define | READABLE(strio) STRIO_MODE_SET_P(strio, READABLE)
#define | WRITABLE(strio) STRIO_MODE_SET_P(strio, WRITABLE)
#define | strio_fcntl strio_unimpl
#define | strio_flush strio_self
#define | strio_fsync strio_0
#define | strio_set_sync strio_first
#define | strio_tell strio_get_pos
#define | strio_addstr rb_io_addstr
#define | strio_print rb_io_print
#define | strio_printf rb_io_printf
#define | strio_puts rb_io_puts
#define | strio_syswrite rb_io_write
#define | strio_isatty strio_false
#define | strio_pid strio_nil
#define | strio_fileno strio_nil

## Typedefs
typedef char | strio_flags_check[(STRIO_READABLE/FMODE_READABLE==STRIO_WRITABLE/FMODE_WRITABLE) *2 - 1]

## Functions
void | Init_stringio (void)

## Macro Definition Documentation

## ◆ check_strio

#define check_strio | ( |  | self | ) | ((struct StringIO*)rb_check_typeddata((self), &strio_data_type))

Definition at line 171 of file stringio.c.

## ◆ CLOSED

#define CLOSED | ( |  | strio | ) | (!STRIO_MODE_SET_P(strio, READWRITE))

Definition at line 213 of file stringio.c.

## ◆ error_inval

#define error_inval | ( |  | msg | ) | (rb_syserr_fail(EINVAL, msg))

Definition at line 123 of file stringio.c.

## ◆ get_enc

#define get_enc | ( |  | ptr | ) | ((ptr)->enc ? (ptr)->enc : rb_enc_get((ptr)->string))

Definition at line 124 of file stringio.c.

## ◆ IS_STRIO

#define IS_STRIO | ( |  | obj | ) | (rb_typeddata_is_kind_of((obj), &strio_data_type))

Definition at line 122 of file stringio.c.

## ◆ rb_io_extract_modeenc

#define rb_io_extract_modeenc strio_extract_modeenc

Definition at line 35 of file stringio.c.

## ◆ READABLE

#define READABLE | ( |  | strio | ) | STRIO_MODE_SET_P(strio, READABLE)

Definition at line 214 of file stringio.c.

## ◆ StringIO

#define StringIO | ( |  | obj | ) | get_strio(obj)

Definition at line 204 of file stringio.c.

## ◆ STRINGIO_VERSION

#define STRINGIO_VERSION "0.1.0"

Definition at line 14 of file stringio.c.

## ◆ strio_addstr

#define strio_addstr rb_io_addstr

Definition at line 1465 of file stringio.c.

## ◆ strio_fcntl

#define strio_fcntl strio_unimpl

Definition at line 682 of file stringio.c.

## ◆ strio_fileno

#define strio_fileno strio_nil

Definition at line 1652 of file stringio.c.

## ◆ strio_flush

#define strio_flush strio_self

Definition at line 684 of file stringio.c.

## ◆ strio_fsync

#define strio_fsync strio_0

Definition at line 686 of file stringio.c.

## ◆ strio_isatty

#define strio_isatty strio_false

Definition at line 1648 of file stringio.c.

## ◆ STRIO_MODE_SET_P

#define STRIO_MODE_SET_P | ( |  | strio,
|  |  | mode
| ) |  |

Value:
((RBASIC(strio)->flags & STRIO_##mode) && \
((struct StringIO*)DATA_PTR(strio))->flags & FMODE_##mode)

Definition at line 210 of file stringio.c.

## ◆ strio_pid

#define strio_pid strio_nil

Definition at line 1650 of file stringio.c.

## ◆ strio_print

#define strio_print rb_io_print

Definition at line 1474 of file stringio.c.

## ◆ strio_printf

#define strio_printf rb_io_printf

Definition at line 1482 of file stringio.c.

## ◆ strio_puts

#define strio_puts rb_io_puts

Definition at line 1514 of file stringio.c.

## ◆ STRIO_READABLE

#define STRIO_READABLE FL_USER4

Definition at line 206 of file stringio.c.

## ◆ STRIO_READWRITE

#define STRIO_READWRITE (STRIO_READABLE|STRIO_WRITABLE)

Definition at line 208 of file stringio.c.

## ◆ strio_set_sync

#define strio_set_sync strio_first

Definition at line 805 of file stringio.c.

## ◆ strio_syswrite

#define strio_syswrite rb_io_write

Definition at line 1637 of file stringio.c.

## ◆ strio_tell

#define strio_tell strio_get_pos

Definition at line 807 of file stringio.c.

## ◆ STRIO_WRITABLE

#define STRIO_WRITABLE FL_USER5

Definition at line 207 of file stringio.c.

## ◆ WRITABLE

#define WRITABLE | ( |  | strio | ) | STRIO_MODE_SET_P(strio, WRITABLE)

Definition at line 215 of file stringio.c.

## Typedef Documentation

## ◆ strio_flags_check

typedef char strio_flags_check[(STRIO_READABLE/FMODE_READABLE==STRIO_WRITABLE/FMODE_WRITABLE) *2 - 1]

Definition at line 209 of file stringio.c.

## Function Documentation

## ◆ Init_stringio()

void Init_stringio | ( | void |  | ) |

Definition at line 1790 of file stringio.c.

References rb_cData, rb_define_alloc_func(), rb_define_class(), rb_define_const(), rb_include_module(), rb_mEnumerable, rb_str_new_cstr, and STRINGIO_VERSION.

StringIO
Definition: stringio.c:109
DATA_PTR
#define DATA_PTR(dta)
Definition: ruby.h:1175
RBASIC
#define RBASIC(obj)
Definition: ruby.h:1267