Граф коммитов

984 Коммитов

Автор SHA1 Сообщение Дата
naruse 7fa7345609 Rename FMODE_STRIP_BOM to FMODE_SETENC_BY_BOM.
* include/ruby/io.h, io.c (FMODE_SETENC_BY_BOM):
  renamed from FMODE_STRIP_BOM.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-21 06:17:06 +00:00
naruse f7207fa2fc Change modestr syntax for BOM to "BOM|UTF-*".
* io .c (rb_io_fmode_modestr): change modestr syntax for BOM
  to "BOM|UTF-*".

* io.c (parse_mode_enc): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-21 06:16:53 +00:00
nobu 4b82d3b6b8 * io.c (rb_sysopen_internal): removed const qualifier.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-20 15:06:36 +00:00
nobu 36c9cddf6c * io.c (rb_sysopen): moved sysopen_struct from rb_sysopen_internal.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-20 14:56:23 +00:00
nobu cb9038cbaf * io.c (rb_stdio_set_default_encoding): prototyped.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-05 10:18:21 +00:00
naruse 00499c097f Set encodings of stdio after setting default internal and external.
* io.c (rb_stdio_set_default_encoding): added.

* ruby.c (process_options): call rb_stdio_set_default_encoding
  after setting defualt internal and external.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-31 07:37:02 +00:00
matz 49991ff6f8 * io.c (argf_eof): should call next_argv() before testing.
[ruby-core:24561]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-28 08:46:04 +00:00
nobu b7f26835da * io.c (argf_eof): go to the next file if called after ARGF.close
or ARGF.skip.  [ruby-core:24561]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-26 10:17:39 +00:00
nobu c689ee1a89 * io.c (argf_eof): should not have reached EOF before trying to
read.  based on a patch by Heesob Park <phasis AT gmail.com> at
  [ruby-core:24559].  [ruby-core:24557]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-25 08:49:08 +00:00
naruse c38487d063 * io.c (rb_f_open): add rdoc about specifying ext_enc as *-bom.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-20 11:37:26 +00:00
nobu 2737b90e36 * io.c (io_read): should taint the result. [ruby-dev:38826]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-19 08:32:44 +00:00
nobu e07cb859cc * suppressed shorten-64-to-32 warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 08:05:32 +00:00
nobu 53163f8138 * io.c (io_reopen): discards read buffer. [ruby-core:24240]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-16 07:00:23 +00:00
ko1 0d2449bd35 * io.c (argf_free): free data body.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-15 23:55:21 +00:00
nobu 9681409e36 * io.c (rb_io_initialize): check if the descriptor can be accessed
in the specified open mode.  [ruby-dev:38571]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-14 07:13:11 +00:00
usa 0fefd19023 * io.c (pipe_open): handles leaked on win32 when an error occurs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-13 13:33:00 +00:00
akr e13fb8029b rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-12 17:36:23 +00:00
naruse 161f0a1699 io.c (io_strip_bom): ungetbyte third byte when UTF-16LE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-10 14:21:13 +00:00
naruse f188db3105 Fix condition of second byte of UTF-16LE/UTF-32LE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-10 14:21:04 +00:00
naruse 67016f368c cosmetic changes
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-10 13:17:43 +00:00
naruse 634cfdc6e6 Set encoding and strip bom when modeenc string is "r:foo-bom" [ruby-dev:37236]
* include/ruby/io.h (FMODE_STRIP_BOM): new constant.

* io.c (io_encname_bom_p): judge whether the encoding name
  is *-bom or not.
  (parse_mode_enc): drop "-bom".
  (rb_io_modestr_fmode): set FMODE_STRIP_BOM if needed.
  (rb_io_extract_modeenc): ditto.
  (io_strip_bom): strip bom if exists.
  (io_set_encoding_by_bom): set encoding if there is bom.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-09 14:47:48 +00:00
