Ruby
2.1.10p492(2016-04-01revision54464)
|
Go to the source code of this file.
Data Structures | |
struct | StringIO |
Typedefs | |
typedef char | strio_flags_check [(STRIO_READABLE/FMODE_READABLE==STRIO_WRITABLE/FMODE_WRITABLE)*2-1] |
Variables | |
static const rb_data_type_t | strio_data_type |
static VALUE | sym_exception |
#define check_strio | ( | self | ) | ((struct StringIO*)rb_check_typeddata((self), &strio_data_type)) |
Definition at line 84 of file stringio.c.
Referenced by get_strio(), strio_copy(), and strio_initialize().
#define CLOSED | ( | strio | ) | (!STRIO_MODE_SET_P(strio, READWRITE)) |
Definition at line 119 of file stringio.c.
Referenced by strio_close(), strio_closed(), and strio_seek().
#define error_inval | ( | msg | ) | (errno = EINVAL, rb_sys_fail(msg)) |
Definition at line 34 of file stringio.c.
Referenced by strio_seek(), strio_set_pos(), and strio_truncate().
#define IS_STRIO | ( | obj | ) | (rb_typeddata_is_kind_of((obj), &strio_data_type)) |
Definition at line 33 of file stringio.c.
#define READABLE | ( | strio | ) | STRIO_MODE_SET_P(strio, READABLE) |
Definition at line 120 of file stringio.c.
Referenced by readable(), strio_close_read(), and strio_closed_read().
Definition at line 110 of file stringio.c.
Referenced by readable(), strio_0(), strio_binmode(), strio_close(), strio_close_read(), strio_close_write(), strio_closed(), strio_closed_read(), strio_closed_write(), strio_copy(), strio_each(), strio_external_encoding(), strio_false(), strio_finalize(), strio_first(), strio_get_lineno(), strio_get_pos(), strio_get_string(), strio_get_sync(), strio_nil(), strio_readlines(), strio_reopen(), strio_rewind(), strio_seek(), strio_self(), strio_set_encoding(), strio_set_lineno(), strio_set_pos(), strio_set_string(), strio_size(), strio_unimpl(), and writable().
#define strio_addstr rb_io_addstr |
Definition at line 1224 of file stringio.c.
Referenced by Init_stringio().
#define strio_fcntl strio_unimpl |
Definition at line 512 of file stringio.c.
Referenced by Init_stringio().
#define strio_fileno strio_nil |
Definition at line 1412 of file stringio.c.
Referenced by Init_stringio().
#define strio_flush strio_self |
Definition at line 514 of file stringio.c.
Referenced by Init_stringio().
#define strio_fsync strio_0 |
Definition at line 516 of file stringio.c.
Referenced by Init_stringio().
#define strio_isatty strio_false |
Definition at line 1408 of file stringio.c.
Referenced by Init_stringio().
#define STRIO_MODE_SET_P | ( | strio, | |
mode | |||
) |
Definition at line 116 of file stringio.c.
#define strio_pid strio_nil |
Definition at line 1410 of file stringio.c.
Referenced by Init_stringio().
#define strio_print rb_io_print |
Definition at line 1233 of file stringio.c.
Referenced by Init_stringio().
#define strio_printf rb_io_printf |
Definition at line 1241 of file stringio.c.
Referenced by Init_stringio().
#define strio_puts rb_io_puts |
Definition at line 1273 of file stringio.c.
Referenced by Init_stringio().
#define STRIO_READABLE FL_USER4 |
Definition at line 112 of file stringio.c.
Referenced by strio_close_read(), and strio_init().
#define STRIO_READWRITE (STRIO_READABLE|STRIO_WRITABLE) |
Definition at line 114 of file stringio.c.
Referenced by strio_close(), and strio_copy().
#define strio_set_sync strio_first |
Definition at line 635 of file stringio.c.
Referenced by Init_stringio().
#define strio_syswrite rb_io_write |
Definition at line 1397 of file stringio.c.
Referenced by Init_stringio(), and strio_syswrite_nonblock().
#define strio_tell strio_get_pos |
Definition at line 637 of file stringio.c.
Referenced by Init_stringio().
#define STRIO_WRITABLE FL_USER5 |
Definition at line 113 of file stringio.c.
Referenced by strio_close_write().
#define WRITABLE | ( | strio | ) | STRIO_MODE_SET_P(strio, WRITABLE) |
Definition at line 121 of file stringio.c.
Referenced by strio_binmode(), strio_close_write(), strio_closed_write(), and writable().
typedef char strio_flags_check[(STRIO_READABLE/FMODE_READABLE==STRIO_WRITABLE/FMODE_WRITABLE)*2-1] |
Definition at line 115 of file stringio.c.
Definition at line 938 of file stringio.c.
References c, CHAR_BIT, and m.
Referenced by strio_getline().
Definition at line 148 of file stringio.c.
References OBJ_FROZEN, rb_eIOError, rb_raise(), and StringIO::string.
Referenced by strio_extend(), strio_putc(), strio_ungetbyte(), strio_ungetc(), and strio_write().
Definition at line 87 of file stringio.c.
References check_strio, ptr, rb_eIOError, rb_io_taint_check(), and rb_raise().
void Init_stringio | ( | ) |
Definition at line 1515 of file stringio.c.
References ID2SYM, rb_cData, rb_cIO, rb_define_alloc_func(), rb_define_class(), rb_define_method(), rb_define_module_under(), rb_define_singleton_method(), rb_include_module(), rb_intern, rb_mEnumerable, strio_addstr, strio_binmode(), strio_bytes(), strio_chars(), strio_close(), strio_close_read(), strio_close_write(), strio_closed(), strio_closed_read(), strio_closed_write(), strio_codepoints(), strio_copy(), strio_each(), strio_each_byte(), strio_each_char(), strio_each_codepoint(), strio_eof(), strio_external_encoding(), strio_fcntl, strio_fileno, strio_flush, strio_fsync, strio_get_lineno(), strio_get_pos(), strio_get_string(), strio_get_sync(), strio_getbyte(), strio_getc(), strio_gets(), strio_initialize(), strio_internal_encoding(), strio_isatty, strio_lines(), strio_pid, strio_print, strio_printf, strio_putc(), strio_puts, strio_read(), strio_read_nonblock(), strio_readbyte(), strio_readchar(), strio_readline(), strio_readlines(), strio_reopen(), strio_rewind(), strio_s_allocate(), strio_s_open(), strio_seek(), strio_set_encoding(), strio_set_lineno(), strio_set_pos(), strio_set_string(), strio_set_sync, strio_size(), strio_sysread(), strio_syswrite, strio_syswrite_nonblock(), strio_tell, strio_truncate(), strio_ungetbyte(), strio_ungetc(), strio_write(), and sym_exception.
Definition at line 126 of file stringio.c.
References ptr, rb_eIOError, rb_raise(), READABLE, and StringIO.
Referenced by r_byte1_buffered(), r_bytes1_buffered(), strio_each(), strio_each_byte(), strio_each_codepoint(), strio_eof(), strio_getbyte(), strio_getc(), strio_gets(), strio_read(), strio_readlines(), strio_ungetbyte(), and strio_ungetc().
Definition at line 279 of file stringio.c.
Definition at line 37 of file stringio.c.
References ALLOC, StringIO::count, StringIO::flags, StringIO::lineno, StringIO::pos, ptr, Qnil, and StringIO::string.
Referenced by strio_initialize().
Definition at line 501 of file stringio.c.
References enc, ptr, rb_ascii8bit_encoding(), rb_enc_associate(), StringIO::string, StringIO, and WRITABLE.
Referenced by Init_stringio().
Definition at line 664 of file stringio.c.
References ID2SYM, rb_block_given_p(), rb_enumeratorize(), rb_intern, rb_warn(), and strio_each_byte().
Referenced by Init_stringio().
Definition at line 884 of file stringio.c.
References ID2SYM, rb_block_given_p(), rb_enumeratorize(), rb_intern, rb_warn(), and strio_each_char().
Referenced by Init_stringio().
Definition at line 346 of file stringio.c.
References CLOSED, Qnil, rb_eIOError, rb_raise(), RBASIC, StringIO, and STRIO_READWRITE.
Referenced by Init_stringio().
Definition at line 364 of file stringio.c.
References Qnil, rb_eIOError, rb_raise(), RBASIC, READABLE, StringIO, and STRIO_READABLE.
Referenced by Init_stringio().
Definition at line 382 of file stringio.c.
References Qnil, rb_eIOError, rb_raise(), RBASIC, StringIO, STRIO_WRITABLE, and WRITABLE.
Referenced by Init_stringio().
Definition at line 399 of file stringio.c.
References CLOSED, Qfalse, Qtrue, and StringIO.
Referenced by Init_stringio().
Definition at line 413 of file stringio.c.
References Qfalse, Qtrue, READABLE, and StringIO.
Referenced by Init_stringio().
Definition at line 427 of file stringio.c.
References Qfalse, Qtrue, StringIO, and WRITABLE.
Referenced by Init_stringio().
Definition at line 928 of file stringio.c.
References ID2SYM, rb_block_given_p(), rb_enumeratorize(), rb_intern, rb_warn(), and strio_each_codepoint().
Referenced by Init_stringio().
Definition at line 452 of file stringio.c.
References check_strio, StringIO::count, DATA_PTR(), OBJ_INFECT, ptr, rb_convert_type(), RBASIC, StringIO, strio_free(), STRIO_READWRITE, and T_DATA.
Referenced by Init_stringio(), and strio_reopen().
Definition at line 1110 of file stringio.c.
References NIL_P(), NUM2LONG, rb_check_string_type(), rb_eArgError, rb_raise(), rb_yield(), readable(), RETURN_ENUMERATOR, StringIO, and strio_getline().
Referenced by Init_stringio(), and strio_lines().
Definition at line 647 of file stringio.c.
References c, CHR2FIX, StringIO::pos, ptr, rb_yield(), readable(), RETURN_ENUMERATOR, RSTRING_LEN, RSTRING_PTR, and StringIO::string.
Referenced by Init_stringio(), and strio_bytes().
Definition at line 868 of file stringio.c.
References c, NIL_P(), rb_yield(), RETURN_ENUMERATOR, and strio_getc().
Referenced by Init_stringio(), and strio_chars().
Definition at line 900 of file stringio.c.
References c, enc, n, StringIO::pos, ptr, rb_enc_codepoint_len(), rb_enc_get(), rb_yield(), readable(), RETURN_ENUMERATOR, RSTRING_END, RSTRING_LEN, RSTRING_PTR, StringIO::string, and UINT2NUM.
Referenced by Init_stringio(), and strio_codepoints().
Definition at line 443 of file stringio.c.
References StringIO::pos, ptr, Qfalse, Qtrue, readable(), RSTRING_LEN, and StringIO::string.
Referenced by Init_stringio().
Definition at line 714 of file stringio.c.
References check_modifiable(), MEMZERO, rb_str_modify(), rb_str_resize(), RSTRING_LEN, RSTRING_PTR, and StringIO::string.
Referenced by strio_write().
Definition at line 1463 of file stringio.c.
References rb_enc_from_encoding(), rb_enc_get(), and StringIO.
Referenced by Init_stringio().
Definition at line 249 of file stringio.c.
Definition at line 222 of file stringio.c.
References StringIO::flags, FMODE_READWRITE, ptr, Qnil, StringIO::string, and StringIO.
Referenced by strio_s_open().
Definition at line 289 of file stringio.c.
Definition at line 58 of file stringio.c.
References StringIO::count, p, ptr, and xfree.
Referenced by strio_copy().
Definition at line 481 of file stringio.c.
References lineno, LONG2NUM, and StringIO.
Referenced by Init_stringio().
Definition at line 545 of file stringio.c.
References LONG2NUM, StringIO::pos, and StringIO.
Referenced by Init_stringio().
Definition at line 629 of file stringio.c.
References Qtrue, and StringIO.
Referenced by Init_stringio().
Definition at line 702 of file stringio.c.
References c, CHR2FIX, StringIO::pos, ptr, Qnil, readable(), RSTRING_LEN, RSTRING_PTR, and StringIO::string.
Referenced by Init_stringio().
Definition at line 679 of file stringio.c.
References enc, len, p, StringIO::pos, ptr, Qnil, rb_enc_get(), rb_enc_mbclen(), rb_enc_str_new(), readable(), RSTRING_END, RSTRING_LEN, RSTRING_PTR, and StringIO::string.
Referenced by Init_stringio(), and strio_each_char().
Definition at line 970 of file stringio.c.
References bm_init_skip(), bm_search(), CHAR_BIT, e, StringIO::lineno, MEMCMP, n, NIL_P(), NUM2LONG, p, StringIO::pos, Qnil, rb_check_string_type(), rb_enc_get(), rb_enc_right_char_head, rb_rs, rb_scan_args(), rb_str_new(), RB_TYPE_P, RSTRING_LEN, RSTRING_PTR, s, str, StringIO::string, StringValue, strio_substr(), T_STRING, and tmp.
Referenced by strio_each(), strio_gets(), and strio_readlines().
Definition at line 1071 of file stringio.c.
References rb_lastline_set(), readable(), str, and strio_getline().
Referenced by Init_stringio().
Definition at line 180 of file stringio.c.
References errno, FIX2INT, FIXNUM_P, StringIO::flags, flags, FMODE_READABLE, FMODE_READWRITE, FMODE_WRITABLE, StringIO::lineno, m, mode, OBJ_FROZEN, StringIO::pos, rb_default_external_encoding(), rb_enc_str_new(), rb_io_mode_flags, rb_io_modenum_flags, rb_scan_args(), rb_str_resize(), rb_sys_fail(), RBASIC, StringIO::string, StringValue, StringValueCStr, and STRIO_READABLE.
Referenced by strio_initialize(), and strio_reopen().
Definition at line 167 of file stringio.c.
References check_strio, DATA_PTR(), ptr, rb_call_super(), strio_alloc(), and strio_init().
Referenced by Init_stringio().
Definition at line 1132 of file stringio.c.
References ID2SYM, rb_block_given_p(), rb_enumeratorize(), rb_intern, rb_warn(), and strio_each().
Referenced by Init_stringio().
Definition at line 49 of file stringio.c.
References p, ptr, rb_gc_mark(), and StringIO::string.
Definition at line 67 of file stringio.c.
Definition at line 259 of file stringio.c.
Definition at line 1250 of file stringio.c.
References c, check_modifiable(), NUM2CHR, ptr, rb_str_new(), rb_str_substr(), RB_TYPE_P, str, strio_write(), T_STRING, and writable().
Referenced by Init_stringio().
Definition at line 1282 of file stringio.c.
References len, MEMCPY, NIL_P(), NUM2LONG, StringIO::pos, ptr, Qnil, rb_ascii8bit_encoding(), rb_eArgError, rb_enc_associate(), rb_enc_copy(), rb_raise(), rb_str_modify(), rb_str_new(), rb_str_resize(), readable(), RSTRING_LEN, RSTRING_PTR, str, StringIO::string, StringValue, and strio_substr().
Referenced by Init_stringio(), and strio_read_nonblock().
Definition at line 1372 of file stringio.c.
References NIL_P(), NULL, opts, Qfalse, Qnil, rb_eof_error(), rb_hash_aref(), rb_scan_args(), strio_read(), sym_exception, and val.
Referenced by Init_stringio().
Definition at line 853 of file stringio.c.
References c, NIL_P(), rb_eof_error(), rb_funcall2(), and rb_intern.
Referenced by Init_stringio().
Definition at line 839 of file stringio.c.
References c, NIL_P(), rb_eof_error(), rb_funcall2(), and rb_intern.
Referenced by Init_stringio().
Definition at line 1088 of file stringio.c.
References NIL_P(), rb_eof_error(), rb_funcall2(), and rb_intern.
Referenced by Init_stringio().
Definition at line 1149 of file stringio.c.
References ary, NIL_P(), NUM2LONG, rb_ary_new(), rb_ary_push(), rb_check_string_type(), rb_eArgError, rb_raise(), readable(), StringIO, and strio_getline().
Referenced by Init_stringio().
Definition at line 527 of file stringio.c.
References rb_io_taint_check(), RB_TYPE_P, StringIO, strio_copy(), strio_init(), and T_STRING.
Referenced by Init_stringio().
Definition at line 576 of file stringio.c.
References INT2FIX, StringIO::lineno, StringIO::pos, ptr, and StringIO.
Referenced by Init_stringio().
Definition at line 156 of file stringio.c.
References TypedData_Wrap_Struct.
Referenced by Init_stringio().
Definition at line 238 of file stringio.c.
References obj, rb_block_given_p(), rb_class_new_instance(), rb_ensure(), rb_yield(), and strio_finalize().
Referenced by Init_stringio().
Definition at line 592 of file stringio.c.
References CLOSED, error_inval, INT2FIX, NIL_P(), NULL, NUM2LONG, StringIO::pos, ptr, rb_eIOError, rb_raise(), rb_scan_args(), RSTRING_LEN, StringIO::string, and StringIO.
Referenced by Init_stringio().
Definition at line 269 of file stringio.c.
References StringIO.
Definition at line 1493 of file stringio.c.
References enc, NIL_P(), rb_default_external_encoding(), rb_enc_associate(), rb_scan_args(), rb_to_encoding(), str, and StringIO.
Referenced by Init_stringio().
Definition at line 494 of file stringio.c.
References lineno, NUM2LONG, and StringIO.
Referenced by Init_stringio().
Definition at line 557 of file stringio.c.
References error_inval, NUM2LONG, p, StringIO::pos, ptr, and StringIO.
Referenced by Init_stringio().
Definition at line 325 of file stringio.c.
References StringIO::flags, FMODE_READABLE, FMODE_READWRITE, StringIO::lineno, OBJ_FROZEN, StringIO::pos, ptr, rb_io_taint_check(), StringIO::string, StringIO, and StringValue.
Referenced by Init_stringio().
Definition at line 1422 of file stringio.c.
References NIL_P(), rb_eIOError, rb_raise(), RSTRING_LEN, StringIO, and ULONG2NUM.
Referenced by Init_stringio().
Definition at line 98 of file stringio.c.
References enc, StringIO::pos, rb_enc_get(), rb_enc_str_new(), rb_str_new(), RSTRING_LEN, RSTRING_PTR, str, and StringIO::string.
Referenced by strio_getline(), and strio_read().
Definition at line 1355 of file stringio.c.
References NIL_P(), rb_eof_error(), rb_funcall2(), rb_intern, and val.
Referenced by Init_stringio().
Definition at line 1400 of file stringio.c.
References NULL, rb_scan_args(), str, and strio_syswrite.
Referenced by Init_stringio().
Definition at line 1439 of file stringio.c.
References error_inval, len, MEMZERO, NUM2LONG, rb_str_resize(), RSTRING_LEN, RSTRING_PTR, StringIO::string, and writable().
Referenced by Init_stringio().
Definition at line 796 of file stringio.c.
References buf, check_modifiable(), cp, FIX2INT, FIXNUM_P, memcpy(), memmove(), NIL_P(), StringIO::pos, ptr, Qnil, RB_GC_GUARD(), rb_str_modify(), rb_str_resize(), readable(), RSTRING_LEN, RSTRING_PTR, s, SafeStringValue, str, and StringIO::string.
Referenced by Init_stringio().
Definition at line 740 of file stringio.c.
References buf, check_modifiable(), enc, enc2, FIX2INT, FIXNUM_P, len, memset(), NIL_P(), p, StringIO::pos, ptr, Qnil, rb_ascii8bit_encoding(), rb_enc_codelen(), rb_enc_get(), rb_enc_mbclen(), rb_enc_mbcput, rb_enc_str_new(), rb_str_concat(), rb_str_conv_enc(), rb_str_resize(), rb_str_update(), readable(), RSTRING_LEN, RSTRING_PTR, SafeStringValue, and StringIO::string.
Referenced by Init_stringio().
Definition at line 299 of file stringio.c.
References rb_notimplement(), StringIO, and UNREACHABLE.
Definition at line 1177 of file stringio.c.
References check_modifiable(), enc, enc2, StringIO::flags, FMODE_APPEND, INT2FIX, len, LONG2NUM, memmove(), OBJ_INFECT, StringIO::pos, ptr, rb_ascii8bit_encoding(), rb_enc_get(), rb_enc_str_buf_cat(), RB_GC_GUARD(), rb_obj_as_string(), rb_str_buf_append(), rb_str_conv_enc(), RB_TYPE_P, RSTRING_LEN, RSTRING_PTR, StringIO::string, strio_extend(), T_STRING, and writable().
Referenced by Init_stringio(), and strio_putc().
Definition at line 136 of file stringio.c.
References OBJ_TAINTED, ptr, rb_eIOError, rb_raise(), StringIO::string, StringIO, and WRITABLE.
Referenced by strio_putc(), strio_truncate(), and strio_write().
|
static |
Definition at line 74 of file stringio.c.
|
static |
Definition at line 123 of file stringio.c.
Referenced by Init_stringio(), and strio_read_nonblock().