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

518 Коммитов

Автор SHA1 Сообщение Дата
matz f309847177 io.c (io_encoding_set): typo fixed
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-10 06:44:30 +00:00
matz a4c82312c3 * io.c (io_encoding_set): handle nil for v1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-10 06:42:49 +00:00
matz 76b247202a * io.c (io_encoding_set): IO.pipe("euc-jp", nil) should work as
IO.pipe("euc-jp", nil).  [ruby-dev:33000]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-10 01:54:43 +00:00
matz 81064a7688 * io.c (rb_io_binmode): should not alter encoding. [ruby-dev:32918]
* io.c (io_read_encoding): need not to return ASCII-8BIT for
  binary IO.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-09 17:44:13 +00:00
akr 6cdef2dc7e * $Date$ keyword removed to avoid inclusion of locale dependent
string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 15:49:38 +00:00
akr 8702c4d0d7 update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-05 03:35:13 +00:00
akr 1aaf8b1713 * io.c (io_ungetc): move data in buffer if it is required to store the
argument.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-03 15:40:45 +00:00
nobu 2000bde8e7 * io.c (fptr_finalize): clear errno first. [ruby-talk:284492]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-03 02:29:04 +00:00
nobu 46933426b0 * io.c (rb_io_mode_enc): encoding spec is not allowed in binary mode.
[ruby-dev:32913]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-01 08:50:49 +00:00
akr 32fe1ecdbc comment modified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-29 14:52:32 +00:00
akr fffd379d44 * io.c (io_fflush): don't retry when wbuf modified by other threads.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-29 14:49:11 +00:00
usa b3c2e224d3 * io.c (io_unread): fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-28 18:10:31 +00:00
usa 57bb055c93 * io.c (io_unread): adhoc workaround for non-binary mode of some DOSish
platforms. this is not perfect and safety, but works with most cases.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-28 17:20:24 +00:00
akr fc9cc7440a * io.c (io_fflush): checks wbuf modification by other threads.
not perfect.  it need locks.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-27 05:36:02 +00:00
akr b3e3c8a578 * io.c (io_fflush): check closed fptr after rb_write_internal to avoid
SEGV on MacOS X.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-26 08:33:38 +00:00
matz 3878b30881 * io.c (appendline): move RS comparison to rb_io_getline_1().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 09:52:52 +00:00
matz 72bf77fb30 * io.c (rb_io_external_encoding): should return nil for
pass-through write IO.  [ruby-dev:32740]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 06:44:58 +00:00
akr 9f98c9a9c2 * io.c (appendline): initialize rslen to 1 if rsptr is 0.
rslen should be the length of the delimiter.
  if only delim is given, it should be 1.
  [ruby-dev:32746]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 06:38:00 +00:00
nobu 33a071016b * io.c (io_encoding_set): missing return type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 05:11:59 +00:00
matz 29595e23d7 * io.c (rb_io_s_pipe): now takes up to two arguments. allow its
external/internal encoding by Encoding objects.

* io.c (rb_io_set_encoding): new method to set encoding of the IO.

* io.c (argf_set_encoding): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-24 18:17:35 +00:00
matz a04a812ed0 * include/ruby/encoding.h (rb_enc_left_char_head): new utility macro.
* include/ruby/encoding.h (rb_enc_right_char_head): ditto.

* io.c (appendline): does multibyte RS search in the function.

* io.c (prepare_getline_args): RS may be nil.

* io.c (rb_io_getc): should process character based on external
  encoding, when transcoding required.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-24 16:36:14 +00:00
matz c749064f9f * io.c (appendline): should do multibyte aware RS search.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 19:55:18 +00:00
matz b4f2e2ba07 * io.c (io_enc_str): should preserve default_external encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 19:29:01 +00:00
matz 459ca7f3f0 * io.c (prepare_getline_args): convert RS to external encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 18:12:44 +00:00
matz 7ea8ec5483 * io.c (rb_io_check_readable): should not fill fptr->enc always.
read-write IO (e.g. socket) does not work.  [ruby-dev:32685]

* io.c (io_read_encoding): retrieve reading encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 18:01:16 +00:00
matz 5f9748deb7 * io.c (rb_io_external_encoding): should return the encoding of
the file reading.

* io.c (rb_io_internal_encoding): should return the encoding of
  read string.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 17:38:32 +00:00
matz 648cd42f77 * io.c (rb_f_open): documentation update.
* io.c (rb_io_s_pipe): ditto.