naruse 999123c147 * io.c (rb_io_ext_int_to_encs): Set external encoding if
ext==intern. [ruby-dev:38278]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-07 01:15:32 +00:00
matz 917286208c * io.c (argf_rewind): need to rewind $. and ARGF.lineno.
[ruby-core:24046]

* io.c (struct argf): refactoring on $. and ARGF.lineno behavior.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-26 18:10:12 +00:00
matz 06e3782978 * io.c (argf_binmode_m): should call rb_io_ascii8bit_binmode() to
set its encoding to ASCII-8BIT.  [ruby-core:24029]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-25 09:01:45 +00:00
matz bfcc8dbbd3 * io.c (rb_io_each_codepoint): uninitialized local variable enc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-24 22:49:37 +00:00
akr 5202b22bfe update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-22 16:25:50 +00:00
akr fc64028291 * io.c: remove __CHECKER__ test.
* dir.c: ditto.

* dln.c: ditto.

* file.c: ditto.

* process.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-22 12:23:06 +00:00
matz fa31dda1f8 * ext/stringio/stringio.c (strio_each_codepoint): new method.
[ruby-core:23949]

* ext/stringio/stringio.c (strio_each_codepoint): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-22 08:23:30 +00:00
nobu a7dedc272e * io.c (rb_io_fdatasync): new method IO#fdatasync.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-22 04:50:29 +00:00
akr 5baa0431b9 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-20 19:15:08 +00:00
akr fa2ab2fca3 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-20 13:12:59 +00:00
ko1 3caa4ee5e5 * array.c (rb_ary_memsize): added.
* io.c (rb_io_memsize): added.
* regcomp.c (onig_memsize): added.
* string.c (rb_str_memsize): added.
* transcode.c (rb_transcoding_memsize, rb_econv_memsize): added.
* variable.c (rb_geneic_ivar_memsize): added.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-16 22:36:27 +00:00
matz d3b852345a * io.c (fptr_finalize): revert last change. [ruby-dev:38648]
* io.c (fptr_finalize): skip close(2) for fd 0,1,2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-16 14:46:53 +00:00
matz 6f1edacc01 * io.c (fptr_finalize): should close stdin/stdout/stderr when
closed explicitly.   [ruby-core:23853]

* io.c (argf_skip): should close only when current_file is available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-16 01:14:28 +00:00
matz c6cb57262d * io.c (argf_each_line): should return self. [ruby-core:23852]
* io.c (argf_each_byte, argf_each_char): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-15 09:54:36 +00:00
kazu a7a1968ad1 * io.c (Init_IO): add constant File::NOATIME. [ruby-core:23194]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-11 11:11:11 +00:00
nobu defd374aae * io.c (pipe_open): should be rb_pid_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-07 04:10:27 +00:00
nobu 5a809d60bd * io.c: fixed types.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-26 09:46:41 +00:00
nobu ff8681ba57 * io.c (io_reopen): keeps pathv for prep_stdio. [ruby-dev:38131]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-26 09:35:34 +00:00
akr 8e8ae2a9c5 * node.h (rb_notimplement_body_p): declared.
* vm_method.c (Init_eval_method): suppress a warning.

* io.c (rb_io_fsync): use rb_f_notimplement if not implemented.
  (rb_io_close_on_exec_p): ditto.
  (rb_io_set_close_on_exec): ditto.
  (rb_io_fcntl): ditto.
  (rb_f_syscall): ditto.

* dir.c (dir_tell): ditto.
  (dir_seek): ditto.
  (dir_s_chroot): ditto.

