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

555 Коммитов

Автор SHA1 Сообщение Дата
nobu 890b0352dd * io.c: removed trailing blanks.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-19 15:29:09 +00:00
nobu a130e92582 * io.c (argf_initialize_copy): get rid of segfault.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-19 15:21:15 +00:00
nobu 42522ee2a6 * io.c (argf_tell, argf_seek_m, argf_set_pos, argf_rewind,
argf_fileno, argf_to_io, argf_eofl, argf_getc, argf_getbyte,
  argf_readchar, argf_readbyte, argf_each_line): use receiver.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-19 15:14:01 +00:00
nobu bdfe0b8f18 * io.c (rb_io_putc, rb_io_puts): ouput directly if the reciever is
rb_stdout to get rid of infinite recursion.  [ruby-dev:34059]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-19 14:52:43 +00:00
akr 861219ce4a fix doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-09 01:04:46 +00:00
matz 39787ea14d * numeric.c (fix_to_s): avoid rb_scan_args() when no argument
given. 
* bignum.c (rb_big_to_s): ditto.
* enum.c (enum_first): ditto.
* eval_jump.c (rb_f_catch): ditto.
* io.c (rb_obj_display): ditto.
* class.c (rb_obj_singleton_methods): ditto.
* object.c (rb_class_initialize): ditto.
* random.c (rb_f_srand): ditto.
* range.c (range_step): ditto.
* re.c (rb_reg_s_last_match): ditto.
* string.c (rb_str_to_i): ditto.
* string.c (rb_str_each_line): ditto.
* string.c (rb_str_chomp_bang): ditto.
* string.c (rb_str_sum): ditto.

* string.c (str_modifiable): declare inline.
* string.c (str_independent): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-05 05:22:17 +00:00
naruse 70b55c5dcf * io.c (open_key_args): use rb_io_open_with_args instead of rb_f_open.
[ruby-core:15763]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-04 05:36:08 +00:00
naruse 8ac9b7c2ed * io.c (open_key_args): use rb_io_open instead of rb_f_open.
[ruby-core:15746]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-03 20:34:58 +00:00
nobu 3b5d60c0b1 * io.c (rb_io_ungetc): reduce redundant call.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-02 14:04:02 +00:00
nobu b8a733d0b8 * io.c (struct argf): packed ARGF stuffs.
* ruby.c (proc_options): use ruby_set_inplace_mode().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-01 08:59:04 +00:00
naruse 4c7d380a81 * io.c (read_all, rb_io_getline_fast): encoding is rb_input_encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-01 01:33:17 +00:00
naruse 198e1d074c * io.c (rb_io_getline_fast): scan coderange.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-28 06:30:38 +00:00
nobu 586f727b8c * io.c (rb_io_getline_1): get rid of segfault. [ruby-dev:33938]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-28 02:25:14 +00:00
naruse 343a1504e3 * io.c (read_all): fix if.
* io.c (rb_io_getline_1): move needless set encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-27 20:56:03 +00:00
naruse 4dd9fd71b3 * string.c (rb_str_coderange_scan_restartable): coderange scaning
for partial read.

* io.c (read_all): set coderange when not convert encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-27 15:19:22 +00:00
matz ca22f3e168 * io.c (rb_f_putc): invoke stdout method so that redefining putc
may take effect.   [ruby-talk:291844]

* io.c (rb_f_puts): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-21 07:47:12 +00:00
nobu ce0264b6f5 * io.c (argf_set_encoding): uses current_file after check if next
input is available.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-21 05:49:42 +00:00
nobu 7f2ca5ba7a * io.c (argf_set_encoding): uses current_file after check for next
input.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-21 05:47:12 +00:00
usa f761aacdd8 * io.c (open_key_args): set arg->io even if no options passed.
[ruby-dev:33072]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-20 01:09:21 +00:00
matz 878bbd1199 * io.c (open_key_args): allow specifying both :mode and :encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 07:35:11 +00:00
akr 433fbebfbc * io.c (io_reopen): check STDIN, STDOUT and STDERR mode according to
stdio streams.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-14 12:01:50 +00:00
akr 82b088aa0c * io.c (io_reopen): don't change access mode for stdin, stdout and
stderr.  [ruby-core:15360]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-07 07:40:25 +00:00
nobu 6f4d6b1650 * io.c (rb_io_close_read): replaces fptr with the tied writer if
duplex.

* io.c (rb_io_close_write): unties the tied IO for writing if duplex.
  [ruby-dev:33532]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-30 21:24:24 +00:00
