Commit graph

61 commits

Author SHA1 Message Date
nobu
449e5c6a5e * ext/stringio/stringio.c (Init_stringio): added readpartial,
read_nonblock and write_nonblock aliases.  [ruby-core:27024]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@29338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-24 16:17:58 +00:00
nahi
f9df459a31 * ext/stringio/stringio.c (strio_getline): fix for "" as separator.
[ruby-dev:34591] (Backport r17739 by Yusuke Endoh from trunk).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@26140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-21 06:33:05 +00:00
knu
24894b3d34 * ext/stringio/stringio.c (StringIO#ungetbyte): New method
backported from 1.9



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-23 12:20:57 +00:00
matz
ecdd96c58d * ext/stringio/stringio.c (strio_ungetc): should allow ungetc at
the top of the buffer.  ref #701

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@20151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-08 08:48:43 +00:00
matz
281d835f89 wrong commit; sorry
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-19 17:26:20 +00:00
matz
ed536836db * lib/mathn.rb (Rational::power2): typo fixed. [ruby-core:17293]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-19 17:22:33 +00:00
nobu
5bcfcce7b4 * ext/stringio/stringio.c (strio_each, strio_readlines): IO#each and
IO#readlines do not affect $_.  [ruby-core:17277]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-16 12:58:41 +00:00
nobu
a7d78dad9f * ext/stringio/stringio.c (strio_readline, strio_each)
(strio_readlines): set lastline.  [ruby-core:17257]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-15 22:14:51 +00:00
nobu
1d0f869ea8 * ext/stringio/stringio.c (strio_sysread): should not raise at empty
read.  a patch from Arthur Schreiber at [ruby-core:17245].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-14 13:52:41 +00:00
mame
f9ac9e2dfc * ext/stringio/stringio.c (strio_init): rewind when reopened.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-11 18:30:10 +00:00
knu
ec161d1c01 Adjust order.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 10:01:31 +00:00
knu
e661670f2c * ext/stringio/stringio.c (strio_each_char, Init_stringio): Add
StringIO#{each_char,chars}.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 09:55:14 +00:00
knu
e37b7b77a8 * ext/stringio/stringio.c (strio_each): Return an enumerator if no
block is given.
  (strio_each_byte): Return an enumerator if no block is given,
  and return self if one is given as the rdoc says.

* io.c (rb_io_each_byte): Fix rdoc.  IO#each_byte returns self,
  not nil.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 09:16:11 +00:00
knu
42187cffa2 Fix a typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 04:50:02 +00:00
knu
af91289477 * ext/stringio/stringio.c (Init_stringio): Define
StringIO#{getbyte,readbyte}.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 04:49:17 +00:00
knu
c94f4df0c5 * ext/stringio/stringio.c (Init_stringio): Define #bytes and
#lines.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 04:27:28 +00:00
nobu
cfea253c0f * ext/stringio/stringio.c (strio_init): separate from strio_initialize
to share with strio_reopen properly.  [ruby-Bugs-13919]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-21 20:19:51 +00:00
nobu
3eb48e993a * ext/stringio/stringio.c (strio_seek): consistent behavior with
IO#seek.  patch by sheepman in [ruby-dev:30710].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-16 07:48:50 +00:00
nobu
41349a4064 * ext/stringio/stringio.c (strio_set_string): disallow nil.
http://www.rubyist.net/~nobu/t/20050811.html#c05


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-08-13 09:36:12 +00:00
nobu
7e04df4e0b * ext/stringio/stringio.c: keep holding string after closed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-08-11 14:29:46 +00:00
nobu
bf1e26cc33 * ext/stringio/stringio.c (strio_getline): suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-04-30 04:11:33 +00:00
nobu
a98287182a * ext/stringio/stringio.c: use right arrows.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-03-15 15:43:29 +00:00
nobu
27c921dfad * ext/stringio/stringio.c: add rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-03-15 14:52:59 +00:00
nobu
1839bc333d * ext/stringio/stringio.c (strio_close, strio_close_read, strio_close_write):
should return nil instead of self as well as IO.  [ruby-dev:25623]

* ext/stringio/stringio.c (strio_extend, strio_putc): fill with zero
  extended portion.  [ruby-dev:25626]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-02-03 14:43:07 +00:00
nobu
c90479e5d3 * ext/stringio/stringio.c (strio_truncate): should MEMZERO an extended
part.  [ruby-dev:25618]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-02-02 14:53:36 +00:00
matz
85b6a42fbe * ext/stringio/stringio.c (strio_set_pos): clear EOF flag.
[ruby-talk:127511]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-01-21 15:08:27 +00:00
nobu
a70f475dbb * ext/stringio/stringio.c (strio_write): insufficiently filled string
being extended when overwriting.  [ruby-core:03836]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-29 07:06:21 +00:00
akr
2964c16f38 String::IO -> StringIO
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-27 13:33:34 +00:00
nobu
1fff70f8b3 * ext/stringio/stringio.c: needs fcntl.h for O_* constants.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-18 02:27:00 +00:00
nobu
61566f4b7c * io.c, rubyio.h (rb_io_modenum_flags): exported.
* ext/stringio/stringio.c (strio_initialize): allow Fixnum as mode as
  well as IO.new does.  [ruby-dev:24896]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-18 01:11:01 +00:00
nobu
549bdb3b0e * ext/stringio/stringio.c (strio_read): position was ignored when a
buffer was passed.  http://www.yo.rim.or.jp/~nov/d/?date=20041116#p03


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-16 07:21:21 +00:00
nobu
b105d85690 * ext/stringio/stringio.c: use FMODE_APPEND.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-06 17:57:19 +00:00
nobu
7b1be71bf0 * ext/stringio/stringio.c (strio_write): zero fill a gap if exsts.
[ruby-dev:24190]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-09-08 09:44:46 +00:00
matz
849bc0234a * eval.c (top_include): include in the wrapped load is done for
the wrapper, not for a singleton class for wrapped main.
  [ruby-dev:23305]

* bignum.c (rb_big_eq): use temporary double variable to save the
  result (internal float register may be bigger than 64 bits, for
  example, 80 bits on x86).  [ruby-dev:23311]

* eval.c (block_pass): should generate unique identifier of the
  pushing block.  [ruby-talk:96363]

* ext/socket/socket.c (make_hostent): fix memory leak, based on
  the patch from HORIKAWA Hisashi <vzw00011@nifty.ne.jp>.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-05 07:45:32 +00:00
akr
9d312f635b * ext/stringio/stringio.c (strio_sysread): StringIO.new.sysread didn't
raise EOFError.

* ext/zlib/zlib.c (gzreader_gets): don't increment lineno when
  gzfile_read_all returns "".


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@5332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-28 11:34:11 +00:00
nobu
6fe8d987ce * ext/stringio/stringio.c (strio_read): clear the buffer argument
when returning nil.  [ruby-dev:22363]

* test/ruby/ut_eof.rb (TestEOF::test_eof_0, TestEOF::test_eof_1):
  add buffer argument tests.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-24 05:23:32 +00:00
nobu
c2b63d249f * ext/stringio/stringio.c (strio_read): never return nil at
unlimited read.  [ruby-dev:22334]

* ext/stringio/stringio.c (strio_read): support second
  argument.  [ruby-dev:22350]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-24 01:29:57 +00:00
nobu
c5d4ee4a39 * ext/stringio/stringio.c (strio_read): set EOF flag at short read.
[ruby-dev:22223], [ruby-dev:22224]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-10 10:29:00 +00:00
nobu
ba18b0c6cb * ext/stringio/stringio.c (strio_read): do not set EOF flag when
requested length is zero.  [ruby-dev:22214]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-10 08:54:56 +00:00
nobu
6395c3b38d * ext/stringio/stringio.c (strio_read): adjust behavior at reading
beyond EOF to IO.  [ruby-dev:22205]

* test/ruby/ut_eof.rb (TestEOF::Seek): test behaviors at reading
  beyond EOF.

* test/ruby/test_file.rb, * test/stringio/test_stringio.rb:
  include TestEOF::Seek test case.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-10 08:16:14 +00:00
nobu
7fbf13f7f2 * ext/stringio/stringio.c (strio_read): follow IO#read.
* test/ruby/ut_eof.rb, test/ruby/test_file.rb, test/ruby/test_pipe.rb,
  test/stringio/test_stringio.rb: add EOF test.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-05 02:54:48 +00:00
nobu
0c15b3a222 * test/stringio/test_stringio.rb: imported from [ruby-dev:21941].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-18 09:23:07 +00:00
nobu
12eee69294 * ext/stringio/stringio.c (strio_read): behave as IO at empty string.
[ruby-dev:21939]

* ext/stringio/stringio.c (strio_getc, strio_getline): set EOF flag.

* ext/stringio/stringio.c (strio_rewind, strio_seek, strio_ungetc):
  clear EOF flag.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-18 09:09:41 +00:00
nobu
4646ba6b2a * ext/stringio/stringio.c (strio_set_string, strio_reopen): check
tainted.

* ext/stringio/stringio.c (strio_copy, strio_ungetc, strio_write,
  strio_putc): add infection.

* ext/stringio/stringio.c (strio_path): just nil.  [ruby-dev:21846]

* ruby.c (proc_options): reserve searched script path in the
  source file name table.  [ruby-list:38765]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-06 01:17:59 +00:00
matz
4699b4afbb * eval.c (rb_thread_atfork): wrong format specifier.
[ruby-dev:21428]

* process.c (pst_inspect): better description.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-09-29 02:44:49 +00:00
matz
dea1baa169 * ext/stringio/stringio.c (strio_gets): only "gets" should set $_.
* ext/stringio/stringio.c (strio_getline): should not set $_ here.

* io.c (argf_to_s): argf.to_s returns "ARGF".

* io.c (set_defout_var, set_deferr_var): make $defout and $deferr
  obsolete.

* io.c (set_input_var, set_output_var): allow $stdin, $stdout,
  $stderr not to be instance of IO.

* io.c (rb_f_readline): forward method to current_file. gets,
  readline, readlines, getc, readchar, tell, seek, pos=, rewind,
  fileno, to_io, eof, each_line, each_byte, binmode, and closed?
  as well.

* io.c (argf_forward): utility function to forward method to
  current_file.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-28 07:31:52 +00:00
nobu
7a1482c3ee * ext/stringio/stringio.c: includes Enumerable as well as IO.
[ruby-talk:77058]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-26 05:14:17 +00:00
matz
7406260aed * eval.c (rb_disable_super, rb_enable_super): deprecate.
* eval.c (thgroup_s_alloc): re-implement group struct.

* eval.c (thgroup_add): add check for enclose and frozen status.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-16 07:11:30 +00:00
michal
4e13d36561 -Wall cleanups (removed unused vars, no 'code has no effect' warnings)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-16 07:38:40 +00:00
nobu
3780ede6ef * ext/curses/curses.c, ext/digest/digest.c, ext/dl/handle.c,
ext/dl/ptr.c, ext/dl/sym.c, ext/gdbm/gdbm.c, ext/iconv/iconv.c,
  ext/stringio/stringio.c, ext/strscan/strscan.c,
  ext/tcltklib/tcltklib.c, ext/win32ole/win32ole.c:
  use rb_define_alloc_func().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-20 11:23:40 +00:00