* process.c (proc_getpgrp): ditto.
  (proc_setpgrp): ditto.
  (proc_getpgid): ditto.
  (proc_setpgid): ditto.
  (proc_setsid): ditto.
  (proc_getpriority): ditto.
  (proc_setpriority): ditto.
  (proc_getrlimit): ditto.
  (proc_setrlimit): ditto.
  (p_sys_setuid): ditto.
  (p_sys_setruid): ditto.
  (p_sys_seteuid): ditto.
  (p_sys_setreuid): ditto.
  (p_sys_setresuid): ditto.
  (p_sys_setgid): ditto.
  (p_sys_setrgid): ditto.
  (p_sys_setegid): ditto.
  (p_sys_setregid): ditto.
  (p_sys_setreuid): ditto.
  (p_sys_setresgid): ditto.
  (p_sys_issetugid): ditto.
  (proc_getgroups): ditto.
  (proc_setgroups): ditto.
  (proc_initgroups): ditto.
  (proc_daemon): ditto.
  (rb_proc_times): ditto.

* file.c (rb_file_s_lchown): ditto.
  (rb_file_s_link): ditto.
  (rb_file_s_symlink): ditto.
  (rb_file_s_readlink): ditto.
  (rb_file_s_truncate): ditto.
  (rb_file_truncate): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-16 16:58:06 +00:00
matz d98da36b8c * thread.c (rb_thread_fd_select): new function to call select
using rb_fdset_t.

* io.c (select_internal): use rb_thread_fd_select instead of
  rb_thread_select.  based on the patch from Kengo Matsuyama.
  [ruby-dev:38221]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-01 04:56:51 +00:00
akr c79e8ba065 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-28 14:49:49 +00:00
knu 6c024efb90 * io.c (rb_io_inspect): Cannot access fptr->fd if fptr is NULL.
This fixes a coredump caused by: ruby -e "class X < IO; def
  initialize; end; end; p X.new.inspect"



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-24 08:11:01 +00:00
nobu 148f58c2df * io.c (pipe_open): should pass program name even if multiple
arguments are given.  fix for TestProcess::test_argv0.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-20 22:25:57 +00:00
akr c4049f4cb6 * io.c (rb_mWaitReadable): defined.
(rb_mWaitWritable): defined.
  (io_getpartial): extend IO::WaitReadable on EWOULDBLOCK and EAGAIN.
  (rb_io_write_nonblock): extend IO::WaitWritable on EWOULDBLOCK and
  EAGAIN.

* error.c (make_errno_exc): extracted from rb_sys_fail.
  (rb_mod_sys_fail): new function.

* include/ruby/ruby.h (rb_mod_sys_fail): declared.
  (rb_mWaitReadable): declared.
  (rb_mWaitWritable): declared.

* ext/socket/init.c (rsock_s_recvfrom_nonblock): extend
  IO::WaitReadable on EWOULDBLOCK and EAGAIN.
  (rsock_s_accept_nonblock): extend IO::WaitReadable on EWOULDBLOCK,
  EAGAIN, ECONNABORTED and EPROTO.

* ext/socket/socket.c (sock_connect_nonblock): extend IO::WaitWritable
  on EINPROGRESS.

* ext/socket/ancdata.c (bsock_sendmsg_internal): extend
  IO::WaitWritable on EWOULDBLOCK and EAGAIN.
  (bsock_recvmsg_internal): extend IO::WaitReadable on EWOULDBLOCK and
  EAGAIN.

* ext/openssl/ossl_ssl.c (ossl_ssl_read_internal): raise SSLError
  extended by IO::WaitReadable/IO::WaitWritable on
  SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE.

* ext/openssl/ossl.c (ossl_make_error): extracted from ossl_raise.
  (ossl_exc_new): new function.

* ext/openssl/ossl.h (ossl_exc_new): declared.

* lib/net/protocol.rb (rbuf_fill): rescue IO::WaitReadable and
  IO::WaitWritable.

  [ruby-core:22539], [ruby-dev:38140] 



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-19 11:40:38 +00:00
akr 616932fbdb rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-17 10:27:17 +00:00
akr e36cfc749f rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-17 10:14:01 +00:00
akr e3cb6518d1 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-17 01:37:57 +00:00
nobu 50d1f54d4d * io.c (nogvl_copy_stream_read_write, copy_stream_body): use size_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12 10:40:33 +00:00
nobu d1abc53721 * array.c, bignum.c, dln.c, error.c, gc.c, io.c, marshal.c,
numeric.c, pack.c, strftime.c, string.c, thread.c, transcode.c,
  transcode_data.h, util.c, variable.c, vm_dump.c,
  include/ruby/encoding.h, missing/crypt.c, missing/vsnprintf.c:
  suppress VC type warnings.  [ruby-core:22726]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12 09:16:15 +00:00