matz d7f5b291be * io.c (open_key_args): allow encoding key to take two encoding
names.  a patch from <rubikitch AT ruby-lang.org>.  [ruby-dev:33540]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-30 17:23:27 +00:00
akr dc36ca0ba5 * io.c (select_internal): fix SEGV by `select [STDIN],nil,[STDIN]'.
fixed by Petr Chromec.
  http://rubyforge.org/tracker/index.php?func=detail&aid=17275&group_id=426&atid=1698


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-30 15:21:40 +00:00
matz 06cd63ce93 * io.c (rb_open_file): should check NUL in path.
<http://www.rubyist.net/~matz/20080125.html#c01>.

* io.c (rb_io_s_popen): ditto.

* io.c (rb_io_reopen): ditto.

* io.c (next_argv): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-28 03:32:27 +00:00
akr fc208c1bd5 * include/ruby/oniguruma.h: precise mbclen API redesigned to avoid
inline functions.
  (onigenc_mbclen_charfound): removed.
  (onigenc_mbclen_needmore): removed.
  (onigenc_mbclen_recover): removed.
  (ONIGENC_MBCLEN_CHARFOUND): removed.
  (ONIGENC_MBCLEN_CHARFOUND_P): defined.
  (ONIGENC_MBCLEN_CHARFOUND_LEN): defined.
  (ONIGENC_MBCLEN_INVALID): removed.
  (ONIGENC_MBCLEN_INVALID_P): defined.
  (ONIGENC_MBCLEN_NEEDMORE): removed.
  (ONIGENC_MBCLEN_NEEDMORE_P): defined.
  (ONIGENC_MBCLEN_NEEDMORE_LEN): defined.
  (ONIGENC_MBC_ENC_LEN): use onigenc_mbclen_approximate.

* regenc.c (onigenc_mbclen_approximate): defined.

* include/ruby/encoding.h (MBCLEN_CHARFOUND): removed.
  (MBCLEN_INVALID): removed.
  (MBCLEN_NEEDMORE): removed.
  (MBCLEN_CHARFOUND_P): defined.
  (MBCLEN_INVALID_P): defined.
  (MBCLEN_NEEDMORE_P): defined.
  (MBCLEN_CHARFOUND_LEN): defined.
  (MBCLEN_NEEDMORE_LEN): defined.

* encoding.c: use new API.

* re.c: ditto.

* string.c: ditto.

* parse.y: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-27 14:27:07 +00:00
akr f4d73e05d4 * io.c (rb_io_getline_fast): don't care ASCII incompatible encoding.
(prepare_getline_args): generate a newline according to IO encoding
  when necessary.
  (rb_io_getline_1): call rb_io_getline_fast only for ASCII
  compatible encoding.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 15:57:32 +00:00
matz 4bcfd50ee7 * io.c (rb_io_getline_fast): the end point of left_char_head()
must be the last character.  [ruby-cvs:22445]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-24 07:34:07 +00:00
matz 9580a9ca91 * string.c (rb_str_each_line): use memchr(3) for faster newline
search.

* io.c (appendline): remove unused arguments

* io.c (rb_io_getline_fast): make much simpler (and faster).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-23 18:43:51 +00:00
matz f7929ed206 * io.c (Init_IO): stdin/stdout may not be duplex.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-17 22:21:40 +00:00
matz d765a38bf5 * io.c (io_fwrite): always flush IO on tty, even without newlines.
[ruby-core:15107]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-17 22:20:20 +00:00
nobu 64239e2291 * io.c (rb_io_check_readable): flush tied write IO too.
* io.c (Init_IO): tie stdin with stdout.  [ruby-core:15107]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-17 15:49:33 +00:00
nobu e477c919db * io.c (pipe_open, rb_io_s_popen): clear temporary object to release
and prevent from GC.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-16 09:03:12 +00:00
nobu db26a9b105 * load.c (rb_feature_p): get rid of unlimited alloca.
* object.c (rb_cstr_to_dbl): ditto.

* io.c (mode_enc): fixed uninitialized variable.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-16 06:26:33 +00:00
nobu 2402ecabb0 * file.c (sys_fail2): get rid of unlimited alloca.
* io.c (mode_enc, pipe_open, rb_io_s_popen): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-16 05:55:22 +00:00
matz fa246559d2 * io.c (appendline): specifying limit should not generate broken
byte sequence.  strings should be rounded.  [ruby-dev:33088]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-14 15:07:49 +00:00
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