summaryrefslogtreecommitdiffstats
path: root/io.c
Commit message (Collapse)AuthorAgeFilesLines
* merges r22902 from trunk into ruby_1_9_1.yugui2009-04-121-2/+2
| | | | | | | -- * io.c (copy_stream_fallback_body): off_t may be larger than long. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@23185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r22610 from trunk into ruby_1_9_1.yugui2009-03-031-15/+17
| | | | | | | | -- * io.c (rb_io_getline_1): enables limit even if rs is given. [ruby-core:22434] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@22740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r22146 from trunk into ruby_1_9_1.yugui2009-02-221-0/+4
| | | | | | | * io.c (io_encoding_set): ignore second argument when external and internal are same. [ruby-dev:37939] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@22523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r22121 from trunk into ruby_1_9_1.yugui2009-02-221-0/+1
| | | | | | * io.c (rb_io_s_binread): ensures file path. [ruby-dev:37940] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@22519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r22099 from trunk into ruby_1_9_1.yugui2009-02-221-0/+3
| | | | | | | * io.c (io_fread): use rb_io_wait_readable for retry avoid Errno::EINTR on ruby -e 'trap(:CHLD) {}; spawn("sleep 1"); STDIN.read' git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@22518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r22037 from trunk into ruby_1_9_1.yugui2009-02-221-2/+0
| | | | | | rdoc update. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@22511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r21715 and r21718 from trunk into ruby_1_9_1.yugui2009-01-281-1/+4
| | | | | | * io.c (rb_io_ungetbyte, rb_io_ungetc): clears EOF flag. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r21709, r21710 from trunk into ruby_1_9_1.yugui2009-01-281-3/+15
| | | | | | | | | | * include/ruby/io.h (FMODE_EOF): EOF flag on TTY. * io.c (io_set_eof): sets EOF flag for TTY. * io.c (io_seek): clears EOF flag. * io.c (io_fillbuf): returns EOF if already met EOF. [ruby-dev:37798] * io.c (io_fillbuf, io_fread, io_getpartial): sets EOF. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r21504 from trunk into ruby_1_9_1.yugui2009-01-151-2/+2
| | | | | | * io.c (rb_io_wait_readable, rb_io_wait_writable): need rb_fd_ptr. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r21503 from trunk into ruby_1_9_!.yugui2009-01-151-14/+9
| | | | | | * io.c (appendline): reformed. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r21492 and r21495 from trunk into ruby_1_9_1.yugui2009-01-151-1/+9
| | | | | | | | | | | * io.c (rb_io_close_read): call rb_io_fptr_cleanup() instead of fptr_finalize() because the fptr has special finalizser if it is a pipe. [ruby-dev:37757] (3) * io.c (io_reopen, rb_io_init_copy): should register fptr to pipe_list when copying pipe fptr. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r21491 from trunk into ruby_1_9_1.yugui2009-01-151-0/+6
| | | | | | | * io.c (rb_io_initialize): workaround for Windows. [ruby-dev:37686] (also see [ruby-dev:37721]) git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r21288 from trunk into ruby_1_9_1.yugui2009-01-041-17/+17
| | | | | | | | | | | | | * io.c (maygvl_copy_stream_wait_read): renamed to add prefix to express GVL state. (nogvl_copy_stream_wait_write): ditto. (nogvl_copy_stream_sendfile): ditto. (maygvl_copy_stream_read): ditto. (nogvl_copy_stream_write): ditto. (nogvl_copy_stream_read_write): ditto. (nogvl_copy_stream_func): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r21211 and r21213 from trunk into ruby_1_9_1.yugui2009-01-011-0/+6
| | | | | | update rdoc. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r21209 from trunk into ruby_1_9_1.yugui2009-01-011-4/+2
| | | | | | | * io.c (copy_stream_body): don't check to_io because Zlib::GzipWriter#to_io returns the underlying IO. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r21068 from trunk into ruby_1_9_1.yugui2008-12-261-16/+29
| | | | | | | | | | * io.c (fptr_finalize): don't allocate objects if noraise. (finish_writeconv): add noalloc argument to be able to avoid object allocation. (finish_writeconv_arg): introduced again. (finish_writeconv_sync): follow the above change. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r21059 from trunk into ruby_1_9_1.yugui2008-12-261-52/+39
| | | | | | | | | | | | | | * io.c (fptr_finalize): close the IO object even if finish_writeconv or flush is failed. (finish_writeconv): don't raise. return errno or exception. (finish_writeconv_arg): removed. (finish_writeconv_sync): follow finish_writeconv change. * transcode.c (rb_econv_make_exception): new function. * include/ruby/encoding.h (rb_econv_make_exception): declared. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r20990 from trunk into ruby_1_9_1.yugui2008-12-251-0/+2
| | | | | | * io.c (rb_io_initialize): check fd validity. [ruby-dev:36646] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r20989 from trunk into ruby_1_9_1.yugui2008-12-251-14/+28
| | | | | | | | | | | | | | | | * io.c (flush_before_seek): check io_fflush result. (rb_io_check_readable): ditto. (rb_io_flush): ditto. (rb_io_fsync): ditto. (remain_size): ditto. (rb_io_write_nonblock): ditto. (finish_writeconv): ditto. (fptr_finalize): ditto. (io_reopen): ditto. (rb_io_reopen): ditto. (copy_stream_body): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r20988 from trunk into ruby_1_9_1.yugui2008-12-251-1/+8
| | | | | | | | | * io.c (io_fflush): flush write buffer without write lock in finalizers. [ruby-dev:37572] * io.c (rb_io_fptr_finalize): clear write lock before finalizing. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r20987 from trunk into ruby_1_9_1.yugui2008-12-251-18/+11
| | | | | | * io.c (fptr_finalize): close the IO object even if close(2) is failed. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r20982 and r20983 from trunk into ruby_1_9_1.yugui2008-12-251-0/+3
| | | | | | | * io.c (rb_io_flush): fsync() after buffer is flushed on win32. [ruby-core:20043] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r20954 from trunk into ruby_1_9_1.yugui2008-12-251-1/+4
| | | | | | * io.c (rb_io_init_copy): call io_seek only if io_tell succeeds. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r20946 from trunk into ruby_1_9_1.yugui2008-12-251-28/+95
| | | | | | | | * io.c: rdoc for File::open and 1.9 feature in file modes. * transcode.c: rdoc for String#encode git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r20934 from trunk into ruby_1_9_1.yugui2008-12-251-1/+1
| | | | | | * io.c (pipe_open): need to initialize args. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r20892 from trunk into ruby_1_9_1.yugui2008-12-211-10/+6
| | | | | | | | | | | | | | | | | * dln.c (dln_find_1): supplements an extension for executable files on DOSish platforms. * io.c (pipe_open): use rb_w32_aspawn() for array form. * win32/win32.c (rb_w32_pipe_exec): no longer used. * win32/win32.c (rb_w32_spawn, rb_w32_aspawn): deals with batch files and commands with extensions. [ruby-core:20695] * win32/win32.c (has_redirection): supports environment variables references. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@20899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r20528 from trunk into ruby_1_9_1.yugui2008-12-211-1/+47
| | | | | | | | | | * win32/win32.c (rb_w32_read): ERROR_BROKEN_PIPE is not a real error at this point. * io.c (pipe_open): use rb_w32_spawn() instead of rb_w32_pipe_exec() to use our own redirection scheme. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@20897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r20870 from trunk into ruby_1_9_1.yugui2008-12-191-38/+43
| | | | | | | | | | | * io.c (rb_io_extract_encoding_option): "internal_encoding: nil" to specify no-transcoding. and other corner case fixed. [ruby-dev:37496] * hash.c (rb_hash_lookup2): new function to look-up hash with default value. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@20886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rdoc fix.akr2008-12-111-3/+3
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@20649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r20532 from trunk into ruby_1_9_1.yugui2008-12-051-1/+1
| | | | | | * io.c (io_binwrite): arg.offset should be updated after retry. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@20552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r20472 from trunk into ruby_1_9_1.yugui2008-12-041-9/+19
| | | | | | update rdoc. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@20500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r20458 and r20459 from trunk into ruby_1_9_1.yugui2008-12-041-5/+5
| | | | | | | | | * io.c (rb_io_getc, rb_io_readchar): documentation correction from Emiel van de Laar. [ruby-core:20212] * ext/stringio/stringio.c (strio_ungetbyte): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@20497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r20144 from trunk into ruby_1_9_1.yugui2008-11-111-20/+72
| | | | | | | | | | | | | | * include/ruby/io.h (rb_io_t): added write_lock to serialize. [ruby-core:19668] * gc.c (gc_mark_children): mark write_lock. * gc.c (rb_gc_call_finalizer_at_exit): Mutex also needs to be deferred. * io.c (io_fflush, io_binwrite, fptr_finalize): serializes writing. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@20192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merges r20045 from trunk into ruby_1_9_1.yugui2008-10-301-1/+8
| | | | | | | | | | | | * io.c (rb_io_rewind): should reset fptr->readconv if it's available. * io.c (more_char): clear readconv at EOF. * test/ruby/test_file.rb: should not read after EOF. use rewind instead. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@20058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merge from trunk (r19984, r19985, r19991-r19998)usa2008-10-281-18/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * io.c (extract_binmode): new function to extract binmode/textmode options from hash. * io.c (rb_io_extract_modeenc): use above function. * io.c (rb_io_s_pipe): recognize binmode/textmode options. * io.c (make_readconv): now can specify the size of cbuf. * io.c (read_all, appendline, io_getc, rb_io_ungetc): follow above change. * win32/win32.c (rb_w32_pipe_exec): internal fds should be always binmode. * test/ruby/test_file.rb (test_each_char_extended_file, test_getbyte_extended_file): add tests. * test/ruby/test_file.rb (test_*_extended_file): test in default/text/ binary mode. * test/ruby/test_file.rb (test_para_gets_extended_file): output file should be binmode. * test/ruby/test_io.rb (test_copy_stream, test_copy_stream_socket): skip some tests if there isn't IO#nonblock=. * test/ruby/test_io.rb (test_close_on_exec): skip if there isn't IO#close_on_exec=. * test/ruby/test_io.rb (test_bytes, test_readbyte): depend on binmode. * test/ruby/test_io.rb (test_sysopen): should specify the mode of IO::for_fd if F_GETFL is not available. * test/ruby/test_io_m17n.rb (test_getc_invalid3): should set binmode if enc is not compatible with ASCII. * test/ruby/test_require.rb (test_require_too_long_filename): too long commandline may be rejected by OS. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@19999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (argf_init): initial value of $. should be 0.nobu2008-10-271-1/+1
| | | | | | | see [ruby-dev:36937]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (read_all): the 3rd argument maybe Qnil.usa2008-10-271-1/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (read_all): use the given buffer to read when needs readconv.nobu2008-10-261-1/+1
| | | | | | | | based on the patch by wanabe <s.wanabe AT gmail.com> at [ruby-dev:36931]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (pipe_open): remove unnecessary flush before fork.matz2008-10-221-2/+0
| | | | | | | a patch from Kazuhiro NISHIYAMA <zn at mbf.nifty.com> in [ruby-dev:36840]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (open_key_args): should adjust argc, argv in structmatz2008-10-211-8/+8
| | | | | | foreach_arg. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/zlib/zlib.c: remove obsolete prototype macros.matz2008-10-211-6/+4
| | | | | | | | | | | | | | | | | | | | * ext/zlib/zlib.c (struct gzfile): add encoding field to gzfile structure. * ext/zlib/zlib.c (rb_gzreader_getc): now works on characters. * ext/zlib/zlib.c (rb_gzreader_getbyte): new method to retrieve single byte. * ext/zlib/zlib.c (rb_gzreader_readbyte): ditto. * ext/zlib/zlib.c (rb_gzreader_each_byte): renamed from each_char * ext/zlib/zlib.c (rb_gzreader_ungetc): allow unget strings. * ext/zlib/zlib.c (rb_gzreader_ungetbyte): renamed from ungetc. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c, include/ruby/intern.h (rb_io_ascii8bit_binmode): externed.shugo2008-10-211-1/+1
| | | | | | | | * ext/socket/socket.c (init_sock): use rb_io_ascii8bit_binmode() instead of rb_io_binmode(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_file_open_internal): should initialize fmode before using.nobu2008-10-211-3/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_extract_modeenc): plain rb/wb should set ASCII-8BITmatz2008-10-201-4/+14
| | | | | | | | | | | | | to the external_encoding. * io.c (rb_file_open_internal): ditto. * io.c (NEED_WRITECONV): no conversion when the external_encoding is ASCII-8BIT. * io.c (do_writeconv): skip ASCII-8BIT. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_ascii8bit_binmode): renamed from rb_io_binmode.akr2008-10-201-2/+17
| | | | | | | | (rb_io_binmode): don't change encoding conversion. (rb_io_binmode_m): call rb_io_ascii8bit_binmode. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rdoc update.akr2008-10-181-3/+7
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_binmode): reset encoding conversion.akr2008-10-161-5/+16
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_getc, rb_io_fread, rb_io_fwrite, rb_read_pending):mame2008-10-161-44/+0
| | | | | | | remove deprecated functions which do not work. [ruby-dev:36697] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rdoc update.akr2008-10-151-15/+24
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (Init_IO): $FILENAME and $* must be read-only. [ruby-dev:36698]nobu2008-10-141-2/+2
| | | | | | | | | * variable.c (*_getter, *_setter, *_marker): made public. * include/ruby/ruby.h (rb_gvar_*_{getter,setter,marker}): declared. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e