* io.c (rb_io_getline_fast, rb_io_getline): increase lineno

when met the delimiter or EOF.  fixed: [ruby-dev:30081]

* io.c (prepare_getline_args, rb_io_getline_1): split
  preparation of arguments and reading.  [ruby-dev:30085]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-01-06 09:47:19 +00:00
parent 387b3e8970
commit 0ad41807a5
2 changed files with 182 additions and 146 deletions

166
ChangeLog
View File

@ -1,12 +1,20 @@
Sat Jan 6 18:46:34 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (rb_io_getline_fast, rb_io_getline): increase lineno
when met the delimiter or EOF. fixed: [ruby-dev:30081]
* io.c (prepare_getline_args, rb_io_getline_1): split
preparation of arguments and reading. [ruby-dev:30085]
Sat Jan 6 13:48:36 2007 Koichi Sasada <ko1@atdot.net> Sat Jan 6 13:48:36 2007 Koichi Sasada <ko1@atdot.net>
* insns.def (send) : fix to optimize send() with Symbol. * insns.def (send): fix to optimize send() with Symbol.
* yarvtest/test_method.rb : add another test. * yarvtest/test_method.rb: add another test.
Sat Jan 6 13:43:55 2007 Koichi Sasada <ko1@atdot.net> Sat Jan 6 13:43:55 2007 Koichi Sasada <ko1@atdot.net>
* common.mk : add PHONY dependency to some rules * common.mk: add PHONY dependency to some rules
Sat Jan 6 11:50:33 2007 Yukihiro Matsumoto <matz@ruby-lang.org> Sat Jan 6 11:50:33 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
@ -14,22 +22,22 @@ Sat Jan 6 11:50:33 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
Sat Jan 6 09:10:52 2007 Koichi Sasada <ko1@atdot.net> Sat Jan 6 09:10:52 2007 Koichi Sasada <ko1@atdot.net>
* insns.def : support direct method dispatch with "send" or "funcall". * insns.def: support direct method dispatch with "send" or "funcall".
This means that "obj.send :m" skips "BasicObject#send" invocation This means that "obj.send :m" skips "BasicObject#send" invocation
(method frame creation, etc) and "obj.m" invokes directly. (method frame creation, etc) and "obj.m" invokes directly.
If you make backtrace, there are no enties of "send" method. If you make backtrace, there are no enties of "send" method.
* compile.c (iseq_specialized_instruction) : fix to support above * compile.c (iseq_specialized_instruction): fix to support above
* eval.c : ditto (remove "static" from rb_f_send and rb_f_funcall * eval.c: ditto (remove "static" from rb_f_send and rb_f_funcall
* yarvcore.c : ditto (add a external IDs for compiler) * yarvcore.c: ditto (add a external IDs for compiler)
* yarvcore.h : ditto (add a VM_CALL_SEND_BIT macro) * yarvcore.h: ditto (add a VM_CALL_SEND_BIT macro)
* yarvtest/test_method.rb : add tests for above changes * yarvtest/test_method.rb: add tests for above changes
* eval.c : remove unused "Kernel#send" declaration * eval.c: remove unused "Kernel#send" declaration
Sat Jan 6 08:29:17 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp> Sat Jan 6 08:29:17 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
@ -40,78 +48,78 @@ Sat Jan 6 08:29:17 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
Sat Jan 6 03:49:22 2007 Koichi Sasada <ko1@atdot.net> Sat Jan 6 03:49:22 2007 Koichi Sasada <ko1@atdot.net>
* benchmark/run.rb : change option format * benchmark/run.rb: change option format
* common.mk : ditto * common.mk: ditto
Fri Jan 5 22:21:08 2007 Koichi Sasada <ko1@atdot.net> Fri Jan 5 22:21:08 2007 Koichi Sasada <ko1@atdot.net>
* benchmark/bm_app_pentomino.rb : use Array#dup instead of * benchmark/bm_app_pentomino.rb: use Array#dup instead of
Array#clone Array#clone
* benchmark/bmx_temp.rb : removed * benchmark/bmx_temp.rb: removed
* benchmark/run.rb : use run.rb instead of run_rite.rb * benchmark/run.rb: use run.rb instead of run_rite.rb
* common.mk : ditto * common.mk: ditto
* benchmark/run_rite.rb : removed * benchmark/run_rite.rb: removed
* common.mk : use $(srcdir)/test.rb to run a test program * common.mk: use $(srcdir)/test.rb to run a test program
with "make run" with "make run"
* benchmark/bmx_temp.rb : removed and * benchmark/bmx_temp.rb: removed and
set svn:ignore (bmx_*.rb) to benchmark/ set svn:ignore (bmx_*.rb) to benchmark/
* test.rb : set svn:ignore * test.rb: set svn:ignore
Fri Jan 5 21:03:08 2007 Koichi Sasada <ko1@atdot.net> Fri Jan 5 21:03:08 2007 Koichi Sasada <ko1@atdot.net>
* yarvtest/yarvtest.rb : fix to compare results * yarvtest/yarvtest.rb: fix to compare results
Fri Jan 5 20:52:56 2007 Koichi Sasada <ko1@atdot.net> Fri Jan 5 20:52:56 2007 Koichi Sasada <ko1@atdot.net>
* compile.c, compile.h : add ADD_CALL_RECEIVER() macro. * compile.c, compile.h: add ADD_CALL_RECEIVER() macro.
* insns.def (send) : use GET_SELF() direct if FCALL. * insns.def (send): use GET_SELF() direct if FCALL.
* eval.c (rb_f_send) : check method dispatch type to permit * eval.c (rb_f_send): check method dispatch type to permit
invoking private method when dispatch type is FCALL/VCALL invoking private method when dispatch type is FCALL/VCALL
* insns.def (opt_ltlt) : remove useless statement. * insns.def (opt_ltlt): remove useless statement.
* vm.h : remove unused macros. * vm.h: remove unused macros.
Fri Jan 5 20:50:31 2007 Koichi Sasada <ko1@atdot.net> Fri Jan 5 20:50:31 2007 Koichi Sasada <ko1@atdot.net>
* benchmark/run_rite.rb : fix to use readlines instead of * benchmark/run_rite.rb: fix to use readlines instead of
read(...).lines (because 1.8 doesn't have String#lines). read(...).lines (because 1.8 doesn't have String#lines).
Fri Jan 5 20:28:19 2007 Koichi Sasada <ko1@atdot.net> Fri Jan 5 20:28:19 2007 Koichi Sasada <ko1@atdot.net>
* thread_win32.ci (rb_thread_reset_timer_thread) : * thread_win32.ci (rb_thread_reset_timer_thread):
added ([ruby-dev:30086]). added ([ruby-dev:30086]).
Fri Jan 5 20:20:36 2007 Koichi Sasada <ko1@atdot.net> Fri Jan 5 20:20:36 2007 Koichi Sasada <ko1@atdot.net>
* common.mk : add .SUFFIXES rule * common.mk: add .SUFFIXES rule
Fri Jan 5 15:58:15 2007 Koichi Sasada <ko1@atdot.net> Fri Jan 5 15:58:15 2007 Koichi Sasada <ko1@atdot.net>
* eval_method.h (rb_alias) : fix to check search result * eval_method.h (rb_alias): fix to check search result
Fri Jan 5 13:59:53 2007 Koichi Sasada <ko1@atdot.net> Fri Jan 5 13:59:53 2007 Koichi Sasada <ko1@atdot.net>
* eval_method.h (rb_add_method) : fix to check old_node * eval_method.h (rb_add_method): fix to check old_node
Fri Jan 5 12:03:07 2007 Koichi Sasada <ko1@atdot.net> Fri Jan 5 12:03:07 2007 Koichi Sasada <ko1@atdot.net>
* compile.c (iseq_compile_each, set_block_local_tbl) : * compile.c (iseq_compile_each, set_block_local_tbl):
support NODE_LAMBDA (partly). support NODE_LAMBDA (partly).
* sample/test.rb : restore test of NODE_LAMBDA * sample/test.rb: restore test of NODE_LAMBDA
* test/ruby/test_lambda.rb : ditto * test/ruby/test_lambda.rb: ditto
Fri Jan 5 12:31:23 2007 GOTOU Yuuzou <gotoyuzo@notwork.org> Fri Jan 5 12:31:23 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
@ -119,20 +127,20 @@ Fri Jan 5 12:31:23 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
Thu Jan 4 20:01:29 2007 Koichi Sasada <ko1@atdot.net> Thu Jan 4 20:01:29 2007 Koichi Sasada <ko1@atdot.net>
* common.mk : rename yarv-test-[all/each] to compare-test[/-each]. * common.mk: rename yarv-test-[all/each] to compare-test[/-each].
purpose of "compare-test" rule is to compare ruby (trunk) and purpose of "compare-test" rule is to compare ruby (trunk) and
matzruby (branches/matzruby) binary in miniruby level. MATZRUBY matzruby (branches/matzruby) binary in miniruby level. MATZRUBY
parameter means an path to miniruby of matzruby binary. to do this parameter means an path to miniruby of matzruby binary. to do this
comparison test, you should build matzruby branch. comparison test, you should build matzruby branch.
* yarvtest/yarvtest.rb : fix to use command line option as * yarvtest/yarvtest.rb: fix to use command line option as
command names to be compared. command names to be compared.
* yarvtest/runner.rb : remove a debug output. * yarvtest/runner.rb: remove a debug output.
Thu Jan 4 19:12:27 2007 Koichi Sasada <ko1@atdot.net> Thu Jan 4 19:12:27 2007 Koichi Sasada <ko1@atdot.net>
* common.mk : fix to use test.rb script in build directory. * common.mk: fix to use test.rb script in build directory.
($(srcdir)/test.rb -> test.rb) ($(srcdir)/test.rb -> test.rb)
Thu Jan 4 17:28:05 2007 GOTOU Yuuzou <gotoyuzo@notwork.org> Thu Jan 4 17:28:05 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
@ -142,11 +150,11 @@ Thu Jan 4 17:28:05 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
Thu Jan 4 16:57:14 2007 Koichi Sasada <ko1@atdot.net> Thu Jan 4 16:57:14 2007 Koichi Sasada <ko1@atdot.net>
* yarv_version.h : removed. * yarv_version.h: removed.
* common.mk : remove yarv_version.h from rules * common.mk: remove yarv_version.h from rules
* yarvcore.h (Init_yarvcore) : remove useless constants * yarvcore.h (Init_yarvcore): remove useless constants
Thu Jan 4 17:00:06 2007 GOTOU Yuuzou <gotoyuzo@notwork.org> Thu Jan 4 17:00:06 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
@ -156,20 +164,20 @@ Thu Jan 4 17:00:06 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
Thu Jan 04 13:45:10 2007 Koichi Sasada <ko1@atdot.net> Thu Jan 04 13:45:10 2007 Koichi Sasada <ko1@atdot.net>
* thread_pthread.ci : fix last changes around PTHREAD_STACK_MIN. * thread_pthread.ci: fix last changes around PTHREAD_STACK_MIN.
Thu Jan 04 13:42:47 2007 Koichi Sasada <ko1@atdot.net> Thu Jan 04 13:42:47 2007 Koichi Sasada <ko1@atdot.net>
* common.mk : restore changes. * common.mk: restore changes.
Thu Jan 04 10:33:54 2007 Koichi Sasada <ko1@atdot.net> Thu Jan 04 10:33:54 2007 Koichi Sasada <ko1@atdot.net>
* thread_pthread.ci : fix to skip using PTHREAD_STACK_MIN. * thread_pthread.ci: fix to skip using PTHREAD_STACK_MIN.
[ruby-dev:30063] [ruby-dev:30063]
Thu Jan 04 10:30:11 2007 Koichi Sasada <ko1@atdot.net> Thu Jan 04 10:30:11 2007 Koichi Sasada <ko1@atdot.net>
* benchmark/run_rite.rb (bm) : fix to use lines. * benchmark/run_rite.rb (bm): fix to use lines.
Wed Jan 3 18:49:15 2007 Yukihiro Matsumoto <matz@ruby-lang.org> Wed Jan 3 18:49:15 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
@ -189,13 +197,13 @@ Tue Jan 2 10:29:54 2007 Eric Hodel <drbrain@segment7.net>
Mon Jan 01 08:07:06 2007 Koichi Sasada <ko1@atdot.net> Mon Jan 01 08:07:06 2007 Koichi Sasada <ko1@atdot.net>
* ext/tk/tcltklib.c : fix to compile on YARV * ext/tk/tcltklib.c: fix to compile on YARV
ruby_errinfo -> rb_errinfo(), ruby_errinfo -> rb_errinfo(),
ruby_safe_level -> rb_safe_level(). ruby_safe_level -> rb_safe_level().
Mon Jan 01 07:57:17 2007 Koichi Sasada <ko1@atdot.net> Mon Jan 01 07:57:17 2007 Koichi Sasada <ko1@atdot.net>
* test/drb/test_drbssl.rb : fix to skip drb tests. * test/drb/test_drbssl.rb: fix to skip drb tests.
Mon Jan 1 06:13:11 2007 Eric Hodel <drbrain@segment7.net> Mon Jan 1 06:13:11 2007 Eric Hodel <drbrain@segment7.net>
@ -543,9 +551,9 @@ Mon Nov 6 15:41:55 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
fix on 'itemconfiginfo' method, and modify to make it easy to fix on 'itemconfiginfo' method, and modify to make it easy to
override 'itemconfiginfo' method. override 'itemconfiginfo' method.
* ext/tk/lib/tkextlib/tile/treeview.rb : support Tile 0.7.8. * ext/tk/lib/tkextlib/tile/treeview.rb: support Tile 0.7.8.
* ext/tk/lib/tkextlib/version.rb : [new] add Tk::Tkextlib_RELEASE_DATE * ext/tk/lib/tkextlib/version.rb: [new] add Tk::Tkextlib_RELEASE_DATE
to get the information from scripts. to get the information from scripts.
* ext/tk/lib/tk.rb: load 'tkextlib/version.rb', and update RELEASE_DATE * ext/tk/lib/tk.rb: load 'tkextlib/version.rb', and update RELEASE_DATE
@ -3631,7 +3639,7 @@ Sun Jun 18 20:28:43 2006 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/win32ole.c (ole_propertyput): support * ext/win32ole/win32ole.c (ole_propertyput): support
PROPERTYPUTREF. [ruby-talk:183042] PROPERTYPUTREF. [ruby-talk:183042]
* test/win32ole/test_propertyputref.rb : ditto. * test/win32ole/test_propertyputref.rb: ditto.
Sat Jun 17 23:42:26 2006 Yukihiro Matsumoto <matz@ruby-lang.org> Sat Jun 17 23:42:26 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
@ -4369,13 +4377,13 @@ Tue Apr 4 22:15:41 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
Sat Apr 1 15:11:27 2006 Masaki Suketa <masaki.suketa@nifty.ne.jp> Sat Apr 1 15:11:27 2006 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/win32ole.c :add WIN32OLE_TYPE#inspect, * ext/win32ole/win32ole.c: add WIN32OLE_TYPE#inspect,
WIN32OLE_VARIABLE#inspect WIN32OLE_VARIABLE#inspect
* remove ext/win32ole/tests/testOLEVARIABLE.rb, testOLETYPE.rb * remove ext/win32ole/tests/testOLEVARIABLE.rb, testOLETYPE.rb
testOLETYPELIB.rb. testOLETYPELIB.rb.
* testall.rb :ditto. * testall.rb: ditto.
* add test/win32ole * add test/win32ole
@ -4470,7 +4478,7 @@ Thu Mar 23 00:01:32 2006 K.Kosako <sndgk393 AT ybb.ne.jp>
* re.c (rb_reg_regsub): add back reference by name \k<name> in * re.c (rb_reg_regsub): add back reference by name \k<name> in
replace string. replace string.
* re.h : add regexp argument to rb_reg_regsub(). * re.h: add regexp argument to rb_reg_regsub().
* string.c (rb_str_sub_bang): ditto. * string.c (rb_str_sub_bang): ditto.
@ -4482,7 +4490,7 @@ Tue Mar 21 22:14:01 2006 K.Kosako <sndgk393 AT ybb.ne.jp>
* re.c (match_aref): add String and Symbol argument. [ruby-dev:28448] * re.c (match_aref): add String and Symbol argument. [ruby-dev:28448]
* re.h : add member regexp to RMatch. * re.h: add member regexp to RMatch.
* gc.c (gc_mark_children): add gc_mark() to regexp member. * gc.c (gc_mark_children): add gc_mark() to regexp member.
@ -6157,7 +6165,7 @@ Thu Nov 17 17:40:19 2005 Kouhei Sutou <kou@cozmixng.org>
Thu Nov 17 13:52:00 2005 Kouhei Sutou <kou@cozmixng.org> Thu Nov 17 13:52:00 2005 Kouhei Sutou <kou@cozmixng.org>
* lib/rss/rss.rb : removed needless argument 'prefix'. * lib/rss/rss.rb: removed needless argument 'prefix'.
* lib/rss/parser.rb: ditto. * lib/rss/parser.rb: ditto.
@ -13870,7 +13878,7 @@ Sat Nov 20 05:34:24 2004 NARUSE, Yui <naruse@ruby-lang.org>
Sat Nov 20 01:45:04 2004 WATANABE Hirofumi <eban@ruby-lang.org> Sat Nov 20 01:45:04 2004 WATANABE Hirofumi <eban@ruby-lang.org>
* test/xmlrpc/test_webrick_server.rb : move `requrie "webrick/https"' * test/xmlrpc/test_webrick_server.rb: move `requrie "webrick/https"'
into #setup_http_server method to avoid soap test errors. into #setup_http_server method to avoid soap test errors.
Sat Nov 20 01:37:34 2004 Johan Holmberg <holmberg@iar.se> Sat Nov 20 01:37:34 2004 Johan Holmberg <holmberg@iar.se>
@ -16497,11 +16505,11 @@ Fri Jul 9 14:28:54 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
Fri Jul 9 01:47:08 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> Fri Jul 9 01:47:08 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib : bug fix * ext/tk/lib: bug fix
* ext/tk/lib/tkextlib/itcl : add [incr Tcl] support * ext/tk/lib/tkextlib/itcl: add [incr Tcl] support
* ext/tk/lib/tkextlib/itk : add [incr Tk] support * ext/tk/lib/tkextlib/itk: add [incr Tk] support
* ext/tk/lib/tkextlib/iwidgets : midway point of [incr Widgets] support * ext/tk/lib/tkextlib/iwidgets: midway point of [incr Widgets] support
* ext/tk/sample/tkextlib/iwidgets : very simple examples of * ext/tk/sample/tkextlib/iwidgets: very simple examples of
[incr Widgets] [incr Widgets]
Thu Jul 8 19:27:16 2004 Nobuyoshi Nakada <nobu@ruby-lang.org> Thu Jul 8 19:27:16 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
@ -16532,7 +16540,7 @@ Wed Jul 7 00:48:34 2004 WATANABE Hirofumi <eban@ruby-lang.org>
Tue Jul 6 18:38:45 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> Tue Jul 6 18:38:45 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib : improve framework of developping Tcl/Tk extension * ext/tk/lib: improve framework of developping Tcl/Tk extension
wrappers wrappers
Mon Jul 5 23:56:42 2004 Kouhei Sutou <kou@cozmixng.org> Mon Jul 5 23:56:42 2004 Kouhei Sutou <kou@cozmixng.org>
@ -16657,9 +16665,9 @@ Sat Jul 3 17:19:44 2004 WATANABE Hirofumi <eban@ruby-lang.org>
Thu Jul 1 18:36:08 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> Thu Jul 1 18:36:08 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tcltklib : bug fix * ext/tk/lib/tcltklib: bug fix
* ext/tk/lib/tk : bug fix and add Tcl/Tk extension support libraries * ext/tk/lib/tk: bug fix and add Tcl/Tk extension support libraries
Thu Jul 1 18:31:31 2004 Nobuyoshi Nakada <nobu@ruby-lang.org> Thu Jul 1 18:31:31 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
@ -17478,7 +17486,7 @@ Sun May 9 13:24:24 2004 WATANABE Hirofumi <eban@ruby-lang.org>
Sun May 9 12:34:26 2004 Kazuo Saito <ksaito@uranus.dti.ne.jp> Sun May 9 12:34:26 2004 Kazuo Saito <ksaito@uranus.dti.ne.jp>
* regex.c : removed unused file. * regex.c: removed unused file.
Sat May 8 10:53:30 2004 Yukihiro Matsumoto <matz@ruby-lang.org> Sat May 8 10:53:30 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
@ -22688,10 +22696,10 @@ Wed Nov 5 22:55:16 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tcltklib/README.1st: add the description of '--with-pthread-ext' * ext/tcltklib/README.1st: add the description of '--with-pthread-ext'
* ext/tk/lib/tktext.rb : add TkText#text_copy, text_cut, text_paste * ext/tk/lib/tktext.rb: add TkText#text_copy, text_cut, text_paste
to support Tcl/Tk8.4's tk_textCopy, tk_textCut, tk_textPaste to support Tcl/Tk8.4's tk_textCopy, tk_textCut, tk_textPaste
* ext/tk/lib/tk.rb : add TkMenu#set_focus support Tcl/Tk's * ext/tk/lib/tk.rb: add TkMenu#set_focus support Tcl/Tk's
tk_menuSetFocus tk_menuSetFocus
Wed Nov 5 17:33:45 2003 Yukihiro Matsumoto <matz@ruby-lang.org> Wed Nov 5 17:33:45 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
@ -23260,10 +23268,10 @@ Wed Oct 15 05:05:53 2003 Akinori MUSHA <knu@iDaemons.org>
Wed Oct 15 04:31:51 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> Wed Oct 15 04:31:51 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/sample/demos-en/entry3.rb, ext/tk/sample/demos-jp/entry3.rb : * ext/tk/sample/demos-en/entry3.rb, ext/tk/sample/demos-jp/entry3.rb:
new demo-scripts new demo-scripts
* ext/tk/sample/demos-en/widget, ext/tk/sample/demos-jp/widget : * ext/tk/sample/demos-en/widget, ext/tk/sample/demos-jp/widget:
add entries for 'entry3.rb' add entries for 'entry3.rb'
Wed Oct 15 04:31:47 2003 Akinori MUSHA <knu@iDaemons.org> Wed Oct 15 04:31:47 2003 Akinori MUSHA <knu@iDaemons.org>
@ -24652,7 +24660,7 @@ Sun Sep 7 16:08:28 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tcltklib/tcltklib.c (lib_mainloop_core): fixed signal-trap bug * ext/tcltklib/tcltklib.c (lib_mainloop_core): fixed signal-trap bug
* ext/tk/lib/*.rb : Ruby/Tk works at $SAFE == 4 * ext/tk/lib/*.rb: Ruby/Tk works at $SAFE == 4
Sat Sep 6 02:26:34 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org> Sat Sep 6 02:26:34 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
@ -24871,7 +24879,7 @@ Tue Sep 2 14:02:19 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tcltklib/tcltklib.c (ip_invoke): fixed bug on passing a exception * ext/tcltklib/tcltklib.c (ip_invoke): fixed bug on passing a exception
* ext/tk/lib/{tk.rb, tkcanvas.rb, tkfont.rb, tktext.rb} : * ext/tk/lib/{tk.rb, tkcanvas.rb, tkfont.rb, tktext.rb}:
bug fix and improvement of font control bug fix and improvement of font control
Tue Sep 2 09:51:36 2003 Nobuyoshi Nakada <nobu@ruby-lang.org> Tue Sep 2 09:51:36 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
@ -24972,17 +24980,17 @@ Fri Aug 29 17:30:15 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* process.c: deny handling IDs during evaluating the block given to * process.c: deny handling IDs during evaluating the block given to
the Process::{UID,GID}.switch method the Process::{UID,GID}.switch method
* ext/tcltklib/tcltklib.c : some methods have no effect if on slave-IP * ext/tcltklib/tcltklib.c: some methods have no effect if on slave-IP
* ext/tcltklib/tcltklib.c : can create a interpreter without Tk * ext/tcltklib/tcltklib.c: can create a interpreter without Tk
* ext/tcltklib/tcltklib.c : bug fix on handling exceptions * ext/tcltklib/tcltklib.c: bug fix on handling exceptions
* ext/tcltklib/MANUAL.euc : modify * ext/tcltklib/MANUAL.euc: modify
* ext/tk/lib/tk.rb : freeze some core modules * ext/tk/lib/tk.rb: freeze some core modules
* ext/tk/lib/multi-tk.rb : more secure * ext/tk/lib/multi-tk.rb: more secure
* ext/tk/lib/tk.rb: TkVariable.new(array) --> treat the array as the * ext/tk/lib/tk.rb: TkVariable.new(array) --> treat the array as the
Tk's list Tk's list
@ -24990,9 +24998,9 @@ Fri Aug 29 17:30:15 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk.rb: improve accessibility of TkVariable object * ext/tk/lib/tk.rb: improve accessibility of TkVariable object
* ext/tk/lib/tk.rb, ext/tk/lib/tkfont.rb, ext/tk/lib/tkcanvas.rb, * ext/tk/lib/tk.rb, ext/tk/lib/tkfont.rb, ext/tk/lib/tkcanvas.rb,
ext/tk/lib/tktext.rb : fix bug of font handling ext/tk/lib/tktext.rb: fix bug of font handling
* ext/tk/lib/tkfont.rb TkFont.new() accepts compound fonts * ext/tk/lib/tkfont.rb: TkFont.new() accepts compound fonts
Thu Aug 28 22:07:12 2003 Yukihiro Matsumoto <matz@ruby-lang.org> Thu Aug 28 22:07:12 2003 Yukihiro Matsumoto <matz@ruby-lang.org>

60
io.c
View File

@ -1636,15 +1636,19 @@ static VALUE
rb_io_getline_fast(OpenFile *fptr, unsigned char delim, long limit) rb_io_getline_fast(OpenFile *fptr, unsigned char delim, long limit)
{ {
VALUE str = Qnil; VALUE str = Qnil;
int c; int c, nolimit = 0;
for (;;) { for (;;) {
c = appendline(fptr, delim, &str, &limit); c = appendline(fptr, delim, &str, &limit);
if (c == EOF || c == delim || limit == 0) break; if (c == EOF || c == delim) break;
if (limit == 0) {
nolimit = 1;
break;
}
} }
if (!NIL_P(str)) { if (!NIL_P(str)) {
if (limit != 0) { if (!nolimit) {
fptr->lineno++; fptr->lineno++;
lineno = INT2FIX(fptr->lineno); lineno = INT2FIX(fptr->lineno);
} }
@ -1662,12 +1666,10 @@ rscheck(const char *rsptr, long rslen, VALUE rs)
return 0; return 0;
} }
static VALUE static void
rb_io_getline(int argc, VALUE *argv, VALUE io) prepare_getline_args(int argc, VALUE *argv, VALUE *rsp, long *limit)
{ {
VALUE rs, lim, str = Qnil; VALUE lim, rs;
OpenFile *fptr;
long limit;
if (argc == 0) { if (argc == 0) {
rs = rb_rs; rs = rb_rs;
@ -1687,7 +1689,16 @@ rb_io_getline(int argc, VALUE *argv, VALUE io)
} }
} }
} }
limit = NIL_P(lim) ? 0 : NUM2LONG(lim); *rsp = rs;
*limit = NIL_P(lim) ? -1L : NUM2LONG(lim);
}
static VALUE
rb_io_getline_1(VALUE rs, long limit, VALUE io)
{
VALUE str = Qnil;
OpenFile *fptr;
int nolimit = 0;
GetOpenFile(io, fptr); GetOpenFile(io, fptr);
rb_io_check_readable(fptr); rb_io_check_readable(fptr);
@ -1695,7 +1706,7 @@ rb_io_getline(int argc, VALUE *argv, VALUE io)
str = read_all(fptr, 0, Qnil); str = read_all(fptr, 0, Qnil);
if (RSTRING_LEN(str) == 0) return Qnil; if (RSTRING_LEN(str) == 0) return Qnil;
} }
else if (!NIL_P(lim) && limit == 0) { else if (limit == 0) {
return rb_str_new(0,0); return rb_str_new(0,0);
} }
else if (rs == rb_default_rs) { else if (rs == rb_default_rs) {
@ -1729,7 +1740,10 @@ rb_io_getline(int argc, VALUE *argv, VALUE io)
if (memcmp(RSTRING_PTR(str) + RSTRING_LEN(str) - rslen, if (memcmp(RSTRING_PTR(str) + RSTRING_LEN(str) - rslen,
rsptr, rslen) == 0) break; rsptr, rslen) == 0) break;
} }
if (limit == 0) break; if (limit == 0) {
nolimit = 1;
break;
}
} }
if (rspara) { if (rspara) {
@ -1740,7 +1754,7 @@ rb_io_getline(int argc, VALUE *argv, VALUE io)
} }
if (!NIL_P(str)) { if (!NIL_P(str)) {
if (limit != 0) { if (!nolimit) {
fptr->lineno++; fptr->lineno++;
lineno = INT2FIX(fptr->lineno); lineno = INT2FIX(fptr->lineno);
} }
@ -1750,6 +1764,16 @@ rb_io_getline(int argc, VALUE *argv, VALUE io)
return str; return str;
} }
static VALUE
rb_io_getline(int argc, VALUE *argv, VALUE io)
{
VALUE rs;
long limit;
prepare_getline_args(argc, argv, &rs, &limit);
return rb_io_getline_1(rs, limit, io);
}
VALUE VALUE
rb_io_gets(VALUE io) rb_io_gets(VALUE io)
{ {
@ -1912,10 +1936,12 @@ rb_io_readline(int argc, VALUE *argv, VALUE io)
static VALUE static VALUE
rb_io_readlines(int argc, VALUE *argv, VALUE io) rb_io_readlines(int argc, VALUE *argv, VALUE io)
{ {
VALUE line, ary; VALUE line, ary, rs;
long limit;
prepare_getline_args(argc, argv, &rs, &limit);
ary = rb_ary_new(); ary = rb_ary_new();
while (!NIL_P(line = rb_io_getline(argc, argv, io))) { while (!NIL_P(line = rb_io_getline_1(rs, limit, io))) {
rb_ary_push(ary, line); rb_ary_push(ary, line);
} }
return ary; return ary;
@ -1948,10 +1974,12 @@ rb_io_readlines(int argc, VALUE *argv, VALUE io)
static VALUE static VALUE
rb_io_each_line(int argc, VALUE *argv, VALUE io) rb_io_each_line(int argc, VALUE *argv, VALUE io)
{ {
VALUE str; VALUE str, rs;
long limit;
RETURN_ENUMERATOR(io, argc, argv); RETURN_ENUMERATOR(io, argc, argv);
while (!NIL_P(str = rb_io_getline(argc, argv, io))) { prepare_getline_args(argc, argv, &rs, &limit);
while (!NIL_P(str = rb_io_getline_1(rs, limit, io))) {
rb_yield(str); rb_yield(str);
} }
return io; return io;