summaryrefslogtreecommitdiff
path: root/lib/bundler/cli/remove.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/cli/remove.rb')
-rw-r--r--lib/bundler/cli/remove.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/bundler/cli/remove.rb b/lib/bundler/cli/remove.rb
new file mode 100644
index 0000000000..44a4d891dd
--- /dev/null
+++ b/lib/bundler/cli/remove.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+module Bundler
+ class CLI::Remove
+ def initialize(gems, options)
+ @gems = gems
+ @options = options
+ end
+
+ def run
+ raise InvalidOption, "Please specify gems to remove." if @gems.empty?
+
+ Injector.remove(@gems, {})
+ Installer.install(Bundler.root, Bundler.definition)
+ end
+ end
+end
--README.ja6
-rw-r--r--array.c1172
-rw-r--r--bcc32/Makefile.sub66
-rwxr-xr-xbcc32/configure.bat92
-rw-r--r--bcc32/setup.mak78
-rw-r--r--bignum.c272
-rw-r--r--class.c47
-rw-r--r--common.mk96
-rw-r--r--configure.in235
-rw-r--r--defines.h25
-rw-r--r--dir.c15
-rw-r--r--dln.c86
-rw-r--r--enum.c1246
-rw-r--r--enumerator.c450
-rw-r--r--error.c31
-rw-r--r--eval.c806
-rw-r--r--ext/Win32API/lib/win32/registry.rb2
-rw-r--r--ext/Win32API/lib/win32/resolv.rb2
-rw-r--r--ext/bigdecimal/bigdecimal.c59
-rw-r--r--ext/bigdecimal/extconf.rb8
-rw-r--r--ext/dbm/dbm.c2
-rw-r--r--ext/dl/dl.c16
-rw-r--r--ext/dl/ptr.c38
-rw-r--r--ext/dl/sym.c1
-rw-r--r--ext/enumerator/.cvsignore2
-rw-r--r--ext/enumerator/enumerator.c298
-rw-r--r--ext/enumerator/enumerator.txt102
-rw-r--r--ext/enumerator/extconf.rb2
-rw-r--r--ext/etc/etc.c2
-rw-r--r--ext/extmk.rb34
-rw-r--r--ext/iconv/iconv.c59
-rw-r--r--ext/io/wait/wait.c4
-rw-r--r--ext/openssl/extconf.rb5
-rw-r--r--ext/openssl/lib/openssl.rb1
-rw-r--r--ext/openssl/lib/openssl/cipher.rb33
-rw-r--r--ext/openssl/lib/openssl/digest.rb14
-rw-r--r--ext/openssl/lib/openssl/pkcs7.rb25
-rw-r--r--ext/openssl/lib/openssl/ssl.rb90
-rw-r--r--ext/openssl/openssl_missing.c12
-rw-r--r--ext/openssl/openssl_missing.h60
-rw-r--r--ext/openssl/ossl.c32
-rw-r--r--ext/openssl/ossl.h21
-rw-r--r--ext/openssl/ossl_asn1.c60
-rw-r--r--ext/openssl/ossl_bio.c23
-rw-r--r--ext/openssl/ossl_bn.c163
-rw-r--r--ext/openssl/ossl_bn.h5
-rw-r--r--ext/openssl/ossl_cipher.c247
-rw-r--r--ext/openssl/ossl_cipher.h1
-rw-r--r--ext/openssl/ossl_config.c12
-rw-r--r--ext/openssl/ossl_digest.c195
-rw-r--r--ext/openssl/ossl_digest.h1
-rw-r--r--ext/openssl/ossl_engine.c10
-rw-r--r--ext/openssl/ossl_hmac.c68
-rw-r--r--ext/openssl/ossl_ns_spki.c12
-rw-r--r--ext/openssl/ossl_ocsp.c24
-rw-r--r--ext/openssl/ossl_pkcs12.c76
-rw-r--r--ext/openssl/ossl_pkcs12.h1
-rw-r--r--ext/openssl/ossl_pkcs5.c96
-rw-r--r--ext/openssl/ossl_pkcs7.c62
-rw-r--r--ext/openssl/ossl_pkcs7.h1
-rw-r--r--ext/openssl/ossl_pkey.c24
-rw-r--r--ext/openssl/ossl_pkey.h21
-rw-r--r--ext/openssl/ossl_pkey_dh.c101
-rw-r--r--ext/openssl/ossl_pkey_dsa.c92
-rw-r--r--ext/openssl/ossl_pkey_ec.c1582
-rw-r--r--ext/openssl/ossl_pkey_rsa.c119
-rw-r--r--ext/openssl/ossl_rand.c88
-rw-r--r--ext/openssl/ossl_ssl.c645
-rw-r--r--ext/openssl/ossl_ssl.h15
-rw-r--r--ext/openssl/ossl_ssl_session.c298
-rw-r--r--ext/openssl/ossl_x509attr.c36
-rw-r--r--ext/openssl/ossl_x509cert.c109
-rw-r--r--ext/openssl/ossl_x509crl.c16
-rw-r--r--ext/openssl/ossl_x509ext.c24
-rw-r--r--ext/openssl/ossl_x509name.c42
-rw-r--r--ext/openssl/ossl_x509req.c10
-rw-r--r--ext/openssl/ossl_x509revoked.c8
-rw-r--r--ext/openssl/ossl_x509store.c17
-rw-r--r--ext/openssl/ruby_missing.h27
-rw-r--r--ext/pty/expect_sample.rb15
-rw-r--r--ext/pty/lib/expect.rb2
-rw-r--r--ext/pty/pty.c70
-rw-r--r--ext/purelib.rb9
-rw-r--r--ext/readline/readline.c21
-rw-r--r--ext/socket/addrinfo.h5
-rw-r--r--ext/socket/socket.c111
-rw-r--r--ext/stringio/stringio.c63
-rw-r--r--ext/syck/rubyext.c16
-rw-r--r--ext/syslog/syslog.c3
-rw-r--r--ext/syslog/syslog.txt5
-rw-r--r--ext/thread/thread.c29
-rw-r--r--ext/tk/ChangeLog.tkextlib6
-rw-r--r--ext/tk/MANUAL_tcltklib.eng24
-rw-r--r--ext/tk/MANUAL_tcltklib.eucj22
-rw-r--r--ext/tk/README.1st13
-rw-r--r--ext/tk/README.tcltklib20
-rw-r--r--ext/tk/extconf.rb166
-rw-r--r--ext/tk/lib/multi-tk.rb200
-rw-r--r--ext/tk/lib/tcltk.rb2
-rw-r--r--ext/tk/lib/tk.rb1226
-rw-r--r--ext/tk/lib/tk/autoload.rb358
-rw-r--r--ext/tk/lib/tk/bindtag.rb83
-rw-r--r--ext/tk/lib/tk/button.rb5
-rw-r--r--ext/tk/lib/tk/canvas.rb54
-rw-r--r--ext/tk/lib/tk/canvastag.rb117
-rw-r--r--ext/tk/lib/tk/checkbutton.rb9
-rw-r--r--ext/tk/lib/tk/composite.rb70
-rw-r--r--ext/tk/lib/tk/encodedstr.rb84
-rw-r--r--ext/tk/lib/tk/entry.rb6
-rw-r--r--ext/tk/lib/tk/event.rb62
-rw-r--r--ext/tk/lib/tk/font.rb732
-rw-r--r--ext/tk/lib/tk/frame.rb5
-rw-r--r--ext/tk/lib/tk/grid.rb49
-rw-r--r--ext/tk/lib/tk/image.rb62
-rw-r--r--ext/tk/lib/tk/itemconfig.rb164
-rw-r--r--ext/tk/lib/tk/itemfont.rb33
-rw-r--r--ext/tk/lib/tk/label.rb5
-rw-r--r--ext/tk/lib/tk/labelframe.rb8
-rw-r--r--ext/tk/lib/tk/listbox.rb5
-rw-r--r--ext/tk/lib/tk/macpkg.rb9
-rw-r--r--ext/tk/lib/tk/menu.rb91
-rw-r--r--ext/tk/lib/tk/menubar.rb2
-rw-r--r--ext/tk/lib/tk/menuspec.rb26
-rw-r--r--ext/tk/lib/tk/message.rb5
-rw-r--r--ext/tk/lib/tk/msgcat.rb6
-rw-r--r--ext/tk/lib/tk/namespace.rb149
-rw-r--r--ext/tk/lib/tk/optiondb.rb16
-rw-r--r--ext/tk/lib/tk/pack.rb17
-rw-r--r--ext/tk/lib/tk/package.rb4
-rw-r--r--ext/tk/lib/tk/palette.rb2
-rw-r--r--ext/tk/lib/tk/panedwindow.rb32
-rw-r--r--ext/tk/lib/tk/radiobutton.rb9
-rw-r--r--ext/tk/lib/tk/root.rb37
-rw-r--r--ext/tk/lib/tk/scale.rb33
-rw-r--r--ext/tk/lib/tk/scrollbar.rb65
-rw-r--r--ext/tk/lib/tk/scrollbox.rb7
-rw-r--r--ext/tk/lib/tk/spinbox.rb24
-rw-r--r--ext/tk/lib/tk/text.rb178
-rw-r--r--ext/tk/lib/tk/textimage.rb14
-rw-r--r--ext/tk/lib/tk/textmark.rb102
-rw-r--r--ext/tk/lib/tk/texttag.rb113
-rw-r--r--ext/tk/lib/tk/textwindow.rb13
-rw-r--r--ext/tk/lib/tk/timer.rb55
-rw-r--r--ext/tk/lib/tk/toplevel.rb13
-rw-r--r--ext/tk/lib/tk/ttk_selector.rb76
-rw-r--r--ext/tk/lib/tk/validation.rb25
-rw-r--r--ext/tk/lib/tk/variable.rb488
-rw-r--r--ext/tk/lib/tk/virtevent.rb77
-rw-r--r--ext/tk/lib/tk/winpkg.rb18
-rw-r--r--ext/tk/lib/tk/wm.rb476
-rw-r--r--ext/tk/lib/tkextlib/SUPPORT_STATUS2
-rw-r--r--ext/tk/lib/tkextlib/blt/bitmap.rb21
-rw-r--r--ext/tk/lib/tkextlib/blt/busy.rb2
-rw-r--r--ext/tk/lib/tkextlib/blt/component.rb452
-rw-r--r--ext/tk/lib/tkextlib/blt/dragdrop.rb54
-rw-r--r--ext/tk/lib/tkextlib/blt/eps.rb2
-rw-r--r--ext/tk/lib/tkextlib/blt/htext.rb1
-rw-r--r--ext/tk/lib/tkextlib/blt/table.rb17
-rw-r--r--ext/tk/lib/tkextlib/blt/tabset.rb81
-rw-r--r--ext/tk/lib/tkextlib/blt/ted.rb9
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/button.rb2
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/checkbutton.rb2
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/frame.rb2
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/label.rb2
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/radiobutton.rb2
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/scrollbar.rb2
-rw-r--r--ext/tk/lib/tkextlib/blt/tile/toplevel.rb2
-rw-r--r--ext/tk/lib/tkextlib/blt/tree.rb341
-rw-r--r--ext/tk/lib/tkextlib/blt/treeview.rb228
-rw-r--r--ext/tk/lib/tkextlib/blt/unix_dnd.rb16
-rw-r--r--ext/tk/lib/tkextlib/blt/vector.rb37
-rw-r--r--ext/tk/lib/tkextlib/blt/watch.rb47
-rw-r--r--ext/tk/lib/tkextlib/bwidget/button.rb2
-rw-r--r--ext/tk/lib/tkextlib/bwidget/buttonbox.rb20
-rw-r--r--ext/tk/lib/tkextlib/bwidget/combobox.rb8
-rw-r--r--ext/tk/lib/tkextlib/bwidget/dialog.rb33
-rw-r--r--ext/tk/lib/tkextlib/bwidget/dynamichelp.rb7
-rw-r--r--ext/tk/lib/tkextlib/bwidget/entry.rb2
-rw-r--r--ext/tk/lib/tkextlib/bwidget/label.rb2
-rw-r--r--ext/tk/lib/tkextlib/bwidget/labelentry.rb2
-rw-r--r--ext/tk/lib/tkextlib/bwidget/labelframe.rb8
-rw-r--r--ext/tk/lib/tkextlib/bwidget/listbox.rb37
-rw-r--r--ext/tk/lib/tkextlib/bwidget/mainframe.rb48
-rw-r--r--ext/tk/lib/tkextlib/bwidget/messagedlg.rb16
-rw-r--r--ext/tk/lib/tkextlib/bwidget/notebook.rb24
-rw-r--r--ext/tk/lib/tkextlib/bwidget/pagesmanager.rb16
-rw-r--r--ext/tk/lib/tkextlib/bwidget/panedwindow.rb8
-rw-r--r--ext/tk/lib/tkextlib/bwidget/panelframe.rb8
-rw-r--r--ext/tk/lib/tkextlib/bwidget/progressdlg.rb4
-rw-r--r--ext/tk/lib/tkextlib/bwidget/scrollableframe.rb8
-rw-r--r--ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb8
-rw-r--r--ext/tk/lib/tkextlib/bwidget/selectcolor.rb28
-rw-r--r--ext/tk/lib/tkextlib/bwidget/selectfont.rb7
-rw-r--r--ext/tk/lib/tkextlib/bwidget/spinbox.rb2
-rw-r--r--ext/tk/lib/tkextlib/bwidget/statusbar.rb8
-rw-r--r--ext/tk/lib/tkextlib/bwidget/titleframe.rb8
-rw-r--r--ext/tk/lib/tkextlib/bwidget/tree.rb37
-rw-r--r--ext/tk/lib/tkextlib/bwidget/widget.rb20
-rw-r--r--ext/tk/lib/tkextlib/itcl/incr_tcl.rb12
-rw-r--r--ext/tk/lib/tkextlib/itk/incr_tk.rb44
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/buttonbox.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/calendar.rb19
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/checkbox.rb21
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/dialogshell.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/entryfield.rb19
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/hierarchy.rb58
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/menubar.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/messagebox.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/notebook.rb16
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/panedwindow.rb5
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/radiobox.rb16
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb12
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb2
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb30
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/selectionbox.rb2
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/selectiondialog.rb2
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/spinner.rb19
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb21
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/tabset.rb49
-rw-r--r--ext/tk/lib/tkextlib/tcllib/autoscroll.rb2
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ctext.rb2
-rw-r--r--ext/tk/lib/tkextlib/tcllib/datefield.rb2
-rw-r--r--ext/tk/lib/tkextlib/tcllib/getstring.rb5
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ico.rb6
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ip_entry.rb2
-rw-r--r--ext/tk/lib/tkextlib/tcllib/plotchart.rb77
-rw-r--r--ext/tk/lib/tkextlib/tcllib/swaplist.rb5
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tablelist_core.rb16
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tkpiechart.rb14
-rw-r--r--ext/tk/lib/tkextlib/tile.rb257
-rw-r--r--ext/tk/lib/tkextlib/tile/dialog.rb14
-rw-r--r--ext/tk/lib/tkextlib/tile/sizegrip.rb4
-rw-r--r--ext/tk/lib/tkextlib/tile/style.rb239
-rw-r--r--ext/tk/lib/tkextlib/tile/tbutton.rb7
-rw-r--r--ext/tk/lib/tkextlib/tile/tcheckbutton.rb8
-rw-r--r--ext/tk/lib/tkextlib/tile/tcombobox.rb3
-rw-r--r--ext/tk/lib/tkextlib/tile/tentry.rb12
-rw-r--r--ext/tk/lib/tkextlib/tile/tframe.rb7
-rw-r--r--ext/tk/lib/tkextlib/tile/tlabel.rb7
-rw-r--r--ext/tk/lib/tkextlib/tile/tlabelframe.rb8
-rw-r--r--ext/tk/lib/tkextlib/tile/tmenubutton.rb12
-rw-r--r--ext/tk/lib/tkextlib/tile/tnotebook.rb31
-rw-r--r--ext/tk/lib/tkextlib/tile/tpaned.rb55
-rw-r--r--ext/tk/lib/tkextlib/tile/tprogressbar.rb3
-rw-r--r--ext/tk/lib/tkextlib/tile/tradiobutton.rb8
-rw-r--r--ext/tk/lib/tkextlib/tile/treeview.rb193
-rw-r--r--ext/tk/lib/tkextlib/tile/tscale.rb7
-rw-r--r--ext/tk/lib/tkextlib/tile/tscrollbar.rb28
-rw-r--r--ext/tk/lib/tkextlib/tile/tseparator.rb3
-rw-r--r--ext/tk/lib/tkextlib/tkDND/shape.rb32
-rw-r--r--ext/tk/lib/tkextlib/tkDND/tkdnd.rb18
-rw-r--r--ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb17
-rw-r--r--ext/tk/lib/tkextlib/tktable/tktable.rb188
-rw-r--r--ext/tk/lib/tkextlib/tktrans/tktrans.rb4
-rw-r--r--ext/tk/lib/tkextlib/treectrl/tktreectrl.rb300
-rw-r--r--ext/tk/lib/tkextlib/version.rb2
-rw-r--r--ext/tk/lib/tkextlib/vu/pie.rb77
-rw-r--r--ext/tk/lib/tkextlib/vu/spinbox.rb2
-rw-r--r--ext/tk/lib/tkextlib/winico/winico.rb57
-rw-r--r--ext/tk/sample/binstr_usage.rb12
-rw-r--r--ext/tk/sample/demos-en/anilabel.rb10
-rw-r--r--ext/tk/sample/demos-en/aniwave.rb9
-rw-r--r--ext/tk/sample/demos-en/arrow.rb26
-rw-r--r--ext/tk/sample/demos-en/bind.rb33
-rw-r--r--ext/tk/sample/demos-en/bitmap.rb10
-rw-r--r--ext/tk/sample/demos-en/button.rb2
-rw-r--r--ext/tk/sample/demos-en/check.rb14
-rw-r--r--ext/tk/sample/demos-en/check2.rb14
-rw-r--r--ext/tk/sample/demos-en/clrpick.rb22
-rw-r--r--ext/tk/sample/demos-en/colors.rb18
-rw-r--r--ext/tk/sample/demos-en/combo.rb96
-rw-r--r--ext/tk/sample/demos-en/cscroll.rb14
-rw-r--r--ext/tk/sample/demos-en/ctext.rb53
-rw-r--r--ext/tk/sample/demos-en/entry1.rb12
-rw-r--r--ext/tk/sample/demos-en/entry2.rb8
-rw-r--r--ext/tk/sample/demos-en/entry3.rb50
-rw-r--r--ext/tk/sample/demos-en/filebox.rb17
-rw-r--r--ext/tk/sample/demos-en/floor.rb14
-rw-r--r--ext/tk/sample/demos-en/floor2.rb14
-rw-r--r--ext/tk/sample/demos-en/form.rb8
-rw-r--r--ext/tk/sample/demos-en/goldberg.rb23
-rw-r--r--ext/tk/sample/demos-en/hello6
-rw-r--r--ext/tk/sample/demos-en/hscale.rb29
-rw-r--r--ext/tk/sample/demos-en/icon.rb20
-rw-r--r--ext/tk/sample/demos-en/image1.rb13
-rw-r--r--ext/tk/sample/demos-en/image2.rb22
-rw-r--r--ext/tk/sample/demos-en/image3.rb29
-rw-r--r--ext/tk/sample/demos-en/items.rb17
-rw-r--r--ext/tk/sample/demos-en/knightstour.rb271
-rw-r--r--ext/tk/sample/demos-en/label.rb13
-rw-r--r--ext/tk/sample/demos-en/labelframe.rb8
-rw-r--r--ext/tk/sample/demos-en/mclist.rb117
-rw-r--r--ext/tk/sample/demos-en/menu.rb12
-rw-r--r--ext/tk/sample/demos-en/menu84.rb8
-rw-r--r--ext/tk/sample/demos-en/menubu.rb10
-rw-r--r--ext/tk/sample/demos-en/msgbox.rb10
-rw-r--r--ext/tk/sample/demos-en/msgbox2.rb91
-rw-r--r--ext/tk/sample/demos-en/paned1.rb14
-rw-r--r--ext/tk/sample/demos-en/paned2.rb8
-rw-r--r--ext/tk/sample/demos-en/patch_1.1c193
-rw-r--r--ext/tk/sample/demos-en/pendulum.rb43
-rw-r--r--ext/tk/sample/demos-en/plot.rb8
-rw-r--r--ext/tk/sample/demos-en/puzzle.rb32
-rw-r--r--ext/tk/sample/demos-en/radio.rb12
-rw-r--r--ext/tk/sample/demos-en/radio2.rb17
-rw-r--r--ext/tk/sample/demos-en/radio3.rb19
-rw-r--r--ext/tk/sample/demos-en/rolodex-j323
-rw-r--r--ext/tk/sample/demos-en/ruler.rb8
-rw-r--r--ext/tk/sample/demos-en/sayings.rb8
-rw-r--r--ext/tk/sample/demos-en/search.rb19
-rw-r--r--ext/tk/sample/demos-en/spin.rb12
-rw-r--r--ext/tk/sample/demos-en/states.rb8
-rw-r--r--ext/tk/sample/demos-en/style.rb42
-rw-r--r--ext/tk/sample/demos-en/text.rb8
-rw-r--r--ext/tk/sample/demos-en/textpeer.rb76
-rw-r--r--ext/tk/sample/demos-en/toolbar.rb130
-rw-r--r--ext/tk/sample/demos-en/tree.rb119
-rw-r--r--ext/tk/sample/demos-en/ttkbut.rb139
-rw-r--r--ext/tk/sample/demos-en/ttkmenu.rb85
-rw-r--r--ext/tk/sample/demos-en/ttknote.rb89
-rw-r--r--ext/tk/sample/demos-en/ttkpane.rb213
-rw-r--r--ext/tk/sample/demos-en/ttkprogress.rb66
-rw-r--r--ext/tk/sample/demos-en/twind.rb14
-rw-r--r--ext/tk/sample/demos-en/twind2.rb6
-rw-r--r--ext/tk/sample/demos-en/unicodeout.rb14
-rw-r--r--ext/tk/sample/demos-en/vscale.rb29
-rw-r--r--ext/tk/sample/demos-en/widget232
-rw-r--r--ext/tk/sample/demos-jp/anilabel.rb11
-rw-r--r--ext/tk/sample/demos-jp/aniwave.rb10
-rw-r--r--ext/tk/sample/demos-jp/arrow.rb27
-rw-r--r--ext/tk/sample/demos-jp/bind.rb34
-rw-r--r--ext/tk/sample/demos-jp/bitmap.rb11
-rw-r--r--ext/tk/sample/demos-jp/button.rb4
-rw-r--r--ext/tk/sample/demos-jp/check.rb15
-rw-r--r--ext/tk/sample/demos-jp/check2.rb15
-rw-r--r--ext/tk/sample/demos-jp/clrpick.rb21
-rw-r--r--ext/tk/sample/demos-jp/colors.rb19
-rw-r--r--ext/tk/sample/demos-jp/combo.rb98
-rw-r--r--ext/tk/sample/demos-jp/cscroll.rb15
-rw-r--r--ext/tk/sample/demos-jp/ctext.rb54
-rw-r--r--ext/tk/sample/demos-jp/dialog1.rb1
-rw-r--r--ext/tk/sample/demos-jp/dialog2.rb1
-rw-r--r--ext/tk/sample/demos-jp/entry1.rb13
-rw-r--r--ext/tk/sample/demos-jp/entry2.rb9
-rw-r--r--ext/tk/sample/demos-jp/entry3.rb49
-rw-r--r--ext/tk/sample/demos-jp/filebox.rb18
-rw-r--r--ext/tk/sample/demos-jp/floor.rb15
-rw-r--r--ext/tk/sample/demos-jp/floor2.rb15
-rw-r--r--ext/tk/sample/demos-jp/form.rb9
-rw-r--r--ext/tk/sample/demos-jp/goldberg.rb24
-rw-r--r--ext/tk/sample/demos-jp/hello1
-rw-r--r--ext/tk/sample/demos-jp/hscale.rb29
-rw-r--r--ext/tk/sample/demos-jp/icon.rb21
-rw-r--r--ext/tk/sample/demos-jp/image1.rb14
-rw-r--r--ext/tk/sample/demos-jp/image2.rb24
-rw-r--r--ext/tk/sample/demos-jp/image3.rb18
-rw-r--r--ext/tk/sample/demos-jp/items.rb18
-rw-r--r--ext/tk/sample/demos-jp/ixset21
-rw-r--r--ext/tk/sample/demos-jp/knightstour.rb273
-rw-r--r--ext/tk/sample/demos-jp/label.rb14
-rw-r--r--ext/tk/sample/demos-jp/labelframe.rb10
-rw-r--r--ext/tk/sample/demos-jp/mclist.rb121
-rw-r--r--ext/tk/sample/demos-jp/menu.rb15
-rw-r--r--ext/tk/sample/demos-jp/menu84.rb9
-rw-r--r--ext/tk/sample/demos-jp/menu8x.rb13
-rw-r--r--ext/tk/sample/demos-jp/menubu.rb11
-rw-r--r--ext/tk/sample/demos-jp/msgbox.rb15
-rw-r--r--ext/tk/sample/demos-jp/msgbox2.rb90
-rw-r--r--ext/tk/sample/demos-jp/paned1.rb16
-rw-r--r--ext/tk/sample/demos-jp/paned2.rb10
-rw-r--r--ext/tk/sample/demos-jp/pendulum.rb44
-rw-r--r--ext/tk/sample/demos-jp/plot.rb15
-rw-r--r--ext/tk/sample/demos-jp/puzzle.rb33
-rw-r--r--ext/tk/sample/demos-jp/radio.rb13
-rw-r--r--ext/tk/sample/demos-jp/radio2.rb19
-rw-r--r--ext/tk/sample/demos-jp/radio3.rb21
-rw-r--r--ext/tk/sample/demos-jp/rolodex-j1
-rw-r--r--ext/tk/sample/demos-jp/ruler.rb9
-rw-r--r--ext/tk/sample/demos-jp/sayings.rb9
-rw-r--r--ext/tk/sample/demos-jp/search.rb20
-rw-r--r--ext/tk/sample/demos-jp/spin.rb16
-rw-r--r--ext/tk/sample/demos-jp/states.rb9
-rw-r--r--ext/tk/sample/demos-jp/style.rb42
-rw-r--r--ext/tk/sample/demos-jp/tcolor1
-rw-r--r--ext/tk/sample/demos-jp/text.rb9
-rw-r--r--ext/tk/sample/demos-jp/textpeer.rb82
-rw-r--r--ext/tk/sample/demos-jp/toolbar.rb136
-rw-r--r--ext/tk/sample/demos-jp/tree.rb120
-rw-r--r--ext/tk/sample/demos-jp/ttkbut.rb145
-rw-r--r--ext/tk/sample/demos-jp/ttkmenu.rb91
-rw-r--r--ext/tk/sample/demos-jp/ttknote.rb97
-rw-r--r--ext/tk/sample/demos-jp/ttkpane.rb216
-rw-r--r--ext/tk/sample/demos-jp/ttkprogress.rb71
-rw-r--r--ext/tk/sample/demos-jp/twind.rb13
-rw-r--r--ext/tk/sample/demos-jp/twind2.rb7
-rw-r--r--ext/tk/sample/demos-jp/unicodeout.rb16
-rw-r--r--ext/tk/sample/demos-jp/vscale.rb30
-rw-r--r--ext/tk/sample/demos-jp/widget278
-rw-r--r--ext/tk/sample/encstr_usage.rb5
-rw-r--r--ext/tk/sample/figmemo_sample.rb456
-rw-r--r--ext/tk/sample/irbtkw.rbw24
-rw-r--r--ext/tk/sample/tcltklib/sample2.rb2
-rw-r--r--ext/tk/sample/tkextlib/tile/demo.rb39
-rw-r--r--ext/tk/sample/tkextlib/tile/themes/blue/pkgIndex.tcl2
-rw-r--r--ext/tk/sample/tkextlib/tile/themes/kroc.rb30
-rw-r--r--ext/tk/sample/tkextlib/treectrl/demo.rb7
-rw-r--r--ext/tk/sample/tkextlib/vu/canvSticker2.rb12
-rw-r--r--ext/tk/sample/tkrttimer.rb13
-rw-r--r--ext/tk/sample/tksleep_sample.rb29
-rw-r--r--ext/tk/sample/tktextio.rb12
-rw-r--r--ext/tk/sample/ttk_wrapper.rb154
-rw-r--r--ext/tk/stubs.c78
-rw-r--r--ext/tk/tcltklib.c2692
-rw-r--r--ext/tk/tkutil/extconf.rb2
-rw-r--r--ext/tk/tkutil/tkutil.c708
-rw-r--r--ext/win32ole/tests/testOLEEVENT.rb91
-rw-r--r--ext/win32ole/tests/testWIN32OLE.rb3
-rw-r--r--ext/win32ole/tests/test_win32ole_event.rb133
-rw-r--r--ext/win32ole/tests/testall.rb1
-rw-r--r--ext/win32ole/win32ole.c188
-rw-r--r--ext/zlib/extconf.rb4
-rw-r--r--ext/zlib/zlib.c15
-rw-r--r--file.c152
-rw-r--r--gc.c136
-rw-r--r--hash.c518
-rw-r--r--inits.c2
-rwxr-xr-xinstruby.rb176
-rw-r--r--intern.h28
-rw-r--r--io.c411
-rw-r--r--keywords2
-rw-r--r--lex.c2
-rw-r--r--lib/README4
-rw-r--r--lib/benchmark.rb9
-rw-r--r--lib/cgi.rb19
-rw-r--r--lib/cgi/session.rb28
-rw-r--r--lib/cgi/session/pstore.rb2
-rw-r--r--lib/complex.rb32
-rw-r--r--lib/date.rb171
-rw-r--r--lib/date/format.rb386
-rw-r--r--lib/delegate.rb48
-rw-r--r--lib/drb/drb.rb25
-rw-r--r--lib/drb/extservm.rb41
-rw-r--r--lib/erb.rb304
-rw-r--r--lib/forwardable.rb2
-rw-r--r--lib/generator.rb38
-rw-r--r--lib/ipaddr.rb146
-rw-r--r--lib/irb.rb18
-rw-r--r--lib/irb/extend-command.rb2
-rw-r--r--lib/irb/help.rb2
-rw-r--r--lib/irb/notifier.rb2
-rw-r--r--lib/irb/ruby-lex.rb2
-rw-r--r--lib/irb/slex.rb2
-rw-r--r--lib/logger.rb2
-rw-r--r--lib/matrix.rb18
-rw-r--r--lib/mkmf.rb327
-rw-r--r--lib/net/ftp.rb11
-rw-r--r--lib/net/https.rb4
-rw-r--r--lib/net/imap.rb6
-rw-r--r--lib/net/pop.rb230
-rw-r--r--lib/net/protocol.rb4
-rw-r--r--lib/net/smtp.rb635
-rw-r--r--lib/net/telnet.rb20
-rw-r--r--lib/open-uri.rb2
-rw-r--r--lib/optparse.rb15
-rw-r--r--lib/pp.rb13
-rw-r--r--lib/pstore.rb4
-rw-r--r--lib/rational.rb78
-rw-r--r--lib/rdoc/options.rb2
-rw-r--r--lib/rdoc/parsers/parse_c.rb8
-rw-r--r--lib/rdoc/parsers/parse_f95.rb8
-rw-r--r--lib/rdoc/parsers/parse_rb.rb8
-rw-r--r--lib/rdoc/ri/ri_options.rb34
-rw-r--r--lib/rdoc/ri/ri_paths.rb27
-rw-r--r--lib/resolv-replace.rb3
-rw-r--r--lib/resolv.rb1244
-rw-r--r--lib/rexml/attlistdecl.rb2
-rw-r--r--lib/rexml/document.rb2
-rw-r--r--lib/rexml/element.rb6
-rw-r--r--lib/rexml/formatters/pretty.rb2
-rw-r--r--lib/rexml/functions.rb2
-rw-r--r--lib/rexml/node.rb2
-rw-r--r--lib/rexml/text.rb2
-rw-r--r--lib/rexml/xpath.rb2
-rw-r--r--lib/rinda/ring.rb4
-rw-r--r--lib/rinda/tuplespace.rb100
-rw-r--r--lib/rss.rb7
-rw-r--r--lib/rss/0.9.rb22
-rw-r--r--lib/rss/1.0.rb13
-rw-r--r--lib/rss/2.0.rb2
-rw-r--r--lib/rss/atom.rb749
-rw-r--r--lib/rss/content.rb25
-rw-r--r--lib/rss/content/1.0.rb10
-rw-r--r--lib/rss/content/2.0.rb12
-rw-r--r--lib/rss/converter.rb8
-rw-r--r--lib/rss/dublincore.rb39
-rw-r--r--lib/rss/dublincore/1.0.rb13
-rw-r--r--lib/rss/dublincore/2.0.rb13
-rw-r--r--lib/rss/dublincore/atom.rb17
-rw-r--r--lib/rss/image.rb10
-rw-r--r--lib/rss/itunes.rb410
-rw-r--r--lib/rss/maker.rb25
-rw-r--r--lib/rss/maker/0.9.rb375
-rw-r--r--lib/rss/maker/1.0.rb332
-rw-r--r--lib/rss/maker/2.0.rb147
-rw-r--r--lib/rss/maker/atom.rb172
-rw-r--r--lib/rss/maker/base.rb844
-rw-r--r--lib/rss/maker/content.rb14
-rw-r--r--lib/rss/maker/dublincore.rb145
-rw-r--r--lib/rss/maker/entry.rb163
-rw-r--r--lib/rss/maker/feed.rb429
-rw-r--r--lib/rss/maker/image.rb116
-rw-r--r--lib/rss/maker/itunes.rb242
-rw-r--r--lib/rss/maker/slash.rb33
-rw-r--r--lib/rss/maker/syndication.rb13
-rw-r--r--lib/rss/maker/taxonomy.rb118
-rw-r--r--lib/rss/maker/trackback.rb115
-rw-r--r--lib/rss/parser.rb167
-rw-r--r--lib/rss/rss.rb735
-rw-r--r--lib/rss/slash.rb49
-rw-r--r--lib/rss/syndication.rb9
-rw-r--r--lib/rss/taxonomy.rb2
-rw-r--r--lib/rss/utils.rb78
-rw-r--r--lib/rss/xml-stylesheet.rb4
-rw-r--r--lib/rss/xml.rb71
-rw-r--r--lib/securerandom.rb137
-rw-r--r--lib/set.rb48
-rw-r--r--lib/shellwords.rb146
-rw-r--r--lib/singleton.rb61
-rw-r--r--lib/tempfile.rb26
-rw-r--r--lib/time.rb18
-rw-r--r--lib/timeout.rb23
-rw-r--r--lib/tmpdir.rb104
-rw-r--r--lib/uri.rb1
-rw-r--r--lib/uri/ftp.rb86
-rw-r--r--lib/uri/generic.rb107
-rw-r--r--lib/uri/ldaps.rb12
-rw-r--r--lib/webrick/httpproxy.rb2
-rw-r--r--lib/webrick/httpresponse.rb2
-rw-r--r--lib/webrick/httpservlet/cgihandler.rb4
-rw-r--r--lib/webrick/httputils.rb16
-rw-r--r--lib/xmlrpc/client.rb10
-rw-r--r--lib/yaml.rb4
-rw-r--r--lib/yaml/baseemitter.rb2
-rw-r--r--lib/yaml/basenode.rb2
-rw-r--r--lib/yaml/encoding.rb6
-rw-r--r--lib/yaml/rubytypes.rb20
-rw-r--r--lib/yaml/store.rb20
-rw-r--r--lib/yaml/types.rb8
-rw-r--r--marshal.c65
-rw-r--r--math.c4
-rw-r--r--misc/README3
-rw-r--r--misc/rdebug.el136
-rw-r--r--misc/ruby-mode.el37
-rw-r--r--misc/ruby-style.el66
-rw-r--r--missing.h2
-rw-r--r--missing/crypt.c34
-rw-r--r--missing/vsnprintf.c2
-rwxr-xr-xmkconfig.rb6
-rw-r--r--node.h16
-rw-r--r--numeric.c467
-rw-r--r--object.c102
-rw-r--r--pack.c30
-rw-r--r--parse.y190
-rw-r--r--process.c45
-rw-r--r--random.c20
-rw-r--r--range.c96
-rw-r--r--re.c147
-rw-r--r--regex.c60
-rw-r--r--regex.h4
-rw-r--r--ruby.c94
-rw-r--r--ruby.h27
-rw-r--r--rubyio.h25
-rw-r--r--rubysig.h8
-rwxr-xr-xrunruby.rb14
-rw-r--r--sample/README3
-rw-r--r--sample/cal.rb84
-rw-r--r--sample/cbreak.rb4
-rw-r--r--sample/dualstack-httpd.rb2
-rw-r--r--sample/erb/erb4html.rb60
-rw-r--r--sample/eval.rb2
-rw-r--r--sample/from.rb2
-rw-r--r--sample/goodfriday.rb48
-rw-r--r--sample/philos.rb2
-rw-r--r--sample/regx.rb2
-rwxr-xr-xsample/rss/blend.rb6
-rwxr-xr-xsample/rss/convert.rb2
-rwxr-xr-x[-rw-r--r--]sample/rss/list_description.rb13
-rwxr-xr-xsample/rss/re_read.rb10
-rwxr-xr-x[-rw-r--r--]sample/rss/rss_recent.rb20
-rw-r--r--sample/test.rb64
-rw-r--r--sample/time.rb16
-rw-r--r--signal.c64
-rw-r--r--sprintf.c17
-rw-r--r--string.c468
-rw-r--r--struct.c28
-rw-r--r--test/drb/drbtest.rb2
-rw-r--r--test/erb/hello.erb4
-rw-r--r--test/erb/test_erb.rb386
-rw-r--r--test/gdbm/test_gdbm.rb4
-rw-r--r--test/iconv/test_basic.rb49
-rw-r--r--test/iconv/test_option.rb31
-rw-r--r--test/iconv/test_partial.rb41
-rw-r--r--test/iconv/utils.rb26
-rw-r--r--test/net/http/test_https_proxy.rb9
-rw-r--r--test/openssl/test_ec.rb113
-rw-r--r--test/openssl/test_ssl.rb348
-rw-r--r--test/pathname/test_pathname.rb26
-rw-r--r--test/rinda/test_rinda.rb97
-rw-r--r--test/rss/dot.pngbin0 -> 111 bytes-rw-r--r--test/rss/rss-assertions.rb1894
-rw-r--r--test/rss/rss-testcase.rb199
-rw-r--r--test/rss/test_1.0.rb61
-rw-r--r--test/rss/test_2.0.rb28
-rw-r--r--test/rss/test_atom.rb681
-rw-r--r--test/rss/test_content.rb68
-rw-r--r--test/rss/test_dublincore.rb316
-rw-r--r--test/rss/test_image.rb22
-rw-r--r--test/rss/test_inherit.rb5
-rw-r--r--test/rss/test_itunes.rb347
-rw-r--r--test/rss/test_maker_0.9.rb147
-rw-r--r--test/rss/test_maker_1.0.rb205
-rw-r--r--test/rss/test_maker_2.0.rb56
-rw-r--r--test/rss/test_maker_atom_entry.rb367
-rw-r--r--test/rss/test_maker_atom_feed.rb389
-rw-r--r--test/rss/test_maker_content.rb13
-rw-r--r--test/rss/test_maker_dc.rb9
-rw-r--r--test/rss/test_maker_itunes.rb471
-rw-r--r--test/rss/test_maker_slash.rb37
-rw-r--r--test/rss/test_maker_sy.rb1
-rw-r--r--test/rss/test_maker_xml-stylesheet.rb8
-rw-r--r--test/rss/test_parser.rb26
-rw-r--r--test/rss/test_parser_1.0.rb1
-rw-r--r--test/rss/test_parser_atom_entry.rb163
-rw-r--r--test/rss/test_parser_atom_feed.rb276
-rw-r--r--test/rss/test_setup_maker_0.9.rb25
-rw-r--r--test/rss/test_setup_maker_1.0.rb26
-rw-r--r--test/rss/test_setup_maker_atom_entry.rb409
-rw-r--r--test/rss/test_setup_maker_atom_feed.rb445
-rw-r--r--test/rss/test_setup_maker_itunes.rb144
-rw-r--r--test/rss/test_setup_maker_slash.rb38
-rw-r--r--test/rss/test_slash.rb64
-rw-r--r--test/rss/test_syndication.rb4
-rw-r--r--test/rss/test_to_s.rb232
-rw-r--r--test/rss/test_version.rb2
-rw-r--r--test/rss/test_xml-stylesheet.rb6
-rw-r--r--test/ruby/test_array.rb1159
-rw-r--r--test/ruby/test_beginendblock.rb18
-rw-r--r--test/ruby/test_bignum.rb19
-rw-r--r--test/ruby/test_enum.rb258
-rw-r--r--test/ruby/test_enumerator.rb105
-rw-r--r--test/ruby/test_fixnum.rb26
-rw-r--r--test/ruby/test_float.rb34
-rw-r--r--test/ruby/test_hash.rb3
-rw-r--r--test/ruby/test_integer.rb653
-rw-r--r--test/ruby/test_method.rb18
-rw-r--r--test/ruby/test_proc.rb5
-rw-r--r--test/ruby/test_settracefunc.rb6
-rw-r--r--test/ruby/test_sleep.rb10
-rw-r--r--test/ruby/test_symbol.rb15
-rw-r--r--test/ruby/test_time.rb21
-rw-r--r--test/thread/test_thread.rb38
-rw-r--r--test/uri/test_common.rb5
-rw-r--r--test/uri/test_ftp.rb22
-rw-r--r--test/uri/test_generic.rb80
-rw-r--r--[-rwxr-xr-x]test/webrick/webrick_long_filename.cgi0
-rw-r--r--test/xmlrpc/test_cookie.rb96
-rw-r--r--test/yaml/test_yaml.rb8
-rw-r--r--test/yaml/test_yamlstore.rb74
-rw-r--r--time.c17
-rw-r--r--util.c3444
-rw-r--r--variable.c90
-rw-r--r--version.c31
-rw-r--r--version.h32
-rw-r--r--win32/Makefile.sub221
-rwxr-xr-xwin32/resource.rb8
-rw-r--r--win32/setup.mak17
-rw-r--r--win32/win32.c352
-rw-r--r--win32/win32.h25
-rw-r--r--wince/Makefile.sub489
-rw-r--r--wince/mkconfig_wce.rb7
-rw-r--r--wince/mkexports.rb35
-rw-r--r--wince/resource.rb96
688 files changed, 53857 insertions, 11906 deletions
diff --git a/ChangeLog b/ChangeLog
index 5b07909608..6432869b78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,46 +1,2694 @@
-Wed Jun 11 15:00:55 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jan 9 19:25:25 2009 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (disconnect): do not refer SSL::SSLSocket for
+ environments without OpenSSL. backported from trunk.
+ fixed [ruby-dev:35755].
+
+Thu Jan 8 13:24:23 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (deferred_nodes, compstmt, arg, fixup_nodes, range_op): fix
+ up fixnum range literal in conditional as automagical line number
+ comparison. [ruby-core:12124], [ruby-dev:35731]
+
+Wed Jan 7 10:09:46 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (timeofday): use monotonic clock. based on a patch
+ from zimbatm <zimbatm@oree.ch> in [ruby-core:16627].
+
+Tue Jan 6 09:03:35 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (yylex): 8 and 9 in octal integer should cause compile
+ error. [ruby-dev:35729]
+
+Mon Jan 5 11:14:39 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_thread_schedule): runs deferred finalizers.
+
+ * gc.c (gc_sweep): sets rb_thread_pending to run deferred finalizers.
+
+ * rubysig.h (CHECK_INTS): now checks rb_thread_pending even on
+ platforms where setitimer is not available. [ruby-core:18045]
+
+Mon Jan 5 11:14:39 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * rubysig.h (CHECK_INTS): gives the chance to perform to deferred
+ finalizers before explicit GC.start or the process termination.
+ [ruby-core:18045]
+
+Sun Jan 4 04:49:01 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_telldir): just returns loc.
+
+ * win32/win32.c (rb_w32_rewinddir): needs to intialize loc.
+ [ruby-core:18041]
+
+Sun Jan 4 04:45:26 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_select): recalc the rest of timeout for each
+ iterations. [ruby-core:18015]
+
+Fri Jan 2 03:08:47 2009 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rss/: use PNG instead of zlib as binary data. [ruby-dev:35666]
+
+Tue Nov 11 01:07:32 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * configure.in: fix SEGV on Mac OS X 10.5.3 with --enable-pthread.
+ a patch from Wataru Kimura in Bug #193 [ruby-core:17333].
+
+Mon Aug 11 09:37:17 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/dl/dl.c (rb_str_to_ptr): should propagate taint to dlptr.
+
+ * ext/dl/dl.c (rb_ary_to_ptr): ditto.
+
+ * ext/dl/sym.c (rb_dlsym_call): should check taint of DLPtrData as
+ well.
+
+Fri Aug 8 10:53:52 2008 Tanaka Akira <akr@fsij.org>
+
+ * lib/resolv.rb: randomize source port and transaction id.
+ CVE-2008-1447.
+
+ * lib/resolv-replace.rb (UDPSocket#bind): don't resolv host if host is
+ "".
+
+Mon Aug 4 14:49:35 2008 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * lib/net/smtp.rb (Net::SMTP::rcptto): fix a typo. a patch from
+ Masao Takaku <masao at nii.ac.jp>
+ fix [ruby-dev:35489].
+
+Mon Aug 4 14:13:15 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * regex.c (xmalloc, xrealloc, xfree): not to use ruby managed memory.
+
+ * regex.c (DOUBLE_STACK, re_compile_fastmap0, re_adjust_startpos),
+ (re_search, re_match_exec): check if failed to allocate memory.
+
+Mon Aug 4 13:53:42 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big2str0, bigsqr): made interruptible. [ruby-Bugs-20622]
+
+Mon Aug 4 13:31:41 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * numeric.c (check_uint, rb_num2uint, rb_fix2uint): fixed wrong check
+ about 64bit positive value.
+Mon Aug 4 13:31:41 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * numeric.c (check_uint, rb_num2uint, rb_fix2uint): strict check.
+ fixed [ruby-dev:33683]
+
+Thu Jul 17 21:42:07 2008 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * lib/net/smtp.rb (Net::SMTP::start): revert to avoid RFC2821
+ violation. [ruby-dev:35487]
+
+Thu Jul 17 21:32:49 2008 Tanaka Akira <akr@fsij.org>
+
+ * string.c (rb_str_format_m): make tmp volatile to avoid possible GC
+ problem.
+
+Thu Jul 17 21:30:55 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser#environment): requires shellwords.
+ [ruby-dev:35466]
+
+Thu Jul 17 02:05:10 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/xmlrpc/client.rb (XMLRPC::Client#do_rpc): requires
+ webrick/cookie. [ ruby-Bugs-21139 ]
+
+Thu Jul 17 01:38:31 2008 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * ext/zlib/zlib.c (rb_gzfile_set_mtime): fix typo. [ruby-core:17713]
+
+Sun Jul 13 00:08:16 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/ipaddr.rb (IPAddr#initialize): get rid of ArgumentError in
+ IPAddr#to_range. a patch from okkez <okkez000 AT gmail.com> in
+ [ruby-dev:35091].
+
+Sun Jul 13 00:04:38 2008 Tanaka Akira <akr@fsij.org>
+
+ * configure.in (erfc): erfc of glibc comes with Debian GNU/Linux Etch
+ on IA64 is broken. erfc(10000.0) aborts.
+ use missing/erf.c instead.
+ http://sources.redhat.com/ml/libc-hacker/2005-08/msg00008.html
+
+Thu Jul 10 18:50:48 2008 Tanaka Akira <akr@fsij.org>
+
+ * common.mk (SPEC_GIT_BASE): update RubySpec GIT URL.
+
+Thu Jul 10 18:46:28 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_file_s_extname): fix for file name with spaces.
+ [ruby-talk:307404]
+
+Thu Jul 10 18:42:37 2008 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/erb.rb (PercentScanner#scan): fix %% line bug. [ruby-core:17491]
+
+ * test/erb/test_erb.rb (test_percent): ditto.
+
+Thu Jul 10 18:40:22 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/net/ftp.rb (Net::FTP#sendport): use divmod. [ruby-core:17557]
+
+Thu Jul 10 18:36:53 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * ruby.c: Mac OS X needs origargc times of '\0' in
+ origargv. [ruby-dev:35308]
+
+Thu Jul 10 13:53:08 2008 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/ruby.h (POSFIXABLE): use FIXNUM_MAX+1 instead of
+ FIXNUM_MAX to make it possible to convert to double accurately.
+ It assumes FLT_RADIX is 2.
+ fix RubyForge bug #14102.
+ backported from 1.9.
+
+Mon Jul 7 16:21:38 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/net/smtp.rb (Net::SMTP::start): use 'localhost' instead of
+ 'localhost.localdomain'. [ruby-dev:35333]
+
+ * lib/net/smtp.rb (Net::SMTP::SMTP.start): ditto.
+
+Mon Jul 7 15:02:13 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_longjmp): duplicate the thrown exception to set backtrace
+ if it was frozen. clear all raised flags.
+
+ * eval.c (stack_check): leave clearing flag to rb_longjmp.
+
+ * eval.c (rb_thread_set_raised, rb_thread_reset_raised): use generic
+ flags.
+
+ * eval.c (Init_Proc), gc.c (Init_GC): freeze preallocated special exceptions.
+
+ * gc.c (rb_memerror): use thread raised flag instead of static flag,
+ and raise nomem_error without backtrace if failed to make backtrace.
+ [ruby-dev:34724]
+
+ * gc.c (ruby_xmalloc): increase malloc_increase only if malloc
+ succeeds. failed malloc size can be huge. it may increase
+ malloc_limit too big which cause less GC and memory full.
+ (ruby_xrealloc): ditto.
+
+Mon Jul 7 12:23:05 2008 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c: avoid creating Ruby object during
+ GC. thanks to arton <artonx AT yahoo.co.jp>. [ruby-dev:35313]
+
+ * ext/win32ole/tests: add test_win32ole_event.rb, remove
+ testOLEEVENT.rb
+
+ * ext/win32ole/tests/testWIN32OLE.rb(test_convert_bignum):
+ fix test.
+
+Mon Jul 7 12:23:05 2008 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * gc.c: add rb_during_gc(). based on a patch from arton <artonx AT
+ yahoo.co.jp> at [ruby-dev:35313].
+
+ * intern.h: ditto.
+
+Thu Jul 3 20:13:20 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c (w_object, marshal_dump, r_object0, marshal_load): search
+ public methods only. [ruby-core:17283]
+
+ * object.c (convert_type): ditto.
+
+ * lib/singleton.rb (Singleton#_dump): conversion method should be
+ public.
+
+Wed Jul 2 19:06:43 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/cgi.rb (CGI::QueryExtension.read_multipart): blanks inside
+ double quotes are allowed. [ruby-list:45140]
+
+Wed Jul 2 19:03:37 2008 Tanaka Akira <akr@fsij.org>
+
+ * numeric.c (num_coerce): call rb_Float(x) first. don't depend on
+ evaluation order of function arguments.
+
+Wed Jul 2 18:57:19 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/syslog/syslog.c (syslog_write): syslog operations should be
+ protected from $SAFE level 4. a patch from Keita Yamaguchi
+ <keita.yamaguchi at gmail.com>.
+
+ * ext/syslog/syslog.c (mSyslog_close): ditto.
+
+ * ext/syslog/syslog.c (mSyslog_set_mask): ditto.
+
+Wed Jul 2 18:26:20 2008 Tanaka Akira <akr@fsij.org>
+
+ * math.c (domain_check): fix preprocess condition.
+
+Wed Jul 2 18:22:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/tmpdir.rb (@@systmpdir): prior LOCAL_APPDATA if possible, and
+ should be clean. based on a patch from arton <artonx AT
+ yahoo.co.jp> at [ruby-dev:35269]
+
+Wed Jul 2 18:16:19 2008 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c (date2time_str): fix the overflow in
+ some situation. [ruby-bugs-20793]
+
+Tue Jul 1 15:11:14 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_fill): check if beg is too big.
+
+Mon Jun 30 20:35:32 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (str_buf_cat): check for self concatenation.
+
+Sun Jun 29 21:39:54 2008 Tanaka Akira <akr@fsij.org>
+
+ * eval.c (rb_obj_respond_to): use RTEST to test the result of
+ respond_to? method.
+
+Sun Jun 29 21:20:17 2008 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * array.c (rb_ary_fill): (compatibility) do not raise
+ ArgumentError on negative length. This behaviour shall change
+ in a future release.
+
+Sun Jun 29 20:08:11 2008 Tanaka Akira <akr@fsij.org>
+
+ * time.c (time_timeval): fix rounding negative float.
+
+Sun Jun 29 19:19:08 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/inlinetest.rb (InlineTest.in_progname): workaround for frozen
+ $0. [ruby-dev:35261]
+
+ * lib/test/unit/ui/console/testrunner.rb (TestRunner#finished): ditto.
+
+Sun Jun 29 19:19:08 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ruby.c (set_arg0, ruby_prog_init): freeze $0. a patch from Keita
+ Yamaguchi <keita.yamaguchi at gmail.com>.
+
+Sun Jun 29 18:33:33 2008 Tanaka Akira <akr@fsij.org>
+
+ * process.c: include sys/resource.h if HAVE_SYS_RESOURCE_H is defined.
+ pointed by TOYOFUKU Chikanobu. [ruby-dev:35258]
+
+Sun Jun 29 18:26:01 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_f_trace_var): should not be allowed at safe level 4.
+ a patch from Keita Yamaguchi <keita.yamaguchi at gmail.com>.
+
+ * eval.c (rb_call0): wrong condition to check insecure method.
+ a patch from Keita Yamaguchi <keita.yamaguchi at gmail.com>.
+
+Sun Jun 29 18:22:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_fill): not depend on unspecified behavior at integer
+ overflow. reported by Vincenzo Iozzo <snagg AT openssl.it>.
+
+Sun Jun 29 18:22:06 2008 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c(ole_invoke): fix memory leak.
+ [ruby-bugs-20792]
+
+Sun Jun 29 18:19:11 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (PUSH_FRAME, PUSH_CLASS): Add volatile to avoid a
+ possible optimization bug on OS X/PPC. This at least makes
+ build with gcc -O1 and `make test' pass.
+
+Sun Jun 29 17:24:43 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/rdoc/parsers/parse_rb.rb (RDoc#collect_first_comment): skip
+ magic comment.
+
+Sun Jun 29 17:22:09 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_each, strio_readlines): IO#each and
+ IO#readlines do not affect $_. [ruby-core:17277]
+
+Sun Jun 29 17:19:59 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_readline, strio_each)
+ (strio_readlines): set lastline. [ruby-core:17257]
+
+Sun Jun 29 17:15:49 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/openssl/ossl.h: include winsock.h if USE_WINSOCK2 is not defined.
+ a patch from arton <artonx at yahoo.co.jp> in [ruby-dev:35078]
+
+Sun Jun 29 17:09:48 2008 wanabe <s.wanabe@gmail.com>
+
+ * util.c (ruby_strtod): ruby_strtod don't allow a trailing
+ decimal point like "7.". [ruby-dev:34835] [ruby-dev:35009]
+
+Sat Jun 28 19:23:40 2008 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * class.c (clone_method): use rb_copy_node_scope.
+ fixed [ruby-list:45102]
+ fixed [ruby-core:17393]
+
+Sat Jun 28 18:49:50 2008 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * class.c: revert to r15855.
+
+Fri Jun 20 18:25:18 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_buf_append): should infect.
+
+Fri Jun 20 16:33:09 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_store, rb_ary_splice): not depend on unspecified
+ behavior at integer overflow.
+
+ * string.c (str_buf_cat): ditto.
+
+Wed Jun 18 22:24:46 2008 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * array.c (ary_new, rb_ary_initialize, rb_ary_store,
+ rb_ary_aplice, rb_ary_times): integer overflows should be
+ checked. based on patches from Drew Yao <ayao at apple.com>
+ fixed CVE-2008-2726
+
+ * string.c (rb_str_buf_append): fixed unsafe use of alloca,
+ which led memory corruption. based on a patch from Drew Yao
+ <ayao at apple.com> fixed CVE-2008-2726
+
+ * sprintf.c (rb_str_format): backported from trunk.
+
+ * intern.h: ditto.
+
+Tue Jun 17 15:09:46 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (file_expand_path): no need to expand root path which has no
+ short file name. [ruby-dev:35095]
+
+Sun Jun 15 19:27:40 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * configure.in: Fix $LOAD_PATH. Properly expand vendor_ruby
+ directories; submitted by Takahiro Kambe <taca at
+ back-street.net> in [ruby-dev:35099].
+
+Mon Jun 9 17:56:30 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb (Set#delete_if): Call to_a.
+ (SortedSet#delete_if, TC_SortedSet#test_sortedset): Use super to
+ yield elements in sorted order; [ruby-core:17144] by Arthur
+ Schreiber.
+ (SortedSet#each, SortedSet#each, TC_Set#test_each)
+ (TC_SortedSet#test_sortedset): Return self; [ruby-dev:35002] by
+ Arthur Schreiber.
+
+Mon Jun 9 03:28:05 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/zlib/zlib.c (rb_deflate_initialize, Init_zlib): Fix up
+ initialize_copy; [ruby-list:45016], [ruby-list:45018].
+
+Mon Jun 9 03:26:03 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * NEWS: Mention new constants.
+
+Mon Jun 9 03:24:18 2008 Tanaka Akira <akr@fsij.org>
+
+ * hash.c (hash_i): make Hash#hash order insensitive.
+
+Mon Jun 9 03:22:43 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (VENDOR_DIR): use LIBDIR instead of PREFIX as well as
+ SITE_DIR. a patch from Richard Brown <rbrown AT exherbo.org> in
+ [ruby-core:17129].
+
+Mon Jun 9 03:21:20 2008 Tanaka Akira <akr@fsij.org>
+
+ * gc.c (os_obj_of): assure to not free the scanning heap.
+
+Mon Jun 9 03:20:12 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (rb_open_file, rb_io_s_sysopen): fmode should be unsigned int.
+ fixed [ruby-dev:34979]
+
+Fri Jun 6 21:16:55 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub (COMMON_HEADERS): include ws2tcpip.h.
+
+ * ext/socket/addrinfo.h (addrinfo, getaddrinfo, getnameinfo,
+ freehostent, freeaddrinfo): undef before define because these are
+ macros in some versions of Windows SDK.
+
+ * win32/setup.mak: maybe commit miss.
+
+Fri Jun 6 19:34:22 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * mkconfig.rb: hide build path from rbconfig.rb.
+
+ * util.c (ruby_strtod, dtoa): initialize more variables for error
+ handling.
+
+ * io.c (rscheck), marshal.c (w_nbyte, w_bytes, w_unique),
+ (path2class, path2module): constified.
+
+ * pack.c (pack_unpack), process.c (rb_syswait): suppress warnings.
+
+ * suppress warnings on cygwin, mingw and mswin.
+
+Fri Jun 6 19:23:53 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (file_expand_path): fix for non-existent files and SFN of
+ symlinks. [ruby-talk:303736]
+
+Fri Jun 6 18:25:43 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/iconv: Tests fixed.
+
+Fri Jun 6 17:04:56 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * win32/win32.h: include ws2tcpip.h. fixed [ruby-Bugs-20528]
+
+ * lib/time.rb (Time.xmlschema): don't use float. fix
+ http://rubyforge.org/tracker/index.php?func=detail&group_id=426&atid=1698&aid=20504
+
+ * object.c (rb_obj_alloc): RDoc updated. a patch from Gaston
+ Ramos <ramos.gaston at gmail.com> in [ruby-core:17073].
+
+ * lib/rdoc.rb: massive spelling correction patch from Evan Farrar
+ <evanfarrar at gmail.com> in [ruby-doc:1382] applied.
+
+ * ext/openssl/ossl_ssl_session.c (ossl_ssl_session_initialize):
+ Add a null check for ssl; submitted by akira yamada
+ in [ruby-dev:34950].
+
+ * ext/openssl/ossl_ssl.c (Init_ossl_ssl): Define OP_NO_TICKET if
+ SSL_OP_NO_TICKET is present; submitted by akira yamada
+ in [ruby-dev:34944].
+
+ * test/openssl/test_ssl.rb (OpenSSL#test_server_session): Add a
+ workaround for the case where OpenSSL is configured with
+ --enable-tlsext; submitted by akira yamada in [ruby-dev:34944].
+
+Fri Jun 6 16:58:23 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/iconv/iconv.c (iconv_iconv): fix for length argument and now
+ allows range. [ruby-core:17092] [ruby-core:17115]
+
+Wed Jun 4 17:22:30 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * NEWS: Fix typos and move misplaced entries.
+ NEWS: Somehow optflags and warnflags were not actually included
+ in this release.
+
+Tue Jun 3 19:33:22 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enumerator.c (enumerator_init_copy): Take care of
+ initialize_copy as well as initialize.
+
+ * test/ruby/test_enumerator.rb: Pull in the test suite for
+ enumerator from trunk.
+
+Tue Jun 3 12:51:57 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enumerator.c (enumerator_allocate, enumerator_ptr): Properly
+ detect if the object is initialized and raise error when
+ appropriate.
+ (enumerator_initialize): Fix a typo in rdoc. [ruby-core:17052]
+
+Tue Jun 3 10:16:40 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/erb.rb (ERB::Compiler::TrimScanner#scan_line): Fix a bug
+ where tokens are not yilelded one by one.
+ (ERB::Compiler::TrimScanner#explicit_trim_line): Fix without-
+ strscan problems. [ruby_core:17028].
+
+ * test/erb/test_erb.rb (TestERBCore#_test_01)
+ (TestERBCore#test_02_safe_04): The expected value should come
+ first for assert_equal().
+ (TestERBCoreWOStrScan): Add test class for without-strscan.
+
+Mon Jun 2 19:47:16 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/delegate.rb (DelegateClass, Delegator#respond_to?):
+ respond_to? must take optional second argument. This was a
+ latent bug exposed by a recent internal change of marshal.c to
+ call respond_to? with a second argument; submitted by Jeremy
+ Kemper <jeremy at bitsweat.net> in [ruby-core:17045].
+
+Sat May 31 23:53:35 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * .: Release as Ruby 1.8.7.
+
+Sat May 31 23:33:34 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * README, README.ja: Add a note about default C flags.
+
+Sat May 31 22:11:15 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * version.c (ruby_description, ruby_copyright): backported from
+ 1.9. bug#19002, [ruby-dev:34883]
+
+ * error.c (report_bug): uses ruby_description.
+
+Sat May 31 20:56:04 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_delete_if): should return enumerator if no block
+ is given. [ruby-dev:34901]
+
+Sat May 31 18:28:17 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * suppress warnings with -Wwrite-string.
+
+Sat May 31 15:58:08 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in, configure.in (warnflags): defaulted to -Wall
+ -Wno-parentheses with gcc. [ruby-dev:34810]
+
+Fri May 30 05:28:18 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * enum.c (count_i, count_iter_i, count_all_i): add prototypes for VC.
+
+Fri May 30 04:32:07 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enum.c (count_i, count_iter_i): Sync with trunk.
+ enum.c (enum_count, count_all_i, Init_Enumerable),
+ array.c (rb_ary_count): Sync with trunk. If no argument or
+ block is given, count the number of all elements.
+
+Fri May 30 03:12:18 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/openssl/ossl_bn.c (ossl_bn_s_rand, ossl_bn_s_pseudo_rand):
+ Int should be enough here.
+
+Fri May 30 02:35:00 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/openssl/ossl_bn.c (ossl_bn_s_rand, ossl_bn_s_pseudo_rand),
+ ext/openssl/ossl_pkey_dh.c (ossl_dh_s_generate)
+ (ossl_dh_initialize),
+ ext/openssl/ossl_pkey_dsa.c (ossl_dsa_s_generate),
+ ext/openssl/ossl_rand.c (ossl_rand_bytes)
+ (ossl_rand_pseudo_bytes, ossl_rand_egd_bytes),
+ ext/openssl/ossl_x509store.c (ossl_x509stctx_set_error): Do not
+ use FIX2INT() without checking the value type. Use NUM2INT()
+ instead; found by akr in [ruby-dev:34890].
+
+Thu May 29 20:07:45 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * configure.in, win32/Makefile.sub, mkconfig.rb, instruby.rb,
+ ruby.c, lib/mkmf.rb, README.EXT, README.EXT.ja: Backport the
+ vendor_ruby directory support.
+
+Thu May 29 17:52:31 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/zlib/extconf.rb: search zlib1, and regard mswin32 later than VC6
+ as WIN32. [ruby-core:16984]
+
+Wed May 28 17:54:29 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * string.c (rb_str_start_with): Remove an unused variable.
+ (rb_str_upto_m): Fix a prototype.
+
+Wed May 28 17:48:28 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * range.c (range_step): Fix brokenness when a non-integer numeric
+ value is specified as step. [rubyspec]
+ (range_step): Make use of String#step internally if a string (or
+ string-alike) range is given.
+
+ * string.c (rb_str_upto_m, Init_String): Add an optional second
+ argument to specify if the last value should be included.
+
+Wed May 28 16:53:39 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_slice_bang): Call rb_ary_modify_check() at the
+ beginning. [rubyspec]
+
+Wed May 28 16:12:44 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/webrick/httpservlet/cgihandler.rb (WEBrick::HTTPServlet::CGIHandler#do_GET):
+ Set the HTTP status code to 302 if a Location header field is
+ present and the status code is not valid as a client
+ redirection. cf. RFC 3875 6.2.3, 6.2.4.
+
+Wed May 28 15:18:16 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/singleton.rb (SingletonClassMethods): _load should be public.
+
+Wed May 28 12:52:41 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c (w_object, marshal_dump, r_object0, marshal_load): search
+ private methods too. [ruby-dev:34671]
+
+ * object.c (convert_type): ditto.
+
+Tue May 27 23:26:49 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * error.c (rb_bug): description from rb_bug() should include
+ patchlevel. [ruby-dev:34826]
+
+Tue May 27 20:19:22 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_slice_bang): Return an empty array instead of
+ nil when pos is valid and len is adjusted from a valid value to
+ zero; caught by RubySpec.
+
+Tue May 27 19:45:20 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * numeric.c (flo_divmod): Revert the behavior change; do not
+ suppress an exception when div is NaN or Inf. [ruby-dev:34857]
+
+Tue May 27 19:24:40 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enum.c (enum_to_a): Pass arguments through to #each().
+ (enum_sort): Follow the enum_to_a signature change.
+ (enum_reverse_each): Add #reverse_each().
+
+Tue May 27 18:54:02 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/stringio/stringio.c (strio_each_char, Init_stringio): Add
+ StringIO#{each_char,chars}.
+
+Tue May 27 17:59:34 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * 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.
+
+Tue May 27 16:02:58 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (rb_mod_module_exec, Init_eval): Add
+ Module#{module_exec,class_exec}.
+
+Tue May 27 15:36:37 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * io.c (rb_io_each_char, argf_each_char, Init_IO):
+ Add {IO#,ARGF.}{each_char,chars}.
+
+Tue May 27 13:46:52 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/stringio/stringio.c (Init_stringio): Define
+ StringIO#{getbyte,readbyte}.
+
+Tue May 27 13:38:51 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * io.c (Init_IO): Define {IO#,ARGF.}{getbyte,readbyte}.
+
+Tue May 27 13:26:15 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/stringio/stringio.c (Init_stringio): Define #bytes and
+ #lines.
+
+Tue May 27 13:20:35 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * io.c: (rb_io_lines, rb_io_bytes, Init_IO): Define
+ IO#{lines,bytes} and ARGF.{lines,bytes}.
+
+Tue May 27 12:13:17 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * file.c (BUFCHECK): wrong condition. [ruby-core:16921]
+
+ * file.c (file_expand_buf): shouldn't use buflen for length of string.
+
+Mon May 26 18:24:48 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (BUFCHECK): no resize if enough room.
+
+ * file.c (file_expand_path): use BUFCHECK.
+
+Mon May 26 16:46:19 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * file.c (ntfs_tail): filename which starts with '.' is valid.
+
+ * file.c (file_expand_path): cygwin symlink support.
+
+Mon May 26 12:16:43 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * .: Release as Ruby 1.8.7-preview4.
+
+Mon May 26 12:12:26 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * marshal.c (dump_ensure, load_ensure): should return values.
+
+ * eval.c (yield_under, yield_under_i, yield_args_under_i)
+ (specific_eval, rb_obj_instance_exec, Init_eval): Implement
+ Object#instance_exec(), a 1.9 feature.
+
+Mon May 26 11:53:21 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (rb_yield_0, proc_invoke, proc_arity): allow passing a
+ block to a Proc. [ruby-dev:23533]; by nobu; backported from
+ 1.9. This implementation in current shape is known to be
+ buggy/broken, especially with nested block invocation. Take
+ this as an experimental feature.
+
+ * parse.y (block_par, block_var): ditto.
+
+Mon May 26 08:00:52 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * marshal.c (r_object0, Init_marshal): Fix the garbled s_call
+ definition; fixes [ruby-dev:34843].
+
+Mon May 26 03:16:20 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * hash.c (rb_hash_default): Fix rdoc.
+ (rb_hash_each, env_each_value, env_each_pair): Return an
+ enumerator if no block is given.
+ (rb_hash_update): Update rdoc.
+ (envix): Conditionalize the definition itself.
+ (rb_f_getenv, env_fetch, env_keys, env_values, env_values_at)
+ (env_select, env_inspect, env_to_a, env_empty_p, env_has_key)
+ (env_has_value, env_index, env_indexes, env_to_hash, env_shift)
+ (env_update): Require secure level 4.
+ (env_each_value, env_each_i): Delay variable initialization.
+ (env_each_key, env_each_value, env_reject_bang)
+ (env_clear, env_replace): Omit duplicated secure level check.
+ (env_has_value): Do to_str conversion.
+
+Sun May 25 19:48:12 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * hash.c (env_delete_if): Return an enumerator if no block is
+ given.
+ (env_each_key): Delay a variable initialization after
+ RETURN_ENUMERATOR().
+
+Sun May 25 05:07:19 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_slice_bang): Be consistent with Array#slice()
+ and String#slice!(). Just return nil when a negative length or
+ out of boundary index is given instead of raising an exception
+ via internal functions.
+ (rb_ary_slice_bang): should not use rb_ary_subseq() which shares
+ internal pointer. splice modifies the receiver right after
+ subseq. [ruby-dev:34005]
+ (rb_ary_slice_bang): should adjust length before making
+ sub-array.
+
+ * enumerator.c (Init_Enumerator): Override
+ Enumerable::Enumerator#each_with_index with #with_index.
+
+Sun May 25 03:13:09 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (Init_Thread): Initialize recursive_key.
+
+Sun May 25 02:45:49 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * error.c (syserr_eqq): Use en.
+
+Sat May 24 22:32:49 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_cstr_to_dbl): should clear errno before calling
+ strtod(3). [ruby-dev:34834]
+
+Sat May 24 22:27:44 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (marshal_load): should initialize arg.data used for
+ reentrant check. [ruby-dev:34837]
+
+Sat May 24 00:34:59 2008 Tanaka Akira <akr@fsij.org>
+
+ * lib/rational.rb (Rational#to_i): fix rdoc. Rational(-7,4).to_i
+ should be -1.
+
+Fri May 23 20:22:44 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (reentrant_check): check reentrance via callcc.
+ [ruby-dev:34802]
+
+Fri May 23 16:46:28 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enumerator.c (proc_call): Remove an unused static function.
+
+Fri May 23 13:46:09 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (cflags): commit miss.
+
+Fri May 23 09:52:21 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (MINIRUBY), common.mk (RUBYOPT): add purelib.rb.
+ [ruby-core:16642]
+
+ * ext/extmk.rb: load purelib.rb only when not cross compiling.
+
+Fri May 23 08:47:02 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * error.c (syserr_eqq): === should be able to handle delegated
+ objects as well.
+
+Fri May 23 04:22:19 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/tcltklib.c, ext/tk/tkutil/tkutil.c: fix memory leak.
+
+ * ext/tk/lib/tk.rb: avoid trouble when finalize TclTkIp.
+
+ * ext/tk/lib/tk.rb, ext/tk/lib/tk/*: help to fix troubles when
+ use Ttk widgets on old Tk scripts.
+
+ * ext/tk/sample/*: update and add demo scripts. some of them are
+ introduction about new features of Tcl/Tk8.5.
+
+Fri May 23 03:48:10 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * class.c (clone_method): Just use ruby_cref as cref.
+
+Fri May 23 01:03:23 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * class.c (rb_singleton_class_clone): Pass Qnil, not 0.
+
+Fri May 23 00:51:48 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * class.c (clone_method): Totally revamp the previous fix which
+ was incorrect.
+ (rb_mod_init_copy): Ditto.
+ (singleton_class_clone_int): Ditto.
+
+Fri May 23 00:48:10 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (rb_copy_node_scope), node.h: Rename from copy_node_scope
+ and export.
+
+Thu May 22 21:24:15 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (top_local_setup): fixed memory leak bug based on a
+ patch from Roger Pack <rogerpack2005 at gmail.com> in
+ [ruby-core:16610].
+
+Thu May 22 14:20:54 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (flatten): check if reentered. [ruby-dev:34798]
+
+Thu May 22 08:28:49 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (flatten): free memo hash table before raising exception.
+ [ruby-dev:34789]
+
+Thu May 22 06:30:10 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * array.c (flatten): fix memory leak.
+
+Thu May 22 05:45:30 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * proc.c (proc_dup): should copy safe_level from src proc
+ properly. a patch from Keita Yamaguchi
+ <keita.yamaguchi at gmail.com>
+
+Wed May 21 23:31:44 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_get_method_body, rb_alias, rb_eval): should not cache
+ uninitialized value, since search_method doesn't set origin if the
+ method wasn't found.
+
+ * eval.c (search_method, remove_method, error_print, rb_alias)
+ (rb_eval, rb_rescue2, search_required, Init_eval, rb_thread_create),
+ gc.c (rb_source_filename, Init_stack), io.c (rb_io_getline),
+ parse.y (rb_id2name, rb_parser_free): suppress warnings.
+
+Wed May 21 12:34:51 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (rb_hash_delete): rdoc fix based on a patch from Gaston Ramos
+ <ramos.gaston AT gmail.com>. [ruby-core:16825]
+
+Tue May 20 13:15:46 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * file.c (lchmod_internal): Remove a compiler warning.
+
+Mon May 19 18:22:35 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/openssl/ossl_pkcs5.c (ossl_pkcs5_pbkdf2_hmac): Fix the type
+ of md; pointed out by Takahiro Kambe <taca at back-street.net>
+ in [ruby-dev:34748].
+
+Mon May 19 14:20:13 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * sprintf.c (rb_f_sprintf): fixed SEGV on win32 with "% 0e" % 1.0/0.0.
+
+Mon May 19 13:29:58 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * process.c (rb_f_system): set last_status when status == -1 because
+ there is no path to set it on win32. this patch is derived from
+ [ruby-core:16787], submitted by Luis Lavena <luislavena at gmail.com>
+
+Mon May 19 13:01:05 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk ({MSPEC,RUBYSPEC}_GIT_URL): moved from Makefine.in.
+
+ * {win32,bcc32}/Makefile.sub (update-rubyspec): added.
+
+Mon May 19 11:53:45 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/openssl/openssl_missing.c (HMAC_CTX_copy): adopted
+ prototype change in openssl bundled with newer OpenBSD.
+ a patch from Takahiro Kambe <taca at back-street.net> in
+ [ruby-dev:34691].
+
+Mon May 19 06:36:37 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * .: Release as Ruby 1.8.7-preview3.
+
+Sun May 18 22:26:51 2008 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/httpservlet/filehandler.rb: should normalize path
+ name in path_info to prevent script disclosure vulnerability on
+ DOSISH filesystems. (fix: CVE-2008-1891)
+ Note: NTFS/FAT filesystem should not be published by the platforms
+ other than Windows. Pathname interpretation (including short
+ filename) is less than perfect.
+
+ * lib/webrick/httpservlet/abstract.rb
+ (WEBrick::HTTPServlet::AbstracServlet#redirect_to_directory_uri):
+ should escape the value of Location: header.
+
+ * lib/webrick/httpservlet/cgi_runner.rb: accept interpreter
+ command line arguments.
+
+Sat May 17 23:53:57 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (file_expand_path): fix for short file name on Cygwin.
+
+Sat May 17 11:29:11 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_file_s_extname): first dot is not an extension name.
+
+Sat May 17 10:18:44 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_search): need to free allocated buffer in re_register.
+
+Fri May 16 17:01:44 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub (test-rubyspec): added.
+
+Fri May 16 16:22:40 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/tcltklib.c: sometimes freeze when receive Interrupt signal.
+
+Fri May 16 14:54:56 2008 Tanaka Akira <akr@fsij.org>
+
+ * Makefile.in (update-rubyspec): move rubyspec to srcdir.
+ (test-rubyspec): ditto.
+
+Fri May 16 14:25:22 2008 Tanaka Akira <akr@fsij.org>
+
+ * Makefile.in (test-rubyspec): use RUNRUBY. suggested by nobu.
+
+Fri May 16 13:01:43 2008 Tanaka Akira <akr@fsij.org>
+
+ * Makefile.in (update-rubyspec): new target to download rubyspec.
+ (test-rubyspec): new target to run rubyspec. this doesn't work
+ before install.
+
+Fri May 16 08:15:52 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: fix memory (object) leak bug.
+
+ * ext/tk/sample/demos-jp/aniwave.rb, ext/tk/sample/demos-en/aniwave.rb:
+ bug fix.
+
+Thu May 15 17:00:22 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * string.c (Init_String): Define #bytesize as an alias for #size
+ for compatibility with 1.9.
+
+Thu May 15 15:33:59 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (file_expand_path): support for alternative data stream
+ and ignored trailing garbages of NTFS.
+
+ * file.c (rb_file_s_basename): ditto.
+
+ * file.c (rb_file_s_extname): ditto.
+
+Wed May 14 19:24:59 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_count): Override Enumerable#count for better
+ performance.
+ (rb_ary_nitems): Undo the backport. Use #count {} instead.
+
+ * enumerator.c (enumerator_iter_i): Remove an unused function.
+ (enumerator_with_index, enumerator_each): Remove unused
+ variables.
+
+Wed May 14 17:15:11 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/tk/tkutil/extronf.rb: check stdndup() because it's not standard
+ function of C.
+
+ * ext/tk/tkutil/tkutil.c (cbsubst_table_setup): use malloc() and
+ strncpy() instead of strndup() if not available.
+
+Wed May 14 09:52:02 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/tkutil/tkutil.c: improve handling callback-subst-keys.
+ Now, support longnam-keys (e.g. '%CTT' on tkdnd-2.0; however, still
+ not support tkdnd-2.0 on tkextlib), and symbols of parameters (e.g.
+ :widget=>'%W', :keycode=>'%k', '%x'=>:x, '%X'=>:root_x, and so on;
+ those are attributes of event object). It means that Ruby/Tk accepts
+ not only "widget.bind(ev, '%W', '%k', ...){|w, k, ...| ... }", but
+ also "widget.bind(ev, :widget, :keycode, ...){|w, k, ...| ... }".
+ It is potentially incompatible, when user passes symbols to the
+ arguments of the callback block (the block receives the symbols as
+ strings). I think that is very rare case (probably, used by Ruby/Tk
+ experts only). When causes such trouble, please give strings instead
+ of such symbol parameters (e.g. call Symbol#to_s method).
+
+ * ext/tk/lib/tk/event.rb, ext/tk/lib/tk/validation.rb,
+ ext/tk/lib/tkextlib/blt/treeview.rb,
+ ext/tk/lib/tkextlib/winico/winico.rb: ditto.
+
+ * ext/tk/tkutil/tkutil.c: strings are available on subst_tables on
+ TkUtil::CallbackSubst class (it is useful on Ruby 1.9).
+
+ * ext/tk/lib/tk/spinbox.rb, ext/tk/lib/tkextlib/iwidgets/hierarchy.rb,
+ ext/tk/lib/tkextlib/iwidgets/spinner.rb,
+ ext/tk/lib/tkextlib/iwidgets/entryfield.rb,
+ ext/tk/lib/tkextlib/iwidgets/calendar.rb,
+ ext/tk/lib/tkextlib/blt/dragdrop.rb,
+ ext/tk/lib/tkextlib/tkDND/tkdnd.rb,
+ ext/tk/lib/tkextlib/treectrl/tktreectrl.rb,
+ ext/tk/lib/tkextlib/tktable/tktable.rb: disable code piece became
+ unnecessary by reason of the changes of ext/tk/tkutil/tkutil.c.
+
+Tue May 13 15:10:50 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enumerator.c: Update rdoc.
+ (enumerator_initialize): Discourage the use.
+ (enum_each_slice, enum_each_cons, enumerator_each)
+ (enumerator_with_index): Add a note about a call without a block.
+
+ * NEWS: Intentionally omit enum_slice and enum_cons, which are
+ removed in 1.9.
+
+Tue May 13 07:56:36 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_cat): fixed buffer overrun reported by
+ Christopher Thompson <cthompson at nexopia.com> in [ruby-core:16746]
+
+Mon May 12 13:57:19 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (is_defined): add NODE_OP_ASGN_{OR,AND}. "defined?(a||=1)"
+ should not operate assignment. [ruby-dev:34645]
+
+Mon May 12 12:59:23 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk/wm.rb: Wm#overrideredirect overwrites arguemnt to
+ an invalid value.
+
+ * ext/tk/sample/ttk_wrapper.rb: support "if __FILE__ == $0" idiom.
+
+Mon May 12 12:36:55 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_select): backport from trunk.
+ [ruby-talk:300743]
+
+Mon May 12 12:33:21 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (RUBYLIB, RUBYOPT): clear.
+
+Mon May 12 10:41:10 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/delegate.rb (SimpleDelegator::dup): removed needless argument.
+ [ruby-list:44910]
+
+ * lib/delegate.rb (clone, dup): keep relationship with the target
+ object.
+
+Sun May 11 23:19:39 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enum.c (all_iter_i, any_iter_i): reduced duplicated code.
+
+Sun May 11 17:57:36 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (MINIRUBY): should not include extension library path.
+
+Sun May 11 10:36:10 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * eval.c (method_name, method_owner): New methods; backported
+ from 1.9. (UnboundMethod#name, UnboundMethod#owner)
+
+Sun May 11 02:48:13 2008 <nagai@orca16.orcabay.ddo.jp>
+
+ * ext/tk/lib/tk/pack.rb, ext/tk/lib/tk/grid.rb: fail to do pack/grid
+ without options.
+
+ * ext/tk/lib/tk.rb: add TkWindow#grid_anchor, grid_column, grid_row.
+
+Sat May 10 18:19:16 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_each_line): RDoc updated. [ruby-dev:34586]
+
+Sat May 10 13:17:56 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk/pack.rb, ext/tk/lib/tk/grid.rb: increase supported
+ parameter patterns of configure method.
+
+Sat May 10 09:16:13 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * util.c (ruby_strtod): backported from 1.9. a patch from Satoshi
+ Nakagawa <psychs at limechat.net> in [ruby-dev:34625].
+ fixed: [ruby-dev:34623]
+
+Fri May 9 23:33:25 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk/wm.rb: methods of Tk::Wm_for_General module cannot
+ pass the given block to methods of Tk::Wm module.
+
+ * ext/tk/lib/tk/grid.rb: lack of module-method definitions.
+
+ * ext/tk/lib/tkextlib/tile.rb: lack of autoload definitions.
+
+ * ext/tk/lib/tkextlib/tile/tnotebook.rb: cannot use kanji (not UTF-8)
+ characters for headings.
+
+ * ext/tk/tcltklib.c: maybe a little more stable about @encoding value
+ of TclTkIp object.
+
+Wed May 7 08:46:44 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * struct.c (rb_struct_s_def): to_str should be called only once.
+ [ruby-core:16647]
+
+Wed May 7 00:54:25 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/zlib/zlib.c (gzreader_gets): may cause infinite loop.
+ a patch from Kouya <kouyataifu4 at gmail.com> in
+ [ruby-reference-manual:762].
+
+Sun May 4 09:35:51 2008 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * sample/erb/erb4html.rb (ERB4Html) : add example of ERB#set_eoutvar.
+ ERB4Html is an auto-quote ERB.
+
+Sat May 3 22:52:48 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tkextlib/tile.rb, ext/tk/lib/tkextlib/tile/style.rb,
+ ext/tk/sample/ttk_wrapper.rb: improve treating and control themes.
+ add Tk::Tile.themes and Tk::Tile.set_theme(theme).
+
+Fri May 2 14:52:33 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * misc/ruby-mode.el: move fontifying code from hook. a patch from
+ Phil Hagelberg <phil at hagelb.org> in [ruby-core:16636].
+
+Fri May 2 13:47:51 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (match_select): restore previous behavior of MatchData#select.
+ RDoc updated as well, mentioning the plan to remove this method
+ in the future. [ruby-dev:34556]
+
+Fri May 2 13:04:04 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/dbm/dbm.c (Init_dbm): defines DBM::VERSION even when
+ DB_VERSION_STRING is not available. [ruby-dev:34569]
+
+Thu May 1 23:57:06 2008 James Edward Gray II <jeg2@ruby-lang.org>
+
+ Merged 16257 from trunk.
+
+ * lib/net/telnet.rb: This patch from Brian Candler adds a FailEOF mode which
+ can be activated to have net/telnet raise EOFError exceptions when the
+ remote connection is closed. The default behavior remains unchanged though.
+
+Thu May 1 23:43:21 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * range.c (range_step): check if step can be converted to an integer.
+ [ruby-dev:34558]
+
+ * range.c (range_step): allow float step bigger than zero but less
+ than one. [ruby-dev:34557]
+
+Wed Apr 30 20:22:40 2008 James Edward Gray II <jeg2@ruby-lang.org>
+
+ Merged 16241 from trunk.
+
+ * lib/net/telnet.rb: Fixing a bug where line endings would not be properly
+ escaped when the two character ending was broken up into separate TCP
+ packets. Issue reported and patched by Brian Candler.
+
+Wed Apr 30 17:47:21 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * re.c (rb_reg_search): use local variable. a patch from wanabe
+ <s.wanabe AT gmail.com> in [ruby-dev:34537]. [ruby-dev:34492]
+
+Sat Apr 26 19:40:34 2008 Guy Decoux <decoux@moulon.inra.fr>
+
+ * class.c (struct clone_method_data): Add cref.
+ (clone_method): Properly handle NODE_BMETHOD and NODE_DMETHOD.
+ (rb_singleton_class_clone, singleton_class_clone_int): Set a
+ proper value to klass and propagate cref. [ruby-core:16238]
+
+ * eval.c (rb_block_dup, rb_method_dup), intern.h: Add duplicator
+ methods for use from class.c#clone_method().
+
+Fri Apr 25 15:46:37 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb, ext/tk/lib/tk/scrollbar.rb, ext/tk/lib/tk/scale.rb:
+ improve unknonw-option check when create a widget.
+
+ * ext/tk/lib/tkextlib/blt/unix_dnd.rb, ext/tk/lib/tkextlib/blt/ted.rb,
+ ext/tk/lib/tkextlib/treectrl/tktreectrl.rb: bug fix on 'cget'.
+
+ * ext/tk/lib/tk/menuspec.rb: option check will fail when
+ TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ is true.
+
+ * ext/tk/lib/tk/palette.rb: bug fix.
+
+Fri Apr 25 12:37:54 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (flatten): returns an instance of same class.
+ [ruby-core:16554]
+
+Thu Apr 24 23:47:50 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * lib/net/pop.rb: backported from 1.9. bug#19003
+
+ * ext/openssl/lib/openssl/ssl.rb: set_params; backported from 1.9.
+ bug#19552, [ruby-dev:34402]
+
+ * ext/openssl/ossl_ssl.c: ditto.
+
+ * test/openssl/test_ssl.rb: ditto.
+
+Thu Apr 24 17:06:34 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (THREAD_SAVE_CONTEXT): remove unnecessary
+ FLUSH_REGISTER_WINDOWS before calling setjmp(). [ruby-core:16285]
+
+Thu Apr 24 14:15:11 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dln.c (dln_find_1): prior files with extensions to files sans
+ extensions. [ruby-core:16517]
+
+Wed Apr 23 15:39:31 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (bind_eval): Add Binding#eval, a shorthand method for
+ eval(str, binding, ..); backported from 1.9.
+
+Wed Apr 23 15:28:52 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/gdbm/test_gdbm.rb (TestGDBM#test_s_open_no_create): failed
+ notice moved from comment to assertion message. [ruby-dev:29127]
+
+Wed Apr 23 14:00:05 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/mkmf.rb (create_makefile): Add a missing dependency on the
+ target directory for each .rb file. This will hopefully fix
+ parallel make (-jN). Tested on FreeBSD.
+
+Wed Apr 23 11:49:54 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb (Set#each, SortedSet#each, TC_Set#test_each): Return
+ an enumerator if no block is given.
+
+Wed Apr 23 00:42:49 2008 Tanaka Akira <akr@fsij.org>
+
+ * eval.c (error_print): show full stack grace except SystemStackError.
+ backport from 1.9. [ruby-dev:31014]
+
+Wed Apr 23 00:18:45 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/ruby/test_symbol.rb (TestSymbol#test_to_proc): Improve
+ tests of Symbol#to_proc.
+
+Tue Apr 22 22:43:05 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (rb_proc_new, YIELD_FUNC_LAMBDA): Add a new nd_state
+ YIELD_FUNC_LAMBDA which avoids automatic `avalue' conversion for
+ arguments. This fixes a bug where [1,[2,3]].map(&:object_id)
+ fails.
+
+ * intern.h, object.c: Hide rb_proc_new() from intern.h. It should
+ not be considered an official API function yet.
+
+Tue Apr 22 21:24:32 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (rb_proc_new): Turn the BLOCK_LAMBDA flag on.
+
+ * object.c (sym_to_proc), test/ruby/test_symbol.rb: Add back
+ Symbol#to_proc, now that it passes the tests.
+
+Tue Apr 22 19:35:03 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enumerator.c (enumerator_initialize): Remove an undocumented
+ feature (passing a block to the constructor) that's broken.
+ This is not what I intended.
+
+Tue Apr 22 17:49:46 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * sprintf.c (rb_f_sprintf): should protect temporary string from
+ GC. [ruby-dev:34480]
+
+Tue Apr 22 17:12:05 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_search): string might be NULL. [ruby-core:16478]
+
+Tue Apr 22 16:44:00 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * object.c (rb_obj_tap): Correct documentation; pointed out by
+ okkez in [ruby-dev:34472].
+
+Tue Apr 22 10:05:51 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * file.c (eaccess): workaround for recent msvcrt's behavior.
+ [ruby-core:16460]
+
+Mon Apr 21 16:06:47 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * enumerator.c (enumerator_init): preserve the method name in ID.
+
+ * enumerator.c (enumerator_each): need not to call rb_to_id().
+
+ * enumerator.c (enumerator_with_index): ditto.
+
+Mon Apr 21 17:19:52 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (rb_f_method_name): New gloval function: __method__;
+ backported from matzruby / 1.9.
+
+ * eval.c (rb_frame_this_func), intern.h: New internal function.
+
+ * intern.h (RETURN_ENUMERATOR): Use rb_frame_this_func() instead
+ of rb_frame_last_func(), to accommodate the behavior to that of
+ 1.9.
+
+Mon Apr 21 15:54:48 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/tempfile.rb (Tempfile::_close): check @data before modifying
+ it; backported from 1.9. [ruby-dev:34094]
+
+ * lib/tempfile.rb (Tempfile::close): clear @data and @tmpname.
+
+Mon Apr 21 10:17:17 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * time.c: should include <errno.h> to refer errno.
+
+Mon Apr 21 10:02:43 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * hash.c (recursive_hash): prototype.
+
+Mon Apr 21 10:00:51 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * time.c (rb_strftime): check errno to detect strftime(3)'s error.
+ this is workaround for recent version of MSVCRT.
+ [ruby-dev:34456]
+
+Sun Apr 20 21:10:04 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * .: Release as Ruby 1.8.7-preview2.
+
+Sun Apr 20 21:02:06 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enumerator.c: Resolve the method every time an enumeration
+ method is run, not once when the enumerator is initialized as it
+ was before, so that method_missing() and method (re)definition
+ afterwards are both in effect; pointed out in: [ruby-core:16441]
+
+Sun Apr 20 17:59:25 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * object.c, NEWS, test/ruby/test_symbol.rb: Revert Symbol#to_proc
+ since it does not pass the tests.
+
+Sun Apr 20 14:29:35 2008 Technorama Ltd. <oss-ruby@technorama.net>
+
+ * ext/openssl/ossl_ssl.c: initialize session class.
+
+Sat Apr 19 20:54:42 2008 akira yamada <akira@arika.org>
+
+ * lib/uri/ftp.rb, lib/uri/generic.rb, test/uri/test_common.rb,
+ test/uri/test_ftp.rb, test/uri/test_generic.rb: backported from 1.9.
+ [ruby-dev:31318]
+
+Sat Apr 19 20:35:02 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/yaml/baseemitter.rb, lib/yaml/encoding.rb: performance
+ tuning around String#gsub.
+
+ * lib/yaml/tag.rb: Replace nodoc with stopdoc so Module methods get
+ documented.
+
+ * lib/yaml/store.rb (YAML::load): modified to support empty
+ database.
+
+ * lib/yaml/store.rb (YAML::Store::marshal_dump_supports_canonical_option?):
+ add a method to support faster PStore.
+
+Sat Apr 19 20:16:52 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/yaml/types.rb: Likewise, pass self to YAML::quick_emit;
+ merged from 1.9.
+
+ * lib/yaml.rb (quick_emit): use combination of object_id and hash to
+ identify repeated object references, since GC will reuse memory of
+ objects during output of YAML. [ruby-Bugs-8548] [ruby-Bugs-3698];
+ merged from 1.9.
+
+Sat Apr 19 20:05:39 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_equal, rb_ary_eql, rb_ary_hash, rb_ary_cmp):
+ Make Array#eql?, #hash, #== and #<=> use rb_exec_recursive() and
+ handle recursive data properly.
+
+ * hash.c (hash_equal, rb_hash_hash): Make Hash#eql?, #hash and #==
+ use rb_exec_recursive() and handle recursive data properly.
+
+Sat Apr 19 19:26:09 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * intern.h, eval.c (rb_exec_recursive): New internal function to
+ help perform recursive operation; backported from 1.9.
+
+Sat Apr 19 18:42:04 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * intern.h, hash.c (rb_hash_lookup): New internal function to
+ check if a key exists in a hash, ignoring #default; backported
+ from 1.9.
+
+Fri Apr 18 18:56:57 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/syck/rubyext.c (syck_genericresolver_node_import): should
+ not set instance variable "@kind" before initializing it.
+ [ruby-dev:32677]
+
+ * ext/syck/rubyext.c (syck_resolver_initialize,
+ syck_resolver_detect_implicit, syck_emitter_emit): remove unused
+ variables.
+
+Fri Apr 18 18:54:57 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/syck/rubyext.c: Node#value defined twice.
+
+ * lib/yaml/: several method redefinitions causing warnings.
+
+Fri Apr 18 16:36:16 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/rexml/node.rb (REXML::Node::indent): should initialize rv
+ variable. a patch from Tadayoshi Funaba <tadf AT dotrb.org> in
+ [ruby-dev:32783].
+
+Fri Apr 18 16:01:37 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/rexml: Merge fixes since 1.8.6 made solely on the ruby_1_8_6
+ branch.
+
+Wed Apr 16 06:11:49 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * test/ruby/test_settracefunc.rb (TestSetTraceFunc#test_event):
+ Fix tests to reflect the following changes: r15833, r15759.
+
+Wed Apr 16 05:03:48 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * .: Release as Ruby 1.8.7-preview1.
+
+Wed Apr 16 02:09:14 2008 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/xmlrpc/client.rb: fix cookie handling. [ruby-dev:34403]
+
+ * test/xmlrpc/test_cookie.rb: add a test for the above fix.
+
+Tue Apr 15 23:48:28 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * version.h: Branch off ruby_1_8_7 from ruby_1_8 in preparation
+ for the forthcoming 1.8.7 release.
+
+Tue Apr 15 23:40:39 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/syck/rubyext.c (rb_syck_mktime): Avoid buffer overflow.
+
+Tue Apr 15 20:32:03 2008 Tanaka Akira <akr@fsij.org>
+
+ * re.c (match_inspect): backported from 1.9.
+
+Tue Apr 15 19:03:28 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * eval.c (method_receiver, method_name, method_owner): New
+ methods; backported from 1.9. bug#19007
+
+Tue Apr 15 18:39:14 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * lib/uri.rb, lib/uri/ldaps.rb: added LDAPS
+ scheme; backported from 1.9. bug#19015, [ruby-dev:31896]
+
+Tue Apr 15 17:45:43 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * lib/net/smtp.rb: backported from 1.9. bug#19003
+
+Tue Apr 15 17:06:12 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/ruby/test_symbol.rb (TestSymbol#test_to_proc): add tests.
+
+Tue Apr 15 16:58:55 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk/menuspec.rb: option check will fail when
+ TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ is true.
+
+ * ext/tk/lib/tk/palette.rb: bug fix.
+
+Tue Apr 15 16:47:48 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * signal.c, gc.c: New methods: GC.stress, GC.stress=;
+ backported from 1.9. a patch from Tadashi Saito
+ in [ruby-dev:34394] and bug#19000
+
+Tue Apr 15 12:35:44 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * rubyio.h (rb_io_t): renamed from OpenFile.
+
+ * ruby.h (struct RHash), file.c, gc.c, io.c, ext/dl/dl.c,
+ ext/io/wait/wait.c, ext/pty/pty.c, ext/readline/readline.c,
+ ext/socket/socket.c: ditto.
+
+ * win32/win32.h: removed workaround for OpenFile.
+
+Tue Apr 15 00:15:29 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk/text.rb: typo. call a wrong method.
+
+ * ext/tk/lib/tk/itemconfig.rb: ditto.
+
+ * ext/tk/sample/ttk_wrapper.rb: bug fix.
+
+ * ext/tk/sample/tktextio.rb: add binding for 'Ctrl-u' at console mode.
+
+ * ext/tk/lib/tk.rb, ext/tk/lib/tk/itemfont.rb, ext/tk/lib/font.rb:
+ support __IGNORE_UNKNOWN_CONFIGURE_OPTION__ about font options.
+
+ * ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb,
+ ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb,
+ ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb: bug fix.
+
+ * ext/tk/lib/tkextlib/tile/tpaned.rb: improve TPaned#add.
+
+ * ext/tk/lib/tk/timer.rb: add TkTimer#at_end(proc) to register the
+ procedure which called at end of the timer.
+
+Mon Apr 14 19:54:21 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_flatten, rb_ary_flatten_bang): Take an optional
+ argument that determines the level of recursion to flatten;
+ backported from 1.9.
+
+ * array.c (rb_ary_shuffle_bang, rb_ary_shuffle, rb_ary_choice,
+ rb_ary_cycle, rb_ary_permutation, rb_ary_combination,
+ rb_ary_product, rb_ary_take, rb_ary_take_while, rb_ary_drop,
+ rb_ary_drop_while): New methods: Array#shuffle, #shuffle!,
+ #choice, #cycle, #permutation, #combination, #product, #take,
+ #take_while, #drop, #drop_while; backported from 1.9.
+
+Mon Apr 14 19:52:35 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ruby.h: New macro: RB_GC_GUARD().
+
+Mon Apr 14 19:49:35 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * random.c (rb_genrand_int32, rb_genrand_real), intern.h: Export.
+
+ * string.c (rb_str_tmp_new), intern.h: New function.
+
+Mon Apr 14 19:18:55 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * enum.c (inject_i, inject_op_i): prototype.
+
+Mon Apr 14 19:10:47 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enum.c New methods: Enumerable#take, #take_while, #drop and
+ #drop_while; backported from 1.9.
+
+Mon Apr 14 18:50:15 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enum.c: New methods: Enumerable#one?, #none?, #minmax, #min_by,
+ #max_by, #minmax_by and #cycle; backported from 1.9.
+
+ * enum.c (enum_find_index): Add support for find_index(obj);
+ [ruby-dev:34313]; backported from 1.9.
+
+ * enum.c (enum_inject): Add support for Enumerable#inject(:binop);
+ backported from 1.9.
+
+ * enum.c: Alias Enumerable#reject to #inject; backported from 1.9.
+
+Mon Apr 14 18:14:19 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enum.c (enum_find, enum_reject): Return an enumerator if no
+ block is given; backported from 1.9.
+
+ * io.c (rb_io_each_line, rb_io_each_byte, rb_io_s_foreach,
+ argf_each_line, argf_each_byte): Ditto.
+
+ * string.c (str_gsub): Ditto.
+
+Mon Apr 14 18:10:05 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * enum.c (find_index_i, find_index_iter_i): add prototype for VC.
+
+Mon Apr 14 17:55:30 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_collect_bang, rb_ary_select): Return an
+ enumerator if no block is given; backported from 1.9.
+
+ * dir.c (dir_each, dir_foreach): Ditto.
+
+ * enum.c (enum_partition, enum_sort_by): Ditto.
+
+ * gc.c (os_each_obj): Ditto.
+
+ * hash.c (rb_hash_delete_if, rb_hash_reject_bang, rb_hash_select,
+ rb_hash_each_value, rb_hash_each_key, rb_hash_each_pair,
+ env_each_key, env_each_value, env_each, env_each_pair,
+ env_reject_bang, env_delete_if, env_select): Ditto.
+
+ * numeric.c (num_step, int_upto, int_downto, int_dotimes): Ditto.
+
+Mon Apr 14 16:42:53 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * ruby.h (rb_block_call_func): Fix prototype.
+
+ * enumerator.c (enumerator_iter_i, enumerator_each_i): Ditto.
+
+Mon Apr 14 15:49:05 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enum.c (enum_count, enum_find_index): New methods:
+ Enumerable#count and #find_index; backported from 1.9.
+
+Mon Apr 14 14:16:08 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * enumerator.c (enumerator_mark, enumerator_iter_i, enumerator_each_i,
+ enumerator_allocate): add prototype.
+
+ * enumerator.c (enumerator_each_i): declare unused two arguments.
+
+Mon Apr 14 13:58:32 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * string.c (rb_str_each_char): New methods: String#chars and
+ #each_char; backported from 1.9.
+
+Mon Apr 14 13:42:20 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * string.c (rb_str_each_line, rb_str_each_byte): Reflect
+ enumerator integration. #lines and #bytes are now aliases to
+ #each_line and #each_byte, respectively.
+
+Mon Apr 14 13:19:36 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * range.c (range_each, range_step): Return an enumerator if no
+ block is given; backported from 1.9.
+
+ * struct.c (rb_struct_each, rb_struct_each_pair): Ditto.
+
+Mon Apr 14 13:07:59 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * string.c (rb_str_partition, rb_str_rpartition,
+ rb_str_start_with, rb_str_end_with): New methods:
+ String#partition, #rpartition, #start_with? and #end_with?;
+ backported from 1.9. These methods are $KCODE aware unlike
+ #index, #rindex and #include?.
+
+Sun Apr 13 15:55:52 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * object.c (sym_to_proc): new method Symbol#to_proc; backported
+ from 1.9. bug#19012
+
+Fri Apr 11 19:14:30 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * object.c (rb_obj_tap): new method Object#tap; backported from
+ 1.9. bug#19008
+
+Fri Apr 11 18:58:09 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * process.c: new method Process.exec; backported from 1.9. bug#19006
+
+Fri Apr 11 12:43:56 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tkextlib/tile.rb, ext/tk/lib/tkextlib/tile/style.rb,
+ ext/tk/sample/tkextlib/tile/demo.rb: previous patch is not complete.
+
+Fri Apr 11 10:22:54 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tkextlib/tile.rb:
+ __define_LoadImages_proc_for_compatibility__! do nothing when the
+ Tcl command exists.
+
+ * ext/tk/lib/tkextlib/tile/style.rb:
+ __define_wrapper_proc_for_compatibility__! do nothing when the Tcl
+ command exists.
+
+ * ext/tk/sample/tkextlib/tile/demo.rb: don't create 'step' theme if
+ it already exists.
+
+Fri Apr 11 08:05:12 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_object): add volatile to avoid potential GC bug. a
+ patch from Tomoyuki Chikanaga <chikanag at nippon-control-system.co.jp>
+ in [ruby-dev:34311].
+
+Thu Apr 10 20:29:13 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * misc/rdebug.el, misc/README: Remove rdebug.el as per request
+ from the maintainer and mention the ruby-debug project at
+ RubyForge in README; bug#19043.
+
+Thu Apr 10 20:08:37 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enum.c (enum_first, enum_group_by): New methods:
+ Enumerable#first and #group_by; backported from 1.9.
+
+Thu Apr 10 19:49:10 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enumerator.c (rb_eStopIteration), eval.c (rb_f_loop), ruby.h:
+ Add a new exception class StopIteration, which breaks Kernel#loop
+ iteration when raised; backported from 1.9.
+
+ * enumerator.c (enumerator_next, enumerator_rewind): Implement
+ #next and #rewind using the "generator" library.
+
+ * lib/generator.rb: Implement Enumerable::Enumerator#next and
+ #rewind.
+
+Thu Apr 10 19:29:48 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_first, rb_ary_last): Return a shared array when
+ possible.
+
+ * array.c (rb_ary_pop, rb_ary_pop_m, rb_ary_shift, rb_ary_shift_m):
+ Array#pop and Array#shift can take an optional argument
+ specifying the number of elements to remove and return;
+ backported from 1.9.
+
+Thu Apr 10 14:00:44 2008 Tanaka Akira <akr@fsij.org>
+
+ * lib/resolv.rb (Resolv::DNS#each_address): backport from 1.9 for
+ CNAME. [ruby-dev:34200]
+
+Thu Apr 10 01:42:25 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * enum.c (iterate_method): add prototype to avoid warning on VC++.
+
+Wed Apr 9 23:12:41 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/tcltklib.c: SEGV when tcltk-stubs is enabled.
+
+ * ext/tk/tcltklib.c: avoid error on a shared object.
+
+ * ext/tk/extconf.rb: support --with-tcltkversion
+
+ * ext/tk/README.tcltklib: add document about --with-tcltkversion
+
+ * ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget,
+ ext/tk/sample/demos-jp/style.rb, ext/tk/sample/demos-en/style.rb,
+ ext/tk/sample/demos-jp/bind.rb, ext/tk/sample/demos-en/bind.rb:
+ bug fix.
+
+Wed Apr 9 21:54:45 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_pop): Do not reallocate too often; backported
+ from 1.9.
+
+Wed Apr 9 21:13:05 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_each, rb_ary_each_index, rb_ary_reverse_each,
+ rb_ary_reject, rb_ary_reject_bang): Array#each, #each_index,
+ #reverse_each, #reject, #reject! and #delete_if return an
+ enumerator if no block is given; backported from 1.9.
+
+Wed Apr 9 20:47:16 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_index, rb_ary_index): Array#index and #rindex
+ can take a block instead of an argument; backported from 1.9.
+
+Wed Apr 9 19:58:31 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * enumerator.c, inits.c (rb_call_inits), ruby.h, intern.h,
+ ext/enumerator, common.mk (OBJS, enumerator.$(OBJEXT)): Make the
+ enumerator module built-in.
+
+ * enumerator.c: New method: Enumerable::Enumerator#with_index.
+
+ * enum.c (enum_each_with_index): Enumerable#each_with_index now
+ returns an enumerator instead of raising an exception if no
+ block is given. Enumerable#enum_with_index, formerly defined in
+ the enumerator module, is kept as an alias to each_with_index
+ for backward compatibility.
+
+Wed Apr 9 19:43:51 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (rb_obj_method, rb_proc_call), intern.h: Export.
+
+Tue Apr 8 11:11:28 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (EXEC_TAG): remove unnecessary FLUSH_REGISTER_WINDOWS for
+ better performance on SPARC. [ruby-core:16159]
+
+Tue Apr 8 10:49:54 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_quote): should always copy the quoting string.
+ [ruby-core:16235]
+
+Mon Apr 7 21:35:08 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_nitems): Backport Array#nitems with a block;
+ suggested by Bertram Scharpf <lists@bertram-scharpf.de> in
+ [ruby-talk:134083].
+
+Sun Apr 6 09:45:00 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (dir_tell): check if closed. [ruby-core:16223]
+
+Sat Apr 5 10:05:00 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * object.c (rb_check_to_integer): backported for range_step.
+
+Fri Apr 4 05:57:11 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/net/pop.rb (Net::POP3::do_finish): clear @n_mails and
+ @n_bytes as well. [ruby-core:16144]
+
+Fri Apr 4 02:17:06 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * range.c (range_step): should not round step into integer if
+ begin and end are numeric. [ruby-core:15990]
+
+Tue Apr 1 14:43:38 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: get rid of empty expansion.
+
+ * {bcc,win}32/Makefile (config.h): need to define RUBY_SETJMP, etc.
+
+Tue Apr 1 11:36:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: _setjmp is available but _longjmp is not on mingw.
+
+Tue Apr 1 03:20:40 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RUBY_SETJMP, RUBY_LONGJMP, RUBY_JMP_BUF): prefers
+ _setjmp over setjmp and sigsetjmp. [ruby-core:16023]
+ __builtin_setjmp cannot handle a variable.
+
+ * configure.in (--with-setjmp-type): new option to override the
+ default rule in the above.
+
+ * eval_intern.h (ruby_setjmp, ruby_longjmp), gc.c (rb_setjmp),
+ vm_core.h (rb_jmpbuf_t): use RUBY_SETJMP, RUBY_LONGJMP and
+ RUBY_JMP_BUF.
+
+Tue Apr 1 01:55:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/resolv.rb (Resolv::Config.default_config_hash): requires
+ win32/resolv to use Win32::Resolv. [ruby-dev:34138]
+
+Mon Mar 31 14:51:11 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big_div): Bignum#div should return integer for
+ floating number operand.
+
+Sun Mar 30 07:00:32 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/tk/tcltklib.c: rb_hash_lookup has not been backported yet.
+
+Sat Mar 29 14:18:41 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
+
+ * ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
+ instate/state/identify method to avoid the conflict with standard
+ widget options. Those methods are renamed to ttk_instate/ttk_state/
+ ttk_identify (tile_instate/tile_state/tile_identify are available
+ too). Although I don't recommend, if you realy need old methods,
+ please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
+ "require 'tkextlib/tile'".
+
+ * ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
+ is obsolete. It outputs warning. To control default widget set,
+ use "Tk.default_widget_set = :Ttk".
+
+ * ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
+ __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
+ as module methods of TkConfigMethod. It may help users to wrap old
+ Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
+ Ttk widgets don't have some options of standard widgets which are
+ control the view of widgets. When set ignore-mode true, configure
+ method tries to ignoure such unknown options with no exception.
+ Of course, it may raise other troubles on the GUI design.
+ So, those are a little danger methods.
+
+ * ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
+ are defind as module methods of TkItemConfigMethod as the same
+ purpose as TkConfigMethod's ones.
+
+ * ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
+ wrapping old Ruby/Tk scripts (which use standard widgets) to use
+ Ttk (Tile) widgets as default.
+
+ * ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
+ method instead of instate/state method.
+
+ * ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
+ ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
+ are replaced to "instance_exec(self)".
+
+ * ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
+ a character code on Ruby1.9).
+
+ * ext/tk/lib/tk/variable.rb: support new style of operation argument
+ on Tcl/Tk's 'trace' command for variables.
+
+ * ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
+
+ * ext/tk/sammple/demos-jp/textpeer.rb,
+ ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
+
+ * ext/tk/tcltklib.c: decrase SEGV troubles (probably)
+
+ * ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
+
+ * ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
+
+ * ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
+ to make Tcl/Tk theme sources (based on different version of Tile
+ extension) available.
+ (Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
+
+ * ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
+ (Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
+ as toplevel widgets.
+
+ * ext/tk/lib/tkextlib/tile/style.rb: ditto.
+ (Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
+
+ * ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
+ properties as a hash. metrics_hash method returns a boolean value
+ for 'fixed' option. But metrics method returns numeric value
+ (0 or 1) for 'fixed' option, because of backward compatibility.
+
+ * ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
+
+ * ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
+ doesn't block the eventloop. It will be better to use the method
+ in event callbacks.
+
+ * ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
+
+Sat Mar 29 04:08:59 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (clone_method): should copy cref as well.
+ [ruby-core:15833]
+
+Mon Mar 24 20:07:42 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c (rb_eval): Call trace hook for if expression after the
+ condition has been evaluated, not before; submitted by Rocky
+ Bernstein in #18722.
+
+Mon Mar 24 19:44:53 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * parse.y (yycompile): Always prepare a new array for each file's
+ SCRIPT_LINES__ storage, instead of appending source lines every
+ time a file is re-loaded; submitted by Rocky Bernstein in
+ #18517.
+
+Mon Mar 24 10:25:54 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: sitearch should use target_cpu. [ruby-core:15986]
+
+Mon Mar 24 01:24:24 2008 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/erb.rb (result): use proc instead of Thread. [ruby-dev:33692]
+
+Fri Mar 21 21:26:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/resolv.rb (Resolv::Hosts): should not use win32/resolv on cygwin.
+ [ruby-dev:29945], [ruby-dev:34095]
+
+ * lib/win32/registry.rb (Win32::Registry.expand_environ): try upcased
+ name too for cygwin. [ruby-dev:29945]
+
+ * lib/win32/resolv.rb (Win32::Resolv.get_hosts_path): use expand_path.
+
+Fri Mar 21 21:10:00 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/ipaddr.rb: Say that I am the current maintainer.
+
+ * lib/set.rb: Ditto.
+
+ * lib/shellwords.rb: Ditto.
+
+ * ext/syslog/syslog.txt: Ditto.
+
+Fri Mar 21 09:24:28 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * instruby.rb (open_for_install): write block result and rewrite only
+ if changed from existing file.
+
+Wed Mar 19 21:01:08 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (dir_inspect, dir_path, dir_tell): check for frozen and closed
+ is not needed. [ruby-dev:32640]
+
+Wed Mar 19 20:25:40 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (Init_Dir): define inspect method. [ruby-core:15960]
+
+Wed Mar 19 14:59:12 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-style.el (ruby-style-{case,label}-indent): fix for labels
+ inside blocks in switch and function top level.
+
+Wed Mar 19 14:36:40 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_cstr_to_inum): treat successive underscores as
+ nondigit. [ruby-dev:34089]
+
+Wed Mar 19 00:01:23 2008 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/erb.rb (ERB::Compiler): Make some minor code optimization.
+
+Mon Mar 17 17:11:13 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-mode): should use `run-mode-hooks' instead
+ of calling `run-hooks' directly to run the mode hook. patch from
+ Chiyuan Zhang <pluskid AT gmail.com> in [ruby-core:15915]
+
+Mon Mar 17 16:41:08 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: unset GREP_OPTIONS. [ruby-core:15918]
+
+Fri Mar 14 16:59:23 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RUBY_LIB_PREFIX): fix for prefix.
+
+Fri Mar 14 16:35:11 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/cgi.rb (CGI::Cookie::initialize): performance patch from
+ Makoto Kuwata <kwa@kuwata-lab.com> in [ruby-dev:34048].
+
+Fri Mar 14 15:49:05 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RUBY_LIB_PREFIX): use libdir.
+
+Fri Mar 14 10:12:29 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RUBY_CHECK_VARTYPE): should not indent preprocessor
+ directives.
+
+Thu Mar 13 00:37:20 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_call0): yields the last executed node line number at
+ return event. [ruby-core:15855]
+
+Wed Mar 12 02:12:20 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * lib/delegate.rb: check $@ to avoid NoMethodError.
+
+Tue Mar 11 19:48:09 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * numeric.c (fix_coerce): try conversion before type check.
+ [ruby-core:15838]
+
+Tue Mar 11 17:03:23 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/delegate.rb (Delegator#initialize, DelegateClass): skip correct
+ backtrace. [ruby-dev:34019]
+
+Tue Mar 11 16:43:53 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_cmdvector): terminate shrunken command line.
+
+Tue Mar 11 12:39:03 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (clean-local): removes MINOBJS.
+
+Sat Mar 8 18:50:57 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (isdirsep): backslash is valid path separator on cygwin too.
+
+Fri Mar 7 19:56:10 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb: rdoc added. [ruby-Patches-9762]
+
+Thu Mar 6 15:10:21 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * {bcc32,win32}/Makefile.sub (RUNRUBY): use $(PROGRAM) instead of
+ ruby$(EXEEXT).
+ suggested by KIMURA Koichi <kimura.koichi at canon.co.jp>.
+ [ruby-dev:34000]
+
+Thu Mar 6 12:15:06 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (opt_block_param): command can start just after block param
+ definition. [ruby-list:44479]
+
+Thu Mar 6 00:34:11 2008 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/erb.rb: update RDoc. Thanks Makoto Kuwata [ruby-dev:33702]
+
+Mon Mar 3 23:28:34 2008 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/httpservlet/filehandler.rb: should normalize path
+ separators in path_info to prevent directory traversal attacks
+ on DOSISH platforms.
+ reported by Digital Security Research Group [DSECRG-08-026].
+
+ * lib/webrick/httpservlet/filehandler.rb: pathnames which have
+ not to be published should be checked case-insensitively.
+
+Mon Mar 3 16:14:24 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (rb_any_hash): shrinks all results in Fixnum range.
+ [ruby-core:15713]
+
+Sat Mar 1 02:35:08 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (big2str_find_n1): check integer overflow.
+
+Tue Feb 26 16:06:00 2008 Technorama Ltd. <oss-ruby@technorama.net>
+
+ * ext/openssl/ossl_pkey_{ec,dh,dsa,rsa}.c: Remove useless warnings.
+
+ * ext/openssl/ossl_asn1.c: Simplify code.
+
+ * ext/openssl/ossl_ssl_session.c Fix compiler warnings.
+ Undefine #id if SSL_SESSION_get_id is not supported.
+
+Tue Feb 26 15:43:42 2008 Tanaka Akira <akr@fsij.org>
+
+ * parse.y (tokadd_escape): refactored. [ruby-core:15657]
+
+Mon Feb 25 17:30:29 2008 Technorama Ltd. <oss-ruby@technorama.net>
+
+ * ext/openssl/digest.c ext/openssl/lib/openssl/digest.rb:
+ Commit patch #9280 from Akinori MUSHA.
+ Simplify the OpenSSL::Digest class and make use of the
+ existing Digest framework.
+ Enhance performance.
+
+Mon Feb 25 13:40:03 2008 Tanaka Akira <akr@fsij.org>
+
+ * process.c (Init_process): share bignum objects for RLIM_INFINITY,
+ RLIM_SAVED_MAX and RLIM_SAVED_CUR if they are equal.
+
+Sun Feb 24 23:29:48 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk, {bcc,win}32/Makefile.sub (clean-local): remove
+ intermediate files.
+
+Sun Feb 24 03:52:58 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * util.c (valid_filename): use O_EXCL to get rid of clobbering
+ existing files in race conditions.
+
+Fri Feb 22 19:50:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (BIGZEROP): fix for longer Bignum zeros. [ruby-Bugs-17454]
+
+Fri Feb 22 16:09:53 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big_lshift, rb_big_rshift, rb_big_aref): removed excess
+ arguments.
+
+Thu Feb 21 00:01:34 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RPATHFLAG): -R option of HP-UX ld is not for runtime
+ load path. [ruby-list:44600]
+
+Wed Feb 20 23:55:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_map_errno): exported.
+
+Wed Feb 20 13:08:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * instruby.rb (parse_args): added --dir-mode, --script-mode and
+ --cmd-type options. [ruby-dev:33816]
+
+ * instruby.rb (parse_args): added bin-arch and bin-comm to install
+ type, for compiled files and script files.
+
+ * instruby.rb (parse_args): deal with make style command line macros,
+ and count as long syle options if prefixed with INSTALL_.
+
+ * instruby.rb (makedirs): use $dir_mode. [ruby-dev:33805]
+
+ * instruby.rb (open_for_install): set file mode, which is now
+ permission mode instead of access mode.
+
+ * instruby.rb (bin-comm): installs scripts with replacing shebang
+ lines.
+
+Tue Feb 19 18:34:32 2008 Tanaka Akira <akr@fsij.org>
+
+ * gc.c (STACK_LENGTH) [SPARC] : 0x80 offset removed. [ruby-dev:33857]
+
+Tue Feb 19 14:27:32 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/readline/readline.c (readline_event): prevent polling. based on
+ a patch from error errorsson in [ruby-Bugs-17675].
+
+Tue Feb 19 12:08:29 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (yycompile): clear ruby_eval_tree_begin if parse failed.
+
+Mon Feb 18 16:23:45 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (yycompile): clear ruby_eval_tree_begin too before parse.
+
+Mon Feb 18 10:17:42 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/pty/lib/expect.rb (IO#expect): check if peer is closed.
+ [ruby-Bugs-17940]
+
+Fri Feb 15 20:37:06 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/rational.rb (floor, ceil, truncate, round): do not use
+ definitions of Numeric.
+
+ * lib/rational.rb (to_i): should returns truncated self.
+
+ * lib/complex.rb (numerator): requires
+ Integer#{numerator,denominator}.
+
+ * lib/complex.rb (quo): do not use definition of Numeric.
+
+ * lib/complex.rb (div, divmod, floor, ceil, truncate, round):
+ undef'ed.
+
+Fri Feb 15 15:23:12 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/iconv/iconv.c (iconv_convert): check upper bound. a patch from
+ Daniel Luz at [ruby-Bugs-17910].
+
+Fri Feb 15 02:42:25 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (ftruncate): check if available.
+
+ * file.c (rb_file_truncate): check if ftruncate instead of truncate.
+
+Fri Feb 15 02:40:54 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (sigsetmask): check when signal semantics is not POSIX.
+
+ * signal.c (USE_TRAP_MASK): set true if sigprocmask or sigsetmask is
+ available.
+
+Thu Feb 14 17:44:32 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/dl/ptr.c (dlmem_each_i): typo fixed. a patch from IKOMA
+ Yoshiki <ikoma AT mb.i-chubu.ne.jp> in [ruby-dev:33776].
+
+Thu Feb 14 16:02:51 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_file_s_utime): inhibits with secure level 2 or higher.
+
+Thu Feb 14 01:43:16 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/timeout.rb (Timeout::timeout): made sensitive to location on the
+ stack. [ruby-core:15458]
+
+Thu Feb 14 00:49:53 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (INSTRUBY_ARGS): pass mode to install. [ruby-dev:33766]
+
+ * instruby.rb (parse_args): added --data-mode and --prog-mode options.
+
+Tue Feb 12 11:33:26 2008 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * test/erb/test_erb.rb(TestERBCore): import from erb-2.0.4.
+
+ * test/erb/hello.erb: ditto
+
+Mon Feb 11 17:25:21 2008 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rss/rss.rb (RSS::VERSION), test/rss/test_version.rb, NEWS:
+ 0.2.3 -> 0.2.4.
+
+ * lib/rss/maker.rb, lib/rss/maker/, test/rss/test_maker_2.0.rb:
+ fixed a bug that RSS::Maker.make("0.9")'s item doesn't make some
+ elements if description is missed.
+ Reported by Michael Auzenne. Thanks!!!
+
+ * lib/rss/maker/0.9.rb, test/rss/test_maker_0.9.rb:
+ RSS::Maker.make("0.9") generates RSS 0.92 not RSS 0.91.
+
+Mon Feb 11 16:57:00 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * ChangeLog: format-time-string under C locale. [ruby-dev:33261]
+
+Mon Feb 11 16:31:47 2008 URABE Shyouhei <shyouhei@ice.uec.ac.jp>
+
+ * gc.c (rb_newobj): prohibit call of rb_newobj() during gc.
+ Submitted by Sylvain Joyeux [ruby-core:12099].
+
+ * ext/dl/ptr.c: do not use LONG2NUM() inside dlptr_free().
+ Slightly modified fix bassed on a patch by Sylvain Joyeux
+ [ruby-core:12099] [ ruby-bugs-11859 ] [ ruby-bugs-11882 ]
+ [ ruby-patches-13151 ].
+
+Mon Feb 11 00:22:55 2008 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/benchmark.rb (Job::Benchmark#item): fix typo.
+
+Sat Feb 9 23:22:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/bigdecimal/extconf.rb: simplified the condition.
+
+Sat Feb 9 17:51:24 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_to_f): use strtod() for more
+ precision. [ruby-talk:290296]
+
+ * ext/bigdecimal/bigdecimal.c (BASE_FIG): made constant.
+
+ * ext/bigdecimal/extconf.rb: ditto. [ruby-dev:33658]
+
+Sat Feb 9 00:44:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/irb.rb (IRB::Irb::eval_input): rescues Interrupt and other than
+ SystemExit and SignalException. [ruby-core:15359]
+
+Fri Feb 8 15:09:21 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (xsystem): expand macros like as make.
+
+Tue Feb 5 11:14:11 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (INSTALL_DIRS, install_dirs): added BINDIR.
+
+ * lib/mkmf.rb (install_files): rejects files matching to
+ $NONINSTALLFILES.
+
+ * lib/mkmf.rb (init_mkmf): defaults $NONINSTALLFILES to backup and
+ temporary filse.
+
+Mon Feb 4 16:44:24 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (darwin): NSIG is not defined if _XOPEN_SOURCE > 500L.
+ [ruby-dev:33584]
+
+Sat Feb 2 20:06:42 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/benchmark.rb (Benchmark::realtime): make Benchmark#realtime
+ a bit faster. a patch from Alexander Dymo <dymo AT ukrpost.ua> in
+ [ruby-core:15337].
+
+Sat Feb 2 09:53:39 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (darwin): disabled fat-binary support which confuses
+ configure much, since ``universal'' implies hidden cross-compiling.
+ TODO: ruby and libruby.bundle might be possible to bound with `lipo'
+ after builds for each archs. Anyway, config.h and rbconfig.rb must
+ be separated definitely at least.
+
+Fri Feb 1 21:42:37 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (darwin): _XOPEN_SOURCE is necessary to make ucontext_t
+ consistent with the library implementation of MacOS X 10.5.
+ [ruby-dev:33461]
+
+ * configure.in (darwin): ucontext on PowerPC MacOS X 10.5 is broken.
+
+Thu Jan 31 08:31:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (ext/extmk.rb, instruby.rb): inlined $(MAKE) so that can
+ be executed even with -n.
+
+Thu Jan 31 07:00:19 2008 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/rinda/tuplespace.rb (bin_for_find): should find a symbol by
+ Symbol class.
+
+ * test/rinda/test_rinda.rb (test_symbol_tuple): ditto.
+
+Wed Jan 30 22:07:58 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb: refined deprecated methods.
+
+Wed Jan 30 22:06:54 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * bignum.c (rb_cstr_to_inum): '0_2' is a valid representation.
+
+Tue Jan 29 22:40:12 2008 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * range.c (step_i): rb_funcall receives VALUE as an argument.
+
+Tue Jan 29 11:53:05 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: rm largefile.h.
+
+Mon Jan 28 01:21:15 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * 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.
+
+ * io.c (rb_io_s_foreach): ditto.
+
+ * io.c (rb_io_s_readlines): ditto.
+
+ * io.c (rb_io_s_read): ditto.
+
+Fri Jan 25 22:33:38 2008 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * math.c: fix comment. [ruby-dev:33276]
+
+Fri Jan 25 10:31:58 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * */*.bat: set svn:mime-type to text/batch.
+
+Thu Jan 24 19:36:22 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/uri/generic.rb (URI::Generic::inspect): use Kernel#to_s instead
+ object_id with printf. [ruby-dev:33347]
+
+Tue Jan 22 11:22:47 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/setup.mak ($(ARCH)): if a macro is appended by $(APPEND),
+ a space will be inserted on the top of the line.
+
+ * win32/Makefile.sub (MKFILES): stop make process if Makefile is
+ updated.
+
+Mon Jan 21 17:34:41 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * io.c (rb_io_mode_flags, rb_io_mode_modenum): Ignore encoding
+ options for forward compatibility.
+
+Mon Jan 21 12:50:02 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c, gc.c (setjmp): sigsetjmp is a macro on cygwin.
+
+Sat Jan 19 11:21:53 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (sigsetjmp): check if available.
+
+ * eval.c, gc.c (setjmp): do not use _setjmp if sigsetjmp is available.
+
+Sat Jan 19 11:10:11 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in: Remove wrong assumptions about Cygwin. a patch from
Corinna Vinschen in [ruby-Bugs-17018].
-Mon Jun 9 18:09:20 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Jan 17 21:06:01 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb (Date::Infinity#<=>): didn't work. A patch from
+ Dirkjan Bussink <d.bussink AT gmail.com> [ruby-core:15098].
+ This is a bug obviously. However it didn't affect the library's
+ functions.
+
+ * lib/date.rb, lib/date/format.rb: some trivial changes.
+
+Tue Jan 15 15:09:28 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/setup.mak: strip out empty lines from CPP output.
+
+Tue Jan 15 03:41:42 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (eval): check if backtrace is empty. [ruby-core:15040]
-Sun Jun 8 06:08:26 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jan 15 01:28:47 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk: simplified dummy objects dependencies.
+
+Mon Jan 14 16:12:58 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/shellwords.rb: scape should be an alias to shellescape. a
+ patch from Masahiro Kawato <m-kawato AT mwb.biglobe.ne.jp> in
+ [ruby-dev:33060].
+
+Mon Jan 14 09:32:40 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/time.rb: do not reference Time directly from the inside of
+ definitions. [ruby-dev:33059]
+
+Sat Jan 12 18:27:41 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (rb_define_alloc_func, rb_undef_alloc_func): should
define/undef on a signleton class. [ruby-core:09959]
-Sun Jun 8 06:04:41 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Jan 12 12:04:14 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb, lib/date/format.rb: tuning for performance.
+
+Fri Jan 11 12:35:56 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: moved broken syscall checks from process.c etc.
+
+ * defines.h (WORDS_BIGENDIAN): honor __BIG_ENDIAN__ than the result of
+ configure.
+
+ * dln.c: use dlopen on Mac OS X 10.3 or later. backport from trunk.
+
+ * lib/rdoc/options.rb (check_diagram): more precise check, darwin
+ is not Windows but minwg is on it.
+
+Thu Jan 10 10:53:50 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_open_osfhandle): reverted to old definition.
+ [ ruby-Bugs-16948 ]
+
+Tue Jan 8 20:02:08 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win{32,ce}/Makefile.sub: merged.
+
+Sun Jan 6 09:39:02 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb, lib/date/format.rb: introduced some constants
+ (for internal use).
+
+ * sample/cal.rb: trivial adjustments.
+
+Fri Jan 4 23:08:48 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* time.c (time_arg): use converted object. [ruby-core:14759]
-Sun Jun 8 06:02:11 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jan 4 01:20:21 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32.h: only VC6 needs extern "C++" for math.h. [ruby-talk:285660]
+
+Thu Jan 3 11:28:58 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (fptr_finalize): clear errno first. [ruby-talk:284492]
-Sun Jun 8 05:59:36 2008 Tadayoshi Funaba <tadf@dotrb.org>
+Wed Jan 2 10:18:56 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * sample/time.rb: use Process.times instead of Time.times.
+
+Wed Jan 2 09:18:11 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * sample/goodfriday.rb: examples for date are enough. retired.
+
+Wed Jan 2 09:06:55 2008 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * sample/cal.rb: just updated with the newest version.
+
+Mon Dec 31 06:50:38 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * trunk/common.mk: not use -I$(srcdir)/lib with $(MINIRUBY) for cross
+ compiling.
+
+ * configure.in, {win,bcc}32/Makefile.sub (MINIRUBY): -I$(srcdir)/lib
+ moved.
+
+Sun Dec 30 22:48:37 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb (_valid_time?): I'm not sure to recommend such an
+ expression. but anyway it is acceptable now. [ruby-core:14580]
+
+Fri Dec 28 16:36:33 2007 NARUSE, Yui <naruse@airemix.com>
+
+ * lib/resolv.rb (Resolv::DNS#each_address): now returns IPv6 address.
+
+Fri Dec 28 13:21:32 2007 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rss/rss.rb, test/rss/test_version.rb, NEWS: 0.2.2 -> 0.2.3.
+
+ * lib/rss/parser.rb, test/rss/test_parser.rb: supported "-" in tag name.
+ Reported by Ray Chen. Thanks.
+
+Thu Dec 27 23:56:01 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * mkconfig.rb: should not use the libraries under the source directory
+ at cross compiling.
+
+Thu Dec 27 11:02:45 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * intern.h, string.c (rb_str_set_len): added for upgrading path from
+ 1.8 to 1.9. [ruby-dev:32807]
+
+ * string.c (rb_str_lines, rb_str_bytes): ditto.
+
+Thu Dec 27 10:47:32 2007 Technorama Ltd. <oss-ruby@technorama.net>
+
+ * ext/openssl/ossl_ssl.c: Only show a warning if the default
+ DH callback is actually used.
+
+ * ext/openssl/ossl_rand.c: New method: random_add().
+
+Wed Dec 26 22:27:45 2007 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/resolv.rb (Resolv::DNS::Name.==): fix for other is array of
+ Resolv::DNS::Label::Str.
+
+ * lib/resolv.rb (Resolv::DNS::MessageEncoder#put_label): String#string
+ is not defined, so replace to_s.
+
+ * lib/resolv.rb (Resolv::IPv6#to_name): ip6.int is obsoleted by
+ int.arpa.
+
+Mon Dec 24 16:18:57 2007 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/ri/ri_options.rb: Fix ri --help listing of gem ri paths.
+ Merge of r14567 and r14569 from trunk.
+
+ * lib/rdoc/ri/ri_paths.rb: Fix duplication of ri data for multiple
+ gems. Merge of r14567 from trunk
+
+Mon Dec 24 12:35:03 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win{32,ce}/Makefile.sub (MFLAGS): defaulted to -l.
+
+Mon Dec 24 11:56:31 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * {bcc32,win{32,ce}}/Makefile.sub (SET_MAKE): set MFLAGS which is not
+ set by default, to get rid of chaotic situation of MFLAGS/MAKEFLAGS.
+
+Sat Dec 22 14:49:46 2007 Tadayoshi Funaba <tadf@dotrb.org>
* lib/date.rb: don't freeze nil even if 1.8 will not be aware of
the issue. [ruby-dev:32677]
-Sun Jun 8 05:54:44 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Dec 19 13:57:43 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (TIMEZONE_VOID): check whether timezone requires zero
arguments. [ruby-dev:32631]
-Sun Jun 8 05:37:10 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Dec 19 12:01:42 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (f_rest_arg): check if duplicated. [ruby-core:14140]
-Sun Jun 8 05:32:45 2008 Tanaka Akira <akr@fsij.org>
+Wed Dec 19 10:52:29 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_cstr_to_inum): an underscore succeeding after octal
+ prefix is allowed. [ruby-core:14139]
+
+Mon Dec 17 13:43:15 2007 Tanaka Akira <akr@fsij.org>
* gc.c (stack_end_address): use local variable address instead of
- __builtin_frame_address(0) to avoid SEGV on SunOS 5.11 on x86 with
+ __builtin_frame_address(0) to avoid SEGV on SunOS 5.11 on x86 with
gcc (GCC) 3.4.3 (csl-sol210-3_4-20050802).
+ stack_end_address returned a frame address of garbage_collect
+ since stack_end_address doesn't create its own frame.
+ So a VALUE stored in a callee saved register, %edi, pushed into
+ the stack at the beginning of garbage_collect was not marked.
-Sun Jun 8 05:24:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Dec 17 12:21:25 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in (RUNRUBY): added RUNRUBYOPT.
+
+Fri Dec 14 12:36:35 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (RUBY_CHECK_VARTYPE): check if a variable is defined
and its type.
@@ -54,98 +2702,264 @@ Sun Jun 8 05:24:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/readline/extconf.rb: should use have_func for functions instead
of have_var.
-Sun Jun 8 05:08:35 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Dec 11 00:04:05 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_slice_bang): If an invalid negative index (<
+ -size) is given, do not raise an exception but return nil just
+ like slice() does.
+
+ * test/ruby/test_array.rb (TestArray::test_slice,
+ TestArray::test_slice!): Pull in test cases from trunk.
+
+Mon Dec 10 21:47:53 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * transcode.c (str_transcode): allow non-registered encodings.
+ [ruby-dev:32520]
+
+Mon Dec 10 21:00:30 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_slice_bang): should return nil if position out
+ of range. a patch from Akinori MUSHA <knu AT iDaemons.org>.
+ [ruby-dev:32518]
+
+Mon Dec 10 18:28:06 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/uri/common.rb (URI::REGEXP::PATTERN): typo in REG_NAME
+ regular expression. a patch from Ueda Satoshi
+ <s-ueda AT livedoor.jp>. [ruby-dev:32514]
+
+Sun Dec 9 12:39:01 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/cgi.rb (read_multipart): exclude blanks from header values.
[ruby-list:44327]
-Sun Jun 8 05:02:25 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Dec 5 23:38:50 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * range.c (range_each): followed step_i change.
+
+Wed Dec 5 18:08:45 2007 Tanaka Akira <akr@fsij.org>
+
+ * numeric.c (int_odd_p): new method Integer#odd?.
+ (int_even_p): new method Integer#even?.
+ (int_pred): new method Integer#pred.
+ (fix_odd_p): new method Fixnum#odd?.
+ (fix_even_p): new method Fixnum#even?.
+
+Wed Dec 5 15:15:21 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * range.c (step_i, range_step): support non-fixnum steps.
+ [ruby-talk:282100]
+
+Tue Dec 4 11:23:50 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* bignum.c (rb_cstr_to_inum): trailing spaces may exist at sqeezing
preceeding 0s. [ruby-core:13873]
-Sun Jun 8 04:58:05 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Dec 2 22:43:45 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (error_print): put newline unless multiple line message ends
with a newline. [ruby-dev:32429]
-Sun Jun 8 04:55:26 2008 James Edward Gray II <jeg2@ruby-lang.org>
+Sun Dec 2 15:49:20 2007 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rss/rss.rb, test/rss/test_version.rb, NEWS: 0.2.1 -> 0.2.2.
+
+ * lib/rss/maker/itunes.rb: fixed new_itunes_category.
+ * lib/rss/maker/taxonomy.rb: new_taxo_topic -> new_topic because
+ of consistency.
+
+ * test/rss/test_maker_itunes.rb, test/rss/test_itunes.rb: removed
+ needless UTF-8 characters.
+
+Sun Dec 2 01:12:15 2007 James Edward Gray II <jeg2@ruby-lang.org>
Merged 14070 from trunk.
-
+
* lib/xmlrpc/server.rb (XMLRPC::Server#server): Improve signal handling so
pressing control-c in the controlling terminal or sending SIGTERM stops
the XML-RPC server.
-Sun Jun 8 04:49:43 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Dec 1 15:13:33 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/resolv.rb: documentation update. backported from 1.9.
+ [ruby-core:13273]
+
+Sat Dec 1 03:30:47 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (newline_node): set line from outermost node before removing
NODE_BEGIN. [ruby-dev:32406]
-Sun Jun 8 04:37:34 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Nov 30 21:53:28 2007 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rss/rss.rb, test/rss/test_version.rb: 0.2.0 -> 0.2.1.
+
+ * lib/rss/content.rb, lib/rss/content/1.0.rb,
+ lib/rss/content/2.0.rb, lib/rss/maker/content.rb,
+ test/rss/rss-testcase.rb, test/rss/test_content.rb,
+ test/rss/test_maker_content.rb: supported content:encoded with RSS
+ 2.0.
+ Suggested by Sam Lown. Thanks.
+
+ * NEWS: added the above changes.
+
+Thu Nov 29 16:59:10 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (stmt): remove unnecessary NODE_BEGIN. [ruby-core:13814]
-Sun Jun 8 04:16:35 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Nov 28 14:43:14 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb (extract_makefile): use dldflags instead of DLDFLAGS to
+ get rid of mixing $LDFLAGS and $ARCH_FLAG.
+
+ * lib/mkmf.rb (configuration): ditto.
+
+ * lib/mkmf.rb (create_makefile): support for extensions which has no
+ shared object.
+
+Wed Nov 28 09:51:42 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big2str0): do not clobber space for sign.
+
+ * sprintf.c (remove_sign_bits): extends sign bit first.
+
+Wed Nov 21 01:04:12 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (nil_plus): remove unused function. [ruby-core:13737]
+
+Sun Nov 18 14:03:44 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (rb_alias): do not call hook functions until initialization
finishes. [ruby-talk:279538]
-Sun Jun 8 04:14:16 2008 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+Sun Nov 18 09:09:48 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (String#tr_cpp): make preprocessor identifiers.
+
+Sat Nov 17 13:58:11 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/win32ole.c (ole_invoke): bug fix. [ruby-talk:279100]
-Sun Jun 8 03:59:31 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Nov 16 17:41:34 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/iconv/iconv.c (Document-class): moved the simplest example to
+ the top.
+
+ * ext/iconv/iconv.c (iconv_s_iconv): Document-method: needs class
+ prefix for class method. [ruby-core:13542]
+
+ * ext/iconv/iconv.c (iconv_iconv): also instance method needs to be
+ qualified.
+
+Fri Nov 16 11:16:41 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/yaml/rubytypes.rb (String#is_binary_data?): use Integer#fdiv.
+
+Thu Nov 15 19:50:46 2007 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/curses/extconf.rb: check macro if cannot find func.
[ruby-list:44224]
-Sun Jun 8 03:52:53 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+Thu Nov 15 12:19:14 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/cgi/session.rb (CGI::Session::FileStore::restore): use
lockfile for exclusive locks. a patch from <tommy AT tmtm.org>.
[ruby-dev:32296]
-Sun Jun 8 03:49:15 2008 Tanaka Akira <akr@fsij.org>
+Wed Nov 14 01:52:59 2007 Tanaka Akira <akr@fsij.org>
* missing/isinf.c (isinf): don't define if the macro is defined.
-Sun Jun 8 03:42:10 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Nov 14 01:34:42 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* numeric.c (round): fallback definition.
* numeric.c (flo_divmod, flo_round): use round() always.
[ruby-dev:32269]
-Sun Jun 8 03:42:10 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Nov 13 22:02:23 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/drb/drb.rb: remove Thread.exclusive.
+
+ * lib/drb/extservm.rb: ditto.
+
+Tue Nov 13 16:33:07 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* numeric.c (flodivmod): work around for infinity.
* numeric.c (flo_divmod): work around for platforms have no round().
[ruby-dev:32247]
-Sun Jun 8 03:42:10 2008 URABE Shyouhei <shyouhei@ice.uec.ac.jp>
+Tue Nov 13 13:58:51 2007 Tanaka Akira <akr@fsij.org>
+
+ * numeric.c (numeric.c): Integer#ord implemented. [ruby-dev:32206]
+
+Tue Nov 13 02:57:04 2007 URABE Shyouhei <shyouhei@ice.uec.ac.jp>
* numeric.c (flo_divmod): round to the nearest integer.
[ ruby-Bugs-14540 ]
-Sun Jun 8 03:28:53 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+Mon Nov 12 16:52:29 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (create_makefile): rdoc about srcprefix. a patch from
+ Daniel Berger <djberg96 AT gmail.com> in [ruby-core:13378].
+
+Mon Nov 12 13:53:06 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-parse-partial): handle stringified
+ symbols properly using ruby-forward-string.
+
+Mon Nov 12 12:38:31 2007 Tanaka Akira <akr@fsij.org>
+
+ * Makefile.in (lex.c): don't remove lex.c at first.
+
+Fri Nov 9 07:26:04 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * random.c: update MT URL.[ruby-core:13305].
+
+Wed Nov 7 03:32:38 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/rexml/encodings/SHIFT-JIS.rb (REXML::Encoding): place -x for
nkf conversion. a patch from <moonwolf AT moonwolf.com>.
[ruby-dev:32183]
-Sun Jun 8 03:07:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Nov 5 05:17:04 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/optparse.rb (OptionParser::Switch::summarize): fix for long form
option with very long argument. a patch from Kobayashi Noritada
<nori1 AT dolphin.c.u-tokyo.ac.jp> in [ruby-list:44179].
-Sun Jun 8 03:04:38 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Nov 5 01:20:33 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (call_args): remove "parenthesize argument(s) for future
+ version" warning. when I added this warning, I had a plan to
+ reimplement the parser that is simpler than the current one.
+ since we abandoned the plan, warning no longer required.
+
+Fri Nov 2 00:13:51 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_assoc): check and convert inner arrays (assocs)
+ using #to_ary.
+
+ * hash.c (rb_hash_s_create): check and convert argument hash
+ using #to_hash.
+
+ * hash.c (rb_hash_s_create): Hash#[] now takes assocs as source of
+ hash conversion.
+
+Thu Nov 1 23:47:43 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/drb/drb.rb (DRbTCPSocket): Improving with multiple network
+ interface.
+
+ * test/drb/drbtest.rb: ditto.
+
+Fri Oct 26 17:14:14 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * numeric.c (fix_pow): returns 1.0 for 0**0.0.
* numeric.c (fix_pow): returns infinity for 0**-1. [ruby-dev:32084]
-Sun Jun 8 02:58:19 2008 James Edward Gray II <jeg2@ruby-lang.org>
+Wed Oct 25 07:18:09 2007 James Edward Gray II <jeg2@ruby-lang.org>
Merged 13781 from trunk.
@@ -159,11 +2973,11 @@ Wed Oct 25 06:46:21 2007 James Edward Gray II <jeg2@ruby-lang.org>
* lib/net/telnet.rb (Net::Telnet#login): Making the password prompt
pattern case insensitive. [ruby-Bugs-10746]
-Sun Jun 8 02:55:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Oct 25 14:19:33 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (rb_io_tell, rb_io_seek): check errno too. [ruby-dev:32093]
-Sun Jun 8 01:53:50 2008 James Edward Gray II <jeg2@ruby-lang.org>
+Wed Oct 25 08:03:53 2007 James Edward Gray II <jeg2@ruby-lang.org>
Merged 13767, 13768, 13769, and 13770 from trunk.
@@ -180,37 +2994,125 @@ Sun Jun 8 01:53:50 2008 James Edward Gray II <jeg2@ruby-lang.org>
* lib/xmlrpc/utils.rb (XMLRPC::ParseContentType#parse_content_type):
Making Content-Type checks case insensitive. [ruby-Bugs-3367]
-Sun Jun 8 01:50:07 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Oct 21 21:16:43 2007 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rss.rb, lib/rss/, test/rss/, sample/rss/: merged from trunk.
+ - 0.1.6 -> 2.0.0.
+ - fixed image module URI. Thanks to Dmitry Borodaenko.
+ - supported Atom.
+ - supported ITunes module.
+ - supported Slash module.
+
+ * NEWS: added an entry for RSS Parser.
+
+Thu Oct 18 10:57:06 2007 Tanaka Akira <akr@fsij.org>
+
+ * ruby.h (RCLASS_IV_TBL): defined.
+ (RCLASS_M_TBL): ditto.
+ (RCLASS_SUPER): ditto.
+ (RMODULE_IV_TBL): ditto.
+ (RMODULE_M_TBL): ditto.
+ (RMODULE_SUPER): ditto.
+
+Mon Oct 15 22:08:55 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * NEWS: Merge some of the sub-sections, as the differences were
+ unclear.
+
+Mon Oct 15 21:57:07 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * NEWS: Mention ipaddr enhancements.
+
+ * lib/ipaddr.rb (in_addr, in6_addr, addr_mask): Make some minor
+ code optimization.
+
+ * lib/ipaddr.rb (<=>): Implement IPAddr#<=> and make IPAddr
+ comparable.
+
+ * lib/ipaddr.rb (succ): Implement IPAddr#succ. You can now create
+ a range between two IPAddr's, which (Range) object is
+ enumerable.
+
+ * lib/ipaddr.rb (to_range): A new method to create a Range object
+ for the (network) address.
+
+ * lib/ipaddr.rb (coerce_other): Support type coercion and make &,
+ |, == and include? accept a string or an integer instead of an
+ IPAddr object as the argument.
+
+ * lib/ipaddr.rb (initialize): Give better error messages.
+
+ * lib/ipaddr.rb: Improve documentation.
+
+Mon Oct 15 21:24:25 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * NEWS: Mention shellwords and tempfile enhancements.
+
+ * NEWS: Move the entry about Tk::X_Scrollable to a better section.
+
+Mon Oct 15 17:28:20 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/openssl/lib/openssl/buffering.rb (read, readpartial): revert
+ r12496. handling EOF is a little differnt in ruby 1.8 and ruby 1.9.
+ [ruby-dev:31979]
+
+Mon Oct 15 11:45:12 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* marshal.c (r_bytes0): refined length check. [ruby-dev:32059]
-Sun Jun 8 01:50:07 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Oct 15 09:58:07 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* marshal.c (r_bytes0): check if source has enough data.
[ruby-dev:32054]
-Sun Jun 8 01:41:19 2008 Tanaka Akira <akr@fsij.org>
+Mon Oct 15 01:15:09 2007 Tanaka Akira <akr@fsij.org>
* ext/socket/socket.c (s_accept_nonblock): make accepted fd
nonblocking. [ruby-talk:274079]
-Sun Jun 8 01:36:26 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Oct 14 04:08:34 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (AC_SYS_LARGEFILE): keep results also in command
options, to vail out of mismatch. [ruby-list:44114]
* mkconfig.rb, lib/mkmf.rb (configuration): add DEFS.
-Sun Jun 8 01:31:17 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Oct 14 03:55:52 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* win32/mkexports.rb: deal with __fastcall name decorations.
[ruby-list:44111]
-Sun Jun 8 01:27:06 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Oct 13 09:02:16 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* {bcc,win}32/mkexports.rb: explicit data. [ruby-list:44108]
-Sun Jun 8 01:15:50 2008 GOTOU Yuuzou <gotoyuzo@notwork.org>
+Sat Oct 13 00:35:03 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/rexml/source.rb (REXML::SourceFactory::SourceFactory): typo
+ fixed. [ruby-list:44099]
+
+Fri Oct 12 11:22:15 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (match_values_at): make #select to be alias to #values_at
+ to adapt RDoc description. [ruby-core:12588]
+
+Thu Oct 11 14:32:46 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * {bcc32,win32}/Makefile.sub (COMMON_MACROS): workaround for old SDK's
+ bug. [ruby-core:12584]
+
+Wed Oct 10 23:34:45 2007 Tanaka Akira <akr@fsij.org>
+
+ * lib/securerandom.rb: new file. [ruby-dev:31928]
+
+ * lib/cgi/session.rb (create_new_id): use securerandom if available.
+
+Tue Oct 9 01:01:55 2007 Tanaka Akira <akr@fsij.org>
+
+ * re.c (rb_reg_s_union_m): Regexp.union accepts single
+ argument which is an array of patterns. [ruby-list:44084]
+
+Mon Oct 8 20:06:23 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
* lib/net/http.rb, lib/open-uri.rb: remove
Net::HTTP#enable_post_connection_check. [ruby-dev:31960]
@@ -220,12 +3122,40 @@ Sun Jun 8 01:15:50 2008 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/lib/net/telnets.rb, ext/openssl/lib/net/ftptls.rb: ditto.
-Thu Jun 5 16:21:16 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Oct 6 23:14:54 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_to_i): update RDoc since base can be any value
+ between 2 and 36. [ruby-talk:272879]
+
+Fri Oct 5 15:44:50 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/shellwords.rb: Add shellescape() and shelljoin().
+
+ * lib/shellwords.rb: Rename shellwords() to shellsplit() and make
+ the former an alias to the latter.
+
+ * lib/shellwords.rb: Add escape(), split(), join() as class
+ methods, which are aliases to their respective long names
+ prefixed with `shell'.
+
+ * lib/shellwords.rb: Add String#shellescape(), String#shellsplit()
+ and Array#shelljoin() for convenience.
+
+Fri Oct 5 15:40:04 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/tempfile.rb (Tempfile::make_tmpname): Allow to specify a
+ suffix for a temporary file name.
+
+ * lib/tempfile.rb (Tempfile::make_tmpname): Make temporary file
+ names less predictable by including a random string.
+ [inspired by: akr]
+
+Tue Oct 2 21:20:14 2007 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (make_cmdvector): adjust escaped successive
double-quote handling. (merge from trunk)
-Thu Jun 5 12:26:45 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue Oct 2 20:35:24 2007 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (init_env): initialize HOME and USER environment
variables unless set. [ruby-core:12328] (merge from trunk)
@@ -235,215 +3165,254 @@ Thu Jun 5 12:26:45 2008 NAKAMURA Usaku <usa@ruby-lang.org>
* configure.in, win32/Makefile.sub (LIBS): need to link shell32
library for SH* functions on mswin32 and mingw32.
-Thu Jun 5 12:22:28 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+Mon Oct 1 12:50:59 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* gc.c (id2ref): valid id should not refer T_VALUE nor T_ICLASS.
[ruby-dev:31911]
-Wed Jun 4 16:41:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Sep 26 23:54:37 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb (extmake), lib/mkmf.rb (configuration): top_srcdir
+ should not prefixed with DESTDIR.
+
+Wed Sep 26 08:36:31 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* Makefile.in (ext/extinit.o): use $(OUTFLAG) as well as other
objects. [ruby-Bugs-14228]
-Tue Jun 3 16:15:27 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Sep 26 05:12:17 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (yyerror): limit error message length. [ruby-dev:31848]
* regex.c (re_mbc_startpos): separated from re_adjust_startpos.
-Tue Jun 3 15:45:00 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (os_obj_of, os_each_obj): hide objects to be finalized.
- [ruby-dev:31810]
-
-Wed Jun 4 19:16:40 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+Tue Sep 25 13:47:38 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (remove_method): should not remove undef place holder.
[ruby-dev:31817]
-Tue Jun 3 15:22:47 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Sep 24 16:52:11 2007 Urabe Shyouhei <shyouhei@ruby-lang.org>
- * process.c (struct rb_exec_arg): proc should be a VALUE.
+ * lib/net/http.rb: fix typo.
- * process.c (rb_f_exec): suppress a warning.
+Sun Sep 23 21:57:25 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * process.c (rb_detach_process): cast for the platforms where size of
- pointer differs from size of int.
+ * lib/net/http.rb: an SSL verification (the server hostname should
+ be matched with its certificate's commonName) is added.
+ this verification can be skipped by
+ "Net::HTTP#enable_post_connection_check=(false)".
+ suggested by Chris Clark <cclark at isecpartners.com>
- * process.c (rb_f_exec, rb_f_system): should not exceptions after
- fork. [ruby-core:08262]
+ * lib/net/open-uri.rb: use Net::HTTP#enable_post_connection_check to
+ perform SSL post connection check.
-Wed May 21 01:32:56 2008 GOTOU Yuuzou <gotoyuzo@notwork.org>
+ * ext/openssl/lib/openssl/ssl.c
+ (OpenSSL::SSL::SSLSocket#post_connection_check): refine error message.
- * lib/webrick/httpservlet/filehandler.rb: should normalize path
- name in path_info to prevent script disclosure vulnerability on
- DOSISH filesystems. (fix: CVE-2008-1891)
- Note: NTFS/FAT filesystem should not be published by the platforms
- other than Windows. Pathname interpretation (including short
- filename) is less than perfect.
+Sun Sep 23 09:05:05 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/webrick/httpservlet/abstract.rb
- (WEBrick::HTTPServlet::AbstracServlet#redirect_to_directory_uri):
- should escape the value of Location: header.
+ * gc.c (os_obj_of, os_each_obj): hide objects to be finalized.
+ [ruby-dev:31810]
- * lib/webrick/httpservlet/cgi_runner.rb: accept interpreter
- command line arguments.
+Sun Sep 23 08:58:01 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun May 18 01:57:44 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * eval_method.ci (rb_attr): should not use alloca for unknowen size
+ input. [ruby-dev:31816]
- * file.c (isdirsep): backslash is valid path separator on cygwin too.
- backported from 1.8 HEAD.
+ * parse.y (rb_intern_str): prevent str from optimization.
-Sat May 17 23:53:57 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Sep 23 05:42:35 2007 URABE Shyouhei <shyouhei@ruby-lang.org>
- * file.c (file_expand_path): fix for short file name on Cygwin.
+ * lib/rdoc/options.rb (Options::check_diagram): dot -V output
+ changed. [ ruby-Bugs-11978 ], Thanks Florian Frank.
-Sat May 17 23:50:29 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Sep 22 06:02:11 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * file.c (OpenFile): prevent conflict on Windows.
+ * lib/optparse.rb (OptionParser::List::summarize): use each_line if
+ defined rather than each. [ruby-Patches-14096]
- * file.c (USE_NTFS): fixed merge miss.
+Sat Sep 22 05:19:49 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat May 17 12:36:46 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/stringio/stringio.c (strio_init): separate from strio_initialize
+ to share with strio_reopen properly. [ruby-Bugs-13919]
- * file.c (file_expand_path): rb_str_set_len is not backported.
+Fri Sep 21 15:46:20 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat May 17 12:15:48 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * process.c (struct rb_exec_arg): proc should be a VALUE.
- * file.c (file_expand_path): support for alternative data stream
- and ignored trailing garbages of NTFS.
+ * process.c (rb_f_exec): suppress a warning.
- * file.c (rb_file_s_basename): ditto.
+Fri Sep 21 03:05:35 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * file.c (rb_file_s_extname): ditto.
+ * eval.c, intern.h, ext/thread/thread.c: should not free queue while
+ any live threads are waiting. [ruby-dev:30653]
-Mon Mar 3 23:34:13 2008 GOTOU Yuuzou <gotoyuzo@notwork.org>
+Thu Sep 20 17:24:59 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/webrick/httpservlet/filehandler.rb: should normalize path
- separators in path_info to prevent directory traversal attacks
- on DOSISH platforms.
- reported by Digital Security Research Group [DSECRG-08-026].
+ * process.c (rb_detach_process): cast for the platforms where size of
+ pointer differs from size of int.
- * lib/webrick/httpservlet/filehandler.rb: pathnames which have
- not to be published should be checked case-insensitively.
+ * process.c (rb_f_exec, rb_f_system): should not exceptions after
+ fork. [ruby-core:08262]
-Mon Dec 3 08:13:52 2007 Kouhei Sutou <kou@cozmixng.org>
+Fri Sep 14 00:34:25 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
- * test/rss/test_taxonomy.rb, test/rss/test_parser_1.0.rb,
- test/rss/test_image.rb, test/rss/rss-testcase.rb: ensured
- declaring XML namespaces.
+ * lib/drb/extservm.rb (invoke_service): use Thread.exclusive instead of
+ Thread.critical
-Sun Sep 23 21:57:25 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
+Wed Sep 12 23:12:22 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
- * lib/net/http.rb: an SSL verification (the server hostname should
- be matched with its certificate's commonName) is added.
- this verification can be skipped by
- "Net::HTTP#enable_post_connection_check=(false)".
- suggested by Chris Clark <cclark at isecpartners.com>
+ * ruby.c (proc_options): -W should be allowed in RUBYOPT
+ environment variable. [ruby-core:12118]
- * lib/net/open-uri.rb: use Net::HTTP#enable_post_connection_check to
- perform SSL post connection check.
+Mon Sep 10 01:05:25 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
- * ext/openssl/lib/openssl/ssl.c
- (OpenSSL::SSL::SSLSocket#post_connection_check): refine error message.
+ * range.c (range_step): fixed integer overflow. [ruby-dev:31763]
-Sun Sep 23 07:49:49 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Sep 9 09:14:45 2007 Tadayoshi Funaba <tadf@dotrb.org>
- * eval.c, intern.h, ext/thread/thread.c: should not free queue while
- any live threads are waiting. [ruby-dev:30653]
+ * lib/date/format.rb (_strptime): now also attaches an element
+ which denotes leftover substring if exists.
-Sun Sep 23 06:05:35 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Sep 8 10:22:20 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
- * ext/stringio/stringio.c (strio_init): separate from strio_initialize
- to share with strio_reopen properly. [ruby-Bugs-13919]
+ * struct.c (rb_struct_s_members): should raise TypeError instead
+ of call rb_bug(). [ruby-dev:31709]
-Sun Sep 23 05:42:35 2007 URABE Shyouhei <shyouhei@ruby-lang.org>
+ * marshal.c (r_object0): no nil check require any more.
- * lib/rdoc/options.rb (Options::check_diagram): dot -V output
- changed. [ ruby-Bugs-11978 ], Thanks Florian Frank.
+Sat Sep 8 09:38:19 2007 Tadayoshi Funaba <tadf@dotrb.org>
-Wed Sep 19 11:13:07 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+ * lib/date/format.rb (str[fp]time): now check specifications more
+ strictly.
- * bignum.c (bigtrunc): RBIGNUM(x)->len may be zero. out of bound
- access. [ruby-dev:31404]
+Fri Sep 7 05:36:19 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * test/rinda/test_rinda.rb (MockClock): correct synchronous problems
+ of the MultiThreading. [ruby-dev:31692]
-Mon Sep 17 05:24:13 2007 Sylvain Joyeux <sylvain.joyeux@m4x.org>
+Wed Sep 5 22:02:27 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
- * ext/thread/thread.c (lock_mutex): should take care of threads
- not waiting any longer; there cases of a thread raising
- exceptions. [ ruby-Bugs-11901 ]
+ * array.c (rb_ary_subseq): need integer overflow check.
+ [ruby-dev:31736]
- * test/thread/test_thread.rb (test_mutex_exception_handling):
- test for above.
+ * array.c (rb_ary_splice): ditto. [ruby-dev:31737]
-Mon Sep 17 05:01:55 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * array.c (rb_ary_fill): ditto. [ruby-dev:31738]
- * runruby.rb: fix incomplete backport r12339.
+ * string.c (rb_str_splice): integer overflow for length.
+ [ruby-dev:31739]
-Mon Sep 17 04:56:28 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Sep 2 00:48:15 2007 Tadayoshi Funaba <tadf@dotrb.org>
- * test/thread/test_thread.rb (test_local_barrier),
- test/thread/lbtest.rb: test for [ruby-dev:30653].
+ * lib/date/format.rb (_parse): improved parsing of ordinal dates.
-Mon Sep 17 04:52:21 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+ * lib/date/format.rb (_parse): use named character classes in some
+ regular expressions.
- * ruby.c (proc_options): -W should be allowed in RUBYOPT
- environment variable. [ruby-core:12118]
+Sat Sep 1 08:13:36 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Mon Sep 17 04:37:10 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+ * ext/win32ole/win32ole.c: add WIN32OLE#ole_activex_initialize.
- * range.c (range_step): fixed integer overflow. [ruby-dev:31763]
+Thu Aug 30 13:13:13 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Sep 7 17:06:16 2007 Vincent Isambart <vincent.isambart@gmail.com>
+ * lib/mkmf.rb (try_const, have_const): check for a const is defined.
+ [ruby-core:04422]
- * eval.c (rb_thread_start_0): should unset time_thread_alive_p.
- [ruby-talk:257219], [ruby-core:11542], [ruby-dev:31253]
+Thu Aug 30 13:10:57 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Sep 7 16:39:23 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+ * configure.in (group_member): check if presents.
- * array.c (rb_ary_subseq): need integer overflow check.
- [ruby-dev:31736]
+ * configure.in (XCFLAGS): add _GNU_SOURCE on linux.
- * array.c (rb_ary_splice): ditto. [ruby-dev:31737]
+ * file.c (group_member): use system routine if available.
- * array.c (rb_ary_fill): ditto. [ruby-dev:31738]
+Thu Aug 30 08:24:18 2007 Tanaka Akira <akr@fsij.org>
- * string.c (rb_str_splice): integer overflow for length.
- [ruby-dev:31739]
+ * ruby.h (RHASH_TBL): defined for compatibility to 1.9.
+ * (RHASH_ITER_LEV): ditto.
+ * (RHASH_IFNONE): ditto.
+ * (RHASH_SIZE): ditto.
+ * (RHASH_EMPTY_P): ditto.
-Fri Sep 7 16:33:23 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+Wed Aug 29 13:05:59 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* include/ruby/defines.h (flush_register_windows): call "ta 0x03"
even on Linux/Sparc. [ruby-dev:31674]
-Fri Sep 7 16:09:39 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+Tue Aug 28 23:26:12 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * ext/win32ole/win32ole.c (ole_type_progid, reg_enum_key,
- reg_get_val, ole_wc2mb): fix the bug. Thanks, arton.
+ * ext/win32ole/win32ole.c (ole_type_progid, reg_enum_key,
+ reg_get_val, ole_wc2mb): fix the bug. Thanks, arton.
[ruby-dev:31576]
-Fri Sep 7 15:50:50 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+Mon Aug 27 19:10:50 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/etc/etc.c (etc_getlogin): update documentation to note
+ security issue. [ruby-Bugs-11821]
+
+Tue Aug 21 21:09:48 2007 Tanaka Akira <akr@fsij.org>
+
+ * lib/tmpdir.rb (Dir.mktmpdir): make directory suffix specifiable.
+
+Tue Aug 21 13:57:04 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (st_foreach_func, rb_foreach_func): typedefed.
+
+Mon Aug 20 17:25:33 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (mnew): should preserve noex as safe_level.
* eval.c (rb_call0): tighten security check condition..
-Fri Sep 7 15:43:43 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Aug 18 21:32:20 2007 Tanaka Akira <akr@fsij.org>
+
+ * lib/tmpdir.rb (Dir.mktmpdir): new method.
+ [ruby-dev:31462]
+
+Sat Aug 18 17:44:42 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/tk/tcltklib.c (Init_tcltklib): use rb_set_end_proc().
-Fri Sep 7 15:42:07 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Aug 18 15:59:52 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* process.c (detach_process_watcher): should not pass the pointer
to an auto variable to the thread to be created. pointed and
fix by KUBO Takehiro <kubo at jiubao.org> [ruby-dev:30618]
-Fri Sep 7 15:40:47 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Aug 18 12:24:30 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* sample/test.rb, test/ruby/test_system.rb(valid_syntax?): keep
comment lines first.
-Wed Aug 22 12:40:15 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Aug 16 20:40:50 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (bigtrunc): RBIGNUM(x)->len may be zero. out of bound
+ access. [ruby-dev:31404]
+
+Thu Aug 16 16:46:07 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (aix): enable shared by default.
+
+ * configure.in (aix): for 64bit-mode AIX. [ruby-dev:31401]
+ + use CC for LDSHARED if non-gcc,
+ + moved -G option from *LDFLAGS to LDSHARED,
+ + set -brtl only in XLDFLAGS.
+
+Thu Aug 16 13:06:08 2007 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (big_lshift): make shift offset long type.
+ (big_rshift): ditto.
+ (rb_big_lshift): ditto.
+ (big_rshift): ditto.
+ [ruby-dev:31434]
+
+Thu Aug 16 04:09:19 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/rinda/tuplespace.rb (Rinda::TupleSpace#start_keeper): improve
+ keeper thread.
+
+Wed Aug 15 13:50:10 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* hash.c (rb_hash_delete_key): delete the entry without calling block.
@@ -455,24 +3424,36 @@ Wed Aug 22 12:40:15 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
Sun Arg 12 03:56:30 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* lib/rinda/tuplespace.rb: fix Rinda::TupleSpace keeper thread bug.
- the thread is started too early. [ruby-talk:264062]
+ the thread is started too early. [ruby-talk:264062]
* test/rinda/test_rinda.rb: ditto.
-Wed Aug 22 12:31:15 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Aug 11 07:34:10 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb: reverted some wrongly erased "o" options
+ (pointed out by nobu).
+
+Tue Aug 7 14:58:39 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/pty/pty.c (establishShell): handshaking before close slave
+ device. [ruby-talk:263410]
+
+ * ext/pty/pty.c (MasterDevice, SlaveDevice, deviceNo): constified.
+
+ * ext/pty/pty.c (SlaveName): removed static buffer.
+
+ * ext/pty/expect_sample.rb: support for autologin.
+
+Tue Aug 7 12:45:13 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (ac_cv_func_isinf): set yes also on OpenSolaris.
[ruby-Bugs-12859]
-Wed Aug 22 12:30:42 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Aug 6 17:36:29 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/rexml/encodings/{ISO-8859-15,CP-1252}.rb: fixed invalid syntax.
-Wed Aug 22 12:29:36 2007 Tadayoshi Funaba <tadf@dotrb.org>
-
- * lib/README: fixed a typo.
-
-Wed Aug 22 12:13:54 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Aug 3 11:05:54 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/extmk.rb (extmake): save all CONFIG values.
@@ -482,20 +3463,37 @@ Wed Aug 22 12:13:54 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/extmk.rb: remove rdoc at clean, and installed list file at
distclean, respectively.
-Wed Aug 22 11:49:00 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Aug 3 07:09:05 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb: more verbose message. [ruby-Bugs-12766]
+
+ * lib/mkmf.rb (have_type): suppress a warning with -Wall.
+
+ * lib/mkmf.rb (find_type): new method.
+
+Thu Aug 2 13:46:39 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* sprintf.c (rb_f_sprintf): should not check positional number as
width. [ruby-core:11838]
-Wed Aug 22 11:47:11 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jul 30 11:16:40 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* bignum.c (rb_big_aref): check for Bignum index range.
- [ruby-dev:31271]
+ [ruby-dev:31271]
+
+Sat Jul 28 09:35:41 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
-Wed Aug 22 11:41:44 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/digest/lib/digest.rb (Digest::self.const_missing): avoid
+ infinite recursive const_missing call. [ruby-talk:262193]
+
+Thu Jul 26 13:57:45 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dln.c (load_1, dln_find_1): constified.
* dln.c (conv_to_posix_path): removed.
+ * ruby.c (usage): constified.
+
* ruby.c (rubylib_mangled_path, rubylib_mangled_path2): return
VALUE instead of a pointer to static buffer.
@@ -504,26 +3502,77 @@ Wed Aug 22 11:41:44 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ruby.c (ruby_init_loadpath): not convert built-in paths.
-Wed Aug 22 11:39:31 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Jul 22 16:07:12 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* intern.h (is_ruby_native_thread): removed since declared as an int
function in ruby.h already.
-Wed Aug 22 11:00:20 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Jul 22 14:33:40 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_file_s_rename): deleted code to get rid of a bug of
+ old Cygwin.
+
+ * file.c (rb_file_truncate): added prototype of GetLastError()
+ on cygwin. [ruby-dev:31239]
+
+ * intern.h (is_ruby_native_thread): prototype.
+
+ * missing/strftime.c (strftime): fix printf format and actual
+ arguments.
+
+ * ext/Win32API/Win32API.c (Win32API_initialize): ditto.
+
+ * ext/tk/tcltklib.c (ip_finalize): ditto.
+
+ * ext/dl/ptr.c (rb_dlptr_inspect): ditto. [ruby-dev:31268]
+
+ * ext/dl/sym.c (rb_dlsym_inspect): ditto.
+
+ * ext/socket/getnameinfo.c: include stdio.h always.
+
+ * ext/win32ole/win32ole.c (ole_hresult2msg, folevariable_name,
+ folevariable_ole_type, folevariable_ole_type_detail,
+ folevariable_value, folemethod_visible): missing return value.
+
+Sat Jul 21 17:48:26 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (create_makefile): make OBJS depend on RUBY_EXTCONF_H
+ only if extconf.h is created.
+
+ * bcc32/{Makefile.sub,configure.bat,setup.mak: configure_args
+ support.
+
+ * bcc32/setup.mak: check runtime version.
+
+ * win32/win32.c (rb_w32_open_osfhandle): prototype has changed
+ in bcc 5.82.
+
+ * {win32,wince,bcc32}/setup.mak (-version-): no RUBY_EXTERN magic.
+
+ * win32/resource.rb: include patchlevel number.
+
+Sat Jul 21 12:06:48 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/mkmf.rb (init_mkmf): should remove mkmf.log too.
-Wed Aug 22 10:57:50 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Jul 21 01:53:17 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb (Date._parse): completes calendar week based year.
+
+ * lib/date/format.rb (Date._parse): detects year of ordinal date in
+ extended format.
+
+Fri Jul 20 15:22:51 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/openssl/ossl_config.c (ossl_config_set_section): do not
initialize aggregations with dynamic values. [ruby-talk:259306]
-Wed Aug 22 10:55:00 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Jul 19 19:24:14 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (get_backtrace): check the result more.
[ruby-dev:31261] [ruby-bugs-12398]
-Wed Aug 22 10:36:15 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Jul 19 14:38:45 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* bignum.c (rb_big_lshift, rb_big_rshift): separated functions
to get rid of infinite recursion. fixed calculation in edge
@@ -531,35 +3580,48 @@ Wed Aug 22 10:36:15 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* numeric.c (rb_fix_lshift, rb_fix_rshift): ditto.
-Wed Aug 22 10:29:45 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Jul 18 16:57:41 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* bignum.c (rb_big_pow): refine overflow check. [ruby-dev:31242]
-Wed Aug 22 10:26:59 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+Wed Jul 18 08:47:09 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* time.c (time_succ): Time#succ should return a time object in the
same timezone mode to the original. [ruby-talk:260256]
-Wed Aug 22 10:24:00 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+Tue Jul 17 00:50:53 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
- * numeric.c (fix_pow): integer power calculation: 0**n => 0,
+ * numeric.c (fix_pow): integer power calculation: 0**n => 0,
1**n => 1, -1**n => 1 (n: even) / -1 (n: odd).
* test/ruby/test_fixnum.rb (TestFixnum::test_pow): update test
suite. pow(-3, 2^64) gives NaN when pow(3, 2^64) gives Inf.
-Wed Aug 22 10:23:01 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+Mon Jul 16 23:07:51 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/base64.rb (Base64::b64encode): should not specify /o option
for regular expression. [ruby-dev:31221]
-Wed Aug 22 10:20:32 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jul 16 18:29:33 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_rindex_m): accept string-like object convertible
+ with #to_str method, as well as rb_str_index_m. [ruby-core:11692]
+
+Mon Jul 16 05:45:53 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* sprintf.c (rb_f_sprintf): more checks for format argument.
[ruby-core:11569], [ruby-core:11570], [ruby-core:11571],
[ruby-core:11573]
-Wed Aug 22 10:13:45 2007 pegacorn <subscriber.jp AT gmail.com>
+Mon Jul 16 00:26:10 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big_pow): removed invariant variable. [ruby-dev:31236]
+
+Sun Jul 15 23:59:57 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big_neg): SIGNED_VALUE isn't in 1.8.
+
+Sun Jul 15 22:24:49 2007 pegacorn <subscriber.jp AT gmail.com>
* ext/digest/digest.c (rb_digest_instance_update,
rb_digest_instance_finish, rb_digest_instance_reset,
@@ -585,101 +3647,198 @@ Wed Aug 22 10:13:45 2007 pegacorn <subscriber.jp AT gmail.com>
* win32.h (rb_w32_getcwd): prototype added. [ruby-dev:31232]
-Wed Aug 22 10:11:59 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Jul 15 21:07:43 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (bigtrunc): do not empty Bignum. [ruby-dev:31229]
+
+Sun Jul 15 19:05:28 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* bignum.c (rb_cstr_to_inum): check leading non-digits.
[ruby-core:11691]
-Wed Aug 22 10:07:48 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Jul 15 04:42:20 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * bignum.c (rb_big_neg): SIGNED_VALUE isn't in 1.8.
+ * bignum.c (get2comp): do nothing for empty Bignum. [ruby-dev:31225]
- * bignum.c (bigtrunc): do not empty Bignum. [ruby-dev:31229]
+Sat Jul 14 14:04:06 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Aug 22 10:02:42 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+ * enum.c (sort_by_cmp): check if reentered. [ruby-dev:24291]
+
+Sat Jul 14 12:44:14 2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/openssl/test_pkcs7.rb: reverted the previous patch. it should
+ be as it was to check interface compatibility. sorry for bothering
+ with this.
+
+Sat Jul 14 12:16:17 2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/openssl/test_pkcs7.rb: follow the library change. applied a
+ patch from <zn at mbf.nifty.com> [ruby-dev:31214].
+ NOTE: r12496 imports the latest openssl libs from trunk to ruby_1_8
+ though its's not ChangeLog-ed. maintainer should aware that.
+
+Sat Jul 14 02:51:52 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* numeric.c (fix_pow): 0**2 should not raise floating point
exception. [ruby-dev:31216]
-Wed Aug 22 10:01:08 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Jul 14 02:25:48 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (int_pow): wrong overflow detection. [ruby-dev:31213]
+
+ * numeric.c (int_pow): wrong overflow detection. [ruby-dev:31215]
+
+Fri Jul 13 16:10:00 2007 Tanaka Akira <akr@fsij.org>
+
+ * lib/open-uri.rb (URI::Generic#find_proxy): use ENV.to_hash to access
+ http_proxy environment variable to avoid case insensitive
+ environment search.
+
+Fri Jul 13 15:02:15 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* win32/win32.c (CreateChild): enclose command line except for
command.com which can not handle quotes. [ruby-talk:258939]
-Wed Aug 22 09:58:30 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jul 13 10:10:46 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/mkmf.rb (link_command, cc_command, cpp_command): do not expand
::CONFIG which is an alias of MAKEFILE_CONFIG.
-Wed Aug 22 09:55:08 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Jul 12 17:03:15 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* struct.c (rb_struct_init_copy): disallow changing the size.
[ruby-dev:31168]
-Wed Aug 22 09:54:28 2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+Wed Jul 11 23:38:14 2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* random.c: documentation fix. srand(0) initializes PRNG with '0',
not with random_seed.
-Wed Aug 22 09:53:14 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jul 10 14:50:01 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* bcc32/{Makefile.sub,setup.mak}: remove surplus slash from srcdir.
-Wed Aug 22 09:46:25 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jul 6 15:22:58 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_interrupt): suppress a gcc's officious warning.
+
+Thu Jul 5 16:44:28 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * numeric.c (int_pow): fix previous nubu's commit.
+
+ * test/ruby/test_fixnum.rb: new test.
+
+Thu Jul 5 15:56:06 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * numeric.c (int_pow): even number multiplication never be negative.
+
+Mon Jul 2 14:34:43 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* sprintf.c (rb_f_sprintf): sign bit extension should not be done
if FPLUS flag is specified. [ruby-list:39224]
-Wed Aug 22 09:41:56 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+Sat Jun 30 16:05:41 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* array.c (rb_ary_initialize): should call rb_ary_modify() first.
[ruby-core:11562]
-Wed Aug 22 09:40:25 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Jun 30 00:17:00 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (yylex): return non-valid token for an invalid
- instance/class variable name. a patch from from Yusuke ENDOH
+ instance/class variable name. a patch from Yusuke ENDOH
<mame AT tsg.ne.jp>. [ruby-dev:31095]
-Wed Aug 22 09:39:26 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jun 29 11:23:09 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (dsym): return non-null NODE even if yyerror(). based on a
- patch from from Yusuke ENDOH <mame AT tsg.ne.jp>. [ruby-dev:31085]
+ patch from Yusuke ENDOH <mame AT tsg.ne.jp>. [ruby-dev:31085]
-Wed Aug 22 09:38:43 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jun 26 16:35:21 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (ruby_setreuid, ruby_setregid): rename to get rid of name
+ clash.
* process.c (proc_exec_v, rb_proc_exec): preserve errno.
-Wed Aug 22 09:00:23 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Jun 23 00:37:46 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (rb_hash_select): remove unnecessary varargs for
+ rb_hash_select. a patch from Daniel Berger
+ <Daniel.Berger at qwest.com>. [ruby-core:11527]
+
+ * hash.c: ditto.
+
+Mon Jun 18 08:47:54 2007 Technorama Ltd. <oss-ruby@technorama.net>
+
+ * ext/openssl/{extconf.rb,ossl_ssl_session.c}:
+ Fix ruby-Bugs-11513.
+
+ * ext/openssl/ossl_pkey_ec.c
+ New methods EC::Point.[eql,make_affine!,invert!,on_curve?,infinity?]
+ By default output the same key form as the openssl command.
+
+ * ext/openssl/ossl_rand.c
+ New method Random.status?
+
+Mon Jun 18 13:54:36 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (ruby_cleanup): return EXIT_FAILURE if any exceptions occured
in at_exit blocks. [ruby-core:11263]
-Wed Aug 22 08:52:02 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jun 18 01:14:10 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* variable.c (rb_path2class): get rid of dangling pointer caused by
optimized out value.
-Wed Aug 22 08:51:20 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+ * variable.c (rb_global_entry, rb_f_untrace_var, rb_alias_variable,
+ rb_generic_ivar_table, generic_ivar_get, generic_ivar_set,
+ generic_ivar_defined, generic_ivar_remove, rb_mark_generic_ivar,
+ rb_free_generic_ivar, rb_copy_generic_ivar,
+ rb_obj_instance_variables): suppress warnings.
+
+Fri Jun 15 22:33:29 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (realclean): separate local and ext.
+
+ * ext/extmk.rb: not remove unrelated directories.
+
+Fri Jun 15 17:01:20 2007 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/dl/lib/dl/win32.rb: seems that dl doesn't accept void argument.
fixed [ruby-bugs:PR#5489].
-Wed Aug 22 08:49:47 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Jun 14 17:09:48 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser): handle more
+ extensions. [ruby-dev:30972]
+
+Wed Jun 13 06:05:12 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (darwin): prohibit loading extension libraries to
miniruby.
-Wed Aug 22 08:34:20 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Jun 13 05:47:58 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (rb_kill_thread): renamed in order to get rid of conflict
with a BeOS system function. [ruby-core:10830]
-Wed Aug 22 08:32:32 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jun 12 14:53:51 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * process.c (ruby_setreuid, ruby_setregid): rename to get rid of name
- clash.
-Wed Aug 22 08:27:53 2007 Shugo Maeda <shugo@ruby-lang.org>
+ * lib/mkmf.rb (Logging.quiet, Logging.message): added quiet flag and
+ use it. [ruby-core:10909]
+
+ * lib/mkmf.rb (find_header): use header names in the message.
+
+Sun Jun 10 13:47:36 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_beginendblock.rb (test_should_propagate_signaled):
+ get rid of invoking shell. [ruby-dev:30942]
+
+Thu Jun 7 19:02:48 2007 Tanaka Akira <akr@fsij.org>
+
+ * lib/pp.rb: call original "method" method instead of redefined one.
+
+Mon Jun 4 11:11:12 2007 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/imap.rb (ResponseParser#next_token): fixed
error message. (backported from HEAD)
@@ -688,28 +3847,20 @@ Wed Aug 22 08:27:53 2007 Shugo Maeda <shugo@ruby-lang.org>
the condition not to refer @token.symbol unexpectedly.
Thanks, Dick Monahan. (backported from HEAD)
-Wed Aug 22 08:26:33 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * marshal.c (w_extended): erroneous check condition when dump
- method is defined. [ruby-core:10646]
-
-Mon Jun 18 11:29:49 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * intern.h, ext/thread/thread.c: moved prototype of rb_thread_status()
- to get rid of error in C++. [ruby-list:43615]
+Thu May 31 17:27:53 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Jun 10 13:47:36 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/test_beginendblock.rb (test_should_propagate_signaled):
- get rid of invoking shell. [ruby-dev:30942]
+ * lib/benchmark.rb (Benchmark::Job::item): avoid modifying the
+ argument unintentionally. [ruby-talk:253676]
-Sat Jun 9 10:40:00 2007 URABE Shyouhei <shyouhei@ruby-lang.org>
+Thu May 31 02:12:32 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
- * stable version 1.8.6-p36 released.
+ * lib/rinda/tuplespace.rb (Rinda::TupleBag): create index on tuple bag
+ by first column.
-Fri Jun 8 17:50:17 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed May 30 13:27:40 2007 Shugo Maeda <shugo@ruby-lang.org>
- * eval.c (rb_thread_cancel_timer): fix undefined function
+ * lib/net/ftp.rb (Net::FTP#transfercmd): skip 2XX
+ responses for some FTP servers. (backported from HEAD)
Wed May 30 05:17:55 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
@@ -734,34 +3885,16 @@ Tue May 29 11:01:06 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* win32/win32.c (rb_w32_opendir, rb_w32_readdir): eliminate magic
numbers.
-Thu Jun 7 20:10:51 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c, intern.h, ext/thread/thread.c: should not free queue
- while any live threads are waiting.
- [ruby-dev:30653]
-
-Thu Jun 7 14:53:46 2007 URABE Shyouhei <shyouhei@ruby-lang.org>
+Mon May 28 02:54:05 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
- * eval.c (method_inspect): show proper class name.
- [ruby-talk:248647], Thanks Calamitas.
+ * lib/rinda/tuplespace.rb (Rinda::TupleBag#delete): use rindex and
+ delete_at instead of delete for little improvement.
-Sun May 27 05:24:56 2007 URABE Shyouhei <shyouhei@ruby-lang.org>
+Sat May 26 00:05:22 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * runruby.rb: eliminate uninitialized variable.
- [ruby-core:11255]
-
-Sun May 27 05:19:03 2007 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * eval.c (mnew): call of super via a method object should work again.
- [ruby-talk:248647], Thanks Calamitas.
-
- * test/ruby/test_method.rb (TestMethod::test_method_super): test for
- above fix.
-
-Wed May 23 07:29:53 2007 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * process.c (proc_exec_v): terminate timer thread in advance.
- [ruby-dev:30581], Thanks H. Holon.
+ * test/ruby/test_beginendblock.rb (test_should_propagate_signaled):
+ skip tests for exitstatus and termsig on the platforms where
+ signals not supported.
Wed May 23 06:51:46 2007 URABE Shyouhei <shyouhei@ruby-lang.org>
@@ -774,35 +3907,119 @@ Wed May 23 05:49:49 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
load path to get rid of load pre-installed extensions/libraries.
[ruby-core:11017]
-Wed May 23 06:14:15 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat May 19 10:29:18 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb (Date._parse): detects some OFX dates
+ (Of course not fully).
+
+Fri May 18 23:07:33 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_first): call rb_ary_subseq() instead of pushing
+ values by itself. [ruby-talk:252062]
+
+ * array.c (rb_ary_first): add negative length check.
+
+Fri May 18 17:10:31 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* win32/win32.c (move_to_next_entry): loc also must move forward.
[ruby-talk:251987]
-Wed May 23 05:55:04 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri May 18 03:02:40 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/mkexports.rb: preserve prefixed underscores for WINAPI
+ symbols.
+
+ * wince/mkconfig_wce.rb, wince/mkexports.rb: obsolete.
+
+Thu May 17 17:03:11 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-style.el (ruby-style-label-indent): for yacc rules.
+
+Tue May 15 14:54:07 2007 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (init_stdhandle): stderr should be without buffering,
but mswin32 use buffering when stderr is not connected to tty.
-Wed May 23 05:35:42 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon May 14 13:28:03 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * bignum.c (rb_big_pow): truncate all zero BDIGITs. [ruby-dev:30733]
+ * ext/thread/thread.c (wait_list): supress a warning.
-Wed May 23 05:17:33 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu May 10 15:21:51 2007 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/iconv/iconv.c (iconv_s_conv): rdoc fix.
-Wed May 23 05:10:02 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu May 10 10:14:14 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (rb_thread_priority): rdoc fix; the initial value is
inherited from the creating thread. [ruby-core:10607]
-Wed May 23 04:22:57 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed May 9 12:28:57 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (Init_Bignum), numeric.c (Init_Numeric): added fdiv as
+ aliases of quo. [ruby-dev:30771]
+
+Wed May 9 11:55:15 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big_quo): now calculate in integer. [ruby-dev:30753]
+
+Wed May 9 11:51:06 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big_pow): reduce multiplying for even number.
+
+ * bignum.c (rb_big_pow): truncate all zero BDIGITs. [ruby-dev:30733]
+
+ * bignum.c (rb_big_pow): improvement by calculating from MSB and using
+ factorization. <http://yowaken.dip.jp/tdiary/20070426.html#p01>
+
+ * numeric.c (int_pow): calculate power in Fixnum as possible.
+ [ruby-dev:30726]
+
+Tue May 8 23:42:51 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb (Date._parse): revised treatment of
+ hyphened/separatorless dates.
+
+ * lib/date/format.rb: some trivial adjustments.
+
+Tue May 8 20:25:05 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb: reverted.
+
+Sat May 5 16:26:33 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/date/format.rb (Format::Bag#method_missing): get rid of
+ modifying orginal argument. [ruby-core:11090]
+
+Mon Apr 30 01:17:51 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/rinda/tuplespace.rb (TupleSpace#create_entry, TupleBag#push,
+ delete): extract method, and rename parameter.
+
+Fri Apr 27 02:00:17 2007 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * signal.c: Fixed backwards compatibility for 'raise Interrupt'.
+
+ * lib/yaml/tag.rb: Running rdoc over the 1.8.6 tree skips
+ Module. Patch from James Britt
+
+Thu Apr 26 13:54:51 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-style.el: new file. C/C++ style for ruby source code.
+
+Wed Apr 25 19:49:16 2007 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/socket.c (unix_send_io, unix_recv_io): use CMSG_DATA to
+ align file descriptor appropriately.
+
+Tue Apr 24 09:33:57 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* dir.c (do_stat, do_lstat, do_opendir): should not warn ENOTDIR.
[ruby-talk:248288]
-Wed May 23 03:50:35 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Apr 23 22:14:42 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb ($ruby): add extout directory to include path.
+ [ruby-core:11003]
* lib/mkmf.rb (libpathflag): not to append RPATHFLAG to current
directory.
@@ -812,16 +4029,29 @@ Wed May 23 03:50:35 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/mkmf.rb (LINK_SO): LIBPATH to be placed before DLDFLAGS.
-Wed May 23 03:33:55 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Apr 20 16:05:22 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (LIBPATHFLAG, RPATHFLAG): no needs to be quoted,
+ it is done by libpathflag in mkmf.rb.
+
+Fri Apr 20 12:27:04 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb: fix to override conv proc.
+
+Fri Apr 20 12:17:05 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (ruby_cleanup): inversed the order of errinfos.
+
+Thu Apr 19 14:53:32 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/monitor.rb (ConditionVariable#wait, mon_enter, mon_exit_for_cond):
ensures Thread.critical to be false. [ruby-talk:248300]
-Wed May 23 03:25:13 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Apr 18 10:41:21 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* util.c (ruby_strtod): exponent is radix 10. [ruby-talk:248272]
-Wed May 23 03:12:17 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Apr 18 02:30:24 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (LDFLAGS): prepend -L. instead appending it to
XLDFLAGS. [ruby-core:10933]
@@ -829,7 +4059,7 @@ Wed May 23 03:12:17 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (Makefile): remove $U for automake from MISSING.
[ruby-talk:248171]
-Wed May 23 02:09:32 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+Tue Apr 17 16:46:46 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_yield_0): should not clear state on TAG_NEXT when
it's invoked from within lambda body. [ruby-talk:248136]
@@ -837,25 +4067,66 @@ Wed May 23 02:09:32 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (proc_invoke): handle TAG_NEXT which would be caused by
next in the lambda body as well.
-Wed May 23 01:55:49 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Apr 16 22:56:01 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/pty/expect_sample.rb: avoid symbolic link representation for
+ expect. a patch from Kazuhiro NISHIYAMA <zn at mbf.nifty.com>.
+ [ruby-dev:30714]
+
+Mon Apr 16 22:51:11 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * sample: replace TRUE, FALSE with true, false respectively.
+ a patch from Kazuhiro NISHIYAMA <zn at mbf.nifty.com>.
+ [ruby-dev:30713]
+
+Mon Apr 16 17:08:02 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (make_switch): do not clobber converter if pattern
+ has no convert method. reported by sheepman in [ruby-dev:30709].
+
+Mon Apr 16 16:49:32 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_seek): consistent behavior with
+ IO#seek. patch by sheepman in [ruby-dev:30710].
+
+Mon Apr 16 16:34:08 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (parser_yylex): should set command_start after block
+ starting "do"s and braces. [ruby-core:10916]
+
+Sun Apr 15 09:19:57 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb: added some zone names.
+
+ * lib/date/format.rb (_parse): now interprets doted numerical
+ dates as a big endian (except dd.mm.yyyy).
+
+Tue Apr 10 17:37:36 2007 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (rb_w32_fclose, rb_w32_close): need to save errno
before calling original fclose()/close().
-Wed May 23 01:42:29 2007 Shugo Maeda <shugo@ruby-lang.org>
+Mon Apr 9 09:30:44 2007 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/imap.rb (disconnect): call shutdown for
SSLSocket. Thanks, Technorama Ltd.
-Wed May 23 01:28:14 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Apr 5 00:42:48 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* error.c (rb_notimplement), io.c (pipe_open): removed definite
articles and UNIX manual section from messages. [ruby-dev:30690]
+Wed Apr 4 17:09:17 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (pipe_open): refined the message of NotImplementedError.
+ [ruby-dev:30685]
+
+Wed Apr 4 10:18:04 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
* io.c (pipe_open): raise NotImplementedError for command "-" on
platforms where fork(2) is not available. [ruby-dev:30681]
-Wed May 23 00:03:42 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue Apr 3 15:45:41 2007 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/socket/socket.c (s_recv, s_recvfrom): some systems (such as
windows) doesn't set fromlen if the socket is connection-oriented.
@@ -873,7 +4144,7 @@ Sat Mar 24 23:40:29 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (io_fread): ditto.
-Tue May 22 23:27:16 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Mar 24 01:54:03 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (ruby_cleanup): exit by SystemExit and SignalException in END
block. [ruby-core:10609]
@@ -884,26 +4155,55 @@ Tue May 22 23:27:16 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* test/ruby/test_beginendblock.rb (test_should_propagate_signaled):
test for signal in END block.
-Tue May 22 23:14:19 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Mar 22 23:13:17 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (rb_provided): check for extension library if SOEXT is
explicitly given. [ruby-dev:30657]
-Tue May 22 21:29:08 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Mar 22 10:29:25 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_bignum.rb (test_to_s): add tests for Bignum#to_s.
+
+Wed Mar 21 17:04:30 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* bignum.c (rb_big2str0): round up for the most significant digit.
[ruby-core:10686]
-Tue May 22 20:53:02 2007 Akinori MUSHA <knu@iDaemons.org>
+Wed Mar 21 07:21:24 2007 Akinori MUSHA <knu@iDaemons.org>
* ext/thread/thread.c (remove_one): Preserve List invariants;
submitted by: MenTaLguY <mental AT rydia.net>
in [ruby-core:10598] and [ruby-bugs:PR#9388].
+Tue Mar 20 22:54:50 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_extended): erroneous check condition when dump
+ method is defined. [ruby-core:10646]
+
Tue Mar 20 15:37:24 2007 URABE Shyouhei <shyouhei@ruby-lang.org>
* distruby.rb: Add zip generation.
+Tue Mar 20 11:28:41 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/matrix.rb (Matrix::inverse_from): adding partial pivoting to
+ the Gauss-Jordan algorithm, making it stable. a patch from
+ Peter Vanbroekhoven. [ruby-core:10641]
+
+Mon Mar 19 11:39:29 2007 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/protocol.rb (rbuf_read): extend buffer size for speed.
+
+Sun Mar 18 04:23:52 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * NEWS: Add a note about the new `date' library defining
+ Time#to_date and Time#to_datetime private methods.
+
+ * NEWS: Inform that the old `thread' library is considered to be
+ stable.
+
+ * NEWS: Sort library entries in alphabetical order.
+
Fri Mar 16 21:48:11 2007 Akinori MUSHA <knu@iDaemons.org>
* ext/dl/dl.c (rb_ary2cary): Fix a bug in type validation;
@@ -944,11 +4244,24 @@ Wed Mar 14 12:30:00 2007 Shigeo Kobayashi <shigeo@tinyforest.jp>
* ext/bigdecimal/bigdecimal.c: BigDecimal("-.31") is now
treated as ("-0.31") not as ("0.31").
-Tue Mar 13 04:04:04 2007 Akinori MUSHA <knu@iDaemons.org>
+Tue Mar 13 09:25:10 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (clear-installed-list): separated from install-prereq.
- * stable version 1.8.6 released.
+Tue Mar 13 06:38:43 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * NEWS: Reword and improve entries.
+
+Tue Mar 13 06:03:46 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * stable version 1.8.6 released from the ruby_1_8_6 branch.
+
+Tue Mar 13 03:24:07 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * runruby.rb: added --pure (turned on by default) and --debugger
+ options.
-Tue Mar 13 02:54:17 2007 Akinori MUSHA <knu@iDaemons.org>
+Tue Mar 13 02:50:28 2007 Akinori MUSHA <knu@iDaemons.org>
* lib/cgi.rb (CGI::header): IIS >= 5.0 does not need the nph
assumption any more; submitted by MIYASAKA Masaru <alkaid AT
@@ -980,7 +4293,7 @@ Mon Mar 12 11:07:44 2007 Akinori MUSHA <knu@iDaemons.org>
* ext/openssl/ossl_ssl.c (Init_ossl_ssl): Ditto.
-Mon Mar 12 01:23:50 2007 Akinori MUSHA <knu@iDaemons.org>
+Mon Mar 12 01:05:17 2007 Akinori MUSHA <knu@iDaemons.org>
* ext/dl/sym.c (rb_dlsym_inspect): Use "0x%x" rather for pointers.
This might not be very right but it is commonly used in other
@@ -989,14 +4302,16 @@ Mon Mar 12 01:23:50 2007 Akinori MUSHA <knu@iDaemons.org>
* ext/dl/ptr.c (rb_dlptr_inspect): Ditto.
+Mon Mar 12 00:59:19 2007 Akinori MUSHA <knu@iDaemons.org>
+
* ext/dl/lib/dl/import.rb (DL::Importable::Internal::import,
DL::Importable::Internal::callback): Avoid race condition for an
instance variable; submitted by sheepman <sheepman AT
sheepman.sakura.ne.jp> in [ruby-dev:30530].
-Sun Mar 11 19:04:29 2007 Akinori MUSHA <knu@iDaemons.org>
+Sun Mar 11 18:57:50 2007 Akinori MUSHA <knu@iDaemons.org>
- * misc/README: Add a note about ruby-electric.el.
+ * misc/README: Add a note about ruby-electric.el.
* misc/ruby-mode.el (ruby-non-block-do-re): Fix
ruby-non-block-do-re. [ruby-core:03719]
@@ -1007,14 +4322,14 @@ Sun Mar 11 19:04:29 2007 Akinori MUSHA <knu@iDaemons.org>
interface based on rubydb3x.el; submitted by Martin Nordholts
<enselic AT gmail.com> in [ruby-bugs:PR#9023].
-Sun Mar 11 17:51:46 2007 Akinori MUSHA <knu@iDaemons.org>
+Sun Mar 11 17:45:51 2007 Akinori MUSHA <knu@iDaemons.org>
* ext/dl/mkcallback.rb (mkfunc): Make sure that a callback
function is found in the function table before trying to call
it; submitted by sheepman <sheepman AT sheepman.sakura.ne.jp>
in [ruby-dev:30524].
-Sun Mar 11 17:30:53 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Mar 11 12:09:37 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (error_handle): no message when exiting by signal.
@@ -1037,63 +4352,83 @@ Sun Mar 11 17:30:53 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* signal.c (rb_signal_exec, trap): handle SIGTERM. [ruby-dev:30505]
-Tue Mar 6 19:03:42 2007 Akinori MUSHA <knu@iDaemons.org>
+Tue Mar 6 19:08:46 2007 Akinori MUSHA <knu@iDaemons.org>
* ext/digest/lib/md5.rb (MD5::new, MD5::md5): Do not modify
Digest::MD5.
* ext/digest/lib/sha1.rb (SHA1::new, SHA1::sha1): Ditto.
+Tue Mar 6 18:58:37 2007 Keiju Ishitsuka <keiju@ruby-lang.org>
+
* lib/shell/process-controller.rb: fix thread synchronization
problem for [ruby-dev:30477].
+Tue Mar 6 18:44:26 2007 Akinori MUSHA <knu@iDaemons.org>
+
* ext/digest/lib/md5.rb (MD5::new, MD5::md5): Catch up with
Digest's API changes; noted by: Kazuhiro Yoshida <moriq AT
moriq.com> in [ruby-dev:30500].
* ext/digest/lib/sha1.rb (SHA1::new, SHA1::sha1): Ditto.
+Tue Mar 6 18:24:19 2007 Akinori MUSHA <knu@iDaemons.org>
+
* time.c (time_to_s): Back out the format changes; discussed
in [ruby-dev:30495].
+Tue Mar 6 11:53:25 2007 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
* ext/tk/sample/irbtkw.rbw: fails to exit process.
-Mon Mar 5 20:26:10 2007 Akinori MUSHA <knu@iDaemons.org>
+Mon Mar 5 20:14:49 2007 Akinori MUSHA <knu@iDaemons.org>
* time.c (time_to_s): Correct the wrong format which did not
really conform to RFC 2822; pointed out by: OHARA Shigeki <os at
iij.ad.jp> in [ruby-dev:30487].
-Sun Mar 4 23:53:27 2007 Minero Aoki <aamine@loveruby.net>
-
- * lib/fileutils.rb (mv): could not move a directory between
- different filesystems. [ruby-dev:30411]
-
-Sun Mar 4 23:46:40 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Mar 4 23:38:07 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * file.c (rb_file_s_utime): allow nil to set the current time.
+ * file.c (rb_stat_s_utime): fixed a commit miss for the platforms
+ where utimes() does not exist.
- * lib/fileutils.rb (touch): ditto, and added :mtime and :nocreate
- options. fixed: [ruby-talk:219037]
+ * lib/fileutils.rb (touch): ditto.
-Sun Mar 4 23:19:00 2007 WATANABE Hirofumi <eban@ruby-lang.org>
+Sun Mar 4 14:46:56 2007 WATANABE Hirofumi <eban@ruby-lang.org>
* util.c (push_element): should return a int value.
-Sun Mar 4 01:06:55 2007 Akinori MUSHA <knu@iDaemons.org>
+Sun Mar 4 01:05:57 2007 Akinori MUSHA <knu@iDaemons.org>
* lib/set.rb (Set#^, Set#&): Correct documentation. Those methods
return sets, not arrays; noted by Oliver Frank Wittich <nietz AT
mangabrain.de>.
-Sat Mar 3 21:41:31 2007 Akinori MUSHA <knu@iDaemons.org>
+Sat Mar 3 23:01:07 2007 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (mv): could not move a directory between
+ different filesystems. [ruby-dev:30411]
+
+Sat Mar 3 22:57:11 2007 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (touch): last commit causes error if :mtime
+ option was not given.
+
+Sat Mar 3 22:37:02 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_file_s_utime): allow nil to set the current time.
+
+ * lib/fileutils.rb (touch): ditto, and added :mtime and :nocreate
+ options. fixed: [ruby-talk:219037]
+
+Sat Mar 3 21:17:35 2007 Akinori MUSHA <knu@iDaemons.org>
* eval.c (stack_check): Unset inline to fix build with GCC 3.4.6;
submitted by: NISHIMATSU Takeshi <t_nissie AT yahoo.co.jp> in
[ruby-list:43218].
cf. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24556
-Sat Mar 3 19:07:05 2007 Akinori MUSHA <knu@iDaemons.org>
+Sat Mar 3 19:05:31 2007 Akinori MUSHA <knu@iDaemons.org>
* ext/thread/thread.c (push_list): Use ALLOC().
@@ -1101,21 +4436,11 @@ Sat Mar 3 19:07:05 2007 Akinori MUSHA <knu@iDaemons.org>
* ext/thread/thread.c (rb_condvar_alloc): Ditto.
-Sat Mar 3 18:56:40 2007 Akinori MUSHA <knu@iDaemons.org>
+Sat Mar 3 18:53:11 2007 Akinori MUSHA <knu@iDaemons.org>
* NEWS: Add a note for String#intern.
-Sat Mar 3 18:36:35 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_provided): return true only for features loaded from
- .rb files, and not search actual library type. [ruby-dev:30414]
-
- * eval.c (rb_feature_p): check loading_tbl if the given ext is
- empty. [ruby-dev:30452]
-
- * eval.c (rb_feature_p): fix possible buffer overrun.
-
-Sat Mar 3 16:30:39 2007 Akinori MUSHA <knu@iDaemons.org>
+Sat Mar 3 16:23:13 2007 Akinori MUSHA <knu@iDaemons.org>
* env.h (SCOPE_CLONE): Introduce a new scope flag to prevent a
local_tbl region from getting freed many times; submitted by
@@ -1128,78 +4453,108 @@ Sat Mar 3 16:30:39 2007 Akinori MUSHA <knu@iDaemons.org>
* parse.y (top_local_setup_gen): Ditto.
-Sat Mar 3 16:09:27 2007 Akinori MUSHA <knu@iDaemons.org>
+Sat Mar 3 16:07:02 2007 Akinori MUSHA <knu@iDaemons.org>
* object.c (rb_obj_ivar_set): RDoc updated according to a
suggestion from Brian Candler <B.Candler AT pobox.com>.
[ruby-core:10469]
-Sat Mar 3 15:41:33 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Mar 1 21:38:07 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (stmt, arg): should not omit lhs of OP_ASGN1 even if
- empty. [ruby-dev:30452]
+ empty. [ruby-dev:30455]
-Thu Mar 1 04:08:30 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Mar 1 08:55:38 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * mkconfig.rb (patchlevel): read from version.h.
+ * eval.c (rb_feature_p): check loading_tbl if the given ext is
+ empty. [ruby-dev:30452]
-Thu Mar 1 03:42:09 2007 Akinori MUSHA <knu@iDaemons.org>
+ * eval.c (rb_feature_p): fix possible buffer overrun.
+
+Thu Mar 1 03:30:21 2007 Akinori MUSHA <knu@iDaemons.org>
* ext/digest/digest.c (get_digest_base_metadata): Allow inheriting
Digest::Base subclasses, which was unintentionally made
impossible while restructuring Digest classes.
-Wed Feb 28 22:10:55 2007 Akinori MUSHA <knu@iDaemons.org>
+Thu Mar 1 02:05:17 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * doc/NEWS-1.8.0: Rename NEWS to NEWS-1.8.0. This is way too old
- NEWS.
+ * mkconfig.rb (patchlevel): read from version.h.
- * NEWS: Add NEWS, a document file to keep user visible feature
- changes between releases.
+Thu Mar 1 00:09:39 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_provided): return true only for features loaded from
+ .rb files, and not search actual library type. [ruby-dev:30414]
+
+Wed Feb 28 21:15:00 2007 WATANABE Hirofumi <eban@ruby-lang.org>
* configure.in (ac_cv_func_fcntl): fcntl support for MinGW.
* missing/flock.c: workaround for MinGW.
+Wed Feb 28 20:51:32 2007 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * pack.c (pack_unpack): properly ignore non-base64 octets such as
+ UTF-8 encoded BOMs; submitted by SOUMA Yutaka <holon@radastery.jp>
+ to fix [ruby-core:10437]
+
+Wed Feb 28 18:59:57 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * NEWS: Add NEWS, a document file to keep user visible feature
+ changes between releases.
+
+Wed Feb 28 18:35:50 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
* ext/openssl/extconf.rb: no need to check unistd.h and sys/time.h.
they are already checked at configure.
reported by KOBAYASHI Yasuhiro [ruby-list:43225]
+Wed Feb 28 18:34:48 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
* lib/mkmf.rb ($DEFLIBPATH): default library paths ($(topdir), etc)
should be the first elements of library paths list.
reported by KOBAYASHI Yasuhiro [ruby-list:43225]
+Wed Feb 28 18:31:32 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * doc/NEWS-1.8.0: Rename NEWS to NEWS-1.8.0. This is way too old
+ NEWS.
+
+Wed Feb 28 01:22:58 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
* test/{dbm,gdbm}/test_{dbm,gdbm}.rb: shouldn't use host_os. use
target_os instead. reported by KOBAYASHI Yasuhiro [ruby-list:43225]
+Wed Feb 28 00:08:11 2007 URABE Shyouhei <shyouhei@ice.uec.ac.jp>
+
* mkconfig.rb (RbConfig): add CONFIG['PATCHLEVEL']
* common.mk: new target dist
* distruby.rb: new file
+Tue Feb 27 22:18:45 2007 WATANABE Hirofumi <eban@ruby-lang.org>
+
* configure.in (--enable-auto-image-base): avoid the neccessity to
rebase the shared libs as much as possible;
submitted by Corinna Vinschen <spam at vinschen.de> in
[ruby-talk:240964].
-Wed Feb 28 20:51:32 2007 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * pack.c (pack_unpack): properly ignore non-base64 octets such as
- UTF-8 encoded BOMs; submitted by SOUMA Yutaka <holon@radastery.jp>
- to fix [ruby-core:10437]
-
-Tue Feb 27 21:50:10 2007 WATANABE Hirofumi <eban@ruby-lang.org>
+Tue Feb 27 21:36:47 2007 WATANABE Hirofumi <eban@ruby-lang.org>
* util.c (__crt0_glob_function): use ruby_glob() instead of rb_globi().
+Tue Feb 27 21:33:04 2007 WATANABE Hirofumi <eban@ruby-lang.org>
+
* configure.in (ac_cv_func_setrlimit): workaround for djgpp.
-Tue Feb 27 20:49:19 2007 Akinori MUSHA <knu@iDaemons.org>
+Tue Feb 27 19:38:52 2007 Akinori MUSHA <knu@iDaemons.org>
* lib/base64.rb (Base64::b64encode): Fix documentation; submitted
by David Symonds <dsymonds@gmail.com> in [ruby-core:10432].
+Tue Feb 27 19:36:57 2007 Akinori MUSHA <knu@iDaemons.org>
+
* regex.c (calculate_must_string, slow_search, re_search): Silence
warnings regarding char * vs. unsigned char * mismatch;
submitted by Lyle Johnson <lyle.johnson@gmail.com>
@@ -1217,6 +4572,8 @@ Tue Feb 27 20:49:19 2007 Akinori MUSHA <knu@iDaemons.org>
* ext/nkf/nkf.c (rb_str_resize, rb_nkf_kconv, rb_nkf_guess1,
rb_nkf_guess2): Ditto.
+Tue Feb 27 03:40:09 2007 Akinori MUSHA <knu@iDaemons.org>
+
* ext/thread/thread.c (wait_list_cleanup, rb_mutex_try_lock):
Eliminate rb_thread_critical switching where unnecessary;
implied by shugo in [ruby-dev:30412].
@@ -1227,28 +4584,35 @@ Tue Feb 27 20:49:19 2007 Akinori MUSHA <knu@iDaemons.org>
* ext/thread/thread.c: Consistently use 0 and 1 for
rb_thread_critical values.
+Mon Feb 26 15:18:23 2007 Akinori MUSHA <knu@iDaemons.org>
+
* ext/thread/thread.c: Use xmalloc()/xfree() instead of
malloc()/free(); pointed out by shugo in [ruby-dev:30412].
+Sun Feb 25 23:02:55 2007 Akinori MUSHA <knu@iDaemons.org>
+
* lib/test/unit/autorunner.rb (Test::Unit::AutoRunner::initialize):
Initialize @workdir properly to silence a warning under -w.
Submitted by <tommy at tmtm.org> in [ruby-dev:30400].
-Sun Feb 25 02:50:51 2007 Akinori MUSHA <knu@iDaemons.org>
+Sun Feb 25 02:47:43 2007 Akinori MUSHA <knu@iDaemons.org>
* defines.h: Pull the RUBY_MBCHAR_MAXSIZE definition from trunk,
which is necessary for dir.c to compile on djgpp and emx.
-Sat Feb 24 17:04:01 2007 Tadayoshi Funaba <tadf@dotrb.org>
-
- * lib/date/format.rb: updated based on date2 4.0.3.
-
-Sat Feb 24 17:01:02 2007 Minero Aoki <aamine@loveruby.net>
+Sat Feb 24 10:42:01 2007 Minero Aoki <aamine@loveruby.net>
* ext/racc/cparse/cparse.c (cparse_params_mark): remove useless
rb_gc_mark. Thanks Tomoyuki Chikanaga. [ruby-dev:30405]
-Sat Feb 24 16:53:09 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Feb 23 15:10:46 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (set_pioinfo_extra): new function for VC++8 SP1
+ workaround. [ruby-core:10259]
+
+ * win32/win32.c (NtInitialize): call above function.
+
+Fri Feb 23 14:19:40 2007 NAKAMURA Usaku <usa@ruby-lang.org>
* signal.c (sighandler): need to tell to be interrupted to main
context when handler is installed.
@@ -1256,19 +4620,14 @@ Sat Feb 24 16:53:09 2007 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.[ch] (rb_win32_interrupted): new function to listen
interrupt.
- * win32/win32.c (set_pioinfo_extra): new function for VC++8 SP1
- workaround. [ruby-core:10259]
-
- * win32/win32.c (NtInitialize): call above function.
-
-Fri Feb 23 13:04:43 2007 Akinori MUSHA <knu@iDaemons.org>
+Fri Feb 23 13:02:17 2007 Akinori MUSHA <knu@iDaemons.org>
* numeric.c (fix_cmp, fix_equal): Remove FIX2LONG() to optimize.
suggested in
http://t-a-w.blogspot.com/2007/02/making-ruby-faster.html.
[ruby-talk:240223]
-Fri Feb 23 12:47:13 2007 James Edward Gray II <james@grayproductions.net>
+Fri Feb 23 12:43:17 2007 James Edward Gray II <james@grayproductions.net>
* lib/xmlrpc/client.rb (XMLRPC::Client::do_rpc): Make the
Content-Length parameter optional for responses in
@@ -1278,22 +4637,22 @@ Fri Feb 23 12:47:13 2007 James Edward Gray II <james@grayproductions.net>
* lib/xmlrpc/create.rb (XMLRPC::Create::conv2value): Add DateTime
support to xmlrpc; approved by the maintainer.
-Mon Feb 19 18:33:30 2007 Akinori MUSHA <knu@iDaemons.org>
-
- * ext/socket/socket.c (unix_peeraddr): wrong syscall name in error
- message for #peeraddr. a patch from Sam Roberts
- <sroberts at uniserve.com>. [ruby-core:10366]
-
-Mon Feb 19 18:27:42 2007 Akinori MUSHA <knu@iDaemons.org>
+Mon Feb 19 18:22:52 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in, defines.h, eval.c (rb_feature_p, rb_provided,
load_wait, search_required, rb_require_safe), ext/extmk.rb: Fix
a bug where a statically linked extension cannot be autoloaded.
[ruby-dev:30023] / [ruby-dev:30239]
-Thu Feb 15 20:31:07 2007 Akinori MUSHA <knu@iDaemons.org>
+Mon Feb 19 17:14:28 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
- * lib/uri/ftp.rb: Revert the previous change pending discussion.
+ * ext/socket/socket.c (unix_peeraddr): wrong syscall name in error
+ message for #peeraddr. a patch from Sam Roberts
+ <sroberts at uniserve.com>. [ruby-core:10366]
+
+Sun Feb 18 19:35:21 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb: updated based on date2 4.0.3.
Fri Feb 16 11:18:21 2007 Eric Hodel <drbrain@segment7.net>
@@ -1302,14 +4661,19 @@ Fri Feb 16 11:18:21 2007 Eric Hodel <drbrain@segment7.net>
* lib/prettyprint.rb: Suppress RDoc for PrettyPrint test suite.
-Thu Feb 15 18:10:09 2007 Akinori MUSHA <knu@iDaemons.org>
+Thu Feb 15 20:26:30 2007 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/uri/ftp.rb: Revert the previous change pending discussion.
+
+Thu Feb 15 18:08:17 2007 Akinori MUSHA <knu@iDaemons.org>
* dir.c (glob_helper): Fix the function declaration.
-Thu Feb 15 16:55:33 2007 Akinori MUSHA <knu@iDaemons.org>
+Thu Feb 15 17:13:32 2007 Akinori MUSHA <knu@iDaemons.org>
- * version.h: Branch off ruby_1_8_6 from ruby_1_8 in preparation
- for the forthcoming 1.8.6 release.
+ * version.h: Welcome to the post-1.8.6 world. Radical changes are
+ inhibited in the ruby_1_8 branch until the 1.8.6 final release
+ goes out of the door.
Thu Feb 15 16:44:14 2007 Akinori MUSHA <knu@iDaemons.org>
@@ -1440,15 +4804,15 @@ Fri Feb 9 15:46:09 2007 Akinori MUSHA <knu@iDaemons.org>
Tue Feb 06 22:06:45 2007 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/nkf/nkf-utf8/{nkf.c,utf8tbl.c}:
- imported nkf 2007-01-28.
- * Fixed: can't decode MIME encode JIS string.
- * Fixed: Fullwitdh-halfwidth conversion.
- * Support DoCoMo's and Softbank's EMOJI
- * Support CP932, CP5022x, eucJP-ms UDC
- * Support UTF-32 encoding
- * Support beyond BMP
- [ruby-dev:29700] [ruby-dev:29922] [ruby-dev:30144]
+ * ext/nkf/nkf-utf8/{nkf.c,utf8tbl.c}:
+ imported nkf 2007-01-28.
+ * Fixed: can't decode MIME encode JIS string.
+ * Fixed: Fullwitdh-halfwidth conversion.
+ * Support DoCoMo's and Softbank's EMOJI
+ * Support CP932, CP5022x, eucJP-ms UDC
+ * Support UTF-32 encoding
+ * Support beyond BMP
+ [ruby-dev:29700] [ruby-dev:29922] [ruby-dev:30144]
Wed Jan 31 14:52:09 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
@@ -1497,7 +4861,7 @@ Wed Jan 24 18:05:39 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
Tue Jan 23 11:02:33 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
- * lib/webrick/httprequest.rb (WEBrick::HTTPRequest::read_line):
+ * lib/webrick/httprequest.rb (WEBrick::HTTPRequest::read_line):
Tue Jan 23 18:26:12 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
@@ -2919,7 +6283,7 @@ Thu Jul 20 15:07:14 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
Thu Jul 20 00:06:29 2006 Keiju Ishitsuka <keiju@ishitsuka.com>
* lib/irb/completion.rb: support for completion of numeric
- number. [ruby-dev: 29038]
+ number. [ruby-dev: 29038]
Wed Jul 19 23:53:05 2006 Kouhei Sutou <kou@cozmixng.org>
@@ -6865,6 +10229,7 @@ Mon Aug 1 01:17:40 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* test/drb/ut_drb.rb: ditto.
Mon Aug 1 00:07:32 2005 Keiju Ishitsuka <keiju@ruby-lang.org>
+
* lib/irb/context.rb: fix `irb --readline` option. [ruby-list:40955]
Fri Jul 29 09:59:38 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
@@ -7349,6 +10714,7 @@ Fri Jul 1 00:18:40 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
destination object. [ruby-talk:146894]
Thu Jun 30 19:00:21 2005 Keiju Ishitsuka <keiju@ruby-lang.org>
+
* lib/irb/ruby-lex.rb (RubyLex::identify_number): alternative implements
for [ruby-dev:26410]. And support a numeric form of 0d99999.
@@ -8320,7 +11686,6 @@ Sat Apr 9 11:59:57 2005 Kouhei Sutou <kou@cozmixng.org>
- gave a name to 'x'.
- undef_method -> remove_method for avoiding a warning in ruby 1.6.
-
* lib/rss/parser.rb: @@setter -> @@setters.
* lib/rss/parser.rb
@@ -8348,34 +11713,28 @@ Sat Apr 9 11:59:57 2005 Kouhei Sutou <kou@cozmixng.org>
elements. (ex. have childlen elements, have some attributes and
a child element and so on.)
-
* lib/rss/dublincore.rb: supported multiple Dublin Core items.
* lib/rss/maker/dublincore.rb: ditto.
* lib/rss/maker/image.rb: supproted new Dublin Core API.
-
* lib/rss/maker/base.rb: added default current_element implementation.
-
* lib/rss/trackback.rb (RSS::TrackBackUtils.new_with_value_if_need):
moved to RSS::Utils.
* lib/rss/utils.rb (RSS::Utils.new_with_value_if_need):
moved from RSS::TrackBackUtils.
-
* lib/rss/maker/image.rb: fixed invalid argument of
add_need_initialize_variable bug.
* lib/rss/maker/trackback.rb: ditto.
-
* lib/rss/rss.rb (Hash#merge): added for ruby 1.6.
* lib/rss/rss.rb (RSS::BaseModel.date_writer): changed to accept nil
for date value.
-
* test/test_dublincore.rb: added tests for plural accessor and
multiple Dublin Core items.
@@ -8391,7 +11750,6 @@ Sat Apr 9 11:59:57 2005 Kouhei Sutou <kou@cozmixng.org>
* test/rss/test_maker_dc.rb (test_date): added a test for #date=
and #dc_date=.
-
* sample/rss/tdiary_plugin/rss-recent.rb:
new option: @options['rss-recent.use-image-link']:
use image as link instread of text if available.
@@ -12049,7 +15407,6 @@ Sun Sep 12 02:41:58 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tcltklib/tcltklib.c: add TclTkIp#allow_ruby_exit? and
allow_ruby_exit=
-
* ext/tk/lib/multi-tk.rb: ditto.
* ext/tk/lib/remote-tk.rb: ditto.
@@ -12635,7 +15992,6 @@ Thu Jul 15 10:15:04 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/sample/tkextlib/: add samples of Iwidget and TkTable
-
Wed Jul 14 18:08:37 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/ossl_asn1.c (ossl_asn1cons_to_der): fix type of
@@ -15112,7 +18468,6 @@ Tue Dec 30 12:30:30 2003 Dave Thomas <dave@pragprog.com>
class and a method have the same name, finding Xxx.abc was trying
to find 'abc' in method 'Xxx', not class 'Xxx'.
-
Tue Dec 30 08:32:32 2003 Dave Thomas <dave@pragprog.com>
* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_method):
@@ -15120,7 +18475,6 @@ Tue Dec 30 08:32:32 2003 Dave Thomas <dave@pragprog.com>
def each_entry(&b) Dir.foreach(@path) {|f| yield P.new(f) } end
-
Tue Dec 30 08:32:32 2003 Dave Thomas <dave@pragprog.com>
* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_method):
@@ -17026,6 +20380,7 @@ Sat Nov 8 13:49:50 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* configure.in: improvement of pthread check
Sat Nov 8 13:28:46 2003 Takaaki Tateishi <ttate@ttsky.net>
+
* ext/dl/sym.c: Add DL.win32_last_error and DL.last_error.
Thanks, Kaoru Shirai.
@@ -19863,6 +23218,7 @@ Tue Aug 12 02:48:56 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (THREAD_ALLOC): initialize IA64 members.
Mon Aug 11 22:31:50 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
* lib/debug.rb(debug_command): inspection command should inspect
resulting value even if it's nil. [ruby-dev:21180] by OMAE, jun
<jun66j5@ybb.ne.jp>.
@@ -20063,9 +23419,10 @@ For the changes before 1.8.0, see doc/ChangeLog-1.8.0
Local variables:
add-log-time-format: (lambda ()
(let* ((time (current-time))
+ (system-time-locale "C")
(diff (+ (cadr time) 32400))
(lo (% diff 65536))
- (hi (+ (car time) (/ diff 65536))))
+ (hi (+ (car time) (/ diff 65536))))
(format-time-string "%a %b %e %H:%M:%S %Y" (list hi lo) t)))
indent-tabs-mode: t
tab-width: 8
diff --git a/Makefile.in b/Makefile.in
index 314e1ed256..a37bcf65fb 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -35,6 +35,9 @@ RIDATADIR = $(DESTDIR)$(datadir)/ri/$(MAJOR).$(MINOR)/system
empty =
OUTFLAG = @OUTFLAG@$(empty)
CFLAGS = @CFLAGS@ @XCFLAGS@ @ARCH_FLAG@
+cflags = @cflags@
+optflags = @optflags@
+debugflags = @debugflags@
CPPFLAGS = -I. -I$(srcdir) @CPPFLAGS@
LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@
EXTLDFLAGS =
@@ -54,7 +57,7 @@ EXEEXT = @EXEEXT@
PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT)
RUBY = $(RUBY_INSTALL_NAME)
MINIRUBY = @MINIRUBY@ $(MINIRUBYOPT)
-RUNRUBY = @RUNRUBY@
+RUNRUBY = @RUNRUBY@ $(RUNRUBYOPT) --
#### End of system configuration section. ####
@@ -155,9 +158,12 @@ $(srcdir)/configure: $(srcdir)/configure.in
cd $(srcdir) && $(AUTOCONF)
lex.c: keywords
- @-$(RM) $@
- gperf -p -j1 -i 1 -g -o -t -N rb_reserved_word -k1,3,$$ $? > $@ || \
- cp "$(srcdir)/$@" .
+ ( gperf -C -p -j1 -i 1 -g -o -t -N rb_reserved_word -k1,3,$$ $? > $@.tmp && mv $@.tmp $@ ) || \
+ if test -f $@; then \
+ touch $@ && echo $@ touched.; \
+ else \
+ cp $(srcdir)/lex.c $@ && echo $@ copied.; \
+ fi
.y.c:
$(YACC) $<
@@ -178,3 +184,19 @@ distclean-local::
ext/extinit.$(OBJEXT): ext/extinit.c $(SETUP)
$(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(OUTFLAG)$@ -c ext/extinit.c
+
+update-rubyspec:
+ if [ -d $(srcdir)/rubyspec ]; then \
+ cd $(srcdir)/rubyspec/mspec; \
+ git pull; \
+ cd ../spec/rubyspec; \
+ git pull; \
+ else \
+ git clone $(MSPEC_GIT_URL) $(srcdir)/rubyspec/mspec; \
+ git clone $(RUBYSPEC_GIT_URL) $(srcdir)/rubyspec/spec/rubyspec; \
+ fi
+
+test-rubyspec:
+ @if [ ! -d $(srcdir)/rubyspec ]; then echo No rubyspec here. make update-rubyspec first.; exit 1; fi
+ $(RUNRUBY) $(srcdir)/rubyspec/mspec/bin/mspec -r$(srcdir)/ext/purelib.rb $(srcdir)/rubyspec/spec/rubyspec/$(MAJOR).$(MINOR)
+
diff --git a/NEWS b/NEWS
index de1dafb533..61373187e5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,55 +1,532 @@
= NEWS
This document is a list of user visible feature changes made between
-releases excluding bug fixes.
+releases except for bug fixes.
Note that each entry is kept so brief that no reason behind or
reference information is supplied with. For a full list of changes
with all sufficient information, see the ChangeLog file.
-== Changes with Ruby 1.8.5
+== Changes since the 1.8.6 release
-=== New platforms/build tools support
+=== Configuration changes
-* IA64 HP-UX
+* vendor_ruby directory
-* Visual C++ 8 SP1
+ A new library directory named `vendor_ruby' is introduced in
+ addition to `site_ruby'. The idea is to separate libraries
+ installed by the package system (`vendor') from manually (`site')
+ installed libraries preventing the former from getting overwritten
+ by the latter, while preserving the user option to override vendor
+ libraries with site libraries. (`site_ruby' takes precedence over
+ `vendor_ruby')
-* autoconf 2.6x
+ If you are a package maintainer, make each library package configure
+ the library passing the `--vendor' option to `extconf.rb' so that
+ the library files will get installed under `vendor_ruby'.
+
+ You can change the directory locations using configure options such
+ as `--with-sitedir=DIR' and `--with-vendordir=DIR'.
+
+=== Global constants
+
+* new constants
+
+ * RUBY_COPYRIGHT
+ * RUBY_DESCRIPTION
=== Library updates (outstanding ones only)
+* new library
+
+ * securerandom
+
+* builtin classes
+
+ * Array#flatten
+ * Array#flatten!
+
+ Takes an optional argument that determines the level of recursion
+ to flatten.
+
+ * Array#eql?
+ * Array#hash
+ * Array#==
+ * Array#<=>
+
+ Handle recursive data properly.
+
+ * Array#index
+ * Array#rindex
+
+ Take a block instead of an argument.
+
+ * Array#collect!
+ * Array#map!
+ * Array#each
+ * Array#each_index
+ * Array#reverse_each
+ * Array#reject
+ * Array#reject!
+ * Array#delete_if
+
+ Return an enumerator if no block is given.
+
+ Note that #map and #collect still return an array unlike Ruby 1.9
+ to keep compatibility.
+
+ * Array#pop
+ * Array#shift
+
+ Take an optional argument specifying the number of elements to
+ remove.
+
+ * Array#choice
+ * Array#combination
+ * Array#cycle
+ * Array#drop
+ * Array#drop_while
+ * Array#permutation
+ * Array#product
+ * Array#shuffle
+ * Array#shuffle!
+ * Array#take,
+ * Array#take_while
+
+ New methods.
+
+ * Binding#eval
+
+ New method.
+
+ * Dir#each
+ * Dir#foreach
+
+ Return an enumerator if no block is given.
+
+ * Enumerable::Enumerator
+
+ New class for various enumeration defined by the enumerator library.
+
+ * Enumerable#each_slice
+ * Enumerable#each_cons
+ * Object#to_enum
+ * Object#enum_for
+
+ New methods for various enumeration defined by the enumerator library.
+
+ * Enumerable#count
+ * Enumerable#cycle
+ * Enumerable#drop
+ * Enumerable#drop_while
+ * Enumerable#find_index
+ * Enumerable#first
+ * Enumerable#group_by
+ * Enumerable#max_by
+ * Enumerable#min_by
+ * Enumerable#minmax
+ * Enumerable#minmax_by
+ * Enumerable#none?
+ * Enumerable#one?
+ * Enumerable#take
+ * Enumerable#take_while
+
+ New methods.
+
+ * Enumerable#find
+ * Enumerable#find_all
+ * Enumerable#partition
+ * Enumerable#reject
+ * Enumerable#select
+ * Enumerable#sort_by
+
+ Return an enumerator if no block is given.
+
+ Note that #map and #collect still return an array unlike Ruby 1.9
+ to keep compatibility.
+
+ * Enumerable#inject
+
+ Accepts a binary operator instead of a block.
+
+ * Enumerable#reduce
+
+ New alias to #inject.
+
+ * Hash#eql?
+ * Hash#hash
+ * Hash#==
+
+ Handle recursive data properly.
+
+ * Hash#delete_if
+ * Hash#each
+ * Hash#each_key
+ * Hash#each_pair
+ * Hash#each_value
+ * Hash#reject!
+ * Hash#select
+ * ENV.delete_if
+ * ENV.each
+ * ENV.each_key
+ * ENV.each_pair
+ * ENV.each_value
+ * ENV.reject!
+ * ENV.select
+
+ Return an enumerator if no block is given.
+
+ * GC.stress
+ * GC.stress=
+
+ New methods.
+
+ * Integer#ord
+ * Integer#odd?
+ * Integer#even?
+ * Integer#pred
+
+ New methods.
+
+ * Integer#downto
+ * Integer#times
+ * Integer#upto
+
+ Return an enumerator if no block is given.
+
+ * IO#each
+ * IO#each_line
+ * IO#each_byte
+ * IO.foreach
+ * ARGF.each
+ * ARGF.each_line
+ * ARGF.each_byte
+
+ Return an enumerator if no block is given.
+
+ * IO#bytes
+ * IO#chars
+ * IO#each_char
+ * IO#getbyte
+ * IO#lines
+ * IO#readbyte
+ * ARGF.bytes
+ * ARGF.chars
+ * ARGF.each_char
+ * ARGF.getbyte
+ * ARGF.lines
+ * ARGF.readbyte
+
+ New methods.
+
+ * Method#name
+ * Method#owner
+ * Method#receiver
+ * UnboundMethod#name
+ * UnboundMethod#owner
+
+ New methods.
+
+ * Module#class_exec
+ * Module#module_exec
+
+ New methods.
+
+ * Numeric#step
+
+ Return an enumerator if no block is given.
+
+ * Object#instance_exec
+ * Object#tap
+
+ New methods.
+
+ * ObjectSpace.each_object
+
+ Return an enumerator if no block is given.
+
+ * Process.exec implemented.
+
+ * Range#each
+ * Range#step
+
+ Return an enumerator if no block is given.
+
+ * Regexp.union accepts an array of patterns.
+
+ * String#bytesize
+
+ New method, returning the size in bytes. (alias length and size)
+
+ * String#chars
+ * String#each_char
+ * String#partition
+ * String#rpartition
+ * String#start_with?
+ * String#end_with?
+
+ New methods. These are $KCODE aware unlike #index, #rindex and
+ #include?.
+
+ * String#each_byte
+ * String#each
+ * String#each_line
+ * String#gsub(pattern)
+
+ Return an enumerator if no block is given.
+
+ * String#upto
+
+ An optional second argument is added to specify if the last value
+ should be included.
+
+ * StopIteration
+
+ New exception class that causes Kernel#loop to stop iteration when
+ raised.
+
+ * Struct#each
+ * Struct#each_pair
+
+ Return an enumerator if no block is given.
+
+ * Symbol#to_proc
+
+ New method.
+
+ * __method__
+
+ New global function that returns the name of the current method as
+ a Symbol.
+
+* enumerator
+
+ * Enumerator is now a built-in module. The #next and #rewind
+ methods are implemented using the "generator" library. Use with
+ care and be aware of the performance loss.
+
+* ipaddr
+
+ * New methods
+ * IPAddr#<=>
+ * IPAddr#succ
+
+ IPAddr objects are now comparable and enumerable having these
+ methods. This also means that it is possible to have a Range
+ object between two IPAddr objects.
+
+ * IPAddr#to_range
+
+ A new method to create a Range object for the (network) address.
+
+ * Type coercion support
+ * IPAddr#&
+ * IPAddr#|
+ * IPAddr#==
+ * IPAddr#include?
+
+ These methods now accept a string or an integer instead of an
+ IPAddr object as the argument.
+
+* net/smtp
+
+ * Support SSL/TLS.
+
+* openssl
+
+ * New classes
+ * OpenSSL::PKey::EC
+ * OpenSSL::PKey::EC::Group
+ * OpenSSL::PKey::EC::Point
+ * OpenSSL::PKey::PKCS5
+ * OpenSSL::SSL::Session
+
+ * Documentation!
+
+ * Various new methods (see documentation).
+
+ * Remove redundant module namespace in Cipher, Digest, PKCS7, PKCS12.
+ Compatibility classes are provided which will be removed in Ruby 1.9.
+
+* shellwords
+
+ * Add methods for escaping shell-unsafe characters:
+ * Shellwords.join
+ * Shellwords.escape
+ * Array#shelljoin
+ * String#shellescape
+
+ * Add shorthand methods:
+ * Shellwords.split (alias shellwords)
+ * String#shellsplit
+
+* stringio
+
+ * StringIO#getbyte
+ * StringIO#readbyte
+
+ New methods. (aliases for compatibility with 1.9)
+
+ * StringIO#each_char
+ * StringIO#chars
+
+ New methods.
+
+ * StringIO#each
+ * StringIO#each_line
+ * StringIO#each_byte
+
+ Return an enumerator if no block is given.
+
+* tempfile
+
+ * Tempfile.open and Tempfile.new now accept a suffix for the
+ temporary file to be created. To specify a suffix, pass an array
+ of [basename, suffix] as the first argument.
+
+ Tempfile.open(['image', 'jpg']) { |tempfile| ... }
+
+* tmpdir
+
+ * New method:
+
+ * Dir.mktmpdir
+
+* uri
+
+ * added LDAPS scheme.
+ * Change for RFC3986:
+ * FTP
+ * URI('ftp://example.com/foo').path #=> 'foo'
+ * URI('ftp://example.com/%2Ffoo').path #=> '/foo'
+ * URI::FTP.build([nil, 'example.com', nil, '/foo', 'i').to_s #=> 'ftp://example.com/%2Ffoo;type=i'
+ * URI merge
+ * URI('http://a/b/c/d;p?q').merge('?y') == URI('http://a/b/c/d;p?y')
+ * URI('http://a/b/c/d;p?q').merge('/./g') == URI('http://a/g')
+ * URI('http://a/b/c/d;p?q').merge('/../g') == URI('http://a/g')
+ * URI('http://a/b/c/d;p?q').merge('../../../g') == URI('http://a/g')
+ * URI('http://a/b/c/d;p?q').merge('../../../../g') == URI('http://a/g')
+
+* rss
+
+ * 0.1.6 -> 0.2.4
+
+ * Fix image module URI
+
+ * Atom support
+
+ * ITunes module support
+
+ * Slash module support
+
+ * content:encoded with RSS 2.0 support
+
+=== Interpreter Implementation
+
+* passing a block to a Proc [experimental]
+
+ This implementation in current shape is known to be buggy/broken,
+ especially with nested block invocation. Take this as an
+ experimental feature.
+
+* stack trace
+
+ On non-SystemStackError exception, full stack trace is shown.
+
+=== Compatibility issues (excluding feature bug fixes)
+
+* String#slice! had some unintentional bugs and they have been fixed
+ because either they disagreed with documentation or their respective
+ behavior of #slice. Unfortunately, this causes some
+ incompatibilities in the following (somewhat rare) cases.
+
+ * #slice! no longer expands the array when an out-of-boundary value
+ is given.
+
+ # Ruby 1.8.6
+ a = [1,2]
+ a.slice!(4,0) #=> nil
+ a #=> [1,2,nil,nil]
+
+ # Ruby 1.8.7
+ a = [1,2]
+ a.slice!(4,0) #=> nil
+ a #=> [1,2]
+
+ * #slice! no longer raises an exception but returns nil when a
+ negative length or out-of-boundary negative position is given.
+
+ # Ruby 1.8.6
+ a = [1,2]
+ a.slice!(1,-1) #=> (raises IndexError)
+ a.slice!(-5,1) #=> (raises IndexError)
+
+ # Ruby 1.8.7
+ a = [1,2]
+ a.slice!(1,-1) #=> nil
+ a.slice!(-5,1) #=> nil
+
+* String#to_i, String#hex and String#oct no longer accept a sequence
+ of underscores (`__') as part of a number.
+
+ # Ruby 1.8.6
+ '1__0'.to_i #=> 10
+ '1__0'.to_i(2) #=> 2 # 0b10
+ '1__0'.oct #=> 8 # 010
+ '1__0'.hex #=> 16 # 0x10
+
+ # Ruby 1.8.7
+ '1__0'.to_i #=> 1
+ '1__0'.to_i(2) #=> 1
+ '1__0'.oct #=> 1
+ '1__0'.hex #=> 1
+
+ The old behavior was inconsistent with Ruby syntax and considered as
+ a bug.
+
* date
- * Updated based on date2 4.0.3.
+ * Date.parse
-* digest
+ '##.##.##' (where each '#' is a digit) is now taken as 'YY.MM.DD'
+ instead of 'MM.DD.YY'. While the change may confuse you, you can
+ always use Date.strptime() when you know what you are dealing
+ with.
- * New internal APIs for C and Ruby.
+* stringio
- * Support for autoloading.
+ * StringIO#each_byte
- * See below for new features and compatibility issues.
+ The return value changed from nil to self. This is what the
+ document says and the same as each_line() does.
-* nkf
+* tempfile
- * Updated based on nkf as of 2007-01-28.
+ * The file name format has changed. No dots are included by default
+ in temporary file names any more. See above for how to specify a
+ suffix.
-* tk
+* uri
- * Tk::X_Scrollable (Y_Scrollable) is renamed to Tk::XScrollable
- (YScrollable). Tk::X_Scrollable (Y_Scrollable) is still available,
- but it is an alias name.
+ * See above for details.
- * Updated Tile extension support based on Tile 0.7.8.
+== Changes since the 1.8.5 release
- * Support --without-X11 configure option for non-X11 versions of
- Tcl/Tk (e.g. Tcl/Tk Aqua).
+=== New platforms/build tools support
- * New sample script: irbtkw.rbw -- IRB on Ruby/Tk. It has no trouble
- about STDIN blocking on Windows.
+* IA64 HP-UX
+
+* Visual C++ 8 SP1
+
+* autoconf 2.6x
+
+=== Global constants
+
+* RUBY_PATCHLEVEL
+
+ New constant since 1.8.5-p1.
-=== New methods and features
+=== Library updates (outstanding ones only)
* builtin classes
@@ -59,13 +536,25 @@ with all sufficient information, see the ChangeLog file.
* New feature: Dir::glob() can now take an array of glob patterns.
+* date
+
+ * Updated based on date2 4.0.3.
+
* digest
+ * New internal APIs for C and Ruby.
+
+ * Support for autoloading.
+
+ require 'digest'
+
+ # autoloads digest/md5
+ md = Digest::MD5.digest("string")
+
* New digest class methods: file
- * New digest instance methods: clone, reset, new,
- inspect, digest_length (alias size or length),
- block_length()
+ * New digest instance methods: clone, reset, new, inspect,
+ digest_length (alias size or length), block_length()
* New library: digest/bubblebabble
@@ -75,11 +564,25 @@ with all sufficient information, see the ChangeLog file.
* New option for FileUtils.cp_r(): :remove_destination
+* nkf
+
+ * Updated based on nkf as of 2007-01-28.
+
* thread
- * Replaced with much faster mutex implementation in C.
- The former implementation is available with a
- configure option `--disable-fastthread'.
+ * Replaced with much faster mutex implementation in C. The former
+ implementation, which is slow but considered to be stable, is
+ available with a configure option `--disable-fastthread'.
+
+* tk
+
+ * Updated Tile extension support based on Tile 0.7.8.
+
+ * Support --without-X11 configure option for non-X11 versions of
+ Tcl/Tk (e.g. Tcl/Tk Aqua).
+
+ * New sample script: irbtkw.rbw -- IRB on Ruby/Tk. It has no trouble
+ about STDIN blocking on Windows.
* webrick
@@ -92,17 +595,17 @@ with all sufficient information, see the ChangeLog file.
* String#intern now raises SecurityError when $SAFE level is greater
than zero.
-* fileutils
+* date
- * A minor implementation change breaks Rake <=0.7.1.
- Updating Rake to 0.7.2 fixes the problem.
+ * Time#to_date and Time#to_datetime are added as private methods.
+ They cause name conflict error in ActiveSupport 1.4.1 and prior,
+ which comes with Rails 1.2.2 and prior. Updating ActiveSupport
+ and/or Rails to the latest versions fixes the problem.
* digest
- * The constructor does no longer take an initial
- string to feed; digest() and hexdigest() now do,
- instead. The following examples show how to
- migrate:
+ * The constructor does no longer take an initial string to feed.
+ The following examples show how to migrate:
# Before
md = Digest::MD5.new("string")
@@ -113,3 +616,14 @@ with all sufficient information, see the ChangeLog file.
hd = Digest::MD5.new("string").hexdigest
# After (works with any version)
hd = Digest::MD5.hexdigest("string")
+
+* fileutils
+
+ * A minor implementation change breaks Rake <=0.7.1.
+ Updating Rake to 0.7.2 or higher fixes the problem.
+
+* tk
+
+ * Tk::X_Scrollable (Y_Scrollable) is renamed to Tk::XScrollable
+ (YScrollable). Tk::X_Scrollable (Y_Scrollable) is still available,
+ but it is an alias name.
diff --git a/README b/README
index cf836415ad..1b79781367 100644
--- a/README
+++ b/README
@@ -29,7 +29,7 @@ The Ruby distribution files can be found in the following FTP site:
The latest source code of this version series can be checked out
through SVN with the following command:
- $ svn co http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_6/
+ $ svn co http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8/
The trunk of the Ruby source tree can be checked out with the
following command:
@@ -70,6 +70,10 @@ This is what you need to do to compile and install Ruby:
2. Run ./configure, which will generate config.h and Makefile.
+ Some C compiler flags may be added by default depending on your
+ environment. Specify optflags=.. and warnflags=.. as necessary
+ to override them.
+
3. Edit defines.h if you need. Usually this step will not be needed.
4. Remove comment mark(#) before the module names from ext/Setup (or
diff --git a/README.EXT b/README.EXT
index 2fc2fd606a..637b19d25b 100644
--- a/README.EXT
+++ b/README.EXT
@@ -662,6 +662,11 @@ Try generating the Makefile by:
ruby extconf.rb
+If the library should be installed under vendor_ruby directory
+instead of site_ruby directory, use --vendor option as follows.
+
+ ruby extconf.rb --vendor
+
You don't need this step if you put the extension library under the ext
directory of the ruby source tree. In that case, compilation of the
interpreter will do this step for you.
diff --git a/README.EXT.ja b/README.EXT.ja
index 30c4d520ba..73425c2cdb 100644
--- a/README.EXT.ja
+++ b/README.EXT.ja
@@ -765,6 +765,12 @@ Makefile¤ò¼ÂºÝ¤ËÀ¸À®¤¹¤ë¤¿¤á¤Ë¤Ï
¤È¤·¤Æ¤¯¤À¤µ¤¤¡¥
+site_ruby ¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ê¤¯¡¢
+vendor_ruby ¥Ç¥£¥ì¥¯¥È¥ê¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¾ì¹ç¤Ë¤Ï
+°Ê²¼¤Î¤è¤¦¤Ë --vendor ¥ª¥×¥·¥ç¥ó¤ò²Ã¤¨¤Æ¤¯¤À¤µ¤¤¡¥
+
+ ruby extconf.rb --vendor
+
¥Ç¥£¥ì¥¯¥È¥ê¤òext°Ê²¼¤ËÍѰդ·¤¿¾ì¹ç¤Ë¤ÏRubyÁ´ÂΤÎmake¤Î»þ¤Ë
¼«Æ°Åª¤ËMakefile¤¬À¸À®¤µ¤ì¤Þ¤¹¤Î¤Ç¡¤¤³¤Î¥¹¥Æ¥Ã¥×¤ÏÉÔÍפǤ¹¡¥
diff --git a/README.ja b/README.ja
index df8cfc03f4..71ce4ee12c 100644
--- a/README.ja
+++ b/README.ja
@@ -36,7 +36,7 @@ Ruby¤Ï¥Æ¥­¥¹¥È½èÍý´Ø·¸¤ÎǽÎϤʤɤËÍ¥¤ì¡¤Perl¤ÈƱ¤¸¤¯¤é¤¤¶¯ÎÏ
ËÜ¥Ö¥é¥ó¥Á¤ÎRuby¤ÎºÇ¿·¤Î¥½¡¼¥¹¥³¡¼¥É¤Ï¼¡¤Î¥³¥Þ¥ó¥É¤Ç¼èÆÀ¤Ç¤­¤Þ¤¹¡¥
- $ svn co http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_6/
+ $ svn co http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8/
³«È¯Àèü¤Î¥½¡¼¥¹¥³¡¼¥É¤Ï¼¡¤Î¥³¥Þ¥ó¥É¤Ç¼èÆÀ¤Ç¤­¤Þ¤¹¡¥
@@ -92,6 +92,10 @@ Ruby³ÈÄ¥¥â¥¸¥å¡¼¥ë¤Ë¤Ä¤¤¤ÆÏ䷹礦ruby-ext¥á¡¼¥ê¥ó¥°¥ê¥¹¥È¤È
2. configure¤ò¼Â¹Ô¤·¤ÆMakefile¤Ê¤É¤òÀ¸À®¤¹¤ë
+ ´Ä¶­¤Ë¤è¤Ã¤Æ¤Ï¥Ç¥Õ¥©¥ë¥È¤ÎC¥³¥ó¥Ñ¥¤¥éÍÑ¥ª¥×¥·¥ç¥ó¤¬ÉÕ¤­
+ ¤Þ¤¹¡¥configure¥ª¥×¥·¥ç¥ó¤Ç optflags=.. warnflags=.. Åù
+ ¤Ç¾å½ñ¤­¤Ç¤­¤Þ¤¹¡¥
+
3. (ɬÍפʤé¤Ð)defines.h¤òÊÔ½¸¤¹¤ë
¿ʬ¡¤É¬Í×̵¤¤¤È»×¤¤¤Þ¤¹¡¥
diff --git a/array.c b/array.c
index fbca3c193e..7e8c12b683 100644
--- a/array.c
+++ b/array.c
@@ -20,6 +20,7 @@ VALUE rb_cArray;
static ID id_cmp;
#define ARY_DEFAULT_SIZE 16
+#define ARY_MAX_SIZE (LONG_MAX / sizeof(VALUE))
void
rb_mem_clear(mem, size)
@@ -120,7 +121,7 @@ ary_new(klass, len)
if (len < 0) {
rb_raise(rb_eArgError, "negative array size (or size too big)");
}
- if (len > 0 && len * sizeof(VALUE) <= len) {
+ if (len > ARY_MAX_SIZE) {
rb_raise(rb_eArgError, "array size too big");
}
if (len == 0) len++;
@@ -195,6 +196,27 @@ rb_ary_new4(n, elts)
return ary;
}
+static VALUE
+ary_make_shared(ary)
+ VALUE ary;
+{
+ if (!FL_TEST(ary, ELTS_SHARED)) {
+ NEWOBJ(shared, struct RArray);
+ OBJSETUP(shared, rb_cArray, T_ARRAY);
+
+ shared->len = RARRAY(ary)->len;
+ shared->ptr = RARRAY(ary)->ptr;
+ shared->aux.capa = RARRAY(ary)->aux.capa;
+ RARRAY(ary)->aux.shared = (VALUE)shared;
+ FL_SET(ary, ELTS_SHARED);
+ OBJ_FREEZE(shared);
+ return (VALUE)shared;
+ }
+ else {
+ return RARRAY(ary)->aux.shared;
+ }
+}
+
VALUE
rb_assoc_new(car, cdr)
VALUE car, cdr;
@@ -293,7 +315,7 @@ rb_ary_initialize(argc, argv, ary)
if (len < 0) {
rb_raise(rb_eArgError, "negative array size");
}
- if (len > 0 && len * (long)sizeof(VALUE) <= len) {
+ if (len > ARY_MAX_SIZE) {
rb_raise(rb_eArgError, "array size too big");
}
if (len > RARRAY(ary)->aux.capa) {
@@ -358,6 +380,9 @@ rb_ary_store(ary, idx, val)
idx - RARRAY(ary)->len);
}
}
+ else if (idx >= ARY_MAX_SIZE) {
+ rb_raise(rb_eIndexError, "index %ld too big", idx);
+ }
rb_ary_modify(ary);
if (idx >= RARRAY(ary)->aux.capa) {
@@ -366,10 +391,10 @@ rb_ary_store(ary, idx, val)
if (new_capa < ARY_DEFAULT_SIZE) {
new_capa = ARY_DEFAULT_SIZE;
}
- new_capa += idx;
- if (new_capa * (long)sizeof(VALUE) <= new_capa) {
- rb_raise(rb_eArgError, "index too big");
+ if (new_capa >= ARY_MAX_SIZE - idx) {
+ new_capa = (ARY_MAX_SIZE - idx) / 2;
}
+ new_capa += idx;
REALLOC_N(RARRAY(ary)->ptr, VALUE, new_capa);
RARRAY(ary)->aux.capa = new_capa;
}
@@ -384,6 +409,50 @@ rb_ary_store(ary, idx, val)
RARRAY(ary)->ptr[idx] = val;
}
+static VALUE
+ary_shared_array(klass, ary)
+ VALUE klass;
+ VALUE ary;
+{
+ VALUE val = ary_alloc(klass);
+
+ ary_make_shared(ary);
+ RARRAY(val)->ptr = RARRAY(ary)->ptr;
+ RARRAY(val)->len = RARRAY(ary)->len;
+ RARRAY(val)->aux.shared = RARRAY(ary)->aux.shared;
+ FL_SET(val, ELTS_SHARED);
+ return val;
+}
+
+static VALUE
+ary_shared_first(argc, argv, ary, last)
+ int argc;
+ VALUE *argv;
+ VALUE ary;
+ int last;
+{
+ VALUE nv, result;
+ long n;
+ long offset = 0;
+
+ rb_scan_args(argc, argv, "1", &nv);
+ n = NUM2LONG(nv);
+ if (n > RARRAY(ary)->len) {
+ n = RARRAY(ary)->len;
+ }
+ else if (n < 0) {
+ rb_raise(rb_eArgError, "negative array size");
+ }
+ if (last) {
+ offset = RARRAY(ary)->len - n;
+ }
+ result = ary_shared_array(rb_cArray, ary);
+ RARRAY(result)->ptr += offset;
+ RARRAY(result)->len = n;
+
+ return result;
+}
+
/*
* call-seq:
* array << obj -> array
@@ -431,18 +500,6 @@ rb_ary_push_m(argc, argv, ary)
return ary;
}
-/*
- * call-seq:
- * array.pop -> obj or nil
- *
- * Removes the last element from <i>self</i> and returns it, or
- * <code>nil</code> if the array is empty.
- *
- * a = [ "a", "m", "z" ]
- * a.pop #=> "z"
- * a #=> ["a", "m"]
- */
-
VALUE
rb_ary_pop(ary)
VALUE ary;
@@ -450,7 +507,7 @@ rb_ary_pop(ary)
rb_ary_modify_check(ary);
if (RARRAY(ary)->len == 0) return Qnil;
if (!FL_TEST(ary, ELTS_SHARED) &&
- RARRAY(ary)->len * 2 < RARRAY(ary)->aux.capa &&
+ RARRAY(ary)->len * 3 < RARRAY(ary)->aux.capa &&
RARRAY(ary)->aux.capa > ARY_DEFAULT_SIZE) {
RARRAY(ary)->aux.capa = RARRAY(ary)->len * 2;
REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->aux.capa);
@@ -458,62 +515,112 @@ rb_ary_pop(ary)
return RARRAY(ary)->ptr[--RARRAY(ary)->len];
}
+/*
+ * call-seq:
+ * array.pop -> obj or nil
+ * array.pop(n) -> array
+ *
+ * Removes the last element from <i>self</i> and returns it, or
+ * <code>nil</code> if the array is empty.
+ *
+ * If a number _n_ is given, returns an array of the last n elements
+ * (or less) just like <code>array.slice!(-n, n)</code> does.
+ *
+ * a = [ "a", "b", "c", "d" ]
+ * a.pop #=> "d"
+ * a.pop(2) #=> ["b", "c"]
+ * a #=> ["a"]
+ */
+
static VALUE
-ary_make_shared(ary)
+rb_ary_pop_m(argc, argv, ary)
+ int argc;
+ VALUE *argv;
VALUE ary;
{
- if (!FL_TEST(ary, ELTS_SHARED)) {
- NEWOBJ(shared, struct RArray);
- OBJSETUP(shared, rb_cArray, T_ARRAY);
+ VALUE result;
- shared->len = RARRAY(ary)->len;
- shared->ptr = RARRAY(ary)->ptr;
- shared->aux.capa = RARRAY(ary)->aux.capa;
- RARRAY(ary)->aux.shared = (VALUE)shared;
- FL_SET(ary, ELTS_SHARED);
- OBJ_FREEZE(shared);
- return (VALUE)shared;
+ if (argc == 0) {
+ return rb_ary_pop(ary);
}
- else {
- return RARRAY(ary)->aux.shared;
+
+ rb_ary_modify_check(ary);
+ result = ary_shared_first(argc, argv, ary, Qtrue);
+ RARRAY(ary)->len -= RARRAY(result)->len;
+ return result;
+}
+
+VALUE
+rb_ary_shift(ary)
+ VALUE ary;
+{
+ VALUE top;
+
+ rb_ary_modify_check(ary);
+ if (RARRAY(ary)->len == 0) return Qnil;
+ top = RARRAY(ary)->ptr[0];
+ if (!FL_TEST(ary, ELTS_SHARED)) {
+ if (RARRAY(ary)->len < ARY_DEFAULT_SIZE) {
+ MEMMOVE(RARRAY(ary)->ptr, RARRAY(ary)->ptr+1, VALUE, RARRAY(ary)->len-1);
+ RARRAY(ary)->len--;
+ return top;
+ }
+ RARRAY(ary)->ptr[0] = Qnil;
+ ary_make_shared(ary);
}
+ RARRAY(ary)->ptr++; /* shift ptr */
+ RARRAY(ary)->len--;
+
+ return top;
}
/*
* call-seq:
- * array.shift -> obj or nil
+ * array.shift -> obj or nil
+ * array.shift(n) -> array
*
* Returns the first element of <i>self</i> and removes it (shifting all
* other elements down by one). Returns <code>nil</code> if the array
* is empty.
+ *
+ * If a number _n_ is given, returns an array of the first n elements
+ * (or less) just like <code>array.slice!(0, n)</code> does.
*
* args = [ "-m", "-q", "filename" ]
- * args.shift #=> "-m"
- * args #=> ["-q", "filename"]
+ * args.shift #=> "-m"
+ * args #=> ["-q", "filename"]
+ *
+ * args = [ "-m", "-q", "filename" ]
+ * args.shift(2) #=> ["-m", "-q"]
+ * args #=> ["filename"]
*/
-VALUE
-rb_ary_shift(ary)
+static VALUE
+rb_ary_shift_m(argc, argv, ary)
+ int argc;
+ VALUE *argv;
VALUE ary;
{
- VALUE top;
+ VALUE result;
+ long n;
- rb_ary_modify_check(ary);
- if (RARRAY(ary)->len == 0) return Qnil;
- top = RARRAY(ary)->ptr[0];
- if (RARRAY_LEN(ary) < ARY_DEFAULT_SIZE && !FL_TEST(ary, ELTS_SHARED)) {
- MEMMOVE(RARRAY_PTR(ary), RARRAY_PTR(ary)+1, VALUE, RARRAY_LEN(ary)-1);
+ if (argc == 0) {
+ return rb_ary_shift(ary);
}
- else {
- if (!FL_TEST(ary, ELTS_SHARED)) {
- RARRAY(ary)->ptr[0] = Qnil;
+
+ rb_ary_modify_check(ary);
+ result = ary_shared_first(argc, argv, ary, Qfalse);
+ n = RARRAY(result)->len;
+ if (FL_TEST(ary, ELTS_SHARED)) {
+ RARRAY(ary)->ptr += n;
+ RARRAY(ary)->len -= n;
}
- ary_make_shared(ary);
- RARRAY(ary)->ptr++; /* shift ptr */
+ else {
+ MEMMOVE(RARRAY(ary)->ptr, RARRAY(ary)->ptr+n, VALUE, RARRAY(ary)->len-n);
+ RARRAY(ary)->len -= n;
}
- RARRAY(ary)->len--;
- return top;
+ return result;
}
VALUE
@@ -748,17 +855,7 @@ rb_ary_first(argc, argv, ary)
return RARRAY(ary)->ptr[0];
}
else {
- VALUE nv, result;
- long n, i;
-
- rb_scan_args(argc, argv, "01", &nv);
- n = NUM2LONG(nv);
- if (n > RARRAY(ary)->len) n = RARRAY(ary)->len;
- result = rb_ary_new2(n);
- for (i=0; i<n; i++) {
- rb_ary_push(result, RARRAY(ary)->ptr[i]);
- }
- return result;
+ return ary_shared_first(argc, argv, ary, Qfalse);
}
}
@@ -784,17 +881,7 @@ rb_ary_last(argc, argv, ary)
return RARRAY(ary)->ptr[RARRAY(ary)->len-1];
}
else {
- VALUE nv, result;
- long n, i;
-
- rb_scan_args(argc, argv, "01", &nv);
- n = NUM2LONG(nv);
- if (n > RARRAY(ary)->len) n = RARRAY(ary)->len;
- result = rb_ary_new2(n);
- for (i=RARRAY(ary)->len-n; n--; i++) {
- rb_ary_push(result, RARRAY(ary)->ptr[i]);
- }
- return result;
+ return ary_shared_first(argc, argv, ary, Qtrue);
}
}
@@ -850,24 +937,41 @@ rb_ary_fetch(argc, argv, ary)
/*
* call-seq:
- * array.index(obj) -> int or nil
+ * array.index(obj) -> int or nil
+ * array.index {|item| block} -> int or nil
*
- * Returns the index of the first object in <i>self</i> such that is
- * <code>==</code> to <i>obj</i>. Returns <code>nil</code> if
- * no match is found.
+ * Returns the index of the first object in <i>self</i> such that is
+ * <code>==</code> to <i>obj</i>. If a block is given instead of an
+ * argument, returns first object for which <em>block</em> is true.
+ * Returns <code>nil</code> if no match is found.
*
* a = [ "a", "b", "c" ]
- * a.index("b") #=> 1
- * a.index("z") #=> nil
+ * a.index("b") #=> 1
+ * a.index("z") #=> nil
+ * a.index{|x|x=="b"} #=> 1
+ *
+ * This is an alias of <code>#find_index</code>.
*/
static VALUE
-rb_ary_index(ary, val)
+rb_ary_index(argc, argv, ary)
+ int argc;
+ VALUE *argv;
VALUE ary;
- VALUE val;
{
+ VALUE val;
long i;
+ if (argc == 0) {
+ RETURN_ENUMERATOR(ary, 0, 0);
+ for (i=0; i<RARRAY(ary)->len; i++) {
+ if (RTEST(rb_yield(RARRAY(ary)->ptr[i]))) {
+ return LONG2NUM(i);
+ }
+ }
+ return Qnil;
+ }
+ rb_scan_args(argc, argv, "01", &val);
for (i=0; i<RARRAY(ary)->len; i++) {
if (rb_equal(RARRAY(ary)->ptr[i], val))
return LONG2NUM(i);
@@ -879,29 +983,44 @@ rb_ary_index(ary, val)
* call-seq:
* array.rindex(obj) -> int or nil
*
- * Returns the index of the last object in <i>array</i>
- * <code>==</code> to <i>obj</i>. Returns <code>nil</code> if
- * no match is found.
+ * Returns the index of the last object in <i>array</i>
+ * <code>==</code> to <i>obj</i>. If a block is given instead of an
+ * argument, returns first object for which <em>block</em> is
+ * true. Returns <code>nil</code> if no match is found.
*
* a = [ "a", "b", "b", "b", "c" ]
- * a.rindex("b") #=> 3
- * a.rindex("z") #=> nil
+ * a.rindex("b") #=> 3
+ * a.rindex("z") #=> nil
+ * a.rindex{|x|x=="b"} #=> 3
*/
static VALUE
-rb_ary_rindex(ary, val)
+rb_ary_rindex(argc, argv, ary)
+ int argc;
+ VALUE *argv;
VALUE ary;
- VALUE val;
{
+ VALUE val;
long i = RARRAY(ary)->len;
+ if (argc == 0) {
+ RETURN_ENUMERATOR(ary, 0, 0);
+ while (i--) {
+ if (RTEST(rb_yield(RARRAY(ary)->ptr[i])))
+ return LONG2NUM(i);
+ if (i > RARRAY(ary)->len) {
+ i = RARRAY(ary)->len;
+ }
+ }
+ return Qnil;
+ }
+ rb_scan_args(argc, argv, "01", &val);
while (i--) {
+ if (rb_equal(RARRAY(ary)->ptr[i], val))
+ return LONG2NUM(i);
if (i > RARRAY(ary)->len) {
i = RARRAY(ary)->len;
- continue;
}
- if (rb_equal(RARRAY(ary)->ptr[i], val))
- return LONG2NUM(i);
}
return Qnil;
}
@@ -975,6 +1094,9 @@ rb_ary_splice(ary, beg, len, rpl)
rb_ary_modify(ary);
if (beg >= RARRAY(ary)->len) {
+ if (beg > ARY_MAX_SIZE - rlen) {
+ rb_raise(rb_eIndexError, "index %ld too big", beg);
+ }
len = beg + rlen;
if (len >= RARRAY(ary)->aux.capa) {
REALLOC_N(RARRAY(ary)->ptr, VALUE, len);
@@ -1134,6 +1256,7 @@ rb_ary_each(ary)
{
long i;
+ RETURN_ENUMERATOR(ary, 0, 0);
for (i=0; i<RARRAY(ary)->len; i++) {
rb_yield(RARRAY(ary)->ptr[i]);
}
@@ -1161,6 +1284,7 @@ rb_ary_each_index(ary)
{
long i;
+ RETURN_ENUMERATOR(ary, 0, 0);
for (i=0; i<RARRAY(ary)->len; i++) {
rb_yield(LONG2NUM(i));
}
@@ -1186,8 +1310,10 @@ static VALUE
rb_ary_reverse_each(ary)
VALUE ary;
{
- long len = RARRAY(ary)->len;
+ long len;
+ RETURN_ENUMERATOR(ary, 0, 0);
+ len = RARRAY(ary)->len;
while (len--) {
rb_yield(RARRAY(ary)->ptr[len]);
if (RARRAY(ary)->len < len) {
@@ -1734,6 +1860,7 @@ rb_ary_collect_bang(ary)
{
long i;
+ RETURN_ENUMERATOR(ary, 0, 0);
rb_ary_modify(ary);
for (i = 0; i < RARRAY(ary)->len; i++) {
rb_ary_store(ary, i, rb_yield(RARRAY(ary)->ptr[i]));
@@ -1818,6 +1945,7 @@ rb_ary_select(ary)
VALUE result;
long i;
+ RETURN_ENUMERATOR(ary, 0, 0);
result = rb_ary_new2(RARRAY(ary)->len);
for (i = 0; i < RARRAY(ary)->len; i++) {
if (RTEST(rb_yield(RARRAY(ary)->ptr[i]))) {
@@ -1957,22 +2085,42 @@ rb_ary_slice_bang(argc, argv, ary)
VALUE ary;
{
VALUE arg1, arg2;
- long pos, len;
+ long pos, len, orig_len;
+ rb_ary_modify_check(ary);
if (rb_scan_args(argc, argv, "11", &arg1, &arg2) == 2) {
pos = NUM2LONG(arg1);
len = NUM2LONG(arg2);
delete_pos_len:
+ if (len < 0) return Qnil;
+ orig_len = RARRAY_LEN(ary);
if (pos < 0) {
- pos = RARRAY(ary)->len + pos;
+ pos += orig_len;
+ if (pos < 0) return Qnil;
}
- arg2 = rb_ary_subseq(ary, pos, len);
- rb_ary_splice(ary, pos, len, Qnil); /* Qnil/rb_ary_new2(0) */
+ else if (orig_len < pos) return Qnil;
+ if (orig_len < pos + len) {
+ len = orig_len - pos;
+ }
+ if (len == 0) return rb_ary_new2(0);
+ arg2 = rb_ary_new4(len, RARRAY_PTR(ary)+pos);
+ RBASIC(arg2)->klass = rb_obj_class(ary);
+ rb_ary_splice(ary, pos, len, Qnil); /* Qundef in 1.9 */
return arg2;
}
- if (!FIXNUM_P(arg1) && rb_range_beg_len(arg1, &pos, &len, RARRAY(ary)->len, 1)) {
- goto delete_pos_len;
+ if (!FIXNUM_P(arg1)) {
+ switch (rb_range_beg_len(arg1, &pos, &len, RARRAY_LEN(ary), 0)) {
+ case Qtrue:
+ /* valid range */
+ goto delete_pos_len;
+ case Qnil:
+ /* invalid range */
+ return Qnil;
+ default:
+ /* not a range */
+ break;
+ }
}
return rb_ary_delete_at(ary, NUM2LONG(arg1));
@@ -1994,6 +2142,7 @@ rb_ary_reject_bang(ary)
{
long i1, i2;
+ RETURN_ENUMERATOR(ary, 0, 0);
rb_ary_modify(ary);
for (i1 = i2 = 0; i1 < RARRAY(ary)->len; i1++) {
VALUE v = RARRAY(ary)->ptr[i1];
@@ -2022,6 +2171,7 @@ static VALUE
rb_ary_reject(ary)
VALUE ary;
{
+ RETURN_ENUMERATOR(ary, 0, 0);
ary = rb_ary_dup(ary);
rb_ary_reject_bang(ary);
return ary;
@@ -2042,6 +2192,7 @@ static VALUE
rb_ary_delete_if(ary)
VALUE ary;
{
+ RETURN_ENUMERATOR(ary, 0, 0);
rb_ary_reject_bang(ary);
return ary;
}
@@ -2265,10 +2416,13 @@ rb_ary_fill(argc, argv, ary)
break;
}
rb_ary_modify(ary);
- end = beg + len;
- if (end < 0) {
+ if (len < 0) {
+ return ary;
+ }
+ if (beg >= ARY_MAX_SIZE || len > ARY_MAX_SIZE - beg) {
rb_raise(rb_eArgError, "argument too big");
}
+ end = beg + len;
if (end > RARRAY(ary)->len) {
if (end >= RARRAY(ary)->aux.capa) {
REALLOC_N(RARRAY(ary)->ptr, VALUE, end);
@@ -2378,7 +2532,7 @@ rb_ary_times(ary, times)
if (len < 0) {
rb_raise(rb_eArgError, "negative argument");
}
- if (LONG_MAX/len < RARRAY(ary)->len) {
+ if (ARY_MAX_SIZE/len < RARRAY(ary)->len) {
rb_raise(rb_eArgError, "argument too big");
}
len *= RARRAY(ary)->len;
@@ -2422,9 +2576,8 @@ rb_ary_assoc(ary, key)
VALUE v;
for (i = 0; i < RARRAY(ary)->len; ++i) {
- v = RARRAY(ary)->ptr[i];
- if (TYPE(v) == T_ARRAY &&
- RARRAY(v)->len > 0 &&
+ v = rb_check_array_type(RARRAY(ary)->ptr[i]);
+ if (!NIL_P(v) && RARRAY(v)->len > 0 &&
rb_equal(RARRAY(v)->ptr[0], key))
return v;
}
@@ -2462,6 +2615,22 @@ rb_ary_rassoc(ary, value)
return Qnil;
}
+static VALUE recursive_equal _((VALUE, VALUE, int));
+static VALUE
+recursive_equal(ary1, ary2, recur)
+ VALUE ary1, ary2;
+ int recur;
+{
+ long i;
+
+ if (recur) return Qfalse;
+ for (i=0; i<RARRAY(ary1)->len; i++) {
+ if (!rb_equal(rb_ary_elt(ary1, i), rb_ary_elt(ary2, i)))
+ return Qfalse;
+ }
+ return Qtrue;
+}
+
/*
* call-seq:
* array == other_array -> bool
@@ -2480,8 +2649,6 @@ static VALUE
rb_ary_equal(ary1, ary2)
VALUE ary1, ary2;
{
- long i;
-
if (ary1 == ary2) return Qtrue;
if (TYPE(ary2) != T_ARRAY) {
if (!rb_respond_to(ary2, rb_intern("to_ary"))) {
@@ -2490,8 +2657,20 @@ rb_ary_equal(ary1, ary2)
return rb_equal(ary2, ary1);
}
if (RARRAY(ary1)->len != RARRAY(ary2)->len) return Qfalse;
+ return rb_exec_recursive(recursive_equal, ary1, ary2);
+}
+
+static VALUE recursive_eql _((VALUE, VALUE, int));
+static VALUE
+recursive_eql(ary1, ary2, recur)
+ VALUE ary1, ary2;
+ int recur;
+{
+ long i;
+
+ if (recur) return Qfalse;
for (i=0; i<RARRAY(ary1)->len; i++) {
- if (!rb_equal(rb_ary_elt(ary1, i), rb_ary_elt(ary2, i)))
+ if (!rb_eql(rb_ary_elt(ary1, i), rb_ary_elt(ary2, i)))
return Qfalse;
}
return Qtrue;
@@ -2509,33 +2688,26 @@ static VALUE
rb_ary_eql(ary1, ary2)
VALUE ary1, ary2;
{
- long i;
-
if (ary1 == ary2) return Qtrue;
if (TYPE(ary2) != T_ARRAY) return Qfalse;
if (RARRAY(ary1)->len != RARRAY(ary2)->len) return Qfalse;
- for (i=0; i<RARRAY(ary1)->len; i++) {
- if (!rb_eql(rb_ary_elt(ary1, i), rb_ary_elt(ary2, i)))
- return Qfalse;
- }
- return Qtrue;
+ return rb_exec_recursive(recursive_eql, ary1, ary2);
}
-/*
- * call-seq:
- * array.hash -> fixnum
- *
- * Compute a hash-code for this array. Two arrays with the same content
- * will have the same hash code (and will compare using <code>eql?</code>).
- */
-
+static VALUE recursive_hash _((VALUE, VALUE, int));
static VALUE
-rb_ary_hash(ary)
+recursive_hash(ary, dummy, recur)
VALUE ary;
+ VALUE dummy;
+ int recur;
{
long i, h;
VALUE n;
+ if (recur) {
+ return LONG2FIX(0);
+ }
+
h = RARRAY(ary)->len;
for (i=0; i<RARRAY(ary)->len; i++) {
h = (h << 1) | (h<0 ? 1 : 0);
@@ -2547,6 +2719,21 @@ rb_ary_hash(ary)
/*
* call-seq:
+ * array.hash -> fixnum
+ *
+ * Compute a hash-code for this array. Two arrays with the same content
+ * will have the same hash code (and will compare using <code>eql?</code>).
+ */
+
+static VALUE
+rb_ary_hash(ary)
+ VALUE ary;
+{
+ return rb_exec_recursive(recursive_hash, ary, 0);
+}
+
+/*
+ * call-seq:
* array.include?(obj) -> true or false
*
* Returns <code>true</code> if the given object is present in
@@ -2574,6 +2761,29 @@ rb_ary_includes(ary, item)
}
+static VALUE recursive_cmp _((VALUE, VALUE, int));
+static VALUE
+recursive_cmp(ary1, ary2, recur)
+ VALUE ary1;
+ VALUE ary2;
+ int recur;
+{
+ long i, len;
+
+ if (recur) return Qnil;
+ len = RARRAY(ary1)->len;
+ if (len > RARRAY(ary2)->len) {
+ len = RARRAY(ary2)->len;
+ }
+ for (i=0; i<len; i++) {
+ VALUE v = rb_funcall(rb_ary_elt(ary1, i), id_cmp, 1, rb_ary_elt(ary2, i));
+ if (v != INT2FIX(0)) {
+ return v;
+ }
+ }
+ return Qundef;
+}
+
/*
* call-seq:
* array <=> other_array -> -1, 0, +1
@@ -2598,19 +2808,13 @@ VALUE
rb_ary_cmp(ary1, ary2)
VALUE ary1, ary2;
{
- long i, len;
+ long len;
+ VALUE v;
ary2 = to_ary(ary2);
- len = RARRAY(ary1)->len;
- if (len > RARRAY(ary2)->len) {
- len = RARRAY(ary2)->len;
- }
- for (i=0; i<len; i++) {
- VALUE v = rb_funcall(rb_ary_elt(ary1, i), id_cmp, 1, rb_ary_elt(ary2, i));
- if (v != INT2FIX(0)) {
- return v;
- }
- }
+ if (ary1 == ary2) return INT2FIX(0);
+ v = rb_exec_recursive(recursive_cmp, ary1, ary2);
+ if (v != Qundef) return v;
len = RARRAY(ary1)->len - RARRAY(ary2)->len;
if (len == 0) return INT2FIX(0);
if (len > 0) return INT2FIX(1);
@@ -2850,6 +3054,7 @@ rb_ary_compact(ary)
* array.nitems -> int
*
* Returns the number of non-<code>nil</code> elements in _self_.
+ *
* May be zero.
*
* [ 1, nil, 3, nil, 5 ].nitems #=> 3
@@ -2862,111 +3067,692 @@ rb_ary_nitems(ary)
long n = 0;
VALUE *p, *pend;
- p = RARRAY(ary)->ptr;
- pend = p + RARRAY(ary)->len;
-
- while (p < pend) {
+ for (p = RARRAY(ary)->ptr, pend = p + RARRAY(ary)->len; p < pend; p++) {
if (!NIL_P(*p)) n++;
- p++;
}
return LONG2NUM(n);
}
-static long
-flatten(ary, idx, ary2, memo)
+/*
+ * call-seq:
+ * array.count -> int
+ * array.count(obj) -> int
+ * array.count { |item| block } -> int
+ *
+ * Returns the number of elements. If an argument is given, counts
+ * the number of elements which equals to <i>obj</i>. If a block is
+ * given, counts the number of elements yielding a true value.
+ *
+ * ary = [1, 2, 4, 2]
+ * ary.count # => 4
+ * ary.count(2) # => 2
+ * ary.count{|x|x%2==0} # => 3
+ *
+ */
+
+static VALUE
+rb_ary_count(argc, argv, ary)
+ int argc;
+ VALUE *argv;
VALUE ary;
- long idx;
- VALUE ary2, memo;
{
- VALUE id;
- long i = idx;
- long n, lim = idx + RARRAY(ary2)->len;
+ long n = 0;
+
+ if (argc == 0) {
+ VALUE *p, *pend;
+
+ if (!rb_block_given_p())
+ return LONG2NUM(RARRAY_LEN(ary));
- id = rb_obj_id(ary2);
- if (rb_ary_includes(memo, id)) {
- rb_raise(rb_eArgError, "tried to flatten recursive array");
+ for (p = RARRAY_PTR(ary), pend = p + RARRAY_LEN(ary); p < pend; p++) {
+ if (RTEST(rb_yield(*p))) n++;
+ }
}
- rb_ary_push(memo, id);
- rb_ary_splice(ary, idx, 1, ary2);
- while (i < lim) {
- VALUE tmp;
+ else {
+ VALUE obj, *p, *pend;
- tmp = rb_check_array_type(rb_ary_elt(ary, i));
- if (!NIL_P(tmp)) {
- n = flatten(ary, i, tmp, memo);
- i += n; lim += n;
+ rb_scan_args(argc, argv, "1", &obj);
+ if (rb_block_given_p()) {
+ rb_warn("given block not used");
+ }
+ for (p = RARRAY_PTR(ary), pend = p + RARRAY_LEN(ary); p < pend; p++) {
+ if (rb_equal(*p, obj)) n++;
+ }
+ }
+
+ return LONG2NUM(n);
+}
+
+static VALUE
+flatten(ary, level, modified)
+ VALUE ary;
+ int level;
+ int *modified;
+{
+ long i = 0;
+ VALUE stack, result, tmp, elt;
+ st_table *memo;
+ st_data_t id;
+
+ stack = ary_new(0, ARY_DEFAULT_SIZE);
+ result = ary_new(0, RARRAY_LEN(ary));
+ memo = st_init_numtable();
+ st_insert(memo, (st_data_t)ary, (st_data_t)Qtrue);
+ *modified = 0;
+
+ while (1) {
+ while (i < RARRAY(ary)->len) {
+ elt = RARRAY(ary)->ptr[i++];
+ tmp = rb_check_array_type(elt);
+ if (RBASIC(result)->klass) {
+ rb_raise(rb_eRuntimeError, "flatten reentered");
+ }
+ if (NIL_P(tmp) || (level >= 0 && RARRAY(stack)->len / 2 >= level)) {
+ rb_ary_push(result, elt);
+ }
+ else {
+ *modified = 1;
+ id = (st_data_t)tmp;
+ if (st_lookup(memo, id, 0)) {
+ st_free_table(memo);
+ rb_raise(rb_eArgError, "tried to flatten recursive array");
+ }
+ st_insert(memo, id, (st_data_t)Qtrue);
+ rb_ary_push(stack, ary);
+ rb_ary_push(stack, LONG2NUM(i));
+ ary = tmp;
+ i = 0;
+ }
+ }
+ if (RARRAY(stack)->len == 0) {
+ break;
}
- i++;
+ id = (st_data_t)ary;
+ st_delete(memo, &id, 0);
+ tmp = rb_ary_pop(stack);
+ i = NUM2LONG(tmp);
+ ary = rb_ary_pop(stack);
}
- rb_ary_pop(memo);
- return lim - idx - 1; /* returns number of increased items */
+ st_free_table(memo);
+
+ RBASIC(result)->klass = rb_class_of(ary);
+ return result;
}
/*
* call-seq:
* array.flatten! -> array or nil
+ * array.flatten!(level) -> array or nil
*
* Flattens _self_ in place.
* Returns <code>nil</code> if no modifications were made (i.e.,
- * <i>array</i> contains no subarrays.)
+ * <i>array</i> contains no subarrays.) If the optional <i>level</i>
+ * argument determines the level of recursion to flatten.
*
* a = [ 1, 2, [3, [4, 5] ] ]
* a.flatten! #=> [1, 2, 3, 4, 5]
* a.flatten! #=> nil
* a #=> [1, 2, 3, 4, 5]
+ * a = [ 1, 2, [3, [4, 5] ] ]
+ * a.flatten!(1) #=> [1, 2, 3, [4, 5]]
*/
static VALUE
-rb_ary_flatten_bang(ary)
+rb_ary_flatten_bang(argc, argv, ary)
+ int argc;
+ VALUE *argv;
VALUE ary;
{
- long i = 0;
- int mod = 0;
- VALUE memo = Qnil;
+ int mod = 0, level = -1;
+ VALUE result, lv;
- while (i<RARRAY(ary)->len) {
- VALUE ary2 = RARRAY(ary)->ptr[i];
- VALUE tmp;
+ rb_scan_args(argc, argv, "01", &lv);
+ if (!NIL_P(lv)) level = NUM2INT(lv);
+ if (level == 0) return ary;
- tmp = rb_check_array_type(ary2);
- if (!NIL_P(tmp)) {
- if (NIL_P(memo)) {
- memo = rb_ary_new();
- }
- i += flatten(ary, i, tmp, memo);
- mod = 1;
- }
- i++;
- }
+ result = flatten(ary, level, &mod);
if (mod == 0) return Qnil;
+ rb_ary_replace(ary, result);
+
return ary;
}
/*
* call-seq:
* array.flatten -> an_array
+ * array.flatten(level) -> an_array
*
* Returns a new array that is a one-dimensional flattening of this
* array (recursively). That is, for every element that is an array,
- * extract its elements into the new array.
+ * extract its elements into the new array. If the optional
+ * <i>level</i> argument determines the level of recursion to flatten.
*
* s = [ 1, 2, 3 ] #=> [1, 2, 3]
* t = [ 4, 5, 6, [7, 8] ] #=> [4, 5, 6, [7, 8]]
* a = [ s, t, 9, 10 ] #=> [[1, 2, 3], [4, 5, 6, [7, 8]], 9, 10]
- * a.flatten #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10
+ * a.flatten #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
+ * a = [ 1, 2, [3, [4, 5] ] ]
+ * a.flatten(1) #=> [1, 2, 3, [4, 5]]
*/
static VALUE
-rb_ary_flatten(ary)
+rb_ary_flatten(argc, argv, ary)
+ int argc;
+ VALUE *argv;
VALUE ary;
{
+ int mod = 0, level = -1;
+ VALUE result, lv;
+
+ rb_scan_args(argc, argv, "01", &lv);
+ if (!NIL_P(lv)) level = NUM2INT(lv);
+ if (level == 0) return ary;
+
+ result = flatten(ary, level, &mod);
+ if (OBJ_TAINTED(ary)) OBJ_TAINT(result);
+
+ return result;
+}
+
+/*
+ * call-seq:
+ * array.shuffle! -> array or nil
+ *
+ * Shuffles elements in _self_ in place.
+ */
+
+
+static VALUE
+rb_ary_shuffle_bang(ary)
+ VALUE ary;
+{
+ long i = RARRAY(ary)->len;
+
+ rb_ary_modify(ary);
+ while (i) {
+ long j = rb_genrand_real()*i;
+ VALUE tmp = RARRAY(ary)->ptr[--i];
+ RARRAY(ary)->ptr[i] = RARRAY(ary)->ptr[j];
+ RARRAY(ary)->ptr[j] = tmp;
+ }
+ return ary;
+}
+
+
+/*
+ * call-seq:
+ * array.shuffle -> an_array
+ *
+ * Returns a new array with elements of this array shuffled.
+ *
+ * a = [ 1, 2, 3 ] #=> [1, 2, 3]
+ * a.shuffle #=> [2, 3, 1]
+ */
+
+static VALUE
+rb_ary_shuffle(VALUE ary)
+{
ary = rb_ary_dup(ary);
- rb_ary_flatten_bang(ary);
+ rb_ary_shuffle_bang(ary);
return ary;
}
+/*
+ * call-seq:
+ * array.choice -> obj
+ *
+ * Choose a random element from an array.
+ */
+
+
+static VALUE
+rb_ary_choice(ary)
+ VALUE ary;
+{
+ long i, j;
+
+ i = RARRAY(ary)->len;
+ if (i == 0) return Qnil;
+ j = rb_genrand_real()*i;
+ return RARRAY(ary)->ptr[j];
+}
+
+
+/*
+ * call-seq:
+ * ary.cycle {|obj| block }
+ * ary.cycle(n) {|obj| block }
+ *
+ * Calls <i>block</i> for each element repeatedly _n_ times or
+ * forever if none or nil is given. If a non-positive number is
+ * given or the array is empty, does nothing. Returns nil if the
+ * loop has finished without getting interrupted.
+ *
+ * a = ["a", "b", "c"]
+ * a.cycle {|x| puts x } # print, a, b, c, a, b, c,.. forever.
+ * a.cycle(2) {|x| puts x } # print, a, b, c, a, b, c.
+ *
+ */
+
+static VALUE
+rb_ary_cycle(argc, argv, ary)
+ int argc;
+ VALUE *argv;
+ VALUE ary;
+{
+ long n, i;
+ VALUE nv = Qnil;
+
+ rb_scan_args(argc, argv, "01", &nv);
+
+ RETURN_ENUMERATOR(ary, argc, argv);
+ if (NIL_P(nv)) {
+ n = -1;
+ }
+ else {
+ n = NUM2LONG(nv);
+ if (n <= 0) return Qnil;
+ }
+
+ while (RARRAY(ary)->len > 0 && (n < 0 || 0 < n--)) {
+ for (i=0; i<RARRAY(ary)->len; i++) {
+ rb_yield(RARRAY(ary)->ptr[i]);
+ }
+ }
+ return Qnil;
+}
+
+#define tmpbuf(n, size) rb_str_tmp_new((n)*(size))
+
+/*
+ * Recursively compute permutations of r elements of the set [0..n-1].
+ * When we have a complete permutation of array indexes, copy the values
+ * at those indexes into a new array and yield that array.
+ *
+ * n: the size of the set
+ * r: the number of elements in each permutation
+ * p: the array (of size r) that we're filling in
+ * index: what index we're filling in now
+ * used: an array of booleans: whether a given index is already used
+ * values: the Ruby array that holds the actual values to permute
+ */
+static void
+permute0(n, r, p, index, used, values)
+ long n, r, *p, index;
+ int *used;
+ VALUE values;
+{
+ long i,j;
+ for (i = 0; i < n; i++) {
+ if (used[i] == 0) {
+ p[index] = i;
+ if (index < r-1) { /* if not done yet */
+ used[i] = 1; /* mark index used */
+ permute0(n, r, p, index+1, /* recurse */
+ used, values);
+ used[i] = 0; /* index unused */
+ }
+ else {
+ /* We have a complete permutation of array indexes */
+ /* Build a ruby array of the corresponding values */
+ /* And yield it to the associated block */
+ VALUE result = rb_ary_new2(r);
+ VALUE *result_array = RARRAY(result)->ptr;
+ const VALUE *values_array = RARRAY(values)->ptr;
+
+ for (j = 0; j < r; j++) result_array[j] = values_array[p[j]];
+ RARRAY(result)->len = r;
+ rb_yield(result);
+ }
+ }
+ }
+}
+
+/*
+ * call-seq:
+ * ary.permutation { |p| block } -> array
+ * ary.permutation -> enumerator
+ * ary.permutation(n) { |p| block } -> array
+ * ary.permutation(n) -> enumerator
+ *
+ * When invoked with a block, yield all permutations of length <i>n</i>
+ * of the elements of <i>ary</i>, then return the array itself.
+ * If <i>n</i> is not specified, yield all permutations of all elements.
+ * The implementation makes no guarantees about the order in which
+ * the permutations are yielded.
+ *
+ * When invoked without a block, return an enumerator object instead.
+ *
+ * Examples:
+ *
+ * a = [1, 2, 3]
+ * a.permutation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
+ * a.permutation(1).to_a #=> [[1],[2],[3]]
+ * a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
+ * a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
+ * a.permutation(0).to_a #=> [[]] # one permutation of length 0
+ * a.permutation(4).to_a #=> [] # no permutations of length 4
+ */
+
+static VALUE
+rb_ary_permutation(argc, argv, ary)
+ int argc;
+ VALUE *argv;
+ VALUE ary;
+{
+ VALUE num;
+ long r, n, i;
+
+ n = RARRAY(ary)->len; /* Array length */
+ RETURN_ENUMERATOR(ary, argc, argv); /* Return enumerator if no block */
+ rb_scan_args(argc, argv, "01", &num);
+ r = NIL_P(num) ? n : NUM2LONG(num); /* Permutation size from argument */
+
+ if (r < 0 || n < r) {
+ /* no permutations: yield nothing */
+ }
+ else if (r == 0) { /* exactly one permutation: the zero-length array */
+ rb_yield(rb_ary_new2(0));
+ }
+ else if (r == 1) { /* this is a special, easy case */
+ for (i = 0; i < RARRAY(ary)->len; i++) {
+ rb_yield(rb_ary_new3(1, RARRAY(ary)->ptr[i]));
+ }
+ }
+ else { /* this is the general case */
+ volatile VALUE t0 = tmpbuf(n,sizeof(long));
+ long *p = (long*)RSTRING(t0)->ptr;
+ volatile VALUE t1 = tmpbuf(n,sizeof(int));
+ int *used = (int*)RSTRING(t1)->ptr;
+ VALUE ary0 = ary_make_shared(ary); /* private defensive copy of ary */
+
+ for (i = 0; i < n; i++) used[i] = 0; /* initialize array */
+
+ permute0(n, r, p, 0, used, ary0); /* compute and yield permutations */
+ RB_GC_GUARD(t0);
+ RB_GC_GUARD(t1);
+ }
+ return ary;
+}
+
+static long
+combi_len(n, k)
+ long n, k;
+{
+ long i, val = 1;
+
+ if (k*2 > n) k = n-k;
+ if (k == 0) return 1;
+ if (k < 0) return 0;
+ val = 1;
+ for (i=1; i <= k; i++,n--) {
+ long m = val;
+ val *= n;
+ if (val < m) {
+ rb_raise(rb_eRangeError, "too big for combination");
+ }
+ val /= i;
+ }
+ return val;
+}
+
+/*
+ * call-seq:
+ * ary.combination(n) { |c| block } -> ary
+ * ary.combination(n) -> enumerator
+ *
+ * When invoked with a block, yields all combinations of length <i>n</i>
+ * of elements from <i>ary</i> and then returns <i>ary</i> itself.
+ * The implementation makes no guarantees about the order in which
+ * the combinations are yielded.
+ *
+ * When invoked without a block, returns an enumerator object instead.
+ *
+ * Examples:
+ *
+ * a = [1, 2, 3, 4]
+ * a.combination(1).to_a #=> [[1],[2],[3],[4]]
+ * a.combination(2).to_a #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
+ * a.combination(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
+ * a.combination(4).to_a #=> [[1,2,3,4]]
+ * a.combination(0).to_a #=> [[]] # one combination of length 0
+ * a.combination(5).to_a #=> [] # no combinations of length 5
+ *
+ */
+
+static VALUE
+rb_ary_combination(ary, num)
+ VALUE ary;
+ VALUE num;
+{
+ long n, i, len;
+
+ n = NUM2LONG(num);
+ RETURN_ENUMERATOR(ary, 1, &num);
+ len = RARRAY(ary)->len;
+ if (n < 0 || len < n) {
+ /* yield nothing */
+ }
+ else if (n == 0) {
+ rb_yield(rb_ary_new2(0));
+ }
+ else if (n == 1) {
+ for (i = 0; i < len; i++) {
+ rb_yield(rb_ary_new3(1, RARRAY(ary)->ptr[i]));
+ }
+ }
+ else {
+ volatile VALUE t0 = tmpbuf(n+1, sizeof(long));
+ long *stack = (long*)RSTRING(t0)->ptr;
+ long nlen = combi_len(len, n);
+ volatile VALUE cc = rb_ary_new2(n);
+ VALUE *chosen = RARRAY(cc)->ptr;
+ long lev = 0;
+
+ RBASIC(cc)->klass = 0;
+ MEMZERO(stack, long, n);
+ stack[0] = -1;
+ for (i = 0; i < nlen; i++) {
+ chosen[lev] = RARRAY(ary)->ptr[stack[lev+1]];
+ for (lev++; lev < n; lev++) {
+ chosen[lev] = RARRAY(ary)->ptr[stack[lev+1] = stack[lev]+1];
+ }
+ rb_yield(rb_ary_new4(n, chosen));
+ do {
+ stack[lev--]++;
+ } while (lev && (stack[lev+1]+n == len+lev+1));
+ }
+ }
+ return ary;
+}
+
+/*
+ * call-seq:
+ * ary.product(other_ary, ...)
+ *
+ * Returns an array of all combinations of elements from all arrays.
+ * The length of the returned array is the product of the length
+ * of ary and the argument arrays
+ *
+ * [1,2,3].product([4,5]) # => [[1,4],[1,5],[2,4],[2,5],[3,4],[3,5]]
+ * [1,2].product([1,2]) # => [[1,1],[1,2],[2,1],[2,2]]
+ * [1,2].product([3,4],[5,6]) # => [[1,3,5],[1,3,6],[1,4,5],[1,4,6],
+ * # [2,3,5],[2,3,6],[2,4,5],[2,4,6]]
+ * [1,2].product() # => [[1],[2]]
+ * [1,2].product([]) # => []
+ */
+
+static VALUE
+rb_ary_product(argc, argv, ary)
+ int argc;
+ VALUE *argv;
+ VALUE ary;
+{
+ int n = argc+1; /* How many arrays we're operating on */
+ volatile VALUE t0 = tmpbuf(n, sizeof(VALUE));
+ volatile VALUE t1 = tmpbuf(n, sizeof(int));
+ VALUE *arrays = (VALUE*)RSTRING(t0)->ptr; /* The arrays we're computing the product of */
+ int *counters = (int*)RSTRING(t1)->ptr; /* The current position in each one */
+ VALUE result; /* The array we'll be returning */
+ long i,j;
+ long resultlen = 1;
+
+ RBASIC(t0)->klass = 0;
+ RBASIC(t1)->klass = 0;
+
+ /* initialize the arrays of arrays */
+ arrays[0] = ary;
+ for (i = 1; i < n; i++) arrays[i] = to_ary(argv[i-1]);
+
+ /* initialize the counters for the arrays */
+ for (i = 0; i < n; i++) counters[i] = 0;
+
+ /* Compute the length of the result array; return [] if any is empty */
+ for (i = 0; i < n; i++) {
+ long k = RARRAY(arrays[i])->len, l = resultlen;
+ if (k == 0) return rb_ary_new2(0);
+ resultlen *= k;
+ if (resultlen < k || resultlen < l || resultlen / k != l) {
+ rb_raise(rb_eRangeError, "too big to product");
+ }
+ }
+
+ /* Otherwise, allocate and fill in an array of results */
+ result = rb_ary_new2(resultlen);
+ for (i = 0; i < resultlen; i++) {
+ int m;
+ /* fill in one subarray */
+ VALUE subarray = rb_ary_new2(n);
+ for (j = 0; j < n; j++) {
+ rb_ary_push(subarray, rb_ary_entry(arrays[j], counters[j]));
+ }
+
+ /* put it on the result array */
+ rb_ary_push(result, subarray);
+
+ /*
+ * Increment the last counter. If it overflows, reset to 0
+ * and increment the one before it.
+ */
+ m = n-1;
+ counters[m]++;
+ while (m > 0 && counters[m] == RARRAY(arrays[m])->len) {
+ counters[m] = 0;
+ m--;
+ counters[m]++;
+ }
+ }
+
+ return result;
+}
+
+/*
+ * call-seq:
+ * ary.take(n) => array
+ *
+ * Returns first n elements from <i>ary</i>.
+ *
+ * a = [1, 2, 3, 4, 5, 0]
+ * a.take(3) # => [1, 2, 3]
+ *
+ */
+
+static VALUE
+rb_ary_take(obj, n)
+ VALUE obj;
+ VALUE n;
+{
+ long len = NUM2LONG(n);
+ if (len < 0) {
+ rb_raise(rb_eArgError, "attempt to take negative size");
+ }
+
+ return rb_ary_subseq(obj, 0, len);
+}
+
+/*
+ * call-seq:
+ * ary.take_while {|arr| block } => array
+ *
+ * Passes elements to the block until the block returns nil or false,
+ * then stops iterating and returns an array of all prior elements.
+ *
+ * a = [1, 2, 3, 4, 5, 0]
+ * a.take_while {|i| i < 3 } # => [1, 2]
+ *
+ */
+
+static VALUE
+rb_ary_take_while(ary)
+ VALUE ary;
+{
+ long i;
+
+ RETURN_ENUMERATOR(ary, 0, 0);
+ for (i = 0; i < RARRAY(ary)->len; i++) {
+ if (!RTEST(rb_yield(RARRAY(ary)->ptr[i]))) break;
+ }
+ return rb_ary_take(ary, LONG2FIX(i));
+}
+
+/*
+ * call-seq:
+ * ary.drop(n) => array
+ *
+ * Drops first n elements from <i>ary</i>, and returns rest elements
+ * in an array.
+ *
+ * a = [1, 2, 3, 4, 5, 0]
+ * a.drop(3) # => [4, 5, 0]
+ *
+ */
+
+static VALUE
+rb_ary_drop(ary, n)
+ VALUE ary;
+ VALUE n;
+{
+ VALUE result;
+ long pos = NUM2LONG(n);
+ if (pos < 0) {
+ rb_raise(rb_eArgError, "attempt to drop negative size");
+ }
+
+ result = rb_ary_subseq(ary, pos, RARRAY(ary)->len);
+ if (result == Qnil) result = rb_ary_new();
+ return result;
+}
+
+/*
+ * call-seq:
+ * ary.drop_while {|arr| block } => array
+ *
+ * Drops elements up to, but not including, the first element for
+ * which the block returns nil or false and returns an array
+ * containing the remaining elements.
+ *
+ * a = [1, 2, 3, 4, 5, 0]
+ * a.drop_while {|i| i < 3 } # => [3, 4, 5, 0]
+ *
+ */
+
+static VALUE
+rb_ary_drop_while(ary)
+ VALUE ary;
+{
+ long i;
+
+ RETURN_ENUMERATOR(ary, 0, 0);
+ for (i = 0; i < RARRAY(ary)->len; i++) {
+ if (!RTEST(rb_yield(RARRAY(ary)->ptr[i]))) break;
+ }
+ return rb_ary_drop(ary, LONG2FIX(i));
+}
+
+
+
/* Arrays are ordered, integer-indexed collections of any object.
* Array indexing starts at 0, as in C or Java. A negative index is
* assumed to be relative to the end of the array---that is, an index of -1
@@ -3004,8 +3790,8 @@ Init_Array()
rb_define_method(rb_cArray, "concat", rb_ary_concat, 1);
rb_define_method(rb_cArray, "<<", rb_ary_push, 1);
rb_define_method(rb_cArray, "push", rb_ary_push_m, -1);
- rb_define_method(rb_cArray, "pop", rb_ary_pop, 0);
- rb_define_method(rb_cArray, "shift", rb_ary_shift, 0);
+ rb_define_method(rb_cArray, "pop", rb_ary_pop_m, -1);
+ rb_define_method(rb_cArray, "shift", rb_ary_shift_m, -1);
rb_define_method(rb_cArray, "unshift", rb_ary_unshift_m, -1);
rb_define_method(rb_cArray, "insert", rb_ary_insert, -1);
rb_define_method(rb_cArray, "each", rb_ary_each, 0);
@@ -3014,8 +3800,9 @@ Init_Array()
rb_define_method(rb_cArray, "length", rb_ary_length, 0);
rb_define_alias(rb_cArray, "size", "length");
rb_define_method(rb_cArray, "empty?", rb_ary_empty_p, 0);
- rb_define_method(rb_cArray, "index", rb_ary_index, 1);
- rb_define_method(rb_cArray, "rindex", rb_ary_rindex, 1);
+ rb_define_method(rb_cArray, "find_index", rb_ary_index, -1);
+ rb_define_method(rb_cArray, "index", rb_ary_index, -1);
+ rb_define_method(rb_cArray, "rindex", rb_ary_rindex, -1);
rb_define_method(rb_cArray, "indexes", rb_ary_indexes, -1);
rb_define_method(rb_cArray, "indices", rb_ary_indexes, -1);
rb_define_method(rb_cArray, "join", rb_ary_join_m, -1);
@@ -3059,9 +3846,22 @@ Init_Array()
rb_define_method(rb_cArray, "uniq!", rb_ary_uniq_bang, 0);
rb_define_method(rb_cArray, "compact", rb_ary_compact, 0);
rb_define_method(rb_cArray, "compact!", rb_ary_compact_bang, 0);
- rb_define_method(rb_cArray, "flatten", rb_ary_flatten, 0);
- rb_define_method(rb_cArray, "flatten!", rb_ary_flatten_bang, 0);
+ rb_define_method(rb_cArray, "flatten", rb_ary_flatten, -1);
+ rb_define_method(rb_cArray, "flatten!", rb_ary_flatten_bang, -1);
rb_define_method(rb_cArray, "nitems", rb_ary_nitems, 0);
+ rb_define_method(rb_cArray, "count", rb_ary_count, -1);
+ rb_define_method(rb_cArray, "shuffle!", rb_ary_shuffle_bang, 0);
+ rb_define_method(rb_cArray, "shuffle", rb_ary_shuffle, 0);
+ rb_define_method(rb_cArray, "choice", rb_ary_choice, 0);
+ rb_define_method(rb_cArray, "cycle", rb_ary_cycle, -1);
+ rb_define_method(rb_cArray, "permutation", rb_ary_permutation, -1);
+ rb_define_method(rb_cArray, "combination", rb_ary_combination, 1);
+ rb_define_method(rb_cArray, "product", rb_ary_product, -1);
+
+ rb_define_method(rb_cArray, "take", rb_ary_take, 1);
+ rb_define_method(rb_cArray, "take_while", rb_ary_take_while, 0);
+ rb_define_method(rb_cArray, "drop", rb_ary_drop, 1);
+ rb_define_method(rb_cArray, "drop_while", rb_ary_drop_while, 0);
id_cmp = rb_intern("<=>");
inspect_key = rb_intern("__inspect_key__");
diff --git a/bcc32/Makefile.sub b/bcc32/Makefile.sub
index b5546104d0..713b5c69df 100644
--- a/bcc32/Makefile.sub
+++ b/bcc32/Makefile.sub
@@ -4,8 +4,12 @@ SHELL = $(COMSPEC)
MKFILES = Makefile
#### Start of system configuration section. ####
+!ifndef OS
OS = bccwin32
-RT = $(OS)
+!endif
+!if !defined(RT)
+!error RT not defined. Retry from configure pass.
+!endif
## variables may be overridden by $(compile_dir)/Makefile
!ifndef srcdir
@@ -137,7 +141,7 @@ STACK = 0x2000000
XCFLAGS = -DRUBY_EXPORT -I. -I$(srcdir) -I$(srcdir)/missing
-ARFLAGS = /a
+ARFLAGS = /a /p32
LD = ilink32 -q -Gn
LDSHARED = $(LD)
XLDFLAGS = -Tpe c0x32.obj
@@ -153,8 +157,8 @@ EXEEXT = .exe
PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT)
WPROGRAM=$(RUBYW_INSTALL_NAME)$(EXEEXT)
RUBYDEF = $(RUBY_SO_NAME).def
-MINIRUBY = .\miniruby$(EXEEXT) $(MINIRUBYOPT)
-RUNRUBY = .\ruby$(EXEEXT) "$(srcdir)/runruby.rb" --extout="$(EXTOUT)" --
+MINIRUBY = .\miniruby$(EXEEXT) -I$(srcdir)/lib $(MINIRUBYOPT)
+RUNRUBY = .\$(PROGRAM) "$(srcdir)/runruby.rb" --extout="$(EXTOUT)" --
ORGLIBPATH = $(LIB)
@@ -197,7 +201,13 @@ rubyw: $(WPROGRAM)
!include $(srcdir)/common.mk
-PHONY: Makefile
+$(MKFILES): $(srcdir)/bcc32/Makefile.sub $(srcdir)/bcc32/configure.bat $(srcdir)/bcc32/setup.mak
+ $(COMSPEC) /C $(srcdir:/=\)\bcc32\configure.bat $(configure_args)
+ @echo $(MKFILES) should be updated, re-run $(MAKE).
+ @$(MAKE) > nul -q -f &&|
+PHONY: nul
+ @exit
+|
CONFIG_H = ./.config.h.time
@@ -253,6 +263,7 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/bcc32/Makefile.sub
\#define HAVE_STRTOD 1
\#define HAVE_STRTOL 1
\#define HAVE_STRTOUL 1
+\#define HAVE_VSNPRINTF 1
\#define HAVE_ISNAN 1
\#define HAVE_FINITE 1
\#define HAVE_HYPOT 1
@@ -272,6 +283,9 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/bcc32/Makefile.sub
\#define RSHIFT(x,y) ((x)>>(int)y)
\#define FILE_COUNT level
\#define FILE_READPTR curp
+\#define RUBY_SETJMP(env) _setjmp(env)
+\#define RUBY_LONGJMP(env,val) longjmp(env,val)
+\#define RUBY_JMP_BUF jmp_buf
\#define inline __inline
\#define NEED_IO_SEEK_BETWEEN_RW 1
\#define STACK_GROW_DIRECTION -1
@@ -280,9 +294,12 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/bcc32/Makefile.sub
\#define RUBY_LIB "/lib/ruby/$(MAJOR).$(MINOR)"
\#define RUBY_SITE_LIB "/lib/ruby/site_ruby"
\#define RUBY_SITE_LIB2 "/lib/ruby/site_ruby/$(MAJOR).$(MINOR)"
+\#define RUBY_VENDOR_LIB "/lib/ruby/vendor_ruby"
+\#define RUBY_VENDOR_LIB2 "/lib/ruby/vendor_ruby/$(MAJOR).$(MINOR)"
\#define RUBY_PLATFORM "$(ARCH)-$(OS)"
\#define RUBY_ARCHLIB "/lib/ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(OS)"
\#define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(OS)"
+\#define RUBY_VENDOR_ARCHLIB "/lib/ruby/vendor_ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(OS)"
|
@exit > $@
@@ -336,7 +353,7 @@ s,@RANLIB@,,;t t
s,@AR@,$(AR),;t t
s,@ARFLAGS@,$(ARFLAGS) ,;t t
s,@LN_S@,$(LN_S),;t t
-s,@SET_MAKE@,$(SET_MAKE),;t t
+s,@SET_MAKE@,MFLAGS = -$$(MAKEFLAGS),;t t
s,@CP@,copy > nul,;t t
s,@LIBOBJS@, acosh.obj crypt.obj erf.obj win32.obj,;t t
s,@ALLOCA@,$(ALLOCA),;t t
@@ -395,6 +412,7 @@ s,@EXPORT_PREFIX@,_,;t t
s,@arch@,$(ARCH)-$(OS),;t t
s,@sitearch@,$(ARCH)-$(OS),;t t
s,@sitedir@,$${prefix}/lib/ruby/site_ruby,;t t
+s,@vendordir@,$${prefix}/lib/ruby/vendor_ruby,;t t
s,@configure_args@,--enable-shared $(configure_args),;t t
s,@configure_input@,$$configure_input,;t t
s,@srcdir@,$(srcdir),;t t
@@ -449,14 +467,46 @@ post-install-doc::
@$(NULLCMD)
clean-local::
- @$(RM) ext\extinit.c ext\extinit.$(OBJEXT) *.tds *.il? $(RUBY_SO_NAME).lib
+ @$(RM) $(WINMAINOBJ) ext\extinit.c ext\extinit.$(OBJEXT) *.tds *.il? $(RUBY_SO_NAME).lib
@$(RM) $(RUBY_INSTALL_NAME).res $(RUBYW_INSTALL_NAME).res $(RUBY_SO_NAME).res
+ @$(RM) *.map *.pdb *.ilk *.exp $(RUBYDEF)
distclean-local::
@$(RM) ext\config.cache $(RBCONFIG:/=\)
- @$(RM) *.map *.pdb *.ilk *.exp $(RUBYDEF)
@$(RM) $(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(RUBY_SO_NAME).rc
+update-rubyspec:
+ @echo SPEC_EXISTS=0 > $@.mk
+ @if exist $(srcdir:/=\)\rubyspec\nul echo SPEC_EXISTS=1 >> $@.mk
+ @type >> $@.mk &&|
+$()update-rubyspec:
+$() @del $@.mk
+$()!if $$(SPEC_EXISTS)
+$() cd $(srcdir:/=\)\rubyspec\mspec
+$() git pull
+$() cd ..\spec\rubyspec
+$() git pull
+$()!else
+$() git clone $(MSPEC_GIT_URL) $(srcdir)/rubyspec/mspec
+$() git clone $(RUBYSPEC_GIT_URL) $(srcdir)/rubyspec/spec/rubyspec
+$()!endif
+|
+ @$(MAKE) -$(MAKEFLAGS)$(MFLAGS) -f $@.mk
+
+test-rubyspec:
+ @echo SPEC_EXISTS=0 > $@.mk
+ @if exist $(srcdir:/=\)\rubyspec\nul echo SPEC_EXISTS=1 >> $@.mk
+ @type >> $@.mk &&|
+$()test-rubyspec:
+$()!if $$(SPEC_EXISTS)
+$() $(RUNRUBY) $(srcdir)/rubyspec/mspec/bin/mspec -r$(srcdir)/ext/purelib.rb $(srcdir)/rubyspec/spec/rubyspec/$(MAJOR).$(MINOR)
+$()!else
+$() @echo No rubyspec here. put rubyspec to srcdir first.
+$() @cd $(srcdir:/=\)\rubyspec
+$()!endif
+|
+ @$(MAKE) -$(MAKEFLAGS) -f $@.mk
+
ext/extinit.obj: ext/extinit.c $(SETUP)
$(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) -o$@ -c ext/extinit.c
diff --git a/bcc32/configure.bat b/bcc32/configure.bat
index 143ad947f0..95575cbc60 100755
--- a/bcc32/configure.bat
+++ b/bcc32/configure.bat
@@ -6,70 +6,110 @@
echo> ~tmp~.mak ####
echo>> ~tmp~.mak conf = %0
echo>> ~tmp~.mak $(conf:\=/): nul
-echo>> ~tmp~.mak @del ~tmp~.mak
+echo>> ~tmp~.mak @del ~setup~.mak
echo>> ~tmp~.mak @-$(MAKE) -l$(MAKEFLAGS) -f $(@D)setup.mak \
+if exist pathlist.tmp del pathlist.tmp
+if exist confargs.mk del confargs.mk
:loop
if "%1" == "" goto :end
if "%1" == "--prefix" goto :prefix
+if "%1" == "prefix" goto :prefix
if "%1" == "--srcdir" goto :srcdir
if "%1" == "srcdir" goto :srcdir
if "%1" == "--target" goto :target
if "%1" == "target" goto :target
if "%1" == "--with-static-linked-ext" goto :extstatic
if "%1" == "--program-suffix" goto :suffix
-if "%1" == "--program-name" goto :progname
+if "%1" == "RUBY_SUFFIX" goto :suffix
+if "%1" == "--program-name" goto :installname
+if "%1" == "--install-name" goto :installname
+if "%1" == "RUBY_INSTALL_NAME" goto :installname
+if "%1" == "--so-name" goto :soname
+if "%1" == "RUBY_SO_NAME" goto :soname
if "%1" == "--enable-install-doc" goto :enable-rdoc
if "%1" == "--disable-install-doc" goto :disable-rdoc
if "%1" == "--extout" goto :extout
+if "%1" == "EXTOUT" goto :extout
+if "%1" == "--path" goto :path
if "%1" == "-h" goto :help
if "%1" == "--help" goto :help
- echo>> ~tmp~.mak "%1" \
+ echo>>confargs.tmp %1 \
shift
goto :loop
:srcdir
- echo>> ~tmp~.mak -D"srcdir=%2" \
+ echo>> ~tmp~.mak -Dsrcdir=%2 \
+ echo>>confargs.tmp --srcdir=%2 \
shift
shift
goto :loop
:prefix
- echo>> ~tmp~.mak -D"prefix=%2" \
+ echo>> ~tmp~.mak -Dprefix=%2 \
+ echo>>confargs.tmp %1=%2 \
shift
shift
goto :loop
:suffix
- echo>> ~tmp~.mak -D"RUBY_SUFFIX=%2" \
+ echo>>confargs.mk !ifndef RUBY_SUFFIX
+ echo>>confargs.mk RUBY_SUFFIX = %2
+ echo>>confargs.mk !endif
+ echo>>confargs.tmp %1=%2 \
shift
shift
goto :loop
:installname
- echo>> ~tmp~.mak -D"RUBY_INSTALL_NAME=%2" \
+ echo>>confargs.mk !ifndef RUBY_INSTALL_NAME
+ echo>>confargs.mk RUBY_INSTALL_NAME = %2
+ echo>>confargs.mk !endif
+ echo>>confargs.tmp %1=%2 \
shift
shift
goto :loop
:soname
- echo>> ~tmp~.mak -D"RUBY_SO_NAME=%2" \
+ echo>>confargs.mk !ifndef RUBY_SO_NAME
+ echo>>confargs.mk RUBY_SO_NAME = %2
+ echo>>confargs.mk !endif
+ echo>>confargs.tmp %1=%2 \
shift
shift
goto :loop
:target
- echo>> ~tmp~.mak "%2" \
+ echo>> ~tmp~.mak %2 \
+ echo>>confargs.tmp --target=%2 \
shift
shift
goto :loop
:extstatic
- echo>> ~tmp~.mak -D"EXTSTATIC=static" \
+ echo>>confargs.mk !ifndef EXTSTATIC
+ echo>>confargs.mk EXTSTATIC = static
+ echo>>confargs.mk !endif
+ echo>>confargs.tmp %1 \
shift
goto :loop
:enable-rdoc
- echo>> ~tmp~.mak -D"RDOCTARGET=install-doc" \
+ echo>>confargs.mk !ifndef RDOCTARGET
+ echo>>confargs.mk RDOCTARGET = install-doc
+ echo>>confargs.mk !endif
+ echo>>confargs.tmp %1 \
shift
goto :loop
:disable-rdoc
- echo>> ~tmp~.mak -D"RDOCTARGET=install-nodoc" \
+ echo>>confargs.mk !ifndef RDOCTARGET
+ echo>>confargs.mk RDOCTARGET = install-nodoc
+ echo>>confargs.mk !endif
+ echo>>confargs.tmp %1 \
shift
goto :loop
:extout
- echo>> ~tmp~.mak -D"EXTOUT=%2" \
+ echo>>confargs.mk !ifndef EXTOUT
+ echo>>confargs.mk EXTOUT = %2
+ echo>>confargs.mk !endif
+ echo>>confargs.tmp %1=%2 \
+ shift
+ shift
+goto :loop
+:path
+ echo>>pathlist.tmp %2;\
+ echo>>confargs.tmp %1=%2 \
shift
shift
goto :loop
@@ -83,10 +123,30 @@ goto :loop
echo --target=TARGET configure for TARGET [i386-bccwin32]
echo Optional Package:
echo --with-static-linked-ext link external modules statically
- echo --enable-install-doc install rdoc indexes during install
+ echo --disable-install-doc install rdoc indexes during install
+ del *.tmp
del ~tmp~.mak
goto :exit
:end
-echo>> ~tmp~.mak -Dbcc32dir="$(@D)"
-make -s -f ~tmp~.mak
+echo>> ~tmp~.mak -Dbcc32dir=$(@D)
+if not exist confargs.tmp goto :noconfargs
+ echo>>confargs.mk configure_args = \
+ type>>confargs.mk confargs.tmp
+ echo.>>confargs.mk
+ echo>>confargs.mk ####
+:noconfargs
+if not exist pathlist.tmp goto :nopathlist
+ echo>>confargs.mk pathlist = \
+ type>>confargs.mk pathlist.tmp
+ echo.>>confargs.mk
+ echo>>confargs.mk ####
+ echo>>confargs.mk PATH = $(pathlist:;=/bin;)$(PATH)
+ echo>>confargs.mk INCLUDE = $(pathlist:;=/include;)
+ echo>>confargs.mk LIB = $(pathlist:;=/lib;)
+:nopathlist
+if exist confargs.mk copy confargs.mk ~setup~.mak > nul
+type>>~setup~.mak ~tmp~.mak
+del *.tmp > nul
+del ~tmp~.mak > nul
+make -s -f ~setup~.mak
:exit
diff --git a/bcc32/setup.mak b/bcc32/setup.mak
index b7a2539d0a..483292ed51 100644
--- a/bcc32/setup.mak
+++ b/bcc32/setup.mak
@@ -30,7 +30,9 @@ i586-$(OS): -prologue- -i586- -epilogue-
i686-$(OS): -prologue- -i686- -epilogue-
alpha-$(OS): -prologue- -alpha- -epilogue-
--prologue-: nul
+-prologue-: -basic-vars- -version- -system-vars-
+
+-basic-vars-: nul
@echo Creating $(MAKEFILE)
@type > $(MAKEFILE) &&|
\#\#\# Makefile for ruby $(OS) \#\#\#
@@ -40,36 +42,68 @@ $(BANG)endif
$(BANG)ifndef prefix
prefix = $(prefix:\=/)
$(BANG)endif
-$(BANG)ifndef EXTSTATIC
-EXTSTATIC = $(EXTSTATIC)
-$(BANG)endif
-!if defined(RDOCTARGET)
-$(BANG)ifndef RDOCTARGET
-RDOCTARGET = $(RDOCTARGET)
-$(BANG)endif
-!endif
-!if defined(EXTOUT)
-$(BANG)ifndef EXTOUT
-EXTOUT = $(EXTOUT)
-$(BANG)endif
+|
+!if exist(confargs.mk)
+ @type confargs.mk >> $(MAKEFILE)
+ @del confargs.mk
!endif
+
+-system-vars-: -runtime- -bormm-
+
+-bormm-: nul
+ @-ilink32 -q -Gn -x usebormm.lib > nul
+ @-if exist usebormm.tds $(APPEND) MEMLIB = usebormm.lib
+ @if exist usebormm.* del usebormm.*
+
+-osname-: nul
+ @echo OS = >>$(MAKEFILE)
+
+-runtime-: nul
+ type > conftest.c &&|
+\#include <stdio.h>
+int main(){printf("");return 0;}
|
- @type > usebormm.bat &&|
-@echo off
-ilink32 -Gn -x usebormm.lib > nul
-if exist usebormm.tds echo MEMLIB = usebormm.lib
+ bcc32 conftest.c cw32i.lib > nul
+ tdump conftest.exe < nul > conftest.i
+ grep "^Imports from CC" conftest.i > conftest.c
+ cpp32 -P- -DFile=\# -DImports=RTNAME -Dfrom== conftest.c > nul
+ $(MAKE) > nul -DBANG=$(BANG) -f &&|
+-runtime-: nul
+$(BANG)include conftest.i
+RT = $$(RTNAME:.DLL=)
+OS = $$(RT:CC32=)
+-runtime-:
+ del conftest.*
+$(BANG)if "$$(OS)" == "50"
+ echo OS = bccwin32 >> $(MAKEFILE)
+$(BANG)else
+ echo OS = bccwin32_$$(OS) >> $(MAKEFILE)
+$(BANG)endif
|
- @usebormm.bat >> $(MAKEFILE)
- @del usebormm.*
+ @echo RT = $$(OS) >> $(MAKEFILE)
+-version-: nul
@cpp32 -I$(srcdir) -P- -o$(MAKEFILE) > nul &&|
\#include "version.h"
MAJOR = RUBY_VERSION_MAJOR
MINOR = RUBY_VERSION_MINOR
TEENY = RUBY_VERSION_TEENY
+
+BORLANDC = __BORLANDC__
|
- @type $(MAKEFILE).i >> $(MAKEFILE)
+ @$(MAKE) > nul -DBANG=$(BANG) -f &&,
+-version-: nul
+$(BANG)include $(MAKEFILE)
+$(BANG)include $(MAKEFILE).i
+-version-:
@del $(MAKEFILE).i
+ @type >> $(MAKEFILE) &&|
+MAJOR = $$(MAJOR)
+MINOR = $$(MINOR)
+TEENY = $$(TEENY)
+BORLANDC = $$(BORLANDC)
+|
+,
-generic-: nul
!if defined(PROCESSOR_ARCHITECTURE) || defined(PROCESSOR_LEVEL)
@@ -84,7 +118,6 @@ $(BANG)ifndef PROCESSOR_LEVEL
PROCESSOR_LEVEL = $(PROCESSOR_LEVEL)
$(BANG)endif
!endif
-
|
!endif
@@ -117,8 +150,6 @@ $(BANG)endif
-epilogue-: nul
@type >> $(MAKEFILE) &&|
-\# OS = $(OS)
-\# RT = $(RT)
\# RUBY_INSTALL_NAME = ruby
\# RUBY_SO_NAME = $$(RT)-$$(RUBY_INSTALL_NAME)$$(MAJOR)$$(MINOR)
\# CFLAGS = -q $$(DEBUGFLAGS) $$(OPTFLAGS) $$(PROCESSOR_FLAG) -w- -wsus -wcpt -wdup -wext -wrng -wrpt -wzdi
@@ -129,5 +160,4 @@ $(BANG)endif
\# EXTLIBS = cw32.lib import32.lib user32.lib kernel32.lib
$(BANG)include $$(srcdir)/bcc32/Makefile.sub
|
- @$(srcdir:/=\)\win32\rm.bat config.h config.status
@echo type "`$(MAKE)'" to make ruby for $(OS).
diff --git a/bignum.c b/bignum.c
index 9a5b3c154a..7f14aee709 100644
--- a/bignum.c
+++ b/bignum.c
@@ -11,8 +11,10 @@
**********************************************************************/
#include "ruby.h"
+#include "rubysig.h"
#include <math.h>
+#include <float.h>
#include <ctype.h>
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
@@ -36,7 +38,21 @@ VALUE rb_cBignum;
#define BIGLO(x) ((BDIGIT)((x) & (BIGRAD-1)))
#define BDIGMAX ((BDIGIT)-1)
-#define BIGZEROP(x) (RBIGNUM(x)->len == 0 || (RBIGNUM(x)->len == 1 && BDIGITS(x)[0] == 0))
+#define BIGZEROP(x) (RBIGNUM(x)->len == 0 || \
+ (BDIGITS(x)[0] == 0 && \
+ (RBIGNUM(x)->len == 1 || bigzero_p(x))))
+
+static int bigzero_p(VALUE);
+static int
+bigzero_p(x)
+ VALUE x;
+{
+ long i;
+ for (i = 0; i < RBIGNUM(x)->len; ++i) {
+ if (BDIGITS(x)[i]) return 0;
+ }
+ return 1;
+}
static VALUE
bignew_1(klass, len, sign)
@@ -110,7 +126,8 @@ bigtrunc(x)
}
static VALUE
-bigfixize(VALUE x)
+bigfixize(x)
+ VALUE x;
{
long len = RBIGNUM(x)->len;
BDIGIT *ds = BDIGITS(x);
@@ -133,7 +150,8 @@ bigfixize(VALUE x)
}
static VALUE
-bignorm(VALUE x)
+bignorm(x)
+ VALUE x;
{
if (!FIXNUM_P(x) && TYPE(x) == T_BIGNUM) {
x = bigfixize(bigtrunc(x));
@@ -445,7 +463,14 @@ rb_cstr_to_inum(str, base, badcheck)
break;
}
if (*str == '0') { /* squeeze preceeding 0s */
- while (*++str == '0');
+ int us = 0;
+ while ((c = *++str) == '0' || c == '_') {
+ if (c == '_') {
+ if (++us >= 2)
+ break;
+ } else
+ us = 0;
+ }
if (!(c = *str) || ISSPACE(c)) --str;
}
c = *str;
@@ -488,10 +513,11 @@ rb_cstr_to_inum(str, base, badcheck)
for (i=len;i--;) zds[i]=0;
while ((c = *str++) != 0) {
if (c == '_') {
- if (badcheck) {
- if (nondigit) goto bad;
- nondigit = c;
+ if (nondigit) {
+ if (badcheck) goto bad;
+ break;
}
+ nondigit = c;
continue;
}
else if ((c = conv_digit(c)) < 0) {
@@ -553,7 +579,7 @@ rb_str_to_inum(str, base, badcheck)
s = p;
}
}
- return rb_cstr_to_inum(s, base, badcheck);
+ return rb_cstr_to_inum(s, base, badcheck);
}
#if HAVE_LONG_LONG
@@ -615,7 +641,7 @@ rb_ll2inum(n)
}
#endif /* HAVE_LONG_LONG */
-
+
VALUE
rb_cstr2inum(str, base)
const char *str;
@@ -652,6 +678,9 @@ rb_big2str0(x, base, trim)
if (BIGZEROP(x)) {
return rb_str_new2("0");
}
+ if (i >= LONG_MAX/SIZEOF_BDIGITS/CHAR_BIT) {
+ rb_raise(rb_eRangeError, "bignum too big to convert into `string'");
+ }
j = SIZEOF_BDIGITS*CHAR_BIT*i;
switch (base) {
case 2: break;
@@ -692,6 +721,7 @@ rb_big2str0(x, base, trim)
s = RSTRING(ss)->ptr;
s[0] = RBIGNUM(x)->sign ? '+' : '-';
+ TRAP_BEG;
while (i && j > 1) {
long k = i;
BDIGIT_DBL num = 0;
@@ -721,6 +751,7 @@ rb_big2str0(x, base, trim)
RSTRING(ss)->len = i;
}
s[RSTRING(ss)->len] = '\0';
+ TRAP_END;
return ss;
}
@@ -734,10 +765,10 @@ rb_big2str(VALUE x, int base)
/*
* call-seq:
* big.to_s(base=10) => string
- *
+ *
* Returns a string containing the representation of <i>big</i> radix
* <i>base</i> (2 through 36).
- *
+ *
* 12345654321.to_s #=> "12345654321"
* 12345654321.to_s(2) #=> "1011011111110110111011110000110001"
* 12345654321.to_s(8) #=> "133766736061"
@@ -781,15 +812,15 @@ big2ulong(x, type)
}
unsigned long
-rb_big2ulong_pack(x)
- VALUE x;
-{
+rb_big2ulong_pack(x)
+ VALUE x;
+{
unsigned long num = big2ulong(x, "unsigned long");
if (!RBIGNUM(x)->sign) {
return -num;
}
return num;
-}
+}
unsigned long
rb_big2ulong(x)
@@ -907,8 +938,8 @@ rb_dbl2big(d)
return bignorm(dbl2big(d));
}
-double
-rb_big2dbl(x)
+static double
+big2dbl(x)
VALUE x;
{
double d = 0.0;
@@ -918,21 +949,30 @@ rb_big2dbl(x)
while (i--) {
d = ds[i] + BIGRAD*d;
}
+ if (!RBIGNUM(x)->sign) d = -d;
+ return d;
+}
+
+double
+rb_big2dbl(x)
+ VALUE x;
+{
+ double d = big2dbl(x);
+
if (isinf(d)) {
rb_warn("Bignum out of Float range");
d = HUGE_VAL;
}
- if (!RBIGNUM(x)->sign) d = -d;
return d;
}
/*
* call-seq:
* big.to_f -> float
- *
+ *
* Converts <i>big</i> to a <code>Float</code>. If <i>big</i> doesn't
* fit in a <code>Float</code>, the result is infinity.
- *
+ *
*/
static VALUE
@@ -945,11 +985,11 @@ rb_big_to_f(x)
/*
* call-seq:
* big <=> numeric => -1, 0, +1
- *
+ *
* Comparison---Returns -1, 0, or +1 depending on whether <i>big</i> is
* less than, equal to, or greater than <i>numeric</i>. This is the
* basis for the tests in <code>Comparable</code>.
- *
+ *
*/
static VALUE
@@ -990,11 +1030,11 @@ rb_big_cmp(x, y)
/*
* call-seq:
* big == obj => true or false
- *
+ *
* Returns <code>true</code> only if <i>obj</i> has the same value
* as <i>big</i>. Contrast this with <code>Bignum#eql?</code>, which
* requires <i>obj</i> to be a <code>Bignum</code>.
- *
+ *
* 68719476736 == 68719476736.0 #=> true
*/
@@ -1029,11 +1069,11 @@ rb_big_eq(x, y)
/*
* call-seq:
* big.eql?(obj) => true or false
- *
+ *
* Returns <code>true</code> only if <i>obj</i> is a
* <code>Bignum</code> with the same value as <i>big</i>. Contrast this
* with <code>Bignum#==</code>, which performs type conversions.
- *
+ *
* 68719476736.eql?(68719476736.0) #=> false
*/
@@ -1074,7 +1114,7 @@ rb_big_uminus(x)
* length, the result acts as if it had an infinite number of one
* bits to the left. In hex representations, this is displayed
* as two periods to the left of the digits.
- *
+ *
* sprintf("%X", ~0x1122334455) #=> "..FEEDDCCBBAA"
*/
@@ -1105,7 +1145,7 @@ bigsub(x, y)
BDIGIT *zds;
BDIGIT_DBL_SIGNED num;
long i = RBIGNUM(x)->len;
-
+
/* if x is larger than y, swap */
if (RBIGNUM(x)->len < RBIGNUM(y)->len) {
z = x; x = y; y = z; /* swap x y */
@@ -1126,11 +1166,11 @@ bigsub(x, y)
z = bignew(RBIGNUM(x)->len, z==0);
zds = BDIGITS(z);
- for (i = 0, num = 0; i < RBIGNUM(y)->len; i++) {
+ for (i = 0, num = 0; i < RBIGNUM(y)->len; i++) {
num += (BDIGIT_DBL_SIGNED)BDIGITS(x)[i] - BDIGITS(y)[i];
zds[i] = BIGLO(num);
num = BIGDN(num);
- }
+ }
while (num && i < RBIGNUM(x)->len) {
num += BDIGITS(x)[i];
zds[i++] = BIGLO(num);
@@ -1140,7 +1180,7 @@ bigsub(x, y)
zds[i] = BDIGITS(x)[i];
i++;
}
-
+
return z;
}
@@ -1271,7 +1311,7 @@ rb_big_mul0(x, y)
zds = BDIGITS(z);
while (j--) zds[j] = 0;
for (i = 0; i < RBIGNUM(x)->len; i++) {
- BDIGIT_DBL dd = BDIGITS(x)[i];
+ BDIGIT_DBL dd = BDIGITS(x)[i];
if (dd == 0) continue;
n = 0;
for (j = 0; j < RBIGNUM(y)->len; j++) {
@@ -1348,7 +1388,7 @@ bigdivrem(x, y, divp, modp)
dd = 0;
q = yds[ny-1];
- while ((q & (1<<(BITSPERDIG-1))) == 0) {
+ while ((q & (1U<<(BITSPERDIG-1))) == 0) {
q <<= 1;
dd++;
}
@@ -1472,9 +1512,6 @@ rb_big_div(x, y)
case T_BIGNUM:
break;
- case T_FLOAT:
- return rb_float_new(rb_big2dbl(x) / RFLOAT(y)->value);
-
default:
return rb_num_coerce_bin(x, y);
}
@@ -1517,9 +1554,9 @@ rb_big_modulo(x, y)
/*
* call-seq:
* big.remainder(numeric) => number
- *
+ *
* Returns the remainder after dividing <i>big</i> by <i>numeric</i>.
- *
+ *
* -1234567890987654321.remainder(13731) #=> -6966
* -1234567890987654321.remainder(13731.24) #=> -9906.22531493148
*/
@@ -1545,6 +1582,27 @@ rb_big_remainder(x, y)
return bignorm(z);
}
+static int
+bdigbitsize(BDIGIT x)
+{
+ int size = 1;
+ int nb = BITSPERDIG / 2;
+ BDIGIT bits = (~0 << nb);
+
+ if (!x) return 0;
+ while (x > 1) {
+ if (x & bits) {
+ size += nb;
+ x >>= nb;
+ }
+ x &= ~bits;
+ nb /= 2;
+ bits >>= nb;
+ }
+
+ return size;
+}
+
static VALUE big_lshift _((VALUE, unsigned long));
static VALUE big_rshift _((VALUE, unsigned long));
@@ -1562,9 +1620,9 @@ static VALUE big_shift(x, n)
/*
* call-seq:
* big.divmod(numeric) => array
- *
+ *
* See <code>Numeric#divmod</code>.
- *
+ *
*/
VALUE
rb_big_divmod(x, y)
@@ -1591,22 +1649,51 @@ rb_big_divmod(x, y)
/*
* call-seq:
* big.quo(numeric) -> float
- *
+ * big.fdiv(numeric) -> float
+ *
* Returns the floating point result of dividing <i>big</i> by
* <i>numeric</i>.
- *
+ *
* -1234567890987654321.quo(13731) #=> -89910996357705.5
* -1234567890987654321.quo(13731.24) #=> -89909424858035.7
- *
+ *
*/
static VALUE
rb_big_quo(x, y)
VALUE x, y;
{
- double dx = rb_big2dbl(x);
+ double dx = big2dbl(x);
double dy;
+ if (isinf(dx)) {
+#define DBL_BIGDIG ((DBL_MANT_DIG + BITSPERDIG) / BITSPERDIG)
+ VALUE z;
+ int ex, ey;
+
+ ex = (RBIGNUM(bigtrunc(x))->len - 1) * BITSPERDIG;
+ ex += bdigbitsize(BDIGITS(x)[RBIGNUM(x)->len - 1]);
+ ex -= 2 * DBL_BIGDIG * BITSPERDIG;
+ if (ex) x = big_shift(x, ex);
+
+ switch (TYPE(y)) {
+ case T_FIXNUM:
+ y = rb_int2big(FIX2LONG(y));
+ case T_BIGNUM: {
+ ey = (RBIGNUM(bigtrunc(y))->len - 1) * BITSPERDIG;
+ ey += bdigbitsize(BDIGITS(y)[RBIGNUM(y)->len - 1]);
+ ey -= DBL_BIGDIG * BITSPERDIG;
+ if (ey) y = big_shift(y, ey);
+ bignum:
+ bigdivrem(x, y, &z, 0);
+ return rb_float_new(ldexp(big2dbl(z), ex - ey));
+ }
+ case T_FLOAT:
+ y = dbl2big(ldexp(frexp(RFLOAT(y)->value, &ey), DBL_MANT_DIG));
+ ey -= DBL_MANT_DIG;
+ goto bignum;
+ }
+ }
switch (TYPE(y)) {
case T_FIXNUM:
dy = (double)FIX2LONG(y);
@@ -1626,6 +1713,52 @@ rb_big_quo(x, y)
return rb_float_new(dx / dy);
}
+static VALUE
+bigsqr(x)
+ VALUE x;
+{
+ long len = RBIGNUM(x)->len, k = len / 2, i;
+ VALUE a, b, a2, z;
+ BDIGIT_DBL num;
+
+ if (len < 4000 / BITSPERDIG) {
+ return rb_big_mul0(x, x);
+ }
+
+ a = bignew(len - k, 1);
+ MEMCPY(BDIGITS(a), BDIGITS(x) + k, BDIGIT, len - k);
+ b = bignew(k, 1);
+ MEMCPY(BDIGITS(b), BDIGITS(x), BDIGIT, k);
+
+ a2 = bigtrunc(bigsqr(a));
+ z = bigsqr(b);
+ REALLOC_N(RBIGNUM(z)->digits, BDIGIT, (len = 2 * k + RBIGNUM(a2)->len) + 1);
+ while (RBIGNUM(z)->len < 2 * k) BDIGITS(z)[RBIGNUM(z)->len++] = 0;
+ MEMCPY(BDIGITS(z) + 2 * k, BDIGITS(a2), BDIGIT, RBIGNUM(a2)->len);
+ RBIGNUM(z)->len = len;
+ a2 = bigtrunc(rb_big_mul0(a, b));
+ len = RBIGNUM(a2)->len;
+ TRAP_BEG;
+ for (i = 0, num = 0; i < len; i++) {
+ num += (BDIGIT_DBL)BDIGITS(z)[i + k] + ((BDIGIT_DBL)BDIGITS(a2)[i] << 1);
+ BDIGITS(z)[i + k] = BIGLO(num);
+ num = BIGDN(num);
+ }
+ TRAP_END;
+ if (num) {
+ len = RBIGNUM(z)->len;
+ for (i += k; i < len && num; ++i) {
+ num += (BDIGIT_DBL)BDIGITS(z)[i];
+ BDIGITS(z)[i] = BIGLO(num);
+ num = BIGDN(num);
+ }
+ if (num) {
+ BDIGITS(z)[RBIGNUM(z)->len++] = BIGLO(num);
+ }
+ }
+ return bigtrunc(z);
+}
+
/*
* call-seq:
* big ** exponent #=> numeric
@@ -1645,7 +1778,7 @@ rb_big_pow(x, y)
{
double d;
long yy;
-
+
if (y == INT2FIX(0)) return INT2FIX(1);
switch (TYPE(y)) {
case T_FLOAT:
@@ -1660,7 +1793,8 @@ rb_big_pow(x, y)
case T_FIXNUM:
yy = FIX2LONG(y);
if (yy > 0) {
- VALUE z = x;
+ VALUE z = 0;
+ long mask;
const long BIGLEN_LIMIT = 1024*1024 / SIZEOF_BDIGITS;
if ((RBIGNUM(x)->len > BIGLEN_LIMIT) ||
@@ -1669,16 +1803,11 @@ rb_big_pow(x, y)
d = (double)yy;
break;
}
- for (;;) {
- yy -= 1;
- if (yy == 0) break;
- while (yy % 2 == 0) {
- yy /= 2;
- x = rb_big_mul0(x, x);
- bigtrunc(x);
+ for (mask = FIXNUM_MAX + 1; mask; mask >>= 1) {
+ if (z) z = bigtrunc(bigsqr(z));
+ if (yy & mask) {
+ z = z ? bigtrunc(rb_big_mul0(z, x)) : x;
}
- z = rb_big_mul0(z, x);
- bigtrunc(z);
}
return bignorm(z);
}
@@ -1903,7 +2032,7 @@ rb_big_lshift(x, y)
if (!NIL_P(t)) return t;
neg = 1;
}
- shift = big2ulong(y, "long", Qtrue);
+ shift = big2ulong(y, "long");
break;
}
y = rb_to_int(y);
@@ -1972,7 +2101,7 @@ rb_big_rshift(x, y)
else {
neg = 1;
}
- shift = big2ulong(y, "long", Qtrue);
+ shift = big2ulong(y, "long");
break;
}
y = rb_to_int(y);
@@ -2030,20 +2159,20 @@ big_rshift(x, shift)
/*
* call-seq:
* big[n] -> 0, 1
- *
+ *
* Bit Reference---Returns the <em>n</em>th bit in the (assumed) binary
* representation of <i>big</i>, where <i>big</i>[0] is the least
* significant bit.
- *
+ *
* a = 9**15
* 50.downto(0) do |n|
* print a[n]
* end
- *
+ *
* <em>produces:</em>
- *
+ *
* 000101110110100000111000011110010100111100010111001
- *
+ *
*/
static VALUE
@@ -2062,7 +2191,7 @@ rb_big_aref(x, y)
out_of_range:
return RBIGNUM(x)->sign ? INT2FIX(0) : INT2FIX(1);
}
- shift = big2ulong(y, "long", Qfalse);
+ shift = big2ulong(y, "long");
}
else {
i = NUM2LONG(y);
@@ -2134,9 +2263,9 @@ rb_big_coerce(x, y)
/*
* call-seq:
* big.abs -> aBignum
- *
+ *
* Returns the absolute value of <i>big</i>.
- *
+ *
* -1234567890987654321.abs #=> 1234567890987654321
*/
@@ -2164,7 +2293,7 @@ rb_big_rand(max, rand_buf)
}
v = bignew(len,1);
len--;
- BDIGITS(v)[len] = BDIGITS(max)[len] * rand_buf[len];
+ BDIGITS(v)[len] = BDIGITS(max)[len] * rand_buf[len];
while (len--) {
BDIGITS(v)[len] = ((BDIGIT)~0) * rand_buf[len];
}
@@ -2175,10 +2304,10 @@ rb_big_rand(max, rand_buf)
/*
* call-seq:
* big.size -> integer
- *
+ *
* Returns the number of bytes in the machine representation of
* <i>big</i>.
- *
+ *
* (256**10 - 1).size #=> 12
* (256**20 - 1).size #=> 20
* (256**40 - 1).size #=> 40
@@ -2198,15 +2327,15 @@ rb_big_size(big)
* Fixnum. When a calculation involving
* Bignum objects returns a result that will fit in a
* Fixnum, the result is automatically converted.
- *
+ *
* For the purposes of the bitwise operations and <code>[]</code>, a
* Bignum is treated as if it were an infinite-length
* bitstring with 2's complement representation.
- *
+ *
* While Fixnum values are immediate, Bignum
* objects are not---assignment and parameter passing work with
* references to objects, not the objects themselves.
- *
+ *
*/
void
@@ -2227,6 +2356,7 @@ Init_Bignum()
rb_define_method(rb_cBignum, "modulo", rb_big_modulo, 1);
rb_define_method(rb_cBignum, "remainder", rb_big_remainder, 1);
rb_define_method(rb_cBignum, "quo", rb_big_quo, 1);
+ rb_define_method(rb_cBignum, "fdiv", rb_big_quo, 1);
rb_define_method(rb_cBignum, "**", rb_big_pow, 1);
rb_define_method(rb_cBignum, "&", rb_big_and, 1);
rb_define_method(rb_cBignum, "|", rb_big_or, 1);
diff --git a/class.c b/class.c
index 80dc9e4b2d..096c7fbdf1 100644
--- a/class.c
+++ b/class.c
@@ -48,13 +48,23 @@ rb_class_new(super)
return rb_class_boot(super);
}
+struct clone_method_data {
+ st_table *tbl;
+ VALUE klass;
+};
+
static int
-clone_method(mid, body, tbl)
+clone_method(mid, body, data)
ID mid;
NODE *body;
- st_table *tbl;
+ struct clone_method_data *data;
{
- st_insert(tbl, mid, (st_data_t)NEW_METHOD(body->nd_body, body->nd_noex));
+ NODE *fbody = body->nd_body;
+
+ if (fbody && nd_type(fbody) == NODE_SCOPE) {
+ fbody = rb_copy_node_scope(fbody, ruby_cref);
+ }
+ st_insert(data->tbl, mid, (st_data_t)NEW_METHOD(fbody, body->nd_noex));
return ST_CONTINUE;
}
@@ -65,7 +75,8 @@ rb_mod_init_copy(clone, orig)
{
rb_obj_init_copy(clone, orig);
if (!FL_TEST(CLASS_OF(clone), FL_SINGLETON)) {
- RBASIC(clone)->klass = rb_singleton_class_clone(orig);
+ RBASIC(clone)->klass = RBASIC(orig)->klass;
+ RBASIC(clone)->klass = rb_singleton_class_clone(clone);
}
RCLASS(clone)->super = RCLASS(orig)->super;
if (RCLASS(orig)->iv_tbl) {
@@ -78,9 +89,12 @@ rb_mod_init_copy(clone, orig)
st_delete(RCLASS(clone)->iv_tbl, (st_data_t*)&id, 0);
}
if (RCLASS(orig)->m_tbl) {
- RCLASS(clone)->m_tbl = st_init_numtable();
- st_foreach(RCLASS(orig)->m_tbl, clone_method,
- (st_data_t)RCLASS(clone)->m_tbl);
+ struct clone_method_data data;
+
+ data.tbl = RCLASS(clone)->m_tbl = st_init_numtable();
+ data.klass = (VALUE)clone;
+
+ st_foreach(RCLASS(orig)->m_tbl, clone_method, (st_data_t)&data);
}
return clone;
@@ -126,9 +140,22 @@ rb_singleton_class_clone(obj)
if (RCLASS(klass)->iv_tbl) {
clone->iv_tbl = st_copy(RCLASS(klass)->iv_tbl);
}
- clone->m_tbl = st_init_numtable();
- st_foreach(RCLASS(klass)->m_tbl, clone_method,
- (st_data_t)clone->m_tbl);
+ {
+ struct clone_method_data data;
+
+ data.tbl = clone->m_tbl = st_init_numtable();
+ switch (TYPE(obj)) {
+ case T_CLASS:
+ case T_MODULE:
+ data.klass = obj;
+ break;
+ default:
+ data.klass = 0;
+ break;
+ }
+
+ st_foreach(RCLASS(klass)->m_tbl, clone_method, (st_data_t)&data);
+ }
rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)clone);
FL_SET(clone, FL_SINGLETON);
return (VALUE)clone;
diff --git a/common.mk b/common.mk
index f751fecfb5..bf49aade4a 100644
--- a/common.mk
+++ b/common.mk
@@ -2,7 +2,12 @@ bin: $(PROGRAM) $(WPROGRAM)
lib: $(LIBRUBY)
dll: $(LIBRUBY_SO)
-RUBYOPT =
+RUBYLIB = -
+RUBYOPT = -
+
+SPEC_GIT_BASE = git://github.com/rubyspec
+MSPEC_GIT_URL = $(SPEC_GIT_BASE)/mspec.git
+RUBYSPEC_GIT_URL = $(SPEC_GIT_BASE)/rubyspec.git
STATIC_RUBY = static-ruby
@@ -23,6 +28,7 @@ OBJS = array.$(OBJEXT) \
dir.$(OBJEXT) \
dln.$(OBJEXT) \
enum.$(OBJEXT) \
+ enumerator.$(OBJEXT) \
error.$(OBJEXT) \
eval.$(OBJEXT) \
file.$(OBJEXT) \
@@ -56,11 +62,15 @@ OBJS = array.$(OBJEXT) \
SCRIPT_ARGS = --dest-dir="$(DESTDIR)" \
--extout="$(EXTOUT)" \
- --make="$(MAKE)" \
--mflags="$(MFLAGS)" \
--make-flags="$(MAKEFLAGS)"
EXTMK_ARGS = $(SCRIPT_ARGS) --extension $(EXTS) --extstatic $(EXTSTATIC) --
-INSTRUBY_ARGS = $(SCRIPT_ARGS) --installed-list $(INSTALLED_LIST)
+INSTRUBY_ARGS = $(SCRIPT_ARGS) \
+ --data-mode=$(INSTALL_DATA_MODE) \
+ --prog-mode=$(INSTALL_PROG_MODE) \
+ --installed-list $(INSTALLED_LIST)
+INSTALL_PROG_MODE = 0755
+INSTALL_DATA_MODE = 0644
PRE_LIBRUBY_UPDATE = $(MINIRUBY) -e 'ARGV[1] or File.unlink(ARGV[0]) rescue nil' -- \
$(LIBRUBY_EXTS) $(LIBRUBY_SO_UPDATE)
@@ -69,7 +79,7 @@ TESTSDIR = $(srcdir)/test
TESTWORKDIR = testwork
all: $(MKFILES) $(PREP) $(RBCONFIG) $(LIBRUBY)
- @$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS)
+ @$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" $(EXTMK_ARGS)
prog: $(PROGRAM) $(WPROGRAM)
miniruby$(EXEEXT): config.status $(LIBRUBY_A) $(MAINOBJ) $(MINIOBJS) $(OBJS) $(DMYEXT)
@@ -96,65 +106,68 @@ install-all: install-nodoc install-doc
install-nodoc: pre-install-nodoc do-install-nodoc post-install-nodoc
pre-install-nodoc:: pre-install-local pre-install-ext
do-install-nodoc:
- $(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --mantype="$(MANTYPE)"
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --mantype="$(MANTYPE)"
post-install-nodoc:: post-install-local post-install-ext
install-local: pre-install-local do-install-local post-install-local
pre-install-local:: pre-install-bin pre-install-lib pre-install-man
do-install-local:
- $(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=local --mantype="$(MANTYPE)"
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=local --mantype="$(MANTYPE)"
+loadpath: $(PREP)
+ $(MINIRUBY) -e 'p $$:'
+
post-install-local:: post-install-bin post-install-lib post-install-man
install-ext: pre-install-ext do-install-ext post-install-ext
pre-install-ext:: pre-install-ext-arch pre-install-ext-comm
do-install-ext:
- $(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=ext
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext
post-install-ext:: post-install-ext-arch post-install-ext-comm
install-arch: pre-install-arch do-install-arch post-install-arch
pre-install-arch:: pre-install-bin pre-install-ext-arch
do-install-arch:
- $(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=bin --install=ext-arch
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin --install=ext-arch
post-install-arch:: post-install-bin post-install-ext-arch
install-comm: pre-install-comm do-install-comm post-install-comm
pre-install-comm:: pre-install-lib pre-install-ext-comm pre-install-man
do-install-comm:
- $(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=lib --install=ext-comm --install=man
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=lib --install=ext-comm --install=man
post-install-comm:: post-install-lib post-install-ext-comm post-install-man
install-bin: pre-install-bin do-install-bin post-install-bin
pre-install-bin:: install-prereq
do-install-bin:
- $(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=bin
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin
post-install-bin::
@$(NULLCMD)
install-lib: pre-install-lib do-install-lib post-install-lib
pre-install-lib:: install-prereq
do-install-lib:
- $(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=lib
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=lib
post-install-lib::
@$(NULLCMD)
install-ext-comm: pre-install-ext-comm do-install-ext-comm post-install-ext-comm
pre-install-ext-comm:: install-prereq
do-install-ext-comm:
- $(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=ext-comm
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-comm
post-install-ext-comm::
@$(NULLCMD)
install-ext-arch: pre-install-ext-arch do-install-ext-arch post-install-ext-arch
pre-install-ext-arch:: install-prereq
do-install-ext-arch:
- $(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=ext-arch
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-arch
post-install-ext-arch::
@$(NULLCMD)
install-man: pre-install-man do-install-man post-install-man
pre-install-man:: install-prereq
do-install-man:
- $(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=man --mantype="$(MANTYPE)"
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=man --mantype="$(MANTYPE)"
post-install-man::
@$(NULLCMD)
@@ -167,42 +180,42 @@ what-where-nodoc: no-install-nodoc
no-install-nodoc: pre-no-install-nodoc dont-install-nodoc post-no-install-nodoc
pre-no-install-nodoc:: pre-no-install-local pre-no-install-ext
dont-install-nodoc:
- $(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --mantype="$(MANTYPE)"
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --mantype="$(MANTYPE)"
post-no-install-nodoc:: post-no-install-local post-no-install-ext
what-where-local: no-install-local
no-install-local: pre-no-install-local dont-install-local post-no-install-local
pre-no-install-local:: pre-no-install-bin pre-no-install-lib pre-no-install-man
dont-install-local:
- $(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=local --mantype="$(MANTYPE)"
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=local --mantype="$(MANTYPE)"
post-no-install-local:: post-no-install-bin post-no-install-lib post-no-install-man
what-where-ext: no-install-ext
no-install-ext: pre-no-install-ext dont-install-ext post-no-install-ext
pre-no-install-ext:: pre-no-install-ext-arch pre-no-install-ext-comm
dont-install-ext:
- $(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=ext
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext
post-no-install-ext:: post-no-install-ext-arch post-no-install-ext-comm
what-where-arch: no-install-arch
no-install-arch: pre-no-install-arch dont-install-arch post-no-install-arch
pre-no-install-arch:: pre-no-install-bin pre-no-install-ext-arch
dont-install-arch:
- $(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=bin --install=ext-arch
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin --install=ext-arch
post-no-install-arch:: post-no-install-lib post-no-install-man post-no-install-ext-arch
what-where-comm: no-install-comm
no-install-comm: pre-no-install-comm dont-install-comm post-no-install-comm
pre-no-install-comm:: pre-no-install-lib pre-no-install-ext-comm pre-no-install-man
dont-install-comm:
- $(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=lib --install=ext-comm --install=man
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=lib --install=ext-comm --install=man
post-no-install-comm:: post-no-install-lib post-no-install-ext-comm post-no-install-man
what-where-bin: no-install-bin
no-install-bin: pre-no-install-bin dont-install-bin post-no-install-bin
pre-no-install-bin:: install-prereq
dont-install-bin:
- $(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=bin
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin
post-no-install-bin::
@$(NULLCMD)
@@ -210,7 +223,7 @@ what-where-lib: no-install-lib
no-install-lib: pre-no-install-lib dont-install-lib post-no-install-lib
pre-no-install-lib:: install-prereq
dont-install-lib:
- $(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=lib
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=lib
post-no-install-lib::
@$(NULLCMD)
@@ -218,7 +231,7 @@ what-where-ext-comm: no-install-ext-comm
no-install-ext-comm: pre-no-install-ext-comm dont-install-ext-comm post-no-install-ext-comm
pre-no-install-ext-comm:: install-prereq
dont-install-ext-comm:
- $(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=ext-comm
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-comm
post-no-install-ext-comm::
@$(NULLCMD)
@@ -226,7 +239,7 @@ what-where-ext-arch: no-install-ext-arch
no-install-ext-arch: pre-no-install-ext-arch dont-install-ext-arch post-no-install-ext-arch
pre-no-install-ext-arch:: install-prereq
dont-install-ext-arch:
- $(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=ext-arch
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=ext-arch
post-no-install-ext-arch::
@$(NULLCMD)
@@ -234,14 +247,14 @@ what-where-man: no-install-man
no-install-man: pre-no-install-man dont-install-man post-no-install-man
pre-no-install-man:: install-prereq
dont-install-man:
- $(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=man --mantype="$(MANTYPE)"
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=man --mantype="$(MANTYPE)"
post-no-install-man::
@$(NULLCMD)
install-doc: rdoc pre-install-doc do-install-doc post-install-doc
pre-install-doc:: install-prereq
do-install-doc: $(PROGRAM)
- $(MINIRUBY) $(srcdir)/instruby.rb $(INSTRUBY_ARGS) --install=rdoc --rdoc-output="$(RDOCOUT)"
+ $(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=rdoc --rdoc-output="$(RDOCOUT)"
post-install-doc::
@$(NULLCMD)
@@ -253,30 +266,38 @@ what-where-doc: no-install-doc
no-install-doc: pre-no-install-doc dont-install-doc post-no-install-doc
pre-no-install-doc:: install-prereq
dont-install-doc::
- $(MINIRUBY) $(srcdir)/instruby.rb -n $(INSTRUBY_ARGS) --install=rdoc --rdoc-output="$(RDOCOUT)"
+ $(MINIRUBY) $(srcdir)/instruby.rb -n --make="$(MAKE)" $(INSTRUBY_ARGS) --install=rdoc --rdoc-output="$(RDOCOUT)"
post-no-install-doc::
@$(NULLCMD)
-install-prereq:
+CLEAR_INSTALLED_LIST = clear-installed-list
+
+install-prereq: $(CLEAR_INSTALLED_LIST)
+
+clear-installed-list:
@exit > $(INSTALLED_LIST)
clean: clean-ext clean-local
clean-local::
- @$(RM) $(OBJS) $(MAINOBJ) $(WINMAINOBJ) $(LIBRUBY_A) $(LIBRUBY_SO) $(LIBRUBY) $(LIBRUBY_ALIASES)
+ @$(RM) $(OBJS) $(MINIOBJS) $(MAINOBJ) $(LIBRUBY_A) $(LIBRUBY_SO) $(LIBRUBY) $(LIBRUBY_ALIASES)
@$(RM) $(PROGRAM) $(WPROGRAM) miniruby$(EXEEXT) dmyext.$(OBJEXT) $(ARCHFILE) .*.time
+ @$(RM) y.tab.c y.output
clean-ext:
- @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS) clean
+ @-$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" $(EXTMK_ARGS) clean
distclean: distclean-ext distclean-local
distclean-local:: clean-local
@$(RM) $(MKFILES) config.h rbconfig.rb
@$(RM) config.cache config.log config.status
- @$(RM) *~ *.bak *.stackdump core *.core gmon.out y.tab.c y.output $(PREP)
+ @$(RM) *~ *.bak *.stackdump core *.core gmon.out $(PREP)
distclean-ext:
- @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS) distclean
+ @-$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" $(EXTMK_ARGS) distclean
-realclean:: distclean
+realclean:: realclean-ext realclean-local
+realclean-local:: distclean-local
@$(RM) parse.c lex.c
+realclean-ext::
+ @-$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" $(EXTMK_ARGS) realclean
check: test test-all
@@ -287,7 +308,7 @@ test-all:
$(RUNRUBY) "$(srcdir)/test/runner.rb" --basedir="$(TESTSDIR)" --runner=$(TESTUI) $(TESTS)
extconf:
- $(MINIRUBY) -I$(srcdir)/lib -run -e mkdir -- -p "$(EXTCONFDIR)"
+ $(MINIRUBY) -run -e mkdir -- -p "$(EXTCONFDIR)"
$(RUNRUBY) -C "$(EXTCONFDIR)" $(EXTCONF) $(EXTCONFARGS)
$(RBCONFIG): $(srcdir)/mkconfig.rb config.status $(PREP)
@@ -341,7 +362,8 @@ array.$(OBJEXT): {$(VPATH)}array.c {$(VPATH)}ruby.h config.h \
{$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
{$(VPATH)}util.h {$(VPATH)}st.h
bignum.$(OBJEXT): {$(VPATH)}bignum.c {$(VPATH)}ruby.h config.h \
- {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}rubysig.h
class.$(OBJEXT): {$(VPATH)}class.c {$(VPATH)}ruby.h config.h \
{$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
{$(VPATH)}rubysig.h {$(VPATH)}node.h {$(VPATH)}st.h
@@ -353,13 +375,13 @@ dir.$(OBJEXT): {$(VPATH)}dir.c {$(VPATH)}ruby.h config.h \
dln.$(OBJEXT): {$(VPATH)}dln.c {$(VPATH)}ruby.h config.h \
{$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
{$(VPATH)}dln.h
-dmydln.$(OBJEXT): {$(VPATH)}dmydln.c {$(VPATH)}dln.c {$(VPATH)}ruby.h \
- config.h {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}dln.h
+dmydln.$(OBJEXT): {$(VPATH)}dmydln.c dln.$(OBJEXT)
dmyext.$(OBJEXT): {$(VPATH)}dmyext.c
enum.$(OBJEXT): {$(VPATH)}enum.c {$(VPATH)}ruby.h config.h \
{$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
{$(VPATH)}node.h {$(VPATH)}util.h
+enumerator.$(OBJEXT): {$(VPATH)}enumerator.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
error.$(OBJEXT): {$(VPATH)}error.c {$(VPATH)}ruby.h config.h \
{$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
{$(VPATH)}env.h {$(VPATH)}st.h
diff --git a/configure.in b/configure.in
index 8621cef90a..5633bc3c44 100644
--- a/configure.in
+++ b/configure.in
@@ -44,10 +44,20 @@ fi
GNU_LD=$rb_cv_prog_gnu_ld
AC_SUBST(GNU_LD)])
+unset GREP_OPTIONS
rb_version=`grep RUBY_VERSION $srcdir/version.h`
MAJOR=`expr "$rb_version" : '#define RUBY_VERSION "\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*"'`
MINOR=`expr "$rb_version" : '#define RUBY_VERSION "[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*"'`
TEENY=`expr "$rb_version" : '#define RUBY_VERSION "[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\)"'`
+if test "$MAJOR" = ""; then
+ AC_MSG_ERROR(could not determine MAJOR number from version.h)
+fi
+if test "$MINOR" = ""; then
+ AC_MSG_ERROR(could not determine MINOR number from version.h)
+fi
+if test "$TEENY" = ""; then
+ AC_MSG_ERROR(could not determine TEENY number from version.h)
+fi
AC_SUBST(MAJOR)
AC_SUBST(MINOR)
AC_SUBST(TEENY)
@@ -75,6 +85,7 @@ AC_CANONICAL_TARGET
target_os=`echo $target_os | sed 's/linux-gnu$/linux/;s/linux-gnu/linux-/'`
ac_install_sh='' # unusable for extension libraries.
+ifelse(currently,disabled, [
dnl checks for fat-binary
AC_ARG_ENABLE(fat-binary,
[ --enable-fat-binary=ARCHS
@@ -128,6 +139,7 @@ if test "$fat_binary" != no; then
done
AC_DEFINE(NEXT_FAT_BINARY)
fi
+], [fat_binary=no])
case $target_cpu in
i?86) frame_address=yes;;
@@ -370,7 +382,22 @@ case "$target_os" in
nextstep*) ;;
openstep*) ;;
rhapsody*) ;;
-darwin*) LIBS="-lobjc $LIBS";;
+darwin*) LIBS="-lobjc $LIBS"
+ CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE"
+ AC_TRY_CPP([#include <AvailabilityMacros.h>
+ #if MAC_OS_X_VERSION_MAX_ALLOWED <= 1040
+ #error pre OS X 10.4
+ [!<===== pre OS X 10.4 =====>]
+ #endif
+ ],
+ [
+ test "x$target_cpu" = xpowerpc && ac_cv_header_ucontext_h=no
+ ],
+ [
+ AC_DEFINE(BROKEN_SETREUID, 1)
+ AC_DEFINE(BROKEN_SETREGID, 1)
+ ])
+ ;;
hpux*) LIBS="-lm $LIBS"
ac_cv_c_inline=no;;
human*) ac_cv_func_getpgrp_void=yes
@@ -422,6 +449,8 @@ msdosdjgpp*) LIBS="-lm $LIBS"
ac_cv_func_setrlimit=no
;;
bsdi*) LIBS="-lm $LIBS"
+ AC_DEFINE(BROKEN_SETREUID, 1)
+ AC_DEFINE(BROKEN_SETREGID, 1)
ac_cv_sizeof_rlim_t=8;;
freebsd*) LIBS="-lm $LIBS"
AC_CACHE_CHECK([whether -lxpg4 has to be linked],
@@ -472,6 +501,7 @@ esac
AC_CHECK_LIB(crypt, crypt)
AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
+AC_CHECK_LIB(rt, clock_gettime) # GNU/Linux
case "$target_cpu" in
alpha*) case "$target_os"::"$GCC" in
@@ -530,19 +560,90 @@ esac
AC_FUNC_MEMCMP
AC_FUNC_FSEEKO
AC_CHECK_FUNCS(ftello)
+
+# http://sources.redhat.com/ml/libc-hacker/2005-08/msg00008.html
+# Debian GNU/Linux Etch's libc6.1 2.3.6.ds1-13etch5 has this problem.
+# Debian GNU/Linux Lenny's libc6.1 2.7-10 has no problem.
+AC_CACHE_CHECK(for broken erfc of glibc-2.3.6 on IA64, rb_broken_glibc_ia64_erfc,
+ [AC_TRY_RUN([
+#include <math.h>
+int
+main()
+{
+ erfc(10000.0);
+ return 0;
+}
+],
+ rb_broken_glibc_ia64_erfc=no,
+ rb_broken_glibc_ia64_erfc=yes,
+ rb_broken_glibc_ia64_erfc=no)])
+case $rb_broken_glibc_ia64_erfc in
+ yes) ac_cv_func_erf=no;;
+esac
+
AC_REPLACE_FUNCS(dup2 memmove strcasecmp strncasecmp strerror strftime\
strchr strstr strtoul crypt flock vsnprintf\
isnan finite isinf hypot acosh erf)
AC_CHECK_FUNCS(fmod killpg wait4 waitpid syscall chroot fsync getcwd eaccess\
- truncate chsize times utimes fcntl lockf lstat symlink link\
+ truncate ftruncate chsize times utimes fcntl lockf lstat symlink link\
readlink setitimer setruid seteuid setreuid setresuid\
setproctitle setrgid setegid setregid setresgid issetugid pause\
lchown lchmod getpgrp setpgrp getpgid setpgid initgroups\
getgroups setgroups getpriority getrlimit setrlimit sysconf\
group_member dlopen sigprocmask\
- sigaction _setjmp setsid telldir seekdir fchmod\
+ sigaction sigsetjmp _setjmp _longjmp setsid telldir seekdir fchmod\
mktime timegm gettimeofday\
cosh sinh tanh round setuid setgid setenv unsetenv)
+
+AC_CACHE_CHECK(for __builtin_setjmp, ac_cv_func___builtin_setjmp,
+[AC_TRY_LINK([@%:@include <setjmp.h>
+ jmp_buf jb; void t(v) int v; {__builtin_longjmp(jb, v);}],
+ [__builtin_setjmp(jb);],
+ [ac_cv_func___builtin_setjmp=yes],
+ [ac_cv_func___builtin_setjmp=no])
+])
+
+test x$ac_cv_func__longjmp = xno && ac_cv_func__setjmp=no
+
+AC_MSG_CHECKING(for setjmp type)
+AC_ARG_WITH(setjmp-type,
+ [ --with-setjmp-type select setjmp type], [
+ case $withval in
+ __builtin_setjmp) setjmp_prefix=__builtin_;;
+ _setjmp) setjmp_prefix=_;;
+ sigsetjmp) setjmp_prefix=sig;;
+ setjmp) setjmp_prefix=;;
+ '') unset setjmp_prefix;;
+ *) AC_MSG_ERROR(invalid setjmp type: $withval);;
+ esac], [unset setjmp_prefix])
+if test ${setjmp_prefix+set}; then
+ if test "${setjmp_prefix}" && eval test '$ac_cv_func_'${setjmp_prefix}setjmp = no; then
+ AC_MSG_ERROR(${setjmp_prefix}setjmp is not available)
+ fi
+elif test "$ac_cv_func___builtin_setjmp" = yes; then
+ setjmp_prefix=__builtin_
+elif test "$ac_cv_func__setjmp" = yes; then
+ setjmp_prefix=_
+elif test "$ac_cv_func_sigsetjmp" = yes; then
+ case $target_os in
+ solaris*|cygwin*)
+ setjmp_prefix=;;
+ *)
+ setjmp_prefix=sig;;
+ esac
+else
+ setjmp_prefix=
+fi
+if test x$setjmp_prefix = xsig; then
+ setjmp_sigmask=yes
+else
+ unset setjmp_sigmask
+fi
+AC_MSG_RESULT(${setjmp_prefix}setjmp)
+AC_DEFINE_UNQUOTED([RUBY_SETJMP(env)], [${setjmp_prefix}setjmp(env${setjmp_sigmask+,0})])
+AC_DEFINE_UNQUOTED([RUBY_LONGJMP(env,val)], [${setjmp_prefix}longjmp(env,val)])
+AC_DEFINE_UNQUOTED(RUBY_JMP_BUF, ${setjmp_sigmask+${setjmp_prefix}}jmp_buf)
+
AC_ARG_ENABLE(setreuid,
[ --enable-setreuid use setreuid()/setregid() according to need even if obsolete.],
[use_setreuid=$enableval])
@@ -571,15 +672,23 @@ fi
AC_DEFUN([RUBY_CHECK_VARTYPE], [dnl
AC_CACHE_CHECK([for external $1], rb_cv_var_$1,
[rb_cv_var_$1=no
- AC_TRY_COMPILE([#define _XOPEN_SOURCE 1
- $2
- const volatile void *volatile t;],
+ AC_TRY_COMPILE([
+#ifndef _XOPEN_SOURCE
+#define _XOPEN_SOURCE 1
+#endif
+$2
+;
+const volatile void *volatile t;],
[t = &(&$1)[0];],
[for t in $3; do
- AC_TRY_COMPILE([#define _XOPEN_SOURCE 1
- $2
- extern $t $1;
- const volatile void *volatile t;],
+ AC_TRY_COMPILE([
+#ifndef _XOPEN_SOURCE
+#define _XOPEN_SOURCE 1
+#endif
+$2
+;
+extern $t $1;
+const volatile void *volatile t;],
[t = &(&$1)[0];],
[rb_cv_var_$1=$t; break])
done])])
@@ -587,13 +696,13 @@ if test "[$rb_cv_var_]$1" != no; then
AC_DEFINE([HAVE_VAR_]m4_toupper($1))
AC_DEFINE_UNQUOTED([TYPEOF_VAR_]m4_toupper($1), $rb_cv_var_$1)
fi])
-RUBY_CHECK_VARTYPE(timezone, [#include <time.h>], [long int])
-RUBY_CHECK_VARTYPE(altzone, [#include <time.h>], [long int])
+RUBY_CHECK_VARTYPE(timezone, [@%:@include <time.h>], [long int])
+RUBY_CHECK_VARTYPE(altzone, [@%:@include <time.h>], [long int])
if test "$rb_cv_var_timezone" = no; then
AC_CHECK_FUNCS(timezone)
- if test "$ ac_cv_func_timezone" = yes; then
+ if test "$ac_cv_func_timezone" = yes; then
AC_CACHE_CHECK([whether timezone requires zero arguments], rb_cv_func_timezone_void,
- [AC_TRY_COMPILE([#include <time.h>],
+ [AC_TRY_COMPILE([@%:@include <time.h>],
[(void)timezone(0, 0);],
[rb_cv_func_timezone_void=no],
[rb_cv_func_timezone_void=yes])]
@@ -645,6 +754,7 @@ fi
if test "$ac_cv_func_sigprocmask" = yes && test "$ac_cv_func_sigaction" = yes; then
AC_DEFINE(POSIX_SIGNAL)
else
+ AC_CHECK_FUNCS(sigsetmask)
AC_CACHE_CHECK(for BSD signal semantics, rb_cv_bsd_signal,
[AC_TRY_RUN([
#include <stdio.h>
@@ -667,7 +777,7 @@ main()
],
rb_cv_bsd_signal=yes,
rb_cv_bsd_signal=no,
- rb_cv_bsd_signal=no)])
+ rb_cv_bsd_signal=$ac_cv_func_sigsetmask)])
if test "$rb_cv_bsd_signal" = yes; then
AC_DEFINE(BSD_SIGNAL)
fi
@@ -1003,7 +1113,7 @@ AC_SUBST(DLEXT2)dnl
AC_SUBST(LIBEXT)dnl
STATIC=
-: ${LIBPATHFLAG=' -L"%s"'}
+: ${LIBPATHFLAG=' -L%s'}
: ${PATHFLAG=''}
if test "$with_dln_a_out" != yes; then
@@ -1028,11 +1138,23 @@ if test "$with_dln_a_out" != yes; then
esac
fi
+
+ AC_ARG_ENABLE(rpath,
+ [ --disable-rpath embed run path into extension libraries.],
+ [enable_rpath=$enableval], [enable_rpath="$rb_cv_binary_elf"])
+ if test "$enable_rpath" = yes; then
+ LIBPATHFLAG=" -L%1\$-s"
+ RPATHFLAG=" ${linker_flag}-R%1\$-s"
+ fi
+
case "$target_os" in
hpux*) DLDFLAGS="$DLDFLAGS -E"
: ${LDSHARED='ld -b'}
XLDFLAGS="$XLDFLAGS -Wl,-E"
: ${LIBPATHENV=SHLIB_PATH}
+ if test "$rb_cv_prog_gnu_ld" = no; then
+ RPATHFLAG=' +b %1$-s'
+ fi
rb_cv_dlopen=yes;;
solaris*) if test "$GCC" = yes; then
: ${LDSHARED='$(CC) -shared'}
@@ -1067,7 +1189,7 @@ if test "$with_dln_a_out" != yes; then
rb_cv_dlopen=yes ;;
interix*) : ${LDSHARED="$CC -shared"}
XLDFLAGS="$XLDFLAGS -Wl,-E"
- LIBPATHFLAG=" -L'%1\$-s'"
+ LIBPATHFLAG=" -L%1\$-s"
rb_cv_dlopen=yes ;;
freebsd*|dragonfly*) : ${LDSHARED="$CC -shared"}
if test "$rb_cv_binary_elf" = yes; then
@@ -1098,11 +1220,11 @@ if test "$with_dln_a_out" != yes; then
aix*) if test "$GCC" = yes; then
: ${LDSHARED='$(CC) -shared'}
else
- : ${LDSHARED='/usr/ccs/bin/ld'}
+ : ${LDSHARED='$(CC)'}
fi
- DLDFLAGS="${linker_flag}-G"' -eInit_$(TARGET)'
- LDFLAGS="${LDFLAGS} ${linker_flag}-brtl"
- XLDFLAGS="${linker_flag}-bE:ruby.imp"
+ LDSHARED="$LDSHARED ${linker_flag}-G"
+ DLDFLAGS='-eInit_$(TARGET)'
+ XLDFLAGS="${linker_flag}-bE:ruby.imp ${linker_flag}-brtl"
: ${ARCHFILE="ruby.imp"}
TRY_LINK='$(CC) $(LDFLAGS) -oconftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS)'
TRY_LINK="$TRY_LINK"' $(CFLAGS) $(src) $(LIBPATH) $(LOCAL_LIBS) $(LIBS)'
@@ -1142,14 +1264,6 @@ if test "$with_dln_a_out" != yes; then
*) : ${LDSHARED='ld'} ;;
esac
AC_MSG_RESULT($rb_cv_dlopen)
-
- AC_ARG_ENABLE(rpath,
- [ --disable-rpath embed run path into extension libraries.],
- [enable_rpath=$enableval], [enable_rpath="$rb_cv_binary_elf"])
- if test "$enable_rpath" = yes; then
- LIBPATHFLAG=" -L'%1\$-s'"
- RPATHFLAG=" ${linker_flag}-R'%1\$-s'"
- fi
fi
AC_SUBST(LINK_SO)
AC_SUBST(LIBPATHFLAG)
@@ -1309,9 +1423,10 @@ if test x"$cross_compiling" = xyes; then
PREP=fake.rb
RUNRUBY='$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`'
else
- MINIRUBY='./miniruby$(EXEEXT)'
+ MINIRUBY='./miniruby$(EXEEXT) -I$(srcdir)/lib'
+ MINIRUBY="$MINIRUBY"' -I$(EXTOUT)/common -I./- -r$(srcdir)/ext/purelib.rb'
PREP='miniruby$(EXEEXT)'
- RUNRUBY='$(MINIRUBY) $(srcdir)/runruby.rb --extout=$(EXTOUT) --'
+ RUNRUBY='$(MINIRUBY) $(srcdir)/runruby.rb --extout=$(EXTOUT)'
fi
AC_SUBST(MINIRUBY)
AC_SUBST(PREP)
@@ -1398,7 +1513,7 @@ if test "$enable_shared" = 'yes'; then
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).sl.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).sl'
;;
aix*)
- LIBRUBY_DLDFLAGS="${linker_flag}-G ${linker_flag}-bnoentry $XLDFLAGS"
+ LIBRUBY_DLDFLAGS="${linker_flag}-bnoentry $XLDFLAGS"
LIBRUBYARG_SHARED='-L${libdir} -l${RUBY_SO_NAME}'
SOLIBS='-lm -lc'
;;
@@ -1542,6 +1657,12 @@ case "$build_os" in
esac
CPPFLAGS="$CPPFLAGS "'$(DEFS)'
+test -z "$CFLAGS" || CFLAGS="$CFLAGS "; CFLAGS="$CFLAGS"'${cflags}'
+test -z "$CPPFLAGS" || CPPFLAGS="$CPPFLAGS "; CPPFLAGS="$CPPFLAGS"'${cppflags}'
+AC_SUBST(cppflags, [])dnl
+AC_SUBST(cflags, ['${optflags} ${debugflags}'])dnl
+AC_SUBST(optflags)dnl
+AC_SUBST(debugflags)dnl
AC_SUBST(XCFLAGS)dnl
AC_SUBST(XLDFLAGS)dnl
AC_SUBST(LIBRUBY_LDSHARED)
@@ -1586,37 +1707,53 @@ case "$target_os" in
rubyw_install_name="$RUBYW_INSTALL_NAME"
;;
esac
-case "$target_os" in
- cygwin*|mingw*|*djgpp*|os2-emx*)
- RUBY_LIB_PREFIX="/lib/ruby"
- ;;
- *)
- RUBY_LIB_PREFIX="${prefix}/lib/ruby"
- ;;
-esac
-RUBY_LIB_PATH="${RUBY_LIB_PREFIX}/${MAJOR}.${MINOR}"
+RUBY_LIB_PREFIX=`eval echo \\"${libdir}/ruby\\"`
AC_ARG_WITH(sitedir,
- [ --with-sitedir=DIR site libraries in DIR [PREFIX/lib/ruby/site_ruby]],
+ [ --with-sitedir=DIR site libraries in DIR [[LIBDIR/ruby/site_ruby]]],
[sitedir=$withval],
- [sitedir='${prefix}/lib/ruby/site_ruby'])
+ [sitedir='${libdir}/ruby/site_ruby'])
SITE_DIR=`eval echo \\"${sitedir}\\"`
+
case "$target_os" in
cygwin*|mingw*|*djgpp*|os2-emx*)
- RUBY_SITE_LIB_PATH="`expr "$SITE_DIR" : "$prefix\(/.*\)"`" ||
- RUBY_SITE_LIB_PATH="$SITE_DIR";;
+ RUBY_LIB_PREFIX="`eval echo "$RUBY_LIB_PREFIX" | sed 's|^NONE/|/|;s|^'"$prefix"'/|/|'`"
+ RUBY_SITE_LIB_PATH="`eval echo "$SITE_DIR" | sed 's|^NONE/|/|;s|^'"$prefix"'/|/|'`"
+ ;;
*)
- RUBY_SITE_LIB_PATH="$SITE_DIR";;
+ RUBY_LIB_PREFIX="`eval echo \\"$RUBY_LIB_PREFIX\\" | sed 's|^NONE/|'"$prefix"'/|'`"
+ RUBY_SITE_LIB_PATH="`eval echo \\"$SITE_DIR\\" | sed 's|^NONE/|'"$prefix"'/|'`"
+ ;;
esac
+RUBY_LIB_PATH="${RUBY_LIB_PREFIX}/${MAJOR}.${MINOR}"
RUBY_SITE_LIB_PATH2="${RUBY_SITE_LIB_PATH}/${MAJOR}.${MINOR}"
AC_DEFINE_UNQUOTED(RUBY_LIB, "${RUBY_LIB_PATH}")
AC_DEFINE_UNQUOTED(RUBY_SITE_LIB, "${RUBY_SITE_LIB_PATH}")
AC_DEFINE_UNQUOTED(RUBY_SITE_LIB2, "${RUBY_SITE_LIB_PATH2}")
+AC_ARG_WITH(vendordir,
+ [ --with-vendordir=DIR vendor libraries in DIR [[LIBDIR/ruby/vendor_ruby]]],
+ [vendordir=$withval],
+ [vendordir='${libdir}/ruby/vendor_ruby'])
+VENDOR_DIR=`eval echo \\"${vendordir}\\"`
+case "$target_os" in
+ cygwin*|mingw*|*djgpp*|os2-emx*)
+ RUBY_VENDOR_LIB_PATH="`eval echo "$VENDOR_DIR" | sed 's|^NONE/|/|;s|^'"$prefix"'/|/|'`"
+ ;;
+ *)
+ RUBY_VENDOR_LIB_PATH="`eval echo \\"$VENDOR_DIR\\" | sed 's|^NONE/|'"$prefix"'/|'`"
+ ;;
+esac
+RUBY_VENDOR_LIB_PATH2="${RUBY_VENDOR_LIB_PATH}/${MAJOR}.${MINOR}"
+
+AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB, "${RUBY_VENDOR_LIB_PATH}")
+AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB2, "${RUBY_VENDOR_LIB_PATH2}")
+
AC_SUBST(arch)dnl
AC_SUBST(sitearch)dnl
AC_SUBST(sitedir)dnl
+AC_SUBST(vendordir)dnl
configure_args=$ac_configure_args
AC_SUBST(configure_args)dnl
@@ -1629,6 +1766,8 @@ if test "$fat_binary" != no ; then
AC_DEFINE_UNQUOTED(RUBY_SITE_THIN_ARCHLIB,
"${RUBY_SITE_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
+ AC_DEFINE_UNQUOTED(RUBY_VENDOR_THIN_ARCHLIB,
+ "${RUBY_VENDOR_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
AC_DEFINE_UNQUOTED(RUBY_PLATFORM, __ARCHITECTURE__ "-${target_os}")
else
arch="${target_cpu}-${target_os}"
@@ -1636,12 +1775,13 @@ else
fi
case "$target_os" in
- mingw*) sitearch="i386-$rb_cv_msvcrt" ;;
+ mingw*) sitearch="$target_cpu-$rb_cv_msvcrt" ;;
*) sitearch="${arch}" ;;
esac
AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, "${RUBY_LIB_PATH}/${arch}")
AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${RUBY_SITE_LIB_PATH2}/${sitearch}")
+AC_DEFINE_UNQUOTED(RUBY_VENDOR_ARCHLIB, "${RUBY_VENDOR_LIB_PATH2}/${sitearch}")
AC_ARG_WITH(search-path,
[ --with-search-path=DIR specify the additional search path],
@@ -1679,6 +1819,7 @@ else
tr -d '\015' < confdefs.h > config.h
fi
tr -d '\015' < largefile.h > confdefs.h
+rm largefile.h
AC_CONFIG_FILES($FIRSTMAKEFILE)
AC_CONFIG_FILES(Makefile, [{
diff --git a/defines.h b/defines.h
index 6b1fd68740..f39097fea4 100644
--- a/defines.h
+++ b/defines.h
@@ -102,6 +102,16 @@ void xfree _((void*));
#endif
#endif
+#if defined(__NeXT__) || defined(__APPLE__)
+/* Do not trust WORDS_BIGENDIAN from configure since -arch compiler flag may
+ result in a different endian. Instead trust __BIG_ENDIAN__ and
+ __LITTLE_ENDIAN__ which are set correctly by -arch. */
+#undef WORDS_BIGENDIAN
+#ifdef __BIG_ENDIAN__
+#define WORDS_BIGENDIAN
+#endif
+#endif
+
#ifdef __NeXT__
/* NextStep, OpenStep, Rhapsody */
#ifndef S_IRUSR
@@ -155,13 +165,6 @@ void xfree _((void*));
#ifndef S_ISREG
#define S_ISREG(mode) (((mode) & (0170000)) == (0100000))
#endif
-/* Do not trust WORDS_BIGENDIAN from configure since -arch compiler flag may
- result in a different endian. Instead trust __BIG_ENDIAN__ and
- __LITTLE_ENDIAN__ which are set correctly by -arch. */
-#undef WORDS_BIGENDIAN
-#ifdef __BIG_ENDIAN__
-#define WORDS_BIGENDIAN
-#endif
#ifndef __APPLE__
/* NextStep, OpenStep (but not Rhapsody) */
#ifndef GETPGRP_VOID
@@ -251,6 +254,14 @@ void rb_ia64_flushrs(void);
#define ENV_IGNORECASE
#endif
+#ifndef CASEFOLD_FILESYSTEM
+# if defined DOSISH || defined __VMS
+# define CASEFOLD_FILESYSTEM 1
+# else
+# define CASEFOLD_FILESYSTEM 0
+# endif
+#endif
+
#ifndef DLEXT_MAXLEN
#define DLEXT_MAXLEN 4
#endif
diff --git a/dir.c b/dir.c
index 0dd12ffd7d..c2c3f9452f 100644
--- a/dir.c
+++ b/dir.c
@@ -268,7 +268,7 @@ fnmatch_helper(pcur, scur, flags)
const char *t;
if (ISEND(s))
RETURN(FNM_NOMATCH);
- if (t = bracket(p + 1, s, flags)) {
+ if ((t = bracket(p + 1, s, flags)) != 0) {
p = t;
Inc(s);
continue;
@@ -473,9 +473,9 @@ dir_inspect(dir)
{
struct dir_data *dirp;
- GetDIR(dir, dirp);
+ Data_Get_Struct(dir, struct dir_data, dirp);
if (dirp->path) {
- char *c = rb_obj_classname(dir);
+ const char *c = rb_obj_classname(dir);
int len = strlen(c) + strlen(dirp->path) + 4;
VALUE s = rb_str_new(0, len);
snprintf(RSTRING_PTR(s), len+1, "#<%s:%s>", c, dirp->path);
@@ -499,7 +499,7 @@ dir_path(dir)
{
struct dir_data *dirp;
- GetDIR(dir, dirp);
+ Data_Get_Struct(dir, struct dir_data, dirp);
if (!dirp->path) return Qnil;
return rb_str_new2(dirp->path);
}
@@ -562,6 +562,7 @@ dir_each(dir)
struct dir_data *dirp;
struct dirent *dp;
+ RETURN_ENUMERATOR(dir, 0, 0);
GetDIR(dir, dirp);
rewinddir(dirp->dir);
for (dp = readdir(dirp->dir); dp != NULL; dp = readdir(dirp->dir)) {
@@ -1008,7 +1009,7 @@ has_magic(s, flags)
register const char *p = s;
register char c;
- while (c = *p++) {
+ while ((c = *p++) != 0) {
switch (c) {
case '*':
case '?':
@@ -1041,7 +1042,7 @@ find_dirsep(const char *s, int flags)
register char c;
int open = 0;
- while (c = *p++) {
+ while ((c = *p++) != 0) {
switch (c) {
case '[':
open = 1;
@@ -1814,6 +1815,7 @@ dir_foreach(io, dirname)
{
VALUE dir;
+ RETURN_ENUMERATOR(io, 1, &dirname);
dir = dir_open_dir(dirname);
rb_ensure(dir_each, dir, dir_close, dir);
return Qnil;
@@ -1970,6 +1972,7 @@ Init_Dir()
rb_define_method(rb_cDir,"initialize", dir_initialize, 1);
rb_define_method(rb_cDir,"path", dir_path, 0);
+ rb_define_method(rb_cDir,"inspect", dir_inspect, 0);
rb_define_method(rb_cDir,"read", dir_read, 0);
rb_define_method(rb_cDir,"each", dir_each, 0);
rb_define_method(rb_cDir,"rewind", dir_rewind, 0);
diff --git a/dln.c b/dln.c
index 9fd605e32e..5ba25b6415 100644
--- a/dln.c
+++ b/dln.c
@@ -81,19 +81,28 @@ char *getenv();
# include "macruby_private.h"
#endif
+#if defined(__APPLE__) && defined(__MACH__) /* Mac OS X */
+# if defined(HAVE_DLOPEN)
+ /* Mac OS X with dlopen (10.3 or later) */
+# define MACOSX_DLOPEN
+# else
+# define MACOSX_DYLD
+# endif
+#endif
+
#ifdef __BEOS__
# include <image.h>
#endif
#ifndef NO_DLN_LOAD
-#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(_AIX) && !defined(__APPLE__) && !defined(_UNICOSMP)
+#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(_AIX) && !defined(MACOSX_DYLD) && !defined(_UNICOSMP)
/* dynamic load with dlopen() */
# define USE_DLN_DLOPEN
#endif
#ifndef FUNCNAME_PATTERN
-# if defined(__hp9000s300) || (defined(__NetBSD__) && !defined(__ELF__)) || defined(__BORLANDC__) || (defined(__FreeBSD__) && !defined(__ELF__)) || (defined(__OpenBSD__) && !defined(__ELF__)) || defined(NeXT) || defined(__WATCOMC__) || defined(__APPLE__)
+# if defined(__hp9000s300) || (defined(__NetBSD__) && !defined(__ELF__)) || defined(__BORLANDC__) || (defined(__FreeBSD__) && !defined(__ELF__)) || (defined(__OpenBSD__) && !defined(__ELF__)) || defined(NeXT) || defined(__WATCOMC__) || defined(MACOSX_DYLD)
# define FUNCNAME_PATTERN "_Init_%s"
# else
# define FUNCNAME_PATTERN "Init_%s"
@@ -636,7 +645,7 @@ load_1(fd, disp, need_init)
long disp;
const char *need_init;
{
- static char *libc = LIBC_NAME;
+ static const char *libc = LIBC_NAME;
struct exec hdr;
struct relocation_info *reloc = NULL;
long block = 0;
@@ -1141,7 +1150,7 @@ dln_sym(name)
#endif
#endif
#else
-#ifdef __APPLE__
+#ifdef MACOSX_DYLD
#include <mach-o/dyld.h>
#endif
#endif
@@ -1403,7 +1412,7 @@ dln_load(file)
}
#endif /* _AIX */
-#if defined(NeXT) || defined(__APPLE__)
+#if defined(NeXT) || defined(MACOSX_DYLD)
#define DLN_DEFINED
/*----------------------------------------------------
By SHIROYAMA Takayuki Psi@fortune.nest.or.jp
@@ -1527,7 +1536,7 @@ dln_load(file)
}
#endif /* __BEOS__*/
-#ifdef __MACOS__
+#ifdef __MACOS__ /* Mac OS 9 or before */
# define DLN_DEFINED
{
OSErr err;
@@ -1680,31 +1689,31 @@ static char fbuf[MAXPATHLEN];
static char *
dln_find_1(fname, path, exe_flag)
- char *fname;
- char *path;
+ const char *fname;
+ const char *path;
int exe_flag; /* non 0 if looking for executable. */
{
- register char *dp;
- register char *ep;
+ register const char *dp;
+ register const char *ep;
register char *bp;
struct stat st;
#ifdef __MACOS__
const char* mac_fullpath;
#endif
- if (!fname) return fname;
- if (fname[0] == '/') return fname;
+ if (!fname) return (char *)fname;
+ if (fname[0] == '/') return (char *)fname;
if (strncmp("./", fname, 2) == 0 || strncmp("../", fname, 3) == 0)
- return fname;
- if (exe_flag && strchr(fname, '/')) return fname;
+ return (char *)fname;
+ if (exe_flag && strchr(fname, '/')) return (char *)fname;
#ifdef DOSISH
- if (fname[0] == '\\') return fname;
+ if (fname[0] == '\\') return (char *)fname;
# ifdef DOSISH_DRIVE_LETTER
- if (strlen(fname) > 2 && fname[1] == ':') return fname;
+ if (strlen(fname) > 2 && fname[1] == ':') return (char *)fname;
# endif
if (strncmp(".\\", fname, 2) == 0 || strncmp("..\\", fname, 3) == 0)
- return fname;
- if (exe_flag && strchr(fname, '\\')) return fname;
+ return (char *)fname;
+ if (exe_flag && strchr(fname, '\\')) return (char *)fname;
#endif
for (dp = path;; dp = ++ep) {
@@ -1772,26 +1781,9 @@ dln_find_1(fname, path, exe_flag)
}
memcpy(bp, fname, i + 1);
-#ifndef __MACOS__
- if (stat(fbuf, &st) == 0) {
- if (exe_flag == 0) return fbuf;
- /* looking for executable */
- if (!S_ISDIR(st.st_mode) && eaccess(fbuf, X_OK) == 0)
- return fbuf;
- }
-#else
- if (mac_fullpath = _macruby_exist_file_in_libdir_as_posix_name(fbuf)) {
- if (exe_flag == 0) return mac_fullpath;
- /* looking for executable */
- if (stat(mac_fullpath, &st) == 0) {
- if (!S_ISDIR(st.st_mode) && eaccess(mac_fullpath, X_OK) == 0)
- return mac_fullpath;
- }
- }
-#endif
#if defined(DOSISH)
if (exe_flag) {
- static const char *extension[] = {
+ static const char extension[][5] = {
#if defined(MSDOS)
".com", ".exe", ".bat",
#if defined(DJGPP)
@@ -1804,11 +1796,10 @@ dln_find_1(fname, path, exe_flag)
".r", ".R", ".x", ".X", ".bat", ".BAT",
/* __human68k__ */
#endif
- (char *) NULL
};
int j;
- for (j = 0; extension[j]; j++) {
+ for (j = 0; j < sizeof(extension) / sizeof(extension[0]); j++) {
if (fspace < strlen(extension[j])) {
fprintf(stderr, "openpath: pathname too long (ignored)\n");
fprintf(stderr, "\tDirectory \"%.*s\"\n", (int) (bp - fbuf), fbuf);
@@ -1825,9 +1816,28 @@ dln_find_1(fname, path, exe_flag)
#endif
}
+ goto next;
}
#endif /* MSDOS or _WIN32 or __human68k__ or __EMX__ */
+#ifndef __MACOS__
+ if (stat(fbuf, &st) == 0) {
+ if (exe_flag == 0) return fbuf;
+ /* looking for executable */
+ if (!S_ISDIR(st.st_mode) && eaccess(fbuf, X_OK) == 0)
+ return fbuf;
+ }
+#else
+ if (mac_fullpath = _macruby_exist_file_in_libdir_as_posix_name(fbuf)) {
+ if (exe_flag == 0) return mac_fullpath;
+ /* looking for executable */
+ if (stat(mac_fullpath, &st) == 0) {
+ if (!S_ISDIR(st.st_mode) && eaccess(mac_fullpath, X_OK) == 0)
+ return mac_fullpath;
+ }
+ }
+#endif
+
next:
/* if not, and no other alternatives, life is bleak */
if (*ep == '\0') {
diff --git a/enum.c b/enum.c
index 2a29272ae9..df35c2fe03 100644
--- a/enum.c
+++ b/enum.c
@@ -15,7 +15,43 @@
#include "util.h"
VALUE rb_mEnumerable;
-static ID id_each, id_eqq, id_cmp;
+static ID id_each, id_eqq, id_cmp, id_size;
+
+struct iter_method_arg {
+ VALUE obj;
+ ID mid;
+ int argc;
+ VALUE *argv;
+};
+
+static VALUE iterate_method _((VALUE obj));
+static VALUE
+iterate_method(obj)
+ VALUE obj;
+{
+ struct iter_method_arg *arg;
+
+ arg = (struct iter_method_arg *)obj;
+ return rb_funcall2(arg->obj, arg->mid, arg->argc, arg->argv);
+}
+
+VALUE
+rb_block_call(obj, mid, argc, argv, bl_proc, data2)
+ VALUE obj;
+ ID mid;
+ int argc;
+ VALUE *argv;
+ VALUE (*bl_proc) (ANYARGS);
+ VALUE data2;
+{
+ struct iter_method_arg arg;
+
+ arg.obj = obj;
+ arg.mid = mid;
+ arg.argc = argc;
+ arg.argv = argv;
+ return rb_iterate(iterate_method, (VALUE)&arg, bl_proc, data2);
+}
VALUE
rb_each(obj)
@@ -48,18 +84,18 @@ grep_iter_i(i, arg)
* call-seq:
* enum.grep(pattern) => array
* enum.grep(pattern) {| obj | block } => array
- *
+ *
* Returns an array of every element in <i>enum</i> for which
* <code>Pattern === element</code>. If the optional <em>block</em> is
* supplied, each matching element is passed to it, and the block's
* result is stored in the output array.
- *
+ *
* (1..100).grep 38..44 #=> [38, 39, 40, 41, 42, 43, 44]
* c = IO.constants
* c.grep(/SEEK/) #=> ["SEEK_END", "SEEK_SET", "SEEK_CUR"]
* res = c.grep(/SEEK/) {|v| IO.const_get(v) }
* res #=> [2, 0, 1]
- *
+ *
*/
static VALUE
@@ -73,10 +109,99 @@ enum_grep(obj, pat)
arg[1] = ary;
rb_iterate(rb_each, obj, rb_block_given_p() ? grep_iter_i : grep_i, (VALUE)arg);
-
+
return ary;
}
+static VALUE count_i _((VALUE, VALUE));
+static VALUE
+count_i(i, memop)
+ VALUE i, memop;
+{
+ VALUE *memo = (VALUE*)memop;
+
+ if (rb_equal(i, memo[1])) {
+ memo[0]++;
+ }
+ return Qnil;
+}
+
+static VALUE count_iter_i _((VALUE, VALUE));
+static VALUE
+count_iter_i(i, memop)
+ VALUE i, memop;
+{
+ VALUE *memo = (VALUE*)memop;
+
+ if (RTEST(rb_yield(i))) {
+ memo[0]++;
+ }
+ return Qnil;
+}
+
+static VALUE count_all_i _((VALUE, VALUE));
+static VALUE
+count_all_i(i, memop)
+ VALUE i, memop;
+{
+ VALUE *memo = (VALUE*)memop;
+
+ memo[0]++;
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.count => int
+ * enum.count(item) => int
+ * enum.count {| obj | block } => int
+ *
+ * Returns the number of items in <i>enum</i>, where #size is called
+ * if it responds to it, otherwise the items are counted through
+ * enumeration. If an argument is given, counts the number of items
+ * in <i>enum</i>, for which equals to <i>item</i>. If a block is
+ * given, counts the number of elements yielding a true value.
+ *
+ * ary = [1, 2, 4, 2]
+ * ary.count # => 4
+ * ary.count(2) # => 2
+ * ary.count{|x|x%2==0} # => 3
+ *
+ */
+
+static VALUE
+enum_count(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE memo[2]; /* [count, condition value] */
+ rb_block_call_func *func;
+
+ if (argc == 0) {
+ if (rb_block_given_p()) {
+ func = count_iter_i;
+ }
+ else {
+ if (rb_respond_to(obj, id_size)) {
+ return rb_funcall(obj, id_size, 0, 0);
+ }
+ func = count_all_i;
+ }
+ }
+ else {
+ rb_scan_args(argc, argv, "1", &memo[1]);
+ if (rb_block_given_p()) {
+ rb_warn("given block not used");
+ }
+ func = count_i;
+ }
+
+ memo[0] = 0;
+ rb_block_call(obj, id_each, 0, 0, func, (VALUE)&memo);
+ return INT2NUM(memo[0]);
+}
+
static VALUE
find_i(i, memo)
VALUE i;
@@ -93,15 +218,15 @@ find_i(i, memo)
* call-seq:
* enum.detect(ifnone = nil) {| obj | block } => obj or nil
* enum.find(ifnone = nil) {| obj | block } => obj or nil
- *
+ *
* Passes each entry in <i>enum</i> to <em>block</em>. Returns the
* first for which <em>block</em> is not <code>false</code>. If no
* object matches, calls <i>ifnone</i> and returns its result when it
* is specified, or returns <code>nil</code>
- *
+ *
* (1..10).detect {|i| i % 5 == 0 and i % 7 == 0 } #=> nil
* (1..100).detect {|i| i % 5 == 0 and i % 7 == 0 } #=> 35
- *
+ *
*/
static VALUE
@@ -114,6 +239,7 @@ enum_find(argc, argv, obj)
VALUE if_none;
rb_scan_args(argc, argv, "01", &if_none);
+ RETURN_ENUMERATOR(obj, argc, argv);
rb_iterate(rb_each, obj, find_i, (VALUE)&memo);
if (memo != Qundef) {
return memo;
@@ -124,6 +250,81 @@ enum_find(argc, argv, obj)
return Qnil;
}
+static VALUE find_index_i _((VALUE, VALUE));
+static VALUE
+find_index_i(i, memop)
+ VALUE i;
+ VALUE memop;
+{
+ VALUE *memo = (VALUE*)memop;
+
+ if (rb_equal(i, memo[2])) {
+ memo[0] = UINT2NUM(memo[1]);
+ rb_iter_break();
+ }
+ memo[1]++;
+ return Qnil;
+}
+
+static VALUE find_index_iter_i _((VALUE, VALUE));
+static VALUE
+find_index_iter_i(i, memop)
+ VALUE i;
+ VALUE memop;
+{
+ VALUE *memo = (VALUE*)memop;
+
+ if (RTEST(rb_yield(i))) {
+ memo[0] = UINT2NUM(memo[1]);
+ rb_iter_break();
+ }
+ memo[1]++;
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.find_index(value) => int or nil
+ * enum.find_index {| obj | block } => int or nil
+ *
+ * Compares each entry in <i>enum</i> with <em>value</em> or passes
+ * to <em>block</em>. Returns the index for the first for which the
+ * evaluated value is non-false. If no object matches, returns
+ * <code>nil</code>
+ *
+ * (1..10).find_index {|i| i % 5 == 0 and i % 7 == 0 } #=> nil
+ * (1..100).find_index {|i| i % 5 == 0 and i % 7 == 0 } #=> 34
+ * (1..100).find_index(50) #=> 49
+ *
+ */
+
+static VALUE
+enum_find_index(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE memo[3]; /* [return value, current index, condition value] */
+ rb_block_call_func *func;
+
+ if (argc == 0) {
+ RETURN_ENUMERATOR(obj, 0, 0);
+ func = find_index_iter_i;
+ }
+ else {
+ rb_scan_args(argc, argv, "1", &memo[2]);
+ if (rb_block_given_p()) {
+ rb_warn("given block not used");
+ }
+ func = find_index_i;
+ }
+
+ memo[0] = Qnil;
+ memo[1] = 0;
+ rb_block_call(obj, id_each, 0, 0, func, (VALUE)memo);
+ return memo[0];
+}
+
static VALUE
find_all_i(i, ary)
VALUE i, ary;
@@ -138,13 +339,13 @@ find_all_i(i, ary)
* call-seq:
* enum.find_all {| obj | block } => array
* enum.select {| obj | block } => array
- *
+ *
* Returns an array containing all elements of <i>enum</i> for which
* <em>block</em> is not <code>false</code> (see also
* <code>Enumerable#reject</code>).
- *
+ *
* (1..10).find_all {|i| i % 3 == 0 } #=> [3, 6, 9]
- *
+ *
*/
static VALUE
@@ -152,7 +353,8 @@ enum_find_all(obj)
VALUE obj;
{
VALUE ary = rb_ary_new();
-
+
+ RETURN_ENUMERATOR(obj, 0, 0);
rb_iterate(rb_each, obj, find_all_i, ary);
return ary;
@@ -171,12 +373,12 @@ reject_i(i, ary)
/*
* call-seq:
* enum.reject {| obj | block } => array
- *
+ *
* Returns an array for all elements of <i>enum</i> for which
* <em>block</em> is false (see also <code>Enumerable#find_all</code>).
- *
+ *
* (1..10).reject {|i| i % 3 == 0 } #=> [1, 2, 4, 5, 7, 8, 10]
- *
+ *
*/
static VALUE
@@ -184,7 +386,8 @@ enum_reject(obj)
VALUE obj;
{
VALUE ary = rb_ary_new();
-
+
+ RETURN_ENUMERATOR(obj, 0, 0);
rb_iterate(rb_each, obj, reject_i, ary);
return ary;
@@ -212,13 +415,13 @@ collect_all(i, ary)
* call-seq:
* enum.collect {| obj | block } => array
* enum.map {| obj | block } => array
- *
+ *
* Returns a new array with the results of running <em>block</em> once
* for every element in <i>enum</i>.
- *
+ *
* (1..4).collect {|i| i*i } #=> [1, 4, 9, 16]
* (1..4).collect { "cat" } #=> ["cat", "cat", "cat", "cat"]
- *
+ *
*/
static VALUE
@@ -236,80 +439,135 @@ enum_collect(obj)
* call-seq:
* enum.to_a => array
* enum.entries => array
- *
+ *
* Returns an array containing the items in <i>enum</i>.
- *
+ *
* (1..7).to_a #=> [1, 2, 3, 4, 5, 6, 7]
* { 'a'=>1, 'b'=>2, 'c'=>3 }.to_a #=> [["a", 1], ["b", 2], ["c", 3]]
*/
static VALUE
-enum_to_a(obj)
+enum_to_a(argc, argv, obj)
+ int argc;
+ VALUE *argv;
VALUE obj;
{
VALUE ary = rb_ary_new();
- rb_iterate(rb_each, obj, collect_all, ary);
+ rb_block_call(obj, id_each, argc, argv, collect_all, ary);
return ary;
}
+static VALUE inject_i _((VALUE, VALUE));
static VALUE
-inject_i(i, memo)
+inject_i(i, p)
VALUE i;
- VALUE *memo;
+ VALUE p;
{
- if (*memo == Qundef) {
- *memo = i;
+ VALUE *memo = (VALUE *)p;
+ if (memo[0] == Qundef) {
+ memo[0] = i;
+ }
+ else {
+ memo[0] = rb_yield_values(2, memo[0], i);
+ }
+ return Qnil;
+}
+
+static VALUE inject_op_i _((VALUE, VALUE));
+static VALUE
+inject_op_i(i, p)
+ VALUE i;
+ VALUE p;
+{
+ VALUE *memo = (VALUE *)p;
+
+ if (memo[0] == Qundef) {
+ memo[0] = i;
}
else {
- *memo = rb_yield_values(2, *memo, i);
+ memo[0] = rb_funcall(memo[0], (ID)memo[1], 1, i);
}
return Qnil;
}
/*
* call-seq:
+ * enum.inject(initial, sym) => obj
+ * enum.inject(sym) => obj
* enum.inject(initial) {| memo, obj | block } => obj
* enum.inject {| memo, obj | block } => obj
- *
- * Combines the elements of <i>enum</i> by applying the block to an
- * accumulator value (<i>memo</i>) and each element in turn. At each
- * step, <i>memo</i> is set to the value returned by the block. The
- * first form lets you supply an initial value for <i>memo</i>. The
- * second form uses the first element of the collection as a the
- * initial value (and skips that element while iterating).
- *
+ *
+ * enum.reduce(initial, sym) => obj
+ * enum.reduce(sym) => obj
+ * enum.reduce(initial) {| memo, obj | block } => obj
+ * enum.reduce {| memo, obj | block } => obj
+ *
+ * Combines all elements of <i>enum</i> by applying a binary
+ * operation, specified by a block or a symbol that names a
+ * method or operator.
+ *
+ * If you specify a block, then for each element in <i>enum<i>
+ * the block is passed an accumulator value (<i>memo</i>) and the element.
+ * If you specify a symbol instead, then each element in the collection
+ * will be passed to the named method of <i>memo</i>.
+ * In either case, the result becomes the new value for <i>memo</i>.
+ * At the end of the iteration, the final value of <i>memo</i> is the
+ * return value fo the method.
+ *
+ * If you do not explicitly specify an <i>initial</i> value for <i>memo</i>,
+ * then uses the first element of collection is used as the initial value
+ * of <i>memo</i>.
+ *
+ * Examples:
+ *
* # Sum some numbers
- * (5..10).inject {|sum, n| sum + n } #=> 45
+ * (5..10).reduce(:+) #=> 45
+ * # Same using a block and inject
+ * (5..10).inject {|sum, n| sum + n } #=> 45
* # Multiply some numbers
- * (5..10).inject(1) {|product, n| product * n } #=> 151200
- *
+ * (5..10).reduce(1, :*) #=> 151200
+ * # Same using a block
+ * (5..10).inject(1) {|product, n| product * n } #=> 151200
* # find the longest word
* longest = %w{ cat sheep bear }.inject do |memo,word|
* memo.length > word.length ? memo : word
* end
- * longest #=> "sheep"
- *
- * # find the length of the longest word
- * longest = %w{ cat sheep bear }.inject(0) do |memo,word|
- * memo >= word.length ? memo : word.length
- * end
- * longest #=> 5
- *
+ * longest #=> "sheep"
+ *
*/
-
static VALUE
enum_inject(argc, argv, obj)
int argc;
- VALUE *argv, obj;
+ VALUE *argv;
+ VALUE obj;
{
- VALUE memo = Qundef;
-
- if (rb_scan_args(argc, argv, "01", &memo) == 0)
- memo = Qundef;
- rb_iterate(rb_each, obj, inject_i, (VALUE)&memo);
- if (memo == Qundef) return Qnil;
- return memo;
+ VALUE memo[2];
+ rb_block_call_func *iter = inject_i;
+
+ switch (rb_scan_args(argc, argv, "02", &memo[0], &memo[1])) {
+ case 0:
+ memo[0] = Qundef;
+ break;
+ case 1:
+ if (rb_block_given_p()) {
+ break;
+ }
+ memo[1] = (VALUE)rb_to_id(memo[0]);
+ memo[0] = Qundef;
+ iter = inject_op_i;
+ break;
+ case 2:
+ if (rb_block_given_p()) {
+ rb_warning("given block not used");
+ }
+ memo[1] = (VALUE)rb_to_id(memo[1]);
+ iter = inject_op_i;
+ break;
+ }
+ rb_block_call(obj, id_each, 0, 0, iter, (VALUE)memo);
+ if (memo[0] == Qundef) return Qnil;
+ return memo[0];
}
static VALUE
@@ -328,13 +586,13 @@ partition_i(i, ary)
/*
* call-seq:
* enum.partition {| obj | block } => [ true_array, false_array ]
- *
+ *
* Returns two arrays, the first containing the elements of
* <i>enum</i> for which the block evaluates to true, the second
* containing the rest.
- *
+ *
* (1..6).partition {|i| (i&1).zero?} #=> [[2, 4, 6], [1, 3, 5]]
- *
+ *
*/
static VALUE
@@ -343,6 +601,8 @@ enum_partition(obj)
{
VALUE ary[2];
+ RETURN_ENUMERATOR(obj, 0, 0);
+
ary[0] = rb_ary_new();
ary[1] = rb_ary_new();
rb_iterate(rb_each, obj, partition_i, (VALUE)ary);
@@ -350,11 +610,111 @@ enum_partition(obj)
return rb_assoc_new(ary[0], ary[1]);
}
+static VALUE
+group_by_i(i, hash)
+ VALUE i;
+ VALUE hash;
+{
+ VALUE group = rb_yield(i);
+ VALUE values;
+
+ values = rb_hash_aref(hash, group);
+ if (NIL_P(values)) {
+ values = rb_ary_new3(1, i);
+ rb_hash_aset(hash, group, values);
+ }
+ else {
+ rb_ary_push(values, i);
+ }
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.group_by {| obj | block } => a_hash
+ *
+ * Returns a hash, which keys are evaluated result from the
+ * block, and values are arrays of elements in <i>enum</i>
+ * corresponding to the key.
+ *
+ * (1..6).group_by {|i| i%3} #=> {0=>[3, 6], 1=>[1, 4], 2=>[2, 5]}
+ *
+ */
+
+static VALUE
+enum_group_by(obj)
+ VALUE obj;
+{
+ VALUE hash;
+
+ RETURN_ENUMERATOR(obj, 0, 0);
+
+ hash = rb_hash_new();
+ rb_block_call(obj, id_each, 0, 0, group_by_i, hash);
+
+ return hash;
+}
+
+static VALUE
+first_i(i, ary)
+ VALUE i;
+ VALUE *ary;
+{
+ if (NIL_P(ary[0])) {
+ ary[1] = i;
+ rb_iter_break();
+ }
+ else {
+ long n = NUM2LONG(ary[0]);
+
+ if (n <= 0) {
+ rb_iter_break();
+ }
+ rb_ary_push(ary[1], i);
+ n--;
+ ary[0] = INT2NUM(n);
+ }
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.first -> obj or nil
+ * enum.first(n) -> an_array
+ *
+ * Returns the first element, or the first +n+ elements, of the enumerable.
+ * If the enumerable is empty, the first form returns <code>nil</code>, and the
+ * second form returns an empty array.
+ *
+ */
+
+static VALUE
+enum_first(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE n, ary[2];
+
+ if (argc == 0) {
+ ary[0] = ary[1] = Qnil;
+ }
+ else {
+ rb_scan_args(argc, argv, "01", &n);
+ ary[0] = n;
+ ary[1] = rb_ary_new2(NUM2LONG(n));
+ }
+ rb_block_call(obj, id_each, 0, 0, first_i, (VALUE)ary);
+
+ return ary[1];
+}
+
+
/*
* call-seq:
* enum.sort => array
* enum.sort {| a, b | block } => array
- *
+ *
* Returns an array containing the items in <i>enum</i> sorted,
* either according to their own <code><=></code> method, or by using
* the results of the supplied block. The block should return -1, 0, or
@@ -362,7 +722,7 @@ enum_partition(obj)
* Ruby 1.8, the method <code>Enumerable#sort_by</code> implements a
* built-in Schwartzian Transform, useful when key computation or
* comparison is expensive..
- *
+ *
* %w(rhea kea flea).sort #=> ["flea", "kea", "rhea"]
* (1..10).sort {|a,b| b <=> a} #=> [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
*/
@@ -371,7 +731,7 @@ static VALUE
enum_sort(obj)
VALUE obj;
{
- return rb_ary_sort(enum_to_a(obj));
+ return rb_ary_sort(enum_to_a(0, 0, obj));
}
static VALUE
@@ -391,65 +751,70 @@ sort_by_i(i, ary)
}
static int
-sort_by_cmp(aa, bb)
+sort_by_cmp(aa, bb, data)
NODE **aa, **bb;
+ void *data;
{
VALUE a = aa[0]->u1.value;
VALUE b = bb[0]->u1.value;
+ VALUE ary = (VALUE)data;
+ if (RBASIC(ary)->klass) {
+ rb_raise(rb_eRuntimeError, "sort_by reentered");
+ }
return rb_cmpint(rb_funcall(a, id_cmp, 1, b), a, b);
}
/*
* call-seq:
* enum.sort_by {| obj | block } => array
- *
+ *
* Sorts <i>enum</i> using a set of keys generated by mapping the
* values in <i>enum</i> through the given block.
- *
+ *
* %w{ apple pear fig }.sort_by {|word| word.length}
#=> ["fig", "pear", "apple"]
- *
+ *
* The current implementation of <code>sort_by</code> generates an
* array of tuples containing the original collection element and the
* mapped value. This makes <code>sort_by</code> fairly expensive when
* the keysets are simple
- *
+ *
* require 'benchmark'
* include Benchmark
- *
+ *
* a = (1..100000).map {rand(100000)}
- *
+ *
* bm(10) do |b|
* b.report("Sort") { a.sort }
* b.report("Sort by") { a.sort_by {|a| a} }
* end
- *
+ *
* <em>produces:</em>
- *
+ *
* user system total real
* Sort 0.180000 0.000000 0.180000 ( 0.175469)
* Sort by 1.980000 0.040000 2.020000 ( 2.013586)
- *
+ *
* However, consider the case where comparing the keys is a non-trivial
* operation. The following code sorts some files on modification time
* using the basic <code>sort</code> method.
- *
+ *
* files = Dir["*"]
* sorted = files.sort {|a,b| File.new(a).mtime <=> File.new(b).mtime}
* sorted #=> ["mon", "tues", "wed", "thurs"]
- *
+ *
* This sort is inefficient: it generates two new <code>File</code>
* objects during every comparison. A slightly better technique is to
* use the <code>Kernel#test</code> method to generate the modification
* times directly.
- *
+ *
* files = Dir["*"]
* sorted = files.sort { |a,b|
* test(?M, a) <=> test(?M, b)
* }
* sorted #=> ["mon", "tues", "wed", "thurs"]
- *
+ *
* This still generates many unnecessary <code>Time</code> objects. A
* more efficient technique is to cache the sort keys (modification
* times in this case) before the sort. Perl users often call this
@@ -457,14 +822,14 @@ sort_by_cmp(aa, bb)
* construct a temporary array, where each element is an array
* containing our sort key along with the filename. We sort this array,
* and then extract the filename from the result.
- *
+ *
* sorted = Dir["*"].collect { |f|
* [test(?M, f), f]
* }.sort.collect { |f| f[1] }
* sorted #=> ["mon", "tues", "wed", "thurs"]
- *
+ *
* This is exactly what <code>sort_by</code> does internally.
- *
+ *
* sorted = Dir["*"].sort_by {|f| test(?M, f)}
* sorted #=> ["mon", "tues", "wed", "thurs"]
*/
@@ -476,6 +841,8 @@ enum_sort_by(obj)
VALUE ary;
long i;
+ RETURN_ENUMERATOR(obj, 0, 0);
+
if (TYPE(obj) == T_ARRAY) {
ary = rb_ary_new2(RARRAY(obj)->len);
}
@@ -485,7 +852,8 @@ enum_sort_by(obj)
RBASIC(ary)->klass = 0;
rb_iterate(rb_each, obj, sort_by_i, ary);
if (RARRAY(ary)->len > 1) {
- qsort(RARRAY(ary)->ptr, RARRAY(ary)->len, sizeof(VALUE), sort_by_cmp, 0);
+ qsort(RARRAY(ary)->ptr, RARRAY(ary)->len, sizeof(VALUE),
+ sort_by_cmp, (void *)ary);
}
if (RBASIC(ary)->klass) {
rb_raise(rb_eRuntimeError, "sort_by reentered");
@@ -498,11 +866,11 @@ enum_sort_by(obj)
}
static VALUE
-all_iter_i(i, memo)
+all_i(i, memo)
VALUE i;
VALUE *memo;
{
- if (!RTEST(rb_yield(i))) {
+ if (!RTEST(i)) {
*memo = Qfalse;
rb_iter_break();
}
@@ -510,32 +878,28 @@ all_iter_i(i, memo)
}
static VALUE
-all_i(i, memo)
+all_iter_i(i, memo)
VALUE i;
VALUE *memo;
{
- if (!RTEST(i)) {
- *memo = Qfalse;
- rb_iter_break();
- }
- return Qnil;
+ return all_i(rb_yield(i), memo);
}
/*
* call-seq:
* enum.all? [{|obj| block } ] => true or false
- *
+ *
* Passes each element of the collection to the given block. The method
* returns <code>true</code> if the block never returns
* <code>false</code> or <code>nil</code>. If the block is not given,
* Ruby adds an implicit block of <code>{|obj| obj}</code> (that is
* <code>all?</code> will return <code>true</code> only if none of the
* collection members are <code>false</code> or <code>nil</code>.)
- *
+ *
* %w{ ant bear cat}.all? {|word| word.length >= 3} #=> true
* %w{ ant bear cat}.all? {|word| word.length >= 4} #=> false
* [ nil, true, 99 ].all? #=> false
- *
+ *
*/
static VALUE
@@ -549,11 +913,11 @@ enum_all(obj)
}
static VALUE
-any_iter_i(i, memo)
+any_i(i, memo)
VALUE i;
VALUE *memo;
{
- if (RTEST(rb_yield(i))) {
+ if (RTEST(i)) {
*memo = Qtrue;
rb_iter_break();
}
@@ -561,21 +925,17 @@ any_iter_i(i, memo)
}
static VALUE
-any_i(i, memo)
+any_iter_i(i, memo)
VALUE i;
VALUE *memo;
{
- if (RTEST(i)) {
- *memo = Qtrue;
- rb_iter_break();
- }
- return Qnil;
+ return any_i(rb_yield(i), memo);
}
/*
* call-seq:
* enum.any? [{|obj| block } ] => true or false
- *
+ *
* Passes each element of the collection to the given block. The method
* returns <code>true</code> if the block ever returns a value other
* than <code>false</code> or <code>nil</code>. If the block is not
@@ -583,11 +943,11 @@ any_i(i, memo)
* is <code>any?</code> will return <code>true</code> if at least one
* of the collection members is not <code>false</code> or
* <code>nil</code>.
- *
+ *
* %w{ ant bear cat}.any? {|word| word.length >= 3} #=> true
* %w{ ant bear cat}.any? {|word| word.length >= 4} #=> true
* [ nil, true, 99 ].any? #=> true
- *
+ *
*/
static VALUE
@@ -601,6 +961,105 @@ enum_any(obj)
}
static VALUE
+one_i(i, memo)
+ VALUE i;
+ VALUE *memo;
+{
+ if (RTEST(i)) {
+ if (*memo == Qundef) {
+ *memo = Qtrue;
+ }
+ else if (*memo == Qtrue) {
+ *memo = Qfalse;
+ rb_iter_break();
+ }
+ }
+ return Qnil;
+}
+
+static VALUE
+one_iter_i(i, memo)
+ VALUE i;
+ VALUE *memo;
+{
+ return one_i(rb_yield(i), memo);
+}
+
+/*
+ * call-seq:
+ * enum.one? [{|obj| block }] => true or false
+ *
+ * Passes each element of the collection to the given block. The method
+ * returns <code>true</code> if the block returns <code>true</code>
+ * exactly once. If the block is not given, <code>one?</code> will return
+ * <code>true</code> only if exactly one of the collection members is
+ * true.
+ *
+ * %w{ant bear cat}.one? {|word| word.length == 4} #=> true
+ * %w{ant bear cat}.one? {|word| word.length > 4} #=> false
+ * %w{ant bear cat}.one? {|word| word.length < 4} #=> false
+ * [ nil, true, 99 ].one? #=> false
+ * [ nil, true, false ].one? #=> true
+ *
+ */
+
+static VALUE
+enum_one(obj)
+ VALUE obj;
+{
+ VALUE result = Qundef;
+
+ rb_block_call(obj, id_each, 0, 0, rb_block_given_p() ? one_iter_i : one_i, (VALUE)&result);
+ if (result == Qundef) return Qfalse;
+ return result;
+}
+
+static VALUE
+none_i(i, memo)
+ VALUE i;
+ VALUE *memo;
+{
+ if (RTEST(i)) {
+ *memo = Qfalse;
+ rb_iter_break();
+ }
+ return Qnil;
+}
+
+static VALUE
+none_iter_i(i, memo)
+ VALUE i;
+ VALUE *memo;
+{
+ return none_i(rb_yield(i), memo);
+}
+
+/*
+ * call-seq:
+ * enum.none? [{|obj| block }] => true or false
+ *
+ * Passes each element of the collection to the given block. The method
+ * returns <code>true</code> if the block never returns <code>true</code>
+ * for all elements. If the block is not given, <code>none?</code> will return
+ * <code>true</code> only if none of the collection members is true.
+ *
+ * %w{ant bear cat}.none? {|word| word.length == 5} #=> true
+ * %w{ant bear cat}.none? {|word| word.length >= 4} #=> false
+ * [].none? #=> true
+ * [nil].none? #=> true
+ * [nil,false].none? #=> true
+ */
+static VALUE
+enum_none(obj)
+ VALUE obj;
+{
+ VALUE result = Qtrue;
+
+ rb_block_call(obj, id_each, 0, 0, rb_block_given_p() ? none_iter_i : none_i, (VALUE)&result);
+ return result;
+}
+
+static VALUE
min_i(i, memo)
VALUE i;
VALUE *memo;
@@ -643,11 +1102,11 @@ min_ii(i, memo)
* call-seq:
* enum.min => obj
* enum.min {| a,b | block } => obj
- *
+ *
* Returns the object in <i>enum</i> with the minimum value. The
* first form assumes all objects implement <code>Comparable</code>;
* the second uses the block to return <em>a <=> b</em>.
- *
+ *
* a = %w(albatross dog horse)
* a.min #=> "albatross"
* a.min {|a,b| a.length <=> b.length } #=> "dog"
@@ -668,11 +1127,11 @@ enum_min(obj)
* call-seq:
* enum.max => obj
* enum.max {| a,b | block } => obj
- *
+ *
* Returns the object in <i>enum</i> with the maximum value. The
* first form assumes all objects implement <code>Comparable</code>;
* the second uses the block to return <em>a <=> b</em>.
- *
+ *
* a = %w(albatross dog horse)
* a.max #=> "horse"
* a.max {|a,b| a.length <=> b.length } #=> "albatross"
@@ -720,15 +1179,15 @@ max_ii(i, memo)
* call-seq:
* enum.max => obj
* enum.max {|a,b| block } => obj
- *
+ *
* Returns the object in _enum_ with the maximum value. The
* first form assumes all objects implement <code>Comparable</code>;
* the second uses the block to return <em>a <=> b</em>.
- *
+ *
* a = %w(albatross dog horse)
* a.max #=> "horse"
* a.max {|a,b| a.length <=> b.length } #=> "albatross"
- */
+ */
static VALUE
enum_max(obj)
@@ -742,6 +1201,240 @@ enum_max(obj)
}
static VALUE
+minmax_i(i, memo)
+ VALUE i;
+ VALUE *memo;
+{
+ int n;
+
+ if (memo[0] == Qundef) {
+ memo[0] = i;
+ memo[1] = i;
+ }
+ else {
+ n = rb_cmpint(rb_funcall(i, id_cmp, 1, memo[0]), i, memo[0]);
+ if (n < 0) {
+ memo[0] = i;
+ }
+ n = rb_cmpint(rb_funcall(i, id_cmp, 1, memo[1]), i, memo[1]);
+ if (n > 0) {
+ memo[1] = i;
+ }
+ }
+ return Qnil;
+}
+
+static VALUE
+minmax_ii(i, memo)
+ VALUE i;
+ VALUE *memo;
+{
+ int n;
+
+ if (memo[0] == Qundef) {
+ memo[0] = i;
+ memo[1] = i;
+ }
+ else {
+ VALUE ary = memo[2];
+
+ RARRAY(ary)->ptr[0] = i;
+ RARRAY(ary)->ptr[1] = memo[0];
+ n = rb_cmpint(rb_yield(ary), i, memo[0]);
+ if (n < 0) {
+ memo[0] = i;
+ }
+ RARRAY(ary)->ptr[0] = i;
+ RARRAY(ary)->ptr[1] = memo[1];
+ n = rb_cmpint(rb_yield(ary), i, memo[1]);
+ if (n > 0) {
+ memo[1] = i;
+ }
+ }
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.minmax => [min,max]
+ * enum.minmax {|a,b| block } => [min,max]
+ *
+ * Returns two elements array which contains the minimum and the
+ * maximum value in the enumerable. The first form assumes all
+ * objects implement <code>Comparable</code>; the second uses the
+ * block to return <em>a <=> b</em>.
+ *
+ * a = %w(albatross dog horse)
+ * a.minmax #=> ["albatross", "horse"]
+ * a.minmax {|a,b| a.length <=> b.length } #=> ["dog", "albatross"]
+ */
+
+static VALUE
+enum_minmax(obj)
+ VALUE obj;
+{
+ VALUE result[3];
+ VALUE ary = rb_ary_new3(2, Qnil, Qnil);
+
+ result[0] = Qundef;
+ if (rb_block_given_p()) {
+ result[2] = ary;
+ rb_block_call(obj, id_each, 0, 0, minmax_ii, (VALUE)result);
+ }
+ else {
+ rb_block_call(obj, id_each, 0, 0, minmax_i, (VALUE)result);
+ }
+ if (result[0] != Qundef) {
+ RARRAY(ary)->ptr[0] = result[0];
+ RARRAY(ary)->ptr[1] = result[1];
+ }
+ return ary;
+}
+
+static VALUE
+min_by_i(i, memo)
+ VALUE i;
+ VALUE *memo;
+{
+ VALUE v;
+
+ v = rb_yield(i);
+ if (memo[0] == Qundef) {
+ memo[0] = v;
+ memo[1] = i;
+ }
+ else if (rb_cmpint(rb_funcall(v, id_cmp, 1, memo[0]), v, memo[0]) < 0) {
+ memo[0] = v;
+ memo[1] = i;
+ }
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.min_by {| obj| block } => obj
+ *
+ * Returns the object in <i>enum</i> that gives the minimum
+ * value from the given block.
+ *
+ * a = %w(albatross dog horse)
+ * a.min_by {|x| x.length } #=> "dog"
+ */
+
+static VALUE
+enum_min_by(obj)
+ VALUE obj;
+{
+ VALUE memo[2];
+
+ RETURN_ENUMERATOR(obj, 0, 0);
+
+ memo[0] = Qundef;
+ memo[1] = Qnil;
+ rb_block_call(obj, id_each, 0, 0, min_by_i, (VALUE)memo);
+ return memo[1];
+}
+
+static VALUE
+max_by_i(i, memo)
+ VALUE i;
+ VALUE *memo;
+{
+ VALUE v;
+
+ v = rb_yield(i);
+ if (memo[0] == Qundef) {
+ memo[0] = v;
+ memo[1] = i;
+ }
+ else if (rb_cmpint(rb_funcall(v, id_cmp, 1, memo[0]), v, memo[0]) > 0) {
+ memo[0] = v;
+ memo[1] = i;
+ }
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.max_by {| obj| block } => obj
+ *
+ * Returns the object in <i>enum</i> that gives the maximum
+ * value from the given block.
+ *
+ * a = %w(albatross dog horse)
+ * a.max_by {|x| x.length } #=> "albatross"
+ */
+
+static VALUE
+enum_max_by(obj)
+ VALUE obj;
+{
+ VALUE memo[2];
+
+ RETURN_ENUMERATOR(obj, 0, 0);
+
+ memo[0] = Qundef;
+ memo[1] = Qnil;
+ rb_block_call(obj, id_each, 0, 0, max_by_i, (VALUE)memo);
+ return memo[1];
+}
+
+static VALUE
+minmax_by_i(i, memo)
+ VALUE i;
+ VALUE *memo;
+{
+ VALUE v;
+
+ v = rb_yield(i);
+ if (memo[0] == Qundef) {
+ memo[0] = v;
+ memo[1] = v;
+ memo[2] = i;
+ memo[3] = i;
+ }
+ else {
+ if (rb_cmpint(rb_funcall(v, id_cmp, 1, memo[0]), v, memo[0]) < 0) {
+ memo[0] = v;
+ memo[2] = i;
+ }
+ if (rb_cmpint(rb_funcall(v, id_cmp, 1, memo[1]), v, memo[1]) > 0) {
+ memo[1] = v;
+ memo[3] = i;
+ }
+ }
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.minmax_by {| obj| block } => [min, max]
+ *
+ * Returns two elements array array containing the objects in
+ * <i>enum</i> that gives the minimum and maximum values respectively
+ * from the given block.
+ *
+ * a = %w(albatross dog horse)
+ * a.minmax_by {|x| x.length } #=> ["dog", "albatross"]
+ */
+
+static VALUE
+enum_minmax_by(obj)
+ VALUE obj;
+{
+ VALUE memo[4];
+
+ RETURN_ENUMERATOR(obj, 0, 0);
+
+ memo[0] = Qundef;
+ memo[1] = Qundef;
+ memo[2] = Qnil;
+ memo[3] = Qnil;
+ rb_block_call(obj, id_each, 0, 0, minmax_by_i, (VALUE)memo);
+ return rb_assoc_new(memo[2], memo[3]);
+}
+
+static VALUE
member_i(item, memo)
VALUE item;
VALUE *memo;
@@ -757,13 +1450,13 @@ member_i(item, memo)
* call-seq:
* enum.include?(obj) => true or false
* enum.member?(obj) => true or false
- *
+ *
* Returns <code>true</code> if any member of <i>enum</i> equals
* <i>obj</i>. Equality is tested using <code>==</code>.
- *
+ *
* IO.constants.include? "SEEK_SET" #=> true
* IO.constants.include? "SEEK_NO_FURTHER" #=> false
- *
+ *
*/
static VALUE
@@ -791,29 +1484,56 @@ each_with_index_i(val, memo)
/*
* call-seq:
* enum.each_with_index {|obj, i| block } -> enum
- *
+ *
* Calls <em>block</em> with two arguments, the item and its index, for
* each item in <i>enum</i>.
- *
+ *
* hash = Hash.new
* %w(cat dog wombat).each_with_index {|item, index|
* hash[item] = index
* }
* hash #=> {"cat"=>0, "wombat"=>2, "dog"=>1}
- *
+ *
*/
static VALUE
enum_each_with_index(obj)
VALUE obj;
{
- VALUE memo = 0;
+ VALUE memo;
- rb_need_block();
+ RETURN_ENUMERATOR(obj, 0, 0);
+
+ memo = 0;
rb_iterate(rb_each, obj, each_with_index_i, (VALUE)&memo);
return obj;
}
+/*
+ * call-seq:
+ * enum.reverse_each {|item| block }
+ *
+ * Traverses <i>enum</i> in reverse order.
+ */
+
+static VALUE
+enum_reverse_each(int argc, VALUE *argv, VALUE obj)
+{
+ VALUE ary;
+ long i;
+
+ RETURN_ENUMERATOR(obj, argc, argv);
+
+ ary = enum_to_a(argc, argv, obj);
+
+ for (i = RARRAY_LEN(ary); --i >= 0; ) {
+ rb_yield(RARRAY_PTR(ary)[i]);
+ }
+
+ return obj;
+}
+
+
static VALUE
zip_i(val, memo)
VALUE val;
@@ -843,7 +1563,7 @@ zip_i(val, memo)
* call-seq:
* enum.zip(arg, ...) => array
* enum.zip(arg, ...) {|arr| block } => nil
- *
+ *
* Converts any arguments to arrays, then merges elements of
* <i>enum</i> with corresponding elements from each argument. This
* generates a sequence of <code>enum#size</code> <em>n</em>-element
@@ -852,14 +1572,14 @@ zip_i(val, memo)
* <code>nil</code> values are supplied. If a block given, it is
* invoked for each output array, otherwise an array of arrays is
* returned.
- *
+ *
* a = [ 4, 5, 6 ]
* b = [ 7, 8, 9 ]
- *
+ *
* (1..3).zip(a, b) #=> [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
* "cat\ndog".zip([1]) #=> [["cat\n", 1], ["dog", nil]]
* (1..3).zip #=> [[1], [2], [3]]
- *
+ *
*/
static VALUE
@@ -884,6 +1604,227 @@ enum_zip(argc, argv, obj)
return result;
}
+static VALUE
+take_i(i, arg)
+ VALUE i;
+ VALUE *arg;
+{
+ if (arg[1]-- == 0) rb_iter_break();
+ rb_ary_push(arg[0], i);
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.take(n) => array
+ *
+ * Returns first n elements from <i>enum</i>.
+ *
+ * a = [1, 2, 3, 4, 5, 0]
+ * a.take(3) # => [1, 2, 3]
+ *
+ */
+
+static VALUE
+enum_take(obj, n)
+ VALUE obj;
+ VALUE n;
+{
+ VALUE args[2];
+ long len = NUM2LONG(n);
+
+ if (len < 0) {
+ rb_raise(rb_eArgError, "attempt to take negative size");
+ }
+
+ args[1] = len;
+ args[0] = rb_ary_new();
+ rb_block_call(obj, id_each, 0, 0, take_i, (VALUE)args);
+ return args[0];
+}
+
+
+static VALUE
+take_while_i(i, ary)
+ VALUE i;
+ VALUE *ary;
+{
+ if (!RTEST(rb_yield(i))) rb_iter_break();
+ rb_ary_push(*ary, i);
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.take_while {|arr| block } => array
+ *
+ * Passes elements to the block until the block returns nil or false,
+ * then stops iterating and returns an array of all prior elements.
+ *
+ * a = [1, 2, 3, 4, 5, 0]
+ * a.take_while {|i| i < 3 } # => [1, 2]
+ *
+ */
+
+static VALUE
+enum_take_while(obj)
+ VALUE obj;
+{
+ VALUE ary;
+
+ RETURN_ENUMERATOR(obj, 0, 0);
+ ary = rb_ary_new();
+ rb_block_call(obj, id_each, 0, 0, take_while_i, (VALUE)&ary);
+ return ary;
+}
+
+static VALUE
+drop_i(i, arg)
+ VALUE i;
+ VALUE *arg;
+{
+ if (arg[1] == 0) {
+ rb_ary_push(arg[0], i);
+ }
+ else {
+ arg[1]--;
+ }
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.drop(n) => array
+ *
+ * Drops first n elements from <i>enum</i>, and returns rest elements
+ * in an array.
+ *
+ * a = [1, 2, 3, 4, 5, 0]
+ * a.drop(3) # => [4, 5, 0]
+ *
+ */
+
+static VALUE
+enum_drop(obj, n)
+ VALUE obj;
+ VALUE n;
+{
+ VALUE args[2];
+ long len = NUM2LONG(n);
+
+ if (len < 0) {
+ rb_raise(rb_eArgError, "attempt to drop negative size");
+ }
+
+ args[1] = len;
+ args[0] = rb_ary_new();
+ rb_block_call(obj, id_each, 0, 0, drop_i, (VALUE)args);
+ return args[0];
+}
+
+
+static VALUE
+drop_while_i(i, args)
+ VALUE i;
+ VALUE *args;
+{
+ if (!args[1] && !RTEST(rb_yield(i))) {
+ args[1] = Qtrue;
+ }
+ if (args[1]) {
+ rb_ary_push(args[0], i);
+ }
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.drop_while {|arr| block } => array
+ *
+ * Drops elements up to, but not including, the first element for
+ * which the block returns nil or false and returns an array
+ * containing the remaining elements.
+ *
+ * a = [1, 2, 3, 4, 5, 0]
+ * a.drop_while {|i| i < 3 } # => [3, 4, 5, 0]
+ *
+ */
+
+static VALUE
+enum_drop_while(obj)
+ VALUE obj;
+{
+ VALUE args[2];
+
+ RETURN_ENUMERATOR(obj, 0, 0);
+ args[0] = rb_ary_new();
+ args[1] = Qfalse;
+ rb_block_call(obj, id_each, 0, 0, drop_while_i, (VALUE)args);
+ return args[0];
+}
+
+static VALUE
+cycle_i(i, ary)
+ VALUE i;
+ VALUE ary;
+{
+ rb_ary_push(ary, i);
+ rb_yield(i);
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.cycle {|obj| block }
+ * enum.cycle(n) {|obj| block }
+ *
+ * Calls <i>block</i> for each element of <i>enum</i> repeatedly _n_
+ * times or forever if none or nil is given. If a non-positive
+ * number is given or the collection is empty, does nothing. Returns
+ * nil if the loop has finished without getting interrupted.
+ *
+ * Enumerable#cycle saves elements in an internal array so changes
+ * to <i>enum</i> after the first pass have no effect.
+ *
+ * a = ["a", "b", "c"]
+ * a.cycle {|x| puts x } # print, a, b, c, a, b, c,.. forever.
+ * a.cycle(2) {|x| puts x } # print, a, b, c, a, b, c.
+ *
+ */
+
+static VALUE
+enum_cycle(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE ary;
+ VALUE nv = Qnil;
+ long n, i, len;
+
+ rb_scan_args(argc, argv, "01", &nv);
+
+ RETURN_ENUMERATOR(obj, argc, argv);
+ if (NIL_P(nv)) {
+ n = -1;
+ }
+ else {
+ n = NUM2LONG(nv);
+ if (n <= 0) return Qnil;
+ }
+ ary = rb_ary_new();
+ RBASIC(ary)->klass = 0;
+ rb_block_call(obj, id_each, 0, 0, cycle_i, ary);
+ len = RARRAY(ary)->len;
+ if (len == 0) return Qnil;
+ while (n < 0 || 0 < --n) {
+ for (i=0; i<len; i++) {
+ rb_yield(RARRAY(ary)->ptr[i]);
+ }
+ }
+ return Qnil; /* not reached */
+}
+
/*
* The <code>Enumerable</code> mixin provides collection classes with
* several traversal and searching methods, and with the ability to
@@ -900,32 +1841,51 @@ Init_Enumerable()
{
rb_mEnumerable = rb_define_module("Enumerable");
- rb_define_method(rb_mEnumerable,"to_a", enum_to_a, 0);
- rb_define_method(rb_mEnumerable,"entries", enum_to_a, 0);
-
- rb_define_method(rb_mEnumerable,"sort", enum_sort, 0);
- rb_define_method(rb_mEnumerable,"sort_by", enum_sort_by, 0);
- rb_define_method(rb_mEnumerable,"grep", enum_grep, 1);
- rb_define_method(rb_mEnumerable,"find", enum_find, -1);
- rb_define_method(rb_mEnumerable,"detect", enum_find, -1);
- rb_define_method(rb_mEnumerable,"find_all", enum_find_all, 0);
- rb_define_method(rb_mEnumerable,"select", enum_find_all, 0);
- rb_define_method(rb_mEnumerable,"reject", enum_reject, 0);
- rb_define_method(rb_mEnumerable,"collect", enum_collect, 0);
- rb_define_method(rb_mEnumerable,"map", enum_collect, 0);
- rb_define_method(rb_mEnumerable,"inject", enum_inject, -1);
- rb_define_method(rb_mEnumerable,"partition", enum_partition, 0);
- rb_define_method(rb_mEnumerable,"all?", enum_all, 0);
- rb_define_method(rb_mEnumerable,"any?", enum_any, 0);
- rb_define_method(rb_mEnumerable,"min", enum_min, 0);
- rb_define_method(rb_mEnumerable,"max", enum_max, 0);
- rb_define_method(rb_mEnumerable,"member?", enum_member, 1);
- rb_define_method(rb_mEnumerable,"include?", enum_member, 1);
- rb_define_method(rb_mEnumerable,"each_with_index", enum_each_with_index, 0);
+ rb_define_method(rb_mEnumerable, "to_a", enum_to_a, -1);
+ rb_define_method(rb_mEnumerable, "entries", enum_to_a, -1);
+
+ rb_define_method(rb_mEnumerable, "sort", enum_sort, 0);
+ rb_define_method(rb_mEnumerable, "sort_by", enum_sort_by, 0);
+ rb_define_method(rb_mEnumerable, "grep", enum_grep, 1);
+ rb_define_method(rb_mEnumerable, "count", enum_count, -1);
+ rb_define_method(rb_mEnumerable, "find", enum_find, -1);
+ rb_define_method(rb_mEnumerable, "detect", enum_find, -1);
+ rb_define_method(rb_mEnumerable, "find_index", enum_find_index, -1);
+ rb_define_method(rb_mEnumerable, "find_all", enum_find_all, 0);
+ rb_define_method(rb_mEnumerable, "select", enum_find_all, 0);
+ rb_define_method(rb_mEnumerable, "reject", enum_reject, 0);
+ rb_define_method(rb_mEnumerable, "collect", enum_collect, 0);
+ rb_define_method(rb_mEnumerable, "map", enum_collect, 0);
+ rb_define_method(rb_mEnumerable, "inject", enum_inject, -1);
+ rb_define_method(rb_mEnumerable, "reduce", enum_inject, -1);
+ rb_define_method(rb_mEnumerable, "partition", enum_partition, 0);
+ rb_define_method(rb_mEnumerable, "group_by", enum_group_by, 0);
+ rb_define_method(rb_mEnumerable, "first", enum_first, -1);
+ rb_define_method(rb_mEnumerable, "all?", enum_all, 0);
+ rb_define_method(rb_mEnumerable, "any?", enum_any, 0);
+ rb_define_method(rb_mEnumerable, "one?", enum_one, 0);
+ rb_define_method(rb_mEnumerable, "none?", enum_none, 0);
+ rb_define_method(rb_mEnumerable, "min", enum_min, 0);
+ rb_define_method(rb_mEnumerable, "max", enum_max, 0);
+ rb_define_method(rb_mEnumerable, "minmax", enum_minmax, 0);
+ rb_define_method(rb_mEnumerable, "min_by", enum_min_by, 0);
+ rb_define_method(rb_mEnumerable, "max_by", enum_max_by, 0);
+ rb_define_method(rb_mEnumerable, "minmax_by", enum_minmax_by, 0);
+ rb_define_method(rb_mEnumerable, "member?", enum_member, 1);
+ rb_define_method(rb_mEnumerable, "include?", enum_member, 1);
+ rb_define_method(rb_mEnumerable, "each_with_index", enum_each_with_index, 0);
+ rb_define_method(rb_mEnumerable, "enum_with_index", enum_each_with_index, 0);
+ rb_define_method(rb_mEnumerable, "reverse_each", enum_reverse_each, -1);
rb_define_method(rb_mEnumerable, "zip", enum_zip, -1);
+ rb_define_method(rb_mEnumerable, "take", enum_take, 1);
+ rb_define_method(rb_mEnumerable, "take_while", enum_take_while, 0);
+ rb_define_method(rb_mEnumerable, "drop", enum_drop, 1);
+ rb_define_method(rb_mEnumerable, "drop_while", enum_drop_while, 0);
+ rb_define_method(rb_mEnumerable, "cycle", enum_cycle, -1);
id_eqq = rb_intern("===");
id_each = rb_intern("each");
id_cmp = rb_intern("<=>");
+ id_size = rb_intern("size");
}
diff --git a/enumerator.c b/enumerator.c
new file mode 100644
index 0000000000..f95d931b62
--- /dev/null
+++ b/enumerator.c
@@ -0,0 +1,450 @@
+/************************************************
+
+ enumerator.c - provides Enumerator class
+
+ $Author$
+
+ Copyright (C) 2001-2003 Akinori MUSHA
+
+ $Idaemons: /home/cvs/rb/enumerator/enumerator.c,v 1.1.1.1 2001/07/15 10:12:48 knu Exp $
+ $RoughId: enumerator.c,v 1.6 2003/07/27 11:03:24 nobu Exp $
+ $Id$
+
+************************************************/
+
+#include "ruby.h"
+
+/*
+ * Document-class: Enumerable::Enumerator
+ *
+ * A class which provides a method `each' to be used as an Enumerable
+ * object.
+ */
+VALUE rb_cEnumerator;
+static VALUE sym_each;
+
+VALUE rb_eStopIteration;
+
+struct enumerator {
+ VALUE obj;
+ ID meth;
+ VALUE proc;
+ VALUE args;
+ rb_block_call_func *iter;
+};
+
+static void enumerator_mark _((void *));
+static void
+enumerator_mark(p)
+ void *p;
+{
+ struct enumerator *ptr = p;
+ rb_gc_mark(ptr->obj);
+ rb_gc_mark(ptr->args);
+}
+
+static struct enumerator *
+enumerator_ptr(obj)
+ VALUE obj;
+{
+ struct enumerator *ptr;
+
+ Data_Get_Struct(obj, struct enumerator, ptr);
+ if (RDATA(obj)->dmark != enumerator_mark) {
+ rb_raise(rb_eTypeError,
+ "wrong argument type %s (expected Enumerable::Enumerator)",
+ rb_obj_classname(obj));
+ }
+ if (!ptr || ptr->obj == Qundef) {
+ rb_raise(rb_eArgError, "uninitialized enumerator");
+ }
+ return ptr;
+}
+
+/*
+ * call-seq:
+ * obj.to_enum(method = :each, *args)
+ * obj.enum_for(method = :each, *args)
+ *
+ * Returns Enumerable::Enumerator.new(self, method, *args).
+ *
+ * e.g.:
+ *
+ * str = "xyz"
+ *
+ * enum = str.enum_for(:each_byte)
+ * a = enum.map {|b| '%02x' % b } #=> ["78", "79", "7a"]
+ *
+ * # protects an array from being modified
+ * a = [1, 2, 3]
+ * some_method(a.to_enum)
+ *
+ */
+static VALUE
+obj_to_enum(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE meth = sym_each;
+
+ if (argc > 0) {
+ --argc;
+ meth = *argv++;
+ }
+ return rb_enumeratorize(obj, meth, argc, argv);
+}
+
+static VALUE
+each_slice_i(val, memo)
+ VALUE val;
+ VALUE *memo;
+{
+ VALUE ary = memo[0];
+ VALUE v = Qnil;
+ long size = (long)memo[1];
+
+ rb_ary_push(ary, val);
+
+ if (RARRAY_LEN(ary) == size) {
+ v = rb_yield(ary);
+ memo[0] = rb_ary_new2(size);
+ }
+
+ return v;
+}
+
+/*
+ * call-seq:
+ * e.each_slice(n) {...}
+ * e.each_slice(n)
+ *
+ * Iterates the given block for each slice of <n> elements. If no
+ * block is given, returns an enumerator.
+ *
+ * e.g.:
+ * (1..10).each_slice(3) {|a| p a}
+ * # outputs below
+ * [1, 2, 3]
+ * [4, 5, 6]
+ * [7, 8, 9]
+ * [10]
+ *
+ */
+static VALUE
+enum_each_slice(obj, n)
+ VALUE obj, n;
+{
+ long size = NUM2LONG(n);
+ VALUE args[2], ary;
+
+ if (size <= 0) rb_raise(rb_eArgError, "invalid slice size");
+ RETURN_ENUMERATOR(obj, 1, &n);
+ args[0] = rb_ary_new2(size);
+ args[1] = (VALUE)size;
+
+ rb_block_call(obj, SYM2ID(sym_each), 0, 0, each_slice_i, (VALUE)args);
+
+ ary = args[0];
+ if (RARRAY_LEN(ary) > 0) rb_yield(ary);
+
+ return Qnil;
+}
+
+static VALUE
+each_cons_i(val, memo)
+ VALUE val;
+ VALUE *memo;
+{
+ VALUE ary = memo[0];
+ VALUE v = Qnil;
+ long size = (long)memo[1];
+
+ if (RARRAY_LEN(ary) == size) {
+ rb_ary_shift(ary);
+ }
+ rb_ary_push(ary, val);
+ if (RARRAY_LEN(ary) == size) {
+ v = rb_yield(rb_ary_dup(ary));
+ }
+ return v;
+}
+
+/*
+ * call-seq:
+ * each_cons(n) {...}
+ * each_cons(n)
+ *
+ * Iterates the given block for each array of consecutive <n>
+ * elements. If no block is given, returns an enumerator.a
+ *
+ * e.g.:
+ * (1..10).each_cons(3) {|a| p a}
+ * # outputs below
+ * [1, 2, 3]
+ * [2, 3, 4]
+ * [3, 4, 5]
+ * [4, 5, 6]
+ * [5, 6, 7]
+ * [6, 7, 8]
+ * [7, 8, 9]
+ * [8, 9, 10]
+ *
+ */
+static VALUE
+enum_each_cons(obj, n)
+ VALUE obj, n;
+{
+ long size = NUM2LONG(n);
+ VALUE args[2];
+
+ if (size <= 0) rb_raise(rb_eArgError, "invalid size");
+ RETURN_ENUMERATOR(obj, 1, &n);
+ args[0] = rb_ary_new2(size);
+ args[1] = (VALUE)size;
+
+ rb_block_call(obj, SYM2ID(sym_each), 0, 0, each_cons_i, (VALUE)args);
+
+ return Qnil;
+}
+
+static VALUE enumerator_allocate _((VALUE));
+static VALUE
+enumerator_allocate(klass)
+ VALUE klass;
+{
+ struct enumerator *ptr;
+ VALUE enum_obj;
+
+ enum_obj = Data_Make_Struct(klass, struct enumerator,
+ enumerator_mark, -1, ptr);
+ ptr->obj = Qundef;
+
+ return enum_obj;
+}
+
+static VALUE enumerator_each_i _((VALUE, VALUE));
+static VALUE
+enumerator_each_i(v, enum_obj)
+ VALUE v;
+ VALUE enum_obj;
+{
+ return rb_yield(v);
+}
+
+static VALUE
+enumerator_init(enum_obj, obj, meth, argc, argv)
+ VALUE enum_obj;
+ VALUE obj;
+ VALUE meth;
+ int argc;
+ VALUE *argv;
+{
+ struct enumerator *ptr;
+
+ Data_Get_Struct(enum_obj, struct enumerator, ptr);
+
+ if (!ptr) {
+ rb_raise(rb_eArgError, "unallocated enumerator");
+ }
+
+ ptr->obj = obj;
+ ptr->meth = rb_to_id(meth);
+ ptr->iter = enumerator_each_i;
+ if (argc) ptr->args = rb_ary_new4(argc, argv);
+
+ return enum_obj;
+}
+
+/*
+ * call-seq:
+ * Enumerable::Enumerator.new(obj, method = :each, *args)
+ *
+ * Creates a new Enumerable::Enumerator object, which is to be
+ * used as an Enumerable object using the given object's given
+ * method with the given arguments.
+ *
+ * Use of this method is discouraged. Use Kernel#enum_for() instead.
+ */
+static VALUE
+enumerator_initialize(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE recv, meth = sym_each;
+
+ if (argc == 0)
+ rb_raise(rb_eArgError, "wrong number of argument (0 for 1)");
+ recv = *argv++;
+ if (--argc) {
+ meth = *argv++;
+ --argc;
+ }
+ return enumerator_init(obj, recv, meth, argc, argv);
+}
+
+/* :nodoc: */
+static VALUE
+enumerator_init_copy(obj, orig)
+ VALUE obj;
+ VALUE orig;
+{
+ struct enumerator *ptr0, *ptr1;
+
+ ptr0 = enumerator_ptr(orig);
+
+ Data_Get_Struct(obj, struct enumerator, ptr1);
+
+ if (!ptr1) {
+ rb_raise(rb_eArgError, "unallocated enumerator");
+ }
+
+ ptr1->obj = ptr0->obj;
+ ptr1->meth = ptr0->meth;
+ ptr1->iter = ptr0->iter;
+ ptr1->args = ptr0->args;
+
+ return obj;
+}
+
+VALUE
+rb_enumeratorize(obj, meth, argc, argv)
+ VALUE obj;
+ VALUE meth;
+ int argc;
+ VALUE *argv;
+{
+ return enumerator_init(enumerator_allocate(rb_cEnumerator), obj, meth, argc, argv);
+}
+
+/*
+ * call-seq:
+ * enum.each {...}
+ *
+ * Iterates the given block using the object and the method specified
+ * in the first place. If no block is given, returns self.
+ *
+ */
+static VALUE
+enumerator_each(obj)
+ VALUE obj;
+{
+ struct enumerator *e;
+ int argc = 0;
+ VALUE *argv = 0;
+
+ if (!rb_block_given_p()) return obj;
+ e = enumerator_ptr(obj);
+ if (e->args) {
+ argc = RARRAY_LEN(e->args);
+ argv = RARRAY_PTR(e->args);
+ }
+ return rb_block_call(e->obj, e->meth, argc, argv, e->iter, (VALUE)e);
+}
+
+static VALUE
+enumerator_with_index_i(val, memo)
+ VALUE val;
+ VALUE *memo;
+{
+ val = rb_yield_values(2, val, INT2FIX(*memo));
+ ++*memo;
+ return val;
+}
+
+/*
+ * call-seq:
+ * e.with_index {|(*args), idx| ... }
+ * e.with_index
+ *
+ * Iterates the given block for each elements with an index, which
+ * start from 0. If no block is given, returns an enumerator.
+ *
+ */
+static VALUE
+enumerator_with_index(obj)
+ VALUE obj;
+{
+ struct enumerator *e = enumerator_ptr(obj);
+ VALUE memo = 0;
+ int argc = 0;
+ VALUE *argv = 0;
+
+ RETURN_ENUMERATOR(obj, 0, 0);
+ if (e->args) {
+ argc = RARRAY_LEN(e->args);
+ argv = RARRAY_PTR(e->args);
+ }
+ return rb_block_call(e->obj, e->meth, argc, argv,
+ enumerator_with_index_i, (VALUE)&memo);
+}
+
+/*
+ * call-seq:
+ * e.next => object
+ *
+ * Returns the next object in the enumerator, and move the internal
+ * position forward. When the position reached at the end, internal
+ * position is rewinded then StopIteration is raised.
+ *
+ * Note that enumeration sequence by next method does not affect other
+ * non-external enumeration methods, unless underlying iteration
+ * methods itself has side-effect, e.g. IO#each_line.
+ *
+ * Caution: Calling this method causes the "generator" library to be
+ * loaded.
+ */
+
+static VALUE
+enumerator_next(obj)
+ VALUE obj;
+{
+ rb_require("generator");
+ return rb_funcall(obj, rb_intern("next"), 0, 0);
+}
+
+/*
+ * call-seq:
+ * e.rewind => e
+ *
+ * Rewinds the enumeration sequence by the next method.
+ */
+
+static VALUE
+enumerator_rewind(obj)
+ VALUE obj;
+{
+ rb_require("generator");
+ return rb_funcall(obj, rb_intern("rewind"), 0, 0);
+}
+
+void
+Init_Enumerator()
+{
+ rb_define_method(rb_mKernel, "to_enum", obj_to_enum, -1);
+ rb_define_method(rb_mKernel, "enum_for", obj_to_enum, -1);
+
+ rb_define_method(rb_mEnumerable, "each_slice", enum_each_slice, 1);
+ rb_define_method(rb_mEnumerable, "enum_slice", enum_each_slice, 1);
+ rb_define_method(rb_mEnumerable, "each_cons", enum_each_cons, 1);
+ rb_define_method(rb_mEnumerable, "enum_cons", enum_each_cons, 1);
+
+ rb_cEnumerator = rb_define_class_under(rb_mEnumerable, "Enumerator", rb_cObject);
+ rb_include_module(rb_cEnumerator, rb_mEnumerable);
+
+ rb_define_alloc_func(rb_cEnumerator, enumerator_allocate);
+ rb_define_method(rb_cEnumerator, "initialize", enumerator_initialize, -1);
+ rb_define_method(rb_cEnumerator, "initialize_copy", enumerator_init_copy, 1);
+ rb_define_method(rb_cEnumerator, "each", enumerator_each, 0);
+ rb_define_method(rb_cEnumerator, "each_with_index", enumerator_with_index, 0);
+ rb_define_method(rb_cEnumerator, "with_index", enumerator_with_index, 0);
+ rb_define_method(rb_cEnumerator, "next", enumerator_next, 0);
+ rb_define_method(rb_cEnumerator, "rewind", enumerator_rewind, 0);
+
+ rb_eStopIteration = rb_define_class("StopIteration", rb_eIndexError);
+
+ sym_each = ID2SYM(rb_intern("each"));
+
+ rb_provide("enumerator.so"); /* for backward compatibility */
+}
diff --git a/error.c b/error.c
index 608d1fa558..a991f55e57 100644
--- a/error.c
+++ b/error.c
@@ -29,7 +29,7 @@
#define EXIT_SUCCESS 0
#endif
-extern const char ruby_version[], ruby_release_date[], ruby_platform[];
+extern const char *ruby_description;
int ruby_nerrs;
@@ -208,8 +208,7 @@ rb_bug(fmt, va_alist)
va_init_list(args, fmt);
vfprintf(out, fmt, args);
va_end(args);
- fprintf(out, "\nruby %s (%s) [%s]\n\n",
- ruby_version, ruby_release_date, ruby_platform);
+ fprintf(out, "\n%s\n\n", ruby_description);
}
abort();
}
@@ -258,7 +257,7 @@ rb_check_type(x, t)
if (TYPE(x) != t) {
while (type->type >= 0) {
if (type->type == t) {
- char *etype;
+ const char *etype;
if (NIL_P(x)) {
etype = "nil";
@@ -334,7 +333,7 @@ rb_exc_new3(etype, str)
VALUE etype, str;
{
StringValue(str);
- return rb_exc_new(etype, RSTRING(str)->ptr, RSTRING(str)->len);
+ return rb_funcall(etype, rb_intern("new"), 1, str);
}
/*
@@ -499,7 +498,7 @@ rb_check_backtrace(bt)
VALUE bt;
{
long i;
- static char *err = "backtrace must be Array of String";
+ static const char err[] = "backtrace must be Array of String";
if (!NIL_P(bt)) {
int t = TYPE(bt);
@@ -728,7 +727,7 @@ name_err_mesg_to_str(obj)
mesg = ptr[0];
if (NIL_P(mesg)) return Qnil;
else {
- char *desc = 0;
+ const char *desc = 0;
VALUE d = 0, args[3];
obj = ptr[1];
@@ -882,7 +881,7 @@ syserr_initialize(argc, argv, self)
#if !defined(_WIN32) && !defined(__VMS)
char *strerror();
#endif
- char *err;
+ const char *err;
VALUE mesg, error;
VALUE klass = rb_obj_class(self);
@@ -952,18 +951,16 @@ syserr_eqq(self, exc)
VALUE self, exc;
{
VALUE num, e;
+ ID en = rb_intern("errno");
- if (!rb_obj_is_kind_of(exc, rb_eSystemCallError)) return Qfalse;
- if (self == rb_eSystemCallError) return Qtrue;
+ if (!rb_obj_is_kind_of(exc, rb_eSystemCallError)) {
+ if (!rb_respond_to(exc, en)) return Qfalse;
+ }
+ else if (self == rb_eSystemCallError) return Qtrue;
- num = rb_attr_get(exc, rb_intern("errno"));
+ num = rb_attr_get(exc, en);
if (NIL_P(num)) {
- VALUE klass = CLASS_OF(exc);
-
- while (TYPE(klass) == T_ICLASS || FL_TEST(klass, FL_SINGLETON)) {
- klass = (VALUE)RCLASS(klass)->super;
- }
- num = rb_const_get(klass, rb_intern("Errno"));
+ num = rb_funcall(exc, en, 0, 0);
}
e = rb_const_get(self, rb_intern("Errno"));
if (FIXNUM_P(num) ? num == e : rb_equal(num, e))
diff --git a/eval.c b/eval.c
index 28384488ad..d2a2556494 100644
--- a/eval.c
+++ b/eval.c
@@ -72,6 +72,8 @@ char *strrchr _((const char*,const char));
#include <unistd.h>
#endif
+#include <time.h>
+
#ifdef __BEOS__
#include <net/socket.h>
#endif
@@ -193,14 +195,11 @@ static int volatile freebsd_clear_carry_flag = 0;
POST_GETCONTEXT, \
(j)->status)
#else
-# if !defined(setjmp) && defined(HAVE__SETJMP)
-# define ruby_setjmp(just_before_setjmp, env) \
- ((just_before_setjmp), _setjmp(env))
-# define ruby_longjmp(env,val) _longjmp(env,val)
-# else
-# define ruby_setjmp(just_before_setjmp, env) \
- ((just_before_setjmp), setjmp(env))
-# define ruby_longjmp(env,val) longjmp(env,val)
+# define ruby_setjmp(just_before_setjmp, env) \
+ ((just_before_setjmp), RUBY_SETJMP(env))
+# define ruby_longjmp(env,val) RUBY_LONGJMP(env,val)
+# ifdef __CYGWIN__
+int _setjmp(), _longjmp();
# endif
#endif
@@ -470,16 +469,16 @@ search_method(klass, id, origin)
VALUE klass, *origin;
ID id;
{
- NODE *body;
+ st_data_t body;
if (!klass) return 0;
- while (!st_lookup(RCLASS(klass)->m_tbl, id, (st_data_t *)&body)) {
+ while (!st_lookup(RCLASS(klass)->m_tbl, id, &body)) {
klass = RCLASS(klass)->super;
if (!klass) return 0;
}
if (origin) *origin = klass;
- return body;
+ return (NODE *)body;
}
static NODE*
@@ -490,7 +489,7 @@ rb_get_method_body(klassp, idp, noexp)
{
ID id = *idp;
VALUE klass = *klassp;
- VALUE origin;
+ VALUE origin = 0;
NODE * volatile body;
struct cache_entry *ent;
@@ -558,7 +557,8 @@ remove_method(klass, mid)
VALUE klass;
ID mid;
{
- NODE *body;
+ st_data_t data;
+ NODE *body = 0;
if (klass == rb_cObject) {
rb_secure(4);
@@ -570,10 +570,11 @@ remove_method(klass, mid)
if (mid == __id__ || mid == __send__ || mid == init) {
rb_warn("removing `%s' may cause serious problem", rb_id2name(mid));
}
- if (st_lookup(RCLASS(klass)->m_tbl, mid, (st_data_t *)&body)) {
+ if (st_lookup(RCLASS(klass)->m_tbl, mid, &data)) {
+ body = (NODE *)data;
if (!body || !body->nd_body) body = 0;
else {
- st_delete(RCLASS(klass)->m_tbl, &mid, (st_data_t *)&body);
+ st_delete(RCLASS(klass)->m_tbl, &mid, &data);
}
}
if (!body) {
@@ -759,7 +760,7 @@ static struct SCOPE *top_scope;
static unsigned long frame_unique = 0;
#define PUSH_FRAME() do { \
- struct FRAME _frame; \
+ volatile struct FRAME _frame; \
_frame.prev = ruby_frame; \
_frame.tmp = 0; \
_frame.node = ruby_current_node; \
@@ -1028,7 +1029,7 @@ static struct tag *prot_tag;
#define PROT_LAMBDA INT2FIX(2) /* 5 */
#define PROT_YIELD INT2FIX(3) /* 7 */
-#define EXEC_TAG() (FLUSH_REGISTER_WINDOWS, ruby_setjmp(((void)0), prot_tag->buf))
+#define EXEC_TAG() ruby_setjmp(((void)0), prot_tag->buf)
#define JUMP_TAG(st) do { \
ruby_frame = prot_tag->frame; \
@@ -1056,7 +1057,7 @@ VALUE ruby_class;
static VALUE ruby_wrapper; /* security wrapper */
#define PUSH_CLASS(c) do { \
- VALUE _class = ruby_class; \
+ volatile VALUE _class = ruby_class; \
ruby_class = (c)
#define POP_CLASS() ruby_class = _class; \
@@ -1104,8 +1105,8 @@ static void scope_dup _((struct SCOPE *));
} while (0)
static VALUE rb_eval _((VALUE,NODE*));
-static VALUE eval _((VALUE,VALUE,VALUE,char*,int));
-static NODE *compile _((VALUE, char*, int));
+static VALUE eval _((VALUE,VALUE,VALUE,const char*,int));
+static NODE *compile _((VALUE, const char*, int));
static VALUE rb_yield_0 _((VALUE, VALUE, VALUE, int, int));
@@ -1114,6 +1115,7 @@ static VALUE rb_yield_0 _((VALUE, VALUE, VALUE, int, int));
#define YIELD_PUBLIC_DEF 4
#define YIELD_FUNC_AVALUE 1
#define YIELD_FUNC_SVALUE 2
+#define YIELD_FUNC_LAMBDA 3
static VALUE rb_call _((VALUE,VALUE,ID,int,const VALUE*,int,VALUE));
static VALUE module_setup _((VALUE,NODE*));
@@ -1227,7 +1229,7 @@ error_print()
{
VALUE errat = Qnil; /* OK */
volatile VALUE eclass, e;
- char *einfo;
+ const char *einfo;
long elen;
if (NIL_P(ruby_errinfo)) return;
@@ -1288,7 +1290,7 @@ error_print()
long len = elen;
if (RSTRING(epath)->ptr[0] == '#') epath = 0;
- if (tail = memchr(einfo, '\n', elen)) {
+ if ((tail = memchr(einfo, '\n', elen)) != 0) {
len = tail - einfo;
tail++; /* skip newline */
}
@@ -1309,6 +1311,7 @@ error_print()
if (!NIL_P(errat)) {
long i;
struct RArray *ep = RARRAY(errat);
+ int truncate = eclass == rb_eSysStackError;
#define TRACE_MAX (TRACE_HEAD+TRACE_TAIL+5)
#define TRACE_HEAD 8
@@ -1319,7 +1322,7 @@ error_print()
if (TYPE(ep->ptr[i]) == T_STRING) {
warn_printf("\tfrom %s\n", RSTRING(ep->ptr[i])->ptr);
}
- if (i == TRACE_HEAD && ep->len > TRACE_MAX) {
+ if (truncate && i == TRACE_HEAD && ep->len > TRACE_MAX) {
warn_printf("\t ... %ld levels...\n",
ep->len - TRACE_HEAD - TRACE_TAIL);
i = ep->len - TRACE_TAIL;
@@ -1440,9 +1443,6 @@ int ruby_in_eval;
static void rb_thread_cleanup _((void));
static void rb_thread_wait_other_threads _((void));
-static int thread_set_raised();
-static int thread_reset_raised();
-
static int thread_no_ensure _((void));
static VALUE exception_error;
@@ -1461,8 +1461,10 @@ error_handle(ex)
int ex;
{
int status = EXIT_FAILURE;
+ rb_thread_t th = curr_thread;
- if (thread_set_raised()) return EXIT_FAILURE;
+ if (rb_thread_set_raised(th))
+ return EXIT_FAILURE;
switch (ex & TAG_MASK) {
case 0:
status = EXIT_SUCCESS;
@@ -1515,7 +1517,7 @@ error_handle(ex)
rb_bug("Unknown longjmp status %d", ex);
break;
}
- thread_reset_raised();
+ rb_thread_reset_raised(th);
return status;
}
@@ -2031,7 +2033,7 @@ void
rb_frozen_class_p(klass)
VALUE klass;
{
- char *desc = "something(?!)";
+ const char *desc = "something(?!)";
if (OBJ_FROZEN(klass)) {
if (FL_TEST(klass, FL_SINGLETON))
@@ -2069,7 +2071,7 @@ rb_undef(klass, id)
}
body = search_method(klass, id, &origin);
if (!body || !body->nd_body) {
- char *s0 = " class";
+ const char *s0 = " class";
VALUE c = klass;
if (FL_TEST(c, FL_SINGLETON)) {
@@ -2160,9 +2162,10 @@ rb_alias(klass, name, def)
VALUE klass;
ID name, def;
{
- VALUE origin;
+ VALUE origin = 0;
NODE *orig, *body, *node;
VALUE singleton = 0;
+ st_data_t data;
rb_frozen_class_p(klass);
if (name == def) return;
@@ -2190,7 +2193,8 @@ rb_alias(klass, name, def)
}
rb_clear_cache_by_id(name);
- if (RTEST(ruby_verbose) && st_lookup(RCLASS(klass)->m_tbl, name, (st_data_t *)&node)) {
+ if (RTEST(ruby_verbose) && st_lookup(RCLASS(klass)->m_tbl, name, &data)) {
+ node = (NODE *)data;
if (node->nd_cnt == 0 && node->nd_body) {
rb_warning("discarding old %s", rb_id2name(name));
}
@@ -2239,8 +2243,8 @@ rb_mod_alias_method(mod, newname, oldname)
return mod;
}
-static NODE*
-copy_node_scope(node, rval)
+NODE *
+rb_copy_node_scope(node, rval)
NODE *node;
NODE *rval;
{
@@ -2319,9 +2323,9 @@ copy_node_scope(node, rval)
#define MATCH_DATA *rb_svar(node->nd_cnt)
-static char* is_defined _((VALUE, NODE*, char*));
+static const char* is_defined _((VALUE, NODE*, char*));
-static char*
+static const char*
arg_defined(self, node, buf, type)
VALUE self;
NODE *node;
@@ -2348,7 +2352,7 @@ arg_defined(self, node, buf, type)
return type;
}
-static char*
+static const char*
is_defined(self, node, buf)
VALUE self;
NODE *node; /* OK */
@@ -2441,6 +2445,8 @@ is_defined(self, node, buf)
case NODE_ATTRSET:
case NODE_OP_ASGN1:
case NODE_OP_ASGN2:
+ case NODE_OP_ASGN_OR:
+ case NODE_OP_ASGN_AND:
case NODE_MASGN:
case NODE_LASGN:
case NODE_DASGN:
@@ -2666,27 +2672,27 @@ set_trace_func(obj, trace)
return trace;
}
-static char *
+static const char *
get_event_name(rb_event_t event)
{
switch (event) {
- case RUBY_EVENT_LINE:
+ case RUBY_EVENT_LINE:
return "line";
- case RUBY_EVENT_CLASS:
+ case RUBY_EVENT_CLASS:
return "class";
- case RUBY_EVENT_END:
+ case RUBY_EVENT_END:
return "end";
- case RUBY_EVENT_CALL:
+ case RUBY_EVENT_CALL:
return "call";
- case RUBY_EVENT_RETURN:
+ case RUBY_EVENT_RETURN:
return "return";
- case RUBY_EVENT_C_CALL:
+ case RUBY_EVENT_C_CALL:
return "c-call";
- case RUBY_EVENT_C_RETURN:
+ case RUBY_EVENT_C_RETURN:
return "c-return";
- case RUBY_EVENT_RAISE:
+ case RUBY_EVENT_RAISE:
return "raise";
- default:
+ default:
return "unknown";
}
}
@@ -2703,7 +2709,8 @@ call_trace_func(event, node, self, id, klass)
struct FRAME *prev;
NODE *node_save;
VALUE srcfile;
- char *event_name;
+ const char *event_name;
+ rb_thread_t th = curr_thread;
if (!trace_func) return;
if (tracing) return;
@@ -2735,7 +2742,7 @@ call_trace_func(event, node, self, id, klass)
}
}
PUSH_TAG(PROT_NONE);
- raised = thread_reset_raised();
+ raised = rb_thread_reset_raised(th);
if ((state = EXEC_TAG()) == 0) {
srcfile = rb_str_new2(ruby_sourcefile?ruby_sourcefile:"(ruby)");
event_name = get_event_name(event);
@@ -2747,7 +2754,7 @@ call_trace_func(event, node, self, id, klass)
klass),
Qundef, 0);
}
- if (raised) thread_set_raised();
+ if (raised) rb_thread_set_raised(th);
POP_TAG();
POP_FRAME();
@@ -2939,6 +2946,7 @@ rb_eval(self, n)
NODE * volatile node = n;
int state;
volatile VALUE result = Qnil;
+ st_data_t data;
#define RETURN(v) do { \
result = (v); \
@@ -3038,13 +3046,16 @@ rb_eval(self, n)
RETURN(Qfalse);
case NODE_IF:
- EXEC_EVENT_HOOK(RUBY_EVENT_LINE, node, self,
- ruby_frame->last_func,
- ruby_frame->last_class);
if (RTEST(rb_eval(self, node->nd_cond))) {
+ EXEC_EVENT_HOOK(RUBY_EVENT_LINE, node, self,
+ ruby_frame->last_func,
+ ruby_frame->last_class);
node = node->nd_body;
}
else {
+ EXEC_EVENT_HOOK(RUBY_EVENT_LINE, node, self,
+ ruby_frame->last_func,
+ ruby_frame->last_class);
node = node->nd_else;
}
goto again;
@@ -3912,7 +3923,7 @@ rb_eval(self, n)
case NODE_DEFN:
if (node->nd_defn) {
NODE *body, *defn;
- VALUE origin;
+ VALUE origin = 0;
int noex;
if (NIL_P(ruby_class)) {
@@ -3946,7 +3957,7 @@ rb_eval(self, n)
noex |= NOEX_NOSUPER;
}
- defn = copy_node_scope(node->nd_defn, ruby_cref);
+ defn = rb_copy_node_scope(node->nd_defn, ruby_cref);
rb_add_method(ruby_class, node->nd_mid, defn, noex);
if (scope_vmode == SCOPE_MODFUNC) {
rb_add_method(rb_singleton_class(ruby_class),
@@ -3974,7 +3985,8 @@ rb_eval(self, n)
if (OBJ_FROZEN(recv)) rb_error_frozen("object");
klass = rb_singleton_class(recv);
- if (st_lookup(RCLASS(klass)->m_tbl, node->nd_mid, (st_data_t *)&body)) {
+ if (st_lookup(RCLASS(klass)->m_tbl, node->nd_mid, &data)) {
+ body = (NODE *)data;
if (ruby_safe_level >= 4) {
rb_raise(rb_eSecurityError, "redefining method prohibited");
}
@@ -3982,7 +3994,7 @@ rb_eval(self, n)
rb_warning("redefine %s", rb_id2name(node->nd_mid));
}
}
- defn = copy_node_scope(node->nd_defn, ruby_cref);
+ defn = rb_copy_node_scope(node->nd_defn, ruby_cref);
rb_add_method(klass, node->nd_mid, defn,
NOEX_PUBLIC|(body?body->nd_noex&NOEX_UNDEF:0));
result = Qnil;
@@ -4126,7 +4138,7 @@ rb_eval(self, n)
case NODE_DEFINED:
{
char buf[20];
- char *desc = is_defined(self, node->nd_head, buf);
+ const char *desc = is_defined(self, node->nd_head, buf);
if (desc) result = rb_str_new2(desc);
else result = Qnil;
@@ -4223,7 +4235,7 @@ rb_obj_respond_to(obj, id, priv)
int n = 0;
args[n++] = ID2SYM(id);
if (priv) args[n++] = Qtrue;
- return rb_funcall2(obj, respond_to, n, args);
+ return RTEST(rb_funcall2(obj, respond_to, n, args));
}
}
@@ -4561,8 +4573,9 @@ rb_longjmp(tag, mesg)
VALUE mesg;
{
VALUE at;
+ rb_thread_t th = curr_thread;
- if (thread_set_raised()) {
+ if (rb_thread_set_raised(th)) {
ruby_errinfo = exception_error;
JUMP_TAG(TAG_FATAL);
}
@@ -4576,6 +4589,9 @@ rb_longjmp(tag, mesg)
at = get_backtrace(mesg);
if (NIL_P(at)) {
at = make_backtrace();
+ if (OBJ_FROZEN(mesg)) {
+ mesg = rb_obj_dup(mesg);
+ }
set_backtrace(mesg, at);
}
}
@@ -4601,7 +4617,7 @@ rb_longjmp(tag, mesg)
ruby_errinfo = mesg;
}
else if (status) {
- thread_reset_raised();
+ rb_thread_reset_raised(th);
JUMP_TAG(status);
}
}
@@ -4616,11 +4632,20 @@ rb_longjmp(tag, mesg)
if (!prot_tag) {
error_print();
}
- thread_reset_raised();
+ rb_thread_raised_clear(th);
JUMP_TAG(tag);
}
void
+rb_exc_jump(mesg)
+ VALUE mesg;
+{
+ rb_thread_raised_clear(rb_curr_thread);
+ ruby_errinfo = mesg;
+ JUMP_TAG(TAG_RAISE);
+}
+
+void
rb_exc_raise(mesg)
VALUE mesg;
{
@@ -4637,7 +4662,8 @@ rb_exc_fatal(mesg)
void
rb_interrupt()
{
- rb_raise(rb_eInterrupt, "");
+ static const char fmt[1] = {'\0'};
+ rb_raise(rb_eInterrupt, fmt);
}
/*
@@ -4793,7 +4819,7 @@ proc_jump_error(state, result)
VALUE result;
{
char mesg[32];
- char *statement;
+ const char *statement;
switch (state) {
case TAG_BREAK:
@@ -4907,7 +4933,7 @@ rb_yield_0(val, self, klass, flags, avalue)
VALUE val, self, klass; /* OK */
int flags, avalue;
{
- NODE *node;
+ NODE *node, *var;
volatile VALUE result = Qnil;
volatile VALUE old_cref;
volatile VALUE old_wrapper;
@@ -4949,27 +4975,35 @@ rb_yield_0(val, self, klass, flags, avalue)
self = block->self;
}
node = block->body;
+ var = block->var;
- if (block->var) {
+ if (var) {
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
- if (block->var == (NODE*)1) { /* no parameter || */
+ NODE *bvar = NULL;
+ block_var:
+ if (var == (NODE*)1) { /* no parameter || */
if (lambda && RARRAY(val)->len != 0) {
rb_raise(rb_eArgError, "wrong number of arguments (%ld for 0)",
RARRAY(val)->len);
}
}
- else if (block->var == (NODE*)2) {
+ else if (var == (NODE*)2) {
if (TYPE(val) == T_ARRAY && RARRAY(val)->len != 0) {
rb_raise(rb_eArgError, "wrong number of arguments (%ld for 0)",
RARRAY(val)->len);
}
}
- else if (nd_type(block->var) == NODE_MASGN) {
+ else if (!bvar && nd_type(var) == NODE_BLOCK_PASS) {
+ bvar = var->nd_body;
+ var = var->nd_args;
+ goto block_var;
+ }
+ else if (nd_type(var) == NODE_MASGN) {
if (!avalue) {
- val = svalue_to_mrhs(val, block->var->nd_head);
+ val = svalue_to_mrhs(val, var->nd_head);
}
- massign(self, block->var, val, lambda);
+ massign(self, var, val, lambda);
}
else {
int len = 0;
@@ -4990,13 +5024,21 @@ rb_yield_0(val, self, klass, flags, avalue)
val = Qnil;
multi_values:
{
- ruby_current_node = block->var;
+ ruby_current_node = var;
rb_warn("multiple values for a block parameter (%d for 1)\n\tfrom %s:%d",
len, cnode->nd_file, nd_line(cnode));
ruby_current_node = cnode;
}
}
- assign(self, block->var, val, lambda);
+ assign(self, var, val, lambda);
+ }
+ if (bvar) {
+ VALUE blk;
+ if (flags & YIELD_PROC_CALL)
+ blk = block->block_obj;
+ else
+ blk = rb_block_proc();
+ assign(self, bvar, blk, 0);
}
}
POP_TAG();
@@ -5013,12 +5055,18 @@ rb_yield_0(val, self, klass, flags, avalue)
if ((state = EXEC_TAG()) == 0) {
redo:
if (nd_type(node) == NODE_CFUNC || nd_type(node) == NODE_IFUNC) {
- if (node->nd_state == YIELD_FUNC_AVALUE) {
+ switch (node->nd_state) {
+ case YIELD_FUNC_LAMBDA:
+ if (!avalue) {
+ val = rb_ary_new3(1, val);
+ }
+ break;
+ case YIELD_FUNC_AVALUE:
if (!avalue) {
val = svalue_to_avalue(val);
}
- }
- else {
+ break;
+ default:
if (avalue) {
val = avalue_to_svalue(val);
}
@@ -5156,6 +5204,16 @@ rb_yield_splat(values)
return rb_yield_0(values, 0, 0, 0, avalue);
}
+static VALUE
+loop_i()
+{
+ for (;;) {
+ rb_yield_0(Qundef, 0, 0, 0, Qfalse);
+ CHECK_INTS;
+ }
+ return Qnil;
+}
+
/*
* call-seq:
* loop {|| block }
@@ -5168,15 +5226,14 @@ rb_yield_splat(values)
* break if !line or line =~ /^qQ/
* # ...
* end
+ *
+ * StopIteration raised in the block breaks the loop.
*/
static VALUE
rb_f_loop()
{
- for (;;) {
- rb_yield_0(Qundef, 0, 0, 0, Qfalse);
- CHECK_INTS;
- }
+ rb_rescue2(loop_i, (VALUE)0, 0, 0, rb_eStopIteration, (VALUE)0);
return Qnil; /* dummy */
}
@@ -5421,7 +5478,7 @@ rb_rescue2(b_proc, data1, r_proc, data2, va_alist)
if (handle) break;
handle = Qfalse;
va_init_list(args, data2);
- while (eclass = va_arg(args, VALUE)) {
+ while ((eclass = va_arg(args, VALUE)) != 0) {
if (rb_obj_is_kind_of(ruby_errinfo, eclass)) {
handle = Qtrue;
break;
@@ -5500,7 +5557,7 @@ rb_ensure(b_proc, data1, e_proc, data2)
POP_TAG();
retval = prot_tag ? prot_tag->retval : Qnil; /* save retval */
if (!thread_no_ensure()) {
- (*e_proc)(data2);
+ (*e_proc)(data2);
}
if (prot_tag) return_value(retval);
if (state) JUMP_TAG(state);
@@ -5536,18 +5593,11 @@ rb_with_disable_interrupt(proc, data)
static void
stack_check()
{
- static int overflowing = 0;
+ rb_thread_t th = rb_curr_thread;
- if (!overflowing && ruby_stack_check()) {
- int state;
- overflowing = 1;
- PUSH_TAG(PROT_NONE);
- if ((state = EXEC_TAG()) == 0) {
- rb_exc_raise(sysstack_error);
- }
- POP_TAG();
- overflowing = 0;
- JUMP_TAG(state);
+ if (!rb_thread_raised_p(th, RAISED_STACKOVERFLOW) && ruby_stack_check()) {
+ rb_thread_raised_set(th, RAISED_STACKOVERFLOW);
+ rb_exc_raise(sysstack_error);
}
}
@@ -5596,7 +5646,7 @@ rb_method_missing(argc, argv, obj)
{
ID id;
VALUE exc = rb_eNoMethodError;
- char *format = 0;
+ const char *format = 0;
NODE *cnode = ruby_current_node;
if (argc == 0 || !SYMBOL_P(argv[0])) {
@@ -5786,8 +5836,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
TMP_PROTECT;
volatile int safe = -1;
- if (NOEX_SAFE(flags) > ruby_safe_level &&
- ruby_safe_level == 0 && NOEX_SAFE(flags) > 2) {
+ if (NOEX_SAFE(flags) > ruby_safe_level && NOEX_SAFE(flags) > 2) {
rb_raise(rb_eSecurityError, "calling insecure method: %s",
rb_id2name(id));
}
@@ -5890,7 +5939,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
}
result = proc_invoke(body->nd_cval, rb_ary_new4(argc, argv), recv, klass);
if (event_hooks) {
- EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, body, recv, id, klass);
+ EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, ruby_current_node, recv, id, klass);
}
break;
@@ -6013,7 +6062,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
}
POP_TAG();
if (event_hooks) {
- EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, body, recv, id, klass);
+ EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, ruby_current_node, recv, id, klass);
}
POP_VARS();
POP_CLASS();
@@ -6397,10 +6446,16 @@ rb_frame_last_func()
return ruby_frame->last_func;
}
+ID
+rb_frame_this_func()
+{
+ return ruby_frame->orig_func;
+}
+
static NODE*
compile(src, file, line)
VALUE src;
- char *file;
+ const char *file;
int line;
{
NODE *node;
@@ -6420,7 +6475,7 @@ compile(src, file, line)
static VALUE
eval(self, src, scope, file, line)
VALUE self, src, scope;
- char *file;
+ const char *file;
int line;
{
struct BLOCK *data = NULL;
@@ -6539,12 +6594,12 @@ eval(self, src, scope, file, line)
errat = get_backtrace(ruby_errinfo);
mesg = rb_attr_get(ruby_errinfo, rb_intern("mesg"));
if (!NIL_P(errat) && TYPE(errat) == T_ARRAY &&
- (bt2 = backtrace(-2), RARRAY(bt2)->len > 0)) {
+ (bt2 = backtrace(-2), RARRAY_LEN(bt2) > 0)) {
if (!NIL_P(mesg) && TYPE(mesg) == T_STRING) {
rb_str_update(mesg, 0, 0, rb_str_new2(": "));
- rb_str_update(mesg, 0, 0, RARRAY(errat)->ptr[0]);
+ rb_str_update(mesg, 0, 0, RARRAY_PTR(errat)[0]);
}
- RARRAY(errat)->ptr[0] = RARRAY(bt2)->ptr[0];
+ RARRAY_PTR(errat)[0] = RARRAY_PTR(bt2)[0];
}
}
rb_exc_raise(ruby_errinfo);
@@ -6581,7 +6636,7 @@ rb_f_eval(argc, argv, self)
VALUE self;
{
VALUE src, scope, vfile, vline;
- char *file = "(eval)";
+ const char *file = "(eval)";
int line = 1;
rb_scan_args(argc, argv, "13", &src, &scope, &vfile, &vline);
@@ -6698,12 +6753,28 @@ yield_under_i(self)
return rb_yield_0(self, self, ruby_class, YIELD_PUBLIC_DEF, Qfalse);
}
+static VALUE
+yield_args_under_i(vinfo)
+ VALUE vinfo;
+{
+ VALUE *info = (VALUE *)vinfo;
+
+ return rb_yield_0(info[0], info[1], ruby_class, YIELD_PUBLIC_DEF, Qtrue);
+}
+
/* block eval under the class/module context */
static VALUE
-yield_under(under, self)
- VALUE under, self;
+yield_under(under, self, args)
+ VALUE under, self, args;
{
- return exec_under(yield_under_i, under, 0, self);
+ if (args == Qundef) {
+ return exec_under(yield_under_i, under, 0, self);
+ }
+ else {
+ VALUE info[2] = { args, self };
+
+ return exec_under(yield_args_under_i, under, 0, (VALUE)info);
+ }
}
static VALUE
@@ -6716,10 +6787,10 @@ specific_eval(argc, argv, klass, self)
if (argc > 0) {
rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
}
- return yield_under(klass, self);
+ return yield_under(klass, self, Qundef);
}
else {
- char *file = "(eval)";
+ const char *file = "(eval)";
int line = 1;
if (argc == 0) {
@@ -6788,6 +6859,41 @@ rb_obj_instance_eval(argc, argv, self)
/*
* call-seq:
+ * obj.instance_exec(arg...) {|var...| block } => obj
+ *
+ * Executes the given block within the context of the receiver
+ * (_obj_). In order to set the context, the variable +self+ is set
+ * to _obj_ while the code is executing, giving the code access to
+ * _obj_'s instance variables. Arguments are passed as block parameters.
+ *
+ * class KlassWithSecret
+ * def initialize
+ * @secret = 99
+ * end
+ * end
+ * k = KlassWithSecret.new
+ * k.instance_exec(5) {|x| @secret+x } #=> 104
+ */
+
+VALUE
+rb_obj_instance_exec(argc, argv, self)
+ int argc;
+ VALUE *argv;
+ VALUE self;
+{
+ VALUE klass;
+
+ if (SPECIAL_CONST_P(self)) {
+ klass = Qnil;
+ }
+ else {
+ klass = rb_singleton_class(self);
+ }
+ return yield_under(klass, self, rb_ary_new4(argc, argv));
+}
+
+/*
+ * call-seq:
* mod.class_eval(string [, filename [, lineno]]) => obj
* mod.module_eval {|| block } => obj
*
@@ -6819,6 +6925,35 @@ rb_mod_module_eval(argc, argv, mod)
return specific_eval(argc, argv, mod, mod);
}
+/*
+ * call-seq:
+ * mod.module_exec(arg...) {|var...| block } => obj
+ * mod.class_exec(arg...) {|var...| block } => obj
+ *
+ * Evaluates the given block in the context of the class/module.
+ * The method defined in the block will belong to the receiver.
+ *
+ * class Thing
+ * end
+ * Thing.class_exec{
+ * def hello() "Hello there!" end
+ * }
+ * puts Thing.new.hello()
+ *
+ * <em>produces:</em>
+ *
+ * Hello there!
+ */
+
+VALUE
+rb_mod_module_exec(argc, argv, mod)
+ int argc;
+ VALUE *argv;
+ VALUE mod;
+{
+ return yield_under(mod, mod, rb_ary_new4(argc, argv));
+}
+
VALUE rb_load_path;
NORETURN(static void load_failed _((VALUE)));
@@ -7180,7 +7315,7 @@ search_required(fname, featurep, path)
#else
rb_str_cat2(tmp, DLEXT);
OBJ_FREEZE(tmp);
- if (*path = rb_find_file(tmp)) {
+ if ((*path = rb_find_file(tmp)) != 0) {
return 's';
}
#endif
@@ -7980,6 +8115,37 @@ rb_exec_end_proc()
ruby_safe_level = safe;
}
+/*
+ * call-seq:
+ * __method__ => symbol
+ *
+ * Returns the name of the current method as a Symbol.
+ * If called from inside of an aliased method it will return the original
+ * nonaliased name.
+ * If called outside of a method, it returns <code>nil</code>.
+ *
+ * def foo
+ * __method__
+ * end
+ * alias bar foo
+ *
+ * foo # => :foo
+ * bar # => :foo
+ *
+ */
+
+static VALUE
+rb_f_method_name()
+{
+ struct FRAME* prev = ruby_frame->prev;
+ if (prev && prev->orig_func) {
+ return ID2SYM(prev->orig_func);
+ }
+ else {
+ return Qnil;
+ }
+}
+
void
Init_eval()
{
@@ -8001,11 +8167,11 @@ Init_eval()
__id__ = rb_intern("__id__");
__send__ = rb_intern("__send__");
- rb_global_variable((VALUE*)&top_scope);
- rb_global_variable((VALUE*)&ruby_eval_tree_begin);
+ rb_global_variable((void *)&top_scope);
+ rb_global_variable((void *)&ruby_eval_tree_begin);
- rb_global_variable((VALUE*)&ruby_eval_tree);
- rb_global_variable((VALUE*)&ruby_dyna_vars);
+ rb_global_variable((void *)&ruby_eval_tree);
+ rb_global_variable((void *)&ruby_dyna_vars);
rb_define_virtual_variable("$@", errat_getter, errat_setter);
rb_define_hooked_variable("$!", &ruby_errinfo, 0, errinfo_setter);
@@ -8018,7 +8184,7 @@ Init_eval()
rb_define_method(rb_mKernel, "respond_to?", obj_respond_to, -1);
respond_to = rb_intern("respond_to?");
- rb_global_variable((VALUE*)&basic_respond_to);
+ rb_global_variable((void *)&basic_respond_to);
basic_respond_to = rb_method_node(rb_cObject, respond_to);
rb_define_global_function("raise", rb_f_raise, -1);
@@ -8036,9 +8202,12 @@ Init_eval()
rb_define_global_function("global_variables", rb_f_global_variables, 0); /* in variable.c */
rb_define_global_function("local_variables", rb_f_local_variables, 0);
+ rb_define_global_function("__method__", rb_f_method_name, 0);
+
rb_define_method(rb_mKernel, "send", rb_f_send, -1);
rb_define_method(rb_mKernel, "__send__", rb_f_send, -1);
rb_define_method(rb_mKernel, "instance_eval", rb_obj_instance_eval, -1);
+ rb_define_method(rb_mKernel, "instance_exec", rb_obj_instance_exec, -1);
rb_define_private_method(rb_cModule, "append_features", rb_mod_append_features, 1);
rb_define_private_method(rb_cModule, "extend_object", rb_mod_extend_object, 1);
@@ -8054,7 +8223,9 @@ Init_eval()
rb_define_method(rb_cModule, "public_class_method", rb_mod_public_method, -1);
rb_define_method(rb_cModule, "private_class_method", rb_mod_private_method, -1);
rb_define_method(rb_cModule, "module_eval", rb_mod_module_eval, -1);
+ rb_define_method(rb_cModule, "module_exec", rb_mod_module_exec, -1);
rb_define_method(rb_cModule, "class_eval", rb_mod_module_eval, -1);
+ rb_define_method(rb_cModule, "class_exec", rb_mod_module_exec, -1);
rb_undef_method(rb_cClass, "module_function");
@@ -8343,20 +8514,42 @@ proc_clone(self)
* MISSING: documentation
*/
+#define PROC_TSHIFT (FL_USHIFT+1)
+#define PROC_TMASK (FL_USER1|FL_USER2|FL_USER3)
+#define PROC_TMAX (PROC_TMASK >> PROC_TSHIFT)
+
+static int proc_get_safe_level(VALUE);
+
static VALUE
proc_dup(self)
VALUE self;
{
struct BLOCK *orig, *data;
VALUE bind;
+ int safe = proc_get_safe_level(self);
Data_Get_Struct(self, struct BLOCK, orig);
bind = Data_Make_Struct(rb_obj_class(self),struct BLOCK,blk_mark,blk_free,data);
blk_dup(data, orig);
+ if (safe > PROC_TMAX) safe = PROC_TMAX;
+ FL_SET(bind, (safe << PROC_TSHIFT) & PROC_TMASK);
return bind;
}
+VALUE
+rb_block_dup(self, klass, cref)
+ VALUE self, klass, cref;
+{
+ struct BLOCK *block;
+ VALUE obj = proc_dup(self);
+ Data_Get_Struct(obj, struct BLOCK, block);
+ block->klass = klass;
+ block->cref = NEW_NODE(nd_type(block->cref), cref, block->cref->u2.node,
+ block->cref->u3.node);
+ return obj;
+}
+
/*
* call-seq:
* binding -> a_binding
@@ -8414,9 +8607,34 @@ rb_f_binding(self)
return bind;
}
-#define PROC_TSHIFT (FL_USHIFT+1)
-#define PROC_TMASK (FL_USER1|FL_USER2|FL_USER3)
-#define PROC_TMAX (PROC_TMASK >> PROC_TSHIFT)
+/*
+ * call-seq:
+ * binding.eval(string [, filename [,lineno]]) => obj
+ *
+ * Evaluates the Ruby expression(s) in <em>string</em>, in the
+ * <em>binding</em>'s context. If the optional <em>filename</em> and
+ * <em>lineno</em> parameters are present, they will be used when
+ * reporting syntax errors.
+ *
+ * def getBinding(param)
+ * return binding
+ * end
+ * b = getBinding("hello")
+ * b.eval("param") #=> "hello"
+ */
+
+static VALUE
+bind_eval(argc, argv, bindval)
+ int argc;
+ VALUE *argv;
+ VALUE bindval;
+{
+ VALUE args[4];
+
+ rb_scan_args(argc, argv, "12", &args[0], &args[2], &args[3]);
+ args[1] = bindval;
+ return rb_f_eval(argc+1, args, Qnil /* self will be searched in eval */);
+}
#define SAFE_LEVEL_MAX PROC_TMASK
@@ -8579,13 +8797,12 @@ proc_invoke(proc, args, self, klass)
volatile VALUE old_wrapper = ruby_wrapper;
volatile int pcall, avalue = Qtrue;
volatile VALUE tmp = args;
+ VALUE bvar = Qnil;
if (rb_block_given_p() && ruby_frame->last_func) {
if (klass != ruby_frame->last_class)
klass = rb_obj_class(proc);
- rb_warning("block for %s#%s is useless",
- rb_class2name(klass),
- rb_id2name(ruby_frame->last_func));
+ bvar = rb_block_proc();
}
Data_Get_Struct(proc, struct BLOCK, data);
@@ -8601,6 +8818,7 @@ proc_invoke(proc, args, self, klass)
/* PUSH BLOCK from data */
old_block = ruby_block;
_block = *data;
+ _block.block_obj = bvar;
if (self != Qundef) _block.frame.self = self;
if (klass) _block.frame.last_class = klass;
_block.frame.argc = RARRAY(tmp)->len;
@@ -8621,7 +8839,8 @@ proc_invoke(proc, args, self, klass)
state = EXEC_TAG();
if (state == 0) {
proc_set_safe_level(proc);
- result = rb_yield_0(args, self, (self!=Qundef)?CLASS_OF(self):0, pcall, avalue);
+ result = rb_yield_0(args, self, (self!=Qundef)?CLASS_OF(self):0,
+ pcall | YIELD_PROC_CALL, avalue);
}
else if (TAG_DST()) {
result = prot_tag->retval;
@@ -8690,8 +8909,8 @@ proc_invoke(proc, args, self, klass)
* from prog.rb:5
*/
-static VALUE
-proc_call(proc, args)
+VALUE
+rb_proc_call(proc, args)
VALUE proc, args; /* OK */
{
return proc_invoke(proc, args, Qundef, 0);
@@ -8725,30 +8944,36 @@ proc_arity(proc)
VALUE proc;
{
struct BLOCK *data;
- NODE *list;
+ NODE *var, *list;
int n;
Data_Get_Struct(proc, struct BLOCK, data);
- if (data->var == 0) {
+ var = data->var;
+ if (var == 0) {
if (data->body && nd_type(data->body) == NODE_IFUNC &&
data->body->nd_cfnc == bmcall) {
return method_arity(data->body->nd_tval);
}
return INT2FIX(-1);
}
- if (data->var == (NODE*)1) return INT2FIX(0);
- if (data->var == (NODE*)2) return INT2FIX(0);
- switch (nd_type(data->var)) {
+ if (var == (NODE*)1) return INT2FIX(0);
+ if (var == (NODE*)2) return INT2FIX(0);
+ if (nd_type(var) == NODE_BLOCK_ARG) {
+ var = var->nd_args;
+ if (var == (NODE*)1) return INT2FIX(0);
+ if (var == (NODE*)2) return INT2FIX(0);
+ }
+ switch (nd_type(var)) {
default:
return INT2FIX(1);
case NODE_MASGN:
- list = data->var->nd_head;
+ list = var->nd_head;
n = 0;
while (list) {
n++;
list = list->nd_next;
}
- if (data->var->nd_args) return INT2FIX(-n-1);
+ if (var->nd_args) return INT2FIX(-n-1);
return INT2FIX(n);
}
}
@@ -8796,7 +9021,7 @@ proc_to_s(self)
{
struct BLOCK *data;
NODE *node;
- char *cname = rb_obj_classname(self);
+ const char *cname = rb_obj_classname(self);
const int w = (sizeof(VALUE) * CHAR_BIT) / 4;
long len = strlen(cname)+6+w; /* 6:tags 16:addr */
VALUE str;
@@ -9010,6 +9235,7 @@ mnew(klass, obj, id, mklass)
(FL_TEST(rklass, FL_SINGLETON) || TYPE(rklass) == T_ICLASS)) {
rklass = RCLASS(rklass)->super;
}
+ if (TYPE(klass) == T_ICLASS) klass = RBASIC(klass)->klass;
method = Data_Make_Struct(mklass, struct METHOD, bm_mark, free, data);
data->klass = klass;
data->recv = obj;
@@ -9109,6 +9335,57 @@ method_unbind(obj)
/*
* call-seq:
+ * meth.receiver => object
+ *
+ * Returns the bound receiver of the method object.
+ */
+
+static VALUE
+method_receiver(obj)
+ VALUE obj;
+{
+ struct METHOD *data;
+
+ Data_Get_Struct(obj, struct METHOD, data);
+ return data->recv;
+}
+
+/*
+ * call-seq:
+ * meth.name => string
+ *
+ * Returns the name of the method.
+ */
+
+static VALUE
+method_name(obj)
+ VALUE obj;
+{
+ struct METHOD *data;
+
+ Data_Get_Struct(obj, struct METHOD, data);
+ return rb_str_new2(rb_id2name(data->oid));
+}
+
+/*
+ * call-seq:
+ * meth.owner => class_or_module
+ *
+ * Returns the class or module that defines the method.
+ */
+
+static VALUE
+method_owner(obj)
+ VALUE obj;
+{
+ struct METHOD *data;
+
+ Data_Get_Struct(obj, struct METHOD, data);
+ return data->klass;
+}
+
+/*
+ * call-seq:
* obj.method(sym) => method
*
* Looks up the named method as a receiver in <i>obj</i>, returning a
@@ -9135,7 +9412,7 @@ method_unbind(obj)
* m.call #=> "Hello, @iv = Fred"
*/
-static VALUE
+VALUE
rb_obj_method(obj, vid)
VALUE obj;
VALUE vid;
@@ -9202,6 +9479,29 @@ method_clone(self)
return clone;
}
+VALUE
+rb_method_dup(self, klass, cref)
+ VALUE self;
+ VALUE klass;
+ VALUE cref;
+{
+ VALUE clone;
+ struct METHOD *orig, *data;
+
+ Data_Get_Struct(self, struct METHOD, orig);
+ clone = Data_Make_Struct(CLASS_OF(self),struct METHOD, bm_mark, free, data);
+ *data = *orig;
+ data->rklass = klass;
+ if (data->body->nd_rval) {
+ NODE *tmp = NEW_NODE(nd_type(data->body->u2.node), cref,
+ data->body->u2.node->u2.node,
+ data->body->u2.node->u3.node);
+ data->body = NEW_NODE(nd_type(data->body), data->body->u1.node, tmp,
+ data->body->u3.node);
+ }
+ return clone;
+}
+
/*
* call-seq:
* meth.call(args, ...) => obj
@@ -9455,7 +9755,7 @@ method_inspect(method)
struct METHOD *data;
VALUE str;
const char *s;
- char *sharp = "#";
+ const char *sharp = "#";
Data_Get_Struct(method, struct METHOD, data);
str = rb_str_buf_new2("#<");
@@ -9484,12 +9784,8 @@ method_inspect(method)
else {
rb_str_buf_cat2(str, rb_class2name(data->rklass));
if (data->rklass != data->klass) {
- VALUE klass = data -> klass;
- if (TYPE(klass) == T_ICLASS) {
- klass = RBASIC(klass)->klass;
- }
rb_str_buf_cat2(str, "(");
- rb_str_buf_cat2(str, rb_class2name(klass));
+ rb_str_buf_cat2(str, rb_class2name(data->klass));
rb_str_buf_cat2(str, ")");
}
}
@@ -9538,7 +9834,8 @@ rb_proc_new(func, val)
VALUE proc = rb_iterate((VALUE(*)_((VALUE)))mproc, 0, func, val);
Data_Get_Struct(proc, struct BLOCK, data);
- data->body->nd_state = YIELD_FUNC_AVALUE;
+ data->body->nd_state = YIELD_FUNC_LAMBDA;
+ data->flags |= BLOCK_LAMBDA;
return proc;
}
@@ -9697,12 +9994,17 @@ Init_Proc()
rb_define_method(rb_eLocalJumpError, "reason", localjump_reason, 0);
rb_global_variable(&exception_error);
- exception_error = rb_exc_new2(rb_eFatal, "exception reentered");
+ exception_error = rb_exc_new3(rb_eFatal,
+ rb_obj_freeze(rb_str_new2("exception reentered")));
+ OBJ_TAINT(exception_error);
+ OBJ_FREEZE(exception_error);
rb_eSysStackError = rb_define_class("SystemStackError", rb_eStandardError);
rb_global_variable(&sysstack_error);
- sysstack_error = rb_exc_new2(rb_eSysStackError, "stack level too deep");
+ sysstack_error = rb_exc_new3(rb_eSysStackError,
+ rb_obj_freeze(rb_str_new2("stack level too deep")));
OBJ_TAINT(sysstack_error);
+ OBJ_FREEZE(sysstack_error);
rb_cProc = rb_define_class("Proc", rb_cObject);
rb_undef_alloc_func(rb_cProc);
@@ -9710,9 +10012,9 @@ Init_Proc()
rb_define_method(rb_cProc, "clone", proc_clone, 0);
rb_define_method(rb_cProc, "dup", proc_dup, 0);
- rb_define_method(rb_cProc, "call", proc_call, -2);
+ rb_define_method(rb_cProc, "call", rb_proc_call, -2);
rb_define_method(rb_cProc, "arity", proc_arity, 0);
- rb_define_method(rb_cProc, "[]", proc_call, -2);
+ rb_define_method(rb_cProc, "[]", rb_proc_call, -2);
rb_define_method(rb_cProc, "==", proc_eq, 1);
rb_define_method(rb_cProc, "to_s", proc_to_s, 0);
rb_define_method(rb_cProc, "to_proc", proc_to_self, 0);
@@ -9732,6 +10034,9 @@ Init_Proc()
rb_define_method(rb_cMethod, "inspect", method_inspect, 0);
rb_define_method(rb_cMethod, "to_s", method_inspect, 0);
rb_define_method(rb_cMethod, "to_proc", method_proc, 0);
+ rb_define_method(rb_cMethod, "receiver", method_receiver, 0);
+ rb_define_method(rb_cMethod, "name", method_name, 0);
+ rb_define_method(rb_cMethod, "owner", method_owner, 0);
rb_define_method(rb_cMethod, "unbind", method_unbind, 0);
rb_define_method(rb_mKernel, "method", rb_obj_method, 1);
@@ -9743,6 +10048,8 @@ Init_Proc()
rb_define_method(rb_cUnboundMethod, "arity", method_arity, 0);
rb_define_method(rb_cUnboundMethod, "inspect", method_inspect, 0);
rb_define_method(rb_cUnboundMethod, "to_s", method_inspect, 0);
+ rb_define_method(rb_cUnboundMethod, "name", method_name, 0);
+ rb_define_method(rb_cUnboundMethod, "owner", method_owner, 0);
rb_define_method(rb_cUnboundMethod, "bind", umethod_bind, 1);
rb_define_method(rb_cModule, "instance_method", rb_mod_method, 1);
}
@@ -9790,6 +10097,7 @@ Init_Binding()
rb_undef_method(CLASS_OF(rb_cBinding), "new");
rb_define_method(rb_cBinding, "clone", proc_clone, 0);
rb_define_method(rb_cBinding, "dup", proc_dup, 0);
+ rb_define_method(rb_cBinding, "eval", bind_eval, -1);
rb_define_global_function("binding", rb_f_binding, 0);
}
@@ -9874,10 +10182,9 @@ extern VALUE rb_last_status;
# endif
#endif
-#define THREAD_RAISED 0x200 /* temporary flag */
#define THREAD_TERMINATING 0x400 /* persistent flag */
-#define THREAD_NO_ENSURE 0x800 /* persistent flag */
-#define THREAD_FLAGS_MASK 0xc00 /* mask for persistent flags */
+#define THREAD_NO_ENSURE 0x800 /* persistent flag */
+#define THREAD_FLAGS_MASK 0xfc00 /* mask for persistent flags */
#define FOREACH_THREAD_FROM(f,x) x = f; do { x = x->next;
#define END_FOREACH_FROM(f,x) } while (x != f)
@@ -9929,19 +10236,25 @@ struct thread_status_t {
(dst)->join = (src)->join, \
0)
-static int
-thread_set_raised()
+int
+rb_thread_set_raised(th)
+ rb_thread_t th;
{
- if (curr_thread->flags & THREAD_RAISED) return 1;
- curr_thread->flags |= THREAD_RAISED;
+ if (th->flags & RAISED_EXCEPTION) {
+ return 1;
+ }
+ th->flags |= RAISED_EXCEPTION;
return 0;
}
-static int
-thread_reset_raised()
+int
+rb_thread_reset_raised(th)
+ rb_thread_t th;
{
- if (!(curr_thread->flags & THREAD_RAISED)) return 0;
- curr_thread->flags &= ~THREAD_RAISED;
+ if (!(th->flags & RAISED_EXCEPTION)) {
+ return 0;
+ }
+ th->flags &= ~RAISED_EXCEPTION;
return 1;
}
@@ -10052,6 +10365,13 @@ static double
timeofday()
{
struct timeval tv;
+#ifdef CLOCK_MONOTONIC
+ struct timespec tp;
+
+ if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0) {
+ return (double)tp.tv_sec + (double)tp.tv_nsec * 1e-9;
+ }
+#endif
gettimeofday(&tv, NULL);
return (double)tv.tv_sec + (double)tv.tv_usec * 1e-6;
}
@@ -10332,7 +10652,7 @@ rb_thread_switch(n)
}
#define THREAD_SAVE_CONTEXT(th) \
- (rb_thread_switch((FLUSH_REGISTER_WINDOWS, ruby_setjmp(rb_thread_save_context(th), (th)->context))))
+ (rb_thread_switch(ruby_setjmp(rb_thread_save_context(th), (th)->context)))
NORETURN(static void rb_thread_restore_context _((rb_thread_t,int)));
NORETURN(NOINLINE(static void rb_thread_restore_context_0(rb_thread_t,int,void*)));
@@ -10637,6 +10957,7 @@ rb_thread_schedule()
}
#endif
rb_thread_pending = 0;
+ rb_gc_finalize_deferred();
if (curr_thread == curr_thread->next
&& curr_thread->status == THREAD_RUNNABLE)
return;
@@ -11079,7 +11400,7 @@ rb_thread_join(th, limit)
if (!rb_thread_dead(th)) return Qfalse;
}
- if (!NIL_P(th->errinfo) && (th->flags & THREAD_RAISED)) {
+ if (!NIL_P(th->errinfo) && (th->flags & RAISED_EXCEPTION)) {
VALUE oldbt = get_backtrace(th->errinfo);
VALUE errat = make_backtrace();
VALUE errinfo = rb_obj_dup(th->errinfo);
@@ -11686,15 +12007,6 @@ rb_thread_abort_exc_set(thread, val)
}
-enum rb_thread_status
-rb_thread_status(thread)
- VALUE thread;
-{
- rb_thread_t th = rb_thread_check(thread);
- return th->status;
-}
-
-
/*
* call-seq:
* thr.group => thgrp or nil
@@ -11788,7 +12100,7 @@ rb_thread_alloc(klass)
return th;
}
-static int thread_init = 0;
+static int thread_init;
#if defined(_THREAD_SAFE)
static void
@@ -11801,19 +12113,12 @@ catch_timer(sig)
/* cause EINTR */
}
-static int time_thread_alive_p = 0;
static pthread_t time_thread;
static void*
thread_timer(dummy)
void *dummy;
{
-#ifdef _THREAD_SAFE
-#define test_cancel() pthread_testcancel()
-#else
-#define test_cancel() /* void */
-#endif
-
sigset_t all_signals;
sigfillset(&all_signals);
@@ -11823,14 +12128,11 @@ thread_timer(dummy)
#ifdef HAVE_NANOSLEEP
struct timespec req, rem;
- test_cancel();
req.tv_sec = 0;
req.tv_nsec = 10000000;
nanosleep(&req, &rem);
#else
struct timeval tv;
-
- test_cancel();
tv.tv_sec = 0;
tv.tv_usec = 10000;
select(0, NULL, NULL, NULL, &tv);
@@ -11842,7 +12144,6 @@ thread_timer(dummy)
}
}
}
-#undef test_cancel
}
void
@@ -11854,26 +12155,6 @@ void
rb_thread_stop_timer()
{
}
-
-void
-rb_child_atfork()
-{
- time_thread_alive_p = 0;
-}
-
-void
-rb_thread_cancel_timer()
-{
-#ifdef _THREAD_SAFE
- if( time_thread_alive_p )
- {
- pthread_cancel( time_thread );
- pthread_join( time_thread, NULL );
- time_thread_alive_p = 0;
- }
- thread_init = 0;
-#endif
-}
#elif defined(HAVE_SETITIMER)
static void
catch_timer(sig)
@@ -11911,19 +12192,8 @@ rb_thread_stop_timer()
tval.it_value = tval.it_interval;
setitimer(ITIMER_VIRTUAL, &tval, NULL);
}
-
-void
-rb_thread_cancel_timer()
-{
-}
-
#else /* !(_THREAD_SAFE || HAVE_SETITIMER) */
int rb_thread_tick = THREAD_TICK;
-
-void
-rb_thread_cancel_timer()
-{
-}
#endif
static VALUE
@@ -11954,8 +12224,6 @@ rb_thread_start_0(fn, arg, th)
#ifdef _THREAD_SAFE
pthread_create(&time_thread, 0, thread_timer, 0);
- time_thread_alive_p = 1;
- pthread_atfork(0, 0, rb_child_atfork);
#else
rb_thread_start_timer();
#endif
@@ -12008,7 +12276,7 @@ rb_thread_start_0(fn, arg, th)
}
if (state && status != THREAD_TO_KILL && !NIL_P(ruby_errinfo)) {
- th->flags |= THREAD_RAISED;
+ th->flags |= RAISED_EXCEPTION;
if (state == TAG_FATAL) {
/* fatal error within this thread, need to stop whole script */
main_thread->errinfo = ruby_errinfo;
@@ -12045,7 +12313,7 @@ rb_thread_create(fn, arg)
VALUE (*fn)();
void *arg;
{
- Init_stack((VALUE*)&arg);
+ Init_stack((void *)&arg);
return rb_thread_start_0(fn, arg, rb_thread_alloc(rb_cThread));
}
@@ -12220,13 +12488,13 @@ rb_thread_value(thread)
*/
static VALUE
-rb_thread_status_name(thread)
+rb_thread_status(thread)
VALUE thread;
{
rb_thread_t th = rb_thread_check(thread);
if (rb_thread_dead(th)) {
- if (!NIL_P(th->errinfo) && (th->flags & THREAD_RAISED))
+ if (!NIL_P(th->errinfo) && (th->flags & RAISED_EXCEPTION))
return Qnil;
return Qfalse;
}
@@ -12680,7 +12948,7 @@ static VALUE
rb_thread_inspect(thread)
VALUE thread;
{
- char *cname = rb_obj_classname(thread);
+ const char *cname = rb_obj_classname(thread);
rb_thread_t th = rb_thread_check(thread);
const char *status = thread_status_name(th->status);
VALUE str;
@@ -13035,6 +13303,109 @@ thgroup_add(group, thread)
}
+/* variables for recursive traversals */
+static ID recursive_key;
+
+static VALUE
+recursive_check(hash, obj)
+ VALUE hash;
+ VALUE obj;
+{
+ if (NIL_P(hash) || TYPE(hash) != T_HASH) {
+ return Qfalse;
+ }
+ else {
+ VALUE list = rb_hash_aref(hash, ID2SYM(rb_frame_last_func()));
+
+ if (NIL_P(list) || TYPE(list) != T_HASH)
+ return Qfalse;
+ if (NIL_P(rb_hash_lookup(list, obj)))
+ return Qfalse;
+ return Qtrue;
+ }
+}
+
+static VALUE
+recursive_push(hash, obj)
+ VALUE hash;
+ VALUE obj;
+{
+ VALUE list, sym;
+
+ sym = ID2SYM(rb_frame_last_func());
+ if (NIL_P(hash) || TYPE(hash) != T_HASH) {
+ hash = rb_hash_new();
+ rb_thread_local_aset(rb_thread_current(), recursive_key, hash);
+ list = Qnil;
+ }
+ else {
+ list = rb_hash_aref(hash, sym);
+ }
+ if (NIL_P(list) || TYPE(list) != T_HASH) {
+ list = rb_hash_new();
+ rb_hash_aset(hash, sym, list);
+ }
+ rb_hash_aset(list, obj, Qtrue);
+ return hash;
+}
+
+static void
+recursive_pop(hash, obj)
+ VALUE hash;
+ VALUE obj;
+{
+ VALUE list, sym;
+
+ sym = ID2SYM(rb_frame_last_func());
+ if (NIL_P(hash) || TYPE(hash) != T_HASH) {
+ VALUE symname;
+ VALUE thrname;
+ symname = rb_inspect(sym);
+ thrname = rb_inspect(rb_thread_current());
+
+ rb_raise(rb_eTypeError, "invalid inspect_tbl hash for %s in %s",
+ StringValuePtr(symname), StringValuePtr(thrname));
+ }
+ list = rb_hash_aref(hash, sym);
+ if (NIL_P(list) || TYPE(list) != T_HASH) {
+ VALUE symname = rb_inspect(sym);
+ VALUE thrname = rb_inspect(rb_thread_current());
+ rb_raise(rb_eTypeError, "invalid inspect_tbl list for %s in %s",
+ StringValuePtr(symname), StringValuePtr(thrname));
+ }
+ rb_hash_delete(list, obj);
+}
+
+VALUE
+rb_exec_recursive(func, obj, arg)
+ VALUE (*func) _((VALUE, VALUE, int));
+ VALUE obj;
+ VALUE arg;
+{
+ VALUE hash = rb_thread_local_aref(rb_thread_current(), recursive_key);
+ VALUE objid = rb_obj_id(obj);
+
+ if (recursive_check(hash, objid)) {
+ return (*func) (obj, arg, Qtrue);
+ }
+ else {
+ VALUE result = Qundef;
+ int state;
+
+ hash = recursive_push(hash, objid);
+ PUSH_TAG(PROT_NONE);
+ if ((state = EXEC_TAG()) == 0) {
+ result = (*func) (obj, arg, Qfalse);
+ }
+ POP_TAG();
+ recursive_pop(hash, objid);
+ if (state)
+ JUMP_TAG(state);
+ return result;
+ }
+}
+
+
/*
* +Thread+ encapsulates the behavior of a thread of
* execution, including the main thread of the Ruby script.
@@ -13049,6 +13420,7 @@ Init_Thread()
{
VALUE cThGroup;
+ recursive_key = rb_intern("__recursive_key__");
rb_eThreadError = rb_define_class("ThreadError", rb_eStandardError);
rb_cThread = rb_define_class("Thread", rb_cObject);
rb_undef_alloc_func(rb_cThread);
@@ -13081,7 +13453,7 @@ Init_Thread()
rb_define_method(rb_cThread, "terminate!", rb_thread_kill_bang, 0);
rb_define_method(rb_cThread, "exit!", rb_thread_kill_bang, 0);
rb_define_method(rb_cThread, "value", rb_thread_value, 0);
- rb_define_method(rb_cThread, "status", rb_thread_status_name, 0);
+ rb_define_method(rb_cThread, "status", rb_thread_status, 0);
rb_define_method(rb_cThread, "join", rb_thread_join_m, -1);
rb_define_method(rb_cThread, "alive?", rb_thread_alive_p, 0);
rb_define_method(rb_cThread, "stop?", rb_thread_stop_p, 0);
diff --git a/ext/Win32API/lib/win32/registry.rb b/ext/Win32API/lib/win32/registry.rb
index 2671551a33..9a2f3827b7 100644
--- a/ext/Win32API/lib/win32/registry.rb
+++ b/ext/Win32API/lib/win32/registry.rb
@@ -493,7 +493,7 @@ module Win32
# utility functions
#
def self.expand_environ(str)
- str.gsub(/%([^%]+)%/) { ENV[$1] || $& }
+ str.gsub(/%([^%]+)%/) { ENV[$1] || ENV[$1.upcase] || $& }
end
@@type2name = { }
diff --git a/ext/Win32API/lib/win32/resolv.rb b/ext/Win32API/lib/win32/resolv.rb
index 6534d20760..92336fac28 100644
--- a/ext/Win32API/lib/win32/resolv.rb
+++ b/ext/Win32API/lib/win32/resolv.rb
@@ -11,7 +11,7 @@ module Win32
def self.get_hosts_path
path = get_hosts_dir
- path = File.join(path.gsub(/\\/, File::SEPARATOR), 'hosts')
+ path = File.expand_path('hosts', path)
File.exist?(path) ? path : nil
end
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index a4b769e8cf..636c0907d6 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -586,19 +586,22 @@ BigDecimal_to_f(VALUE self)
{
ENTER(1);
Real *p;
- double d, d2;
+ double d;
S_LONG e;
+ char *buf;
GUARD_OBJ(p,GetVpValue(self,1));
if(VpVtoD(&d, &e, p)!=1) return rb_float_new(d);
+ buf = ALLOCA_N(char,(unsigned int)VpNumOfChars(p,"E"));
+ VpToString(p, buf, 0, 0);
errno = 0;
- d2 = pow(10.0,(double)e);
- if((errno == ERANGE && e>0) || (d2>1.0 && (fabs(d) > (DBL_MAX / d2)))) {
+ d = strtod(buf, 0);
+ if(errno == ERANGE) {
VpException(VP_EXCEPTION_OVERFLOW,"BigDecimal to Float conversion",0);
if(d>0.0) return rb_float_new(DBL_MAX);
else return rb_float_new(-DBL_MAX);
}
- return rb_float_new(d*d2);
+ return rb_float_new(d);
}
/* The coerce method provides support for Ruby type coercion. It is not
@@ -1051,7 +1054,7 @@ static VALUE
BigDecimal_remainder(VALUE self, VALUE r) /* remainder */
{
VALUE f;
- Real *d,*rv;
+ Real *d,*rv=0;
f = BigDecimal_divremain(self,r,&d,&rv);
if(f!=(VALUE)0) return f;
return ToValue(rv);
@@ -1505,7 +1508,7 @@ BigDecimal_to_s(int argc, VALUE *argv, VALUE self)
} else if(*psz=='+') {
fPlus = 2; psz++;
}
- while(ch=*psz++) {
+ while((ch=*psz++)!=0) {
if(ISSPACE(ch)) continue;
if(!ISDIGIT(ch)) {
if(ch=='F' || ch=='f') fmt = 1; /* F format */
@@ -1962,17 +1965,27 @@ static int gfCheckVal = 1; /* Value checking flag in VpNmlz() */
static U_LONG gnPrecLimit = 0; /* Global upper limit of the precision newly allocated */
static U_LONG gfRoundMode = VP_ROUND_HALF_UP; /* Mode for general rounding operation */
+#ifndef BASE_FIG
static U_LONG BASE_FIG = 4; /* =log10(BASE) */
static U_LONG BASE = 10000L; /* Base value(value must be 10**BASE_FIG) */
/* The value of BASE**2 + BASE must be represented */
/* within one U_LONG. */
static U_LONG HALF_BASE = 5000L;/* =BASE/2 */
-static S_LONG DBLE_FIG = 8; /* figure of double */
static U_LONG BASE1 = 1000L; /* =BASE/10 */
+#else
+#ifndef BASE
+#error BASE_FIG is defined but BASE is not
+#endif
+#define HALF_BASE (BASE/2)
+#define BASE1 (BASE/10)
+#endif
+#ifndef DBLE_FIG
+#define DBLE_FIG (DBL_DIG+1) /* figure of double */
+#endif
static Real *VpConstOne; /* constant 1.0 */
static Real *VpPt5; /* constant 0.5 */
-static U_LONG maxnr = 100; /* Maximum iterations for calcurating sqrt. */
+#define maxnr 100UL /* Maximum iterations for calcurating sqrt. */
/* used in VpSqrt() */
/* ETC */
@@ -2089,8 +2102,8 @@ VpSetRoundMode(unsigned long n)
* (to let the compiler know they may be changed in outside
* (... but not actually..)).
*/
-volatile double gZero_ABCED9B1_CE73__00400511F31D = 0.0;
-volatile double gOne_ABCED9B4_CE73__00400511F31D = 1.0;
+volatile const double gZero_ABCED9B1_CE73__00400511F31D = 0.0;
+volatile const double gOne_ABCED9B4_CE73__00400511F31D = 1.0;
static double
Zero(void)
{
@@ -2362,16 +2375,15 @@ VpNumOfChars(Real *vp,const char *pszFmt)
VP_EXPORT U_LONG
VpInit(U_LONG BaseVal)
{
- U_LONG w;
- double v;
-
/* Setup +/- Inf NaN -0 */
VpGetDoubleNaN();
VpGetDoublePosInf();
VpGetDoubleNegInf();
VpGetDoubleNegZero();
+#ifndef BASE_FIG
if(BaseVal <= 0) {
+ U_LONG w;
/* Base <= 0, then determine Base by calcuration. */
BASE = 1;
while(
@@ -2388,6 +2400,8 @@ VpInit(U_LONG BaseVal)
BASE1 = BASE / 10;
BASE_FIG = 0;
while(BaseVal /= 10) ++BASE_FIG;
+#endif
+
/* Allocates Vp constants. */
VpConstOne = VpAlloc((U_LONG)1, "1");
VpPt5 = VpAlloc((U_LONG)1, ".5");
@@ -2396,15 +2410,6 @@ VpInit(U_LONG BaseVal)
gnAlloc = 0;
#endif /* _DEBUG */
- /* Determine # of digits available in one 'double'. */
-
- v = 1.0;
- DBLE_FIG = 0;
- while(v + 1.0 > 1.0) {
- ++DBLE_FIG;
- v /= 10;
- }
-
#ifdef _DEBUG
if(gfDebug) {
printf("VpInit: BaseVal = %lu\n", BaseVal);
@@ -2507,7 +2512,7 @@ VpAlloc(U_LONG mx, const char *szVal)
psz = ALLOCA_N(char,strlen(szVal)+1);
i = 0;
ipn = 0;
- while(psz[i]=szVal[ipn]) {
+ while((psz[i]=szVal[ipn])!=0) {
if(ISDIGIT(psz[i])) ++ni;
if(psz[i]=='_') {
if(ni>0) {ipn++;continue;}
@@ -2550,7 +2555,7 @@ VpAlloc(U_LONG mx, const char *szVal)
else if(szVal[i] == '+') ++i;
/* Skip digits */
ni = 0; /* digits in mantissa */
- while(v = szVal[i]) {
+ while((v = szVal[i]) != 0) {
if(!ISDIGIT(v)) break;
++i;
++ni;
@@ -2564,7 +2569,7 @@ VpAlloc(U_LONG mx, const char *szVal)
if(szVal[i] == '.') { /* xxx. */
++i;
ipf = i;
- while(v = szVal[i]) { /* get fraction part. */
+ while((v = szVal[i]) != 0) { /* get fraction part. */
if(!ISDIGIT(v)) break;
++i;
++nf;
@@ -2582,7 +2587,7 @@ VpAlloc(U_LONG mx, const char *szVal)
ipe = i;
v = szVal[i];
if((v == '-') ||(v == '+')) ++i;
- while(v=szVal[i]) {
+ while((v=szVal[i])!=0) {
if(!ISDIGIT(v)) break;
++i;
++ne;
@@ -4434,7 +4439,7 @@ VpLeftRound(Real *y, int f, int nf)
if(!VpHasVal(y)) return 0; /* Unable to round */
v = y->frac[0];
nf -= VpExponent(y)*BASE_FIG;
- while(v=v/10) nf--;
+ while((v /= 10) != 0) nf--;
nf += (BASE_FIG-1);
return VpMidRound(y,f,nf);
}
diff --git a/ext/bigdecimal/extconf.rb b/ext/bigdecimal/extconf.rb
index a68a656044..0c8b98e4a3 100644
--- a/ext/bigdecimal/extconf.rb
+++ b/ext/bigdecimal/extconf.rb
@@ -1,2 +1,10 @@
require 'mkmf'
+
+base_fig = 0
+src = "(BASE * (BASE+1)) / BASE == (BASE+1)"
+while try_static_assert(src, nil, "-DBASE=10#{'0'*base_fig}UL")
+ base_fig += 1
+end
+$defs << "-DBASE=1#{'0'*base_fig}UL" << "-DBASE_FIG=#{base_fig}"
+
create_makefile('bigdecimal')
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c
index 69b7a6e7a7..0247387fdc 100644
--- a/ext/dbm/dbm.c
+++ b/ext/dbm/dbm.c
@@ -812,5 +812,7 @@ Init_dbm()
#ifdef DB_VERSION_STRING
rb_define_const(rb_cDBM, "VERSION", rb_str_new2(DB_VERSION_STRING));
+#else
+ rb_define_const(rb_cDBM, "VERSION", rb_str_new2("unknown"));
#endif
}
diff --git a/ext/dl/dl.c b/ext/dl/dl.c
index 5ba3646ea3..f65247be86 100644
--- a/ext/dl/dl.c
+++ b/ext/dl/dl.c
@@ -522,12 +522,15 @@ rb_str_to_ptr(VALUE self)
{
char *ptr;
int len;
+ VALUE p;
len = RSTRING(self)->len;
ptr = (char*)dlmalloc(len + 1);
memcpy(ptr, RSTRING(self)->ptr, len);
ptr[len] = '\0';
- return rb_dlptr_new((void*)ptr,len,dlfree);
+ p = rb_dlptr_new((void*)ptr,len,dlfree);
+ OBJ_INFECT(p, self);
+ return p;
}
VALUE
@@ -545,13 +548,18 @@ rb_ary_to_ptr(int argc, VALUE argv[], VALUE self)
ptr = rb_ary2cary(0, self, &size);
break;
}
- return ptr ? rb_dlptr_new(ptr, size, dlfree) : Qnil;
+ if (ptr) {
+ VALUE p = rb_dlptr_new(ptr, size, dlfree);
+ OBJ_INFECT(p, self);
+ return p;
+ }
+ return Qnil;
}
VALUE
rb_io_to_ptr(VALUE self)
{
- OpenFile *fptr;
+ rb_io_t *fptr;
FILE *fp;
GetOpenFile(self, fptr);
@@ -563,7 +571,7 @@ rb_io_to_ptr(VALUE self)
VALUE
rb_dl_dlopen(int argc, VALUE argv[], VALUE self)
{
- rb_secure(4);
+ rb_secure(2);
return rb_class_new_instance(argc, argv, rb_cDLHandle);
}
diff --git a/ext/dl/ptr.c b/ext/dl/ptr.c
index 5112151733..01eb31da20 100644
--- a/ext/dl/ptr.c
+++ b/ext/dl/ptr.c
@@ -4,30 +4,22 @@
#include <ruby.h>
#include <ctype.h>
-#include <version.h> /* for ruby version code */
+#include "st.h"
#include "dl.h"
VALUE rb_cDLPtrData;
VALUE rb_mDLMemorySpace;
-static VALUE DLMemoryTable;
+static st_table* st_memory_table;
#ifndef T_SYMBOL
# define T_SYMBOL T_FIXNUM
#endif
-#if RUBY_VERSION_CODE < 171
-static VALUE
-rb_hash_delete(VALUE hash, VALUE key)
-{
- return rb_funcall(hash, rb_intern("delete"), 1, key);
-}
-#endif
-
static void
rb_dlmem_delete(void *ptr)
{
rb_secure(4);
- rb_hash_delete(DLMemoryTable, DLLONG2NUM(ptr));
+ st_delete(st_memory_table, (st_data_t*)&ptr, NULL);
}
static void
@@ -37,7 +29,7 @@ rb_dlmem_aset(void *ptr, VALUE obj)
rb_dlmem_delete(ptr);
}
else{
- rb_hash_aset(DLMemoryTable, DLLONG2NUM(ptr), DLLONG2NUM(obj));
+ st_insert(st_memory_table, (st_data_t)ptr, (st_data_t)obj);
}
}
@@ -46,8 +38,8 @@ rb_dlmem_aref(void *ptr)
{
VALUE val;
- val = rb_hash_aref(DLMemoryTable, DLLONG2NUM(ptr));
- return val == Qnil ? Qnil : (VALUE)DLNUM2LONG(val);
+ if(!st_lookup(st_memory_table, (st_data_t)ptr, &val)) return Qnil;
+ return val == Qundef ? Qnil : val;
}
void
@@ -344,7 +336,7 @@ rb_dlptr_to_array(int argc, VALUE argv[], VALUE self)
n = data->size / sizeof(void*);
break;
case 'S': case 's':
- for (n=0; ((void**)(data->ptr))[n]; n++) {};
+ n = data->size / sizeof(char*);
break;
default:
n = 0;
@@ -1010,20 +1002,18 @@ rb_dlptr_size(int argc, VALUE argv[], VALUE self)
}
}
-static VALUE
-dlmem_each_i(VALUE assoc, void *data)
+static int
+dlmem_each_i(void* key, VALUE value, void* arg)
{
- VALUE key, val;
- key = rb_ary_entry(assoc, 0);
- val = rb_ary_entry(assoc, 1);
- rb_yield(rb_assoc_new(key,(VALUE)DLNUM2LONG(val)));
+ VALUE vkey = DLLONG2NUM(key);
+ rb_yield(rb_assoc_new(vkey, value));
return Qnil;
}
VALUE
rb_dlmem_each(VALUE self)
{
- rb_iterate(rb_each, DLMemoryTable, dlmem_each_i, 0);
+ st_foreach(st_memory_table, dlmem_each_i, 0);
return Qnil;
}
@@ -1062,7 +1052,7 @@ Init_dlptr()
rb_define_method(rb_cDLPtrData, "size=", rb_dlptr_size, -1);
rb_mDLMemorySpace = rb_define_module_under(rb_mDL, "MemorySpace");
- DLMemoryTable = rb_hash_new();
- rb_define_const(rb_mDLMemorySpace, "MemoryTable", DLMemoryTable);
+ st_memory_table = st_init_numtable();
+ rb_define_const(rb_mDLMemorySpace, "MemoryTable", Qnil); /* historical */
rb_define_module_function(rb_mDLMemorySpace, "each", rb_dlmem_each, 0);
}
diff --git a/ext/dl/sym.c b/ext/dl/sym.c
index 01e0474f58..933fb7f4f0 100644
--- a/ext/dl/sym.c
+++ b/ext/dl/sym.c
@@ -492,6 +492,7 @@ rb_dlsym_call(int argc, VALUE argv[], VALUE self)
rb_raise(rb_eDLTypeError, "unexpected type of argument #%d", i);
}
}
+ rb_check_safe_obj(pval);
Data_Get_Struct(pval, struct ptr_data, data);
ANY2P(args[i]) = DLVOIDP(data->ptr);
}
diff --git a/ext/enumerator/.cvsignore b/ext/enumerator/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/enumerator/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/enumerator/enumerator.c b/ext/enumerator/enumerator.c
deleted file mode 100644
index 1c6e1d1ace..0000000000
--- a/ext/enumerator/enumerator.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/************************************************
-
- enumerator.c - provides Enumerator class
-
- $Author$
-
- Copyright (C) 2001-2003 Akinori MUSHA
-
- $Idaemons: /home/cvs/rb/enumerator/enumerator.c,v 1.1.1.1 2001/07/15 10:12:48 knu Exp $
- $RoughId: enumerator.c,v 1.6 2003/07/27 11:03:24 nobu Exp $
- $Id$
-
-************************************************/
-
-#include "ruby.h"
-#include "node.h"
-
-/*
- * Document-class: Enumerable::Enumerator
- *
- * A class which provides a method `each' to be used as an Enumerable
- * object.
- */
-static VALUE rb_cEnumerator;
-static ID sym_each, sym_each_with_index, sym_each_slice, sym_each_cons;
-static ID id_new, id_enum_obj, id_enum_method, id_enum_args;
-
-/*
- * call-seq:
- * obj.to_enum(method = :each, *args)
- * obj.enum_for(method = :each, *args)
- *
- * Returns Enumerable::Enumerator.new(self, method, *args).
- *
- * e.g.:
- * str = "xyz"
- *
- * enum = str.enum_for(:each_byte)
- * a = enum.map {|b| '%02x' % b } #=> ["78", "79", "7a"]
- *
- * # protects an array from being modified
- * a = [1, 2, 3]
- * some_method(a.to_enum)
- *
- */
-static VALUE
-obj_to_enum(obj, enum_args)
- VALUE obj, enum_args;
-{
- rb_ary_unshift(enum_args, obj);
-
- return rb_apply(rb_cEnumerator, id_new, enum_args);
-}
-
-/*
- * call-seq:
- * enum_with_index
- *
- * Returns Enumerable::Enumerator.new(self, :each_with_index).
- *
- */
-static VALUE
-enumerator_enum_with_index(obj)
- VALUE obj;
-{
- return rb_funcall(rb_cEnumerator, id_new, 2, obj, sym_each_with_index);
-}
-
-static VALUE
-each_slice_i(val, memo)
- VALUE val;
- NODE *memo;
-{
- VALUE ary = memo->u1.value;
- long size = memo->u3.cnt;
-
- rb_ary_push(ary, val);
-
- if (RARRAY(ary)->len == size) {
- rb_yield(ary);
- memo->u1.value = rb_ary_new2(size);
- }
-
- return Qnil;
-}
-
-/*
- * call-seq:
- * e.each_slice(n) {...}
- *
- * Iterates the given block for each slice of <n> elements.
- *
- * e.g.:
- * (1..10).each_slice(3) {|a| p a}
- * # outputs below
- * [1, 2, 3]
- * [4, 5, 6]
- * [7, 8, 9]
- * [10]
- *
- */
-static VALUE
-enum_each_slice(obj, n)
- VALUE obj, n;
-{
- long size = NUM2LONG(n);
- NODE *memo;
- VALUE ary;
-
- if (size <= 0) rb_raise(rb_eArgError, "invalid slice size");
-
- memo = rb_node_newnode(NODE_MEMO, rb_ary_new2(size), 0, size);
-
- rb_iterate(rb_each, obj, each_slice_i, (VALUE)memo);
-
- ary = memo->u1.value;
- if (RARRAY(ary)->len > 0) rb_yield(ary);
-
- return Qnil;
-}
-
-/*
- * call-seq:
- * e.enum_slice(n)
- *
- * Returns Enumerable::Enumerator.new(self, :each_slice, n).
- *
- */
-static VALUE
-enumerator_enum_slice(obj, n)
- VALUE obj, n;
-{
- return rb_funcall(rb_cEnumerator, id_new, 3, obj, sym_each_slice, n);
-}
-
-static VALUE
-each_cons_i(val, memo)
- VALUE val;
- NODE *memo;
-{
- VALUE ary = memo->u1.value;
- long size = memo->u3.cnt;
-
- if (RARRAY(ary)->len == size) {
- rb_ary_shift(ary);
- }
- rb_ary_push(ary, val);
- if (RARRAY(ary)->len == size) {
- rb_yield(rb_ary_dup(ary));
- }
- return Qnil;
-}
-
-/*
- * call-seq:
- * each_cons(n) {...}
- *
- * Iterates the given block for each array of consecutive <n>
- * elements.
- *
- * e.g.:
- * (1..10).each_cons(3) {|a| p a}
- * # outputs below
- * [1, 2, 3]
- * [2, 3, 4]
- * [3, 4, 5]
- * [4, 5, 6]
- * [5, 6, 7]
- * [6, 7, 8]
- * [7, 8, 9]
- * [8, 9, 10]
- *
- */
-static VALUE
-enum_each_cons(obj, n)
- VALUE obj, n;
-{
- long size = NUM2LONG(n);
- NODE *memo;
-
- if (size <= 0) rb_raise(rb_eArgError, "invalid size");
- memo = rb_node_newnode(NODE_MEMO, rb_ary_new2(size), 0, size);
-
- rb_iterate(rb_each, obj, each_cons_i, (VALUE)memo);
-
- return Qnil;
-}
-
-/*
- * call-seq:
- * e.enum_cons(n)
- *
- * Returns Enumerable::Enumerator.new(self, :each_cons, n).
- *
- */
-static VALUE
-enumerator_enum_cons(obj, n)
- VALUE obj, n;
-{
- return rb_funcall(rb_cEnumerator, id_new, 3, obj, sym_each_cons, n);
-}
-
-/*
- * call-seq:
- * Enumerable::Enumerator.new(obj, method = :each, *args)
- *
- * Creates a new Enumerable::Enumerator object, which is to be
- * used as an Enumerable object using the given object's given
- * method with the given arguments.
- *
- * e.g.:
- * str = "xyz"
- *
- * enum = Enumerable::Enumerator.new(str, :each_byte)
- * a = enum.map {|b| '%02x' % b } #=> ["78", "79", "7a"]
- *
- */
-static VALUE
-enumerator_initialize(argc, argv, obj)
- int argc;
- VALUE *argv;
- VALUE obj;
-{
- VALUE enum_obj, enum_method, enum_args;
-
- rb_scan_args(argc, argv, "11*", &enum_obj, &enum_method, &enum_args);
-
- if (enum_method == Qnil)
- enum_method = sym_each;
-
- rb_ivar_set(obj, id_enum_obj, enum_obj);
- rb_ivar_set(obj, id_enum_method, enum_method);
- rb_ivar_set(obj, id_enum_args, enum_args);
-
- return Qnil;
-}
-
-static VALUE
-enumerator_iter(memo)
- NODE *memo;
-{
- return rb_apply(memo->u1.value, memo->u2.id, memo->u3.value);
-}
-
-/*
- * call-seq:
- * enum.each {...}
- *
- * Iterates the given block using the object and the method specified
- * in the first place.
- *
- */
-static VALUE
-enumerator_each(obj)
- VALUE obj;
-{
- VALUE val;
-
- obj = (VALUE)rb_node_newnode(NODE_MEMO,
- rb_ivar_get(obj, id_enum_obj),
- rb_to_id(rb_ivar_get(obj, id_enum_method)),
- rb_ivar_get(obj, id_enum_args));
- val = rb_iterate((VALUE (*)_((VALUE)))enumerator_iter, obj, rb_yield, 0);
- return val;
-}
-
-void
-Init_enumerator()
-{
- VALUE rb_mEnumerable;
-
- rb_define_method(rb_mKernel, "to_enum", obj_to_enum, -2);
- rb_define_method(rb_mKernel, "enum_for", obj_to_enum, -2);
-
- rb_mEnumerable = rb_path2class("Enumerable");
-
- rb_define_method(rb_mEnumerable, "enum_with_index", enumerator_enum_with_index, 0);
- rb_define_method(rb_mEnumerable, "each_slice", enum_each_slice, 1);
- rb_define_method(rb_mEnumerable, "enum_slice", enumerator_enum_slice, 1);
- rb_define_method(rb_mEnumerable, "each_cons", enum_each_cons, 1);
- rb_define_method(rb_mEnumerable, "enum_cons", enumerator_enum_cons, 1);
-
- rb_cEnumerator = rb_define_class_under(rb_mEnumerable, "Enumerator", rb_cObject);
- rb_include_module(rb_cEnumerator, rb_mEnumerable);
-
- rb_define_method(rb_cEnumerator, "initialize", enumerator_initialize, -1);
- rb_define_method(rb_cEnumerator, "each", enumerator_each, 0);
-
- sym_each = ID2SYM(rb_intern("each"));
- sym_each_with_index = ID2SYM(rb_intern("each_with_index"));
- sym_each_slice = ID2SYM(rb_intern("each_slice"));
- sym_each_cons = ID2SYM(rb_intern("each_cons"));
-
- id_new = rb_intern("new");
- id_enum_obj = rb_intern("enum_obj");
- id_enum_method = rb_intern("enum_method");
- id_enum_args = rb_intern("enum_args");
-}
diff --git a/ext/enumerator/enumerator.txt b/ext/enumerator/enumerator.txt
deleted file mode 100644
index 64c7d50226..0000000000
--- a/ext/enumerator/enumerator.txt
+++ /dev/null
@@ -1,102 +0,0 @@
-.\" enumerator.txt - -*- Indented-Text -*-
-$Idaemons: /home/cvs/rb/enumerator/enumerator.txt,v 1.2 2001/07/15 10:19:24 knu Exp $
-$RoughId: enumerator.txt,v 1.5 2003/02/20 12:24:51 knu Exp $
-$Id$
-
-** Enumerable::Enumerator(Class)
-
-A class which provides a method `each' to be used as an Enumerable
-object.
-
-Superclass: Object
-
-Mix-ins: Enumerable
-
-require 'enumerator'
-
-Class Methods:
-
- new(obj, method = :each, *args)
-
- Creates a new Enumerable::Enumerator object, which is to be
- used as an Enumerable object using the given object's given
- method with the given arguments.
-
- e.g.:
- str = "xyz"
-
- enum = Enumerable::Enumerator.new(str, :each_byte)
- a = enum.map {|b| '%02x' % b } #=> ["78", "79", "7a"]
-
-Methods:
-
- each {...}
-
- Iterates the given block using the object and the method
- specified in the first place.
-
-
-Requiring this module also adds some methods to the Object class:
-
- to_enum(method = :each, *args)
- enum_for(method = :each, *args)
-
- Returns Enumerable::Enumerator.new(self, method, *args).
-
- e.g.:
- str = "xyz"
-
- enum = str.enum_for(:each_byte)
- a = enum.map {|b| '%02x' % b } #=> ["78", "79", "7a"]
-
- # protects an array from being modified
- a = [1, 2, 3]
- some_method(a.to_enum)
-
-And the Enumerable module.
-
- each_slice(n) {...}
-
- Iterates the given block for each slice of <n> elements.
-
- e.g.:
- (1..10).each_slice(3) {|a| p a}
- # outputs below
- [1, 2, 3]
- [4, 5, 6]
- [7, 8, 9]
- [10]
-
- enum_slice(n)
-
- Returns Enumerable::Enumerator.new(self, :each_slice, n).
-
- each_cons(n) {...}
-
- Iterates the given block for each array of consecutive <n>
- elements.
-
- e.g.:
- (1..10).each_cons(3) {|a| p a}
- # outputs below
- [1, 2, 3]
- [2, 3, 4]
- [3, 4, 5]
- [4, 5, 6]
- [5, 6, 7]
- [6, 7, 8]
- [7, 8, 9]
- [8, 9, 10]
-
- enum_cons(n)
-
- Returns Enumerable::Enumerator.new(self, :each_cons, n).
-
- enum_with_index
-
- Returns Enumerable::Enumerator.new(self, :each_with_index).
-
--------------------------------------------------------
-Local variables:
-fill-column: 70
-end:
diff --git a/ext/enumerator/extconf.rb b/ext/enumerator/extconf.rb
deleted file mode 100644
index 94e2ee38b2..0000000000
--- a/ext/enumerator/extconf.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require 'mkmf'
-create_makefile('enumerator')
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index 486963378b..ecb9e16411 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -35,6 +35,8 @@ char *getenv();
char *getlogin();
/* Returns the short user name of the currently logged in user.
+ * Unfortunately, it is often rather easy to fool getlogin().
+ * Avoid getlogin() for security-related purposes.
*
* e.g.
* Etc.getlogin -> 'guest'
diff --git a/ext/extmk.rb b/ext/extmk.rb
index cf7944679c..64746552c1 100644
--- a/ext/extmk.rb
+++ b/ext/extmk.rb
@@ -79,7 +79,7 @@ def extract_makefile(makefile, keep = true)
$static ||= m[/^EXTSTATIC[ \t]*=[ \t]*(\S+)/, 1] || false
/^STATIC_LIB[ \t]*=[ \t]*\S+/ =~ m or $static = nil
$preload = Shellwords.shellwords(m[/^preload[ \t]*=[ \t]*(.*)/, 1] || "")
- $DLDFLAGS += " " + (m[/^DLDFLAGS[ \t]*=[ \t]*(.*)/, 1] || "")
+ $DLDFLAGS += " " + (m[/^dldflags[ \t]*=[ \t]*(.*)/, 1] || "")
if s = m[/^LIBS[ \t]*=[ \t]*(.*)/, 1]
s.sub!(/^#{Regexp.quote($LIBRUBYARG)} */, "")
s.sub!(/ *#{Regexp.quote($LIBS)}$/, "")
@@ -135,7 +135,6 @@ def extmake(target)
"topdir" => $topdir,
}
mkconfig = {
- "top_srcdir" => ($hdrdir == top_srcdir) ? top_srcdir : "$(topdir)"+top_srcdir[2..-1],
"hdrdir" => "$(top_srcdir)",
"srcdir" => "$(top_srcdir)/ext/#{$mdir}",
"topdir" => $topdir,
@@ -299,7 +298,7 @@ def parse_args()
$mflags.unshift(*rest) unless rest.empty?
def $mflags.set?(flag)
- grep(/\A-(?!-).*#{'%c' % flag}/i) { return true }
+ grep(/\A-(?!-).*#{flag.chr}/i) { return true }
false
end
def $mflags.defined?(var)
@@ -326,9 +325,9 @@ parse_args()
if target = ARGV.shift and /^[a-z-]+$/ =~ target
$mflags.push(target)
- target = target.sub(/^(dist|real)(?=(?:clean)?$)/, '')
case target
- when /clean/
+ when /^(dist|real)?(clean)$/
+ target = $2
$ignore ||= true
$clean = $1 ? $1[0] : true
when /^install\b/
@@ -355,12 +354,16 @@ elsif sep = config_string('BUILD_FILE_SEPARATOR')
else
$ruby = '$(topdir)/miniruby' + EXEEXT
end
-$ruby << " -I'$(topdir)' -I'$(top_srcdir)/lib'"
-$ruby << " -I'$(extout)/$(arch)' -I'$(extout)/common'" if $extout
-$ruby << " -I'$(hdrdir)/ext' -rpurelib.rb"
+$ruby << " -I'$(topdir)'"
+unless CROSS_COMPILING
+ $ruby << " -I'$(top_srcdir)/lib'"
+ $ruby << " -I'$(extout)/$(arch)' -I'$(extout)/common'" if $extout
+ $ruby << " -I./- -I'$(top_srcdir)/ext' -rpurelib.rb"
+ ENV["RUBYLIB"] = "-"
+ ENV["RUBYOPT"] = "-rpurelib.rb"
+end
$config_h = '$(topdir)/config.h'
-ENV["RUBYLIB"] = "-"
-ENV["RUBYOPT"] = "-rpurelib.rb"
+$mflags << "ruby=#$ruby"
MTIMES = [__FILE__, 'rbconfig.rb', srcdir+'/lib/mkmf.rb'].collect {|f| File.mtime(f)}
@@ -455,7 +458,16 @@ if $ignore
Dir.chdir ".."
if $clean
Dir.rmdir('ext') rescue nil
- FileUtils.rm_rf(extout) if $extout
+ if $extout
+ FileUtils.rm_rf([extout+"/common", extout+"/include/ruby", extout+"/rdoc"])
+ FileUtils.rm_rf(extout+"/"+CONFIG["arch"])
+ if $clean != true
+ FileUtils.rm_rf(extout+"/include/"+CONFIG["arch"])
+ FileUtils.rm_f($mflags.defined?("INSTALLED_LIST")||ENV["INSTALLED_LIST"]||".installed.list")
+ Dir.rmdir(extout+"/include") rescue nil
+ Dir.rmdir(extout) rescue nil
+ end
+ end
end
exit
end
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 65fed33bd2..d989b97df2 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -43,7 +43,11 @@
*
* == Examples
*
- * 1. Instantiate a new Iconv and use method Iconv#iconv.
+ * 1. Simple conversion between two charsets.
+ *
+ * converted_text = Iconv.conv('iso-8859-15', 'utf-8', text)
+ *
+ * 2. Instantiate a new Iconv and use method Iconv#iconv.
*
* cd = Iconv.new(to, from)
* begin
@@ -53,20 +57,16 @@
* cd.close
* end
*
- * 2. Invoke Iconv.open with a block.
+ * 3. Invoke Iconv.open with a block.
*
* Iconv.open(to, from) do |cd|
* input.each { |s| output << cd.iconv(s) }
* output << cd.iconv(nil)
* end
*
- * 3. Shorthand for (2).
+ * 4. Shorthand for (3).
*
* Iconv.iconv(to, from, *input.to_a)
- *
- * 4. Simple conversion between two charsets.
- *
- * converted_text = Iconv.new('iso-8859-15', 'utf-8').iconv(text)
*/
/* Invalid value for iconv_t is -1 but 0 for VALUE, I hope VALUE is
@@ -101,7 +101,7 @@ static void iconv_dfree _((void *cd));
static VALUE iconv_free _((VALUE cd));
static VALUE iconv_try _((iconv_t cd, const char **inptr, size_t *inlen, char **outptr, size_t *outlen));
static VALUE rb_str_derive _((VALUE str, const char* ptr, int len));
-static VALUE iconv_convert _((iconv_t cd, VALUE str, int start, int length, struct iconv_env_t* env));
+static VALUE iconv_convert _((iconv_t cd, VALUE str, long start, long length, struct iconv_env_t* env));
static VALUE iconv_s_allocate _((VALUE klass));
static VALUE iconv_initialize _((VALUE self, VALUE to, VALUE from));
static VALUE iconv_s_open _((VALUE self, VALUE to, VALUE from));
@@ -170,7 +170,7 @@ iconv_create
}
if (cd == (iconv_t)-1) {
int inval = errno == EINVAL;
- char *s = inval ? "invalid encoding " : "iconv";
+ const char *s = inval ? "invalid encoding " : "iconv";
volatile VALUE msg = rb_str_new(0, strlen(s) + RSTRING(to)->len +
RSTRING(from)->len + 8);
@@ -362,13 +362,13 @@ rb_str_derive
static VALUE
iconv_convert
#ifdef HAVE_PROTOTYPES
- (iconv_t cd, VALUE str, int start, int length, struct iconv_env_t* env)
+ (iconv_t cd, VALUE str, long start, long length, struct iconv_env_t* env)
#else /* HAVE_PROTOTYPES */
(cd, str, start, length, env)
iconv_t cd;
VALUE str;
- int start;
- int length;
+ long start;
+ long length;
struct iconv_env_t *env;
#endif /* HAVE_PROTOTYPES */
{
@@ -417,14 +417,9 @@ iconv_convert
slen = RSTRING(str)->len;
inptr = RSTRING(str)->ptr;
- if (start < 0 ? (start += slen) < 0 : start >= slen)
- length = 0;
- else if (length < 0 && (length += slen + 1) < 0)
- length = 0;
- else if ((length -= start) < 0)
- length = 0;
- else
- inptr += start;
+ inptr += start;
+ if (length < 0 || length > start + slen)
+ length = slen - start;
}
instart = inptr;
inlen = length;
@@ -606,7 +601,7 @@ iconv_s_convert
}
/*
- * Document-method: iconv
+ * Document-method: Iconv::iconv
* call-seq: Iconv.iconv(to, from, *strs)
*
* Shorthand for
@@ -715,7 +710,7 @@ iconv_finish
}
/*
- * Document-method: iconv
+ * Document-method: Iconv#iconv
* call-seq: iconv(str, start=0, length=-1)
*
* Converts string and returns the result.
@@ -754,14 +749,22 @@ iconv_iconv
{
VALUE str, n1, n2;
VALUE cd = check_iconv(self);
+ long start = 0, length = 0, slen = 0;
- n1 = n2 = Qnil;
rb_scan_args(argc, argv, "12", &str, &n1, &n2);
+ if (!NIL_P(str)) slen = RSTRING_LEN(StringValue(str));
+ if (argc != 2 || !RTEST(rb_range_beg_len(n1, &start, &length, slen, 0))) {
+ if (NIL_P(n1) || ((start = NUM2LONG(n1)) < 0 ? (start += slen) >= 0 : start < slen)) {
+ if (NIL_P(n2)) {
+ length = -1;
+ }
+ else if ((length = NUM2LONG(n2)) >= slen - start) {
+ length = slen - start;
+ }
+ }
+ }
- return iconv_convert(VALUE2ICONV(cd), str,
- NIL_P(n1) ? 0 : NUM2INT(n1),
- NIL_P(n2) ? -1 : NUM2INT(n2),
- NULL);
+ return iconv_convert(VALUE2ICONV(cd), str, start, length, NULL);
}
/*
@@ -825,7 +828,7 @@ iconv_failure_inspect
VALUE self;
#endif /* HAVE_PROTOTYPES */
{
- char *cname = rb_class2name(CLASS_OF(self));
+ const char *cname = rb_class2name(CLASS_OF(self));
VALUE success = rb_attr_get(self, rb_success);
VALUE failed = rb_attr_get(self, rb_failed);
VALUE str = rb_str_buf_cat2(rb_str_new2("#<"), cname);
diff --git a/ext/io/wait/wait.c b/ext/io/wait/wait.c
index 61d6527b36..02cb54a014 100644
--- a/ext/io/wait/wait.c
+++ b/ext/io/wait/wait.c
@@ -56,7 +56,7 @@ static VALUE
io_ready_p(io)
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
FILE *fp;
ioctl_arg n;
@@ -84,7 +84,7 @@ io_wait(argc, argv, io)
VALUE *argv;
VALUE io;
{
- OpenFile *fptr;
+ rb_io_t *fptr;
fd_set rd;
FILE *fp;
int fd;
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index 98921bc468..02e06b7149 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -59,6 +59,8 @@ unless have_header("openssl/conf_api.h")
exit 1
end
+%w"rb_str_set_len rb_block_call".each {|func| have_func(func, "ruby.h")}
+
message "=== Checking for OpenSSL features... ===\n"
have_func("ERR_peek_last_error")
have_func("BN_mod_add")
@@ -81,6 +83,8 @@ have_func("HMAC_CTX_cleanup")
have_func("HMAC_CTX_copy")
have_func("HMAC_CTX_init")
have_func("PEM_def_callback")
+have_func("PKCS5_PBKDF2_HMAC")
+have_func("PKCS5_PBKDF2_HMAC_SHA1")
have_func("X509V3_set_nconf")
have_func("X509V3_EXT_nconf_nid")
have_func("X509_CRL_add0_revoked")
@@ -90,6 +94,7 @@ have_func("X509_CRL_sort")
have_func("X509_STORE_get_ex_data")
have_func("X509_STORE_set_ex_data")
have_func("OBJ_NAME_do_all_sorted")
+have_func("SSL_SESSION_get_id")
have_func("OPENSSL_cleanse")
if try_compile("#define FOO(a, ...) foo(a, ##__VA_ARGS__)\n int x(){FOO(1);FOO(1,2);FOO(1,2,3);}\n")
$defs.push("-DHAVE_VA_ARGS_MACRO")
diff --git a/ext/openssl/lib/openssl.rb b/ext/openssl/lib/openssl.rb
index 24a9eed136..f10985ed2c 100644
--- a/ext/openssl/lib/openssl.rb
+++ b/ext/openssl/lib/openssl.rb
@@ -19,6 +19,7 @@ require 'openssl.so'
require 'openssl/bn'
require 'openssl/cipher'
require 'openssl/digest'
+require 'openssl/pkcs7'
require 'openssl/ssl'
require 'openssl/x509'
diff --git a/ext/openssl/lib/openssl/cipher.rb b/ext/openssl/lib/openssl/cipher.rb
index 049533d06b..290e9c1d2d 100644
--- a/ext/openssl/lib/openssl/cipher.rb
+++ b/ext/openssl/lib/openssl/cipher.rb
@@ -19,7 +19,7 @@
#require 'openssl'
module OpenSSL
- module Cipher
+ class Cipher
%w(AES CAST5 BF DES IDEA RC2 RC4 RC5).each{|name|
klass = Class.new(Cipher){
define_method(:initialize){|*args|
@@ -41,18 +41,25 @@ module OpenSSL
const_set("AES#{keylen}", klass)
}
- class Cipher
- def random_key
- str = OpenSSL::Random.random_bytes(self.key_len)
- self.key = str
- return str
- end
-
- def random_iv
- str = OpenSSL::Random.random_bytes(self.iv_len)
- self.iv = str
- return str
- end
+ # Generate, set, and return a random key.
+ # You must call cipher.encrypt or cipher.decrypt before calling this method.
+ def random_key
+ str = OpenSSL::Random.random_bytes(self.key_len)
+ self.key = str
+ return str
+ end
+
+ # Generate, set, and return a random iv.
+ # You must call cipher.encrypt or cipher.decrypt before calling this method.
+ def random_iv
+ str = OpenSSL::Random.random_bytes(self.iv_len)
+ self.iv = str
+ return str
+ end
+
+ # This class is only provided for backwards compatibility. Use OpenSSL::Digest in the future.
+ class Cipher < Cipher
+ # add warning
end
end # Cipher
end # OpenSSL
diff --git a/ext/openssl/lib/openssl/digest.rb b/ext/openssl/lib/openssl/digest.rb
index b3e4484805..4810f0121b 100644
--- a/ext/openssl/lib/openssl/digest.rb
+++ b/ext/openssl/lib/openssl/digest.rb
@@ -19,13 +19,17 @@
#require 'openssl'
module OpenSSL
- module Digest
+ class Digest
alg = %w(DSS DSS1 MD2 MD4 MD5 MDC2 RIPEMD160 SHA SHA1)
if OPENSSL_VERSION_NUMBER > 0x00908000
alg += %w(SHA224 SHA256 SHA384 SHA512)
end
+ def self.digest(name, data)
+ super(data, name)
+ end
+
alg.each{|name|
klass = Class.new(Digest){
define_method(:initialize){|*data|
@@ -44,6 +48,14 @@ module OpenSSL
const_set(name, klass)
}
+ # This class is only provided for backwards compatibility. Use OpenSSL::Digest in the future.
+ class Digest < Digest
+ def initialize(*args)
+ # add warning
+ super(*args)
+ end
+ end
+
end # Digest
end # OpenSSL
diff --git a/ext/openssl/lib/openssl/pkcs7.rb b/ext/openssl/lib/openssl/pkcs7.rb
new file mode 100644
index 0000000000..1f88c1de5e
--- /dev/null
+++ b/ext/openssl/lib/openssl/pkcs7.rb
@@ -0,0 +1,25 @@
+=begin
+= $RCSfile$ -- PKCS7
+
+= Licence
+ This program is licenced under the same licence as Ruby.
+ (See the file 'LICENCE'.)
+
+= Version
+ $Id: digest.rb 12148 2007-04-05 05:59:22Z technorama $
+=end
+
+module OpenSSL
+ class PKCS7
+ # This class is only provided for backwards compatibility. Use OpenSSL::PKCS7 in the future.
+ class PKCS7 < PKCS7
+ def initialize(*args)
+ super(*args)
+
+ warn("Warning: OpenSSL::PKCS7::PKCS7 is deprecated after Ruby 1.9; use OpenSSL::PKCS7 instead")
+ end
+ end
+
+ end # PKCS7
+end # OpenSSL
+
diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb
index 9e9a9448ba..f722cb0c45 100644
--- a/ext/openssl/lib/openssl/ssl.rb
+++ b/ext/openssl/lib/openssl/ssl.rb
@@ -20,6 +20,33 @@ require "fcntl"
module OpenSSL
module SSL
+ class SSLContext
+ DEFAULT_PARAMS = {
+ :ssl_version => "SSLv23",
+ :verify_mode => OpenSSL::SSL::VERIFY_PEER,
+ :ciphers => "ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW",
+ :options => OpenSSL::SSL::OP_ALL,
+ }
+
+ DEFAULT_CERT_STORE = OpenSSL::X509::Store.new
+ DEFAULT_CERT_STORE.set_default_paths
+ if defined?(OpenSSL::X509::V_FLAG_CRL_CHECK_ALL)
+ DEFAULT_CERT_STORE.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL
+ end
+
+ def set_params(params={})
+ params = DEFAULT_PARAMS.merge(params)
+ self.ssl_version = params.delete(:ssl_version)
+ params.each{|name, value| self.__send__("#{name}=", value) }
+ if self.verify_mode != OpenSSL::SSL::VERIFY_NONE
+ unless self.ca_file or self.ca_path or self.cert_store
+ self.cert_store = DEFAULT_CERT_STORE
+ end
+ end
+ return params
+ end
+ end
+
module SocketForwarder
def addr
to_io.addr
@@ -59,36 +86,49 @@ module OpenSSL
end
end
+ def verify_certificate_identity(cert, hostname)
+ should_verify_common_name = true
+ cert.extensions.each{|ext|
+ next if ext.oid != "subjectAltName"
+ ext.value.split(/,\s+/).each{|general_name|
+ if /\ADNS:(.*)/ =~ general_name
+ should_verify_common_name = false
+ reg = Regexp.escape($1).gsub(/\\\*/, "[^.]+")
+ return true if /\A#{reg}\z/i =~ hostname
+ elsif /\AIP Address:(.*)/ =~ general_name
+ should_verify_common_name = false
+ return true if $1 == hostname
+ end
+ }
+ }
+ if should_verify_common_name
+ cert.subject.to_a.each{|oid, value|
+ if oid == "CN"
+ reg = Regexp.escape(value).gsub(/\\\*/, "[^.]+")
+ return true if /\A#{reg}\z/i =~ hostname
+ end
+ }
+ end
+ return false
+ end
+ module_function :verify_certificate_identity
+
class SSLSocket
include Buffering
include SocketForwarder
include Nonblock
def post_connection_check(hostname)
- check_common_name = true
- cert = peer_cert
- cert.extensions.each{|ext|
- next if ext.oid != "subjectAltName"
- ext.value.split(/,\s+/).each{|general_name|
- if /\ADNS:(.*)/ =~ general_name
- check_common_name = false
- reg = Regexp.escape($1).gsub(/\\\*/, "[^.]+")
- return true if /\A#{reg}\z/i =~ hostname
- elsif /\AIP Address:(.*)/ =~ general_name
- check_common_name = false
- return true if $1 == hostname
- end
- }
- }
- if check_common_name
- cert.subject.to_a.each{|oid, value|
- if oid == "CN"
- reg = Regexp.escape(value).gsub(/\\\*/, "[^.]+")
- return true if /\A#{reg}\z/i =~ hostname
- end
- }
+ unless OpenSSL::SSL.verify_certificate_identity(peer_cert, hostname)
+ raise SSLError, "hostname was not match with the server certificate"
end
- raise SSLError, "hostname was not match with the server certificate"
+ return true
+ end
+
+ def session
+ SSL::Session.new(self)
+ rescue SSL::Session::SessionError
+ nil
end
end
@@ -114,6 +154,10 @@ module OpenSSL
@svr.listen(backlog)
end
+ def shutdown(how=Socket::SHUT_RDWR)
+ @svr.shutdown(how)
+ end
+
def accept
sock = @svr.accept
begin
diff --git a/ext/openssl/openssl_missing.c b/ext/openssl/openssl_missing.c
index f77731ed65..724f36b8ae 100644
--- a/ext/openssl/openssl_missing.c
+++ b/ext/openssl/openssl_missing.c
@@ -22,17 +22,15 @@
#include "openssl_missing.h"
#if !defined(HAVE_HMAC_CTX_COPY)
-int
+void
HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in)
{
- if (!out || !in) return 0;
+ if (!out || !in) return;
memcpy(out, in, sizeof(HMAC_CTX));
- if (!EVP_MD_CTX_copy(&out->md_ctx, &in->md_ctx)
- || !EVP_MD_CTX_copy(&out->i_ctx, &in->i_ctx)
- || !EVP_MD_CTX_copy(&out->o_ctx, &in->o_ctx))
- return 0;
- return 1;
+ EVP_MD_CTX_copy(&out->md_ctx, &in->md_ctx);
+ EVP_MD_CTX_copy(&out->i_ctx, &in->i_ctx);
+ EVP_MD_CTX_copy(&out->o_ctx, &in->o_ctx);
}
#endif /* HAVE_HMAC_CTX_COPY */
#endif /* NO_HMAC */
diff --git a/ext/openssl/openssl_missing.h b/ext/openssl/openssl_missing.h
index e8c75ca42c..5a71f73c64 100644
--- a/ext/openssl/openssl_missing.h
+++ b/ext/openssl/openssl_missing.h
@@ -15,6 +15,10 @@
extern "C" {
#endif
+#ifndef TYPEDEF_D2I_OF
+typedef char *d2i_of_void();
+#endif
+
/*
* These functions are not included in headers of OPENSSL <= 0.9.6b
*/
@@ -56,14 +60,33 @@ extern "C" {
(char *(*)())d2i_PKCS7_RECIP_INFO, (char *)ri)
#endif
+#if !defined(HAVE_EVP_MD_CTX_INIT)
void HMAC_CTX_init(HMAC_CTX *ctx);
-int HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in);
+#endif
+
+#if !defined(HAVE_HMAC_CTX_COPY)
+void HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in);
+#endif
+
+#if !defined(HAVE_HMAC_CTX_CLEANUP)
void HMAC_CTX_cleanup(HMAC_CTX *ctx);
+#endif
+#if !defined(HAVE_EVP_MD_CTX_CREATE)
EVP_MD_CTX *EVP_MD_CTX_create(void);
+#endif
+
+#if !defined(HAVE_EVP_MD_CTX_INIT)
void EVP_MD_CTX_init(EVP_MD_CTX *ctx);
+#endif
+
+#if !defined(HAVE_EVP_MD_CTX_CLEANUP)
int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx);
+#endif
+
+#if !defined(HAVE_EVP_MD_CTX_DESTROY)
void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);
+#endif
#if !defined(HAVE_EVP_CIPHER_CTX_COPY)
int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, EVP_CIPHER_CTX *in);
@@ -107,19 +130,54 @@ int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, EVP_CIPHER_CTX *in);
#define OPENSSL_cleanse(p, l) memset(p, 0, l)
#endif
+#if !defined(HAVE_X509_STORE_SET_EX_DATA)
void *X509_STORE_get_ex_data(X509_STORE *str, int idx);
int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data);
+#endif
+
+#if !defined(HAVE_X509_CRL_SET_VERSION)
int X509_CRL_set_version(X509_CRL *x, long version);
+#endif
+
+#if !defined(HAVE_X509_CRL_SET_ISSUER_NAME)
int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name);
+#endif
+
+#if !defined(HAVE_X509_CRL_SORT)
int X509_CRL_sort(X509_CRL *c);
+#endif
+
+#if !defined(HAVE_X509_CRL_ADD0_REVOKED)
int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);
+#endif
+
+#if !defined(HAVE_BN_MOD_SQR)
int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
+#endif
+
+#if !defined(HAVE_BN_MOD_ADD)
int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
+#endif
+
+#if !defined(HAVE_BN_MOD_SUB)
int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
+#endif
+
+#if !defined(HAVE_BN_RAND_RANGE)
int BN_rand_range(BIGNUM *r, BIGNUM *range);
+#endif
+
+#if !defined(HAVE_BN_PSEUDO_RAND_RANGE)
int BN_pseudo_rand_range(BIGNUM *r, BIGNUM *range);
+#endif
+
+#if !defined(HAVE_CONF_GET1_DEFAULT_CONFIG_FILE)
char *CONF_get1_default_config_file(void);
+#endif
+
+#if !defined(HAVE_PEM_DEF_CALLBACK)
int PEM_def_callback(char *buf, int num, int w, void *key);
+#endif
#if defined(__cplusplus)
}
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c
index a98f2641cc..53f476fd65 100644
--- a/ext/openssl/ossl.c
+++ b/ext/openssl/ossl.c
@@ -59,7 +59,7 @@ ossl_x509_ary2sk0(VALUE ary)
sk = sk_X509_new_null();
if (!sk) ossl_raise(eOSSLError, NULL);
- for (i = 0; i < RARRAY(ary)->len; i++) {
+ for (i = 0; i < RARRAY_LEN(ary); i++) {
val = rb_ary_entry(ary, i);
if (!rb_obj_is_kind_of(val, cX509Cert)) {
sk_X509_pop_free(sk, X509_free);
@@ -131,7 +131,7 @@ ossl_buf2str(char *buf, int len)
int status = 0;
str = rb_protect((VALUE(*)_((VALUE)))ossl_str_new, len, &status);
- if(!NIL_P(str)) memcpy(RSTRING(str)->ptr, buf, len);
+ if(!NIL_P(str)) memcpy(RSTRING_PTR(str), buf, len);
OPENSSL_free(buf);
if(status) rb_jump_tag(status);
@@ -170,7 +170,7 @@ ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd)
rflag = flag ? Qtrue : Qfalse;
pass = rb_protect(ossl_pem_passwd_cb0, rflag, &status);
if (status) return -1; /* exception was raised. */
- len = RSTRING(pass)->len;
+ len = RSTRING_LEN(pass);
if (len < 4) { /* 4 is OpenSSL hardcoded limit */
rb_warning("password must be longer than 4 bytes");
continue;
@@ -179,7 +179,7 @@ ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd)
rb_warning("password must be shorter then %d bytes", max_len-1);
continue;
}
- memcpy(buf, RSTRING(pass)->ptr, len);
+ memcpy(buf, RSTRING_PTR(pass), len);
break;
}
return len;
@@ -310,6 +310,14 @@ ossl_raise(VALUE exc, const char *fmt, ...)
rb_exc_raise(rb_exc_new(exc, buf, len));
}
+/*
+ * call-seq:
+ * OpenSSL.errors -> [String...]
+ *
+ * See any remaining errors held in queue.
+ *
+ * Any errors you see here are probably due to a bug in ruby's OpenSSL implementation.
+ */
VALUE
ossl_get_errors()
{
@@ -345,12 +353,23 @@ ossl_debug(const char *fmt, ...)
}
#endif
+/*
+ * call-seq:
+ * OpenSSL.debug -> true | false
+ */
static VALUE
ossl_debug_get(VALUE self)
{
return dOSSL;
}
+/*
+ * call-seq:
+ * OpenSSL.debug = boolean -> boolean
+ *
+ * Turns on or off CRYPTO_MEM_CHECK.
+ * Also shows some debugging message on stderr.
+ */
static VALUE
ossl_debug_set(VALUE self, VALUE val)
{
@@ -427,8 +446,8 @@ Init_openssl()
/*
* Verify callback Proc index for ext-data
*/
- ossl_verify_cb_idx =
- X509_STORE_CTX_get_ex_new_index(0, "ossl_verify_cb_idx", 0, 0, 0);
+ if ((ossl_verify_cb_idx = X509_STORE_CTX_get_ex_new_index(0, "ossl_verify_cb_idx", 0, 0, 0)) < 0)
+ ossl_raise(eOSSLError, "X509_STORE_CTX_get_ex_new_index");
/*
* Init debug core
@@ -454,6 +473,7 @@ Init_openssl()
Init_ossl_ns_spki();
Init_ossl_pkcs12();
Init_ossl_pkcs7();
+ Init_ossl_pkcs5();
Init_ossl_pkey();
Init_ossl_rand();
Init_ossl_ssl();
diff --git a/ext/openssl/ossl.h b/ext/openssl/ossl.h
index 598bfb69da..3cc30ae2e8 100644
--- a/ext/openssl/ossl.h
+++ b/ext/openssl/ossl.h
@@ -17,6 +17,11 @@
extern "C" {
#endif
+#if 0
+ mOSSL = rb_define_module("OpenSSL");
+ mX509 = rb_define_module_under(mOSSL, "X509");
+#endif
+
/*
* OpenSSL has defined RFILE and Ruby has defined RFILE - so undef it!
*/
@@ -40,8 +45,12 @@ extern "C" {
#endif
#if defined(_WIN32)
-# define OpenFile WINAPI_OpenFile
# define OSSL_NO_CONF_API 1
+# ifdef USE_WINSOCK2
+# include <winsock2.h>
+# else
+# include <winsock.h>
+# endif
#endif
#include <errno.h>
#include <openssl/err.h>
@@ -64,9 +73,6 @@ extern "C" {
# define OSSL_OCSP_ENABLED
# include <openssl/ocsp.h>
#endif
-#if defined(_WIN32)
-# undef OpenFile
-#endif
/*
* Common Module
@@ -117,11 +123,10 @@ VALUE ossl_x509crl_sk2ary(STACK_OF(X509_CRL) *crl);
VALUE ossl_buf2str(char *buf, int len);
#define ossl_str_adjust(str, p) \
do{\
- int len = RSTRING(str)->len;\
- int newlen = (p) - (unsigned char*)RSTRING(str)->ptr;\
+ int len = RSTRING_LEN(str);\
+ int newlen = (p) - (unsigned char*)RSTRING_PTR(str);\
assert(newlen <= len);\
- RSTRING(str)->len = newlen;\
- RSTRING(str)->ptr[newlen] = 0;\
+ rb_str_set_len(str, newlen);\
}while(0)
/*
diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c
index 3614f470d9..8ceea95021 100644
--- a/ext/openssl/ossl_asn1.c
+++ b/ext/openssl/ossl_asn1.c
@@ -214,7 +214,7 @@ obj_to_asn1bstr(VALUE obj, long unused_bits)
StringValue(obj);
if(!(bstr = ASN1_BIT_STRING_new()))
ossl_raise(eASN1Error, NULL);
- ASN1_BIT_STRING_set(bstr, RSTRING(obj)->ptr, RSTRING(obj)->len);
+ ASN1_BIT_STRING_set(bstr, RSTRING_PTR(obj), RSTRING_LEN(obj));
bstr->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear */
bstr->flags |= ASN1_STRING_FLAG_BITS_LEFT|(unused_bits&0x07);
@@ -229,7 +229,7 @@ obj_to_asn1str(VALUE obj)
StringValue(obj);
if(!(str = ASN1_STRING_new()))
ossl_raise(eASN1Error, NULL);
- ASN1_STRING_set(str, RSTRING(obj)->ptr, RSTRING(obj)->len);
+ ASN1_STRING_set(str, RSTRING_PTR(obj), RSTRING_LEN(obj));
return str;
}
@@ -253,8 +253,8 @@ obj_to_asn1obj(VALUE obj)
ASN1_OBJECT *a1obj;
StringValue(obj);
- a1obj = OBJ_txt2obj(RSTRING(obj)->ptr, 0);
- if(!a1obj) a1obj = OBJ_txt2obj(RSTRING(obj)->ptr, 1);
+ a1obj = OBJ_txt2obj(RSTRING_PTR(obj), 0);
+ if(!a1obj) a1obj = OBJ_txt2obj(RSTRING_PTR(obj), 1);
if(!a1obj) ossl_raise(eASN1Error, "invalid OBJECT ID");
return a1obj;
@@ -295,7 +295,7 @@ obj_to_asn1derstr(VALUE obj)
str = ossl_to_der(obj);
if(!(a1str = ASN1_STRING_new()))
ossl_raise(eASN1Error, NULL);
- ASN1_STRING_set(a1str, RSTRING(str)->ptr, RSTRING(str)->len);
+ ASN1_STRING_set(a1str, RSTRING_PTR(str), RSTRING_LEN(str));
return a1str;
}
@@ -445,7 +445,7 @@ decode_time(unsigned char* der, int length)
/********/
typedef struct {
- char *name;
+ const char *name;
VALUE *klass;
} ossl_asn1_info_t;
@@ -678,7 +678,7 @@ static VALUE
join_der(VALUE enumerable)
{
VALUE str = rb_str_new(0, 0);
- rb_iterate(rb_each, enumerable, join_der_i, str);
+ rb_block_call(enumerable, rb_intern("each"), 0, 0, join_der_i, str);
return str;
}
@@ -699,13 +699,13 @@ ossl_asn1data_to_der(VALUE self)
tag = ossl_asn1_tag(self);
tag_class = ossl_asn1_tag_class(self);
- if((length = ASN1_object_size(1, RSTRING(value)->len, tag)) <= 0)
+ if((length = ASN1_object_size(1, RSTRING_LEN(value), tag)) <= 0)
ossl_raise(eASN1Error, NULL);
der = rb_str_new(0, length);
- p = RSTRING(der)->ptr;
- ASN1_put_object(&p, is_cons, RSTRING(value)->len, tag, tag_class);
- memcpy(p, RSTRING(value)->ptr, RSTRING(value)->len);
- p += RSTRING(value)->len;
+ p = RSTRING_PTR(der);
+ ASN1_put_object(&p, is_cons, RSTRING_LEN(value), tag, tag_class);
+ memcpy(p, RSTRING_PTR(value), RSTRING_LEN(value));
+ p += RSTRING_LEN(value);
ossl_str_adjust(der, p);
return der;
@@ -824,8 +824,8 @@ ossl_asn1_traverse(VALUE self, VALUE obj)
obj = ossl_to_der_if_possible(obj);
tmp = rb_str_new4(StringValue(obj));
- p = RSTRING(tmp)->ptr;
- ossl_asn1_decode0(&p, RSTRING(tmp)->len, &offset, 0, 0, 1);
+ p = RSTRING_PTR(tmp);
+ ossl_asn1_decode0(&p, RSTRING_LEN(tmp), &offset, 0, 0, 1);
return Qnil;
}
@@ -840,8 +840,8 @@ ossl_asn1_decode(VALUE self, VALUE obj)
obj = ossl_to_der_if_possible(obj);
tmp = rb_str_new4(StringValue(obj));
- p = RSTRING(tmp)->ptr;
- ary = ossl_asn1_decode0(&p, RSTRING(tmp)->len, &offset, 0, 1, 0);
+ p = RSTRING_PTR(tmp);
+ ary = ossl_asn1_decode0(&p, RSTRING_LEN(tmp), &offset, 0, 1, 0);
ret = rb_ary_entry(ary, 0);
return ret;
@@ -857,8 +857,8 @@ ossl_asn1_decode_all(VALUE self, VALUE obj)
obj = ossl_to_der_if_possible(obj);
tmp = rb_str_new4(StringValue(obj));
- p = RSTRING(tmp)->ptr;
- ret = ossl_asn1_decode0(&p, RSTRING(tmp)->len, &offset, 0, 0, 0);
+ p = RSTRING_PTR(tmp);
+ ret = ossl_asn1_decode0(&p, RSTRING_LEN(tmp), &offset, 0, 0, 0);
return ret;
}
@@ -973,21 +973,21 @@ ossl_asn1cons_to_der(VALUE self)
explicit = ossl_asn1_is_explicit(self);
value = join_der(ossl_asn1_get_value(self));
- seq_len = ASN1_object_size(1, RSTRING(value)->len, tag);
+ seq_len = ASN1_object_size(1, RSTRING_LEN(value), tag);
length = ASN1_object_size(1, seq_len, tn);
str = rb_str_new(0, length);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
if(tc == V_ASN1_UNIVERSAL)
- ASN1_put_object(&p, 1, RSTRING(value)->len, tn, tc);
+ ASN1_put_object(&p, 1, RSTRING_LEN(value), tn, tc);
else{
if(explicit){
ASN1_put_object(&p, 1, seq_len, tn, tc);
- ASN1_put_object(&p, 1, RSTRING(value)->len, tag, V_ASN1_UNIVERSAL);
+ ASN1_put_object(&p, 1, RSTRING_LEN(value), tag, V_ASN1_UNIVERSAL);
}
- else ASN1_put_object(&p, 1, RSTRING(value)->len, tn, tc);
+ else ASN1_put_object(&p, 1, RSTRING_LEN(value), tn, tc);
}
- memcpy(p, RSTRING(value)->ptr, RSTRING(value)->len);
- p += RSTRING(value)->len;
+ memcpy(p, RSTRING_PTR(value), RSTRING_LEN(value));
+ p += RSTRING_LEN(value);
ossl_str_adjust(str, p);
return str;
@@ -1007,7 +1007,7 @@ ossl_asn1obj_s_register(VALUE self, VALUE oid, VALUE sn, VALUE ln)
StringValue(sn);
StringValue(ln);
- if(!OBJ_create(RSTRING(oid)->ptr, RSTRING(sn)->ptr, RSTRING(ln)->ptr))
+ if(!OBJ_create(RSTRING_PTR(oid), RSTRING_PTR(sn), RSTRING_PTR(ln)))
ossl_raise(eASN1Error, NULL);
return Qtrue;
@@ -1112,9 +1112,9 @@ Init_ossl_asn1()
}
cASN1Data = rb_define_class_under(mASN1, "ASN1Data", rb_cObject);
- rb_attr(cASN1Data, rb_intern("value"), 1, 1, Qtrue);
- rb_attr(cASN1Data, rb_intern("tag"), 1, 1, Qtrue);
- rb_attr(cASN1Data, rb_intern("tag_class"), 1, 1, Qtrue);
+ rb_attr(cASN1Data, rb_intern("value"), 1, 1, 0);
+ rb_attr(cASN1Data, rb_intern("tag"), 1, 1, 0);
+ rb_attr(cASN1Data, rb_intern("tag_class"), 1, 1, 0);
rb_define_method(cASN1Data, "initialize", ossl_asn1data_initialize, 3);
rb_define_method(cASN1Data, "to_der", ossl_asn1data_to_der, 0);
@@ -1166,5 +1166,5 @@ do{\
rb_define_method(cASN1ObjectId, "oid", ossl_asn1obj_get_oid, 0);
rb_define_alias(cASN1ObjectId, "short_name", "sn");
rb_define_alias(cASN1ObjectId, "long_name", "ln");
- rb_attr(cASN1BitString, rb_intern("unused_bits"), 1, 1, Qtrue);
+ rb_attr(cASN1BitString, rb_intern("unused_bits"), 1, 1, 0);
}
diff --git a/ext/openssl/ossl_bio.c b/ext/openssl/ossl_bio.c
index 9c9aa24197..6db1fb9a62 100644
--- a/ext/openssl/ossl_bio.c
+++ b/ext/openssl/ossl_bio.c
@@ -19,16 +19,29 @@ ossl_obj2bio(VALUE obj)
BIO *bio;
if (TYPE(obj) == T_FILE) {
- OpenFile *fptr;
+ rb_io_t *fptr;
+ FILE *fp;
+ int fd;
+
GetOpenFile(obj, fptr);
rb_io_check_readable(fptr);
- bio = BIO_new_fp(fptr->f, BIO_NOCLOSE);
- }
+ if ((fd = dup(FPTR_TO_FD(fptr))) < 0){
+ rb_sys_fail(0);
+ }
+ if (!(fp = fdopen(fd, "r"))){
+ close(fd);
+ rb_sys_fail(0);
+ }
+ if (!(bio = BIO_new_fp(fp, BIO_CLOSE))){
+ fclose(fp);
+ ossl_raise(eOSSLError, NULL);
+ }
+ }
else {
StringValue(obj);
- bio = BIO_new_mem_buf(RSTRING(obj)->ptr, RSTRING(obj)->len);
+ bio = BIO_new_mem_buf(RSTRING_PTR(obj), RSTRING_LEN(obj));
+ if (!bio) ossl_raise(eOSSLError, NULL);
}
- if (!bio) ossl_raise(eOSSLError, NULL);
return bio;
}
diff --git a/ext/openssl/ossl_bn.c b/ext/openssl/ossl_bn.c
index cc7689eef5..6856476261 100644
--- a/ext/openssl/ossl_bn.c
+++ b/ext/openssl/ossl_bn.c
@@ -40,7 +40,7 @@ VALUE eBNError;
* Public
*/
VALUE
-ossl_bn_new(BIGNUM *bn)
+ossl_bn_new(const BIGNUM *bn)
{
BIGNUM *newbn;
VALUE obj;
@@ -100,6 +100,13 @@ ossl_bn_alloc(VALUE klass)
return obj;
}
+/*
+ * call-seq:
+ * BN.new => aBN
+ * BN.new(bn) => aBN
+ * BN.new(string) => aBN
+ * BN.new(string, 0 | 2 | 10 | 16) => aBN
+ */
static VALUE
ossl_bn_initialize(int argc, VALUE *argv, VALUE self)
{
@@ -124,22 +131,22 @@ ossl_bn_initialize(int argc, VALUE *argv, VALUE self)
switch (base) {
case 0:
- if (!BN_mpi2bn(RSTRING(str)->ptr, RSTRING(str)->len, bn)) {
+ if (!BN_mpi2bn(RSTRING_PTR(str), RSTRING_LEN(str), bn)) {
ossl_raise(eBNError, NULL);
}
break;
case 2:
- if (!BN_bin2bn(RSTRING(str)->ptr, RSTRING(str)->len, bn)) {
+ if (!BN_bin2bn(RSTRING_PTR(str), RSTRING_LEN(str), bn)) {
ossl_raise(eBNError, NULL);
}
break;
case 10:
- if (!BN_dec2bn(&bn, RSTRING(str)->ptr)) {
+ if (!BN_dec2bn(&bn, RSTRING_PTR(str))) {
ossl_raise(eBNError, NULL);
}
break;
case 16:
- if (!BN_hex2bn(&bn, RSTRING(str)->ptr)) {
+ if (!BN_hex2bn(&bn, RSTRING_PTR(str))) {
ossl_raise(eBNError, NULL);
}
break;
@@ -149,6 +156,19 @@ ossl_bn_initialize(int argc, VALUE *argv, VALUE self)
return self;
}
+/*
+ * call-seq:
+ * bn.to_s => string
+ * bn.to_s(base) => string
+ *
+ * === Parameters
+ * * +base+ - integer
+ * * * Valid values:
+ * * * * 0 - MPI
+ * * * * 2 - binary
+ * * * * 10 - the default
+ * * * * 16 - hex
+ */
static VALUE
ossl_bn_to_s(int argc, VALUE *argv, VALUE self)
{
@@ -165,13 +185,13 @@ ossl_bn_to_s(int argc, VALUE *argv, VALUE self)
case 0:
len = BN_bn2mpi(bn, NULL);
str = rb_str_new(0, len);
- if (BN_bn2mpi(bn, RSTRING(str)->ptr) != len)
+ if (BN_bn2mpi(bn, RSTRING_PTR(str)) != len)
ossl_raise(eBNError, NULL);
break;
case 2:
len = BN_num_bytes(bn);
str = rb_str_new(0, len);
- if (BN_bn2bin(bn, RSTRING(str)->ptr) != len)
+ if (BN_bn2bin(bn, RSTRING_PTR(str)) != len)
ossl_raise(eBNError, NULL);
break;
case 10:
@@ -189,6 +209,10 @@ ossl_bn_to_s(int argc, VALUE *argv, VALUE self)
return str;
}
+/*
+ * call-seq:
+ * bn.to_i => integer
+ */
static VALUE
ossl_bn_to_i(VALUE self)
{
@@ -233,6 +257,11 @@ ossl_bn_coerce(VALUE self, VALUE other)
}
#define BIGNUM_BOOL1(func) \
+ /* \
+ * call-seq: \
+ * bn.##func -> true | false \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self) \
{ \
@@ -248,6 +277,11 @@ BIGNUM_BOOL1(is_one);
BIGNUM_BOOL1(is_odd);
#define BIGNUM_1c(func) \
+ /* \
+ * call-seq: \
+ * bn.##func -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self) \
{ \
@@ -267,6 +301,11 @@ BIGNUM_BOOL1(is_odd);
BIGNUM_1c(sqr);
#define BIGNUM_2(func) \
+ /* \
+ * call-seq: \
+ * bn.##func(bn2) -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self, VALUE other) \
{ \
@@ -287,6 +326,11 @@ BIGNUM_2(add);
BIGNUM_2(sub);
#define BIGNUM_2c(func) \
+ /* \
+ * call-seq: \
+ * bn.##func(bn2) -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self, VALUE other) \
{ \
@@ -310,6 +354,10 @@ BIGNUM_2c(gcd);
BIGNUM_2c(mod_sqr);
BIGNUM_2c(mod_inverse);
+/*
+ * call-seq:
+ * bn1 / bn2 => [result, remainder]
+ */
static VALUE
ossl_bn_div(VALUE self, VALUE other)
{
@@ -337,6 +385,11 @@ ossl_bn_div(VALUE self, VALUE other)
}
#define BIGNUM_3c(func) \
+ /* \
+ * call-seq: \
+ * bn.##func(bn1, bn2) -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self, VALUE other1, VALUE other2) \
{ \
@@ -360,6 +413,11 @@ BIGNUM_3c(mod_mul);
BIGNUM_3c(mod_exp);
#define BIGNUM_BIT(func) \
+ /* \
+ * call-seq: \
+ * bn.##func(bit) -> self \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self, VALUE bit) \
{ \
@@ -374,6 +432,10 @@ BIGNUM_BIT(set_bit);
BIGNUM_BIT(clear_bit);
BIGNUM_BIT(mask_bits);
+/*
+ * call-seq:
+ * bn.bit_set?(bit) => true | false
+ */
static VALUE
ossl_bn_is_bit_set(VALUE self, VALUE bit)
{
@@ -389,6 +451,11 @@ ossl_bn_is_bit_set(VALUE self, VALUE bit)
}
#define BIGNUM_SHIFT(func) \
+ /* \
+ * call-seq: \
+ * bn.##func(bits) -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self, VALUE bits) \
{ \
@@ -410,7 +477,32 @@ ossl_bn_is_bit_set(VALUE self, VALUE bit)
BIGNUM_SHIFT(lshift);
BIGNUM_SHIFT(rshift);
+#define BIGNUM_SELF_SHIFT(func) \
+ /* \
+ * call-seq: \
+ * bn.##func!(bits) -> self \
+ * \
+ */ \
+ static VALUE \
+ ossl_bn_self_##func(VALUE self, VALUE bits) \
+ { \
+ BIGNUM *bn; \
+ int b; \
+ b = NUM2INT(bits); \
+ GetBN(self, bn); \
+ if (!BN_##func(bn, bn, b)) \
+ ossl_raise(eBNError, NULL); \
+ return self; \
+ }
+BIGNUM_SELF_SHIFT(lshift);
+BIGNUM_SELF_SHIFT(rshift);
+
#define BIGNUM_RAND(func) \
+ /* \
+ * call-seq: \
+ * BN.##func(bits [, fill [, odd]]) -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_s_##func(int argc, VALUE *argv, VALUE klass) \
{ \
@@ -423,7 +515,7 @@ BIGNUM_SHIFT(rshift);
bottom = (odd == Qtrue) ? 1 : 0; \
/* FALLTHROUGH */ \
case 2: \
- top = FIX2INT(fill); \
+ top = NUM2INT(fill); \
} \
b = NUM2INT(bits); \
if (!(result = BN_new())) { \
@@ -440,6 +532,11 @@ BIGNUM_RAND(rand);
BIGNUM_RAND(pseudo_rand);
#define BIGNUM_RAND_RANGE(func) \
+ /* \
+ * call-seq: \
+ * BN.##func(range) -> aBN \
+ * \
+ */ \
static VALUE \
ossl_bn_s_##func##_range(VALUE klass, VALUE range) \
{ \
@@ -458,6 +555,16 @@ BIGNUM_RAND(pseudo_rand);
BIGNUM_RAND_RANGE(rand);
BIGNUM_RAND_RANGE(pseudo_rand);
+/*
+ * call-seq:
+ * BN.generate_prime(bits, [, safe [, add [, rem]]]) => bn
+ *
+ * === Parameters
+ * * +bits+ - integer
+ * * +safe+ - boolean
+ * * +add+ - BN
+ * * +rem+ - BN
+ */
static VALUE
ossl_bn_s_generate_prime(int argc, VALUE *argv, VALUE klass)
{
@@ -473,12 +580,8 @@ ossl_bn_s_generate_prime(int argc, VALUE *argv, VALUE klass)
safe = 0;
}
if (!NIL_P(vadd)) {
- if (NIL_P(vrem)) {
- ossl_raise(rb_eArgError,
- "if ADD is specified, REM must be also given");
- }
add = GetBNPtr(vadd);
- rem = GetBNPtr(vrem);
+ rem = NIL_P(vrem) ? NULL : GetBNPtr(vrem);
}
if (!(result = BN_new())) {
ossl_raise(eBNError, NULL);
@@ -489,10 +592,15 @@ ossl_bn_s_generate_prime(int argc, VALUE *argv, VALUE klass)
}
WrapBN(klass, obj, result);
- return obj;
+ return obj;
}
#define BIGNUM_NUM(func) \
+ /* \
+ * call-seq: \
+ * bn.##func -> integer \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self) \
{ \
@@ -522,6 +630,11 @@ ossl_bn_copy(VALUE self, VALUE other)
}
#define BIGNUM_CMP(func) \
+ /* \
+ * call-seq: \
+ * bn.##func(bn2) -> integer \
+ * \
+ */ \
static VALUE \
ossl_bn_##func(VALUE self, VALUE other) \
{ \
@@ -541,6 +654,14 @@ ossl_bn_eql(VALUE self, VALUE other)
return Qfalse;
}
+/*
+ * call-seq:
+ * bn.prime? => true | false
+ * bn.prime?(checks) => true | false
+ *
+ * === Parameters
+ * * +checks+ - integer
+ */
static VALUE
ossl_bn_is_prime(int argc, VALUE *argv, VALUE self)
{
@@ -564,6 +685,16 @@ ossl_bn_is_prime(int argc, VALUE *argv, VALUE self)
return Qnil;
}
+/*
+ * call-seq:
+ * bn.prime_fasttest? => true | false
+ * bn.prime_fasttest?(checks) => true | false
+ * bn.prime_fasttest?(checks, trial_div) => true | false
+ *
+ * === Parameters
+ * * +checks+ - integer
+ * * +trial_div+ - boolean
+ */
static VALUE
ossl_bn_is_prime_fasttest(int argc, VALUE *argv, VALUE self)
{
@@ -676,8 +807,10 @@ Init_ossl_bn()
rb_define_method(cBN, "bit_set?", ossl_bn_is_bit_set, 1);
rb_define_method(cBN, "mask_bits!", ossl_bn_mask_bits, 1);
rb_define_method(cBN, "<<", ossl_bn_lshift, 1);
- /* lshift1 - DON'T IMPL. */
rb_define_method(cBN, ">>", ossl_bn_rshift, 1);
+ rb_define_method(cBN, "lshift!", ossl_bn_self_lshift, 1);
+ rb_define_method(cBN, "rshift!", ossl_bn_self_rshift, 1);
+ /* lshift1 - DON'T IMPL. */
/* rshift1 - DON'T IMPL. */
/*
diff --git a/ext/openssl/ossl_bn.h b/ext/openssl/ossl_bn.h