* io.c (io_fwrite): wrong encoding destination.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 17:13:07 +00:00
matz 93444eea15 * io.c (rb_io_s_pipe): allow specifying read-side encoding.
* io.c (io_enc_str): wrong encoding destination.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 16:48:28 +00:00
matz 61ea3fd50d * io.c (open_key_args): IO direct methods (foreach, readlines,
read) now takes keyword argument: encoding, mode, open_args.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 16:02:46 +00:00
matz 2e791ace7f * io.c (rb_io_s_read): encoding argument reverted.
* io.c (mode_enc): independent function to share code.

* io.c (rb_io_internal_encoding): new method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 15:56:41 +00:00
nobu a3c87a7859 * io.c (rb_io_binmode_m): removed C99ism.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 02:01:34 +00:00
akr 5b809a28f8 * include/ruby/encoding.h, encoding.c, re.c, io.c, parse.y, numeric.c,
ruby.c, transcode.c: rename rb_ascii_encoding. to
  rb_ascii8bit_encoding.  rb_ascii_encoding is ambiguous with 
  ASCII-8BIT and US-ASCII.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-22 23:47:18 +00:00
matz e8a71bc853 * io.c (rb_io_mode_enc): do not set encoding unless explicitly
specified.

* io.c (rb_io_check_readable): fill fptr->enc by default_external
  if it's empty.

* io.c (io_enc_str): fptr->enc is always set for reading IO (by
  rb_io_check_readable(fptr)).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-22 17:28:20 +00:00
davidflanagan b83cbb0c7c * io.c, io.h: temporary patch to partially implement transcode-on-read and transcode-on-write
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-22 16:21:09 +00:00
davidflanagan ac42f7adf9 io.c: fix typo in rdoc comment
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 21:10:55 +00:00
matz d7cc14d436 * encoding.c (rb_ascii_encoding): renamed from previous
rb_default_encoding().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 18:55:30 +00:00
matz 2bed2cdc7f * io.c (io_ungetc): avoid buffer relocation, which might cause
serious problem under concurrent situation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 16:54:25 +00:00
ko1 91c6c2c170 * io.c: write() should be in blocking region.
* bootstraptest/test_io.rb, test_knownbug.rb: move a fixed test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 09:43:49 +00:00
matz e48ea0a5f3 * io.c (rb_io_s_read): allow specifying encoding explicitly.
* io.c (rb_io_binmode): specifies encoding to ASCII-8BIT (binary).

* io.c (rb_io_s_read): IO should be in binary mode when offset is
  specified.

* encoding.c (rb_to_encoding): returns default encoding if no
  corresponding encoding found.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 07:02:55 +00:00
akr 0d49e43be2 * io.c (Init_IO): define IO::BINARY even if O_BINARY is not exist.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 05:47:15 +00:00
matz ad47716266 * io.c (rb_io_external_encoding): should fill delayed
initialization for STDIN.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 04:32:53 +00:00
matz 1b27cfcd6c * io.c (rb_io_external_encoding): new method.
* encoding.c (rb_enc_from_encoding): returns Qnil for NULL
  encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 04:26:38 +00:00
matz 74a0c0cc7e * io.c (rb_io_mode_enc): set default external encoding if no
encoding specified explicitly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 03:29:54 +00:00
akr 4cf437519f * regerror.c, string.c, io.c, lib/getoptlong.rb, lib/net/imap.rb,
compile.c, sprintf.c, parse.y, ext/win32ole/win32ole.c,
  ext/tk/sample/demos-en/entry3.rb, ext/tk/lib/tcltk.rb,
  ext/openssl/ossl_bn.c, numeric.c, vm.c,
  benchmark/bm_so_meteor_contest.rb, bignum.c, ruby.c: don't "illegal"
  for non law violation context.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 02:31:11 +00:00
gotoyuzo d86caf3188 * io.c (select_internal): should return original value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-20 16:12:38 +00:00
matz 11f3462fb7 * io.c (rb_f_p): RDoc update. a patch from murphy <murphy AT rubychan.de>.
[ruby-core:14010]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-14 08:38:18 +00:00
matz c3b5279d49 * io.c (rb_io_synchronized): should check if initialized.
[ruby-dev:32585]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-13 17:06:41 +00:00
matz b754d62f72 * io.c (rb_io_getc): use default external encoding if fptr->enc is
not set.  [ruby-dev:32565]

* lib/rubygems/package.rb (Gem::TarReader::Entry::rewind): typo fixed.
  [ruby-dev:32565]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-12 23:58:58 +00:00
matz 0ca7036682 * io.c (read_all): should associate default external encoding.
* io.c (io_read): should NOT associate default external encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-12 23:46:58 +00:00
matz 098ca00175 * io.c (rb_io_mode_enc): allow specifying external encoding in
open mode, e.g. open(path, "r:utf-8").

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-12 13:23:07 +00:00