nobu 748ed24234 * io.c (copy_stream_fallback_body): off_t may be larger than long.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-11 20:22:52 +00:00
usa 2c288bf91f * include/ruby/win32.h (rb_w32_wopen): prototype forgotten.
* io.c (rb_sysopen_internal): shouldn't replace undefined chars in this
	  case.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-26 01:58:20 +00:00
usa a898f0fb4b * io.c (sysopen_func, rb_sysopen_internal, rb_sysopen): open file
by UTF-16'ed filename on Windows.

	* io.c (rb_file_open_generic, rb_io_s_sysopen, rb_io_reopen,
	  argf_next_argv): follow above change.

	* io.c (rb_scan_open_args): no longer need to convert filepath here on
	  Windows.

	* win32/wio32.c (rb_w32_wopen): new function to open file by UTF-16'ed
	  filename.

	* win32/win32.c (rb_w32_open): call rb_w32_open().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-25 08:36:45 +00:00
nobu ac9d09ba3c * io.c (rb_io_getline_1): enables limit even if rs is given.
[ruby-core:22434]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-25 03:06:12 +00:00
akr 2e0a20d3e2 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 16:22:28 +00:00
nobu 12d2c8ba41 stripped trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
akr 9cfe35ad50 * io.c (io_getpartial): error message describes what should be
waited after nonblocking error.
  (rb_io_write_nonblock): ditto.

* ext/socket/init.c (s_recvfrom_nonblock): ditto.
  (s_accept_nonblock): ditto.

* ext/socket/socket.c (sock_connect_nonblock): ditto.

* ext/socket/ancdata.c (bsock_sendmsg_internal): ditto.
  (bsock_recvmsg_internal): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-21 15:57:52 +00:00
nobu 30231731a9 * io.c (pipe_open): sarg is always used unless HAVE_FORK.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-18 06:33:53 +00:00
nobu 3229c32008 * io.c (rb_write_error2, argf_next_argv), process.c (rb_fork_err),
random.c (fill_random_seed): suppress warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-18 06:21:04 +00:00
naruse 646e2efaef * io.c (io_encoding_set): ignore second argument when external and
internal are same. [ruby-dev:37939]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-09 02:35:38 +00:00
nobu 25d14edf29 * io.c (rb_io_s_binread): ensures file path. [ruby-dev:37940]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-08 09:34:46 +00:00
akr a0b54e6cbd * 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@22099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-06 14:46:21 +00:00
azav 71dd792128 (pipe_open) [__SYMBIAN32__]: fixed compile time error
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-06 13:31:20 +00:00
akr 74063bf4d3 * include/ruby/intern.h (rb_run_exec_options_err): renamed from
rb_run_exec_options.
  (rb_exec_err): renamed from rb_exec.
  (rb_fork_err): renamed from rb_fork.
  (rb_spawn_err): renamed from rb_spawn.
  (rb_run_exec_options): declared with 1.9.1 compatible signature.
  (rb_exec): ditto.
  (rb_fork): ditto.
  (rb_spawn): ditto.

* process.c (rb_run_exec_options_err): renamed from
  rb_run_exec_options.
  (rb_exec_err): renamed from rb_exec.
  (rb_fork_err): renamed from rb_fork.
  (rb_spawn_err): renamed from rb_spawn.
  (rb_run_exec_options): defined.
  (rb_exec): ditto.
  (rb_fork): ditto.
  (rb_spawn): ditto.

* io.c: follow above change.

