Ruby: ext/stringio/stringio.c File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

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 "3.0.1"
#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 172 of file stringio.c.

## ◆ CLOSED

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

Definition at line 214 of file stringio.c.

## ◆ error_inval

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

Definition at line 124 of file stringio.c.

## ◆ get_enc

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

Definition at line 125 of file stringio.c.

## ◆ IS_STRIO

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

Definition at line 123 of file stringio.c.

## ◆ rb_io_extract_modeenc

#define rb_io_extract_modeenc strio_extract_modeenc

Definition at line 36 of file stringio.c.

## ◆ READABLE

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

Definition at line 215 of file stringio.c.

## ◆ StringIO

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

Definition at line 205 of file stringio.c.

## ◆ STRINGIO_VERSION

#define STRINGIO_VERSION "3.0.1"

Definition at line 15 of file stringio.c.

## ◆ strio_addstr

#define strio_addstr rb_io_addstr

Definition at line 1431 of file stringio.c.

## ◆ strio_fcntl

#define strio_fcntl strio_unimpl

Definition at line 695 of file stringio.c.

## ◆ strio_fileno

#define strio_fileno strio_nil

Definition at line 1619 of file stringio.c.

## ◆ strio_flush

#define strio_flush strio_self

Definition at line 697 of file stringio.c.

## ◆ strio_fsync

#define strio_fsync strio_0

Definition at line 699 of file stringio.c.

## ◆ strio_isatty

#define strio_isatty strio_false

Definition at line 1615 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)
mode
const char int mode
Definition: ioapi.h:137
RBASIC
#define RBASIC(obj)
Definition: rbasic.h:34
DATA_PTR
#define DATA_PTR(obj)
Definition: rdata.h:56
StringIO
Definition: stringio.c:110

Definition at line 211 of file stringio.c.

## ◆ strio_pid

#define strio_pid strio_nil

Definition at line 1617 of file stringio.c.

## ◆ strio_print

#define strio_print rb_io_print

Definition at line 1440 of file stringio.c.

## ◆ strio_printf

#define strio_printf rb_io_printf

Definition at line 1448 of file stringio.c.

## ◆ strio_puts

#define strio_puts rb_io_puts

Definition at line 1480 of file stringio.c.

## ◆ STRIO_READABLE

#define STRIO_READABLE FL_USER4

Definition at line 207 of file stringio.c.

## ◆ STRIO_READWRITE

#define STRIO_READWRITE (STRIO_READABLE|STRIO_WRITABLE)

Definition at line 209 of file stringio.c.

## ◆ strio_set_sync

#define strio_set_sync strio_first

Definition at line 818 of file stringio.c.

## ◆ strio_syswrite

#define strio_syswrite rb_io_write

Definition at line 1604 of file stringio.c.

## ◆ strio_tell

#define strio_tell strio_get_pos

Definition at line 820 of file stringio.c.

## ◆ STRIO_WRITABLE

#define STRIO_WRITABLE FL_USER5

Definition at line 208 of file stringio.c.

## ◆ WRITABLE

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

Definition at line 216 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 210 of file stringio.c.

## Function Documentation

## ◆ Init_stringio()

void Init_stringio | ( | void |  | ) |

Definition at line 1754 of file stringio.c.

References ID2SYM, rb_cIO, rb_cObject, rb_define_alloc_func(), rb_define_class(), rb_define_const(), rb_define_method, rb_define_module_under(), rb_define_singleton_method, rb_ext_ractor_safe(), rb_include_module(), rb_intern(), rb_mEnumerable, rb_str_new_cstr, STRINGIO_VERSION, strio_addstr, strio_fcntl, strio_fileno, strio_flush, strio_fsync, strio_isatty, strio_pid, strio_print, strio_printf, strio_puts, strio_set_sync, strio_syswrite, and strio_tell.