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

951 Коммитов

Автор SHA1 Сообщение Дата
nobu bfeeb913fe * io.c (seek_before_access): fixed argument type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-30 17:22:32 +00:00
nobu 55181301ae * io.c (seek_before_access): renamed. see [ruby-core:29861].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-29 02:20:58 +00:00
nobu e1c34852dc * io.c (rb_io_s_binread): fixed rdoc. parts of a patch from Roger
Pack in [ruby-core:29861].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-29 02:17:12 +00:00
akr 87ba383aa3 * io.c (select_internal): IO which cbuf is not empty is readable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-26 21:21:07 +00:00
nobu 8ebadc63f4 * io.c (ruby_dup): update max fd.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-25 14:50:10 +00:00
akr ba2ee2f04c update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-24 12:00:56 +00:00
akr 02efdb4845 update document.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-24 06:05:34 +00:00
akr 78db46b31c * io.c: raise IOError when byte oriented operations occur with
non-empty character buffer.
  [ruby-dev:40493] [ruby-dev:40506]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-24 05:42:50 +00:00
naruse 4131d6176a * io.c (io_getc): fix incomplete character immediately before EOF
with newline converter. [ruby-dev:41024]
  run test only when "Create Shortcut (&S)" menu is found.
* lib/rexml/parsers/xpathparser.rb (PathExpr): ditto.
* lib/matrix.rb (Vector#each): make Vector enumerable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-21 06:37:18 +00:00
naruse 8a269f85a0 * io.c (io_getc): set read_encoding to resulted one character
string. [ruby-dev:41023]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-20 18:19:01 +00:00
usa ef3ea2dd89 * io.c: fixed the wrong description of rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-20 13:53:08 +00:00
usa 57e50f7f88 * io.c: rdoc. see [ruby-dev:40506].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-20 13:40:15 +00:00
nobu a91d8b8c33 * io.c (internal_{read,write}_func, rb_{read,write}_internal):
reverted r27265, since now rb_thread_blocking_region() preserves
  errno.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-19 15:41:27 +00:00
mame d6f289b0ff * io.c (rb_io_rewind, rb_io_eof): add rdoc. based on a patch from
Roger Pack in [ruby-core:26771] [Bug #2377].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-16 16:36:08 +00:00
nobu 8e7a682be0 * io.c (io_shift_cbuf): should terminate.
http://golf.shinh.org/p.rb?DECimal+number+to+BINary#Ruby


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-14 08:56:11 +00:00
kazu 0a6d09330c * io.c (rb_io_getline_fast, rb_io_getline_1): fix ARGF.lineno behavior. [ruby-core:25205]
* test/ruby/test_argf.rb (TestArgf#test_lineno3): add a test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-11 15:56:43 +00:00
nobu 92de2ed517 * io.c (internal_{read,write}_func, rb_{read,write}_internal):
preserve errno.  a patch from Takehiro Kubo in [ruby-core:29340].
  [ruby-core:28924]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-08 16:27:42 +00:00
nobu 171131061e * io.c (rb_io_initialize): fixed a rdoc miss that textmode and
bimode flag explanation was reversed each other.  a patch from
  Heesob Park in [ruby-core:29166].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-01 02:36:33 +00:00
nobu ed2dd5e3f4 * io.c (rb_io_initialize): add autoclose argument to control close
at finalization.  [ruby-core:26222]

* io.c (rb_io_autoclose_p, rb_io_set_autoclose): new methods.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-21 10:52:31 +00:00
nobu cce4892c1f * io.c (IO_RBUF_CAPA_FOR): use large buffer as cbuf if readconv is
needed for performance improvement.  based on a patch by Roger Pack
  in [ruby-core:28163].  [ruby-core:28162]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-21 08:57:55 +00:00
nobu f623979f65 * io.c (IO_[CRW]BUF_CAPA_MIN): replaced magic numbers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-21 00:43:07 +00:00
matz 01657b51f8 * io.c (rb_io_print): RDoc update. a patch from Daniel Kelley
in [ruby-core:28643].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-15 08:43:45 +00:00
nobu 32ed00ab18 * io.c (rb_io_each_codepoint): read directly when readconv is
needed but internal encoding is not set.  [ruby-core:28650]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-14 19:41:32 +00:00
matz 05d4516145 * io.c (rb_io_print): should not print field separator at the end
of arguments.  [ruby-talk:358633]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-13 06:59:37 +00:00
marcandre 51ae7f6e9a * io.c: Fix documentation for each/each_line/lines, bytes/each_byte,
codepoints/each_code_point [ruby-core:23948]

* string.c: ditto

* ext/stringio/stringio.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-07 10:22:05 +00:00
mame e796e95ec8 * io.c (rb_io_s_write, rb_io_s_binwrite): delete File#write and
#binwrite.  It may take a long time to make them stable, so 1.9.2
  should not include them.  We need refactoring to implement them
  again.

* test/ruby/test_io.rb: delete tests for them.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-06 04:52:31 +00:00
mame 127cfd1174 * io.c (rb_io_s_binwrite): use mode "r+b" instead of "ab" to handle
offset correctly.  [ruby-core:28517]

* test/ruby/test_io.rb: use assert_equal instead of assert.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-06 01:06:57 +00:00
nobu 4bcae18e37 * io.c (pipe_open): suppressed a warning.
* win32/win32.c (rb_w32_map_errno, winnt_stat, rb_chsize): ditto.

* win32/win32.c (rb_w32_aspawn): get rid of overflow.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-05 08:51:12 +00:00
mame ae2065a285 * io.c (io_s_write, io_s_binwrite): add File#write and #binwrite.
[ruby-core:21701]

* test/ruby/test_io.rb: add tests for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-04 13:48:20 +00:00
mame a0ff5cae7c * io.c (rb_io_lines, rb_io_bytes, rb_io_chars, rb_io_codepoints):
change to alias to each_*, in similar way to ARGF and String.
  [ruby-core:23948]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-02 12:19:24 +00:00
akr 54a61d3e2a rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-19 12:52:03 +00:00
mame 713e99cec2 * io.c (io_fread, io_getpartial, io_read, io_sysread): by using lock,
prohibit modification of buffer string during read (which had caused
  EFAULT or SEGV).  [ruby-dev:40437]

* test/ruby/test_io.rb: rewrite tests for the old behavior.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-17 17:19:53 +00:00
akr 76678bb526 * io.c: check lseek error by errno. NetBSD 4.0.1 may return -1 as
a file position of tty.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-15 14:37:52 +00:00
akr c09bcd351a * io.c (rb_io_oflags_modestr): return "r" for O_RDONLY|O_APPEND.
[ruby-dev:40379]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-11 11:45:22 +00:00
mame b4f90b236c * io.c (READ_CHECK): do not select fd before reading, that had made
TCPServer#gets stuck.  [ruby-dev:40317]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-09 13:27:04 +00:00
matz bba5e1126b * io.c (rb_io_getline_fast): wrong calculation of new position
from rb_str_coderange_scan_restartable().  [ruby-core:28103]

* io.c (read_all): ditto.  

* sprintf.c (rb_str_format): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-08 15:08:15 +00:00
wanabe 8d33d0a560 * io.c (rb_io_each_codepoint): use cbuf when needs readconv.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-31 14:24:40 +00:00
naruse d5b0c4b1f3 * dln.c, file.c, io.c, signal.c: add __HAIKU__.
patched by Alexander von Gluck [ruby-core:27767]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-25 03:06:06 +00:00
usa ef6e53635a * io.c (rb_io_s_read): close the IO if an exception is raised on
seeking. [ruby-core:27429]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-08 07:47:12 +00:00
mame ae8dc9b722 * vm_eval.c (rb_iterate): pass current block when the argument bl_proc
is NULL.  This behavior can be used to make enumerator faster
  [ruby-dev:39874]

* enumerator.c (enumerator_each): pass current block directly instead
  of trampoline block (enumerator_each_i).

* io.c (argf_each_line, argf_each_byte, argf_each_char): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-20 12:31:26 +00:00
nobu 4d786d21e3 * removed spaces just before tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-26 05:25:08 +00:00
naruse 8f05568afb * io.c (read_all): fix: false negative invalid byte seequence
on reading from pipes. [ruby-dev:39743]
  fix: assigin the variable 'pos' as relative value from recent pos.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-21 07:03:06 +00:00
akr 973841cb73 * io.c (MORE_CHAR_SUSPENDED): renamed from MORE_CHAR_CBUF_FULL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-18 15:47:41 +00:00
akr 4c6eda226a * io.c (fill_cbuf): extracted from more_char.
(io_shift_cbuf): fix memmove condition.
  (read_all): use fill_cbuf directly to avoid ECONV_AFTER_OUTPUT.
  [ruby-dev:39708]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-18 13:02:14 +00:00
naruse 6c2373ea67 * io.c (rb_scan_open_args): move path encoding conversion
for filesystem encoding of Mac OS X.

* file.c (file_path_convert): added for convert encoding
  of file path.

* file.c (rb_get_path_check): add file_path_convert.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-18 02:41:25 +00:00
akr cde9a50b75 * io.c (parse_mode_enc): fix invalid access.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-17 22:52:02 +00:00
wanabe 98cf9c43fa * io.c (read_all): shift read buffer if exception occured.
pointed out in [ruby-dev:39702].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-16 05:06:16 +00:00
wanabe d8a754cc12 * io.c (read_all): don't call io_shift_cbuf until bufffering enough or
econv_finished.   [ruby-dev:39696]

* io.c (more_char): don't call clear_readconv to read buffer after
  econv_finished.

* io.c (appendline, rb_io_each_codepoint): clear readconv when done.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-15 23:11:26 +00:00
akr b9e0294eda fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 17:46:28 +00:00
matz 0580ba0611 * array.c (rb_ary_to_ary): do not use #respond_to? to detect
to_ary.  Just call.  [ruby-core:23738]

* eval.c (rb_check_funcall): new function with method existence
  check.  returns Qundef when the method does not exist.

* enumerator.c (enumerator_rewind): just call method, using
  rb_check_funcall().  [ruby-core:23738]

* error.c (exc_equal): ditto.

* object.c (convert_type): ditto.

* error.c (rb_name_err_mesg_new): export function.

* eval.c (make_exception): ditto.

* io.c (pop_last_hash): return early when the last argument is nil.

* io.c (rb_io_puts): treat T_STRING specially for small
  optimization. 

* vm_eval.c (raise_method_missing): skip method call if possible
  using rb_method_basic_definition_p().

* vm_eval.c (method_missing): ditto.

* test/ruby/test_rubyoptions.rb (TestRubyOptions#test_debug): test
  suites changed to ignore exceptions caused by just-call policy.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-29 04:55:10 +00:00