* ext/pty/pty.c: follow above change.

  [ruby-dev:37893]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-05 11:33:19 +00:00
akr 28e33ad61e rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-04 12:58:55 +00:00
akr 4a3e62b383 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-31 05:12:23 +00:00
usa 9e83ce20b1 * revert previous revision. it's already out-of-date.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-22 07:13:40 +00:00
usa a3e8d63a75 * include/ruby/win32.h, win32/win32.c (rb_w32_is_valid_fd): new function
to validate fd.

	* io.c (rb_io_initialize): check fd with above function.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-22 06:55:20 +00:00
nobu 938fcd6b70 * io.c (rb_io_ungetbyte, rb_io_ungetc): allows nil to reset EOF
flag with ungetting nothing.

* ruby.c (load_file_internal): rests EOF flag to make possible to
  load from stdin after reading data.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-21 12:42:39 +00:00
nobu 237c54075a * io.c (rb_io_ungetbyte, rb_io_ungetc): clears EOF flag.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-21 06:31:03 +00:00
nobu 877dca1e27 * include/ruby/io.h (typedef struct rb_io_t):
* io.c (flush_before_seek):
* io.c (io_fillbuf):
* io.c (io_fread):
* io.c (io_getpartial):
* ruby.c (load_file_internal):


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-21 04:56:06 +00:00
akr c157583627 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-15 13:45:06 +00:00
usa 4430438c66 * io.c (pipe_open): revert a part of previous commit. it may be a
mistake.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-15 02:41:38 +00:00
matz c6af6b1b94 * symbian/README.SYMBIAN: symbian support added. great appreciate
to <alexandre.zavorine at symbian.com>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-15 01:53:08 +00:00
nobu 96a49b1ada * io.c (rb_io_wait_readable, rb_io_wait_writable): need rb_fd_ptr.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-14 03:39:20 +00:00
nobu ff80e84db9 * io.c (appendline): reformed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-14 03:38:06 +00:00
nobu d4beba3f3e * io.c (rb_io_s_pipe): reduced nest of rb_ensure of main block.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-14 03:35:25 +00:00
usa be551172ed * io.c (io_reopen, rb_io_init_copy): should register fptr to pipe_list
when copying pipe fptr.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-13 12:45:43 +00:00
usa c4554d20a6 * 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)



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-13 09:23:54 +00:00
usa fbc4429d72 * io.c (rb_io_initialize): workaround for Windows. [ruby-dev:37686]
(also see [ruby-dev:37721])



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-13 09:21:14 +00:00
akr e6045986ef * io.c (rb_close_before_exec): more heuristics to detect maximum fd.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-05 15:35:21 +00:00
akr 1dfea33652 * 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@21288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-03 18:34:06 +00:00
akr a6d38b8c39 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-31 11:09:27 +00:00
akr f7676fd9d4 update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-31 09:06:09 +00:00
akr 67d66b2652 * io.c (copy_stream_body): don't check to_io because
Zlib::GzipWriter#to_io returns the underlying IO.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-31 07:19:24 +00:00
naruse a928613a31 revert previous changes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-29 02:56:23 +00:00
naruse 1ebed6c614 * file.c (rb_get_path): move encoding conversion of file path
from rb_scan_open_args.

* io.c (rb_scan_open_args): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-29 02:01:02 +00:00
akr b729ec53a2 * 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@21068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-26 09:05:47 +00:00
akr b17c5eba46 * 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@21059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-26 05:04:39 +00:00
akr b0480260e2 * io.c (rb_io_s_pipe): unused variable removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-25 11:02:09 +00:00
akr bb4329becd * io.c (pipe_close): removed.
(pipe_yield): defined.
  (rb_io_s_pipe): use pipe_yield.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-25 09:36:40 +00:00
akr ea6ac1c45b * io.c (rb_io_initialize): check fd validity. [ruby-dev:36646]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-25 08:07:01 +00:00
akr db0a659012 * 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@20989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-25 07:25:06 +00:00
matz ad558a3a7f * 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@20988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-25 06:55:38 +00:00
akr f20234994e * io.c (fptr_finalize): close the IO object even if close(2) is failed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-25 06:08:12 +00:00
usa dea037cc67 * io.c: sorry, wrong commit. orz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-25 04:33:22 +00:00
usa f29ec7ed67 * io.c (rb_io_flush): fsync() after buffer is flushed on win32.
[ruby-core:20043]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-25 04:29:30 +00:00
akr 19fee2e2e0 * io.c (rb_io_init_copy): call io_seek only if io_tell succeeds.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-23 15:22:18 +00:00
akr 423bbf80d5 * process.c (rb_fork): propagete an error message from child to parent.
(rb_f_exec): show details of error in child process on
  exception.
  (save_redirect_fd): add error message arguments.
  (run_exec_dup2): ditto.
  (run_exec_close): ditto.
  (run_exec_open): ditto.
  (run_exec_dup2_child): ditto.
  (run_exec_pgroup): ditto.
  (run_exec_rlimit): ditto.
  (rb_run_exec_options): ditto.
  (rb_exec): ditto.
  (rb_exec_atfork): ditto.
  (rb_spawn_internal): ditto.
  (rb_spawn): ditto.
  (rb_f_system): follow arguments change.
  (proc_daemon): ditto.
  (rb_f_spawn): show details of error in child process on exception.

* io.c (popen_exec): add error message arguments.
  (pipe_open): show details of error in child process on exception.

* include/ruby/intern.h (rb_run_exec_options): add error message
  arguments.
  (rb_exec): ditto.
  (rb_fork): ditto.
  (rb_spawn): ditto.

* ext/pty/pty.c (chfunc): add error message arguments.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-23 13:15:54 +00:00
yugui 5677106ec9 * io.c: rdoc for File::open and 1.9 feature in file modes.
* transcode.c: rdoc for String#encode

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-23 11:30:44 +00:00
akr fbcc23a8fa * io.c (rb_io_inspect): show fd number if there is no pathname.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-23 07:24:13 +00:00
usa 7d02404765 * io.c (pipe_open): need to initialize args.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-23 06:30:33 +00:00
akr a61a5f171d * io.c (pipe_close): fix coding style. [ruby-dev:37554]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-23 03:00:31 +00:00
akr b795b5c537 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-22 12:29:04 +00:00
akr 3a7daf882b * io.c (rb_io_s_pipe): IO.pipe can take a block.
(pipe_close): new function.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-22 12:27:26 +00:00
nobu 7ac32d7a16 * 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@20892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-20 09:28:29 +00:00
matz 63219d8a24 * 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@20870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-19 08:22:45 +00:00
akr b314ab3e44 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-10 17:18:31 +00:00
akr 4433defb46 * io.c (io_binwrite): arg.offset should be updated after retry.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-04 22:59:25 +00:00
usa a9a4435e12 * 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@20528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-04 16:39:03 +00:00
akr 49b10fd508 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-04 15:21:32 +00:00
akr ec324872d5 update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-03 15:02:49 +00:00
nobu aa39c4491a * 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@20458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-03 03:22:12 +00:00
nobu 551dfe9d8b * 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@20144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-07 20:47:02 +00:00
matz 86ade65104 * 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@20045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-29 16:40:05 +00:00
usa f3ac3e8774 * 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.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-28 12:00:42 +00:00
usa 7d934c47d1 * io.c (make_readconv): now can specify the size of cbuf.
* io.c (read_all, appendline, io_getc, rb_io_ungetc): follow above
	  change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-28 11:18:28 +00:00
nobu 782f3bd3f9 * io.c (argf_init): initial value of $. should be 0.
see [ruby-dev:36937].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-27 06:55:06 +00:00
usa db8e3024e7 * io.c (read_all): the 3rd argument maybe Qnil.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-27 01:03:22 +00:00
nobu 0db5641dae * io.c (read_all): use the given buffer to read when needs readconv.
based on the patch by wanabe <s.wanabe AT gmail.com> at
  [ruby-dev:36931].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-26 04:30:45 +00:00
matz a9a23756b5 * io.c (pipe_open): remove unnecessary flush before fork.
a patch from Kazuhiro NISHIYAMA <zn at mbf.nifty.com>
  in [ruby-dev:36840].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-22 08:27:48 +00:00
matz c5377c2bcc * io.c (open_key_args): should adjust argc, argv in struct
foreach_arg.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-21 13:57:16 +00:00
matz b6ef272d02 * ext/zlib/zlib.c: remove obsolete prototype macros.
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-21 09:18:34 +00:00
shugo d423b884b8 * io.c, include/ruby/intern.h (rb_io_ascii8bit_binmode): externed.
* ext/socket/socket.c (init_sock): use rb_io_ascii8bit_binmode()
  instead of rb_io_binmode().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-21 04:31:15 +00:00
nobu 4442095d4c * io.c (rb_file_open_internal): should initialize fmode before using.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-21 01:40:41 +00:00
matz e50a5bcef0 * io.c (rb_io_extract_modeenc): plain rb/wb should set ASCII-8BIT
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-20 16:57:19 +00:00
akr 7d48eab260 * io.c (rb_io_ascii8bit_binmode): renamed from rb_io_binmode.
(rb_io_binmode): don't change encoding conversion.
  (rb_io_binmode_m): call rb_io_ascii8bit_binmode.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-20 15:53:14 +00:00
akr de55ffd024 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-18 05:07:38 +00:00
akr 0cda4bb3bf * io.c (rb_io_binmode): reset encoding conversion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-16 15:25:25 +00:00
mame ca9589aeb0 * io.c (rb_getc, rb_io_fread, rb_io_fwrite, rb_read_pending):
remove deprecated functions which do not work.  [ruby-dev:36697]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-16 15:18:17 +00:00
akr 5c9dd204f5 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-15 09:15:46 +00:00
nobu 1288965f4e * io.c (Init_IO): $FILENAME and $* must be read-only. [ruby-dev:36698]
* variable.c (*_getter, *_setter, *_marker): made public.

* include/ruby/ruby.h (rb_gvar_*_{getter,setter,marker}): declared.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-14 11:45:32 +00:00
akr 43f910a9aa rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-11 13:44:31 +00:00
akr 470a309c4a rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-08 10:06:16 +00:00
matz baeeebf474 * encoding.c (rb_default_internal_encoding): merged a patch from
Michael Selig <michael.selig at fs.com.au> in [ruby-core:18985].

* io.c (rb_io_ext_int_to_encs): ditto.

* ruby.c (proc_options): support default internal encoding in -E
  option.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-07 17:39:44 +00:00
yugui e8ee99ff1a * dln.c: Ruby no longer supports VMS.
* error.c: ditto.

* eval.c: ditto.

* eval_intern.h: ditto.

* include/ruby/defines.h: ditto.

* include/ruby/ruby.h: ditto.

* io.c: ditto.

* process.c: ditto.

* ruby.c: ditto.

* vms/config.h: removed.

* vms/vms.h: ditto.

* vms/vmsruby_private.c: ditto.

* vms/vmsruby_private.h: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:57:06 +00:00
yugui ae7ea3332b * dln.c: Ruby no longer supports MS-DOS.
* ext/sdbm/_sdbm.c: ditto.

* ext/sdbm/sdbm.h: ditto.

* gc.c: ditto.

* hash.c: ditto.

* include/ruby/defines.h: ditto.

* include/ruby/util.h: ditto.

* io.c: ditto.

* process.c: ditto.

* ruby.c: ditto.

* strftime.c: ditto.

* util.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:33:22 +00:00
yugui 8dd118c0db * djgpp/GNUmakefile.in: removed. Ruby no longer supports djgpp.
* djgpp/README.djgpp: ditto.

* djgpp/config.hin: ditto.

* djgpp/config.sed: ditto.

* djgpp/configure.bat: ditto.

* djgpp/mkver.sed: ditto.

* ext/Setup.dj: ditto.

* dln.c: removed djgpp supports.

* file.c: ditto.

* gc.c: ditto.

* io.c: ditto.

* process.c: ditto.

* ruby.c: ditto.

* signal.c: ditto.

* util.c: ditto.

* vm_core.h: ditto.

* lib/fileutils.rb: ditto.

* lib/mkmf.rb: ditto.

* ext/socket/socket.c: ditto.

* test/fileutils/test_fileutils.rb: ditto.

* test/ruby/test_env.rb: ditto.

* test/ruby/test_path.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:25:12 +00:00
yugui bbbd9c0b7b * x68/_dtos18.c: removed. Ruby no longer supports human68k.
* x68/_round.c: ditto.

* x68/fconvert.c: ditto.

* x68/select.c: ditto.

* ext/Setup.x68: ditto.

* missing/x68.c: ditto.

* dln.c (dln_find_exe_r): removed human68k supports.
  (dln_find_1): ditto.

* lib/mkmf.rb: ditto.

* ext/extmk.rb (Init_ext): ditto.

* ext/socket/socket.c (init_sock): ditto.

* gc.c (GC_MALLOC_LIMIT): ditto.
  (rb_setjmp, rb_jmpbuf): ditto.
  (mark_current_machine_context): ditto.

* include/ruby/defines.h (PATH_ENV): ditto.

* io.c: ditto.

* process.c: ditto.

* ruby.c: ditto.

* test/ruby/test_env.rb: ditto.

* test/ruby/test_path.rb: ditto.

* LEGAL


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:12:13 +00:00
matz 414605560f * io.c (rb_io_extract_modeenc): should honor value of the
textmode: and binmode: options.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-30 17:55:25 +00:00
akr a3bebd5564 * include/ruby/encoding.h (rb_str_encode): renamed from
rb_str_transcode.  [ruby-dev:36593]
  (rb_econv_has_convpath_p): renamed from rb_transcode_convertible.

* transcode.c: follow the renaming.

* io.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-26 10:35:00 +00:00
akr 48fdf59dcf * io.c (rb_io_mode_enc): make it static.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-24 17:10:03 +00:00
matz 9bf27f6b17 * io.c (rb_io_s_binread): offset argument was wrongly passed to
internal IO#read call.  [ruby-core:18810]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-24 02:31:12 +00:00
akr c1759a9f18 * io.c (io_binwrite): allocate wbuf if nosync.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 12:51:39 +00:00
akr 0f1a1073f7 * io.c (copy_stream_body): use io_binwrite instead of io_fwrite.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 12:46:17 +00:00
akr 55783c696d * io.c (io_binwrite): add nosync argument.
(do_writeconv): extracted from io_fwrite.
  (io_fwrite): add nosync argument.  use do_writeconv.
  (io_write): add nosync argument.
  (io_write_m): new function for IO#write.
  (rb_p): don't append record separator.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 11:55:48 +00:00
matz 6b90013d1e * io.c (rb_io_s_binread): a new method to read binary chunk from a
file.  [ruby-core:18674]

* io.c (open_key_args): wrong permission specified for read-open.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 10:48:17 +00:00
ko1 b9a12116fb * thread.c, include/ruby/intern.h (rb_thread_interrupted): added.
* io.c: use VALUE of thead instead of rb_tread_t to check interrupts.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 08:17:17 +00:00
matz b09322c61a * io.c (rb_io_extract_modeenc): process option mode: and perm: as
well.

* io.c (open_key_args): move mode: and perm: related code to
  rb_io_extract_modeenc().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-17 16:39:47 +00:00
matz 73c8f02384 * io.c (rb_io_readbyte): rdoc updated. [ruby-core:18617]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-16 09:36:06 +00:00