summaryrefslogtreecommitdiff
path: root/spec/ruby/core/process/status/success_spec.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-30 09:30:21 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-30 11:41:10 +0900
commit41012f2e2b71fddc9acf8a50d887707c44ad8f88 (patch)
tree08c7de279b3f11ce1e6e6da731721050060f319c /spec/ruby/core/process/status/success_spec.rb
parent78a8888c3eb6377218e8d3ec94a162c2c20eef82 (diff)
Add parentheses to suppress warnings
Diffstat (limited to 'spec/ruby/core/process/status/success_spec.rb')
0 files changed, 0 insertions, 0 deletions
.4%;'/> -rw-r--r--LEGAL371
-rw-r--r--LGPL504
-rw-r--r--MANIFEST237
-rw-r--r--Makefile.in465
-rw-r--r--README116
-rw-r--r--README.EXT1090
-rw-r--r--README.EXT.ja (renamed from README.EXT.jp)647
-rw-r--r--README.ja (renamed from README.jp)114
-rw-r--r--ToDo130
-rw-r--r--array.c2954
-rw-r--r--bcc32/Makefile.sub585
-rw-r--r--bcc32/README.bcc32125
-rw-r--r--bcc32/configure.bat32
-rw-r--r--bcc32/mkexports.rb25
-rw-r--r--bcc32/setup.mak89
-rw-r--r--beos/ruby.def.in353
-rw-r--r--bignum.c1681
-rwxr-xr-xbin/erb139
-rw-r--r--bin/irb21
-rw-r--r--bin/rdoc67
-rwxr-xr-xbin/ri49
-rwxr-xr-xbin/testrb5
-rw-r--r--class.c793
-rw-r--r--compar.c215
-rw-r--r--config.guess1190
-rw-r--r--config.sub819
-rw-r--r--config_h.dj64
-rw-r--r--config_s.dj49
-rw-r--r--configure4273
-rw-r--r--configure.bat6
-rw-r--r--configure.in1397
-rw-r--r--cygwin/GNUmakefile.in65
-rw-r--r--defines.h237
-rw-r--r--dir.c1320
-rw-r--r--djgpp/GNUmakefile.in2
-rw-r--r--djgpp/README.djgpp21
-rw-r--r--djgpp/config.hin114
-rw-r--r--djgpp/config.sed128
-rw-r--r--djgpp/configure.bat20
-rw-r--r--djgpp/mkver.sed1
-rw-r--r--dln.c612
-rw-r--r--dln.h32
-rw-r--r--doc/ChangeLog-1.8.024345
-rw-r--r--doc/NEWS837
-rw-r--r--doc/forwardable.rd84
-rw-r--r--doc/forwardable.rd.ja81
-rw-r--r--doc/irb/irb-tools.rd.ja185
-rw-r--r--doc/irb/irb.rd392
-rw-r--r--doc/irb/irb.rd.ja411
-rw-r--r--doc/shell.rd348
-rw-r--r--doc/shell.rd.ja336
-rw-r--r--enum.c891
-rw-r--r--env.h34
-rw-r--r--error.c1302
-rw-r--r--eval.c11903
-rw-r--r--ext/.cvsignore2
-rw-r--r--ext/.document5
-rw-r--r--ext/Setup30
-rw-r--r--ext/Setup.atheos33
-rw-r--r--ext/Setup.dj35
-rw-r--r--ext/Setup.emx33
-rw-r--r--ext/Setup.nt35
-rw-r--r--ext/Setup.x6831
-rw-r--r--ext/Win32API/.cvsignore3
-rw-r--r--ext/Win32API/MANIFEST7
-rw-r--r--ext/Win32API/Win32API.c243
-rw-r--r--ext/Win32API/depend1
-rw-r--r--ext/Win32API/extconf.rb8
-rw-r--r--ext/Win32API/lib/win32/registry.rb831
-rw-r--r--ext/Win32API/lib/win32/resolv.rb366
-rw-r--r--ext/aix_ld.rb73
-rw-r--r--ext/bigdecimal/.cvsignore3
-rw-r--r--ext/bigdecimal/README60
-rw-r--r--ext/bigdecimal/bigdecimal.c4057
-rw-r--r--ext/bigdecimal/bigdecimal.def2
-rw-r--r--ext/bigdecimal/bigdecimal.h216
-rw-r--r--ext/bigdecimal/bigdecimal_en.html797
-rw-r--r--ext/bigdecimal/bigdecimal_ja.html798
-rw-r--r--ext/bigdecimal/depend1
-rw-r--r--ext/bigdecimal/extconf.rb2
-rw-r--r--ext/bigdecimal/lib/bigdecimal/jacobian.rb63
-rw-r--r--ext/bigdecimal/lib/bigdecimal/ludcmp.rb77
-rw-r--r--ext/bigdecimal/lib/bigdecimal/math.rb196
-rw-r--r--ext/bigdecimal/lib/bigdecimal/newton.rb75
-rw-r--r--ext/bigdecimal/lib/bigdecimal/nlsolve.rb38
-rw-r--r--ext/bigdecimal/lib/bigdecimal/util.rb68
-rw-r--r--ext/bigdecimal/sample/linear.rb71
-rw-r--r--ext/bigdecimal/sample/nlsolve.rb38
-rw-r--r--ext/bigdecimal/sample/pi.rb20
-rw-r--r--ext/curses/.cvsignore3
-rw-r--r--ext/curses/MANIFEST6
-rw-r--r--ext/curses/curses.c1365
-rw-r--r--ext/curses/depend1
-rw-r--r--ext/curses/extconf.rb39
-rw-r--r--ext/curses/hello.rb2
-rw-r--r--ext/curses/mouse.rb53
-rw-r--r--ext/curses/view2.rb115
-rw-r--r--ext/cygwin32_ld.rb90
-rw-r--r--ext/dbm/.cvsignore3
-rw-r--r--ext/dbm/MANIFEST4
-rw-r--r--ext/dbm/dbm.c497
-rw-r--r--ext/dbm/depend2
-rw-r--r--ext/dbm/extconf.rb64
-rw-r--r--ext/dbm/testdbm.rb593
-rw-r--r--ext/digest/.cvsignore3
-rw-r--r--ext/digest/defs.h37
-rw-r--r--ext/digest/depend2
-rw-r--r--ext/digest/digest.c316
-rw-r--r--ext/digest/digest.h32
-rw-r--r--ext/digest/digest.txt113
-rw-r--r--ext/digest/digest.txt.ja111
-rw-r--r--ext/digest/extconf.rb6
-rw-r--r--ext/digest/lib/md5.rb14
-rw-r--r--ext/digest/lib/sha1.rb14
-rw-r--r--ext/digest/md5/.cvsignore3
-rw-r--r--ext/digest/md5/depend6
-rw-r--r--ext/digest/md5/extconf.rb26
-rw-r--r--ext/digest/md5/md5.c432
-rw-r--r--ext/digest/md5/md5.h83
-rw-r--r--ext/digest/md5/md5init.c35
-rw-r--r--ext/digest/md5/md5ossl.c30
-rw-r--r--ext/digest/md5/md5ossl.h11
-rw-r--r--ext/digest/rmd160/.cvsignore3
-rw-r--r--ext/digest/rmd160/depend8
-rw-r--r--ext/digest/rmd160/extconf.rb25
-rw-r--r--ext/digest/rmd160/rmd160.c464
-rw-r--r--ext/digest/rmd160/rmd160.h68
-rw-r--r--ext/digest/rmd160/rmd160hl.c96
-rw-r--r--ext/digest/rmd160/rmd160init.c38
-rw-r--r--ext/digest/rmd160/rmd160ossl.c45
-rw-r--r--ext/digest/rmd160/rmd160ossl.h20
-rw-r--r--ext/digest/sha1/.cvsignore3
-rw-r--r--ext/digest/sha1/depend8
-rw-r--r--ext/digest/sha1/extconf.rb25
-rw-r--r--ext/digest/sha1/sha1.c283
-rw-r--r--ext/digest/sha1/sha1.h50
-rw-r--r--ext/digest/sha1/sha1hl.c102
-rw-r--r--ext/digest/sha1/sha1init.c38
-rw-r--r--ext/digest/sha1/sha1ossl.c45
-rw-r--r--ext/digest/sha1/sha1ossl.h16
-rw-r--r--ext/digest/sha2/.cvsignore3
-rw-r--r--ext/digest/sha2/depend7
-rw-r--r--ext/digest/sha2/extconf.rb28
-rw-r--r--ext/digest/sha2/sha2.c937
-rw-r--r--ext/digest/sha2/sha2.h133
-rw-r--r--ext/digest/sha2/sha2hl.c252
-rw-r--r--ext/digest/sha2/sha2init.c47
-rw-r--r--ext/digest/test.sh33
-rw-r--r--ext/dl/.cvsignore8
-rw-r--r--ext/dl/depend46
-rw-r--r--ext/dl/dl.c714
-rw-r--r--ext/dl/dl.def59
-rw-r--r--ext/dl/dl.h313
-rw-r--r--ext/dl/doc/dl.txt266
-rw-r--r--ext/dl/extconf.rb193
-rw-r--r--ext/dl/h2rb500
-rw-r--r--ext/dl/handle.c215
-rw-r--r--ext/dl/install.rb49
-rw-r--r--ext/dl/lib/dl/import.rb215
-rw-r--r--ext/dl/lib/dl/struct.rb146
-rw-r--r--ext/dl/lib/dl/types.rb180
-rw-r--r--ext/dl/lib/dl/win32.rb25
-rw-r--r--ext/dl/mkcall.rb62
-rw-r--r--ext/dl/mkcallback.rb53
-rw-r--r--ext/dl/mkcbtable.rb18
-rw-r--r--ext/dl/ptr.c1065
-rw-r--r--ext/dl/sample/c++sample.C35
-rw-r--r--ext/dl/sample/c++sample.rb60
-rw-r--r--ext/dl/sample/drives.rb70
-rw-r--r--ext/dl/sample/getch.rb5
-rw-r--r--ext/dl/sample/libc.rb69
-rw-r--r--ext/dl/sample/msgbox.rb19
-rw-r--r--ext/dl/sample/msgbox2.rb18
-rw-r--r--ext/dl/sample/stream.rb87
-rw-r--r--ext/dl/sym.c990
-rw-r--r--ext/dl/test/libtest.def28
-rw-r--r--ext/dl/test/test.c247
-rw-r--r--ext/dl/test/test.rb295
-rw-r--r--ext/dl/type.rb115
-rw-r--r--ext/enumerator/.cvsignore2
-rw-r--r--ext/enumerator/enumerator.c195
-rw-r--r--ext/enumerator/enumerator.txt102
-rw-r--r--ext/enumerator/extconf.rb2
-rw-r--r--ext/etc/.cvsignore3
-rw-r--r--ext/etc/MANIFEST5
-rw-r--r--ext/etc/depend2
-rw-r--r--ext/etc/etc.c305
-rw-r--r--ext/etc/etc.txt72
-rw-r--r--ext/etc/etc.txt.ja (renamed from ext/etc/etc.doc)5
-rw-r--r--ext/etc/extconf.rb31
-rw-r--r--ext/extmk.rb312
-rw-r--r--ext/extmk.rb.in556
-rw-r--r--ext/extmk.rb.nt501
-rw-r--r--ext/fcntl/.cvsignore3
-rw-r--r--ext/fcntl/MANIFEST3
-rw-r--r--ext/fcntl/depend2
-rw-r--r--ext/fcntl/extconf.rb2
-rw-r--r--ext/fcntl/fcntl.c8
-rw-r--r--ext/gdbm/.cvsignore3
-rw-r--r--ext/gdbm/README1
-rw-r--r--ext/gdbm/depend1
-rw-r--r--ext/gdbm/extconf.rb7
-rw-r--r--ext/gdbm/gdbm.c1030
-rw-r--r--ext/gdbm/testgdbm.rb663
-rw-r--r--ext/iconv/.cvsignore5
-rw-r--r--ext/iconv/charset_alias.rb52
-rw-r--r--ext/iconv/depend2
-rw-r--r--ext/iconv/extconf.rb49
-rw-r--r--ext/iconv/iconv.c885
-rw-r--r--ext/io/wait/.cvsignore2
-rw-r--r--ext/io/wait/extconf.rb12
-rw-r--r--ext/io/wait/lib/nonblock.rb23
-rw-r--r--ext/io/wait/wait.c106
-rw-r--r--ext/kconv/MANIFEST3
-rw-r--r--ext/kconv/depend1
-rw-r--r--ext/kconv/kconv.c2016
-rw-r--r--ext/md5/MANIFEST6
-rw-r--r--ext/md5/depend2
-rw-r--r--ext/md5/md5.doc36
-rw-r--r--ext/md5/md5.h86
-rw-r--r--ext/md5/md5c.c337
-rw-r--r--ext/md5/md5init.c94
-rw-r--r--ext/nkf/.cvsignore3
-rw-r--r--ext/nkf/depend1
-rw-r--r--ext/nkf/extconf.rb2
-rw-r--r--ext/nkf/lib/kconv.rb226
-rw-r--r--ext/nkf/nkf-utf8/config.h52
-rw-r--r--ext/nkf/nkf-utf8/nkf.c4060
-rw-r--r--ext/nkf/nkf-utf8/utf8tbl.c5313
-rw-r--r--ext/nkf/nkf.c289
-rw-r--r--ext/nkf/test.rb706
-rw-r--r--ext/openssl/.cvsignore4
-rw-r--r--ext/openssl/extconf.rb145
-rw-r--r--ext/openssl/lib/net/ftptls.rb43
-rw-r--r--ext/openssl/lib/net/https.rb188
-rw-r--r--ext/openssl/lib/net/protocols.rb56
-rw-r--r--ext/openssl/lib/net/telnets.rb250
-rw-r--r--ext/openssl/lib/openssl.rb24
-rw-r--r--ext/openssl/lib/openssl/bn.rb35
-rw-r--r--ext/openssl/lib/openssl/buffering.rb200
-rw-r--r--ext/openssl/lib/openssl/cipher.rb52
-rw-r--r--ext/openssl/lib/openssl/digest.rb44
-rw-r--r--ext/openssl/lib/openssl/ssl.rb93
-rw-r--r--ext/openssl/lib/openssl/x509.rb71
-rw-r--r--ext/openssl/openssl_missing.c338
-rw-r--r--ext/openssl/openssl_missing.h126
-rw-r--r--ext/openssl/ossl.c449
-rw-r--r--ext/openssl/ossl.h217
-rw-r--r--ext/openssl/ossl_asn1.c1156
-rw-r--r--ext/openssl/ossl_asn1.h54
-rw-r--r--ext/openssl/ossl_bio.c70
-rw-r--r--ext/openssl/ossl_bio.h21
-rw-r--r--ext/openssl/ossl_bn.c719
-rw-r--r--ext/openssl/ossl_bn.h22
-rw-r--r--ext/openssl/ossl_cipher.c377
-rw-r--r--ext/openssl/ossl_cipher.h23
-rw-r--r--ext/openssl/ossl_config.c455
-rw-r--r--ext/openssl/ossl_config.h22
-rw-r--r--ext/openssl/ossl_digest.c294
-rw-r--r--ext/openssl/ossl_digest.h23
-rw-r--r--ext/openssl/ossl_engine.c329
-rw-r--r--ext/openssl/ossl_engine.h20
-rw-r--r--ext/openssl/ossl_hmac.c220
-rw-r--r--ext/openssl/ossl_hmac.h19
-rw-r--r--ext/openssl/ossl_ns_spki.c230
-rw-r--r--ext/openssl/ossl_ns_spki.h21
-rw-r--r--ext/openssl/ossl_ocsp.c765
-rw-r--r--ext/openssl/ossl_ocsp.h24
-rw-r--r--ext/openssl/ossl_pkcs12.c154
-rw-r--r--ext/openssl/ossl_pkcs12.h16
-rw-r--r--ext/openssl/ossl_pkcs7.c858
-rw-r--r--ext/openssl/ossl_pkcs7.h22
-rw-r--r--ext/openssl/ossl_pkey.c221
-rw-r--r--ext/openssl/ossl_pkey.h113
-rw-r--r--ext/openssl/ossl_pkey_dh.c395
-rw-r--r--ext/openssl/ossl_pkey_dsa.c423
-rw-r--r--ext/openssl/ossl_pkey_rsa.c503
-rw-r--r--ext/openssl/ossl_rand.c130
-rw-r--r--ext/openssl/ossl_rand.h20
-rw-r--r--ext/openssl/ossl_ssl.c793
-rw-r--r--ext/openssl/ossl_ssl.h21
-rw-r--r--ext/openssl/ossl_version.h16
-rw-r--r--ext/openssl/ossl_x509.c104
-rw-r--r--ext/openssl/ossl_x509.h114
-rw-r--r--ext/openssl/ossl_x509attr.c249
-rw-r--r--ext/openssl/ossl_x509cert.c672
-rw-r--r--ext/openssl/ossl_x509crl.c537
-rw-r--r--ext/openssl/ossl_x509ext.c439
-rw-r--r--ext/openssl/ossl_x509name.c311
-rw-r--r--ext/openssl/ossl_x509req.c466
-rw-r--r--ext/openssl/ossl_x509revoked.c229
-rw-r--r--ext/openssl/ossl_x509store.c559
-rw-r--r--ext/openssl/ruby_missing.h18
-rw-r--r--ext/pty/.cvsignore3
-rw-r--r--ext/pty/README65
-rw-r--r--ext/pty/README.expect22
-rw-r--r--ext/pty/README.expect.ja21
-rw-r--r--ext/pty/README.ja89
-rw-r--r--ext/pty/depend1
-rw-r--r--ext/pty/expect_sample.rb55
-rw-r--r--ext/pty/extconf.rb15
-rw-r--r--ext/pty/lib/expect.rb36
-rw-r--r--ext/pty/pty.c485
-rw-r--r--ext/pty/script.rb37
-rw-r--r--ext/pty/shl.rb92
-rw-r--r--ext/racc/cparse/.cvsignore3
-rw-r--r--ext/racc/cparse/cparse.c824
-rw-r--r--ext/racc/cparse/depend1
-rw-r--r--ext/racc/cparse/extconf.rb4
-rw-r--r--ext/readline/.cvsignore3
-rw-r--r--ext/readline/README62
-rw-r--r--ext/readline/README.ja63
-rw-r--r--ext/readline/depend1
-rw-r--r--ext/readline/extconf.rb30
-rw-r--r--ext/readline/readline.c743
-rw-r--r--ext/sdbm/.cvsignore3
-rw-r--r--ext/sdbm/_sdbm.c (renamed from win32/sdbm.c)56
-rw-r--r--ext/sdbm/depend2
-rw-r--r--ext/sdbm/extconf.rb3
-rw-r--r--ext/sdbm/init.c785
-rw-r--r--ext/sdbm/sdbm.h (renamed from win32/sdbm.h)36
-rw-r--r--ext/sdbm/testsdbm.rb556
-rw-r--r--ext/socket/.cvsignore3
-rw-r--r--ext/socket/MANIFEST4
-rw-r--r--ext/socket/addrinfo.h172
-rw-r--r--ext/socket/depend4
-rw-r--r--ext/socket/extconf.rb386
-rw-r--r--ext/socket/getaddrinfo.c693
-rw-r--r--ext/socket/getnameinfo.c268
-rw-r--r--ext/socket/socket.c2722
-rw-r--r--ext/socket/sockport.h76
-rw-r--r--ext/stringio/.cvsignore3
-rw-r--r--ext/stringio/README19
-rw-r--r--ext/stringio/depend2
-rw-r--r--ext/stringio/extconf.rb2
-rw-r--r--ext/stringio/stringio.c1017
-rw-r--r--ext/strscan/.cvsignore3
-rw-r--r--ext/strscan/depend1
-rw-r--r--ext/strscan/extconf.rb2
-rw-r--r--ext/strscan/strscan.c1346
-rw-r--r--ext/syck/.cvsignore3
-rw-r--r--ext/syck/bytecode.c1171
-rw-r--r--ext/syck/depend12
-rw-r--r--ext/syck/emitter.c444
-rw-r--r--ext/syck/extconf.rb5
-rw-r--r--ext/syck/gram.c1796
-rw-r--r--ext/syck/gram.h81
-rw-r--r--ext/syck/handler.c156
-rw-r--r--ext/syck/implicit.c2965
-rw-r--r--ext/syck/node.c337
-rw-r--r--ext/syck/rubyext.c1581
-rw-r--r--ext/syck/syck.c506
-rw-r--r--ext/syck/syck.h409
-rw-r--r--ext/syck/token.c2636
-rw-r--r--ext/syck/yaml2byte.c251
-rw-r--r--ext/syck/yamlbyte.h170
-rw-r--r--ext/syslog/.cvsignore3
-rw-r--r--ext/syslog/depend2
-rw-r--r--ext/syslog/extconf.rb10
-rw-r--r--ext/syslog/syslog.c394
-rw-r--r--ext/syslog/syslog.txt121
-rw-r--r--ext/syslog/test.rb164
-rw-r--r--ext/tcltklib/.cvsignore3
-rw-r--r--ext/tcltklib/MANIFEST15
-rw-r--r--ext/tcltklib/MANUAL.eng420
-rw-r--r--ext/tcltklib/MANUAL.euc409
-rw-r--r--ext/tcltklib/README.1st55
-rw-r--r--ext/tcltklib/README.ActiveTcl49
-rw-r--r--ext/tcltklib/README.euc26
-rw-r--r--ext/tcltklib/demo/lines1.rb26
-rw-r--r--ext/tcltklib/demo/lines2.rb26
-rw-r--r--ext/tcltklib/demo/lines3.rb54
-rw-r--r--ext/tcltklib/demo/lines4.rb54
-rw-r--r--ext/tcltklib/demo/safeTk.rb22
-rw-r--r--ext/tcltklib/depend3
-rw-r--r--ext/tcltklib/extconf.rb305
-rw-r--r--ext/tcltklib/lib/tcltk.rb313
-rw-r--r--ext/tcltklib/sample/sample1.rb6
-rw-r--r--ext/tcltklib/sample/sample2.rb504
-rw-r--r--ext/tcltklib/stubs.c104
-rw-r--r--ext/tcltklib/tcltklib.c6358
-rw-r--r--ext/tk/.cvsignore3
-rw-r--r--ext/tk/ChangeLog.tkextlib87
-rw-r--r--ext/tk/README.1st23
-rw-r--r--ext/tk/README.fork34
-rw-r--r--ext/tk/depend1
-rw-r--r--ext/tk/extconf.rb4
-rw-r--r--ext/tk/lib/README30
-rw-r--r--ext/tk/lib/multi-tk.rb2381
-rw-r--r--ext/tk/lib/remote-tk.rb468
-rw-r--r--ext/tk/lib/tk.rb3871
-rw-r--r--ext/tk/lib/tk/after.rb6
-rw-r--r--ext/tk/lib/tk/autoload.rb192
-rw-r--r--ext/tk/lib/tk/bgerror.rb29
-rw-r--r--ext/tk/lib/tk/bindtag.rb79
-rw-r--r--ext/tk/lib/tk/button.rb27
-rw-r--r--ext/tk/lib/tk/canvas.rb701
-rw-r--r--ext/tk/lib/tk/canvastag.rb351
-rw-r--r--ext/tk/lib/tk/checkbutton.rb25
-rw-r--r--ext/tk/lib/tk/clipboard.rb75
-rw-r--r--ext/tk/lib/tk/clock.rb57
-rw-r--r--ext/tk/lib/tk/composite.rb293
-rw-r--r--ext/tk/lib/tk/console.rb29
-rw-r--r--ext/tk/lib/tk/dialog.rb293
-rw-r--r--ext/tk/lib/tk/encodedstr.rb107
-rw-r--r--ext/tk/lib/tk/entry.rb110
-rw-r--r--ext/tk/lib/tk/event.rb180
-rw-r--r--ext/tk/lib/tk/font.rb1464
-rw-r--r--ext/tk/lib/tk/frame.rb123
-rw-r--r--ext/tk/lib/tk/grid.rb211
-rw-r--r--ext/tk/lib/tk/image.rb186
-rw-r--r--ext/tk/lib/tk/itemconfig.rb794
-rw-r--r--ext/tk/lib/tk/itemfont.rb300
-rw-r--r--ext/tk/lib/tk/kinput.rb71
-rw-r--r--ext/tk/lib/tk/label.rb22
-rw-r--r--ext/tk/lib/tk/labelframe.rb20
-rw-r--r--ext/tk/lib/tk/listbox.rb273
-rw-r--r--ext/tk/lib/tk/macpkg.rb68
-rw-r--r--ext/tk/lib/tk/menu.rb488
-rw-r--r--ext/tk/lib/tk/menubar.rb131
-rw-r--r--ext/tk/lib/tk/menuspec.rb265
-rw-r--r--ext/tk/lib/tk/message.rb19
-rw-r--r--ext/tk/lib/tk/mngfocus.rb33
-rw-r--r--ext/tk/lib/tk/msgcat.rb286
-rw-r--r--ext/tk/lib/tk/namespace.rb294
-rw-r--r--ext/tk/lib/tk/optiondb.rb370
-rw-r--r--ext/tk/lib/tk/optionobj.rb212
-rw-r--r--ext/tk/lib/tk/pack.rb90
-rw-r--r--ext/tk/lib/tk/package.rb139
-rw-r--r--ext/tk/lib/tk/palette.rb (renamed from lib/tkpalette.rb)22
-rw-r--r--ext/tk/lib/tk/panedwindow.rb204
-rw-r--r--ext/tk/lib/tk/place.rb128
-rw-r--r--ext/tk/lib/tk/radiobutton.rb32
-rw-r--r--ext/tk/lib/tk/root.rb86
-rw-r--r--ext/tk/lib/tk/scale.rb81
-rw-r--r--ext/tk/lib/tk/scrollable.rb79
-rw-r--r--ext/tk/lib/tk/scrollbar.rb124
-rw-r--r--ext/tk/lib/tk/scrollbox.rb (renamed from lib/tkscrollbox.rb)21
-rw-r--r--ext/tk/lib/tk/selection.rb86
-rw-r--r--ext/tk/lib/tk/spinbox.rb39
-rw-r--r--ext/tk/lib/tk/tagfont.rb43
-rw-r--r--ext/tk/lib/tk/text.rb1285
-rw-r--r--ext/tk/lib/tk/textimage.rb72
-rw-r--r--ext/tk/lib/tk/textmark.rb135
-rw-r--r--ext/tk/lib/tk/texttag.rb253
-rw-r--r--ext/tk/lib/tk/textwindow.rb137
-rw-r--r--ext/tk/lib/tk/timer.rb490
-rw-r--r--ext/tk/lib/tk/toplevel.rb232
-rw-r--r--ext/tk/lib/tk/txtwin_abst.rb39
-rw-r--r--ext/tk/lib/tk/validation.rb373
-rw-r--r--ext/tk/lib/tk/variable.rb1016
-rw-r--r--ext/tk/lib/tk/virtevent.rb90
-rw-r--r--ext/tk/lib/tk/winfo.rb387
-rw-r--r--ext/tk/lib/tk/winpkg.rb138
-rw-r--r--ext/tk/lib/tk/wm.rb280
-rw-r--r--ext/tk/lib/tk/xim.rb122
-rw-r--r--ext/tk/lib/tkafter.rb4
-rw-r--r--ext/tk/lib/tkbgerror.rb4
-rw-r--r--ext/tk/lib/tkcanvas.rb4
-rw-r--r--ext/tk/lib/tkclass.rb (renamed from lib/tkclass.rb)15
-rw-r--r--ext/tk/lib/tkconsole.rb4
-rw-r--r--ext/tk/lib/tkdialog.rb4
-rw-r--r--ext/tk/lib/tkentry.rb4
-rw-r--r--ext/tk/lib/tkextlib/ICONS.rb13
-rw-r--r--ext/tk/lib/tkextlib/ICONS/icons.rb108
-rw-r--r--ext/tk/lib/tkextlib/ICONS/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/SUPPORT_STATUS173
-rw-r--r--ext/tk/lib/tkextlib/bwidget.rb146
-rw-r--r--ext/tk/lib/tkextlib/bwidget/arrowbutton.rb21
-rw-r--r--ext/tk/lib/tkextlib/bwidget/bitmap.rb21
-rw-r--r--ext/tk/lib/tkextlib/bwidget/button.rb21
-rw-r--r--ext/tk/lib/tkextlib/bwidget/buttonbox.rb73
-rw-r--r--ext/tk/lib/tkextlib/bwidget/combobox.rb45
-rw-r--r--ext/tk/lib/tkextlib/bwidget/dialog.rb147
-rw-r--r--ext/tk/lib/tkextlib/bwidget/dragsite.rb31
-rw-r--r--ext/tk/lib/tkextlib/bwidget/dropsite.rb39
-rw-r--r--ext/tk/lib/tkextlib/bwidget/dynamichelp.rb51
-rw-r--r--ext/tk/lib/tkextlib/bwidget/entry.rb28
-rw-r--r--ext/tk/lib/tkextlib/bwidget/label.rb26
-rw-r--r--ext/tk/lib/tkextlib/bwidget/labelentry.rb45
-rw-r--r--ext/tk/lib/tkextlib/bwidget/labelframe.rb30
-rw-r--r--ext/tk/lib/tkextlib/bwidget/listbox.rb290
-rw-r--r--ext/tk/lib/tkextlib/bwidget/mainframe.rb73
-rw-r--r--ext/tk/lib/tkextlib/bwidget/messagedlg.rb167
-rw-r--r--ext/tk/lib/tkextlib/bwidget/notebook.rb116
-rw-r--r--ext/tk/lib/tkextlib/bwidget/pagesmanager.rb61
-rw-r--r--ext/tk/lib/tkextlib/bwidget/panedwindow.rb31
-rw-r--r--ext/tk/lib/tkextlib/bwidget/passwddlg.rb27
-rw-r--r--ext/tk/lib/tkextlib/bwidget/progressbar.rb20
-rw-r--r--ext/tk/lib/tkextlib/bwidget/progressdlg.rb54
-rw-r--r--ext/tk/lib/tkextlib/bwidget/scrollableframe.rb34
-rw-r--r--ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb32
-rw-r--r--ext/tk/lib/tkextlib/bwidget/scrollview.rb20
-rw-r--r--ext/tk/lib/tkextlib/bwidget/selectcolor.rb45
-rw-r--r--ext/tk/lib/tkextlib/bwidget/selectfont.rb79
-rw-r--r--ext/tk/lib/tkextlib/bwidget/separator.rb20
-rw-r--r--ext/tk/lib/tkextlib/bwidget/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/bwidget/spinbox.rb58
-rw-r--r--ext/tk/lib/tkextlib/bwidget/titleframe.rb27
-rw-r--r--ext/tk/lib/tkextlib/bwidget/tree.rb374
-rw-r--r--ext/tk/lib/tkextlib/bwidget/widget.rb113
-rw-r--r--ext/tk/lib/tkextlib/itcl.rb13
-rw-r--r--ext/tk/lib/tkextlib/itcl/incr_tcl.rb167
-rw-r--r--ext/tk/lib/tkextlib/itcl/setup.rb13
-rw-r--r--ext/tk/lib/tkextlib/itk.rb13
-rw-r--r--ext/tk/lib/tkextlib/itk/incr_tk.rb383
-rw-r--r--ext/tk/lib/tkextlib/itk/setup.rb13
-rw-r--r--ext/tk/lib/tkextlib/iwidgets.rb89
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/buttonbox.rb114
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/calendar.rb88
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb43
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/canvasprintdialog.rb38
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/checkbox.rb111
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/combobox.rb99
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/dateentry.rb20
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/datefield.rb43
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/dialog.rb20
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/dialogshell.rb114
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb45
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/entryfield.rb161
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/extbutton.rb30
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb33
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/extfileselectiondialog.rb33
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/feedback.rb30
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb33
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/fileselectiondialog.rb33
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/finddialog.rb29
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/hierarchy.rb294
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb40
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/labeledframe.rb24
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb30
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/mainwindow.rb52
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/menubar.rb190
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/messagebox.rb81
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/messagedialog.rb20
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/notebook.rb163
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/optionmenu.rb87
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/panedwindow.rb127
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/promptdialog.rb131
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/pushbutton.rb30
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/radiobox.rb111
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scopedobject.rb24
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb315
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledframe.rb59
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb43
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb190
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb518
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledwidget.rb20
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/selectionbox.rb92
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/selectiondialog.rb92
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/shell.rb38
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/spindate.rb38
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/spinint.rb20
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/spinner.rb150
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/spintime.rb38
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb154
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/tabset.rb89
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/timeentry.rb20
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/timefield.rb43
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/toolbar.rb87
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/watch.rb45
-rwxr-xr-xext/tk/lib/tkextlib/pkg_checker.rb184
-rw-r--r--ext/tk/lib/tkextlib/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tcllib.rb69
-rw-r--r--ext/tk/lib/tkextlib/tcllib/README135
-rw-r--r--ext/tk/lib/tkextlib/tcllib/autoscroll.rb143
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ctext.rb143
-rw-r--r--ext/tk/lib/tkextlib/tcllib/cursor.rb90
-rw-r--r--ext/tk/lib/tkextlib/tcllib/datefield.rb52
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ico.rb109
-rw-r--r--ext/tk/lib/tkextlib/tcllib/ip_entry.rb55
-rw-r--r--ext/tk/lib/tkextlib/tcllib/plotchart.rb708
-rw-r--r--ext/tk/lib/tkextlib/tcllib/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tcllib/style.rb55
-rw-r--r--ext/tk/lib/tkextlib/tcllib/tkpiechart.rb287
-rw-r--r--ext/tk/lib/tkextlib/tclx.rb13
-rw-r--r--ext/tk/lib/tkextlib/tclx/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tclx/tclx.rb59
-rw-r--r--ext/tk/lib/tkextlib/tile.rb69
-rw-r--r--ext/tk/lib/tkextlib/tile/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tile/style.rb70
-rw-r--r--ext/tk/lib/tkextlib/tile/tbutton.rb30
-rw-r--r--ext/tk/lib/tkextlib/tile/tcheckbutton.rb31
-rw-r--r--ext/tk/lib/tkextlib/tile/tlabel.rb30
-rw-r--r--ext/tk/lib/tkextlib/tile/tmenubutton.rb30
-rw-r--r--ext/tk/lib/tkextlib/tile/tnotebook.rb92
-rw-r--r--ext/tk/lib/tkextlib/tile/tradiobutton.rb31
-rw-r--r--ext/tk/lib/tkextlib/tkDND.rb18
-rw-r--r--ext/tk/lib/tkextlib/tkDND/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tkDND/shape.rb117
-rw-r--r--ext/tk/lib/tkextlib/tkDND/tkdnd.rb124
-rw-r--r--ext/tk/lib/tkextlib/tkHTML.rb13
-rw-r--r--ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb433
-rw-r--r--ext/tk/lib/tkextlib/tkHTML/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tkimg.rb31
-rw-r--r--ext/tk/lib/tkextlib/tkimg/README26
-rw-r--r--ext/tk/lib/tkextlib/tkimg/bmp.rb28
-rw-r--r--ext/tk/lib/tkextlib/tkimg/gif.rb28
-rw-r--r--ext/tk/lib/tkextlib/tkimg/ico.rb28
-rw-r--r--ext/tk/lib/tkextlib/tkimg/jpeg.rb28
-rw-r--r--ext/tk/lib/tkextlib/tkimg/pcx.rb28
-rw-r--r--ext/tk/lib/tkextlib/tkimg/pixmap.rb39
-rw-r--r--ext/tk/lib/tkextlib/tkimg/png.rb28
-rw-r--r--ext/tk/lib/tkextlib/tkimg/ppm.rb28
-rw-r--r--ext/tk/lib/tkextlib/tkimg/ps.rb28
-rw-r--r--ext/tk/lib/tkextlib/tkimg/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tkimg/sgi.rb28
-rw-r--r--ext/tk/lib/tkextlib/tkimg/sun.rb28
-rw-r--r--ext/tk/lib/tkextlib/tkimg/tga.rb28
-rw-r--r--ext/tk/lib/tkextlib/tkimg/tiff.rb28
-rw-r--r--ext/tk/lib/tkextlib/tkimg/window.rb28
-rw-r--r--ext/tk/lib/tkextlib/tkimg/xbm.rb28
-rw-r--r--ext/tk/lib/tkextlib/tkimg/xpm.rb28
-rw-r--r--ext/tk/lib/tkextlib/tktable.rb14
-rw-r--r--ext/tk/lib/tkextlib/tktable/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tktable/tktable.rb796
-rw-r--r--ext/tk/lib/tkextlib/tktrans.rb14
-rw-r--r--ext/tk/lib/tkextlib/tktrans/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/tktrans/tktrans.rb59
-rw-r--r--ext/tk/lib/tkextlib/treectrl.rb13
-rw-r--r--ext/tk/lib/tkextlib/treectrl/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/treectrl/tktreectrl.rb923
-rw-r--r--ext/tk/lib/tkextlib/vu.rb43
-rw-r--r--ext/tk/lib/tkextlib/vu/bargraph.rb51
-rw-r--r--ext/tk/lib/tkextlib/vu/charts.rb47
-rw-r--r--ext/tk/lib/tkextlib/vu/dial.rb102
-rw-r--r--ext/tk/lib/tkextlib/vu/pie.rb235
-rw-r--r--ext/tk/lib/tkextlib/vu/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/vu/spinbox.rb22
-rw-r--r--ext/tk/lib/tkextlib/winico.rb14
-rw-r--r--ext/tk/lib/tkextlib/winico/setup.rb8
-rw-r--r--ext/tk/lib/tkextlib/winico/winico.rb181
-rw-r--r--ext/tk/lib/tkfont.rb4
-rw-r--r--ext/tk/lib/tkmacpkg.rb4
-rw-r--r--ext/tk/lib/tkmenubar.rb4
-rw-r--r--ext/tk/lib/tkmngfocus.rb4
-rw-r--r--ext/tk/lib/tkpalette.rb4
-rw-r--r--ext/tk/lib/tkscrollbox.rb4
-rw-r--r--ext/tk/lib/tktext.rb4
-rw-r--r--ext/tk/lib/tkvirtevent.rb4
-rw-r--r--ext/tk/lib/tkwinpkg.rb4
-rw-r--r--ext/tk/sample/binding_sample.rb87
-rw-r--r--ext/tk/sample/bindtag_sample.rb127
-rw-r--r--ext/tk/sample/binstr_usage.rb39
-rw-r--r--ext/tk/sample/btn_with_frame.rb20
-rw-r--r--ext/tk/sample/cmd_res_test.rb17
-rw-r--r--ext/tk/sample/cmd_resource5
-rw-r--r--ext/tk/sample/demos-en/ChangeLog64
-rw-r--r--ext/tk/sample/demos-en/ChangeLog.prev9
-rw-r--r--ext/tk/sample/demos-en/README138
-rw-r--r--ext/tk/sample/demos-en/README.1st18
-rw-r--r--ext/tk/sample/demos-en/README.tkencoding29
-rw-r--r--ext/tk/sample/demos-en/arrow.rb239
-rw-r--r--ext/tk/sample/demos-en/bind.rb110
-rw-r--r--ext/tk/sample/demos-en/bitmap.rb73
-rw-r--r--ext/tk/sample/demos-en/browse163
-rw-r--r--ext/tk/sample/demos-en/browse282
-rw-r--r--ext/tk/sample/demos-en/button.rb84
-rw-r--r--ext/tk/sample/demos-en/check.rb70
-rw-r--r--ext/tk/sample/demos-en/check2.rb107
-rw-r--r--ext/tk/sample/demos-en/clrpick.rb77
-rw-r--r--ext/tk/sample/demos-en/colors.rb148
-rw-r--r--ext/tk/sample/demos-en/cscroll.rb134
-rw-r--r--ext/tk/sample/demos-en/ctext.rb186
-rw-r--r--ext/tk/sample/demos-en/dialog1.rb38
-rw-r--r--ext/tk/sample/demos-en/dialog2.rb41
-rw-r--r--ext/tk/sample/demos-en/doc.org/README7
-rw-r--r--ext/tk/sample/demos-en/doc.org/README.JP14
-rw-r--r--ext/tk/sample/demos-en/doc.org/README.tk8046
-rw-r--r--ext/tk/sample/demos-en/doc.org/license.terms39
-rw-r--r--ext/tk/sample/demos-en/doc.org/license.terms.tk8039
-rw-r--r--ext/tk/sample/demos-en/entry1.rb56
-rw-r--r--ext/tk/sample/demos-en/entry2.rb91
-rw-r--r--ext/tk/sample/demos-en/entry3.rb200
-rw-r--r--ext/tk/sample/demos-en/filebox.rb97
-rw-r--r--ext/tk/sample/demos-en/floor.rb1721
-rw-r--r--ext/tk/sample/demos-en/floor2.rb1720
-rw-r--r--ext/tk/sample/demos-en/form.rb62
-rw-r--r--ext/tk/sample/demos-en/hello14
-rw-r--r--ext/tk/sample/demos-en/hscale.rb74
-rw-r--r--ext/tk/sample/demos-en/icon.rb99
-rw-r--r--ext/tk/sample/demos-en/image1.rb60
-rw-r--r--ext/tk/sample/demos-en/image2.rb105
-rw-r--r--ext/tk/sample/demos-en/image3.rb121
-rw-r--r--ext/tk/sample/demos-en/items.rb374
-rw-r--r--ext/tk/sample/demos-en/ixset333
-rw-r--r--ext/tk/sample/demos-en/ixset2367
-rw-r--r--ext/tk/sample/demos-en/label.rb69
-rw-r--r--ext/tk/sample/demos-en/labelframe.rb93
-rw-r--r--ext/tk/sample/demos-en/menu.rb186
-rw-r--r--ext/tk/sample/demos-en/menu84.rb213
-rw-r--r--ext/tk/sample/demos-en/menubu.rb235
-rw-r--r--ext/tk/sample/demos-en/msgbox.rb88
-rw-r--r--ext/tk/sample/demos-en/paned1.rb45
-rw-r--r--ext/tk/sample/demos-en/paned2.rb92
-rw-r--r--ext/tk/sample/demos-en/patch_1.1c193
-rw-r--r--ext/tk/sample/demos-en/plot.rb122
-rw-r--r--ext/tk/sample/demos-en/puzzle.rb120
-rw-r--r--ext/tk/sample/demos-en/radio.rb84
-rw-r--r--ext/tk/sample/demos-en/radio2.rb106
-rw-r--r--ext/tk/sample/demos-en/radio3.rb114
-rw-r--r--ext/tk/sample/demos-en/rmt268
-rw-r--r--ext/tk/sample/demos-en/rolodex320
-rw-r--r--ext/tk/sample/demos-en/rolodex-j323
-rw-r--r--ext/tk/sample/demos-en/ruler.rb203
-rw-r--r--ext/tk/sample/demos-en/sayings.rb104
-rw-r--r--ext/tk/sample/demos-en/search.rb180
-rw-r--r--ext/tk/sample/demos-en/spin.rb63
-rw-r--r--ext/tk/sample/demos-en/square81
-rw-r--r--ext/tk/sample/demos-en/states.rb78
-rw-r--r--ext/tk/sample/demos-en/style.rb211
-rw-r--r--ext/tk/sample/demos-en/tcolor521
-rw-r--r--ext/tk/sample/demos-en/tcolor.bak513
-rw-r--r--ext/tk/sample/demos-en/text.rb126
-rw-r--r--ext/tk/sample/demos-en/timer136
-rw-r--r--ext/tk/sample/demos-en/tkencoding.rb42
-rw-r--r--ext/tk/sample/demos-en/twind.rb285
-rw-r--r--ext/tk/sample/demos-en/twind2.rb382
-rw-r--r--ext/tk/sample/demos-en/unicodeout.rb112
-rw-r--r--ext/tk/sample/demos-en/vscale.rb78
-rw-r--r--ext/tk/sample/demos-en/widget822
-rw-r--r--ext/tk/sample/demos-jp/README54
-rw-r--r--ext/tk/sample/demos-jp/README.1st20
-rw-r--r--ext/tk/sample/demos-jp/arrow.rb236
-rw-r--r--ext/tk/sample/demos-jp/bind.rb107
-rw-r--r--ext/tk/sample/demos-jp/bitmap.rb71
-rw-r--r--ext/tk/sample/demos-jp/browse163
-rw-r--r--ext/tk/sample/demos-jp/browse282
-rw-r--r--ext/tk/sample/demos-jp/button.rb81
-rw-r--r--ext/tk/sample/demos-jp/check.rb67
-rw-r--r--ext/tk/sample/demos-jp/check2.rb107
-rw-r--r--ext/tk/sample/demos-jp/clrpick.rb75
-rw-r--r--ext/tk/sample/demos-jp/colors.rb144
-rw-r--r--ext/tk/sample/demos-jp/cscroll.rb131
-rw-r--r--ext/tk/sample/demos-jp/ctext.rb182
-rw-r--r--ext/tk/sample/demos-jp/dialog1.rb38
-rw-r--r--ext/tk/sample/demos-jp/dialog2.rb42
-rw-r--r--ext/tk/sample/demos-jp/doc.org/README7
-rw-r--r--ext/tk/sample/demos-jp/doc.org/README.JP14
-rw-r--r--ext/tk/sample/demos-jp/doc.org/README.tk8046
-rw-r--r--ext/tk/sample/demos-jp/doc.org/license.terms39
-rw-r--r--ext/tk/sample/demos-jp/doc.org/license.terms.tk8039
-rw-r--r--ext/tk/sample/demos-jp/entry1.rb57
-rw-r--r--ext/tk/sample/demos-jp/entry2.rb88
-rw-r--r--ext/tk/sample/demos-jp/entry3.rb204
-rw-r--r--ext/tk/sample/demos-jp/filebox.rb96
-rw-r--r--ext/tk/sample/demos-jp/floor.rb1718
-rw-r--r--ext/tk/sample/demos-jp/floor2.rb1716
-rw-r--r--ext/tk/sample/demos-jp/form.rb63
-rw-r--r--ext/tk/sample/demos-jp/hello9
-rw-r--r--ext/tk/sample/demos-jp/hscale.rb77
-rw-r--r--ext/tk/sample/demos-jp/icon.rb96
-rw-r--r--ext/tk/sample/demos-jp/image1.rb58
-rw-r--r--ext/tk/sample/demos-jp/image2.rb102
-rw-r--r--ext/tk/sample/demos-jp/image3.rb122
-rw-r--r--ext/tk/sample/demos-jp/items.rb371
-rw-r--r--ext/tk/sample/demos-jp/ixset333
-rw-r--r--ext/tk/sample/demos-jp/ixset2368
-rw-r--r--ext/tk/sample/demos-jp/label.rb65
-rw-r--r--ext/tk/sample/demos-jp/labelframe.rb98
-rw-r--r--ext/tk/sample/demos-jp/menu.rb188
-rw-r--r--ext/tk/sample/demos-jp/menu84.rb210
-rw-r--r--ext/tk/sample/demos-jp/menu8x.rb222
-rw-r--r--ext/tk/sample/demos-jp/menubu.rb235
-rw-r--r--ext/tk/sample/demos-jp/msgbox.rb86
-rw-r--r--ext/tk/sample/demos-jp/paned1.rb48
-rw-r--r--ext/tk/sample/demos-jp/paned2.rb96
-rw-r--r--ext/tk/sample/demos-jp/plot.rb119
-rw-r--r--ext/tk/sample/demos-jp/puzzle.rb116
-rw-r--r--ext/tk/sample/demos-jp/radio.rb81
-rw-r--r--ext/tk/sample/demos-jp/radio2.rb107
-rw-r--r--ext/tk/sample/demos-jp/radio3.rb114
-rw-r--r--ext/tk/sample/demos-jp/rmt268
-rw-r--r--ext/tk/sample/demos-jp/rolodex320
-rw-r--r--ext/tk/sample/demos-jp/rolodex-j299
-rw-r--r--ext/tk/sample/demos-jp/ruler.rb200
-rw-r--r--ext/tk/sample/demos-jp/sayings.rb100
-rw-r--r--ext/tk/sample/demos-jp/search.rb176
-rw-r--r--ext/tk/sample/demos-jp/spin.rb67
-rw-r--r--ext/tk/sample/demos-jp/square81
-rw-r--r--ext/tk/sample/demos-jp/states.rb71
-rw-r--r--ext/tk/sample/demos-jp/style.rb248
-rw-r--r--ext/tk/sample/demos-jp/tcolor528
-rw-r--r--ext/tk/sample/demos-jp/text.rb117
-rw-r--r--ext/tk/sample/demos-jp/timer136
-rw-r--r--ext/tk/sample/demos-jp/twind.rb285
-rw-r--r--ext/tk/sample/demos-jp/twind2.rb381
-rw-r--r--ext/tk/sample/demos-jp/unicodeout.rb115
-rw-r--r--ext/tk/sample/demos-jp/vscale.rb78
-rw-r--r--ext/tk/sample/demos-jp/widget848
-rw-r--r--ext/tk/sample/encstr_usage.rb29
-rw-r--r--ext/tk/sample/images/earth.gifbin0 -> 51712 bytes-rw-r--r--ext/tk/sample/images/earthris.gifbin0 -> 6343 bytes-rw-r--r--ext/tk/sample/images/face.xbm173
-rw-r--r--ext/tk/sample/images/flagdown.xbm27
-rw-r--r--ext/tk/sample/images/flagup.xbm27
-rw-r--r--ext/tk/sample/images/gray25.xbm6
-rw-r--r--ext/tk/sample/images/grey.256
-rw-r--r--ext/tk/sample/images/grey.56
-rw-r--r--ext/tk/sample/images/letters.xbm27
-rw-r--r--ext/tk/sample/images/noletter.xbm27
-rw-r--r--ext/tk/sample/images/pattern.xbm6
-rw-r--r--ext/tk/sample/images/tcllogo.gifbin0 -> 2341 bytes-rw-r--r--ext/tk/sample/images/teapot.ppm56
-rw-r--r--ext/tk/sample/iso2022-kr.txt2
-rw-r--r--ext/tk/sample/menubar1.rb51
-rw-r--r--ext/tk/sample/menubar2.rb56
-rw-r--r--ext/tk/sample/msgs_rb/README3
-rw-r--r--ext/tk/sample/msgs_rb/cs.msg84
-rw-r--r--ext/tk/sample/msgs_rb/de.msg88
-rw-r--r--ext/tk/sample/msgs_rb/el.msg98
-rw-r--r--ext/tk/sample/msgs_rb/en.msg83
-rw-r--r--ext/tk/sample/msgs_rb/en_gb.msg7
-rw-r--r--ext/tk/sample/msgs_rb/eo.msg87
-rw-r--r--ext/tk/sample/msgs_rb/es.msg84
-rw-r--r--ext/tk/sample/msgs_rb/fr.msg84
-rw-r--r--ext/tk/sample/msgs_rb/it.msg84
-rw-r--r--ext/tk/sample/msgs_rb/ja.msg13
-rw-r--r--ext/tk/sample/msgs_rb/nl.msg123
-rw-r--r--ext/tk/sample/msgs_rb/pl.msg87
-rw-r--r--ext/tk/sample/msgs_rb/ru.msg87
-rw-r--r--ext/tk/sample/msgs_rb2/README5
-rw-r--r--ext/tk/sample/msgs_rb2/de.msg88
-rw-r--r--ext/tk/sample/msgs_rb2/ja.msg85
-rw-r--r--ext/tk/sample/msgs_tk/README4
-rw-r--r--ext/tk/sample/msgs_tk/cs.msg84
-rw-r--r--ext/tk/sample/msgs_tk/de.msg88
-rw-r--r--ext/tk/sample/msgs_tk/el.msg103
-rw-r--r--ext/tk/sample/msgs_tk/en.msg83
-rw-r--r--ext/tk/sample/msgs_tk/en_gb.msg7
-rw-r--r--ext/tk/sample/msgs_tk/eo.msg87
-rw-r--r--ext/tk/sample/msgs_tk/es.msg84
-rw-r--r--ext/tk/sample/msgs_tk/fr.msg84
-rw-r--r--ext/tk/sample/msgs_tk/it.msg84
-rw-r--r--ext/tk/sample/msgs_tk/ja.msg13
-rw-r--r--ext/tk/sample/msgs_tk/license.terms39
-rw-r--r--ext/tk/sample/msgs_tk/nl.msg123
-rw-r--r--ext/tk/sample/msgs_tk/pl.msg87
-rw-r--r--ext/tk/sample/msgs_tk/ru.msg87
-rw-r--r--ext/tk/sample/multi-ip_sample.rb102
-rw-r--r--ext/tk/sample/multi-ip_sample2.rb29
-rw-r--r--ext/tk/sample/optobj_sample.rb67
-rw-r--r--ext/tk/sample/propagate.rb30
-rw-r--r--ext/tk/sample/remote-ip_sample.rb33
-rw-r--r--ext/tk/sample/remote-ip_sample2.rb56
-rw-r--r--ext/tk/sample/resource.en13
-rw-r--r--ext/tk/sample/resource.ja13
-rw-r--r--ext/tk/sample/safe-tk.rb115
-rw-r--r--ext/tk/sample/tkalignbox.rb225
-rw-r--r--ext/tk/sample/tkballoonhelp.rb99
-rw-r--r--ext/tk/sample/tkbiff.rb (renamed from sample/tkbiff.rb)38
-rw-r--r--ext/tk/sample/tkbrowse.rb (renamed from sample/tkbrowse.rb)10
-rw-r--r--ext/tk/sample/tkcombobox.rb426
-rw-r--r--ext/tk/sample/tkdialog.rb (renamed from sample/tkdialog.rb)3
-rw-r--r--ext/tk/sample/tkextlib/ICONS/Orig_LICENSE.txt61
-rw-r--r--ext/tk/sample/tkextlib/ICONS/tkIcons195
-rw-r--r--ext/tk/sample/tkextlib/ICONS/tkIcons-sample.kde658
-rw-r--r--ext/tk/sample/tkextlib/ICONS/tkIcons.kde195
-rw-r--r--ext/tk/sample/tkextlib/ICONS/viewIcons.rb329
-rw-r--r--ext/tk/sample/tkextlib/bwidget/Orig_LICENSE.txt53
-rw-r--r--ext/tk/sample/tkextlib/bwidget/basic.rb198
-rw-r--r--ext/tk/sample/tkextlib/bwidget/bwidget.xbm46
-rw-r--r--ext/tk/sample/tkextlib/bwidget/demo.rb243
-rw-r--r--ext/tk/sample/tkextlib/bwidget/dnd.rb46
-rw-r--r--ext/tk/sample/tkextlib/bwidget/manager.rb150
-rw-r--r--ext/tk/sample/tkextlib/bwidget/select.rb82
-rw-r--r--ext/tk/sample/tkextlib/bwidget/tmpldlg.rb221
-rw-r--r--ext/tk/sample/tkextlib/bwidget/tree.rb289
-rw-r--r--ext/tk/sample/tkextlib/bwidget/x1.xbm2258
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/Orig_LICENSE.txt42
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/box.xbm14
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/clear.gifbin0 -> 279 bytes-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/close.gifbin0 -> 249 bytes-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/copy.gifbin0 -> 269 bytes-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/cut.gifbin0 -> 179 bytes-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/exit.gifbin0 -> 396 bytes-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/find.gifbin0 -> 386 bytes-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/help.gifbin0 -> 591 bytes-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/line.xbm14
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/mag.gifbin0 -> 183 bytes-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/new.gifbin0 -> 212 bytes-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/open.gifbin0 -> 258 bytes-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/oval.xbm14
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/paste.gifbin0 -> 376 bytes-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/points.xbm14
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/poly.gifbin0 -> 141 bytes-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/print.gifbin0 -> 263 bytes-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/ruler.gifbin0 -> 174 bytes-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/save.gifbin0 -> 270 bytes-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/select.gifbin0 -> 124 bytes-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/images/text.xbm14
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/buttonbox.rb22
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb10
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/canvasprintbox.rb8
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/canvasprintdialog.rb8
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/checkbox.rb12
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb32
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/dateentry.rb7
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/datefield.rb8
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/dialog.rb20
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb14
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb16
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb39
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb40
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb40
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb20
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb8
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb29
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/feedback.rb10
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb8
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb28
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/finddialog.rb15
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb25
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/hyperhelp.rb14
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/labeledframe.rb14
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb13
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb64
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb124
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb44
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb19
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb19
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb44
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb30
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb30
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb14
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb22
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb22
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb17
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb9
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/radiobox.rb13
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/scrolledcanvas.rb13
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb18
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb15
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb22
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb11
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb19
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb12
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/shell.rb17
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/spindate.rb7
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb10
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb33
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/spintime.rb7
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb26
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb30
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/tabset.rb34
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/timeentry.rb7
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/timefield.rb8
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb152
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/watch.rb18
-rw-r--r--ext/tk/sample/tkextlib/tcllib/Orig_LICENSE.txt46
-rw-r--r--ext/tk/sample/tkextlib/tcllib/datefield.rb29
-rw-r--r--ext/tk/sample/tkextlib/tcllib/plotdemos1.rb158
-rw-r--r--ext/tk/sample/tkextlib/tcllib/plotdemos2.rb71
-rw-r--r--ext/tk/sample/tkextlib/tcllib/plotdemos3.rb83
-rw-r--r--ext/tk/sample/tkextlib/tcllib/xyplot.rb17
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/Orig_COPYRIGHT.txt12
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/README12
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/hv.rb306
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image1bin0 -> 8995 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image10bin0 -> 3095 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image11bin0 -> 1425 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image12bin0 -> 2468 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image13bin0 -> 4073 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image14bin0 -> 53 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image2bin0 -> 42 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image3bin0 -> 3473 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image4bin0 -> 1988 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image5bin0 -> 973 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image6bin0 -> 2184 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image7bin0 -> 2022 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image8bin0 -> 1186 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/image9bin0 -> 139 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page1/index.html115
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image1bin0 -> 1966 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image10bin0 -> 255 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image11bin0 -> 590 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image12bin0 -> 254 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image13bin0 -> 493 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image14bin0 -> 195 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image15bin0 -> 68 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image16bin0 -> 157 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image17bin0 -> 81 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image18bin0 -> 545 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image19bin0 -> 53 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image2bin0 -> 49 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image20bin0 -> 533 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image21bin0 -> 564 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image22bin0 -> 81 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image23bin0 -> 539 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image24bin0 -> 151 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image25bin0 -> 453 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image26bin0 -> 520 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image27bin0 -> 565 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image28bin0 -> 416 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image29bin0 -> 121 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image3bin0 -> 10835 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image30bin0 -> 663 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image31bin0 -> 78 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image32bin0 -> 556 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image33bin0 -> 598 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image34bin0 -> 496 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image35bin0 -> 724 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image36bin0 -> 404 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image37bin0 -> 124 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image38bin0 -> 8330 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image39bin0 -> 369 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image4bin0 -> 268 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image5bin0 -> 492 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image6bin0 -> 246 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image7bin0 -> 551 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image8bin0 -> 497 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/image9bin0 -> 492 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page2/index.html433
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image1bin0 -> 113 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image10bin0 -> 5088 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image11bin0 -> 4485 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image12bin0 -> 3579 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image13bin0 -> 5119 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image14bin0 -> 3603 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image2bin0 -> 74 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image3bin0 -> 681 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image4bin0 -> 3056 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image5bin0 -> 2297 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image6bin0 -> 79 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image7bin0 -> 1613 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image8bin0 -> 864 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/image9bin0 -> 2379 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page3/index.html2787
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image1bin0 -> 42 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image2bin0 -> 14343 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image3bin0 -> 17750 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image4bin0 -> 61 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image5bin0 -> 201 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image6bin0 -> 214 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image7bin0 -> 149 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image8bin0 -> 203 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/image9bin0 -> 1504 bytes-rw-r--r--ext/tk/sample/tkextlib/tkHTML/page4/index.html768
-rw-r--r--ext/tk/sample/tkextlib/tkHTML/ss.rb404
-rw-r--r--ext/tk/sample/tkextlib/tktable/Orig_LICENSE.txt52
-rw-r--r--ext/tk/sample/tkextlib/tktable/basic.rb60
-rw-r--r--ext/tk/sample/tkextlib/tktable/buttons.rb76
-rw-r--r--ext/tk/sample/tkextlib/tktable/command.rb89
-rw-r--r--ext/tk/sample/tkextlib/tktable/debug.rb101
-rw-r--r--ext/tk/sample/tkextlib/tktable/dynarows.rb99
-rw-r--r--ext/tk/sample/tkextlib/tktable/maxsize.rb67
-rw-r--r--ext/tk/sample/tkextlib/tktable/spreadsheet.rb137
-rwxr-xr-xext/tk/sample/tkextlib/tktable/tcllogo.gifbin0 -> 2341 bytes-rw-r--r--ext/tk/sample/tkextlib/tktable/valid.rb88
-rw-r--r--ext/tk/sample/tkextlib/vu/Orig_LICENSE.txt51
-rw-r--r--ext/tk/sample/tkextlib/vu/README.txt50
-rw-r--r--ext/tk/sample/tkextlib/vu/canvItems.rb90
-rw-r--r--ext/tk/sample/tkextlib/vu/canvSticker.rb82
-rw-r--r--ext/tk/sample/tkextlib/vu/canvSticker2.rb99
-rw-r--r--ext/tk/sample/tkextlib/vu/dial.rb113
-rw-r--r--ext/tk/sample/tkextlib/vu/m128_000.xbm174
-rw-r--r--ext/tk/sample/tkextlib/vu/oscilloscope.rb68
-rw-r--r--ext/tk/sample/tkextlib/vu/pie.rb56
-rw-r--r--ext/tk/sample/tkextlib/vu/vu.rb67
-rw-r--r--ext/tk/sample/tkfrom.rb (renamed from sample/tkfrom.rb)32
-rw-r--r--ext/tk/sample/tkhello.rb10
-rw-r--r--ext/tk/sample/tkline.rb (renamed from sample/tkline.rb)6
-rw-r--r--ext/tk/sample/tkmenubutton.rb135
-rw-r--r--ext/tk/sample/tkmsgcat-load_rb.rb102
-rw-r--r--ext/tk/sample/tkmsgcat-load_rb2.rb102
-rw-r--r--ext/tk/sample/tkmsgcat-load_tk.rb118
-rw-r--r--ext/tk/sample/tkmulticolumnlist.rb743
-rw-r--r--ext/tk/sample/tkmultilistbox.rb654
-rw-r--r--ext/tk/sample/tkmultilistframe.rb940
-rw-r--r--ext/tk/sample/tkoptdb-safeTk.rb73
-rw-r--r--ext/tk/sample/tkoptdb.rb106
-rw-r--r--ext/tk/sample/tktextframe.rb162
-rw-r--r--ext/tk/sample/tktimer.rb (renamed from sample/tktimer.rb)2
-rw-r--r--ext/tk/sample/tktimer2.rb47
-rw-r--r--ext/tk/sample/tktimer3.rb59
-rw-r--r--ext/tk/sample/tktree.rb103
-rw-r--r--ext/tk/sample/tktree.tcl305
-rw-r--r--ext/tk/tkutil.c1352
-rw-r--r--ext/tkutil/MANIFEST3
-rw-r--r--ext/tkutil/depend1
-rw-r--r--ext/tkutil/tkutil.c45
-rw-r--r--ext/win32ole/.cvsignore3
-rw-r--r--ext/win32ole/depend1
-rw-r--r--ext/win32ole/doc/win32ole.rd294
-rw-r--r--ext/win32ole/extconf.rb27
-rw-r--r--ext/win32ole/lib/win32ole/property.rb16
-rw-r--r--ext/win32ole/sample/excel1.rb22
-rw-r--r--ext/win32ole/sample/excel2.rb30
-rw-r--r--ext/win32ole/sample/excel3.rb13
-rw-r--r--ext/win32ole/sample/ie.rb11
-rw-r--r--ext/win32ole/sample/ieconst.rb32
-rw-r--r--ext/win32ole/sample/ienavi.rb40
-rw-r--r--ext/win32ole/sample/oledirs.rb23
-rw-r--r--ext/win32ole/sample/olegen.rb348
-rw-r--r--ext/win32ole/sample/xml.rb7306
-rw-r--r--ext/win32ole/tests/oleserver.rb10
-rw-r--r--ext/win32ole/tests/testOLEEVENT.rb33
-rw-r--r--ext/win32ole/tests/testOLEMETHOD.rb87
-rw-r--r--ext/win32ole/tests/testOLEPARAM.rb74
-rw-r--r--ext/win32ole/tests/testOLETYPE.rb96
-rw-r--r--ext/win32ole/tests/testOLEVARIABLE.rb49
-rw-r--r--ext/win32ole/tests/testVARIANT.rb32
-rw-r--r--ext/win32ole/tests/testWIN32OLE.rb312
-rw-r--r--ext/win32ole/tests/testall.rb11
-rw-r--r--ext/win32ole/win32ole.c5565
-rw-r--r--ext/zlib/.cvsignore3
-rw-r--r--ext/zlib/doc/zlib.rd911
-rw-r--r--ext/zlib/extconf.rb66
-rw-r--r--ext/zlib/zlib.c3510
-rw-r--r--file.c3816
-rw-r--r--fnmatch.c243
-rw-r--r--fnmatch.h36
-rw-r--r--gc.c1633
-rw-r--r--glob.c591
-rw-r--r--hash.c2300
-rw-r--r--inits.c14
-rw-r--r--install-sh238
-rw-r--r--instruby.rb250
-rw-r--r--intern.h679
-rw-r--r--io.c4936
-rw-r--r--keywords80
-rw-r--r--lex.c151
-rw-r--r--lib/.document33
-rw-r--r--lib/English.rb133
-rw-r--r--lib/Env.rb17
-rw-r--r--lib/README109
-rw-r--r--lib/abbrev.rb103
-rw-r--r--lib/base64.rb150
-rw-r--r--lib/benchmark.rb569
-rw-r--r--lib/cgi-lib.rb290
-rw-r--r--lib/cgi.rb2296
-rw-r--r--lib/cgi/.document2
-rw-r--r--lib/cgi/session.rb462
-rw-r--r--lib/cgi/session/pstore.rb117
-rw-r--r--lib/complex.rb507
-rw-r--r--lib/csv.rb992
-rw-r--r--lib/date.rb1472
-rw-r--r--lib/date/format.rb563
-rw-r--r--lib/date2.rb222
-rw-r--r--lib/debug.rb1077
-rw-r--r--lib/delegate.rb133
-rw-r--r--lib/drb.rb2
-rw-r--r--lib/drb/acl.rb144
-rw-r--r--lib/drb/drb.rb1622
-rw-r--r--lib/drb/eq.rb16
-rw-r--r--lib/drb/extserv.rb67
-rw-r--r--lib/drb/extservm.rb94
-rw-r--r--lib/drb/gw.rb60
-rw-r--r--lib/drb/invokemethod.rb36
-rw-r--r--lib/drb/observer.rb22
-rw-r--r--lib/drb/ssl.rb185
-rw-r--r--lib/drb/timeridconv.rb91
-rw-r--r--lib/drb/unix.rb107
-rw-r--r--lib/e2mmap.rb270
-rw-r--r--lib/erb.rb473
-rw-r--r--lib/eregex.rb1
-rw-r--r--lib/fileutils.rb1007
-rw-r--r--lib/final.rb41
-rw-r--r--lib/finalize.rb255
-rw-r--r--lib/find.rb86
-rw-r--r--lib/forwardable.rb94
-rw-r--r--lib/ftools.rb222
-rw-r--r--lib/ftplib.rb574
-rw-r--r--lib/generator.rb380
-rw-r--r--lib/getoptlong.rb468
-rw-r--r--lib/getopts.rb211
-rw-r--r--lib/gserver.rb249
-rw-r--r--lib/importenv.rb9
-rw-r--r--lib/ipaddr.rb762
-rw-r--r--lib/irb.rb340
-rw-r--r--lib/irb/cmd/chws.rb33
-rw-r--r--lib/irb/cmd/fork.rb25
-rw-r--r--lib/irb/cmd/load.rb67
-rw-r--r--lib/irb/cmd/nop.rb39
-rw-r--r--lib/irb/cmd/pushws.rb39
-rw-r--r--lib/irb/cmd/subirb.rb43
-rw-r--r--lib/irb/completion.rb188
-rw-r--r--lib/irb/context.rb234
-rw-r--r--lib/irb/ext/change-ws.rb62
-rw-r--r--lib/irb/ext/history.rb110
-rw-r--r--lib/irb/ext/loader.rb106
-rw-r--r--lib/irb/ext/math-mode.rb37
-rw-r--r--lib/irb/ext/multi-irb.rb241
-rw-r--r--lib/irb/ext/tracer.rb61
-rw-r--r--lib/irb/ext/use-loader.rb65
-rw-r--r--lib/irb/ext/workspaces.rb56
-rw-r--r--lib/irb/extend-command.rb215
-rw-r--r--lib/irb/frame.rb67
-rw-r--r--lib/irb/help.rb33
-rw-r--r--lib/irb/init.rb225
-rw-r--r--lib/irb/input-method.rb120
-rw-r--r--lib/irb/lc/error.rb30
-rw-r--r--lib/irb/lc/help-message35
-rw-r--r--lib/irb/lc/ja/error.rb29
-rw-r--r--lib/irb/lc/ja/help-message36
-rw-r--r--lib/irb/locale.rb186
-rw-r--r--lib/irb/ruby-lex.rb1073
-rw-r--r--lib/irb/ruby-token.rb273
-rw-r--r--lib/irb/slex.rb278
-rw-r--r--lib/irb/version.rb16
-rw-r--r--lib/irb/workspace.rb107
-rw-r--r--lib/irb/ws-for-case-2.rb15
-rw-r--r--lib/irb/xmp.rb86
-rw-r--r--lib/jcode.rb289
-rw-r--r--lib/logger.rb728
-rw-r--r--lib/mailread.rb26
-rw-r--r--lib/mathn.rb45
-rw-r--r--lib/matrix.rb1082
-rw-r--r--lib/mkmf.rb1233
-rw-r--r--lib/monitor.rb494
-rw-r--r--lib/mutex_m.rb237
-rw-r--r--lib/net/ftp.rb923
-rw-r--r--lib/net/http.rb1801
-rw-r--r--lib/net/imap.rb3352
-rw-r--r--lib/net/pop.rb879
-rw-r--r--lib/net/protocol.rb448
-rw-r--r--lib/net/smtp.rb697
-rw-r--r--lib/net/telnet.rb742
-rw-r--r--lib/observer.rb180
-rw-r--r--lib/open-uri.rb610
-rw-r--r--lib/open3.rb75
-rw-r--r--lib/optparse.rb1796
-rw-r--r--lib/optparse/date.rb17
-rw-r--r--lib/optparse/shellwords.rb6
-rw-r--r--lib/optparse/time.rb10
-rw-r--r--lib/optparse/uri.rb6
-rw-r--r--lib/optparse/version.rb68
-rw-r--r--lib/ostruct.rb111
-rw-r--r--lib/parsearg.rb2
-rw-r--r--lib/parsedate.rb74
-rw-r--r--lib/pathname.rb1197
-rw-r--r--lib/ping.rb18
-rw-r--r--lib/pp.rb652
-rw-r--r--lib/prettyprint.rb914
-rw-r--r--lib/profile.rb57
-rw-r--r--lib/profiler.rb59
-rw-r--r--lib/pstore.rb137
-rw-r--r--lib/racc/parser.rb456
-rw-r--r--lib/rational.rb138
-rw-r--r--lib/rdoc/README475
-rw-r--r--lib/rdoc/code_objects.rb706
-rw-r--r--lib/rdoc/diagram.rb333
-rw-r--r--lib/rdoc/dot/dot.rb255
-rw-r--r--lib/rdoc/generators/chm_generator.rb112
-rw-r--r--lib/rdoc/generators/html_generator.rb1442
-rw-r--r--lib/rdoc/generators/ri_generator.rb268
-rw-r--r--lib/rdoc/generators/template/chm/chm.rb87
-rw-r--r--lib/rdoc/generators/template/html/hefss.rb418
-rw-r--r--lib/rdoc/generators/template/html/html.rb647
-rw-r--r--lib/rdoc/generators/template/html/kilmer.rb421
-rw-r--r--lib/rdoc/generators/template/html/old_html.rb728
-rw-r--r--lib/rdoc/generators/template/html/one_page_html.rb122
-rw-r--r--lib/rdoc/generators/template/xml/rdf.rb112
-rw-r--r--lib/rdoc/generators/template/xml/xml.rb112
-rw-r--r--lib/rdoc/generators/xml_generator.rb130
-rw-r--r--lib/rdoc/markup/sample/rdoc2latex.rb16
-rw-r--r--lib/rdoc/markup/sample/sample.rb42
-rw-r--r--lib/rdoc/markup/simple_markup.rb477
-rw-r--r--lib/rdoc/markup/simple_markup/fragments.rb328
-rw-r--r--lib/rdoc/markup/simple_markup/inline.rb338
-rw-r--r--lib/rdoc/markup/simple_markup/lines.rb151
-rw-r--r--lib/rdoc/markup/simple_markup/preprocess.rb70
-rw-r--r--lib/rdoc/markup/simple_markup/to_flow.rb188
-rw-r--r--lib/rdoc/markup/simple_markup/to_html.rb289
-rw-r--r--lib/rdoc/markup/simple_markup/to_latex.rb333
-rw-r--r--lib/rdoc/markup/test/AllTests.rb2
-rw-r--r--lib/rdoc/markup/test/TestInline.rb154
-rw-r--r--lib/rdoc/markup/test/TestParse.rb503
-rw-r--r--lib/rdoc/options.rb575
-rw-r--r--lib/rdoc/parsers/parse_c.rb523
-rw-r--r--lib/rdoc/parsers/parse_f95.rb119
-rw-r--r--lib/rdoc/parsers/parse_rb.rb2594
-rw-r--r--lib/rdoc/parsers/parse_simple.rb37
-rw-r--r--lib/rdoc/parsers/parserfactory.rb99
-rw-r--r--lib/rdoc/rdoc.rb282
-rw-r--r--lib/rdoc/ri/ri_cache.rb187
-rw-r--r--lib/rdoc/ri/ri_descriptions.rb152
-rw-r--r--lib/rdoc/ri/ri_display.rb273
-rw-r--r--lib/rdoc/ri/ri_driver.rb145
-rw-r--r--lib/rdoc/ri/ri_formatter.rb651
-rw-r--r--lib/rdoc/ri/ri_options.rb257
-rw-r--r--lib/rdoc/ri/ri_paths.rb51
-rw-r--r--lib/rdoc/ri/ri_reader.rb100
-rw-r--r--lib/rdoc/ri/ri_util.rb75
-rw-r--r--lib/rdoc/ri/ri_writer.rb62
-rw-r--r--lib/rdoc/template.rb234
-rw-r--r--lib/rdoc/tokenstream.rb25
-rw-r--r--lib/rdoc/usage.rb203
-rw-r--r--lib/resolv-replace.rb62
-rw-r--r--lib/resolv.rb1767
-rw-r--r--lib/rexml/attlistdecl.rb62
-rw-r--r--lib/rexml/attribute.rb163
-rw-r--r--lib/rexml/cdata.rb68
-rw-r--r--lib/rexml/child.rb96
-rw-r--r--lib/rexml/comment.rb86
-rw-r--r--lib/rexml/doctype.rb213
-rw-r--r--lib/rexml/document.rb179
-rw-r--r--lib/rexml/dtd/attlistdecl.rb10
-rw-r--r--lib/rexml/dtd/dtd.rb51
-rw-r--r--lib/rexml/dtd/elementdecl.rb17
-rw-r--r--lib/rexml/dtd/entitydecl.rb56
-rw-r--r--lib/rexml/dtd/notationdecl.rb39
-rw-r--r--lib/rexml/element.rb1205
-rw-r--r--lib/rexml/encoding.rb56
-rw-r--r--lib/rexml/encodings/CP-1252.rb98
-rw-r--r--lib/rexml/encodings/EUC-JP.rb37
-rw-r--r--lib/rexml/encodings/ICONV.rb16
-rw-r--r--lib/rexml/encodings/ISO-8859-1.rb25
-rw-r--r--lib/rexml/encodings/ISO-8859-15.rb69
-rw-r--r--lib/rexml/encodings/SHIFT-JIS.rb37
-rw-r--r--lib/rexml/encodings/SHIFT_JIS.rb1
-rw-r--r--lib/rexml/encodings/UNILE.rb29
-rw-r--r--lib/rexml/encodings/US-ASCII.rb25
-rw-r--r--lib/rexml/encodings/UTF-16.rb29
-rw-r--r--lib/rexml/encodings/UTF-8.rb13
-rw-r--r--lib/rexml/entity.rb159
-rw-r--r--lib/rexml/functions.rb372
-rw-r--r--lib/rexml/instruction.rb62
-rw-r--r--lib/rexml/light/node.rb196
-rw-r--r--lib/rexml/namespace.rb47
-rw-r--r--lib/rexml/node.rb40
-rw-r--r--lib/rexml/output.rb24
-rw-r--r--lib/rexml/parent.rb165
-rw-r--r--lib/rexml/parseexception.rb51
-rw-r--r--lib/rexml/parsers/baseparser.rb451
-rw-r--r--lib/rexml/parsers/lightparser.rb60
-rw-r--r--lib/rexml/parsers/pullparser.rb149
-rw-r--r--lib/rexml/parsers/sax2parser.rb213
-rw-r--r--lib/rexml/parsers/streamparser.rb43
-rw-r--r--lib/rexml/parsers/treeparser.rb90
-rw-r--r--lib/rexml/parsers/ultralightparser.rb56
-rw-r--r--lib/rexml/parsers/xpathparser.rb691
-rw-r--r--lib/rexml/quickpath.rb266
-rw-r--r--lib/rexml/rexml.rb26
-rw-r--r--lib/rexml/sax2listener.rb94
-rw-r--r--lib/rexml/source.rb218
-rw-r--r--lib/rexml/streamlistener.rb89
-rw-r--r--lib/rexml/text.rb336
-rw-r--r--lib/rexml/validation/relaxng.rb559
-rw-r--r--lib/rexml/validation/validation.rb152
-rw-r--r--lib/rexml/validation/validationexception.rb9
-rw-r--r--lib/rexml/xmldecl.rb105
-rw-r--r--lib/rexml/xmltokens.rb18
-rw-r--r--lib/rexml/xpath.rb62
-rw-r--r--lib/rexml/xpath_parser.rb558
-rw-r--r--lib/rinda/rinda.rb184
-rw-r--r--lib/rinda/ring.rb164
-rw-r--r--lib/rinda/tuplespace.rb428
-rw-r--r--lib/rss/0.9.rb530
-rw-r--r--lib/rss/1.0.rb653
-rw-r--r--lib/rss/2.0.rb150
-rw-r--r--lib/rss/content.rb52
-rw-r--r--lib/rss/converter.rb155
-rw-r--r--lib/rss/dublincore.rb64
-rw-r--r--lib/rss/maker.rb33
-rw-r--r--lib/rss/maker/0.9.rb160
-rw-r--r--lib/rss/maker/1.0.rb184
-rw-r--r--lib/rss/maker/2.0.rb129
-rw-r--r--lib/rss/maker/base.rb430
-rw-r--r--lib/rss/maker/content.rb29
-rw-r--r--lib/rss/maker/dublincore.rb47
-rw-r--r--lib/rss/maker/syndication.rb27
-rw-r--r--lib/rss/maker/trackback.rb30
-rw-r--r--lib/rss/parser.rb396
-rw-r--r--lib/rss/rexmlparser.rb47
-rw-r--r--lib/rss/rss.rb680
-rw-r--r--lib/rss/syndication.rb85
-rw-r--r--lib/rss/taxonomy.rb32
-rw-r--r--lib/rss/trackback.rb306
-rw-r--r--lib/rss/utils.rb17
-rw-r--r--lib/rss/xml-stylesheet.rb94
-rw-r--r--lib/rss/xmlparser.rb91
-rw-r--r--lib/rss/xmlscanner.rb102
-rw-r--r--lib/rubyunit.rb6
-rw-r--r--lib/runit/assert.rb73
-rw-r--r--lib/runit/cui/testrunner.rb51
-rw-r--r--lib/runit/error.rb9
-rw-r--r--lib/runit/testcase.rb45
-rw-r--r--lib/runit/testresult.rb44
-rw-r--r--lib/runit/testsuite.rb26
-rw-r--r--lib/runit/topublic.rb8
-rw-r--r--lib/scanf.rb702
-rw-r--r--lib/set.rb1208
-rw-r--r--lib/shell.rb696
-rw-r--r--lib/shell/builtin-command.rb154
-rw-r--r--lib/shell/command-processor.rb592
-rw-r--r--lib/shell/error.rb26
-rw-r--r--lib/shell/filter.rb110
-rw-r--r--lib/shell/process-controller.rb258
-rw-r--r--lib/shell/system-command.rb168
-rw-r--r--lib/shell/version.rb16
-rw-r--r--lib/shellwords.rb68
-rw-r--r--lib/singleton.rb371
-rw-r--r--lib/soap/attachment.rb107
-rw-r--r--lib/soap/baseData.rb815
-rw-r--r--lib/soap/element.rb251
-rw-r--r--lib/soap/encodingstyle/aspDotNetHandler.rb220
-rw-r--r--lib/soap/encodingstyle/handler.rb100
-rw-r--r--lib/soap/encodingstyle/literalHandler.rb227
-rw-r--r--lib/soap/encodingstyle/soapHandler.rb589
-rw-r--r--lib/soap/generator.rb210
-rw-r--r--lib/soap/header/handler.rb57
-rw-r--r--lib/soap/header/handlerset.rb58
-rw-r--r--lib/soap/header/simplehandler.rb44
-rw-r--r--lib/soap/mapping.rb10
-rw-r--r--lib/soap/mapping/factory.rb388
-rw-r--r--lib/soap/mapping/mapping.rb218
-rw-r--r--lib/soap/mapping/registry.rb479
-rw-r--r--lib/soap/mapping/rubytypeFactory.rb452
-rw-r--r--lib/soap/mapping/typeMap.rb41
-rw-r--r--lib/soap/mapping/wsdlRegistry.rb155
-rw-r--r--lib/soap/marshal.rb58
-rw-r--r--lib/soap/mimemessage.rb238
-rw-r--r--lib/soap/netHttpClient.rb174
-rw-r--r--lib/soap/parser.rb252
-rw-r--r--lib/soap/processor.rb66
-rw-r--r--lib/soap/property.rb328
-rw-r--r--lib/soap/rpc/cgistub.rb206
-rw-r--r--lib/soap/rpc/driver.rb300
-rw-r--r--lib/soap/rpc/element.rb270
-rw-r--r--lib/soap/rpc/httpserver.rb105
-rw-r--r--lib/soap/rpc/proxy.rb171
-rw-r--r--lib/soap/rpc/router.rb235
-rw-r--r--lib/soap/rpc/rpc.rb25
-rw-r--r--lib/soap/rpc/soaplet.rb200
-rw-r--r--lib/soap/rpc/standaloneServer.rb43
-rw-r--r--lib/soap/soap.rb115
-rw-r--r--lib/soap/streamHandler.rb267
-rw-r--r--lib/soap/wsdlDriver.rb598
-rw-r--r--lib/sync.rb282
-rw-r--r--lib/telnet.rb439
-rw-r--r--lib/tempfile.rb210
-rw-r--r--lib/test/unit.rb283
-rw-r--r--lib/test/unit/assertionfailederror.rb12
-rw-r--r--lib/test/unit/assertions.rb472
-rw-r--r--lib/test/unit/autorunner.rb189
-rw-r--r--lib/test/unit/collector.rb43
-rw-r--r--lib/test/unit/collector/dir.rb86
-rw-r--r--lib/test/unit/collector/objectspace.rb34
-rw-r--r--lib/test/unit/error.rb54
-rw-r--r--lib/test/unit/failure.rb49
-rw-r--r--lib/test/unit/testcase.rb150
-rw-r--r--lib/test/unit/testresult.rb79
-rw-r--r--lib/test/unit/testsuite.rb74
-rw-r--r--lib/test/unit/ui/console/testrunner.rb125
-rw-r--r--lib/test/unit/ui/fox/testrunner.rb266
-rw-r--r--lib/test/unit/ui/gtk/testrunner.rb414
-rw-r--r--lib/test/unit/ui/gtk2/testrunner.rb463
-rw-r--r--lib/test/unit/ui/testrunnermediator.rb66
-rw-r--r--lib/test/unit/ui/testrunnerutilities.rb44
-rw-r--r--lib/test/unit/ui/tk/testrunner.rb258
-rw-r--r--lib/test/unit/util/backtracefilter.rb40
-rw-r--r--lib/test/unit/util/observable.rb88
-rw-r--r--lib/test/unit/util/procwrapper.rb46
-rw-r--r--lib/thread.rb315
-rw-r--r--lib/thwait.rb99
-rw-r--r--lib/time.rb617
-rw-r--r--lib/timeout.rb64
-rw-r--r--lib/tk.rb2499
-rw-r--r--lib/tkafter.rb296
-rw-r--r--lib/tkbgerror.rb17
-rw-r--r--lib/tkcanvas.rb829
-rw-r--r--lib/tkdialog.rb141
-rw-r--r--lib/tkentry.rb73
-rw-r--r--lib/tkfont.rb939
-rw-r--r--lib/tkmenubar.rb137
-rw-r--r--lib/tkmngfocus.rb27
-rw-r--r--lib/tktext.rb797
-rw-r--r--lib/tkvirtevent.rb66
-rw-r--r--lib/tmpdir.rb42
-rw-r--r--lib/tracer.rb70
-rw-r--r--lib/tsort.rb289
-rw-r--r--lib/un.rb227
-rw-r--r--lib/uri.rb28
-rw-r--r--lib/uri/common.rb607
-rw-r--r--lib/uri/ftp.rb148
-rw-r--r--lib/uri/generic.rb1125
-rw-r--r--lib/uri/http.rb65
-rw-r--r--lib/uri/https.rb16
-rw-r--r--lib/uri/ldap.rb190
-rw-r--r--lib/uri/mailto.rb239
-rw-r--r--lib/weakref.rb86
-rw-r--r--lib/webrick.rb29
-rw-r--r--lib/webrick/accesslog.rb64
-rw-r--r--lib/webrick/cgi.rb249
-rw-r--r--lib/webrick/compat.rb15
-rw-r--r--lib/webrick/config.rb98
-rw-r--r--lib/webrick/cookie.rb80
-rw-r--r--lib/webrick/htmlutils.rb25
-rw-r--r--lib/webrick/httpauth.rb46
-rw-r--r--lib/webrick/httpauth/authenticator.rb79
-rw-r--r--lib/webrick/httpauth/basicauth.rb66
-rw-r--r--lib/webrick/httpauth/digestauth.rb348
-rw-r--r--lib/webrick/httpauth/htdigest.rb91
-rw-r--r--lib/webrick/httpauth/htgroup.rb61
-rw-r--r--lib/webrick/httpauth/htpasswd.rb75
-rw-r--r--lib/webrick/httpauth/userdb.rb29
-rw-r--r--lib/webrick/httpproxy.rb240
-rw-r--r--lib/webrick/httprequest.rb359
-rw-r--r--lib/webrick/httpresponse.rb327
-rw-r--r--lib/webrick/https.rb63
-rw-r--r--lib/webrick/httpserver.rb203
-rw-r--r--lib/webrick/httpservlet.rb22
-rw-r--r--lib/webrick/httpservlet/abstract.rb71
-rw-r--r--lib/webrick/httpservlet/cgi_runner.rb45
-rw-r--r--lib/webrick/httpservlet/cgihandler.rb98
-rw-r--r--lib/webrick/httpservlet/erbhandler.rb54
-rw-r--r--lib/webrick/httpservlet/filehandler.rb387
-rw-r--r--lib/webrick/httpservlet/prochandler.rb33
-rw-r--r--lib/webrick/httpstatus.rb126
-rw-r--r--lib/webrick/httputils.rb391
-rw-r--r--lib/webrick/httpversion.rb49
-rw-r--r--lib/webrick/log.rb88
-rw-r--r--lib/webrick/server.rb180
-rw-r--r--lib/webrick/ssl.rb126
-rw-r--r--lib/webrick/utils.rb88
-rw-r--r--lib/webrick/version.rb13
-rw-r--r--lib/wsdl/binding.rb65
-rw-r--r--lib/wsdl/data.rb64
-rw-r--r--lib/wsdl/definitions.rb240
-rw-r--r--lib/wsdl/documentation.rb32
-rw-r--r--lib/wsdl/import.rb70
-rw-r--r--lib/wsdl/importer.rb73
-rw-r--r--lib/wsdl/info.rb33
-rw-r--r--lib/wsdl/message.rb54
-rw-r--r--lib/wsdl/operation.rb129
-rw-r--r--lib/wsdl/operationBinding.rb80
-rw-r--r--lib/wsdl/param.rb74
-rw-r--r--lib/wsdl/parser.rb160
-rw-r--r--lib/wsdl/part.rb52
-rw-r--r--lib/wsdl/port.rb84
-rw-r--r--lib/wsdl/portType.rb72
-rw-r--r--lib/wsdl/service.rb61
-rw-r--r--lib/wsdl/soap/address.rb40
-rw-r--r--lib/wsdl/soap/binding.rb48
-rw-r--r--lib/wsdl/soap/body.rb52
-rw-r--r--lib/wsdl/soap/cgiStubCreator.rb73
-rw-r--r--lib/wsdl/soap/classDefCreator.rb112
-rw-r--r--lib/wsdl/soap/classDefCreatorSupport.rb106
-rw-r--r--lib/wsdl/soap/clientSkeltonCreator.rb78
-rw-r--r--lib/wsdl/soap/complexType.rb107
-rw-r--r--lib/wsdl/soap/data.rb41
-rw-r--r--lib/wsdl/soap/definitions.rb152
-rw-r--r--lib/wsdl/soap/driverCreator.rb84
-rw-r--r--lib/wsdl/soap/fault.rb52
-rw-r--r--lib/wsdl/soap/header.rb79
-rw-r--r--lib/wsdl/soap/headerfault.rb56
-rw-r--r--lib/wsdl/soap/mappingRegistryCreator.rb90
-rw-r--r--lib/wsdl/soap/methodDefCreator.rb148
-rw-r--r--lib/wsdl/soap/operation.rb123
-rw-r--r--lib/wsdl/soap/servantSkeltonCreator.rb65
-rw-r--r--lib/wsdl/soap/standaloneServerStubCreator.rb79
-rw-r--r--lib/wsdl/types.rb43
-rw-r--r--lib/wsdl/wsdl.rb23
-rw-r--r--lib/wsdl/xmlSchema/all.rb65
-rw-r--r--lib/wsdl/xmlSchema/any.rb56
-rw-r--r--lib/wsdl/xmlSchema/attribute.rb74
-rw-r--r--lib/wsdl/xmlSchema/choice.rb65
-rw-r--r--lib/wsdl/xmlSchema/complexContent.rb83
-rw-r--r--lib/wsdl/xmlSchema/complexType.rb133
-rw-r--r--lib/wsdl/xmlSchema/content.rb96
-rw-r--r--lib/wsdl/xmlSchema/data.rb68
-rw-r--r--lib/wsdl/xmlSchema/element.rb104
-rw-r--r--lib/wsdl/xmlSchema/enumeration.rb36
-rw-r--r--lib/wsdl/xmlSchema/import.rb44
-rw-r--r--lib/wsdl/xmlSchema/parser.rb162
-rw-r--r--lib/wsdl/xmlSchema/schema.rb106
-rw-r--r--lib/wsdl/xmlSchema/sequence.rb65
-rw-r--r--lib/wsdl/xmlSchema/simpleRestriction.rb48
-rw-r--r--lib/wsdl/xmlSchema/simpleType.rb81
-rw-r--r--lib/wsdl/xmlSchema/unique.rb34
-rw-r--r--lib/xmlrpc/README.txt31
-rw-r--r--lib/xmlrpc/base64.rb81
-rw-r--r--lib/xmlrpc/client.rb605
-rw-r--r--lib/xmlrpc/config.rb40
-rw-r--r--lib/xmlrpc/create.rb280
-rw-r--r--lib/xmlrpc/datetime.rb138
-rw-r--r--lib/xmlrpc/httpserver.rb178
-rw-r--r--lib/xmlrpc/marshal.rb76
-rw-r--r--lib/xmlrpc/parser.rb808
-rw-r--r--lib/xmlrpc/server.rb833
-rw-r--r--lib/xmlrpc/utils.rb172
-rw-r--r--lib/xsd/charset.rb167
-rw-r--r--lib/xsd/codegen.rb12
-rw-r--r--lib/xsd/codegen/classdef.rb203
-rw-r--r--lib/xsd/codegen/commentdef.rb34
-rw-r--r--lib/xsd/codegen/gensupport.rb112
-rw-r--r--lib/xsd/codegen/methoddef.rb63
-rw-r--r--lib/xsd/codegen/moduledef.rb191
-rw-r--r--lib/xsd/datatypes.rb1116
-rw-r--r--lib/xsd/datatypes1999.rb20
-rw-r--r--lib/xsd/iconvcharset.rb33
-rw-r--r--lib/xsd/namedelements.rb79
-rw-r--r--lib/xsd/ns.rb130
-rw-r--r--lib/xsd/qname.rb71
-rw-r--r--lib/xsd/xmlparser.rb61
-rw-r--r--lib/xsd/xmlparser/parser.rb96
-rw-r--r--lib/xsd/xmlparser/rexmlparser.rb54
-rw-r--r--lib/xsd/xmlparser/xmlparser.rb50
-rw-r--r--lib/xsd/xmlparser/xmlscanner.rb147
-rw-r--r--lib/yaml.rb413
-rw-r--r--lib/yaml/baseemitter.rb247
-rw-r--r--lib/yaml/basenode.rb216
-rw-r--r--lib/yaml/constants.rb45
-rw-r--r--lib/yaml/dbm.rb111
-rw-r--r--lib/yaml/emitter.rb107
-rw-r--r--lib/yaml/encoding.rb33
-rw-r--r--lib/yaml/error.rb33
-rw-r--r--lib/yaml/loader.rb14
-rw-r--r--lib/yaml/rubytypes.rb625
-rw-r--r--lib/yaml/store.rb29
-rw-r--r--lib/yaml/stream.rb44
-rw-r--r--lib/yaml/stringio.rb83
-rw-r--r--lib/yaml/syck.rb27
-rw-r--r--lib/yaml/types.rb196
-rw-r--r--lib/yaml/yamlnode.rb54
-rw-r--r--lib/yaml/ypath.rb52
-rw-r--r--main.c29
-rw-r--r--marshal.c1273
-rw-r--r--math.c455
-rwxr-xr-xmdoc2man.rb465
-rw-r--r--misc/README5
-rw-r--r--misc/inf-ruby.el (renamed from sample/inf-ruby.el)123
-rw-r--r--misc/ruby-mode.el1194
-rw-r--r--misc/rubydb2x.el (renamed from sample/rubydb2x.el)0
-rw-r--r--misc/rubydb3x.el (renamed from sample/rubydb3x.el)49
-rw-r--r--missing.h139
-rw-r--r--missing/acosh.c88
-rw-r--r--missing/alloca.c9
-rw-r--r--missing/dir.h63
-rw-r--r--missing/dup2.c69
-rw-r--r--missing/erf.c91
-rw-r--r--missing/file.h33
-rw-r--r--missing/fileblocks.c1
-rw-r--r--missing/finite.c8
-rw-r--r--missing/flock.c74
-rw-r--r--missing/hypot.c17
-rw-r--r--missing/isinf.c64
-rw-r--r--missing/isnan.c17
-rw-r--r--missing/memcmp.c5
-rw-r--r--missing/memmove.c38
-rw-r--r--missing/nt.c2194
-rw-r--r--missing/nt.h358
-rw-r--r--missing/os2.c113
-rw-r--r--missing/setenv.c149
-rw-r--r--missing/strcasecmp.c7
-rw-r--r--missing/strchr.c57
-rw-r--r--missing/strdup.c25
-rw-r--r--missing/strerror.c8
-rw-r--r--missing/strftime.c76
-rw-r--r--missing/strncasecmp.c21
-rw-r--r--missing/strstr.c83
-rw-r--r--missing/strtod.c271
-rw-r--r--missing/strtol.c89
-rw-r--r--missing/vsnprintf.c64
-rw-r--r--missing/x68.c6
-rw-r--r--mkconfig.rb157
-rw-r--r--node.h266
-rw-r--r--numeric.c2656
-rw-r--r--object.c2691
-rw-r--r--pack.c1781
-rw-r--r--parse.y4957
-rw-r--r--prec.c141
-rw-r--r--process.c3240
-rw-r--r--random.c324
-rw-r--r--range.c679
-rw-r--r--re.c2023
-rw-r--r--re.h23
-rw-r--r--regex.c6156
-rw-r--r--regex.h277
-rw-r--r--ruby.1661
-rw-r--r--ruby.c961
-rw-r--r--ruby.h676
-rw-r--r--rubyio.h52
-rw-r--r--rubysig.h125
-rw-r--r--rubytest.rb36
-rw-r--r--sample/README18
-rw-r--r--sample/biorhythm.rb82
-rw-r--r--sample/cal.rb254
-rw-r--r--sample/clnt.rb12
-rw-r--r--sample/dir.rb6
-rw-r--r--sample/drb/README.rd56
-rw-r--r--sample/drb/README.rd.ja59
-rw-r--r--sample/drb/darray.rb12
-rw-r--r--sample/drb/darrayc.rb59
-rw-r--r--sample/drb/dbiff.rb51
-rw-r--r--sample/drb/dcdbiff.rb43
-rw-r--r--sample/drb/dchatc.rb41
-rw-r--r--sample/drb/dchats.rb70
-rw-r--r--sample/drb/dhasen.rb42
-rw-r--r--sample/drb/dhasenc.rb13
-rw-r--r--sample/drb/dlogc.rb16
-rw-r--r--sample/drb/dlogd.rb39
-rw-r--r--sample/drb/dqin.rb13
-rw-r--r--sample/drb/dqlib.rb14
-rw-r--r--sample/drb/dqout.rb14
-rw-r--r--sample/drb/dqueue.rb12
-rw-r--r--sample/drb/drbc.rb45
-rw-r--r--sample/drb/drbch.rb48
-rw-r--r--sample/drb/drbm.rb60
-rw-r--r--sample/drb/drbmc.rb22
-rw-r--r--sample/drb/drbs-acl.rb51
-rw-r--r--sample/drb/drbs.rb64
-rw-r--r--sample/drb/drbssl_c.rb19
-rw-r--r--sample/drb/drbssl_s.rb31
-rw-r--r--sample/drb/extserv_test.rb80
-rw-r--r--sample/drb/gw_ct.rb29
-rw-r--r--sample/drb/gw_cu.rb28
-rw-r--r--sample/drb/gw_s.rb10
-rw-r--r--sample/drb/holderc.rb22
-rw-r--r--sample/drb/holders.rb63
-rw-r--r--sample/drb/http0.rb77
-rw-r--r--sample/drb/http0serv.rb119
-rw-r--r--sample/drb/name.rb117
-rw-r--r--sample/drb/namec.rb36
-rw-r--r--sample/drb/old_tuplespace.rb214
-rw-r--r--sample/drb/rinda_ts.rb7
-rw-r--r--sample/drb/rindac.rb17
-rw-r--r--sample/drb/rindas.rb18
-rw-r--r--sample/drb/ring_echo.rb30
-rw-r--r--sample/drb/ring_inspect.rb30
-rw-r--r--sample/drb/ring_place.rb25
-rw-r--r--sample/drb/simpletuple.rb91
-rw-r--r--sample/drb/speedc.rb21
-rw-r--r--sample/drb/speeds.rb31
-rw-r--r--sample/dualstack-fetch.rb48
-rw-r--r--sample/dualstack-httpd.rb55
-rw-r--r--sample/eval.rb19
-rw-r--r--sample/exyacc.rb8
-rw-r--r--sample/fact.rb5
-rw-r--r--sample/fib.pl19
-rw-r--r--sample/fib.scm2
-rw-r--r--sample/freq.rb13
-rw-r--r--sample/from.rb5
-rw-r--r--sample/fullpath.rb14
-rw-r--r--sample/goodfriday.rb12
-rw-r--r--sample/list.rb16
-rw-r--r--sample/logger/app.rb46
-rw-r--r--sample/logger/log.rb27
-rw-r--r--sample/logger/shifting.rb26
-rw-r--r--sample/mine.rb175
-rw-r--r--sample/mkproto.rb10
-rw-r--r--sample/mpart.rb2
-rw-r--r--sample/mrshtest.rb1
-rw-r--r--sample/occur.rb10
-rw-r--r--sample/occur2.rb6
-rw-r--r--sample/openssl/c_rehash.rb174
-rw-r--r--sample/openssl/cert2text.rb23
-rw-r--r--sample/openssl/cert_store_view.rb911
-rw-r--r--sample/openssl/certstore.rb161
-rw-r--r--sample/openssl/cipher.rb29
-rw-r--r--sample/openssl/crlstore.rb122
-rw-r--r--sample/openssl/echo_cli.rb37
-rw-r--r--sample/openssl/echo_svr.rb62
-rw-r--r--sample/openssl/gen_csr.rb50
-rw-r--r--sample/openssl/smime_read.rb23
-rw-r--r--sample/openssl/smime_write.rb23
-rw-r--r--sample/openssl/wget.rb33
-rw-r--r--sample/optparse/opttest.rb85
-rw-r--r--sample/philos.rb4
-rw-r--r--sample/pi.rb2
-rw-r--r--sample/rbc.rb1015
-rw-r--r--sample/rcs.rb30
-rw-r--r--sample/rss/list_description.rb84
-rw-r--r--sample/rss/rss_recent.rb83
-rw-r--r--sample/rss/tdiary_plugin/rss-recent.rb213
-rw-r--r--sample/ruby-mode.el677
-rw-r--r--sample/sieve.rb22
-rw-r--r--sample/soap/authheader/authmgr.rb41
-rw-r--r--sample/soap/authheader/client.rb40
-rw-r--r--sample/soap/authheader/client2.rb39
-rw-r--r--sample/soap/authheader/server.rb72
-rw-r--r--sample/soap/authheader/server2.rb77
-rw-r--r--sample/soap/babelfish.rb16
-rw-r--r--sample/soap/calc/calc.rb17
-rw-r--r--sample/soap/calc/calc2.rb29
-rw-r--r--sample/soap/calc/client.rb26
-rw-r--r--sample/soap/calc/client2.rb29
-rw-r--r--sample/soap/calc/httpd.rb20
-rw-r--r--sample/soap/calc/samplehttpd.conf2
-rw-r--r--sample/soap/calc/server.cgi15
-rw-r--r--sample/soap/calc/server.rb17
-rw-r--r--sample/soap/calc/server2.rb20
-rw-r--r--sample/soap/digraph.rb43
-rw-r--r--sample/soap/exchange/client.rb19
-rw-r--r--sample/soap/exchange/exchange.rb17
-rw-r--r--sample/soap/exchange/httpd.rb20
-rw-r--r--sample/soap/exchange/samplehttpd.conf2
-rw-r--r--sample/soap/exchange/server.cgi14
-rw-r--r--sample/soap/exchange/server.rb16
-rw-r--r--sample/soap/helloworld/hw_c.rb6
-rw-r--r--sample/soap/helloworld/hw_s.rb17
-rw-r--r--sample/soap/icd/IICD.rb17
-rw-r--r--sample/soap/icd/icd.rb46
-rw-r--r--sample/soap/raa/iRAA.rb154
-rw-r--r--sample/soap/raa/soap4r.rb30
-rw-r--r--sample/soap/raa2.4/raa.rb332
-rw-r--r--sample/soap/raa2.4/raaDriver.rb255
-rw-r--r--sample/soap/raa2.4/raaServiceClient.rb354
-rw-r--r--sample/soap/raa2.4/sample.rb115
-rw-r--r--sample/soap/sampleStruct/client.rb16
-rw-r--r--sample/soap/sampleStruct/httpd.rb20
-rw-r--r--sample/soap/sampleStruct/iSampleStruct.rb22
-rw-r--r--sample/soap/sampleStruct/sampleStruct.rb13
-rw-r--r--sample/soap/sampleStruct/samplehttpd.conf2
-rw-r--r--sample/soap/sampleStruct/server.cgi14
-rw-r--r--sample/soap/sampleStruct/server.rb20
-rw-r--r--sample/soap/ssl/files/README1
-rw-r--r--sample/soap/ssl/files/ca.cert23
-rw-r--r--sample/soap/ssl/files/client.cert19
-rw-r--r--sample/soap/ssl/files/client.key15
-rw-r--r--sample/soap/ssl/files/server.cert19
-rw-r--r--sample/soap/ssl/files/server.key15
-rw-r--r--sample/soap/ssl/files/sslclient.properties5
-rw-r--r--sample/soap/ssl/files/sslclient_require_noserverauth.properties2
-rw-r--r--sample/soap/ssl/files/sslclient_with_clientauth.properties9
-rw-r--r--sample/soap/ssl/files/subca.cert21
-rw-r--r--sample/soap/ssl/sslclient.rb12
-rw-r--r--sample/soap/ssl/sslclient_require_noserverauth.rb12
-rw-r--r--sample/soap/ssl/sslclient_with_clientauth.rb12
-rw-r--r--sample/soap/ssl/sslserver.rb49
-rw-r--r--sample/soap/ssl/sslserver_noauth.rb45
-rw-r--r--sample/soap/ssl/sslserver_require_clientauth.rb50
-rw-r--r--sample/soap/swa/client.rb13
-rw-r--r--sample/soap/swa/server.rb23
-rw-r--r--sample/soap/whois.rb14
-rw-r--r--sample/svr.rb6
-rw-r--r--sample/test.rb1718
-rw-r--r--sample/testunit/adder.rb13
-rw-r--r--sample/testunit/subtracter.rb12
-rw-r--r--sample/testunit/tc_adder.rb18
-rw-r--r--sample/testunit/tc_subtracter.rb18
-rw-r--r--sample/testunit/ts_examples.rb7
-rw-r--r--sample/time.rb4
-rw-r--r--sample/tkhello.rb10
-rw-r--r--sample/trojan.rb5
-rw-r--r--sample/tsvr.rb15
-rw-r--r--sample/uumerge.rb16
-rw-r--r--sample/webrick/demo-app.rb66
-rw-r--r--sample/webrick/demo-multipart.cgi12
-rw-r--r--sample/webrick/demo-servlet.rb6
-rw-r--r--sample/webrick/demo-urlencoded.cgi12
-rw-r--r--sample/webrick/hello.cgi11
-rw-r--r--sample/webrick/hello.rb8
-rw-r--r--sample/webrick/httpd.rb23
-rw-r--r--sample/webrick/httpsd.rb33
-rw-r--r--sample/wsdl/amazon/AmazonSearch.rb3057
-rw-r--r--sample/wsdl/amazon/AmazonSearchDriver.rb536
-rw-r--r--sample/wsdl/amazon/sampleClient.rb37
-rw-r--r--sample/wsdl/amazon/wsdlDriver.rb52
-rw-r--r--sample/wsdl/googleSearch/GoogleSearch.rb258
-rw-r--r--sample/wsdl/googleSearch/GoogleSearchDriver.rb101
-rw-r--r--sample/wsdl/googleSearch/README6
-rw-r--r--sample/wsdl/googleSearch/httpd.rb20
-rw-r--r--sample/wsdl/googleSearch/sampleClient.rb56
-rw-r--r--sample/wsdl/googleSearch/samplehttpd.conf2
-rw-r--r--sample/wsdl/googleSearch/sjissearch.sh3
-rw-r--r--sample/wsdl/googleSearch/wsdlDriver.rb23
-rw-r--r--sample/wsdl/raa/raa.wsdl264
-rw-r--r--sample/wsdl/raa/soap4r.rb31
-rw-r--r--sample/wsdl/raa2.4/raa.rb332
-rw-r--r--sample/wsdl/raa2.4/wsdlDriver.rb117
-rw-r--r--signal.c653
-rw-r--r--sprintf.c643
-rw-r--r--st.c417
-rw-r--r--st.h44
-rw-r--r--string.c4586
-rw-r--r--struct.c905
-rw-r--r--test/csv/test_csv.rb1753
-rw-r--r--test/dbm/test_dbm.rb54
-rw-r--r--test/digest/test_digest.rb97
-rw-r--r--test/drb/drbtest.rb303
-rw-r--r--test/drb/test_acl.rb195
-rw-r--r--test/drb/test_drb.rb286
-rw-r--r--test/drb/test_drbssl.rb74
-rw-r--r--test/drb/test_drbunix.rb57
-rw-r--r--test/drb/ut_array.rb15
-rw-r--r--test/drb/ut_array_drbssl.rb24
-rw-r--r--test/drb/ut_array_drbunix.rb15
-rw-r--r--test/drb/ut_drb.rb143
-rw-r--r--test/drb/ut_drb_drbssl.rb25
-rw-r--r--test/drb/ut_drb_drbunix.rb16
-rw-r--r--test/drb/ut_eval.rb23
-rw-r--r--test/drb/ut_large.rb38
-rw-r--r--test/drb/ut_port.rb14
-rw-r--r--test/drb/ut_safe1.rb16
-rw-r--r--test/drb/ut_timerholder.rb49
-rw-r--r--test/erb/test_erb.rb40
-rw-r--r--test/fileutils/fileasserts.rb51
-rw-r--r--test/fileutils/test_fileutils.rb642
-rw-r--r--test/fileutils/test_nowrite.rb89
-rw-r--r--test/gdbm/test_gdbm.rb52
-rw-r--r--test/logger/test_logger.rb276
-rw-r--r--test/monitor/test_monitor.rb161
-rw-r--r--test/openssl/ssl_server.rb71
-rw-r--r--test/openssl/test_cipher.rb62
-rw-r--r--test/openssl/test_digest.rb65
-rw-r--r--test/openssl/test_hmac.rb34
-rw-r--r--test/openssl/test_ssl.rb195
-rw-r--r--test/openssl/test_x509cert.rb175
-rw-r--r--test/openssl/test_x509crl.rb218
-rw-r--r--test/openssl/test_x509name.rb180
-rw-r--r--test/openssl/test_x509req.rb140
-rw-r--r--test/openssl/test_x509store.rb143
-rw-r--r--test/openssl/utils.rb135
-rw-r--r--test/optparse/test_noarg.rb57
-rw-r--r--test/optparse/test_optarg.rb44
-rw-r--r--test/optparse/test_optparse.rb46
-rw-r--r--test/optparse/test_placearg.rb45
-rw-r--r--test/optparse/test_reqarg.rb63
-rw-r--r--test/ostruct/test_ostruct.rb23
-rw-r--r--test/rinda/test_rinda.rb403
-rw-r--r--test/rss/rss-assertions.rb162
-rw-r--r--test/rss/rss-testcase.rb240
-rw-r--r--test/rss/test_1.0.rb268
-rw-r--r--test/rss/test_accessor.rb24
-rw-r--r--test/rss/test_content.rb95
-rw-r--r--test/rss/test_dublincore.rb124
-rw-r--r--test/rss/test_maker_0.9.rb397
-rw-r--r--test/rss/test_maker_1.0.rb363
-rw-r--r--test/rss/test_maker_2.0.rb622
-rw-r--r--test/rss/test_maker_content.rb34
-rw-r--r--test/rss/test_maker_dc.rb71
-rw-r--r--test/rss/test_maker_sy.rb43
-rw-r--r--test/rss/test_maker_trackback.rb35
-rw-r--r--test/rss/test_maker_xml-stylesheet.rb75
-rw-r--r--test/rss/test_parser.rb611
-rw-r--r--test/rss/test_syndication.rb123
-rw-r--r--test/rss/test_trackback.rb135
-rw-r--r--test/rss/test_xml-stylesheet.rb108
-rw-r--r--test/ruby/beginmainend.rb85
-rw-r--r--test/ruby/endblockwarn.rb12
-rw-r--r--test/ruby/envutil.rb21
-rw-r--r--test/ruby/marshaltestlib.rb494
-rw-r--r--test/ruby/test_alias.rb40
-rw-r--r--test/ruby/test_array.rb101
-rw-r--r--test/ruby/test_assignment.rb467
-rw-r--r--test/ruby/test_beginendblock.rb57
-rw-r--r--test/ruby/test_bignum.rb87
-rw-r--r--test/ruby/test_call.rb19
-rw-r--r--test/ruby/test_case.rb49
-rw-r--r--test/ruby/test_clone.rb28
-rw-r--r--test/ruby/test_condition.rb16
-rw-r--r--test/ruby/test_const.rb33
-rw-r--r--test/ruby/test_defined.rb43
-rw-r--r--test/ruby/test_env.rb84
-rw-r--r--test/ruby/test_eval.rb157
-rw-r--r--test/ruby/test_exception.rb187
-rw-r--r--test/ruby/test_file.rb70
-rw-r--r--test/ruby/test_float.rb89
-rw-r--r--test/ruby/test_gc.rb30
-rw-r--r--test/ruby/test_hash.rb74
-rw-r--r--test/ruby/test_ifunless.rb14
-rw-r--r--test/ruby/test_io.rb11
-rw-r--r--test/ruby/test_iterator.rb451
-rw-r--r--test/ruby/test_marshal.rb48
-rw-r--r--test/ruby/test_math.rb12
-rw-r--r--test/ruby/test_pack.rb19
-rw-r--r--test/ruby/test_path.rb46
-rw-r--r--test/ruby/test_pipe.rb18
-rw-r--r--test/ruby/test_proc.rb89
-rw-r--r--test/ruby/test_range.rb11
-rw-r--r--test/ruby/test_signal.rb25
-rw-r--r--test/ruby/test_string.rb19
-rw-r--r--test/ruby/test_stringchar.rb116
-rw-r--r--test/ruby/test_struct.rb24
-rw-r--r--test/ruby/test_system.rb64
-rw-r--r--test/ruby/test_time.rb74
-rw-r--r--test/ruby/test_trace.rb21
-rw-r--r--test/ruby/test_variable.rb53
-rw-r--r--test/ruby/test_whileuntil.rb77
-rw-r--r--test/ruby/ut_eof.rb115
-rw-r--r--test/runner.rb7
-rw-r--r--test/soap/calc/calc.rb17
-rw-r--r--test/soap/calc/calc2.rb29
-rw-r--r--test/soap/calc/server.cgi13
-rw-r--r--test/soap/calc/server.rb17
-rw-r--r--test/soap/calc/server2.rb20
-rw-r--r--test/soap/calc/test_calc.rb56
-rw-r--r--test/soap/calc/test_calc2.rb60
-rw-r--r--test/soap/calc/test_calc_cgi.rb76
-rw-r--r--test/soap/header/server.cgi119
-rw-r--r--test/soap/header/test_authheader.rb247
-rw-r--r--test/soap/header/test_authheader_cgi.rb128
-rw-r--r--test/soap/helloworld/hw_s.rb16
-rw-r--r--test/soap/helloworld/test_helloworld.rb47
-rw-r--r--test/soap/marshal/test_digraph.rb56
-rw-r--r--test/soap/marshal/test_marshal.rb26
-rw-r--r--test/soap/marshal/test_struct.rb47
-rw-r--r--test/soap/ssl/README1
-rw-r--r--test/soap/ssl/ca.cert23
-rw-r--r--test/soap/ssl/client.cert19
-rw-r--r--test/soap/ssl/client.key15
-rw-r--r--test/soap/ssl/server.cert19
-rw-r--r--test/soap/ssl/server.key15
-rw-r--r--test/soap/ssl/sslsvr.rb56
-rw-r--r--test/soap/ssl/subca.cert21
-rw-r--r--test/soap/ssl/test_ssl.rb212
-rw-r--r--test/soap/struct/test_struct.rb83
-rw-r--r--test/soap/swa/test_file.rb77
-rw-r--r--test/soap/test_basetype.rb964
-rw-r--r--test/soap/test_property.rb422
-rw-r--r--test/soap/test_soapelement.rb121
-rw-r--r--test/soap/test_streamhandler.rb197
-rw-r--r--test/soap/wsdlDriver/README.txt2
-rw-r--r--test/soap/wsdlDriver/echo_version.rb20
-rw-r--r--test/soap/wsdlDriver/simpletype.wsdl63
-rw-r--r--test/soap/wsdlDriver/test_simpletype.rb92
-rw-r--r--test/stringio/test_stringio.rb33
-rw-r--r--test/strscan/test_stringscanner.rb487
-rw-r--r--test/testunit/collector/test_dir.rb389
-rw-r--r--test/testunit/collector/test_objectspace.rb98
-rw-r--r--test/testunit/runit/test_assert.rb402
-rw-r--r--test/testunit/runit/test_testcase.rb91
-rw-r--r--test/testunit/runit/test_testresult.rb144
-rw-r--r--test/testunit/runit/test_testsuite.rb49
-rw-r--r--test/testunit/test_assertions.rb528
-rw-r--r--test/testunit/test_error.rb26
-rw-r--r--test/testunit/test_failure.rb33
-rw-r--r--test/testunit/test_testcase.rb275
-rw-r--r--test/testunit/test_testresult.rb104
-rw-r--r--test/testunit/test_testsuite.rb129
-rw-r--r--test/testunit/util/test_backtracefilter.rb41
-rw-r--r--test/testunit/util/test_observable.rb102
-rw-r--r--test/testunit/util/test_procwrapper.rb36
-rw-r--r--test/uri/test_common.rb56
-rw-r--r--test/uri/test_ftp.rb42
-rw-r--r--test/uri/test_generic.rb683
-rw-r--r--test/uri/test_http.rb63
-rw-r--r--test/uri/test_ldap.rb100
-rw-r--r--test/uri/test_mailto.rb122
-rw-r--r--test/wsdl/axisArray/axisArray.wsdl60
-rw-r--r--test/wsdl/axisArray/itemList.rb27
-rw-r--r--test/wsdl/axisArray/test_axisarray.rb69
-rw-r--r--test/wsdl/datetime/DatetimeService.rb38
-rw-r--r--test/wsdl/datetime/datetime.rb0
-rw-r--r--test/wsdl/datetime/datetime.wsdl45
-rw-r--r--test/wsdl/datetime/datetimeServant.rb21
-rw-r--r--test/wsdl/datetime/test_datetime.rb88
-rw-r--r--test/wsdl/emptycomplextype.wsdl31
-rw-r--r--test/wsdl/map/map.wsdl66
-rw-r--r--test/wsdl/map/map.xml43
-rw-r--r--test/wsdl/map/test_map.rb37
-rw-r--r--test/wsdl/multiplefault.wsdl68
-rw-r--r--test/wsdl/raa/RAA.rb243
-rw-r--r--test/wsdl/raa/RAAServant.rb99
-rw-r--r--test/wsdl/raa/RAAService.rb101
-rw-r--r--test/wsdl/raa/README.txt8
-rw-r--r--test/wsdl/raa/raa.wsdl264
-rw-r--r--test/wsdl/raa/test_raa.rb78
-rw-r--r--test/wsdl/simpletype/simpletype.wsdl67
-rw-r--r--test/wsdl/simpletype/test_simpletype.rb81
-rw-r--r--test/wsdl/soap/soapbodyparts.wsdl103
-rw-r--r--test/wsdl/soap/test_soapbodyparts.rb86
-rw-r--r--test/wsdl/test_emptycomplextype.rb21
-rw-r--r--test/wsdl/test_fault.rb51
-rw-r--r--test/wsdl/test_multiplefault.rb39
-rw-r--r--test/xsd/noencoding.xml4
-rw-r--r--test/xsd/test_noencoding.rb32
-rw-r--r--test/xsd/test_xmlschemaparser.rb22
-rw-r--r--test/xsd/test_xsd.rb1011
-rw-r--r--test/xsd/xmlschema.xml12
-rw-r--r--test/yaml/test_yaml.rb1246
-rw-r--r--test/zlib/test_zlib.rb57
-rw-r--r--time.c1999
-rw-r--r--top.sed58
-rw-r--r--util.c1144
-rw-r--r--util.h58
-rw-r--r--variable.c1643
-rw-r--r--version.c33
-rw-r--r--version.h17
-rw-r--r--vms/config.h_in61
-rw-r--r--vms/vms.h6
-rw-r--r--win32/Makefile241
-rw-r--r--win32/Makefile.sub678
-rw-r--r--win32/README.win32126
-rw-r--r--win32/config.h67
-rwxr-xr-xwin32/configure.bat32
-rw-r--r--win32/dir.h35
-rw-r--r--win32/mkexports.rb30
-rwxr-xr-xwin32/ntsetup.bat10
-rw-r--r--win32/resource.rb97
-rw-r--r--win32/ruby.def431
-rw-r--r--win32/setup.mak87
-rw-r--r--win32/win32.c3345
-rw-r--r--win32/win32.h505
-rw-r--r--win32/winmain.c10
-rw-r--r--wince/Makefile.sub718
-rw-r--r--wince/README.wince121
-rw-r--r--wince/assert.c11
-rw-r--r--wince/assert.h6
-rw-r--r--wince/configure.bat59
-rw-r--r--wince/direct.c54
-rw-r--r--wince/direct.h22
-rw-r--r--wince/errno.c11
-rw-r--r--wince/errno.h55
-rw-r--r--wince/fcntl.h42
-rw-r--r--wince/io.h76
-rw-r--r--wince/io_wce.c230
-rw-r--r--wince/mkconfig_wce.rb7
-rw-r--r--wince/mkexports.rb35
-rw-r--r--wince/process.h46
-rw-r--r--wince/process_wce.c47
-rw-r--r--wince/resource.rb96
-rw-r--r--wince/setup.mak233
-rw-r--r--wince/signal.h71
-rw-r--r--wince/signal_wce.c26
-rw-r--r--wince/stddef.h5
-rw-r--r--wince/stdio.c36
-rw-r--r--wince/stdlib.c57
-rw-r--r--wince/string_wce.c89
-rw-r--r--wince/sys/stat.c102
-rw-r--r--wince/sys/stat.h68
-rw-r--r--wince/sys/timeb.c25
-rw-r--r--wince/sys/timeb.h26
-rw-r--r--wince/sys/types.h67
-rw-r--r--wince/sys/utime.c44
-rw-r--r--wince/sys/utime.h27
-rw-r--r--wince/time.h63
-rw-r--r--wince/time_wce.c301
-rw-r--r--wince/varargs.h34
-rw-r--r--wince/wince.c583
-rw-r--r--wince/wince.h191
-rw-r--r--wince/wincemain.c19
-rw-r--r--wince/wincon.h7
-rw-r--r--wince/winsock2.c338
2133 files changed, 440276 insertions, 53281 deletions
diff --git a/.cvsignore b/.cvsignore
index 2474526e2a..52a5620133 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -1,18 +1,54 @@
+*.bak
+*.orig
+*.rej
+*.sav
+*~
+.ccmalloc
+.ppack
+COPYING.LIB
+ChangeLog.pre-alpha
+ChangeLog.pre1_1
Makefile
-parse.c
-newver.rb
-ruby
-miniruby
README.fat-patch
+README.v6
+README.atheos
+archive
+autom4te*.cache
+automake
+beos
config.cache
config.h
+config.h.in
config.log
config.status
-Makefile
+configure
+foo.rb
+libruby.so.*
+miniruby
+miniruby.elhash
+miniruby.elhash2
+miniruby.orig2
+miniruby.plhash
+miniruby.plhash2
+modex.rb
+newdate.rb
+newver.rb
+parse.c
+parse.y.try
+pitest.rb
ppack
-archive
-*.orig
-*.rej
-*.bak
-*.sav
-*~
+preview
+rbconfig.rb
+rename2.h
+repack
+riscos
+rubicon
+ruby
+ruby-man.rd.gz
+rubyunit
+st.c.power
+this that
+tmp
+web
+y.output
+y.tab.c
diff --git a/.document b/.document
new file mode 100644
index 0000000000..230c50e387
--- /dev/null
+++ b/.document
@@ -0,0 +1,16 @@
+# This file determines which files in the
+# Ruby hierarchy will be processed by the RDoc
+# tool when it is given the top-level directory
+# as an argument
+
+# Process all the C source files
+*.c
+
+# the lib/ directory (which has its own .document file)
+
+lib
+
+
+# and some of the ext/ directory (which has its own .document file)
+
+ext
diff --git a/COPYING b/COPYING
index eeb586b392..870a5f22d6 100644
--- a/COPYING
+++ b/COPYING
@@ -1,340 +1,56 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
+Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
+You can redistribute it and/or modify it under either the terms of the GPL
+(see the file GPL), or the conditions below:
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
+ 1. You may make and give away verbatim copies of the source form of the
+ software without restriction, provided that you duplicate all of the
+ original copyright notices and associated disclaimers.
- Preamble
+ 2. You may modify your copy of the software in any way, provided that
+ you do at least ONE of the following:
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
+ a) place your modifications in the Public Domain or otherwise
+ make them Freely Available, such as by posting said
+ modifications to Usenet or an equivalent medium, or by allowing
+ the author to include your modifications in the software.
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
+ b) use the modified software only within your corporation or
+ organization.
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
+ c) give non-standard binaries non-standard names, with
+ instructions on where to get the original software distribution.
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
+ d) make other distribution arrangements with the author.
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
+ 3. You may distribute the software in object code or binary form,
+ provided that you do at least ONE of the following:
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
+ a) distribute the binaries and library files of the software,
+ together with instructions (in the manual page or equivalent)
+ on where to get the original distribution.
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
+ b) accompany the distribution with the machine-readable source of
+ the software.
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+ c) give non-standard binaries non-standard names, with
+ instructions on where to get the original software distribution.
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
+ d) make other distribution arrangements with the author.
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
+ 4. You may modify and include the part of the software into any other
+ software (possibly commercial). But some files in the distribution
+ are not written by the author, so that they are not under these terms.
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
+ For the list of those files and their copying conditions, see the
+ file LEGAL.
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
+ 5. The scripts and library files supplied as input to or produced as
+ output from the software do not automatically fall under the
+ copyright of the software, but belong to whomever generated them,
+ and may be sold commercially, and may be aggregated with this
+ software.
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) 19yy name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE.
diff --git a/COPYING.ja b/COPYING.ja
new file mode 100644
index 0000000000..933cc7cb9a
--- /dev/null
+++ b/COPYING.ja
@@ -0,0 +1,51 @@
+本プログラムはフリ・踉札愁侫肇逅札Д△任后俳岬芭賠鈬鱇貅蝟昭粡竚癈鷭п粐Ь跚也竇銖紿または以王踉擦胞踉雑す魴錣破椒廛蹈哀薀爐鮑毒柯曚鹿粡寂蝟赱齠洲痲筵娼きます.GPLについてはGPLファイルを参箸靴堂さい.
+
+ 1. 複製は制限なく海任后鹿粡寂蝟赱齠洲痲筵娼鹿粡寂蝟赱齠洲痲筵娼荻ぢ以王踉擦陸苳賜件のいずれかを満たす時に本プログラムのソ・踉札垢鹿粡寂蝟赱齠洲痲筵娼ぢ海吠儿垢任泙后鹿粡寂蝟赱齠洲痲筵娼鹿粡寂蝟赱齠洲痲筵娼瓸ぢネットニュ・踉札困縫櫂好箸靴燭蝓ず遉踉市に変更を送付する
+ などの方法で,変更を公開する.
+
+ (b) 変更した本プログラムを僚蠡阿垢訌反テ睇瑤世韻鹿粡寂蝟赱齠洲痲筵娼ぢ使う瘢雹.
+
+ (c) 変更点を明┐靴燭逅擦─ぅ愁侫肇逅札Д△量前を変更する.
+ そのソフトウ瘢雹ェアを配布する時には変更前の本プログラ
+ ムも同時に配布する.または変更前の本プログラムのソ・踉鹿粡寂蝟赱齠洲痲筵娼ぢスの入衙,鯡畝踉雑する.
+
+ (d) その側苳擦諒儿孔苳賜件を作圓塙膂佞垢襦鹿粡寂蝟赱齠洲痲筵娼鹿粡寂蝟赱齠洲痲筵娼凱ぢ以王踉擦陸苳賜件のいずれかを満たす時に本プログラムをコンパイ
+ ルしたオブジェクトコ・踉札匹筅踉斬行形阿任眷柯曚任泙后鹿粡寂蝟赱齠洲痲筵娼鹿粡寂蝟赱齠洲痲筵娼瓸ぢバイナリを右踉肢った人がソ・踉札垢鯑踉至できるよう瘢雹に,
+ ソ・踉札垢瞭踉至法を明┐垢襦鹿粡寂蝟赱齠洲痲筵娼鹿粡寂蝟赱齠洲痲筵娼皎ぢ機械可読なソ・踉札好魁ドを添付する.
+
+ (c) 変更を行ったバイナリは巳苳餐阿鯤儿垢靴燭逅擦─ぅ螢献鹿粡寂蝟赱齠洲痲筵娼ぢルのソ・踉札好魁ドの入衙,鯡畝踉雑する.
+
+ (d) その側苳擦稜柯昿苳賜件を作圓塙膂佞垢襦鹿粡寂蝟赱齠洲痲筵娼鹿粡寂蝟赱齠洲痲筵娼堪ぢ側苳擦離廛蹈哀薀爐悗琉僂呂い覆詭榲任△讀踉捌由です.た
+ だし,本プログラムに含まれる側苳擦虜遉踉市によるコ・踉札匹蓮い鹿粡寂蝟赱齠洲痲筵娼ぢれう苳擦譴虜遉踉市の意向による制限が加えられる豺腓△蠅泙后鹿粡寂蝟赱齠洲痲筵娼鹿粡寂蝟赱齠洲痲筵娼ぢそれらファイルの一覧とそれう苳擦譴稜柯昿苳賜件などに付いては
+ LEGALファイルを参箸靴討世気ぁ鹿粡寂蝟赱齠洲痲筵娼鹿粡寂蝟赱齠洲痲筵娼貴ぢ本プログラムへの入力となるスクリプトおよび,本プログラ
+ ムからの出力の権利は本プログラムの作圓任呂覆い修譴
+ れの入出力を生成した人に属します.また,本プログラムに
+ 組み込まれるための拡張ライブラリについても同様です.
+
+ 6. 本プログラムは無保擇任后ズ遉踉市は本プログラムをサポ・踉札鹿粡寂蝟赱齠洲痲筵娼ぢする意志はありますが,プログラム箸離丱阿△襪い亘椒鹿粡寂蝟赱齠洲痲筵娼ぢログラムの孫圓覆匹虍犬垢襪い覆訛山欧紡个靴討眄鹿粡寂蝟赱齠洲痲筵娼ぢ任を持ちません.
diff --git a/ChangeLog b/ChangeLog
index 14bc362df3..027f0c2a6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,2632 +1,8912 @@
-Mon Nov 9 17:55:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Sat Nov 6 00:46:27 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * version 1.1c7 released.
+ * string.c (rb_str_locktmp): check STR_TMPLOCK flag before
+ locking. [ruby-dev:24727]
-Fri Nov 6 19:25:27 1998 Takao KAWAMURA <kawamura@ike.tottori-u.ac.jp>
+Fri Nov 5 18:12:42 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * sample/ruby-mode.el: font-lock patch.
+ * ext/tk/lib/tk/scrollable.rb: divide Scrollable module into
+ X_Scrollable and Y_Scrollable
-Thu Nov 5 15:42:22 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/lib/tk/entry.rb: include X_Scrollable instead of Scrollable
- * sample/README, lib/README: simple description for each file.
+ * ext/tk/lib/tk/autoload.rb: define autoload for X_Scrollable and
+ Y_Scrollable
-Wed Nov 4 18:14:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Fri Nov 5 16:05:32 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * eval.c (assign): attribute assignment should be called as public.
+ * ext/tk/lib/tk.rb: TkComm._at() supprts both of "@x,y" and "@x"
-Mon Nov 2 18:24:33 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Fri Nov 5 13:22:58 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * eval.c (thread_create): was accessing modified status.
+ * ext/tk/lib/tk/text.rb: sorry. bug fix again.
-Sun Nov 1 01:18:52 1998 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+Fri Nov 5 13:17:54 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * gc.c (xrealloc): size 0 needs round up to 1.
+ * ext/tk/lib/tk/text.rb: bug fix
-Sat Oct 31 23:18:34 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Fri Nov 5 08:52:48 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * string.c (rb_str_split_method): negative LIMIT means number of
- splitted fields are unlimited, as in perl.
+ * gc.c (gc_mark): stricter GC stack check.
- * string.c (rb_str_split_method): if LIMIT is unspecified,
- trailing null fields are stripped.
+Fri Nov 5 08:34:43 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Sat Oct 31 04:16:14 1998 Inaba Hiroto <inaba@st.rim.or.jp>
+ * string.c (str_gsub): should have removed rb_str_unlocktmp(str).
+ [ruby-dev:24708]
- * string.c (str_aref): regexp index SEGVed.
+Thu Nov 4 21:25:38 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Fri Oct 30 14:33:47 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * string.c (str_gsub): string modify check no longer based on
+ tmplock. [ruby-dev:24706]
- * re.c (reg_match): returns nil for unmatch.
+Thu Nov 4 19:27:46 2004 NAKAMURA Usaku <usa@ruby-lang.org>
- * dir.c (dir_entries): new method.
+ * io.c (rb_f_open): fix typo.
- * eval.c (block_pass): do not push block, substitute it.
+Thu Nov 4 15:02:14 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-Wed Oct 28 11:37:42 1998 TAMITO <tommy@valley.ne.jp>
+ * ext/tk/lib/tk/variable.rb: forget to initialize instance_variables
+ of TkVarAccess objects
- * io.c (f_select): fd number comparison bug.
+Thu Nov 4 09:11:35 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Sun Oct 25 22:59:27 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * gc.c (gc_mark): enable GC stack checking.
- * regex.c (set_list_bits): was using wrong offset.
+Thu Nov 4 03:11:33 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Mon Oct 19 11:50:00 1998 Motoyuki Kasahara <m-kasahr@sra.co.jp>
+ * string.c (str_gsub): lock strings temporarily. [ruby-dev:24687]
- * ext/extmk.rb: Load '@top_srcdir@/lib/find.rb', not
- '../lib/find.rb'.
- * ext/extmk.rb: Distinguish between `top_srcdir' and `topdir'.
- * Makefile.in (CFLAGS): Add `-I.'.
- * Makefile.in (lex.c): Give `@srcdir@/keywords' to gperf, not
- `keywords'.
- * instruby.rb: Use `CONFIG["bindir"]', instead of `prefix + "/bin"'.
- * instruby.rb: Use `CONFIG["libdir"]', instead of `prefix + "/lib"'.
- * instruby.rb Use `CONFIG["mandir"]', instead of `prefix + "/man"'.
- * instruby.rb (wdir): Add the variable to preserve the current
- working directory.
- * instruby.rb: Chdir to wdir before install `config.h' and
- `rbconfig.rb'.
+ * ext/socket/socket.c (s_recvfrom): tmplock input buffer.
+ [ruby-dev:24705]
-Mon Oct 19 10:07:01 1998 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+Wed Nov 3 22:32:12 2004 NARUSE, Yui <naruse@ruby-lang.org>
- * eval.c (rb_eval): reduce recursive calls to rb_eval().
+ * process.c: On NetBSD don't use setruid() and setrgid().
-Thu Oct 15 13:54:48 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Nov 3 22:24:17 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * parse.y (arg): local variabls can be accessed within right side
- expression in assignment, notably in blocks.
+ * lib/webrick/httpauth/digestauth.rb: use Base64.encode64 to
+ avoid warnings.
-Mon Oct 12 13:27:15 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Nov 3 17:19:59 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * eval.c (rb_call0): check stack depth more frequently.
+ * array.c (rb_ary_uniq_bang): do not push frozen string from hash
+ table. [ruby-dev:24695]
-Fri Oct 9 17:01:14 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * array.c (rb_ary_and): ditto.
- * io.c (read_all): read() returns "" at immediate EOF.
+ * array.c (rb_ary_or): ditto.
- * io.c (io_read): read(nil) read all until EOF.
+Wed Nov 3 17:13:02 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-Thu Oct 8 13:32:13 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * io.c (pipe_open): fix compile error
- * time.c (time_dump): marshal can dump Time object now.
+Wed Nov 3 16:58:07 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * marshal.c (Init_marshal): rename marshal methods `_dump_to' to
- `_dump', `_load_from' to `_load'.
+ * ext/tk/lib/tk.rb: support to use different Tcl commands between
+ configure and configinfo
- * parse.y (rb_intern): "+=".intern generates proper symbol.
+ * ext/tk/lib/font.rb: ditto.
-Mon Oct 5 18:31:53 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/lib/itemconfig.rb: support to use different Tcl commands
+ between item_configure and item_configinfo
- * version 1.1c6 released.
+ * ext/tk/lib/itemfont.rb: ditto.
-Fri Oct 2 14:22:33 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/extconf.rb: install SUPPORT_STATUS
- * regex.c (re_search): `/\s*(--)$/ =~ "- --"' did not match,
- because of wrong optimize condition.
+ * ext/tk/lib/tkextlib: some bug fixes (see ext/tk/ChangeLog.tkextlib)
-Mon Oct 1 01:55:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Nov 3 16:30:41 2004 NARUSE, Yui <naruse@ruby-lang.org>
- * parse.y (rb_intern): should not raise exceptions.
+ * ext/nkf: follow nkf 2.0.4
- * parse.y (yylex): symbol like `:foo?=' should not be allowed.
+Wed Nov 3 15:53:34 2004 Kouhei Sutou <kou@cozmixng.org>
- * ext/extmk.rb.in: makes *.a for static link modules.
+ * test/rss/test_maker_*.rb: added tests for RSS Maker.
-Fri Sep 25 12:01:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/rss/maker.rb: added RSS Maker.
+
+ * lib/rss/maker/*.rb: ditto.
- * parse.y (yylex): `@foo!' should be an error.
+Tue Nov 2 16:35:57 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Thu Sep 24 14:55:06 1998 WATANABE Tetsuya <tetsu@jpn.hp.com>
+ * ext/enumerator/enumerator.c (each_cons_i): pass copy of an
+ internal consequent array. [ruby-talk:118691]
- * ext/etc/etc.c (Init_etc): wrong field definition.
+Tue Nov 2 16:05:21 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Thu Sep 17 17:09:05 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * process.c (rb_f_fork): need to flush stdout and stderr before
+ fork(2). [ruby-talk:117715]
- * io.c (io_reopen): was creating FILE* for wrong fd.
+Tue Nov 2 01:20:09 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Tue Sep 15 05:28:11 1998 Koji Arai <JCA02266@nifty.ne.jp>
+ * eval.c (proc_invoke): nail down dyna_var node when Proc object
+ or continuation is created. [ruby-dev:24671]
- * regex.c (re_compile_pattern): forgot to fixup for the pattern
- like (?=(A)|(B)).
+Mon Nov 1 13:59:28 2004 WATANABE Hirofumi <eban@ruby-lang.org>
-Mon Sep 14 14:42:27 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/extmk.rb (MANIFEST): do not use anymore, use extconf.rb instead.
- * regex.c (re_match): beginning and end of the string, do not
- automatically match `\b'.
+ * ext/enumerator/extconf.rb, ext/fcntl/extconf.rb,
+ ext/stringio/extconf.rb: added.
- * string.c (scan_once): comsume at leaset on character.
+ * MANIFEST, ext/**/MANIFEST: removed.
- * regex.c (re_search): wrong behavior for negative range.
+ * README.EXT, README.EXT.ja: remove MANIFEST stuff.
-Sat Sep 12 21:21:26 1998 Koji Arai <JCA02266@nifty.ne.jp>
+Mon Nov 1 01:14:52 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * regex.c (re_search): range value should be maintained.
+ * io.c (rb_f_open): create copy of popen specifier. [ruby-dev:24656]
-Thu Sep 10 10:55:00 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Mon Nov 1 00:36:48 2004 WATANABE Hirofumi <eban@ruby-lang.org>
- * parse.y (backref_error): yyerror does not understand formats.
+ * main.c (_stklen): move to gc.c.
-Tue Sep 8 18:05:33 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Sun Oct 31 00:22:28 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * version 1.1c5 released.
+ * string.c (rb_str_locktmp): lock string temporarily.
-Tue Sep 8 10:03:39 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * string.c (str_independent): add tmplock check.
- * string.c (str_each_line): wrong line splitting with newline at
- top of the string.
+ * io.c (io_write): lock output string temporarily.
+ [ruby-dev:24649]
- * string.c: non bang methods return copied string.
+ * io.c (io_write): use rb_str_locktmp().
- * eval.c (f_END): needed to initialize frame->argc;
+ * io.c (read_all): ditto.
-Fri Sep 4 11:27:40 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Sat Oct 30 06:53:24 2004 Peter Vanbroekhoven <peter.vanbroekhoven@cs.kuleuven.ac.be>
- * bignum.c (bigadd): proper sign combination.
+ * eval.c (rb_eval): NODE_XSTR should pass copy of literal string.
- * regex.c (re_search): wrong return value for \A.
+Sat Oct 30 00:19:40 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Thu Sep 3 14:08:14 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * enum.c (enum_sort_by): protect continuation jump in.
+ [ruby-dev:24642]
- * version 1.1c4 released.
+Fri Oct 29 21:27:51 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Sep 1 10:47:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * io.c (rb_io_check_initialized): new function to check uninitialized
+ object. [ruby-talk:118234]
- * regex.c (slow_search): do not compare llen and blen. llen may
- be longer than blen, if little contains 0xff.
+ * file.c (rb_file_path), io.c (rb_io_closed): check if initialized.
- * regex.c (mbctab_euc): set 0x8e as multibyte character.
+Fri Oct 29 10:00:30 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * string.c (str_inspect): mask character for octal output.
+ * eval.c (rb_thread_start_0): forget to free some memory chunks.
+ [ruby-core:03611]
-Mon Aug 31 15:32:41 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * eval.c (ruby_cleanup): ruby_finalize_1 may cause exception,
+ should be wrapped by PUSH_TAG/POP_TAG(). [ruby-dev:24627]
- * regex.c (re_search): use calculated offset if exactn is the
- first opcode in the compiled regexp.
+Thu Oct 28 23:32:54 2004 akira yamada <akira@ruby-lang.org>
- * regex.c (bm_search): use Boyer-Moore search for simple search.
+ * ext/zlib/zlib.c (zstream_detach_input): resets klass of z->input if
+ z->input isn't nil.
- * regex.c (must_instr): wrong length check if pattern includes
- byte escape by 0xff.
+Thu Oct 28 23:19:31 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * regex.c (re_compile_pattern): need not to check current_mbctype.
+ * ext/extmk.rb: prefer relative path. [ruby-talk:93037]
-Sat Aug 29 16:31:40 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Oct 27 18:49:11 2004 NAKAMURA Usaku <usa@ruby-lang.org>
- * eval.c (rb_check_safe_str): avoid calling rb_id2name() in normal
- cases to speed-up.
+ * gc.c: prototype; rb_io_fptr_finalize() doesn't return any value
+ at this version.
- * eval.c (thread_raise): do not save context of terminated thread.
+Wed Oct 27 17:27:45 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * regex.c (re_compile_pattern): mask \nnn over 256.
+ * gc.c (gc_sweep): recover ruby_in_compile variable.
-Sat Aug 29 02:09:46 1998 1998 Koji Arai <JCA02266@nifty.ne.jp>
+Wed Oct 27 09:17:30 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * sprintf.c (f_sprintf): wrong buffer size check.
+ * string.c (str_gsub): use a string object for exception safeness.
+ [ruby-dev:24601]
-Fri Aug 28 01:57:04 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Oct 26 23:52:32 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * regex.c (re_compile_pattern): accepts (?ix-ix) and (?ix-ix:...).
+ * io.c (rb_io_getline): rs modification check should not interfere in the loop.
-Fri Aug 28 12:25:33 1998 Hiroshi Igarashi <igarashi@ueda.info.waseda.ac.jp>
+Tue Oct 26 23:30:39 2004 Dave Thomas <dave@pragprog.com>
- * ruby.c (ruby_require_modules): load modules in appearing order.
+ * lib/rdoc/code_objects.rb (RDoc::Context::add_class_or_module):
+ Restore correct :nopdoc: behavior with nested classes and modules.
-Thu Aug 27 12:54:28 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Oct 26 18:21:29 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * version 1.1c3 released.
+ * string.c (RESIZE_CAPA): check string attribute before modifying
+ capacity member of string structure. [ruby-dev:24594]
-Wed Aug 26 11:47:00 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Oct 26 11:33:26 2004 David G. Andersen <dga@lcs.mit.edu>
- * regex.c (re_match): pop non-greedy stack elements on success.
+ * ext/zlib/zlib.c (gzreader_gets): use memchr() to to gain
+ performance. [ruby-talk:117701]
-Wed Aug 26 09:25:35 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+Tue Oct 26 10:56:55 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * ruby.h: add #define environ for cygwin32.
+ * sprintf.c (rb_f_sprintf): raise ArgumentError for extra
+ arguments, unless (digit)$ style used.
-Mon Aug 24 18:46:44 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+Tue Oct 26 11:33:26 2004 David G. Andersen <dga@lcs.mit.edu>
- * dln.c (dln_find_1): path check was too strict.
+ * ext/zlib/zlib.c (gzreader_gets): use memchr() to to gain
+ performance. [ruby-talk:117701]
-Mon Aug 24 15:28:11 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+Tue Oct 26 10:56:55 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * parse.y (f_arglist): opt_nl added after f_args.
+ * sprintf.c (rb_f_sprintf): raise ArgumentError for extra
+ arguments, unless (digit)$ style used.
-Wed Aug 19 00:31:09 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Mon Oct 25 18:35:39 2004 WATANABE Hirofumi <eban@ruby-lang.org>
- * io.c (io_ctl): forgot to place TRAP_END at right position.
+ * win32/win32.c (isUNCRoot): should check NUL after '.'.
+ [ruby-dev:24590]
-Fri Aug 14 11:01:47 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * win32/win32.c (isUNCRoot): fixed buffer overrun.
- * eval.c (call_trace_func): save __FILE__, __LINE__ before
- executing trace_func, since trace function should not corrupt
- line number information.
+Mon Oct 25 08:03:26 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Aug 13 15:09:02 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * eval.c (get_backtrace): ignore illegal backtrace. [ruby-dev:24587]
- * array.c (ary_s_new): was marking unallocated region on GC.
+Sun Oct 24 00:41:09 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Aug 11 11:57:35 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * eval.c (rb_load, search_required, rb_require_safe, rb_require): use
+ frozen shared string to avoid outside modification. [ruby-dev:24580]
- * version 1.1c2 released.
+Sat Oct 23 22:18:32 2004 Guy Decoux <ts@moulon.inra.fr>
-Mon Aug 10 14:05:30 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * eval.c (frame_free): Guy Decoux solved the leak problem.
+ Thanks. [ruby-core:03549]
- * process.c (f_system): removed fflush(stdin).
+Sat Oct 23 00:20:55 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Fri Aug 7 17:44:44 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/zlib/zlib.c (zstream_append_input): clear klass for z->input
+ to avoid potential vulnerability.
- * error.c (err_snprintf): replace sprintf for fixed sized buffer,
- with snprintf to avoid buffer over-run. For systems which does
- dot provide snprintf, missing/snprintf.c added.
+ * ext/zlib/zlib.c (zstream_run): always use zstream_append_input()
+ to avoid SEGV. [ruby-dev:24568]
-Tue Jul 28 13:03:25 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Fri Oct 22 12:02:28 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * array.c (ary_s_new): argument to specify initial value is added.
+ * eval.c (rb_alias): was warning for wrong condition.
+ [ruby-dev:24565]
- * array.c (ary_s_new): specifies size, not capacity.
+Fri Oct 22 10:36:37 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
-Mon Jul 27 12:39:34 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/webrick/httprequest.rb (WEBrick::HTTPRequest#meta_vars):
+ should check if path_info is not nil.
- * string.c (str_replace): zero fill for expansion gap.
+Fri Oct 22 00:22:31 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * regex.c (mbctab_euc): set flags on for 0xA1-0xFE. suggested by
- <inaba@st.rim.or.jp>.
+ * ext/zlib/zlib.c (zstream_shift_buffer): should restore class
+ field of a buffer. [ruby-dev:24562]
- * string.c (str_inspect): consider current_mbctype.
+Fri Oct 22 00:20:33 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Jul 26 15:37:11 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+ * string.c (rb_str_include): should not treat char as negative value.
+ [ruby-dev:24558]
- * array.c (ary_s_new): Array.new(1<<30) dumps core.
+Thu Oct 21 19:06:15 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
-Fri Jul 24 13:40:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/webrick/httpresponse.rb (WEBrick::HTTPResponse#send_body_io):
+ ensure to close @body. (http://bugs.debian.org/277520)
- * version 1.1c1 released.
+Thu Oct 21 00:36:41 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Fri Jul 24 02:10:22 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * eval.c (rb_alias): should warn on method discarding.
+ [ruby-dev:24546]
- * marshal.c (r_bytes2): allocated buffer size was too short.
+ * ext/zlib/zlib.c (zstream_expand_buffer_into): hide internal
+ string buffer by clearing klass. [ruby-dev:24548]
- * marshal.c (w_object): saves all options, not only casefold flag.
+Wed Oct 20 19:45:13 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * re.c (reg_clone): now copies options properly.
+ * string.c (str_gsub): reentrant check. [ruby-dev:24432]
- * re.c (reg_get_kcode): code number was wrong.
+ * backport all SEGV bug fixes from CVS HEAD. [ruby-dev:24536]
-Thu Jul 23 13:11:32 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Oct 20 04:17:55 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * eval.c (rb_attr): argument should be symbol or string.
+ * ext/dbm/dbm.c (fdbm_delete_if): should check if deleting element
+ is a string. [ruby-dev:24490]
-Wed Jul 22 11:59:34 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/sdbm/init.c (fsdbm_delete_if): ditto.
- * regex.c (calculate_must_string): wrong offset added.
+Wed Oct 20 01:37:18 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Wed Jul 22 11:59:59 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * array.c (rb_ary_times): Array#* should return an instance of
+ the class of right operand. [ruby-dev:24526]
- * st.c (rehash): still had a GC problem. fixed.
+ * ext/zlib/zlib.c (zstream_detach_buffer): should not expose
+ class-less object to Ruby world. [ruby-dev:24530]
-Tue Jul 21 13:19:30 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * eval.c (proc_dup): provide Proc#dup as well. [ruby-talk:116915]
- * eval.c (gc_mark_threads): crashed on GC before thread allocation.
+ * eval.c (ruby_exec): stack marking position may be higher than
+ expected. thanks to Guy Decoux. [ruby-core:03527]
- * st.c (rehash): GC during rehash caused SEGV.
+Tue Oct 19 22:43:12 2004 Dave Thomas <dave@pragprog.com>
-Tue Jul 21 01:25:10 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_attr): If
+ we come across 'attr' in a context where it isn't
+ followed by a symbol, just issue a warning.
- * sprintf.c (f_sprintf): integer formatter totally re-written.
+Tue Oct 19 20:41:37 2004 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * sprintf.c (remove_sign_bits): support uppercase hexadecimal.
+ * ext/win32ole.c(ole_invoke): retrieve the result value when
+ retrying the IDispatch::invoke.
-Sat Jul 18 00:14:13 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Oct 19 17:24:11 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * sprintf.c (f_sprintf): proper sign position for %X and %O.
+ * io.c (read_all): block string buffer modification during
+ rb_io_fread() by freezing it temporarily. [ruby-dev:24479]
-Fri Jul 17 14:10:20 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * dir.c (rb_push_glob): block call at once the end of method.
+ [ruby-dev:24487]
- * version 1.1c0 released.
+ * ext/enumerator/enumerator.c (enum_each_slice): remove
+ rb_gc_force_recycle() to prevent potential SEGV.
+ [ruby-dev:24499]
-Fri Jul 17 08:01:49 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+ * ext/zlib/zlib.c (zstream_expand_buffer): hide internal string
+ buffer by clearing klass. [ruby-dev:24510]
- * process.c (f_exec): Check_SafeStr() added.
+Tue Oct 19 16:12:18 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * process.c (f_system): Check_SafeStr() moved before fork().
+ * ext/tk/tkutil.c: backport from CVS HEAD
-Thu Jul 16 22:58:48 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Oct 19 08:54:26 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * string.c (scan_once): substrings to the block should not be
- tainted. use reg_nth_match(), not str_substr().
+ * intern.h, object.c (rb_class_inherited_p): export.
- * string.c (str_substr): needed to transfer taint.
+Tue Oct 19 08:46:57 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jul 16 16:15:57 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * string.c (rb_str_upto): method result must be checked. [ruby-dev:24504]
- * gc.c (xmalloc): object allocation count added to GC trigger.
+ * eval.c (error_print): ditto. [ruby-dev:24519]
- * eval.c (thread_save_context): avoid marking uninitialized stack
- in thread_mark. GC may be triggered by REALLOC_N().
+Mon Oct 18 23:37:05 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Jul 15 15:11:57 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * marshal.c (r_object0): check inheritance by the internal function.
+ [ruby-dev:24515]
- * experimental release 1.1b9_31.
+Mon Oct 18 15:58:01 2004 NAKAMURA Usaku <usa@ruby-lang.org>
-Wed Jul 15 15:05:27 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * range.c (range_step, range_each): need cast.
- * eval.c (thread_create): exit() and abort() in threads now
- forwarded to main_thread.
+Mon Oct 18 07:26:21 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Jul 14 14:03:47 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * file.c (rb_file_truncate): discard read buffer before truncation.
+ [ruby-dev:24197]
- * variable.c (obj_instance_variables): list names that is not
- instance variables.
+Mon Oct 18 02:11:21 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * gc.c (GC_MALLOC_LIMIT): choose smaller limit value.
+ * lib/webrick/config.rb (WEBrick::Config::General): add default values:
+ - WEBrick::Config[:DoNotReverseLookup]
+ - WEBrick::Config[:RequestCallback] (it used as an alias of
+ :RequestHandler in WEBrick::HTTPServer#run)
+ - WEBrick::Config::FileHandler[:AcceptableLanguages]
-Mon Jul 13 12:39:38 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/webrick/httpservlet/filehandler.rb
+ (WEBrick::HTTPServlet::FileHandler#set_filename): search files
+ having suffix of language-name which Accept-Language header field
+ includes if :AcceptableLanguages options is present.
- * object.c (str2cstr): should not return NULL.
+ * lib/webrick/httpservlet/filehandler.rb
+ (WEBrick::HTTPServlet::FileHandler#get_servlet): new method to
+ search servlet correspond to the suffix of filename.
-Fri Jul 10 11:51:46 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/webrick/httprequest.rb: add attributes access methods: accept,
+ accept_charset, accept_encoding, accept_language, content_length
+ and content_type.
- * parse.y (gettable): needed to add dyna_in_block() check.
+ * lib/webrick/httpresponse.rb: add attribute access methods:
+ content_length, content_length=, content_type and content_type=.
-Thu Jul 9 17:38:23 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/webrick/httputils.rb (WEBrick::HTTPUtils.mime_types):
+ use the second suffix to detect media type. (the first suffix
+ may be a language name.)
- * experimental release 1.1b9_30.
+ * lib/webrick/httputils.rb (WEBrick::HTTPUtils.parse_qvalues):
+ add method to parse Accept header field. it returns an Array of
+ values sorted by the qvalues.
-Thu Jul 9 16:01:48 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Mon Oct 18 02:04:11 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * sprintf.c (fmt_setup): format specifier for long needed.
+ * lib/webrick/httpserver.rb (WEBrick::HTTPServer#virtual_host): new
+ method to register virtual hosting servers.
- * sprintf.c (f_sprintf): ditto.
+ * lib/webrick/server.rb (WEBrick::GenericServer#accept): call
+ do_not_reverse_lookup for each socket if :DoNotReverseLookup
+ is set. [ruby-core:02357]
- * numeric.c (fix2str): ditto.
+Sun Oct 17 23:03:48 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * eval.c (thread_create): no more ITIMER_REAL.
+ * ext/tk/lib/tk/timer.rb: TkTimer#start and restart accept a block
- * eval.c (thread_create): thread finalization needed before
- aborting thread if thread_abort is set.
+Sun Oct 17 13:05:04 2004 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Wed Jul 8 18:17:33 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/win32ole/win32ole.c (fole_func_methods): correct argument mismatch.
+ * ext/win32ole/win32ole.c (fole_get_methods): ditto.
+ * ext/win32ole/win32ole.c (fole_put_methods): ditto.
+ * ext/win32ole/tests/testWIN32OLE.rb: add test for WIN32OLE#ole_func_methods
+ WIN32OLE#ole_get_methods, WIN32OLE#ole_put_methods
- * bignum.c (big_pow): abandon power by bignum (too big).
+Sat Oct 16 14:45:28 2004 Kouhei Sutou <kou@cozmixng.org>
-Tue Jul 7 13:58:43 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/rss/0.9.rb (RSS::Rss#to_s): removed garbage.
- * eval.c (rb_catch): add C level catch/throw feature.
+Sat Oct 16 13:42:49 2004 Kouhei Sutou <kou@cozmixng.org>
-Mon Jul 6 15:18:09 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/rss/: untabified.
+ * test/rss/: untabified.
+ * lib/rss/0.9.rb (RSS::Rss#to_s): inent -> indent.
- * parse.y (arg): proper return values for `||=' and `&&='.
+Sat Oct 16 13:34:56 2004 Kouhei Sutou <kou@cozmixng.org>
-Fri Jul 3 16:05:11 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/rss: supported prety print.
+ * test/rss/test_1.0.rb: added test for calculating default indent size.
- * experimental release 1.1b9_29.
+Fri Oct 15 18:04:35 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-Fri Jul 3 11:20:46 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/lib/tk/timer.rb: TkTimer.new(interval, loop){ ... } is
+ acceptable. Add TkTimer.start ( == new + start ).
- * marshal.c (r_byte): byte should not extend sign bit.
+Fri Oct 15 12:43:09 2004 Tanaka Akira <akr@m17n.org>
- * numeric.c (fix_mul): use FIX2LONG() instead of FIX2INT() for
- 64bit architectures.
+ * eval.c (Init_stack): make prototype declaration consistent with
+ the definition in gc.c.
- * marshal.c (r_bytes): remove weird casting bwetween pointer and int.
+Thu Oct 14 14:34:01 2004 WATANABE Hirofumi <eban@ruby-lang.org>
- * process.c (proc_setsid): new method Process#setsid().
+ * io.c (MODE_BINMODE, MODE_BINARY): fixed reversed condition.
-Thu Jul 2 12:49:21 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu Oct 14 13:33:59 2004 Kouhei Sutou <kou@cozmixng.org>
- * marshal.c (w_object): remove `write_bignum' label for 64bit
- architectures.
+ * lib/rss/rss.rb: added link to Tutorial.
- * marshal.c (r_bytes): needs int, not long.
+Mon Oct 11 13:48:20 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-Wed Jul 1 14:21:06 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/lib/tk/*: untabify
- * numeric.c (flo_plus): should not allow addition with strings.
+Sun Oct 10 12:32:08 2004 Dave Thomas <dave@pragprog.com>
-Wed Jul 1 13:09:01 1998 Keiju ISHITSUKA <keiju@rational.com>
+ * lib/rdoc/parsers/parse_rb.rb (RDoc::parse_require): Allow 'require'
+ to be used as a variable name
- * numeric.c (num_uminus): wrong coerce direction.
+Sat Oct 9 21:23:37 2004 Kouhei Sutou <kou@cozmixng.org>
-Tue Jun 30 10:13:44 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/rss/converter.rb: changed to try to use Iconv for default
+ conversion.
- * io.c (f_p): accepts arbitrary number of arguments.
+ * lib/rss/rss.rb: 0.0.9 -> 0.1.0.
- * eval.c (rb_yield_0): there's some case that iterator_p() returns
- true even if the_block was not set. check added.
+Sat Oct 9 19:50:36 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Jun 30 01:05:20 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * io.c (rb_io_getline): should not treat char as negative value.
+ [ruby-dev:24460]
- * eval.c (BEGIN_CALLARGS): adjust the_block before evaluating the
- receiver's value and the arguments.
+Fri Oct 8 09:49:32 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Fri Jun 26 18:02:50 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * pack.c (pack_pack): pointer modification check before each
+ iteration. [ruby-dev:24445]
- * experimental release 1.1b9_28.
+Fri Oct 8 01:13:05 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-Fri Jun 26 11:01:26 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * ext/tk/lib/tk/optiondb.rb: make it more secure
- * string.c (str_aset_method): needed to convert to string.
+Thu Oct 7 23:47:57 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-Thu Jun 25 02:05:50 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/lib/tk/scrollbar.rb: When 'set' operation, a scrollbar
+ cannot propagate view port information from the source widget
+ (that calls 'set') to other assigned widgets.
- * regex.c (re_search): optimize for `.*' at beginning of the
- pattern.
+Thu Oct 7 17:36:25 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * regex.c (re_search): optimize for character class repeat at
- beginning of the pattern.
+ * ext/tk/lib/tk.rb: When CHILDKILLED and so on, Tk.errorCode returns
+ a Fixnum for 2nd element (it's pid) of the return value.
- * regex.c (re_compile_pattern): detect optimization potential for
- the compiled patterns.
+Thu Oct 7 12:55:04 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Thu Jun 25 00:02:26 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * io.c (io_read): should freeze buffer before thread context
+ switch. [ruby-dev:24442]
- * re.c (reg_s_new): flag value was wrong.
+ * pack.c (pack_unpack): string conversion should at the top of the
+Mon Oct 18 00:42:45 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Wed Jun 24 23:45:06 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/socket/socket.c (sock_s_getservbyaname): protocol string
+ might be altered. [ruby-dev:24503]
- * regex.c (re_search): wrong anchor handling for reverse search.
+ * string.c (rb_str_upto): check if return value from succ is a
+ string. [ruby-dev:24504]
-Wed Jun 24 02:18:57 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ method. [ruby-dev:24439]
- * parse.y (mlhs): `((a,b)),c = [[1,2]],3' assigns a=1,b=2,c=3.
+ * io.c (io_read): buffer should be frozen only after the length
+ check. [ruby-dev:24440]
-Tue Jun 23 11:46:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu Oct 7 02:56:43 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * parse.y (yylex): `&&=' and `||=' added.
+ * ext/stringio/stringio.c: use FMODE_APPEND.
-Sat Jun 20 02:53:50 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu Oct 7 01:05:33 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * parse.y (assignable): nesting local variables should have higher
- priority than normal local variables for assignment too.
+ * ext/tk/lib/tk.rb: add Tk.errorInfo and Tk.errorCode
-Fri Jun 19 18:28:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu Oct 7 00:08:37 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * experimental release 1.1b9_27.
+ * io.c (rb_io_s_sysopen): preserve path in the buffer allocated by
+ ALLOCA_N() to prevent modification. [ruby-dev:24438]
-Fri Jun 19 14:34:49 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Oct 6 09:21:00 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * eval.c (assign): support hack for nested multiple assignment.
+ * io.c (rb_io_mode_flags): preserve append mode flag.
+ [ruby-dev:24436]
- * parse.y (mlhs): nested multiple assignment.
+ * io.c (rb_io_modenum_mode): do not use external output buffer.
- * eval.c (rb_eval): in-block variables now honors static scope.
+ * string.c (rb_str_justify): differ pointer retrieval to prevent
+ padding string modification. [ruby-dev:24434]
- * configure.in: RSHIFT check moved to configure.
+ * range.c (range_each_func): allow func to terminate loop by
+ returning RANGE_EACH_BREAK.
-Thu Jun 18 16:46:04 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * range.c (member_i): use RANGE_EACH_BREAK. [ruby-talk:114959]
- * experimental release 1.1b9_26.
+Mon Oct 4 14:04:14 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jun 18 13:37:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * io.c (rb_file_open_internal, rb_io_reopen): fname might be altered
+ while GC. [ruby-dev:24408]
- * file.c (file_s_ftype): uses lstat(2) instead of stat(2).
+Mon Oct 4 12:53:45 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * dir.c (dir_s_glob): there can be buffer overrun, check added.
+ * ext/tk/lib/tk/optiondb.rb: support definition of command
+ resources on widgets
- * eval.c (f_binding): handles in-block variables declared after
- binding's generation.
+ * ext/tk/lib/tk/image.rb: bug fix
- * numeric.c (flo_floor): floor, ceil, round added to Float.
+Sun Oct 3 21:20:03 2004 Shugo Maeda <shugo@ruby-lang.org>
-Wed Jun 17 11:20:00 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/net/imap.rb (TEXT_REGEXP): allow 8-bit characters for the german
+ version of Microsoft Exchange Server. (backported from HEAD)
- * parse.y (gettable): nesting local variables should have higher
- priority than normal local variables.
+ * lib/net/imap.rb (RTEXT_REGEXP): ditto.
-Tue Jun 16 12:30:46 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/net/imap.rb (CTEXT_REGEXP): ditto.
- * bignum.c (str2inum): handles `+ddd'.
+Sat Oct 2 20:34:22 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * struct.c (make_struct): name parameter can be nil for unnamed
- structures.
+ * node.h (NEW_DVAR): extra semicolon.
-Mon Jun 15 16:30:10 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Sat Oct 2 00:42:20 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * object.c (class_s_inherited): prohibiting to make subclass of
- class Class.
+ * marshal.c (r_byte): retrieve pointer from string value for each
+ time. [ruby-dev:24404]
- * object.c (module_s_new): support for making subclass of Module.
+ * marshal.c (r_bytes0): ditto.
- * parse.y (yycompile): clear eval_tree before compiling.
+ * enum.c (sort_by_i): re-entrance check added. [ruby-dev:24399]
-Fri Jun 12 17:58:18 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * io.c (io_read): should freeze all reading buffer.
+ [ruby-dev:24400]
- * eval.c (eval): write back the_dyna_var into the block.
+ * string.c (rb_str_sum): should use bignums when bits is greater
+ than or equals to sizeof(long)*CHAR_BITS. [ruby-dev:24395]
-Thu Jun 11 18:19:18 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * eval.c (specific_eval): defer pointer retrieval to prevent
+ unsafe sourcefile string modification. [ruby-dev:24382]
- * experimental release 1.1b9_25.
+ * eval.c (specific_eval): defer pointer retrieval to prevent
+ unsafe sourcefile string modification. [ruby-dev:24382]
- * eval.c (dvar_add_compiling): register dyna_var at compile time.
+ * string.c (rb_str_sum): wrong cast caused wrong result.
+ [ruby-dev:24385]
- * regex.c (re_compile_pattern): RE_DUP_MAX iteration is too big.
+ * enum.c (enum_sort_by): hide temporary array from
+ ObjectSpace.each_object. [ruby-dev:24386]
-Wed Jun 10 15:12:04 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * string.c (rb_str_sum): check was done with false pointer.
+ [ruby-dev:24383]
- * io.c (io_eof): do not block other threads.
+ * string.c (rb_str_sum): string may be altered. [ruby-dev:24381]
+Mon Oct 11 17:51:34 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * signal.c (trap): reserve SIGALRM for thread.
+ * io.c (rb_io_popen): get mode string via rb_io_flags_mode() to
+ avoid mode string modification. [ruby-dev:24454]
- * eval.c (thread_create): use ITIMER_REAL also to avoid system
- call blocking.
+ * io.c (rb_io_getline_fast): should take delim as unsigned char to
+ distinguish EOF and '\377'. [ruby-dev:24460]
- * io.c (f_syscall): add TRAP_BEG, TRAP_END around system calls.
+ * io.c (rb_io_getline): add check for RS modification.
+ [ruby-dev:24461]
- * io.c (io_ctl): add TRAP_BEG, TRAP_END around system calls.
+ * enum.c (enum_sort_by): use qsort() directly instead using
+ rb_iterate(). [ruby-dev:24462]
- * enum.c (enum_collect): did not collect false values.
+ * enum.c (enum_each_with_index): remove rb_gc_force_recycle() to
+ prevent access to recycled object (via continuation for
+ example). [ruby-dev:24463]
- * array.c (ary_new2): forgot to initialize capa field.
-Tue Jun 9 18:36:15 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+Fri Oct 1 11:40:14 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * string.c (str_split_method): split dumped core for "\xff".
+ * eval.c (rb_f_eval): defer pointer retrieval to prevent unsafe
+ sourcefile string modification. [ruby-dev:24373]
-Tue Jun 9 16:22:12 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * io.c (io_read): block string buffer modification during
+ rb_io_fread() by freezing it temporarily. [ruby-dev:24366]
- * experimental release 1.1b9_24.
+ * io.c (rb_io_s_popen): mode argument may be altered.
+ [ruby-dev:24375]
-Tue Jun 9 16:04:07 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * file.c (rb_file_s_basename): ext argument may be altered.
+ [ruby-dev:24377]
- * ext/kconv/kconv.c (kconv_guess): more precise decision for EUC,
- using jless algorithm (3 sequential EUC hiragana characters).
+ * enum.c (enum_sort_by): use NODE instead of 2 element arrays.
+ [ruby-dev:24378]
-Tue Jun 9 15:12:44 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * string.c (rb_str_chomp_bang): StringValue() may change the
+ receiver. [ruby-dev:24371]
- * ext/kconv/kconv.c (kconv_guess): wrong guess for EUC as SJIS in
- some cases (0xe0 - 0xef).
+Fri Oct 1 11:25:20 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * gc.c (xmalloc): insert size check for big (negative in signed)
- allocation size.
+ * ext/tk/lib/tk/grid.rb: revive TkGrid.grid
-Tue Jun 9 02:54:51 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/lib/tk/pack.rb: revive TkPack.pack
- * lib/parsedate.rb: wday moved to the last in the return values.
+ * ext/tk/lib/tk/place.rb: revive TkPlace.place
-Mon Jun 8 10:40:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu Sep 30 00:50:44 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * string.c (str_split_method): split dumped core for "\0".
+Sat Oct 9 00:25:39 2004 Tanaka Akira <akr@m17n.org>
-Sat Jun 6 22:50:52 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * io.c (rb_io_fread): rb_thread_wait_fd() was lost.
+ [ruby-dev:24457]
- * regex.c (calculate_must_string): wrong condition for
- {start,stop}_nowidth.
+ * ext/tcltklib/tcltklib.c (ip_init): bug fix
- * regex.c (re_match): various features imported from GNU regex.c
- 0.12, such as nested grouping, avoiding infinite loop with empty
- match, etc.
+ * ext/tk/tkutil.c (get_eval_string_core): accept a Regexp object
- * regex.c (register_info_type): now use union.
+ * ext/tk/lib/multi-tk.rb: fix bug on 'exit' operation
- * regex.c (re_search): more precise anchor(^) check.
+ * ext/tk/lib/tk/text.rb: 'tksearch' accepts a Regexp object as a
+ matting pattern argument
-Wed Jun 3 18:07:54 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Sep 29 10:58:07 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * re.c (reg_raise): check rb_in_compile, not rb_in_eval.
+ * enum.c (sort_by_i): internally used object must not be changed
+ outside. [ruby-dev:24368]
-Mon Jun 1 05:26:06 1998 WATANABE Tetsuya <tetsu@jpn.hp.com>
+Mon Sep 27 13:46:45 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * string.c (trnext): casting to signed char* needed.
+ * intern.h, struct.c (rb_struct_s_members, rb_struct_members): public
+ accessors. [ruby-dev:24342]
-Tue Jun 2 16:00:12 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * marshal.c (w_object, r_object0): use accessors.
- * ext/socket/socket.c (udp_addrsetup): error check enhanced.
+Mon Sep 27 09:14:03 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * ext/socket/socket.c (sock_s_getservbyaname): use strtoul(), if
- possible.
+ * ext/socket/socket.c (s_accept): don't retry for EWOULDBLOCK.
+ [ruby-talk:113807]
-Sat May 30 07:10:02 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Fri Sep 24 16:09:42 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * re.c (reg_prepare_re): no more needless regular expression
- recompile on casefold conditions.
+ * eval.c (proc_invoke): propagate DVAR_DONT_RECYCLE on termination
+ to avoid double call to rb_gc_force_recycle(). [ruby-dev:24311]
-Thu May 28 18:02:55 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Fri Sep 24 08:29:45 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * object.c (nil_plus): no more `+' method for nil.
+ * array.c (rb_ary_subseq): original object might be modified after
+ sharing data creation. [ruby-dev:24327]
-Wed May 27 17:33:46 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * array.c (rb_ary_replace): ditto.
- * hash.c (hash_fetch): new method.
+ * array.c (ary_make_shared): freeze shared array. [ruby-dev:24325]
- * regex.c (re_search): check whether translate table is set.
+ * struct.c (struct_members): always check struct size and size of
+ members list in the class. [ruby-dev:24320]
-Tue May 26 11:39:50 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu Sep 23 09:29:14 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * experimental release 1.1b9_23.
+ * string.c (rb_str_sub_bang): check if string is not modified
+ during iteration. [ruby-dev:24315]
- * parse.y (yylex): no UPLUS/UMINUS for 1st argument if
- parenthesises are omitted.
+ * hash.c (rb_hash_rehash): replace st_foreach() by its deep
+ checking counterpart. [ruby-dev:24310]
-Tue May 26 01:09:55 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Sep 22 13:38:12 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * regex.c (re_compile_pattern): (?XI) for turns off the
- corresponding option.
+ * hash.c (rb_hash_rehash): add iteration check. [ruby-dev:24301]
-Mon May 25 12:38:56 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * st.c (st_foreach): add deep check.
- * regex.c (re_compile_pattern): inline i option (?i).
+Wed Sep 22 13:06:14 2004 NAKAMURA Usaku <usa@ruby-lang.org>
- * regex.c (re_compile_pattern): inline x option (?x).
+ * win32/win32.c (rb_w32_call_handler): workaround for Ctrl-C.
+ merge from HEAD.
- * regex.c (re_compile_pattern): x option for regexp.
+Wed Sep 22 00:11:12 2004 Dave Thomas <dave@pragprog.com>
- * dir.c (dir_s_open): returns block's evaluated value.
+ * process.c: Add documentation for fork()
- * io.c (f_open): returns block's evaluated value.
+Wed Sep 22 09:04:41 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * ext/curses/curses.c (curses_addstr): nil argument caused SEGV.
+ * array.c (rb_ary_collect_bang): element size might change during
+ comparison. [ruby-dev:24300]
-Fri May 22 11:52:45 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * array.c (rb_ary_reject_bang): ditto. [ruby-dev:24300]
- * regex.c (re_compile_pattern): push mark on (?:), so that
- laststart check for {a,b} can be done.
+ * array.c (rb_ary_eql): ditto. [ruby-dev:24300]
-Thu May 21 17:31:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Sep 21 18:29:49 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * regex.c (re_match): wrong match (too non-greedy) for `{a,b}?'.
+ * array.c (rb_ary_equal): merge miss.
- * io.c (io_lineno): new method IO#lineno, IO#lineno=.
+ * array.c (rb_ary_uniq_bang): element size might change during
+ comparison. [ruby-dev:24298]
-Wed May 20 06:04:43 1998 MAEDA shugo <shugo@aianet.ne.jp>
+Mon Sep 20 00:24:19 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * BeOS patch.
+ * enum.c (enum_sort_by): do not use qsort directly. use
+ rb_ary_sort_bang() instead. [ruby-dev:24291]
-Wed May 20 16:32:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * enum.c (enum_sort_by): pedantic type check added.
+ [ruby-dev:24291]
- * bignum.c (BIGDN): use RSHIFT(), instead of mere `>>'.
+ * hash.c (rb_hash_foreach_iter): check iter_lev after each
+ iteration. [ruby-dev:24289]
-Tue May 19 16:36:26 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * array.c (rb_ary_and): element size might change during
+ comparison. [ruby-dev:24290]
- * experimental release 1.1b9_22.
+ * array.c (rb_ary_or): ditto. [ruby-dev:24292]
-Tue May 19 16:31:57 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * array.c (rb_ary_equal): wrong fix. [ruby-dev:24286]
- * parse.y (assignable): specification changed for in-block
- variable definition.
+Sat Sep 18 15:02:22 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * eval.c (dyna_var_asgn): error in in-block variables' compile
- time definition.
+ * array.c (rb_ary_equal): element size might change during
+ comparison. [ruby-dev:24254]
- * parse.y (str_extend): wrong nesting detection.
+ * array.c (rb_ary_diff): ditto. [ruby-dev:24274]
-Tue May 19 09:47:55 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * array.c (rb_ary_select): ditto. [ruby-dev:24278]
- * numeric.c (num2int): re-defined (extensions may use this).
+ * array.c (rb_ary_delete): ditto. [ruby-dev:24283]
-Mon May 18 16:40:50 1998 MAEDA shugo <shugo@aianet.ne.jp>
+ * array.c (rb_ary_rindex): ditto. [ruby-dev:24275]
- * error.c (get_syserr): BeOS support.
+ * array.c (rb_ary_initialize): element size might change during
+ initializing block. [ruby-dev:24284]
- * configure.in: modified for BeOS.
+Sat Sep 18 14:10:23 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * string.c (str_dump): do not call isascii().
+ * dir.c (dir_s_chdir): avoid memory leak and unnecessary chdir to
+ the original directory when exception has caused in changing
+ direcotry or within block. thanks to Johan Holmberg
+ <holmberg@iar.se> [ruby-core:03446]
- * sprintf.c (remove_sign_bits): forgot to initialize end pointer.
+Fri Sep 17 20:20:27 2004 Minero Aoki <aamine@loveruby.net>
- * glob.c: #include <alloca.h> added.
+ * lib/fileutils.rb (mkdir_p): backport from CVS HEAD 1.45. [ruby-core:03420]
-Mon May 18 14:52:21 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
-
- * experimental release 1.1b9_21.
+Fri Sep 17 17:11:08 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Mon May 18 03:27:57 1998 MAEDA shugo <shugo@aianet.ne.jp>
+ * array.c (rb_ary_delete): element comparison might change array
+ size. [ruby-dev:24273]
- * file.c (file_s_expand_path): optional second argument
- `default_directory' added.
+ * file.c (rb_file_truncate): clear stdio buffer before truncating
+ the file. [ruby-dev:24191]
-Sat May 16 22:06:52 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * ext/digest/digest.c: use rb_obj_class() instead of CLASS_OF
+ which might return singleton class. [ruby-dev:24202]
- * error.c (RAISE_ERROR): wrong error message
+Fri Sep 17 16:07:09 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-Fri May 15 14:43:25 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/lib/multi-tk.rb: improve exit operation
- * experimental release 1.1b9_20.
+Fri Sep 17 15:01:57 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-Thu May 14 14:44:21 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * ext/tcltklib/tcltklib.c: fix SEGV when (thread_)vwait or
+ (thread_)tkwait
- * sun4 cc patches for intern.h and regex.h.
+ * ext/tk/lib/tk.rb: add alias wait_window to wait_destroy
-Thu May 14 14:03:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/lib/multi-tk.rb: support calling 'mainloop' on slave
+ interpreters (however, the 'real' eventloop must be run on the
+ Default Master IP)
- * random.c (RANDOM_MAX): guessing proper maximum value for random
- numbers.
+ * ext/tk/lib/remote-tk.rb: follow the changes of ext/tk/lib/multi-tk.rb
- * random.c (f_rand): use drand48 if possible.
+ * ext/tk/sample/remote-ip_sample2.rb: ditto
-Wed May 13 19:05:20 1998 1998 MAEDA shugo <shugo@aianet.ne.jp>
+ * ext/tk/sample/tkoptdb-safeTk.rb: ditto
- * BeOS patches for io.c, error.c and config.guess.
+Thu Sep 16 18:12:32 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
-Wed May 13 14:56:23 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/webrick/cgi.rb (WEBrick::CGI#start): should set REMOTE_USER
+ to request.user attribute.
- * experimental release 1.1b9_19.
+ * lib/webrick/httpservlet/filehandler.rb
+ (WEBrick::HTTPServlet::FileHandler#initialize): should expand
+ the pathname of document root directory.
- * most of the Mac and BeOS patches merged, except path separators.
+Thu Sep 16 15:49:28 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * error.c (err_append): generated SyntaxError was String.
+ * string.c (rb_str_intern): protect string argument from GC.
+ [ruby-core:03411]
- * ruby.h: xxx2INT, xxx2UINT checks values as int, not long.
+Wed Sep 15 20:22:23 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ruby.h: remove typedef's. INT, UINT, UCHAR, USHORT.
+ * ext/tk/sample/tkoptdb-safeTk.rb: fix a bug depend on the changes
+ of MultiTkIp
-Tue May 12 17:38:00 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Sep 14 23:54:11 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * experimental release 1.1b9_18.
+ * ext/tk/lib/multi-tk.rb: MultiTkIp#eval_string was en-bugged by
+ the previous changes.
-Tue May 12 11:38:08 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Sep 14 23:45:44 2004 Dave Thomas <dave@pragprog.com>
- * error.c (syserr_errno): returns errno of the SystemCallError.
+ * lib/rdoc/ri/ri_formatter.rb (RI::TextFormatter::TextFormatter.for):
+ Add Eric Hodel's simpleformatter.
- * error.c (rb_sys_fail): saves errno in the Exception.
+Tue Sep 14 16:59:37 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * error.c (set_syserr): no need to protect syserr_list.
+ * ext/tcltklib/tcltklib.c: fix SEGV
- * error.c (rb_sys_fail): no more bufsize limit.
+ * ext/tk/lib/multi-tk.rb: improve safe-level handling of argument proc
- * error.c (set_syserr): integer value of errno can be accessed by
- Errno::EXXX::Errno.
+ * ext/tk/sample/multi-ip_sample.rb: rename of old 'safe-tk.rb'
-Sun May 10 03:10:33 1998 WATANABE Tetsuya <tetsu@jpn.hp.com>
+ * ext/tk/sample/safe-tk.rb: new sample script
- * io.c (io_tell etc.): moved from File class to IO class.
+Tue Sep 14 00:15:15 2004 WATANABE Hirofumi <eban@ruby-lang.org>
-Fri May 8 12:26:37 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/zlib/zlib.c: backported from HEAD.
- * pack.c (pack_unpack): should be unsigned int (was signed int).
+Mon Sep 13 19:16:33 2004 WATANABE Hirofumi <eban@ruby-lang.org>
-Thu May 7 16:34:10 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * eval.c (blk_copy_prev): need frame_dup(). [ruby-dev:24103]
- * pack.c (pack_pack): `V', `N' uses newly created NUM2UINT().
+Mon Sep 13 16:23:27 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ruby.h (NUM2UINT): new macro.
+ * ext/tk/lib/multi-tk.rb: MultiTkIp.new_master and new_slave accept
+ safe-level value argument
- * bignum.c (big2uint): try to convert bignum into UINT.
+Mon Sep 13 10:20:45 2004 NAKAMURA Usaku <usa@ruby-lang.org>
- * re.c (reg_match): needed to return false for match with nil.
+ * object.c (nil_inspect): fix typo.
- * gc.c (obj_free): wrong condition to free string.
+Mon Sep 13 01:03:02 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-Wed May 6 21:08:08 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * ext/tcltklib/tcltklib.c: improve control of preserv/release tcltkip
- * ruby.c (ruby_process_options): modified for DJGPP.
+ * ext/tcltklib/tcltklib.c: store original 'exit' command
-Wed May 6 15:48:03 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/tkutil.c: fix(?) SEGV
- * experimental release 1.1b9_17.
+Sun Sep 12 23:46:23 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-Wed May 6 01:37:39 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * util.c (ruby_strdup): remove unnecessary code. (xmalloc never
+ returns NULL.)
- * eval.c: remove global variable `errat'.
+ * util.c (ruby_getcwd): fix memory leak on failure.
- * eval.c (rb_longjmp): embed error position information in the
- exception object.
+Sun Sep 12 02:41:58 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-Sat May 2 12:20:02 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tcltklib/tcltklib.c: add TclTkIp#allow_ruby_exit? and
+ allow_ruby_exit=
- * re.c (reg_search): supports reverse search.
- * string.c (str_index_method): does update $~ etc.
+ * ext/tk/lib/multi-tk.rb: ditto.
- * eval.c (f_load): needed to clear the_dyna_vars.
+ * ext/tk/lib/remote-tk.rb: ditto.
- * eval.c (dyna_var_asgn): do not push dyna_var, which is id == 0.
+ * ext/tcltklib/MANUAL.euc: ditto.
- * error.c (Init_Exception): NotImplementError is no longer
- StandardError, which is not handled by default rescue.
+ * ext/tcltklib/MANUAL.eng: ditto.
-Fri May 1 00:35:51 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tcltklib/tcltklib.c: fix some reasons of SEGV
- * ruby.c (proc_options): `-d' turns on verbose flag too.
+ * ext/tk/tkutil.c: ditto.
- * error.c (exception): last argument may be the superclass of the
- defining exception(s).
+ * ext/tk/lib/multi-tk.rb: ditto.
- * io.c (Init_IO): EOFError is now subclass of the IOError.
+ * ext/tk/lib/tk/timer.rb: ditto.
- * io.c (Init_IO): forgot to define IOError.
+Sat Sep 11 16:09:46 2004 Dave Thomas <dave@pragprog.com>
- * error.c (Init_Exception): old Exception class renamed to
- StandardError. Exception now replaces old GlobalExit.
+ * lib/rdoc/parsers/parse_rb.rb: Fix up cross-file class merging.
- * error.c (Init_Exception): Exception is now the root of the
- Global Exits. There's no longer GlobalExit class.
+Fri Sep 10 20:20:53 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * util.c (ruby_mktemp): check TMP, TMPDIR first.
+ * ext/tcltklib/tcltklib.c (lib_merge_tklist): fix suspicious
+ pointer conversion.
-Thu Apr 30 01:08:35 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Fri Sep 10 02:43:54 2004 Dave Thomas <dave@pragprog.com>
- * lib/tk.rb: call 'unknown', if proc not defined.
+ * lib/rdoc/generators/template/kilmer.rb: James Buck's
+ patch for call-seq.
- * eval.c (handle_rescue): default rescue handles `Exceptional' not
- only the instance of the `Exception's.
+Thu Sep 9 13:58:56 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * eval.c (f_raise): exception can be any object.
+ * ext/tcltklib/tcltklib.c (ip_init): change flag value for setting
+ 'argv' and 'argv0' variable
- * time.c (time_gm_or_local): call time_gmtime or time_localtime.
+ * ext/tk/lib/remote-tk.rb: follow changes of multi-tk.rb
- * eval.c (f_raise): raises TypeError if the class which is not a
- subclass of String is specified (checked in exc_new()).
+Thu Sep 9 11:46:18 2004 Dave Thomas <dave@pragprog.com>
- * error.c (exc_new): need to check whether invalid class (not a
- subclass of String) is specified.
+ * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser::do_classes): Allow
+ spaces aroun parameter to define_method_under (James Buck)
-Wed Apr 29 21:05:44 1998 WATANABE Hirofumi <eban@os.rim.or.jp>
+Wed Sep 8 18:44:03 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ruby.c (proc_options): option '-e' via tempfile.
+ * ext/stringio/stringio.c (strio_write): zero fill a gap if exsts.
+ [ruby-dev:24190]
-Tue Apr 28 15:27:58 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Sep 8 15:19:49 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * experimental release 1.1b9_16.
+ * ext/tcltklib/tcltklib.c (ip_init): cannot create a IP at level 4
-Tue Apr 28 00:07:38 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/lib/multi-tk.rb: improve 'exit' operation, security check,
+ and error treatment
- * eval.c (obj_is_proc): type check predicate.
+ * ext/tk/lib/multi-tk.rb: allow a trusted slave IP to create slave IPs
- * eval.c (obj_is_block): ditto.
+ * ext/tk/lib/tk/listbox.rb: add TkListbox#value, value=, clear, and
+ erase
-Mon Apr 27 16:59:17 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/lib/tk/text.rb: add TkText#clear and erase
- * ext/gtk/gtk.c (Init_gtk): use timeout, not idle to avoid
- comsuming CPU too much.
+Mon Sep 6 11:08:50 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * lib/tk.rb: use tcltklib#_invoke instead of `_eval'.
+ * ext/tk/lib/tk/menu.rb(TkOptionMenubutton#insert): call correct method
-Mon Apr 27 16:59:17 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Mon Sep 6 11:00:47 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * array.c (ary_sort): use dup, not clone.
+ * dir.c (dir_s_chdir): the patch to shut up false warning when
+ exception occurred within a block. a patch was given from Johan
+ Holmberg <holmberg@iar.se>. [ruby-core:03292]
-Mon Apr 27 13:46:27 1998 Tadahiro Maebashi <maebashi@iij.ad.jp>
+Mon Sep 6 07:51:42 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * ext/tcltklib/tcltklib.c (ip_invoke): invoke tcl command
- directly. need not worry about escaping tcl characters.
+ * eval.c (cvar_cbase): singletons should refer outer cvar scope.
+ [ruby-dev:24223]
-Mon Apr 27 12:04:43 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * eval.c (rb_load): should preserve previous ruby_wrapper value.
+ [ruby-dev:24226]
- * random.c (f_rand): do not call srand() implicitly.
+Sat Sep 4 01:14:57 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Fri Apr 24 14:35:45 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * eval.c (cvar_cbase): class variables cause SEGV in
+ instance_eval() for fixnums and symbols. [ruby-dev:24213]
- * experimental release 1.1b9_15.
+Fri Sep 3 17:47:58 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * parse.y (assignable): dyna_var_asgn actually defines nested
- local variables in outer context.
+ * struct.c (make_struct): remove redefining constant when
+ conflict. [ruby-dev:24210]
- * random.c (f_rand): call srand(), if it has not called yet.
+Fri Sep 3 11:31:44 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * random.c (f_srand): use tv_usec as the default seed.
+ * ext/tk/lib/tk.rb: Tk.after makes TkCore::INTERP.tk_cmd_tbl grow
+ [ruby-dev:24207]
- * eval.c (rb_eval): values of nested local variables should be
- independent.
+Fri Sep 3 02:12:48 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * eval.c (rb_yield_0): local variables wrong nested conditions.
+ * ext/tcltklib/tcltklib.c: fix typo [ruby-talk:111266]
-Wed Apr 22 23:27:17 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/lib/tk/text.rb: fix typo
- * io.c (select_get_io): get IO object by `to_io'.
+ * ext/tk/lib/multi-tk.rb: improve safe-level treatment on slave IPs
- * io.c (io_to_io): method to retrieve IO object, from delegating
- object for example.
+Fri Sep 3 01:54:20 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Apr 22 16:52:37 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/extmk.rb: already built-in libraries satisfy dependencies.
+ [ruby-dev:24028]
- * experimental release 1.1b9_14.
+Thu Sep 2 11:36:20 2004 WATANABE Hirofumi <eban@ruby-lang.org>
- * string.c (str_modify): check for embedded pointer reference.
+ * eval.c (rb_obj_instance_eval): backported from HEAD.
- * gc.c (obj_free): ditto.
+Wed Sep 1 21:18:25 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * pack.c (pack_pack): p/P template to embed pointers.
+ * ext/tk/lib/tk/spinbox.rb: fix typo
-Wed Apr 22 00:07:10 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+Tue Aug 31 18:24:04 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * array.c (ary_rindex): embarrassing typo.
+ * ext/tk/tkutil.c (cbsubst_init): fix memory leak
-Tue Apr 21 12:31:48 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/tkutil.c (cbsubst_get_all_subst_keys): fix SEGV
- * experimental release 1.1b9_13.
+Tue Aug 31 16:04:22 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * configure.in (RUBY_LIB): supports --program-{prefix,suffix}.
+ * ext/tcltklib/tcltklib.c (ip_delete): when a tcltkip is deleted,
+ destroy its root widget
- * array.c (ary_rindex): new method.
+Tue Aug 31 12:30:36 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * io.c (io_binmode): should return self.
+ * ext/tcltklib/tcltklib.c (del_root): fix SEGV
-Tue Apr 21 08:23:04 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+Mon Aug 30 23:11:06 2004 Dave Thomas <dave@pragprog.com>
- * parse.y (here_document): calling parse_string with wrong
- arguments.
+ * lib/rdoc/ri/ri_driver.rb (and others): ri now merges documentation
+ if it finds the same class in multiple places.
- * struct.c (struct_aset): problem member assignment with name.
+Mon Aug 30 22:40:30 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
-Mon Apr 20 14:47:49 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/lib/multi-tk.rb: 'restart' method accepts arguments
- * experimental release 1.1b9_12.
+Mon Aug 30 21:50:14 2004 Dave Thomas <dave@pragprog.com>
- * time.c (time_arg): args may be string (support for reduced
- implicit type conversion).
+ * object.c: Add RDoc for Module.included.
- * lib/base64.rb: changed to use pack/unpack with `m' template.
+Mon Aug 30 15:10:46 2004 WATANABE Hirofumi <eban@ruby-lang.org>
-Mon Apr 20 06:23:20 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * configure.in (GNU/k*BSD): fixed FTBFS on GNU/k*BSD. [ruby-dev:24051]
- * variable.c (mod_remove_const): new method.
+Mon Aug 30 11:29:35 2004 NAKAMURA Usaku <usa@ruby-lang.org>
-Sat Apr 18 03:53:27 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * win32/win32.c (CreateChild): strip trailing spaces. [ruby-dev:24143]
+ merge from HEAD.
- * hash.c (hash_each_with_index): removed. use Enumerable's
- each_with_index instead.
+Sun Aug 29 14:08:56 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * class.c (rb_include_module): check for super modules, since
- module's included modules may be changed.
+ * ext/tcltklib/tcltklib.c: compile error on bcc32 [ruby-dev:24081]
-Fri Apr 17 21:50:47 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * ext/tk/lib/multi-tk.rb: MultiTkIp#eval_string does not work
- * marshal.c (r_long): r_byte() may return signed byte.
+Sat Aug 28 23:04:41 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Fri Apr 17 11:58:30 1998 NAGAI Hidetoshi <nagai@dumbo.ai.kyutech.ac.jp>
+ * bignum.c (rb_big_and): protect parameters from GC.
+ [ruby-talk:110664]
- * ext/tcltklib/tcltklib.c (lib_mainloop): thread and interrupt check.
+Thu Aug 26 04:38:29 2004 Dave Thomas <dave@pragprog.com>
-Fri Apr 17 11:06:30 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * eval.c (return_jump): Minor typo in error message. Now reads
+ "return can't jump across threads".
- * eval.c (find_file): try to fopen() to check whether file exists.
+Tue Aug 24 17:30:00 2004 Shugo Maeda <shugo@ruby-lang.org>
- * ruby.c (load_file): ditto.
+ * lib/cgi/session.rb (CGI::Session::FileStore#initialize): do not
+ use a session id as a filename. (backported from HEAD)
- * struct.c (struct_aset): struct member can be set by member name.
+ * lib/cgi/session/pstore.rb (CGI::Session::PStore#initialize): ditto.
-Fri Apr 17 00:47:19 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * lib/cgi/session/pstore.rb (CGI::Session::PStore#initialize): use
+ Dir::tmpdir. (backported from HEAD)
- * ext/extmk.rb.in: added m68k-human support
+Tue Aug 24 14:40:16 2004 Shugo Maeda <shugo@ruby-lang.org>
- * file.c (LOCK_SH): defines moved.
+ * lib/cgi/session.rb (CGI::Session::FileStore#initialize): untaint
+ session id after check. (backported from HEAD)
- * array.c (ary_flatten_bang): simplified loop.
+Tue Aug 24 09:09:01 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
-Thu Apr 16 16:52:01 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/openssl/ossl_x509attr.c (ossl_x509attr_initialize): d2i
+ functions may replace the pointer indicated by the first argument.
- * experimental release 1.1b9_11.
+ * ext/openssl/ossl_x509ext.c (ossl_x509ext_initialize): ditto.
- * lib/tk.rb: thread support (experimental - maybe slow).
+ * ext/openssl/ossl_x509name.c (ossl_x509name_initialize): ditto.
- * eval.c (rb_longjmp): trace event on exception in raising
- context, just before raising exception.
+Mon Aug 23 14:04:51 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * struct.c (struct_s_members): forgot to check singletons.
+ * ext/openssl/ossl_ssl.c (ossl_ssl_read):
+ - should return an empty string if specified length to read is 0.
+ - should check for pending data and wait for fd before reading.
+ - call underlying IO's sysread if SSL session is not started.
+ [ruby-dev:24072], [ruby-dev:24075]
- * struct.c (struct_aref): members can be accessed by names too.
+ * ext/openssl/ossl_ssl.c (ossl_ssl_write):
+ - call underlying IO's syswrite if SSL session is not started.
- * array.c (ary_flatten): new method.
+ * ext/openssl/ossl_ssl.c (ossl_ssl_pending): new method
+ OpenSSL::SSL#pending.
- * eval.c (rb_longjmp): prints exception information with `-d'.
+ * ext/openssl/lib/openssl/buffering.rb: should not use select.
- * object.c (any_to_s): remove class name restriction.
+Mon Aug 23 12:40:56 2004 NAKAMURA Usaku <usa@ruby-lang.org>
-Thu Apr 16 01:38:02 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/resolv.rb (Config.default_config_hash): when multiple domains
+ are set, Win32::Resolv.get_resolv_info returns Array.
- * file.c (thread_flock): do not block other threads.
+Sun Aug 22 01:15:31 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * eval.c (thread_trap_eval): signals are now delivered to the
- current thread again. In case that the current thread is dead,
- signals are forwarded to the main thread.
+ * lib/webrick/httpproxy.rb (WEBrick::HTTPProxyServer#proxy_connect):
+ should call :ProxyContentHandler before finishing CONNECT.
- * string.c (str_new4): need not to duplicate frozen strings.
+Sat Aug 21 06:41:16 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Apr 15 08:33:47 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+ * ext/tcltklib/extconf.rb (find_tcl, find_tk): find stub library.
- * struct.c (struct_inspect): remove restriction for struct names.
+ * lib/mkmf.rb (arg_config, with_config): deal with '-' and '_'
+ uniformly. [ruby-dev:24118]
-Wed Apr 15 02:55:02 1998 Kazuya 'Sharl' Masuda <sharl@www.ufo.co.jp>
+Thu Aug 19 16:29:45 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * x68 patches to config.sub, ext/extmk.rb.in
+ * ext/tk/lib/tk.rb: Fail to treat a hash value of 'font' option.
-Wed Apr 15 01:22:56 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/lib/tk.rb: bindinfo cannot return '%' substiturion infomation.
- * string.c (str_dup_frozen): do not duplicate frozen strings.
+ * ext/tk/lib/menu.rb: typo bug.
- * parse.y (yylex): allow nested parenthesises.
+Thu Aug 19 15:15:24 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * io.c (obj_displayln): prints newline after `display'ing the
- receiver.
+ * dir.c (free_dir): fix memory leak. reported by yamamoto
+ madoka.
- * io.c (io_puts): avoid generating "\n" each time. use RS_default
- instead.
+Thu Aug 20 11:00:00 2004 Akiyoshi, Masamichi <masamichi.akiyoshi@hp.com>
- * io.c (f_p): ditto.
+ * dln.c (dln_load): Modify to call lib$find_image_symbol for VMS.
+ * io.c (rb_io_fwrite): Use fputc() for VMS non-stream file.
-Tue Apr 14 22:18:17 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+Thu Aug 19 06:07:45 2004 why the lucky stiff <why@ruby-lang.org>
- * struct.c (struct_aref): should not subtract negative index.
+ * ext/syck/token.c: re2c no longer compiled with bit vectors. caused
+ problems for non-ascii characters. [ruby-core:03280]
+ * ext/syck/implicit.c: ditto.
+ * ext/syck/bytecode.c: ditto.
-Tue Apr 14 11:34:50 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/yaml/baseemitter.rb: folding now handles double-quoted strings,
+ fixed problem with extra line feeds at end of folding, whitespace
+ opening scalar blocks.
- * experimental release 1.1b9_10.
+ * lib/yaml/rubytypes.rb: subtelties in handling strings with
+ non-printable characters and odd whitespace patterns.
- * parse.y: token names prefixed by `t'.
+Wed Aug 18 23:41:33 2004 Minero Aoki <aamine@loveruby.net>
- * struct.c (struct_s_def): supports subclassing of Struct.
+ * lib/net/protocol.rb (rbuf_fill): OpenSSL::SSL::SSLSocket has its own
+ buffer, select(2) might not work. [ruby-dev:24072]
- * io.c (io_s_new): supports subclassing of IO.
+Wed Aug 18 17:10:12 2004 WATANABE Hirofumi <eban@ruby-lang.org>
-Mon Apr 13 11:07:39 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tcltklib/stubs.c (ruby_tcltk_stubs): need to call
+ Tcl_FindExecutable() for Tcl/Tk 8.4.
- * eval.c (f_binding): need to restore method name.
+Wed Aug 18 12:52:55 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * eval.c (rb_call0): raises SystemStackError, not Fatal.
+ * eval.c (rb_obj_instance_eval): evaluates under special singleton
+ classes as for special constants.
- * io.c (obj_display): same as `print self'.
+Tue Aug 17 17:20:59 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * io.c (f_p): can now be called in the method form.
+ * io.c (rb_io_reopen): should clear allocated OpenFile. pointed
+ out by Guy Decoux. [ruby-core:03288]
- * re.c (reg_regsub): needed to be mbchar aware.
+Tue Aug 17 01:36:32 2004 Dave Thomas <dave@pragprog.com>
-Mon Apr 13 13:18:32 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/rdoc/usage.rb: Remove extra indent. Tidy 'ri' option
+ parsing so RDoc::usage plays better with OptionParser.
- * eval.c (thread_trap_eval): all signals delivered to main_thread.
+Sat Aug 14 13:09:10 2004 Minero Aoki <aamine@loveruby.net>
-Mon Apr 13 12:47:03 1998 TAKAHASHI Masayoshi <maki@inac.co.jp>
+ * lib/fileutils.rb: backport from CVS HEAD (rev1.44).
- * re.c (kcode_set_option): did not set SJIS on SJIS condition.
+ * lib/fileutils.rb: cp_r should copy symlink itself, except cp_r
+ root.
-Sun Apr 12 22:14:07 1998 Kazunori NISHI <kazunori@swlab.csce.kyushu-u.ac.jp>
+ * lib/fileutils.rb: new option mv :force.
- * array.c (ary_uniq_bang): should be `==', not `='. embarrassing.
+ * lib/fileutils.rb: new module FileUtils::DryRun.
-Sat Apr 11 02:13:30 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Sat Aug 14 02:48:16 2004 Dave Thomas <dave@pragprog.com>
- * array.c (ary_subseq): SEGVed for `[][1,1]'.
+ * lib/rdoc/usage.rb: Added. Allows command line programs
+ to report usage using their initial RDoc comment.
-Fri Apr 10 21:29:06 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+Fri Aug 13 13:23:17 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * array.c (ary_subseq): add check for beg larger than array length.
+ * lib/webrick/httputils.rb (WEBrick::HTTPUtils.parse_range_header):
+ fix regex for range-spec.
-Wed Apr 8 17:24:11 1998 MAEDA shugo <shugo@po.aianet.ne.jp>
+ * lib/webrick/httpservlet/filehandler.rb
+ (WEBrick::HTTPServlet::DefaultFileHandler#make_partial_content):
+ multipart/byteranges response was broken.
- * dir.c (dir_s_open): can be called with block (like IO#open).
+ * lib/webrick/httpservlet/erbhandler.rb
+ (WEBrick::HTTPServlet::ERBHandler#do_GET): should select media type
+ by suffix of script filename.
- * dir.c (dir_s_chdir): print directory path on error.
+ * lib/xmlrpc/server.rb: refine example code.
- * dir.c (dir_s_chroot): ditto
+Wed Aug 11 17:17:50 2004 WATANABE Hirofumi <eban@ruby-lang.org>
- * dir.c (Init_Dir): needed to override `new'.
+ * configure.in (RPATHFLAG): stop setting RPATHFLAG on Interix.
-Thu Apr 9 18:24:58 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Sun Aug 8 00:43:31 2004 why the lucky stiff <why@ruby-lang.org>
- * experimental release 1.1b9_09.
+ * lib/implicit.c: added sexagecimal float#base60.
- * string.c (str_cmp): do not depend on sentinel at the end of the
- strings.
+ * ext/syck/rubyext.c (yaml_org_handler): ditto.
- * string.c (str_chomp_bang): forgot to set the sentinel.
+ * lib/token.c: indentation absolutely ignored when processing flow
+ collections. plain scalars are trimmed if indentation follows in
+ an ambiguous flow collection.
-Wed Apr 8 00:59:13 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Sat Aug 7 00:50:01 2004 Tanaka Akira <akr@m17n.org>
- * bignum.c (big2int): converted int may be too big to fit in
- signed int.
+ * ext/zlib/zlib.c: Zlib::GzipReader#read(0) returns "" instead of nil.
- * parse.y (arg): `foo += 1' should not cause an error.
+Tue Aug 3 13:49:20 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * variable.c (rb_const_defined): returned false even if the
- constant is defined at the top level.
+ * ext/tk/lib/tk/namespace.rb: bug fix
- * eval.c (f_local_variables): dyna_var->id may be null. should
- have checked before calling str_new2().
+ * ext/tk/lib/tkextlib/treectrl/tktreectrl.rb: add Tk::TreeCtrl.loupe
-Tue Apr 7 01:15:15 1998 Kaneko Naoshi <wbs01621@mail.wbs.or.jp>
+Mon Aug 2 18:04:21 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * re.c (reg_regsub): need to check string boundary.
+ * ext/tk/lib/tk/msgcat.rb (set_translation): bug fix (fail to set
+ trans_str to the same as src_str when trans_str is not given.)
-Tue Apr 7 19:19:12 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Mon Aug 2 11:53:06 2004 Dave Thomas <dave@pragprog.com>
- * string.c (str_cmp): returns either 1, 0, -1.
+ * lib/rdoc/code_objects.rb (RDoc::Context::find_symbol): Fix infinite recursion
+ looking up some top level symbols (batsman)
- * array.c (ary_cmp): should check array length, too
+Mon Aug 2 11:48:29 2004 Dave Thomas <dave@pragprog.com>
-Tue Apr 7 18:50:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser::do_methods): Allow '.'s in
+ variable names to support SWIG generated files (Hans Fugal)
- * experimental release 1.1b9_08.
+Sat Jul 31 17:40:16 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Apr 7 18:31:27 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * misc/ruby-mode.el (ruby-expr-beg, ruby-parse-partial,
+ ruby-calculate-indent, ruby-move-to-block, ruby-forward-sexp,
+ ruby-backward-sexp): keywords must match word-wise.
- * instruby.rb (mandir): dll installation for cygwin32
+Sat Jul 31 05:47:37 2004 why the lucky stiff <why@ruby-lang.org>
-Tue Apr 7 01:16:45 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/yaml.rb (YAML::load_file, YAML::parse_file): added.
- * config.sub (maybe_os): TOWNS support?
+ * lib/yaml/rubytypes.rb: exceptions were using an older
+ YAML.object_maker. [ruby-core:03080]
- * config.guess: too strict check for libc versions on linuxes.
+ * ext/syck/token.c (sycklex_yaml_utf8): using newline_len to
+ handline CR-LFs. "\000" was showing up on folded blocks which
+ stopped at EOF.
- * experimental release 1.1b9_07.
+ * ext/syck/token.c: re2c compiled with bit vectors now.
+ * ext/syck/implicit.c: ditto.
+ * ext/syck/bytecode.c: ditto.
- * array.c (ary_cmp): compare each element using `<=>'.
+Fri Jul 30 16:10:54 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * hash.c (hash_each_with_index): yields [value, key] pair.
+ * ext/tcltklib/tcltklib.c (lib_fromUTF8_core): raise ArgumentError when
+ the unknown encoding name is given.
- * class.c (class_protected_instance_methods): list protected
- method names.
+ * ext/tcltklib/tcltklib.c (lib_toUTF8_core): ditto.
- * class.c (ins_methods_i): exclude protected methods.
+ * ext/tk/lib/tk.rb (Tk::Encoding.encoding_convertfrom): bug fix.
- * eval.c (PUSH_BLOCK): dynamic variables can be accessed from
- eval() with bindings.
+ * ext/tk/lib/tk.rb (Tk::Encoding.encoding_convertto): ditto.
-Mon Apr 6 14:49:06 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Jul 28 18:59:17 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * eval.c (thread_yield): must return evaluated value.
+ * lib/cgi.rb (CGI::initialize): remove at_exit code for CGI_PARAMS
+ and CGI_COOKIES. they will no longer be used.
-Fri Apr 3 13:07:29 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Jul 28 01:04:44 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * eval.c (thread_schedule): context switch bypassed on wrong
- conditions.
+ * gc.c (run_final): wrong order of data. [ruby-dev:23984]
- * variable.c (rb_name_class): set classname by id before String
- class is initialized (1.0 behavior restored).
+Tue Jul 27 07:05:04 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Fri Apr 3 11:25:45 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * eval.c (rb_eval): copy on write for argument local variable
+ assignment.
- * numeric.c (num2int): no implicit conversion from string.
+ * eval.c (assign): ditto.
- * numeric.c (num2int): check whether `to_i' returns an Integer.
+ * eval.c (rb_call0): update ruby_frame->argv with the default
+ value used for the optional arguments.
- * numeric.c (num_zero_p): new method.
+ * object.c (Init_Object): "===" calls rb_obj_equal() directly.
+ [ruby-list:39937]
- * numeric.c (num_nonzero_p): new method. returns the receiver if
- it's not zero.
+Mon Jul 26 11:22:55 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * eval.c (obj_instance_eval): the_class should be the object's
- singleton class.
+ * lib/webrick/httputils.rb (WEBrick::HTTPUtils.escape): should
+ escape space.
- * error.c (exc_s_new): message is converted into a string.
+Sun Jul 25 11:05:21 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-Thu Apr 2 18:31:46 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * win32/win32.{h,c} (rb_w32_{f,fd,fs}open): workaround for bcc32's
+ {f,fd,fs}open bug. set errno EMFILE and EBADF. [ruby-dev:23963]
- * eval.c (obj_call_init): every object call `initialize'.
+Sat Jul 24 13:32:47 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Wed Apr 1 08:51:53 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+ * range.c (rb_range_beg_len): returns Qnil only when "beg" points
+ outside of a range. No boundary check for "end".
- * parse.y (stmt): UNTIL_MOD should be for stmt, not only for expr.
+Fri Jul 23 16:40:25 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Wed Apr 1 01:20:31 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * gc.c (define_final): should not disclose NODE* to Ruby world.
+ [ruby-dev:23957]
- * object.c (true_and): boolean operators &, | and ^.
+Fri Jul 23 09:03:16 2004 Shugo Maeda <shugo@ruby-lang.org>
-Tue Mar 31 13:23:58 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/net/imap.rb (disconnected?): new method. (backported from HEAD)
- * array.c (ary_compact_bang): returns nil, if it does not modify
- the array like String's bang methods.
+Thu Jul 22 16:41:54 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * array.c (ary_uniq_bang): new method to remove duplicate items.
+ * lib/cgi/session.rb (CGI::Session::FileStore#update): sets the
+ permission of the session data file to 0600.
- * eval.c (bind_s_new): new method.
+ * lib/cgi/session/pstore.rb (CGI::Session::Pstore#initialize):
+ ditto.
- * numeric.c (num2int): raise exception if Fixnums too big to
- convert into `int' in case that sizeof(int) < sizeof(INT).
+Thu Jul 22 00:02:21 2004 Masahiro Kitajima <katonbo@katontech.com>
- * string.c (str_center): SEGV on negative width.
+ * process.c (rb_f_system): not need to call last_status_set() any
+ longer on _WIN32.
- * eval.c (eval): forgot to set sourcefile.
+Tue Jul 20 09:15:17 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-Mon Mar 30 11:12:29 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * test/fileutils/test_fileutils.rb: File.link raises EINVAL on BeOS.
- * file.c (f_test): raises exception for unkown command.
+Mon Jul 19 01:15:07 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * eval.c (Init_eval): `class_eval': alias to the module_eval.
+ * lib/webrick/httpservlet/cgihandler.rb
+ (WEBrick::HTTPServlet::CGIhandler#do_GET): set SystemRoot environment
+ variable to CGI process on Windows native platforms. [ruby-dev:23936]
-Mon Mar 30 18:50:42 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+ * lib/webrick/httpservlet/cgihandler.rb
+ (WEBrick::HTTPServlet::CGIhandler#do_GET): use $?.exitstatus and
+ refine log message.
- * string.c (str_capitalize_bang): did not check string modification.
+Sun Jul 18 16:14:29 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * string.c (str_delete_bang): wrong conversion.
+ * ext/tk/lib/tk/msgcat.rb (TkMsgCatalog.callback): bug fix
+ ( wrong number of argument )
- * string.c (str_intern): typo in error message.
+Sun Jul 18 08:13:58 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Mar 30 01:44:13 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * sprintf.c (rb_f_sprintf): remove extra sign digit.
- * eval.c (obj_instance_eval): accepts block as evaluation body.
- No compilation needed each time.
+Sun Jul 18 03:21:42 2004 Akinori MUSHA <knu@iDaemons.org>
- * eval.c (mod_module_eval): ditto
+ * dir.c (range): use NULL instead of 0.
- * file.c (file_s_umask): umask did not return old values, if no
- argument given.
+ * dir.c (range): get rid of a gcc 3.4 warning.
-Sun Mar 29 00:54:23 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Sun Jul 18 03:12:11 2004 Shugo Maeda <shugo@ruby-lang.org>
- * eval.c (f_throw): nil returned always.
+ * lib/net/imap.rb (receive_responses): return if a LOGOUT response
+ received. (backported from HEAD)
+ * lib/net/imap.rb (send_string_data): wait command continuation
+ requests before sending octet data of literals. (backported from HEAD)
-Sat Mar 28 20:40:12 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Sat Jul 17 23:54:59 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * experimental release 1.1b9_06.
+ * ext/tk/lib/tk/variable.rb: TkVariable#ref returns a TkVariable object
-Sat Mar 28 16:07:11 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+Sat Jul 17 22:04:44 2004 akira yamada <akira@ruby-lang.org>
- * io.c (io_closed): should not cause exception fot closed IO.
+ * lib/uri/ldap.rb: method hierarchical? should be in URI::LDAP.
- * string.c (str_tr): returned nil for success.
+Sat Jul 17 18:29:07 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Mar 28 00:47:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * parse.y (stmt): not to show same error messages twice.
- * eval.c (f_local_variables): new method to return an array of
- local variable names.
+Sat Jul 17 13:13:32 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * variable.c (obj_instance_variables): now returns an array of
- variable names, as described in the reference.
+ * lib/irb/ruby-lex.rb (RubyLex::identify_string): %s string do not
+ process expression interpolation. [ruby-talk:106691]
- * eval.c (rb_attr): honors default method visibility of the
- current scope.
+Sat Jul 17 05:26:27 2004 Dave Thomas <dave@pragprog.com>
-Fri Mar 27 13:49:27 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/rdoc/diagram.rb: Incorporate Micheal Neuman's
+ client-side imagemao patch
- * experimental release 1.1b9_05.
+Sat Jul 17 01:57:03 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * ruby.c (ruby_prog_init): `site_ruby' added to load_path.
+ * eval.c (THREAD_ALLOC): th->thread should be initialized to NULL.
+ [ruby-talk:106657] The solution was found by Guy Decoux.
- * ruby.c (ruby_prog_init): load-path order changed. Paths in
- the RUBYLIB environment variable comes first in non-tainted
- mode.
+Fri Jul 16 22:30:28 2004 Michael Neumann <mneumann@ntecs.de>
-Thu Mar 26 11:51:09 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * file.c (rb_stat_dev_major): new methods File::Stat#dev_major and
+ #dev_minor. [ruby-core:03195]
- * eval.c (rb_call): new feature: `protected' methods.
+Fri Jul 16 15:23:53 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * string.c (str_dump): new method.
+ * eval.c (return_jump, break_jump): raise unexpceted local jump
+ exception directly. [ruby-dev:23740]
- * eval.c (block_pass): block argument can be nil, which means no
- block is supplied for the method.
+ * lib/base64.rb (Deprecated): super in bound method calls original
+ name method in stable version. [ruby-dev:23916]
-Wed Mar 25 21:20:13 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+Fri Jul 16 11:31:49 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * string.c (str_reverse_bang): string copied to wrong place.
+ * lib/test/unit/ui/{fox,gtk,gtk2}/testrunner.rb: remove
+ garbage (patch from akira yamada) [ruby-dev:23911]
-Wed Mar 25 08:12:07 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Fri Jul 16 11:20:00 2004 NAKAMURA Usaku <usa@ruby-lang.org>
- * numeric.c (flo_modulo): caused SEGV if left operand is not a
- float value.
+ * sprintf.c (rb_f_sprintf): fix output of NaN, Inf and -Inf with
+ "%f" or etc on MSVCRT platforms. (backported from HEAD)
- * eval.c (f_eval): optional third and fourth argument to specify
- file-name and line-number.
+Fri Jul 16 11:17:38 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * eval.c (eval): file-name and line-number set properly.
+ * error.c (exit_initialize): use EXIT_SUCCESS instead of 0.
+ [ruby-dev:23913]
- * parse.y (assign_in_cond): literal assignment is now warning, not
- compile error.
+ * error.c (exit_success_p): new method SystemExit#success?.
+ [ruby-dev:23912]
- * error.c (Warn): Warn() always print message, OTOH Waring()
- prints when verbose flag is set.
+ * error.c (syserr_initialize): initialization for subclasses.
+ [ruby-dev:23912]
-Tue Mar 24 12:50:06 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu Jul 15 23:53:38 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ruby.c (ruby_prog_init): `.' should come last in the load-path.
+ * lib/optparse.rb (OptionParser#warn, OptionParser#abort): Exception
+ no longer has to_str method.
- * eval.c (Init_eval): `__send__', alias for `send'.
+Thu Jul 15 22:59:48 2004 Shugo Maeda <shugo@ruby-lang.org>
-Mon Mar 23 12:44:12 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/readline/extconf.rb: added dir_config for curses, ncurses,
+ termcap. (backported from HEAD)
- * string.c (str_chomp_bang): now takes `rs' as an argument.
+Thu Jul 15 20:29:15 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * eval.c (thread_free): main_thread should not be freed.
+ * class.c, error.c, eval.c, intern.h, object.c, variable.c:
+ do not set path if it is a singleton class. [ruby-dev:22588]
+ (backport from 1.9)
-Fri Mar 20 16:40:34 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu Jul 15 10:15:04 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * string.c (str_chomp_bang): chomp! (and other ! methods) returns
- nil if it does not modify the string.
+ * ext/tk/, ext/tcltklib/: bug fix
- * string.c (str_sub_iter_s): should check last pattern since it
- may be matched to null.
+ * ext/tk/lib/tk.rb: better operation for SIGINT when processing
+ callbacks.
+ * ext/tk/lib/tk/msgcat.rb: ditto.
+ * ext/tk/lib/tk/variable.rb: ditto.
+ * ext/tk/lib/tk/timer.rb: ditto.
-Thu Mar 19 13:48:55 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/lib/tk/validation.rb: add Tk::ValidateConfigure.__def_validcmd
+ to define validatecommand methods easier
- * experimental release 1.1b9_04.
+ * ext/tk/lib/tk.rb (_genobj_for_tkwidget): support autoload Tk ext
+ classes
- * parse.y (yylex): `10e0.9' should cause syntax error.
+ * ext/tk/lib/tk/canvas.rb and so on: remove the parent widget type
+ check for items (e.g. canvas items; depends on the class) to
+ avoid some troubles on Tk extension widget class definition.
-Wed Mar 18 17:46:31 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/lib/tkextlib/: add Iwidget and TkTable extension support
- * ruby.c (load_file): new file object constant DATA. Only
- available for the script from the file.
+ * ext/tk/sample/tkextlib/: add samples of Iwidget and TkTable
- * regex.c (re_match): forwading failure point popped too much.
-Tue Mar 17 18:23:06 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Jul 14 18:08:37 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * math.c (math_frexp): newly added.
+ * ext/openssl/ossl_asn1.c (ossl_asn1cons_to_der): fix type of
+ argument. [ruby-dev:23891]
- * math.c (math_ldexp): ditto.
+ * test/openssl/test_x509store.rb: prune tests for CRL checking
+ unless X509::V_FLAG_CRL_CHECK is defined.
- * bignum.c (bigdivmod): calculates modulo.
+Wed Jul 14 12:29:07 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * numeric.c (fix_remainder): returns reminder, formerly introduced
- as modulo.
+ * util.c (ruby_strtod): should not convert string in the form of
+ "-I.FE-X" which both "I" and "F" are ommitted. [ruby-dev:23883]
- * numeric.c (fix_modulo): calculates proper `modulo'.
+ * test/ruby/test_float.rb (test_strtod): add test for bug fix.
- * bignum.c (bigdivmod): wrong sign for reminder.
+Wed Jul 14 01:18:45 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-Mon Mar 16 17:07:28 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * array.c: rdoc patch - unified margin.
- * experimental release 1.1b9_03.
+Wed Jul 14 00:31:15 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-Mon Mar 16 16:33:53 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * array.c: rdoc patch. merged patch from Johan Holmberg
+ <holmberg@iar.se> [ruby-core:3170]
- * io.c (pipe_finalize): needed to add pipe_finalize to pipes on
- cygwin32.
+Tue Jul 13 19:39:12 2004 akira yamada <akira@ruby-lang.org>
-Mon Mar 16 14:11:06 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/uri/generic.rb (URI::Generic#merge_path):
+ "URI('http://www.example.com/foo/..') + './'" should return
+ "URI('http://www.example.com/')". [ruby-list:39838]
+ "URI('http://www.example.com/') + './foo/bar/..'" should return
+ "URI('http://www.example.com/foo/')". [ruby-list:39844]
- * class.c (ins_methods_i): needed to consider NOEX_UNDEF.
+ * test/uri/test_generic.rb (TestGeneric#test_merge): added tests.
-Mon Mar 16 13:23:53 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+Tue Jul 13 15:51:45 2004 Akinori MUSHA <knu@iDaemons.org>
- * io.c (io_check_closed): check for `fptr->f2 == NULL'.
+ * lib/mkmf.rb (init_mkmf): Do not add $(libdir) to $LIBPATH in
+ extmk mode.
- * io.c (io_fptr_close): ditto.
+ * lib/mkmf.rb (dir_config): Prepend a new library path instead of
+ appending so it is tried first.
-Mon Mar 16 11:49:25 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Jul 13 00:50:48 2004 Dave Thomas <dave@pragprog.com>
- * io.c (pipe_atexit): free()ing referencing pipe_list.
+ * lib/rdoc/parsers/parse_rb.rb: Support call-seq: for Ruby files.
- * range.c (range_length): returns zero, if the first is greater
- than the last.
+Mon Jul 12 21:20:36 2004 Dave Thomas <dave@pragprog.com>
- * signal.c (trap_restore_mask): restore signal mask before raising
- exceptions and throws.
+ * html_generator.rb: Support hyperlinks of the form {any text}[xxx]
+ as well as stuff[xxx]
-Fri Mar 13 13:49:24 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Sat Jul 10 09:30:24 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
- * experimental release 1.1b9_02.
+ * test/soap/marshal/test_struct.rb: use qualified build-tin class name
+ (::Struct) to avoid name crash.
- * object.c (mod_clone): need to dups constants and instance
- variables.
+Sat Jul 10 04:21:56 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * eval.c (rb_eval): forgot to initialize body for NODE_DEFS.
+ * ext/tk/lib/tk.rb: better operation for SIGINT when processing
+ callbacks.
+ * ext/tk/lib/tk/msgcat.rb: ditto.
+ * ext/tk/lib/tk/variable.rb: ditto.
+ * ext/tk/lib/tk/timer.rb: ditto.
- * eval.c (rb_eval): retrieve self from calling frame, since self
- changes sometimes.
+ * ext/tk/lib/tk/validation.rb (__def_validcmd): add a module
+ function of Tk::ValidateConfigure to define validatecommand
+ methods easier
- * env.h (FRAME): need to save self in the calling frame.
+Fri Jul 9 22:36:36 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * io.c (f_gets_method): rs should be initialized by RS.
+ * array.c, enum.c, pack.c: rdoc patch from Johan Holmberg
+ <holmberg@iar.se> [ruby-core:3132] [ruby-core:3136]
-Thu Mar 12 15:33:57 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * numeric.c: rdoc patch.
- * experimental release 1.1b9_01.
+Fri Jul 9 19:26:39 2004 Tanaka Akira <akr@m17n.org>
- * range.c (range_s_new): check values by `first <= last'.
+ * lib/open-uri.rb (URI::HTTPS#proxy_open): raise ArgumentError to
+ notice https is not supported.
- * parse.y (lastline_set): fixed offset for $_ and $~ in the local
- variable space.
+Fri Jul 9 14:28:54 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Mar 11 02:14:17 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * eval.c (rb_thread_raise): accept third argument as well as
+ Kernel#raise, and evaluate the arguments to create an exception in
+ the caller's context. [ruby-talk:105507]
- * io.c (io_gets): handle normal case specially for speed.
+Fri Jul 9 01:47:08 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * eval.c (rb_disable_super): function to disable superclass's
- method explicitly.
+ * ext/tk/lib : bug fix
+ * ext/tk/lib/tkextlib/itcl : add [incr Tcl] support
+ * ext/tk/lib/tkextlib/itk : add [incr Tk] support
+ * ext/tk/lib/tkextlib/iwidgets : midway point of [incr Widgets] support
+ * ext/tk/sample/tkextlib/iwidgets : very simple examples of
+ [incr Widgets]
- * eval.c (rb_eval): inherits previous method definition's
- NOEX_UNDEF-ness, if exists.
+Thu Jul 8 22:52:19 2004 Kouhei Sutou <kou@cozmixng.org>
- * class.c (rb_define_method): disables superclass's overriding
- method by default.
+ * lib/rss/{rss,parser,0.9,1.0,2.0}.rb: supported RSS 0.9x/2.0
+ validation and validation which disregard order of elements.
+ * test/rss/test_parser.rb: added tests for RSS 0.9x/2.0
+ validation.
+ * test/rss/{test_trackback,rss-testcase}.rb: fixed no good method
+ name.
-Wed Mar 11 01:40:48 1998 MAEDA shugo <shugo@po.aianet.ne.jp>
+Thu Jul 8 00:05:23 2004 akira yamada <akira@ruby-lang.org>
- * numeric.c (flo_gt,etc.): do not depend on `<=>', to handle NaN.
+ * lib/tempfile.rb (Tempfile::initialize): got out code of
+ generating tmpname. [ruby-dev:23832][ruby-dev:23837]
-Tue Mar 10 00:03:24 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Jul 7 15:53:14 2004 NAKAMURA Usaku <usa@ruby-lang.org>
- * ruby.c (load_file): understands multiple options in #! line.
+ * string.c (rb_str_match): raise TypeError when both arguments are
+ strings. [ruby-dev:22869] (backported from HEAD)
- * regex.c (re_compile_pattern): support for [:alpha:] etc.
+ * string.c (rb_str_match2): removed.
-Mon Mar 9 16:53:51 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * Makefile.in, bcc32/Makefile.sub, win32/Makefile.sub,
+ wince/Makefile.sub (string.c): now not depend on version.h.
- * io.h (GetOpenFile): embed io_check_closed in GetOpenFile.
+Wed Jul 7 00:48:34 2004 WATANABE Hirofumi <eban@ruby-lang.org>
- * sprintf.c (f_sprintf): zero padding failed for negative
- integers.
+ * ext/tk/lib/tkextlib/tktrans.rb,
+ ext/tk/lib/tkextlib/treectrl.rb: fix syntax errors.
- * sprintf.c (remove_sign_bits): failed to remove some bits.
+Tue Jul 6 18:38:45 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib : improve framework of developping Tcl/Tk extension
+ wrappers
+
+Mon Jul 5 23:56:42 2004 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rss/{trackback,syndication,dublincore,content}.rb: worked
+ with ruby 1.6 again.
+
+ * test/rss/rss-assertions.rb: ditto.
+
+Mon Jul 5 22:54:39 2004 Tanaka Akira <akr@m17n.org>
+
+ * lib/uri/common.rb (Kernel#URI): new global method for parsing URIs.
+
+Mon Jul 5 09:02:52 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_thread_yield, rb_f_catch): 4th argument to rb_yield_0()
+ is a set of bit flags. [ruby-dev:23859]
+
+Mon Jul 5 01:27:32 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
+
+ * lib/drb/drb.rb(DRbConn self.open): If socket pool is full, close
+ the socket whose last-access-time is oldest. (and add new one)
+ [ruby-dev:23860]
+
+Sun Jul 4 12:24:50 2004 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rss/rss.rb: added copyright header.
+
+Sun Jul 4 00:24:40 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
+
+ * added files
+ * lib/soap/attachment.rb
+ * lib/soap/header
+ * lib/soap/mimemessage.rb
+ * lib/soap/rpc/httpserver.rb
+ * lib/wsdl/soap/cgiStubCreator.rb
+ * lib/wsdl/soap/classDefCreator.rb
+ * lib/wsdl/soap/classDefCreatorSupport.rb
+ * lib/wsdl/soap/clientSkeltonCreator.rb
+ * lib/wsdl/soap/driverCreator.rb
+ * lib/wsdl/soap/mappingRegistryCreator.rb
+ * lib/wsdl/soap/methodDefCreator.rb
+ * lib/wsdl/soap/servantSkeltonCreator.rb
+ * lib/wsdl/soap/standaloneServerStubCreator.rb
+ * lib/wsdl/xmlSchema/enumeration.rb
+ * lib/wsdl/xmlSchema/simpleRestriction.rb
+ * lib/wsdl/xmlSchema/simpleType.rb
+ * lib/xsd/codegen
+ * lib/xsd/codegen.rb
+ * sample/soap/authheader
+ * sample/soap/raa2.4
+ * sample/soap/ssl
+ * sample/soap/swa
+ * sample/soap/whois.rb
+ * sample/soap/calc/samplehttpd.conf
+ * sample/soap/exchange/samplehttpd.conf
+ * sample/soap/sampleStruct/samplehttpd.conf
+ * sample/wsdl/raa2.4
+ * sample/wsdl/googleSearch/samplehttpd.conf
+ * test/openssl/_test_ssl.rb
+ * test/soap/header
+ * test/soap/ssl
+ * test/soap/struct
+ * test/soap/swa
+ * test/soap/wsdlDriver
+ * test/wsdl/multiplefault.wsdl
+ * test/wsdl/simpletype
+ * test/wsdl/test_multiplefault.rb
+
+ * modified files
+ * lib/soap/baseData.rb
+ * lib/soap/element.rb
+ * lib/soap/generator.rb
+ * lib/soap/marshal.rb
+ * lib/soap/netHttpClient.rb
+ * lib/soap/parser.rb
+ * lib/soap/processor.rb
+ * lib/soap/property.rb
+ * lib/soap/soap.rb
+ * lib/soap/streamHandler.rb
+ * lib/soap/wsdlDriver.rb
+ * lib/soap/encodingstyle/handler.rb
+ * lib/soap/encodingstyle/literalHandler.rb
+ * lib/soap/encodingstyle/soapHandler.rb
+ * lib/soap/mapping/factory.rb
+ * lib/soap/mapping/mapping.rb
+ * lib/soap/mapping/registry.rb
+ * lib/soap/mapping/rubytypeFactory.rb
+ * lib/soap/mapping/wsdlRegistry.rb
+ * lib/soap/rpc/cgistub.rb
+ * lib/soap/rpc/driver.rb
+ * lib/soap/rpc/element.rb
+ * lib/soap/rpc/proxy.rb
+ * lib/soap/rpc/router.rb
+ * lib/soap/rpc/soaplet.rb
+ * lib/soap/rpc/standaloneServer.rb
+ * lib/wsdl/data.rb
+ * lib/wsdl/definitions.rb
+ * lib/wsdl/operation.rb
+ * lib/wsdl/parser.rb
+ * lib/wsdl/soap/definitions.rb
+ * lib/wsdl/xmlSchema/complexContent.rb
+ * lib/wsdl/xmlSchema/complexType.rb
+ * lib/wsdl/xmlSchema/data.rb
+ * lib/wsdl/xmlSchema/parser.rb
+ * lib/wsdl/xmlSchema/schema.rb
+ * lib/xsd/datatypes.rb
+ * lib/xsd/qname.rb
+ * sample/soap/calc/httpd.rb
+ * sample/soap/exchange/httpd.rb
+ * sample/soap/sampleStruct/httpd.rb
+ * sample/soap/sampleStruct/server.rb
+ * sample/wsdl/amazon/AmazonSearch.rb
+ * sample/wsdl/amazon/AmazonSearchDriver.rb
+ * sample/wsdl/googleSearch/httpd.rb
+ * test/soap/test_basetype.rb
+ * test/soap/test_property.rb
+ * test/soap/test_streamhandler.rb
+ * test/soap/calc/test_calc.rb
+ * test/soap/calc/test_calc2.rb
+ * test/soap/calc/test_calc_cgi.rb
+ * test/soap/helloworld/test_helloworld.rb
+ * test/wsdl/test_emptycomplextype.rb
+ * test/wsdl/axisArray/test_axisarray.rb
+ * test/wsdl/datetime/test_datetime.rb
+ * test/wsdl/raa/test_raa.rb
+ * test/xsd/test_xmlschemaparser.rb
+ * test/xsd/test_xsd.rb
+
+ * summary
+ * add SOAP Header mustUnderstand support.
+
+ * add HTTP client SSL configuration and Cookies support (works
+ completely with http-access2).
+
+ * add header handler for handling sending/receiving SOAP Header.
+
+ * map Ruby's anonymous Struct to common SOAP Struct in SOAP Object
+ Model. it caused error.
+
+ * add WSDL simpleType support to restrict lexical value space.
+
+ * add SOAP with Attachment support.
+
+Sat Jul 3 17:19:44 2004 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/tk/lib/tkextlib/tkDND.rb: fix syntax error.
+
+Thu Jul 1 23:15:29 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/pstore.rb (transaction): safer backup scheme. [ruby-list:39102]
+
+ * lib/pstore.rb (commit_new): use FileUtils.copy_stream for Cygwin.
+ [ruby-dev:23157]
+
+ * lib/pstore.rb (transaction): allow overriding dump and load.
+ [ruby-dev:23567]
+
+ * lib/pstore.rb (PStore#transaction): get rid of opening in write mode
+ when read only transaction. [ruby-dev:23842]
+
+ * lib/yaml/store.rb: follow lib/pstore.rb's change.
-Sat Mar 7 21:51:46 1998 MAEDA shugo <shugo@po.aianet.ne.jp>
+Thu Jul 1 18:36:08 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * class.c (ins_methods_i): body may be NULL for some case.
+ * ext/tk/lib/tcltklib : bug fix
-Fri Mar 6 17:23:07 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/lib/tk : bug fix and add Tcl/Tk extension support libraries
- * regex.c (mbcinit): table driven mbchar detection.
+Thu Jul 1 11:59:45 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * object.c (obj_alloc): check for allocating instance for the
- primitive classes (mostly perfect).
+ * ext/openssl/extconf.rb: check for EVP_CIPHER_CTX_copy, ENGINE_add,
+ EVP_CIPHER_CTX_set_padding, EVP_CipherFinal_ex, EVP_CipherInit_ex,
+ EVP_DigestFinal_ex and EVP_DigestInit_ex.
- * ext/curses/curses.c (curses_finalize): restore original state at
- interpreter temination.
+ * ext/openssl/openssl_missing.c (EVP_CIPHER_CTX_copy): new function.
- * ext/curses/curses.c (curses_addstr): forgot to check argument
- type (caused SEGV). now uses STR2CSTR() macro.
+ * ext/openssl/openssl_missing.h (EVP_DigestInit_ex, EVP_DigestFinal_ex,
+ EVP_CipherInit_ex, EVP_CipherFinal_ex, HMAC_Init_ex): new macro for
+ OpenSSL 0.9.6.
-Thu Mar 5 13:47:39 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/openssl/ossl_cipher.c (ossl_cipher_encrypt, ossl_cipher_decrypt):
+ re-implemnt (the arguments for this method is ).
- * eval.c (block_pass): accepts method object as block args.
+ * ext/openssl/ossl_cipher.c (ossl_cipher_pkcs5_keyivgen): new method
+ OpenSSL::Cipher::Cipher#pkcs5_keyivgen. it calls EVP_BytesToKey().
- * eval.c (f_missing): use any_to_s() for stringify.
+ * ext/openssl/ossl_cipher.c (ossl_cipher_alloc, ossl_cipher_initialize,
+ ossl_cipher_copy, ossl_cipher_reset ossl_cipher_final,
+ ossl_cipher_set_key, ossl_cipher_set_iv): replace all EVP_CipherInit
+ and EVP_CipherFinal into EVP_CipherInit_ex and EVP_CipherFinal_ex.
+ and EVP_CIPHER_CTX_init should only be called once.
-Wed Mar 4 01:39:52 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/openssl/ossl_cipher.c (ossl_cipher_set_key_length): new method
+ OpenSSL::Cipher::Cipher#key_len=.
- * parse.y (block_arg): new syntax - block argument in the
- calling arglist.
+ * ext/openssl/ossl_cipher.c (ossl_cipher_init_deprecated): new
+ finction; print warning for Cipher#<<.
- * eval.c (rb_call): no module search. simplified a lot.
+ * ext/openssl/ossl_digest.c: replace all EVP_DigestInit and
+ EVP_DigestFinal into EVP_DigestInit_ex and EVP_DigestFinal_ex.
+ and EVP_MD_CTX_init should only be called once.
- * eval.c (rb_eval): block arg support.
+ * ext/openssl/ossl_digest.c (digest_final): should call
+ EVP_MD_CTX_cleanup to avoid memory leak.
- * parse.y (f_block_arg): new syntax - block argument in the
- formal arglist.
+ * ext/openssl/ossl_hmac.c (ossl_hmac_initialize): repalce HMAC_init
+ into HMAC_init_ex. and HMAC_CTX_init is moved to ossl_hmac_alloc.
-Tue Mar 3 14:20:15 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/openssl/ossl_hmac.c (hmac_final): should call
+ HMAC_CTX_cleanup to avoid memory leak.
- * eval.c (obj_method): returns bound method object.
+ * test/openssl/test_cipher.rb, test/openssl/test_digest.rb,
+ test/openssl/test_hmac.rb: new file.
- * eval.c (rb_call): argument check for empty methods.
+Thu Jul 1 04:08:30 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * ruby.h (NUM2CHR): new macro, originally from curses module.
+ * ext/openssl/ossl_asn1.c (ossl_i2d_ASN1_TYPE, ossl_ASN1_TYPE_free):
+ workaround for the versions earlier than OpenSSL-0.9.7.
-Tue Mar 3 13:03:35 1998 MAEDA shugo <shugo@po.aianet.ne.jp>
+Thu Jul 1 03:33:55 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * io.c (io_putc): new method.
+ * ext/openssl/ossl_pkey_dh.c (ossl_dh_initialize): should create
+ empty pkey object if no argument is passed. [ruby-talk:103328]
-Tue Mar 3 11:21:28 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/openssl/ossl_pkey_dsa.c (ossl_dsa_initialize): ditto.
- * string.c (str_inspect): more strict charcode detection.
+ * ext/openssl/ossl_pkey_rsa.c (ossl_rsa_initialize): ditto.
- * eval.c (thread_stop): stopping only thread raises ThreadError
- exception.
+ * ext/openssl/ossl_pkey_dh.c: add new methods: OpenSSL::PKey::DH#p,
+ OpenSSL::PKey::DH#p=, OpenSSL::PKey::DH#g, OpenSSL::PKey::DH#g=,
+ OpenSSL::PKey::DH#pub_key, OpenSSL::PKey::DH#pub_key=,
+ OpenSSL::PKey::DH#priv_key and OpenSSL::PKey::DH#priv_key=.
-Tue Mar 3 08:04:56 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+ * ext/openssl/ossl_pkey_dsa.c: add new methods: OpenSSL::PKey::DSA#p,
+ OpenSSL::PKey::DSA#p=, OpenSSL::PKey::DSA#q, OpenSSL::PKey::DSA#q=,
+ OpenSSL::PKey::DSA#g, OpenSSL::PKey::DSA#g=,
+ OpenSSL::PKey::DSA#pub_key, OpenSSL::PKey::DSA#pub_key=,
+ OpenSSL::PKey::DSA#priv_key and OpenSSL::PKey::DSA#priv_key=.
- * struct.c (struct_alloc): imcomplete struct initialization made
- GC to access unallocated addresses.
+Thu Jul 1 03:16:09 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
-Mon Mar 2 16:28:27 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/openssl/ossl_ssl.c (ossl_ssl_read): take optional second argument
+ to specify a string to be written.
- * eval.c (thread_stop_method): remove Thread#stop.
+ * ext/openssl/lib/openssl/buffering.rb (OpenSSL::Buffering#read):
+ take optional second argument to specify a string to be written.
-Fri Feb 27 18:16:26 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/openssl/lib/openssl/buffering.rb (OpenSSL::Buffering#gets):
+ refine regexp for end-of-line.
- * version 1.1b9 released.
+ * ext/opnessl/lib/openssl/ssl.rb
+ (OpenSSL::SSL::SocketForwarder#listen): fix typo.
-Fri Feb 27 09:36:35 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Jun 30 11:38:51 2004 Mikael Brockman <phubuh@phubuh.org>
- * hash.c (hash_delete_nil): needed to compare value to nil, since
- nil is the valid key for hashes.
+ * parse.y (primary): should not be NULL. [ruby-core:03098]
- * hash.c (hash_foreach_iter): rehashing causes IndexError.
+Wed Jun 30 02:53:24 2004 why the lucky stiff <why@ruby-lang.org>
- * hash.c (hash_foreach_iter): rehash check by pointer comparison.
+ * ext/syck/rubyext.c (syck_emitter_new): set buffer after
+ Data_Wrap_Struct to avoid possible GC. [ruby-talk:104835]
-Thu Feb 26 17:22:13 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Jun 29 10:31:19 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * parse.y (fname): convert reswords into symbols.
+ * eval.c (rb_eval_cmd, rb_thread_trap_eval): restore safe level.
- * parse.y (reswords): reserved words are now embedded in the
- syntax (sigh).
+ * gc.c (define_final, run_final): preserve and restore safe level for
+ finalizers. [ruby-core:03058]
- * parse.y: now reserved words can be method names safely.
+ * signal.c (signal_exec, rb_trap_exit, trap): preserve and restore
+ safe level for signal handlers. [ruby-dev:23829]
-Wed Feb 25 15:50:07 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Mon Jun 28 14:57:56 2004 Jeff Mitchell <quixoticsycophant@yahoo.com>
- * eval.c (mod_module_eval): clear the_scope's PRIVATE flag before
- calling eval().
+ * configure.in, lib/mkmf.rb (LIBPATHFLAG): use double quotes due to
+ DOSISH compilers. [ruby-core:03107]
- * gc.c (gc_call_finalizer_at_exit): run finalizers before any data
- object being freed.
+Mon Jun 28 00:30:19 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
- * eval.c (rb_eval): needed to keep prot_tag->retval before
- evaluating the ensure clause.
+ * sample/drb/*.rb: using 'DRb.thread.join' instead of 'gets'
-Tue Feb 24 11:16:32 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Sun Jun 27 22:39:51 2004 Kouhei Sutou <kou@cozmixng.org>
- * parse.y (yylex): reserved words can be appear as method names at
- right after 'def' and `.'(dot), like foo.next.
+ * sample/rss/tdiary_plugin/rss-recent.rb: supported Hiki.
- * eval.c (return_check): checks for return out of thread (formerly
- done in return_value).
+Sun Jun 27 12:19:46 2004 Kouhei Sutou <kou@cozmixng.org>
- * eval.c (POP_TAG): copy retval to outer level.
+ * {lib,sample,test}/rss: added RSS Parser. [ruby-dev:23780]
- * eval.c (return_value): just set retval, no check, no unwinding.
+Sat Jun 26 11:07:30 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * parse.y (nextc): line continuation by backslash at end of line.
+ * configure.in (aix): -b must come at the start of the command line,
+ and -e must not appear while testing libraries. [ruby-talk:104501]
- * regex.c (re_compile_pattern): forgot to clear pending_exact on
- closing parentheses.
+ * lib/mkmf.rb (dir_config): quote directory names if necessary.
+ [ruby-talk:104505]
- * parse.y (assignable): should not assign dyna_var to true, if it
- is already defined.
+Fri Jun 25 15:33:19 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Feb 23 14:35:03 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/iconv/extconf.rb: check stricter. [ruby-talk:104501]
- * object.c (obj_is_kind_of): no longer accepts true/false/nil.
+ * ext/iconv/extconf.rb: include iconv.h for libiconv. [ruby-dev:22715]
- * object.c ({true,false,nil}_to_i): can be converted into integers.
+Fri Jun 25 08:31:29 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Mon Feb 23 12:11:51 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * eval.c (rb_thread_atfork): remove "fork terminates thread"
+ warning. [ruby-dev:23768]
- * re.c (reg_s_quote): needed to be mbchar aware.
+ * object.c (rb_obj_clone): backport FL_FINALIZE patch from 1.9.
+ [ruby-core:02786][ruby-core:03067]
- * eval.c (proc_s_new): wrong iter mark.
+ * ext/socket/socket.c (sock_sockaddr): Socket#gethostbyname()
+ should give us packed address, not struct sockaddr.
+ [ruby-core:03053]
-Sat Feb 21 22:59:30 1998 MAEDA shugo <shugo@po.aianet.ne.jp>
+Fri Jun 25 02:04:23 2004 NAKAMURA Usaku <usa@ruby-lang.org>
- * io.c (f_syscall): no argument check.
+ * {bcc32,win32,wince}/setup.mak: remove RUBY_EXTERN lines when
+ including version.h. [ruby-talk:104456] (backported from HEAD)
-Fri Feb 20 10:17:51 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu Jun 24 14:23:29 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * version 1.1b8 released.
+ * io.c (rb_io_fread): return already read data when system call is
+ interrupted. [ruby-talk:97206]
- * ext/kconv/kconv.c (kconv_kconv): default output code now be
- determined according to the value of $KCODE.
+Thu Jun 24 01:32:43 2004 Shugo Maeda <shugo@ruby-lang.org>
- * re.c (rb_get_kcode): can retrieve $KCODE from C code.
+ * version.h: added declarations of ruby_version,
+ ruby_release_date, ruby_platform.
+ (backported from HEAD)
- * parse.y (stmt): if/unless modifiers returns nil, if condition is
- not established.
+Wed Jun 23 22:23:37 2004 Dave Thomas <dave@pragprog.com>
-Thu Feb 19 11:06:47 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/socket/socket.c (sock_s_gethostbyaddr): Work around problem
+ with OS X not returning 'from' parameter to recvfrom for
+ connection-oriented sockets.
- * ext/kconv/kconv.c (kconv_kconv): charcode can be specified by
- code name (JIS, SJIS, EUC like value of $KCODE).
+Wed Jun 23 01:45:27 2004 Dave Thomas <dave@pragprog.com>
- * regex.c (re_compile_pattern): forgot to fixup_jump for (?:..).
+ * lib/rdoc/parsers/parse_rb.rb (RubyLex::identify_quotation):
+ Fix problem with the 'r' being dropped from %r{xxx}
- * regex.c (re_compile_pattern): needed to clear pending_exact on
- non-registering grouping (?:...).
+Wed Jun 23 00:20:20 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-Wed Feb 18 19:54:21 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/win32ole/win32ole.c (ole_hresult2msg): remove trailing
+ CRs and LFs. (doesn't depend on CR+LF) [ruby-dev:23749]
- * parse.y (here_document): needed to set lex_state to EXPR_END.
+Wed Jun 23 00:00:25 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Feb 18 18:45:10 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * io.c (rb_io_initialize): should check fcntl result. [ruby-dev:23742]
- * patches for cygwin32 applied.
+Tue Jun 22 21:11:36 2004 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Wed Feb 18 00:41:31 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/win32ole/win32ole.c (OLE_FREE): should not call CoFreeUnuse-
+ dLibraries().
- * string.c (str_sub_s): needed to be mbchar aware to increment one
- character.
+ * ext/win32ole/win32ole.c (ole_event_free): ditto.
- * regex.c (re_match): \Z matches newline just before the end of
- the string.
+ * ext/win32ole/win32ole.c (ole_hresult2msg): truncate error message
+ before CR.
-Tue Feb 17 00:04:32 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Jun 22 16:47:42 2004 Shugo Maeda <shugo@ruby-lang.org>
- * time.c (time_arg): Time.gm and Time.local now understands
- Time#to_a format.
+ * lib/net/ftp.rb (MDTM_REGEXP): fix for demon's ftp server.
+ Thanks, Rutger Nijlunsing.
- * string.c (str_sub_s): replace happened twice for null pattern.
+Mon Jun 21 10:19:23 2004 NAKAMURA Usaku <usa@ruby-lang.org>
- * regex.c (re_search): null pattern should not match after newline
- at the end of string.
+ * win32/win32.c (rb_w32_opendir): use FindFirstFile()/FindNextFile()/
+ FindClose() instead of _findfirst()/_findnext()/_findclose().
+ merge from HEAD.
- * time.c (time_isdst): now returns boolean value.
+Sat Jun 19 13:24:15 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * error.c (rb_check_type): treat special constants in messages.
+ * eval.c (method_call): allow changing $SAFE. [ruby-dev:23713]
- * parse.y (yylex): new form `::Const' to see toplevel constants.
+Fri Jun 18 23:12:22 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * parse.y (cond): SEGV on `if ()'.
+ * eval.c (proc_save_safe_level, rb_set_safe_level, safe_setter): limit
+ safe level.
- * gc.c (obj_free): some data needed explicit free().
+Wed Jun 16 23:05:57 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Mon Feb 16 23:55:40 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * object.c (rb_mod_freeze): prepare string representation before
+ freezing. [ruby-talk:103646]
- * eval.c (blk_free): release duplicated block informations.
+Wed Jun 16 16:04:40 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * eval.c (blk_copy_prev): duplicate outer block information into
- the heap, when proc/binding created.
+ * object.c (rb_mod_le): singleton class inherits Class rather than its
+ object's class. [ruby-dev:23690]
-Mon Feb 16 14:38:25 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Jun 16 16:01:17 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * time.c (time_mon): now 1 for January and so on.
+ * gc.c (stack_grow_direction): memoize the direction.
- * time.c (time_year): year in 19xx (no + 1900 needed anymore).
+ * gc.c (Init_stack): should always move to end of VALUE.
-Mon Feb 16 13:28:33 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Jun 15 12:10:04 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * regex.c (re_compile_pattern): need to fetch mbchar's second byte
- without translation.
+ * ext/tk/lib/tk.rb: bug fix (TkWindow#grab)
-Mon Feb 16 12:29:27 1998 MAEDA shugo <shugo@po.aianet.ne.jp>
+Mon Jun 14 18:23:27 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * eval.c (f_pass_block): pass iterator block to other method.
+ * ext/tk/lib/remote-tk.rb: bug fix
-Fri Feb 13 08:16:11 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Sun Jun 13 00:23:04 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * parse.y (parse_regx): handle \s before read_escape().
+ * ext/tcltklib/extconf.rb: [EXPERIMENTAL] MacOS X (darwin) support
- * parse.y (read_escape): `\s' in strings as space.
+ * ext/tcltklib/tcltklib.c: fix thread trouble on callback proc, and
+ eliminate warning about instance variable access
-Tue Feb 10 17:29:08 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/lib/tk/menubar.rb: improve supported menu_spec
- * version 1.1b7 released.
+ * ext/tk/lib/tk/menuspec.rb: [add] menu_spec support library
- * string.c (str_aset): string insertion by `str[n] = str2'.
+ * ext/tk/lib/tk/root.rb: add menu_spec support
- * string.c (str_oct): does recognize `0x'.
+ * ext/tk/lib/tk/text.rb: bug fix
- * sprintf.c (f_sprintf): use baes 10 for conversion from string to
- integer.
+ * ext/tk/lib/tk/toplevel.rb: add menu_spec support
-Mon Feb 9 14:51:56 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/tk/sample/menubar?.rb: [add] sample of menu_spec usage
- * numeric.c (do_coerce): proper error message.
+Sat Jun 12 11:15:53 2004 WATANABE Hirofumi <eban@ruby-lang.org>
- * string.c (str_sum): bug - masked by wrong value. (sigh..)
+ * configure.in (target_os): strip -gnu suffix on Linux.
-Sat Feb 7 15:11:14 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Fri Jun 11 17:08:21 2004 Akinori MUSHA <knu@iDaemons.org>
- * string.c (str_empty): new method
+ * config.guess: Restore a wrongly removed hyphen.
-Fri Feb 6 01:42:15 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Fri Jun 11 14:30:08 2004 Akinori MUSHA <knu@iDaemons.org>
- * time.c (time_asctime): use asctime(3), not strftime(3).
+ * config.guess: Attempt to avoid system name change on
+ Darwin platforms also.
-Thu Feb 5 18:58:46 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Fri Jun 11 14:22:45 2004 Akinori MUSHA <knu@iDaemons.org>
- * io.c (io_fptr_close): do not free path on close().
+ * config.guess, config.sub: Attempt to avoid system name change on
+ Linux platforms. We have been using "linux" instead of
+ "linux-gnu" on this branch.
- * array.c (ary_filter): new method.
+Thu Jun 10 19:19:41 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * enum.c (enum_each_with_index): new method.
+ * ext/sdbm/init.c (fsdbm_store): sdbm should use StringValue().
+ [ruby-talk:103062]
-Thu Feb 5 14:10:35 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Jun 9 18:04:14 2004 akira yamada <akira@ruby-lang.org>
- * parse.y (primary): singleton class def can be appeared inside
- method bodies.
+ * lib/uri/generic.rb (URI::Generic::merge,
+ URI::Generic::route_from): accepts non-hierarchical URI.
+ [ruby-dev:23631]
- * hash.c (hash_replace): replace content.
+ * test/uri/test_generic.rb (TestGeneric::test_route,
+ TestGeneric::test_merge): added tests for above changes.
- * string.c (str_replace_method): replace content.
+Wed Jun 9 17:39:37 2004 Akinori MUSHA <knu@iDaemons.org>
- * array.c (ary_replace_method): replace elements.
+ * config.guess, config.sub: Update to a more recent version as of
+ 2004-01-20.
- * string.c (str_succ_bang): String#succ!
+ * configure.in: Add support for DragonFly BSD.
-Thu Feb 5 18:20:30 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+Wed Jun 2 20:16:03 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * string.c (str_upcase_bang): multi byte character support.
+ * string.c (str_new4): should share shared instance if it already
+ exists. [ruby-dev:23665]
-Wed Feb 4 13:55:26 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Jun 2 12:41:53 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * array.c (ary_reverse): SEGV on empty array reverse.
+ * io.c (rb_io_gets_m): set lastline ($_) even when read line is
+ nil. [ruby-dev:23663]
-Tue Feb 3 12:24:07 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Fri May 28 11:20:31 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * re.c (match_to_a): non matching element should be nil.
+ * eval.c (rb_eval): bad influence on frame node.
- * ruby.c (ruby_load_script): load script after all initialization.
+ * eval.c (eval): reverted wrongly removed condition. [ruby-dev:23638]
- * bignum.c (str2inum): need to interpret prefix `0' of `0x'.
+Thu May 27 23:15:18 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
-Tue Feb 3 10:00:18 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * lib/logger.rb: leading 0 padding of timestamp usec part.
- * numeric.c (fix_rshift): use `sizeof(INT)*8' instead of 32.
+ * lib/csv.rb (CSV.parse): [CAUTION] behavior changed. in the past,
+ CSV.parse accepts a filename to be read-opened (it was just a
+ shortcut of CSV.open(filename, 'r')). now CSV.parse accepts a
+ string or a stream to be parsed e.g.
+ CSV.parse("1,2\n3,r") #=> [['1', '2'], ['3', '4']]
-Mon Feb 2 14:09:24 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/csv.rb: CSV::Row and CSV::Cell are deprecated. these classes
+ are removed in the future. in the new csv.rb, row is represented
+ as just an Array. since CSV::Row was a subclass of Array, it won't
+ hurt almost all programs except one which depended CSV::Row#match.
+ and a cell is represented as just a String or nil(NULL). this
+ change will cause widespread destruction.
- * ruby.c (set_arg0): grab environment region too.
+ CSV.open("foo.csv", "r") do |row|
+ row.each do |cell|
+ if cell.is_null # using Cell#is_null
+ p "(NULL)"
+ else
+ p cell.data # using Cell#data
+ end
+ end
+ end
-Thu Jan 29 18:36:25 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ must be just;
- * process.c (rb_proc_exec): check `sh' to be exist.
+ CSV.open("foo.csv", "r") do |row|
+ row.each do |cell|
+ if cell.nil?
+ p "(NULL)"
+ else
+ p cell
+ end
+ end
+ end
-Thu Jan 29 18:18:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/csv.rb: [CAUTION] record separator(CR, LF, CR+LF) behavior
+ change. CSV.open, CSV.parse, and CSV,generate now do not force
+ opened file binmode. formerly it set binmode explicitly.
- * io.c (io_stdio_set): assignment to $stdin or $stdout does
- reopen() as well as $stderr.
+ with CSV.open, binmode of opened file depends the given mode
+ parameter "r", "w", "rb", and "wb". CSV.parse and CSV.generate open
+ file with "r" and "w".
-Thu Jan 29 14:18:40 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ setting mode properly is user's responsibility now.
- * class.c (mod_ancestors): should not include singleton classes.
+ * lib/csv.rb: accepts String as a fs (field separator/column separator)
+ and rs (record separator/row separator)
- * object.c (obj_type): should not return internal class.
+ * lib/csv.rb (CSV.read, CSV.readlines): added. works as IO.read and
+ IO.readlines in CSV format.
- * io.c (io_reopen): unwillingly closes stdio streams.
+ * lib/csv.rb: added CSV.foreach(path, rs = nil, &block). CSV.foreach
+ now does not handle "| cmd" as a path different from IO.foreach.
+ needed?
-Thu Jan 29 11:50:35 1998 Toshihiko SHIMOKAWA <toshi@csce.kyushu-u.ac.jp>
+ * test/csv/test_csv.rb: updated.
- * ext/socket/socket.c (udp_addrsetup): forgot to use htons().
+ * test/ruby/test_float.rb: added test_strtod to test Float("0").
-Tue Jan 27 23:15:24 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu May 27 21:37:50 2004 Tanaka Akira <akr@m17n.org>
- * keywords: __FILE__, __LINE__ are available again.
+ * lib/pathname.rb (Pathname#initialize): refine pathname initialization
+ by pathname.
-Fri Jan 23 14:19:28 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu May 27 20:22:05 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * version 1.1b6 released.
+ * io.c (rb_io_fwrite): check all case errno != 0 [ruby-dev:23648]
- * object.c (mod_to_s): need to duplicate classpath.
+Thu May 27 14:53:13 2004 WATANABE Hirofumi <eban@ruby-lang.org>
- * error.c (exc_inspect): need to duplicate classpath.
+ * io.c (rb_io_fwrite): workaround for bcc32's fwrite bug.
+ add errno checking. [ruby-dev:23627]
-Thu Jan 22 00:37:47 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed May 26 14:19:42 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ruby.h (STR2CSTR): new macro to retrieve char*.
+ * eval.c (rb_eval, eval): make line number consistent on eval with
+ Proc. [ruby-talk:101253]
- * class.c (rb_define_method): `initialize' should always be
- private, even if it defined by C extensions.
+Wed May 26 13:59:17 2004 Dave Thomas <dave@pragprog.com>
- * eval.c (rb_eval): `initialize' should always be private.
+ * lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::skip_for_variable): Allow for
+ 'do' after for statement
-Thu Jan 22 16:21:08 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed May 26 13:56:03 2004 Dave Thomas <dave@pragprog.com>
- * eval.c (rb_eval): some singleton class def cause SEGV.
+ * lib/rdoc/generators/html_generator.rb (Generators::MarkUp::style_url): Fix
+ relative path to code CSS file
- * eval.c (TMP_ALLOC): replace ALLOCA_N, where thread context
- switch may happen.
+Wed May 26 13:14:52 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Jan 21 01:43:42 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * io.c (rb_io_init_copy): copy also positions. [ruby-talk:100910]
- * eval.c (PUSH_FRAME): do not use ALLOCA_N(). crash on some
- platforms that use missing/alloca.c.
+Wed May 26 00:00:00 2004 why the lucky stiff <why@ruby-lang.org>
- * regex.c (re_compile_pattern): too many pops for non register
- subexpr.
+ * ext/syck/syck.c (syck_new_parser): clear parser on init.
+ thanks, ts. [ruby-core:02931]
- * parse.y (yylex): open parentheses after identifiers are argument
- list, even if whitespaces have seen.
+ * ext/syck/token.c (sycklex_yaml_utf8): buffer underflow.
+ thanks, ts. [ruby-core:02929]
-Tue Jan 20 15:19:59 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/yaml/baseemitter.rb (indent_text): simpler flow block code.
- * parse.y (terms): quoted word list by %w(a b c).
+ * lib/yaml.rb: added rdoc to beginning of lib.
- * ext/tcltklib/extconf.rb: more accurate check for tcl/tk libs.
+Mon May 24 10:46:26 2004 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * file.c (rb_stat): most of the FileTest methods (and function
- `test') accept File objects as the argument.
+ * lib/rdoc/generators/template/html/html.rb: SYSTEM identifiers
+ must be absolute URIs
-Tue Jan 19 18:19:24 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+Sat May 22 12:00:04 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/extmk.rb.in (install): there should be no newline after install:
+ * MANIFEST: add new encodings in rexml.
- * re.c (MIN): renamed from min(). there's a local variable named
- min in the file, so that some cpp will raise an error.
+ * ext/tk/MANIFEST: add recent files.
-Mon Jan 19 16:30:05 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Sat May 22 05:37:11 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * version 1.1b5 released.
+ * ext/tk/lib/remote-tk.rb: (NEW library) controll Tk interpreters
+ on the other processes by Tcl/Tk's 'send' command
- * process.c (rb_syswait): no exception raised.
+Fri May 21 09:22:05 2004 Dave Thomas <dave@pragprog.com>
-Fri Jan 16 00:43:43 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_method_parameters):
+ Add ()'s around parameters that don't have them
- * ruby.h (CLONESETUP): copies its singleton classes too.
+Thu May 20 17:02:03 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * class.c (singleton_class_attached): saves binded object in the
- singleton classes.
+ * lib/mkmf.rb (check_sizeof): define result size. [ruby-core:02911]
- * eval.c (rb_eval): calls singleton_method_added even in the
- singleton class clauses.
+ * lib/mkmf.rb (create_header): macro name should not include equal
+ sign.
-Fri Jan 15 23:22:43 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+Thu May 20 15:59:50 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * ruby.c (proc_options): -S does not recognize PATH.
+ * ext/socket/socket.c: fix SEGV. [ruby-dev:23550]
-Thu Jan 15 02:03:12 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu May 20 14:35:52 2004 Tanaka Akira <akr@m17n.org>
- * eval.c (rb_clear_cache_by_id): clear only affected cache
- entries.
+ * ext/socket/socket.c: check SCM_RIGHTS macro addition to
+ the msg_control field to test existence of file descriptor passing
+ by msg_control.
-Wed Jan 14 02:14:48 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu May 20 12:38:06 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * ext/socket/socket.c: new UDP/IP socket classes.
+ * numeric.c (flo_eq): always check if operands are NaN.
+ [ruby-list:39685]
-Tue Jan 13 10:00:18 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu May 20 12:34:39 2004 Dave Thomas <dave@pragprog.com>
- * string.c (str_cmp): ignorecase($=) works wrong.
+ * lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_visibility):
+ At Ryan Davis' suggestion, honor visibility modifers if guarded by a
+ statement modifier
-Fri Jan 9 13:19:55 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu May 20 12:22:13 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * version 1.1b4 released.
+ * lib/mkmf.rb (have_type): do not check pointer to incomplete type,
+ which always get compiled. [ruby-list:39683]
- * eval.c (f_missing): class name omitted from the error message.
+Wed May 19 11:09:00 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * error.c (exc_inspect): description changed.
+ * ext/tk/lib/tk.rb: change permition of TkObject#tk_send from
+ private to public
- * string.c (Init_String): GlobalExit's superclass did not filled,
- since GlobalExit created earlier than String.
+Tue May 18 14:00:46 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jan 8 12:10:09 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * node.h (NEW_DSTR): adjust list length.
- * parse.y (aryset): expr in the brackets can be null.
+ * parse.y (literal_concat): ditto.
-Wed Jan 7 21:13:56 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Mon May 17 16:14:25 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * io.c (io_reopen): keep stderr unclosed.
+ * numeric.c (flo_to_s): it's preferable that "p 0.0" outputs "0.0"
+ instead of "0.0e+00". [ruby-dev:23480]
- * io.c (io_errset): keep stderr unclosed.
+ * numeric.c (flo_to_s): it's preferable that "p 0.00000000000000000001"
+ outputs "1.0e-20" instead of "9.999999999999999e-21". (the precision
+ is considered, but there is assumption DBL_DIG == 15 in current
+ implementation)
-Tue Jan 6 00:27:43 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+Mon May 17 10:13:33 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * parse.y: syntax modified for `while expr do .. end' etc.
+ * ext/socket/socket.c (setup_domain_and_type): honor duck typing.
+ [ruby-dev:23522]
- * process.c (f_exec,f_system): can supply arbitrary name for the
- new process.
+ * ext/socket/socket.c (sock_s_getnameinfo): ditto.
-Mon Jan 5 16:59:13 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+Mon May 17 01:15:23 2004 why the lucky stiff <why@ruby-lang.org>
- * file.c (file_s_basename): removes any extention by ".*".
+ * lib/yaml.rb: removed fallback to pure Ruby parser.
-Sun Jan 4 19:36:22 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * lib/yaml/baseemitter.rb (indent_text): was forcing a mod value
+ of zero at times, which kept some blocks from getting indentation.
- * parse.y (yylex): needed to update lex_p (reading point).
+ * lib/yaml/baseemitter.rb (node_text): rewriting folded scalars.
-Sat Jan 3 19:14:14 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * ext/syck/syck.h: reports style of scalars now, be they plain, block
+ single-, or double-quoted.
- * class.c,object.c: duplicate defines mKernel and cFinxnum.
+ * ext/syck/syck.c: ditto.
-Fri Jan 2 20:38:59 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/syck/gram.c: ditto.
- * ext/curses/curses.c (NUM2CHAR): uses the first character for
- string arguments.
+ * ext/syck/node.c: ditto.
- * array.c (ary_fill): did not extend array for ranges.
+ * ext/syck/token.c: ditto.
- * array.c (beg_len): did not return end pos bigger than size.
+ * ext/syck/rubyext.c (yaml_org_handler): symbols loaded only
+ if scalar style is plain.
-Fri Jan 2 02:09:16 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * ext/syck/rubyext.c (yaml_org_handler): some empty strings were
+ loaded as symbols.
- * dir.c (dir_s_chdir): bug in nil check.
+ * test/yaml/test_yaml.rb (test_perl_regexp): updated test to
+ match new regexp serialization.
- * array.c (ary_fill): bug in nil check.
+Mon May 17 00:03:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
-Tue Dec 30 11:46:23 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/drb/drb.rb: Cosmetic documentation changes.
- * hash.c (env_path_tainted): checks directories in PATH
- environment variable are not world writable.
+Sun May 16 22:36:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
- * ruby.c (load_file): invoke specified interpreter if the #! line
- does not contain the word `ruby'.
+ * lib/test/unit.rb: Removed :nodoc: directive (it prevented effective
+ RDoc operation), and added file-level comment.
-Fri Dec 26 03:26:41 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Sun May 16 20:55:49 2004 Tanaka Akira <akr@m17n.org>
- * string.c (uscore_get): type information included in the error
- message.
+ * ext/dbm/dbm.c (fdbm_initialize): accept optional 3rd argument to
+ specify an open flag.
+ (Init_dbm): define open flags: DBM::READER, DBM::WRITER, DBM::WRCREAT
+ and DBM::NEWDB.
- * variable.c (f_untrace_var): does not free trace-data within
- trace procedure.
+Sun May 16 13:10:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
-Thu Dec 25 02:50:29 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/test/unit/**/*.rb: Removed :nodoc: directives (many were
+ generating warnings, many were on private methods).
- * version 1.1b3 released.
+Sat May 15 01:41:34 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * ruby.h: inlining some functions on gcc 2.x
+ * eval.c (eval): forgot to restore $SAFE value before evaluating
+ compiled node. [ruby-core:02872]
-Tue Dec 23 02:47:33 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Sat May 15 01:33:12 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * eval.c (rb_eval): public/private information kept in the current
- scope, to remove undesired state from the class/module.
+ * range.c (range_each_func): terminates loop if generating value
+ is same to @end. [ruby-talk:100269]
- * time.c (time_strftime): remove hidden limit of 100 bytes of
- result string, using malloc'ed buffer.
+Fri May 14 22:08:38 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * hash.c (hash_update): merges the contents of another hash,
- overriding existing keys.
+ * string.c (rb_str_new4): should not reuse frozen shared string if
+ the original is not an instance of String. [ruby-talk:100193]
- * regex.c (must_instr): totally re-written.
+Fri May 14 18:39:25 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * io.c (read_all): try to allocate proper sized buffer using
- fstat(2) for speedup.
+ * ext/tk/lib/tk/canvas.rb: improve coords support for canvas items.
+ Now, supports all of the followings.
+ TkcLine.new(c, 0, 0, 100, 100, :fill=>'red')
+ TkcLine.new(c, [0, 0, 100, 100], :fill=>'red')
+ TkcLine.new(c, [0, 0], [100, 100], :fill=>'red')
+ TkcLine.new(c, [[0, 0], [100, 100]], :fill=>'red')
+ TkcLine.new(c, :coords=>[0, 0, 100, 100], :fill=>'red')
+ TkcLine.new(c, :coords=>[[0, 0], [100, 100]], :fill=>'red')
-Sat Dec 20 00:27:28 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Fri May 14 12:11:43 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * regex.c (must_instr): need to skip 2 bytes for mbchars.
+ * util.c (ruby_strtod): strtod("0", &end); => end should point '\0'.
+ [ruby-dev:23498]
-Fri Dec 19 01:18:29 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu May 13 15:47:30 2004 akira yamada <akira@ruby-lang.org>
- * version 1.1b2 released.
+ * lib/net/telnet.rb (Net::Telnet::login): "options" can specify
+ regexps for login prompt and/or password prompt.
- * eval.c (check_errat): check and convert (if necessary) traceback
- information before assigning to the variable $@.
+Thu May 13 14:23:45 2004 WATANABE Hirofumi <eban@ruby-lang.org>
- * eval.c (f_raise): optional third argument to specify traceback
- information.
+ * hash.c (delete_if_i): use st_delete_safe() (via
+ rb_hash_delete()) instead of returning ST_DELETE.
+ backport from HEAD. [ruby-dev:23487]
- * io.c (f_open): prevent infinite recursive call.
+Thu May 13 13:01:30 2004 akira yamada <akira@ruby-lang.org>
-Thu Dec 18 19:33:47 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/uri/mailto.rb (URI::MailTo::to_s): should include fragment.
- * string.c (str_rindex): now accepts regexp as index.
+Thu May 13 11:04:08 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Dec 18 18:42:50 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * pack.c (pack_pack): always add with null for 'Z'.
- * ext/socket/extconf.rb: modified to detect win32 socket lib.
+ * pack.c (pack_unpack): terminated by null for 'Z'. [ruby-talk:98281]
-Thu Dec 18 00:25:03 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed May 12 19:59:43 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * re.c (reg_equal): checks for source and casefold and kcode matching.
+ * lib/mkmf.rb (have_type, check_sizeof): replace unusable characters.
+ [ruby-talk:99788]
- * marshal.c: became built-in module.
+Wed May 12 17:41:42 2004 Tanaka Akira <akr@m17n.org>
- * ext/marshal/marshal.c (r_object): displays struct name for
- non-compatible struct.
+ * lib/resolv.rb (Resolv::DNS::Config): make it configurable without
+ external file such as /etc/resolv.conf.
- * string.c (str_index_method): now searches character (fixnum) in
- the string.
+Wed May 12 14:37:27 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * string.c (str_include): redefine `include?'.
+ * ext/openssl/ossl_x509name.c: attribute value of DC (short name of
+ domainComponent) should be IA5String.
- * regex.c (re_match): start_nowidth saves current stack position
- to stop_nowidth.
+Wed May 12 13:20:19 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * regex.c (re_compile_pattern): add space to stop_nowidth to save
- runtime stack position.
+ * ext/tk/lib/tk/composite.rb: improve configure methods (based on
+ the proposal of [ruby-talk:99671]).
-Tue Dec 16 14:57:43 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed May 12 11:51:08 2004 Dave Thomas <dave@pragprog.com>
- * string.c (scan_once): wrong exception for regexp that match with
- null string (use substr instead of subseq).
+ * class.c (rb_obj_singleton_methods): fix rdoc
-Sat Dec 13 00:13:32 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Mon May 10 21:44:42 2004 Dave Thomas <dave@pragprog.com>
- * parse.y (expr): remove bare assocs from expr rule.
+ * lib/rdoc/generators/html_generator.rb: Change scheme for
+ looking up symbols in HTML generator.
- * rbconfig.rb: renamed from config.rb (it was too generic name).
+Mon May 10 16:45:21 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Fri Dec 12 00:50:25 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * eval.c (eval): warning during eval should not cause deadlock.
+ [ruby-talk:98651]
- * parse.y (expr): warns if BEGIN or END appear in the method
- bodies.
+ * eval.c (rb_eval): raise TypeError exception for superclass
+ mismatch. [ruby-list:39567]
- * string.c (str_match): calls y =~ x if y is neither String nor
- Regexp so that eregex.rb works.
+Mon May 10 12:11:37 2004 Dave Thomas <dave@pragprog.com>
- * eval.c (f_at_exit): to register end proc.
+ * lib/rdoc/generators/html_generator.rb: Hack to search parents
+ for unqualified constant names.
- * class.c (rb_define_module_function): define 'function' method
- for the Module, not private method.
+Mon May 10 12:11:37 2004 Dave Thomas <dave@pragprog.com>
- * class.c (rb_define_function): function to define `function' method.
+ * lib/rdoc/generators/html_generator.rb: Hack to search parents
+ for unqualified constant names.
- * eval.c (rb_eval): inherit visibility from superclass's method
- except when it is set to `function'
+Sun May 9 22:37:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
- * eval.c (rb_eval): new visibility status `function'.
+ * lib/net/ftp.rb: improved documentation
+ * lib/net/imap.rb: ditto
+ * lib/net/pop.rb: ditto
+ * lib/net/smtp.rb: ditto
+ * lib/net/telnet.rb: ditto
- * parse.y (yycompile): do not clear eval_tree. thus enable multipe
- command line script by optn `-e'.
+Fri May 7 21:50:21 2004 Dave Thomas <dave@pragprog.com>
- * eval.c (rb_eval): END execute just once.
+ * lib/rdoc/parsers/parse_rb.rb (RDoc::parse_include): Allow
+ multiple arguments to 'include'
- * parse.y (expr): BEGIN/END built in the syntax.
+Fri May 7 21:31:56 2004 Minero Aoki <aamine@loveruby.net>
-Thu Dec 11 13:14:35 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/fileutils.rb (fu_list): Array() breaks pathes including "\n".
+ [ruby-core:02843]
- * object.c (mod_le): Module (or Class) comparison.
+Fri May 7 11:25:53 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * eval.c (rb_remove_method): raises NameError if named method does
- not exist.
+ * util.c (ruby_strtod): "0.0000000000000000001" should be converted
+ to 1.0e-19 instead of 0.0. (leading zeros aren't significant digits)
+ [ruby-talk:99318] [ruby-dev:23465]
- * ext/curses/curses.c: remove CHECK macro for BSD curses.
-
-Thu Dec 11 12:44:01 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+Fri May 7 10:00:05 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/tkutil.c (get_eval_string_core): bug fix. [ruby-dev:23466]
+
+Thu May 6 22:13:17 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * ext/socket/socket.c (ippaddr): use NUMERICHOST if can not resolve
+ hostname.
+
+Thu May 6 14:22:29 2004 why the lucky stiff <why@ruby-lang.org>
+
+ * lib/yaml/rubytypes.rb (to_yaml): added instance variable handling
+ for Ranges, Strings, Structs, Regexps.
+
+ * lib/yaml/rubytypes.rb (to_yaml_fold): new method for setting a
+ String's flow style.
+
+ * lib/yaml.rb (YAML::object_maker): now uses Object.allocate.
+
+ * ext/syck/gram.c: fixed transfer methods on structs, broke it
+ last commit.
+
+Thu May 6 11:40:28 2004 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (string): accept NIL.
+
+ * lib/net/imap.rb (body_type_basic): allow body-fields omissions.
+
+Thu May 6 01:59:04 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/generators/html_generator.rb (Generators::HtmlMethod::params):
+ Don't include the &block parameter if we have explicit
+ yield parameters.
+
+Wed May 5 03:40:29 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/rinda/ring.rb: use recv instead of recvfrom.
+
+Tue May 4 23:52:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+
+ * lib/gserver.rb: documented
+
+Tue May 4 23:46:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+
+ * lib/xmlrpc/README.txt: introduced for documentation purposes
+
+Mon May 3 09:47:24 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_method_or_yield_parameters):
+ Fix parsing bug if yield called within 1 line block
+
+Sun May 2 01:04:38 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib, ext/tk: renewal Ruby/Tk
+
+Fri Apr 30 20:08:41 2004 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * time.c (SIZEOF_TIME_T): support SIZEOF_TIME_T == SIZEOF_INT.
+
+Tue Apr 27 13:12:42 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): too many line trace call. (ruby-bugs PR#1320)
+
+Tue Apr 27 08:41:28 2004 why the lucky stiff <why@ruby-lang.org>
+
+ * lib/yaml/rubytypes.rb: passing Range tests.
+
+ * ext/syck/syck.h: version 0.44.
+
+ * ext/syck/gram.c: transfers no longer open an indentation.
+ fixed transfers which precede blocks.
+
+ * ext/syck/token.c: ditto.
+
+ * ext/syck/syck.c: fixed segfault if an anchor has been released already.
+
+ * ext/syck/node.c (syck_free_members): organized order of free'd nodes.
+
+ * ext/syck/rubyext.c (syck_emitter_write_m): test for proper string with
+ StringValue.
+
+Mon Apr 26 23:56:54 2004 Daniel Kelley <news-1082945587@dkelley.gmp.san-jose.ca.us>
+
+ * README.EXT, README.EXT.ja: fixed wrong function signature.
+ [ruby-talk:98349]
+
+Mon Apr 26 21:40:09 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/code_objects.rb (RDoc::Context::add_alias): Only alias
+ to instance methods.
+
+Sat Apr 24 10:38:31 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/markup/simple_markup.rb (SM::SimpleMarkup::group_lines):
+ Fix bug where consecutive headings are merged.
+
+Fri Apr 23 23:26:13 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb: $hdrdir should not contain macros for backward
+ compatibilitiy. [bruby-dev:28]
+
+ * version.c (ruby_show_copyright): obtain copyright year from
+ RUBY_RELEASE_YEAR.
+
+ * win32/resource.rb: ditto.
+
+ * win32/resource.rb: default rubyw icon to ruby.ico, and let DLL also
+ include them.
+
+ * win32/resource.rb: include winver.h for older WindowsCE.
+
+Fri Apr 23 16:38:46 2004 Tanaka Akira <akr@m17n.org>
+
+ * lib/pathname.rb: sync taint/freeze flag between
+ a pathname object and its internal string object.
+
+Fri Apr 23 14:52:08 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (stmt, arg, aref_args): should not make sole splat into
+ array, in aref_args other than aref with op_asgn.
+
+Fri Apr 23 14:14:38 2004 Tanaka Akira <akr@m17n.org>
+
+ * lib/resolv.rb: don't use Regexp#source to embed regexps.
+ [ruby-dev:23432]
+
+Thu Apr 22 04:15:36 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (aref_args): should pass expanded list. [ruby-core:02793]
+
+Thu Apr 22 01:12:57 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (flo_to_s): tweak output string based to preserve
+ decimal point and to remove trailing zeros. [ruby-talk:97891]
+
+ * string.c (rb_str_index_m): use unsigned comparison for T_FIXNUM
+ search. [ruby-talk:97342]
+
+Wed Apr 21 22:57:27 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/rinda/rinda.rb, test/rinda/test_rinda.rb: check Hash tuple size.
+
+Wed Apr 21 20:05:00 2004 Tanaka Akira <akr@m17n.org>
+
+ * lib/open-uri.rb (URI::HTTP#proxy_open): set Host: field explicitly.
+ [ruby-list:39542]
+
+Mon Apr 19 18:11:15 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (rb_hash_equal): returns true if two hashes have same set
+ of key-value set. [ruby-talk:97559]
+
+ * hash.c (rb_hash_eql): returns true if two hashes are equal and
+ have same default values.
+
+Mon Apr 19 08:19:58 2004 Doug Kearns <djkea2@mugca.its.monash.edu.au>
+
+ * dln.c, io.c, lib/benchmark.rb, lib/cgi.rb, lib/csv.rb, lib/date.rb,
+ lib/ftools.rb, lib/getoptlong.rb, lib/logger.rb, lib/matrix.rb,
+ lib/monitor.rb, lib/set.rb, lib/thwait.rb, lib/timeout.rb,
+ lib/yaml.rb, lib/drb/drb.rb, lib/irb/workspace.rb, lib/net/ftp.rb,
+ lib/net/http.rb, lib/net/imap.rb, lib/net/telnet.rb,
+ lib/racc/parser.rb, lib/rinda/rinda.rb, lib/rinda/tuplespace.rb,
+ lib/shell/command-processor.rb, lib/soap/rpc/soaplet.rb,
+ lib/test/unit/testcase.rb, lib/test/unit/testsuite.rb: typo fix.
+
+Mon Apr 19 08:14:18 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser::find_body): Allow for
+ #ifdef HAVE_PROTOTYPES
+
+Fri Apr 16 22:33:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+
+ * ext/iconv/iconv.c: nearly finished RDoc comments.
+
+Fri Apr 16 17:04:07 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_equal): always returns true or false, never
+ returns nil. [ruby-dev:23404]
+
+Fri Apr 16 08:27:02 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb: skip linking when libraries to be preloaded not
+ compiled. [ruby-list:39561]
+
+Thu Apr 15 23:21:52 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (pst_success_p): new method Process::Status#success?.
+ [ruby-dev:23385]
+
+Thu Apr 15 17:12:13 2004 Tanaka Akira <akr@m17n.org>
+
+ * ext/gdbm/gdbm.c (Init_gdbm): define GDBM::READER, GDBM::WRITER,
+ GDBM::WRCREAT and GDBM::NEWDB.
+ (fgdbm_initialize): use specified read/write flag.
+
+Wed Apr 14 11:29:56 2004 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * numeric.c (flo_eq): workaround for bcc32's bug.
+ (ruby-bugs-ja:PR#594)
+
+Wed Apr 14 13:06:35 2004 Doug Kearns <djkea2@mugca.its.monash.edu.au>
+
+ * array.c, enum.c, eval.c, file.c, io.c, numeric.c, object.c, prec.c,
+ process.c, re.c, string.c: typos in RDoc comments. [ruby-core:02783]
+
+Wed Apr 14 11:06:38 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::scan): Changed
+ behavior of :enddoc: -- it now unconditionally terminates
+ processing of the current file.
+
+Wed Apr 14 11:03:22 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
+
+ * defines.h: include <net/socket.h> to get fd_set definition in BeOS.
+
+Tue Apr 13 23:06:30 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/rinda/rinda.rb: change pattern matching.
+ a === b -> a == b || a === b. [druby-ja:98]
+
+ * test/rinda/test_rinda.rb: ditto.
+
+Tue Apr 13 19:54:29 2004 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb: should not overwrite HTTP request header.
+ [ruby-list:39543]
+
+Tue Apr 13 01:30:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+
+ * ext/iconv/iconv.c: RDoc documentation (from RD; nearly finished).
+ * ext/iconv/charset_alias.rb: Prevent from RDoc'ing.
+
+Mon Apr 12 19:11:29 2004 Eric Hodel <drbrain@segment7.net>
+
+ * gc.c (rb_gc_copy_finalizer): typo. [ruby-core:02774]
+
+Mon Apr 12 18:52:32 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_x509name.c (ossl_x509name_init_i): should return
+ a value.
+
+Mon Apr 12 10:43:47 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
+
+ * dir.c (rb_glob2, rb_glob, rb_globi, push_globs, push_braces,
+ rb_push_glob): fix memory leak. (leaked when block was interrupted)
+
+Mon Apr 12 10:27:37 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
+
+ * bcc32/Makefile.sub: backport SIZEOF_TIME_T definition from 1.9.
+
+ * win32/Makefile.sub: ditto.
+
+ * wince/Makefile.sub: ditto.
+
+Sun Apr 11 19:12:35 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ruby.c (require_libraries): restore source file/line after
+ statically linked extensions initialized. [ruby-dev:23357]
+
+Sun Apr 11 10:47:04 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/code_objects.rb (RDoc::TopLevel::add_class_or_module): Toplevel
+ classes and modules are a special case too... (handle extending existing
+ classes with or without :enddoc:)
+
+Sat Apr 10 23:51:13 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/code_objects.rb (RDoc::Context::add_to): Implementation of :enddoc:
+ made one too many assumptions...
+
+Sat Apr 10 00:00:19 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/markup/simple_markup/inline.rb: Fix problem
+ with \_cat_<b>dog</b>
+
+Wed Apr 7 00:19:50 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/rinda/rinda.rb: fix hash tuple bug.
+
+ * lib/rinda/tuplespace.rb: ditto.
+
+ * test/rinda/test_rinda.rb
+
+Tue Apr 6 18:24:18 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_reopen): should use rb_io_check_io().
+
+Tue Apr 6 16:46:09 2004 Tanaka Akira <akr@m17n.org>
+
+ * configure.in: check the size of time_t.
+
+ * time.c (time_add): new function.
+ (time_plus): use time_add.
+ (time_minus): use time_add.
+
+Tue Apr 6 13:21:30 2004 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/socket/socket.c (make_hostent): must return value.
+
+Tue Apr 6 00:05:30 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/rinda/rinda.rb: add require 'drb/drb'
+
+Mon Apr 5 08:18:23 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/rdoc.rb: Remove leading ./ from file names so that cross
+ references work properly.
+
+Sun Apr 4 20:33:42 2004 Minero Aoki <aamine@loveruby.net>
+
+ * eval.c (Init_load): make $LOADED_FEATURES built-in.
+ [ruby-dev:23299]
+
+ * ruby.c (ruby_prog_init): make $PROGRAM_NAME built-in.
+
+ * lib/English.rb: remove $LOADED_FEATURES and $PROGRAM_NAME.
+
+Sun Apr 4 14:01:20 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/options.rb (Options::parse): Allow multiple -x options to RDoc.
+ Fix bug where files weren't being excluded properly
+
+Sat Apr 3 17:11:05 2004 why the lucky stiff <why@ruby-lang.org>
+
+ * ext/syck/syck.h: version 0.43.
+
+ * ext/syck/lib/gram.c: allow root-level inline collections.
+ [ruby-talk:94922]
+
+ * lib/yaml/rubytypes.rb (Symbol#to_yaml): emit symbols as implicits.
+ [ruby-talk:94930]
+
+ * ext/syck/bytecode.c: turn off default implicit typing.
+
+ * ext/syck/implicit.c: detect base60 integers.
+
+ * ext/syck/rubyext.c: handle base60, as well as hex and octal
+ with commas. implicit typing of ruby symbols.
+
+Fri Apr 2 17:27:17 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (top_include): include in the wrapped load is done for
+ the wrapper, not for a singleton class for wrapped main.
+ [ruby-dev:23305]
+
+Fri Apr 2 15:13:44 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big_eq): use temporary double variable to save the
+ result (internal float register may be bigger than 64 bits, for
+ example, 80 bits on x86). [ruby-dev:23311]
+
+Fri Apr 2 14:35:26 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (block_pass): should generate unique identifier of the
+ pushing block. [ruby-talk:96363]
+
+Fri Apr 2 07:31:38 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c (make_hostent): fix memory leak, based on
+ the patch from HORIKAWA Hisashi <vzw00011@nifty.ne.jp>.
+
+Thu Apr 1 22:55:33 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/parsers/parse_rb.rb: Allow rdoc comments in
+ =begin rdoc/=end
+
+ * lib/rdoc/parsers/parse_rb.rb: Fix problem with comment in
+ top-level method being taken as file comment.
+
+Thu Apr 1 22:55:04 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/ri/ri_options.rb: Fix undefined variable warning.
+
+Thu Apr 1 19:58:37 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
+
+ * lib/soap/mapping/{factory.rb,registry.rb}: fixed illegal mapped URI
+ object with soap/marshal.
+ added URIFactory class for URI mapping. BasetypeFactory checks
+ instance_variables when original mapping is not allowed (ivar must
+ be empty). Instance of URI have instance_variables but it must be
+ llowed whenever original mapping is allowed or not.
+
+ * lib/xsd/datatypes.rb: check the smallest positive non-zero
+ single-precision float exactly instead of packing with "f".
+ [ruby-talk:88822]
+
+ * lib/soap/mapping/rubytypeFactory.rb: should not dump singleton class.
+ [ruby-dev:22588]
+ c = class << Object.new; class C; self; end; end; SOAPMarshal.dump(c)
+
+Wed Mar 31 19:06:23 2004 Tanaka Akira <akr@m17n.org>
+
+ * time.c (year_leap_p): new function.
+ (timegm_noleapsecond): ditto.
+ (search_time_t): use timegm_noleapsecond instead of
+ mktime for first guess.
+
+Wed Mar 31 12:04:04 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/delegate.rb (DelegateClass): define internal methods of the
+ result class, but not metaclass of the caller. [ruby-talk:96156]
+
+ * intern.h: provide proper prototypes. [ruby-core:02724]
+
+ * ruby.h: missing.h is now prerequisite to intern.h.
+
+Tue Mar 30 20:25:34 2004 Tanaka Akira <akr@m17n.org>
+
+ * time.c (search_time_t): limit guess range by mktime if it is
+ available. [ruby-dev:23274]
+
+Sun Mar 28 14:16:59 2004 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/pop.rb (auth): failed when account/password include "%".
+ [ruby-talk:95933]
+
+Sat Mar 27 21:40:41 2004 Tanaka Akira <akr@m17n.org>
+
+ * lib/open-uri.rb: permit extra semicolon in content-type field.
+
+Sat Mar 27 10:40:48 2004 Tanaka Akira <akr@m17n.org>
+
+ * (lib/pp.rb, lib/prettyprint.rb): define seplist in PP::PPMethods
+ instead of PrettyPrint.
+
+Thu Mar 25 23:28:52 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_overflow_p): backport 1.9 usec overflow function.
+ (ruby-bugs PR#1307)
+
+Thu Mar 25 23:15:24 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/ri/ri_options.rb (RI::Options::show_version):
+ Add --version option
+
+Thu Mar 25 04:16:18 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/ri/ri_options.rb (RI::Options): Add the --list-names option,
+ which dumps our all known names
+
+Thu Mar 25 03:57:47 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/ri/ri_util.rb (NameDescriptor::initialize): No longer
+ allow nested classes to be designated using "."--you must
+ now use "::"
+
+Thu Mar 25 02:00:18 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/generators/template/html/one_page_html.rb (Page):
+ Fix to work with C modules.
+
+Wed Mar 24 21:17:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+
+ * lib/uri.rb: Documented (thanks Dmitry V. Sabanin).
+ * lib/uri/common.rb: Ditto.
+ * lib/uri/ftp.rb: Ditto.
+ * lib/uri/generic.rb: Ditto.
+ * lib/uri/http.rb: Ditto.
+ * lib/uri/https.rb: Ditto.
+ * lib/uri/ldap.rb: Ditto.
+ * lib/uri/mailto.rb: Ditto.
+ (All backported from 1.9)
+
+Wed Mar 24 18:48:26 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb ($ruby, $topdir, $hdrdir): should not be affected by
+ DESTDIR after installed.
+
+ * lib/mkmf.rb (RUBY): / is not recognized as path separator on
+ nmake/bmake. [ruby-list:39388]
+
+ * lib/mkmf.rb (init_mkmf): $INCFLAGS also should be lazy-evaluated.
+
+Wed Mar 24 12:32:56 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser::handle_class_module):
+ Don't document methods if we don't know for sure the
+ class or module.
+
+ * lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_class):
+ Don't store documentation for singleton classes if we
+ don't know the real class.
+
+Wed Mar 24 11:11:26 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/generators/html_generator.rb (Generators::HTMLGenerator::load_html_template):
+ Allow non-RDoc templates by putting a slash in the template name
+
+Mon Mar 22 16:19:57 2004 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ruby.1: add -width option to .Bl for old groff.
+
+Sun Mar 21 21:11:16 2004 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/shell/*: bug fix for Shell#system(command_line_string).
+
+Sat Mar 20 20:57:10 2004 David Black <dblack@wobblini.net>
+
+ * lib/scanf.rb: Backported 1.9 branch
+ modifications/corrections to 1.8 branch
+
+Sat Mar 20 23:51:03 2004 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * eval.c (rb_require_safe): preserve old ruby_errinfo.
+ [ruby-talk:95409]
+
+ * eval.c (rb_f_raise): should not clear backtrace information if
+ exception object already have one.
+
+Sat Mar 20 15:25:36 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/generators/template/html/html.rb (RDoc::Page): Force
+ page background to white.
+
+Sat Mar 20 09:52:33 2004 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb, lib/date/format.rb: _parse() now accepts fractional
+ part of second minute that follows a comma or a full stop.
+
+Fri Mar 19 01:55:57 2004 Mauricio Fernandez <batsman.geo@yahoo.com>
+
+ * io.c (rb_io_sync): need not to check writable. [ruby-core:02674]
+
+Thu Mar 18 21:44:38 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/drb/drb.rb: backport drb.rb 1.16.
+
+Thu Mar 18 16:22:38 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (proc_eq): avoid false positive by using scope and
+ dyna_vars. no longer use frame.uniq.
+
+Wed Mar 17 14:44:43 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
+
+ * dir.c (range): fix possible "\0" overrun. (in case of "\0-")
+
+Mon Mar 15 07:39:13 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_yield_0): should not re-submit TAG_BREAK if this
+ yield is not break destination. [ruby-dev:23197]
+
+Sat Mar 13 14:28:16 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * test/drb/test_drbssl.rb: rescue LoadError. (Barkport from main
+ trunk)
+
+ * test/drb/test_drbunix.rb: ditto.
+
+Wed Mar 10 22:28:09 2004 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (remove_dir): should handle symlink correctly.
+ This patch is contributed by Christian Loew. [ruby-talk:94635]
+ (Backport from main trunk)
+
+Wed Mar 10 16:28:42 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (return_jump): set return value to the return
+ destination. separated from localjump_destination().
+
+ * eval.c (break_jump): break innermost loop (or thread or proc).
+
+ * eval.c (rb_yield_0): set exit_value for block break.
+
+Wed Mar 10 15:58:43 2004 Ryan Davis <ryand@zenspider.com>
+
+ * eval.c (eval): Only print backtrace if generating the backtrace
+ doesn't generate an exception. [ruby-core:02621]
+
+Tue Mar 9 13:04:26 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_ungetc): raise IOError instead of calling
+ rb_sys_fail(). [ruby-talk:23181]
+
+Mon Mar 8 19:32:28 2004 akira yamada <akira@ruby-lang.org>
+
+ * lib/uri/common.rb (URI::REGEXP::PATTERN::HOSTPORT): (?:#{PORT})
+ -> (?::#{PORT}). [ruby-dev:23170]
+
+Mon Mar 8 15:31:41 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
+
+ * dir.c (range): treat incomplete '[' as ordinary character (like
+ has_magic does).
+
+ * dir.c (range): Cancel above change. More discussion is needed.
+
+Sun Mar 7 22:37:46 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * test/drb/ut_drb.rb: use 'druby://localhost:0'. [ruby-dev:23078]
+
+ * test/drb/ut_eval.rb: ditto.
+
+ * test/drb/ut_large.rb: ditto.
+
+ * test/drb/ut_safe1.rb: ditto.
+
+ * test/drb/ut_drb_drbssl.rb: use 'drbssl://localhost:0'.
+
+Sun Mar 7 16:22:26 2004 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * Makefile.in (lex.c): use $? instead of $<.
+
+Fri Mar 5 00:54:14 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/test/unit.rb: MOve RDoc documentation so that you can
+ now say 'ri Test::Unit'
+
+Tue Mar 2 12:32:59 2004 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub, wince/Makefile.sub (config.h): shouldn't check
+ defined? NORETURN. [ruby-dev:23100]
+
+Mon Mar 1 12:24:10 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_alias):
+ Allow aliases to have parentheses
+
+Sun Feb 29 23:14:53 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_class):
+ Handle :nodoc: on singleton classes.
+
+Sat Feb 28 10:58:49 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * MANIFEST: add test_erb.rb
+
+ * lib/erb.rb, test/erb/test_erb.rb: don't forget filename,
+ if both filename and safe_level given. [ruby-dev:23050]
+
+Fri Feb 27 01:00:09 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/drb/drb.rb, test/drb/drbtest.rb: require drb/eq.rb by default
+
+Wed Feb 25 21:16:25 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * instruby.rb (with_destdir): should return the given argument if no
+ DESTDIR is given.
+
+ * instruby.rb: use path name expansion of cmd.exe.
+
+Wed Feb 25 09:35:22 2004 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * error.c (NameError::Message): new class for lazy evaluation of
+ message to ensure replaced before marshalling. merge from HEAD.
+ (ruby-bugs-ja:PR#588)
+
+ * eval.c (rb_method_missing): use NameError::Message. merge from
+ HEAD. (ruby-bugs-ja:PR#588)
+
+Tue Feb 24 18:59:37 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
+
+ * dir.c (glob_helper): '**/' should not match leading period
+ unless File::FNM_DOTMATCH is set. (like '*/') [ruby-dev:23014]
+
+Tue Feb 24 13:22:21 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/rdoc.rb (RDoc::RDoc::normalized_file_list): Attempt to get better
+ heuristics on which files to include and exclude. Now only include
+ non-standard files if they are explicitly named in ARGV.
+
+Tue Feb 24 07:23:30 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/generators/html_generator.rb: Deal with :stopdoc: when
+ choosing a default main page to display (ie. don't select a page
+ if we don't have documentation for it).
+
+Tue Feb 24 06:40:14 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/parsers/parse_rb.rb (RubyLex::identify_identifier): Handle
+ class variables in code listings
+
+Tue Feb 24 06:40:14 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/parsers/parse_rb.rb (RubyLex::identify_identifier): Handle
+ class variables in code listings
+
+Tue Feb 24 06:32:27 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser::do_aliases): Handle
+ aliases in C files.
+
+Tue Feb 24 06:16:22 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/rdoc.rb (RDoc::RDoc::document): Now create op dir _before_
+ parsing files.
+
+Tue Feb 24 06:08:47 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_constant):
+ Start collecting text of constant values earlier: was missing
+ values in output if there was no space after '='
+
+Tue Feb 24 06:08:25 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/generators/html_generator.rb: Escape contant values.
+
+Tue Feb 24 03:45:06 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_config.c (ossl_config_each): add new method
+ OpenSSL::Config#each. it iterates with section name, field name
+ and value.
+
+ * ext/openssl/ossl_config.c (Init_ossl_config): include Enumerable.
+
+Mon Feb 23 09:16:35 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * instruby.rb (DOSISH): embedded path in batch files should not be
+ prefixed by DESTDIR. [ruby-core:02186]
+
+Sun Feb 22 09:54:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+
+ * re.c: corrected documentation format (again)
+
+Sun Feb 22 09:43:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+
+ * re.c: corrected documentation format (rb_reg_initialize_m)
+
+Sat Feb 21 22:36:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+
+ * ext/zlib/zlib.c: documented, but needs more effort.
+
+Sat Feb 21 11:12:15 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * pack.c: sun4 cc patch
+ * missing/os2.c, missing/x68.c: typo fix. pointed out by greentea.
-Wed Dec 10 15:21:36 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Fri Feb 20 18:59:47 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * ext/marshal/marshal.c (marshal_load): can supply evolution proc
- object as optional second argument.
+ * lib/irb/init.rb (IRB::IRB.parse_opts): add -I option to
+ irb. [ruby-dev:39243]
- * re.c (reg_source): get source string of the regular expression.
+Thu Feb 19 23:24:16 2004 Dave Thomas <dave@pragprog.com>
-Tue Dec 9 10:05:17 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/rdoc/generators/html_generator.rb (Generators::HtmlClass::build_attribute_list):
+ Support visibility modifiers for attributes
- * version 1.1b1 released.
+Thu Feb 19 23:24:16 2004 Dave Thomas <dave@pragprog.com>
- * parse.y (tokadd): token buffer overrun.
+ * lib/rdoc/generators/html_generator.rb (Generators::HtmlClass::build_attribute_list):
+ Support visibility modifiers for attributes
- * ruby.c (ruby_prog_init): forgot to protect rb_argv0 from gc.
+Thu Feb 19 22:39:04 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
- * eval.c (ruby_run): call finalizers at process termination.
+ * test/rinda/test_rinda.rb: DRb.start_service only once in testsuites.
+ DRb.start_service could handle this.
- * gc.c (gc_call_finalizer_at_exit): call free proc for every Data
- Wrapper, and finalizer for specified objects at termination.
+Thu Feb 19 22:19:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
- * version.c (show_version): version format changed.
+ * lib/ostruct.rb: documented
- * regex.c (re_match): wrong match with non-greedy if they appear
- more than once in regular expressions.
+Thu Feb 19 21:28:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
- * sample/ruby-mode.el (ruby-expr-beg): forgot to handle modifiers.
+ * ext/strscan/strscan.c: improved documentation
-Mon Dec 8 19:00:15 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu Feb 19 03:10:52 2004 Minero Aoki <aamine@loveruby.net>
- * io.c (io_puts): just put a newline if no argument given.
+ * ext/strscan/strscan.c: synchronized with main trunk (rev 1.11).
- * ext/tcltklib/tcltklib.c (lib_mainloop): thread-aware tk handle
- when $tk_thread_safe is set.
+Thu Feb 19 02:30:34 2004 Minero Aoki <aamine@loveruby.net>
- * ext/tcltklib/tcltklib.c (lib_mainloop): use Tcl_DoOneEvent()
- instead of Tk_MainLoop().
+ * ext/strscan/strscan.c: documentation checked.
-Mon Dec 6 07:11:16 1997 MAEDA shugo <shugo@po.aianet.ne.jp>
+Thu Feb 19 00:11:05 2004 Dave Thomas <dave@pragprog.com>
- * io.c (io_puts): core dumped without any argument.
+ * lib/rdoc/markup/simple_markup/preprocess.rb (SM::PreProcess::handle):
+ Strip extraneous space from filenames in :include:
-Fri Dec 5 18:17:17 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Feb 18 22:52:00 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
- * eval.c (mod_remove_method): remove (not undef) a method from the
- class/module.
+ * lib/drb/unix.rb: remove O_NONBLOCK, thanks \ay
- * variable.c (obj_remove_instance_variable): method to remove
- instance variables.
+Wed Feb 18 22:47:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
-Thu Dec 4 13:50:29 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/strscan/strscan.c: documented
- * version 1.1b0 released.
+Wed Feb 18 22:03:11 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
- * string.c (str_aref): called str_index for regexp.
+ * test/*: should not depend on $KCODE.
-Mon Dec 1 15:24:41 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Feb 18 17:18:01 2004 WATANABE Hirofumi <eban@ruby-lang.org>
- * compar.c (cmp_between): wrong comparison made.
+ * ext/win32ole/win32ole.c: need to include <olectl.h> on Cygwin.
-Wed Nov 26 18:18:05 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Feb 18 10:40:38 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * lib/mkmf.rb: generate Makefile for extention modules out of ruby
- source tree. use like `ruby -r mkmf extconf.rb'.
+ * sprintf.c (rb_f_sprintf): do not prepend dots for negative
+ numbers if FZERO is specified. [ruby-dev:39218]
- * numeric.c (fix2str): enlarge buffer to prevent overflow on some
- machines.
+Tue Feb 17 23:40:34 2004 Guy Decoux <ts@moulon.inra.fr>
- * parse.y (here_document): wrong line number generated after here-doc.
+ * sprintf.c (rb_f_sprintf): preserve original val for
+ format_integer. [ruby-talk:92975]
-Fri Nov 21 13:17:12 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Feb 17 23:28:45 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
- * parse.y (yylex): skip multibyte characters in comments.
+ * test/ruby/marshaltestlib.rb: common marshal testcase added.
-Wed Nov 19 17:19:20 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * test/ruby/test_marshal.rb: use above testsuite.
- * object.c (nil_to_a): nil.to_a => [].
+ * test/soap/marshal/test_marshal.rb: ditto.
- * parse.y (call_args): wrong node generation.
+ * test/soap/marshal/cmarshal.rb: removed (not used).
-Tue Nov 18 10:13:08 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Feb 17 10:51:23 2004 NAKAMURA Usaku <usa@ruby-lang.org>
- * array.c (Init_Array): Array#=== works as Array#include?
+ * ext/syck/rubyext.c (syck_emitter_end_object): takes only one arg.
- * regex.c (re_compile_pattern): insert initialize code for jump_n,
- before entering loops.
+Tue Feb 17 01:35:28 2004 Tanaka Akira <akr@m17n.org>
- * re.c (reg_search): does not save registers unless $& etc appear
- in the script.
+ * eval.c (rb_eval): care that another thread replace NODE_DREGX_ONCE
+ to NODE_LIT. [ruby-dev:22920]
-Mon Nov 17 13:01:43 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Feb 17 01:24:35 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * eval.c (is_defined): add defined? check for receivers and
- arguments for calls.
+ * bcc32/Makefile.sub, win32/Makefile.sub (config.h): define
+ STACK_GROW_DIRECTION. [ruby-dev:22910]
- * re.c (reg_search): cache last match object.
+ * bcc32/Makefile.sub (config.h): add newer checks.
- * re.c (match_aref): $[0] etc. are available.
+ * wince/Makefile.sub (config.h): define NEED_IO_SEEK_BETWEEN_RW.
-Sat Nov 15 00:11:36 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+Tue Feb 17 00:38:10 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
- * io.c (io_s_popen): "rb" detection
+ * lib/rinda/tuplespace.rb: TupleSpace#initialize, stop doubling timeout
-Fri Nov 14 18:28:40 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Feb 17 00:18:03 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
- * string.c (scan_once): returns whole match if the pattern does
- not contain any parentheses.
+ * test/rinda/test_rinda.rb: import test_rinda.rb
-Thu Nov 13 14:39:06 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Feb 17 00:14:30 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * string.c (str_sub): returns copy of the receiver string, even if
- any substitution occurred.
+ * bcc32/Makefile.sub: avoid warning "Redefinition of macro
+ 'HAVE_GETLOGIN'".
- * regex.c (re_compile_pattern): no-width match by (?=..), (?!..).
+ * vms/config.h_in: ditto.
-Wed Nov 12 13:44:47 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Mon Feb 16 23:28:14 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
- * time.c: remove coerce from Time class.
+ * lib/csv.rb: document reduction. [ruby-core:02429]
- * regex.c (re_match): non-greedy match by ??, *? +?, {n,m}?.
+Mon Feb 16 22:08:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
-Mon Nov 10 11:24:51 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/generator.rb: corrected doc format
+ * lib/rinda/rinda.rb: added documentation (from Hugh Sasse)
+ * lib/rinda/tuplespace.rb: ditto
- * regex.c (re_compile_pattern): non-resitering parens (?:..).
+Mon Feb 16 20:41:32 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * regex.c (re_compile_pattern): new meta character \< (wordbeg)
- and \> (wordend).
+ * bcc32/Makefile.sub: show more warnings. (refering to mingw)
- * regex.c (re_compile_pattern): embedded comment for regular
- expression by (?#...).
+ * bcc32/setup.mak: ditto.
-Fri Nov 7 16:58:24 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Mon Feb 16 13:39:44 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * regex.c (re_compile_pattern): perl5 regxp \A and \Z available.
+ * dir.c (rb_glob, rb_globi): add const.
- * regex.c (re_compile_pattern): can expand compile stack dynamically.
+ * ruby.h: ditto.
- * regex.c (PUSH_FAILURE_POINT): wrong compare condition.
+Mon Feb 16 02:16:33 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
-Wed Nov 2 16:00:00 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * bcc32/Makefile.sub: should warn suspicious pointer conversion.
- * string.c (str_sub_s): "".sub! "", "" => "\000"
+ * bcc32/setup.mak: ditto.
-Fri Oct 31 15:52:10 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Sun Feb 15 19:06:42 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
- * parse.y (assoc): keyword assoc like {fg->"black"}.
+ * lib/rinda/tuplespace.rb: TupleSpace#read(tpl, 0), raise
+ RequestExpiredError if not found.
-Thu Oct 30 17:33:38 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Sun Feb 15 15:56:46 2004 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * io.c (io_println): print with newline, which is not affected by
- the values of $/ and $\.
+ * ext/win32ole/win32ole.c: add IDispatch wrapper in val2variant.
+ Thanks, arton.
-Thu Oct 30 16:54:01 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+Sun Feb 15 01:46:05 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * string.c (str_chop_bang): "".chop caused SEGV.
+ * lib/mkmf.rb: absolute path of ruby is assigned to $(RUBY).
+ [ruby-dev:22870]
- * string.c (str_chomp_bang): method to chop out last newline.
+Sat Feb 14 11:29:41 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-Mon Oct 27 13:49:13 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * sample/drb/*: import lib/drb/sample
- * ext/extmk.rb.in: library may have pathname contains `.'
+Sat Feb 14 11:08:23 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
- * eval.c (rb_rescue): should not protect SystemError.
+ * lib/drb/drb.rb: add pretty_print, thanks gotoken.
-Fri Oct 24 10:58:53 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Fri Feb 13 12:35:08 2004 Minero Aoki <aamine@loveruby.net>
- * io.c (io_s_with_open_stream): ensures to close stream.
+ * test/fileutils/test_fileutils.rb: File.link may raise EINVAL and
+ EACCES on Windows.
-Thu Oct 23 11:17:44 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu Feb 12 21:45:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
- * io.c (io_errset): value of $stderr can be changed (to any IO
- object).
+ * lib/ftools.rb: documented
- * io.c (next_argv): $< can be anything that responds to `write'.
+Thu Feb 12 21:25:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
- * file.c (file_s_with_open_file): ensures to close file.
+ * lib/base64.rb: backported from HEAD (modularised and documented)
- * error.c (exception): create error under the current class/module.
+Thu Feb 12 20:31:48 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * range.c (range_eqq): fixnum check for last needed too.
+ * lib/mkmf.rb (create_tmpsrc): cpp32 of Borland C++ ignores #error
+ directives in DOS line-ending files at all.
-Wed Oct 22 12:52:30 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu Feb 12 02:23:56 2004 Tanaka Akira <akr@m17n.org>
- * ext/socket/socket.c: Socket::Constants added.
+ * lib/pathname.rb: use assert_raise instead of assert_raises.
- * file.c: File::Constants added for inclusion.
+ * lib/pp.rb: ditto.
- * array.c (ary_join): call ary_join() recursively for the 1st
- array element.
+ * lib/time.rb: ditto.
-Mon Oct 20 12:18:29 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * lib/tsort.rb: ditto.
+ use TSortHash and TSortArray instead of Hash and Array in test.
- * ruby.c (load_file): wrong condition for #! check with -x.
+Wed Feb 11 20:01:12 2004 akira yamada <akira@ruby-lang.org>
- * file.c (file_s_dirname): did return "" for "/a".
+ * test/ruby/test_file.rb (TestFile::test_fnmatch): added tests for
+ File.fnmatch. [ruby-dev:22815][ruby-dev:22819]
-Fri Oct 17 14:29:09 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * test/ruby/test_proc.rb (TestProc::test_eq): added a
+ test. [ruby-dev:22599]
- * ruby.c: now works on alpha-linux.
+ * test/ruby/test_proc.rb (TestProc::test_eq): added tests for
+ Proc#==. [ruby-dev:22592], [ruby-dev:22601]
- * bignum.c (bigadd): some undefined side effect order assumed.
+Tue Feb 10 16:43:56 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Oct 15 17:49:24 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * eval.c (umethod_bind): purge unused check. [ruby-dev:22850]
- * intern.h: function prototypes added.
+Mon Feb 9 17:16:00 2004 WATANABE Hirofumi <eban@ruby-lang.org>
-Mon Oct 13 16:54:18 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/rdoc/parsers/parse_c.rb: escape '{' and '}' to avoid warnings.
- * class.c (rb_define_class_id): call superclass's `inherited'
- method when making subclasses.
+Mon Feb 9 13:00:55 2004 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
- * parse.y (nextc): clear lex_lastline at the end of file.
+ * dir.c (fnmatch): File.fnmatch('*?', 'a') should return true.
+ [ruby-dev:22815]
- * object.c (Init_Object): need to undef Class#append_features.
+ * dir.c (fnmatch): File.fnmatch('\[1\]' , '[1]') should return true.
+ [ruby-dev:22819]
- * eval.c (rb_eval): no warning on extending classes or modules.
+Sun Feb 8 16:46:13 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Oct 9 11:17:50 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/pp.rb (PP::PPMethods::object_address_group): suppress negative
+ sign for higher heap areas.
- * eval.c (error_print): the exception name follows after the error
+Fri Feb 6 22:48:16 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/generators/html_generator.rb (gen_url): Support
+ https in RDoc hyperlinks
+
+Fri Feb 6 22:41:22 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
+
+ * lib/pp.rb (PPInspectTest#test_to_s_with_iv): rollback the previous
+ commit. [ruby-dev:22813]
+
+Fri Feb 6 22:22:50 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
+
+ * lib/pp.rb (PPInspectTest#test_to_s_with_iv): remove instance
+ variable which is defined in the test.
+
+Fri Feb 6 00:48:37 2004 Tanaka Akira <akr@m17n.org>
+
+ * lib/prettyprint.rb (PrettyPrint#first?): obsoleted.
+
+Thu Feb 5 23:56:55 2004 Tanaka Akira <akr@m17n.org>
+
+ * lib/prettyprint.rb (PrettyPrint#seplist): added.
+
+ * lib/pp.rb (PPMethods#pp_object): use seplist.
+ (PPMethods#pp_hash): ditto.
+ (Array#pretty_print): ditto.
+ (Struct#pretty_print): ditto.
+ (MatchData#pretty_print): ditto.
+
+ * lib/set.rb (Set#pretty_print): use seplist.
+
+Wed Feb 4 02:12:06 2004 Tanaka Akira <akr@m17n.org>
+
+ * file.c (test_l): fix wrong method name in document.
+ (test_S): ditto.
+ (test_b): ditto.
+ (test_c): ditto.
+ (test_suid): ditto.
+ (test_sgid): ditto.
+ (test_sticky): ditto.
+
+Tue Feb 3 08:04:57 2004 Tanaka Akira <akr@m17n.org>
+
+ * lib/pp.rb (Struct#pretty_print_cycle): follow 1.8 style.
+
+Mon Feb 2 19:33:49 2004 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: backport from 1.9 for Interix.
+
+ * dln.c (dln_load): ditto.
+
+Mon Feb 2 13:31:51 2004 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/net/http.rb (canonical_each): fix merge miss.
+
+Mon Feb 2 01:54:00 2004 Tanaka Akira <akr@m17n.org>
+
+ * lib/pp.rb (Struct#pretty_print): make it 1.8 style.
+ (Numeric#pretty_print, FalseClass#pretty_print)
+ (TrueClass#pretty_print, Module#pretty_print): fix pp for objects
+ with instance variables. [ruby-talk:91157]
+
+ * lib/open-uri.rb (URI::Generic#find_proxy): return nil on loopback
+ address.
+
+ * lib/resolv-replace.rb (BasicSocket#send): don't replace because
+ it has no hostname argument.
+ (IPSocket.getaddress): raise SocketError instead of
+ Resolv::ResolvError for errors.
+ (TCPSocket#initialize, UDPSocket#bind, UDPSocket#connect)
+ (SOCKSSocket#initialize): use IPSocket.getaddress instead of
+ Resolv.getaddress.
+ (UDPSocket#send): recognize 3 arguments form. try all addresses on
+ 4 arguments form.
+
+Sun Feb 1 18:17:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+
+ * lib/net/http.rb: merged coding style changes from HEAD.
+
+Sun Feb 1 16:15:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
+
+ * lib/test/unit.rb: rearranged documentation for RDoc's sake.
+ * lib/matrix.rb: improved documentation.
+ * lib/net/http.rb: slight documentation formatting improvement.
+
+Sun Feb 1 05:30:06 2004 Tanaka Akira <akr@m17n.org>
+
+ * lib/open-uri.rb (URI::Generic#find_proxy): warn HTTP_PROXY.
+ raise an errror on non-http proxy URI.
+ (OpenURI::Buffer#<<): make a tempfile binmode. [ruby-talk:90793]
+
+Sat Jan 31 09:20:32 2004 NAKAMURA, Hiroshi <nakahiro@sairon.co.jp>
+
+ * sample/openssl/gen_csr.rb: wrong usage string.
+
+Sat Jan 31 01:00:32 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
+
+ * lib/soap/wsdlDriver.rb, lib/wsdl/soap/operation.rb: add support of
+ "parts" attribute of soap:body element in WSDL.
+
+ * lib/wsdl/xmlSchema/schema.rb: friendly warning message for
+ simpleType element which is not supported for now.
+
+ * lib/soap/mapping/factory.rb: deleted unused methods.
+
+ * lib/soap/mapping/rubytypeFactory.rb: do no ignore case while xsi:type
+ string <-> Ruby class name matching.
+
+ * test/wsdl/soap/{soapbodyparts.wsdl,test_soapbodyparts.wsdl}: new
+ files.
+
+Thu Jan 29 23:56:00 2004 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * util.c (mblen): fix overrun. [ruby-dev:22672]
+
+Thu Jan 29 22:41:53 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/generators/html_generator.rb: Allow 'link:' in Tidylinks.
+ THis means you can write "see f1[link:files/f1_rb.html]".
+
+Thu Jan 29 15:33:23 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_x509hame.c (ossl_x509name_initialize): change
+ second argument. it expected to be a Hash not an Integer.
+
+ * ext/openssl/ossl_x509name.c (ossl_x509name_add_entry): add new
+ function for OpenSSL::X509::Name#add_entry.
+
+ * ext/openssl/ossl_x509name.c (ossl_x509name_to_a): append ASN.1
+ tag number to each element of return value.
+
+ * ext/openssl/ossl_x509name.c (Init_ossl_x509name): add constants
+ OpenSSL::X509::Name::DEFAULT_OBJECT_TYPE and OBJECT_TYPE_TEMPLATE.
+
+ * ext/openssl/lib/openssl/x509.rb (OpenSSL::X509::Name#initialize):
+ second argument takes OBJECT_TYPE_TEMPLATE by default.
+
+ * sample/openssl/gen_csr.rb: use OpenSSL::X509::Name.parse.
+
+Wed Jan 28 04:29:41 2004 Eric Schwartz <emschwar@fc.hp.com>
+
+ * lib/cgi/session.rb: use LOCK_SH to read, and a few other
+ improvements. [ruby-core:02328]
+
+Tue Jan 27 11:09:29 2004 FUKUMOTO Atsushi <fukumoto@nospam.imasy.or.jp>
+
+ * ext/socket/socket.c (s_recvfrom): sending length should be an
+ invariant while retrying on EAGAIN. [ruby-talk:89962]
+
+Tue Jan 27 10:35:18 2004 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/win32ole/win32ole.c (set_argv): fix condition.
+
+Tue Jan 27 02:26:31 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/httputils.rb (WEBrick:HTTPUtils::parse_header):
+ refine regex for header-name.
+
+Tue Jan 27 00:30:11 2004 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub: rollback.
+
+Mon Jan 26 22:53:04 2004 Dave Thomas <dave@pragprog.com>
+
+ * io.c: Remove documentation references to $defout.
+
+Mon Jan 26 15:11:47 2004 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * sample/exyacc.rb: escape '}' to avoid warning.
+
+Mon Jan 26 14:41:46 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/delegate.rb (Delegator::initialize): preserve
+ singleton_method_added method [ruby-dev:22685]
+
+ * lib/delegate.rb (Delegator::initialize): use Kernel::raise
+ instead of mere raise. [ruby-dev:22681]
+
+Mon Jan 26 12:47:17 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c: define CONST84 when TCL_MAJOR_VERSION == 7
+
+Mon Jan 26 11:35:23 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb: Makefiles should depend on also rbconfig.rb.
+ (ruby-bugs:PR#1256)
+
+ * ext/win32ole/win32ole.c (set_argv): set real arguments to
+ WIN32OLE::ARGV. [ruby-list:39073]
+
+Thu Jan 22 22:54:53 2004 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (BEG_REGEXP): allow 8-bit characters in quoted
+ strings for Novell GroupWise Internet Agent.
+ * lib/net/imap.rb (DATA_REGEXP): ditto.
+
+Thu Jan 22 16:21:33 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (string_content): reset lexical states at the beginning of
+ string contents. [ruby-list:39061]
+
+Wed Jan 21 21:55:51 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/drb/drb.rb: remove O_NONBLOCK, thanks \ay
+ * lib/drb/extserv.rb: typo
+
+Wed Jan 21 17:57:56 2004 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (envelope): allow NIL.
+ * lib/net/imap.rb (body): ditto.
+ * lib/net/imap.rb (number): ditto.
+ * lib/net/imap.rb (ensure_nz_number): show a detailed error
message.
- * eval.c (compile_error): error message slightly changed.
+Wed Jan 21 16:44:20 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * parse.y (nextc): script parsing will be terminated by __END__ at
- beginning of line.
+ * lib/mkmf.rb (merge_libs): squeeze successive same libraries.
+ [ruby-dev:22652]
- * eval.c (compile_error): `__END__' is no longer a keyword.
+Wed Jan 21 16:01:37 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * parse.y (nextc): protect lastline read from script stream.
+ * ext/digest/rmd160/extconf.rb: have_library appends found library.
-Tue Oct 7 14:06:06 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Wed Jan 21 11:36:00 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * version 1.1 alpha9 released.
+ * parse.y (block_append): update nd_end for "real" head node.
+ [ruby-list:39058]
- * eval.c (mod_append_features): renamed from extend_class.
+Tue Jan 20 14:48:13 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * eval.c (rb_eval): defining method calls `method_added'.
+ * ext/openssl/extconf.rb: should check <openssl/conf_api.h> instead
+ of OPENSSL_VERSION_NUMBER. [ruby-list:39056]
- * eval.c (ruby_options): exception while processing options must
- terminate the interpreter.
+Tue Jan 20 14:43:17 2004 Dave Thomas <dave@pragprog.com>
- * error.c (Init_Exception): wrong method configuration. `new'
- should have been a singleton method.
+ * lib/base64.rb: Add RDoc
-Mon Oct 6 18:55:38 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Jan 20 14:25:51 2004 Dave Thomas <dave@pragprog.com>
- * ext/kconv/kconv.c (kconv_guess): code to guess character code
- from string.
+ * lib/abbrev.rb: Add RDoc
-Mon Oct 6 18:38:17 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+Tue Jan 20 13:22:39 2004 Dave Thomas <dave@pragprog.com>
- * pack.c: now encode/decode base64 by `m' template.
+ * lib/rdoc/generators/html_generator.rb: Document aliases at
+ top-most level.
-Fri Oct 3 10:51:10 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/English.rb: Document English.rb.
- * MANIFEST: needed to include lex.c in the distribution.
+Tue Jan 20 02:49:22 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * eval.c (ruby_options): f_require() called too early.
+ * ext/openssl/extconf.rb: add check for OpenSSL version.
+ [ruby-list:39054]
- * eval.c (rb_provide): module extentions should always be `.o'.
+Tue Jan 20 02:38:13 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-Thu Oct 2 11:38:31 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * marshal.c (w_class): should not dump singleton class.
+ [ruby-dev:22631]
- * version 1.1 alpha8 released.
+Tue Jan 20 01:31:36 2004 WATANABE Hirofumi <eban@ruby-lang.org>
- * ext/marshal/marshal.c (r_object): remove temporal regist for
- structs. (caused problem if structs form cycles.)
+ * io.c (lineno): typo fix(FIX2INT -> INT2FIX).
- * parse.y (match_gen): static binding for match(=~) calls
- with regexp literals.
+Mon Jan 19 21:53:38 2004 akira yamada <akira@ruby-lang.org>
-Wed Oct 1 15:26:55 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * io.c, re.c, string.c, time.c: fixed up positions of RDocs.
- * eval.c: protect retval in struct tag from GC for C_ALLOCA.
+Mon Jan 19 07:09:20 2004 Tadayoshi Funaba <tadf@dotrb.org>
- * eval.c: no more pointer value from setjmp/longjmp.
+ * lib/date.rb: zone was wrong when it was behind UTC.
+ Thanks Mark J. Reed.
-Wed Oct 1 14:01:49 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * lib/date/format.rb: %z is now always replaced by four digits
+ with a leading plus or minus sign.
- * ext/marshal/marshal.c (w_byte): argument must be char.
+ * sample/cal.rb: added a class, anyway.
-Wed Oct 1 10:30:22 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Sun Jan 18 20:47:35 2004 WATANABE Hirofumi <eban@ruby-lang.org>
- * variable.c (mod_const_at): global constants now belongs to the
- class Object.
+ * ruby.c: use translate_char() on Cygwin.
- * object.c (Init_Object): new global constant NIL.
+Sun Jan 18 02:33:26 2004 WATANABE Hirofumi <eban@ruby-lang.org>
- * ext/marshal/marshal.c (marshal_dump): try to set binmode.
+ * defines.h (_WIN32): undef _WIN32 on Cygwin before defining DOSISH.
- * ext/marshal/marshal.c (r_object): forgot to re-regist structs in
- the object table.
+Sun Jan 18 00:23:55 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * eval.c (ruby_options): call Init_ext() before any require()
- calls by `-r'.
+ * marshal.c (class2path): check anonymous class/module before
+ checking referable, and allow singleton classes.
-Fri Sep 30 14:29:22 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+Fri Jan 16 14:33:35 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/marshal/marshal.c (w_object): marshal dumped core.
+ * marshal.c (class2path): get class path and check referable.
+ [ruby-dev:22588]
-Tue Sep 30 10:27:39 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Fri Jan 16 09:52:23 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * sample/test.rb: bignum test suits added.
+ * eval.c (proc_eq): Proc with empty body may not be equal.
+ [ruby-dev:22590]
- * eval.c (rb_eval): new pseudo variable `true' and `false'.
+Thu Jan 15 13:03:10 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * parse.y: new keywords `true' and `false' added.
+ * io.c (argf_read): do not append EOF. (ruby-bugs-ja:PR#585)
-Mon Sep 29 13:37:58 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * io.c (rb_io_fwrite): ad-hockery hack to get rid of HP-UX stdio
+ weird behavior. [ruby-dev:22424]
- * ruby.c (forbid_setid): forbid some options in suid mode.
+Wed Jan 14 13:31:06 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ruby.h (NUM2DBL): new macro to convert into doubles.
+ * ext/iconv/extconf.rb: wrapper iconv.rb is dependent on platform.
-Mon Sep 27 09:53:48 1997 EGUCHI Osamu <eguchi@shizuokanet.or.jp>
+Tue Jan 13 18:54:28 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
- * bignum.c: modified for speeding.
+ * lib/logger.rb(Logger#msg2str): no special treatment for the object
+ which responds to :to_str. commited at 2004-01-11T21:46:27 by
+ gsinclair.
-Fri Sep 26 18:27:59 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * lib/logger.rb(LogDevice#initialize): remove type checking if the
+ given object is a String. Kernel.open handles it correctly.
+ commited at 2004-01-11T21:46:27 by gsinclair.
- * sample/from.rb: some extensions.
+ * test/logger/test_logger.rb: follow above change (ArgumentError ->
+ TypeError.) follow above commit.
-Mon Sep 29 13:15:56 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Jan 13 14:27:13 2004 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * parse.y (lhs): no more syntax error on `obj.CONSTANT = value'.
+ * lib/test/unit/ui/testrunnerutilities.rb (TestRunnerUtilities):
+ moved run method which allows output level. [ruby-dev:22554]
-Fri Sep 26 14:41:46 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Jan 13 04:29:52 2004 Dave Thomas <dave@pragprog.com>
- * eval.c (ruby_run): deferred calling Init_ext() just before eval_node.
+ * lib/rdoc/ri/ri_driver.rb (RiDriver::report_method_stuff):
+ Show fully-qualified class names in class list.
-Fri Sep 26 13:27:24 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+Tue Jan 13 01:04:37 2004 Dave Thomas <dave@pragprog.com>
- * io.c (io_isatty): forgot to return TRUE value.
+ * lib/rdoc/ri/ri_paths.rb (RI::Paths): First attempt at
+ incorporating DESTDIR in the rdoc installation.
-Fri Sep 25 11:10:58 1997 EGUCHI Osamu <eguchi@shizuokanet.or.jp>
+Mon Jan 12 23:27:19 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * eval.c: use _setjmp/_longjmp instead of setjmp/longjmp on some
- platforms.
+ * parse.y (primary): fix position after FCALL. [ruby-dev:22574]
-Wed Sep 24 17:43:13 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Mon Jan 12 12:07:22 2004 Dave Thomas <dave@pragprog.com>
- * string.c (Init_String): String#taint and String#taint? added.
+ * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser::do_methods):
+ Someone changed the "// in eval.c" comments to "/*...*/" style,
+ so the parsing of the source file name broke.
- * class.c (mod_ancestors): ancestors include the class itself.
+ * object.c: Remove spurious space in TrueClass documentation.
-Wed Sep 24 00:57:00 1997 Katsuyuki Okabe <HGC02147@niftyserve.or.jp>
+ * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser::find_body): Fix
+ bad regexp: if the code before a documented method contained
+ a comment that wasn't terminated by whitespace, that comment
+ and all intervening code was included in the following
+ method's documentation.
- * X68000 patch.
+ * lib/rdoc/ri/ri_formatter.rb (RI::HtmlFormatter::break_to_newline):
+ HTML formats need explicit line breaks.
-Tue Sep 23 20:42:30 1997 EGUCHI Osamu <eguchi@shizuokanet.or.jp>
+Mon Jan 12 11:46:30 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * parse.y (node_newnode): SEGV on null node setup.
+ * configure.in (LIBPATHFLAG, RPATHFLAG): enclose paths with single
+ quotes. [ruby-dev:22564]
-Mon Sep 22 11:22:46 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/mkmf.rb (libpathflag): do not enclose with quotes always.
- * ruby.c (ruby_prog_init): wrong safe condition check.
+ * {bcc32,win32,wince}/Makefile.sub (LIBPATHFLAG): quoted.
-Sun Sep 21 14:46:02 1997 MAEDA shugo <shugo@po.aianet.ne.jp>
+Mon Jan 12 02:24:07 2004 Dave Thomas <dave@pragprog.com>
- * error.c (exc_inspect): garbage added to classpath.
+ * lib/rdoc/ri/ri_formatter.rb (RI::HtmlFormatter): Add HTML
+ generation support to ri (Elliot Hughes)
-Fri Sep 19 11:49:23 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Mon Jan 12 02:24:07 2004 Dave Thomas <dave@pragprog.com>
- * parse.y (newtok): forgot to adjust buffer size when shrinking
- the token buffer.
+ * lib/rdoc/ri/ri_formatter.rb (RI::HtmlFormatter): Add HTML
+ generation support to ri (Elliot Hughes)
- * enum.c (enum_find): rb_eval_cmd() does not return value.
+Sun Jan 11 02:07:47 2004 Dave Thomas <dave@pragprog.com>
- * io.c (pipe_open): close fds on pipe exec. fcntl(fd, F_SETFD, 1)
- no longer used.
+ * lib/rdoc/ri/ri_options.rb (RI::Options::OptionList::OptionList):
+ Also accept command line options via the 'RI' environment variable.
-Tue Sep 16 17:54:25 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Sun Jan 11 02:07:47 2004 Dave Thomas <dave@pragprog.com>
- * file.c (f_test): problem if wrong command specified.
+ * lib/rdoc/ri/ri_options.rb (RI::Options::OptionList::OptionList):
+ Also accept command line options via the 'RI' environment variable.
- * ruby.c (ruby_prog_init): close stdaux and stdprn for MSDOS.
+Sat Jan 10 21:27:41 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * ruby.c (ruby_prog_init): should not add path from environment
- variable, if ruby is running under seuid.
+ * eval.c (eval): need to add message delimiter. [ruby-dev:22561]
- * process.c (init_ids): check suid check for setuid/seteuid etc.
+Sat Jan 10 01:54:50 2004 Eric Sunshine <sunshine@sunshineco.com>
-Mon Sep 15 00:42:04 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * defines.h (__NeXT__): Ensure that all standard S_IRUSR, S_IWGRP,
+ S_IRWXO, etc. macros are defined since future code might require
+ them (even though present code only requires a subset).
- * regex.c (re_compile_pattern): \w{3} and \W{3} did not work.
+ * defines.h (__NeXT__): Bug fix: WORDS_BIGENDIAN was not being set
+ correctly on Rhapsody when -arch compiler flag was used (via
+ configure's --enable-fat-binary option).
-Thu Sep 11 10:31:48 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Fri Jan 9 10:05:14 2004 Siena. <siena@faculty.chiba-u.jp>
- * version 1.1 alpha7 released.
+ * lib/mkmf.rb (libpathflag): use single quotes. [ruby-dev:22440]
- * ext/socket/socket.c (sock_new): no setbuf() for NT.
+Thu Jan 8 23:49:21 2004 WATANABE Hirofumi <eban@ruby-lang.org>
- * io.c (rb_fopen,rb_fdopen): set close-on-exec for every fd.
+ * configure.in (RDOCTARGET): new macro. if you want to install
+ rdoc documentation, you need to run configure with
+ --enable-install-doc.
-Wed Sep 10 15:55:31 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu Jan 8 21:29:43 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * ext/marshal/marshal.c (r_bytes0): extra big length check.
+ * ext/openssl/ossl_pkey.c (ossl_pkey_to_der): removed; it returns
+ public key only.
-Tue Sep 9 16:27:14 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/openssl/ossl_pkey_dh.c (ossl_dh_to_der): new function for
+ OpenSSL::PKey::DH#to_der.
- * io.c (pipe_fptr_atexit): clean up popen()'ed fptr.
+ * ext/openssl/ossl_pkey_dsa.c (ossl_dsa_to_der): new function for
+ OpenSSL::PKey::DSA#to_der.
- * error.c (set_syserr): some system has error code that is bigger
- than sys_nerr. grrr.
+ * ext/openssl/ossl_pkey_rsa.c (ossl_rsa_to_der): new function for
+ OpenSSL::PKey::RSA#to_der.
-Mon Sep 8 18:33:33 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu Jan 8 16:51:04 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
- * io.c (io_s_new): dereferenced nil for optional mode.
+ * test/wsdl/datetime/test_datetime.rb: fixed a stupid testcase which
+ dumps "E" at month-end.
-Fri Sep 5 10:26:03 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu Jan 8 11:20:01 2004 WATANABE Hirofumi <eban@ruby-lang.org>
- * class.c (class_instance_methods): do not include methods which
- are changed to private in subclasses.
+ * eval.c, object.c, process.c, re.c: don't use C++ style comments.
-Thu Sep 4 12:38:53 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu Jan 8 04:36:21 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * variable.c (f_global_variables): list name of the global
- variables.
+ * lib/webrick/cgi.rb (WEBrick::CGI#initialize): should create
+ @config[:Logger] if it was not given.
- * object.c (obj_id): returns unique integer.
+ * sample/webrick/*: new files.
-Wed Sep 3 14:05:16 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * MANIFEST: add sample/webrick/*
- * version 1.1 alpha6 released.
+Wed Jan 7 13:00:18 2004 Dave Thomas <dave@pragprog.com>
- * eval.c (mod_s_constants): context sensitive constant list.
+ * lib/rdoc/ri/ri_driver.rb: Fix problem where ri was
+ being too eager to find matches of ambiguous method
+ names (such as "ri Thread.join" would return both
+ Thread.join and ThreadsWait.join)
- * variable.c (mod_constants): no more `all' option.
+Wed Jan 7 12:35:41 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
- * variable.c (mod_const_of): the values for autoload classes are
- their name strings.
+ * lib/debug.rb: revert command parse regexps. [ruby-list:39014] by
+ Shirai,Kaoru.
- * class.c (class_instance_methods): no special treatment for
- singleton classes.
+Wed Jan 7 08:21:04 2004 Dave Thomas <dave@pragprog.com>
- * object.c (obj_singleton_methods): returns list of singleton
- method names.
+ * lib/rdoc/parsers/parserfactory.rb: Check for shebang
+ line in files that would otherwise be treated as
+ plain text.
- * parse.y (yylex): no here document after `class' keyword.
+Tue Jan 6 22:13:34 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
- * eval.c (f_load): expand path if fname begins with `~'.
+ * eval.c (rb_mod_modfunc): should break if m has no super class.
+ [ruby-dev:22498]
-Tue Sep 2 13:19:48 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Jan 6 21:55:02 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * class.c (ins_methods_i): do not list undef'ed methods.
+ * io.c (fptr_finalize): should save errno just after failure.
+ [ruby-dev:22492]
-Mon Sep 1 13:42:48 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Jan 6 14:53:14 2004 Dave Thomas <dave@pragprog.com>
- * version 1.1 alpha5 released.
+ * bin/ri: split out the display side, making it pluggable. Added
+ new ri_driver and ri_display files in lib/rdoc/ri.
- * object.c (mod_attr_reader): create methods to define attribute
- reader/write/accessor.
+Tue Jan 6 06:37:53 2004 Dave Thomas <dave@pragprog.com>
- * class.c (rb_define_attr): always defines accessors.
+ * bin/rdoc: Add --ri-system switch
- * eval.c (rb_call): alias occured in the module body caused SEGV.
+ * lib/.document: Update with list of files that seem to have
+ documentation
- * parse.y: did not generate here document strings properly.
+ * lib/test/unit.rb: Reorder comment to make it RDoc friendly.
-Mon Sep 1 11:43:57 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
-
- * parse.y (yylex): heredoc dropped an extra character.
+ * Makefile.in: add install-nodoc target, and make it
+ generate RDoc on default install.
+
+ * lib/rdoc/ri/ri_options.rb (RI::Options::parse): Add
+ --doc-dir option to ri.
+
+Tue Jan 6 00:04:40 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_method_or_yield_parameters):
+ fix parsing if there are braces in a method parameter list
+
+Fri Jan 2 14:54:11 2004 Dave Thomas <dave@pragprog.com>
+
+ * bin/ri: Add new --classes option, and arrange for
+ help messages to be paged too.
+
+ * bin/rdoc: Add statistics.
+
+ * process.c: (MG) Added Process documentation
+
+ * lib/rdoc/ri/ri_formatter.rb (RI::AttributeFormatter::wrap):
+ Fix problem with labels not displaying in RI labeled
+ lists using BS and ANSI modes.
+
+Fri Jan 2 01:50:13 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (argf_eof): ARGF.eof? should not have any side effect.
+ [ruby-dev:22469]
+
+Wed Dec 31 17:25:17 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (argf_each_byte): should return self. [ruby-dev:22465]
+
+Wed Dec 31 11:20:34 2003 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser::do_methods): Make
+ file referenced in "// in sss.c" relative to current file.
+
+Wed Dec 31 11:17:37 2003 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/generators/html_generator.rb: Fix problem when
+ a public method was aliased, but the alias is then
+ made private, and hence doesn't appear in RDoc output.
+
+Wed Dec 31 01:33:05 2003 Dave Thomas <dave@pragprog.com>
+
+ * array.c, error.c, eval.c, io.c, prec.c, range.c, re.c,
+ string.c, time.c: Add RDoc for Kernel functions, and tidy.
+
+Tue Dec 30 19:39:14 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_f_readline): should raise EOFError at the end of
+ files. [ruby-dev:22458]
+
+ * io.c (argf_read): should concatenate input files when length
+ argument is nil. [ruby-dev:22450]
+
+ * io.c (argf_read): should update supplied string buffer (2nd
+ argument) even when IO#read is called multiple times.
+
+ * io.c: should initialize lineno by zero. [ruby-dev:22460]
+
+Tue Dec 30 12:30:30 2003 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/code_objects.rb (RDoc::Context::find_symbol): If a
+ 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):
+ Handle undoing nesting of yield parameters correctly for:
+
+ 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):
+ Handle undoing nesting of yield parameters correctly for:
+
+ def each_entry(&block) Dir.foreach(@path) {|f| yield Pathname.new(f) } end
+
+Mon Dec 29 12:51:02 2003 Dave Thomas <dave@pragprog.com>
+
+ * eval.c: Add RDoc for Kernel global functions.
+
+Mon Dec 29 11:00:16 2003 Dave Thomas <dave@pragprog.com>
+
+ * array.c: Tidy up RDoc loose ends.
+
+Mon Dec 29 05:05:51 2003 Dave Thomas <dave@pragprog.com>
+
+ * struct.c, random: Add RDoc comments
+
+Mon Dec 29 02:20:54 2003 Dave Thomas <dave@pragprog.com>
+
+ * eval.c: Add RDoc for class Proc, Method, UnboundMethod
+
+Mon Dec 29 00:41:44 2003 Dave Thomas <dave@pragprog.com>
+
+ * math.c: Add RDoc comments
+
+Sun Dec 28 20:19:11 2003 Tanaka Akira <akr@m17n.org>
+
+ * ext/stringio/stringio.c (strio_sysread): StringIO.new.sysread didn't
+ raise EOFError.
+
+ * ext/zlib/zlib.c (gzreader_gets): don't increment lineno when
+ gzfile_read_all returns "".
+
+Sun Dec 28 15:25:08 2003 Dave Thomas <dave@pragprog.com>
+
+ * class.c,object.c,parse.y,sprintf.c,variable.c: Document classes
+ Object, Module, etc...
+
+Sun Dec 28 11:55:29 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/csv/test_csv.rb: generate bom.csv and mac.csv files on the fly.
+ [ruby-talk:88852]
+
+ * test/csv/{bom.csv,mac.csv}: removed.
+
+Sun Dec 28 08:56:51 2003 Dave Thomas <dave@pragprog.com>
+
+ * eval.c: Thead[Group] RDoc (thanks to MG)
+
+Sun Dec 28 03:50:05 2003 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser::find_override_comment):
+ Escape method names used in regexp
+
+Sun Dec 28 01:46:02 2003 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/ri/ri_formatter.rb (RI::TextFormatter::display_flow_item):
+ Add support for rules in 'ri' output.
+
+Sun Dec 28 01:35:35 2003 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser::find_body):
+ Sometimes the Ruby source aliases two otherwise
+ unrelated methods (for example Kernel#object_id and
+ Kernel#hash are both the same C function). Provide a
+ facility to allow the methods to be documented
+ separately.
+
+Sun Dec 28 01:05:31 2003 Dave Thomas <dave@pragprog.com>
+
+ * marshal.c, signal.c: RDoc collemts added by Elliott Hughes
+
+Sun Dec 28 00:48:47 2003 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser::find_class_comment):
+ Some source files use lower case class or module names
+ when naming the Init_XXX function in C.
+
+Sat Dec 27 23:41:46 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: fix "test: too many arguments" error.
+
+Sat Dec 27 15:32:19 2003 Dave Thomas <dave@wireless_3.local.thomases.com>
+
+ * time.c: RDoc comments added
+
+Sat Dec 27 15:07:57 2003 Dave Thomas <dave@pragprog.com>
+
+ * object.c: Add RDoc comments for Symbol class.
+
+Sat Dec 27 14:42:30 2003 Dave Thomas <dave@pragprog.com>
+
+ * numeric.c: Add RDoc comments.
+
+Sat Dec 27 00:44:00 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (next_argv): warn always for stdin on inplace edit mode.
+
+ * io.c (read_all): need to check string value.
+
+ * io.c (argf_read): allow ARGF.read(nil). [ruby-dev:22433]
+
+Fri Dec 26 23:02:09 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_f_backquote): need not to check nil result.
+ [ruby-core:02078]
+
+ * io.c (rb_io_getline): should return nil when read_all gives
+ empty string, even when nil rs is specified. [ruby-core:02077]
+
+Fri Dec 26 18:50:59 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: check if getcontext and setcontext are available.
+
+ * eval.c: use presence of getcontext/setcontext.
+
+Fri Dec 26 16:40:53 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pathname.rb (PathnameTest#test_plus): add 2 assertions.
+
+Fri Dec 26 09:26:58 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * pack.c (pack_pack): add sign check for 'i', and 'l'.
+ [ruby-dev:22427]
+
+ * bignum.c (rb_quad_pack): add range check for 'quad int'.
+
+Thu Dec 25 22:39:59 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * string.c (rb_str_update): don't return any value.
+
+Thu Dec 25 15:30:17 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_update): call rb_str_modify().
+
+Thu Dec 25 05:08:09 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (search_required): search actual file name once when no
+ extension specified.
+
+Thu Dec 25 04:00:44 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * stable version 1.8.1 released.
+
+Thu Dec 25 00:17:53 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * configure.in: check for nanosleep, -lrt if required.
+ [ruby-core:02059]
+
+ * eval.c (thread_timer): use select(2) if nanosleep(2) is not
+ available.
+
+ * eval.c: check __stub_getcontext for glibc on some platforms.
+ [ruby-list:38984]
+
+Wed Dec 24 23:48:04 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/soap/test_basetype.rb, test/soap/marshal/test_marshal.rb
+ test/xsd/test_xsd.rb: use "(-1.0 / (1.0 / 0.0))" instead of "-0.0"
+ to express -0.0. [ruby-talk:88786]
+
+Wed Dec 24 23:29:30 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/tsort.rb (test_orphaned_break): removed.
+
+Wed Dec 24 20:53:06 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/sample/tkmulticolumnlist.rb: new sample
+
+ * ext/tk/sample/tkmultilistframe.rb: bug fix
+
+Wed Dec 24 20:37:37 2003 Eric Sunshine <sunshine@sunshineco.com>
+
+ * configure.in (LDSHARED): Fixed typographical error in assignment of
+ LDSHARED for Rhapsody which caused linking of extension modules to
+ fail.
+
+Wed Dec 24 17:51:18 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (rb_thread_flock): enable thread support again.
+
+Wed Dec 24 16:46:08 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (catch_timer): do not call rb_thread_schedule() inside to
+ avoid pthread_mutex_lock() deadlock. interrupts to system calls
+ are detected by TRAP_END via EINTR error.
+
+ * eval.c (thread_timer): do not post signal unless it is
+ absolutely necessary.
+
+ * rubysig.h (TRAP_END): add CHECK_INTS to switch thread.
+
+ * regex.c (re_compile_pattern): check if nextp is smaller than
+ pend. [ruby-dev:22372]
+
+ * eval.c (umethod_bind): remove method overridden check.
+ [ruby-dev:22366]
+
+Wed Dec 24 16:13:05 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_ssl.c (ossl_ssl_read): should check for error
+ status by SSL_get_error().
+
+ * ext/openssl/ossl_ssl.c (ossl_ssl_write): ditto.
+
+Wed Dec 24 14:23:27 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_read): clear the buffer argument
+ when returning nil. [ruby-dev:22363]
+
+ * test/ruby/ut_eof.rb (TestEOF::test_eof_0, TestEOF::test_eof_1):
+ add buffer argument tests.
+
+Wed Dec 24 14:07:55 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb: Modules are allowed to rescue.
+
+ * lib/test/unit/autorunner.rb: show output_level in order.
+
+ * lib/test/unit/collector/dir.rb: get rid of successive same
+ directories in load path.
+
+ * test/testunit/test_assertions.rb (test_assert_nothing_raised,
+ test_assert_raise): test for modules.
+
+Wed Dec 24 13:43:34 2003 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (authenticate): remove "\n" from base64 encoded
+ strings.
+
+Wed Dec 24 11:26:41 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/fileutils/test_fileutils.rb: should not create any
+ files or directories in current directory. [ruby-talk:88724]
+
+Wed Dec 24 10:29:53 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_read): never return nil at
+ unlimited read. [ruby-dev:22334]
+
+ * ext/stringio/stringio.c (strio_read): support second
+ argument. [ruby-dev:22350]
+
+Wed Dec 24 09:38:49 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (arg): should return 0 after error. [ruby-dev:22360]
+
+Wed Dec 24 00:56:54 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (read_all): do not return nil at the end of file.
+ [ruby-dev:22334]
+
+ * io.c (argf_read): do not depend on nil at eof behavior of
+ IO#read().
+
+ * eval.c (rb_thread_join): dup exception before re-raising it.
+
+ * io.c (rb_io_eof): call clearerr() to prevent side effect. this
+ patch is supplied by Masahiro Sakai <sakai@tom.sfc.keio.ac.jp>.
+ [ruby-dev:22234]
+
+ * pack.c (OFF16): get offset for big endian machines.
+
+ * pack.c (pack_pack): use OFF16 instead of OFF16B.
+ [ruby-dev:22344]
+
+ * pack.c (pack_unpack): ditto.
+
+Tue Dec 23 22:47:14 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_check_readable): set FMODE_RBUF always, even if
+ NEED_IO_SEEK_BETWEEN_RW is not defined. [ruby-dev:22340]
+
+ * io.c (rb_io_check_writable): clear FMODE_RBUF before writing
+ something.
+
+Tue Dec 23 22:25:00 2003 Gavin Sinclair <gsinclair@soyabean.com.au>
+
+ * lib/optparse.rb: incomplete RDoc documentation added in place of
+ existing RD comments. Tabs converted to spaces.
+
+Tue Dec 23 19:44:47 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/soap/test_streamhandler.rb (test_basic_auth): removed.
+ soap4r + basic_auth is not officially supported in ruby/1.8.1 even
+ though soap4r + basic_auth + http-access2 should run fine.
+
+Tue Dec 23 19:42:59 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_io_ungetc): raise an exception at unread stream to
+ avoid unspecified behavior. [ruby-dev:22330]
+
+ * test/ruby/test_system.rb (test_syntax): glob relatively from
+ __FILE__.
+
+Tue Dec 23 18:09:40 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * pack.c (pack_pack): remove unnecessary negative value check.
+ [ruby-dev:22329]
+
+Tue Dec 23 17:26:55 2003 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
+
+ * bcc32/Makefile.sub (config.h): bcc has finite(). [ruby-list:38940]
+
+Tue Dec 23 16:08:16 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/rexml/encodings/US-ASCII.rb: typo. [ruby-talk:88650]
+
+ * test/ruby/test_system.rb: num of asserts depended on running dir.
+
+ * test/xsd/test_noencoding.rb: rexml + without iconv/uconv cannot
+ handle euc-jp. install iconv, uconv or xmlscan.
+
+Tue Dec 23 14:13:51 2003 akira yamada <akira@ruby-lang.org>
+
+ * lib/uri/generic.rb (URI::Generic::check_userinfo,
+ URI::Generic::check_user, URI::Generic::check_password): tests
+ conflicts/depends with other components closely.
+
+ * test/uri/test_generic.rb (TestGeneric::test_set_component):
+ added tets.
+
+Tue Dec 23 11:08:34 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/xsd/test_noencoding.rb: rescue Errno::EINVAL and do not test.
+ "euc-jp" might not be in supported encoding name list.
+ [ruby-talk:88650]
+
+Tue Dec 23 06:10:31 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/cgi.rb (CGI): add support for mod_ruby.
+
+ * lib/webrick/cgi.rb (CGI::Socket): add check for existence of
+ OpenSSL module in all HTTPS related methods.
+
+ * lib/webrick/cgi.rb (CGI::Socket#cipher): should create similar
+ value to OpenSSL::SSLSocket#cipher.
+
+ * lib/webrick/httpresponse.rb (HTTPResponse#setup_header): should
+ set "connection: close" if @keep_alive is false.
+
+ * lib/webrick/https.rb (HTTPrequest#meta_vars): add supprt for
+ SSL_PROTOCOL, SSL_CIPHER_USEKEYSIZE and SSL_CIPHER_ALGKEYSIZE.
+
+Mon Dec 22 23:00:05 2003 akira yamada <akira@ruby-lang.org>
+
+ * lib/uri/generic.rb (URI::Generic::check_opaque): fixed typo.
+
+Mon Dec 22 21:59:24 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/iconv/iconv.c (map_charset): always ensure code is a String.
+
+Mon Dec 22 21:15:29 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * class.c (rb_mod_init_copy): always copy singleton class.
+ [ruby-dev:22325]
+
+Mon Dec 22 20:44:36 2003 akira yamada <akira@ruby-lang.org>
+
+ * lib/uri/generic.rb (URI::Generic#route_from): accepts urls which
+ has no host-part.
+
+ * test/uri/test_generic.rb (TestGeneric::test_route): added a test.
+
+Mon Dec 22 20:38:44 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/cgi.rb: reduce eval.
+
+ * lib/cgi.rb (CGI::QueryExtension::read_multipart): alias path to
+ local_path. [ruby-list:38883]
+
+Mon Dec 22 20:09:31 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/soap/test_property.rb: remove duplicated test method.
+
+Mon Dec 22 18:22:04 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * bcc32/Makefile.sub, win32/Makefile.sub (config.h): remove
+ HAVE_ISINF definition to follow previous commits of missing.h
+ and win32/win32.h.
+
+Mon Dec 22 17:23:42 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (ac_cv_func_setitimer): moved from defines.h
+
+ * defines.h, rubysig.h, signal.c: removed macro handling which
+ should be done in configure.
+
+ * configure.in (intrinsics.h): check if present.
+
+ * ruby.h: include intrinsics.h if available.
+
+ * bignum.c, marshal.c: include ieeefp.h if available.
+
+ * missing.h (isinf): define as a macro if finite() and isnan()
+ are available. [ruby-core:02032]
+
+Mon Dec 22 17:07:31 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in (mingw): set isnan, finite and isinf to yes.
+
+Mon Dec 22 13:40:19 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/soap/property.rb: passing block by reference.
+
+Mon Dec 22 00:32:43 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_with_disable_interrupt): use ENABLE_INTS instead of
+ ALLOW_INTS which may switch context. [ruby-dev:22319]
+
+ * ext/syck/emitter.c (syck_emitter_write): str bigger than
+ e->bufsize causes buffer overflow. [ruby-dev:22307]
+
+Sun Dec 21 17:29:00 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * class.c (rb_check_inheritable): new function. [ruby-dev:22316]
+
+ * intern.h: add prototype.
+
+ * eval.c (superclass): use rb_check_inheritable().
+
+ * object.c (rb_class_initialize): check argument validity.
+
+Sun Dec 21 16:25:10 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pathname.rb (Pathname#+): re-implemented to resolve ".." in
+ beginning of the argument.
+ (Pathname#join): concatenate from the last argument.
+ (Pathname#parent): just use Pathname#+.
+
+Sun Dec 21 00:12:37 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: add new methods (TkScrollbar#assign, assign_list)
+
+ * ext/tk/sample/tkmultilistframe.rb: use TkScrollbar#assign method
+
+Sat Dec 20 21:59:03 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/httprequest.rb (HTTPRequest#meta_vars): refine regexp.
+
+ * lib/webrick/cgi.rb (CGI#start): NPH scripts return status line
+ instead of Status: header field.
+
+ * lib/webrick/cgi.rb (CGI::Socket): refine some coditions.
+
+Sat Dec 20 16:07:14 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser::Completion::complete): wrong
+ Regexp for word boundary. pointed out by Gavin Sinclair.
+
+ * lib/optparse.rb (OptionParser::make_switch): [no-] prefix was
+ missing.
+
+Sat Dec 20 11:40:10 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/yaml.rb (YAML::YAML): adjust Marshal version.
+
+Sat Dec 20 03:56:02 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_with_disable_interrupt): prohibit thread context
+ switch during proc execution. [ruby-dev:21899]
+
+Sat Dec 20 02:41:02 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/cgi.rb: add file. (yet another CGI library)
+
+ * MANIFEST: add lib/webrick/cgi.rb.
+
+Sat Dec 20 02:18:31 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-calculate-indent): proper indentation
+ inside of parentheses. [ruby-dev:22308]
+
+Fri Dec 19 21:24:22 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/httprequest.rb (HTTPRequest#meta_vars): should not set
+ HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH.
+
+ * lib/webrick/https.rb (HTTPRequest#parse): should check presence
+ of cert() method to detect SSLSocket.
+
+Fri Dec 19 22:56:46 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/soap/property.rb (SOAP::Property#load): new method for loading
+ property value into existing property tree.
+
+ * test/soap/test_property.rb: add test.
+
+Fri Dec 19 19:21:49 2003 akira yamada <akira@ruby-lang.org>
+
+ * lib/runit/cui/testrunner.rb (RUNIT::CUI::TestRunner::run):
+ should use Test::Unit::UI::{PROGRESS_ONLY,VERBOSE}.
+
+Fri Dec 19 17:36:49 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/sample/tkmultilistbox.rb: bug fix
+
+ * ext/tk/sample/tkmultilistframe.rb: new sample script
+
+Fri Dec 19 03:44:27 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/httputils.rb (parse_form_data): should return an
+ empty Hash if the body is empty.
+
+Thu Dec 18 21:47:35 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/mkmf.rb (create_makefile): should remove deffile if it's
+ made by miniruby. based on nobu's patch.
+
+Thu Dec 18 21:44:21 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * eval.c (stack_extend): ignore inline optimization on VC7.
+
+ * win32/Makefile.sub (OS, RT): can override.
+
+ * win32/Makefile.sub (LDFLAGS): ditto. shouldn't use pdb:none
+ option. based on Tietew's patch [ruby-dev:22289]
+
+Thu Dec 18 16:38:44 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (fnmatch): unlike find_dirsep(), rb_path_next() never
+ return NULL.
+
+Thu Dec 18 15:27:59 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/ipaddr.rb (IPSocket::getaddress): merge usa's patch.
+ [ruby-dev:21678]
+
+Wed Dec 17 15:15:30 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/cgi.rb (CGI::QueryExtension::Value::[]): should work like
+ String#[] if more than one arguments are specified.
+
+ * lib/delegate.rb: avoid using common instance name as "@obj".
+
+ * lib/cgi.rb (CGI::QueryExtension::Value): Value is no longer
+ subclass of String, but DelegateClass(String).
+
+ * ext/curses/extconf.rb: restore function check for init_color.
+ [ruby-list:38905]
+
+ * Makefile.in: need to specify $(MAINLIBS) for the miniruby
+ generation rule.
+
+ * configure.in: better FreeBSD -lc_r support.
+
+Wed Dec 17 00:16:14 2003 Minero Aoki <aamine@loveruby.net>
+
+ * ext/strscan/strscan.c: new method
+ StringScanner#beginning_of_line? (alias #bol?)
+
+ * ext/strscan/strscan.c: new method StringScanner#concat and #<<.
+
+ * ext/strscan/strscan.c: StringScanner#new(str) does not duplicate
+ nor freeze STR (allow destructive modification).
+
+ * test/strscan/test_stringscanner.rb: test new methods above.
+
+ * test/strscan/test_stringscanner.rb: test destructive string
+ modification.
+
+Tue Dec 16 21:20:47 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pp.rb: don't use local variable `pp'.
+
+ * lib/prettyprint.rb: ditto.
+
+Tue Dec 16 13:20:43 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: condition bug of if statement on
+ {pack,grid}_propagate methods
+
+Tue Dec 16 03:17:29 2003 why the lucky stiff <why@ruby-lang.org>
+
+ * lib/yaml/rubytypes.rb: comments in strings. [ruby-talk:88012]
+
+ * test/yaml/test_yaml.rb: add test.
+
+Tue Dec 16 01:14:44 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (catch_timer): check rb_thread_crtical in main native
+ thread.
+
+ * eval.c (thread_timer): just sends signals periodically, to
+ prevent main native thread from receiving them in critical
+ section. [ruby-core:01959]
+
+Mon Dec 15 13:32:22 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (check_dirname): check string safety and remove extraneous
+ trailing directory separators. [ruby-dev:22279]
+
+ * file.c: renamed and externalized rb_path_next,
+ rb_path_skip_prefix, rb_path_last_separator, rb_path_end.
+
+ * intern.h: prototypes for rb_path_next, rb_path_skip_prefix,
+ rb_path_last_separator, rb_path_end.
+
+Mon Dec 15 09:27:46 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/openssl/ossl_pkcs12.c (ossl_pkcs12_initialize): first argument
+ of rb_protect should take an argument of VALUE.
+
+Sun Dec 14 18:46:48 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/socket/socket.c (Init_socket): IPv6 is not supported although
+ AF_INET6 is defined on MinGW.
+
+ * lib/ipaddr.rb (AF_INET6): workaround in the environment which does
+ not support IPv6.
+
+Sat Dec 13 18:55:16 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/iconv/charset_alias.rb: preserve original order.
+
+ * ext/iconv/extconf.rb: remove wrapper file at clean.
+
+Sat Dec 13 18:09:42 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (thread_timer): use timer by sub-thread and nanosleep.
+ [ruby-talk:87519]
+
+ * gc.c (Init_stack): no stack adjustment for THREAD_SAFE.
+
+Sat Dec 13 17:17:59 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (proc_alloc): cache the created object at first time.
+ [ruby-talk:61288], [ruby-dev:22240]
+
+Sat Dec 13 09:01:23 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: check ucontext.h.
+
+ * eval.c: use getcontext/setcontext() instead of setjmp/longjmp()
+ on ia64 or with native thread enabled. [ruby-core:01932]
+
+Sat Dec 13 03:09:14 2003 why the lucky stiff <why@ruby-lang.org>
+
+ * lib/yaml/rubytypes.rb: anonymous struct fix. [ruby-core:01946]
+
+ * test/yaml/test_yaml.rb: add test.
+
+Fri Dec 12 22:36:44 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/csv.rb: add Cell#to_str and Cell#to_s for /.../ =~ aCell,
+ "#{aCell}" and so on.
+
+ * test/csv/test_csv.rb: add tests.
+
+Fri Dec 12 19:33:06 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (mkdir): remove trailing `/' from pathes.
+
+ * lib/fileutils.rb (rmdir): ditto. [ruby-dev:22238]
+
+ * lib/fileutils.rb (rmdir_r): ditto.
+
+ * lib/fileutils.rb (fu_copy_dir): check if it is a directory after
+ mkdir(2).
+
+Fri Dec 12 06:06:09 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (proc_invoke): fix class name in warning message for
+ define_method. [ruby-dev:22235]
+
+Thu Dec 11 21:24:43 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_pkcs12.[ch]: new files. add OpenSSL::PKCS12.
+
+ * ext/openssl/ossl.[ch]: ditto.
+
+ * ext/openssl/MANIFEST: add ossl_pkcs12.[ch].
+
+Thu Dec 11 20:54:28 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (mkdir_p): remove trailing `/' befere mkdir(2).
+ mkdir("nonexistdir/") does not work on NetBSD/Alpha 1.6.1.
+
+ * lib/fileutils.rb (fu_list): call to_str for all arguments.
+
+Thu Dec 11 20:07:01 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/ftools.rb (makedirs): sync with fileutils.
+
+Thu Dec 11 19:53:03 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (mkdir_p): catch all SystemCallErrors.
+ (mkdir("C:\") causes EACCESS on Windows 2000/NTFS)
+
+Thu Dec 11 19:08:02 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (mkdir_p): check if it is a directory after
+ mkdir(2) instead of before mkdir(2), to avoid race condition.
+ [ruby-talk:87730]
+ Refer: mkinstalldirs sh script, GNU mkdir(1) (coreutils 5.0)
+
+Thu Dec 11 18:49:30 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb: def m( arg ) -> def m(arg).
+
+Thu Dec 11 11:39:43 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (ieeefp.h), numeric.c: needed for finite() on
+ Solaris. [ruby-core:01921]
+
+ * file.c (rb_stat_inspect): adjust format specifier.
+
+ * parse.c (arg_prepend): nodetype() is for debug use.
+
+ * ruby.h (ISASCII, etc): cast to int to get rid of warning.
+
+ * ruby.h (alloca.h): include even in GCC. [ruby-core:01925]
+
+ * ext/bigdecimal/bigdecimal.c (GetVpValue): adjust format
+ specifier.
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_prec, BigDecimal_coerce,
+ BigDecimal_divmod): use rb_assoc_new() to suppress memory usage.
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_split): ditto.
+
+ * ext/dl/sym.c (rb_dlsym_guardcall): guard itself should be
+ volatile.
+
+ * ext/iconv/iconv.c (iconv_convert): ensure actual parameter with
+ format specifier.
+
+ * ext/pty/pty.c (MasterDevice, SlaveDevice, deviceNo): do not
+ define unless used.
+
+ * ext/pty/pty.c (getDevice): get rid of warning.
+
+ * ext/socket/socket.c (port_str, sock_s_getaddrinfo,
+ sock_s_getnameinfo): FIX2INT() now returns long.
+
+ * ext/socket/socket.c (init_inetsock_internal): uninitialized
+ variable.
+
+ * ext/syck/rubyext.c (syck_parser_assign_io): add prototype.
+
+ * ext/syck/rubyext.c (rb_syck_mktime, yaml_org_handler): use
+ ISDIGIT() instead of isdigit() to avoid warnings and for
+ platforms which don't support non-ascii charater.
+
+Wed Dec 10 19:28:56 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_read): set EOF flag at short read.
+ [ruby-dev:22223], [ruby-dev:22224]
+
+Wed Dec 10 18:07:25 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/erb.rb: new method ERB#filename(=). [ruby-dev:22208]
+
+Wed Dec 10 17:54:51 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_read): do not set EOF flag when
+ requested length is zero. [ruby-dev:22214]
+
+Wed Dec 10 17:17:18 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (read_all): should return given string even if data read is
+ empty. [ruby-dev:22207]
+
+Wed Dec 10 17:16:06 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_read): adjust behavior at reading
+ beyond EOF to IO. [ruby-dev:22205]
+
+ * test/ruby/ut_eof.rb (TestEOF::Seek): test behaviors at reading
+ beyond EOF.
+
+ * test/ruby/test_file.rb, test/stringio/test_stringio.rb: include
+ TestEOF::Seek test case.
+
+Wed Dec 10 15:01:19 2003 Shugo Maeda <shugo@ruby-lang.org>
+
+ * test/monitor/test_monitor.rb (test_cond): use Queue#deq
+ instead of sleep.
+
+Wed Dec 10 14:45:39 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/pty/pty.c (HAVE_SYS_IOCTL_H): need to include <sys/ioctl.h>
+ for TIOCSCTTY on *BSD. based on gotoyuzo's patch.
+ (ruby-bugs:PR#1211)
+
+ * ext/pty/pty.c (establishShell): should close descriptors if fork
+ failed.
+
+Wed Dec 10 12:53:05 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * win32/win32.h: define execv() using do_aspawn().
+
+ * process.c (proc_exec_v): remove #ifdef's which stopped needing.
+
+Tue Dec 9 23:32:23 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb, ext/tk/lib/tkcanvas.rb, ext/tk/lib/tkdialog.rb,
+ ext/tk/lib/tkentry.rb, ext/tk/lib/tkscrollbox.rb, ext/tk/lib/tktext.rb,
+ ext/tk/sample/tkalignbox.rb, ext/tk/sample/tkcombobox.rb,
+ ext/tk/sample/tkmultilistbox.rb, ext/tk/sample/tkoptdb.rb, ext/tk/sample/tktextframe.rb,
+ ext/tk/sample/demos-en/dialog1.rb, ext/tk/sample/demos-en/dialog2.rb,
+ ext/tk/sample/demos-jp/dialog1.rb, ext/tk/sample/demos-jp/dialog2.rb:
+ overrided instance methods, which are private methods on the super
+ class, are changed to 'private'
+
+Tue Dec 9 19:53:02 2003 akira yamada <akira@ruby-lang.org>
+
+ * lib/uri/generic.rb (URI::Generic#route_from0): make case insensitive
+ for host-part.
+
+ * test/uri/test_generic.rb (test_route): added tests for the above
+ change.
+
+Tue Dec 9 14:10:48 2003 Tanaka Akira <akr@m17n.org>
+
+ * io.c (rb_io_check_readable): don't call io_seek if EOF flag is set,
+ to avoid clearing EOF flag.
+ (rb_io_check_writable): ditto.
+
+Tue Dec 9 02:53:55 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/sample/tkalignbox.rb: new sample script
+
+Tue Dec 9 00:45:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb: renamed #assert_raises to #assert_raise
+ and made the former call the latter. [ruby-core:01890]
+
+ * test/testunit/test_assertions.rb: ditto.
+
+Tue Dec 9 00:07:35 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/soap/rpc/standaloneServer.rb: add 'shutdown' and 'status'
+ methods as delegates to WEBrick.
+
+ * test/soap/calc/{test_calc.rb,test_calc2.rb},
+ test/soap/helloworld/test_helloworld.rb,
+ test/wsdl/datetime/test_datetime.rb, test/wsdl/raa/test_raa.rb:
+ follow the change.
+
+Mon Dec 8 22:48:03 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/autorunner.rb: remove dependency to a particular
+ runner. [ruby-core:01901], [ruby-list:38869]
+
+ * lib/test/unit/ui/testrunnerutilities.rb: moved output level
+ constants from Console.
+
+ * lib/test/unit/ui/console/testrunner.rb: ditto.
+
+ * lib/test/unit/ui/{fox,gtk,gtk2,tk}/testrunner.rb (initialize):
+ accept output_level.
+
+Mon Dec 8 15:03:30 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/syck/syck.c (syck_io_str_read): get rid of buffer overflow.
+
+Mon Dec 8 13:02:11 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/uri/common.rb: new method URI.regexp. [ruby-dev:22121]
+
+ * test/uri/test_common.rb: add test for URI.regexp.
+
+Mon Dec 8 12:44:14 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * pack.c: define swap16 and swap32 only if they are not
+ defined. OpenBSD defines these macros. [ruby-dev:22181]
+
+Sun Dec 7 20:54:17 2003 Tanaka Akira <akr@m17n.org>
+
+ * ext/iconv/iconv.c (map_charset): make case sensitive.
+ ext/iconv/charset_alias.rb (charset_alias): don't ignore
+ config.charset's information. sort aliases.
+
+Sat Dec 6 22:58:03 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_ssl.c (ossl_start_ssl): new function to wrap
+ SSL_connect and SSL_accept; if SSL_connect (or SSL_accept) returned
+ but not finished the handshake process, we should retry it.
+
+ * ext/openssl/ossl_ssl.c (ossl_ssl_connect): call ossl_start_ssl.
+
+ * ext/openssl/ossl_ssl.c (ossl_ssl_accept): ditto.
+
+ * ext/openssl/ossl_ssl.c (ossl_ssl_read): allow signal traps.
+
+Sat Dec 6 21:45:10 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * io.c (flush_before_seek): flush before seek on any platform.
+
+ * configure.in: ditto.
+
+Sat Dec 6 17:23:00 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/soap/soap.rb(SOAP::Env.getenv): allow upcase environment variable
+ as well as downcase one.
+
+ * lib/soap/netHttpClient.rb(SOAP::NetHttpClient#proxy=): check URI.
+
+Fri Dec 5 23:22:30 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb (Test::Unit::Assertions::assert_raises,
+ Test::Unit::Assertions::assert_nothing_raised): use the last
+ argument as message unless class object.
+
+ * test/testunit/test_assertions.rb (test_assert_raises): test for
+ multiple exception list. [ruby-core:01891]
+
+ * test/testunit/test_assertions.rb (test_assert_nothing_raised): test
+ for non-exception classes.
+
+Fri Dec 5 22:23:04 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/soap/netHttpClient.rb: proxy support did not work. fixed.
+
+ * lib/soap/property.rb: add class methods for loading property from
+ stream/file/propertyfile. propertyfile is a file which is located at
+ somedir in $:.
+
+ * lib/soap/soap.rb, lib/soap/wsdlDriver.rb, lib/soap/rpc/driver.rb,
+ lib/wsdl/importer.rb: load property from propertyfile 'soap/property'
+ e.g. /usr/local/lib/ruby/site_ruby/1.8/soap/property.
+
+ * test/soap/test_property.rb, test/soap/test_streamhandler.rb: new file.
+
+Fri Dec 5 17:26:23 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_exec_end_proc): maintain tmp_end_procs.
+ [ruby-dev:22154]
+
+Fri Dec 5 13:36:59 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_exec_end_proc): should not clear end_procs and
+ ephemeral_end_procs before execution. [ruby-dev:22144]
+
+ * eval.c (rb_obj_extend): call Module#extended hook after
+ extended_object. [ruby-list:38866]
+
+ * object.c (Init_Object): Module#extended defined.
+
+Fri Dec 5 13:17:30 2003 Tanaka Akira <akr@m17n.org>
+
+ * test/ruby/test_pipe.rb: use IO.pipe instead of IO.popen.
+
+Fri Dec 5 11:54:45 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_read): follow IO#read.
+
+ * test/ruby/ut_eof.rb, test/ruby/test_file.rb, test/ruby/test_pipe.rb,
+ test/stringio/test_stringio.rb: add EOF test.
+
+Fri Dec 5 02:49:35 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb (Test::Unit::Assertions::assert_raises):
+ allow multiple exception list. [ruby-core:01884]
+
+ * lib/test/unit/assertions.rb (Test::Unit::Assertions::assert_nothing_raised):
+ check whether arguments are subclass of Exception.
+
+Thu Dec 4 23:54:00 2003 Rick Ohnemus <rick.ohnemus@systemware.com>
+
+ * dln.c (aix_loaderror): should not use member named 'errno' which
+ might be a macro (e.g. on AIX).
+
+Thu Dec 4 23:32:26 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (read_all): do not depend on lseek position.
+ [ruby-dev:22026]
+
+Thu Dec 4 22:37:26 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_eval): preserve $! value when retry happens in the
+ rescue clause. [ruby-talk:86697]
+
+Thu Dec 4 21:50:07 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/drb/drb.rb (DRb::DRbMessage::send_request, send_reply):
+ should rescue errors and re-raise DRbConnError on write too.
+ [ruby-dev:22132]
+
+Thu Dec 4 16:41:17 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (exc_list): allow expanding list. [ruby-dev:22134]
+
+Thu Dec 4 14:09:24 2003 Minero Aoki <aamine@loveruby.net>
+
+ * test/fileutils/test_fileutils.rb (test_cp): test if the error is
+ kind of SystemCallError. It is needless details that which errno
+ is set on each systems.
+
+Thu Dec 4 13:24:13 2003 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/monitor.rb: use Object#__send__ instead of Object#send.
+
+Thu Dec 4 13:17:45 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/soap/streamHandler.rb: support latest released version of
+ http-access2.
+
+Thu Dec 4 13:04:44 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/soap/soap.rb: add SOAP::Env module for environment repository
+ such as HTTP_PROXY.
+
+ * lib/soap/property.rb: property implementation.
+
+ * lib/soap/streamHandler.rb, lib/soap/wsdlDriver.rb,
+ lib/soap/rpc/driver.rb: use soap/property.rb.
+
+ * lib/wsdl/importer.rb, lib/soap/wsdlDriver.rb, lib/soap/rpc/driver.rb:
+ use SOAP::Env.
+
+ * lib/soap/netHttpClient.rb: add basic_auth, ssl_config, and cookie
+ management interface, but ignored for now.
+
+ * lib/xsd/charset.rb: add XSD::Charset.encoding= interface to set
+ wiredump charset explicitly. it was fixed to 'utf-8' when iconv or
+ uconv module was found.
+
+Thu Dec 4 10:43:58 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/dl/sym.c (rb_dlsym_guardcall): __declspec(noinline) is VC7
+ feature.
+
+Thu Dec 4 10:27:12 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb: update hyperlink to the Japanese document.
+
+Thu Dec 4 09:12:43 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_asn1.c (asn1time_to_time): should check that
+ the underlying value of ASN1_TIME isn't NULL. [ruby-core:01881]
+
+Thu Dec 4 08:29:43 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/server.rb (GenericServer#start): should rescue
+ Exception to avoid unexpected aborting. [ruby-core:01853]
+
+ * lib/webrick/server.rb (GenericServer#start_thread): should check
+ that peeraddr isn't nil before printing.
+
+ * lib/webrick/httpresponse.rb (HTTPResponse#start_thread): should
+ rescue Exception to avoid unexpected aborting of thread.
+
+Thu Dec 4 03:48:59 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pathname.rb (Pathname#link, Pathname#symlink): obsoleted.
+ (Pathname#make_link, Pathname#make_symlink): new method.
+
+Thu Dec 4 01:45:24 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (argf_read): should not terminate on empty string; wait
+ until real EOF. [ruby-dev:21969]
+
+ * io.c (argf_read): should adjust length to read, when length is
+ specified and read spans command line argument files.
+
+Wed Dec 3 19:38:36 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/drb/drb.rb: correct fcntl parameter. [ruby-dev:22120]
+
+Wed Dec 3 13:49:07 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: 'format'==>'Kernel.format' (avoid override trouble)
+
+ * ext/tk/lib/tkafter.rb: ditto.
+
+ * ext/tk/lib/tkcanvas.rb: ditto.
+
+ * ext/tk/lib/tkdialog.rb: ditto.
+
+ * ext/tk/lib/tktext.rb: ditto.
+
+Wed Dec 3 13:28:13 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in (lex.c): try gperf first, and copy from the source
+ directory if failed. [ruby-dev:22123]
+
+ * ext/extmk.rb (MTIMES): let makefiles depend to mkmf.rb.
+
+ * lib/mkmf.rb (configuration): DLDFLAGS was duplicated.
+
+Tue Dec 2 23:18:12 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb: wrote the warning about HTTP_PROXY environment
+ variable.
+
+Tue Dec 2 21:31:42 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bin/testrb: new test runner. [ruby-core:01845]
+
+ * lib/test/unit/autorunner.rb (Test::Unit::AutoRunner.run,
+ Test::Unit::AutoRunner#process_args): take test list to run and
+ options.
+
+ * lib/test/unit/autorunner.rb (Test::Unit::AutoRunner::RUNNERS,
+ Test::Unit::AutoRunner#run): should not exit inside a library,
+ just return the result instead.
+
+ * lib/test/unit.rb: ditto.
+
+ * test/runner.rb: exit with the test result.
+
+Tue Dec 2 20:18:48 2003 Eric Sunshine <sunshine@sunshineco.com>
+
+ * configure.in (AC_PROG_YACC): AC_DEFINE(OLD_YACC) if Yacc is found
+ instead of Bison or byacc.
+
+ * parse.y: If OLD_YACC is defined, ensure that YYMAXDEPTH is at least
+ 10000 (Bison's default) since some old versions of Yacc define it as
+ low as 150 by default, which is too low for Ruby to parse some files,
+ such as date/format.rb. Among other issues, the parse problem causes
+ "make test" to fail.
+
+Tue Dec 2 20:03:20 2003 Minero Aoki <aamine@loveruby.net>
+
+ * test/fileutils/test_fileutils.rb: check if Pathnames are usable
+ for arguments.
+
+Tue Dec 2 04:22:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb: fixed #assert_no_match message.
+
+ * test/testunit/test_assertions.rb: ditto.
+
+Tue Dec 2 00:43:00 2003 why the lucky stiff <why@ruby-lang.org>
+
+ * ext/syck/syck.c: string buffering bug. decrementing by full
+ max_size now. [ruby-core:01834]
+
+Mon Dec 1 21:33:08 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (num_sadded): prohibit singleton method definition for
+ Numerics. fill yet another gap between Fixnum and Bignum.
+
+Mon Dec 1 17:33:47 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * pack.c (htov16): converts endian using swap16. htov32(), hton16,
+ hton32 as well. [ruby-talk:85377]
+
+ * pack.c (swap16): swap 2 bytes no matter how big short is on the
+ platform. swap32() is also prepared.
+
+ * numeric.c (rb_num2int): returns long to preserve information.
+ rb_fix2int(), rb_num2uint(), rb_fix2uint() as well.
+ [ruby-talk:85377]
+
+ * numeric.c (rb_num2uint): should not check for value range if the
+ source value is negative.
+
+Mon Dec 1 17:14:34 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * sample/optparse/opttest.rb: added.
+
+Mon Dec 1 16:10:52 2003 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/rdoc.rb: (etc) initial merge into main tree.
+
+Mon Dec 1 14:17:49 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (fu_each_src_dest0): call #to_str to allow
+ Pathname for arguments. [ruby-core:01795]
+
+ * test/fileutils/test_fileutils.rb: does much strict test on
+ "same" files detecting.
+
+Mon Dec 1 09:28:14 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * bcc32/Makefile.sub, win32/Makefile.sub, wince/Makefile.sub
+ (XCFLAGS): re-export $(XCFLAGS).
+
+ * bcc32/Makefile.sub, win32/Makefile.sub, wince/Makefile.sub
+ (ARCH_FLAG): export $(ARCH_FLAG) (perhaps empty value).
+
+Mon Dec 1 01:03:27 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/mkmf.rb (TRY_LINK, link_command): added support for DLDFLAGS
+ and ARCH_FLAG. [ruby-dev:22085]
+
+Sun Nov 30 20:18:07 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: keep ARCH_FLAG separate. export ARCH_FLAG.
+ [ruby-core:01819]
+
+ * Makefile.in: add ARCH_FLAG to CFLAGS.
+
+ * Makefile.in: add @CPPFLAGS@ to CPPFLAGS.
+
+ * lib/mkmf.rb (link_command, cc_command): use ARCH_FLAG.
+
+ * lib/mkmf.rb (configuration): add ARCH_FLAG to DLDFLAGS.
+
+ * Makefile.in: add ARCH_FLAG to DLDFLAGS.
+
+ * configure.in: should put getcwd in AC_CHECK_FUNCS, not
+ AC_REPLACE_FUNCS. [ruby-core:01826]
+
+Sun Nov 30 18:22:48 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: do not override CCDLDFLAGS, LDFLAGS, XLDFLAGS,
+ DLDFLAGS and LDSHARED.
+
+ * configure.in: XCFLAGS for compiling ruby itself. ARCH_FLAG is
+ reflected in CFLAGS.
+
+ * lib/mkmf.rb: ditto. do not import XCFLAGS from config.status.
+
+Sun Nov 30 17:37:36 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: bug fix [ruby-talk:86746]
+
+Sun Nov 30 13:02:00 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/soap/encodingstyle/soapHandler.rb: refactoring - Simplifying
+ Conditional Expressions.
+
+ * lib/wsdl/soap/definitions.rb: refactoring - Move Method.
+
+ * test/xsd/{test_noencoding.rb,noencoding.xml}: new files. test for
+ encoding unspecified XML file parsing.
+
+ * test/wsdl/{test_fault.rb,map,datetime}: new files. test of
+ SOAPFault, dateTime and Apache's Map.
+
+Sun Nov 30 09:35:14 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_update): get rid of SEGV at just allocated String.
+ [ruby-core:01812]
+
+Fri Nov 28 23:19:34 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (gc_mark): explicitly check mark recursion levels, instead
+ of unreliable stack length.
+
+Fri Nov 28 22:49:56 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/rinda/rinda.rb: fix TupleSpaceProxy#read, read_all.
+
+Fri Nov 28 21:44:40 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * test/fileutils/test_fileutils.rb (test_ln_s): should be a file, not
+ a directory for FreeBSD.
+
+Fri Nov 28 19:37:56 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (env_has_value, env_index): must match exactly.
+
+ * test/ruby/test_env.rb (test_has_value, test_index): condition for
+ aboves.
+
+Fri Nov 28 17:59:20 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_env.rb: add tests for ENV.
+
+Fri Nov 28 17:47:46 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/drb/drb.rb (DRbMessage#load): rescue Errno::* and raise
+ DRbConnError.
+
+Fri Nov 28 15:41:15 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pathname.rb (Pathname#realpath): obsolete the force_absolute
+ argument.
+
+Fri Nov 28 14:41:52 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/soap/streamHandler.rb: drop unused http parameters.
+
+ * lib/soap/encodingstyle/soapHandler.rb, lib/soap/mapping/factory.rb,
+ lib/soap/mapping/mapping.rb, lib/soap/mapping/registry.rb,
+ lib/wsdl/soap/complexType.rb: ApacheSOAP's map support was broken
+ under WSDL dynanic client environment. fixed.
+
+ * test/wsdl/raa/*: add tests.
+
+ * lib/xsd/datatypes.rb: dateTime precision bug fix (at least, I hope.)
+ bug of soap4r. XSDDateTimeImple.to_time passed a Float to
+ Time.local/Time.gm as an usec, and NUM2LONG(rb_num2long for Float)
+ causes rounding error.
+
+ * test/soap/test_basetype.rb, test/xsd/test_xsd.rb: add tests.
+
+Fri Nov 28 04:15:24 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (method_arity): used wrong Proc object. [ruby-talk:86504]
+
+Fri Nov 28 00:47:29 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_f_exit), process.c (rb_f_exit_bang): treat true as
+ success, false as failure. [ruby-dev:22067]
+
+ * eval.c (rb_f_abort, rb_thread_switch), process.c (rb_f_system): use
+ ANSI macro instead of hard coded value.
+
+ * eval.c (rb_f_exit), process.c (rb_f_exit_bang): use VALUEs not but
+ TYPEs.
+
+Thu Nov 27 22:05:48 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c, gc.c: FreeBSD/ia64 currently does not have a way for a
+ process to get the base address for the RSE backing store, so
+ hardcode it for the moment.
+ [submitted by: Marcel Moolenaar <marcel@FreeBSD.org>]
+
+Thu Nov 27 17:36:42 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tkafter.rb: bug fix on TkTimer#cancel_on_exception=(mode).
+ TkTimer#wait recieves the exception of the callback.
+ The exception is kept on @return_value.
+
+Thu Nov 27 16:58:48 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_stat): remove _fullpath() for NUL: device.
+
+Wed Nov 26 15:38:47 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * test/fileutils/test_fileutils.rb (test_ln_s): should take the
+ existing symbolic link for OpenBSD.
+
+Wed Nov 26 04:48:42 2003 why the lucky stiff <why@ruby-lang.org>
+
+ * ext/syck/token.c: removed YYTOKTMP references which
+ were causing buffer overflows on large block scalars,
+ comments, quoted scalars and plain scalars.
+
+ * ext/syck/rubyext.c: dynamic changing of buffer size.
+
+ * ext/syck/syck.h: default buffer size of 4k.
+
+Wed Nov 26 00:55:30 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/httpresponse.rb: add HTTPResponse#keep_alive=.
+
+ * lib/webrick/httpserver.rb (HTTPServer#run): should pass the
+ request's keep_alive flag to the response.
+
+Tue Nov 25 21:41:35 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * defines.h (ENV_IGNORECASE): should define when DOSISH without
+ human68k. [ruby-dev:22047]
+
+ * hash.c (env_has_value, env_index): don't ignore case of value.
+ [ruby-dev:22048]
+
+Tue Nov 25 21:39:37 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (path_check_1): honor sticky bits always.
+ [ruby-talk:86273]
+
+Tue Nov 25 20:02:14 2003 Minero Aoki <aamine@loveruby.net>
+
+ * test/fileutils/test_fileutils.rb: do test in more deep
+ directory.
+
+ * test/fileutils/test_nowrite.rb: ditto.
+
+Tue Nov 25 19:04:23 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/open-uri.rb (URI::Generic#find_proxy): ENV case sensitivity test
+ refined.
+
+Tue Nov 25 18:13:30 2003 Minero Aoki <aamine@loveruby.net>
+
+ * test/fileutils/test_fileutils.rb: chdir Dir.tmpdir before each
+ test. [ruby-dev:22045]
+
+ * test/fileutils/test_nowrite.rb: ditto.
+
+Tue Nov 25 17:52:11 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/open-uri.rb (URI::Generic#find_proxy): use http_proxy under CGI
+ if the environment variable is case sensitive.
+
+Tue Nov 25 16:41:33 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/wsdl/multiplefault.wsdl, test/wsdl/test_multiplefault.rb:
+ removed. this test requires extra libraries in soap4r/1.5.*.
+
+Tue Nov 25 16:24:42 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/soap/**/*.rb, lib/wsdl/**/*.rb, lib/xsd/**/*.rb: changed license;
+ GPL2 -> Ruby's.
+
+ * lib/soap/rpc/driver.rb, lib/soap/wsdlDriver.rb,
+ lib/soap/streamHandler.rb: add interface to streamhandler.
+
+ * lib/soap/marshal.rb: raise error if parse fails.
+
+ * lib/soap/netHttpClient.rb: add https support. Patched by
+ Oliver M. Bolzer.
+
+ * lib/soap/netHttpClient.rb: dump HTTP response message body by itself.
+
+ * lib/soap/rpc/driver.rb, lib/soap/rpc/proxy.rb,
+ lib/soap/wsdlDriver.rb: add driver#mandatorycharset interface to foce
+ using charset for parsing response from buggy server.
+
+ * lib/soap/encodingstyle/soapHandler.rb: support Apache Axis's half
+ typed multi-ref array.
+
+ * lib/soap/mapping/factory.rb, lib/soap/mapping/registry.rb: map
+ SOAPStruct which has multi-accessors which name are the same, to an
+ array.
+
+ * lib/soap/rpc/element.rb: fixed illegal parameter order.
+
+ * lib/soap/rpc/element.rb: element name of response message could have
+ the name other than 'return'.
+
+ * lib/wsdl/operation.rb, lib/wsdl/operationBinding.rb,
+ lib/wsdl/soap/classDefCreator.rb, lib/wsdl/soap/methodDefCreator.rb,
+ lib/wsdl/soap/methodDefCreatorSupport.rb: WSDL/1.1 allows plural
+ fault definition in a operation. [ruby-talk:84948]
+
+ * test/wsdl/multiplefault.wsdl, test/wsdl/test_multiplefault.rb: add
+ test for above fix.
+
+ * lib/wsdl/soap/complexType.rb: support WSDL array definition with
+ maxOccures="unbound".
+
+ * lib/xsd/charset.rb: use cp932 under emx. Patched by
+ Siena. / SHINAGAWA, Norihide in [ruby-dev:21972]
+
+ * lib/xsd/xmlparser/parser.rb: set @charset nil by default. Nil means
+ 'follow encoding declaration in XML'.
+
+ * sample/soap/digraph.rb, sample/wsdl/amazon/wsdlDriver.rb,
+ sample/wsdl/googleSearch/sampleClient.rb,
+ sample/wsdl/googleSearch/wsdlDriver.rb,
+ test/wsdl/test_emptycomplextype.rb,
+ test/wsdl/marshal/test_wsdlmarshal.rb,
+ test/xsd/test_xmlschemaparser.rb: use File.open(...) { |f| f.read }
+ instead of File.open(...).read. [ruby-dev:21964]
+
+ * test/wsdl/emptycomplextype.wsdl, test/wsdl/test_emptycomplextype.rb:
+ simplify the test case.
+
+ * test/wsdl/axisArray/*: add tests for axis's array encoding.
+
+Tue Nov 25 16:15:29 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ruby.h: don't treat Cygwin as Windows.
+
+Tue Nov 25 15:18:28 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * configure.in: change default value of --enable-pthread (default: no)
+
+Tue Nov 25 07:31:16 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (primary): allow newlines just before right argument
+ parenthesis. (ruby-bugs:PR#1221)
+
+Mon Nov 24 23:32:06 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/open-uri.rb (OpenURI.open_loop, URI::HTTP#proxy_open): use
+ catch/throw for redirection instead of exception.
+ (OpenURI.open_loop, OpenURI.redirectable?): restrict redirection.
+
+Mon Nov 24 19:59:48 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/open-uri.rb (URI::Generic#find_proxy): use CGI_HTTP_PROXY
+ instead of HTTP_PROXY in the CGI environment.
+
+Mon Nov 24 19:32:55 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/etc/extconf.rb: check for pw_passwd in struct passwd and
+ gr_passwd in struct group for DJGPP.
+
+ * ext/etc/etc.c: ditto.
+
+ * ext/Setup.dj: support for curses, etc, zlib.
+
+Mon Nov 24 17:00:00 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/open-uri.rb: validate option names.
+ :content_length_proc and :progress_proc option implemented.
+
+Mon Nov 24 14:53:10 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * bcc32/Makefile.sub, win32/Makefile.sub, wince/Makefile.sub
+ (XCFLAGS): output empty value instead of `-DRUBY_EXPORT'.
+
+Sat Nov 22 23:09:45 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: set enable_pthread to no on MinGW.
+
+Sat Nov 22 22:56:20 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * configure.in: add --enable-pthread option (default: yes)
+
+Sat Nov 22 22:48:46 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: add Tk.grab_release and fix bug of TkComposite
+
+ * ext/tk/lib/tkafter.rb: bug fix of TkAfter#start
+
+ * ext/tk/sample/tkcombobox.rb: new sample script
+
+ * ext/tcltklib/tcltklib.c: add native thread check
+
+Sat Nov 22 18:49:47 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/curses/curses.c (window_nodelay): nodelay() of NetBSD's
+ libcruses returns no value, just like keypad().
+
+Sat Nov 22 17:36:36 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * bcc32/Makefile.sub, win32/Makefile.sub, wince/Makefile.sub
+ (HAVE_GETCWD): output to config.h.
+
+ * bcc32/Makefile.sub, win32/Makefile.sub, wince/Makefile.sub
+ (XCFLAGS): output to config.status.
+
+Sat Nov 22 13:10:10 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (have_st_ino?): djgpp has valid st_ino.
+
+Sat Nov 22 11:28:48 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (Init_stack): stack region is far smaller than usual if
+ pthread is used.
+
+Sat Nov 22 07:30:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/test/unit/util/backtracefilter.rb: fixed a bug that occurred
+ when an exception had no backtrace.
+
+ * test/testunit/util/test_backtracefilter.rb: ditto.
+
+Fri Nov 21 16:44:18 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tkentry.rb: fix the encoding trouble of percent
+ substitutions on validatecommand option of TkEntry widget
+
+ * ext/tk/lib/tk.rb: fix bug on {pack|grid}_propagate() method
+
+Fri Nov 21 16:12:11 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * ruby.1: Fix markups and grammar.
+
+Fri Nov 21 14:49:42 2003 Minero Aoki <aamine@loveruby.net>
+
+ * ruby.1: wrote about ruby related environment variables.
+
+Fri Nov 21 12:28:03 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_extended): singleton methods should not be checked
+ when dumping via marshal_dump() or _dump(). [ruby-talk:85909]
+
+Fri Nov 21 01:40:00 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * configure.in: check <pthread.h>
+
+ * ruby.h: include pthread.h if existence.
+ define is_ruby_native() macro when not HAVE_NATIVETHREAD
+
+ * eval.c: undef is_ruby_native() function when not HAVE_NATIVETHREAD
+
+Fri Nov 21 00:43:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb: use #__send__ instead of #send.
+
+ * lib/test/unit/testcase.rb: ditto.
+
+Thu Nov 20 19:19:22 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: don't find the Cygwin's pthread library on MinGW.
+
+Thu Nov 20 19:15:50 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (have_st_ino?): emx (OS/2 with EMX) does not
+ have st_ino (always 0). [ruby-dev:21972]
+
+ * lib/fileutils.rb (rename_cannot_overwrite_file?): emx does not
+ allow overwriting files by rename(2).
+
+ * test/fileutils/test_fileutils.rb: windows? ->
+ have_drive_letter?, have_file_perm?
+
+Thu Nov 20 17:50:58 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/sample/tkballoonhelp.rb: new sample script
+
+ * ext/tk/sample/tkmultilistbox.rb: ditto
+
+ * ext/tk/sample/tktextframe.rb: ditto
+
+Thu Nov 20 13:37:34 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ruby.h: define is_ruby_native_thread() for no native thread
+ environment
+
+ * eval.c: ditto
+
+Thu Nov 20 12:42:47 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * configure.in: always check existence of the pthread library
+
+ * ruby.h: define macros for ruby's native thread check
+
+ * eval.c: add ruby's native thread check
+
+ * gc.c: ditto
+
+Wed Nov 19 14:45:18 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb (to_ary): print more friendly warning message.
+
+Wed Nov 19 14:32:08 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (fu_same?): add djgpp and wince.
+
+ * lib/fileutils.rb (cannot_overwrite_file?): add wince.
+
+Wed Nov 19 11:04:47 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/fileutils.rb (cannot_overwrite_file?, have_st_ino?): bccwin32
+ is same as mswin32.
+
+Wed Nov 19 07:54:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/test/unit.rb: do not run tests if $! is set.
+
+ * lib/test/unit/assertionfailederror.rb: extend StandardError instead
+ Exception (irb catches the former but not the latter).
+
+Tue Nov 18 23:31:36 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * missing/memmove.c (memmove): take void *, not char *.
+
+ * missing.h (memmove): ditto.
+
+ * missing.h (strchr, strrchr): return char *, not int.
+
+Tue Nov 18 22:20:10 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (fu_same?): temporal fix for windows.
+
+Tue Nov 18 19:05:04 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (fu_same?): check by inode instead of path
+ name, to detect two hard links pointing to the same content.
+
+ * test/fileutils.rb: did not create correctly looped symlinks.
+
+Tue Nov 18 18:23:05 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_read): behave as IO at empty string.
+ [ruby-dev:21939], [ruby-dev:21941]
+
+ * ext/stringio/stringio.c (strio_getc, strio_getline): set EOF flag.
+
+ * ext/stringio/stringio.c (strio_rewind, strio_seek, strio_ungetc):
+ clear EOF flag.
+
+ * test/stringio/test_stringio.rb: imported from [ruby-dev:21941].
+
+Tue Nov 18 14:06:35 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (fu_each_src_dest): raise if src==dest.
+ [ruby-talk:85344] [ruby-core:01699]
+
+ * lib/fileutils.rb: use Object#is_a? instead of Class#=== to allow
+ e.g. remote objects for receivers.
+
+ * lib/fileutils.rb: FileTest -> File.
+
+ * lib/fileutils.rb: put parentheses for arguments of File.xxxx?
+
+ * test/fileutils/test_fileutils.rb (test_cp): test "cp a a".
+
+ * test/fileutils/test_fileutils.rb (test_mv): test "mv a a".
+
+ * test/fileutils/test_fileutils.rb (test_ln): test "ln a a".
+
+ * test/fileutils/test_fileutils.rb (test_ln_s): test "ln_s a a".
+
+ * test/fileutils/test_fileutils.rb (test_install): test "install a a".
+
+ * test/fileutils/fileasserts.rb: new method assert_symlink.
+
+ * test/fileutils/fileasserts.rb: assert_is_directory -> assert_directory.
+
+Mon Nov 17 19:38:49 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (getcwdofdrv): avoid using getcwd() directly, use
+ my_getcwd() instead.
+
+ * merged NeXT, OpenStep, Rhapsody ports patch from Eric Sunshine
+ <sunshine@sunshineco.com>. [ruby-core:01596]
+
+Mon Nov 17 10:50:27 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser::Completion::complete): allow least
+ common completion for three or more candidates.
+
+Mon Nov 17 09:41:38 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/ui/tk/testrunner.rb,
+ lib/test/unit/ui/gtk/testrunner.rb:
+ run GUI main loop in sub thread.
+
+ * lib/test/unit/ui/gtk2/testrunner.rb: imported from rough.
+
+ * lib/test/unit/autorunner.rb (keyword_display): sort keywords.
+
+Sun Nov 16 18:10:57 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_eval): iterator should return value from next inside
+ begin/rescue/end. (ruby-bugs:PR#1218)
+
+Sun Nov 16 13:26:07 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_object): LINK check earlier than anything else,
+ i.e. do not dump TYPE_IVAR for already dumped objects.
+ (ruby-bugs:PR#1220)
+
+ * eval.c (rb_eval): call "inherited" only when a new class is
+ generated; not on reopening.
+
+ * eval.c (eval): prepend error position in evaluating string to
+ "mesg" attribute string only when it's available and is a
+ string.
+
+Sun Nov 16 12:16:10 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/protocol.rb: logging response body. [experimental]
+ [ruby-list:38800]
+
+Sun Nov 16 10:49:38 2003 Gavin Sinclair <gsinclair@soyabean.com.au>
+
+ * lib/thread.rb (Thread.exclusive): wrap method definition in
+ class Thread to enable rdoc to process.
+
+Sun Nov 16 09:45:23 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb (set_debug_output): warn if method is called
+ after #start. [ruby-dev:38798]
+
+Sun Nov 16 04:41:33 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (eval): do not re-raise exception to avoid unnecessary
+ exception copying, instead modify exception and internal
+ information to adjust eval().
+
+ * eval.c (backtrace): can return the current frame information
+ only if lev < -1.
+
+Sat Nov 15 22:16:42 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * /ext/openssl/ossl_x509ext.c (ossl_x509extfactory_create_ext):
+ refine error message.
+
+Sat Nov 15 10:05:40 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/open-uri.rb (OpenURI.open_loop, OpenURI::HTTP#proxy_open):
+ refactored to support options.
+ (Buffer): maintain size by this class.
+
+Sat Nov 15 07:40:14 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_method_node): new API to retrieve method body.
+
+Fri Nov 14 13:21:30 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c: fix (en-bugged at 2003/11/07)
+
+ * ext/tk/lib/tkdialog.rb: TkDialog.new accepts a parent widget
+ argument [ruby-talk:85066]
+
+Thu Nov 13 20:53:35 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/open-uri.rb (Kernel[#.]open): hard coded URI schemes removed.
+ [ruby-ext:02251]
+
+Thu Nov 13 19:17:00 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * lib/test/unit/ui/tk/testrunner.rb: use grid and panedwindow
+ (if available)
+
+Thu Nov 13 17:56:41 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/open-uri.rb (OpenURI.open_uri): use File::RDONLY.
+ reported by Take_tk <ggb03124@nifty.ne.jp>.
+ [ruby-ext:02245]
+
+Thu Nov 13 16:45:53 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_x509req.c (ossl_x509req_to_der): add function for
+ X509::Request#to_der.
+
+Thu Nov 13 11:31:14 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser::Completion#complete): prior shorter
+ name to containing longer name.
+
+Thu Nov 13 06:08:54 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: stop freezing some classes
+
+ * ext/tk/lib/multi-tk.rb: ditto.
+
+Wed Nov 12 17:32:49 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb (assert_throws, assert_nothing_thrown):
+ uncaught throw in sub thread raises ThreadError.
+
+ * lib/test/unit/ui/tk/testrunner.rb (setup_ui): "expand" is not
+ necessary.
+
+Wed Nov 12 14:09:43 2003 Shugo Maeda <shugo@ruby-lang.org>
+
+ * test/monitor/test_monitor.rb: fix the timing problem by Queue.
+
+Wed Nov 12 12:59:44 2003 Shugo Maeda <shugo@ruby-lang.org>
+
+ * test/monitor/test_monitor.rb: added.
+
+Wed Nov 12 10:14:28 2003 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/monitor.rb: refactored. Thanks, Gennady Bystritsky.
+
+Wed Nov 12 06:11:39 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl.c (ossl_x509_sk2ary, ossl_x509crl_sk2ary):
+ add functions to convert STACK into Array.
+
+ * ext/openssl/ossl.h: add prototypes.
+
+ * ext/openssl/ossl_pkcs7.c (ossl_pkcs7_set_certificates,
+ ossl_pkcs7_get_certificates, ossl_pkcs7_get_crls,
+ ossl_pkcs7_set_crls): add functions for PKCS7#certificates=
+ PKCS7#certificates, PKCS7#crls= and PKCS7#crls.
+
+Wed Nov 12 00:47:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/test/unit/ui/testrunnermediator.rb: should require 'test/unit'.
+
+Tue Nov 11 23:54:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/test/unit/ui/gtk/testrunner.rb: added a rescue clause to handle
+ the case when the requested font is not available.
+
+Tue Nov 11 22:44:08 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (appendline): file may not end with newline. a bug if
+ READ_DATA_PENDING_PTR is defined. [ruby-talk:84925]
+
+Tue Nov 11 10:42:41 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: raise an exception when creating TkWindow
+ object, because TkWindow class is an abstract class.
+
+Tue Nov 11 03:30:43 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/ext/openssl/ossl_conf.c (ossl_config_get_value): return nil
+ if the specified value doesn't exist.
+
+ * lib/ext/openssl/ossl_conf.c (ossl_config_get_section): return
+ a empty hash if the specified section doesn't exist.
+
+Mon Nov 10 11:40:29 2003 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/monitor.rb (wait): return true on signal/broadcastfalse and
+ false on timeout. Thanks Gennady Bystritsky.
+
+Mon Nov 10 00:07:10 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (primary): primary_value may be 0 when syntax error.
+ [ruby-talk:84893]
+
+Sun Nov 9 02:05:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb: un-deprecated #assert_not_nil to
+ maintain symmetry with #assert_nil. Also added better output for
+ #assert_kind_of.
+
+ * test/testunit/tc_assertions.rb: ditto.
+
+Sat Nov 8 18:50:20 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/wsdl/raa/*: add new testcase for WSDL loading, parsing and
+ reading.
+
+ * test/soap/marshal/*: backport from soap4r/1.5.1. all differences are
+ for ruby/1.6.
+
+ * lib/soap/*: backport from soap4r/1.5.1. all differences are for
+ ruby/1.6.
+
+ * lib/wsdl/data.rb, lib/wsdl/xmlSchema/data.rb: move definition of
+ ArrayTypeAttrName from ::WSDL::XMLSchema::* to ::WSDL::*.
+ [ruby-talk:84813]
+
+ * lib/wsdl/soap/definitions.rb: element name typo in custom exception
+ struct definition which is needed for wsdlDriver; camelCase ->
+ underscore_name.
+
+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.
+
+Sat Nov 8 06:19:38 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c: To fix 'pthread-enabled Tcl/Tk' problem,
+ TclTkIp#_eval calls Tcl_Eval() on the mainloop thread only
+ (queueing a handler to the EventQueue).
+
+ * ext/tcltklib/README.1st: edit the description of '--with-pthread-ext'
+
+Fri Nov 7 23:23:04 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pathname.rb (Pathname#+): if self or the argument is `.', return
+ another.
+ (Pathname#parent): if self is `.', return `..'.
+ (Pathname#children): if self is `.', don't prepend self for a
+ pathname in a result.
+ (Pathname#join): re-implemented using Pathname#+.
+ (Pathname#find): if self is `.', remove `./' prefix of yielding
+ pathname.
+
+Fri Nov 7 10:23:24 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/socket/socket.c (make_hostent): get rid of SEGV on aliases
+ lookup failure. (ruby-bugs:PR#1215)
+
+Fri Nov 7 04:08:05 2003 UENO Katsuhiro <katsu@blue.sky.or.jp>
+
+ * ext/zlib/zlib.c (Init_zlib): define Zlib::GzipReader#each_line as
+ an alias of Zlib::GzipReader#each.
+
+Fri Nov 7 01:03:16 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_load): save and restore rb_prohibit_interrupt.
+ [ruby-dev:21857]
+
+Thu Nov 6 18:05:07 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_io_inspect): show the path also at a closed file.
+ [ruby-dev:21851]
+
+Thu Nov 6 11:42:07 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_set_string, strio_reopen): check
+ tainted.
+
+ * ext/stringio/stringio.c (strio_copy, strio_ungetc, strio_write,
+ strio_putc): add infection.
+
+ * ext/stringio/stringio.c (strio_path): just nil. [ruby-dev:21846]
+
+ * ruby.c (proc_options): reserve searched script path in the
+ source file name table. [ruby-list:38765]
+
+ * lib/optparse.rb (OptionParser::Completion#complete): default not to
+ ignore case on completion. [ruby-talk:84726]
+
+ * win32/win32.c (make_cmdvector): process backslashes even if a quote
+ is not enclosed.
+
+Wed Nov 5 23:49:45 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * sample/openssl/gen_csr.rb: there (at least) is a CA which does not
+ accept DN in UTF8STRING format. it's a sample.
+
+Wed Nov 5 22:55:16 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * configure.in, eval.c, signal.c: : add '--with-pthread-ext'
+ option to fix the pthread trouble on 'tcltklib'
+
+ * ext/tcltklib/README.1st: add the description of '--with-pthread-ext'
+
+ * ext/tk/lib/tktext.rb : add TkText#text_copy, text_cut, text_paste
+ to support Tcl/Tk8.4's tk_textCopy, tk_textCut, tk_textPaste
+
+ * ext/tk/lib/tk.rb : add TkMenu#set_focus support Tcl/Tk's
+ tk_menuSetFocus
+
+Wed Nov 5 17:33:45 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_load): allow interrupt during loaded program
+ evaluation. [ruby-dev:21834]
+
+ * hash.c (rb_hash_fetch): always warn if default argument and a
+ block are supplied at the same time. [ruby-dev:21842]
+
+ * hash.c (env_fetch): ditto.
+
+ * array.c (rb_ary_fetch): ditto.
+
+Wed Nov 5 19:08:47 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser::Switch::PlacedArgument::parse):
+ do not remove next argument if empty value is placed.
+
+ * test/optparse: added.
+
+Wed Nov 5 17:05:18 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/ui/gtk/testrunner.rb: typo.
+
+Wed Nov 5 11:13:32 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * string.c: add #include "version.h". this file still depends on it.
+
+ * Makefile.in, bcc32/Makefile.sub, win32/Makefile.sub,
+ wince/Makefile.sub: add version.h dependency to string.c.
+
+Wed Nov 5 09:14:23 2003 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/monitor.rb: revert to the previous revision.
+
+Wed Nov 5 08:39:51 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/https.rb (HTTPRequest#parse): set @client_cert_chain.
+
+ * lib/webrick/https.rb (HTTPRequest#meta_vars): create
+ SSL_CLIENT_CERT_CHAIN_n from @client_cert_chain.
+
+ * ext/openssl/ossl_ssl.c (ossl_ssl_get_peer_cert_chain): return nil
+ if no cert-chain was given.
+
+Tue Nov 4 23:44:48 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * bcc32/Makefile.sub, win32/Makefile.sub, wince/Makefile.sub:
+ remove needless version.h dependency.
+
+Tue Nov 4 23:38:43 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * class.c, hash.c, string.c: remove #include "version.h".
+
+ * Makefile.in: remove needless version.h dependency.
+
+Tue Nov 4 06:54:52 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (read_all): fptr->f may be NULL, if IO is closed in the
+ signal handler.
+
+ * io.c (io_read): ditto.
+
+ * string.c (get_pat): remove 1.8.0 warning code.
+
+ * string.c (rb_str_match): extend warning until 1.8.2.
+
+ * string.c (rb_str_match2): ditto.
+
+ * class.c (class_instance_method_list): remove 1.8.0 warnings.
+ method_list now recurs. [ruby-dev:21816]
+
+ * class.c (rb_obj_singleton_methods): ditto.
+
+ * array.c (rb_ary_select): remove select with block.
+ [ruby-dev:21824]
+
+ * hash.c (rb_hash_select): ditto.
+
+ * hash.c (env_select): ditto.
+
+ * re.c (match_select): ditto.
+
+ * struct.c (rb_struct_select): ditto.
+
+Mon Nov 3 22:53:21 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/racc/parser.rb: synchronize with Racc 1.4.4.
+
+ * ext/racc/cparse/cparse.c: ditto.
+
+ * ext/racc/cparse/cparse.c (parse_main): should abort when
+ the length of LR state stack <=1, not ==0.
+
+Mon Nov 3 08:50:47 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * process.c (check_uid_switch): remove duplicated error messages.
+
+ * process.c (check_gid_switch): ditto.
+
+Sun Nov 2 02:28:33 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/ssl.rb: new option :SSLExtraChainCert.
+
+Sun Nov 2 01:02:04 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * string.c (rb_str_hash): Update the HASH_PERL alternative hash
+ algorithm in sync with Perl 5.8.
+
+ * st.c (strhash): Ditto.
+
+Sat Nov 1 18:21:09 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_ssl.c (ossl_ssl_peer_cert_chain): add new method
+ SSLSocket#peer_cert_chain.
+
+ * ext/openssl/ossl_x509req.c (GetX509ReqPtr): new function
+ which returns underlying X509_REQ.
+
+ * ext/openssl/ossl_x509ext.c (ossl_x509extfactory_set_issuer_cert,
+ ossl_x509extfactory_set_subject_cert, ossl_x509extfactory_set_crl,
+ ossl_x509extfactory_set_subject_req, ossl_x509extfactory_set_config):
+ use underlying C struct without duplication not to leak momory.
+
+Sat Nov 1 01:49:03 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/soap/mapping/factory.rb: mark marshalled basetype objects when
+ @allow_original_mapping is true. multi-referencing basetype node is
+ prohibited in SOAP/1.1 encoding but soap4r's original ruby object
+ mapping requires basetype to be marked to detect self referencing
+ loop. e.g. o = 1; o.instance_eval { @iv = o } soap4r's original
+ mapping is only used through soap/marshal API.
+
+ * test/soap/marshal/test_marshal.rb: add tests for self referencing
+ immutable objects.
+
+ * test/soap/calc/test_calc_cgi.rb: fix test name.
+
+Fri Oct 31 22:26:29 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+
+ * wince/string_wce.c (strrchr): should decrement pointer.
+
+ * wince/Makefile.sub: correct a range of isdigit().
+
+Fri Oct 31 12:55:24 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in, lib/mkmf.rb: add RPATHFLAG for NetBSD.
+ [ruby-dev:21791]
+
+ * bcc32/Makefile.sub, win32/Makefile.sub, win32/Makefile.sub: ditto.
+
+Fri Oct 31 01:38:14 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * wince/Makefile.sub, win32/Makefile.sub (.y.c): allow white spaces
+ at the beginning of line to remove by sed. (ruby-bugs-ja:PR#580)
+
+Fri Oct 31 01:02:24 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * compar.c (cmp_equal): protect exceptions from <=> comparison
+ again. returns nil if any exception or error happened during
+ comparison.
+
+ * eval.c (search_required): should update *featurep when DLEXT2 is
+ defined. (ruby-bugs-ja:PR#581)
+
+Thu Oct 30 23:41:04 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/drb/drb.rb: add DRbArray
+
+ * lib/drb/invokemethod.rb: fix Hash#each problem. [ruby-dev:21773]
+
+ * lib/drb/unix.rb: add LoadError. [ruby-dev:21743]
+
+Thu Oct 30 23:19:11 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/soap/generator.rb: better XML pretty printing.
+
+ * lib/soap/encodingstyle/soapHandler.rb: remove unnecessary namespace
+ assignment in the element which has "encodingStyle" attribute, and
+ add necessary namespace assignment for "arrayType" attribute.
+
+ * test/soap/calc/test_calc_cgi.rb: take over $DEBUG to ruby process
+ through CGI.
+
+Thu Oct 30 22:59:39 2003 why the lucky stiff <why@ruby-lang.org>
+
+ * ext/syck/yaml2byte.c: HASH const too long. Thanks, matz.
+
+Thu Oct 30 19:13:53 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/syck/MANIFEST: Add yamlbyte.h.
+
+Thu Oct 30 14:25:31 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (READ_DATA_BUFFERED): new macro to detect whether stdio
+ buffer filled.
+
+ * io.c (rb_io_fptr_cleanup): move path deallocation to
+ rb_io_fptr_finalize (finalizer called by GC).
+
+Thu Oct 30 13:23:39 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (logop): left may be NULL. [ruby-talk:84539]
+
+ * eval.c (rb_eval): NODE_CASE nd_head may be NULL.
+
+Thu Oct 30 10:14:51 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/test/unit/autorunner.rb: make fox runner work.
+
+Thu Oct 30 09:32:26 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * process.c (rb_f_system): fixed lack of security check before
+ calling do_spawn() on win32. [ruby-talk:84555]
+
+Thu Oct 30 02:46:35 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (proc_invoke): single array value to normal Proc#call
+ (i.e. not via lambda call), should be treated just like yield.
+ [ruby-dev:21726]
+
+Thu Oct 30 02:25:48 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/lib/openssl/buffering.rb (Buffering#initialize):
+ add new method to inherit @sync from @io.sync.
+
+ * ext/openssl/lib/net/protocols.rb (SSLIO#ssl_connect): no need to
+ set sync flag explicitly.
+
+ * ext/openssl/ossl_ssl.c (ossl_sslctx_initialize): call super.
+
+ * ext/openssl/ossl_ssl.c (ossl_sslctx_setup): set extra chain
+ certificates in @extra_chain_cert.
+
+Wed Oct 29 22:02:04 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/drb/drbtest.rb: use rbconfig.rb to make the path of ruby
+ interpreter to exec, instead of test/ruby/envutil.rb,
+
+Wed Oct 29 19:58:59 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/tcltklib/tcltklib.c (CONST84): define CONST84 when it is not
+ defined and TCL_MAJOR_VERSION >= 8.
+
+ * ext/tcltklib/tcltklib.c (VwaitVarProc, WaitVariableProc,
+ rb_threadVwaitProc): use CONST84 instead of CONST.
+
+ * ext/tcltklib/tcltklib.c (ip_rbTkWaitCommand,
+ ip_rb_threadTkWaitCommand): use CONST84 always.
+
+Wed Oct 29 17:27:05 2003 Tanaka Akira <akr@m17n.org>
+
+ * re.c (rb_reg_s_union, Init_Regexp): new method `Regexp.union'.
+
+ * lib/pathname.rb (realpath): examine Dir.pwd because it may have
+ symlinks.
+
+Wed Oct 29 17:16:31 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_longjmp): must not disturb original jump.
+ [ruby-dev:21733]
+
+Wed Oct 29 15:28:34 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (Init_Proc): taint preallocated exception object
+ sysstack_error. [ruby-talk:84534]
+
+Wed Oct 29 11:27:39 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (ret_args): node may be NULL. [ruby-talk:84530]
+
+Tue Oct 28 15:20:12 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/tcltklib/tcltklib.c (VwaitVarProc, ip_rbVwaitObjCmd,
+ WaitVariableProc, WaitVisibilityProc, WaitWindowProc,
+ ip_rbTkWaitObjCmd, ip_rbTkWaitCommand, rb_threadVwaitProc,
+ rb_threadWaitVisibilityProc, rb_threadWaitWindowProc,
+ ip_rb_threadVwaitObjCmd, ip_rb_threadTkWaitObjCmd): prototype;
+ avoid VC++ warnings.
+
+Mon Oct 27 19:19:55 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_longjmp): ignore reentering error while warning.
+ [ruby-dev:21730]
+
+Mon Oct 27 00:23:50 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c (ip_ruby): bug fix on Win : hang-up when
+ calling 'exit' in the Tk callback procedure. [ruby-list:38656]
+
+Sat Oct 25 09:18:04 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_method_missing): protect exception from within
+ "inspect". (ruby-bugs:PR#1204)
+
+Fri Oct 24 23:26:34 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (rb_hash_each): Hash#each should yield single value.
+ [ruby-talk:84420]
+
+ * hash.c (env_each): ditto for ENV.each.
+
+Thu Oct 23 20:25:32 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/server.rb (GenericServer#start): should rescue
+ IOError from IO::accept. [ruby-dev:21692]
+
+Thu Oct 23 17:59:36 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (ruby_cleanup): initialize stack bottom for embedding.
+ [ruby-dev:21686]
+
+ * ext/dl/extconf.rb: move list of files to clean from DEPEND file,
+ to get rid of macro redefinitions.
+
+Thu Oct 23 13:44:00 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y: integrate operations for stack_type. [ruby-dev:21681]
+
+Thu Oct 23 00:41:45 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/soap/calc/*, test/soap/helloworld/*: set logging threshold
+ to ERROR.
+
+Wed Oct 22 12:53:31 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/collector/dir.rb (Test::Unit::Collector::Dir#collect_file):
+ ignore tests which raised LoadError.
+
+ * test/drb/drbtest.rb, test/ruby/test_beginendblock.rb,
+ test/ruby/test_system.rb: avoid requiring same file twice.
+
+ * test/drb/test_drbssl.rb, test/drb/test_drbunix.rb: should not use
+ ARGV unless invoked directly. do not create test cases unless
+ required libraries are available.
+
+Wed Oct 22 02:31:34 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (ruby_cleanup): should not ignore exit_value in END
+ execution. [ruby-dev:21670]
+
+Tue Oct 21 23:16:26 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (ruby_cleanup): call finalizers and exit procs before
+ terminating threads.
+
+ * eval.c (ruby_cleanup): preserve ruby_errinfo before ruby_finalize_0().
+
+Tue Oct 21 15:57:11 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/collector/dir.rb (Test::Unit::Collector::Dir#collect_file):
+ prepend the directory of target file to the load path.
+
+Tue Oct 21 15:08:53 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (do_spawn, do_aspawn): should wait child process even
+ if callded with P_OVERLAY.
+
+ * win32/win32.c (do_spawn, do_aspawn): should return child's exit
+ status to parent.
+
+Tue Oct 21 00:35:02 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/soap/calc/*, test/soap/helloworld/*: catch the exception from
+ test server thread and recover.
+
+Tue Oct 21 00:22:57 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * test/drb/*: import drb/runit.
+
+Mon Oct 20 23:55:47 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_eval): set current node after arguments evaluation.
+ [ruby-dev:21632]
+
+ * eval.c (rb_yield_0): set current node and keep it at local jump.
+
+Mon Oct 20 22:01:18 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_thread_cleanup): keep thread group for main thread.
+ [ruby-dev:21644]
+
+Mon Oct 20 18:28:10 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_catch): backout.
+
+Mon Oct 20 17:31:46 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (PUSH_FRAME): generate unique number to be TAG_JUMP()
+ destination.
+
+ * eval.c (localjump_destination): use unique number in ruby_frame
+ for localjump destination.
+
+Mon Oct 20 11:31:44 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_signal.rb (test_signal): restore old trap.
+
+Mon Oct 20 11:00:46 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (gc_sweep): loosen page free condition to avoid add_heap()
+ race condition. [ruby-dev:21633]
+
+ * gc.c (gc_sweep): do not update malloc_limit when malloc_increase
+ is smaller than malloc_limit.
+
+Mon Oct 20 09:45:12 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/debug.rb (debug_command): remove debug print.
+
+Wed Oct 20 00:25:41 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (search_required): required name must not be changed before
+ loading. [ruby-dev:24492]
+
+Sun Oct 19 13:12:30 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pathname.rb (foreachline, dir_foreach): add obsolete warning.
+
+Sun Oct 19 00:14:22 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/soap/calc/*, test/soap/helloworkd/*: changed port# of test
+ server. (17171)
+
+Sat Oct 18 23:01:32 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * missing/acosh.c (DBL_MANT_DIG): typo fix(ifdef -> ifndef).
+
+Sat Oct 18 05:48:59 2003 why the lucky stiff <why@ruby-lang.org>
+
+ * ext/syck/rubyext.c: YAML::Syck::compile method.
+
+ * ext/syck/syck.c: Buffer edge bug.
+
+ * ext/syck/yaml2byte.c: YAML to bytecode converter.
+
+ * ext/syck/yamlbyte.h: Ditto.
+
+ * ext/syck/bytecode.c: Bytecode parser fixes to empty collections
+ and empty strings.
+
+ * ext/syck/token.c: Ditto.
+
+Fri Oct 17 23:07:38 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/enumerator/enumerator.c, ext/enumerator/enumerator.txt:
+ Provide Kernel#to_enum as an alias for Kernel#enum_for. Maybe
+ this is a better name.
+
+Fri Oct 17 23:00:30 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/generator.rb: Add rdoc documentation.
+
+Fri Oct 17 22:16:42 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb: Reword and fix Overview.
+
+ * lib/set.rb: It is not necessary to require
+ 'test/unit/ui/console/testrunner'.
+
+Fri Oct 17 11:15:22 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_range.rb: added.
+
+ * MANIFEST: add test/ruby/test_range.rb.
+
+Fri Oct 17 03:21:23 2003 William Sobel <will.sobel@barra.com>
+
+ * ext/socket/socket.c (make_hostent): h_aliases may be NULL.
+ (ruby-bugs:PR#1195)
+
+ * ext/socket/socket.c (sock_s_gethostbyaddr): ditto.
+
+Fri Oct 17 00:12:41 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: (bug fix) instance variable @frame was used
+ without initializing on TkComposite module.
+
+Thu Oct 16 23:51:04 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: If $DEBUG == true and some exception is caused
+ in a callback operation, Ruby/Tk shows a (verbose) backtrace
+ information on the callback process.
+
+Thu Oct 16 17:09:19 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/debug.rb (DEBUGGER__::Context::debug_command): do not call
+ debug_silent_eval() when $1 is not set. (ruby-bugs:PR#1194)
+
+Thu Oct 16 16:54:57 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_upto): ("a"..."a").to_a should return [].
+ [ruby-core:01634]
+
+Thu Oct 16 16:40:51 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb:
+ Add Tk::EncodedString and Tk::UTF8_String class to support
+ characters using the \uXXXX escape to the UNICODE string.
+
+ * ext/tk/sample/{demos-en,demos-jp}/unicodeout.rb
+ new demo-scripts (samples of Tk::UTF8_String)
+
+ * ext/tk/sample/{demos-en,demos-jp}/widget
+ add entries for 'unicodeout.rb'
+
+Thu Oct 16 08:38:06 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/digest/test_digest.rb (test_eq): show failed class.
+
+ * test/ruby/test_iterator.rb (test_break, test_return_trace_func):
+ test localjump destination.
+
+Wed Oct 15 20:22:31 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/soap/netHttpClient.rb: use URI::HTTP#request_uri instead of
+ instance_eval('path_query'). [ruby-list:38575]
+
+Wed Oct 15 17:24:45 2003 URABE Shyouhei <root@mput.dip.jp>
+
+ * lib/cgi.rb (CGI::Cookie): tiny typo fix.
+
+Wed Oct 15 15:00:54 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (ruby_run): just return FAILURE instead of parse error
+ count. [ruby-list:38569]
+
+Wed Oct 15 13:17:02 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/digest/digest.c (rb_digest_base_alloc): need to initialize
+ buffer. [ruby-dev:21622]
+
+Wed Oct 15 11:23:05 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_object): dump extended modules as well.
+
+ * marshal.c (r_object0): TYPE_USRMARSHAL should restore extended
+ modules before invoking marshal_load. these two fixes are done
+ by Masatoshi Seki <m_seki@mva.biglobe.ne.jp>.
+
+Wed Oct 15 09:30:34 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/enumerator/enumerator.c (enumerator_each): avoid VC++ warning.
+
+ * ext/syck/syck.h: include stdio.h for definition of FILE.
+
+Wed Oct 15 08:09:07 2003 why the lucky stiff <why@ruby-lang.org>
+
+ * ext/syck/bytecode.c: Checkin of YAML bytecode support.
+
+ * ext/syck/gram.c: Ditto.
+
+ * ext/syck/syck.c: Ditto.
+
+ * ext/syck/token.c: Ditto.
+
+ * ext/syck/handler.c: Ditto.
+
+ * ext/syck/handler.c: Now using 'tag' rather than 'taguri' in type URIs.
+
+ * ext/syck/rubyext.c: Ditto (on both counts).
+
+Wed Oct 15 05:05:53 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/generator.rb: A new library which converts an internal
+ iterator to an external iterator.
+
+ * lib/abbrev.rb: A new library which creates an abbreviation table
+ from a list.
+
+Wed Oct 15 04:31:51 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/sample/demos-en/entry3.rb, ext/tk/sample/demos-jp/entry3.rb :
+ new demo-scripts
+
+ * ext/tk/sample/demos-en/widget, ext/tk/sample/demos-jp/widget :
+ add entries for 'entry3.rb'
+
+Wed Oct 15 04:31:47 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * test/digest/test_digest.rb: Moved from ext/digest/test.rb.
+
+Wed Oct 15 03:53:20 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: fixed trouble on auto-load Tcl commands (enbug
+ on the last commit).
+
+Wed Oct 15 00:25:00 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): argument parentheses preceded by spaces should
+ be warned; not error. [ruby-talk:84103]
+
+Wed Oct 15 00:20:15 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c: replace Tcl/Tk's vwait and tkwait to
+ switch on threads smoothly and avoid seg-fault.
+
+ * ext/tcltklib/tcltklib.c: add TclTkIp._thread_vwait and
+ _thread_tkwait for waiting on a thread. (Because Tcl/Tk's vwait
+ and tkwait command wait on an eventloop.)
+
+ * ext/tk/lib/multi-tk.rb: support TclTkIp._thread_vwait and
+ _thread_tkwait.
+
+ * ext/tk/lib/tk.rb: now, TkVariable#wait has 2 arguments.
+ If 1st argument is true, waits on a thread. If false, waits on
+ an eventloop. If 2nd argument is true, checks existence of
+ rootwidgets. If false, doesn't. Default is wait(true, false).
+
+ * ext/tk/lib/tk.rb: add TkVariable#tkwait(arg) which is equal to
+ TkVariable#wait(arg, true). wait_visibility and wait_destroy
+ have an argument for waiting on a thread or an eventloop.
+
+ * ext/tk/lib/tk.rb: improve of accessing Tcl/Tk's special variables.
+
+ * ext/tk/lib/tkafter.rb: support 'wait on a thread' and 'wait on
+ an eventloop'.
+
+Wed Oct 15 00:10:24 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/soap/baseData.rb: Introduce SOAPType as the common ancestor of
+ SOAPBasetype and SOAPCompoundtype.
+
+ * lib/soap/generator.rb, lib/soap/element.rb, lib/soap/encodingstyle/*:
+ Encoding methods signature change. Pass SOAPGenerator as a parameter.
+
+ * lib/soap/mapping/*, test/soap/marshal/test_marshal.rb: Refactoring
+ for better marshalling/unmarshalling support. Now I think SOAP
+ marshaller supports all kind of object graph which is supported by
+ Ruby's original marshaller. Of course there could be bugs as always.
+ Find it. :-)
+
+ * lib/soap/rpc/standaloneServer.rb: Set severity threshould to INFO.
+ DEBUG is too noisy.
+
+ * lib/xsd/datatypes.rb: DateTime#of is obsoleted. Use DateTime#offset.
+
+ * test/wsdl/emptycomplextype.wsdl, test/xsd/xmlschema.xml: Avoid
+ useless warning.
+
+Tue Oct 14 19:09:35 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (ruby_finalize_0): return the given exit status unless
+ SystemExit got raised.
+
+Tue Oct 14 11:53:49 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * intern.h (ruby_stop): never return.
+
+ * ruby.h (ruby_run): ditto.
+
+Tue Oct 14 04:43:55 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pathname.rb (realpath): make ELOOP check bit more robust.
+ (children): prepend self by default.
+ (chroot): obsoleted.
+
+Tue Oct 14 02:29:31 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_require_safe): segfault after loading .so.
+
+Tue Oct 14 02:05:23 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/Setup*, ext/enumerator/*: Add ext/enumerator, a helper
+ module for the Enumerable interface.
+
+Mon Oct 13 23:55:59 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * test/ruby/envutil.rb: use Config::CONFIG["ruby_install_name"],
+ not "ruby".
+
+Mon Oct 13 23:57:29 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_feature_p): match by classified suffix.
+
+ * eval.c (rb_require_safe): require library in the specified safe
+ level.
+
+ * variable.c (rb_autoload, rb_autoload_load): restore safe level
+ when autoload was called. [ruby-dev:21338]
+
+ * intern.h: prototypes; rb_require_safe.
+
+ * test/runner.rb: accept non-option arguments.
+
+Mon Oct 13 20:49:51 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (str_new4): should not preserve FL_TAINT status in the
+ internal shared string. [ruby-dev:21601]
+
+ * string.c (rb_str_new4): ditto.
+
+ * eval.c: use EXIT_SUCCESS and EXIT_FAILURE for exit values.
+
+ * process.c: ditto. [ruby-list:38521]
+
+Mon Oct 13 19:51:02 2003 Koji Arai <jca02266@nifty.ne.jp>
+
+ * lib/debug.rb (debug_command): should enter emacs mode when
+ assigned any value to the environment variable "EMACS".
+ On Meadow, (getenv "EMACS") is "meadow".
+
+Sun Oct 12 14:45:03 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/win32ole/extconf.rb: check "windows.h", not "windows".
+ [ruby-talk:84051]
+
+Sat Oct 11 20:41:03 2003 Corinna Vinschen <corinna@vinschen.de>
+
+ * file.c (eaccess): Use access(2) on Cygwin.
+
+Sat Oct 11 17:09:21 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/rexml/quickpath.rb (REXML::QuickPath::match):
+ escape '[' to avoid warning.
+
+Sat Oct 11 16:08:41 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pathname.rb (realpath): check existence of the file.
+
+ * lib/pathname.rb (realpath): re-implemented.
+ (realpath_root?, realpath_rec): removed
+
+Sat Oct 11 10:19:39 2003 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/monitor.rb: handle exceptions correctly. Thanks, Gennady
+ Bystritsky.
+
+Fri Oct 10 07:50:54 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (is_defined): inheritance line adjustment as like as
+ rb_call_super().
+
+Fri Oct 10 01:19:00 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_x509name.c (ossl_x509name_initialize): add
+ optional argument to specify the DirectoryString type
+ (ASN1::UTF8STRING by default). RFC3280 deprecates PrintableString
+ for DirectoryString, and strongly requires to use UTF8String for
+ all certificates issued after December, 31 2003.
+
+ * ext/openssl/lib/openssl/x509.rb (X509::Name::parse): ditto.
+
+Thu Oct 9 23:50:21 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_thread_start_0): prevent thread from GC.
+ [ruby-dev:21572]
+
+Thu Oct 9 19:11:44 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_thread_start_0): non-volatile should be restored from
+ volatile.
+
+Thu Oct 9 17:43:36 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (proc_save_safe_level, proc_get_safe_level,
+ proc_set_safe_level): save/restore safe level 1..4.
+
+Thu Oct 9 16:33:23 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (r_object0): remove unnecessary iv restoration for
+ USRMARSHAL. [ruby-dev:21582]
+
+ * marshal.c (w_object): dump generic instance variables from
+ a string from '_dump'.
+
+ * variable.c (rb_generic_ivar_table): return 0 if obj's FL_EXIVAR
+ is not set.
+
+ * time.c (time_dump): copy instance variables to dumped string, to
+ be included in the marshaled data.
+
+ * bignum.c (rb_big2ulong): add range check to ensure round trip.
+
+Thu Oct 9 15:45:27 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * pack.c (uv_to_utf8): change message to "out of range", since
+ negative values are not "too big". [ruby-dev:21567]
+
+Thu Oct 9 14:05:38 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_set_end_proc, rb_exec_end_proc): restore safe level.
+ [ruby-dev:21557]
+
+Thu Oct 9 10:51:04 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_yield_0): no error if block is empty.
+
+Thu Oct 9 06:43:33 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (localjump_error): id should be ID.
+
+ * eval.c (rb_eval): nd_rval is set in copy_node_scope().
+
+ * eval.c (rb_yield_0): unused variable.
+
+ * eval.c (rb_yield_0): nothing to do for empty node.
+
+ * eval.c (call_end_proc, proc_invoke): adjust backtrace in END.
+ [ruby-dev:21551]
+
+ * eval.c (rb_thread_start_0): set the value by break as the result.
+ [ruby-dev:21552]
+
+ * eval.c (rb_thread_start_0, rb_thread_raise, rb_callcc): save
+ variables across THREAD_SAVE_CONTEXT.
+
+Thu Oct 9 12:05:46 2003 Eric Sunshine <sunshine@sunshineco.com>
+
+ * configure.in: revived NextStep, OpenStep, and Rhapsody ports which
+ had become unbuildable; enhanced --enable-fat-binary option so that
+ it accepts a list of desired architectures (rather than assuming a
+ fixed list), or defaults to a platform-appropriate list if user does
+ not provide an explicit list; made the default list of architectures
+ for MAB (fat binary) more comprehensive; now uses -fno-common even
+ when building the interpreter (in addition to using it for
+ extensions), thus allowing the interpreter to be embedded into a
+ plugin module of an external project (in addition to allowing
+ embedding directly into an application); added checks for
+ <netinet/in_systm.h> (needed by `socket' extension) and getcwd(); now
+ ensures that -I/usr/local/include is employed when extensions'
+ extconf.rb scripts invoke have_header() since extension checks on
+ NextStep and OpenStep will fail without it if the desired resource
+ resides in the /usr/local tree; fixed formatting of --help message.
+
+ * Makefile.in: $(LIBRUBY_A) rule now deletes the archive before
+ invoking $(AR) since `ar' on Apple/NeXT can not "update" MAB archives
+ (see configure's --enable-fat-binary option); added rule for new
+ missing/getcwd.c.
+
+ * defines.h: fixed endian handling during MAB build (see configure's
+ --enable-fat-binary option) to ensure that all portions of the
+ project see the correct WORDS_BIGENDIAN value (some extension modules
+ were getting the wrong endian setting); added missing constants
+ GETPGRP_VOID, WNOHANG, WUNTRACED, X_OK, and type pid_t for NextStep
+ and OpenStep; removed unnecessary and problematic HAVE_SYS_WAIT_H
+ define in NeXT section.
+
+ * dir.c: do not allow NAMLEN() macro to trust dirent::d_namlen on
+ NextStep since, on some installations, this value always resolves
+ uselessly to zero.
+
+ * dln.c: added error reporting to NextStep extension loader since the
+ previous behavior of failing silently was not useful; now ensures
+ that NSLINKMODULE_OPTION_BINDNOW compatibility constant is defined
+ for OpenStep and Rhapsody; no longer includes <mach-o/dyld.h> twice
+ on Rhapsody since this header lacks multiple-include protection,
+ which resulted in "redefinition" compilation errors.
+
+ * main.c: also create hard reference to objc_msgSend() on NeXT
+ platforms (in addition to Apple platforms).
+
+ * lib/mkmf.rb: now exports XCFLAGS from configure script to extension
+ makefiles so that extensions can be built MAB (see configure's
+ --enable-fat-binary option); also utilize XCFLAGS in cc_command()
+ (but not cpp_command() because MAB flags are incompatible with
+ direct invocation of `cpp').
+
+ * ext/curses/extconf.rb: now additionally checks for presence of these
+ curses functions which are not present on NextStep or Openstep:
+ bkgd(), bkgdset(), color(), curs(), getbkgd(), init(), scrl(), set(),
+ setscrreg(), wattroff(), wattron(), wattrset(), wbkgd(), wbkgdset(),
+ wscrl(), wsetscrreg()
+
+ * ext/curses/curses.c: added appropriate #ifdef's for additional set of
+ curses functions now checked by extconf.rb; fixed curses_bkgd() and
+ window_bkgd() to correctly return boolean result rather than numeric
+ result; fixed window_getbkgd() to correctly signal an error by
+ returning nil rather than -1.
+
+ * ext/etc/etc.c: setup_passwd() and setup_group() now check for null
+ pointers before invoking rb_tainted_str_new2() upon fields extracted
+ from `struct passwd' and `struct group' since null pointers in some
+ fields are common on NextStep/OpenStep (especially so for the
+ `pw_comment' field) and rb_tainted_str_new2() throws an exception
+ when it receives a null pointer.
+
+ * ext/pty/pty.c: include "util.h" for strdup()/ruby_strdup() for
+ platforms such as NextStep and OpenStep which lack strdup().
+
+ * ext/socket/getaddrinfo.c: cast first argument of getservbyname(),
+ gethostbyaddr(), and gethostbyname() from (const char*) to non-const
+ (char*) for older platforms such as NextStep and OpenStep.
+
+ * ext/socket/socket.c: include "util.h" for strdup()/ruby_strdup() for
+ platforms such as NextStep and OpenStep which lack strdup(); include
+ <netinet/in_systm.h> if present for NextStep and OpenStep; cast first
+ argument of gethostbyaddr() and getservbyname() from (const char*) to
+ non-const (char*) for older platforms.
+
+ * ext/syslog/syslog.c: include "util.h" for strdup()/ruby_strdup() for
+ platforms such as NextStep and OpenStep which lack strdup().
+
+Wed Oct 8 22:19:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/test/unit.rb: removed installation instructions.
+
+ * lib/test/unit/ui/testrunnermediator.rb: moved the run flag to a more
+ central location.
+
+ * lib/test/unit.rb: ditto.
+
+ * lib/test/unit.rb: extracted the running code in to AutoRunner.
+
+ * lib/test/unit/autorunner.rb: added.
+
+ * lib/test/unit/collector/objectspace.rb: extracted common test
+ collection functionality in to a module.
+
+ * lib/test/unit/collector.rb: ditto; added.
+
+ * test/testunit/collector/test_objectspace.rb: ditto.
+
+ * lib/test/unit/collector/dir.rb: added. Supports collecting tests out
+ of a directory structure.
+
+ * test/testunit/collector/test_dir.rb: added.
+
+ * test/runner.rb: simplified to use the new capabilities.
+
+Tue Oct 7 15:23:09 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/ruby/test_beginendblock.rb: add tests for nested BEGIN/END.
+
+ * test/ruby/beginmainend.rb: add tests for nested BEGIN/END.
+
+ * test/ruby/endblockwarn.rb: new file added to test of END-in-method
+ warning.
+
+Tue Oct 7 12:23:47 2003 Tanaka Akira <akr@m17n.org>
+
+ * ext/fcntl/fcntl.c (Init_fcntl): define Fcntl::O_ACCMODE.
+
+ * ext/socket/extconf.rb: useless assignment removed.
+
+Tue Oct 7 09:13:24 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_beginendblock.rb (test_endinmethod): END{} is now
+ allowed in eval.
+
+Tue Oct 7 04:15:25 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (stmt): should not expand mrhs if lhs is solely starred.
+
+Tue Oct 7 02:57:53 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (stmt): rhs of multiple assignment should not be
+ expanded using "to_a". [ruby-dev:21527]
+
+Tue Oct 7 01:42:34 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_asn1.c (ossl_asn1_get_asn1type): use appropriate
+ free function for ASN1_OBJECT.
+
+ * ext/openssl/ossl_asn1.c (ossl_asn1obj_get_sn): add new function for
+ ASN1::ObjectId#sn; it returns short name text representation of OID.
+
+ * ext/openssl/ossl_asn1.c (ossl_asn1obj_get_ln): add new function for
+ ASN1::ObjectId#ln; it returns long name text representation of OID.
+
+ * ext/openssl/ossl_asn1.c (ossl_asn1obj_get_oid): add new function for
+ ASN1::ObjectId#oid; it returns numerical representation of OID.
+
+Mon Oct 6 22:59:46 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/csv.rb (IOReader, BasicWriter): call binmode when a given IO
+ respond_to?(:binmode). record separator was wrong when you gave
+ text mode IO to Reader.parse and Writer.generate.
+
+ * test/csv/test_csv.rb: add tests for above change.
+
+Sun Oct 5 23:27:09 2003 Tanaka Akira <akr@m17n.org>
+
+ * ext/socket/extconf.rb: check recvmsg even if sendmsg is exists.
+
+ * ext/socket/socket.c (thread_read_select): restored.
+
+Mon Oct 6 16:23:38 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c (w_object): wrong method name in the message.
+
+Mon Oct 6 16:02:05 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (stmt): END in method should cause warning.
+ [ruby-dev:21519]
+
+Mon Oct 6 15:17:23 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/ruby/test_iterator.rb (test_block_argument_without_paren):
+ added. (follows sample/test.rb)
+
+Mon Oct 6 11:57:06 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/ruby/test_beginendblock.rb, test/ruby/beginmainend.rb: added
+ test for eval-ed BEGIN END order.
+
+Mon Oct 6 09:19:54 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_object): should pass "weak" value to next level.
+ [ruby-dev:21496]
+
+ * eval.c (proc_alloc): should not use cached object if klass is
+ different. [ruby-talk:83685]
+
+Sun Oct 5 23:27:09 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pathname.rb: version information is added in document.
+
+Sun Oct 5 23:07:03 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_f_END): block should be given. [ruby-dev:21497]
+
+Sun Oct 5 22:51:23 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/ext/openssl/extconf.rb: add check for some engine functions
+ unavailable in OpenSSL-0.9.6.
+
+ * lib/ext/openssl/ossl_engine.c: ditto.
+
+Sun Oct 5 17:56:30 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_eval): fix evaluation order. [ruby-list:38431]
+
+Sun Oct 5 15:05:06 2003 akira yamada <akira@ruby-lang.org>
+
+ * test/uri/*: translated RUNIT to Test::Unit.
+
+Sun Oct 5 14:37:39 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/xsd/datatypes.rb: Rational -> Decimal string bug fix.
+
+ * test/soap/marshal/test_marshal.rb: ditto.
+
+ * test/soap/calc/test_calc_cgi.rb: add Config::CONFIG["EXEEXT"] to
+ RUBYBIN.
+
+Sun Oct 5 13:47:22 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/ruby/test_beginendblock.rb, test/ruby/beginmainend.rb: add tests
+ about scope, order and allowed syntax.
+
+Sun Oct 5 11:54:29 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/ruby/envutil.rb: added. split "rubybin" from test_system.rb.
+
+ * test/ruby/test_system.rb: use envutil.rb
+
+ * test/ruby/test_beginendblock.rb: added.
+
+ * test/ruby/beginmainend.rb: added. used in test_beginendblock.rb.
+
+Sun Oct 5 11:23:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * test/testunit/runit/test_testresult.rb: removed some unnecessary
+ cruft.
+
+Sun Oct 5 11:14:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/rubyunit.rb: aliasing TestCase into the top level is
+ problematic.
+
+ * lib/runit/assert.rb: fixed a couple of bugs caused by recent
+ refactoring in Test::Unit.
+
+ * test/testunit/runit/*: added.
+
+Sun Oct 5 10:55:29 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/open-uri.rb (URI::Generic#find_proxy): no_proxy support did not
+ work. [ruby-dev:21484]
+
+Sun Oct 5 09:52:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb: will use pp for output if available.
+ Can be disabled by setting Assertions.use_pp = false.
+
+ * test/testunit/test_assertions.rb: made a small change to exception
+ formatting.
+
+Sun Oct 5 07:42:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb: made small improvements to assertion
+ messages. Deprecated Assertions#assert_not_nil; use #assert instead.
+
+ * test/testunit/test_assertions.rb: ditto.
+
+ * test/testunit/util/test_procwrapper.rb: use #assert instead of
+ #assert_not_nil.
+
+Sun Oct 5 04:10:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb: refactored message building.
+
+Sun Oct 5 03:40:22 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_asn1.h: global symbols should be declared
+ as external.
+
+Sun Oct 5 03:03:20 2003 akira yamada <akira@ruby-lang.org>
+
+ * test/ruby/test_exception.rb (test_else): added.
+
+Sun Oct 5 02:12:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb: changed assertion messages to rely more
+ heavily on #inspect. Added backtrace filtering for exceptions in
+ assertion messages.
+
+ * test/testunit/test_assertions.rb: ditto.
+
+Sun Oct 5 02:12:00 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/drb/acl.rb, lib/drb/ssl.rb: added.
+
+ * lib/drb/drb.rb: exit from a thread using 'break'.
+
+Sat Oct 4 21:49:14 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * gc.c (Init_stack): the type of space is changed to unsigned int
+ from double. [ruby-dev:21483]
+
+Sat Oct 4 17:52:59 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/soap/netHttpClient.rb: follow http-access2. hosts which matches
+ ENV['no_proxy'] or ENV['NO_PROXY'] are not proxyed.
+ - [,:] separated. ("ruby-lang.org:rubyist.net")
+ - no regexp. (give "ruby-lang.org", not "*.ruby-lang.org")
+ - if you want specify host by IP address, give full address.
+ ("192.168.1.1, 192.168.1.2")
+
+ * lib/soap/rpc/cgistub.rb: return "Status: XXX MMM" line.
+
+ * test/runner.rb: give testsuite name.
+
+Sat Oct 4 15:16:02 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_object): instance variable dump do not cause error
+ for objects that cannot be dumped, if they traversed from
+ marshal_dump. they are just ignored.
+
+ * gc.c (Init_stack): cast "space" (doble value) into unsigned
+ int. should run on PowerPC.
+
+ * eval.c (rb_eval): should not execute else part if any exception
+ is caught. [ruby-dev:21482]
+
+ * parse.y (f_args): should allow unparenthesized block argument.
+
+ * parse.y (f_rest_arg): should allow unparenthesized rest
+ argument.
+
+Sat Oct 4 14:59:51 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pathname.rb (initialize): raise ArgumentError if argument has
+ '\0' character.
+ (relative_path_from): new method.
+ (each_entry): new method for replacement of dir_foreach.
+ (foreach, foreachline, dir_foreach, chdir): obsoleted.
+
+Sat Oct 4 12:58:48 2003 akira yamada <akira@ruby-lang.org>
+
+ * test/uri/* (6 files): added.
+
+Sat Oct 4 12:44:45 2003 akira yamada <akira@ruby-lang.org>
+
+ * lib/uri/ftp.rb, lib/uri/mailto.rb: renamed to #to_s from #to_str.
+
+Sat Oct 4 07:33:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/test/unit/testsuite.rb: changed #<< to return self, and added
+ #delete.
+
+ * test/testunit/test_testsuite.rb: ditto. Also slightly refactored
+ #test_size.
+
+ * lib/test/unit/collector/objectspace.rb: collector now preserves the
+ hierarchy of suites.
+
+ * test/testunit/collector/test_objectspace.rb: ditto.
+
+Sat Oct 4 04:48:49 2003 why the lucky stiff <why@ruby-lang.org>
+
+ * ext/syck/rubyext.c: default keys handled.
+
+ * ext/syck/syck.h: lowered default buffer size to 16k for increased
+ performance.
+
+ * test/yaml: checkin of basic unit tests.
+
+Sat Oct 4 04:24:19 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/extconf.rb: add check for X509V3_set_nconf.
+
+ * ext/openssl/ossl_x509ext.c (ossl_x509extfactory_set_config):
+ cannot implement if X509V3_set_nconf doesn't exist.
+
+Sat Oct 4 02:12:44 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/xsd/datatypes.rb: dump sign by itself. under the problematic
+ platform, sprintf("%+.10g", -0.0) => +0. sigh.
+
+ * sample/wsdl/amazon/*: update schema ver2 to ver3.
+
+Sat Oct 4 01:33:46 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pathname.rb (initialize): duplicate and freeze argument.
+ (to_s): return duplicated string.
+ (children): new method.
+ (each_line): new alias to foreachline.
+
+Fri Oct 3 16:13:19 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_asn1.c: add DER encoder and decoder.
+
+ * ext/openssl/ossl_asn1.h: add OpenSSL::ASN1 module.
+
+ * ext/openssl/ossl.c (Init_openssl): call Init_ossl_asn1.
+
+ * ext/openssl/extconf.rb: check if X509_ATTRIBUTE has field "single".
+
+ * ext/openssl/ossl_x509attr.c (ossl_x509attr_set_value): accept
+ DER encoded data argument.
+
+ * ext/openssl/ossl_x509attr.c (ossl_x509attr_get_value): return
+ DER encoded data in OpenSSL::ASN1 types.
+
+Fri Oct 3 13:02:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/test/unit.rb: refactored to use optparse.
+
+ * lib/test/unit.rb: added support for selecting the output
+ level from the command-line.
+
+ * lib/test/unit.rb: added a command-line switch to stop processing
+ the command-line, allowing arguments to be passed to tests.
+
+ * lib/test/unit.rb: changed the method for specifying a runner or a
+ filter from the command-line.
+
+ * lib/test/unit/collector/objectspace.rb: fixed a bug causing all
+ tests to be excluded when the filter was set to an empty array.
+
+ * test/testunit/collector/test_objectspace.rb: ditto.
+
+Fri Oct 3 08:14:32 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/irb/ruby-lex.rb (RubyLex::identify_identifier): support
+ 'class ::Foo' syntax. [ruby-talk:83514]
+
+Fri Oct 3 08:01:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb: added a default message for #assert,
+ #assert_block, and #flunk.
+
+ * test/testunit/test_assertions.rb: ditto.
+
+ * lib/test/unit/failure.rb: failures now show a better trace of where
+ they occurred.
+
+ * test/testunit/test_failure.rb: ditto (added).
+
+ * lib/test/unit/testcase.rb: ditto.
+
+ * test/testunit/test_testcase.rb: ditto.
+
+ * lib/test/unit/util/backtracefilter.rb: added.
+
+ * test/testunit/util/test_backtracefilter.rb: added.
+
+ * lib/test/unit/error.rb: changed to use BacktraceFilter and improved
+ output.
+
+ * test/testunit/test_error.rb: ditto.
+
+Thu Oct 2 20:33:49 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/iconv/iconv.c (iconv_failure_initialize): conform with
+ orthodox initialization method.
+
+ * ext/iconv/iconv.c (iconv_fail): initialize exception instance
+ from the class, and do not share instance variables with the
+ others. [ruby-dev:21470]
+
+Thu Oct 2 18:20:27 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * time.c (Init_Time): define initialize. [ruby-dev:21469]
+
+Thu Oct 2 17:39:38 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_engine.c: add a new module OpenSSL::Engine.
+ it supports OpenSSL hardware cryptographic engine interface.
+
+ * ext/openssl/ossl_engine.h: ditto.
+
+ * ext/openssl/MANIFEST: add ossl_engine.c and ossl_engine.h.
+
+ * ext/openssl/extconf.rb: add check for openssl/engine.h.
+
+ * ext/openssl/ossl.c: call Init_ossl_engine().
+
+ * ext/openssl/ossl.h: include openssl/engine.h.
+
+ * ext/openssl/ossl_pkey_{rsa,dsa,dh}.c: check if underlying
+ EVP_PKEY referes engine.
+
+Thu Oct 2 17:22:37 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_load): restore instance variables (if any) before
+ loading from marshaled data.
+
+Thu Oct 2 14:19:15 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/iconv/iconv.c (iconv_fail): now yield erred substring, and
+ set error object to $!.
+
+ * ext/iconv/iconv.c (iconv_convert): error handler block should
+ return appended part and the rest. if rest is nil, the
+ conversion stops.
+
+Thu Oct 2 12:00:18 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * variable.c (rb_const_defined_0): look up constants in Object as
+ well. [ruby-dev:21458]
+
+ * test/ruby/test_defined.rb (TestDefined::test_defined): test for
+ constants.
+
+Thu Oct 2 11:17:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb: should not capture an
+ AssertionFailedError unless explicitly requested.
+
+ * test/testunit/test_assertions.rb: ditto.
+
+ * test/testunit/collector/test_objectspace.rb: fixed a test failure
+ caused by methods being returned in different orders on different
+ platforms by moving test sorting from TestSuite into the locations
+ where suites are constructed. [ruby-talk:83156]
+
+ * lib/test/unit/testcase.rb: ditto.
+
+ * lib/test/unit/testsuite.rb: ditto.
+
+ * lib/test/unit/collector/objectspace.rb: ditto.
+
+Thu Oct 2 03:25:01 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * eval.c (rb_thread_raise): prototype; avoid VC++ warning.
+
+Thu Oct 2 01:37:34 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_mdump): new marshal dumper. _dump is still
+ available for compatibility.
+
+ * time.c (time_mload): new marshal loader.
+
+ * marshal.c (w_object): preserve instance variables for objects
+ with marshal_dump.
+
+ * marshal.c (r_object0): restore instance variables before calling
+ marshal_load.
+
+ * error.c (rb_warn_m): always return nil.
+
+Thu Oct 2 01:32:46 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_f_block_given_p): real required condition is
+ ruby_frame->prev->iter == ITER_CUR.
+
+ * eval.c (rb_block_given_p): ditto.
+
+ * eval.c (block_pass): update ruby_frame->iter only when previous
+ value is ITER_NOT.
+
+Thu Oct 2 01:02:35 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_const_defined_at): should exclude constants from
+ Object when TYPE(klass) == T_MODULE *and* exclude is on.
+ [ruby-dev:21458]
+
+ * variable.c (rb_const_get_0): do not lookup constants from Object
+ when TYPE(klass) == T_MODULE *and* exclude is on.
+
+Thu Oct 2 00:21:11 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/logger/test_logger.rb: unlinking file before close causes
+ problem under win32 box.
+
+ * lib/xsd/datatypes.rb(XSDFloat, XSDDouble): add +/- sign explicitly
+ when stringified and embedded into XML instance. Ruby's sprintf may
+ format -0.0 as "0.0" (no minus sign) depending on underlying C
+ sprintf implementation.
+
+ * test/xsd/test_xsd.rb, test/soap/test_basetype.rb: follow above change.
+
+ * test/soap/calc/*: give httpd config param "CGIInterpreter".
+ "/usr/bin/env ruby" thing does not work under non-Unix boxes.
+
+Sat Oct 2 00:42:20 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (r_byte): retrieve pointer from string value for each
+ time. [ruby-dev:24404]
+
+ * marshal.c (r_bytes0): ditto.
+
+ * enum.c (sort_by_i): re-entrance check added. [ruby-dev:24399]
+
+ * io.c (io_read): should freeze all reading buffer.
+ [ruby-dev:24400]
+
+ * string.c (rb_str_sum): should use bignums when bits is greater
+ than or equals to sizeof(long)*CHAR_BITS. [ruby-dev:24395]
+
+ * eval.c (specific_eval): defer pointer retrieval to prevent
+ unsafe sourcefile string modification. [ruby-dev:24382]
+
+ * string.c (rb_str_sum): wrong cast caused wrong result.
+ [ruby-dev:24385]
+
+ * enum.c (enum_sort_by): hide temporary array from
+ ObjectSpace.each_object. [ruby-dev:24386]
+
+ * string.c (rb_str_sum): check was done with false pointer.
+ [ruby-dev:24383]
+
+ * string.c (rb_str_sum): string may be altered. [ruby-dev:24381]
+
+Thu Oct 2 00:25:21 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * signal.c (ruby_signal_name): adjust to the prototype.
+
+ * process.c (pst_inspect): ditto.
+
+ * ext/etc/etc.c (etc_getgrent, Init_etc): typo.
+
+Wed Oct 1 20:49:41 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (heaps): manage slots and limits together. [ruby-dev:21453]
+
+ * gc.c (add_heap): should not clear heaps slot even if realloc()
+ failed.
+
+Wed Oct 1 20:36:49 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * MANIFEST: add wince/mkconfig_wce.rb.
+
+Wed Oct 1 17:22:33 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/etc/etc.c: add new functions: setpwent, getpwent, endpwent,
+ setgrent, getgrent, endgrent.
+
+ * ext/socket/socket.c (sock_s_gethostbyname): do not reverse lookup.
+
+Wed Oct 1 17:01:30 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_load): Object scope had priority over required file
+ scope. [ruby-dev:21415]
+
+Wed Oct 01 14:09:53 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+
+ * wince/mkconfig_wce.rb: sorry, forget to commit.
+
+Wed Oct 01 10:08:42 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+
+ * wince/setup.mak: add sigmarionIII SDK support.
+
+ * wince/Makefile.sub: ditto.
+
+ * wince/mkexports.rb: fix linker error in SH4.
+
+ * wince/mkconfig_wce.rb: camouflage RUBY_PLATFORM for compiling ext.
+
+Wed Oct 01 08:02:52 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+
+ * wince/time_wce.c (time): add zero check.
+
+Tue Sep 30 16:11:05 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * Makefile.in: copy lex.c from $(srcdir) if it's not the current
+ directory. [ruby-dev:21437]
+
+Tue Sep 30 11:29:23 2003 Tanaka Akira <akr@m17n.org>
+
+ * process.c (pst_inspect): describe stopped process "stopped".
+
+Tue Sep 30 09:31:56 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/runner.rb: glob for directories.
+
+Tue Sep 30 09:11:43 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): while/until should not capture break unless
+ they are destination of the break.
+
+Tue Sep 30 03:12:02 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb (finish): revert to 1.93.
+
+ * lib/net/pop.rb (finish): revert to 1.60.
+
+ * lib/net/smtp.rb (finish): revert to 1.67.
+
+ * lib/net/http.rb (do_start): ensure to close socket if failed to
+ start session.
+
+ * lib/net/pop.rb (do_start): ditto.
+
+ * lib/net/smtp.rb (do_start): ditto.
+
+ * lib/net/smtp.rb: SMTP#started? wrongly returned false always.
+
+Tue Sep 30 02:54:49 2003 Minero Aoki <aamine@loveruby.net>
+
+ * test/ruby/test_iterator.rb: new test
+ test_break__nested_loop[123].
+
+Mon Sep 29 23:39:13 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb (finish): does not raise IOError even if
+ !started?, to allow closing socket which was opened before
+ session started.
+
+ * lib/net/pop.rb (finish): ditto.
+
+ * lib/net/smtp.rb (finish): ditto.
+
+Mon Sep 29 19:06:51 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/win32ole/extconf.rb: add windows.h checking.
+ (ruby-bugs:PR#1185)
+
+Mon Sep 29 16:18:30 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/logger.rb: check if the given logdevice object respond_to :write
+ and :close, not is_a? IO. duck duck.
+
+ * test/logger/test_logger.rb: self IO.pipe reading/writing may be
+ locked by the flood. use tempfile.
+
+ * lib/wsdl/xmlSchema/data.rb: wrong constant reference.
+
+Mon Sep 29 16:11:23 2003 Minero Aoki <aamine@loveruby.net>
+
+ * test/fileutils/test_fileutils.rb: clean up temporary symlink.
+ Patched by NaHi. [ruby-dev:21420]
+
+Mon Sep 29 11:16:55 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_atfork): wrong format specifier.
+ [ruby-dev:21428]
+
+ * process.c (pst_inspect): better description.
+
+Mon Sep 29 02:31:44 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/utils.rb (Utils::su): use setgid and setuid to
+ set real and effective IDs. and setup group access list by
+ initgroups.
+
+Sun Sep 28 11:14:19 2003 Koji Arai <jca02266@nifty.ne.jp>
+
+ * ext/digest/digest.c (Init_digest): `copy_object' was deprecated.
+ `initialize_copy' should be defined.
+
+ * ext/stringio/stringio.c (Init_stringio): ditto.
+
+Sat Sep 27 18:25:13 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/xsd/charset.rb: XSD::Charset.is_ces did return always true under
+ $KCODE = "NONE" environment. check added.
+
+ * test/xsd/test_xsd.rb: add tests for above fix.
+
+Sat Sep 27 15:58:50 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/soap/rpc/cgistub.rb: make logging severity threshold higher.
+
+ * lib/soap/rpc/standaloneServer.rb: defer WEBrick server start to give
+ a chance to reset logging severity threshold.
+
+ * test/soap/calc/test_*, test/soap/helloworld/test_helloworld.rb: run
+ silent.
+
+Sat Sep 27 09:44:18 2003 Minero Aoki <aamine@loveruby.net>
+
+ * test/fileutils/test_fileutils.rb: clear all errors on Windows.
+ [ruby-dev:21417]
+
+ * test/fileutils/test_nowrite.rb: ditto.
+
+Mon Sep 27 09:14:03 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_delete): comparison may change the capacity.
+ [ruby-dev:24348]
+
+ * array.c (rb_ary_fill): fill should honor length argument.
+ [ruby-dev:24346]
+
+ * array.c (rb_ary_replace): should not use ptr from shared array.
+ [ruby-dev:24345]
+
+ * ext/socket/socket.c (s_accept): don't retry for EWOULDBLOCK.
+ [ruby-talk:113807]
+
+Sat Sep 27 04:57:07 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/ruby/test_file.rb: new file. only asserts unlink-before-close
+ behaviour now.
+
+ * test/soap/marshal/test_digraph.rb: should close before unlink.
+ unlink-before-close pattern is not needed here.
+
+Sat Sep 27 03:32:37 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/soap/*, test/wsdl/*, test/xsd/*: move TestCase classes into
+ each module namespace. TestMarshal in
+ test/soap/marshal/test_marshal.rb crashed with
+ test/ruby/test_marshal.rb.
+
+Sat Sep 27 01:30:59 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/socket/socket.c (ruby_connect): on win32, type of the 4th
+ argument of getsockopt is char *.
+
+Fri Sep 26 18:35:40 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/resolv-replace.rb: 1.8 compliance. [ruby-talk:82946]
+
+Fri Sep 26 17:39:27 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/ruby/test_marshal.rb: add test for ruby's objects.
+
+Fri Sep 26 09:52:44 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * defines.h (flush_register_windows): use volatile only for gcc on
+ Solaris. [ruby-dev:21403]
+
+ * lib/mkmf.rb (xsystem): use system directly to honor shell meta
+ charaters.
+
+Fri Sep 26 00:10:13 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/README: updated.
+
+Thu Sep 25 17:48:10 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/openssl/ossl.c (ossl_buf2str): fix type of 1st argument for
+ rb_protect.
+
+ * ext/openssl/ossl_hmac.c (ossl_hmac_digest): should return meaningful
+ value.
+
+Thu Sep 25 09:00:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/ostruct.rb: Added OpenStruct#==.
+
+ * test/ostruct/test_ostruct.rb: Added.
+
+Thu Sep 25 07:55:26 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/win32ole/win32ole.c, ext/openssl/ossl_pkey_dsa.c,
+ ext/openssl/ossl_pkey_rsa.c, ext/bigdecimal/bigdecimal.h: must
+ not use C++ or C99 style comment yet. (ruby-bugs:PR#1184)
+
+Thu Sep 25 00:23:22 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * MANIFEST: add SOAP4R.
+
+Thu Sep 25 00:13:15 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/soap/* (29 files): SOAP4R added.
+
+ * lib/wsdl/* (42 files): WSDL4R added.
+
+ * lib/xsd/* (12 files): XSD4R added.
+
+ * test/soap/* (16 files): added.
+
+ * test/wsdl/* (2 files): added.
+
+ * test/xsd/* (3 files): added.
+
+ * sample/soap/* (27 files): added.
+
+ * sample/wsdl/* (13 files): added.
+
+Wed Sep 24 02:08:11 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/httpservlet/cgihandler.rb: conform to mswin32.
+ [ruby-talk:82735], [ruby-talk:82748], [ruby-talk:82818]
+
+Tue Sep 23 23:10:16 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/logger.rb: add Logger#<<(msg) for writing msg without any
+ formatting.
+
+ * test/logger/test_logger.rb: ditto.
+
+Tue Sep 23 20:47:51 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * error.c (rb_warn_m): should not warn if -W0 is specified.
+ [ruby-talk:82675]
+
+Mon Sep 22 21:28:57 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * MANIFEST: updated.
+
+Mon Sep 22 19:22:26 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * configure.in (AC_CHECK_FUNCS): add setuid and setgid.
+
+Mon Sep 22 12:34:55 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * util.c (ruby_strtod): skip preceding zeros before counting
+ digits in the mantissa. (ruby-bugs:PR#1181)
+
+Sun Sep 21 04:12:36 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_ocsp.c (ossl_ocspreq_initialize): the argument
+ should be a String.
+
+ * ext/openssl/ossl_ocsp.c (ossl_ocspres_initialize): ditt.
+
+ * ext/openssl/ossl_x509attr.c (ossl_x509attr_initialize): ditto.
+
+ * ext/openssl/ossl_x509ext.c (ossl_x509ext_initialize): ditto.
+
+ * ext/openssl/ossl_x509ext.c (ossl_x509ext_set_value): ditto.
+
+Sat Sep 20 11:49:05 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/logger.rb: typo fixed.
+
+ * test/logger/test_logger.rb: new file.
+
+Fri Sep 19 11:39:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * test/testunit/*: Added.
+
+ * lib/test/unit.rb: Documentation update.
+
+ * lib/test/unit/ui/console/testrunner.rb (TestRunner#initialize):
+ Ditto.
+
+ * lib/test/unit.rb: Factored out an ObjectSpace collector.
+
+ * lib/test/unit/collector/objectspace.rb: Ditto.
+
+ * sample/testunit/*: Added.
+
+Fri Sep 19 01:00:48 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/log.rb (BasicLog#log): get rid of as ineffectual
+ condition.
+
+ * lib/webrick/log.rb (BasicLog#format): add "\n" to message.
+
+Thu Sep 18 22:43:20 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (proc_invoke): should push PROT_PCALL tag for orphans.
+
+ * eval.c (proc_invoke): should update "result" for orphans.
+
+Thu Sep 18 20:33:03 2003 Tietew <tietew-ml-ruby-list@tietew.net>
+
+ * parse.y (str_xquote): do not prepend escapes in
+ backqoute literals. [ruby-list:38409]
+
+Thu Sep 18 20:30:17 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pathname.rb: update document.
+
+Thu Sep 18 15:27:05 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/logger.rb: new file. Logger, formerly called devel-logger or
+ Devel::Logger.
+
+ * sample/logger/*: new file. samples of logger.rb.
+
+Wed Sep 17 23:41:45 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (localjump_destination): should not raise ThreadError
+ exception for "break". [ruby-dev:21348]
+
+ * eval.c (proc_invoke): use result instead of prot_tag->retval.
+ retval is no longer propagated to the ancestors.
+
+Wed Sep 17 20:34:00 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (tokadd_string, parse_string, yylex): escaped terminator
+ is now interpreted as is. [ruby-talk:82206]
+
+Wed Sep 17 18:52:36 2003 Minero Aoki <aamine@loveruby.net>
+
+ * test/fileutils/fileassertions.rb: new file.
+
+ * test/fileutils/test_fileutils.rb: new file.
+
+ * test/fileutils/test_nowrite.rb: new file.
+
+Wed Sep 17 18:51:02 2003 Minero Aoki <aamine@loveruby.net>
+
+ * test/strscan/test_stringscanner.rb: require test/unit.
+
+Wed Sep 17 18:35:34 2003 Minero Aoki <aamine@loveruby.net>
+
+ * test/strscan/test_stringscanner.rb: new file.
+
+Wed Sep 17 18:03:30 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl: all files are reviewed to simplify and avoid memory leak.
+
+ * ext/openssl/extconf.rb: add check for assert.h.
+
+ * ext/openssl/ossl.c (ossl_buf2str): new function to convert
+ C buffer to String and free buffer.
+
+ * ext/openssl/ossl.c (ossl_x509_ary2sk): new function to convert
+ Array of OpenSSL::X509 to STACK_OF(X509) with exception safe.
+
+ * ext/openssl/ossl.c (ossl_to_der, ossl_to_der_if_possible): new
+ functions to convert object to DER string.
+
+ * ext/openssl/ossl.h: ditto.
+
+ * ext/openssl/ossl_bio.c (ossl_membio2str): new function to convert
+ BIO to String object and free BIO.
+
+ * ext/openssl/ossl_bio.h: ditto.
+
+ * ext/openssl/ossl_pkcs7.c (ossl_pkcs7_to_der): add for "to_der".
+
+ * ext/openssl/ossl_x509name.c (ossl_x509name_to_der): ditto.
+
+ * ext/openssl/ossl_x509ext.c (ossl_x509ext_to_der): ditto.
+
+ * ext/openssl/ossl_x509ext.c (create_ext_from_array): removed
+ and reimplement in openssl/x509.rb.
+
+ * ext/openssl/ossl_x509attr.c: reimplemented and disable some
+ method temporarily. this class doesn't work fine without ASN.1
+ data support;-) I'll rewrite in near future.
+
+ * ext/openssl/lib/openssl/x509.c (X509::Attribute): get rid off
+ unused code.
+
+ * ext/openssl/lib/openssl/x509.c (X509::ExtensionFactory): refine all.
+
+Tue Sep 16 22:25:06 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/csv/test_csv.rb: add negative tests of row_sep.
+
+Tue Sep 16 18:02:36 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_compile_pattern): should not translate character
+ class range edge. [ruby-list:38393]
+
+Tue Sep 16 16:47:56 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * MANIFEST: add test/csv/mac.csv.
+
+ * win32/Makefile.sub, bcc32/Makefile.sub (test): add phony NUL target.
+
+Mon Sep 15 19:02:52 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/csv.rb: add extra pamameter to specify row(record) separater
+ character. To parse Mac's CR separated CSV, do like this.
+ CSV.open("mac.csv", "r", ?,, ?\r) { |row| p row.to_a }
+ The 3rd parameter in this example ?, is for column separater and the
+ 4th ?\r is for row separater. Row separater is nil by default. Nil
+ separater means "\r\n" or "\n".
+
+ * test/csv/test_csv.rb: add tests for above feature.
+
+ * test/csv/mac.csv: added. Sample CR separated CSV file.
+
+Fri Sep 12 22:41:48 2003 Michal Rokos <m.rokos@sh.cvut.cz>
+
+ * ext/openssl/ossl.c: move ASN.1 stuff to ossl_asn1.[ch]
+
+ * ext/openssl/ossl.c: move BIO stuff to ossl_bio.[ch]
+
+ * ext/openssl/ossl_asn1.[ch]: new files
+
+ * ext/openssl/ossl_bio.[ch]: new files
+
+Fri Sep 12 12:30:41 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * intern.h (rb_disable_super, rb_enable_super): replace with dummy
+ expressions instead of prototypes. the functions remain yet for
+ binary compatibility. [ruby-talk:81758]
+
+Fri Sep 12 12:09:54 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big_and): convert argument using 'to_int'.
+
+ * bignum.c (rb_big_or): ditto.
+
+ * bignum.c (rb_big_xor): ditto.
+
+Fri Sep 12 07:06:14 2003 David Black <dblack@superlink.net>
+
+ * lib/scanf.rb: Took out useless @matched_item variable; some small
+ refactoring.
+
+Thu Sep 11 08:43:44 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_f_require): allow "require" on $SAFE>0, if feature
+ name is not tainted.
+
+ * lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser::stream):
+ Supports StringIO.
+
+Wed Sep 10 22:47:30 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl.h: add a workaround for win32 platform.
+ libeay32.dll doesn't export functions defined in conf_api.h.
+
+ * ext/openssl/ossl_config.c (ossl_config_initialize): ditto.
+
+ * ext/openssl/ossl_config.c (ossl_config_add_value): ditto.
+
+ * ext/openssl/ossl_config.c (set_conf_section_i): should check
+ if the argument is Array.
+
+Wed Sep 10 22:41:54 2003 Tietew <tietew@tietew.net>
+
+ * eval.c (win32_get_exception_list): avoid VC7 warning.
+ [ruby-win32:577]
+
+Tue Sep 9 10:39:51 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (struct tag): dst should be VALUE.
+
+Tue Sep 9 10:39:51 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (localjump_destination): stop at the scope where the current
+ block was created. [ruby-dev:21353]
+
+Tue Sep 9 05:17:04 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_config.rb: avoid compile error in OpenSSL-0.9.6.
+
+Tue Sep 9 02:41:35 2003 Michal Rokos <m.rokos@sh.cvut.cz>
+
+ * ext/openssl/ossl_config.c: Refine compatibility.
+
+Tue Sep 9 01:50:45 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/httpserver.rb (HTTPServer#access_log): add "\n" to
+ the message.
+
+ * lib/webrick/log.rb (BasicLog#log): add "\n" only if needed.
+
+Mon Sep 8 22:15:33 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/multi-tk.rb: modify security check at creating
+ a new interpreter
+
+Mon Sep 8 20:00:12 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb, lib/optparse/version.rb: search also all
+ capital versions.
+
+Mon Sep 8 19:26:33 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl.h: include openssl/conf.h and openssl/conf_api.h.
+
+ * ext/openssl/ossl_config.c: refine all with backward compatibility.
+
+ * ext/openssl/ossl_config.h: export GetConfigPtr() and DupConfigPtr().
+
+ * ext/openssl/ossl_x509.c: added new constants under X509 module.
+ DEFAULT_CERT_AREA, DEFAULT_CERT_DIR, DEFAULT_CERT_FILE,
+ DEFAULT_CERT_DIR_ENV, DEFAULT_CERT_FILE_ENV and DEFAULT_PRIVATE_DIR.
+
+ * ext/openssl/ossl_x509ext.c (ossl_x509extfactory_free): don't free
+ the members of the struct. it's left to GC.
+
+ * ext/openssl/ossl_x509ext.c (ossl_x509_set_config): add for config=.
+
+ * ext/openssl/ossl_x509ext.c (Xossl_x509extfactory_initialize):
+ add attr readers: issuer_certificate, subject_certificate,
+ subject_request, crl and config.
+
+Mon Sep 8 18:26:41 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/accesslog.rb (AccessLog::setup_params): use req.port
+ instead of config[:Port] or req.request_uri.port.
+
+ * lib/webrick/httprequest.rb (HTTPRequest#meta_vars): ditto.
+
+ * lib/webrick/httpservlet/filehandler.rb (FileHandler#dir_list): ditto.
+
+ * lib/webrick/config.rb: :Listen option never be used.
+
+ * lib/webrick/server.rb (GenericServer#initialize): don't use :Listen
+ option and add warning message.
+
+ * lib/webrick/log.rb (BasicLog#<<): shortcut of log(INFO, ...).
+
+ * lib/webrick/httpserver.rb (HTTPServer#accesslog): use << for logging.
+
+Sun Sep 7 16:08:28 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c (lib_mainloop_core): fixed signal-trap bug
+
+ * ext/tk/lib/*.rb : Ruby/Tk works at $SAFE == 4
+
+Sat Sep 6 02:26:34 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/ruby/test_*.rb: assert_same, assert_match, and so on.
+
+Sat Sep 6 18:45:46 2003 Mauricio Fernandez <batsman.geo@yahoo.com>
+
+ * parse.y (assignable): call rb_compile_error(), not rb_bug().
+ [ruby-core:01523]
+
+Sat Sep 6 17:40:41 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ruby_missing.c: rid of unnecessary backward
+ compatibility stuff. and remove DEFINE_ALLOC_WRAPPER from
+ all sources.
+
+ * ext/openssl/ossl_x509ext.c (X509::Extension.new): new method.
+
+ * ext/openssl/ossl_x509ext.c (X509::Extension#oid=): new method.
+
+ * ext/openssl/ossl_x509ext.c (X509::Extension#value=): new method.
+
+ * ext/openssl/ossl_x509ext.c (X509::Extension#critical=): new method.
+
+Sat Sep 6 01:23:22 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (CreateChild): need to quote cmd if RUBYSHELL is set.
+
+ * win32/win32.c (CreateChild): fix condition about whether to call
+ shell or not.
+
+Sat Sep 6 00:36:20 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * Makefile.in (test): phony target.
+
+ * lib/mkmf.rb (have_library, find_library): configure by library
+ name.
+
+ * lib/optparse.rb (OptionParser#order, #permute, #parse): allow an
+ array as argument.
+
+ * test/ruby/test_*.rb: moved invariants to left side in
+ assert_equal, and use assert_nil, assert_raises and so on.
+
+ * win32/win32.c (isInternalCmd): distinguish command.com and
+ cmd.exe.
+
+ * win32/win32.c (make_cmdvector): a character just after wildcard
+ was ignored. [ruby-core:01518]
+
+Fri Sep 5 20:27:08 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/ruby/test_*.rb: replace 'assert(a == b)' with assert_equal(a, b)'
+
+Fri Sep 5 18:00:51 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/lib/openssl/x509.rb: new method X509::Name::parse.
+
+ * ext/openssl/ossl_digest.c: add ossl_digest_new().
+
+ * ext/openssl/ossl_digest.h: ditto.
+
+ * ext/openssl/ossl_cipher.c: add ossl_cipher_new().
+
+ * ext/openssl/ossl_cipher.h: ditto.
+
+Fri Sep 5 15:32:04 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-font-lock-maybe-here-docs): should not
+ search delimiter forward if found in backward.
+
+Fri Sep 5 13:32:48 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/runner.rb: arguments should be keys.
+
+Fri Sep 5 12:09:55 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * test/ruby/test_system.rb (test_system): check existence of ruby
+ interpreter.
+
+Fri Sep 5 11:32:17 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (--version): fix assignment/reference order.
+
+ * lib/optparse.rb (OptionParser#help): new; OptionParser#to_s may
+ be deprecated in future.
+
+ * lib/optparse/version.rb (OptionParser#show_version): hide Object.
+
+ * test/runner.rb: fix optparse usage.
+
+ * test/runner.rb: glob all testsuits if no tests given.
+
+Fri Sep 5 10:42:58 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/runner.rb: added. gets testcases from command line and runs it.
+
+ * test/ruby/test_gc.rb: remove useless part which was for dumping test
+ result.
+
+Fri Sep 5 09:28:59 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/ruby/test_gc.rb: added. splitter.rb which I made to split
+ sample/test.rb into test/ruby/test_* kindly removed GC test (the
+ last section in the original test) to reduce things to be worried.
+
+Fri Sep 5 03:00:04 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_iterator.rb (test_block_in_arg): add no block
+ given tests.
+
+ * test/ruby/test_iterator.rb (test_ljump): uncomment LocalJumpError
+ test.
+
+Fri Sep 5 01:10:11 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/ruby: tests for ruby itself.
+
+ * test/ruby/test_*.rb: split sample/test.rb into 28 test/unit testcases.
+ some tests could not be translates... search '!!' mark to see it.
+
+ * test/csv/test_csv.rb: should require 'csv', not '../lib/csv'. test
+ runner should set load path correctly.
+
+Fri Sep 5 01:03:59 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/csv/test_csv.rb: close opened files for CSV::IOBuf explicitly.
+ opened file cannot be removed under win32 box.
+
+Thu Sep 4 23:59:40 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (tokadd_string): newlines have no special meanings in
+ %w/%W, otherwise they are ignored only when interpolation is
+ enabled. [ruby-dev:21325]
+
+Thu Sep 4 19:38:25 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * ext/io/wait/.cvsignore: added.
+
+ * ext/openssl/.cvsignore: added.
+
+Thu Sep 4 19:28:24 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * sample/openssl: added. Sample of standard distribution library
+ should be locate in sample/{module_name}/*.
+
+ * ext/openssl/sample/*: removed. move to sample/openssl/*.
+
+Thu Sep 4 18:02:15 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/csv/test_csv.rb: use remove_const to reduce warnings. use
+ Dir.tmpdir to locate working files.
+
+Thu Sep 4 17:41:31 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-here-doc-beg-re): underscore also is
+ valid delimiter.
+
+ * misc/ruby-mode.el (ruby-here-doc-end-match): must quote
+ arbitrary string to use as regexp.
+
+ * misc/ruby-mode.el (ruby-font-lock-maybe-here-docs): must not
+ call `ruby-here-doc-end-match' unless `ruby-here-doc-beg-re'
+ matched.
+
+Thu Sep 4 15:40:07 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test/csv/test_csv.rb: run on test/unit original layer.
+
+Thu Sep 4 12:54:50 2003 why the lucky stiff <why@ruby-lang.org>
+
+ * ext/syck/token.c: headerless documents with root-level spacing now
+ honored.
+
+Thu Sep 4 00:06:14 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (mark_frame_adj): need to adjust argv pointer if using
+ system's alloca. [ruby-core:01503]
+
+Wed Sep 3 21:33:20 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * test: add test directory. Test::Unit aware testcases and needed
+ files should be located in this directory. dir/file name convention;
+ test/{module_name}/test_{testcase_name}.rb
+ test/{module_name}/{needed_files}
+ someday, someone will write testrunner which searches test_*.rb and
+ run testcases automatically.
+
+ * test/csv/*: add testcase for lib/csv.rb.
+
+Wed Sep 3 01:37:09 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_f_gets): should call next_argv() before type check
+ current_file. [ruby-list:38336]
+
+Tue Sep 2 20:37:15 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/lib/net/protocols.rb (SSLIO#ssl_connect): warning
+ for skipping server verification.
+
+Tue Sep 2 23:36:57 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (proc_invoke): should retrieve retval when pcall is true.
+
+Tue Sep 2 14:09:20 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/extconf.rb: check s6_addr8 in in6_addr (Tru64 UNIX).
+ the patch is submitted by nmu <nmu@users.sourceforge.jp>.
+
+ * ext/socket/getaddrinfo.c (getaddrinfo): should use in6_addr8 on
+ some platforms.
+
+ * ext/socket/getnameinfo.c (getnameinfo): ditto.
+
+Tue Sep 2 14:02:19 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c (ip_invoke): fixed bug on passing a exception
+
+ * ext/tk/lib/{tk.rb, tkcanvas.rb, tkfont.rb, tktext.rb} :
+ bug fix and improvement of font control
+
+Tue Sep 2 09:51:36 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_eval): should not handle exceptions within rescue
+ argument. [ruby-talk:80804]
+
+Tue Sep 2 00:44:37 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * re.c (rb_memsearch): fix overrun. [ruby-talk:80759]
+
+Tue Sep 2 00:41:27 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/iconv/iconv.c (map_charset): use lower case keys.
+
+ * ext/iconv/iconv.c (iconv_fail): just yield error and return the
+ result if a block is given.
+
+ * ext/iconv/iconv.c (iconv_convert): yield error and append the
+ result if a block is given.
+
+ * ext/iconv/charset_alias.rb (charset_alias): optional third
+ argument.
+
+ * ext/iconv/charset_alias.rb (charset_alias): use CP932 instead of
+ SHIFT_JIS on cygwin.
+
+Mon Sep 1 18:34:25 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_eval): make tail recursion in ELSE clause of
+ RESCUE a jump.
+
+Mon Sep 1 18:00:02 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (aref_args): forgot to call NEW_SPLAT(). reported by
+ Dave Butcher.
+
+ * eval.c (Init_Thread): protect thgroup_default. suggested by Guy
+ Decoux in [ruby-talk:80623]
+
+Mon Sep 1 16:59:10 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_thread_switch): add RESTORE_EXIT; exit by another
+ thread termination.
+
+ * eval.c (rb_thread_start_0): should not error_print() within
+ terminated thread, because $stderr used by it might be
+ overriden now. [ruby-dev:21280]
+
+Sun Aug 31 22:46:55 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * eval.c (TAG_DST()): take no argument.
+
+ * process.c (p_gid_sw_ensure): return VALUE.
+
+Sun Aug 31 22:27:10 2003 Hidetoshi NAGAI <nagai@dumbo.ai.kyutech.ac.jp>
+
+ * process.c (p_gid_sw_ensure): lack of function type
+
+Sun Aug 31 12:25:06 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/optparse.rb: --version takes an optional argument; "all" or
+ a list of package names.
+
+Sun Aug 31 10:17:02 2003 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb: yyyy/mm is not an acceptable format.
+
+ * lib/time.rb: follow above.
+
+Sat Aug 30 14:25:43 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_iter_break): should not call TAG_JUMP directly.
+
+Sat Aug 30 03:58:21 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (struct BLOCK): remove BLOCKTAG, use scope instead.
+
+ * eval.c (POP_TAG): no longer propagate retval. retval is now set
+ directly by localjump_destination().
+
+ * eval.c (localjump_destination): new function to cast
+ return/break local jump.
+
+ * eval.c (rb_yield_0): stop TAG_RETURN/TAG_BREAK escaping.
+
+Fri Aug 29 22:35:00 2003 Shigeo Kobayashi <shigek@ruby-lang.org>
+
+ * bigdecimal.c *.html: The 2nd arg. for add,sub,mult, and div is 0,
+ then result will be the same as +,-,*,/ respectively.
+
+Fri Aug 29 17:30:15 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * process.c: bug fix
+
+ * process.c: add rb_secure(2) to methods of Process::{UID,GID,Sys}
+
+ * process.c: deny handling IDs during evaluating the block given to
+ the Process::{UID,GID}.switch method
+
+ * ext/tcltklib/tcltklib.c : some methods have no effect if on slave-IP
+
+ * ext/tcltklib/tcltklib.c : can create a interpreter without Tk
+
+ * ext/tcltklib/tcltklib.c : bug fix on handling exceptions
+
+ * ext/tcltklib/MANUAL.euc : modify
+
+ * ext/tk/lib/tk.rb : freeze some core modules
+
+ * ext/tk/lib/multi-tk.rb : more secure
+
+ * ext/tk/lib/tk.rb: TkVariable.new(array) --> treat the array as the
+ Tk's list
+
+ * ext/tk/lib/tk.rb: improve accessibility of TkVariable object
+
+ * ext/tk/lib/tk.rb, ext/tk/lib/tkfont.rb, ext/tk/lib/tkcanvas.rb,
+ ext/tk/lib/tktext.rb : fix bug of font handling
+
+ * ext/tk/lib/tkfont.rb TkFont.new() accepts compound fonts
+
+Thu Aug 28 22:07:12 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_autoload_load): call const_missing if autoloading
+ constant is not defined to allow hook.
+
+ * eval.c (rb_eval): use rb_const_get_from() instead of
+ rb_const_get_at().
+
+ * eval.c (is_defined): forgot to check NODE_COLON3.
+
+Thu Aug 28 17:30:24 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_const_get_0): should check constants defined in
+ included modules, if klass is Object. [ruby-talk:79302]
+
+ * numeric.c (check_uint): check should be done using UINT_MAX, not
+ INT_MAX. this fix is submitted by Lyle Johnson
+ <lyle@knology.net> in [ruby-core:01486]
+
+Thu Aug 28 05:02:52 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (singleton): typo fixed (ruby-bugs-ja:PR#562)
+
+Thu Aug 28 02:37:45 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): *a = [1,2] now assigns [[1,2]] to a.
+ consistent with *a = [1], which set [[1]] to a.
+
+ * node.h: merge NODE_RESTARY to NODE_SPLAT.
+
+ * parse.y: rules simplified a bit by removing NODE_RESTARY.
+
+ * sample/test.rb: updated for new assignment behavior.
+
+Wed Aug 27 22:33:24 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (rb_bug): should not use other methods; this function is
+ not for ordinary use. [ruby-dev:21259]
+
+Wed Aug 27 15:07:57 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/smtp.rb (check_response): AUTH CRAM-MD5 returns 334
+ response. [ruby-list:38279]
+
+Wed Aug 27 05:10:15 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (map_errno): support winsock error.
+
+ * win32/win32.c (pipe_exec, CreateChild, poll_child_status, waitpid,
+ kill, link, rb_w32_rename, unixtime_to_filetime, rb_w32_utime):
+ pass errno to map_errno().
+
+ * win32/win32.c (rb_w32_select, rb_w32_accept, rb_w32_bind,
+ rb_w32_connect, rb_w32_getpeername, rb_w32_getsockname,
+ rb_w32_getsockopt, rb_w32_ioctlsocket, rb_w32_listen, rb_w32_recv,
+ rb_w32_recvfrom, rb_w32_send, rb_w32_sendto, rb_w32_setsockopt,
+ rb_w32_shutdown, rb_w32_socket, rb_w32_gethostbyaddr,
+ rb_w32_gethostbyname, rb_w32_gethostname, rb_w32_getprotobyname,
+ rb_w32_getprotobynumber, rb_w32_getservbyname, rb_w32_getservbyport,
+ rb_w32_fclose, rb_w32_close): use map_errno().
+
+ * win32/win32.h: add winsock errors.
+
+Tue Aug 26 23:53:23 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/ostruct.rb (OpenStruct::method_missing): prohibit modifying
+ frozen OpenStruct. [ruby-talk:80214]
+
+Tue Aug 26 20:03:50 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (create_tmpsrc): add the hook for source.
+ [ruby-list:38122]
+
+Tue Aug 26 15:59:53 2003 why the lucky stiff <why@ruby-lang.org>
+
+ * implicit.c (syck_type_id_to_taguri): corrected detection of
+ x-private types.
+
+Sun Aug 24 01:02:48 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (file_expand_path): performance improvement.
+ [ruby-talk:79748]
+
+Sat Aug 23 23:41:16 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (rb_file_s_expand_path): avoid calling rb_scan_args() for
+ apparent cases. [ruby-talk:79748]
+
+Sat Aug 23 18:56:53 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/nkf/nkf.c (rb_nkf_putchar): should use rb_str_resize() to just
+ resize a string, rb_str_cat() disallows NULL. [ruby-dev:21237]
+
+Sat Aug 23 16:48:41 2003 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/ruby-lex.rb: bug fix for "foo" !~ /bar/. [ruby-talk:79942]
+
+Sat Aug 23 15:59:58 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_eval, rb_iterate, block_pass): reduce PUSH/POP_TAG and
+ EXEC_TAG() for retry. [ruby-dev:21216]
+
+Sat Aug 23 02:32:33 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_yield_splat): should check if "values" is array.
+
+ * enum.c (each_with_index_i): typo.
+
+Fri Aug 22 17:07:05 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * enum.c (inject_i): use rb_yield_values.
+
+ * enum.c (each_with_index_i): ditto.
+
+ * eval.c (rb_yield_splat): new function to call "yield *values".
+
+ * string.c (rb_str_scan): use rb_yield_splat().
+
+Fri Aug 22 06:13:22 2003 why the lucky stiff <why@ruby-lang.org>
+
+ * ext/syck/rubyext.c: refactoring of the transfer method
+ dispatch. added yaml_org_handler for faster dispatch of
+ transfers to base types.
+
+ * lib/yaml/rubytypes.rb: removed handling of builtins from
+ Ruby library.
+
+ * ext/syck/token.c: quoted and block scalars are now implicit !str
+
+ * ext/syck/implicit.c: empty string detected as !null.
+
+Fri Aug 22 01:00:31 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (block_pass): improve passing current block.
+
+Fri Aug 22 00:13:00 2003 Shigeo Kobayashi <shigek@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c: Int. overflow bug in multiplication
+ fixed, and VpNmlz() speed up.
+
+Wed Aug 20 16:44:49 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/socket/socket.c (ruby_connect): many systems seem to have
+ a problem in select() after EINPROGRESS. [ruby-list:38080]
+
+Wed Aug 20 01:31:17 2003 why the lucky stiff <why@ruby-lang.org>
+
+ * ext/syck/syck.h: Parser definition problems on HP-UX.
+ [ruby-talk:79389]
+
+ * ext/syck/handler.c (syck_hdlr_get_anchor): Memory leak.
+
+ * ext/syck/syck.s (syck_io_file_read): Bad arguments to fread.
+
+ * ext/syck/rubyext.c: Tainting issues.
+
+Tue Aug 19 23:20:00 2003 Shigeo Kobayashi <shigek@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c .h .html: to_s("+") implemented.
+
+ * ext/bigdecimal/lib/bigdecimal/math.rb: E implemented.
+
+Tue Aug 19 07:47:09 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/ssl.rb: new file; SSL/TLS enhancement for GenericServer.
+
+ * lib/webrick/https.rb: SSLSocket handling is moved to webrick/ssl.rb.
+
+ * lib/webrick/compat.rb (File::fnmatch): remove old migration code.
+
+ * lib/webrick/httpserver.rb (HTTPServer#run): ditto.
+
+ * lib/webrick/server.rb (GenericServer#listen): the body of this
+ method is pull out as Utils::create_lisnteners.
+
+ * lib/webrick/utils.rb (Utils::create_lisnteners): new method.
+
+ * lib/webrick/server.rb (GenericServer#start): should rescue
+ unknown errors. and refine comments.
+
+ * ext/openssl/lib/openssl/ssl.rb (SSLServer#accept): should close
+ socket if SSLSocket raises error.
+
+Tue Aug 19 11:19:33 2003 Shugo Maeda <shugo@ruby-lang.org>
+
+ * io.c (next_argv): should not call GetOpenFile() if rb_stdout is
+ not a IO (T_FILE).
+
+Tue Aug 19 07:47:09 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_ssl.c: sync_close is moved to SSLSocket as
+ a builtin.
+
+ * ext/openssl/lib/openssl/buffering.rb (Buffering#close): ditto.
+
+ * ext/openssl/lib/openssl/buffering.rb (Buffering#puts): should
+ add a return to the tails of each line.
+
+ * ext/openssl/lib/openssl/ssl.rb: new class OpenSSL::SSL::SSLServer.
+
+ * ext/openssl/lib/net/protocols.rb (SSLIO#ssl_connect): use sync_close.
+
+ * ext/openssl/sample/echo_svr.rb: use SSLServer.
+
+ * ext/openssl/sample/echo_cli.rb: add example of SSLSocket#sync_close.
+
+Tue Aug 19 01:24:34 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/curses/curses.c (_XOPEN_SOURCE_EXTENDED): Mac OS X standard
+ headers are inconsistent at this macro. [ruby-core:01432]
+
+ * ext/curses/extconf.rb: check if _XOPEN_SOURCE_EXTENDED breaks.
+
+ * ext/tcltklib/stubs.c: Status macro in X11/Xthreads.h bothers
+ winspool.h
+
+ * instruby.rb: make list at first instead of iterator.
+ [ruby-talk:79347]
+
+Mon Aug 18 11:23:11 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (glob_helper): preserve raw order for **.
+
+Sun Aug 17 23:39:55 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/openssl/extconf.rb (HAVE_VA_ARGS_MACRO): need to compile.
+
+Sun Aug 17 17:10:03 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/lib/openssl/ssl.rb (SSLSocket#sync_close=): add a
+ method to specify if the underlying IO will be closed in
+ SSLSocket#close.
+
+ * ext/openssl/lib/openssl/buffering.rb: add forwarders to
+ setsockopt, getsockopt and fcntl.
+
+ * ext/openssl/lib/net/protocols.rb: enable sync for SSLSocket.
+
+Sun Aug 17 11:32:04 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb (extmake): should not force to remake Makefile when
+ installation and so on.
+
+Sat Aug 16 23:58:18 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c (w_symbol, w_object): get rid of warnings.
+
+ * re.c (rb_memsearch): ditto.
+
+ * time.c (time_dump): ditto.
+
+ * ext/extmk.rb (extmake): not continue making when extconf.rb
+ failed.
+
+ * ext/openssl/extconf.rb: check __VA_ARGS__ macro more precisely.
+
+ * ext/openssl/ossl.h: remove version.h dependency.
+
+ * ext/openssl/ruby_missing.h: ditto.
+
+ * lib/mkmf.rb (pkg_config): use --libs output except with
+ only-L for other options. [ruby-list:38099]
+
+ * lib/mkmf.rb (create_makefile): separate rule for static
+ library from shared object.
+
+ * win32/Makefile.sub, bcc32/Makefile.sub, wince/Makefile.sub:
+ define exec_prefix and libdir.
+
+Fri Aug 15 23:15:00 2003 Shigeo Kobayashi <shigek@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c .h: Bug in combination of limit & div
+ method fixed.
+
+ * ext/bigdecimal/lib/bigdecimal/math.rb: atan() & sqrt() added.
+
+Fri Aug 15 12:01:43 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (HUGE_ST_INO): check whether struct stat.st_ino
+ is larger than long. [ruby-dev:21194]
+ http://www.geocities.co.jp/SiliconValley-PaloAlto/1409/ruby/beos.html
+
+ * error.c (syserr_eqq): errno might exceed Fixnum limit.
+
+ * error.c (Init_Exception): moved base initialization from
+ init_syserr().
+
+ * inits.c (rb_call_inits): postpone initializing errnos until
+ Bignum is available.
+
+Fri Aug 15 12:01:43 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/curses/curses.c (_XOPEN_SOURCE_EXTENDED): needed to let
+ keyname() and so on be declared.
+
+ * ext/curses/curses.c (curses_resizeterm, window_resize):
+ arguments conflicted with macros in term.h.
+
+ * ext/curses/curses.c (Curses module methods): ensure
+ initialized. [ruby-dev:21191]
+
+Fri Aug 15 02:08:53 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (id2ref): recycle check should be done by klass == 0.
+ [ruby-core:01408]
+
+Fri Aug 15 01:34:23 2003 Michal Rokos <m.rokos@sh.cvut.cz>
+
+ * ext/openssl/ossl_pkey.c: move generate_cb here
+
+ * ext/openssl/ossl_pkey_{dh|dsa|rsa}.c: adapt to this cb
+
+ * ext/openssl/openssl_missing.[ch]: add (0.9.6x, x<j) missing BN funcs
+
+ * ext/openssl/ossl_bn.c: use supplied funcs from openssl_missing.c
+
+Fri Aug 15 00:38:00 2003 Shigeo Kobayashi <shigek@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c: Bug in div method fixed.
+
+ * ext/bigdecimal/lib/bigdecimal/math.rb: Newly added.
+
+ * ext/bigdecimal/sample/pi.rb: Changed so as to use math.rb.
+
+Thu Aug 14 21:19:14 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (Init_Thread): Continuation#[] added. [ruby-talk:79028]
+
+Thu Aug 14 20:03:34 2003 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c (OLE_FREE): should not call
+ ole_message_loop.
+
+ * ext/win32ole/win32ole.c (ole_event_free): ditto.
+
+ * ext/win32ole/win32ole.c (ole_initialize): stop calling
+ OleUninitialize at exit.
+
+Thu Aug 14 11:27:37 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * gc.c (rb_data_object_alloc): check type of 1st argument.
+ [ruby-dev:21192]
+
+Thu Aug 14 00:21:14 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (mlhs_node): should allow "::Foo" (colon3) as lhs.
+
+ * parse.y (lhs): ditto.
+
+ * parse.y (yylex): should return tCOLON3 right after kCLASS.
+ [ruby-talk:78918]
+
+ * error.c (exc_initialize): was converting argument to string too
+ eagerly. Only check was needed. [ruby-talk:78958]
+
+Wed Aug 13 23:31:00 2003 Shigeo Kobayashi <shigek@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c .h .html: Ambiguity of
+ BigDecimal::limit removed.
+
+Wed Aug 13 19:21:34 2003 Christian Neukirchen <chneukirchen@yahoo.de>
+
+ * lib/webrick/https.rb (HTTPServer#run): should set syncing-mode
+ to SSLSocket. [ruby-talk:78919]
+
+Wed Aug 13 18:13:49 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (POP_BLOCK): turn on BLOCK_LEFT flag when leaving block.
+
+ * eval.c (proc_invoke): unpack return/break destination when block
+ is already left.
+
+Wed Aug 13 15:58:31 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * object.c (rb_class_s_alloc): add function prototype to avoid VC++
+ warning.
+
+Wed Aug 13 13:50:59 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/Win32API/Win32API.c (Win32API_initialize): should pass some
+ class to first argument of Data_Wrap_Struct(). (ruby-bugs:PR#1109)
+
+Tue Aug 12 16:55:11 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in: static link libraries to LIBRUBY_SO with static linked
+ ext. [ruby-dev:21157]
+
+ * ext/extmk.rb (extmake): sort extension library initialization order.
+
+ * ext/extmk.rb (extmake): compact $extlibs.
+
+Tue Aug 12 02:48:56 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (THREAD_SAVE_CONTEXT): should explicitly turn off the
+ flag before calling getcontext(2).
+
+ * eval.c (struct thread): add member to save backing store on
+ IA64. (ruby-bugs PR1086)
+
+ * eval.c (thread_mark): mark IA64 backing store region.
+
+ * eval.c (thread_free): free saved IA64 backing store.
+
+ * eval.c (rb_thread_save_context): save IA64 backing store as well.
+
+ * eval.c (rb_thread_restore_context): restore IA64 backing store.
+
+ * 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>.
+
+ * lib/debug.rb(debug_command): incomplete regexp.
+
+Mon Aug 11 17:33:07 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_call_super): do not use rb_block_given_p() for
+ check. [ruby-talk:78656]
+
+ * eval.c (BEGIN_CALLARGS): push ITER_NOT only when ITER_PRE.
+
+Sun Aug 10 10:43:05 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/lib/openssl/buffering.rb: increase BLOCK_SIZE
+ from 1k to 16k bytes. [ruby-talk:78603]
+
+ * ext/openssl/ossl_ssl.c (ossl_sslctx_s_alloc): enable
+ partial write to allow interruption in SSLSocket#write.
+
+Sun Aug 10 00:34:16 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * cygwin/GNUmakefile: remove unnecessary '--drive-name=$(CC)'
+ for ccache.
+
+Sat Aug 9 10:36:21 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_object): do not dump generic instance variable when
+ marshal_dump is defined.
+
+Sat Aug 9 00:35:00 2003 Shigeo Kobayashi <shigek@ruby-lang.org>
-Fri Aug 29 11:10:21 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/bigdecimal.c: F style output(like 1234.56789) implemented
+ to to_s method.
+ * ext/bigdecimal_??.html: F style output(like 1234.56789)
+ implemented to to_s method.
- * class.c (class_instance_methods): same method names should not
- appear more than twice.
+Fri Aug 8 12:33:17 2003 WATANABE Hirofumi <eban@ruby-lang.org>
- * parse.y (yylex): spaces can follow =begin/=end.
+ * bcc32/Makefile.sub: rubyw.exe should be a Windows GUI program.
+ add the -aa option to WLDFLAGS.
- * variable.c (find_class_path): look for class_tbl also for
- unnamed fundamental classes, such as Object, String, etc.
+Fri Aug 8 11:29:26 2003 Koji Arai <jca02266@nifty.ne.jp>
- * variable.c (rb_name_class): can't name class before String class
- is initilialized.
+ * marshal.c (w_object): should set `c_arg' at first.
- * inits.c (rb_call_inits): unrecognized dependency from GC to
- Array.
+Fri Aug 8 03:22:28 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * variable.c (find_class_path): could not find class if Object's
- iv_tbl is NULL.
+ * lib/webrick/httputils.rb (FormData#list): should not take
+ a side effect for the receiver.
-Thu Aug 28 13:12:05 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu Aug 7 14:40:37 2003 WATANABE Hirofumi <eban@ruby-lang.org>
- * version 1.1 alpha4 released.
+ * cygwin/GNUmakefile: better --disbale-shared option support.
- * variable.c (mod_constants): wrong condition for singleton
- class.
+ * cygwin/GNUmakefile: add forwarding DLL target for cygwin.
- * parse.y (yylex): revised `=begin' skip code.
+Thu Aug 7 14:21:05 2003 Corinna Vinschen <vinschen@redhat.com>
- * parse.y (here_document): forgot to free(eos).
+ * configure.in: Fix Cygwin specific naming of libraries to
+ be net distribution compliant. (ruby-bugs:PR#1077)
+ cygwin-ruby18.dll -> cygruby18.dll
- * parse.y (yylex): spaces after `<<' prohibited for here
- documents to avoid confusing with operator `<<'.
+Thu Aug 7 12:51:38 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
- * eval.c (is_defined): separated from rb_eval().
+ * eval.c (rb_f_at_exit): should not be called without a block.
+ block_given check added.
-Wed Aug 27 11:32:42 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Thu Aug 7 06:46:06 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
- * version 1.1 alpha3 released.
+ * eval.c (rb_call0): forgot to pop ruby_class.
- * variable.c (mod_name): returns name of the class/module.
+ * eval.c (rb_call0): update ruby_class as well as ruby_cref.
+ (ruby-bugs-ja:PR#540)
- * parse.y (here_document): finally here document available now.
+Thu Aug 7 04:52:50 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
- * variable.c (fc_i): some classes/modules does not have iv_tbl.
+ * eval.c (rb_yield_0): remove ruby_frame->cbase and unify to
+ ruby_cref. [ruby-talk:78141]
- * variable.c (find_class_path): avoid inifinite loop.
+Thu Aug 7 04:19:15 2003 Akinori MUSHA <knu@iDaemons.org>
-Tue Aug 26 13:43:47 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * gc.c: FreeBSD/ia64's mcontext_t is a bit different from that of
+ Linux/ia64. This makes gc.c compile but miniruby coredumps for
+ the moment.
- * eval.c (rb_eval): undef'ing non-existing method will raise
- NameError exception.
+Thu Aug 7 00:15:00 2003 Shigeo Kobayashi <shigek@ruby-lang.org>
- * object.c (class_s_new): needed to create metaclass too.
+ * ext/bigdecimal.c: Comparison results adjusted to Float's.
+ * ext/bigdecimal.c: Use rb_num_coerce_????(x,y) instead of own.
- * eval.c (error_print): no class name print for anonymous class.
+Wed Aug 6 22:58:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
- * eval.c (rb_longjmp): proper exception raised if raise() called
- without arguments, with $! or $@ set.
+ * lib/test/unit/testcase.rb: Added equality checking.
+ * lib/test/unit/testsuite.rb: Added equality checking.
+ * lib/test/unit/assertions.rb: Fixed a warning.
- * object.c (Init_Object): superclass()'s method argument setting
- was wrong again.
+Wed Aug 6 17:28:10 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * class.c (mod_anscestors): list superclasses and included modules
- in priority order.
+ * ext/extmk.rb (extmake): pass LIBPATH to make ruby. [ruby-dev:21137]
-Mon Aug 25 11:53:11 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/extmk.rb (extmake): set library name as source file name in
+ Init_ext(). [ruby-dev:21137]
- * version 1.1 alpha2 released.
+ * lib/mkmf.rb (Logging::postpone): postpone logging messages after
+ heading message as the result of the block.
- * sample/ruby-mode.el (ruby-parse-region): auto-indent now
- supports "\\" in the strings.
+ * lib/mkmf.rb (macro_defined?): append newline to src unless ended
+ with it.
- * struct.c (struct_getmember): new API to get member value from C
- language side.
+ * lib/mkmf.rb (have_library): treat nil function name as "main".
+ (ruby-bugs:PR#1083)
-Sat Aug 23 21:39:05 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/mkmf.rb (pkg_config): should append additional libraries to
+ $libs but not $LIBS. [ruby-dev:21137]
- * parse.y (asignable): remove unnecessary local variable
- initialize by nil.
+ * ext/io/wait/extconf.rb: check DOSISH macro instead of platform.
-Fri Aug 22 14:26:40 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * ext/digest/sha1/extconf.rb: have_library already appends library
+ name.
- * eval.c (error_print): modified exception print format.
+Wed Aug 6 17:23:57 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
-Thu Aug 21 16:10:58 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * eval.c: initialize /* OK */ variables by Qnil to stop warnings.
- * sample/ruby-mode.el (ruby-calculate-indent): wrong indent level
- calculated with keyword operators.
+Wed Aug 6 04:58:32 2003 NAKAMURA Usaku <usa@ruby-lang.org>
-Thu Aug 21 11:36:58 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * ext/Setup*: add io/wait and openssl.
- * parse.y (arg): ary[0] += 1 cause SEGV
+Wed Aug 6 01:13:38 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
-Wed Aug 20 17:28:50 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * eval.c (rb_f_autoload): use ruby_cbase instead of ruby_class.
- * ruby.c (ruby_process_options): require() all modules after
- processing all options
+ * eval.c (rb_f_autoload_p): ditto.
- * process.c (rb_proc_exec): more security checks added.
+ * class.c (rb_mod_init_copy): no longer implements independent
+ clone and dup methods. override "initialize_copy" instead.
+ [ruby-core:01352]
- * process.c (rb_proc_exec): insecure path on exec.
+ * object.c (rb_class_s_alloc): define Class allocation function.
+ this makes Classes to follow clone framework that uses
+ initialize_copy.
- * hash.c (f_getenv): PATH modification security check.
+ * object.c (rb_class_initialize): separate instantiation and
+ initialization.
-Tue Aug 19 00:15:38 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * object.c (rb_obj_alloc): prohibit instantiation from
+ uninitialized class.
- * version 1.1 alpha1 released.
+ * object.c (rb_class_superclass): check uninitialized class.
- * eval.c (mod_eval): work as normal eval() if second binding
- argument given.
+ * array.c (rb_ary_fill): wrong index processing with block. this
+ fix was done by Koji Arai <JCA02266@nifty.ne.jp> [ruby-list:38029]
- * eval.c (rb_call): did not raise ArgumentError if too many
- arguments more than optional arguments (without rest arg).
+ * marshal.c (w_object): should preserve generic ivar for nil,
+ true, false, symbols, and fixnums.
- * eval.c (rb_eval): did not work well for op_asgn2 (attribute
- self assignment).
+ * marshal.c (w_uclass): base_klass check should be done after
+ rb_class_real().
- * eval.c (Init_Thread): returns main thread.
+Wed Aug 6 01:18:50 2003 Minero Aoki <aamine@loveruby.net>
-Mon Aug 18 09:25:56 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/net/http.rb: update document.
- * object.c (inspect_i): did not display T_DATA instance variables.
+ * lib/net/pop.rb: ditto.
- * parse.y: provides more accurate line number information.
+ * lib/net/protocol.rb: ditto.
- * eval.c (thread_value): include value's backtrace information in
- the variable `$@'.
+Wed Aug 6 00:48:37 2003 Koji Arai <jca02266@nifty.ne.jp>
- * eval.c (f_abort): print backtrace and exit.
+ * marshal.c (w_object): should recommend marshal_dump rather than
+ _dump_data.
-Sat Aug 16 00:17:44 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+Tue Aug 5 17:58:57 2003 WATANABE Hirofumi <eban@ruby-lang.org>
- * eval.c (class_new_instance): do not make instance from virtual
- classes.
+ * lib/fileutils.rb (install): should preserve timestamp only.
- * object.c (class_s_new): do not make subclass of singleton class.
+Tue Aug 5 17:31:59 2003 Ian Macdonald <ian@caliban.org>
-Fri Aug 15 15:49:46 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/shell/command-processor.rb (Shell::CommandProcessor::rmdir):
+ simple typo.
- * eval.c (call_trace_func): block context switch in the trace
- function.
+Tue Aug 5 15:47:34 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * eval.c (rb_eval): clear method cache at class extention.
+ * eval.c (rb_load): should preserve current source file/line.
- * object.c (obj_type): returns object's class even if it defines
- singleton methods.
+Tue Aug 5 10:04:42 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
-Fri Aug 15 19:40:43 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+ * string.c (str_new4): ptr may refer null_str.
- * ext/socket/socket.c (Init_socket): small typo caused SEGV.
+Mon Aug 4 17:25:18 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
-Wed Aug 13 17:51:46 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * stable version 1.8.0 released.
- * version 1.1 alpha0 released.
+For the changes before 1.8.0, see doc/ChangeLog-1.8.0
+Local variables:
+add-log-time-format: (lambda ()
+ (let* ((time (current-time))
+ (diff (+ (cadr time) 32400))
+ (lo (% 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
+end:
diff --git a/GPL b/GPL
new file mode 100644
index 0000000000..5b6e7c66c2
--- /dev/null
+++ b/GPL
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/LEGAL b/LEGAL
new file mode 100644
index 0000000000..dce7c1acbf
--- /dev/null
+++ b/LEGAL
@@ -0,0 +1,371 @@
+LEGAL NOTICE INFORMATION
+------------------------
+
+All the files in this distribution are covered under either the Ruby's
+license (see the file COPYING) or public-domain except some files
+mentioned below.
+
+regex.[ch]:
+
+ These files are under LGPL. Treat them as LGPL says. (See the file
+ LGPL for details)
+
+ Extended regular expression matching and search library.
+ Copyright (C) 1993, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file LGPL. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+ Multi-byte extension added May, 1993 by t^2 (Takahiro Tanimoto)
+ Last change: May 21, 1993 by t^2
+ removed gapped buffer support, multiple syntax support by matz <matz@nts.co.jp>
+ Perl5 extension added by matz <matz@caelum.co.jp>
+ UTF-8 extension added Jan 16 1999 by Yoshida Masato <yoshidam@tau.bekkoame.ne.jp>
+
+configure:
+
+ This file is free software.
+
+ Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+
+ This configure script is free software; the Free Software Foundation
+ gives unlimited permission to copy, distribute and modify it.
+
+config.guess:
+config.sub:
+parse.c:
+
+ As long as you distribute these files with the file configure, they
+ are covered under the Ruby's license.
+
+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999
+ Free Software Foundation, Inc.
+
+ This file is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ As a special exception to the GNU General Public License, if you
+ distribute this file as part of a program that contains a
+ configuration script generated by Autoconf, you may include it under
+ the same distribution terms that you use for the rest of that program.
+
+util.c (partly):
+win32/win32.[ch]:
+
+ You can apply the Artistic License to these files. (or GPL,
+ alternatively)
+
+ Copyright (c) 1993, Intergraph Corporation
+
+ You may distribute under the terms of either the GNU General Public
+ License or the Artistic License, as specified in the perl README file.
+
+random.c
+
+ This file is under the new-style BSD license.
+
+ A C-program for MT19937, with initialization improved 2002/2/10.
+ Coded by Takuji Nishimura and Makoto Matsumoto.
+ This is a faster version by taking Shawn Cokus's optimization,
+ Matthe Bellew's simplification, Isaku Wada's real version.
+
+ Before using, initialize the state by using init_genrand(seed)
+ or init_by_array(init_key, key_length).
+
+ Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. The names of its contributors may not be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ Any feedback is very welcome.
+ http://www.math.keio.ac.jp/matumoto/emt.html
+ email: matumoto@math.keio.ac.jp
+
+st.[ch]:
+x68/*:
+missing/alloca.c:
+missing/dup2.c:
+missing/erf.c:
+missing/finite.c:
+missing/hypot.c:
+missing/isinf.c:
+missing/isnan.c:
+missing/memcmp.c:
+missing/memmove.c:
+missing/mkdir.c:
+missing/strcasecmp.c:
+missing/strchr.c:
+missing/streror.c:
+missing/strftime.c:
+missing/strncasecmp.c:
+missing/strstr.c:
+missing/strtol.c:
+ext/digest/sha1/sha1.[ch]:
+
+ These files are all under public domain.
+
+missing/strtod.c:
+
+ This file will not be used on most platforms depending on how the
+ configure script results. In any case you must not receive any fee
+ with the file itself.
+
+ Copyright (c) 1988-1993 The Regents of the University of California.
+ Copyright (c) 1994 Sun Microsystems, Inc.
+
+ Permission to use, copy, modify, and distribute this
+ software and its documentation for any purpose and without
+ fee is hereby granted, provided that the above copyright
+ notice appear in all copies. The University of California
+ makes no representations about the suitability of this
+ software for any purpose. It is provided "as is" without
+ express or implied warranty.
+
+missing/strtoul.c:
+
+ This file will not be used on most platforms depending on how the
+ configure script results. In any case you must not receive any fee
+ with the file itself.
+
+ Copyright 1988 Regents of the University of California
+
+ Permission to use, copy, modify, and distribute this
+ software and its documentation for any purpose and without
+ fee is hereby granted, provided that the above copyright
+ notice appear in all copies. The University of California
+ makes no representations about the suitability of this
+ software for any purpose. It is provided "as is" without
+ express or implied warranty.
+
+missing/vsnprintf.c:
+
+ This file is under the old-style BSD license. Note that the
+ paragraph 3 below is now null and void.
+
+ Copyright (c) 1990, 1993
+ The Regents of the University of California. All rights reserved.
+
+ This code is derived from software contributed to Berkeley by
+ Chris Torek.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement:
+ This product includes software developed by the University of
+ California, Berkeley and its contributors.
+ 4. Neither the name of the University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+ IMPORTANT NOTE:
+ --------------
+ From ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
+ paragraph 3 above is now null and void.
+
+ext/digest/md5/md5.[ch]:
+
+ These files are under the following license. Ruby uses modified
+ versions of them.
+
+ Copyright (C) 1999, 2000 Aladdin Enterprises. All rights reserved.
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ L. Peter Deutsch
+ ghost@aladdin.com
+
+ext/digest/rmd160/rmd160.[ch]:
+
+ These files have the following copyright information, and by the
+ author we are allowed to use it under the new-style BSD license.
+
+ AUTHOR: Antoon Bosselaers, ESAT-COSIC
+ (Arranged for libc by Todd C. Miller)
+ DATE: 1 March 1996
+
+ Copyright (c) Katholieke Universiteit Leuven
+ 1996, All Rights Reserved
+
+ext/digest/rmd160/rmd160hl.c:
+ext/digest/sha1/sha1hl.c:
+
+ These files are under the beer-ware license.
+
+ "THE BEER-WARE LICENSE" (Revision 42):
+ <phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
+ can do whatever you want with this stuff. If we meet some day, and you think
+ this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
+
+ext/digest/sha2/sha2.[ch]:
+ext/digest/sha2/sha2hl.c:
+
+ These files are under the new-style BSD license.
+
+ Copyright 2000 Aaron D. Gifford. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the copyright holder nor the names of contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTOR(S) ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTOR(S) BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+ext/nkf/nkf1.7/nkf.c:
+
+ This file is under the following license. So to speak, it is
+ copyrighted semi-public-domain software.
+
+ Copyright (C) 1987, Fujitsu LTD. (Itaru ICHIKAWA)
+ Everyone is permitted to do anything on this program
+ including copying, modifying, improving.
+ as long as you don't try to pretend that you wrote it.
+ i.e., the above copyright notice has to appear in all copies.
+ You don't have to ask before copying or publishing.
+ THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE.
+
+ext/socket/addrinfo.h:
+ext/socket/getaddrinfo.c:
+ext/socket/getnameinfo.c:
+
+ These files are under the new-style BSD license.
+
+ Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the project nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+ext/win32ole/win32ole.c:
+
+ You can apply the Artistic License to this file. (or GPL,
+ alternatively)
+
+ (c) 1995 Microsoft Corporation. All rights reserved.
+ Developed by ActiveWare Internet Corp., http://www.ActiveWare.com
+
+ Other modifications Copyright (c) 1997, 1998 by Gurusamy Sarathy
+ <gsar@umich.edu> and Jan Dubois <jan.dubois@ibm.net>
+
+ You may distribute under the terms of either the GNU General Public
+ License or the Artistic License, as specified in the README file
+ of the Perl distribution.
diff --git a/LGPL b/LGPL
new file mode 100644
index 0000000000..b1e3f5a263
--- /dev/null
+++ b/LGPL
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/MANIFEST b/MANIFEST
deleted file mode 100644
index 95dc640c53..0000000000
--- a/MANIFEST
+++ /dev/null
@@ -1,237 +0,0 @@
-COPYING
-ChangeLog
-MANIFEST
-Makefile.in
-README
-README.jp
-README.EXT
-README.EXT.jp
-ToDo
-array.c
-bignum.c
-class.c
-compar.c
-configure
-configure.bat
-configure.in
-config_h.dj
-config_s.dj
-config.guess
-config.sub
-defines.h
-dir.c
-dln.c
-dln.h
-dmyext.c
-enum.c
-env.h
-error.c
-eval.c
-file.c
-fnmatch.c
-fnmatch.h
-gc.c
-glob.c
-hash.c
-inits.c
-install-sh
-instruby.rb
-intern.h
-io.c
-keywords
-lex.c
-main.c
-marshal.c
-math.c
-mkconfig.rb
-node.h
-numeric.c
-object.c
-pack.c
-parse.c
-parse.y
-process.c
-random.c
-range.c
-re.c
-re.h
-regex.c
-regex.h
-ruby.1
-ruby.c
-ruby.h
-rubyio.h
-rubysig.h
-rubytest.rb
-signal.c
-sprintf.c
-st.c
-st.h
-string.c
-struct.c
-time.c
-top.sed
-util.h
-util.c
-variable.c
-version.c
-version.h
-beos/ruby.def.in
-ext/Setup
-ext/Setup.dj
-ext/Setup.nt
-ext/Setup.x68
-ext/aix_ld.rb
-ext/cygwin32_ld.rb
-ext/extmk.rb.in
-ext/extmk.rb.nt
-lib/English.rb
-lib/Env.rb
-lib/README
-lib/base64.rb
-lib/cgi-lib.rb
-lib/complex.rb
-lib/date.rb
-lib/date2.rb
-lib/debug.rb
-lib/delegate.rb
-lib/e2mmap.rb
-lib/eregex.rb
-lib/find.rb
-lib/final.rb
-lib/finalize.rb
-lib/ftplib.rb
-lib/ftools.rb
-lib/getopts.rb
-lib/importenv.rb
-lib/jcode.rb
-lib/mailread.rb
-lib/mathn.rb
-lib/matrix.rb
-lib/mkmf.rb
-lib/monitor.rb
-lib/mutex_m.rb
-lib/observer.rb
-lib/open3.rb
-lib/ostruct.rb
-lib/parsearg.rb
-lib/parsedate.rb
-lib/ping.rb
-lib/pstore.rb
-lib/rational.rb
-lib/readbytes.rb
-lib/shell.rb
-lib/shellwords.rb
-lib/singleton.rb
-lib/sync.rb
-lib/telnet.rb
-lib/tempfile.rb
-lib/thread.rb
-lib/thwait.rb
-lib/timeout.rb
-lib/tk.rb
-lib/tkafter.rb
-lib/tkbgerror.rb
-lib/tkcanvas.rb
-lib/tkclass.rb
-lib/tkdialog.rb
-lib/tkentry.rb
-lib/tkfont.rb
-lib/tkmenubar.rb
-lib/tkmngfocus.rb
-lib/tkpalette.rb
-lib/tkscrollbox.rb
-lib/tktext.rb
-lib/tkvirtevent.rb
-lib/tracer.rb
-lib/weakref.rb
-missing/alloca.c
-missing/crypt.c
-missing/dir.h
-missing/dup2.c
-missing/file.h
-missing/flock.c
-missing/memcmp.c
-missing/memmove.c
-missing/mkdir.c
-missing/nt.c
-missing/nt.h
-missing/setenv.c
-missing/strcasecmp.c
-missing/strchr.c
-missing/strdup.c
-missing/strerror.c
-missing/strftime.c
-missing/strstr.c
-missing/strtol.c
-missing/strtoul.c
-missing/vsnprintf.c
-missing/x68.c
-sample/README
-sample/biorhythm.rb
-sample/cal.rb
-sample/cbreak.rb
-sample/clnt.rb
-sample/dbmtest.rb
-sample/dir.rb
-sample/eval.rb
-sample/export.rb
-sample/exyacc.rb
-sample/fact.rb
-sample/fib.awk
-sample/fib.pl
-sample/fib.py
-sample/fib.rb
-sample/fib.scm
-sample/freq.rb
-sample/from.rb
-sample/fullpath.rb
-sample/getopts.test
-sample/goodfriday.rb
-sample/inf-ruby.el
-sample/less.rb
-sample/list.rb
-sample/list2.rb
-sample/list3.rb
-sample/mine.rb
-sample/mkproto.rb
-sample/mpart.rb
-sample/mrshtest.rb
-sample/observ.rb
-sample/occur.pl
-sample/occur.rb
-sample/occur2.rb
-sample/philos.rb
-sample/pi.rb
-sample/rbc.rb
-sample/rcs.awk
-sample/rcs.dat
-sample/rcs.rb
-sample/regx.rb
-sample/ruby-mode.el
-sample/rubydb2x.el
-sample/rubydb3x.el
-sample/sieve.rb
-sample/svr.rb
-sample/test.rb
-sample/time.rb
-sample/tkbiff.rb
-sample/tkbrowse.rb
-sample/tkdialog.rb
-sample/tkfrom.rb
-sample/tkhello.rb
-sample/tkline.rb
-sample/tktimer.rb
-sample/trojan.rb
-sample/tsvr.rb
-sample/uumerge.rb
-win32/Makefile
-win32/config.h
-win32/ntsetup.bat
-win32/ruby.def
-win32/sdbm.c
-win32/sdbm.h
-x68/fconvert.c
-x68/select.c
-x68/_dtos18.c
-x68/_round.c
diff --git a/Makefile.in b/Makefile.in
index f3ac3dd890..663ba43111 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -3,223 +3,378 @@ SHELL = /bin/sh
#### Start of system configuration section. ####
srcdir = @srcdir@
-VPATH = @srcdir@:@srcdir@/missing
+VPATH = $(srcdir):$(srcdir)/missing
CC = @CC@
YACC = @YACC@
PURIFY =
+AUTOCONF = autoconf
@SET_MAKE@
prefix = @prefix@
-CFLAGS = @CFLAGS@ -I. -I@srcdir@ -I@includedir@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+sbindir = @sbindir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+arch = @arch@
+sitearch = @sitearch@
+sitedir = @sitedir@
+
+CFLAGS = @CFLAGS@ @XCFLAGS@ @ARCH_FLAG@
+CPPFLAGS = -I. -I$(srcdir) @CPPFLAGS@
LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@
+EXTLDFLAGS =
+XLDFLAGS = @XLDFLAGS@ $(EXTLDFLAGS)
EXTLIBS =
LIBS = @LIBS@ $(EXTLIBS)
MISSING = @LIBOBJS@ @ALLOCA@
-LDSHARED = @LDSHARED@
-DLDFLAGS = @DLDFLAGS@
+LDSHARED = @LIBRUBY_LDSHARED@
+DLDFLAGS = @LIBRUBY_DLDFLAGS@ $(EXTLDFLAGS) @ARCH_FLAG@
SOLIBS = @SOLIBS@
+MAINLIBS = @MAINLIBS@
-binsuffix = @binsuffix@
+RUBY_INSTALL_NAME=@RUBY_INSTALL_NAME@
+RUBY_SO_NAME=@RUBY_SO_NAME@
+EXEEXT = @EXEEXT@
+PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT)
+RUBY = $(RUBY_INSTALL_NAME)
+MINIRUBY = @MINIRUBY@
#### End of system configuration section. ####
+MAJOR= @MAJOR@
+MINOR= @MINOR@
+TEENY= @TEENY@
+LIBRUBY_A = @LIBRUBY_A@
+LIBRUBY_SO = @LIBRUBY_SO@
+LIBRUBY_ALIASES= @LIBRUBY_ALIASES@
LIBRUBY = @LIBRUBY@
LIBRUBYARG = @LIBRUBYARG@
+LIBRUBYARG_STATIC = @LIBRUBYARG_STATIC@
+LIBRUBYARG_SHARED = @LIBRUBYARG_SHARED@
-EXTOBJS =
+PREP = @PREP@ @ARCHFILE@
+SETUP =
+EXTSTATIC = @EXTSTATIC@
-MAINOBJ = main.o
-
-OBJS = array.o \
- bignum.o \
- class.o \
- compar.o \
- dir.o \
- dln.o \
- enum.o \
- error.o \
- eval.o \
- file.o \
- fnmatch.o \
- gc.o \
- glob.o \
- hash.o \
- inits.o \
- io.o \
- marshal.o \
- math.o \
- numeric.o \
- object.o \
- pack.o \
- parse.o \
- process.o \
- random.o \
- range.o \
- re.o \
- regex.o \
- ruby.o \
- signal.o \
- sprintf.o \
- st.o \
- string.o \
- struct.o \
- time.o \
- util.o \
- variable.o \
- version.o \
+EXTOBJS =
+DLDOBJS = $(DMYEXT)
+DMYEXT = dmyext.@OBJEXT@
+
+MAINOBJ = main.@OBJEXT@
+
+OBJS = array.@OBJEXT@ \
+ bignum.@OBJEXT@ \
+ class.@OBJEXT@ \
+ compar.@OBJEXT@ \
+ dir.@OBJEXT@ \
+ dln.@OBJEXT@ \
+ enum.@OBJEXT@ \
+ error.@OBJEXT@ \
+ eval.@OBJEXT@ \
+ file.@OBJEXT@ \
+ gc.@OBJEXT@ \
+ hash.@OBJEXT@ \
+ inits.@OBJEXT@ \
+ io.@OBJEXT@ \
+ marshal.@OBJEXT@ \
+ math.@OBJEXT@ \
+ numeric.@OBJEXT@ \
+ object.@OBJEXT@ \
+ pack.@OBJEXT@ \
+ parse.@OBJEXT@ \
+ process.@OBJEXT@ \
+ prec.@OBJEXT@ \
+ random.@OBJEXT@ \
+ range.@OBJEXT@ \
+ re.@OBJEXT@ \
+ regex.@OBJEXT@ \
+ ruby.@OBJEXT@ \
+ signal.@OBJEXT@ \
+ sprintf.@OBJEXT@ \
+ st.@OBJEXT@ \
+ string.@OBJEXT@ \
+ struct.@OBJEXT@ \
+ time.@OBJEXT@ \
+ util.@OBJEXT@ \
+ variable.@OBJEXT@ \
+ version.@OBJEXT@ \
$(MISSING)
-all: miniruby$(binsuffix) rbconfig.rb
- @./miniruby$(binsuffix) -Xext extmk.rb @EXTSTATIC@
+MANTYPE = @MANTYPE@
+
+SCRIPT_ARGS = --dest-dir="$(DESTDIR)" \
+ --make="$(MAKE)" \
+ --mflags="$(MFLAGS)" \
+ --make-flags="$(MAKEFLAGS)"
-miniruby$(binsuffix): $(OBJS) $(MAINOBJ) dmyext.o
+all: @MAKEFILES@ miniruby$(EXEEXT) rbconfig.rb $(LIBRUBY)
+ @$(MINIRUBY) $(srcdir)/ext/extmk.rb --extstatic="$(EXTSTATIC)" $(SCRIPT_ARGS)
+
+miniruby$(EXEEXT): config.status $(LIBRUBY_A) $(MAINOBJ) $(DMYEXT)
@rm -f $@
- $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(OBJS) dmyext.o $(LIBS) -o $@
+ $(PURIFY) $(CC) $(LDFLAGS) $(MAINLIBS) $(MAINOBJ) $(DMYEXT) $(LIBRUBY_A) $(LIBS) -o $@
-ruby$(binsuffix): $(LIBRUBY) $(MAINOBJ) $(EXTOBJS)
+$(PROGRAM): $(LIBRUBY) $(MAINOBJ) $(EXTOBJS) $(SETUP) miniruby$(EXEEXT)
@rm -f $@
- $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@
+ $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@
-libruby.a: $(OBJS) dmyext.o
- @AR@ rcu $@ $(OBJS) dmyext.o
+# We must `rm' the library each time this rule is invoked because "updating" a
+# MAB library on Apple/NeXT (see --enable-fat-binary in configure) is not
+# supported.
+$(LIBRUBY_A): $(OBJS) $(DMYEXT)
+ @rm -f $@
+ @AR@ rcu $@ $(OBJS) $(DMYEXT)
@-@RANLIB@ $@ 2> /dev/null || true
-libruby.so: $(OBJS) dmyext.o
- $(LDSHARED) $(DLDFLAGS) $(SOLIBS) $(OBJS) dmyext.o -o $@
+$(LIBRUBY_SO): $(OBJS) $(DLDOBJS) miniruby$(EXEEXT) $(PREP)
+ $(LDSHARED) $(DLDFLAGS) $(OBJS) $(DLDOBJS) $(SOLIBS) -o $@
+ @-$(MINIRUBY) -e 'ARGV.each{|link| File.delete link if File.exist? link; \
+ File.symlink "$(LIBRUBY_SO)", link}' \
+ $(LIBRUBY_ALIASES) || true
-install: rbconfig.rb
- ./miniruby$(binsuffix) $(srcdir)/instruby.rb
+ruby.imp: $(LIBRUBY_A)
+ @@NM@ -Pgp $(LIBRUBY_A) | awk 'BEGIN{print "#!"}; $$2~/^[BD]$$/{print $$1}' | sort -u -o $@
+# $(MINIRUBY) $< $@
-clean:; @rm -f $(OBJS) $(LIBRUBY) $(MAINOBJ) rbconfig.rb
- @rm -f ext/extinit.c ext/extinit.o dmyext.o
- @if test -f ./miniruby$(binsuffix); then \
- ./miniruby$(binsuffix) -Xext extmk.rb clean; \
- fi
+install: install-nodoc @RDOCTARGET@
-distclean: clean
- @rm -f Makefile ext/extmk.rb config.h
- @rm -f ext/config.cache config.cache config.log config.status
- @rm -f parse.c *~ core *.core gmon.out y.tab.c y.output
- @rm -f ruby$(binsuffix) miniruby$(binsuffix)
+install-nodoc: rbconfig.rb
+ $(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --mantype="$(MANTYPE)"
+ $(MINIRUBY) $(srcdir)/ext/extmk.rb $(SCRIPT_ARGS) install
-realclean: distclean
- @rm -f lex.c
+what-where no-install: rbconfig.rb
+ $(MINIRUBY) $(srcdir)/instruby.rb -n $(SCRIPT_ARGS) --mantype="$(MANTYPE)"
+ $(MINIRUBY) $(srcdir)/ext/extmk.rb -n $(SCRIPT_ARGS) install
+
+install-doc:
+ @echo Generating RDoc documentation
+ $(bindir)/$(PROGRAM) $(srcdir)/bin/rdoc --all --ri-system $(srcdir)
+
+clean-ext:
+ @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(SCRIPT_ARGS) clean 2> /dev/null || true
+
+clean-local:
+ @rm -f $(OBJS) $(MAINOBJ) $(LIBRUBY_A) $(LIBRUBY_SO) $(LIBRUBY_ALIASES)
+ @rm -f ext/extinit.c ext/extinit.@OBJEXT@ dmyext.@OBJEXT@
+ @rm -f $(PROGRAM) miniruby$(EXEEXT)
+
+clean: clean-ext clean-local
+
+distclean-ext:
+ @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(SCRIPT_ARGS) distclean 2> /dev/null || true
-test: miniruby$(binsuffix)
- @./miniruby$(binsuffix) $(srcdir)/rubytest.rb
+distclean-local: clean-local
+ @rm -f @MAKEFILES@ config.h rbconfig.rb
+ @rm -f ext/config.cache config.cache config.log config.status
+ @rm -f *~ core *.core gmon.out y.tab.c y.output ruby.imp
+
+distclean: distclean-ext distclean-local
-rbconfig.rb: config.status miniruby$(binsuffix)
- @./miniruby$(binsuffix) $(srcdir)/mkconfig.rb rbconfig.rb
+realclean: distclean
+ @rm -f parse.c
+ @rm -f lex.c
-.c.o:
+test: miniruby$(EXEEXT) rbconfig.rb $(PROGRAM) PHONY
+ @./miniruby$(EXEEXT) $(srcdir)/rubytest.rb
+
+rbconfig.rb: miniruby$(EXEEXT) $(srcdir)/mkconfig.rb config.status $(PREP)
+ @$(MINIRUBY) $(srcdir)/mkconfig.rb rbconfig.rb
+
+fake.rb: miniruby$(EXEEXT) Makefile
+ @echo ' \
+ class Object; \
+ CROSS_COMPILING = RUBY_PLATFORM; \
+ remove_const :RUBY_PLATFORM; \
+ remove_const :RUBY_VERSION; \
+ RUBY_PLATFORM = "@arch@"; \
+ RUBY_VERSION = "@MAJOR@.@MINOR@.@TEENY@"; \
+ end; \
+ if RUBY_PLATFORM =~ /mswin|bccwin|mingw/; \
+ class File; \
+ remove_const :ALT_SEPARATOR; \
+ ALT_SEPARATOR = "\\"; \
+ end; \
+ end; \
+ ' > $@
+
+Makefile: $(srcdir)/Makefile.in
+
+.PRECIOUS: @MAKEFILES@
+
+.PHONY: test install install-nodoc install-doc
+
+PHONY:
+
+@MAKEFILES@: config.status
+ MAKE=$(MAKE) $(SHELL) ./config.status
+ @{ \
+ echo "all:; -@rm -f conftest.mk"; \
+ echo "conftest.mk: .force; @echo AUTO_REMAKE"; \
+ echo ".force:"; \
+ } > conftest.mk || exit 1; \
+ $(MAKE) -f conftest.mk | grep '^AUTO_REMAKE$$' >/dev/null 2>&1 || \
+ { echo "Makefile updated, restart."; exit 1; }
+
+config.status: $(srcdir)/configure
+ MINIRUBY="$(MINIRUBY)" $(SHELL) ./config.status --recheck
+
+$(srcdir)/configure: $(srcdir)/configure.in
+ cd $(srcdir) && $(AUTOCONF)
+
+.c.@OBJEXT@:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
lex.c: keywords
- gperf -p -j1 -i 1 -g -o -t -N rb_reserved_word -k1,3,$$ @srcdir@/keywords > lex.c
+ @-rm -f $@
+ gperf -p -j1 -i 1 -g -o -t -N rb_reserved_word -k1,3,$$ $? > $@ || \
+ cp "$(srcdir)/$@" .
-parse.c: parse.y
+.y.c:
$(YACC) $<
- mv -f y.tab.c parse.c
+ sed '/^#/s|y\.tab\.c|$@|' y.tab.c > $@
+ rm -f y.tab.c
+
+ext/extinit.@OBJEXT@: ext/extinit.c $(SETUP)
+ $(CC) $(CFLAGS) $(CPPFLAGS) @OUTFLAG@$@ -c ext/extinit.c
+
+acosh.@OBJEXT@: $(srcdir)/missing/acosh.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/acosh.c
+
+alloca.@OBJEXT@: $(srcdir)/missing/alloca.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/alloca.c
-alloca.o: @srcdir@/missing/alloca.c
- $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/alloca.c
+crypt.@OBJEXT@: $(srcdir)/missing/crypt.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/crypt.c
-crypt.o: @srcdir@/missing/crypt.c
- $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/crypt.c
+dup2.@OBJEXT@: $(srcdir)/missing/dup2.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/dup2.c
-dup2.o: @srcdir@/missing/dup2.c
- $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/dup2.c
+fileblocks.@OBJEXT@: $(srcdir)/missing/fileblocks.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/fileblocks.c
-flock.o: @srcdir@/missing/flock.c
- $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/flock.c
+finite.@OBJEXT@: $(srcdir)/missing/finite.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/finite.c
-memcmp.o: @srcdir@/missing/memcmp.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/memcmp.c
+flock.@OBJEXT@: $(srcdir)/missing/flock.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/flock.c
-memmove.o: @srcdir@/missing/memmove.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/memmove.c
+isinf.@OBJEXT@: $(srcdir)/missing/isinf.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/isinf.c
-mkdir.o: @srcdir@/missing/mkdir.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/mkdir.c
+isnan.@OBJEXT@: $(srcdir)/missing/isnan.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/isnan.c
-setenv.o: @srcdir@/missing/setenv.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/setenv.c
+fnmatch.@OBJEXT@: $(srcdir)/missing/fnmatch.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/fnmatch.c
-vsnprintf.o: @srcdir@/missing/vsnprintf.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/vsnprintf.c
+memcmp.@OBJEXT@: $(srcdir)/missing/memcmp.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/memcmp.c
-strcasecmp.o: @srcdir@/missing/strcasecmp.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/strcasecmp.c
+memmove.@OBJEXT@: $(srcdir)/missing/memmove.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/memmove.c
-strchr.o: @srcdir@/missing/strchr.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/strchr.c
+mkdir.@OBJEXT@: $(srcdir)/missing/mkdir.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/mkdir.c
-strdup.o: @srcdir@/missing/strdup.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/strdup.c
+vsnprintf.@OBJEXT@: $(srcdir)/missing/vsnprintf.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/vsnprintf.c
-strerror.o: @srcdir@/missing/strerror.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/strerror.c
+strcasecmp.@OBJEXT@: $(srcdir)/missing/strcasecmp.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strcasecmp.c
-strftime.o: @srcdir@/missing/strftime.c
- $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/strftime.c
+strncasecmp.@OBJEXT@: $(srcdir)/missing/strncasecmp.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strncasecmp.c
-strstr.o: @srcdir@/missing/strstr.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/strstr.c
+strchr.@OBJEXT@: $(srcdir)/missing/strchr.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strchr.c
-strtol.o: @srcdir@/missing/strtol.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/strtol.c
+strerror.@OBJEXT@: $(srcdir)/missing/strerror.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strerror.c
-strtoul.o: @srcdir@/missing/strtoul.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/strtoul.c
+strftime.@OBJEXT@: $(srcdir)/missing/strftime.c
+ $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strftime.c
-nt.o: @srcdir@/missing/nt.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/nt.c
+strstr.@OBJEXT@: $(srcdir)/missing/strstr.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strstr.c
-x68.o: @srcdir@/missing/x68.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/x68.c
+strtol.@OBJEXT@: $(srcdir)/missing/strtol.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strtol.c
+
+strtoul.@OBJEXT@: $(srcdir)/missing/strtoul.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strtoul.c
+
+x68.@OBJEXT@: $(srcdir)/missing/x68.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/x68.c
+
+os2.@OBJEXT@: $(srcdir)/missing/os2.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/os2.c
+
+dl_os2.@OBJEXT@: $(srcdir)/missing/dl_os2.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/dl_os2.c
+
+win32.@OBJEXT@: $(srcdir)/win32/win32.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -I$(srcdir)/win32 -c $(srcdir)/win32/win32.c
# Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT:
###
-parse.o: parse.y ruby.h config.h defines.h intern.h env.h node.h st.h regex.h util.h lex.c
-###
-array.o: array.c ruby.h config.h defines.h intern.h
-bignum.o: bignum.c ruby.h config.h defines.h intern.h
-class.o: class.c ruby.h config.h defines.h intern.h node.h st.h
-compar.o: compar.c ruby.h config.h defines.h intern.h
-dir.o: dir.c ruby.h config.h defines.h intern.h
-dln.o: dln.c config.h defines.h dln.h
-dmyext.o: dmyext.c
-enum.o: enum.c ruby.h config.h defines.h intern.h
-error.o: error.c ruby.h config.h defines.h intern.h env.h
-eval.o: eval.c ruby.h config.h defines.h intern.h node.h env.h rubysig.h st.h dln.h
-file.o: file.c ruby.h config.h defines.h intern.h rubyio.h rubysig.h
-fnmatch.o: fnmatch.c config.h fnmatch.h
-gc.o: gc.c ruby.h config.h defines.h intern.h rubysig.h st.h node.h env.h re.h regex.h
-glob.o: config.h glob.c fnmatch.h
-hash.o: hash.c ruby.h config.h defines.h intern.h st.h rubysig.h
-inits.o: inits.c ruby.h config.h defines.h intern.h
-io.o: io.c ruby.h config.h defines.h intern.h rubyio.h rubysig.h
-main.o: main.c ruby.h config.h defines.h intern.h
-marshal.o: marshal.c ruby.h config.h defines.h intern.h rubyio.h st.h
-math.o: math.c ruby.h config.h defines.h intern.h
-numeric.o: numeric.c ruby.h config.h defines.h intern.h
-object.o: object.c ruby.h config.h defines.h intern.h st.h
-pack.o: pack.c ruby.h config.h defines.h intern.h
-process.o: process.c ruby.h config.h defines.h intern.h rubysig.h st.h
-random.o: random.c ruby.h config.h defines.h intern.h
-range.o: range.c ruby.h config.h defines.h intern.h
-re.o: re.c ruby.h config.h defines.h intern.h re.h regex.h
-regex.o: regex.c config.h regex.h util.h
-ruby.o: ruby.c ruby.h config.h defines.h intern.h dln.h
-signal.o: signal.c ruby.h config.h defines.h intern.h rubysig.h
-sprintf.o: sprintf.c ruby.h config.h defines.h intern.h
-st.o: st.c config.h st.h
-string.o: string.c ruby.h config.h defines.h intern.h re.h regex.h
-struct.o: struct.c ruby.h config.h defines.h intern.h
-time.o: time.c ruby.h config.h defines.h intern.h
-util.o: util.c ruby.h config.h defines.h intern.h util.h
-variable.o: variable.c ruby.h config.h defines.h intern.h env.h node.h st.h
-version.o: version.c ruby.h config.h defines.h intern.h version.h
+array.@OBJEXT@: array.c ruby.h config.h defines.h intern.h missing.h \
+ util.h st.h
+bignum.@OBJEXT@: bignum.c ruby.h config.h defines.h intern.h missing.h
+class.@OBJEXT@: class.c ruby.h config.h defines.h intern.h missing.h \
+ rubysig.h node.h st.h
+compar.@OBJEXT@: compar.c ruby.h config.h defines.h intern.h missing.h
+dir.@OBJEXT@: dir.c ruby.h config.h defines.h intern.h missing.h util.h
+dln.@OBJEXT@: dln.c ruby.h config.h defines.h intern.h missing.h dln.h
+dmyext.@OBJEXT@: dmyext.c
+enum.@OBJEXT@: enum.c ruby.h config.h defines.h intern.h missing.h node.h \
+ util.h
+error.@OBJEXT@: error.c ruby.h config.h defines.h intern.h missing.h \
+ env.h st.h
+eval.@OBJEXT@: eval.c ruby.h config.h defines.h intern.h missing.h node.h \
+ env.h util.h rubysig.h st.h dln.h
+file.@OBJEXT@: file.c ruby.h config.h defines.h intern.h missing.h \
+ rubyio.h rubysig.h util.h dln.h
+gc.@OBJEXT@: gc.c ruby.h config.h defines.h intern.h missing.h rubysig.h \
+ st.h node.h env.h re.h regex.h
+hash.@OBJEXT@: hash.c ruby.h config.h defines.h intern.h missing.h st.h \
+ util.h rubysig.h
+inits.@OBJEXT@: inits.c ruby.h config.h defines.h intern.h missing.h
+io.@OBJEXT@: io.c ruby.h config.h defines.h intern.h missing.h rubyio.h \
+ rubysig.h env.h util.h
+main.@OBJEXT@: main.c ruby.h config.h defines.h intern.h missing.h
+marshal.@OBJEXT@: marshal.c ruby.h config.h defines.h intern.h missing.h \
+ rubyio.h st.h util.h
+math.@OBJEXT@: math.c ruby.h config.h defines.h intern.h missing.h
+numeric.@OBJEXT@: numeric.c ruby.h config.h defines.h intern.h missing.h
+object.@OBJEXT@: object.c ruby.h config.h defines.h intern.h missing.h \
+ st.h util.h
+pack.@OBJEXT@: pack.c ruby.h config.h defines.h intern.h missing.h
+parse.@OBJEXT@: parse.c ruby.h config.h defines.h intern.h missing.h \
+ env.h node.h st.h regex.h util.h lex.c
+prec.@OBJEXT@: prec.c ruby.h config.h defines.h intern.h missing.h
+process.@OBJEXT@: process.c ruby.h config.h defines.h intern.h missing.h \
+ rubysig.h st.h
+random.@OBJEXT@: random.c ruby.h config.h defines.h intern.h missing.h
+range.@OBJEXT@: range.c ruby.h config.h defines.h intern.h missing.h
+re.@OBJEXT@: re.c ruby.h config.h defines.h intern.h missing.h re.h \
+ regex.h
+regex.@OBJEXT@: regex.c config.h regex.h
+ruby.@OBJEXT@: ruby.c ruby.h config.h defines.h intern.h missing.h dln.h \
+ node.h util.h
+signal.@OBJEXT@: signal.c ruby.h config.h defines.h intern.h missing.h \
+ rubysig.h
+sprintf.@OBJEXT@: sprintf.c ruby.h config.h defines.h intern.h missing.h
+st.@OBJEXT@: st.c config.h st.h
+string.@OBJEXT@: string.c ruby.h config.h defines.h intern.h missing.h \
+ re.h regex.h
+struct.@OBJEXT@: struct.c ruby.h config.h defines.h intern.h missing.h
+time.@OBJEXT@: time.c ruby.h config.h defines.h intern.h missing.h
+util.@OBJEXT@: util.c ruby.h config.h defines.h intern.h missing.h util.h
+variable.@OBJEXT@: variable.c ruby.h config.h defines.h intern.h \
+ missing.h env.h node.h st.h util.h
+version.@OBJEXT@: version.c ruby.h config.h defines.h intern.h missing.h \
+ version.h
diff --git a/README b/README
index 47012a3cb2..bde22dff78 100644
--- a/README
+++ b/README
@@ -5,6 +5,7 @@ easy object-oriented programming. It has many features to
process text files and to do system management tasks (as in
Perl). It is simple, straight-forward, and extensible.
+
* Features of Ruby
+ Simple Syntax
@@ -15,115 +16,88 @@ Perl). It is simple, straight-forward, and extensible.
+ Iterators and Closures
+ Garbage Collection
+ Dynamic Loading of Object files(on some architecture)
- + Highly Portable(works on many UNIX machines)
+ + Highly Portable(works on many UNIX machines, and on DOS,
+ Windows, Mac, BeOS etc.)
+
* How to get Ruby
-The Ruby distribution can be found on
+The Ruby distribution can be found on:
- ftp://ftp.netlab.co.jp/pub/lang/ruby/
+ ftp://ftp.ruby-lang.org/pub/ruby/
-* How to compile and install
-
-This is what you need to do to compile and install Ruby:
+You can get it by anonymous CVS. How to check out is:
- 1. Run ./configure, which will generate config.h and Makefile.
+ $ cvs -d :pserver:anonymous@cvs.ruby-lang.org:/src login
+ (Logging in to anonymous@cvs.ruby-lang.org)
+ CVS password: anonymous
+ $ cvs -z4 -d :pserver:anonymous@cvs.ruby-lang.org:/src checkout ruby
- 2. Edit defines.h if you need. Probably this step will not need.
- 3. Remove comment mark(#) before the module names from ext/Setup (or
- add module names if not present), if you want to link modules
- statically.
-
- If you don't want to compile non static extension modules
- (probably on architectures which does not allow dynamic loading),
- remove comment mark from the line "#option nodynamic" in
- ext/Setup.
+* Ruby home-page
- 4. Run make.
+The URL of the Ruby home-page is:
- 5. Optionally, run 'make test' to check whether the compiled Ruby
- interpreter works well. If you see the message "test succeeded",
- your ruby works as it should (hopefully).
+ http://www.ruby-lang.org/
- 6. Run 'make install'
- You may have to be a super user to install ruby.
+* Mailing list
-If you fail to compile ruby, please send the detailed error report with
-the error log and machine/OS type, to help others.
+There is a mailing list to talk about Ruby.
+To subscribe this list, please send the following phrase
-* Copying
+ subscribe YourFirstName YourFamilyName
+e.g.
+ subscribe Joseph Smith
-Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.co.jp>.
-You can redistribute it and/or modify it under either the terms of the GPL
-(see COPYING file), or the conditions below:
+in the mail body (not subject) to the address <ruby-talk-ctl@ruby-lang.org>.
- 1. You may make and give away verbatim copies of the source form of the
- software without restriction, provided that you duplicate all of the
- original copyright notices and associated disclaimers.
- 2. You may modify your copy of the software in any way, provided that
- you do at least ONE of the following:
+* How to compile and install
- a) place your modifications in the Public Domain or otherwise
- make them Freely Available, such as by posting said
- modifications to Usenet or an equivalent medium, or by allowing
- the author to include your modifications in the software.
+This is what you need to do to compile and install Ruby:
- b) use the modified software only within your corporation or
- organization.
+ 1. If ./configure does not exist or is older than configure.in,
+ run autoconf to (re)generate configure.
- c) rename any non-standard executables so the names do not conflict
- with standard executables, which must also be provided.
+ 2. Run ./configure, which will generate config.h and Makefile.
- d) make other distribution arrangements with the author.
+ 3. Edit defines.h if you need. Probably this step will not need.
- 3. You may distribute the software in object code or executable
- form, provided that you do at least ONE of the following:
+ 4. Remove comment mark(#) before the module names from ext/Setup (or
+ add module names if not present), if you want to link modules
+ statically.
- a) distribute the executables and library files of the software,
- together with instructions (in the manual page or equivalent)
- on where to get the original distribution.
+ If you don't want to compile non static extension modules
+ (probably on architectures which does not allow dynamic loading),
+ remove comment mark from the line "#option nodynamic" in
+ ext/Setup.
- b) accompany the distribution with the machine-readable source of
- the software.
+ 5. Run make.
- c) give non-standard executables non-standard names, with
- instructions on where to get the original software distribution.
+ 6. Optionally, run 'make test' to check whether the compiled Ruby
+ interpreter works well. If you see the message "test succeeded",
+ your ruby works as it should (hopefully).
- d) make other distribution arrangements with the author.
+ 7. Run 'make install'
- 4. You may modify and include the part of the software into any other
- software (possibly commercial). But some files in the distribution
- are not written by the author, so that they are not under this terms.
- They are gc.c(partly), utils.c(partly), regex.[ch], fnmatch.[ch],
- glob.c, st.[ch] and some files under the ./missing directory. See
- each file for the copying condition.
+ You may have to be a super user to install ruby.
- 5. The scripts and library files supplied as input to or produced as
- output from the software do not automatically fall under the
- copyright of the software, but belong to whomever generated them,
- and may be sold commercially, and may be aggregated with this
- software.
+If you fail to compile ruby, please send the detailed error report with
+the error log and machine/OS type, to help others.
- 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- PURPOSE.
-* Ruby home-page
+* Copying
-The URL of the Ruby home-page is:
+See the file COPYING.
- http://www.netlab.co.jp/ruby/
* The Author
Feel free to send comments and bug reports to the author. Here is the
author's latest mail address:
- matz@netlab.co.jp
+ matz@netlab.jp
-------------------------------------------------------
created at: Thu Aug 3 11:57:36 JST 1995
diff --git a/README.EXT b/README.EXT
index fb041bca9b..d832d1e0af 100644
--- a/README.EXT
+++ b/README.EXT
@@ -1,30 +1,30 @@
.\" README.EXT - -*- Text -*- created at: Mon Aug 7 16:45:54 JST 1995
-This document explains how to make extention modules for Ruby.
+This document explains how to make extension libraries for Ruby.
-1Basic knowledge
+1. Basic knowledge
In C, variables have types and data do not have types. In contrast,
-Ruby variables do not have static type and data themselves have
-types. So, data need to be converted across the languages.
+Ruby variables do not have a static type, and data themselves have
+types, so data will need to be converted between the languages.
-Data in Ruby represented C type `VALUE'. Each VALUE data have its
-data-type.
+Data in Ruby are represented by C type `VALUE'. Each VALUE data has
+its data-type.
-To retrieve an C data from the VALUE, you need to:
+To retrieve C data from a VALUE, you need to:
- (1) Identify VALUE's data type
- (2) Convert VALUE into C data
+ (1) Identify the VALUE's data type
+ (2) Convert the VALUE into C data
-Converting to wrong data type may cause serious promblems.
+Converting to the wrong data type may cause serious problems.
1.1 Data-types
-Ruby interpreter has data-types as below:
+The Ruby interpreter has the following data types:
T_NIL nil
- T_OBJECT ordinaly object
+ T_OBJECT ordinary object
T_CLASS class
T_MODULE module
T_FLOAT floating point number
@@ -32,17 +32,20 @@ Ruby interpreter has data-types as below:
T_REGEXP regular expression
T_ARRAY array
T_FIXNUM Fixnum(31bit integer)
- T_HASH assosiative array
+ T_HASH associative array
T_STRUCT (Ruby) structure
T_BIGNUM multi precision integer
+ T_FILE IO
T_TRUE true
T_FALSE false
T_DATA data
+ T_SYMBOL symbol
-Otherwise, there are several other types used internally:
+In addition, there are several other types used internally:
T_ICLASS
T_MATCH
+ T_UNDEF
T_VARMAP
T_SCOPE
T_NODE
@@ -51,9 +54,9 @@ Most of the types are represented by C structures.
1.2 Check Data Type of the VALUE
-The macro TYPE() defined in ruby.h shows data-type of the VALUE.
+The macro TYPE() defined in ruby.h shows the data type of the VALUE.
TYPE() returns the constant number T_XXXX described above. To handle
-data-types, the code will be like:
+data types, your code will look something like this:
switch (TYPE(obj)) {
case T_FIXNUM:
@@ -67,319 +70,306 @@ data-types, the code will be like:
break;
default:
/* raise exception */
- Fail("not valid value");
+ rb_raise(rb_eTypeError, "not valid value");
break;
}
-There is the data-type check function.
+There is the data-type check function
void Check_Type(VALUE value, int type)
-It raises an exception, if the VALUE does not have the type specified.
+which raises an exception if the VALUE does not have the type specified.
-There are faster check-macros for fixnums and nil.
+There are also faster check macros for fixnums and nil.
FIXNUM_P(obj)
NIL_P(obj)
1.3 Convert VALUE into C data
-T_NIL, T_FALSE, T_TRUE
-nil, false, true
-
+The data for type T_NIL, T_FALSE, T_TRUE are nil, true, false
+respectively. They are singletons for the data type.
+
+The T_FIXNUM data is a 31bit length fixed integer (63bit length on
+some machines), which can be convert to a C integer by using the
+FIX2INT() macro. There is also NUM2INT() which converts any Ruby
+numbers into C integers. The NUM2INT() macro includes a type check, so
+an exception will be raised if the conversion failed. NUM2DBL() can
+be used to retrieve the double float value in same way.
+
+To get char* from a VALUE, version 1.7 recommend to use new macros
+StringValue() and StringValuePtr(). StringValue(var) replaces var's
+value to the result of "var.to_str()". StringValuePtr(var) does same
+replacement and returns char* representation of var. These macros
+will skip the replacement if var is a String. Notice that the macros
+requires to take only lvalue as their argument, to change the value
+of var in the replacement.
+
+In version 1.6 or earlier, STR2CSTR() was used to do same thing
+but now it is obsoleted in version 1.7 because of STR2CSTR() has
+a risk of dangling pointer problem in to_str() impliclit conversion.
+
+Other data types have corresponding C structures, e.g. struct RArray
+for T_ARRAY etc. The VALUE of the type which has corresponding structure
+can be cast to retrieve the pointer to the struct. The casting macro
+will be of the form RXXXX for each data type; for instance, RARRAY(obj).
+See "ruby.h".
+
+For example, `RSTRING(str)->len' is the way to get the size of the
+Ruby String object. The allocated region can be accessed by
+`RSTRING(str)->ptr'. For arrays, use `RARRAY(ary)->len' and
+`RARRAY(ary)->ptr' respectively.
+
+Notice: Do not change the value of the structure directly, unless you
+are responsible for the result. This ends up being the cause of interesting
+bugs.
-T_FIXNUM31bit
-FIXNUMCFIX2INT()
-FIXNUMRuby
-NUM2INT()
-(
-)
-
-C
-VALUE()
-
-
-struct RXxxxxruby.h
-struct RString
-
-
-ruby.hRXXXXX()(
-)(: RSTRING())
+1.4 Convert C data into VALUE
-strRSTRING(str)->len
-strchar*RSTRING(str)->ptr
-RARRAT(str)->len
-RARRAT(str)->ptr
+To convert C data to Ruby values:
-Ruby
-
-
-
+ * FIXNUM
-1.4 Convert C data into VALUE
+ left shift 1 bit, and turn on LSB.
-VALUE
+ * Other pointer values
- * FIXNUM
+ cast to VALUE.
- 1bitLSB
+You can determine whether a VALUE is pointer or not by checking its LSB.
- *
+Notice Ruby does not allow arbitrary pointer values to be a VALUE. They
+should be pointers to the structures which Ruby knows about. The known
+structures are defined in <ruby.h>.
- VALUE
+To convert C numbers to Ruby values, use these macros.
-LSBVALUEFIXNUM
-(LSB
-)
+ INT2FIX() for integers within 31bits.
+ INT2NUM() for arbitrary sized integer.
-FIXNUMRubyVALUE
-VALUE
-VALUE
-Ruby(ruby.hstruct RXxxx
-)
+INT2NUM() converts an integer into a Bignum if it is out of the FIXNUM
+range, but is a bit slower.
-FIXNUMC
-VALUE
-
+1.5 Manipulating Ruby data
- INT2FIX() 31bit
- INT2NUM() VALUE
+As I already mentioned, it is not recommended to modify an object's internal
+structure. To manipulate objects, use the functions supplied by the Ruby
+interpreter. Some (not all) of the useful functions are listed below:
-INT2NUM()FIXNUMBignum
-()
+ String functions
-1.5 Manipulate Ruby data
+ rb_str_new(const char *ptr, long len)
-Ruby
-Ruby
-Ruby
+ Creates a new Ruby string.
-/
-()
+ rb_str_new2(const char *ptr)
- String funtions
+ Creates a new Ruby string from a C string. This is equivalent to
+ rb_str_new(ptr, strlen(ptr)).
- str_new(char *ptr, int len)
+ rb_tainted_str_new(const char *ptr, long len)
- Creates a new Ruby string.
+ Creates a new tainted Ruby string. Strings from external data
+ sources should be tainted.
- str_new2(char *ptr)
+ rb_tainted_str_new2(const char *ptr)
- Creates a new Ruby string from C string. This is equivalent to
- str_new(ptr, strlen(ptr)).
+ Creates a new tainted Ruby string from a C string.
- str_cat(VALUE str, char *ptr, int len)
+ rb_str_cat(VALUE str, const char *ptr, long len)
- Appends len bytes data from ptr to the Ruby string.
+ Appends len bytes of data from ptr to the Ruby string.
Array functions
- ary_new()
+ rb_ary_new()
- Creates an array with no element.
+ Creates an array with no elements.
- ary_new2(int len)
+ rb_ary_new2(long len)
- Creates an array with no element, with allocating internal buffer
+ Creates an array with no elements, allocating internal buffer
for len elements.
- ary_new3(int n, ...)
+ rb_ary_new3(long n, ...)
- Creates an n-elements array from arguments.
+ Creates an n-element array from the arguments.
- ary_new4(int n, VALUE *elts)
+ rb_ary_new4(long n, VALUE *elts)
- Creates an n-elements array from C array.
+ Creates an n-element array from a C array.
- ary_push(VALUE ary, VALUE val)
- ary_pop(VALUE ary)
- ary_shift(VALUE ary)
- ary_unshift(VALUE ary, VALUE val)
- ary_entry(VALUE ary, int idx)
+ rb_ary_push(VALUE ary, VALUE val)
+ rb_ary_pop(VALUE ary)
+ rb_ary_shift(VALUE ary)
+ rb_ary_unshift(VALUE ary, VALUE val)
Array operations. The first argument to each functions must be an
array. They may dump core if other types given.
-2. Extend Ruby with C
+2. Extending Ruby with C
-RubyCRubyC
-
-Ruby
-
+2.1 Addding new features to Ruby
-2.1 Add new features to Ruby
+You can add new features (classes, methods, etc.) to the Ruby
+interpreter. Ruby provides APIs for defining the following things:
-RubyRuby
-Ruby
-
+ * Classes, Modules
+ * Methods, Singleton Methods
+ * Constants
- *
- *
- *
+2.1.1 Class/module definition
-
+To define a class or module, use the functions below:
-2.1.1 Class/module definition
+ VALUE rb_define_class(const char *name, VALUE super)
+ VALUE rb_define_module(const char *name)
-
+These functions return the newly created class or module. You may
+want to save this reference into a variable to use later.
- VALUE rb_define_class(char *name, VALUE super)
- VALUE rb_define_module(char *name)
+To define nested classes or modules, use the functions below:
-
-
-
+ VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
+ VALUE rb_define_module_under(VALUE outer, const char *name)
2.1.2 Method/singleton method definition
-
+To define methods or singleton methods, use these functions:
- void rb_define_method(VALUE class, char *name,
+ void rb_define_method(VALUE klass, const char *name,
VALUE (*func)(), int argc)
- void rb_define_singleton_method(VALUE object, char *name,
- VALUE (*func)(), int argc)
+ void rb_define_singleton_method(VALUE object, const char *name,
+ VALUE (*func)(), int argc)
+The `argc' represents the number of the arguments to the C function,
+which must be less than 17. But I believe you don't need that much. :-)
-
-RubySmalltalk
-
-
+If `argc' is negative, it specifies the calling sequence, not number of
+the arguments.
- argcC(
-)argc
-16(
-)
+If argc is -1, the function will be called as:
-argc
-argc-1argc-2
-Ruby
+ VALUE func(int argc, VALUE *argv, VALUE obj)
-private
-rb_define_method()
+where argc is the actual number of arguments, argv is the C array of
+the arguments, and obj is the receiver.
- void rb_define_private_method(VALUE class, char *name,
- VALUE (*func)(), int argc)
+If argc is -2, the arguments are passed in a Ruby array. The function
+will be called like:
+
+ VALUE func(VALUE obj, VALUE args)
+
+where obj is the receiver, and args is the Ruby array containing
+actual arguments.
-private
-
+There are two more functions to define methods. One is to define
+private methods:
-
-private
-Mathsqrt()
-
+ void rb_define_private_method(VALUE klass, const char *name,
+ VALUE (*func)(), int argc)
+
+The other is to define module functions, which are private AND singleton
+methods of the module. For example, sqrt is the module function
+defined in Math module. It can be call in the form like:
Math.sqrt(4)
-
+or
include Math
sqrt(4)
-
-
+To define module functions, use:
- void rb_define_module_function(VALUE module, char *name,
+ void rb_define_module_function(VALUE module, const char *name,
VALUE (*func)(), int argc)
-(Kernelprivaet method)
-
+Oh, in addition, function-like methods, which are private methods defined
+in the Kernel module, can be defined using:
- void rb_define_global_function(char *name, VALUE (*func)(), int argc)
+ void rb_define_global_function(const char *name, VALUE (*func)(), int argc)
+To define alias to the method,
+
+ void rb_define_alias(VALUE module, const char* new, const char* old);
2.1.3 Constant definition
-
-
+We have 2 functions to define constants:
- void rb_define_const(VALUE class, char *name, VALUE val)
- void rb_define_global_const(char *name, VALUE val)
+ void rb_define_const(VALUE klass, const char *name, VALUE val)
+ void rb_define_global_const(const char *name, VALUE val)
-/
-
+The former is to define a constant under specified class/module. The
+latter is to define a global constant.
2.2 Use Ruby features from C
-1.5 Ruby
-Ruby
-
-
-#
-#
+There are several ways to invoke Ruby's features from C code.
-Ruby
+2.2.1 Evaluate Ruby Programs in a String
-2.2.1 Rubyeval
+The easiest way to use Ruby's functionality from a C program is to
+evaluate the string as Ruby program. This function will do the job.
-CRuby
-Ruby
+ VALUE rb_eval_string(const char *str)
- VALUE rb_eval_string(char *str)
-
-
-
+Evaluation is done under the current context, thus current local variables
+of the innermost method (which is defined by Ruby) can be accessed.
2.2.2 ID or Symbol
-CRuby
-Ruby
-ID
-
-IDRuby
+You can invoke methods directly, without parsing the string. First I
+need to explain about symbols (whose data type is ID). ID is the
+integer number to represent Ruby's identifiers such as variable names.
+It can be accessed from Ruby in the form:
- :
+ :Identifier
-C
+You can get the symbol value from a string within C code by using
- rb_intern(char *name)
-
-
-
+ rb_intern(const char *name)
2.2.3 Invoke Ruby method from C
-CRuby
-
+To invoke methods directly, you can use the function below
VALUE rb_funcall(VALUE recv, ID mid, int argc, ...)
-recvmid
-
+This function invokes a method on the recv, with the method name
+specified by the symbol mid.
-2.2.4 //
+2.2.4 Accessing the variables and constants
-C
-C
-
+You can access class variables and instance variables using access
+functions. Also, global variables can be shared between both environments.
+There's no way to access Ruby's local variables.
-
-
+The functions to access/modify instance variables are below:
VALUE rb_ivar_get(VALUE obj, ID id)
VALUE rb_ivar_set(VALUE obj, ID id, VALUE val)
-idrb_intern()
+id must be the symbol, which can be retrieved by rb_intern().
-
+To access the constants of the class/module:
VALUE rb_const_get(VALUE obj, ID id)
-2.1.3
-
-
-3. Informatin sharing between Ruby and C
+See 2.1.3 for defining new constant.
-CRuby
+3. Information sharing between Ruby and C
-3.1 Ruby constant that CRuby
+3.1 Ruby constants that C can be accessed from C
-Following Ruby constants can be referred from C.
+The following Ruby constants can be referred from C.
- TRUE
- FALSE
+ Qtrue
+ Qfalse
-Boolean values. FALSE is false in the C also (i.e. 0).
+Boolean values. Qfalse is false in C also (i.e. 0).
Qnil
@@ -387,168 +377,131 @@ Ruby nil in C scope.
3.2 Global variables shared between C and Ruby
-CRuby
-
-rb_define_variable()
+Information can be shared between the two environments using shared global
+variables. To define them, you can use functions listed below:
- void rb_define_variable(char *name, VALUE *var)
+ void rb_define_variable(const char *name, VALUE *var)
-RubyC
-`$'
-Ruby
+This function defines the variable which is shared by both environments.
+The value of the global variable pointed to by `var' can be accessed
+through Ruby's global variable named `name'.
-Rubyread only
-
+You can define read-only (from Ruby, of course) variables using the
+function below.
- void rb_define_readonly_variable(char *name, VALUE *var)
+ void rb_define_readonly_variable(const char *name, VALUE *var)
-hookhook
-hook
-hook
+You can defined hooked variables. The accessor functions (getter and
+setter) are called on access to the hooked variables.
- void rb_define_hooked_variable(char *name, VALUE *var,
- VALUE (*getter)(), VALUE (*setter)())
-
-Chook
-getter
-setterhookgetter
-setter0
+ void rb_define_hooked_variable(constchar *name, VALUE *var,
+ VALUE (*getter)(), void (*setter)())
-# gettersetter0rb_define_variable()
+If you need to supply either setter or getter, just supply 0 for the
+hook you don't need. If both hooks are 0, rb_define_hooked_variable()
+works just like rb_define_variable().
-CRuby
-
+ void rb_define_virtual_variable(const char *name,
+ VALUE (*getter)(), void (*setter)())
- void rb_define_virtual_variable(char *name,
- VALUE (*getter)(), VALUE (*setter)())
+This function defines a Ruby global variable without a corresponding C
+variable. The value of the variable will be set/get only by hooks.
-Ruby
-gettersetter
-
-The prototypes of the getter and setter functions are as following:
+The prototypes of the getter and setter functions are as follows:
(*getter)(ID id, void *data, struct global_entry* entry);
(*setter)(VALUE val, ID id, void *data, struct global_entry* entry);
3.3 Encapsulate C data into Ruby object
-C()Ruby
-Data
-RubyC()Ruby
-
-
-DataRuby
-
+To wrap and objectify a C pointer as a Ruby object (so called
+DATA), use Data_Wrap_Struct().
- Data_Wrap_Struct(class,mark,free,ptr)
+ Data_Wrap_Struct(klass, mark, free, ptr)
-Data
+Data_Wrap_Struct() returns a created DATA object. The klass argument
+is the class for the DATA object. The mark argument is the function
+to mark Ruby objects pointed by this data. The free argument is the
+function to free the pointer allocation. If this is -1, the pointer
+will be just freed. The functions mark and free will be called from
+garbage collector.
-classDataptr
-CmarkRuby
-
-0
+You can allocate and wrap the structure in one step.
-#
+ Data_Make_Struct(klass, type, mark, free, sval)
-free
-
+This macro returns an allocated Data object, wrapping the pointer to
+the structure, which is also allocated. This macro works like:
-CData
-
+ (sval = ALLOC(type), Data_Wrap_Struct(klass, mark, free, sval))
- Data_Make_Struct(class, type, mark, free, sval)
+Arguments klass, mark, and free work like their counterparts in
+Data_Wrap_Struct(). A pointer to the allocated structure will be
+assigned to sval, which should be a pointer of the type specified.
-Data
-
-class, mark, freeData_Wrap_Structtype
-Csval
- (type*)
-
-Data
-
+To retrieve the C pointer from the Data object, use the macro
+Data_Get_Struct().
Data_Get_Struct(obj, type, sval)
-Csval
+A pointer to the structure will be assigned to the variable sval.
-Data
-
+See the example below for details.
-4Example - Create dbm module
+4. Example - Creating dbm extension
-
-Rubyextdbm
-
+OK, here's the example of making an extension library. This is the
+extension to access DBMs. The full source is included in the ext/
+directory in the Ruby's source tree.
(1) make the directory
% mkdir ext/dbm
-Rubyext
-
-
-
-(2) create MANIFEST file
-
- % cd ext/dbm
- % touch MANIFEST
+Make a directory for the extension library under ext directory.
-MANIFEST
-
-
+(2) design the library
-MANIFESTmake
-
+You need to design the library features, before making it.
-(3) design the library
+(3) write C code.
-
-
-
-dbmext/dbm.doc
+You need to write C code for your extension library. If your library
+has only one source file, choosing ``LIBRARY.c'' as a file name is
+preferred. On the other hand, in case your library has multiple source
+files, avoid choosing ``LIBRARY.c'' for a file name. It may conflict
+with an intermediate file ``LIBRARY.o'' on some platforms.
-(4) write C code.
+Ruby will execute the initializing function named ``Init_LIBRARY'' in
+the library. For example, ``Init_dbm()'' will be executed when loading
+the library.
-CC
-.cC
-.c
-
-.o
-
-
-RubyInit_
-dbmInit_dbm
-
-dbm.c
+Here's the example of an initializing function.
--
Init_dbm()
{
- /* DBM */
- cDBM = rb_define_class("DBM", cObject);
- /* DBMEnumerate */
- rb_include_module(cDBM, mEnumerable);
+ /* define DBM class */
+ cDBM = rb_define_class("DBM", rb_cObject);
+ /* DBM includes Enumerate module */
+ rb_include_module(cDBM, rb_mEnumerable);
- /* DBMopen(): C */
+ /* DBM has class method open(): arguments are received as C array */
rb_define_singleton_method(cDBM, "open", fdbm_s_open, -1);
- /* DBMclose(): */
+ /* DBM instance method close(): no args */
rb_define_method(cDBM, "close", fdbm_close, 0);
- /* DBM[]: 1 */
+ /* DBM instance method []: 1 argument */
rb_define_method(cDBM, "[]", fdbm_fetch, 1);
:
- /* DBMID */
+ /* ID for a instance variable to store DBM data */
id_dbm = rb_intern("dbm");
}
--
-DBMdbm
-CdbmRuby
-
-
-dbm.cData_Make_Struct
+The dbm extension wraps the dbm struct in the C environment using
+Data_Make_Struct.
--
struct dbmdata {
@@ -557,15 +510,14 @@ struct dbmdata {
};
-obj = Data_Make_Struct(class,struct dbmdata,0,free_dbm,dbmp);
+obj = Data_Make_Struct(klass, struct dbmdata, 0, free_dbm, dbmp);
--
-dbmstructData
-DBM*close()
-
+This code wraps the dbmdata structure into a Ruby object. We avoid wrapping
+DBM* directly, because we want to cache size information.
-Datadbmstruct
-
+To retrieve the dbmdata structure from a Ruby object, we define the
+following macro:
--
#define GetDBM(obj, dbmp) {\
@@ -574,14 +526,11 @@ Datadbmstruct
}
--
-dbmdata
-close
-
+This sort of complicated macro does the retrieving and close checking for
+the DBM.
-DBM3
-
-deletedelete
-fdbm_delete()
+There are three kinds of way to receive method arguments. First,
+methods with a fixed number of arguments receive arguments like this:
--
static VALUE
@@ -592,20 +541,18 @@ fdbm_delete(obj, keystr)
}
--
-1self2
-
+The first argument of the C function is the self, the rest are the
+arguments to the method.
-CRuby
-dbmC
-DBMopen()
-fdbm_s_open()
+Second, methods with an arbitrary number of arguments receive
+arguments like this:
--
static VALUE
-fdbm_s_open(argc, argv, class)
+fdbm_s_open(argc, argv, klass)
int argc;
VALUE *argv;
- VALUE class;
+ VALUE klass;
{
:
if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
@@ -615,113 +562,105 @@ fdbm_s_open(argc, argv, class)
}
--
-12
-self3
-
+The first argument is the number of method arguments, the second
+argument is the C array of the method arguments, and the third
+argument is the receiver of the method.
-open()
-rb_scan_args()3
-4
-12
-3
-"*"23
-dbm.c"11"1
-2
-nil(CQnil)
+You can use the function rb_scan_args() to check and retrieve the
+arguments. For example, "11" means that the method requires at least one
+argument, and at most receives two arguments.
-Rubyindexes
-
+Methods with an arbitrary number of arguments can receive arguments
+by Ruby's array, like this:
--
static VALUE
fdbm_indexes(obj, args)
- VALUE obj;
- struct RArray *args;
+ VALUE obj, args;
{
:
}
--
-1self2Ruby
- struct RArray* VALUE
-
+The first argument is the receiver, the second one is the Ruby array
+which contains the arguments to the method.
-**
+** Notice
-RubyRuby
-CRuby
-GC
+GC should know about global variables which refer to Ruby's objects, but
+are not exported to the Ruby world. You need to protect them by
void rb_global_variable(VALUE *var)
-(5) prepare extconf.rb
+(4) prepare extconf.rb
+
+If the file named extconf.rb exists, it will be executed to generate
+Makefile. If not, the compilation scheme will try to generate Makefile
+anyway.
-extconf.rb
-makeMakefile
+extconf.rb is the file for check compilation conditions etc. You
+need to put
-extconf.rb
-extconf.rbRuby
-
+ require 'mkmf'
- have_library(lib, func):
- have_func(func):
- have_header(header):
- create_makefile(target): Makefile
+at the top of the file. You can use the functions below to check
+various conditions.
-
+ have_library(lib, func): check whether library containing function exists.
+ have_func(func, header): check whether function exists
+ have_header(header): check whether header file exists
+ create_makefile(target): generate Makefile
- $CFLAGS: (-I)
- $LDFLAGS: (-L)
+The value of the variables below will affect the Makefile.
-
-create_makefileMakefile
-
+ $CFLAGS: included in CFLAGS make variable (such as -I)
+ $LDFLAGS: included in LDFLAGS make variable (such as -L)
-(6) prepare depend (optional)
+If a compilation condition is not fulfilled, you should not call
+``create_makefile''. The Makefile will not generated, compilation will
+not be done.
-depend
-Makefile
+(5) prepare depend (optional)
- % gcc -MM *.c > depend
+If the file named depend exists, Makefile will include that file to
+check dependencies. You can make this file by invoking
-
+ % gcc -MM *.c > depend
-(7) MANIFEST
+It's no harm. Prepare it.
- % ls > MANIFEST
- % vi MANIFEST
+(6) generate Makefile
-*.o, *~MANIFEST
-makeMANIFEST
-
-
-
+Try generating the Makefile by:
-(8) make
+ ruby extconf.rb
-RubymakeMakefilemake
-Ruby
-extconf.rbMakefile
-Rubymake
+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.
-(9) debug
+(7) make
-You may need to debug the module. The modules can be linked
-statically by adding directory name in the ext/Setup file,
-so that you can inspect the module by the debugger.
+Type
-(10) done, now you have the extension module
+ make
-
-Ruby
-
+to compile your extension. You don't need this step either if you have
+put extension library under the ext directory of the ruby source tree.
-Appendix A. Ruby
+(8) debug
-Ruby
-
-
-
+You may need to rb_debug the extension. Extensions can be linked
+statically by the adding directory name in the ext/Setup file so that
+you can inspect the extension with the debugger.
+
+(9) done, now you have the extension library
+
+You can do anything you want with your library. The author of Ruby
+will not claim any restrictions on your code depending on the Ruby API.
+Feel free to use, modify, distribute or sell your program.
+
+Appendix A. Ruby source files overview
ruby language core
@@ -736,8 +675,6 @@ ruby language core
utility functions
dln.c
- fnmatch.c
- glob.c
regex.c
st.c
util.c
@@ -760,9 +697,11 @@ class library
file.c
hash.c
io.c
+ marshal.c
math.c
numeric.c
pack.c
+ prec.c
process.c
random.c
range.c
@@ -773,18 +712,15 @@ class library
struct.c
time.c
-Appendix B.
-
-CRubyAPI
+Appendix B. Ruby extension API reference
-**
+** Types
VALUE
-Ruby
-Cruby.hR
-VALUER
-
+The type for the Ruby object. Actual structures are defined in ruby.h,
+such as struct RString, etc. To refer the values in structures, use
+casting macros like RSTRING(obj).
** Variables and constants
@@ -792,269 +728,325 @@ Ruby
const: nil object
- TRUE
+ Qtrue
-const: TRUE object(default true value)
+const: true object(default true value)
- FALSE
+ Qfalse
-const: FALSE object
+const: false object
-** C
+** C pointer wrapping
- Data_Wrap_Struct(VALUE class, void (*mark)(), void (*free)(), void *sval)
+ Data_Wrap_Struct(VALUE klass, void (*mark)(), void (*free)(), void *sval)
-CRuby
-Rubyfree
-Ruby
-mark
-
+Wrap a C pointer into a Ruby object. If object has references to other
+Ruby objects, they should be marked by using the mark function during
+the GC process. Otherwise, mark should be 0. When this object is no
+longer referred by anywhere, the pointer will be discarded by free
+function.
- Data_Make_Struct(class, type, mark, free, sval)
+ Data_Make_Struct(klass, type, mark, free, sval)
-typemallocsval
-
+This macro allocates memory using malloc(), assigns it to the variable
+sval, and returns the DATA encapsulating the pointer to memory region.
Data_Get_Struct(data, type, sval)
-datatypesval
+This macro retrieves the pointer value from DATA, and assigns it to
+the variable sval.
+
+** Checking data types
+
+TYPE(value)
+FIXNUM_P(value)
+NIL_P(value)
+void Check_Type(VALUE value, int type)
+void Check_SafeStr(VALUE value)
+
+** Data type conversion
+
+FIX2INT(value)
+INT2FIX(i)
+NUM2INT(value)
+INT2NUM(i)
+NUM2DBL(value)
+rb_float_new(f)
+STR2CSTR(value)
+rb_str_new2(s)
-** /
+** defining class/module
- VALUE rb_define_class(char *name, VALUE super)
+ VALUE rb_define_class(const char *name, VALUE super)
-superRuby
+Defines a new Ruby class as a subclass of super.
- VALUE rb_define_class_under(VALUE module, char *name, VALUE super)
+ VALUE rb_define_class_under(VALUE module, const char *name, VALUE super)
-superRubymodule
-
+Creates a new Ruby class as a subclass of super, under the module's
+namespace.
- VALUE rb_define_module(char *name)
+ VALUE rb_define_module(const char *name)
-Ruby
+Defines a new Ruby module.
- VALUE rb_define_module_under(VALUE module, char *name, VALUE super)
+ VALUE rb_define_module_under(VALUE module, const char *name)
-Rubymodule
+Defines a new Ruby module under the module's namespace.
- void rb_include_module(VALUE class, VALUE module)
+ void rb_include_module(VALUE klass, VALUE module)
-classmodule
-()
+Includes module into class. If class already includes it, just
+ignored.
void rb_extend_object(VALUE object, VALUE module)
-()
+Extend the object with the module's attributes.
-**
+** Defining Global Variables
- void rb_define_variable(char *name, VALUE *var)
+ void rb_define_variable(const char *name, VALUE *var)
-RubyC`$'
-nameRuby
-(` ')Ruby
-
+Defines a global variable which is shared between C and Ruby. If name
+contains a character which is not allowed to be part of the symbol,
+it can't be seen from Ruby programs.
- void rb_define_readonly_variable(char *name, VALUE *var)
+ void rb_define_readonly_variable(const char *name, VALUE *var)
-RubyCread onlyread
-onlyrb_define_variable()
+Defines a read-only global variable. Works just like
+rb_define_variable(), except defined variable is read-only.
- void rb_define_virtual_variable(char *name,
- VALUE (*getter)(), VALUE (*setter)())
+ void rb_define_virtual_variable(const char *name,
+ VALUE (*getter)(), VALUE (*setter)())
+
+Defines a virtual variable, whose behavior is defined by a pair of C
+functions. The getter function is called when the variable is
+referred. The setter function is called when the value is set to the
+variable. The prototype for getter/setter functions are:
+
+ VALUE getter(ID id)
+ void setter(VALUE val, ID id)
-Ruby
-gettersetter
+The getter function must return the value for the access.
- void rb_define_hooked_variable(char *name, VALUE *var,
+ void rb_define_hooked_variable(const char *name, VALUE *var,
VALUE (*getter)(), VALUE (*setter)())
-hook
-gettersetter
-gettersetter0hook
-
+Defines hooked variable. It's a virtual variable with a C variable.
+The getter is called as
+
+ VALUE getter(ID id, VALUE *var)
+
+returning a new value. The setter is called as
+
+ void setter(VALUE val, ID id, VALUE *var)
+
+GC requires C global variables which hold Ruby values to be marked.
void rb_global_variable(VALUE *var)
-GCRuby, Ruby
-
+Tells GC to protect these variables.
-**
+** Constant Definition
- void rb_define_const(VALUE class, char *name, VALUE val)
+ void rb_define_const(VALUE klass, const char *name, VALUE val)
-
+Defines a new constant under the class/module.
- void rb_define_global_const(char *name, VALUE val)
+ void rb_define_global_const(const char *name, VALUE val)
-
+Defines a global constant. This is just the same as
rb_define_const(cKernal, name, val)
-
+** Method Definition
-**
+ rb_define_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
- rb_define_method(VALUE class, char *name, VALUE (*func)(), int argc)
+Defines a method for the class. func is the function pointer. argc
+is the number of arguments. if argc is -1, the function will receive
+3 arguments: argc, argv, and self. if argc is -2, the function will
+receive 2 arguments, self and args, where args is a Ruby array of
+the method arguments.
-argcselfargc-1,
-(self)1, 2
-(3self)argc-2, 1
-self, 2args(argsRuby)
-
+ rb_define_private_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
- rb_define_private_method(VALUE class, char *name, VALUE (*func)(), int argc)
+Defines a private method for the class. Arguments are same as
+rb_define_method().
-privaterb_define_method()
+ rb_define_singleton_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
- rb_define_singleton_method(VALUE class, char *name, VALUE (*func)(), int argc)
+Defines a singleton method. Arguments are same as rb_define_method().
-rb_define_method()
+ rb_scan_args(int argc, VALUE *argv, const char *fmt, ...)
- rb_scan_args(int atgc, VALUE *argv, char *fmt, ...)
+Retrieve argument from argc, argv. The fmt is the format string for
+the arguments, such as "12" for 1 non-optional argument, 2 optional
+arguments. If `*' appears at the end of fmt, it means the rest of
+the arguments are assigned to the corresponding variable, packed in
+an array.
-argc,argvfmt,
-, , "
-*" 2 "*"
-03
-,
-Qnil
-
-
-** Ruby
+** Invoking Ruby method
VALUE rb_funcall(VALUE recv, ID mid, int narg, ...)
-midrb_intern()
+Invokes a method. To retrieve mid from a method name, use rb_intern().
VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv)
-argc,argv
+Invokes a method, passing arguments by an array of values.
- VALUE rb_eval_string(char *str)
+ VALUE rb_eval_string(const char *str)
-Ruby
+Compiles and executes the string as a Ruby program.
- ID rb_intern(char *name)
+ ID rb_intern(const char *name)
-ID
+Returns ID corresponding to the name.
char *rb_id2name(ID id)
-ID()
+Returns the name corresponding ID.
+
+ char *rb_class2name(VALUE klass)
- char *rb_class2name(VALUE class)
+Returns the name of the class.
-class()class,
-
+ int rb_respond_to(VALUE object, ID id)
-**
+Returns true if the object responds to the message specified by id.
- VALUE rb_iv_get(VALUE obj, char *name)
+** Instance Variables
-obj`@'
- Ruby
-
+ VALUE rb_iv_get(VALUE obj, const char *name)
- VALUE rb_iv_set(VALUE obj, char *name, VALUE val)
+Retrieve the value of the instance variable. If the name is not
+prefixed by `@', that variable shall be inaccessible from Ruby.
-objval
+ VALUE rb_iv_set(VALUE obj, const char *name, VALUE val)
-**
+Sets the value of the instance variable.
+
+** Control Structure
VALUE rb_iterate(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2)
-func2, func1
-func1 arg1, func21
-, 2arg2
+Calls the function func1, supplying func2 as the block. func1 will be
+called with the argument arg1. func2 receives the value from yield as
+the first argument, arg2 as the second argument.
VALUE rb_yield(VALUE val)
-val
+Evaluates the block with value val.
VALUE rb_rescue(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2)
-func1arg1func1
- func2arg2
-func1, func2
-
+Calls the function func1, with arg1 as the argument. If an exception
+occurs during func1, it calls func2 with arg2 as the argument. The
+return value of rb_rescue() is the return value from func1 if no
+exception occurs, from func2 otherwise.
VALUE rb_ensure(VALUE (*func1)(), void *arg1, void (*func2)(), void *arg2)
-func1arg1, (
-) func2arg2func1
-()
+Calls the function func1 with arg1 as the argument, then calls func2
+with arg2 if execution terminated. The return value from
+rb_ensure() is that of func1.
+
+** Exceptions and Errors
+
+ void rb_warn(const char *fmt, ...)
+
+Prints a warning message according to a printf-like format.
+
+ void rb_warning(const char *fmt, ...)
+
+Prints a warning message according to a printf-like format, if
+$VERBOSE is true.
-**
+void rb_raise(rb_eRuntimeError, const char *fmt, ...)
- void Warning(char *fmt, ...)
+Raises RuntimeError. The fmt is a format string just like printf().
-verboseprintf()
+ void rb_raise(VALUE exception, const char *fmt, ...)
- void Fail(char *fmt, ...)
+Raises a class exception. The fmt is a format string just like printf().
-printf()
+ void rb_fatal(const char *fmt, ...)
- void Fatal(char *fmt, ...)
+Raises a fatal error, terminates the interpreter. No exception handling
+will be done for fatal errors, but ensure blocks will be executed.
-,
-(ensure
-)
+ void rb_bug(const char *fmt, ...)
- void Bug(char *fmt, ...)
+Terminates the interpreter immediately. This function should be
+called under the situation caused by the bug in the interpreter. No
+exception handling nor ensure execution will be done.
-
-
-
+** Initialize and Starts the Interpreter
-** Ruby
+The embedding API functions are below (not needed for extension libraries):
-Ruby
-
+ void ruby_init()
- void ruby_init(int argc, char **argv, char **envp)
+Initializes the interpreter.
-Ruby
+ void ruby_options(int argc, char **argv)
+
+Process command line arguments for the interpreter.
void ruby_run()
-Ruby
+Starts execution of the interpreter.
void ruby_script(char *name)
-Ruby($0)
-
+Specifies the name of the script ($0).
-Appendix B. extconf.rb
+Appendix C. Functions Available in extconf.rb
-extconf.rb
-
+These functions are available in extconf.rb:
have_library(lib, func)
-funclib
-TRUE
+Checks whether the library exists, containing the specified function.
+Returns true if the library exists.
+
+ find_library(lib, func, path...)
+
+Checks whether a library which contains the specified function exists in
+path. Returns true if the library exists.
- have_func(func)
+ have_func(func, header)
-funcfunc
-have_library
-TRUE
+Checks whether func exists with header. Returns true if the function
+exists. To check functions in an additional library, you need to
+check that library first using have_library().
have_header(header)
-
-TRUE
+Checks whether header exists. Returns true if the header file exists.
create_makefile(target)
-Makefile
-target
-
+Generates the Makefile for the extension library. If you don't invoke
+this method, the compilation will not be done.
+
+ with_config(withval[, default=nil])
+
+Parses the command line options and returns the value specified by
+--with-<withval>.
+
+ dir_config(target[, default_dir])
+ dir_config(target[, default_include, default_lib])
+
+Parses the command line options and adds the directories specified by
+--with-<target>-dir, --with-<target>-include, and/or --with-<target>-lib
+to $CFLAGS and/or $LDFLAGS. --with-<target>-dir=/path is equivalent to
+--with-<target>-include=/path/include --with-<target>-lib=/path/lib.
+Returns an array of the added directories ([include_dir, lib_dir]).
/*
* Local variables:
- * fill-column: 60
+ * fill-column: 70
* end:
*/
diff --git a/README.EXT.jp b/README.EXT.ja
index 09983b5ee0..7a4cb5df2a 100644
--- a/README.EXT.jp
+++ b/README.EXT.ja
@@ -1,6 +1,6 @@
-.\" README.EXT - -*- Text -*- created at: Mon Aug 7 16:45:54 JST 1995
+.\" README.EXT.ja - -*- Text -*- created at: Mon Aug 7 16:45:54 JST 1995
-Ruby
+Ruby
1
@@ -43,11 +43,13 @@ Ruby
T_TRUE
T_FALSE
T_DATA
+ T_SYMBOL
T_ICLASS
T_MATCH
+ T_UNDEF
T_VARMAP
T_SCOPE
T_NODE
@@ -73,7 +75,7 @@ ruby.hTYPE()VALUE
break;
default:
/* */
- TypeError("not valid value");
+ rb_raise(rb_eTypeError, "not valid value");
break;
}
@@ -102,10 +104,19 @@ FIXNUMNIL
FIXNUMRuby
NUM2INT()
(
-)
-
-double
-NUM2DBL()char*STR2CSTR()
+)double
+NUM2DBL()
+
+char* version 1.6 STR2CSTR()
+ to_str()
+ GC version 1.7
+obsolete StringValue() StringValuePtr()
+StringValue(var) var String
+ var var.to_str()
+StringValuePtr(var) var
+ var char* var
+var lvalue
+
C
VALUE()
@@ -120,8 +131,8 @@ ruby.hRXXXXX()(
strRSTRING(str)->len
strchar*RSTRING(str)->ptr
-RARRAY(str)->len
-RARRAY(str)->ptr
+RARRAY(ary)->len
+RARRAY(ary)->ptr
Ruby
@@ -134,7 +145,7 @@ VALUE
* FIXNUM
- 1bitLSB
+ 1bitLSB
*
@@ -171,43 +182,52 @@ Ruby
- str_new(char *ptr, int len)
+ rb_str_new(const char *ptr, long len)
Ruby
- str_new2(char *ptr)
+ rb_str_new2(const char *ptr)
CRuby
- str_new(ptr, strlen(ptr))
+ rb_str_new(ptr, strlen(ptr))
+
+ rb_tainted_str_new(const char *ptr, long len)
+
+ Ruby
+
+
+
+ rb_tainted_str_new2(const char *ptr)
+
+ CRuby
- str_cat(VALUE str, char *ptr, int len)
+ rb_str_cat(VALUE str, const char *ptr, long len)
Rubystrlenptr
- ary_new()
+ rb_ary_new()
0
- ary_new2(int len)
+ rb_ary_new2(long len)
0len
- ary_new3(int n, ...)
+ rb_ary_new3(long n, ...)
n
- ary_new4(int n, VALUE *elts)
+ rb_ary_new4(long n, VALUE *elts)
n
- ary_push(VALUE ary, VALUE val)
- ary_pop(VALUE ary)
- ary_shift(VALUE ary)
- ary_unshift(VALUE ary, VALUE val)
- ary_entry(VALUE ary, int idx)
+ rb_ary_push(VALUE ary, VALUE val)
+ rb_ary_pop(VALUE ary)
+ rb_ary_shift(VALUE ary)
+ rb_ary_unshift(VALUE ary, VALUE val)
Array1
@@ -235,8 +255,8 @@ RubyRuby
- VALUE rb_define_class(char *name, VALUE super)
- VALUE rb_define_module(char *name)
+ VALUE rb_define_class(const char *name, VALUE super)
+ VALUE rb_define_module(const char *name)
@@ -245,17 +265,17 @@ RubyRuby
- VALUE rb_define_class(VALUE outer, char *name, VALUE super)
- VALUE rb_define_module(VALUE outer, char *name)
+ VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
+ VALUE rb_define_module_under(VALUE outer, const char *name)
2.1.2 /
- void rb_define_method(VALUE class, char *name,
+ void rb_define_method(VALUE klass, const char *name,
VALUE (*func)(), int argc)
- void rb_define_singleton_method(VALUE object, char *name,
+ void rb_define_singleton_method(VALUE object, const char *name,
VALUE (*func)(), int argc)
@@ -265,10 +285,10 @@ RubyRuby
argcC(
-)argc
-16(
-)self
-1
+)argc0
+16(
+)self
+1
argc
argc-1argc-2
@@ -277,8 +297,8 @@ argc-1argc-2
private
rb_define_method()
- void rb_define_private_method(VALUE class, char *name,
- VALUE (*func)(), int argc)
+ void rb_define_private_method(VALUE klass, const char *name,
+ VALUE (*func)(), int argc)
private
@@ -298,22 +318,26 @@ private
- void rb_define_module_function(VALUE module, char *name,
+ void rb_define_module_function(VALUE module, const char *name,
VALUE (*func)(), int argc)
(Kernelprivate method)
- void rb_define_global_function(char *name, VALUE (*func)(), int argc)
+ void rb_define_global_function(const char *name, VALUE (*func)(), int argc)
+
+
+ void rb_define_alias(VALUE module, const char* new, const char* old);
+
2.1.3
-
+
- void rb_define_const(VALUE class, char *name, VALUE val)
- void rb_define_global_const(char *name, VALUE val)
+ void rb_define_const(VALUE klass, const char *name, VALUE val)
+ void rb_define_global_const(const char *name, VALUE val)
/
@@ -332,9 +356,9 @@ private
2.2.1 Rubyeval
CRuby
-Ruby
+Ruby
- VALUE rb_eval_string(char *str)
+ VALUE rb_eval_string(const char *str)
@@ -351,11 +375,10 @@ IDRuby
C
- rb_intern(char *name)
+ rb_intern(const char *name)
-
-Ruby(
-)ID
+Ruby(
+)ID
rb_to_id(VALUE symbol)
@@ -376,9 +399,9 @@ applyRuby
2.2.4 //
-C
-C
-
+C
+C
+
@@ -388,11 +411,11 @@ C
idrb_intern()
-
+
VALUE rb_const_get(VALUE obj, ID id)
-2.1.3
+2.1.3
3RubyC
@@ -401,16 +424,16 @@ CRuby
3.1 CRuby
-RubyC
+RubyC
- TRUE
- FALSE
+ Qtrue
+ Qfalse
-FALSEC(0)
+ QfalseC(0)
Qnil
-Cnil
+ Cnil
3.2 CRuby
@@ -418,7 +441,7 @@ CRuby
rb_define_variable()
- void rb_define_variable(char *name, VALUE *var)
+ void rb_define_variable(const char *name, VALUE *var)
RubyC
`$'
@@ -427,14 +450,14 @@ CRuby
Rubyread only
- void rb_define_readonly_variable(char *name, VALUE *var)
+ void rb_define_readonly_variable(const char *name, VALUE *var)
hookhook
hook
hook
- void rb_define_hooked_variable(char *name, VALUE *var,
- VALUE (*getter)(), VALUE (*setter)())
+ void rb_define_hooked_variable(const char *name, VALUE *var,
+ VALUE (*getter)(), void (*setter)())
Chook
getter
@@ -446,8 +469,8 @@ setter0
CRuby
- void rb_define_virtual_variable(char *name,
- VALUE (*getter)(), VALUE (*setter)())
+ void rb_define_virtual_variable(const char *name,
+ VALUE (*getter)(), void (*setter)())
Ruby
gettersetter
@@ -467,11 +490,11 @@ RubyC()Ruby
DataRuby
- Data_Wrap_Struct(class,mark,free,ptr)
+ Data_Wrap_Struct(klass, mark, free, ptr)
Data
-classDataptr
+klassDataptr
CmarkRuby
0
@@ -479,16 +502,17 @@ CmarkRuby
#
free
-
+-1
+
CData
- Data_Make_Struct(class, type, mark, free, sval)
+ Data_Make_Struct(klass, type, mark, free, sval)
Data
-class, mark, freeData_Wrap_Structtype
+klass, mark, freeData_Wrap_Structtype
Csval
(type*)
@@ -504,8 +528,8 @@ Csval
4 - dbm
-
-Rubyextdbm
+
+Rubyextdbm
(1)
@@ -515,41 +539,27 @@ Rubyextdbm
Ruby 1.1
Ruby
Rubyext
-
+
-(2) MANIFEST
-
- % cd ext/dbm
- % touch MANIFEST
-
-MANIFEST
-
-
-
-MANIFESTmake
-
-
-
-
-(3)
+(2)
-dbmext/dbm.doc
+
-(4) C
+(3) C
-CC
-.cC
-.c
+CC
+.cC
+.c
-.o
+.o
-RubyInit_
-dbmInit_dbm
+RubyInit_
+dbmInit_dbm
dbm.c
@@ -557,9 +567,9 @@ RubyInit_
Init_dbm()
{
/* DBM */
- cDBM = rb_define_class("DBM", cObject);
+ cDBM = rb_define_class("DBM", rb_cObject);
/* DBMEnumerate */
- rb_include_module(cDBM, mEnumerable);
+ rb_include_module(cDBM, rb_mEnumerable);
/* DBMopen(): C */
rb_define_singleton_method(cDBM, "open", fdbm_s_open, -1);
@@ -575,7 +585,7 @@ Init_dbm()
}
--
-DBMdbm
+DBMdbm
CdbmRuby
@@ -588,7 +598,7 @@ struct dbmdata {
};
-obj = Data_Make_Struct(class,struct dbmdata,0,free_dbm,dbmp);
+obj = Data_Make_Struct(klass, struct dbmdata, 0, free_dbm, dbmp);
--
dbmstructData
@@ -627,16 +637,16 @@ fdbm_delete(obj, keystr)
CRuby
-dbmC
+dbmC
DBMopen()
fdbm_s_open()
--
static VALUE
-fdbm_s_open(argc, argv, class)
+fdbm_s_open(argc, argv, klass)
int argc;
VALUE *argv;
- VALUE class;
+ VALUE klass;
{
:
if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
@@ -666,16 +676,13 @@ Rubyindexes
--
static VALUE
fdbm_indexes(obj, args)
- VALUE obj;
- struct RArray *args;
+ VALUE obj, args;
{
:
}
--
-1self2Ruby
- struct RArray* VALUE
-
+1self2Ruby
**
@@ -685,15 +692,19 @@ CRuby
void rb_global_variable(VALUE *var)
-(5) extconf.rb
+(4) extconf.rb
Makefileextconf.rb
-extconf.rb
-extconf.rbRuby
-
+extconf.rb
+
+
+ require 'mkmf'
+
+extconf.rbextconf.rbRuby
+
have_library(lib, func):
- have_func(func):
+ have_func(func, header):
have_header(header):
create_makefile(target): Makefile
@@ -702,37 +713,20 @@ Makefileextconf.rb
$CFLAGS: (-I)
$LDFLAGS: (-L)
-
-create_makefileMakefile
-
-
-Ruby 1.1
-
- require 'mkmf'
+
+create_makefileMakefile
+
-extconf.rb
-
-(6) depend
+(5) depend
depend
Makefile
- % gcc -MM *.c > depend
+ % gcc -MM *.c > depend
-(7) MANIFEST
-
- % ls > MANIFEST
- % vi MANIFEST
-
-*.o, *~MANIFEST
-makeMANIFEST
-
-
-
-
-(8) Makefile
+(6) Makefile
Makefile
@@ -748,7 +742,7 @@ Makefile
extRubymake
Makefile
-(9) make
+(7) make
make
make install
@@ -759,29 +753,29 @@ makeMakefilemake
extconf.rbMakefile
Rubymake
-make installRuby
-Ruby
-Ruby
- lib
+make installRuby
+Ruby
+Ruby
+ lib
.rb
-(10)
+(8)
ext/Setup
-(11)
+(9)
-Ruby
+Ruby
Appendix A. Ruby
Ruby
-
+
@@ -798,8 +792,6 @@ Ruby
dln.c
- fnmatch.c
- glob.c
regex.c
st.c
util.c
@@ -826,6 +818,7 @@ Ruby
math.c
numeric.c
pack.c
+ prec.c
process.c
random.c
range.c
@@ -842,303 +835,335 @@ CRubyAPI
**
- VALUE
+VALUE
-Ruby
-Cruby.hR
-VALUER
-
+ Ruby
+ Cruby.hR
+ VALUER
+
**
- Qnil
+Qnil
-: nil
+ : nil
- TRUE
+Qtrue
-: true()
+ : true()
- FALSE
+Qfalse
-: false
+ : false
** C
- Data_Wrap_Struct(VALUE class, void (*mark)(), void (*free)(), void *sval)
+Data_Wrap_Struct(VALUE klass, void (*mark)(), void (*free)(), void *sval)
-CRuby
-Rubyfree
-Ruby
-mark
-
+ CRuby
+ Rubyfree
+ Ruby
+ mark
+
- Data_Make_Struct(class, type, mark, free, sval)
+Data_Make_Struct(klass, type, mark, free, sval)
-typemallocsval
-
+ typemallocsval
+
- Data_Get_Struct(data, type, sval)
+Data_Get_Struct(data, type, sval)
-datatypesval
+ datatypesval
**
- TYPE(value)
- FIXNUM_P(value)
- NIL_P(value)
- void Check_Type(VALUE value, int type)
- void Check_SafeStr(VALUE value)
+TYPE(value)
+FIXNUM_P(value)
+NIL_P(value)
+void Check_Type(VALUE value, int type)
+void Check_SafeStr(VALUE value)
**
- FIX2INT(value)
- INT2FIX(i)
- NUM2INT(value)
- INT2NUM(i)
- NUM2DBL(value)
- float_new(f)
- STR2CSTR(value)
- str_new2(s)
+FIX2INT(value)
+INT2FIX(i)
+NUM2INT(value)
+INT2NUM(i)
+NUM2DBL(value)
+rb_float_new(f)
+STR2CSTR(value)
+rb_str_new2(s)
** /
- VALUE rb_define_class(char *name, VALUE super)
+VALUE rb_define_class(const char *name, VALUE super)
-superRuby
+ superRuby
- VALUE rb_define_class_under(VALUE module, char *name, VALUE super)
+VALUE rb_define_class_under(VALUE module, const char *name, VALUE super)
-superRubymodule
-
+ superRubymodule
+
- VALUE rb_define_module(char *name)
+VALUE rb_define_module(const char *name)
-Ruby
+ Ruby
- VALUE rb_define_module_under(VALUE module, char *name, VALUE super)
+VALUE rb_define_module_under(VALUE module, const char *name)
-Rubymodule
+ Rubymodule
- void rb_include_module(VALUE class, VALUE module)
+void rb_include_module(VALUE klass, VALUE module)
-classmodule
-()
+ classmodule
+ ()
- void rb_extend_object(VALUE object, VALUE module)
+void rb_extend_object(VALUE object, VALUE module)
-()
+ ()
**
- void rb_define_variable(char *name, VALUE *var)
+void rb_define_variable(const char *name, VALUE *var)
-RubyC`$'
-nameRuby
-(` ')Ruby
-
+ RubyC`$'
+ nameRuby
+ (` ')Ruby
+
- void rb_define_readonly_variable(char *name, VALUE *var)
+void rb_define_readonly_variable(const char *name, VALUE *var)
-RubyCread onlyread
-onlyrb_define_variable()
+ RubyCread only
+ read onlyrb_define_variable()
- void rb_define_virtual_variable(char *name,
- VALUE (*getter)(), VALUE (*setter)())
+void rb_define_virtual_variable(const char *name,
+ VALUE (*getter)(), void (*setter)())
-Ruby
-gettersetter
+ Ruby
+ gettersetter
+
- void rb_define_hooked_variable(char *name, VALUE *var,
- VALUE (*getter)(), VALUE (*setter)())
+void rb_define_hooked_variable(const char *name, VALUE *var,
+ VALUE (*getter)(), void (*setter)())
-hook
-gettersetter
-gettersetter0hook
-
+ hook
+ getter
+ settergettersetter0hook
+
- void rb_global_variable(VALUE *var)
+void rb_global_variable(VALUE *var)
-GCRuby, Ruby
-
+ GCRuby, Ruby
+
-**
+**
- void rb_define_const(VALUE class, char *name, VALUE val)
+void rb_define_const(VALUE klass, const char *name, VALUE val)
-
+
- void rb_define_global_const(char *name, VALUE val)
+void rb_define_global_const(const char *name, VALUE val)
-
+
- rb_define_const(cKernal, name, val)
+ rb_define_const(rb_cObject, name, val)
-
+
**
- rb_define_method(VALUE class, char *name, VALUE (*func)(), int argc)
+rb_define_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
-argcselfargc-1,
-(self)1, 2
-(3self)argc-2, 1
-self, 2args(argsRuby)
-
-
- rb_define_private_method(VALUE class, char *name, VALUE (*func)(), int argc)
+ argcselfargc-1,
+ (self)1, 2
+ (3self)argc-2,
+ 1self, 2args(argsRuby)
+
+
+rb_define_private_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
-privaterb_define_method()
+ privaterb_define_method()
- rb_define_singleton_method(VALUE class, char *name, VALUE (*func)(), int argc)
+rb_define_singleton_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
-rb_define_method()
+ rb_define_method()
- rb_scan_args(int atgc, VALUE *argv, char *fmt, ...)
+rb_scan_args(int argc, VALUE *argv, const char *fmt, ...)
-argc,argvfmt,
-, , "
-*" 2 "*"
-03
-,
-Qnil
-
+ argc, argvfmt,
+ , , "
+ *" 2 "*"
+ 03
+ ,
+ Qnil
+
** Ruby
- VALUE rb_funcall(VALUE recv, ID mid, int narg, ...)
+VALUE rb_funcall(VALUE recv, ID mid, int narg, ...)
+
+ midrb_intern()
+
+
+VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv)
-midrb_intern()
+ argc, argv
- VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv)
+VALUE rb_eval_string(const char *str)
-argc,argv
+ Ruby
- VALUE rb_eval_string(char *str)
+ID rb_intern(const char *name)
-Ruby
+ ID
- ID rb_intern(char *name)
+char *rb_id2name(ID id)
-ID
+ ID()
- char *rb_id2name(ID id)
+char *rb_class2name(VALUE klass)
-ID()
+ (),
+
- char *rb_class2name(VALUE class)
+int rb_respond_to(VALUE obj, ID id)
-class()class,
-
+ objid
**
- VALUE rb_iv_get(VALUE obj, char *name)
+VALUE rb_iv_get(VALUE obj, const char *name)
-obj`@'
- Ruby
-(
-)
+ obj`@'
+ Ruby
+ (
+ )
- VALUE rb_iv_set(VALUE obj, char *name, VALUE val)
+VALUE rb_iv_set(VALUE obj, const char *name, VALUE val)
-objval
+ objval
**
- VALUE rb_iterate(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2)
+VALUE rb_iterate(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2)
-func2, func1
-func1 arg1, func21
-, 2arg2
+ func2, func1
+ func1 arg1, func21
+ , 2arg2
- VALUE rb_yield(VALUE val)
+VALUE rb_yield(VALUE val)
-val
+ val
- VALUE rb_rescue(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2)
+VALUE rb_rescue(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2)
-func1arg1func1
- func2arg2
-func1, func2
-
+ func1arg1func1
+ func2arg2
+ func1, func2
+
- VALUE rb_ensure(VALUE (*func1)(), void *arg1, void (*func2)(), void *arg2)
+VALUE rb_ensure(VALUE (*func1)(), VALUE arg1, void (*func2)(), VALUE arg2)
-func1arg1, (
-) func2arg2func1
-()
+ func1arg1, (
+ ) func2arg2func1
+ ()
**
- void Warning(char *fmt, ...)
+void rb_warning(const char *fmt, ...)
-verboseprintf()
+ rb_verbose
+ printf()
- void Fail(char *fmt, ...)
+void rb_raise(rb_eRuntimeError, const char *fmt, ...)
-RuntimeErrorprintf()
+ RuntimeErrorprintf()
- void Raise(VALUE exception, char *fmt, ...)
+void rb_raise(VALUE exception, const char *fmt, ...)
-exceptionfmtprintf()
+ exceptionfmt
+ printf()
- void Fatal(char *fmt, ...)
+void rb_fatal(const char *fmt, ...)
-,
-(ensure
-)
+ ,
+ (ensure
+ )
- void Bug(char *fmt, ...)
+void rb_bug(const char *fmt, ...)
-
-
-
+
+
+
** Ruby
Ruby
-
+
- void ruby_init(int argc, char **argv, char **envp)
+void ruby_init()
-Ruby
+ Ruby
- void ruby_run()
+void ruby_options(int argc, char **argv)
-Ruby
+ Ruby
- void ruby_script(char *name)
+void ruby_run()
-Ruby($0)
+ Ruby
+void ruby_script(char *name)
-Appendix B. extconf.rb
+ Ruby($0)
+
+
+Appendix C. extconf.rb
extconf.rb
- have_library(lib, func)
+have_library(lib, func)
+
+ funclib
+ true
+
+find_library(lib, func, path...)
+
+ funclib -Lpath
+ true
+
+have_func(func, header)
+
+ headerfunc
+ func
+ have_library
+ true
+
+have_header(header)
-funclib
-TRUE
+
+ true
- have_func(func)
+create_makefile(target)
-funcfunc
-have_library
-TRUE
+ Makefile
+ target
+
- have_header(header)
+with_config(withval[, default=nil])
-
-TRUE
+ --with-<withval>
- create_makefile(target)
+dir_config(target[, default_dir])
+dir_config(target[, default_include, default_lib])
-Makefile
-target
-
+ --with-<target>-dir, --with-<target>-include,
+ --with-<target>-lib
+ $CFLAGS $LDFLAGS --with-<target>-dir=/path
+ --with-<target>-include=/path/include --with-<target>-lib=/path/lib
+ include lib
+ ([include_dir, lib_dir])
/*
* Local variables:
diff --git a/README.jp b/README.ja
index 0ef0065925..fc502dd440 100644
--- a/README.jp
+++ b/README.ja
@@ -10,7 +10,7 @@ RubyPerl
-* Ruby
+* Ruby
+
+ ()
@@ -20,7 +20,8 @@ RubyPerl
+
+
+ ()
- + UNIX
+ + UNIXDOSWindows
+ MacBeOS
*
@@ -29,39 +30,66 @@ RubyPerl
- ftp://ftp.netlab.co.jp/pub/lang/ruby/
+ ftp://ftp.ruby-lang.org/pub/ruby/
+
+** CVS
+
+ $ cvs -d :pserver:anonymous@cvs.ruby-lang.org:/src login
+ (Logging in to anonymous@cvs.ruby-lang.org)
+ CVS password: anonymous
+ $ cvs -z4 -d :pserver:anonymous@cvs.ruby-lang.org:src checkout ruby
*
- RubyURL
+RubyURL
+
+ http://www.ruby-lang.org/
+
+
+
+
+*
- http://www.netlab.co.jp/ruby/jp/
+Ruby
-
+ ruby-list-ctl@ruby-lang.org
+
-*
+ subscribe YourFirstName YourFamilyName
+
+
- Ruby
-
+Rubyruby
+
+
- ruby-list@netlab.co.jp
+ ruby-dev-ctl@ruby-lang.org
-
+ruby-list
+
+Rubyruby-ext
+ruby-math
+ruby-talk
+
*
- 1. configureMakefile
+ 1. configure
+ configure.inautoconf
+ configure
+
+ 2. configureMakefile
- 2. ()defines.h
+ 3. ()defines.h
- 3. ()ext/Setup
+ 4. ()ext/Setup
ext/Setup
@@ -72,14 +100,14 @@ RubyPerl
- 4. make
+ 5. make
- 5. make test
+ 6. make test
test succeeded
- 6. make install
+ 7. make install
root
@@ -94,7 +122,7 @@ UNIXconfigure
()
-GCRubyGC
+GCRubyGC
setjmp() jmp_buf
jmp_buf32bit
@@ -112,58 +140,12 @@ UNIXconfigure
*
-RUbyGPL(the GNU General Public
-Licence)RubyGPL
-COPYING
-
- 1.
-
- 2. Ruby
-
-
- (a)
-
-
- (b) Ruby
-
- (c)
- Ruby
-
-
- (d)
-
- 3. Ruby
-
-
- (a)
-
-
- (b)
-
- (c)
-
-
- (d)
-
- 4.
- Ruby
- gc.c()
- util.c()st.[ch]regex.[ch], fnmatch.[ch], glob.c
- ./missing
-
- 5. RubyRuby
- Ruby
- Ruby
-
-
- 6. RubyRuby
- RubyRuby
-
+COPYING.ja
*
- matz@netlab.co.jp
+ matz@netlab.jp
-------------------------------------------------------
created at: Thu Aug 3 11:57:36 JST 1995
Local variables:
diff --git a/ToDo b/ToDo
index 462bc47adb..b55e399edf 100644
--- a/ToDo
+++ b/ToDo
@@ -1,4 +1,126 @@
-* remove Enumerable#reverse at 1.2
-* non-blocking open/write for thread
-* package or access control for global variables
-* format
+Language Spec.
+
+- Class#allocate - basicNew
+- class Foo::Bar<Baz .. end, module Boo::Bar .. end
+* operator !! for rescue. ???
+* objectify characters
+* ../... outside condition invokes operator method too.
+* ... inside condition turns off just before right condition.???
+* package or access control for global variables??
+* named arguments like foo(nation:="german") or foo(nation: "german").
+* method to retrieve argument information (needs new C API)
+* multiple return values, yield values. maybe incompatible ???
+* cascading method invocation ???
+* def Class#method .. end ??
+* def Foo::Bar::baz() .. end ??
+* I18N (or M17N) script/string/regexp
+* Fixnum 0 as false ????
+* discourage use of symbol variables (e.g. $/, etc.) in manual
+* discourage use of Perlish features by giving warnings.
+* non confusing in-block local variable (is it possible?)
+ + remove scope by block
+ + variables appears within block may have independent values.
+* Regexp: make /o thread safe.
+* decide whether begin with rescue or ensure make do..while loop.
+* a +1 to be a+1, not a(+1).
+* unify == and eql? again
+* to_i returns nil if str contains no digit.
+* raise exception by `` error
+* jar like combined library package. -> RubyGems?
+* resumable Exception via Exception#resume.
+* method combination, e.g. before, after, around, etc.
+* .. or something like defadvice in Emacs.
+* property - for methods, or for objects in general.
+* "in" modifier, to annotate, or to encourage assertion.
+* selector namespace - something like generic-flet in CLOS, to help RubyBehavior
+* private instance variable (as in Python?) @_foo in class Foo => @_Foo_foo
+* warn/error "bare word" method, like "foo", you should type "foo()"
+* clarify evaluation order of operator argument (=~, .., ...)
+* :symbol => value hash in the form of {symbol: value, ...} ??
+
+Hacking Interpreter
+
+- generational GC
+* non-blocking open (e.g. for named pipe) for thread
+* avoid blocking with gethostbyname/gethostbyaddr (use fork ???)
+* objectify interpreters ???
+* remove rb_eval() recursions
+* syntax tree -> bytecode ???
+* scrambled script, or script filter
+* setuid ruby
+* performance tune for in-block (dynamic) local variables.
+* give warnings to assign magic variables.
+* export rb_io_{addstr,printf,puts,print}
+* autoload should work with threads [ruby-talk:4589]
+* remove stdio dependency from IOs.
+* warn for inconsistent local variable usage (lv m and method m at the same time).
+* MicroRuby
+* Built-in Interactive Ruby.
+* Parser API
+* trap every method invocation, which can be enabled by e.g. trap_call :method.
+* unify Errno exceptions of same errno, or new exception comparison scheme.
+* 2.times{|i| if i==0 then a = 15 else puts eval("a") end} should print nil.
+* Thread#max_stack_size attribute (possible??)
+
+Standard Libraries
+
+- Module#define_method which takes a name and a body (block, proc or method).
+- Enume#inject
+- Array#fetch
+- IO::for_fd
+- Process::waitall [ruby-talk:4557]
+- Process::Status
+- File::lchown, File::lchmod; xxx - still need work for non existing platforms
+- move Time::times to Process.
+- Enumerable#sort_by for Schwartzian transformation
+- fork_and_kill_other_threads.
+- signal list (Signal::trap, Signal::list).
+- move NameError under StandardError.
+- Integer#to_s(base)
+- Hash::new{default}
+- hash etc. should handle self referenceing array/hash
+- Array#select(n1,n2...) works like Array#indexes(n1,n2...)
+- use Mersenne Twister RNG for random.
+- deprecate Array#indexes, and Array#indices.
+- remove dependency on MAXPATHLEN.
+* String#scanf(?)
+* Object#fmt(?)
+* Time::strptime
+* Integer[num], Float[num]; Fixnum[num]?
+* method to retrieve non-number trailer for to_i/to_f.
+* Stream or Port, abstract superclass of IO ?
+* String#{pred,prev}, String#downto
+* optional stepsize argument for succ()
+* Ruby module -- Ruby::Version, Ruby::Interpreter
+* introduce Boolean class; super of TrueClass, FalseClass
+* synchronized method - synchronized{...}, synchronized :foo, :bar
+* Array#&, Array#| to allow duplication. ???
+* way to specify immortal (fork endurance) thread;
+* or raise ForkException to every thread but fork caller.
+* new user-defined marshal scheme. _dump(dumper), _load(restorer)
+* library to load per-user profile seeking .ruby_profile or ruby.ini file.
+* warning framework (warn, warning for Ruby level)
+* marshal should not depend on sprintf (works bad with locale).
+* ternary arg pow: a.pow(b,c) == a**b%c
+* new caller(), e.g. call_stack; needs better name.
+* pointer share mechanism similar to one in String for Array.
+* require "1.6" etc. by /usr/lib/ruby/1.6/1.6.rb ;-)
+* save both "feature names" and "normalized path" in $"
+* implement Mutex_m (or MutexMixin) using Mutex.
+
+Extension Libraries
+
+* ptk.rb pTk wrapper that is compatible to tk.rb
+* Berkeley DB extension
+* BitVector
+* thread-safe fcgi
+
+Ruby Libraries
+
+* urllib.rb, nttplib.rb, etc.
+* format like perl's
+
+Tools
+
+* freeze or undump to bundle everything
+* bundle using zlib
diff --git a/array.c b/array.c
index 10d554ba2c..03647f81fd 100644
--- a/array.c
+++ b/array.c
@@ -1,4 +1,4 @@
-/************************************************
+/**********************************************************************
array.c -
@@ -6,31 +6,35 @@
$Date$
created at: Fri Aug 6 09:46:12 JST 1993
- Copyright (C) 1993-1998 Yukihiro Matsumoto
+ Copyright (C) 1993-2003 Yukihiro Matsumoto
+ Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
+ Copyright (C) 2000 Information-technology Promotion Agency, Japan
-************************************************/
+**********************************************************************/
#include "ruby.h"
+#include "util.h"
+#include "st.h"
-
-VALUE cArray;
+VALUE rb_cArray;
+static ID id_cmp;
#define ARY_DEFAULT_SIZE 16
void
-memclear(mem, size)
+rb_mem_clear(mem, size)
register VALUE *mem;
- register int size;
+ register long size;
{
while (size--) {
*mem++ = Qnil;
}
}
-static void
+static inline void
memfill(mem, size, val)
register VALUE *mem;
- register int size;
+ register long size;
register VALUE val;
{
while (size--) {
@@ -38,61 +42,106 @@ memfill(mem, size, val)
}
}
-#define ARY_FREEZE FL_USER1
+#define ARY_TMPLOCK FL_USER1
+
+static inline void
+rb_ary_modify_check(ary)
+ VALUE ary;
+{
+ if (OBJ_FROZEN(ary)) rb_error_frozen("array");
+ if (FL_TEST(ary, ARY_TMPLOCK))
+ rb_raise(rb_eRuntimeError, "can't modify array during iteration");
+ if (!OBJ_TAINTED(ary) && rb_safe_level() >= 4)
+ rb_raise(rb_eSecurityError, "Insecure: can't modify array");
+}
static void
-ary_modify(ary)
+rb_ary_modify(ary)
VALUE ary;
{
- rb_secure(5);
- if (FL_TEST(ary, ARY_FREEZE)) {
- TypeError("can't modify frozen array");
+ VALUE *ptr;
+
+ rb_ary_modify_check(ary);
+ if (FL_TEST(ary, ELTS_SHARED)) {
+ ptr = ALLOC_N(VALUE, RARRAY(ary)->len);
+ FL_UNSET(ary, ELTS_SHARED);
+ RARRAY(ary)->aux.capa = RARRAY(ary)->len;
+ MEMCPY(ptr, RARRAY(ary)->ptr, VALUE, RARRAY(ary)->len);
+ RARRAY(ary)->ptr = ptr;
}
}
VALUE
-ary_freeze(ary)
+rb_ary_freeze(ary)
VALUE ary;
{
- FL_SET(ary, ARY_FREEZE);
- return ary;
+ return rb_obj_freeze(ary);
}
+/*
+ * call-seq:
+ * array.frozen? -> true or false
+ *
+ * Return <code>true</code> if this array is frozen (or temporarily frozen
+ * while being sorted).
+ */
+
static VALUE
-ary_frozen_p(ary)
+rb_ary_frozen_p(ary)
VALUE ary;
{
- if (FL_TEST(ary, ARY_FREEZE))
- return TRUE;
- return FALSE;
+ if (OBJ_FROZEN(ary)) return Qtrue;
+ if (FL_TEST(ary, ARY_TMPLOCK)) return Qtrue;
+ return Qfalse;
}
-VALUE
-ary_new2(len)
- int len;
+static VALUE ary_alloc _((VALUE));
+static VALUE
+ary_alloc(klass)
+ VALUE klass;
{
NEWOBJ(ary, struct RArray);
- OBJSETUP(ary, cArray, T_ARRAY);
+ OBJSETUP(ary, klass, T_ARRAY);
- if (len < 0) {
- ArgError("negative array size (or size too big)");
- }
- if (len > 0 && len*sizeof(VALUE) <= 0) {
- ArgError("array size too big");
- }
ary->len = 0;
- ary->capa = len;
ary->ptr = 0;
- ary->ptr = ALLOC_N(VALUE, len);
- memclear(ary->ptr, len);
+ ary->aux.capa = 0;
return (VALUE)ary;
}
+static VALUE
+ary_new(klass, len)
+ VALUE klass;
+ long len;
+{
+ VALUE ary = ary_alloc(klass);
+
+ if (len < 0) {
+ rb_raise(rb_eArgError, "negative array size (or size too big)");
+ }
+ if (len > 0 && len * sizeof(VALUE) <= len) {
+ rb_raise(rb_eArgError, "array size too big");
+ }
+ if (len == 0) len++;
+ RARRAY(ary)->ptr = ALLOC_N(VALUE, len);
+ RARRAY(ary)->aux.capa = len;
+
+ return ary;
+}
+
VALUE
-ary_new()
+rb_ary_new2(len)
+ long len;
{
- return ary_new2(ARY_DEFAULT_SIZE);
+ return ary_new(rb_cArray, len);
+}
+
+
+VALUE
+rb_ary_new()
+{
+ return rb_ary_new2(ARY_DEFAULT_SIZE);
}
#ifdef HAVE_STDARG_PROTOTYPES
@@ -105,21 +154,18 @@ ary_new()
VALUE
#ifdef HAVE_STDARG_PROTOTYPES
-ary_new3(int n, ...)
+rb_ary_new3(long n, ...)
#else
-ary_new3(n, va_alist)
- int n;
+rb_ary_new3(n, va_alist)
+ long n;
va_dcl
#endif
{
va_list ar;
VALUE ary;
- int i;
+ long i;
- if (n < 0) {
- IndexError("Negative number of items(%d)", n);
- }
- ary = ary_new2(n<ARY_DEFAULT_SIZE?ARY_DEFAULT_SIZE:n);
+ ary = rb_ary_new2(n);
va_init_list(ar, n);
for (i=0; i<n; i++) {
@@ -132,14 +178,14 @@ ary_new3(n, va_alist)
}
VALUE
-ary_new4(n, elts)
- int n;
- VALUE *elts;
+rb_ary_new4(n, elts)
+ long n;
+ const VALUE *elts;
{
VALUE ary;
- ary = ary_new2(n);
- if (elts) {
+ ary = rb_ary_new2(n);
+ if (n > 0 && elts) {
MEMCPY(RARRAY(ary)->ptr, elts, VALUE, n);
}
RARRAY(ary)->len = n;
@@ -148,12 +194,12 @@ ary_new4(n, elts)
}
VALUE
-assoc_new(car, cdr)
+rb_assoc_new(car, cdr)
VALUE car, cdr;
{
VALUE ary;
- ary = ary_new2(2);
+ ary = rb_ary_new2(2);
RARRAY(ary)->ptr[0] = car;
RARRAY(ary)->ptr[1] = cdr;
RARRAY(ary)->len = 2;
@@ -162,80 +208,175 @@ assoc_new(car, cdr)
}
static VALUE
-ary_s_new(argc, argv, klass)
+to_ary(ary)
+ VALUE ary;
+{
+ return rb_convert_type(ary, T_ARRAY, "Array", "to_ary");
+}
+
+VALUE
+rb_check_array_type(ary)
+ VALUE ary;
+{
+ return rb_check_convert_type(ary, T_ARRAY, "Array", "to_ary");
+}
+
+static VALUE rb_ary_replace _((VALUE, VALUE));
+
+/*
+ * call-seq:
+ * Array.new(size=0, obj=nil)
+ * Array.new(array)
+ * Array.new(size) {|index| block }
+ *
+ * Returns a new array. In the first form, the new array is
+ * empty. In the second it is created with _size_ copies of _obj_
+ * (that is, _size_ references to the same
+ * _obj_). The third form creates a copy of the array
+ * passed as a parameter (the array is generated by calling
+ * to_ary on the parameter). In the last form, an array
+ * of the given size is created. Each element in this array is
+ * calculated by passing the element's index to the given block and
+ * storing the return value.
+ *
+ * Array.new
+ * Array.new(2)
+ * Array.new(5, "A")
+ *
+ * # only one copy of the object is created
+ * a = Array.new(2, Hash.new)
+ * a[0]['cat'] = 'feline'
+ * a
+ * a[1]['cat'] = 'Felix'
+ * a
+ *
+ * # here multiple copies are created
+ * a = Array.new(2) { Hash.new }
+ * a[0]['cat'] = 'feline'
+ * a
+ *
+ * squares = Array.new(5) {|i| i*i}
+ * squares
+ *
+ * copy = Array.new(squares)
+ */
+
+static VALUE
+rb_ary_initialize(argc, argv, ary)
int argc;
VALUE *argv;
- VALUE klass;
+ VALUE ary;
{
- int len = 0;
+ long len;
VALUE size, val;
- NEWOBJ(ary, struct RArray);
- OBJSETUP(ary, klass, T_ARRAY);
- ary->len = 0;
- ary->ptr = 0;
+ rb_ary_modify(ary);
if (rb_scan_args(argc, argv, "02", &size, &val) == 0) {
- ary->capa = ARY_DEFAULT_SIZE;
+ RARRAY(ary)->len = 0;
+ if (rb_block_given_p()) {
+ rb_warning("given block not used");
+ }
+ return ary;
}
- else {
- int capa = NUM2INT(size);
- if (capa < 0) {
- ArgError("negative array size");
+ if (argc == 1 && !FIXNUM_P(size)) {
+ val = rb_check_array_type(size);
+ if (!NIL_P(val)) {
+ rb_ary_replace(ary, val);
+ return ary;
}
- if (capa > 0 && capa*sizeof(VALUE) <= 0) {
- ArgError("array size too big");
+ }
+
+ len = NUM2LONG(size);
+ if (len < 0) {
+ rb_raise(rb_eArgError, "negative array size");
+ }
+ if (len > 0 && len * (long)sizeof(VALUE) <= len) {
+ rb_raise(rb_eArgError, "array size too big");
+ }
+ if (len > RARRAY(ary)->aux.capa) {
+ REALLOC_N(RARRAY(ary)->ptr, VALUE, len);
+ RARRAY(ary)->aux.capa = len;
+ }
+ if (rb_block_given_p()) {
+ long i;
+
+ if (argc == 2) {
+ rb_warn("block supersedes default value argument");
+ }
+ for (i=0; i<len; i++) {
+ rb_ary_store(ary, i, rb_yield(LONG2NUM(i)));
+ RARRAY(ary)->len = i + 1;
}
- ary->capa = capa;
- len = capa;
}
- ary->ptr = ALLOC_N(VALUE, ary->capa);
- memfill(ary->ptr, len, val);
- ary->len = len;
- obj_call_init((VALUE)ary);
+ else {
+ memfill(RARRAY(ary)->ptr, len, val);
+ RARRAY(ary)->len = len;
+ }
- return (VALUE)ary;
+ return ary;
}
+
+/*
+* Returns a new array populated with the given objects.
+*
+* Array.[]( 1, 'a', /^A/ )
+* Array[ 1, 'a', /^A/ ]
+* [ 1, 'a', /^A/ ]
+*/
+
static VALUE
-ary_s_create(argc, argv, klass)
+rb_ary_s_create(argc, argv, klass)
int argc;
VALUE *argv;
VALUE klass;
{
- NEWOBJ(ary, struct RArray);
- OBJSETUP(ary, klass, T_ARRAY);
+ VALUE ary = ary_alloc(klass);
- ary->len = argc;
- ary->capa = argc;
- if (argc == 0) {
- ary->ptr = 0;
+ if (argc < 0) {
+ rb_raise(rb_eArgError, "negative number of arguments");
}
- else {
- ary->ptr = ALLOC_N(VALUE, argc);
- MEMCPY(ary->ptr, argv, VALUE, argc);
+ if (argc > 0) {
+ RARRAY(ary)->ptr = ALLOC_N(VALUE, argc);
+ MEMCPY(RARRAY(ary)->ptr, argv, VALUE, argc);
}
+ RARRAY(ary)->len = RARRAY(ary)->aux.capa = argc;
- return (VALUE)ary;
+ return ary;
}
void
-ary_store(ary, idx, val)
+rb_ary_store(ary, idx, val)
VALUE ary;
- int idx;
+ long idx;
VALUE val;
{
- ary_modify(ary);
+ rb_ary_modify(ary);
if (idx < 0) {
- IndexError("negative index for array");
+ idx += RARRAY(ary)->len;
+ if (idx < 0) {
+ rb_raise(rb_eIndexError, "index %ld out of array",
+ idx - RARRAY(ary)->len);
+ }
}
- if (idx >= RARRAY(ary)->capa) {
- RARRAY(ary)->capa = idx + ARY_DEFAULT_SIZE;
- REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->capa);
+ if (idx >= RARRAY(ary)->aux.capa) {
+ long new_capa = RARRAY(ary)->aux.capa / 2;
+
+ 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");
+ }
+ REALLOC_N(RARRAY(ary)->ptr, VALUE, new_capa);
+ RARRAY(ary)->aux.capa = new_capa;
}
if (idx > RARRAY(ary)->len) {
- memclear(RARRAY(ary)->ptr+RARRAY(ary)->len, idx-RARRAY(ary)->len+1);
+ rb_mem_clear(RARRAY(ary)->ptr + RARRAY(ary)->len,
+ idx-RARRAY(ary)->len + 1);
}
if (idx >= RARRAY(ary)->len) {
@@ -244,444 +385,930 @@ ary_store(ary, idx, val)
RARRAY(ary)->ptr[idx] = val;
}
+/*
+ * call-seq:
+ * array << obj -> array
+ *
+ * Append---Pushes the given object on to the end of this array. This
+ * expression returns the array itself, so several appends
+ * may be chained together.
+ *
+ * [ 1, 2 ] << "c" << "d" << [ 3, 4 ]
+ * #=> [ 1, 2, "c", "d", [ 3, 4 ] ]
+ *
+ */
+
VALUE
-ary_push(ary, item)
+rb_ary_push(ary, item)
VALUE ary;
VALUE item;
{
- ary_store(ary, RARRAY(ary)->len, item);
+ rb_ary_store(ary, RARRAY(ary)->len, item);
return ary;
}
+/*
+ * call-seq:
+ * array.push(obj, ... ) -> array
+ *
+ * Append---Pushes the given object(s) on to the end of this array. This
+ * expression returns the array itself, so several appends
+ * may be chained together.
+ *
+ * a = [ "a", "b", "c" ]
+ * a.push("d", "e", "f")
+ * #=> ["a", "b", "c", "d", "e", "f"]
+ */
+
static VALUE
-ary_push_method(argc, argv, ary)
+rb_ary_push_m(argc, argv, ary)
int argc;
VALUE *argv;
VALUE ary;
{
while (argc--) {
- ary_store(ary, RARRAY(ary)->len, *argv++);
+ rb_ary_push(ary, *argv++);
}
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
-ary_pop(ary)
+rb_ary_pop(ary)
VALUE ary;
{
+ rb_ary_modify_check(ary);
if (RARRAY(ary)->len == 0) return Qnil;
- if (RARRAY(ary)->len * 10 < RARRAY(ary)->capa && RARRAY(ary)->capa > ARY_DEFAULT_SIZE) {
- RARRAY(ary)->capa = RARRAY(ary)->len * 2;
- REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->capa);
+ if (!FL_TEST(ary, ELTS_SHARED) &&
+ RARRAY(ary)->len * 2 < 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);
}
return RARRAY(ary)->ptr[--RARRAY(ary)->len];
}
+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;
+ }
+}
+
+/*
+ * call-seq:
+ * array.shift -> obj or nil
+ *
+ * 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.
+ *
+ * args = [ "-m", "-q", "filename" ]
+ * args.shift #=> "-m"
+ * args #=> ["-q", "filename"]
+ */
+
VALUE
-ary_shift(ary)
+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];
+ ary_make_shared(ary);
+ RARRAY(ary)->ptr++; /* shift ptr */
RARRAY(ary)->len--;
- /* sliding items */
- MEMMOVE(RARRAY(ary)->ptr, RARRAY(ary)->ptr+1, VALUE, RARRAY(ary)->len);
- if (RARRAY(ary)->len * 10 < RARRAY(ary)->capa && RARRAY(ary)->capa > ARY_DEFAULT_SIZE) {
- RARRAY(ary)->capa = RARRAY(ary)->len * 2;
- REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->capa);
- }
-
return top;
}
VALUE
-ary_unshift(ary, item)
+rb_ary_unshift(ary, item)
VALUE ary, item;
{
- ary_modify(ary);
- if (RARRAY(ary)->len >= RARRAY(ary)->capa) {
- RARRAY(ary)->capa+=ARY_DEFAULT_SIZE;
- REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->capa);
+ rb_ary_modify(ary);
+ if (RARRAY(ary)->len == RARRAY(ary)->aux.capa) {
+ long capa_inc = RARRAY(ary)->aux.capa / 2;
+ if (capa_inc < ARY_DEFAULT_SIZE) {
+ capa_inc = ARY_DEFAULT_SIZE;
+ }
+ RARRAY(ary)->aux.capa += capa_inc;
+ REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->aux.capa);
}
/* sliding items */
- MEMMOVE(RARRAY(ary)->ptr+1, RARRAY(ary)->ptr, VALUE, RARRAY(ary)->len);
+ MEMMOVE(RARRAY(ary)->ptr + 1, RARRAY(ary)->ptr, VALUE, RARRAY(ary)->len);
RARRAY(ary)->len++;
- return RARRAY(ary)->ptr[0] = item;
+ RARRAY(ary)->ptr[0] = item;
+
+ return ary;
}
-VALUE
-ary_entry(ary, offset)
+/*
+ * call-seq:
+ * array.unshift(obj, ...) -> array
+ *
+ * Prepends objects to the front of <i>array</i>.
+ * other elements up one.
+ *
+ * a = [ "b", "c", "d" ]
+ * a.unshift("a") #=> ["a", "b", "c", "d"]
+ * a.unshift(1, 2) #=> [ 1, 2, "a", "b", "c", "d"]
+ */
+
+static VALUE
+rb_ary_unshift_m(argc, argv, ary)
+ int argc;
+ VALUE *argv;
VALUE ary;
- int offset;
{
- if (RARRAY(ary)->len == 0) return Qnil;
+ long len = RARRAY(ary)->len;
- if (offset < 0) {
- offset = RARRAY(ary)->len + offset;
+ if (argc < 0) {
+ rb_raise(rb_eArgError, "negative number of arguments");
}
+ if (argc == 0) return ary;
+
+ /* make rooms by setting the last item */
+ rb_ary_store(ary, len + argc - 1, Qnil);
+
+ /* sliding items */
+ MEMMOVE(RARRAY(ary)->ptr + argc, RARRAY(ary)->ptr, VALUE, len);
+ MEMCPY(RARRAY(ary)->ptr, argv, VALUE, argc);
+
+ return ary;
+}
+
+/* faster version - use this if you don't need to treat negative offset */
+static inline VALUE
+rb_ary_elt(ary, offset)
+ VALUE ary;
+ long offset;
+{
+ if (RARRAY(ary)->len == 0) return Qnil;
if (offset < 0 || RARRAY(ary)->len <= offset) {
return Qnil;
}
-
return RARRAY(ary)->ptr[offset];
}
+VALUE
+rb_ary_entry(ary, offset)
+ VALUE ary;
+ long offset;
+{
+ if (offset < 0) {
+ offset += RARRAY(ary)->len;
+ }
+ return rb_ary_elt(ary, offset);
+}
+
static VALUE
-ary_subseq(ary, beg, len)
+rb_ary_subseq(ary, beg, len)
VALUE ary;
- int beg, len;
+ long beg, len;
{
- VALUE ary2;
+ VALUE klass, ary2, shared;
+ VALUE *ptr;
+
+ if (beg > RARRAY(ary)->len) return Qnil;
+ if (beg < 0 || len < 0) return Qnil;
- if (beg < 0) {
- beg = RARRAY(ary)->len + beg;
- if (beg < 0) beg = 0;
- }
- if (len < 0) {
- IndexError("negative length %d", RARRAY(ary)->len);
- }
- if (len == 0) {
- return ary_new2(0);
- }
if (beg + len > RARRAY(ary)->len) {
len = RARRAY(ary)->len - beg;
+ if (len < 0)
+ len = 0;
}
- if (len < 0) {
- len = 0;
- }
+ klass = rb_obj_class(ary);
+ if (len == 0) return ary_new(klass, 0);
- ary2 = ary_new2(len);
- MEMCPY(RARRAY(ary2)->ptr, RARRAY(ary)->ptr+beg, VALUE, len);
+ shared = ary_make_shared(ary);
+ ptr = RARRAY(ary)->ptr;
+ ary2 = ary_alloc(klass);
+ RARRAY(ary2)->ptr = ptr + beg;
RARRAY(ary2)->len = len;
+ RARRAY(ary2)->aux.shared = shared;
+ FL_SET(ary2, ELTS_SHARED);
return ary2;
}
-static VALUE
-beg_len(range, begp, lenp, len)
- VALUE range;
- int *begp, *lenp;
- int len;
-{
- int beg, end;
- int b, e;
+/*
+ * call-seq:
+ * array[index] -> obj or nil
+ * array[start, length] -> an_array or nil
+ * array[range] -> an_array or nil
+ * array.slice(index) -> obj or nil
+ * array.slice(start, length) -> an_array or nil
+ * array.slice(range) -> an_array or nil
+ *
+ * Element Reference---Returns the element at _index_,
+ * or returns a subarray starting at _start_ and
+ * continuing for _length_ elements, or returns a subarray
+ * specified by _range_.
+ * Negative indices count backward from the end of the
+ * array (-1 is the last element). Returns nil if the index
+ * (or starting index) are out of range.
+ *
+ * a = [ "a", "b", "c", "d", "e" ]
+ * a[2] + a[0] + a[1] #=> "cab"
+ * a[6] #=> nil
+ * a[1, 2] #=> [ "b", "c" ]
+ * a[1..3] #=> [ "b", "c", "d" ]
+ * a[4..7] #=> [ "e" ]
+ * a[6..10] #=> nil
+ * a[-3, 3] #=> [ "c", "d", "e" ]
+ * # special cases
+ * a[5] #=> nil
+ * a[5, 1] #=> []
+ * a[5..10] #=> []
+ *
+ */
- if (!range_beg_end(range, &beg, &end)) return FALSE;
- b = beg; e = end;
+VALUE
+rb_ary_aref(argc, argv, ary)
+ int argc;
+ VALUE *argv;
+ VALUE ary;
+{
+ VALUE arg;
+ long beg, len;
- if (beg < 0) {
- beg = len + beg;
- if (beg < 0) beg = 0;
+ if (argc == 2) {
+ if (SYMBOL_P(argv[0])) {
+ rb_raise(rb_eTypeError, "Symbol as array index");
+ }
+ beg = NUM2LONG(argv[0]);
+ len = NUM2LONG(argv[1]);
+ if (beg < 0) {
+ beg += RARRAY(ary)->len;
+ }
+ return rb_ary_subseq(ary, beg, len);
+ }
+ if (argc != 1) {
+ rb_scan_args(argc, argv, "11", 0, 0);
}
- if (end < 0) {
- end = len + end;
- if (end < 0) end = -1;
+ arg = argv[0];
+ /* special case - speeding up */
+ if (FIXNUM_P(arg)) {
+ return rb_ary_entry(ary, FIX2LONG(arg));
}
- if (beg > end) {
- IndexError("end smaller than beg [%d..%d]", b, e);
+ if (SYMBOL_P(arg)) {
+ rb_raise(rb_eTypeError, "Symbol as array index");
}
+ /* check if idx is Range */
+ switch (rb_range_beg_len(arg, &beg, &len, RARRAY(ary)->len, 0)) {
+ case Qfalse:
+ break;
+ case Qnil:
+ return Qnil;
+ default:
+ return rb_ary_subseq(ary, beg, len);
+ }
+ return rb_ary_entry(ary, NUM2LONG(arg));
+}
+
+/*
+ * call-seq:
+ * array.at(index) -> obj or nil
+ *
+ * Returns the element at _index_. A
+ * negative index counts from the end of _self_. Returns +nil+
+ * if the index is out of range. See also <code>Array#[]</code>.
+ * (<code>Array#at</code> is slightly faster than <code>Array#[]</code>,
+ * as it does not accept ranges and so on.)
+ *
+ * a = [ "a", "b", "c", "d", "e" ]
+ * a.at(0) #=> "a"
+ * a.at(-1) #=> "e"
+ */
+
+static VALUE
+rb_ary_at(ary, pos)
+ VALUE ary, pos;
+{
+ return rb_ary_entry(ary, NUM2LONG(pos));
+}
+
+/*
+ * call-seq:
+ * array.first -> obj or nil
+ *
+ * Returns the first element of the array. If the array is empty,
+ * returns <code>nil</code>.
+ *
+ * a = [ "q", "r", "s", "t" ]
+ * a.first #=> "q"
+ */
- *begp = beg;
- if (beg > len) {
- *lenp = 0;
+static VALUE
+rb_ary_first(argc, argv, ary)
+ int argc;
+ VALUE *argv;
+ VALUE ary;
+{
+ if (argc == 0) {
+ if (RARRAY(ary)->len == 0) return Qnil;
+ return RARRAY(ary)->ptr[0];
}
else {
- *lenp = end - beg +1;
+ 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 TRUE;
}
-VALUE
-ary_aref(argc, argv, ary)
+/*
+ * call-seq:
+ * array.last -> obj or nil
+ * array.last(n) -> an_array
+ *
+ * Returns the last element(s) of <i>self</i>. If the array is empty,
+ * the first form returns <code>nil</code>.
+ *
+ * [ "w", "x", "y", "z" ].last #=> "z"
+ */
+
+static VALUE
+rb_ary_last(argc, argv, ary)
int argc;
VALUE *argv;
VALUE ary;
{
- VALUE arg1, arg2;
- int beg, len;
-
- if (rb_scan_args(argc, argv, "11", &arg1, &arg2) == 2) {
- beg = NUM2INT(arg1);
- len = NUM2INT(arg2);
- if (len <= 0) {
- return ary_new();
- }
- return ary_subseq(ary, beg, len);
+ if (argc == 0) {
+ if (RARRAY(ary)->len == 0) return Qnil;
+ 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;
+ }
+}
+
+/*
+ * call-seq:
+ * array.fetch(index) -> obj
+ * array.fetch(index, default ) -> obj
+ * array.fetch(index) {|index| block } -> obj
+ *
+ * Tries to return the element at position <i>index</i>. If the index
+ * lies outside the array, the first form throws an
+ * <code>IndexError</code> exception, the second form returns
+ * <i>default</i>, and the third form returns the value of invoking
+ * the block, passing in the index. Negative values of <i>index</i>
+ * count from the end of the array.
+ *
+ * a = [ 11, 22, 33, 44 ]
+ * a.fetch(1) #=> 22
+ * a.fetch(-1) #=> 44
+ * a.fetch(4, 'cat') #=> "cat"
+ * a.fetch(4) { |i| i*i } #=> 16
+ */
- /* special case - speeding up */
- if (FIXNUM_P(arg1)) {
- return ary_entry(ary, FIX2INT(arg1));
+static VALUE
+rb_ary_fetch(argc, argv, ary)
+ int argc;
+ VALUE *argv;
+ VALUE ary;
+{
+ VALUE pos, ifnone;
+ long block_given;
+ long idx;
+
+ rb_scan_args(argc, argv, "11", &pos, &ifnone);
+ block_given = rb_block_given_p();
+ if (block_given && argc == 2) {
+ rb_warn("block supersedes default value argument");
}
- else if (TYPE(arg1) == T_BIGNUM) {
- IndexError("index too big");
+ idx = NUM2LONG(pos);
+
+ if (idx < 0) {
+ idx += RARRAY(ary)->len;
}
- else if (beg_len(arg1, &beg, &len, RARRAY(ary)->len)) {
- /* check if idx is Range */
- return ary_subseq(ary, beg, len);
+ if (idx < 0 || RARRAY(ary)->len <= idx) {
+ if (block_given) return rb_yield(pos);
+ if (argc == 1) {
+ rb_raise(rb_eIndexError, "index %ld out of array", idx);
+ }
+ return ifnone;
}
- return ary_entry(ary, NUM2INT(arg1));
+ return RARRAY(ary)->ptr[idx];
}
+/*
+ * call-seq:
+ * array.index(obj) -> 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.
+ *
+ * a = [ "a", "b", "c" ]
+ * a.index("b") #=> 1
+ * a.index("z") #=> nil
+ */
+
static VALUE
-ary_index(ary, val)
+rb_ary_index(ary, val)
VALUE ary;
VALUE val;
{
- int i;
+ long i;
for (i=0; i<RARRAY(ary)->len; i++) {
if (rb_equal(RARRAY(ary)->ptr[i], val))
- return INT2FIX(i);
+ return LONG2NUM(i);
}
return Qnil;
}
+/*
+ * 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.
+ *
+ * a = [ "a", "b", "b", "b", "c" ]
+ * a.rindex("b") #=> 3
+ * a.rindex("z") #=> nil
+ */
+
static VALUE
-ary_rindex(ary, val)
+rb_ary_rindex(ary, val)
VALUE ary;
VALUE val;
{
- int i = RARRAY(ary)->len;
+ long i = RARRAY(ary)->len;
while (i--) {
+ if (i > RARRAY(ary)->len) {
+ i = RARRAY(ary)->len;
+ continue;
+ }
if (rb_equal(RARRAY(ary)->ptr[i], val))
- return INT2FIX(i);
+ return LONG2NUM(i);
}
return Qnil;
}
+/*
+ * call-seq:
+ * array.indexes( i1, i2, ... iN ) -> an_array
+ * array.indices( i1, i2, ... iN ) -> an_array
+ *
+ * Deprecated; use <code>Array#select</code>.
+ */
+
static VALUE
-ary_indexes(argc, argv, ary)
+rb_ary_indexes(argc, argv, ary)
int argc;
VALUE *argv;
VALUE ary;
{
VALUE new_ary;
- int i;
+ long i;
- new_ary = ary_new2(argc);
+ rb_warn("Array#%s is deprecated; use Array#values_at", rb_id2name(rb_frame_last_func()));
+ new_ary = rb_ary_new2(argc);
for (i=0; i<argc; i++) {
- ary_store(new_ary, i, ary_entry(ary, NUM2INT(argv[i])));
+ rb_ary_push(new_ary, rb_ary_aref(1, argv+i, ary));
}
return new_ary;
}
-static void
-ary_replace(ary, beg, len, rpl)
- VALUE ary, rpl;
- int beg, len;
+VALUE
+rb_ary_to_ary(obj)
+ VALUE obj;
{
- ary_modify(ary);
- if (TYPE(rpl) != T_ARRAY) {
- rpl = rb_Array(rpl);
+ if (TYPE(obj) == T_ARRAY) {
+ return obj;
+ }
+ if (rb_respond_to(obj, rb_intern("to_ary"))) {
+ return rb_convert_type(obj, T_ARRAY, "Array", "to_ary");
}
+ return rb_ary_new3(1, obj);
+}
+
+static void
+rb_ary_update(ary, beg, len, rpl)
+ VALUE ary;
+ long beg, len;
+ VALUE rpl;
+{
+ long rlen;
+
+ if (len < 0) rb_raise(rb_eIndexError, "negative length (%ld)", len);
if (beg < 0) {
- beg = RARRAY(ary)->len + beg;
- if (beg < 0) beg = 0;
+ beg += RARRAY(ary)->len;
+ if (beg < 0) {
+ beg -= RARRAY(ary)->len;
+ rb_raise(rb_eIndexError, "index %ld out of array", beg);
+ }
}
+ if (beg + len > RARRAY(ary)->len) {
+ len = RARRAY(ary)->len - beg;
+ }
+
+ rb_ary_modify(ary);
+ if (NIL_P(rpl)) {
+ rlen = 0;
+ }
+ else {
+ rpl = rb_ary_to_ary(rpl);
+ rlen = RARRAY(rpl)->len;
+ }
+
if (beg >= RARRAY(ary)->len) {
- len = beg + RARRAY(rpl)->len;
- if (len >= RARRAY(ary)->capa) {
- RARRAY(ary)->capa=len;
- REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->capa);
+ len = beg + rlen;
+ if (len >= RARRAY(ary)->aux.capa) {
+ REALLOC_N(RARRAY(ary)->ptr, VALUE, len);
+ RARRAY(ary)->aux.capa = len;
+ }
+ rb_mem_clear(RARRAY(ary)->ptr + RARRAY(ary)->len, beg - RARRAY(ary)->len);
+ if (rlen > 0) {
+ MEMCPY(RARRAY(ary)->ptr + beg, RARRAY(rpl)->ptr, VALUE, rlen);
}
- memclear(RARRAY(ary)->ptr+RARRAY(ary)->len, beg-RARRAY(ary)->len);
- MEMCPY(RARRAY(ary)->ptr+beg, RARRAY(rpl)->ptr, VALUE, RARRAY(rpl)->len);
RARRAY(ary)->len = len;
}
else {
- int alen;
+ long alen;
if (beg + len > RARRAY(ary)->len) {
len = RARRAY(ary)->len - beg;
}
- if (len < 0) {
- IndexError("negative length %d", RARRAY(ary)->len);
- }
- alen = RARRAY(ary)->len + RARRAY(rpl)->len - len;
- if (alen >= RARRAY(ary)->capa) {
- RARRAY(ary)->capa=alen;
- REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->capa);
+ alen = RARRAY(ary)->len + rlen - len;
+ if (alen >= RARRAY(ary)->aux.capa) {
+ REALLOC_N(RARRAY(ary)->ptr, VALUE, alen);
+ RARRAY(ary)->aux.capa = alen;
}
- if (len != RARRAY(rpl)->len) {
- MEMMOVE(RARRAY(ary)->ptr+beg+RARRAY(rpl)->len, RARRAY(ary)->ptr+beg+len,
- VALUE, RARRAY(ary)->len-(beg+len));
+ if (len != rlen) {
+ MEMMOVE(RARRAY(ary)->ptr + beg + rlen, RARRAY(ary)->ptr + beg + len,
+ VALUE, RARRAY(ary)->len - (beg + len));
RARRAY(ary)->len = alen;
}
- MEMCPY(RARRAY(ary)->ptr+beg, RARRAY(rpl)->ptr, VALUE, RARRAY(rpl)->len);
+ if (rlen > 0) {
+ MEMMOVE(RARRAY(ary)->ptr + beg, RARRAY(rpl)->ptr, VALUE, rlen);
+ }
}
}
+/*
+ * call-seq:
+ * array[index] = obj -> obj
+ * array[start, length] = obj or an_array or nil -> obj or an_array or nil
+ * array[range] = obj or an_array or nil -> obj or an_array or nil
+ *
+ * Element Assignment---Sets the element at _index_,
+ * or replaces a subarray starting at _start_ and
+ * continuing for _length_ elements, or replaces a subarray
+ * specified by _range_. If indices are greater than
+ * the current capacity of the array, the array grows
+ * automatically. A negative indices will count backward
+ * from the end of the array. Inserts elements if _length_ is
+ * zero. If +nil+ is used in the second and third form,
+ * deletes elements from _self_. An +IndexError+ is raised if a
+ * negative index points past the beginning of the array. See also
+ * <code>Array#push</code>, and <code>Array#unshift</code>.
+ *
+ * a = Array.new
+ * a[4] = "4"; #=> [nil, nil, nil, nil, "4"]
+ * a[0, 3] = [ 'a', 'b', 'c' ] #=> ["a", "b", "c", nil, "4"]
+ * a[1..2] = [ 1, 2 ] #=> ["a", 1, 2, nil, "4"]
+ * a[0, 2] = "?" #=> ["?", 2, nil, "4"]
+ * a[0..2] = "A" #=> ["A", "4"]
+ * a[-1] = "Z" #=> ["A", "Z"]
+ * a[1..-1] = nil #=> ["A"]
+ */
+
static VALUE
-ary_aset(argc, argv, ary)
+rb_ary_aset(argc, argv, ary)
int argc;
VALUE *argv;
VALUE ary;
{
- VALUE arg1, arg2, arg3;
- int offset;
- int beg, len;
+ long offset, beg, len;
- if (rb_scan_args(argc, argv, "21", &arg1, &arg2, &arg3) == 3) {
- beg = NUM2INT(arg1);
- len = NUM2INT(arg2);
- ary_replace(ary, beg, len, arg3);
- return arg3;
+ if (argc == 3) {
+ if (SYMBOL_P(argv[0])) {
+ rb_raise(rb_eTypeError, "Symbol as array index");
+ }
+ if (SYMBOL_P(argv[1])) {
+ rb_raise(rb_eTypeError, "Symbol as subarray length");
+ }
+ rb_ary_update(ary, NUM2LONG(argv[0]), NUM2LONG(argv[1]), argv[2]);
+ return argv[2];
}
- else if (FIXNUM_P(arg1)) {
- offset = FIX2INT(arg1);
+ if (argc != 2) {
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)", argc);
+ }
+ if (FIXNUM_P(argv[0])) {
+ offset = FIX2LONG(argv[0]);
goto fixnum;
}
- else if (beg_len(arg1, &beg, &len, RARRAY(ary)->len)) {
- /* check if idx is Range */
- ary_replace(ary, beg, len, arg2);
- return arg2;
+ if (SYMBOL_P(argv[0])) {
+ rb_raise(rb_eTypeError, "Symbol as array index");
}
- if (TYPE(arg1) == T_BIGNUM) {
- IndexError("index too big");
+ if (rb_range_beg_len(argv[0], &beg, &len, RARRAY(ary)->len, 1)) {
+ /* check if idx is Range */
+ rb_ary_update(ary, beg, len, argv[1]);
+ return argv[1];
}
- offset = NUM2INT(arg1);
- fixnum:
- if (offset < 0) {
- offset = RARRAY(ary)->len + offset;
+ offset = NUM2LONG(argv[0]);
+fixnum:
+ rb_ary_store(ary, offset, argv[1]);
+ return argv[1];
+}
+
+/*
+ * call-seq:
+ * array.insert(index, obj...) -> array
+ *
+ * Inserts the given values before the element with the given index
+ * (which may be negative).
+ *
+ * a = %w{ a b c d }
+ * a.insert(2, 99) #=> ["a", "b", 99, "c", "d"]
+ * a.insert(-2, 1, 2, 3) #=> ["a", "b", 99, "c", 1, 2, 3, "d"]
+ */
+
+static VALUE
+rb_ary_insert(argc, argv, ary)
+ int argc;
+ VALUE *argv;
+ VALUE ary;
+{
+ long pos;
+
+ if (argc < 1) {
+ rb_raise(rb_eArgError, "wrong number of arguments (at least 1)");
+ }
+ pos = NUM2LONG(argv[0]);
+ if (pos == -1) {
+ pos = RARRAY(ary)->len;
}
- ary_store(ary, offset, arg2);
- return arg2;
+ else if (pos < 0) {
+ pos++;
+ }
+
+ if (argc == 1) return ary;
+ rb_ary_update(ary, pos, 0, rb_ary_new4(argc - 1, argv + 1));
+ return ary;
}
+/*
+ * call-seq:
+ * array.each {|item| block } -> array
+ *
+ * Calls <i>block</i> once for each element in <i>self</i>, passing that
+ * element as a parameter.
+ *
+ * a = [ "a", "b", "c" ]
+ * a.each {|x| print x, " -- " }
+ *
+ * produces:
+ *
+ * a -- b -- c --
+ */
+
VALUE
-ary_each(ary)
+rb_ary_each(ary)
VALUE ary;
{
- int i;
+ long i;
for (i=0; i<RARRAY(ary)->len; i++) {
rb_yield(RARRAY(ary)->ptr[i]);
}
- return Qnil;
+ return ary;
}
+/*
+ * call-seq:
+ * array.each_index {|index| block } -> array
+ *
+ * Same as <code>Array#each</code>, but passes the index of the element
+ * instead of the element itself.
+ *
+ * a = [ "a", "b", "c" ]
+ * a.each_index {|x| print x, " -- " }
+ *
+ * produces:
+ *
+ * 0 -- 1 -- 2 --
+ */
+
static VALUE
-ary_each_index(ary)
+rb_ary_each_index(ary)
VALUE ary;
{
- int i;
+ long i;
for (i=0; i<RARRAY(ary)->len; i++) {
- rb_yield(INT2FIX(i));
+ rb_yield(LONG2NUM(i));
}
- return Qnil;
+ return ary;
}
+/*
+ * call-seq:
+ * array.reverse_each {|item| block }
+ *
+ * Same as <code>Array#each</code>, but traverses <i>self</i> in reverse
+ * order.
+ *
+ * a = [ "a", "b", "c" ]
+ * a.reverse_each {|x| print x, " " }
+ *
+ * produces:
+ *
+ * c b a
+ */
+
static VALUE
-ary_reverse_each(ary)
+rb_ary_reverse_each(ary)
VALUE ary;
{
- int len = RARRAY(ary)->len;
+ long len = RARRAY(ary)->len;
while (len--) {
rb_yield(RARRAY(ary)->ptr[len]);
+ if (RARRAY(ary)->len < len) {
+ len = RARRAY(ary)->len;
+ }
}
- return Qnil;
+ return ary;
}
+/*
+ * call-seq:
+ * array.length -> int
+ *
+ * Returns the number of elements in <i>self</i>. May be zero.
+ *
+ * [ 1, 2, 3, 4, 5 ].length #=> 5
+ */
+
static VALUE
-ary_length(ary)
+rb_ary_length(ary)
VALUE ary;
{
- return INT2FIX(RARRAY(ary)->len);
+ return LONG2NUM(RARRAY(ary)->len);
}
+/*
+ * call-seq:
+ * array.empty? -> true or false
+ *
+ * Returns <code>true</code> if <i>self</i> array contains no elements.
+ *
+ * [].empty? #=> true
+ */
+
static VALUE
-ary_empty_p(ary)
+rb_ary_empty_p(ary)
VALUE ary;
{
if (RARRAY(ary)->len == 0)
- return TRUE;
- return FALSE;
+ return Qtrue;
+ return Qfalse;
}
-static VALUE
-ary_clone(ary)
+VALUE
+rb_ary_dup(ary)
VALUE ary;
{
- VALUE ary2 = ary_new2(RARRAY(ary)->len);
+ VALUE dup = rb_ary_new2(RARRAY(ary)->len);
- CLONESETUP(ary2, ary);
- MEMCPY(RARRAY(ary2)->ptr, RARRAY(ary)->ptr, VALUE, RARRAY(ary)->len);
- RARRAY(ary2)->len = RARRAY(ary)->len;
- return ary2;
+ DUPSETUP(dup, ary);
+ MEMCPY(RARRAY(dup)->ptr, RARRAY(ary)->ptr, VALUE, RARRAY(ary)->len);
+ RARRAY(dup)->len = RARRAY(ary)->len;
+ return dup;
}
-static VALUE
-ary_dup(ary)
- VALUE ary;
-{
- return ary_new4(RARRAY(ary)->len, RARRAY(ary)->ptr);
-}
+extern VALUE rb_output_fs;
static VALUE
-to_ary(ary)
+inspect_join(ary, arg)
VALUE ary;
+ VALUE *arg;
{
- return rb_convert_type(ary, T_ARRAY, "Array", "to_ary");
+ return rb_ary_join(arg[0], arg[1]);
}
-extern VALUE OFS;
-
VALUE
-ary_join(ary, sep)
- VALUE ary;
- VALUE sep;
+rb_ary_join(ary, sep)
+ VALUE ary, sep;
{
- int i;
+ long len = 1, i;
+ int taint = Qfalse;
VALUE result, tmp;
- if (RARRAY(ary)->len == 0) return str_new(0, 0);
- switch (TYPE(RARRAY(ary)->ptr[0])) {
- case T_STRING:
- result = str_dup(RARRAY(ary)->ptr[0]);
- break;
- case T_ARRAY:
- result = ary_join(RARRAY(ary)->ptr[0], sep);
- break;
- default:
- result = obj_as_string(RARRAY(ary)->ptr[0]);
- break;
- }
+ if (RARRAY(ary)->len == 0) return rb_str_new(0, 0);
+ if (OBJ_TAINTED(ary) || OBJ_TAINTED(sep)) taint = Qtrue;
- for (i=1; i<RARRAY(ary)->len; i++) {
+ for (i=0; i<RARRAY(ary)->len; i++) {
+ tmp = rb_check_string_type(RARRAY(ary)->ptr[i]);
+ len += NIL_P(tmp) ? 10 : RSTRING(tmp)->len;
+ }
+ if (!NIL_P(sep)) {
+ StringValue(sep);
+ len += RSTRING(sep)->len * (RARRAY(ary)->len - 1);
+ }
+ result = rb_str_buf_new(len);
+ for (i=0; i<RARRAY(ary)->len; i++) {
tmp = RARRAY(ary)->ptr[i];
switch (TYPE(tmp)) {
case T_STRING:
break;
case T_ARRAY:
- tmp = ary_join(tmp, sep);
+ if (rb_inspecting_p(tmp)) {
+ tmp = rb_str_new2("[...]");
+ }
+ else {
+ VALUE args[2];
+
+ args[0] = tmp;
+ args[1] = sep;
+ tmp = rb_protect_inspect(inspect_join, ary, (VALUE)args);
+ }
break;
default:
- tmp = obj_as_string(tmp);
+ tmp = rb_obj_as_string(tmp);
}
- if (!NIL_P(sep)) str_concat(result, sep);
- str_cat(result, RSTRING(tmp)->ptr, RSTRING(tmp)->len);
- if (str_tainted(tmp)) str_taint(result);
+ if (i > 0 && !NIL_P(sep))
+ rb_str_buf_append(result, sep);
+ rb_str_buf_append(result, tmp);
+ if (OBJ_TAINTED(tmp)) taint = Qtrue;
}
+ if (taint) OBJ_TAINT(result);
return result;
}
+/*
+ * call-seq:
+ * array.join(sep=$,) -> str
+ *
+ * Returns a string created by converting each element of the array to
+ * a string, separated by <i>sep</i>.
+ *
+ * [ "a", "b", "c" ].join #=> "abc"
+ * [ "a", "b", "c" ].join("-") #=> "a-b-c"
+ */
+
static VALUE
-ary_join_method(argc, argv, ary)
+rb_ary_join_m(argc, argv, ary)
int argc;
VALUE *argv;
VALUE ary;
@@ -689,561 +1316,1502 @@ ary_join_method(argc, argv, ary)
VALUE sep;
rb_scan_args(argc, argv, "01", &sep);
- if (NIL_P(sep)) sep = OFS;
-
- return ary_join(ary, sep);
+ if (NIL_P(sep)) sep = rb_output_fs;
+
+ return rb_ary_join(ary, sep);
}
+/*
+ * call-seq:
+ * array.to_s -> string
+ *
+ * Returns _self_<code>.join</code>.
+ *
+ * [ "a", "e", "i", "o" ].to_s #=> "aeio"
+ *
+ */
+
VALUE
-ary_to_s(ary)
+rb_ary_to_s(ary)
VALUE ary;
{
- VALUE str = ary_join(ary, OFS);
- if (NIL_P(str)) return str_new(0, 0);
- return str;
+ if (RARRAY(ary)->len == 0) return rb_str_new(0, 0);
+
+ return rb_ary_join(ary, rb_output_fs);
+}
+
+static ID inspect_key;
+
+struct inspect_arg {
+ VALUE (*func)();
+ VALUE arg1, arg2;
+};
+
+static VALUE
+inspect_call(arg)
+ struct inspect_arg *arg;
+{
+ return (*arg->func)(arg->arg1, arg->arg2);
}
static VALUE
-ary_inspect(ary)
+get_inspect_tbl(create)
+ int create;
+{
+ VALUE inspect_tbl = rb_thread_local_aref(rb_thread_current(), inspect_key);
+
+ if (NIL_P(inspect_tbl)) {
+ if (create) {
+ tbl_init:
+ inspect_tbl = rb_ary_new();
+ rb_thread_local_aset(rb_thread_current(), inspect_key, inspect_tbl);
+ }
+ }
+ else if (TYPE(inspect_tbl) != T_ARRAY) {
+ rb_warn("invalid inspect_tbl value");
+ if (create) goto tbl_init;
+ rb_thread_local_aset(rb_thread_current(), inspect_key, Qnil);
+ return Qnil;
+ }
+ return inspect_tbl;
+}
+
+static VALUE
+inspect_ensure(obj)
+ VALUE obj;
+{
+ VALUE inspect_tbl;
+
+ inspect_tbl = get_inspect_tbl(Qfalse);
+ if (!NIL_P(inspect_tbl)) {
+ rb_ary_pop(inspect_tbl);
+ }
+ return 0;
+}
+
+VALUE
+rb_protect_inspect(func, obj, arg)
+ VALUE (*func)(ANYARGS);
+ VALUE obj, arg;
+{
+ struct inspect_arg iarg;
+ VALUE inspect_tbl;
+ VALUE id;
+
+ inspect_tbl = get_inspect_tbl(Qtrue);
+ id = rb_obj_id(obj);
+ if (rb_ary_includes(inspect_tbl, id)) {
+ return (*func)(obj, arg);
+ }
+ rb_ary_push(inspect_tbl, id);
+ iarg.func = func;
+ iarg.arg1 = obj;
+ iarg.arg2 = arg;
+
+ return rb_ensure(inspect_call, (VALUE)&iarg, inspect_ensure, obj);
+}
+
+VALUE
+rb_inspecting_p(obj)
+ VALUE obj;
+{
+ VALUE inspect_tbl;
+
+ inspect_tbl = get_inspect_tbl(Qfalse);
+ if (NIL_P(inspect_tbl)) return Qfalse;
+ return rb_ary_includes(inspect_tbl, rb_obj_id(obj));
+}
+
+static VALUE
+inspect_ary(ary)
VALUE ary;
{
- int i, len;
+ int tainted = OBJ_TAINTED(ary);
+ long i;
VALUE s, str;
- if (RARRAY(ary)->len == 0) return str_new2("[]");
- str = str_new2("[");
- len = 1;
-
+ str = rb_str_buf_new2("[");
for (i=0; i<RARRAY(ary)->len; i++) {
s = rb_inspect(RARRAY(ary)->ptr[i]);
- if (i > 0) str_cat(str, ", ", 2);
- str_cat(str, RSTRING(s)->ptr, RSTRING(s)->len);
- len += RSTRING(s)->len + 2;
+ if (OBJ_TAINTED(s)) tainted = Qtrue;
+ if (i > 0) rb_str_buf_cat2(str, ", ");
+ rb_str_buf_append(str, s);
}
- str_cat(str, "]", 1);
-
+ rb_str_buf_cat2(str, "]");
+ if (tainted) OBJ_TAINT(str);
return str;
}
+/*
+ * call-seq:
+ * array.inspect -> string
+ *
+ * Create a printable version of <i>array</i>.
+ */
+
+static VALUE
+rb_ary_inspect(ary)
+ VALUE ary;
+{
+ if (RARRAY(ary)->len == 0) return rb_str_new2("[]");
+ if (rb_inspecting_p(ary)) return rb_str_new2("[...]");
+ return rb_protect_inspect(inspect_ary, ary, 0);
+}
+
+/*
+ * call-seq:
+ * array.to_a -> array
+ *
+ * Returns _self_. If called on a subclass of Array, converts
+ * the receiver to an Array object.
+ */
+
static VALUE
-ary_to_a(ary)
+rb_ary_to_a(ary)
+ VALUE ary;
+{
+ if (rb_obj_class(ary) != rb_cArray) {
+ VALUE dup = rb_ary_new2(RARRAY(ary)->len);
+ rb_ary_replace(dup, ary);
+ return dup;
+ }
+ return ary;
+}
+
+/*
+ * call-seq:
+ * array.to_ary -> array
+ *
+ * Returns _self_.
+ */
+
+static VALUE
+rb_ary_to_ary_m(ary)
VALUE ary;
{
return ary;
}
VALUE
-ary_reverse(ary)
+rb_ary_reverse(ary)
VALUE ary;
{
VALUE *p1, *p2;
VALUE tmp;
- if (RARRAY(ary)->len == 0) return ary;
-
- p1 = RARRAY(ary)->ptr;
- p2 = p1 + RARRAY(ary)->len - 1; /* points last item */
+ rb_ary_modify(ary);
+ if (RARRAY(ary)->len > 1) {
+ p1 = RARRAY(ary)->ptr;
+ p2 = p1 + RARRAY(ary)->len - 1; /* points last item */
- while (p1 < p2) {
- tmp = *p1;
- *p1 = *p2;
- *p2 = tmp;
- p1++; p2--;
+ while (p1 < p2) {
+ tmp = *p1;
+ *p1++ = *p2;
+ *p2-- = tmp;
+ }
}
-
return ary;
}
+/*
+ * call-seq:
+ * array.reverse! -> array
+ *
+ * Reverses _self_ in place.
+ *
+ * a = [ "a", "b", "c" ]
+ * a.reverse! #=> ["c", "b", "a"]
+ * a #=> ["c", "b", "a"]
+ */
+
+static VALUE
+rb_ary_reverse_bang(ary)
+ VALUE ary;
+{
+ return rb_ary_reverse(ary);
+}
+
+/*
+ * call-seq:
+ * array.reverse -> an_array
+ *
+ * Returns a new array containing <i>self</i>'s elements in reverse order.
+ *
+ * [ "a", "b", "c" ].reverse #=> ["c", "b", "a"]
+ * [ 1 ].reverse #=> [1]
+ */
+
static VALUE
-ary_reverse_method(ary)
+rb_ary_reverse_m(ary)
VALUE ary;
{
- return ary_reverse(ary_dup(ary));
+ return rb_ary_reverse(rb_ary_dup(ary));
}
-static ID cmp;
+struct ary_sort_data {
+ VALUE ary;
+ VALUE *ptr;
+ long len;
+};
+
+static void
+ary_sort_check(data)
+ struct ary_sort_data *data;
+{
+ if (RARRAY(data->ary)->ptr != data->ptr || RARRAY(data->ary)->len != data->len) {
+ rb_raise(rb_eArgError, "array modified during sort");
+ }
+}
static int
-sort_1(a, b)
+sort_1(a, b, data)
VALUE *a, *b;
+ struct ary_sort_data *data;
{
- VALUE retval = rb_yield(assoc_new(*a, *b));
- return NUM2INT(retval);
+ VALUE retval = rb_yield_values(2, *a, *b);
+ int n;
+
+ n = rb_cmpint(retval, *a, *b);
+ ary_sort_check(data);
+ return n;
}
static int
-sort_2(a, b)
- VALUE *a, *b;
+sort_2(ap, bp, data)
+ VALUE *ap, *bp;
+ struct ary_sort_data *data;
{
VALUE retval;
+ VALUE a = *ap, b = *bp;
+ int n;
- if (FIXNUM_P(*a)) {
- if (FIXNUM_P(*b)) return *a - *b;
+ if (FIXNUM_P(a) && FIXNUM_P(b)) {
+ if ((long)a > (long)b) return 1;
+ if ((long)a < (long)b) return -1;
+ return 0;
}
- else if (TYPE(*a) == T_STRING) {
- if (TYPE(*b) == T_STRING) return str_cmp(*a, *b);
+ if (TYPE(a) == T_STRING && TYPE(b) == T_STRING) {
+ return rb_str_cmp(a, b);
}
- retval = rb_funcall(*a, cmp, 1, *b);
- return NUM2INT(retval);
+ retval = rb_funcall(a, id_cmp, 1, b);
+ n = rb_cmpint(retval, a, b);
+ ary_sort_check(data);
+
+ return n;
}
-VALUE
-ary_sort_bang(ary)
+static VALUE
+sort_internal(ary)
VALUE ary;
{
- if (RARRAY(ary)->len == 0) return ary;
+ struct ary_sort_data data;
- ary_modify(ary);
+ data.ary = ary;
+ data.ptr = RARRAY(ary)->ptr; data.len = RARRAY(ary)->len;
qsort(RARRAY(ary)->ptr, RARRAY(ary)->len, sizeof(VALUE),
- iterator_p()?sort_1:sort_2);
+ rb_block_given_p()?sort_1:sort_2, &data);
+ return ary;
+}
+
+static VALUE
+sort_unlock(ary)
+ VALUE ary;
+{
+ FL_UNSET(ary, ARY_TMPLOCK);
+ return ary;
+}
+
+/*
+ * call-seq:
+ * array.sort! -> array
+ * array.sort! {| a,b | block } -> array
+ *
+ * Sorts _self_. Comparisons for
+ * the sort will be done using the <code><=></code> operator or using
+ * an optional code block. The block implements a comparison between
+ * <i>a</i> and <i>b</i>, returning -1, 0, or +1. See also
+ * <code>Enumerable#sort_by</code>.
+ *
+ * a = [ "d", "a", "e", "c", "b" ]
+ * a.sort #=> ["a", "b", "c", "d", "e"]
+ * a.sort {|x,y| y <=> x } #=> ["e", "d", "c", "b", "a"]
+ */
+
+VALUE
+rb_ary_sort_bang(ary)
+ VALUE ary;
+{
+ rb_ary_modify(ary);
+ if (RARRAY(ary)->len > 1) {
+ FL_SET(ary, ARY_TMPLOCK); /* prohibit modification during sort */
+ rb_ensure(sort_internal, ary, sort_unlock, ary);
+ }
+ return ary;
+}
+
+/*
+ * call-seq:
+ * array.sort -> an_array
+ * array.sort {| a,b | block } -> an_array
+ *
+ * Returns a new array created by sorting <i>self</i>. Comparisons for
+ * the sort will be done using the <code><=></code> operator or using
+ * an optional code block. The block implements a comparison between
+ * <i>a</i> and <i>b</i>, returning -1, 0, or +1. See also
+ * <code>Enumerable#sort_by</code>.
+ *
+ * a = [ "d", "a", "e", "c", "b" ]
+ * a.sort #=> ["a", "b", "c", "d", "e"]
+ * a.sort {|x,y| y <=> x } #=> ["e", "d", "c", "b", "a"]
+ */
+
+VALUE
+rb_ary_sort(ary)
+ VALUE ary;
+{
+ ary = rb_ary_dup(ary);
+ rb_ary_sort_bang(ary);
+ return ary;
+}
+
+/*
+ * call-seq:
+ * array.collect {|item| block } -> an_array
+ * array.map {|item| block } -> an_array
+ *
+ * Invokes <i>block</i> once for each element of <i>self</i>. Creates a
+ * new array containing the values returned by the block.
+ * See also <code>Enumerable#collect</code>.
+ *
+ * a = [ "a", "b", "c", "d" ]
+ * a.collect {|x| x + "!" } #=> ["a!", "b!", "c!", "d!"]
+ * a #=> ["a", "b", "c", "d"]
+ */
+
+static VALUE
+rb_ary_collect(ary)
+ VALUE ary;
+{
+ long i;
+ VALUE collect;
+
+ if (!rb_block_given_p()) {
+ return rb_ary_new4(RARRAY(ary)->len, RARRAY(ary)->ptr);
+ }
+
+ collect = rb_ary_new2(RARRAY(ary)->len);
+ for (i = 0; i < RARRAY(ary)->len; i++) {
+ rb_ary_push(collect, rb_yield(RARRAY(ary)->ptr[i]));
+ }
+ return collect;
+}
+
+/*
+ * call-seq:
+ * array.collect! {|item| block } -> array
+ * array.map! {|item| block } -> array
+ *
+ * Invokes the block once for each element of _self_, replacing the
+ * element with the value returned by _block_.
+ * See also <code>Enumerable#collect</code>.
+ *
+ * a = [ "a", "b", "c", "d" ]
+ * a.collect! {|x| x + "!" }
+ * a #=> [ "a!", "b!", "c!", "d!" ]
+ */
+
+static VALUE
+rb_ary_collect_bang(ary)
+ VALUE ary;
+{
+ long i;
+
+ rb_ary_modify(ary);
+ for (i = 0; i < RARRAY(ary)->len; i++) {
+ rb_ary_store(ary, i, rb_yield(RARRAY(ary)->ptr[i]));
+ }
return ary;
}
VALUE
-ary_sort(ary)
+rb_values_at(obj, olen, argc, argv, func)
+ VALUE obj;
+ long olen;
+ int argc;
+ VALUE *argv;
+ VALUE (*func) _((VALUE,long));
+{
+ VALUE result = rb_ary_new2(argc);
+ long beg, len, i, j;
+
+ for (i=0; i<argc; i++) {
+ if (FIXNUM_P(argv[i])) {
+ rb_ary_push(result, (*func)(obj, FIX2LONG(argv[i])));
+ continue;
+ }
+ /* check if idx is Range */
+ switch (rb_range_beg_len(argv[i], &beg, &len, olen, 0)) {
+ case Qfalse:
+ break;
+ case Qnil:
+ continue;
+ default:
+ for (j=0; j<len; j++) {
+ rb_ary_push(result, (*func)(obj, j+beg));
+ }
+ continue;
+ }
+ rb_ary_push(result, (*func)(obj, NUM2LONG(argv[i])));
+ }
+ return result;
+}
+
+/*
+ * call-seq:
+ * array.values_at(selector,... ) -> an_array
+ *
+ * Returns an array containing the elements in
+ * _self_ corresponding to the given selector(s). The selectors
+ * may be either integer indices or ranges.
+ * See also <code>Array#select</code>.
+ *
+ * a = %w{ a b c d e f }
+ * a.values_at(1, 3, 5)
+ * a.values_at(1, 3, 5, 7)
+ * a.values_at(-1, -3, -5, -7)
+ * a.values_at(1..3, 2...5)
+ */
+
+static VALUE
+rb_ary_values_at(argc, argv, ary)
+ int argc;
+ VALUE *argv;
VALUE ary;
{
- if (RARRAY(ary)->len == 0) return ary;
- return ary_sort_bang(ary_dup(ary));
+ return rb_values_at(ary, RARRAY(ary)->len, argc, argv, rb_ary_entry);
}
+/*
+ * call-seq:
+ * array.select {|item| block } -> an_array
+ *
+ * Invokes the block passing in successive elements from <i>array</i>,
+ * returning an array containing those elements for which the block
+ * returns a true value (equivalent to <code>Enumerable#select</code>).
+ *
+ * a = %w{ a b c d e f }
+ * a.select {|v| v =~ /[aeiou]/} #=> ["a", "e"]
+ */
+
+static VALUE
+rb_ary_select(argc, argv, ary)
+ int argc;
+ VALUE *argv;
+ VALUE ary;
+{
+ VALUE result;
+ long i;
+
+ if (argc > 0) {
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
+ }
+ result = rb_ary_new2(RARRAY(ary)->len);
+ for (i = 0; i < RARRAY(ary)->len; i++) {
+ if (RTEST(rb_yield(RARRAY(ary)->ptr[i]))) {
+ rb_ary_push(result, rb_ary_elt(ary, i));
+ }
+ }
+ return result;
+}
+
+/*
+ * call-seq:
+ * array.delete(obj) -> obj or nil
+ * array.delete(obj) { block } -> obj or nil
+ *
+ * Deletes items from <i>self</i> that are equal to <i>obj</i>. If
+ * the item is not found, returns <code>nil</code>. If the optional
+ * code block is given, returns the result of <i>block</i> if the item
+ * is not found.
+ *
+ * a = [ "a", "b", "b", "b", "c" ]
+ * a.delete("b") #=> "b"
+ * a #=> ["a", "c"]
+ * a.delete("z") #=> nil
+ * a.delete("z") { "not found" } #=> "not found"
+ */
+
VALUE
-ary_delete(ary, item)
+rb_ary_delete(ary, item)
VALUE ary;
VALUE item;
{
- int i1, i2;
+ long i1, i2;
- ary_modify(ary);
+ rb_ary_modify(ary);
for (i1 = i2 = 0; i1 < RARRAY(ary)->len; i1++) {
- if (rb_equal(RARRAY(ary)->ptr[i1], item)) continue;
+ VALUE e = RARRAY(ary)->ptr[i1];
+
+ if (rb_equal(e, item)) continue;
if (i1 != i2) {
- RARRAY(ary)->ptr[i2] = RARRAY(ary)->ptr[i1];
+ rb_ary_store(ary, i2, e);
}
i2++;
}
if (RARRAY(ary)->len == i2) {
- if (iterator_p()) {
+ if (rb_block_given_p()) {
return rb_yield(item);
}
return Qnil;
}
- else {
+
+ if (RARRAY(ary)->len > i2) {
RARRAY(ary)->len = i2;
+ if (i2 * 2 < RARRAY(ary)->aux.capa &&
+ RARRAY(ary)->aux.capa > ARY_DEFAULT_SIZE) {
+ REALLOC_N(RARRAY(ary)->ptr, VALUE, i2 * 2);
+ RARRAY(ary)->aux.capa = i2 * 2;
+ }
}
return item;
}
VALUE
-ary_delete_at(ary, at)
+rb_ary_delete_at(ary, pos)
VALUE ary;
- VALUE at;
+ long pos;
{
- int i1, i2, pos;
- VALUE del = Qnil;
+ long i, len = RARRAY(ary)->len;
+ VALUE del;
- ary_modify(ary);
- pos = NUM2INT(at);
- for (i1 = i2 = 0; i1 < RARRAY(ary)->len; i1++) {
- if (i1 == pos) {
- del = RARRAY(ary)->ptr[i1];
- continue;
- }
- if (i1 != i2) {
- RARRAY(ary)->ptr[i2] = RARRAY(ary)->ptr[i1];
- }
- i2++;
+ rb_ary_modify(ary);
+ if (pos >= len) return Qnil;
+ if (pos < 0) {
+ pos += len;
+ if (pos < 0) return Qnil;
}
- RARRAY(ary)->len = i2;
+
+ del = RARRAY(ary)->ptr[pos];
+ for (i = pos + 1; i < len; i++, pos++) {
+ RARRAY(ary)->ptr[pos] = RARRAY(ary)->ptr[i];
+ }
+ RARRAY(ary)->len = pos;
return del;
}
+/*
+ * call-seq:
+ * array.delete_at(index) -> obj or nil
+ *
+ * Deletes the element at the specified index, returning that element,
+ * or <code>nil</code> if the index is out of range. See also
+ * <code>Array#slice!</code>.
+ *
+ * a = %w( ant bat cat dog )
+ * a.delete_at(2) #=> "cat"
+ * a #=> ["ant", "bat", "dog"]
+ * a.delete_at(99) #=> nil
+ */
+
+static VALUE
+rb_ary_delete_at_m(ary, pos)
+ VALUE ary, pos;
+{
+ return rb_ary_delete_at(ary, NUM2LONG(pos));
+}
+
+/*
+ * call-seq:
+ * array.slice!(index) -> obj or nil
+ * array.slice!(start, length) -> sub_array or nil
+ * array.slice!(range) -> sub_array or nil
+ *
+ * Deletes the element(s) given by an index (optionally with a length)
+ * or by a range. Returns the deleted object, subarray, or
+ * <code>nil</code> if the index is out of range. Equivalent to:
+ *
+ * def slice!(*args)
+ * result = self[*args]
+ * self[*args] = nil
+ * result
+ * end
+ *
+ * a = [ "a", "b", "c" ]
+ * a.slice!(1) #=> "b"
+ * a #=> ["a", "c"]
+ * a.slice!(-1) #=> "c"
+ * a #=> ["a"]
+ * a.slice!(100) #=> nil
+ * a #=> ["a"]
+ */
+
static VALUE
-ary_delete_if(ary)
+rb_ary_slice_bang(argc, argv, ary)
+ int argc;
+ VALUE *argv;
+ VALUE ary;
+{
+ VALUE arg1, arg2;
+ long pos, len;
+
+ rb_ary_modify(ary);
+ if (rb_scan_args(argc, argv, "11", &arg1, &arg2) == 2) {
+ pos = NUM2LONG(arg1);
+ len = NUM2LONG(arg2);
+ delete_pos_len:
+ if (pos < 0) {
+ pos = RARRAY(ary)->len + pos;
+ }
+ arg2 = rb_ary_subseq(ary, pos, len);
+ rb_ary_update(ary, pos, len, Qnil); /* Qnil/rb_ary_new2(0) */
+ return arg2;
+ }
+
+ if (!FIXNUM_P(arg1) && rb_range_beg_len(arg1, &pos, &len, RARRAY(ary)->len, 1)) {
+ goto delete_pos_len;
+ }
+
+ return rb_ary_delete_at(ary, NUM2LONG(arg1));
+}
+
+/*
+ * call-seq:
+ * array.reject! {|item| block } -> array or nil
+ *
+ * Equivalent to <code>Array#delete_if</code>, deleting elements from
+ * _self_ for which the block evaluates to true, but returns
+ * <code>nil</code> if no changes were made. Also see
+ * <code>Enumerable#reject</code>.
+ */
+
+static VALUE
+rb_ary_reject_bang(ary)
VALUE ary;
{
- int i1, i2;
+ long i1, i2;
- ary_modify(ary);
+ rb_ary_modify(ary);
for (i1 = i2 = 0; i1 < RARRAY(ary)->len; i1++) {
- if (rb_yield(RARRAY(ary)->ptr[i1])) continue;
+ VALUE v = RARRAY(ary)->ptr[i1];
+ if (RTEST(rb_yield(v))) continue;
if (i1 != i2) {
- RARRAY(ary)->ptr[i2] = RARRAY(ary)->ptr[i1];
+ rb_ary_store(ary, i2, v);
}
i2++;
}
- RARRAY(ary)->len = i2;
+ if (RARRAY(ary)->len == i2) return Qnil;
+ if (i2 < RARRAY(ary)->len)
+ RARRAY(ary)->len = i2;
return ary;
}
+/*
+ * call-seq:
+ * array.reject {|item| block } -> an_array
+ *
+ * Returns a new array containing the items in _self_
+ * for which the block is not true.
+ */
+
static VALUE
-ary_filter(ary)
+rb_ary_reject(ary)
VALUE ary;
{
- int i;
-
- ary_modify(ary);
- for (i = 0; i < RARRAY(ary)->len; i++) {
- RARRAY(ary)->ptr[i] = rb_yield(RARRAY(ary)->ptr[i]);
- }
+ ary = rb_ary_dup(ary);
+ rb_ary_reject_bang(ary);
return ary;
}
+/*
+ * call-seq:
+ * array.delete_if {|item| block } -> array
+ *
+ * Deletes every element of <i>self</i> for which <i>block</i> evaluates
+ * to <code>true</code>.
+ *
+ * a = [ "a", "b", "c" ]
+ * a.delete_if {|x| x >= "b" } #=> ["a"]
+ */
+
static VALUE
-ary_replace_method(ary, ary2)
- VALUE ary, ary2;
+rb_ary_delete_if(ary)
+ VALUE ary;
{
- ary2 = to_ary(ary2);
- ary_replace(ary, 0, RARRAY(ary2)->len, ary2);
+ rb_ary_reject_bang(ary);
return ary;
}
+/*
+ * call-seq:
+ * array.zip(arg, ...) -> an_array
+ * array.zip(arg, ...) {| arr | block } -> nil
+ *
+ * Converts any arguments to arrays, then merges elements of
+ * <i>self</i> with corresponding elements from each argument. This
+ * generates a sequence of <code>self.size</code> <em>n</em>-element
+ * arrays, where <em>n</em> is one more that the count of arguments. If
+ * the size of any argument is less than <code>enumObj.size</code>,
+ * <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,2,3].zip(a, b) #=> [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
+ * [1,2].zip(a,b) #=> [[1, 4, 7], [2, 5, 8]]
+ * a.zip([1,2],[8]) #=> [[4,1,8], [5,2,nil], [6,nil,nil]]
+ */
+
+static VALUE
+rb_ary_zip(argc, argv, ary)
+ int argc;
+ VALUE *argv;
+ VALUE ary;
+{
+ int i, j;
+ long len;
+ VALUE result;
+
+ for (i=0; i<argc; i++) {
+ argv[i] = to_ary(argv[i]);
+ }
+ if (rb_block_given_p()) {
+ for (i=0; i<RARRAY(ary)->len; i++) {
+ VALUE tmp = rb_ary_new2(argc+1);
+
+ rb_ary_push(tmp, rb_ary_elt(ary, i));
+ for (j=0; j<argc; j++) {
+ rb_ary_push(tmp, rb_ary_elt(argv[j], i));
+ }
+ rb_yield(tmp);
+ }
+ return Qnil;
+ }
+ len = RARRAY(ary)->len;
+ result = rb_ary_new2(len);
+ for (i=0; i<len; i++) {
+ VALUE tmp = rb_ary_new2(argc+1);
+
+ rb_ary_push(tmp, rb_ary_elt(ary, i));
+ for (j=0; j<argc; j++) {
+ rb_ary_push(tmp, rb_ary_elt(argv[j], i));
+ }
+ rb_ary_push(result, tmp);
+ }
+ return result;
+}
+
+/*
+ * call-seq:
+ * array.transpose -> an_array
+ *
+ * Assumes that <i>self</i> is an array of arrays and transposes the
+ * rows and columns.
+ *
+ * a = [[1,2], [3,4], [5,6]]
+ * a.transpose #=> [[1, 3, 5], [2, 4, 6]]
+ */
+
static VALUE
-ary_clear(ary)
+rb_ary_transpose(ary)
VALUE ary;
{
+ long elen = -1, alen, i, j;
+ VALUE tmp, result = 0;
+
+ alen = RARRAY(ary)->len;
+ if (alen == 0) return rb_ary_dup(ary);
+ for (i=0; i<alen; i++) {
+ tmp = to_ary(rb_ary_elt(ary, i));
+ if (elen < 0) { /* first element */
+ elen = RARRAY(tmp)->len;
+ result = rb_ary_new2(elen);
+ for (j=0; j<elen; j++) {
+ rb_ary_store(result, j, rb_ary_new2(alen));
+ }
+ }
+ else if (elen != RARRAY(tmp)->len) {
+ rb_raise(rb_eIndexError, "element size differ (%d should be %d)",
+ RARRAY(tmp)->len, elen);
+ }
+ for (j=0; j<elen; j++) {
+ rb_ary_store(rb_ary_elt(result, j), i, rb_ary_elt(tmp, j));
+ }
+ }
+ return result;
+}
+
+/*
+ * call-seq:
+ * array.replace(other_array) -> array
+ *
+ * Replaces the contents of <i>self</i> with the contents of
+ * <i>other_array</i>, truncating or expanding if necessary.
+ *
+ * a = [ "a", "b", "c", "d", "e" ]
+ * a.replace([ "x", "y", "z" ]) #=> ["x", "y", "z"]
+ * a #=> ["x", "y", "z"]
+ */
+
+static VALUE
+rb_ary_replace(copy, orig)
+ VALUE copy, orig;
+{
+ VALUE shared;
+
+ rb_ary_modify(copy);
+ orig = to_ary(orig);
+ if (copy == orig) return copy;
+ shared = ary_make_shared(orig);
+ if (RARRAY(copy)->ptr && !FL_TEST(copy, ELTS_SHARED))
+ free(RARRAY(copy)->ptr);
+ RARRAY(copy)->ptr = RARRAY(orig)->ptr;
+ RARRAY(copy)->len = RARRAY(orig)->len;
+ RARRAY(copy)->aux.shared = shared;
+ FL_SET(copy, ELTS_SHARED);
+
+ return copy;
+}
+
+/*
+ * call-seq:
+ * array.clear -> array
+ *
+ * Removes all elements from _self_.
+ *
+ * a = [ "a", "b", "c", "d", "e" ]
+ * a.clear #=> [ ]
+ */
+
+VALUE
+rb_ary_clear(ary)
+ VALUE ary;
+{
+ rb_ary_modify(ary);
RARRAY(ary)->len = 0;
- if (ARY_DEFAULT_SIZE*3 < RARRAY(ary)->capa) {
- RARRAY(ary)->capa = ARY_DEFAULT_SIZE * 2;
- REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->capa);
+ if (ARY_DEFAULT_SIZE * 2 < RARRAY(ary)->aux.capa) {
+ REALLOC_N(RARRAY(ary)->ptr, VALUE, ARY_DEFAULT_SIZE * 2);
+ RARRAY(ary)->aux.capa = ARY_DEFAULT_SIZE * 2;
}
return ary;
}
+/*
+ * call-seq:
+ * array.fill(obj) -> array
+ * array.fill(obj, start [, length]) -> array
+ * array.fill(obj, range ) -> array
+ * array.fill {|index| block } -> array
+ * array.fill(start [, length] ) {|index| block } -> array
+ * array.fill(range) {|index| block } -> array
+ *
+ * The first three forms set the selected elements of <i>self</i> (which
+ * may be the entire array) to <i>obj</i>. A <i>start</i> of
+ * <code>nil</code> is equivalent to zero. A <i>length</i> of
+ * <code>nil</code> is equivalent to <i>self.length</i>. The last three
+ * forms fill the array with the value of the block. The block is
+ * passed the absolute index of each element to be filled.
+ *
+ * a = [ "a", "b", "c", "d" ]
+ * a.fill("x") #=> ["x", "x", "x", "x"]
+ * a.fill("z", 2, 2) #=> ["x", "x", "z", "z"]
+ * a.fill("y", 0..1) #=> ["y", "y", "z", "z"]
+ * a.fill {|i| i*i} #=> [0, 1, 4, 9]
+ * a.fill(-2) {|i| i*i*i} #=> [0, 1, 8, 27]
+ */
+
static VALUE
-ary_fill(argc, argv, ary)
+rb_ary_fill(argc, argv, ary)
int argc;
VALUE *argv;
VALUE ary;
{
VALUE item, arg1, arg2;
- int beg, len, end;
+ long beg, end, len;
VALUE *p, *pend;
+ int block_p = Qfalse;
- if (rb_scan_args(argc, argv, "12", &item, &arg1, &arg2) == 2 &&
- beg_len(arg1, &beg, &len, RARRAY(ary)->len)) {
- /* beg and len set already */
+ if (rb_block_given_p()) {
+ block_p = Qtrue;
+ rb_scan_args(argc, argv, "02", &arg1, &arg2);
+ argc += 1; /* hackish */
}
else {
- beg = NIL_P(arg1)?0:NUM2INT(arg1);
+ rb_scan_args(argc, argv, "12", &item, &arg1, &arg2);
+ }
+ switch (argc) {
+ case 1:
+ beg = 0;
+ len = RARRAY(ary)->len;
+ break;
+ case 2:
+ if (rb_range_beg_len(arg1, &beg, &len, RARRAY(ary)->len, 1)) {
+ break;
+ }
+ /* fall through */
+ case 3:
+ beg = NIL_P(arg1) ? 0 : NUM2LONG(arg1);
if (beg < 0) {
beg = RARRAY(ary)->len + beg;
if (beg < 0) beg = 0;
}
- len = NIL_P(arg2)?RARRAY(ary)->len - beg:NUM2INT(arg2);
+ len = NIL_P(arg2) ? RARRAY(ary)->len - beg : NUM2LONG(arg2);
+ break;
}
+ rb_ary_modify(ary);
end = beg + len;
if (end > RARRAY(ary)->len) {
- if (end >= RARRAY(ary)->capa) {
- RARRAY(ary)->capa=end;
- REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->capa);
+ if (end >= RARRAY(ary)->aux.capa) {
+ REALLOC_N(RARRAY(ary)->ptr, VALUE, end);
+ RARRAY(ary)->aux.capa = end;
}
if (beg > RARRAY(ary)->len) {
- memclear(RARRAY(ary)->ptr+RARRAY(ary)->len,end-RARRAY(ary)->len);
+ rb_mem_clear(RARRAY(ary)->ptr + RARRAY(ary)->len, end - RARRAY(ary)->len);
}
RARRAY(ary)->len = end;
}
- p = RARRAY(ary)->ptr + beg; pend = p + len;
- while (p < pend) {
- *p++ = item;
+ if (block_p) {
+ VALUE v;
+ long i;
+
+ for (i=beg; i<end; i++) {
+ v = rb_yield(LONG2NUM(i));
+ if (i>=RARRAY(ary)->len) break;
+ RARRAY(ary)->ptr[i] = v;
+ }
+ }
+ else {
+ p = RARRAY(ary)->ptr + beg;
+ pend = p + len;
+ while (p < pend) {
+ *p++ = item;
+ }
}
return ary;
}
+/*
+ * call-seq:
+ * array + other_array -> an_array
+ *
+ * Concatenation---Returns a new array built by concatenating the
+ * two arrays together to produce a third array.
+ *
+ * [ 1, 2, 3 ] + [ 4, 5 ] #=> [ 1, 2, 3, 4, 5 ]
+ */
+
VALUE
-ary_plus(x, y)
+rb_ary_plus(x, y)
VALUE x, y;
{
VALUE z;
+ long len;
- if (TYPE(y) != T_ARRAY) {
- return ary_plus(x, rb_Array(y));
- }
-
- z = ary_new2(RARRAY(x)->len + RARRAY(y)->len);
+ y = to_ary(y);
+ len = RARRAY(x)->len + RARRAY(y)->len;
+ z = rb_ary_new2(len);
MEMCPY(RARRAY(z)->ptr, RARRAY(x)->ptr, VALUE, RARRAY(x)->len);
- MEMCPY(RARRAY(z)->ptr+RARRAY(x)->len, RARRAY(y)->ptr, VALUE, RARRAY(y)->len);
- RARRAY(z)->len = RARRAY(x)->len + RARRAY(y)->len;
+ MEMCPY(RARRAY(z)->ptr + RARRAY(x)->len, RARRAY(y)->ptr, VALUE, RARRAY(y)->len);
+ RARRAY(z)->len = len;
return z;
}
+/*
+ * call-seq:
+ * array.concat(other_array) -> array
+ *
+ * Appends the elements in other_array to _self_.
+ *
+ * [ "a", "b" ].concat( ["c", "d"] ) #=> [ "a", "b", "c", "d" ]
+ */
+
+
VALUE
-ary_concat(x, y)
+rb_ary_concat(x, y)
VALUE x, y;
{
- VALUE *p, *pend;
-
- if (TYPE(y) != T_ARRAY) {
- return ary_concat(x, rb_Array(y));
- }
-
- p = RARRAY(y)->ptr;
- pend = p + RARRAY(y)->len;
- while (p < pend) {
- ary_store(x, RARRAY(x)->len, *p);
- p++;
+ y = to_ary(y);
+ if (RARRAY(y)->len > 0) {
+ rb_ary_update(x, RARRAY(x)->len, 0, y);
}
return x;
}
+
+/*
+ * call-seq:
+ * array * int -> an_array
+ * array * str -> a_string
+ *
+ * Repetition---With a String argument, equivalent to
+ * self.join(str). Otherwise, returns a new array
+ * built by concatenating the _int_ copies of _self_.
+ *
+ *
+ * [ 1, 2, 3 ] * 3 #=> [ 1, 2, 3, 1, 2, 3, 1, 2, 3 ]
+ * [ 1, 2, 3 ] * "," #=> "1,2,3"
+ *
+ */
+
static VALUE
-ary_times(ary, times)
- VALUE ary;
- VALUE times;
+rb_ary_times(ary, times)
+ VALUE ary, times;
{
- VALUE ary2;
- int i, len;
+ VALUE ary2, tmp;
+ long i, len;
- if (TYPE(times) == T_STRING) {
- return ary_join(ary, times);
+ tmp = rb_check_string_type(times);
+ if (!NIL_P(tmp)) {
+ return rb_ary_join(ary, tmp);
}
- len = NUM2INT(times);
+ len = NUM2LONG(times);
+ if (len == 0) return ary_new(rb_obj_class(ary), 0);
if (len < 0) {
- ArgError("negative argument");
+ rb_raise(rb_eArgError, "negative argument");
+ }
+ if (LONG_MAX/len < RARRAY(ary)->len) {
+ rb_raise(rb_eArgError, "argument too big");
}
len *= RARRAY(ary)->len;
- ary2 = ary_new2(len);
+ ary2 = ary_new(rb_obj_class(ary), len);
RARRAY(ary2)->len = len;
for (i=0; i<len; i+=RARRAY(ary)->len) {
MEMCPY(RARRAY(ary2)->ptr+i, RARRAY(ary)->ptr, VALUE, RARRAY(ary)->len);
}
+ OBJ_INFECT(ary2, ary);
return ary2;
}
+/*
+ * call-seq:
+ * array.assoc(obj) -> an_array or nil
+ *
+ * Searches through an array whose elements are also arrays
+ * comparing _obj_ with the first element of each contained array
+ * using obj.==.
+ * Returns the first contained array that matches (that
+ * is, the first associated array),
+ * or +nil+ if no match is found.
+ * See also <code>Array#rassoc</code>.
+ *
+ * s1 = [ "colors", "red", "blue", "green" ]
+ * s2 = [ "letters", "a", "b", "c" ]
+ * s3 = "foo"
+ * a = [ s1, s2, s3 ]
+ * a.assoc("letters") #=> [ "letters", "a", "b", "c" ]
+ * a.assoc("foo") #=> nil
+ */
+
VALUE
-ary_assoc(ary, key)
- VALUE ary;
- VALUE key;
+rb_ary_assoc(ary, key)
+ VALUE ary, key;
{
- VALUE *p, *pend;
+ long i;
+ VALUE v;
- p = RARRAY(ary)->ptr; pend = p + RARRAY(ary)->len;
- while (p < pend) {
- if (TYPE(*p) == T_ARRAY
- && RARRAY(*p)->len > 1
- && rb_equal(RARRAY(*p)->ptr[0], key))
- return *p;
- p++;
+ for (i = 0; i < RARRAY(ary)->len; ++i) {
+ v = RARRAY(ary)->ptr[i];
+ if (TYPE(v) == T_ARRAY &&
+ RARRAY(v)->len > 0 &&
+ rb_equal(RARRAY(v)->ptr[0], key))
+ return v;
}
return Qnil;
}
+/*
+ * call-seq:
+ * array.rassoc(key) -> an_array or nil
+ *
+ * Searches through the array whose elements are also arrays. Compares
+ * <em>key</em> with the second element of each contained array using
+ * <code>==</code>. Returns the first contained array that matches. See
+ * also <code>Array#assoc</code>.
+ *
+ * a = [ [ 1, "one"], [2, "two"], [3, "three"], ["ii", "two"] ]
+ * a.rassoc("two") #=> [2, "two"]
+ * a.rassoc("four") #=> nil
+ */
+
VALUE
-ary_rassoc(ary, value)
- VALUE ary;
- VALUE value;
+rb_ary_rassoc(ary, value)
+ VALUE ary, value;
{
- VALUE *p, *pend;
+ long i;
+ VALUE v;
- p = RARRAY(ary)->ptr; pend = p + RARRAY(ary)->len;
- while (p < pend) {
- if (TYPE(*p) == T_ARRAY
- && RARRAY(*p)->len > 1
- && rb_equal(RARRAY(*p)->ptr[1], value))
- return *p;
- p++;
+ for (i = 0; i < RARRAY(ary)->len; ++i) {
+ v = RARRAY(ary)->ptr[i];
+ if (TYPE(v) == T_ARRAY &&
+ RARRAY(v)->len > 1 &&
+ rb_equal(RARRAY(v)->ptr[1], value))
+ return v;
}
return Qnil;
}
+/*
+ * call-seq:
+ * array == other_array -> bool
+ *
+ * Equality---Two arrays are equal if they contain the same number
+ * of elements and if each element is equal to (according to
+ * Object.==) the corresponding element in the other array.
+ *
+ * [ "a", "c" ] == [ "a", "c", 7 ] #=> false
+ * [ "a", "c", 7 ] == [ "a", "c", 7 ] #=> true
+ * [ "a", "c", 7 ] == [ "a", "d", "f" ] #=> false
+ *
+ */
+
static VALUE
-ary_equal(ary1, ary2)
+rb_ary_equal(ary1, ary2)
VALUE ary1, ary2;
{
- int i;
+ long i;
- if (TYPE(ary2) != T_ARRAY) return FALSE;
- if (RARRAY(ary1)->len != RARRAY(ary2)->len) return FALSE;
+ if (ary1 == ary2) return Qtrue;
+ if (TYPE(ary2) != T_ARRAY) {
+ if (!rb_respond_to(ary2, rb_intern("to_ary"))) {
+ return Qfalse;
+ }
+ return rb_equal(ary2, ary1);
+ }
+ if (RARRAY(ary1)->len != RARRAY(ary2)->len) return Qfalse;
for (i=0; i<RARRAY(ary1)->len; i++) {
- if (!rb_equal(RARRAY(ary1)->ptr[i], RARRAY(ary2)->ptr[i]))
- return FALSE;
+ if (!rb_equal(rb_ary_elt(ary1, i), rb_ary_elt(ary2, i)))
+ return Qfalse;
}
- return TRUE;
+ return Qtrue;
}
+/*
+ * call-seq:
+ * array.eql?(other) -> true or false
+ *
+ * Returns <code>true</code> if _array_ and _other_ are the same object,
+ * or are both arrays with the same content.
+ */
+
static VALUE
-ary_eql(ary1, ary2)
+rb_ary_eql(ary1, ary2)
VALUE ary1, ary2;
{
- int i;
+ long i;
- if (TYPE(ary2) != T_ARRAY) return FALSE;
- if (RARRAY(ary1)->len != RARRAY(ary2)->len)
- return FALSE;
+ 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(RARRAY(ary1)->ptr[i], RARRAY(ary2)->ptr[i]))
- return FALSE;
+ if (!rb_eql(rb_ary_elt(ary1, i), rb_ary_elt(ary2, i)))
+ return Qfalse;
}
- return TRUE;
+ return Qtrue;
}
+/*
+ * 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
-ary_hash(ary)
+rb_ary_hash(ary)
VALUE ary;
{
- int h, i;
+ long i, h;
+ VALUE n;
h = RARRAY(ary)->len;
for (i=0; i<RARRAY(ary)->len; i++) {
- h ^= rb_hash(RARRAY(ary)->ptr[i]);
- }
- return INT2FIX(h);
-}
+ h = (h << 1) | (h<0 ? 1 : 0);
+ n = rb_hash(RARRAY(ary)->ptr[i]);
+ h ^= NUM2LONG(n);
+ }
+ return LONG2FIX(h);
+}
+
+/*
+ * call-seq:
+ * array.include?(obj) -> true or false
+ *
+ * Returns <code>true</code> if the given object is present in
+ * <i>self</i> (that is, if any object <code>==</code> <i>anObject</i>),
+ * <code>false</code> otherwise.
+ *
+ * a = [ "a", "b", "c" ]
+ * a.include?("b") #=> true
+ * a.include?("z") #=> false
+ */
VALUE
-ary_includes(ary, item)
+rb_ary_includes(ary, item)
VALUE ary;
VALUE item;
{
- int i;
+ long i;
+
for (i=0; i<RARRAY(ary)->len; i++) {
if (rb_equal(RARRAY(ary)->ptr[i], item)) {
- return TRUE;
+ return Qtrue;
}
}
- return FALSE;
-}
+ return Qfalse;
+}
+
+
+/*
+ * call-seq:
+ * array <=> other_array -> -1, 0, +1
+ *
+ * Comparison---Returns an integer (-1, 0,
+ * or +1) if this array is less than, equal to, or greater than
+ * other_array. Each object in each array is compared
+ * (using <=>). If any value isn't
+ * equal, then that inequality is the return value. If all the
+ * values found are equal, then the return is based on a
+ * comparison of the array lengths. Thus, two arrays are
+ * ``equal'' according to <code>Array#<=></code> if and only if they have
+ * the same length and the value of each element is equal to the
+ * value of the corresponding element in the other array.
+ *
+ * [ "a", "a", "c" ] <=> [ "a", "b", "c" ] #=> -1
+ * [ 1, 2, 3, 4, 5, 6 ] <=> [ 1, 2 ] #=> +1
+ *
+ */
VALUE
-ary_cmp(ary, ary2)
- VALUE ary;
- VALUE ary2;
+rb_ary_cmp(ary1, ary2)
+ VALUE ary1, ary2;
{
- int i, len;
+ long i, len;
ary2 = to_ary(ary2);
- len = RARRAY(ary)->len;
+ len = RARRAY(ary1)->len;
if (len > RARRAY(ary2)->len) {
len = RARRAY(ary2)->len;
}
for (i=0; i<len; i++) {
- VALUE v = rb_funcall(RARRAY(ary)->ptr[i],cmp,1,RARRAY(ary2)->ptr[i]);
+ VALUE v = rb_funcall(rb_ary_elt(ary1, i), id_cmp, 1, rb_ary_elt(ary2, i));
if (v != INT2FIX(0)) {
return v;
}
}
- len = RARRAY(ary)->len - RARRAY(ary2)->len;
+ len = RARRAY(ary1)->len - RARRAY(ary2)->len;
if (len == 0) return INT2FIX(0);
if (len > 0) return INT2FIX(1);
return INT2FIX(-1);
}
static VALUE
-ary_diff(ary1, ary2)
+ary_make_hash(ary1, ary2)
VALUE ary1, ary2;
{
- VALUE ary3;
- int i;
+ VALUE hash = rb_hash_new();
+ long i;
- ary2 = to_ary(ary2);
- ary3 = ary_new();
for (i=0; i<RARRAY(ary1)->len; i++) {
- if (ary_includes(ary2, RARRAY(ary1)->ptr[i])) continue;
- if (ary_includes(ary3, RARRAY(ary1)->ptr[i])) continue;
- ary_push(ary3, RARRAY(ary1)->ptr[i]);
+ rb_hash_aset(hash, RARRAY(ary1)->ptr[i], Qtrue);
+ }
+ if (ary2) {
+ for (i=0; i<RARRAY(ary2)->len; i++) {
+ rb_hash_aset(hash, RARRAY(ary2)->ptr[i], Qtrue);
+ }
+ }
+ return hash;
+}
+
+/*
+ * call-seq:
+ * array - other_array -> an_array
+ *
+ * Array Difference---Returns a new array that is a copy of
+ * the original array, removing any items that also appear in
+ * other_array. (If you need set-like behavior, see the
+ * library class Set.)
+ *
+ * [ 1, 1, 2, 2, 3, 3, 4, 5 ] - [ 1, 2, 4 ] #=> [ 3, 3, 5 ]
+ */
+
+static VALUE
+rb_ary_diff(ary1, ary2)
+ VALUE ary1, ary2;
+{
+ VALUE ary3, hash;
+ long i;
+
+ hash = ary_make_hash(to_ary(ary2), 0);
+ ary3 = rb_ary_new();
+
+ for (i=0; i<RARRAY(ary1)->len; i++) {
+ if (st_lookup(RHASH(hash)->tbl, RARRAY(ary1)->ptr[i], 0)) continue;
+ rb_ary_push(ary3, rb_ary_elt(ary1, i));
}
return ary3;
}
+/*
+ * call-seq:
+ * array & other_array
+ *
+ * Set Intersection---Returns a new array
+ * containing elements common to the two arrays, with no duplicates.
+ *
+ * [ 1, 1, 3, 5 ] & [ 1, 2, 3 ] #=> [ 1, 3 ]
+ */
+
+
static VALUE
-ary_and(ary1, ary2)
+rb_ary_and(ary1, ary2)
VALUE ary1, ary2;
{
- VALUE ary3;
- int i;
+ VALUE hash, ary3, v, vv;
+ long i;
ary2 = to_ary(ary2);
- ary3 = ary_new();
+ ary3 = rb_ary_new2(RARRAY(ary1)->len < RARRAY(ary2)->len ?
+ RARRAY(ary1)->len : RARRAY(ary2)->len);
+ hash = ary_make_hash(ary2, 0);
+
for (i=0; i<RARRAY(ary1)->len; i++) {
- if (ary_includes(ary2, RARRAY(ary1)->ptr[i])
- && !ary_includes(ary3, RARRAY(ary1)->ptr[i])) {
- ary_push(ary3, RARRAY(ary1)->ptr[i]);
+ v = vv = rb_ary_elt(ary1, i);
+ if (st_delete(RHASH(hash)->tbl, (st_data_t*)&vv, 0)) {
+ rb_ary_push(ary3, v);
}
}
+
return ary3;
}
+/*
+ * call-seq:
+ * array | other_array -> an_array
+ *
+ * Set Union---Returns a new array by joining this array with
+ * other_array, removing duplicates.
+ *
+ * [ "a", "b", "c" ] | [ "c", "d", "a" ]
+ * #=> [ "a", "b", "c", "d" ]
+ */
+
static VALUE
-ary_or(ary1, ary2)
+rb_ary_or(ary1, ary2)
VALUE ary1, ary2;
{
- VALUE ary3;
- int i;
+ VALUE hash, ary3;
+ VALUE v, vv;
+ long i;
- if (TYPE(ary2) != T_ARRAY) {
- if (ary_includes(ary1, ary2)) return ary1;
- else return ary_plus(ary1, ary2);
- }
+ ary2 = to_ary(ary2);
+ ary3 = rb_ary_new2(RARRAY(ary1)->len+RARRAY(ary2)->len);
+ hash = ary_make_hash(ary1, ary2);
- ary3 = ary_new();
for (i=0; i<RARRAY(ary1)->len; i++) {
- if (!ary_includes(ary3, RARRAY(ary1)->ptr[i]))
- ary_push(ary3, RARRAY(ary1)->ptr[i]);
+ v = vv = rb_ary_elt(ary1, i);
+ if (st_delete(RHASH(hash)->tbl, (st_data_t*)&vv, 0)) {
+ rb_ary_push(ary3, v);
+ }
}
for (i=0; i<RARRAY(ary2)->len; i++) {
- if (!ary_includes(ary3, RARRAY(ary2)->ptr[i]))
- ary_push(ary3, RARRAY(ary2)->ptr[i]);
+ v = vv = rb_ary_elt(ary2, i);
+ if (st_delete(RHASH(hash)->tbl, (st_data_t*)&vv, 0)) {
+ rb_ary_push(ary3, v);
+ }
}
return ary3;
}
+/*
+ * call-seq:
+ * array.uniq! -> array or nil
+ *
+ * Removes duplicate elements from _self_.
+ * Returns <code>nil</code> if no changes are made (that is, no
+ * duplicates are found).
+ *
+ * a = [ "a", "a", "b", "b", "c" ]
+ * a.uniq! #=> ["a", "b", "c"]
+ * b = [ "a", "b", "c" ]
+ * b.uniq! #=> nil
+ */
+
static VALUE
-ary_uniq_bang(ary)
+rb_ary_uniq_bang(ary)
VALUE ary;
{
- VALUE *p, *q, *t, *end;
- VALUE v;
+ VALUE hash, v, vv;
+ long i, j;
- ary_modify(ary);
- p = RARRAY(ary)->ptr;
- end = p + RARRAY(ary)->len;
+ rb_ary_modify(ary);
- while (p < end) {
- v = *p++;
- q = t = p;
- while (q < end) {
- if (rb_equal(*q, v)) q++;
- else *t++ = *q++;
- }
- end = t;
- }
- if (RARRAY(ary)->len == (end - RARRAY(ary)->ptr)) {
+ hash = ary_make_hash(ary, 0);
+
+ if (RARRAY(ary)->len == RHASH(hash)->tbl->num_entries) {
return Qnil;
}
-
- RARRAY(ary)->len = (end - RARRAY(ary)->ptr);
+ for (i=j=0; i<RARRAY(ary)->len; i++) {
+ v = vv = rb_ary_elt(ary, i);
+ if (st_delete(RHASH(hash)->tbl, (st_data_t*)&vv, 0)) {
+ rb_ary_store(ary, j++, v);
+ }
+ }
+ RARRAY(ary)->len = j;
return ary;
}
+/*
+ * call-seq:
+ * array.uniq -> an_array
+ *
+ * Returns a new array by removing duplicate values in <i>self</i>.
+ *
+ * a = [ "a", "a", "b", "b", "c" ]
+ * a.uniq #=> ["a", "b", "c"]
+ */
+
static VALUE
-ary_uniq(ary)
+rb_ary_uniq(ary)
VALUE ary;
{
- VALUE v = ary_uniq_bang(ary_dup(ary));
-
- if (NIL_P(v)) return ary;
- return v;
+ ary = rb_ary_dup(ary);
+ rb_ary_uniq_bang(ary);
+ return ary;
}
+/*
+ * call-seq:
+ * array.compact! -> array or nil
+ *
+ * Removes +nil+ elements from array.
+ * Returns +nil+ if no changes were made.
+ *
+ * [ "a", nil, "b", nil, "c" ].compact! #=> [ "a", "b", "c" ]
+ * [ "a", "b", "c" ].compact! #=> nil
+ */
+
static VALUE
-ary_compact_bang(ary)
+rb_ary_compact_bang(ary)
VALUE ary;
{
VALUE *p, *t, *end;
- ary_modify(ary);
+ rb_ary_modify(ary);
p = t = RARRAY(ary)->ptr;
end = p + RARRAY(ary)->len;
+
while (t < end) {
if (NIL_P(*t)) t++;
else *p++ = *t++;
@@ -1251,140 +2819,250 @@ ary_compact_bang(ary)
if (RARRAY(ary)->len == (p - RARRAY(ary)->ptr)) {
return Qnil;
}
- RARRAY(ary)->len = RARRAY(ary)->capa = (p - RARRAY(ary)->ptr);
+ RARRAY(ary)->len = RARRAY(ary)->aux.capa = (p - RARRAY(ary)->ptr);
REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->len);
return ary;
}
+/*
+ * call-seq:
+ * array.compact -> an_array
+ *
+ * Returns a copy of _self_ with all +nil+ elements removed.
+ *
+ * [ "a", nil, "b", nil, "c", nil ].compact
+ * #=> [ "a", "b", "c" ]
+ */
+
static VALUE
-ary_compact(ary)
+rb_ary_compact(ary)
VALUE ary;
{
- VALUE v = ary_compact_bang(ary_dup(ary));
-
- if (NIL_P(v)) return ary;
- return v;
+ ary = rb_ary_dup(ary);
+ rb_ary_compact_bang(ary);
+ return ary;
}
+/*
+ * call-seq:
+ * array.nitems -> int
+ *
+ * Returns the number of non-<code>nil</code> elements in _self_.
+ * May be zero.
+ *
+ * [ 1, nil, 3, nil, 5 ].nitems #=> 3
+ */
+
static VALUE
-ary_nitems(ary)
+rb_ary_nitems(ary)
VALUE ary;
{
- int n = 0;
+ long n = 0;
VALUE *p, *pend;
p = RARRAY(ary)->ptr;
pend = p + RARRAY(ary)->len;
+
while (p < pend) {
if (!NIL_P(*p)) n++;
p++;
}
- return INT2FIX(n);
+ return LONG2NUM(n);
+}
+
+static long
+flatten(ary, idx, ary2, memo)
+ VALUE ary;
+ long idx;
+ VALUE ary2, memo;
+{
+ VALUE id;
+ long i = idx;
+ long n, lim = idx + RARRAY(ary2)->len;
+
+ id = rb_obj_id(ary2);
+ if (rb_ary_includes(memo, id)) {
+ rb_raise(rb_eArgError, "tried to flatten recursive array");
+ }
+ rb_ary_push(memo, id);
+ rb_ary_update(ary, idx, 1, ary2);
+ while (i < lim) {
+ VALUE tmp;
+
+ tmp = rb_check_array_type(rb_ary_elt(ary, i));
+ if (!NIL_P(tmp)) {
+ n = flatten(ary, i, tmp, memo);
+ i += n; lim += n;
+ }
+ i++;
+ }
+ rb_ary_pop(memo);
+
+ return lim - idx - 1; /* returns number of increased items */
}
+/*
+ * call-seq:
+ * array.flatten! -> array or nil
+ *
+ * Flattens _self_ in place.
+ * Returns <code>nil</code> if no modifications were made (i.e.,
+ * <i>array</i> contains no subarrays.)
+ *
+ * a = [ 1, 2, [3, [4, 5] ] ]
+ * a.flatten! #=> [1, 2, 3, 4, 5]
+ * a.flatten! #=> nil
+ * a #=> [1, 2, 3, 4, 5]
+ */
+
static VALUE
-ary_flatten_bang(ary)
+rb_ary_flatten_bang(ary)
VALUE ary;
{
- int i;
+ long i = 0;
int mod = 0;
+ VALUE memo = Qnil;
- ary_modify(ary);
- for (i=0; i<RARRAY(ary)->len; i++) {
+ rb_ary_modify(ary);
+ while (i<RARRAY(ary)->len) {
VALUE ary2 = RARRAY(ary)->ptr[i];
- if (TYPE(ary2) == T_ARRAY) {
- ary_replace(ary, i--, 1, ary2);
+ VALUE tmp;
+
+ 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++;
}
if (mod == 0) return Qnil;
return ary;
}
+/*
+ * call-seq:
+ * array.flatten -> 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.
+ *
+ * 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
+ */
+
static VALUE
-ary_flatten(ary)
+rb_ary_flatten(ary)
VALUE ary;
{
- VALUE v = ary_flatten_bang(ary_dup(ary));
-
- if (NIL_P(v)) return ary;
- return v;
+ ary = rb_ary_dup(ary);
+ rb_ary_flatten_bang(ary);
+ return ary;
}
+
+/* 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
+ * indicates the last element of the array, -2 is the next to last
+ * element in the array, and so on.
+ */
+
void
Init_Array()
{
- cArray = rb_define_class("Array", cObject);
- rb_include_module(cArray, mEnumerable);
-
- rb_define_singleton_method(cArray, "new", ary_s_new, -1);
- rb_define_singleton_method(cArray, "[]", ary_s_create, -1);
- rb_define_method(cArray, "to_s", ary_to_s, 0);
- rb_define_method(cArray, "inspect", ary_inspect, 0);
- rb_define_method(cArray, "to_a", ary_to_a, 0);
- rb_define_method(cArray, "to_ary", ary_to_a, 0);
-
- rb_define_method(cArray, "freeze", ary_freeze, 0);
- rb_define_method(cArray, "frozen?", ary_frozen_p, 0);
-
- rb_define_method(cArray, "==", ary_equal, 1);
- rb_define_method(cArray, "eql?", ary_eql, 1);
- rb_define_method(cArray, "hash", ary_hash, 0);
-
- rb_define_method(cArray, "[]", ary_aref, -1);
- rb_define_method(cArray, "[]=", ary_aset, -1);
- rb_define_method(cArray, "concat", ary_concat, 1);
- rb_define_method(cArray, "<<", ary_push, 1);
- rb_define_method(cArray, "push", ary_push_method, -1);
- rb_define_method(cArray, "pop", ary_pop, 0);
- rb_define_method(cArray, "shift", ary_shift, 0);
- rb_define_method(cArray, "unshift", ary_unshift, 1);
- rb_define_method(cArray, "each", ary_each, 0);
- rb_define_method(cArray, "each_index", ary_each_index, 0);
- rb_define_method(cArray, "reverse_each", ary_reverse_each, 0);
- rb_define_method(cArray, "length", ary_length, 0);
- rb_define_alias(cArray, "size", "length");
- rb_define_method(cArray, "empty?", ary_empty_p, 0);
- rb_define_method(cArray, "index", ary_index, 1);
- rb_define_method(cArray, "rindex", ary_rindex, 1);
- rb_define_method(cArray, "indexes", ary_indexes, -1);
- rb_define_method(cArray, "indices", ary_indexes, -1);
- rb_define_method(cArray, "clone", ary_clone, 0);
- rb_define_method(cArray, "dup", ary_dup, 0);
- rb_define_method(cArray, "join", ary_join_method, -1);
- rb_define_method(cArray, "reverse", ary_reverse_method, 0);
- rb_define_method(cArray, "reverse!", ary_reverse, 0);
- rb_define_method(cArray, "sort", ary_sort, 0);
- rb_define_method(cArray, "sort!", ary_sort_bang, 0);
- rb_define_method(cArray, "delete", ary_delete, 1);
- rb_define_method(cArray, "delete_at", ary_delete_at, 1);
- rb_define_method(cArray, "delete_if", ary_delete_if, 0);
- rb_define_method(cArray, "filter", ary_filter, 0);
- rb_define_method(cArray, "replace", ary_replace_method, 1);
- rb_define_method(cArray, "clear", ary_clear, 0);
- rb_define_method(cArray, "fill", ary_fill, -1);
- rb_define_method(cArray, "include?", ary_includes, 1);
- rb_define_method(cArray, "===", ary_includes, 1);
- rb_define_method(cArray, "<=>", ary_cmp, 1);
-
- rb_define_method(cArray, "assoc", ary_assoc, 1);
- rb_define_method(cArray, "rassoc", ary_rassoc, 1);
-
- rb_define_method(cArray, "+", ary_plus, 1);
- rb_define_method(cArray, "*", ary_times, 1);
-
- rb_define_method(cArray, "-", ary_diff, 1);
- rb_define_method(cArray, "&", ary_and, 1);
- rb_define_method(cArray, "|", ary_or, 1);
-
- rb_define_method(cArray, "uniq", ary_uniq, 0);
- rb_define_method(cArray, "uniq!", ary_uniq_bang, 0);
- rb_define_method(cArray, "compact", ary_compact, 0);
- rb_define_method(cArray, "compact!", ary_compact_bang, 0);
- rb_define_method(cArray, "flatten", ary_flatten, 0);
- rb_define_method(cArray, "flatten!", ary_flatten_bang, 0);
- rb_define_method(cArray, "nitems", ary_nitems, 0);
-
- cmp = rb_intern("<=>");
+ rb_cArray = rb_define_class("Array", rb_cObject);
+ rb_include_module(rb_cArray, rb_mEnumerable);
+
+ rb_define_alloc_func(rb_cArray, ary_alloc);
+ rb_define_singleton_method(rb_cArray, "[]", rb_ary_s_create, -1);
+ rb_define_method(rb_cArray, "initialize", rb_ary_initialize, -1);
+ rb_define_method(rb_cArray, "initialize_copy", rb_ary_replace, 1);
+
+ rb_define_method(rb_cArray, "to_s", rb_ary_to_s, 0);
+ rb_define_method(rb_cArray, "inspect", rb_ary_inspect, 0);
+ rb_define_method(rb_cArray, "to_a", rb_ary_to_a, 0);
+ rb_define_method(rb_cArray, "to_ary", rb_ary_to_ary_m, 0);
+ rb_define_method(rb_cArray, "frozen?", rb_ary_frozen_p, 0);
+
+ rb_define_method(rb_cArray, "==", rb_ary_equal, 1);
+ rb_define_method(rb_cArray, "eql?", rb_ary_eql, 1);
+ rb_define_method(rb_cArray, "hash", rb_ary_hash, 0);
+
+ rb_define_method(rb_cArray, "[]", rb_ary_aref, -1);
+ rb_define_method(rb_cArray, "[]=", rb_ary_aset, -1);
+ rb_define_method(rb_cArray, "at", rb_ary_at, 1);
+ rb_define_method(rb_cArray, "fetch", rb_ary_fetch, -1);
+ rb_define_method(rb_cArray, "first", rb_ary_first, -1);
+ rb_define_method(rb_cArray, "last", rb_ary_last, -1);
+ 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, "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);
+ rb_define_method(rb_cArray, "each_index", rb_ary_each_index, 0);
+ rb_define_method(rb_cArray, "reverse_each", rb_ary_reverse_each, 0);
+ 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, "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);
+ rb_define_method(rb_cArray, "reverse", rb_ary_reverse_m, 0);
+ rb_define_method(rb_cArray, "reverse!", rb_ary_reverse_bang, 0);
+ rb_define_method(rb_cArray, "sort", rb_ary_sort, 0);
+ rb_define_method(rb_cArray, "sort!", rb_ary_sort_bang, 0);
+ rb_define_method(rb_cArray, "collect", rb_ary_collect, 0);
+ rb_define_method(rb_cArray, "collect!", rb_ary_collect_bang, 0);
+ rb_define_method(rb_cArray, "map", rb_ary_collect, 0);
+ rb_define_method(rb_cArray, "map!", rb_ary_collect_bang, 0);
+ rb_define_method(rb_cArray, "select", rb_ary_select, -1);
+ rb_define_method(rb_cArray, "values_at", rb_ary_values_at, -1);
+ rb_define_method(rb_cArray, "delete", rb_ary_delete, 1);
+ rb_define_method(rb_cArray, "delete_at", rb_ary_delete_at_m, 1);
+ rb_define_method(rb_cArray, "delete_if", rb_ary_delete_if, 0);
+ rb_define_method(rb_cArray, "reject", rb_ary_reject, 0);
+ rb_define_method(rb_cArray, "reject!", rb_ary_reject_bang, 0);
+ rb_define_method(rb_cArray, "zip", rb_ary_zip, -1);
+ rb_define_method(rb_cArray, "transpose", rb_ary_transpose, 0);
+ rb_define_method(rb_cArray, "replace", rb_ary_replace, 1);
+ rb_define_method(rb_cArray, "clear", rb_ary_clear, 0);
+ rb_define_method(rb_cArray, "fill", rb_ary_fill, -1);
+ rb_define_method(rb_cArray, "include?", rb_ary_includes, 1);
+ rb_define_method(rb_cArray, "<=>", rb_ary_cmp, 1);
+
+ rb_define_method(rb_cArray, "slice", rb_ary_aref, -1);
+ rb_define_method(rb_cArray, "slice!", rb_ary_slice_bang, -1);
+
+ rb_define_method(rb_cArray, "assoc", rb_ary_assoc, 1);
+ rb_define_method(rb_cArray, "rassoc", rb_ary_rassoc, 1);
+
+ rb_define_method(rb_cArray, "+", rb_ary_plus, 1);
+ rb_define_method(rb_cArray, "*", rb_ary_times, 1);
+
+ rb_define_method(rb_cArray, "-", rb_ary_diff, 1);
+ rb_define_method(rb_cArray, "&", rb_ary_and, 1);
+ rb_define_method(rb_cArray, "|", rb_ary_or, 1);
+
+ rb_define_method(rb_cArray, "uniq", rb_ary_uniq, 0);
+ 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, "nitems", rb_ary_nitems, 0);
+
+ id_cmp = rb_intern("<=>");
+ inspect_key = rb_intern("__inspect_key__");
}
diff --git a/bcc32/Makefile.sub b/bcc32/Makefile.sub
new file mode 100644
index 0000000000..0c4c6bb126
--- /dev/null
+++ b/bcc32/Makefile.sub
@@ -0,0 +1,585 @@
+# -*- makefile -*-
+
+SHELL = $(COMSPEC)
+
+#### Start of system configuration section. ####
+OS = bccwin32
+RT = $(OS)
+
+## variables may be overridden by $(compile_dir)/Makefile
+!ifndef srcdir
+srcdir = ..
+!endif
+!ifndef RUBY_INSTALL_NAME
+RUBY_INSTALL_NAME = ruby
+!endif
+!ifndef RUBYW_INSTALL_NAME
+RUBYW_INSTALL_NAME = $(RUBY_INSTALL_NAME:ruby=rubyw)
+!elif "$(RUBYW_INSTALL_NAME)" == "$(RUBY_INSTALL_NAME)"
+RUBYW_INSTALL_NAME = $(RUBY_INSTALL_NAME:ruby=rubyw)
+!endif
+!if "$(RUBYW_INSTALL_NAME)" == "$(RUBY_INSTALL_NAME)"
+RUBYW_INSTALL_NAME = $(RUBY_INSTALL_NAME)w
+!endif
+!ifndef RUBY_SO_NAME
+RUBY_SO_NAME = $(RT)-$(RUBY_INSTALL_NAME)$(MAJOR)$(MINOR)
+!endif
+!ifndef icondirs
+!ifdef ICONDIRS
+icondirs=$(ICONDIRS)
+!endif
+!endif
+!ifdef icondirs
+icondirs=$(icondirs:\=/)
+iconinc=-I$(icondirs: = -I)
+!endif
+###############
+
+VPATH = $(srcdir):$(srcdir)/missing
+.SUFFIXES: .y
+
+!ifndef CC
+CC = bcc32
+!endif
+!ifndef CPP
+CPP = cpp32
+!endif
+!ifndef RC
+RC = brcc32
+!endif
+!ifndef YACC
+YACC = byacc
+!endif
+!ifndef AR
+AR = tlib
+!endif
+
+PURIFY =
+AUTOCONF = autoconf
+
+!if !defined(PROCESSOR_ARCHITECTURE)
+PROCESSOR_ARCHITECTURE = x86
+!endif
+MACHINE = $(PROCESSOR_ARCHITECTURE)
+!if "$(PROCESSOR_ARCHITECTURE)" == "x86"
+!ifndef PROCESSOR_LEVEL
+PROCESSOR_LEVEL = 5
+!endif
+!if 6 < $(PROCESSOR_LEVEL)
+PROCESSOR_LEVEL = 6
+!endif
+PROCESSOR_FLAG = -$(PROCESSOR_LEVEL)
+CPU = i$(PROCESSOR_LEVEL)86
+ARCH = i386
+!else
+CPU = $(PROCESSOR_ARCHITECTURE)
+ARCH = $(PROCESSOR_ARCHITECTURE)
+!endif
+!ifndef DEBUGFLAGS
+DEBUGFLAGS =
+!endif
+!ifndef OPTFLAGS
+OPTFLAGS = -O
+!endif
+
+!ifndef prefix
+prefix = /usr
+!endif
+!ifndef exec_prefix
+exec_prefix = $(prefix)
+!endif
+!ifndef libdir
+libdir = $(exec_prefix)/lib
+!endif
+!ifndef DESTDIR
+DESTDIR = $(prefix)
+!endif
+!ifndef CFLAGS
+CFLAGS = -q $(DEBUGFLAGS) $(OPTFLAGS) $(PROCESSOR_FLAG) -w- -wsus -wcpt -wdup -wext -wrng -wrpt -wzdi
+!endif
+!ifndef CPPFLAGS
+CPPFLAGS = -I. -I$(srcdir) -I$(srcdir)missing
+!endif
+!ifndef LDFLAGS
+LDFLAGS = -S:$(STACK)
+!endif
+!ifndef RFLAGS
+RFLAGS = $(iconinc)
+!endif
+!ifndef EXTLIBS
+EXTLIBS =
+!endif
+LIBS = cw32.lib import32.lib ws2_32.lib $(EXTLIBS)
+MISSING = acosh.obj crypt.obj erf.obj win32.obj
+
+!ifndef STACK
+STACK = 0x2000000
+!endif
+
+XCFLAGS = -DRUBY_EXPORT
+
+ARFLAGS = /a
+LD = ilink32 -q -Gn
+LDSHARED = $(LD)
+XLDFLAGS = -Tpe c0x32.obj
+WLDFLAGS = -aa -Tpe c0w32.obj
+DLDFLAGS = -Tpd c0d32.obj
+LIBRUBY_LDSHARED = $(LDSHARED)
+LIBRUBY_DLDFLAGS = -Gi $(DLDFLAGS) $(EXTLDFLAGS)
+LDOBJECTS = $(MAINOBJ)
+
+SOLIBS =
+
+EXEEXT = .exe
+PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT)
+WPROGRAM=$(RUBYW_INSTALL_NAME)$(EXEEXT)
+RUBYDEF = $(RUBY_SO_NAME).def
+MINIRUBY = .\miniruby$(EXEEXT)
+
+ORGLIBPATH = $(LIB)
+
+#### End of system configuration section. ####
+
+LIBRUBY_A = $(RUBY_SO_NAME)-static.lib
+LIBRUBY_SO = $(RUBY_SO_NAME).dll
+LIBRUBY = $(RUBY_SO_NAME).lib
+LIBRUBYARG = $(LIBRUBY)
+
+!ifndef EXTOBJS
+EXTOBJS = dmyext.obj
+!endif
+
+MAINOBJ = main.obj
+WINMAINOBJ = winmain.obj
+
+OBJS = array.obj \
+ bignum.obj \
+ class.obj \
+ compar.obj \
+ dir.obj \
+ dln.obj \
+ enum.obj \
+ error.obj \
+ eval.obj \
+ file.obj \
+ gc.obj \
+ hash.obj \
+ inits.obj \
+ io.obj \
+ marshal.obj \
+ math.obj \
+ numeric.obj \
+ object.obj \
+ pack.obj \
+ parse.obj \
+ prec.obj \
+ process.obj \
+ random.obj \
+ range.obj \
+ re.obj \
+ regex.obj \
+ ruby.obj \
+ signal.obj \
+ sprintf.obj \
+ st.obj \
+ string.obj \
+ struct.obj \
+ time.obj \
+ util.obj \
+ variable.obj \
+ version.obj \
+ $(MISSING)
+
+SCRIPT_ARGS = "--dest-dir=$(DESTDIR)" \
+ "--make=$(MAKE)" \
+ "--mflags=$(MFLAGS)" \
+ "--make-flags=$(MAKEFLAGS)"
+
+all: miniruby$(EXEEXT) rbconfig.rb \
+ $(LIBRUBY) $(MISCLIBS)
+ .\miniruby$(EXEEXT) $(srcdir)ext/extmk.rb --extstatic=$(EXTSTATIC) $(SCRIPT_ARGS)
+
+ruby: $(PROGRAM)
+rubyw: $(WPROGRAM)
+lib: $(LIBRUBY)
+dll: $(LIBRUBY_SO)
+
+config: config.h config.status
+
+config.h:
+ @echo Creating $(@:.\=)
+ @type > $@ &&|
+\#define HAVE_SYS_TYPES_H 1
+\#define HAVE_SYS_STAT_H 1
+\#define HAVE_STDLIB_H 1
+\#define HAVE_STRING_H 1
+\#define HAVE_MEMORY_H 1
+\#define HAVE_OFF_T 1
+\#define SIZEOF_INT 4
+\#define SIZEOF_SHORT 2
+\#define SIZEOF_LONG 4
+\#define SIZEOF_LONG_LONG 0
+\#define SIZEOF___INT64 8
+\#define SIZEOF_OFF_T 4
+\#define SIZEOF_VOIDP 4
+\#define SIZEOF_FLOAT 4
+\#define SIZEOF_DOUBLE 8
+\#define SIZEOF_TIME_T 4
+\#define HAVE_PROTOTYPES 1
+\#define TOKEN_PASTE(x,y) x\#\#y
+\#define HAVE_STDARG_PROTOTYPES 1
+\#define NORETURN(x) x
+\#define HAVE_DECL_SYS_NERR 1
+\#define HAVE_LIMITS_H 1
+\#define HAVE_FCNTL_H 1
+\#define HAVE_UTIME_H 1
+\#define HAVE_FLOAT_H 1
+\#define HAVE_STRUCT_STAT_ST_RDEV 1
+\#define HAVE_ST_RDEV 1
+\#define GETGROUPS_T int
+\#define RETSIGTYPE void
+\#define HAVE_ALLOCA 1
+\#define HAVE_DUP2 1
+\#define HAVE_MEMMOVE 1
+\#define HAVE_MKDIR 1
+\#define HAVE_STRCASECMP 1
+\#define HAVE_STRNCASECMP 1
+\#define HAVE_STRERROR 1
+\#define HAVE_STRFTIME 1
+\#define HAVE_STRCHR 1
+\#define HAVE_STRSTR 1
+\#define HAVE_STRTOD 1
+\#define HAVE_STRTOL 1
+\#define HAVE_STRTOUL 1
+\#define HAVE_ISNAN 1
+\#define HAVE_FINITE 1
+\#define HAVE_FMOD 1
+\#define HAVE_WAITPID 1
+\#define HAVE_FSYNC 1
+\#define HAVE_GETCWD 1
+\#define HAVE_CHSIZE 1
+\#define HAVE_TIMES 1
+\#define HAVE_LINK 1
+\#define HAVE_TELLDIR 1
+\#define HAVE_SEEKDIR 1
+\#define HAVE_COSH 1
+\#define HAVE_SINH 1
+\#define HAVE_TANH 1
+\#define RSHIFT(x,y) ((x)>>(int)y)
+\#define FILE_COUNT level
+\#define FILE_READPTR curp
+\#define inline __inline
+\#define NEED_IO_SEEK_BETWEEN_RW 1
+\#define STACK_GROW_DIRECTION -1
+\#define DEFAULT_KCODE KCODE_NONE
+\#define DLEXT ".so"
+\#define DLEXT2 ".dll"
+\#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_PLATFORM "$(ARCH)-$(OS)"
+\#define RUBY_ARCHLIB "/lib/ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(OS)"
+\#define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(OS)"
+|
+
+config.status: Makefile $(srcdir)bcc32/Makefile.sub
+ @echo Creating $@
+ @type > $@ &&|
+# Generated automatically by Makefile.sub.
+s,@SHELL@,$$(COMSPEC),;t t
+s,@CFLAGS@,$(CFLAGS),;t t
+s,@CPPFLAGS@,$(CPPFLAGS),;t t
+s,@CXXFLAGS@,$(CXXFLAGS),;t t
+s,@FFLAGS@,$(FFLAGS),;t t
+s,@LDFLAGS@,,;t t
+s,@LIBS@,$(LIBS),;t t
+s,@exec_prefix@,$${prefix},;t t
+s,@prefix@,,;t t
+s,@program_transform_name@,s,,,,;t t
+s,@bindir@,$${exec_prefix}/bin,;t t
+s,@sbindir@,$${exec_prefix}/sbin,;t t
+s,@libexecdir@,$${exec_prefix}/libexec,;t t
+s,@datadir@,$${prefix}/share,;t t
+s,@sysconfdir@,$${prefix}/etc,;t t
+s,@sharedstatedir@,/etc,;t t
+s,@localstatedir@,/var,;t t
+s,@libdir@,$${exec_prefix}/lib,;t t
+s,@includedir@,$${prefix}/include,;t t
+s,@oldincludedir@,/usr/include,;t t
+s,@infodir@,$${prefix}/info,;t t
+s,@mandir@,$${prefix}/man,;t t
+s,@build@,$(CPU)-pc-$(OS),;t t
+s,@build_alias@,$(CPU)-$(OS),;t t
+s,@build_cpu@,$(CPU),;t t
+s,@build_vendor@,pc,;t t
+s,@build_os@,$(OS),;t t
+s,@host@,$(CPU)-pc-$(OS),;t t
+s,@host_alias@,$(CPU)-$(OS),;t t
+s,@host_cpu@,$(CPU),;t t
+s,@host_vendor@,pc,;t t
+s,@host_os@,$(OS),;t t
+s,@target@,$(ARCH)-pc-$(OS),;t t
+s,@target_alias@,$(ARCH)-$(OS),;t t
+s,@target_cpu@,$(ARCH),;t t
+s,@target_vendor@,pc,;t t
+s,@target_os@,$(OS),;t t
+s,@CC@,$(CC),;t t
+s,@CPP@,cpp32,;t t
+s,@YACC@,$(YACC),;t t
+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,@LIBOBJS@, acosh.obj crypt.obj erf.obj win32.obj,;t t
+s,@ALLOCA@,$(ALLOCA),;t t
+s,@DEFAULT_KCODE@,$(DEFAULT_KCODE),;t t
+s,@EXEEXT@,.exe,;t t
+s,@OBJEXT@,obj,;t t
+s,@XCFLAGS@,$(XCFLAGS),;t t
+s,@XLDFLAGS@,$(XLDFLAGS),;t t
+s,@DLDFLAGS@,$(DLDFLAGS),;t t
+s,@ARCH_FLAG@,$(ARCH_FLAG),;t t
+s,@STATIC@,$(STATIC),;t t
+s,@CCDLFLAGS@,,;t t
+s,@LDSHARED@,$(LDSHARED),;t t
+s,@DLEXT@,so,;t t
+s,@DLEXT2@,dll,;t t
+s,@LIBEXT@,lib,;t t
+s,@STRIP@,$(STRIP),;t t
+s,@EXTSTATIC@,$(EXTSTATIC),;t t
+s,@setup@,Setup,;t t
+s,@MINIRUBY@,$(MINIRUBY),;t t
+s,@LIBRUBY_LDSHARED@,$$(LDSHARED),;t t
+s,@LIBRUBY_DLDFLAGS@,-Gi $$(DLDFLAGS),;t t
+s,@RUBY_INSTALL_NAME@,$(RUBY_INSTALL_NAME),;t t
+s,@rubyw_install_name@,$(RUBYW_INSTALL_NAME),;t t
+s,@RUBYW_INSTALL_NAME@,$(RUBYW_INSTALL_NAME),;t t
+s,@RUBY_SO_NAME@,$(RUBY_SO_NAME),;t t
+s,@LIBRUBY_A@,$$(RUBY_SO_NAME)-static.lib,;t t
+s,@LIBRUBY_SO@,$$(RUBY_SO_NAME).dll,;t t
+s,@LIBRUBY_ALIASES@,$(LIBRUBY_ALIASES),;t t
+s,@LIBRUBY@,$$(RUBY_SO_NAME).lib,;t t
+s,@LIBRUBYARG@,$$(LIBRUBYARG_SHARED),;t t
+s,@LIBRUBYARG_STATIC@,$$(LIBRUBY_A),;t t
+s,@LIBRUBYARG_SHARED@,$$(LIBRUBY),;t t
+s,@SOLIBS@,$(SOLIBS),;t t
+s,@DLDLIBS@,$(DLDLIBS),;t t
+s,@ENABLE_SHARED@,yes,;t t
+s,@OUTFLAG@,-o,;t t
+s,@CPPOUTFILE@,,;t t
+s,@LIBPATHFLAG@, -L"%s",;t t
+s,@RPATHFLAG@,,;t t
+s,@LIBARG@,%s.lib,;t t
+s,@LINK_SO@,$$(LDSHARED) $$(DLDFLAGS) $$(LIBPATH) $$(OBJS), $$(@:/=\), nul, $$(LIBS) $$(LOCAL_LIBS), $$(DEFFILE), $$(RESFILE),;t t
+s,@COMPILE_C@,$$(CC) $$(CFLAGS) $$(CPPFLAGS) -c $$(<:/=\),;t t
+s,@COMPILE_CXX@,$$(CXX) $$(CXXFLAGS) $$(CPPFLAGS) -P -c $$(<:/=\),;t t
+s,@COMPILE_RULES@,{$$(srcdir)}.%s{}.%s: .%s.%s:,;t t
+s,@COMMON_LIBS@,m,;t t
+s,@COMMON_MACROS@,WIN32_LEAN_AND_MEAN;t t
+s,@COMMON_HEADERS@,winsock2.h windows.h,;t t
+s,@TRY_LINK@,$$(CC) -oconftest $$(INCFLAGS) -I$$(hdrdir) $$(CPPFLAGS) $$(CFLAGS) $$(LIBPATH) $$(LDFLAGS) $$(src) $$(LOCAL_LIBS) $$(LIBS),;t t
+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,@configure_args@,--enable-shared $(configure_args),;t t
+s,@configure_input@,$$configure_input,;t t
+s,@srcdir@,$(srcdir),;t t
+s,@top_srcdir@,$(srcdir),;t t
+|
+
+miniruby$(EXEEXT): $(LIBRUBY_A) $(MAINOBJ) dmyext.obj
+ @echo $(LIBS)
+ $(LD) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) dmyext.obj,$@,nul,$(LIBRUBY_A) $(LIBS)
+
+$(PROGRAM): $(MAINOBJ) $(LIBRUBY_SO) $(RUBY_INSTALL_NAME).res
+ $(LD) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ),$@,nul,$(LIBRUBYARG) $(LIBS),,$(RUBY_INSTALL_NAME).res
+
+$(WPROGRAM): $(MAINOBJ) $(WINMAINOBJ) $(LIBRUBY_SO) $(RUBYW_INSTALL_NAME).res
+ $(LD) $(LDFLAGS) $(WLDFLAGS) $(MAINOBJ) $(WINMAINOBJ),$@,nul,$(LIBRUBYARG) $(LIBS),,$(RUBYW_INSTALL_NAME).res
+
+$(LIBRUBY_A): $(OBJS) dmyext.obj
+ @-if exist $@ del $@
+ $(AR) $(ARFLAGS) "$@" $(OBJS) dmyext.obj
+
+# $(LIBRUBY): $(LIBRUBY_SO)
+# implib $@ $(LIBRUBY_SO)
+
+$(LIBRUBY_SO) $(LIBRUBY): $(LIBRUBY_A) $(EXTOBJS) $(RUBYDEF) $(RUBY_SO_NAME).res
+ @echo $(EXTOBJS)
+ $(LIBRUBY_LDSHARED) $(LIBRUBY_DLDFLAGS) $(EXTOBJS:/=\),$(LIBRUBY_SO),nul,$(LIBRUBY_A) $(LIBS),$(RUBYDEF),$(RUBY_SO_NAME).res
+
+$(RUBYDEF): $(LIBRUBY_A) miniruby$(EXEEXT)
+ $(MINIRUBY) $(srcdir)bcc32/mkexports.rb -output=$@ $(LIBRUBY_A)
+
+install: rbconfig.rb
+ $(MINIRUBY) $(srcdir)instruby.rb $(SCRIPT_ARGS)
+ $(MINIRUBY) $(srcdir)ext/extmk.rb $(SCRIPT_ARGS) install
+
+what-where no-install: rbconfig.rb
+ $(MINIRUBY) $(srcdir)instruby.rb -n $(SCRIPT_ARGS)
+ $(MINIRUBY) $(srcdir)ext/extmk.rb -n $(SCRIPT_ARGS) install
+
+clean: clean-ext clean-local
+
+clean-local:
+ @if exist $(LIBRUBY_A) del $(LIBRUBY_A)
+ @if exist $(MAINOBJ) del $(MAINOBJ)
+ @if exist rbconfig.rb del rbconfig.rb
+ @if exist ext\extinit.c del ext\extinit.c
+ @if exist ext\extinit.obj del ext\extinit.obj
+ @if exist ext\vc*.pdb del ext\vc*.pdb
+ @if exist *.obj del *.obj
+ @if exist *.res del *.res
+ @if exist *.tds del *.tds
+ @if exist *.il? del *.il?
+
+clean-ext:
+ @-$(MINIRUBY) $(srcdir)ext/extmk.rb $(SCRIPT_ARGS) clean
+
+distclean: distclean-ext distclean-local
+
+distclean-local: clean-local
+ @if exist Makefile del Makefile
+ @if exist config.h del config.h
+ @if exist ext\config.cache del ext\config.cache
+ @if exist config.cache del config.cache
+ @if exist config.log del config.log
+ @if exist config.status del config.status
+ @if exist *~ del *~
+ @if exist *.bak del *.bak
+ @if exist *.stackdump del *.stackdump
+ @if exist *.core del *.core
+ @if exist gmon.out del gmon.out
+ @if exist y.tab.c del y.tab.c
+ @if exist y.output del y.output
+ @if exist *.map del *.map
+ @if exist *.pdb del *.pdb
+ @if exist *.ilk del *.ilk
+ @if exist *.exp del *.exp
+ @if exist $(RUBYDEF) del $(RUBYDEF)
+ @if exist $(RUBY_INSTALL_NAME).rc del $(RUBY_INSTALL_NAME).rc
+ @if exist $(RUBYW_INSTALL_NAME).rc del $(RUBYW_INSTALL_NAME).rc
+ @if exist $(RUBY_SO_NAME).rc del $(RUBY_SO_NAME).rc
+ @if exist $(PROGRAM) del $(PROGRAM)
+ @if exist $(WPROGRAM) del $(WPROGRAM)
+ @if exist $(LIBRUBY_SO) del $(LIBRUBY_SO)
+ @if exist $(LIBRUBY) del $(LIBRUBY)
+ @if exist ext\nul if not exist ext\* rmdir ext
+ @if exist miniruby$(EXEEXT) del miniruby$(EXEEXT)
+
+distclean-ext:
+ @-$(MINIRUBY) $(srcdir)ext/extmk.rb $(SCRIPT_ARGS) distclean
+
+realclean: distclean
+ @if exist parse.c del parse.c
+ @if exist lex.c del lex.c
+
+test: miniruby$(EXEEXT) NUL
+ @$(MINIRUBY) $(srcdir)rubytest.rb
+
+rbconfig.rb: miniruby$(EXEEXT) config.status
+ @$(MINIRUBY) $(srcdir)mkconfig.rb -srcdir=$(srcdir) \
+ -install_name=$(RUBY_INSTALL_NAME) \
+ -so_name=$(RUBY_SO_NAME) rbconfig.rb
+
+$(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(RUBY_SO_NAME).rc: rbconfig.rb
+ @$(MINIRUBY) $(srcdir)win32/resource.rb \
+ -ruby_name=$(RUBY_INSTALL_NAME) \
+ -rubyw_name=$(RUBYW_INSTALL_NAME) \
+ -so_name=$(RUBY_SO_NAME) \
+ . $(icondirs) $(srcdir)win32
+
+#config.status: $(srcdir)configure
+# $(SHELL) .config.status --recheck
+
+.path.c = .;$(srcdir);$(srcdir)win32;$(srcdir)missing
+.path.h = .;$(srcdir);$(srcdir)win32;$(srcdir)missing
+.path.y = $(srcdir)
+
+.c.obj:
+ $(CC) $(CFLAGS) $(XCFLAGS) -I. $(CPPFLAGS) -c $(<:/=\)
+
+.rc.res:
+ $(RC) $(RFLAGS) -I. -I$(<D). $(iconinc) -I$(srcdir)win32 $(RFLAGS) -fo$@ $(<:/=\)
+
+.y.c:
+ $(YACC) $(YFLAGS) $(<:\=/)
+ sed -e "s!^ *extern char \*getenv();!/* & */!;s/^\(#.*\)y\.tab/\1parse/" y.tab.c > $(@F)
+ @del y.tab.c
+
+parse.c: parse.y
+
+ext/extinit.obj: ext/extinit.c $(SETUP)
+ $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) -o$@ -c ext/extinit.c
+
+acosh.obj: acosh.c win32.h
+alloca.obj: alloca.c win32.h
+crypt.obj: crypt.c win32.h
+dup2.obj: dup2.c win32.h
+erf.obj: erf.c win32.h
+finite.obj: finite.c win32.h
+flock.obj: flock.c win32.h
+memcmp.obj: memcmp.c win32.h
+memmove.obj: memmove.c win32.h
+mkdir.obj: mkdir.c win32.h
+vsnprintf.obj: vsnprintf.c win32.h
+strcasecmp.obj: strcasecmp.c win32.h
+strncasecmp.obj: strncasecmp.c win32.h
+strchr.obj: strchr.c win32.h
+strdup.obj: strdup.c win32.h
+strerror.obj: strerror.c win32.h
+strftime.obj: strftime.c win32.h
+strstr.obj: strstr.c win32.h
+strtod.obj: strtod.c win32.h
+strtol.obj: strtol.c win32.h
+strtoul.obj: strtoul.c win32.h
+nt.obj: nt.c win32.h
+x68.obj: x68.c win32.h
+os2.obj: os2.c win32.h
+dl_os2.obj: dl_os2.c win32.h
+
+# when I use -I., there is confliction at "OpenFile"
+# so, set . into environment varible "include"
+win32.obj: win32.c win32.h
+
+###
+array.obj: array.c ruby.h config.h defines.h intern.h missing.h util.h st.h win32.h
+bignum.obj: bignum.c ruby.h config.h defines.h intern.h missing.h win32.h
+class.obj: class.c ruby.h config.h defines.h intern.h missing.h rubysig.h node.h st.h win32.h
+compar.obj: compar.c ruby.h config.h defines.h intern.h missing.h win32.h
+dir.obj: dir.c ruby.h config.h defines.h intern.h missing.h util.h win32.h
+dln.obj: dln.c ruby.h config.h defines.h intern.h missing.h dln.h win32.h
+dmyext.obj: dmyext.c
+enum.obj: enum.c ruby.h config.h defines.h intern.h missing.h node.h util.h win32.h
+error.obj: error.c ruby.h config.h defines.h intern.h missing.h env.h st.h win32.h
+eval.obj: eval.c ruby.h config.h defines.h intern.h missing.h node.h env.h util.h rubysig.h st.h dln.h win32.h
+file.obj: file.c ruby.h config.h defines.h intern.h missing.h rubyio.h rubysig.h util.h dln.h win32.h
+gc.obj: gc.c ruby.h config.h defines.h intern.h missing.h rubysig.h st.h node.h env.h re.h regex.h win32.h
+hash.obj: hash.c ruby.h config.h defines.h intern.h missing.h st.h util.h rubysig.h win32.h
+inits.obj: inits.c ruby.h config.h defines.h intern.h missing.h win32.h
+io.obj: io.c ruby.h config.h defines.h intern.h missing.h rubyio.h rubysig.h env.h util.h win32.h
+main.obj: main.c ruby.h config.h defines.h intern.h missing.h win32.h
+marshal.obj: marshal.c ruby.h config.h defines.h intern.h missing.h rubyio.h st.h util.h win32.h
+math.obj: math.c ruby.h config.h defines.h intern.h missing.h win32.h
+numeric.obj: numeric.c ruby.h config.h defines.h intern.h missing.h win32.h
+object.obj: object.c ruby.h config.h defines.h intern.h missing.h st.h util.h win32.h
+pack.obj: pack.c ruby.h config.h defines.h intern.h missing.h win32.h
+parse.obj: parse.c ruby.h config.h defines.h intern.h missing.h env.h node.h st.h regex.h util.h lex.c win32.h
+prec.obj: prec.c ruby.h config.h defines.h intern.h missing.h win32.h
+process.obj: process.c ruby.h config.h defines.h intern.h missing.h rubysig.h st.h win32.h
+random.obj: random.c ruby.h config.h defines.h intern.h missing.h win32.h
+range.obj: range.c ruby.h config.h defines.h intern.h missing.h win32.h
+re.obj: re.c ruby.h config.h defines.h intern.h missing.h re.h regex.h win32.h
+regex.obj: regex.c config.h regex.h win32.h
+ruby.obj: ruby.c ruby.h config.h defines.h intern.h missing.h dln.h node.h util.h win32.h
+signal.obj: signal.c ruby.h config.h defines.h intern.h missing.h rubysig.h win32.h
+sprintf.obj: sprintf.c ruby.h config.h defines.h intern.h missing.h win32.h
+st.obj: st.c config.h st.h
+string.obj: string.c ruby.h config.h defines.h intern.h missing.h re.h regex.h win32.h
+struct.obj: struct.c ruby.h config.h defines.h intern.h missing.h win32.h
+time.obj: time.c ruby.h config.h defines.h intern.h missing.h win32.h
+util.obj: util.c ruby.h config.h defines.h intern.h missing.h util.h win32.h
+variable.obj: variable.c ruby.h config.h defines.h intern.h missing.h env.h node.h st.h util.h win32.h
+version.obj: version.c ruby.h config.h defines.h intern.h missing.h version.h win32.h
diff --git a/bcc32/README.bcc32 b/bcc32/README.bcc32
new file mode 100644
index 0000000000..a699d34a4e
--- /dev/null
+++ b/bcc32/README.bcc32
@@ -0,0 +1,125 @@
+=begin
+
+= How to build ruby using Borland C++
+
+== Requirement
+
+(1) Borland C++ 5.0 or later.
+
+(2) If you want to run `((%make clean%))' or `((%make distclean%))'
+ properly, you must install UNIX compatible `((%rm%))' command on
+ your ((|PATH|)).
+
+(3) Please set environment variable (({INCLUDE})), (({LIB})), (({PATH}))
+ to run required commands properly from the command line.
+
+ Note: building ruby requires following commands.
+ * make
+ * bcc
+ * tlib
+ * ilink
+
+== How to compile and install
+
+(1) Execute bcc32\configure.bat on your build directory.
+ ex. c:\ruby-1.6.7>bcc32\configure.bat
+
+(2) Change ((|RUBY_INSTALL_NAME|)) and ((|RUBY_SO_NAME|)) in (({Makefile}))
+ if you want to change the name of the executable files.
+ And add ((|RUBYW_INSTALL_NAME|)) to change the name of the
+ executable without console window if also you want.
+
+(3) Run `((%make%))'
+
+(4) Run `((%make test%))'
+
+(5) Run `((%make DESTDIR=<install_directory> install%))'
+
+ This command will create following directories and install files onto them.
+ * <install_directory>\bin
+ * <install_directory>\lib
+ * <install_directory>\lib\ruby
+ * <install_directory>\lib\ruby\<MAJOR>.<MINOR>
+ * <install_directory>\lib\ruby\<MAJOR>.<MINOR>\<PLATFORM>
+ * <install_directory>\lib\ruby\site_ruby
+ * <install_directory>\lib\ruby\site_ruby\<MAJOR>.<MINOR>
+ * <install_directory>\lib\ruby\site_ruby\<MAJOR>.<MINOR>\<PLATFORM>
+ * <install_directory>\man\man1
+ If Ruby's version is `x.y.z', the ((|<MAJOR>|)) is `x' and the ((|<MINOR>|)) is `y'.
+ The ((|<PLATFORM>|)) is usually `(({i586-bccwin32}))'.
+
+== Icons
+
+Any icon files(*.ico) in the build directory, directories specified with
+((|icondirs|)) make variable and (({win32})) directory under the ruby
+source directory will be included in DLL or executable files, according
+to their base names.
+ $(RUBY_INSTALL_NAME).ico or ruby.ico --> $(RUBY_INSTALL_NAME).exe
+ $(RUBYW_INSTALL_NAME).ico or rubyw.ico --> $(RUBYW_INSTALL_NAME).exe
+ the others --> $(RUBY_SO_NAME).dll
+
+Although no icons are distributed with the ruby source or in the official
+site, you can use anything you like. For example, followings are written
+in Japanese, but you can download at least.
+
+* ((<URL:http://member.nifty.ne.jp/ueivu/rubyico.html>)) or
+ ((<zipped icons|URL:http://member.nifty.ne.jp/ueivu/Ruby_ico.zip>))
+* ((<URL:http://homepage1.nifty.com/a_nakata/ruby/>)) or
+ ((<icon itself|URL:http://homepage1.nifty.com/a_nakata/ruby/RubyIcon.ico>))
+
+== Build examples
+
+* Build on the ruby source directory.
+
+ ex.)
+ ruby source directory: C:\ruby
+ build directory: C:\ruby
+ install directory: C:\usr\local
+
+ C:
+ cd \ruby
+ bcc32\configure
+ make
+ make test
+ make DESTDIR=/usr/local install
+
+* Build on the relative directory from the ruby source directory and CPU type
+ i386.
+
+ ex.)
+ ruby source directory: C:\ruby
+ build directory: C:\ruby\bccwin32
+ install directory: C:\usr\local
+ CPU i386
+
+ C:
+ cd \ruby
+ mkdir bccwin32
+ cd bccwin32
+ ..\bcc32\configure target i386-bccwin32
+ make
+ make test
+ make DESTDIR=/usr/local install
+
+* Build on the different drive.
+
+ ex.)
+ ruby source directory: C:\src\ruby
+ build directory: D:\build\ruby
+ install directory: C:\usr\local
+
+ D:
+ cd D:\build\ruby
+ C:\src\ruby\bcc32\configure
+ make
+ make test
+ make DESTDIR=C:/usr/local install
+
+== Bugs
+
+You can ((*NOT*)) use a path name contains any white space characters as
+the ruby source directory, this restriction comes from the behavior of
+(({!INCLUDE})) directives of (({MAKE})).
+((- you may call it a bug. -))
+
+=end
diff --git a/bcc32/configure.bat b/bcc32/configure.bat
new file mode 100644
index 0000000000..449b6e25b5
--- /dev/null
+++ b/bcc32/configure.bat
@@ -0,0 +1,32 @@
+@echo off
+::: Don't set environment variable in batch file other than autoexec.bat
+::: to avoid "Out of environment space" problem on Windows 95/98.
+::: set TMPMAKE=~tmp~.mak
+
+echo> ~tmp~.mak ####
+echo>> ~tmp~.mak conf = %0
+echo>> ~tmp~.mak $(conf:\=/): nul
+echo>> ~tmp~.mak @del ~tmp~.mak
+echo>> ~tmp~.mak @-$(MAKE) -l$(MAKEFLAGS) -f $(@D)setup.mak \
+echo>> ~tmp~.mak bcc32dir="$(@D)" \
+:loop
+if "%1" == "" goto :end
+if "%1" == "--srcdir" goto :srcdir
+if "%1" == "srcdir" goto :srcdir
+if "%1" == "--target" goto :target
+if "%1" == "target" goto :target
+ echo>> ~tmp~.mak "%1"
+ shift
+goto :loop
+:srcdir
+ echo>> ~tmp~.mak "srcdir=%2"
+ shift
+ shift
+goto :loop
+:target
+ echo>> ~tmp~.mak %2
+ shift
+ shift
+goto :loop
+:end
+make -s -f ~tmp~.mak
diff --git a/bcc32/mkexports.rb b/bcc32/mkexports.rb
new file mode 100644
index 0000000000..e34b441e2f
--- /dev/null
+++ b/bcc32/mkexports.rb
@@ -0,0 +1,25 @@
+#!./miniruby -s
+
+SYM = {}
+STDIN.reopen(open("nul"))
+ARGV.each do |obj|
+ IO.foreach("|tdump -q -oiPUBDEF -oiPUBD32 #{obj.tr('/', '\\')}") do |l|
+ next unless /(?:PUBDEF|PUBD32)/ =~ l
+ SYM[$1] = true if /'(.*?)'/ =~ l
+ end
+end
+
+exports = []
+if $name
+ exports << "Name " + $name
+elsif $library
+ exports << "Library " + $library
+end
+exports << "Description " + $description.dump if $description
+exports << "EXPORTS" << SYM.keys.sort
+
+if $output
+ open($output, 'w') {|f| f.puts exports.join("\n")}
+else
+ puts exports.join("\n")
+end
diff --git a/bcc32/setup.mak b/bcc32/setup.mak
new file mode 100644
index 0000000000..3b37b92fa8
--- /dev/null
+++ b/bcc32/setup.mak
@@ -0,0 +1,89 @@
+# -*- makefile -*-
+
+!if "$(srcdir)" != ""
+bcc32dir = $(srcdir)bcc32/
+!elseif "$(bcc32dir)" == "bcc32/"
+srcdir = ./
+!elseif "$(bcc32dir:/bcc32/=)/bcc32/" == "$(bcc32dir)"
+srcdir = $(bcc32dir:/bcc32/=/)
+!else
+srcdir = $(bcc32dir)../
+!endif
+
+OS = bccwin32
+RT = $(OS)
+INCLUDE = !include
+APPEND = echo>>$(MAKEFILE)
+!ifdef MAKEFILE
+MAKE = $(MAKE) -f $(MAKEFILE)
+!else
+MAKEFILE = Makefile
+!endif
+
+all: Makefile
+Makefile: -prologue- -generic- -epilogue-
+i386-$(OS): -prologue- -i386- -epilogue-
+i486-$(OS): -prologue- -i486- -epilogue-
+i586-$(OS): -prologue- -i586- -epilogue-
+i686-$(OS): -prologue- -i686- -epilogue-
+alpha-$(OS): -prologue- -alpha- -epilogue-
+
+-prologue-: nul
+ @echo Creating $(MAKEFILE)
+ @type > $(MAKEFILE) &&|
+\#\#\# Makefile for ruby $(OS) \#\#\#
+srcdir = $(srcdir:\=/)
+|
+ @cpp32 -I$(srcdir) -DRUBY_EXTERN="//" -P- -o$(MAKEFILE) > nul &&|
+\#include "version.h"
+MAJOR = RUBY_VERSION_MAJOR
+MINOR = RUBY_VERSION_MINOR
+TEENY = RUBY_VERSION_TEENY
+|
+ @type $(MAKEFILE).i >> $(MAKEFILE)
+ @del $(MAKEFILE).i
+
+-generic-: nul
+!if defined(PROCESSOR_ARCHITECTURE) || defined(PROCESSOR_LEVEL)
+ @type >> $(MAKEFILE) &&|
+!if defined(PROCESSOR_ARCHITECTURE)
+PROCESSOR_ARCHITECTURE = $(PROCESSOR_ARCHITECTURE)
+!endif
+!if defined(PROCESSOR_LEVEL)
+PROCESSOR_LEVEL = $(PROCESSOR_LEVEL)
+!endif
+
+|
+!endif
+
+-alpha-: nul
+ @$(APPEND) PROCESSOR_ARCHITECTURE = alpha
+-ix86-: nul
+ @$(APPEND) PROCESSOR_ARCHITECTURE = x86
+
+-i386-: -ix86-
+ @$(APPEND) PROCESSOR_LEVEL = 3
+-i486-: -ix86-
+ @$(APPEND) PROCESSOR_LEVEL = 4
+-i586-: -ix86-
+ @$(APPEND) PROCESSOR_LEVEL = 5
+-i686-: -ix86-
+ @$(APPEND) PROCESSOR_LEVEL = 6
+
+-epilogue-: nul
+ @type >> $(MAKEFILE) &&|
+
+\# OS = $(OS)
+\# RT = $(RT)
+\# RUBY_INSTALL_NAME = ruby
+\# RUBY_SO_NAME = $$(RT)-$$(RUBY_INSTALL_NAME)$$(MAJOR)$$(MINOR)
+\# prefix = /usr
+\# CFLAGS = -q $$(DEBUGFLAGS) $$(OPTFLAGS) $$(PROCESSOR_FLAG) -w- -wsus -wcpt -wdup -wext -wrng -wrpt -wzdi
+\# CPPFLAGS = -I. -I$$(srcdir) -I$$(srcdir)missing -DLIBRUBY_SO=\"$$(LIBRUBY_SO)\"
+\# STACK = 0x2000000
+\# LDFLAGS = -S:$$(STACK)
+\# RFLAGS = $$(iconinc)
+\# EXTLIBS = cw32.lib import32.lib user32.lib kernel32.lib
+$(INCLUDE) $$(srcdir)bcc32/Makefile.sub
+|
+ @echo type "`$(MAKE)'" to make ruby for $(OS).
diff --git a/beos/ruby.def.in b/beos/ruby.def.in
deleted file mode 100644
index 04de159208..0000000000
--- a/beos/ruby.def.in
+++ /dev/null
@@ -1,353 +0,0 @@
-ArgError
-Bug
-Error
-Error_Append
-Fail
-Fatal
-IndexError
-LoadError
-NameError
-Raise
-TypeError
-Warning
-any_to_s
-ary_assoc
-ary_concat
-ary_delete
-ary_delete_at
-ary_each
-ary_entry
-ary_freeze
-ary_includes
-ary_join
-ary_new
-ary_new2
-ary_new3
-ary_new4
-ary_plus
-ary_pop
-ary_push
-ary_rassoc
-ary_reverse
-ary_shift
-ary_sort
-ary_sort_bang
-ary_store
-ary_to_s
-ary_unshift
-assoc_new
-backref_get
-backref_set
-big2dbl
-big2str
-big_2comp
-big_and
-big_clone
-big_lshift
-big_minus
-big_mul
-big_norm
-big_or
-big_plus
-big_pow
-big_rand
-big_to_f
-big_to_i
-big_xor
-cArray
-cBignum
-cClass
-cData
-cFile
-cFixnum
-cFixnum
-cFloat
-cHash
-cIO
-cInteger
-cModule
-cNumeric
-cObject
-cProc
-cRegexp
-cString
-cStruct
-class_new
-class_new_instance
-data_object_alloc
-dbl2big
-dln_find_exe
-dln_find_file
-dln_load
-dyna_var_asgn
-dyna_var_defined
-dyna_var_ref
-eaccess
-enum_length
-eof_error
-exc_new
-exc_new2
-exc_new3
-f_autoload
-f_gets
-f_lambda
-f_load
-f_require
-file_open
-file_s_expand_path
-fix2str
-fix_to_s
-fix_upto
-flo_pow
-float_new
-gc_force_recycle
-gc_gc
-gc_mark
-gc_mark_frame
-gc_mark_global_tbl
-gc_mark_locations
-gc_mark_maybe
-gc_mark_threads
-gc_mark_trap_list
-gc_s_disable
-gc_s_enable
-hash_aref
-hash_aset
-hash_new
-id_attrset
-int2big
-int2inum
-io_binmode
-io_check_closed
-io_close
-io_fptr_finalize
-io_getc
-io_gets
-io_gets_method
-io_mode_flags
-io_readable
-io_reopen
-io_unbuffered
-io_ungetc
-io_writable
-io_write
-iterator_p
-lastline_get
-lastline_set
-local_var_append
-memclear
-mod_constants
-module_new
-new_idhash
-nodeline
-nodetype
-num2fix
-num2int
-num2long
-num_coerce_bin
-num_upto
-num_zerodiv
-obj_alloc
-obj_as_string
-obj_call_init
-obj_equal
-obj_is_instance_of
-obj_is_kind_of
-range_beg_end
-range_new
-rb_Array
-rb_Float
-rb_Integer
-rb_String
-rb_add_method
-rb_alias
-rb_alias_variable
-rb_apply
-rb_autoload
-rb_autoload_defined
-rb_backtrace
-rb_call_inits
-rb_check_safe_str
-rb_check_type
-rb_class2name
-rb_class_of
-rb_class_path
-rb_clear_cache
-rb_const_defined
-rb_const_defined_at
-rb_const_get
-rb_const_get_at
-rb_const_set
-rb_define_alias
-rb_define_attr
-rb_define_class
-rb_define_class_id
-rb_define_class_under
-rb_define_const
-rb_define_global_const
-rb_define_global_function
-rb_define_hooked_variable
-rb_define_method
-rb_define_method_id
-rb_define_module
-rb_define_module_function
-rb_define_module_id
-rb_define_module_under
-rb_define_private_method
-rb_define_readonly_variable
-rb_define_singleton_method
-rb_define_variable
-rb_define_virtual_variable
-rb_each
-rb_ensure
-rb_eql
-rb_equal
-rb_eval_cmd
-rb_eval_string
-rb_exit
-rb_extend_object
-rb_fatal
-rb_fdopen
-rb_fopen
-rb_frame_last_func
-rb_funcall
-rb_funcall2
-rb_get_kcode
-rb_global_entry
-rb_global_variable
-rb_gvar_defined
-rb_gvar_get
-rb_gvar_set
-rb_gvar_set2
-rb_hash
-rb_id2name
-rb_include_module
-rb_inspect
-rb_intern
-rb_interrupt
-rb_is_const_id
-rb_is_instance_id
-rb_iterate
-rb_iv_get
-rb_iv_set
-rb_ivar_defined
-rb_ivar_get
-rb_ivar_set
-rb_load_file
-rb_method_boundp
-rb_name_class
-rb_newobj
-rb_notimplement
-rb_path2class
-rb_proc_exec
-rb_provide
-rb_raise
-rb_rescue
-rb_respond_to
-rb_safe_level
-rb_scan_args
-rb_secure
-rb_set_class_path
-rb_set_kcode
-rb_set_safe_level
-rb_singleton_class
-rb_special_const_p
-rb_str_setter
-rb_sys_fail
-rb_syswait
-rb_test_false_or_nil
-rb_to_id
-rb_trap_eval
-rb_trap_exec
-rb_trap_exit
-rb_type
-rb_undef_method
-rb_yield
-rb_yield_0
-reg_free
-reg_last_match
-reg_match
-reg_match2
-reg_match_last
-reg_match_post
-reg_match_pre
-reg_new
-reg_nth_defined
-reg_nth_match
-reg_regcomp
-reg_regsub
-reg_search
-ruby_init
-ruby_options
-ruby_process_options
-ruby_prog_init
-ruby_run
-ruby_script
-ruby_set_argv
-scan_hex
-scan_oct
-show_copyright
-show_version
-singleton_class_clone
-singleton_class_new
-st_add_direct
-st_copy
-st_delete
-st_delete_safe
-st_find_or_add
-st_foreach
-st_free_table
-st_init_numtable
-st_init_strtable
-st_init_table
-st_init_table_with_size
-st_insert
-st_lookup
-str2inum
-str2cstr
-str_cat
-str_cicmp
-str_cmp
-str_dup
-str_freeze
-str_hash
-str_inspect
-str_modify
-str_new
-str_new2
-str_new3
-str_new4
-str_plus
-str_resize
-str_split
-str_substr
-str_taint
-str_tainted
-str_times
-str_upto
-struct_alloc
-struct_aref
-struct_aset
-struct_define
-struct_getmember
-struct_new
-thread_alone
-thread_create
-thread_fd_writable
-thread_interrupt
-thread_schedule
-thread_select
-thread_sleep
-thread_sleep_forever
-thread_wait_fd
-thread_wait_for
-time_new
-time_timeval
-uint2big
-uint2inum
-xcalloc
-xmalloc
-xrealloc
-eException
-eStandardError
-trap_immediate
diff --git a/bignum.c b/bignum.c
index c1f0692d6d..06228416bf 100644
--- a/bignum.c
+++ b/bignum.c
@@ -1,4 +1,4 @@
-/************************************************
+/**********************************************************************
bignum.c -
@@ -6,57 +6,73 @@
$Date$
created at: Fri Jun 10 00:48:55 JST 1994
-************************************************/
+ Copyright (C) 1993-2003 Yukihiro Matsumoto
+
+**********************************************************************/
#include "ruby.h"
+
#include <math.h>
#include <ctype.h>
+#ifdef HAVE_IEEEFP_H
+#include <ieeefp.h>
+#endif
+
+VALUE rb_cBignum;
-VALUE cBignum;
-typedef unsigned short USHORT;
+#if defined __MINGW32__
+#define USHORT _USHORT
+#endif
+
+#define BDIGITS(x) ((BDIGIT*)RBIGNUM(x)->digits)
+#define BITSPERDIG (SIZEOF_BDIGITS*CHAR_BIT)
+#define BIGRAD ((BDIGIT_DBL)1 << BITSPERDIG)
+#define DIGSPERLONG ((unsigned int)(SIZEOF_LONG/SIZEOF_BDIGITS))
+#if HAVE_LONG_LONG
+# define DIGSPERLL ((unsigned int)(SIZEOF_LONG_LONG/SIZEOF_BDIGITS))
+#endif
+#define BIGUP(x) ((BDIGIT_DBL)(x) << BITSPERDIG)
+#define BIGDN(x) RSHIFT(x,BITSPERDIG)
+#define BIGLO(x) ((BDIGIT)((x) & (BIGRAD-1)))
+#define BDIGMAX ((BDIGIT)-1)
-#define BDIGITS(x) RBIGNUM(x)->digits
-#define BITSPERDIG (sizeof(short)*CHAR_BIT)
-#define BIGRAD (1L << BITSPERDIG)
-#define DIGSPERINT ((unsigned int)(sizeof(long)/sizeof(short)))
-#define BIGUP(x) ((unsigned long)(x) << BITSPERDIG)
-#define BIGDN(x) (((x)<0) ? ~((~(x))>>BITSPERDIG) : (x)>>BITSPERDIG)
-#define BIGLO(x) ((x) & (BIGRAD-1))
+#define BIGZEROP(x) (RBIGNUM(x)->len == 0 || (RBIGNUM(x)->len == 1 && BDIGITS(x)[0] == 0))
static VALUE
bignew_1(klass, len, sign)
VALUE klass;
- unsigned int len;
+ long len;
char sign;
{
NEWOBJ(big, struct RBignum);
OBJSETUP(big, klass, T_BIGNUM);
big->sign = sign;
big->len = len;
- BDIGITS(big) = ALLOC_N(USHORT, len);
+ big->digits = ALLOC_N(BDIGIT, len);
return (VALUE)big;
}
-#define bignew(len,sign) bignew_1(cBignum,len,sign)
+#define bignew(len,sign) bignew_1(rb_cBignum,len,sign)
VALUE
-big_clone(x)
+rb_big_clone(x)
VALUE x;
{
VALUE z = bignew_1(CLASS_OF(x), RBIGNUM(x)->len, RBIGNUM(x)->sign);
- MEMCPY(BDIGITS(z), BDIGITS(x), USHORT, RBIGNUM(x)->len);
+ MEMCPY(BDIGITS(z), BDIGITS(x), BDIGIT, RBIGNUM(x)->len);
return z;
}
-void
-big_2comp(x) /* get 2's complement */
+static void
+get2comp(x, carry) /* get 2's complement */
VALUE x;
+ int carry;
{
- unsigned int i = RBIGNUM(x)->len;
- USHORT *ds = BDIGITS(x);
- long num;
+ long i = RBIGNUM(x)->len;
+ BDIGIT *ds = BDIGITS(x);
+ BDIGIT_DBL num;
while (i--) ds[i] = ~ds[i];
i = 0; num = 1;
@@ -65,72 +81,79 @@ big_2comp(x) /* get 2's complement */
ds[i++] = BIGLO(num);
num = BIGDN(num);
} while (i < RBIGNUM(x)->len);
- if (ds[0] == 1 || ds[0] == 0) {
- for (i=1;i<RBIGNUM(x)->len;i++) {
- if (ds[i] != 0) return;
- }
- REALLOC_N(BDIGITS(x), USHORT, RBIGNUM(x)->len++);
+ if (!carry) return;
+ if ((ds[RBIGNUM(x)->len-1] & (1<<(BITSPERDIG-1))) == 0) {
+ REALLOC_N(RBIGNUM(x)->digits, BDIGIT, ++RBIGNUM(x)->len);
ds = BDIGITS(x);
- ds[RBIGNUM(x)->len-1] = 1;
+ ds[RBIGNUM(x)->len-1] = ~0;
}
}
+void
+rb_big_2comp(x) /* get 2's complement */
+ VALUE x;
+{
+ get2comp(x, Qtrue);
+}
+
static VALUE
bignorm(x)
VALUE x;
{
- unsigned int len = RBIGNUM(x)->len;
- USHORT *ds = BDIGITS(x);
+ if (!FIXNUM_P(x)) {
+ long len = RBIGNUM(x)->len;
+ BDIGIT *ds = BDIGITS(x);
- while (len-- && !ds[len]) ;
- RBIGNUM(x)->len = ++len;
+ while (len-- && !ds[len]) ;
+ RBIGNUM(x)->len = ++len;
- if (len*sizeof(USHORT) <= sizeof(VALUE)) {
- long num = 0;
- while (len--) {
- num = BIGUP(num) + ds[len];
- }
- if (num >= 0) {
- if (RBIGNUM(x)->sign) {
- if (POSFIXABLE(num)) return INT2FIX(num);
+ if (len*SIZEOF_BDIGITS <= sizeof(VALUE)) {
+ long num = 0;
+ while (len--) {
+ num = BIGUP(num) + ds[len];
+ }
+ if (num >= 0) {
+ if (RBIGNUM(x)->sign) {
+ if (POSFIXABLE(num)) return LONG2FIX(num);
+ }
+ else if (NEGFIXABLE(-(long)num)) return LONG2FIX(-(long)num);
}
- else if (NEGFIXABLE(-num)) return INT2FIX(-num);
}
}
return x;
}
VALUE
-big_norm(x)
+rb_big_norm(x)
VALUE x;
{
- return bignorm(RBIGNUM(x));
+ return bignorm(x);
}
VALUE
-uint2big(n)
+rb_uint2big(n)
unsigned long n;
{
- unsigned int i = 0;
- USHORT *digits;
+ BDIGIT_DBL num = n;
+ long i = 0;
+ BDIGIT *digits;
VALUE big;
- i = 0;
- big = bignew(DIGSPERINT, 1);
+ big = bignew(DIGSPERLONG, 1);
digits = BDIGITS(big);
- while (i < DIGSPERINT) {
- digits[i++] = BIGLO(n);
- n = BIGDN(n);
+ while (i < DIGSPERLONG) {
+ digits[i++] = BIGLO(num);
+ num = BIGDN(num);
}
- i = DIGSPERINT;
- while (i-- && !digits[i]) ;
+ i = DIGSPERLONG;
+ while (--i && !digits[i]) ;
RBIGNUM(big)->len = i+1;
return big;
}
VALUE
-int2big(n)
+rb_int2big(n)
long n;
{
long neg = 0;
@@ -140,7 +163,7 @@ int2big(n)
n = -n;
neg = 1;
}
- big = uint2big(n);
+ big = rb_uint2big(n);
if (neg) {
RBIGNUM(big)->sign = 0;
}
@@ -148,114 +171,320 @@ int2big(n)
}
VALUE
-uint2inum(n)
+rb_uint2inum(n)
unsigned long n;
{
- if (POSFIXABLE(n)) return INT2FIX(n);
- return uint2big(n);
+ if (POSFIXABLE(n)) return LONG2FIX(n);
+ return rb_uint2big(n);
}
VALUE
-int2inum(n)
+rb_int2inum(n)
long n;
{
- if (FIXABLE(n)) return INT2FIX(n);
- return int2big(n);
+ if (FIXABLE(n)) return LONG2FIX(n);
+ return rb_int2big(n);
+}
+
+#ifdef HAVE_LONG_LONG
+
+void
+rb_quad_pack(buf, val)
+ char *buf;
+ VALUE val;
+{
+ LONG_LONG q;
+
+ val = rb_to_int(val);
+ if (FIXNUM_P(val)) {
+ q = FIX2LONG(val);
+ }
+ else {
+ long len = RBIGNUM(val)->len;
+ BDIGIT *ds;
+
+ if (len > SIZEOF_LONG_LONG/SIZEOF_BDIGITS)
+ rb_raise(rb_eRangeError, "bignum too big to convert into `quad int'");
+ ds = BDIGITS(val);
+ q = 0;
+ while (len--) {
+ q = BIGUP(q);
+ q += ds[len];
+ }
+ if (!RBIGNUM(val)->sign) q = -q;
+ }
+ memcpy(buf, (char*)&q, SIZEOF_LONG_LONG);
+}
+
+VALUE
+rb_quad_unpack(buf, sign)
+ const char *buf;
+ int sign;
+{
+ unsigned LONG_LONG q;
+ long neg = 0;
+ long i;
+ BDIGIT *digits;
+ VALUE big;
+
+ memcpy(&q, buf, SIZEOF_LONG_LONG);
+ if (sign) {
+ if (FIXABLE((LONG_LONG)q)) return LONG2FIX((LONG_LONG)q);
+ if ((LONG_LONG)q < 0) {
+ q = -(LONG_LONG)q;
+ neg = 1;
+ }
+ }
+ else {
+ if (POSFIXABLE(q)) return LONG2FIX(q);
+ }
+
+ i = 0;
+ big = bignew(DIGSPERLL, 1);
+ digits = BDIGITS(big);
+ while (i < DIGSPERLL) {
+ digits[i++] = BIGLO(q);
+ q = BIGDN(q);
+ }
+
+ i = DIGSPERLL;
+ while (i-- && !digits[i]) ;
+ RBIGNUM(big)->len = i+1;
+
+ if (neg) {
+ RBIGNUM(big)->sign = 0;
+ }
+ return bignorm(big);
+}
+
+#else
+
+#define QUAD_SIZE 8
+
+void
+rb_quad_pack(buf, val)
+ char *buf;
+ VALUE val;
+{
+ long len;
+
+ memset(buf, 0, QUAD_SIZE);
+ val = rb_to_int(val);
+ if (FIXNUM_P(val)) {
+ val = rb_int2big(FIX2LONG(val));
+ }
+ len = RBIGNUM(val)->len * SIZEOF_BDIGITS;
+ if (len > QUAD_SIZE) {
+ rb_raise(rb_eRangeError, "bignum too big to convert into `quad int'");
+ }
+ memcpy(buf, (char*)BDIGITS(val), len);
+ if (!RBIGNUM(val)->sign) {
+ len = QUAD_SIZE;
+ while (len--) {
+ *buf = ~*buf;
+ buf++;
+ }
+ }
+}
+
+#define BNEG(b) (RSHIFT(((BDIGIT*)b)[QUAD_SIZE/SIZEOF_BDIGITS-1],BITSPERDIG-1) != 0)
+
+VALUE
+rb_quad_unpack(buf, sign)
+ const char *buf;
+ int sign;
+{
+ VALUE big = bignew(QUAD_SIZE/SIZEOF_BDIGITS, 1);
+
+ memcpy((char*)BDIGITS(big), buf, QUAD_SIZE);
+ if (sign && BNEG(buf)) {
+ long len = QUAD_SIZE;
+ char *tmp = (char*)BDIGITS(big);
+
+ RBIGNUM(big)->sign = 0;
+ while (len--) {
+ *tmp = ~*tmp;
+ tmp++;
+ }
+ }
+
+ return bignorm(big);
}
+#endif
+
VALUE
-str2inum(str, base)
- char *str;
+rb_cstr_to_inum(str, base, badcheck)
+ const char *str;
int base;
+ int badcheck;
{
- char sign = 1, c;
- unsigned long num;
- unsigned int len, blen = 1, i;
+ const char *s = str;
+ char *end;
+ char sign = 1, nondigit = 0;
+ int c;
+ BDIGIT_DBL num;
+ long len, blen = 1;
+ long i;
VALUE z;
- USHORT *zds;
+ BDIGIT *zds;
- while (ISSPACE(*str)) str++;
+ if (!str) {
+ if (badcheck) goto bad;
+ return INT2FIX(0);
+ }
+ if (badcheck) {
+ while (ISSPACE(*str)) str++;
+ }
+ else {
+ while (ISSPACE(*str) || *str == '_') str++;
+ }
- if (*str == '+') {
+ if (str[0] == '+') {
str++;
}
- else if (*str == '-') {
+ else if (str[0] == '-') {
str++;
sign = 0;
}
- if (base == 0) {
- if (*str == '0') {
- str++;
- if (*str == 'x' || *str == 'X') {
- str++;
+ if (str[0] == '+' || str[0] == '-') {
+ if (badcheck) goto bad;
+ return INT2FIX(0);
+ }
+ if (base <= 0) {
+ if (str[0] == '0') {
+ switch (str[1]) {
+ case 'x': case 'X':
base = 16;
- }
- else {
+ break;
+ case 'b': case 'B':
+ base = 2;
+ break;
+ case 'o': case 'O':
+ base = 8;
+ break;
+ case 'd': case 'D':
+ base = 10;
+ break;
+ default:
base = 8;
}
- if (*str == '\0') return INT2FIX(0);
+ }
+ else if (base < -1) {
+ base = -base;
}
else {
base = 10;
}
}
- if (base == 8) {
- while (str[0] == '0') str++;
- len = 3*strlen(str)*sizeof(char);
- }
- else { /* base == 10 or 16 */
- if (base == 16 && str[0] == '0' && (str[1] == 'x'||str[1] == 'X')) {
+ switch (base) {
+ case 2:
+ len = 1;
+ if (str[0] == '0' && (str[1] == 'b'||str[1] == 'B')) {
str += 2;
}
- while (str[0] == '0') str++;
- len = 4*strlen(str)*sizeof(char);
+ break;
+ case 3:
+ len = 2;
+ break;
+ case 8:
+ if (str[0] == '0' && (str[1] == 'o'||str[1] == 'O')) {
+ str += 2;
+ }
+ case 4: case 5: case 6: case 7:
+ len = 3;
+ break;
+ case 10:
+ if (str[0] == '0' && (str[1] == 'd'||str[1] == 'D')) {
+ str += 2;
+ }
+ case 9: case 11: case 12: case 13: case 14: case 15:
+ len = 4;
+ break;
+ case 16:
+ len = 4;
+ if (str[0] == '0' && (str[1] == 'x'||str[1] == 'X')) {
+ str += 2;
+ }
+ break;
+ default:
+ if (base < 2 || 36 < base) {
+ rb_raise(rb_eArgError, "illegal radix %d", base);
+ }
+ if (base <= 32) {
+ len = 5;
+ }
+ else {
+ len = 6;
+ }
+ break;
+ }
+ if (*str == '0') { /* squeeze preceeding 0s */
+ while (*++str == '0');
+ --str;
}
+ len *= strlen(str)*sizeof(char);
if (len <= (sizeof(VALUE)*CHAR_BIT)) {
- unsigned int val = strtoul((char*)str, 0, base);
+ unsigned long val = strtoul((char*)str, &end, base);
+
+ if (*end == '_') goto bigparse;
+ if (badcheck) {
+ if (end == str) goto bad; /* no number */
+ while (*end && ISSPACE(*end)) end++;
+ if (*end) goto bad; /* trailing garbage */
+ }
if (POSFIXABLE(val)) {
- if (sign) return INT2FIX(val);
+ if (sign) return LONG2FIX(val);
else {
long result = -(long)val;
- return INT2FIX(result);
+ return LONG2FIX(result);
}
}
else {
- VALUE big = uint2big(val);
+ VALUE big = rb_uint2big(val);
RBIGNUM(big)->sign = sign;
- return big;
+ return bignorm(big);
}
}
+ bigparse:
len = (len/BITSPERDIG)+1;
+ if (badcheck && *str == '_') goto bad;
z = bignew(len, sign);
zds = BDIGITS(z);
for (i=len;i--;) zds[i]=0;
while (c = *str++) {
- switch (c) {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- c = c - '0';
- break;
- case 'a': case 'b': case 'c':
- case 'd': case 'e': case 'f':
- c = c - 'a' + 10;
- break;
- case 'A': case 'B': case 'C':
- case 'D': case 'E': case 'F':
- c = c - 'A' + 10;
+ if (c == '_') {
+ if (badcheck) {
+ if (nondigit) goto bad;
+ nondigit = c;
+ }
+ continue;
+ }
+ else if (!ISASCII(c)) {
break;
- default:
- c = base;
+ }
+ else if (isdigit(c)) {
+ c -= '0';
+ }
+ else if (islower(c)) {
+ c -= 'a' - 10;
+ }
+ else if (isupper(c)) {
+ c -= 'A' - 10;
+ }
+ else {
break;
}
if (c >= base) break;
+ nondigit = 0;
i = 0;
num = c;
for (;;) {
while (i<blen) {
- num += zds[i]*base;
+ num += (BDIGIT_DBL)zds[i]*base;
zds[i++] = BIGLO(num);
num = BIGDN(num);
}
@@ -266,67 +495,197 @@ str2inum(str, base)
break;
}
}
+ if (badcheck) {
+ str--;
+ if (s+1 < str && str[-1] == '_') goto bad;
+ while (*str && ISSPACE(*str)) str++;
+ if (*str) {
+ bad:
+ rb_invalid_str(s, "Integer");
+ }
+ }
+
return bignorm(z);
}
-static char hexmap[] = "0123456789abcdef";
VALUE
-big2str(x, base)
+rb_str_to_inum(str, base, badcheck)
+ VALUE str;
+ int base;
+ int badcheck;
+{
+ char *s;
+ long len;
+
+ StringValue(str);
+ if (badcheck) {
+ s = StringValueCStr(str);
+ }
+ else {
+ s = RSTRING(str)->ptr;
+ }
+ if (s) {
+ len = RSTRING(str)->len;
+ if (s[len]) { /* no sentinel somehow */
+ char *p = ALLOCA_N(char, len+1);
+
+ MEMCPY(p, s, char, len);
+ p[len] = '\0';
+ s = p;
+ }
+ }
+ return rb_cstr_to_inum(s, base, badcheck);
+}
+
+#if HAVE_LONG_LONG
+
+VALUE
+rb_ull2big(n)
+ unsigned LONG_LONG n;
+{
+ BDIGIT_DBL num = n;
+ long i = 0;
+ BDIGIT *digits;
+ VALUE big;
+
+ big = bignew(DIGSPERLL, 1);
+ digits = BDIGITS(big);
+ while (i < DIGSPERLL) {
+ digits[i++] = BIGLO(num);
+ num = BIGDN(num);
+ }
+
+ i = DIGSPERLL;
+ while (i-- && !digits[i]) ;
+ RBIGNUM(big)->len = i+1;
+ return big;
+}
+
+VALUE
+rb_ll2big(n)
+ LONG_LONG n;
+{
+ long neg = 0;
+ VALUE big;
+
+ if (n < 0) {
+ n = -n;
+ neg = 1;
+ }
+ big = rb_ull2big(n);
+ if (neg) {
+ RBIGNUM(big)->sign = 0;
+ }
+ return big;
+}
+
+VALUE
+rb_ull2inum(n)
+ unsigned LONG_LONG n;
+{
+ if (POSFIXABLE(n)) return LONG2FIX(n);
+ return rb_ull2big(n);
+}
+
+VALUE
+rb_ll2inum(n)
+ LONG_LONG n;
+{
+ if (FIXABLE(n)) return LONG2FIX(n);
+ return rb_ll2big(n);
+}
+
+#endif /* HAVE_LONG_LONG */
+
+VALUE
+rb_cstr2inum(str, base)
+ const char *str;
+ int base;
+{
+ return rb_cstr_to_inum(str, base, base==0);
+}
+
+VALUE
+rb_str2inum(str, base)
+ VALUE str;
+ int base;
+{
+ return rb_str_to_inum(str, base, base==0);
+}
+
+const char ruby_digitmap[] = "0123456789abcdefghijklmnopqrstuvwxyz";
+VALUE
+rb_big2str(x, base)
VALUE x;
int base;
{
- VALUE t;
- USHORT *ds;
- unsigned int i, j, hbase;
+ volatile VALUE t;
+ BDIGIT *ds;
+ long i, j, hbase;
VALUE ss;
char *s, c;
if (FIXNUM_P(x)) {
- return fix2str(x, base);
+ return rb_fix2str(x, base);
}
i = RBIGNUM(x)->len;
- if (i == 0) return str_new2("0");
- if (base == 10) {
- j = (sizeof(USHORT)/sizeof(char)*CHAR_BIT*i*241L)/800+2;
- hbase = 10000;
- }
- else if (base == 16) {
- j = (sizeof(USHORT)/sizeof(char)*CHAR_BIT*i)/4+2;
- hbase = 0x10000;
- }
- else if (base == 8) {
- j = (sizeof(USHORT)/sizeof(char)*CHAR_BIT*i)+2;
- hbase = 010000;
- }
- else if (base == 2) {
- j = (sizeof(USHORT)*CHAR_BIT*i)+2;
- hbase = 020;
- }
- else {
- j = 0;
- hbase = 0;
- Fail("bignum cannot treat base %d", base);
+ if (BIGZEROP(x)) {
+ return rb_str_new2("0");
+ }
+ j = SIZEOF_BDIGITS*CHAR_BIT*i;
+ switch (base) {
+ case 2: break;
+ case 3:
+ j = j * 647L / 1024;
+ break;
+ case 4: case 5: case 6: case 7:
+ j /= 2;
+ break;
+ case 8: case 9:
+ j /= 3;
+ break;
+ case 10: case 11: case 12: case 13: case 14: case 15:
+ j = j * 241L / 800;
+ break;
+ case 16: case 17: case 18: case 19: case 20: case 21:
+ case 22: case 23: case 24: case 25: case 26: case 27:
+ case 28: case 29: case 30: case 31:
+ j /= 4;
+ break;
+ case 32: case 33: case 34: case 35: case 36:
+ j /= 5;
+ break;
+ default:
+ rb_raise(rb_eArgError, "illegal radix %d", base);
+ break;
}
+ j += 2;
- t = big_clone(x);
+ hbase = base * base;
+#if SIZEOF_BDIGITS > 2
+ hbase *= hbase;
+#endif
+
+ t = rb_big_clone(x);
ds = BDIGITS(t);
- ss = str_new(0, j);
+ ss = rb_str_new(0, j);
s = RSTRING(ss)->ptr;
s[0] = RBIGNUM(x)->sign ? '+' : '-';
while (i && j) {
- int k = i;
- unsigned long num = 0;
+ long k = i;
+ BDIGIT_DBL num = 0;
+
while (k--) {
num = BIGUP(num) + ds[k];
- ds[k] = num / hbase;
+ ds[k] = (BDIGIT)(num / hbase);
num %= hbase;
}
if (ds[i-1] == 0) i--;
- k = 4;
+ k = SIZEOF_BDIGITS;
while (k--) {
- c = num % base;
- s[--j] = hexmap[(int)c];
+ c = (char)(num % base);
+ s[--j] = ruby_digitmap[(int)c];
num /= base;
if (i == 0 && num == 0) break;
}
@@ -339,23 +698,46 @@ big2str(x, base)
return ss;
}
+/*
+ * 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"
+ * 12345654321.to_s(16) #=> "2dfdbbc31"
+ * 78546939656932.to_s(36) #=> "rubyrules"
+ */
+
static VALUE
-big_to_s(x)
+rb_big_to_s(argc, argv, x)
+ int argc;
+ VALUE *argv;
VALUE x;
{
- return big2str(x, 10);
+ VALUE b;
+ int base;
+
+ rb_scan_args(argc, argv, "01", &b);
+ if (argc == 0) base = 10;
+ else base = NUM2INT(b);
+ return rb_big2str(x, base);
}
-unsigned long
-big2ulong(x)
+static unsigned long
+big2ulong(x, type)
VALUE x;
+ char *type;
{
- unsigned long num;
- unsigned int len = RBIGNUM(x)->len;
- USHORT *ds;
+ long len = RBIGNUM(x)->len;
+ BDIGIT_DBL num;
+ BDIGIT *ds;
- if (len > sizeof(long)/sizeof(USHORT))
- ArgError("bignum too big to convert into `uint'");
+ if (len > SIZEOF_LONG/SIZEOF_BDIGITS)
+ rb_raise(rb_eRangeError, "bignum too big to convert into `%s'", type);
ds = BDIGITS(x);
num = 0;
while (len--) {
@@ -365,37 +747,100 @@ big2ulong(x)
return num;
}
+unsigned long
+rb_big2ulong(x)
+ VALUE x;
+{
+ unsigned long num = big2ulong(x, "unsigned long");
+
+ if (!RBIGNUM(x)->sign) {
+ if ((long)num < 0) {
+ rb_raise(rb_eRangeError, "bignum out of range of unsigned long");
+ }
+ return -num;
+ }
+ return num;
+}
+
long
-big2long(x)
+rb_big2long(x)
+ VALUE x;
+{
+ unsigned long num = big2ulong(x, "long");
+
+ if ((long)num < 0 && (RBIGNUM(x)->sign || (long)num != LONG_MIN)) {
+ rb_raise(rb_eRangeError, "bignum too big to convert into `long'");
+ }
+ if (!RBIGNUM(x)->sign) return -(long)num;
+ return num;
+}
+
+#if HAVE_LONG_LONG
+
+static unsigned LONG_LONG
+big2ull(x, type)
VALUE x;
+ char *type;
{
- unsigned long num = big2ulong(x);
+ long len = RBIGNUM(x)->len;
+ BDIGIT_DBL num;
+ BDIGIT *ds;
- if ((long)num < 0) {
- ArgError("bignum too big to convert into `int'");
+ if (len > SIZEOF_LONG_LONG/SIZEOF_BDIGITS)
+ rb_raise(rb_eRangeError, "bignum too big to convert into `%s'", type);
+ ds = BDIGITS(x);
+ num = 0;
+ while (len--) {
+ num = BIGUP(num);
+ num += ds[len];
}
+ return num;
+}
+
+unsigned LONG_LONG
+rb_big2ull(x)
+ VALUE x;
+{
+ unsigned LONG_LONG num = big2ull(x, "unsigned long long");
+
if (!RBIGNUM(x)->sign) return -num;
return num;
}
-VALUE
-big_to_i(x)
+LONG_LONG
+rb_big2ll(x)
VALUE x;
{
- return bignorm(x);
+ unsigned LONG_LONG num = big2ull(x, "long long");
+
+ if ((LONG_LONG)num < 0 && (RBIGNUM(x)->sign
+ || (LONG_LONG)num != LLONG_MIN)) {
+ rb_raise(rb_eRangeError, "bignum too big to convert into `long long'");
+ }
+ if (!RBIGNUM(x)->sign) return -(LONG_LONG)num;
+ return num;
}
-VALUE
+#endif /* HAVE_LONG_LONG */
+
+static VALUE
dbl2big(d)
double d;
{
- unsigned int i = 0;
- long c;
- USHORT *digits;
+ long i = 0;
+ BDIGIT c;
+ BDIGIT *digits;
VALUE z;
double u = (d < 0)?-d:d;
- while (0 != (long)u) {
+ if (isinf(d)) {
+ rb_raise(rb_eFloatDomainError, d < 0 ? "-Infinity" : "Infinity");
+ }
+ if (isnan(d)) {
+ rb_raise(rb_eFloatDomainError, "NaN");
+ }
+
+ while (!POSFIXABLE(u) || 0 != (long)u) {
u /= (double)(BIGRAD);
i++;
}
@@ -403,52 +848,85 @@ dbl2big(d)
digits = BDIGITS(z);
while (i--) {
u *= BIGRAD;
- c = (long)u;
+ c = (BDIGIT)u;
u -= c;
digits[i] = c;
}
- return bignorm(z);
+ return z;
+}
+
+VALUE
+rb_dbl2big(d)
+ double d;
+{
+ return bignorm(dbl2big(d));
}
double
-big2dbl(x)
+rb_big2dbl(x)
VALUE x;
{
double d = 0.0;
- unsigned int i = RBIGNUM(x)->len;
- USHORT *ds = BDIGITS(x);
+ long i = RBIGNUM(x)->len;
+ BDIGIT *ds = BDIGITS(x);
while (i--) {
d = ds[i] + BIGRAD*d;
}
+ if (isinf(d)) {
+ rb_warn("Bignum out of Float range");
+ d = HUGE_VAL;
+ }
if (!RBIGNUM(x)->sign) d = -d;
return d;
}
-VALUE
-big_to_f(x)
+/*
+ * 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
+rb_big_to_f(x)
VALUE x;
{
- return float_new(big2dbl(x));
+ return rb_float_new(rb_big2dbl(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
-big_cmp(x, y)
+rb_big_cmp(x, y)
VALUE x, y;
{
- int xlen = RBIGNUM(x)->len;
+ long xlen = RBIGNUM(x)->len;
switch (TYPE(y)) {
case T_FIXNUM:
- y = int2big(FIX2LONG(y));
+ y = rb_int2big(FIX2LONG(y));
break;
case T_BIGNUM:
break;
+ case T_FLOAT:
+ return rb_dbl_cmp(rb_big2dbl(x), RFLOAT(y)->value);
+
default:
- return num_coerce_bin(x, y);
+ return rb_num_coerce_cmp(x, y);
}
if (RBIGNUM(x)->sign > RBIGNUM(y)->sign) return INT2FIX(1);
@@ -465,36 +943,108 @@ big_cmp(x, y)
(RBIGNUM(x)->sign ? INT2FIX(-1) : INT2FIX(1));
}
+/*
+ * 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
+ */
+
+static VALUE
+rb_big_eq(x, y)
+ VALUE x, y;
+{
+ switch (TYPE(y)) {
+ case T_FIXNUM:
+ y = rb_int2big(FIX2LONG(y));
+ break;
+ case T_BIGNUM:
+ break;
+ case T_FLOAT:
+ {
+ volatile double a, b;
+
+ a = RFLOAT(y)->value;
+ b = rb_big2dbl(x);
+ if (isnan(a) || isnan(b)) return Qfalse;
+ return (a == b)?Qtrue:Qfalse;
+ }
+ default:
+ return rb_equal(y, x);
+ }
+ if (RBIGNUM(x)->sign != RBIGNUM(y)->sign) return Qfalse;
+ if (RBIGNUM(x)->len != RBIGNUM(y)->len) return Qfalse;
+ if (MEMCMP(BDIGITS(x),BDIGITS(y),BDIGIT,RBIGNUM(y)->len) != 0) return Qfalse;
+ return Qtrue;
+}
+
+/*
+ * 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
+ */
+
static VALUE
-big_eq(x, y)
+rb_big_eql(x, y)
VALUE x, y;
{
- if (big_cmp(x, y) == INT2FIX(0)) return TRUE;
- return FALSE;
+ if (TYPE(y) != T_BIGNUM) return Qfalse;
+ if (RBIGNUM(x)->sign != RBIGNUM(y)->sign) return Qfalse;
+ if (RBIGNUM(x)->len != RBIGNUM(y)->len) return Qfalse;
+ if (MEMCMP(BDIGITS(x),BDIGITS(y),BDIGIT,RBIGNUM(y)->len) != 0) return Qfalse;
+ return Qtrue;
}
+/*
+ * call-seq:
+ * -big => other_big
+ *
+ * Unary minus (returns a new Bignum whose value is 0-big)
+ */
+
static VALUE
-big_uminus(x)
+rb_big_uminus(x)
VALUE x;
{
- VALUE z = big_clone(x);
+ VALUE z = rb_big_clone(x);
RBIGNUM(z)->sign = !RBIGNUM(x)->sign;
return bignorm(z);
}
+/*
+ * call-seq:
+ * ~big => integer
+ *
+ * Inverts the bits in big. As Bignums are conceptually infinite
+ * 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"
+ */
+
static VALUE
-big_neg(x)
+rb_big_neg(x)
VALUE x;
{
- VALUE z = big_clone(x);
- unsigned int i = RBIGNUM(x)->len;
- USHORT *ds = BDIGITS(z);
+ VALUE z = rb_big_clone(x);
+ long i = RBIGNUM(x)->len;
+ BDIGIT *ds = BDIGITS(z);
- if (!RBIGNUM(x)->sign) big_2comp(z);
+ if (!RBIGNUM(x)->sign) get2comp(z, Qtrue);
while (i--) ds[i] = ~ds[i];
- if (RBIGNUM(x)->sign) big_2comp(z);
+ if (RBIGNUM(x)->sign) get2comp(z, Qfalse);
RBIGNUM(z)->sign = !RBIGNUM(z)->sign;
return bignorm(z);
@@ -505,11 +1055,10 @@ bigsub(x, y)
VALUE x, y;
{
VALUE z = 0;
- USHORT *zds;
- long num;
- unsigned int i;
-
- i = RBIGNUM(x)->len;
+ 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 */
@@ -531,7 +1080,7 @@ bigsub(x, y)
zds = BDIGITS(z);
for (i = 0, num = 0; i < RBIGNUM(y)->len; i++) {
- num += (long)BDIGITS(x)[i] - BDIGITS(y)[i];
+ num += (BDIGIT_DBL_SIGNED)BDIGITS(x)[i] - BDIGITS(y)[i];
zds[i] = BIGLO(num);
num = BIGDN(num);
}
@@ -545,7 +1094,7 @@ bigsub(x, y)
i++;
}
- return bignorm(z);
+ return z;
}
static VALUE
@@ -554,8 +1103,8 @@ bigadd(x, y, sign)
char sign;
{
VALUE z;
- long num;
- unsigned int i, len;
+ BDIGIT_DBL num;
+ long i, len;
sign = (sign == RBIGNUM(y)->sign);
if (RBIGNUM(x)->sign != sign) {
@@ -574,7 +1123,7 @@ bigadd(x, y, sign)
len = RBIGNUM(x)->len;
for (i = 0, num = 0; i < len; i++) {
- num += BDIGITS(x)[i] + BDIGITS(y)[i];
+ num += (BDIGIT_DBL)BDIGITS(x)[i] + BDIGITS(y)[i];
BDIGITS(z)[i] = BIGLO(num);
num = BIGDN(num);
}
@@ -588,72 +1137,93 @@ bigadd(x, y, sign)
BDIGITS(z)[i] = BDIGITS(y)[i];
i++;
}
- BDIGITS(z)[i] = num;
+ BDIGITS(z)[i] = (BDIGIT)num;
- return bignorm(z);
+ return z;
}
+/*
+ * call-seq:
+ * big + other => Numeric
+ *
+ * Adds big and other, returning the result.
+ */
+
VALUE
-big_plus(x, y)
+rb_big_plus(x, y)
VALUE x, y;
{
switch (TYPE(y)) {
case T_FIXNUM:
- y = int2big(FIX2LONG(y));
+ y = rb_int2big(FIX2LONG(y));
/* fall through */
case T_BIGNUM:
- return bigadd(x, y, 1);
+ return bignorm(bigadd(x, y, 1));
case T_FLOAT:
- return float_new(big2dbl(x) + RFLOAT(y)->value);
+ return rb_float_new(rb_big2dbl(x) + RFLOAT(y)->value);
default:
- return num_coerce_bin(x, y);
+ return rb_num_coerce_bin(x, y);
}
}
+/*
+ * call-seq:
+ * big - other => Numeric
+ *
+ * Subtracts other from big, returning the result.
+ */
+
VALUE
-big_minus(x, y)
+rb_big_minus(x, y)
VALUE x, y;
{
switch (TYPE(y)) {
case T_FIXNUM:
- y = int2big(FIX2LONG(y));
+ y = rb_int2big(FIX2LONG(y));
/* fall through */
case T_BIGNUM:
- return bigadd(x, y, 0);
+ return bignorm(bigadd(x, y, 0));
case T_FLOAT:
- return float_new(big2dbl(x) - RFLOAT(y)->value);
+ return rb_float_new(rb_big2dbl(x) - RFLOAT(y)->value);
default:
- return num_coerce_bin(x, y);
+ return rb_num_coerce_bin(x, y);
}
}
+/*
+ * call-seq:
+ * big * other => Numeric
+ *
+ * Multiplies big and other, returning the result.
+ */
+
VALUE
-big_mul(x, y)
+rb_big_mul(x, y)
VALUE x, y;
{
- unsigned int i = 0, j;
- unsigned long n = 0;
+ long i, j;
+ BDIGIT_DBL n = 0;
VALUE z;
- USHORT *zds;
+ BDIGIT *zds;
- if (FIXNUM_P(x)) x = int2big(FIX2LONG(x));
+ if (FIXNUM_P(x)) x = rb_int2big(FIX2LONG(x));
switch (TYPE(y)) {
case T_FIXNUM:
- y = int2big(FIX2LONG(y));
+ y = rb_int2big(FIX2LONG(y));
break;
case T_BIGNUM:
break;
case T_FLOAT:
- return float_new(big2dbl(x) * RFLOAT(y)->value);
+ return rb_float_new(rb_big2dbl(x) * RFLOAT(y)->value);
default:
- return num_coerce_bin(x, y);
+ return rb_num_coerce_bin(x, y);
}
j = RBIGNUM(x)->len + RBIGNUM(y)->len + 1;
@@ -661,11 +1231,11 @@ big_mul(x, y)
zds = BDIGITS(z);
while (j--) zds[j] = 0;
for (i = 0; i < RBIGNUM(x)->len; i++) {
- unsigned long dd = BDIGITS(x)[i];
+ BDIGIT_DBL dd = BDIGITS(x)[i];
if (dd == 0) continue;
n = 0;
for (j = 0; j < RBIGNUM(y)->len; j++) {
- int ee = n + dd * BDIGITS(y)[j];
+ BDIGIT_DBL ee = n + (BDIGIT_DBL)dd * BDIGITS(y)[j];
n = zds[i + j] + ee;
if (ee) zds[i + j] = BIGLO(n);
n = BIGDN(n);
@@ -679,93 +1249,102 @@ big_mul(x, y)
}
static void
-bigdivmod(x, y, div, mod, modulo)
+bigdivrem(x, y, divp, modp)
VALUE x, y;
- VALUE *div, *mod;
- int modulo;
+ VALUE *divp, *modp;
{
- unsigned int nx = RBIGNUM(x)->len, ny = RBIGNUM(y)->len, i, j;
+ long nx = RBIGNUM(x)->len, ny = RBIGNUM(y)->len;
+ long i, j;
VALUE yy, z;
- USHORT *xds, *yds, *zds, *tds;
- unsigned long t2;
- long num;
- USHORT dd, q;
+ BDIGIT *xds, *yds, *zds, *tds;
+ BDIGIT_DBL t2;
+ BDIGIT_DBL_SIGNED num;
+ BDIGIT dd, q;
+ if (BIGZEROP(y)) rb_num_zerodiv();
yds = BDIGITS(y);
- if (ny == 0 && yds[0] == 0) num_zerodiv();
- if (nx < ny || nx == ny && BDIGITS(x)[nx - 1] < BDIGITS(y)[ny - 1]) {
- if (div) *div = INT2FIX(0);
- if (mod) *mod = bignorm(x);
+ if (nx < ny || (nx == ny && BDIGITS(x)[nx - 1] < BDIGITS(y)[ny - 1])) {
+ if (divp) *divp = rb_int2big(0);
+ if (modp) *modp = x;
return;
}
xds = BDIGITS(x);
if (ny == 1) {
dd = yds[0];
- z = big_clone(x);
+ z = rb_big_clone(x);
zds = BDIGITS(z);
t2 = 0; i = nx;
while (i--) {
t2 = BIGUP(t2) + zds[i];
- zds[i] = t2 / dd;
+ zds[i] = (BDIGIT)(t2 / dd);
t2 %= dd;
}
- if (div) *div = bignorm(z);
- if (mod) {
- if (!RBIGNUM(y)->sign) t2 = -t2;
- *mod = INT2FIX(t2);
+ RBIGNUM(z)->sign = RBIGNUM(x)->sign==RBIGNUM(y)->sign;
+ if (modp) {
+ *modp = rb_uint2big((unsigned long)t2);
+ RBIGNUM(*modp)->sign = RBIGNUM(x)->sign;
}
+ if (divp) *divp = z;
return;
}
z = bignew(nx==ny?nx+2:nx+1, RBIGNUM(x)->sign==RBIGNUM(y)->sign);
zds = BDIGITS(z);
if (nx==ny) zds[nx+1] = 0;
while (!yds[ny-1]) ny--;
- if ((dd = BIGRAD/(int)(yds[ny-1]+1)) != 1) {
- yy = big_clone(y);
+
+ dd = 0;
+ q = yds[ny-1];
+ while ((q & (1<<(BITSPERDIG-1))) == 0) {
+ q <<= 1;
+ dd++;
+ }
+ if (dd) {
+ yy = rb_big_clone(y);
tds = BDIGITS(yy);
j = 0;
- num = 0;
+ t2 = 0;
while (j<ny) {
- num += (long)yds[j]*dd;
- tds[j++] = BIGLO(num);
- num = BIGDN(num);
+ t2 += (BDIGIT_DBL)yds[j]<<dd;
+ tds[j++] = BIGLO(t2);
+ t2 = BIGDN(t2);
}
yds = tds;
j = 0;
- num = 0;
+ t2 = 0;
while (j<nx) {
- num += (long)xds[j]*dd;
- zds[j++] = BIGLO(num);
- num = BIGDN(num);
+ t2 += (BDIGIT_DBL)xds[j]<<dd;
+ zds[j++] = BIGLO(t2);
+ t2 = BIGDN(t2);
}
- zds[j] = num;
+ zds[j] = (BDIGIT)t2;
}
else {
zds[nx] = 0;
j = nx;
while (j--) zds[j] = xds[j];
}
+
j = nx==ny?nx+1:nx;
do {
if (zds[j] == yds[ny-1]) q = BIGRAD-1;
- else q = (BIGUP(zds[j]) + zds[j-1])/yds[ny-1];
+ else q = (BDIGIT)((BIGUP(zds[j]) + zds[j-1])/yds[ny-1]);
if (q) {
i = 0; num = 0; t2 = 0;
do { /* multiply and subtract */
- int ee;
- t2 += (long)yds[i] * q;
+ BDIGIT_DBL ee;
+ t2 += (BDIGIT_DBL)yds[i] * q;
ee = num - BIGLO(t2);
- num = zds[j - ny + i] + ee;
+ num = (BDIGIT_DBL)zds[j - ny + i] + ee;
if (ee) zds[j - ny + i] = BIGLO(num);
num = BIGDN(num);
t2 = BIGDN(t2);
} while (++i < ny);
- num += zds[j - ny + i] - t2; /* borrow from high digit; don't update */
+ num += zds[j - ny + i] - t2;/* borrow from high digit; don't update */
while (num) { /* "add back" required */
i = 0; num = 0; q--;
do {
- int ee = num + yds[i];
- num = (long) zds[j - ny + i] + ee;
+ BDIGIT_DBL ee = num + yds[i];
+ num = (BDIGIT_DBL)zds[j - ny + i] + ee;
if (ee) zds[j - ny + i] = BIGLO(num);
num = BIGDN(num);
} while (++i < ny);
@@ -774,135 +1353,226 @@ bigdivmod(x, y, div, mod, modulo)
}
zds[j] = q;
} while (--j >= ny);
- if (div) { /* move quotient down in z */
- *div = big_clone(z);
- zds = BDIGITS(*div);
+ if (divp) { /* move quotient down in z */
+ *divp = rb_big_clone(z);
+ zds = BDIGITS(*divp);
j = (nx==ny ? nx+2 : nx+1) - ny;
for (i = 0;i < j;i++) zds[i] = zds[i+ny];
- RBIGNUM(*div)->len = i;
- *div = bignorm(*div);
+ RBIGNUM(*divp)->len = i;
}
- if (mod) { /* just normalize remainder */
- *mod = big_clone(z);
+ if (modp) { /* normalize remainder */
+ *modp = rb_big_clone(z);
+ zds = BDIGITS(*modp);
+ while (--ny && !zds[ny]); ++ny;
if (dd) {
- zds = BDIGITS(*mod);
t2 = 0; i = ny;
while(i--) {
- t2 = BIGUP(t2) + zds[i];
- zds[i] = t2 / dd;
- t2 %= dd;
+ t2 = (t2 | zds[i]) >> dd;
+ q = zds[i];
+ zds[i] = BIGLO(t2);
+ t2 = BIGUP(q);
}
}
- RBIGNUM(*mod)->len = ny;
- RBIGNUM(*mod)->sign = RBIGNUM(x)->sign;
- if (modulo && RBIGNUM(x)->sign != RBIGNUM(y)->sign) {
- int len = ny;
- zds = BDIGITS(*mod);
- while (len-- && !zds[len]);
- if (len > 0) {
- *mod = bigadd(*mod, y, 1);
- return;
- }
- }
- *mod = bignorm(*mod);
+ RBIGNUM(*modp)->len = ny;
+ RBIGNUM(*modp)->sign = RBIGNUM(x)->sign;
}
}
+static void
+bigdivmod(x, y, divp, modp)
+ VALUE x, y;
+ VALUE *divp, *modp;
+{
+ VALUE mod;
+
+ bigdivrem(x, y, divp, &mod);
+ if (RBIGNUM(x)->sign != RBIGNUM(y)->sign && !BIGZEROP(mod)) {
+ if (divp) *divp = bigadd(*divp, rb_int2big(1), 0);
+ if (modp) *modp = bigadd(mod, y, 1);
+ }
+ else {
+ if (divp) *divp = *divp;
+ if (modp) *modp = mod;
+ }
+}
+
+/*
+ * call-seq:
+ * big / other => Numeric
+ * big.div(other) => Numeric
+ *
+ * Divides big by other, returning the result.
+ */
+
static VALUE
-big_div(x, y)
+rb_big_div(x, y)
VALUE x, y;
{
VALUE z;
switch (TYPE(y)) {
case T_FIXNUM:
- y = int2big(FIX2LONG(y));
+ y = rb_int2big(FIX2LONG(y));
break;
case T_BIGNUM:
break;
case T_FLOAT:
- return float_new(big2dbl(x) / RFLOAT(y)->value);
+ return rb_float_new(rb_big2dbl(x) / RFLOAT(y)->value);
default:
- return num_coerce_bin(x, y);
+ return rb_num_coerce_bin(x, y);
}
- bigdivmod(x, y, &z, 0, 0);
+ bigdivmod(x, y, &z, 0);
- return z;
+ return bignorm(z);
}
+/*
+ * call-seq:
+ * big % other => Numeric
+ * big.modulo(other) => Numeric
+ *
+ * Returns big modulo other. See Numeric.divmod for more
+ * information.
+ */
static VALUE
-big_modulo(x, y, modulo)
+rb_big_modulo(x, y)
VALUE x, y;
- int modulo;
{
VALUE z;
switch (TYPE(y)) {
case T_FIXNUM:
- y = int2big(FIX2LONG(y));
+ y = rb_int2big(FIX2LONG(y));
break;
case T_BIGNUM:
break;
- case T_FLOAT:
- y = dbl2big(RFLOAT(y)->value);
- break;
-
default:
- return num_coerce_bin(x, y);
+ return rb_num_coerce_bin(x, y);
}
- bigdivmod(x, y, 0, &z, modulo);
+ bigdivmod(x, y, 0, &z);
- return z;
+ return bignorm(z);
}
+/*
+ * 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
+ */
static VALUE
-big_mod(x, y)
+rb_big_remainder(x, y)
VALUE x, y;
{
- return big_modulo(x, y, 1);
+ VALUE z;
+
+ switch (TYPE(y)) {
+ case T_FIXNUM:
+ y = rb_int2big(FIX2LONG(y));
+ break;
+
+ case T_BIGNUM:
+ break;
+
+ default:
+ return rb_num_coerce_bin(x, y);
+ }
+ bigdivrem(x, y, 0, &z);
+
+ return bignorm(z);
}
-static VALUE
-big_remainder(x, y)
+/*
+ * call-seq:
+ * big.divmod(numeric) => array
+ *
+ * See <code>Numeric#divmod</code>.
+ *
+ */
+VALUE
+rb_big_divmod(x, y)
VALUE x, y;
{
- return big_modulo(x, y, 0);
+ VALUE div, mod;
+
+ switch (TYPE(y)) {
+ case T_FIXNUM:
+ y = rb_int2big(FIX2LONG(y));
+ break;
+
+ case T_BIGNUM:
+ break;
+
+ default:
+ return rb_num_coerce_bin(x, y);
+ }
+ bigdivmod(x, y, &div, &mod);
+
+ return rb_assoc_new(bignorm(div), bignorm(mod));
}
+/*
+ * call-seq:
+ * big.quo(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
-big_divmod(x, y)
+rb_big_quo(x, y)
VALUE x, y;
{
- VALUE div, mod;
+ double dx = rb_big2dbl(x);
+ double dy;
switch (TYPE(y)) {
case T_FIXNUM:
- y = int2big(FIX2LONG(y));
+ dy = (double)FIX2LONG(y);
break;
- case T_FLOAT:
- y = dbl2big(RFLOAT(y)->value);
+ case T_BIGNUM:
+ dy = rb_big2dbl(y);
break;
- case T_BIGNUM:
+ case T_FLOAT:
+ dy = RFLOAT(y)->value;
break;
default:
- return num_coerce_bin(x, y);
+ return rb_num_coerce_bin(x, y);
}
- bigdivmod(x, y, &div, &mod, 1);
-
- return assoc_new(div, mod);;
+ return rb_float_new(dx / dy);
}
+/*
+ * call-seq:
+ * big ** exponent #=> numeric
+ *
+ * Raises _big_ to the _exponent_ power (which may be an integer, float,
+ * or anything that will coerce to a number). The result may be
+ * a Fixnum, Bignum, or Float
+ *
+ * 123456789 ** 2 #=> 15241578750190521
+ * 123456789 ** 1.2 #=> 5126464716.09932
+ * 123456789 ** -2 #=> 6.5610001194102e-17
+ */
+
VALUE
-big_pow(x, y)
+rb_big_pow(x, y)
VALUE x, y;
{
double d;
@@ -915,59 +1585,63 @@ big_pow(x, y)
break;
case T_BIGNUM:
- Warn("in a**b, b may be too big");
- d = big2dbl(y);
+ rb_warn("in a**b, b may be too big");
+ d = rb_big2dbl(y);
break;
case T_FIXNUM:
- yy = NUM2LONG(y);
+ yy = FIX2LONG(y);
if (yy > 0) {
- VALUE z;
+ VALUE z = x;
- z = x;
for (;;) {
- yy = yy - 1;
+ yy -= 1;
if (yy == 0) break;
while (yy % 2 == 0) {
- yy = yy / 2;
- x = big_mul(x, x);
+ yy /= 2;
+ x = rb_big_mul(x, x);
}
- z = big_mul(z, x);
+ z = rb_big_mul(z, x);
}
- return z;
+ return bignorm(z);
}
d = (double)yy;
break;
default:
- return num_coerce_bin(x, y);
+ return rb_num_coerce_bin(x, y);
}
- return float_new(pow(big2dbl(x), d));
+ return rb_float_new(pow(rb_big2dbl(x), d));
}
+/*
+ * call-seq:
+ * big & numeric => integer
+ *
+ * Performs bitwise +and+ between _big_ and _numeric_.
+ */
+
VALUE
-big_and(x, y)
- VALUE x, y;
+rb_big_and(xx, yy)
+ VALUE xx, yy;
{
- VALUE z;
- USHORT *ds1, *ds2, *zds;
- unsigned int i, l1, l2;
+ volatile VALUE x, y, z;
+ BDIGIT *ds1, *ds2, *zds;
+ long i, l1, l2;
char sign;
+ x = xx;
+ y = rb_to_int(yy);
if (FIXNUM_P(y)) {
- y = int2big(FIX2LONG(y));
+ y = rb_int2big(FIX2LONG(y));
}
- else {
- Check_Type(y, T_BIGNUM);
- }
-
if (!RBIGNUM(y)->sign) {
- y = big_clone(y);
- big_2comp(y);
+ y = rb_big_clone(y);
+ get2comp(y, Qtrue);
}
if (!RBIGNUM(x)->sign) {
- x = big_clone(x);
- big_2comp(x);
+ x = rb_big_clone(x);
+ get2comp(x, Qtrue);
}
if (RBIGNUM(x)->len > RBIGNUM(y)->len) {
l1 = RBIGNUM(y)->len;
@@ -983,7 +1657,7 @@ big_and(x, y)
ds2 = BDIGITS(y);
sign = RBIGNUM(x)->sign;
}
- z = bignew(l2, RBIGNUM(x)->sign && RBIGNUM(y)->sign);
+ z = bignew(l2, RBIGNUM(x)->sign || RBIGNUM(y)->sign);
zds = BDIGITS(z);
for (i=0; i<l1; i++) {
@@ -992,33 +1666,39 @@ big_and(x, y)
for (; i<l2; i++) {
zds[i] = sign?0:ds2[i];
}
- if (!RBIGNUM(z)->sign) big_2comp(z);
+ if (!RBIGNUM(z)->sign) get2comp(z, Qfalse);
return bignorm(z);
}
+/*
+ * call-seq:
+ * big | numeric => integer
+ *
+ * Performs bitwise +or+ between _big_ and _numeric_.
+ */
+
VALUE
-big_or(x, y)
- VALUE x, y;
+rb_big_or(xx, yy)
+ VALUE xx, yy;
{
- VALUE z;
- USHORT *ds1, *ds2, *zds;
- unsigned int i, l1, l2;
+ volatile VALUE x, y, z;
+ BDIGIT *ds1, *ds2, *zds;
+ long i, l1, l2;
char sign;
+ x = xx;
+ y = rb_to_int(yy);
if (FIXNUM_P(y)) {
- y = int2big(FIX2LONG(y));
- }
- else {
- Check_Type(y, T_BIGNUM);
+ y = rb_int2big(FIX2LONG(y));
}
if (!RBIGNUM(y)->sign) {
- y = big_clone(y);
- big_2comp(y);
+ y = rb_big_clone(y);
+ get2comp(y, Qtrue);
}
if (!RBIGNUM(x)->sign) {
- x = big_clone(x);
- big_2comp(x);
+ x = rb_big_clone(x);
+ get2comp(x, Qtrue);
}
if (RBIGNUM(x)->len > RBIGNUM(y)->len) {
l1 = RBIGNUM(y)->len;
@@ -1034,7 +1714,7 @@ big_or(x, y)
ds2 = BDIGITS(y);
sign = RBIGNUM(x)->sign;
}
- z = bignew(l2, RBIGNUM(x)->sign || RBIGNUM(y)->sign);
+ z = bignew(l2, RBIGNUM(x)->sign && RBIGNUM(y)->sign);
zds = BDIGITS(z);
for (i=0; i<l1; i++) {
@@ -1043,34 +1723,41 @@ big_or(x, y)
for (; i<l2; i++) {
zds[i] = sign?ds2[i]:(BIGRAD-1);
}
- if (!RBIGNUM(z)->sign) big_2comp(z);
+ if (!RBIGNUM(z)->sign) get2comp(z, Qfalse);
return bignorm(z);
}
+/*
+ * call-seq:
+ * big ^ numeric => integer
+ *
+ * Performs bitwise +exclusive or+ between _big_ and _numeric_.
+ */
+
VALUE
-big_xor(x, y)
- VALUE x, y;
+rb_big_xor(xx, yy)
+ VALUE xx, yy;
{
+ volatile VALUE x, y;
VALUE z;
- USHORT *ds1, *ds2, *zds;
- unsigned int i, l1, l2;
+ BDIGIT *ds1, *ds2, *zds;
+ long i, l1, l2;
char sign;
+ x = xx;
+ y = rb_to_int(yy);
if (FIXNUM_P(y)) {
- y = int2big(FIX2LONG(y));
- }
- else {
- Check_Type(y, T_BIGNUM);
+ y = rb_int2big(FIX2LONG(y));
}
if (!RBIGNUM(y)->sign) {
- y = big_clone(y);
- big_2comp(y);
+ y = rb_big_clone(y);
+ get2comp(y, Qtrue);
}
if (!RBIGNUM(x)->sign) {
- x = big_clone(x);
- big_2comp(x);
+ x = rb_big_clone(x);
+ get2comp(x, Qtrue);
}
if (RBIGNUM(x)->len > RBIGNUM(y)->len) {
l1 = RBIGNUM(y)->len;
@@ -1097,35 +1784,42 @@ big_xor(x, y)
for (; i<l2; i++) {
zds[i] = sign?ds2[i]:~ds2[i];
}
- if (!RBIGNUM(z)->sign) big_2comp(z);
+ if (!RBIGNUM(z)->sign) get2comp(z, Qfalse);
return bignorm(z);
}
-static VALUE big_rshift _((VALUE,VALUE));
+static VALUE rb_big_rshift _((VALUE,VALUE));
+
+/*
+ * call-seq:
+ * big << numeric => integer
+ *
+ * Shifts big left _numeric_ positions (right if _numeric_ is negative).
+ */
VALUE
-big_lshift(x, y)
+rb_big_lshift(x, y)
VALUE x, y;
{
- USHORT *xds, *zds;
+ BDIGIT *xds, *zds;
int shift = NUM2INT(y);
- unsigned int s1 = shift/BITSPERDIG;
- unsigned int s2 = shift%BITSPERDIG;
+ int s1 = shift/BITSPERDIG;
+ int s2 = shift%BITSPERDIG;
VALUE z;
- unsigned long num = 0;
- unsigned int len, i;
+ BDIGIT_DBL num = 0;
+ long len, i;
- if (shift < 0) return big_rshift(x, INT2FIX(-shift));
- xds = BDIGITS(x);
+ if (shift < 0) return rb_big_rshift(x, INT2FIX(-shift));
len = RBIGNUM(x)->len;
z = bignew(len+s1+1, RBIGNUM(x)->sign);
zds = BDIGITS(z);
for (i=0; i<s1; i++) {
*zds++ = 0;
}
+ xds = BDIGITS(x);
for (i=0; i<len; i++) {
- num = num | *xds++<<s2;
+ num = num | (BDIGIT_DBL)*xds++<<s2;
*zds++ = BIGLO(num);
num = BIGDN(num);
}
@@ -1133,54 +1827,96 @@ big_lshift(x, y)
return bignorm(z);
}
+/*
+ * call-seq:
+ * big >> numeric => integer
+ *
+ * Shifts big right _numeric_ positions (left if _numeric_ is negative).
+ */
+
static VALUE
-big_rshift(x, y)
+rb_big_rshift(x, y)
VALUE x, y;
{
- USHORT *xds, *zds;
+ BDIGIT *xds, *zds;
int shift = NUM2INT(y);
- unsigned int s1 = shift/BITSPERDIG;
- unsigned int s2 = shift%BITSPERDIG;
+ long s1 = shift/BITSPERDIG;
+ long s2 = shift%BITSPERDIG;
VALUE z;
- unsigned long num = 0;
- unsigned int i = RBIGNUM(x)->len;
- unsigned int j;
+ BDIGIT_DBL num = 0;
+ long i, j;
+
+ if (shift < 0) return rb_big_lshift(x, INT2FIX(-shift));
- if (shift < 0) return big_lshift(x, INT2FIX(-shift));
if (s1 > RBIGNUM(x)->len) {
if (RBIGNUM(x)->sign)
return INT2FIX(0);
else
return INT2FIX(-1);
}
+ if (!RBIGNUM(x)->sign) {
+ x = rb_big_clone(x);
+ get2comp(x, Qtrue);
+ }
xds = BDIGITS(x);
i = RBIGNUM(x)->len; j = i - s1;
z = bignew(j, RBIGNUM(x)->sign);
+ if (!RBIGNUM(x)->sign) {
+ num = ((BDIGIT_DBL)~0) << BITSPERDIG;
+ }
zds = BDIGITS(z);
while (i--, j--) {
num = (num | xds[i]) >> s2;
zds[j] = BIGLO(num);
num = BIGUP(xds[i]);
}
+ if (!RBIGNUM(x)->sign) {
+ get2comp(z, Qfalse);
+ }
return bignorm(z);
}
+/*
+ * 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
-big_aref(x, y)
+rb_big_aref(x, y)
VALUE x, y;
{
- USHORT *xds;
- int shift = NUM2INT(y);
- unsigned int s1, s2;
+ BDIGIT *xds;
+ int shift;
+ long s1, s2;
+ if (TYPE(y) == T_BIGNUM) {
+ if (!RBIGNUM(y)->sign || RBIGNUM(x)->sign)
+ return INT2FIX(0);
+ return INT2FIX(1);
+ }
+ shift = NUM2INT(y);
if (shift < 0) return INT2FIX(0);
s1 = shift/BITSPERDIG;
s2 = shift%BITSPERDIG;
if (!RBIGNUM(x)->sign) {
if (s1 >= RBIGNUM(x)->len) return INT2FIX(1);
- x = big_clone(x);
- big_2comp(x);
+ x = rb_big_clone(x);
+ get2comp(x, Qtrue);
}
else {
if (s1 >= RBIGNUM(x)->len) return INT2FIX(0);
@@ -1191,115 +1927,154 @@ big_aref(x, y)
return INT2FIX(0);
}
+/*
+ * call-seq:
+ * big.hash => fixnum
+ *
+ * Compute a hash based on the value of _big_.
+ */
+
static VALUE
-big_hash(x)
+rb_big_hash(x)
VALUE x;
{
- int i, len, key;
- USHORT *digits;
+ long i, len, key;
+ BDIGIT *digits;
- key = 0; digits = BDIGITS(x);
- for (i=0,len=RBIGNUM(x)->len; i<RBIGNUM(x)->len; i++) {
+ key = 0; digits = BDIGITS(x); len = RBIGNUM(x)->len;
+ for (i=0; i<len; i++) {
key ^= *digits++;
}
- return INT2FIX(key);
+ return LONG2FIX(key);
}
+/*
+ * MISSING: documentation
+ */
+
static VALUE
-big_coerce(x, y)
+rb_big_coerce(x, y)
VALUE x, y;
{
if (FIXNUM_P(y)) {
- return assoc_new(int2big(FIX2LONG(y)), x);
+ return rb_assoc_new(rb_int2big(FIX2LONG(y)), x);
}
else {
- TypeError("can't coerce %s to Bignum", rb_class2name(CLASS_OF(y)));
+ rb_raise(rb_eTypeError, "Can't coerce %s to Bignum",
+ rb_obj_classname(y));
}
/* not reached */
+ return Qnil;
}
+/*
+ * call-seq:
+ * big.abs -> aBignum
+ *
+ * Returns the absolute value of <i>big</i>.
+ *
+ * -1234567890987654321.abs #=> 1234567890987654321
+ */
+
static VALUE
-big_abs(x)
+rb_big_abs(x)
VALUE x;
{
if (!RBIGNUM(x)->sign) {
- x = big_clone(x);
+ x = rb_big_clone(x);
RBIGNUM(x)->sign = 1;
}
return x;
}
-/* !!!warnig!!!!
- this is not really a random number!!
-*/
-
VALUE
-big_rand(max)
+rb_big_rand(max, rand_buf)
VALUE max;
+ double *rand_buf;
{
- struct RBignum *v;
- int len;
+ VALUE v;
+ long len = RBIGNUM(max)->len;
- len = RBIGNUM(max)->len;
- v = RBIGNUM(bignew(len,1));
+ if (BIGZEROP(max)) {
+ return rb_float_new(rand_buf[0]);
+ }
+ v = bignew(len,1);
while (len--) {
-#ifdef HAVE_RANDOM
- BDIGITS(v)[len] = random();
-#else
- BDIGITS(v)[len] = rand();
-#endif
+ BDIGITS(v)[len] = ((BDIGIT)~0) * rand_buf[len];
}
- return big_mod(v, max);
+ return rb_big_modulo((VALUE)v, max);
}
-static VALUE
-big_size(big)
- VALUE big;
-{
- return INT2FIX(RBIGNUM(big)->len*sizeof(USHORT));
-}
+/*
+ * 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
+ */
static VALUE
-big_zero_p(big)
+rb_big_size(big)
VALUE big;
{
- return FALSE;
+ return LONG2FIX(RBIGNUM(big)->len*SIZEOF_BDIGITS);
}
+/*
+ * Bignum objects hold integers outside the range of
+ * Fixnum. Bignum objects are created
+ * automatically when integer calculations would otherwise overflow a
+ * 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
Init_Bignum()
{
- cBignum = rb_define_class("Bignum", cInteger);
-
- rb_undef_method(CLASS_OF(cBignum), "new");
-
- rb_define_method(cBignum, "to_s", big_to_s, 0);
- rb_define_method(cBignum, "coerce", big_coerce, 1);
- rb_define_method(cBignum, "-@", big_uminus, 0);
- rb_define_method(cBignum, "+", big_plus, 1);
- rb_define_method(cBignum, "-", big_minus, 1);
- rb_define_method(cBignum, "*", big_mul, 1);
- rb_define_method(cBignum, "/", big_div, 1);
- rb_define_method(cBignum, "%", big_mod, 1);
- rb_define_method(cBignum, "divmod", big_divmod, 1);
- rb_define_method(cBignum, "remainder", big_remainder, 1);
- rb_define_method(cBignum, "**", big_pow, 1);
- rb_define_method(cBignum, "&", big_and, 1);
- rb_define_method(cBignum, "|", big_or, 1);
- rb_define_method(cBignum, "^", big_xor, 1);
- rb_define_method(cBignum, "~", big_neg, 0);
- rb_define_method(cBignum, "<<", big_lshift, 1);
- rb_define_method(cBignum, ">>", big_rshift, 1);
- rb_define_method(cBignum, "[]", big_aref, 1);
-
- rb_define_method(cBignum, "<=>", big_cmp, 1);
- rb_define_method(cBignum, "==", big_eq, 1);
- rb_define_method(cBignum, "eql?", big_eq, 1);
- rb_define_method(cBignum, "hash", big_hash, 0);
- rb_define_method(cBignum, "to_i", big_to_i, 0);
- rb_define_method(cBignum, "to_f", big_to_f, 0);
- rb_define_method(cBignum, "abs", big_abs, 0);
- rb_define_method(cBignum, "size", big_size, 0);
- rb_define_method(cBignum, "zero?", big_zero_p, 0);
+ rb_cBignum = rb_define_class("Bignum", rb_cInteger);
+
+ rb_define_method(rb_cBignum, "to_s", rb_big_to_s, -1);
+ rb_define_method(rb_cBignum, "coerce", rb_big_coerce, 1);
+ rb_define_method(rb_cBignum, "-@", rb_big_uminus, 0);
+ rb_define_method(rb_cBignum, "+", rb_big_plus, 1);
+ rb_define_method(rb_cBignum, "-", rb_big_minus, 1);
+ rb_define_method(rb_cBignum, "*", rb_big_mul, 1);
+ rb_define_method(rb_cBignum, "/", rb_big_div, 1);
+ rb_define_method(rb_cBignum, "%", rb_big_modulo, 1);
+ rb_define_method(rb_cBignum, "div", rb_big_div, 1);
+ rb_define_method(rb_cBignum, "divmod", rb_big_divmod, 1);
+ 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, "**", rb_big_pow, 1);
+ rb_define_method(rb_cBignum, "&", rb_big_and, 1);
+ rb_define_method(rb_cBignum, "|", rb_big_or, 1);
+ rb_define_method(rb_cBignum, "^", rb_big_xor, 1);
+ rb_define_method(rb_cBignum, "~", rb_big_neg, 0);
+ rb_define_method(rb_cBignum, "<<", rb_big_lshift, 1);
+ rb_define_method(rb_cBignum, ">>", rb_big_rshift, 1);
+ rb_define_method(rb_cBignum, "[]", rb_big_aref, 1);
+
+ rb_define_method(rb_cBignum, "<=>", rb_big_cmp, 1);
+ rb_define_method(rb_cBignum, "==", rb_big_eq, 1);
+ rb_define_method(rb_cBignum, "eql?", rb_big_eql, 1);
+ rb_define_method(rb_cBignum, "hash", rb_big_hash, 0);
+ rb_define_method(rb_cBignum, "to_f", rb_big_to_f, 0);
+ rb_define_method(rb_cBignum, "abs", rb_big_abs, 0);
+ rb_define_method(rb_cBignum, "size", rb_big_size, 0);
}
diff --git a/bin/erb b/bin/erb
new file mode 100755
index 0000000000..2459d2562e
--- /dev/null
+++ b/bin/erb
@@ -0,0 +1,139 @@
+#!/usr/bin/env ruby
+# Tiny eRuby --- ERB2
+# Copyright (c) 1999-2000,2002 Masatoshi SEKI
+# You can redistribute it and/or modify it under the same terms as Ruby.
+
+require 'erb'
+
+class ERB
+ module Main
+ def ARGV.switch
+ return nil if self.empty?
+ arg = self.shift
+ return nil if arg == '--'
+ if arg =~ /^-(.)(.*)/
+ return arg if $1 == '-'
+ raise 'unknown switch "-"' if $2.index('-')
+ self.unshift "-#{$2}" if $2.size > 0
+ "-#{$1}"
+ else
+ self.unshift arg
+ nil
+ end
+ end
+
+ def ARGV.req_arg
+ self.shift || raise('missing argument')
+ end
+
+ def trim_mode_opt(trim_mode, disable_percent)
+ return trim_mode if disable_percent
+ case trim_mode
+ when 0
+ return '%'
+ when 1
+ return '%>'
+ when 2
+ return '%<>'
+ when '-'
+ return '%-'
+ end
+ end
+ module_function :trim_mode_opt
+
+ def run(factory=ERB)
+ trim_mode = 0
+ disable_percent = false
+ begin
+ while switch = ARGV.switch
+ case switch
+ when '-x' # ruby source
+ output = true
+ when '-n' # line number
+ number = true
+ when '-v' # verbose
+ $VERBOSE = true
+ when '--version' # version
+ STDERR.puts factory.version
+ exit
+ when '-d', '--debug' # debug
+ $DEBUG = true
+ when '-r' # require
+ require ARGV.req_arg
+ when '-S' # sacurity level
+ arg = ARGV.req_arg
+ raise "invalid safe_level #{arg.dump}" unless arg =~ /^[0-4]$/
+ safe_level = arg.to_i
+ when '-T' # trim mode
+ arg = ARGV.req_arg
+ if arg == '-'
+ trim_mode = arg
+ next
+ end
+ raise "invalid trim mode #{arg.dump}" unless arg =~ /^[0-2]$/
+ trim_mode = arg.to_i
+ when '-K' # KCODE
+ arg = ARGV.req_arg
+ case arg.downcase
+ when 'e', '-e', 'euc'
+ $KCODE = 'EUC'
+ when 's', '-s', 'sjis'
+ $KCODE = 'SJIS'
+ when 'u', '-u', 'utf8'
+ $KCODE = 'UTF8'
+ when 'n', '-n', 'none'
+ $KCODE = 'NONE'
+ else
+ raise "invalid KCODE #{arg.dump}"
+ end
+ when '-P'
+ disable_percent = true
+ when '--help'
+ raise "print this help"
+ else
+ raise "unknown switch #{switch.dump}"
+ end
+ end
+ rescue # usage
+ STDERR.puts $!.to_s
+ STDERR.puts File.basename($0) +
+ " [switches] [inputfile]"
+ STDERR.puts <<EOU
+ -x print ruby script
+ -n print ruby script with line number
+ -v enable verbose mode
+ -d set $DBEUG to true
+ -r [library] load a library
+ -K [kcode] specify KANJI code-set
+ -S [safe_level] set $SAFE (0..4)
+ -T [trim_mode] specify trim_mode (0..2, -)
+ -P disregard the lin which starts in "%"
+EOU
+ exit 1
+ end
+
+ src = $<.read
+ exit 2 unless src
+ trim = trim_mode_opt(trim_mode, disable_percent)
+ erb = factory.new(src.untaint, safe_level, trim)
+ if output
+ if number
+ l = 1
+ for line in erb.src
+ puts "%3d %s"%[l, line]
+ l += 1
+ end
+ else
+ puts erb.src
+ end
+ else
+ erb.run(TOPLEVEL_BINDING.taint)
+ end
+ end
+ module_function :run
+ end
+end
+
+if __FILE__ == $0
+ ERB::Main.run
+end
diff --git a/bin/irb b/bin/irb
new file mode 100644
index 0000000000..309da52161
--- /dev/null
+++ b/bin/irb
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+#
+# irb.rb - intaractive ruby
+# $Release Version: 0.7.3 $
+# $Revision$
+# $Date$
+# by Keiju ISHITSUKA(keiju@ishitsuka.com)
+#
+
+require "irb"
+
+if __FILE__ == $0
+ IRB.start(__FILE__)
+else
+ # check -e option
+ if /^-e$/ =~ $0
+ IRB.start(__FILE__)
+ else
+ IRB.setup(__FILE__)
+ end
+end
diff --git a/bin/rdoc b/bin/rdoc
new file mode 100644
index 0000000000..fe619137fd
--- /dev/null
+++ b/bin/rdoc
@@ -0,0 +1,67 @@
+#!/usr/bin/env ruby
+#
+# RDoc: Documentation tool for source code
+# (see lib/rdoc/rdoc.rb for more information)
+#
+# Copyright (c) 2003 Dave Thomas
+# Released under the same terms as Ruby
+#
+# $Revision$
+
+## Transitional Hack ####
+#
+# RDoc was initially distributed independently, and installed
+# itself into <prefix>/lib/ruby/site_ruby/<ver>/rdoc...
+#
+# Now that RDoc is part of the distribution, it's installed into
+# <prefix>/lib/ruby/<ver>, which unfortunately appears later in the
+# search path. This means that if you have previously installed RDoc,
+# and then install from ruby-lang, you'll pick up the old one by
+# default. This hack checks for the condition, and readjusts the
+# search path if necessary.
+
+def adjust_for_existing_rdoc(path)
+
+ $stderr.puts %{
+ It seems as if you have a previously-installed RDoc in
+ the directory #{path}.
+
+ Because this is now out-of-date, you might want to consider
+ removing the directories:
+
+ #{File.join(path, "rdoc")}
+
+ and
+
+ #{File.join(path, "markup")}
+
+ }
+
+ # Move all the site_ruby directories to the end
+ p $:
+ $:.replace($:.partition {|path| /site_ruby/ !~ path}.flatten)
+ p $:
+end
+
+$:.each do |path|
+ if /site_ruby/ =~ path
+ rdoc_path = File.join(path, 'rdoc', 'rdoc.rb')
+ if File.exists?(rdoc_path)
+ adjust_for_existing_rdoc(path)
+ break
+ end
+ end
+end
+
+## End of Transitional Hack ##
+
+
+require 'rdoc/rdoc'
+
+begin
+ r = RDoc::RDoc.new
+ r.document(ARGV)
+rescue RDoc::RDocError => e
+ $stderr.puts e.message
+ exit(1)
+end
diff --git a/bin/ri b/bin/ri
new file mode 100755
index 0000000000..fb3e00eda3
--- /dev/null
+++ b/bin/ri
@@ -0,0 +1,49 @@
+#!/usr/bin/env ruby
+# usage:
+#
+# ri name...
+#
+# where name can be
+#
+# Class | Class::method | Class#method | Class.method | method
+#
+# All names may be abbreviated to their minimum unbiguous form. If a name
+# _is_ ambiguous, all valid options will be listed.
+#
+# The form '.' method matches either class or instance methods, while
+# #method matches only instance and ::method matches only class methods.
+#
+#
+# == Installing Documentation
+#
+# 'ri' uses a database of documentation built by the RDoc utility.
+#
+# So, how do you install this documentation on your system?
+# It depends on how you installed Ruby.
+#
+# <em>If you installed Ruby from source files</em> (that is, if it some point
+# you typed 'make' during the process :), you can install the RDoc
+# documentation yourself. Just go back to the place where you have
+# your Ruby source and type
+#
+# make install-doc
+#
+# You'll probably need to do this as a superuser, as the documentation
+# is installed in the Ruby target tree (normally somewhere under
+# <tt>/usr/local</tt>.
+#
+# <em>If you installed Ruby from a binary distribution</em> (perhaps
+# using a one-click installer, or using some other packaging system),
+# then the team that produced the package probably forgot to package
+# the documentation as well. Contact them, and see if they can add
+# it to the next release.
+#
+
+
+require 'rdoc/ri/ri_driver'
+
+######################################################################
+
+ri = RiDriver.new
+ri.process_args
+
diff --git a/bin/testrb b/bin/testrb
new file mode 100755
index 0000000000..ff49cb5466
--- /dev/null
+++ b/bin/testrb
@@ -0,0 +1,5 @@
+#!/usr/bin/env ruby
+require 'test/unit'
+(r = Test::Unit::AutoRunner.new(true)).process_args(ARGV) or
+ abort r.options.banner + " tests..."
+exit r.run
diff --git a/class.c b/class.c
index fefc99d65e..8addef7612 100644
--- a/class.c
+++ b/class.c
@@ -1,4 +1,4 @@
-/************************************************
+/**********************************************************************
class.c -
@@ -6,44 +6,46 @@
$Date$
created at: Tue Aug 10 15:05:44 JST 1993
- Copyright (C) 1993-1998 Yukihiro Matsumoto
+ Copyright (C) 1993-2003 Yukihiro Matsumoto
-************************************************/
+**********************************************************************/
#include "ruby.h"
+#include "rubysig.h"
#include "node.h"
#include "st.h"
#include <ctype.h>
-#ifdef USE_CWGUSI
-#include <stdio.h>
-#endif
-
extern st_table *rb_class_tbl;
VALUE
-class_new(super)
+rb_class_boot(super)
VALUE super;
{
NEWOBJ(klass, struct RClass);
- OBJSETUP(klass, cClass, T_CLASS);
+ OBJSETUP(klass, rb_cClass, T_CLASS);
klass->super = super;
klass->iv_tbl = 0;
klass->m_tbl = 0; /* safe GC */
- klass->m_tbl = new_idhash();
+ klass->m_tbl = st_init_numtable();
+ OBJ_INFECT(klass, super);
return (VALUE)klass;
}
VALUE
-singleton_class_new(super)
+rb_class_new(super)
VALUE super;
{
- VALUE klass = class_new(super);
-
- FL_SET(klass, FL_SINGLETON);
- return klass;
+ Check_Type(super, T_CLASS);
+ if (super == rb_cClass) {
+ rb_raise(rb_eTypeError, "can't make subclass of Class");
+ }
+ if (FL_TEST(super, FL_SINGLETON)) {
+ rb_raise(rb_eTypeError, "can't make subclass of virtual class");
+ }
+ return rb_class_boot(super);
}
static int
@@ -52,37 +54,116 @@ clone_method(mid, body, tbl)
NODE *body;
st_table *tbl;
{
- st_insert(tbl, mid, NEW_METHOD(body->nd_body, body->nd_noex));
+ st_insert(tbl, mid, (st_data_t)NEW_METHOD(body->nd_body, body->nd_noex));
return ST_CONTINUE;
}
VALUE
-singleton_class_clone(klass)
- VALUE klass;
+rb_mod_init_copy(clone, orig)
+ VALUE clone, orig;
+{
+ rb_obj_init_copy(clone, orig);
+ if (!FL_TEST(CLASS_OF(clone), FL_SINGLETON)) {
+ RBASIC(clone)->klass = rb_singleton_class_clone(orig);
+ }
+ RCLASS(clone)->super = RCLASS(orig)->super;
+ if (RCLASS(orig)->iv_tbl) {
+ ID id;
+
+ RCLASS(clone)->iv_tbl = st_copy(RCLASS(orig)->iv_tbl);
+ id = rb_intern("__classpath__");
+ st_delete(RCLASS(clone)->iv_tbl, (st_data_t*)&id, 0);
+ id = rb_intern("__classid__");
+ 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);
+ }
+
+ return clone;
+}
+
+VALUE
+rb_class_init_copy(clone, orig)
+ VALUE clone, orig;
+{
+ if (RCLASS(clone)->super != 0) {
+ rb_raise(rb_eTypeError, "already initialized class");
+ }
+ return rb_mod_init_copy(clone, orig);
+}
+
+VALUE
+rb_singleton_class_clone(obj)
+ VALUE obj;
{
+ VALUE klass = RBASIC(obj)->klass;
+
if (!FL_TEST(klass, FL_SINGLETON))
return klass;
else {
/* copy singleton(unnamed) class */
NEWOBJ(clone, struct RClass);
- CLONESETUP(clone, klass);
+ OBJSETUP(clone, 0, RBASIC(klass)->flags);
+
+ if (BUILTIN_TYPE(obj) == T_CLASS) {
+ RBASIC(clone)->klass = (VALUE)clone;
+ }
+ else {
+ RBASIC(clone)->klass = rb_singleton_class_clone(klass);
+ }
clone->super = RCLASS(klass)->super;
clone->iv_tbl = 0;
clone->m_tbl = 0;
- clone->m_tbl = new_idhash();
- st_foreach(RCLASS(klass)->m_tbl, clone_method, clone->m_tbl);
+ 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);
+ rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)clone);
FL_SET(clone, FL_SINGLETON);
return (VALUE)clone;
}
}
void
-singleton_class_attached(klass, obj)
+rb_singleton_class_attached(klass, obj)
VALUE klass, obj;
{
- if (FL_TEST(klass, FL_SINGLETON))
- rb_iv_set(klass, "__attached__", obj);
+ if (FL_TEST(klass, FL_SINGLETON)) {
+ if (!RCLASS(klass)->iv_tbl) {
+ RCLASS(klass)->iv_tbl = st_init_numtable();
+ }
+ st_insert(RCLASS(klass)->iv_tbl, rb_intern("__attached__"), obj);
+ }
+}
+
+VALUE
+rb_make_metaclass(obj, super)
+ VALUE obj, super;
+{
+ VALUE klass = rb_class_boot(super);
+ FL_SET(klass, FL_SINGLETON);
+ RBASIC(obj)->klass = klass;
+ rb_singleton_class_attached(klass, obj);
+ if (BUILTIN_TYPE(obj) == T_CLASS && FL_TEST(obj, FL_SINGLETON)) {
+ RBASIC(klass)->klass = klass;
+ RCLASS(klass)->super = RBASIC(rb_class_real(RCLASS(obj)->super))->klass;
+ }
+ else {
+ VALUE metasuper = RBASIC(rb_class_real(super))->klass;
+
+ /* metaclass of a superclass may be NULL at boot time */
+ if (metasuper) {
+ RBASIC(klass)->klass = metasuper;
+ }
+ }
+
+ return klass;
}
VALUE
@@ -92,28 +173,61 @@ rb_define_class_id(id, super)
{
VALUE klass;
- if (!super) super = cObject;
- klass = class_new(super);
- rb_name_class(klass, id);
- /* make metaclass */
- RBASIC(klass)->klass = singleton_class_new(RBASIC(super)->klass);
- singleton_class_attached(RBASIC(klass)->klass, klass);
- rb_funcall(super, rb_intern("inherited"), 1, klass);
+ if (!super) super = rb_cObject;
+ klass = rb_class_new(super);
+ rb_make_metaclass(klass, RBASIC(super)->klass);
return klass;
}
+void
+rb_check_inheritable(super)
+ VALUE super;
+{
+ if (TYPE(super) != T_CLASS) {
+ rb_raise(rb_eTypeError, "superclass must be a Class (%s given)",
+ rb_obj_classname(super));
+ }
+ if (RBASIC(super)->flags & FL_SINGLETON) {
+ rb_raise(rb_eTypeError, "can't make subclass of virtual class");
+ }
+}
+
+VALUE
+rb_class_inherited(super, klass)
+ VALUE super, klass;
+{
+ if (!super) super = rb_cObject;
+ return rb_funcall(super, rb_intern("inherited"), 1, klass);
+}
+
VALUE
rb_define_class(name, super)
- char *name;
+ const char *name;
VALUE super;
{
VALUE klass;
ID id;
id = rb_intern(name);
+ if (rb_const_defined(rb_cObject, id)) {
+ klass = rb_const_get(rb_cObject, id);
+ if (TYPE(klass) != T_CLASS) {
+ rb_raise(rb_eTypeError, "%s is not a class", name);
+ }
+ if (rb_class_real(RCLASS(klass)->super) != super) {
+ rb_name_error(id, "%s is already defined", name);
+ }
+ return klass;
+ }
+ if (!super) {
+ rb_warn("no super class for `%s', Object assumed", name);
+ }
klass = rb_define_class_id(id, super);
st_add_direct(rb_class_tbl, id, klass);
+ rb_name_class(klass, id);
+ rb_const_set(rb_cObject, id, klass);
+ rb_class_inherited(super, klass);
return klass;
}
@@ -121,30 +235,45 @@ rb_define_class(name, super)
VALUE
rb_define_class_under(outer, name, super)
VALUE outer;
- char *name;
+ const char *name;
VALUE super;
{
VALUE klass;
ID id;
id = rb_intern(name);
+ if (rb_const_defined_at(outer, id)) {
+ klass = rb_const_get_at(outer, id);
+ if (TYPE(klass) != T_CLASS) {
+ rb_raise(rb_eTypeError, "%s is not a class", name);
+ }
+ if (rb_class_real(RCLASS(klass)->super) != super) {
+ rb_name_error(id, "%s is already defined", name);
+ }
+ return klass;
+ }
+ if (!super) {
+ rb_warn("no super class for `%s::%s', Object assumed",
+ rb_class2name(outer), name);
+ }
klass = rb_define_class_id(id, super);
- rb_const_set(outer, id, klass);
rb_set_class_path(klass, outer, name);
+ rb_const_set(outer, id, klass);
+ rb_class_inherited(super, klass);
return klass;
}
VALUE
-module_new()
+rb_module_new()
{
NEWOBJ(mdl, struct RClass);
- OBJSETUP(mdl, cModule, T_MODULE);
+ OBJSETUP(mdl, rb_cModule, T_MODULE);
mdl->super = 0;
mdl->iv_tbl = 0;
mdl->m_tbl = 0;
- mdl->m_tbl = new_idhash();
+ mdl->m_tbl = st_init_numtable();
return (VALUE)mdl;
}
@@ -153,9 +282,9 @@ VALUE
rb_define_module_id(id)
ID id;
{
- extern st_table *rb_class_tbl;
- VALUE mdl = module_new();
+ VALUE mdl;
+ mdl = rb_module_new();
rb_name_class(mdl, id);
return mdl;
@@ -163,14 +292,21 @@ rb_define_module_id(id)
VALUE
rb_define_module(name)
- char *name;
+ const char *name;
{
VALUE module;
ID id;
id = rb_intern(name);
+ if (rb_const_defined(rb_cObject, id)) {
+ module = rb_const_get(rb_cObject, id);
+ if (TYPE(module) == T_MODULE)
+ return module;
+ rb_raise(rb_eTypeError, "%s is not a module", rb_obj_classname(module));
+ }
module = rb_define_module_id(id);
st_add_direct(rb_class_tbl, id, module);
+ rb_const_set(rb_cObject, id, module);
return module;
}
@@ -178,12 +314,19 @@ rb_define_module(name)
VALUE
rb_define_module_under(outer, name)
VALUE outer;
- char *name;
+ const char *name;
{
VALUE module;
ID id;
id = rb_intern(name);
+ if (rb_const_defined_at(outer, id)) {
+ module = rb_const_get_at(outer, id);
+ if (TYPE(module) == T_MODULE)
+ return module;
+ rb_raise(rb_eTypeError, "%s::%s is not a module",
+ rb_class2name(outer), rb_obj_classname(module));
+ }
module = rb_define_module_id(id);
rb_const_set(outer, id, module);
rb_set_class_path(module, outer, name);
@@ -196,10 +339,16 @@ include_class_new(module, super)
VALUE module, super;
{
NEWOBJ(klass, struct RClass);
- OBJSETUP(klass, cClass, T_ICLASS);
+ OBJSETUP(klass, rb_cClass, T_ICLASS);
- klass->m_tbl = RCLASS(module)->m_tbl;
+ if (BUILTIN_TYPE(module) == T_ICLASS) {
+ module = RBASIC(module)->klass;
+ }
+ if (!RCLASS(module)->iv_tbl) {
+ RCLASS(module)->iv_tbl = st_init_numtable();
+ }
klass->iv_tbl = RCLASS(module)->iv_tbl;
+ klass->m_tbl = RCLASS(module)->m_tbl;
klass->super = super;
if (TYPE(module) == T_ICLASS) {
RBASIC(klass)->klass = RBASIC(module)->klass;
@@ -207,6 +356,8 @@ include_class_new(module, super)
else {
RBASIC(klass)->klass = module;
}
+ OBJ_INFECT(klass, module);
+ OBJ_INFECT(klass, super);
return (VALUE)klass;
}
@@ -215,231 +366,426 @@ void
rb_include_module(klass, module)
VALUE klass, module;
{
- VALUE p;
+ VALUE p, c;
+ int changed = 0;
+ rb_frozen_class_p(klass);
+ if (!OBJ_TAINTED(klass)) {
+ rb_secure(4);
+ }
+
if (NIL_P(module)) return;
if (klass == module) return;
- switch (TYPE(module)) {
- case T_MODULE:
- case T_CLASS:
- case T_ICLASS:
- break;
- default:
+ if (TYPE(module) != T_MODULE) {
Check_Type(module, T_MODULE);
}
+ OBJ_INFECT(klass, module);
+ c = klass;
while (module) {
+ int superclass_seen = Qfalse;
+
+ if (RCLASS(klass)->m_tbl == RCLASS(module)->m_tbl)
+ rb_raise(rb_eArgError, "cyclic include detected");
/* ignore if the module included already in superclasses */
for (p = RCLASS(klass)->super; p; p = RCLASS(p)->super) {
- if (BUILTIN_TYPE(p) == T_ICLASS &&
- RCLASS(p)->m_tbl == RCLASS(module)->m_tbl) {
- if (RCLASS(module)->super) {
- rb_include_module(p, RCLASS(module)->super);
+ switch (BUILTIN_TYPE(p)) {
+ case T_ICLASS:
+ if (RCLASS(p)->m_tbl == RCLASS(module)->m_tbl) {
+ if (!superclass_seen) {
+ c = p; /* move insertion point */
+ }
+ goto skip;
}
- return;
+ break;
+ case T_CLASS:
+ superclass_seen = Qtrue;
+ break;
}
}
- RCLASS(klass)->super =
- include_class_new(module, RCLASS(klass)->super);
- klass = RCLASS(klass)->super;
+ c = RCLASS(c)->super = include_class_new(module, RCLASS(c)->super);
+ changed = 1;
+ skip:
module = RCLASS(module)->super;
}
- rb_clear_cache();
+ if (changed) rb_clear_cache();
}
+/*
+ * call-seq:
+ * mod.included_modules -> array
+ *
+ * Returns the list of modules included in <i>mod</i>.
+ *
+ * module Mixin
+ * end
+ *
+ * module Outer
+ * include Mixin
+ * end
+ *
+ * Mixin.included_modules #=> []
+ * Outer.included_modules #=> [Mixin]
+ */
+
VALUE
-mod_included_modules(mod)
+rb_mod_included_modules(mod)
VALUE mod;
{
- VALUE ary = ary_new();
+ VALUE ary = rb_ary_new();
VALUE p;
for (p = RCLASS(mod)->super; p; p = RCLASS(p)->super) {
if (BUILTIN_TYPE(p) == T_ICLASS) {
- ary_push(ary, RBASIC(p)->klass);
+ rb_ary_push(ary, RBASIC(p)->klass);
}
}
return ary;
}
+/*
+ * call-seq:
+ * mod.include?(module) => true or false
+ *
+ * Returns <code>true</code> if <i>module</i> is included in
+ * <i>mod</i> or one of <i>mod</i>'s ancestors.
+ *
+ * module A
+ * end
+ * class B
+ * include A
+ * end
+ * class C < B
+ * end
+ * B.include?(A) #=> true
+ * C.include?(A) #=> true
+ * A.include?(A) #=> false
+ */
+
VALUE
-mod_ancestors(mod)
+rb_mod_include_p(mod, mod2)
VALUE mod;
+ VALUE mod2;
{
- VALUE ary = ary_new();
VALUE p;
+ Check_Type(mod2, T_MODULE);
+ for (p = RCLASS(mod)->super; p; p = RCLASS(p)->super) {
+ if (BUILTIN_TYPE(p) == T_ICLASS) {
+ if (RBASIC(p)->klass == mod2) return Qtrue;
+ }
+ }
+ return Qfalse;
+}
+
+/*
+ * call-seq:
+ * mod.ancestors -> array
+ *
+ * Returns a list of modules included in <i>mod</i> (including
+ * <i>mod</i> itself).
+ *
+ * module Mod
+ * include Math
+ * include Comparable
+ * end
+ *
+ * Mod.ancestors #=> [Mod, Comparable, Math]
+ * Math.ancestors #=> [Math]
+ */
+
+VALUE
+rb_mod_ancestors(mod)
+ VALUE mod;
+{
+ VALUE p, ary = rb_ary_new();
+
for (p = mod; p; p = RCLASS(p)->super) {
if (FL_TEST(p, FL_SINGLETON))
continue;
if (BUILTIN_TYPE(p) == T_ICLASS) {
- ary_push(ary, RBASIC(p)->klass);
+ rb_ary_push(ary, RBASIC(p)->klass);
}
else {
- ary_push(ary, p);
+ rb_ary_push(ary, p);
}
}
return ary;
}
+#define VISI(x) ((x)&NOEX_MASK)
+#define VISI_CHECK(x,f) (VISI(x) == (f))
+
static int
-ins_methods_i(key, body, ary)
- ID key;
- NODE *body;
+ins_methods_push(name, type, ary, visi)
+ ID name;
+ long type;
VALUE ary;
+ long visi;
{
- if ((body->nd_noex&(NOEX_PRIVATE|NOEX_PROTECTED)) == 0) {
- VALUE name = str_new2(rb_id2name(key));
-
- if (!ary_includes(ary, name)) {
- if (!body->nd_body) {
- ary_push(ary, Qnil);
- }
- ary_push(ary, name);
- }
+ if (type == -1) return ST_CONTINUE;
+ switch (visi) {
+ case NOEX_PRIVATE:
+ case NOEX_PROTECTED:
+ case NOEX_PUBLIC:
+ visi = (type == visi);
+ break;
+ default:
+ visi = (type != NOEX_PRIVATE);
+ break;
}
- else if (body->nd_body && nd_type(body->nd_body) == NODE_ZSUPER) {
- ary_push(ary, Qnil);
- ary_push(ary, str_new2(rb_id2name(key)));
+ if (visi) {
+ rb_ary_push(ary, rb_str_new2(rb_id2name(name)));
}
return ST_CONTINUE;
}
static int
-ins_methods_prot_i(key, body, ary)
- ID key;
- NODE *body;
+ins_methods_i(name, type, ary)
+ ID name;
+ long type;
VALUE ary;
{
- if (!body->nd_body) {
- ary_push(ary, Qnil);
- ary_push(ary, str_new2(rb_id2name(key)));
- }
- else if (body->nd_noex & NOEX_PROTECTED) {
- VALUE name = str_new2(rb_id2name(key));
+ return ins_methods_push(name, type, ary, -1); /* everything but private */
+}
- if (!ary_includes(ary, name)) {
- ary_push(ary, name);
- }
- }
- else if (nd_type(body->nd_body) == NODE_ZSUPER) {
- ary_push(ary, Qnil);
- ary_push(ary, str_new2(rb_id2name(key)));
- }
- return ST_CONTINUE;
+static int
+ins_methods_prot_i(name, type, ary)
+ ID name;
+ long type;
+ VALUE ary;
+{
+ return ins_methods_push(name, type, ary, NOEX_PROTECTED);
}
static int
-ins_methods_priv_i(key, body, ary)
+ins_methods_priv_i(name, type, ary)
+ ID name;
+ long type;
+ VALUE ary;
+{
+ return ins_methods_push(name, type, ary, NOEX_PRIVATE);
+}
+
+static int
+ins_methods_pub_i(name, type, ary)
+ ID name;
+ long type;
+ VALUE ary;
+{
+ return ins_methods_push(name, type, ary, NOEX_PUBLIC);
+}
+
+static int
+method_entry(key, body, list)
ID key;
NODE *body;
- VALUE ary;
+ st_table *list;
{
- if (!body->nd_body) {
- ary_push(ary, Qnil);
- ary_push(ary, str_new2(rb_id2name(key)));
- }
- else if (body->nd_noex & NOEX_PRIVATE) {
- VALUE name = str_new2(rb_id2name(key));
+ long type;
- if (!ary_includes(ary, name)) {
- ary_push(ary, name);
- }
- }
- else if (nd_type(body->nd_body) == NODE_ZSUPER) {
- ary_push(ary, Qnil);
- ary_push(ary, str_new2(rb_id2name(key)));
+ if (key == ID_ALLOCATOR) return ST_CONTINUE;
+ if (!st_lookup(list, key, 0)) {
+ if (!body->nd_body) type = -1; /* none */
+ else type = VISI(body->nd_noex);
+ st_add_direct(list, key, type);
}
return ST_CONTINUE;
}
static VALUE
-method_list(mod, option, func)
+class_instance_method_list(argc, argv, mod, func)
+ int argc;
+ VALUE *argv;
VALUE mod;
- int option;
- int (*func)();
+ int (*func) _((ID, long, VALUE));
{
VALUE ary;
- VALUE klass;
- VALUE *p, *q, *pend;
+ int recur;
+ st_table *list;
- ary = ary_new();
- for (klass = mod; klass; klass = RCLASS(klass)->super) {
- st_foreach(RCLASS(klass)->m_tbl, func, ary);
- if (!option) break;
+ if (argc == 0) {
+ recur = Qtrue;
}
- p = q = RARRAY(ary)->ptr; pend = p + RARRAY(ary)->len;
- while (p < pend) {
- if (*p == Qnil) {
- p+=2;
- continue;
- }
- *q++ = *p++;
+ else {
+ VALUE r;
+ rb_scan_args(argc, argv, "01", &r);
+ recur = RTEST(r);
+ }
+
+ list = st_init_numtable();
+ for (; mod; mod = RCLASS(mod)->super) {
+ st_foreach(RCLASS(mod)->m_tbl, method_entry, (st_data_t)list);
+ if (BUILTIN_TYPE(mod) == T_ICLASS) continue;
+ if (FL_TEST(mod, FL_SINGLETON)) continue;
+ if (!recur) break;
}
- RARRAY(ary)->len = q - RARRAY(ary)->ptr;
+ ary = rb_ary_new();
+ st_foreach(list, func, ary);
+ st_free_table(list);
+
return ary;
}
+/*
+ * call-seq:
+ * mod.instance_methods(include_super=true) => array
+ *
+ * Returns an array containing the names of public instance methods in
+ * the receiver. For a module, these are the public methods; for a
+ * class, they are the instance (not singleton) methods. With no
+ * argument, or with an argument that is <code>false</code>, the
+ * instance methods in <i>mod</i> are returned, otherwise the methods
+ * in <i>mod</i> and <i>mod</i>'s superclasses are returned.
+ *
+ * module A
+ * def method1() end
+ * end
+ * class B
+ * def method2() end
+ * end
+ * class C < B
+ * def method3() end
+ * end
+ *
+ * A.instance_methods #=> ["method1"]
+ * B.instance_methods(false) #=> ["method2"]
+ * C.instance_methods(false) #=> ["method3"]
+ * C.instance_methods(true).length #=> 43
+ */
+
VALUE
-class_instance_methods(argc, argv, mod)
+rb_class_instance_methods(argc, argv, mod)
int argc;
VALUE *argv;
VALUE mod;
{
- VALUE option;
-
- rb_scan_args(argc, argv, "01", &option);
- return method_list(mod, RTEST(option), ins_methods_i);
+ return class_instance_method_list(argc, argv, mod, ins_methods_i);
}
+/*
+ * call-seq:
+ * mod.protected_instance_methods(include_super=true) => array
+ *
+ * Returns a list of the protected instance methods defined in
+ * <i>mod</i>. If the optional parameter is not <code>false</code>, the
+ * methods of any ancestors are included.
+ */
+
VALUE
-class_protected_instance_methods(argc, argv, mod)
+rb_class_protected_instance_methods(argc, argv, mod)
int argc;
VALUE *argv;
VALUE mod;
{
- VALUE option;
-
- rb_scan_args(argc, argv, "01", &option);
- return method_list(mod, RTEST(option), ins_methods_prot_i);
+ return class_instance_method_list(argc, argv, mod, ins_methods_prot_i);
}
+/*
+ * call-seq:
+ * mod.private_instance_methods(include_super=true) => array
+ *
+ * Returns a list of the private instance methods defined in
+ * <i>mod</i>. If the optional parameter is not <code>false</code>, the
+ * methods of any ancestors are included.
+ *
+ * module Mod
+ * def method1() end
+ * private :method1
+ * def method2() end
+ * end
+ * Mod.instance_methods #=> ["method2"]
+ * Mod.private_instance_methods #=> ["method1"]
+ */
+
VALUE
-class_private_instance_methods(argc, argv, mod)
+rb_class_private_instance_methods(argc, argv, mod)
int argc;
VALUE *argv;
VALUE mod;
{
- VALUE option;
+ return class_instance_method_list(argc, argv, mod, ins_methods_priv_i);
+}
+
+/*
+ * call-seq:
+ * mod.public_instance_methods(include_super=true) => array
+ *
+ * Returns a list of the public instance methods defined in <i>mod</i>.
+ * If the optional parameter is not <code>false</code>, the methods of
+ * any ancestors are included.
+ */
- rb_scan_args(argc, argv, "01", &option);
- return method_list(mod, RTEST(option), ins_methods_priv_i);
+VALUE
+rb_class_public_instance_methods(argc, argv, mod)
+ int argc;
+ VALUE *argv;
+ VALUE mod;
+{
+ return class_instance_method_list(argc, argv, mod, ins_methods_pub_i);
}
+/*
+ * call-seq:
+ * obj.singleton_methods(all=true) => array
+ *
+ * Returns an array of the names of singleton methods for <i>obj</i>.
+ * If the optional <i>all</i> parameter is true, the list will include
+ * methods in modules included in <i>obj</i>.
+ *
+ * module Other
+ * def three() end
+ * end
+ *
+ * class Single
+ * def Single.four() end
+ * end
+ *
+ * a = Single.new
+ *
+ * def a.one()
+ * end
+ *
+ * class << a
+ * include Other
+ * def two()
+ * end
+ * end
+ *
+ * Single.singleton_methods #=> ["four"]
+ * a.singleton_methods(false) #=> ["two", "one"]
+ * a.singleton_methods #=> ["two", "one", "three"]
+ */
+
VALUE
-obj_singleton_methods(obj)
+rb_obj_singleton_methods(argc, argv, obj)
+ int argc;
+ VALUE *argv;
VALUE obj;
{
- VALUE ary;
- VALUE klass;
- VALUE *p, *q, *pend;
+ VALUE recur, ary, klass;
+ st_table *list;
- ary = ary_new();
+ rb_scan_args(argc, argv, "01", &recur);
+ if (argc == 0) {
+ recur = Qtrue;
+ }
klass = CLASS_OF(obj);
- while (klass && FL_TEST(klass, FL_SINGLETON)) {
- st_foreach(RCLASS(klass)->m_tbl, ins_methods_i, ary);
+ list = st_init_numtable();
+ if (klass && FL_TEST(klass, FL_SINGLETON)) {
+ st_foreach(RCLASS(klass)->m_tbl, method_entry, (st_data_t)list);
klass = RCLASS(klass)->super;
}
- p = q = RARRAY(ary)->ptr; pend = p + RARRAY(ary)->len;
- while (p < pend) {
- if (*p == Qnil) {
- p+=2;
- continue;
+ if (RTEST(recur)) {
+ while (klass && (FL_TEST(klass, FL_SINGLETON) || TYPE(klass) == T_ICLASS)) {
+ st_foreach(RCLASS(klass)->m_tbl, method_entry, (st_data_t)list);
+ klass = RCLASS(klass)->super;
}
- *q++ = *p++;
}
- RARRAY(ary)->len = q - RARRAY(ary)->ptr;
+ ary = rb_ary_new();
+ st_foreach(list, ins_methods_i, ary);
+ st_free_table(list);
return ary;
}
@@ -451,72 +797,97 @@ rb_define_method_id(klass, name, func, argc)
VALUE (*func)();
int argc;
{
- rb_add_method(klass, name, NEW_CFUNC(func,argc), NOEX_PUBLIC|NOEX_CFUNC);
+ rb_add_method(klass, name, NEW_CFUNC(func,argc), NOEX_PUBLIC);
}
void
rb_define_method(klass, name, func, argc)
VALUE klass;
- char *name;
+ const char *name;
VALUE (*func)();
int argc;
{
ID id = rb_intern(name);
+ int ex = NOEX_PUBLIC;
- rb_add_method(klass, id, NEW_CFUNC(func, argc),
- ((name[0] == 'i' && id == rb_intern("initialize"))?
- NOEX_PRIVATE:NOEX_PUBLIC)|NOEX_CFUNC);
+
+ rb_add_method(klass, id, NEW_CFUNC(func, argc), ex);
}
void
rb_define_protected_method(klass, name, func, argc)
VALUE klass;
- char *name;
+ const char *name;
VALUE (*func)();
int argc;
{
- rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc),
- NOEX_PROTECTED|NOEX_CFUNC);
+ rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc), NOEX_PROTECTED);
}
void
rb_define_private_method(klass, name, func, argc)
VALUE klass;
- char *name;
+ const char *name;
VALUE (*func)();
int argc;
{
- rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc),
- NOEX_PRIVATE|NOEX_CFUNC);
+ rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc), NOEX_PRIVATE);
}
void
rb_undef_method(klass, name)
VALUE klass;
- char *name;
+ const char *name;
{
rb_add_method(klass, rb_intern(name), 0, NOEX_UNDEF);
}
+#define SPECIAL_SINGLETON(x,c) do {\
+ if (obj == (x)) {\
+ return c;\
+ }\
+} while (0)
+
VALUE
rb_singleton_class(obj)
VALUE obj;
{
+ VALUE klass;
+
+ if (FIXNUM_P(obj) || SYMBOL_P(obj)) {
+ rb_raise(rb_eTypeError, "can't define singleton");
+ }
if (rb_special_const_p(obj)) {
- TypeError("cannot define singleton");
+ SPECIAL_SINGLETON(Qnil, rb_cNilClass);
+ SPECIAL_SINGLETON(Qfalse, rb_cFalseClass);
+ SPECIAL_SINGLETON(Qtrue, rb_cTrueClass);
+ rb_bug("unknown immediate %ld", obj);
}
- if (FL_TEST(RBASIC(obj)->klass, FL_SINGLETON)) {
- return RBASIC(obj)->klass;
+
+ DEFER_INTS;
+ if (FL_TEST(RBASIC(obj)->klass, FL_SINGLETON) &&
+ rb_iv_get(RBASIC(obj)->klass, "__attached__") == obj) {
+ klass = RBASIC(obj)->klass;
}
- RBASIC(obj)->klass = singleton_class_new(RBASIC(obj)->klass);
- singleton_class_attached(RBASIC(obj)->klass, obj);
- return RBASIC(obj)->klass;
+ else {
+ klass = rb_make_metaclass(obj, RBASIC(obj)->klass);
+ }
+ if (OBJ_TAINTED(obj)) {
+ OBJ_TAINT(klass);
+ }
+ else {
+ FL_UNSET(klass, FL_TAINT);
+ }
+ if (OBJ_FROZEN(obj)) OBJ_FREEZE(klass);
+ ALLOW_INTS;
+
+ return klass;
}
void
rb_define_singleton_method(obj, name, func, argc)
VALUE obj;
- char *name;
+ const char *name;
VALUE (*func)();
int argc;
{
@@ -526,7 +897,7 @@ rb_define_singleton_method(obj, name, func, argc)
void
rb_define_module_function(module, name, func, argc)
VALUE module;
- char *name;
+ const char *name;
VALUE (*func)();
int argc;
{
@@ -536,17 +907,17 @@ rb_define_module_function(module, name, func, argc)
void
rb_define_global_function(name, func, argc)
- char *name;
+ const char *name;
VALUE (*func)();
int argc;
{
- rb_define_private_method(mKernel, name, func, argc);
+ rb_define_module_function(rb_mKernel, name, func, argc);
}
void
rb_define_alias(klass, name1, name2)
VALUE klass;
- char *name1, *name2;
+ const char *name1, *name2;
{
rb_alias(klass, rb_intern(name1), rb_intern(name2));
}
@@ -554,10 +925,10 @@ rb_define_alias(klass, name1, name2)
void
rb_define_attr(klass, name, read, write)
VALUE klass;
- char *name;
+ const char *name;
int read, write;
{
- rb_attr(klass, rb_intern(name), read, write, FALSE);
+ rb_attr(klass, rb_intern(name), read, write, Qfalse);
}
#ifdef HAVE_STDARG_PROTOTYPES
@@ -570,35 +941,31 @@ rb_define_attr(klass, name, read, write)
int
#ifdef HAVE_STDARG_PROTOTYPES
-rb_scan_args(int argc, VALUE *argv, char *fmt, ...)
+rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...)
#else
rb_scan_args(argc, argv, fmt, va_alist)
int argc;
- VALUE *argv;
- char *fmt;
+ const VALUE *argv;
+ const char *fmt;
va_dcl
#endif
{
- int n, i;
- char *p = fmt;
+ int n, i = 0;
+ const char *p = fmt;
VALUE *var;
va_list vargs;
va_init_list(vargs, fmt);
- if (*p == '*') {
- var = va_arg(vargs, VALUE*);
- *var = ary_new4(argc, argv);
- return argc;
- }
+ if (*p == '*') goto rest_arg;
if (ISDIGIT(*p)) {
n = *p - '0';
if (n > argc)
- ArgError("Wrong # of arguments (%d for %d)", argc, n);
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", argc, n);
for (i=0; i<n; i++) {
var = va_arg(vargs, VALUE*);
- *var = argv[i];
+ if (var) *var = argv[i];
}
p++;
}
@@ -611,37 +978,51 @@ rb_scan_args(argc, argv, fmt, va_alist)
for (; i<n; i++) {
var = va_arg(vargs, VALUE*);
if (argc > i) {
- *var = argv[i];
+ if (var) *var = argv[i];
}
else {
- *var = Qnil;
+ if (var) *var = Qnil;
}
}
p++;
}
if(*p == '*') {
+ rest_arg:
var = va_arg(vargs, VALUE*);
if (argc > i) {
- *var = ary_new4(argc-i, argv+i);
+ if (var) *var = rb_ary_new4(argc-i, argv+i);
+ i = argc;
}
else {
- *var = ary_new();
+ if (var) *var = rb_ary_new();
}
+ p++;
}
- else if (*p == '\0') {
- if (argc > i) {
- ArgError("Wrong # of arguments(%d for %d)", argc, i);
+
+ if (*p == '&') {
+ var = va_arg(vargs, VALUE*);
+ if (rb_block_given_p()) {
+ *var = rb_block_proc();
+ }
+ else {
+ *var = Qnil;
}
+ p++;
}
- else {
+ va_end(vargs);
+
+ if (*p != '\0') {
goto error;
}
- va_end(vargs);
+ if (argc > i) {
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", argc, i);
+ }
+
return argc;
error:
- Fatal("bad scan arg format: %s", fmt);
+ rb_fatal("bad scan arg format: %s", fmt);
return 0;
}
diff --git a/compar.c b/compar.c
index 846364ef49..1488b2c65d 100644
--- a/compar.c
+++ b/compar.c
@@ -1,4 +1,4 @@
-/************************************************
+/**********************************************************************
compar.c -
@@ -6,95 +6,238 @@
$Date$
created at: Thu Aug 26 14:39:48 JST 1993
- Copyright (C) 1993-1998 Yukihiro Matsumoto
+ Copyright (C) 1993-2003 Yukihiro Matsumoto
-************************************************/
+**********************************************************************/
#include "ruby.h"
-VALUE mComparable;
+VALUE rb_mComparable;
static ID cmp;
+int
+rb_cmpint(val, a, b)
+ VALUE val, a, b;
+{
+ if (NIL_P(val)) {
+ rb_cmperr(a, b);
+ }
+ if (FIXNUM_P(val)) return FIX2INT(val);
+ if (TYPE(val) == T_BIGNUM) {
+ if (RBIGNUM(val)->sign) return 1;
+ return -1;
+ }
+ if (RTEST(rb_funcall(val, '>', 1, INT2FIX(0)))) return 1;
+ if (RTEST(rb_funcall(val, '<', 1, INT2FIX(0)))) return -1;
+ return 0;
+}
+
+void
+rb_cmperr(x, y)
+ VALUE x, y;
+{
+ const char *classname;
+
+ if (SPECIAL_CONST_P(y)) {
+ y = rb_inspect(y);
+ classname = StringValuePtr(y);
+ }
+ else {
+ classname = rb_obj_classname(y);
+ }
+ rb_raise(rb_eArgError, "comparison of %s with %s failed",
+ rb_obj_classname(x), classname);
+}
+
+#define cmperr() (rb_cmperr(x, y), Qnil)
+
+static VALUE
+cmp_eq(a)
+ VALUE *a;
+{
+ VALUE c = rb_funcall(a[0], cmp, 1, a[1]);
+
+ if (NIL_P(c)) return Qnil;
+ if (rb_cmpint(c, a[0], a[1]) == 0) return Qtrue;
+ return Qfalse;
+}
+
static VALUE
-cmp_eq(x, y)
+cmp_failed()
+{
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * obj == other => true or false
+ *
+ * Compares two objects based on the receiver's <code><=></code>
+ * method, returning true if it returns 0. Also returns true if
+ * _obj_ and _other_ are the same object.
+ */
+
+static VALUE
+cmp_equal(x, y)
VALUE x, y;
{
- VALUE c = rb_funcall(x, cmp, 1, y);
- int t = NUM2INT(c);
+ VALUE a[2];
+
+ if (x == y) return Qtrue;
- if (t == 0) return TRUE;
- return FALSE;
+ a[0] = x; a[1] = y;
+ return rb_rescue(cmp_eq, (VALUE)a, cmp_failed, 0);
}
+/*
+ * call-seq:
+ * obj > other => true or false
+ *
+ * Compares two objects based on the receiver's <code><=></code>
+ * method, returning true if it returns 1.
+ */
+
static VALUE
cmp_gt(x, y)
VALUE x, y;
{
VALUE c = rb_funcall(x, cmp, 1, y);
- int t = NUM2INT(c);
- if (t > 0) return TRUE;
- return FALSE;
+ if (NIL_P(c)) return cmperr();
+ if (rb_cmpint(c, x, y) > 0) return Qtrue;
+ return Qfalse;
}
+/*
+ * call-seq:
+ * obj >= other => true or false
+ *
+ * Compares two objects based on the receiver's <code><=></code>
+ * method, returning true if it returns 0 or 1.
+ */
+
static VALUE
cmp_ge(x, y)
VALUE x, y;
{
VALUE c = rb_funcall(x, cmp, 1, y);
- int t = NUM2INT(c);
- if (t >= 0) return TRUE;
- return FALSE;
+ if (NIL_P(c)) return cmperr();
+ if (rb_cmpint(c, x, y) >= 0) return Qtrue;
+ return Qfalse;
}
+/*
+ * call-seq:
+ * obj < other => true or false
+ *
+ * Compares two objects based on the receiver's <code><=></code>
+ * method, returning true if it returns -1.
+ */
+
static VALUE
cmp_lt(x, y)
VALUE x, y;
{
VALUE c = rb_funcall(x, cmp, 1, y);
- int t = NUM2INT(c);
- if (t < 0) return TRUE;
- return FALSE;
+ if (NIL_P(c)) return cmperr();
+ if (rb_cmpint(c, x, y) < 0) return Qtrue;
+ return Qfalse;
}
+
+/*
+ * call-seq:
+ * obj <= other => true or false
+ *
+ * Compares two objects based on the receiver's <code><=></code>
+ * method, returning true if it returns -1 or 0.
+ */
+
static VALUE
cmp_le(x, y)
VALUE x, y;
{
VALUE c = rb_funcall(x, cmp, 1, y);
- int t = NUM2INT(c);
- if (t <= 0) return TRUE;
- return FALSE;
+ if (NIL_P(c)) return cmperr();
+ if (rb_cmpint(c, x, y) <= 0) return Qtrue;
+ return Qfalse;
}
+/*
+ * call-seq:
+ * obj.between?(min, max) => true or false
+ *
+ * Returns <code>false</code> if <i>obj</i> <code><=></code>
+ * <i>min</i> is less than zero or if <i>anObject</i> <code><=></code>
+ * <i>max</i> is greater than zero, <code>true</code> otherwise.
+ *
+ * 3.between?(1, 5) #=> true
+ * 6.between?(1, 5) #=> false
+ * 'cat'.between?('ant', 'dog') #=> true
+ * 'gnu'.between?('ant', 'dog') #=> false
+ *
+ */
+
static VALUE
cmp_between(x, min, max)
VALUE x, min, max;
{
- VALUE c = rb_funcall(x, cmp, 1, min);
- long t = NUM2LONG(c);
- if (t < 0) return FALSE;
-
- c = rb_funcall(x, cmp, 1, max);
- t = NUM2LONG(c);
- if (t > 0) return FALSE;
- return TRUE;
+ if (RTEST(cmp_lt(x, min))) return Qfalse;
+ if (RTEST(cmp_gt(x, max))) return Qfalse;
+ return Qtrue;
}
+/*
+ * The <code>Comparable</code> mixin is used by classes whose objects
+ * may be ordered. The class must define the <code><=></code> operator,
+ * which compares the receiver against another object, returning -1, 0,
+ * or +1 depending on whether the receiver is less than, equal to, or
+ * greater than the other object. <code>Comparable</code> uses
+ * <code><=></code> to implement the conventional comparison operators
+ * (<code><</code>, <code><=</code>, <code>==</code>, <code>>=</code>,
+ * and <code>></code>) and the method <code>between?</code>.
+ *
+ * class SizeMatters
+ * include Comparable
+ * attr :str
+ * def <=>(anOther)
+ * str.size <=> anOther.str.size
+ * end
+ * def initialize(str)
+ * @str = str
+ * end
+ * def inspect
+ * @str
+ * end
+ * end
+ *
+ * s1 = SizeMatters.new("Z")
+ * s2 = SizeMatters.new("YY")
+ * s3 = SizeMatters.new("XXX")
+ * s4 = SizeMatters.new("WWWW")
+ * s5 = SizeMatters.new("VVVVV")
+ *
+ * s1 < s2 #=> true
+ * s4.between?(s1, s3) #=> false
+ * s4.between?(s3, s5) #=> true
+ * [ s3, s2, s5, s4, s1 ].sort #=> [Z, YY, XXX, WWWW, VVVVV]
+ *
+ */
+
void
Init_Comparable()
{
- mComparable = rb_define_module("Comparable");
- rb_define_method(mComparable, "==", cmp_eq, 1);
- rb_define_method(mComparable, ">", cmp_gt, 1);
- rb_define_method(mComparable, ">=", cmp_ge, 1);
- rb_define_method(mComparable, "<", cmp_lt, 1);
- rb_define_method(mComparable, "<=", cmp_le, 1);
- rb_define_method(mComparable, "between?", cmp_between, 2);
+ rb_mComparable = rb_define_module("Comparable");
+ rb_define_method(rb_mComparable, "==", cmp_equal, 1);
+ rb_define_method(rb_mComparable, ">", cmp_gt, 1);
+ rb_define_method(rb_mComparable, ">=", cmp_ge, 1);
+ rb_define_method(rb_mComparable, "<", cmp_lt, 1);
+ rb_define_method(rb_mComparable, "<=", cmp_le, 1);
+ rb_define_method(rb_mComparable, "between?", cmp_between, 2);
cmp = rb_intern("<=>");
}
diff --git a/config.guess b/config.guess
index d62857905a..dd1688b7b5 100644
--- a/config.guess
+++ b/config.guess
@@ -1,7 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
-#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+timestamp='2004-06-11'
+
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@@ -21,136 +24,323 @@
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
-# Written by Per Bothner <bothner@cygnus.com>.
-# The master version of this file is at the FSF in /home/gd/gnu/lib.
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
-# don't specify an explicit system type (host/target name).
-#
-# Only a few systems have been added to this list; please add others
-# (but try to keep the structure clean).
-#
+# don't specify an explicit build system type.
-# Modified for Human68k by K.Okabe 1997.07.09
-# Last change: 1997.07.09
+me=`echo "$0" | sed -e 's,.*/,,'`
-case "$KSH_VERSION" in
-*X6*)
- echo m68k-sharp-human
- exit 0 ;;
-*)
- ;;
-esac
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit 0 ;;
+ --version | -v )
+ echo "$version" ; exit 0 ;;
+ --help | --h* | -h )
+ echo "$usage"; exit 0 ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ;'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 8/24/94.)
+# (ghazi@noc.rutgers.edu 1994-08-24)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
-
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
- alpha:OSF1:*:*)
- if test $UNAME_RELEASE = "V4.0"; then
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- fi
- # A Vn.n version is a released version.
- # A Tn.n version is a released field test version.
- # A Xn.n version is an unreleased experimental baselevel.
- # 1.2 uses "1.2" for uname -r.
- cat <<EOF >dummy.s
- .globl main
- .ent main
-main:
- .frame \$30,0,\$26,0
- .prologue 0
- .long 0x47e03d80 # implver $0
- lda \$2,259
- .long 0x47e20c21 # amask $2,$1
- srl \$1,8,\$2
- sll \$2,2,\$2
- sll \$0,3,\$0
- addl \$1,\$0,\$0
- addl \$2,\$0,\$0
- ret \$31,(\$26),1
- .end main
-EOF
- ${CC-cc} dummy.s -o dummy 2>/dev/null
- if test "$?" = 0 ; then
- ./dummy
- case "$?" in
- 7)
- UNAME_MACHINE="alpha"
- ;;
- 15)
- UNAME_MACHINE="alphaev5"
- ;;
- 14)
- UNAME_MACHINE="alphaev56"
- ;;
- 10)
- UNAME_MACHINE="alphapca56"
- ;;
- 16)
- UNAME_MACHINE="alphaev6"
- ;;
- esac
- fi
- rm -f dummy.s dummy
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "${UNAME_VERSION}" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
exit 0 ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
+ amd64:OpenBSD:*:*)
+ echo x86_64-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-cbm-sysv4
- exit 0;;
- amiga:NetBSD:*:*)
- echo m68k-cbm-netbsd${UNAME_RELEASE}
- exit 0 ;;
amiga:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
- arc64:OpenBSD:*:*)
- echo mips64el-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
arc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
- hkmips:OpenBSD:*:*)
- echo mips-unknown-openbsd${UNAME_RELEASE}
+ cats:OpenBSD:*:*)
+ echo arm-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ luna88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ macppc:OpenBSD:*:*)
+ echo powerpc-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvmeppc:OpenBSD:*:*)
+ echo powerpc-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
pmax:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sgi:OpenBSD:*:*)
- echo mips-unknown-openbsd${UNAME_RELEASE}
+ echo mipseb-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
wgrisc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit 0 ;;
+ macppc:MirBSD:*:*)
+ echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ exit 0 ;;
+ alpha:OSF1:*:*)
+ case $UNAME_RELEASE in
+ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case "$ALPHA_CPU_TYPE" in
+ "EV4 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE="alpha" ;;
+ "EV5 (21164)")
+ UNAME_MACHINE="alphaev5" ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE="alphaev56" ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE="alphapca56" ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE="alphapca57" ;;
+ "EV6 (21264)")
+ UNAME_MACHINE="alphaev6" ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE="alphaev67" ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE="alphaev69" ;;
+ "EV7 (21364)")
+ UNAME_MACHINE="alphaev7" ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
+ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit 0 ;;
+ Alpha*:OpenVMS:*:*)
+ echo alpha-hp-vms
+ exit 0 ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit 0;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit 0 ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit 0 ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit 0 ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
- arm32:NetBSD:*:*)
- echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- exit 0 ;;
- SR2?01:HI-UX/MPP:*:*)
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
exit 0;;
- Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
@@ -158,9 +348,19 @@ EOF
echo pyramid-pyramid-bsd
fi
exit 0 ;;
- NILE:*:*:dcosx)
+ NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit 0 ;;
+ DRS?6000:unix:4.0:6*)
+ echo sparc-icl-nx6
+ exit 0 ;;
+ DRS?6000:UNIX_SV:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7 && exit 0 ;;
+ esac ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
@@ -186,7 +386,7 @@ EOF
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
case "`/bin/arch`" in
sun3)
@@ -200,29 +400,34 @@ EOF
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit 0 ;;
- atari*:NetBSD:*:*)
- echo m68k-atari-netbsd${UNAME_RELEASE}
- exit 0 ;;
- atari*:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sun3*:NetBSD:*:*)
- echo m68k-sun-netbsd${UNAME_RELEASE}
- exit 0 ;;
- sun3*:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mac68k:NetBSD:*:*)
- echo m68k-apple-netbsd${UNAME_RELEASE}
- exit 0 ;;
- mac68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
- mvme88k:OpenBSD:*:*)
- echo m88k-unknown-openbsd${UNAME_RELEASE}
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit 0 ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit 0 ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
@@ -236,12 +441,18 @@ EOF
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
- 2020:CLIX:*:*)
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
exit 0 ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
- sed 's/^ //' << EOF >dummy.c
- int main (argc, argv) int argc; char **argv; {
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
@@ -256,12 +467,20 @@ EOF
exit (-1);
}
EOF
- ${CC-cc} dummy.c -o dummy \
- && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
- && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
+ $CC_FOR_BUILD -o $dummy $dummy.c \
+ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && exit 0
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit 0 ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit 0 ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit 0 ;;
@@ -277,15 +496,18 @@ EOF
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
- -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
echo m88k-dg-dgux${UNAME_RELEASE}
- else
+ else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
fi
- else echo i586-dg-dgux${UNAME_RELEASE}
- fi
exit 0 ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
@@ -306,12 +528,21 @@ EOF
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i?86:AIX:*:*)
+ i*86:AIX:*:*)
echo i386-ibm-aix
exit 0 ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit 0 ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- sed 's/^ //' << EOF >dummy.c
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
#include <sys/systemcfg.h>
main()
@@ -322,8 +553,7 @@ EOF
exit(0);
}
EOF
- ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
+ $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
@@ -331,8 +561,9 @@ EOF
echo rs6000-ibm-aix3.2
fi
exit 0 ;;
- *:AIX:*:4)
- if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
+ *:AIX:*:[45])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
@@ -340,7 +571,7 @@ EOF
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
- IBM_REV=4.${UNAME_RELEASE}
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit 0 ;;
@@ -350,7 +581,7 @@ EOF
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit 0 ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit 0 ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
@@ -365,18 +596,85 @@ EOF
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit 0 ;;
- 9000/[3478]??:HP-UX:*:*)
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
- 9000/8?? ) HP_ARCH=hppa1.0 ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
+ fi ;;
esac
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+ # avoid double evaluation of $set_cc_for_build
+ test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
+ then
+ HP_ARCH="hppa2.0w"
+ else
+ HP_ARCH="hppa64"
+ fi
+ fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit 0 ;;
3050*:HI-UX:*:*)
- sed 's/^ //' << EOF >dummy.c
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
#include <unistd.h>
int
main ()
@@ -401,8 +699,7 @@ EOF
exit (0);
}
EOF
- ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
+ $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
@@ -411,13 +708,16 @@ EOF
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit 0 ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit 0 ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
exit 0 ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit 0 ;;
- i?86:OSF1:*:*)
+ i*86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
@@ -445,168 +745,267 @@ EOF
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit 0 ;;
- CRAY*X-MP:*:*:*)
- echo xmp-cray-unicos
- exit 0 ;;
CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE}
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE}
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
- CRAY-2:*:*:*)
- echo cray2-cray-unicos
- exit 0 ;;
- F300:UNIX_System_V:*:*)
- FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ *:UNICOS/mp:*:*)
+ echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
- F301:UNIX_System_V:*:*)
- echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
- exit 0 ;;
- hp3[0-9][05]:NetBSD:*:*)
- echo m68k-hp-netbsd${UNAME_RELEASE}
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
- hp300:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- i?86:BSD/386:*:* | *:BSD/OS:*:*)
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
- *:FreeBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
- *:NetBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- exit 0 ;;
- *:OpenBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
- *:*:*BOW*:*)
- echo i386-pc-bow
+ *:FreeBSD:*:*)
+ # Determine whether the default compiler uses glibc.
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #if __GLIBC__ >= 2
+ LIBC=gnu
+ #else
+ LIBC=
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+ # GNU/KFreeBSD systems have a "k" prefix to indicate we are using
+ # FreeBSD's kernel, but not the complete OS.
+ case ${LIBC} in gnu) kernel_only='k' ;; esac
+ echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
exit 0 ;;
i*:CYGWIN*:*)
- echo i386-pc-cygwin32
+ echo ${UNAME_MACHINE}-pc-cygwin
exit 0 ;;
i*:MINGW*:*)
- echo i386-pc-mingw32
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit 0 ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit 0 ;;
+ x86:Interix*:[34]*)
+ echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
+ exit 0 ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit 0 ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i586-pc-interix
+ exit 0 ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
exit 0 ;;
p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin32
+ echo powerpcle-unknown-cygwin
exit 0 ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
*:GNU:*:*)
+ # the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
- *:Linux:*:*)
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ exit 0 ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit 0 ;;
+ arm*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ cris:Linux:*:*)
+ echo cris-axis-linux-gnu
+ exit 0 ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ mips:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips
+ #undef mipsel
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mipsel
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+ test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ ;;
+ mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips64
+ #undef mips64el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mips64el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips64
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+ test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit 0 ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit 0 ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit 0 ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit 0 ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit 0 ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit 0 ;;
+ sh64*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+ exit 0 ;;
+ i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
- # first see if it will tell us.
- ld_help_string=`ld --help 2>&1`
- ld_supported_emulations=`echo $ld_help_string \
- | sed -ne '/supported emulations:/!d
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ # Set LC_ALL=C to ensure ld outputs messages in English.
+ ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
s/[ ][ ]*/ /g
- s/.*supported emulations: *//
+ s/.*supported targets: *//
s/ .*//
p'`
- case "$ld_supported_emulations" in
- i?86linux) echo "${UNAME_MACHINE}-pc-linux-aout" ; exit 0 ;;
- i?86coff) echo "${UNAME_MACHINE}-pc-linux-coff" ; exit 0 ;;
- sparclinux) echo "${UNAME_MACHINE}-unknown-linux-aout" ; exit 0 ;;
- m68klinux) echo "${UNAME_MACHINE}-unknown-linux-aout" ; exit 0 ;;
- elf32ppc) echo "powerpc-unknown-linux" ; exit 0 ;;
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit 0 ;;
+ coff-i386)
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+ exit 0 ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+ exit 0 ;;
esac
-
- if test "${UNAME_MACHINE}" = "alpha" ; then
- sed 's/^ //' <<EOF >dummy.s
- .globl main
- .ent main
- main:
- .frame \$30,0,\$26,0
- .prologue 0
- .long 0x47e03d80 # implver $0
- lda \$2,259
- .long 0x47e20c21 # amask $2,$1
- srl \$1,8,\$2
- sll \$2,2,\$2
- sll \$0,3,\$0
- addl \$1,\$0,\$0
- addl \$2,\$0,\$0
- ret \$31,(\$26),1
- .end main
-EOF
- LIBC=""
- ${CC-cc} dummy.s -o dummy 2>/dev/null
- if test "$?" = 0 ; then
- ./dummy
- case "$?" in
- 7)
- UNAME_MACHINE="alpha"
- ;;
- 15)
- UNAME_MACHINE="alphaev5"
- ;;
- 14)
- UNAME_MACHINE="alphaev56"
- ;;
- 10)
- UNAME_MACHINE="alphapca56"
- ;;
- 16)
- UNAME_MACHINE="alphaev6"
- ;;
- esac
-
- objdump --private-headers dummy | \
- grep ld.so.1 > /dev/null
- if test "$?" = 0 ; then
- LIBC="-libc1"
- fi
- fi
- rm -f dummy.s dummy
- echo ${UNAME_MACHINE}-unknown-linux${LIBC} ; exit 0
- elif test "${UNAME_MACHINE}" = "mips" ; then
- cat >dummy.c <<EOF
-main(argc, argv)
- int argc;
- char *argv[];
-{
-#ifdef __MIPSEB__
- printf ("%s-unknown-linux\n", argv[1]);
-#endif
-#ifdef __MIPSEL__
- printf ("%sel-unknown-linux\n", argv[1]);
-#endif
- return 0;
-}
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #ifdef __ELF__
+ # ifdef __GLIBC__
+ # if __GLIBC__ >= 2
+ LIBC=gnu
+ # else
+ LIBC=gnulibc1
+ # endif
+ # else
+ LIBC=gnulibc1
+ # endif
+ #else
+ #ifdef __INTEL_COMPILER
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
EOF
- ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
- else
- case "${UNAME_MACHINE}" in
- i?86)
- VENDOR=pc;
- ;;
- *)
- VENDOR=unknown;
- ;;
- esac
- echo ${UNAME_MACHINE}-${VENDOR}-linux
- exit 0
- fi ;;
-# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
-# are messed up and put the nodename in both sysname and nodename.
- i?86:DYNIX/ptx:4*:*)
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+ test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+ test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
echo i386-sequent-sysv4
exit 0 ;;
- i?86:UNIX_SV:4.2MP:2.*)
+ i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
@@ -614,28 +1013,62 @@ EOF
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit 0 ;;
- i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit 0 ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit 0 ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit 0 ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit 0 ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit 0 ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
fi
exit 0 ;;
- i?86:*:3.2:*)
+ i*86:*:5:[78]*)
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit 0 ;;
+ i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
- (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
pc:*:*:*)
+ # Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
echo i386-pc-msdosdjgpp
@@ -657,9 +1090,15 @@ EOF
# "miniframe"
echo m68010-convergent-sysv
exit 0 ;;
- M68*:*:R3V[567]*:*)
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit 0 ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ exit 0 ;;
+ M68*:*:R3V[5678]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
- 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@@ -670,24 +1109,27 @@ EOF
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4 && exit 0 ;;
- m68*:LynxOS:2.*:*)
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
- i?86:LynxOS:2.*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
- rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+ rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
exit 0 ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
exit 0 ;;
@@ -699,8 +1141,8 @@ EOF
echo ns32k-sni-sysv
fi
exit 0 ;;
- PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit 0 ;;
*:UNIX_System_V:4*:FTX*)
@@ -712,40 +1154,119 @@ EOF
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
exit 0 ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit 0 ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit 0 ;;
- X680[02346]0:Human68k:*:*)
- echo m68k-sharp-human
- exit 0 ;;
- news*:NEWS-OS:*:6*)
+ news*:NEWS-OS:6*:*)
echo mips-sony-newsos6
- exit 0 ;;
- R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
+ exit 0 ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
- DS/90*:*:*:V20*)
- echo sparc-fujitsu-uxpds
- exit 0 ;;
- BeBox:BeOS:*:*)
- echo powerpc-be-beos
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
exit 0 ;;
- BeMac:BeOS:*:*)
- echo powerpc-apple-beos
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
exit 0 ;;
- BePC:BeOS:*:*)
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit 0 ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Darwin:*:*)
+ case `uname -p` in
+ *86) UNAME_PROCESSOR=i686 ;;
+ powerpc) UNAME_PROCESSOR=powerpc ;;
+ esac
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ exit 0 ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit 0 ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit 0 ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit 0 ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit 0 ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit 0 ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit 0 ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit 0 ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit 0 ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit 0 ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit 0 ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit 0 ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit 0 ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit 0 ;;
+ SEI:*:*:SEIUX)
+ echo mips-sei-seiux${UNAME_RELEASE}
+ exit 0 ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-cat >dummy.c <<EOF
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
@@ -787,7 +1308,6 @@ main ()
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
-
exit (0);
#endif
@@ -832,11 +1352,24 @@ main ()
#endif
#if defined (vax)
-#if !defined (ultrix)
- printf ("vax-dec-bsd\n"); exit (0);
-#else
- printf ("vax-dec-ultrix\n"); exit (0);
-#endif
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
#endif
#if defined (alliant) && defined (i860)
@@ -847,8 +1380,7 @@ main ()
}
EOF
-${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
-rm -f dummy.c dummy
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
# Apollos put the system type in the environment.
@@ -880,6 +1412,48 @@ then
esac
fi
-#echo '(Unable to guess system type)' 1>&2
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ ftp://ftp.gnu.org/pub/gnu/config/
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config.sub b/config.sub
index 9775812226..506d3ab77f 100644
--- a/config.sub
+++ b/config.sub
@@ -1,6 +1,10 @@
#! /bin/sh
-# Configuration validation subroutine script, version 1.1.
-# Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+timestamp='2004-06-11'
+
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine. It does not imply ALL GNU software can.
@@ -25,6 +29,9 @@
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
@@ -45,30 +52,74 @@
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
-if [ x$1 = x ]
-then
- echo Configuration name missing. 1>&2
- echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
- echo "or $0 ALIAS" 1>&2
- echo where ALIAS is a recognized configuration type. 1>&2
- exit 1
-fi
+me=`echo "$0" | sed -e 's,.*/,,'`
-# First pass through any local machine types.
-case $1 in
- *local*)
- echo $1
- exit 0
- ;;
- *)
- ;;
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit 0 ;;
+ --version | -v )
+ echo "$version" ; exit 0 ;;
+ --help | --h* | -h )
+ echo "$usage"; exit 0 ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit 0;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
esac
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
- linux-gnu*)
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
+ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
@@ -94,15 +145,33 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple)
+ -apple | -axis)
+ os=
+ basic_machine=$1
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
-hiux*)
os=-hiuxwe2
;;
-sco5)
- os=sco3.2v5
+ os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco4)
@@ -121,6 +190,9 @@ case $os in
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
-isc)
os=-isc2.2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -143,58 +215,158 @@ case $os in
-psos*)
os=-psos
;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
esac
# Decode aliases for certain CPU-COMPANY combinations.
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
- tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
- | arme[lb] | pyramid | mn10200 | mn10300 \
- | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
- | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
- | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
- | mips64 | mipsel | mips64el | mips64orion | mips64orionel \
- | mipstx39 | mipstx39el \
- | sparc | sparclet | sparclite | sparc64 | v850)
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ | c4x | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k | iq2000 \
+ | m32r | m68000 | m68k | m88k | mcore \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64vr | mips64vrel \
+ | mips64orion | mips64orionel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | msp430 \
+ | ns16k | ns32k \
+ | openrisc | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
+ | strongarm \
+ | tahoe | thumb | tic4x | tic80 | tron \
+ | v850 | v850e \
+ | we32k \
+ | x86 | xscale | xstormy16 | xtensa \
+ | z8k)
basic_machine=$basic_machine-unknown
;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+ # Motorola 68HC11/12.
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
- i[3456]86)
+ i*86 | x86_64)
basic_machine=$basic_machine-pc
;;
- i[3456]86-TOWNS*)
- basic_machine=`echo $basic_machine | sed -e 's/-TOWNS.*/-TOWNS/'`
- ;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
# Recognize the basic CPU types with company name.
- vax-* | tahoe-* | i[3456]86-* | i860-* | m32r-* | m68k-* | m68000-* \
- | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
- | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
- | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
- | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* \
- | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
- | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
- | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
- | sparc64-* | mips64-* | mipsel-* \
- | mips64el-* | mips64orion-* | mips64orionel-* \
- | mipstx39-* | mipstx39el-* \
- | f301-*)
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* \
+ | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+ | clipper-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* | iq2000-* \
+ | m32r-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | mcore-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
+ | msp430-* \
+ | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tron-* \
+ | v850-* | v850e-* | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+ | xtensa-* \
+ | ymp-* \
+ | z8k-*)
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
basic_machine=m68000-att
;;
3b*)
basic_machine=we32k-att
;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
alliant | fx80)
basic_machine=fx80-alliant
;;
@@ -205,25 +377,35 @@ case $basic_machine in
basic_machine=a29k-none
os=-bsd
;;
+ amd64)
+ basic_machine=x86_64-pc
+ ;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
amdahl)
basic_machine=580-amdahl
os=-sysv
;;
amiga | amiga-*)
- basic_machine=m68k-cbm
+ basic_machine=m68k-unknown
;;
amigaos | amigados)
- basic_machine=m68k-cbm
+ basic_machine=m68k-unknown
os=-amigaos
;;
amigaunix | amix)
- basic_machine=m68k-cbm
+ basic_machine=m68k-unknown
os=-sysv4
;;
apollo68)
basic_machine=m68k-apollo
os=-sysv
;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
aux)
basic_machine=m68k-apple
os=-aux
@@ -232,6 +414,10 @@ case $basic_machine in
basic_machine=ns32k-sequent
os=-dynix
;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
convex-c1)
basic_machine=c1-convex
os=-bsd
@@ -252,27 +438,30 @@ case $basic_machine in
basic_machine=c38-convex
os=-bsd
;;
- cray | ymp)
- basic_machine=ymp-cray
- os=-unicos
- ;;
- cray2)
- basic_machine=cray2-cray
- os=-unicos
- ;;
- [ctj]90-cray)
- basic_machine=c90-cray
+ cray | j90)
+ basic_machine=j90-cray
os=-unicos
;;
crds | unos)
basic_machine=m68k-crds
;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
da30 | da30-*)
basic_machine=m68k-da30
;;
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
basic_machine=mips-dec
;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
basic_machine=m68k-motorola
@@ -300,6 +489,10 @@ case $basic_machine in
encore | umax | mmax)
basic_machine=ns32k-encore
;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
fx2800)
basic_machine=i860-alliant
;;
@@ -310,6 +503,10 @@ case $basic_machine in
basic_machine=tron-gmicro
os=-sysv
;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
h3050r* | hiux*)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
@@ -318,6 +515,14 @@ case $basic_machine in
basic_machine=h8300-hitachi
os=-hms
;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
harris)
basic_machine=m88k-harris
os=-sysv3
@@ -333,13 +538,30 @@ case $basic_machine in
basic_machine=m68k-hp
os=-hpux
;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp
;;
hp9k3[2-9][0-9])
basic_machine=m68k-hp
;;
- hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][0-9] | hp8[0-9][0-9])
@@ -348,27 +570,42 @@ case $basic_machine in
hppa-next)
os=-nextstep3
;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
i370-ibm* | ibm*)
basic_machine=i370-ibm
- os=-mvs
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
- i[3456]86v32)
+ i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
- i[3456]86v4*)
+ i*86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
- i[3456]86v)
+ i*86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
- i[3456]86sol2)
+ i*86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
iris | iris4d)
basic_machine=mips-sgi
case $os in
@@ -394,16 +631,16 @@ case $basic_machine in
basic_machine=ns32k-utek
os=-sysv
;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
miniframe)
basic_machine=m68000-convergent
;;
- mipsel*-linux*)
- basic_machine=mipsel-unknown
- os=-linux
- ;;
- mips*-linux*)
- basic_machine=mips-unknown
- os=-linux
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
;;
mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
@@ -411,10 +648,38 @@ case $basic_machine in
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
+ mmix*)
+ basic_machine=mmix-knuth
+ os=-mmixware
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
os=-newsos
@@ -427,6 +692,10 @@ case $basic_machine in
basic_machine=mips-sony
os=-newsos
;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
next | m*-next )
basic_machine=m68k-next
case $os in
@@ -452,9 +721,44 @@ case $basic_machine in
basic_machine=i960-intel
os=-nindy
;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
np1)
basic_machine=np1-gould
;;
+ nv1)
+ basic_machine=nv1-cray
+ os=-unicosmp
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ or32 | or32-*)
+ basic_machine=or32-unknown
+ os=-coff
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
pa-hitachi)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
@@ -469,53 +773,95 @@ case $basic_machine in
pbb)
basic_machine=m68k-tti
;;
- pc532 | pc532-*)
+ pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
- pentium | p5)
- basic_machine=i586-intel
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
;;
- pentiumpro | p6)
- basic_machine=i686-intel
+ pentiumii | pentium2 | pentiumiii | pentium3)
+ basic_machine=i686-pc
;;
- pentium-* | p5-*)
+ pentium4)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
- pentiumpro-* | p6-*)
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
- k5)
- # We don't have specific support for AMD's K5 yet, so just call it a Pentium
- basic_machine=i586-amd
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
- nexen)
- # We don't have specific support for Nexgen yet, so just call it a Pentium
- basic_machine=i586-nexgen
+ pentium4-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pn)
basic_machine=pn-gould
;;
- power) basic_machine=rs6000-ibm
+ power) basic_machine=power-ibm
;;
ppc) basic_machine=powerpc-unknown
- ;;
+ ;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
- ;;
+ ;;
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
ps2)
basic_machine=i386-ibm
;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
rm[46]00)
basic_machine=mips-siemens
;;
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+ ;;
sequent)
basic_machine=i386-sequent
;;
@@ -523,6 +869,13 @@ case $basic_machine in
basic_machine=sh-hitachi
os=-hms
;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
sps7)
basic_machine=m68k-bull
os=-sysv2
@@ -530,6 +883,13 @@ case $basic_machine in
spur)
basic_machine=spur-unknown
;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
sun2)
basic_machine=m68000-sun
;;
@@ -570,19 +930,51 @@ case $basic_machine in
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
symmetry)
basic_machine=i386-sequent
os=-dynix
;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+ ;;
+ tic55x | c55x*)
+ basic_machine=tic55x-unknown
+ os=-coff
+ ;;
+ tic6x | c6x*)
+ basic_machine=tic6x-unknown
+ os=-coff
+ ;;
tx39)
basic_machine=mipstx39-unknown
;;
tx39el)
basic_machine=mipstx39el-unknown
;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
tower | tower-32)
basic_machine=m68k-ncr
;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
udi29k)
basic_machine=a29k-amd
os=-udi
@@ -591,6 +983,10 @@ case $basic_machine in
basic_machine=a29k-nyu
os=-sym1
;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
vaxv)
basic_machine=vax-dec
os=-sysv
@@ -600,8 +996,8 @@ case $basic_machine in
os=-vms
;;
vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
- ;;
+ basic_machine=f301-fujitsu
+ ;;
vxworks960)
basic_machine=i960-wrs
os=-vxworks
@@ -614,13 +1010,25 @@ case $basic_machine in
basic_machine=a29k-wrs
os=-vxworks
;;
- xmp)
- basic_machine=xmp-cray
- os=-unicos
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
;;
- xps | xps100)
+ xps | xps100)
basic_machine=xps100-honeywell
;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
none)
basic_machine=none-none
os=-none
@@ -628,12 +1036,14 @@ case $basic_machine in
# Here we handle the default manufacturer of certain CPU types. It is in
# some cases the only manufacturer, in others, it is the most popular.
- mips)
- if [ x$os = x-linux ]; then
- basic_machine=mips-unknown
- else
- basic_machine=mips-mips
- fi
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
;;
romp)
basic_machine=romp-ibm
@@ -644,16 +1054,26 @@ case $basic_machine in
vax)
basic_machine=vax-dec
;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
pdp11)
basic_machine=pdp11-dec
;;
we32k)
basic_machine=we32k-att
;;
- sparc)
+ sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparc | sparcv9 | sparcv9b)
basic_machine=sparc-sun
;;
- cydra)
+ cydra)
basic_machine=cydra-cydrome
;;
orion)
@@ -662,6 +1082,15 @@ case $basic_machine in
orion105)
basic_machine=clipper-highlevel
;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
@@ -676,10 +1105,6 @@ case $basic_machine in
*-commodore*)
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
;;
- human)
- basic_machine=m68k-sharp
- os=-human
- ;;
*)
;;
esac
@@ -705,7 +1130,7 @@ case $os in
os=-sysv4.2uw
;;
-gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ os=`echo $os | sed -e 's|gnu/linux|linux|'`
;;
# First accept the basic system types.
# The portable systems comes first.
@@ -718,20 +1143,63 @@ case $os in
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
- | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
+ | -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \
+ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -cygwin32* | -pe* | -psos* | -moss* | -proelf* \
- | -linux* | -bow* | -rhapsody* | -openstep* )
+ | -chorusos* | -chorusrdb* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto-qnx*)
+ ;;
+ -nto*)
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
+ -linux*)
+ os=-linux
+ ;;
-sunos5*)
os=`echo $os | sed -e 's|sunos5|solaris2|'`
;;
-sunos6*)
os=`echo $os | sed -e 's|sunos6|solaris3|'`
;;
+ -opened*)
+ os=-openedition
+ ;;
+ -os400*)
+ os=-os400
+ ;;
+ -wince*)
+ os=-wince
+ ;;
-osfrose*)
os=-osfrose
;;
@@ -747,11 +1215,26 @@ case $os in
-acis*)
os=-aos
;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -syllable*)
+ os=-syllable
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
-ctix* | -uts*)
os=-sysv
;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
-ns2 )
- os=-nextstep2
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
;;
# Preserve the version number of sinix5.
-sinix5.*)
@@ -760,6 +1243,9 @@ case $os in
-sinix*)
os=-sysv4
;;
+ -tpf*)
+ os=-tpf
+ ;;
-triton*)
os=-sysv3
;;
@@ -778,16 +1264,23 @@ case $os in
# This must come after -sysvr4.
-sysv*)
;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
-xenix)
os=-xenix
;;
- -uxpds)
- os=-uxpds
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
;;
- -human)
+ -aros*)
+ os=-aros
;;
- -beos)
- os=-beos
+ -kaos*)
+ os=-kaos
;;
-none)
;;
@@ -814,10 +1307,20 @@ case $basic_machine in
*-acorn)
os=-riscix1.2
;;
+ arm*-rebel)
+ os=-linux
+ ;;
arm*-semi)
os=-aout
;;
- pdp11-*)
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
os=-none
;;
*-dec | vax-*)
@@ -835,15 +1338,39 @@ case $basic_machine in
# default.
# os=-sunos4
;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
*-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3
;;
sparc-* | *-sun)
os=-sunos4.1.1
;;
+ *-be)
+ os=-beos
+ ;;
*-ibm)
os=-aix
;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
*-hp)
os=-hpux
;;
@@ -886,27 +1413,39 @@ case $basic_machine in
*-next)
os=-nextstep3
;;
- *-gould)
+ *-gould)
os=-sysv
;;
- *-highlevel)
+ *-highlevel)
os=-bsd
;;
*-encore)
os=-bsd
;;
- *-sgi)
+ *-sgi)
os=-irix
;;
- *-siemens)
+ *-siemens)
os=-sysv4
;;
*-masscomp)
os=-rtu
;;
- f301-fujitsu)
+ f30[01]-fujitsu | f700-fujitsu)
os=-uxpv
;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
*)
os=-none
;;
@@ -928,9 +1467,15 @@ case $basic_machine in
-aix*)
vendor=ibm
;;
+ -beos*)
+ vendor=be
+ ;;
-hpux*)
vendor=hp
;;
+ -mpeix*)
+ vendor=hp
+ ;;
-hiux*)
vendor=hitachi
;;
@@ -946,21 +1491,47 @@ case $basic_machine in
-genix*)
vendor=ns
;;
- -mvs*)
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -os400*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
- -vxsim* | -vxworks*)
+ -tpf*)
+ vendor=ibm
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
vendor=wrs
;;
-aux*)
vendor=apple
;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
esac
echo $basic_machine$os
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config_h.dj b/config_h.dj
deleted file mode 100644
index 2a81c29594..0000000000
--- a/config_h.dj
+++ /dev/null
@@ -1,64 +0,0 @@
-#define THREAD 1
-#define SIZEOF_INT 4
-#define SIZEOF_LONG 4
-#define SIZEOF_VOIDP 4
-#define HAVE_PROTOTYPES 1
-#define HAVE_STDARG_PROTOTYPES 1
-#define HAVE_ATTR_NORETURN 1
-#define HAVE_DIRENT_H 1
-#define STDC_HEADERS 1
-#define HAVE_STDLIB_H 1
-#define HAVE_UNISTD_H 1
-#define HAVE_LIMITS_H 1
-#define HAVE_SYS_FILE_H 1
-#define HAVE_SYS_IOCTL_H 1
-#define HAVE_PWD_H 1
-#define HAVE_SYS_TIME_H 1
-#define HAVE_SYS_TIMES_H 1
-#define HAVE_SYS_PARAM_H 1
-#define HAVE_SYS_WAIT_H 1
-#define HAVE_STRING_H 1
-#define HAVE_UTIME_H 1
-#define HAVE_MEMORY_H 1
-#define HAVE_DIRECT_H 1
-#define HAVE_ST_BLKSIZE 1
-#define HAVE_ST_RDEV 1
-#define GETGROUPS_T gid_t
-#define RETSIGTYPE void
-#define HAVE_ALLOCA 1
-#define vfork fork
-#define HAVE_DUP2 1
-#define HAVE_SETENV 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MKDIR 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRERROR 1
-#define HAVE_STRFTIME 1
-#define HAVE_STRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRDUP 1
-#define HAVE_FMOD 1
-#define HAVE_RANDOM 1
-#define HAVE_WAITPID 1
-#define HAVE_GETCWD 1
-#define HAVE_TRUNCATE 1
-#define HAVE_CHSIZE 1
-#define HAVE_TIMES 1
-#define HAVE_UTIMES 1
-#define HAVE_FCNTL 1
-/*#define HAVE_SETITIMER 1*/
-#define HAVE_GETGROUPS 1
-#define HAVE_SIGPROCMASK 1
-#define HAVE_SIGACTION 1
-#define HAVE_SETSID 1
-#define POSIX_SIGNAL 1
-#define BSD_SETPGRP setpgrp
-#define RSHIFT(x,y) ((x)>>y)
-#define FILE_COUNT _cnt
-#define DLEXT ".o"
-#define RUBY_LIB "/usr/local/lib/ruby"
-#define RUBY_SITE_LIB "/usr/local/lib/ruby/site_ruby"
-#define RUBY_ARCHLIB "/usr/local/lib/ruby/i386-djgpp"
-#define RUBY_SITE_ARCHLIB "/usr/local/lib/ruby/site_ruby/i386-djgpp"
-#define RUBY_PLATFORM "i386-djgpp"
diff --git a/config_s.dj b/config_s.dj
deleted file mode 100644
index d6d3836613..0000000000
--- a/config_s.dj
+++ /dev/null
@@ -1,49 +0,0 @@
-s%@CFLAGS@%-g -O2%g
-s%@CPPFLAGS@%%g
-s%@CXXFLAGS@%%g
-s%@DEFS@% -DTHREAD=1 -DSIZEOF_INT=4 -DSIZEOF_LONG=4 -DSIZEOF_VOIDP=4 -DHAVE_PROTOTYPES=1 -DHAVE_STDARG_PROTOTYPES=1 -DHAVE_ATTR_NORETURN=1 -DHAVE_DIRENT_H=1 -DSTDC_HEADERS=1 -DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_FILE_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_PWD_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TIMES_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_STRING_H=1 -DHAVE_UTIME_H=1 -DHAVE_MEMORY_H=1 -DHAVE_DIRECT_H=1 -DHAVE_ST_BLKSIZE=1 -DHAVE_ST_RDEV=1 -DGETGROUPS_T=gid_t -DRETSIGTYPE=void -DHAVE_ALLOCA=1 -Dvfork=fork -DHAVE_DUP2=1 -DHAVE_SETENV=1 -DHAVE_MEMMOVE=1 -DHAVE_MKDIR=1 -DHAVE_STRCASECMP=1 -DHAVE_STRERROR=1 -DHAVE_STRFTIME=1 -DHAVE_STRCHR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOUL=1 -DHAVE_STRDUP=1 -DHAVE_FMOD=1 -DHAVE_RANDOM=1 -DHAVE_WAITPID=1 -DHAVE_GETCWD=1 -DHAVE_TRUNCATE=1 -DHAVE_CHSIZE=1 -DHAVE_TIMES=1 -DHAVE_UTIMES=1 -DHAVE_FCNTL=1 -DHAVE_SETITIMER=1 -DHAVE_GETGROUPS=1 -DHAVE_SIGPROCMASK=1 -DHAVE_SIGACTION=1 -DHAVE_SETSID=1 -DPOSIX_SIGNAL=1 -DBSD_SETPGRP=setpgrp -DRSHIFT=\(x,y\)\ \(\(x\)\>\>y\) -DFILE_COUNT=_cnt -DDLEXT=\".so\" -DRUBY_LIB=\"/usr/local/lib/ruby\" -DRUBY_SITE_LIB=\"/usr/local/lib/ruby/site_ruby\" -DRUBY_ARCHLIB=\"/usr/local/lib/ruby/i386-djgpp\" -DRUBY_SITE_ARCHLIB=\"/usr/local/lib/ruby/site_ruby/i386-djgpp\" -DRUBY_PLATFORM=\"i386-djgpp\" %g
-s%@LDFLAGS@%%g
-s%@LIBS@%-lm %g
-s%@exec_prefix@%${prefix}%g
-s%@prefix@%/usr/local%g
-s%@program_transform_name@%s,x,x,%g
-s%@bindir@%${exec_prefix}/bin%g
-s%@sbindir@%${exec_prefix}/sbin%g
-s%@libexecdir@%${exec_prefix}/libexec%g
-s%@datadir@%${prefix}/share%g
-s%@sysconfdir@%${prefix}/etc%g
-s%@sharedstatedir@%${prefix}/com%g
-s%@localstatedir@%${prefix}/var%g
-s%@libdir@%${exec_prefix}/lib%g
-s%@includedir@%${prefix}/include%g
-s%@oldincludedir@%/usr/include%g
-s%@infodir@%${prefix}/info%g
-s%@mandir@%${prefix}/man%g
-s%@host@%i386-pc-djgpp%g
-s%@host_alias@%i386-djgpp%g
-s%@host_cpu@%i386%g
-s%@host_vendor@%pc%g
-s%@host_os@%djgpp%g
-s%@CC@%gcc%g
-s%@CPP@%gcc -E%g
-s%@YACC@%bison -y%g
-s%@RANLIB@%ranlib%g
-s%@AR@%ar%g
-s%@INSTALL_PROGRAM@%${INSTALL}%g
-s%@INSTALL_DATA@%${INSTALL} -m 644%g
-s%@SET_MAKE@%%g
-s%@LIBOBJS@% crypt.o flock.o snprintf.o%g
-s%@ALLOCA@%%g
-s%@DLDFLAGS@%%g
-s%@STATIC@%%g
-s%@CCDLFLAGS@%%g
-s%@LDSHARED@%ld%g
-s%@DLEXT@%o%g
-s%@STRIP@%strip%g
-s%@EXTSTATIC@%%g
-s%@binsuffix@%.exe%g
-s%@setup@%Setup%g
-s%@LIBRUBY@%libruby.a%g
-s%@LIBRUBYARG@%libruby.a%g
-s%@SOLIBS@%%g
-s%@arch@%i386-djgpp%g
diff --git a/configure b/configure
deleted file mode 100644
index b3e31db719..0000000000
--- a/configure
+++ /dev/null
@@ -1,4273 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.12
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-ac_help="$ac_help
---without-gcc never use gcc"
-ac_help="$ac_help
---disable-thread never use user-level thread"
-ac_help="$ac_help
---enable-fat-binary build a NeXT/Apple Multi Architecture Binary. "
-ac_help="$ac_help
---with-dln-a-out use dln_a_out if possible"
-ac_help="$ac_help
---with-static-linked-ext link external modules statically"
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-for ac_option
-do
-
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
- ac_prev=
- continue
- fi
-
- case "$ac_option" in
- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case "$ac_option" in
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir="$ac_optarg" ;;
-
- -build | --build | --buil | --bui | --bu)
- ac_prev=build ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$ac_optarg" ;;
-
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file="$ac_optarg" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_${ac_feature}='$ac_optarg'" ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix="$ac_optarg" ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
- -help | --help | --hel | --he)
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --program-prefix=PREFIX prepend PREFIX to installed program names
- --program-suffix=SUFFIX append SUFFIX to installed program names
- --program-transform-name=PROGRAM
- run sed PROGRAM on installed program names
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host="$ac_optarg" ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir="$ac_optarg" ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir="$ac_optarg" ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir="$ac_optarg" ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir="$ac_optarg" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir="$ac_optarg" ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir="$ac_optarg" ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- no_recursion=yes ;;
-
- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
- | --oldin | --oldi | --old | --ol | --o)
- ac_prev=oldincludedir ;;
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir="$ac_optarg" ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix="$ac_optarg" ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix="$ac_optarg" ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix="$ac_optarg" ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
- | --program-transform-n | --program-transform- \
- | --program-transform | --program-transfor \
- | --program-transfo | --program-transf \
- | --program-trans | --program-tran \
- | --progr-tra | --program-tr | --program-t)
- ac_prev=program_transform_name ;;
- -program-transform-name=* | --program-transform-name=* \
- | --program-transform-nam=* | --program-transform-na=* \
- | --program-transform-n=* | --program-transform-=* \
- | --program-transform=* | --program-transfor=* \
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name="$ac_optarg" ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- silent=yes ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir="$ac_optarg" ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir="$ac_optarg" ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
- site="$ac_optarg" ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir="$ac_optarg" ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir="$ac_optarg" ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.12"
- exit 0 ;;
-
- -with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "with_${ac_package}='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=no" ;;
-
- --x)
- # Obsolete; use --with-x.
- with_x=yes ;;
-
- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- | --x-incl | --x-inc | --x-in | --x-i)
- ac_prev=x_includes ;;
- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes="$ac_optarg" ;;
-
- -x-libraries | --x-libraries | --x-librarie | --x-librari \
- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- ac_prev=x_libraries ;;
- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries="$ac_optarg" ;;
-
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
- ;;
-
- *)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
- esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=ruby.h
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
- srcdir=..
- fi
-else
- ac_srcdir_defaulted=no
-fi
-if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
- else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
- fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-
-
-# Check whether --with-gcc or --without-gcc was given.
-if test "${with_gcc+set}" = set; then
- withval="$with_gcc"
-
- case $withval in
- no) CC=cc
- without_gcc=yes;;
- yes) CC=gcc
- without_gcc=no;;
- *) CC=$withval
- without_gcc=$withval;;
- esac
-else
- without_gcc=no
-fi
-
-if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
-then
- { echo "configure: error: cached CC is different -- throw away $cache_file
-(it is also a good idea to do 'make clean' before compiling)" 1>&2; exit 1; }
-fi
-
-rb_thread=yes
-# Check whether --enable-thread or --disable-thread was given.
-if test "${enable_thread+set}" = set; then
- enableval="$enable_thread"
-
- rb_thread=$enableval
-
-fi
-
-if test $rb_thread = yes; then
- cat >> confdefs.h <<\EOF
-#define THREAD 1
-EOF
-
-fi
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-
-# Make sure we can run config.sub.
-if $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:597: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
- case $nonopt in
- NONE)
- if host_alias=`$ac_config_guess`; then :
- else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
- fi ;;
- *) host_alias=$nonopt ;;
- esac ;;
-esac
-
-host=`$ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-
-fat_binary=no
-# Check whether --enable-fat-binary or --disable-fat-binary was given.
-if test "${enable_fat_binary+set}" = set; then
- enableval="$enable_fat_binary"
- fat_binary=$enableval
-fi
-
- if test "$fat_binary" = yes ; then
-
- echo $ac_n "checking target architecture ""... $ac_c" 1>&6
-echo "configure:628: checking target architecture " >&5
-
- if test "$host_os" = "rhapsody" ; then
- echo -n "Rhapsody: "
- if test "$TARGET_ARCHS" = "" ; then
- TARGET_ARCHS="ppc i486"
- fi
- else
- echo -n "NeXTSTEP/OPENSTEP: "
- if test "$TARGET_ARCHS" = "" ; then
- if test `/usr/bin/arch` = "m68k" ; then
- TARGET_ARCHS="m68k i486"
- else
- TARGET_ARCHS="m68k `/usr/bin/arch`"
- fi
- fi
- fi
- # /usr/lib/arch_tool -archify_list $TARGET_ARCHS
- for archs in $TARGET_ARCHS
- do
- ARCH_FLAG="$ARCH_FLAG -arch $archs "
- echo -n " $archs"
- done
- cat >> confdefs.h <<\EOF
-#define NEXT_FAT_BINARY 1
-EOF
-
- echo "."
-fi
-
-if test "$program_transform_name" = s,x,x,; then
- program_transform_name=
-else
- # Double any \ or $. echo might interpret backslashes.
- cat <<\EOF_SED > conftestsed
-s,\\,\\\\,g; s,\$,$$,g
-EOF_SED
- program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
- rm -f conftestsed
-fi
-test "$program_prefix" != NONE &&
- program_transform_name="s,^,${program_prefix},; $program_transform_name"
-# Use a double $ so make ignores it.
-test "$program_suffix" != NONE &&
- program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
-
-# sed with no file args requires a program.
-test "$program_transform_name" = "" && program_transform_name="s,x,x,"
-
-
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:681: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:710: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- ac_prog_rejected=no
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# -gt 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:758: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext <<EOF
-#line 768 "configure"
-#include "confdefs.h"
-main(){return(0);}
-EOF
-if { (eval echo configure:772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- ac_cv_prog_cc_works=yes
- # If we can't run a trivial program, we are probably using a cross compiler.
- if (./conftest; exit) 2>/dev/null; then
- ac_cv_prog_cc_cross=no
- else
- ac_cv_prog_cc_cross=yes
- fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cc_works=no
-fi
-rm -fr conftest*
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:792: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:797: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:806: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:821: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-O2"
- fi
-else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:849: checking how to run the C preprocessor" >&5
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- # This must be in double quotes, not single quotes, because CPP may get
- # substituted into the Makefile and "${CC-cc}" will confuse make.
- CPP="${CC-cc} -E"
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp.
- cat > conftest.$ac_ext <<EOF
-#line 864 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:870: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -E -traditional-cpp"
- cat > conftest.$ac_ext <<EOF
-#line 881 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:887: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP=/lib/cpp
-fi
-rm -f conftest*
-fi
-rm -f conftest*
- ac_cv_prog_CPP="$CPP"
-fi
- CPP="$ac_cv_prog_CPP"
-else
- ac_cv_prog_CPP="$CPP"
-fi
-echo "$ac_t""$CPP" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:911: checking whether ${CC-cc} needs -traditional" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_pattern="Autoconf.*'x'"
- cat > conftest.$ac_ext <<EOF
-#line 917 "configure"
-#include "confdefs.h"
-#include <sgtty.h>
-Autoconf TIOCGETP
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "$ac_pattern" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_prog_gcc_traditional=yes
-else
- rm -rf conftest*
- ac_cv_prog_gcc_traditional=no
-fi
-rm -f conftest*
-
-
- if test $ac_cv_prog_gcc_traditional = no; then
- cat > conftest.$ac_ext <<EOF
-#line 935 "configure"
-#include "confdefs.h"
-#include <termio.h>
-Autoconf TCGETA
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "$ac_pattern" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_prog_gcc_traditional=yes
-fi
-rm -f conftest*
-
- fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
- if test $ac_cv_prog_gcc_traditional = yes; then
- CC="$CC -traditional"
- fi
-fi
-
-for ac_prog in 'bison -y' byacc
-do
-# Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:961: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$YACC"; then
- ac_cv_prog_YACC="$YACC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_YACC="$ac_prog"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-YACC="$ac_cv_prog_YACC"
-if test -n "$YACC"; then
- echo "$ac_t""$YACC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-test -n "$YACC" && break
-done
-test -n "$YACC" || YACC="yacc"
-
-# Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:993: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-for ac_prog in ar aal
-do
-# Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1025: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$AR"; then
- ac_cv_prog_AR="$AR" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AR="$ac_prog"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-AR="$ac_cv_prog_AR"
-if test -n "$AR"; then
- echo "$ac_t""$AR" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-test -n "$AR" && break
-done
-test -n "$AR" || AR="ar"
-
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1065: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- for ac_prog in ginstall installbsd scoinst install; do
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- # OSF/1 installbsd also uses dspmsg, but is usable.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL="$ac_cv_path_install"
- else
- # As a last resort, use the slow shell script. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&6
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1115: checking whether ${MAKE-make} sets \${MAKE}" >&5
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftestmake <<\EOF
-all:
- @echo 'ac_maketemp="${MAKE}"'
-EOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
-if test -n "$ac_maketemp"; then
- eval ac_cv_prog_make_${ac_make}_set=yes
-else
- eval ac_cv_prog_make_${ac_make}_set=no
-fi
-rm -f conftestmake
-fi
-if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- SET_MAKE=
-else
- echo "$ac_t""no" 1>&6
- SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-
-# checks for UNIX variants that set C preprocessor variables
-ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6
-echo "configure:1145: checking for minix/config.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1150 "configure"
-#include "confdefs.h"
-#include <minix/config.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1155: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- MINIX=yes
-else
- echo "$ac_t""no" 1>&6
-MINIX=
-fi
-
-if test "$MINIX" = yes; then
- cat >> confdefs.h <<\EOF
-#define _POSIX_SOURCE 1
-EOF
-
- cat >> confdefs.h <<\EOF
-#define _POSIX_1_SOURCE 2
-EOF
-
- cat >> confdefs.h <<\EOF
-#define _MINIX 1
-EOF
-
-fi
-
-
-echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:1194: checking size of int" >&5
-if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
-else
- cat > conftest.$ac_ext <<EOF
-#line 1202 "configure"
-#include "confdefs.h"
-#include <stdio.h>
-main()
-{
- FILE *f=fopen("conftestval", "w");
- if (!f) exit(1);
- fprintf(f, "%d\n", sizeof(int));
- exit(0);
-}
-EOF
-if { (eval echo configure:1213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
- ac_cv_sizeof_int=`cat conftestval`
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_sizeof_int=0
-fi
-rm -fr conftest*
-fi
-
-fi
-echo "$ac_t""$ac_cv_sizeof_int" 1>&6
-cat >> confdefs.h <<EOF
-#define SIZEOF_INT $ac_cv_sizeof_int
-EOF
-
-
-echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:1233: checking size of long" >&5
-if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
-else
- cat > conftest.$ac_ext <<EOF
-#line 1241 "configure"
-#include "confdefs.h"
-#include <stdio.h>
-main()
-{
- FILE *f=fopen("conftestval", "w");
- if (!f) exit(1);
- fprintf(f, "%d\n", sizeof(long));
- exit(0);
-}
-EOF
-if { (eval echo configure:1252: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
- ac_cv_sizeof_long=`cat conftestval`
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_sizeof_long=0
-fi
-rm -fr conftest*
-fi
-
-fi
-echo "$ac_t""$ac_cv_sizeof_long" 1>&6
-cat >> confdefs.h <<EOF
-#define SIZEOF_LONG $ac_cv_sizeof_long
-EOF
-
-
-echo $ac_n "checking size of void*""... $ac_c" 1>&6
-echo "configure:1272: checking size of void*" >&5
-if eval "test \"`echo '$''{'ac_cv_sizeof_voidp'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
-else
- cat > conftest.$ac_ext <<EOF
-#line 1280 "configure"
-#include "confdefs.h"
-#include <stdio.h>
-main()
-{
- FILE *f=fopen("conftestval", "w");
- if (!f) exit(1);
- fprintf(f, "%d\n", sizeof(void*));
- exit(0);
-}
-EOF
-if { (eval echo configure:1291: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
- ac_cv_sizeof_voidp=`cat conftestval`
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_sizeof_voidp=0
-fi
-rm -fr conftest*
-fi
-
-fi
-echo "$ac_t""$ac_cv_sizeof_voidp" 1>&6
-cat >> confdefs.h <<EOF
-#define SIZEOF_VOIDP $ac_cv_sizeof_voidp
-EOF
-
-
-
-echo $ac_n "checking for prototypes""... $ac_c" 1>&6
-echo "configure:1312: checking for prototypes" >&5
-if eval "test \"`echo '$''{'rb_cv_have_prototypes'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1317 "configure"
-#include "confdefs.h"
-int foo(int x) { return 0; }
-int main() {
-return foo(10);
-; return 0; }
-EOF
-if { (eval echo configure:1324: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- rb_cv_have_prototypes=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- rb_cv_have_prototypes=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$rb_cv_have_prototypes" 1>&6
-if test "$rb_cv_have_prototypes" = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_PROTOTYPES 1
-EOF
-
-fi
-
-echo $ac_n "checking for variable length prototypes and stdarg.h""... $ac_c" 1>&6
-echo "configure:1345: checking for variable length prototypes and stdarg.h" >&5
-if eval "test \"`echo '$''{'rb_cv_stdarg'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1350 "configure"
-#include "confdefs.h"
-
-#include <stdarg.h>
-int foo(int x, ...) {
- va_list va;
- va_start(va, x);
- va_arg(va, int);
- va_arg(va, char *);
- va_arg(va, double);
- return 0;
-}
-
-int main() {
-return foo(10, "", 3.14);
-; return 0; }
-EOF
-if { (eval echo configure:1367: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- rb_cv_stdarg=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- rb_cv_stdarg=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$rb_cv_stdarg" 1>&6
-if test "$rb_cv_stdarg" = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_STDARG_PROTOTYPES 1
-EOF
-
-fi
-
-echo $ac_n "checking for gcc attribute noreturn""... $ac_c" 1>&6
-echo "configure:1388: checking for gcc attribute noreturn" >&5
-if eval "test \"`echo '$''{'rb_cv_have_attr_noreturn'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1393 "configure"
-#include "confdefs.h"
-void exit(int x) __attribute__ ((noreturn));
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:1400: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- rb_cv_have_attr_noreturn=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- rb_cv_have_attr_noreturn=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$rb_cv_have_attr_noreturn" 1>&6
-if test "$rb_cv_have_attr_noreturn" = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_ATTR_NORETURN 1
-EOF
-
-fi
-
-case "$host_os" in
-nextstep*) ;;
-openstep*) ;;
-rhapsody*) ;;
-human*) ;;
-beos*) ;;
-*) LIBS="-lm $LIBS";;
-esac
-echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:1429: checking for crypt in -lcrypt" >&5
-ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lcrypt $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1437 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char crypt();
-
-int main() {
-crypt()
-; return 0; }
-EOF
-if { (eval echo configure:1448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_lib=HAVE_LIB`echo crypt | sed -e 's/[^a-zA-Z0-9_]/_/g' \
- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
- LIBS="-lcrypt $LIBS"
-
-else
- echo "$ac_t""no" 1>&6
-fi
-
-echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:1476: checking for dlopen in -ldl" >&5
-ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-ldl $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1484 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char dlopen();
-
-int main() {
-dlopen()
-; return 0; }
-EOF
-if { (eval echo configure:1495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_lib=HAVE_LIB`echo dl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
- LIBS="-ldl $LIBS"
-
-else
- echo "$ac_t""no" 1>&6
-fi
- # Dynamic linking for SunOS/Solaris and SYSV
-echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
-echo "configure:1523: checking for shl_load in -ldld" >&5
-ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-ldld $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1531 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char shl_load();
-
-int main() {
-shl_load()
-; return 0; }
-EOF
-if { (eval echo configure:1542: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_lib=HAVE_LIB`echo dld | sed -e 's/[^a-zA-Z0-9_]/_/g' \
- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
- LIBS="-ldld $LIBS"
-
-else
- echo "$ac_t""no" 1>&6
-fi
- # Dynamic linking for HP-UX
-echo $ac_n "checking for setlocale in -lxpg4""... $ac_c" 1>&6
-echo "configure:1570: checking for setlocale in -lxpg4" >&5
-ac_lib_var=`echo xpg4'_'setlocale | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lxpg4 $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1578 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char setlocale();
-
-int main() {
-setlocale()
-; return 0; }
-EOF
-if { (eval echo configure:1589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_lib=HAVE_LIB`echo xpg4 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
- LIBS="-lxpg4 $LIBS"
-
-else
- echo "$ac_t""no" 1>&6
-fi
- # FreeBSD needs this
-
-ac_header_dirent=no
-for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:1622: checking for $ac_hdr that defines DIR" >&5
-if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1627 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <$ac_hdr>
-int main() {
-DIR *dirp = 0;
-; return 0; }
-EOF
-if { (eval echo configure:1635: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- eval "ac_cv_header_dirent_$ac_safe=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_dirent_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
- ac_header_dirent=$ac_hdr; break
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
-if test $ac_header_dirent = dirent.h; then
-echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:1660: checking for opendir in -ldir" >&5
-ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-ldir $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1668 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char opendir();
-
-int main() {
-opendir()
-; return 0; }
-EOF
-if { (eval echo configure:1679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- LIBS="$LIBS -ldir"
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
-echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:1701: checking for opendir in -lx" >&5
-ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lx $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1709 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char opendir();
-
-int main() {
-opendir()
-; return 0; }
-EOF
-if { (eval echo configure:1720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- LIBS="$LIBS -lx"
-else
- echo "$ac_t""no" 1>&6
-fi
-
-fi
-
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1743: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1748 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1756: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
- rm -rf conftest*
- ac_cv_header_stdc=yes
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1773 "configure"
-#include "confdefs.h"
-#include <string.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "memchr" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1791 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "free" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-if test "$cross_compiling" = yes; then
- :
-else
- cat > conftest.$ac_ext <<EOF
-#line 1812 "configure"
-#include "confdefs.h"
-#include <ctype.h>
-#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int main () { int i; for (i = 0; i < 256; i++)
-if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
-exit (0); }
-
-EOF
-if { (eval echo configure:1823: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
- :
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_header_stdc=no
-fi
-rm -fr conftest*
-fi
-
-fi
-fi
-
-echo "$ac_t""$ac_cv_header_stdc" 1>&6
-if test $ac_cv_header_stdc = yes; then
- cat >> confdefs.h <<\EOF
-#define STDC_HEADERS 1
-EOF
-
-fi
-
-for ac_hdr in stdlib.h unistd.h limits.h sys/file.h sys/ioctl.h pwd.h \
- sys/select.h sys/time.h sys/times.h sys/param.h sys/wait.h\
- syscall.h a.out.h string.h utime.h memory.h direct.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1852: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1857 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1862: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-
-echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:1890: checking for uid_t in sys/types.h" >&5
-if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1895 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "uid_t" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_uid_t=yes
-else
- rm -rf conftest*
- ac_cv_type_uid_t=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_type_uid_t" 1>&6
-if test $ac_cv_type_uid_t = no; then
- cat >> confdefs.h <<\EOF
-#define uid_t int
-EOF
-
- cat >> confdefs.h <<\EOF
-#define gid_t int
-EOF
-
-fi
-
-echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1924: checking for size_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1929 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_size_t=yes
-else
- rm -rf conftest*
- ac_cv_type_size_t=no
-fi
-rm -f conftest*
-
-fi
-echo "$ac_t""$ac_cv_type_size_t" 1>&6
-if test $ac_cv_type_size_t = no; then
- cat >> confdefs.h <<\EOF
-#define size_t unsigned
-EOF
-
-fi
-
-echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6
-echo "configure:1957: checking for st_blksize in struct stat" >&5
-if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1962 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-int main() {
-struct stat s; s.st_blksize;
-; return 0; }
-EOF
-if { (eval echo configure:1970: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_struct_st_blksize=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_struct_st_blksize=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_struct_st_blksize" 1>&6
-if test $ac_cv_struct_st_blksize = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_ST_BLKSIZE 1
-EOF
-
-fi
-
-save_LIBOJBS="$LIBOBJS"
-echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6
-echo "configure:1992: checking for st_blocks in struct stat" >&5
-if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1997 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-int main() {
-struct stat s; s.st_blocks;
-; return 0; }
-EOF
-if { (eval echo configure:2005: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_struct_st_blocks=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_struct_st_blocks=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_struct_st_blocks" 1>&6
-if test $ac_cv_struct_st_blocks = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_ST_BLOCKS 1
-EOF
-
-else
- LIBOBJS="$LIBOBJS fileblocks.o"
-fi
-
-LIBOBJS="$save_LIBOBJS"
-echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6
-echo "configure:2029: checking for st_rdev in struct stat" >&5
-if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2034 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-int main() {
-struct stat s; s.st_rdev;
-; return 0; }
-EOF
-if { (eval echo configure:2042: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_struct_st_rdev=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_struct_st_rdev=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_struct_st_rdev" 1>&6
-if test $ac_cv_struct_st_rdev = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_ST_RDEV 1
-EOF
-
-fi
-
-
-echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6
-echo "configure:2064: checking type of array argument to getgroups" >&5
-if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- ac_cv_type_getgroups=cross
-else
- cat > conftest.$ac_ext <<EOF
-#line 2072 "configure"
-#include "confdefs.h"
-
-/* Thanks to Mike Rendell for this test. */
-#include <sys/types.h>
-#define NGID 256
-#undef MAX
-#define MAX(x, y) ((x) > (y) ? (x) : (y))
-main()
-{
- gid_t gidset[NGID];
- int i, n;
- union { gid_t gval; long lval; } val;
-
- val.lval = -1;
- for (i = 0; i < NGID; i++)
- gidset[i] = val.gval;
- n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1,
- gidset);
- /* Exit non-zero if getgroups seems to require an array of ints. This
- happens when gid_t is short but getgroups modifies an array of ints. */
- exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0);
-}
-
-EOF
-if { (eval echo configure:2097: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
- ac_cv_type_getgroups=gid_t
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_type_getgroups=int
-fi
-rm -fr conftest*
-fi
-
-if test $ac_cv_type_getgroups = cross; then
- cat > conftest.$ac_ext <<EOF
-#line 2111 "configure"
-#include "confdefs.h"
-#include <unistd.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "getgroups.*int.*gid_t" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_getgroups=gid_t
-else
- rm -rf conftest*
- ac_cv_type_getgroups=int
-fi
-rm -f conftest*
-
-fi
-fi
-
-echo "$ac_t""$ac_cv_type_getgroups" 1>&6
-cat >> confdefs.h <<EOF
-#define GETGROUPS_T $ac_cv_type_getgroups
-EOF
-
-
-echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:2135: checking return type of signal handlers" >&5
-if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2140 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <signal.h>
-#ifdef signal
-#undef signal
-#endif
-#ifdef __cplusplus
-extern "C" void (*signal (int, void (*)(int)))(int);
-#else
-void (*signal ()) ();
-#endif
-
-int main() {
-int i;
-; return 0; }
-EOF
-if { (eval echo configure:2157: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_type_signal=void
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_type_signal=int
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_type_signal" 1>&6
-cat >> confdefs.h <<EOF
-#define RETSIGTYPE $ac_cv_type_signal
-EOF
-
-
-# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
-# for constant arguments. Useless!
-echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:2178: checking for working alloca.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2183 "configure"
-#include "confdefs.h"
-#include <alloca.h>
-int main() {
-char *p = alloca(2 * sizeof(int));
-; return 0; }
-EOF
-if { (eval echo configure:2190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- ac_cv_header_alloca_h=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_alloca_h=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
-if test $ac_cv_header_alloca_h = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_ALLOCA_H 1
-EOF
-
-fi
-
-echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:2211: checking for alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2216 "configure"
-#include "confdefs.h"
-
-#ifdef __GNUC__
-# define alloca __builtin_alloca
-#else
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- #pragma alloca
-# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-# endif
-# endif
-# endif
-#endif
-
-int main() {
-char *p = (char *) alloca(1);
-; return 0; }
-EOF
-if { (eval echo configure:2239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- ac_cv_func_alloca_works=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_func_alloca_works=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
-if test $ac_cv_func_alloca_works = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_ALLOCA 1
-EOF
-
-fi
-
-if test $ac_cv_func_alloca_works = no; then
- # The SVR3 libPW and SVR4 libucb both contain incompatible functions
- # that cause trouble. Some versions do not even contain alloca or
- # contain a buggy version. If you still want to use their alloca,
- # use ar to extract alloca.o from them instead of compiling alloca.c.
- ALLOCA=alloca.o
- cat >> confdefs.h <<\EOF
-#define C_ALLOCA 1
-EOF
-
-
-echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:2271: checking whether alloca needs Cray hooks" >&5
-if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2276 "configure"
-#include "confdefs.h"
-#if defined(CRAY) && ! defined(CRAY2)
-webecray
-#else
-wenotbecray
-#endif
-
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "webecray" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_os_cray=yes
-else
- rm -rf conftest*
- ac_cv_os_cray=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_os_cray" 1>&6
-if test $ac_cv_os_cray = yes; then
-for ac_func in _getb67 GETB67 getb67; do
- echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2301: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2306 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<EOF
-#define CRAY_STACKSEG_END $ac_func
-EOF
-
- break
-else
- echo "$ac_t""no" 1>&6
-fi
-
-done
-fi
-
-echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:2356: checking stack direction for C alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- ac_cv_c_stack_direction=0
-else
- cat > conftest.$ac_ext <<EOF
-#line 2364 "configure"
-#include "confdefs.h"
-find_stack_direction ()
-{
- static char *addr = 0;
- auto char dummy;
- if (addr == 0)
- {
- addr = &dummy;
- return find_stack_direction ();
- }
- else
- return (&dummy > addr) ? 1 : -1;
-}
-main ()
-{
- exit (find_stack_direction() < 0);
-}
-EOF
-if { (eval echo configure:2383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
- ac_cv_c_stack_direction=1
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_c_stack_direction=-1
-fi
-rm -fr conftest*
-fi
-
-fi
-
-echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
-cat >> confdefs.h <<EOF
-#define STACK_DIRECTION $ac_cv_c_stack_direction
-EOF
-
-fi
-
-echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:2405: checking for pid_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2410 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_pid_t=yes
-else
- rm -rf conftest*
- ac_cv_type_pid_t=no
-fi
-rm -f conftest*
-
-fi
-echo "$ac_t""$ac_cv_type_pid_t" 1>&6
-if test $ac_cv_type_pid_t = no; then
- cat >> confdefs.h <<\EOF
-#define pid_t int
-EOF
-
-fi
-
-ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
-echo "configure:2439: checking for vfork.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2444 "configure"
-#include "confdefs.h"
-#include <vfork.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2449: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<\EOF
-#define HAVE_VFORK_H 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-
-echo $ac_n "checking for working vfork""... $ac_c" 1>&6
-echo "configure:2474: checking for working vfork" >&5
-if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- echo $ac_n "checking for vfork""... $ac_c" 1>&6
-echo "configure:2480: checking for vfork" >&5
-if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2485 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char vfork(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char vfork();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_vfork) || defined (__stub___vfork)
-choke me
-#else
-vfork();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_func_vfork=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_vfork=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- :
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- cat > conftest.$ac_ext <<EOF
-#line 2529 "configure"
-#include "confdefs.h"
-/* Thanks to Paul Eggert for this test. */
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_VFORK_H
-#include <vfork.h>
-#endif
-/* On some sparc systems, changes by the child to local and incoming
- argument registers are propagated back to the parent.
- The compiler is told about this with #include <vfork.h>,
- but some compilers (e.g. gcc -O) don't grok <vfork.h>.
- Test for this by using a static variable whose address
- is put into a register that is clobbered by the vfork. */
-static
-#ifdef __cplusplus
-sparc_address_test (int arg)
-#else
-sparc_address_test (arg) int arg;
-#endif
-{
- static pid_t child;
- if (!child) {
- child = vfork ();
- if (child < 0) {
- perror ("vfork");
- _exit(2);
- }
- if (!child) {
- arg = getpid();
- write(-1, "", 0);
- _exit (arg);
- }
- }
-}
-main() {
- pid_t parent = getpid ();
- pid_t child;
-
- sparc_address_test ();
-
- child = vfork ();
-
- if (child == 0) {
- /* Here is another test for sparc vfork register problems.
- This test uses lots of local variables, at least
- as many local variables as main has allocated so far
- including compiler temporaries. 4 locals are enough for
- gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe.
- A buggy compiler should reuse the register of parent
- for one of the local variables, since it will think that
- parent can't possibly be used any more in this routine.
- Assigning to the local variable will thus munge parent
- in the parent process. */
- pid_t
- p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
- p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
- /* Convince the compiler that p..p7 are live; otherwise, it might
- use the same hardware register for all 8 local variables. */
- if (p != p1 || p != p2 || p != p3 || p != p4
- || p != p5 || p != p6 || p != p7)
- _exit(1);
-
- /* On some systems (e.g. IRIX 3.3),
- vfork doesn't separate parent from child file descriptors.
- If the child closes a descriptor before it execs or exits,
- this munges the parent's descriptor as well.
- Test for this by closing stdout in the child. */
- _exit(close(fileno(stdout)) != 0);
- } else {
- int status;
- struct stat st;
-
- while (wait(&status) != child)
- ;
- exit(
- /* Was there some problem with vforking? */
- child < 0
-
- /* Did the child fail? (This shouldn't happen.) */
- || status
-
- /* Did the vfork/compiler bug occur? */
- || parent != getpid()
-
- /* Did the file descriptor bug occur? */
- || fstat(fileno(stdout), &st) != 0
- );
- }
-}
-EOF
-if { (eval echo configure:2624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
- ac_cv_func_vfork_works=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_func_vfork_works=no
-fi
-rm -fr conftest*
-fi
-
-fi
-
-echo "$ac_t""$ac_cv_func_vfork_works" 1>&6
-if test $ac_cv_func_vfork_works = no; then
- cat >> confdefs.h <<\EOF
-#define vfork fork
-EOF
-
-fi
-
-echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:2647: checking for 8-bit clean memcmp" >&5
-if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- ac_cv_func_memcmp_clean=no
-else
- cat > conftest.$ac_ext <<EOF
-#line 2655 "configure"
-#include "confdefs.h"
-
-main()
-{
- char c0 = 0x40, c1 = 0x80, c2 = 0x81;
- exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
-}
-
-EOF
-if { (eval echo configure:2665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
- ac_cv_func_memcmp_clean=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_func_memcmp_clean=no
-fi
-rm -fr conftest*
-fi
-
-fi
-
-echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
-test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.o"
-
-for ac_func in dup2 setenv memmove mkdir strcasecmp strerror strftime\
- strchr strstr strtoul strdup crypt flock snprintf
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2686: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2691 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-LIBOBJS="$LIBOBJS ${ac_func}.o"
-fi
-done
-
-
-for ac_func in fmod killpg drand48 random wait4 waitpid syscall getcwd\
- truncate chsize times utimes fcntl lockf setitimer\
- setruid seteuid setreuid setrgid setegid setregid\
- setpgrp2 getpgid getgroups getpriority\
- dlopen sigprocmask sigaction _setjmp setpgrp setsid
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2747: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2752 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2775: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-if test "$ac_cv_func_strftime" = no; then
- echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:2801: checking whether struct tm is in sys/time.h or time.h" >&5
-if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2806 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <time.h>
-int main() {
-struct tm *tp; tp->tm_sec;
-; return 0; }
-EOF
-if { (eval echo configure:2814: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_struct_tm=time.h
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_struct_tm=sys/time.h
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_struct_tm" 1>&6
-if test $ac_cv_struct_tm = sys/time.h; then
- cat >> confdefs.h <<\EOF
-#define TM_IN_SYS_TIME 1
-EOF
-
-fi
-
-echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
-echo "configure:2835: checking for tm_zone in struct tm" >&5
-if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2840 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <$ac_cv_struct_tm>
-int main() {
-struct tm tm; tm.tm_zone;
-; return 0; }
-EOF
-if { (eval echo configure:2848: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_struct_tm_zone=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_struct_tm_zone=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_struct_tm_zone" 1>&6
-if test "$ac_cv_struct_tm_zone" = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_TM_ZONE 1
-EOF
-
-else
- echo $ac_n "checking for tzname""... $ac_c" 1>&6
-echo "configure:2868: checking for tzname" >&5
-if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2873 "configure"
-#include "confdefs.h"
-#include <time.h>
-#ifndef tzname /* For SGI. */
-extern char *tzname[]; /* RS6000 and others reject char **tzname. */
-#endif
-int main() {
-atoi(*tzname);
-; return 0; }
-EOF
-if { (eval echo configure:2883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- ac_cv_var_tzname=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_var_tzname=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_var_tzname" 1>&6
- if test $ac_cv_var_tzname = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_TZNAME 1
-EOF
-
- fi
-fi
-
- cat > conftest.$ac_ext <<EOF
-#line 2905 "configure"
-#include "confdefs.h"
-
-int main() {
-extern int daylight; int i = daylight;
-; return 0; }
-EOF
-if { (eval echo configure:2912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- cat >> confdefs.h <<\EOF
-#define HAVE_DAYLIGHT 1
-EOF
-
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
-fi
-rm -f conftest*
-fi
-
-if test "$ac_cv_func_sigprocmask" = yes && test "$ac_cv_func_sigaction" = yes; then
- cat >> confdefs.h <<\EOF
-#define POSIX_SIGNAL 1
-EOF
-
-else
- echo $ac_n "checking for BSD signal semantics""... $ac_c" 1>&6
-echo "configure:2932: checking for BSD signal semantics" >&5
- if eval "test \"`echo '$''{'rb_cv_bsd_signal'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
-else
- cat > conftest.$ac_ext <<EOF
-#line 2940 "configure"
-#include "confdefs.h"
-
-#include <stdio.h>
-#include <signal.h>
-
-void
-sig_handler(dummy)
- int dummy;
-{
-}
-
-int
-main()
-{
- signal(SIGINT, sig_handler);
- kill(getpid(), SIGINT);
- kill(getpid(), SIGINT);
- return 0;
-}
-
-EOF
-if { (eval echo configure:2962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
- rb_cv_bsd_signal=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- rb_cv_bsd_signal=no
-fi
-rm -fr conftest*
-fi
-
-fi
-
- echo "$ac_t""$rb_cv_bsd_signal" 1>&6
- if test "$rb_cv_bsd_signal" = yes; then
- cat >> confdefs.h <<\EOF
-#define BSD_SIGNAL 1
-EOF
-
- fi
-fi
-
-if test "$ac_cv_func_setpgrp2" = yes; then
- cat >> confdefs.h <<\EOF
-#define BSD_GETPGRP getpgrp2
-EOF
-
- cat >> confdefs.h <<\EOF
-#define BSD_SETPGRP setpgrp2
-EOF
-
-else
- echo $ac_n "checking whether getpgrp() has arg""... $ac_c" 1>&6
-echo "configure:2996: checking whether getpgrp() has arg" >&5
- if eval "test \"`echo '$''{'rb_cv_bsdgetpgrp'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 3001 "configure"
-#include "confdefs.h"
-#include <unistd.h>
-int main() {
-getpgrp(0);
-; return 0; }
-EOF
-if { (eval echo configure:3008: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- rb_cv_bsdgetpgrp=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- rb_cv_bsdgetpgrp=no
-fi
-rm -f conftest*
-fi
-
- echo "$ac_t""$rb_cv_bsdgetpgrp" 1>&6
- if test "$rb_cv_bsdgetpgrp" = yes; then
- cat >> confdefs.h <<\EOF
-#define BSD_GETPGRP getpgrp
-EOF
-
- fi
-
- echo $ac_n "checking whether setpgrp() has args""... $ac_c" 1>&6
-echo "configure:3029: checking whether setpgrp() has args" >&5
- if eval "test \"`echo '$''{'rb_cv_bsdsetpgrp'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 3034 "configure"
-#include "confdefs.h"
-#include <unistd.h>
-int main() {
-setpgrp(1, 1);
-; return 0; }
-EOF
-if { (eval echo configure:3041: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- rb_cv_bsdsetpgrp=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- rb_cv_bsdsetpgrp=no
-fi
-rm -f conftest*
-fi
-
- echo "$ac_t""$rb_cv_bsdsetpgrp" 1>&6
- if test "$rb_cv_bsdsetpgrp" = yes; then
- cat >> confdefs.h <<\EOF
-#define BSD_SETPGRP setpgrp
-EOF
-
- fi
-fi
-
-echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:3063: checking whether byte ordering is bigendian" >&5
-if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_cv_c_bigendian=unknown
-# See if sys/param.h defines the BYTE_ORDER macro.
-cat > conftest.$ac_ext <<EOF
-#line 3070 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <sys/param.h>
-int main() {
-
-#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
- bogus endian macros
-#endif
-; return 0; }
-EOF
-if { (eval echo configure:3081: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- # It does; now see whether it defined to BIG_ENDIAN or not.
-cat > conftest.$ac_ext <<EOF
-#line 3085 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <sys/param.h>
-int main() {
-
-#if BYTE_ORDER != BIG_ENDIAN
- not big endian
-#endif
-; return 0; }
-EOF
-if { (eval echo configure:3096: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_c_bigendian=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_c_bigendian=no
-fi
-rm -f conftest*
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
-fi
-rm -f conftest*
-if test $ac_cv_c_bigendian = unknown; then
-if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
-else
- cat > conftest.$ac_ext <<EOF
-#line 3116 "configure"
-#include "confdefs.h"
-main () {
- /* Are we little or big endian? From Harbison&Steele. */
- union
- {
- long l;
- char c[sizeof (long)];
- } u;
- u.l = 1;
- exit (u.c[sizeof (long) - 1] == 1);
-}
-EOF
-if { (eval echo configure:3129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
- ac_cv_c_bigendian=no
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_c_bigendian=yes
-fi
-rm -fr conftest*
-fi
-
-fi
-fi
-
-echo "$ac_t""$ac_cv_c_bigendian" 1>&6
-if test $ac_cv_c_bigendian = yes; then
- cat >> confdefs.h <<\EOF
-#define WORDS_BIGENDIAN 1
-EOF
-
-fi
-
-echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6
-echo "configure:3153: checking whether char is unsigned" >&5
-if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$GCC" = yes; then
- # GCC predefines this symbol on systems where it applies.
-cat > conftest.$ac_ext <<EOF
-#line 3160 "configure"
-#include "confdefs.h"
-#ifdef __CHAR_UNSIGNED__
- yes
-#endif
-
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "yes" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_c_char_unsigned=yes
-else
- rm -rf conftest*
- ac_cv_c_char_unsigned=no
-fi
-rm -f conftest*
-
-else
-if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
-else
- cat > conftest.$ac_ext <<EOF
-#line 3182 "configure"
-#include "confdefs.h"
-/* volatile prevents gcc2 from optimizing the test away on sparcs. */
-#if !defined(__STDC__) || __STDC__ != 1
-#define volatile
-#endif
-main() {
- volatile char c = 255; exit(c < 0);
-}
-EOF
-if { (eval echo configure:3192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
- ac_cv_c_char_unsigned=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_c_char_unsigned=no
-fi
-rm -fr conftest*
-fi
-
-fi
-fi
-
-echo "$ac_t""$ac_cv_c_char_unsigned" 1>&6
-if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
- cat >> confdefs.h <<\EOF
-#define __CHAR_UNSIGNED__ 1
-EOF
-
-fi
-
-
-echo $ac_n "checking whether right shift preserve sign bit""... $ac_c" 1>&6
-echo "configure:3217: checking whether right shift preserve sign bit" >&5
-if eval "test \"`echo '$''{'rb_cv_rshift_sign'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
-else
- cat > conftest.$ac_ext <<EOF
-#line 3225 "configure"
-#include "confdefs.h"
-
-int
-main()
-{
- if (-1==(-1>>1))
- return 0;
- return 1;
-}
-
-EOF
-if { (eval echo configure:3237: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
- rb_cv_rshift_sign=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- rb_cv_rshift_sign=no
-fi
-rm -fr conftest*
-fi
-
-fi
-
- echo "$ac_t""$rb_cv_rshift_sign" 1>&6
-if test "$rb_cv_rshift_sign" = yes; then
- cat >> confdefs.h <<\EOF
-#define RSHIFT(x,y) ((x)>>y)
-EOF
-
-else
- cat >> confdefs.h <<\EOF
-#define RSHIFT(x,y) (((x)<0) ? ~((~(x))>>y) : (x)>>y)
-EOF
-
-fi
-
-echo $ac_n "checking count field in FILE structures""... $ac_c" 1>&6
-echo "configure:3265: checking count field in FILE structures" >&5
-if eval "test \"`echo '$''{'rb_cv_fcnt'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 3270 "configure"
-#include "confdefs.h"
-#include <stdio.h>
-int main() {
-FILE *f = stdin; f->_cnt = 0;
-; return 0; }
-EOF
-if { (eval echo configure:3277: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- rb_cv_fcnt="_cnt"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
-fi
-rm -f conftest*
-if test "$rb_cv_fcnt" = ""; then
- cat > conftest.$ac_ext <<EOF
-#line 3287 "configure"
-#include "confdefs.h"
-#include <stdio.h>
-int main() {
-FILE *f = stdin; f->__cnt = 0;
-; return 0; }
-EOF
-if { (eval echo configure:3294: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- rb_cv_fcnt="__cnt"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
-fi
-rm -f conftest*
-fi
-if test "$rb_cv_fcnt" = ""; then
- cat > conftest.$ac_ext <<EOF
-#line 3305 "configure"
-#include "confdefs.h"
-#include <stdio.h>
-int main() {
-FILE *f = stdin; f->_r = 0;
-; return 0; }
-EOF
-if { (eval echo configure:3312: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- rb_cv_fcnt="_r"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
-fi
-rm -f conftest*
-fi
-if test "$rb_cv_fcnt" = ""; then
- cat > conftest.$ac_ext <<EOF
-#line 3323 "configure"
-#include "confdefs.h"
-#include <stdio.h>
-int main() {
-FILE *f = stdin; f->readCount = 0;
-; return 0; }
-EOF
-if { (eval echo configure:3330: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- rb_cv_fcnt="readCount"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- rb_cv_fcnt="not found"
-fi
-rm -f conftest*
-fi
-fi
-
-if test "$rb_cv_fcnt" = "not found"; then
- echo "$ac_t""not found(OK if using GNU libc)" 1>&6
-else
- echo "$ac_t""$rb_cv_fcnt" 1>&6
- cat >> confdefs.h <<EOF
-#define FILE_COUNT $rb_cv_fcnt
-EOF
-
-fi
-
-# Check whether --with-dln-a-out or --without-dln-a-out was given.
-if test "${with_dln_a_out+set}" = set; then
- withval="$with_dln_a_out"
-
- case $withval in
- yes) with_dln_a_out=yes;;
- *) with_dln_a_out=no;;
- esac
-else
- with_dln_a_out=no
-fi
-
-
-case "$host_os" in
- linux*)
- echo $ac_n "checking whether ELF binaries are produced""... $ac_c" 1>&6
-echo "configure:3369: checking whether ELF binaries are produced" >&5
- if eval "test \"`echo '$''{'rb_cv_linux_elf'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- :
-else
- cat > conftest.$ac_ext <<EOF
-#line 3377 "configure"
-#include "confdefs.h"
-
-/* Test for whether ELF binaries are produced */
-#include <fcntl.h>
-#include <stdlib.h>
-main() {
- char buffer[4];
- int i=open("conftest",O_RDONLY);
- if(i==-1)
- exit(1); /* fail */
- if(read(i,&buffer[0],4)<4)
- exit(1); /* fail */
- if(buffer[0] != 127 || buffer[1] != 'E' ||
- buffer[2] != 'L' || buffer[3] != 'F')
- exit(1); /* fail */
- exit(0); /* succeed (yes, it's ELF) */
-}
-
-EOF
-if { (eval echo configure:3397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
- rb_cv_linux_elf=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- rb_cv_linux_elf=no
-fi
-rm -fr conftest*
-fi
-
-fi
-
- echo "$ac_t""$rb_cv_linux_elf" 1>&6
- if test "$rb_cv_linux_elf" = no; then
- with_dln_a_out=yes
- host_os=linux-a.out
- else
- LDFLAGS="-rdynamic"
- fi;;
-esac
-
-
-
-STATIC=
-
-if test "$with_dln_a_out" != yes; then
- rb_cv_dlopen=unknown
- echo $ac_n "checking whether OS depend dynamic link works""... $ac_c" 1>&6
-echo "configure:3427: checking whether OS depend dynamic link works" >&5
- if test "$GCC" = yes; then
- case "$host_os" in
- nextstep*) ;;
- openstep*) ;;
- rhapsody*) ;;
- human*) ;;
- cygwin32*) CCDLFLAGS=-DDLLIMPORT;;
- *) CCDLFLAGS=-fpic;;
- esac
- else
- case "$host_os" in
- hpux*) CCDLFLAGS='+z';;
- solaris*|irix*) CCDLFLAGS='-K pic' ;;
- sunos*) CCDLFLAGS='-pic' ;;
- esix*|uxpds*) CCDLFLAGS='-Kpic' ;;
- *) CCDLFLAGS='' ;;
- esac
- fi
-
- case "$host_os" in
- hpux*) DLDFLAGS="-E"
- LDSHARED='ld -b'
- LDFLAGS="-Wl,-E"
- rb_cv_dlopen=yes;;
- solaris*) LDSHARED='ld -G'
- rb_cv_dlopen=yes;;
- sunos*) LDSHARED='ld -assert nodefinitions'
- rb_cv_dlopen=yes;;
- irix*) LDSHARED='ld -ignore_unresolved'
- rb_cv_dlopen=yes;;
- sysv4*) LDSHARED='ld -G'
- rb_cv_dlopen=yes;;
- esix*|uxpds*) LDSHARED="ld -G"
- rb_cv_dlopen=yes ;;
- linux*) LDSHARED="gcc -shared"
- rb_cv_dlopen=yes ;;
- freebsd*) LDSHARED="ld -Bshareable"
- rb_cv_dlopen=yes ;;
- netbsd*) LDSHARED="ld -Bshareable"
- rb_cv_dlopen=yes ;;
- openbsd*) LDSHARED="ld -Bshareable"
- rb_cv_dlopen=yes ;;
- nextstep*) LDSHARED='cc -r'
- LDFLAGS="-u libsys_s"
- DLDFLAGS="$ARCH_FLAG"
- rb_cv_dlopen=yes ;;
- openstep*) LDSHARED='cc -dynamic -bundle -undefined suppress'
- LDFLAGS=""
- DLDFLAGS="$ARCH_FLAG"
- rb_cv_dlopen=yes ;;
- rhapsody*) LDSHARED='cc -dynamic -bundle -undefined suppress'
- LDFLAGS=""
- DLDFLAGS="$ARCH_FLAG"
- rb_cv_dlopen=yes ;;
- aix*) LDSHARED='../../miniruby ../aix_ld.rb $(TARGET)'
- rb_cv_dlopen=yes ;;
- human*) DLDFLAGS=''
- LDSHARED=''
- LDFLAGS='' ;;
- beos*) LDSHARED="ld -xms"
- case "$host_cpu" in
- powerpc*)
- DLDFLAGS="-f ruby.exp -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o"
- ;;
- *)
- DLDFLAGS="ruby.def -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o"
- ;;
- esac
- rb_cv_dlopen=yes ;;
- cygwin32*) LDSHARED='../../miniruby ../cygwin32_ld.rb' ;;
- *) LDSHARED='ld' ;;
- esac
- echo "$ac_t""$rb_cv_dlopen" 1>&6
-fi
-
-dln_a_out_works=no
-if test "$ac_cv_header_a_out_h" = yes; then
- if test "$with_dln_a_out" = yes || test "$rb_cv_dlopen" = unknown; then
- echo $ac_n "checking whether matz's dln works""... $ac_c" 1>&6
-echo "configure:3507: checking whether matz's dln works" >&5
- cat confdefs.h > config.h
- if eval "test \"`echo '$''{'rb_cv_dln_a_out'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 3513 "configure"
-#include "confdefs.h"
-
-#define USE_DLN_A_OUT
-#include "dln.c"
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:3523: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- rb_cv_dln_a_out=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- rb_cv_dln_a_out=no
-fi
-rm -f conftest*
-fi
-
- echo "$ac_t""$rb_cv_dln_a_out" 1>&6
- if test "$rb_cv_dln_a_out" = yes; then
- dln_a_out_works=yes
- cat >> confdefs.h <<\EOF
-#define USE_DLN_A_OUT 1
-EOF
-
- fi
- fi
-fi
-
-if test "$dln_a_out_works" = yes; then
- if test "$GCC" = yes; then
- STATIC=-static
- else
- STATIC=-Bstatic
- fi
- DLEXT=o
- cat >> confdefs.h <<\EOF
-#define DLEXT ".o"
-EOF
-
- CCDLFLAGS=
-else
- case "$host_os" in
- hpux*) DLEXT=sl
- cat >> confdefs.h <<\EOF
-#define DLEXT ".sl"
-EOF
-;;
- nextstep*) DLEXT=o
- cat >> confdefs.h <<\EOF
-#define DLEXT ".o"
-EOF
-;;
- openstep*) DLEXT=bundle
- cat >> confdefs.h <<\EOF
-#define DLEXT ".bundle"
-EOF
-;;
- rhapsody*) DLEXT=bundle
- cat >> confdefs.h <<\EOF
-#define DLEXT ".bundle"
-EOF
-;;
- cygwin32*) DLEXT=dll
- cat >> confdefs.h <<\EOF
-#define DLEXT ".dll"
-EOF
-;;
- *) DLEXT=so
- cat >> confdefs.h <<\EOF
-#define DLEXT ".so"
-EOF
-;;
- esac
-fi
-
-if test "$with_dln_a_out" = yes; then
- STRIP=true
-else
- STRIP=strip
-fi
-
-case "$host_os" in
- linux*)
- STRIP='strip -S -x';;
- nextstep*)
- STRIP='strip -A -n';;
- openstep*)
- STRIP='strip -A -n';;
- rhapsody*)
- STRIP='strip -A -n';;
-esac
-
-EXTSTATIC=
-# Check whether --with-static-linked-ext or --without-static-linked-ext was given.
-if test "${with_static_linked_ext+set}" = set; then
- withval="$with_static_linked_ext"
- case $withval in
- yes) STATIC=
- EXTSTATIC=static;;
- *) ;;
- esac
-fi
-
-
-case "$host_os" in
- human*)
- echo $ac_n "checking for _harderr in -lsignal""... $ac_c" 1>&6
-echo "configure:3625: checking for _harderr in -lsignal" >&5
-ac_lib_var=`echo signal'_'_harderr | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lsignal $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 3633 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char _harderr();
-
-int main() {
-_harderr()
-; return 0; }
-EOF
-if { (eval echo configure:3644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_lib=HAVE_LIB`echo signal | sed -e 's/[^a-zA-Z0-9_]/_/g' \
- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
- LIBS="-lsignal $LIBS"
-
-else
- echo "$ac_t""no" 1>&6
-fi
-
- echo $ac_n "checking for hmemset in -lhmem""... $ac_c" 1>&6
-echo "configure:3672: checking for hmemset in -lhmem" >&5
-ac_lib_var=`echo hmem'_'hmemset | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lhmem $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 3680 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char hmemset();
-
-int main() {
-hmemset()
-; return 0; }
-EOF
-if { (eval echo configure:3691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_lib=HAVE_LIB`echo hmem | sed -e 's/[^a-zA-Z0-9_]/_/g' \
- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
- LIBS="-lhmem $LIBS"
-
-else
- echo "$ac_t""no" 1>&6
-fi
-
- for ac_func in select
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3721: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 3726 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:3749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
- echo $ac_n "checking whether PD libc _dtos18 fail to convert big number""... $ac_c" 1>&6
-echo "configure:3774: checking whether PD libc _dtos18 fail to convert big number" >&5
- if eval "test \"`echo '$''{'rb_cv_missing__dtos18'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
-else
- cat > conftest.$ac_ext <<EOF
-#line 3782 "configure"
-#include "confdefs.h"
-
-#include <stdio.h>
-main ()
-{
- char buf[256];
- sprintf (buf, "%g", 1e+300);
- exit (strcmp (buf, "1e+300") ? 0 : 1);
-}
-
-EOF
-if { (eval echo configure:3794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
- rb_cv_missing__dtos18=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- rb_cv_missing__dtos18=no
-fi
-rm -fr conftest*
-fi
-
-fi
-
- echo "$ac_t""$rb_cv_missing__dtos18" 1>&6
- if test "$rb_cv_missing__dtos18" = yes; then
- cat >> confdefs.h <<\EOF
-#define MISSING__DTOS18 1
-EOF
-
- fi
- echo $ac_n "checking whether PD libc fconvert fail to round""... $ac_c" 1>&6
-echo "configure:3816: checking whether PD libc fconvert fail to round" >&5
- if eval "test \"`echo '$''{'rb_cv_missing_fconvert'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
-else
- cat > conftest.$ac_ext <<EOF
-#line 3824 "configure"
-#include "confdefs.h"
-
-#include <stdio.h>
-#include <math.h>
-main ()
-{
- char buf[256];
- sprintf (buf, "%f", log(exp(1.0)));
- exit (strcmp (buf, "1.000000") ? 0 : 1);
-}
-
-EOF
-if { (eval echo configure:3837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
- rb_cv_missing_fconvert=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- rb_cv_missing_fconvert=no
-fi
-rm -fr conftest*
-fi
-
-fi
-
- echo "$ac_t""$rb_cv_missing_fconvert" 1>&6
- if test "$rb_cv_missing_fconvert" = yes; then
- cat >> confdefs.h <<\EOF
-#define MISSING_FCONVERT 1
-EOF
-
- fi
- LIBOBJS="$LIBOBJS x68.o"
- CFLAGS="$CFLAGS -fansi-only -cc1-stack=196608 -cpp-stack=2694144"
- binsuffix=.x
- setup=Setup.x68
- ;;
- cygwin32*)
- binsuffix=.exe
- setup=Setup
- ;;
- *)
- binsuffix=
- setup=Setup
- ;;
-esac
-
-
-
-
-
-
-if test "$prefix" = NONE; then
- prefix=$ac_default_prefix
-fi
-
-if test "$fat_binary" = yes ; then
- CFLAGS="$CFLAGS $ARCH_FLAG"
-fi
-
-LIBRUBY='libruby.a'
-LIBRUBYARG='libruby.a'
-SOLIBS=
-if test "$host_os" = "beos"; then
- CFLAGS="$CFLAGS -relax_pointers"
- LIBRUBY='libruby.so'
- LIBRUBYARG='-lruby'
- SOLIBS='-lnet'
- echo creating ruby.def
- case "$host_cpu" in
- powerpc*)
- cp beos/ruby.def.in ruby.exp
- ;;
- *)
- echo EXPORTS > ruby.def
- cat beos/ruby.def.in >> ruby.def
- ;;
- esac
-fi
-
-if test "$enable_shared" = 'yes'; then
- LIBRUBY='libruby.so'
- LIBRUBYARG='-L./ -lruby'
-fi
-
-case "$host_os" in
- nextstep*)
- CFLAGS="$CFLAGS -pipe"
- ;;
- openstep*)
- CFLAGS="$CFLAGS -pipe"
- ;;
- rhasody*)
- CFLAGS="$CFLAGS -pipe -no-precomp"
- ;;
- *)
- ;;
-esac
-
-
-
-
-
-
-ri_prefix=
-test "$program_prefix" != NONE &&
- ri_prefix=$program_prefix
-
-ri_suffix=
-test "$program_suffix" != NONE &&
- ri_suffix=$program_suffix
-
-RUBY_INSTALL_NAME="${ri_prefix}ruby${ri_suffix}"
-cat >> confdefs.h <<EOF
-#define RUBY_LIB "${prefix}/lib/${RUBY_INSTALL_NAME}"
-EOF
-
-cat >> confdefs.h <<EOF
-#define RUBY_SITE_LIB "${prefix}/lib/${RUBY_INSTALL_NAME}/site_ruby"
-EOF
-
-
-if test "$fat_binary" = yes ; then
- arch="fat-${host_os}"
-
- cat >> confdefs.h <<EOF
-#define RUBY_THIN_ARCHLIB "${prefix}/lib/${RUBY_INSTALL_NAME}/" __ARCHITECTURE__ "-${host_os}"
-EOF
-
-
- cat >> confdefs.h <<EOF
-#define RUBY_SITE_THIN_ARCHLIB "${prefix}/lib/${RUBY_INSTALL_NAME}/" __ARCHITECTURE__ "-${host_os}"
-EOF
-
-
- cat >> confdefs.h <<EOF
-#define RUBY_ARCHLIB "${prefix}/lib/${RUBY_INSTALL_NAME}/${arch}"
-EOF
-
- cat >> confdefs.h <<EOF
-#define RUBY_SITE_ARCHLIB "${prefix}/lib/${RUBY_INSTALL_NAME}/site_ruby/${arch}"
-EOF
-
- cat >> confdefs.h <<EOF
-#define RUBY_PLATFORM __ARCHITECTURE__ "-${host_os}"
-EOF
-
-else
- arch="${host_cpu}-${host_os}"
- cat >> confdefs.h <<EOF
-#define RUBY_ARCHLIB "${prefix}/lib/${RUBY_INSTALL_NAME}/${arch}"
-EOF
-
- cat >> confdefs.h <<EOF
-#define RUBY_SITE_ARCHLIB "${prefix}/lib/${RUBY_INSTALL_NAME}/site_ruby/${arch}"
-EOF
-
- cat >> confdefs.h <<EOF
-#define RUBY_PLATFORM "${arch}"
-EOF
-
-fi
-
-echo "creating config.h"
-cat confdefs.h > config.h
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(set) 2>&1 |
- case `(ac_space=' '; set) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
-
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.12"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
-done
-
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
-
-trap 'rm -fr `echo "Makefile ext/extmk.rb" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@host@%$host%g
-s%@host_alias@%$host_alias%g
-s%@host_cpu@%$host_cpu%g
-s%@host_vendor@%$host_vendor%g
-s%@host_os@%$host_os%g
-s%@CC@%$CC%g
-s%@CPP@%$CPP%g
-s%@YACC@%$YACC%g
-s%@RANLIB@%$RANLIB%g
-s%@AR@%$AR%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-s%@SET_MAKE@%$SET_MAKE%g
-s%@LIBOBJS@%$LIBOBJS%g
-s%@ALLOCA@%$ALLOCA%g
-s%@DLDFLAGS@%$DLDFLAGS%g
-s%@STATIC@%$STATIC%g
-s%@CCDLFLAGS@%$CCDLFLAGS%g
-s%@LDSHARED@%$LDSHARED%g
-s%@DLEXT@%$DLEXT%g
-s%@STRIP@%$STRIP%g
-s%@EXTSTATIC@%$EXTSTATIC%g
-s%@binsuffix@%$binsuffix%g
-s%@setup@%$setup%g
-s%@LIBRUBY@%$LIBRUBY%g
-s%@LIBRUBYARG@%$LIBRUBYARG%g
-s%@SOLIBS@%$SOLIBS%g
-s%@arch@%$arch%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
- else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
- fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
- else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
- fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile ext/extmk.rb"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
-
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
-
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- esac
-
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
-
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
diff --git a/configure.bat b/configure.bat
deleted file mode 100644
index 093d43549d..0000000000
--- a/configure.bat
+++ /dev/null
@@ -1,6 +0,0 @@
-@echo off
-sed -f top.sed Makefile.in >Makefile
-sed -f top.sed ext/extmk.rb.in > ext\extmk.rb
-copy ext\Setup.dj ext\Setup
-copy config_h.dj config.h
-copy config_s.dj config.status
diff --git a/configure.in b/configure.in
index 9ddce9983e..641954adfe 100644
--- a/configure.in
+++ b/configure.in
@@ -1,99 +1,233 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(ruby.h)
+AC_INIT()
+AC_PREREQ(2.50)
+
+AC_DEFUN(RUBY_MINGW32,
+[case "$host_os" in
+cygwin*)
+AC_CACHE_CHECK(for mingw32 environment, rb_cv_mingw32,
+[AC_TRY_CPP([
+#ifndef __MINGW32__
+# error
+#endif
+], rb_cv_mingw32=yes,rb_cv_mingw32=no)
+rm -f conftest*])
+test "$rb_cv_mingw32" = yes && target_os="mingw32"
+ ;;
+esac])
+
+AC_DEFUN(RUBY_CPPOUTFILE,
+[AC_CACHE_CHECK(whether ${CPP} accepts -o, rb_cv_cppoutfile,
+[cppflags=$CPPFLAGS
+CPPFLAGS='-o conftest.i'
+AC_TRY_CPP([], rb_cv_cppoutfile=yes, rb_cv_cppoutfile=no)
+CPPFLAGS=$cppflags
+rm -f conftest*])
+if test "$rb_cv_cppoutfile" = yes; then
+ CPPOUTFILE='-o conftest.i'
+elif test "$rb_cv_cppoutfile" = no; then
+ CPPOUTFILE='> conftest.i'
+elif test -n "$rb_cv_cppoutfile"; then
+ CPPOUTFILE="$rb_cv_cppoutfile"
+fi
+AC_SUBST(CPPOUTFILE)])
+
+AC_DEFUN(RUBY_PROG_GNU_LD,
+[AC_CACHE_CHECK(whether the linker is GNU ld, rb_cv_prog_gnu_ld,
+[if `$CC $CFLAGS $CPPFLAGS $LDFLAGS --print-prog-name=ld 2>&1` -v 2>&1 | grep "GNU ld" > /dev/null; then
+ rb_cv_prog_gnu_ld=yes
+else
+ rb_cv_prog_gnu_ld=no
+fi
+])
+GNU_LD=$rb_cv_prog_gnu_ld
+AC_SUBST(GNU_LD)])
+
+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]*\)"'`
+AC_SUBST(MAJOR)
+AC_SUBST(MINOR)
+AC_SUBST(TEENY)
dnl checks for alternative programs
-AC_ARG_WITH(gcc, [--without-gcc never use gcc], [
+AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
case $withval in
- no) CC=cc
- without_gcc=yes;;
- yes) CC=gcc
- without_gcc=no;;
+ no) : ${CC=cc}
+ ;;
+ yes) : ${CC=gcc}
+ ;;
*) CC=$withval
- without_gcc=$withval;;
- esac], [without_gcc=no])
+ ;;
+ esac])
dnl If the user switches compilers, we can't believe the cache
if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
then
- AC_ERROR(cached CC is different -- throw away $cache_file
+ AC_MSG_ERROR(cached CC is different -- throw away $cache_file
(it is also a good idea to do 'make clean' before compiling))
fi
-dnl checks for thread
-rb_thread=yes
-AC_ARG_ENABLE(thread, [--disable-thread never use user-level thread], [
- rb_thread=$enableval
-])
-if test $rb_thread = yes; then
- AC_DEFINE(THREAD)
+if test "$program_prefix" = NONE; then
+ program_prefix=
fi
-
-AC_CANONICAL_HOST
+AC_CANONICAL_TARGET
+target_os=`echo $target_os | sed 's/linux-gnu$/linux/;s/linux-gnu/linux-/'`
dnl checks for fat-binary
-fat_binary=no
-AC_ARG_ENABLE( fat-binary,
- [--enable-fat-binary build a NeXT/Apple Multi Architecture Binary. ],
- [ fat_binary=$enableval ] )
- if test "$fat_binary" = yes ; then
-
- AC_MSG_CHECKING( target architecture )
-
- if test "$host_os" = "rhapsody" ; then
- echo -n "Rhapsody: "
- if test "$TARGET_ARCHS" = "" ; then
- TARGET_ARCHS="ppc i486"
- fi
- else
- echo -n "NeXTSTEP/OPENSTEP: "
- if test "$TARGET_ARCHS" = "" ; then
- if test `/usr/bin/arch` = "m68k" ; then
- TARGET_ARCHS="m68k i486"
- else
- TARGET_ARCHS="m68k `/usr/bin/arch`"
- fi
- fi
+AC_ARG_ENABLE(fat-binary,
+ [ --enable-fat-binary=ARCHS
+ build an Apple/NeXT Multi Architecture Binary (MAB);
+ ARCHS is a comma-delimited list of architectures for
+ which to build; if ARCHS is omitted, then the package
+ will be built for all architectures supported by the
+ platform ("ppc" for MacOS/X and Darwin; "ppc,i386"
+ for Rhapsody; "m68k,i386,sparc" for OpenStep;
+ "m68k,i386,sparc,hppa" for NextStep); if this option
+ is disabled or omitted entirely, then the package
+ will be built only for the target platform],
+ [fat_binary=$enableval], [fat_binary=no])
+if test "$fat_binary" != no; then
+
+ AC_MSG_CHECKING([target architectures])
+
+ # Respect TARGET_ARCHS setting from environment if available.
+ if test -z "$TARGET_ARCHS"; then
+ # Respect ARCH given to --enable-fat-binary if present.
+ if test "$fat_binary" != yes; then
+ TARGET_ARCHS=`echo "$fat_binary" | tr ',' ' '`
+ else
+ # Choose a default set of architectures based upon platform.
+ case "$target_os" in
+ darwin*)
+ TARGET_ARCHS="ppc"
+ ;;
+ rhapsody*)
+ TARGET_ARCHS="ppc i386"
+ ;;
+ openstep*)
+ TARGET_ARCHS="m68k i386 sparc"
+ ;;
+ nextstep*)
+ TARGET_ARCHS="m68k i386 sparc hppa"
+ ;;
+ *)
+ TARGET_ARCHS=`arch`
+ esac
+ fi
fi
+
+ AC_MSG_RESULT([$TARGET_ARCHS])
+
# /usr/lib/arch_tool -archify_list $TARGET_ARCHS
+ ARCH_FLAG=
for archs in $TARGET_ARCHS
do
- ARCH_FLAG="$ARCH_FLAG -arch $archs "
- echo -n " $archs"
+ ARCH_FLAG="$ARCH_FLAG -arch $archs"
done
- AC_DEFINE( NEXT_FAT_BINARY )
- echo "."
-fi
+ AC_DEFINE(NEXT_FAT_BINARY)
+fi
+
+case $target_cpu in
+ i?86) frame_address=yes;;
+ *) frame_address=no;;
+esac
+AC_ARG_ENABLE(frame-address,
+ [ --enable-frame-address use GCC __builtin_frame_address(). ],
+ [frame_address=$enableval])
+if test $frame_address = yes; then
+ AC_DEFINE(USE_BUILTIN_FRAME_ADDRESS)
+fi
AC_ARG_PROGRAM
dnl Checks for programs.
+
+if test x"${build}" != x"${host}"; then
+ AC_CHECK_TOOL(CC, gcc)
+fi
AC_PROG_CC
AC_PROG_GCC_TRADITIONAL
+
+RUBY_PROG_GNU_LD
+RUBY_CPPOUTFILE
+
+: ${OUTFLAG='-o '}
+AC_SUBST(OUTFLAG)
+
+RUBY_MINGW32
+
AC_PROG_YACC
-AC_PROG_RANLIB
-AC_SUBST(AR)
-AC_CHECK_PROGS(AR, ar aal, ar)
-AC_PROG_INSTALL
+if test "$YACC" = "yacc"; then
+ AC_DEFINE([OLD_YACC])
+fi
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(AR, ar)
+if test -z "$AR"; then
+ AC_CHECK_PROGS(AR, aal, ar)
+fi
+
+case "$target_os" in
+cygwin*|mingw*)
+ AC_CHECK_TOOL(NM, nm)
+ AC_CHECK_TOOL(WINDRES, windres)
+ AC_CHECK_TOOL(DLLWRAP, dllwrap)
+ target_cpu=`echo $target_cpu | sed s/i.86/i386/`
+ : ${enable_shared=yes}
+ ;;
+aix*)
+ AC_CHECK_TOOL(NM, nm, /usr/ccs/bin/nm, /usr/ccs/bin:$PATH)
+ ;;
+hiuxmpp*)
+ # by TOYODA Eizi <toyoda@npd.kishou.go.jp>
+ AC_DEFINE(__HIUX_MPP__)
+ ;;
+esac
+
+AC_PROG_LN_S
AC_PROG_MAKE_SET
# checks for UNIX variants that set C preprocessor variables
+AC_AIX
AC_MINIX
-AC_CHECK_SIZEOF(int)
-AC_CHECK_SIZEOF(long)
-AC_CHECK_SIZEOF(void*)
+dnl check for large file stuff
+AC_SYS_LARGEFILE
+
+AC_CHECK_TYPES([long long, off_t])
-AC_MSG_CHECKING(for prototypes)
-AC_CACHE_VAL(rb_cv_have_prototypes,
+AC_CHECK_SIZEOF(int, 4)
+AC_CHECK_SIZEOF(short, 2)
+AC_CHECK_SIZEOF(long, 4)
+AC_CHECK_SIZEOF(long long, 0)
+AC_CHECK_SIZEOF(__int64, 0)
+AC_CHECK_SIZEOF(off_t, 0)
+AC_CHECK_SIZEOF(void*, 4)
+AC_CHECK_SIZEOF(float, 4)
+AC_CHECK_SIZEOF(double, 8)
+AC_CHECK_SIZEOF(time_t, 0)
+
+AC_CACHE_CHECK(for prototypes, rb_cv_have_prototypes,
[AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
rb_cv_have_prototypes=yes,
rb_cv_have_prototypes=no)])
-AC_MSG_RESULT($rb_cv_have_prototypes)
if test "$rb_cv_have_prototypes" = yes; then
AC_DEFINE(HAVE_PROTOTYPES)
fi
-AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
-AC_CACHE_VAL(rb_cv_stdarg,
+AC_CACHE_CHECK(token paste string, rb_cv_tokenpaste,
+ [AC_TRY_COMPILE([#define paste(a,b) a##b],
+ [int xy = 1; return paste(x,y);],
+ rb_cv_tokenpaste=ansi,
+ rb_cv_tokenpaste=knr)])
+if test "$rb_cv_tokenpaste" = ansi; then
+ AC_DEFINE(TOKEN_PASTE(x,y),[x##y])
+else
+ AC_DEFINE(TOKEN_PASTE(x,y),[x/**/y])
+fi
+
+AC_CACHE_CHECK(for variable length prototypes and stdarg.h, rb_cv_stdarg,
[AC_TRY_COMPILE([
#include <stdarg.h>
int foo(int x, ...) {
@@ -107,75 +241,235 @@ int foo(int x, ...) {
], [return foo(10, "", 3.14);],
rb_cv_stdarg=yes,
rb_cv_stdarg=no)])
-AC_MSG_RESULT($rb_cv_stdarg)
if test "$rb_cv_stdarg" = yes; then
AC_DEFINE(HAVE_STDARG_PROTOTYPES)
fi
-AC_MSG_CHECKING(for gcc attribute noreturn)
-AC_CACHE_VAL(rb_cv_have_attr_noreturn,
- [AC_TRY_COMPILE([void exit(int x) __attribute__ ((noreturn));], [],
- rb_cv_have_attr_noreturn=yes,
- rb_cv_have_attr_noreturn=no)])
-AC_MSG_RESULT($rb_cv_have_attr_noreturn)
-if test "$rb_cv_have_attr_noreturn" = yes; then
- AC_DEFINE(HAVE_ATTR_NORETURN)
-fi
+AC_CACHE_CHECK([for noreturn], rb_cv_noreturn,
+[rb_cv_noreturn=no
+for mac in "x __attribute__ ((noreturn))" "__declspec(noreturn) x" x; do
+ AC_TRY_COMPILE(
+ [#define NORETURN(x) $mac
+NORETURN(void exit(int x));],
+ [],
+ [rb_cv_noreturn="$mac"; break])
+done])
+AC_DEFINE_UNQUOTED([NORETURN(x)], $rb_cv_noreturn)
+
+dnl Check whether we need to define sys_nerr locally
+AC_CHECK_DECLS([sys_nerr], [], [], [$ac_includes_default
+#include <errno.h>])
+
+dnl whether link libc_r or not
+AC_ARG_WITH(libc_r,
+ [ --with-libc_r link libc_r if possible (FreeBSD only)], [
+ case $withval in
+ yes) with_libc_r=yes;;
+ *) with_libc_r=no;;
+ esac], [with_libc_r=no])
+
+AC_ARG_ENABLE(pthread,
+ [ --enable-pthread use pthread library.],
+ [enable_pthread=$enableval], [enable_pthread=no])
dnl Checks for libraries.
-case "$host_os" in
+case "$target_os" in
nextstep*) ;;
openstep*) ;;
rhapsody*) ;;
-human*) ;;
+darwin*) LIBS="-lobjc $LIBS";;
+hpux*) LIBS="-lm $LIBS"
+ ac_cv_c_inline=no;;
+human*) ac_cv_func_getpgrp_void=yes
+ ac_cv_func_setitimer=no
+ ;;
beos*) ;;
+cygwin*) rb_cv_have_daylight=no
+ ac_cv_var_tzname=no
+ ac_cv_func__setjmp=no
+ ac_cv_func_setitimer=no
+ ;;
+mingw*) LIBS="-lwsock32 $LIBS"
+ ac_cv_header_a_out_h=no
+ ac_cv_header_pwd_h=no
+ ac_cv_header_utime_h=no
+ ac_cv_header_sys_ioctl_h=no
+ ac_cv_header_sys_param_h=no
+ ac_cv_header_sys_resource_h=no
+ ac_cv_header_sys_select_h=no
+ ac_cv_header_sys_times_h=no
+ ac_cv_func_times=yes
+ ac_cv_func_waitpid=yes
+ ac_cv_func_fsync=yes
+ ac_cv_func_vsnprintf=yes
+ ac_cv_func_seekdir=yes
+ ac_cv_func_telldir=yes
+ ac_cv_func_isinf=yes
+ ac_cv_func_isnan=yes
+ ac_cv_func_finite=yes
+ ac_cv_lib_crypt_crypt=no
+ enable_pthread=no
+ ;;
+os2-emx*) LIBS="-lm $LIBS"
+ ac_cv_lib_dir_opendir=no;;
+msdosdjgpp*) LIBS="-lm $LIBS"
+ ac_cv_func_getpgrp_void=yes
+ ac_cv_func_setitimer=no
+ ;;
+freebsd*) LIBS="-lm $LIBS"
+ AC_CACHE_CHECK([whether -lxpg4 has to be linked],
+ rb_cv_lib_xpg4_needed,
+ [AC_TRY_CPP([
+#include <osreldate.h>
+#if __FreeBSD_version < 400020 || \
+ (__FreeBSD_version >= 500000 && __FreeBSD_version < 500005)
+#error needs libxpg4
+#endif
+ ],
+ rb_cv_lib_xpg4_needed=no,
+ rb_cv_lib_xpg4_needed=yes,
+ rb_cv_lib_xpg4_needed=yes)])
+ if test "$rb_cv_lib_xpg4_needed" = yes; then
+ AC_CHECK_LIB(xpg4, setlocale)
+ fi
+ if test "$with_libc_r" = yes; then
+ AC_CACHE_CHECK([whether libc_r is supplementary to libc],
+ rb_cv_supplementary_lib_c_r,
+ [AC_TRY_CPP([
+#include <osreldate.h>
+#if 500016 <= __FreeBSD_version
+#error libc_r is supplementary to libc
+#endif
+ ],
+ rb_cv_supplementary_lib_c_r=no,
+ rb_cv_supplementary_lib_c_r=yes,
+ rb_cv_supplementary_lib_c_r=yes)])
+ if test "$rb_cv_supplementary_lib_c_r" = yes; then
+ MAINLIBS="-lc_r $MAINLIBS"
+ fi
+ fi
+ ;;
+dragonfly*) LIBS="-lm $LIBS"
+ ;;
+bow) ac_cv_func_setitimer=no
+ ;;
+superux*) ac_cv_func_setitimer=no
+ ;;
*) LIBS="-lm $LIBS";;
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(xpg4, setlocale) # FreeBSD needs this
+
+case "$target_cpu" in
+alpha*) case "$target_os"::"$GCC" in
+ *::yes) CFLAGS="-mieee $CFLAGS" ;; # gcc
+ osf*) CFLAGS="-ieee $CFLAGS" ;; # ccc
+ esac ;;
+esac
dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
-AC_CHECK_HEADERS(stdlib.h unistd.h limits.h sys/file.h sys/ioctl.h pwd.h \
- sys/select.h sys/time.h sys/times.h sys/param.h sys/wait.h\
- syscall.h a.out.h string.h utime.h memory.h direct.h)
+AC_HEADER_SYS_WAIT
+AC_CHECK_HEADERS(stdlib.h string.h unistd.h limits.h sys/file.h sys/ioctl.h\
+ fcntl.h sys/fcntl.h sys/select.h sys/time.h sys/times.h sys/param.h\
+ syscall.h pwd.h grp.h a.out.h utime.h memory.h direct.h sys/resource.h \
+ sys/mkdev.h sys/utime.h netinet/in_systm.h float.h ieeefp.h pthread.h \
+ ucontext.h intrinsics.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_UID_T
AC_TYPE_SIZE_T
AC_STRUCT_ST_BLKSIZE
-save_LIBOJBS="$LIBOBJS"
AC_STRUCT_ST_BLOCKS
-LIBOBJS="$save_LIBOBJS"
AC_STRUCT_ST_RDEV
dnl Checks for library functions.
AC_TYPE_GETGROUPS
AC_TYPE_SIGNAL
AC_FUNC_ALLOCA
-AC_FUNC_VFORK
AC_FUNC_MEMCMP
-AC_REPLACE_FUNCS(dup2 setenv memmove mkdir strcasecmp strerror strftime\
- strchr strstr strtoul strdup crypt flock snprintf)
-AC_CHECK_FUNCS(fmod killpg drand48 random wait4 waitpid syscall getcwd\
- truncate chsize times utimes fcntl lockf setitimer\
- setruid seteuid setreuid setrgid setegid setregid\
- setpgrp2 getpgid getgroups getpriority\
- dlopen sigprocmask sigaction _setjmp setpgrp setsid)
-if test "$ac_cv_func_strftime" = no; then
- AC_STRUCT_TIMEZONE
- AC_TRY_LINK([],
- [extern int daylight; int i = daylight;], AC_DEFINE(HAVE_DAYLIGHT))
+AC_FUNC_FSEEKO
+AC_CHECK_FUNCS(ftello)
+AC_REPLACE_FUNCS(dup2 memmove mkdir 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\
+ truncate chsize times utimes fcntl lockf lstat symlink readlink\
+ setitimer setruid seteuid setreuid setresuid setproctitle\
+ setrgid setegid setregid setresgid issetugid pause lchown lchmod\
+ getpgrp setpgrp getpgid setpgid initgroups getgroups setgroups\
+ getpriority getrlimit dlopen sigprocmask sigaction _setjmp\
+ setsid telldir seekdir fchmod mktime timegm cosh sinh tanh\
+ setuid setgid)
+AC_ARG_ENABLE(setreuid,
+ [ --enable-setreuid use setreuid()/setregid() according to need even if obsolete.],
+ [use_setreuid=$enableval])
+if test "$use_setreuid" = yes; then
+ AC_DEFINE(USE_SETREUID)
+ AC_DEFINE(USE_SETREGID)
+fi
+AC_STRUCT_TIMEZONE
+AC_CACHE_CHECK(for struct tm.tm_gmtoff, rb_cv_member_struct_tm_tm_gmtoff,
+ [AC_TRY_COMPILE([#include <time.h>],
+ [struct tm t; t.tm_gmtoff = 3600;],
+ [rb_cv_member_struct_tm_tm_gmtoff=yes],
+ [rb_cv_member_struct_tm_tm_gmtoff=no])])
+if test "$rb_cv_member_struct_tm_tm_gmtoff" = yes; then
+ AC_DEFINE(HAVE_STRUCT_TM_TM_GMTOFF)
+fi
+AC_CACHE_CHECK(for external int daylight, rb_cv_have_daylight,
+ [AC_TRY_LINK([#include <time.h>
+ int i;],
+ [i = daylight;],
+ rb_cv_have_daylight=yes,
+ rb_cv_have_daylight=no)])
+if test "$rb_cv_have_daylight" = yes; then
+ AC_DEFINE(HAVE_DAYLIGHT)
+fi
+AC_CACHE_CHECK(for negative time_t for gmtime(3), rb_cv_negative_time_t,
+ [AC_TRY_RUN([
+#include <time.h>
+
+void
+check(tm, y, m, d, h, s)
+ struct tm *tm;
+ int y, m, d, h, s;
+{
+ if (!tm ||
+ tm->tm_year != y ||
+ tm->tm_mon != m-1 ||
+ tm->tm_mday != d ||
+ tm->tm_hour != h ||
+ tm->tm_sec != s) {
+ exit(1);
+ }
+}
+
+int
+main()
+{
+ time_t t = -1;
+ struct tm *tm;
+
+ check(gmtime(&t), 69, 12, 31, 23, 59);
+ t = ~(time_t)0 << 31;
+ check(gmtime(&t), 1, 12, 13, 20, 52);
+ return 0;
+}
+],
+ rb_cv_negative_time_t=yes,
+ rb_cv_negative_time_t=no,
+ rb_cv_negative_time_t=yes)])
+if test "$rb_cv_negative_time_t" = yes; then
+ AC_DEFINE(NEGATIVE_TIME_T)
fi
if test "$ac_cv_func_sigprocmask" = yes && test "$ac_cv_func_sigaction" = yes; then
AC_DEFINE(POSIX_SIGNAL)
else
- AC_MSG_CHECKING(for BSD signal semantics)
- AC_CACHE_VAL(rb_cv_bsd_signal,
+ AC_CACHE_CHECK(for BSD signal semantics, rb_cv_bsd_signal,
[AC_TRY_RUN([
#include <stdio.h>
#include <signal.h>
@@ -196,43 +490,23 @@ main()
}
],
rb_cv_bsd_signal=yes,
+ rb_cv_bsd_signal=no,
rb_cv_bsd_signal=no)])
- AC_MSG_RESULT($rb_cv_bsd_signal)
if test "$rb_cv_bsd_signal" = yes; then
AC_DEFINE(BSD_SIGNAL)
fi
fi
-if test "$ac_cv_func_setpgrp2" = yes; then
- AC_DEFINE(BSD_GETPGRP, getpgrp2)
- AC_DEFINE(BSD_SETPGRP, setpgrp2)
-else
- AC_MSG_CHECKING(whether getpgrp() has arg)
- AC_CACHE_VAL(rb_cv_bsdgetpgrp,
- [AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);],
- rb_cv_bsdgetpgrp=yes,
- rb_cv_bsdgetpgrp=no)])
- AC_MSG_RESULT($rb_cv_bsdgetpgrp)
- if test "$rb_cv_bsdgetpgrp" = yes; then
- AC_DEFINE(BSD_GETPGRP, getpgrp)
- fi
-
- AC_MSG_CHECKING(whether setpgrp() has args)
- AC_CACHE_VAL(rb_cv_bsdsetpgrp,
- [AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(1, 1);],
- rb_cv_bsdsetpgrp=yes,
- rb_cv_bsdsetpgrp=no)])
- AC_MSG_RESULT($rb_cv_bsdsetpgrp)
- if test "$rb_cv_bsdsetpgrp" = yes; then
- AC_DEFINE(BSD_SETPGRP, setpgrp)
- fi
-fi
+AC_FUNC_GETPGRP
+AC_FUNC_SETPGRP
AC_C_BIGENDIAN
-AC_CHAR_UNSIGNED
+AC_C_CONST
+AC_C_CHAR_UNSIGNED
+AC_C_INLINE
+AC_C_VOLATILE
-AC_MSG_CHECKING(whether right shift preserve sign bit)
-AC_CACHE_VAL(rb_cv_rshift_sign,
+AC_CACHE_CHECK(whether right shift preserve sign bit, rb_cv_rshift_sign,
[AC_TRY_RUN([
int
main()
@@ -243,31 +517,29 @@ main()
}
],
rb_cv_rshift_sign=yes,
- rb_cv_rshift_sign=no)])
- AC_MSG_RESULT($rb_cv_rshift_sign)
+ rb_cv_rshift_sign=no,
+ rb_cv_rshift_sign=yes)])
if test "$rb_cv_rshift_sign" = yes; then
- AC_DEFINE(RSHIFT(x,y), ((x)>>y))
+ AC_DEFINE(RSHIFT(x,y), ((x)>>(int)y))
else
AC_DEFINE(RSHIFT(x,y), (((x)<0) ? ~((~(x))>>y) : (x)>>y))
fi
-AC_MSG_CHECKING([count field in FILE structures])
+AC_MSG_CHECKING(read count field in FILE structures)
AC_CACHE_VAL(rb_cv_fcnt,
-[AC_TRY_COMPILE([#include <stdio.h>],
- [FILE *f = stdin; f->_cnt = 0;], rb_cv_fcnt="_cnt", )
-if test "$rb_cv_fcnt" = ""; then
- AC_TRY_COMPILE([#include <stdio.h>],
- [FILE *f = stdin; f->__cnt = 0;], rb_cv_fcnt="__cnt", )
-fi
-if test "$rb_cv_fcnt" = ""; then
- AC_TRY_COMPILE([#include <stdio.h>],
- [FILE *f = stdin; f->_r = 0;], rb_cv_fcnt="_r", )
-fi
-if test "$rb_cv_fcnt" = ""; then
- AC_TRY_COMPILE([#include <stdio.h>],
- [FILE *f = stdin; f->readCount = 0;],
- rb_cv_fcnt="readCount", rb_cv_fcnt="not found")
-fi])
+[for fcnt in dnl
+ _cnt dnl
+ __cnt dnl
+ _r dnl
+ readCount dnl
+ _rcount dnl for emx0.9c
+; do
+ AC_TRY_COMPILE([#include <stdio.h>
+],
+ [FILE *f = stdin; f->$fcnt = 0;],
+ rb_cv_fcnt="$fcnt"; break,
+ rb_cv_fcnt="not found")
+done])
if test "$rb_cv_fcnt" = "not found"; then
AC_MSG_RESULT([not found(OK if using GNU libc)])
else
@@ -275,18 +547,210 @@ else
AC_DEFINE_UNQUOTED(FILE_COUNT, $rb_cv_fcnt)
fi
-dnl wheather use dln_a_out ot not
-AC_ARG_WITH(dln-a-out, [--with-dln-a-out use dln_a_out if possible], [
+AC_MSG_CHECKING(read buffer ptr field in FILE structures)
+AC_CACHE_VAL(rb_cv_frptr,
+[for frptr in dnl
+ _IO_read_ptr dnl
+ _ptr dnl
+ __ptr dnl
+ bufpos dnl
+ _p dnl
+; do
+ AC_TRY_COMPILE([#include <stdio.h>
+],
+ [FILE *f = stdin; char buf[256]; f->$frptr = buf;],
+ rb_cv_frptr="$frptr"; break,
+ rb_cv_frptr="not found")
+done])
+if test "$rb_cv_frptr" = "not found"; then
+ AC_MSG_RESULT([not found])
+else
+ AC_MSG_RESULT($rb_cv_frptr)
+ AC_DEFINE_UNQUOTED(FILE_READPTR, $rb_cv_frptr)
+
+ if test "$rb_cv_fcnt" = "not found"; then
+ AC_MSG_CHECKING(read buffer end field in FILE structures)
+ AC_CACHE_VAL(rb_cv_frend,
+ [for frend in dnl
+ _IO_read_end dnl
+ bufread dnl
+ ; do
+ AC_TRY_COMPILE([#include <stdio.h>
+ ],
+ [FILE *f = stdin; char buf[256]; f->$frend = buf;],
+ rb_cv_frend="$frend"; break,
+ rb_cv_frend="not found")
+ done])
+ if test "$rb_cv_frend" = "not found"; then
+ AC_MSG_RESULT([not found])
+ else
+ AC_MSG_RESULT($rb_cv_frend)
+ AC_DEFINE_UNQUOTED(FILE_READEND, $rb_cv_frend)
+ fi
+ fi
+fi
+
+AC_DEFUN(RUBY_CHECK_IO_NEED,
+[AC_CACHE_CHECK(whether need to [$1], [$2],
+ [AC_TRY_RUN([
+#include <stdio.h>
+#ifndef SEEK_SET
+#define SEEK_SET 0
+#endif
+#ifndef SEEK_CUR
+#define SEEK_CUR 1
+#endif
+#define before_seek(f) ]ifelse(index($2,flush_before_seek),-1,[fflush(f)],[(f,0)])[
+#define reset_rw(f) ]ifelse(index($2,seek_between_rw),-1,[do_seek(f,SEEK_CUR)],[(f,0)])[
+#define do_seek(f, w) (before_seek(f), fseek(f,0,w))
+
+char *fn = "conftest.dat";
+char *wombat = "wombat\n";
+char *koara = "koara\n";
+char *kangaroo = "kangaroo\n";
+
+int main()
+{
+ char buf[BUFSIZ];
+ FILE *f;
+ int r = 1;
+
+ if (!(f = fopen(fn, "w+"))) return 1;
+ fputs(wombat, f);
+ do_seek(f, SEEK_SET);
+ if (!fgets(buf, BUFSIZ, f) || strcmp(buf, wombat)) goto fail;
+ reset_rw(f);
+ fputs(koara, f);
+ fputs(kangaroo, f);
+ do_seek(f, SEEK_SET);
+ if (!fgets(buf, BUFSIZ, f) || strcmp(buf, wombat)) goto fail;
+ if (!fgets(buf, BUFSIZ, f) || strcmp(buf, koara)) goto fail;
+ if (!fgets(buf, BUFSIZ, f) || strcmp(buf, kangaroo)) goto fail;
+ do_seek(f, SEEK_SET);
+ if (!fgets(buf, BUFSIZ, f) || strcmp(buf, wombat)) goto fail;
+ reset_rw(f);
+ fputc('X', f);
+ reset_rw(f);
+ if (!fgets(buf, BUFSIZ, f) || strcmp(buf, koara+1)) goto fail;
+ if (!fgets(buf, BUFSIZ, f) || strcmp(buf, kangaroo)) goto fail;
+ do_seek(f, SEEK_SET);
+ if (!fgets(buf, BUFSIZ, f) || strcmp(buf, wombat)) goto fail;
+ if (!fgets(buf, BUFSIZ, f) || buf[0] != 'X' || strcmp(buf+1, koara+1)) goto fail;
+ if (!fgets(buf, BUFSIZ, f) || strcmp(buf, kangaroo)) goto fail;
+ r = 0;
+ fail:
+ fclose(f);
+ unlink(fn);
+ return r;
+}
+], [$2]=no, [$2]=yes, [$2]=[$3])])])
+RUBY_CHECK_IO_NEED(seek between R/W, rb_cv_need_io_seek_between_rw, yes)
+if test "$rb_cv_need_io_seek_between_rw" = yes; then
+ AC_DEFINE(NEED_IO_SEEK_BETWEEN_RW, 1)
+fi
+dnl RUBY_CHECK_IO_NEED(flush before seek, rb_cv_need_io_flush_before_seek, no)
+dnl if test "$rb_cv_need_io_flush_before_seek" = yes; then
+dnl AC_DEFINE(NEED_IO_FLUSH_BEFORE_SEEK, 1)
+dnl fi
+
+AC_CACHE_CHECK([whether st_ino is huge], rb_cv_huge_st_ino,
+[AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([
+#include <sys/stat.h>
+struct stat test_stat;
+], [sizeof(test_stat.st_ino)>sizeof(long)])],
+rb_cv_huge_st_ino=yes,
+rb_cv_huge_st_ino=no)
+])
+if test $rb_cv_huge_st_ino = yes; then
+ AC_DEFINE(HUGE_ST_INO)
+fi
+
+case "$target_cpu" in
+m68*|i?86|ia64|sparc*|alpha*) rb_cv_stack_grow_dir=-1;;
+hppa*) rb_cv_stack_grow_dir=+1;;
+esac
+AC_CACHE_CHECK(stack growing direction, rb_cv_stack_grow_dir,
+ [AC_TRY_RUN([
+/* recurse to get rid of inlining */
+static int
+stack_growup_p(addr, n)
+ volatile int *addr, n;
+{
+ volatile int end;
+ if (n > 0)
+ return *addr = stack_growup_p(addr, n - 1);
+ else
+ return (&end > addr);
+}
+int main()
+{
+ int x;
+ return stack_growup_p(&x, 10);
+}
+], rb_cv_stack_grow_dir=-1, rb_cv_stack_grow_dir=+1, rb_cv_stack_grow_dir=0)])
+AC_DEFINE_UNQUOTED(STACK_GROW_DIRECTION, $rb_cv_stack_grow_dir)
+
+if test x"$enable_pthread" = xyes; then
+ for pthread_lib in pthread pthreads c c_r; do
+ AC_CHECK_LIB($pthread_lib, pthread_kill,
+ rb_with_pthread=yes, rb_with_pthread=no)
+ if test "$rb_with_pthread" = "yes"; then break; fi
+ done
+ if test x"$rb_with_pthread" = xyes; then
+ AC_DEFINE(_REENTRANT)
+ AC_DEFINE(_THREAD_SAFE)
+ AC_DEFINE(HAVE_LIBPTHREAD)
+ case $pthread_lib in
+ c)
+ ;;
+ c_r)
+ MAINLIBS="-pthread $MAINLIBS"
+ ;;
+ *)
+ LIBS="-l$pthread_lib $LIBS"
+ ;;
+ esac
+ else
+ AC_MSG_WARN("Don't know how to find pthread library on your system -- thread support disabled")
+ fi
+ AC_CHECK_FUNCS(nanosleep)
+ if test x"$ac_cv_func_nanosleep" = xno; then
+ AC_CHECK_LIB(rt, nanosleep)
+ if test x"$ac_cv_lib_rt_nanosleep" = xyes; then
+ AC_DEFINE(HAVE_NANOSLEEP)
+ fi
+ fi
+fi
+if test x"$ac_cv_header_ucontext_h" = xyes; then
+ if test x"$target_cpu" = xia64 -o x"$rb_with_pthread" = xyes; then
+ AC_CHECK_FUNCS(getcontext setcontext)
+ fi
+fi
+
+dnl default value for $KANJI
+DEFAULT_KCODE="KCODE_NONE"
+
+AC_ARG_WITH(default-kcode,
+ [ --with-default-kcode=CODE specify default value for \$KCODE (utf8|euc|sjis|none)],
+ [case $withval in
+ utf8) DEFAULT_KCODE="KCODE_UTF8";;
+ euc) DEFAULT_KCODE="KCODE_EUC";;
+ sjis) DEFAULT_KCODE="KCODE_SJIS";;
+ none) DEFAULT_KCODE="KCODE_NONE";;
+ *) AC_MSG_WARN($withval is not valid kcode; ignored);;
+ esac])
+AC_DEFINE_UNQUOTED(DEFAULT_KCODE, $DEFAULT_KCODE)
+
+dnl wheather use dln_a_out or not
+AC_ARG_WITH(dln-a-out,
+ [ --with-dln-a-out use dln_a_out if possible], [
case $withval in
yes) with_dln_a_out=yes;;
*) with_dln_a_out=no;;
esac], [with_dln_a_out=no])
-case "$host_os" in
- linux*)
- AC_MSG_CHECKING(whether ELF binaries are produced)
- AC_CACHE_VAL(rb_cv_linux_elf,
- [AC_TRY_RUN([
+AC_CACHE_CHECK(whether ELF binaries are produced, rb_cv_binary_elf,
+[AC_TRY_RUN([
/* Test for whether ELF binaries are produced */
#include <fcntl.h>
#include <stdlib.h>
@@ -303,111 +767,194 @@ main() {
exit(0); /* succeed (yes, it's ELF) */
}
],
- rb_cv_linux_elf=yes,
- rb_cv_linux_elf=no,
- [:])])
- AC_MSG_RESULT($rb_cv_linux_elf)
- if test "$rb_cv_linux_elf" = no; then
- with_dln_a_out=yes
- host_os=linux-a.out
- else
- LDFLAGS="-rdynamic"
- fi;;
+rb_cv_binary_elf=yes,
+rb_cv_binary_elf=no,
+rb_cv_binary_elf=yes)])
+
+if test "$rb_cv_binary_elf" = yes; then
+ AC_DEFINE(USE_ELF)
+fi
+
+case "$target_os" in
+linux* | gnu* | k*bsd*-gnu)
+ if test "$rb_cv_binary_elf" = no; then
+ with_dln_a_out=yes
+ else
+ LDFLAGS="$LDFLAGS -rdynamic"
+ fi;;
+netbsd*|openbsd*)
+ if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
+ then
+ netbsd_elf=yes
+ else
+ netbsd_elf=no
+ fi
+ ;;
esac
+LIBEXT=a
AC_SUBST(DLDFLAGS)dnl
+AC_SUBST(ARCH_FLAG)dnl
AC_SUBST(STATIC)dnl
AC_SUBST(CCDLFLAGS)dnl
AC_SUBST(LDSHARED)dnl
AC_SUBST(DLEXT)dnl
+AC_SUBST(DLEXT2)dnl
+AC_SUBST(LIBEXT)dnl
STATIC=
+: ${LIBPATHFLAG=' -L"%s"'}
+: ${PATHFLAG=''}
if test "$with_dln_a_out" != yes; then
rb_cv_dlopen=unknown
AC_MSG_CHECKING(whether OS depend dynamic link works)
if test "$GCC" = yes; then
- case "$host_os" in
- nextstep*) ;;
- openstep*) ;;
- rhapsody*) ;;
- human*) ;;
- cygwin32*) CCDLFLAGS=-DDLLIMPORT;;
- *) CCDLFLAGS=-fpic;;
+ case "$target_os" in
+ nextstep*) CCDLFLAGS="$CCDLFLAGS -fno-common";;
+ openstep*) CCDLFLAGS="$CCDLFLAGS -fno-common";;
+ rhapsody*) CCDLFLAGS="$CCDLFLAGS -fno-common";;
+ darwin*) CCDLFLAGS="$CCDLFLAGS -fno-common";;
+ human*|bsdi*|beos*|cygwin*|mingw*|aix*|interix*) ;;
+ *) CCDLFLAGS="$CCDLFLAGS -fPIC";;
esac
else
- case "$host_os" in
- hpux*) CCDLFLAGS='+z';;
- solaris*|irix*) CCDLFLAGS='-K pic' ;;
- sunos*) CCDLFLAGS='-pic' ;;
- esix*|uxpds*) CCDLFLAGS='-Kpic' ;;
- *) CCDLFLAGS='' ;;
+ case "$target_os" in
+ hpux*) CCDLFLAGS="$CCDLFLAGS +Z";;
+ solaris*|irix*) CCDLFLAGS="$CCDLFLAGS -KPIC" ;;
+ sunos*) CCDLFLAGS="$CCDLFLAGS -PIC" ;;
+ esix*|uxpds*) CCDLFLAGS="$CCDLFLAGS -KPIC" ;;
+ *) : ${CCDLFLAGS=""} ;;
esac
fi
- case "$host_os" in
- hpux*) DLDFLAGS="-E"
- LDSHARED='ld -b'
- LDFLAGS="-Wl,-E"
+ case "$target_os" in
+ hpux*) DLDFLAGS="$DLDFLAGS -E"
+ : ${LDSHARED='ld -b'}
+ XLDFLAGS="$XLDFLAGS -Wl,-E"
rb_cv_dlopen=yes;;
- solaris*) LDSHARED='ld -G'
+ solaris*) if test "$GCC" = yes; then
+ : ${LDSHARED='$(CC) -Wl,-G'}
+ if test "$rb_cv_prog_gnu_ld" = yes; then
+ LDFLAGS="$LDFLAGS -Wl,-E"
+ LDSHARED="$LDSHARED -shared"
+ fi
+ else
+ : ${LDSHARED='ld -G'}
+ fi
rb_cv_dlopen=yes;;
- sunos*) LDSHARED='ld -assert nodefinitions'
+ sunos*) : ${LDSHARED='ld -assert nodefinitions'}
rb_cv_dlopen=yes;;
- irix*) LDSHARED='ld -ignore_unresolved'
+ irix*) : ${LDSHARED='ld -shared'}
rb_cv_dlopen=yes;;
- sysv4*) LDSHARED='ld -G'
+ sysv4*) : ${LDSHARED='ld -G'}
rb_cv_dlopen=yes;;
- esix*|uxpds*) LDSHARED="ld -G"
+ nto-qnx*) : ${LDSHARED="qcc -shared"}
+ rb_cv_dlopen=yes ;;
+ esix*|uxpds*) : ${LDSHARED="ld -G"}
+ rb_cv_dlopen=yes ;;
+ osf*) : ${LDSHARED="ld -shared -expect_unresolved \"*\""}
rb_cv_dlopen=yes ;;
- linux*) LDSHARED="gcc -shared"
+ linux* | gnu* | k*bsd*-gnu)
+ : ${LDSHARED="$CC -shared"}
rb_cv_dlopen=yes ;;
- freebsd*) LDSHARED="ld -Bshareable"
+ interix*) : ${LDSHARED="$CC -shared"}
+ XLDFLAGS="$XLDFLAGS -Wl,-E"
+ LIBPATHFLAG=" -L'%1\$-s'"
rb_cv_dlopen=yes ;;
- netbsd*) LDSHARED="ld -Bshareable"
+ freebsd*|dragonfly*) : ${LDSHARED="$CC -shared"}
+ if test "$rb_cv_binary_elf" = yes; then
+ LDFLAGS="$LDFLAGS -rdynamic"
+ DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$(.TARGET)'
+ else
+ test "$GCC" = yes && test "$rb_cv_prog_gnu_ld" = yes || LDSHARED="ld -Bshareable"
+ fi
rb_cv_dlopen=yes ;;
- openbsd*) LDSHARED="ld -Bshareable"
+ netbsd*) : ${LDSHARED='${CC} -shared'}
+ if test "$rb_cv_binary_elf" = yes; then
+ LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
+ LIBPATHFLAG=" -L'%1\$-s'"
+ RPATHFLAG=" -Wl,-R'%1\$-s'"
+ fi
rb_cv_dlopen=yes ;;
- nextstep*) LDSHARED='cc -r'
- LDFLAGS="-u libsys_s"
- DLDFLAGS="$ARCH_FLAG"
+ openbsd*) : ${LDSHARED="\$(CC) -shared ${CCDLFLAGS}"}
+ if test "$rb_cv_binary_elf" = yes; then
+ LDFLAGS="$LDFLAGS -Wl,-E"
+ fi
rb_cv_dlopen=yes ;;
- openstep*) LDSHARED='cc -dynamic -bundle -undefined suppress'
- LDFLAGS=""
- DLDFLAGS="$ARCH_FLAG"
+ bsdi3*) case "$CC" in
+ *shlicc*) : ${LDSHARED="$CC -r"}
+ rb_cv_dlopen=yes ;;
+ esac ;;
+ bsdi*) : ${LDSHARED="ld -shared"}
+ LDFLAGS="$LDFLAGS "'-rdynamic -Wl,-rpath,$(libdir)/ruby/$(MAJOR).$(MINOR)/i386-bsdi4.0'
rb_cv_dlopen=yes ;;
- rhapsody*) LDSHARED='cc -dynamic -bundle -undefined suppress'
- LDFLAGS=""
- DLDFLAGS="$ARCH_FLAG"
+ nextstep*) : ${LDSHARED='cc -r -nostdlib'}
+ LDFLAGS="$LDFLAGS -u libsys_s"
rb_cv_dlopen=yes ;;
- aix*) LDSHARED='../../miniruby ../aix_ld.rb $(TARGET)'
+ openstep*) : ${LDSHARED='cc -dynamic -bundle -undefined suppress'}
+ : ${LDFLAGS=""}
rb_cv_dlopen=yes ;;
- human*) DLDFLAGS=''
- LDSHARED=''
- LDFLAGS='' ;;
- beos*) LDSHARED="ld -xms"
- case "$host_cpu" in
+ rhapsody*) : ${LDSHARED='cc -dynamic -bundle -undefined suppress'}
+ : ${LDFLAGS=""}
+ rb_cv_dlopen=yes ;;
+ darwin*) : ${LDSHARED='cc -dynamic -bundle -undefined suppress -flat_namespace'}
+ : ${LDFLAGS=""}
+ rb_cv_dlopen=yes ;;
+ aix*) : ${LDSHARED='/usr/ccs/bin/ld'}
+ XLDFLAGS="$XLDFLAGS -Wl,-bE:ruby.imp"
+ DLDFLAGS='-brtl -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 '"$DLDFLAGS"
+ ARCH_FLAGS='-eInit_$(TARGET)'
+ : LDFLAGS="-brtl $LDFLAGS"
+ : ${ARCHFILE="ruby.imp"}
+ TRY_LINK='$(CC) $(DLDFLAGS) -oconftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS) $(CFLAGS)'
+ TRY_LINK="$TRY_LINK"' $(src) $(LIBPATH) $(LOCAL_LIBS) $(LIBS)'
+ rb_cv_dlopen=yes ;;
+
+ human*) : ${DLDFLAGS=''}
+ : ${LDSHARED=''}
+ : ${LDFLAGS=''}
+ : ${LINK_SO='ar cru $@ $(OBJS)'}
+ rb_cv_dlopen=yes ;;
+ beos*) case "$target_cpu" in
powerpc*)
- DLDFLAGS="-f ruby.exp -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o"
+ : ${LDSHARED="ld -xms"}
+ DLDFLAGS="$DLDFLAGS "'-export Init_$(TARGET) -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o'
;;
- *)
- DLDFLAGS="ruby.def -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o"
+ i586*)
+ : ${LDSHARED="ld -shared"}
+ DLDFLAGS="$DLDFLAGS -L/boot/develop/lib/x86 -lbe -lroot"
;;
esac
rb_cv_dlopen=yes ;;
- cygwin32*) LDSHARED='../../miniruby ../cygwin32_ld.rb' ;;
- *) LDSHARED='ld' ;;
+ nto-qnx*) DLDFLAGS="$DLDFLAGS -L/lib -L/usr/lib -L/usr/local/lib"
+ : ${LDSHARED='ld -Bshareable -x'}
+ LDFLAGS="$LDFLAGS -L/lib -L/usr/lib -L/usr/local/lib"
+ rb_cv_dlopen=yes;;
+ cygwin*|mingw*) : ${LDSHARED="${CC} -shared -s"}
+ XLDFLAGS="$XLDFLAGS -Wl,--stack,0x02000000"
+ DLDFLAGS="${DLDFLAGS} -Wl,--enable-auto-import,--export-all"
+ rb_cv_dlopen=yes ;;
+ hiuxmpp) : ${LDSHARED='ld -r'} ;;
+ atheos*) : ${LDSHARED="$CC -shared"}
+ rb_cv_dlopen=yes ;;
+ os2-emx*) LDFLAGS="$LDFLAGS -Zbsd-signals"
+ ;;
+ *) : ${LDSHARED='ld'} ;;
esac
AC_MSG_RESULT($rb_cv_dlopen)
fi
+AC_SUBST(LINK_SO)
+AC_SUBST(LIBPATHFLAG)
+AC_SUBST(RPATHFLAG)
+AC_SUBST(TRY_LINK)
dln_a_out_works=no
if test "$ac_cv_header_a_out_h" = yes; then
if test "$with_dln_a_out" = yes || test "$rb_cv_dlopen" = unknown; then
- AC_MSG_CHECKING(whether matz's dln works)
cat confdefs.h > config.h
- AC_CACHE_VAL(rb_cv_dln_a_out,
+ AC_CACHE_CHECK(whether matz's dln works, rb_cv_dln_a_out,
[AC_TRY_COMPILE([
#define USE_DLN_A_OUT
#include "dln.c"
@@ -415,7 +962,6 @@ if test "$ac_cv_header_a_out_h" = yes; then
[],
rb_cv_dln_a_out=yes,
rb_cv_dln_a_out=no)])
- AC_MSG_RESULT($rb_cv_dln_a_out)
if test "$rb_cv_dln_a_out" = yes; then
dln_a_out_works=yes
AC_DEFINE(USE_DLN_A_OUT)
@@ -429,21 +975,27 @@ if test "$dln_a_out_works" = yes; then
else
STATIC=-Bstatic
fi
- DLEXT=o
- AC_DEFINE(DLEXT, ".o")
+ DLEXT=so
+ AC_DEFINE(DLEXT, ".so")
CCDLFLAGS=
else
- case "$host_os" in
+ case "$target_os" in
hpux*) DLEXT=sl
AC_DEFINE(DLEXT, ".sl");;
- nextstep*) DLEXT=o
- AC_DEFINE(DLEXT, ".o");;
+ nextstep*) DLEXT=bundle
+ AC_DEFINE(DLEXT, ".bundle");;
openstep*) DLEXT=bundle
AC_DEFINE(DLEXT, ".bundle");;
rhapsody*) DLEXT=bundle
AC_DEFINE(DLEXT, ".bundle");;
- cygwin32*) DLEXT=dll
+ darwin*) DLEXT=bundle
+ AC_DEFINE(DLEXT, ".bundle");;
+ os2-emx*) DLEXT=dll
AC_DEFINE(DLEXT, ".dll");;
+ cygwin*|mingw*) DLEXT=so
+ AC_DEFINE(DLEXT, ".so")
+ DLEXT2=dll
+ AC_DEFINE(DLEXT2, ".dll");;
*) DLEXT=so
AC_DEFINE(DLEXT, ".so");;
esac
@@ -456,8 +1008,8 @@ else
STRIP=strip
fi
-case "$host_os" in
- linux*)
+case "$target_os" in
+ linux* | gnu* | k*bsd*-gnu)
STRIP='strip -S -x';;
nextstep*)
STRIP='strip -A -n';;
@@ -465,25 +1017,27 @@ case "$host_os" in
STRIP='strip -A -n';;
rhapsody*)
STRIP='strip -A -n';;
+ darwin*)
+ STRIP='strip -A -n';;
esac
EXTSTATIC=
AC_SUBST(EXTSTATIC)dnl
AC_ARG_WITH(static-linked-ext,
- [--with-static-linked-ext link external modules statically],
+ [ --with-static-linked-ext link external modules statically],
[case $withval in
yes) STATIC=
EXTSTATIC=static;;
*) ;;
esac])
-case "$host_os" in
+case "$target_os" in
human*)
AC_CHECK_LIB(signal, _harderr)
AC_CHECK_LIB(hmem, hmemset)
- AC_CHECK_FUNCS(select)
- AC_MSG_CHECKING(whether PD libc _dtos18 fail to convert big number)
- AC_CACHE_VAL(rb_cv_missing__dtos18,
+ AC_CHECK_FUNCS(select gettimeofday)
+ AC_CACHE_CHECK(whether PD libc _dtos18 fail to convert big number,
+ rb_cv_missing__dtos18,
[AC_TRY_RUN(
changequote(<<, >>)dnl
<<
@@ -496,13 +1050,12 @@ main ()
}
>>,
changequote([, ])dnl
-rb_cv_missing__dtos18=yes, rb_cv_missing__dtos18=no)])
- AC_MSG_RESULT($rb_cv_missing__dtos18)
+rb_cv_missing__dtos18=yes, rb_cv_missing__dtos18=no, rb_cv_missing__dtos18=no)])
if test "$rb_cv_missing__dtos18" = yes; then
AC_DEFINE(MISSING__DTOS18)
fi
- AC_MSG_CHECKING(whether PD libc fconvert fail to round)
- AC_CACHE_VAL(rb_cv_missing_fconvert,
+ AC_CACHE_CHECK(whether PD libc fconvert fail to round,
+ rb_cv_missing_fconvert,
[AC_TRY_RUN(
changequote(<<, >>)dnl
<<
@@ -516,82 +1069,297 @@ main ()
}
>>,
changequote([, ])dnl
-rb_cv_missing_fconvert=yes, rb_cv_missing_fconvert=no)])
- AC_MSG_RESULT($rb_cv_missing_fconvert)
+rb_cv_missing_fconvert=yes, rb_cv_missing_fconvert=no, rb_cv_missing_fconvert=no)])
if test "$rb_cv_missing_fconvert" = yes; then
AC_DEFINE(MISSING_FCONVERT)
fi
- LIBOBJS="$LIBOBJS x68.o"
- CFLAGS="$CFLAGS -fansi-only -cc1-stack=196608 -cpp-stack=2694144"
- binsuffix=.x
+ AC_LIBOBJ([x68.o])
+ CFLAGS="$CFLAGS -fansi-only"
+ XCFLAGS="$XCFLAGS -cc1-stack=262144 -cpp-stack=2694144"
+ EXEEXT=.x
+ OBJEXT=o
setup=Setup.x68
;;
- cygwin32*)
- binsuffix=.exe
- setup=Setup
+ dnl OS/2 environment w/ Autoconf 2.1x for EMX
+ os2-emx)
+ AC_LIBOBJ([os2])
+ setup=Setup.emx
+ ;;
+ *djgpp*)
+ setup=Setup.dj
;;
*)
- binsuffix=
setup=Setup
;;
esac
-
-
-AC_SUBST(binsuffix)
AC_SUBST(setup)
if test "$prefix" = NONE; then
prefix=$ac_default_prefix
fi
-if test "$fat_binary" = yes ; then
- CFLAGS="$CFLAGS $ARCH_FLAG"
+#if test "$fat_binary" != no ; then
+# CFLAGS="$CFLAGS $ARCH_FLAG"
+#fi
+
+if test x"$cross_compiling" = xyes; then
+ test x"$MINIRUBY" = x && MINIRUBY="${RUBY-ruby} -I`pwd` -rfake"
+ PREP=fake.rb
+else
+ MINIRUBY='./miniruby$(EXEEXT)'
+ PREP=''
fi
+AC_SUBST(MINIRUBY)
+AC_SUBST(PREP)
-LIBRUBY='libruby.a'
-LIBRUBYARG='libruby.a'
+FIRSTMAKEFILE=""
+LIBRUBY_A='lib$(RUBY_SO_NAME)-static.a'
+LIBRUBY='$(LIBRUBY_A)'
+LIBRUBYARG_STATIC='-l$(RUBY_SO_NAME)-static'
+LIBRUBYARG='$(LIBRUBYARG_STATIC)'
SOLIBS=
-if test "$host_os" = "beos"; then
- CFLAGS="$CFLAGS -relax_pointers"
- LIBRUBY='libruby.so'
- LIBRUBYARG='-lruby'
- SOLIBS='-lnet'
- echo creating ruby.def
- case "$host_cpu" in
- powerpc*)
- cp beos/ruby.def.in ruby.exp
- ;;
+
+case "$target_os" in
+ cygwin*|mingw*|beos*|openstep*|nextstep*|rhapsody*|darwin*|os2-emx*)
+ : ${DLDLIBS=""}
+ ;;
+ *)
+ DLDLIBS="$DLDLIBS -lc"
+ ;;
+esac
+
+RUBY_SO_NAME='$(RUBY_INSTALL_NAME)'
+LIBRUBY_LDSHARED=$LDSHARED
+LIBRUBY_DLDFLAGS=$DLDFLAGS
+LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR).$(TEENY)'
+LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so'
+ENABLE_SHARED=no
+
+AC_ARG_ENABLE(shared,
+ [ --enable-shared build a shared library for Ruby. ],
+ [enable_shared=$enableval])
+if test "$enable_shared" = 'yes'; then
+ LIBRUBY='$(LIBRUBY_SO)'
+ LIBRUBYARG_SHARED='-l$(RUBY_SO_NAME)'
+ LIBRUBYARG='$(LIBRUBYARG_SHARED)'
+ CFLAGS="$CFLAGS $CCDLFLAGS"
+ ENABLE_SHARED=yes
+ if test "$rb_cv_binary_elf" = yes; then
+ SOLIBS='$(LIBS)'
+ fi
+ case "$target_os" in
+ sunos4*)
+ LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
+ ;;
+ linux* | gnu* | k*bsd*-gnu)
+ LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR)'
+ LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
+ ;;
+ freebsd*|dragonfly*)
+ SOLIBS='$(LIBS)'
+ LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR)'
+ if test "$rb_cv_binary_elf" != "yes" ; then
+ LIBRUBY_SO="$LIBRUBY_SO.\$(TEENY)"
+ LIBRUBY_ALIASES=''
+ fi
+ ;;
+ netbsd*)
+ SOLIBS='$(LIBS)'
+ LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR).$(TEENY)'
+ LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR)'
+ LIBRUBYARG_SHARED='-Wl,-R -Wl,${libdir} -L${libdir} -L. -l$(RUBY_SO_NAME)'
+ if test "$rb_cv_binary_elf" = yes; then # ELF platforms
+ LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR)$(MINOR) lib$(RUBY_SO_NAME).so'
+ else # a.out platforms
+ LIBRUBY_ALIASES=""
+ fi
+ ;;
+ openbsd*)
+ SOLIBS='$(LIBS)'
+ LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).'`expr ${MINOR} \* 10 + ${TEENY}`
+ ;;
+ solaris*)
+ XLDFLAGS="$XLDFLAGS "'-R${libdir}'
+ ;;
+ hpux*)
+ XLDFLAGS="$XLDFLAGS "'-Wl,+s,+b,$(libdir)'
+ LIBRUBY_SO='lib$(RUBY_SO_NAME).sl.$(MAJOR).$(MINOR).$(TEENY)'
+ LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).sl.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).sl'
+ ;;
+ aix*)
+ if test "$GCC" = yes; then
+ LIBRUBY_LDSHARED='$(CC) -shared'
+ LIBRUBY_DLDFLAGS='-Wl,-bE:ruby.imp'
+ else
+ LIBRUBY_LDSHARED='/usr/ccs/bin/ld'
+ LIBRUBY_DLDFLAGS='-bE:ruby.imp -bM:SRE -bnoentry'
+ fi
+ LIBRUBYARG_SHARED='-L${libdir} -Wl,lib$(RUBY_SO_NAME).so'
+ SOLIBS='-lm -lc'
+ ;;
+ beos*)
+ case "$target_cpu" in
+ powerpc*)
+ LIBRUBY_DLDFLAGS='-f ruby.exp -lnet -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o'
+ ;;
+ esac
+ ;;
+ darwin*)
+ LIBRUBY_SO='lib$(RUBY_SO_NAME).$(MAJOR).$(MINOR).$(TEENY).dylib'
+ LIBRUBY_LDSHARED='cc -dynamiclib -undefined suppress -flat_namespace'
+ LIBRUBY_DLDFLAGS='-install_name $(libdir)/lib$(RUBY_SO_NAME).dylib -current_version $(MAJOR).$(MINOR).$(TEENY) -compatibility_version $(MAJOR).$(MINOR)'
+ LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).$(MAJOR).$(MINOR).dylib lib$(RUBY_SO_NAME).dylib'
+ ;;
+ atheos*)
+ LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR)'
+ LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
+ ;;
+ interix*)
+ LIBRUBYARG_SHARED='-L${libdir} -L. -l$(RUBY_SO_NAME)'
+ ;;
*)
- echo EXPORTS > ruby.def
- cat beos/ruby.def.in >> ruby.def
- ;;
+ ;;
esac
fi
+XLDFLAGS="$XLDFLAGS -L."
+AC_SUBST(ARCHFILE)
-if test "$enable_shared" = 'yes'; then
- LIBRUBY='libruby.so'
- LIBRUBYARG='-L./ -lruby'
+dnl build rdoc index if requested
+RDOCTARGET=""
+AC_ARG_ENABLE(install-doc,
+ [ --enable-install-doc build and install rdoc indexes during install ],
+ [install_doc=$enableval], [install_doc=no])
+if test "$install_doc" != no; then
+ RDOCTARGET="install-doc"
fi
+AC_SUBST(RDOCTARGET)
-case "$host_os" in
- nextstep*)
- CFLAGS="$CFLAGS -pipe"
- ;;
- openstep*)
+case "$target_os" in
+ netbsd*)
CFLAGS="$CFLAGS -pipe"
+ ;;
+ nextstep*|openstep*)
+ # The -fno-common is needed if we wish to embed the Ruby interpreter
+ # into a plugin module of some project (as opposed to embedding it
+ # within the project's application). The -I/usr/local/include is
+ # needed because CPP as discovered by configure (cc -E -traditional)
+ # fails to consult /usr/local/include by default. This causes
+ # mkmf.rb's have_header() to fail if the desired resource happens to be
+ # installed in the /usr/local tree.
+ CFLAGS="$CFLAGS -pipe -fno-common"
+ CPPFLAGS="$CPPFLAGS -I/usr/local/include"
+ ;;
+ rhapsody*)
+ CFLAGS="$CFLAGS -pipe -no-precomp -fno-common"
+ ;;
+ darwin*)
+ CFLAGS="$CFLAGS -pipe -fno-common"
+ ;;
+ os2-emx)
+ CFLAGS="$CFLAGS -DOS2 -Zmts"
+ LIBRUBY_A=`echo $LIBRUBY_A | sed 's/^lib//'`
+ LIBRUBY_SO=`echo $LIBRUBY_SO | sed 's/^lib//'`
+ LIBRUBY_ALIASES=`for i in $LIBRUBY_ALIASES; do echo "$i"; done | sed 's/^lib//'`
+ ;;
+ osf*)
+ if test "$GCC" != "yes" ; then
+ # compile something small: taint.c is fine for this.
+ # the main point is the '-v' flag of 'cc'.
+ case "`cc -v -I. -c main.c -o /tmp/main.o 2>&1`" in
+ */gemc_cc*) # we have the new DEC GEM CC
+ CFLAGS="$CFLAGS -oldc"
+ ;;
+ *) # we have the old MIPS CC
+ ;;
+ esac
+ # cleanup
+ rm -f /tmp/main.o
+ CFLAGS="$CFLAGS -std"
+ fi
;;
- rhasody*)
- CFLAGS="$CFLAGS -pipe -no-precomp"
- ;;
- *)
- ;;
+ beos*)
+ case "$target_cpu" in
+ powerpc*)
+ CFLAGS="$CFLAGS -relax_pointers"
+ ;;
+ esac
+ ;;
+ cygwin*|mingw*)
+ case "$target_os" in
+ cygwin*)
+ if test x"$enable_shared" = xyes; then
+ LIBRUBY_SO='cyg$(RUBY_SO_NAME)'${MAJOR}${MINOR}.dll
+ LIBRUBY='lib$(RUBY_SO_NAME).dll.a'
+ fi
+ AC_LIBOBJ([strftime])
+ ;;
+ mingw*)
+ RUBY_SO_NAME=msvcrt-'$(RUBY_INSTALL_NAME)'${MAJOR}${MINOR}
+ if test x"$enable_shared" = xyes; then
+ LIBRUBY_SO='$(RUBY_SO_NAME)'.dll
+ LIBRUBY='lib$(LIBRUBY_SO).a'
+ fi
+ AC_LIBOBJ([win32])
+ COMMON_LIBS=m
+ COMMON_MACROS="WIN32_LEAN_AND_MEAN="
+ COMMON_HEADERS="windows.h winsock.h"
+ ;;
+ esac
+ XCFLAGS="$XCFLAGS"
+ LIBRUBY_DLDFLAGS="${DLDFLAGS}"' -Wl,--out-implib=$(LIBRUBY)'
+ LIBRUBY_ALIASES=''
+ FIRSTMAKEFILE=GNUmakefile:cygwin/GNUmakefile.in
+ SOLIBS='$(LIBS)'
+ if test x"$enable_shared" = xno; then
+ LIBRUBY_SO=dummy
+ LIBRUBY='lib$(RUBY_SO_NAME).a'
+ LIBRUBYARG='-l$(RUBY_SO_NAME)'
+ fi
+ ;;
+ hpux*)
+ case "$YACC" in
+ *yacc*)
+ XCFLAGS="$XCFLAGS -DYYMAXDEPTH=300"
+ YACC="$YACC -Nl40000 -Nm40000"
+ ;;
+ esac
+ ;;
+ *)
+ ;;
esac
+case "$build_os" in
+ *msdosdjgpp*) FIRSTMAKEFILE=GNUmakefile:djgpp/GNUmakefile.in;;
+esac
+AC_SUBST(XCFLAGS)dnl
+AC_SUBST(XLDFLAGS)dnl
+AC_SUBST(LIBRUBY_LDSHARED)
+AC_SUBST(LIBRUBY_DLDFLAGS)
+AC_SUBST(RUBY_INSTALL_NAME)
+AC_SUBST(rubyw_install_name)
+AC_SUBST(RUBYW_INSTALL_NAME)
+AC_SUBST(RUBY_SO_NAME)
+AC_SUBST(LIBRUBY_A)
+AC_SUBST(LIBRUBY_SO)
+AC_SUBST(LIBRUBY_ALIASES)
AC_SUBST(LIBRUBY)
AC_SUBST(LIBRUBYARG)
+AC_SUBST(LIBRUBYARG_STATIC)
+AC_SUBST(LIBRUBYARG_SHARED)
AC_SUBST(SOLIBS)
+AC_SUBST(DLDLIBS)
+AC_SUBST(ENABLE_SHARED)
+AC_SUBST(MAINLIBS)
+AC_SUBST(COMMON_LIBS)
+AC_SUBST(COMMON_MACROS)
+AC_SUBST(COMMON_HEADERS)
+AC_SUBST(EXPORT_PREFIX)
+
+MAKEFILES="Makefile `echo $FIRSTMAKEFILE | sed 's/:.*//'`"
+MAKEFILES="`echo $MAKEFILES`"
+AC_SUBST(MAKEFILES)
ri_prefix=
test "$program_prefix" != NONE &&
@@ -602,30 +1370,105 @@ test "$program_suffix" != NONE &&
ri_suffix=$program_suffix
RUBY_INSTALL_NAME="${ri_prefix}ruby${ri_suffix}"
-AC_DEFINE_UNQUOTED(RUBY_LIB, "${prefix}/lib/${RUBY_INSTALL_NAME}")
-AC_DEFINE_UNQUOTED(RUBY_SITE_LIB, "${prefix}/lib/${RUBY_INSTALL_NAME}/site_ruby")
+case "$target_os" in
+ cygwin*|mingw*)
+ RUBYW_INSTALL_NAME="${ri_prefix}rubyw${ri_suffix}"
+ 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}"
+
+AC_ARG_WITH(sitedir,
+ [ --with-sitedir=DIR site libraries in DIR [PREFIX/lib/ruby/site_ruby]],
+ [sitedir=$withval],
+ [sitedir='${prefix}/lib/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_SITE_LIB_PATH="$SITE_DIR";;
+esac
+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_SUBST(arch)dnl
+AC_SUBST(sitearch)dnl
+AC_SUBST(sitedir)dnl
+
+configure_args=$ac_configure_args
+AC_SUBST(configure_args)dnl
-if test "$fat_binary" = yes ; then
- arch="fat-${host_os}"
+if test "$fat_binary" != no ; then
+ arch="fat-${target_os}"
AC_DEFINE_UNQUOTED(RUBY_THIN_ARCHLIB,
- "${prefix}/lib/${RUBY_INSTALL_NAME}/" __ARCHITECTURE__ "-${host_os}" )
+ "${RUBY_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
AC_DEFINE_UNQUOTED(RUBY_SITE_THIN_ARCHLIB,
- "${prefix}/lib/${RUBY_INSTALL_NAME}/" __ARCHITECTURE__ "-${host_os}" )
-
- AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, "${prefix}/lib/${RUBY_INSTALL_NAME}/${arch}")
- AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${prefix}/lib/${RUBY_INSTALL_NAME}/site_ruby/${arch}")
- AC_DEFINE_UNQUOTED(RUBY_PLATFORM, __ARCHITECTURE__ "-${host_os}" )
+ "${RUBY_SITE_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
+ AC_DEFINE_UNQUOTED(RUBY_PLATFORM, __ARCHITECTURE__ "-${target_os}")
else
- arch="${host_cpu}-${host_os}"
- AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, "${prefix}/lib/${RUBY_INSTALL_NAME}/${arch}")
- AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${prefix}/lib/${RUBY_INSTALL_NAME}/site_ruby/${arch}")
+ arch="${target_cpu}-${target_os}"
AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "${arch}")
fi
-echo "creating config.h"
-cat confdefs.h > config.h
+case "$target_os" in
+ mingw*) sitearch="i386-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_ARG_WITH(search-path,
+ [ --with-search-path=DIR specify the additional search path],
+ [search_path=$withval])
+if test "$search_path" != ""; then
+ AC_DEFINE_UNQUOTED(RUBY_SEARCH_PATH,"$search_path")
+fi
+
+AC_ARG_WITH(mantype,
+ [ --with-mantype=TYPE specify man page type; TYPE is one of man and doc],
+ [
+ case "$withval" in
+ man|doc)
+ MANTYPE=$withval
+ ;;
+ *)
+ AC_MSG_ERROR(invalid man type: $withval)
+ ;;
+ esac
+ ])
+if test -z "$MANTYPE"; then
+ AC_PATH_PROGS(NROFF, nroff awf, /bin/false, "/usr/bin:/usr/ucb")
+ if ${NROFF} -mdoc ${srcdir}/ruby.1 >/dev/null 2>&1; then
+ MANTYPE=doc
+ else
+ MANTYPE=man
+ fi
+fi
+AC_SUBST(MANTYPE)
+
+if test -f config.h && tr -d '\015' < confdefs.h | cmp -s config.h -; then
+ echo "config.h unchanged"
+else
+ echo "creating config.h"
+ tr -d '\015' < confdefs.h > config.h
+fi
+: > confdefs.h
-AC_OUTPUT(Makefile ext/extmk.rb)
+AC_CONFIG_FILES([$FIRSTMAKEFILE Makefile])
+AC_OUTPUT
diff --git a/cygwin/GNUmakefile.in b/cygwin/GNUmakefile.in
new file mode 100644
index 0000000000..da9efaab47
--- /dev/null
+++ b/cygwin/GNUmakefile.in
@@ -0,0 +1,65 @@
+include Makefile
+
+ENABLE_SHARED=@ENABLE_SHARED@
+
+ifeq (@target_os@,cygwin)
+ DLL_BASE_NAME := $(subst .dll,,$(LIBRUBY_SO))
+else
+ DLL_BASE_NAME := $(RUBY_SO_NAME)
+endif
+
+ifneq ($(ENABLE_SHARED),yes)
+ RUBY_EXP = $(RUBY_INSTALL_NAME).exp
+ EXTOBJS = $(RUBY_EXP)
+ LIBRUBYARG = $(LIBRUBY_A)
+ LIBRUBY_SO =
+endif
+
+ifeq ($(RUBY_INSTALL_NAME),ruby)
+ RUBYW_INSTALL_NAME = $(RUBY_INSTALL_NAME)w
+else
+ RUBYW_INSTALL_NAME = $(subst ruby,rubyw,$(RUBY_INSTALL_NAME))
+endif
+
+WPROGRAM = $(RUBYW_INSTALL_NAME)$(EXEEXT)
+SOLIBS := $(DLL_BASE_NAME).res.@OBJEXT@ $(SOLIBS)
+EXTOBJS += $(@:$(EXEEXT)=.res.@OBJEXT@)
+
+$(LIBRUBY): $(RUBY_EXP) $(LIBRUBY_SO)
+$(RUBY_EXP) $(LIBRUBY_SO): $(DLL_BASE_NAME).res.@OBJEXT@
+
+%.res.@OBJEXT@: %.rc
+ @WINDRES@ --include-dir . --include-dir $(<D) --include-dir $(srcdir)/win32 $< $@
+
+$(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(DLL_BASE_NAME).rc: rbconfig.rb
+ @$(MINIRUBY) $(srcdir)/win32/resource.rb \
+ -ruby_name=$(RUBY_INSTALL_NAME) -rubyw_name=$(RUBYW_INSTALL_NAME) \
+ -so_name=$(DLL_BASE_NAME) \
+ . $(icondirs) $(srcdir)/win32
+
+$(PROGRAM): $(RUBY_INSTALL_NAME).res.@OBJEXT@
+$(WPROGRAM): $(RUBYW_INSTALL_NAME).res.@OBJEXT@
+ @rm -f $@
+ $(PURIFY) $(CC) -mwindows -e _mainCRTStartup $(LDFLAGS) $(XLDFLAGS) \
+ $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@
+
+$(RUBY_EXP): $(LIBRUBY_A)
+ @DLLWRAP@ --target=@target_os@ --driver-name=$(CC) \
+ --output-exp=$(RUBY_EXP) \
+ --export-all $(LIBRUBY_A) $(LIBS) -o $(PROGRAM)
+ $(LDSHARED) $(DLDFLAGS) $(OBJS) dmyext.o $(SOLIBS) -o $(PROGRAM)
+ @rm -f $(PROGRAM)
+
+GNUmakefile: $(srcdir)/cygwin/GNUmakefile.in
+
+ifeq (@target_os@,mingw32)
+$(OBJS) $(MAINOBJ): win32/win32.h
+endif
+
+ifeq (@target_os@,cygwin)
+cygwin-$(RUBY_INSTALL_NAME)$(MAJOR)$(MINOR).dll: $(LIBRUBY_A)
+ @NM@ --extern --defined $(LIBRUBY_A) | \
+ $(MINIRUBY) -ne 'BEGIN{puts "EXPORTS"}; puts $$1+"=cyg$(RUBY_INSTALL_NAME)$(MAJOR)$(MINOR)."+$$1 if / [CDT] _(.*)$$/' >rubydll.def
+ @DLLWRAP@ -s --def=rubydll.def -o $@
+ @rm -f rubydll.def
+endif
diff --git a/defines.h b/defines.h
index 1a857581fb..77f3f40a55 100644
--- a/defines.h
+++ b/defines.h
@@ -12,41 +12,240 @@
#define RUBY
+#ifdef __cplusplus
+# ifndef HAVE_PROTOTYPES
+# define HAVE_PROTOTYPES 1
+# endif
+# ifndef HAVE_STDARG_PROTOTYPES
+# define HAVE_STDARG_PROTOTYPES 1
+# endif
+#endif
+
+#undef _
+#ifdef HAVE_PROTOTYPES
+# define _(args) args
+#else
+# define _(args) ()
+#endif
+
+#undef __
+#ifdef HAVE_STDARG_PROTOTYPES
+# define __(args) args
+#else
+# define __(args) ()
+#endif
+
+#ifdef __cplusplus
+#define ANYARGS ...
+#else
+#define ANYARGS
+#endif
+
+#define xmalloc ruby_xmalloc
+#define xcalloc ruby_xcalloc
+#define xrealloc ruby_xrealloc
+#define xfree ruby_xfree
+
+void *xmalloc _((long));
+void *xcalloc _((long,long));
+void *xrealloc _((void*,long));
+void xfree _((void*));
+
+#if SIZEOF_LONG_LONG > 0
+# define LONG_LONG long long
+#elif SIZEOF___INT64 > 0
+# define HAVE_LONG_LONG 1
+# define LONG_LONG __int64
+# undef SIZEOF_LONG_LONG
+# define SIZEOF_LONG_LONG SIZEOF___INT64
+#endif
+
+#if SIZEOF_INT*2 <= SIZEOF_LONG_LONG
+# define BDIGIT unsigned int
+# define SIZEOF_BDIGITS SIZEOF_INT
+# define BDIGIT_DBL unsigned LONG_LONG
+# define BDIGIT_DBL_SIGNED LONG_LONG
+#elif SIZEOF_INT*2 <= SIZEOF_LONG
+# define BDIGIT unsigned int
+# define SIZEOF_BDIGITS SIZEOF_INT
+# define BDIGIT_DBL unsigned long
+# define BDIGIT_DBL_SIGNED long
+#elif SIZEOF_SHORT*2 <= SIZEOF_LONG
+# define BDIGIT unsigned short
+# define SIZEOF_BDIGITS SIZEOF_SHORT
+# define BDIGIT_DBL unsigned long
+# define BDIGIT_DBL_SIGNED long
+#else
+# define BDIGIT unsigned short
+# define SIZEOF_BDIGITS (SIZEOF_LONG/2)
+# define BDIGIT_DBL unsigned long
+# define BDIGIT_DBL_SIGNED long
+#endif
+
+#ifdef __CYGWIN__
+#undef _WIN32
+#endif
+
+#if defined(MSDOS) || defined(_WIN32) || defined(__human68k__) || defined(__EMX__)
+#define DOSISH 1
+#ifndef _WIN32_WCE
+# define DOSISH_DRIVE_LETTER
+#endif
+#endif
+
/* define RUBY_USE_EUC/SJIS for default kanji-code */
-#if defined(MSDOS) || defined(__CYGWIN32__) || defined(__human68k__) || defined(__MACOS__)
-#undef RUBY_USE_EUC
-#define RUBY_USE_SJIS
+#ifndef DEFAULT_KCODE
+#if defined(DOSISH) || defined(__CYGWIN__) || defined(__MACOS__) || defined(OS2)
+#define DEFAULT_KCODE KCODE_SJIS
#else
-#define RUBY_USE_EUC
-#undef RUBY_USE_SJIS
+#define DEFAULT_KCODE KCODE_EUC
+#endif
#endif
-#ifdef NeXT
-#define DYNAMIC_ENDIAN /* determine endian at runtime */
+#ifdef __NeXT__
+/* NextStep, OpenStep, Rhapsody */
+#ifndef S_IRUSR
+#define S_IRUSR 0000400 /* read permission, owner */
+#endif
+#ifndef S_IRGRP
+#define S_IRGRP 0000040 /* read permission, group */
+#endif
+#ifndef S_IROTH
+#define S_IROTH 0000004 /* read permission, other */
+#endif
+#ifndef S_IWUSR
+#define S_IWUSR 0000200 /* write permission, owner */
+#endif
+#ifndef S_IWGRP
+#define S_IWGRP 0000020 /* write permission, group */
+#endif
+#ifndef S_IWOTH
+#define S_IWOTH 0000002 /* write permission, other */
+#endif
+#ifndef S_IXUSR
+#define S_IXUSR 0000100 /* execute/search permission, owner */
+#endif
+#ifndef S_IXGRP
+#define S_IXGRP 0000010 /* execute/search permission, group */
+#endif
+#ifndef S_IXOTH
+#define S_IXOTH 0000001 /* execute/search permission, other */
+#endif
+#ifndef S_IRWXU
+#define S_IRWXU 0000700 /* read, write, execute permissions, owner */
+#endif
+#ifndef S_IRWXG
+#define S_IRWXG 0000070 /* read, write, execute permissions, group */
+#endif
+#ifndef S_IRWXO
+#define S_IRWXO 0000007 /* read, write, execute permissions, other */
+#endif
+#ifndef S_ISBLK
+#define S_ISBLK(mode) (((mode) & (0170000)) == (0060000))
+#endif
+#ifndef S_ISCHR
+#define S_ISCHR(mode) (((mode) & (0170000)) == (0020000))
+#endif
+#ifndef S_ISDIR
+#define S_ISDIR(mode) (((mode) & (0170000)) == (0040000))
+#endif
+#ifndef S_ISFIFO
+#define S_ISFIFO(mode) (((mode) & (0170000)) == (0010000))
+#endif
+#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__
-#define S_IXUSR _S_IXUSR /* execute/search permission, owner */
+/* NextStep, OpenStep (but not Rhapsody) */
+#ifndef GETPGRP_VOID
+#define GETPGRP_VOID 1
+#endif
+#ifndef WNOHANG
+#define WNOHANG 01
+#endif
+#ifndef WUNTRACED
+#define WUNTRACED 02
+#endif
+#ifndef X_OK
+#define X_OK 1
#endif
-#define S_IXGRP 0000010 /* execute/search permission, group */
-#define S_IXOTH 0000001 /* execute/search permission, other */
+typedef int pid_t;
+#endif /* __APPLE__ */
#endif /* NeXT */
-#ifdef NT
-#include "missing/nt.h"
+#ifdef _WIN32
+#include "win32/win32.h"
+#endif
+
+#if defined(__VMS)
+#include "vms/vms.h"
+#endif
+
+#if defined(__BEOS__)
+#include <net/socket.h> /* intern.h needs fd_set definition */
+#endif
+
+#undef RUBY_EXTERN
+#if defined _WIN32 && !defined __GNUC__
+# ifndef RUBY_EXPORT
+# define RUBY_EXTERN extern __declspec(dllimport)
+# endif
+#endif
+
+#ifndef RUBY_EXTERN
+#define RUBY_EXTERN extern
#endif
#ifndef EXTERN
-#define EXTERN extern
+#define EXTERN RUBY_EXTERN /* deprecated */
+#endif
+
+#if defined(sparc) || defined(__sparc__)
+static inline void
+flush_register_windows(void)
+{
+ asm
+#ifdef __GNUC__
+ volatile
+#endif
+# if defined(__sparc_v9__) || defined(__sparcv9) || defined(__arch64__)
+ ("flushw")
+# elif defined(linux) || defined(__linux__)
+ ("ta 0x83")
+# else /* Solaris, OpenBSD, NetBSD, etc. */
+ ("ta 0x03")
+# endif /* trap always to flush register windows if we are on a Sparc system */
+ ;
+}
+# define FLUSH_REGISTER_WINDOWS flush_register_windows()
+#else
+# define FLUSH_REGISTER_WINDOWS ((void)0)
+#endif
+
+#if defined(DOSISH)
+#define PATH_SEP ";"
+#elif defined(riscos)
+#define PATH_SEP ","
+#else
+#define PATH_SEP ":"
#endif
+#define PATH_SEP_CHAR PATH_SEP[0]
-#ifdef sparc
-#define FLUSH_REGISTER_WINDOWS asm("ta 3")
+#if defined(__human68k__)
+#define PATH_ENV "path"
#else
-#define FLUSH_REGISTER_WINDOWS /* empty */
+#define PATH_ENV "PATH"
#endif
-#if defined(__human68k__) || defined(__CYGWIN32__)
-#undef HAVE_RANDOM
-#undef HAVE_SETITIMER
+#if defined(DOSISH) && !defined(__human68k__) && !defined(__EMX__)
+#define ENV_IGNORECASE
#endif
#ifndef RUBY_PLATFORM
diff --git a/dir.c b/dir.c
index 44f662e2e8..2de990ad8a 100644
--- a/dir.c
+++ b/dir.c
@@ -1,4 +1,4 @@
-/************************************************
+/**********************************************************************
dir.c -
@@ -6,33 +6,35 @@
$Date$
created at: Wed Jan 5 09:51:01 JST 1994
- Copyright (C) 1993-1998 Yukihiro Matsumoto
+ Copyright (C) 1993-2003 Yukihiro Matsumoto
+ Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
+ Copyright (C) 2000 Information-technology Promotion Agency, Japan
-************************************************/
+**********************************************************************/
#include "ruby.h"
#include <sys/types.h>
#include <sys/stat.h>
-#ifdef HAVE_SYS_PARAM_H
-# include <sys/param.h>
-#else
-# define MAXPATHLEN 1024
-#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#if HAVE_DIRENT_H
+#if defined HAVE_DIRENT_H && !defined _WIN32
# include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name)
-#elif HAVE_DIRECT_H
+#elif defined HAVE_DIRECT_H && !defined _WIN32
# include <direct.h>
# define NAMLEN(dirent) strlen((dirent)->d_name)
#else
# define dirent direct
-# define NAMLEN(dirent) (dirent)->d_namlen
+# if !defined __NeXT__
+# define NAMLEN(dirent) (dirent)->d_namlen
+# else
+# /* On some versions of NextStep, d_namlen is always zero, so avoid it. */
+# define NAMLEN(dirent) strlen((dirent)->d_name)
+# endif
# if HAVE_SYS_NDIR_H
# include <sys/ndir.h>
# endif
@@ -42,214 +44,678 @@
# if HAVE_NDIR_H
# include <ndir.h>
# endif
-# if defined(NT) && defined(_MSC_VER)
-# include "missing/dir.h"
+# ifdef _WIN32
+# include "win32/dir.h"
# endif
#endif
#include <errno.h>
-#ifndef NT
+#ifndef HAVE_STDLIB_H
char *getenv();
#endif
-#ifdef USE_CWGUSI
-# include <sys/errno.h>
+#ifndef HAVE_STRING_H
+char *strchr _((char*,char));
+#endif
+
+#include <ctype.h>
+
+#include "util.h"
+
+#ifndef HAVE_LSTAT
+#define lstat(path,st) stat(path,st)
#endif
-static VALUE cDir;
+#define FNM_NOESCAPE 0x01
+#define FNM_PATHNAME 0x02
+#define FNM_DOTMATCH 0x04
+#define FNM_CASEFOLD 0x08
+
+#define FNM_NOMATCH 1
+#define FNM_ERROR 2
+
+#define downcase(c) (nocase && ISUPPER(c) ? tolower(c) : (c))
+
+#ifndef CharNext /* defined as CharNext[AW] on Windows. */
+# if defined(DJGPP)
+# define CharNext(p) ((p) + mblen(p, MB_CUR_MAX))
+# else
+# define CharNext(p) ((p) + 1)
+# endif
+#endif
+
+#if defined DOSISH
+#define isdirsep(c) ((c) == '/' || (c) == '\\')
+#else
+#define isdirsep(c) ((c) == '/')
+#endif
+
+static char *
+range(pat, test, flags)
+ const char *pat;
+ int test;
+ int flags;
+{
+ int not, ok = 0;
+ int nocase = flags & FNM_CASEFOLD;
+ int escape = !(flags & FNM_NOESCAPE);
+
+ not = *pat == '!' || *pat == '^';
+ if (not)
+ pat++;
+
+ test = downcase(test);
+
+ while (*pat != ']') {
+ int cstart, cend;
+ if (escape && *pat == '\\')
+ pat++;
+ cstart = cend = *pat++;
+ if (!cstart)
+ return NULL;
+ if (*pat == '-' && pat[1] != ']') {
+ pat++;
+ if (escape && *pat == '\\')
+ pat++;
+ cend = *pat++;
+ if (!cend)
+ return NULL;
+ }
+ if (downcase(cstart) <= test && test <= downcase(cend))
+ ok = 1;
+ }
+ return ok == not ? NULL : (char *)pat + 1;
+}
+
+#define ISDIRSEP(c) (pathname && isdirsep(c))
+#define PERIOD(s) (period && *(s) == '.' && \
+ ((s) == string || ISDIRSEP((s)[-1])))
+static int
+fnmatch(pat, string, flags)
+ const char *pat;
+ const char *string;
+ int flags;
+{
+ int c;
+ int test;
+ const char *s = string;
+ int escape = !(flags & FNM_NOESCAPE);
+ int pathname = flags & FNM_PATHNAME;
+ int period = !(flags & FNM_DOTMATCH);
+ int nocase = flags & FNM_CASEFOLD;
+
+ while (c = *pat++) {
+ switch (c) {
+ case '?':
+ if (!*s || ISDIRSEP(*s) || PERIOD(s))
+ return FNM_NOMATCH;
+ s++;
+ break;
+ case '*':
+ while ((c = *pat++) == '*')
+ ;
+
+ if (PERIOD(s))
+ return FNM_NOMATCH;
+
+ if (!c) {
+ if (pathname && *rb_path_next(s))
+ return FNM_NOMATCH;
+ else
+ return 0;
+ }
+ else if (ISDIRSEP(c)) {
+ s = rb_path_next(s);
+ if (*s) {
+ s++;
+ break;
+ }
+ return FNM_NOMATCH;
+ }
+
+ test = escape && c == '\\' ? *pat : c;
+ test = downcase(test);
+ pat--;
+ while (*s) {
+ if ((c == '?' || c == '[' || downcase(*s) == test) &&
+ !fnmatch(pat, s, flags | FNM_DOTMATCH))
+ return 0;
+ else if (ISDIRSEP(*s))
+ break;
+ s++;
+ }
+ return FNM_NOMATCH;
+
+ case '[':
+ if (!*s || ISDIRSEP(*s) || PERIOD(s))
+ return FNM_NOMATCH;
+ pat = range(pat, *s, flags);
+ if (pat == NULL)
+ return FNM_NOMATCH;
+ s++;
+ break;
+
+ case '\\':
+ if (escape
+#if defined DOSISH
+ && *pat && strchr("*?[]\\", *pat)
+#endif
+ ) {
+ c = *pat;
+ if (!c)
+ c = '\\';
+ else
+ pat++;
+ }
+ /* FALLTHROUGH */
+
+ default:
+#if defined DOSISH
+ if (ISDIRSEP(c) && isdirsep(*s))
+ ;
+ else
+#endif
+ if(downcase(c) != downcase(*s))
+ return FNM_NOMATCH;
+ s++;
+ break;
+ }
+ }
+ return !*s ? 0 : FNM_NOMATCH;
+}
+
+VALUE rb_cDir;
+
+struct dir_data {
+ DIR *dir;
+ char *path;
+};
static void
free_dir(dir)
- DIR *dir;
+ struct dir_data *dir;
{
- if (dir) closedir(dir);
+ if (dir) {
+ if (dir->dir) closedir(dir->dir);
+ if (dir->path) free(dir->path);
+ }
+ free(dir);
}
static VALUE dir_close _((VALUE));
+static VALUE dir_s_alloc _((VALUE));
static VALUE
-dir_s_open(dir_class, dirname)
- VALUE dir_class, dirname;
+dir_s_alloc(klass)
+ VALUE klass;
{
- VALUE obj;
- DIR *dirp;
+ struct dir_data *dirp;
+ VALUE obj = Data_Make_Struct(klass, struct dir_data, 0, free_dir, dirp);
- Check_SafeStr(dirname);
+ dirp->dir = NULL;
+ dirp->path = NULL;
- dirp = opendir(RSTRING(dirname)->ptr);
- if (dirp == NULL) {
+ return obj;
+}
+
+/*
+ * call-seq:
+ * Dir.new( string ) -> aDir
+ *
+ * Returns a new directory object for the named directory.
+ */
+static VALUE
+dir_initialize(dir, dirname)
+ VALUE dir, dirname;
+{
+ struct dir_data *dp;
+
+ SafeStringValue(dirname);
+ Data_Get_Struct(dir, struct dir_data, dp);
+ if (dp->dir) closedir(dp->dir);
+ if (dp->path) free(dp->path);
+ dp->dir = NULL;
+ dp->path = NULL;
+ dp->dir = opendir(RSTRING(dirname)->ptr);
+ if (dp->dir == NULL) {
if (errno == EMFILE || errno == ENFILE) {
- gc_gc();
- dirp = opendir(RSTRING(dirname)->ptr);
+ rb_gc();
+ dp->dir = opendir(RSTRING(dirname)->ptr);
}
- if (dirp == NULL) {
+ if (dp->dir == NULL) {
rb_sys_fail(RSTRING(dirname)->ptr);
}
}
+ dp->path = strdup(RSTRING(dirname)->ptr);
+
+ return dir;
+}
- obj = Data_Wrap_Struct(dir_class, 0, free_dir, dirp);
+/*
+ * call-seq:
+ * Dir.open( string ) => aDir
+ * Dir.open( string ) {| aDir | block } => anObject
+ *
+ * With no block, <code>open</code> is a synonym for
+ * <code>Dir::new</code>. If a block is present, it is passed
+ * <i>aDir</i> as a parameter. The directory is closed at the end of
+ * the block, and <code>Dir::open</code> returns the value of the
+ * block.
+ */
+static VALUE
+dir_s_open(klass, dirname)
+ VALUE klass, dirname;
+{
+ struct dir_data *dp;
+ VALUE dir = Data_Make_Struct(klass, struct dir_data, 0, free_dir, dp);
- if (iterator_p()) {
- return rb_ensure(rb_yield, obj, dir_close, obj);
+ dir_initialize(dir, dirname);
+ if (rb_block_given_p()) {
+ return rb_ensure(rb_yield, dir, dir_close, dir);
}
- return obj;
+ return dir;
}
static void
dir_closed()
{
- Fail("closed directory");
+ rb_raise(rb_eIOError, "closed directory");
}
-#define GetDIR(obj, dirp) {\
- Data_Get_Struct(obj, DIR, dirp);\
- if (dirp == NULL) dir_closed();\
+#define GetDIR(obj, dirp) do {\
+ Data_Get_Struct(obj, struct dir_data, dirp);\
+ if (dirp->dir == NULL) dir_closed();\
+} while (0)
+
+/*
+ * call-seq:
+ * dir.path => string or nil
+ *
+ * Returns the path parameter passed to <em>dir</em>'s constructor.
+ *
+ * d = Dir.new("..")
+ * d.path #=> ".."
+ */
+static VALUE
+dir_path(dir)
+ VALUE dir;
+{
+ struct dir_data *dirp;
+
+ GetDIR(dir, dirp);
+ if (!dirp->path) return Qnil;
+ return rb_str_new2(dirp->path);
}
+/*
+ * call-seq:
+ * dir.read => string or nil
+ *
+ * Reads the next entry from <em>dir</em> and returns it as a string.
+ * Returns <code>nil</code> at the end of the stream.
+ *
+ * d = Dir.new("testdir")
+ * d.read #=> "."
+ * d.read #=> ".."
+ * d.read #=> "config.h"
+ */
static VALUE
dir_read(dir)
VALUE dir;
{
- DIR *dirp;
+ struct dir_data *dirp;
struct dirent *dp;
GetDIR(dir, dirp);
errno = 0;
- dp = readdir(dirp);
- if (dp)
- return str_taint(str_new(dp->d_name, NAMLEN(dp)));
+ dp = readdir(dirp->dir);
+ if (dp) {
+ return rb_tainted_str_new(dp->d_name, NAMLEN(dp));
+ }
else if (errno == 0) { /* end of stream */
return Qnil;
}
else {
rb_sys_fail(0);
}
+ return Qnil; /* not reached */
}
+/*
+ * call-seq:
+ * dir.each { |filename| block } => dir
+ *
+ * Calls the block once for each entry in this directory, passing the
+ * filename of each entry as a parameter to the block.
+ *
+ * d = Dir.new("testdir")
+ * d.each {|x| puts "Got #{x}" }
+ *
+ * <em>produces:</em>
+ *
+ * Got .
+ * Got ..
+ * Got config.h
+ * Got main.rb
+ */
static VALUE
dir_each(dir)
VALUE dir;
{
- DIR *dirp;
+ struct dir_data *dirp;
struct dirent *dp;
- VALUE file;
GetDIR(dir, dirp);
- for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
- file = str_taint(str_new(dp->d_name, NAMLEN(dp)));
- rb_yield(file);
+ for (dp = readdir(dirp->dir); dp != NULL; dp = readdir(dirp->dir)) {
+ rb_yield(rb_tainted_str_new(dp->d_name, NAMLEN(dp)));
+ if (dirp->dir == NULL) dir_closed();
}
return dir;
}
+/*
+ * call-seq:
+ * dir.pos => integer
+ * dir.tell => integer
+ *
+ * Returns the current position in <em>dir</em>. See also
+ * <code>Dir#seek</code>.
+ *
+ * d = Dir.new("testdir")
+ * d.tell #=> 0
+ * d.read #=> "."
+ * d.tell #=> 12
+ */
static VALUE
dir_tell(dir)
VALUE dir;
{
- DIR *dirp;
- int pos;
+#ifdef HAVE_TELLDIR
+ struct dir_data *dirp;
+ long pos;
-#if !defined(__CYGWIN32__) && !defined(__BEOS__)
GetDIR(dir, dirp);
- pos = telldir(dirp);
- return int2inum(pos);
+ pos = telldir(dirp->dir);
+ return rb_int2inum(pos);
#else
rb_notimplement();
#endif
}
+/*
+ * call-seq:
+ * dir.seek( integer ) => dir
+ *
+ * Seeks to a particular location in <em>dir</em>. <i>integer</i>
+ * must be a value returned by <code>Dir#tell</code>.
+ *
+ * d = Dir.new("testdir") #=> #<Dir:0x401b3c40>
+ * d.read #=> "."
+ * i = d.tell #=> 12
+ * d.read #=> ".."
+ * d.seek(i) #=> #<Dir:0x401b3c40>
+ * d.read #=> ".."
+ */
static VALUE
dir_seek(dir, pos)
VALUE dir, pos;
{
- DIR *dirp;
+ struct dir_data *dirp;
-#if !defined(__CYGWIN32__) && !defined(__BEOS__)
+#ifdef HAVE_SEEKDIR
GetDIR(dir, dirp);
- seekdir(dirp, NUM2INT(pos));
+ seekdir(dirp->dir, NUM2INT(pos));
return dir;
#else
rb_notimplement();
#endif
}
+/*
+ * call-seq:
+ * dir.pos( integer ) => integer
+ *
+ * Synonym for <code>Dir#seek</code>, but returns the position
+ * parameter.
+ *
+ * d = Dir.new("testdir") #=> #<Dir:0x401b3c40>
+ * d.read #=> "."
+ * i = d.pos #=> 12
+ * d.read #=> ".."
+ * d.pos = i #=> 12
+ * d.read #=> ".."
+ */
+static VALUE
+dir_set_pos(dir, pos)
+ VALUE dir, pos;
+{
+ dir_seek(dir, pos);
+ return pos;
+}
+
+/*
+ * call-seq:
+ * dir.rewind => dir
+ *
+ * Repositions <em>dir</em> to the first entry.
+ *
+ * d = Dir.new("testdir")
+ * d.read #=> "."
+ * d.rewind #=> #<Dir:0x401b3fb0>
+ * d.read #=> "."
+ */
static VALUE
dir_rewind(dir)
VALUE dir;
{
- DIR *dirp;
+ struct dir_data *dirp;
GetDIR(dir, dirp);
- rewinddir(dirp);
+ rewinddir(dirp->dir);
return dir;
}
+/*
+ * call-seq:
+ * dir.close => nil
+ *
+ * Closes the directory stream. Any further attempts to access
+ * <em>dir</em> will raise an <code>IOError</code>.
+ *
+ * d = Dir.new("testdir")
+ * d.close #=> nil
+ */
static VALUE
dir_close(dir)
VALUE dir;
{
- DIR *dirp;
+ struct dir_data *dirp;
- Data_Get_Struct(dir, DIR, dirp);
- if (dirp == NULL) dir_closed();
- closedir(dirp);
- DATA_PTR(dir) = NULL;
+ GetDIR(dir, dirp);
+ closedir(dirp->dir);
+ dirp->dir = NULL;
return Qnil;
}
+static void
+dir_chdir(path)
+ VALUE path;
+{
+ if (chdir(RSTRING(path)->ptr) < 0)
+ rb_sys_fail(RSTRING(path)->ptr);
+}
+
+static int chdir_blocking = 0;
+static VALUE chdir_thread = Qnil;
+
+struct chdir_data {
+ VALUE old_path, new_path;
+ int done;
+};
+
+static VALUE
+chdir_yield(args)
+ struct chdir_data *args;
+{
+ dir_chdir(args->new_path);
+ args->done = Qtrue;
+ chdir_blocking++;
+ if (chdir_thread == Qnil)
+ chdir_thread = rb_thread_current();
+ return rb_yield(args->new_path);
+}
+
+static VALUE
+chdir_restore(args)
+ struct chdir_data *args;
+{
+ if (args->done) {
+ chdir_blocking--;
+ if (chdir_blocking == 0)
+ chdir_thread = Qnil;
+ dir_chdir(args->old_path);
+ }
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * Dir.chdir( [ string] ) => 0
+ * Dir.chdir( [ string] ) {| path | block } => anObject
+ *
+ * Changes the current working directory of the process to the given
+ * string. When called without an argument, changes the directory to
+ * the value of the environment variable <code>HOME</code>, or
+ * <code>LOGDIR</code>. <code>SystemCallError</code> (probably
+ * <code>Errno::ENOENT</code>) if the target directory does not exist.
+ *
+ * If a block is given, it is passed the name of the new current
+ * directory, and the block is executed with that as the current
+ * directory. The original working directory is restored when the block
+ * exits. The return value of <code>chdir</code> is the value of the
+ * block. <code>chdir</code> blocks can be nested, but in a
+ * multi-threaded program an error will be raised if a thread attempts
+ * to open a <code>chdir</code> block while another thread has one
+ * open.
+ *
+ * Dir.chdir("/var/spool/mail")
+ * puts Dir.pwd
+ * Dir.chdir("/tmp") do
+ * puts Dir.pwd
+ * Dir.chdir("/usr") do
+ * puts Dir.pwd
+ * end
+ * puts Dir.pwd
+ * end
+ * puts Dir.pwd
+ *
+ * <em>produces:</em>
+ *
+ * /var/spool/mail
+ * /tmp
+ * /usr
+ * /tmp
+ * /var/spool/mail
+ */
static VALUE
dir_s_chdir(argc, argv, obj)
int argc;
VALUE *argv;
VALUE obj;
{
- VALUE path;
- char *dist = "";
+ VALUE path = Qnil;
rb_secure(2);
if (rb_scan_args(argc, argv, "01", &path) == 1) {
- Check_SafeStr(path);
- dist = RSTRING(path)->ptr;
+ SafeStringValue(path);
}
else {
- dist = getenv("HOME");
+ const char *dist = getenv("HOME");
if (!dist) {
dist = getenv("LOGDIR");
+ if (!dist) rb_raise(rb_eArgError, "HOME/LOGDIR not set");
}
+ path = rb_str_new2(dist);
}
- if (chdir(dist) < 0)
- rb_sys_fail(dist);
+ if (chdir_blocking > 0) {
+ if (!rb_block_given_p() || rb_thread_current() != chdir_thread)
+ rb_warn("conflicting chdir during another chdir block");
+ }
+
+ if (rb_block_given_p()) {
+ struct chdir_data args;
+ char *cwd = my_getcwd();
+
+ args.old_path = rb_tainted_str_new2(cwd); free(cwd);
+ args.new_path = path;
+ args.done = Qfalse;
+ return rb_ensure(chdir_yield, (VALUE)&args, chdir_restore, (VALUE)&args);
+ }
+ dir_chdir(path);
return INT2FIX(0);
}
+/*
+ * call-seq:
+ * Dir.getwd => string
+ * Dir.pwd => string
+ *
+ * Returns the path to the current working directory of this process as
+ * a string.
+ *
+ * Dir.chdir("/tmp") #=> 0
+ * Dir.getwd #=> "/tmp"
+ */
static VALUE
dir_s_getwd(dir)
VALUE dir;
{
- char path[MAXPATHLEN];
+ char *path;
+ VALUE cwd;
-#ifdef HAVE_GETCWD
- if (getcwd(path, sizeof(path)) == 0) rb_sys_fail(path);
-#else
- extern char *getwd();
- if (getwd(path) == 0) rb_sys_fail(path);
-#endif
+ rb_secure(4);
+ path = my_getcwd();
+ cwd = rb_tainted_str_new2(path);
+
+ free(path);
+ return cwd;
+}
+
+static void check_dirname _((volatile VALUE *));
+static void
+check_dirname(dir)
+ volatile VALUE *dir;
+{
+ char *path, *pend;
- return str_taint(str_new2(path));
+ SafeStringValue(*dir);
+ rb_secure(2);
+ path = RSTRING(*dir)->ptr;
+ if (path && *(pend = rb_path_end(rb_path_skip_prefix(path)))) {
+ *dir = rb_str_new(path, pend - path);
+ }
}
+/*
+ * call-seq:
+ * Dir.chroot( string ) => 0
+ *
+ * Changes this process's idea of the file system root. Only a
+ * privileged process may make this call. Not available on all
+ * platforms. On Unix systems, see <code>chroot(2)</code> for more
+ * information.
+ */
static VALUE
dir_s_chroot(dir, path)
VALUE dir, path;
{
-#if !defined(DJGPP) && !defined(NT) && !defined(__human68k__) && !defined(USE_CWGUSI) && !defined(__BEOS__)
- rb_secure(2);
- Check_SafeStr(path);
+#if defined(HAVE_CHROOT) && !defined(__CHECKER__)
+ check_dirname(&path);
if (chroot(RSTRING(path)->ptr) == -1)
rb_sys_fail(RSTRING(path)->ptr);
@@ -257,9 +723,23 @@ dir_s_chroot(dir, path)
return INT2FIX(0);
#else
rb_notimplement();
+ return Qnil; /* not reached */
#endif
}
+/*
+ * call-seq:
+ * Dir.mkdir( string [, integer] ) => 0
+ *
+ * Makes a new directory named by <i>string</i>, with permissions
+ * specified by the optional parameter <i>anInteger</i>. The
+ * permissions may be modified by the value of
+ * <code>File::umask</code>, and are ignored on NT. Raises a
+ * <code>SystemCallError</code> if the directory cannot be created. See
+ * also the discussion of permissions in the class documentation for
+ * <code>File</code>.
+ *
+ */
static VALUE
dir_s_mkdir(argc, argv, obj)
int argc;
@@ -269,7 +749,6 @@ dir_s_mkdir(argc, argv, obj)
VALUE path, vmode;
int mode;
- rb_secure(2);
if (rb_scan_args(argc, argv, "11", &path, &vmode) == 2) {
mode = NUM2INT(vmode);
}
@@ -277,8 +756,8 @@ dir_s_mkdir(argc, argv, obj)
mode = 0777;
}
- Check_SafeStr(path);
-#if !defined(NT) && !defined(USE_CWGUSI)
+ check_dirname(&path);
+#ifndef _WIN32
if (mkdir(RSTRING(path)->ptr, mode) == -1)
rb_sys_fail(RSTRING(path)->ptr);
#else
@@ -289,51 +768,380 @@ dir_s_mkdir(argc, argv, obj)
return INT2FIX(0);
}
+/*
+ * call-seq:
+ * Dir.delete( string ) => 0
+ * Dir.rmdir( string ) => 0
+ * Dir.unlink( string ) => 0
+ *
+ * Deletes the named directory. Raises a subclass of
+ * <code>SystemCallError</code> if the directory isn't empty.
+ */
static VALUE
dir_s_rmdir(obj, dir)
VALUE obj, dir;
{
- rb_secure(2);
- Check_SafeStr(dir);
+ check_dirname(&dir);
if (rmdir(RSTRING(dir)->ptr) < 0)
rb_sys_fail(RSTRING(dir)->ptr);
- return TRUE;
+ return INT2FIX(0);
}
-#define isdelim(c) ((c)==' '||(c)=='\t'||(c)=='\n'||(c)=='\0')
+/* Return nonzero if S has any special globbing chars in it. */
+static int
+has_magic(s, send, flags)
+ const char *s, *send;
+ int flags;
+{
+ register const char *p = s;
+ register char c;
+ int open = 0;
+ int escape = !(flags & FNM_NOESCAPE);
+
+ while ((c = *p++) != '\0') {
+ switch (c) {
+ case '?':
+ case '*':
+ return Qtrue;
+
+ case '[': /* Only accept an open brace if there is a close */
+ open++; /* brace to match it. Bracket expressions must be */
+ continue; /* complete, according to Posix.2 */
+ case ']':
+ if (open)
+ return Qtrue;
+ continue;
+
+ case '\\':
+ if (escape && *p++ == '\0')
+ return Qfalse;
+ }
-char **glob_filename();
-extern char *glob_error_return;
+ if (send && p >= send) break;
+ }
+ return Qfalse;
+}
+
+static char*
+extract_path(p, pend)
+ const char *p, *pend;
+{
+ char *alloc;
+ int len;
+
+ len = pend - p;
+ alloc = ALLOC_N(char, len+1);
+ memcpy(alloc, p, len);
+ if (len > 1 && pend[-1] == '/'
+#if defined DOSISH_DRIVE_LETTER
+ && pend[-2] != ':'
+#endif
+ ) {
+ alloc[len-1] = 0;
+ }
+ else {
+ alloc[len] = 0;
+ }
+
+ return alloc;
+}
+
+static char*
+extract_elem(path)
+ const char *path;
+{
+ const char *pend;
+
+ pend = strchr(path, '/');
+ if (!pend) pend = path + strlen(path);
+
+ return extract_path(path, pend);
+}
static void
-push_globs(ary, s)
- VALUE ary;
- char *s;
+remove_backslashes(p)
+ char *p;
{
- char **fnames, **ff;
+ char *pend = p + strlen(p);
+ char *t = p;
- fnames = glob_filename(s);
- if (fnames == (char**)-1) rb_sys_fail(s);
- ff = fnames;
- while (*ff) {
- ary_push(ary, str_taint(str_new2(*ff)));
- free(*ff);
- ff++;
+ while (p < pend) {
+ if (*p == '\\') {
+ if (++p == pend) break;
+ }
+ *t++ = *p++;
}
- if (fnames != &glob_error_return) {
- free(fnames);
+ *t = '\0';
+}
+
+#ifndef S_ISDIR
+# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
+#endif
+
+struct glob_args {
+ void (*func) _((const char*, VALUE));
+ const char *c;
+ VALUE v;
+};
+
+static VALUE glob_func_caller _((VALUE));
+
+static VALUE
+glob_func_caller(val)
+ VALUE val;
+{
+ struct glob_args *args = (struct glob_args *)val;
+ (*args->func)(args->c, args->v);
+ return Qnil;
+}
+
+static int
+glob_call_func(func, path, arg)
+ void (*func) _((const char*, VALUE));
+ const char *path;
+ VALUE arg;
+{
+ int status;
+ struct glob_args args;
+
+ args.func = func;
+ args.c = path;
+ args.v = arg;
+
+ rb_protect(glob_func_caller, (VALUE)&args, &status);
+ return status;
+}
+
+static int
+glob_helper(path, sub, flags, func, arg)
+ char *path;
+ char *sub;
+ int flags;
+ void (*func) _((const char*, VALUE));
+ VALUE arg;
+{
+ struct stat st;
+ char *p, *m;
+ int status = 0;
+
+ p = sub ? sub : path;
+ if (!has_magic(p, 0, flags)) {
+#if defined DOSISH
+ remove_backslashes(path);
+#else
+ if (!(flags & FNM_NOESCAPE)) remove_backslashes(p);
+#endif
+ if (lstat(path, &st) == 0) {
+ status = glob_call_func(func, path, arg);
+ if (status) return status;
+ }
+ else if (errno != ENOENT) {
+ /* In case stat error is other than ENOENT and
+ we may want to know what is wrong. */
+ rb_sys_warning(path);
+ }
+ return 0;
+ }
+
+ while (p && !status) {
+ if (*p == '/') p++;
+ m = strchr(p, '/');
+ if (has_magic(p, m, flags)) {
+ char *dir, *base, *magic, *buf;
+ DIR *dirp;
+ struct dirent *dp;
+ int recursive = 0;
+
+ struct d_link {
+ char *path;
+ struct d_link *next;
+ } *tmp, *link, **tail = &link;
+
+ base = extract_path(path, p);
+ if (path == p) dir = ".";
+ else dir = base;
+
+ magic = extract_elem(p);
+ if (stat(dir, &st) < 0) {
+ if (errno != ENOENT) rb_sys_warning(dir);
+ free(base);
+ free(magic);
+ break;
+ }
+ if (S_ISDIR(st.st_mode)) {
+ if (m && strcmp(magic, "**") == 0) {
+ int n = strlen(base);
+ recursive = 1;
+ buf = ALLOC_N(char, n+strlen(m)+3);
+ sprintf(buf, "%s%s", base, *base ? m : m+1);
+ status = glob_helper(buf, buf+n, flags, func, arg);
+ free(buf);
+ if (status) goto finalize;
+ }
+ dirp = opendir(dir);
+ if (dirp == NULL) {
+ rb_sys_warning(dir);
+ free(base);
+ free(magic);
+ break;
+ }
+ }
+ else {
+ free(base);
+ free(magic);
+ break;
+ }
+
+#if defined DOSISH_DRIVE_LETTER
+#define BASE (*base && !((isdirsep(*base) && !base[1]) || (base[1] == ':' && isdirsep(base[2]) && !base[3])))
+#else
+#define BASE (*base && !(isdirsep(*base) && !base[1]))
+#endif
+
+ for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
+ if (recursive) {
+ if (strcmp(".", dp->d_name) == 0 || strcmp("..", dp->d_name) == 0)
+ continue;
+ if (fnmatch("*", dp->d_name, flags) != 0)
+ continue;
+ buf = ALLOC_N(char, strlen(base)+NAMLEN(dp)+strlen(m)+6);
+ sprintf(buf, "%s%s%s", base, (BASE) ? "/" : "", dp->d_name);
+ if (lstat(buf, &st) < 0) {
+ if (errno != ENOENT) rb_sys_warning(buf);
+ free(buf);
+ continue;
+ }
+ if (S_ISDIR(st.st_mode)) {
+ char *t = buf+strlen(buf);
+ strcpy(t, "/**");
+ strcpy(t+3, m);
+ status = glob_helper(buf, t, flags, func, arg);
+ free(buf);
+ if (status) break;
+ continue;
+ }
+ free(buf);
+ continue;
+ }
+ if (fnmatch(magic, dp->d_name, flags) == 0) {
+ buf = ALLOC_N(char, strlen(base)+NAMLEN(dp)+2);
+ sprintf(buf, "%s%s%s", base, (BASE) ? "/" : "", dp->d_name);
+ if (!m) {
+ status = glob_call_func(func, buf, arg);
+ free(buf);
+ if (status) break;
+ continue;
+ }
+ tmp = ALLOC(struct d_link);
+ tmp->path = buf;
+ *tail = tmp;
+ tail = &tmp->next;
+ }
+ }
+ closedir(dirp);
+ finalize:
+ *tail = 0;
+ free(base);
+ free(magic);
+ if (link) {
+ while (link) {
+ if (status == 0) {
+ if (stat(link->path, &st) == 0) {
+ if (S_ISDIR(st.st_mode)) {
+ int len = strlen(link->path);
+ int mlen = strlen(m);
+ char *t = ALLOC_N(char, len+mlen+1);
+
+ sprintf(t, "%s%s", link->path, m);
+ status = glob_helper(t, t+len, flags, func, arg);
+ free(t);
+ }
+ }
+ else {
+ rb_sys_warning(link->path);
+ }
+ }
+ tmp = link;
+ link = link->next;
+ free(tmp->path);
+ free(tmp);
+ }
+ break;
+ }
+ }
+ p = m;
}
+ return status;
+}
+
+static int
+rb_glob2(path, flags, func, arg)
+ const char *path;
+ int flags;
+ void (*func) _((const char*, VALUE));
+ VALUE arg;
+{
+ char *buf;
+ int status;
+
+ buf = ALLOC_N(char, strlen(path)+1);
+ strcpy(buf, path);
+ status = glob_helper(buf, 0, flags, func, arg);
+ free(buf);
+ return status;
+}
+
+void
+rb_glob(path, func, arg)
+ const char *path;
+ void (*func) _((const char*, VALUE));
+ VALUE arg;
+{
+ int status = rb_glob2(path, 0, func, arg);
+
+ if (status) rb_jump_tag(status);
+}
+
+void
+rb_globi(path, func, arg)
+ const char *path;
+ void (*func) _((const char*, VALUE));
+ VALUE arg;
+{
+ int status = rb_glob2(path, FNM_CASEFOLD, func, arg);
+
+ if (status) rb_jump_tag(status);
}
static void
-push_braces(ary, s)
+push_pattern(path, ary)
+ const char *path;
+ VALUE ary;
+{
+ rb_ary_push(ary, rb_tainted_str_new2(path));
+}
+
+static int
+push_globs(ary, s, flags)
VALUE ary;
- char *s;
+ const char *s;
+ int flags;
{
- char buf[MAXPATHLEN];
- char *p, *t, *b;
- char *lbrace, *rbrace;
+ return rb_glob2(s, flags, push_pattern, ary);
+}
+
+static int
+push_braces(ary, s, flags)
+ VALUE ary;
+ const char *s;
+ int flags;
+{
+ char *buf, *b;
+ const char *p, *t;
+ const char *lbrace, *rbrace;
+ int nest = 0;
+ int status = 0;
p = s;
lbrace = rbrace = 0;
@@ -345,14 +1153,17 @@ push_braces(ary, s)
p++;
}
while (*p) {
- if (*p == '}' && lbrace) {
+ if (*p == '{') nest++;
+ if (*p == '}' && --nest == 0) {
rbrace = p;
break;
}
p++;
}
- if (lbrace) {
+ if (lbrace && rbrace) {
+ int len = strlen(s);
+ buf = xmalloc(len + 1);
memcpy(buf, s, lbrace-s);
b = buf + (lbrace-s);
p = lbrace;
@@ -364,106 +1175,291 @@ push_braces(ary, s)
}
memcpy(b, t, p-t);
strcpy(b+(p-t), rbrace+1);
- push_braces(ary, buf);
+ status = push_braces(ary, buf, flags);
+ if (status) break;
}
+ free(buf);
}
else {
- push_globs(ary, s);
+ status = push_globs(ary, s, flags);
}
+
+ return status;
}
+#define isdelim(c) ((c)=='\0')
+
static VALUE
-dir_s_glob(dir, str)
- VALUE dir, str;
+rb_push_glob(str, flags)
+ VALUE str;
+ int flags;
{
- char *p, *pend;
- char buf[MAXPATHLEN];
- char *t, *t0;
- int nest;
+ const char *p, *pend;
+ char *buf;
+ char *t;
+ int nest, maxnest;
+ int status = 0;
+ int noescape = flags & FNM_NOESCAPE;
VALUE ary;
- Check_SafeStr(str);
- if (RSTRING(str)->len > MAXPATHLEN) {
- ArgError("pathname too long (%d bytes)", RSTRING(str)->len);
- }
- ary = ary_new();
+ ary = rb_ary_new();
+ SafeStringValue(str);
+ buf = xmalloc(RSTRING(str)->len + 1);
p = RSTRING(str)->ptr;
pend = p + RSTRING(str)->len;
while (p < pend) {
t = buf;
+ nest = maxnest = 0;
while (p < pend && isdelim(*p)) p++;
while (p < pend && !isdelim(*p)) {
+ if (*p == '{') nest++, maxnest++;
+ if (*p == '}') nest--;
+ if (!noescape && *p == '\\') {
+ *t++ = *p++;
+ if (p == pend) break;
+ }
*t++ = *p++;
}
*t = '\0';
- t0 = buf;
- nest = 0;
- while (t0 < t) {
- if (*t0 == '{') nest+=2;
- if (*t0 == '}') nest+=3;
- t0++;
- }
- if (nest == 0) {
- push_globs(ary, buf);
+ if (maxnest == 0) {
+ status = push_globs(ary, buf, flags);
+ if (status) break;
}
- else if (nest % 5 == 0) {
- push_braces(ary, buf);
+ else if (nest == 0) {
+ status = push_braces(ary, buf, flags);
+ if (status) break;
}
/* else unmatched braces */
}
+ free(buf);
+
+ if (status) rb_jump_tag(status);
+
+ if (rb_block_given_p()) {
+ rb_ary_each(ary);
+ return Qnil;
+ }
return ary;
}
+/*
+ * call-seq:
+ * Dir[ string ] => array
+ *
+ * Equivalent to calling
+ * <em>dir</em>.<code>glob(</code><i>string,</i><code>0)</code>.
+ *
+ */
+static VALUE
+dir_s_aref(obj, str)
+ VALUE obj, str;
+{
+ return rb_push_glob(str, 0);
+}
+
+/*
+ * call-seq:
+ * Dir.glob( string, [flags] ) => array
+ * Dir.glob( string, [flags] ) {| filename | block } => false
+ *
+ * Returns the filenames found by expanding the pattern given in
+ * <i>string</i>, either as an <i>array</i> or as parameters to the
+ * block. Note that this pattern is not a regexp (it's closer to a
+ * shell glob). See <code>File::fnmatch</code> for
+ * details of file name matching and the meaning of the <i>flags</i>
+ * parameter.
+ *
+ * Dir["config.?"] #=> ["config.h"]
+ * Dir.glob("config.?") #=> ["config.h"]
+ * Dir.glob("*.[a-z][a-z]") #=> ["main.rb"]
+ * Dir.glob("*.[^r]*") #=> ["config.h"]
+ * Dir.glob("*.{rb,h}") #=> ["main.rb", "config.h"]
+ * Dir.glob("*") #=> ["config.h", "main.rb"]
+ * Dir.glob("*", File::FNM_DOTMATCH) #=> [".", "..", "config.h", "main.rb"]
+ *
+ */
+static VALUE
+dir_s_glob(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE str, rflags;
+ int flags;
+
+ if (rb_scan_args(argc, argv, "11", &str, &rflags) == 2)
+ flags = NUM2INT(rflags);
+ else
+ flags = 0;
+
+ return rb_push_glob(str, flags);
+}
+
+/*
+ * call-seq:
+ * Dir.foreach( dirname ) {| filename | block } => nil
+ *
+ * Calls the block once for each entry in the named directory, passing
+ * the filename of each entry as a parameter to the block.
+ *
+ * Dir.foreach("testdir") {|x| puts "Got #{x}" }
+ *
+ * <em>produces:</em>
+ *
+ * Got .
+ * Got ..
+ * Got config.h
+ * Got main.rb
+ *
+ */
static VALUE
dir_foreach(io, dirname)
VALUE io, dirname;
{
VALUE dir;
- dir = rb_funcall(cDir, rb_intern("open"), 1, dirname);
- return rb_ensure(dir_each, dir, dir_close, dir);
+ dir = rb_funcall(rb_cDir, rb_intern("open"), 1, dirname);
+ rb_ensure(dir_each, dir, dir_close, dir);
+ return Qnil;
}
+/*
+ * call-seq:
+ * Dir.entries( dirname ) => array
+ *
+ * Returns an array containing all of the filenames in the given
+ * directory. Will raise a <code>SystemCallError</code> if the named
+ * directory doesn't exist.
+ *
+ * Dir.entries("testdir") #=> [".", "..", "config.h", "main.rb"]
+ *
+ */
static VALUE
dir_entries(io, dirname)
VALUE io, dirname;
{
VALUE dir;
- dir = rb_funcall(cDir, rb_intern("open"), 1, dirname);
+ dir = rb_funcall(rb_cDir, rb_intern("open"), 1, dirname);
return rb_ensure(rb_Array, dir, dir_close, dir);
}
+/*
+ * call-seq:
+ * File.fnmatch( pattern, path, [flags] ) => (true or false)
+ * File.fnmatch?( pattern, path, [flags] ) => (true or false)
+ *
+ * Returns true if <i>path</i> matches against <i>pattern</i> The
+ * pattern is not a regular expression; instead it follows rules
+ * similar to shell filename globbing. It may contain the following
+ * metacharacters:
+ *
+ * <i>flags</i> is a bitwise OR of the <code>FNM_xxx</code> parameters.
+ * The same glob pattern and flags are used by <code>Dir::glob</code>.
+ *
+ * File.fnmatch('cat', 'cat') #=> true
+ * File.fnmatch('cat', 'category') #=> false
+ * File.fnmatch('c{at,ub}s', 'cats') #=> false
+ * File.fnmatch('c{at,ub}s', 'cubs') #=> false
+ * File.fnmatch('c{at,ub}s', 'cat') #=> false
+ *
+ * File.fnmatch('c?t', 'cat') #=> true
+ * File.fnmatch('c\?t', 'cat') #=> false
+ * File.fnmatch('c??t', 'cat') #=> false
+ * File.fnmatch('c*', 'cats') #=> true
+ * File.fnmatch('c/ * FIXME * /t', 'c/a/b/c/t') #=> true
+ * File.fnmatch('c*t', 'cat') #=> true
+ * File.fnmatch('c\at', 'cat') #=> true
+ * File.fnmatch('c\at', 'cat', File::FNM_NOESCAPE) #=> false
+ * File.fnmatch('a?b', 'a/b') #=> true
+ * File.fnmatch('a?b', 'a/b', File::FNM_PATHNAME) #=> false
+ *
+ * File.fnmatch('*', '.profile') #=> false
+ * File.fnmatch('*', '.profile', File::FNM_DOTMATCH) #=> true
+ * File.fnmatch('*', 'dave/.profile') #=> true
+ * File.fnmatch('*', 'dave/.profile', File::FNM_DOTMATCH) #=> true
+ * File.fnmatch('*', 'dave/.profile', File::FNM_PATHNAME) #=> false
+ * File.fnmatch('* / FIXME *', 'dave/.profile', File::FNM_PATHNAME) #=> false
+ * STRICT = File::FNM_PATHNAME | File::FNM_DOTMATCH
+ * File.fnmatch('* / FIXME *', 'dave/.profile', STRICT) #=> true
+ */
+static VALUE
+file_s_fnmatch(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE pattern, path;
+ VALUE rflags;
+ int flags;
+
+ if (rb_scan_args(argc, argv, "21", &pattern, &path, &rflags) == 3)
+ flags = NUM2INT(rflags);
+ else
+ flags = 0;
+
+ StringValue(pattern);
+ StringValue(path);
+
+ if (fnmatch(RSTRING(pattern)->ptr, RSTRING(path)->ptr, flags) == 0)
+ return Qtrue;
+
+ return Qfalse;
+}
+
+/*
+ * Objects of class <code>Dir</code> are directory streams representing
+ * directories in the underlying file system. They provide a variety of
+ * ways to list directories and their contents. See also
+ * <code>File</code>.
+ *
+ * The directory used in these examples contains the two regular files
+ * (<code>config.h</code> and <code>main.rb</code>), the parent
+ * directory (<code>..</code>), and the directory itself
+ * (<code>.</code>).
+ */
void
Init_Dir()
{
- cDir = rb_define_class("Dir", cObject);
-
- rb_include_module(cDir, mEnumerable);
-
- rb_define_singleton_method(cDir, "new", dir_s_open, 1);
- rb_define_singleton_method(cDir, "open", dir_s_open, 1);
- rb_define_singleton_method(cDir, "foreach", dir_foreach, 1);
- rb_define_singleton_method(cDir, "entries", dir_entries, 1);
-
- rb_define_method(cDir,"read", dir_read, 0);
- rb_define_method(cDir,"each", dir_each, 0);
- rb_define_method(cDir,"rewind", dir_rewind, 0);
- rb_define_method(cDir,"tell", dir_tell, 0);
- rb_define_method(cDir,"seek", dir_seek, 1);
- rb_define_method(cDir,"close", dir_close, 0);
-
- rb_define_singleton_method(cDir,"chdir", dir_s_chdir, -1);
- rb_define_singleton_method(cDir,"getwd", dir_s_getwd, 0);
- rb_define_singleton_method(cDir,"pwd", dir_s_getwd, 0);
- rb_define_singleton_method(cDir,"chroot", dir_s_chroot, 1);
- rb_define_singleton_method(cDir,"mkdir", dir_s_mkdir, -1);
- rb_define_singleton_method(cDir,"rmdir", dir_s_rmdir, 1);
- rb_define_singleton_method(cDir,"delete", dir_s_rmdir, 1);
- rb_define_singleton_method(cDir,"unlink", dir_s_rmdir, 1);
-
- rb_define_singleton_method(cDir,"glob", dir_s_glob, 1);
- rb_define_singleton_method(cDir,"[]", dir_s_glob, 1);
+ rb_cDir = rb_define_class("Dir", rb_cObject);
+
+ rb_include_module(rb_cDir, rb_mEnumerable);
+
+ rb_define_alloc_func(rb_cDir, dir_s_alloc);
+ rb_define_singleton_method(rb_cDir, "open", dir_s_open, 1);
+ rb_define_singleton_method(rb_cDir, "foreach", dir_foreach, 1);
+ rb_define_singleton_method(rb_cDir, "entries", dir_entries, 1);
+
+ rb_define_method(rb_cDir,"initialize", dir_initialize, 1);
+ rb_define_method(rb_cDir,"path", dir_path, 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);
+ rb_define_method(rb_cDir,"tell", dir_tell, 0);
+ rb_define_method(rb_cDir,"seek", dir_seek, 1);
+ rb_define_method(rb_cDir,"pos", dir_tell, 0);
+ rb_define_method(rb_cDir,"pos=", dir_set_pos, 1);
+ rb_define_method(rb_cDir,"close", dir_close, 0);
+
+ rb_define_singleton_method(rb_cDir,"chdir", dir_s_chdir, -1);
+ rb_define_singleton_method(rb_cDir,"getwd", dir_s_getwd, 0);
+ rb_define_singleton_method(rb_cDir,"pwd", dir_s_getwd, 0);
+ rb_define_singleton_method(rb_cDir,"chroot", dir_s_chroot, 1);
+ rb_define_singleton_method(rb_cDir,"mkdir", dir_s_mkdir, -1);
+ rb_define_singleton_method(rb_cDir,"rmdir", dir_s_rmdir, 1);
+ rb_define_singleton_method(rb_cDir,"delete", dir_s_rmdir, 1);
+ rb_define_singleton_method(rb_cDir,"unlink", dir_s_rmdir, 1);
+
+ rb_define_singleton_method(rb_cDir,"glob", dir_s_glob, -1);
+ rb_define_singleton_method(rb_cDir,"[]", dir_s_aref, 1);
+
+ rb_define_singleton_method(rb_cFile,"fnmatch", file_s_fnmatch, -1);
+ rb_define_singleton_method(rb_cFile,"fnmatch?", file_s_fnmatch, -1);
+
+ rb_file_const("FNM_NOESCAPE", INT2FIX(FNM_NOESCAPE));
+ rb_file_const("FNM_PATHNAME", INT2FIX(FNM_PATHNAME));
+ rb_file_const("FNM_DOTMATCH", INT2FIX(FNM_DOTMATCH));
+ rb_file_const("FNM_CASEFOLD", INT2FIX(FNM_CASEFOLD));
}
diff --git a/djgpp/GNUmakefile.in b/djgpp/GNUmakefile.in
new file mode 100644
index 0000000000..0a7e1fb131
--- /dev/null
+++ b/djgpp/GNUmakefile.in
@@ -0,0 +1,2 @@
+include Makefile
+VPATH = $(srcdir) $(srcdir)/missing
diff --git a/djgpp/README.djgpp b/djgpp/README.djgpp
new file mode 100644
index 0000000000..f1f413a478
--- /dev/null
+++ b/djgpp/README.djgpp
@@ -0,0 +1,21 @@
+* How to compile and install on djgpp
+
+This is what you need to do to compile and install Ruby:
+
+ 1. Run configure.bat, which will generate config.h and Makefile
+ (GNU sed required).
+ Message like this is normal:
+ sed.exe: can't read 123456789: No such file or directory (ENOENT)
+
+ 2. Edit defines.h if you need. Probably this step will not need.
+
+ 3. Remove comment mark(#) before the module names from ext/Setup.dj (or
+ add module names if not present).
+
+ 4. Run make.
+
+ 5. Optionally, run 'make test' to check whether the compiled Ruby
+ interpreter works well. If you see the message "test succeeded",
+ your ruby works as it should (hopefully).
+
+ 6. Run 'make install'
diff --git a/djgpp/config.hin b/djgpp/config.hin
new file mode 100644
index 0000000000..8ee427c92f
--- /dev/null
+++ b/djgpp/config.hin
@@ -0,0 +1,114 @@
+
+#define PACKAGE_NAME ""
+#define PACKAGE_TARNAME ""
+#define PACKAGE_VERSION ""
+#define PACKAGE_STRING ""
+#define PACKAGE_BUGREPORT ""
+#define USE_BUILTIN_FRAME_ADDRESS 1
+#define STDC_HEADERS 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRING_H 1
+#define HAVE_MEMORY_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_UNISTD_H 1
+#define HAVE_LONG_LONG 1
+#define HAVE_OFF_T 1
+#define SIZEOF_INT 4
+#define SIZEOF_SHORT 2
+#define SIZEOF_LONG 4
+#define SIZEOF_LONG_LONG 8
+#define SIZEOF___INT64 0
+#define SIZEOF_OFF_T 4
+#define SIZEOF_VOIDP 4
+#define SIZEOF_FLOAT 4
+#define SIZEOF_DOUBLE 8
+#define HAVE_PROTOTYPES 1
+#define TOKEN_PASTE(x,y) x##y
+#define HAVE_STDARG_PROTOTYPES 1
+#define NORETURN(x) x __attribute__ ((noreturn))
+#define HAVE_DECL_SYS_NERR 1
+#define HAVE_DIRENT_H 1
+#define STDC_HEADERS 1
+#define HAVE_SYS_WAIT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRING_H 1
+#define HAVE_UNISTD_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_SYS_FILE_H 1
+#define HAVE_SYS_IOCTL_H 1
+#define HAVE_FCNTL_H 1
+#define HAVE_SYS_FCNTL_H 1
+#define HAVE_SYS_TIME_H 1
+#define HAVE_SYS_TIMES_H 1
+#define HAVE_SYS_PARAM_H 1
+#define HAVE_PWD_H 1
+#define HAVE_UTIME_H 1
+#define HAVE_MEMORY_H 1
+#define HAVE_DIRECT_H 1
+#define HAVE_SYS_RESOURCE_H 1
+#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
+#define HAVE_ST_BLKSIZE 1
+#define HAVE_STRUCT_STAT_ST_RDEV 1
+#define HAVE_ST_RDEV 1
+#define GETGROUPS_T gid_t
+#define RETSIGTYPE void
+#define HAVE_ALLOCA 1
+#define HAVE_DUP2 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MKDIR 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRNCASECMP 1
+#define HAVE_STRERROR 1
+#define HAVE_STRFTIME 1
+#define HAVE_STRCHR 1
+#define HAVE_STRSTR 1
+#define HAVE_STRTOUL 1
+#define HAVE_ISINF 1
+#define HAVE_ISNAN 1
+#define HAVE_FINITE 1
+#define HAVE_HYPOT 1
+#define HAVE_ACOSH 1
+#define HAVE_FMOD 1
+#define HAVE_WAITPID 1
+#define HAVE_FSYNC 1
+#define HAVE_TRUNCATE 1
+#define HAVE_CHSIZE 1
+#define HAVE_TIMES 1
+#define HAVE_UTIMES 1
+#define HAVE_FCNTL 1
+#define HAVE_SYMLINK 1
+#define HAVE_SETITIMER 1
+#define HAVE_PAUSE 1
+#define HAVE_GETPGRP 1
+#define HAVE_SETPGID 1
+#define HAVE_GETGROUPS 1
+#define HAVE_GETRLIMIT 1
+#define HAVE_SIGPROCMASK 1
+#define HAVE_SIGACTION 1
+#define HAVE_SETSID 1
+#define HAVE_TELLDIR 1
+#define HAVE_SEEKDIR 1
+#define HAVE_MKTIME 1
+#define HAVE_COSH 1
+#define HAVE_SINH 1
+#define HAVE_TANH 1
+#define HAVE_STRUCT_TM_TM_ZONE 1
+#define HAVE_TM_ZONE 1
+#define HAVE_STRUCT_TM_TM_GMTOFF 1
+#define POSIX_SIGNAL 1
+#define GETPGRP_VOID 1
+#define SETPGRP_VOID 1
+#define RSHIFT(x,y) ((x)>>(int)y)
+#define FILE_COUNT _cnt
+#define FILE_READPTR _ptr
+#define NEED_IO_FLUSH_BETWEEN_RW 1
+#define DEFAULT_KCODE KCODE_NONE
+#define DLEXT ".so"
+#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_PLATFORM "i386-msdosdjgpp"
+#define RUBY_ARCHLIB "/lib/ruby/@MAJOR@.@MINOR@/i386-msdosdjgpp"
+#define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/@MAJOR@.@MINOR@/i386-msdosdjgpp"
diff --git a/djgpp/config.sed b/djgpp/config.sed
new file mode 100644
index 0000000000..1805789520
--- /dev/null
+++ b/djgpp/config.sed
@@ -0,0 +1,128 @@
+/^SHELL/s,/bin/sh,$(COMSPEC),
+;s%/bin/rm%rm%
+;s%|| true%%
+;/\/dev\/null/ {
+;s,/dev/null 2>&1, nul,
+;s,2> /dev/null,,
+;}
+;/^config.status/ {
+; N;N;N;N;N;d
+;}
+:t
+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@srcdir@,.,g;t t
+s,@top_srcdir@,..,;t t
+s,@PATH_SEPARATOR@,:,;t t
+s,@PACKAGE_NAME@,,;t t
+s,@PACKAGE_TARNAME@,,;t t
+s,@PACKAGE_VERSION@,,;t t
+s,@PACKAGE_STRING@,,;t t
+s,@PACKAGE_BUGREPORT@,,;t t
+s,@exec_prefix@,${prefix},;t t
+s,@prefix@,/dev/env/DJDIR,;t t
+s%@program_transform_name@%s,^,,%;t t
+s,@bindir@,${exec_prefix}/bin,;t t
+s,@sbindir@,${exec_prefix}/sbin,;t t
+s,@libexecdir@,${exec_prefix}/libexec,;t t
+s,@datadir@,${prefix}/share,;t t
+s,@sysconfdir@,${prefix}/etc,;t t
+s,@sharedstatedir@,${prefix}/com,;t t
+s,@localstatedir@,${prefix}/var,;t t
+s,@libdir@,${exec_prefix}/lib,;t t
+s,@includedir@,${prefix}/include,;t t
+s,@oldincludedir@,/usr/include,;t t
+s,@infodir@,${prefix}/info,;t t
+s,@mandir@,${prefix}/man,;t t
+s,@build_alias@,i586-pc-msdosdjgpp,;t t
+s,@host_alias@,i586-pc-msdosdjgpp,;t t
+s,@target_alias@,i386-msdosdjgpp,;t t
+s,@DEFS@,,;t t
+s,@ECHO_C@,,;t t
+s,@ECHO_N@,-n,;t t
+s,@ECHO_T@,,;t t
+s,@LIBS@,-lm ,;t t
+s,@MAJOR@,1,;t t
+s,@MINOR@,7,;t t
+s,@TEENY@,3,;t t
+s,@build@,i586-pc-msdosdjgpp,;t t
+s,@build_cpu@,i586,;t t
+s,@build_vendor@,pc,;t t
+s,@build_os@,msdosdjgpp,;t t
+s,@host@,i586-pc-msdosdjgpp,;t t
+s,@host_cpu@,i586,;t t
+s,@host_vendor@,pc,;t t
+s,@host_os@,msdosdjgpp,;t t
+s,@target@,i386-pc-msdosdjgpp,;t t
+s,@target_cpu@,i386,;t t
+s,@target_vendor@,pc,;t t
+s,@target_os@,msdosdjgpp,;t t
+s,@CC@,gcc,;t t
+s,@ac_ct_CC@,,;t t
+s,@CFLAGS@,-Os,;t t
+s,@LDFLAGS@,,;t t
+s,@CPPFLAGS@,,;t t
+s,@EXEEXT@,.exe,;t t
+s,@OBJEXT@,o,;t t
+s,@CPP@,gcc -E,;t t
+s,@EGREP@,grep -E,;t t
+s,@GNU_LD@,yes,;t t
+s,@CPPOUTFILE@,-o conftest.i,;t t
+s,@OUTFLAG@,-o ,;t t
+s,@YACC@,bison -y,;t t
+s,@RANLIB@,ranlib,;t t
+s,@ac_ct_RANLIB@,,;t t
+s,@AR@,ar,;t t
+s,@ac_ct_AR@,,;t t
+s,@NM@,,;t t
+s,@ac_ct_NM@,,;t t
+s,@WINDRES@,,;t t
+s,@ac_ct_WINDRES@,,;t t
+s,@DLLWRAP@,,;t t
+s,@ac_ct_DLLWRAP@,,;t t
+s,@LN_S@,ln -s,;t t
+s,@SET_MAKE@,,;t t
+s,@LIBOBJS@,crypt.o flock.o vsnprintf.o,;t t
+s,@ALLOCA@,,;t t
+s,@XCFLAGS@,,;t t
+s,@XLDFLAGS@, -L.,;t t
+s,@DLDFLAGS@,,;t t
+s,@STATIC@,,;t t
+s,@CCDLFLAGS@,,;t t
+s,@LDSHARED@,ld,;t t
+s,@DLEXT@,so,;t t
+s,@DLEXT2@,,;t t
+s,@LIBEXT@,a,;t t
+s,@LINK_SO@,,;t t
+s,@LIBPATHFLAG@, -L%s,;t t
+s,@STRIP@,strip,;t t
+s,@EXTSTATIC@,,;t t
+s,@setup@,Setup.dj,;t t
+s,@MINIRUBY@,./miniruby,;t t
+s,@PREP@,,;t t
+s,@ARCHFILE@,,;t t
+s,@LIBRUBY_LDSHARED@,ld,;t t
+s,@LIBRUBY_DLDFLAGS@,,;t t
+s,@RUBY_INSTALL_NAME@,ruby,;t t
+s,@rubyw_install_name@,,;t t
+s,@RUBYW_INSTALL_NAME@,,;t t
+s,@RUBY_SO_NAME@,$(RUBY_INSTALL_NAME),;t t
+s,@LIBRUBY_A@,lib$(RUBY_INSTALL_NAME).a,;t t
+s,@LIBRUBY_SO@,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR).$(TEENY),;t t
+s,@LIBRUBY_ALIASES@,lib$(RUBY_SO_NAME).so,;t t
+s,@LIBRUBY@,$(LIBRUBY_A),;t t
+s,@LIBRUBYARG@,-l$(RUBY_INSTALL_NAME),;t t
+s,@SOLIBS@,,;t t
+s,@DLDLIBS@,-lc,;t t
+s,@ENABLE_SHARED@,no,;t t
+s,@MAINLIBS@,,;t t
+s,@COMMON_LIBS@,,;t t
+s,@COMMON_MACROS@,,;t t
+s,@COMMON_HEADERS@,,;t t
+s,@EXPORT_PREFIX@,,;t t
+s,@MAKEFILES@,Makefile,;t t
+s,@arch@,i386-msdosdjgpp,;t t
+s,@sitearch@,i386-msdosdjgpp,;t t
+s,@sitedir@,${prefix}/lib/ruby/site_ruby,;t t
+s,@configure_args@,,;t t
+/^,THIS_IS_DUMMY_PATTERN_/i\
+ac_given_srcdir=.
diff --git a/djgpp/configure.bat b/djgpp/configure.bat
new file mode 100644
index 0000000000..e6a5d79d4a
--- /dev/null
+++ b/djgpp/configure.bat
@@ -0,0 +1,20 @@
+@echo off
+if exist configure.bat cd ..
+if exist djgpp\version.sed goto exist
+ sed -n -f djgpp\mkver.sed < version.h > djgpp\version.sed
+:exist
+set _conv_=-f djgpp\config.sed -f djgpp\version.sed
+sed %_conv_% < Makefile.in > Makefile
+sed %_conv_% < djgpp\config.hin > config.h
+echo LFN check > 12345678
+sed -n /LFN/d 123456789 > nul
+if errorlevel 2 goto LFN
+ copy missing\vsnprintf.c missing\vsnprint.c > nul
+ copy djgpp\config.sed config.sta > nul
+goto end
+:LFN
+ copy djgpp\config.sed config.status > nul
+:end
+set _conv_=
+del 12345678
+echo Now you must run a make.
diff --git a/djgpp/mkver.sed b/djgpp/mkver.sed
new file mode 100644
index 0000000000..f29b9ddd3e
--- /dev/null
+++ b/djgpp/mkver.sed
@@ -0,0 +1 @@
+/RUBY_VERSION /s/^.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/s,@MAJOR@,\1,;s,@MINOR@,\2,;s,@TEENY@,\3,/p
diff --git a/dln.c b/dln.c
index 9fe4208f4c..8f0b2a0409 100644
--- a/dln.c
+++ b/dln.c
@@ -1,4 +1,4 @@
-/************************************************
+/**********************************************************************
dln.c -
@@ -6,21 +6,32 @@
$Date$
created at: Tue Jan 18 17:05:06 JST 1994
- Copyright (C) 1993-1998 Yukihiro Matsumoto
+ Copyright (C) 1993-2003 Yukihiro Matsumoto
-************************************************/
+**********************************************************************/
-#include "config.h"
-#include "defines.h"
+#include "ruby.h"
#include "dln.h"
+#ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+
+#ifdef __CHECKER__
+#undef HAVE_DLOPEN
+#undef USE_DLN_A_OUT
+#undef USE_DLN_DLOPEN
+#endif
+
+#ifdef USE_DLN_A_OUT
char *dln_argv0;
+#endif
#ifdef _AIX
#pragma alloca
#endif
-#if defined(HAVE_ALLOCA_H) && !defined(__GNUC__)
+#if defined(HAVE_ALLOCA_H)
#include <alloca.h>
#endif
@@ -30,24 +41,27 @@ char *dln_argv0;
# include <strings.h>
#endif
+#ifndef xmalloc
void *xmalloc();
void *xcalloc();
void *xrealloc();
+#endif
#include <stdio.h>
-#ifndef NT
-# ifndef USE_CWGUSI
-# include <sys/file.h>
-# endif
-#else
+#if defined(_WIN32) || defined(__VMS)
#include "missing/file.h"
#endif
#include <sys/types.h>
#include <sys/stat.h>
+#ifndef S_ISDIR
+# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
+#endif
+
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
-#else
+#endif
+#ifndef MAXPATHLEN
# define MAXPATHLEN 1024
#endif
@@ -55,15 +69,20 @@ void *xrealloc();
# include <unistd.h>
#endif
-#ifndef NT
-char *strdup();
+#ifndef _WIN32
char *getenv();
#endif
+#if defined(__VMS)
+#pragma builtins
+#include <dlfcn.h>
+#endif
+
#ifdef __MACOS__
# include <TextUtils.h>
# include <CodeFragments.h>
# include <Aliases.h>
+# include "macruby_private.h"
#endif
#ifdef __BEOS__
@@ -72,41 +91,59 @@ char *getenv();
int eaccess();
-#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(__CYGWIN32__) && !defined(_AIX)
+#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(_AIX) && !defined(__APPLE__) && !defined(_UNICOSMP)
/* dynamic load with dlopen() */
# define USE_DLN_DLOPEN
#endif
#ifndef FUNCNAME_PATTERN
-# if defined(__hp9000s300) || defined(__NetBSD__) || defined(__BORLANDC__) || (defined(__FreeBSD__) && __FreeBSD__ < 3) || defined(NeXT) || defined(__WATCOMC__)
-# define FUNCNAME_PATTERN "_Init_%.200s"
+# if defined(__hp9000s300) || (defined(__NetBSD__) && !defined(__ELF__)) || defined(__BORLANDC__) || (defined(__FreeBSD__) && !defined(__ELF__)) || (defined(__OpenBSD__) && !defined(__ELF__)) || defined(NeXT) || defined(__WATCOMC__) || defined(__APPLE__)
+# define FUNCNAME_PATTERN "_Init_%s"
# else
-# define FUNCNAME_PATTERN "Init_%.200s"
+# define FUNCNAME_PATTERN "Init_%s"
# endif
#endif
-static void
-init_funcname(buf, file)
- char *buf, *file;
+static int
+init_funcname_len(buf, file)
+ char **buf;
+ const char *file;
{
- char *p, *slash;
+ char *p;
+ const char *slash;
+ int len;
/* Load the file as an object one */
- for (p = file, slash = p-1; *p; p++) /* Find position of last '/' */
+ for (slash = file-1; *file; file++) /* Find position of last '/' */
#ifdef __MACOS__
- if (*p == ':') slash = p;
+ if (*file == ':') slash = file;
#else
- if (*p == '/') slash = p;
+ if (*file == '/') slash = file;
#endif
- sprintf(buf, FUNCNAME_PATTERN, slash + 1);
- for (p = buf; *p; p++) { /* Delete suffix it it exists */
+ len = strlen(FUNCNAME_PATTERN) + strlen(slash + 1);
+ *buf = xmalloc(len);
+ snprintf(*buf, len, FUNCNAME_PATTERN, slash + 1);
+ for (p = *buf; *p; p++) { /* Delete suffix if it exists */
if (*p == '.') {
*p = '\0'; break;
}
}
+ return p - *buf;
}
+#define init_funcname(buf, file) do {\
+ int len = init_funcname_len(buf, file);\
+ char *tmp = ALLOCA_N(char, len+1);\
+ if (!tmp) {\
+ free(*buf);\
+ rb_memerror();\
+ }\
+ strcpy(tmp, *buf);\
+ free(*buf);\
+ *buf = tmp;\
+} while (0)
+
#ifdef USE_DLN_A_OUT
#ifndef LIBC_NAME
@@ -122,16 +159,15 @@ init_funcname(buf, file)
static int dln_errno;
#define DLN_ENOEXEC ENOEXEC /* Exec format error */
-#define DLN_ECONFL 201 /* Symbol name conflict */
-#define DLN_ENOINIT 202 /* No inititalizer given */
-#define DLN_EUNDEF 203 /* Undefine symbol remains */
-#define DLN_ENOTLIB 204 /* Not a library file */
-#define DLN_EBADLIB 205 /* Malformed library file */
-#define DLN_EINIT 206 /* Not initialized */
+#define DLN_ECONFL 1201 /* Symbol name conflict */
+#define DLN_ENOINIT 1202 /* No inititalizer given */
+#define DLN_EUNDEF 1203 /* Undefine symbol remains */
+#define DLN_ENOTLIB 1204 /* Not a library file */
+#define DLN_EBADLIB 1205 /* Malformed library file */
+#define DLN_EINIT 1206 /* Not initialized */
static int dln_init_p = 0;
-#include "st.h"
#include <ar.h>
#include <a.out.h>
#ifndef N_COMM
@@ -143,6 +179,9 @@ static int dln_init_p = 0;
#define INVALID_OBJECT(h) (N_MAGIC(h) != OMAGIC)
+#include "util.h"
+#include "st.h"
+
static st_table *sym_tbl;
static st_table *undef_tbl;
@@ -315,7 +354,7 @@ sym_hash(hdrp, syms)
static int
dln_init(prog)
- char *prog;
+ const char *prog;
{
char *file;
int fd;
@@ -368,6 +407,10 @@ dln_init(prog)
while (read(fd, p, 1) == 1) {
if (*p == '\n' || *p == '\t' || *p == ' ') break;
p++;
+ if (p-buf >= MAXPATHLEN) {
+ dln_errno = ENAMETOOLONG;
+ return -1;
+ }
}
*p = '\0';
@@ -462,7 +505,7 @@ struct undef {
static st_table *reloc_tbl = NULL;
static void
link_undef(name, base, reloc)
- char *name;
+ const char *name;
long base;
struct relocation_info *reloc;
{
@@ -492,7 +535,7 @@ link_undef(name, base, reloc)
}
struct reloc_arg {
- char *name;
+ const char *name;
long value;
};
@@ -562,7 +605,7 @@ reloc_undef(no, undef, arg)
static void
unlink_undef(name, value)
- char *name;
+ const char *name;
long value;
{
struct reloc_arg arg;
@@ -595,7 +638,7 @@ static int
load_1(fd, disp, need_init)
int fd;
long disp;
- char *need_init;
+ const char *need_init;
{
static char *libc = LIBC_NAME;
struct exec hdr;
@@ -606,7 +649,6 @@ load_1(fd, disp, need_init)
struct nlist *sym;
struct nlist *end;
int init_p = 0;
- char buf[256];
if (load_header(fd, &hdr, disp) == -1) return -1;
if (INVALID_OBJECT(hdr)) {
@@ -615,8 +657,12 @@ load_1(fd, disp, need_init)
}
reloc = load_reloc(fd, &hdr, disp);
if (reloc == NULL) return -1;
+
syms = load_sym(fd, &hdr, disp);
- if (syms == NULL) return -1;
+ if (syms == NULL) {
+ free(reloc);
+ return -1;
+ }
sym = syms;
end = syms + (hdr.a_syms / sizeof(struct nlist));
@@ -629,7 +675,7 @@ load_1(fd, disp, need_init)
char *key = sym->n_un.n_name;
if (st_lookup(sym_tbl, sym[1].n_un.n_name, &old_sym)) {
- if (st_delete(undef_tbl, &key, NULL)) {
+ if (st_delete(undef_tbl, (st_data_t*)&key, NULL)) {
unlink_undef(key, old_sym->n_value);
free(key);
}
@@ -642,7 +688,7 @@ load_1(fd, disp, need_init)
st_foreach(reloc_tbl, reloc_repl, &data);
st_insert(undef_tbl, strdup(sym[1].n_un.n_name), NULL);
- if (st_delete(undef_tbl, &key, NULL)) {
+ if (st_delete(undef_tbl, (st_data_t*)&key, NULL)) {
free(key);
}
}
@@ -710,7 +756,7 @@ load_1(fd, disp, need_init)
}
key = sym->n_un.n_name;
- if (st_delete(undef_tbl, &key, NULL) != 0) {
+ if (st_delete(undef_tbl, (st_data_t*)&key, NULL) != 0) {
unlink_undef(key, sym->n_value);
free(key);
}
@@ -819,18 +865,19 @@ load_1(fd, disp, need_init)
if (need_init) {
int len;
char **libs_to_be_linked = 0;
+ char *buf;
if (undef_tbl->num_entries > 0) {
if (load_lib(libc) == -1) goto err_exit;
}
- init_funcname(buf, need_init);
+ init_funcname(&buf, need_init);
len = strlen(buf);
for (sym = syms; sym<end; sym++) {
char *name = sym->n_un.n_name;
if (name[0] == '_' && sym->n_value >= block) {
- if (strcmp(name+1, "libs_to_be_linked") == 0) {
+ if (strcmp(name+1, "dln_libs_to_be_linked") == 0) {
libs_to_be_linked = (char**)sym->n_value;
}
else if (strcmp(name+1, buf) == 0) {
@@ -873,11 +920,11 @@ load_1(fd, disp, need_init)
static int target_offset;
static int
search_undef(key, value, lib_tbl)
- char *key;
+ const char *key;
int value;
st_table *lib_tbl;
{
- int offset;
+ long offset;
if (st_lookup(lib_tbl, key, &offset) == 0) return ST_CONTINUE;
target_offset = offset;
@@ -885,15 +932,15 @@ search_undef(key, value, lib_tbl)
}
struct symdef {
- int str_index;
+ int rb_str_index;
int lib_offset;
};
-char *dln_library_path = DLN_DEFAULT_LIB_PATH;
+char *dln_librrb_ary_path = DLN_DEFAULT_LIB_PATH;
static int
load_lib(lib)
- char *lib;
+ const char *lib;
{
char *path, *file;
char armagic[SARMAG];
@@ -920,10 +967,10 @@ load_lib(lib)
/* library search path: */
/* look for environment variable DLN_LIBRARY_PATH first. */
- /* then variable dln_library_path. */
+ /* then variable dln_librrb_ary_path. */
/* if path is still NULL, use "." for path. */
path = getenv("DLN_LIBRARY_PATH");
- if (path == NULL) path = dln_library_path;
+ if (path == NULL) path = dln_librrb_ary_path;
file = dln_find_file(lib, path);
fd = open(file, O_RDONLY);
@@ -952,7 +999,7 @@ load_lib(lib)
base = (struct symdef*)(data + 1);
name_base = (char*)(base + nsym) + sizeof(int);
while (nsym > 0) {
- char *name = name_base + base->str_index;
+ char *name = name_base + base->rb_str_index;
st_insert(lib_tbl, name, base->lib_offset + sizeof(ahdr));
nsym--;
@@ -1030,7 +1077,7 @@ load_lib(lib)
static int
load(file)
- char *file;
+ const char *file;
{
int fd;
int result;
@@ -1056,7 +1103,7 @@ load(file)
void*
dln_sym(name)
- char *name;
+ const char *name;
{
struct nlist *sym;
@@ -1076,12 +1123,12 @@ dln_sym(name)
# endif
#endif
-#ifdef hpux
+#ifdef __hpux
#include <errno.h>
#include "dl.h"
#endif
-#ifdef _AIX
+#if defined(_AIX)
#include <ctype.h> /* for isdigit() */
#include <errno.h> /* for global errno */
#include <sys/ldr.h>
@@ -1092,14 +1139,30 @@ dln_sym(name)
#include <mach-o/rld.h>
#else
#include <mach-o/dyld.h>
+#ifndef NSLINKMODULE_OPTION_BINDNOW
+#define NSLINKMODULE_OPTION_BINDNOW 1
+#endif
+#endif
+#else
+#ifdef __APPLE__
+#include <mach-o/dyld.h>
#endif
#endif
-#ifdef _WIN32
+#if defined _WIN32 && !defined __CYGWIN__
#include <windows.h>
#endif
-static char *
+#ifdef _WIN32_WCE
+#undef FormatMessage
+#define FormatMessage FormatMessageA
+#undef LoadLibrary
+#define LoadLibrary LoadLibraryA
+#undef GetProcAddress
+#define GetProcAddress GetProcAddressA
+#endif
+
+static const char *
dln_strerror()
{
#ifdef USE_DLN_A_OUT
@@ -1109,7 +1172,7 @@ dln_strerror()
case DLN_ECONFL:
return "Symbol name conflict";
case DLN_ENOINIT:
- return "No inititalizer given";
+ return "No initializer given";
case DLN_EUNDEF:
return "Unresolved symbols";
case DLN_ENOTLIB:
@@ -1127,31 +1190,38 @@ dln_strerror()
return (char*)dlerror();
#endif
-#ifdef _WIN32
+#if defined _WIN32 && !defined __CYGWIN__
static char message[1024];
+ int error = GetLastError();
+ char *p = message;
+ p += sprintf(message, "%d: ", error);
FormatMessage(
- FORMAT_MESSAGE_FROM_SYSTEM,
+ FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
- GetLastError(),
- MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
- message,
- sizeof message,
+ error,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ p,
+ sizeof message - strlen(message),
NULL);
+ for (p = message; *p; p++) {
+ if (*p == '\n' || *p == '\r')
+ *p = ' ';
+ }
return message;
#endif
}
-#ifdef _AIX
+#if defined(_AIX) && ! defined(_IA64)
static void
-aix_loaderror(char *pathname)
+aix_loaderror(const char *pathname)
{
char *message[8], errbuf[1024];
int i,j;
struct errtab {
- int errno;
+ int errnum;
char *errstr;
} load_errtab[] = {
{L_ERROR_TOOMANY, "too many errors, rest skipped."},
@@ -1163,7 +1233,7 @@ aix_loaderror(char *pathname)
{L_ERROR_MEMBER,
"file not an archive or does not contain requested member:"},
{L_ERROR_TYPE, "symbol table mismatch:"},
- {L_ERROR_ALIGN, "text allignment in file is wrong."},
+ {L_ERROR_ALIGN, "text alignment in file is wrong."},
{L_ERROR_SYSTEM, "System error:"},
{L_ERROR_ERRNO, NULL}
};
@@ -1171,77 +1241,86 @@ aix_loaderror(char *pathname)
#define LOAD_ERRTAB_LEN (sizeof(load_errtab)/sizeof(load_errtab[0]))
#define ERRBUF_APPEND(s) strncat(errbuf, s, sizeof(errbuf)-strlen(errbuf)-1)
- sprintf(errbuf, "load failed - %.200s ", pathname);
+ snprintf(errbuf, 1024, "load failed - %s ", pathname);
if (!loadquery(1, &message[0], sizeof(message)))
ERRBUF_APPEND(strerror(errno));
for(i = 0; message[i] && *message[i]; i++) {
int nerr = atoi(message[i]);
- for (j=0; j<LOAD_ERRTAB_LEN ; j++) {
- if (nerr == load_errtab[i].errno && load_errtab[i].errstr)
+ for (j=0; j<LOAD_ERRTAB_LEN; j++) {
+ if (nerr == load_errtab[i].errnum && load_errtab[i].errstr)
ERRBUF_APPEND(load_errtab[i].errstr);
}
- while (isdigit(*message[i])) message[i]++ ;
+ while (isdigit(*message[i])) message[i]++;
ERRBUF_APPEND(message[i]);
ERRBUF_APPEND("\n");
}
errbuf[strlen(errbuf)-1] = '\0'; /* trim off last newline */
- LoadError(errbuf);
+ rb_loaderror(errbuf);
return;
}
#endif
-void
+#if defined(__VMS)
+#include <starlet.h>
+#include <rms.h>
+#include <stsdef.h>
+#include <unixlib.h>
+#include <descrip.h>
+#include <lib$routines.h>
+
+static char *vms_filespec;
+static int vms_fileact(char *filespec, int type);
+static long vms_fisexh(long *sigarr, long *mecarr);
+#endif
+
+void*
dln_load(file)
- char *file;
+ const char *file;
{
-#ifdef _WIN32
+#if !defined(_AIX) && !defined(NeXT)
+ const char *error = 0;
+#define DLN_ERROR() (error = dln_strerror(), strcpy(ALLOCA_N(char, strlen(error) + 1), error))
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
HINSTANCE handle;
- char winfile[255];
+ char winfile[MAXPATHLEN];
void (*init_fct)();
- char buf[MAXPATHLEN];
+ char *buf;
+
+ if (strlen(file) >= MAXPATHLEN) rb_loaderror("filename too long");
/* Load the file as an object one */
- init_funcname(buf, file);
+ init_funcname(&buf, file);
-#ifdef __CYGWIN32__
- cygwin32_conv_to_win32_path(file, winfile);
-#else
strcpy(winfile, file);
-#endif
/* Load file */
- if ((handle =
- LoadLibraryExA(winfile, NULL, LOAD_WITH_ALTERED_SEARCH_PATH)) == NULL) {
- printf("LoadLibraryExA\n");
+ if ((handle = LoadLibrary(winfile)) == NULL) {
+ error = dln_strerror();
goto failed;
}
-#ifdef __CYGWIN32__
- init_fct = (void(*)())GetProcAddress(handle, "impure_setup");
-
- if (init_fct)
- init_fct(_impure_ptr);
-#endif
-
if ((init_fct = (void(*)())GetProcAddress(handle, buf)) == NULL) {
- printf("GetProcAddress %s\n", buf);
- goto failed;
+ rb_loaderror("%s - %s\n%s", dln_strerror(), buf, file);
}
+
/* Call the init code */
(*init_fct)();
- return;
+ return handle;
#else
#ifdef USE_DLN_A_OUT
if (load(file) == -1) {
+ error = dln_strerror();
goto failed;
}
- return;
+ return 0;
#else
- char buf[MAXPATHLEN];
+ char *buf;
/* Load the file as an object one */
- init_funcname(buf, file);
+ init_funcname(&buf, file);
#ifdef USE_DLN_DLOPEN
#define DLN_DEFINED
@@ -1249,28 +1328,36 @@ dln_load(file)
void *handle;
void (*init_fct)();
-# ifndef RTLD_LAZY
-# define RTLD_LAZY 1
-# endif
-# ifndef RTLD_GLOBAL
-# define RTLD_GLOBAL 0
-# endif
+#ifndef RTLD_LAZY
+# define RTLD_LAZY 1
+#endif
+#ifdef __INTERIX
+# undef RTLD_GLOBAL
+#endif
+#ifndef RTLD_GLOBAL
+# define RTLD_GLOBAL 0
+#endif
/* Load file */
if ((handle = (void*)dlopen(file, RTLD_LAZY|RTLD_GLOBAL)) == NULL) {
+ error = dln_strerror();
goto failed;
}
- if ((init_fct = (void(*)())dlsym(handle, buf)) == NULL) {
+ init_fct = (void(*)())dlsym(handle, buf);
+ if (init_fct == NULL) {
+ error = DLN_ERROR();
+ dlclose(handle);
goto failed;
}
/* Call the init code */
(*init_fct)();
- return;
+
+ return handle;
}
#endif /* USE_DLN_DLOPEN */
-#ifdef hpux
+#ifdef __hpux
#define DLN_DEFINED
{
shl_t lib = NULL;
@@ -1281,36 +1368,39 @@ dln_load(file)
lib = shl_load(file, flags, 0);
if (lib == NULL) {
extern int errno;
- LoadError("%s - %s", strerror(errno), file);
+ rb_loaderror("%s - %s", strerror(errno), file);
}
shl_findsym(&lib, buf, TYPE_PROCEDURE, (void*)&init_fct);
if (init_fct == NULL) {
shl_findsym(&lib, buf, TYPE_UNDEFINED, (void*)&init_fct);
if (init_fct == NULL) {
errno = ENOSYM;
- LoadError("%s - %s", strerror(ENOSYM), file);
+ rb_loaderror("%s - %s", strerror(ENOSYM), file);
}
}
(*init_fct)();
- return;
+ return (void*)lib;
}
#endif /* hpux */
-#ifdef _AIX
+#if defined(_AIX) && ! defined(_IA64)
#define DLN_DEFINED
{
void (*init_fct)();
- init_fct = (void(*)())load(file, 1, 0);
+ init_fct = (void(*)())load((char*)file, 1, 0);
if (init_fct == NULL) {
aix_loaderror(file);
}
+ if (loadbind(0, (void*)dln_load, (void*)init_fct) == -1) {
+ aix_loaderror(file);
+ }
(*init_fct)();
- return;
+ return (void*)init_fct;
}
#endif /* _AIX */
-#ifdef NeXT
+#if defined(NeXT) || defined(__APPLE__)
#define DLN_DEFINED
/*----------------------------------------------------
By SHIROYAMA Takayuki Psi@fortune.nest.or.jp
@@ -1318,68 +1408,71 @@ dln_load(file)
Special Thanks...
Yu tomoak-i@is.aist-nara.ac.jp,
Mi hisho@tasihara.nest.or.jp,
+ sunshine@sunshineco.com,
and... Miss ARAI Akino(^^;)
----------------------------------------------------*/
-#if NS_TARGET_MAJOR < 4 /* NeXTSTEP rld functions */
+#if defined(NeXT) && (NS_TARGET_MAJOR < 4)/* NeXTSTEP rld functions */
+
{
+ NXStream* s;
unsigned long init_address;
char *object_files[2] = {NULL, NULL};
void (*init_fct)();
- object_files[0] = file;
+ object_files[0] = (char*)file;
+ s = NXOpenFile(2,NX_WRITEONLY);
+
/* Load object file, if return value ==0 , load failed*/
- if(rld_load(NULL, NULL, object_files, NULL) == 0) {
- LoadError("Failed to load %.200s", file);
+ if(rld_load(s, NULL, object_files, NULL) == 0) {
+ NXFlush(s);
+ NXClose(s);
+ rb_loaderror("Failed to load %.200s", file);
}
/* lookup the initial function */
- if(rld_lookup(NULL, buf, &init_address) == 0) {
- LoadError("Failed to lookup Init function %.200s",file);
+ if(rld_lookup(s, buf, &init_address) == 0) {
+ NXFlush(s);
+ NXClose(s);
+ rb_loaderror("Failed to lookup Init function %.200s", file);
}
- /* Cannot call *init_address directory, so copy this value to
- funtion pointer */
+ NXFlush(s);
+ NXClose(s);
+ /* Cannot call *init_address directory, so copy this value to
+ funtion pointer */
init_fct = (void(*)())init_address;
(*init_fct)();
- return ;
+ return (void*)init_address;
}
#else/* OPENSTEP dyld functions */
- {
- int dyld_result ;
- NSObjectFileImage obj_file ; /* handle, but not use it */
+ {
+ int dyld_result;
+ NSObjectFileImage obj_file; /* handle, but not use it */
/* "file" is module file name .
- "buf" is initial function name with "_" . */
+ "buf" is pointer to initial function name with "_" . */
void (*init_fct)();
- dyld_result = NSCreateObjectFileImageFromFile( file, &obj_file );
+ dyld_result = NSCreateObjectFileImageFromFile(file, &obj_file);
- if (dyld_result != NSObjectFileImageSuccess)
- {
- LoadError("Failed to load %.200s", file);
- }
-
- NSLinkModule(obj_file, file, TRUE);
-
-
- /* lookup the initial function */
- /*NSIsSymbolNameDefined require function name without "_" */
- if( NSIsSymbolNameDefined( buf + 1 ) )
- {
- LoadError("Failed to lookup Init function %.200s",file);
+ if (dyld_result != NSObjectFileImageSuccess) {
+ rb_loaderror("Failed to load %.200s", file);
}
- /* NSLookupAndBindSymbol require function name with "_" !! */
+ NSLinkModule(obj_file, file, NSLINKMODULE_OPTION_BINDNOW);
- init_fct = NSAddressOfSymbol( NSLookupAndBindSymbol( buf ) );
+ /* lookup the initial function */
+ if(!NSIsSymbolNameDefined(buf)) {
+ rb_loaderror("Failed to lookup Init function %.200s",file);
+ }
+ init_fct = NSAddressOfSymbol(NSLookupAndBindSymbol(buf));
(*init_fct)();
-
- return ;
+ return (void*)init_fct;
}
#endif /* rld or dyld */
#endif
@@ -1394,39 +1487,40 @@ dln_load(file)
/* load extention module */
img_id = load_add_on(file);
if (img_id <= 0) {
- LoadError("Failed to load %.200s", file);
+ rb_loaderror("Failed to load %.200s", file);
}
/* find symbol for module initialize function. */
- /* The Be Book KernelKit Images section described to use
- B_SYMBOL_TYPE_TEXT for symbol of function, not
- B_SYMBOL_TYPE_CODE. Why ? */
- /* strcat(init_fct_symname, "__Fv"); */ /* parameter nothing. */
- /* "__Fv" dont need! The Be Book Bug ? */
+ /* The Be Book KernelKit Images section described to use
+ B_SYMBOL_TYPE_TEXT for symbol of function, not
+ B_SYMBOL_TYPE_CODE. Why ? */
+ /* strcat(init_fct_symname, "__Fv"); */ /* parameter nothing. */
+ /* "__Fv" dont need! The Be Book Bug ? */
err_stat = get_image_symbol(img_id, buf,
- B_SYMBOL_TYPE_TEXT, &init_fct);
+ B_SYMBOL_TYPE_TEXT, (void **)&init_fct);
if (err_stat != B_NO_ERROR) {
- char real_name[1024];
- strcpy(real_name, buf);
- strcat(real_name, "__Fv");
+ char real_name[MAXPATHLEN];
+
+ strcpy(real_name, buf);
+ strcat(real_name, "__Fv");
err_stat = get_image_symbol(img_id, real_name,
- B_SYMBOL_TYPE_TEXT, &init_fct);
+ B_SYMBOL_TYPE_TEXT, (void **)&init_fct);
}
if ((B_BAD_IMAGE_ID == err_stat) || (B_BAD_INDEX == err_stat)) {
unload_add_on(img_id);
- LoadError("Failed to lookup Init function %.200s", file);
+ rb_loaderror("Failed to lookup Init function %.200s", file);
}
else if (B_NO_ERROR != err_stat) {
char errmsg[] = "Internal of BeOS version. %.200s (symbol_name = %s)";
unload_add_on(img_id);
- LoadError(errmsg, strerror(err_stat), buf);
+ rb_loaderror(errmsg, strerror(err_stat), buf);
}
/* call module initialize function. */
(*init_fct)();
- return;
+ return (void*)img_id;
}
#endif /* __BEOS__*/
@@ -1444,7 +1538,6 @@ dln_load(file)
CFragSymbolClass class;
void (*init_fct)();
char fullpath[MAXPATHLEN];
- extern LoadError();
strcpy(fullpath, file);
@@ -1452,8 +1545,8 @@ dln_load(file)
c2pstr(fullpath);
(void)FSMakeFSSpec(0, 0, fullpath, &libspec);
err = ResolveAliasFile(&libspec, 1, &isfolder, &didsomething);
- if ( err ) {
- LoadError("Unresolved Alias - %s", file);
+ if (err) {
+ rb_loaderror("Unresolved Alias - %s", file);
}
/* Load the fragment (or return the connID if it is already loaded */
@@ -1461,69 +1554,129 @@ dln_load(file)
err = GetDiskFragment(&libspec, 0, 0, fragname,
kLoadCFrag, &connID, &mainAddr,
errMessage);
- if ( err ) {
- p2cstr(errMessage);
- LoadError("%s - %s",errMessage , file);
+ if (err) {
+ p2cstr(errMessage);
+ rb_loaderror("%s - %s",errMessage , file);
}
/* Locate the address of the correct init function */
c2pstr(buf);
err = FindSymbol(connID, buf, &symAddr, &class);
- if ( err ) {
- LoadError("Unresolved symbols - %s" , file);
+ if (err) {
+ rb_loaderror("Unresolved symbols - %s" , file);
}
-
init_fct = (void (*)())symAddr;
(*init_fct)();
- return;
+ return (void*)init_fct;
}
#endif /* __MACOS__ */
+#if defined(__VMS)
+#define DLN_DEFINED
+ {
+ long status;
+ void (*init_fct)();
+ char *fname, *p1, *p2;
+
+ $DESCRIPTOR(fname_d, "");
+ $DESCRIPTOR(image_d, "");
+ $DESCRIPTOR(buf_d, "");
+
+ decc$to_vms(file, vms_fileact, 0, 0);
+
+ fname = (char *)__alloca(strlen(file)+1);
+ strcpy(fname,file);
+ if (p1 = strrchr(fname,'/'))
+ fname = p1 + 1;
+ if (p2 = strrchr(fname,'.'))
+ *p2 = '\0';
+
+ fname_d.dsc$w_length = strlen(fname);
+ fname_d.dsc$a_pointer = fname;
+ image_d.dsc$w_length = strlen(vms_filespec);
+ image_d.dsc$a_pointer = vms_filespec;
+ buf_d.dsc$w_length = strlen(buf);
+ buf_d.dsc$a_pointer = buf;
+
+ lib$establish(vms_fisexh);
+
+ status = lib$find_image_symbol (
+ &fname_d,
+ &buf_d,
+ &init_fct,
+ &image_d);
+
+ lib$establish(0);
+
+ if (status == RMS$_FNF) {
+ error = dln_strerror();
+ goto failed;
+ } else if (!$VMS_STATUS_SUCCESS(status)) {
+ error = DLN_ERROR();
+ goto failed;
+ }
+
+ /* Call the init code */
+ (*init_fct)();
+
+ return 1;
+ }
+#endif /* __VMS */
+
#ifndef DLN_DEFINED
- rb_notimplement("dynamic link not supported");
+ rb_notimplement();
#endif
#endif /* USE_DLN_A_OUT */
#endif
#if !defined(_AIX) && !defined(NeXT)
failed:
- LoadError("%s - %s", dln_strerror(), file);
+ rb_loaderror("%s - %s", error, file);
#endif
+ return 0; /* dummy return */
}
static char *dln_find_1();
char *
dln_find_exe(fname, path)
- char *fname;
- char *path;
+ const char *fname;
+ const char *path;
{
-#if defined(__human68k__)
- if (!path)
- path = getenv("path");
- if (!path)
+ if (!path) {
+ path = getenv(PATH_ENV);
+ }
+
+ if (!path) {
+#if defined(MSDOS) || defined(_WIN32) || defined(__human68k__) || defined(__MACOS__)
path = "/usr/local/bin;/usr/ucb;/usr/bin;/bin;.";
#else
- if (!path) path = getenv("PATH");
- if (!path) path = "/usr/local/bin:/usr/ucb:/usr/bin:/bin:.";
+ path = "/usr/local/bin:/usr/ucb:/usr/bin:/bin:.";
#endif
+ }
return dln_find_1(fname, path, 1);
}
char *
dln_find_file(fname, path)
- char *fname;
- char *path;
+ const char *fname;
+ const char *path;
{
+#ifndef __MACOS__
if (!path) path = ".";
return dln_find_1(fname, path, 0);
+#else
+ if (!path) path = ".";
+ return _macruby_path_conv_posix_to_macos(dln_find_1(fname, path, 0));
+#endif
}
#if defined(__CYGWIN32__)
-char *
-conv_to_posix_path(win32, posix)
+const char *
+conv_to_posix_path(win32, posix, len)
char *win32;
char *posix;
+ int len;
{
char *first = win32;
char *p = win32;
@@ -1538,7 +1691,10 @@ conv_to_posix_path(win32, posix)
first = p + 1;
*p = ';';
}
- cygwin32_conv_to_posix_path(first, posix);
+ if (len < strlen(first))
+ fprintf(stderr, "PATH length too long: %s\n", first);
+ else
+ cygwin32_conv_to_posix_path(first, posix);
return dst;
}
#endif
@@ -1555,25 +1711,24 @@ dln_find_1(fname, path, exe_flag)
register char *ep;
register char *bp;
struct stat st;
-
-#if defined(__CYGWIN32__)
- char rubypath[MAXPATHLEN];
- conv_to_posix_path(path, rubypath);
- path = rubypath;
+#ifdef __MACOS__
+ const char* mac_fullpath;
#endif
-#ifndef __MACOS__
+
+ if (!fname) return fname;
if (fname[0] == '/') return fname;
if (strncmp("./", fname, 2) == 0 || strncmp("../", fname, 3) == 0)
return fname;
if (exe_flag && strchr(fname, '/')) return fname;
-#if defined(MSDOS) || defined(NT) || defined(__human68k__)
+#ifdef DOSISH
if (fname[0] == '\\') return fname;
+# ifdef DOSISH_DRIVE_LETTER
if (strlen(fname) > 2 && fname[1] == ':') return fname;
+# endif
if (strncmp(".\\", fname, 2) == 0 || strncmp("..\\", fname, 3) == 0)
return fname;
if (exe_flag && strchr(fname, '\\')) return fname;
#endif
-#endif /* __MACOS__ */
for (dp = path;; dp = ++ep) {
register int l;
@@ -1581,11 +1736,7 @@ dln_find_1(fname, path, exe_flag)
int fspace;
/* extract a component */
-#if !defined(MSDOS) && !defined(NT) && !defined(__human68k__) && !defined(__MACOS__)
- ep = strchr(dp, ':');
-#else
- ep = strchr(dp, ';');
-#endif
+ ep = strchr(dp, PATH_SEP[0]);
if (ep == NULL)
ep = dp+strlen(dp);
@@ -1603,7 +1754,7 @@ dln_find_1(fname, path, exe_flag)
*/
if (*dp == '~' && (l == 1 ||
-#if defined(MSDOS) || defined(NT) || defined(__human68k__)
+#if defined(DOSISH)
dp[1] == '\\' ||
#endif
dp[1] == '/')) {
@@ -1629,11 +1780,7 @@ dln_find_1(fname, path, exe_flag)
/* add a "/" between directory and filename */
if (ep[-1] != '/')
-#ifdef __MACOS__
- *bp++ = ':';
-#else
*bp++ = '/';
-#endif
}
/* now append the file name */
@@ -1644,16 +1791,28 @@ dln_find_1(fname, path, exe_flag)
*bp = '\0';
fprintf(stderr, "\tDirectory \"%s\"\n", fbuf);
fprintf(stderr, "\tFile \"%s\"\n", fname);
- continue;
+ goto next;
}
memcpy(bp, fname, i + 1);
+#ifndef __MACOS__
if (stat(fbuf, &st) == 0) {
if (exe_flag == 0) return fbuf;
/* looking for executable */
- if (eaccess(fbuf, X_OK) == 0) return fbuf;
+ if (!S_ISDIR(st.st_mode) && eaccess(fbuf, X_OK) == 0)
+ return fbuf;
}
-#if defined(MSDOS) || defined(NT) || defined(__human68k__)
+#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[] = {
#if defined(MSDOS)
@@ -1661,8 +1820,12 @@ dln_find_1(fname, path, exe_flag)
#if defined(DJGPP)
".btm", ".sh", ".ksh", ".pl", ".sed",
#endif
+#elif defined(__EMX__) || defined(_WIN32)
+ ".exe", ".com", ".cmd", ".bat",
+/* end of __EMX__ or _WIN32 */
#else
".r", ".R", ".x", ".X", ".bat", ".BAT",
+/* __human68k__ */
#endif
(char *) NULL
};
@@ -1676,11 +1839,19 @@ dln_find_1(fname, path, exe_flag)
continue;
}
strcpy(bp + i, extension[j]);
+#ifndef __MACOS__
if (stat(fbuf, &st) == 0)
return fbuf;
+#else
+ if (mac_fullpath = _macruby_exist_file_in_libdir_as_posix_name(fbuf))
+ return mac_fullpath;
+
+#endif
}
}
-#endif /* MSDOS or NT or __human68k__ */
+#endif /* MSDOS or _WIN32 or __human68k__ or __EMX__ */
+
+ next:
/* if not, and no other alternatives, life is bleak */
if (*ep == '\0') {
return NULL;
@@ -1689,3 +1860,24 @@ dln_find_1(fname, path, exe_flag)
/* otherwise try the next component in the search path */
}
}
+
+#if defined(__VMS)
+
+/* action routine for decc$to_vms */
+static int vms_fileact(char *filespec, int type)
+{
+ if (vms_filespec)
+ free(vms_filespec);
+ vms_filespec = malloc(strlen(filespec)+1);
+ strcpy(vms_filespec, filespec);
+ return 1;
+}
+
+/* exception handler for LIB$FIND_IMAGE_SYMBOL */
+static long vms_fisexh(long *sigarr, long *mecarr)
+{
+ sys$unwind(1, 0);
+ return 1;
+}
+
+#endif /* __VMS */
diff --git a/dln.h b/dln.h
index 7af1f63a9d..182cf9f9f4 100644
--- a/dln.h
+++ b/dln.h
@@ -1,30 +1,40 @@
-/************************************************
+/**********************************************************************
dln.h -
$Author$
- $Revision$
$Date$
created at: Wed Jan 19 16:53:09 JST 1994
-************************************************/
+ Copyright (C) 1993-2003 Yukihiro Matsumoto
+
+**********************************************************************/
+
#ifndef DLN_H
#define DLN_H
-#ifndef _
-#ifndef __STDC__
-# define _(args) ()
-#else
-# define _(args) args
+#ifdef __cplusplus
+# ifndef HAVE_PROTOTYPES
+# define HAVE_PROTOTYPES 1
+# endif
+# ifndef HAVE_STDARG_PROTOTYPES
+# define HAVE_STDARG_PROTOTYPES 1
+# endif
#endif
+
+#undef _
+#ifdef HAVE_PROTOTYPES
+# define _(args) args
+#else
+# define _(args) ()
#endif
-char *dln_find_exe _((char*,char*));
-char *dln_find_file _((char*,char*));
+char *dln_find_exe _((const char*,const char*));
+char *dln_find_file _((const char*,const char*));
#ifdef USE_DLN_A_OUT
extern char *dln_argv0;
#endif
-void dln_load _((char*));
+void *dln_load _((const char*));
#endif
diff --git a/doc/ChangeLog-1.8.0 b/doc/ChangeLog-1.8.0
new file mode 100644
index 0000000000..d168a50f80
--- /dev/null
+++ b/doc/ChangeLog-1.8.0
@@ -0,0 +1,24345 @@
+Mon Aug 4 17:21:19 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (class_instance_method_list): methods defined in
+ singleton class and extended modules should be included.
+ [ruby-dev:21119]
+
+Mon Aug 4 13:05:57 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (method_proc): should specify YIELD_FUNC_SVALUE.
+ [ruby-dev:21107]
+
+ * marshal.c (w_object): should not call w_extended for USRMARSHAL
+ dump. [ruby-dev:21106]
+
+Mon Aug 4 10:42:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/test/unit/ui/console/testrunner.rb: Flushed io in the
+ Console::TestRunner so that it will output immediately.
+
+Mon Aug 4 10:27:22 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * util.h: remove unnecessary parentheses. [ruby-dev:20879]
+
+Mon Aug 4 10:00:47 2003 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (receive_responses): raise exception to
+ client_thread. Thanks to William Webber.
+
+Mon Aug 4 09:22:53 2003 William Webber <wew@williamwebber.com>
+
+ * lib/net/imap.rb: convert RD to RDoc.
+
+Mon Aug 4 02:34:05 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_utime): never use utime() of C runtime.
+ [ruby-talk:77782]
+
+Sun Aug 3 23:56:50 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_call_super): should propagate previous block for
+ super call. [ruby-talk:77884]
+
+Sun Aug 3 22:07:47 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tkentry.rb: support 'validatecommand' option of
+ TkEntry/TkSpinbox widget
+
+ * ext/tk/sample/{demos-en,demos-jp}/spin.rb: add
+
+Sun Aug 3 19:25:28 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (call_trace_func): clear exception flag temporarily.
+ [ruby-dev:21090]
+
+Sun Aug 3 18:03:44 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * regex.h (re_mbctab): should refer to RUBY_EXPORT. [ruby-ext:02199]
+
+ * lib/un.h (help): new. % ruby -run -e help cp
+
+Sun Aug 3 08:53:06 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/sample/{demos-en,demos-jp}/image3.rb: add
+
+ * ext/tk/lib/tkcanvas.rb: bug fix on Tk object ID management
+
+ * ext/tk/lib/tktext.rb: ditto
+
+Sun Aug 3 02:55:52 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * process.c: modify macro to detect 'MacOS X' [ruby-talk:77849]
+
+ * ext/tcltklib/lib/tcltk.rb: bug fix ( NOT MAINTAINED : only
+ for running 'line2.rb' demo. )
+
+Sun Aug 3 02:45:06 2003 Koji Arai <jca02266@nifty.ne.jp>
+
+ * numeric.c (flo_to_s): get rid of buffer overflow.
+
+Sat Aug 2 23:51:52 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (appendline): clearerr(3) before raising exception, since
+ exception may be captured by rescue. [ruby-talk:77794]
+
+Sat Aug 2 09:58:13 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: bug fix --- TkGrid failed to treat
+ RELATIVE PLACEMENT
+
+ * ext/tk/sample/demos-en/, demos-jp/: add or modify some
+ widget demo scripts
+
+Sat Aug 2 20:59:38 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick/https.rb: change an option name.
+ :SSLCertStore -> :SSLCertificateStore.
+
+Sat Aug 2 19:18:40 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/smtp.rb: respond_to? needs 2nd argument.
+ Thanks Jim Bob. [ruby-talk:77796]
+
+Sat Aug 2 15:11:54 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/extmk.rb (--no-undefined): annoying option removed.
+
+Sat Aug 2 14:53:55 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (pkg_config): get configuration by pkg-config. [new]
+
+ * ext/openssl/extconf.rb: use pkg_config.
+
+Sat Aug 2 13:45:17 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c: add "#pragma weak" for __libc_ia64_register_backing_store_base.
+ [ruby-dev:21072]
+
+Sat Aug 2 14:02:39 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * variable.c (classname): find regular class name if not set.
+ [ruby-dev:20496]
+
+Sat Aug 2 09:58:13 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: bug fix --- forgot to entry a widget class
+ name of 'labelframe' widget
+
+ * ext/tk/sample/{demos-en,demos-jp}/{labelframe.rb,paned1.rb,
+ paned2.rb,spin.rb}: add demo-scripts to the JP/EN widget demos
+
+Sat Aug 2 05:04:30 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tkentry.rb: bug fix of TkEntry#delete
+
+ * ext/tk/samples/: bug fix of some widget demos
+
+ * ext/tk/lib/tk.rb: support <TkVariable object> == <Symbol>
+
+ * ext/tk/lib/*.rb: freeze some object for security reason
+
+Sat Aug 2 03:30:25 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_obj_singleton_methods): should not go up to
+ ancestors unless the recursive flag is set. [ruby-list:38007]
+
+ * eval.c (rb_yield_0): expand [] to nil if avalue is set.
+ [ruby-dev:21058]
+
+ * hash.c (env_each_key): use env_keys to avoid environment modify
+ on the fly.
+
+ * hash.c (env_each_value): use env_values for safety.
+
+ * hash.c (env_each): allocate environment array first.
+
+Fri Aug 2 03:20:00 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * lib/yaml/store.rb (YAML::Store#initialize): filename is first
+ argument. Thanks Kent Dahl.
+
+Sat Aug 2 00:49:31 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb: refine document.
+
+Fri Aug 1 23:57:45 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (rb_gc_mark_locations): no need to swap arguments.
+
+ * gc.c (STACK_LENGTH): insufficient for growing up stack
+ architectures.
+
+ * gc.c (rb_gc, Init_stack) ditto.
+
+Fri Aug 1 23:33:36 2003 Masatoshi Seki <mas@snow.local.>
+
+ * rubytest.rb: set dldpath on darwin.
+
+Fri Aug 1 23:07:38 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb: convert RD to RDoc. Thanks William Webber.
+ [ruby-doc:456]
+
+Fri Aug 1 19:48:56 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/syck/rubyext.c (syck_emitter_write_m): forgot to declare
+ "self", making it default to "int".
+
+ * ext/syck/rubyext.c (syck_emitter_simple_write): ditto.
+
+ * gc.c (rb_gc): should mark backing store region on IA64.
+
+Fri Aug 1 18:51:10 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * process.c: bug fix --- preprocessor errors occur on OpenBSD-current
+
+Fri Aug 1 17:13:23 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/openssl/extconf.rb: should replace literally.
+
+Fri Aug 1 16:22:57 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_io_check_readable, rb_io_check_writable): ensure not
+ closed at first.
+
+ * io.c (rb_io_getline): check readable always. (ruby-bugs:PR#1069)
+
+ * io.c (rb_io_each_byte): ditto.
+
+Fri Aug 1 16:02:46 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (READ_DATA_PENDING_PTR): cast to get rid of warnings.
+
+ * ext/socket/socket.c (unix_send_io, unix_recv_io): ditto.
+
+Fri Aug 1 15:53:24 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (isInternalCmd): shouldn't return if find end of str.
+ [ruby-talk:77678]
+
+Fri Aug 1 13:45:14 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_call_super): propagate previous block if a block is
+ given. [ruby-talk:77577]
+
+Fri Aug 1 09:54:38 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_fill): array length may be changed during the
+ block execution. [ruby-talk:77579]
+
+ * array.c (rb_ary_zip): ditto.
+
+ * array.c (rb_ary_fill): ditto.
+
+ * hash.c (env_reject_bang): length may be changed during the block
+ execution.
+
+ * hash.c (env_clear): ditto.
+
+Fri Aug 1 04:58:55 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: bug fix --- forget to eval given block to
+ TkRoot.new method
+
+ * ext/tk/sample/tkoptdb-safeTk.rb: new sample script
+
+Fri Aug 1 00:52:58 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (Init_stack): IA64 requires STACK_LEVEL_MAX to be less than
+ magic number when optimizer turned on, regardless of rlimit
+ values.
+
+Thu Jul 31 23:44:00 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/erb.rb: import erb-2.0.4b4.
+
+Thu Jul 31 23:04:45 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/sample/resource.en, ext/tk/sample/resource.jp:
+ wrong resource file format
+
+ * ext/tk/lib/tk.rb: add Tk::Encoding.{encoding_convertfrom,
+ encoding_convertto}
+
+ * ext/tk/lib/tk.rb: add TkOptionDB.read_with_encoding to read
+ non-utf8 resource file
+
+Thu Jul 31 23:02:47 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/etc/etc.c: revert getenv()'s prototype. use it only when _WIN32
+ is not defined.
+
+Thu Jul 31 20:52:40 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: (IMPORTANT BUG FIX) scan of event keywords
+ doesn't work on recent versions of Tck/Tk
+
+ * ext/tk/lib/tk.rb: initialize error of instance variable on
+ TkComposite
+
+ * ext/tk/lib/multi-tk.rb: initialize error on encoding-system on
+ MultiTkIp
+
+ * ext/tk/lib/tk.rb: trouble on destroying widgets
+
+ * ext/tk/sample/demos-en/, demos-jp/: add JP and EN version of
+ Ruby/Tk widget demos
+
+Thu Jul 31 15:25:12 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * array.c (rb_ary_collect): must get length of array for each
+ iteration. reported on [ruby-talk:77500], and fixed by
+ K.Sasada <ko1@namikilab.tuat.ac.jp> on [ruby-talk:77504]
+
+Thu Jul 31 14:11:54 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/extconf.rb: move gmake specific features
+ into GNUmakefile.
+
+Thu Jul 31 12:36:11 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * bin/erb, lib/erb.rb: add explicit trim mode.
+
+Thu Jul 31 04:59:10 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (rb_num_coerce_relop): export function.
+
+Thu Jul 31 08:18:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
+
+ * lib/test/unit.rb: A useful return code is now set if tests fail when
+ running automatically using the Console::TestRunner.
+
+Thu Jul 31 07:59:18 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: wrap the command-proc of TkScale --- pass
+ the numeric object to the proc
+
+ * ext/tk/lib/tk.rb: better support for widgets created on
+ Tk interpreter (without Ruby)
+
+ * ext/tk/lib/multi-tk.rb: a little more stable on Multiple Tk
+ interpreters running
+
+Thu Jul 31 00:17:19 2003 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/ftp.rb (return_code): obsolete.
+
+ * lib/net/ftp.rb (last_response_code): new method. lastresp is now
+ alias to last_response_code.
+
+ * lib/net/ftp.rb (last_response): new method.
+
+Wed Jul 30 23:55:44 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_object): check has been dropped. "_dump must return
+ string." [ruby-dev:21024]
+
+Wed Jul 30 22:35:19 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/mkmf.rb (dir_config): allow multiple directories separated
+ by File::PATH_SEPARATOR.
+
+ * lib/mkmf.rb (create_makefile): DLDFLAGS include $LDFLAGS again.
+ [ruby-talk:76894]
+
+ * lib/mkmf.rb (init_mkmf): not default $LDFLAGS to LDFLAGS for
+ ruby itself, but default $DLDFLAGS to DLDFLAGS.
+
+Wed Jul 30 16:17:06 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_object): marshal_dump should not take any
+ argument.
+
+Wed Jul 30 15:54:04 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl_ssl.c (ossl_sslctx_initialize): should initialize
+ instance variables. [ruby-talk:77362]
+
+Wed Jul 30 15:39:54 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ruby.c (proc_options): -F set compiled regular expression to $;.
+ [ruby-talk:77381]
+
+ * string.c (Init_String): no setter type check for $;
+
+Wed Jul 30 15:10:02 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * error.c (rb_raise): snprintf() termination moved to
+ win32/win32.c.
+
+ * win32/win32.c (valid_filename, str_grow): unused.
+
+ * win32/win32.c (NTLoginName, ChildRecord): make static.
+
+ * win32/win32.c (CreateChild): argument check.
+
+ * win32/win32.c (kill): should not call CloseHandle() when
+ OpenProcess() failed.
+
+ * win32/win32.c (rb_w32_vsnprintf, rb_w32_snprintf): ensure buffer
+ terminated. [ruby-talk:69672]
+
+Wed Jul 30 10:54:10 2003 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/ftp.rb (get): fix wrong argument name. Thanks to William
+ Webber.
+
+Wed Jul 30 10:31:37 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/iconv/iconv.c (iconv_convert): append unchanged portion
+ after overflow. [ruby-dev:21006]
+
+ * ext/iconv/extconf.rb: check if iconv() 2nd argument is const.
+
+Wed Jul 30 09:31:55 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * configure.in (os2-emx): renamed from os2_emx, add flags to
+ CFLAGS and LDFLAGS, and remove lib prefix. [ruby-dev:20993]
+
+ * file.c (rb_file_s_rename): retry with removing new file on
+ DOSISH. [ruby-dev:21007]
+
+ * ext/socket/extconf.rb (sendmsg, recvmsg): check functions.
+
+ * ext/socket/socket.c (unix_send_io, unix_recv_io): raise
+ NotImplementedError unless system calls are available.
+
+ * ext/socket/socket.c (sock_initialize): rename from sock_init()
+ to get rid of conflict with OS/2 socket library.
+
+Wed Jul 30 07:23:14 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tkentry.rb: fix lack of methods for TkEntry
+
+ * ext/tk/lib/multi-tk.rb, ext/tk/lib/tk.rb,
+ ext/tk/lib/tkdialog.rb, ext/tk/lib/tkentry.rb,
+ ext/tk/sample/safe-tk.rb, ext/tk/sample/tktimer2.rb: bug fix
+
+ * ext/tk/lib/multi-tk.rb: MultiTkIp.new_* accept a block to
+ eval under the new interpreter
+
+Wed Jul 30 04:36:30 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c,
+ ext/tk/lib/tk.rb, ext/tk/lib/tkafter.rb: additional check of
+ Tk interpreters' status for a little more safety
+
+Wed Jul 30 02:37:12 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_object): if object responds to 'marshal_dump',
+ Marshal.dump uses it to dump object. unlike '_dump',
+ marshal_dump returns any kind of object.
+
+ * marshal.c (r_object0): restore instance by calling
+ 'marshal_load' method. unlike '_load', it's an instance
+ method, to handle cyclic reference.
+
+ * marshal.c (marshal_load): all objects read from file should be
+ tainted. [ruby-core:01325]
+
+Wed Jul 30 01:47:51 2003 Hugh Sasse <hgs@dmu.ac.uk>
+
+ * lib/timeout.rb (Timeout::timeout): execute immediately if sec is
+ zero.
+
+Wed Jul 30 01:36:18 2003 Aron Griffis <ruby-talk@griffis1.net>
+
+ * ext/socket/socket.c (socks_init): typo fixed. [ruby-talk:77232]
+
+Wed Jul 30 00:48:43 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/extconf.rb: the default value for --enable-socks is
+ taken from ENV["SOCKS_SERVER"]. [ruby-talk:77232]
+
+ * ruby.c (proc_options): add -W option. -W0 to shut up all warning
+ messages. [ruby-talk:77227]
+
+ * error.c (rb_warn): no message will be printed if the value of
+ $VERBOSE is "nil", i.e. perfect silence.
+
+ * ruby.c (verbose_setter): $VERBOSE value is either true, false,
+ or nil.
+
+ * io.c (Init_IO): no "read" check for $stdin. in addition some
+ function names has been changed.
+
+Tue Jul 29 23:10:19 2003 Yoshida Masato <yoshidam@yoshidam.net>
+
+ * regex.c (re_match_exec): incorrect multibyte match.
+
+Tue Jul 29 22:36:50 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/smtp.rb (send0): do taint check only when $SAFE > 0
+
+Tue Jul 29 19:20:34 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/fileutils.rb (install): support preserve timestamp.
+
+ * instruby.rb (install): use FileUtils::install preserve mode.
+
+ * lib/un.rb: new. % ruby -run -e cp -- -p foo bar
+
+ * lib/mkmf.rb: use un.rb instead of ftools.rb.
+
+ * MANIFEST: add lib/un.rb.
+
+ * ext/extmk.rb (INSTALL_PROG, INSTALL_DATA): modify verbose messages.
+
+Tue Jul 29 18:55:22 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/smtp.rb: unify coding style.
+
+ * lib/net/http.rb: ditto.
+
+Tue Jul 29 17:27:59 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ruby.h (LLONG_MIN): fix typo.
+
+Tue Jul 29 16:38:44 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/net/smtp.rb (Net::SMTP::send0): add taint check.
+
+Tue Jul 29 15:41:02 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * instruby.rb (install): preserve the timestamp for Mac OS X ranlib
+ problem.
+
+Tue Jul 29 01:14:51 2003 Rick Ohnemus <rick_ohnemus@acm.org>
+
+ * ruby.h (LLONG_MIN): wrong value.
+
+Mon Jul 28 22:57:52 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_f_getc): $stdin may not be IO. [ruby-dev:20973]
+
+Tue Jul 29 16:20:36 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c: bug fix and
+ change mainloop_abort_on_no_widget_cmd => mainloop_abort_on_exception
+ ( to avoid thread timing trouble on accessing destroyed widgets )
+
+ * ext/tk/lib/multi-tk.rb: change default mode of
+ mainloop_abort_on_exception on multi-tk.rb
+
+ * ext/tk/lib/multi-tk.rb: fix a bug of the procedure for
+ 'Delete' button on the safe-Tk frmae
+
+Tue Jul 29 12:22:28 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/token.c: prefixed many constants and definitions
+ with YAML_ to avoid name clash.
+
+ * ext/syck/gram.c: ditto.
+
+ * ext/syck/gram.h: ditto.
+
+Tue Jul 29 12:15:37 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/etc/etc.c: add real prototype to getenv().
+
+ * win32/win32.h: add arguments to definitions of functions if possible.
+
+Tue Jul 29 08:05:30 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb, ext/tk/lib/tkdialog.rb, ext/tk/lib/tktext.rb,
+ ext/tk/sample/tkbiff.rb, ext/tk/sample/tkdialog.rb,
+ ext/tk/sample/tkform.rb: bug fix ( tested with Ruby/Tk widget demo )
+
+Tue Jul 29 04:22:08 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/syck.h: Added 'syck' yacc prefixes.
+
+ * ext/syck/gram.c: ditto.
+
+ * ext/syck/token.c: ditto.
+
+ * ext/syck: Added ruby.h reference to source files.
+
+Tue Jul 29 03:53:28 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/lib/net/https.rb (use_ssl=): raise ProtocolError if
+ connection is set up already.
+
+Tue Jul 29 01:45:32 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c: use RTEST()
+
+Tue Jul 29 01:24:32 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c: bug fix
+
+ * ext/tk/lib/multi-tk.rb: bug fix and pack options are pssed
+ to the safeTk container
+
+ * ext/tk/sample/safe-tk.rb: add example for pack options of
+ safeTk container
+
+Mon Jul 28 23:23:08 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * file.c (Init_File): IO should include File::Const.
+ [ruby-dev:20964]
+
+Mon Jul 28 18:53:03 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/openssl/extconf.rb: check again after pkg-config for MinGW on
+ Cygwin.
+
+Mon Jul 28 15:32:04 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_gets): only "gets" should set $_.
+
+ * ext/stringio/stringio.c (strio_getline): should not set $_ here.
+
+ * io.c (argf_to_s): argf.to_s returns "ARGF".
+
+ * io.c (set_defout_var, set_deferr_var): make $defout and $deferr
+ obsolete.
+
+ * io.c (set_input_var, set_output_var): allow $stdin, $stdout,
+ $stderr not to be instance of IO.
+
+ * io.c (rb_f_readline): forward method to current_file. gets,
+ readline, readlines, getc, readchar, tell, seek, pos=, rewind,
+ fileno, to_io, eof, each_line, each_byte, binmode, and closed?
+ as well.
+
+ * io.c (argf_forward): utility function to forward method to
+ current_file.
+
+Mon Jul 28 06:10:13 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c: bug fix
+
+ * ext/lib/tk/multi-tk.rb: bug fix
+
+ * ext/lib/tk/multi-tk.rb: add methods depend on Tcl's 'interp' command
+
+ * ext/lib/tk/multi-tk.rb: suppot safe-level control of each interpreter
+
+Mon Jul 28 03:08:47 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb: each() should return self.
+
+Mon Jul 28 01:35:32 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_chomp_bang): defer rb_str_modify() to actual
+ modify point. other methods, replace, tr, delete, squeeze,
+ lstrip, and rstrip as well.
+
+ * string.c (rb_str_rstrip_bang): remove trailing '\0' at the end
+ of string.
+
+ * string.c (rb_str_lstrip_bang): do not strip '\0' from the left.
+
+Sun Jul 27 21:16:30 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/openssl/extconf.rb: better support MinGW. add
+ dir_config("kerberos") and with_config("pkg-config").
+
+ * mkconfig.rb: initialize global variables to avoid warnings.
+
+Sun Jul 27 19:35:06 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c: add some methods to support
+ multiple interpreters (low level)
+
+ * ext/tk/lib/multi-tk.rb: new library to support multiple Tk
+ interpreters (high level)
+
+ * ext/tcltklib/demo/safeTk.rb: new sample of safeTk interpreter
+
+ * ext/tk/sample/safe-tk.rb: new sample of multi-tk.rb
+
+ * ext/tk/lib/tk.rb: bug fix and add feature to supprt multi-tk
+
+ * ext/tk/lib/tkafter.rb: ditto
+
+Sun Jul 27 14:43:37 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/debug.rb: fix breakpoint parameter parsing/checking.
+ (?:(file|class):)(line_number|method)
+
+Sun Jul 27 10:21:28 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/drb/unix.rb: add UNIXFileOwner, UNIXFileGroup.
+
+Sun Jul 27 03:10:43 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * io.c (io_reopen): avoid dup2() equal handles not to close itself and
+ to get rid of a msvcrt bug. [ruby-dev:20919]
+
+Sun Jul 27 00:37:16 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/tmpdir.rb: use GetWindowsDirectory, not GetSystemDirectory.
+ [ruby-talk:77073]
+
+Sat Jul 26 21:25:21 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (rb_fdopen): set errno if it's zero on win32 platforms.
+
+ * ext/openssl/ossl_ssl.c (TO_SOCKET): define special version when
+ _WIN32 is defined. this is ruby's problem, not OpenSSL.
+
+ * win32/win32.c: remove some old comments.
+
+Sat Jul 26 14:26:57 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/tk/lib/tk.rb (TkCore::chooseDirectory): back up wrongly
+ removed method.
+
+Sat Jul 26 14:14:12 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/stringio/stringio.c: includes Enumerable as well as IO.
+ [ruby-talk:77058]
+
+Sat Jul 26 07:00:53 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/erb.rb: fix % line.
+
+Sat Jul 26 05:31:09 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ossl.h: fix comment.
+
+ * ext/openssl/ossl.c (ossl_debug): should enable if no va-args
+ macro supplied.
+
+Sat Jul 26 04:04:36 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/extconf.rb: refine va-args macro detection.
+ [ruby-talk:76983]
+
+Sat Jul 26 01:33:51 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/openssl/ossl_ssl.c (ossl_ssl_setup): need to pass the real
+ socket to SSL_get_fd on native win32 platforms.
+
+Sat Jul 26 01:20:29 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_mod_const_missing): "const_missing" should not
+ appear in the caller(); add call frame adjustment.
+
+ * eval.c (rb_method_missing): simplify call frame adjustment.
+
+Fri Jul 26 00:04:25 2003 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
+
+ * ext/openssl/sample: add samples.
+ - cert2text.rb: dump certificate file as text.
+ - crlstore.rb: CRL store implementation. Fetch CRL via HTTP when
+ http-access2 is installed.
+ - certstore.rb: certificate store implementation.
+ - cert_store_view.rb: certificate store viewer with FXRuby. Uses
+ c_rehash.rb, crlstore.rb and certstore.rb.
+
+Fri Jul 25 16:43:03 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c: add TclTkIp#create_slave,
+ TclTkIp#_make_safe and TclTkIp#safe?
+
+ * ext/tcltklib/MANUAL.euc: modify descriptions
+
+ * ext/tk/lib/tk.rb: bug fix [ruby-talk:76980] and modify to
+ support multi Tk IPs
+
+ * ext/tk/lib/tkafter.rb: modify to support multi Tk IPs
+
+Fri Jul 25 15:47:39 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/extconf.rb: add check for BN_rand_range() and
+ BN_pseudo_rand_range().
+
+ * ext/openssl/ossl_bn.c (ossl_bn_s_rand_range): should raise
+ NotImplementedError if BN_rand_range() wan not defined.
+
+ * ext/openssl/ossl_bn.c (ossl_bn_s_pseudo_rand_range): should raise
+ NotImplementedError if BN_pseudo_rand_range() wan not defined.
+
+ * ext/openssl/ossl_pkcs7.c (ossl_pkcs7_s_encrypt): avoid compiler
+ warning for OpenSSL-0.9.6.
+
+ * ext/openssl/ossl_pkcs7.c (ossl_pkcs7si_initialize): ditto.
+
+Fri Jul 25 14:34:55 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c (tcp_s_gethostbyname): was using
+ uninitialized size_t value. [ruby-talk:76946]
+
+Fri Jul 25 13:38:38 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * re.c (rb_reg_options_m): use rb_reg_options() to mask internal
+ flags.
+
+ * re.c (rb_reg_initialize_m): allow nil as third argument and
+ ignore, and mask code flags if the argument is given.
+ [ruby-dev:20885]
+
+ * re.c (rb_reg_options): get common flags directly.
+
+Fri Jul 25 03:52:21 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * lib/yaml/dbm.rb: replace indexes with values_at.
+
+Fri Jul 25 02:55:59 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/extconf.rb: add check for libsocket and libnsl.
+
+ * ext/openssl/extconf.rb: use pkg-config to build CFLAGS and LDFLAGS.
+
+Fri Jul 25 01:27:59 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/emitter.c (syck_emitter_flush): accepts count
+ of bytes to flush. anchor offsets now functional.
+
+ * ext/syck/syck.h (syck_emitter_flush): ditto.
+
+ * ext/syck/rubyext.c: ditto.
+
+ * ext/syck/token.c: URI escaping now supported.
+
+Thu Jul 24 16:41:31 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/mkmf.rb (have_type): check if a type is defined.
+
+ * lib/mkmf.rb (check_sizeof): check size of a type.
+
+ * ext/dbm/extconf.rb: check if type DBM is defined.
+ [ruby-talk:76693]
+
+Thu Jul 24 16:18:40 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ChangeLog (add-log-time-format): "%c" contains timezone on
+ XEmacs.
+
+Thu Jul 24 16:05:22 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * configure.in (AC_C_VOLATILE): check if volatile works.
+
+ * defines.h (volatile): removed.
+
+ * eval.c (rb_thread_group): Thread#group. [new]
+
+Thu Jul 24 15:50:42 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/extconf.rb: add check for win32 OpenSSL libraries.
+
+ * ext/openssl/extconf.rb: add check for __VA_ARGS__.
+
+ * ext/openssl/ossl.h: avoid non C99 compiler errors.
+
+Thu Jul 24 13:32:56 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (thgroup_add): no warning for terminated threads.
+
+Thu Jul 24 13:09:26 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pathname.rb: added.
+
+Thu Jul 24 11:21:10 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/io/wait/extconf.rb: removed unnecessary backward
+ compatibility stuff.
+
+Thu Jul 24 11:09:10 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/openssl/extconf.rb: revert use of dir_config.
+
+Thu Jul 24 09:58:32 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/Win32API/lib/win32/resolv.rb: added.
+
+ * lib/resolv.rb: support Win32 platforms. based on Tietew's work
+ [ruby-dev:15573].
+
+Thu Jul 24 04:05:46 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/ssl.h: undef X509_NAME and PKCS7_SIGNER_INFO to
+ avoid name confliction on mswin32.
+
+ * ext/openssl/ssl.c (ossl_protect_obj2bio): avoid VC++ warnings
+ in function prototype.
+
+ * ext/openssl/ssl.c (ossl_protect_membio2str): ditto.
+
+ * ext/openssl/ssl.c (ossl_protect_x509_ary2sk): ditto.
+
+Thu Jul 24 03:44:04 2003 Michal Rokos <m.rokos@sh.cvut.cz>
+
+ * ext/openssl/extconf.rb: cut check for OpenSSL version
+
+Thu Jul 24 03:41:30 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/tcltklib/tcltklib.c (ip_init): need at least one statement after
+ label.
+
+Thu Jul 24 01:48:03 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/cgi.rb (CGI::QueryExtension::[]): should return StringIO (or
+ Tempfile) for multipart/form.
+
+ * variable.c (rb_define_const): give warning for non constant
+ name. [ruby-core:01287]
+
+Thu Jul 24 01:51:08 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * lib/webrick: imported.
+
+ * MANIFEST: added webrick files.
+
+Thu Jul 24 01:32:04 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/tmpdir.rb (tmpdir): new method. remove TMPDIR.
+ use GetSystemWindowsDirectory(GetSystemDirectory), not GetTempPath.
+
+Thu Jul 24 01:08:43 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl: imported.
+
+Wed Jul 23 23:06:59 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * file.c (DOSISH): better Cygwin support.
+
+Wed Jul 23 19:13:21 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_split_m): the receiver may be empty string.
+
+Wed Jul 23 18:43:00 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/erb.rb: import erb-2.0.4b1.
+
+Wed Jul 23 18:21:52 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/io/wait: imported.
+
+Wed Jul 23 16:07:35 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * process.c: unify indentation
+
+ * configure.in: add --enable-setreuid option
+
+ * ext/tcltklib/tcltklib.c: TclTkIp.new accepts 'ip-name' and 'options'
+
+ * ext/tk/lib/tk.rb: support arguments of TclTkIp.new
+
+ * ext/tk/lib/tk*.rb: preparations for multi-Tk interpreter support
+
+Wed Jul 23 15:49:01 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_lstrip_bang): strip NUL along with white
+ spaces. [ruby-talk:76659]
+
+ * string.c (rb_str_rstrip_bang): ditto.
+
+Wed Jul 23 14:19:17 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/mkmf.rb (log_src, checking_for, create_header):
+ Logging.message is printf like format.
+
+Wed Jul 23 10:11:15 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/iconv/iconv.c (check_iconv): check if Iconv instance.
+
+ * ext/iconv/iconv.c (iconv_convert): stringify argument.
+
+Wed Jul 23 02:39:46 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * process.c: add a module for raw syscalls to control UID/GID
+
+ * process.c: add modules for portable UID/GID control
+
+Tue Jul 22 19:16:40 2003 Tanaka Akira <akr@m17n.org>
+
+ * ext/iconv/iconv.c (iconv_failure_initialize): limit
+ inspect message. [ruby-dev:20785]
+
+ * ext/iconv/iconv.c (rb_str_derive): share with original
+ string if possible. [ruby-dev:20785]
+
+Tue Jul 22 17:22:34 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_mod_const_missing): new method. [ruby-core:00441]
+
+ * variable.c (rb_const_get_at): allow "const_missing" hook.
+
+ * variable.c (rb_const_get_0): ditto.
+
+ * eval.c (method_missing): rename from rb_undefined to clarify.
+
+ * eval.c (ruby_finalize_0): update exit status if any of END proc
+ raises SystemExit. [ruby-core:01256]
+
+ * signal.c (rb_trap_exit): wrap rb_eval_cmd
+
+ * eval.c (rb_exec_end_proc): reduce rb_protect().
+
+Tue Jul 22 17:15:57 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * MANIFEST (lib/cgi/session/pstore.rb, lib/yaml/baseemitter.rb):
+ added.
+
+Tue Jul 22 10:52:19 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/tmpdir.rb: remove charcters after "\000" and regularize path.
+
+Tue Jul 22 02:22:45 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (num_equal): should not use rb_equal().
+
+ * string.c (rb_str_equal): should return nil for non string
+ operand to conform comparable convention. [ruby-dev:20759]
+
+Tue Jul 22 00:19:19 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/tmpdir.rb: new library to get temporary directory path,
+ using GetTempPath on Win32 environment.
+
+ * lib/tempfile.rb: now uses tmpdir.rb.
+
+ * lib/cgi/session.rb, ib/drb/unix.rb: ditto.
+
+Mon Jul 21 01:53:43 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_string_value_cstr): check null byte in the string
+ before retrieving C ptr. accessed via macro StringValueCStr.
+
+ * file.c: use StringValueCStr to retrieve paths to system calls.
+
+ * file.c (sys_fail2): raise error for two operand system calls
+ such as rename, link, symlink. (ruby-bugs PR#1047)
+
+Sun Jul 20 11:03:25 2003 UENO Katsuhiro <katsu@blue.sky.or.jp>
+
+ * ext/zlib/zlib.c (gzfile_read_header): gz->z.input may be nil after
+ finishing reading a gzip header.
+
+Sat Jul 19 22:25:47 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_match2): add warning to "~string".
+ [ruby-list:37751]
+
+ * lib/net/ftp.rb (Net::FTP::open): takes block. suggested by Gavin
+ Sinclair in [ruby-core:01237].
+
+Sat Jul 19 19:03:24 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+
+ * wince/stdlib.c: add bsearch().
+
+Sat Jul 19 12:34:45 2003 David Black <dblack@superlink.net>
+
+ * lib/scanf.rb: import.
+
+Sat Jul 19 11:27:25 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/xmlrpc: import.
+
+ * eval.c (thgroup_add): should return group for terminated thread
+ case.
+
+ * eval.c (thgroup_add): do not raise ThreadError on terminated
+ thread addition for compatibility. just warning.
+
+Sat Jul 19 04:50:56 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/iconv/charset_alias.rb, ext/iconv/extconf.rb: make wrapper
+ script which maps charset names. [ruby-dev:20625]
+
+ * ext/iconv/iconv.c (charset_map): charset name map.
+
+ * ext/iconv/iconv.c (iconv_dfree): no exception while
+ finalization.
+
+ * ext/iconv/iconv.c (iconv_s_conv): new method Iconv.conv.
+ [ruby-dev:20588]
+
+Sat Jul 19 03:09:18 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/Win32API/lib/win32/registry.rb (Win32::Registry::Error):
+ inherit StandardError instead of SystemCallError.
+
+Sat Jul 19 02:00:39 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_attr): extra calls of method_added. [ruby-talk:76361]
+
+Fri Jul 18 18:44:22 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/mkmf.rb (init_mkmf): clear $INSTALLFILES. [ruby-dev:20727]
+
+Fri Jul 18 17:34:39 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/mkmf.rb (rm_f): use FileUtils.
+
+ * lib/mkmf.rb (modified?): return mtime of the target if
+ it exists and newer than times.
+
+ * lib/mkmf.rb (install_files): add a current directory
+ file even if it does not exist yet.
+
+ * lib/mkmf.rb (configuration): do not add $LDFLAGS to
+ DLDFLAGS.
+
+ * ext/extmk.rb (extmake): check whether Makefile is newer
+ than depend and MANIFEST.
+
+Fri Jul 18 14:57:19 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (make_cmdvector): recognize quote within string.
+ based on Nobu's patch ([ruby-win32:450]). [ruby-talk:75853]
+
+Fri Jul 18 13:04:36 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_f_missing): VCALL is called only for LOCAL_ID. no
+ check required.
+
+ * parse.y (primary): primary:tFID generates NODE_FCALL.
+ [ruby-dev:20641]
+
+Thu Jul 17 18:50:26 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (match_captures): rename from "groups".
+
+Thu Jul 17 17:57:32 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_clear_cache_by_class): check both klass and origin.
+
+Thu Jul 17 13:46:25 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (ruby_init): set ruby_running to true after
+ initialization.
+
+Thu Jul 17 13:42:53 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/ftools.rb (File::makedirs): do not handle "//" as a directory.
+
+Thu Jul 17 06:40:28 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: recover and fix typo : Tk.chooseDirectory
+ (Tk8.4 feature)
+
+Wed Jul 16 16:23:58 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_proc_new): call svalue_to_avalue for yield argument.
+
+Wed Jul 16 00:31:00 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_disable_super, rb_enable_super): deprecate.
+
+ * eval.c (thgroup_s_alloc): re-implement group struct.
+
+ * eval.c (thgroup_add): add check for enclose and frozen status.
+
+Tue Jul 15 19:50:49 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_add_method, rb_alias): need to clear cache by
+ ID when method defined in parent class is cached for
+ grand child classes. [ruby-dev:20672]
+
+Tue Jul 15 14:38:21 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/matrix.rb: remove elements conversion to_f, to_i, to_r.
+
+ * lib/cgi/session/pstore.rb: add new file.
+
+Tue Jul 15 03:30:41 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/rubyext.c (syck_mark_emitter): forgot to rb_gc_mark the
+ outgoing IO object.
+
+Sun Jul 13 14:55:36 2003 Koji Arai <jca02266@nifty.ne.jp>
+
+ * process.c (proc_getgroups, proc_setmaxgroups): fix typo.
+
+Sat Jul 12 17:01:28 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * struct.c (struct_entry): add prototype to avoid VC++ warnings.
+
+Sat Jul 12 04:43:57 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/emitter.c: new emitter code.
+
+ * ext/syck/rubyext.c: Emitter class.
+
+ * lib/yaml.rb: Load Syck emitter, if available.
+
+ * lib/yaml/stream.rb: ditto.
+
+ * lib/yaml/baseemitter.rb: underlying class for all emitters.
+
+ * lib/yaml/rubytypes.rb: use BaseEmitter abstraction.
+
+ * lib/yaml/emitter.rb: ditto.
+
+Sat Jul 12 04:23:13 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_undef): need to clear cache for inherited class.
+ (rubicon/builtin/TestModulePrivate.rb:test_undef_method)
+
+Sat Jul 12 01:21:54 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (avalue_to_svalue): typo.
+
+ * eval.c (rb_load): rb_prohibit_interrupt must not underflow.
+
+ * parse.y (NODE_STRTERM, tokadd_string, parse_string): moved
+ string nest level from a static variable to NODE_STRTERM, to
+ preserve it from word to word in %W/%w.
+
+Fri Jul 11 22:37:18 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * configure.in (aix): needs ruby.imp even with gcc.
+ (ruby-bugs:PR#1007)
+
+Fri Jul 11 18:37:37 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * instruby.rb: do not handle directories. [ruby-dev:20613]
+
+Fri Jul 11 16:09:09 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * util.c (ruby_strtod): exp should be less than MDMAXEXPT.
+
+Fri Jul 11 07:17:47 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: not create a Tcl/Tk interpreter if already
+ defined TkCore::INTERP
+
+ * ext/tk/lib/tk.rb: bugfix on TkWindow#configure
+
+Thu Jul 10 14:42:02 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * math.c (math_log): nan takes a dummy argument on Cygwin 1.5.0.
+
+Wed Jul 9 23:50:46 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * regex.c (mbctab_sjis): 0x80 is not shift jis first byte.
+ [ruby-dev:20516]
+
+Wed Jul 9 15:38:28 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * instruby.rb: do not install shared libraries as man pages.
+
+ * mkconfig.rb: support text-mount on Cygwin.
+
+Wed Jul 9 11:09:57 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * re.c (match_entry): add prototype to avoid VC++ warnings.
+
+Wed Jul 9 03:48:27 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_load): put rb_load_file() in a thread critical
+ section. [ruby-dev:20490]
+
+ * eval.c (compile): put rb_compile_string() in a thread critical
+ section.
+
+Tue Jul 8 02:35:41 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_const_get_0): should not warn if constant is not
+ defined. (ruby-bugs-ja PR#509)
+
+ * bignum.c (rb_big2dbl): give a warning on overflow.
+ (ruby-bugs-ja PR#510)
+
+ * util.c (ruby_strtod): change MDMAXEXPT from 511 to 308.
+
+ * pack.c (utf8_to_uv): long is sufficient. LONG_LONG is not
+ required.
+
+Tue Jul 8 01:43:16 2003 Koji Arai <jca02266@nifty.ne.jp>
+
+ * bignum.c (rb_big2str): support 32 bit (without `long long' type)
+ machines. (ruby-bugs-ja PR#512)
+
+Mon Jul 7 10:22:46 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/dbm/extconf.rb (gdbm_compat, qdbm): add check for gdbm_compat
+ and qdbm.
+
+Mon Jul 7 01:34:49 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_call_super): k->super maybe NULL if klass is Kernel.
+ [ruby-dev:20519]
+
+ * gc.c (obj_free): clear method cache when freeing class/module.
+
+Sat Jul 5 23:32:06 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_mod_remove_method): allow "remove_method" to accept
+ multiple arguments.
+
+Sat Jul 5 00:22:59 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * node.h (NEW_NODE): cast arguments to rb_node_newnode().
+
+Fri Jul 4 21:48:44 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/syck/rubyext.c, ext/syck/syck.c, ext/syck/syck.h,
+ ext/syck/token.c: C++ style comments are not allowed.
+ (ruby-bugs:PR#1008)
+
+Thu Jul 3 23:41:30 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/timeout.rb: add optional exception argument for compatibility
+ function.
+
+Thu Jul 3 14:22:46 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_values_at): extract common procedure from
+ rb_ary_values_at. follow DRY principle.
+
+ * re.c (match_values_at): values_at should understand ranges.
+
+ * struct.c (rb_struct_values_at): ditto.
+
+ * struct.c (inspect_struct): inspect format changed; add "struct "
+ at the top.
+
+ * sprintf.c (rb_f_sprintf): "%p" specifier for inspect output.
+ (RCR#69)
+
+ * eval.c (rb_mod_undef_method): allow "undef_method" to accept
+ multiple arguments. (RCR#146)
+
+ * lib/timeout.rb: put timeout in Timeout module. (RCR#121)
+ [ruby-talk:61028]
+
+ * re.c (match_groups): new method added. (RCR#139)
+
+ * variable.c (rb_mod_const_of): should exclude constant defined
+ in Object, unless retrieving constants of Object.
+
+Thu Jul 3 12:13:05 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/mkmf.rb (VPATH): convert from Windows form to Unix form on
+ MinGW. This fixes the build with GNU make 3.80-1 for Cygwin.
+
+Wed Jul 2 23:27:34 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_new4): do not allocate new string if original
+ is frozen or already have copy-on-write entry. [ruby-talk:74940]
+
+Wed Jul 2 13:22:39 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_shared_replace): clear flags before copy.
+
+ * string.c (rb_str_replace): ditto.
+
+ * eval.c (rb_yield_0): override visibility mode for module_eval
+ etc. (ruby-bugs-ja PR#505)
+
+Wed Jul 2 11:45:34 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/smtp.rb: synchronize document with source code.
+
+ * lib/net/pop.rb: ditto.
+
+Wed Jul 2 11:39:50 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/smtp.rb: unify SMTP and SMTPCommand.
+
+ * lib/net/smtp.rb: new exception class SMTPError.
+
+ * lib/net/smtp.rb: new exception class SMTPAuthenticationError.
+
+ * lib/net/smtp.rb: new exception class SMTPServerBusy.
+
+ * lib/net/smtp.rb: new exception class SMTPSyntaxError.
+
+ * lib/net/smtp.rb: new exception class SMTPFatalError.
+
+ * lib/net/smtp.rb: new exception class SMTPUnknownError.
+
+ * lib/net/smtp.rb: change critical section protect algorithm.
+
+ * lib/net/smtp.rb (SMTP#do_start): check authentication args
+ before all.
+
+ * lib/net/smtp.rb: new method send_message (alias send_mail).
+
+ * lib/net/smtp.rb: new method open_message_stream (alias ready).
+
+ * lib/net/pop.rb: POPBadResponse is a POPError.
+
+ * lib/net/pop.rb (POPMail#pop): ban ReadAdapter.
+
+ * lib/net/pop.rb (POPMail#top): ditto.
+
+ * lib/net/pop.rb (POP3Command): change critical section protect
+ algorithm.
+
+ * lib/net/pop.rb (POP3Command#auth): USER and PASS should be one
+ critical block.
+
+ * lib/net/pop.rb (POP3Command#retr): ban `dest' argument using
+ iterator.
+
+ * lib/net/pop.rb (POP3Command#top): ditto.
+
+ * lib/net/protocol.rb: #read_message_to -> #each_message_chunk
+
+ * lib/net/protocol.rb: #D -> #LOG
+
+ * lib/net/protocol.rb: #D_off -> #LOG_off
+
+ * lib/net/protocol.rb: #D_on -> #LOG_on
+
+Wed Jul 2 11:10:47 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb: set old class aliases for backward
+ compatibility. [ruby-talk:74863]
+
+ * lib/net/protocol.rb: ditto.
+
+Wed Jul 2 01:32:40 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/net/pop.rb (Net::POP3#start): typofix.
+
+Tue Jul 1 22:08:19 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: TkWindow include TkWinfo
+
+ * ext/tk/lib/tk.rb: treat unknown widget classes as subclasses
+ of TkWindow
+
+Tue Jul 1 19:02:12 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * parse.y (rb_intern): should use mbclen instead of mblen.
+
+Tue Jul 1 10:36:19 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * class.c (rb_define_class, rb_define_module): also set constant under
+ Object. [ruby-dev:20445]
+
+ * object.c (boot_defclass): ditto.
+
+ * variable.c (rb_const_get_at, rb_const_get_0, rb_mod_const_at,
+ rb_const_defined, mod_av_set, rb_const_assign): toplevel constants
+ are now under Object, rb_class_tbl remains for GC.
+
+Mon Jun 30 17:53:06 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (mnew): ignore metaclasses have no influence, for rklass.
+ [ruby-talk:74706]
+
+Sun Jun 29 06:59:07 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/drb/drb.rb, lib/drb/invokemethod.rb: import drb-2.0.4
+ (use LocalJumpError#reason)
+
+Sat Jun 28 12:28:54 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * configure.in (rb_cv_stack_grow_dir): check stack growing direction.
+
+ * eval.c (rb_thread_restore_context): prior configuration macro.
+
+ * gc.c (ruby_stack_length): always return the address of lower edge.
+
+ * gc.c (rb_gc_mark_locations): remove margin. [ruby-dev:20462]
+
+ * gc.c (rb_gc, Init_stack): prior configuration macro.
+
+ * gc.c (Init_stack): add safety margin.
+
+Fri Jun 27 14:41:22 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * string.c (rb_str_split_m): remove white spaces on the head of
+ the last element, when limit is specified. [ruby-talk:74506]
+
+Fri Jun 27 03:24:54 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * io.c (io_fflush): need to check if closed after thread switch.
+ [ruby-dev:20351]
+
+ * io.c (fptr_finalize): ditto.
+
+ * string.c (rb_str_rindex_m): fixed wrong fix. should move backward
+ first only when matching from the end.
+
+Thu Jun 26 21:34:49 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * class.c (class_instance_method_list): get rid of warning about
+ arguement type mismatch, and inline method_list().
+ [ruby-core:01198]
+
+Wed Jun 25 14:40:33 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: add and modify methods ---
+ TkWidget.database_class, TkWidget.database_classname,
+ TkWidget#database_class, TkWidget#database_classname
+
+ * ext/tk/lib/tk.rb: instances of a subclass of TkToplevel or
+ TkFrame are created with ":class=>subclass" option as default.
+
+ * ext/tk/sample/tkoptdb.rb: add a new part
+
+Wed Jun 25 12:52:58 2003 Matthew Dempsky <jivera@flame.org>
+
+ * class.c (rb_generic_class_instance_methods): merge argument
+ check (and warning) into one function; following DRY principle.
+ [ruby-core:01193]
+
+Wed Jun 25 05:49:10 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: add widget destroy hook binding to TkBindTag::ALL
+
+ * ext/tk/lib/tkcanvas.rb: Although requiring manual control of GC,
+ memory eating problem of TkCanvas Items is fixed.
+
+ * ext/tk/lib/tktext.rb: add some methods and bug fix
+
+Wed Jun 25 00:14:30 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (autoload_delete): should delete Qundef from iv_tbl.
+ (ruby-bugs-ja PR#504)
+
+Tue Jun 24 16:46:07 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: bug fix on TkToplevel, TkFrame,
+ TkPanedwindow, TkOptionDB
+
+ * ext/tk/lib/tk.rb: TkOptionDB --- make it more secure to use procs
+ defined on resourceDB
+
+ * ext/tk/sample/tkoptdb.rb, resource.ja, resource.en:
+ sample script how to use TkOptionDB.
+
+Tue Jun 24 14:22:41 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * lib/yaml/types.rb: replaced Kernel::Hash reference with Object::Hash
+ from [ruby-talk:74270]
+
+Tue Jun 24 17:59:30 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_yield_0): show yielded block position not only yielding
+ point. [ruby-dev:20441]
+
+Tue Jun 24 16:47:07 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb (HTTPHeader#proxy_basic_auth): missing `@'.
+ Thanks Douglas Koszerek. (ruby-bugs:PR975)
+
+Tue Jun 24 14:31:17 2003 Minero Aoki <aamine@loveruby.net>
+
+ * config.guess: have wrongly returned "alphaev56-unknown-linux-"
+ on Linux/Alpha. [ruby-dev:20434]
+
+Tue Jun 24 04:54:46 2003 Minero Aoki <aamine@loveruby.net>
+
+ * configure.in: always add -mieee for gcc/alpha. [ruby-dev:20429]
+
+Tue Jun 24 02:40:09 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * array.c (rb_ary_unshift_m): need to check number of arguments.
+ [ruby-talk:74189]
+
+Mon Jun 23 23:59:56 2003 Minero Aoki <aamine@loveruby.net>
+
+ * io.c (io_close): missing prototype. [ruby-dev:20422]
+
+ * ext/socket/socket.c (bsock_do_not_rev_lookup_set): ditto.
+
+ * ext/win32ole/win32ole.c (foletype_guid, foletype_progid): ditto.
+
+ * error.c (syserr_initialize): length argument of sprintf() is an
+ int.
+
+Mon Jun 23 23:28:14 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * MANIFEST: add wince files.
+
+ * ext/tk/MANIFEST: add sample/tkmenubutton.rb.
+
+Mon Jun 23 17:40:58 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * dir.c (find_dirsep): get rid of warnings.
+
+ * eval.c (error_print): temporary value might be disposed by GC.
+
+ * hash.c (env_has_value, env_index): should not increment NULL.
+
+ * io.c (io_read, rb_io_sysread): not read when length is 0.
+
+ * io.c (rb_io_reopen): ensure initialized IO.
+
+ * io.c (rb_io_init_copy): sychronize file pointer.
+
+ * io.c (rb_io_s_pipe): make exception proof.
+
+ * string.c (rb_str_rindex_m): Fixnum 0 matched end of string.
+
+Mon Jun 23 16:18:12 2003 Tanaka Akira <akr@m17n.org>
+
+ * io.c (rb_open_file): initialize flags.
+
+ * time.c (time_arg): initialize v[6] even when argc is 10 to
+ avoid valgrind error.
+
+Mon Jun 23 14:22:44 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: bug fix on TkRoot and TkToplevel
+
+Mon Jun 23 08:24:01 2003 Florian Frank <flori@nixe.ping.de>
+
+ * string.c (rb_str_upto): generate sequence according to "succ"
+ order. formerly check was done by dictionary order.
+ [ruby-talk:74138]
+
+Mon Jun 23 00:27:32 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_string_value): fill constant empty string along
+ with setting ELTS_SHARED if str->ptr is NULL. [ruby-core:01179]
+
+ * string.c (rb_string_value_ptr): ditto.
+
+ * string.c (rb_check_string_type): ditto.
+
+Sun Jun 22 23:42:20 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * string.c (str_gsub): move END(0) check before mbclen2().
+
+ * string.c (scan_once): reduce END(0) check.
+
+ * io.c (rb_io_initialize): accept fixnum mode.
+
+ * eval.c (error_print): replace strchr() by memchr(), einfo may
+ contain "\0".
+
+ * pack.c (pack_unpack): range check for "@" move; initialize check
+ for "m".
+
+ * error.c (syserr_initialize): avoid buffer overflow.
+
+ * file.c (rb_file_s_readlink): expand buffer until readlink
+ succeed.
+
+Sun Jun 22 16:17:02 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: TkRoot.new and TkToplevel.new accept Wm
+ commands as elements
+
+ * ext/tk/lib/tk.rb: TkMenu --- add some methods
+
+ * ext/tk/lib/tk.rb: TkOptionMenubutton --- bug fix
+
+ * ext/tk/sample/tkmenubutton.rb: sample of TkMenubutton and
+ TkOptionMenubutton
+
+Sat Jun 21 23:15:08 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (proc_invoke): should not propagate distination tag if
+ tag is already handled in this level. (ruby-bugs-ja PR#501)
+
+ * object.c (str_to_id): check for empty string before intern.
+ [ruby-talk:74006]
+
+Sat Jun 21 13:56:09 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+
+ * wince/Makefile.sub: undefine HAVE__SETJMP.
+
+ * wince/resource.rb: include winver.h in wince3.0.
+
+Sat Jun 21 12:55:17 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: TkRoot.new and TkToplevel.new accept Wm commands
+ as elements of a hash argument.
+
+ * ext/tk/sample/tktimer2.rb: add comments about the usage of a
+ TkTimer object.
+
+Sat Jun 21 08:47:22 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk*.rb: remove direct-accesses to TkComm::INTERP and
+ TkComm::INITIALIZE_TARGETS
+
+ * ext/tk/lib/tk*.rb: use TkINTERP_SETUP_SCRIPTS constant for setting
+ up the interpreter
+
+ * ext/tcltklib/tcltklib.c: support to create a safe interpreter
+ with safe-Tk
+
+Fri Jun 20 23:28:27 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (proc_invoke): should not propagate TAG_BREAK and
+ TAG_RETURN from orphan Proc object. [ruby-core:01148]
+
+Fri Jun 20 15:04:28 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * defines.h (PATH_ENV): name of PATH environment. [new].
+
+ * defines.h (ENV_IGNORECASE): define for case insensitive platforms
+ to access environment variables.
+
+ * dln.c (dln_find_exe): use PATH_ENV instead of "PATH".
+
+ * hash.c (env_delete, rb_f_getenv, env_fetch, rb_env_path_tainted,
+ env_aset): ditto.
+
+ * ruby.c (proc_options): ditto.
+
+Fri Jun 20 14:52:46 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c: Tk interpreter returns TAINTED strings.
+
+Fri Jun 20 03:09:21 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (new_yield): distinguish "yield 1,2" and "yield [1,2]".
+ [ruby-dev:20360]
+
+ * eval.c (rb_eval): support new_yield() change.
+
+ * variable.c (rb_const_get_0): warn for Foo::BAR when BAR is a
+ toplevel constant (i.e. a constant defined under Object).
+ [ruby-list:36935]
+
+ * parse.y (no_blockarg): separate no block argument check and
+ ret_args argument processing.
+
+Fri Jun 20 00:45:19 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/csv.rb: import csv module.
+
+Thu Jun 19 22:51:41 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/drb.rb, lib/drb/drb.rb, lib/drb/eq.rb,
+ lib/drb/extserv.rb, lib/drb/extservm.rb, lib/drb/gw.rb,
+ lib/drb/invokemethod.rb, lib/drb/observer.rb,
+ lib/drb/timeridconv.rb, lib/drb/unix.rb: import drb-2.0.4b3
+
+Thu Jun 19 16:14:43 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c (lib_do_one_event): change default
+ value of the argument
+
+ * ext/tcltklib/tcltklib.c (lib_do_one_event): returns true/false
+
+ * ext/tcltklib/tcltklib.c: add TclTkLib::EventFlag::NONE ( == 0 )
+
+ * ext/tcltklib/tcltklib.c: add set_no_event_wait() and
+ get_no_event_wait()
+
+ * ext/tcltklib/MANUAL.euc: modify
+
+ * ext/tcltklib/README.euc: ditto
+
+ * ext/tk/lib/tk.rb: change default value of TkCore.do_one_event
+ argument
+
+ * ext/tk/lib/tk.rb: add TkCore.set_no_event_wait(wait) and
+ TkCore.get_no_event_wait
+
+ * ext/tk/lib/tk.rb: add Tk.exit ( == destroy root widget )
+
+ * ext/tk/lib/tkafter.rb: rename TkAfter => TkTimer (TkAfter is
+ an alias name)
+
+ * ext/tk/lib/tkafter.rb: set_callback returns self
+
+ * ext/tk/lib/tkafter.rb: continue() raises an exception, if already
+ running or no procedure.
+
+ * ext/tk/lib/tkafter.rb: skip() raises an exception, if not running.
+
+ * ext/tk/sample/tktimer2.rb: new sample for TkTimer class.
+
+Thu Jun 19 16:13:54 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * rubytest.rb: add library path to include standard libraries.
+
+Thu Jun 19 13:13:10 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * hash.c (env_delete, rb_f_getenv, env_fetch): case insensitive to
+ access environment variables on DOSISH platforms.
+
+Thu Jun 19 00:51:47 2003 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
+
+ * range.c (rb_range_beg_len): out_of_range check after adjusting
+ end point. [ruby-dev:20370]
+
+Wed Jun 18 23:59:11 2003 Guy Decoux <ts@moulon.inra.fr>
+
+ * parse.y (call_args): the first argument to arg_cancat() should
+ be NODE_LIST. [ruby-core:01151]
+
+Wed Jun 18 23:41:27 2003 Marc Cartright <marc@isri.unlv.edu>
+
+ * ext/zlib/zlib.c (zstream_run): In a particular situation,
+ deflate/inflate will return Z_BUF_ERROR, even though another call
+ is required by the zlib library.
+
+Wed Jun 18 19:46:21 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: bug fix
+
+ * ext/tk/lib/tk.rb: rename 'no_create' option to 'without_creating'
+
+ * ext/tk/lib/tk.rb: add TkWindow#pack_in, TkWindow#grid_in,
+ TkWindow#place_in
+
+ * ext/tk/lib/tk.rb: add TkWindow#bind_class and TkWindow#database_class
+
+ * ext/tk/lib/tk.rb: add TkBindTag.new_by_name and TkDatabaseClass
+ for binding to database class
+
+ * ext/tk/lib/tk.rb: check varname whether already exsist or not.
+ (TkVarAccess.new)
+
+ * ext/tk/lib/tk.rb: TkTextWin#bbox returns an array of four numbers
+
+ * ext/tk/lib/tk.rb: autoload TkDialog2, TkWarning2
+
+ * ext/tk/lib/tk.rb: scan event callback arguments and convert
+ to proper type
+
+ * ext/tk/lib/tk.rb: TkBindTag.new accepts a block
+
+ * ext/tk/lib/tk.rb: If given taglist, TkWindow#bindtags(taglist)
+ returns taglist
+
+ * ext/tk/lib/tk.rb: add TkWindow#bindtags=(taglist)
+
+ * ext/tk/lib/tk.rb: Tk.focue and Tk.focus_lastfor return nil
+ if there is no target widget.
+
+ * ext/tk/lib/tk.rb: Tk::Wm.client returns the argument string
+ when setting name
+
+ * ext/tk/lib/tk.rb: TkGrid.columnconfiginfo and rowconfiginfo
+ given a slot return a number.
+
+ * ext/tk/lib/tk.rb: TkWindow.grid_columnconfiginfo and
+ grid_rowconfiginfo --- ditto
+
+ * ext/tk/lib/tk.rb: rename and define alias :: TkOption ==> TkOptionDB
+
+ * ext/tk/lib/tk.rb: define alias :: TkTimer ==> TkAfter
+
+ * ext/tk/lib/tk.rb: some instance methods change from public to private
+
+ * ext/tk/lib/tk.rb: some TkComm methods change to module functions
+
+ * ext/tk/lib/tk.rb: add support for -displayof option to some
+ TkWinfo methods
+
+ * ext/tk/lib/tk.rb: bind, bind_append and bind_remove ---
+ returns the target of event-binding
+
+ * ext/tk/lib/tk.rb: add Tk8.4 features
+
+ * ext/tk/lib/tk.rb: add TkPaneWindow
+
+ * ext/tk/lib/tkdialog.rb: bug fix
+
+ * ext/tk/lib/tkdialog.rb: some methods return self
+
+ * ext/tk/lib/tkdialog.rb: add TkTextMark#+(mod) and TkTextMark#-(mod)
+
+ * ext/tk/lib/tkdialog.rb: add some methods
+
+ * ext/tk/lib/tkcanvas.rb: bug fix and some methods return self
+
+ * ext/tk/lib/tkentry.rb: some methods return self
+
+ * ext/tk/lib/tkentry.rb: TkEntry#bbox returns an array of four numbers
+
+ * ext/tk/lib/tkentry.rb: scan validatecommand arguments and
+ convert to proper type
+
+ * ext/tk/lib/tkbgerror.rb: support to define a error handler by user
+
+ * ext/tcltklib/tcltklib.c: [ruby-talk:60759]
+
+Wed Jun 18 13:50:06 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): should dispatch based on ID type.
+
+Wed Jun 18 12:53:42 2003 Minero Aoki <aamine@loveruby.net>
+
+ * eval.c (rb_yield_0): should restore scope_vmode during yield.
+ [ruby-dev:20361]
+
+Wed Jun 18 01:13:36 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/rubyext.c (rb_syck_load_handler): merge key implemented.
+
+ * ext/syck/rubyext.c (transfer_find_i): removed use of String#=~ in favor
+ of Regexp#match.
+
+ * lib/yaml.rb: YAML::try_implicit returns.
+
+ * lib/yaml/rubytypes.rb: Regexps added for type matching.
+
+ * lib/yaml/emitter.rb: fix String + nil error.
+
+Tue Jun 17 17:01:08 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/gram.c: added grammar for certain empty sequence entries.
+
+ * ext/syck/handler.c, ext/syck/syck.c, ext/syck/syck.h: track bad anchors.
+
+ * ext/syck/token.c: added pause token, tag possible circular references.
+
+ * lib/yaml/rubytypes.rb: parsing YMD time as Date instance.
+
+ * ext/syck/rubyext.c: ditto. DomainType, PrivateType, BadAlias classes.
+
+Tue Jun 17 21:28:27 2003 Ariff Abdullah <skywizard@time.net.my>
+
+ * win32/win32.c (rb_w32_opendir): need to set errno. [ruby-talk:73761]
+
+Mon Jun 16 19:01:25 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c: remove rb_cBlock.
+
+Mon Jun 16 18:06:33 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * numeric.c (rb_fix2uint): renamed from rb_fix2int on IA64.
+
+Mon Jun 16 17:02:57 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (proc_invoke): format the message for localjump_error().
+
+Mon Jun 16 16:23:56 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/dl/dl.c (rb_dl_callback): use rb_block_proc() instead of
+ rb_block_new().
+
+ * ext/win32ole/win32ole.c (ev_on_event): ditto.
+
+Mon Jun 16 16:06:47 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (proc_alloc): re-unification of Block and Proc. Block
+ class is no longer available.
+
+Mon Jun 16 14:43:14 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * bcc32/Makefile.sub: undefine HAVE_GETGROUPS.
+
+Sat Jun 14 16:58:41 2003 Guy Decoux <ts@moulon.inra.fr>
+
+ * regex.c (calculate_must_string): should handle option_set
+ properly. [ruby-talk:73481]
+
+ * regex.c (re_compile_fastmap): a bug in flag manipulation.
+ [ruby-talk:73549]
+
+Sat Jun 14 17:59:59 2003 Guy Decoux <ts@moulon.inra.fr>
+
+ * eval.c (method_arity): should handle NODE_BMETHOD and
+ NODE_DMETHOD. [ruby-core:01138]
+
+Fri Jun 13 09:24:39 2003 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/ftp.rb (storebinary): seek correctly. Thanks, William Webber.
+
+ * lib/net/ftp.rb (putbinaryfile): rescue FTPPermError.
+
+Thu Jun 12 22:13:13 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb : add 'no_create' option to widget
+ initialize method.
+
+ * ext/tk/MANIFEST : forgot to commit when added tkmacpkg.rb
+ and tkwinpkg.rb
+
+ * ext/tk/lib/README : ditto.
+
+Thu Jun 12 21:14:11 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb : widget configure returns self (for method
+ call chain)
+
+ * ext/tk/lib/tkmacpkg.rb : Mac resource (not new but not
+ included until now)
+
+ * ext/tk/lib/tkwinpkg.rb : Win DDE and registry (not new but not
+ included until now)
+
+Tue Jun 10 14:26:30 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/token.c: preserve newlines prepended to a block.
+
+ * ext/syck/implicit.c (syck_match_implicit): added !merge and !default.
+
+ * lib/yaml/constants.rb: remove '\z' escape.
+
+ * lib/yaml/emitter.rb: ensure reset of @seq_map shortcut flag.
+
+ * lib/yaml/encoding.rb: remove Unicode translation methods.
+
+ * lib/yaml/rubytypes.rb: improved round-tripping of Strings.
+ [ruby-core:1134]
+
+Tue Jun 10 01:07:54 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/irb.rb (IRB::Irb::eval_input): warn and exit if $SAFE >=3
+ after input evaluation.
+
+ * lib/irb.rb (IRB::Irb::eval_input): untaint input string. now
+ irb works for levels 1 and 2.
+
+Mon Jun 9 19:02:33 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * configure.in: checks presence of grp.h and setgroups().
+
+ * process.c (proc_getgroups, proc_setgroups): raise
+ NotImplementedError unless available. [ruby-talk:73014]
+
+Mon Jun 9 18:09:11 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c: fixed 100% CPU problem of Tk.mainloop
+
+Mon Jun 9 15:50:24 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c: renewal Tk.mainloop
+
+Sun Jun 8 13:37:21 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+
+ * wince/setup.mak: set SUBSYSTEM in each platform.
+
+ * wince/stdlib.c: fix mblen() bug.
+
+Sat Jun 7 22:22:03 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/syck/rubyext.c (syck_loader_transfer): should not use
+ rb_cProc directly, since type_proc may be Proc, Block, or
+ Method.
+
+ * parse.y (value_expr0): class and module statements should not be
+ warned for "void value expression". [ruby-talk:72989]
+
+Sat Jun 7 01:46:41 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (add_final): should determine type by respond_to?
+
+ * gc.c (define_final): ditto.
+
+ * io.c (rb_io_ctl): should not depend on respond_to?
+
+ * range.c (range_step): rb_check_string_type().
+
+Fri Jun 6 20:29:14 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (error_print): needs to be exception proof.
+
+ * eval.c (error_handle, rb_longjmp): bails out when exception
+ reentered. (ruby-bugs-ja:PR#487), [ruby-core:01119],
+ [ruby-core:01122]
+
+ * eval.c (Init_Proc): pre-allocates critical error objects.
+
+Fri Jun 6 20:29:14 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (cmd_brace_block, do_block, brace_block): initialize block
+ variables at the beginning of the block. [ruby-talk:72521]
+
+Fri Jun 6 18:49:11 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * process.c (proc_setgroups): new functions.
+
+Fri Jun 6 18:33:27 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (define_final): eliminate rb_f_lambda() call.
+
+ * class.c (rb_scan_args): ditto.
+
+ * signal.c (sig_trap): ditto.
+
+ * hash.c (rb_hash_initialize): ditto.
+
+ * variable.c (rb_f_trace_var): ditto.
+
+ * ext/dl/dl.c (rb_dl_callback): ditto.
+
+ * ext/win32ole/win32ole.c (ev_on_event): ditto.
+
+Fri Jun 6 16:10:01 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb: define Net::HTTPResponse#to_ary for backward
+ compatibility. [ruby-talk:72927]
+
+ * lib/net/protocol.rb: add warning.
+
+Fri Jun 6 13:30:57 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (ruby_cleanup): $SAFE is turned off in the finalization.
+ Each END proc should preserve its own $SAFE level. [ruby-core:01119]
+
+ * marshal.c (marshal_load): remove unused variable "hash".
+ [ruby-core:01120]
+
+ * hash.c (env_str_new): freeze strings from ENV. [ruby-talk:72860]
+
+ * array.c (rb_ary_first): optional argument to retrieve first n
+ elements.
+
+ * array.c (rb_ary_last): optional argument to retrieve last n
+ elements.
+
+Thu Jun 5 21:31:55 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+
+ * wince/stdlib.c: add mblen().
+
+Thu Jun 5 18:33:46 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/curses/curses.c (window_s_allocate,curses_finalize):
+ avoid VC++ warnings.
+
+Thu Jun 5 17:44:11 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/rubyext.c (syck_parser_mark): was a bit heavy on the GC.
+
+ * lib/yaml.rb (YAML::transfer): added.
+
+Thu Jun 5 16:11:50 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * bcc32/Makefile.sub, win32/Makefile.sub, wince/Makefile.sub
+ (MISSING): link with missing/erf.c.
+
+ * missing.h (erf, erfc): fix prototype.
+
+ * missing/erf.c: new. [ruby-list:37753]
+
+Thu Jun 5 15:09:06 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * math.c (math_erf,math_erfc): new function. [ruby-list:37753]
+
+Thu Jun 5 14:49:43 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/rubyext.c: using GC nodes caused segfault. [ruby-core:1071]
+
+Thu Jun 5 13:48:57 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/token.c: directives choked on a period.
+
+ * ext/syck/gram.y: anchors work above a collection. [ruby-core:1071]
+
+ * ext/syck/handler.c, ext/syck/syck.c: ensure a fresh strtable between
+ parser iterations.
+
+Wed Jun 4 12:06:59 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (ruby_finalize): no longer need to turn off $DEBUG in the
+ finalizer. (ruby-bugs-ja PR#473)
+
+Tue Jun 3 22:20:49 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_call_super): should search superclass method based on
+ orig_func, not last_func.
+
+Tue Jun 3 09:59:27 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_call_super): inheritance line adjustment moved from
+ rb_call(). [ruby-core:01113]
+
+ * eval.c (rb_eval): use rb_call_super() to follow DRY principle.
+
+Mon Jun 2 02:20:52 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (push_values_at): Array#values_at should work with
+ ranges too.
+
+ * range.c (rb_range_beg_len): length calculation was wrong.
+
+ * eval.c (rb_call): should set T_ICLASS in the frame->last_class.
+ [ruby-core:01110]
+
+Sun Jun 1 21:50:01 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: should not use def file, use ld with
+ --export-all-symbols option on Cygwin/MinGW.
+
+ * defines.h: ditto.
+
+ * cygwin/GNUmakefile.in: ditto.
+
+ * ext/digest/defs.h: avoid warnings on Cygwin.
+
+Sun Jun 01 13:33:49 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+
+ * wince/string_wce.c: add strpbrk() for hpcpro support.
+
+ * wince/setup.mak: add hpcpro(CE2.11) & armv4t(CE.NET) support.
+
+ * wince/resource.rb: ditto.
+
+ * wince/Makefile.sub: ditto.
+
+Sun Jun 1 10:38:28 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * variable.c (rb_autoload_load): autoloaded constants under a module
+ belong to the module. [ruby-core:01094], [ruby-dev:20309]
+
+Sat May 31 04:36:54 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (rb_intern): should handle multibyte name.
+
+Fri May 30 23:18:01 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/rubyext.c (rb_syck_mktime): seconds calculated wrong.
+
+ * ext/syck/gram.c: flexibility to anchors and transfer methods on
+ collections.
+
+ * ext/syck/token.c: hex escapes.
+
+ * lib/yaml/basenode.rb: YamlNode references changed to YAML::BaseNode.
+
+Fri May 30 22:28:04 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * numeric.c (rb_num2uint, rb_fix2int): new function to convert
+ values over INT_MAX. [ruby-core:01099]
+
+ * ruby.h (NUM2UINT, FIX2INT): ditto.
+
+Fri May 30 15:01:05 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/token.c: preserve any indentation past an explicit
+ indentation.
+
+Fri May 30 14:55:44 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_Array): exclude Kernel#to_a instead of Object#to_a.
+ (ruby-bugs-ja:PR#483)
+
+ * lib/optparse.rb (OptionParser::Switch#parse_arg): not splat.
+
+ * lib/optparse.rb (OptionParser::Switch#conv_arg): splat if no
+ conversion supplied.
+
+ * lib/optparse.rb (OptionParser::Switch::PlacedArgument#parse):
+ override next switch after argument conversion.
+
+Fri May 30 14:41:34 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/handler.c, ext/syck/syck.h: removed syck_fold_format().
+
+ * ext/syck/gram.c: flexibility for aliases and anchors.
+
+ * ext/syck/token.c: folding now handled in the tokenizer.
+
+Fri May 30 06:21:18 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * variable.c (rb_autoload_load): should delete autoloaded
+ symbol itself before load. [ruby-core:01097]
+
+ * variable.c (rb_mod_remove_const): must not return Qundef.
+
+Thu May 29 14:59:10 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * win32/win32.c (_CRTIMP): redefine _CRTIMP on MinGW.
+
+ * configure.in: remove '-D__USE_CRTIMP' from XCFLAGS on MinGW.
+
+ * win32/win32.c (NtMakeCmdVector): handle quotes only if not instring.
+
+Thu May 29 09:11:01 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (ev_const_defined, ev_const_get), variable.c
+ (rb_const_get_at, rb_const_get, rb_mod_remove_const): use Qundef
+ as autoload marker. [ruby-dev:18103], [ruby-dev:18184]
+
+ * eval.c (rb_mod_autoload, rb_mod_autoload_p): new method;
+ Module#autoload, Module#autoload?.
+
+ * variable.c (rb_autoload, rb_autoload_load, rb_autoload_p):
+ manage autoload constants per classes/modules.
+
+ * variable.c (rb_const_defined_at, rb_const_defined): return false
+ for autoloading constants.
+
+ * class.c (rb_define_class, rb_define_module), eval.c (rb_eval),
+ variable.c (rb_mod_const_at, rb_const_assign): removed autoload
+ stuff.
+
+ * intern.h: prototypes; rb_autoload, rb_autoload_load,
+ rb_autoload_p.
+
+ * lib/optparse.rb (OptionParser::Switch::PlacedArgument::parse):
+ do not treat unmatched argument as an option.
+
+Wed May 28 08:44:26 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_f_syscall): type dispatch should be based on
+ rb_check_string_type(), not FIXNUM_P(), because values may be a
+ bignum. [ruby-talk:72257]
+
+Tue May 27 20:33:18 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c, util.c: removed duplicated includes/defines.
+
+ * ext/socket/socket.c (sock_addrinfo): get rid of SEGV at NULL ptr
+ String. increase buffer size for 64bit platforms.
+
+Tue May 27 02:34:14 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_call0): should pass the current klass value to
+ block_invoke, which may be called via "super". [ruby-core:01077]
+
+ * eval.c (block_invoke): now takes 4th argument "klass".
+
+ * eval.c (block_alloc): should propagate BLOCK_PROC to
+ ruby_block.
+
+Mon May 26 23:51:38 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (r_object0): should not use "yield" method, use "call"
+ instead. (ruby-bugs-ja PR#476)
+
+Mon May 26 21:39:46 2003 MoonWolf <moonwolf@moonwolf.com>
+
+ * lib/mkmf.rb, lib/optparse.rb, lib/tracer.rb: use Method#to_block
+ instead of deprecated Method#to_proc. (ruby-bugs-ja:PR#477)
+
+Mon May 26 21:21:20 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/optparse.rb (OptionParser::Switch::parse,
+ OptionParser::order): use {Block,Proc}#call instead of deprecated
+ #yield.
+
+Mon May 26 16:39:10 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (Init_Proc): Block/Proc separation. [huge change]
+
+ * eval.c (block_arity): returns exact arity number for Procs out
+ of methods. also gives 1 for {|a|..}.
+
+ * string.c (rb_str_match): revert use of String#index for
+ invocation like string =~ string.
+
+ * eval.c (rb_Array): move Object#to_a exclusion hack from
+ splat_value(). need to be in eval.c for a while.
+
+Sun May 25 23:48:21 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * bignum.c (rb_quad_pack): should negate negative bignum.
+ (ruby-bugs-ja:PR#474)
+
+Sun May 25 03:27:25 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/smtp.rb: support LOGIN authentication, based on
+ the patch by Kazuhiko Izawa. [ruby-talk:78981]
+
+Sat May 24 18:19:51 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+
+ * wince/Makefile.sub: add eMbedded Visual C++ 4.0 support.
+
+ * wince/resource.rb: ditto.
+
+ * wince/setup.mak: ditto.
+
+ * wince/configure.bat: ditto.
+
+ * wince/mkexports.rb: delete japanese comments.
+
+Fri May 23 18:34:05 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_longjmp): get rid of reentering while debug warning.
+ (ruby-bugs-ja:PR473)
+
+Fri May 23 15:16:16 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * pack.c (pack_unpack): sign-extend if sizeof long is bigger than
+ 32. (ruby-bugs-ja:PR#472)
+
+Fri May 23 14:19:29 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (ruby_finalize): turn off ruby_debug flag before calling
+ at_exit procs and finalizers. (ruby-bugs-ja:PR473)
+
+ * ext/tcltklib/tcltklib.c (lib_mainloop_core): OK to block if
+ there's no other thread. (ruby-bugs:PR#861)
+
+Thu May 22 18:07:46 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/token.c: single- and double-quoted root-level fix.
+
+ * lib/yaml.rb (YAML::object_maker): can create object attributes (such as
+ found in Exception class)
+
+ * lib/yaml/rubytypes.rb: roundtripping of Exception and subclasses.
+
+Fri May 23 01:26:26 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_obj_clone): defer copying freezing state after
+ calling initialize_copy(). [ruby-dev:20276]
+
+Thu May 22 17:12:10 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (run_final): use rb_thread_critical instead of DEFER_INTS.
+ [ruby-dev:20272]
+
+ * marshal.c: try to make ArgumentError and TypeError consistent.
+ [ruby-core:01068]
+
+Thu May 22 15:46:37 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_define_alloc_func): need not to disable
+ rb_call_super() for allocation functions. [ruby-core:1065]
+
+Thu May 22 06:21:33 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/rubyext.c (rb_syck_err_handler): raise ArgumentError on
+ malformed YAML.
+
+ * lib/yaml/rubytypes.rb: String#to_yaml was missing space indicators at
+ the end of a line.
+
+Thu May 22 05:43:24 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/rubyext.c (syck_parser_load): root-level false was returning
+ nil.
+
+ * ext/syck/token.c: root-level transfer method bug.
+
+ * ext/syck/gram.c: root-level empty gave a parse error.
+
+ * lib/yaml/rubytypes.rb: Symbol#to_yaml generating method call error.
+
+Thu May 22 02:46:38 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_eval): splat NODE_RESTARY. [ruby-dev:20268]
+
+ * eval.c (rb_thread_fd_close): raise for writing threads.
+ [ruby-dev:20269]
+
+ * io.c (rb_io_close, io_reopen): ditto.
+
+ * io.c (io_reopen): keep stdio objects for stdin, stdout,
+ and stderr. [ruby-dev:19442]
+
+Thu May 22 01:11:15 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (strings, word_list): must create new instance always.
+ http://yowaken.dip.jp/tdiary/20030521.html#p02
+
+ * parse.y (yylex): slight optimization.
+
+Wed May 21 23:07:08 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * error.c (rb_sys_fail): should not specify errno explicitly.
+ [ruby-dev:20264]
+
+Wed May 21 20:51:47 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * Makefile.in, bcc32/Makefile.sub, win32/Makefile.sub,
+ wince/Makefile.sub: update dependencies.
+
+Wed May 21 17:44:16 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * error.c (syserr_initialize): prohibit specifying errno for
+ subclasses of SystemCallError. in addition, if initialize is
+ called for SystenCallError instance, its class be changed.
+ [ruby-dev:20257]
+
+ * gc.c (run_final): to protect thread context switch, finalizers
+ are wrapped in DEFER_INTS/ENABLE_INTS.
+
+Wed May 21 13:26:08 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/optparse.rb: get rid of warnings.
+
+Tue May 20 18:59:54 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_save_context): prohibit rb_gc_force_recycle()
+ on thread saved ruby_dyna_vars. [ruby-dev:20236]
+
+Tue May 20 17:39:15 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (init_copy): call initialize_copy at the end of copy
+ process.
+
+Tue May 20 17:15:55 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * error.c (syserr_initialize): use Errno constants as default
+ errno for subclasses. [ruby-dev:20241]
+
+Tue May 20 15:26:25 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * st.h: define ST_DATA_T_DEFINED for portability.
+
+ * ext/syck/syck.h: add typedef, st_data_t for Ruby 1.6.
+
+ * ext/syck/syck.c (syck_st_free_nodes): return int.
+
+ * ext/syck/syck.c (syck_add_sym): cast the data to st_data_t
+ to avoid error on bcc32.
+
+ * ext/syck/syck.c (syck_lookup_sym): ditto.
+
+ * ext/syck/syck.c (syck_free_parser): NULL is not integer.
+
+Tue May 20 13:29:04 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (kill): set errno after calling raise().
+
+Tue May 20 10:51:26 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_f_missing): create exception instance by ordinal
+ method. [ruby-dev:20033]
+
+ * error.c (rb_name_error, rb_sys_fail): ditto.
+
+ * error.c (exc_to_s, exit_status, name_err_name,
+ nometh_err_args, syserr_errno, syserr_eqq): access
+ attributes.
+
+ * error.c (name_err_initialize, nometh_err_initialize,
+ syserr_initialize): initialize attributes.
+
+Tue May 20 10:26:56 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_yield_0): give warning for multiple values for a
+ block parameter.
+
+ * eval.c (rb_yield_values): a function to yield multiple values.
+
+ * array.c (sort_1): use rb_yield_values.
+
+ * enum.c (min_ii, max_ii): ditto.
+
+ * hash.c (rb_hash_update_block_i, delete_if_i, select_i,
+ each_pair_i, env_each, env_reject_bang, env_select,
+ env_update_i): ditto.
+
+ * struct.c (rb_struct_each_pair): ditto.
+
+ * eval.c (top_include): should include module in the current self,
+ not ruby_top_self. [ruby-dev:20198]
+
+ * eval.c (top_include): stop inclusion to ruby_wrapper; give
+ warning.
+
+Mon May 19 18:54:30 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/token.c, ext/syck/implicit.c: expanded character set to
+ allow UTF-8, other Ruby encodings.
+
+Mon May 19 16:47:00 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/syck.c, ext/syck/syck.h, ext/syck/token.c, ext/syck/gram.c:
+ count line numbers only if line pointer has increased.
+
+Tue May 20 00:45:40 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * dir.c (push_braces): do not push_braces() unless rbrace is found.
+ (ruby-bugs-ja:PR#469)
+
+Tue May 20 00:09:41 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/pty/pty.c (pty_finalize_syswait): join (using Thread#value)
+ before detach pid. [ruby-talk:71519]
+
+Mon May 19 23:02:10 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (PUSH_FRAME): save outer ruby_block. [ruby-list:37677],
+ [ruby-dev:20202]
+
+ * eval.c (BEGIN_CALLARGS): restore outer block by using
+ ruby_block->outer.
+
+ * eval.c (block_pass): do not alter block->prev, but block->outer.
+
+ * array.c (get_inspect_tbl): warning on wrong condition.
+
+Mon May 19 16:13:57 2003 Minero Aoki <aamine@loveruby.net>
+
+ * class.c: add #include "version.h".
+
+ * hash.c: ditto.
+
+ * string.c: ditto.
+
+Mon May 19 15:33:27 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (localjump_xvalue): renamed exitstatus to exit_value
+ since it's not exit "status" after all.
+
+ * eval.c (localjump_error): add reason to LocalJumpError.
+
+ * compar.c (rb_cmpint): raise error via rb_cmperr(), if cmp value
+ is nil. now take new 2 arguments.
+
+ * time.c (time_cmp): 2003-05-16 fix was incomplete.
+ (ruby-bugs-ja:PR#458)
+
+Mon May 19 14:42:50 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_mod_cmp): stupid comparison fixed.
+
+ * io.c (Init_IO): ARGF.path added (alias to ARGF.filename).
+ [ruby-dev:20197]
+
+Mon May 19 13:58:03 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (init_copy): rename copy_object as initialize_copy,
+ since it works as copy constructor.
+
+ * eval.c (rb_add_method): initialize_copy should always be
+ private, like initialize.
+
+Mon May 19 13:51:50 2003 Minero Aoki <aamine@loveruby.net>
+
+ * re.c (rb_reg_quote): \n \r \f \v quoting was wrong.
+ [ruby-dev:20203]
+
+ * re.c (rb_reg_quote): rb_reg_quote(" ") should be "\\ ", not
+ "\\s".
+
+Mon May 19 08:08:51 2003 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb: use warn() instead of $stderr.puts().
+
+ * sample/cal.rb: ditto.
+
+Sat May 17 12:02:25 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (get_inspect_tbl): check whether inspect_tbl value is a
+ valid array. (ruby-bugs-ja PR#65)
+
+ * array.c (inspect_ensure,rb_protect_inspect,rb_inspecting_p):
+ use get_inspect_tbl().
+
+Sat May 17 11:50:26 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_f_abort): call exit(1) if exception is raised. This
+ patch was made by Nobuyoshi Nakada <nobu.nokada@softhome.net> on
+ 2002-05-30. (ruby-bugs-ja PR#236)
+
+ * signal.c: disable Ruby's interrupt handler at the beginning.
+ (ruby-bugs-ja PR#236)
+
+Sat May 17 02:17:42 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/rational.rb (Integer::denominator): fixed typo.
+ (ruby-bugs-ja:PR#466)
+
+Sat May 17 00:18:11 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/socket/socket.c (ruby_connect): connect() after EINPROGRESS
+ returns EINVAL on some platforms, need to check true error
+ status. [ruby-core:01037]
+
+Sat May 17 00:21:51 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_class_allocate_instance): singleton class check
+ moved to rb_obj_alloc(). (ruby-bugs-ja PR#345)
+
+Fri May 16 23:55:50 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_quote): should escape white space characters,
+ \t, \f, \n, \r. (ruby-bugs-ja PR#231)
+
+Fri May 16 12:40:40 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (block_pass): chain previous block to the pushing block.
+ [ruby-list:37677]
+
+ * time.c (time_cmp): does not compare with numbers for
+ interchangeability. (ruby-bugs-ja:PR#458)
+
+Thu May 15 21:55:54 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/gram.c: fixes to one-line documents and end of stream
+ documents.
+
+ * ext/syck/syck.c, ext/syck/syck.h: add root_on_error to parser
+ struct, specifying the symbol to be returned on a parse error.
+
+Thu May 15 18:44:31 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/open-uri.rb (OpenURI::Redirect#initialize): call super to
+ initialize mesg.
+
+ * lib/open-uri.rb (OpenURI::Meta#charset): call block to guess charset
+ if block is given and charset is not given.
+
+Thu May 15 16:55:16 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_mod_le): returns nil if two classes/modules are not
+ in class-superclass relationship.
+
+ * object.c (rb_mod_cmp): uses new rb_mod_le() behavior.
+
+Thu May 15 07:45:30 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/rubyext.c, ext/syck/implicit.c: timestamp repairs to
+ timezone and milliseconds.
+
+ * ext/syck/syck.c (syck_parser_reset_levels): duplicate string literal
+ to avoid warning.
+
+Thu May 15 13:26:48 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_class_instance_methods): default will be changed in
+ 1.8.1.
+
+ * io.c (set_stdio): better message.
+
+Thu May 15 13:18:11 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (set_stdio): $stdin, $stdout, $stderr now became read-only.
+
+ * variable.c (readonly_setter): message changed.
+
+Thu May 15 09:50:51 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/syck/syck.c (syck_parser_pop_level): add prototype.
+
+ * ext/syck/syck.c (syck_strndup): should return value.
+
+Thu May 15 09:32:25 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (kill): fix typo and add signal 0 support.
+
+Wed May 14 20:09:26 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/gram.c: sequence-in-map shortcut, transfer methods on
+ sequence-in-sequence, memory leak in mapping merge.
+
+ * ext/syck/syck.c: memory leak in domain anchoring.
+
+ * lib/yaml/rubytypes.rb, lib/yaml/types.rb: eliminated 1.6.x code.
+
+Wed May 14 19:56:43 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/syck/rubyext.c: add prototypes to avoid VC++ warnings.
+
+Wed May 14 12:23:46 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb (Net::HTTP#start): should check whether HTTP
+ session is opened before finishing. (ruby-bugs-ja:PR#463)
+
+Wed May 14 09:12:55 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb: reduce warning. (ruby-bugs-ja:PR#462)
+
+Tue May 13 22:31:04 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * lib/yaml/rubytypes.rb, lib/yaml/types.rb: using Object#object_id
+ rather than deprecated Object#id.
+
+ * ext/syck/token.c: changed ASCII escapes to octal notation.
+
+ * ext/Setup*: added entries for static linking of Syck extension.
+
+Tue May 13 20:31:58 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: add '--Wl,--enable-auto-import' to DLDFLAGS
+ on Cygwin/MinGW.
+
+ * configure.in: add '-D__USE_CRTIMP' to XCFLAGS on MinGW.
+
+ * ext/syck/handler.c: add proper casts.
+
+ * ext/syck/syck.c: ditto.
+
+Tue May 13 17:58:08 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * configure.in, bcc32/Makefile.sub, win32/Makefile.sub: define
+ HAVE_FSYNC.
+
+ * win32/win32.h (fsync): define as _commit().
+
+Tue May 13 15:35:35 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_match_exec): \Z changed to be consistent with new $
+ (endbuf) behavior.
+
+Tue May 13 14:48:07 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (error_pos): use $deferr for output instead of stderr
+ directly.
+
+ * eval.c (error_print,error_handle,rb_longjmp,rb_thread_schedule):
+ ditto.
+
+Tue May 13 06:34:19 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * lib/yaml/rubytypes.rb: object and struct loading
+
+ * lib/yaml.rb: YAML::detect_implicit will discover typing for a Ruby
+ string
+
+ * ext/syck/: Fixed portable comments, misuse of NULL and methods without
+ return VALUEs.
+
+Mon May 12 18:08:21 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (Init_IO): new variable $deferr which is default output
+ port of error messages.
+
+ * io.c (rb_warn_m): new method "warn". [new]
+
+ * error.c (warn_print): use $deferr.
+
+ * error.c (rb_bug): ditto.
+
+ * error.c (err_append): ditto.
+
+Sun May 11 13:50:12 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pp.rb: refine to_s test.
+
+ * lib/pp.rb (PP::ObjectMixin#pretty_print): refine to_s handling.
+
+Sun May 11 06:32:13 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/implicit.c, ext/syck/rubyext.c: transfer methods applied to
+ native loading
+
+ * ext/syck/token.c: fix for transfer methods on same indentation as nested
+ mapping
+
+ * lib/yaml/rubytypes.rb: all type names in lowercase
+
+Sat May 10 19:55:18 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ext/syck/gram.c ext/syck/handler.c ext/syck/implicit.c
+ ext/syck/node.c ext/syck/rubyext.c ext/syck/syck.c
+ ext/syck/syck.h ext/syck/token.c: updated to Syck 0.27
+
+ * lib/yaml/loader.rb: new YAML::Loader class
+
+ * lib/yaml.rb: loading of type families leverages YAML::DefaultLoader
+
+Sat May 10 19:00:08 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+
+ * wince/string.c: file removed.
+
+ * wince/stdlib.c: file added.
+
+Sat May 10 16:17:02 2003 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (decode_utf7): new method.
+
+ * lib/net/imap.rb (encode_utf7): new method.
+
+Fri May 9 21:25:50 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
+
+ * ruby/ext/syck, ruby/lib/yaml: Initial checkin of YAML substances.
+
+Fri May 9 16:38:30 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_reopen): It should be possible to reopen closed IO.
+ [ruby-talk:70941]
+
+ * io.c (rb_io_reopen): inherit original file mode unless specified.
+
+Thu May 8 18:44:09 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (rb_gc): check odd alignment stack on m68k machines.
+
+Thu May 8 12:56:04 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * compar.c (rb_cmperr): raise comparison failure.
+
+ * intern.h: prototype; rb_cmperr
+
+ * numeric.c (flo_gt, flo_ge, flo_lt, flo_le, fix_gt, fix_ge,
+ fix_lt, fix_le): should fail unless the argument is comparable.
+ (ruby-bugs-ja:PR#456)
+
+ * numeric.c (int_upto, int_downto): should fail unless the
+ argument is comparable. (ruby-bugs-ja:PR#454)
+
+Wed May 7 13:30:11 2003 Masahiro TANAKA <masa@ir.isas.ac.jp>
+
+ * numeric.c (num_step): better error treatment of float values.
+
+Tue May 6 17:51:54 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/pop.rb: rename method: POP3#mail_size -> n_mails
+
+ * lib/net/pop.rb: rename method: POP3#bytes -> n_bytes
+
+Tue May 6 17:21:01 2003 Minero Aoki <aamine@loveruby.net>
+
+ * ext/bigdecimal/.cvsignore: new file.
+
+ * ext/zlib/.cvsignore: new file.
+
+Tue May 6 14:39:36 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_obj_methods): list singleton methods if recur
+ argument is false; list all methods otherwise.
+
+Mon May 5 21:19:25 2003 Koji Arai <jca02266@nifty.ne.jp>
+
+ * ext/gdbm/gdbm.c (fgdbm_values_at): new method to replace
+ select(index..).
+
+ * ext/sdbm/init.c (fsdbm_values_at): ditto.
+
+ * ext/dbm/dbm.c (fdbm_values_at): ditto.
+
+ * ext/dbm/dbm.c (DBM::VERSION): defined.
+
+ * ext/gdbm/testgdbm.rb: replace select with values_at.
+
+ * ext/sdbm/testsdbm.rb: ditto.
+
+ * ext/dbm/testdbm.rb: ditto.
+
+ * ext/dbm/testdbm.rb (setup): DBM.open(path, 0400) cause EACCESS
+ on Berkeley DB[234].
+
+Mon May 5 22:57:07 2003 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * sample/cal.rb: use values_at instead of select.
+
+ * sample/biorhythm.rb: ditto.
+
+Mon May 5 18:59:45 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * sample/test.rb: substitute 'select' with 'values_at'.
+
+ * lib/date.rb: ditto.
+
+ * lib/parsedate.rb: ditto.
+
+Mon May 5 00:46:10 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_values_at): new method to replace select(index..).
+
+ * hash.c (rb_hash_values_at,env_values_at): ditto.
+
+ * re.c (match_values_at): ditto.
+
+ * struct.c (rb_struct_values_at): ditto.
+
+ * re.c (match_select): add iterator behavior.
+
+Sun May 4 19:08:53 2003 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb: synchronized with date2 3.3.2.
+
+Sun May 4 15:21:18 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/smtp.rb: ESMTP -> SMTP transition wrongly fails.
+
+Sun May 4 15:06:37 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/pop.rb: APOP did not work. [ruby-dev:20149]
+
+Sat May 3 21:14:29 2003 Johan Holmberg <holmberg@iar.se>
+
+ * ext/curses/curses.c, ext/digest/sha2/sha2.c, ext/iconv/iconv.c,
+ ext/racc/cparse/cparse.c: include "ruby.h" at the top to shut up
+ "_FILE_OFFSET_BITS redefined" warning on Solaris.
+
+Sat May 3 11:00:12 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_class_protected_instance_methods): now gives
+ warnings to show migration path. The default will be reversed
+ on Jan 2004.
+
+Sat May 3 00:58:53 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_obj_methods): now accepts recurse parameter.
+
+ * lib/delegate.rb (Delegator::initialize): instance_methods
+ etc. now recurse by default. need to specify false.
+
+Sat May 3 00:22:00 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/protocol.rb: reintroduce Protocol.protocol_param.
+
+ * lib/net/http.rb: ditto.
+
+ * lib/net/pop.rb: ditto.
+
+ * lib/net/smtp.rb: ditto.
+
+Fri May 2 23:29:53 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/protocol.rb: remove Protocol class.
+
+ * lib/net/smtp.rb (SMTP): ditto.
+
+ * lib/net/pop.rb (POP3): ditto.
+
+ * lib/net/http.rb (HTTP): ditto.
+
+ * lib/net/protocol.rb: remove Command class.
+
+ * lib/net/smtp.rb (SMTPCommand): ditto.
+
+ * lib/net/pop.rb (POP3Command): ditto.
+
+ * lib/net/pop.rb: remove APOPCommand class.
+
+ * lib/net/protocol.rb: remove Code class and its all subclasses.
+
+ * lib/net/protocol.rb: remove Response class and its all
+ subclasses.
+
+ * lib/net/pop.rb (POPMail): new method unique_id (alias uidl).
+
+Fri May 2 18:17:37 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * compar.c (cmp_gt): raises ArgumentError when "<=>" give nil.
+ inspired by discussion on comp.lang.python.
+
+Fri May 2 17:37:01 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/cgi/session.rb (CGI::Session::initialize): updated to
+ support 2003-04-23 change in cgi.rb [ruby-core:1002]
+
+Fri May 2 17:21:02 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (method_list): classify methods based on nearest
+ visibility. [ruby-dev:20127]
+
+ * class.c (rb_class_instance_methods): recurse by default. other
+ method listing methods as well.
+
+Fri May 2 09:38:06 2003 Warren Brown <wkb@airmail.net>
+
+ * string.c (rb_str_ljust): now takes optional argument to specify
+ pad string. [ruby-talk:70482]
+
+ * string.c (rb_str_rjust): ditto.
+
+ * string.c (rb_str_center): ditto.
+
+ * string.c (rb_str_justify): utility function.
+
+Fri May 2 04:10:59 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_add_method): call singleton_method_added or
+ method_added for every method definition (after ruby_running).
+ [ruby-talk:70471]
+
+ * array.c (rb_ary_reverse_bang): Array#reverse! should not return
+ nil even for arrays sized less than 2.
+
+Thu May 1 23:18:01 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (argf_eof): should not block after reading all argument
+ files. (ruby-bugs-ja PR#449)
+
+Fri May 2 15:10:41 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb: use hashes to pass options.
+
+ * lib/fileutils.rb: new option mkdir(:mode), mkdir_p(:mode).
+
+ * instruby.rb: follow fileutils.rb feature change.
+
+Thu May 1 08:24:00 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_match_exec): $ _always_ matches at the end of string.
+
+Wed Apr 30 14:12:00 2003 wanowa.kimura@nifty.ne.jp (kimura wataru)
+
+ * net/imap.rb: support THREAD extension.
+
+Sun Apr 27 23:13:20 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * string.c (rb_str_to_i): disallow negative radix.
+ [ruby-dev:20087]
+
+Sat Apr 26 23:34:42 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (open_args): warning message changed to "don't put space
+ before argument parentheses".
+
+Sat Apr 26 14:25:00 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+
+ * wince/ : files removed.
+ (config, dll.mak, exe.mak, mswince-ruby17.def,
+ io.c, process.c, signal.c, string.c, time.c)
+
+ * wince/ : files added.
+ (assert.c, Makefile.sub, mkexports.rb, io_wce.c,
+ process_wce.c, signal_wce.c, string_wce.c,
+ time_wce.c)
+
+ * wince/configure.bat : like mswin32 style.
+
+ * wince/direct.c : remove "static" at _currentdir.
+
+ * wince/io.h : change definition.
+
+ * wince/stdio.c : _fdopen -> fdopen.
+
+ * wince/process.h : add _P_OVERLAY.
+
+ * wince/time.h : change definition.
+
+ * wince/wincemain.c : add wce_SetCurrentDir.
+
+ * wince/wince.c : add wce_SetCurrentDir and wce_fopen.
+ fix GetModuleFileNameA to return correct "lpFileName".
+
+ * wince/wince.h : remove #ifdef.
+
+ * wince/sys/utime.h, utime.c : rename _utime to utime.
+
+ * wince/sys/stat.c : expand relative directory in stat.
+
+Sat Apr 26 06:33:04 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (argf_read): ARGF.read() should read all argument files.
+
+Fri Apr 25 18:46:00 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+
+ * gc.c: STACK_LEVEL_MAX=65535 on mswince.
+
+Fri Apr 25 18:40:07 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (argf_read): read should not span two files. [ruby-dev:20073]
+
+Fri Apr 25 18:19:03 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (splat_value): split splat_value() and avalue_splat().
+
+ * io.c: there's no way to set non-IO value to current_file, thus
+ no need for argf_forward().
+
+Fri Apr 25 02:03:25 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (proc_invoke): Proc#yield should pass through retry and
+ break like keyword yield. [ruby-talk:70034]
+
+ * eval.c (proc_invoke): orphan Proc now raises LocalJumpError for
+ break and retry again.
+
+ * eval.c (rb_eval): ARGSCAT should splat the argument.
+
+ * eval.c (splat_value): splat operation function.
+
+Thu Apr 24 23:37:02 2003 Dave Thomas <dave@thomases.com>
+
+ * lib/matrix.rb (Matrix#minor): Used Range#size, which no longer
+ exists.
+
+ * lib/complex.rb (new!): Complex.new had been made private, but
+ Kernel#Complex called it. Re-exposed as new!.
+
+ * lib/matrix.rb (Matrix.row_vector): Fix method name typo
+
+Thu Apr 24 19:40:02 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/extmk.rb: add -Wl,--no-undefined to LDSHARED only
+ if GNU ld is 2.11 or later.
+
+Wed Apr 23 14:05:40 2003 Dave Thomas <dave@pragprog.com>
+
+ * lib/ipaddr.rb (include?): Support non-IPAddr parameters.
+ [ruby-core:00980]
+
+Wed Apr 23 13:31:10 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/cgi.rb (CGI::QueryExtension::[]): always return Value
+ object.
+
+Wed Apr 23 08:39:27 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/zlib/extconf.rb: bccwin32 is win32 too.
+
+Tue Apr 22 20:58:00 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
+
+ * ruby.c: don't call VirtualQuery in ruby_init_loadpath()
+ on mswince.
+
+Tue Apr 22 19:08:53 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * marshal.c (save_mantissa, load_mantissa): for interoperability
+ should count cut-down bit from topmost.
+
+Tue Apr 22 09:20:40 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (arg_ambiguous): hopefully better message.
+
+ * lib/cgi.rb (CGI::QueryExtension::initialize_query): to_ary
+ removed.
+
+Tue Apr 22 06:06:22 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/resolv.rb (Resolv::DNS::Resource#hash): use XOR to accumulate
+ hash value.
+
+ * lib/tsort.rb (TSort#each_strongly_connected_component): don't use
+ block argument.
+ (each_strongly_connected_component_from): ditto.
+
+Mon Apr 21 21:59:48 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * marshal.c: one more digit for decimal point. [ruby-talk:69808]
+
+Mon Apr 21 21:25:59 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * numeric.c (flo_is_finite_p): use finite() if available.
+
+ * win32/win32.h (isinf, isnan): define as macro.
+ [ruby-win32:00533]
+
+ * bcc32/Makefile.sub, win32/Makefile.sub: no longer use
+ missing/isinf.c, missing/isnan.c.
+
+Mon Apr 21 18:36:28 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * bignum.c (rb_cstr_to_inum): unnecessarily long buffer was used
+ for radix 9. [ruby-dev:20057]
+
+Mon Apr 21 17:44:34 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (block_append, value_expr0, assign_in_cond,
+ warn_unless_e_option, warning_unless_e_option, range_op,
+ cond0): adjust line number in warning.
+
+Mon Apr 21 00:47:42 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * sample/test.rb: avoid the MSVCRT *printf problem(float).
+ [ruby-dev:20037]
+
+Mon Apr 21 00:11:15 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * marshal.c (w_float): append least mantissa bits to get rid
+ of roundoff problem. [ruby-talk:69518]
+
+ * marshal.c (r_object0): load least mantissa bits.
+
+Sun Apr 20 23:24:25 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * win32/win32.c (NtInitialize): set the floating-point control word
+ on bcc32.
+
+ * win32/win32.h, bcc32/Makefile.sub: use missing/isinf.c, should not
+ use _finite() because it returns 0 if NaN.
+
+Sun Apr 20 03:09:30 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * parse.y (void_expr0): node might become NULL after calling
+ remove_begin().
+
+Sat Apr 19 21:55:10 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/Setup*: Add zlib and remove bogus and obsolete entries.
+
+Sat Apr 19 14:47:07 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (rb_gc): use rb_gc_mark_maybe() to mark registered C
+ addresses. C variables may not hold valid reference to Ruby
+ objects. [ruby-core:00975]
+
+Sat Apr 19 00:56:13 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * struct.c (rb_struct_eql): should compare values with "eql?".
+
+Fri Apr 18 23:29:08 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * range.c (range_check): <=> returns nil for invalid values;
+ should check.
+
+Fri Apr 18 15:26:50 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * error.c (rb_raise): workaround for some implementations of
+ vsnprintf.
+
+Fri Apr 18 02:23:42 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_compile_pattern): should not set RE_OPTIMIZE_ANCHOR,
+ if anychar_repeat is enclosed by parentheses.
+
+Fri Apr 18 01:49:18 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * util.c (ruby_strtod): improved conversion accuracy.
+
+Thu Apr 17 14:39:23 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/dbm/dbm.c (each_pair): add prototype to avoid VC++ warnings.
+
+ * ext/readline/readline.c (Init_readline): follow readline 4.2
+ prototype.
+
+Thu Apr 17 14:22:36 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (cond0): warn only range literals whose both side are
+ literals. [ruby-core:00964]
+
+Thu Apr 17 11:10:59 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/readline/readline.c: add the defined operator for bcc32.
+
+Wed Apr 16 00:14:06 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * misc/ruby-mode.el (ruby-special-char-p): should test at the
+ point if no argument. fixed by Michael Scholz
+ <scholz-micha@gmx.de>.
+
+Tue Apr 15 19:35:08 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb: rm_r should raise Errno::ENOENT if file
+ does not exist ([ruby-core:958]). Thanks Johan Holmberg.
+
+Tue Apr 15 19:12:21 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * struct.c (rb_struct_hash): new methods Struct#hash, Struct#eql?.
+ (ruby-bugs:PR#758)
+
+Tue Apr 15 16:05:11 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * numeric.c (rb_fix2str): buffer was insufficient.
+ (ruby-bugs-ja:PR#431)
+
+Mon Apr 14 19:45:56 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * file.c (file_expand_path): root must follow buf when
+ reallocated. [ruby-talk:69339], [ruby-dev:20025]
+
+Mon Apr 14 03:22:33 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * rubyio.h (struct OpenFile): add noraise flag to finalizer.
+
+ * io.c (Init_IO): define $/, $-0, and $\ as string-only
+ variables.
+
+ * string.c (rb_str_split_m): does not generate empty string if
+ the receiver is empty.
+
+ * io.c (fptr_finalize): should raise error on EBADF for readable
+ IOs as well.
+
+Mon Apr 14 15:54:18 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * bignum.c (rb_cstr_to_inum, rb_big2str): allow 2-36 as radix.
+
+ * numeric.c (rb_fix2str): ditto.
+
+ * string.c (rb_str_to_i): ditto.
+
+Sun Apr 13 03:20:31 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/mkmf.rb (try_func): remove COMMON_HEADERS at first for
+ performance.
+
+Sat Apr 12 20:59:40 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * misc/ruby-mode.el (ruby-beginning-of-arg): substitute
+ ruby-backward-arg.
+
+ * misc/ruby-mode.el (ruby-calculate-indent): fixed wrong
+ indentation in brace block and parentheses.
+
+ * misc/ruby-mode.el (ruby-forward-sexp, ruby-backward-sexp):
+ support special char literal, and negative arguments.
+
+Sat Apr 12 17:52:47 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (rb_stat): use rb_check_convert_type() to retrieve IO.
+
+Fri Apr 11 19:00:14 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * win32/win32.c (rb_w32_stat): check arguments. [ruby-dev:20007]
+ [ruby-win32:535]
+
+Fri Apr 11 15:56:08 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * numeric.c (coerce_rescue): prevent inspected String from GC.
+
+ * numeric.c (flo_eq, rb_dbl_cmp, flo_gt, flo_ge, flo_lt, flo_le,
+ flo_eql): correct NaN comparison. (ruby-bugs:PR#744)
+
+ * sample/test.rb: NaN comparison test.
+
+Fri Apr 11 14:48:47 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (rb_stat): dereference using StringValuePtr().
+
+ * file.c (rb_file_s_stat): use rb_stat(). [ruby-dev:20007]
+
+Fri Apr 11 10:51:08 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/benchmark.rb (Benchmark::bm): get rid of warning.
+ [ruby-talk:69124]
+
+Fri Apr 11 02:41:35 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * io.c (set_stdin): assigned value must respond to "read" and
+ "getc".
+
+ * io.c (set_outfile): assigned value must respond to "write".
+ (ruby-bugs-ja:PR#425)
+
+Thu Apr 10 21:12:19 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/pop.rb: Exception line was accidentaly removed.
+ [ruby-dev:19989]
+
+Thu Apr 10 18:42:13 2003 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * array.c (rb_ary_times): added some checks for request size.
+
+Thu Apr 10 03:22:38 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_mod_name): always return empty string for
+ anonymous class/module. (ruby-bugs-ja PR#424)
+
+ * config.sub: stop forcing addition of -gnu to -linux.
+
+ * variable.c (classname): refactoring.
+
+ * variable.c (rb_class_path): __tmp__classpath__ handling moved
+ from classname().
+
+Thu Apr 10 01:52:24 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_obj_is_method): indefinite return value.
+
+Thu Apr 10 00:39:32 2003 Tanaka Akira <akr@m17n.org>
+
+ * regex.c (re_compile_pattern): /[\--\-]/ was warned. warn /]/.
+
+ * mkconfig.rb: escape `]' in regexp.
+
+Thu Apr 10 00:27:07 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * time.c (time_strftime): RSTRING(format)->ptr might become NULL.
+
+Wed Apr 9 23:54:50 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_obj_remove_instance_variable): better message.
+ [ruby-talk:68987]
+
+ * variable.c (rb_mod_remove_const): ditto.
+
+ * object.c (rb_obj_ivar_get): ditto.
+
+ * object.c (rb_obj_ivar_set): ditto.
+
+ * parse.y (yylex): ditto.
+
+Wed Apr 9 21:51:20 2003 Dave Thomas <Dave@Thomases.com>
+
+ * eval.c (rb_mod_define_method): Allow UnboundMethod as
+ parameter.
+
+Wed Apr 9 18:30:58 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (top_include): include module to wrapper module if
+ wrapper is present. experimental. [ruby-list:37539]
+
+Wed Apr 9 17:24:21 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (rb_gc_mark_children): introduce this function again; this
+ is required when stack was very tight. [ruby-talk:68916]
+
+Wed Apr 9 15:49:30 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (bigdivmod): small typo.
+
+Wed Apr 9 15:35:04 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/readline/readline.c: include <unistd.h> only when
+ HAVE_UNISTD_H is defined.
+
+Wed Apr 9 14:05:00 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * marshal.c (w_object): preserve extended module on struct.
+ (ruby-bugs-ja:PR#422)
+
+Wed Apr 9 03:43:14 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (BIGZEROP): macro to determine if x is a bignum zero.
+
+Tue Apr 8 11:49:31 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (Init_Proc): make Method and UnboundMethod independent.
+ They are like instance and its class. [ruby-core:00941]
+
+ * parse.y (yylex): disallow global variables like "$1ve".
+ [ruby-core:00945]
+
+ * marshal.c (marshal_dump): Marshal.dump(0, false) should cause an
+ error. (ruby-bugs-ja PR#421)
+
+ * regex.c (re_compile_pattern): warn if '-' is the edge of
+ character range.
+
+Mon Apr 7 15:49:09 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c (sock_s_unpack_sockaddr_in): remove struct
+ size check. getnameinfo(3) can handle. [ruby-dev:19967]
+
+Mon Apr 7 01:33:31 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (io_read): do not call rb_sys_fail() when required data
+ length is zero. (ruby-bugs-ja PR#420)
+
+ * eval.c (umethod_proc): should raise TypeError, instead of
+ returning error causing Proc. Following the principle of "fail
+ early". [ruby-core:00927]
+
+Sun Apr 6 18:29:21 2003 UENO Katsuhiro <katsu@blue.sky.or.jp>
+
+ * ext/zlib/zlib.c: the return value of GzipReader#getc must be
+ unsigned.
+
+Sun Apr 6 00:35:37 2003 Tanaka Akira <akr@m17n.org>
+
+ * sample/exyacc.rb: use Regexp in gsub!.
+
+Sat Apr 5 23:41:28 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * pack.c (pack_pack): small but serious typo.
+
+Sat Apr 5 04:23:05 2003 Warren Brown <wkb@airmail.net>
+
+ * sprintf.c (rb_f_sprintf): was decrementing width even if there
+ is no sign character.
+
+Sat Apr 5 01:41:28 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (backtrace): skip internal allocator frame.
+ (ruby-bugs-ja PR#416)
+
+Fri Apr 4 10:53:22 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (assign): should prepare mrhs by svalue_to_mrhs().
+
+Wed Apr 2 15:11:23 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * README.EXT, README.EXT.ja (3.3): clarified -1 as free for
+ Data_Wrap_Struct(). [ruby-dev:19881]
+
+Mon Mar 31 11:11:36 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_f_missing): use "inspect" for T_OBJECT as well.
+
+Mon Mar 31 10:50:48 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (env_reject_bang): untaint key string.
+
+ * hash.c (env_delete_m): execute block only if deleting key does
+ not exist.
+
+Sat Mar 29 17:54:46 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * pack.c (pack_pack): do not call rb_str_buf_cat() with NULL ptr,
+ which causes SEGV; jump to grow instead. [ruby-dev:19944]
+
+Sat Mar 29 15:19:48 2003 Tanaka Akira <akr@m17n.org>
+
+ * instruby.rb, ext/extmk.rb, lib/benchmark.rb, lib/cgi.rb,
+ lib/debug.rb, lib/getoptlong.rb, lib/optparse.rb, lib/time.rb,
+ lib/date/format.rb, lib/irb/ruby-lex.rb lib/uri/common.rb: revert
+ escape for `-' in character class.
+
+Sat Mar 29 09:48:35 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (avalue_to_svalue): use rb_check_array_type() again.
+ Clarify how "to_ary" and "to_a" work. [ruby-talk:68155]
+
+ * eval.c (svalue_to_avalue): ditto.
+
+ * eval.c (svalue_to_mrhs): ditto.
+
+ * eval.c (rb_eval): unary splat to use to_a, but we need a hack to
+ exclude Object#to_a until it's removed.
+
+ * object.c (rb_Array): check obj.respond_to?("to_a"). Currently
+ all object respond_to "to_a", but Object#to_a will be removed.
+
+ * range.c (Init_Range): undefine to_ary.
+
+ * re.c (Init_Regexp): ditto.
+
+Sat Mar 29 09:47:52 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * MANIFEST (ext/aix_mksym.rb): remove obsolete file.
+
+Fri Mar 29 06:21:24 2003 UENO Katsuhiro <katsu@blue.sky.or.jp>
+
+ * ext/zlib: merge from rough.
+
+Fri Mar 28 19:33:39 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * variable.c (rb_class_path): hold temporary class path in a
+ instance variable to get rid of GC. [ruby-dev:19932]
+
+ * variable.c (classname): remove temporary class path when exact
+ name found.
+
+Fri Mar 28 18:29:23 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_compile_pattern): do not warn if "-" is at the top
+ or last of character class.
+
+Thu Mar 27 12:10:15 2003 Tanaka Akira <akr@m17n.org>
+
+ * regex.c (re_compile_pattern): fix [:name:] handling.
+ /[\[:digit:]]/ was treated as /[[:digit:]]/.
+ /[[:-@]/ was treated as /[\[:\-@]/.
+ /[%-[:digit:]]/ was treated as /[%-\[:digit:]\]/.
+
+Thu Mar 27 03:26:40 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * string.c (rb_str_capitalize_bang): check length before upcase
+ first character. (ruby-bugs:PR#697)
+
+Wed Mar 26 20:25:10 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * dln.c (dln_find_1): break if path list end, even for too long
+ path names. (ruby-bugs-ja:PR#412)
+
+Wed Mar 26 13:19:32 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (avalue_splat): new function to do unary * (splat)
+ operator.
+
+ * eval.c (avalue_to_svalue,svalue_to_avalue,svalue_to_mrhs): do
+ not use implicit "to_ary" conversion.
+
+ * ext/curses/curses.c (GetWINDOW,GetMOUSE): add taint check.
+
+ * ext/curses/curses.c (curses_init_screen): ditto.
+
+ * ext/curses/curses.c (window_initialize): ditto.
+
+ * gc.c (os_each_obj): prohibit ObjectSpace#each_object in safe
+ mode ($SAFE >= 4).
+
+Tue Mar 25 23:26:02 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * signal.c (trap): return "DEFAULT" and "IGNORE" respectively for
+ previous sighandler SIG_DFL and SIG_IGN. [ruby-talk:67860]
+
+Tue Mar 25 12:24:15 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_yield_0): call avalue_to_mrhs() to assign block
+ parameter |a|. [ruby-dev:19897]
+
+ * ruby.c (ruby_set_argv): freeze argument strings.
+
+Tue Mar 25 12:01:54 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_initialize): should check rb_secure(4).
+
+ * dir.c (dir_s_getwd): should check rb_secure(4).
+
+ * object.c (rb_obj_infect): function version of OBJ_INFECT().
+
+ * eval.c (rb_secure_update): new function to check object update.
+
+Tue Mar 25 10:18:05 2003 Minero Aoki <aamine@loveruby.net>
+
+ * ext/strscan/strscan.c: should infect also return values of
+ #inspect.
+
+ * ext/strscan/strscan.c: use snprintf() instead of sprintf().
+
+Mon Mar 24 16:55:04 2003 Takaaki Tateishi <ttate@ttsky.net>
+
+ * ext/dl/dl.c: added rb_secure(4). (Thanks to Minero Aoki)
+
+ * ext/dl/sym.c: ditto.
+
+ * ext/dl/ptr.c: ditto.
+
+Mon Mar 24 00:09:02 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (block_append): warn unused literal.
+
+Sun Mar 23 22:22:04 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/jcode.rb (tr!, delete!, szueeze!): add empty string checking.
+
+Sun Mar 23 19:54:53 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * gc.c (rb_gc_call_finalizer_at_exit): use free() if dfree is -1.
+
+Sat Mar 22 15:50:29 2003 Tanaka Akira <akr@m17n.org>
+
+ * time.c (make_time_t): try search_time_t if mktime/timegm is failed.
+
+Sat Mar 22 13:26:33 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/optparse.rb, lib/jcode.rb, ext/tk/lib/tk.rb: reorder character
+ class /[\]\[]/ to /[\[\]]/ for readability.
+
+Sat Mar 22 12:44:15 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/date/format.rb, lib/uri/common.rb: escape `[', `]', `-' in
+ character class in regexp to avoid warning.
+
+Sat Mar 22 07:39:32 2003 Ulf Betlehem <flu@iki.fi>
+
+ * io.c (rb_io_fread): may lose data on nonblocking read.
+
+Fri Mar 21 23:40:41 2003 Tanaka Akira <akr@m17n.org>
+
+ * regex.c (re_compile_pattern): fix previous change.
+
+ * instruby.rb, ext/extmk.rb, ext/tk/lib/tk.rb, lib/benchmark.rb,
+ lib/cgi.rb, lib/debug.rb, lib/getoptlong.rb, lib/jcode.rb,
+ lib/optparse.rb, lib/time.rb, lib/date/format.rb,
+ lib/irb/ruby-lex.rb: escape `[', `]', `-' in character class in
+ regexp to avoid warning.
+
+Fri Mar 21 23:23:45 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_compile_pattern): give warning for unescaped square
+ brackets and minus in character class. [ruby-dev:19868]
+
+Fri Mar 21 18:12:20 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (bmcall): missing type.
+
+Fri Mar 21 01:29:35 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * sprintf.c (rb_f_sprintf): copy sign bits only if value is
+ negative.
+
+ * missing.h: include <stdarg.h> or <varargs.h> if HAVE_VSNPRINTF
+ is not defined.
+
+Thu Mar 20 18:31:37 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/optparse.rb (OptionParser#order!): follow recent change
+ of proc argument.
+
+Thu Mar 20 16:12:53 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (flo_to_s): change format specifier to "%.15g" to
+ avoid unnecessary 9s (e.g. 99.59999999999999). (ruby-bugs-ja PR#406)
+
+Thu Mar 20 16:03:18 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (stmt, primary): get rid of SEGV at empty or invalid
+ condition. (ruby-bugs-ja:PR#410)
+
+ * parse.y (cond_negative): negate condition node when NODE_NOT.
+
+Thu Mar 20 10:45:29 2003 Tanaka Akira <akr@m17n.org>
+
+ * eval.c (bmcall): add volatile to avoid GC problem.
+
+Thu Mar 20 10:10:49 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (load_dyna): clear ruby_errinfo. (ruby-bugs-ja PR#409)
+
+Wed Mar 19 23:05:30 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/tracer.rb (trace_func): save and recover Thread.critical state.
+ Fixed by Fukumoto Atsushi <fukumoto@imasy.or.jp> [ruby-dev:19830]
+
+Wed Mar 19 02:55:46 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (read_all): make str empty if given. (ruby-bugs-ja PR#408)
+
+ * io.c (io_read): ditto.
+
+ * io.c (rb_io_sysread): ditto.
+
+Tue Mar 18 18:24:03 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * range.c: do not override min and max.
+
+Sun Mar 16 12:29:55 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pp.rb (object_address_group): use to_s instead of name
+ to get name of class.
+
+Fri Mar 14 08:53:29 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * sprintf.c (remove_sign_bits): octal left most digit for negative
+ numbers may be '3'. (ruby-bugs-ja PR#407)
+
+ * sprintf.c (rb_f_sprintf): should prefix sign bits if bignum is
+ negative, using sign_bits().
+
+Wed Mar 12 16:48:19 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * io.c (prep_stdio): set binmode only if the file descriptor
+ is not connected to a terminal on Cygwin.
+
+Wed Mar 12 11:23:49 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (avalue_to_mrhs): split argument passing and assignment
+ conversion.
+
+ * eval.c (svalue_to_mrhs): ditto.
+
+ * eval.c (avalue_to_svalue): avalue_to_svalue([[1,2]]) should be
+ [[1,2]], not [1,2] to wrap-around.
+
+Tue Mar 11 21:00:59 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/smtp.rb: Digest string wrongly included '\n' when user
+ name is too long (ruby-bugs-ja:PR#404).
+
+Tue Mar 11 20:07:01 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb: speeding up by avoiding extra flush.
+ (suggested by Brian Candler <B.Candler@pobox.com> [ruby-talk:66516])
+
+Tue Mar 11 04:30:12 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (massign): remove unnecessary array unpacking; it should
+ be handled before massign() by svalue_to_mrhs().
+
+ * eval.c (svalue_to_mrhs): '*a = v' value conversion to avalue
+ (i.e. [1] => [[1]], [1,2] => [1,2]).
+
+ * eval.c (rb_eval): use svalue_to_mrhs.
+
+ * eval.c (rb_yield_0): ditto.
+
+ * eval.c (proc_invoke): break from "Proc#yield" is legal.
+
+Mon Mar 10 23:19:29 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (rb_find_file): need world writable directory check for
+ relative paths too.
+
+Mon Mar 10 11:23:00 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (rb_find_file): world writable directory check if
+ $SAFE >= 1 (was $SAFE >= 2).
+
+Mon Mar 10 01:59:47 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/pop.rb: do not dispatch LIST when a mailbox is empty.
+
+ * lib/net/pop.rb: merge the 'STAT' patch from Frank S.Fejes
+ <frank@oopdreams.com>, with modifications (listed below).
+
+ * lib/net/pop.rb: new method Net::POP#mail_size.
+
+ * lib/net/pop.rb: new method Net::POP#bytes.
+
+ * lib/net/pop.rb: new method Net::POPCommand#stat.
+
+Sun Mar 9 19:30:25 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/fileutils.rb (mkdir, mkdir_p): revert.
+
+ * instruby.rb (umask): umask 0022, not 0.
+
+Sun Mar 9 17:09:40 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/fileutils.rb (mkdir, mkdir_p): set mode to 0755.
+
+ * Makefile.in (fake.rb): set ALT_SEPARATOR to the default value.
+
+Sat Mar 8 11:30:59 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (massign): fix a bug not to expand in assignment to sole
+ lhs. [ruby-dev:19766]
+
+Fri Mar 7 21:57:25 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pp.rb (Kernel.pp): module function.
+ (MatchData#pretty_print): new method.
+
+Fri Mar 7 20:27:19 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/tcltklib/extconf.rb (find_tcl, find_tk): return true if
+ non-versioned found. [ruby-dev:19759]
+
+Fri Mar 7 15:05:35 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/dbm/extconf.rb: add QDBM support.
+
+Fri Mar 7 12:59:39 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (massign): deal with sole lhs, assign rest args from
+ converted array. [ruby-dev:19751]
+
+Fri Mar 7 03:31:36 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (dsym): :"symbol string" style should not contain `\0'.
+
+ * process.c (proc_detach): new method Process.detach(pid) which
+ create background watcher thread to issue waitpid. [new]
+
+ * process.c (rb_detach_process): utility function to detach
+ process from C code.
+
+ * ext/pty/pty.c (pty_finalize_syswait): terminate watcher thread,
+ and detach child process (by creating new idle waitpid watcher
+ thread).
+
+ * ext/pty/pty.c (pty_syswait): may lost signal stopped child.
+
+Fri Mar 7 00:30:33 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/Win32API/Win32API.c: no longer use inline-asms.
+
+ * ext/Win32API/extconf.rb: no need to add gcc options.
+
+Thu Mar 6 13:02:10 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (reswords): fix reswords list.
+
+Wed Mar 5 12:13:21 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: better YACC support on HP-UX.
+
+Wed Mar 5 05:55:20 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_cat): remove ptr NULL check and MEMZERO(). ptr
+ must be non NULL.
+
+Tue Mar 4 23:12:07 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * configure.in, bcc32/Makefile.sub, win32/Makefile.sub: define
+ RUBY_EXPORT to export symbols.
+
+ * defines.h: use RUBY_EXTERN instead of EXTERN.
+
+ * intern.h, re.h, ruby.h, rubysig.h: ditto.
+
+ * win32/win32.h: remove EXTERN definition.
+
+Tue Mar 4 17:54:30 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_aref): raise TypeError if index is a symbol.
+ [ruby-list:37217]
+
+ * array.c (rb_ary_aset): ditto.
+
+Tue Nov 13 14:39:11 2001 WATANABE Tetsuya <tetsu@jpn.hp.com>
+
+ * missing/strftime.c: HP-UX support.
+
+Tue Mar 4 15:08:08 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: better HP-UX support.
+
+ * missing/strftime.c: ditto.
+
+Tue Mar 4 10:11:32 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_popen): do not call rb_io_close() directly, call
+ "close" method instead. [ruby-dev:19717]
+
+ * io.c (rb_io_s_open): ditto.
+
+ * hash.c (rb_any_hash): remove DEFER_INTS. all do_hash() calls in
+ st.c are at the top of functions. No reentrant problem.
+
+Tue Mar 4 01:19:21 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/dl/MANIFEST: Exclude .cvsignore. [found by: eban]
+
+Tue Mar 4 01:17:08 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/Win32API/MANIFEST: Belatedly add lib/win32/registry.rb.
+ [found by: eban]
+
+Tue Mar 4 00:33:04 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * MANIFEST: Belatedly add Test::Unit files. D'oh!
+
+Sun Mar 2 09:51:47 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * marshal.c (w_nbyte): should output always via rb_io_write().
+
+ * marshal.c (dump_ensure): ditto.
+
+ * marshal.c (marshal_dump): should call "binmode" method, if it
+ responds to.
+
+ * marshal.c (r_byte): should input always via "getc" method.
+
+ * marshal.c (r_bytes0): should input always via "read" method.
+
+ * marshal.c (marshal_load): need not to set up FILE* fp;
+
+Mon Mar 3 11:29:04 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (arg): parse 'lhs = a rescue b' as 'lhs=(a rescue b)'.
+
+Mon Mar 3 02:53:52 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_fread): should not clearerr() if there's no filled
+ buffer (i.e. rb_io_fread() returning zero).
+
+Mon Mar 3 01:42:35 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * misc/ruby-mode.el (ruby-expr-beg): escaped char syntax.
+
+ * misc/ruby-mode.el (ruby-parse-partial): ditto.
+
+ * misc/ruby-mode.el (ruby-parse-partial): no deep indent for
+ block.
+
+ * misc/ruby-mode.el (ruby-backward-arg): skip arguments backward.
+
+ * misc/ruby-mode.el (ruby-calculate-indent): too deep indentation.
+
+Fri Feb 28 23:50:32 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (map_errno): map OS error to errno. [new]
+
+ * win32/win32.c (pipe_exec, CreateChild, poll_child_status, waitpid,
+ kill, link, rb_w32_rename, unixtime_to_filetime, rb_w32_utime): use
+ map_errno() instead of using GetLastError() directly.
+
+ * win32/win32.c (rb_w32_select, rb_w32_accept, rb_w32_bind,
+ rb_w32_connect, rb_w32_getpeername, rb_w32_getsockname,
+ rb_w32_getsockopt, rb_w32_ioctlsocket, rb_w32_listen, rb_w32_recv,
+ rb_w32_recvfrom, rb_w32_send, rb_w32_sendto, rb_w32_setsockopt,
+ rb_w32_shutdown, rb_w32_socket, rb_w32_gethostbyaddr,
+ rb_w32_gethostbyname, rb_w32_gethostname, rb_w32_getprotobyname,
+ rb_w32_getprotobynumber, rb_w32_getservbyname, rb_w32_getservbyport,
+ rb_w32_fclose, rb_w32_close): map winsock error to errno.
+
+Fri Feb 28 22:54:10 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * win32/win32.c (flock): supports larger files, and maps error
+ code.
+
+ * win32/win32.c (rb_w32_asynchronize): returns errno from child
+ thread.
+
+ * win32/win32.c (rb_w32_fclose, rb_w32_close): ensures unlocked.
+
+Wed Feb 26 17:38:16 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/open-uri.rb: replace Kernel.open as well.
+
+Tue Feb 25 23:03:08 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * lib/debug.rb (DEBUGGER__::Context#debug_command): bp filename must
+ be the basename of it. [ruby-talk:65644]
+
+Mon Feb 24 17:49:35 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (yycompile): zero clear ruby_eval_tree_begin if
+ compilation failed.
+
+Mon Feb 24 08:06:29 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (str_new): need no MEMZERO().
+
+Sun Feb 23 17:57:06 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/fileutils (fu_stream_blksize): wrong logical condition.
+ (and -> or).
+
+Sat Feb 22 03:12:56 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (fix_gt): use rb_num_coerce_cmp() instead of
+ rb_num_coerce_bin.
+
+ * numeric.c (fix_ge, fix_lt, fix_le): ditto.
+
+ * numeric.c (flo_gt, flo_ge, flo_lt, flo_le): ditto.
+
+Sat Feb 22 02:45:20 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_create): may called from place higher than
+ rb_gc_stack_start.
+
+ * gc.c (Init_stack): update rb_gc_stack_start if it is lower (or
+ higher if stack grows down) than the previous value.
+
+Fri Feb 21 21:03:41 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb: new method FileUtils#copy_stream.
+
+ * lib/fileutils.rb: new method FileUtils#compare_file.
+
+ * lib/fileutils.rb: new method FileUtils#compare_stream.
+
+ * lib/fileutils.rb: new method FileUtils#rmtree (alias of rm_rf).
+
+Fri Feb 21 17:19:27 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * eval.c (rb_f_require): do not need to abort if a DLEXT file
+ is not found.
+
+Fri Feb 21 13:39:25 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_cmp_m): should use LONG2NUM().
+
+Fri Feb 21 12:45:50 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_cmp_m): two small bugs fixed.
+
+Fri Feb 21 08:03:09 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (rb_gc_mark): inline rb_gc_mark_children().
+
+ * gc.c (gc_sweep): new tactics to increase malloc_limit mildly.
+
+Fri Feb 21 05:16:14 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_cmp_m): return nil if str2 does not respond to
+ both "to_str" and "<=>".
+
+ * compar.c (cmp_gt): return nil if "<=>" returns nil (means
+ incomparable).
+
+ * compar.c (cmp_ge, cmp_lt, cmp_le): ditto.
+
+ * compar.c (cmp_between): use RTEST(), since cmp_lt and cmp_gt may
+ return nil.
+
+Thu Feb 20 19:05:51 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_start_0): main thread swapped by fork() may
+ terminate rb_thread_start_0() successfully. call ruby_stop(0);
+ this change was suggested by Rudi Cilibrasi
+ <cilibrar@drachma.ugcs.caltech.edu>.
+
+Thu Feb 20 18:44:51 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * file.c (file_expand_path): fix wrong behavior for root file.
+ expand_path("..", "//machine/share") => "//machine/share"
+ expand_path("..", "c:/a") => "c:/"
+ expand_path("..", "/a") => "/"
+
+Thu Feb 20 18:11:01 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * file.c (file_expand_path): should not upward beyond share name.
+
+Thu Feb 20 15:45:33 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * missing.h (strtoul): fix prototype of strtoul.
+
+Thu Feb 20 10:11:30 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (clhs): allow "Foo::Bar = x".
+
+Thu Feb 20 04:07:06 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (primary): "self[n]=x" can be legal even when "[]=" is
+ private. changes submitted in [ruby-talk:63982]
+
+ * parse.y (aryset): ditto.
+
+ * parse.y (attrset): "self.foo=x" can be legal even when "foo="
+ is private.
+
+ * eval.c (is_defined): private "[]=" and "foo=" support.
+
+ * eval.c (rb_eval, assign): ditto.
+
+Thu Feb 20 03:58:34 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): "foo=" should not always be public.
+
+Thu Feb 20 01:23:59 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_thread_restore_context): inhibit interrupts in
+ critical section while context switching. [ruby-talk:64785]
+
+Wed Feb 19 18:27:42 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * node.h (nd_cpath): nested class/module declaration.
+ [EXPERIMENTAL]
+
+ * eval.c (rb_eval): ditto.
+
+ * gc.c (rb_gc_mark_children): ditto.
+
+ * parse.y (cpath): ditto.
+
+Tue Feb 18 21:39:27 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_call0): should not report uninitialized warning by
+ attribute reader method.
+
+ * variable.c (rb_attr_get): new function to get instance variable
+ without uninitialized warning.
+
+ * io.c (argf_to_io): should prefetch argv.
+
+Tue Feb 18 00:13:50 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * misc/ruby-mode.el (ruby-comment-column): customize comment
+ column. [new]
+
+ * misc/ruby-mode.el (ruby-deep-indent-paren): deep indentation
+ parentheses. [new]
+
+ * misc/ruby-mode.el (ruby-expr-beg): fix for / after $?.
+
+ * misc/ruby-mode.el (ruby-parse-partial, ruby-calculate-indent):
+ deep indentation support.
+
+ * misc/ruby-mode.el (ruby-forward-sexp, ruby-backward-sexp):
+ move forward/backward across one balanced expression. [new]
+
+ * misc/ruby-mode.el (ruby-indent-exp): indent balanced
+ expression. [new]
+
+ * misc/ruby-mode.el (ruby-electric-brace): indent before
+ show matching parenthesis. (contributed by NABEYA Kenichi)
+
+Mon Feb 17 14:36:56 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * win32/win32.c (rb_w32_opendir, rb_w32_utime): need parens.
+
+Mon Feb 17 14:13:25 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (link): implement with CreateHardLink().
+
+ * win32/win32.c, win32/win32.h (rb_w32_utime): enable utime() to
+ directory if on NT. [new] (ruby-bugs-ja:PR#393)
+
+Mon Feb 17 13:28:51 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * file.c (file_expand_path): strip last slash when path is
+ root.
+
+Sun Feb 16 19:22:31 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * file.c (file_expand_path): buffer might be reallocated while
+ expanding default directory.
+
+ * file.c (file_expand_path): default directory was being
+ ignored if path was full path with no drive letter, under
+ DOSISH.
+
+Sun Feb 16 03:14:33 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * io.c (prep_stdio, Init_io): always set binmode on Cygwin.
+
+Sat Feb 15 01:01:45 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * file.c (file_expand_path): fix surplus path separators while
+ expanding at root directory. [ruby-dev:19572]
+
+Fri Feb 14 14:25:24 2003 akira yamada <akira@arika.org>
+
+ * lib/uri/generic.rb, lib/uri/ldap.rb, lib/uri/mailto.ldap: all foo=()
+ returns arguments passed by caller.
+
+ * lib/uri/generic.rb (Generic#to_str, Generic#to_s): removed to_str.
+ Suggested by Tanaka Akira <akr@m17n.org> at [ruby-dev:19475].
+
+ * lib/uri/generic.rb (Generic#==): should not generate an URI object
+ from argument. Suggested by Tanaka Akira <akr@m17n.org> at
+ [ruby-dev:19475].
+
+Thu Feb 13 11:54:50 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ruby.c (ruby_init_loadpath): ensures buffer terminated
+ before use strncpy().
+
+ * ruby.c (proc_options): avoid SEGV at -S with no arguments.
+ script argument is in effect only when -e is not given.
+ (ruby-bugs-ja:PR#391)
+
+Thu Feb 13 01:30:10 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_thread_schedule): current thread may be dead when
+ deadlock. (ruby-bugs:PR#588)
+
+Thu Feb 13 00:28:52 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * range.c (range_step): step might be float 0 < x < 1.
+
+ * eval.c (rb_thread_schedule): pause if no runnable thread when
+ there's only one thread.
+
+Thu Feb 13 00:09:47 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * file.c (strrdirsep): ignore trailing directory separators.
+
+ * file.c (rb_file_s_expand_path): File.expand_path(".","/") should
+ return "/". (ruby-bugs-ja:PR#389)
+
+ * file.c (rb_file_s_basename): also ignore trailing directory
+ separators, in compliance with SUSv3. (ruby-bugs-ja:PR#390)
+
+ * file.c (rb_file_s_dirname, rb_file_s_extname): ditto.
+
+ * file.c (rb_file_s_dirname): append "." if drive only.
+
+ * file.c (rb_file_s_split): get rid of converting twice.
+
+Mon Feb 10 20:55:15 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/extmk.rb (parse_args): add '-n' to $mflags BEFORE "--".
+ do not add DESTDIR if already included in $mflags.
+
+Mon Feb 10 19:54:30 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (FileUtils#uptodate?): use mtime for
+ comparison.
+
+Mon Feb 10 10:14:26 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_to_a): return value should be an Array if the
+ receiver is an instance of subclass of Array.
+
+ * string.c (rb_str_to_s): return value should be a String if the
+ receiver is an instance of subclass of String.
+
+Mon Feb 10 03:33:42 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * io.c (rb_file_sysopen): rb_file_sysopen_internal() needs four
+ arguments.
+
+Sun Feb 9 15:16:04 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * intern.h (HAVE_RB_DEFINE_ALLOC_FUNC, RB_CVAR_SET_4ARGS):
+ define to 1.
+
+ * ruby.h (NORETURN_STYLE_NEW): ditto.
+
+Sun Feb 9 12:28:18 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/mkmf.rb (init_mkmf): add libdir to LIBPATH unless cross
+ compiling.
+
+Sun Feb 9 08:34:45 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb: 4xx raises Net::ProtoServerError, 5xx raises
+ Net::ProtoFatalError (for backward compatibility).
+
+Sun Feb 9 07:07:26 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb: new method FileUtils.pwd (really).
+
+ * lib/fileutils.rb: FileUtils.pwd, cmp, identical?, uptodate? does
+ not accept any option.
+
+Sat Feb 8 18:35:30 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * misc/ruby-mode.el (ruby-forward-string): fixed void variable
+ error.
+
+Sat Feb 8 16:23:11 2003 NABEYA Kenichi <kenichi@nabeya.com>
+
+ * misc/ruby-mode.el (ruby-font-lock-keywords): method name can
+ be delimited by tab.
+
+Sat Feb 8 03:57:32 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/irb/workspace.rb, lib/irb/ext/math-mode.rb,
+ lib/irb/ext/multi-irb.rb, lib/irb/lc/error.rb,
+ lib/irb/lc/help-message, lib/irb/lc/ja/error.rb,
+ lib/shell/command-processor.rb, lib/shell/error.rb,
+ lib/shell/filter.rb: Fix typos and grammos. [approved by: keiju]
+
+Sat Feb 8 03:34:28 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * intern.h (HAVE_RB_DEFINE_ALLOC_FUNC): New boolean macro to make
+ it easier to write extensions that work with both ~1.6 and 1.8~.
+
+ * intern.h (RB_CVAR_SET_4ARGS): Ditto.
+
+ * ruby.h (NORETURN_STYLE_NEW): Ditto.
+
+Sat Feb 8 00:47:24 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_call): calls method_missing when superclass method
+ does not exist.
+
+ * eval.c (rb_f_missing): now handles "no super" case.
+
+ * object.c (rb_obj_ivar_get): Object#instance_variable_get: new
+ method to get instance variable value without eval(). [new]
+
+ * object.c (rb_obj_ivar_set): Object#instance_variable_set: new
+ method to set instance variable value without eval(). [new]
+
+Fri Feb 7 15:35:21 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * intern.h, re.c (rb_memsearch): returns long.
+
+ * string.c (rb_str_index): should return offset position.
+
+Fri Feb 7 15:30:15 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (proc_invoke): should propagate self to super
+ methods. [ruby-dev:19510]
+
+Thu Feb 6 19:04:32 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_initialize_m): should not preset "kcode" unless
+ encoding is explicitly specified.
+
+Thu Feb 6 19:01:32 2003 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb: new method FileUtils.pwd.
+
+ * lib/fileutils.rb: default label is ''.
+
+ * lib/fileutils.rb: using module_eval again, to avoid ruby's bug.
+
+ * lib/fileutils.rb: fix wrong examples in rdoc.
+
+Thu Feb 6 17:43:56 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/complex.rb (Complex#==): should not raise error by type
+ mismatch.
+
+ * lib/rational.rb (Rational#==): ditto.
+
+Thu Feb 6 11:44:40 2003 MoonWolf <moonwolf@moonwolf.com>
+
+ * re.c (rb_reg_initialize_m): 3rd argument was ignored.
+
+Thu Feb 6 01:09:05 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_count): return 0 for empty string (was
+ returning nil).
+
+Wed Feb 5 19:41:37 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/open-uri.rb: dispatch code restructured to make it openable
+ that has `open' method.
+
+ * lib/open-uri.rb: Location: field may has a relative URI.
+ pointed out by erik eriksson <ee@opera.com>.
+
+Wed Feb 5 17:11:02 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): no .<digit> float literal anymore.
+
+Tue Feb 4 16:11:30 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_equal): a == b is true when b is non T_ARRAY
+ object, if b has "to_ary" and b == a.
+
+ * hash.c (rb_hash_equal): a == b is true when b is non T_HASH
+ object, if b has "to_hash" and b == a.
+
+ * string.c (rb_str_equal): a == b is true when b is non T_STRING
+ object, if b has "to_str" and b == a.
+
+Mon Feb 3 23:46:48 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (argf_getline): should not increment lineno at EOF.
+
+Mon Feb 3 16:49:19 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (Init_Object): default Object#=== now calls "=="
+ internally.
+
+ * re.c (rb_reg_initialize_m): should honor option status of
+ original regexp.
+
+ * array.c (rb_ary_equal): ary2 should be T_ARRAY (no to_ary
+ conversion).
+
+ * array.c (rb_ary_eql): ditto.
+
+ * string.c (rb_str_equal): str2 should be T_STRING (no to_str
+ conversion).
+
+Mon Feb 3 16:32:52 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * re.c (rb_memsearch): a little improvement.
+
+Mon Feb 3 13:18:05 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_memsearch): algorithm body of String#index.
+
+ * error.c (Init_Exception): "to_str" removed.
+
+ * eval.c (eval): should not rely on Exception#to_str
+
+ * eval.c (compile_error): ditto.
+
+ * error.c (err_append): ditto.
+
+Sat Feb 1 23:56:29 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (rb_hash_merge): Hash#merge, non destructive "update".
+ now there's also Hash#merge! which is an alias to "update".
+
+Fri Jan 31 14:16:59 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_index): search using Karp-Rabin algorithm.
+
+Fri Jan 31 12:45:11 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_obj_classname): new function.
+
+ * string.c (rb_str_dup): should preserve original's class (but not
+ hidden singleton class).
+
+ * string.c (rb_str_substr): ditto.
+
+ * parse.y: backout EXPR_CMDARG removal.
+
+Fri Jan 31 09:40:07 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/optparse.rb (OptionParser::List::accept): default
+ pattern must not be nil.
+
+ * lib/optparse.rb (OptionParser::make_switch): NoArgument doesn't
+ override other styles.
+
+Thu Jan 30 16:46:43 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/optparse.rb (OptionParser::Switch::PlacedArgument): added.
+ if the next argument doesn't start with '-', use it as the
+ value.
+
+ * lib/optparse.rb (OptionParser::make_switch): fixed a bug of
+ pattern.
+
+ * lib/optparse.rb (Array): no need to guard.
+
+Thu Jan 30 08:27:19 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * file.c (rb_file_s_expand_path): removed a sludge.
+
+Wed Jan 29 03:24:39 2003 Michal Rokos <michal@rokos.homeip.net>
+
+ * dir.c (glob_helper): memory leak fixed.
+
+Tue Jan 28 04:45:03 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * instruby.rb (parse_args), ext/extmk.rb (parse_args): Prepend a
+ hyphen to the first argument of MAKEFLAGS only if appropriate.
+ Remove wrong comments.
+
+Mon Jan 27 03:30:06 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * error.c (get_syserror): use snprintf() instead of sprintf(). pointed
+ out by knu.
+
+Mon Jan 27 02:06:38 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * error.c (get_syserror): some Windows' errno have 5 digits. pointed
+ out by znz.
+
+Sun Jan 26 19:23:10 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * instruby.rb ($mflags.set?): Check $make instead of $nmake, since
+ there is no such a variable.
+
+ * instruby.rb ($mflags.set?), ext/extmk.rb ($mflags.set?): Return
+ false if unmatched.
+
+Sun Jan 26 19:08:30 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/shellwords.rb: Embed rdoc style comments.
+
+ * lib/shellwords.rb (shellwords): Use String#lstrip!.
+
+ * lib/shellwords.rb (shellwords): Recognize an object that
+ responds to to_str() by using String.new().
+
+Sun Jan 26 17:53:04 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * instruby.rb (parse_args), ext/extmk.rb (parse_args): Detect -n
+ and emulate a dry run. Use 'make' in case no --make argument is
+ given.
+
+Sun Jan 26 07:18:42 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * instruby.rb: re-define individual methods verbosely rather than
+ including FileUtils::Verbose, in order to suppress messages from
+ FileUtils#cmp.
+
+ * instruby.rb (makedirs): make same directory only once even if
+ dryrun.
+
+ * lib/fileutils.rb (FileUtils::Verbose, FileUtils::NoWrite):
+ re-define methods with define_method instead of module_eval.
+
+Sun Jan 26 03:37:18 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * instruby.rb, ext/extmk.rb, Makefile.in, win32/Makefile.sub,
+ bcc32/Makefile.sub: Replace the complicated MFLAGS/MAKEFLAGS
+ parser with something plain and comprehensible. This fixes a
+ bug where make flags were wrongly reordered and the resulted
+ command line often did not make sense especially when BSD make
+ is used with extra arguments given. Tested with FreeBSD and
+ Linux by me and mswin32, bccwin32 and mingw by usa.
+
+Fri Jan 24 18:15:33 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y: tMINUS should have lower precedence than tPOW.
+
+Fri Jan 24 05:12:55 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * misc/ruby-mode.el (ruby-font-lock-syntactic-keywords): deal
+ with escaped $ and ? at the end of strings. [ruby-talk:62297]
+
+ * misc/ruby-mode.el (ruby-font-lock-keywords): added defined?.
+
+Thu Jan 23 17:25:04 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): do not warn discarding already undefined
+ method.
+
+ * lib/rational.rb: undef quo before replacing.
+
+Thu Jan 23 15:49:57 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (arg): missing arguments.
+
+Thu Jan 23 14:56:52 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/rational.rb: modified to support "quo".
+
+ * numeric.c (num_quo): should return most exact quotient value,
+ i.e. float by default, rational if available.
+
+ * numeric.c (num_div): "div" should return x.divmod(x)[0].
+
+Thu Jan 23 13:24:18 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_arg): was accessing garbage argv value.
+
+Thu Jan 23 06:37:01 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * instruby.rb: should not contain destdir in shebang line.
+
+Wed Jan 22 23:19:57 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (pipe_exec): remove unnecessary SetStdHandle().
+
+Wed Jan 22 20:20:59 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (arg): syntaxify tPOW negative number hack.
+
+ * parse.y (negate_lit): new function to negate literal numeric
+ values in compile time.
+
+Wed Jan 22 15:36:54 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_match_exec): charset info may be stored in MBC
+ region when $KCODE != NONE.
+
+Wed Jan 22 14:22:53 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * error.c (set_syserr): should preserve duplicated error names.
+
+Tue Jan 21 20:29:31 2003 Michal Rokos <michal@rokos.homeip.net>
+
+ * mkmf.rb: make possible to add files to clean and distclean targets
+
+Tue Jan 21 18:05:25 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * bcc32/Makefile.sub (LIBRUBY_A): link dmyext.
+
+Tue Jan 21 16:59:18 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * instruby.rb: use real interpreter pathname at shebang line.
+ [ruby-dev:19370]
+
+Tue Jan 21 16:22:32 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (arg): put back old ** behavior for negative number
+ right operand.
+
+Tue Jan 21 14:46:12 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pp.rb: Use Test::Unit.
+
+ * lib/prettyprint.rb: Ditto
+
+ * lib/time.rb: Ditto
+
+ * lib/tsort.rb: Ditto
+
+Tue Jan 21 04:15:50 2003 Tanaka Akira <akr@m17n.org>
+
+ * lib/pp.rb: Use redefined `to_s' as well as `inspect'.
+ Useless `pretty_print' methods removed.
+ (PP::ObjectMixin#pretty_print_inspect): new method.
+
+Mon Jan 20 21:48:43 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * configure.in (MANTYPE): Detect if the system's nroff(1) groks
+ mdoc. Provide a new option --with-mantype={doc|man} in case the
+ check does not work as expected.
+
+ * Makefile.in (MANTYPE): Define MANTYPE and pass it to
+ instruby.rb.
+
+ * instruby.rb: Convert mdoc manpages to man for systems which
+ nroff(1) does not grok mdoc.
+
+Mon Jan 20 21:25:18 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/tempfile.rb (self.open): If a block is given, call it with
+ tempfile as an argument and automatically close the tempfile
+ when the block terminates.
+
+Mon Jan 20 21:02:50 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * mdoc2man.rb: Properly put nested braces, parentheses and angles.
+
+ * mdoc2man.rb: Add support for .An and .Aq/.Ao/.Ac.
+
+ * mdoc2man.rb: Add support for .Dl.
+
+ * mdoc2man.rb: Make .Pf macro actually work.
+
+ * mdoc2man.rb: Properly handle .Os.
+
+ * mdoc2man.rb: Correctly omit spaces around punctuation
+ characters.
+
+Mon Jan 20 19:43:41 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * mdoc2man.rb: Make this work as a library.
+
+Mon Jan 20 18:22:40 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_f_require): purge too many goto's.
+
+Mon Jan 20 17:50:05 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * mdoc2man.rb (parse_macro): Understand .Ux.
+
+Mon Jan 20 17:32:56 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * mdoc2man.rb: New file. A mdoc to man converter ported from
+ Perl.
+
+Mon Jan 20 15:40:15 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * ruby.1: Properly close .Bl with .El.
+
+Mon Jan 20 04:14:17 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/mkmf.rb (egrep_cpp): use inspect to show options.
+
+ * lib/mkmf.rb (dir_config): prior configured directories to
+ defaults.
+
+ * lib/mkmf.rb (dir_config): extract first word to determine
+ make command type.
+
+Mon Jan 20 02:15:53 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/aix_mksym.rb: no longer used.
+
+Mon Jan 20 00:17:16 2003 Matt Armstrong <matt@lickey.com>
+
+ * file.c (eaccess): under windows, make eaccess() just call
+ access(). [ruby-core:716], [ruby-bugs:PR#556]
+
+Sun Jan 19 23:08:18 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/shellwords.rb (shellwords): A backslash ('\') in single
+ quotes should not be regarded as meta character. This bug or
+ maybe feature was inherited from Perl's shellwords.pl.
+
+Sun Jan 19 14:01:12 2003 UENO Katsuhiro <unnie@blue.sky.or.jp>
+
+ * regex.c (is_in_list): should work well with UTF-8.
+
+ * regex.c (re_match_exec): ditto.
+
+Sat Jan 18 14:53:49 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * bignum.c (rb_cstr_to_inum): should not erase all 0s, but
+ squeeze into one. [ruby-dev:19377]
+
+Fri Jan 17 03:33:42 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * sprintf.c (rb_f_sprintf): Fix a bug caused by an uninitialized
+ variable v, that a bignum unexpectedly gets converted into a
+ string with its higher figures all filled with ./f/7/1,
+ depending on the base. This bug seems to have been introduced
+ in rev.1.27.
+
+ * sprintf.c (rb_f_sprintf): Use switch instead of a sequence of
+ else-if's.
+
+Wed Jan 15 15:18:38 2003 moumar <moumar@netcourrier.com>
+
+ * configure.in (ARCHFILE): set even unless --enable-shared on
+ AIX. [ruby-talk:61466]
+
+ * marshal.c (math.h): should be included after ruby.h on AIX.
+ [ruby-talk:61366]
+
+Tue Jan 14 21:47:56 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_f_require): do not search adding .rb/.so suffixes if
+ the suffix specified. [ruby-dev:18702]
+ http://moonrock.jp/~don/d/200211.html#d08_t1
+
+Tue Jan 14 18:36:41 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * enum.c (enum_all): now works without block.
+
+ * enum.c (enum_any): ditto.
+
+Tue Jan 14 01:21:32 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * io.c (next_argv): not always set binmode.
+
+Mon Jan 13 20:45:19 2003 Guy Decoux <ts@moulon.inra.fr>
+
+ * parse.y (list_append): avoid O(n) search using node->nd_next->nd_end.
+
+ * parse.y (list_concat): ditto.
+
+ * eval.c (rb_eval): NODE_ARRY nd_end adoption.
+
+Mon Jan 13 02:22:11 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/dl/lib/dl/win32.rb: eliminate unnecessary "A" adding.
+
+Sun Jan 12 16:07:17 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * io.c (next_argv): inherit binmode from $defout.
+
+Sat Jan 11 22:50:47 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/dl/lib/dl/win32.rb: compatibility improvement.
+
+Sat Jan 11 01:44:16 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * configure.in (RUBY_CHECK_IO_NEED): added more tests.
+
+ * io.c (rb_io_check_readable): seek after synchronized write.
+
+Fri Jan 10 01:23:45 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * misc/ruby-mode.el (ruby-font-lock-syntactic-keywords): syntax
+ classes are not allowed inside character classes.
+ [ruby-talk:60996]
+
+Thu Jan 9 23:28:01 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * configure.in: AC_MSG_FAILURE is a new macro in 2.54b or later.
+
+Thu Jan 9 17:05:24 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * configure.in (RUBY_CHECK_IO_NEED): check whether fseek() and
+ fflush() are needed.
+
+ * io.c (flush_before_seek): flush write stream only.
+
+ * io.c (rb_io_check_readable): seek instead of flush if the last
+ operation was write.
+
+ * io.c (rb_io_check_writable): seek instead of flush if the last
+ operation was read.
+
+ * bcc32/Makefile.sub, win32/Makefile.sub: needs to seek between
+ R/W.
+
+Thu Jan 9 16:31:51 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): should not discard nested NODE_BLOCK.
+
+Thu Jan 9 15:12:30 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (stmt): NODE_NOT elimination for if/unless/while/until node.
+
+ * parse.y (primary): ditto.
+
+Thu Jan 9 13:26:18 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * st.h, st.c: Back out the introduction of st_*_func_t. Some
+ compilers complain about function type mismatch.
+
+Thu Jan 9 02:10:44 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): reduce recursive rb_eval() call by using sort
+ of continuation passing style.
+
+Wed Jan 8 17:10:32 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/Win32API/lib/win32/registry.rb: added. [new]
+
+Wed Jan 8 15:54:05 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c: remove ruby_last_node and assignments seems to be
+ unnecessary
+
+ * intern.h: debug does not run if ID_ALLOCATOR is zero.
+
+Wed Jan 8 15:04:11 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * range.c (range_each): treat fixnums specially to boost.
+
+ * numeric.c (num_step): remove rb_scan_args() for small speedup.
+
+Tue Jan 7 17:56:08 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (svalue_to_avalue): should return converted array.
+
+Tue Jan 7 07:48:01 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_f_local_variables): skip $_, $~ and flip states in
+ dynamic variables. [ruby-core:00681]
+
+Tue Jan 7 02:46:29 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (env_clear): new Hash compatible method.
+
+ * hash.c (env_shift, env_invert, env_replace, env_update): ditto.
+
+Mon Jan 6 23:36:29 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * st.h, st.c: Introduce new conventional typedef's, st_data_t,
+ st_compare_func_t, st_hash_func_t and st_each_func_t.
+
+ * st.h, st.c: Do explicit function declarations and do not rely on
+ implicit declarations.
+
+ * class.c, eval.c, gc.c, hash.c, marshal.c, parse.y, variable.c:
+ Add proper casts to avoid warnings.
+
+Mon Jan 6 20:44:43 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * intern.h (rb_check_array_type): Declare rb_check_array_type().
+
+ * ext/digest/md5/md5ossl.c: Include stdio.h for sprintf() and
+ string.h for memcmp().
+
+ * ext/dl/ptr.c: Include ctype.h for isdigit().
+
+Mon Jan 6 18:43:17 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * file.c: improve DOSISH drive letter support.
+
+Mon Jan 6 18:31:45 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/fileutils.rb (ln): add ' -f' in the verbose message.
+
+ * lib/fileutils.rb (cp_r): add 'p' in the verbose message.
+
+Mon Jan 6 16:44:52 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_join): dispatch based on "to_str".
+
+ * array.c (rb_ary_times, rb_ary_equal): ditto.
+
+Mon Jan 6 13:26:35 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * process.c (proc_exec_v): follow to proc_spawn_v(). call do_aspawn()
+ on Win32.
+
+ * process.c (rb_proc_exec): call do_spawn() on Win32.
+
+ * win32/win32.c, win32/win32.h (do_spawn, do_aspawn): add mode flag.
+
+ * process.c (proc_spawn_v, rb_f_system): follow above change.
+
+Mon Jan 6 05:11:15 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/extmk.rb: make $0 normal variable.
+
+Mon Jan 6 02:32:46 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * struct.c (make_struct): needs meta class.
+
+Sun Jan 5 22:54:05 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/fileutils.rb (ln): `argv' is not a argument.
+
+Sun Jan 5 17:44:37 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/extmk.rb (extmake): set $0 temporarily while loading
+ extconf.rb.
+
+Sun Jan 5 14:46:46 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * instruby.rb: need paren in regexp(make -n install).
+
+ * ext/extmk.rb (sysquote): do not need to quote on mswin/bccwin/mingw.
+
+ * ext/extmk.rb ($mflags): uniq items and remove '-' and '--'.
+ move options to the lead.
+
+ * lib/fileutils.rb (install): model on the real install
+ command(message).
+
+Sun Jan 5 09:36:46 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ruby.c (ruby_init_loadpath): under Windows, get the module
+ path from an internal address instead of hard coded library
+ name.
+
+ * cygwin/GNUmakefile.in, bcc32/Makefile.sub,
+ win32/Makefile.sub (CPPFLAGS): removed LIBRUBY_SO macro.
+
+ * bcc32/Makefile.sub, win32/Makefile.sub (config.h): no longer
+ depends on makefiles.
+
+Sun Jan 5 04:17:05 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * gc.c (SET_STACK_END): Issue a FLUSH_REGISTER_WINDOWS here too.
+ This fixes make test on FreeBSD/sparc64.
+
+Sun Jan 5 03:43:47 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * defines.h (FLUSH_REGISTER_WINDOWS): Make the flushw call an
+ inline function so it can be used as an expression.
+
+ * eval.c (EXEC_TAG, THREAD_SAVE_CONTEXT): Consistently call
+ FLUSH_REGISTER_WINDOWS before calling setjmp(). (I suspect that
+ every setjmp() implementation should take care of register
+ windows, though)
+
+Sun Jan 5 03:12:32 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * file.c (utimbuf): use utimbuf instead of _utimbuf if defined _WIN32.
+
+ * win32/Makefile.sub (LIBS): use oldnames.lib.
+
+ * win32/win32.c (rb_w32_getcwd): follow above change.
+
+ * win32/win32.h: ditto.
+
+ * wince/direct.c, wince/direct.h (getcwd): ditto.
+
+ * wince/io.h: ditto.
+
+ * wince/string.c, wince/wince.h (stricmp, strnicmp): ditto.
+
+Sat Jan 4 15:18:50 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * process.c (rb_proc_exec): use same logic as DJGPP on win32 ports.
+
+ * process.c (rb_f_system): ditto.
+
+ * win32/win32.c, win32/win32.h (do_aspawn): [new]. for arrayed
+ arguments.
+
+ * win32/win32.c (CreateChild): add new argument for real filename of
+ executing process.
+
+ * win32/win32.c (NtHasRedirection, pipe_exec): follow above change.
+
+Sat Jan 4 14:29:52 2003 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * configure.in: set rb_cv_need_io_flush_between_seek=yes.
+
+ * win32/Makefile.sub (config.h): define NEED_IO_FLUSH_BETWEE_SEEK.
+ (pointed out by moriq [ruby-dev:19299])
+
+Sat Jan 4 03:12:14 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (umethod_bind): exact class match is not required. relax
+ the restriction to subclasses.
+
+Sat Jan 4 01:33:40 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * file.c (rb_file_s_lchmod): get rid of gcc-3 -O3 warning.
+
+Fri Jan 3 22:26:07 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * process.c (rb_proc_times): need to initialize first.
+
+Fri Jan 3 01:10:17 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): call "inherited" before executing class body.
+
+ * class.c (rb_define_class): call "inherited" after defining the
+ constant.
+
+ * class.c (rb_define_class_under): ditto.
+
+Thu Jan 2 19:37:30 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (massign): expand first element if RHS is an array and
+ its size is 1, and LHS has concrete assignment target (i.e. LHS
+ has target(s) other than *var).
+
+ * eval.c (massign): avoid unnecessary avalue/svalue conversion.
+
+ * eval.c (rb_yield_0): ditto
+
+ * array.c (rb_ary_update): do not allocate unused array if rpl is
+ nil (i.e. merely removing elements).
+
+Thu Jan 2 13:55:08 2003 Mathieu Bouchard <matju@sympatico.ca>
+
+ * io.c (io_read): should resize supplied string if it's shorter
+ than expected.
+
+Thu Jan 2 11:01:20 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (bmcall): arguments should be an array.
+
+Wed Jan 1 18:18:45 2003 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: better DJGPP support. add GNUmakefile.
+
+ * djgpp/GNUmakefile: new.
+
+Wed Jan 1 04:16:18 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * node.h (struct RNode): Change argc from int to long. Otherwise
+ NEW_CFUNC() sets argc to a wrong value on platforms where
+ sizeof(int) != sizeof(long) and the byte order is big-endian.
+ This fixes breakage on FreeBSD/sparc64.
+
+Tue Dec 31 23:22:50 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (massign): removed awkward conversion between yvalue,
+ mvalue, etc.
+
+ * eval.c (rb_yield_0): new parameter added to tell whether val is
+ an array value or not.
+
+ * parse.y (yield_args): restructuring: new nodes: NODE_RESTARY2,
+ NODE_SVALUE; removed node: NODE_RESTARGS.
+
+Tue Dec 31 21:13:51 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * Makefile.in, {win32,bcc32}/Makefile.sub: add new target:
+ what-where, no-install.
+
+ * mkconfig.rb: add const: CROSS_COMPILING.
+
+ * ext/extmk.rb: no-install support. add MAKEDIRS macro.
+
+ * lib/mkmf.rb: add !ifdef .. !endif for Borland make.
+
+ * process.c: improve DJGPP support. system "ls", "-l".
+
+Tue Dec 31 20:16:37 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/socket/addrinfo.h (NI_MAXHOST): Define NI_MAXHOST and
+ NI_MAXSERV only if they are not defined yet. This fixes build
+ on such platforms as OpenBSD.
+
+Tue Dec 31 20:07:49 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/tcltklib/extconf.rb (find_tcl, find_tk): Look for both
+ lib{tcl,tk}M.N and lib{tcl,tk}MN on all platforms. *BSD have
+ Tcl/Tk libraries named this way.
+
+Tue Dec 31 19:48:21 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * configure.in: Improve OpenBSD support. [obtained from: OpenBSD
+ ports]
+
+ * dln.c (FUNCNAME_PATTERN): Ditto.
+
+Tue Dec 31 19:21:02 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * array.c (rb_ary_transpose): Properly declare ary as a VALUE.
+
+ * file.c (rb_file_s_chmod): Do not directly cast an int to void *
+ to avoid a warning.
+
+ * defines.h (FLUSH_REGISTER_WINDOWS): Add support for
+ FreeBSD/sparc64. miniruby still coredumps in a different place,
+ though.
+
+Tue Dec 31 07:47:15 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (parse_string): readjusted.
+
+ * parse.y (heredoc_identifier): readjusted.
+
+ * parse.y (here_document): make EOL codes of single-quoted
+ here-documents consistent.
+
+ * parse.y (yylex): reduced unnecessary conditionals.
+
+Tue Dec 31 04:49:51 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ruby.1: mdoc'ify.
+
+Tue Dec 31 01:30:29 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * parse.y (yylex): do not accept " __END__\n". ([ruby-dev:19245])
+
+Mon Dec 30 21:10:59 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * parse.y (yylex): use strncmp instead of strcmp.
+ accept "__END__\r\n". ([ruby-dev:19241])
+
+Mon Dec 30 20:32:14 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (rb_gc_mark_frame): should mark frame->node.
+
+Mon Dec 30 19:10:30 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/extmk.rb: split --make argument contains options, assume
+ the first word of --make-flags is always options even unless
+ preceded by -, and ignore letter-case of options if nmake.
+
+ * instruby.rb: extract -n option also from --make and
+ --make-flags.
+
+ * bcc32/Makefile.sub, win32/Makefile.sub: not prepend - to
+ $(MFLAGS)
+
+Mon Dec 30 16:44:14 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * string.c (rb_str_substr): should share the shared string if
+ present, instead of the original string. (ruby-bugs:PR#528)
+
+Mon Dec 30 05:10:00 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/socket/socket.c (tcp_svr_init): local host to
+ init_inetsock() is VALUE but not pointer.
+
+ * ext/socket/socket.c (sock_s_unpack_sockaddr_in): get rid of
+ gcc-3 -O3 warning.
+
+Sun Dec 29 23:45:53 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * gc.c (gc_sweep): adjust GC trigger.
+
+ * dln.c (init_funcname_len): get rid of gcc-3 -O3 warning.
+
+ * eval.c (copy_node_scope): ditto.
+
+ * hash.c (rb_hash_foreach, delete_if_i, select_i, each_value_i,
+ each_key_i, each_pair_i, envix): ditto.
+
+ * range.c (range_each_func): ditto.
+
+ * file.c (rb_file_s_chmod): ditto.
+
+Sun Dec 29 15:30:37 2002 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (fu_parseargs): should not inherit ftools.rb's
+ misfeature.
+
+Sun Dec 29 05:08:13 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/fileutils.rb (cmp): return false if file size differs.
+
+Sat Dec 28 19:21:24 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * instruby.rb: remove junk args.
+
+ * lib/mkmf.rb (create_makefile): remove a trouble library
+ before making a shared library.
+
+ * win32/Makefile.sub: invoke instruby.rb with the --make-flags option.
+
+Sat Dec 28 03:09:58 2002 Wakou Aoyama <wakou@ruby-lang.org>
+
+ * lib/cgi.rb (CGI#[]): improvement. thanks to Kazuhiro NISHIYAMA
+ <zn@mbf.nifty.com>
+
+Sat Dec 28 00:34:03 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * {win32,bcc32}/Makefile.sub: remove `=' from --make-flags options.
+ nmake quotes args if included `=' in args.
+
+ * instruby.rb: use getopts.rb.
+
+ * ext/dbm/extconf.rb (-DDBM_HDR): substitute ' with " to avoid
+ a error on Win32.
+
+ * ext/gdbm/gdbm.c: add prototypes to avoid VC++ warnings.
+
+Fri Dec 27 21:41:57 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * bcc32/setup.mak, win32/setup.mak(-prologue-): move srcdir from
+ CPP input or UNC path will be removed as a comment.
+
+Fri Dec 27 17:55:00 2002 Takaaki Uematsu <mail@uema2.cjb.net>
+
+ * wince/config, wince/configure.bat: replace 1.7 with 1.8
+ in macros.
+
+Fri Dec 27 13:28:14 2002 Minero Aoki <aamine@loveruby.net>
+
+ * instruby.rb: fileutils.rb accepts only one argument.
+
+Fri Dec 27 13:23:29 2002 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (fu_parseargs): reject illegal options
+ correctly.
+
+ * lib/fileutils.rb (uptodate?): parameter declaration was wrong.
+
+ * lib/fileutils.rb: change coding styles.
+
+Fri Dec 27 09:25:22 2002 ABE Shigeru <shiger-a@nifty.com>
+
+ * process.c (rb_proc_times): avoid WindowsXP crash using volatile
+ variables.
+
+Fri Dec 27 02:56:58 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * instruby.rb: check only `-' option, and use fileutils instead of
+ ftools.
+
+Fri Dec 27 02:45:17 2002 Wakou Aoyama <wakou@ruby-lang.org>
+
+ * lib/net/telnet.rb: Telnet#print not add "\n".
+
+ * lib/cgi.rb: cgi['key'] is equal cgi['key'][0]
+
+Thu Dec 26 22:33:18 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/extmk.rb (create_makefile): check only `-' option.
+
+ * configure.in: cleanups for MinGW. remove -D__NO_ISOCEXT in $CFLAGS.
+
+ * win32/win32.h: prototypes for isinf, isnan are not needed on MinGW.
+
+Thu Dec 26 19:22:00 2002 YOSHIDA Kazuhiro <moriq@moriq.com>
+
+ * win32/setup.mak (-prologue-): moved srcdir macro definition.
+ [ruby-win32:420].
+
+Wed Dec 25 18:26:44 2002 K.Kosako <kosako@sofnec.co.jp>
+
+ * regex.c (re_match): fixed wrong \G behavior. (ruby-bugs-ja:PR#377)
+
+Wed Dec 25 16:41:16 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_match_exec): fix odd \G behavior based on the patch
+ from Nobu.
+
+Wed Dec 25 11:05:11 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * bcc32/setup.mak (-generic-): removed garbages.
+
+Wed Dec 25 10:36:20 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * bcc32/Makefile.sub, win32/Makefile.sub (RUBY_SO_NAME, config.h):
+ use $(MAJOR) and $(MINOR). based on Nobu's patch. [ruby-win32:413]
+
+ * bcc32/setup.mak, win32/setup.mak (-prologue-): define MAJOR, MINOR
+ and TEENY from version.h. based on Nobu's patch. [ruby-win32:413]
+
+ * win32/Makefile.sub (config.h): add HAVE_FLOAT_H.
+
+ * win32/Makefile.sub (parse.obj): depend on win32/win32.h.
+
+Tue Dec 24 23:49:16 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/irb/completion.rb: Use Object#class rather than Object#type.
+
+Tue Dec 24 23:37:40 2002 TADA Tadashi <sho@spc.gr.jp>
+
+ * lib/cgi.rb (Cookie::parse), lib/cgi-lib.rb (initialize): Do not
+ pass to split() a bare string longer than 2 characters as
+ separator.
+
+Tue Dec 24 19:19:24 2002 Tietew <tietew@tietew.net>
+
+ * numeric.c (DBL_MAX_10_EXP): fix typo. [ruby-dev:19175]
+
+Tue Dec 24 17:02:46 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_undefined): use NoMethodError instead of fatal.
+
+Tue Dec 24 02:12:45 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/README: Synchronize with reality.
+
+Tue Dec 24 02:05:51 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * MANIFEST, lib/README, lib/ipaddr.rb: Add ipaddr.rb from rough.
+
+Sun Dec 22 04:07:47 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/dbm/dbm.c (fdbm_alloc): allocator takes only one argument.
+
+Sun Dec 22 02:49:25 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * array.c (ary_alloc), dir.c (dir_s_alloc), eval.c (thgroup_s_alloc),
+ file.c (rb_stat_s_alloc), hash.c (hash_alloc), io.c (io_alloc),
+ object.c (rb_module_s_alloc, rb_class_allocate_instance),
+ re.c (match_alloc, rb_reg_s_alloc), string.c (str_alloc),
+ time.c (time_s_alloc), ext/digest/digest.c (rb_digest_base_alloc),
+ ext/tcltklib/tcltklib.c (ip_alloc),
+ ext/win32ole/win32ole.c (fole_s_allocate, fev_s_allocate)
+ : add prototype to get rid of VC++ warnings.
+
+ * ext/sdbm/init.c (fsdbm_alloc): allocator takes only one argument.
+
+Sun Dec 22 00:36:43 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/mkmf.rb (create_makefile): accept pure ruby libraries.
+
+Sat Dec 21 23:59:42 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (ins_methods_i): should not show ID_ALLOCATOR.
+
+ * class.c (ins_methods_prot_i): ditto.
+
+ * class.c (ins_methods_priv_i): ditto.
+
+ * class.c (ins_methods_pub_i): ditto.
+
+ * eval.c (call_trace_func): ditto.
+
+ * eval.c (rb_undefined): ditto.
+
+Sat Dec 21 07:27:24 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * misc/ruby-mode.el (ruby-parse-partial): keywords must not be
+ preceded by @ or $.
+
+Fri Dec 20 20:29:04 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/curses/curses.c, ext/dbm/dbm.c, ext/digest/digest.c,
+ ext/dl/handle.c, ext/dl/ptr.c, ext/dl/sym.c, ext/gdbm/gdbm.c,
+ ext/iconv/iconv.c, ext/sdbm/init.c, ext/stringio/stringio.c,
+ ext/strscan/strscan.c, ext/tcltklib/tcltklib.c,
+ ext/win32ole/win32ole.c: use rb_define_alloc_func().
+
+Fri Dec 20 18:29:04 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * io.c (rb_io_fwrite): separated from io_write().
+
+ * marshal.c (w_byten): use rb_io_fwrite() to support non-blocking
+ IO, and added error check.
+
+ * rubyio.h: prototypes; rb_io_fwrite
+
+Fri Dec 20 17:40:59 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (Init_Object): should not remove Class#allocate.
+
+ * lib/profiler.rb: separate profiling functions, without
+ trace_func and at_exit setting.
+
+Fri Dec 20 16:20:04 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (do_block): split "do" block and tLBRACE_ARG block.
+
+ * parse.y (cmd_brace_block): new tLBRACE_ARG block rule
+
+ * parse.y (command): can take optional cmd_brace_block; use %prec
+ to resolve shift/reduce conflict. (ruby-bugs-ja PR#372)
+
+ * eval.c (ruby_finalize): trace_func should be cleared here (after
+ executing exit procs and finalizers).
+
+ * eval.c (rb_define_alloc_func): new allocation framework, based
+ on Nobu's work [ruby-dev:19116]. "allocate" method is no longer
+ used for object allocation.
+
+Fri Dec 20 05:06:49 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/README, lib/cgi/ftplib.rb, lib/telnet.rb: Delete ftplib.rb
+ and telnet.rb. It has been quite some time sinc they were
+ obsoleted and made to emit warnings.
+
+Fri Dec 20 04:58:22 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/tempfile.rb: Embed Rdoc style comments.
+
+ * lib/tempfile.rb: Add length as an alias for size.
+
+Fri Dec 20 03:57:32 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/tempfile.rb: Add Tempfile#close!() as a shorthand for
+ Tempfile#close(true).
+
+ * lib/tempfile.rb: Add Tempfile#{unlink,delete}().
+
+Fri Dec 20 03:53:01 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/README, lib/cgi/final.rb, lib/cgi/session.rb: Delete
+ final.rb, which was obsoleted long ago.
+
+Fri Dec 20 00:16:06 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * re.c (rb_reg_match_pre, rb_reg_match_post, match_to_a,
+ match_select): return instances of same class as the original
+ string. [ruby-dev:19119]
+
+Thu Dec 19 22:55:49 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * numeric.c (DBL_EPSILON): fix typo.
+
+Thu Dec 19 22:35:20 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (assign): avoid [BUG] at multiple attribute assignment.
+
+Thu Dec 19 01:00:09 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (num_step): use DBL_EPSILON.
+
+ * array.c (rb_check_array_type): new function: return an array
+ (convert if possible), or nil.
+
+ * string.c (rb_check_string_type): new function: return a string
+ (convert if possible), or nil.
+
+ * numeric.c (rb_dbl_cmp): returns nil if values are not
+ comparable.
+
+ * numeric.c (fix_cmp,flo_cmp): use rb_num_coerce_cmp()
+
+ * bignum.c (rb_big_cmp): ditto.
+
+ * numeric.c (rb_num_coerce_cmp): new coercing function for "<=>",
+ which does not raise TypeError.
+
+ * numeric.c (do_coerce): can be suppress exception now.
+
+ * object.c (rb_mod_cmp): should return nil for non class/module
+ objects.
+
+Thu Dec 19 04:21:10 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/open-uri.rb: add a missing ||. (found by: ruby -wc)
+
+Wed Dec 18 17:53:05 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_eqq): return false if the argument is not a
+ string. now returns boolean value.
+
+ * class.c (rb_include_module): argument should be T_MODULE, not
+ T_class, nor T_ICLASS.
+
+Wed Dec 18 03:52:55 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * string.c (rb_str_new4): handle tail shared string.
+ (ruby-bugs-ja:PR#370)
+
+ * string.c (rb_str_dup_frozen): ditto.
+
+Tue Dec 17 21:08:29 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * node.h (NODE_ATTRASGN): new node, assignment to attribute.
+ [ruby-core:00637].
+
+ * eval.c (is_defined, rb_eval): ditto.
+
+ * parse.y (attrset, node_assign): ditto.
+
+ * string.c (rb_str_substr): tail sharing. [ruby-core:00650]
+
+ * re.c (rb_reg_nth_match): ditto.
+
+Tue Dec 17 16:52:38 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (is_defined): "defined?" should return "assignment" for
+ attribute assignment (e.g. a.foo=b) and indexed assignment
+ (e.g. a[2] = 44).
+
+ * parse.y (aryset): use NODE_ATTRASGN.
+
+Tue Dec 17 04:03:45 2002 Tanaka Akira <akr@m17n.org>
+
+ * lib/open-uri.rb: new file.
+
+Tue Dec 17 00:28:19 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * file.c (utimbuf): need to define for VC++.
+
+Mon Dec 16 15:53:20 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (nextc): get rid of overrun. (pointed out by akr
+ [ruby-list:36773])
+
+Sun Dec 15 21:16:44 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/mkmf.rb (init_mkmf): add $(topdir) to $LIBPATH if $extmk.
+ remove adding $(archdir) to $LIBPATH.
+
+Sat Dec 15 12:15:00 2002 Takaaki Uematsu <mail@uema2.cjb.net>
+
+ * configure.in, defines.h, dir.c, dir.h, dln.c, error.c,
+ eval.c, file.c, hash.c, io.c, main.c, missing.c,
+ process.c, ruby.c, rubysig.h, signal.c, st.c, util.c, util.h,
+ bcc/Makefile.sub, win32/Makefile.sub, win32/win32.h,
+ ext/Win32API/Win32API.c, ext/socket/getaddrinfo.c,
+ ext/socket/getnameinfo.c, ext/socket/socket.c,
+ ext/tcltklib/stubs.c
+ : replace "NT" with "_WIN32", add DOSISH_DRIVE_LETTER
+ * wince/exe.mak : delete \r at the end of lines.
+ * wince/mswince-ruby17.def : delete rb_obj_become
+
+Sun Dec 15 11:43:26 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (dispose_string): dispose String object.
+
+ * parse.y (heredoc_restore, here_document): fix memory leak.
+
+Sat Dec 14 14:25:00 2002 Takaaki Uematsu <mail@uema2.cjb.net>
+
+ * wince/sys : add stat.c, stat.h, timeb.c, timeb.h,
+ types.h, utime.c, utime.h
+ * wince/dll.mak : object file name changed.
+ * wince/io.c : add empty dup2().
+ * wince/io.h : add dup2 definition.
+
+Sat Dec 14 01:51:29 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/dbm/extconf.rb (rb_check): support for GNU dbm 1.8.3.
+ (-with-dbm-type=gdbm_compat). link against -lgdbm_compat
+ and -lgdbm.
+
+Fri Dec 13 23:42:16 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/dbm/extconf.rb (db_check): check existence of the function
+ in the specified library before checking it in libc.
+
+Fri Dec 13 17:15:49 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (generic_ivar_get): should always warn uninitialized
+ instance variables.
+
+Fri Dec 13 12:33:22 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (expr): rescue clause was ignored.
+
+Thu Dec 12 18:19:14 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in (RUBY_PROG_GNU_LD): add $CFLAGS, $CPPFLAGS, $LDFLAGS
+ to the option of $CC.
+
+ * configure.in: set LIBRUBYARG to '-l$(RUBY_SO_NAME)' if the
+ target os is cygwin and --disable-shared option is supplied.
+
+ * lib/mkmf.rb (init_mkmf): expand config["LIBRUBY"] and
+ config["LIBRUBY_A"]. don't link $LIBRUBYARG_STATIC if
+ --disable-shared option is supplied.
+
+ * configure.in (RUBY_CPPOUTFILE): should be a better message.
+
+ * ext/Win32API/extconf.rb: join with a space.
+
+Thu Dec 12 17:27:19 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_hash): define Regexp#hash to make regexps to be
+ hash keys.
+
+ * re.c (Init_Regexp): define Regexp#eql? (alias to Regexp#==).
+
+Thu Dec 12 16:26:31 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * marshal.c (r_object0): singleton class instance can't be loaded.
+ (ruby-bugs-ja:PR#366)
+
+Wed Dec 11 23:35:43 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/extmk.rb (create_makefile): -no-undefined -> --no-undefined.
+
+Wed Dec 11 17:54:59 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (io_read): takes optional second argument to specify a
+ string to be written. the string should not be frozen.
+
+ * io.c (rb_io_sysread): ditto.
+
+Wed Dec 11 11:30:28 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/digest/digest.c (rb_digest_base_copy): renamed "become".
+
+ * ext/stringio/stringio.c (strio_copy): ditto.
+
+Wed Dec 11 00:45:00 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/getoptlong.rb (GetoptLong::Error): provide a common ancestor
+ for GetoptLong error classes (RCR#129).
+
+Tue Dec 10 17:42:39 2002 K.Kosako <kosako@sofnec.co.jp>
+
+ * re.c (rb_reg_copy_object): fixed memory leak.
+
+Tue Dec 10 17:30:35 2002 Tanaka Akira <akr@m17n.org>
+
+ * pack.c (utf8_limits): fix the limit of 4 bytes UTF-8 sequence.
+
+Tue Dec 10 12:01:15 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (mnew): original class of method defined in module should
+ be the module not intermediate class. [ruby-dev:19040]
+
+Tue Dec 10 01:16:52 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * sprintf.c (rb_f_sprintf): preceding ".." for negative numbers
+ still left; removed.
+
+ * sprintf.c (rb_f_sprintf): should not prepend '0' if width > prec
+ for example "%5.3d".
+
+Sat Dec 7 18:14:23 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * process.c (Init_process): add Process.exit and Process.abort
+
+ * pack.c (utf8_to_uv): raise ArgumentError for malformed/redundant
+ UTF-8 sequences.
+
+Fri Dec 6 03:46:00 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * process.c (last_status_set): add pid attribute to Process::Status.
+
+Wed Dec 4 17:31:42 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * pack.c (uv_to_utf8): limit maximum length of the encoded string
+ to 6 bytes, even when the platform supports 8 bytes long integers.
+
+ * pack.c (utf8_to_uv): do not decode sequences longer than 6 bytes.
+
+ * object.c (copy_object): use "copy_object" method, not "become".
+
+Wed Dec 4 16:37:11 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (copy_object): copy finalizers as well if any.
+
+ * gc.c (rb_gc_copy_finalizer): new function to copy finalizers.
+
+Tue Dec 3 01:13:41 2002 Tanaka Akira <akr@m17n.org>
+
+ * lib/pp.rb (PP.singleline_pp): new method.
+
+Sun Dec 1 23:04:03 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/optparse.rb (OptionParser::new): same as OptionParser#on but
+ returns new OptionParser::switch.
+
+Sun Dec 1 22:43:29 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * win32/win32.c (rb_w32_stat): empty path is invalid, and return
+ ENOENT rather than EBADF in such case. [ruby-talk:57177]
+
+Fri Nov 29 18:01:48 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * pack.c (utf8_to_uv): added checks for malformed or redundant
+ UTF-8 sequences.
+
+Thu Nov 28 12:08:30 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/mkmf.rb: Avoid the use of "clean::" in favor of "clean:" in
+ order not to let make(1) choke if there is another dependency on
+ the target added in a depend file.
+
+Thu Nov 28 02:40:42 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/mkmf.rb: Make sure to dig the destination directory before
+ installing a file there. Formerly "make install" could fail
+ depending on make(1)'s mood of the moment, especially when -jN
+ is given.
+
+Wed Nov 27 17:39:38 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/syslog/syslog.c: Cut redundancy.
+
+ * ext/syslog/syslog.c: Do not leak ident.
+
+Wed Nov 27 17:25:29 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/syslog/syslog.c, ext/syslog/test.rb: Syslog.close should
+ raise RuntimeError when not opened.
+
+ * ext/syslog/syslog.c, ext/syslog/test.rb:
+ Syslog.{ident,options,facility,mask} should all return nil when
+ not opened.
+
+ * ext/syslog/syslog.c, ext/syslog/test.rb: Change back the output
+ format of inspect().
+
+Wed Nov 27 16:25:43 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/test.rb: Switch from RUnit to Test::Unit.
+
+Wed Nov 27 16:14:12 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/syslog/syslog.c: Fix a problem where Syslog.ident was not
+ marked and could thus be GC'd.
+
+Wed Nov 27 16:11:53 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/syslog/test.rb: Switch from RUnit to Test::Unit.
+
+ * ext/syslog/test.rb: The output format of inspect() is slightly
+ altered.
+
+Wed Nov 27 06:43:26 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * error.c (exit_initialize): add SystemExit#initialize to set
+ instance variable status. (ruby-bugs-ja:PR#362)
+ Now accepts status as optional first argument.
+
+ * eval.c (error_handle): now SystemExit have status always.
+
+ * eval.c (system_exit): just instantiate SystemExit without raise.
+
+ * eval.c (rb_thread_start_0): initialize SystemExit properly.
+
+Tue Nov 26 10:17:04 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * dln.c (init_funcname_len): remove MAXPATHLEN dependency.
+
+Mon Nov 25 19:55:38 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/extmk.rb (extmake): return true if not dynamic and not static.
+
+Mon Nov 25 01:08:40 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * dln.c: revert and add the MAXPATHLEN definition on mswin32/mingw32.
+
+Sun Nov 24 20:36:53 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * dln.c: move the MAXPATHLEN definition in front.
+
+Fri Nov 22 22:55:01 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * sprintf.c (rb_f_sprintf): preceding ".." for negative
+ hexadecimal numbers should not appear if prec (e.g. %.4) is
+ specified.
+
+ * pack.c (NUM2I32): support platforms which does not have 32bit
+ integers (e.g. Cray).
+
+Fri Nov 22 19:20:36 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * instruby.rb: Install batch files on Windows. [Submitted by usa]
+
+Fri Nov 22 18:31:46 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_add_method): node may be NULL.
+
+Thu Nov 21 20:53:06 2002 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/smtp.rb: changes coding style.
+
+ * lib/net/pop.rb: ditto.
+
+ * lib/net/protocol.rb: ditto.
+
+Thu Nov 21 20:17:08 2002 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb: changes coding style.
+
+Thu Nov 21 20:04:06 2002 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb: should not overwrite Host: header.
+ (This patch is contributed by sean@ruby-lang.org)
+
+Thu Nov 21 20:01:33 2002 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb: support Proxy-Authorization.
+ (This patch is contributed by Alexander Bokovoy)
+
+Thu Nov 21 11:03:39 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (rb_find_file_ext): should not terminate searching with
+ empty path, just ignore.
+
+ * dir.c: remove <sys/parm.h> inclusion.
+
+Wed Nov 20 02:07:12 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * compar.c (cmp_eq,cmp_gt,cmp_ge,cmp_lt,cmp_le): check using
+ rb_cmpint().
+
+ * error.c (init_syserr): remove sys_nerr dependency.
+
+Wed Nov 20 01:52:21 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (num_cmp): added to satisfy Comparable assumption.
+
+ * eval.c (rb_add_method): "initialize" should be public if it is a
+ singleton method.
+
+Tue Nov 19 22:37:23 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_match): avoid dereferencing if size == 0.
+ (ruby-bugs-ja:PR#360)
+
+Tue Nov 19 20:40:39 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_cmp): should return nil if an operand is not a
+ number nor time. (ruby-bugs-ja:PR#359)
+
+ * file.c (rb_stat_cmp): should return nil if an operand is not
+ File::Stat.
+
+Tue Nov 19 14:35:09 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_zip): iterates over items in the receiver.
+ zipped with nil if argument arrays are shorter. if arrays are
+ longer, left items are ignored. now works with blocks.
+
+ * enum.c (zip_i): changed for new behavior.
+
+ * array.c (rb_ary_transpose): added. [new]
+
+Tue Nov 19 05:12:21 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * instruby.rb: Do not install various working files under bin/.
+
+Tue Nov 19 05:07:39 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * instruby.rb: not rewrite installed scripts when dry-run mode.
+
+ * lib/ostruct.rb (OpenStruct::initialize): should symbolize keys
+ instead of values.
+
+Tue Nov 19 02:24:10 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * instruby.rb: Rewrite installed scripts' shebang lines.
+
+ * instruby.rb: Use File.join() where appropriate.
+
+Tue Nov 19 01:53:35 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * bin/irb: Moved from sample/irb.rb.
+
+ * instruby.rb: Install script files under bin/ with ruby's program
+ prefix and suffix.
+
+Mon Nov 18 02:13:36 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/tempfile.rb: Make this library thread safe.
+
+ * lib/tempfile.rb: Do not pick a name which was once used and is
+ still scheduled for removal.
+
+ * lib/tempfile.rb: A lock file need not and must not be scheduled
+ for removal.
+
+ * lib/tempfile.rb: Compare Max_try with the number of mkdir
+ failures instead of the suffix counter.
+
+ * lib/tempfile.rb: Overall cleanup and add some important notices.
+
+Sun Nov 17 22:57:31 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (dsym): garbage returned. (ruby-bugs-ja:PR#358)
+
+Fri Nov 15 07:40:08 2002 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
+
+ * observer.rb: raise NoMethodError instead of NameError.
+ [ruby-dev:18788]
+
+ * ostruct.rb: ditto. fix a bug in inspect which called String#+ with
+ Symbol. [ruby-dev:18788]
+
+ * profile.rb: illegal use of Array#sort!. replaced it with non-bang
+ method. [ruby-dev:18792]
+
+Thu Nov 14 22:40:29 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * configure.in (LIBRUBY_A): append -static. [ruby-dev:18689]
+
+ * configure.in (LIBRUBYARG_STATIC, LIBRUBYARG_SHARED): linker
+ argument to link static/shared library respectively.
+
+ * Makefile.in (LIBRUBYARG_STATIC, LIBRUBYARG_SHARED): added.
+
+ * bcc32/Makefile.sub, win32/Makefile.sub: ditto.
+
+ * instruby.rb (LIBRUBY_A): install to libdir.
+
+ * lib/mkmf.rb (link_command): link static library of ruby, or
+ try_run fails unless LIBRUBY_SO is installed. [ruby-dev:18646]
+
+ * eval.c (call_trace_func): toplevel caller was missing.
+ [ruby-dev:18754]
+
+ * eval.c (proc_to_s): adjust created line number.
+
+ * parse.y (primary, do_block, brace_block): adjust line number of
+ block to beginning line, instead of the first statement inside
+ the block.
+
+Thu Nov 14 08:23:42 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * math.c (math_acos): check errno after operation. ditto for
+ asin, acosh, atanh, log, log10 and sqrt.
+
+ * eval.c (rb_add_method): initialize should always be private.
+
+ * parse.y (expr): add rescue modifier rule.
+
+ * parse.y (command_call): return, break and next with argument is
+ now part of this rule.
+
+Wed Nov 13 16:22:38 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * configure.in (DLDFLAGS): removed -Wl,-no-undefined to
+ ext/extmk.rb, in order to allow references to symbols in other
+ extension libraries for mkmf.rb. [ruby-dev:18724]
+
+ * ext/extmk.rb (extmake): ditto.
+
+ * ext/extmk.rb (extmake): exit when make failed.
+
+Sun Nov 10 03:46:18 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb: retire contain?() and add superset?(),
+ proper_superset?() subset?(), and proper_subset?().
+ [obtained from: Jason Voegele's set.rb]
+
+ * lib/set.rb: define several aliases: union() for |(),
+ difference() for -(), and intersection() for &().
+ [obtained from: Jason Voegele's set.rb]
+
+ * lib/set.rb: deal with a s/id/object_id/ leftover.
+
+Sat Nov 9 16:06:57 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/tcltklib/stubs.c: should include "util.h" for ruby_strdup.
+
+Sat Nov 9 11:39:45 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c: remove ENABLE_TRACE/DISABLE_TRACE to trace child nodes of
+ c-call. [ruby-dev:18699]
+
+Fri Nov 8 04:16:55 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): "a" in "a /5" should be considered as a local
+ variable. [experimental]
+
+Thu Nov 7 09:51:37 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_yield_0): should enable trace for non-cfunc nodes.
+ [ruby-dev:18645]
+
+ * eval.c (blk_orphan): a block created in a different thread is
+ orphan. [ruby-dev:17471]
+
+Wed Nov 6 16:57:06 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_define_method): do not set NOEX_CFUNC if klass is
+ really a module, whose methods must be safe for reciever's type.
+
+ * eval.c (rb_eval): nosuper should not be inherited unless the
+ overwritten method is an undef placeholder.
+
+Tue Nov 5 00:46:04 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/extmk.rb: Properly pass the given target to
+ make(1). [pointed out by eban]
+
+Mon Nov 4 20:03:53 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * instruby.rb, lib/mkmf.rb: use CONFIG["ENABLE_SHARED"] instead of
+ checking whether CONFIG["configure-args"] includes "--enable-shared".
+
+Mon Nov 4 16:49:14 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (primary): allow 'when'-less case statement; persuaded
+ by Sean Chittenden.
+
+Mon Nov 4 06:28:09 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * Makefile.in, ext/extmk.rb, bcc32/Makefile.sub,
+ win32/Makefile.sub: Introduce better command line syntax
+ (--make/--make-flags/--extstatic) to extmk.rb and instruby.rb.
+ Previously such command as 'make -j3 install' with pmake doesn't
+ fail. Formerly extmk.rb was receiving "make -j 3 -j 3" via the
+ command line arguments and just ended up recognizing the first
+ "3" as destdir. [with help of usa]
+
+Mon Nov 4 03:59:51 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/getopts.rb: Do not choke on characters that cannot be used
+ in a variable name. Replace them with `_'. Define a hash named
+ $OPT for convenience.
+
+Sat Nov 2 00:38:55 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (Init_Object): added Object#object_id, new name for
+ Object#id. [new]
+
+ * object.c (rb_obj_id_obsolete): give warning for Object#id.
+
+ * numeric.c (fix_intern): added Fixnum#to_sym. [new]
+
+ * object.c (sym_to_sym): rename from Symbol#intern
+
+Fri Nov 1 14:21:06 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * enum.c (enum_zip): added Enumerable#zip. [new]
+
+ * array.c (rb_ary_zip): added Array#zip.
+
+Thu Oct 31 20:10:18 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * error.c (init_syserr): remove sys_nerr dependency.
+
+Thu Oct 31 09:31:51 2002 K.Kosako <kosako@sofnec.co.jp>
+
+ * eval.c (rb_export_method): undef'ed method visibility should not
+ be changed.
+
+Wed Oct 30 17:00:47 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_mod_public_method_defined, etc.): new methods:
+ public_method_defined?, private_method_defined?,
+ protected_method_defined?
+
+ * object.c (rb_obj_public_methods): new method
+ Object#public_methods.
+
+ * class.c (ins_methods_i): Object#methods should list both public
+ and protected methods.
+
+ * class.c (rb_class_public_instance_methods): new method
+ Module#public_instance_methods.
+
+Wed Oct 30 06:29:00 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c, file.c, gc.c, io.c, object.c, ruby.c, ruby.h, struct.c,
+ ext/socket/socket.c: differentiate long and int; use proper
+ printf type specifiers and do casts where appropriate.
+
+Wed Oct 30 04:07:33 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (error_print, rb_longjmp, rb_thread_schedule): flush
+ error message. [ruby-dev:18582]
+
+ * eval.c (ruby_cleanup): added. just clean up without exit.
+ [ruby-dev:18582]
+
+ * eval.c (ruby_exec): added. execute main evaluation tree without
+ exit. [ruby-dev:18582]
+
+ * intern.h: prototypes; ruby_cleanup, ruby_exec
+
+Tue Oct 29 02:00:08 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/extmk.rb (extmake): use dummy_makefile to create dummy
+ Makefile.
+
+ * lib/mkmf.rb (find_executable0): EXEEXT is optional.
+
+ * lib/mkmf.rb (dummy_makefile): make dummy Makefile content.
+
+ * lib/mkmf.rb (create_makefile): define EXTLIB replacing -l.
+
+ * lib/mkmf.rb ($bccwin): detect Borland make by help message.
+
+ * lib/mkmf.rb (CLEANINGS): common rules to clean.
+
+Mon Oct 28 01:27:17 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * djgpp/config.sed (@program_transform_name@): use `%', not `,'.
+
+Sun Oct 27 22:59:50 2002 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
+
+ * ext/extmk.rb(78) : The unnecessary error when installing by bccwin32
+ is controlled.
+
+ * lib/mkmf.rb(773) : Also in the case of bccwin32, the path was added.
+
+Sun Oct 27 17:07:25 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * djgpp/*: sync with the latest.
+
+ * ext/extmk.rb, lib/mkmf.rb: flush $stdout.
+
+ * io.c (READ_DATA_PENDING_COUNT, READ_DATA_PENDING_PTR):
+ undef these macros on DJGPP.
+
+Sat Oct 26 10:11:47 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * node.h (nd_type): cast the value to int.
+
+Sat Oct 26 04:27:35 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/dbm/dbm.c (fdbm_indexes, fdbm_select): add a missing
+ argument and prevent coredump when a nonexistent key is
+ specified.
+
+ * ext/sdbm/init.c (fsdbm_indexes, fsdbm_select): ditto.
+
+Sat Oct 26 03:28:43 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * eval.c, gc.c: use a common set of alloca() #ifdef's. This fixes
+ the build with Intel C Compiler for Linux.
+
+ * eval.c (rb_f_require): declare old_func with a real type, not
+ just type modifiers.
+
+Fri Oct 25 02:55:01 2002 Minero Aoki <aamine@loveruby.net>
+
+ * string.c (rb_str_split_m): RSTRING(str)->ptr might become NULL.
+ [ruby-dev:18581]
+
+Thu Oct 24 21:57:02 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * configure.in (LIBPATHFLAG): avoid $ substitution.
+ [ruby-dev:18577]
+
+ * ext/extmk.rb (extmake): expand $srcdir.
+
+ * ext/win32ole/extconf.rb: should not override $CFLAGS, but
+ append.
+
+ * lib/mkmf.rb (config_string): use given config hash.
+
+ * bcc32/Makefile.sub (.rc.res): directory part may be empty in
+ Borland make.
+
+Thu Oct 24 03:38:07 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/mkmf.rb (create_makefile): site-install target for backward
+ compatibility.
+
+ * lib/mkmf.rb (init_mkmf): libdir prior to topdir.
+
+ * configure.in (LIBPATHFLAG): should escape $. [ruby-dev:18572]
+
+ * mkconfig.rb: never substitute escaped $$.
+
+ * instruby.rb: not install LIBRUBY_SO unless enable-shared.
+ [ruby-dev:18569]
+
+Wed Oct 23 19:16:06 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_eval): added NODE_DSYM, symbol literal with
+ interpolation.
+
+ * node.h: ditto.
+
+ * intern.h: prototypes; rb_is_junk_id, rb_str_dump, rb_str_intern
+
+ * object.c (sym_inspect): escape and quote for non-alphanumeric
+ symbols.
+
+ * parse.y (dsym, tokadd_string, yylex): extended symbol literals.
+
+ * parse.y (rb_is_junk_id): added.
+
+ * string.c (rb_str_dump, rb_str_intern) : make extern.
+
+ * lib/mkmf.rb (create_makefile): deffile should be removed by
+ distclean, not clean.
+
+Tue Oct 22 23:56:41 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/mkmf.rb (init_mkmf): add dir_config("opt").
+
+Tue Oct 22 19:44:03 2002 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
+
+ * bcc32/configure.bat : The command line when calling setup.mak is
+ corrected.
+
+ * bcc32/readme.bcc32 : It follows up about the option of configure.bat.
+
+Tue Oct 22 15:23:19 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * instruby.rb: add dryrun mode.
+
+ * ext/extmk.rb (extmake): add install: target to dummy Makefile.
+
+ * ext/extmk.rb (extmake): avoid Borland make's quirk behavior.
+
+ * lib/mkmf.rb (link_command): opt is not a makefile macro.
+
+ * bcc32/Makefile.sub ($(LIBRUBY_SO) $(LIBRUBY)): EXTOBJS were not
+ linked.
+
+ * bcc32/Makefile.sub (ext/extinit.obj): missing.
+
+ * bcc32/Makefile.sub (TRY_LINK): options have to place before any
+ non-option arguments.
+
+ * win32/Makefile.sub (TRY_LINK): need -link and -libpath options.
+
+ * bcc32/Makefile.sub, win32/Makefile.sub (RANLIB): logical
+ operator never work with command.com.
+
+Tue Oct 22 00:59:59 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in (RUBY_CPPOUTFILE): fix cache file bug.
+
+ * lib/mkmf.rb (link_command): put 'opt' after conftest.c for
+ static linking.
+
+Mon Oct 21 22:53:02 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * configure.in (XCFLAGS): CFLAGS to compile ruby itself.
+
+ * configure.in (LIBEXT): suffix for static libraries.
+
+ * configure.in (LIBPATHFLAG): switch template to specify library
+ path.
+
+ * configure.in (LINK_SO): command to link shared objects.
+
+ * configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent
+ files.
+
+ * configure.in (EXPORT_PREFIX): prefix to exported symbols on
+ Windows.
+
+ * configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS):
+ libraries, macros and headers used in common.
+
+ * configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode
+ executable name.
+
+ * Makefile.in (CFLAGS): append XCFLAGS.
+
+ * Makefile.in (PREP): miscellaneous system dependent files.
+
+ * Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb.
+
+ * Makefile.in (fake.rb): CROSS_COMPILING keeps building platform.
+
+ * Makefile.in (MAKEFILES): depend on *.in and config.status.
+
+ * Makefile.in (parse.c): replace "y.tab.c" with actual name for
+ byacc.
+
+ * ext/extmk.rb, lib/mkmf.rb: integrated.
+
+ * ext/extmk.rb: propagate MFLAGS.
+
+ * ext/extmk.rb (extmake): make dummy Makefile to clean even if no
+ Makefile is made.
+
+ * lib/mkmf.rb (older): accept multiple file names and Time
+ objects.
+
+ * lib/mkmf.rb (xsystem): split and quote.
+
+ * lib/mkmf.rb (cpp_include): make include directives.
+
+ * lib/mkmf.rb (try_func): try whether specified function is
+ available.
+
+ * lib/mkmf.rb (install_files): default to site-install.
+
+ * lib/mkmf.rb (checking_for): added.
+
+ * lib/mkmf.rb (find_executable0): just find executable file with
+ no message.
+
+ * lib/mkmf.rb (create_header): output header file is variable.
+
+ * lib/mkmf.rb (create_makefile): separate sections.
+
+ * lib/mkmf.rb (init_mkmf): initialize global variables.
+
+ * win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added.
+
+ * bcc32/Makefile.sub (ARCH): fixed to i386.
+
+ * win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not
+ link EXTOBJS.
+
+ * ext/dl/extconf.rb: use try_cpp to cross compile.
+
+ * ext/dl/extconf.rb: not modify files in source directory.
+
+Fri Oct 18 23:11:21 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (value_expr0): allow return/break/next/redo/retry in rhs
+ of logical operator. [ruby-dev:18534]
+
+ * parse.y (remove_begin): eliminate useless NODE_BEGIN.
+ [ruby-dev:18535]
+
+Fri Oct 18 01:02:44 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * hash.c, eval.c: Use (*_NSGetEnviron()) instead of environ on
+ Darwin for namespace cleanness. [ruby-core:00537]
+
+ * dln.c (dln_load): Fix Darwin support that has been disabled and
+ switch to using it on Darwin instead of the system dlopen().
+ [ruby-core:00541]
+
+Thu Oct 17 19:17:56 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * marshal.c (w_byten): added; write n bytes from s to arg.
+
+ * marshal.c (dump): flush buffered data.
+
+ * marshal.c (marshal_dump, r_byte, r_bytes0, marshal_load): unify
+ marshaling I/O. [ruby-talk:53368]
+
+Thu Oct 17 12:58:24 2002 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb: stat.blksize might be 0/nil.
+
+ * lib/fileutils.rb: change coding style.
+
+Wed Oct 16 22:35:53 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * sprintf.c (rb_f_sprintf): disallow mixed usage of numbered and
+ unnumbered arguments. [ruby-dev:18531]
+ get rid of memory leak at exception. [ruby-core:00460]
+
+Wed Oct 16 13:36:29 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * variable.c (rb_global_entry): not add global entry until
+ initialized to avoid accessing it while GC. [ruby-dev:18514]
+
+ * variable.c (rb_alias_variable): ditto.
+
+Wed Oct 16 01:03:54 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_str_to_dbl): RString ptr might be NULL.
+
+ * object.c (rb_cstr_to_dbl): p pointer might be NULL.
+
+ * bignum.c (rb_str_to_inum): RString ptr might be NULL.
+
+ * bignum.c (rb_cstr_to_inum): str pointer might be NULL.
+
+Sat Oct 12 23:44:11 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * win32/win32.c (rb_w32_putc): wrong condition to fill or flush on
+ bccwin32. [ruby-win32:408]
+
+Fri Oct 11 15:58:06 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (arg): rescue modifier is now an operator with
+ precedence right below assignments. i.e. "a = b rescue c" now
+ parsed as "a = (b rescue c)", not as "(a = b) rescue c". [new]
+ [experimental]
+
+Fri Oct 11 06:05:30 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * win32/win32.c (rb_w32_fclose, rb_w32_close): use closesocket()
+ for socket. [ruby-win32:382]
+
+ * win32/win32.c (StartSockets): set NtSocketsInitialized.
+
+ * win32/win32.h: prototypes; rb_w32_fclose, rb_w32_close
+
+Fri Oct 11 00:24:57 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * gc.c (ruby_xmalloc, ruby_xrealloc): restrict total allocation
+ size according to memories consumed by live objects.
+ [ruby-dev:18482]
+
+ * gc.c (gc_sweep): estimate how live objects consume memories.
+
+Thu Oct 10 17:26:12 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/tcltklib/stubs.c (ruby_tcltk_stubs): fix memory leak.
+ [ruby-dev:18478]
+
+Thu Oct 10 15:20:18 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/weakref.rb (WeakRef::@@final): use Hash#delete.
+
+ * lib/weakref.rb (WeakRef::__getobj__): examine if alive or not by
+ ID_REV_MAP to deal with recycled object. [ruby-dev:18472]
+
+ * lib/weakref.rb (WeakRef::weakref_alive?): ditto.
+
+Wed Oct 9 07:11:25 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * gc.c (gc_sweep): also adjust heaps_limits when free unused heap
+ page. [ruby-core:00526]
+
+ * io.c (io_fflush): condition to retry can occur.
+
+ * io.c (io_write): returned 0 wrongly if no error occurred.
+
+Tue Oct 8 14:19:07 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * io.c (io_write): must check returned value from fwrite() before
+ test with ferror(). (ruby-bugs-ja:PR#350)
+
+Tue Oct 8 10:55:23 2002 Tanaka Akira <akr@m17n.org>
+
+ * lib/prettyprint.rb (PrettyPrint.singleline_format): new method.
+
+Mon Oct 7 16:43:07 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (bigdivrem): bignum zero's len should not be 0.
+
+Mon Oct 7 15:36:42 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (bigdivmod): wrong condition check for Bignum zero.
+
+ * bignum.c (Init_Bignum): need to add Bignum#div.
+
+Sun Oct 6 00:49:15 2002 Minero Aoki <aamine@loveruby.net>
+
+ * eval.c (rb_load): should not pass blocks to the loaded file.
+ [ruby-dev:18458]
+
+Fri Oct 4 20:25:38 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_thread_interrupt, rb_thread_signal_raise): no need to
+ save dead thread context. (same as [ruby-dev:18322])
+ (ruby-bugs-ja:PR#349)
+
+Fri Oct 4 13:05:58 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in (RUBY_PROG_GNU_LD): check whether the linker is GNU ld.
+
+ * ext/extmk.rb (create_makefile): add -Wl,-no-undefined to $DLDFLAGS
+ on Linux if GNU ld is used and --enable-shared is specified.
+
+Fri Oct 4 02:21:16 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big_rshift): num should be initialized by carry
+ bits if x is negative.
+
+ * bignum.c (bigdivmod): len for bignum zero is 1, not 0.
+
+Thu Oct 3 20:22:11 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * bcc32/mkexports.rb: to work on cygwin via telnet.
+ [ruby-win32:358]
+
+ * ext/tcltklib/tcltklib.c (ip_invoke): requires command name
+ argument. [ruby-dev:18438]
+
+ * eval.c (ruby_init, ruby_options): Init_stack() with local
+ location. (ruby-bugs-ja:PR#277)
+
+ * eval.c (rb_call0): disable trace call. [ruby-dev:18074]
+
+ * eval.c (eval, rb_load): enable trace call. [ruby-dev:18074]
+
+ * eval.c (rb_f_require): set source file name for extension
+ libraries. [ruby-dev:18445]
+
+ * gc.c (Init_stack): prefer address of argument rather than local
+ variable to initialize rb_gc_stack_start.
+
+ * ruby.c (translate_char): translate a character in a string;
+ DOSISH only. [ruby-dev:18274]
+
+ * ruby.c (ruby_init_loadpath): added argv[0] handling under
+ Human68K. [ruby-dev:18274]
+
+ * ruby.c (proc_options): translate directory separator in $0 to
+ '/'. [ruby-dev:18274]
+
+Thu Oct 3 00:27:26 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/delegate.rb (Delegator::initialize): use Object#class
+ instead of deprecated Object#type.
+
+Wed Oct 2 23:32:48 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * configure.in (RUBY_CHECK_IO_NEED_FLUSH): check whether fflush()
+ is needed.
+
+ * io.c (flush_before_seek): flush before seek if buffered data
+ may remain.
+
+ * io.c (rb_io_check_readable): flush if the last operation was
+ write.
+
+ * io.c (rb_io_check_writable): flush if the last operation was
+ read.
+
+ * rubyio.h (FMODE_RBUF): added.
+
+Wed Oct 2 23:09:20 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * io.c (rb_io_wait_readable): handle retryable errors.
+
+ * io.c (rb_io_wait_writable): ditto.
+
+ * ext/socket/socket.c (bsock_send): ditto.
+
+ * ext/socket/socket.c (s_recvfrom): ditto.
+
+ * ext/socket/socket.c (s_accept): ditto.
+
+ * ext/socket/socket.c (udp_send): ditto.
+
+ * ext/socket/getaddrinfo.c (afdl): made private structures constant.
+
+ * rubyio.h: prototype; rb_io_wait_readable(), rb_io_wait_writable().
+
+Wed Oct 2 13:03:58 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: set ac_cv_func_setitimer to "no" on Cygwin.
+
+Wed Oct 2 10:59:29 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (gc_sweep): free unused heap page to reduce process size if
+ possible.
+
+ * object.c (rb_obj_type): deprecated Object#type; use Object#class.
+
+Tue Oct 1 23:48:32 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/socket/socket.c (init_sock): no need for special finalizer,
+ socket descriptor is no longer duplicated in 1.7.
+ [ruby-talk:50732]
+
+ * win32/win32.c, win32/win32.h (rb_w32_fddup, rb_w32_fdclose):
+ delete.
+
+Mon Sep 30 20:29:10 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * io.c (rb_io_inspect): not need to raise IOError for closed
+ stream. [ruby-talk:51871]
+
+Mon Sep 30 03:48:15 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * range.c (range_check): need no Fixnum check.
+
+Sun Sep 29 18:30:24 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * win32/win32.c (rb_w32_open_osfhandle): adjust
+ rb_w32_open_osfhandle() with _open_osfhandle().
+
+ * win32/win32.c (rb_w32_accept, rb_w32_socket): return -1 on
+ error.
+
+ * win32/win32.h: should use file descriptor instead of SOCKET.
+
+Sun Sep 29 06:33:03 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (is_socket, rb_w32_select, rb_w32_accept, rb_w32_bind,
+ rb_w32_connect, rb_w32_getpeername, rb_w32_getsockname,
+ rb_w32_getsockopt, rb_w32_ioctlsocket, rb_w32_listen, rb_w32_recv,
+ rb_w32_recvfrom, rb_w32_send, rb_w32_sendto, rb_w32_setsockopt,
+ rb_w32_shutdown, rb_w32_socket, rb_w32_gethostbyaddr,
+ rb_w32_gethostbyname, rb_w32_gethostname, rb_w32_getprotobyname,
+ rb_w32_getprotobynumber, rb_w32_getservbyname, rb_w32_getservbyport):
+ need to protect WSAGetLastError() by RUBY_CRITICAL. [ruby-talk:51778]
+
+Sat Sep 28 20:06:36 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * keywords: add braces around initializers.
+
+Sat Sep 28 13:19:29 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * hash.c (rb_hash_become): should check self-assignment after
+ conversion.
+
+Sat Sep 28 10:40:44 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (rb_hash_become): Hash#become should check added
+ self-assignment.
+
+ * class.c (rb_make_metaclass): metaclass of a superclass may be
+ NULL at boot time.
+
+Sat Sep 28 09:50:03 2002 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
+
+ * ext/extmk.rb: The condition judgment without necessity was deleted.
+
+Fri Sep 27 18:40:42 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_thread_deadlock): more verbose message at deadlock.
+
+ * eval.c (rb_thread_schedule): ditto.
+
+ * eval.c (rb_thread_join): ditto.
+
+Fri Sep 27 13:24:35 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): Class#inherited should be called after the
+ execution of the class body.
+
+Fri Sep 27 02:41:53 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/sha1: Use OpenSSL's SHA1 engine if available. It is
+ much faster than what we have now (sha1.[ch]). Add a knob
+ (--with-bundled-sha1) to extconf.rb which makes it use the
+ bundled one anyway.
+
+Fri Sep 27 02:25:14 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/rmd160: Use OpenSSL's RMD160 engine if available. It
+ is much faster than what we have now (rmd160.[ch]). Add a knob
+ (--with-bundled-rmd160) to extconf.rb which makes it use the
+ bundled one anyway.
+
+Fri Sep 27 01:23:39 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/md5: Use OpenSSL's MD5 engine if available. It is
+ much faster than what we have now (md5.[ch]). Add a knob
+ (--with-bundled-md5) to extconf.rb which makes it use the
+ bundled one anyway.
+
+Thu Sep 26 22:44:21 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/digest.c (rb_digest_base_s_digest): Fix a double
+ free() bug mingled with allocation framework deployment.
+
+ * ext/digest/digest.c (rb_digest_base_s_hexdigest): Get rid of
+ redundant struct allocation.
+
+Thu Sep 26 09:52:52 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (primary): remove "return outside of method" check at
+ compile time.
+
+Wed Sep 25 23:51:29 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * dir.c (glob_helper): must not closedir() when exception raised
+ while globbing "**".
+
+ * marshal.c (w_uclass): unused variable.
+
+ * re.c (match_clone): unused.
+
+ * regex.c (re_compile_pattern): get rid of implicit promotion from
+ plain char to int.
+
+Wed Sep 25 17:46:46 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/mkmf.rb (libpathflag): restore ENV['LIB'] when some error
+ occurred.
+
+Wed Sep 25 16:14:51 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_match): p1 may exceed pend limit.
+
+Mon Sep 23 23:22:43 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_call0): must not clear ruby_current_node, or
+ backtrace cannot be generated.
+
+ * intern.h (ruby_yyparse): rather than yyparse().
+
+ * parse.y (yylex): nextc() returns -1 at end of input, not 0.
+
+ * parse.y (newline_node): reduce duplicated newline node.
+
+ * parse.y (literal_concat): get rid of warning.
+
+ * parse.y (new_evstr): fixed junk code.
+
+Mon Sep 23 19:57:52 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in (RUBY_MINGW32): new macro. check for the MinGW
+ compiler environment.
+
+ * lib/mkmf.rb: refactoring.
+
+Mon Sep 23 08:27:11 2002 Tanaka Akira <akr@m17n.org>
+
+ * io.c (appendline): forget to terminate with nul.
+
+Mon Sep 23 02:46:29 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (ruby_run): should set toplevel visibility again here.
+
+ * eval.c (rb_eval): should not rely on ruby_class == rb_cObject
+ check. Besides allow implicit publicity for attribute set
+ methods.
+
+ * parse.y (primary): need not to check class_nest, just set
+ whether method is an attrset or not.
+
+Sun Sep 22 21:49:42 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (call_trace_func): should not call trace function while
+ compilation.
+
+ * eval.c (rb_call0): also inside c-func.
+
+ * parse.y (yycompile): ditto.
+
+ * ruby.c (require_libraries): preserve source file/line for each
+ require.
+
+Sun Sep 22 17:08:11 2002 Tanaka Akira <akr@m17n.org>
+
+ * string.c (rb_str_each_line): p might be at the top of the
+ string.
+
+Sat Sep 21 23:28:28 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_make_metaclass): class of metaclass should be
+ metaclass of superclass, unless class itself is a metaclass;
+ class of metaclass of metaclass should point back to self.
+ eh, confusing, isn't it.
+
+ * class.c (rb_singleton_class): check if its class is singleton
+ AND attached to self.
+
+Sat Sep 21 22:23:41 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_thread_raise): no need to save dead thread context.
+ [ruby-dev:18322]
+
+Fri Sep 20 23:02:01 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (block_append): eliminate unused literal nodes.
+
+ * parse.y (literal_concat): refined literal concatenation.
+
+Fri Sep 20 19:43:40 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb: Merge rough/lib/set.rb rev.1.5-1.15.
+
+Wed Sep 18 12:41:16 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): should define class/module under ruby_cbase.
+
+ * eval.c (rb_eval): should set class/module path based on
+ ruby_cbase, not ruby_class.
+
+ * eval.c (module_setup): use ruby_cbase instead of ruby_class.
+
+Tue Sep 17 21:06:04 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_thread_die): put thread dead state.
+
+ * eval.c (rb_thread_atfork): free stack buffer at fork too.
+
+Tue Sep 17 01:13:31 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_mod_nesting): load wrapping module should appear in
+ Module#nesting list. (ruby-bugs-ja:PR#328)
+
+ * eval.c (rb_thread_remove): free stack buffer on remove.
+
+Tue Sep 17 00:58:35 2002 Minero Aoki <aamine@loveruby.net>
+
+ * io.c: add parameter prototype.
+
+ * re.c: ditto.
+
+Sun Sep 15 21:14:22 2002 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
+
+ * win32/win32.c (rb_w32_opendir, rb_w32_stat): Corresponds to
+ the unjust path containing ".
+
+Sun Sep 15 19:48:55 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in (OUTFLAG, CPPOUTFILE): moved from lib/mkmf.rb.
+ check whether ${CPP} accepts the -o option.
+
+ * win32/Makefile.sub (OUTFLAG, CPPOUTFILE): ditto.
+
+ * bcc32/Makefile.sub (OUTFLAG, CPPOUTFILE): ditto.
+
+ * djgpp/config.sed (OUTFLAG, CPPOUTFILE): ditto.
+
+ * lib/mkmf.rb (OUTFLAG, CPPOUTFILE): use CONFIG.
+ make easy to understand log.
+
+ * mkconfig.rb (val): should not strip.
+
+Sat Sep 14 20:13:42 2002 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
+
+ * error.c(rb_sys_fail): remove case EPIPE on bcc32 .
+
+Fri Sep 13 23:39:49 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * dir.c (glob_func_caller): add prototype to get rid of warning.
+
+Fri Sep 13 18:35:12 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_eval): avoid uninitialized global/class variable
+ warnings at `||='. [ruby-dev:18278]
+
+ * parse.y (stmt, arg): ditto
+
+Fri Sep 13 13:28:04 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/mkmf.rb ($INSTALLFILES): avoid warning when $VERBOSE mode.
+
+Thu Sep 12 23:20:10 2002 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
+
+ * bcc32/setup.mak : Control of a message.
+
+ * bcc32/makefile.sub : include resource.
+
+Thu Sep 12 18:10:03 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * dir.c (glob_helper): fixed freeing buffer. (ruby-bugs-ja:PR#332)
+
+ * dir.c (glob_helper): should pass matched path. (ruby-bugs-ja:PR#333)
+
+Thu Sep 12 00:09:32 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_trap_eval): preserve thread status and so on.
+ [ruby-talk:40337], [ruby-core:00019]
+
+Wed Sep 11 21:25:52 2002 Tanaka Akira <akr@m17n.org>
+
+ * pp.rb (ARGF.pretty_print): implemented.
+ (PP.pp): arguments reordered.
+
+Wed Sep 11 18:55:38 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (proc_to_s): refined format. [ruby-dev:18215]
+
+Wed Sep 11 17:47:17 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c, win32/win32.h (rb_w32_getpid): negate pid under Win9x.
+ [ruby-dev:18262]
+
+Wed Sep 11 12:58:57 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * string.c (get_pat): Add an extra argument "quote".
+
+ * string.c (rb_str_match_m): Do not bother to convert if a regexp
+ is given.
+
+Wed Sep 11 11:33:40 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * bcc32/Makefile.sub: remove unnecessary `.dll' from filename of
+ dll's resource file.
+
+ * cygwin/GNUmakefile.in: ditto. [ruby-dev:17103]
+
+ * win32/Makefile.sub: ditto. [ruby-dev:17103]
+
+ * win32/resource.rb: ditto. [ruby-dev:17103]
+
+Wed Sep 11 09:59:46 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * io.c (rb_io_wait_readable): added.
+
+ * io.c (rb_io_wait_writable): added.
+
+ * io.c (io_read_retryable): added.
+
+ * io.c (io_write): retry on EINTR, ERESTART and EWOULDBLOCK.
+ [ruby-dev:17855], [ruby-dev:17878], [ruby-core:00444]
+
+ * io.c (rb_io_fread): ditto.
+
+ * io.c (read_all): ditto.
+
+ * io.c (appendline): ditto.
+
+ * io.c (rb_io_each_byte): ditto.
+
+ * io.c (rb_io_getc): ditto.
+
+Wed Sep 11 09:29:24 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub (ext): make directory `ext' on compile dir.
+ [ruby-dev:18255]
+
+Wed Sep 11 00:41:10 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_mod_define_method): initialize orig_func too.
+ (ruby-bugs-ja:PR#330)
+
+Wed Sep 11 00:01:32 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * dir.c (glob_helper): prevent memory leak using rb_protect().
+
+ * string.c (rb_str_associate): no need to check freeze flag.
+
+ * string.c (rb_str_resize): should honor STR_ASSOC flag on
+ resize.
+
+ * string.c (rb_str_resize): proper STR_ASSOC handling. pointed
+ out by Michal Rokos.
+
+ * string.c (rb_str_buf_cat): ditto.
+
+ * string.c (rb_str_cat): ditto.
+
+ * string.c (rb_str_buf_append): ditto.
+
+ * string.c (rb_str_append): ditto.
+
+Tue Sep 10 23:35:46 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (nextc): restore line number after here documents.
+ (ruby-bugs-ja:PR#331)
+
+ * parse.y (heredoc_restore): ditto.
+
+Tue Sep 10 18:26:52 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/extmk.rb, lib/mkmf.rb ($INCFLAGS): new var for -I$(topdir).
+
+ * lib/mkmf.rb: add #define WIN32_LEAN_AND_MEAN to improve compile
+ times.
+
+Tue Sep 10 17:16:14 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub (miniruby): shouldn't link $(EXTOBJS).
+ [ruby-dev:17059]
+
+ * win32/Makefile.sub ($(LIBRUBY_A), $(LIBRUBY)): avoid lib.exe's
+ warning. [ruby-dev:17059]
+
+ * win32/Makefile.sub: remove unnecessary rules. [ruby-dev:17059]
+
+ * win32/configure.bat, win32/setup.mak, win32/README.win32: enable to
+ pass some arguments to configure. [ruby-dev:17059]
+
+Mon Sep 9 23:43:33 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * win32/win32.h (S_I?USR): define only if not mingw32.
+
+Mon Sep 9 11:21:04 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/stringio/stringio.c (strio_set_string): reinitialize
+ properly.
+
+ * ext/stringio/stringio.c (strio_become): added self-assign check
+ and experimental auto-conversion to StringIO.
+
+ * ext/stringio/stringio.c (strio_reopen): added.
+
+
+Sun Sep 8 21:29:25 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * time.c (time_free): prototype; struct time_object -> void *.
+ avoid GCC warnings.
+
+ * lib/mkmf.rb, ext/extmk.rb ($LINK, $CPP): move to lib/mkmf.rb.
+
+Sun Sep 8 19:02:28 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * time.c: prototype; time_free() to avoid VC++ warnings.
+
+ * ext/tcltklib/tcltklib.c: prototype; invoke_queue_handler() to avoid
+ VC++ warning.
+
+ * win32/win32.c (rb_w32_stat): remove S_IWGRP and S_IWOTH bits from
+ st_mode.
+
+ * win32/win32.h (S_I*): define if not defined.
+
+Sun Sep 8 14:38:31 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: modify program_prefix only if specified
+ --program-prefix.
+
+ * configure.in: don't generate ext/extmk.rb.
+
+ * Makefile.in: execute directly $(srcdir)/ext/extmk.rb.
+ remove -Cext option, "Dir::chdir 'ext'" in ext/extmk.rb.
+
+ * {win32,bccwin32}/Makefile.sub: ditto.
+
+ * instruby.rb: ditto.
+
+ * ext/extmk.rb: renamed from ext/extmk.rb.in.
+
+ * lib/mkmf.rb (module Logging): create log files (mkmf.log)
+ in each extension module directories.
+
+ * ext/extmk.rb: ditto.
+
+ * lib/mkmf.rb (macro_defined?): new method.
+
+ * ext/.cvsignore: remove extmk.rb.
+
+ * ext/*/.cvsignore: add "*.def".
+
+ * lib/mkmf.rb (have_struct_member): moved from ext/socket/extconf.rb.
+
+ * ext/socket/extconf.rb: use macro_defined? instead of egrep_cpp.
+
+ * ext/etc/extconf.rb: use have_struct_member.
+
+ * ext/etc/etc.c: add prefix HAVE_ST_ to PW_ macros.
+
+Sun Sep 8 14:36:40 2002 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
+
+ * bcc32/configure.bat : Control of a message.
+ * bcc32/makefile.sub : @(sitearch) typo.
+ * ext/extmk.rb.in : [bccwin32] libdir is added to a library path.
+ * lib/mkmf.rb : ditto.
+
+Sat Sep 7 23:32:56 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * misc/inf-ruby.el (inferior-ruby-error-regexp-alist): regexp
+ alist for error message from ruby.
+
+ * misc/inf-ruby.el (inferior-ruby-mode): fixed for Emacs.
+
+ * misc/inf-ruby.el (ruby-send-region): compilation-parse-errors
+ doesn't parse first line, so insert separators before each
+ evaluations.
+
+Sat Sep 7 19:46:57 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb: Disallow Set.new(false). Add even more tests.
+ [Submitted by: "Christoph" <chr_news@gmx.net>]
+
+Sat Sep 7 19:23:56 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb: Fix a bug in flatten()'s recursive set detection.
+ [Submitted by: "Christoph" <chr_news@gmx.net>] Some tests
+ against the bug are added.
+
+ * lib/set.rb: Resurrect the test suite by putting it after
+ __END__ and executing `eval DATA.read'.
+
+Sat Sep 7 08:41:39 2002 Minero Aoki <aamine@loveruby.net>
+
+ * parse.y (rb_gc_mark_parser): ruby_eval_tree is marked in eval.c.
+
+Fri Sep 6 20:01:38 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/mkmf.rb ($CC): command to compile C source.
+
+ * lib/mkmf.rb (logging): added.
+
+ * lib/mkmf.rb (try_compile): added.
+
+ * lib/mkmf.rb (egrep_cpp): use internal grep when pattern is
+ Regexp, otherwise use external egrep command but get rid of
+ pipe of command.com.
+
+ * lib/mkmf.rb (have_func): local variable should be volatile not
+ to be eliminated by optimization.
+
+ * lib/mkmf.rb (create_makefile): link with CONFIG["LIBS"].
+
+ * lib/mkmf.rb (create_makefile): emit .SUFFIXES:.
+
+Fri Sep 6 12:11:22 2002 Minero Aoki <aamine@loveruby.net>
+
+ * parse.y (rb_gc_mark_parser): should mark ALL global variables
+ defined in parse.y.
+
+Fri Sep 6 01:15:23 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (ruby_xmalloc): remove MALLOC_LIMIT to avoid frequent
+ garbage collection.
+
+Fri Sep 6 11:47:37 2002 Minero Aoki <aamine@loveruby.net>
+
+ * parse.y (rb_gc_mark_parser): should mark global variables
+ defined in parse.y.
+
+Fri Sep 6 10:34:32 2002 Minero Aoki <aamine@loveruby.net>
+
+ * io.c (rb_io_puts): RSTRING(line)->ptr might be NULL.
+
+Fri Sep 6 10:26:37 2002 Minero Aoki <aamine@loveruby.net>
+
+ * parse.y: should not put non-NODE-VALUEs in the semantic stack.
+
+Fri Sep 6 05:48:26 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * file.c (rb_path_check): nothing to check under DOSISH.
+ [ruby-list:35772]
+
+Fri Sep 6 05:03:50 2002 Minero Aoki <aamine@loveruby.net>
+
+ * gc.c (rb_gc): should mark parser.
+
+ * parse.y (rb_gc_mark_parser): new function.
+
+ * intern.h (rb_gc_mark_parser): added.
+
+Thu Sep 5 18:32:32 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_path2class): should not use rb_eval_string().
+
+Thu Sep 5 17:18:22 2002 Michal Rokos <michal@ruby-lang.org>
+
+ * dln.c: fix memory leak in dln_load (ruby-core:405) and
+ in load_1 (ruby-core:407)
+
+Thu Sep 5 15:43:54 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_extended): should allow marshaling of object which
+ is extended by named module.
+
+ * class.c (rb_make_metaclass): super may be T_ICLASS, need to skip.
+
+Thu Sep 5 13:09:22 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_eval): overriding false constant with class/module
+ definition should be error. (PR#327)
+
+Thu Sep 5 01:24:26 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * extmk.rb (create_makefile): add macro MAKEDIRS, INSTALL_PROG,
+ INSTALL_DATA.
+
+ * extmk.rb (create_makefile): support for building to any directory.
+
+ * extmk.rb (xsystem): move to mkmf.rb.
+
+ * mkmf.rb (xsystem): support for extmk.rb
+
+ * mkmf.rb ($CPP): remove '-E' option. add CPPFLAGS.
+
+Wed Sep 4 16:15:17 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb: ==(o) should be aware of all the Set variant
+ instances, not just those of its subclasses. [Submitted by:
+ "Christoph" <chr_news@gmx.net>]
+
+ * lib/set.rb: - Fix eql?(). [ditto]
+
+Wed Sep 4 15:23:23 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_make_metaclass): obj.meta.super.meta should be equal
+ to obj.meta.meta.super (ruby-bugs-ja:PR#324).
+
+Wed Sep 4 05:10:16 2002 Koji Arai <jca02266@nifty.ne.jp>
+
+ * parse.y (yylex): the warning message "invalid
+ character syntax" was never issued (ruby-bugs-ja:PR#323).
+
+Wed Sep 4 01:08:45 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (r_bytes): do not use alloca (ruby-bugs:PR#382).
+
+Tue Sep 3 17:12:59 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * extmk.rb: require mkmf.rb. remove duplicate methods.
+ use Config::CONFIG["FOO"] instead of @FOO@.
+
+ * mkmf.rb: support for extmk.rb.
+
+Mon Sep 2 23:01:50 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * re.c (rb_reg_search): MatchData must be rb_cMatch.
+ (ruby-bugs-ja:PR#319)
+
+Mon Sep 2 21:21:46 2002 Minero Aoki <aamine@loveruby.net>
+
+ * gc.c (gc_sweep): does reclaim nodes in also compile time, if we
+ can.
+
+ * ruby.c (load_file): omit GC if we can.
+
+ * parse.y (ruby_parser_stack_on_heap): new function.
+
+ * intern.h (ruby_parser_stack_on_heap): added.
+
+Mon Sep 2 18:45:07 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_copy_generic_ivar): remove old generic instance
+ variable table if it exists.
+
+Sun Sep 1 15:54:33 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * config.guess: fixed for Linux/PPC.
+
+Sat Aug 31 09:38:12 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_make_metaclass): metaclass of a metaclass is a
+ metaclass itself.
+
+Fri Aug 30 22:45:16 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb: Added.
+
+Fri Aug 30 20:58:54 2002 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
+
+ * ext/Win32API/Win32API.c (Win32API_Call): typo.
+
+Fri Aug 30 19:45:52 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * variable.c (rb_const_assign): st_delete() takes pointer to key.
+
+Fri Aug 30 19:40:28 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/Win32API/Win32API.c (Win32API_Call): RSTRING()->ptr may be
+ NULL.
+
+ * ext/nkf/nkf.c (rb_nkf_guess): ditto.
+
+ * ext/readline/readline.c (readline_s_set_completion_append_character):
+ ditto.
+
+ * ext/socket/socket.c (sock_s_getaddrinfo, sock_s_getnameinfo):
+ ditto.
+
+ * ext/tcltklib/tcltklib.c (ip_toUTF8, ip_fromUTF8): ditto.
+
+Fri Aug 30 01:32:17 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_singleton_class): superclass of a metaclass
+ should be a metaclass of superclass.
+
+ * range.c (range_eq): two instances must belong to a same class to
+ be equal.
+
+ * range.c (range_eql): ditto.
+
+ * io.c (rb_io_taint_check): frozen check added.
+
+ * file.c (rb_stat_become): frozen check added.
+
+ * object.c (rb_obj_become): ditto.
+
+ * re.c (rb_reg_become): ditto.
+
+ * struct.c (rb_struct_become): ditto.
+
+ * time.c (time_become): ditto.
+
+ * array.c (rb_ary_become): should call rb_ary_modify().
+
+ * hash.c (rb_hash_become): should call rb_hash_modify().
+
+ * compar.c (cmp_equal): should not use NUM2LONG(), since <=> may
+ return bignum.
+
+ * compar.c (cmp_gt, cmp_ge, cmp_lt, cmp_le, cmp_between): ditto.
+
+Thu Aug 29 23:34:42 2002 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
+
+ * bcc32/MakeFile.sub (sitearch): add.
+
+Thu Aug 29 13:36:42 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * io.c (read_all): should use off_t instead of long.
+
+Thu Aug 29 00:55:55 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * marshal.c (r_object): yield loaded objects, not intermediates.
+ (ruby-bugs-ja:PR#296)
+
+Thu Aug 29 00:06:54 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_become): should not free ptr if it's shared.
+
+ * eval.c (rb_alias): prohibit making an alias named "allocate" if
+ klass is a metaclass.
+
+Wed Aug 28 23:59:15 2002 Michal Rokos <michal@ruby-lang.org>
+
+ * signal.c: remove #ifdef SIGINT for struct signals.
+
+ * variable.c: get rid of fix length buffer in rb_class_path.
+
+Wed Aug 28 23:34:32 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * io.c (appendline): data was lost when raw mode.
+
+Wed Aug 28 22:57:34 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_string_value_ptr): StringValuePtr() should never
+ return NULL pointer.
+
+Wed Aug 28 19:12:46 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/stringio/stringio.c (strio_initialize): RSTRING(mode)->ptr
+ can be NULL.
+
+ * ext/stringio/stringio.c (strio_ungetc): fix buffer overflow.
+
+Wed Aug 28 18:19:55 2002 Michal Rokos <michal@ruby-lang.org>
+
+ * file.c: fix memory leak in rb_stat_init.
+
+Wed Aug 28 17:45:03 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * win32/win32.c (kill): negate pid under Win9x.
+
+Wed Aug 28 16:36:40 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in (ar): don't check ar twice.
+
+Wed Aug 28 15:00:29 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_delete_bang): should check if str->ptr is 0.
+
+ * string.c (rb_str_squeeze_bang): ditto.
+
+ * string.c (rb_str_count): ditto.
+
+ * string.c (rb_str_lstrip_bang): ditto.
+
+ * string.c (rb_str_rstrip_bang): ditto.
+
+ * string.c (rb_str_intern): ditto.
+
+Wed Aug 28 11:37:35 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.h: define SIGINT and SIGKILL if not defined.
+
+ * win32/win32.c: remove definition of SIGINT and SIGKILL.
+
+Tue Aug 27 19:50:27 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ruby.c (require_libraries): prevent ruby_sourcefile from GC.
+
+Tue Aug 27 15:03:35 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (rb_find_file): $LOAD_PATH must not be empty.
+
+ * file.c (rb_find_file_ext): ditto.
+
+Tue Aug 27 02:35:21 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * range.c (range_eq): class check should be based on range.class,
+ instead of Range to work with Range.dup.
+
+ * range.c (range_eql): ditto.
+
+Mon Aug 26 18:17:56 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_mod_dup): need to preserve metaclass and flags.
+
+Mon Aug 26 10:44:18 2002 Tanaka Akira <akr@m17n.org>
+
+ * object.c (rb_cstr_to_dbl): had a buffer overrun.
+
+Sun Aug 25 20:10:32 2002 Wakou Aoyama <wakou@ruby-lang.org>
+
+ * lib/cgi.rb (CGI#form): fix ruby-bugs-ja:PR#280, add default action.
+
+Sat Aug 24 15:32:16 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (call_trace_func): restore source file/line, as trace
+ function installed in required library with -r option can be
+ called while parsing. (ruby-bugs:PR#372)
+
+ * eval.c (module_setup): unused variable. [ruby-core:00358]
+
+Sat Aug 24 14:59:02 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_class): integrate singleton check into a function
+ to follow DRY principle.
+
+ * marshal.c (w_uclass): should check singleton method.
+
+ * object.c (rb_obj_dup): dmark and dfree functions must be match
+ for T_DATA type.
+
+ * object.c (rb_obj_dup): class of the duped object must be match
+ to the class of the original.
+
+Sat Aug 24 13:57:28 2002 Tanaka Akira <akr@m17n.org>
+
+ * lib/time.rb (Time.rfc2822, Time#rfc2822): preserve localtimeness.
+
+ * lib/pp.rb: pretty_print_cycled is renamed to pretty_print_cycle.
+
+Fri Aug 23 23:59:57 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (method_call): check receiver is defined.
+
+ * eval.c (umethod_call): removed.
+
+Fri Aug 23 23:39:17 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_quote): do not escape \t, \f, \r, \n, for they are
+ not regular expression metacharacters.
+
+ * time.c (time_s_alloc): use time_free instead of free (null check,
+ also serves for type mark).
+
+ * time.c (time_s_at): check dfree function too.
+
+Fri Aug 23 17:06:48 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: RUBY_SO_NAME is msvcrt-rubyXX on mswin32/mingw32.
+
+ * configure.in (sitearch): new var.
+
+ * mkconfig.rb, lib/mkmf.rb (sitearch): ditto.
+
+ * win32/Makefile.sub, win32/setup.mak (sitearch): ditto.
+
+ * instruby.rb: ditto.
+
+Wed Aug 21 16:53:00 2002 Michal Rokos <michal@ruby-lang.org>
+
+ * *.c: int, long types cleanup.
+
+ * parse.y: ditto.
+
+ * re.h, regex.h, ruby.h: ditto.
+
+Wed Aug 21 16:43:19 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_cleanup): should not modify the global
+ variable curr_thread.
+
+Wed Aug 21 16:14:26 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: set ac_cv_func__setjmp to "no" on Cygwin.
+
+ * configure.in: set ac_cv_func_crypt to "no" on MinGW.
+
+Tue Aug 20 21:47 2002 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
+
+ * io.c (rb_io_fread): remove case EPIPE on bcc32 .
+
+ * win32/win32.c (rb_w32_getc): clear EPIPE error on bcc32.
+
+Tue Aug 20 19:39:03 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * file.c (rb_file_s_expand_path): accept drive letter on Cygwin.
+
+ * file.c (is_absolute_path): ditto.
+
+Tue Aug 20 12:12:25 2002 Tietew <tietew@tietew.net>
+
+ * io.c (rb_io_putc): output via rb_io_write().
+
+Mon Aug 19 19:01:55 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * misc/inf-ruby.el (inf-ruby-keys): ruby-send-definition
+ conflicted with ruby-insert-end.
+
+ * misc/inf-ruby.el (inferior-ruby-mode): compilation-minor-mode.
+
+ * misc/inf-ruby.el (ruby-send-region): send as here document to
+ adjust source file/line. [ruby-talk:47113], [ruby-dev:17965]
+
+ * misc/inf-ruby.el (ruby-send-terminator): added to make unique
+ terminator.
+
+Mon Aug 19 17:08:19 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_initialize_m): frozen check should be moved here
+ from rb_reg_initialize().
+
+Mon Aug 19 15:38:44 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (sort_2): comparison should be done as signed long.
+
+ * array.c (sort_2): should return int, not VALUE.
+
+Mon Aug 19 12:38:33 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_thread_save_context, rb_thread_restore_context):
+ save/restore SEH chain on MS-Windows at thread switch.
+ [ruby-win32:273]
+
+ * eval.c (win32_get_exception_list, win32_set_exception_list):
+ added.
+
+Sat Aug 17 23:01:25 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (sort_2): *a - *b may overflow.
+
+Sat Aug 17 00:25:08 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (ary_new): len*sizeof(VALUE) may be a positive value.
+
+ * array.c (rb_ary_initialize): ditto.
+
+Fri Aug 16 15:58:16 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * io.c (NOFILE): define NOFILE as 64 if not defined.
+
+ * signal.c (sighandler_t): rename to sh_t on dietlibc.
+
+Fri Aug 16 15:37:04 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * bignum.c (rb_cstr_to_inum): new decimal and octal string.
+
+Fri Aug 16 13:17:11 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_class_allocate_instance): move singleton class
+ check from rb_obj_alloc().
+
+Fri Aug 16 11:47:24 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * io.c (rb_io_fread): renamed from io_fread and made extern.
+
+ * marshal.c (r_bytes0): check if successfully read, use
+ rb_io_fread() instead of fread() to be preemptive.
+ (ruby-bugs-ja:PR#294, 295)
+
+ * rubyio.h (rb_io_fread): added.
+
+Fri Aug 16 07:57:26 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (compile_error): must not clear ruby_sourcefile here.
+ (ruby-bugs:PR#364).
+
+ * eval.c (rb_longjmp): set ruby_sourcefile before making
+ backtrace.
+
+Thu Aug 15 20:38:58 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (ruby_current_node) : added to set sourceline on demand.
+
+ * eval.c (error_pos, error_print, rb_longjmp, assign): set source
+ file/line.
+
+ * eval.c (rb_eval): store current node instead of file/line, and
+ preserve it at return.
+
+ * eval.c (module_setup): ditto.
+
+ * eval.c (struct thread): store node instead of file/line.
+
+ * eval.c (rb_thread_raise): ditto.
+
+ * intern.h (ruby_current_node): added.
+
+ * intern.h (ruby_set_current_source): added.
+
+ * parse.y (stmt, arg): not fix position of assignment.
+
+ * parse.y (node_assign): ditto.
+
+ * parse.y (yycompile): clear current node.
+
+Thu Aug 15 00:48:46 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_initialize): should not modify frozen Regexp.
+
+Tue Aug 13 18:33:18 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/tcltklib/tcltklib.c (ip_init): allocation framework.
+
+Tue Aug 13 15:32:14 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (rb_hash_replace): should copy ifnone.
+
+ * hash.c (rb_hash_dup): should preserve HASH_PROC_DEFAULT and
+ HASH_DELETED flags.
+
+ * hash.c (rb_hash_shift): shift from empty hash should not return
+ its default proc.
+
+ * hash.c (rb_hash_default_proc): new method. [new]
+
+Tue Aug 13 00:37:11 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_aref): no need for Bignum check.
+
+ * array.c (rb_ary_aset): explicit Bignum check removed.
+
+ * numeric.c (fix_aref): normalize bignum before bit-op.
+
+ * bignum.c (rb_big_rand): max may be Bignum zero.
+
+ * bignum.c (rb_cstr_to_inum): should normalize bignums, to avoid
+ returning fixable bignum value.
+
+ * bignum.c (rb_uint2big): there should be no zero sized bignum.
+
+Mon Aug 12 23:45:28 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/extmk.rb.in: extmake() that works properly for both tkutil
+ (tk/tkutil.so) and digest/sha1.
+
+Mon Aug 12 22:29:35 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ruby.c (set_arg0): Correct the position of #endif.
+
+Mon Aug 12 17:25:06 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (rb_hash_equal): should check HASH_PROC_DEFAULT too.
+
+Mon Aug 12 16:15:37 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * bignum.c (rb_big_cmp): raise for NaN. (ruby-bugs-ja:PR#284).
+
+Sun Aug 11 09:34:07 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_eval): set line number from all nodes.
+
+ * eval.c (proc_to_s): show source file/line if available.
+
+ * marshal.c (r_object): register TYPE_BIGNUM regardless real type.
+
+Sat Aug 10 23:47:16 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big_cmp): use dbl2big() for Floats, instead of
+ big2dbl().
+
+ * bignum.c (Init_Bignum): rb_big_zero_p() removed. There may be
+ Bignum zero.
+
+Fri Aug 9 13:31:40 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/Win32API/extconf.rb: check existence of <windows.h>.
+
+Thu Aug 8 09:37:02 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/optparse.rb (NilClass): must provide conversion block.
+
+ * lib/optparse.rb (String): ditto.
+
+Thu Aug 8 00:45:15 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_call0): new argument added for original method name.
+ preserve original method name in frame->orig_func.
+
+ * eval.c (is_defined): use frame->orig_func, not last_func.
+
+ * eval.c (rb_eval): ditto.
+
+ * eval.c (method_call): supply data->oid also to rb_call0().
+
+ * object.c (rb_class_allocate_instance): call rb_obj_alloc() when
+ called from alias, thus invoke original "allocate".
+
+ * eval.c (remove_method): removing allocate from classes should
+ cause NameError.
+
+Wed Aug 7 22:12:54 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/optparse.rb (OptionParser::Completion::convert): returned
+ all values not first one.
+
+ * lib/optparse.rb (OptionParser::Switch::parse): return values as
+ is.
+
+ * lib/optparse.rb (OptionParser::order): ditto.
+
+ * lib/optparse/time.rb: prior time.rb.
+
+ * lib/optparse/uri.rb: require standard uri module. thanks to
+ Minero Aoki.
+
+Wed Aug 7 09:51:54 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (rb_hash_equal): should check default values.
+
+Wed Aug 7 08:44:32 2002 Minero Aoki <aamine@loveruby.net>
+
+ * ext/racc/cparse/cparse.c: reduce goto.
+
+Tue Aug 6 15:19:39 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * string.c (rb_str_rindex): must return -1 if unmatched.
+
+Mon Aug 5 22:41:18 2002 Minero Aoki <aamine@loveruby.net>
+
+ * MANIFEST: add lib/racc/parser.rb.
+
+ * ext/racc/cparse/cparse.c: code refine.
+
+ * ext/racc/cparse/MANIFEST: add depend.
+
+Sun Aug 4 22:30:50 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/curses/curses.c: follow allocation framework.
+
+Sat Aug 3 21:23:56 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_eval): set constant in cbase scope.
+
+ * eval.c (assign): ditto.
+
+Fri Aug 2 09:12:32 2002 Minero Aoki <aamine@loveruby.net>
+
+ * ext/strscan/strscan.c: follow allocation framework.
+
+Fri Aug 2 01:21:52 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c (s_recvfrom): update RSTRING len.
+
+Thu Aug 1 17:47:15 2002 Tachino Nobuhiro <tachino@jp.fujitsu.com>
+
+ * parse.y (tokadd_string): ignore backslashed spaces in %w.
+
+Thu Aug 1 14:14:15 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * enum.c (enum_find): do not use rb_eval_cmd(); should not accept
+ a string for if_none.
+
+Wed Jul 31 14:11:43 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_undef): undef should be done for klass, not ruby_class.
+
+Tue Jul 30 19:48:51 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * misc/ruby-mode.el (ruby-accurate-end-of-block): restrict search
+ region.
+
+ * misc/ruby-mode.el (ruby-parse-partial): reversed wrong patch.
+
+Tue Jul 30 17:21:13 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * misc/ruby-mode.el (ruby-accurate-end-of-block): incomplete block
+ caused infinite loop.
+
+ * misc/ruby-mode.el (ruby-parse-partial): returns nil unless
+ delimiters found.
+
+Tue Jul 30 15:24:07 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/tcltklib/stubs.c (ruby_tcltk_stubs): win32_getenv returns
+ the same address always, so allocate string by ruby_strdup.
+
+ * win32/win32.c: prototype; rb_w32_open_osfhandle().
+
+Tue Jul 30 09:11:07 2002 Minero Aoki <aamine@loveruby.net>
+
+ * eval.c (rb_thread_join_m): add parameter type declaration.
+
+Tue Jul 30 08:37:11 2002 Minero Aoki <aamine@loveruby.net>
+
+ * eval.c (localjump_error): add parameter type declaration.
+
+Mon Jul 29 16:00:54 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/extmk.rb.in: always use File.expand_path for $top_srcdir.
+
+Sat Jul 27 23:07:52 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (num_to_int): default to_int implementation for every
+ numeric class.
+
+Sat Jul 27 08:09:03 2002 Booker C. Bense <bbense@slac.stanford.edu>
+
+ * re.c (rb_reg_quote): initial part of the string was never copied
+ to the quoted string.
+
+Fri Jul 26 23:03:53 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_eval): no need to convert to string twice.
+
+Fri Jul 26 18:32:37 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * misc/ruby-mode.el (ruby-expr-beg): wrong indent at modifiers
+ after ?.
+
+Fri Jul 26 16:01:16 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/extmk.rb.in (create_makefile): use Regexp in gsub.
+
+ * sample/mkproto.rb: ditto and fix bug.
+
+Fri Jul 26 14:31:06 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * random.c: replace with Mersenne Twister RNG.
+
+Fri Jul 26 12:14:48 2002 Minero Aoki <aamine@loveruby.net>
+
+ * parse.y (yylex): modify to accept a code like "m (a){...}".
+
+Thu Jul 25 09:05:02 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * misc/ruby-mode.el (ruby-delimiter): include here document.
+
+ * misc/ruby-mode.el (ruby-deep-arglist): skips spaces after
+ parenthesis when 'space.
+
+ * misc/ruby-mode.el (ruby-imenu-create-index): fix for nested
+ classes.
+
+ * misc/ruby-mode.el (ruby-accurate-end-of-block): added. scan a
+ block in the order.
+
+ * misc/ruby-mode.el (ruby-expr-beg): support for here document.
+
+ * misc/ruby-mode.el (ruby-parse-partial): splitted from
+ ruby-parse-region.
+
+ * misc/ruby-mode.el (ruby-move-to-block): skips RD style comments.
+
+Wed Jul 24 09:47:42 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (jump_tag_but_local_jump): preserve retval in
+ LocalJumpError exceptions.
+
+ * parse.y (command): no more check for "super outside of method".
+
+ * eval.c (rb_mod_define_method): should set last_class and
+ last_func in the block->frame.
+
+Mon Jul 22 17:23:00 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (error_handle): should handle TAG_THROW as well.
+
+Fri Jul 19 10:52:32 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): new decimal notation '0d4567'.
+
+Thu Jul 18 11:52:02 2002 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/ftp.rb (set_socket): new method.
+
+Thu Jul 18 06:51:24 2002 Minero Aoki <aamine@loveruby.net>
+
+ * parse.y (yylex): fix typo.
+
+Wed Jul 17 18:41:28 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): new octal notation '0o777'.
+
+Mon Jul 15 18:36:42 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (string_content): every string_content node should
+ return string only. use NODE_EVSTR to coercing.
+
+ * eval.c (rb_eval): NODE_EVSTR support.
+
+Mon Jul 15 10:35:35 2002 Minero Aoki <aamine@loveruby.net>
+
+ * parse.y (heredoc_identifier): fix typo.
+
+Sat Jul 13 09:30:04 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (literal_concat_string): wrong optimization.
+
+Sat Jul 13 01:25:38 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/resolv.rb (Resolv::DNS::open, close): new.
+
+ * lib/optparse.rb, lib/optparse: import.
+
+Fri Jul 12 06:34:05 2002 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb: rename HTTP.get_uri get_response.
+
+ * lib/net/http.rb: HTTP.get_print accepts URI objects.
+
+ * lib/net/http.rb: HTTP.get had not work with URI objects.
+
+Fri Jul 12 02:15:58 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * string.c (rb_str_match): fix for string match.
+
+Fri Jul 12 00:02:50 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/stringio/stringio.c (strio_gets_internal): fixed for record
+ separator longer than 1.
+
+Thu Jul 11 17:59:20 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_quote): avoid unnecessary string allocation.
+
+ * string.c (get_pat): quote metacharacters before compiling a
+ string into a regex.
+
+ * string.c (rb_str_split_m): special treatment of strings of size
+ 1, but AWK emulation. now uses get_pat().
+
+ * string.c (rb_str_match_m): quote metacharacters.
+
+ * string.c (rb_str_match2): ditto.
+
+Thu Jul 11 12:59:23 2002 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/resolv.rb: untaint strings read from /etc/hosts and
+ /etc/resolv.conf to prevent SecurityError when $SAFE==1.
+
+Thu Jul 11 09:00:43 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_slice_bang): if there's no corresponding
+ substring, slice! should return nil without exception.
+
+Tue Jul 9 20:03:55 2002 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * irb 0.9
+
+Sat Jul 6 07:35:02 2002 Jamie Herre <jfh@gettysgroup.com>
+
+ * array.c (rb_ary_insert): type fixed.
+
+Fri Jul 5 09:17:00 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_split_m): accept separator value nil as well.
+
+Fri Jul 5 08:59:15 2002 Michal Rokos <michal@ruby-lang.org>
+
+ * enum.c: Fix bug in enum_sort_by and some code indents
+
+Fri Jul 5 05:00:40 2002 Wakou Aoyama <wakou@ruby-lang.org>
+
+ * lib/cgi.rb (CGI#initialize): improvement for mod_ruby.
+ thanks to Sean Chittenden <sean@ruby-lang.org>, Shugo Maeda
+ <shugo@modruby.net>
+
+Fri Jul 5 00:10:09 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_become): was leaking memory.
+
+Thu Jul 4 23:43:26 2002 Minero Aoki <aamine@loveruby.net>
+
+ * parse.y: remove useless function str_extend_p().
+
+Wed Jul 3 14:26:40 2002 Sean Chittenden <sean@ruby-lang.org>
+
+ * lib/net/ftp.rb (get): new method.
+
+ * lib/net/ftp.rb (putt): ditto.
+
+ * lib/net/ftp.rb (binary): ditto.
+
+ * lib/net/ftp.rb (binary=): ditto.
+
+Wed Jul 3 13:57:53 2002 Sean Chittenden <sean@ruby-lang.org>
+
+ * lib/net/ftp.rb (getbinaryfile): the second argument (localfile)
+ is now optional.
+
+ * lib/net/ftp.rb (gettextfile): ditto.
+
+Wed Jul 3 13:45:42 2002 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/ftp.rb: use &block and yield for speed.
+
+Wed Jul 3 02:32:31 2002 Wakou Aoyama <wakou@ruby-lang.org>
+
+ * lib/cgi.rb (CGI#initialize): improvement for mod_ruby.
+
+Tue Jul 2 14:53:10 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_include_module): should not alter other
+ classes/modules by inclusion. by this fix, local order may not
+ be preserved for some cases.
+
+ * class.c (include_class_new): module may be T_ICLASS; retrieve
+ original module information.
+
+Tue Jul 2 14:13:11 2002 Wakou Aoyama <wakou@ruby-lang.org>
+
+ * lib/cgi.rb (CGI#header): accept any type as value.
+
+Sun Jun 30 17:05:29 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in (seekdir, telldir): add ac_cv_func_telldir=yes,
+ ac_cv_func_seekdir=yes for MinGW.
+
+Sat Jun 29 01:43:32 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (pipe_finalize, pipe_popen): two-way pipe support for win32.
+
+ * win32/win32.c (ChildRecord, FindFreeChildSlot): ditto.
+
+ * win32/win32.c, win32/win32.h (pipe_exec): new function for two-way
+ pipe support for win32.
+
+ * win32/win32.c, win32/win32.h (FindPipedChildSlot, rb_w32_popen,
+ rb_w32_pclose): removed functions for two-way pipe support for win32.
+
+Fri Jun 28 23:49:34 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * pack.c (pack_unpack): change names of local variables because their
+ names are overlapped.
+
+Fri Jun 28 17:54:07 2002 Tanaka Akira <akr@m17n.org>
+
+ * lib/pp.rb: fix object address.
+
+Thu Jun 27 23:55:50 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_stat): fix buffer overflow. (ruby-bugs:PR#329)
+
+Thu Jun 27 20:57:45 2002 Tanaka Akira <akr@m17n.org>
+
+ * lib/prettyprint.rb, lib/pp.rb: convenience methods added.
+
+Thu Jun 27 15:22:18 2002 Tanaka Akira <akr@m17n.org>
+
+ * lib/prettyprint.rb: re-implemented for incremental output to handle
+ huge data. API is changed a bit.
+
+ * lib/pp.rb: adapt new pretty printing API.
+
+Thu Jun 27 08:28:18 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (literal_concat_string): non-string last expression in
+ #{} was ignored when followed by literal.
+
+Thu Jun 27 03:42:04 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_expr_str): need to process backslashes properly.
+
+Wed Jun 26 17:33:38 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_any_to_a): declare Object#to_a to be obsolete.
+
+ * object.c (rb_Array): do not convert nil into [] automagically.
+
+Wed Jun 26 15:40:00 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (words, qwords): word list literal rules.
+
+ * parse.y (parse_string): ditto.
+
+ * parse.y (yylex): %W: word list literal with interpolation. [new]
+
+Tue Jun 25 18:53:34 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (string1, xstring, regexp): moved lex_strnest
+ initialization to string_contents/xstring_contents.
+
+Tue Jun 25 19:24:38 2002 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
+
+ * dln.c: remove definition rb_loaderror().
+
+Tue Jun 25 00:34:54 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_Integer): use "to_int" instead of
+ "to_i". [experimental]
+
+ * object.c (nil_to_f): new method.
+
+ * object.c (rb_Integer): Symbols and nil should cause error.
+
+ * object.c (rb_Float): nil should cause error.
+
+Tue Jun 25 00:21:00 2002 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
+
+ * dln.c: remark definition rb_loaderror().
+
+Tue Jun 25 00:14:07 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (string_dvar): allow back references in interpolation.
+
+Mon Jun 24 16:32:31 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_eval): NODE_EVSTR is no longer used.
+
+ * eval.c (eval): not enforce to make assigned variables dynamic.
+
+ * parse.y (string): split rules to strings/xstring/regexp to allow
+ arbitrary statements inside string interpolation.
+
+ * parse.y (here_document): splitted into three phases.
+
+ * parse.y (literall_append, literal_concat): added.
+ append/concatenate string literals.
+
+ * sample/test.rb (valid_syntax): adjust line number for BEGIN.
+
+ * lib/mkmf.rb (create_makefile): get rid of nested string.
+
+ * lib/mkmf.rb (install_rb): site-install didn't work properly.
+
+Sun Jun 23 00:19:10 2002 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb, lib/date/format.rb, sample/cal.rb, sample/goodfriday.rb:
+ updated to the new version (based on date2 3.3).
+
+Sat Jun 22 14:41:33 2002 Guy Decoux <ts@moulon.inra.fr>
+
+ * ext/socket/socket.c (sock_addrinfo): make all 3 versions of
+ getaddrinfo happy. [ruby-core:00184]
+
+Fri Jun 21 18:49:58 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): __END__ should not be effective within
+ string literals.
+
+Thu Jun 20 21:09:37 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/readline/readline.c (readline_readline): get rid of
+ libreadline's bug. (ruby-bugs-ja:PR#268)
+
+Thu Jun 20 17:10:27 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/ftool.rb (BUFSIZE): tuning, set buffer length to 8192.
+
+ * configure.in (__NO_ISOCEXT): add for mingw-runtime 2.0-2.
+
+ * configure.in (__MSVCRT__): removed because it is defined
+ in the GCC specs.
+
+Wed Jun 19 14:46:18 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/extmk.rb, lib/mkmf.rb (xsystem): open the log file if xsystem
+ is called.
+
+Wed Jun 19 01:01:13 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (here_document): should be aware of __END__ within here
+ documents.
+
+Wed Jun 19 00:50:50 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (yylex): ? followed by successive word characters is
+ ternary operator not numeric literal.
+
+ * parse.y (yylex): commands after break/next/rescue can take
+ arguments. (ruby-bugs-ja:PR#265)
+
+Tue Jun 18 19:20:16 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/mkexports.rb: remove unnecessary exports. (ruby-dev:17418)
+
+Tue Jun 18 12:50:17 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (yylex): should pushback proper char after '<<'.
+
+ * parse.y (range_op, cond0, cond): get rid of doubled warnings.
+
+ * parse.y (value_expr): reduce recursion level.
+
+ * parse.y (logop): ditto.
+
+Mon Jun 17 11:11:34 2002 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * string.c (rb_str_crypt): result need not be tainted always.
+
+Mon Jun 17 10:51:37 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * dln.c (dln_load): need to preserve dln_strerror() result,
+ calling other dl family can clear it.
+
+Sat Jun 15 22:56:37 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): obsolete '?<whitespace>'; use '?\s', '?\n',
+ etc, instead.
+
+Sat Jun 15 18:51:13 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * dir.c (glob_helper): Use lstat() instead of stat() so it catches
+ a dead symlink. Given a dead symlink named "a", Dir.glob("?")
+ did catch it but Dir.glob("a") somehow didn't.
+
+Sat Jun 15 01:59:05 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): no here document after a dot.
+
+ * parse.y (yylex): should have set lex_state after '`'.
+
+ * parse.y (yylex): should have set lex_state properly after
+ tOP_ASGN.
+
+Fri Jun 14 21:01:48 2002 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
+
+ * bcc32/mkexports.rb: insert sleep(1) for win9x.
+
+ * bcc32/configure.bat: change return code LF -> CRLF for win9x.
+
+ * win32/win32.c: fix rb_w32_open_osfhandle()
+
+Fri Jun 14 15:22:19 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (read_escape): deny zero-width hexadecimal character.
+ (ruby-bugs-ja:PR#260)
+
+ * parse.y (tokadd_escape): ditto.
+
+ * regex.c (re_compile_pattern): ditto.
+
+Fri Jun 14 00:49:54 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big2dbl): return canonical HUGE_VAL for infinity.
+
+Thu Jun 13 09:43:37 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (svalue_to_avalue): v may be Qundef. This fix was
+ suggested by Guy Decoux.
+
+Thu Jun 13 00:33:49 2002 takuma ozawa <metal@mine.ne.jp>
+
+ * hash.c (rb_hash_s_create): use rb_hash_aset() instead of calling
+ st_insert() directly, to dup&freeze string keys.
+
+Thu Jun 13 00:12:54 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): proper error message for "@@0".
+
+ * parse.y (yylex): paren to parse_string() must be zero for
+ unparenthesized strings.
+
+ * parse.y (str_extend): broken string when unterminated "#{".
+
+ * enum.c (enum_sort_by): had a bug in 1 element enumeration.
+
+Wed Jun 12 18:04:44 2002 akira yamada <akira@arika.org>
+
+ * uri/common.rb (REGEXP::PATTERN::X_ABS_URI): 'file:/foo' is valid.
+
+ * uri/generic.rb (Generic#xxx=): should return substituted value.
+ (ruby-dev:16728.)
+
+ * test/generic.rb (test_set_component): added tests for the above
+ change.
+
+Wed Jun 12 02:38:00 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (stmt): fix typo.
+
+Wed Jun 12 01:10:55 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): 'do' should return kDO_BLOCK on EXPR_ENDARG.
+
+ * parse.y (singleton): "def (()).a end" dumped core.
+
+ * parse.y (range_op): node may be null.
+
+ * parse.y (match_gen): ditto.
+
+Tue Jun 11 19:20:34 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in (LIBRUBY): rename to lib$(LIBRUBY_SO).a on Cygwin/MinGW.
+
+ * configure.in, cygwin/GNUmakefile: use dllwrap when --disable-shared
+ is specified.
+
+Tue Jun 11 17:12:04 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (arg): void value check for "..", "...", "!", and "not".
+
+ * parse.y (match_gen): void value check for "=~".
+
+ * parse.y (value_expr): check NODE_AND and NODE_OR recursively.
+
+ * parse.y (cond0): void value check added for conditionals.
+
+Tue Jun 11 13:18:47 2002 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/ftp.rb (noop): new method.
+
+ * lib/net/ftp.rb (site): ditto.
+
+Tue Jun 11 13:15:41 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * bcc32/Makefile.sub: set PROCESSOR_LEVEL to 6 if it's too big value.
+
+ * win32/Makefile.sub: ditto.
+
+Tue Jun 11 12:37:46 2002 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
+
+ * bcc32/configure.bat fix.
+
+Tue Jun 11 10:18:23 2002 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
+
+ * new platform [bccwin32] merged.
+ - create new folder bcc32
+ - modify any files for bccwin32
+ error.c, file.c, hash.c, io.c, instruby.rb,
+ ext/extmk.rb.in,
+ lib/mkmf.rb, lib/ftools.rb,
+ ext/digest/defs.h,
+ ext/dl/depend, ext/dl/dl.c, ext/dl/sym.c, ext/dl/extconf.rb,
+ ext/socket/extconf.rb,
+ ext/pty/extconf.rb,
+ ext/tcltklib/extconf.rb
+ ext/Win32API/Win32API.c,
+ win32/dir.h, win32/win32.c, win32/win32.h, win32/resource.rb
+
+Mon Jun 10 19:02:19 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * numeric.c (fix_lshift): negative shift count means right shift.
+ (ruby-bugs-ja:PR#248)
+
+ * numeric.c (fix_rshift): return -1 when left side operand is
+ negative. (ruby-bugs-ja:PR#247)
+
+ * parse.y (yylex): `0_' should be an error. (ruby-bugs-ja:PR#249)
+
+Mon Jun 10 01:53:54 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): ruby_frame->last_func may be null, if it's
+ called outside of a method.
+
+ * parse.y (arg): use INT2NUM, not INT2FIX for tUMINUS.
+
+ * parse.y (arg): unnecessary negative tPOW treatment.
+
+ * parse.y (tokadd_escape): wrong backslash escapement.
+
+Sun Jun 9 17:40:41 2002 Takaaki Tateishi <ttate@kt.jaist.ac.jp>
+
+ * ext/dl: change the callback mechanism.
+
+Sat Jun 8 00:48:38 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (stmt,arg): too much void value check.
+
+ * parse.y (stmt,arg): need to check void value on rules which does
+ not use node_assign().
+
+Thu Jun 6 19:50:39 2002 KONISHI Hiromasa <H_Konishi@ruby-lang.org>
+
+ * sample/biorhythm.rb (getPosiiton,etc)
+ fix at changing Date module ( Date is changed Fixnum to Rational )
+
+Thu Jun 6 17:42:39 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c (ipaddr): need not to taint hostnames.
+
+Thu Jun 6 12:04:30 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub (config.status): use sub! instead of []= because
+ []= causes exception.
+
+Thu Jun 6 11:42:15 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * lib/thread.rb (Queue::pop): get rid of race condition.
+
+Wed Jun 5 01:56:47 2002 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c: Stop the running zombi-eventloop when
+ mainloop_watchdog is killed.
+
+Tue Jun 4 23:09:24 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * range.c (range_include): should be based on "<=>", whereas
+ member? still is based on "each".
+
+ * range.c (range_min,range_max): redefine methods based on "<=>".
+
+Tue Jun 4 18:28:37 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/socket/extconf.rb: The IPv6 stack of Cygwin is still incomplete.
+
+ * ext/Win32API/extconf.rb: refactoring.
+
+Tue Jun 4 07:03:33 2002 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tkfont.rb: Fix bugs on TkFont.init_widget_font for Tk8.x.
+
+ * ext/tk/lib/tkafter.rb: Add self to 1st argument of interval-
+ and loop-proc
+ TkAfter#current_interval returns an interval (sleep) time value
+ TkAfter#current_args returns an array of arguments
+ TkAfter#return_value returns a return value of last loop-proc
+
+ * ext/tk/lib/tk*.rb: Allow to use Symbols for parameters.
+
+ * ext/tk/lib/tkcanvas.rb: (TkcItem) Add 'coords' parameter to the
+ canvas item constructor (for new notation of constructor).
+
+ * ext/tcltklib/tcltklib.c: New 'mainloop' and 'mainloop_watchdog'.
+
+ * ext/tk/lib/tk.rb: (Tk.restart) Add 'app-name' paramater and
+ 'use' parameter.
+
+ * ext/tk/lib/tk.rb: Add new parameter 'widgetname' to the widget
+ constructor to support effective use of Resource Database.
+
+ * ext/tk/lib/tk.rb: TkOption::get always returns a tainted string.
+
+Tue Jun 4 00:45:50 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/socket/addrinfo.h: typo.
+
+ * ext/socket/getaddrinfo.c (gai_strerror): make literals const.
+
+ * ext/socket/socket.c (init_inetsock): ensures resources are
+ freed at exceptions.
+
+ * ext/socket/socket.c (init_unixsock): ditto.
+
+ * ext/socket/socket.c (udp_connect): ditto.
+
+Mon Jun 3 20:39:51 2002 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/extconf.rb : change PLATFORM with RUBY_PLATFORM.
+
+Mon Jun 3 07:07:07 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (here_document): check if identifier is terminated.
+ (ruby-bugs-ja:PR#239)
+
+ * parse.y (yylex): should pushback proper char after '**'.
+ (ruby-bugs-ja:PR#240)
+
+Mon Jun 3 05:56:17 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_aset): should raise error if an indexing string
+ is not found in the receiver.
+
+ * sprintf.c (rb_f_sprintf): "%d" should convert objects into
+ integers using Integer().
+
+Sat Jun 1 19:20:07 2002 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole: merge from rough.
+
+Fri May 31 17:11:42 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/tempfile.rb (Tempfile::size): added.
+
+Thu May 30 12:52:42 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * range.c (range_step): iteration done using "+" if elements are
+ Numeric. Otherwise using "succ".
+
+ * range.c (range_each): iteration done using "succ". If the
+ elements does not respond to "succ", raise TypeError. As a
+ result, all Enumerable methods, e.g. collect, require elements
+ to respond to "succ".
+
+ * range.c (range_member): comparison done using "each", if
+ elements are non-Numeric or no-"succ" objects. Otherwise
+ compare using "<=>".
+
+ * range.c (Init_Range): remove "size" and "length".
+
+Thu May 30 09:16:36 2002 Wakou Aoyama <wakou@ruby-lang.org>
+
+ * lib/cgi.rb: if StringIO is usable then use it.
+
+Wed May 29 18:55:47 2002 KONISHI Hiromasa <H_Konishi@ruby-lang.org>
+
+ * function renames my* and win32_* to rb_w32_* in win32/win32.c
+ fixed files win32/win32.c, win32/win32.h, win32/dir.h,
+ hash.c, rubysig.h, signal.c, ext/socket/socket.c
+
+Wed May 29 17:32:55 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * time.c (tmcmp, search_time_t): activate unless HAVE_TIMEGM.
+
+Wed May 29 13:45:15 2002 Wakou Aoyama <wakou@ruby-lang.org>
+
+ * lib/cgi.rb: not use const if GET, HEAD. check multipart form head.
+
+Tue May 28 17:56:02 2002 Sean Chittenden <sean@ruby-lang.org>
+
+ * parse.y: yyparse #defines moved from intern.h
+
+ * ruby.c (proc_options): access prefixed "ruby_yydebug".
+
+ * applied modifies to pacify some of gcc -Wall warnings.
+
+Tue May 28 14:07:00 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (arg): no more ugly hack for "**", so that "-2**2" to be
+ parsed as "(-2)**2", whereas "- 2**2" or "-(2)**2" to be parsed
+ as "-(2**2)".
+
+ * parse.y (yylex): '-2' to be literal fixnum. [new]
+
+Tue May 28 12:13:37 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (scope_node): trick to keep the node has a scope.
+
+ * eval.c (rb_eval): NODE_EVSTR: write back local_tbl to the node.
+
+ * eval.c (rb_eval): NODE_SCOPE: hold the scope node in ruby_scope.
+
+ * eval.c (module_setup): ditto.
+
+ * eval.c (rb_call0): ditto.
+
+ * node.h (NEW_DASGN, NEW_DASGN_CURR): remove surplus semicolons.
+
+Fri May 24 09:06:29 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_arg): nil test against v[6] (usec).
+
+Thu May 23 16:39:21 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ruby.c (proc_options): option parsing problem.
+ (ruby-bugs-ja:PR#233)
+
+Thu May 23 09:13:56 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ruby.c (proc_options): removed "-*-" support for #! line.
+
+ * io.c (rb_io_s_sysopen): new method to get a raw file
+ descriptor. [new]
+
+ * ext/socket/socket.c (tcp_sysaccept): new method to return an
+ accepted socket fd (integer). [new]
+
+ * ext/socket/socket.c (unix_sysaccept,sock_sysaccept): ditto.
+
+Wed May 22 21:26:47 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ruby.c (proc_options): -T consumes digits only.
+
+Wed May 22 20:18:31 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: need not link vsnprintf.o on MinGW.
+
+Wed May 22 18:34:23 2002 Minero Aoki <aamine@loveruby.net>
+
+ * parse.y (yylex): Here-document label ate '-'.
+
+Tue May 21 13:25:18 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * misc/ruby-mode.el (ruby-font-lock-keywords): symbols end with
+ '_'.
+
+Tue May 21 04:48:37 2002 Sean Chittenden <sean@chittenden.org>
+
+ * lib/cgi-lib.rb: Checking for constant MOD_RUBY instead of
+ environment variable. Remove a mod_ruby warning and use
+ Apache::request.headers_out[] instead.
+
+Tue May 21 01:16:46 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (bodystmt): ensure clause was executed on else clause
+ without rescue clause.
+
+Tue May 21 00:20:25 2002 Takaaki Tateishi <ttate@kt.jaist.ac.jp>
+
+ * ext/dl/ptr.c: rename PtrData::alloc to PtrData::malloc.
+
+ * ext/dl/lib/dl/struct.c: rename Struct#alloc to Struct#malloc.
+
+Mon May 20 14:29:14 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (Init_Object): should do exact match for Module#==.
+
+ * compar.c (cmp_eq): returns 'false' if <=> returns 'nil'.
+
+ * compar.c (cmp_gt,cmp_ge,cmp_lt,cmp_le,cmp_between): ditto.
+
+Mon May 20 13:28:52 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * io.c (rb_io_clone): writing stream was not copied properly.
+
+Sat May 18 21:38:11 2002 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb, lib/date/format.rb, lib/parsedate.rb:
+ updated to the new version (based on date2 3.2.1).
+
+Sat May 18 21:18:00 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub (config.h): add VC++4/5 support about noreturn
+ directive.
+
+Sat May 18 02:16:41 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * pack.c (pack_pack): should propagate taintedness.
+
+ * pack.c (pack_unpack): ditto.
+
+Fri May 17 16:16:19 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * sample/test.rb: use eval instead of './miniruby -c',
+ in order to check a syntax error.
+
+Thu May 16 14:46:34 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_thread_select): cleanup conditional compilation.
+
+Wed May 15 06:13:35 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_schedule): need to preserve errno before
+ calling rb_trap_exec().
+
+ * regex.c (calculate_must_string): a bug in charset/charset_not
+ parsing.
+
+Tue May 14 18:17:44 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * win32/Makefile.sub: config.h inlined. and catch up with the
+ latest change.
+
+ * win32/config.h.in: no longer used.
+
+Tue May 14 14:49:05 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * gc.c (is_pointer_to_heap): avoid GCC 3.1 warnings.
+
+ * missing/strftime.c (timezone): it should take no argument on Cygwin.
+
+Tue May 14 03:07:35 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_clear_cache_by_class): new function.
+
+ * eval.c (set_method_visibility): should have clear cache for
+ updated visibility.
+
+Mon May 13 14:38:33 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * djgpp/config.hin, djgpp/config.sed: catch up with the latest change.
+
+Mon May 13 01:59:55 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (flo_to_s): default format precision to be "%.16g".
+
+ * util.c (ruby_strtod): use own strtod(3) implementation to avoid
+ locale hell. Due to this change "0xff".to_f no longer returns 255.0
+
+Sun May 12 03:01:08 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * missing.h: add for missing/*.c.
+
+ * ruby.h: add `#include "missing.h"'.
+
+ * Makefile.in: add the dependency of missing.h by gcc -MM.
+
+ * MANIFEST: add missing.h
+
+Sat May 11 23:24:52 2002 Takaaki Tateishi <ttate@kt.jaist.ac.jp>
+
+ * ext/dl: enable dl's stack emulation for constructing function call.
+
+Sat May 11 10:52:09 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * dir.c (glob_helper): remove escaping backslashes.
+
+Sat May 11 02:46:43 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (avalue_to_yvalue): new function to distinguish yvalue
+ (no-arg == Qundef) from svalue (no-arg == Qnil).
+
+ * eval.c (rb_yield_0): use avalue_to_yvalue().
+
+ * eval.c (assign): warn if val == Qundef where it means rhs is
+ void (e.g. yield without value or call without argument).
+
+Fri May 10 19:00:47 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (here_document): preserve line number begins here
+ document.
+
+Fri May 10 01:55:44 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_thread_join): added an argument to limit time to wait
+ the thread.
+
+ * eval.c (rb_thread_join_m): new. and added optional argument.
+
+Wed May 8 23:48:40 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (value_expr): need not to warn for WHILE and UNTIL,
+ since they can have return value (via valued break).
+
+Tue May 7 17:13:40 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: forgot to add '-Wl,' to the gcc option on Cygwin/MinGW.
+
+Tue May 7 15:41:33 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/iconv/iconv.c (iconv_try): should initialize exceptions
+ properly. (ruby-bugs-ja:PR#232)
+
+Tue May 7 15:28:03 2002 Minero Aoki <aamine@loveruby.net>
+
+ * eval.c (rb_yield_0): The destination of the goto jump was wrong.
+
+Tue May 7 09:17:51 2002 Minero Aoki <aamine@loveruby.net>
+
+ * eval.c (superclass): undesirable "unexpected return" when the
+ superclass is not a Class.
+
+Sun May 5 06:53:45 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/mkmf.rb: exclude topdir from the system configuration
+ section and prevent it from being overridden.
+
+Fri May 3 20:19:00 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: add #include <errno.h> in AC_CHECK_DECLS().
+
+ * win32/config.h.in: define HAVE_DECL_SYS_NERR.
+
+Thu May 2 23:42:40 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_s_quote): # also should be quoted.
+
+Thu May 2 18:27:13 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/extmk.rb.in, lib/mkmf.rb: use 'do...end' instead of '{}' for
+ Borland make.
+
+Thu May 2 08:01:56 2002 Chris Thomas <kenshin@apple.com>
+
+ * error.c: use HAVE_DECL_SYS_NERR instead of platform names.
+
+Tue Apr 30 09:23:05 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (num_step): better iteration condition for float
+ values; suggested by Masahiro TANAKA <masa@ir.isas.ac.jp>.
+
+Tue Apr 30 05:59:42 2002 Michal Rokos <m.rokos@sh.cvut.cz>
+
+ * range.c (range_step): step (for Range#step method) <= 0 makes no
+ sense, thus ArgError will be raised.
+
+ * range.c (range_each): Range#each method is special case for
+ Range#step(1)
+
+Mon Apr 29 18:46:42 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (rb_find_file): load must be done from an absolute path if
+ $SAFE >= 4.
+
+Sun Apr 28 17:01:56 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * win32/win32.c (insert): fix prototype for ANSI C.
+
+Fri Apr 26 13:47:15 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * enum.c (enum_partition): new method. [new]
+
+Fri Apr 26 13:41:00 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_s_quote): quote whitespaces for /x cases.
+
+Fri Apr 26 06:48:23 2002 Takaaki Tateishi <ttate@kt.jaist.ac.jp>
+
+ * ext/dl/ptr.c (cary2ary): missing break in switch statements.
+
+Fri Apr 26 09:35:47 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_proc_new): make Proc from C function. [new]
+
+ * intern.h (rb_proc_new): prototype.
+
+Wed Apr 24 14:56:46 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (proc_to_proc): return self. [new]
+
+ * eval.c (block_pass): no need to convert if block is Proc.
+
+Wed Apr 24 14:21:41 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: set size of the initial stack from
+ 2MB to 32MB on MinGW/Cygwin.
+
+Wed Apr 24 14:06:35 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (num_step): try to reduce residual on Float operations.
+
+Wed Apr 24 06:48:31 2002 Koji Arai <jca02266@nifty.ne.jp>
+
+ * io.c (rb_io_mode_flags): both 'r+b' and 'rb+' should be allowed.
+
+ * io.c (rb_io_mode_modenum): ditto.
+
+Wed Apr 24 01:16:14 2002 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_mark): must check if ptr is NULL
+ first. [ruby-talk:38873]
+
+ * lib/mkmf.rb (create_makefile): should print depend file when
+ make is other than nmake.
+
+Wed Apr 24 00:37:12 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/extmk.rb.in (create_makefile): use `{$(srcdir)}' directive instead
+ of `$(srcdir)/' when including depend file.
+
+ * lib/mkmf.rb (create_makefile): add `{$(srcdir)}' when including depend
+ file.
+
+Tue Apr 23 12:58:18 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (rb_memerror): rename from mem_error, and exported.
+
+ * gc.c (Init_GC): pre-allocate NoMemoryError instance.
+
+ * object.c (convert_type): error message changed from "failed to
+ convert" to "cannot convert", since it does not try to convert
+ if an object does not respond to the converting method.
+
+Mon Apr 22 09:31:30 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (block_pass): convert Method to Proc using
+ rb_check_convert_type().
+
+ * object.c (rb_check_convert_type): always convert T_DATA
+
+ * eval.c (rb_thread_cleanup): should not terminate main_thread by
+ Fatal error.
+
+ * regex.c (is_in_list): need to not exclude NUL and NEWLINE.
+
+Sat Apr 20 00:19:13 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_expr_str): wrong backslash escapement.
+
+ * re.c (rb_reg_expr_str): do not escape embedded space
+ characters.
+
+Fri Apr 19 22:03:40 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub: add -DNT to $CFLAGS instead of $CPPFLAGS.
+
+ * win32/setup.mak: ditto.
+
+Fri Apr 19 17:24:22 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_object): T_DATA process patch from Joel VanderWerf
+ <vjoel@PATH.Berkeley.EDU>. This is temporary hack; it remains
+ undocumented, and it will be removed when marshaling is
+ re-designed.
+
+ * marshal.c (r_object): ditto.
+
+Fri Apr 19 17:10:55 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (num_step): Integer#step is moved to Numeric#step;
+ Fixnum#step is merged into this method.
+
+ * numeric.c (int_dotimes): Fixnum#times is merged.
+
+ * numeric.c (int_upto): Fixnum#upto is merged.
+
+ * numeric.c (int_downto): Fixnum#downto is merged.
+
+Fri Apr 19 16:22:55 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/socket/extconf.rb: include <windows.h>, <winsock.h> on _WIN32.
+
+ * win32/win32.c: include <mswsock.h> on __MINGW32__.
+
+ * configure.in: cleanup for autoconf 2.5x.
+
+ * configure.in: use gcc -shared instead of dllwrap on Cygwin/MinGW.
+
+ * ext/extmk.rb, lib/mkmf.rb: get rid of "--def=".
+
+Fri Apr 19 14:57:44 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * re.c (rb_reg_to_s): remove redundant shy group.
+
+Fri Apr 19 01:08:20 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_cleanup): current thread may be THREAD_STOPPED,
+ for example when terminated from signal handler.
+
+Thu Apr 18 19:03:15 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_compile_pattern): remove /p support.
+
+ * regex.h: ditto.
+
+ * parse.y (parse_regx): ditto.
+
+Thu Apr 18 17:01:43 2002 Takaaki Tateishi <ttate@kt.jaist.ac.jp>
+
+ * ext/dl/ptr.c (rb_dlptr_cast): removed.
+
+Thu Apr 18 17:01:43 2002 Tanaka Akira <akr@m17n.org>
+
+ * re.c (rb_reg_to_s): new function for Regexp#to_s.
+
+Wed Apr 17 23:55:34 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/Setup*, ext/bigfloat/*: Back out the import of BigFloat in
+ favor of its forthcoming successor, BigDecimal.
+
+Wed Apr 17 16:53:33 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_expr_str): should treat backslash specially in
+ escaping.
+
+Wed Apr 17 08:16:41 2002 Michal Rokos <m.rokos@sh.cvut.cz>
+
+ * io.c: complete off_t handling; missing argument for
+ fptr_finalize(); polished rb_scan_args call.
+
+Wed Apr 17 00:01:59 2002 Michal Rokos <m.rokos@sh.cvut.cz>
+
+ * dir.c: wrap multi-statement macro by do { } while (0)
+
+ * eval.c, numeric,c, sprintf.c, util.c: ditto.
+
+Tue Apr 16 08:59:50 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (assign): convert mrhs to mvalue.
+
+Mon Apr 15 18:12:57 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big_eq): check `y == x' if y is neither Fixnum,
+ Bignum, nor Float.
+
+Mon Apr 15 09:27:31 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * pack.c (pack_unpack): should treat 'U' in character unit, not in
+ byte unit.
+
+ * error.c (exc_initialize): should clear backtrace information.
+
+Sat Apr 13 23:42:43 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_fptr_cleanup): should close IO created by IO.new(fd).
+
+ * rubyio.h: remove FMODE_FDOPEN
+
+Fri Apr 12 12:54:04 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub: use missing/acosh.c.
+
+ * win32/config.h.in: define HAVE_COSH, HAVE_SINH, and HAVE_TANH.
+
+Fri Apr 12 02:58:55 2002 Koji Arai <jca02266@nifty.ne.jp>
+
+ * struct.c (rb_struct_select): fix typo.
+
+Fri Apr 12 00:34:17 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * MANIFEST (missing/acosh.c): added.
+
+ * Makefile.in (missing/acosh.c): ditto.
+
+ * Makefile.in (missing/fileblocks.c): ditto.
+
+ * configure.in (AC_REPLACE_FUNCS): check acosh() on behalf of
+ inverse hyperbolic functions, asinh() and atanh().
+
+ * missing/acosh.c: added for acosh(), asinh() and atanh().
+
+Thu Apr 11 20:01:44 2002 Masahiro Tomita <tommy@tmtm.org>
+
+ * io.c (io_write): check error if written data is less than
+ specified size to detect EPIPE.
+
+Thu Apr 11 19:10:37 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * io.c (remain_size): IO#read returns "" if file.size == 0.
+
+ * random.c (rand_init): add check for initstate(3).
+
+ * configure.in: ditto.
+
+Thu Apr 11 09:31:19 2002 Takaaki Tateishi <ttate@kt.jaist.ac.jp>
+
+ * ext/dl/ptr.c: raise() -> rb_raise(). (Thanks Tetsuya Watanabe)
+
+ * ext/dl/sym.c: ditto.
+
+Thu Apr 11 07:57:48 2002 Michal Rokos <m.rokos@sh.cvut.cz>
+
+ * eval.c (assign): ruby_verbose should be surrounded by RTEST().
+
+ * object.c (rb_str2cstr): ditto.
+
+ * parse.y (void_expr): ditto.
+
+ * parse.y (void_stmts): ditto.
+
+ * variable.c (rb_ivar_get): ditto.
+
+ * variable.c (rb_cvar_set): ditto.
+
+ * variable.c (rb_cvar_get): ditto.
+
+Thu Apr 11 07:02:31 2002 Takaaki Tateishi <ttate@kt.jaist.ac.jp>
+
+ * ext/dl: Add dl.txt instead of README and README.html.
+
+Thu Apr 11 01:55:52 2002 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/cgi/session.rb: support for multipart form.
+
+Wed Apr 10 18:42:23 2002 Tachino Nobuhiro <tachino@jp.fujitsu.com>
+
+ * dir.c (glob_helper): should have proceed link when link->path
+ was non existing symbolic link.
+
+Wed Apr 10 17:30:19 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_obj_remove_instance_variable): raise NameError if
+ specified instance variable is not defined.
+
+ * variable.c (generic_ivar_remove): modified to check ivar
+ existence.
+
+Wed Apr 10 14:16:45 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * misc/ruby-mode.el (ruby-font-lock-keywords): fontify symbols for
+ unary operators and aset.
+
+Tue Apr 9 13:40:31 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * lib/mkmf.rb (try_link0): need expand macro in command, sync with
+ ext/extmk.rb.in.
+
+ * lib/mkmf.rb (try_cpp): ditto.
+
+ * lib/mkmf.rb (egrep_cpp): ditto.
+
+Tue Apr 9 12:44:59 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ext/stringio/stringio.c (check_modifiable): performance
+ improvement. avoid calling rb_str_modify() twice.
+
+ * ext/stringio/stringio.c (strio_ungetc): ditto.
+
+ * ext/stringio/stringio.c (strio_putc): ditto.
+
+ * ext/stringio/stringio.c (strio_write): ditto, and use
+ rb_str_cat() as possible.
+
+Tue Apr 9 05:17:48 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * re.c (match_select): fix index references and make
+ MatchData#select actually work.
+
+Tue Apr 9 00:20:52 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (rb_file_s_extname): new method based on the proposal
+ (and patch) from Mike Hall. [new]
+
+Mon Apr 8 04:50:51 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (error_handle): default to 1 unless status is set.
+
+ * eval.c (ruby_options): guard error_handle() with PROT_NONE.
+
+ * eval.c (ruby_stop): ditto.
+
+Mon Apr 8 01:22:24 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * math.c (math_acosh): added. [new]
+
+ * math.c (math_asinh): ditto.
+
+ * math.c (math_atanh): ditto.
+
+ * struct.c (rb_struct_each_pair): method added. [new]
+
+Sat Apr 6 02:04:49 2002 Guy Decoux <ts@moulon.inra.fr>
+
+ * class.c (rb_singleton_class): wrong condition; was creating
+ unnecessary singleton class.
+
+Sat Apr 6 01:09:41 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * sprintf.c (remove_sign_bits): simplifies the condition.
+
+ * bignum.c (get2comp): calculate proper carry over.
+
+Fri Apr 5 05:07:28 2002 Takaaki Tateishi <ttate@kt.jaist.ac.jp>
+
+ * ext/dl: Add dl/struct.rb.
+
+Thu Apr 4 14:08:52 2002 Takaaki Tateishi <ttate@kt.jaist.ac.jp>
+
+ * ext/dl/lib/dl/import.rb: Get rid of ineffective
+ encoding/decoding procedures.
+
+Thu Apr 4 01:08:23 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (int_step): step may be a float less than 1.
+
+Wed Apr 3 20:42:34 2002 Takaaki Tateishi <ttate@kt.jaist.ac.jp>
+
+ * ext/dl: Merge Nakada's patch.
+
+ * ext/dl/dl.h: define StringValuePtr for ruby-1.6.
+
+Wed Apr 3 15:37:24 2002 Takaaki Tateishi <ttate@kt.jaist.ac.jp>
+
+ * ext/dl: Add dl/types.rb.
+
+Wed Apr 3 01:54:10 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ext/extmk.rb.in (enable_config): follow lib/mkmf.rb.
+
+Tue Apr 2 19:59:13 2002 Takaaki Tateishi <ttate@kt.jaist.ac.jp>
+
+ * ext/dl: Merge from rough.
+
+Tue Apr 2 15:17:54 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * Makefile.in (CPPFLAGS): remove @includedir@.
+
+ * lib/mkmf.rb (create_makefile): ditto.
+
+ * ext/extmk.rb.in (create_makefile): ditto.
+
+Tue Apr 2 15:09:05 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/socket/socket.c (sock_addrinfo): should clear addrinfo hints.
+
+Mon Apr 1 23:48:12 2002 Takaaki Tateishi <ttate@kt.jaist.ac.jp>
+
+ * lib/mkmf.rb: install any files using $INSTALLFILES.
+ (see also [ruby-dev:16683])
+
+Mon Apr 1 17:25:50 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_fptr_cleanup): need flush even when io will not be
+ closed.
+
+ * io.c (rb_io_initialize): was calling wrong function
+ rb_io_mode_flags().
+
+Mon Apr 1 16:52:00 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ext/sdbm/init.c (each_pair): moved prototype before the
+ definition.
+
+ * ext/racc/cparse/cparse.c (call_scaniter): ditto.
+
+Mon Apr 1 15:11:40 2002 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/racc/cparse/cparse.c: prototype; call_scaniter().
+
+ * ext/sdbm/init.c: prototype; each_pair().
+
+ * ext/tcltklib/tcltklib.c: prototypes; _timer_for_tcl() and ip_ruby(),
+ Nobu's patch at [ruby-dev:14483].
+
+Mon Apr 1 10:56:40 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (match_setter): it's OK to assign nil to $~.
+
+Mon Apr 1 03:55:46 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_fptr_cleanup): do not close IO created by for_fd().
+
+ * io.c (rb_io_initialize): mark IO created by for_fd
+
+ * ext/socket/socket.c (bsock_s_for_fd): ditto.
+
+Fri Mar 29 20:21:58 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * lib/mkmf.rb (create_makefile): default FLAGS to empty strings.
+
+Fri Mar 29 16:36:52 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * lib/mkmf.rb (arg_config): should use Shellwords::shellwords like
+ ext/extmk.rb.in.
+
+ * lib/mkmf.rb (enable_config): default had priority over command
+ line options and configure_args.
+
+ * lib/mkmf.rb: support autoconf 2.53 style variables from
+ environment.
+
+ * lib/mkmf.rb: add directory options.
+
+Fri Mar 29 15:49:29 2002 Usaku Nakamura <usa@ruby-lang.org>
+
+ * win32/README.win32: follow recent changes.
+
+Fri Mar 29 14:44:05 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (io_fflush): DRY patch from /Christoph applied.
+
+Thu Mar 28 18:58:13 2002 Usaku Nakamura <usa@ruby-lang.org>
+
+ * win32/Makefile.sub (config.status): reflect user defined $CC in
+ config.status.
+
+Thu Mar 28 18:03:51 2002 Minero Aoki <aamine@loveruby.net>
+
+ * ext/strscan/strscan.c: add taint check.
+
+ * ext/strscan/strscan.c: #getch/#get_byte should set regexp
+ registers.
+
+ * ext/strscan/strscan.c: remove useless #include directive.
+
+ * ext/strscan/strscan.c: refactor struct strscanner.
+
+Thu Mar 28 14:51:38 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c (sock_addrinfo): should specify socktype
+ from outside.
+
+Wed Mar 27 17:04:30 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (argf_binmode): should call next_argv() to initialize ARGF.
+
+ * io.c (argf_filename): ditto.
+
+ * io.c (argf_file): ditto.
+
+Wed Mar 27 14:47:32 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * io.c (READ_DATA_PENDING): configure.in has supported for uClibc,
+ so remove uClibc stuff.
+
+Wed Mar 27 13:14:43 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_sysseek): new method based on a patch from Aristarkh
+ A Zagorodnikov <xm@bolotov-team.ru>. [new]
+
+ * io.c (READ_DATA_PENDING): use !feof(fp) for default behavior.
+
+Tue Mar 26 20:28:50 2002 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb: HTTP.get accepts URI.
+
+ * lib/net/http.rb: new method HTTP.get_uri.
+
+ * lib/net/http.rb: add some HTTP 1.1 response codes.
+
+Tue Mar 26 20:25:28 2002 Minero Aoki <aamine@loveruby.net>
+
+ * doc/net/protocol.rd.ja, smtp.rd.ja, pop.rd.ja: removed.
+
+ * MANIFEST: remove doc/net/* entries.
+
+Tue Mar 26 18:45:15 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in (FILE_READPTR): check bufread instead of bufend
+ for uClibc.
+
+ * ext/extmk.rb.in (arg_config): should use Shellwords::shellwords.
+
+Tue Mar 26 01:56:33 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (primary): while/until statement modifiers to "begin"
+ statement now work as "do .. while" even when begin statement
+ has "rescue" or "ensure" [new].
+
+ * parse.y (bodystmt): rescue/ensure is allowed at every bodies,
+ i.e. method bodies, begin bodies, class bodies[new], and module
+ bodies[new].
+
+Mon Mar 25 22:10:04 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c (sock_addrinfo): should specify ai_socktype
+ for getaddrinfo hints.
+
+Mon Mar 25 17:18:48 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * dir.c (rb_push_glob): local variable 'maxnest' was
+ uninitialized.
+
+Mon Mar 25 16:53:30 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_f_abort): embed aborting message into exception
+ object [new].
+
+ * eval.c (terminate_process): utility function for exit and abort.
+
+Tue Mar 26 14:04:47 2002 okabe katsuyuki <HGC02147@nifty.ne.jp>
+
+ * win32/mkexports.rb: support VC++.NET.
+
+Tue Mar 26 14:00:17 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/bigfloat/bigfloat.c: Fix the initializer's function name
+ according to the new library name. (pointed out by nobu)
+
+Tue Mar 26 11:12:01 2002 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb: new file.
+
+Tue Mar 26 03:23:50 2002 Tanaka Akira <akr@m17n.org>
+
+ * lib/pp.rb (pp): return nil like p.
+
+Tue Mar 26 01:48:01 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/bigfloat/extconf.rb: Downcase the library name. (BigFloat.so
+ -> bigfloat.so)
+
+ * ext/bigfloat/bigfloat.c (BigFloat_inspect): Alter the inspect
+ format not to look like an array. (pointed out by akr)
+
+ * ext/bigfloat/bigfloat.c (BigFloat_hash): Implement BigFloat#hash.
+
+ * ext/bigfloat/bigfloat.c (BigFloat_dump, BigFloat_load):
+ Support marshaling.
+
+Tue Mar 26 00:38:11 2002 Tanaka Akira <akr@m17n.org>
+
+ * configure.in (FILE_READPTR): check _p for 4.4BSD.
+
+Mon Mar 25 23:39:25 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * configure.in (FILE_READPTR): new. for IO#gets improvement.
+
+ * io.c (READ_DATA_PENDING_PTR): ditto.
+
+ * io.c (remain_size): separated from read_all().
+
+ * io.c (read_all): argument changed.
+
+ * io.c (appendline): new. get a line and append to string.
+
+ * io.c (swallow): new. swallow continuous line delimiters.
+
+ * io.c (rb_io_getline_fast): add delimiter argument.
+
+ * io.c (rb_io_getline): performance improvement.
+
+Mon Mar 25 19:30:25 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/extmk.rb.in (arg_config): get rid of single quotes
+ for autoconf 2.53.
+
+Mon Mar 25 17:49:41 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * regex.c (mbc_startpos_func): VC6 seems to be unable to
+ understand forward declaration for static variables.
+
+ * dir.c (rb_push_glob): local variable 'maxnest' was
+ uninitialized.
+
+Mon Mar 25 13:24:20 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c (bsock_do_not_rev_lookup_set): should not be
+ allowed when $SAFE > 3.
+
+ * eval.c (rb_thread_ready): THREAD_TO_KILL threads should not turn
+ into THREAD_RUNNABLE on wakeup.
+
+ * eval.c (rb_thread_list): THREAD_TO_KILL threads should be in the
+ list.
+
+ * eval.c (thgroup_list): ditto; by moving gid clearance from
+ rb_thread_cleanup().
+
+Mon Mar 25 11:06:19 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * dln.c (dln_argv0): unused unless USE_DLN_A_OUT.
+
+ * regex.c (mbc_startpos_func): should be static.
+
+Sun Mar 24 12:19:09 2002 Koji Arai <jca02266@nifty.ne.jp>
+
+ * dir.c (fnmatch): "*/bar" (with FNM_PATHNAME flag) does not
+ match "foo/bar".
+
+Sun Mar 24 00:46:05 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * util.c (push_element): avoid warning for djgpp.
+
+Sat Mar 23 01:50:30 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (read_all): files on /proc filesystem with zero stat size,
+ may have contents.
+
+Fri Mar 22 18:07:29 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c (tcp_s_gethostbyname): refactored.
+
+ * ext/socket/socket.c (sock_s_gethostbyname): ditto.
+
+Fri Mar 22 16:46:54 2002 Minero Aoki <aamine@loveruby.net>
+
+ * ext/extmk.rb.in: replace mkdir with mkpath to compile racc/cparse.
+
+Fri Mar 22 16:22:55 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * the VMS support patch submitted by Akiyoshi, Masamichi
+ <Masamichi.Akiyoshi@jp.compaq.com> is merged.
+
+Fri Mar 22 16:27:24 2002 Minero Aoki <aamine@loveruby.net>
+
+ * lib/racc/parser.rb: new file.
+
+ * ext/racc/MANIFEST, cparse.c, depend, extconf.rb: new files.
+
+ * lib/README: add racc/parser.rb.
+
+ * ext/Setup*: add racc/cparse.
+
+Fri Mar 22 15:04:03 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (exec_under): changing ruby_class is OK, but should not
+ alter cbase.
+
+ * eval.c (yield_under_i): ditto.
+
+Fri Mar 22 15:44:38 2002 Minero Aoki <aamine@loveruby.net>
+
+ * ext/strscan/MANIFEST, strscan.c, depend, extconf.rb: new files.
+
+ * ext/Setup*: add strscan entry.
+
+Fri Mar 22 14:32:14 2002 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/protocol.rb: Protocol#start should return self.
+
+Fri Mar 22 14:14:21 2002 Tanaka Akira <akr@m17n.org>
+
+ * lib/resolv.rb: fix arguments to create exceptions.
+ Patch from matt@lickey.com. (ruby-bugs:PR#278)
+
+Fri Mar 22 13:51:11 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/bigfloat/.cvsignore, ext/bigfloat/MANIFEST: BigFloat 1.1.8
+ has been imported. Add .cvsignore and MANIFEST.
+
+Fri Mar 22 04:07:55 2002 Koji Arai <jca02266@nifty.ne.jp>
+
+ * sprintf.c (rb_f_printf): discard meaningless prefix ".." for '%u'.
+
+Thu Mar 21 01:11:37 2002 Usaku Nakamura <usa@ruby-lang.org>
+
+ * win32/Makefile.sub (config.status): fix install path (prefix).
+
+Thu Mar 21 01:03:05 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ext/configsub.rb: latest autoconf style support.
+
+Wed Mar 20 22:16:25 2002 Usaku Nakamura <usa@ruby-lang.org>
+
+ * mkconfig.rb: close duplicated $stdout before renaming rbconfig.rb.
+
+Wed Mar 20 21:54:17 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * win32/Makefile.sub: made variables configurable.
+
+ * win32/Makefile.sub (config.h): updates RUBY_PLATFORM from
+ Makefile.
+
+ * win32/Makefile.sub (config.status): ditto. and use recent
+ autoconf format.
+
+ * win32/Makefile.sub (clean): separate ext and local clean up.
+
+ * win32/Makefile.sub (distclean): ditto.
+
+ * win32/config.status.in: no longer used.
+
+Wed Mar 20 20:12:35 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * variable.c (rb_const_list): a temporary table must be freed.
+
+Wed Mar 20 19:44:09 2002 Tanaka Akira <akr@m17n.org>
+
+ * mkconfig.rb: don't touch rbconfig.rb if there is a trouble.
+
+Wed Mar 20 16:05:37 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (is_defined): should check receiver only once.
+
+ * eval.c (is_defined): should handle NODE_NEWLINE.
+
+Wed Mar 20 11:29:25 2002 Aristarkh A Zagorodnikov <xm@xml-objects.com>
+
+ * file.c (rb_file_s_expand_path): memory leak fixed.
+
+Wed Mar 20 00:36:43 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * util.c (ruby_getcwd): the content of buf is uncertain and must
+ not be printed when getcwd(buf, size) has failed.
+
+Mon Mar 18 22:19:52 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ext/stringio/stringio.c (check_modifiable): wrong declaration.
+
+Mon Mar 18 18:04:05 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ext/digest: add depend file.
+
+ * ext/digest/md5: ditto.
+
+ * ext/digest/rmd160: ditto.
+
+ * ext/digest/sha1: ditto.
+
+ * ext/digest/sha2: ditto.
+
+ * ext/iconv/MANIFEST: ditto.
+
+ * ext/stringio/MANIFEST: ditto.
+
+ * ext/syslog: ditto.
+
+Mon Mar 18 17:18:06 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (rb_f_abort): should not bypass cleanup.
+
+ * ext/stringio/stringio.c (check_modifiable): void function.
+
+Mon Mar 18 12:52:01 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/iconv/extconf.rb: workaround for GNU libiconv.
+
+Mon Mar 18 10:55:03 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * parse.y (parse_string): part of multi-byte sequence must not
+ match to paren.
+
+ * parse.y (parse_qstring): ditto.
+
+ * parse.y (parse_quotedwords): ditto.
+
+ * parse.y (str_extend): handle multi-byte characters.
+
+Mon Mar 18 10:31:20 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * enum.c (enum_find): catch a value before recycle.
+
+ * enum.c (enum_all): ditto.
+
+ * enum.c (enum_any): ditto.
+
+ * enum.c (enum_min): ditto.
+
+ * enum.c (enum_max): ditto.
+
+Sun Mar 17 20:08:04 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ext/iconv/depend: added.
+
+ * ext/stringio/depend: added.
+
+Sat Mar 16 22:43:53 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * missing/fileblocks.c: add for autoconf.
+
+Sat Mar 16 15:30:40 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_search): should clear last_match if pos is out of
+ string range.
+
+ * string.c (rb_str_index_m): ditto.
+
+ * string.c (rb_str_rindex): ditto.
+
+Sat Mar 16 09:04:58 2002 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * enum.c (enum_inject): use the first iterated element as the
+ initial value when omitted.
+
+ * enum.c (inject_i): ditto.
+
+ * enum.c (Init_Enumerable): Enumerable#inject now takes variable
+ count arguments.
+
+Fri Mar 15 19:47:31 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * win32/win32.c (StartSockets): remove duplicated lines.
+
+Fri Mar 15 17:44:08 2002 Usaku Nakamura <usa@ruby-lang.org>
+
+ * bignum.c, intern.h (rb_ull2big, rb_ll2big, rb_ull2inum, rb_ll2inum,
+ big2ull, rb_big2ull, rb_big2ll): use LONG_LONG macro instead of
+ long long.
+
+ * numeric.c, intern.h, ruby.h (rb_num2ll, rb_num2ull): ditto.
+
+ * ruby.h: use _I64_MAX and _I64_MIN if they are defined (for VC++).
+
+Fri Mar 15 14:02:43 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ext/iconv/iconv.c: fixed document, Iconv#new is no longer an
+ iterator. thanks to Tanaka Akira <akr@m17n.org>.
+
+Thu Mar 14 22:17:45 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ext/iconv: imported.
+
+Thu Mar 14 16:42:37 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_define_class): should handle autoload.
+
+ * class.c (rb_define_module): ditto.
+
+Thu Mar 14 16:18:12 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: autoconf 2.53 support. use AC_LIBOBJ.
+
+Thu Mar 14 00:29:12 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_match): should clear $~ if operand is nil.
+
+ * re.c (rb_reg_match2): ditto.
+
+Thu Mar 14 12:32:59 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ext/stringio/stringio.c: fixed frozen string bug. ungetc no
+ longer raises on readonly stream unless modifies actually.
+
+Thu Mar 14 08:57:41 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * dir.c (rb_push_glob): avoid SEGV when a block given.
+
+Thu Mar 14 00:16:02 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * string.c (rb_str_subpat_set): must make str independent after
+ rb_reg_search() matched.
+
+Wed Mar 13 19:05:15 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * dir.c: FNM_PERIOD is obsoleted and FNM_DOTMATCH is introduced
+ instead, which has the opposite meaning of FNM_PERIOD.
+
+ * dir.c: Dir::glob now accepts optional FNM_* flags via the second
+ argument, whereas Dir::[] doesn't.
+
+Wed Mar 13 18:36:55 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/getopts.rb: single_options can be nil[*], and is not not
+ optional. ([*]Pointed out by gotoken)
+
+Wed Mar 13 17:23:46 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * configure: merge Jonathan Baker's large file support patch
+ [ruby-talk:35316], with read_all patch in [ruby-talk:35470].
+
+Wed Mar 13 04:06:48 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_f_abort): optional message argument that be printed
+ on termination.
+
+Tue Mar 12 17:12:06 2002 Tanaka Akira <akr@m17n.org>
+
+ * lib/resolv.rb: don't complete domains for absolute FQNs.
+
+Mon Mar 11 23:08:48 2002 Tanaka Akira <akr@m17n.org>
+
+ * lib/tsort.rb: new file.
+
+Mon Mar 11 21:03:37 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ext/stringio: new.
+
+Mon Mar 11 18:03:37 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_compile_pattern): '\0111' should be '\011' plus '1',
+ since octal literals are formed by three digits at most.
+
+Mon Mar 11 14:44:38 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_object): module inclusion using extend() should
+ also be detected.
+
+ * eval.c (rb_eval_cmd): cbase should not be NULL; it should be
+ either ruby_wrapper or Object.
+
+Sun Mar 10 02:18:22 2002 Koji Arai <jca02266@nifty.ne.jp>
+
+ * enum.c (enum_each_with_index): should return self.
+
+ * process.c (proc_setpgrp): should return value for non-void function.
+
+ * process.c (proc_getpgid): should raise exception if getpgid() return -1.
+
+ * string.c (rb_str_ljust): should return a duplicated string.
+
+ * string.c (rb_str_rjust): ditto.
+
+ * string.c (rb_str_center): ditto.
+
+Sat Mar 9 08:45:58 2002 Tanaka Akira <akr@m17n.org>
+
+ * ext/socket/extconf.rb (have_struct_member): don't print checked
+ result.
+
+Fri Mar 8 12:19:15 2002 Tanaka Akira <akr@m17n.org>
+
+ * lib/resolv.rb: use its own thread group for background threads.
+
+Fri Mar 8 02:21:32 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (cvar_cbase): utility function to find innermost non
+ singleton cbase.
+
+ * eval.c (is_defined): adopt new cvar behavior.
+
+ * eval.c (rb_eval): ditto.
+
+ * eval.c (assign): ditto.
+
+Thu Mar 7 20:08:25 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * gc.c (rb_source_filename): added. holds unique strings for file
+ names with GC space.
+
+ * gc.c (rb_gc_mark): mark source file name.
+
+ * gc.c (gc_sweep): ditto.
+
+ * gc.c (Init_GC): initialize source file name table.
+
+ * intern.h (rb_source_filename): added.
+
+ * eval.c (rb_eval_string): use rb_source_filename().
+
+ * parse.y (yycompile): ditto.
+
+ * ruby.c (proc_options): ditto.
+
+ * ruby.c (load_file): ditto.
+
+ * ruby.c (ruby_script): ditto.
+
+ * ruby.c (ruby_prog_init): ditto.
+
+Wed Mar 6 17:58:08 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * dln.c (dln_load): use LoadLibrary instead of LoadLibraryEx.
+
+Wed Mar 6 16:50:37 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_mod_clone): should not call rb_obj_clone(), since
+ Module does not provide "allocate".
+
+ * class.c (rb_singleton_class): should create new singleton class
+ if obj is a class or module and attached object is different,
+ which means metaclass of singleton class is sought.
+
+ * time.c (time_s_alloc): now follows allocation framework.
+
+Tue Mar 5 05:56:29 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/getopts.rb: Rewrite to fix some bugs and complete features.
+ - Accept options with the colon in the first argument;
+ getopts("a:bcd:") is equivalent to getopts("bc", "a:", "d:").
+ - Do not discard the argument that caused an error.
+ - Do not discard '-', which commonly stands for stdin or stdout.
+ - Allow specifying a long option with a value using '='.
+ (command --long-option=value)
+ - Stop reading options when it meets a non-option argument.
+
+Mon Mar 4 13:19:18 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/extmk.rb.in (dir_config): Sync with mkmf.rb: Fix a bug where
+ --with-xx-{include,lib} is ignored when --with-xx-dir is
+ specified.
+
+Mon Mar 4 00:09:55 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): should initialize outer class variables from
+ methods in singleton class definitions.
+
+ * eval.c (assign): ditto.
+
+Fri Mar 1 11:29:10 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/socket/{addinfo.h,getaddrinfo.c} (gai_strerror): add const
+ qualifier only for uClibc.
+
+Fri Mar 1 11:22:51 2002 Amos Gouaux <amos+ruby@utdallas.edu>
+
+ * lib/net/imap.rb: added document.
+
+ * lib/net/imap.rb (getquotaroot): new method.
+
+ * lib/net/imap.rb (setacl): remove the rights if the rights
+ parameter is nil.
+
+ * lib/net/imap.rb (getacl): return an array of MailboxACLItem.
+
+Fri Mar 1 06:25:49 2002 Tanaka Akira <akr@m17n.org>
+
+ * ext/socket/extconf.rb (have_struct_member): new method.
+ check msg_control and msg_accrights in struct msghdr. check
+ sys/uio.h.
+
+ * ext/socket/socket.c: include sys/uio.h if available.
+ (thread_read_select): new function.
+ (unix_send_io): ditto.
+ (unix_recv_io): ditto.
+ (unix_s_socketpair): ditto.
+ (Init_socket): define UNIXSocket#send_io, UNIXSocket#recv_io,
+ UNIXSocket.socketpair and UNIXSocket.pair.
+
+ * dln.c (dln_load): fix typo.
+
+Wed Feb 27 16:30:50 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_mod_include): load modules in argument order.
+
+ * st.c (st_init_table_with_size): num_bins should be prime numbers
+ (no decrement).
+
+ * st.c (rehash): ditto.
+
+Wed Feb 27 13:18:49 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * io.c (READ_DATA_PENDING): uClibc support.
+
+ * random.c (rand_init): ditto.
+
+ * ext/socket/{addinfo.h,getaddrinfo.c} (gai_strerror): ditto.
+
+Wed Feb 27 07:05:17 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/sha2/sha2.c: Merge from rough. Fix a couple of
+ off-by-one errors in Aaron Gifford's code.
+
+ Obtained from: KAME via FreeBSD
+ KAME PR: 393
+ FreeBSD PR: kern/34242
+
+Wed Feb 27 03:36:47 2002 Koji Arai <jca02266@nifty.ne.jp>
+
+ * ext/dbm/dbm.c (fdbm_select): 1.7 behavior.
+
+ * ext/gdbm/gdbm.c (fgdbm_select): ditto.
+
+ * ext/sdbm/sdbm.c (fsdbm_select): ditto.
+
+ * ext/dbm/dbm.c (fdbm_delete): adopt Hash#delete behavior.
+
+ * ext/sdbm/sdbm.c (fsdbm_delete): ditto.
+
+ * ext/gdbm/gdbm.c: need not to dup key to the block.
+
+ * ext/sdbm/sdbm.c : replace RuntimeError with SDBMError.
+
+Tue Feb 26 21:34:07 2002 Usaku Nakamura <usa@ruby-lang.org>
+
+ * bignum.c (rb_big_2comp): void function cannot return any value.
+
+Tue Feb 26 16:52:12 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_f_missing): NoMethod error messages for true, false,
+ nil must respond visibility like for other objects.
+
+Tue Feb 26 15:41:30 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): call trace_func for if/while conditions.
+
+ * marshal.c (r_object): separate r_regist from proc calling.
+
+Tue Feb 26 11:25:50 2002 akira yamada <akira@arika.org>
+
+ * lib/uri/generic.rb: merge0 should return [oth, oth] if oth is
+ absolute URI.
+
+ * lib/uri/generic.rb: registry part must not be allowed for any
+ schemes for the Internet. (RFC2396, section 3.2.2 and 3.2.1.)
+
+Mon Feb 25 21:22:41 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/syslog/syslog.c: Merge from rough. Use SafeStringValue().
+
+Mon Feb 25 21:12:08 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/syslog/syslog.c: Merge from rough. Turn Syslog into a
+ module keeping backward compatibility intact.
+
+Mon Feb 25 19:35:48 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * sample/test.rb (system): test with scripts under the source
+ directory.
+
+Mon Feb 25 15:14:01 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (method_inspect): should not dump core for unbound
+ singleton methods.
+
+ * object.c (rb_mod_to_s): better description.
+
+Mon Feb 25 13:32:13 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * lib/shell.rb (Shell::expand_path): relative to @cwd.
+
+Mon Feb 25 06:30:11 2002 Koji Arai <jca02266@nifty.ne.jp>
+
+ * hash.c (env_select): should path the assoc list.
+
+Sun Feb 24 17:20:22 2002 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/*/*.h: Merge from rough.
+ - Avoid namespace pollution. (MD5_* -> rb_Digest_MD5_*, etc.)
+
+Sat Feb 23 21:12:13 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * process.c (rb_syswait): thread kludge; should be fixed to
+ support native thread.
+
+Fri Feb 22 21:20:53 2002 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/protocol.rb: set read_timeout dynamically.
+
+ * lib/net/http.rb: @@newimpl is always true in the main trunk.
+
+ * lib/net/http.rb: HTTP.port -> default_port
+
+ * lib/net/http.rb: HTTPResponse.read_response_status ->
+ read_status_line
+
+Fri Feb 22 19:56:15 2002 Usaku Nakamura <usa@ruby-lang.org>
+
+ * win32/config.status.in: set LIBRUBY_SO.
+
+Fri Feb 22 03:34:38 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (get2comp): need to specify to carry or not.
+
+ * io.c (rb_io_inspect): embed path info.
+
+Fri Feb 22 11:30:01 2002 Tanaka Akira <akr@m17n.org>
+
+ * lib/prettyprint.rb: FillGroup implemented.
+
+Thu Feb 21 21:40:18 2002 Usaku Nakamura <usa@ruby-lang.org>
+
+ * ext/extmk.rb.in (create_makefile): remove unnecessary -L option from
+ LIBS macro.
+
+Thu Feb 21 02:49:12 2002 Koji Arai <jca02266@nifty.ne.jp>
+
+ * pack.c (pack_pack): wrong # comment treatment.
+
+ * pack.c (pack_unpack): ditto.
+
+Wed Feb 20 15:15:03 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * intern.h: prototypes; rb_io_addstr(), rb_io_printf(),
+ rb_io_print(), rb_io_puts()
+
+ * io.c (rb_io_addstr): make extern.
+
+ * io.c (rb_io_printf): ditto.
+
+ * io.c (rb_io_print): ditto.
+
+ * io.c (rb_io_puts): ditto.
+
+Wed Feb 20 13:41:35 2002 Usaku Nakamura <usa@ruby-lang.org>
+
+ * io.c (rb_io_close): return Qnil.
+
+Wed Feb 20 12:41:59 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (rb_any_cmp): should handle Qundef in keys.
+
+ * eval.c (remove_method): should not remove a empty method to
+ implement "undef".
+
+ * eval.c (rb_eval): should allow singleton class def for
+ true/false/nil.
+
+Tue Feb 19 21:43:32 2002 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/protocol.rb: rename Protocol.port to default_port.
+
+ * lib/net/smtp.rb: ditto.
+
+ * lib/net/pop.rb: ditto.
+
+ * lib/net/http.rb: ditto.
+
+ * lib/net/protocol.rb: rename BufferedSocket class to
+ InternetMessageIO.
+
+ * lib/net/smtp.rb: ditto.
+
+ * lib/net/pop.rb: ditto.
+
+ * lib/net/http.rb: ditto.
+
+ * lib/net/protocol.rb: rename InternetMessageIO#write_pendstr to
+ write_message.
+
+ * lib/net/smtp.rb: ditto.
+
+ * lib/net/protocol.rb: new method
+ InternetMessageIO#through_message.
+
+ * lib/net/smtp.rb: ditto.
+
+ * lib/net/protocol.rb: rename InternetMessageIO#read_pendstr to
+ read_message_to.
+
+ * lib/net/pop.rb: ditto.
+
+ * lib/net/protocol.rb: rename InternetMessageIO#read_pendlist to
+ each_list_item
+
+ * lib/net/pop.rb: ditto.
+
+ * lib/net/protocol.rb: Now block size is 1024.
+
+ * lib/net/smtp.rb: new methods SMTP#esmtp? and #esmtp=.
+
+ * lib/net/http.rb: Using singleton method syntax instead of
+ singleton class clause, to avoid behavior change of class
+ variables in ruby 1.7.
+
+ * lib/net/http.rb: HTTPResponse class does not inherit from
+ Net::Response.
+
+ * lib/net/http.rb: divide HTTP#connecting into
+ {begin,end}_transport.
+
+ * lib/net/http.rb: unused class Accumulator removed.
+
+ * lib/net/http.rb: Net::HTTP reads response. not HTTPRequest.
+
+ * lib/net/http.rb: proxy related class-instance-variables are not
+ initialized correctly.
+
+Tue Feb 19 20:20:12 2002 Ed Sinjiashvili <edsin@swes.saren.ru>
+
+ * parse.y (str_extend): backslash escape was done wrong.
+
+Tue Feb 19 17:10:25 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * file.c (path_check_1): do not fail on world writable *parent*
+ directories too.
+
+Tue Feb 19 15:51:41 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (path_check_1): do not warn on world writable *parent*
+ directories.
+
+ * class.c (rb_include_module): should preserve ancestor order in
+ the included class/module.
+
+Tue Feb 19 14:45:32 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (path_check_1): should check directory sticky bits.
+
+ * process.c (security): need not to warn twice.
+
+ * marshal.c (r_object): complete restoration before calling
+ r_regist().
+
+Tue Feb 19 14:24:36 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): operators in the "op" rule should make
+ lex_state EXPR_ARG on EXPR_FNAME and EXPR_DOT.
+
+Tue Feb 19 13:38:10 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval_string_wrap): should hide the toplevel local
+ variable bindings by PUSH_SCOPE().
+
+Tue Feb 19 13:21:51 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * regex.c: fix prototypes of xmalloc(), xcalloc() and xrealloc().
+
+Tue Feb 19 13:16:08 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * io.c (rb_io_ungetc): don't fail pushed EOF back.
+
+Mon Feb 18 20:48:40 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * pack.c (pack_pack): avoid infinite loop at comment.
+
+ * pack.c (pack_unpack): ditto.
+
+Mon Feb 18 14:06:28 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * misc/ruby-mode.el (ruby-block-hanging-re): rescue block was too
+ indented.
+
+Mon Feb 18 13:56:44 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (expr_value, arg_value, primary_value): value_expr()
+ check in place.
+
+ * eval.c (block_pass): "&nil" should clear block given.
+
+Mon Feb 18 02:05:56 2002 Wolfgang Jahrling <wolfgang@pro-linux.de>
+
+ * dir.c (push_braces): remove MAXPATHLEN dependency.
+
+ * dir.c (dir_s_globd): ditto.
+
+ * dln.c (init_funcname): ditto.
+
+ * dln.c (load_1): ditto.
+
+ * dln.c (dln_load): ditto.
+
+ * configure.in: add GNU/Hurd switches.
+
+Fri Feb 15 17:44:26 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * pack.c (pack_pack): allows comment in template strings.
+
+ * pack.c (pack_unpack): ditto.
+
+Sun Feb 17 23:41:37 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * mkconfig.rb (Config::expand): expand ${} too.
+
+ * ext/extmk.rb.in (try_link0): expand command.
+
+ * ext/extmk.rb.in (try_cpp): ditto.
+
+ * ext/extmk.rb.in (extmake): default $LIBPATH to $libdir
+
+Sun Feb 17 21:39:24 2002 Tetsuya Watanabe <tetsuya.watanabe@nifty.com>
+
+ * ext/digest/md5/md5init.c (Init_md5): rb_cvar_declare() is
+ replaced by rb_cvar_set().
+
+ * ext/digest/rmd160/rmd160init.c (Init_rmd160): ditto.
+
+ * ext/digest/sha1/sha1init.c (Init_sha1): ditto.
+
+ * ext/digest/sha2/sha2init.c (Init_sha2): ditto.
+
+Sun Feb 17 18:10:09 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * class.c (rb_define_class): warn unless superclass is specified
+ explicitly.
+
+ * class.c (rb_define_class_under): ditto.
+
+Thu Feb 16 02:11:08 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * misc/ruby-mode.el (ruby-font-lock-keywords): fontify
+ instance/class/global variables start with '_'.
+
+Fri Feb 15 14:40:38 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): replace rb_cvar_declare() by rb_cvar_set().
+
+ * eval.c (assign): ditto.
+
+ * variable.c (rb_cvar_set): 4th argument (warn) added; define new
+ class variable if it's not defined yet.
+
+ * variable.c (rb_cvar_declare): removed.
+
+Fri Feb 15 13:36:58 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big_rshift): should properly convert the negative
+ value to 2's compliment.
+
+Thu Feb 14 17:38:35 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * parse.y: avoid SEGV at OP_ASIGN to pseudo variable.
+
+Thu Feb 14 14:13:16 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * struct.c (Init_Struct): should undefine "allocate" for Struct
+ class (it's redefined in the subclasses).
+
+Wed Feb 13 17:58:12 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (stmt): local variable declaration order was changed
+ since 1.6
+
+ * parse.y (arg): ditto.
+
+ * pack.c (pack_pack): add templates 'q' and 'Q'.
+
+ * pack.c (pack_unpack): ditto.
+
+ * bignum.c (rb_quad_pack): new utility function.
+
+ * bignum.c (rb_quad_unpack): ditto.
+
+Tue Feb 12 01:21:34 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (assignable): should emit CVASGN within the method
+ body.
+
+Mon Feb 11 06:13:53 2002 Matt Armstrong <matt@lickey.com>
+
+ * dir.c (dir_s_glob): should not warn even if no match found.
+
+Mon Feb 11 04:25:54 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): clean up class variable behavior.
+
+ * eval.c (assign): ditto.
+
+ * eval.c (is_defined): ditto.
+
+ * variable.c (rb_mod_class_variables): need not to call rb_cvar_singleton().
+
+ * variable.c (rb_cvar_singleton): removed.
+
+Mon Feb 11 00:10:41 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * regex.c (re_compile_fastmap): skip begpos.
+
+Sun Feb 10 16:52:53 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ruby.c (load_file): avoid SEGV on '#' only input.
+
+Fri Feb 8 23:07:23 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): singleton check should be moved from yycompile
+ to here.
+
+ * eval.c (is_defined): check should be added here too.
+
+Fri Feb 8 05:31:48 2002 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb: HTTP.Proxy should use self for proxy-class's
+ super class.
+
+ * lib/net/http.rb: initialize HTTP.proxy_port by HTTP.port.
+
+Fri Feb 8 01:27:33 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yycompile): should inherit "in_single" if eval happened
+ in a singleton method.
+
+ * eval.c (rb_eval): class variables from singleton methods defined
+ within singleton class statement should work like ones defined
+ by singleton def statements.
+
+Thu Feb 7 13:44:08 2002 akira yamada <akira@arika.org>
+
+ * uri/common.rb (URI::join): new method.
+
+ * uri/generic.rb (Generic#merge): URI.parse("http://a/")+"b" should
+ return "http://a/b" but it returned "http://a//b".
+
+ * uri/generic.rb (Generic#check_path): corrected error message,
+ @path -> v
+
+Thu Feb 7 00:18:43 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (io_write): flag when buffered write is done.
+
+ * io.c (fptr_finalize): do not raise error on EBADF if write
+ buffer is empty.
+
+Wed Feb 6 17:18:54 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * configure.in: keep old config.h unless changed.
+
+Wed Feb 6 13:28:53 2002 Amos Gouaux <amos+ruby@utdallas.edu>
+
+ * lib/net/imap.rb: OpenSSL support.
+
+ * lib/net/imap.rb (setquota): unset quota if the second argument
+ is nil.
+
+Wed Feb 6 13:05:11 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_readlines): avoid calling GetOpenFile() repeatedly.
+
+ * io.c (rb_io_each_line): ditto.
+
+ * io.c (argf_getline): ditto.
+
+ * process.c: should include <time.h> to get proper CLK_TCK.
+
+Wed Feb 6 02:10:30 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * io.c (fptr_finalize): ignore EBADF when f and f2 use same
+ descriptor.
+
+Tue Feb 5 16:17:20 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (fptr_finalize): should raise error when fclose fails.
+
+ * eval.c (method_inspect): proper output format to distinguish
+ methods and singleton methods.
+
+Mon Feb 4 22:44:58 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * file.c (rb_file_s_expand_path): should terminate.
+
+Mon Feb 4 15:38:29 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_class_real): should not follow ICLASS link
+
+ * variable.c (classname): should follow ICLASS link explicitly.
+
+ * eval.c (rb_call): ditto.
+
+Fri Feb 1 19:10:04 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * intern.h: prototypes for new functions; rb_cstr_to_inum(),
+ rb_str_to_inum(), rb_cstr_to_dbl(), rb_str_to_dbl()
+
+ * bignum.c (rb_cstr_to_inum): changed from rb_cstr2inum(), and
+ added argument badcheck to be consistent with parser. [new]
+
+ * bignum.c (rb_str_to_inum): ditto.
+
+ * bignum.c (rb_cstr2inum): wrapper of rb_cstr_to_inum() now.
+
+ * bignum.c (rb_str2inum): ditto.
+
+ * object.c (rb_cstr_to_dbl): float number parser. [new]
+
+ * object.c (rb_str_to_dbl): ditto.
+
+ * object.c (rb_Float): use rb_cstr_to_dbl() for strict check.
+
+ * object.c (rb_Integer): use rb_str_to_inum() for strict check.
+
+ * string.c (rb_str_to_f): use rb_str_to_dbl() with less check.
+
+ * string.c (rb_str_to_i): use rb_str_to_inum() with less check.
+
+ * string.c (rb_str_hex): ditto.
+
+ * string.c (rb_str_oct): ditto.
+
+ * sprintf.c (rb_f_sprintf): ditto.
+
+ * time.c (obj2long): ditto.
+
+ * parse.y (yylex): use rb_cstr_to_inum() for strict check.
+
+Fri Feb 1 17:46:39 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * regex.c (mbc_startpos): become macro.
+
+ * regex.c (euc_startpos): added for improvement.
+
+ * regex.c (sjis_startpos): ditto.
+
+ * regex.c (utf8_startpos): ditto.
+
+Fri Feb 1 00:03:30 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (rb_stat_inspect): print dev, rdev in hexadecimal.
+
+Thu Jan 31 20:45:33 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * lib/mkmf.rb (dir_config): prior --with flag.
+
+ * lib/mkmf.rb (arg_config): avoid special variables for
+ font-lock-mode.
+
+Thu Jan 31 13:22:36 2002 Tanaka Akira <akr@m17n.org>
+
+ * lib/pp.rb (File::Stat#pretty_print): print rdev_major and rdev_minor.
+
+Wed Jan 30 15:58:04 2002 K.Kosako <kosako@sofnec.co.jp>
+
+ * regex.c (re_adjust_startpos): fix for SJIS and UTF-8.
+
+ * regex.c (mbc_startpos): ditto.
+
+Wed Jan 30 13:37:05 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_search): should set regs.allocated.
+
+Wed Jan 30 02:25:38 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * regex.c (re_adjust_startpos): search start of multibyte
+ backward.
+
+ * regex.c (mbc_startpos): ditto.
+
+Tue Jan 29 17:59:20 2002 Tanaka Akira <akr@m17n.org>
+
+ * file.c: `major' and `minor' macro needs sys/mkdev.h on SunOS 5.x.
+
+ * configure.in: add check for `sys/mkdev.h'.
+
+ * lib/pp.rb: don't print a mode File::Stat as decimal number.
+
+Mon Jan 28 19:16:58 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * array.c (rb_ary_fill): shouldn't yield unless block given.
+
+Mon Jan 28 18:33:18 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * parse.y (yylex): strict check for numbers.
+
+Mon Jan 28 18:01:01 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (rb_stat_rdev_major): added. [new]
+
+ * file.c (rb_stat_rdev_minor): added. [new]
+
+ * file.c (rb_stat_inspect): print mode in octal.
+
+Mon Jan 28 13:29:41 2002 K.Kosako <kosako@sofnec.co.jp>
+
+ * eval.c (is_defined): defined?(Foo::Baz) should check constants
+ only, no methods.
+
+ * eval.c (is_defined): should not dump core on defined?(a::b)
+ where a is not a class nor a module.
+
+Mon Jan 28 02:50:12 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (Init_Object): remove dup and clone from TrueClass,
+ FalseClass, and NilClass.
+
+ * array.c (rb_ary_fill): Array#fill takes block to get the value to
+ fill.
+
+Sat Jan 26 20:05:18 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_to_i): to_i(0) auto-detects base radix.
+
+ * array.c (rb_ary_initialize): fill by the block evaluation value
+ if block is given.
+
+Fri Jan 25 17:48:43 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in (solaris): add '-shared' only for GNU ld.
+
+Fri Jan 25 17:16:23 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_include_module): detect cyclic module inclusion.
+
+Fri Jan 25 02:17:56 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_cleanup): need not to free thread stacks at
+ process termination.
+
+ * array.c (rb_ary_fetch): use the block to get the default value
+ if the block is given.
+
+ * eval.c (rb_thread_schedule): should check time only if BOTH
+ WAIT_SELECT and WAIT_TIME.
+
+Thu Jan 24 11:49:05 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (umethod_bind): should update rklass field.
+
+ * hash.c (rb_hash_update): if a block is given, yields [key,
+ value1, value2] to the block to resolve conflict.
+
+Thu Jan 24 05:42:01 2002 Koji Arai <jca02266@nifty.ne.jp>
+
+ * string.c (rb_str_split_m): no need to consider KANJI
+ characters, if the length of separator is 1 (byte).
+
+Wed Jan 23 16:07:31 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (Init_Array): remove Array#filter.
+
+Wed Jan 23 13:27:44 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (rb_yield_0): restore source file/line after yield.
+
+Wed Jan 23 02:00:14 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_mod_initialize): should accept zero argument.
+
+ * object.c (rb_mod_cmp): should raise ArgumentError if
+ inheritance/inclusion relation between two classes/modules is
+ not defined. [new]
+
+Tue Jan 22 17:45:23 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_fsync): new method. [new]
+
+Mon Jan 21 22:57:18 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * signal.c (ruby_signal): must define sighandler_t for every
+ occasion.
+
+Mon Jan 21 08:25:30 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (ruby_stop): should not trace error handler.
+
+ * signal.c (install_sighandler): do not install sighandler unless
+ the old value is SIG_DFL.
+
+ * io.c (io_write): should not raise exception on O_NONBLOCK io.
+
+ * dir.c (dir_set_pos): seek should return dir, pos= should not.
+
+Sat Jan 19 02:31:45 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): need not to clear method cache for NODE_CLASS,
+ NODE_SCLASS.
+
+ * gc.c (obj_free): need not to clear method cache on class/module
+ finalization.
+
+Fri Jan 18 23:38:03 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_fetch): index out of range raises exception
+ unless optional second argument is specified.
+
+Fri Jan 18 17:32:09 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_s_new): block check moved from initialize to this
+ method.
+
+ * io.c (rb_io_s_open): open should call initialize too. IO#for_fd
+ also calls initialize. [new]
+
+Fri Jan 18 10:26:33 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * error.c (rb_sys_fail): replace INT2FIX() by INT2NUM() since
+ errno value may not fit in Fixnum size on Hurd.
+
+ * error.c (set_syserr): ditto.
+
+Fri Jan 18 10:12:00 2002 Usaku Nakamura <usa@ruby-lang.org>
+
+ * ext/socket/socket.c (tcp_svr_s_open): fix typo.
+
+Fri Jan 18 02:27:48 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * dir.c (dir_s_glob): returns nil if block given.
+
+ * io.c (rb_io_each_byte): should return self.
+
+ * io.c (rb_io_close_m): close check added.
+
+ * dir.c (dir_seek): should return pos.
+
+Fri Jan 18 01:21:53 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (fixpos): orig may be (NODE*)1, which should not be
+ dereferenced.
+
+Thu Jan 17 16:21:42 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (block_pass): allow "retry" from within argument passed
+ block. [new]
+
+ * eval.c (localjump_error): should preserve exit status in the
+ exception object. [new]
+
+ * eval.c (proc_invoke): should raise exception for "break" if it's
+ yielding, not calling. [new]
+
+ * eval.c (block_pass): should NOT raise exception for "break". [new]
+
+ * eval.c (block_pass): should allow block argument relay even in
+ the tainted mode.
+
+Thu Jan 17 04:51:48 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c: support subclassing by proper "initialize"
+ calling convention. [new]
+
+Wed Jan 16 18:25:08 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * st.c: primes should be primes.
+
+Wed Jan 16 12:29:14 2002 Tanaka Akira <akr@m17n.org>
+
+ * lib/timeout.rb (timeout): new optional argument to specify an
+ exception class.
+
+ * lib/resolv.rb: use Resolv::ResolvTimeout for internal timeout to
+ avoid problem with timeout of application.
+
+Wed Jan 16 11:12:30 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * object.c (rb_Float): remove underscores between digits.
+
+ * bignum.c (rb_cstr2inum): reject prefix followed by spaces only.
+
+ * class.c (rb_class_inherited): should use Object when no super
+ class.
+
+Tue Jan 15 01:11:44 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (is_defined): method defined? check should honor
+ protected too.
+
+Mon Jan 14 13:06:02 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (block_pass): should not pass tainted block, if $SAFE > 0.
+
+Sun Jan 13 09:31:41 2002 Koji Arai <jca02266@nifty.ne.jp>
+
+ * variable.c (rb_mod_remove_cvar): should pass the char*.
+
+Fri Jan 11 05:06:25 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * class.c (rb_make_metaclass): [new]
+
+ * class.c (rb_define_class_id): use rb_make_metaclass(), don't
+ call Class#inherited hook.
+
+ * class.c (rb_class_inherited): [new]
+
+ * class.c (rb_define_class): call Class#inherited hook here.
+
+ * class.c (rb_define_class_under): ditto after class path is set.
+
+ * class.c (rb_singleton_class): use rb_make_metaclass().
+
+ * eval.c (rb_eval): same as rb_define_class_under().
+
+ * intern.h: prototypes of rb_make_metaclass() and
+ rb_class_inherited().
+
+ * object.c (rb_class_s_new): use rb_make_metaclass() and
+ rb_class_inherited().
+
+ * object.c (Init_Object): use rb_make_metaclass().
+
+ * struct.c (make_struct): use rb_class_inherited().
+
+Thu Jan 10 19:15:15 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (rb_add_method): should clear cache by id always.
+
+ * eval.c (rb_disable_super): no longer need to clear cache before
+ rb_add_method().
+
+ * eval.c (rb_export_method): ditto.
+
+ * eval.c (rb_attr): ditto.
+
+ * eval.c (rb_undef): ditto.
+
+ * eval.c (rb_eval): ditto.
+
+ * eval.c (rb_mod_modfunc): ditto.
+
+ * eval.c (rb_mod_define_method): ditto.
+
+Thu Jan 10 11:42:47 2002 Usaku Nakamura <usa@ruby-lang.org>
+
+ * win32/resource.rb: Modify copyright in resource script.
+
+Thu Jan 10 07:15:44 2002 takuma ozawa <metal@mine.ne.jp>
+
+ * re.c (match_select): should propagate taintness.
+
+Thu Jan 10 00:54:57 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (rb_hash_set_default): Hash#default= should return the
+ new value.
+
+Wed Jan 9 20:21:09 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * misc/ruby-mode.el (ruby-calculate-indent): indentation after
+ comment at beginning of buffer failed.
+
+ * misc/ruby-mode.el (font-lock-defaults): unless XEmacs, set
+ font-lock variables in ruby-mode-hook.
+
+Tue Jan 8 15:56:20 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_to_i): accepts optional base argument. [new]
+
+ * numeric.c (rb_fix2str): should not handle negative fixnum values
+ int32 via calling sprintf() directly.
+
+Tue Jan 8 15:54:02 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (rb_add_method): clear replaced method from the cache.
+
+Mon Jan 7 12:38:47 2002 Tanaka Akira <akr@m17n.org>
+
+ * lib/time.rb (Time#xmlschema): new optional argument
+ fractional_seconds to specify a number of digits of
+ fractional part of the time.
+
+Sat Jan 5 13:18:11 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * range.c (range_member): beginning check was
+ wrong. [ruby-talk:30252]
+
+Sat Jan 5 03:07:34 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_new2): NULL pointer check added.
+
+Sat Jan 5 00:19:12 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * parse.y (yycompile): strdup()'ed twice.
+
+Fri Jan 4 18:29:10 2002 Michal Rokos <m.rokos@sh.cvut.cz>
+
+ * class.c (rb_define_module_under): should locate predefined
+ module using rb_const_defined_at().
+
+Fri Jan 4 17:23:49 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * misc/ruby-mode.el (ruby-forward-string): forward a string. [new]
+
+ * misc/ruby-mode.el (ruby-parse-region): handle nested parentheses
+ in a string and terminators in #{}.
+
+ * misc/ruby-mode.el (ruby-calculate-indent): ditto.
+
+Wed Jan 2 23:34:25 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/mkmf.rb (create_makefile): add -I. to CPPFLAGS.
+
+ * lib/mkmf.rb (create_makefile): srcdir support(.def and depend file).
+
+Wed Jan 2 11:51:56 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * process.c (rb_f_system): abandon vfork.
+
+ * io.c (pipe_open): ditto.
+
+Tue Jan 1 02:16:48 2002 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/curses/extconf.rb: add dir_config.
+
+ * Makefile.in (fake.rb): set RUBY_VERSION.
+
+Mon Dec 31 14:20:46 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * parse.y (yycompile): always store copy of filename.
+
+ * parse.y (rb_compile_file): no longer need to strdup() here.
+
+Mon Dec 31 05:26:40 2001 Ferris McCormick <fmccor@inforead.com>
+
+ * defines.h: sparc linux needs different FLUSH_REGISTER_WINDOWS
+
+Mon Dec 31 04:27:28 2001 Minero Aoki <aamine@mx.edit.ne.jp>
+
+ * lib/net/protocol.rb: Protocol#start returns the return value of
+ block.
+
+ * lib/net/protocol.rb: set timeout limit by default.
+
+ * lib/net/protocol.rb: new methods WriteAdapter#write, puts,
+ print, printf.
+
+ * lib/net/http.rb: rename HTTP#get2 to request_get, post2 to
+ request_post ...
+
+ * lib/net/smtp.rb: should not resolve HELO domain automatically.
+
+Sun Dec 30 00:59:16 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/extmk.rb.in, lib/mkmf.rb (have_library): accept -lm
+ unconditionally on mswin32/mingw32.
+
+Sat Dec 29 01:55:42 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_search): abandon stclass optimization.
+
+Fri Dec 28 14:39:05 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * array.c (rb_cmpint): fixed typo.
+
+Thu Dec 27 18:43:04 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * bignum.c (rb_cstr2inum): deny "0_".
+
+Thu Dec 27 01:54:02 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * bignum.c (rb_cstr2inum): allow "0\n" and so on.
+
+Wed Dec 26 19:24:21 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * error.c (rb_invalid_str): utility function to show inspect()'ed
+ string.
+
+ * bignum.c (rb_cstr2inum): prints invalid strings in inspect()'ed
+ format.
+
+ * object.c (rb_Float): ditto.
+
+Wed Dec 26 02:41:29 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_convert_type): no longer use rb_rescue().
+
+Tue Dec 25 18:32:16 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * re.c (rb_reg_search): initialize taint status of match object.
+
+Tue Dec 25 02:37:49 2001 Tanaka Akira <akr@m17n.org>
+
+ * lib/pp.rb, lib/prettyprint.rb: new files.
+
+Tue Dec 25 02:11:17 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_convert_type): check method response check before
+ invoking rb_rescue().
+
+ * object.c (rb_check_convert_type): ditto.
+
+Mon Dec 24 02:37:40 2001 Le Wang <lewang@bigfoot.com>
+
+ * misc/ruby-mode.el (ruby-font-lock-syntactic-keywords):
+ fix font-lock problem [ruby-talk:29296].
+
+Sat Dec 22 22:52:14 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_timeval): wrong cast to time_t.
+
+ * time.c (time_plus): ditto.
+
+Fri Dec 21 20:33:34 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * parse.y (str_extend): make up "#$;" handling.
+
+Fri Dec 21 16:18:17 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * dln.h, ruby.h, util.h: enable prototypes in C++.
+
+Fri Dec 21 15:12:41 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_plus): result should not be negative unless
+ NEGATIVE_TIME_T is defined.
+
+ * time.c (time_new_internal): should check tv_sec overflow too.
+
+ * time.c (time_timeval): should check time_t range when time is
+ initialized from float.
+
+ * time.c (time_plus): uses modf(3).
+
+Fri Dec 21 03:15:52 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (rb_mod_define_method): must not convert Method to Proc.
+
+Fri Dec 21 01:17:57 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * lib/mkmf.rb (with_destdir): new.
+
+ * lib/mkmf.rb: prefix target directories with $(DESTDIR) all.
+
+ * lib/mkmf.rb: no need to mkdir $(libdir)
+
+Thu Dec 20 14:08:20 2001 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/protocol.rb: rename Net::Socket to Net::BufferedSocket
+
+Thu Dec 20 13:51:52 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * variable.c (rb_cvar_set): add frozen class/module check.
+
+ * variable.c (rb_cvar_declare): add frozen class/module check.
+
+Thu Dec 20 01:01:50 2001 takuma ozawa <metal@mine.ne.jp>
+
+ * re.c (match_to_a): should propagate taint.
+
+ * re.c (rb_reg_s_quote): ditto.
+
+Wed Dec 19 16:58:29 2001 Shugo Maeda <shugo@ruby-lang.org>
+
+ * ext/readline/readline.c: new methods
+ Readline::basic_word_break_characters,
+ Readline::basic_word_break_characters=,
+ Readline::completer_word_break_characters,
+ Readline::completer_word_break_characters=,
+ Readline::basic_quote_characters,
+ Readline::basic_quote_characters=,
+ Readline::completer_quote_characters,
+ Readline::completer_quote_characters=,
+ Readline::filename_quote_characters,
+ Readline::filename_quote_characters=.
+
+Wed Dec 19 14:05:00 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_mod_define_method): define_method should follow
+ default method visibility.
+
+ * eval.c (rb_attr): should warn if the default method visibility
+ is "module_function" (can be error).
+
+ * eval.c (rb_mod_define_method): should define class/module method
+ also if the visibility is "module_function".
+
+ * eval.c (rb_mod_define_method): should call hook method
+ "method_added", and "singleton_method_added".
+
+Wed Dec 19 11:42:13 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * string.c: use RESIZE_CAPA for capacity change.
+
+Wed Dec 19 03:08:40 2001 Tanaka Akira <akr@m17n.org>
+
+ * lib/time.rb: date.rb is not required anymore.
+
+ * lib/resolv.rb: fix document. refine IPv6 regex.
+
+Tue Dec 18 23:24:53 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c (Init_socket): add listen method to
+ TCPServer and UNIXServer.
+
+Tue Dec 18 17:54:53 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * sample/test.rb: Hash#indexes -> Hash#select.
+
+Tue Dec 18 01:02:13 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_schedule): should not select a thread which is
+ not yet initialized.
+
+Mon Dec 17 18:53:49 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * string.c (rb_str_replace): swap arguments of OBJ_INFECT.
+
+Mon Dec 17 16:52:20 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * intern.h: add prototypes.
+ rb_gc_enable(), rb_gc_disable(), rb_gc_start(), rb_str_new5()
+ rb_str_buf_append(), rb_str_buf_cat(), rb_str_buf_cat2(),
+ rb_str_dup_frozen()
+
+ * ruby.h: added declaration.
+ rb_defout, rb_stdin, rb_stdout, rb_stderr, ruby_errinfo
+
+ * rubyio.h: changed double include guard macro to RUBYIO_H.
+
+ * array.c (inspect_call): make static.
+
+ * eval.c (dvar_asgn): ditto.
+
+ * io.c (rb_io_close_read): ditto.
+
+ * lex.c (rb_reserved_word): ditto.
+
+ * ruby.c: (req_list_head, req_list_last): ditto.
+
+ * ruby.c (require_libraries): ditto.
+
+Mon Dec 17 15:41:24 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_plus): wrong boundary check.
+
+ * time.c (time_minus): ditto.
+
+Mon Dec 17 15:19:32 2001 Tanaka Akira <akr@m17n.org>
+
+ * time.c: new method `gmtoff', `gmt_offset' and `utc_offset'.
+ (time_utc_offset): new function.
+ (Init_Time): bind above methods to `time_utc_offset'.
+
+ * time.c: 64bit time_t support.
+ (time_s_at): use NUM2LONG instead of NUM2INT for tv_sec.
+ (time_arg): initialize tm_isdst correctly.
+ use long to initialize tm_year.
+ (search_time_t): renamed from `make_time_t'.
+ (make_time_t): call `timegm' and `mktime' instead of `search_time_t'
+ if available.
+ (time_to_i): use LONG2NUM instead of INT2NUM.
+ (time_localtime): check localtime failure.
+ (time_gmtime): check gmtime failure.
+ (time_year): use LONG2NUM instead of INT2FIX.
+ (time_to_a): use long for tm_year.
+ (time_dump): check tm_year which is not representable with 17bit.
+ (time_load): initialize tm_isdst.
+
+ * configure.in: check existence of `mktime' and `timegm'.
+ check existence of tm_gmtoff field of struct tm.
+ fix negative time_t for 64bit time_t.
+
+ * missing/strftime.c: fix overflow by tm_year + 1900.
+
+ * lib/time.rb: use Time#utc_offset.
+
+Mon Dec 17 00:02:04 2001 Guy Decoux <ts@moulon.inra.fr>
+
+ * variable.c (find_class_path): should initialize iv_tbl if it's
+ NULL.
+
+Fri Dec 14 04:23:36 2001 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/pop.rb: new method Net::POP3.APOP
+
+ * lib/net/http.rb: set default Content-Type to
+ x-www-form-urlencoded (causes warning)
+
+ * lib/net/protocol.rb: remove Net::NetPrivate module.
+
+ * lib/net/smtp.rb: ditto.
+
+ * lib/net/pop.rb: ditto.
+
+ * lib/net/http.rb: ditto.
+
+Fri Dec 14 00:16:06 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_define_class): should return the existing class if
+ the class is already defined and its superclass is identical to
+ the specified superclass.
+
+ * class.c (rb_define_class_under): ditto.
+
+ * class.c (rb_define_module): should return the existing module if
+ the module is already defined.
+
+Thu Dec 13 09:52:59 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_new_internal): avoid loop to calculate negative
+ div, mod.
+
+ * time.c (time_cmp): should handle Bignums.
+
+Tue Dec 11 17:39:16 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * array.c (rb_ary_pop): should ELTS_SHARED flag check before
+ REALLOC.
+
+Tue Dec 11 12:45:28 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_match_m): should convert an argument into
+ regexp if it's a string.
+
+Tue Dec 11 03:40:23 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_select): Array#select(n,m,...) now works like
+ Array#indexes(n,m,..). [new, experimental]
+
+ * hash.c (rb_hash_select): ditto.
+
+ * hash.c (env_select): ditto.
+
+ * re.c (match_select): ditto.
+
+ * struct.c (rb_struct_select): ditto.
+
+Tue Dec 11 03:17:19 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * object.c (rb_class_real): follow included modules.
+
+Mon Dec 10 23:37:51 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * util.h: change prototype of ruby_qsort() to accord with its
+ definition.
+
+Mon Dec 10 20:30:01 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * gc.c (STR_ASSOC): use FL_USER3 instead of FL_USER2.
+
+Mon Dec 10 17:40:02 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * parse.y (str_extend): make up pushback call.
+
+Mon Dec 10 02:09:28 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_modify): should copy the internal buffer if the
+ modifying buffer is shared.
+
+ * array.c (ary_make_shared): make an internal buffer of an array
+ to be shared.
+
+ * array.c (rb_ary_shift): avoid sliding an internal buffer by
+ using shared buffer.
+
+ * array.c (rb_ary_subseq): avoid copying the buffer.
+
+Mon Dec 10 01:06:56 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (gettable): should freeze __FILE__ string.
+
+Sun Dec 9 18:06:26 2001 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/protocol.rb: calls on_connect before conn_command
+
+Sat Dec 8 23:27:44 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_puts): old behavior restored. rationale: a) if you
+ want to call to_s for arrays, you can just call print a, "\n".
+ b) to_s wastes memory if array (and sum of its contents) is
+ huge. c) now any object that has to_ary is treated as an array,
+ using rb_check_convert_type().
+
+Sat Dec 8 22:40:38 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (rb_hash_initialize): now accepts a block to calculate
+ the default value. [new]
+
+ * hash.c (rb_hash_aref): call "default" method to get the value
+ corresponding to the non existing key.
+
+ * hash.c (rb_hash_default): get the default value based on the
+ block given to 'new'. Now it takes an optional "key" argument.
+ "default" became the method to get the value for non existing
+ key. Users may override "default" method to change the hash
+ behavior.
+
+ * hash.c (rb_hash_set_default): clear the flag if a block is given
+ to 'new'
+
+Sat Dec 8 02:29:54 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (Init_Object): undef Data.allocate, left Data.new.
+
+Fri Dec 7 19:12:14 2001 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/smtp.rb: SMTP.new requires at least one arg.
+
+ * lib/net/pop.rb: POP.new requires at least one arg.
+
+ * lib/net/pop.rb: uses "raise *Error.new" instead of simple raise.
+
+ * lib/net/http.rb: HTTP.new requires at least one arg.
+
+ * lib/net/http.rb: changes implicit start algorithm.
+
+Fri Dec 7 15:49:39 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * ext/extmk.rb.in: ignore adding -Wl,-R to DLDFLAGS when the directory
+ is $topdir.
+
+Fri Dec 7 13:58:58 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/curses/curses.c (window_scrollok): use RTEST().
+
+ * ext/curses/curses.c (window_idlok): ditto.
+
+ * ext/curses/curses.c (window_keypad): ditto.
+
+ * ext/curses/curses.c (window_idlok): idlok() may return void on
+ some platforms; so don't use return value.
+
+ * ext/curses/curses.c (window_scrollok): ditto for consistency.
+
+ * ext/curses/curses.c: replace FIX2INT() by typechecking NUM2INT().
+
+Fri Dec 7 09:51:00 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (str_extend): should not process immature #$x and
+ #@x interpolation, e.g #@#@ etc.
+
+Fri Dec 7 03:21:18 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * enum.c (enum_sort_by): sort_by does not have to be stable always.
+
+ * enum.c (enum_sort_by): call qsort directly to gain performance.
+
+Thu Dec 6 18:52:28 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * ext/extmk.rb.in: add -Wl,-R flags to DLDFLAGS on netbsdelf.
+
+ * lib/mkmf.rb: ditto.
+
+Thu Dec 6 09:15:14 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * util.c (ruby_qsort): ruby_qsort(qs6) is now native thread safe.
+
+ * error.c (rb_sys_fail): it must be a bug if it's called when
+ errno == 0.
+
+Wed Dec 5 23:36:56 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (WC2MBC1ST): should not pass through > 0x80 number in UTF-8.
+
+Wed Dec 5 20:05:18 2001 Florian Frank <flori@ping.de>
+
+ * ext/socket/socket.c (bsock_send): should raise EWOULDBLOCK
+ exception.
+
+ * ext/socket/socket.c (s_recvfrom): ditto.
+
+ * ext/socket/socket.c (s_accept): ditto.
+
+ * ext/socket/socket.c (udp_send): ditto.
+
+Tue Dec 4 17:43:10 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ruby.h (DUPSETUP): new SETUP macro for duplication.
+
+ * time.c (time_dup): implement in Time class using DUPSETUP.
+
+ * time.c (time_getlocaltime): new method; probably requires
+ better name than getlocaltime. [new,experimental]
+
+ * time.c (time_getgmtime): ditto.
+
+ * array.c (rb_ary_dup): uses DUPSETUP.
+
+ * string.c (rb_str_dup): uses DUPSETUP. now properly copies
+ instance variables too.
+
+Tue Dec 4 03:49:06 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (io_fread): EAGAIN/EWOULDBLOCK should not terminate and
+ throw away the input.
+
+ * time.c (time_new_internal): underflow adjustment must not use
+ negative div/mod.
+
+ * time.c (time_cmp): should consider tv_usec on non Fixnum number
+ comparison.
+Sun Dec 9 23:00:54 2001 Keiju Ishitsuka <keiju@ishitsuka.com>
+ * matrix.rb: Vector#* bug. reported from Massimiliano Mirra
+ <info@chromatic-harp.com>.
+
+Sun Dec 9 22:15:59 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * enum.c (enum_sort_by): should replace with last elements.
+
+Mon Dec 3 16:06:57 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/socket/extconf.rb: remove -L/usr/local/lib.
+
+ * configure.in: add -Wl,-export-dynamic on NetBSD.
+
+Mon Dec 3 16:04:16 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * configure.in: not use X11BASE, since it's not always set.
+
+Mon Dec 3 13:53:49 2001 Tanaka Akira <akr@m17n.org>
+
+ * time.c (rb_strftime): buffer length condition was wrong.
+
+ * time.c (time_strftime): should backup buf to the original
+ buffer.
+
+Mon Dec 3 09:59:08 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_plus): must detect result overflow.
+
+ * time.c (time_minus): ditto.
+
+ * time.c (time_new_internal): round usec overflow and underflow
+ here.
+
+ * time.c (time_plus): move operand overflow/underflow check to
+ time_new_internal().
+
+ * time.c (time_minus): ditto.
+
+ * time.c (time_cmp): should consider tv_usec too.
+
+Mon Dec 3 03:32:22 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * configure.in: apply patch from NetBSD's pkgsrc (patch-aa).
+
+Sun Dec 2 22:01:52 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: use GCC, not without_gcc. remove without_gcc.
+
+ * ext/curses/extconf.rb: check for curses.h.
+
+ * ext/dbm/extconf.rb: check if $CFLAGS includes DBM_HDR.
+
+Sat Dec 1 12:13:20 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_gmtime): time_modify() should be called even if tm
+ struct is not calculated yet.
+
+Fri Nov 30 17:02:55 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: set target_cpu to i386 on cygwin and mingw32.
+
+ * configure.in: default --enable-shared to yes on cygwin and mingw32.
+
+Fri Nov 30 00:25:28 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * README.EXT: Appendix B is duplicated.
+
+ * README.EXT.ja: ditto.
+
+Thu Nov 29 00:28:07 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_equal): object with to_str must be treated as a
+ string.
+
+Wed Nov 28 18:46:28 2001 Ville Mattila <mulperi@iki.fi>
+
+ * eval.c (rb_thread_select): should subtract timeofday() from
+ limit, not reverse.
+
+Wed Nov 28 16:03:28 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * util.c (scan_hex): x is not a hexadecimal digit.
+
+Wed Nov 28 13:38:04 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_schedule): should treat the case that
+ select(2) returns 0, if a thread is under both WAIT_SELECT and
+ WAIT_TIME. Jakub Travnik <J.Travnik@sh.cvut.cz> actually fixed
+ this bug.
+
+Tue Nov 27 02:15:25 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_float): must distinguish -0.0 from 0.0.
+
+Mon Nov 26 20:57:24 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/Setup*, ext/syslog/*: import the "syslog" module from the
+ rough ruby project.
+
+Mon Nov 26 16:14:42 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * gc.c (gc_mark_all): tweak mark order for little bit better scan.
+
+ * gc.c (rb_gc_mark): ditto.
+
+ * gc.c (rb_gc): ditto.
+
+Mon Nov 26 16:54:59 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * win32/win32.c (mypopen): fixed that mypclose() didn't really close
+ pipe.
+
+ * win32/win32.c (CreateChild): set STARTF_USESTDHANDLES flag only
+ when some handles are passed.
+
+Mon Nov 26 16:31:28 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * enum.c (sort_by_i): slight performance boost.
+
+Sun Nov 25 21:02:18 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * parse.y (str_extend): change types of second and third arguments
+ from char to int.
+
+Thu Nov 22 20:15:28 2001 TAMURA Takashi <sheepman@tcn.zaq.ne.jp>
+
+ * gc.c (gc_mark_rest): should call gc_mark_children(), not gc_mark().
+
+ * gc.c (rb_gc_mark): may cause infinite loop.
+
+Thu Nov 22 00:28:13 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (str_extend): should check nesting parentheses in #{}.
+
+Wed Nov 21 12:22:52 2001 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/cgi.rb: CGI#header: do not set Apache.request.status for
+ Location: if Apache.request.status is already set.
+
+Wed Nov 21 02:24:18 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * process.c (pst_wstopsig): returns nil unless WIFSTOPPED() is
+ non-zero.
+
+ * process.c (pst_wtermsig): returns nil unless WIFSIGNALED() is
+ non-zero.
+
+ * process.c (pst_wexitstatus): returns nil unless WIFEXITED() is
+ non-zero.
+
+Wed Nov 21 00:17:54 2001 Ville Mattila <mulperi@iki.fi>
+
+ * eval.c (rb_thread_select): tv_sec and tv_usec should not be
+ negative.
+
+ * signal.c (posix_signal): do not set SA_RESTART for SIGVTALRM.
+
+Tue Nov 20 21:09:22 2001 Guy Decoux <ts@moulon.inra.fr>
+
+ * parse.y (call_args2): block_arg may follow the first argument in
+ call_args2.
+
+Tue Nov 20 02:01:15 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (stack_check): should avoid stack length check during
+ raising SystemStackError exception.
+
+Tue Nov 20 01:07:13 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (str_extend): should not terminate string interpolation
+ with newlines in here-docs and newline terminated strings.
+
+Mon Nov 19 17:58:49 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_mod_modfunc): should follow NODE_ZSUPER link; based
+ on Guy Decoux's patch in [ruby-talk:25478].
+
+Mon Nov 19 16:09:33 2001 Tanaka Akira <akr@m17n.org>
+
+ * string.c (rb_str_succ): there was buffer overrun.
+
+Mon Nov 19 14:14:58 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (str_extend): term can be any character.
+
+Mon Nov 19 04:58:42 2001 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/cgi.rb (header): support for Apache. thanks to
+ Shugo Maeda <shugo@ruby-lang.org>.
+
+Sun Nov 18 19:37:55 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * parse.y: needless conditionals.
+
+ * parse.y (parse_regx): parse error at unterminated regex /#{.
+ (ruby-bugs-ja:PR#142)
+
+Sat Nov 17 12:37:39 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * pack.c (pack_unpack): should give length to utf8_to_uv().
+
+ * pack.c (utf8_to_uv): add length check.
+
+Sat Nov 17 01:41:52 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * massages: replace "wrong #" by "wrong number".
+
+ * marshal.c (w_float): output Infinity and NaN explicitly.
+
+ * marshal.c (r_object): support new explicit float format.
+
+ * eval.c (rb_thread_wait_for): select may cause ERESTART on
+ Solaris.
+
+ * eval.c (rb_thread_select): ditto.
+
+Thu Nov 15 15:29:39 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * array.c (rb_ary_join): non-nil separator must be converted to
+ String. and separators' total length was wrong.
+
+Thu Nov 15 03:37:17 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * hash.c (ruby_setenv): remove USE_WIN32_RTL_ENV block since it's
+ obsoleted.
+
+ * win32/win32.c, win32/win32.h: sort out #if 0 - #endif or others.
+
+Thu Nov 15 00:07:12 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_to_s): if rb_output_fs is nil, insert newlines
+ between array elements (use rb_default_rs as newline literal)
+ [experimental].
+
+Wed Nov 14 15:16:23 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * gc.c (init_mark_stack): no need to clear mark_stack.
+
+ * gc.c (gc_mark_all): need to handle finalizer mark.
+
+ * gc.c (gc_mark_rest): use MEMCPY instead of memcpy.
+
+ * gc.c (rb_gc_mark): earlier const check to avoid pusing special
+ constants into mark stack.
+
+Wed Nov 14 01:12:07 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * win32/win32.c (waitpid): fix wait count.
+
+ * win32/win32.c (poll_child_status): rename from wait_child().
+
+Wed Nov 14 01:33:49 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (fix_to_s): 'to_s' now takes optional argument to
+ specify radix. [new]
+
+ * bignum.c (rb_big_to_s): ditto. [new]
+
+Tue Nov 13 19:50:30 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: do not override CC if set.
+
+Tue Nov 13 16:49:16 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * win32/win32.c (mypopen): return error status instead of calling
+ rb_sys_fail().
+
+ * win32/win32.c (do_spawn): ditto.
+
+Tue Nov 13 14:39:11 2001 WATANABE Tetsuya <tetsu@jpn.hp.com>
+
+ * signal.c (sighandle): should not re-register sighandler if
+ POSIX_SIGNAL is defined.
+
+Tue Nov 13 12:55:59 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * win32/win32.c (do_spawn): use CreateChild() instead of calling
+ CreateProcess() directly. Original patches comes from Patrick Cheng.
+
+ * win32/win32.c (mypopen): ditto.
+
+ * win32/win32.c (mypclose): use rb_syswait() instead of waiting in this
+ function.
+
+ * win32/win32.c (waitpid): use wait_child() instead of _cwait().
+
+ * win32/win32.c (CreateChild): added. [new]
+
+ * win32/win32.c (wait_child): added. [new]
+
+ * win32/win32.c (FindFirstChildSlot): added. [new]
+
+ * win32/win32.c (FindChildSlot): added. [new]
+
+ * win32/win32.c (FindPipedChildSlot): added. [new]
+
+ * win32/win32.c (CloseChildHandle): added. [new]
+
+ * win32/win32.c (FindFreeChildSlot): added. [new]
+
+Tue Nov 13 12:38:12 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * hash.c (envix): use GET_ENVIRON and FREE_ENVIRON to get environment
+ variables list.
+
+ * hash.c (env_keys): ditto.
+
+ * hash.c (env_each_key): ditto.
+
+ * hash.c (env_values): ditto.
+
+ * hash.c (env_keys): ditto.
+
+ * hash.c (env_each_value): ditto.
+
+ * hash.c (env_each): ditto.
+
+ * hash.c (env_inspect): ditto.
+
+ * hash.c (env_to_a): ditto.
+
+ * hash.c (env_size): ditto.
+
+ * hash.c (env_empty_p): ditto.
+
+ * hash.c (env_has_value): ditto.
+
+ * hash.c (env_index): ditto.
+
+ * hash.c (env_to_hash): ditto.
+
+ * win32/win32.c (win32_getenv): use static buffer.
+
+ * win32/win32.c, win32/win32.h (win32_get_environ): get environment
+ variables list. [new]
+
+ * win32/win32.c, win32/win32.h (win32_free_environ): free environment
+ variables list. [new]
+
+Mon Nov 12 16:48:48 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (error_print): errat array may be empty.
+
+Mon Nov 12 01:30:37 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval_cmd): should not upgrade safe level unless
+ explicitly specified by argument newly added.
+
+ * signal.c (sig_trap): should not allow tainted trap closure.
+
+ * variable.c (rb_f_trace_var): should not allow trace_var on safe
+ level higher than 3.
+
+ * variable.c (rb_f_trace_var): should not allow tainted trace
+ closure.
+
+Sun Nov 11 00:12:23 2001 TAMURA Takashi <sheepman@tcn.zaq.ne.jp>
+
+ * gc.c: do not use static stack until system stack overflows.
+
+Sat Nov 10 03:57:09 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (eval): should call Exception#exception instead of
+ calling rb_exc_new3() directly.
+
+ * error.c (exc_exception): set "mesg" directly to the clone. it
+ might be better to set mesg via some method for flexibility.
+
+Sat Nov 10 00:14:24 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (cvar_override_check): should print original module
+ name, if 'a' is T_ICLASS.
+
+ * parse.y (yylex): float '1_.0' should not be allowed.
+
+ * variable.c (var_getter): should care about var as Qfalse
+ (ruby-bugs#PR199).
+
+Fri Nov 9 13:50:06 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * win32/config.status.in: make CFLAGS same as Makefile's one.
+
+Thu Nov 8 20:20:37 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (rb_trap_eval): avoid annoying warning with signal.
+ [ruby-talk:23225]
+
+ * eval.c (rb_call0): adjust caller source file/line while
+ evaluating optional arguments.
+
+Thu Nov 8 18:41:58 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (cmpint): <=> or block for {min,max} may return bignum.
+
+ * array.c (sort_1): use rb_compint.
+
+ * array.c (sort_2): ditto.
+
+ * enum.c (min_ii): ditto.
+
+ * enum.c (min_ii): ditto.
+
+ * enum.c (max_i): ditto.
+
+ * enum.c (max_ii): ditto.
+
+Thu Nov 8 18:21:02 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (path_check_1): forgot to initialize 'p'.
+
+Thu Nov 8 14:52:15 2001 Tanaka Akira <akr@m17n.org>
+
+ * mkconfig.rb: use String#dump to generate Ruby string literal.
+
+Thu Nov 8 15:46:54 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * range.c (range_eql): should override 'eql?'
+
+ * array.c (rb_ary_hash): should override 'hash' too.
+
+Tue Nov 6 14:38:48 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * process.c (security): always give warning for insecure PATH.
+
+ * dir.c (my_getcwd): do not rely on MAXPATHLEN.
+
+ * file.c (rb_file_s_readlink): ditto.
+
+ * file.c (path_check_1): ditto.
+
+Tue Nov 6 14:17:14 2001 Amos Gouaux <amos+ruby@utdallas.edu>
+
+ * lib/net/imap.rb (getquota_response): use astring for mailbox
+ names.
+
+ * lib/net/imap.rb (getacl_response): ditto.
+
+Mon Nov 5 17:09:55 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_yield_0): should not call rb_f_block_given_p().
+
+Sat Nov 3 23:33:18 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_chomp_bang): should terminate string by NUL.
+
+Sat Nov 3 22:28:51 2001 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * matrix.rb (Matrix#column_vectors, Matrix#row_vectors): ditto bug.
+ this bug report and fix by tsutomu@nucba.ac.jp.
+
+ * forwardable.rb: change raise to Kernel::raise
+
+Sat Nov 3 10:11:57 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_yield_0): better error message.
+
+Thu Nov 1 14:08:42 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big_aref): idx may be a Bignum.
+
+ * numeric.c (fix_aref): negative index must return zero.
+
+Thu Nov 1 13:23:50 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (gc_mark_children): should NOT treat last element of
+ structs and arrays specially.
+
+Wed Oct 31 16:59:25 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (exec_under): should initialize ruby_frame->self;
+
+Wed Oct 31 15:09:28 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (POP_VARS): should not set DVAR_DONT_RECYCLE if _old
+ ruby_vars is already force_recycled.
+
+Wed Oct 31 10:28:49 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (rb_gc): handles mark stack overflow.
+
+ * gc.c (PUSH_MARK): use static mark stack, no more recursion.
+
+Wed Oct 31 02:44:06 2001 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/cgi.rb: CGI::Cookie::parse(): Ignore duplicate keys caused by
+ Netscape bug.
+
+Tue Oct 30 18:21:51 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * win32/mkexports.rb: follow the change of rb_io_puts().
+
+Tue Oct 30 14:04:04 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_chomp_bang): do smart chomp if $/ == '\n'. [new]
+
+ * io.c (rb_io_puts): don't treat Array specially.
+
+ * bignum.c (rb_big_cmp): should convert bignum to float.
+
+ * eval.c (rb_f_eval): can't modify untainted binding.
+
+Mon Oct 29 16:08:30 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_compile_pattern): should preserve p0 value.
+
+Mon Oct 29 14:56:44 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * intern.h (rb_protect_inspect): follow the change of array.c.
+
+ * eval.c (rb_exec_end_proc): follow the change of rb_protect().
+
+ * eval.c (method_proc, umethod_proc, rb_catch): cast the first
+ parameter of rb_iterate() to avoid VC++ warning.
+
+ * range.c (range_step): ditto.
+
+ * ext/sdbm/init.c (fsdbm_update, fsdbm_replace): ditto.
+
+Mon Oct 29 07:57:31 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (str_extend): should allow interpolation of $-x.
+
+ * variable.c (rb_cvar_set): empty iv_tbl may cause infinite loop.
+
+ * variable.c (rb_cvar_get): ditto.
+
+ * variable.c (cvar_override_check): ditto.
+
+Sat Oct 27 23:01:19 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big_eq): convert Bignum to Float, instead of
+ reverse.
+
+Fri Oct 26 06:19:29 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_localtime): getting tm should not be prohibited for
+ frozen time objects.
+
+ * time.c (time_gmtime): ditto.
+
+ * version.c (Init_version): freeze RUBY_VERSION,
+ RUBY_RELEASE_DATE, and RUBY_PLATFORM.
+
+ * file.c (Init_File): freeze File::SEPARATOR, ALT_SEPARATOR and
+ PATH_SEPARATOR.
+
+ * file.c (rb_stat_cmp): should check operand type before calling
+ get_stat().
+
+Thu Oct 25 10:28:15 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval_cmd): should not invoke "call" with a block on
+ any occasion.
+
+Wed Oct 24 03:25:31 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (fix_aref): idx may be a Bignum.
+
+Tue Oct 23 01:21:19 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (proc_invoke): fix self switching in Proc#call
+ (ruby-bugs-ja#PR108) and GC failure. use Qundef instead of 0
+ to direct not switching self.
+
+ * eval.c (call_trace_func): ditto.
+
+ * eval.c (call_end_proc): ditto.
+
+ * eval.c (proc_call): ditto.
+
+ * eval.c (proc_yield): ditto.
+
+Tue Oct 23 01:15:43 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * variable.c (rb_global_entry): reconstruct global variable
+ aliasing (sharing global_entry->var with other global_entry).
+
+ * variable.c (undef_getter): ditto.
+
+ * variable.c (undef_setter): ditto.
+
+ * variable.c (val_setter): ditto.
+
+ * variable.c (mark_global_entry): ditto.
+
+ * variable.c (rb_define_hooked_variable): ditto.
+
+ * variable.c (rb_f_trace_var): ditto.
+
+ * variable.c (remove_trace): ditto.
+
+ * variable.c (rb_f_untrace_var): ditto.
+
+ * variable.c (rb_gvar_get): ditto.
+
+ * variable.c (trace_en): ditto.
+
+ * variable.c (rb_gvar_set): ditto.
+
+ * variable.c (rb_gvar_defined): ditto.
+
+ * variable.c (rb_alias_variable): ditto.
+
+Mon Oct 22 18:53:55 2001 Masahiro Tanaka <masa@stars.gsfc.nasa.gov>
+
+ * numeric.c (num_remainder): a bug in Numeric#remainder.
+
+Mon Oct 22 15:21:55 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_exec_end_proc): END might be called within END
+ block.
+
+ * class.c (rb_mod_clone): should not copy class name, since clone
+ should remain anonymous.
+
+Fri Oct 19 23:40:37 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * variable.c (remove_trace): should not access already freed area.
+
+ * variable.c (rb_f_untrace_var): fix memory leak.
+
+Fri Oct 19 17:55:14 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * marshal.c (w_uclass): cloned class is not user
+ class. (ruby-bugs-ja#PR103)
+
+ * marshal.c (r_object): Struct subclass couldn't
+ load. (ruby-bugs-ja#PR104)
+
+Wed Oct 17 14:12:50 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * variable.c (alias_fixup): added. ad hoc support for ordinary
+ global variable aliasing. when original entry is set, make the
+ alias to refer directly as possible.
+
+ * variable.c (alias_getter, alias_setter): ditto.
+
+ * variable.c (rb_alias_variable): ditto. and no need to mark alias
+ variables.
+
+ * variable.c (rb_gvar_defined): refer the original entry of an alias.
+
+Tue Oct 16 23:29:26 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_call0): self in a block given to define_method now be
+ switched to the receiver of the method.
+
+ * eval.c (proc_invoke): added new parameter to allow self
+ switching.
+
+Tue Oct 16 21:38:15 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (rb_f_missing): check stack level with rb_stack_check().
+
+ * eval.c (rb_call0): ditto.
+
+ * eval.c, intern.h (rb_stack_check): added. [new]
+
+Tue Oct 16 13:18:47 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * object.c (rb_mod_initialize): optional block with
+ Module.new. [new] (from 2001-10-10)
+
+Tue Oct 16 00:07:06 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * parse.y (yylex): disallow alpha-numeric and mbchar for
+ terminator of %string.
+
+Mon Oct 15 18:00:05 2001 Pit Capitain <pit@capitain.de>
+
+ * string.c (rb_str_index): wrong increment for non alphanumeric
+ string.
+
+Mon Oct 15 05:23:02 2001 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * sprintf.c (rb_f_sprintf): support "%B".
+
+Wed Oct 10 03:11:47 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (rb_stat_clone): should copy internal data too.
+
+ * numeric.c (num_clone): Numeric should not be copied by clone.
+
+ * object.c (rb_obj_clone): should check immediate values.
+
+ * parse.y (command): `yield' should take command_args.
+
+ * parse.y (parse_quotedwords): %w(...) is not a string.
+
+Tue Oct 9 18:40:35 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * process.c (Init_process): activate the case NT.
+
+Tue Oct 9 17:08:00 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (thread_status_name): separated from
+ rb_thread_inspect(). return string expression for thread status.
+
+ * eval.c (rb_thread_status, rb_thread_inspect): use
+ thread_status_name().
+
+ * eval.c (rb_thread_priority_set): return the priority not but
+ self.
+
+Sat Oct 6 23:07:08 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): NODE_MATCH3 was confusing left and right. sigh.
+
+Fri Oct 5 15:19:46 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_unique): should not dump anonymous class.
+
+Fri Oct 5 11:59:13 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (proc_s_new): revived.
+
+ * eval.c (Init_Proc): define Proc.new instead of Proc.allocate to
+ inhibit from creating uninitialized Proc.
+
+Thu Oct 4 14:11:03 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/socket/socket.c (ruby_connect): EALREADY is the equivalent
+ for EINPROGRESS in ws2_32.lib.
+
+Wed Oct 3 20:11:06 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * re.c (rb_reg_s_alloc): avoid infinite recursion.
+
+Wed Oct 3 16:49:49 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ext/gdbm/gdbm.c (rb_gdbm_fetch): str is a VALUE now.
+
+Wed Oct 3 13:32:06 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (r_object): better allocation type check for
+ TYPE_UCLASS. usage of allocation framework is disabled for now.
+
+ * variable.c (rb_class_path): Module may have subclass.
+
+ * string.c (rb_str_update): should maintain original negative
+ offset.
+
+ * string.c (rb_str_subpat_set): ditto
+
+ * string.c (rb_str_aset): ditto.
+
+ * re.c (rb_reg_nth_match): should check negative nth.
+
+ * re.c (rb_reg_nth_defined): ditto.
+
+Tue Oct 2 19:12:47 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/ftools.rb (catname): allow trailing '/' for the destination.
+
+Tue Oct 2 18:31:20 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): should override existing class.
+
+Tue Oct 2 17:08:49 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_obj_alloc): general instance allocation framework.
+ use of NEWOBJ() is deprecated except within 'allocate' method.
+
+Tue Oct 2 08:04:52 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * marshal.c (r_object): TYPE_UCLASS check should be inversed.
+
+Mon Oct 1 19:18:54 2001 Tanaka Akira <akr@m17n.org>
+
+ * ext/socket/socket.c (unix_addr): getsockname(2) may result len = 0.
+
+ * ext/socket/socket.c (unix_peeraddr): getpeername(2) may result
+ len = 0.
+
+Mon Oct 1 09:59:07 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_subpat_set): support function for new argument
+ pattern String#[re,offset] = val. [new]
+
+Sat Sep 29 02:30:06 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (POP_BLOCK): rb_gc_force_recycle() was called too much.
+ Should not be called if SCOPE_DONT_RECYCLE is set.
+
+Wed Sep 26 22:21:52 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_aref_m): new argument pattern
+ String#[re,offset]. [new]
+
+Wed Sep 26 19:02:39 2001 Guy Decoux <ts@moulon.inra.fr>
+
+ * parse.y: allow 'primary[] = arg'
+
+Tue Sep 25 10:46:42 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * win32/win32.c (isInternalCmd): check return value of NtMakeCmdVector
+ (Tietew <tietew@tietew.net>'s patch).
+
+Mon Sep 24 00:55:06 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_substr): should return an instance of
+ receiver's class.
+
+ * string.c (rb_str_succ): ditto.
+
+ * array.c (rb_ary_subseq): ditto.
+
+ * array.c (rb_ary_initialize): Array.new([1,2,3]) => [1,2,3]. [new]
+
+Sat Sep 22 22:16:08 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_reverse): should return an instance of
+ receiver's class.
+
+ * string.c (rb_str_times): ditto.
+
+ * array.c (rb_ary_times): ditto
+
+ * string.c (str_gsub): ditto.
+
+ * string.c (rb_str_ljust): ditto.
+
+ * string.c (rb_str_rjust): ditto.
+
+ * string.c (rb_str_center): ditto.
+
+Sat Sep 22 12:13:39 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (eval): retrieves file, line information from binding.
+
+Thu Sep 20 21:25:00 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (MATCH_DATA): access via rb_svar().
+
+Thu Sep 20 15:20:00 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c, intern.h (rb_svar): return reference to special variable
+ from local variable index. [new]
+
+ * eval.c (rb_eval): use rb_svar() for NODE_FLIP{2,3}.
+
+ * parse.y (rb_(backref|lastline)_(get|set)): access via rb_svar().
+
+ * eval.c (proc_invoke): push dynamic variables.
+
+ * eval.c (rb_thread_yield): push special variables as dynamic
+ variables($_, $~ and FLIP states).
+
+Thu Sep 20 15:20:00 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * intern.h, parse.y (rb_is_local_id): return true if the ID is
+ local symbol. [new]
+
+ * parse.y (internal_id): make new ID for internal use. [new]
+
+ * parse.y (cond0): allocate internal ID for NODE_FLIP{2,3}.
+
+ * eval.c (rb_f_local_variables): use rb_is_local_id() to select
+ visible local variables.
+
+Thu Sep 20 15:20:00 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (rb_thread_start_0): SCOPE_SHARED is removed.
+
+ * eval.c, intern.h (rb_thread_scope_shared_p): removed. special
+ variables are no longer shared by threads.
+
+ * re.c (rb_reg_search): MATCHDATA is no longer shared by threads.
+
+Tue Sep 18 11:44:26 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_init): String.new() => "" [new]
+
+Tue Sep 11 20:53:56 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * dir.c (dir_path): new method.
+
+ * dir.c (dir_initialize): wrap DIR into struct, along with path
+ information.
+
+Sat Sep 8 07:13:42 2001 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/net/telnet.rb: waitfor(): improvement. thanks to
+ nobu.nakada@nifty.ne.jp
+
+Sat Sep 8 04:34:17 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_restore_context): save current value of
+ lastline and lastmatch in the thread struct for later restore.
+
+ * eval.c (rb_thread_save_context): restore lastline and lastmatch.
+
+Fri Sep 7 11:27:56 2001 akira yamada <akira@ruby-lang.org>
+
+ * numeric.c (flo_to_s): should handle negative float value.
+
+Fri Sep 7 09:44:44 2001 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/net/telnet.rb: waitfor(): bug fix.
+
+Fri Sep 7 07:11:34 2001 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/cgi.rb: CGI#doctype(): bug fix (html4Fr).
+
+ * lib/net/telnet.rb, lib/cgi.rb: remove VERSION, RELEASE_DATE,
+ VERSION_CODE, RELEASE_CODE. please use REVISION.
+
+ * lib/cgi.rb: CGI#header(): bug fix.
+
+ * lib/net/telnet.rb, lib/cgi.rb: concat --> +=
+
+Thu Sep 6 17:38:18 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * dir.c (dir_s_chdir): raise if environment variable HOME/LOGDIR
+ not set.
+
+ * dir.c (glob_helper): avoid infinite loop on a file name with
+ wildcard characters. (ruby-bugs#PR177)
+
+Thu Sep 6 14:25:15 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/digest.c (rb_digest_base_s_hexdigest): remove a debug
+ print.
+
+Thu Sep 6 13:56:14 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/digest.c (rb_digest_base_s_digest,
+ rb_digest_base_s_hexdigest): ensure that a string is given.
+
+Thu Sep 6 13:28:51 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/jcode.rb (_regexp_quote): fix quote handling, again.
+
+Thu Sep 6 07:28:56 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * file.c (rb_find_file_ext): add const qualifiers to ext.
+
+ * intern.h (rb_find_file_ext): ditto.
+
+Thu Sep 6 07:16:14 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ext/socket/socket.c (Init_socket): remove duplicating constants.
+
+Thu Sep 6 03:15:24 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_include_module): should check whole ancestors to
+ avoid duplicate module inclusion.
+
+Wed Sep 5 20:02:27 2001 Shin'ya Adzumi <adzumi@denpa.org>
+
+ * string.c (trnext): should check backslash before updating "now"
+ position.
+
+Wed Sep 5 17:41:11 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/jcode.rb (_regexp_quote): fix quote handling.
+
+Tue Sep 4 01:03:18 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (Init_Regexp): to_s to be alias to inspect.
+
+Mon Sep 3 22:46:59 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): should support 'keyword='.
+
+Mon Sep 3 20:26:08 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * intern.h (rb_find_file_ext): changed from rb_find_file_noext().
+
+Mon Sep 3 15:12:49 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ruby.c (proc_options): should not adjust argc/argv if -e option
+ is supplied.
+
+Mon Sep 3 14:11:17 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * error.c: unbreak the build on *BSD with gcc 3.0.1 by removing
+ the conflicting declaration of sys_nerr for *BSD.
+
+Sat Sep 1 18:50:07 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ruby.c (proc_options): should not alter origargv[].
+
+ * ruby.c (set_arg0): long strings for $0 dumped core.
+
+Sat Sep 1 09:50:54 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ruby.c (set_arg0): prevent SEGV when val is longer than the
+ original arguments.
+
+ * ruby.c (ruby_process_options): initialize total length of
+ original arguments at first.
+
+Sat Sep 1 14:05:28 2001 Brian F. Feldman <green@FreeBSD.org>
+
+ * ruby.c (set_arg0): use setprogtitle() if it's available.
+
+Sat Sep 1 03:49:11 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_popen): accept integer flags as mode.
+
+Fri Aug 31 19:46:05 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * file.c (rb_find_file_ext): extension table can be supplied from
+ outside. renamed.
+
+ * eval.c (rb_f_require): replace rb_find_file_noext by
+ rb_find_file_ext.
+
+Fri Aug 31 19:26:55 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (rb_provided): should also check feature without
+ extension.
+
+Fri Aug 31 13:06:33 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (flo_to_s): do not rely on decimal point to be '.'
+
+Wed Aug 29 02:18:53 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): ternary ? can be followed by newline.
+
+Tue Aug 28 00:40:48 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_f_require): should check static linked libraries
+ before raising exception.
+
+Fri Aug 24 15:17:40 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_equal): check identity equality first.
+
+ * string.c (rb_str_equal): ditto.
+
+ * struct.c (rb_struct_equal): ditto.
+
+Fri Aug 24 14:38:17 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * dln.c (dln_strerror): fix a bug that sometimes made null message on
+ win32 (Tietew <tietew@tietew.net>'s patch).
+
+ * win32/win32.c (mystrerror): ditto.
+
+Fri Aug 24 03:15:07 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (Init_Numeric): undef Integer::new.
+
+Fri Aug 24 00:46:44 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): NODE_WHILE should update result for each
+ conditional evaluation.
+
+ * eval.c (rb_eval): NODE_UNTIL should return last evaluated value
+ (or value given to break).
+
+Thu Aug 23 21:59:38 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * enum.c (sort_by_i): fix typo.
+
+Thu Aug 23 10:10:59 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (is_defined): should not dump core for "defined?(())".
+
+ * eval.c (umethod_bind): recv can be an instance of descender of
+ oklass if oklass is a Module.
+
+Wed Aug 22 23:20:03 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (rb_hash_equal): check identity equality first.
+
+Wed Aug 22 19:58:59 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (intersect_fds): counts intersecting fds.
+
+ * eval.c (rb_thread_schedule): only fds requested by
+ each thread count as select_value.
+
+Tue Aug 21 22:28:09 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * file.c (group_member): should check real gid only.
+
+ * file.c (eaccess): do not cache euid, since effective euid may be
+ changed via Process.euid=().
+
+ * file.c (eaccess): return -1 unless every specified access mode
+ is permitted.
+
+Tue Aug 21 16:09:27 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): while/until returns the value which is given
+ to break.
+
+ * parse.y (value_expr): using while/until/class/def as an
+ expression is now gives a warning, not an error.
+
+Tue Aug 21 11:56:02 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * range.c (range_eqq): should compare strings based on magical
+ increment (using String#upto), not dictionary order.
+
+Mon Aug 20 19:53:16 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/digest/sha2/extconf.rb: fix support for cross-compiling.
+
+ * mkconfig.rb: fix support for autoconf 2.52.
+
+Mon Aug 20 17:24:15 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * enum.c (enum_sort_by): new method for Schewartzian transformed
+ stable sort.
+
+Mon Aug 20 16:09:05 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (mod_av_set): detect constant overriding for built-in
+ classes/modules.
+
+Mon Aug 20 15:14:27 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (tokadd_escape): escaped backslashes too much.
+
+Mon Aug 20 13:24:08 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * range.c (range_step): 'iter' here should be an array.
+
+Mon Aug 20 12:43:08 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_object): should retrieve __member__ data from
+ non-singleton class.
+
+Sat Aug 18 23:11:14 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_cvar_get): class variable override check added.
+
+ * variable.c (rb_cvar_set): ditto
+
+ * variable.c (rb_cvar_declare): ditto.
+
+Fri Aug 17 12:13:48 2001 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/protocol.rb: Protocol.new requires at least one arg.
+
+ * lib/net/smtp.rb: ditto.
+
+ * lib/net/pop.rb: ditto.
+
+ * lib/net/http.rb: ditto.
+
+Fri Aug 17 00:49:51 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (parse_regx): handle backslash escaping of delimiter here.
+
+Thu Aug 16 23:03:40 2001 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * io.c: prevent recursive malloc calls on NEC UX/4800.
+
+ * ext/socket/socket.c: ditto.
+
+Thu Aug 16 13:54:04 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * ext/socket/socket.c (s_recvfrom): fix typo.
+
+Thu Aug 16 09:53:28 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * ext/socket/socket.c (s_recvfrom): avoid VC++6 warning.
+
+Thu Aug 16 03:50:33 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * win32/win32.c (NtCmdGlob): avoid VC++ warning.
+
+ * lib/mkmf.rb: add -I$(srcdir) to CPPFLAGS.
+
+Wed Aug 15 04:59:15 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/*/extconf.rb: really fix so that they build from any
+ directory.
+
+Wed Aug 15 04:04:02 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/sha2/extconf.rb: fix so that they build from any
+ directory.
+
+Wed Aug 15 01:59:19 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/defs.h: Define NO_UINT64_T instead of emitting an
+ error to fail.
+
+ * ext/digest/sha2/extconf.rb: Do not exit on error, and utilize
+ NO_UINT64_T to detect if the system has a 64bit integer type.
+
+Tue Aug 14 21:14:07 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/sha2/extconf.rb: do not create Makefile when no 64bit
+ integer type is detected.
+
+Tue Aug 14 17:09:12 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * range.c (range_step): new method.
+
+Tue Aug 14 11:49:00 2001 TOYOFUKU Chikanobu <toyofuku@juice.or.jp>
+
+ * string.c (rb_str_cmp): remove needless conditional.
+
+Tue Aug 14 03:23:25 2001 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * string.c (rb_str_lstrip_bang) `return Qnil' was missing.
+
+Mon Aug 13 14:16:46 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * bignum.c, marshal.c: Detypo: s/SIZEOF_ING/SIZEOF_INT/.
+
+Sun Aug 12 15:01:58 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * string.c (rb_str_cat): fix buffer overflow.
+
+ * string.c (rb_str_append): nothing to append actually when `str2'
+ is empty.
+
+Sat Aug 11 14:43:47 2001 Tanaka Akira <akr@m17n.org>
+
+ * array.c (rb_inspecting_p): initialize inspect_key if it is
+ not initialized yet.
+
+Fri Aug 10 22:14:37 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (cond0): operands of logical operators are not treated
+ as conditional expression anymore, but propagate conditional
+ status if used in conditionals.
+
+Tue Aug 7 09:10:32 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * win32/win32.h: fix problems with BC++ (ruby-bugs#PR161).
+
+Mon Aug 6 23:47:46 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * pack.c (pack_pack): associates p/P strings once at last
+ (reverted to 1.26).
+
+ * string.c (rb_str_associate): associates an Array at once, not
+ but a String. realloc's when str_buf.
+
+Mon Aug 6 17:01:33 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_gc_mark_threads): should mark ruby_cref.
+
+Mon Aug 6 14:31:37 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * numeric.c (num_divmod): fix typo.
+
+Mon Aug 6 03:29:03 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_lstrip_bang): new method.
+
+ * string.c (rb_str_rstrip_bang): new method.
+
+Mon Aug 6 00:35:03 2001 Guy Decoux <decoux@moulon.inra.fr>
+
+ * struct.c (rb_struct_modify): should check frozen and taint
+ status.
+
+Sun Aug 5 19:28:39 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * string.c (rb_str_associate): should consider STR_ASSOC too.
+
+Sun Aug 5 07:46:18 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (rb_undefined): do not recurse if method_missing is
+ undefined.
+
+Thu Aug 2 21:37:32 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * process.c (proc_waitpid): now all arguments are optional.
+
+ * process.c (Init_process): waitpid is now alias to wait.
+
+ * process.c (Init_process): waitpid2 is now alias to wait2.
+
+ * process.c (rb_waitpid): made public.
+
+ * ext/pty/pty.c (pty_getpty): avoid disturbing SIGCHLD using
+ thread and rb_waitpid.
+
+Thu Aug 2 11:23:07 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * process.c (proc_getpgrp): now takes no argument on all
+ platforms.
+
+ * process.c (proc_setpgrp): ditto.
+
+Thu Aug 2 01:29:42 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * file.c (strrdirsep): removed meaningless code.
+
+ * file.c (rb_file_s_expand_path): reverted to 1.66.
+
+Wed Aug 1 16:17:47 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c (sock_s_pack_sockaddr_in): added
+ Socket::pack_sockaddr_in(). [new]
+
+ * ext/socket/socket.c (sock_s_pack_sockaddr_un): added
+ Socket::pack_sockaddr_un(). [new]
+
+ * ext/socket/socket.c (sock_s_pack_sockaddr_in): added
+ Socket::unpack_sockaddr_in(). [new]
+
+ * ext/socket/socket.c (sock_s_pack_sockaddr_un): added
+ Socket::unpack_sockaddr_un(). [new]
+
+Wed Aug 1 15:42:16 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * eval.c (ruby_run): avoid VC++ warning.
+
+Tue Jul 31 17:30:53 2001 Usaku Nakamura <usa@ruby-lang.org>
+
+ * marshal.c (Init_marshal): fix typos.
+
+Tue Jul 31 15:16:39 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * process.c (last_status_set): nothing returned, should be void.
+
+ * ext/socket/socket.c (load_addr_info): ditto.
+
+Tue Jul 31 12:11:42 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (Init_marshal): new constant Marshal::MAJOR_VERSION
+ and Marshal::MINOR_VERSION.
+
+Tue Jul 31 07:18:04 2001 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * file.c (rb_file_s_expand_path): scans per path element not per
+ byte/character, including fix of [ruby-talk:18152] and
+ multi-byte pathname support.
+
+Tue Jul 31 11:52:10 2001 akira yamada <akira@ruby-lang.org>
+
+ * marshal.c (marshal_load): ruby_verbose test should be wrapped by
+ RTEST().
+
+Mon Jul 30 17:54:23 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (rb_hash_index): should return nil (not the default
+ value) if value is not in the hash.
+
+Mon Jul 30 12:55:47 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (num_div): new method added. alias to '/' which
+ should be preserved even if '/' is redefined (e.g. by
+ mathn). [new]
+
+Mon Jul 30 11:12:14 2001 Amos Gouaux <amos+ruby@utdallas.edu>
+
+ * lib/net/imap.rb: added new commands for managing folder quotas
+ and folder ACLs.
+
+Mon Jul 30 03:19:53 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_cstr2inum): "0 ff".hex should return 0, not 255.
+
+Fri Jul 27 22:29:41 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * file.c (rb_file_s_expand_path): fixed using CharNext().
+
+Fri Jul 27 18:07:27 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_provided): extension should be guessed using
+ rb_find_file_noext().
+
+ * eval.c (rb_f_require): should call rb_feature_p() after
+ extension completion.
+
+Fri Jul 27 16:25:52 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): add CHECK_INTS before next, redo, retry to
+ avoid potential uninterruptable infinite loop.
+
+Thu Jul 26 11:27:12 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * file.c (rb_find_file_noext, rb_find_file): fix tilde expansion
+ problem.
+
+Wed Jul 25 17:54:20 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (rb_file_s_expand_path): use CharNext() to expand.
+
+Wed Jul 25 17:16:26 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * intern.h: add some missing function prototypes.
+
+Wed Jul 25 15:50:05 2001 Guy Decoux <decoux@moulon.inra.fr>
+
+ * file.c (rb_file_s_expand_path): should not expand "." and ".."
+ not following dirsep.
+
+Wed Jul 25 12:15:32 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * file.c (rb_find_file_noext): should update f by expanded path.
+
+ * file.c (rb_find_file): ditto.
+
+Tue Jul 24 23:10:47 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * file.c (strrdirsep): multi-byte pathname and DOSish separator
+ support. originally comes from Patrick Cheng. [new]
+
+ * file.c (rb_file_s_basename, rb_file_s_dirname): use
+ strrdirsep(). comes from Patrick Cheng.
+
+ * file.c (is_absolute_path): restricted in DOSish absolute path
+ with drive letter, and UNC support. originally comes from
+ Patrick Cheng.
+
+ * file.c (getcwd): define macro using getwd() unless provided.
+
+Tue Jul 24 19:23:15 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/extmk.rb.in, lib/mkmf.rb: dig the target subdirectory for
+ lib/* files properly in case of create_makefile("dir/name").
+
+Mon Jul 23 00:26:04 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_provide_feature): should not tweak extension used for
+ loading.
+
+Sun Jul 22 21:16:43 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/extmk.rb.in, lib/mkmf.rb: introduce a couple of new make
+ variables: CLEANFILES and DISTCLEANFILES. They'd typically be
+ defined in a file "depend".
+
+Sat Jul 21 09:40:10 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * io.c (io_fread): use fread(3) if PENDING_COUNT is available.
+
+Fri Jul 20 22:55:01 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * gc.c (ruby_xrealloc): fix a dangling bug which led memory
+ reallocation to fail even though the second try after a GC
+ succeeds.
+
+Fri Jul 20 03:00:46 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * class.c (rb_mod_include_p): Module#include? added. [new]
+
+Fri Jul 20 01:05:50 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (ignorecase_setter): give warning on modifying $=.
+
+ * string.c (rb_str_casecmp): new method. [new]
+
+ * string.c (rb_str_eql): separated from rb_str_equal(), make it
+ always be case sensitive. [new]
+
+ * string.c (rb_str_hash): made it always be case sensitive.
+
+Thu Jul 19 13:03:15 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (rb_f_require): should not include path in $" value
+
+ * file.c (rb_find_file): should return 0 explicitly on failure.
+
+Tue Jul 17 11:44:40 2001 Usaku Nakamura <usa@osb.att.ne.jp>
+
+ * ruby.h: enable volatile directive with VC++.
+
+ * regex.c: ditto.
+
+Tue Jul 17 06:01:12 2001 Minero Aoki <aamine@loveruby.net>
+
+ * doc/net/smtp.rd.ja, pop.rd.ja, http.rd.ja: new files.
+
+ * MANIFEST: add doc/net/{http,pop,smtp}.rd.ja.
+
+Tue Jul 17 11:22:01 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (NUM_FAILURE_ITEMS): was confusing NUM_REG_ITEMS and
+ NUM_NONREG_ITEMS, which have happened to be same value.
+
+Tue Jul 17 11:08:34 2001 Usaku Nakamura <usa@osb.att.ne.jp>
+
+ * ext/extmk.rb.in: modify RM macro because command.com/cmd.exe don't
+ recognize single quotation as quote character.
+
+ * lib/mkmf.rb: ditto.
+
+Tue Jul 17 01:38:15 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_class_new): subclass check moved to this function.
+
+ * class.c (rb_class_boot): check less version of rb_class_new().
+
+Man Jul 16 13:21:30 2001 Usaku Nakamura <usa@osb.att.ne.jp>
+
+ * file.c (file_load_ok): fix typo.
+
+Mon Jul 16 12:58:07 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (proc_invoke): should preserve iter status for embedded
+ frame in the block.
+
+Mon Jul 16 00:04:39 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (rb_file_s_expand_path): may overrun buffer on stack.
+
+Sun Jul 15 01:38:28 2001 Guy Decoux <decoux@moulon.inra.fr>
+
+ * string.c (rb_str_insert): forgot to call rb_str_modify().
+
+Sat Jul 14 12:26:30 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ext/digest/*/extconf.rb: fix so that they build from any
+ directory.
+
+Sat Jul 14 06:20:17 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/net/http.rb: HTTP#proxy? did not worked.
+
+Sat Jul 14 02:56:19 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/extmk.rb.in: support multi-level ext/ directories.
+ (e.g. you can have ext/foo, ext/foo/bar and ext/foo/baz)
+
+Sat Jul 14 02:55:02 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/.cvsignore: let cvs ignore extinit.c.
+
+Fri Jul 13 23:47:35 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_search): should consider reverse search.
+
+Fri Jul 13 22:26:09 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/mkmf.rb: use File::split to split a target into a prefix and
+ a module name. This also works around a just found bug of
+ String#rindex.
+
+ * ext/extmk.rb.in: ditto.
+
+Fri Jul 13 02:36:10 2001 Minero Aoki <aamine@loveruby.net>
+
+ * dir.c (dir_s_chdir): warn only when invoked from multiple
+ threads or block is not given.
+
+Thu Jul 12 15:11:48 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/socket/socket.c (ruby_connect): workaround for the setup of
+ Cygwin socket(EALREADY).
+
+Mon Jul 9 16:49:30 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/extmk.rb.in: modify RM macro.
+
+ * lib/mkmf.rb: ditto.
+
+Sun Jul 8 20:52:02 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ruby.h: fix a wrong function name: rb_iglob() -> rb_globi().
+
+Sun Jul 8 16:04:35 2001 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb: rename HTTP#request_by_name to send_request.
+
+ * lib/net/protocol.rb (ProtoSocket#read): modify typo.
+
+Sat Jul 7 17:45:35 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_convert_type): should use rb_rescue(), not rb_rescue2().
+
+ * range.c (range_init): ditto.
+
+Fri Jul 6 18:01:10 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_obj_dup): copies (actually does not free)
+ generic_ivar on dupif original owns them.
+
+Fri Jul 6 02:15:06 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/tempfile.rb: a tempfile must be created with mode 0600.
+
+Thu Jul 5 20:28:53 2001 Tietew <tietew@tietew.net>
+
+ * string.c (rb_str_each_line): should propagate taint mark.
+
+ * ext/nkf/nkf.c (rb_nkf_kconv): ditto.
+
+Fri Jul 6 14:54:27 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_f_require): revamp for simpler implementation.
+
+ * file.c (rb_find_file_noext): use String object, instead of
+ passing char* around.
+
+ * file.c (rb_find_file): ditto.
+
+Thu Jul 5 22:01:02 2001 Mitsuhiro Kondo <kondo@nik-prt.co.jp>
+
+ * dln.c (dln_load): should use NSLINKMODULE_OPTION_BINDNOW.
+
+Thu Jul 5 13:44:03 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ruby.c (load_file): local variables 'c' remain uninitialized on
+ xflag.
+
+Thu Jul 5 10:00:59 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_match): prefetched escaped character too early.
+
+Wed Jul 4 08:58:30 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_call0): add argument check for attr_readers.
+
+Wed Jul 4 04:22:44 2001 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb (HTTP#request_by_name): arg order changes.
+
+Wed Jul 4 04:07:36 2001 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb (HTTP#request_by_name): bug fix.
+
+ * lib/net/http.rb: does not write Connection: by default.
+
+ * lib/net/protocol.rb: "start" for started protocol is an error.
+
+ * lib/net/protocol.rb: "finish" for finished protocol is an error.
+
+Wed Jul 4 03:17:31 2001 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/http.rb: new method HTTP#request_by_name (test)
+
+ * lib/net/http.rb: new class HTTPGenericRequest
+
+Tue Jul 3 23:58:29 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/mkmf.rb: distclean should remove mkmf.log as well.
+
+Tue Jul 3 18:35:49 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval_string_wrap): should push frame (and adjust
+ cbase) before wrapped eval.
+
+ * eval.c (rb_eval_cmd): ditto.
+
+ * eval.c (eval): should update ruby_class always after all.
+
+Tue Jul 3 14:56:27 2001 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (block_pass): do not change wrapper information.
+
+ * eval.c (rb_yield_0): preserve wrapper information.
+
+Tue Jul 3 08:59:50 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * error.c (rb_name_error): raise NameError instead of LoadError.
+
+Mon Jul 2 17:22:00 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * error.c (exc_exception): clone the receiver exception instead of
+ creating brand new exception object of the receiver.
+
+Mon Jul 2 09:53:12 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval_string_wrap): extend new ruby_top_self, not
+ original self.
+
+ * eval.c (rb_eval_cmd): respect ruby_wrapper if set.
+
+ * eval.c (eval): do not update ruby_class unless scope is not
+ provided.
+
+Sun Jul 1 10:51:15 2001 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (eval): preserve wrapper information.
+
+ * eval.c (proc_invoke): ditto.
+
+ * eval.c (block_pass): ditto.
+
+Sat Jun 30 02:55:45 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (void_expr): too much warnings for void context
+ (e.g. foo[1] that can be mere Proc call).
+
+Fri Jun 29 17:23:18 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * error.c (rb_name_error): new function to raise NameError with
+ name attribute set.
+
+ * eval.c (rb_f_missing): set name and args in the exception
+ object. [new]
+
+ * error.c (name_name): NameError#name - new method.
+
+ * error.c (nometh_args): NoMethodError#args - new method.
+
+Fri Jun 29 15:29:31 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lex.c (rb_reserved_word): lex_state after tRESCUE should be
+ EXPR_MID.
+
+Thu Jun 28 00:21:28 2001 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/matrix.rb: resolve 'ruby -w' warnings.
+
+ * lib/irb/locale.rb: resolve 'ruby -w' warnings.
+
+ * lib/irb/multi-irb.rb: resolve 'ruby -w' warnings.
+
+ * lib/irb/ruby-lex.rb: fix problem for "\\M-\\..." and "\\C-\\..."
+ and resolve 'ruby -w' warnings.
+
+ * lib/irb/ruby-token.rb: fix typo
+
+ * lib/shell/command-processor.rb: resolve 'ruby -w' warnings.
+
+Wed Jun 27 08:53:26 2001 Minero Aoki <aamine@loveruby.net>
+
+ * lib/net/pop.rb: new methods POP3.auth_only, POP3#auth_only
+
+ * lib/net/http.rb: HTTP.Proxy returns self if ADDRESS is nil.
+
+ * lib/net/protocol.rb: new method ProtocolError#response
+
+ * lib/net/protocol.rb,smtp.rb,pop.rb,http.rb: add document.
+
+Tue Jun 26 18:42:42 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (add_heap): allocation size of the heap unit is doubled for
+ each allocation.
+
+Mon Jun 25 09:54:48 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * dir.c (isdelim): space, tab, and newline are no longer
+ delimiters for glob patterns.
+
+Sat Jun 23 22:28:52 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (svalue_to_avalue): new conversion scheme between single
+ value and array values.
+
+ * eval.c (avalue_to_svalue): ditto.
+
+ * eval.c (rb_eval): REXPAND now uses avalue_to_svalue(), return
+ and yield too.
+
+ * eval.c (rb_yield_0): use avalue_to_svalue().
+
+ * eval.c (proc_invoke): Proc#call gives avaules, whereas
+ Proc#yield gives mvalues.
+
+ * eval.c (bmcall): convert given value (svalue) to avalue.
+
+Sat Jun 23 18:28:52 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/readline/readline.c (readline_event): a non-void function
+ should return a value.
+
+Fri Jun 22 23:17:28 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/socket/socket.c (ruby_connect): workaround for the setup of
+ Cygwin socket.
+
+Fri Jun 22 23:11:17 2001 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/locale.rb: fix for require "kconv" problem
+
+Fri Jun 22 18:08:45 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_yield_0): no mvalue_to_svalue conversion here.
+
+ * eval.c (massign): takes svalue, convert it to mvalue inside.
+
+ * eval.c (rb_eval): parameters for yield/return are always
+ svalues now.
+
+ * eval.c (svalue_to_mvalue): more strict conversion.
+
+ * eval.c (mvalue_to_svalue): ditto.
+
+Fri Jun 22 17:12:23 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * st.c (new_size): prime hash size enabled.
+
+ * ext/socket/socket.c (Init_socket): SO_* constants added.
+
+Tue Jun 19 22:24:07 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * gc.c (rb_setjmp): avoid GCC 3.0 warnings.
+
+Tue Jun 19 18:19:30 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/readline/readline.c: add new methods:
+ Readline::completion_append_character and
+ Readline::completion_append_character=.
+
+Tue Jun 19 16:29:50 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (svalue_to_mvalue): new function to convert from svalue
+ to mvalue. [experimental]
+
+ * eval.c (mvalue_to_svalue): new function to convert from mvalue
+ to svalue.
+
+ * eval.c (rb_eval): use mvalue_to_svalue().
+
+ * eval.c (rb_yield_0): use mvalue_to_svalue().
+
+ * eval.c (proc_invoke): proper mvalue handling.
+
+Mon Jun 18 17:38:50 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_f_require): searches ".rb" and ".so" at the same
+ time. previous behavior (search ".rb", then ".so") has a
+ security risk (ruby-bugs#PR140).
+
+ * array.c (rb_ary_to_ary): new function to replace internal
+ rb_Array(), which never calls to_a, but to_ary (rb_Array() might
+ call both). [new]
+
+Mon Jun 18 00:43:20 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (PUSH_FAILURE_POINT): push option status again.
+
+ * regex.c (re_compile_pattern): avoid pushing unnecessary
+ option_set.
+
+Sat Jun 16 10:58:48 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_load): tainted string is OK if wrapped *and*
+ $SAFE >= 4.
+
+Thu Jun 14 16:27:07 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_start_0): should not nail down higher blocks
+ before preserving original context (i.e. should not alter
+ original context).
+
+Wed Jun 13 19:34:59 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * dir.c (Init_Dir): add a new method File::fnmatch? along with
+ File::Constants::FNM_*. While I am here, FNM_NOCASE is renamed
+ to FNM_CASEFOLD which is commonly used by *BSD and GNU libc.
+
+Wed Jun 13 09:33:45 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (proc_yield): new method equivalent to Proc#call but no
+ check for number of arguments. [new]
+
+Tue Jun 12 14:21:28 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * lib/mkmf.rb: target_prefix is only for installation, not for
+ build.
+
+Tue Jun 12 00:41:18 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (method_eq): new method Method#==. [new]
+
+Mon Jun 11 14:29:41 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * confgure.in: add RUBY_CANONICAL_BUILD.
+
+Sun Jun 10 17:31:47 2001 Guy Decoux <decoux@moulon.inra.fr>
+
+ * gc.c (STR_NO_ORIG): STR_NO_ORIG value was different between
+ string.c and gc.c
+
+Sat Jun 9 22:10:04 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): should convert *non-array at the end of
+ arguments by using Array().
+
+Sat Jun 9 17:04:30 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * hash.c (ruby_setenv): readline library leaves their environment
+ strings uncopied. "free" check revised.
+
+Sat Jun 9 16:31:03 2001 Usaku Nakamura <usa@osb.att.ne.jp>
+
+ * ext/extmk.rb.in: Use -F and -T for mswin32 because cl.exe doesn't
+ support -o officially and cl.exe considers that *.cc and *.cxx are
+ OBJs.
+
+ * lib/mkmf.rb: ditto.
+
+ * win32/Makefile.sub: Use del instead of rm.
+ All these changes are derived from Nobuyoshi Nakada's patch.
+ Thanks.
+
+Fri Jun 8 22:37:40 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (Init_stack): avoid __builtin_frame_address(2) to retrieve
+ stack bottom line.
+
+Fri Jun 8 18:14:12 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * st.c (numhash): should shuffle bits by dividing by prime number.
+
+Fri Jun 8 17:05:21 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): multiple assignment behavior fixed, which
+ results "*a = nil" makes "a == []" now.
+
+Fri Jun 8 15:25:09 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_f_require): should set SCOPE_PUBLIC before calling
+ dln_load().
+
+Thu Jun 7 17:28:00 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): exclude kDO_BLOCK too much by false condition.
+
+Wed Jun 6 23:02:36 2001 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/sync.rb: bug fix if obj.initialize has parameters when
+ obj.extend(Sync_m)
+
+ * lib/mutex_m.rb: modified bit
+
+Wed Jun 6 16:11:06 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_load): should check if tainted even when wrap is
+ specified.
+
+Wed Jun 6 14:34:27 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (mrhs_basic): "*arg" should always be expanded by REXPAND.
+
+ * regex.c (re_compile_pattern): too much optimization for the
+ cases like /(.|a)b/.
+
+Tue Jun 5 23:58:43 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (fc_i): removed vast string allocation.
+
+Tue Jun 5 16:45:48 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * error.c (Init_Exception): NameError went under StandardError,
+ and NoMethodError went under NameError.
+
+Tue Jun 5 16:40:06 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (rb_intern): non identifier symbols should be
+ categorized as ID_JUNK. [new]
+
+Tue Jun 5 16:15:58 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_mod_const_at): use hash table as internal
+ data. [new]
+
+ * variable.c (rb_mod_const_of): ditto.
+
+ * variable.c (rb_const_list): new function to convert internal
+ data (hash table) to array of strings.
+
+ * eval.c (rb_mod_s_constants): data handling scheme has changed.
+
+Tue Jun 5 15:16:06 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_add_method): should not call rb_secure(), for
+ last_func may not be set.
+
+ * io.c (rb_io_ctl): ioctl should accept any integer within C long
+ range.
+
+Tue Jun 5 13:41:13 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/etc/extconf.rb: use egrep_cpp.
+
+Tue Jun 5 12:44:59 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (r_object): wrong type check for modules.
+
+ * marshal.c (w_object): should not dump anonymous classes/modules.
+
+Tue Jun 5 01:19:34 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_open_file): use rb_file_sysopen_internal() if the 3rd
+ argument (permission flags) is given. [new, should be backported?]
+
+ * io.c (rb_io_mode_binmode): mode string (e.g. "r+") to flags to
+ open(2).
+
+Mon Jun 4 23:55:54 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): NODE_REXPAND expand an array of 1 element as
+ the element itself. [new, should be backported?]
+
+ * parse.y (ret_args): should treat "*[a]" in rhs expression as
+ "a", not "[a]".
+
+Mon Jun 4 04:14:53 2001 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/shellwords.rb: don't destroy argument.
+
+Sat Jun 2 23:23:05 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_compile_pattern): should push option modifier at the
+ right place.
+
+Sat Jun 2 23:05:20 2001 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/cgi/session.rb: don't use module_function for Class.
+
+Sat Jun 2 00:02:22 2001 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * irb messages: fix typos.
+
+Fri Jun 1 17:26:24 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * hash.c (replace_i): ignore when key == Qundef.
+
+Fri Jun 1 16:50:59 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (call_args2): confusion with list_append() and
+ list_concat() was fixed.
+
+Fri Jun 1 15:01:40 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): fixed 'print CGI::bar() {}, "\n"' syntax
+ breakage, adding new lex_state status. sigh. [new]
+
+Fri Jun 1 11:21:04 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: use waitpid on mingw32.
+
+ * ext/dbm/extconf.rb: include <ndbm.h>, not <gdbm.h>.
+
+Thu May 31 18:34:57 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * file.c (rb_file_s_unlink): should not allow if $SAFE >= 2.
+
+Thu May 31 17:23:25 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * range.c (Init_Range): define "to_ary".
+
+Thu May 31 13:30:25 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * mkconfig.rb, ext/configsub.rb: VERSION -> RUBY_VERSION.
+
+Thu May 31 08:00:58 2001 Usaku Nakamura <usa@osb.att.ne.jp>
+
+ * win32/dir.h: re-add.
+
+Thu May 31 01:25:59 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * configure.in: default --with-libc_r to `no' until the problem is
+ fixed. (FreeBSD only)
+
+Tue May 29 17:24:23 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * ruby.c (proc_options): unexpected SecurityError happens when -T4.
+
+Tue May 29 18:46:04 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_compile_pattern): * \1 .. \9 should be
+ backreferences always.
+
+ * regex.c (re_match): backreferences corresponding to
+ unclosed/unmatched parentheses should fail always.
+
+Tue May 29 16:35:49 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_cat): use rb_str_buf_cat() if possible. [new]
+
+ * string.c (rb_str_append): ditto.
+
+ * string.c (rb_str_buf_cat): remove unnecessary check (type,
+ taint, modify) to gain performance.
+
+ * string.c (rb_str_buf_append): ditto.
+
+ * string.c (rb_str_buf_finish): removed.
+
+Tue May 29 02:05:55 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_buf_new): buffering string function. [new]
+
+ * string.c (rb_str_buf_append): ditto.
+
+ * string.c (rb_str_buf_cat): ditto.
+
+ * string.c (rb_str_buf_finish): ditto.
+
+Mon May 28 23:20:43 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: remove unnecessary AC_CANONICAL_BUILD
+
+ * defines.h: #define HAVE_SETITIMER on Cygwin(bug fixed).
+
+ * ruby.c: use relative path from LIBRUBY_SO.
+
+ * ruby.c: don't use -mwin32 option on Cygwin.
+
+ * cygwin/GNUmakefile.in: ditto.
+
+ * ext/sdbm/_sdbm: ditto.
+
+ * ext/tcltklib/extconf.rb: ditto.
+
+ * ext/tcltklib/stubs.c: ditto.
+
+Mon May 28 22:12:01 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ext/extconf.rb.in: make the priority of the make rule of .c
+ higher than .C .
+
+Mon May 28 13:22:19 2001 Tanaka Akira <akr@m17n.org>
+
+ * time.c (make_time_t): local time adjustment revised.
+
+Mon May 28 02:20:38 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * dir.c (glob_helper): teach has_magic() to handle flags and get
+ glob_helper to properly support FNM_NOESCAPE.
+
+ * dir.c (fnmatch): fix a bug when FNM_PATHNAME and FNM_PERIOD are
+ specified at the same time.
+
+Sat May 26 09:55:26 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y: accomplish extended syntax described in [ruby-talk:14525]
+ using tSPC token. [new, experimental]
+
+Sat May 26 07:05:45 2001 Usaku Nakamura <usa@osb.att.ne.jp>
+
+ * MANIFEST: add win32/dir.h .
+
+Fri May 25 20:03:51 2001 Pascal Rigaux <pixel@mandrakesoft.com>
+
+ * dln.c (dln_find_1): should exclude directories in executable
+ file lookup.
+
+Fri May 25 18:00:26 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_obj_singleton_methods): list methods in extended
+ modules if optional argument is true. [new]
+
+Fri May 25 14:19:25 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * string.c (rb_str_replace): add taint status infection
+ (OBJ_INFECT()).
+
+ * string.c (rb_str_crypt): ditto.
+
+ * string.c (rb_str_ljust): ditto.
+
+ * string.c (rb_str_rjust): ditto.
+
+ * string.c (rb_str_center): ditto.
+
+Fri May 25 05:39:03 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/sha1/sha1-ruby.c (sha1_hexdigest): fix buffer overflow. The
+ buffer for a SHA-1 hexdigest needs to be 41 bytes in length.
+
+Fri May 25 01:47:39 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * MANIFEST: update the entries I forgot to add or remove.
+
+Fri May 25 00:57:25 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/sha1/sha1-ruby.c (sha1_new): separate initialize() from
+ new().
+
+ * ext/md5/md5init.c (md5i_new): ditto.
+
+Fri May 25 00:53:41 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/dbm/extconf.rb: fix support for *BSD and set $CFLAGS
+ properly.
+
+Thu May 24 16:10:33 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * range.c (range_member): check based on "<=>" comparison. [new]
+
+ * range.c (range_check): add "succ" check if first end is not a
+ numeric.
+
+ * range.c (range_eqq): comparison should based on "<=>".
+
+ * range.c (range_each): ditto.
+
+Thu May 24 16:08:21 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * mkconfig.rb: autoconf 2.50 support.
+
+Thu May 24 14:23:35 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_yield_0): need argument adjustment for C defined
+ blocks too.
+
+Thu May 24 01:11:30 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/dbm/extconf.rb: header search added. [new]
+
+Wed May 23 02:58:21 2001 Tanaka Akira <akr@m17n.org>
+
+ * time.c (make_time_t): fix ad-hoc local time adjustment, using
+ binary tree search.
+
+Tue May 22 17:10:35 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * variable.c (rb_alias_variable): should not allow variable
+ aliasing if $SAFE >= 4.
+
+Tue May 22 02:37:45 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (expr): "break" and "next" to take optional expression,
+ which is used as a value for termination. [new, experimental]
+
+ * eval.c (rb_eval): "break" can give value to terminating method.
+
+ * eval.c (rb_eval): "break" and "next" to take optional expression.
+
+ * eval.c (rb_yield_0): "next" can give value to terminating "yield".
+
+ * eval.c (rb_iterate): "break" can give value to terminating method.
+
+ * eval.c (proc_call): ditto.
+
+Mon May 21 13:15:25 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big2str): t should be protected from GC.
+
+Sat May 19 09:29:07 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * process.c (rb_proc_times): need not to check return value from
+ times(2).
+
+Fri May 18 05:36:08 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/extmk.rb.in (xsystem): backout the previous fix which was
+ bogus.
+
+Fri May 18 05:19:55 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/mkmf.rb (xsystem): make a temporary fix to get $(...) macros
+ properly expanded on a command execution.
+
+ * ext/extmk.rb.in (xsystem): ditto.
+
+Fri May 18 03:45:55 2001 Brian F. Feldman <green@FreeBSD.org>
+
+ * lib/mkmf.rb: unbreak "make install". lib/* must be installed
+ under $rubylibdir, not under $libdir.
+
+Fri May 18 01:28:07 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (expr): break, next, redo, retry are moved from primary.
+
+Fri May 18 01:11:02 2001 Usaku Nakamura <usa@osb.att.ne.jp>
+
+ * ext/sha1/sha1-ruby.c (sha1_new): get rid of an unneeded
+ rb_obj_call_init() call.
+
+Fri May 18 01:03:55 2001 Usaku Nakamura <usa@osb.att.ne.jp>
+
+ * ext/sha1/sha1.txt, ext/sha1/sha1.txt.jp: fix typos.
+
+Thu May 17 19:17:11 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/shell.rb, lib/shell/process-controller.rb,
+ lib/shell/command-processor.rb: translate Japanese comments into
+ English.
+
+Thu May 17 19:07:14 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * doc/shell.rd.jp: RD'ify and make some fixes.
+
+ * doc/shell.rd: RD'ify, delete Japanese leftovers, make overall
+ English fixes, and sync with doc/shell.rd.jp.
+
+Thu May 17 17:35:04 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_call0): address of local_vars might change during eval.
+
+Thu May 17 07:27:09 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/md5/md5.txt.jp, ext/sha1/sha1.txt.jp:
+ s/SuperClass/Superclass/.
+
+Thu May 17 07:21:44 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/Setup.dj, ext/Setup.emx, ext/Setup.nt, ext/Setup.x68:
+ compile sha1 in as well as md5.
+
+ * ext/Setup: put sha1 in a comment.
+
+Thu May 17 07:16:38 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/sha1/sha1.txt.jp: add the Japanese version derived from
+ ext/md5/md5.txt.jp.
+
+ * ext/sha1/sha1.txt: revise the copyright info and reduce the
+ difference from ext/md5/md5.txt.
+
+ * ext/md5/md5.txt: reduce the difference from ext/sha1/sha1.txt.
+
+Thu May 17 07:11:35 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/sha1/extconf.rb, ext/sha1/sha1.c: use WORDS_BIGENDIAN to
+ detect the platform's endian.
+
+Thu May 17 06:31:30 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/md5/md5.txt: make wording fixes, and mention the newly added
+ method: "<<".
+
+ * ext/md5/md5.txt.jp: ditto.
+
+Wed May 16 18:05:52 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/md5/md5init.c: add an instance method "<<" as an alias for
+ "update". (inspired by Steve Coltrin's ruby-sha1)
+
+Tue May 15 17:46:37 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_and): should not push frozen key string.
+
+ * array.c (rb_ary_or): ditto.
+
+Tue May 15 02:18:23 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/thread.rb: rescue ThreadError in case the thread is dead
+ just before calling Thread#run.
+
+Mon May 14 13:50:22 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_schedule): should save context before raising
+ deadlock, saved context for current thread might be obsolete.
+
+ * time.c (make_time_t): non DST timezone shift supported (hopefully).
+
+ * time.c (make_time_t): strict range detection for negative time_t.
+
+Mon May 14 11:54:20 2001 Tanaka Akira <akr@m17n.org>
+
+ * signal.c: SIGINFO added.
+
+Mon May 14 08:57:06 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_ensure): should not SEGV when prot_tag is NULL.
+
+Sun May 13 23:51:14 2001 Usaku Nakamura <usa@osb.att.ne.jp>
+
+ * win32/resource.rb: Modify copyright in resource script.
+
+Sun May 13 14:03:33 2001 Okada Jun <yun@be-in.org>
+
+ * lib/thread.rb: fix Queue#pop and SizedQueue#max= to avoid
+ deadlock.
+
+Sat May 12 15:43:55 2001 Usaku Nakamura <usa@osb.att.ne.jp>
+
+ * win32/win32.c (kill): add support of signal 9 on mswin32/mingw32.
+
+Fri May 11 15:09:52 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ruby.h (rb_string_value): add volatile to avoid compiler warning.
+
+ * string.c (rb_string_value): ditto.
+
+Fri May 11 03:35:33 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * README.EXT: Document find_library(), with_config() and
+ dir_config().
+
+Fri May 11 03:34:20 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * README.EXT.jp: Remove the description of find_header() because
+ such a function does not actually exist.
+
+ * README.EXT.jp: Update the description of dir_config().
+
+Fri May 11 02:42:05 2001 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * README, README.jp: Fix CVS access and mailing lists info.
+
+Fri May 11 02:00:44 2001 Ryo HAYASAKA <ryoh@jaist.ac.jp>
+
+ * bignum.c (bigdivrem): access boundary bug.
+
+Thu May 10 02:40:47 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_object): prohibit dumping out singleton classes.
+
+ * object.c (rb_mod_to_s): distinguish singleton classes.
+
+ * variable.c (rb_class2name): it's ok to reveal NilClass,
+ TrueClass, FalseClass.
+
+Wed May 9 14:38:33 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * eval.c (rb_yield_0): preserve and restore ruby_cref as well.
+
+Tue May 8 18:28:19 2001 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb.rb lib/irb/multi-irb.rb lib/irb/ruby-lex.rb
+ lib/irb/version.rb resolve ctrl-c problem
+
+Tue May 8 17:12:43 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * eval.c (is_defined): core dumped during instance_eval for
+ special constants.
+
+ * eval.c (rb_eval): ditto.
+
+Tue May 8 08:52:57 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * doc/forwardable.rd, doc/forwardable.rd.jp: Hit `=begin' and
+ `=end' in proper places so rd2 can format them without a problem.
+
+ * doc/irb/irb-tools.rd.jp, doc/irb/irb.rd, doc/irb/irb.rd.jp:
+ ditto.
+
+Tue May 8 08:38:53 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * doc/forwardable.rd, doc/forwardable.rd.jp, lib/forwardable.rb:
+ Import forwardable 1.1.
+
+Tue May 8 08:34:33 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * doc/irb/irb-tools.rd.jp, doc/irb/irb.rd.jp: Convert from JIS to
+ EUC.
+
+Tue May 8 03:46:39 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * sample/rbc.rb: Obsoleted by IRB.
+
+Mon May 7 15:58:45 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (arg): "||=" should not warn for uninitialized instance
+ variables.
+
+ * eval.c (rb_eval): ditto.
+
+ * eval.c (eval): preserve and restore ruby_cref as well.
+
+Mon May 7 15:45:48 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/ftools.rb (syscopy): chmod destination file only if
+ it does not exist.
+
+Mon May 7 14:35:57 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_obj_is_instance_of): takes only class/module as an
+ argument.
+
+Sun May 6 16:27:29 2001 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * eval.c (is_defined): rb_reg_nth_defined() may return Qnil.
+
+Thu May 3 03:15:06 2001 SHIROYAMA Takayuki <psi@fortune.nest.or.jp>
+
+ * configure.in: get --enable-shared to work on MacOS X.
+
+ * Makefile.in: make $(LIBRUBY_SO) depend on miniruby properly.
+ Now `make -jN' should work without a problem.
+
+Thu May 3 02:07:45 2001 Usaku Nakamura <usa@osb.att.ne.jp>
+
+ * win32/config.h.in: add SIZEOF___INT64 definition.
+
+Wed May 2 20:39:35 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * dir.c (rb_glob, rb_globi): remove unnecessary FNM_PATHNAME.
+
+Wed May 2 11:46:13 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * eval.c (block_pass): should not downgrade safe level.
+
+Wed May 2 03:07:49 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/dbm/extconf.rb: allow specifying dbm-type explicitly.
+
+ * ext/dbm/extconf.rb: avoid gdbm if possible, because it leaks
+ memory, whereas gdbm.so doesn't. potential incompatibility.
+
+Wed May 2 02:02:18 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_insert): new method.
+
+Tue May 1 17:55:58 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): lex_state after RESCUE_MOD should be EXPR_BEG.
+
+Tue May 1 16:23:03 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_insert): new method.
+
+ * array.c (rb_ary_update): new utility function.
+
+Tue May 1 03:24:05 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/irb/completion.rb, lib/irb/frame.rb, lib/irb/xmp.rb,
+ doc/irb/irb-tools.rd.jp: Merge from irb-tools 0.7.1.
+
+Tue May 1 03:07:17 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * sample/irb.rb, lib/irb.rb, lib/irb/*, doc/irb/*: Merge from irb
+ 0.7.3.
+
+ * instruby.rb: Install help-message's too.
+
+ * lib/irb/main.rb: This file is not needed anymore.
+
+Fri Apr 27 09:27:10 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (set_outfile): should check if closed before assignment.
+
+Thu Apr 26 22:36:11 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: don't use tzname on Cygwin 1.3.1+.
+
+ * configure.in: add -mieee/-ieee to CFLAGS on OSF1/Alpha
+ to disable "DIVISION BY ZERO" exception.
+
+Thu Apr 26 22:30:43 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): should preserve value of ruby_errinfo.
+
+Thu Apr 26 10:36:09 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_schedule): infinite sleep should not cause
+ dead lock.
+
+Wed Apr 25 16:40:44 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_flatten_bang): proper recursive detection.
+
+Wed Apr 25 15:36:15 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * eval.c (yield_under): need not to prohibit at safe level 4.
+
+Wed Apr 25 15:22:20 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * pack.c (pack_pack): p/P packs nil into NULL.
+
+ * pack.c (pack_unpack): p/P unpacks NULL into nil.
+
+Tue Apr 24 15:35:32 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * pack.c (pack_pack): size check for P template.
+
+ * ruby.c (set_arg0): wrong predicate when new $0 value is bigger
+ than original space.
+
+Tue Apr 24 15:18:49 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/extmk.rb.in, lib/mkmf.rb: (dir_config) do not add the
+ specified include directory if already included in $CPPFLAGS.
+
+ * ext/extmk.rb.in, lib/mkmf.rb: (dir_config) return a more useful
+ value, [include_dir, lib_dir].
+
+Mon Apr 23 14:43:59 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (id2ref): should use NUM2ULONG()
+
+ * object.c (rb_mod_const_get): check whether name is a class
+ variable name.
+
+ * object.c (rb_mod_const_set): ditto.
+
+ * object.c (rb_mod_const_defined): ditto.
+
+Sat Apr 21 22:33:26 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_float): precision changed to "%.16g"
+
+Sat Apr 21 22:07:58 2001 Guy Decoux <decoux@moulon.inra.fr>
+
+ * eval.c (rb_call0): wrong retry behavior.
+
+Fri Apr 20 19:12:20 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (fix_aref): a bug on long>int architecture.
+
+Fri Apr 20 14:57:15 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * eval.c (rb_eval_string_wrap): should restore ruby_wrapper.
+
+Sun Apr 22 17:44:37 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: add -mieee to CFLAGS on Linux/Alpha
+ to disable "DIVISION BY ZERO" exception.
+
+ * configure.in: remove -ansi on OSF/1.
+
+Wed Apr 18 04:37:51 2001 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/cgi.rb: CGI::Cookie: no use PATH_INFO.
+
+Wed Apr 18 00:24:40 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_compile_pattern): char class at either edge of range
+ should be invalid.
+
+Tue Apr 17 17:33:55 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (handle_rescue): use === to compare exception match.
+
+ * error.c (syserr_eqq): comparison between SytemCallErrors should
+ based on their error numbers.
+
+Tue Apr 17 16:54:39 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * eval.c (safe_getter): should use INT2NUM().
+
+Tue Apr 17 15:12:56 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big2long): 2**31 cannot fit in 31 bit long.
+
+Sat Apr 14 22:46:43 2001 Guy Decoux <decoux@moulon.inra.fr>
+
+ * regex.c (calculate_must_string): wrong length calculation.
+
+Sat Apr 14 13:37:32 2001 Usaku Nakamura <usa@osb.att.ne.jp>
+
+ * win32/config.status.in: no longer use missing/alloca.c.
+
+ * win32/Makefile.sub: ditto.
+
+Fri Apr 13 12:40:48 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * eval.c (rb_thread_start_0): fixed memory leak.
+
+Fri Apr 13 16:41:18 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (none): should clear cmdarg_stack too.
+
+Fri Apr 13 06:19:29 2001 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * io.c (rb_fopen): use setvbuf() to avoid recursive malloc() on
+ some platforms.
+
+Wed Apr 11 23:36:26 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (rb_stat_dev): device functions should honor stat field
+ types (except long long such as dev_t).
+
+Wed Apr 11 18:07:53 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * eval.c (rb_mod_nesting): should not push nil for nesting array.
+
+ * eval.c (rb_mod_s_constants): should not search array by
+ rb_mod_const_at() for nil (happens for singleton class).
+
+Wed Apr 11 13:29:26 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_singleton_class_attached): should modify iv_tbl by
+ itself, no longer use rb_iv_set() to avoid freeze check error.
+
+ * variable.c (rb_const_get): error message "uninitialized constant
+ Foo at Bar::Baz" instead of "uninitialized constantBar::Baz::Foo".
+
+Tue Apr 10 17:52:10 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_mod_included): new hook called from rb_mod_include().
+
+Tue Apr 10 02:24:40 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * io.c (opt_i_set): should strdup() inplace_edit string.
+
+Mon Apr 9 23:29:54 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (exec_under): need to push cref too.
+
+Mon Apr 9 15:20:21 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_f_missing): raise NameError for "undefined local
+ variable or method".
+
+ * error.c (Init_Exception): new exception NoMethodError.
+ NameError moved under ScriptError again.
+
+ * eval.c (rb_f_missing): use NoMethodError instead of NameError.
+
+Mon Apr 9 12:05:44 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (Init_File): should redefine "new" class method.
+
+Mon Apr 9 11:56:52 2001 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb: fix typo.
+
+Fri Apr 6 01:46:35 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (PUSH_CREF): sharing cref node was problematic. maintain
+ runtime cref list instead.
+
+ * eval.c (rb_eval): copy defn node before registering.
+
+ * eval.c (rb_load): clear ruby_cref before loading.
+
+Thu Apr 5 22:40:12 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_const_get): no recursion to show full class path
+ for modules.
+
+ * eval.c (rb_set_safe_level): should set safe level in curr_thread
+ as well.
+
+ * eval.c (safe_setter): ditto.
+
+Thu Apr 5 13:46:06 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * object.c (rb_obj_is_instance_of): nil belongs to false, not true.
+
+Thu Apr 5 02:19:03 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (make_time_t): proper (I hope) daylight saving time
+ handling for both US and Europe. I HATE DST!
+
+ * eval.c (rb_thread_wait_for): non blocked signal interrupt should
+ stop the interval.
+
+Wed Apr 4 03:47:03 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (proc_eq): class check added.
+
+ * eval.c (proc_eq): typo fixed ("return" was omitted).
+
+ * error.c (Init_Exception): move NameError under StandardError.
+
+ * class.c (rb_mod_clone): should copy method bodies too.
+
+ * bignum.c (bigdivrem): should trim trailing zero bdigits of
+ remainder, even if dd == 0.
+
+ * file.c (check3rdbyte): safe string check moved here.
+
+Tue Apr 3 09:56:20 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/extmk.rb.in (create_makefile): create def file only if
+ it does not yet exist.
+
+ * lib/mkmf.rb: ditto.
+
+Tue Apr 3 00:05:07 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (make_time_t): remove HAVE_TM_ZONE code since it
+ sometimes reports wrong time.
+
+ * time.c (make_time_t): remove unnecessary range check for
+ platforms where negative time_t is available.
+
+Mon Apr 2 16:52:48 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * process.c (proc_waitall): should push Process::Status instead of
+ Fixnum status.
+
+ * process.c (waitall_each): should add all entries in pid_tbl.
+ these changes are inspired by Koji Arai. Thanks.
+
+ * process.c (proc_wait): should not iterate if pid_tbl is 0.
+
+ * process.c (proc_waitall): ditto.
+
+Mon Apr 2 14:25:49 2001 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/monitor.rb (wait): ensure reentrance.
+
+ * lib/monitor.rb (wait): fix timeout support.
+
+Mon Apr 2 12:40:45 2001 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (media_subtype): return subtype.
+
+Mon Apr 2 12:01:15 2001 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (flag_list): capitalize flags.
+
+Mon Apr 2 01:32:38 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * Makefile.in: Introduce MAINLIBS.
+
+ * configure.in: Link libc_r against the ruby executable on
+ FreeBSD, which is the first attempt to work around a certain
+ problem regarding pthread on FreeBSD. It should make ruby/libruby
+ happy when it loads an extension to a library compiled and linked
+ with -pthread. Note, however, that libruby is _not_ linked with
+ libc_r so as not to mess up pthread unfriendly stuff including
+ apache+mod_ruby and vim6+ruby_interp.
+
+Mon Apr 2 01:16:24 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * win32/win32.c: use ruby's opendir on mingw32.
+
+ * win32/dir.h, dir.c, Makefile: ditto.
+
+Sun Apr 1 23:26:14 2001 TOYOFUKU Chikanobu <toyofuku@juice.or.jp>
+
+ * numeric.c (flodivmod): a bug in no fmod case.
+
+Sun Apr 1 18:36:14 2001 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * process.c (pst_wifsignaled): should apply WIFSIGNALED for status
+ (int), not st (VALUE).
+
+Sat Mar 31 04:47:55 2001 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb: add document and example code.
+
+Sat Mar 31 03:24:10 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (Init_IO): value of $/ and $\ are no longer restricted to
+ strings. type checks are done on demand.
+
+ * class.c (rb_include_module): module inclusion should be check
+ taints.
+
+ * ruby.h (STR2CSTR): replace to StringType() and StringTypePtr().
+
+ * ruby.h (rb_str2cstr): ditto.
+
+Fri Mar 30 23:37:49 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_load): should not copy toplevel local variables. It
+ cause variable/method ambiguity. Thanks to L. Peter Deutsch.
+
+Fri Mar 30 22:56:56 2001 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb: rename ContinueRequest to ContinuationRequest.
+
+Fri Mar 30 12:51:19 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_include_module): freeze check at first.
+
+Thu Mar 29 17:05:09 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_attr): sprintf() and rb_intern() moved into
+ conditional body.
+
+Wed Mar 28 23:43:00 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ext/extmk.rb.in, lib/mkmf.rb: add C++ rules in addition to C
+ rules for the mswin32 platforms.
+
+Wed Mar 28 19:29:21 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/extmk.rb.in, lib/mkmf.rb: move C++ rules to the right place.
+
+Wed Mar 28 17:39:04 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_str2cstr): warn if string contains \0 and length
+ value is ignored.
+
+Wed Mar 28 15:00:31 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * class.c (rb_singleton_class_clone): should copy class constant
+ table as well.
+
+Wed Mar 28 14:23:23 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * class.c (rb_include_module): sometimes cache was mistakenly left
+ uncleared - based on the patch by K.Kosako.
+
+ * ruby.h: all Check_SafeStr()'s are replaced by SafeStr() to
+ ensure 'to_str' be always effective.
+
+Wed Mar 28 09:52:33 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * win32/Makefile.sub: disable global optimization.
+
+Tue Mar 27 15:00:54 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * eval.c (rb_mod_define_method): should have clear method cache.
+
+ * eval.c (rb_mod_define_method): should have raised exception for
+ type error.
+
+Tue Mar 27 14:48:17 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ruby.h: changed "extern INLINE" to "static inline".
+
+Mon Mar 26 23:19:33 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * time.c (rb_strftime): check whether strftime returns empty string.
+
+Mon Mar 26 21:16:56 2001 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb: supports response handlers and multiple commands.
+
+Mon Mar 26 17:21:07 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c: remove TMP_PROTECT_END to prevent C_ALLOCA crash.
+
+Mon Mar 26 14:04:41 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/Win32API/Win32API.c: remove Init_win32api().
+
+Sun Mar 25 16:52:48 2001 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * file.c (rb_file_flock): do not trap EINTR.
+
+ * missing/flock.c (flock): returns the value from lockf(2)
+ directly.
+
+Sat Mar 24 23:44:50 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (ev_const_defined): should ignore toplevel cbase (Object).
+
+ * eval.c (ev_const_get): ditto.
+
+Fri Mar 23 17:37:52 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/md5/md5.h: replace by independent md5 implementation
+ contributed by L. Peter Deutsch (thanks).
+
+ * ext/md5/md5init.c: adopted to Deutsch's md5 implementation.
+
+Fri Mar 23 17:26:19 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * pack.c (pack_unpack): string from P/p should be tainted.
+
+Fri Mar 23 12:18:44 2001 SHIROYAMA Takayuki <psi@fortune.nest.or.jp>
+
+ * ext/curses/curses.c: curses on Mac OS X public beta does not
+ have _maxx etc.
+
+Fri Mar 23 10:50:31 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_object): should truncate trailing zero short for
+ bignums.
+
+Fri Mar 23 09:49:02 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (sym_intern): new method.
+
+Thu Mar 22 22:15:45 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/Win32API/extconf.rb: add -fno-omit-frame-pointer.
+
+Thu Mar 22 18:17:36 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_mod_nesting): should not include Object at the
+ toplevel.
+
+Thu Mar 22 17:43:44 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ruby.h: better inline function support.
+
+ * configure.in (NO_C_INLINE): check if inline is available for the
+ C compiler.
+
+Mon Mar 19 11:03:10 2001 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * marshal.c (r_object): len calculation patch was wrong for
+ machines SIZEOF_BDIGITS == SIZEOF_SHORT.
+
+ * gc.c: alloca prototype reorganized for C_ALLOCA machine.
+
+Wed Mar 21 23:07:45 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * win32/win32.c (win32_stat): WinNT/2k "//host/share" support.
+
+Wed Mar 21 08:05:35 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * win32/dir.h: replace missing/dir.h .
+
+ * win32/win32.h: ditto.
+
+ * win32/win32.c: ditto.
+
+Wed Mar 21 01:26:14 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (id2ref): sometimes confused symbol and reference.
+
+Tue Mar 20 23:09:33 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * win32/win32.c (win32_stat): UNC support.
+
+ * dir.c (extract_path): fix "./*" problem.
+
+Tue Mar 20 15:10:00 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * dir.c (glob_helper): breaks loop after calling recursive
+ glob_helper; all wild cards should be consumed; no need for
+ further match.
+
+ * dir.c (dir_s_glob): gives warning if no match found.
+
+Tue Mar 20 14:13:45 2001 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * object.c (sym_inspect): did allocate extra byte space.
+
+Mon Mar 19 19:14:47 2001 Guy Decoux <decoux@moulon.inra.fr>
+
+ * marshal.c (shortlen): shortlen should return number of bytes
+ written.
+
+Mon Mar 19 16:52:23 2001 K.Kosako <kosako@sofnec.co.jp>
+
+ * eval.c (ev_const_defined): need not to check if cbase->nd_class
+ is rb_cObject.
+
+ * eval.c (ev_const_get): ditto.
+
+Mon Mar 19 17:11:20 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_zone): return "UTC" for UTC time objects.
+
+Mon Mar 19 16:27:32 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (THREAD_ALLOC): flags should be initialized.
+
+ * signal.c (rb_f_kill): should use FIX2INT, not FIX2UINT.
+
+Mon Mar 19 10:55:10 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * dir.c (glob_helper): replace lstat() by stat() to follow symlink
+ in the case like 'symlink/*'.
+
+ * dir.c (glob_helper): gave warning too much.
+
+Sun Mar 18 08:58:18 2001 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/cgi.rb: // === '' --> //.match('')
+
+ * lib/cgi.rb: cgi#header(): improvement for mod_ruby.
+
+ * lib/cgi.rb: cgi#rfc1123date(): improvement.
+ thanks to TADA Tadashi <sho@spc.gr.jp>.
+
+ * lib/cgi.rb: cgi#rfc1123date(): document bug fix.
+ thanks to Kazuhiro NISHIYAMA <zn@mbf.nifty.com>.
+
+ * lib/cgi.rb: cgi#header(): bug fix.
+ thanks to IWATSUKI Hiroyuki <don@na.rim.or.jp>.
+
+Sat Mar 17 11:11:24 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * dir.c (glob_helper): * should follow symlink, whereas ** should
+ not follow.
+
+Thu Mar 15 01:28:02 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * dir.c (dir_s_chdir): block form of Dir.chdir. (RCR#U016).
+
+Fri Mar 16 17:14:17 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * configure.in: Set SOLIBS properly for all ELF and
+ FreeBSD/NetBSD/OpenBSD a.out platforms so that the shlib
+ dependencies are recorded in the libruby shlib.
+
+Wed Mar 14 16:41:45 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_schedule): raise FATAL just once to
+ THREAD_TO_KILL.
+
+Wed Mar 14 10:41:34 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_yield_0): 0 (= Qfalse) is a valid value, so that
+ default self should be checked by klass == 0.
+
+ * bignum.c (rb_cstr2inum): should disallow '++1', '+-1', etc.
+
+Tue Mar 13 17:51:09 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (ev_const_defined): add new parameter self for special
+ const fallback.
+
+ * eval.c (ev_const_get): ditto.
+
+Tue Mar 13 16:39:45 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * dir.c (rb_glob_helper): fix drive letter handling on DOSISH.
+
+Tue Mar 13 14:54:39 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/http.rb: add HTTPRequest#basic_auth.
+
+ * lib/net/smtp.rb: raise if only account or password is given.
+
+ * lib/net/protocol.rb: WriteAdapter#<< returns self.
+
+Tue Mar 13 14:41:16 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (argf_seek_m): wrong calling sequence of rb_io_seek().
+
+Tue Mar 13 09:14:19 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (cond0): no special treatment of string literal in
+ condition.
+
+Mon Mar 12 18:59:38 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/mkmf.rb (create_makefile): save/restore $libs and $LIBPATH.
+
+Sun Mar 11 18:13:34 2001 Masahiro Tanaka <masa@stars.gsfc.nasa.gov>
+
+ * math.c: add acos, asin, atan, conh, sinh, tanh and hypot to Math.
+
+ * configure.in: check hypot availability.
+
+ * missing/hypot.c: public domain rewrite of hypot.
+
+Sun Mar 11 13:21:04 2001 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * parse.y (warn_unless_e_option): warning condition was wrong.
+
+ * parse.y (warning_unless_e_option): ditto.
+
+Sun Mar 11 00:55:31 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/mkmf.rb (install_rb): fix handling of destination path.
+
+Sat Mar 10 22:56:44 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * enum.c (enum_all): new method 'all?', which returns true if
+ block returns true for all elements.
+
+ * enum.c (enum_any): new method 'any?', which returns true if
+ block returns true for any of elements.
+
+Sat Mar 10 02:34:18 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * math.c (math_log, math_log10): use nan() instead of 0.0/0.0 on Cygwin.
+
+Fri Mar 9 09:56:19 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (marshal_load): do not give warning unless explicitly
+ set to verbose.
+
+Fri Mar 9 02:07:53 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_exit): give string value "exit" to SystemExit.
+
+ * ruby.c (proc_options): -v should not print version if
+ proc_options called via moreswitches().
+
+Thu Mar 8 17:45:19 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb: one write(2) per one line.
+
+Wed Mar 7 14:26:11 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * math.c (math_log, math_log10): should return NaN if x < 0.0
+ on Cygwin.
+
+Thu Mar 7 10:31:26 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * parse.y (stmt): while/until modifier must work for empty body.
+
+Tue Mar 6 22:53:58 2001 Kazuhiro Yoshida <moriq.kazuhiro@nifty.ne.jp>
+
+ * ruby.c (ruby_set_argv): clear ARGV contents before adding args.
+
+Tue Mar 6 10:50:29 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (primary): rescue and ensure clauses should be allowed
+ to appear in singleton method body.
+
+Mon Mar 5 17:25:13 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (proc_eq): compare Procs using blocktag equality.
+
+ * eval.c (proc_to_s): stringify according to block tag address.
+
+Mon Mar 5 17:19:56 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * win32/win32.c (gettimeofday): use GetLocalTime() instead of ftime()
+ for high-resolution timing.
+
+Sun Mar 4 17:01:09 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * string.c (trnext): support backslash escape in String#tr.
+
+Sat Mar 3 16:15:16 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): push cbase if ruby_cbase != ruby_class, for
+ example in the case NODE_DEFN/NODE_DEFS are called within
+ module_eval.
+
+Wed Feb 28 11:02:41 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_delete_bang): delete! should take at least 1
+ argument.
+
+ * ruby.c (load_file): add rb_gc() after loading to avoid
+ extraordinary memory growth.
+
+Wed Feb 28 05:01:40 2001 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * dir.c (rb_glob_helper): "./foo" should match "foo", not "./foo".
+
+Tue Feb 27 16:38:15 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (ev_const_get): retrieve Object's constant if no current
+ class is available (e.g. defining singleton class for Fixnums).
+
+ * eval.c (ev_const_defined): check Object's constant if no current
+ class is available (e.g. defining singleton class for Fixnums).
+
+ * time.c (time_timeval): negative time interval should not be
+ allowed.
+
+ * eval.c (proc_call): ignore block to `call' always, despite of
+ being orphan or not.
+
+Wed Feb 27 10:16:32 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (rb_yield_0): should check based on rb_block_given_p()
+ and rb_f_block_given_p().
+
+Tue Feb 27 04:13:45 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * configure.in (frame-address): --enable-frame-address to allow
+ __builtin_frame_address() to be used.
+
+ * eval.c (stack_length): use __builtin_frame_address() based on
+ the macro USE_BUILTIN_FRAME_ADDRESS.
+
+ * gc.c (rb_gc): ditto.
+
+ * gc.c (Init_stack): ditto.
+
+Mon Feb 26 16:20:27 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ruby.c (proc_options): call ruby_show_version() just once.
+
+ * dir.c (dir_s_open): returns the value from a block (if given).
+
+Mon Feb 26 14:29:04 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/extmk.rb.in, lib/mkmf.rb: add C++ rules in addition to C
+ rules.
+
+Mon Feb 26 00:04:52 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (proc_call): should not modify ruby_block->frame.iter
+ based on ruby_frame->iter altered by PUSH_ITER().
+
+Mon Feb 26 05:27:52 2001 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/net/telnet.rb: #telnetmode(), #binmode(): bug fix.
+ thanks to nobu.nakada@nifty.ne.jp.
+
+Mon Feb 26 04:55:50 2001 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/cgi.rb: CGI#form(): bug fix.
+ thanks to MoonWolf <moonwolf@moonwolf.com>.
+
+ * lib/cgi.rb: CGI#rfc1123_date(): improvement.
+ thanks to Tomoyasu Akita <genzo-@dm4lab.to>.
+
+ * lib/cgi.rb: CGI#header(): improvement for mod_ruby.
+ thanks to Shugo Maeda <shugo@ruby-lang.org>.
+
+Sun Feb 25 02:45:30 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * file.c (rb_file_s_rename): avoid Cygwin's bug.
+
+Sat Feb 24 23:32:55 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_fd_close): should save current context before
+ raising exception.
+
+Sat Feb 24 22:14:00 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * win32/win32.c (myrename): fix error handling.
+
+Sat Feb 24 13:58:48 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/http.rb: always close connection on request without
+ body.
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: change copyright.
+
+Sat Feb 24 03:15:49 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (set_stdin): preserve original stdin.
+
+ * io.c (set_outfile): preserve original stdout/stderr.
+
+Fri Feb 23 08:28:58 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb: clear read buffer after reopen.
+
+ * lib/net/protocol.rb: refactoring.
+
+ * lib/net/http.rb: split module HTTPHeader from HTTPResponse.
+
+Tue Feb 20 23:45:35 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * process.c: add W* macro if not available.
+
+Tue Feb 20 16:37:58 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * configure.in: add check for negative time_t for gmtime(3).
+
+ * time.c (time_new_internal): no positive check if gmtime(3) can
+ handle negative time_t.
+
+ * time.c (time_timeval): ditto.
+
+ * bignum.c (rb_big2long): should not raise RangeError for Bignum
+ LONG_MIN value.
+
+Mon Feb 19 17:46:37 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_substr): "a"[1,2] should return ""; need
+ rubicon upgrade.
+
+Mon Feb 19 12:10:36 2001 Triet H. Lai <thlai@mail.usyd.edu.au>
+
+ * error.c (rb_sys_warning): new function to give warning with
+ strerror() message.
+
+ * dir.c (rb_glob_helper): better error handling, along with
+ performance tune.
+
+Mon Feb 19 01:55:43 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (secure_visibility): visibility check for untainted modules.
+
+Mon Feb 19 00:29:29 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * signal.c (sigpipe): sighandler which does nothing.
+
+ * signal.c (trap): set sigpipe function for SIGPIPE.
+
+ * signal.c (Init_signal): default SIGPIPE handler should be
+ sigpipe function.
+
+Sun Feb 18 15:42:38 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/curses/extconf.rb: add dir_config.
+
+ * missing/flock.c: use fcntl(2) instead of lockf(2).
+
+Sun Feb 18 05:46:03 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/http.rb: Response#range_length was not debugged.
+
+Sun Feb 18 04:02:03 2001 Yasushi Shoji <yashi@yashi.com>
+
+ * array.c (rb_ary_subseq): wrong boundary check.
+
+Sun Feb 18 00:09:50 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * win32/win32.c: make file I/O faster on mswin32/mingw32.
+
+ * win32/win32.h: ditto.
+
+ * rubysig.h: ditto.
+
+Sat Feb 17 23:32:45 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (cond0): integer literal in condition should not be
+ compared to lineno ($.).
+
+Fri Feb 16 01:44:56 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (set_outfile): f should be the FILE* from the assigning value.
+
+ * ext/socket/socket.c (tcp_s_open): should not give default value
+ to local_host.
+
+ * time.c (time_s_times): move to Process::times.
+
+ * file.c (rb_file_s_lchmod): new method File::lchmod.
+
+ * file.c (rb_file_s_lchown): new method File::lchown.
+
+Thu Feb 15 11:33:49 2001 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/cgi/session.rb (close): fixed reversed condition.
+
+Thu Feb 15 08:34:14 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * process.c (proc_waitall): new method based on a patch from Brian
+ Fundakowski Feldman <green@green.dyndns.org>.
+
+ * process.c (last_status_set): objectify $? value (Process::Status).
+
+Wed Feb 14 17:28:24 2001 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb: supports unknown resp_text_code.
+
+Wed Feb 14 00:44:17 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * dir.c (dir_s_glob): support backslash escape of metacharacters
+ and delimiters.
+
+ * dir.c (remove_backslases): remove backslashes from path before
+ calling stat(2).
+
+ * dir.c (dir_s_glob): call rb_yield directly (via push_pattern) if
+ block is given to the method.
+
+ * dir.c (push_pattern): do not call rb_ary_push; yield directly.
+
+ * eval.c (blk_copy_prev): reduced ALLOC_N too much.
+
+ * eval.c (frame_dup): ditto.
+
+Tue Feb 13 23:05:38 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * dir.c (lstat): should use rb_sys_stat if lstat(2) is not
+ available.
+
+Tue Feb 13 08:43:10 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_ctl): do not call ioctl/fcntl for f2, if f and f2
+ have same fileno.
+
+Tue Feb 13 01:13:43 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_load): raise LocalJumpError if unexpected local jumps
+ appear during load.
+
+ * ext/socket/socket.c (bsock_close_read): don't call rb_thread_fd_close();
+ it's supposed to be called by io_io_close().
+
+ * ext/socket/socket.c (bsock_close_read): do not modify f and f2.
+
+ * ext/socket/socket.c (bsock_close_write): ditto.
+
+ * ext/socket/socket.c (sock_new): avoid dup(2) on sockets.
+
+ * parse.y (primary): preserve and clear in_single and in_def using
+ stack to prevent nested method errors in singleton class bodies.
+
+Sun Feb 11 16:00:30 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * eval.c (stack_length): use __builtin_frame_address() only if
+ GCC and i386 CPU.
+
+ * gc.c (rb_gc, Init_stack): ditto.
+
+ * configure.in: add ac_cv_func_getpgrp_void=yes on DJGPP.
+
+Sat Feb 10 23:43:49 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * hash.c (rb_any_hash): dumped core on machines sizeof(int) != sizeof(long).
+
+Sat Feb 10 23:07:15 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_s_for_fd): IO::for_fd(fd) - new method.
+
+ * regex.c (PREV_IS_A_LETTER): should not treat c>0x7f as a word
+ character if -Kn.
+
+Sat Feb 10 00:00:30 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * win32/win32.c (win32_stat): replace stat to enable when pathname
+ ends with '/' or '\' for mswin32 on Win9X / Win2k.
+
+ * win32/win32.h: ditto.
+
+ * ruby.h: ditto.
+
+ * dir.c (rb_glob_helper): ditto.
+
+ * file.c (rb_stat, rb_file_s_stat, eaccess, check3rdbyte): ditto.
+
+Fri Feb 9 22:54:57 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ruby.c (ruby_init_loadpath): convert '\\' to '/'
+ before finding executable file path.
+
+Fri Feb 9 17:41:53 2001 Triet H. Lai <thlai@mail.usyd.edu.au>
+
+ * dir.c (rb_glob_helper): do not follow symbolic links.
+
+Thu Feb 8 21:27:24 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/mkmf.rb (install_rb): fix handling of relative path.
+
+ * lib/mkmf.rb (create_makefile): add srcdir.
+
+Thu Feb 8 02:22:09 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/http.rb: join HTTPReadResponse into HTTPResponse again.
+
+ * lib/net/http.rb: move http_version() from HTTPRequest to
+ HTTPResponse.
+
+ * lib/net/protocol.rb: refactoring.
+
+Wed Feb 7 16:27:27 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/http.rb: split HTTPResponse into HTTPReadResponse
+ module.
+
+ * lib/net/protocol.rb: add Net::net_private.
+
+ * lib/net/protocol.rb: Socket#reopen takes arg, open_timeout.
+
+Wed Feb 7 16:05:22 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * parse.y (parse_quotedwords): %w should allow parenthesis escape.
+
+Wed Feb 7 00:57:42 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (parse_qstring): %q should allow terminator escape.
+
+ * re.c (rb_reg_options): new method to give an option values.
+
+ * parse.y (cond0): disable special treating of integer literal in
+ conditional unless option -e is supplied. changes current
+ behavior. experimental.
+
+ * parse.y (cond0): give warning for string/integer literals and
+ dot operators in conditionals unless option -e is supplied.
+
+ * re.c (rb_reg_equal): all option flags should be same to be equal.
+
+Tue Feb 6 21:30:44 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/http.rb: call on_connect() on re-opening socket.
+
+ * lib/net/pop.rb: also POP3 can use APOP auth.
+
+Tue Feb 6 20:19:10 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/http.rb: add HTTP#request.
+
+ * lib/net/http.rb: take HTTP 1.0 server into account (incomplete).
+
+ * lib/net/protocol.rb: timeout for open/read.
+
+ * lib/net/protocol.rb: add Protocol#on_connect,on_disconnect.
+
+Mon Feb 5 23:15:46 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * error.c (Init_Exception): make Interrupt a subclass of
+ SignalException.
+
+Mon Feb 5 00:39:06 2001 KANEKO Naoshi <wbs01621@mail.wbs.ne.jp>
+
+ * dir.c: use ISXXX() instead of isxxx().
+
+ * dln.c (aix_loaderror): ditto.
+
+ * file.c (rb_file_s_expand_path): ditto.
+
+ * string.c (rb_str_upcase_bang): ditto.
+
+ * win32/win32.c (do_spawn): ditto.
+
+ * win32/win32.c (NtMakeCmdVector): ditto.
+
+ * win32/win32.c (opendir): ditto.
+
+Sat Feb 3 14:44:53 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * configure.in (AC_C_INLINE): check inline attribute.
+
+ * gc.c (is_pointer_to_heap): use inline rather than __inline__.
+
+ * pack.c (hex2num): ditto.
+
+ * ruby.h (rb_class_of, rb_type, rb_special_const_p): ditto.
+
+ * util.c (rb_class_of, rb_type, rb_special_const_p): defined in
+ ruby.h.
+
+Fri Feb 2 16:14:51 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_sort_bang): returns self, even if its length is
+ less than 2.
+
+ * eval.c (POP_VARS): propagate DVAR_DONT_RECYCLE, if
+ SCOPE_DONT_RECYCLE of ruby_scope is set.
+
+Wed Jan 31 22:27:29 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: gcc-2.95.2-7(Cygwin) support.
+ add -mwin32 if available.
+
+ * cygwin/GNUmakefile: ditto.
+
+Tue Jan 30 17:56:48 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_fetch): new method.
+
+Mon Jan 29 17:36:19 2001 TOYOFUKU Chikanobu <toyofuku@juice.or.jp>
+
+ * eval.c (rb_eval): nd_iter evaluation should be wrapped by
+ BEGIN_CALLARGS and END_CALLARGS.
+
+Mon Jan 29 14:25:39 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (block_pass): return from block jumps directory to
+ block invoker.
+
+Mon Jan 29 01:40:27 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (str_independent): should not clear str->orig here.
+ it's too early.
+
+Fri Jan 26 01:42:40 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y: clarify do ambiguity, bit more complex but natural
+ from my point of view.
+
+Wed Jan 24 14:58:08 2001 Akinori MUSHA <knu@ruby-lang.org>
+
+ * lib/cgi.rb: fix the problem that when running under mod_ruby
+ header() outputs only one Set-Cookie line.
+
+Wed Jan 24 01:45:49 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (POP_BLOCK_TAG): call rb_gc_force_recycle() if block has
+ not been objectified.
+
+ * eval.c (rb_callcc): should nail down block->tag history to avoid
+ rb_gc_force_recycle().
+
+Tue Jan 23 18:51:57 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (rb_gc_call_finalizer_at_exit): should finalize objects in
+ deferred_final_list too.
+
+Tue Jan 23 16:10:12 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (os_live_obj): do not list terminated object.
+
+ * gc.c (os_obj_of): ditto.
+
+ * gc.c (rb_gc_mark): support new T_BLKTAG tag.
+
+ * gc.c (obj_free): ditto.
+
+ * eval.c (new_blktag): creation of new block tag, which holds
+ destination of global jump and orphan status.
+
+ * eval.c (block_pass): break from orphan Proc object will raise a
+ LocalJumpError exception.
+
+Mon Jan 22 16:33:16 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * mkconfig.rb: autoconf 2.49 support.
+
+Mon Jan 22 00:32:44 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (block_pass): behavior consistency with proc_call(). do
+ not propagate `break'.
+
+Sat Jan 20 03:54:00 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): fixed serious syntax misbehavior. do's
+ preceding was too high. a block in `foo bar do .. end' should
+ be passed to `foo', not `bar'.
+
+ * parse.y (block_call): syntax restructure.
+
+Thu Jan 18 04:28:14 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_s_read): new method to call IO#read from
+ pathname. In addition, it accepts third optional argument to
+ specify starting point.
+
+Wed Jan 17 13:28:26 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: remove DEFS definition.
+
+ * mkconfig.rb: ditto.
+
+ * win32/config.status.in: ditto.
+
+Tue Jan 16 17:00:50 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb: ignore EOFError for read.
+
+ * lib/net/http.rb: user specified header was not used.
+
+Mon Jan 15 16:00:07 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * pack.c (pack_unpack): should check associated pointer packed by
+ pack("P"). Thus pointers can be retrieved only from pointer
+ packed strings. restriction added.
+
+Sun Jan 14 21:49:28 2001 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * sprintf.c (rb_f_sprintf): simple typo. binary base should be 2,
+ not '2'.
+
+ * re.c (rb_reg_s_last_match): should explicitly return nth match.
+
+Sun Jan 14 18:21:30 2001 Usaku Nakamura <usa@osb.att.ne.jp>
+
+ * win32/config.status.in: add some field.
+
+ * win32/win32.c (isInternalCmd): ignore case for shell's internal
+ command.
+
+ * win32/win32.c (do_spawn): recognize quoted command line.
+
+Sun Jan 14 04:10:27 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb (adding): too few "yield" in case of arg is
+ not String/File.
+
+ * lib/net/http.rb: add http request object.
+
+Sat Jan 13 19:39:30 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * re.c (rb_reg_desc): separate RE_OPTION_MULTILINE
+
+ * re.c (rb_reg_options): add RE_OPTION_{POSIXLINE,RE_OPTION_MULTILINE,
+ RE_OPTION_EXTENDED}
+
+Thu Jan 11 10:45:04 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * win32/win32.h, win32/config.h.in: move NORETURN from win32.h
+ to config.h.in.
+
+ * win32/config.h.in (inline): renamed from INLINE.
+
+ * djgpp/config.hin (INLINE): removed.
+
+Thu Jan 11 06:45:55 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_mod_dup): should propagate FL_SINGLETON.
+
+ * object.c (inspect_obj): handles the case of no instance variable.
+
+Wed Jan 10 16:15:08 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ruby.h: NORETURN macro is changed for VC++ 6.0.
+
+ * eval.c, intern.h: ditto.
+
+ * djgpp/config.hin, win32/win32.h: ditto.
+
+ * configure.in: ditto.
+
+Wed Jan 10 13:54:53 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * process.c (proc_setuid): use setresuid() if available.
+
+ * process.c (proc_setgid): use setresgid() if available.
+
+ * configure.in: ditto.
+
+Wed Jan 10 01:50:45 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * configure.in (AC_C_INLINE): check inline attribute.
+
+ * string.c (rb_str_reverse_bang): forgot to call rb_str_modify().
+
+Tue Jan 9 17:41:40 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_obj_taint): check frozen status before modifying
+ taint status.
+
+ * object.c (rb_obj_untaint): ditto.
+
+Tue Jan 9 16:22:14 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * enum.c (enum_inject): new method.
+
+Tue Jan 9 02:16:42 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (rb_gc_call_finalizer_at_exit): clear klass member of
+ terminating object.
+
+ * eval.c (rb_call): raise exception for terminated object.
+
+Mon Jan 8 21:24:37 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (bigdivrem): t2 might be too big for signed long; do
+ not use rb_int2big(), but rb_uint2big().
+
+Mon Jan 8 21:35:10 2001 Guy Decoux <decoux@moulon.inra.fr>
+
+ * file.c (path_check_1): should restore modified path.
+
+Mon Jan 8 03:09:58 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * error.c (rb_load_fail): new func to report LoadError.
+
+ * ruby.c (load_file): use rb_load_fail.
+
+Sat Jan 6 00:17:18 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * pack.c (pack_pack): avoid infinite loop(pack 'm2').
+
+Fri Jan 5 01:02:17 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (ruby_finalize): should enclosed by PUSH_TAG/POP_TAG.
+
+ * gc.c (rb_gc_mark): link 2 of NODE_IFUNC should not be explicitly
+ marked. it may contain non object pointer.
+
+Tue Jan 2 00:20:06 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (reg_s_last_match): Regexp::last_match(nth) returns nth
+ substring of the match (alternative for $& and $<digit>).
+
+Sun Dec 31 01:39:16 2000 Guy Decoux <decoux@moulon.inra.fr>
+
+ * eval.c (rb_mod_define_method): wrong comparison for blocks.
+
+Sat Dec 30 19:28:50 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (id2ref): should handle Symbol too.
+
+ * gc.c (id2ref): should print original ptr value
+
+Sat Dec 30 03:14:22 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_iterate): NODE_CFUNC does not protect its data
+ (nd_tval), so create new node NODE_IFUNC for iteration C
+ function.
+
+ * eval.c (rb_yield_0): use NODE_IFUNC.
+
+ * gc.c (rb_gc_mark): support NODE_IFUNC.
+
+Fri Dec 29 11:41:55 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (mem_error): prohibit recursive mem_error().
+ (ruby-bugs-ja:PR#36)
+
+Fri Dec 29 11:05:41 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_fd_writable): should not switch context if
+ rb_thread_critical is set.
+
+ * eval.c (rb_thread_wait_fd): ditto.
+
+ * eval.c (rb_thread_wait_for): ditto.
+
+ * eval.c (rb_thread_select): ditto.
+
+ * eval.c (rb_thread_join): join during critical section causes
+ deadlock.
+
+Fri Dec 29 00:38:46 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * m17n.c: new file - core functions of M17N.
+
+Tue Dec 26 18:46:41 2000 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
+
+ * lib/debug.rb: Avoid thread deadlock in debugging stopped thread.
+
+ * lib/debug.rb: Uncleared 'finish' state.
+
+Tue Dec 26 16:53:55 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_yield_0): remove dvar node by rb_gc_force_recycle()
+ more eagerly.
+
+ * eval.c (rb_f_binding): recycling should be stopped for outer
+ scope too.
+
+ * eval.c (proc_new): ditto.
+
+Tue Dec 26 15:45:35 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_inspect): should treat multibyte characters
+ properly.
+
+Mon Dec 25 17:49:08 2000 K.Kosako <kosako@sofnec.co.jp>
+
+ * string.c (rb_str_replace_m): unexpected string share happens if
+ replace is done for associated (STR_NO_ORIG) string.
+
+Tue Dec 26 15:01:53 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_f_p): should not call rb_io_flush() if rb_defout is not
+ a IO (T_FILE).
+
+Mon Dec 25 15:52:39 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * stable version 1.6.2 released.
+
+Mon Dec 25 05:11:04 2000 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/cgi.rb: version 2.1.2 (some bug fixes).
+
+ * lib/cgi.rb: Regexp::last_match[1] --> $1
+
+ * lib/net/telnet.rb: ditto.
+
+Mon Dec 25 04:43:02 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/http.rb: does not send HEAD on closing socket.
+
+Mon Dec 25 00:44:48 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (rb_any_cmp): should use rb_str_cmp() if TYPE == T_STRING
+ and CLASS_OF == rb_cString.
+
+ * string.c (rb_str_new4): should copy class of original too.
+
+Mon Dec 25 00:04:54 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (rb_thread_schedule): initial value of `max' changed to -1.
+
+Mon Dec 25 00:16:14 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_replace_m): copy-on-write replace.
+
+ * parse.y (yylex): should handle => after identifier as well as ==
+ and =~.
+
+Sat Dec 23 23:55:57 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_cstr2inum): Integer("") should not return 0.
+
+Sat Dec 23 11:55:57 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_and): Array#& should preserve original order.
+
+Sat Dec 23 03:44:16 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb: set @closed false in Socket#reopen.
+
+ * lib/net/pop.rb: add POP3.foreach, delete_all.
+
+ * lib/net/pop.rb: add POP3#delete_all.
+
+ * lib/net/http.rb: add HTTP.version_1_1, version_1_2
+
+ * lib/net/http.rb: refactoring.
+
+Fri Dec 22 23:11:12 2000 Ueno Katsuhiro <unnie@blue.sky.or.jp>
+
+ * eval.c (rb_feature_p): ext might be null.
+
+Fri Dec 22 17:04:12 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * win32/win32.c (myselect): avoid busy loop by adjusting fd_count.
+
+Fri Dec 22 15:07:55 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_cstr2inum): prefix like '0x' had removed too much.
+
+Thu Dec 21 13:01:46 2000 Tanaka Akira <akr@m17n.org>
+
+ * lib/net/ftp.rb (makeport): don't use TCPsocket.getaddress.
+
+Wed Dec 20 12:00:15 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big_lshift): should cast up to BDIGIT_DBL.
+
+ * parse.y (yylex): disallow trailing '_' for numeric literals.
+
+ * bignum.c (rb_cstr2inum): allow `_' within converting string.
+
+ * eval.c (specific_eval): should take no argument if block is
+ supplied.
+
+Tue Dec 19 13:44:50 2000 K.Kosako <kosako@sofnec.co.jp>
+
+ * io.c (rb_f_p): should flush rb_defout, not stdout.
+
+Tue Dec 19 00:57:10 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_minus): usec might overflow. (ruby-bugs-ja:PR#35)
+
+ * eval.c (rb_obj_extend): Object#extend should take at least one
+ argument.
+
+ * parse.y (mrhs_basic): should check value_expr($3), not $1.
+
+Mon Dec 18 23:18:39 2000 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * util.c (mblen, __crt0_glob_function): add for multibyte
+ on DJGPP 2.03.
+
+Mon Dec 18 18:10:30 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_plus): usec might underflow (ruby-bugs-ja:#PR33).
+
+Mon Dec 18 08:11:20 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (rb_hash_set_default): should call rb_hash_modify().
+
+Sat Dec 16 02:58:26 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * eval.c (rb_eval): should clear ruby_errinfo on retry.
+
+ * eval.c (rb_rescue2): ditto.
+
+Thu Dec 14 13:06:18 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * class.c (rb_include_module): prohibit frozen class/module.
+
+ * eval.c (rb_frozen_class_p): make external.
+
+ * intern.h (rb_frozen_class_p): prototyped.
+
+ * intern.h (rb_undef): prototyped not but rb_undef_method()
+ which is also in ruby.h.
+
+Thu Dec 14 09:20:26 2000 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/cgi.rb: support -T1 on ruby 1.6.2
+
+ * lib/cgi.rb: $1 --> Regexp::last_match[1]
+
+ * lib/net/telnet.rb: ditto.
+
+Wed Dec 13 23:27:06 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): handles case statement without expr, which
+ looks for any TRUE (non nil, non false) when expression.
+
+ * parse.y (primary): case expression should not be compstmt, but
+ mere expr.
+
+ * parse.y (primary): case without following expression is now
+ separated rule.
+
+Wed Dec 13 12:41:27 2000 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ruby.c (proc_options): accept "--^M" for DOS line endings.
+
+Tue Dec 12 15:45:42 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (newline_node): cancel newline unification.
+
+Mon Dec 11 23:01:57 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): supports cases `?' precedes EOF and newline.
+
+Mon Dec 11 12:11:25 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (call_end_proc): some frame members were left
+ uninitialized.
+
+Mon Dec 11 01:14:58 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_fptr_finalize): do not fclose stdin, stdout and
+ stderr at exit.
+
+Sat Dec 9 17:34:48 2000 Tachino Nobuhiro <tachino@open.nm.fujitsu.co.jp>
+
+ * time.c (time_cmp): should check with kind_of?, not instance_of?
+
+ * time.c (time_eql): ditto.
+
+ * time.c (time_minus): ditto.
+
+Fri Dec 8 17:23:25 2000 Tachino Nobuhiro <tachino@open.nm.fujitsu.co.jp>
+
+ * sprintf.c (rb_f_sprintf): proper string precision treat.
+
+Fri Dec 8 10:44:05 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_mod_remove_cvar): Module#remove_class_variable
+ added.
+
+Thu Dec 7 17:35:51 2000 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (stack_length): don't use __builtin_frame_address() on alpha.
+
+Wed Dec 6 18:07:13 2000 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * djgpp/config.sed, win32/Makefile.sub: typo.
+
+ * eval.c (rb_mod_define_method): avoid VC4.0 warnings.
+
+Wed Dec 6 13:38:08 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_and): tuning, make hash from shorter operand.
+
+Wed Dec 6 01:28:50 2000 SHIROYAMA Takayuki <psi@fortune.nest.or.jp>
+
+ * gc.c (rb_gc): __builtin_frame_address() should not be used on
+ MacOS X.
+
+ * gc.c (Init_stack): ditto.
+
+Mon Dec 4 13:44:01 2000 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * lib/jcode.rb: consider multibyte. not /n.
+
+Mon Dec 4 09:49:36 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_inspect): output whole string contents. no more `...'
+
+ * string.c (rb_str_dump): should propagate taintness.
+
+ * hash.c (env_inspect): hash like human readable output.
+
+ * variable.c (rb_ivar_get): prohibiting instance variable access
+ is too much restriction.
+
+ * class.c (method_list): retrieving information should not be
+ restricted where $SAFE=4.
+
+ * class.c (rb_obj_singleton_methods): ditto.
+
+ * eval.c (rb_thread_priority): ditto.
+
+ * eval.c (rb_thread_local_aref): ditto.
+
+ * variable.c (rb_obj_instance_variables): ditto.
+
+ * variable.c (rb_mod_const_at): ditto.
+
+ * variable.c (rb_mod_class_variables): ditto.
+
+ * eval.c (rb_exec_end_proc): end_proc should be preserved.
+
+Sat Dec 2 22:32:43 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_yield_0): || should accept exactly zero argument.
+
+ * parse.y (stmt): multiple right hand side for single assignment
+ (e.g. a = 1,2) is allowed.
+
+Wed Nov 29 07:55:29 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (w_long): dumping long should be smaller than 32bit max.
+
+ * marshal.c (w_long): shorter long format for small integers(-123..122).
+
+ * marshal.c (r_long): ditto.
+
+Tue Nov 28 18:10:51 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_mod_define_method): quick hack to implement
+ on-the-fly method definition. experimental.
+
+Mon Nov 27 17:00:35 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): should not redefine builtin classes/modules
+ from within wrapped load.
+
+Mon Nov 27 08:57:33 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (call_end_proc): should be isolated from outer block.
+
+Mon Nov 27 00:10:08 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_ctl): call ioctl/fcntl for fptr->f2 too.
+
+ * process.c (rb_f_fork): call rb_thread_atfork() after creating
+ child process.
+
+ * eval.c (rb_thread_atfork): kill all other threads immediately,
+ then turn the current thread into the main thread.
+
+Sat Nov 25 23:12:22 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (ruby_run): move calling point of rb_trap_exit after
+ cleaning up threads.
+
+ * eval.c (ruby_finalize): new function to call EXIT trap, END
+ procs and GC finalizers.
+
+ * eval.c (rb_exec_end_proc): prevent recursion.
+
+ * gc.c (rb_gc_call_finalizer_at_exit): ditto.
+
+ * signal.c (rb_trap_exit): ditto. made static.
+
+ * process.c (rb_f_fork): should swallow all exceptions from block
+ execution.
+
+ * process.c (fork_rescue): should call ruby_finalize().
+
+ * parse.y (yycompile): rb_gc() removed. I don't remember why I put
+ this here. test code?
+
+Fri Nov 24 22:03:48 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * range.c (EXCL): exclusive information is now stored in an
+ instance variable. this enables proper marshal dump.
+
+ * process.c (proc_waitpid): should clear rb_last_status ($?) if
+ no pid was given by waitpid(2).
+
+Thu Nov 23 01:35:38 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * process.c (proc_waitpid2): returns nil if no pid found.
+
+Wed Nov 22 23:45:15 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * range.c (range_eq): new method. Compares start and end of range
+ respectively.
+
+Wed Nov 22 11:01:32 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_mod_class_variables): should honor singleton
+ class variable rule defined yesterday.
+
+Tue Nov 21 23:24:14 2000 Mitsuteru S Nakao <nakao@kuicr.kyoto-u.ac.jp>
+
+ * numeric.c (flodivmod): missing second operand (typo).
+
+Tue Nov 21 03:39:41 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (marshal_load): marshal format compatibility check
+ revised. greater minor revision is UPWARD compatible;
+ downward compatibility is not assured.
+
+ * eval.c (is_defined): clarify class variable behavior for
+ singleton classes. class variables within singleton class
+ should be treated like within singleton method.
+
+Mon Nov 20 13:45:21 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): set ruby_sourceline before evaluating
+ exceptions.
+
+ * gc.c (gc_sweep): defer finalization in GC during compilation or
+ interrupt prohibit section.
+
+ * gc.c (gc_sweep): mark all nodes before sweeping if GC happened
+ during compilation.
+
+ * eval.c (rb_eval): should treat class variables specially in a
+ method defined in the singleton class.
+
+Mon Nov 20 10:20:21 2000 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * dir.c, win32/win32.c, ruby.h: add rb_iglob().
+
+Mon Nov 20 00:18:16 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_subseq): should return nil for outbound start
+ index.
+
+ * marshal.c (marshal_load): show format versions explicitly when
+ format version mismatch happens.
+
+Sun Nov 19 06:13:24 2000 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * marshal.c: use long for string/array length.
+
+ * pack.c (swaps): use bit-or(|) instead of plus(+).
+
+ * pack.c (swapl): ditto.
+
+Sat Nov 18 15:18:16 2000 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * array.c (rb_ary_replace): array size should be in long.
+
+ * array.c (rb_ary_concat): ditto.
+
+ * array.c (rb_ary_hash): ditto.
+
+Sat Nov 18 14:07:20 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/http.rb: Socket#readline() reads until "\n", not "\r\n"
+
+Fri Nov 17 14:55:18 2000 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * string.c (rb_str_succ): output should be NUL terminated.
+
+Fri Nov 17 02:54:15 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_close): need not to flush before closing.
+
+ * eval.c (rb_thread_join): should preserve last thread status when
+ THREAD_TO_KILL.
+
+ * eval.c (rb_thread_stop): ditto.
+
+ * io.c (io_fflush): wrap fflush by TRAP_BEG, TRAP_END.
+
+ * eval.c (rb_eval): method defined within singleton class
+ definition should behave like singleton method about class
+ variables.
+
+ * eval.c (is_defined): ditto.
+
+Thu Nov 16 23:06:07 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/http.rb: can call {old,new}_implementation any times.
+
+ * lib/net/http.rb: HTTP#connecting, receive ->
+ common_oper, connecting.
+
+ * lib/net/http.rb: output warning if u_header includes
+ duplicated header.
+
+ * lib/net/http.rb: not check Connection:/Proxy-Connection;
+ always read until eof.
+
+ * lib/net/protocol.rb: detects and catches "break" from block.
+
+Thu Nov 16 16:32:45 2000 Masahiro Tanaka <masa@stars.gsfc.nasa.gov>
+
+ * bignum.c (bigdivrem): should have incremented ny first.
+
+Thu Nov 16 14:58:00 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ext/socket/socket.c (sock_new): duplicates file descriptor
+ with myfddup() on mswin32/mingw32.
+
+ * win32/win32.h: uses system original fdopen().
+
+ * win32/win32.c (myfddup): newly added instead of myfdopen().
+
+ * win32/win32.c (mybind, myconnect, mygetsockname, mygetsockopt,
+ mylisten, mysetsockopt): now accept file descriptor only, not
+ SOCKET.
+
+ * win32/win32.c (myaccept, mysocket): return file descriptor,
+ instead of SOCKET.
+
+Thu Nov 16 10:23:24 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (massign): too strict check for nameless rest argument.
+
+ * eval.c (method_arity): mere * should return -1.
+
+ * eval.c (intersect_fds): should check all FDs in the fd_set.
+
+Wed Nov 15 19:33:20 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (rb_attr): should clear method cache before calling hook.
+
+ * eval.c (rb_eval): ditto.
+
+ * eval.c (rb_mod_modfunc): ditto.
+
+Mon Nov 13 22:44:52 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * error.c (rb_bug): print version to stderr.
+
+Mon Nov 13 19:02:08 2000 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * win32/win32.c, io.c, process.c: the exit status of program must be
+ multiplied 256 on mswin32 and msdosdjgpp(system(), ``).
+
+Sat Nov 11 22:57:38 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (arg): uniformed treatment of -a**b, where a is a
+ number literal; hacky but behavior appears more consistent.
+
+ * parse.y (newline_node): reduce newline node (one per line).
+
+ * random.c (rb_f_srand): should be prohibited in safe level
+ greater than 4.
+
+Sat Nov 11 22:37:36 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * rubysig.h: do not use rb_trap_immediate on win32.
+
+ * rubysig.h: new macros, ATOMIC_TEST, ATOMIC_SET, ATOMIC_INC,
+ ATOMIC_DEC, RUBY_CRITICAL and new definition of TRAP_BEG,
+ TRAP_END.
+
+ * gc.c (ruby_xmalloc): should wrap malloc() by RUBY_CRITICAL.
+
+ * signal.c (sighandle): better win32 sig handling.
+
+ * win32/win32.c (flock): better implementation.
+
+ * win32/win32.c (myselect): ditto.
+
+ * win32/win32.c (myaccept): ditto.
+
+ * win32/win32.c (waitpid): ditto.
+
+ * win32/win32.c (myrename): ditto.
+
+ * win32/win32.c (wait_events): support function for win32 signal
+ handling.
+
+Sat Nov 11 08:34:18 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.31.
+
+ * lib/net/http.rb: initializes header in HTTP, not HTTPCommand.
+
+ * lib/net/protocol.rb, http.rb: rewrites proxy code.
+
+Fri Nov 10 16:15:53 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (rb_num2long): use to_int, not to_i.
+
+ * error.c: T_SYMBOL was misplaced by T_UNDEF.
+
+ * parse.y (yylex): eval("^") caused infinite loop.
+
+Thu Nov 9 14:22:13 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_taint_check): should check IO taintness; no
+ operation for untainted IO should be allowed in the sandbox.
+
+ * rubyio.h (GetOpenFile): check IO taintness inside using
+ rb_io_taint_check().
+
+Wed Nov 8 03:08:53 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (io_fflush): ensure fflush(3) would not block by calling
+ rb_thread_fd_writable().
+
+Tue Nov 7 20:29:56 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.30.
+
+ * lib/net/protocol.rb, smtp.rb: Command#critical_ok -> error_ok
+
+ * lib/net/http.rb: reads header when also "100 Continue".
+
+Tue Nov 7 04:32:19 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (bigdivrem): use bit shift to make y's MSB set.
+
+Mon Nov 6 1:22:49 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * error.c (warn_print): do not use err_append(), to ensure output
+ to stderr.
+
+ * error.c (rb_warn): use warn_print() instead of err_print().
+
+ * error.c (rb_warning): ditto.
+
+ * error.c (rb_bug): ditto.
+
+ * eval.c (rb_load): re-raise exceptions during load.
+
+ * time.c (make_time_t): remove useless adjust
+
+Thu Nov 2 18:01:16 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * random.c (rb_f_rand): half-baked float support fixed. This fix
+ was originally proposed by K.Kosako <kosako@sofnec.co.jp>.
+
+Tue Oct 31 17:27:17 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c: change digit size to `long|int' if long long is
+ available.
+
+ * marshal.c (w_object): support `long|int' digits.
+
+ * marshal.c (r_object): ditto.
+
+Sat Oct 28 23:54:22 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): allow =end at the end of file (without a
+ newline at the end).
+
+Fri Oct 27 10:00:27 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_cstr2inum): should ignore trailing white spaces.
+
+ * bignum.c (rb_str2inum): string may not have sentinel NUL.
+
+Fri Oct 27 02:37:22 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_cstr2inum): wrongly assigned base to c before
+ badcheck check.
+
+Thu Oct 26 02:42:50 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb: Command#critical_ok
+
+ * lib/net/smtp.rb: clear critical flag before go to SMTP
+
+Wed Oct 25 12:30:19 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_concat): replacing array might be the receiver
+ itself. do not call rb_ary_push_m.
+
+ * array.c (rb_ary_replace): replacing array might be the receiver
+ itself. use memmove.
+
+Fri Oct 20 07:56:23 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): ARGSPUSH should not modify args array.
+
+Thu Oct 19 14:58:17 2000 WATANABE Tetsuya <tetsu@jpn.hp.com>
+
+ * pack.c (NUM2U32): should use NUM2ULONG().
+
+Tue Oct 17 17:30:34 2000 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * eval.c (error_print): ruby_sourcefile may be NULL.
+
+Tue Oct 17 16:36:28 2000 Wes Nakamura <wknaka@pobox.com>
+
+ * pack.c (NATINT_U32): wrong use of sizeof.
+
+Tue Oct 17 12:48:20 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * eval.c (rb_abort): nil check against ruby_errinfo.
+
+ * eval.c (rb_thread_schedule): use FOREACH_THREAD_FROM instead of
+ FOREACH_THREAD, since curr_thread may be removed from thread ring.
+
+ * eval.c (THREAD_ALLOC): errinfo should be Qnil.
+
+ * eval.c (rb_callcc): th->prev,th->next are now already
+ initialized in THREAD_ALLOC.
+
+Mon Oct 16 15:37:33 2000 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * eval.c (rb_thread_inspect): tag size was shorter than required.
+
+ * object.c (rb_obj_inspect): ditto.
+
+Mon Oct 16 14:25:18 2000 Shugo Maeda <shugo@ruby-lang.org>
+
+ * object.c (sym_inspect): used `name' before initialization.
+
+Mon Oct 16 14:06:00 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * pack.c (pack_pack): use NATINT_U32 for 'l', 'L', and 'N'.
+
+ * pack.c (I32,U32): 32 bit sized integer.
+
+ * pack.c (OFF16,OFF32B): big endian offset for network byteorder.
+
+Mon Oct 16 06:39:32 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/http.rb: hex-alpha is not [a-h] but [a-f].
+
+Mon Oct 16 01:02:02 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_start_0): should not abort on exception if
+ $SAFE >= 4.
+
+ * parse.y (sym): symbols for class variable names.
+
+Sun Oct 15 01:49:18 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (rb_file_flock): should accept interrupt.
+
+ * process.c (rb_waitpid): ditto.
+
+ * process.c (rb_waitpid): ditto.
+
+ * process.c (proc_wait): ditto.
+
+ * process.c (proc_waitpid2): wrong recursion.
+
+Sat Oct 14 03:32:13 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_alloc): should not link a new thread in the
+ live thread ring before initialization.
+
+Fri Oct 13 17:08:09 2000 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb: new file.
+
+Thu Oct 12 18:56:28 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/pop.rb: POP3#reset
+
+ * lib/net/http.rb: a code for "Switch Protocol" was wrongly 100.
+
+Thu Oct 12 01:23:38 2000 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/cgi.rb: bug fix: CGI::html(): PRETTY option didn't work.
+
+Thu Oct 12 00:03:02 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (sym_inspect): should adjust string length.
+
+ * struct.c (rb_struct_to_s): ditto.
+
+ * struct.c (rb_struct_inspect): ditto.
+
+Wed Oct 11 22:15:47 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * eval.c (rb_thread_inspect): should adjust string length.
+
+ * object.c (rb_any_to_s): ditto.
+
+ * object.c (rb_obj_inspect): ditto.
+
+Wed Oct 11 18:13:50 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_start_0): should check insecure exit.
+
+Wed Oct 11 14:29:51 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb: 2nd arg for ProtocolError#initialize is
+ optional.
+
+ * lib/net/http.rb: code refining.
+
+Wed Oct 11 11:13:03 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (primary): setter method (e.g. foo=) should always be
+ public.
+
+ * eval.c (rb_thread_raise): should not raise SecurityError if
+ exception raised by the interpreter.
+
+ * eval.c (rb_thread_cleanup): skip all THREAD_KILLED threads
+ before FOREACH_THREAD.
+
+Tue Oct 10 16:11:54 2000 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * dln.c (dln_load): remove unused code for Cygwin.
+
+Tue Oct 10 09:49:23 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (Init_File): FileTest.size should return 0 (not nil) for
+ empty files.
+
+Sun Oct 8 13:20:26 2000 Guy Decoux <decoux@moulon.inra.fr>
+
+ * eval.c (POP_SCOPE): not just set SCOPE_DONT_RECYCLE, but do
+ scope_dup().
+
+Sat Oct 7 15:10:50 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_reverse_bang): unnecessary ALLOCA_N() was
+ removed.
+
+Fri Oct 6 14:50:24 2000 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ext/extmk.rb.in, lib/mkmf.rb: remove "DESTDIR =".
+
+ * Makefile.in, win32/Makefile.sub, ruby.1: renamed -X to -C.
+
+Fri Oct 6 12:50:52 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * array.c (rb_ary_plus): use to_ary(), not Check_Type().
+
+ * array.c (rb_ary_concat): ditto.
+
+ * gc.c (rb_gc): use __builtin_frame_address() for gcc.
+
+ * eval.c (stack_length): ditto.
+
+ * parse.y (assign_in_cond): stop warning till some better warning
+ condition will be found.
+
+Thu Oct 5 18:02:39 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_obj_dup): should have propagated taint flag.
+ (ruby-bugs:#PR64,65)
+
+Wed Oct 4 00:26:11 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (proc_arity): proc{|a|}'s arity should be -1.
+
+Mon Oct 2 05:28:58 2000 akira yamada <akira@ruby-lang.org>
+
+ * string.c (trnext): minus at the end of pattern.
+
+Sun Oct 1 00:43:34 2000 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * configure.in: exp-name was wrong on cygwin and mingw32.
+
+Thu Sep 28 14:57:09 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_compile_pattern): should try must_string calculation
+ every time.
+
+Tue Sep 19 23:47:44 2000 SHIROYAMA Takayuki <psi@fortune.nest.or.jp>
+
+ * configure.in, config.guess, config.sub: MacOS X support.
+
+Wed Sep 27 18:40:05 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * stable version 1.6.1 released.
+
+Wed Sep 27 16:13:05 2000 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * mkconfig.rb: variables should be expanded only if /\$\{?\w+\}?/.
+
+Tue Sep 26 18:09:51 2000 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * string.c: include <math.h>
+
+Tue Sep 26 15:59:50 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_mod_dup): metaclasses of class/module should not be
+ cleared by rb_obj_dup.
+
+Tue Sep 26 02:44:54 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (GC_MALLOC_LIMIT): size extended.
+
+ * regex.c (DOUBLE_STACK): use machine's stack region for regex
+ stack if its size is small enough.
+
+Mon Sep 25 18:13:07 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c: include <defines.h>.
+
+ * eval.c (rb_add_method): cache mismatch by method
+ definition. need to clear_cache_by_id every time.
+
+Mon Sep 25 13:31:45 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * win32/win32.c (NtCmdGlob): substitute '\\' with '/'.
+
+Mon Sep 25 00:35:01 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * defines.h: #undef HAVE_SETITIMER on cygwin.
+
+Sun Sep 24 03:01:53 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, http.rb: typo.
+
+Sat Sep 23 07:33:20 2000 Aleksi Niemela <aleksi.niemela@cinnober.com>
+
+ * regex.c (re_compile_pattern): nicer regexp error messages for
+ invalid patterns.
+
+Sat Sep 23 03:06:25 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_autoload_load): should not require already
+ provided features.
+
+Fri Sep 22 15:46:21 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/http.rb: too early parameter expansion in string.
+
+Fri Sep 22 13:58:51 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ext/extmk.rb.in: don't use default $:
+
+Fri Sep 22 13:42:50 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * regex.c (PUSH_FAILURE_COUNT): avoid casting warning on alpha.
+
+ * regex.c (PUSH_FAILURE_POINT): ditto.
+
+Fri Sep 22 10:16:21 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * win32/config.h.in: add HAVE_TELLDIR, HAVE_SEEKDIR
+
+Thu Sep 21 19:04:34 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ext/extmk.rb, lib/mkmf.rb (install_rb): check whether libdir is
+ directory or not.
+
+Thu Sep 21 17:23:05 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * file.c (rb_file_s_symlink): use HAVE_SYMLINK.
+
+ * file.c (rb_file_s_readlink): use HAVE_READLINK.
+
+ * dir.c (dir_tell): use HAVE_TELLDIR.
+
+ * dir.c (dir_seek): use HAVE_SEEKDIR.
+
+ * configure.in (AC_CHECK_FUNCS): lstat, symlink, readlink,
+ telldir, seekdir checks added.
+
+ * file.c (lstat): should use stat(2) if lstat(2) is not
+ available.
+
+Thu Sep 21 15:59:23 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.29.
+
+ * lib/net/http.rb: HTTPReadAdapter -> HTTPResponseReceiver
+
+ * lib/net/http.rb (connecting): response is got in receive()
+
+Thu Sep 21 15:49:07 2000 Wayne Scott <wscott@ichips.intel.com>
+
+ * lib/find.rb (find): should not follow symbolic links;
+ tuned performance too.
+
+Wed Sep 20 23:21:38 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ruby.c (load_file): two Ctrl-D was required to stop ruby at the
+ beginning of stdin script read.
+
+Wed Sep 20 14:01:45 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_provided): detect infinite load loop.
+
+ * eval.c (rb_provided): too weak filename comparison.
+
+ * eval.c (rb_thread_alloc): avoid recycling still referenced
+ dvar structures.
+
+ * eval.c (rb_callcc): ditto.
+
+ * eval.c (THREAD_ALLOC): fill dyna_vars field by ruby_dyna_vars.
+
+Tue Sep 19 17:47:03 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * stable version 1.6.0 released.
+
+Tue Sep 19 16:24:52 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * marshal.c (Init_marshal): provide marshal.so no more.
+
+Tue Sep 19 14:01:01 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * configure.in, win32/setup.mak: include version number
+ in RUBY_SO_NAME.
+
+Tue Sep 19 13:07:47 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): was confusing $~ and $_.
+
+Tue Sep 19 13:06:53 2000 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * signal.c (rb_f_kill): signum may be a negative number, should be
+ treated by signed number.
+
+Tue Sep 19 01:14:56 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_provide): better feature handling.
+
+ * eval.c (rb_f_require): loading ruby library may be partial
+ state. checks in rb_thread_loading is integrated.
+
+ * eval.c (rb_provided): better thread awareness.
+
+ * lib/irb/frame.rb: 6 (not 5) parameters for trace_func proc.
+
+ * eval.c (error_print): should print error position even if
+ get_backtrace() failed.
+
+Sat Sep 16 03:29:59 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_f_require): rb_provided() was called too early; does
+ not work well with threads.
+
+ * parse.y (ensure): should distinguish empty ensure and non
+ existing ensure.
+
+ * file.c (Init_File): extending File by class of FileTest was
+ serious mistake.
+
+Thu Sep 14 02:46:54 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_yield): array strip should be done in this
+ function.
+
+Wed Sep 13 17:01:03 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big_eq): incomplete value comparison of bignums.
+
+Wed Sep 13 06:39:54 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_mod_class_variables): Module#class_variables added.
+
+Wed Sep 13 06:09:26 2000 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/cgi.rb: bug fix: CGI::header(): output status header.
+
+Wed Sep 13 01:09:12 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): allow global variables like '$__a'.
+
+Tue Sep 12 22:28:43 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ext/socket/extconf.rb: avoid using terrible <netinet/tcp.h>
+ on cygwin 1.1.5.
+
+Tue Sep 12 16:01:58 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * array.c (rb_ary_unshift_m): typo.
+
+Tue Sep 12 15:37:55 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_yield_0): stripped array too much, should remove just
+ for proc_call().
+
+Tue Sep 12 07:05:24 2000 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/cgi.rb: version 2.0.0: require ruby1.5.4 or later.
+
+ * lib/net/telnet.rb: version 1.6.0
+
+Tue Sep 12 03:26:07 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (massign): use to_ary to get an array if available.
+
+ * object.c (rb_Array): ditto.
+
+Mon Sep 11 14:24:47 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (ruby_setenv): should not free the element of
+ origenvironment.
+
+ * parse.y (command_call): kYIELD moved to this rule to allow
+ 'a = yield b'. (ruby-bugs-ja:#PR15)
+
+Mon Sep 11 01:27:54 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_yield_0): proc#call([]) should pass single value to
+ the block.
+
+ * eval.c (callargs): reduce array allocation.
+
+ * eval.c (massign): precise check for argument number.
+
+Fri Sep 8 10:05:17 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (STR_NO_ORIG): should be FL_USER2.
+
+Thu Sep 7 14:17:51 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_cat): should work even for concatenating same
+ string.
+
+Wed Sep 6 17:06:38 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_cvar_declare): should check superclass's class
+ variable first.
+
+Wed Sep 6 10:42:02 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-calculate-indent): shift continuing line
+ if previous line ends with modifier keyword.
+
+ * misc/ruby-mode.el (ruby-parse-region): should not give up if
+ modifiers are at the end of line.
+
+ * misc/ruby-mode.el (ruby-expr-beg): indented wrongly if modified
+ statement was size 1.
+
+Wed Sep 6 10:41:19 2000 Kenichi Komiya <kom@mail1.accsnet.ne.jp>
+
+ * misc/ruby-mode.el (ruby-parse-region): modifier was not handled
+ well on emacs19.
+
+Tue Sep 5 17:10:12 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_to_s): fixed zone string UTC for utc time object.
+
+Tue Sep 5 00:26:06 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_search): range worked wrongly on bm_search().
+
+Mon Sep 4 13:40:40 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * configure.in: renamed libruby.a to libruby.{cygwin,mingw32}.a
+ on cygwin and mingw32.
+
+Sun Sep 3 23:44:04 2000 Noriaki Harada <tenmei@maoh.office.ne.jp>
+
+ * io.c (NO_SAFE_RENAME): for BeOS too.
+
+Sun Sep 3 11:31:53 2000 Takaaki Tateishi <ttate@jaist.ac.jp>
+
+ * parse.y (rescue): no assignment was done if rescue body was
+ empty.
+
+Sat Sep 2 10:52:21 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (call_args,aref_args): block_call can be the last
+ argument.
+
+ * parse.y (COND_PUSH,COND_POP): maintain condition stack to allow
+ kDO2 in parentheses in while/until/for conditions.
+
+ * parse.y (yylex): generate kDO2 for EXPR_ARG outside of
+ while/until/for condition.
+
+Fri Sep 1 10:36:29 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (aref_args,opt_call_args): add block_call to allow a
+ method without parentheses and with block as a last argument.
+
+ * hash.c (rb_hash_sort): should not return nil.
+
+ * re.c (match_aref): should use rb_reg_nth_match().
+
+ * eval.c (POP_SCOPE): recycled scopes too much
+
+ * eval.c (Init_eval): extend room for stack allowance.
+
+ * eval.c (POP_SCOPE): frees scope too much.
+
+Thu Aug 31 14:28:39 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (rb_gc_mark): T_SCOPE condition must be more precise.
+
+ * eval.c (scope_dup): should not make all duped scope orphan.
+
+Thu Aug 31 10:11:47 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (stmt): allow stmt_rhs to be right hand side of multiple
+ assignment.
+
+ * time.c (rb_time_timeval): type error should not mention the word
+ 'interval'.
+
+Wed Aug 30 23:21:20 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (rb_num2long): use rb_Integer() instead of independent
+ convert routine.
+
+ * eval.c (rb_rescue2): now takes arbitrary number of exception types.
+
+ * object.c (rb_convert_type): use rb_rescue2 now to handle NameError.
+
+ * object.c (rb_convert_type): better error message.
+
+Wed Aug 30 17:09:14 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ext/Win32API/Win32API.c (Win32API_initialize): AlphaNT support.
+
+Wed Aug 30 14:19:07 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (node_assign): should support NODE_CVASGN2 too.
+
+Wed Aug 30 11:31:47 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ext/Win32API/Win32API.c (Win32API_initialize): add the
+ arguments checking.
+
+ * ext/Win32API/Win32API.c (Win32API_initialize): add taint
+ checking. allow String object in the third argument.
+
+Wed Aug 30 10:29:40 2000 Masahiro Tomita <tommy@tmtm.org>
+
+ * io.c (rb_f_p): flush output buffer.
+
+Tue Aug 29 16:29:15 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (assignable): remove NODE_CVASGN3.
+
+ * parse.y (gettable): remove NODE_CVAR3.
+
+Tue Aug 29 02:02:14 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/mkmf.rb (create_makefile): handles create_makefile("a/b").
+
+ * ext/extmk.rb.in (create_makefile): ditto
+
+Mon Aug 28 18:43:54 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (is_defined): now handles class variables.
+
+ * eval.c (rb_eval): class variable behavior revisited.
+
+ * parse.y (assignable): ditto.
+
+ * parse.y (gettable): ditto.
+
+ * regex.c (PUSH_FAILURE_COUNT): push/pop interval count on failure
+ stack. this fix is inspired by the Emacs21 patch from Stefan
+ Monnier <monnier@cs.yale.edu>.
+
+Fri Aug 25 15:24:39 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * variable.c (rb_cvar_get): should not follow __attached__.
+
+ * variable.c (rb_cvar_set): ditto.
+
+ * variable.c (rb_cvar_declare): ditto.
+
+ * variable.c (mod_av_set): second class variable assignment at the
+ toplevel should not give warning.
+
+Fri Aug 25 01:18:36 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (next_argv): prepare path for open file.
+
+ * string.c (rb_str_setter): moved from io.c.
+
+ * io.c (next_argv): filename should be "-" for refreshed ARGF.
+
+Thu Aug 24 15:27:39 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ext/socket/socketport.h: use `extern int h_errno' if needed.
+
+Sat Aug 19 01:34:02 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ext/sdbm/_sdbm.c (sdbm_prep): flags should be or-ed by O_BINARY on
+ Win32 too.
+
+ * ext/sdbm/_sdbm.c (makroom): fill hole with 0 on Win32 too.
+
+Fri Aug 18 13:23:59 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): should preserve and clear $! value before
+ compilation.
+
+ * eval.c (eval): ditto.
+
+Fri Aug 18 11:06:19 2000 Shugo Maeda <shugo@ruby-lang.org>
+
+ * ext/socket/socket.c (s_accept): start GC on EMFILE/ENFILE.
+
+Thu Aug 17 16:04:48 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (is_defined): should clear ruby_errinfo.
+
+Thu Aug 17 04:26:31 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.27.
+
+ * lib/net/protocol.rb: writing methods returns written byte size.
+
+ * lib/net/smtp.rb: send_mail accepts many destinations.
+
+Wed Aug 16 00:43:47 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_s_times): use CLK_TCK for HZ if it's defined.
+
+Tue Aug 15 17:30:59 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (frame_dup): should set flag FRAME_MALLOC after
+ argv allocation.
+
+ * eval.c (blk_free): should not free argv if GC was called before
+ frame_dup.
+
+Tue Aug 15 16:08:40 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * configure.in: add ac_cv_func_times=yes for mingw32.
+
+ * win32/win32.c (mytimes): typo.
+
+Tue Aug 15 01:45:28 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (argf_eof): should return true at the end of ARGF without
+ checking stdout if arguments are given.
+
+Mon Aug 14 10:34:32 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_status): status should return false for normal
+ termination, nil for termination by exception.
+
+Fri Aug 11 15:43:46 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_undef): give warning for undefining __id__, __send__.
+
+Thu Aug 10 08:05:03 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_callcc): returned current thread instead of
+ continuation wrongly.
+
+Thu Aug 10 05:40:28 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ext/extmk.rb.in: $CPPFLAGS should be initialized.
+
+ * ext/tcltklib/depend: add stubs.o.
+
+ * ext/tcltklib/extconf.rb: use $CPPFLAGS instead of $CFLAGS.
+
+Wed Aug 9 16:31:48 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_callcc): thread status for continuations must be
+ THREAD_KILLED, otherwise thread_free() breaks other threads.
+
+Wed Aug 9 13:24:25 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * win32/win32.[ch]: emulate rename(2).
+
+Tue Aug 8 14:01:46 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ext/tcltklib/tcltklib.c: support --enable-tcltk_stubs
+
+ * ext/tcltklib/extconf.rb: ditto.
+
+ * ext/tcltklib/stubs.c: created. examine candidate shared libraries.
+
+Mon Aug 7 13:59:12 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ruby.h (CLONESETUP): should copy flags before any potential
+ object allocation.
+
+ * regex.c (re_match): check for stack depth was needed.
+
+Sat Aug 5 16:43:43 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * djgpp/*: convert DOS line endings to UNIX style.
+
+ * djgpp/config.status: rename to config.sed for SFN.
+
+ * lib/ftools.rb (compare, safe_unlink, chmod): avoid warnings.
+
+ * lib/ftools.rb (move): typo. not `tpath', but `to'.
+
+Fri Aug 4 23:26:48 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (proc_call): gives warning if a block is supplied.
+
+ * eval.c (rb_eval): no warning for discarding if an alias for the
+ method is already made.
+
+Fri Aug 4 16:32:29 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (rb_ary_reject_bang): returns nil if no element removed.
+
+ * hash.c (rb_hash_reject_bang): returns nil if no element removed.
+
+Thu Aug 3 19:44:26 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_fd_writable): should return integer value.
+
+ * array.c (rb_ary_assoc): search array element whose length is
+ longer than 0 (not 1).
+
+Wed Aug 2 18:27:47 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_wait_fd): prohibit thread context switch
+ during compilation.
+
+ * eval.c (rb_cont_call): prohibit Continuation#call across threads.
+
+Wed Aug 2 08:22:04 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * gc.c (rb_gc): clear malloc_memories to zero, to avoid potential
+ super frequent GC invocation. (ruby-bugs:#PR48)
+
+ * gc.c (rb_gc): only add_heap() if GC trigger condition is
+ satisfied.
+
+Tue Aug 1 16:41:58 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c (proc_options): global load path setting moved from
+ ruby_prog_init().
+
+ * ruby.c (incpush): renamed. push path entry at the END of the
+ load path array. This makes -I directories sorted in order in
+ the arguments.
+
+Sat Jul 29 23:42:04 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * dir.c (dir_each): should check whether dir is closed during the
+ block execution. (ruby-bugs:#PR47)
+
+Sat Jul 29 21:57:30 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ruby.c (rubylib_mangle): provide another buffer for the result.
+
+Wed Jul 26 10:09:01 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * configure.in: set SOLIBS to LIBS on Cygwin.
+
+ * configure.in: LIBRUBY_SO='$(RUBY_INSTALL_NAME)'.$target_os.dll
+ on cygwin and mingw32. ruby-cygwin.dll is bad. why?
+
+Wed Jul 26 10:04:03 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * gc.c (gc_sweep): avoid full scan during compilation.
+
+ * gc.c (rb_gc): add heap during no gc period (including
+ compilation).
+
+Tue Jul 25 19:03:04 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * cygwin/GNUmakefile: use puts instead of print, because
+ Cygwin DLL's behavior is changed(or bug?).
+
+ * configure.in: LIBRUBY_SO='$(RUBY_INSTALL_NAME)'-$target_os.dll
+ on cygwin and mingw32.
+
+ * cygwin/GNUmakefile: ditto.
+
+ * Makefile.in: $(SOLIBS) should be put after dmyext.@OBJEXT@.
+
+ * instruby.rb: install $(LIBRUBY) to libdir
+ if $(LIBRUBY) != $(LIBRUBY_A_).
+
+Tue Jul 25 15:16:00 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_p): redirect to $defout.
+
+Mon Jul 24 18:52:55 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * win32/win32.c (win32_getenv): should remove `static'.
+
+ * ruby.c (rubylib_mangle): support "/hoge;/foo"
+
+Mon Jul 24 10:28:55 2000 GOTO Kentaro <gotoken@math.sci.hokudai.ac.jp>
+
+ * string.c (rb_str_count): raise exception if no argument is
+ given.
+
+Sun Jul 23 12:55:04 2000 Dave Thomas <Dave@Thomases.com>
+
+ * string.c (rb_str_rindex): Support negative end position.
+
+Fri Jul 21 17:35:01 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (aref_args): command_call now be permitted as
+ aref_args.
+
+ * process.c (proc_getpriority): getpriority(2) may return valid
+ negative number. use errno to detect error.
+
+ * marshal.c (dump_ensure): dumped string should be tainted if
+ any among target objects is tainted.
+
+ * marshal.c (r_regist): restored object should be tainted if and
+ only if the source is a file or a tainted string.
+
+Wed Jul 19 15:14:04 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * bignum.c (bigdivrem): should use rb_int2big(), not rb_uint2big().
+
+Tue Jul 18 14:58:30 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (ruby_options): should treat SystemExit etc. properly.
+
+ * parse.y (yycompile): should check compile_for_eval, not
+ ruby_in_eval.
+
+Mon Jul 17 04:29:50 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/mkmf.rb: converts extension of $objs into $OBJEXT.
+
+Sun Jul 16 03:02:34 2000 Dave Thomas <dave@thomases.com>
+
+ * lib/weakref.rb: Change to use new ObjectSpace calls.
+
+Sat Jul 15 21:59:58 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_eval): should not redefine __id__ nor __send__.
+
+ * gc.c (define_final): integrate final.rb features into the
+ interpreter. define_finalizer and undefine_finalizer was
+ added to ObjectSpace. plus, add_finalizer, remove_finalizer,
+ and call_finalizer are deprecated now.
+
+Sat Jul 15 01:32:34 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_mod_method): implements unbound method.
+
+ * eval.c (Init_eval): should prohibit `module_function' for class
+ Class.
+
+Fri Jul 14 17:19:59 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * cygwin/GNUmakefile.in: use miniruby instead of sed.
+
+Fri Jul 14 12:49:50 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (argf_eof): need to check stdin, when next_p == -1.
+
+ * io.c (read_all): use io_fread() instead of fread(3).
+
+ * io.c (io_reopen): should clearerr FILE if fd < 3.
+
+ * re.c (rb_reg_match_m): the result is exported, so it should be
+ declared as busy.
+
+ * eval.c (rb_eval): should preserve errinfo even if return, break,
+ etc. is called in rescue clause.
+
+ * instruby.rb: install irb too.
+
+Wed Jul 12 15:32:57 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * variable.c (rb_const_get): constants for builtin classes must
+ have higher priority than constants from included modules at
+ Object class.
+
+ * bignum.c (bigdivrem): small embarrassing typo.
+
+Wed Jul 12 15:06:28 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_eval): use rb_const_get_at().
+
+ * variable.c (top_const_get): retrieve toplevel constants only,
+ not ones of Object (and its included modules) in general.
+
+Wed Jul 12 15:04:11 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.26.
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb:
+ add module Net::NetPrivate and its inner classes
+ {Read,Write}Adapter, Command, Socket,
+ SMTPCommand, POP3Command, APOPCommand, HTTPCommand
+
+Wed Jul 12 13:10:30 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * bignum.c (bigdivrem): defer bignorm().
+
+ * bignum.c (bignorm): accepts accidental fixnums.
+
+Tue Jul 11 16:54:17 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (yylex): `@<digit>' is no longer a valid instance
+ variable name.
+
+Tue Jul 11 01:51:50 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * bignum.c (rb_big_divmod): should not use Integer(float) for
+ the right operand.
+
+ * bignum.c (rb_big_remainder): ditto.
+
+ * bignum.c (rb_big_modulo): ditto.
+
+Mon Jul 10 15:27:16 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * io.c (pipe_finalize): should set rb_last_status when pclose().
+
+Mon Jul 10 09:07:54 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * error.c (rb_bug): print version number and such too.
+
+Sat Jul 8 23:08:40 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_start_0): should copy previous scopes to
+ prevent rb_gc_force_recycle().
+
+Fri Jul 7 23:36:36 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * ext/socket/addrinfo.h: move IN_EXPERIMENTAL and IN_LOOPBACKNET
+ definitions to ext/socket/sockport.h.
+
+ * ext/socket/extconf.rb: add getservbyport() and arpa/inet.h check.
+
+ * ext/socket/getaddrinfo.c (getaddrinfo): SOCK_RAW may not be
+ defined (ex. BeOS, Palm OS 2.x or before).
+
+ * ext/socket/getnameinfo.c (getnameinfo): getservbyport() may not
+ exist (ex. BeOS, Palm OS).
+
+ * ext/socket/sockport.h: add IN_EXPERIMENTAL, IN_CLASSA_NSHIFT,
+ IN_LOOPBACKNET, AF_UNSPEC, PF_UNSPEC and PF_INET.
+
+Fri Jul 7 03:30:00 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (aref_args): should allow Hash[:a=>2] etc.
+
+ * numeric.c (fix_aref): convert index by NUM2INT, not FIX2INT.
+ (ruby-bugs:#PR37)
+
+ * time.c (time_localtime): should prohibit for frozen time.
+
+ * time.c (time_gmtime): ditto.
+
+Thu Jul 6 19:12:12 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_file_s_open): should not terminate fptr; just clear it.
+
+ * ruby.c (proc_options): should not call require_libraries()
+ twice.
+
+ * ruby.c (require_libraries): clear req_list_head.next after
+ execution.
+
+Thu Jul 6 13:51:57 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * object.c (rb_to_id): name may not be symbol nor fixnum.
+
+ * struct.c (rb_struct_s_def): name may be nil.
+
+Thu Jul 6 02:09:06 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * bignum.c (bigdivrem): new function to return remainder.
+
+ * numeric.c (fixdivmod): now returns modulo, not remainder.
+
+ * numeric.c (flodivmod): ditto.
+
+ * bignum.c (bigdivmod): ditto.
+
+ * numeric.c (num_modulo): new method; alias to '%'.
+
+Thu Jul 6 00:51:43 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * win32/win32.c (NtCmdGlob): patterns should be separated and
+ NUL terminated.
+
+Wed Jul 5 22:27:56 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * cygwin/GNUmakefile: use ruby.def to make rubycw.dll.
+
+ * ext/extmk.rb.in: create target.def.
+
+ * lib/mkmf.rb: ditto.
+
+Wed Jul 5 09:47:14 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * time.c (time_arg): Time::local, Time::gm now take 7th optional
+ argument for usec.
+
+ * numeric.c (num_ceil, etc): default ceil, floor, round, truncate
+ implementation for Numeric, using `to_f'.
+
+ * io.c (rb_io_reopen): clear fptr->path after free() to prevent
+ potential GC crash.
+
+ * io.c (rb_file_s_open): terminate fptr unless null.
+
+ * io.c (rb_file_initialize): ditto.
+
+ * lib/tempfile.rb: specify FILE::CREAT|File::EXCL to open for
+ better security.
+
+ * numeric.c (flo_truncate): new method.
+
+Wed Jul 5 01:02:53 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ext/extmk.rb.in: join ' ' -> join(' ').
+
+ * lib/mkmf.rb: ditto.
+
+Tue Jul 4 13:51:29 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/dbm/dbm.c: add methods added to Hash in 1.5.x.
+
+ * ext/gdbm/gdbm.c: ditto.
+
+ * ext/sdbm/init.c: ditto.
+
+ * eval.c (proc_call): args may be Qundef (means no argument), do
+ not call TYPE() for args.
+
+Tue Jul 4 13:20:56 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ext/extmk.rb.in: make command line must be single-quoted.
+ $(RUBY_INSTALL_NAME) is command substitution in the POSIX sh.
+
+Tue Jul 4 13:16:02 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * util.c (rb_type): should add T_UNDEF.
+
+Tue Jul 4 09:30:35 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (here_document): supports EOF right after terminator.
+
+ * random.c (rb_f_rand): argument is now optional (rand(max=0)).
+
+Tue Jul 4 01:50:49 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * win32/ruby.def: remove ruby_mktemp.
+
+Tue Jul 4 01:27:13 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_rescue2): new function to rescue arbitrary exception.
+
+ * numeric.c (do_coerce): should catch NameError explicitly.
+
+Tue Jul 4 00:15:23 2000 Dave Thomas <Dave@thomases.com>
+
+ * numeric.c (Init_Numeric): forgot to register Numeric#remainder.
+
+Mon Jul 3 23:46:56 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * win32/win32.c (myselect, myaccept): disable interrupt while
+ executing accept() or select() to avoid Ctrl-C causes
+ "unknown software exception (0xc0000029)".
+
+Mon Jul 3 18:35:41 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * lib/mkmf.rb: use null device if it exists for cross-compiling.
+
+Mon Jul 3 18:19:51 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.26.
+
+ * lib/net/protocol.rb (finish): do nothing unless active.
+
+ * lib/net/http.rb: HTTP#{get,post}2 again (for new impl).
+
+Mon Jul 3 16:47:22 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * cygwin/GNUmakefile: librubys.a -> lib$(RUBY_INSTALL_NAME)s.a
+
+ * configure.in: use AC_CANONICAL_{HOST,TARGET,BUILD}.
+
+Mon Jul 3 13:15:02 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * numeric.c (fix_divmod): x * d + m = y where d, m = x.divmod(y).
+
+ * bignum.c (rb_big_divmod): ditto.
+
+ * numeric.c (fixdivmod): does not depend C's undefined %
+ behavior. adopt to fmod(3m) behavior.
+
+ * numeric.c (flo_mod): modulo now reserves fmod(3m) behavior.
+
+ * numeric.c (num_remainder): 'deprecated' warning.
+
+Mon Jul 3 10:27:28 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * configure.in: use AC_CANONICAL_SYSTEM.
+
+Sun Jul 2 21:17:37 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * configure.in: support without --enable-shared for cygwin/mingw32.
+
+ * cygwin/GNUmakefile: ditto.
+
+ * ext/extmk.rb.in: use null device if it exists for cross-compiling.
+
+ * lib/mkmf.rb: ditto.
+
+ * util.c (ruby_mktemp): remove unused ruby_mktemp().
+
+Sun Jul 2 14:18:04 2000 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * eval.c (TMP_PROTECT_END): tmp__protect_tmp may be NULL.
+
+Sun Jul 2 03:37:50 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.25.
+
+ * lib/net/protocol.rb (each_crlf_line): beg = 0 is needed in adding{}
+
+ * lib/net/smtp.rb: allow String for to_addr of SMTP#sendmail
+
+Sat Jul 1 15:22:35 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * numeric.c (fix_rshift): should handle shift value more than
+ sizeof(long).
+
+Sat Jul 1 15:22:35 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_eval): the value from RTEST() is not valid Ruby
+ object. result should be either true or false.
+
+Sat Jul 1 09:30:06 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * re.c (rb_reg_initialize): was freeing invalid pointer.
+
+Sat Jul 1 03:25:56 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (call_args): command_call can be the last argument of
+ call_args. It had to be the only argument.
+
+ * re.c (rb_reg_s_quote): should not dump core even for unsane mbc
+ string.
+
+Fri Jun 30 01:36:20 2000 Aleksi Niemela <aleksi.niemela@cinnober.com>
+
+ * parse.y (f_norm_arg): better, nicer error message.
+
+Thu Jun 29 07:45:33 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/socket/socket.c (udp_send): destination may be packed
+ struct sockaddr.
+
+ * object.c (rb_Integer): Integer(nil) should be invalid, on the
+ other hand, nil.to_i is OK.
+
+Wed Jun 28 17:26:06 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/socket/socket.c (ip_recvfrom): udp_recvfrom and tcp_recvfrom
+ is merged and moved to IPSocket#recvfrom.
+
+ * ext/socket/socket.c (sock_s_getaddrinfo): family can be a
+ strings such as "AF_INET" etc.
+
+ * ruby.c (require_libraries): . and RUBYLIB added to $load_path
+ just before -r procedure.
+
+ * ruby.c (proc_options): -e, - did not exec -r.
+
+Wed Jun 28 14:52:28 2000 Koga Youichirou <y-koga@mms.mt.nec.co.jp>
+
+ * config.sub: NetBSD/hpcmips support.
+
+Wed Jun 28 10:11:06 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * gc.c: gc trigger threshold changed; GC_NEWOBJ_LIMIT removed,
+ FREE_MIN is increased to 4096.
+
+Tue Jun 27 22:39:28 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.24.
+
+ * lib/net/protocol.rb: modified each_crlf_line again.
+
+ * lib/net/protocol.rb: do_write_beg,do_write_end -> writing{}
+ do_write_do -> do_write
+
+ * lib/net/http.rb: can make proxy connection by passing
+ addresses to HTTP.new, start.
+
+ * lib/net/http.rb: HTTP.new_implementation, old_implementation:
+ can use 1.2 implementation of head, get, post, put.
+ (see document)
+
+Tue Jun 27 12:05:10 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * win32.c (myfdclr): new function.
+
+ * win32.h: add FD_CLR.
+
+Mon Jun 26 23:41:41 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ruby.h: add cast for ANSI style.
+
+ * gc.c (rb_data_object_alloc): use RUBY_DATA_FUNC.
+
+Mon Jun 26 22:20:03 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * win32/win32.c (is_socket, extract_file_fd): New function.
+
+ * win32/win32.c (myfdopen): use is_socket().
+
+ * win32/win32.c (myselect): return non socket files immediately
+ if file and socket handles are mixed.
+
+Mon Jun 26 16:21:30 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_schedule): wait_for cleared too early.
+
+Mon Jun 26 09:15:31 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * pack.c: remove obsolete 'F', 'D' specifiers.
+
+Sun Jun 25 00:55:03 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * ext/socket/socket.c (sock_s_getnameinfo): `res' would not
+ be assigned if TYPE(sa) == T_STRING.
+
+Sat Jun 24 14:36:29 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * config*.dj, configure.bat, top.sed: move to djgpp/.
+
+Sat Jun 24 02:34:17 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c (load_file): call require_libraries() here to let
+ debug.rb work properly.
+
+Fri Jun 23 22:34:51 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * bignum.c (rb_big_lshift): reorder xds assignment to avoid
+ reusing `x' as `len' by VC++ 6.0 SP3 compiler with -Ox switch.
+
+Fri Jun 23 01:11:27 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_substr): should return empty string (""),
+ if beg == str.size and len == zero, mostly for convenience and
+ backward compatibility.
+
+ * parse.y (new_super): should tweak block_pass node for super too.
+
+ * string.c (rb_str_split_m): last split element should not be nil,
+ but "" when limit is specified.
+
+Thu Jun 22 17:27:46 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_substr): str[n,m] now returns nil when n equals
+ to str.size.
+
+Thu Jun 22 13:49:02 2000 Uechi Yasumasa <uechi@ryucom.ne.jp>
+
+ * lib/net/ftp.rb: support resuming.
+
+Thu Jun 22 13:37:19 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * eval.c (rb_thread_sleep_forever): merge pause() macro.
+
+Wed Jun 21 08:49:04 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_eval): should not raise exception just by defining
+ singleton class.
+
+Wed Jun 21 01:18:03 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.h: two macros RUBY_DATA_FUNC and RUBY_METHOD_FUNC are added
+ to make writing C++ extensions easier.
+
+ * array.c (rb_ary_dup): internal classes should not be shared by dup.
+
+ * hash.c (rb_hash_dup): ditto.
+
+ * object.c (rb_obj_dup): ditto.
+
+ * string.c (rb_str_dup): ditto.
+
+ * error.c (Init_Exception): renamed NotImplementError to
+ NotImplementedError.
+
+Tue Jun 20 16:22:38 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * time.c (make_time_t): bug in DST boundary.
+
+Tue Jun 20 10:54:19 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * configure.in: add eval sitedir.
+
+Tue Jun 20 06:14:43 2000 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/cgi.rb: change: version syntax. old: x.yz, now: x.y.z
+
+ * lib/net/telnet.rb: ditto.
+
+Tue Jun 20 00:37:45 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (rb_reg_kcode_m): Regexp#kcode returns nil for code unfixed
+ regexp object.
+
+ * bignum.c (bigdivmod): bignum zero check was wrong.
+
+Mon Jun 19 10:48:28 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * variable.c (rb_cvar_set): forgot to add security check for class
+ variable assignment.
+
+Sun Jun 18 22:49:13 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * configure.in: single quoted sitedir.
+
+ * mkconfig.rb: add DESTDIR for cross-compiling.
+
+ * lib/mkmf.rb: add DESTDIR.
+
+ * ruby.c (load_file): force binmode if fname includes ".exe"
+ on DOSISH.
+
+Sat Jun 17 23:22:17 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * sprintf.c (rb_f_sprintf): should ignore negative precision given
+ by <%.*>.
+
+ * sprintf.c (rb_f_sprintf): should allow zero precision.
+
+Sat Jun 17 03:13:29 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * time.c (time_localtime): avoid unnecessary call of localtime.
+
+ * time.c (time_gmtime): avoid unnecessary call of gmtime.
+
+ * process.c (proc_wait2): new method.
+
+ * process.c (proc_waitpid): second argument made optional.
+
+ * process.c (proc_waitpid2): new method.
+
+Sat Jun 17 00:05:00 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (rb_reg_clone): should initialize member fields.
+
+Fri Jun 16 22:49:34 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_rewind): set lineno to zero.
+
+Fri Jun 16 22:47:47 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.23.
+
+ * lib/net/protocol.rb: too many CRLF in last line.
+
+Fri Jun 16 21:23:59 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * configure.in: add pause(2) checking.
+
+ * eval.c: define pause() if missing.
+
+Fri Jun 16 18:41:58 2000 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * process.c (proc_setsid): BSD-style setpgrp() don't return
+ process group ID, but 0 or -1.
+
+Fri Jun 16 16:23:35 2000 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * file.c (rb_stat_inspect): gives detailed information;
+ compatibility with ruby-1.4.x.
+
+Fri Jun 16 05:18:45 2000 Yasuhiro Fukuma <yasuf@bsdclub.org>
+
+ * configure.in: FreeBSD: do not link dummy libxpg4 which was
+ merged into libc.
+
+Fri Jun 16 03:17:36 2000 Satoshi Nojo <nojo@t-samukawa.or.jp>
+
+ * ext/dbm/dbm.c (fdbm_length): use GetDBM. empty?, [] too.
+
+ * ext/gdbm/gdbm.c (fgdbm_length): ditto.
+
+ * ext/sdbm/init.c (fsdbm_length): ditto.
+
+Fri Jun 16 01:57:31 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_sleep_forever): pause(2) instead of sleep(3).
+
+Thu Jun 15 10:46:36 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_sub_bang): should propagate taintness from
+ replacement string.
+
+Wed Jun 14 17:01:41 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * rubytest.rb: add CONFIG['EXEEXT'] to the executable file name.
+
+Wed Jun 14 14:50:00 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_f_sub): assign to $_ only if modification happens.
+
+ * string.c (rb_f_gsub): ditto.
+
+ * string.c (rb_f_chop): ditto.
+
+ * string.c (rb_f_chomp): ditto.
+
+ * io.c (io_reopen): preserve file position by ftell/fseek, if io
+ is a seekable.
+
+ * eval.c (method_arity): wrong arity number for the methods with
+ optional arguments.
+
+ * time.c (make_time_t): opposite timezone shift (should be negative).
+
+Wed Jun 14 14:07:38 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * io.c: typo(ig/if).
+
+ * re.c: typo(re/reg). add rb_reg_check().
+
+ * time.c: remove unneeded declare(daylight, timezone).
+
+ * configure.in: add include <time.h> when daylight checking.
+
+Wed Jun 14 11:36:52 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * marshal.c (r_object): modified for symbols.
+
+ * marshal.c (w_object): ditto.
+
+Wed Jun 14 10:04:58 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (rb_memcmp): should compare according to ruby_ignorecase.
+
+ * string.c (rb_str_cmp): use rb_memcmp.
+
+ * string.c (rb_str_index): ditto.
+
+ * string.c (rb_str_rindex): ditto.
+
+ * string.c (rb_str_each_line): ditto.
+
+Wed Jun 14 04:58:53 2000 Dave Thomas <dave@thomases.com>
+
+ * io.c (rb_io_set_lineno): should have returned VALUE, not
+ integer.
+
+Wed Jun 14 09:29:42 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_dup): dup should always propagate taintness.
+
+Wed Jun 14 00:50:14 2000 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/cgi.rb: read_multipart(): if no content body then raise EOFError.
+
+Tue Jun 13 11:46:17 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * process.c (proc_setsid): try implement it using setpgrp() and
+ ioctl(fd, TIOCNOTTY, NULL).
+
+ * re.c (rb_reg_prepare_re): magic variable $= should affect regex
+ pattern match.
+
+ * time.c (make_time_t): use tm.tm_gmtoff if possible.
+
+ * time.c (time_zone): use tm.tm_zone if available.
+
+Tue Jun 13 01:50:57 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.22.
+
+ * lib/net/http.rb: HTTPResponse#body returns body.
+
+Mon Jun 12 23:41:54 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * configure.in (daylight): avoid GCC optimization.
+
+Mon Jun 12 19:02:27 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * configure.in: cygwin has strange timezone.
+
+ * time.c (time_zone): use tzname and daylight.
+
+Sat Jun 10 23:10:32 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_seek): whence is optional, default is SEEK_SET.
+
+Fri Jun 9 17:00:29 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.21.
+
+ * lib/net/http.rb: exception is raised with response object.
+
+Fri Jun 9 15:11:35 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * time.c (make_time_t): supports daylight saving time.
+
+ * eval.c (rb_thread_safe_level): should retrieve current $SAFE
+ value if a thread is the current thread.
+
+Thu Jun 8 14:25:45 2000 Hiroshi Igarashi <iga@ruby-lang.org>
+
+ * lib/mkmf.rb: add target `distclean' in Makefile for extlib.
+ target `clean' doesn't remove Makefile.
+
+Thu Jun 8 13:34:03 2000 Dave Thomas <dave@thomases.com>
+
+ * numeric.c: add nan?, infinite?, and finite? to Float
+
+Thu Jun 8 00:31:04 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * regex.h: export re_mbctab properly on cygwin.
+
+ * dln.c: use dlopen instead of LoadLibrary on cygwin.
+
+Thu Jun 8 13:41:34 2000 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * file.c (rb_file_s_basename): might dump core.
+
+Tue Jun 6 03:29:12 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * dir.c (dir_foreach): now returns nil for consistency.
+
+ * bignum.c (bigdivmod): modulo by small numbers was wrong.
+
+Mon Jun 5 00:18:08 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * bignum.c: avoid conflict with USHORT on mingw32.
+
+Mon Jun 5 00:13:35 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * eval.c (rb_thread_schedule): =/== typo.
+
+Sun Jun 4 03:17:36 2000 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/cgi.rb: improve: CGI::pretty()
+
+Sun Jun 4 02:01:10 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * lib/mkmf.rb: do not need to add -L$(topdir) in --enable-shared case.
+
+Sat Jun 3 13:50:06 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (rb_id2name): should support constant attrset
+ identifiers.
+
+ * bignum.c (rb_big_eq): Bignum#== should not raise exception.
+
+Fri Jun 2 11:24:48 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_popen): open with a block returns the value from the
+ block. old behavior was back.
+
+Fri Jun 2 00:42:31 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+
+ * eval.c (rb_thread_cleanup): should clear priority for thread
+ termination.
+
+Thu Jun 1 22:39:41 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.20.
+
+ * lib/net/http.rb: wrongly closed the socket twice
+ when no Content-Length: was given.
+
+Thu Jun 1 00:59:15 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_yield_0): convert Qundef to [].
+
+Wed May 31 20:45:59 2000 Dave Thomas <Dave@Thomases.com>
+
+ * string.c (rb_str_slice_bang): wrong argument number.
+
+Wed May 31 12:37:04 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_exec_end_proc): print error message from END procs.
+
+Wed May 31 04:06:41 2000 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/cgi.rb: change: CGI#out() if "HEAD" == REQUEST_METHOD then
+ output only HTTP header.
+
+Wed May 31 01:54:21 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_schedule): set main_thread->status to
+ THREAD_TO_KILL, before raising deadlock error.
+
+ * eval.c (rb_thread_deadlock): if curr_thread == main_thread, do
+ not call rb_thread_restore_context()
+
+Tue May 30 23:33:41 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * lib/mkmf.rb (create_makefile): add $(TARGET).ilk and *.pdb
+ to cleanup files for mswin32.
+
+Mon May 29 10:41:10 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * file.c (rb_file_s_basename): should propagate taintness.
+
+Sun May 28 21:37:13 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * eval.c: bug fix: DLEXT2.
+
+Sun May 28 19:21:43 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * win32/win32.c: use ruby's glob.
+
+ * dir.c: "glob" exported and renamed to "rb_glob".
+
+ * ruby.h: ditto.
+
+ * main.c: turn off command line mingw32's globbing.
+
+Wed May 25 22:25:13 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ext/extmk.rb.in: use "ftools" instead of "rm -f".
+
+ * lib/mkmf.rb: ditto.
+
+Thu May 25 22:01:32 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * defines.h: mswin32: remove obsolete USHORT definition.
+
+ * re.h: mswin32: use EXTERN instead of extern.
+
+ * regex.h: mswin32: export re_mbctab properly.
+
+ * win32/ruby.def: add ruby_ignorecase and regex.c's exports.
+
+Thu May 25 21:28:44 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * re.c (rb_reg_expr_str): escape un-printable character.
+
+Thu May 25 01:35:15 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (tokadd_escape): forgot to add `\x' to hexadecimal
+ escape sequences.
+
+ * object.c (rb_obj_dup): dup for normal object (T_OBJECT) copies
+ instance variables only.
+
+Wed May 24 23:49:47 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * object.c (rb_mod_initialize): should provide initialize.
+
+Wed May 24 23:17:50 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * win32/Makefile: remove unnecessary mv and rm command call.
+
+Wed May 24 21:01:04 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * ext/pty/pty.c: use "" instead of <> to include ruby.h and rubyio.h
+ for BeOS (PowerPC).
+
+ * file.c (rb_find_file): should check dln_find_file() result.
+
+ * win32/ruby.def: add rb_block_given_p.
+
+Wed May 24 16:32:45 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_popen): popen does not take 3rd argument anymore.
+
+ * re.c (rb_reg_desc): re may be zero, check before dereferencing.
+
+Wed May 24 16:03:06 2000 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/cgi.rb: bug fix: CGI::escape(), CGI::Cookie::new()
+
+ * lib/net/telnet.rb: improve: binmode(), telnetmode() interface
+
+Wed May 24 13:12:31 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * misc/ruby-mode.el (ruby-parse-region): support `while .. do'
+ etc. But corresponding keywords must be at the beginning of
+ line.
+
+Tue May 23 23:50:12 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (rb_reg_initialize_m): wrong kcode value.
+
+ * re.c (rb_reg_s_new): forgot to initialize re->ptr.
+
+Tue May 23 08:36:24 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_pattern): forgot to restore old option
+ status by (?ix-ix).
+
+ * regex.c (re_compile_fastmap): anychar may match newline if
+ RE_OPTION_MULTILINE or RE_OPTION_POSIXLINE is set.
+
+Mon May 22 22:45:06 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.19.
+
+ * lib/net/http.rb: do not use Regexp "p" option.
+
+Mon May 22 21:56:43 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * struct.c (rb_struct_getmember): should use ID2SYM, not INT2NUM.
+
+Mon May 22 15:07:37 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * file.c (rb_find_file): should check if the file really exists.
+
+Mon May 22 09:08:12 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_popen): _exit(0) after processing block under the
+ child process.
+
+ * io.c (rb_io_popen): flush stdout/stderr before subprocess
+ termination.
+
+ * eval.c (rb_check_safe_str): insert rb_secure(4); operation
+ requires untainted string should be prohibited in level 4.
+
+Sun May 21 21:17:00 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * configure.in: add Setup.dj for djgpp cross-compiling.
+
+ * Setup.dj: add readline.
+
+ * instruby.rb: copy win32/win32.h to archlibdir on mingw32.
+
+Sun May 21 20:58:08 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * pack.c: fix OFF16 and OFF32 definitions for Alpha and IRIX64.
+
+Sun May 21 17:31:37 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * instruby.rb: support "make install" for cross-compiling.
+
+ * ext/extmk.rb.in: ditto.
+
+Sun May 21 14:22:49 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * Makefile.in: rename prep.rb to fake.rb.
+
+ * configure.in: ditto.
+
+Sat May 20 23:29:14 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * dir.c (dir_s_new): does not take block; "open" does.
+
+ * io.c (rb_io_s_new): ditto.
+
+Fri May 19 07:44:26 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * dir.c (dir_s_open): Dir#open does not returns closed Dir if a
+ block is given to the method.
+
+ * re.c (rb_reg_initialize_m): Regexp::new calls initialize now.
+
+ * string.c (Init_String): String#delete_at removed.
+
+ * string.c (rb_str_aset_m): should have checked argc != 2.
+
+ * eval.c (rb_thread_schedule): select(2) was called too many.
+
+ * regex.c (re_compile_pattern): a bug in (?m) support. Pointed
+ out by Dave Thomas <Dave@thomases.com>.
+
+Thu May 18 23:55:26 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * dln.c (search_undef): st_lookup()'s 3rd parameter should be
+ a pointer of the variable which has the same size and alignment
+ as `char *'.
+
+ * marshal.c (w_symbol, w_object): ditto.
+
+ * parse.y (rb_intern): ditto.
+
+Thu May 18 18:00:35 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.18.
+
+ * lib/net/protocol.rb: Net::Version was removed.
+
+ * lib/net/smtp.rb: use Socket.gethostname to get local host name.
+
+Thu May 18 13:34:57 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/socket/socket.c (ruby_connect): should not have replaced
+ thread_write_select() by rb_thread_fd_writable().
+
+Thu May 18 09:01:25 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * configure.in, ext/extmk.rb.in, lib/mkmf.rb: remove BeOS R3 support.
+ Make a shared library (libruby.so) only if the --enable-shared
+ option is specified.
+
+ * instruby.rb: no longer use libruby.so.LIB and import.h.
+
+ * io.c: fix READ_DATA_PENDING definition for BeOS (PowerPC).
+
+Wed May 17 14:14:23 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (rb_reg_new_1): use /m instead of /p.
+
+Wed May 17 02:22:03 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_polling): wait 0.06 second to let other
+ processes run.
+
+ * process.c (rb_waitpid): avoid busy wait using rb_thread_polling.
+
+ * file.c (rb_thread_flock): ditto.
+
+ * parse.y (expr): avoid calling value_expr() twice.
+
+Wed May 17 00:45:57 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * io.c (rb_io_binmode): should check PLATFORMs, not O_BINARY, sigh...
+
+Wed May 17 00:40:15 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * win32/config.h: add DLEXT2, now DLEXT on mswin32 is "so".
+
+ * win32/config.status: ditto.
+
+ * win32/ruby.def: add symbol "rb_big_divmod".
+
+Tue May 16 19:45:32 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * intern.h: use EXTERN instead of extern.
+
+ * win32/ruby.def: add rb_defout, rb_stdout, ruby_errinfo,
+ ruby_sourceline, ruby_sourcefile to work with eruby
+ reported by Hiroshi Saito <HiroshiSaito@pob.org>.
+ Export both ruby_xmalloc and xmalloc etc.
+
+Tue May 16 17:00:05 2000 Masaki Fukushima <fukusima@goto.info.waseda.ac.jp>
+
+ * eval.c (rb_thread_select): should check whether fds are null.
+
+Tue May 16 11:51:31 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (pipe_open): synchronize subprocess stdout/stderr.
+
+Mon May 15 15:38:09 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.h: exported symbols should be for xmalloc etc. are now
+ prefixed by 'ruby_', e.g. ruby_xmalloc().
+
+ * eval.c (rb_thread_select): remove busy wait for select.
+
+ * dir.c (glob): trailing path may be null, e.g. glob("**").
+
+Mon May 15 14:48:41 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * io.c (rb_io_pid): new method; returns nil if no process attached
+ to the IO.
+
+Mon May 15 01:18:20 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_s_popen): _exit after Proc execution.
+
+Sun May 14 18:05:59 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * Makefile.in: missing/nt.c -> win32/win32.c
+
+ * configure.in: bug fix; static linking on mingw32.
+
+ * cygwin/GNUmakefile.in: remove VPATH.
+
+ * ext/extmk.rb.in: Makefile set binmode with mingw32 on cygwin32.
+
+ * lib/mkmf.rb: ditto.
+
+ * win32/config.h: undef HAVE_SYS_FILE_H.
+
+Sun May 14 02:02:48 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * lib/irb/ruby-lex.rb: '/' should be escaped in character class.
+
+Sun May 14 00:54:43 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * configure.in, ...: support mingw32.
+
+ * defines.h: ditto. undef EXTERN for tcl/tk on cygwin.
+
+ * ext/*/extconf.rb: replace PLATFORM with RUBY_PLATFORM.
+
+ * ext/socket/sockport.h: define IN_MULTICAST for missing IN_MULTICAST.
+
+ * ext/tcltklib/tcltklib.c: remove declaration of rb_argv0.
+
+ * file.c: should check S_IXGRP, S_ISGID, not NT.
+
+ * io.c (rb_io_binmode): should check _IOBIN, O_BINARY, not PLATFORMs.
+
+Sat May 13 14:21:15 2000 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * io.c (rb_io_s_popen): should check whether a block is given.
+
+Fri May 12 17:33:44 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_pattern): charset_not should not exclude
+ newline from matching set.
+
+Thu May 11 22:51:05 2000 Ryunosuke Ohshima <ryu@jaist.ac.jp>
+
+ * pack.c (pack_pack): Bignum support.
+
+ * pack.c (pack_unpack): ditto.
+
+Thu May 11 21:19:29 2000 Hiroshi Igarashi <iga@ruby-lang.org>
+
+ * intern.h: add missing declarations of ruby API functions.
+
+ * ruby.h: fix function name in declarations.
+
+Thu May 11 22:29:25 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * ext/md5/depend: add $(topdir)/config.h dependency to md5c.o.
+
+ * ext/md5/extconf.rb: new file to add -DHAVE_CONFIG_H flag for Alpha.
+
+Thu May 11 10:55:52 2000 Ryunosuke Ohshima <ryu@jaist.ac.jp>
+
+ * pack.c (pack_pack): packing BER compressed integer by `w'.
+
+ * pack.c (pack_unpack): unpacking BER.
+
+Thu May 11 00:37:55 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (parse_regx): remove in_brack.
+
+Wed May 10 12:51:18 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c (proc_options): move adding RUBYLIB and "." to the load
+ path after #! line parsing.
+
+ * parse.y (parse_regx): should parse backslash escape like `\c['
+ here to avoid causing `unterminated regexp' error.
+
+Wed May 10 00:19:53 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * MANIFEST, beos/GNUmakefile.in, configure.in: no longer need
+ beos/GNUmakefile.in to support BeOS R4.5.2 (Intel) as a result
+ of eban's Makefile.in change.
+
+ * io.c: NOFILE is already defined on BeOS R4.5 (Intel) or later.
+
+ * lib/matrix.rb: remove debug print.
+
+ * regex.c: don't use nested comment.
+
+Tue May 9 17:08:43 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (massign): no longer convert nil into empty array.
+
+ * io.c (rb_io_s_popen): optional 3rd argument to give proc, which
+ will be executed in spawned child process.
+
+Mon May 8 23:47:39 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * eval.c (rb_callcc): prev & next should be initialized to zero.
+
+Mon May 8 23:17:36 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * dln.c (dln_init): remove possible buffer overrun. This is
+ suggested by Aleksi Niemela <aleksi.niemela@cinnober.com>.
+
+ * dln.c (init_funcname): ditto.
+
+Sat May 6 23:35:47 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (lhs): should allow `obj.Attr = 5' type expression.
+
+Sat May 6 15:46:08 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ext/socket/extconf.rb: add a new configure option to force use
+ of the WIDE Project's getaddrinfo(): --enbale-wide-getaddrinfo.
+
+Fri May 5 21:19:22 2000 MOROHOSHI Akihiko <moro@remus.dti.ne.jp>
+
+ * parse.y (yylex): allow '$1foo' and such.
+
+Fri May 5 17:57:24 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.17.
+
+ * lib/net/http.rb: write also port number in Host: field.
+
+ * lib/net/http.rb: see Proxy-Connection: to decide socket connection.
+
+Fri May 5 03:25:15 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_fastmap): charset_not for multibyte
+ characters excluded too many characters.
+
+Tue May 2 13:23:43 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_schedule): little bit more impartial context
+ switching.
+
+Tue May 2 09:50:03 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * configure.in: add DLDLIBS to set platform specific library
+ for extensions.
+
+ * ext/extmk.rb.in: use @DLDLIBS@ instead of RUBY_PLATFORM choice.
+
+ * lib/mkmf.rb: use CONFIG["DLDLIBS"] instead of RUBY_PLATFORM choice.
+
+ * config_s.dj: add @DLDLIBS@.
+
+ * win32/config.status: ditto.
+
+ * win32/ruby.def: regular maintenance.
+
+Mon May 1 23:42:44 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * configure.in, eval.c: add DLEXT2. now DLEXT on Cygwin is "so".
+
+ * defines.h: use dllimport, dllexport for Cygwin 1.1.x.
+
+ * ruby.h: ditto.
+
+ * cygwin/GNUmakefile.in: ditto.
+
+ * ext/Win32API/Win32API.c: directly "call" in asm statement for
+ gcc 2.95.x or newer.
+
+Sat Apr 29 04:58:12 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * array.c (rb_ary_unshift_m): performance improvement.
+
+Fri Apr 28 00:19:22 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * array.c (rb_ary_unshift_m): takes items to push.
+
+Wed Apr 26 15:23:02 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_succ): insert carrying character just before
+ the leftmost alpha numeric character.
+
+ * string.c (rb_str_succ): proper behavior for "".succ and "\377".succ.
+
+ * string.c (rb_str_succ): use realloc and memmove.
+
+Tue Apr 25 18:28:45 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.16.
+
+ * lib/net/smtp.rb: add SMTP AUTH
+
+Tue Apr 25 14:30:13 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_gets_internal): shortcut when rs == rb_default_rs.
+
+Sat Apr 22 23:14:41 2000 SHIROYAMA Takayuki <psi@fortune.nest.or.jp>
+
+ * configure.in: MacOS X support.
+
+Sat Apr 22 16:37:10 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.15.
+
+ * lib/net/http.rb: closing socket by watching both
+ user header and server response
+
+Fri Apr 21 21:44:34 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * io.c (rb_io_s_pipe): should set FMODE_SYNC.
+
+Thu Apr 20 16:59:22 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (massign): `*lvalue = false' should assign `[false]' to
+ lvalue.
+
+Wed Apr 19 08:35:08 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * class.c (rb_singleton_class): generate singleton class for
+ special constants: nil, true, false.
+
+Wed Apr 19 02:09:30 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * class.c (rb_singleton_class): singleton method for nil, true,
+ false is possible now.
+
+ * eval.c (rb_eval): ditto.
+
+Tue Apr 18 18:54:25 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.14.
+
+ * lib/net/http.rb: new method HTTP#head2.
+
+ * lib/net/http.rb: get2/post2 does not raise exceptions.
+
+Mon Apr 17 15:16:31 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_close): to detect some exceptional status, writable
+ IO should be flushed before close;
+
+Sat Apr 15 18:29:00 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (rb_ary_collect_bang): Array#filter renamed.
+
+Fri Apr 14 19:47:11 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.13.
+
+ * lib/net/pop.rb: accept illegal timestamp
+
+ * lib/net/http.rb: when body was chunked, does not set Content-Length:
+
+Tue Apr 11 21:14:42 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * config_s.dj: add @sitedir@.
+ * configure.in: add --with-sitedir=DIR option.
+ * instruby.rb: use CONFIG["sitedir"].
+ * lib/mkmf.rb: support 'make site-install'.
+ * win32/config.status: add @sitedir@.
+
+Tue Apr 11 16:25:15 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * bignum.c (rb_big_2comp): unnecessary lvalue cast removed.
+
+Tue Apr 11 02:25:53 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * hash.c (env_fetch): new method.
+
+ * marshal.c (marshal_dump): accepts depth = nil for unlimited depth.
+
+Sun Apr 9 20:49:19 2000 Dave Thomas <Dave@Thomases.com>
+
+ * parse.y (str_extend): Allow class variables to be expanded.
+
+Fri Apr 7 02:03:54 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * error.c (rb_sys_fail): escape non-printable characters.
+
+Thu Apr 6 20:10:47 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * ext/extmk.rb.in (create_makefile): BeOS --program-suffix support.
+ * lib/mkmf.rb (create_makefile): ditto.
+
+Thu Apr 6 09:55:26 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * error.c (rb_sys_fail): need rb_exc_new2() call on BeOS.
+
+Mon Apr 3 17:22:27 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_reopen): support tempfile.
+
+ * eval.c (catch_i): should supply argument.
+
+Sat Apr 1 22:50:28 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * marshal.c (r_object): wrong symbol restoration.
+
+Sat Apr 1 21:30:53 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * io.c (rb_io_printf, rb_f_printf): should use rb_io_write.
+
+Sat Apr 1 00:16:05 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * gc.c (rb_gc_call_finalizer_at_exit): should be clear flags
+ before calling finalizers.
+
+ * eval.c (specific_eval): can be called without SecurityError, if
+ $SAFE >= 4.
+
+ * object.c (sym_inspect): inspect gives ":sym", to_s gives "sym".
+
+Fri Mar 31 22:07:04 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.12.
+
+ * lib/net/protocol.rb: update Net::Protocol::Proxy#connect
+
+ * lib/net/protocol.rb: ReplyCode is not a class
+
+ * lib/net/http.rb: header value format was change:
+ values do not include header name
+
+ * lib/net/http.rb: header is not a Hash, but HTTPResponse
+
+Thu Mar 30 12:19:44 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * enum.c (enum_find): rb_eval_cmd() should be called with array.
+
+Tue Mar 28 13:57:05 2000 Clemens Hintze <c.hintze@gmx.net>
+
+ * ext/dbm/dbm.c (fdbm_invert): should return new hash.
+
+ * ext/gdbm/gdbm.c (fgdbm_invert): ditto.
+
+Tue Mar 28 00:58:03 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.11.
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: does not
+ dispatch any commands while dispatching command.
+
+ * lib/net/protocol.rb: failed to get error class of
+ inherited ReplyCode
+
+ * lib/net/http.rb: change feature of "get2", "post2"
+
+Mon Mar 27 01:34:58 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.10.
+
+ * lib/net/http.rb: return value of 'head' was wrong.
+
+Sun Mar 26 17:47:35 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.9.
+
+ * lib/net/smtp.rb: SMTP#do_ready wrongly took no arguments
+
+Sat Mar 25 23:21:10 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * marshal.c (w_object): symbols should be converted to ID before
+ dumping out.
+
+Fri Mar 24 18:26:51 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * file.c (test_check): should have checked exact number of arguments.
+
+Fri Mar 24 21:02:11 2000 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * signal.c (trap): should treat some symbols as the signal.
+
+Fri Mar 24 06:58:03 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.8.
+
+ * lib/net/http.rb: post, get2, post2, get_body
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: separate
+ Command/Socket documentation.
+
+Thu Mar 23 02:26:14 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_fptr_finalize): fptr may be null.
+
+ * io.c (rb_io_s_new): now calls `initialize'.
+
+ * io.c (rb_io_initialize): actual open done in this method.
+
+ * io.c (rb_file_initialize): ditto.
+
+ * eval.c (rb_eval): class variables in singleton class definition
+ is now handled properly (I hope).
+
+Wed Mar 22 21:49:36 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * st.c (st_delete_safe): skip already deleted entry.
+
+ * hash.c (rb_hash_delete): modify brace miss.
+
+Wed Mar 22 08:53:58 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (exec_under): do not push cbase if ruby_cbase == under.
+
+ * node.h (NEW_CREF0): preserve cbase nesting.
+
+Tue Mar 21 12:57:50 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * object.c (rb_class_s_new): Class::new should call `inherited'.
+
+Sat Mar 18 12:36:09 2000 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (rb_backtrace, make_backtrace): removed unused variable
+ `lev'.
+
+ * eval.c (rb_attr): calls `method_added' at attribute definition.
+
+ * eval.c (rb_mod_modfunc): calls `singleton_method_added' while
+ `module_function'.
+
+ * eval.c (rb_eval): parameter to `method_added' and
+ `singleton_method_added' is Symbol.
+
+ * eval.c (Init_eval): caches IDs for `method_added' and
+ `singleton_method_added'.
+
+Sat Mar 18 11:25:10 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (rescue): allows `rescue Error in foo'. experimental.
+ which is better this or preparing alias `exception' for `$!'?
+
+Fri Mar 17 15:02:45 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * variable.c (rb_autoload_id): defining new autoload should be
+ prohibited for $SAFE > 4.
+
+ * variable.c (rb_autoload_load): autoload should be possible for
+ $SAFE > 4.
+
+ * eval.c (call_trace_func): should handle T_ICLASS properly.
+
+Fri Mar 17 14:34:30 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (str_gsub): forgot to initialize str->orig.
+
+Fri Mar 17 01:24:59 2000 Dave Thomas <Dave@thomases.com>
+
+ * string.c (rb_str_clone): forgot to copy str->orig if STR_NO_ORIG
+ is set by Array#pack.
+
+Wed Mar 15 21:25:04 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * array.c (rb_ary_join): 'result' is always duplicated
+ before concat string.
+
+Wed Mar 15 17:26:05 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * hash.c (rb_hash_s_create): unexpected recursive call removed.
+ this bug was found by Satoshi Nojo <nojo@t-samukawa.or.jp>.
+
+Wed Mar 15 13:12:39 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (Init_Thread): Thread.join removed finally.
+
+ * string.c (rb_str_chomp_bang): forgot to call rb_str_modify().
+
+Mon Mar 13 16:12:13 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (block_pass): distinguish real orphan block and still
+ on-stack block passed by block argument.
+
+Mon Mar 13 00:20:25 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (f_norm_arg): proper error message when constant comes
+ in formal argument list. this message is suggested by Muvaw
+ Pnazte <bugathlon@yahoo.com>.
+
+ * eval.c (rb_f_raise): proper error message when the first
+ argument is not an exception class/object.
+
+ * string.c (rb_str_dup): dup now postpone buffer copy as long as
+ possible. performance improved by lazy copying.
+
+Sun Mar 12 13:58:52 2000 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * signal.c (rb_f_kill): should treat some symbols as the signal.
+
+Sat Mar 11 22:03:03 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_gsub): performance tune by avoiding buffer copy.
+
+ * eval.c (rb_f_missing): check if argv[0] is ID.
+
+Sat Mar 11 15:49:41 2000 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * struct.c (rb_struct_aref): struct aref by symbol.
+
+Sat Mar 11 05:07:11 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * process.c (proc_setpriority): should return 0, not nil.
+
+ * process.c (proc_setpgid): ditto.
+
+Fri Mar 10 18:14:54 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * file.c (path_check_1): confusing buf and path. this bug found
+ by <decoux@moulon.inra.fr>.
+
+Fri Mar 10 09:37:49 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * MANIFEST: add beos/GNUmakefile.in.
+ * configure.in: support BeOS R4.5.2 (Intel).
+ * beos/GNUmakefile.in: new file to support BeOS R4.5.2 (Intel).
+
+Thu Mar 9 11:13:32 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_fastmap): fixed embarrassing brace bug.
+
+Thu Mar 9 01:36:32 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * missing/flock.c: emulate missing flock() with fcntl().
+
+Thu Mar 9 00:29:35 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * object.c (sym_to_s): returns ":sym".
+
+ * object.c (sym_id2name): separated from to_s; returns "sym".
+
+Wed Mar 8 19:16:19 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.7.
+
+ * lib/net/http.rb (connecting): returns header
+
+Wed Mar 8 02:08:43 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y: escape expansion too early.
+
+ * string.c (rb_f_scan): Kernel#scan added.
+
+ * regex.c (re_compile_pattern): support \cX et al.
+
+Tue Mar 7 01:44:27 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (set_stdin): simplified procedure, allows $stdin = DATA;
+ experimental.
+
+ * io.c (set_outfile): ditto.
+
+ * re.c (Init_Regexp): new method Regexp#last_match added; it's an
+ alternative for $~.
+
+ * configure.in (DEFAULT_KCODE): KCODE_NONE should be the default.
+
+ * dir.c (dir_s_rmdir): should return 0 on success.
+
+ * signal.c: remove CWGUSI support.
+
+Mon Mar 6 12:28:37 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * marshal.c (w_symbol): support symbol object.
+
+ * util.c: make symbol as separated class.
+
+ * error.c (Init_Exception): new exception RangeError.
+
+ * ext/socket/socket.c (ip_addrsetup): should check length of hostname.
+
+ * ext/socket/socket.c (ip_addrsetup): check newline at the end of
+ hostname. These fixes suggested by Muvaw Pnazte <bugathlon@yahoo.com>.
+
+Sun Mar 5 20:35:45 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ext/Win32API/Win32API.c (Win32API_initialize): should call
+ LoadLibrary() everytime and should assign the hdll to Win32API
+ object(protect the hdll from GC).
+
+Sun Mar 5 18:49:06 2000 Nakada.Nobuyoshi <nobu.nokada@softhome.net>
+
+ * misc/ruby-mode.el (ruby-parse-region): not treat method `begin'
+ and `end' as reserved words.
+
+ * misc/ruby-mode.el (ruby-font-lock-docs): ignore after `=begin'
+ and `=end'.
+
+ * misc/ruby-mode.el (ruby-font-lock-keywords, hilit-set-mode-patterns):
+ added `yield' to keywords.
+
+ * misc/ruby-mode.el (ruby-font-lock-keywords, hilit-set-mode-patterns):
+ matches keywords at end of buffer.
+
+Sun Mar 5 18:08:53 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.6.
+
+ * lib/net/http.rb: allow to omit 'start'
+
+Tue Feb 29 01:08:26 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * range.c (range_initialize): initialization done in `initialize';
+ `initialize' should not be called more than once.
+
+ * object.c (Init_Object): default `initialize' should take zero
+ argument.
+
+ * time.c (time_s_new): call `initialize' in Time::new.
+
+Sat Feb 26 22:39:31 2000 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * string.c (rb_str_times): fix String#* with huge string.
+
+Sat Feb 26 00:14:59 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * dir.c (dir_s_new): call `initialize' in Dir::new.
+
+Fri Feb 25 23:01:49 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * ruby.h: export ruby_safe_level by EXTERN for mswin32.
+ * win32/ruby.def: regular maintenance.
+
+Fri Feb 25 22:12:46 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_reopen): IO#reopen should accept path as well.
+
+ * string.c (rb_str_s_new): call `initialize' in String::new.
+
+ * hash.c (rb_hash_s_new): call `initialize' in Hash::new.
+
+ * array.c (rb_ary_s_new): call `initialize' in Array::new.
+
+Fri Feb 25 12:50:20 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_start_timer): interval changed to 10ms from 50ms.
+
+Fri Feb 25 06:42:26 2000 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/socket/socket.c (ip_addrsetup): hostp should remain NULL if
+ host is nil.
+
+Thu Feb 24 16:53:47 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_schedule): priority check for sleep expired
+ threads needed.
+
+Wed Feb 23 14:22:32 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (rb_ary_join): forgot to initialize a local variable
+ `taint'.
+
+Tue Feb 22 07:40:55 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (Init_Regexp): renamed to MatchData, old name MatchingData
+ remain as alias.
+
+Tue Feb 22 00:20:21 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.5.
+
+ * lib/net/session.rb: rename to protocol.rb
+
+ * lib/net/protocol.rb: ProtocolSocket -> Net::Socket
+
+ * lib/net/protocol.rb: Net::Socket#write, write_pendstr
+ can take block
+
+ * lib/net/smtp.rb: new methods SMTP#ready SMTPCommand#write_mail
+
+ * lib/net/pop.rb: POPMail#pop can take block
+
+Sat Feb 19 23:58:51 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_match): pop_loop should not pop at forward jump.
+
+Fri Feb 18 17:15:40 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (method_clone): method objects are now clonable.
+
+Fri Feb 18 00:27:34 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * variable.c (rb_shared_variable_declare): shared variable (aka
+ class/module variable) introduced. prefix `@@'. experimental.
+
+ * class.c (rb_scan_args): new format char '&'.
+
+Thu Feb 17 19:09:05 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * win32/win32.c (mypopen): don't close handle if it is not assigned.
+ * win32/win32.c (my_open_osfhandle): support O_NOINHERIT flag.
+ * win32/win32.c (win32_getcwd): rename getcwd to win32_getcwd
+ in order to avoid using the C/C++ runtime DLL's getcwd.
+ Use CharNext() to process directory name.
+ * win32/win32.h: map getcwd to win32_getcwd.
+
+Wed Feb 16 00:32:49 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (method_arity): nd_rest is -1 for no rest argument.
+
+ * process.c (proc_waitpid): returns nil when waitpid(2) returns 0.
+
+Tue Feb 15 01:47:00 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * process.c (rb_f_waitpid): pid_t should be signed.
+
+Mon Feb 14 13:59:01 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (yylex): yylex yields wrong tokens for `:foo=~expr'.
+
+ * ruby.c (load_file): exit if reading file is empty.
+
+Mon Feb 14 03:34:52 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (yylex): `foo.bar=1' should be <foo><.><bar><=><1>,
+ not <foo><.><bar=><1>.
+
+ * eval.c (rb_thread_restore_context): process according to
+ RESTORE_* is moved after longjmp().
+
+ * eval.c (thread_switch): new function to process RESTORE_*.
+
+Sun Feb 13 16:19:49 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ruby.c (require_libraries): don't access freed memory.
+
+ * ruby.c (add_modules): ditto.
+
+Fri Feb 11 12:06:22 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (parse_quotedwords): %w() need to split not only by mere
+ spaces, but by all whitespaces.
+
+Thu Feb 10 02:12:04 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_index_m): did not support negative offset.
+
+Wed Feb 9 21:54:26 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * ext/socket/getaddrinfo.c: gcc --traditional support.
+ Rearrange headers to work AC_C_CONST.
+ * ext/socket/getnameinfo.c: ditto.
+ * ext/socket/socket.c: mswin32: use double instead of long long.
+
+Wed Feb 9 16:30:41 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * numeric.c (num_coerce): should return [y, x].
+
+Wed Feb 9 11:07:30 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c (ruby_prog_init): loadpath structure changed.
+
+Tue Feb 8 02:07:33 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_search): optimize for \G at top.
+
+ * regex.c (re_compile_pattern): \G introduced.
+
+ * regex.c (re_match): ditto.
+
+ * string.c (str_sub_bang): old behavior restored: bang method
+ returns nil if string not changed.
+
+ * regex.c (re_compile_pattern): support independent subexpression
+ `(?>pattern)'.
+
+ * regex.c (re_match): ditto.
+
+Mon Feb 7 15:51:08 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_match): now understands interrupts under Ruby.
+
+Mon Feb 7 07:51:52 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (rb_ary_uniq_bang): always return an Array.
+
+ * array.c (rb_ary_compact_bang): ditto.
+
+ * array.c (rb_ary_flatten_bang): ditto.
+
+ * hash.c (rb_hash_reject): returns a Hash, not an Array.
+
+ * hash.c (env_reject): ditto.
+
+Fri Feb 4 10:20:25 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (scan_once): scan now leaves information about the last
+ successful pattern match in $&.
+
+ * io.c (rb_io_close): should not check closed IO.
+
+Fri Feb 4 05:44:01 2000 Kentaro Inagaki <inagaki@tg.rim.or.jp>
+
+ * ext/socket/socket.c (s_recv): TRAP_BEG after retry entry.
+
+Wed Feb 2 22:33:45 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (rb_thread_start): receives argument from outside, like
+ `Thread::start(1,2,3){|a,b,c| ... }'.
+
+Wed Feb 2 22:14:40 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (rb_reg_regsub): should check regs->num_regs.
+
+ * re.c (rb_reg_search): remove matchcache, use static struct
+ re_register instead.
+
+ * re.c (match_getter): avoid cloning match data.
+
+Wed Feb 2 17:12:15 2000 Dave Thomas <Dave@Thomases.com>
+
+ * samples/eval.rb: Rescue new ScriptError exception
+
+Wed Feb 2 02:06:07 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (str_gsub_bang): gsub! now leaves information about the
+ last successful pattern match in $&.
+
+Mon Jan 31 15:24:58 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (str_sub_bang): bang method returns string always.
+ experimental.
+
+Sun Jan 30 17:58:09 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * eval.c: arrange to use setitimer(2) for BOW, DJGPP
+
+ * defines.h: ditto. use random(3) on cygwin b20.1.
+
+Sun Jan 30 17:20:16 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * eval.c: use getrlimit(2) on DJGPP.
+
+Thu Jan 27 01:27:10 2000 GOTO Kentaro <gotoken@math.sci.hokudai.ac.jp>
+
+ * dir.c (glob): glob pattern "/*" did not match.
+
+Wed Jan 26 22:30:47 2000 Shigeo Kobayashi <shigeo@tinyforest.gr.jp>
+
+ * numeric.c (flo_modulo): wrong result for negative modulo.
+
+Wed Jan 26 02:01:57 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * file.c (test_c): should use S_ISCHR.
+
+ * file.c (rb_stat_c): ditto.
+
+ * string.c (rb_str_each_line): should propagate tainting.
+
+Tue Jan 25 04:01:34 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * object.c (rb_obj_freeze): all objects made freezable.
+
+Tue Jan 25 00:37:01 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * configure.in: use AC_CHECK_TOOL for cross compiling.
+
+Mon Jan 24 19:01:54 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * array.c (rb_protect_inspect): should be checked by id of
+ objects; not by object themselves.
+
+Mon Jan 24 18:48:08 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * eval.c (rb_eval): too many warnings; warned on every method
+ overriding. should be on method discarding.
+
+Mon Jan 24 02:56:44 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (yylex): -2.abs should be `(-2).abs' to accomplish the
+ principle of less surprise. `+2' too.
+
+ * eval.c (rb_eval): when defining class is already there, and
+ superclass differ, throw away the old class.
+
+ * variable.c (rb_const_set): gives warning again on constant
+ redefinition.
+
+ * error.c (Init_Exception): SyntaxError, NameError, LoadError and
+ NotImplementError are subclasses of ScriptError<Exception, not
+ StandardError. experimental.
+
+Sat Jan 22 00:00:41 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (parse_quotedwords): no longer use `String#split'.
+ and enable space escape within quoted word list.
+ e.g. %w(a\ b\ c abc) => ["a b c", "abc"].
+
+ * string.c (rb_str_slice_bang): new method `slice!'.
+
+Fri Jan 21 21:56:08 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/session.rb, smtp.rb, pop.rb, http.rb: 1.1.4.
+
+ * lib/net/http.rb: can receive messages which have
+ no Content-Length:.
+
+Fri Jan 21 16:15:59 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (thgroup_s_new): new class ThreadGroup.
+
+Tue Jan 18 12:24:28 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * struct.c (Init_Struct): remove Struct's own hash and eql?.
+
+Sat Jan 15 22:21:08 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * eval.c (search_method): argument klass may be 0.
+
+Sat Jan 15 15:03:46 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * enum.c (enum_index): remove this method.
+
+ * enum.c: remove use of pointers to local variables. find,
+ find_all, min, max, index, member?, each_with_index,
+
+ * eval.c (massign): multiple assignment does not use to_a anymore.
+ experimental.
+
+Fri Jan 14 12:22:04 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_replace): use memmove instead of memcpy for
+ overwrapping strings (e.g. a[1] = a).
+
+Thu Jan 13 11:12:40 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (arg_add): use new node, ARGSPUSH.
+
+Mon Jan 10 18:32:28 2000 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * marshal.c (w_object): forgot an argument to call w_ivar().
+
+Sun Jan 9 18:13:51 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * random.c: first was not defined unless HAVE_RANDOM.
+
+Sat Jan 8 19:02:49 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_sysread): raise IOError for buffered IO.
+
+ * ext/socket/socket.c (s_recv): ditto.
+
+Fri Jan 7 00:59:29 2000 Masahiro Tomita <tommy@tmtm.org>
+
+ * io.c (io_fread): TRAP_BEG/TRAP_END added around getc().
+
+Thu Jan 6 00:39:54 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * random.c (rb_f_rand): should be initialized unless srand is
+ called before.
+
+Wed Jan 5 16:59:34 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/session.rb, smtp.rb, pop.rb, http.rb: 1.1.3.
+
+ * lib/net/session.rb: Session -> Protocol, ...
+
+ * lib/net/http.rb: HTTPCommand implementation was changed.
+
+Wed Jan 5 02:14:46 2000 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * parse.y: Fix SEGV on empty parens with UMINUS or UPLUS.
+
+Tue Jan 4 22:25:54 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (stmt): `() while cond' dumped core.
+
+Tue Jan 4 06:04:14 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * configure.in: modify for cross-compiling.
+ use target_* instead of host_*.
+ use AC_CANONICAL_TARGET.
+
+ * Makefile.in: ditto.
+
+ * cygwin/GNUmakefile.in: ditto.
+
+Sat Jan 1 13:26:14 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_yield_0): force_recycle ruby_dyna_vars to gain
+ performance.
+
+ * array.c (rb_ary_delete_at_m): takes same argument pattern with
+ rb_ary_aref.
+
+Sat Jan 1 10:12:26 2000 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ruby.h,util.c (rb_special_const_p): peep hole optimization.
+
+ * ruby.h,util.c (rb_test_false_or_nil): removed.
+
+ * ruby.h (RTEST, SPECIAL_CONST_P): peep hole optimization.
+
+ * ruby.h (FL_ABLE, FL_SET, FL_UNSET, FL_REVERSE): made expressions
+ not statements.
+
+ * ruby.h (OBJ_INFECT): newly added macro which copies taint from
+ `s' to `x'.
+
+Sat Jan 1 02:04:18 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_safe_level): new method.
+
+ * eval.c (rb_yield_0): recycle dyna_var_map to reduce object
+ allocation.
+
+Fri Dec 31 00:52:48 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c: thread independent trace_func not needed.
+
+Thu Dec 30 14:47:31 1999 akira yamada <akira@ruby-lang.org>
+
+ * configure.in: specifies -soname in LIBRUBY_DLDFLAGS on linux
+ platforms.
+
+Thu Dec 30 10:51:27 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c,io.c,hash,c,re.c,string.c: `_m' suffix instead of
+ `_method' for wrapper functions to implement method,
+ e.g. `rb_str_join_m()'.
+
+Thu Dec 30 02:08:02 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * bignum.c (rb_cstr2inum): non-numeric format check added.
+ currently it works only with base == 0 (i.e. Integer()).
+
+ * bignum.c (rb_str2inum): now takes VALUE to 1st argument. null
+ byte check added.
+
+ * array.c (rb_ary_replace): unless replacement is an array,
+ replacement shall be converted to array by `[replacement]', not
+ by `replacement.to_a'.
+
+ * array.c (rb_ary_plus): right operand must be an array.
+
+ * array.c (rb_ary_concat): argument must be an array.
+
+Mon Dec 27 12:35:47 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * ext/socket/socket.c (sock_finalize): mswin32: fix socket handle leak.
+
+ * win32/win32.c (myfdclose): ditto.
+
+Sun Dec 26 23:15:13 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * win32/win32.c (mypopen): raise catchable error instead of rb_fatal.
+ * win32/win32.c (mypclose): fix process handle leak.
+
+Sun Dec 26 16:17:11 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * ext/Win32API/Win32API.c (Win32API_initialize): use UINT2NUM
+ instead of INT2NUM to set __dll__ and __proc__.
+
+Sat Dec 25 00:08:59 1999 KANEKO Naoshi <wbs01621@mail.wbs.ne.jp>
+
+ * ext/Win32API/Win32API.c (Win32API_Call): remove 'dword ptr'
+ from _asm.
+
+Fri Dec 24 10:26:47 1999 Koji Oda <oda@bsd1.qnes.nec.co.jp>
+
+ * win32/win32.h: use "C++" linkage.
+
+Fri Dec 24 02:00:57 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (THREAD_ALLOC): should initialize th->trace.
+
+Fri Dec 24 00:43:39 1999 KANEKO Naoshi <wbs01621@mail.wbs.ne.jp>
+
+ * io.c (pipe_open): check for `fptr->f == NULL'.
+ * win32/win32.c (mypopen): STDERR does not work during ` function.
+
+Wed Dec 22 22:50:40 1999 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/session.rb, smtp.rb, pop.rb, http.rb: 1.1.2.
+
+ * lib/net/http.rb: HTTP support is enhanced a little
+
+ * lib/net/http.rb: support proxy
+
+Tue Dec 21 17:21:28 1999 Koji Oda <oda@bsd1.qnes.nec.co.jp>
+
+ * ext/socket/socket.c (sock_finalize): mswin32: fix FILE* leak.
+
+Tue Dec 21 05:33:56 1999 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/session.rb, smtp.rb, pop.rb, http.rb: 1.1.1.
+
+ * lib/net/http.rb: support HTTP chunk
+
+Mon Dec 20 19:08:12 1999 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * file.c (rb_file_s_expand_path): handle dir separator correctly.
+
+Sun Dec 19 22:56:31 1999 KANEKO Naoshi <wbs01621@mail.wbs.ne.jp>
+
+ * lib/find.rb: support dosish root directory.
+ * win32/Makefile: ditto.
+ * win32/config.status: ditto.
+ * win32/win32.c (opendir): ditto.
+ * win32/win32.c (opendir): use CharPrev() to get last character
+ of the directory name.
+
+Sat Dec 18 03:00:01 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * file.c (path_check_1): check should be done by absolute path.
+
+ * marshal.c (r_ivar): should restore generic_ivar too.
+
+ * marshal.c (w_ivar): should dump generic_ivar too.
+
+Fri Dec 17 22:46:46 1999 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/session.rb, smtp.rb, pop.rb, http.rb: 1.1.0.
+
+ * lib/net/http.rb: test release
+
+ * lib/net/session.rb: support class swapping
+
+ * lib/net/session.rb: Socket#flush_rbuf
+
+ * lib/net/session.rb: doquote -> Net.quote
+
+Fri Dec 17 19:27:43 1999 IWAMURO Motonori <iwa@mmp.fujitsu.co.jp>
+
+ * eval.c (rb_load): should initialize ruby_frame->last_class.
+
+Wed Dec 15 01:35:29 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c (proc_options): option to change directory changed to
+ `-C' like tar.
+
+ * ruby.c (proc_options): argv boundary check for `-X'.
+
+Mon Dec 13 15:15:31 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_adjust_startpos): separate startpos adjustment
+ because of major performance drawback.
+
+ * class.c (rb_singleton_class): tainted status of the singleton
+ class must be synchronized with the object.
+
+ * eval.c (rb_thread_schedule): implement thread priority.
+
+Sat Dec 11 03:34:38 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * gc.c (mark_hashentry): key should be VALUE, not ID.
+
+ * io.c (argf_eof): should check next_p too.
+
+Thu Dec 9 18:09:13 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * error.c (exc_set_backtrace): forgot to declare a VALUE argument.
+
+Thu Dec 9 14:19:31 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * object.c (rb_obj_taint): explicit tainting must be prohibited at
+ level 4 to prevent polluting trusted object by untrusted code.
+
+ * file.c: file operations (stat, lstat, chmod, chown, umask,
+ truncate, flock) are prohibited in level 2 (was level 4).
+
+Wed Dec 8 11:48:23 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_f_require): prohibiting require() in the secure mode
+ cause serious autoloading error.
+
+ * variable.c (rb_obj_instance_variables): don't need to prohibit
+ to get list of instance variable names of untainted objects.
+
+ * variable.c (rb_ivar_get): don't need to prohibit to get instance
+ variables of untainted objects.
+
+ * variable.c (rb_mod_remove_const): should prohibit constant
+ removals too.
+
+Wed Dec 8 09:23:01 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_eval): should try autoloading before defining
+ class/module at the toplevel.
+
+Tue Dec 7 22:15:30 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * configure.in: Modified rb_cv_rshift_sign detect routine and
+ more simple/fast RSHIFT() for hpux-10.x.
+
+Tue Dec 7 11:16:30 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (Init_eval): calculate stack limit from rlimit where
+ getrlimit(2) is available.
+
+Tue Dec 7 09:57:33 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * file.c (rb_file_ftype): should have removed mode_t.
+
+Mon Dec 6 15:55:30 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * numeric.c (fix_rshift): Fix -1 >> 32 returned 0 (should be -1).
+
+ * numeric.c (fix_rshift): Fix 1 >> -1 returned 0 (should be 2).
+
+Mon Dec 6 11:47:23 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * sprintf.c (rb_f_sprintf): formatted string must be tainted if
+ any of parameters is a tainted string.
+
+ * file.c (rb_file_s_expand_path): expanded file path need not to
+ be tainted always.
+
+Sun Dec 5 20:25:29 1999 Katsuhiro Ueno <unnie@blue.sky.or.jp>
+
+ * eval.c (Init_Proc): simple typo.
+
+ * gc.c (add_heap): sizeof(RVALUE*), not sizeof(RVALUE).
+
+Sat Dec 4 01:40:22 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_search): adjust startpos for multibyte match unless
+ the first pattern is forced byte match.
+
+ * bignum.c (rb_big_rand): should not use rand/random where drand48
+ may be available. RANDOM_NUMBER should be provided from outside.
+
+Fri Dec 3 09:54:59 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c (moreswitches): there may be trailing garbage at #!
+ line.
+
+ * eval.c (rb_f_require): should check require 'feature.o' too.
+
+Thu Dec 2 11:58:15 1999 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * eval.c (rb_thread_loading): should maintain loading_tbl.
+
+Thu Dec 2 10:21:43 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_loading_done): wrong parameter to st_delete().
+
+Wed Dec 1 11:24:06 1999 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ruby.c (process_sflag): process -s properly (should not force `--').
+
+Wed Dec 1 09:47:33 1999 Kazunori NISHI <kazunori@swlab.csce.kyushu-u.ac.jp>
+
+ * string.c (rb_str_split_method): should increment end too.
+
+Tue Nov 30 18:00:45 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * marshal.c: MARSHAL_MINOR incremented; format version is 4.2.
+
+ * marshal.c (w_object): distinguish class and module.
+
+ * marshal.c (w_object): save hash's default value.
+
+ * marshal.c (r_object): restore hash's default value.
+
+Tue Nov 30 01:46:18 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (rb_reg_source): generated source string must be tainted if
+ regex is tainted.
+
+ * file.c (rb_file_s_basename): basename should not be tainted
+ unless the original path is tainted.
+
+ * file.c (rb_file_s_dirname): ditto.
+
+Mon Nov 29 20:42:13 1999 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * file.c (stat_new): Struct::Stat -> File::Stat; Stat is no longer
+ a Struct.
+
+Mon Nov 29 15:28:52 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * variable.c (rb_path2class): evaluated value from path should be
+ module or class.
+
+Fri Nov 26 18:12:49 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_exec_end_proc): should remove only end_procs defined
+ within load wrapper.
+
+ * eval.c (rb_load): save and restore ruby_wrapper around loading.
+
+ * eval.c (rb_mark_end_proc): mark end procs registered by END{} or
+ at_exit{}.
+
+ * eval.c (rb_set_end_proc): should not call rb_global_variable()
+ on heap address; it crashed mod_ruby.
+
+Mon Nov 22 14:07:24 1999 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * ruby.c (proc_options): variable e_script should be visited by
+ garbage collector.
+
+Sat Nov 20 10:10:41 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * hash.c (inspect_i): value may be nil, check revised.
+
+Fri Nov 19 18:06:21 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * dir.c (glob): recursive wildcard match by `**' ala zsh.
+
+Fri Nov 19 11:44:26 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * variable.c: was returning void value.
+
+Fri Nov 19 03:57:22 1999 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * file.c: add methods Stat struct class to reduce stat(2).
+
+Thu Nov 18 16:18:27 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * lib/pstore.rb: mutual lock by flock(2).
+
+Thu Nov 18 11:44:13 1999 Masahiro Tomita <tommy@tmtm.org>
+
+ * io.c (read_all): should check bytes too.
+
+Wed Nov 17 02:40:40 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (Init_IO): $defout (alias of $>) added.
+
+Tue Nov 16 09:47:14 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * lib/pstore.rb: add mutual lock using symlink.
+
+Mon Nov 15 16:50:34 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * enum.c (enum_grep): non matching grep returns an empty array, no
+ longer returns nil.
+
+ * enum.c (enum_grep): grep with block returns collection of
+ evaluated values of block over matched elements.
+
+Mon Nov 15 04:50:33 1999 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * re.c (rb_reg_source): should not call rb_reg_expr_str()
+ everytime.
+
+Sat Nov 13 07:34:18 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * variable.c (rb_mod_constants): traverse superclasses to collect
+ constants.
+
+ * eval.c (assign): modified for shared variables.
+
+ * eval.c (rb_eval): search nested scope, then superclasses to
+ assign shared variables within methods.
+
+ * eval.c (rb_eval): remove warnings from constants modification,
+ because they are no longer constants.
+
+ * parse.y (node_assign): modified for shared variables.
+
+ * parse.y (assignable): allow constant assignment in methods;
+ constants should be called `shared variable'.
+
+Fri Nov 12 23:52:19 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * process.c (rb_f_system): argument check for NT, __EMX__, DJGPP.
+
+Wed Nov 10 21:54:11 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * hash.c (rb_any_cmp): Fixed return without value.
+
+Wed Nov 10 17:57:06 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * sprintf.c: incorporate <yasuf@big.or.jp>'s sprintf patch at
+ [ruby-dev:7754].
+
+Wed Nov 10 08:28:53 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_call0): supply class parameter for each invocation.
+
+Tue Nov 9 13:21:04 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * configure.in: AC_MINIX move to before AC_EXEEXT and AC_OBJEXT.
+
+Mon Nov 8 19:52:29 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * configure.in: Renamed AC_CHAR_UNSIGNED to AC_C_CHAR_UNSIGNED.
+
+ * configure.in: Added default to AC_CHECK_SIZEOF().
+
+Mon Nov 8 14:28:18 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (stmt): rescue modifier added to the syntax.
+
+ * keywords: kRESCUE_MOD added.
+
+ * eval.c (rb_f_eval): fake outer scope when eval() called without
+ bindings.
+
+ * eval.c (rb_f_binding): should copy last_class in the outer frame too.
+
+Sun Nov 7 18:31:04 1999 Yasuhiro Fukuma <yasuf@big.or.jp>
+
+ * eval.c (is_defined): last_class may be 0.
+
+Sat Nov 6 19:26:55 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * Makefile.in: Added depend entry make parse.@OBJEXT@ from parse.c
+ for UCB make
+
+Thu Nov 4 17:41:18 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_pattern): \< (wordbeg), \> (wordend) disabled.
+
+Wed Nov 3 08:52:57 1999 Masaki Fukushima <fukusima@goto.info.waseda.ac.jp>
+
+ * io.c (Init_IO): forgot to use INT2FIX() around SEEK_SET, etc.
+
+Wed Nov 3 00:25:20 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_split_method): use mbclen2() to handle kcode
+ option of regexp objects.
+
+Mon Nov 1 14:22:15 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * eval.c (rb_eval): reduce recursive calls to rb_eval()
+ case of ||= and &&= .
+
+Sun Oct 31 13:12:42 1999 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * regex.c (re_compile_pattern): wrong [\W] match.
+
+Fri Oct 29 16:57:30 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/nkf/lib/kconv.rb: new String methods (kconv, tojis, toeuc,
+ tosjis).
+
+ * time.c (time_s_at): now accepts optional second argument to
+ specify micro second.
+
+Thu Oct 28 13:35:40 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_split_method): should be mbchar aware with
+ single char separators.
+
+Wed Oct 27 12:57:21 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * random.c (rb_f_srand): random seed should be unsigned.
+
+Tue Oct 26 23:58:15 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (rb_ary_collect): collect for better performance.
+
+Tue Oct 26 19:20:54 1999 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * marshal.c (r_object): should register class/module objects.
+
+Sat Oct 23 15:59:39 1999 Takaaki Tateishi <ttate@jaist.ac.jp>
+
+ * process.c (rb_f_system): should require at least one argument.
+
+Sat Oct 23 12:42:44 1999 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * enum.c (enum_collect): collect without block will collect
+ elements in enumerable.
+
+Thu Oct 21 16:14:19 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c (moreswitches): function to process string option;
+ the name is stolen from perl (not implementation).
+
+ * ruby.c (proc_options): use RUBYOPT environment variable to
+ retrieve the default options.
+
+ * dir.c (fnmatch): use eban's fnmatch; do not depend on system's
+ fnmatch (which may have portability problem) anymore.
+
+Wed Oct 20 15:14:24 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * marshal.c (marshal_load): should protect the generated object
+ table (arg->data) from GC.
+
+Mon Oct 18 16:15:52 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/nkf/nkf.c (rb_nkf_kconv): output should be NUL terminated.
+
+Mon Oct 18 09:03:01 1999 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/session.rb, smtp.rb, pop.rb: 1.0.3
+
+ * lib/net/pop.rb: new methods POP3Command#uidl, POPMail#uidl.
+
+Sun Oct 17 03:35:33 1999 Masaki Fukushima <fukusima@goto.info.waseda.ac.jp>
+
+ * array.c (rb_ary_pop): forgot some freeze checks.
+
+Sat Oct 16 12:57:53 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * array.c (rb_ary_sort): always returns the copied array.
+
+Fri Oct 15 22:50:41 1999 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * error.c (sys_nerr): on CYGWIN, it is _sys_nerr.
+
+Fri Oct 15 01:32:31 1999 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * io.c (rb_io_ctl) :need to use NUM2ULONG, not NUM2INT.
+
+ * ext/Win32API/Win32API.c (Win32API_Call): need to use NUM2ULONG,
+ not NUM2INT.
+
+Fri Oct 15 00:22:30 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (Init_Regexp): super class of the MatchingData, which was
+ Data, to be Object.
+
+ * eval.c (ruby_run): evaluate required libraries before load &
+ compiling the script.
+
+ * parse.y (lex_getline): retrieve a line from the stream, saving
+ lines in the table in debug mode.
+
+ * eval.c (call_trace_func): treat the case ruby_sourcefile is null.
+
+Thu Oct 14 02:00:10 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (string): compile time string concatenation.
+
+Wed Oct 13 07:28:09 1999 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/session.rb, smtp.rb, pop.rb: 1.0.2
+
+ * lib/net/session.rb: new method Session#set_pipe.
+
+ * lib/net/session.rb, smtp.rb, pop.rb: add RD documentation.
+
+Wed Oct 13 02:17:05 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * array.c (rb_ary_plus): remove recursion.
+
+ * array.c (rb_ary_sort_bang): detect modify attempt.
+
+Wed Oct 13 02:17:05 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (block_pass): should copy block to prevent modifications.
+ tag in the structure should be updated from latest prot_tag.
+
+ * eval.c (proc_s_new): tag in struct BLOCK should not point into
+ unused stack.
+
+ * dir.c (dir_s_glob): iterate over generated matching filenames if
+ the block is given to the method.
+
+ * array.c (rb_ary_at): new methods; at, first, last.
+
+ * hash.c (rb_hash_fetch): raises exception unless the default
+ value is supplied.
+
+ * hash.c (rb_hash_s_create): need not remove nil from value.
+
+ * hash.c (rb_hash_aset): setting value to nil does not remove key
+ anymore.
+
+Tue Oct 12 22:29:04 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (io_read): length may be 0 or negative.
+
+Tue Oct 12 13:26:27 1999 Jun-ichiro itojun Hagino <itojun@itojun.org>
+
+ * signal.c (posix_signal): RETSIGTYPE may be void.
+
+Tue Oct 12 03:28:03 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * array.c (rb_ary_delete_at): allows negative position.
+
+Mon Oct 11 17:42:25 1999 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * parse.y (rb_intern): should generate distinct ID_ATTRSET symbols
+ for the name with multiple `='s at the end.
+
+ * Makefile.in (CPPFLAGS): separate cpp flags from CFLAGS.
+
+Mon Oct 11 07:27:05 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_eval): should not execute the `else' clause on the
+ case the exceptions are handled by the `rescue' clause.
+
+ * signal.c (Init_signal): ignore SIGPIPE by default.
+
+Wed Oct 6 17:13:19 1999 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * ruby.c (addpath): rubylib_mangled_path() modified.
+
+Mon Oct 4 12:42:32 1999 Kazuhiko Izawa <izawa@erec.che.tohoku.ac.jp>
+
+ * pack.c (pack_unpack): % in printf format should be %%.
+
+Mon Oct 4 10:01:40 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * variable.c (rb_obj_instance_variables): should always return
+ array for all object can have instance variables now.
+
+Mon Oct 4 00:08:34 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * pack.c (OFF16): need to adjust pointer address to pack/unpack on
+ 64bit machines.
+
+Sun Oct 3 03:05:59 1999 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * time.c (time_arg): mktime y2k problem.
+
+Sun Sep 26 16:54:45 1999 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * parse.y (here_document): `\r' handling for here documents.
+
+Wed Sep 22 09:20:11 1999 Masahiro Tomita <tommy@tmtm.org>
+
+ * ext/socket/socket.c: SOCKS5 support.
+
+Wed Sep 22 07:33:23 1999 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/session.rb, smtp.rb, pop.rb: 1.0.1
+
+ * lib/net/pop.rb: APOP did not work.
+
+ * lib/net/pop.rb: modify the way to make APOP challenge.
+
+Wed Sep 22 00:35:30 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_include): should return boolean value.
+
+ * regex.c (re_compile_fastmap): wrong comparison with mbc.
+
+ * eval.c (specific_eval): default sourcefile name should be
+ "(eval)" for module_eval etc.
+
+Wed Sep 22 00:06:07 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * win32/Makefile: update rules.
+
+ * io.c (io_fread): should not assign in char, it maybe -1.
+
+Tue Sep 21 23:57:54 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (call_trace_func): should not propagate retval in
+ trace_func.
+
+Mon Sep 20 21:35:39 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * win32/win32.c (myselect): assume non socket files are always
+ readable/writable.
+
+Mon Sep 20 01:08:02 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (io_fread): should not block other threads.
+
+ * io.c (rb_io_synchronized): renamed from rb_io_unbuffered(); do
+ not call setbuf(NULL) anymore.
+
+Sat Sep 18 13:45:43 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * stable version 1.4.2 released.
+
+Fri Sep 17 23:24:17 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * eval.c (rb_f_missing): dumped core if no argument given.
+
+Fri Sep 17 23:21:06 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * win32/win32.c (myselect): translate WSAEINTR, WSAENOTSOCK into
+ UNIX errno constants.
+
+Fri Sep 17 00:52:27 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (arg): assignable() may return 0.
+
+Thu Sep 16 20:46:23 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * eval.c (rb_eval): was doubly evaluating the return expression.
+
+Thu Sep 16 18:40:08 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * stable version 1.4.1 released.
+
+Thu Sep 16 11:33:22 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * string.c (rb_str_match): should return nil.
+
+Wed Sep 15 22:46:37 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (rb_reg_s_quote): should quote `-' too.
+
+Tue Sep 14 15:23:22 1999 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * parse.y (yylex): no need to ignore `\r' here.
+
+ * parse.y (nextc): strip `\r' from text.
+
+ * parse.y (nextc): support `__END__\r\n' type terminator.
+
+Mon Sep 13 10:49:19 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * eval.c (rb_eval): needless RTEST(ruby_verbose) removed.
+
+Mon Sep 13 09:10:11 1999 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/net/session.rb, smtp.rb, pop.rb: 1.0.0
+
+Wed Sep 8 11:37:38 1999 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * time.c (make_time_t): bit more strict comparison.
+
+Tue Sep 7 00:50:56 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * range.c (range_each): use rb_str_upto() for strings.
+
+ * string.c (rb_str_upto): set upper limit by comparing curr <= end.
+
+ * range.c (range_each): should check equality to handle magic
+ increment.
+
+Mon Sep 6 22:43:33 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_eval): break/next/redo available within -n/-p loop.
+
+Fri Sep 3 11:14:31 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * compar.c (cmp_equal): should not raise exception; protect by
+ rb_rescue().
+
+Thu Sep 2 05:23:05 1999 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * file.c (rb_file_s_expand_path): use dirsep, instead of character
+ literal '/'.
+
+ * file.c (rb_file_s_expand_path): reduce multiple dirsep at the top.
+
+Wed Sep 1 00:28:27 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_call): call rb_undefined() if a method appears not to
+ be exist explicitly from cache.
+
+ * eval.c (rb_method_boundp): check method cache before calling
+ rb_get_method_body().
+
+ * eval.c (rb_get_method_body): store method non-existence
+ information in the cache.
+
+ * random.c (rb_f_srand): use getpid(2) to generate seed.
+
+ * regex.c (re_match): do not apply partial mbc match for
+ charset_not.
+
+ * regex.c (re_compile_pattern): put extended literal prefix (0xff)
+ only before numeric literals, not before all >0x80 char.
+
+ * regex.c (re_compile_pattern): put numeric literal in extended
+ charset region, not normal charset bits.
+
+ * regex.c (re_compile_fastmap): calculate fastmap for charset and
+ charset_not to treat numeric literal (e.g. \246) specially.
+
+Fri Aug 28 17:32:55 1999 Yasuhiro Fukuma <yasuf@big.or.jp>
+
+ * eval.c (rb_eval): should set return value (nil) explicitly if a
+ value is omitted for return statement.
+
+Sun Aug 26 20:26:40 2001 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * ext/readline/readline.c: restore terminal mode
+ even if readline() interrupted.
+
+ * ext/readline/readline.c: returned string need to
+ be tainted.
+
+ * ext/readline/readline.c: fixed memory leak.
+
+ * ext/readline/readline.c: allow negative index.
+
+ * ext/readline/readline.c: added Readline::HISTORY.size
+ same as Readline::HISTORY.length
+
+ * ext/readline/readline.c: allow conditional parsing
+ of the ~/.inputrc file by `$if Ruby'.
+
+ * ext/readline/extconf.rb: check whether the
+ libreadline has the variable `rl_completion_append_character'
+ (this feature was implemented from GNU readline 2.1).
+
+Thu Aug 26 15:06:11 1999 Masaki Fukushima <fukusima@goto.info.waseda.ac.jp>
+
+ * gc.c (rb_gc): local variables may be placed beyond stack_end, so
+ use an address from alloca(1) on non C_ALLOCA platforms.
+
+Thu Aug 26 01:24:17 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * sprintf.c (rb_f_sprintf): "%%" is legal, but "%3.14%" is not.
+
+Mon Aug 23 00:00:54 1999 Tsukada Takuya <tsukada@fminn.nagano.nagano.jp>
+
+ * regex.c (re_compile_fastmap): wrong macro caused memory leak.
+
+Sat Aug 21 11:30:51 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (ADJ): should not adjust addresses to data on heap.
+
+Fri Aug 20 20:50:58 1999 Kenji Nagasawa <kenn@hma.att.ne.jp>
+
+ * defines.h (PATH_SEP): path separator is ";" for OS/2.
+
+Thu Aug 19 10:50:43 1999 WATANABE Tetsuya <tetsu@jpn.hp.com>
+
+ * gc.c (rb_gc): add volatile to avoid GCC optimize bug(?).
+
+Wed Aug 18 23:48:10 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * due to disk trouble, some change records were lost. several
+ modification made to eval.c, gc.c, io.c, pack.c,
+ ext/extmk.rb.in, and lib/mkmf.rb.
+
+Fri Aug 13 15:41:39 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * stable version 1.4.0 released.
+
+Fri Aug 13 03:16:07 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (argf_forward): since $stdout may be non-IO, ARGF.file is
+ not guaranteed to be IO. check and forwarding added to every ARGF
+ method.
+
+ * io.c (set_outfile): $stdout/$stderr may not be IO now.
+
+ * io.c (set_stdin): $stdin may not be IO now.
+
+ * range.c (rb_range_beg_len): round `end' to length as documented.
+
+ * io.c (Init_IO): preserve original stdin/stdout/stderr.
+
+Thu Aug 12 13:44:33 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (Init_load): require receives 1 argument.
+
+ * eval.c (frame_dup): should clear tmp to avoid dangling
+ references.
+
+Wed Aug 11 13:33:13 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * eval.c (rb_eval): no automatic aggregate initialization.
+
+ * eval.c (module_setup): ditto.
+
+Wed Aug 11 18:18:41 1999 WATANABE Tetsuya <tetsu@jpn.hp.com>
+
+ * eval.c (yield_under_i): automatic aggregate initialization is an
+ ANSI feature.
+
+Wed Aug 11 10:10:02 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (yylex): parse `[].length==0' as `([].length)==0', not
+ `([].length=)=0'
+
+ * parse.y (yylex): parse `[].length!=0' as `([].length)!=0', not
+ `([].length!)=0'
+
+ * parse.y (peek): peek-in lexical buffer.
+
+Wed Aug 11 00:34:05 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_match): bug on backward jump adjustment concerning
+ stop_paren.
+
+Tue Aug 10 14:54:25 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/nkf/nkf.c (rb_nkf_guess): binary detection was wrong.
+
+Tue Aug 10 00:07:36 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_clone): should use CLONESETUP().
+
+Mon Aug 9 23:57:07 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.h (CLONESETUP): should have copied generic instance
+ variables too.
+
+Mon Aug 9 10:46:54 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * ext/socket/extconf.rb: add check for <arpa/nameser.h> and
+ <resolv.h>.
+
+Sat Aug 7 13:19:06 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * numeric.c (flo_cmp): comparing NaN should not return value.
+ raises FloatDomainError.
+
+Sat Aug 7 03:09:08 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (blk_free): free copied frames too.
+
+ * eval.c (frame_dup): should copy previous frames from stack to
+ heap to preserve frame information.
+
+Fri Aug 6 15:01:07 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.3.7 - version 1.4 beta
+
+ * ext/socket/socket.c (s_recv): UDPsocket#recvfrom now returns
+ IPsocket#addr information.
+
+ * array.c (rb_ary_subary): ary[-3,3] should not return nil.
+
+Thu Aug 5 10:58:01 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (thread_mark): protect old ruby_frame from GC during it
+ replaced by eval().
+
+ * eval.c (eval): do not modify frame.prev; binding should preserve
+ information about calling() too.
+
+ * eval.c (rb_yield_0): no arity check for mere yield; but only for
+ Proc#call.
+
+Tue Aug 3 22:07:13 1999 Kazuhiro HIWADA <hiwada@kuee.kyoto-u.ac.jp>
+
+ * object.c (rb_mod_clone): should check if iv_tbl, m_tbl are
+ initialized.
+
+Tue Aug 3 19:03:02 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * hash.c (rb_any_cmp): use rb_with_disable_interrupt() to ensure
+ clearance of rb_prohibit_interrupt even on failure.
+
+ * eval.c (rb_with_disable_interrupt): new function added.
+
+Sat Jul 31 23:23:44 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_create_0): set THREAD_RAISED flag on thread
+ termination by exception.
+
+ * eval.c (rb_thread_join): `$!' may not be nil for the threads
+ created in rescue clause.
+
+ * eval.c (rb_thread_status): ditto.
+
+ * eval.c (rb_thread_join): should re-raise exception for already
+ dead threads too.
+
+Fri Jul 30 17:56:54 1999 GOTO Kentaro <gotoken@math.sci.hokudai.ac.jp>
+
+ * object.c (rb_mod_ge): wrong comparison.
+
+Fri Jul 30 12:15:44 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * ext/tcltklib/extconf.rb: win32 support.
+
+ * lib/mkmf.rb: use append_library().
+
+ * ext/extmk.rb.in: ditto.
+
+Fri Jul 30 02:11:48 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (rb_ary_delete): should return nil for deleting non
+ existing item.
+
+ * io.c (rb_io_close): call rb_sys_wait() on explicit close.
+
+ * io.c (rb_io_fptr_close): do not call rb_sys_wait() on finalize.
+
+ * eval.c (yield_under_i): cbase context should be maintained for
+ Module#module_eval(). suggested by <inaba@st.rim.or.jp>.
+
+Wed Jul 28 01:18:28 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * Makefile.in: add -I$(hdrdir)/lib to install using ftools.
+
+ * util.c: use HAVE_FCNTL_H, not HAVE_FCNTL
+
+Wed Jul 28 18:24:45 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.3.6 - version 1.4 alpha
+
+Tue Jul 27 09:38:08 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * eval.c (rb_eval): reduce recursive rb_eval() calls by
+ NODE_BLOCKs.
+
+Tue Jul 27 01:20:40 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * file.c (rb_file_s_expand_path): drive letter patch.
+
+Mon Jul 26 02:36:31 1999 Shugo Maeda <shugo@netlab.co.jp>
+
+ * eval.c (rb_load): should clear ruby_nerr.
+
+ * eval.c (rb_thread_join): oldbt should not be empty to unshift.
+
+Sun Jul 25 12:09:16 1999 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * dir.c (push_braces): should treat nested braces.
+
+Fri Jul 23 02:49:49 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * hash.c (rb_hash_clear): dummy argument added; suggested by
+ <eguchi@shizuokanet.ne.jp>. thanks.
+
+Thu Jul 22 19:37:22 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_join): get_backtrace() may return Qnil.
+ typecheck added.
+
+Tue Jul 20 14:36:43 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * range.c (range_each): do not treat String specially (for future
+ override).
+
+Tue Jul 20 02:28:34 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_gets): $_ should be nil, when get returns nil.
+
+ * io.c (rb_f_gets): ditto.
+
+Mon Jul 19 17:13:09 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_fastmap): should continue fastmap compile
+ for anychar_repeat, for it's repeat anyway.
+
+Mon Jul 26 13:33:45 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * lib/jcode.rb: replaced by faster code.
+
+Mon Jul 19 01:57:28 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * lib/mkmf.rb: no longer use install program.
+
+ * ext/extmk.rb.in: use miniruby to install programs.
+
+Sat Jul 17 00:06:21 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/socket/socket.c (ipaddr): don't do reverse lookup if
+ attribute do_not_reverse_lookup is set for socket classes.
+ Experimental. Note this is a global attribute.
+
+Fri Jul 16 22:18:29 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_eof): use feof() to check EOF already met.
+
+ * io.c (read_all): should return nil at EOF.
+
+Fri Jul 16 13:39:42 1999 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/telnet.rb: version 0.231.
+
+Fri Jul 16 10:58:22 1999 WATANABE Tetsuya <tetsu@jpn.hp.com>
+
+ * regex.c (re_match): debug print removed.
+
+Fri Jul 16 09:58:15 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * many files: clean up unused variables found by gcc -Wall.
+
+ * lib/mkmf.rb: better cygwin support etc.
+
+ * ext/extmk.rb.in: ditto.
+
+ * instruby.rb: ditto.
+
+Fri Jul 16 01:37:50 1999 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * string.c (rb_str_squeeze_bang): the type of local variable `c'
+ should be int, not char.
+
+ * string.c (rb_str_reverse): should always return copy.
+
+Thu Jul 15 23:25:57 1999 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
+
+ * lib/debug.rb: better display & frame treatment.
+
+Thu Jul 15 21:16:41 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (rb_ary_each): returns self for normal termination;
+ returns nil for break.
+
+ * string.c: non bang methods (e.g. String#sub) should always
+ return copy of the receiver.
+
+Thu Jul 15 21:09:15 1999 Masaki Fukushima <fukusima@goto.info.waseda.ac.jp>
+
+ * eval.c (find_file): do not add empty string to the path.
+
+ * configure.in (with-search-path): should not add empty string if
+ the option is not supplied.
+
+Thu Jul 15 17:49:08 1999 Ryo HAYASAKA <hayasaka@univ21.u-aizu.ac.jp>
+
+ * ext/tcltklib/tcltklib.c: move `#include "ruby.h"' forward.
+
+Thu Jul 15 16:54:16 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.3.5 - version 1.4 alpha
+
+Wed Jul 14 23:45:33 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * eval.c (ruby_init): initialize for the first time only.
+
+Tue Jul 13 00:15:19 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * hash.c (rb_hash_index): re-defined; method to retrieve a key
+ from the value.
+
+ * hash.c (Init_Hash): member? should be re-defined for Hash.
+
+Tue Jul 12 13:54:51 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * io.c (rb_file_sysopen): wrong number of argument.
+
+Mon Jul 12 11:52:35 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_f_missing): class name included in message.
+
+ * eval.c (print_undef): better error message.
+
+Sun Jul 11 05:36:17 1999 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
+
+ * lib/debug.rb: patch to show proper position.
+
+Fri Jul 9 23:56:14 1999 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * dln.c (dln_find_1): path conv. moved to conv_to_posix_path.
+
+ * dln.c (conv_to_posix_path): path conv. should be done.
+
+Fri Jul 9 10:26:47 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * random.c (RANDOM_NUMBER): should place parentheses.
+
+Fri Jul 8 11:00:51 1999 Shugo Maeda <shugo@netlab.co.jp>
+
+ * numeric.c (fix_div): division may be out of fixnum range.
+
+ * bignum.c (bigdivmod): proper sign calculation to result.
+
+Wed Jul 7 18:27:41 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * st.c (st_delete_safe): was modifying wrong slot.
+
+Mon Jul 5 13:17:46 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * gc.c (rb_gc_call_finalizer_at_exit): close all files at exit.
+
+Fri Jul 2 18:00:21 1999 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * lib/Mail/README: Mail-0.3.0 added to the distribution.
+
+Fri Jul 2 01:45:32 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_fastmap): avoid allocation of register
+ variables for each invocation of re_match(). Suggested by
+ Zasukhin Ruslan <ruslan@paradigmasoft.com>. Thanks.
+
+Tue Jun 29 20:39:24 1999 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * ext/tk/lib/tk.rb (TkVariable): bug fix; should value type check
+ be added?
+
+ * string.c (rb_str_each_line): a bug in paragraph mode.
+
+ * ruby.c (load_file): shifted too much to skip #!.
+
+Tue Jun 29 06:50:21 1999 Wakou Aoyama <wakou@fsinet.or.jp>
+
+ * lib/CGI.rb: 0.30 - cleanup release, incompatible.
+
+ * lib/telnet.rb: 0.22 - timeout added.
+
+Tue Jun 29 10:49:25 1999 SHIROYAMA Takayuki <psi@fortune.nest.or.jp>
+
+ * configure.in: better Rhapsody support.
+
+ * lib/mkmf.rb: Rhapsody/NEXTSTEP support.
+
+Tue Jun 29 01:42:13 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/pty/pty.c (chld_changed): should use POSIX.1 style wait.
+
+Mon Jun 28 21:07:36 1999 KIMURA Koichi <kbk@kt.rim.or.jp>
+
+ * ext/extmk.rb.nt: wrong result for have_library().
+
+Mon Jun 28 15:24:05 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * missing/isinf.c: OSF/1 raises SIGFPE on one()/zero().
+
+ * regex.c (re_search): should search til EOS, for patterns may
+ match beyond the end of range.
+
+Mon Jun 28 12:49:12 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_f_select): should not accept Time objects as an
+ argument for it is time interval.
+
+ * process.c (rb_f_sleep): ditto.
+
+ * file.c (test_s): should return nil for false condition.
+
+Mon Jun 28 12:23:52 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * bignum.c (rb_dbl2big): typo.
+
+ * file.c (rb_f_test): ditto.
+
+ * string.c (rb_str_crypt): wrong message.
+
+Sun Jun 27 19:50:11 1999 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * eval.c (rb_f_exit): should have treat signed integer status, not
+ VALUE.
+
+ * process.c (rb_f_exit_bang): should work like exit().
+
+Sun Jun 27 16:21:32 1999 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * string.c (rb_str_rindex): wrong position to search.
+
+Sat Jun 26 04:05:30 1999 Takaaki Tateishi <ttate@jaist.ac.jp>
+
+ * configure.in (configure_args): --with-search-path to specify
+ additional ruby search path.
+
+ * ruby.c (ruby_prog_init): additional search path.
+
+Fri Jun 25 13:09:12 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * pack.c (pack_unpack): needed to initialize natint.
+
+ * regex.c (re_compile_pattern): add start_paren to avoid too much
+ finalization on maybe_finalize_jump.
+
+Fri Jun 25 13:07:20 1999 Koji Oda <oda@bsd1.qnes.nec.co.jp>
+
+ * missing/isinf.c: include "config.h" added.
+
+Fri Jun 25 07:25:05 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * lib/mkmf.rb: initialize $(topdir).
+
+ * ext/extmk.rb.in (install_rb): install lib/*.rb properly.
+
+ * configure.in (linux): specifies -rpath on --enable-shared.
+
+ * configure.in (aix): ruby.imp must reside in $(topdir).
+
+Thu Jun 24 19:11:29 1999 Yoshida Masato <yoshidam@yoshidam.net>
+
+ * parse.y (rb_str_extend): multi-byte identifier in expression
+ interpolation in strings.
+
+ * parse.y (yylex): support multi-byte char identifiers.
+
+Thu Jun 24 15:27:13 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (f_arg): check duplicate argument names.
+
+ * gc.c (rb_gc_mark): marking wrong member for NODE_ARGS.
+
+ * string.c (rb_str_rindex): POSITION specifies start point, not
+ end point.
+
+Thu Jun 24 13:00:17 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (print_mbc): wrong boundary.
+
+ * pack.c (uv_to_utf8): raises ArgError for too big value.
+
+Thu Jun 24 11:02:51 1999 Yoshida Masato <yoshidam@yoshidam.net>
+
+ * pack.c (uv_to_utf8): mask needed.
+
+Wed Jun 23 21:03:56 1999 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * ruby.h (struct RFile): remove iv_tbl from struct. instance
+ variables are handled as generic ivs.
+
+Wed Jun 23 22:06:26 1999 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * pack.c (utf8_to_uv): pack to 7 bytes sequence.
+
+ * pack.c (uv_to_utf8): wrong boundary.
+
+ * pack.c (pack_unpack): should treat as unsigned long.
+
+Wed Jun 23 15:10:11 1999 Inaba Hiroto <inaba@sdd.tokyo-sc.toshiba.co.jp>
+
+ * parse.y (parse_string): failed to parse nested braces.
+
+ * parse.y (parse_regx): nested braces within #{} available.
+
+Wed Jun 23 11:18:38 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (slow_search): wrong shift width for mbcs.
+
+ * eval.c (rb_thread_save_context): should not clear th->locals.
+
+Wed Jun 23 02:06:14 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (yylex): UMINUS binds too tight with digits. changed so
+ that -2**2 => -4.
+
+ * parse.y (close_paren): `do' for expr termination now works it
+ used to be.
+
+Wed Jun 22 18:26:42 1999 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * pack.c (pack_pack): should initialize local variable `j'.
+
+Wed Jun 22 15:24:59 1999 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * parse.y (here_document): a bug for multiline heredoc.
+
+Tue Jun 22 15:06:36 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * ext/socket/socket.c (ruby_socket): forgot to return fd
+ explicitly.
+
+Tue Jun 22 13:34:12 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * rubyio.h (MakeOpenFile): should initialize member `iv_tbl'.
+
+Wed Jun 22 10:35:51 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * io.c (rb_io_gets_internal): getc(3) may not set errno on
+ interrupt.
+
+Mon Jun 21 22:39:28 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (call_required_libraries): ruby_sourceline should be
+ cleared before loading libraries.
+
+ * io.c (set_stdin): do not use reopen(), so that we don't need to
+ dup original stdin before assigning $stdin.
+
+Mon Jun 21 18:04:27 1999 Ryo HAYASAKA <hayasaka@univ21.u-aizu.ac.jp>
+
+ * ext/dbm/dbm.c: include <cdefs.h> for solaris 2.6.
+
+Mon Jun 21 15:59:47 1999 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ext/socket/socket.c (ip_addrsetup): forgot to put `else'.
+
+Mon Jun 21 15:38:37 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (fptr_finalize): remove rb_syswait() invocation to avoid
+ wait4(2) within GC. rb_syswait() moved to rb_io_fptr_close().
+
+Mon Jun 21 12:05:59 1999 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * dir.c (dir_s_glob): remove MAXPATHLEN restriction.
+
+ * ext/md5/md5init.c (md5_hexdigest): should have used "%02x".
+
+Sun Jun 20 19:50:38 1999 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * string.c (rb_str_each_line): should have checked string
+ boundary.
+
+Sat Jun 19 22:24:12 1999 Kenji Nagasawa <kenn@hma.att.ne.jp>
+
+ * OS/2 patch improved.
+
+Fri Jun 18 08:30:17 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * marshal.c (r_byte): add data length check.
+
+ * ext/tcltklib/tcltklib.c (_timer_for_tcl): was doing busy-wait.
+
+Tue Jun 15 10:01:21 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * configure.in: remove trailing slash from interpreter embedded
+ shared library path.
+
+ * configure.in (INSTALL_DLLIB): install shared lib with 0555.
+
+ * instruby.rb: changed mode for shared library into 0555.
+
+Fri Jun 11 23:27:00 1999 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * ext/etc/etc.c (etc_passwd): should return nil, not exception for
+ call after last passwd entry.
+
+Fri Jun 11 15:21:21 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * gc.c (rb_gc_mark_locations): add safety margin 1.
+
+ * eval.c (ruby_run): should protect toplevel node tree.
+
+ * ext/etc/etc.c (etc_group): dumps core if there's no more group.
+
+Fri Jun 11 01:50:25 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (ruby_run): Init_stack() was called too late; local
+ variables happened to be higher (or lower) than stack_start.
+
+Thu Jun 10 16:41:48 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c: do not call `initialize' for IO objects. So with Array,
+ Hash, Range, and Time objects.
+
+ * ext/curses/curses.c (curses_getch): made thread aware using
+ rb_read_check().
+
+ * ext/curses/curses.c (window_getch): ditto.
+
+ * ext/curses/curses.c (curses_getstr): made (partially) thread
+ aware using rb_read_check().
+
+ * ext/curses/curses.c (window_getstr): ditto.
+
+ * io.c (rb_read_check): new function to help making something
+ (like extension libraries) thread aware.
+
+ * eval.c (is_defined): `defined? super' should be true even for
+ private superclass methods.
+
+Fri Jun 10 13:42:10 1999 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * pack.c (pack_pack): template `Z' should be allowed.
+
+Wed Jun 9 13:26:38 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_loading): modified to avoid nested race
+ condition of require().
+
+ * ext/tcltklib/tcltklib.c (ip_invoke): queue invocation on non
+ main threads.
+
+ * ext/tcltklib/tcltklib.c (lib_mainloop): flush invocation
+ queues periodically.
+
+ * version.c (ruby_show_version): now print the message to stdout.
+
+ * version.c (ruby_show_copyright): ditto.
+
+Tue Jun 8 00:00:34 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * pack.c (pack_unpack): append sentinel (NUL) to the string.
+
+ * ext/md5/md5init.c (md5_hexdigest): new method to obtain
+ printable hash string.
+
+ * ext/md5/md5init.c (md5_update): should return self.
+
+ * pack.c (pack_pack): undocumented template 'U' for UTF8.
+
+ * pack.c (pack_unpack): ditto.
+
+ * marshal.c (r_byte): should replace getc() with rb_getc().
+
+ * io.c (rb_getc): getc() replacement uses READ_DATA_PENDING() and
+ rb_thread_wait_fd().
+
+Mon Jun 7 23:23:38 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * object.c (rb_mod_clone): should call CLOSESETUP().
+
+ * eval.c (bind_clone): should call CLONESETUP() for new clone.
+
+Sat Jun 5 10:32:40 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_oct): binary (e.g. 0b10111) support.
+
+ * variable.c (rb_const_set): raise warning, not exception.
+
+ * parse.y (yycompile): initialize parser internal variables.
+
+ * parse.y (close_paren): set lex_state to EXPR_PAREN after closing
+ parenthesis.
+
+ * parse.y (yylex): returns kDO for `do' right after method_call.
+
+Thu Jun 3 11:05:30 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * regex.c (read_backslash): should decode \b within class.
+
+Thu Jun 3 01:06:18 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * dln.c (dln_load): AIX improvement (aix_findmain removed).
+
+Wed Jun 2 00:41:31 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * pack.c (pack_unpack): new undocumented template Z which strips
+ stuff after first null.
+
+ * pack.c (pack_pack): should preserve specified length of the
+ resulting string.
+
+Tue Jun 1 15:29:33 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/socket/socket.c (ruby_socket): retry after GC, if socket(2)
+ failed on EMFILE or ENFILE.
+
+ * ext/socket/socket.c (sock_s_socketpair): ditto.
+
+ * eval.c (module_setup): need to add PUSH_VAR/POP_VAR to clear
+ dyna vars link list.
+
+ * version.h (RUBY_RELEASE_CODE): integer macro constant for source
+ version detection.
+
+Sun May 30 22:19:12 1999 Kenji Nagasawa <kenn@tcp-ip.or.jp>
+
+ * ext/socket/socket.c: emx/gcc 0.9d now fixes things about
+ AF_UNIX.
+
+ * process.c: OS/2 EMX kludge.
+
+ * Makefile.in (strncasecmp.o): added dependency.
+
+Mon May 31 16:06:28 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.3.4 - preliminary release for 1.4
+
+Mon May 31 15:57:41 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_fptr_close): close on IO which main_thread is
+ waiting cause serious exception, that vanishes the actual fd
+ closing. Invocation of rb_thread_fd_close() is deferred
+ a little.
+
+Sat May 29 18:27:13 1999 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * regex.c (re_match): stack boundary check needed.
+
+Sat May 29 12:27:00 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/tcltklib/tcltklib.c (ip_invoke): proper ref count management
+ to avoid leak. I HATE REF COUNTING!!
+
+ * eval.c (ruby_run): moved ruby_require_libraries() to handle `-r'
+ from ruby_options() to avoid stack corruption for threads
+ created in libraries.
+
+Sat May 29 02:22:12 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_yield_0): when `for' appeared in blocks, it
+ introduced new scope for local variables.
+
+Fri May 28 17:16:49 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_squeeze_bang): squeeze AND of the arguments.
+ UNDOCUMENTED.
+
+ * string.c (rb_str_count): new UNDOCUMENTED method.
+
+ * string.c (rb_str_delete_bang): delete AND of the arg ranges.
+ UNDOCUMENTED FEATURE for 1.3.x.
+
+ * ext/socket/socket.c (setipaddr): re-wrote using ip_addrsetup().
+
+ * ext/socket/socket.c (ip_addrsetup): decode symbolic address
+ <broadcast>.
+
+Thu May 27 12:27:42 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (tr_trans): should handle NUL (\0) within strings.
+
+Tue May 25 16:45:11 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_f_syscall): syscall may return values other than zero
+ on success.
+
+ * regex.c (re_match): handle empty loop properly (hopefully).
+
+ * regex.c (re_match): remove empty group check, because it does
+ not help non-grouping parentheses (?:..).
+
+ * regex.c (re_compile_fastmap): treating try_next, finalize_push
+ wrong way.
+
+ * regex.c: remove some obsolete functions such as
+ group_match_null_string_p().
+
+Mon May 24 14:47:54 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (read_backslash): read backslash by regex.
+
+Sun May 23 19:44:58 1999 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ext/pty/pty.c (getDevice): portability patch.
+
+Fri May 21 23:01:26 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * ext/socket/getaddrinfo.c (GET_AI): should set error code.
+
+Thu May 20 03:43:44 1999 Jun-ichiro itojun Hagino <itojun@itojun.org>
+
+ * ext/socket/socket.c: you should use sockaddr_storage to handle
+ IPv6 addresses.
+
+ * ext/socket/getaddrinfo.c (getaddrinfo): prevent retrieving
+ AF_INET6 address if hints.ai_flags == AI_PASSIVE.
+
+Wed May 19 12:27:07 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (exec_end_proc): should protect exceptions.
+
+ * gc.c (run_final): ditto.
+
+ * parse.y (f_rest_arg): allow just * for rest arg.
+
+ * parse.y (mlhs_basic): allow * without formal argument.
+
+ * regex.c (re_match): the variable `part' should be initialized.
+
+Tue May 18 15:25:45 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_search): a bug in range adjustment.
+
+Tue May 18 11:35:59 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * dln.c (conv_to_posix_path): path_len argument added.
+
+Mon May 17 12:26:31 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * numeric.c (fix_rev): should treat Fixnum as signed long.
+
+ * eval.c (massign): add strict number check for yield (and call).
+
+ * eval.c (proc_arity): new method to return number of arguments.
+
+ * eval.c (method_arity): new method to return number of arguments.
+
+ * parse.y (read_escape): char may be unsigned.
+
+ * string.c (rb_str_succ): ditto.
+
+ * string.c (tr_trans): ditto.
+
+ * object.c (Init_Object): methods `&', `|', `^' are added to nil.
+
+ * range.c (rb_range_beg_len): it should be OK for [0..-len-1].
+
+ * regex.c (re_search): search for byte literal within mbcs.
+
+ * regex.c (is_in_list): parsh
+
+ * regex.c (re_compile_fastmap): should have not alter the loop
+ variable `j' if TRASLATE_P().
+
+ * regex.c (re_compile_pattern): escaped characters should be read
+ by PATFETCH_RAW(c).
+
+Sat May 15 11:23:51 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_match): endline2 (\Z) should not match at the point
+ between a newline and end-of-line, like endline ($).
+
+ * class.c (include_class_new): should initialize iv_tbl to share
+ between module and iclass.
+
+Fri May 14 08:50:27 1999 Akira Endo <akendo@t3.rim.or.jp>
+
+ * regex.c (re_compile_fastmap): it should be k != 0 to skip.
+
+Fri May 14 12:46:56 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * time.c (time_load): a bug in old marshal format support.
+
+ * instruby.rb: make site_ruby directory.
+
+Fri May 14 10:18:02 1999 WATANABE Tetsuya <tetsu@jpn.hp.com>
+
+ * regex.c (re_match): a bug in inline `.*' etc.
+
+Fri May 14 09:58:46 1999 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * ruby.c (addpath): should have specified string length.
+
+Thu May 13 10:40:44 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_eval_string_wrap): new function.
+
+ * regex.c (re_compile_pattern): POSIX line match should alter
+ behavior for `^' and `$' to begbuf and endbuf2 respectively.
+
+ * ext/pty/pty.c: un-ANSI-fy function arguments.
+
+Wed May 12 14:19:38 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * struct.c (iv_get): in case of inheritance of generated struct
+ class, __member__ and __size__ should also be inherited.
+ Thanks for Pros Yeboah <yeboah@tu-harburg.de>.
+
+ * io.c (rb_f_gets_internal): should check number of arguments
+ before checking rb_rs == rb_default_rs. Thanks for Koji Arai
+ <JCA02266@nifty.ne.jp>.
+
+Tue May 11 08:29:28 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_pattern): .?, .+ did not work.
+
+Mon May 10 00:59:33 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * lib/jcode.rb: forgot to squeeze on reverse (complement) case.
+
+ * string.c (tr_squeeze): should not set modify flag to be honest,
+ if the string is not modified.
+
+ * signal.c (Init_signal): SIGTERM should not be handled.
+
+ * regex.c (re_match): seeking for longest match is now optional,
+ which can be set using RE_OPTION_POSIXMATCH. This satisfies
+ POSIX longest match as much as Emacs's posix-* functions, which
+ are known to be incomplete.
+
+Sun May 9 13:04:01 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * ext/socket/socket.c (sock_s_getaddrinfo): conversion from
+ Fixnums to C integers needed.
+
+Sun May 9 11:51:43 1999 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * range.c (range_eqq): reverse condition.
+
+ * range.c (range_s_new): default should be end inclusive.
+
+Sat May 8 03:27:51 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/socket/socket.c (thread_connect): replace nasty
+ rb_thread_fd_writable() with rb_thread_select().
+
+Fri May 7 20:49:00 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * ext/socket/getaddrinfo.c (inet_pton): wrong parameter to
+ inet_aton().
+
+ * ext/socket/addrinfo.h (__P): silly cut and paste typo.
+
+Fri May 7 17:03:57 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * dir.c (glob): removed GPL'ed glob.c completely.
+
+Fri May 7 08:17:19 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/sdbm/extconf.rb: sdbm extension added to the distribution.
+
+Fri May 7 01:42:20 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/socket/socket.c (tcp_s_gethostbyname): avoid using struct
+ sockaddr_storage.
+
+Thu May 6 13:21:41 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (rb_ary_indexes): should not use rb_ary_concat().
+
+Thu May 4 12:34:18 1999 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * parse.y (parse_string): there should be newline escape by
+ backslashes in strings.
+
+ * parse.y (parse_qstring): ditto.
+
+Mon May 3 04:37:20 1999 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * ext/tcltklib/extconf.rb: better search for libX11.
+
+ * range.c (range_s_new): embarrassing =/== typo.
+
+ * re.c (Init_Regexp): failed to set default kcode.
+
+Mon May 3 02:39:55 1999 WATANABE Tetsuya <tetsu@jpn.hp.com>
+
+ * ext/socket/socket.c (open_inet): typo (res and res0).
+
+Tue May 4 02:07:49 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * mkconfig.rb: leave undefined $(VARIABLE) unexpanded in the
+ Config::CONFIG hash table.
+
+Mon May 3 09:37:22 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_pattern): expand exactn{n} at compile time.
+ handles stop_paren specially.
+
+ * regex.c (re_compile_pattern): expand x{n} at compile time.
+
+ * regex.c (re_search): posix line match should be checked.
+
+ * regex.c (re_search): a bug in anchor condition.
+
+Fri Apr 30 18:57:41 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.3.3
+
+ * string.c (rb_str_rindex): position should be END point, not
+ START point.
+
+ * re.c (rb_reg_search): pos means end point on reverse now.
+
+ * array.c (rb_ary_s_create): should clear ary->ptr to avoid
+ potential gc crash.
+
+Fri Apr 30 15:24:58 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/socket/addrinfo.h: compatibility hack for ipv4.
+
+ * ext/socket/socket.c: itojun's ipv6 patches applied.
+
+ * ext/socket/extconf.rb: detect ipv6 features based on itojun's
+ ipv6 patches.
+
+ * ext/extmk.rb.in (enable_config): can handle --enable-xxx now.
+
+ * lib/mkmf.rb (enable_config): ditto.
+
+Fri Apr 30 05:22:23 1999 Shugo Maeda <shugo@netlab.co.jp>
+
+ * string.c (rb_str_aset): last index should not append.
+
+Thu Apr 29 18:55:31 1999 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * dln.c (conv_to_posix_path): remove const from args.
+
+ * ruby.c (rubylib_mangle): remove Fatal(), the obsolete function.
+
+Tue Apr 27 14:11:45 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (fname): lazy workaround for keywords did not work well.
+
+ * ext/extmk.rb.in: `--with-xxx=yyy' argument configuration.
+
+ * lib/mkmf.rb: ditto.
+
+ * misc/ruby-mode.el: forgot to handle $`.
+
+ * ext/extmk.rb.in: better AIX link support proposed by
+ <komatsu@sarion.co.jp>.
+
+Mon Apr 26 16:46:59 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/extmk.rb.in: AIX shared library support modified.
+
+ * ext/aix_mksym.rb: ditto.
+
+ * configure.in: ditto.
+
+ * sprintf.c (rb_f_sprintf): should allocate proper sized buffer
+ for float numbers.
+
+Sat Apr 24 00:00:16 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (operation): syntax like `a.[]=(1,2)' is allowed.
+
+Fri Apr 23 23:54:09 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (argf_binmode): binmode method added to ARGF.
+
+Fri Apr 23 13:55:22 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_f_chomp): should assign the result to $_. or maybe
+ sub/gsub/chop/chomp should NOT assign $_ altogether.
+
+Thu Apr 22 16:50:54 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_callcc): call scope_dup() for all scopes in
+ the interpreter stack.
+
+Tue Apr 20 11:24:18 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_dump): `#' should be escaped.
+
+Tue Apr 20 02:32:42 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (parse_regx): option /p for posix match added.
+
+ * re.c (rb_reg_desc): did not print options properly.
+
+ * io.c (rb_file_s_open): initialize was called twice.
+
+Mon Apr 19 18:56:21 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * configure.in (DEFAULT_KCODE): can specify default code for
+ $KCODE by --with-default-kcode=(euc|sjis|utf8|none).
+
+ * regex.c (IS_A_LETTER): a byte sequence shorter than mbc should
+ not match with \w etc.
+
+Mon Apr 19 13:49:11 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (eval): should restore ruby_dyna_vars.
+
+Fri Apr 16 21:40:43 1999 Nobuyoshi Nakada <gea02117@nifty.ne.jp>
+
+ * io.c (f_backquote): pipe_open may return nil.
+
+ * io.c (f_open): rb_io_open may return nil.
+
+ * io.c (io_s_foreach): ditto.
+
+ * io.c (io_s_readlines): ditto.
+
+ * io.c (io_defset): wrong message.
+
+Fri Apr 16 15:09:20 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * bignum.c (rb_str2inum): strtoul() returns long, not int.
+
+ * eval.c (rb_load): size of VALUE and ID may be different.
+
+ * util.c (mmprepare): int is too small to cast from pointers.
+
+ * config.guess: avoid 'linux-gnu' for alpha-unknown-linux.
+
+Thu Apr 15 23:46:20 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * ruby.c (rubylib_mangle): mangle path by RUBYLIB_PREFIX.
+
+Wed Apr 14 23:52:51 1999 SHIROYAMA Takayuki <psi@fortune.nest.or.jp>
+
+ * node.h (NODE_LMASK): should be long to avoid overflow.
+
+Wed Apr 14 13:14:35 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * dln.c: AIX dynamic link.
+
+ * ext/aix_ld.rb: ditto.
+
+Wed Apr 14 12:19:09 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * lib/thread.rb: Queue#{enq,deq} added.
+
+Tue Apr 13 17:43:56 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * hash.c (rb_hash_s_create): Hash::[] acts more like casting.
+
+Tue Apr 13 00:33:52 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_stdio_set): warning for assignment to the variables
+ $std{in,out,err}.
+
+Mon Apr 12 23:12:32 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_reopen): check for reopening same IO.
+
+Fri Apr 9 17:45:11 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (rb_compile_string): bug for nested eval().
+
+ * regex.c (re_match): should pop non-greedy stack items on
+ failure, after best_regs are fixed.
+
+Thu Apr 8 17:30:40 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * pack.c (PACK_LENGTH_ADJUST): need to adjust for `*' length.
+
+Tue Apr 6 23:28:44 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (void_check): add void context checks.
+
+Mon Apr 5 12:23:42 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * time.c (time_s_at): should copy gmt-mode.
+
+ * eval.c (eval_node): preserve ruby_eval_tree.
+
+Fri Apr 2 14:00:34 1999 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
+
+ * lib/debug.rb: wrong command interpreting.
+
+Fri Apr 2 11:46:22 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.3.2
+
+Fri Apr 2 10:40:04 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_s_pipe): forgot to define IO::pipe.
+
+Thu Apr 1 14:40:46 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (assign): modified for rhs change.
+
+ * parse.y (stmt): unparenthesisized method calls can be right hand
+ side expression of the assignment.
+
+Sat Mar 27 22:42:47 1999 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * ext/nkf/nkf.c (rb_nkf_kconv): check size output_ctr before
+ decrement.
+
+Thu Mar 25 09:11:03 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * time.c (time_s_at): preserve gmt-mode for result.
+
+ * parse.y (rb_compile_string): do not use cur_mid, use
+ compile_for_eval instead.
+
+ * st.c (PTR_NOT_EQUAL): wrong logical condition.
+
+Wed Mar 24 13:06:43 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (yycompile): should clear cur_mid after compilation.
+
+ * io.c (next_argv): need to check type for ARGV.shift.
+
+ * eval.c (blk_copy_prev): need to preserve outer scope as well as
+ outer frames.
+
+ * parse.y (rb_compile_string): return can appear within eval().
+
+Tue Mar 23 10:15:07 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * configure.in: AC_C_CONST check added.
+
+Tue Mar 23 02:07:35 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * time.c (time_plus): preserve gmt-mode for result.
+
+Mon Mar 22 01:32:37 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_eval): adjust line numbers before expression
+ interpolation within strings.
+
+ * eval.c (rb_eval): defined? returns nil for false condition.
+
+ * numeric.c (num_nonzero_p): returns nil for false condition.
+
+Sat Mar 20 13:07:43 1999 Keiju Ishitsuka <keiju@rational.com>
+
+ * lib/weakref.rb: avoid leak for two weakrefs for one object.
+
+Fri Mar 19 11:26:45 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * eval.c (ruby_run): needed to eval END{} on exit.
+
+ * eval.c (rb_exit): ditto.
+
+Fri Mar 19 02:17:27 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * signal.c (Init_signal): handles terminating signals HUP, TERM,
+ QUIT, PIPE, etc.
+
+Thu Mar 18 15:47:18 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * bignum.c (rb_big_and): bug in sign calculation.
+
+ * bignum.c (rb_big_or): ditto.
+
+ * io.c (rb_f_select): forgot to use to_io to retrieve IO, after
+ calling select(2).
+
+Tue Mar 16 19:54:31 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * ext/extmk.rb.in: static linking cause infinite make loop.
+
+Tue Mar 16 18:50:04 1999 Yoshida Masato <yoshidam@yoshidam.net>
+
+ * ext/socket/socket.c (tcp_s_gethostbyname): typo, not NUM2INT(),
+ but INT2NUM().
+
+ * ext/socket/socket.c (mkhostent): ditto.
+
+Tue Mar 16 12:31:44 1999 Ryo HAYASAKA <hayasaka@cheer.u-aizu.ac.jp>
+
+ * file.c (utime_internal): suppress warning by const.
+
+ * time.c (time_gmtime): ditto.
+
+Tue Mar 16 10:23:05 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * time.c (time_clone): Time object can be cloned.
+
+Tue Mar 16 03:13:10 1999 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * ruby.c (load_file): argv[argc] should be NULL.
+
+Mon Mar 15 22:12:08 1999 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * sprintf.c (rb_f_sprintf): typo in arg_num check at exit.
+
+Mon Mar 15 16:42:22 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (rb_ary_dup): dup2 should copy class too.
+
+Mon Mar 15 15:12:53 1999 Yasuhiro Fukuma <yasuf@big.or.jp>
+
+ * lib/mkmf.rb: install program relative path check.
+
+Mon Mar 15 14:05:25 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (rb_reg_s_new): 2nd argument is now option.
+ Regexp::EXTENDED can be specified.
+
+Fri Mar 12 10:47:49 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_index): str.index("") should always match at
+ offset point.
+
+ * string.c (rb_str_upto): can specify end point exclusion.
+
+ * string.c (rb_str_index): negative offset.
+
+ * regex.c (re_match): begline should not match at the point
+ between a newline and end-of-string. endline neither.
+
+ * regex.c (re_compile_pattern): context_indep_anchors .
+
+ * parse.y (parse_regx): need not to push backslashes before
+ escaped characters.
+
+ * eval.c (rb_thread_join): re-raises exception within target.
+
+Fri Mar 12 01:09:36 1999 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * ext/readline/readline.c (readline_s_vi_editing_mode): wrong
+ number of arguments.
+
+Fri Mar 12 02:12:50 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * pack.c (PACK_ITEM_ADJUST): "a".unpack("C3") => [97, nil, nil]
+
+Thu Mar 11 18:23:50 1999 WATANABE Tetsuya <tetsu@jpn.hp.com>
+
+ * ext/socket/socket.c (Init_socket): UDPsocket was omitted.
+
+Thu Mar 11 16:43:30 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * pack.c (PACK_LENGTH_ADJUST): push fixed number of items per
+ template to result array.
+
+ * pack.c (pack_unpack): I/N/C etc. push nil in the array for "".
+
+Tue Mar 9 00:19:21 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * hash.c (ruby_unsetenv): use ruby_setenv(name, 0).
+
+ * hash.c (env_delete): ditto.
+
+ * string.c (rb_str_upto): do not check `beg<end' to generate
+ strings for the pattern like "a".upto("#a").
+
+ * range.c (range_each): treat strings as special case.
+
+ * range.c (range_each): no longer use upto for generic cases.
+
+Sun Mar 7 14:21:32 1999 IKARASHI Akira <ikarashi@itlb.te.noda.sut.ac.jp>
+
+ * string.c (rb_str_index): wrong end point calculation.
+
+Sat Mar 6 02:19:12 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (match_index): MatchingData#index(n) added.
+
+ * array.c (rb_ary_subseq): ary[n..-1] returns an sub-array unless
+ n is too small negative index.
+
+ * re.c (rb_reg_match_method): Regexp#match(str) added.
+
+ * array.c (rb_ary_indexes): understands ranges as indexes.
+
+ * re.c (match_size): MatchingData#size added.
+
+Fri Mar 5 01:04:57 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (rb_ary_fill): modified for range.
+
+ * array.c (rb_ary_aset): a[n..m] revisited.
+
+Thu Mar 4 14:23:29 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_subseq): a[n..m] revisited.
+
+ * parse.y (method_call): allow Const::method{}.
+
+ * array.c (rb_ary_replace_method): should replace original array.
+
+Thu Mar 4 02:30:22 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * configure.in: remove --disable-thread, thread feature is no
+ longer optional.
+
+Thu Mar 4 00:32:17 1999 Yasuhiro Fukuma <yasuf@big.or.jp>
+
+ * parse.y (read_escape): wrong arguments for scan_oct,scan_hex.
+
+Wed Mar 3 11:51:53 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/socket/socket.c (Init_socket): rename class names as
+ TCPsocket -> TCPSocket etc.
+
+Tue Mar 2 19:46:42 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * configure.in (LDSHARED): use gcc -Wl,-G for solaris with gcc.
+
+Tue Mar 2 17:04:19 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (yylex): backslashes do not concatenate comment lines
+ anymore.
+
+Mon Mar 1 14:05:12 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_call0): adjust argv for optional arguments. super
+ without arguments emit superclass method with the value from
+ optional arguments. enabled as experiment.
+
+Sun Feb 28 14:04:07 1999 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * parse.y (nextc): backslash at the eof cause infinite loop
+
+Sun Feb 28 11:01:26 1999 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * time.c (make_time_t): month range check added.
+
+Sat Feb 27 02:36:05 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (Init_Regexp): add escape as alias of quote.
+
+ * re.c (rb_reg_s_quote): char-code can be specified now.
+
+Fri Feb 26 18:45:36 1999 Yasuhiro Fukuma <yasuf@big.or.jp>
+
+ * eval.c (error_print): bug for error message with newlines.
+
+Fri Feb 26 12:00:04 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * time.c (make_time_t): future check modified to allow 1969-12-31
+ at certain timezone.
+
+ * time.c (time_arg): year >= 1000 should be past.
+
+ * version.c (Init_version): constant RELEASE_DATE added.
+
+Fri Feb 26 01:08:30 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_substr): returns nil for out-of-range access.
+
+ * array.c (rb_ary_subseq): returns nil for out-of-range access.
+
+ * array.c (rb_ary_store): negative index message has changed.
+
+ * string.c (rb_str_aset): reallocation needed.
+
+ * string.c (rb_str_aset): allow char append to the string.
+
+Thu Feb 25 23:30:17 1999 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * time.c (time_load): tm_year should be packed in 17 bits, not 18.
+
+Thu Feb 25 12:50:25 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * missing/dup2.c: replaced by public domain version.
+
+ * time.c (make_time_t): add `future check' in loops.
+
+ * object.c (rb_num2dbl): forbid implicit conversion from nil, or
+ strings. thus `Time.now + str' should raise error.
+
+ * object.c (rb_Float): convert nil into 0.0.
+
+ * object.c (rb_Integer): conversion method improved.
+
+Thu Feb 25 03:27:50 1999 Shugo Maeda <shugo@netlab.co.jp>
+
+ * eval.c (rb_call): should handle T_ICLASS properly.
+
+Thu Feb 25 00:04:00 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * error.c (Init_Exception): global function Exception() removed.
+
+ * variable.c (rb_class2name): returns "nil"/"true"/"false" for them.
+
+ * time.c (time_dump): time marshaling format compressed size from
+ 11 bytes to 8 bytes. thanx to tadf@kt.rim.or.jp.
+
+ * eval.c (rb_obj_call_init): should specify arguments explicitly.
+
+Wed Feb 24 15:43:28 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (yylex): comment concatenation requires preceding space
+ before backslash at the end of line.
+
+ * io.c (rb_f_pipe): global pipe is obsolete now.
+
+ * object.c (Init_Object): remove true.to_i, false.to_i.
+
+Tue Feb 23 14:21:41 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (yylex): warn if identifier! immediately followed by `='.
+
+Tue Feb 23 12:32:41 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * eval.c (rb_load): tilde expansion moved to find_file.
+
+ * eval.c (find_file): tilde expansion added.
+
+Tue Feb 23 10:50:20 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (require_method): require can handle multiple fnames.
+
+ * hash.c (rb_hash_foreach_iter): hash key may be nil.
+
+Mon Feb 22 17:44:02 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_match): should not pop failure point on success for
+ non-greedy matches.
+
+ * io.c (Init_IO): remove global_functions getc, readchar, ungetc,
+ seek, tell, rewind.
+
+Sat Feb 20 22:54:26 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * numeric.c (rb_num2long): no implicit conversion from boolean.
+
+Sat Feb 20 09:58:42 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * numeric.c (flo_to_s): portable Infinity and NaN support.
+
+Sat Feb 20 07:13:31 1999 WATANABE Tetsuya <tetsu@jpn.hp.com>
+
+ * io.c (rb_file_sysopen): forgot to initialize a local variable.
+
+Fri Feb 19 23:05:07 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_subseq): range check changed.
+
+ * marshal.c: increment MARSHAL_MINOR for Time format change.
+
+ * time.c (time_old_load): support old marshal format.
+
+ * time.c (time_load): changed for new format Y/M/D/h/m/s/usec.
+
+ * time.c (time_dump): marshal dump format has changed.
+
+Fri Feb 19 00:25:57 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * time.c (time_arg): should reject "sep\0" and such.
+
+ * time.c (time_plus): Time#+ should not receive Time object
+ operand.
+
+ * string.c (rb_str_substr): negative length raises exception now.
+
+ * array.c (beg_len): if end == -1, it points end of the array.
+
+ * array.c (rb_ary_subseq): negative length raises exception now.
+
+Thu Feb 18 20:57:04 1999 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * time.c (rb_strftime): strftime() may return 0 on success too.
+
+ * time.c (time_strftime): `\0' within format string should not be
+ omitted in the result.
+
+ * time.c (rb_strftime): zero length format.
+
+ * time.c (time_to_a): yday start with 1 now.
+
+ * time.c (time_zone): support for long timezone name.
+
+ * time.c (time_yday): yday start with 1 now.
+
+ * time.c (time_minus): minus calculation was wrong.
+
+ * time.c (time_minus): sec, usec should be at least `long', maybe
+ they should be `time_t'.
+
+ * time.c (time_plus): addition with float was wrong.
+
+ * time.c (time_to_s): support for long timezone name.
+
+ * time.c (time_gm_or_local): too far future check moved.
+
+ * time.c (time_arg): treat 2 digit year as 69-99 => 1969-1999,
+ 00-68 => 2000-2068
+
+Thu Feb 18 03:56:47 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * missing/fnmatch.c: moved to missing directory.
+
+Wed Feb 17 16:22:26 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * struct.c (rb_struct_alloc): actual initialization now be done in
+ `initialize'.
+
+Wed Feb 17 09:47:15 1999 okabe katsuyuki <hgc02147@nifty.ne.jp>
+
+ * regex.c (re_search): use mbclen() instead of ismbchar().
+
+ * re.c (rb_reg_s_quote): should handle mbchars properly.
+
+Wed Feb 17 01:25:26 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (yylex): stop comment concatenation by backslash follows
+ after >= 0x80 char. may cause problem with Latin chars.
+
+ * eval.c (error_print): exception in rb_obj_as_string() caused
+ SEGV. protect it by PUSH_TAG/POP_TAG.
+
+ * error.c (exc_exception): `Exception#exception' should return self.
+
+Wed Feb 17 01:12:22 1999 Hirotaka Ichikawa <hirotaka.ichikawa@tosmec.toshiba.co.jp>
+
+ * configure.in: BeOS patch.
+
+Tue Feb 16 14:25:00 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_pattern): should reallocate mbc space for
+ character class unless current_mbctype is ASCII.
+
+Mon Feb 15 15:48:30 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * configure.in: specify `-Wl,-E' only for GNU ld.
+
+Mon Feb 15 11:43:22 1999 GOTO Kentaro <gotoken@math.sci.hokudai.ac.jp>
+
+ * array.c (rb_inspecting_p): should return Qfalse.
+
+Sun Feb 14 22:36:40 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * sprintf.c (rb_f_sprintf): `%G' was omitted.
+
+Sun Feb 14 12:47:48 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * numeric.c (Init_Numeric): allow divide by zero on FreeBSD.
+
+ * numeric.c (Init_Numeric): FloatDomainError added.
+
+ * configure.in (AC_REPLACE_FUNCS): add checks for functions
+ isinf, isnan, and finite.
+
+Sat Feb 13 01:24:16 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_create_0): should protect th->thread.
+
+Fri Feb 12 16:16:47 1999 Yasuhiro Fukuma <yasuf@big.or.jp>
+
+ * string.c (rb_str_inspect): wrong mbc position.
+
+Fri Feb 12 16:21:17 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_fd_close):
+
+ * io.c (rb_io_fptr_close): tell scheduler that fd is closed.
+
+ * io.c (rb_io_reopen): ditto.
+
+ * io.c (READ_CHECK): check if closed after thread context switch.
+
+ * ext/socket/socket.c (bsock_close_read): do not check
+ the return value from shutdown(2).
+
+ * ext/socket/socket.c (bsock_close_write): ditto.
+
+ * ext/socket/socket.c (sock_new): need to dup(fd) for close_read
+ and close_write.
+
+ * parse.y (here_document): handle newlines within #{}.
+
+ * regex.h: should replace symbols for ruby.
+
+Fri Feb 12 00:46:28 1999 Shugo Maeda <shugo@netlab.co.jp>
+
+ * marshal.c (r_object): should update the method name in message.
+
+ * marshal.c (w_object): limit should be converted into Fixnum.
+
+Wed Feb 10 15:20:03 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_match): empty pattern should not cause infinite
+ pattern match loop.
+
+ * regex.c (re_compile_pattern): RE_OPTIMIZE_ANCHOR for /.*/, not
+ for /(.|\n)/.
+
+ * numeric.c (fix_pow): `fixnum**nil' should raise TypeError.
+
+ * bignum.c (rb_big_pow): need to normalize results.
+
+Wed Feb 10 01:42:41 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * numeric.c (fix_pow): `(5**1).type' should be Integer.
+
+Tue Feb 9 01:22:49 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (yylex): do not ignore newlines in mbchars.
+
+ * io.c (rb_file_s_open): mode can be specified by flags like
+ open(2), e.g. File::open(path, File::CREAT|File::WRONLY).
+
+ * io.c (rb_f_open): bit-wise mode flags for pipes
+
+ * io.c (Init_IO): bit flags for open.
+
+Sat Feb 6 22:56:21 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_sub_bang): should not overwrite match data by
+ regexp match within the block.
+
+ * string.c (rb_str_gsub_bang): ditto.
+
+Sat Feb 6 03:06:17 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (match_getter): accessing $~ without matching caused SEGV.
+
+Fri Feb 5 22:11:08 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * parse.y (yylex): binary literal support, like 0b01001.
+
+ * parse.y (yylex): octal numbers can contain `_'s.
+
+ * parse.y (yylex): warns if non-octal number follows immediately
+ after octal literal.
+
+ * parse.y (yylex): now need at least one digit after prefix such
+ as 0x, or 0b.
+
+ * bignum.c (rb_str2inum): recognize binary numbers like 0b0101.
+
+Fri Feb 5 03:26:56 1999 Yasuhiro Fukuma <yasuf@big.or.jp>
+
+ * ruby.c (proc_options): -e without program prints error.
+
+Fri Feb 5 00:01:50 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (terms): needed to clear heredoc_end.
+
+ * numeric.c (flo_div): allow float division by zero.
+
+Thu Feb 4 11:56:24 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * missing/strtod.c: for compatibility.
+
+ * configure.in (strtod): add strtod compatible check.
+
+ * numeric.c (rb_num2long): missing/vsnprintf.c does not support
+ floating points.
+
+ * numeric.c (flo_to_s): ditto.
+
+Wed Feb 3 23:02:12 1999 Yoshida Masato <yoshidam@yoshidam.net>
+
+ * regex.c (re_compile_pattern): use ismbchar() to get next char.
+
+ * regex.c (re_search): wrong mbchar shift.
+
+ * re.c (rb_reg_search): needed to reset $KCODE after match.
+
+ * regex.c (re_compile_fastmap): mbchars should match with \w.
+
+Wed Feb 3 22:35:12 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * parse.y (yylex): too big float raise warning, not error.
+
+Tue Feb 2 23:41:42 1999 Yoshida Masato <yoshidam@yoshidam.net>
+
+ * regex.c (re_match): wrong boundary.
+
+ * regex.c (IS_A_LETTER): re_mbctab[c] may not be 1 for mbc.
+
+ * regex.c (re_search): mbchar support for shifting ranges.
+
+ * regex.c (MBC2WC): wrong conversion.
+
+Wed Feb 3 15:03:16 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (parse_regx): need to escape parens if terminators are
+ not any kind of parenthesis.
+
+ * parse.y (parse_qstring): ditto.
+
+ * parse.y (parse_string): ditto.
+
+Tue Feb 2 17:11:26 1999 WATANABE Tetsuya <tetsu@jpn.hp.com>
+
+ * string.c (rb_str_gsub_bang): too small realloc condition.
+
+Mon Feb 1 10:01:17 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * parse.y (yylex): range check for the float literal.
+
+Sat Jan 30 18:34:16 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c (usage): -h option to show brief command description.
+
+Sat Jan 30 08:45:16 1999 IKARASHI Akira <ikarashi@itlb.te.noda.sut.ac.jp>
+
+ * lib/cgi-lib.rb: cookie support added.
+
+Sat Jan 30 13:38:24 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_pattern): mbchars should match with \w
+ within character class. Was matching with \W.
+
+ * regex.c (re_match): \w should match with multi byte characters,
+ not its first byte.
+
+Sat Jan 30 10:06:41 1999 Yoshida Masato <yoshidam@yoshidam.net>
+
+ * re.c (rb_reg_s_new): UTF-8 flag handle (/u, /U).
+
+ * re.c (rb_kcode): $KCODE handle for UTF-8.
+
+Sat Jan 30 01:51:16 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (rb_ary_delete_if): RTEST() missing.
+
+ * hash.c (delete_if_i): ditto.
+
+ * enum.c (Init_Enumerable): select (=find_all), detect (=find)
+ added as aliases.
+
+Fri Jan 29 21:32:19 1999 WATANABE Tetsuya <tetsu@jpn.hp.com>
+
+ * hash.c (rb_f_setenv): SEGV caused by small typo.
+
+Fri Jan 29 00:15:58 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * lib/parsedate.rb (parsedate): support date format like
+ 23-Feb-93, which is required by HTTP/1.1.
+
+ * variable.c (find_class_path): avoid calling rb_iv_set().
+
+ * eval.c (backtrace): do not need to modify $SAFE internally.
+
+ * variable.c (classname): inline __classid__ access.
+
+ * eval.c (THREAD_ALLOC): needed to initialize wrapper.
+
+ * lib/ftools.rb (makedirs): allows slash at the end of the path.
+
+ * numeric.c (rb_fix_induced_from): ensure result to be Fixnum.
+
+Thu Jan 28 17:31:43 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * numeric.c (flo_to_s): float format changed to "%16.10g".
+
+Thu Jan 28 02:13:11 1999 Yoshinori Toki <toki@freedom.ne.jp>
+
+ * array.c (rb_ary_store): expand allocated buffer by 3/2.
+
+Wed Jan 27 17:50:02 1999 Kazuhiro HIWADA <hiwada@kuee.kyoto-u.ac.jp>
+
+ * bignum.c (dbl2big): raised error if double is too big to cast
+ into long. check added.
+
+Wed Jan 27 03:16:18 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * variable.c (rb_mod_const_at): can't list constants of the
+ untainted objects in safe mode.
+
+ * class.c (method_list): can't list methods of untainted objects
+ in safe mode.
+
+Tue Jan 26 02:40:41 1999 GOTO Kentaro <gotoken@math.sci.hokudai.ac.jp>
+
+ * prec.c: Precision support for numbers.
+
+Thu Jan 21 19:08:14 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_f_raise): calls `exception' method, not `new'.
+
+ * error.c (exc_exception): renamed from `new'.
+
+Wed Jan 20 03:39:48 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (yycompile): rb_in_compile renamed to ruby_in_compile.
+
+ * ruby.c (load_file): define DATA if __END__ appeared in script.
+
+Tue Jan 19 14:57:51 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (here_document): need to protect lex_lastline.
+
+ * parse.y (yylex): disable %//, %'', %``.
+
+Tue Jan 19 05:01:16 1999 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * array.c (beg_len): round range value too much.
+
+Mon Jan 18 13:02:27 1999 Kuroda Jun <jkuro@dwe.co.jp>
+
+ * hash.c (env_keys): strchr() may return NULL.
+
+Mon Jan 18 17:51:47 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * instruby.rb (wdir): install libruby.a in archdir.
+
+ * lib/ftools.rb (install): removes file before installing.
+
+Mon Jan 18 16:55:31 1999 MAEDA shugo <shugo@aianet.ne.jp>
+
+ * eval.c (rb_callcc): experimental continuation support.
+
+Sun Jan 17 19:45:37 1999 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * pack.c (pack_pack): nil packing caused SEGV.
+
+Sat Jan 16 13:18:03 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_concat): character (fixnum) can be append to
+ strings
+
+ * array.c (rb_ary_unshift): unshift returns array.
+
+Sat Jan 16 01:39:19 1999 Yoshida Masato <yoshidam@tau.bekkoame.ne.jp>
+
+ * string.c (rb_str_split_method): UTF-8 support.
+
+ * regex.c: UTF-8 support.
+
+Thu Jan 14 00:42:55 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_gsub_bang): forget to add offset for null match.
+
+ * eval.c (rb_thread_local_aset): can't modify in tainted mode.
+
+ * hash.c (env_each_key): avoid generating temporary array.
+
+Wed Jan 13 23:58:50 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * hash.c (rb_f_setenv): name and value can be tainted.
+
+Wed Jan 6 02:42:08 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * bignum.c (Init_Bignum): forgot to define Bignum#===.
+
+ * gc.c (gc_sweep): if add_heap() is called during GC, objects on
+ allocated heap page(s) are not marked, should not be recycled.
+
+ * gc.c (gc_sweep): should refer latest freelist.
+
+ * gc.c (id2ref): modified to support performance patch.
+
+ * object.c (rb_obj_id): performance patch (no bignum for id).
+
+Tue Jan 5 01:56:18 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * config.guess: merge up-to-date from autoconf 2.12.
+
+ * array.c (rb_ary_join): avoid calling rb_protect_inspect() till
+ it is really needed.
+
+ * object.c (rb_obj_inspect): show detailed information for the
+ instance variables (infinite loop can avoid now).
+
+ * struct.c (rb_struct_inspect): avoid infinite loop.
+
+Sun Jan 3 01:37:58 1999 Takao KAWAMURA <kawamura@ike.tottori-u.ac.jp>
+
+ * misc/ruby-mode.el (ruby-end-of-defun): moved too much.
+
+ * misc/ruby-mode.el (ruby-mode-variables): set paragraph-separator
+ for the mode.
+
+ * misc/ruby-mode.el: proper font-lock for `def' and `nil' etc.
+
+Sat Jan 2 17:09:06 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_jump_tag): new api to invoke JUMP_TAG. tag values
+ can obtained from rb_eval_string_protect()/rb_load_protect().
+
+ * eval.c (rb_rescue): now catches all exceptions but SystemExit.
+
+ * eval.c (rb_eval_string_protect): eval string with protection.
+
+ * eval.c (rb_load_protect): load file with protection.
+
+ * io.c (rb_io_puts): avoid infinite loop for cyclic arrays.
+
+ * eval.c (rb_thread_local_aref): thread local hash tables.
+
+ * object.c (rb_equal): check exact equal before calling `=='.
+
+Thu Dec 31 22:28:53 1998 MAEDA shugo <shugo@aianet.ne.jp>
+
+ * eval.c (rb_f_require): feature names should be provided with
+ DLEXT extension.
+
+ * marshal.c (Init_marshal): need to provide `marshal.so'.
+
+Wed Dec 30 02:29:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * variable.c (classname): do not call rb_ivar_set().
+
+ * eval.c (ruby_run): finalizers were called too early.
+
+Fri Dec 25 12:19:30 1998 Fukuda Masaki <fukuda@wni.co.jp>
+
+ * gc.c (rb_gc_mark): should not return on FL_EXIVAR.
+
+Fri Dec 25 11:56:51 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * gc.c (gc_mark): proper scanning for temporary region.
+
+ * eval.c (TMP_ALLOC): protection for C_ALLOCA was broken.
+
+Thu Dec 24 18:26:04 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * development version 1.3 released.
+
+Thu Dec 24 00:17:00 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_load): top self should be set properly.
+
+ * variable.c (classname): check __classpath__ if it is defined.
+
+ * variable.c (classname): invalid warning at -v with static linked
+ ruby interpreter.
+
+ * eval.c (is_defined): modified for expr::Const support.
+
+ * eval.c (rb_eval): invoke method expr::Const if expr is not class
+ nor module.
+
+ * parse.y (primary): enable expr::identifier as method
+ invocation.
+
+Wed Dec 23 03:04:36 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_match): avoid too many loop pops for (?:..).
+
+Tue Dec 22 18:01:08 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental version 1.1d1 released.
+
+Mon Dec 21 01:33:03 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (TMP_PROTECT): add volatile to ensure GC protection.
+
+ * string.c (rb_str_gsub_bang): calculate buffer size properly.
+
+ * parse.y (lex_get_str): needed to return Qnil at EOS.
+
+ * eval.c (find_file): check policy modified, raise exception
+ immediately for tainted load_path.
+
+ * hash.c (rb_f_setenv): do not depend on setenv() nor putenv().
+
+Thu Dec 17 06:29:23 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/tk/tkutil.c (tk_s_new): use rb_obj_instance_eval(), instead
+ of rb_yield_0().
+
+ * eval.c (rb_f_require): forgot to call find_file in some cases.
+
+ * eval.c (rb_f_require): `require "feature.so"' to load dynamic
+ libraries. old `require "feature.o"' is still OK.
+
+ * eval.c (rb_eval): yield without value dumped core.
+
+Wed Dec 16 16:28:31 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental version 1.1d0 (pre1.2) released.
+
+Wed Dec 16 10:43:34 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_search): bound check before calling re_match().
+
+Tue Dec 15 13:59:01 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * error.c (exc_to_s): returns class name for unset mesg.
+
+ * error.c (exc_initialize): do not initialize @mesg by "".
+
+ * parse.y (nextc): __END__ should handle CR+LF newlines.
+
+Wed Dec 9 13:37:12 1998 MAEDA shugo <shugo@aianet.ne.jp>
+
+ * pack.c (encodes): use buffering for B-encoding.
+
+ * pack.c (pack_pack): Q-encoding by 'M'.
+
+Tue Dec 8 14:10:00 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * variable.c (generic_ivar_get): any object can have instance
+ variables now. great improvement.
+
+ * variable.c (rb_name_class): do not set __classpath__ by default,
+ use __classid__ instead.
+
+Mon Dec 7 22:08:22 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.h (struct RFile): IO objects can have instance variables now.
+
+ * parse.y (primary): allows `def obj::foo; .. end'.
+
+Mon Dec 7 18:24:50 1998 WATANABE Tetsuya <tetsu@jpn.hp.com>
+
+ * ruby.c (set_arg0): $0 support for HP-UX.
+
+Mon Dec 7 01:30:28 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * dln.c (dln_strerror): better error messages on win32.
+
+Sat Dec 5 23:27:23 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (here_document): indentable here-doc delimiter by
+ `<<-'. Proposed by Clemens <c.hintze@gmx.net>. Thanks.
+
+Thu Dec 3 16:50:17 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/extmk.rb.in (realclean): trouble on install.
+
+Sun Nov 29 22:25:39 1998 Takaaki Tateishi <ttate@jaist.ac.jp>
+
+ * process.c (f_exec): check number of argument.
+
+Thu Nov 26 17:27:30 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1c9 released.
+
+Wed Nov 25 13:07:12 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_dup): do not copy additional data (STR_NO_ORIG).
+
+ * parse.y (yycompile): reduce known memory leak (hard to remove).
+
+Wed Nov 25 03:41:21 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * st.c (st_init_table_with_size): round size up to prime number.
+
+Sat Nov 21 23:27:23 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * hash.c (rb_hash_aset): reduce copying key strings.
+
+ * gc.c (looks_pointerp): declare as inline function if possible.
+
+ * st.c (PTR_NOT_EQUAL): compare hash values first before calling
+ comparing function.
+
+ * st.c (ADD_DIRECT): save hash value in entries to reduce hash
+ calculation.
+
+ * string.c (rb_str_gsub_bang): avoid rb_scan_args() to speed-up.
+
+ * string.c (rb_str_sub_bang): ditto.
+
+Sat Nov 21 18:44:06 1998 Masaki Fukushima <fukusima@goto.info.waseda.ac.jp>
+
+ * time.c (time_s_now): had memory leak.
+
+ * ext/md5/md5init.c (md5_new): had memory leak.
+
+ * ext/md5/md5init.c (md5_clone): ditto.
+
+Fri Nov 20 23:23:23 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * lib/delegate.rb: do not propagate hash and eql?.
+
+Thu Nov 19 01:40:52 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * sample/ruby-mode.el (ruby-expr-beg): failed to find reserved
+ word boundary.
+
+ * eval.c (rb_eval): avoid calling `concat' method. calls
+ rb_ary_concat() directly for efficiency.
+
+ * eval.c (rb_eval): actual rest arguments extended arrays too much.
+
+Wed Nov 18 14:30:24 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * class.c (rb_define_global_function): global functions now be
+ module function of the Kernel.
+
+Wed Nov 18 10:48:09 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (read_all): SEGV on large files.
+
+Tue Nov 17 18:11:20 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1c8 released.
+
+Tue Nov 17 16:58:47 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (arg): assignment to attribute name start with capital
+ should be allowed.
+
+ * eval.c (thread_alloc): needed to mark terminated threads too.
+
+Tue Nov 17 12:33:48 1998 Motoyuki Kasahara <m-kasahr@sra.co.jp>
+
+ * ext/extmk.rb.in (create_makefile): Set `libdir' to `@libdir@',
+ Set `pkglibdir' to `$libdir/$(RUBY_INSTALL_NAME)'.
+
+Tue Nov 17 10:30:46 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * sprintf.c (f_sprintf): %l%%c -> %%l%c
+
+Tue Nov 17 01:08:50 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (ret_args): distinguish `a' and `*a' for the arguments
+ of yield and return.
+
+ * eval.c (rb_eval): flip3 should work like sed.
+
+ * eval.c (rb_eval): flip{2,3} now have independent state for each
+ scope to work fine with thread.
+
+Mon Nov 16 23:26:29 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (primary): exec else clause if no exception raised.
+
+Sun Nov 15 15:44:07 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * ext/extmk.rb.in (install): bug in target.
+
+Sat Nov 14 11:02:05 1998 Motoyuki Kasahara <m-kasahr@sra.co.jp>
+
+ * Makefile.in (install): Give the argument `$(DESTDIR)' to
+ `instruby.rb'.
+
+ * instruby.rb: Recognize ARG[0] as `destdir'.
+
+ * instruby.rb: Give the argument `destdir' to `extmk.rb'.
+
+ * ext/extmk.rb.in: Recognize ARG[1] as `$destdir'.
+
+ * instruby.rb: Create the installation directories (bindir, libdir,
+ archdir, pkglibdir, archdir, and mandir) under `destdir', and
+ install all files under there.
+
+ * ext/extmk.rb.in: Likewise.
+
+Sat Nov 14 10:56:55 1998 Motoyuki Kasahara <m-kasahr@sra.co.jp>
+
+ * instruby.rb: Add the variable `pkglibdir'.
+
+ * instruby.rb: Set the variable `libdir' to `$(libdir)', not
+ `$(libdir)/$(ruby_install_name)'. `libruby.so' and `libruby.so.LIB'
+ are installed at `libdir'.
+
+ * instruby.rb: Set the variable `archdir' to `$(pkglibdir)/$(arch)'.
+
+Fri Nov 13 19:43:29 1998 KIMURA Koichi <kbk@kt.rim.or.jp>
+
+ * missing/nt.c (SafeFree): wrong free offset.
+
+Thu Nov 12 20:11:53 1998 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * sample/ruby-mode.el: wrong highlight.
+
+ * parse.y (parse_regx): newline in regexp was ignored.
+
+Wed Nov 11 10:54:57 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (here_document): <<'FOO' should not escape anything.
+
+ * parse.y (here_document): bare << here-doc available, even though
+ it's deprecated.
+
+ * file.c (rb_file_s_readlink): return value should be tainted.
+
+ * ext/etc/etc.c (setup_passwd): information (eg. GCOS name) should
+ be tainted (modified at Perl Conference).
+
+Tue Nov 10 00:22:11 1998 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * configure.in: elf support for FreeBSD 3.x
+
+Tue Nov 10 00:05:43 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (yylex): here document available in eval.
+
+Mon Nov 9 17:55:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1c7 released.
+
+Fri Nov 6 19:25:27 1998 Takao KAWAMURA <kawamura@ike.tottori-u.ac.jp>
+
+ * sample/ruby-mode.el: font-lock patch.
+
+Thu Nov 5 15:42:22 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * sample/README, lib/README: simple description for each file.
+
+Wed Nov 4 18:14:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (assign): attribute assignment should be called as public.
+
+Tue Nov 3 23:36:39 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_dump): dumps core for negative char value.
+
+ * regex.c (re_compile_pattern): out of boundary access for empty
+ regexp.
+
+Mon Nov 2 22:54:01 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_aset): `str[str]' replaces first match.
+
+Mon Nov 2 18:24:33 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (thread_create): was accessing modified status.
+
+Sun Nov 1 01:18:52 1998 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * gc.c (xrealloc): size 0 needs round up to 1.
+
+Sat Oct 31 23:18:34 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_split_method): negative LIMIT means number of
+ split fields are unlimited, as in perl.
+
+ * string.c (rb_str_split_method): if LIMIT is unspecified,
+ trailing null fields are stripped.
+
+Sat Oct 31 04:16:14 1998 Inaba Hiroto <inaba@st.rim.or.jp>
+
+ * string.c (str_aref): regexp index SEGVed.
+
+Fri Oct 30 14:33:47 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (reg_match): returns nil for unmatch.
+
+ * dir.c (dir_entries): new method.
+
+ * eval.c (block_pass): do not push block, substitute it.
+
+Fri Oct 30 01:28:52 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * range.c (range_check): avoid <=> check for Fixnums.
+
+ * array.c (rb_ary_aset): accept negative index.
+
+Wed Oct 28 22:00:54 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_match): access out of boundary fixed.
+
+Wed Oct 28 11:37:42 1998 TAMITO <tommy@valley.ne.jp>
+
+ * io.c (f_select): fd number comparison bug.
+
+Tue Oct 27 23:07:11 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * sample/ruby-mode.el (ruby-parse-region): forgot to support %w()
+ style array literal.
+
+ * eval.c (rb_eval): unused block raises warning.
+
+Mon Oct 26 09:37:53 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (dvar_asgn_push): dvar pushed too many times if
+ variable-in-block first appear in loops.
+
+Sun Oct 25 22:59:27 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (set_list_bits): was using wrong offset.
+
+Thu Oct 22 00:07:11 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_obj_method): method retrieved from tainted object
+ should be tainted too.
+
+ * eval.c (method_call): safe_level should be restored during
+ Method#call.
+
+Wed Oct 21 14:21:06 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (Init_IO): new constants IO::SEEK_{SET,CUR,END}.
+
+ * io.c (rb_f_ungetc): ungetc pushes a char back into STDIN.
+
+Mon Oct 19 11:50:00 1998 Motoyuki Kasahara <m-kasahr@sra.co.jp>
+
+ * ext/extmk.rb: Load '@top_srcdir@/lib/find.rb', not
+ '../lib/find.rb'.
+
+ * ext/extmk.rb: Distinguish between `top_srcdir' and `topdir'.
+
+ * Makefile.in (CFLAGS): Add `-I.'.
+
+ * Makefile.in (lex.c): Give `@srcdir@/keywords' to gperf, not
+ `keywords'.
+
+ * instruby.rb: Use `CONFIG["bindir"]', instead of `prefix + "/bin"'.
+
+ * instruby.rb: Use `CONFIG["libdir"]', instead of `prefix + "/lib"'.
+
+ * instruby.rb Use `CONFIG["mandir"]', instead of `prefix + "/man"'.
+
+ * instruby.rb (wdir): Add the variable to preserve the current
+ working directory.
+
+ * instruby.rb: Chdir to wdir before install `config.h' and
+ `rbconfig.rb'.
+
+Mon Oct 19 10:07:01 1998 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * eval.c (rb_eval): reduce recursive calls to rb_eval().
+
+Fri Oct 16 15:31:45 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * time.c (time_new_internal): timeval must be positive.
+
+Thu Oct 15 13:54:48 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (arg): local variables can be accessed within right side
+ expression in assignment, notably in blocks.
+
+Wed Oct 14 00:18:33 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (Init_Array): Array#=== is now for equal check, not
+ inclusion check.
+
+ * parse.y (when_args): `when a, *b' style new syntax for array
+ expansion in `case'.
+
+Tue Oct 13 14:30:32 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * object.c (rb_obj_untaint): taint marks can be unset.
+
+ * eval.c (rb_eval): taint propagation for embedded strings.
+
+Mon Oct 12 13:27:15 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_call0): check stack depth more frequently.
+
+Mon Oct 12 08:08:30 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_p): can print even in secure mode.
+
+Sun Oct 11 22:50:13 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * variable.c (rb_const_set): taint check for modification.
+
+ * variable.c (rb_ivar_set): taint check for modification.
+
+ * string.c (rb_str_modify): taint check for modification.
+
+ * hash.c (rb_hash_modify): taint check for modification.
+
+ * array.c (rb_ary_modify): taint check for modification.
+
+ * ruby.h (FL_TAINT): taint for all objects, not only strings.
+
+Fri Oct 9 17:01:14 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (read_all): read() returns "" at immediate EOF.
+
+ * io.c (io_read): read(nil) read all until EOF.
+
+Thu Oct 8 13:32:13 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * time.c (time_dump): marshal can dump Time object now.
+
+ * marshal.c (Init_marshal): rename marshal methods `_dump_to' to
+ `_dump', `_load_from' to `_load'.
+
+ * parse.y (rb_intern): "+=".intern generates proper symbol.
+
+Mon Oct 5 18:31:53 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1c6 released.
+
+Fri Oct 2 14:22:33 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_search): `/\s*(--)$/ =~ "- --"' did not match,
+ because of wrong optimize condition.
+
+Mon Oct 1 01:55:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (rb_intern): should not raise exceptions.
+
+ * parse.y (yylex): symbol like `:foo?=' should not be allowed.
+
+ * ext/extmk.rb.in: makes *.a for static link modules.
+
+Wed Sep 30 14:13:06 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_start): supports making a subclass of the
+ Thread class.
+
+Tue Sep 29 17:46:01 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_join): join is now an instance method.
+
+Fri Sep 25 12:01:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (yylex): `@foo!' should be an error.
+
+Thu Sep 24 14:55:06 1998 WATANABE Tetsuya <tetsu@jpn.hp.com>
+
+ * ext/etc/etc.c (Init_etc): wrong field definition.
+
+Thu Sep 17 17:09:05 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (io_reopen): was creating FILE* for wrong fd.
+
+Tue Sep 15 05:28:11 1998 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * regex.c (re_compile_pattern): forgot to fixup for the pattern
+ like (?=(A)|(B)).
+
+Tue Sep 15 01:06:08 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (rb_io_gets_internal): do not set $_ by default, only
+ gets/readline set the variable.
+
+ * eval.c (rb_f_load): load toplevel class is set to anonymous
+ module if safe_level >= 5, to encapsulate modification.
+
+ * eval.c (rb_f_load): set frame properly.
+
+ * string.c (rb_str_each_line): do not set $_.
+
+Mon Sep 14 14:42:27 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_match): beginning and end of the string, do not
+ automatically match `\b'.
+
+ * string.c (scan_once): consume at least on character.
+
+ * regex.c (re_search): wrong behavior for negative range.
+
+Sat Sep 12 21:21:26 1998 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * regex.c (re_search): range value should be maintained.
+
+Thu Sep 10 10:55:00 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (backref_error): yyerror does not understand formats.
+
+Tue Sep 8 18:05:33 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1c5 released.
+
+Tue Sep 8 10:03:39 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (str_each_line): wrong line splitting with newline at
+ top of the string.
+
+ * string.c: non bang methods return copied string.
+
+ * eval.c (f_END): needed to initialize frame->argc;
+
+Fri Sep 4 11:27:40 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * bignum.c (bigadd): proper sign combination.
+
+ * regex.c (re_search): wrong return value for \A.
+
+Thu Sep 3 14:08:14 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1c4 released.
+
+Tue Sep 1 10:47:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (slow_search): do not compare llen and blen. llen may
+ be longer than blen, if little contains 0xff.
+
+ * regex.c (mbctab_euc): set 0x8e as multibyte character.
+
+ * string.c (str_inspect): mask character for octal output.
+
+Mon Aug 31 15:32:41 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_search): use calculated offset if exactn is the
+ first opcode in the compiled regexp.
+
+ * regex.c (bm_search): use Boyer-Moore search for simple search.
+
+ * regex.c (must_instr): wrong length check if pattern includes
+ byte escape by 0xff.
+
+ * regex.c (re_compile_pattern): need not to check current_mbctype.
+
+Sat Aug 29 16:31:40 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_check_safe_str): avoid calling rb_id2name() in normal
+ cases to speed-up.
+
+ * eval.c (thread_raise): do not save context of terminated thread.
+
+ * regex.c (re_compile_pattern): mask \nnn over 256.
+
+Sat Aug 29 02:09:46 1998 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * sprintf.c (f_sprintf): wrong buffer size check.
+
+Fri Aug 28 01:57:04 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_pattern): accepts (?ix-ix) and (?ix-ix:...).
+
+Fri Aug 28 12:25:33 1998 Hiroshi Igarashi <igarashi@ueda.info.waseda.ac.jp>
+
+ * ruby.c (ruby_require_modules): load modules in appearing order.
+
+Fri Aug 28 01:57:04 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_pattern): accepts (?ix-ix) and (?ix-ix:...).
+
+Thu Aug 27 12:54:28 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1c3 released.
+
+Wed Aug 26 14:40:56 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_eval): check whether ruby_class is properly set,
+ before accessing it.
+
+ * eval.c (rb_obj_instance_eval): ruby_class should be Qnil for
+ special objects like Fixnums.
+
+ * ext/tkutil/tkutil.c (Init_tkutil): removes calls to
+ rb_yield_0(). used instance_eval() instead in the tk.rb.
+
+Wed Aug 26 11:47:00 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_match): pop non-greedy stack elements on success.
+
+Wed Aug 26 09:25:35 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * ruby.h: add #define environ for cygwin32.
+
+Tue Aug 25 08:57:41 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (rb_ary_sort_bang): temporarily freeze sorting array.
+
+Mon Aug 24 18:46:44 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * dln.c (dln_find_1): path check was too strict.
+
+Mon Aug 24 15:28:11 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * parse.y (f_arglist): opt_nl added after f_args.
+
+Fri Aug 21 01:06:01 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/socket/socket.c: grand renaming on socket.c.
+
+ * ext/socket/socket.c (inet_aton): supply inet_aton for those
+ systems that do not have it.
+
+ * ext/socket/socket.c (setipaddr): use inet_aton instead of
+ inet_addr.
+
+ * ext/socket/socket.c (tcp_s_gethostbyname): new method: works
+ like Socket.gethostbyname but returning array contains ip-addrs
+ as octet decimal string format like "127.0.0.1".
+
+ * ext/socket/socket.c (mkhostent): return format changed to
+ [host, aliases, type, ipaddr..] as documented.
+
+Wed Aug 19 00:31:09 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (io_ctl): forgot to place TRAP_END at right position.
+
+Fri Aug 14 11:01:47 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (call_trace_func): save __FILE__, __LINE__ before
+ executing trace_func, since trace function should not corrupt
+ line number information.
+
+Thu Aug 13 15:09:02 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (ary_s_new): was marking unallocated region on GC.
+
+Tue Aug 11 11:57:35 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1c2 released.
+
+Mon Aug 10 14:05:30 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * process.c (f_system): removed fflush(stdin).
+
+Fri Aug 7 17:44:44 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * error.c (err_snprintf): replace sprintf for fixed sized buffer,
+ with snprintf to avoid buffer over-run. For systems which does
+ dot provide snprintf, missing/snprintf.c added.
+
+Wed Aug 5 00:47:35 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (rb_reg_search): recycle match object.
+
+Mon Aug 3 09:17:55 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_gsub_bang): do not allocate temporary string.
+
+ * string.c (rb_str_sub_bang): use inline replace.
+
+Wed Jul 29 00:36:08 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * hash.c (hash_s_new): the default value can be specified.
+
+ * hash.c (hash_default): method to set the default value.
+
+ * hash.c (hash_aref): now returns the default value.
+
+Tue Jul 28 13:03:25 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (ary_s_new): argument to specify initial value is added.
+
+ * array.c (ary_s_new): specifies size, not capacity.
+
+Mon Jul 27 12:39:34 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (str_replace): zero fill for expansion gap.
+
+ * regex.c (mbctab_euc): set flags on for 0xA1-0xFE. suggested by
+ <inaba@st.rim.or.jp>.
+
+ * string.c (str_inspect): consider current_mbctype.
+
+Sun Jul 26 15:37:11 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * array.c (ary_s_new): Array.new(1<<30) dumps core.
+
+Fri Jul 24 13:40:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1c1 released.
+
+Fri Jul 24 02:10:22 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * marshal.c (r_bytes2): allocated buffer size was too short.
+
+ * marshal.c (w_object): saves all options, not only casefold flag.
+
+ * re.c (reg_clone): now copies options properly.
+
+ * re.c (reg_get_kcode): code number was wrong.
+
+Thu Jul 23 13:11:32 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_attr): argument should be symbol or string.
+
+Wed Jul 22 11:59:34 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (calculate_must_string): wrong offset added.
+
+Wed Jul 22 11:59:59 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * st.c (rehash): still had a GC problem. fixed.
+
+Tue Jul 21 13:19:30 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (gc_mark_threads): crashed on GC before thread allocation.
+
+ * st.c (rehash): GC during rehash caused SEGV.
+
+Tue Jul 21 01:25:10 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * sprintf.c (f_sprintf): integer formatter totally re-written.
+
+ * sprintf.c (remove_sign_bits): support uppercase hexadecimal.
+
+Sat Jul 18 00:14:13 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * sprintf.c (f_sprintf): proper sign position for %X and %O.
+
+Fri Jul 17 14:10:20 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1c0 released.
+
+Fri Jul 17 08:01:49 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * process.c (f_exec): Check_SafeStr() added.
+
+ * process.c (f_system): Check_SafeStr() moved before fork().
+
+Thu Jul 16 22:58:48 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (scan_once): substrings to the block should not be
+ tainted. use reg_nth_match(), not str_substr().
+
+ * string.c (str_substr): needed to transfer taint.
+
+Thu Jul 16 16:15:57 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * gc.c (xmalloc): object allocation count added to GC trigger.
+
+ * eval.c (thread_save_context): avoid marking uninitialized stack
+ in thread_mark. GC may be triggered by REALLOC_N().
+
+Wed Jul 15 15:11:57 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_31.
+
+Wed Jul 15 15:05:27 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (thread_create): exit() and abort() in threads now
+ forwarded to main_thread.
+
+Tue Jul 14 14:03:47 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * variable.c (obj_instance_variables): list names that is not
+ instance variables.
+
+ * gc.c (GC_MALLOC_LIMIT): choose smaller limit value.
+
+Mon Jul 13 12:39:38 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * object.c (str2cstr): should not return NULL.
+
+Fri Jul 10 11:51:46 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (gettable): needed to add dyna_in_block() check.
+
+Thu Jul 9 17:38:23 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_30.
+
+Thu Jul 9 16:01:48 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * sprintf.c (fmt_setup): format specifier for long needed.
+
+ * sprintf.c (f_sprintf): ditto.
+
+ * numeric.c (fix2str): ditto.
+
+ * eval.c (thread_create): no more ITIMER_REAL.
+
+ * eval.c (thread_create): thread finalization needed before
+ aborting thread if thread_abort is set.
+
+Wed Jul 8 18:17:33 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * bignum.c (big_pow): abandon power by bignum (too big).
+
+Tue Jul 7 13:58:43 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_catch): add C level catch/throw feature.
+
+Mon Jul 6 15:18:09 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (arg): proper return values for `||=' and `&&='.
+
+Fri Jul 3 16:05:11 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_29.
+
+Fri Jul 3 11:20:46 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * marshal.c (r_byte): byte should not extend sign bit.
+
+ * numeric.c (fix_mul): use FIX2LONG() instead of FIX2INT() for
+ 64bit architectures.
+
+ * marshal.c (r_bytes): remove weird casting between pointer and int.
+
+ * process.c (proc_setsid): new method Process#setsid().
+
+Thu Jul 2 12:49:21 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * marshal.c (w_object): remove `write_bignum' label for 64bit
+ architectures.
+
+ * marshal.c (r_bytes): needs int, not long.
+
+Wed Jul 1 14:21:06 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * numeric.c (flo_plus): should not allow addition with strings.
+
+Wed Jul 1 13:09:01 1998 Keiju ISHITSUKA <keiju@rational.com>
+
+ * numeric.c (num_uminus): wrong coerce direction.
+
+Tue Jun 30 10:13:44 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (f_p): accepts arbitrary number of arguments.
+
+ * eval.c (rb_yield_0): there's some case that iterator_p() returns
+ true even if the_block was not set. check added.
+
+Tue Jun 30 01:05:20 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (BEGIN_CALLARGS): adjust the_block before evaluating the
+ receiver's value and the arguments.
+
+Fri Jun 26 18:02:50 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_28.
+
+Fri Jun 26 11:01:26 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * string.c (str_aset_method): needed to convert to string.
+
+Thu Jun 25 02:05:50 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_search): optimize for `.*' at beginning of the
+ pattern.
+
+ * regex.c (re_search): optimize for character class repeat at
+ beginning of the pattern.
+
+ * regex.c (re_compile_pattern): detect optimization potential for
+ the compiled patterns.
+
+Thu Jun 25 00:02:26 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * re.c (reg_s_new): flag value was wrong.
+
+Wed Jun 24 23:45:06 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_search): wrong anchor handling for reverse search.
+
+Wed Jun 24 02:18:57 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (mlhs): `((a,b)),c = [[1,2]],3' assigns a=1,b=2,c=3.
+
+Tue Jun 23 11:46:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (yylex): `&&=' and `||=' added.
+
+Sat Jun 20 02:53:50 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (assignable): nesting local variables should have higher
+ priority than normal local variables for assignment too.
+
+Fri Jun 19 18:28:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_27.
+
+Fri Jun 19 14:34:49 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (assign): support hack for nested multiple assignment.
+
+ * parse.y (mlhs): nested multiple assignment.
+
+ * eval.c (rb_eval): in-block variables now honors static scope.
+
+ * configure.in: RSHIFT check moved to configure.
+
+Thu Jun 18 16:46:04 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_26.
+
+Thu Jun 18 13:37:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * file.c (file_s_ftype): uses lstat(2) instead of stat(2).
+
+ * dir.c (dir_s_glob): there can be buffer overrun, check added.
+
+ * eval.c (f_binding): handles in-block variables declared after
+ binding's generation.
+
+ * numeric.c (flo_floor): floor, ceil, round added to Float.
+
+Wed Jun 17 11:20:00 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (gettable): nesting local variables should have higher
+ priority than normal local variables.
+
+Tue Jun 16 12:30:46 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * bignum.c (str2inum): handles `+ddd'.
+
+ * struct.c (make_struct): name parameter can be nil for unnamed
+ structures.
+
+Mon Jun 15 16:30:10 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * object.c (class_s_inherited): prohibiting to make subclass of
+ class Class.
+
+ * object.c (module_s_new): support for making subclass of Module.
+
+ * parse.y (yycompile): clear eval_tree before compiling.
+
+Fri Jun 12 17:58:18 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (eval): write back the_dyna_var into the block.
+
+Thu Jun 11 18:19:18 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_25.
+
+ * eval.c (dvar_add_compiling): register dyna_var at compile time.
+
+ * regex.c (re_compile_pattern): RE_DUP_MAX iteration is too big.
+
+Wed Jun 10 15:12:04 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (io_eof): do not block other threads.
+
+ * signal.c (trap): reserve SIGALRM for thread.
+
+ * eval.c (thread_create): use ITIMER_REAL also to avoid system
+ call blocking.
+
+ * io.c (f_syscall): add TRAP_BEG, TRAP_END around system calls.
+
+ * io.c (io_ctl): add TRAP_BEG, TRAP_END around system calls.
+
+ * enum.c (enum_collect): did not collect false values.
+
+ * array.c (ary_new2): forgot to initialize capa field.
+
+Tue Jun 9 18:36:15 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * string.c (str_split_method): split dumped core for "\xff".
+
+Tue Jun 9 16:22:12 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_24.
+
+Tue Jun 9 16:04:07 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * ext/kconv/kconv.c (kconv_guess): more precise decision for EUC,
+ using jless algorithm (3 sequential EUC hiragana characters).
+
+Tue Jun 9 15:12:44 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/kconv/kconv.c (kconv_guess): wrong guess for EUC as SJIS in
+ some cases (0xe0 - 0xef).
+
+ * gc.c (xmalloc): insert size check for big (negative in signed)
+ allocation size.
+
+Tue Jun 9 02:54:51 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * lib/parsedate.rb: wday moved to the last in the return values.
+
+Mon Jun 8 10:40:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (str_split_method): split dumped core for "\0".
+
+Sat Jun 6 22:50:52 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (calculate_must_string): wrong condition for
+ {start,stop}_nowidth.
+
+ * regex.c (re_match): various features imported from GNU regex.c
+ 0.12, such as nested grouping, avoiding infinite loop with empty
+ match, etc.
+
+ * regex.c (register_info_type): now use union.
+
+ * regex.c (re_search): more precise anchor(^) check.
+
+Wed Jun 3 18:07:54 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (reg_raise): check rb_in_compile, not rb_in_eval.
+
+Mon Jun 1 05:26:06 1998 WATANABE Tetsuya <tetsu@jpn.hp.com>
+
+ * string.c (trnext): casting to signed char* needed.
+
+Tue Jun 2 16:00:12 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/socket/socket.c (udp_addrsetup): error check enhanced.
+
+ * ext/socket/socket.c (sock_s_getservbyaname): use strtoul(), if
+ possible.
+
+Sat May 30 07:10:02 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (reg_prepare_re): no more needless regular expression
+ recompile on casefold conditions.
+
+Thu May 28 18:02:55 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * object.c (nil_plus): no more `+' method for nil.
+
+Wed May 27 17:33:46 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * hash.c (hash_fetch): new method.
+
+ * regex.c (re_search): check whether translate table is set.
+
+Tue May 26 11:39:50 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_23.
+
+ * parse.y (yylex): no UPLUS/UMINUS for 1st argument if
+ parenthesises are omitted.
+
+Tue May 26 01:09:55 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_pattern): (?XI) for turns off the
+ corresponding option.
+
+Mon May 25 12:38:56 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_pattern): inline i option (?i).
+
+ * regex.c (re_compile_pattern): inline x option (?x).
+
+ * regex.c (re_compile_pattern): x option for regexp.
+
+ * dir.c (dir_s_open): returns block's evaluated value.
+
+ * io.c (f_open): returns block's evaluated value.
+
+ * ext/curses/curses.c (curses_addstr): nil argument caused SEGV.
+
+Fri May 22 11:52:45 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_pattern): push mark on (?:), so that
+ laststart check for {a,b} can be done.
+
+Thu May 21 17:31:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_match): wrong match (too non-greedy) for `{a,b}?'.
+
+ * io.c (io_lineno): new method IO#lineno, IO#lineno=.
+
+Wed May 20 06:04:43 1998 MAEDA shugo <shugo@aianet.ne.jp>
+
+ * BeOS patch.
+
+Wed May 20 16:32:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * bignum.c (BIGDN): use RSHIFT(), instead of mere `>>'.
+
+Tue May 19 16:36:26 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_22.
+
+Tue May 19 16:31:57 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (assignable): specification changed for in-block
+ variable definition.
+
+ * eval.c (dyna_var_asgn): error in in-block variables' compile
+ time definition.
+
+ * parse.y (str_extend): wrong nesting detection.
+
+Tue May 19 09:47:55 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * numeric.c (num2int): re-defined (extensions may use this).
+
+Mon May 18 16:40:50 1998 MAEDA shugo <shugo@aianet.ne.jp>
+
+ * error.c (get_syserr): BeOS support.
+
+ * configure.in: modified for BeOS.
+
+ * string.c (str_dump): do not call isascii().
+
+ * sprintf.c (remove_sign_bits): forgot to initialize end pointer.
+
+ * glob.c: #include <alloca.h> added.
+
+Mon May 18 14:52:21 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_21.
+
+Mon May 18 03:27:57 1998 MAEDA shugo <shugo@aianet.ne.jp>
+
+ * file.c (file_s_expand_path): optional second argument
+ `default_directory' added.
+
+Sat May 16 22:06:52 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * error.c (RAISE_ERROR): wrong error message
+
+Fri May 15 14:43:25 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_20.
+
+Thu May 14 14:44:21 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * sun4 cc patches for intern.h and regex.h.
+
+Thu May 14 14:03:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * random.c (RANDOM_MAX): guessing proper maximum value for random
+ numbers.
+
+ * random.c (f_rand): use drand48 if possible.
+
+Wed May 13 19:05:20 1998 MAEDA shugo <shugo@aianet.ne.jp>
+
+ * BeOS patches for io.c, error.c and config.guess.
+
+Wed May 13 14:56:23 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_19.
+
+ * most of the Mac and BeOS patches merged, except path separators.
+
+ * error.c (err_append): generated SyntaxError was String.
+
+ * ruby.h: xxx2INT, xxx2UINT checks values as int, not long.
+
+ * ruby.h: remove typedef's. INT, UINT, UCHAR, USHORT.
+
+Tue May 12 17:38:00 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_18.
+
+Tue May 12 11:38:08 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * error.c (syserr_errno): returns errno of the SystemCallError.
+
+ * error.c (rb_sys_fail): saves errno in the Exception.
+
+ * error.c (set_syserr): no need to protect syserr_list.
+
+ * error.c (rb_sys_fail): no more bufsize limit.
+
+ * error.c (set_syserr): integer value of errno can be accessed by
+ Errno::EXXX::Errno.
+
+Sun May 10 03:10:33 1998 WATANABE Tetsuya <tetsu@jpn.hp.com>
+
+ * io.c (io_tell etc.): moved from File class to IO class.
+
+Fri May 8 12:26:37 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * pack.c (pack_unpack): should be unsigned int (was signed int).
+
+Thu May 7 16:34:10 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * pack.c (pack_pack): `V', `N' uses newly created NUM2UINT().
+
+ * ruby.h (NUM2UINT): new macro.
+
+ * bignum.c (big2uint): try to convert bignum into UINT.
+
+ * re.c (reg_match): needed to return false for match with nil.
+
+ * gc.c (obj_free): wrong condition to free string.
+
+Wed May 6 21:08:08 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * ruby.c (ruby_process_options): modified for DJGPP.
+
+Wed May 6 15:48:03 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_17.
+
+Wed May 6 01:37:39 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c: remove global variable `errat'.
+
+ * eval.c (rb_longjmp): embed error position information in the
+ exception object.
+
+Sat May 2 12:20:02 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (reg_search): supports reverse search.
+
+ * string.c (str_index_method): does update $~ etc.
+
+ * eval.c (f_load): needed to clear the_dyna_vars.
+
+ * eval.c (dyna_var_asgn): do not push dyna_var, which is id == 0.
+
+ * error.c (Init_Exception): NotImplementError is no longer
+ StandardError, which is not handled by default rescue.
+
+Fri May 1 00:35:51 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c (proc_options): `-d' turns on verbose flag too.
+
+ * error.c (exception): last argument may be the superclass of the
+ defining exception(s).
+
+ * io.c (Init_IO): EOFError is now subclass of the IOError.
+
+ * io.c (Init_IO): forgot to define IOError.
+
+ * error.c (Init_Exception): old Exception class renamed to
+ StandardError. Exception now replaces old GlobalExit.
+
+ * error.c (Init_Exception): Exception is now the root of the
+ Global Exits. There's no longer GlobalExit class.
+
+ * util.c (ruby_mktemp): check TMP, TMPDIR first.
+
+Thu Apr 30 01:08:35 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * lib/tk.rb: call 'unknown', if proc not defined.
+
+ * eval.c (handle_rescue): default rescue handles `Exceptional' not
+ only the instance of the `Exception's.
+
+ * eval.c (f_raise): exception can be any object.
+
+ * time.c (time_gm_or_local): call time_gmtime or time_localtime.
+
+ * eval.c (f_raise): raises TypeError if the class which is not a
+ subclass of String is specified (checked in exc_new()).
+
+ * error.c (exc_new): need to check whether invalid class (not a
+ subclass of String) is specified.
+
+Wed Apr 29 21:05:44 1998 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * ruby.c (proc_options): option '-e' via tempfile.
+
+Tue Apr 28 15:27:58 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_16.
+
+Tue Apr 28 00:07:38 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (obj_is_proc): type check predicate.
+
+ * eval.c (obj_is_block): ditto.
+
+Mon Apr 27 16:59:17 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/gtk/gtk.c (Init_gtk): use timeout, not idle to avoid
+ consuming CPU too much.
+
+ * lib/tk.rb: use tcltklib#_invoke instead of `_eval'.
+
+Mon Apr 27 16:59:17 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (ary_sort): use dup, not clone.
+
+Mon Apr 27 13:46:27 1998 Tadahiro Maebashi <maebashi@iij.ad.jp>
+
+ * ext/tcltklib/tcltklib.c (ip_invoke): invoke tcl command
+ directly. need not worry about escaping tcl characters.
+
+Mon Apr 27 12:04:43 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * random.c (f_rand): do not call srand() implicitly.
+
+Fri Apr 24 14:35:45 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_15.
+
+ * parse.y (assignable): dyna_var_asgn actually defines nested
+ local variables in outer context.
+
+ * random.c (f_rand): call srand(), if it has not called yet.
+
+ * random.c (f_srand): use tv_usec as the default seed.
+
+ * eval.c (rb_eval): values of nested local variables should be
+ independent.
+
+ * eval.c (rb_yield_0): local variables wrong nested conditions.
+
+Wed Apr 22 23:27:17 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (select_get_io): get IO object by `to_io'.
+
+ * io.c (io_to_io): method to retrieve IO object, from delegating
+ object for example.
+
+Wed Apr 22 16:52:37 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_14.
+
+ * string.c (str_modify): check for embedded pointer reference.
+
+ * gc.c (obj_free): ditto.
+
+ * pack.c (pack_pack): p/P template to embed pointers.
+
+Wed Apr 22 00:07:10 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * array.c (ary_rindex): embarrassing typo.
+
+Tue Apr 21 12:31:48 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_13.
+
+ * configure.in (RUBY_LIB): supports --program-{prefix,suffix}.
+
+ * array.c (ary_rindex): new method.
+
+ * io.c (io_binmode): should return self.
+
+Tue Apr 21 08:23:04 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * parse.y (here_document): calling parse_string with wrong
+ arguments.
+
+ * struct.c (struct_aset): problem member assignment with name.
+
+Mon Apr 20 14:47:49 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_12.
+
+ * time.c (time_arg): args may be string (support for reduced
+ implicit type conversion).
+
+ * lib/base64.rb: changed to use pack/unpack with `m' template.
+
+Mon Apr 20 06:23:20 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * variable.c (mod_remove_const): new method.
+
+Sat Apr 18 03:53:27 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * hash.c (hash_each_with_index): removed. use Enumerable's
+ each_with_index instead.
+
+ * class.c (rb_include_module): check for super modules, since
+ module's included modules may be changed.
+
+Fri Apr 17 21:50:47 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * marshal.c (r_long): r_byte() may return signed byte.
+
+Fri Apr 17 11:58:30 1998 NAGAI Hidetoshi <nagai@dumbo.ai.kyutech.ac.jp>
+
+ * ext/tcltklib/tcltklib.c (lib_mainloop): thread and interrupt check.
+
+Fri Apr 17 11:06:30 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (find_file): try to fopen() to check whether file exists.
+
+ * ruby.c (load_file): ditto.
+
+ * struct.c (struct_aset): struct member can be set by member name.
+
+Fri Apr 17 00:47:19 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * ext/extmk.rb.in: added m68k-human support
+
+ * file.c (LOCK_SH): defines moved.
+
+ * array.c (ary_flatten_bang): simplified loop.
+
+Thu Apr 16 16:52:01 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_11.
+
+ * lib/tk.rb: thread support (experimental - maybe slow).
+
+ * eval.c (rb_longjmp): trace event on exception in raising
+ context, just before raising exception.
+
+ * struct.c (struct_s_members): forgot to check singletons.
+
+ * struct.c (struct_aref): members can be accessed by names too.
+
+ * array.c (ary_flatten): new method.
+
+ * eval.c (rb_longjmp): prints exception information with `-d'.
+
+ * object.c (any_to_s): remove class name restriction.
+
+Thu Apr 16 01:38:02 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * file.c (thread_flock): do not block other threads.
+
+ * eval.c (thread_trap_eval): signals are now delivered to the
+ current thread again. In case that the current thread is dead,
+ signals are forwarded to the main thread.
+
+ * string.c (str_new4): need not to duplicate frozen strings.
+
+Wed Apr 15 08:33:47 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * struct.c (struct_inspect): remove restriction for struct names.
+
+Wed Apr 15 02:55:02 1998 Kazuya 'Sharl' Masuda <sharl@www.ufo.co.jp>
+
+ * x68 patches to config.sub, ext/extmk.rb.in
+
+Wed Apr 15 01:22:56 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (str_dup_frozen): do not duplicate frozen strings.
+
+ * parse.y (yylex): allow nested parenthesises.
+
+ * io.c (obj_displayln): prints newline after `display'ing the
+ receiver.
+
+ * io.c (io_puts): avoid generating "\n" each time. use RS_default
+ instead.
+
+ * io.c (f_p): ditto.
+
+Tue Apr 14 22:18:17 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * struct.c (struct_aref): should not subtract negative index.
+
+Tue Apr 14 11:34:50 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_10.
+
+ * parse.y: token names prefixed by `t'.
+
+ * struct.c (struct_s_def): supports subclassing of Struct.
+
+ * io.c (io_s_new): supports subclassing of IO.
+
+Mon Apr 13 11:07:39 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (f_binding): need to restore method name.
+
+ * eval.c (rb_call0): raises SystemStackError, not Fatal.
+
+ * io.c (obj_display): same as `print self'.
+
+ * io.c (f_p): can now be called in the method form.
+
+ * re.c (reg_regsub): needed to be mbchar aware.
+
+Mon Apr 13 13:18:32 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (thread_trap_eval): all signals delivered to main_thread.
+
+Mon Apr 13 12:47:03 1998 TAKAHASHI Masayoshi <maki@inac.co.jp>
+
+ * re.c (kcode_set_option): did not set SJIS on SJIS condition.
+
+Sun Apr 12 22:14:07 1998 Kazunori NISHI <kazunori@swlab.csce.kyushu-u.ac.jp>
+
+ * array.c (ary_uniq_bang): should be `==', not `='. embarrassing.
+
+Sat Apr 11 02:13:30 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (ary_subseq): SEGVed for `[][1,1]'.
+
+Fri Apr 10 21:29:06 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * array.c (ary_subseq): add check for beg larger than array length.
+
+Wed Apr 8 17:24:11 1998 MAEDA shugo <shugo@po.aianet.ne.jp>
+
+ * dir.c (dir_s_open): can be called with block (like IO#open).
+
+ * dir.c (dir_s_chdir): print directory path on error.
+
+ * dir.c (dir_s_chroot): ditto
+
+ * dir.c (Init_Dir): needed to override `new'.
+
+Thu Apr 9 18:24:58 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_09.
+
+ * string.c (str_cmp): do not depend on sentinel at the end of the
+ strings.
+
+ * string.c (str_chomp_bang): forgot to set the sentinel.
+
+Wed Apr 8 00:59:13 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * bignum.c (big2int): converted int may be too big to fit in
+ signed int.
+
+ * parse.y (arg): `foo += 1' should not cause an error.
+
+ * variable.c (rb_const_defined): returned false even if the
+ constant is defined at the top level.
+
+ * eval.c (f_local_variables): dyna_var->id may be null. should
+ have checked before calling str_new2().
+
+Tue Apr 7 01:15:15 1998 Kaneko Naoshi <wbs01621@mail.wbs.or.jp>
+
+ * re.c (reg_regsub): need to check string boundary.
+
+Tue Apr 7 19:19:12 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (str_cmp): returns either 1, 0, -1.
+
+ * array.c (ary_cmp): should check array length, too
+
+Tue Apr 7 18:50:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_08.
+
+Tue Apr 7 18:31:27 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * instruby.rb (mandir): dll installation for cygwin32
+
+Tue Apr 7 01:16:45 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * config.sub (maybe_os): TOWNS support?
+
+ * config.guess: too strict check for libc versions on linuxes.
+
+ * experimental release 1.1b9_07.
+
+ * array.c (ary_cmp): compare each element using `<=>'.
+
+ * hash.c (hash_each_with_index): yields [value, key] pair.
+
+ * class.c (class_protected_instance_methods): list protected
+ method names.
+
+ * class.c (ins_methods_i): exclude protected methods.
+
+ * eval.c (PUSH_BLOCK): dynamic variables can be accessed from
+ eval() with bindings.
+
+Mon Apr 6 14:49:06 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (thread_yield): must return evaluated value.
+
+Fri Apr 3 13:07:29 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (thread_schedule): context switch bypassed on wrong
+ conditions.
+
+ * variable.c (rb_name_class): set classname by id before String
+ class is initialized (1.0 behavior restored).
+
+Fri Apr 3 11:25:45 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * numeric.c (num2int): no implicit conversion from string.
+
+ * numeric.c (num2int): check whether `to_i' returns an Integer.
+
+ * numeric.c (num_zero_p): new method.
+
+ * numeric.c (num_nonzero_p): new method. returns the receiver if
+ it's not zero.
+
+ * eval.c (obj_instance_eval): the_class should be the object's
+ singleton class.
+
+ * error.c (exc_s_new): message is converted into a string.
+
+Thu Apr 2 18:31:46 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (obj_call_init): every object call `initialize'.
+
+Wed Apr 1 08:51:53 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * parse.y (stmt): UNTIL_MOD should be for stmt, not only for expr.
+
+Wed Apr 1 01:20:31 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * object.c (true_and): boolean operators &, | and ^.
+
+Tue Mar 31 13:23:58 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (ary_compact_bang): returns nil, if it does not modify
+ the array like String's bang methods.
+
+ * array.c (ary_uniq_bang): new method to remove duplicate items.
+
+ * eval.c (bind_s_new): new method.
+
+ * numeric.c (num2int): raise exception if Fixnums too big to
+ convert into `int' in case that sizeof(int) < sizeof(INT).
+
+ * string.c (str_center): SEGV on negative width.
+
+ * eval.c (eval): forgot to set sourcefile.
+
+Mon Mar 30 11:12:29 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * file.c (f_test): raises exception for unknown command.
+
+ * eval.c (Init_eval): `class_eval': alias to the module_eval.
+
+Mon Mar 30 18:50:42 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * string.c (str_capitalize_bang): did not check string modification.
+
+ * string.c (str_delete_bang): wrong conversion.
+
+ * string.c (str_intern): typo in error message.
+
+Mon Mar 30 01:44:13 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (obj_instance_eval): accepts block as evaluation body.
+ No compilation needed each time.
+
+ * eval.c (mod_module_eval): ditto
+
+ * file.c (file_s_umask): umask did not return old values, if no
+ argument given.
+
+Sun Mar 29 00:54:23 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (f_throw): nil returned always.
+
+Sat Mar 28 20:40:12 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_06.
+
+Sat Mar 28 16:07:11 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * io.c (io_closed): should not cause exception for closed IO.
+
+ * string.c (str_tr): returned nil for success.
+
+Sat Mar 28 00:47:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (f_local_variables): new method to return an array of
+ local variable names.
+
+ * variable.c (obj_instance_variables): now returns an array of
+ variable names, as described in the reference.
+
+ * eval.c (rb_attr): honors default method visibility of the
+ current scope.
+
+Fri Mar 27 13:49:27 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_05.
+
+ * ruby.c (ruby_prog_init): `site_ruby' added to load_path.
+
+ * ruby.c (ruby_prog_init): load-path order changed. Paths in
+ the RUBYLIB environment variable comes first in non-tainted
+ mode.
+
+Thu Mar 26 11:51:09 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_call): new feature: `protected' methods.
+
+ * string.c (str_dump): new method.
+
+ * eval.c (block_pass): block argument can be nil, which means no
+ block is supplied for the method.
+
+Wed Mar 25 21:20:13 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * string.c (str_reverse_bang): string copied to wrong place.
+
+Wed Mar 25 08:12:07 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * numeric.c (flo_modulo): caused SEGV if left operand is not a
+ float value.
+
+ * eval.c (f_eval): optional third and fourth argument to specify
+ file-name and line-number.
+
+ * eval.c (eval): file-name and line-number set properly.
+
+ * parse.y (assign_in_cond): literal assignment is now warning, not
+ compile error.
+
+ * error.c (Warn): Warn() always print message, OTOH Waring()
+ prints when verbose flag is set.
+
+Tue Mar 24 12:50:06 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c (ruby_prog_init): `.' should come last in the load-path.
+
+ * eval.c (Init_eval): `__send__', alias for `send'.
+
+Mon Mar 23 12:44:12 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (str_chomp_bang): now takes `rs' as an argument.
+
+ * eval.c (thread_free): main_thread should not be freed.
+
+Fri Mar 20 16:40:34 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (str_chomp_bang): chomp! (and other ! methods) returns
+ nil if it does not modify the string.
+
+ * string.c (str_sub_iter_s): should check last pattern since it
+ may be matched to null.
+
+Thu Mar 19 13:48:55 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_04.
+
+ * parse.y (yylex): `10e0.9' should cause syntax error.
+
+Wed Mar 18 17:46:31 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c (load_file): new file object constant DATA. Only
+ available for the script from the file.
+
+ * regex.c (re_match): forwarding failure point popped too much.
+
+Tue Mar 17 18:23:06 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * math.c (math_frexp): newly added.
+
+ * math.c (math_ldexp): ditto.
+
+ * bignum.c (bigdivmod): calculates modulo.
+
+ * numeric.c (fix_remainder): returns reminder, formerly introduced
+ as modulo.
+
+ * numeric.c (fix_modulo): calculates proper `modulo'.
+
+ * bignum.c (bigdivmod): wrong sign for reminder.
+
+Mon Mar 16 17:07:28 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_03.
+
+Mon Mar 16 16:33:53 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * io.c (pipe_finalize): needed to add pipe_finalize to pipes on
+ cygwin32.
+
+Mon Mar 16 14:11:06 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * class.c (ins_methods_i): needed to consider NOEX_UNDEF.
+
+Mon Mar 16 13:23:53 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * io.c (io_check_closed): check for `fptr->f2 == NULL'.
+
+ * io.c (io_fptr_close): ditto.
+
+Mon Mar 16 11:49:25 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (pipe_atexit): free()ing referencing pipe_list.
+
+ * range.c (range_length): returns zero, if the first is greater
+ than the last.
+
+ * signal.c (trap_restore_mask): restore signal mask before raising
+ exceptions and throws.
+
+Fri Mar 13 13:49:24 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_02.
+
+ * object.c (mod_clone): need to dups constants and instance
+ variables.
+
+ * eval.c (rb_eval): forgot to initialize body for NODE_DEFS.
+
+ * eval.c (rb_eval): retrieve self from calling frame, since self
+ changes sometimes.
+
+ * env.h (FRAME): need to save self in the calling frame.
+
+ * io.c (f_gets_method): rs should be initialized by RS.
+
+Thu Mar 12 15:33:57 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_01.
+
+ * range.c (range_s_new): check values by `first <= last'.
+
+ * parse.y (lastline_set): fixed offset for $_ and $~ in the local
+ variable space.
+
+Wed Mar 11 02:14:17 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (io_gets): handle normal case specially for speed.
+
+ * eval.c (rb_disable_super): function to disable superclass's
+ method explicitly.
+
+ * eval.c (rb_eval): inherits previous method definition's
+ NOEX_UNDEF-ness, if exists.
+
+ * class.c (rb_define_method): disables superclass's overriding
+ method by default.
+
+Wed Mar 11 01:40:48 1998 MAEDA shugo <shugo@po.aianet.ne.jp>
+
+ * numeric.c (flo_gt,etc.): do not depend on `<=>', to handle NaN.
+
+Tue Mar 10 00:03:24 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c (load_file): understands multiple options in #! line.
+
+ * regex.c (re_compile_pattern): support for [:alpha:] etc.
+
+Mon Mar 9 16:53:51 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.h (GetOpenFile): embed io_check_closed in GetOpenFile.
+
+ * sprintf.c (f_sprintf): zero padding failed for negative
+ integers.
+
+ * sprintf.c (remove_sign_bits): failed to remove some bits.
+
+Sat Mar 7 21:51:46 1998 MAEDA shugo <shugo@po.aianet.ne.jp>
+
+ * class.c (ins_methods_i): body may be NULL for some case.
+
+Fri Mar 6 17:23:07 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (mbcinit): table driven mbchar detection.
+
+ * object.c (obj_alloc): check for allocating instance for the
+ primitive classes (mostly perfect).
+
+ * ext/curses/curses.c (curses_finalize): restore original state at
+ interpreter termination.
+
+ * ext/curses/curses.c (curses_addstr): forgot to check argument
+ type (caused SEGV). now uses STR2CSTR() macro.
+
+Thu Mar 5 13:47:39 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (block_pass): accepts method object as block args.
+
+ * eval.c (f_missing): use any_to_s() for stringify.
+
+Wed Mar 4 01:39:52 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (block_arg): new syntax - block argument in the
+ calling arglist.
+
+ * eval.c (rb_call): no module search. simplified a lot.
+
+ * eval.c (rb_eval): block arg support.
+
+ * parse.y (f_block_arg): new syntax - block argument in the
+ formal arglist.
+
+Tue Mar 3 14:20:15 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (obj_method): returns bound method object.
+
+ * eval.c (rb_call): argument check for empty methods.
+
+ * ruby.h (NUM2CHR): new macro, originally from curses module.
+
+Tue Mar 3 13:03:35 1998 MAEDA shugo <shugo@po.aianet.ne.jp>
+
+ * io.c (io_putc): new method.
+
+Tue Mar 3 11:21:28 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (str_inspect): more strict charcode detection.
+
+ * eval.c (thread_stop): stopping only thread raises ThreadError
+ exception.
+
+Tue Mar 3 08:04:56 1998 Tadayoshi Funaba <tadf@kt.rim.or.jp>
+
+ * struct.c (struct_alloc): incomplete struct initialization made
+ GC to access unallocated addresses.
+
+Mon Mar 2 16:28:27 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (thread_stop_method): remove Thread#stop.
+
+Fri Feb 27 18:16:26 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1b9 released.
+
+Fri Feb 27 09:36:35 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * hash.c (hash_delete_nil): needed to compare value to nil, since
+ nil is the valid key for hashes.
+
+ * hash.c (hash_foreach_iter): rehashing causes IndexError.
+
+ * hash.c (hash_foreach_iter): rehash check by pointer comparison.
+
+Thu Feb 26 17:22:13 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (fname): convert reswords into symbols.
+
+ * parse.y (reswords): reserved words are now embedded in the
+ syntax (sigh).
+
+ * parse.y: now reserved words can be method names safely.
+
+Wed Feb 25 15:50:07 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (mod_module_eval): clear the_scope's PRIVATE flag before
+ calling eval().
+
+ * gc.c (gc_call_finalizer_at_exit): run finalizers before any data
+ object being freed.
+
+ * eval.c (rb_eval): needed to keep prot_tag->retval before
+ evaluating the ensure clause.
+
+Tue Feb 24 11:16:32 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (yylex): reserved words can be appear as method names at
+ right after 'def' and `.'(dot), like foo.next.
+
+ * eval.c (return_check): checks for return out of thread (formerly
+ done in return_value).
+
+ * eval.c (POP_TAG): copy retval to outer level.
+
+ * eval.c (return_value): just set retval, no check, no unwinding.
+
+ * parse.y (nextc): line continuation by backslash at end of line.
+
+ * regex.c (re_compile_pattern): forgot to clear pending_exact on
+ closing parentheses.
+
+ * parse.y (assignable): should not assign dyna_var to true, if it
+ is already defined.
+
+Mon Feb 23 14:35:03 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * object.c (obj_is_kind_of): no longer accepts true/false/nil.
+
+ * object.c ({true,false,nil}_to_i): can be converted into integers.
+
+Mon Feb 23 12:11:51 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (reg_s_quote): needed to be mbchar aware.
+
+ * eval.c (proc_s_new): wrong iter mark.
+
+Sat Feb 21 22:59:30 1998 MAEDA shugo <shugo@po.aianet.ne.jp>
+
+ * io.c (f_syscall): no argument check.
+
+Fri Feb 20 10:17:51 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1b8 released.
+
+ * ext/kconv/kconv.c (kconv_kconv): default output code now be
+ determined according to the value of $KCODE.
+
+ * re.c (rb_get_kcode): can retrieve $KCODE from C code.
+
+ * parse.y (stmt): if/unless modifiers returns nil, if condition is
+ not established.
+
+Thu Feb 19 11:06:47 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/kconv/kconv.c (kconv_kconv): charcode can be specified by
+ code name (JIS, SJIS, EUC like value of $KCODE).
+
+ * regex.c (re_compile_pattern): forgot to fixup_jump for (?:..).
+
+ * regex.c (re_compile_pattern): needed to clear pending_exact on
+ non-registering grouping (?:...).
+
+Wed Feb 18 19:54:21 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (here_document): needed to set lex_state to EXPR_END.
+
+Wed Feb 18 18:45:10 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * patches for cygwin32 applied.
+
+Wed Feb 18 00:41:31 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (str_sub_s): needed to be mbchar aware to increment one
+ character.
+
+ * regex.c (re_match): \Z matches newline just before the end of
+ the string.
+
+Tue Feb 17 00:04:32 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * time.c (time_arg): Time.gm and Time.local now understands
+ Time#to_a format.
+
+ * string.c (str_sub_s): replace happened twice for null pattern.
+
+ * regex.c (re_search): null pattern should not match after newline
+ at the end of string.
+
+ * time.c (time_isdst): now returns boolean value.
+
+ * error.c (rb_check_type): treat special constants in messages.
+
+ * parse.y (yylex): new form `::Const' to see toplevel constants.
+
+ * parse.y (cond): SEGV on `if ()'.
+
+ * gc.c (obj_free): some data needed explicit free().
+
+Mon Feb 16 23:55:40 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (blk_free): release duplicated block informations.
+
+ * eval.c (blk_copy_prev): duplicate outer block information into
+ the heap, when proc/binding created.
+
+Mon Feb 16 14:38:25 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * time.c (time_mon): now 1 for January and so on.
+
+ * time.c (time_year): year in 19xx (no + 1900 needed anymore).
+
+Mon Feb 16 13:28:33 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_pattern): need to fetch mbchar's second byte
+ without translation.
+
+Mon Feb 16 12:29:27 1998 MAEDA shugo <shugo@po.aianet.ne.jp>
+
+ * eval.c (f_pass_block): pass iterator block to other method.
+
+Fri Feb 13 08:16:11 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (parse_regx): handle \s before read_escape().
+
+ * parse.y (read_escape): `\s' in strings as space.
+
+Tue Feb 10 17:29:08 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1b7 released.
+
+ * string.c (str_aset): string insertion by `str[n] = str2'.
+
+ * string.c (str_oct): does recognize `0x'.
+
+ * sprintf.c (f_sprintf): use base 10 for conversion from string to
+ integer.
+
+Mon Feb 9 14:51:56 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * numeric.c (do_coerce): proper error message.
+
+ * string.c (str_sum): bug - masked by wrong value. (sigh..)
+
+Sat Feb 7 15:11:14 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (str_empty): new method
+
+Fri Feb 6 01:42:15 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * time.c (time_asctime): use asctime(3), not strftime(3).
+
+Thu Feb 5 18:58:46 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (io_fptr_close): do not free path on close().
+
+ * array.c (ary_filter): new method.
+
+ * enum.c (enum_each_with_index): new method.
+
+Thu Feb 5 14:10:35 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (primary): singleton class def can be appeared inside
+ method bodies.
+
+ * hash.c (hash_replace): replace content.
+
+ * string.c (str_replace_method): replace content.
+
+ * array.c (ary_replace_method): replace elements.
+
+ * string.c (str_succ_bang): String#succ!
+
+Thu Feb 5 18:20:30 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * string.c (str_upcase_bang): multi byte character support.
+
+Wed Feb 4 13:55:26 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (ary_reverse): SEGV on empty array reverse.
+
+Tue Feb 3 12:24:07 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (match_to_a): non matching element should be nil.
+
+ * ruby.c (ruby_load_script): load script after all initialization.
+
+ * bignum.c (str2inum): need to interpret prefix `0' of `0x'.
+
+Tue Feb 3 10:00:18 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * numeric.c (fix_rshift): use `sizeof(INT)*8' instead of 32.
+
+Mon Feb 2 14:09:24 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c (set_arg0): grab environment region too.
+
+Thu Jan 29 18:36:25 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * process.c (rb_proc_exec): check `sh' to be exist.
+
+Thu Jan 29 18:18:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (io_stdio_set): assignment to $stdin or $stdout does
+ reopen() as well as $stderr.
+
+Thu Jan 29 14:18:40 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * class.c (mod_ancestors): should not include singleton classes.
+
+ * object.c (obj_type): should not return internal class.
+
+ * io.c (io_reopen): unwillingly closes stdio streams.
+
+Thu Jan 29 11:50:35 1998 Toshihiko SHIMOKAWA <toshi@csce.kyushu-u.ac.jp>
+
+ * ext/socket/socket.c (udp_addrsetup): forgot to use htons().
+
+Tue Jan 27 23:15:24 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * keywords: __FILE__, __LINE__ are available again.
+
+Fri Jan 23 14:19:28 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1b6 released.
+
+ * object.c (mod_to_s): need to duplicate classpath.
+
+ * error.c (exc_inspect): need to duplicate classpath.
+
+Thu Jan 22 00:37:47 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.h (STR2CSTR): new macro to retrieve char*.
+
+ * class.c (rb_define_method): `initialize' should always be
+ private, even if it defined by C extensions.
+
+ * eval.c (rb_eval): `initialize' should always be private.
+
+Thu Jan 22 16:21:08 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_eval): some singleton class def cause SEGV.
+
+ * eval.c (TMP_ALLOC): replace ALLOCA_N, where thread context
+ switch may happen.
+
+Wed Jan 21 01:43:42 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (PUSH_FRAME): do not use ALLOCA_N(). crash on some
+ platforms that use missing/alloca.c.
+
+ * regex.c (re_compile_pattern): too many pops for non register
+ subexpr.
+
+ * parse.y (yylex): open parentheses after identifiers are argument
+ list, even if whitespaces have seen.
+
+Tue Jan 20 15:19:59 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (terms): quoted word list by %w(a b c).
+
+ * ext/tcltklib/extconf.rb: more accurate check for tcl/tk libs.
+
+ * file.c (rb_stat): most of the FileTest methods (and function
+ `test') accept File objects as the argument.
+
+Tue Jan 19 18:19:24 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * ext/extmk.rb.in (install): there should be no newline after install:
+
+ * re.c (MIN): renamed from min(). there's a local variable named
+ min in the file, so that some cpp will raise an error.
+
+Mon Jan 19 16:30:05 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1b5 released.
+
+ * process.c (rb_syswait): no exception raised.
+
+Fri Jan 16 00:43:43 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.h (CLONESETUP): copies its singleton classes too.
+
+ * class.c (singleton_class_attached): saves binded object in the
+ singleton classes.
+
+ * eval.c (rb_eval): calls singleton_method_added even in the
+ singleton class clauses.
+
+Fri Jan 15 23:22:43 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * ruby.c (proc_options): -S does not recognize PATH.
+
+Thu Jan 15 02:03:12 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_clear_cache_by_id): clear only affected cache
+ entries.
+
+Wed Jan 14 02:14:48 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/socket/socket.c: new UDP/IP socket classes.
+
+Tue Jan 13 10:00:18 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (str_cmp): ignorecase($=) works wrong.
+
+Fri Jan 9 13:19:55 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1b4 released.
+
+ * eval.c (f_missing): class name omitted from the error message.
+
+ * error.c (exc_inspect): description changed.
+
+ * string.c (Init_String): GlobalExit's superclass did not filled,
+ since GlobalExit created earlier than String.
+
+Thu Jan 8 12:10:09 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (aryset): expr in the brackets can be null.
+
+Wed Jan 7 21:13:56 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (io_reopen): keep stderr unclosed.
+
+ * io.c (io_errset): keep stderr unclosed.
+
+Tue Jan 6 00:27:43 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y: syntax modified for `while expr do .. end' etc.
+
+ * process.c (f_exec,f_system): can supply arbitrary name for the
+ new process.
+
+Mon Jan 5 16:59:13 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * file.c (file_s_basename): removes any extension by ".*".
+
+Sun Jan 4 19:36:22 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * parse.y (yylex): needed to update lex_p (reading point).
+
+Sat Jan 3 19:14:14 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * class.c,object.c: duplicate defines mKernel and cFinxnum.
+
+Fri Jan 2 20:38:59 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/curses/curses.c (NUM2CHAR): uses the first character for
+ string arguments.
+
+ * array.c (ary_fill): did not extend array for ranges.
+
+ * array.c (beg_len): did not return end pos bigger than size.
+
+Fri Jan 2 02:09:16 1998 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * dir.c (dir_s_chdir): bug in nil check.
+
+ * array.c (ary_fill): bug in nil check.
+
+Tue Dec 30 11:46:23 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * hash.c (env_path_tainted): checks directories in PATH
+ environment variable are not world writable.
+
+ * ruby.c (load_file): invoke specified interpreter if the #! line
+ does not contain the word `ruby'.
+
+Fri Dec 26 03:26:41 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (uscore_get): type information included in the error
+ message.
+
+ * variable.c (f_untrace_var): does not free trace-data within
+ trace procedure.
+
+Thu Dec 25 02:50:29 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1b3 released.
+
+ * ruby.h: inlining some functions on gcc 2.x
+
+Tue Dec 23 02:47:33 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_eval): public/private information kept in the current
+ scope, to remove undesired state from the class/module.
+
+ * time.c (time_strftime): remove hidden limit of 100 bytes of
+ result string, using malloc'ed buffer.
+
+ * hash.c (hash_update): merges the contents of another hash,
+ overriding existing keys.
+
+ * regex.c (must_instr): totally re-written.
+
+ * io.c (read_all): try to allocate proper sized buffer using
+ fstat(2) for speedup.
+
+Sat Dec 20 00:27:28 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (must_instr): need to skip 2 bytes for mbchars.
+
+Fri Dec 19 01:18:29 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1b2 released.
+
+ * eval.c (check_errat): check and convert (if necessary) traceback
+ information before assigning to the variable $@.
+
+ * eval.c (f_raise): optional third argument to specify traceback
+ information.
+
+ * io.c (f_open): prevent infinite recursive call.
+
+Thu Dec 18 19:33:47 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (str_rindex): now accepts regexp as index.
+
+Thu Dec 18 18:42:50 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * ext/socket/extconf.rb: modified to detect win32 socket lib.
+
+Thu Dec 18 00:25:03 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * re.c (reg_equal): checks for source and casefold and kcode matching.
+
+ * marshal.c: became built-in module.
+
+ * ext/marshal/marshal.c (r_object): displays struct name for
+ non-compatible struct.
+
+ * string.c (str_index_method): now searches character (fixnum) in
+ the string.
+
+ * string.c (str_include): redefine `include?'.
+
+ * regex.c (re_match): start_nowidth saves current stack position
+ to stop_nowidth.
+
+ * regex.c (re_compile_pattern): add space to stop_nowidth to save
+ runtime stack position.
+
+Tue Dec 16 14:57:43 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (scan_once): wrong exception for regexp that match with
+ null string (use substr instead of subseq).
+
+Sat Dec 13 00:13:32 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (expr): remove bare assocs from expr rule.
+
+ * rbconfig.rb: renamed from config.rb (it was too generic name).
+
+Fri Dec 12 00:50:25 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (expr): warns if BEGIN or END appear in the method
+ bodies.
+
+ * string.c (str_match): calls y =~ x if y is neither String nor
+ Regexp so that eregex.rb works.
+
+ * eval.c (f_at_exit): to register end proc.
+
+ * class.c (rb_define_module_function): define 'function' method
+ for the Module, not private method.
+
+ * class.c (rb_define_function): function to define `function' method.
+
+ * eval.c (rb_eval): inherit visibility from superclass's method
+ except when it is set to `function'
+
+ * eval.c (rb_eval): new visibility status `function'.
+
+ * parse.y (yycompile): do not clear eval_tree. thus enable multiple
+ command line script by option `-e'.
+
+ * eval.c (rb_eval): END execute just once.
+
+ * parse.y (expr): BEGIN/END built in the syntax.
+
+Thu Dec 11 13:14:35 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * object.c (mod_le): Module (or Class) comparison.
+
+ * eval.c (rb_remove_method): raises NameError if named method does
+ not exist.
+
+ * ext/curses/curses.c: remove CHECK macro for BSD curses.
+
+Thu Dec 11 12:44:01 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * pack.c: sun4 cc patch
+
+Wed Dec 10 15:21:36 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/marshal/marshal.c (marshal_load): can supply evolution proc
+ object as optional second argument.
+
+ * re.c (reg_source): get source string of the regular expression.
+
+Tue Dec 9 10:05:17 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1b1 released.
+
+ * parse.y (tokadd): token buffer overrun.
+
+ * ruby.c (ruby_prog_init): forgot to protect rb_argv0 from gc.
+
+ * eval.c (ruby_run): call finalizers at process termination.
+
+ * gc.c (gc_call_finalizer_at_exit): call free proc for every Data
+ Wrapper, and finalizer for specified objects at termination.
+
+ * version.c (show_version): version format changed.
+
+ * regex.c (re_match): wrong match with non-greedy if they appear
+ more than once in regular expressions.
+
+ * sample/ruby-mode.el (ruby-expr-beg): forgot to handle modifiers.
+
+Mon Dec 8 19:00:15 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (io_puts): just put a newline if no argument given.
+
+ * ext/tcltklib/tcltklib.c (lib_mainloop): thread-aware tk handle
+ when $tk_thread_safe is set.
+
+ * ext/tcltklib/tcltklib.c (lib_mainloop): use Tcl_DoOneEvent()
+ instead of Tk_MainLoop().
+
+Mon Dec 6 07:11:16 1997 MAEDA shugo <shugo@po.aianet.ne.jp>
+
+ * io.c (io_puts): core dumped without any argument.
+
+Fri Dec 5 18:17:17 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (mod_remove_method): remove (not undef) a method from the
+ class/module.
+
+ * variable.c (obj_remove_instance_variable): method to remove
+ instance variables.
+
+Thu Dec 4 13:50:29 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1b0 released.
+
+ * string.c (str_aref): called str_index for regexp.
+
+Mon Dec 1 15:24:41 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * compar.c (cmp_between): wrong comparison made.
+
+Wed Nov 26 18:18:05 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * lib/mkmf.rb: generate Makefile for extension modules out of ruby
+ source tree. use like `ruby -r mkmf extconf.rb'.
+
+ * numeric.c (fix2str): enlarge buffer to prevent overflow on some
+ machines.
+
+ * parse.y (here_document): wrong line number generated after here-doc.
+
+Fri Nov 21 13:17:12 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (yylex): skip multibyte characters in comments.
+
+Wed Nov 19 17:19:20 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * object.c (nil_to_a): nil.to_a => [].
+
+ * parse.y (call_args): wrong node generation.
+
+Tue Nov 18 10:13:08 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (Init_Array): Array#=== works as Array#include?
+
+ * regex.c (re_compile_pattern): insert initialize code for jump_n,
+ before entering loops.
+
+ * re.c (reg_search): does not save registers unless $& etc appear
+ in the script.
+
+Mon Nov 17 13:01:43 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (is_defined): add defined? check for receivers and
+ arguments for calls.
+
+ * re.c (reg_search): cache last match object.
+
+ * re.c (match_aref): $[0] etc. are available.
+
+Sat Nov 15 00:11:36 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * io.c (io_s_popen): "rb" detection
+
+Fri Nov 14 18:28:40 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (scan_once): returns whole match if the pattern does
+ not contain any parentheses.
+
+Thu Nov 13 14:39:06 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (str_sub): returns copy of the receiver string, even if
+ any substitution occurred.
+
+ * regex.c (re_compile_pattern): no-width match by (?=..), (?!..).
+
+Wed Nov 12 13:44:47 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * time.c: remove coerce from Time class.
+
+ * regex.c (re_match): non-greedy match by ??, *? +?, {n,m}?.
+
+Mon Nov 10 11:24:51 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_pattern): non-registering parens (?:..).
+
+ * regex.c (re_compile_pattern): new meta character \< (wordbeg)
+ and \> (wordend).
+
+ * regex.c (re_compile_pattern): embedded comment for regular
+ expression by (?#...).
+
+Fri Nov 7 16:58:24 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_pattern): perl5 regexp \A and \Z available.
+
+ * regex.c (re_compile_pattern): can expand compile stack dynamically.
+
+ * regex.c (PUSH_FAILURE_POINT): wrong compare condition.
+
+Wed Nov 2 16:00:00 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * string.c (str_sub_s): "".sub! "", "" => "\000"
+
+Fri Oct 31 15:52:10 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (assoc): keyword assoc like {fg->"black"}.
+
+Thu Oct 30 17:33:38 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (io_println): print with newline, which is not affected by
+ the values of $/ and $\.
+
+Thu Oct 30 16:54:01 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * string.c (str_chop_bang): "".chop caused SEGV.
+
+ * string.c (str_chomp_bang): method to chop out last newline.
+
+Mon Oct 27 13:49:13 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/extmk.rb.in: library may have pathname contains `.'
+
+ * eval.c (rb_rescue): should not protect SystemError.
+
+Fri Oct 24 10:58:53 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (io_s_with_open_stream): ensures to close stream.
+
+Thu Oct 23 11:17:44 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (io_errset): value of $stderr can be changed (to any IO
+ object).
+
+ * io.c (next_argv): $< can be anything that responds to `write'.
+
+ * file.c (file_s_with_open_file): ensures to close file.
+
+ * error.c (exception): create error under the current class/module.
+
+ * range.c (range_eqq): fixnum check for last needed too.
+
+Wed Oct 22 12:52:30 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/socket/socket.c: Socket::Constants added.
+
+ * file.c: File::Constants added for inclusion.
+
+ * array.c (ary_join): call ary_join() recursively for the 1st
+ array element.
+
+Mon Oct 20 12:18:29 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * ruby.c (load_file): wrong condition for #! check with -x.
+
+ * file.c (file_s_dirname): did return "" for "/a".
+
+Fri Oct 17 14:29:09 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c: now works on alpha-linux.
+
+ * bignum.c (bigadd): some undefined side effect order assumed.
+
+Wed Oct 15 17:49:24 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * intern.h: function prototypes added.
+
+Mon Oct 13 16:54:18 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * class.c (rb_define_class_id): call superclass's `inherited'
+ method when making subclasses.
+
+ * parse.y (nextc): clear lex_lastline at the end of file.
+
+ * object.c (Init_Object): need to undef Class#append_features.
+
+ * eval.c (rb_eval): no warning on extending classes or modules.
+
+Thu Oct 9 11:17:50 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (error_print): the exception name follows after the error
+ message.
+
+ * eval.c (compile_error): error message slightly changed.
+
+ * parse.y (nextc): script parsing will be terminated by __END__ at
+ beginning of line.
+
+ * eval.c (compile_error): `__END__' is no longer a keyword.
+
+ * parse.y (nextc): protect lastline read from script stream.
+
+Tue Oct 7 14:06:06 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1 alpha9 released.
+
+ * eval.c (mod_append_features): renamed from extend_class.
+
+ * eval.c (rb_eval): defining method calls `method_added'.
+
+ * eval.c (ruby_options): exception while processing options must
+ terminate the interpreter.
+
+ * error.c (Init_Exception): wrong method configuration. `new'
+ should have been a singleton method.
+
+Mon Oct 6 18:55:38 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/kconv/kconv.c (kconv_guess): code to guess character code
+ from string.
+
+Mon Oct 6 18:38:17 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * pack.c: now encode/decode base64 by `m' template.
+
+Fri Oct 3 10:51:10 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * MANIFEST: needed to include lex.c in the distribution.
+
+ * eval.c (ruby_options): f_require() called too early.
+
+ * eval.c (rb_provide): module extensions should always be `.o'.
+
+Thu Oct 2 11:38:31 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1 alpha8 released.
+
+ * ext/marshal/marshal.c (r_object): remove temporal regist for
+ structs. (caused problem if structs form cycles.)
+
+ * parse.y (match_gen): static binding for match(=~) calls
+ with regexp literals.
+
+Wed Oct 1 15:26:55 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c: protect retval in struct tag from GC for C_ALLOCA.
+
+ * eval.c: no more pointer value from setjmp/longjmp.
+
+Wed Oct 1 14:01:49 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * ext/marshal/marshal.c (w_byte): argument must be char.
+
+Wed Oct 1 10:30:22 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * variable.c (mod_const_at): global constants now belongs to the
+ class Object.
+
+ * object.c (Init_Object): new global constant NIL.
+
+ * ext/marshal/marshal.c (marshal_dump): try to set binmode.
+
+ * ext/marshal/marshal.c (r_object): forgot to re-regist structs in
+ the object table.
+
+ * eval.c (ruby_options): call Init_ext() before any require()
+ calls by `-r'.
+
+Fri Sep 30 14:29:22 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * ext/marshal/marshal.c (w_object): marshal dumped core.
+
+Tue Sep 30 10:27:39 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * sample/test.rb: bignum test suits added.
+
+ * eval.c (rb_eval): new pseudo variable `true' and `false'.
+
+ * parse.y: new keywords `true' and `false' added.
+
+Mon Sep 29 13:37:58 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c (forbid_setid): forbid some options in suid mode.
+
+ * ruby.h (NUM2DBL): new macro to convert into doubles.
+
+Mon Sep 27 09:53:48 1997 EGUCHI Osamu <eguchi@shizuokanet.or.jp>
+
+ * bignum.c: modified for speeding.
+
+Fri Sep 26 18:27:59 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * sample/from.rb: some extensions.
+
+Mon Sep 29 13:15:56 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (lhs): no more syntax error on `obj.CONSTANT = value'.
+
+Fri Sep 26 14:41:46 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (ruby_run): deferred calling Init_ext() just before eval_node.
+
+Fri Sep 26 13:27:24 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * io.c (io_isatty): forgot to return TRUE value.
+
+Fri Sep 25 11:10:58 1997 EGUCHI Osamu <eguchi@shizuokanet.or.jp>
+
+ * eval.c: use _setjmp/_longjmp instead of setjmp/longjmp on some
+ platforms.
+
+Wed Sep 24 17:43:13 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (Init_String): String#taint and String#taint? added.
+
+ * class.c (mod_ancestors): ancestors include the class itself.
+
+Wed Sep 24 00:57:00 1997 Katsuyuki Okabe <HGC02147@niftyserve.or.jp>
+
+ * X68000 patch.
+
+Tue Sep 23 20:42:30 1997 EGUCHI Osamu <eguchi@shizuokanet.or.jp>
+
+ * parse.y (node_newnode): SEGV on null node setup.
+
+Mon Sep 22 11:22:46 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c (ruby_prog_init): wrong safe condition check.
+
+Sun Sep 21 14:46:02 1997 MAEDA shugo <shugo@po.aianet.ne.jp>
+
+ * error.c (exc_inspect): garbage added to classpath.
+
+Fri Sep 19 11:49:23 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (newtok): forgot to adjust buffer size when shrinking
+ the token buffer.
+
+ * enum.c (enum_find): rb_eval_cmd() does not return value.
+
+ * io.c (pipe_open): close fds on pipe exec. fcntl(fd, F_SETFD, 1)
+ no longer used.
+
+Tue Sep 16 17:54:25 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * file.c (f_test): problem if wrong command specified.
+
+ * ruby.c (ruby_prog_init): close stdaux and stdprn for MSDOS.
+
+ * ruby.c (ruby_prog_init): should not add path from environment
+ variable, if ruby is running under setuid.
+
+ * process.c (init_ids): check suid check for setuid/seteuid etc.
+
+Mon Sep 15 00:42:04 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * regex.c (re_compile_pattern): \w{3} and \W{3} did not work.
+
+Thu Sep 11 10:31:48 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1 alpha7 released.
+
+ * ext/socket/socket.c (sock_new): no setbuf() for NT.
+
+ * io.c (rb_fopen,rb_fdopen): set close-on-exec for every fd.
+
+Wed Sep 10 15:55:31 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/marshal/marshal.c (r_bytes0): extra big length check.
+
+Tue Sep 9 16:27:14 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (pipe_fptr_atexit): clean up popen()'ed fptr.
+
+ * error.c (set_syserr): some system has error code that is bigger
+ than sys_nerr. grrr.
+
+Mon Sep 8 18:33:33 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (io_s_new): dereferenced nil for optional mode.
+
+Fri Sep 5 10:26:03 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * class.c (class_instance_methods): do not include methods which
+ are changed to private in subclasses.
+
+Thu Sep 4 12:38:53 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * variable.c (f_global_variables): list name of the global
+ variables.
+
+ * object.c (obj_id): returns unique integer.
+
+Wed Sep 3 14:05:16 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1 alpha6 released.
+
+ * eval.c (mod_s_constants): context sensitive constant list.
+
+ * variable.c (mod_constants): no more `all' option.
+
+ * variable.c (mod_const_of): the values for autoload classes are
+ their name strings.
+
+ * class.c (class_instance_methods): no special treatment for
+ singleton classes.
+
+ * object.c (obj_singleton_methods): returns list of singleton
+ method names.
+
+ * parse.y (yylex): no here document after `class' keyword.
+
+ * eval.c (f_load): expand path if fname begins with `~'.
+
+Tue Sep 2 13:19:48 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * class.c (ins_methods_i): do not list undef'ed methods.
+
+Mon Sep 1 13:42:48 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1 alpha5 released.
+
+ * object.c (mod_attr_reader): create methods to define attribute
+ reader/write/accessor.
+
+ * class.c (rb_define_attr): always defines accessors.
+
+ * eval.c (rb_call): alias occurred in the module body caused SEGV.
+
+ * parse.y: did not generate here document strings properly.
+
+Mon Sep 1 11:43:57 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * parse.y (yylex): heredoc dropped an extra character.
+
+Fri Aug 29 11:10:21 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * class.c (class_instance_methods): same method names should not
+ appear more than once.
+
+ * parse.y (yylex): spaces can follow =begin/=end.
+
+ * variable.c (find_class_path): look for class_tbl also for
+ unnamed fundamental classes, such as Object, String, etc.
+
+ * variable.c (rb_name_class): can't name class before String class
+ is initialized.
+
+ * inits.c (rb_call_inits): unrecognized dependency from GC to
+ Array.
+
+ * variable.c (find_class_path): could not find class if Object's
+ iv_tbl is NULL.
+
+Thu Aug 28 13:12:05 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1 alpha4 released.
+
+ * variable.c (mod_constants): wrong condition for singleton
+ class.
+
+ * parse.y (yylex): revised `=begin' skip code.
+
+ * parse.y (here_document): forgot to free(eos).
+
+ * parse.y (yylex): spaces after `<<' prohibited for here
+ documents to avoid confusing with operator `<<'.
+
+ * eval.c (is_defined): separated from rb_eval().
+
+Wed Aug 27 11:32:42 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1 alpha3 released.
+
+ * variable.c (mod_name): returns name of the class/module.
+
+ * parse.y (here_document): finally here document available now.
+
+ * variable.c (fc_i): some classes/modules does not have iv_tbl.
+
+ * variable.c (find_class_path): avoid infinite loop.
+
+Tue Aug 26 13:43:47 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_eval): undef'ing non-existing method will raise
+ NameError exception.
+
+ * object.c (class_s_new): needed to create metaclass too.
+
+ * eval.c (error_print): no class name print for anonymous class.
+
+ * eval.c (rb_longjmp): proper exception raised if raise() called
+ without arguments, with $! or $@ set.
+
+ * object.c (Init_Object): superclass()'s method argument setting
+ was wrong again.
+
+ * class.c (mod_ancestors): list superclasses and included modules
+ in priority order.
+
+Mon Aug 25 11:53:11 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1 alpha2 released.
+
+ * sample/ruby-mode.el (ruby-parse-region): auto-indent now
+ supports "\\" in the strings.
+
+ * struct.c (struct_getmember): new API to get member value from C
+ language side.
+
+Sat Aug 23 21:39:05 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (assignable): remove unnecessary local variable
+ initialize by nil.
+
+Fri Aug 22 14:26:40 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (error_print): modified exception print format.
+
+Thu Aug 21 16:10:58 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * sample/ruby-mode.el (ruby-calculate-indent): wrong indent level
+ calculated with keyword operators.
+
+Thu Aug 21 11:36:58 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * parse.y (arg): ary[0] += 1 cause SEGV
+
+Wed Aug 20 17:28:50 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c (ruby_process_options): require() all modules after
+ processing all options
+
+ * process.c (rb_proc_exec): more security checks added.
+
+ * process.c (rb_proc_exec): insecure path on exec.
+
+ * hash.c (f_getenv): PATH modification security check.
+
+Tue Aug 19 00:15:38 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1 alpha1 released.
+
+ * eval.c (mod_eval): work as normal eval() if second binding
+ argument given.
+
+ * eval.c (rb_call): did not raise ArgumentError if too many
+ arguments more than optional arguments (without rest arg).
+
+ * eval.c (rb_eval): did not work well for op_asgn2 (attribute
+ self assignment).
+
+ * eval.c (Init_Thread): returns main thread.
+
+Mon Aug 18 09:25:56 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * object.c (inspect_i): did not display T_DATA instance variables.
+
+ * parse.y: provides more accurate line number information.
+
+ * eval.c (thread_value): include value's backtrace information in
+ the variable `$@'.
+
+ * eval.c (f_abort): print backtrace and exit.
+
+Sat Aug 16 00:17:44 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (class_new_instance): do not make instance from virtual
+ classes.
+
+ * object.c (class_s_new): do not make subclass of singleton class.
+
+Fri Aug 15 15:49:46 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (call_trace_func): block context switch in the trace
+ function.
+
+ * eval.c (rb_eval): clear method cache at class extension.
+
+ * object.c (obj_type): returns object's class even if it defines
+ singleton methods.
+
+Fri Aug 15 19:40:43 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * ext/socket/socket.c (Init_socket): small typo caused SEGV.
+
+Wed Aug 13 17:51:46 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.1 alpha0 released.
+
+Local variables:
+add-log-time-format: (lambda ()
+ (let* ((time (current-time))
+ (diff (+ (cadr time) 32400))
+ (lo (% 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
+end:
diff --git a/doc/NEWS b/doc/NEWS
new file mode 100644
index 0000000000..b4445fa59f
--- /dev/null
+++ b/doc/NEWS
@@ -0,0 +1,837 @@
+= command line options
+
+: -W option
+
+ new option to specify warning level. -W0 to shut up warnings, -W1 for normal level,
+ -W2 for verbose level. -w equals to -W2.
+
+= language syntax
+
+: arbitrary delimited string array
+
+ %W(...) notation, word list literal like %w(...) with the
+ exception that #{} interpolation is allowed.
+
+: arbitrary delimited symbol literl
+
+ :"foo", :"foo#{bar}", etc.
+
+: expression interpolation in strings
+
+ Now arbitrary statements are allowed inside #{} interpolation
+ without escapes. In other hand, they can no longer access to
+ variables defined in eval.
+
+: negative number literals
+
+ Digits preceded minus sign is a literal integer.
+
+: array expansion
+
+ Fixed with the following behavior:
+
+ a = *[1]
+ p a #=> [1]
+
+ Now 1-element array in rhs is expanded properly.
+
+ a = *[1]
+ p a #=> 1
+
+: break and next
+
+ Extended to take an optional expression, which is used as a value
+ for termination.
+
+: direct assignment to Foo::Bar is allowed
+
+ also, you can define "class Foo::Bar; end".
+
+= language core
+
+: $stdin, $stdout, $stderr
+
+ can be assignable again. the original stdio are preserved as STDIN,
+ STDOUT, STDERR.
+
+: $VERBOSE now has 3 levels
+
+ nil - silence, false - medium (default), true - verbose
+
+: allocation framework
+
+ any instance of class can be allocated by class.allocate,
+ (except for a few classes).
+
+: comparison of exception classes in a rescue clause
+
+ changed to use Module#=== for comparing $! with the exception
+ class specified in each rescue clause.
+
+ as the previous behavior was to use kind_of?, the effect is limited
+ to the SystemCallError case. SystemCallError.=== has been newly
+ defined to return true when the two have the same errno. With this
+ change, SystemCallError's with the same errno, such as Errno::EAGAIN
+ and Errno::EWOULDBLOCK, can both be rescued by listing just one of
+ them.
+
+: constants lookup
+
+ improved at the performance of searching by using an internal hash
+ table.
+
+ calls const_missing method of the class/module, if constant is not
+ found in the look up path.
+
+: expression parenthesis in the first argument
+
+ altered to get the following code (note the space after p):
+
+ p ("xx"*2).to_i
+
+ Interpreted as:
+
+ p (("xx"*2).to_i)
+
+ Instead of:
+
+ (p("xx"*2)).to_i
+
+: implicit comparison in conditional expressions
+
+ Obsoleted except when it is used in -e.
+
+ : between Range and $.
+ Use explicit comparison instead.
+
+ : between Regexp and $_
+ Use the unary method ~/re/ instead.
+
+: to_str
+
+ added to get objects which define to_str() treated as String's.
+
+ now almost all the built-in methods try each argument with to_str()
+ when they expect it to be a String.
+
+ foo = Object.new
+ class <<foo
+ def to_str
+ "foo"
+ end
+ end
+ p File.open(foo)
+ => -:7:in `open': wrong argument type Object (expected String) (TypeError)
+ ruby 1.6.4 (2001-04-19) [i586-linux]
+ => -:7:in `open': No such file or directory - "foo" (Errno::ENOENT)
+ ruby 1.7.0 (2001-05-02) [i586-linux]
+
+: multiple assignment behavior
+
+ Fixed so that "*a = nil" results in "a == []".
+
+= changes in core class library
+
+: open
+
+ Extended so that when the third argument is permission flags it
+ calls open(2) instead of fopen(3).
+
+: sprintf
+
+ new format specifier "%p" is available.
+
+: lambda and proc
+
+ Proc object returns from these methods has the following attributes:
+
+ * strict argument number check
+ * break and return terminates the proc execution.
+
+: warn(message)
+
+ a method to give warnings.
+
+: abort()
+
+ takes optional terminate message argument.
+
+: Object#initialize_copy
+
+ copy constructor for clone and dup.
+
+: Object#instance_variable_set, Object#instance_variable_get
+
+ added.
+
+: Object#singleton_method_removed
+: Object#singleton_method_undefined
+
+ Added.
+
+: Array#transpose
+
+ added.
+
+: Array#fetch(index [, default])
+
+ Added. If a default value isn't given, raises index error if index
+ is out of range.
+
+: Array#insert(n, other, ...)
+
+ Added. [ruby-talk:14289]
+
+ This is much the same as (({ary[n,0] = [other,...]})) except
+ returing self.
+
+ ary = [0,1,2,3]
+ ary[2, 0] = [4, 5, 6]
+ p ary
+
+ ary = [0,1,2,3]
+ ary.insert(2, 4, 5, 6)
+ p ary
+
+: Array#sort!
+
+ Changed to always return self without checking whether the sequence
+ of the elements was modified or not.
+
+ Beware that this behavior is not guaranteed to continue in the
+ future. Do not rely on its return value. [ruby-dev:12506]
+
+: Array#filter
+
+ Previously deprecated, now removed. Use Array#collect!.
+
+: Array#pack, String#unpack
+
+ Allows comment in template strings.
+
+: Array#pack, String#unpack
+
+ New templates 'q' and 'Q' for 64bit integer (signed and unsigned respectively).
+
+: Array#new
+
+ Now takes block to fill initial values. E.g.
+
+ Array.new(10) { |i| i + 1 }
+ => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
+
+: Array#fill
+
+ Takes block to get the values to fill.
+
+: Array#fetch
+
+ Takes block to get the default value.
+
+: Array#zip
+
+ added.
+
+: Hash#update
+
+ Takes block to resolve key conflict.
+
+: Hash#merge and Hash#merge!
+
+ update hash. Hash#merge! is a synonym of Hash#update.
+
+: String#split
+
+ if "sep" argument is a string, regular expression meta characters
+ are escaped internally.
+
+: String#rstrip
+
+ chop off NULs at the end of strings.
+
+: String#to_i
+
+ Now accepts optional base argument.
+
+ "101".to_i(10) => 101
+ "101".to_i(2) => 5
+ "101".to_i(8) => 65
+ "101".to_i(16) => 257
+
+ A base argument of 0 guesses at the base.
+
+ "101".to_i(0) => 101
+ "0b101".to_i(0) => 5
+ "0101".to_i(0) => 65
+ "0x101".to_i(0) => 257
+
+: String#[regexp, nth]
+
+ Extended to accepts optional second argument.
+
+ It tries match between self and REGEXP, then returns the
+ content of the NTH regexp register.
+
+: String#casecmp
+
+ Added. This is a case insensitive version of String#<=>.
+
+: String#chomp
+
+ If $/ == "\n", chops off last newlines (any of \n, \r, \r\n).
+
+: String#eql?
+
+ Changed to be always case sensitive.
+
+: String#insert(n, other)
+
+ Added.
+
+ This is much the same as (({str[n, 0] = other})) except returing
+ self.
+
+: String#lstrip, rstrip, lstrip!, rstrip!
+
+ Added. These strip only left or right part of a string.
+
+: String#match
+
+ Added.
+
+: String/Array methods
+
+ Returns an instance of receivers class.
+
+: String.new
+
+ The first argument becomes optional.
+
+: Symbol#intern
+
+ Added.
+
+: Symbol.all_symbols
+
+ Added. [ruby-dev:12921]
+
+: IO
+
+ 64bit off_t support by Janathan Baker.
+
+: IO#read
+: IO#sysread
+
+ takes optinal second argument for read buffer.
+
+: IO::sysopen
+
+ New method to get a raw file descriptor.
+
+: IO#sysseek
+
+ Added.
+
+: IO#fsync
+
+ new method that copies all in-memory parts of a file to disk and
+ waits until the device reports that all parts are on stable storage.
+ Implemented with fsync(2) or equivalent.
+
+: IO.open
+
+ Made public. Can only associate an IO object with a file number
+ like IO.new and IO.for_fd, but can take a block.
+
+: IO.for_fd
+
+ Added as a synonym for IO.new.
+
+: IO.read
+
+ Added. Like IO.readlines, except it returns the entire file as a
+ string. [ruby-talk:9460]
+
+: File#fnmatch, File::Constants::FNM_*
+
+ Added. Refer to the fnmatch(3) manpage for details.
+
+ Localism is FNM_DOTMATCH which has the opposite meaning of the
+ commonly known FNM_PERIOD, which does not exist in Ruby.
+
+ e.g.
+
+ # exclude files matching "*.bak" case-insensitively.
+ files.reject! {|fn| File.fnmatch?("*.bak", fn, File::FNM_CASEFOLD) }
+
+: File.lchmod
+: File.lchown
+
+ Added.
+
+: File.open, IO.open
+
+ File mode can be specified by flags like open(2),
+ e.g. File::open(path, File::CREAT|File::WRONLY).
+
+: Regexp#options
+
+ Added.
+
+: Regexp.last_match(n)
+
+ Extended to take an optional argument.
+
+: MatchData#captures
+
+ added.
+
+: Dir#path
+
+ Added.
+
+: Dir.chdir
+
+ Extended to take a block.
+
+: Dir.glob
+
+ Made to support meta-character escaping by a backslash. Wildcards
+ and spaces may now be escaped using a backslash.
+
+: Dir.open
+
+ Changed to return what the block returns when a block is given, just
+ as File.open does. (It always returned (({nil})) in 1.6 and
+ prior)
+
+: Dir.chdir
+
+ Changed to warn only when invoked from multiple threads or no block
+ is given. [ruby-dev:13823]
+
+ Dir.chdir('foo') {
+ Dir.chdir('bar') { # previously warned
+ puts Dir.pwd
+ }
+ }
+
+: Dir#pos=
+
+ Returns the new position instead of self.
+
+: Dir::glob
+
+ Now accepts optional FNM_* flags via the second argument, whereas
+ Dir::[] doesn't.
+
+ Dir.glob("makefile", File::FNM_CASEFOLD) #=> ['Makefile', 'makefile']
+
+: Class#inherited
+
+ Method is called when Class is inherited by another class.
+
+ class A; end
+ def A.inherited(by)
+ puts "A inherited by #{by.inspect}"
+ end
+ class B < A; end
+
+ Prints out "A inherited by B"
+
+: Module#include?
+
+ Added. [ruby-dev:13941]
+
+: Module#included
+
+ Added. This is a hook called after Module#append_feature.
+
+: Module#method_removed
+: Module#method_undefined
+
+ Added.
+
+: Module.new, Class.new
+
+ Extended to take block.
+
+: Time
+
+ Extended to accept a negative time_t. (Only when the platform
+ supports it)
+
+ p Time.at(-1)
+ => Thu Jan 01 08:59:59 JST 1970
+
+: Time#to_a
+: Time#zone
+
+ Made to return "UTC" under gmtime. It used to return a platform
+ dependent value, typically "GMT", in 1.6 and prior.
+
+: Marshal to use marshal_dump and marshal_load
+
+ if a dumping object responds to 'marshal_dump', Marshal.dump calls
+ it, and dumps object returned. Marshal.load allocates a new instance
+ using "allocate", then calls its "marshal_load" with dumped data.
+ Marshal format version is now 4.8 (was 4.6 in 1.6.8).
+
+: Marshal
+
+ Fixed not to dump anonymous classes/modules.
+
+ Fixed with loading modules.
+
+: Thread#group
+
+ new method to get belonging ThreadGroup.
+
+: Thread#terminate
+
+ synonym of Thread#exit
+
+: Thread#join
+
+ Optional argument limits maximum time to wait the thread in second.
+ And returns nil if timed out.
+
+: ThreagGroup#enclose
+
+ prohibits thread movement from/to enclosed groups.
+
+: Range#step([step=1])
+
+ Added.
+
+: SystemCallError
+
+ SystemCallError's "===" match (used in rescue also) is now based on its errno.
+
+: Interrupt
+
+ Made a subclass of SignalException. (It was a subclass of
+ Exception in 1.6 and prior)
+
+: NameError and NoMethodError
+
+ Moved and now NoMethodError < NameError < StandardError.
+
+: NoMethodError
+
+ Added. [ruby-dev:12763]
+
+: NotImplementError
+
+ Finally obsoleted. Use NotImplementedError.
+
+: SystemCallError.===
+
+ Added. (See the "Comparison of exception classes in a rescue clause"
+ paragraph above) [ruby-dev:12670]
+
+: SystemExit#status
+
+ Added.
+
+: Proc#==
+
+ Added.
+
+: Method#==
+
+ Added.
+
+: UnboundMethod is no longer subclass of Method
+
+ class hierarchy changed.
+
+: Enumerable#all?
+: Enumerable#any?
+: Enumerable#inject
+: Enumerable#sort_by
+
+ Added.
+
+: Math.acos(x)
+: Math.asin(x)
+: Math.atan(x)
+: Math.cosh(x)
+: Math.hypot(x,y)
+: Math.sinh(x)
+: Math.tanh(x)
+
+ Added.
+
+: Process.abort
+: Process.exit
+
+ synonym of Kernel#abort, and Kernel#exit respectively.
+
+: Process::detach(pid)
+
+ new method to detach child process. child process will be "wait"ed
+ automagically.
+
+: Process.times
+
+ Moved from Time.times. (Time.times still remains but emits a
+ warning)
+
+: Process.waitall
+
+ Added.
+
+: Process::Status
+
+ Added. (({$?})) is now an instance of this class.
+
+: Process::UID, Process::GID, Process::Sys,
+
+ Added.
+
+: Signal
+
+ Added. This module has module functions Signal.trap and Signal.list.
+
+= changes in bundled libraries
+
+: lib/cgi.rb
+
+ cgi[name] returns CGI::QueryExtension::Value that wraps string
+ value, no longer array.
+
+: lib/timeout
+
+ timeout "function" wrapped in Timeout module.
+
+: TCPServer#accept, UNIXServer#accept, Socket#accept
+
+ New methods to return an accepted socket fd.
+
+: Date and DateTime
+
+ lib/date.rb now provides both Date and DateTime.
+
+ Some methods have been renamed. But the old names are still alive.
+
+ Some new methods have been added (Date::parse, Date#strftime, etc.).
+
+ Date#mjd now returns the chronological modified Julian day number.
+
+ All facilities about tjd have been removed.
+
+: Curses
+
+ Updated. New methods and constants for using the mouse, character
+ attributes, colors and key codes have been added.
+
+: Net::HTTP
+
+ New version of Net::HTTP has introduced seriously incompatible
+ changes. For details, see document embedded in net/http.rb itself.
+
+: Socket.pack_sockaddr_in, Socket.unpack_sockaddr_in
+
+ Added. Utility for direct Socket access.
+
+: Socket.pack_sockaddr_un, Socket.unpack_sockaddr_un
+
+ Added. Utility for direct Socket access.
+
+: TCPServer#listen, UNIXServer#listen
+
+ Added.
+
+: TCPSocket.new
+: TCPSocket.open
+
+ Extended to take an address and a port number for the local side in
+ optional 3rd and 4th arguments.
+
+= newly bundled library
+
+: ext/bigdecimal
+
+ variable precision decimal number
+
+: ext/dl
+
+ an interface to the dynamic linker.
+
+: ext/enumerator
+
+ a helper module for the Enumerable interface.
+
+: ext/io/wait
+
+ IO wait methods.
+
+: ext/iconv
+
+ wrapper library of (({iconv})).
+
+: ext/openssl
+
+ OpenSSL for Ruby
+
+: ext/racc/cparse
+
+ Racc runtime library in C. (Racc is a parser generator for ruby)
+
+: ext/stringio
+
+ Pseudo (({IO})) class from/to (({String})).
+
+: ext/strscan
+
+ Fast string scanner library.
+
+: ext/syck
+
+ fast YAML parser.
+
+: lib/abbrev
+
+ creates an abbreviation table from a list
+
+: lib/benchmark
+
+ Ruby scripts benchmarker
+
+: lib/cgi/session/pstore
+
+ cgi/session back-end using pstore
+
+: lib/csv
+
+ reads/writes CSV files.
+
+: lib/date/format
+
+ strftime for Date class
+
+: lib/drb
+
+ dRuby or distributed Ruby
+
+: lib/fileutils
+
+ file utility library.
+
+: lib/generator
+
+ converts an internal iterator to an external iterator
+
+: lib/gserver
+
+ generic server used by xmlrpc
+
+: lib/ipaddr
+
+ manipulates IP address.
+
+: lib/multi-tk
+
+ to allow safe Tk, etc.
+
+: lib/open-uri
+
+ easy-to-use wrapper for net/http and net/ftp
+
+: lib/optparse
+
+ command line options utility library
+
+: lib/pathname
+
+ handles pathname in OO manner.
+
+: lib/pp
+
+ prettyprinter for Ruby objects
+
+: lib/prettyprint
+
+ implements prettyprint algorithm.
+
+: lib/profiler
+
+ library to implement -r "profile"
+
+: lib/racc/parser
+
+ RACC parser generator runtime in Ruby.
+
+: lib/scanf
+
+ scan string and retrieve object with format
+
+: lib/set
+
+ Set class
+
+: lib/runit
+
+ RubyUnit compatible layer for test/unit
+
+: lib/test/unit
+
+ unit testing framework for Ruby
+
+: lib/tmpdir
+
+ get temporary directory path.
+
+: lib/tsort
+
+ topological sorting library.
+
+: lib/rexml
+
+ REXML XML library
+
+: lib/webrick
+
+ generic internet server kit
+
+: lib/xmlrpc
+
+ simple RPC via XML
+
+: lib/un
+
+ used like 'ruby -run -e cp -- -p foo bar'. neat, isn't it?
+
+: lib/win32/registry
+
+ win32/registry is registry accessor
+
+: lib/yaml
+
+ YAML Ain't Mark-up Language
+
+= removed libraries
+
+: lib/ftplib
+
+ use net/ftp instead.
+
+: lib/telnet
+
+ use net/telnet instead.
+
+= new port
+
+: WindowsCE port
+: Win32 BCC
+
+= interpreter implementation
+
+: garbage collector
+
+ faster, but uses more memory for the worst case.
+
+: string concatenation
+
+ faster by avoiding too frequent realloc(3).
diff --git a/doc/forwardable.rd b/doc/forwardable.rd
new file mode 100644
index 0000000000..7272c374b6
--- /dev/null
+++ b/doc/forwardable.rd
@@ -0,0 +1,84 @@
+ -- forwardable.rb
+
+ $Release Version: 1.1 $
+ $Revision$
+ $Date$
+ Original version by Tosh
+
+=begin
+
+= Forwardable
+
+A Module to define delegations for selected methods to a class.
+
+== Usage
+
+Using through extending the class.
+
+ class Foo
+ extend Forwardable
+
+ def_delegators("@out", "printf", "print")
+ def_delegators(:@in, :gets)
+ def_delegator(:@contents, :[], "content_at")
+ end
+ f = Foo.new
+ f.printf ...
+ f.gets
+ f.content_at(1)
+
+== Methods
+
+--- Forwardable#def_instance_delegators(accessor, *methods)
+
+ adding the delegations for each method of ((|methods|)) to
+ ((|accessor|)).
+
+--- Forwardable#def_instance_delegator(accessor, method, ali = method)
+
+ adding the delegation for ((|method|)) to ((|accessor|)). When
+ you give optional argument ((|ali|)), ((|ali|)) is used as the
+ name of the delegation method, instead of ((|method|)).
+
+--- Forwardable#def_delegators(accessor, *methods)
+
+ the alias of ((|Forwardable#def_instance_delegators|)).
+
+--- Forwardable#def_delegator(accessor, method, ali = method)
+
+ the alias of ((|Forwardable#def_instance_delegator|)).
+
+= SingleForwardable
+
+a Module to define delegations for selected methods to an object.
+
+== Usage
+
+Using through extending the object.
+
+ g = Goo.new
+ g.extend SingleForwardable
+ g.def_delegator("@out", :puts)
+ g.puts ...
+
+== Methods
+
+--- SingleForwardable#def_singleton_delegators(accessor, *methods)
+
+ adding the delegations for each method of ((|methods|)) to
+ ((|accessor|)).
+
+--- SingleForwardable#def_singleton_delegator(accessor, method, ali = method)
+
+ adding the delegation for ((|method|)) to ((|accessor|)). When
+ you give optional argument ((|ali|)), ((|ali|)) is used as the
+ name of the delegation method, instead of ((|method|)).
+
+--- SingleForwardable#def_delegators(accessor, *methods)
+
+ the alias of ((|SingleForwardable#def_instance_delegators|)).
+
+--- SingleForwardable#def_delegator(accessor, method, ali = method)
+
+ the alias of ((|SingleForwardable#def_instance_delegator|)).
+=end
diff --git a/doc/forwardable.rd.ja b/doc/forwardable.rd.ja
new file mode 100644
index 0000000000..d928fddc5e
--- /dev/null
+++ b/doc/forwardable.rd.ja
@@ -0,0 +1,81 @@
+ -- forwatable.rb
+ $Release Version: 1.1 $
+ $Revision$
+ $Date$
+
+=begin
+= Forwardable
+
+.
+
+==
+
+extend.
+
+ class Foo
+ extend Forwardable
+
+ def_delegators("@out", "printf", "print")
+ def_delegators(:@in, :gets)
+ def_delegator(:@contents, :[], "content_at")
+ end
+ f = Foo.new
+ f.printf ...
+ f.gets
+ f.content_at(1)
+
+==
+
+--- Forwardable#def_instance_delegators(accessor, *methods)
+
+ ((|methods|))((|accessor|))
+ .
+
+--- Forwardable#def_instance_delegator(accessor, method, ali = method)
+
+ ((||method|))((|accessor|))
+ . ((|ali|)), ((|ali|))
+ , ((|accessor|))((|method|)).
+
+--- Forwardable#def_delegators(accessor, *methods)
+
+ ((|Forwardable#def_instance_delegators|)).
+
+--- Forwardable#def_delegator(accessor, method, ali = method)
+
+ ((|Forwardable#def_instance_delegator|)).
+
+= SingleForwardable
+
+, .
+
+==
+
+((|extend|)).
+
+ g = Goo.new
+ g.extend SingleForwardable
+ g.def_delegator("@out", :puts)
+ g.puts ...
+
+==
+
+--- SingleForwardable#def_singleton_delegators(accessor, *methods)
+
+ ((|methods|))((|accessor|))
+ .
+
+--- SingleForwardable#def_singleton_delegator(accessor, method, ali = method)
+
+ ((|method|))((|accessor|))
+ . ((|ali|)), ((|ali|))
+ , ((|accessor|))((|method|)).
+
+--- SingleForwardable#def_delegators(accessor, *methods)
+
+ ((|SingleForwardable#def_singleton_delegators|)).
+
+--- SingleForwardable#def_delegator(accessor, method, ali = method)
+
+ ((|SingleForwardable#def_singleton_delegator|)).
+=end
diff --git a/doc/irb/irb-tools.rd.ja b/doc/irb/irb-tools.rd.ja
new file mode 100644
index 0000000000..64d9ab29c8
--- /dev/null
+++ b/doc/irb/irb-tools.rd.ja
@@ -0,0 +1,185 @@
+irb
+ $Release Version: 0.7.1 $
+ $Revision$
+ $Date$
+ by Keiju ISHITSUKA(Nihon Rational Co.,Ltd.)
+
+=begin
+
+::
+* rtags -- ruby tags command
+
+::
+* xmp -- irb version of gotoken xmp-function
+
+::
+* frame.rb -- frame tracer
+* completion.rb -- irb completor
+
+= rtags
+
+rtagsemacsvi, TAG.
+
+==
+
+ rtags [-vi] file....
+
+emacsTAGS. -vi
+vitags.
+
+emacs, etags.el. ,
+
+*
+*
+*
+* alias
+* attr()
+* attr_XXX()
+
+.
+
+C, ,
+
+,
+
+ (
+
+,
+
+ ::::....::
+
+,
+
+ ::::....::#
+
+()
+
+ ::::....::.
+
+.
+
+= xmp.rb
+
+xmp. , xmp
+, .
+
+==
+
+=== .
+
+ require "irb/xmp"
+ xmp <<END
+ foo = 1
+ foo
+ END
+ ---
+ foo = 1
+ ==>1
+ foo
+ ==>1
+
+=== XMP.
+
+, XMP,
+.
+
+ require "irb/xmp"
+ xmp = XMP.new
+ xmp.puts <<END
+ foo = 1
+ foo
+ END
+ xmp.puts <<END
+ foo
+ END
+ ===
+ foo = 1
+ ==>1
+ foo
+ ==>1
+ foo
+ ==>1
+
+==
+
+XMP, .
+.
+
+:
+
+ xmp "foo", an_binding
+
+::
+.
+
+= frame.rb
+.
+
+* IRB::Frame.top(n = 0)
+ n. n0.
+* IRB::Frame.bottom(n = 0)
+ n. n0.
+* IRB::Frame.sender
+ . ,
+ self.
+
+::
+set_trace_funcRuby.
+.
+
+= completion.rb
+irbcompletion.
+
+==
+
+ % irb -r irb/completion
+
+, ~/.irbrc
+
+ require "irb/completion"
+
+. irb require "irb/completion" .
+
+irb (TAB) .
+
+(TAB), ,
+. .
+
+ irb(main):001:0> in
+ in inspect instance_eval
+ include install_alias_method instance_of?
+ initialize install_aliases instance_variables
+ irb(main):001:0> inspect
+ "main"
+ irb(main):002:0> foo = Object.new
+ #<Object:0x4027146c>
+
+ ((|.|))(TAB),
+ .
+
+ irb(main):003:0> foo.
+ foo.== foo.frozen? foo.protected_methods
+ foo.=== foo.hash foo.public_methods
+ foo.=~ foo.id foo.respond_to?
+ foo.__id__ foo.inspect foo.send
+ foo.__send__ foo.instance_eval foo.singleton_methods
+ foo.class foo.instance_of? foo.taint
+ foo.clone foo.instance_variables foo.tainted?
+ foo.display foo.is_a? foo.to_a
+ foo.dup foo.kind_of? foo.to_s
+ foo.eql? foo.method foo.type
+ foo.equal? foo.methods foo.untaint
+ foo.extend foo.nil?
+ foo.freeze foo.private_methods
+
+=end
+
+% Begin Emacs Environment
+% Local Variables:
+% mode: text
+% comment-column: 0
+% comment-start: "%"
+% comment-end: "\n"
+% End:
+%
+
diff --git a/doc/irb/irb.rd b/doc/irb/irb.rd
new file mode 100644
index 0000000000..a42cd46680
--- /dev/null
+++ b/doc/irb/irb.rd
@@ -0,0 +1,392 @@
+irb -- interactive ruby
+ $Release Version: 0.9 $
+ $Revision$
+ $Date$
+ by Keiju ISHITSUKA(keiju@ishitsuka.com)
+ by gotoken-san who is original translater from japanese version
+
+=begin
+= What is irb?
+
+irb stands for `interactive ruby'. irb is a tool to execute interactively
+ruby expressions read from stdin.
+
+= Invoking
+
+ % irb
+
+= Usage
+
+Use of irb is easy if you know ruby. Executing irb, prompts are
+displayed as follows. Then, enter expression of ruby. A input is
+executed when it is syntacticaly completed.
+
+ dim% irb
+ irb(main):001:0> 1+2
+ 3
+ irb(main):002:0> class Foo
+ irb(main):003:1> def foo
+ irb(main):004:2> print 1
+ irb(main):005:2> end
+ irb(main):006:1> end
+ nil
+ irb(main):007:0>
+
+And, Readline extesion module can be used with irb. Using Readline
+is the standard default action if Readline is installed.
+
+= Command line option
+
+ irb.rb [options] file_name opts
+ options:
+ -f suppress read ~/.irbrc
+ -m bc mode (fraction or matrix are available)
+ -d set $DEBUG to true (same as `ruby -d')
+ -Kc same as `ruby -Kc'
+ -r load-module same as `ruby -r'
+ --verbose command input is echoed(default)
+ --noverbose command input isn't echoed
+ --echo commands are echoed immediately before execution(default)
+ --noecho commands aren't echoed immediately before execution
+ --inspect uses `inspect' for output (the default except bc mode)
+ --noinspect doesn't uses inspect for output
+ --readline uses Readline extension module
+ --noreadline doesn't use Readline extension module
+ --prompt prompt-mode
+ --prompt-mode prompt-mode
+ switches prompt mode. Pre-defined prompt modes are
+ `default', `simple', `xmp' and `inf-ruby'
+
+ --inf-ruby-mode uses prompt appreciate for inf-ruby-mode on emacs.
+ Suppresses --readline.
+ --simple-prompt simple prompt mode
+ --noprompt no prompt
+ --tracer display trace for each execution of commands.
+ --back-trace-limit n
+ displayes backtrace top n and tail n. The default
+ value is 16.
+ --irb_debug n sets internal debug level to n (It shouldn't be used)
+ -v, --version prints the version of irb
+
+= Configurations
+
+irb reads `~/.irbrc' when it is invoked. If `~/.irbrb' doesn't exist
+irb try to read in the order `.irbrc', `irb.rc', `_irbrc' then `$irbrc'.
+
+The following is altanative to the command line option. To use them
+type as follows in an irb session.
+
+ IRB.conf[:IRB_NAME]="irb"
+ IRB.conf[:MATH_MODE]=false
+ IRB.conf[:USE_TRACER]=false
+ IRB.conf[:USE_LOADER]=false
+ IRB.conf[:IGNORE_SIGINT]=true
+ IRB.conf[:IGNORE_EOF]=false
+ IRB.conf[:INSPECT_MODE]=nil
+ IRB.conf[:IRB_RC] = nil
+ IRB.conf[:BACK_TRACE_LIMIT]=16
+ IRB.conf[:USE_LOADER] = false
+ IRB.conf[:USE_READLINE] = nil
+ IRB.conf[:USE_TRACER] = false
+ IRB.conf[:IGNORE_SIGINT] = true
+ IRB.conf[:IGNORE_EOF] = false
+ IRB.conf[:PROMPT_MODE] = :DEFALUT
+ IRB.conf[:PROMPT] = {...}
+ IRB.conf[:DEBUG_LEVEL]=0
+ IRB.conf[:VERBOSE]=true
+
+== Customizing prompt
+
+To costomize the prompt you set a variable
+
+ IRB.conf[:PROMPT]
+
+For example, describe as follows in `.irbrc'.
+
+ IRB.conf[:PROMPT][:MY_PROMPT] = { # name of prompt mode
+ :PROMPT_I => nil, # normal prompt
+ :PROMPT_S => nil, # prompt for continuated strings
+ :PROMPT_C => nil, # prompt for continuated statement
+ :RETURN => " ==>%s\n" # format to return value
+ }
+
+Then, invoke irb with the above prompt mode by
+
+ % irb --prompt my-prompt
+
+Or add the following in `.irbrc'.
+
+ IRB.conf[:PROMPT_MODE] = :MY_PROMPT
+
+Constants PROMPT_I, PROMPT_S and PROMPT_C specifies the format.
+In the prompt specification, some special strings are available.
+
+ %N command name which is running
+ %m to_s of main object (self)
+ %M inspect of main object (self)
+ %l type of string(", ', /, ]), `]' is inner %w[...]
+ %NNi indent level. NN is degits and means as same as printf("%NNd").
+ It can be ommited
+ %NNn line number.
+ %% %
+
+For instance, the default prompt mode is defined as follows:
+
+IRB.conf[:PROMPT_MODE][:DEFAULT] = {
+ :PROMPT_I => "%N(%m):%03n:%i> ",
+ :PROMPT_S => "%N(%m):%03n:%i%l ",
+ :PROMPT_C => "%N(%m):%03n:%i* ",
+ :RETURN => "%s\n"
+}
+
+RETURN is used to printf.
+
+== Configurating subirb
+
+The command line option or IRB.conf specify the default behavior of
+(sub)irb. On the other hand, each conf of in the next sction `6. Command'
+is used to individually configurate (sub)irb.
+
+If proc is set to IRB.conf[:IRB_RC], its subirb will be invoked after
+execution of that proc under giving the context of irb as its
+aregument. By this mechanism each subirb can be configurated.
+
+= Command
+
+For irb commands, both simple name and `irb_'-prefixed name are prepared.
+
+--- exit, quit, irb_exit
+ Quits (sub)irb.
+
+--- conf, irb_context
+ Displays current configuration. Modifing the configuration is
+ achieved by sending message to `conf'.
+
+--- conf.eval_history = N
+ Sets execution result history.
+ N is a integer or nil. If N > 0, the number of historys is N.
+ If N == 0, the number of historys is unlimited. If N is nill,
+ execution result history isn't used(default).
+
+--- conf.back_trace_limit
+ Sets display lines of backtrace as top n and tail n.
+ The default value is 16.
+
+--- conf.debug_level = N
+ Sets debug level of irb.
+
+--- conf.ignore_eof = true/false
+ Whether ^D (control-d) will be ignored or not.
+ If false is set, ^D means quit.
+
+--- conf.ignore_sigint= true/false
+ Whether ^C (control-c) will be ignored or not.
+ If false is set, ^D means quit. If true,
+ during input: cancel inputing then return to top level.
+ during execute: abondon current execution.
+
+--- conf.inf_ruby_mode = true/false
+ Whether inf-ruby-mode or not. The default value is false.
+
+--- conf.inspect_mode = true/false/nil
+ Specifies inspect mode.
+ true: display inspect
+ false: display to_s
+ nil: inspect mode in non math mode,
+ non inspect mode in math mode.
+
+--- conf.math_mode
+ Whether bc mode or not.
+
+--- conf.use_loader = true/false
+ Whether irb's own file reader method is used when load/require or not.
+ This mode is globaly affected (irb wide).
+
+--- conf.prompt_c
+ prompt for a continuating statement (e.g, immediately after of `if')
+
+--- conf.prompt_i
+ standard prompt
+
+--- conf.prompt_s
+ prompt for a continuating string
+
+--- conf.rc
+ Whether ~/.irbrc is read or not.
+
+--- conf.use_prompt = true/false
+ Prompting or not.
+
+--- conf.use_readline = true/false/nil
+ Whether readline is used or not.
+ true: uses
+ false: doen't use
+ nil: intends to use readline except for inf-ruby-mode (default)
+#
+#--- conf.verbose=T/F
+# Whether verbose messages are display or not.
+
+--- cws, chws, irb_change_workspace [obj]
+ obj will be self. If obj is omitted, self will be home-object, or
+ the main object of first started irb.
+
+--- pushws, irb_pushws, irb_push_workspace [obj]
+ same as UNIX-shell command pushd.
+
+--- popws, irb_popws, irb_pop_workspace
+ same as UNIX-shell command popd
+
+--- irb [obj]
+ Invoke subirb. If obj is given, obj will be self.
+
+--- jobs, irb_jobs
+ List of subirb
+
+--- fg n, irb_fg n
+ Switch into specified subirb. The following is candidates of n:
+
+ irb number
+ thhread
+ irb object
+ self(obj which is specified of irb obj)
+
+--- kill n, irb_kill n
+ Kill subirb. The means of n is as same as the case of irb_fg.
+
+--- souce, irb_source path
+ This is a like UNIX-shell command source. evaluate script in path
+ on current context.
+
+--- irb_load path, prev
+ irb-version of Ruby's load.
+
+= System variable
+
+--- _ The latest value of evaluation (it is local)
+--- __ The history of evaluation values.
+ __[line_no] return an evaluation value of line number<line_no>. If
+ line_no is a negative, return value before -<line_no> from latest
+ value.
+
+= Session Example
+
+ dim% ruby irb.rb
+ irb(main):001:0> irb # invoke subirb
+ irb#1(main):001:0> jobs # list of subirbs
+ #0->irb on main (#<Thread:0x400fb7e4> : stop)
+ #1->irb#1 on main (#<Thread:0x40125d64> : running)
+ nil
+ irb#1(main):002:0> fg 0 # switch job
+ nil
+ irb(main):002:0> class Foo;end
+ nil
+ irb(main):003:0> irb Foo # invoke subirb which has the
+ # context of Foo
+ irb#2(Foo):001:0> def foo # define Foo#foo
+ irb#2(Foo):002:1> print 1
+ irb#2(Foo):003:1> end
+ nil
+ irb#2(Foo):004:0> fg 0 # switch job
+ nil
+ irb(main):004:0> jobs # list of job
+ #0->irb on main (#<Thread:0x400fb7e4> : running)
+ #1->irb#1 on main (#<Thread:0x40125d64> : stop)
+ #2->irb#2 on Foo (#<Thread:0x4011d54c> : stop)
+ nil
+ irb(main):005:0> Foo.instance_methods # Foo#foo is defined asurely
+ ["foo"]
+ irb(main):006:0> fg 2 # switch job
+ nil
+ irb#2(Foo):005:0> def bar # define Foo#bar
+ irb#2(Foo):006:1> print "bar"
+ irb#2(Foo):007:1> end
+ nil
+ irb#2(Foo):010:0> Foo.instance_methods
+ ["bar", "foo"]
+ irb#2(Foo):011:0> fg 0
+ nil
+ irb(main):007:0> f = Foo.new
+ #<Foo:0x4010af3c>
+ irb(main):008:0> irb f # invoke subirb which has the
+ # context of f (instance of Foo)
+ irb#3(#<Foo:0x4010af3c>):001:0> jobs
+ #0->irb on main (#<Thread:0x400fb7e4> : stop)
+ #1->irb#1 on main (#<Thread:0x40125d64> : stop)
+ #2->irb#2 on Foo (#<Thread:0x4011d54c> : stop)
+ #3->irb#3 on #<Foo:0x4010af3c> (#<Thread:0x4010a1e0> : running)
+ nil
+ irb#3(#<Foo:0x4010af3c>):002:0> foo # evaluate f.foo
+ 1nil
+ irb#3(#<Foo:0x4010af3c>):003:0> bar # evaluate f.bar
+ barnil
+ irb#3(#<Foo:0x4010af3c>):004:0> kill 1, 2, 3# kill job
+ nil
+ irb(main):009:0> jobs
+ #0->irb on main (#<Thread:0x400fb7e4> : running)
+ nil
+ irb(main):010:0> exit # exit
+ dim%
+
+= Restrictions
+
+Because irb evaluates the inputs immediately after the imput is
+syntactically completed, irb gives slight different result than
+directly use ruby. Known difference is pointed out here.
+
+
+== Declaration of the local variable
+
+The following causes an error in ruby:
+
+ eval "foo = 0"
+ foo
+ --
+ -:2: undefined local variable or method `foo' for #<Object:0x40283118> (NameError)
+ ---
+ NameError
+
+Though, the above will successfully done by irb.
+
+ >> eval "foo = 0"
+ => 0
+ >> foo
+ => 0
+
+Ruby evaluates a code after reading entire of code and determination
+of the scope of local variables. On the other hand, irb do
+immediately. More precisely, irb evaluate at first
+
+ evel "foo = 0"
+
+then foo is defined on this timing. It is because of this
+incompatibility.
+
+If you'd like to detect those differences, begin...end can be used:
+
+ >> begin
+ ?> eval "foo = 0"
+ >> foo
+ >> end
+ NameError: undefined local variable or method `foo' for #<Object:0x4013d0f0>
+ (irb):3
+ (irb_local_binding):1:in `eval'
+
+== Here-document
+
+Implementation of Here-document is incomplete.
+
+== Symbol
+
+Irb can not always recognize a symbol as to be Symbol. Concretely, an
+expression have completed, however Irb regard it as continuation line.
+
+=end
+
+% Begin Emacs Environment
+% Local Variables:
+% mode: text
+% comment-column: 0
+% comment-start: "%"
+% comment-end: "\n"
+% End:
+%
diff --git a/doc/irb/irb.rd.ja b/doc/irb/irb.rd.ja
new file mode 100644
index 0000000000..bf8ac5d517
--- /dev/null
+++ b/doc/irb/irb.rd.ja
@@ -0,0 +1,411 @@
+irb -- interactive ruby
+ $Release Version: 0.9 $
+ $Revision$
+ $Date$
+ by Keiju ISHITSUKA(keiju@ishitsuka.com)
+=begin
+= irb?
+
+irbinteractive ruby. ruby/
+.
+
+=
+
+ % irb
+
+.
+
+=
+
+irb, Ruby. irb
+. irb,
+. , ruby.
+.
+
+ dim% irb
+ irb(main):001:0> 1+2
+ 3
+ irb(main):002:0> class Foo
+ irb(main):003:1> def foo
+ irb(main):004:2> print 1
+ irb(main):005:2> end
+ irb(main):006:1> end
+ nil
+ irb(main):007:0>
+
+, irbReadline. Readline
+, .
+
+=
+
+ irb.rb [options] file_name opts
+ options:
+ -f ~/.irbrc .
+ -m bc(, )
+ -d $DEBUG true(ruby -d )
+ -Kc ruby -Kc
+ -r load-module ruby -r .
+ --verbose ()
+ --noverbose
+ --echo ()
+ --noecho
+ --inspect inspect(bc).
+ --noinspect inspect.
+ --readline readline.
+ --noreadline readline. ,
+ inf-ruby-modereadline
+ .
+ --prompt prompt-mode
+ --prompt-mode prompt-mode
+ .
+ , default, simple, xmp, inf-ruby
+ . default
+ .
+
+ --inf-ruby-mode emacsinf-ruby-mode.
+ , readline.
+ --simple-prompt
+ .
+ --noprompt .
+ --tracer .
+ --back-trace-limit n
+ n,
+ n. 16
+ --irb_debug n irbn(
+ ).
+ -v, --version irb
+
+=
+
+irb``~/.irbrc''. ,
+``.irbrc'', ``irb.rc'', ``_irbrc'', ``$irbrc''load.
+
+,
+.
+
+ IRB.conf[:IRB_NAME]="irb"
+ IRB.conf[:MATH_MODE]=false
+ IRB.conf[:USE_TRACER]=false
+ IRB.conf[:USE_LOADER]=false
+ IRB.conf[:IGNORE_SIGINT]=true
+ IRB.conf[:IGNORE_EOF]=false
+ IRB.conf[:INSPECT_MODE]=nil
+ IRB.conf[:IRB_RC] = nil
+ IRB.conf[:BACK_TRACE_LIMIT]=16
+ IRB.conf[:USE_LOADER] = false
+ IRB.conf[:USE_READLINE] = nil
+ IRB.conf[:USE_TRACER] = false
+ IRB.conf[:IGNORE_SIGINT] = true
+ IRB.conf[:IGNORE_EOF] = false
+ IRB.conf[:PROMPT_MODE] = :DEFALUT
+ IRB.conf[:PROMPT] = {...}
+ IRB.conf[:DEBUG_LEVEL]=0
+ IRB.conf[:VERBOSE]=true
+
+==
+
+,
+
+ IRB.conf[:PROMPT]
+
+. , .irbrc:
+
+ IRB.conf[:PROMPT][:MY_PROMPT] = { #
+ :PROMPT_I => nil, #
+ :PROMPT_S => nil, #
+ :PROMPT_C => nil, #
+ :RETURN => " ==>%s\n" #
+ }
+
+,
+
+ irb --prompt my-prompt
+
+. , .irbrc
+OK.
+
+ IRB.conf[:PROMPT_MODE] = :MY_PROMPT
+
+PROMPT_I, PROMPT_S, PROMPT_C, .
+
+ %N .
+ %m main(self)to_s.
+ %M main(self)inspect.
+ %l (", ', /, ], `]'%w)
+ %NNi . NNprintf%NNd.
+
+ %NNn .
+ %% %
+
+, :
+
+ IRB.conf[:PROMPT_MODE][:DEFAULT] = {
+ :PROMPT_I => "%N(%m):%03n:%i> ",
+ :PROMPT_S => "%N(%m):%03n:%i%l ",
+ :PROMPT_C => "%N(%m):%03n:%i* ",
+ :RETURN => "%s\n"
+ }
+
+.
+
+RETURN, printf. .
+
+== irb
+
+IRB.conf()irb
+, `5. 'conf()irb
+.
+
+IRB.conf[:IRB_RC]proc, irb
+procirb.
+irb.
+
+
+=
+
+irb, `irb_'
+. , override.
+
+--- exit, quit, irb_exit
+ .
+ irb, irb.
+
+--- conf, irb_context
+ irb. , conf
+ .
+
+--- conf.eval_history = N
+ .
+ nnnil nn>0 nn==0
+ nil().
+
+--- Conf.back_trace_limit
+ n, n.
+ 16
+
+--- conf.debug_level = N
+ irb
+
+--- conf.ignore_eof = true/false
+ ^D. true^D, false
+ irb.
+
+--- conf.ignore_sigint= true/false
+ ^C. false, irb. true
+ :
+ : .
+ : .
+
+--- conf.inf_ruby_mode = true/false
+ inf-ruby-mode. false.
+
+--- conf.inspect_mode = true/false/nil
+ .
+ true: .
+ false: print.
+ nil: , inspect mode, math, non
+ inspect mode.
+
+--- conf.math_mode
+ . bc(, )?
+
+--- conf.use_loader = true/false
+ load/requireirbfile(
+ ). IRB.
+
+--- conf.prompt_c
+ if, .
+
+--- conf.prompt_i
+ .
+
+--- conf.prompt_s
+ .
+
+--- conf.rc
+ ~/.irbrc?
+
+--- conf.use_prompt = true/false
+ ? .
+
+--- conf.use_readline = true/false/nil
+ readline?
+ true: readline.
+ false: readline.
+ nil: ()inf-ruby-modereadline
+ .
+#
+#--- conf.verbose=T/F
+# irb?
+
+--- cws, chws, irb_cws, irb_chws, irb_change_workspace [obj]
+ objself. obj, home workspace,
+ irbmain objectself.
+
+--- pushws, irb_pushws, irb_push_workspace [obj]
+ UNIXpushd.
+
+--- popws, irb_popws, irb_pop_workspace
+ UNIXpopd.
+
+--- irb [obj]
+ irb. obj, objself.
+
+--- jobs, irb_jobs
+ irb
+
+--- fg n, irb_fg n
+ irb. n, .
+
+ irb
+
+ irb
+ self(irb objobj)
+
+--- kill n, irb_kill n
+ irbkill. nfg.
+
+--- souce, irb_source path
+ UNIXsource. path
+ .
+
+--- irb_load path, prev
+
+ Rubyloadirb.
+
+=
+
+--- _
+ ().
+--- __
+ .
+ __[line_no]. line_no
+ -line_no.
+
+=
+
+.
+
+ dim% ruby irb.rb
+ irb(main):001:0> irb # irb
+ irb#1(main):001:0> jobs # irb
+ #0->irb on main (#<Thread:0x400fb7e4> : stop)
+ #1->irb#1 on main (#<Thread:0x40125d64> : running)
+ nil
+ irb#1(main):002:0> fg 0 # job
+ nil
+ irb(main):002:0> class Foo;end
+ nil
+ irb(main):003:0> irb Foo # Fooirb
+ #
+ irb#2(Foo):001:0> def foo # Foo#foo
+ irb#2(Foo):002:1> print 1
+ irb#2(Foo):003:1> end
+ nil
+ irb#2(Foo):004:0> fg 0 # job
+ nil
+ irb(main):004:0> jobs # job
+ #0->irb on main (#<Thread:0x400fb7e4> : running)
+ #1->irb#1 on main (#<Thread:0x40125d64> : stop)
+ #2->irb#2 on Foo (#<Thread:0x4011d54c> : stop)
+ nil
+ irb(main):005:0> Foo.instance_methods # Foo#foo
+ #
+ ["foo"]
+ irb(main):006:0> fg 2 # job
+ nil
+ irb#2(Foo):005:0> def bar # Foo#bar
+ irb#2(Foo):006:1> print "bar"
+ irb#2(Foo):007:1> end
+ nil
+ irb#2(Foo):010:0> Foo.instance_methods
+ ["bar", "foo"]
+ irb#2(Foo):011:0> fg 0
+ nil
+ irb(main):007:0> f = Foo.new
+ #<Foo:0x4010af3c>
+ irb(main):008:0> irb f # Fooirb
+ # .
+ irb#3(#<Foo:0x4010af3c>):001:0> jobs
+ #0->irb on main (#<Thread:0x400fb7e4> : stop)
+ #1->irb#1 on main (#<Thread:0x40125d64> : stop)
+ #2->irb#2 on Foo (#<Thread:0x4011d54c> : stop)
+ #3->irb#3 on #<Foo:0x4010af3c> (#<Thread:0x4010a1e0> : running)
+ nil
+ irb#3(#<Foo:0x4010af3c>):002:0> foo # f.foo
+ nil
+ irb#3(#<Foo:0x4010af3c>):003:0> bar # f.bar
+ barnil
+ irb#3(#<Foo:0x4010af3c>):004:0> kill 1, 2, 3# jobkill
+ nil
+ irb(main):009:0> jobs
+ #0->irb on main (#<Thread:0x400fb7e4> : running)
+ nil
+ irb(main):010:0> exit #
+ dim%
+
+=
+
+irb, ().
+, ruby, .
+
+.
+
+==
+
+ruby, .
+
+ eval "foo = 0"
+ foo
+ --
+ -:2: undefined local variable or method `foo' for #<Object:0x40283118> (NameError)
+ ---
+ NameError
+
+, irb
+
+ >> eval "foo = 0"
+ => 0
+ >> foo
+ => 0
+
+, . , ruby
+. , irb
+(). ,
+
+ evel "foo = 0"
+
+, ,
+foo.
+
+rubyirb, begin...end
+:
+
+ >> begin
+ ?> eval "foo = 0"
+ >> foo
+ >> end
+ NameError: undefined local variable or method `foo' for #<Object:0x4013d0f0>
+ (irb):3
+ (irb_local_binding):1:in `eval'
+
+==
+
+.
+
+==
+
+.
+.
+
+=end
+
+% Begin Emacs Environment
+% Local Variables:
+% mode: text
+% comment-column: 0
+% comment-start: "%"
+% comment-end: "\n"
+% End:
+%
+
diff --git a/doc/shell.rd b/doc/shell.rd
new file mode 100644
index 0000000000..02ee1b020a
--- /dev/null
+++ b/doc/shell.rd
@@ -0,0 +1,348 @@
+ -- shell.rb
+ $Release Version: 0.6.0 $
+ $Revision$
+ $Date$
+ by Keiju ISHITSUKA(keiju@ishitsuka.com)
+
+=begin
+
+= What's shell.rb?
+
+It realizes a wish to do execution of commands with filters and pipes
+like sh/csh by using just native facilities of ruby.
+
+= Main classes
+
+== Shell
+
+Every shell object has its own current working directory, and executes
+each command as if it stands in the directory.
+
+--- Shell#cwd
+--- Shell#dir
+--- Shell#getwd
+--- Shell#pwd
+
+ Returns the current directory
+
+--- Shell#system_path
+
+ Returns the command search path in an array
+
+--- Shell#umask
+
+ Returns the umask
+
+== Filter
+
+Any result of command exection is a Filter. Filter include
+Enumerable, therefore a Filter object can use all Enumerable
+facilities.
+
+= Main methods
+
+== Command definitions
+
+In order to execute a command on your OS, you need to define it as a
+Shell method.
+
+Alternatively, you can execute any command via Shell#system even if it
+is not defined.
+
+--- Shell.def_system_command(command, path = command)
+
+ Defines a command. Registers <path> as a Shell method
+ <command>.
+
+ ex)
+ Shell.def_system_command "ls"
+ Defines ls.
+
+ Shell.def_system_command "sys_sort", "sort"
+ Defines sys_sort as sort.
+
+--- Shell.undef_system_command(command)
+
+ Undefines a commmand
+
+--- Shell.alias_command(ali, command, *opts) {...}
+
+ Aliases a command.
+
+ ex)
+ Shell.alias_command "lsC", "ls", "-CBF", "--show-control-chars"
+ Shell.alias_command("lsC", "ls"){|*opts| ["-CBF", "--show-control-chars", *opts]}
+
+--- Shell.unalias_command(ali)
+
+ Unaliases a command.
+
+--- Shell.install_system_commands(pre = "sys_")
+
+ Defines all commands in the default_system_path as Shell method,
+ all with <pre> prefixed to their names.
+
+== Creation
+
+--- Shell.new
+
+ Creates a Shell object which current directory is set to the
+ process current directory.
+
+--- Shell.cd(path)
+
+ Creates a Shell object which current directory is set to
+ <path>.
+
+== Process management
+
+--- Shell#jobs
+
+ Returns a list of scheduled jobs.
+
+--- Shell#kill sig, job
+
+ Sends a signal <sig> to <job>.
+
+== Current directory operations
+
+--- Shell#cd(path, &block)
+--- Shell#chdir
+
+ Changes the current directory to <path>. If a block is given,
+ it restores the current directory when the block ends.
+
+--- Shell#pushd(path = nil, &block)
+--- Shell#pushdir
+
+ Pushes the current directory to the directory stack, changing
+ the current directory to <path>. If <path> is omitted, it
+ exchanges its current directory and the top of its directory
+ stack. If a block is given, it restores the current directory
+ when the block ends.
+
+--- Shell#popd
+--- Shell#popdir
+
+ Pops a directory from the directory stack, and sets the current
+ directory to it.
+
+== File and directory operations
+
+--- Shell#foreach(path = nil, &block)
+
+ Same as:
+ File#foreach (when path is a file)
+ Dir#foreach (when path is a directory)
+
+--- Shell#open(path, mode)
+
+ Same as:
+ File#open (when path is a file)
+ Dir#open (when path is a directory)
+
+--- Shell#unlink(path)
+
+ Same as:
+ Dir#open (when path is a file)
+ Dir#unlink (when path is a directory)
+
+--- Shell#test(command, file1, file2)
+--- Shell#[command, file1, file2]
+
+ Same as test().
+ ex)
+ sh[?e, "foo"]
+ sh[:e, "foo"]
+ sh["e", "foo"]
+ sh[:exists?, "foo"]
+ sh["exists?", "foo"]
+
+--- Shell#mkdir(*path)
+
+ Same as Dir.mkdir (with multiple directories allowed)
+
+--- Shell#rmdir(*path)
+
+ Same as Dir.rmdir (with multiple directories allowed)
+
+== Command execution
+
+--- System#system(command, *opts)
+
+ Executes <command> with <opts>.
+
+ ex)
+ print sh.system("ls", "-l")
+ sh.system("ls", "-l") | sh.head > STDOUT
+
+--- System#rehash
+
+ Does rehash.
+
+--- Shell#transact &block
+
+ Executes a block as self.
+ ex)
+ sh.transact{system("ls", "-l") | head > STDOUT}
+
+--- Shell#out(dev = STDOUT, &block)
+
+ Does transact, with redirecting the result output to <dev>.
+
+== Internal commands
+
+--- Shell#echo(*strings)
+--- Shell#cat(*files)
+--- Shell#glob(patten)
+--- Shell#tee(file)
+
+ Return Filter objects, which are results of their execution.
+
+--- Filter#each &block
+
+ Iterates a block for each line of it.
+
+--- Filter#<(src)
+
+ Inputs from <src>, which is either a string of a file name or an
+ IO.
+
+--- Filter#>(to)
+
+ Outputs to <to>, which is either a string of a file name or an
+ IO.
+
+--- Filter#>>(to)
+
+ Appends the ouput to <to>, which is either a string of a file
+ name or an IO.
+
+--- Filter#|(filter)
+
+ Processes a pipeline.
+
+--- Filter#+(filter)
+
+ (filter1 + filter2) outputs filter1, and then outputs filter2.
+
+--- Filter#to_a
+--- Filter#to_s
+
+== Built-in commands
+
+--- Shell#atime(file)
+--- Shell#basename(file, *opt)
+--- Shell#chmod(mode, *files)
+--- Shell#chown(owner, group, *file)
+--- Shell#ctime(file)
+--- Shell#delete(*file)
+--- Shell#dirname(file)
+--- Shell#ftype(file)
+--- Shell#join(*file)
+--- Shell#link(file_from, file_to)
+--- Shell#lstat(file)
+--- Shell#mtime(file)
+--- Shell#readlink(file)
+--- Shell#rename(file_from, file_to)
+--- Shell#split(file)
+--- Shell#stat(file)
+--- Shell#symlink(file_from, file_to)
+--- Shell#truncate(file, length)
+--- Shell#utime(atime, mtime, *file)
+
+ Equivalent to the class methods of File with the same names.
+
+--- Shell#blockdev?(file)
+--- Shell#chardev?(file)
+--- Shell#directory?(file)
+--- Shell#executable?(file)
+--- Shell#executable_real?(file)
+--- Shell#exist?(file)/Shell#exists?(file)
+--- Shell#file?(file)
+--- Shell#grpowned?(file)
+--- Shell#owned?(file)
+--- Shell#pipe?(file)
+--- Shell#readable?(file)
+--- Shell#readable_real?(file)
+--- Shell#setgid?(file)
+--- Shell#setuid?(file)
+--- Shell#size(file)/Shell#size?(file)
+--- Shell#socket?(file)
+--- Shell#sticky?(file)
+--- Shell#symlink?(file)
+--- Shell#writable?(file)
+--- Shell#writable_real?(file)
+--- Shell#zero?(file)
+
+ Equivalent to the class methods of FileTest with the same names.
+
+--- Shell#syscopy(filename_from, filename_to)
+--- Shell#copy(filename_from, filename_to)
+--- Shell#move(filename_from, filename_to)
+--- Shell#compare(filename_from, filename_to)
+--- Shell#safe_unlink(*filenames)
+--- Shell#makedirs(*filenames)
+--- Shell#install(filename_from, filename_to, mode)
+
+ Equivalent to the class methods of FileTools with the same
+ names.
+
+ And also, there are some aliases for convenience:
+
+--- Shell#cmp <- Shell#compare
+--- Shell#mv <- Shell#move
+--- Shell#cp <- Shell#copy
+--- Shell#rm_f <- Shell#safe_unlink
+--- Shell#mkpath <- Shell#makedirs
+
+= Samples
+
+== ex1
+
+ sh = Shell.cd("/tmp")
+ sh.mkdir "shell-test-1" unless sh.exists?("shell-test-1")
+ sh.cd("shell-test-1")
+ for dir in ["dir1", "dir3", "dir5"]
+ if !sh.exists?(dir)
+ sh.mkdir dir
+ sh.cd(dir) do
+ f = sh.open("tmpFile", "w")
+ f.print "TEST\n"
+ f.close
+ end
+ print sh.pwd
+ end
+ end
+
+== ex2
+
+ sh = Shell.cd("/tmp")
+ sh.transact do
+ mkdir "shell-test-1" unless exists?("shell-test-1")
+ cd("shell-test-1")
+ for dir in ["dir1", "dir3", "dir5"]
+ if !exists?(dir)
+ mkdir dir
+ cd(dir) do
+ f = open("tmpFile", "w")
+ f.print "TEST\n"
+ f.close
+ end
+ print pwd
+ end
+ end
+ end
+
+== ex3
+
+ sh.cat("/etc/printcap") | sh.tee("tee1") > "tee2"
+ (sh.cat < "/etc/printcap") | sh.tee("tee11") > "tee12"
+ sh.cat("/etc/printcap") | sh.tee("tee1") >> "tee2"
+ (sh.cat < "/etc/printcap") | sh.tee("tee11") >> "tee12"
+
+== ex4
+
+ print sh.cat("/etc/passwd").head.collect{|l| l =~ /keiju/}
+
+=end
diff --git a/doc/shell.rd.ja b/doc/shell.rd.ja
new file mode 100644
index 0000000000..073e71ea42
--- /dev/null
+++ b/doc/shell.rd.ja
@@ -0,0 +1,336 @@
+ -- shell.rb
+ $Release Version: 0.6.0 $
+ $Revision$
+ $Date$
+ by Keiju ISHITSUKA(keiju@ishitsuka.com)
+
+=begin
+
+=
+
+rubysh/csh.
+sh/cshruby.
+
+=
+
+== Shell
+
+Shell,
+.
+
+--- Shell#cwd
+--- Shell#dir
+--- Shell#getwd
+--- Shell#pwd
+
+
+
+--- Shell#system_path
+
+
+
+--- Shell#umask
+
+ umask
+
+== Filter
+
+Filter. Enumerableinclude
+.
+
+=
+
+==
+
+OS, Shell.
+
+) Shell#system.
+
+--- Shell.def_system_command(command, path = command)
+
+ Shellcommand.
+
+ )
+ Shell.def_system_command "ls"
+ ls
+
+ Shell.def_system_command "sys_sort", "sort"
+ sortsys_sort
+
+--- Shell.undef_system_command(command)
+
+ command.
+
+--- Shell.alias_command(ali, command, *opts) {...}
+
+ commandalias.
+
+ )
+ Shell.alias_command "lsC", "ls", "-CBF", "--show-control-chars"
+ Shell.alias_command("lsC", "ls"){|*opts| ["-CBF", "--show-control-chars", *opts]}
+
+--- Shell.unalias_command(ali)
+
+ commandalias.
+
+--- Shell.install_system_commands(pre = "sys_")
+
+ system_pathShell.
+ pre.
+
+==
+
+--- Shell.new
+
+ Shell
+ .
+
+--- Shell.cd(path)
+
+ pathShell.
+
+==
+
+--- Shell#jobs
+
+ job.
+
+--- Shell#kill sig, job
+
+ jobsig
+
+==
+
+--- Shell#cd(path, &block)
+--- Shell#chdir
+
+ path.
+ .
+
+--- Shell#pushd(path = nil, &block)
+--- Shell#pushdir
+
+ ,
+ path. path,
+ .
+ , pushd.
+
+--- Shell#popd
+--- Shell#popdir
+
+ , .
+
+== /
+
+--- Shell#foreach(path = nil, &block)
+
+ path, File#foreach
+ path, Dir#foreach
+
+--- Shell#open(path, mode)
+
+ path, File#open
+ path, Dir#open
+
+--- Shell#unlink(path)
+
+ path, File#unlink
+ path, Dir#unlink
+
+--- Shell#test(command, file1, file2)
+--- Shell#[command, file1, file2]
+
+ test.
+ )
+ sh[?e, "foo"]
+ sh[:e, "foo"]
+ sh["e", "foo"]
+ sh[:exists?, "foo"]
+ sh["exists?", "foo"]
+
+--- Shell#mkdir(*path)
+
+ Dir.mkdir()
+
+--- Shell#rmdir(*path)
+
+ Dir.rmdir()
+
+==
+
+--- System#system(command, *opts)
+
+ command.
+ )
+ print sh.system("ls", "-l")
+ sh.system("ls", "-l") | sh.head > STDOUT
+
+--- System#rehash
+
+
+
+--- Shell#transact &block
+
+ shellself.
+ )
+ sh.transact{system("ls", "-l") | head > STDOUT}
+
+--- Shell#out(dev = STDOUT, &block)
+
+ transactdev.
+
+==
+
+--- Shell#echo(*strings)
+--- Shell#cat(*files)
+--- Shell#glob(patten)
+--- Shell#tee(file)
+
+ , Filter.
+
+--- Filter#each &block
+
+ block.
+
+--- Filter#<(src)
+
+ src. src, , IO
+ .
+
+--- Filter#>(to)
+
+ src. to, , IO
+ .
+
+--- Filter#>>(to)
+
+ src. to, , IO
+ .
+
+--- Filter#|(filter)
+
+
+
+--- Filter#+(filter)
+
+ filter1 + filter2 filter1, filter2.
+
+--- Filter#to_a
+--- Filter#to_s
+
+==
+
+--- Shell#atime(file)
+--- Shell#basename(file, *opt)
+--- Shell#chmod(mode, *files)
+--- Shell#chown(owner, group, *file)
+--- Shell#ctime(file)
+--- Shell#delete(*file)
+--- Shell#dirname(file)
+--- Shell#ftype(file)
+--- Shell#join(*file)
+--- Shell#link(file_from, file_to)
+--- Shell#lstat(file)
+--- Shell#mtime(file)
+--- Shell#readlink(file)
+--- Shell#rename(file_from, file_to)
+--- Shell#split(file)
+--- Shell#stat(file)
+--- Shell#symlink(file_from, file_to)
+--- Shell#truncate(file, length)
+--- Shell#utime(atime, mtime, *file)
+
+ File.
+
+--- Shell#blockdev?(file)
+--- Shell#chardev?(file)
+--- Shell#directory?(file)
+--- Shell#executable?(file)
+--- Shell#executable_real?(file)
+--- Shell#exist?(file)/Shell#exists?(file)
+--- Shell#file?(file)
+--- Shell#grpowned?(file)
+--- Shell#owned?(file)
+--- Shell#pipe?(file)
+--- Shell#readable?(file)
+--- Shell#readable_real?(file)
+--- Shell#setgid?(file)
+--- Shell#setuid?(file)
+--- Shell#size(file)/Shell#size?(file)
+--- Shell#socket?(file)
+--- Shell#sticky?(file)
+--- Shell#symlink?(file)
+--- Shell#writable?(file)
+--- Shell#writable_real?(file)
+--- Shell#zero?(file)
+
+ FileTest.
+
+--- Shell#syscopy(filename_from, filename_to)
+--- Shell#copy(filename_from, filename_to)
+--- Shell#move(filename_from, filename_to)
+--- Shell#compare(filename_from, filename_to)
+--- Shell#safe_unlink(*filenames)
+--- Shell#makedirs(*filenames)
+--- Shell#install(filename_from, filename_to, mode)
+
+ FileTools.
+
+ , .
+
+--- Shell#cmp <- Shell#compare
+--- Shell#mv <- Shell#move
+--- Shell#cp <- Shell#copy
+--- Shell#rm_f <- Shell#safe_unlink
+--- Shell#mkpath <- Shell#makedirs
+
+=
+
+== ex1
+
+ sh = Shell.cd("/tmp")
+ sh.mkdir "shell-test-1" unless sh.exists?("shell-test-1")
+ sh.cd("shell-test-1")
+ for dir in ["dir1", "dir3", "dir5"]
+ if !sh.exists?(dir)
+ sh.mkdir dir
+ sh.cd(dir) do
+ f = sh.open("tmpFile", "w")
+ f.print "TEST\n"
+ f.close
+ end
+ print sh.pwd
+ end
+ end
+
+== ex2
+
+ sh = Shell.cd("/tmp")
+ sh.transact do
+ mkdir "shell-test-1" unless exists?("shell-test-1")
+ cd("shell-test-1")
+ for dir in ["dir1", "dir3", "dir5"]
+ if !exists?(dir)
+ mkdir dir
+ cd(dir) do
+ f = open("tmpFile", "w")
+ f.print "TEST\n"
+ f.close
+ end
+ print pwd
+ end
+ end
+ end
+
+== ex3
+
+ sh.cat("/etc/printcap") | sh.tee("tee1") > "tee2"
+ (sh.cat < "/etc/printcap") | sh.tee("tee11") > "tee12"
+ sh.cat("/etc/printcap") | sh.tee("tee1") >> "tee2"
+ (sh.cat < "/etc/printcap") | sh.tee("tee11") >> "tee12"
+
+== ex4
+
+ print sh.cat("/etc/passwd").head.collect{|l| l =~ /keiju/}
+
+=end
diff --git a/enum.c b/enum.c
index ffc0734f44..a745a6e604 100644
--- a/enum.c
+++ b/enum.c
@@ -1,4 +1,4 @@
-/************************************************
+/**********************************************************************
enum.c -
@@ -6,13 +6,15 @@
$Date$
created at: Fri Oct 1 15:15:19 JST 1993
- Copyright (C) 1993-1998 Yukihiro Matsumoto
+ Copyright (C) 1993-2003 Yukihiro Matsumoto
-************************************************/
+**********************************************************************/
#include "ruby.h"
+#include "node.h"
+#include "util.h"
-VALUE mEnumerable;
+VALUE rb_mEnumerable;
static ID id_each, id_eqq, id_cmp;
VALUE
@@ -27,374 +29,915 @@ grep_i(i, arg)
VALUE i, *arg;
{
if (RTEST(rb_funcall(arg[0], id_eqq, 1, i))) {
- ary_push(arg[1], i);
+ rb_ary_push(arg[1], i);
}
return Qnil;
}
static VALUE
-grep_iter_i(i, pat)
- VALUE i, pat;
+grep_iter_i(i, arg)
+ VALUE i, *arg;
{
- if (RTEST(rb_funcall(pat, id_eqq, 1, i))) {
- rb_yield(i);
+ if (RTEST(rb_funcall(arg[0], id_eqq, 1, i))) {
+ rb_ary_push(arg[1], rb_yield(i));
}
return Qnil;
}
+/*
+ * 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
enum_grep(obj, pat)
VALUE obj, pat;
{
- if (iterator_p()) {
- rb_iterate(rb_each, obj, grep_iter_i, pat);
- return obj;
- }
- else {
- VALUE tmp, arg[2];
+ VALUE ary = rb_ary_new();
+ VALUE arg[2];
- arg[0] = pat; arg[1] = tmp = ary_new();
- rb_iterate(rb_each, obj, grep_i, (VALUE)arg);
+ arg[0] = pat;
+ arg[1] = ary;
- return tmp;
- }
+ rb_iterate(rb_each, obj, rb_block_given_p() ? grep_iter_i : grep_i, (VALUE)arg);
+
+ return ary;
}
-struct find_arg {
- int found;
- VALUE val;
-};
-
static VALUE
-find_i(i, arg)
+find_i(i, memo)
VALUE i;
- struct find_arg *arg;
+ NODE *memo;
{
if (RTEST(rb_yield(i))) {
- arg->found = TRUE;
- arg->val = i;
+ memo->u2.value = Qtrue;
+ memo->u1.value = i;
rb_iter_break();
}
return Qnil;
}
+/*
+ * 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
enum_find(argc, argv, obj)
int argc;
VALUE* argv;
VALUE obj;
{
- struct find_arg arg;
+ NODE *memo = rb_node_newnode(NODE_MEMO, Qnil, Qfalse, 0);
VALUE if_none;
rb_scan_args(argc, argv, "01", &if_none);
- arg.found = FALSE;
- rb_iterate(rb_each, obj, find_i, (VALUE)&arg);
- if (arg.found) {
- return arg.val;
+ rb_iterate(rb_each, obj, find_i, (VALUE)memo);
+ if (memo->u2.value) {
+ return memo->u1.value;
}
if (!NIL_P(if_none)) {
- rb_eval_cmd(if_none, Qnil);
+ return rb_funcall(if_none, rb_intern("call"), 0, 0);
}
return Qnil;
}
static VALUE
-find_all_i(i, tmp)
- VALUE i, tmp;
+find_all_i(i, ary)
+ VALUE i, ary;
{
if (RTEST(rb_yield(i))) {
- ary_push(tmp, i);
+ rb_ary_push(ary, i);
}
return Qnil;
}
+/*
+ * 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
enum_find_all(obj)
VALUE obj;
{
- VALUE tmp;
-
- tmp = ary_new();
- rb_iterate(rb_each, obj, find_all_i, tmp);
+ VALUE ary = rb_ary_new();
+
+ rb_iterate(rb_each, obj, find_all_i, ary);
- return tmp;
+ return ary;
}
static VALUE
-collect_i(i, tmp)
- VALUE i, tmp;
+reject_i(i, ary)
+ VALUE i, ary;
{
- ary_push(tmp, rb_yield(i));
+ if (!RTEST(rb_yield(i))) {
+ rb_ary_push(ary, i);
+ }
return Qnil;
}
+/*
+ * 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
-enum_collect(obj)
+enum_reject(obj)
VALUE obj;
{
- VALUE tmp;
+ VALUE ary = rb_ary_new();
+
+ rb_iterate(rb_each, obj, reject_i, ary);
- tmp = ary_new();
- rb_iterate(rb_each, obj, collect_i, tmp);
+ return ary;
+}
+
+static VALUE
+collect_i(i, ary)
+ VALUE i, ary;
+{
+ rb_ary_push(ary, rb_yield(i));
- return tmp;
+ return Qnil;
}
static VALUE
-reverse_i(i, tmp)
- VALUE i, tmp;
+collect_all(i, ary)
+ VALUE i, ary;
{
- ary_unshift(tmp, i);
+ rb_ary_push(ary, i);
+
return Qnil;
}
+/*
+ * 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
-enum_reverse(obj)
+enum_collect(obj)
VALUE obj;
{
- VALUE tmp;
+ VALUE ary = rb_ary_new();
- tmp = ary_new();
- rb_iterate(rb_each, obj, reverse_i, tmp);
+ rb_iterate(rb_each, obj, rb_block_given_p() ? collect_i : collect_all, ary);
- return tmp;
+ return ary;
}
+/*
+ * 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_all(i, ary)
- VALUE i, ary;
+enum_to_a(obj)
+ VALUE obj;
+{
+ VALUE ary = rb_ary_new();
+
+ rb_iterate(rb_each, obj, collect_all, ary);
+
+ return ary;
+}
+
+static VALUE
+inject_i(i, memo)
+ VALUE i;
+ NODE *memo;
{
- ary_push(ary, i);
+ if (memo->u2.value) {
+ memo->u2.value = Qfalse;
+ memo->u1.value = i;
+ }
+ else {
+ memo->u1.value = rb_yield_values(2, memo->u1.value, i);
+ }
return Qnil;
}
+/*
+ * call-seq:
+ * 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).
+ *
+ * # Sum some numbers
+ * (5..10).inject {|sum, n| sum + n } #=> 45
+ * # Multiply some numbers
+ * (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
+ *
+ */
+
static VALUE
-enum_to_a(obj)
+enum_inject(argc, argv, obj)
+ int argc;
+ VALUE *argv, obj;
+{
+ NODE *memo;
+ VALUE n;
+
+ if (rb_scan_args(argc, argv, "01", &n) == 1) {
+ memo = rb_node_newnode(NODE_MEMO, n, Qfalse, 0);
+ }
+ else {
+ memo = rb_node_newnode(NODE_MEMO, Qnil, Qtrue, 0);
+ }
+ rb_iterate(rb_each, obj, inject_i, (VALUE)memo);
+ n = memo->u1.value;
+ return n;
+}
+
+static VALUE
+partition_i(i, ary)
+ VALUE i, *ary;
+{
+ if (RTEST(rb_yield(i))) {
+ rb_ary_push(ary[0], i);
+ }
+ else {
+ rb_ary_push(ary[1], i);
+ }
+ return Qnil;
+}
+
+/*
+ * 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
+enum_partition(obj)
VALUE obj;
{
- VALUE ary;
+ VALUE ary[2];
- ary = ary_new();
- rb_iterate(rb_each, obj, enum_all, ary);
+ ary[0] = rb_ary_new();
+ ary[1] = rb_ary_new();
+ rb_iterate(rb_each, obj, partition_i, (VALUE)ary);
- return ary;
+ return rb_assoc_new(ary[0], 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
+ * +1 depending on the comparison between <i>a</i> and <i>b</i>. As of
+ * 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]
+ */
+
static VALUE
enum_sort(obj)
VALUE obj;
{
- return ary_sort(enum_to_a(obj));
+ return rb_ary_sort(enum_to_a(obj));
}
static VALUE
-min_i(i, min)
- VALUE i, *min;
+sort_by_i(i, ary)
+ VALUE i, ary;
{
- VALUE cmp;
+ VALUE v;
+ NODE *memo;
- if (NIL_P(*min))
- *min = i;
- else {
- cmp = rb_funcall(i, id_cmp, 1, *min);
- if (FIX2LONG(cmp) < 0)
- *min = i;
+ v = rb_yield(i);
+ if (RBASIC(ary)->klass) {
+ rb_raise(rb_eRuntimeError, "sort_by reentered");
}
+ memo = rb_node_newnode(NODE_MEMO, v, i, 0);
+ rb_ary_push(ary, (VALUE)memo);
return Qnil;
}
+static int
+sort_by_cmp(aa, bb)
+ NODE **aa, **bb;
+{
+ VALUE a = aa[0]->u1.value;
+ VALUE b = bb[0]->u1.value;
+
+ 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
+ * approach a Schwartzian Transform, after Randal Schwartz. We
+ * 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"]
+ */
+
static VALUE
-min_ii(i, min)
- VALUE i, *min;
+enum_sort_by(obj)
+ VALUE obj;
{
- VALUE cmp;
+ VALUE ary;
+ long i;
- if (NIL_P(*min))
- *min = i;
+ if (TYPE(obj) == T_ARRAY) {
+ ary = rb_ary_new2(RARRAY(obj)->len);
+ }
else {
- cmp = rb_yield(assoc_new(i, *min));
- if (FIX2LONG(cmp) < 0)
- *min = i;
+ ary = rb_ary_new();
+ }
+ 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);
+ }
+ if (RBASIC(ary)->klass) {
+ rb_raise(rb_eRuntimeError, "sort_by reentered");
+ }
+ for (i=0; i<RARRAY(ary)->len; i++) {
+ RARRAY(ary)->ptr[i] = RNODE(RARRAY(ary)->ptr[i])->u2.value;
+ }
+ RBASIC(ary)->klass = rb_cArray;
+ return ary;
+}
+
+static VALUE
+all_iter_i(i, memo)
+ VALUE i;
+ NODE *memo;
+{
+ if (!RTEST(rb_yield(i))) {
+ memo->u1.value = Qfalse;
+ rb_iter_break();
}
return Qnil;
}
static VALUE
-enum_min(obj)
+all_i(i, memo)
+ VALUE i;
+ NODE *memo;
+{
+ if (!RTEST(i)) {
+ memo->u1.value = Qfalse;
+ rb_iter_break();
+ }
+ return Qnil;
+}
+
+/*
+ * 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
+enum_all(obj)
VALUE obj;
{
- VALUE min = Qnil;
+ VALUE result;
+ NODE *memo = rb_node_newnode(NODE_MEMO, Qnil, 0, 0);
+
+ memo->u1.value = Qtrue;
+ rb_iterate(rb_each, obj, rb_block_given_p() ? all_iter_i : all_i, (VALUE)memo);
+ result = memo->u1.value;
+ return result;
+}
- rb_iterate(rb_each, obj, iterator_p()?min_ii:min_i, (VALUE)&min);
- return min;
+static VALUE
+any_iter_i(i, memo)
+ VALUE i;
+ NODE *memo;
+{
+ if (RTEST(rb_yield(i))) {
+ memo->u1.value = Qtrue;
+ rb_iter_break();
+ }
+ return Qnil;
}
static VALUE
-max_i(i, max)
- VALUE i, *max;
+any_i(i, memo)
+ VALUE i;
+ NODE *memo;
+{
+ if (RTEST(i)) {
+ memo->u1.value = Qtrue;
+ rb_iter_break();
+ }
+ return Qnil;
+}
+
+/*
+ * 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
+ * that <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>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
+enum_any(obj)
+ VALUE obj;
+{
+ VALUE result;
+ NODE *memo = rb_node_newnode(NODE_MEMO, Qnil, 0, 0);
+
+ memo->u1.value = Qfalse;
+ rb_iterate(rb_each, obj, rb_block_given_p() ? any_iter_i : any_i, (VALUE)memo);
+ result = memo->u1.value;
+ return result;
+}
+
+static VALUE
+min_i(i, memo)
+ VALUE i;
+ NODE *memo;
{
VALUE cmp;
- if (NIL_P(*max))
- *max = i;
+ if (NIL_P(memo->u1.value)) {
+ memo->u1.value = i;
+ }
else {
- cmp = rb_funcall(i, id_cmp, 1, *max);
- if (FIX2LONG(cmp) > 0)
- *max = i;
+ cmp = rb_funcall(i, id_cmp, 1, memo->u1.value);
+ if (rb_cmpint(cmp, i, memo->u1.value) < 0) {
+ memo->u1.value = i;
+ }
}
return Qnil;
}
static VALUE
-max_ii(i, max)
- VALUE i, *max;
+min_ii(i, memo)
+ VALUE i;
+ NODE *memo;
{
VALUE cmp;
- if (NIL_P(*max))
- *max = i;
+ if (NIL_P(memo->u1.value)) {
+ memo->u1.value = i;
+ }
else {
- cmp = rb_yield(assoc_new(i, *max));
- if (FIX2LONG(cmp) > 0)
- *max = i;
+ cmp = rb_yield_values(2, i, memo->u1.value);
+ if (rb_cmpint(cmp, i, memo->u1.value) < 0) {
+ memo->u1.value = i;
+ }
}
return Qnil;
}
+
+/*
+ * 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"
+ */
+
static VALUE
-enum_max(obj)
+enum_min(obj)
VALUE obj;
{
- VALUE max = Qnil;
+ VALUE result;
+ NODE *memo = rb_node_newnode(NODE_MEMO, Qnil, 0, 0);
- rb_iterate(rb_each, obj, iterator_p()?max_ii:max_i, (VALUE)&max);
- return max;
+ rb_iterate(rb_each, obj, rb_block_given_p() ? min_ii : min_i, (VALUE)memo);
+ result = memo->u1.value;
+ return result;
}
-struct i_v_pair {
- int i;
- VALUE v;
- int found;
-};
+/*
+ * 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"
+ */
static VALUE
-index_i(item, iv)
- VALUE item;
- struct i_v_pair *iv;
+max_i(i, memo)
+ VALUE i;
+ NODE *memo;
{
- if (rb_equal(item, iv->v)) {
- iv->found = 1;
- rb_iter_break();
+ VALUE cmp;
+
+ if (NIL_P(memo->u1.value)) {
+ memo->u1.value = i;
}
else {
- iv->i++;
+ cmp = rb_funcall(i, id_cmp, 1, memo->u1.value);
+ if (rb_cmpint(cmp, i, memo->u1.value) > 0) {
+ memo->u1.value = i;
+ }
}
return Qnil;
}
static VALUE
-enum_index(obj, val)
- VALUE obj, val;
+max_ii(i, memo)
+ VALUE i;
+ NODE *memo;
{
- struct i_v_pair iv;
+ VALUE cmp;
- iv.i = 0;
- iv.v = val;
- iv.found = 0;
- rb_iterate(rb_each, obj, index_i, (VALUE)&iv);
- if (iv.found) return INT2FIX(iv.i);
- return Qnil; /* not found */
+ if (NIL_P(memo->u1.value)) {
+ memo->u1.value = i;
+ }
+ else {
+ cmp = rb_yield_values(2, i, memo->u1.value);
+ if (rb_cmpint(cmp, i, memo->u1.value) > 0) {
+ memo->u1.value = i;
+ }
+ }
+ return Qnil;
}
+/*
+ * 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
-member_i(item, iv)
+enum_max(obj)
+ VALUE obj;
+{
+ VALUE result;
+ NODE *memo = rb_node_newnode(NODE_MEMO, Qnil, 0, 0);
+
+ rb_iterate(rb_each, obj, rb_block_given_p() ? max_ii : max_i, (VALUE)memo);
+ result = memo->u1.value;
+ return result;
+}
+
+static VALUE
+member_i(item, memo)
VALUE item;
- struct i_v_pair *iv;
+ NODE *memo;
{
- if (rb_equal(item, iv->v)) {
- iv->i = 1;
+ if (rb_equal(item, memo->u1.value)) {
+ memo->u2.value = Qtrue;
rb_iter_break();
}
return Qnil;
}
+/*
+ * 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
enum_member(obj, val)
VALUE obj, val;
{
- struct i_v_pair iv;
+ VALUE result;
+ NODE *memo = rb_node_newnode(NODE_MEMO, val, Qfalse, 0);
- iv.i = 0;
- iv.v = val;
- rb_iterate(rb_each, obj, member_i, (VALUE)&iv);
- if (iv.i) return TRUE;
- return FALSE;
+ rb_iterate(rb_each, obj, member_i, (VALUE)memo);
+ result = memo->u2.value;
+ return result;
}
static VALUE
-length_i(i, length)
- VALUE i;
- int *length;
+each_with_index_i(val, memo)
+ VALUE val;
+ NODE *memo;
{
- (*length)++;
+ rb_yield_values(2, val, INT2FIX(memo->u3.cnt));
+ memo->u3.cnt++;
return Qnil;
}
-VALUE
-enum_length(obj)
+/*
+ * 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;
{
- int length = 0;
+ NODE *memo = rb_node_newnode(NODE_MEMO, 0, 0, 0);
- rb_iterate(rb_each, obj, length_i, (VALUE)&length);
- return INT2FIX(length);
+ rb_iterate(rb_each, obj, each_with_index_i, (VALUE)memo);
+ return obj;
}
static VALUE
-each_with_index_i(val, indexp)
+zip_i(val, memo)
VALUE val;
- int *indexp;
+ NODE *memo;
{
- rb_yield(assoc_new(val, INT2FIX(*indexp)));
- (*indexp)++;
+ VALUE result = memo->u1.value;
+ VALUE args = memo->u2.value;
+ int idx = memo->u3.cnt++;
+ VALUE tmp;
+ int i;
+
+ tmp = rb_ary_new2(RARRAY(args)->len + 1);
+ rb_ary_store(tmp, 0, val);
+ for (i=0; i<RARRAY(args)->len; i++) {
+ rb_ary_push(tmp, rb_ary_entry(RARRAY(args)->ptr[i], idx));
+ }
+ if (rb_block_given_p()) {
+ rb_yield(tmp);
+ }
+ else {
+ rb_ary_push(result, tmp);
+ }
return Qnil;
}
-VALUE
-enum_each_with_index(obj)
+/*
+ * 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
+ * arrays, where <em>n</em> is one more that the count of arguments. If
+ * the size of any argument is less than <code>enum#size</code>,
+ * <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
+enum_zip(argc, argv, obj)
+ int argc;
+ VALUE *argv;
VALUE obj;
{
- int index = 0;
+ int i;
+ VALUE result;
+ NODE *memo;
- rb_iterate(rb_each, obj, each_with_index_i, (VALUE)&index);
- return Qnil;
+ for (i=0; i<argc; i++) {
+ argv[i] = rb_convert_type(argv[i], T_ARRAY, "Array", "to_a");
+ }
+ result = rb_block_given_p() ? Qnil : rb_ary_new();
+ memo = rb_node_newnode(NODE_MEMO, result, rb_ary_new4(argc, argv), 0);
+ rb_iterate(rb_each, obj, zip_i, (VALUE)memo);
+
+ return result;
}
+/*
+ * The <code>Enumerable</code> mixin provides collection classes with
+ * several traversal and searching methods, and with the ability to
+ * sort. The class must provide a method <code>each</code>, which
+ * yields successive members of the collection. If
+ * <code>Enumerable#max</code>, <code>#min</code>, or
+ * <code>#sort</code> is used, the objects in the collection must also
+ * implement a meaningful <code><=></code> operator, as these methods
+ * rely on an ordering between members of the collection.
+ */
+
void
Init_Enumerable()
{
- mEnumerable = rb_define_module("Enumerable");
-
- rb_define_method(mEnumerable,"to_a", enum_to_a, 0);
- rb_define_method(mEnumerable,"entries", enum_to_a, 0);
-
- rb_define_method(mEnumerable,"sort", enum_sort, 0);
- rb_define_method(mEnumerable,"grep", enum_grep, 1);
- rb_define_method(mEnumerable,"find", enum_find, -1);
- rb_define_method(mEnumerable,"find_all", enum_find_all, 0);
- rb_define_method(mEnumerable,"collect", enum_collect, 0);
- rb_define_method(mEnumerable,"reverse", enum_reverse, 0);
- rb_define_method(mEnumerable,"min", enum_min, 0);
- rb_define_method(mEnumerable,"max", enum_max, 0);
- rb_define_method(mEnumerable,"index", enum_index, 1);
- rb_define_method(mEnumerable,"member?", enum_member, 1);
- rb_define_method(mEnumerable,"include?", enum_member, 1);
- rb_define_method(mEnumerable,"length", enum_length, 0);
- rb_define_method(mEnumerable,"size", enum_length, 0);
- rb_define_method(mEnumerable,"each_with_index", enum_each_with_index, 0);
+ 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, "zip", enum_zip, -1);
id_eqq = rb_intern("===");
id_each = rb_intern("each");
id_cmp = rb_intern("<=>");
}
+
diff --git a/env.h b/env.h
index b254ddef1c..c47c01d9db 100644
--- a/env.h
+++ b/env.h
@@ -1,13 +1,15 @@
-/************************************************
+/**********************************************************************
env.h -
$Author$
- $Revision$
$Date$
created at: Mon Jul 11 11:53:03 JST 1994
-************************************************/
+ Copyright (C) 1993-2003 Yukihiro Matsumoto
+
+**********************************************************************/
+
#ifndef ENV_H
#define ENV_H
@@ -16,30 +18,36 @@ extern struct FRAME {
int argc;
VALUE *argv;
ID last_func;
+ ID orig_func;
VALUE last_class;
- VALUE cbase;
struct FRAME *prev;
- char *file;
- int line;
+ struct FRAME *tmp;
+ struct RNode *node;
int iter;
-} *the_frame;
+ int flags;
+ unsigned long uniq;
+} *ruby_frame;
+
+void rb_gc_mark_frame _((struct FRAME *));
-void gc_mark_frame _((struct FRAME *));
+#define FRAME_ALLOCA 0
+#define FRAME_MALLOC 1
extern struct SCOPE {
struct RBasic super;
ID *local_tbl;
VALUE *local_vars;
- int flag;
-} *the_scope;
+ int flags;
+} *ruby_scope;
#define SCOPE_ALLOCA 0
#define SCOPE_MALLOC 1
#define SCOPE_NOSTACK 2
+#define SCOPE_DONT_RECYCLE 4
-extern int rb_in_eval;
+extern int ruby_in_eval;
-extern VALUE the_class;
+extern VALUE ruby_class;
struct RVarmap {
struct RBasic super;
@@ -47,6 +55,6 @@ struct RVarmap {
VALUE val;
struct RVarmap *next;
};
-extern struct RVarmap *the_dyna_vars;
+extern struct RVarmap *ruby_dyna_vars;
#endif /* ENV_H */
diff --git a/error.c b/error.c
index 564358c83b..c67fce9d34 100644
--- a/error.c
+++ b/error.c
@@ -1,4 +1,4 @@
-/************************************************
+/**********************************************************************
error.c -
@@ -6,12 +6,14 @@
$Date$
created at: Mon Aug 9 16:11:34 JST 1993
- Copyright (C) 1993-1998 Yukihiro Matsumoto
+ Copyright (C) 1993-2003 Yukihiro Matsumoto
-************************************************/
+**********************************************************************/
#include "ruby.h"
#include "env.h"
+#include "st.h"
+
#include <stdio.h>
#ifdef HAVE_STDARG_PROTOTYPES
#include <stdarg.h>
@@ -20,38 +22,53 @@
#include <varargs.h>
#define va_init_list(a,b) va_start(a)
#endif
-
-#ifdef USE_CWGUSI
-#include <sys/errno.h>
-int sys_nerr = 256;
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifndef EXIT_SUCCESS
+#define EXIT_SUCCESS 0
#endif
-extern char *sourcefile;
-extern int sourceline;
+extern const char ruby_version[], ruby_release_date[], ruby_platform[];
-int nerrs;
+int ruby_nerrs;
+
+static int
+err_position(buf, len)
+ char *buf;
+ long len;
+{
+ ruby_set_current_source();
+ if (!ruby_sourcefile) {
+ return 0;
+ }
+ else if (ruby_sourceline == 0) {
+ return snprintf(buf, len, "%s: ", ruby_sourcefile);
+ }
+ else {
+ return snprintf(buf, len, "%s:%d: ", ruby_sourcefile, ruby_sourceline);
+ }
+}
static void
err_snprintf(buf, len, fmt, args)
- char *buf, *fmt;
- int len;
+ char *buf;
+ long len;
+ const char *fmt;
va_list args;
{
- if (!sourcefile) {
- vsnprintf(buf, len, fmt, args);
- }
- else {
- int n = snprintf(buf, len, "%s:%d: ", sourcefile, sourceline);
- if (len > n) {
- vsnprintf((char*)buf+n, len-n, fmt, args);
- }
+ long n;
+
+ n = err_position(buf, len);
+ if (len > n) {
+ vsnprintf((char*)buf+n, len-n, fmt, args);
}
}
-static void err_append _((char*));
+static void err_append _((const char*));
static void
err_print(fmt, args)
- char *fmt;
+ const char *fmt;
va_list args;
{
char buf[BUFSIZ];
@@ -62,10 +79,10 @@ err_print(fmt, args)
void
#ifdef HAVE_STDARG_PROTOTYPES
-Error(char *fmt, ...)
+rb_compile_error(const char *fmt, ...)
#else
-Error(fmt, va_alist)
- char *fmt;
+rb_compile_error(fmt, va_alist)
+ const char *fmt;
va_dcl
#endif
{
@@ -74,15 +91,15 @@ Error(fmt, va_alist)
va_init_list(args, fmt);
err_print(fmt, args);
va_end(args);
- nerrs++;
+ ruby_nerrs++;
}
void
#ifdef HAVE_STDARG_PROTOTYPES
-Error_Append(char *fmt, ...)
+rb_compile_error_append(const char *fmt, ...)
#else
-Error_Append(fmt, va_alist)
- char *fmt;
+rb_compile_error_append(fmt, va_alist)
+ const char *fmt;
va_dcl
#endif
{
@@ -95,94 +112,136 @@ Error_Append(fmt, va_alist)
err_append(buf);
}
+static void
+warn_print(fmt, args)
+ const char *fmt;
+ va_list args;
+{
+ char buf[BUFSIZ];
+ int len;
+
+ err_snprintf(buf, BUFSIZ, fmt, args);
+ len = strlen(buf);
+ buf[len++] = '\n';
+ rb_write_error2(buf, len);
+}
+
void
#ifdef HAVE_STDARG_PROTOTYPES
-Warn(char *fmt, ...)
+rb_warn(const char *fmt, ...)
#else
-Warn(fmt, va_alist)
- char *fmt;
+rb_warn(fmt, va_alist)
+ const char *fmt;
va_dcl
#endif
{
char buf[BUFSIZ];
va_list args;
+ if (NIL_P(ruby_verbose)) return;
+
snprintf(buf, BUFSIZ, "warning: %s", fmt);
va_init_list(args, fmt);
- err_print(buf, args);
+ warn_print(buf, args);
va_end(args);
}
-/* Warning() reports only in verbose mode */
+/* rb_warning() reports only in verbose mode */
void
#ifdef HAVE_STDARG_PROTOTYPES
-Warning(char *fmt, ...)
+rb_warning(const char *fmt, ...)
#else
-Warning(fmt, va_alist)
- char *fmt;
+rb_warning(fmt, va_alist)
+ const char *fmt;
va_dcl
#endif
{
char buf[BUFSIZ];
va_list args;
- if (!RTEST(verbose)) return;
+ if (!RTEST(ruby_verbose)) return;
snprintf(buf, BUFSIZ, "warning: %s", fmt);
va_init_list(args, fmt);
- err_print(buf, args);
+ warn_print(buf, args);
va_end(args);
}
+/*
+ * call-seq:
+ * warn(msg) => nil
+ *
+ * Display the given message (followed by a newline) on STDERR unless
+ * warnings are disabled (for example with the <code>-W0</code> flag).
+ */
+
+static VALUE
+rb_warn_m(self, mesg)
+ VALUE self, mesg;
+{
+ if (!NIL_P(ruby_verbose)) {
+ rb_io_write(rb_stderr, mesg);
+ rb_io_write(rb_stderr, rb_default_rs);
+ }
+ return Qnil;
+}
+
void
#ifdef HAVE_STDARG_PROTOTYPES
-Bug(char *fmt, ...)
+rb_bug(const char *fmt, ...)
#else
-Bug(fmt, va_alist)
- char *fmt;
+rb_bug(fmt, va_alist)
+ const char *fmt;
va_dcl
#endif
{
char buf[BUFSIZ];
va_list args;
-
- snprintf(buf, BUFSIZ, "[BUG] %s", fmt);
- rb_in_eval = 0;
-
- va_init_list(args, fmt);
- err_print(buf, args);
- va_end(args);
+ FILE *out = stderr;
+ int len = err_position(buf, BUFSIZ);
+
+ if (fwrite(buf, 1, len, out) == len ||
+ fwrite(buf, 1, len, (out = stdout)) == len) {
+ fputs("[BUG] ", out);
+ 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);
+ }
abort();
}
static struct types {
int type;
- char *name;
+ const char *name;
} builtin_types[] = {
- T_NIL, "nil",
- T_OBJECT, "Object",
- T_CLASS, "Class",
- T_ICLASS, "iClass", /* internal use: mixed-in module holder */
- T_MODULE, "Module",
- T_FLOAT, "Float",
- T_STRING, "String",
- T_REGEXP, "Regexp",
- T_ARRAY, "Array",
- T_FIXNUM, "Fixnum",
- T_HASH, "Hash",
- T_STRUCT, "Struct",
- T_BIGNUM, "Bignum",
- T_FILE, "File",
- T_TRUE, "TRUE",
- T_FALSE, "FALSE",
- T_DATA, "Data", /* internal use: wrapped C pointers */
- T_MATCH, "Match", /* data of $~ */
- T_VARMAP, "Varmap", /* internal use: dynamic variables */
- T_SCOPE, "Scope", /* internal use: variable scope */
- T_NODE, "Node", /* internal use: syntax tree node */
- -1, 0,
+ {T_NIL, "nil"},
+ {T_OBJECT, "Object"},
+ {T_CLASS, "Class"},
+ {T_ICLASS, "iClass"}, /* internal use: mixed-in module holder */
+ {T_MODULE, "Module"},
+ {T_FLOAT, "Float"},
+ {T_STRING, "String"},
+ {T_REGEXP, "Regexp"},
+ {T_ARRAY, "Array"},
+ {T_FIXNUM, "Fixnum"},
+ {T_HASH, "Hash"},
+ {T_STRUCT, "Struct"},
+ {T_BIGNUM, "Bignum"},
+ {T_FILE, "File"},
+ {T_TRUE, "true"},
+ {T_FALSE, "false"},
+ {T_SYMBOL, "Symbol"}, /* :symbol */
+ {T_DATA, "Data"}, /* internal use: wrapped C pointers */
+ {T_MATCH, "MatchData"}, /* data of $~ */
+ {T_VARMAP, "Varmap"}, /* internal use: dynamic variables */
+ {T_SCOPE, "Scope"}, /* internal use: variable scope */
+ {T_NODE, "Node"}, /* internal use: syntax tree node */
+ {T_UNDEF, "undef"}, /* internal use: #undef; should not happen */
+ {-1, 0}
};
void
@@ -191,9 +250,12 @@ rb_check_type(x, t)
int t;
{
struct types *type = builtin_types;
- int tt = TYPE(x);
- if (tt != t) {
+ if (x == Qundef) {
+ rb_bug("undef leaked to the Ruby space");
+ }
+
+ if (TYPE(x) != t) {
while (type->type >= 0) {
if (type->type == t) {
char *etype;
@@ -204,116 +266,173 @@ rb_check_type(x, t)
else if (FIXNUM_P(x)) {
etype = "Fixnum";
}
+ else if (SYMBOL_P(x)) {
+ etype = "Symbol";
+ }
else if (rb_special_const_p(x)) {
- etype = RSTRING(obj_as_string(x))->ptr;
+ etype = RSTRING(rb_obj_as_string(x))->ptr;
}
else {
- etype = rb_class2name(CLASS_OF(x));
+ etype = rb_obj_classname(x);
}
- TypeError("wrong argument type %s (expected %s)",
- etype, type->name);
+ rb_raise(rb_eTypeError, "wrong argument type %s (expected %s)",
+ etype, type->name);
}
type++;
}
- Bug("unknown type 0x%x", t);
+ rb_bug("unknown type 0x%x", t);
}
}
/* exception classes */
#include <errno.h>
-VALUE eException;
-VALUE eSystemExit, eInterrupt, eFatal;
-VALUE eStandardError;
-VALUE eRuntimeError;
-VALUE eSyntaxError;
-VALUE eTypeError;
-VALUE eArgError;
-VALUE eNameError;
-VALUE eIndexError;
-VALUE eLoadError;
-VALUE eSecurityError;
-VALUE eNotImpError;
-
-VALUE eSystemCallError;
-VALUE mErrno;
+VALUE rb_eException;
+VALUE rb_eSystemExit;
+VALUE rb_eInterrupt;
+VALUE rb_eSignal;
+VALUE rb_eFatal;
+VALUE rb_eStandardError;
+VALUE rb_eRuntimeError;
+VALUE rb_eTypeError;
+VALUE rb_eArgError;
+VALUE rb_eIndexError;
+VALUE rb_eRangeError;
+VALUE rb_eNameError;
+VALUE rb_eNoMethodError;
+VALUE rb_eSecurityError;
+VALUE rb_eNotImpError;
+VALUE rb_eNoMemError;
+static VALUE rb_cNameErrorMesg;
+
+VALUE rb_eScriptError;
+VALUE rb_eSyntaxError;
+VALUE rb_eLoadError;
+
+VALUE rb_eSystemCallError;
+VALUE rb_mErrno;
VALUE
-exc_new(etype, ptr, len)
+rb_exc_new(etype, ptr, len)
VALUE etype;
- char *ptr;
- unsigned len;
+ const char *ptr;
+ long len;
{
- VALUE exc = obj_alloc(etype);
-
- rb_iv_set(exc, "mesg", str_new(ptr, len));
- return exc;
+ return rb_funcall(etype, rb_intern("new"), 1, rb_str_new(ptr, len));
}
VALUE
-exc_new2(etype, s)
+rb_exc_new2(etype, s)
VALUE etype;
- char *s;
+ const char *s;
{
- return exc_new(etype, s, strlen(s));
+ return rb_exc_new(etype, s, strlen(s));
}
VALUE
-exc_new3(etype, str)
+rb_exc_new3(etype, str)
VALUE etype, str;
{
- char *s;
- int len;
-
- s = str2cstr(str, &len);
- return exc_new(etype, s, len);
+ StringValue(str);
+ return rb_exc_new(etype, RSTRING(str)->ptr, RSTRING(str)->len);
}
+/*
+ * call-seq:
+ * Exception.new(msg = nil) => exception
+ *
+ * Construct a new Exception object, optionally passing in
+ * a message.
+ */
+
static VALUE
exc_initialize(argc, argv, exc)
int argc;
VALUE *argv;
VALUE exc;
{
- VALUE mesg;
+ VALUE arg;
- if (rb_scan_args(argc, argv, "01", &mesg) == 0) {
- mesg = str_new(0, 0);
- }
- else {
- STR2CSTR(mesg); /* ensure mesg can be converted to String */
- }
- rb_iv_set(exc, "mesg", mesg);
+ rb_scan_args(argc, argv, "01", &arg);
+ rb_iv_set(exc, "mesg", arg);
+ rb_iv_set(exc, "bt", Qnil);
return exc;
}
+/*
+ * Document-method: exception
+ *
+ * call-seq:
+ * exc.exception(string) -> an_exception or exc
+ *
+ * With no argument, or if the argument is the same as the receiver,
+ * return the receiver. Otherwise, create a new
+ * exception object of the same class as the receiver, but with a
+ * message equal to <code>string.to_str</code>.
+ *
+ */
+
static VALUE
-exc_new_method(argc, argv, self)
+exc_exception(argc, argv, self)
int argc;
VALUE *argv;
VALUE self;
{
- VALUE etype, exc;
+ VALUE exc;
+ if (argc == 0) return self;
if (argc == 1 && self == argv[0]) return self;
- etype = CLASS_OF(self);
- while (FL_TEST(etype, FL_SINGLETON)) {
- etype = RCLASS(etype)->super;
- }
- exc = obj_alloc(etype);
- obj_call_init(exc);
+ exc = rb_obj_clone(self);
+ exc_initialize(argc, argv, exc);
return exc;
}
+/*
+ * call-seq:
+ * exception.to_s => string
+ *
+ * Returns exception's message (or the name of the exception if
+ * no message is set).
+ */
+
static VALUE
exc_to_s(exc)
VALUE exc;
{
- return rb_iv_get(exc, "mesg");
+ VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));
+
+ if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
+ if (OBJ_TAINTED(exc)) OBJ_TAINT(mesg);
+ return mesg;
}
+/*
+ * call-seq:
+ * exception.message => string
+ * exception.to_str => string
+ *
+ * Returns the result of invoking <code>exception.to_s</code>.
+ * Normally this returns the exception's message or name. By
+ * supplying a to_str method, exceptions are agreeing to
+ * be used where Strings are expected.
+ */
+
+static VALUE
+exc_to_str(exc)
+ VALUE exc;
+{
+ return rb_funcall(exc, rb_intern("to_s"), 0, 0);
+}
+
+/*
+ * call-seq:
+ * exception.inspect => string
+ *
+ * Return this exception's class name an message
+ */
+
static VALUE
exc_inspect(exc)
VALUE exc;
@@ -321,358 +440,656 @@ exc_inspect(exc)
VALUE str, klass;
klass = CLASS_OF(exc);
- exc = obj_as_string(exc);
+ exc = rb_obj_as_string(exc);
if (RSTRING(exc)->len == 0) {
- return str_dup(rb_class_path(klass));
+ return rb_str_dup(rb_class_name(klass));
}
- str = str_new2("#<");
- klass = rb_class_path(klass);
- str_concat(str, klass);
- str_cat(str, ":", 1);
- str_concat(str, exc);
- str_cat(str, ">", 1);
+ str = rb_str_buf_new2("#<");
+ klass = rb_class_name(klass);
+ rb_str_buf_append(str, klass);
+ rb_str_buf_cat(str, ": ", 2);
+ rb_str_buf_append(str, exc);
+ rb_str_buf_cat(str, ">", 1);
return str;
}
+/*
+ * call-seq:
+ * exception.backtrace => array
+ *
+ * Returns any backtrace associated with the exception. The backtrace
+ * is an array of strings, each containing either ``filename:lineNo: in
+ * `method''' or ``filename:lineNo.''
+ *
+ * def a
+ * raise "boom"
+ * end
+ *
+ * def b
+ * a()
+ * end
+ *
+ * begin
+ * b()
+ * rescue => detail
+ * print detail.backtrace.join("\n")
+ * end
+ *
+ * <em>produces:</em>
+ *
+ * prog.rb:2:in `a'
+ * prog.rb:6:in `b'
+ * prog.rb:10
+*/
+
static VALUE
exc_backtrace(exc)
VALUE exc;
{
- return rb_iv_get(exc, "bt");
+ ID bt = rb_intern("bt");
+
+ if (!rb_ivar_defined(exc, bt)) return Qnil;
+ return rb_ivar_get(exc, bt);
}
static VALUE
check_backtrace(bt)
VALUE bt;
{
- int i;
+ long i;
static char *err = "backtrace must be Array of String";
if (!NIL_P(bt)) {
int t = TYPE(bt);
- if (t == T_STRING) return ary_new3(1, bt);
+ if (t == T_STRING) return rb_ary_new3(1, bt);
if (t != T_ARRAY) {
- TypeError(err);
+ rb_raise(rb_eTypeError, err);
}
for (i=0;i<RARRAY(bt)->len;i++) {
if (TYPE(RARRAY(bt)->ptr[i]) != T_STRING) {
- TypeError(err);
+ rb_raise(rb_eTypeError, err);
}
}
}
return bt;
}
+/*
+ * call-seq:
+ * exc.set_backtrace(array) => array
+ *
+ * Sets the backtrace information associated with <i>exc</i>. The
+ * argument must be an array of <code>String</code> objects in the
+ * format described in <code>Exception#backtrace</code>.
+ *
+ */
+
static VALUE
exc_set_backtrace(exc, bt)
VALUE exc;
+ VALUE bt;
{
return rb_iv_set(exc, "bt", check_backtrace(bt));
}
+/*
+ * call-seq:
+ * SystemExit.new(status=0) => system_exit
+ *
+ * Create a new +SystemExit+ exception with the given status.
+ */
+
static VALUE
-exception(argc, argv)
+exit_initialize(argc, argv, exc)
int argc;
VALUE *argv;
+ VALUE exc;
{
- VALUE v = Qnil;
- VALUE etype = eStandardError;
- int i;
- ID id;
-
- if (argc == 0) {
- ArgError("wrong # of arguments");
+ VALUE status = INT2FIX(EXIT_SUCCESS);
+ if (argc > 0 && FIXNUM_P(argv[0])) {
+ status = *argv++;
+ --argc;
}
- Warn("Exception() is now obsolete");
- if (TYPE(argv[argc-1]) == T_CLASS) {
- etype = argv[argc-1];
- argc--;
- if (!rb_funcall(etype, '<', 1, eException)) {
- TypeError("exception should be subclass of Exception");
- }
- }
- for (i=0; i<argc; i++) { /* argument check */
- id = rb_to_id(argv[i]);
- if (!rb_id2name(id)) {
- ArgError("argument needs to be symbol or string");
- }
- if (!rb_is_const_id(id)) {
- ArgError("identifier `%s' needs to be constant", rb_id2name(id));
- }
- }
- for (i=0; i<argc; i++) {
- v = rb_define_class_under(the_class,
- rb_id2name(rb_to_id(argv[i])),
- eStandardError);
- }
- return v;
+ exc_initialize(argc, argv, exc);
+ rb_iv_set(exc, "status", status);
+ return exc;
}
-#ifdef __BEOS__
-typedef struct {
- VALUE *list;
- size_t n;
-} syserr_list_entry;
-
-typedef struct {
- int ix;
- size_t n;
-} syserr_index_entry;
-
-static VALUE syserr_list_b_general[16+1];
-static VALUE syserr_list_b_os0[2+1];
-static VALUE syserr_list_b_os1[5+1];
-static VALUE syserr_list_b_os2[2+1];
-static VALUE syserr_list_b_os3[3+1];
-static VALUE syserr_list_b_os4[1+1];
-static VALUE syserr_list_b_app[15+1];
-static VALUE syserr_list_b_interface[0+1];
-static VALUE syserr_list_b_media[8+1];
-static VALUE syserr_list_b_midi[0+1];
-static VALUE syserr_list_b_storage[15+1];
-static VALUE syserr_list_b_posix[38+1];
-static VALUE syserr_list_b_mail[8+1];
-static VALUE syserr_list_b_print[1+1];
-static VALUE syserr_list_b_device[14+1];
-
-# define SYSERR_LIST_B(n) {(n), sizeof(n)/sizeof(VALUE)}
-static const syserr_list_entry syserr_list[] = {
- SYSERR_LIST_B(syserr_list_b_general),
- SYSERR_LIST_B(syserr_list_b_os0),
- SYSERR_LIST_B(syserr_list_b_os1),
- SYSERR_LIST_B(syserr_list_b_os2),
- SYSERR_LIST_B(syserr_list_b_os3),
- SYSERR_LIST_B(syserr_list_b_os4),
- SYSERR_LIST_B(syserr_list_b_app),
- SYSERR_LIST_B(syserr_list_b_interface),
- SYSERR_LIST_B(syserr_list_b_media),
- SYSERR_LIST_B(syserr_list_b_midi),
- SYSERR_LIST_B(syserr_list_b_storage),
- SYSERR_LIST_B(syserr_list_b_posix),
- SYSERR_LIST_B(syserr_list_b_mail),
- SYSERR_LIST_B(syserr_list_b_print),
- SYSERR_LIST_B(syserr_list_b_device),
-};
-# undef SYSERR_LIST_B
-static const syserr_index_entry syserr_index[]= {
- {0, 1}, {1, 5}, {6, 1}, {7, 1}, {8, 1}, {9, 1}, {10, 1}, {11, 1},
- {12, 1}, {13, 1}, {14, 1}, {0, 0},
-};
+/*
+ * call-seq:
+ * system_exit.status => fixnum
+ *
+ * Return the status value associated with this system exit.
+ */
+
+static VALUE
+exit_status(exc)
+ VALUE exc;
+{
+ return rb_attr_get(exc, rb_intern("status"));
+}
+
+
+/*
+ * call-seq:
+ * system_exit.success? => true or false
+ *
+ * Returns +true+ if exiting successful, +false+ if not.
+ */
+
+static VALUE
+exit_success_p(exc)
+ VALUE exc;
+{
+ VALUE status = rb_attr_get(exc, rb_intern("status"));
+ if (NIL_P(status)) return Qtrue;
+ if (status == INT2FIX(EXIT_SUCCESS)) return Qtrue;
+ return Qfalse;
+}
+
+void
+#ifdef HAVE_STDARG_PROTOTYPES
+rb_name_error(ID id, const char *fmt, ...)
#else
-static VALUE *syserr_list;
+rb_name_error(id, fmt, va_alist)
+ ID id;
+ const char *fmt;
+ va_dcl
#endif
+{
+ VALUE exc, argv[2];
+ va_list args;
+ char buf[BUFSIZ];
-#ifndef NT
-extern int sys_nerr;
-#endif
+ va_init_list(args, fmt);
+ vsnprintf(buf, BUFSIZ, fmt, args);
+ va_end(args);
+
+ argv[0] = rb_str_new2(buf);
+ argv[1] = ID2SYM(id);
+ exc = rb_class_new_instance(2, argv, rb_eNameError);
+ rb_exc_raise(exc);
+}
+
+/*
+ * call-seq:
+ * NameError.new(msg [, name]) => name_error
+ *
+ * Construct a new NameError exception. If given the <i>name</i>
+ * parameter may subsequently be examined using the <code>NameError.name</code>
+ * method.
+ */
static VALUE
-set_syserr(i, name)
- int i;
- char *name;
+name_err_initialize(argc, argv, self)
+ int argc;
+ VALUE *argv;
+ VALUE self;
{
-#ifdef __BEOS__
- VALUE *list;
- int ix, offset;
-#endif
- VALUE error = rb_define_class_under(mErrno, name, eSystemCallError);
- rb_define_const(error, "Errno", INT2FIX(i));
-#ifdef __BEOS__
- i -= B_GENERAL_ERROR_BASE;
- ix = (i >> 12) & 0xf;
- offset = (i >> 8) & 0xf;
- if (offset < syserr_index[ix].n) {
- ix = syserr_index[ix].ix;
- if ((i & 0xff) < syserr_list[ix + offset].n) {
- list = syserr_list[ix + offset].list;
- list[i & 0xff] = error;
- rb_global_variable(&list[i & 0xff]);
- }
- }
-#else
- if (i <= sys_nerr) {
- syserr_list[i] = error;
+ VALUE name;
+
+ name = (argc > 1) ? argv[--argc] : Qnil;
+ exc_initialize(argc, argv, self);
+ rb_iv_set(self, "name", name);
+ return self;
+}
+
+/*
+ * call-seq:
+ * name_error.name => string or nil
+ *
+ * Return the name associated with this NameError exception.
+ */
+
+static VALUE
+name_err_name(self)
+ VALUE self;
+{
+ return rb_attr_get(self, rb_intern("name"));
+}
+
+/*
+ * call-seq:
+ * name_error.to_s => string
+ *
+ * Produce a nicely-formated string representing the +NameError+.
+ */
+
+static VALUE
+name_err_to_s(exc)
+ VALUE exc;
+{
+ VALUE mesg = rb_attr_get(exc, rb_intern("mesg")), str = mesg;
+
+ if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
+ StringValue(str);
+ if (str != mesg) {
+ rb_iv_set(exc, "mesg", mesg = str);
}
-#endif
- return error;
+ if (OBJ_TAINTED(exc)) OBJ_TAINT(mesg);
+ return mesg;
}
+/*
+ * call-seq:
+ * NoMethodError.new(msg, name [, args]) => no_method_error
+ *
+ * Contruct a NoMethodError exception for a method of the given name
+ * called with the given arguments. The name may be accessed using
+ * the <code>#name</code> method on the resulting object, and the
+ * arguments using the <code>#args</code> method.
+ */
+
static VALUE
-syserr_errno(self)
+nometh_err_initialize(argc, argv, self)
+ int argc;
+ VALUE *argv;
VALUE self;
{
- return rb_iv_get(self, "errno");
+ VALUE args = (argc > 2) ? argv[--argc] : Qnil;
+ name_err_initialize(argc, argv, self);
+ rb_iv_set(self, "args", args);
+ return self;
}
-#ifdef __BEOS__
+/* :nodoc: */
+static void
+name_err_mesg_mark(ptr)
+ VALUE *ptr;
+{
+ rb_gc_mark_locations(ptr, ptr+3);
+}
+
+/* :nodoc: */
static VALUE
-get_syserr(int i)
+name_err_mesg_new(obj, mesg, recv, method)
+ VALUE obj, mesg, recv, method;
{
- VALUE *list;
- int ix, offset;
-
- i -= B_GENERAL_ERROR_BASE;
- ix = (i >> 12) & 0xf;
- offset = (i >> 8) & 0xf;
- if (offset < syserr_index[ix].n) {
- ix = syserr_index[ix].ix;
- if ((i & 0xff) < syserr_list[ix + offset].n) {
- list = syserr_list[ix + offset].list;
- return list[i & 0xff];
- }
- }
- return 0;
+ VALUE *ptr = ALLOC_N(VALUE, 3);
+
+ ptr[0] = mesg;
+ ptr[1] = recv;
+ ptr[2] = method;
+ return Data_Wrap_Struct(rb_cNameErrorMesg, name_err_mesg_mark, -1, ptr);
}
-#endif /* __BEOS__ */
-static void init_syserr _((void));
+/* :nodoc: */
+static VALUE
+name_err_mesg_to_str(obj)
+ VALUE obj;
+{
+ VALUE *ptr, mesg;
+ Data_Get_Struct(obj, VALUE, ptr);
-void
-Init_Exception()
+ mesg = ptr[0];
+ if (NIL_P(mesg)) return Qnil;
+ else {
+ char *desc = 0;
+ VALUE d = 0, args[3];
+
+ obj = ptr[1];
+ switch (TYPE(obj)) {
+ case T_NIL:
+ desc = "nil";
+ break;
+ case T_TRUE:
+ desc = "true";
+ break;
+ case T_FALSE:
+ desc = "false";
+ break;
+ default:
+ d = rb_protect(rb_inspect, obj, 0);
+ if (NIL_P(d) || RSTRING(d)->len > 65) {
+ d = rb_any_to_s(obj);
+ }
+ desc = RSTRING(d)->ptr;
+ break;
+ }
+ if (desc && desc[0] != '#') {
+ d = rb_str_new2(desc);
+ rb_str_cat2(d, ":");
+ rb_str_cat2(d, rb_obj_classname(obj));
+ }
+ args[0] = mesg;
+ args[1] = ptr[2];
+ args[2] = d;
+ mesg = rb_f_sprintf(3, args);
+ }
+ if (OBJ_TAINTED(obj)) OBJ_TAINT(mesg);
+ return mesg;
+}
+
+/* :nodoc: */
+static VALUE
+name_err_mesg_load(klass, str)
+ VALUE klass, str;
{
- eException = rb_define_class("Exception", cObject);
- rb_define_method(eException, "new", exc_new_method, -1);
- rb_define_method(eException, "initialize", exc_initialize, -1);
- rb_define_method(eException, "to_s", exc_to_s, 0);
- rb_define_method(eException, "to_str", exc_to_s, 0);
- rb_define_method(eException, "message", exc_to_s, 0);
- rb_define_method(eException, "inspect", exc_inspect, 0);
- rb_define_method(eException, "backtrace", exc_backtrace, 0);
- rb_define_method(eException, "set_backtrace", exc_set_backtrace, 1);
-
- eSystemExit = rb_define_class("SystemExit", eException);
- eFatal = rb_define_class("fatal", eException);
- eInterrupt = rb_define_class("Interrupt", eException);
-
- eStandardError = rb_define_class("StandardError", eException);
- eSyntaxError = rb_define_class("SyntaxError", eStandardError);
- eTypeError = rb_define_class("TypeError", eStandardError);
- eArgError = rb_define_class("ArgumentError", eStandardError);
- eNameError = rb_define_class("NameError", eStandardError);
- eIndexError = rb_define_class("IndexError", eStandardError);
- eLoadError = rb_define_class("LoadError", eStandardError);
-
- eRuntimeError = rb_define_class("RuntimeError", eStandardError);
- eSecurityError = rb_define_class("SecurityError", eStandardError);
- eNotImpError = rb_define_class("NotImplementError", eException);
-
- init_syserr();
-
- rb_define_global_function("Exception", exception, -1);
+ return str;
}
-#define RAISE_ERROR(klass,fmt) {\
- va_list args;\
- char buf[BUFSIZ];\
- va_init_list(args,fmt);\
- vsnprintf(buf, BUFSIZ, fmt, args);\
- va_end(args);\
- rb_raise(exc_new2(klass, buf));\
+/*
+ * call-seq:
+ * no_method_error.args => obj
+ *
+ * Return the arguments passed in as the third parameter to
+ * the constructor.
+ */
+
+static VALUE
+nometh_err_args(self)
+ VALUE self;
+{
+ return rb_attr_get(self, rb_intern("args"));
}
void
-#ifdef HAVE_STDARG_PROTOTYPES
-Raise(VALUE exc, char *fmt, ...)
-#else
-Raise(exc, fmt, va_alist)
- VALUE exc;
- char *fmt;
- va_dcl
-#endif
+rb_invalid_str(str, type)
+ const char *str, *type;
{
- RAISE_ERROR(exc, fmt);
+ VALUE s = rb_str_inspect(rb_str_new2(str));
+
+ rb_raise(rb_eArgError, "invalid value for %s: %s", type, RSTRING(s)->ptr);
}
-void
-#ifdef HAVE_STDARG_PROTOTYPES
-TypeError(char *fmt, ...)
-#else
-TypeError(fmt, va_alist)
- char *fmt;
- va_dcl
-#endif
+/*
+ * Document-module: Errno
+ *
+ * Ruby exception objects are subclasses of <code>Exception</code>.
+ * However, operating systems typically report errors using plain
+ * integers. Module <code>Errno</code> is created dynamically to map
+ * these operating system errors to Ruby classes, with each error
+ * number generating its own subclass of <code>SystemCallError</code>.
+ * As the subclass is created in module <code>Errno</code>, its name
+ * will start <code>Errno::</code>.
+ *
+ * The names of the <code>Errno::</code> classes depend on
+ * the environment in which Ruby runs. On a typical Unix or Windows
+ * platform, there are <code>Errno</code> classes such as
+ * <code>Errno::EACCES</code>, <code>Errno::EAGAIN</code>,
+ * <code>Errno::EINTR</code>, and so on.
+ *
+ * The integer operating system error number corresponding to a
+ * particular error is available as the class constant
+ * <code>Errno::</code><em>error</em><code>::Errno</code>.
+ *
+ * Errno::EACCES::Errno #=> 13
+ * Errno::EAGAIN::Errno #=> 11
+ * Errno::EINTR::Errno #=> 4
+ *
+ * The full list of operating system errors on your particular platform
+ * are available as the constants of <code>Errno</code>.
+ *
+ * Errno.constants #=> E2BIG, EACCES, EADDRINUSE, EADDRNOTAVAIL, ...
+ */
+
+static st_table *syserr_tbl;
+
+static VALUE
+set_syserr(n, name)
+ int n;
+ const char *name;
{
- RAISE_ERROR(eTypeError, fmt);
+ VALUE error;
+
+ if (!st_lookup(syserr_tbl, n, &error)) {
+ error = rb_define_class_under(rb_mErrno, name, rb_eSystemCallError);
+ rb_define_const(error, "Errno", INT2NUM(n));
+ st_add_direct(syserr_tbl, n, error);
+ }
+ else {
+ rb_define_const(rb_mErrno, name, error);
+ }
+ return error;
}
-void
-#ifdef HAVE_STDARG_PROTOTYPES
-ArgError(char *fmt, ...)
-#else
-ArgError(fmt, va_alist)
- char *fmt;
- va_dcl
+static VALUE
+get_syserr(n)
+ int n;
+{
+ VALUE error;
+
+ if (!st_lookup(syserr_tbl, n, &error)) {
+ char name[8]; /* some Windows' errno have 5 digits. */
+
+ snprintf(name, sizeof(name), "E%03d", n);
+ error = set_syserr(n, name);
+ }
+ return error;
+}
+
+/*
+ * call-seq:
+ * SystemCallError.new(msg, errno) => system_call_error_subclass
+ *
+ * If _errno_ corresponds to a known system error code, constructs
+ * the appropriate <code>Errno</code> class for that error, otherwise
+ * constructs a generic <code>SystemCallError</code> object. The
+ * error number is subsequently available via the <code>errno</code>
+ * method.
+ */
+
+static VALUE
+syserr_initialize(argc, argv, self)
+ int argc;
+ VALUE *argv;
+ VALUE self;
+{
+#if !defined(_WIN32) && !defined(__VMS)
+ char *strerror();
#endif
+ char *err;
+ VALUE mesg, error;
+ VALUE klass = rb_obj_class(self);
+
+ if (klass == rb_eSystemCallError) {
+ rb_scan_args(argc, argv, "11", &mesg, &error);
+ if (argc == 1 && FIXNUM_P(mesg)) {
+ error = mesg; mesg = Qnil;
+ }
+ if (!NIL_P(error) && st_lookup(syserr_tbl, NUM2LONG(error), &klass)) {
+ /* change class */
+ if (TYPE(self) != T_OBJECT) { /* insurance to avoid type crash */
+ rb_raise(rb_eTypeError, "invalid instance type");
+ }
+ RBASIC(self)->klass = klass;
+ }
+ }
+ else {
+ rb_scan_args(argc, argv, "01", &mesg);
+ error = rb_const_get(klass, rb_intern("Errno"));
+ }
+ if (!NIL_P(error)) err = strerror(NUM2LONG(error));
+ else err = "unknown error";
+ if (!NIL_P(mesg)) {
+ VALUE str = mesg;
+ StringValue(str);
+ mesg = rb_str_new(0, strlen(err)+RSTRING(mesg)->len+3);
+ sprintf(RSTRING(mesg)->ptr, "%s - %.*s", err,
+ (int)RSTRING(str)->len, RSTRING(str)->ptr);
+ rb_str_resize(mesg, strlen(RSTRING(mesg)->ptr));
+ }
+ else {
+ mesg = rb_str_new2(err);
+ }
+ exc_initialize(1, &mesg, self);
+ rb_iv_set(self, "errno", error);
+ return self;
+}
+
+/*
+ * call-seq:
+ * system_call_error.errno => fixnum
+ *
+ * Return this SystemCallError's error number.
+ */
+
+static VALUE
+syserr_errno(self)
+ VALUE self;
+{
+ return rb_attr_get(self, rb_intern("errno"));
+}
+
+/*
+ * call-seq:
+ * system_call_error === other => true or false
+ *
+ * Return +true+ if the receiver is a generic +SystemCallError+, or
+ * if the error numbers _self_ and _other_ are the same.
+ */
+
+
+static VALUE
+syserr_eqq(self, exc)
+ VALUE self, exc;
{
- RAISE_ERROR(eArgError, fmt);
+ VALUE num, e;
+
+ if (!rb_obj_is_kind_of(exc, rb_eSystemCallError)) return Qfalse;
+ if (self == rb_eSystemCallError) return Qtrue;
+
+ num = rb_attr_get(exc, rb_intern("errno"));
+ 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"));
+ }
+ e = rb_const_get(self, rb_intern("Errno"));
+ if (FIXNUM_P(num) ? num == e : rb_equal(num, e))
+ return Qtrue;
+ return Qfalse;
}
+/*
+ * Descendents of class <code>Exception</code> are used to communicate
+ * between <code>raise</code> methods and <code>rescue</code>
+ * statements in <code>begin/end</code> blocks. <code>Exception</code>
+ * objects carry information about the exception---its type (the
+ * exception's class name), an optional descriptive string, and
+ * optional traceback information. Programs may subclass
+ * <code>Exception</code> to add additional information.
+ */
+
void
-#ifdef HAVE_STDARG_PROTOTYPES
-NameError(char *fmt, ...)
-#else
-NameError(fmt, va_alist)
- char *fmt;
- va_dcl
-#endif
+Init_Exception()
{
- RAISE_ERROR(eNameError, fmt);
+ rb_eException = rb_define_class("Exception", rb_cObject);
+ rb_define_singleton_method(rb_eException, "exception", rb_class_new_instance, -1);
+ rb_define_method(rb_eException, "exception", exc_exception, -1);
+ rb_define_method(rb_eException, "initialize", exc_initialize, -1);
+ rb_define_method(rb_eException, "to_s", exc_to_s, 0);
+ rb_define_method(rb_eException, "to_str", exc_to_str, 0);
+ rb_define_method(rb_eException, "message", exc_to_str, 0);
+ rb_define_method(rb_eException, "inspect", exc_inspect, 0);
+ rb_define_method(rb_eException, "backtrace", exc_backtrace, 0);
+ rb_define_method(rb_eException, "set_backtrace", exc_set_backtrace, 1);
+
+ rb_eSystemExit = rb_define_class("SystemExit", rb_eException);
+ rb_define_method(rb_eSystemExit, "initialize", exit_initialize, -1);
+ rb_define_method(rb_eSystemExit, "status", exit_status, 0);
+ rb_define_method(rb_eSystemExit, "success?", exit_success_p, 0);
+
+ rb_eFatal = rb_define_class("fatal", rb_eException);
+ rb_eSignal = rb_define_class("SignalException", rb_eException);
+ rb_eInterrupt = rb_define_class("Interrupt", rb_eSignal);
+
+ rb_eStandardError = rb_define_class("StandardError", rb_eException);
+ rb_eTypeError = rb_define_class("TypeError", rb_eStandardError);
+ rb_eArgError = rb_define_class("ArgumentError", rb_eStandardError);
+ rb_eIndexError = rb_define_class("IndexError", rb_eStandardError);
+ rb_eRangeError = rb_define_class("RangeError", rb_eStandardError);
+ rb_eNameError = rb_define_class("NameError", rb_eStandardError);
+ rb_define_method(rb_eNameError, "initialize", name_err_initialize, -1);
+ rb_define_method(rb_eNameError, "name", name_err_name, 0);
+ rb_define_method(rb_eNameError, "to_s", name_err_to_s, 0);
+ rb_cNameErrorMesg = rb_define_class_under(rb_eNameError, "message", rb_cData);
+ rb_define_singleton_method(rb_cNameErrorMesg, "!", name_err_mesg_new, 3);
+ rb_define_method(rb_cNameErrorMesg, "to_str", name_err_mesg_to_str, 0);
+ rb_define_method(rb_cNameErrorMesg, "_dump", name_err_mesg_to_str, 1);
+ rb_define_singleton_method(rb_cNameErrorMesg, "_load", name_err_mesg_load, 1);
+ rb_eNoMethodError = rb_define_class("NoMethodError", rb_eNameError);
+ rb_define_method(rb_eNoMethodError, "initialize", nometh_err_initialize, -1);
+ rb_define_method(rb_eNoMethodError, "args", nometh_err_args, 0);
+
+ rb_eScriptError = rb_define_class("ScriptError", rb_eException);
+ rb_eSyntaxError = rb_define_class("SyntaxError", rb_eScriptError);
+ rb_eLoadError = rb_define_class("LoadError", rb_eScriptError);
+ rb_eNotImpError = rb_define_class("NotImplementedError", rb_eScriptError);
+
+ rb_eRuntimeError = rb_define_class("RuntimeError", rb_eStandardError);
+ rb_eSecurityError = rb_define_class("SecurityError", rb_eStandardError);
+ rb_eNoMemError = rb_define_class("NoMemoryError", rb_eException);
+
+ syserr_tbl = st_init_numtable();
+ rb_eSystemCallError = rb_define_class("SystemCallError", rb_eStandardError);
+ rb_define_method(rb_eSystemCallError, "initialize", syserr_initialize, -1);
+ rb_define_method(rb_eSystemCallError, "errno", syserr_errno, 0);
+ rb_define_singleton_method(rb_eSystemCallError, "===", syserr_eqq, 1);
+
+ rb_mErrno = rb_define_module("Errno");
+
+ rb_define_global_function("warn", rb_warn_m, 1);
}
void
#ifdef HAVE_STDARG_PROTOTYPES
-IndexError(char *fmt, ...)
+rb_raise(VALUE exc, const char *fmt, ...)
#else
-IndexError(fmt, va_alist)
- char *fmt;
+rb_raise(exc, fmt, va_alist)
+ VALUE exc;
+ const char *fmt;
va_dcl
#endif
{
- RAISE_ERROR(eIndexError, fmt);
+ va_list args;
+ char buf[BUFSIZ];
+
+ va_init_list(args,fmt);
+ vsnprintf(buf, BUFSIZ, fmt, args);
+ va_end(args);
+ rb_exc_raise(rb_exc_new2(exc, buf));
}
void
#ifdef HAVE_STDARG_PROTOTYPES
-Fail(char *fmt, ...)
+rb_loaderror(const char *fmt, ...)
#else
-Fail(fmt, va_alist)
- char *fmt;
+rb_loaderror(fmt, va_alist)
+ const char *fmt;
va_dcl
#endif
{
- RAISE_ERROR(eRuntimeError, fmt);
-}
+ va_list args;
+ char buf[BUFSIZ];
-void
-rb_notimplement()
-{
- Raise(eNotImpError,
- "The %s() function is unimplemented on this machine",
- rb_id2name(the_frame->last_func));
+ va_init_list(args, fmt);
+ vsnprintf(buf, BUFSIZ, fmt, args);
+ va_end(args);
+ rb_exc_raise(rb_exc_new2(rb_eLoadError, buf));
}
void
-#ifdef HAVE_STDARG_PROTOTYPES
-LoadError(char *fmt, ...)
-#else
-LoadError(fmt, va_alist)
- char *fmt;
- va_dcl
-#endif
+rb_notimplement()
{
- RAISE_ERROR(eLoadError, fmt);
+ rb_raise(rb_eNotImpError,
+ "The %s() function is unimplemented on this machine",
+ rb_id2name(ruby_frame->last_func));
}
void
#ifdef HAVE_STDARG_PROTOTYPES
-Fatal(char *fmt, ...)
+rb_fatal(const char *fmt, ...)
#else
-Fatal(fmt, va_alist)
- char *fmt;
+rb_fatal(fmt, va_alist)
+ const char *fmt;
va_dcl
#endif
{
@@ -683,91 +1100,77 @@ Fatal(fmt, va_alist)
vsnprintf(buf, BUFSIZ, fmt, args);
va_end(args);
- rb_in_eval = 0;
- rb_fatal(exc_new2(eFatal, buf));
+ ruby_in_eval = 0;
+ rb_exc_fatal(rb_exc_new2(rb_eFatal, buf));
}
void
rb_sys_fail(mesg)
- char *mesg;
+ const char *mesg;
{
-#ifndef NT
- char *strerror();
-#endif
- char *err;
- char *buf;
extern int errno;
int n = errno;
- VALUE ee;
-
- err = strerror(errno);
- if (mesg) {
- buf = ALLOCA_N(char, strlen(err)+strlen(mesg)+1);
- sprintf(buf, "%s - %s", err, mesg);
- }
- else {
- buf = ALLOCA_N(char, strlen(err)+1);
- strcpy(buf, err);
- }
+ VALUE arg;
errno = 0;
-#ifdef __BEOS__
- ee = get_syserr(n);
- if (!ee) {
- char name[6];
-
- sprintf(name, "E%03d", n);
- ee = set_syserr(n, name);
- }
-#else
-# ifdef USE_CWGUSI
- if (n < 0) {
- int macoserr_index = sys_nerr - 1;
- if (!syserr_list[macoserr_index]) {
- char name[6];
- sprintf(name, "E%03d", macoserr_index);
- ee = set_syserr(macoserr_index, name);
- }
+ if (n == 0) {
+ rb_bug("rb_sys_fail(%s) - errno == 0", mesg ? mesg : "");
}
- else
-#endif /* USE_CWGUSI */
- if (n > sys_nerr || !syserr_list[n]) {
- char name[6];
- sprintf(name, "E%03d", n);
- ee = set_syserr(n, name);
- }
- else {
- ee = syserr_list[n];
- }
- ee = exc_new2(ee, buf);
-#endif
- rb_iv_set(ee, "errno", INT2FIX(n));
- rb_raise(ee);
+ arg = mesg ? rb_str_new2(mesg) : Qnil;
+ rb_exc_raise(rb_class_new_instance(1, &arg, get_syserr(n)));
}
-static void
-init_syserr()
-{
-#ifdef __BEOS__
- int i, ix, offset;
-#endif
- eSystemCallError = rb_define_class("SystemCallError", eStandardError);
- rb_define_method(eSystemCallError, "errno", syserr_errno, 0);
-
- mErrno = rb_define_module("Errno");
-#ifdef __BEOS__
- for (i = 0; syserr_index[i].n != 0; i++) {
- ix = syserr_index[i].ix;
- for (offset = 0; offset < syserr_index[i].n; offset++) {
- MEMZERO(syserr_list[ix + offset].list, VALUE, syserr_list[ix + offset].n);
- }
- }
+void
+#ifdef HAVE_STDARG_PROTOTYPES
+rb_sys_warning(const char *fmt, ...)
#else
- syserr_list = ALLOC_N(VALUE, sys_nerr+1);
- MEMZERO(syserr_list, VALUE, sys_nerr+1);
+rb_sys_warning(fmt, va_alist)
+ const char *fmt;
+ va_dcl
#endif
+{
+ char buf[BUFSIZ];
+ va_list args;
+ int errno_save;
+
+ errno_save = errno;
+
+ if (!RTEST(ruby_verbose)) return;
+
+ snprintf(buf, BUFSIZ, "warning: %s", fmt);
+ snprintf(buf+strlen(buf), BUFSIZ-strlen(buf), ": %s", strerror(errno_save));
+
+ va_init_list(args, fmt);
+ warn_print(buf, args);
+ va_end(args);
+ errno = errno_save;
+}
+void
+rb_load_fail(path)
+ const char *path;
+{
+ rb_loaderror("%s -- %s", strerror(errno), path);
+}
+
+void
+rb_error_frozen(what)
+ const char *what;
+{
+ rb_raise(rb_eTypeError, "can't modify frozen %s", what);
+}
+
+void
+rb_check_frozen(obj)
+ VALUE obj;
+{
+ if (OBJ_FROZEN(obj)) rb_error_frozen(rb_obj_classname(obj));
+}
+
+void
+Init_syserr()
+{
#ifdef EPERM
set_syserr(EPERM, "EPERM");
#endif
@@ -1138,25 +1541,24 @@ init_syserr()
static void
err_append(s)
- char *s;
+ const char *s;
{
- extern VALUE errinfo;
+ extern VALUE ruby_errinfo;
- if (rb_in_eval) {
- if (NIL_P(errinfo)) {
- errinfo = exc_new2(eSyntaxError, s);
+ if (ruby_in_eval) {
+ if (NIL_P(ruby_errinfo)) {
+ ruby_errinfo = rb_exc_new2(rb_eSyntaxError, s);
}
else {
- VALUE str = str_to_str(errinfo);
+ VALUE str = rb_obj_as_string(ruby_errinfo);
- str_cat(str, "\n", 1);
- str_cat(str, s, strlen(s));
- errinfo = exc_new3(eSyntaxError, str);
+ rb_str_cat2(str, "\n");
+ rb_str_cat2(str, s);
+ ruby_errinfo = rb_exc_new3(rb_eSyntaxError, str);
}
}
else {
- fputs(s, stderr);
- fputs("\n", stderr);
- fflush(stderr);
+ rb_write_error(s);
+ rb_write_error("\n");
}
}
diff --git a/eval.c b/eval.c
index 9cf23d3827..043f349bbd 100644
--- a/eval.c
+++ b/eval.c
@@ -1,4 +1,4 @@
-/************************************************
+/**********************************************************************
eval.c -
@@ -6,22 +6,74 @@
$Date$
created at: Thu Jun 10 14:22:17 JST 1993
- Copyright (C) 1993-1998 Yukihiro Matsumoto
+ Copyright (C) 1993-2003 Yukihiro Matsumoto
+ Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
+ Copyright (C) 2000 Information-technology Promotion Agency, Japan
-************************************************/
+**********************************************************************/
#include "ruby.h"
#include "node.h"
#include "env.h"
+#include "util.h"
#include "rubysig.h"
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifndef EXIT_SUCCESS
+#define EXIT_SUCCESS 0
+#endif
+#ifndef EXIT_FAILURE
+#define EXIT_FAILURE 1
+#endif
+
#include <stdio.h>
+#if defined(HAVE_GETCONTEXT) && defined(HAVE_SETCONTEXT)
+#include <ucontext.h>
+#define USE_CONTEXT
+#else
#include <setjmp.h>
+#endif
+
#include "st.h"
#include "dln.h"
+#ifdef __APPLE__
+#include <crt_externs.h>
+#endif
+
+/* Make alloca work the best possible way. */
+#ifdef __GNUC__
+# ifndef atarist
+# ifndef alloca
+# define alloca __builtin_alloca
+# endif
+# endif /* atarist */
+#else
+# ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+ #pragma alloca
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+void *alloca ();
+# endif
+# endif /* AIX */
+# endif /* HAVE_ALLOCA_H */
+#endif /* __GNUC__ */
+
+#ifdef HAVE_STDARG_PROTOTYPES
+#include <stdarg.h>
+#define va_init_list(a,b) va_start(a,b)
+#else
+#include <varargs.h>
+#define va_init_list(a,b) va_start(a)
+#endif
+
#ifndef HAVE_STRING_H
-char *strrchr _((char*,char));
+char *strrchr _((const char*,const char));
#endif
#ifdef HAVE_UNISTD_H
@@ -32,34 +84,68 @@ char *strrchr _((char*,char));
#include <net/socket.h>
#endif
-#ifdef USE_CWGUSI
-#include <sys/stat.h>
-#include <sys/errno.h>
-#include <compat.h>
+#ifdef __MACOS__
+#include "macruby_private.h"
#endif
+#ifdef USE_CONTEXT
+typedef struct {
+ ucontext_t context;
+ volatile int status;
+} rb_jmpbuf_t[1];
+
+#undef longjmp
+#undef setjmp
+NORETURN(static void rb_jump_context(rb_jmpbuf_t, int));
+static inline void
+rb_jump_context(env, val)
+ rb_jmpbuf_t env;
+ int val;
+{
+ env->status = val;
+ setcontext(&env->context);
+ abort(); /* ensure noreturn */
+}
+#define longjmp(env, val) rb_jump_context(env, val)
+#define setjmp(j) ((j)->status = 0, getcontext(&(j)->context), (j)->status)
+#else
+typedef jmp_buf rb_jmpbuf_t;
#ifndef setjmp
#ifdef HAVE__SETJMP
#define setjmp(env) _setjmp(env)
#define longjmp(env,val) _longjmp(env,val)
#endif
#endif
+#endif
-#if defined(MSDOS) || defined(NT) || defined(__human68k__) || defined(__MACOS__)
-#define RUBY_LIB_SEP ";"
-#else
-#define RUBY_LIB_SEP ":"
+#include <sys/types.h>
+#include <signal.h>
+#include <errno.h>
+
+#if defined(__VMS)
+#pragma nostandard
+#endif
+
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
#endif
-VALUE cProc;
-static VALUE cBinding;
-static VALUE proc_call _((VALUE,VALUE));
-static VALUE f_binding _((VALUE));
-static void f_END _((void));
-static VALUE f_iterator_p _((void));
+#include <sys/stat.h>
+
+VALUE rb_cProc;
+static VALUE rb_cBinding;
+static VALUE proc_invoke _((VALUE,VALUE,VALUE,VALUE));
+static VALUE rb_f_binding _((VALUE));
+static void rb_f_END _((void));
+static VALUE rb_f_block_given_p _((void));
static VALUE block_pass _((VALUE,NODE*));
-static VALUE cMethod;
-static VALUE method_proc _((VALUE));
+static VALUE rb_cMethod;
+static VALUE method_call _((int, VALUE*, VALUE));
+static VALUE rb_cUnboundMethod;
+static VALUE umethod_bind _((VALUE, VALUE));
+static VALUE rb_mod_define_method _((int, VALUE*, VALUE));
+NORETURN(static void rb_raise_jump _((VALUE)));
+static VALUE rb_make_exception _((int argc, VALUE *argv));
static int scope_vmode;
#define SCOPE_PUBLIC 0
@@ -67,12 +153,88 @@ static int scope_vmode;
#define SCOPE_PROTECTED 2
#define SCOPE_MODFUNC 5
#define SCOPE_MASK 7
-#define SCOPE_SET(f) do {scope_vmode=(f);} while(0)
+#define SCOPE_SET(f) (scope_vmode=(f))
#define SCOPE_TEST(f) (scope_vmode&(f))
-#define CACHE_SIZE 0x200
-#define CACHE_MASK 0x1ff
-#define EXPR1(c,m) ((((int)(c)>>3)^(m))&CACHE_MASK)
+NODE* ruby_current_node;
+int ruby_safe_level = 0;
+/* safe-level:
+ 0 - strings from streams/environment/ARGV are tainted (default)
+ 1 - no dangerous operation by tainted value
+ 2 - process/file operations prohibited
+ 3 - all generated objects are tainted
+ 4 - no global (non-tainted) variable modification/no direct output
+*/
+
+static VALUE safe_getter _((void));
+static void safe_setter _((VALUE val));
+
+void
+rb_secure(level)
+ int level;
+{
+ if (level <= ruby_safe_level) {
+ if (ruby_frame->last_func) {
+ rb_raise(rb_eSecurityError, "Insecure operation `%s' at level %d",
+ rb_id2name(ruby_frame->last_func), ruby_safe_level);
+ }
+ else {
+ rb_raise(rb_eSecurityError, "Insecure operation at level %d", ruby_safe_level);
+ }
+ }
+}
+
+void
+rb_secure_update(obj)
+ VALUE obj;
+{
+ if (!OBJ_TAINTED(obj)) rb_secure(4);
+}
+
+void
+rb_check_safe_obj(x)
+ VALUE x;
+{
+ if (ruby_safe_level > 0 && OBJ_TAINTED(x)){
+ if (ruby_frame->last_func) {
+ rb_raise(rb_eSecurityError, "Insecure operation - %s",
+ rb_id2name(ruby_frame->last_func));
+ }
+ else {
+ rb_raise(rb_eSecurityError, "Insecure operation: -r");
+ }
+ }
+ rb_secure(4);
+}
+
+void
+rb_check_safe_str(x)
+ VALUE x;
+{
+ rb_check_safe_obj(x);
+ if (TYPE(x)!= T_STRING) {
+ rb_raise(rb_eTypeError, "wrong argument type %s (expected String)",
+ rb_obj_classname(x));
+ }
+}
+
+NORETURN(static void print_undef _((VALUE, ID)));
+static void
+print_undef(klass, id)
+ VALUE klass;
+ ID id;
+{
+ rb_name_error(id, "undefined method `%s' for %s `%s'",
+ rb_id2name(id),
+ (TYPE(klass) == T_MODULE) ? "module" : "class",
+ rb_class2name(klass));
+}
+
+static ID removed, singleton_removed, undefined, singleton_undefined;
+
+#define CACHE_SIZE 0x800
+#define CACHE_MASK 0x7ff
+#define EXPR1(c,m) ((((c)>>3)^(m))&CACHE_MASK)
struct cache_entry { /* method hash table. */
ID mid; /* method's id */
@@ -84,12 +246,14 @@ struct cache_entry { /* method hash table. */
};
static struct cache_entry cache[CACHE_SIZE];
+static int ruby_running = 0;
void
rb_clear_cache()
{
- struct cache_entry *ent, *end;
+ struct cache_entry *ent, *end;
+ if (!ruby_running) return;
ent = cache; end = ent + CACHE_SIZE;
while (ent < end) {
ent->mid = 0;
@@ -98,11 +262,29 @@ rb_clear_cache()
}
static void
+rb_clear_cache_for_undef(klass, id)
+ VALUE klass;
+ ID id;
+{
+ struct cache_entry *ent, *end;
+
+ if (!ruby_running) return;
+ ent = cache; end = ent + CACHE_SIZE;
+ while (ent < end) {
+ if (ent->origin == klass && ent->mid == id) {
+ ent->mid = 0;
+ }
+ ent++;
+ }
+}
+
+static void
rb_clear_cache_by_id(id)
ID id;
{
struct cache_entry *ent, *end;
+ if (!ruby_running) return;
ent = cache; end = ent + CACHE_SIZE;
while (ent < end) {
if (ent->mid == id) {
@@ -113,6 +295,26 @@ rb_clear_cache_by_id(id)
}
void
+rb_clear_cache_by_class(klass)
+ VALUE klass;
+{
+ struct cache_entry *ent, *end;
+
+ if (!ruby_running) return;
+ ent = cache; end = ent + CACHE_SIZE;
+ while (ent < end) {
+ if (ent->klass == klass || ent->origin == klass) {
+ ent->mid = 0;
+ }
+ ent++;
+ }
+}
+
+static ID init, eqq, each, aref, aset, match, missing;
+static ID added, singleton_added;
+static ID __id__, __send__;
+
+void
rb_add_method(klass, mid, node, noex)
VALUE klass;
ID mid;
@@ -121,9 +323,50 @@ rb_add_method(klass, mid, node, noex)
{
NODE *body;
- if (NIL_P(klass)) klass = cObject;
+ if (NIL_P(klass)) klass = rb_cObject;
+ if (ruby_safe_level >= 4 && (klass == rb_cObject || !OBJ_TAINTED(klass))) {
+ rb_raise(rb_eSecurityError, "Insecure: can't define method");
+ }
+ if (!FL_TEST(klass, FL_SINGLETON) &&
+ node && nd_type(node) != NODE_ZSUPER &&
+ (mid == rb_intern("initialize" )|| mid == rb_intern("initialize_copy"))) {
+ noex = NOEX_PRIVATE | noex;
+ }
+ else if (FL_TEST(klass, FL_SINGLETON) && node && nd_type(node) == NODE_CFUNC &&
+ mid == rb_intern("allocate")) {
+ rb_warn("defining %s.allocate is deprecated; use rb_define_alloc_func()",
+ rb_class2name(rb_iv_get(klass, "__attached__")));
+ mid = ID_ALLOCATOR;
+ }
+ if (OBJ_FROZEN(klass)) rb_error_frozen("class/module");
+ rb_clear_cache_by_id(mid);
body = NEW_METHOD(node, noex);
- st_insert(RCLASS(klass)->m_tbl, mid, body);
+ st_insert(RCLASS(klass)->m_tbl, mid, (st_data_t)body);
+ if (node && mid != ID_ALLOCATOR && ruby_running) {
+ if (FL_TEST(klass, FL_SINGLETON)) {
+ rb_funcall(rb_iv_get(klass, "__attached__"), singleton_added, 1, ID2SYM(mid));
+ }
+ else {
+ rb_funcall(klass, added, 1, ID2SYM(mid));
+ }
+ }
+}
+
+void
+rb_define_alloc_func(klass, func)
+ VALUE klass;
+ VALUE (*func) _((VALUE));
+{
+ Check_Type(klass, T_CLASS);
+ rb_add_method(CLASS_OF(klass), ID_ALLOCATOR, NEW_CFUNC(func, 0), NOEX_PRIVATE);
+}
+
+void
+rb_undef_alloc_func(klass)
+ VALUE klass;
+{
+ Check_Type(klass, T_CLASS);
+ rb_add_method(CLASS_OF(klass), ID_ALLOCATOR, 0, NOEX_UNDEF);
}
static NODE*
@@ -133,7 +376,8 @@ search_method(klass, id, origin)
{
NODE *body;
- while (!st_lookup(RCLASS(klass)->m_tbl, id, &body)) {
+ if (!klass) return 0;
+ while (!st_lookup(RCLASS(klass)->m_tbl, id, (st_data_t *)&body)) {
klass = RCLASS(klass)->super;
if (!klass) return 0;
}
@@ -151,65 +395,66 @@ rb_get_method_body(klassp, idp, noexp)
ID id = *idp;
VALUE klass = *klassp;
VALUE origin;
- NODE *body;
+ NODE * volatile body;
struct cache_entry *ent;
- if ((body = search_method(klass, id, &origin)) == 0) {
+ if ((body = search_method(klass, id, &origin)) == 0 || !body->nd_body) {
+ /* store empty info in cache */
+ ent = cache + EXPR1(klass, id);
+ ent->klass = klass;
+ ent->origin = klass;
+ ent->mid = ent->mid0 = id;
+ ent->noex = 0;
+ ent->method = 0;
+
return 0;
}
- if (!body->nd_body) return 0;
- /* store in cache */
- ent = cache + EXPR1(klass, id);
- ent->klass = klass;
- ent->noex = body->nd_noex;
- body = body->nd_body;
- if (nd_type(body) == NODE_FBODY) {
- ent->mid = id;
- *klassp = body->nd_orig;
- ent->origin = body->nd_orig;
- *idp = ent->mid0 = body->nd_mid;
- body = ent->method = body->nd_head;
+ if (ruby_running) {
+ /* store in cache */
+ ent = cache + EXPR1(klass, id);
+ ent->klass = klass;
+ ent->noex = body->nd_noex;
+ if (noexp) *noexp = body->nd_noex;
+ body = body->nd_body;
+ if (nd_type(body) == NODE_FBODY) {
+ ent->mid = id;
+ *klassp = body->nd_orig;
+ ent->origin = body->nd_orig;
+ *idp = ent->mid0 = body->nd_mid;
+ body = ent->method = body->nd_head;
+ }
+ else {
+ *klassp = origin;
+ ent->origin = origin;
+ ent->mid = ent->mid0 = id;
+ ent->method = body;
+ }
}
else {
- *klassp = origin;
- ent->origin = origin;
- ent->mid = ent->mid0 = id;
- ent->method = body;
+ if (noexp) *noexp = body->nd_noex;
+ body = body->nd_body;
+ if (nd_type(body) == NODE_FBODY) {
+ *klassp = body->nd_orig;
+ *idp = body->nd_mid;
+ body = body->nd_head;
+ }
+ else {
+ *klassp = origin;
+ }
}
- if (noexp) *noexp = ent->noex;
return body;
}
-void
-rb_alias(klass, name, def)
+NODE*
+rb_method_node(klass, id)
VALUE klass;
- ID name, def;
+ ID id;
{
- VALUE origin;
- NODE *orig, *body;
-
- if (name == def) return;
- orig = search_method(klass, def, &origin);
- if (!orig || !orig->nd_body) {
- if (TYPE(klass) == T_MODULE) {
- orig = search_method(cObject, def, &origin);
- }
- }
- if (!orig || !orig->nd_body) {
- NameError("undefined method `%s' for `%s'",
- rb_id2name(def), rb_class2name(klass));
- }
- body = orig->nd_body;
- if (nd_type(body) == NODE_FBODY) { /* was alias */
- body = body->nd_head;
- def = body->nd_mid;
- origin = body->nd_orig;
- }
+ int noex;
- st_insert(RCLASS(klass)->m_tbl, name,
- NEW_METHOD(NEW_FBODY(body, def, origin), orig->nd_noex));
+ return rb_get_method_body(&klass, &id, &noex);
}
static void
@@ -219,84 +464,103 @@ remove_method(klass, mid)
{
NODE *body;
- if (!st_delete(RCLASS(klass)->m_tbl, &mid, &body)) {
- NameError("method `%s' not defined in %s",
- rb_id2name(mid), rb_class2name(klass));
+ if (klass == rb_cObject) {
+ rb_secure(4);
+ }
+ if (ruby_safe_level >= 4 && !OBJ_TAINTED(klass)) {
+ rb_raise(rb_eSecurityError, "Insecure: can't remove method");
+ }
+ if (OBJ_FROZEN(klass)) rb_error_frozen("class/module");
+ if (mid == __id__ || mid == __send__ || mid == init) {
+ rb_warn("removing `%s' may cause serious problem", rb_id2name(mid));
+ }
+ if (!st_delete(RCLASS(klass)->m_tbl, &mid, (st_data_t *)&body) ||
+ !body->nd_body) {
+ rb_name_error(mid, "method `%s' not defined in %s",
+ rb_id2name(mid), rb_class2name(klass));
+ }
+ rb_clear_cache_for_undef(klass, mid);
+ if (FL_TEST(klass, FL_SINGLETON)) {
+ rb_funcall(rb_iv_get(klass, "__attached__"), singleton_removed, 1, ID2SYM(mid));
+ }
+ else {
+ rb_funcall(klass, removed, 1, ID2SYM(mid));
}
- rb_clear_cache_by_id(mid);
}
void
rb_remove_method(klass, name)
VALUE klass;
- char *name;
+ const char *name;
{
remove_method(klass, rb_intern(name));
}
+/*
+ * call-seq:
+ * remove_method(symbol) => self
+ *
+ * Removes the method identified by _symbol_ from the current
+ * class. For an example, see <code>Module.undef_method</code>.
+ */
+
+static VALUE
+rb_mod_remove_method(argc, argv, mod)
+ int argc;
+ VALUE *argv;
+ VALUE mod;
+{
+ int i;
+
+ for (i=0; i<argc; i++) {
+ remove_method(mod, rb_to_id(argv[i]));
+ }
+ return mod;
+}
+
+#undef rb_disable_super
+#undef rb_enable_super
+
void
rb_disable_super(klass, name)
VALUE klass;
- char *name;
+ const char *name;
{
- VALUE origin;
- NODE *body;
- ID mid = rb_intern(name);
-
- body = search_method(klass, mid, &origin);
- if (!body || !body->nd_body) {
- NameError("undefined method `%s' for `%s'",
- rb_id2name(mid), rb_class2name(klass));
- }
- if (origin == klass) {
- body->nd_noex |= NOEX_UNDEF;
- }
- else {
- rb_clear_cache_by_id(mid);
- rb_add_method(the_class, mid, 0, NOEX_UNDEF);
- }
+ /* obsolete - no use */
}
void
rb_enable_super(klass, name)
VALUE klass;
- char *name;
+ const char *name;
{
- VALUE origin;
- NODE *body;
- ID mid = rb_intern(name);
-
- body = search_method(klass, mid, &origin);
- if (!body || !body->nd_body || origin != klass) {
- NameError("undefined method `%s' for `%s'",
- rb_id2name(mid), rb_class2name(klass));
- }
- body->nd_noex &= ~NOEX_UNDEF;
+ rb_warning("rb_enable_super() is obsolete");
}
static void
rb_export_method(klass, name, noex)
VALUE klass;
ID name;
- int noex;
+ ID noex;
{
NODE *body;
VALUE origin;
+ if (klass == rb_cObject) {
+ rb_secure(4);
+ }
body = search_method(klass, name, &origin);
if (!body && TYPE(klass) == T_MODULE) {
- body = search_method(cObject, name, &origin);
+ body = search_method(rb_cObject, name, &origin);
}
- if (!body) {
- NameError("undefined method `%s' for `%s'",
- rb_id2name(name), rb_class2name(klass));
+ if (!body || !body->nd_body) {
+ print_undef(klass, name);
}
if (body->nd_noex != noex) {
if (klass == origin) {
body->nd_noex = noex;
}
else {
- rb_clear_cache_by_id(name);
rb_add_method(klass, name, NEW_ZSUPER(), noex);
}
}
@@ -308,14 +572,23 @@ rb_method_boundp(klass, id, ex)
ID id;
int ex;
{
+ struct cache_entry *ent;
int noex;
+ /* is it in the method cache? */
+ ent = cache + EXPR1(klass, id);
+ if (ent->mid == id && ent->klass == klass) {
+ if (ex && (ent->noex & NOEX_PRIVATE))
+ return Qfalse;
+ if (!ent->method) return Qfalse;
+ return Qtrue;
+ }
if (rb_get_method_body(&klass, &id, &noex)) {
- if (ex && noex & NOEX_PRIVATE)
- return FALSE;
- return TRUE;
+ if (ex && (noex & NOEX_PRIVATE))
+ return Qfalse;
+ return Qtrue;
}
- return FALSE;
+ return Qfalse;
}
void
@@ -324,16 +597,18 @@ rb_attr(klass, id, read, write, ex)
ID id;
int read, write, ex;
{
- char *name;
+ const char *name;
char *buf;
- ID attr, attriv;
+ ID attriv;
int noex;
if (!ex) noex = NOEX_PUBLIC;
else {
if (SCOPE_TEST(SCOPE_PRIVATE)) {
noex = NOEX_PRIVATE;
- Warning("private attribute?");
+ rb_warning((scope_vmode == SCOPE_MODFUNC) ?
+ "attribute accessor as module_function" :
+ "private attribute?");
}
else if (SCOPE_TEST(SCOPE_PROTECTED)) {
noex = NOEX_PROTECTED;
@@ -345,7 +620,7 @@ rb_attr(klass, id, read, write, ex)
name = rb_id2name(id);
if (!name) {
- ArgError("argument needs to be symbol or string");
+ rb_raise(rb_eArgError, "argument needs to be symbol or string");
}
buf = ALLOCA_N(char,strlen(name)+2);
sprintf(buf, "@%s", name);
@@ -353,39 +628,48 @@ rb_attr(klass, id, read, write, ex)
if (read) {
rb_add_method(klass, id, NEW_IVAR(attriv), noex);
}
- sprintf(buf, "%s=", name);
- id = rb_intern(buf);
if (write) {
+ sprintf(buf, "%s=", name);
+ id = rb_intern(buf);
rb_add_method(klass, id, NEW_ATTRSET(attriv), noex);
}
}
-static ID init, eqq, each, aref, aset, match;
-VALUE errinfo = Qnil;
-extern NODE *eval_tree_begin;
-extern NODE *eval_tree;
-extern int nerrs;
+extern int ruby_in_compile;
-static VALUE eLocalJumpError;
-static VALUE eSysStackError;
+VALUE ruby_errinfo = Qnil;
+extern NODE *ruby_eval_tree_begin;
+extern NODE *ruby_eval_tree;
+extern int ruby_nerrs;
-extern VALUE TopSelf;
+static VALUE rb_eLocalJumpError;
+static VALUE rb_eSysStackError;
-struct FRAME *the_frame;
-struct SCOPE *the_scope;
+extern VALUE ruby_top_self;
+
+struct FRAME *ruby_frame;
+struct SCOPE *ruby_scope;
static struct FRAME *top_frame;
static struct SCOPE *top_scope;
-#define PUSH_FRAME() { \
- struct FRAME _frame; \
- _frame.prev = the_frame; \
- _frame.file = sourcefile; \
- _frame.line = sourceline; \
- _frame.iter = the_iter->iter; \
- _frame.cbase = the_frame->cbase; \
- the_frame = &_frame; \
+static unsigned long frame_unique = 0;
-#define POP_FRAME() the_frame = _frame.prev; }
+#define PUSH_FRAME() do { \
+ struct FRAME _frame; \
+ _frame.prev = ruby_frame; \
+ _frame.tmp = 0; \
+ _frame.node = ruby_current_node; \
+ _frame.iter = ruby_iter->iter; \
+ _frame.argc = 0; \
+ _frame.argv = 0; \
+ _frame.flags = FRAME_ALLOCA; \
+ _frame.uniq = frame_unique++; \
+ ruby_frame = &_frame
+
+#define POP_FRAME() \
+ ruby_current_node = _frame.node; \
+ ruby_frame = _frame.prev; \
+} while (0)
struct BLOCK {
NODE *var;
@@ -394,88 +678,116 @@ struct BLOCK {
struct FRAME frame;
struct SCOPE *scope;
VALUE klass;
- struct tag *tag;
+ NODE *cref;
int iter;
int vmode;
- struct RVarmap *d_vars;
-#ifdef THREAD
+ int flags;
+ int uniq;
+ struct RVarmap *dyna_vars;
VALUE orig_thread;
-#endif
+ VALUE wrapper;
+ VALUE block_obj;
+ struct BLOCK *outer;
struct BLOCK *prev;
};
-static struct BLOCK *the_block;
-#define PUSH_BLOCK(v,b) { \
+#define BLOCK_D_SCOPE 1
+#define BLOCK_LAMBDA 2
+
+static struct BLOCK *ruby_block;
+static unsigned long block_unique = 0;
+
+#define PUSH_BLOCK(v,b) do { \
struct BLOCK _block; \
- _block.tag = prot_tag; \
- _block.var = v; \
- _block.body = b; \
+ _block.var = (v); \
+ _block.body = (b); \
_block.self = self; \
- _block.frame = *the_frame; \
- _block.klass = the_class; \
- _block.frame.file = sourcefile; \
- _block.frame.line = sourceline; \
- _block.scope = the_scope; \
- _block.d_vars = the_dyna_vars; \
- _block.prev = the_block; \
- _block.iter = the_iter->iter; \
+ _block.frame = *ruby_frame; \
+ _block.klass = ruby_class; \
+ _block.cref = ruby_cref; \
+ _block.frame.node = ruby_current_node;\
+ _block.scope = ruby_scope; \
+ _block.prev = ruby_block; \
+ _block.outer = ruby_block; \
+ _block.iter = ruby_iter->iter; \
_block.vmode = scope_vmode; \
- the_block = &_block;
-
-#define POP_BLOCK() \
- the_block = _block.prev; \
-}
-
-struct RVarmap *the_dyna_vars;
-#define PUSH_VARS() { \
- struct RVarmap * volatile _old; \
- _old = the_dyna_vars; \
- the_dyna_vars = 0;
+ _block.flags = BLOCK_D_SCOPE; \
+ _block.dyna_vars = ruby_dyna_vars; \
+ _block.wrapper = ruby_wrapper; \
+ _block.block_obj = 0; \
+ _block.uniq = (b)?block_unique++:0; \
+ if (b) { \
+ prot_tag->blkid = _block.uniq; \
+ } \
+ ruby_block = &_block
+
+#define POP_BLOCK() \
+ ruby_block = _block.prev; \
+} while (0)
+
+struct RVarmap *ruby_dyna_vars;
+#define PUSH_VARS() do { \
+ struct RVarmap * volatile _old; \
+ _old = ruby_dyna_vars; \
+ ruby_dyna_vars = 0
+
+#define POP_VARS() \
+ if (_old && (ruby_scope->flags & SCOPE_DONT_RECYCLE)) {\
+ if (RBASIC(_old)->flags) /* unless it's already recycled */ \
+ FL_SET(_old, DVAR_DONT_RECYCLE); \
+ }\
+ ruby_dyna_vars = _old; \
+} while (0)
-#define POP_VARS() \
- the_dyna_vars = _old; \
-}
+#define DVAR_DONT_RECYCLE FL_USER2
static struct RVarmap*
-new_dvar(id, value)
+new_dvar(id, value, prev)
ID id;
VALUE value;
+ struct RVarmap *prev;
{
NEWOBJ(vars, struct RVarmap);
OBJSETUP(vars, 0, T_VARMAP);
vars->id = id;
vars->val = value;
- vars->next = the_dyna_vars;
+ vars->next = prev;
return vars;
}
-static void
-mark_dvar(vars)
- struct RVarmap *vars;
+VALUE
+rb_dvar_defined(id)
+ ID id;
{
- the_dyna_vars = new_dvar(0, 0);
- the_dyna_vars->next = vars;
+ struct RVarmap *vars = ruby_dyna_vars;
+
+ while (vars) {
+ if (vars->id == id) return Qtrue;
+ vars = vars->next;
+ }
+ return Qfalse;
}
VALUE
-dyna_var_defined(id)
+rb_dvar_curr(id)
ID id;
{
- struct RVarmap *vars = the_dyna_vars;
+ struct RVarmap *vars = ruby_dyna_vars;
while (vars) {
- if (vars->id == id) return TRUE;
+ if (vars->id == 0) break;
+ if (vars->id == id) return Qtrue;
vars = vars->next;
}
- return FALSE;
+ return Qfalse;
}
VALUE
-dyna_var_ref(id)
+rb_dvar_ref(id)
ID id;
{
- struct RVarmap *vars = the_dyna_vars;
+ struct RVarmap *vars = ruby_dyna_vars;
while (vars) {
if (vars->id == id) {
@@ -487,106 +799,142 @@ dyna_var_ref(id)
}
void
-dyna_var_push(id, value)
+rb_dvar_push(id, value)
ID id;
VALUE value;
{
- the_dyna_vars = new_dvar(id, value);
+ ruby_dyna_vars = new_dvar(id, value, ruby_dyna_vars);
}
-VALUE
-dyna_var_asgn(id, value)
+static void
+dvar_asgn_internal(id, value, curr)
ID id;
VALUE value;
+ int curr;
{
- struct RVarmap *vars = the_dyna_vars;
+ int n = 0;
+ struct RVarmap *vars = ruby_dyna_vars;
while (vars) {
+ if (curr && vars->id == 0) {
+ /* first null is a dvar header */
+ n++;
+ if (n == 2) break;
+ }
if (vars->id == id) {
vars->val = value;
- return value;
+ return;
}
vars = vars->next;
}
- dyna_var_push(id, value);
- return value;
+ if (!ruby_dyna_vars) {
+ ruby_dyna_vars = new_dvar(id, value, 0);
+ }
+ else {
+ vars = new_dvar(id, value, ruby_dyna_vars->next);
+ ruby_dyna_vars->next = vars;
+ }
}
-static void
-dvar_asgn_push(id, value)
+static inline void
+dvar_asgn(id, value)
ID id;
VALUE value;
{
- if (the_dyna_vars && the_dyna_vars->id == 0) {
- struct RVarmap* vars = new_dvar(id, value);
+ dvar_asgn_internal(id, value, 0);
+}
- vars->next = the_dyna_vars->next;
- the_dyna_vars->next = vars;
- }
- else {
- dyna_var_asgn(id, value);
+static inline void
+dvar_asgn_curr(id, value)
+ ID id;
+ VALUE value;
+{
+ dvar_asgn_internal(id, value, 1);
+}
+
+VALUE *
+rb_svar(cnt)
+ int cnt;
+{
+ struct RVarmap *vars = ruby_dyna_vars;
+ ID id;
+
+ if (!ruby_scope->local_tbl) return NULL;
+ if (cnt >= ruby_scope->local_tbl[0]) return NULL;
+ id = ruby_scope->local_tbl[cnt+1];
+ while (vars) {
+ if (vars->id == id) return &vars->val;
+ vars = vars->next;
}
+ if (ruby_scope->local_vars == 0) return NULL;
+ return &ruby_scope->local_vars[cnt];
}
struct iter {
int iter;
struct iter *prev;
};
-static struct iter *the_iter;
+static struct iter *ruby_iter;
#define ITER_NOT 0
#define ITER_PRE 1
#define ITER_CUR 2
-#define PUSH_ITER(i) { \
+#define PUSH_ITER(i) do { \
struct iter _iter; \
- _iter.prev = the_iter; \
+ _iter.prev = ruby_iter; \
_iter.iter = (i); \
- the_iter = &_iter; \
+ ruby_iter = &_iter
#define POP_ITER() \
- the_iter = _iter.prev; \
-}
+ ruby_iter = _iter.prev; \
+} while (0)
struct tag {
- jmp_buf buf;
+ rb_jmpbuf_t buf;
struct FRAME *frame;
struct iter *iter;
- ID tag;
+ VALUE tag;
VALUE retval;
- ID dst;
+ struct SCOPE *scope;
+ VALUE dst;
struct tag *prev;
+ int blkid;
};
static struct tag *prot_tag;
-#define PUSH_TAG(ptag) { \
+#define PUSH_TAG(ptag) do { \
struct tag _tag; \
_tag.retval = Qnil; \
- _tag.frame = the_frame; \
- _tag.iter = the_iter; \
+ _tag.frame = ruby_frame; \
+ _tag.iter = ruby_iter; \
_tag.prev = prot_tag; \
- _tag.retval = Qnil; \
+ _tag.scope = ruby_scope; \
_tag.tag = ptag; \
_tag.dst = 0; \
- prot_tag = &_tag;
+ _tag.blkid = 0; \
+ prot_tag = &_tag
-#define PROT_NONE 0
-#define PROT_FUNC -1
-#define PROT_THREAD -2
+#define PROT_NONE Qfalse /* 0 */
+#define PROT_THREAD Qtrue /* 2 */
+#define PROT_FUNC INT2FIX(0) /* 1 */
+#define PROT_LOOP INT2FIX(1) /* 3 */
+#define PROT_LAMBDA INT2FIX(2) /* 5 */
+#define PROT_YIELD INT2FIX(3) /* 7 */
-#define EXEC_TAG() setjmp(prot_tag->buf)
+#define EXEC_TAG() (FLUSH_REGISTER_WINDOWS, setjmp(prot_tag->buf))
-#define JUMP_TAG(st) { \
- the_frame = prot_tag->frame; \
- the_iter = prot_tag->iter; \
+#define JUMP_TAG(st) do { \
+ ruby_frame = prot_tag->frame; \
+ ruby_iter = prot_tag->iter; \
longjmp(prot_tag->buf,(st)); \
-}
+} while (0)
#define POP_TAG() \
- if (_tag.prev) \
- _tag.prev->retval = _tag.retval;\
prot_tag = _tag.prev; \
-}
+} while (0)
+
+#define TAG_DST() (_tag.dst == (VALUE)ruby_frame->uniq)
#define TAG_RETURN 0x1
#define TAG_BREAK 0x2
@@ -598,135 +946,128 @@ static struct tag *prot_tag;
#define TAG_FATAL 0x8
#define TAG_MASK 0xf
-VALUE the_class;
+VALUE ruby_class;
+static VALUE ruby_wrapper; /* security wrapper */
-#define PUSH_CLASS() { \
- VALUE _class = the_class; \
+#define PUSH_CLASS(c) do { \
+ VALUE _class = ruby_class; \
+ ruby_class = (c)
-#define POP_CLASS() the_class = _class; }
+#define POP_CLASS() ruby_class = _class; \
+} while (0)
-#define PUSH_SCOPE() { \
- int volatile _vmode = scope_vmode; \
+static NODE *ruby_cref = 0;
+static NODE *top_cref;
+#define PUSH_CREF(c) ruby_cref = NEW_NODE(NODE_CREF,(c),0,ruby_cref)
+#define POP_CREF() ruby_cref = ruby_cref->nd_next
+
+#define PUSH_SCOPE() do { \
+ volatile int _vmode = scope_vmode; \
struct SCOPE * volatile _old; \
NEWOBJ(_scope, struct SCOPE); \
OBJSETUP(_scope, 0, T_SCOPE); \
_scope->local_tbl = 0; \
_scope->local_vars = 0; \
- _scope->flag = 0; \
- _old = the_scope; \
- the_scope = _scope; \
- scope_vmode = SCOPE_PUBLIC;
-
-#define POP_SCOPE() \
- if (the_scope->flag == SCOPE_ALLOCA) {\
- the_scope->local_vars = 0;\
- the_scope->local_tbl = 0;\
- if (the_scope != top_scope)\
- gc_force_recycle(the_scope);\
- }\
- else {\
- the_scope->flag |= SCOPE_NOSTACK;\
- }\
- the_scope = _old;\
- scope_vmode = _vmode;\
-}
+ _scope->flags = 0; \
+ _old = ruby_scope; \
+ ruby_scope = _scope; \
+ scope_vmode = SCOPE_PUBLIC
+
+typedef struct thread * rb_thread_t;
+static rb_thread_t curr_thread = 0;
+static rb_thread_t main_thread;
+static void scope_dup _((struct SCOPE *));
+
+#define POP_SCOPE() \
+ if (ruby_scope->flags & SCOPE_DONT_RECYCLE) {\
+ if (_old) scope_dup(_old); \
+ } \
+ if (!(ruby_scope->flags & SCOPE_MALLOC)) {\
+ ruby_scope->local_vars = 0; \
+ ruby_scope->local_tbl = 0; \
+ if (!(ruby_scope->flags & SCOPE_DONT_RECYCLE) && \
+ ruby_scope != top_scope) { \
+ rb_gc_force_recycle((VALUE)ruby_scope);\
+ } \
+ } \
+ ruby_scope->flags |= SCOPE_NOSTACK; \
+ ruby_scope = _old; \
+ scope_vmode = _vmode; \
+} while (0)
static VALUE rb_eval _((VALUE,NODE*));
static VALUE eval _((VALUE,VALUE,VALUE,char*,int));
-static NODE *compile _((VALUE,char*));
+static NODE *compile _((VALUE, char*, int));
+
+static VALUE rb_yield_0 _((VALUE, VALUE, VALUE, int, int));
-static VALUE rb_call _((VALUE,VALUE,ID,int,VALUE*,int));
+#define YIELD_LAMBDA_CALL 1
+#define YIELD_PROC_CALL 2
+#define YIELD_PUBLIC_DEF 4
+#define YIELD_FUNC_AVALUE 1
+#define YIELD_FUNC_SVALUE 2
+
+static VALUE rb_call _((VALUE,VALUE,ID,int,const VALUE*,int));
static VALUE module_setup _((VALUE,NODE*));
-static VALUE massign _((VALUE,NODE*,VALUE));
-static void assign _((VALUE,NODE*,VALUE));
+static VALUE massign _((VALUE,NODE*,VALUE,int));
+static void assign _((VALUE,NODE*,VALUE,int));
-static int safe_level = 0;
-/* safe-level:
- 0 - strings from streams/environment/ARGV are tainted (default)
- 1 - no dangerous operation by tainted string
- 2 - some process operations prohibited
- 3 - all genetated strings are tainted
- 4 - no global variable value modification/no direct output
- 5 - no instance variable value modification
-*/
+static VALUE trace_func = 0;
+static int tracing = 0;
+static void call_trace_func _((char*,NODE*,VALUE,ID,VALUE));
-int
-rb_safe_level()
-{
- return safe_level;
-}
+#if 0
+#define SET_CURRENT_SOURCE() (ruby_sourcefile = ruby_current_node->nd_file, \
+ ruby_sourceline = nd_line(ruby_current_node))
+#else
+#define SET_CURRENT_SOURCE() ((void)0)
+#endif
void
-rb_set_safe_level(level)
- int level;
+ruby_set_current_source()
{
- if (level > safe_level) {
- safe_level = level;
+ if (ruby_current_node) {
+ ruby_sourcefile = ruby_current_node->nd_file;
+ ruby_sourceline = nd_line(ruby_current_node);
}
}
-static VALUE
-safe_getter()
-{
- return INT2FIX(safe_level);
-}
-
static void
-safe_setter(val)
- VALUE val;
-{
- int level = NUM2INT(val);
-
- if (level < safe_level) {
- Raise(eSecurityError, "tried to downgrade safe level from %d to %d",
- safe_level, level);
- }
- safe_level = level;
-}
-
-void
-rb_check_safe_str(x)
- VALUE x;
+#ifdef HAVE_STDARG_PROTOTYPES
+warn_printf(const char *fmt, ...)
+#else
+warn_printf(fmt, va_alist)
+ const char *fmt;
+ va_dcl
+#endif
{
- if (TYPE(x)!= T_STRING) {
- TypeError("wrong argument type %s (expected String)",
- rb_class2name(CLASS_OF(x)));
- }
- if (str_tainted(x)) {
- if (safe_level > 0){
- Raise(eSecurityError, "Insecure operation - %s",
- rb_id2name(the_frame->last_func));
- }
- }
-}
+ char buf[BUFSIZ];
+ va_list args;
-void
-rb_secure(level)
- int level;
-{
- if (level <= safe_level) {
- Raise(eSecurityError, "Insecure operation `%s' for level %d",
- rb_id2name(the_frame->last_func), level);
- }
+ va_init_list(args, fmt);
+ vsnprintf(buf, BUFSIZ, fmt, args);
+ va_end(args);
+ rb_write_error(buf);
}
-extern int sourceline;
-extern char *sourcefile;
-
-static VALUE trace_func = 0;
-static void call_trace_func _((char*,char*,int,VALUE,ID));
+#define warn_print(x) rb_write_error(x)
+#define warn_print2(x,l) rb_write_error2(x,l)
static void
error_pos()
{
- if (sourcefile) {
- if (the_frame->last_func) {
- fprintf(stderr, "%s:%d:in `%s'", sourcefile, sourceline,
- rb_id2name(the_frame->last_func));
+ ruby_set_current_source();
+ if (ruby_sourcefile) {
+ if (ruby_frame->last_func) {
+ warn_printf("%s:%d:in `%s'", ruby_sourcefile, ruby_sourceline,
+ rb_id2name(ruby_frame->last_func));
+ }
+ else if (ruby_sourceline == 0) {
+ warn_printf("%s", ruby_sourcefile);
}
else {
- fprintf(stderr, "%s:%d", sourcefile, sourceline);
+ warn_printf("%s:%d", ruby_sourcefile, ruby_sourceline);
}
}
}
@@ -736,7 +1077,7 @@ get_backtrace(info)
VALUE info;
{
if (NIL_P(info)) return Qnil;
- return rb_funcall(info, rb_intern("backtrace"), 0);
+ return rb_check_array_type(rb_funcall(info, rb_intern("backtrace"), 0));
}
static void
@@ -749,61 +1090,87 @@ set_backtrace(info, bt)
static void
error_print()
{
- VALUE errat;
- VALUE eclass;
- VALUE einfo;
+ VALUE errat = Qnil; /* OK */
+ volatile VALUE eclass, e;
+ char *einfo;
+ long elen;
- if (NIL_P(errinfo)) return;
+ if (NIL_P(ruby_errinfo)) return;
- errat = get_backtrace(errinfo);
- if (!NIL_P(errat)) {
+ PUSH_TAG(PROT_NONE);
+ if (EXEC_TAG() == 0) {
+ errat = get_backtrace(ruby_errinfo);
+ }
+ else {
+ errat = Qnil;
+ }
+ if (EXEC_TAG()) goto error;
+ if (NIL_P(errat)){
+ ruby_set_current_source();
+ if (ruby_sourcefile)
+ warn_printf("%s:%d", ruby_sourcefile, ruby_sourceline);
+ else
+ warn_printf("%d", ruby_sourceline);
+ }
+ else if (RARRAY(errat)->len == 0) {
+ error_pos();
+ }
+ else {
VALUE mesg = RARRAY(errat)->ptr[0];
if (NIL_P(mesg)) error_pos();
else {
- fwrite(RSTRING(mesg)->ptr, 1, RSTRING(mesg)->len, stderr);
+ warn_print2(RSTRING(mesg)->ptr, RSTRING(mesg)->len);
}
}
- eclass = CLASS_OF(errinfo);
- einfo = obj_as_string(errinfo);
- if (eclass == eRuntimeError && RSTRING(einfo)->len == 0) {
- fprintf(stderr, ": unhandled exception\n");
+ eclass = CLASS_OF(ruby_errinfo);
+ if (EXEC_TAG() == 0) {
+ e = rb_funcall(ruby_errinfo, rb_intern("message"), 0, 0);
+ StringValue(e);
+ einfo = RSTRING(e)->ptr;
+ elen = RSTRING(e)->len;
+ }
+ else {
+ einfo = "";
+ elen = 0;
+ }
+ if (EXEC_TAG()) goto error;
+ if (eclass == rb_eRuntimeError && elen == 0) {
+ warn_print(": unhandled exception\n");
}
else {
VALUE epath;
- epath = rb_class_path(eclass);
- if (RSTRING(einfo)->len == 0) {
- fprintf(stderr, ": ");
- fwrite(RSTRING(epath)->ptr, 1, RSTRING(epath)->len, stderr);
- putc('\n', stderr);
+ epath = rb_class_name(eclass);
+ if (elen == 0) {
+ warn_print(": ");
+ warn_print2(RSTRING(epath)->ptr, RSTRING(epath)->len);
}
else {
char *tail = 0;
- int len = RSTRING(einfo)->len;
+ long len = elen;
if (RSTRING(epath)->ptr[0] == '#') epath = 0;
- if (tail = strchr(RSTRING(einfo)->ptr, '\n')) {
- len = tail - RSTRING(einfo)->ptr;
+ if (tail = memchr(einfo, '\n', elen)) {
+ len = tail - einfo;
tail++; /* skip newline */
}
- fprintf(stderr, ": ");
- fwrite(RSTRING(einfo)->ptr, 1, len, stderr);
+ warn_print(": ");
+ warn_print2(einfo, len);
if (epath) {
- fprintf(stderr, " (");
- fwrite(RSTRING(epath)->ptr, 1, RSTRING(epath)->len, stderr);
- fprintf(stderr, ")\n");
+ warn_print(" (");
+ warn_print2(RSTRING(epath)->ptr, RSTRING(epath)->len);
+ warn_print(")\n");
}
if (tail) {
- fwrite(tail, 1, RSTRING(einfo)->len-len-1, stderr);
- putc('\n', stderr);
+ warn_print2(tail, elen-len-1);
}
}
}
if (!NIL_P(errat)) {
- int i;
+ long i;
struct RArray *ep = RARRAY(errat);
#define TRACE_MAX (TRACE_HEAD+TRACE_TAIL+5)
@@ -812,365 +1179,569 @@ error_print()
ep = RARRAY(errat);
for (i=1; i<ep->len; i++) {
- fprintf(stderr, "\tfrom %s\n", RSTRING(ep->ptr[i])->ptr);
+ 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) {
- fprintf(stderr, "\t ... %d levels...\n",
+ warn_printf("\t ... %ld levels...\n",
ep->len - TRACE_HEAD - TRACE_TAIL);
i = ep->len - TRACE_TAIL;
}
}
}
+ error:
+ POP_TAG();
}
-#if !defined(NT) && !defined(__MACOS__)
+#if defined(__APPLE__)
+#define environ (*_NSGetEnviron())
+#elif !defined(_WIN32) && !defined(__MACOS__) || defined(_WIN32_WCE)
extern char **environ;
#endif
-char **origenviron;
+char **rb_origenviron;
void rb_call_inits _((void));
-void init_stack _((void));
-void init_heap _((void));
+void Init_stack _((VALUE*));
+void Init_heap _((void));
void Init_ext _((void));
-void gc_call_finalizer_at_exit _((void));
+
+#ifdef HAVE_NATIVETHREAD
+static rb_nativethread_t ruby_thid;
+int
+is_ruby_native_thread() {
+ return NATIVETHREAD_EQUAL(ruby_thid, NATIVETHREAD_CURRENT());
+}
+#endif
void
ruby_init()
{
+ static int initialized = 0;
static struct FRAME frame;
static struct iter iter;
int state;
- the_frame = top_frame = &frame;
- the_iter = &iter;
+ if (initialized)
+ return;
+ initialized = 1;
+#ifdef HAVE_NATIVETHREAD
+ ruby_thid = NATIVETHREAD_CURRENT();
+#endif
+
+ ruby_frame = top_frame = &frame;
+ ruby_iter = &iter;
#ifdef __MACOS__
- origenviron = 0;
+ rb_origenviron = 0;
#else
- origenviron = environ;
+ rb_origenviron = environ;
#endif
- init_heap();
+ Init_stack((void*)&state);
+ Init_heap();
PUSH_SCOPE();
- the_scope->local_vars = 0;
- the_scope->local_tbl = 0;
- top_scope = the_scope;
+ ruby_scope->local_vars = 0;
+ ruby_scope->local_tbl = 0;
+ top_scope = ruby_scope;
/* default visibility is private at toplevel */
SCOPE_SET(SCOPE_PRIVATE);
- PUSH_TAG(PROT_NONE)
+ PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
rb_call_inits();
- the_class = cObject;
- the_frame->self = TopSelf;
- the_frame->cbase = (VALUE)node_newnode(NODE_CREF,cObject,0,0);
- rb_define_global_const("TOPLEVEL_BINDING", f_binding(TopSelf));
+ ruby_class = rb_cObject;
+ ruby_frame->self = ruby_top_self;
+ top_cref = rb_node_newnode(NODE_CREF,rb_cObject,0,0);
+ ruby_cref = top_cref;
+ rb_define_global_const("TOPLEVEL_BINDING", rb_f_binding(ruby_top_self));
+#ifdef __MACOS__
+ _macruby_init();
+#endif
ruby_prog_init();
- }
- POP_TAG();
- if (state) error_print();
- POP_SCOPE();
- the_scope = top_scope;
-}
-
-static int ext_init = 0;
-
-void
-ruby_options(argc, argv)
- int argc;
- char **argv;
-{
- int state;
-
- PUSH_TAG(PROT_NONE)
- if ((state = EXEC_TAG()) == 0) {
- NODE *save;
-
- ruby_process_options(argc, argv);
- ext_init = 1; /* Init_ext() called in ruby_process_options */
- save = eval_tree;
- ruby_require_modules();
- eval_tree = save;
+ ALLOW_INTS;
}
POP_TAG();
if (state) {
error_print();
- exit(1);
+ exit(EXIT_FAILURE);
}
+ POP_SCOPE();
+ ruby_scope = top_scope;
+ top_scope->flags &= ~SCOPE_NOSTACK;
+ ruby_running = 1;
}
static VALUE
-eval_node(self)
+eval_node(self, node)
VALUE self;
+ NODE *node;
{
- VALUE result = Qnil;
- NODE *tree;
+ NODE *beg_tree = ruby_eval_tree_begin;
- if (eval_tree_begin) {
- tree = eval_tree_begin;
- eval_tree_begin = 0;
- rb_eval(self, tree);
+ ruby_eval_tree_begin = 0;
+ if (beg_tree) {
+ rb_eval(self, beg_tree);
}
- if (!eval_tree) return Qnil;
-
- tree = eval_tree;
- eval_tree = 0;
-
- result = rb_eval(self, tree);
- return result;
+ if (!node) return Qnil;
+ return rb_eval(self, node);
}
-int rb_in_eval;
+int ruby_in_eval;
-#ifdef THREAD
-static void thread_cleanup _((void));
-static void thread_wait_other_threads _((void));
-static VALUE thread_current _((void));
-#endif
+static void rb_thread_cleanup _((void));
+static void rb_thread_wait_other_threads _((void));
-static int exit_status;
+static int thread_set_raised();
+static int thread_reset_raised();
-static void exec_end_proc _((void));
+static VALUE exception_error;
+static VALUE sysstack_error;
-void
-ruby_run()
+static int
+error_handle(ex)
+ int ex;
{
- int state;
- static int ex;
-
- if (nerrs > 0) exit(nerrs);
-
- init_stack();
+ int status = EXIT_FAILURE;
- PUSH_TAG(PROT_NONE);
- PUSH_ITER(ITER_NOT);
- if ((state = EXEC_TAG()) == 0) {
- if (!ext_init) Init_ext();
- eval_node(TopSelf);
- }
- POP_ITER();
- POP_TAG();
-
- if (state && !ex) ex = state;
- PUSH_TAG(PROT_NONE);
- PUSH_ITER(ITER_NOT);
- if ((state = EXEC_TAG()) == 0) {
- rb_trap_exit();
-#ifdef THREAD
- thread_cleanup();
- thread_wait_other_threads();
-#endif
- exec_end_proc();
- gc_call_finalizer_at_exit();
- }
- else {
- ex = state;
- }
- POP_ITER();
- POP_TAG();
-
- switch (ex & 0xf) {
+ if (thread_set_raised()) return EXIT_FAILURE;
+ switch (ex & TAG_MASK) {
case 0:
- exit(0);
+ status = EXIT_SUCCESS;
+ break;
case TAG_RETURN:
error_pos();
- fprintf(stderr, ": unexpected return\n");
- exit(1);
+ warn_print(": unexpected return\n");
break;
case TAG_NEXT:
error_pos();
- fprintf(stderr, ": unexpected next\n");
- exit(1);
+ warn_print(": unexpected next\n");
break;
case TAG_BREAK:
error_pos();
- fprintf(stderr, ": unexpected break\n");
- exit(1);
+ warn_print(": unexpected break\n");
break;
case TAG_REDO:
error_pos();
- fprintf(stderr, ": unexpected redo\n");
- exit(1);
+ warn_print(": unexpected redo\n");
break;
case TAG_RETRY:
error_pos();
- fprintf(stderr, ": retry outside of rescue clause\n");
- exit(1);
+ warn_print(": retry outside of rescue clause\n");
+ break;
+ case TAG_THROW:
+ if (prot_tag && prot_tag->frame && prot_tag->frame->node) {
+ NODE *tag = prot_tag->frame->node;
+ warn_printf("%s:%d: uncaught throw\n",
+ tag->nd_file, nd_line(tag));
+ }
+ else {
+ error_pos();
+ warn_printf(": unexpected throw\n");
+ }
break;
case TAG_RAISE:
case TAG_FATAL:
- if (obj_is_kind_of(errinfo, eSystemExit)) {
- exit(exit_status);
+ if (rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) {
+ VALUE st = rb_iv_get(ruby_errinfo, "status");
+ status = NUM2INT(st);
+ }
+ else {
+ error_print();
}
- error_print();
- exit(1);
break;
default:
- Bug("Unknown longjmp status %d", ex);
+ rb_bug("Unknown longjmp status %d", ex);
break;
}
+ thread_reset_raised();
+ return status;
+}
+
+void
+ruby_options(argc, argv)
+ int argc;
+ char **argv;
+{
+ int state;
+
+ Init_stack((void*)&state);
+ PUSH_TAG(PROT_NONE);
+ if ((state = EXEC_TAG()) == 0) {
+ ruby_process_options(argc, argv);
+ }
+ else {
+ trace_func = 0;
+ tracing = 0;
+ exit(error_handle(state));
+ }
+ POP_TAG();
+}
+
+void rb_exec_end_proc _((void));
+
+static void
+ruby_finalize_0()
+{
+ PUSH_TAG(PROT_NONE);
+ if (EXEC_TAG() == 0) {
+ rb_trap_exit();
+ }
+ POP_TAG();
+ rb_exec_end_proc();
+}
+
+static void
+ruby_finalize_1()
+{
+ ruby_errinfo = 0;
+ rb_gc_call_finalizer_at_exit();
+ trace_func = 0;
+ tracing = 0;
+}
+
+void
+ruby_finalize()
+{
+ ruby_finalize_0();
+ ruby_finalize_1();
+}
+
+int
+ruby_cleanup(ex)
+ int ex;
+{
+ int state;
+ volatile VALUE err = ruby_errinfo;
+
+ ruby_safe_level = 0;
+ Init_stack((void*)&state);
+ ruby_finalize_0();
+ if (ruby_errinfo) err = ruby_errinfo;
+ PUSH_TAG(PROT_NONE);
+ PUSH_ITER(ITER_NOT);
+ if ((state = EXEC_TAG()) == 0) {
+ rb_thread_cleanup();
+ rb_thread_wait_other_threads();
+ }
+ else if (ex == 0) {
+ ex = state;
+ }
+ POP_ITER();
+ ruby_errinfo = err;
+ ex = error_handle(ex);
+ ruby_finalize_1();
+ POP_TAG();
+
+ if (err && rb_obj_is_kind_of(err, rb_eSystemExit)) {
+ VALUE st = rb_iv_get(err, "status");
+ return NUM2INT(st);
+ }
+ return ex;
+}
+
+static int
+ruby_exec_internal()
+{
+ int state;
+
+ PUSH_TAG(PROT_NONE);
+ PUSH_ITER(ITER_NOT);
+ /* default visibility is private at toplevel */
+ SCOPE_SET(SCOPE_PRIVATE);
+ if ((state = EXEC_TAG()) == 0) {
+ eval_node(ruby_top_self, ruby_eval_tree);
+ }
+ POP_ITER();
+ POP_TAG();
+ return state;
+}
+
+void
+ruby_stop(ex)
+ int ex;
+{
+ exit(ruby_cleanup(ex));
+}
+
+int
+ruby_exec()
+{
+ volatile NODE *tmp;
+
+ Init_stack((void*)&tmp);
+ return ruby_exec_internal();
+}
+
+void
+ruby_run()
+{
+ int state;
+ static int ex;
+
+ if (ruby_nerrs > 0) exit(EXIT_FAILURE);
+ state = ruby_exec();
+ if (state && !ex) ex = state;
+ ruby_stop(ex);
}
static void
compile_error(at)
- char *at;
+ const char *at;
{
VALUE str;
- char *mesg;
- int len;
- mesg = str2cstr(errinfo, &len);
- nerrs = 0;
- str = str_new2("compile error");
+ ruby_nerrs = 0;
+ str = rb_str_buf_new2("compile error");
if (at) {
- str_cat(str, " in ", 4);
- str_cat(str, at, strlen(at));
+ rb_str_buf_cat2(str, " in ");
+ rb_str_buf_cat2(str, at);
+ }
+ rb_str_buf_cat(str, "\n", 1);
+ if (!NIL_P(ruby_errinfo)) {
+ rb_str_append(str, rb_obj_as_string(ruby_errinfo));
}
- str_cat(str, "\n", 1);
- str_cat(str, mesg, len);
- rb_raise(exc_new3(eSyntaxError, str));
+ rb_exc_raise(rb_exc_new3(rb_eSyntaxError, str));
}
VALUE
rb_eval_string(str)
- char *str;
+ const char *str;
{
VALUE v;
- char *oldsrc = sourcefile;
+ NODE *oldsrc = ruby_current_node;
- sourcefile = "(eval)";
- v = eval(TopSelf, str_new2(str), Qnil, 0, 0);
- sourcefile = oldsrc;
+ ruby_current_node = 0;
+ ruby_sourcefile = rb_source_filename("(eval)");
+ v = eval(ruby_top_self, rb_str_new2(str), Qnil, 0, 0);
+ ruby_current_node = oldsrc;
return v;
}
VALUE
-rb_eval_cmd(cmd, arg)
- VALUE cmd, arg;
+rb_eval_string_protect(str, state)
+ const char *str;
+ int *state;
{
- int state;
- VALUE val;
- struct SCOPE *saved_scope;
- volatile int safe = rb_safe_level();
+ VALUE result = Qnil; /* OK */
+ int status;
- if (TYPE(cmd) != T_STRING) {
- Check_Type(arg, T_ARRAY);
- return rb_funcall2(cmd, rb_intern("call"),
- RARRAY(arg)->len, RARRAY(arg)->ptr);
+ PUSH_TAG(PROT_NONE);
+ if ((status = EXEC_TAG()) == 0) {
+ result = rb_eval_string(str);
+ }
+ POP_TAG();
+ if (state) {
+ *state = status;
+ }
+ if (status != 0) {
+ return Qnil;
}
- PUSH_CLASS();
- PUSH_TAG(PROT_NONE);
- saved_scope = the_scope;
- the_scope = top_scope;
+ return result;
+}
+
+VALUE
+rb_eval_string_wrap(str, state)
+ const char *str;
+ int *state;
+{
+ int status;
+ VALUE self = ruby_top_self;
+ VALUE wrapper = ruby_wrapper;
+ VALUE val;
- the_class = cObject;
- if (str_tainted(cmd)) {
- safe_level = 5;
+ PUSH_CLASS(ruby_wrapper = rb_module_new());
+ ruby_top_self = rb_obj_clone(ruby_top_self);
+ rb_extend_object(ruby_top_self, ruby_wrapper);
+ PUSH_FRAME();
+ ruby_frame->last_func = 0;
+ ruby_frame->orig_func = 0;
+ ruby_frame->last_class = 0;
+ ruby_frame->self = self;
+ PUSH_CREF(ruby_wrapper);
+ PUSH_SCOPE();
+
+ val = rb_eval_string_protect(str, &status);
+ ruby_top_self = self;
+
+ POP_SCOPE();
+ POP_FRAME();
+ POP_CLASS();
+ ruby_wrapper = wrapper;
+ if (state) {
+ *state = status;
}
+ else if (status) {
+ JUMP_TAG(status);
+ }
+ return val;
+}
- if ((state = EXEC_TAG()) == 0) {
- val = eval(TopSelf, cmd, Qnil, 0, 0);
+NORETURN(static void localjump_error(const char*, VALUE, int));
+static void
+localjump_error(mesg, value, reason)
+ const char *mesg;
+ VALUE value;
+ int reason;
+{
+ VALUE exc = rb_exc_new2(rb_eLocalJumpError, mesg);
+ ID id;
+
+ rb_iv_set(exc, "@exit_value", value);
+ switch (reason) {
+ case TAG_BREAK:
+ id = rb_intern("break"); break;
+ case TAG_REDO:
+ id = rb_intern("redo"); break;
+ case TAG_RETRY:
+ id = rb_intern("retry"); break;
+ case TAG_NEXT:
+ id = rb_intern("next"); break;
+ case TAG_RETURN:
+ id = rb_intern("return"); break;
+ default:
+ id = rb_intern("noreason"); break;
}
+ rb_iv_set(exc, "@reason", ID2SYM(id));
+ rb_exc_raise(exc);
+}
- the_scope = saved_scope;
- safe_level = safe;
- POP_TAG();
- POP_CLASS();
+/*
+ * call_seq:
+ * local_jump_error.exit_value => obj
+ *
+ * Returns the exit value associated with this +LocalJumpError+.
+ */
+static VALUE
+localjump_xvalue(exc)
+ VALUE exc;
+{
+ return rb_iv_get(exc, "@exit_value");
+}
+
+/*
+ * call-seq:
+ * local_jump_error.reason => symbol
+ *
+ * The reason this block was terminated:
+ * :break, :redo, :retry, :next, :return, or :noreason.
+ */
+
+static VALUE
+localjump_reason(exc)
+ VALUE exc;
+{
+ return rb_iv_get(exc, "@reason");
+}
+
+NORETURN(static void jump_tag_but_local_jump _((int,VALUE)));
+static void
+jump_tag_but_local_jump(state, val)
+ int state;
+ VALUE val;
+{
+ if (val == Qundef) val = prot_tag->retval;
switch (state) {
case 0:
break;
case TAG_RETURN:
- Raise(eLocalJumpError, "unexpected return");
- break;
- case TAG_NEXT:
- Raise(eLocalJumpError, "unexpected next");
+ localjump_error("unexpected return", val, state);
break;
case TAG_BREAK:
- Raise(eLocalJumpError, "unexpected break");
+ localjump_error("unexpected break", val, state);
+ break;
+ case TAG_NEXT:
+ localjump_error("unexpected next", val, state);
break;
case TAG_REDO:
- Raise(eLocalJumpError, "unexpected redo");
+ localjump_error("unexpected redo", Qnil, state);
break;
case TAG_RETRY:
- Raise(eLocalJumpError, "retry outside of rescue clause");
+ localjump_error("retry outside of rescue clause", Qnil, state);
break;
default:
- JUMP_TAG(state);
break;
}
- return val;
+ JUMP_TAG(state);
}
VALUE
-rb_trap_eval(cmd, sig)
- VALUE cmd;
- int sig;
+rb_eval_cmd(cmd, arg, level)
+ VALUE cmd, arg;
+ int level;
{
int state;
- VALUE val; /* OK */
+ VALUE val = Qnil; /* OK */
+ struct SCOPE *saved_scope;
+ volatile int safe = ruby_safe_level;
- PUSH_TAG(PROT_NONE);
- if ((state = EXEC_TAG()) == 0) {
- val = rb_eval_cmd(cmd, ary_new3(1, INT2FIX(sig)));
+ if (OBJ_TAINTED(cmd)) {
+ level = 4;
}
- POP_TAG();
- if (state) {
- trap_immediate = 0;
- JUMP_TAG(state);
+ if (TYPE(cmd) != T_STRING) {
+ PUSH_ITER(ITER_NOT);
+ PUSH_TAG(PROT_NONE);
+ ruby_safe_level = level;
+ if ((state = EXEC_TAG()) == 0) {
+ val = rb_funcall2(cmd, rb_intern("call"), RARRAY(arg)->len, RARRAY(arg)->ptr);
+ }
+ ruby_safe_level = safe;
+ POP_TAG();
+ POP_ITER();
+ if (state) JUMP_TAG(state);
+ return val;
}
- return val;
-}
-static VALUE
-superclass(self, node)
- VALUE self;
- NODE *node;
-{
- VALUE val; /* OK */
- int state;
+ saved_scope = ruby_scope;
+ ruby_scope = top_scope;
+ PUSH_FRAME();
+ ruby_frame->last_func = 0;
+ ruby_frame->orig_func = 0;
+ ruby_frame->last_class = 0;
+ ruby_frame->self = ruby_top_self;
+ PUSH_CREF(ruby_wrapper ? ruby_wrapper : rb_cObject);
+
+ ruby_safe_level = level;
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
- val = rb_eval(self, node);
+ val = eval(ruby_top_self, cmd, Qnil, 0, 0);
}
+ if (ruby_scope->flags & SCOPE_DONT_RECYCLE)
+ scope_dup(saved_scope);
+ ruby_scope = saved_scope;
+ ruby_safe_level = safe;
POP_TAG();
- if (state) {
- superclass_error:
- switch (nd_type(node)) {
- case NODE_COLON2:
- TypeError("undefined superclass `%s'", rb_id2name(node->nd_mid));
- case NODE_CVAR:
- TypeError("undefined superclass `%s'", rb_id2name(node->nd_vid));
- default:
- TypeError("superclass undefined");
- }
- JUMP_TAG(state);
- }
- if (TYPE(val) != T_CLASS) goto superclass_error;
- if (FL_TEST(val, FL_SINGLETON)) {
- TypeError("can't make subclass of virtual class");
- }
+ POP_FRAME();
+ jump_tag_but_local_jump(state, val);
return val;
}
+#define ruby_cbase (ruby_cref->nd_clss)
+
static VALUE
-ev_const_defined(cref, id)
+ev_const_defined(cref, id, self)
NODE *cref;
ID id;
+ VALUE self;
{
NODE *cbase = cref;
+ VALUE result;
- while (cbase && cbase->nd_clss != cObject) {
+ while (cbase && cbase->nd_next) {
struct RClass *klass = RCLASS(cbase->nd_clss);
- if (klass->iv_tbl &&
- st_lookup(klass->iv_tbl, id, 0)) {
- return TRUE;
+ if (NIL_P(klass)) return rb_const_defined(CLASS_OF(self), id);
+ if (klass->iv_tbl && st_lookup(klass->iv_tbl, id, &result)) {
+ if (result == Qundef && NIL_P(rb_autoload_p((VALUE)klass, id))) {
+ return Qfalse;
+ }
+ return Qtrue;
}
cbase = cbase->nd_next;
}
@@ -1178,18 +1749,23 @@ ev_const_defined(cref, id)
}
static VALUE
-ev_const_get(cref, id)
+ev_const_get(cref, id, self)
NODE *cref;
ID id;
+ VALUE self;
{
NODE *cbase = cref;
VALUE result;
- while (cbase && cbase->nd_clss != cObject) {
- struct RClass *klass = RCLASS(cbase->nd_clss);
+ while (cbase && cbase->nd_next) {
+ VALUE klass = cbase->nd_clss;
- if (klass->iv_tbl &&
- st_lookup(klass->iv_tbl, id, &result)) {
+ if (NIL_P(klass)) return rb_const_get(CLASS_OF(self), id);
+ while (RCLASS(klass)->iv_tbl && st_lookup(RCLASS(klass)->iv_tbl, id, &result)) {
+ if (result == Qundef) {
+ rb_autoload_load(klass, id);
+ continue;
+ }
return result;
}
cbase = cbase->nd_next;
@@ -1198,127 +1774,371 @@ ev_const_get(cref, id)
}
static VALUE
-mod_nesting()
+cvar_cbase()
+{
+ NODE *cref = ruby_cref;
+
+ while (cref && cref->nd_next && (NIL_P(cref->nd_clss) || FL_TEST(cref->nd_clss, FL_SINGLETON))) {
+ cref = cref->nd_next;
+ if (!cref->nd_next) {
+ rb_warn("class variable access from toplevel singleton method");
+ }
+ }
+ if (NIL_P(cref->nd_clss)) {
+ rb_raise(rb_eTypeError, "no class variables available");
+ }
+ return cref->nd_clss;
+}
+
+/*
+ * call-seq:
+ * Module.nesting => array
+ *
+ * Returns the list of +Modules+ nested at the point of call.
+ *
+ * module M1
+ * module M2
+ * $a = Module.nesting
+ * end
+ * end
+ * $a #=> [M1::M2, M1]
+ * $a[0].name #=> "M1::M2"
+ */
+
+static VALUE
+rb_mod_nesting()
{
- NODE *cbase = (NODE*)the_frame->cbase;
- VALUE ary = ary_new();
+ NODE *cbase = ruby_cref;
+ VALUE ary = rb_ary_new();
- while (cbase && cbase->nd_clss != cObject) {
- ary_push(ary, cbase->nd_clss);
+ while (cbase && cbase->nd_next) {
+ if (!NIL_P(cbase->nd_clss)) rb_ary_push(ary, cbase->nd_clss);
cbase = cbase->nd_next;
}
+ if (ruby_wrapper && RARRAY(ary)->len == 0) {
+ rb_ary_push(ary, ruby_wrapper);
+ }
return ary;
}
+/*
+ * call-seq:
+ * Module.constants => array
+ *
+ * Returns an array of the names of all constants defined in the
+ * system. This list includes the names of all modules and classes.
+ *
+ * p Module.constants.sort[1..5]
+ *
+ * <em>produces:</em>
+ *
+ * ["ARGV", "ArgumentError", "Array", "Bignum", "Binding"]
+ */
+
static VALUE
-mod_s_constants()
+rb_mod_s_constants()
{
- NODE *cbase = (NODE*)the_frame->cbase;
- VALUE ary = ary_new();
+ NODE *cbase = ruby_cref;
+ void *data = 0;
- while (cbase && cbase->nd_clss != cObject) {
- mod_const_at(cbase->nd_clss, ary);
+ while (cbase) {
+ if (!NIL_P(cbase->nd_clss)) {
+ data = rb_mod_const_at(cbase->nd_clss, data);
+ }
cbase = cbase->nd_next;
}
- mod_const_of(((NODE*)the_frame->cbase)->nd_clss, ary);
- return ary;
+ if (!NIL_P(ruby_cbase)) {
+ data = rb_mod_const_of(ruby_cbase, data);
+ }
+ return rb_const_list(data);
}
-static VALUE
-mod_remove_method(mod, name)
- VALUE mod, name;
+void
+rb_frozen_class_p(klass)
+ VALUE klass;
{
- remove_method(mod, rb_to_id(name));
- return mod;
+ char *desc = "something(?!)";
+
+ if (OBJ_FROZEN(klass)) {
+ if (FL_TEST(klass, FL_SINGLETON))
+ desc = "object";
+ else {
+ switch (TYPE(klass)) {
+ case T_MODULE:
+ case T_ICLASS:
+ desc = "module"; break;
+ case T_CLASS:
+ desc = "class"; break;
+ }
+ }
+ rb_error_frozen(desc);
+ }
}
+void
+rb_undef(klass, id)
+ VALUE klass;
+ ID id;
+{
+ VALUE origin;
+ NODE *body;
+
+ if (ruby_cbase == rb_cObject && klass == rb_cObject) {
+ rb_secure(4);
+ }
+ if (ruby_safe_level >= 4 && !OBJ_TAINTED(klass)) {
+ rb_raise(rb_eSecurityError, "Insecure: can't undef `%s'", rb_id2name(id));
+ }
+ rb_frozen_class_p(klass);
+ if (id == __id__ || id == __send__ || id == init) {
+ rb_warn("undefining `%s' may cause serious problem", rb_id2name(id));
+ }
+ body = search_method(klass, id, &origin);
+ if (!body || !body->nd_body) {
+ char *s0 = " class";
+ VALUE c = klass;
+
+ if (FL_TEST(c, FL_SINGLETON)) {
+ VALUE obj = rb_iv_get(klass, "__attached__");
+
+ switch (TYPE(obj)) {
+ case T_MODULE:
+ case T_CLASS:
+ c = obj;
+ s0 = "";
+ }
+ }
+ else if (TYPE(c) == T_MODULE) {
+ s0 = " module";
+ }
+ rb_name_error(id, "undefined method `%s' for%s `%s'",
+ rb_id2name(id),s0,rb_class2name(c));
+ }
+ rb_add_method(klass, id, 0, NOEX_PUBLIC);
+ if (FL_TEST(klass, FL_SINGLETON)) {
+ rb_funcall(rb_iv_get(klass, "__attached__"),
+ singleton_undefined, 1, ID2SYM(id));
+ }
+ else {
+ rb_funcall(klass, undefined, 1, ID2SYM(id));
+ }
+}
+
+/*
+ * call-seq:
+ * undef_method(symbol) => self
+ *
+ * Prevents the current class from responding to calls to the named
+ * method. Contrast this with <code>remove_method</code>, which deletes
+ * the method from the particular class; Ruby will still search
+ * superclasses and mixed-in modules for a possible receiver.
+ *
+ * class Parent
+ * def hello
+ * puts "In parent"
+ * end
+ * end
+ * class Child < Parent
+ * def hello
+ * puts "In child"
+ * end
+ * end
+ *
+ *
+ * c = Child.new
+ * c.hello
+ *
+ *
+ * class Child
+ * remove_method :hello # remove from child, still in parent
+ * end
+ * c.hello
+ *
+ *
+ * class Child
+ * undef_method :hello # prevent any calls to 'hello'
+ * end
+ * c.hello
+ *
+ * <em>produces:</em>
+ *
+ * In child
+ * In parent
+ * prog.rb:23: undefined method `hello' for #<Child:0x401b3bb4> (NoMethodError)
+ */
+
static VALUE
-mod_undef_method(mod, name)
- VALUE mod, name;
+rb_mod_undef_method(argc, argv, mod)
+ int argc;
+ VALUE *argv;
+ VALUE mod;
{
- ID id = rb_to_id(name);
+ int i;
- rb_add_method(mod, id, 0, NOEX_PUBLIC);
- rb_clear_cache_by_id(id);
+ for (i=0; i<argc; i++) {
+ rb_undef(mod, rb_to_id(argv[i]));
+ }
return mod;
}
+void
+rb_alias(klass, name, def)
+ VALUE klass;
+ ID name, def;
+{
+ VALUE origin;
+ NODE *orig, *body, *node;
+ VALUE singleton = 0;
+
+ rb_frozen_class_p(klass);
+ if (name == def) return;
+ if (klass == rb_cObject) {
+ rb_secure(4);
+ }
+ orig = search_method(klass, def, &origin);
+ if (!orig || !orig->nd_body) {
+ if (TYPE(klass) == T_MODULE) {
+ orig = search_method(rb_cObject, def, &origin);
+ }
+ }
+ if (!orig || !orig->nd_body) {
+ print_undef(klass, def);
+ }
+ if (FL_TEST(klass, FL_SINGLETON)) {
+ singleton = rb_iv_get(klass, "__attached__");
+ }
+ body = orig->nd_body;
+ orig->nd_cnt++;
+ if (nd_type(body) == NODE_FBODY) { /* was alias */
+ def = body->nd_mid;
+ origin = body->nd_orig;
+ body = body->nd_head;
+ }
+
+ rb_clear_cache_by_id(name);
+ if (RTEST(ruby_verbose) && st_lookup(RCLASS(klass)->m_tbl, name, (st_data_t *)&node)) {
+ if (node->nd_cnt == 0 && node->nd_body) {
+ rb_warning("discarding old %s", rb_id2name(name));
+ }
+ }
+ st_insert(RCLASS(klass)->m_tbl, name,
+ (st_data_t)NEW_METHOD(NEW_FBODY(body, def, origin), orig->nd_noex));
+ if (singleton) {
+ rb_funcall(singleton, singleton_added, 1, ID2SYM(name));
+ }
+ else {
+ rb_funcall(klass, added, 1, ID2SYM(name));
+ }
+}
+
+/*
+ * call-seq:
+ * alias_method(new_name, old_name) => self
+ *
+ * Makes <i>new_name</i> a new copy of the method <i>old_name</i>. This can
+ * be used to retain access to methods that are overridden.
+ *
+ * module Mod
+ * alias_method :orig_exit, :exit
+ * def exit(code=0)
+ * puts "Exiting with code #{code}"
+ * orig_exit(code)
+ * end
+ * end
+ * include Mod
+ * exit(99)
+ *
+ * <em>produces:</em>
+ *
+ * Exiting with code 99
+ */
+
static VALUE
-mod_alias_method(mod, newname, oldname)
+rb_mod_alias_method(mod, newname, oldname)
VALUE mod, newname, oldname;
{
- ID id = rb_to_id(newname);
-
- rb_alias(mod, id, rb_to_id(oldname));
- rb_clear_cache_by_id(id);
+ rb_alias(mod, rb_to_id(newname), rb_to_id(oldname));
return mod;
}
-#if defined(C_ALLOCA) && defined(THREAD)
-# define TMP_PROTECT NODE *__protect_tmp=0
-# define TMP_ALLOC(type,n) \
- (__protect_tmp = node_newnode(NODE_ALLOCA, \
- str_new(0,sizeof(type)*(n)),0,__protect_tmp), \
- (void*)RSTRING(__protect_tmp->nd_head)->ptr)
+static NODE*
+copy_node_scope(node, rval)
+ NODE *node;
+ NODE *rval;
+{
+ NODE *copy = NEW_NODE(NODE_SCOPE,0,rval,node->nd_next);
+
+ if (node->nd_tbl) {
+ copy->nd_tbl = ALLOC_N(ID, node->nd_tbl[0]+1);
+ MEMCPY(copy->nd_tbl, node->nd_tbl, ID, node->nd_tbl[0]+1);
+ }
+ else {
+ copy->nd_tbl = 0;
+ }
+ return copy;
+}
+
+#ifdef C_ALLOCA
+# define TMP_PROTECT NODE * volatile tmp__protect_tmp=0
+# define TMP_ALLOC(n) \
+ (tmp__protect_tmp = rb_node_newnode(NODE_ALLOCA, \
+ ALLOC_N(VALUE,n),tmp__protect_tmp,n), \
+ (void*)tmp__protect_tmp->nd_head)
#else
# define TMP_PROTECT typedef int foobazzz
-# define TMP_ALLOC(type,n) ALLOCA_N(type,n)
+# define TMP_ALLOC(n) ALLOCA_N(VALUE,n)
#endif
-#define SETUP_ARGS(anode) {\
+#define SETUP_ARGS0(anode,alen) do {\
NODE *n = anode;\
if (!n) {\
argc = 0;\
argv = 0;\
}\
else if (nd_type(n) == NODE_ARRAY) {\
- argc=n->nd_alen;\
- if (argc > 0) {\
- char *file = sourcefile;\
- int line = sourceline;\
- int i;\
+ argc=alen;\
+ if (argc > 0) {\
+ int i;\
n = anode;\
- argv = TMP_ALLOC(VALUE,argc);\
+ argv = TMP_ALLOC(argc);\
for (i=0;i<argc;i++) {\
argv[i] = rb_eval(self,n->nd_head);\
n=n->nd_next;\
}\
- sourcefile = file;\
- sourceline = line;\
- }\
- else {\
+ }\
+ else {\
argc = 0;\
argv = 0;\
- }\
+ }\
}\
else {\
- VALUE args = rb_eval(self,n);\
- char *file = sourcefile;\
- int line = sourceline;\
+ VALUE args = rb_eval(self,n);\
if (TYPE(args) != T_ARRAY)\
- args = rb_Array(args);\
- argc = RARRAY(args)->len;\
+ args = rb_ary_to_ary(args);\
+ argc = RARRAY(args)->len;\
argv = ALLOCA_N(VALUE, argc);\
MEMCPY(argv, RARRAY(args)->ptr, VALUE, argc);\
- sourcefile = file;\
- sourceline = line;\
}\
-}
+} while (0)
-#define BEGIN_CALLARGS {\
- struct BLOCK *tmp_block = the_block;\
- if (the_iter->iter == ITER_PRE) {\
- the_block = the_block->prev;\
+#define SETUP_ARGS(anode) SETUP_ARGS0(anode, anode->nd_alen)
+
+#define BEGIN_CALLARGS do {\
+ struct BLOCK *tmp_block = ruby_block;\
+ int tmp_iter = ruby_iter->iter;\
+ if (tmp_iter == ITER_PRE) {\
+ ruby_block = ruby_block->outer;\
+ tmp_iter = ITER_NOT;\
}\
- PUSH_ITER(ITER_NOT);
+ PUSH_ITER(tmp_iter)
#define END_CALLARGS \
- the_block = tmp_block;\
+ ruby_block = tmp_block;\
POP_ITER();\
-}
+} while (0)
-#define MATCH_DATA the_scope->local_vars[node->nd_cnt]
+#define MATCH_DATA *rb_svar(node->nd_cnt)
static char* is_defined _((VALUE, NODE*, char*));
@@ -1335,20 +2155,20 @@ arg_defined(self, node, buf, type)
if (!node) return type; /* no args */
if (nd_type(node) == NODE_ARRAY) {
argc=node->nd_alen;
- if (argc > 0) {
+ if (argc > 0) {
for (i=0;i<argc;i++) {
if (!is_defined(self, node->nd_head, buf))
return 0;
node = node->nd_next;
}
- }
+ }
}
else if (!is_defined(self, node, buf)) {
return 0;
}
return type;
}
-
+
static char*
is_defined(self, node, buf)
VALUE self;
@@ -1358,12 +2178,15 @@ is_defined(self, node, buf)
VALUE val; /* OK */
int state;
+ again:
+ if (!node) return "expression";
switch (nd_type(node)) {
case NODE_SUPER:
case NODE_ZSUPER:
- if (the_frame->last_func == 0) return 0;
- else if (rb_method_boundp(RCLASS(the_frame->last_class)->super,
- the_frame->last_func, 1)) {
+ if (ruby_frame->orig_func == 0) return 0;
+ else if (ruby_frame->last_class == 0) return 0;
+ val = ruby_frame->last_class;
+ if (rb_method_boundp(RCLASS(val)->super, ruby_frame->orig_func, 0)) {
if (nd_type(node) == NODE_SUPER) {
return arg_defined(self, node->nd_args, buf, "super");
}
@@ -1373,23 +2196,44 @@ is_defined(self, node, buf)
case NODE_VCALL:
case NODE_FCALL:
- val = CLASS_OF(self);
+ val = self;
goto check_bound;
+ case NODE_ATTRASGN:
+ val = self;
+ if (node->nd_recv == (NODE *)1) goto check_bound;
case NODE_CALL:
- if (!is_defined(self, node->nd_recv, buf)) return 0;
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
val = rb_eval(self, node->nd_recv);
- val = CLASS_OF(val);
}
POP_TAG();
if (state) {
+ ruby_errinfo = Qnil;
return 0;
}
check_bound:
- if (rb_method_boundp(val, node->nd_mid, nd_type(node)== NODE_CALL)) {
- return arg_defined(self, node->nd_args, buf, "method");
+ {
+ int call = nd_type(node)==NODE_CALL;
+
+ val = CLASS_OF(val);
+ if (call) {
+ int noex;
+ ID id = node->nd_mid;
+
+ if (!rb_get_method_body(&val, &id, &noex))
+ break;
+ if ((noex & NOEX_PRIVATE))
+ break;
+ if ((noex & NOEX_PROTECTED) &&
+ !rb_obj_is_kind_of(self, rb_class_real(val)))
+ break;
+ }
+ else if (!rb_method_boundp(val, node->nd_mid, call))
+ break;
+ return arg_defined(self, node->nd_args, buf,
+ nd_type(node) == NODE_ATTRASGN ?
+ "assignment" : "method");
}
break;
@@ -1398,7 +2242,7 @@ is_defined(self, node, buf)
return "method";
case NODE_YIELD:
- if (iterator_p()) {
+ if (rb_block_given_p()) {
return "yield";
}
break;
@@ -1421,10 +2265,11 @@ is_defined(self, node, buf)
case NODE_MASGN:
case NODE_LASGN:
case NODE_DASGN:
- case NODE_DASGN_PUSH:
+ case NODE_DASGN_CURR:
case NODE_GASGN:
- case NODE_IASGN:
- case NODE_CASGN:
+ case NODE_CDECL:
+ case NODE_CVDECL:
+ case NODE_CVASGN:
return "assignment";
case NODE_LVAR:
@@ -1444,12 +2289,18 @@ is_defined(self, node, buf)
}
break;
- case NODE_CVAR:
- if (ev_const_defined((NODE*)the_frame->cbase, node->nd_vid)) {
+ case NODE_CONST:
+ if (ev_const_defined(ruby_cref, node->nd_vid, self)) {
return "constant";
}
break;
+ case NODE_CVAR:
+ if (rb_cvar_defined(cvar_cbase(), node->nd_vid)) {
+ return "class variable";
+ }
+ break;
+
case NODE_COLON2:
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
@@ -1457,32 +2308,48 @@ is_defined(self, node, buf)
}
POP_TAG();
if (state) {
+ ruby_errinfo = Qnil;
return 0;
}
else {
switch (TYPE(val)) {
case T_CLASS:
case T_MODULE:
- if (rb_const_defined_at(val, node->nd_mid))
+ if (rb_const_defined_from(val, node->nd_mid))
return "constant";
+ break;
+ default:
+ if (rb_method_boundp(CLASS_OF(val), node->nd_mid, 1)) {
+ return "method";
+ }
}
}
break;
+ case NODE_COLON3:
+ if (rb_const_defined_from(rb_cObject, node->nd_mid)) {
+ return "constant";
+ }
+ break;
+
case NODE_NTH_REF:
- if (reg_nth_defined(node->nd_nth, MATCH_DATA)) {
- sprintf(buf, "$%d", node->nd_nth);
+ if (RTEST(rb_reg_nth_defined(node->nd_nth, MATCH_DATA))) {
+ sprintf(buf, "$%d", (int)node->nd_nth);
return buf;
}
break;
case NODE_BACK_REF:
- if (reg_nth_defined(0, MATCH_DATA)) {
- sprintf(buf, "$%c", node->nd_nth);
+ if (RTEST(rb_reg_nth_defined(0, MATCH_DATA))) {
+ sprintf(buf, "$%c", (char)node->nd_nth);
return buf;
}
break;
+ case NODE_NEWLINE:
+ node = node->nd_next;
+ goto again;
+
default:
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
@@ -1492,6 +2359,7 @@ is_defined(self, node, buf)
if (!state) {
return "expression";
}
+ ruby_errinfo = Qnil;
break;
}
return 0;
@@ -1502,24 +2370,58 @@ static int handle_rescue _((VALUE,NODE*));
static void blk_free();
static VALUE
-obj_is_block(block)
- VALUE block;
-{
- if (TYPE(block) == T_DATA && RDATA(block)->dfree == blk_free) {
- return TRUE;
- }
- return FALSE;
-}
-
-static VALUE
-obj_is_proc(proc)
+rb_obj_is_proc(proc)
VALUE proc;
{
- if (obj_is_block(proc) && obj_is_kind_of(proc, cProc)) {
- return TRUE;
- }
- return FALSE;
-}
+ if (TYPE(proc) == T_DATA && RDATA(proc)->dfree == (RUBY_DATA_FUNC)blk_free) {
+ return Qtrue;
+ }
+ return Qfalse;
+}
+
+/*
+ * call-seq:
+ * set_trace_func(proc) => proc
+ * set_trace_func(nil) => nil
+ *
+ * Establishes _proc_ as the handler for tracing, or disables
+ * tracing if the parameter is +nil+. _proc_ takes up
+ * to six parameters: an event name, a filename, a line number, an
+ * object id, a binding, and the name of a class. _proc_ is
+ * invoked whenever an event occurs. Events are: <code>c-call</code>
+ * (call a C-language routine), <code>c-return</code> (return from a
+ * C-language routine), <code>call</code> (call a Ruby method),
+ * <code>class</code> (start a class or module definition),
+ * <code>end</code> (finish a class or module definition),
+ * <code>line</code> (execute code on a new line), <code>raise</code>
+ * (raise an exception), and <code>return</code> (return from a Ruby
+ * method). Tracing is disabled within the context of _proc_.
+ *
+ * class Test
+ * def test
+ * a = 1
+ * b = 2
+ * end
+ * end
+ *
+ * set_trace_func proc { |event, file, line, id, binding, classname|
+ * printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname
+ * }
+ * t = Test.new
+ * t.test
+ *
+ * line prog.rb:11 false
+ * c-call prog.rb:11 new Class
+ * c-call prog.rb:11 initialize Object
+ * c-return prog.rb:11 initialize Object
+ * c-return prog.rb:11 new Class
+ * line prog.rb:12 false
+ * call prog.rb:2 test Test
+ * line prog.rb:3 test Test
+ * line prog.rb:4 test Test
+ * return prog.rb:4 test Test
+ */
+
static VALUE
set_trace_func(obj, trace)
@@ -1529,91 +2431,262 @@ set_trace_func(obj, trace)
trace_func = 0;
return Qnil;
}
- if (!obj_is_proc(trace)) {
- TypeError("trace_func needs to be Proc");
+ if (!rb_obj_is_proc(trace)) {
+ rb_raise(rb_eTypeError, "trace_func needs to be Proc");
}
return trace_func = trace;
}
static void
-call_trace_func(event, file, line, self, id)
+call_trace_func(event, node, self, id, klass)
char *event;
- char *file;
- int line;
+ NODE *node;
VALUE self;
ID id;
+ VALUE klass; /* OK */
{
- int state;
- volatile VALUE trace;
+ int state, raised;
struct FRAME *prev;
- char *file_save = sourcefile;
- int line_save = sourceline;
+ NODE *node_save;
+ VALUE srcfile;
if (!trace_func) return;
+ if (tracing) return;
+ if (ruby_in_compile) return;
+ if (id == ID_ALLOCATOR) return;
- trace = trace_func;
- trace_func = 0;
-#ifdef THREAD
- thread_critical++;
-#endif
-
- prev = the_frame;
+ if (!(node_save = ruby_current_node)) {
+ node_save = NEW_NEWLINE(0);
+ }
+ tracing = 1;
+ prev = ruby_frame;
PUSH_FRAME();
- *the_frame = *_frame.prev;
- the_frame->prev = prev;
+ *ruby_frame = *prev;
+ ruby_frame->prev = prev;
+ ruby_frame->iter = 0; /* blocks not available anyway */
- the_frame->line = sourceline = line;
- the_frame->file = sourcefile = file;
+ if (node) {
+ ruby_current_node = node;
+ ruby_frame->node = node;
+ ruby_sourcefile = node->nd_file;
+ ruby_sourceline = nd_line(node);
+ }
+ if (klass) {
+ if (TYPE(klass) == T_ICLASS) {
+ klass = RBASIC(klass)->klass;
+ }
+ else if (FL_TEST(klass, FL_SINGLETON)) {
+ klass = self;
+ }
+ }
PUSH_TAG(PROT_NONE);
+ raised = thread_reset_raised();
if ((state = EXEC_TAG()) == 0) {
- proc_call(trace, ary_new3(5, str_new2(event),
- str_new2(sourcefile),
- INT2FIX(sourceline),
- INT2FIX(id),
- self?f_binding(self):Qnil));
- }
+ srcfile = rb_str_new2(ruby_sourcefile?ruby_sourcefile:"(ruby)");
+ proc_invoke(trace_func, rb_ary_new3(6, rb_str_new2(event),
+ srcfile,
+ INT2FIX(ruby_sourceline),
+ id?ID2SYM(id):Qnil,
+ self?rb_f_binding(self):Qnil,
+ klass),
+ Qundef, 0);
+ }
+ if (raised) thread_set_raised();
POP_TAG();
POP_FRAME();
-#ifdef THREAD
- thread_critical--;
-#endif
- if (!trace_func) trace_func = trace;
- sourceline = line_save;
- sourcefile = file_save;
+ tracing = 0;
+ ruby_current_node = node_save;
+ SET_CURRENT_SOURCE();
if (state) JUMP_TAG(state);
}
-static void return_check _((void));
-#define return_value(v) prot_tag->retval = (v)
+static VALUE
+avalue_to_svalue(v)
+ VALUE v;
+{
+ VALUE tmp, top;
+
+ tmp = rb_check_array_type(v);
+ if (NIL_P(tmp)) {
+ return v;
+ }
+ if (RARRAY(tmp)->len == 0) {
+ return Qundef;
+ }
+ if (RARRAY(tmp)->len == 1) {
+ top = rb_check_array_type(RARRAY(tmp)->ptr[0]);
+ if (NIL_P(top)) {
+ return RARRAY(tmp)->ptr[0];
+ }
+ if (RARRAY(top)->len > 1) {
+ return v;
+ }
+ return top;
+ }
+ return tmp;
+}
+
+static VALUE
+svalue_to_avalue(v)
+ VALUE v;
+{
+ VALUE tmp, top;
+
+ if (v == Qundef) return rb_ary_new2(0);
+ tmp = rb_check_array_type(v);
+ if (NIL_P(tmp)) {
+ return rb_ary_new3(1, v);
+ }
+ if (RARRAY(tmp)->len == 1) {
+ top = rb_check_array_type(RARRAY(tmp)->ptr[0]);
+ if (!NIL_P(top) && RARRAY(top)->len > 1) {
+ return v;
+ }
+ return rb_ary_new3(1, v);
+ }
+ return tmp;
+}
+
+static VALUE
+svalue_to_mrhs(v, lhs)
+ VALUE v;
+ NODE *lhs;
+{
+ VALUE tmp;
+
+ if (v == Qundef) return rb_ary_new2(0);
+ tmp = rb_check_array_type(v);
+ if (NIL_P(tmp)) {
+ return rb_ary_new3(1, v);
+ }
+ /* no lhs means splat lhs only */
+ if (!lhs) {
+ return rb_ary_new3(1, v);
+ }
+ return tmp;
+}
+
+static VALUE
+avalue_splat(v)
+ VALUE v;
+{
+ if (RARRAY(v)->len == 0) {
+ return Qundef;
+ }
+ if (RARRAY(v)->len == 1) {
+ return RARRAY(v)->ptr[0];
+ }
+ return v;
+}
+
+#if 1
+VALUE
+rb_Array(val)
+ VALUE val;
+{
+ VALUE tmp = rb_check_array_type(val);
+
+ if (NIL_P(tmp)) {
+ /* hack to avoid invoke Object#to_a */
+ VALUE origin;
+ ID id = rb_intern("to_a");
+
+ if (search_method(CLASS_OF(val), id, &origin) &&
+ RCLASS(origin)->m_tbl != RCLASS(rb_mKernel)->m_tbl) { /* exclude Kernel#to_a */
+ val = rb_funcall(val, id, 0);
+ if (TYPE(val) != T_ARRAY) {
+ rb_raise(rb_eTypeError, "`to_a' did not return Array");
+ }
+ return val;
+ }
+ else {
+ return rb_ary_new3(1, val);
+ }
+ }
+ return tmp;
+}
+#endif
+
+static VALUE
+splat_value(v)
+ VALUE v;
+{
+ if (NIL_P(v)) return rb_ary_new3(1, Qnil);
+ return rb_Array(v);
+}
+
+static VALUE
+class_prefix(self, cpath)
+ VALUE self;
+ NODE *cpath;
+{
+ if (!cpath) {
+ rb_bug("class path missing");
+ }
+ if (cpath->nd_head) {
+ VALUE c = rb_eval(self, cpath->nd_head);
+ switch (TYPE(c)) {
+ case T_CLASS:
+ case T_MODULE:
+ break;
+ default:
+ rb_raise(rb_eTypeError, "%s is not a class/module",
+ RSTRING(rb_obj_as_string(c))->ptr);
+ }
+ return c;
+ }
+ else if (nd_type(cpath) == NODE_COLON2) {
+ return ruby_cbase;
+ }
+ else if (ruby_wrapper) {
+ return ruby_wrapper;
+ }
+ else {
+ return rb_cObject;
+ }
+}
+
+#define return_value(v) do {\
+ if ((prot_tag->retval = (v)) == Qundef) {\
+ prot_tag->retval = Qnil;\
+ }\
+} while (0)
+
+NORETURN(static void return_jump _((VALUE)));
+NORETURN(static void break_jump _((VALUE)));
static VALUE
-rb_eval(self, node)
+rb_eval(self, n)
VALUE self;
- NODE * volatile node;
+ NODE *n;
{
+ NODE * volatile contnode = 0;
+ NODE * volatile node = n;
int state;
volatile VALUE result = Qnil;
-#define RETURN(v) { result = (v); goto finish; }
+#define RETURN(v) do { \
+ result = (v); \
+ goto finish; \
+} while (0)
again:
if (!node) RETURN(Qnil);
+ ruby_current_node = node;
switch (nd_type(node)) {
- case NODE_BLOCK:
- if (!node->nd_next) {
- node = node->nd_head;
- goto again;
- }
- while (node) {
- result = rb_eval(self, node->nd_head);
- node = node->nd_next;
+ case NODE_BLOCK:
+ if (contnode) {
+ result = rb_eval(self, node);
+ break;
}
- break;
+ contnode = node->nd_next;
+ node = node->nd_head;
+ goto again;
case NODE_POSTEXE:
- f_END();
+ rb_f_END();
nd_set_type(node, NODE_NIL); /* exec just once */
result = Qnil;
break;
@@ -1625,34 +2698,57 @@ rb_eval(self, node)
/* nodes for speed-up(default match) */
case NODE_MATCH:
- result = reg_match2(node->nd_head->nd_lit);
+ result = rb_reg_match2(node->nd_lit);
break;
/* nodes for speed-up(literal match) */
case NODE_MATCH2:
- result = reg_match(rb_eval(self,node->nd_recv),
- rb_eval(self,node->nd_value));
+ {
+ VALUE l = rb_eval(self,node->nd_recv);
+ VALUE r = rb_eval(self,node->nd_value);
+ result = rb_reg_match(l, r);
+ }
break;
/* nodes for speed-up(literal match) */
case NODE_MATCH3:
- {
+ {
VALUE r = rb_eval(self,node->nd_recv);
VALUE l = rb_eval(self,node->nd_value);
- if (TYPE(r) == T_STRING) {
- result = reg_match(l, r);
+ if (TYPE(l) == T_STRING) {
+ result = rb_reg_match(r, l);
}
else {
- result = rb_funcall(r, match, 1, l);
+ result = rb_funcall(l, match, 1, r);
}
}
break;
- /* nodes for speed-up(top-level loop for -n/-p) */
+ /* node for speed-up(top-level loop for -n/-p) */
case NODE_OPT_N:
- while (!NIL_P(f_gets())) {
- rb_eval(self, node->nd_body);
+ PUSH_TAG(PROT_LOOP);
+ switch (state = EXEC_TAG()) {
+ case 0:
+ opt_n_next:
+ while (!NIL_P(rb_gets())) {
+ opt_n_redo:
+ rb_eval(self, node->nd_body);
+ }
+ break;
+
+ case TAG_REDO:
+ state = 0;
+ goto opt_n_redo;
+ case TAG_NEXT:
+ state = 0;
+ goto opt_n_next;
+ case TAG_BREAK:
+ state = 0;
+ default:
+ break;
}
+ POP_TAG();
+ if (state) JUMP_TAG(state);
RETURN(Qnil);
case NODE_SELF:
@@ -1662,13 +2758,17 @@ rb_eval(self, node)
RETURN(Qnil);
case NODE_TRUE:
- RETURN(TRUE);
+ RETURN(Qtrue);
case NODE_FALSE:
- RETURN(FALSE);
+ RETURN(Qfalse);
case NODE_IF:
- sourceline = nd_line(node);
+ if (trace_func) {
+ call_trace_func("line", node, self,
+ ruby_frame->last_func,
+ ruby_frame->last_class);
+ }
if (RTEST(rb_eval(self, node->nd_cond))) {
node = node->nd_body;
}
@@ -1677,6 +2777,42 @@ rb_eval(self, node)
}
goto again;
+ case NODE_WHEN:
+ while (node) {
+ NODE *tag;
+
+ if (nd_type(node) != NODE_WHEN) goto again;
+ tag = node->nd_head;
+ while (tag) {
+ if (trace_func) {
+ call_trace_func("line", tag, self,
+ ruby_frame->last_func,
+ ruby_frame->last_class);
+ }
+ if (tag->nd_head && nd_type(tag->nd_head) == NODE_WHEN) {
+ VALUE v = rb_eval(self, tag->nd_head->nd_head);
+ long i;
+
+ if (TYPE(v) != T_ARRAY) v = rb_ary_to_ary(v);
+ for (i=0; i<RARRAY(v)->len; i++) {
+ if (RTEST(RARRAY(v)->ptr[i])) {
+ node = node->nd_body;
+ goto again;
+ }
+ }
+ tag = tag->nd_next;
+ continue;
+ }
+ if (RTEST(rb_eval(self, tag->nd_head))) {
+ node = node->nd_body;
+ goto again;
+ }
+ tag = tag->nd_next;
+ }
+ node = node->nd_next;
+ }
+ RETURN(Qnil);
+
case NODE_CASE:
{
VALUE val;
@@ -1692,11 +2828,25 @@ rb_eval(self, node)
tag = node->nd_head;
while (tag) {
if (trace_func) {
- call_trace_func("line", tag->nd_file, nd_line(tag),
- self, the_frame->last_func);
+ call_trace_func("line", tag, self,
+ ruby_frame->last_func,
+ ruby_frame->last_class);
+ }
+ if (tag->nd_head && nd_type(tag->nd_head) == NODE_WHEN) {
+ VALUE v = rb_eval(self, tag->nd_head->nd_head);
+ long i;
+
+ if (TYPE(v) != T_ARRAY) v = rb_ary_to_ary(v);
+ for (i=0; i<RARRAY(v)->len; i++) {
+ if (RTEST(rb_funcall2(RARRAY(v)->ptr[i], eqq, 1, &val))){
+ node = node->nd_body;
+ goto again;
+ }
+ }
+ tag = tag->nd_next;
+ continue;
}
- sourceline = nd_line(tag);
- if (RTEST(rb_funcall2(rb_eval(self, tag->nd_head),eqq,1,&val))){
+ if (RTEST(rb_funcall2(rb_eval(self, tag->nd_head), eqq, 1, &val))) {
node = node->nd_body;
goto again;
}
@@ -1708,10 +2858,10 @@ rb_eval(self, node)
RETURN(Qnil);
case NODE_WHILE:
- PUSH_TAG(PROT_NONE);
+ PUSH_TAG(PROT_LOOP);
+ result = Qnil;
switch (state = EXEC_TAG()) {
case 0:
- sourceline = nd_line(node);
if (node->nd_state && !RTEST(rb_eval(self, node->nd_cond)))
goto while_out;
do {
@@ -1729,19 +2879,22 @@ rb_eval(self, node)
state = 0;
goto while_next;
case TAG_BREAK:
- state = 0;
+ if (TAG_DST()) {
+ state = 0;
+ result = prot_tag->retval;
+ }
+ /* fall through */
default:
break;
}
while_out:
POP_TAG();
- if (state) {
- JUMP_TAG(state);
- }
- RETURN(Qnil);
+ if (state) JUMP_TAG(state);
+ RETURN(result);
case NODE_UNTIL:
- PUSH_TAG(PROT_NONE);
+ PUSH_TAG(PROT_LOOP);
+ result = Qnil;
switch (state = EXEC_TAG()) {
case 0:
if (node->nd_state && RTEST(rb_eval(self, node->nd_cond)))
@@ -1761,16 +2914,18 @@ rb_eval(self, node)
state = 0;
goto until_next;
case TAG_BREAK:
- state = 0;
+ if (TAG_DST()) {
+ state = 0;
+ result = prot_tag->retval;
+ }
+ /* fall through */
default:
break;
}
until_out:
POP_TAG();
- if (state) {
- JUMP_TAG(state);
- }
- RETURN(Qnil);
+ if (state) JUMP_TAG(state);
+ RETURN(result);
case NODE_BLOCK_PASS:
result = block_pass(self, node);
@@ -1779,51 +2934,42 @@ rb_eval(self, node)
case NODE_ITER:
case NODE_FOR:
{
- iter_retry:
+ PUSH_TAG(PROT_LOOP);
PUSH_BLOCK(node->nd_var, node->nd_body);
- PUSH_TAG(PROT_FUNC);
state = EXEC_TAG();
if (state == 0) {
+ iter_retry:
+ PUSH_ITER(ITER_PRE);
if (nd_type(node) == NODE_ITER) {
- PUSH_ITER(ITER_PRE);
result = rb_eval(self, node->nd_iter);
- POP_ITER();
}
else {
VALUE recv;
- char *file = sourcefile;
- int line = sourceline;
+ _block.flags &= ~BLOCK_D_SCOPE;
+ BEGIN_CALLARGS;
recv = rb_eval(self, node->nd_iter);
- PUSH_ITER(ITER_PRE);
- sourcefile = file;
- sourceline = line;
+ END_CALLARGS;
+ ruby_current_node = node;
+ SET_CURRENT_SOURCE();
result = rb_call(CLASS_OF(recv),recv,each,0,0,0);
- POP_ITER();
}
+ POP_ITER();
}
- else if (_block.tag->dst == state) {
- state &= TAG_MASK;
- if (state == TAG_RETURN) {
- result = prot_tag->retval;
- }
+ else if (state == TAG_BREAK && TAG_DST()) {
+ result = prot_tag->retval;
+ state = 0;
+ }
+ else if (state == TAG_RETRY) {
+ state = 0;
+ goto iter_retry;
}
- POP_TAG();
POP_BLOCK();
+ POP_TAG();
switch (state) {
case 0:
break;
-
- case TAG_RETRY:
- goto iter_retry;
-
- case TAG_BREAK:
- result = Qnil;
- break;
- case TAG_RETURN:
- return_value(result);
- /* fall through */
default:
JUMP_TAG(state);
}
@@ -1831,63 +2977,103 @@ rb_eval(self, node)
break;
case NODE_BREAK:
- JUMP_TAG(TAG_BREAK);
+ break_jump(rb_eval(self, node->nd_stts));
break;
case NODE_NEXT:
+ CHECK_INTS;
+ return_value(rb_eval(self, node->nd_stts));
JUMP_TAG(TAG_NEXT);
break;
case NODE_REDO:
+ CHECK_INTS;
JUMP_TAG(TAG_REDO);
break;
case NODE_RETRY:
+ CHECK_INTS;
JUMP_TAG(TAG_RETRY);
break;
+ case NODE_SPLAT:
+ result = splat_value(rb_eval(self, node->nd_head));
+ break;
+
+ case NODE_TO_ARY:
+ result = rb_ary_to_ary(rb_eval(self, node->nd_head));
+ break;
+
+ case NODE_SVALUE:
+ result = avalue_splat(rb_eval(self, node->nd_head));
+ if (result == Qundef) result = Qnil;
+ break;
+
case NODE_YIELD:
- result = rb_yield_0(rb_eval(self, node->nd_stts), 0);
+ if (node->nd_head) {
+ result = rb_eval(self, node->nd_head);
+ ruby_current_node = node;
+ }
+ else {
+ result = Qundef; /* no arg */
+ }
+ SET_CURRENT_SOURCE();
+ result = rb_yield_0(result, 0, 0, 0, node->nd_state);
break;
case NODE_RESCUE:
- retry_entry:
- {
- volatile VALUE e_info = errinfo;
+ {
+ volatile VALUE e_info = ruby_errinfo;
+ volatile int rescuing = 0;
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
+ retry_entry:
result = rb_eval(self, node->nd_head);
}
- POP_TAG();
- if (state == TAG_RAISE) {
- NODE * volatile resq = node->nd_resq;
+ else if (rescuing) {
+ if (rescuing < 0) {
+ /* in rescue argument, just reraise */
+ }
+ else if (state == TAG_RETRY) {
+ rescuing = state = 0;
+ ruby_errinfo = e_info;
+ goto retry_entry;
+ }
+ else if (state != TAG_RAISE) {
+ result = prot_tag->retval;
+ }
+ }
+ else if (state == TAG_RAISE) {
+ NODE *resq = node->nd_resq;
+ rescuing = -1;
while (resq) {
+ ruby_current_node = resq;
if (handle_rescue(self, resq)) {
state = 0;
- PUSH_TAG(PROT_NONE);
- if ((state = EXEC_TAG()) == 0) {
- result = rb_eval(self, resq->nd_body);
- }
- POP_TAG();
- if (state == 0) {
- errinfo = e_info;
- }
- else if (state == TAG_RETRY) {
- state = 0;
- goto retry_entry;
- }
+ rescuing = 1;
+ result = rb_eval(self, resq->nd_body);
break;
}
resq = resq->nd_head; /* next rescue */
}
}
+ else {
+ result = prot_tag->retval;
+ }
+ POP_TAG();
+ if (state != TAG_RAISE) ruby_errinfo = e_info;
if (state) {
+ if (state == TAG_NEXT) prot_tag->retval = result;
JUMP_TAG(state);
}
+ /* no exception raised */
+ if (!rescuing && (node = node->nd_else)) { /* else clause given */
+ goto again;
+ }
}
- break;
+ break;
case NODE_ENSURE:
PUSH_TAG(PROT_NONE);
@@ -1897,13 +3083,13 @@ rb_eval(self, node)
POP_TAG();
if (node->nd_ensr) {
VALUE retval = prot_tag->retval; /* save retval */
+ VALUE errinfo = ruby_errinfo;
rb_eval(self, node->nd_ensr);
return_value(retval);
+ ruby_errinfo = errinfo;
}
- if (state) {
- JUMP_TAG(state);
- }
+ if (state) JUMP_TAG(state);
break;
case NODE_AND:
@@ -1919,54 +3105,108 @@ rb_eval(self, node)
goto again;
case NODE_NOT:
- if (RTEST(rb_eval(self, node->nd_body))) result = FALSE;
- else result = TRUE;
+ if (RTEST(rb_eval(self, node->nd_body))) result = Qfalse;
+ else result = Qtrue;
break;
case NODE_DOT2:
case NODE_DOT3:
- RETURN(range_new(rb_eval(self, node->nd_beg), rb_eval(self, node->nd_end)));
+ result = rb_range_new(rb_eval(self, node->nd_beg),
+ rb_eval(self, node->nd_end),
+ nd_type(node) == NODE_DOT3);
+ if (node->nd_state) break;
+ if (nd_type(node->nd_beg) == NODE_LIT && FIXNUM_P(node->nd_beg->nd_lit) &&
+ nd_type(node->nd_end) == NODE_LIT && FIXNUM_P(node->nd_end->nd_lit))
+ {
+ nd_set_type(node, NODE_LIT);
+ node->nd_lit = result;
+ }
+ else {
+ node->nd_state = 1;
+ }
+ break;
case NODE_FLIP2: /* like AWK */
- if (node->nd_state == 0) {
- if (RTEST(rb_eval(self, node->nd_beg))) {
- node->nd_state = rb_eval(self, node->nd_end)?0:1;
- result = TRUE;
+ {
+ VALUE *flip = rb_svar(node->nd_cnt);
+ if (!flip) rb_bug("unexpected local variable");
+ if (!RTEST(*flip)) {
+ if (RTEST(rb_eval(self, node->nd_beg))) {
+ *flip = RTEST(rb_eval(self, node->nd_end))?Qfalse:Qtrue;
+ result = Qtrue;
+ }
+ else {
+ result = Qfalse;
+ }
}
else {
- result = FALSE;
- }
- }
- else {
- if (RTEST(rb_eval(self, node->nd_end))) {
- node->nd_state = 0;
+ if (RTEST(rb_eval(self, node->nd_end))) {
+ *flip = Qfalse;
+ }
+ result = Qtrue;
}
- result = TRUE;
}
break;
case NODE_FLIP3: /* like SED */
- if (node->nd_state == 0) {
- if (RTEST(rb_eval(self, node->nd_beg))) {
- node->nd_state = 1;
- result = TRUE;
+ {
+ VALUE *flip = rb_svar(node->nd_cnt);
+ if (!flip) rb_bug("unexpected local variable");
+ if (!RTEST(*flip)) {
+ result = RTEST(rb_eval(self, node->nd_beg)) ? Qtrue : Qfalse;
+ *flip = result;
}
- result = FALSE;
- }
- else {
- if (RTEST(rb_eval(self, node->nd_end))) {
- node->nd_state = 0;
+ else {
+ if (RTEST(rb_eval(self, node->nd_end))) {
+ *flip = Qfalse;
+ }
+ result = Qtrue;
}
- result = TRUE;
}
break;
case NODE_RETURN:
- if (node->nd_stts) {
- return_value(rb_eval(self, node->nd_stts));
+ return_jump(rb_eval(self, node->nd_stts));
+ break;
+
+ case NODE_ARGSCAT:
+ {
+ VALUE args = rb_eval(self, node->nd_head);
+ result = rb_ary_concat(args, splat_value(rb_eval(self, node->nd_body)));
+ }
+ break;
+
+ case NODE_ARGSPUSH:
+ {
+ VALUE args = rb_ary_dup(rb_eval(self, node->nd_head));
+ result = rb_ary_push(args, rb_eval(self, node->nd_body));
+ }
+ break;
+
+ case NODE_ATTRASGN:
+ {
+ VALUE recv;
+ int argc; VALUE *argv; /* used in SETUP_ARGS */
+ int scope;
+ TMP_PROTECT;
+
+ BEGIN_CALLARGS;
+ if (node->nd_recv == (NODE *)1) {
+ recv = self;
+ scope = 1;
+ }
+ else {
+ recv = rb_eval(self, node->nd_recv);
+ scope = 0;
+ }
+ SETUP_ARGS(node->nd_args);
+ END_CALLARGS;
+
+ ruby_current_node = node;
+ SET_CURRENT_SOURCE();
+ rb_call(CLASS_OF(recv),recv,node->nd_mid,argc,argv,scope);
+ result = argv[argc-1];
}
- return_check();
- JUMP_TAG(TAG_RETURN);
break;
case NODE_CALL:
@@ -1980,6 +3220,8 @@ rb_eval(self, node)
SETUP_ARGS(node->nd_args);
END_CALLARGS;
+ ruby_current_node = node;
+ SET_CURRENT_SOURCE();
result = rb_call(CLASS_OF(recv),recv,node->nd_mid,argc,argv,0);
}
break;
@@ -1993,11 +3235,14 @@ rb_eval(self, node)
SETUP_ARGS(node->nd_args);
END_CALLARGS;
+ ruby_current_node = node;
+ SET_CURRENT_SOURCE();
result = rb_call(CLASS_OF(self),self,node->nd_mid,argc,argv,1);
}
break;
case NODE_VCALL:
+ SET_CURRENT_SOURCE();
result = rb_call(CLASS_OF(self),self,node->nd_mid,0,0,2);
break;
@@ -2007,52 +3252,66 @@ rb_eval(self, node)
int argc; VALUE *argv; /* used in SETUP_ARGS */
TMP_PROTECT;
- if (the_frame->last_class == 0) {
- NameError("superclass method `%s' disabled",
- rb_id2name(the_frame->last_func));
+ if (ruby_frame->last_class == 0) {
+ if (ruby_frame->orig_func) {
+ rb_name_error(ruby_frame->last_func,
+ "superclass method `%s' disabled",
+ rb_id2name(ruby_frame->orig_func));
+ }
+ else {
+ rb_raise(rb_eNoMethodError, "super called outside of method");
+ }
}
if (nd_type(node) == NODE_ZSUPER) {
- argc = the_frame->argc;
- argv = the_frame->argv;
+ argc = ruby_frame->argc;
+ argv = ruby_frame->argv;
}
else {
BEGIN_CALLARGS;
SETUP_ARGS(node->nd_args);
END_CALLARGS;
+ ruby_current_node = node;
}
- PUSH_ITER(the_iter->iter?ITER_PRE:ITER_NOT);
- result = rb_call(RCLASS(the_frame->last_class)->super,
- the_frame->self, the_frame->last_func,
- argc, argv, 3);
- POP_ITER();
+ SET_CURRENT_SOURCE();
+ result = rb_call_super(argc, argv);
}
break;
case NODE_SCOPE:
{
- VALUE save = the_frame->cbase;
+ struct FRAME frame;
+ NODE *saved_cref = 0;
+
+ frame = *ruby_frame;
+ frame.tmp = ruby_frame;
+ ruby_frame = &frame;
PUSH_SCOPE();
PUSH_TAG(PROT_NONE);
- if (node->nd_rval) the_frame->cbase = node->nd_rval;
+ if (node->nd_rval) {
+ saved_cref = ruby_cref;
+ ruby_cref = (NODE*)node->nd_rval;
+ }
if (node->nd_tbl) {
VALUE *vars = ALLOCA_N(VALUE, node->nd_tbl[0]+1);
*vars++ = (VALUE)node;
- the_scope->local_vars = vars;
- memclear(the_scope->local_vars, node->nd_tbl[0]);
- the_scope->local_tbl = node->nd_tbl;
+ ruby_scope->local_vars = vars;
+ rb_mem_clear(ruby_scope->local_vars, node->nd_tbl[0]);
+ ruby_scope->local_tbl = node->nd_tbl;
}
else {
- the_scope->local_vars = 0;
- the_scope->local_tbl = 0;
+ ruby_scope->local_vars = 0;
+ ruby_scope->local_tbl = 0;
}
if ((state = EXEC_TAG()) == 0) {
- result = rb_eval(self, node->nd_body);
+ result = rb_eval(self, node->nd_next);
}
POP_TAG();
POP_SCOPE();
- the_frame->cbase = save;
+ ruby_frame = frame.tmp;
+ if (saved_cref)
+ ruby_cref = saved_cref;
if (state) JUMP_TAG(state);
}
break;
@@ -2066,21 +3325,22 @@ rb_eval(self, node)
recv = rb_eval(self, node->nd_recv);
rval = node->nd_args->nd_head;
- SETUP_ARGS(node->nd_args->nd_next);
+ SETUP_ARGS0(node->nd_args->nd_next, node->nd_args->nd_alen - 1);
val = rb_funcall2(recv, aref, argc-1, argv);
- if (node->nd_mid == 0) { /* OR */
- if (RTEST(val)) break;
+ switch (node->nd_mid) {
+ case 0: /* OR */
+ if (RTEST(val)) RETURN(val);
val = rb_eval(self, rval);
- }
- else if (node->nd_mid == 1) { /* AND */
- if (!RTEST(val)) break;
+ break;
+ case 1: /* AND */
+ if (!RTEST(val)) RETURN(val);
val = rb_eval(self, rval);
- }
- else {
+ break;
+ default:
val = rb_funcall(val, node->nd_mid, 1, rb_eval(self, rval));
}
argv[argc-1] = val;
- val = rb_funcall2(recv, aset, argc, argv);
+ rb_funcall2(recv, aset, argc, argv);
result = val;
}
break;
@@ -2092,15 +3352,16 @@ rb_eval(self, node)
recv = rb_eval(self, node->nd_recv);
val = rb_funcall(recv, id, 0);
- if (node->nd_next->nd_mid == 0) { /* OR */
- if (RTEST(val)) break;
+ switch (node->nd_next->nd_mid) {
+ case 0: /* OR */
+ if (RTEST(val)) RETURN(val);
val = rb_eval(self, node->nd_value);
- }
- else if (node->nd_next->nd_mid == 1) { /* AND */
- if (!RTEST(val)) break;
+ break;
+ case 1: /* AND */
+ if (!RTEST(val)) RETURN(val);
val = rb_eval(self, node->nd_value);
- }
- else {
+ break;
+ default:
val = rb_funcall(val, node->nd_next->nd_mid, 1,
rb_eval(self, node->nd_value));
}
@@ -2112,83 +3373,84 @@ rb_eval(self, node)
case NODE_OP_ASGN_AND:
result = rb_eval(self, node->nd_head);
- if (RTEST(result)) {
- result = rb_eval(self, node->nd_value);
- }
- break;
+ if (!RTEST(result)) break;
+ node = node->nd_value;
+ goto again;
case NODE_OP_ASGN_OR:
- result = rb_eval(self, node->nd_head);
- if (!RTEST(result)) {
- result = rb_eval(self, node->nd_value);
+ if ((node->nd_aid && !is_defined(self, node->nd_head, 0)) ||
+ !RTEST(result = rb_eval(self, node->nd_head))) {
+ node = node->nd_value;
+ goto again;
}
break;
case NODE_MASGN:
- result = massign(self, node, rb_eval(self, node->nd_value));
+ result = massign(self, node, rb_eval(self, node->nd_value), 0);
break;
case NODE_LASGN:
- if (the_scope->local_vars == 0)
- Bug("unexpected local variable assignment");
+ if (ruby_scope->local_vars == 0)
+ rb_bug("unexpected local variable assignment");
result = rb_eval(self, node->nd_value);
- the_scope->local_vars[node->nd_cnt] = result;
+ ruby_scope->local_vars[node->nd_cnt] = result;
break;
case NODE_DASGN:
- result = dyna_var_asgn(node->nd_vid, rb_eval(self, node->nd_value));
+ result = rb_eval(self, node->nd_value);
+ dvar_asgn(node->nd_vid, result);
break;
- case NODE_DASGN_PUSH:
+ case NODE_DASGN_CURR:
result = rb_eval(self, node->nd_value);
- dvar_asgn_push(node->nd_vid, result);
+ dvar_asgn_curr(node->nd_vid, result);
break;
case NODE_GASGN:
- {
- VALUE val;
-
- val = rb_eval(self, node->nd_value);
- rb_gvar_set(node->nd_entry, val);
- result = val;
- }
+ result = rb_eval(self, node->nd_value);
+ rb_gvar_set(node->nd_entry, result);
break;
case NODE_IASGN:
- {
- VALUE val;
+ result = rb_eval(self, node->nd_value);
+ rb_ivar_set(self, node->nd_vid, result);
+ break;
- val = rb_eval(self, node->nd_value);
- rb_ivar_set(self, node->nd_vid, val);
- result = val;
+ case NODE_CDECL:
+ result = rb_eval(self, node->nd_value);
+ if (node->nd_vid == 0) {
+ rb_const_set(class_prefix(self, node->nd_else), node->nd_else->nd_mid, result);
+ }
+ else {
+ if (NIL_P(ruby_cbase)) {
+ rb_raise(rb_eTypeError, "no class/module to define constant");
+ }
+ rb_const_set(ruby_cbase, node->nd_vid, result);
}
break;
- case NODE_CASGN:
- {
- VALUE val;
-
- val = rb_eval(self, node->nd_value);
- /* check for static scope constants */
- if (RTEST(verbose) &&
- ev_const_defined((NODE*)the_frame->cbase, node->nd_vid)) {
- Warning("already initialized constant %s",
- rb_id2name(node->nd_vid));
- }
- rb_const_set(the_class, node->nd_vid, val);
- result = val;
+ case NODE_CVDECL:
+ if (NIL_P(ruby_cbase)) {
+ rb_raise(rb_eTypeError, "no class/module to define class variable");
}
+ result = rb_eval(self, node->nd_value);
+ rb_cvar_set(cvar_cbase(), node->nd_vid, result, Qtrue);
+ break;
+
+ case NODE_CVASGN:
+ result = rb_eval(self, node->nd_value);
+ rb_cvar_set(cvar_cbase(), node->nd_vid, result, Qfalse);
break;
case NODE_LVAR:
- if (the_scope->local_vars == 0) {
- Bug("unexpected local variable");
+ if (ruby_scope->local_vars == 0) {
+ rb_bug("unexpected local variable");
}
- result = the_scope->local_vars[node->nd_cnt];
+ result = ruby_scope->local_vars[node->nd_cnt];
break;
case NODE_DVAR:
- result = dyna_var_ref(node->nd_vid);
+ result = rb_dvar_ref(node->nd_vid);
break;
case NODE_GVAR:
@@ -2199,16 +3461,20 @@ rb_eval(self, node)
result = rb_ivar_get(self, node->nd_vid);
break;
+ case NODE_CONST:
+ result = ev_const_get(ruby_cref, node->nd_vid, self);
+ break;
+
case NODE_CVAR:
- result = ev_const_get((NODE*)the_frame->cbase, node->nd_vid);
+ result = rb_cvar_get(cvar_cbase(), node->nd_vid);
break;
case NODE_BLOCK_ARG:
- if (the_scope->local_vars == 0)
- Bug("unexpected block argument");
- if (iterator_p()) {
- result = f_lambda();
- the_scope->local_vars[node->nd_cnt] = result;
+ if (ruby_scope->local_vars == 0)
+ rb_bug("unexpected block argument");
+ if (rb_block_given_p()) {
+ result = rb_block_proc();
+ ruby_scope->local_vars[node->nd_cnt] = result;
}
else {
result = Qnil;
@@ -2220,49 +3486,55 @@ rb_eval(self, node)
VALUE klass;
klass = rb_eval(self, node->nd_head);
- switch (TYPE(klass)) {
- case T_CLASS:
- case T_MODULE:
- break;
- default:
- Check_Type(klass, T_CLASS);
- break;
+ if (rb_is_const_id(node->nd_mid)) {
+ switch (TYPE(klass)) {
+ case T_CLASS:
+ case T_MODULE:
+ result = rb_const_get_from(klass, node->nd_mid);
+ break;
+ default:
+ rb_raise(rb_eTypeError, "%s is not a class/module",
+ RSTRING(rb_obj_as_string(klass))->ptr);
+ break;
+ }
+ }
+ else {
+ result = rb_funcall(klass, node->nd_mid, 0, 0);
}
- result = rb_const_get_at(klass, node->nd_mid);
}
break;
case NODE_COLON3:
- result = rb_const_get_at(cObject, node->nd_mid);
+ result = rb_const_get_from(rb_cObject, node->nd_mid);
break;
case NODE_NTH_REF:
- result = reg_nth_match(node->nd_nth, MATCH_DATA);
+ result = rb_reg_nth_match(node->nd_nth, MATCH_DATA);
break;
case NODE_BACK_REF:
switch (node->nd_nth) {
case '&':
- result = reg_last_match(MATCH_DATA);
+ result = rb_reg_last_match(MATCH_DATA);
break;
case '`':
- result = reg_match_pre(MATCH_DATA);
+ result = rb_reg_match_pre(MATCH_DATA);
break;
case '\'':
- result = reg_match_post(MATCH_DATA);
+ result = rb_reg_match_post(MATCH_DATA);
break;
case '+':
- result = reg_match_last(MATCH_DATA);
+ result = rb_reg_match_last(MATCH_DATA);
break;
default:
- Bug("unexpected back-ref");
+ rb_bug("unexpected back-ref");
}
break;
case NODE_HASH:
{
NODE *list;
- VALUE hash = hash_new();
+ VALUE hash = rb_hash_new();
VALUE key, val;
list = node->nd_head;
@@ -2270,26 +3542,26 @@ rb_eval(self, node)
key = rb_eval(self, list->nd_head);
list = list->nd_next;
if (list == 0)
- Bug("odd number list for Hash");
+ rb_bug("odd number list for Hash");
val = rb_eval(self, list->nd_head);
list = list->nd_next;
- hash_aset(hash, key, val);
+ rb_hash_aset(hash, key, val);
}
result = hash;
}
break;
case NODE_ZARRAY: /* zero length list */
- result = ary_new();
+ result = rb_ary_new();
break;
case NODE_ARRAY:
{
VALUE ary;
- int i;
+ long i;
i = node->nd_alen;
- ary = ary_new2(i);
+ ary = rb_ary_new2(i);
for (i=0;node;node=node->nd_next) {
RARRAY(ary)->ptr[i++] = rb_eval(self, node->nd_head);
RARRAY(ary)->len = i;
@@ -2300,55 +3572,58 @@ rb_eval(self, node)
break;
case NODE_STR:
- result = str_new3(node->nd_lit);
+ result = rb_str_new3(node->nd_lit);
+ break;
+
+ case NODE_EVSTR:
+ result = rb_obj_as_string(rb_eval(self, node->nd_body));
break;
case NODE_DSTR:
case NODE_DXSTR:
case NODE_DREGX:
case NODE_DREGX_ONCE:
+ case NODE_DSYM:
{
VALUE str, str2;
NODE *list = node->nd_next;
- str = str_new3(node->nd_lit);
+ str = rb_str_new3(node->nd_lit);
while (list) {
- if (nd_type(list->nd_head) == NODE_STR) {
- str2 = list->nd_head->nd_lit;
- }
- else {
- if (nd_type(list->nd_head) == NODE_EVSTR) {
- rb_in_eval++;
- list->nd_head = compile(list->nd_head->nd_lit,0);
- eval_tree = 0;
- rb_in_eval--;
- if (nerrs > 0) {
- compile_error("string expansion");
- }
+ if (list->nd_head) {
+ switch (nd_type(list->nd_head)) {
+ case NODE_STR:
+ str2 = list->nd_head->nd_lit;
+ break;
+ default:
+ str2 = rb_eval(self, list->nd_head);
+ break;
}
- str2 = rb_eval(self, list->nd_head);
- str2 = obj_as_string(str2);
- }
- if (str2) {
- str_cat(str, RSTRING(str2)->ptr, RSTRING(str2)->len);
- if (str_tainted(str2)) str_taint(str);
+ rb_str_append(str, str2);
+ OBJ_INFECT(str, str2);
}
list = list->nd_next;
}
switch (nd_type(node)) {
case NODE_DREGX:
- result = reg_new(RSTRING(str)->ptr, RSTRING(str)->len,
- node->nd_cflag);
+ result = rb_reg_new(RSTRING(str)->ptr, RSTRING(str)->len,
+ node->nd_cflag);
break;
case NODE_DREGX_ONCE: /* regexp expand once */
- result = reg_new(RSTRING(str)->ptr, RSTRING(str)->len,
- node->nd_cflag);
+ result = rb_reg_new(RSTRING(str)->ptr, RSTRING(str)->len,
+ node->nd_cflag);
nd_set_type(node, NODE_LIT);
node->nd_lit = result;
break;
+ case NODE_LIT:
+ /* other thread may replace NODE_DREGX_ONCE to NODE_LIT */
+ goto again;
case NODE_DXSTR:
result = rb_funcall(self, '`', 1, str);
break;
+ case NODE_DSYM:
+ result = rb_str_intern(str);
+ break;
default:
result = str;
break;
@@ -2357,7 +3632,7 @@ rb_eval(self, node)
break;
case NODE_XSTR:
- result = rb_funcall(self, '`', 1, node->nd_lit);
+ result = rb_funcall(self, '`', 1, rb_str_new3(node->nd_lit));
break;
case NODE_LIT:
@@ -2365,26 +3640,34 @@ rb_eval(self, node)
break;
case NODE_ATTRSET:
- if (the_frame->argc != 1)
- ArgError("Wrong # of arguments(%d for 1)", the_frame->argc);
- result = rb_ivar_set(self, node->nd_vid, the_frame->argv[0]);
+ if (ruby_frame->argc != 1)
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)",
+ ruby_frame->argc);
+ result = rb_ivar_set(self, node->nd_vid, ruby_frame->argv[0]);
break;
case NODE_DEFN:
if (node->nd_defn) {
- NODE *body;
+ NODE *body, *defn;
VALUE origin;
int noex;
- if (the_class == cObject && node->nd_mid == init) {
- Warn("re-defining Object#initialize may cause infinite loop");
+ if (NIL_P(ruby_class)) {
+ rb_raise(rb_eTypeError, "no class/module to add method");
+ }
+ if (ruby_class == rb_cObject && node->nd_mid == init) {
+ rb_warn("redefining Object#initialize may cause infinite loop");
+ }
+ if (node->nd_mid == __id__ || node->nd_mid == __send__) {
+ rb_warn("redefining `%s' may cause serious problem",
+ rb_id2name(node->nd_mid));
}
- body = search_method(the_class, node->nd_mid, &origin);
- if (body) {
- if (origin == the_class) {
- Warning("discarding old %s", rb_id2name(node->nd_mid));
+ rb_frozen_class_p(ruby_class);
+ body = search_method(ruby_class, node->nd_mid, &origin);
+ if (body){
+ if (RTEST(ruby_verbose) && ruby_class == origin && body->nd_cnt == 0 && body->nd_body) {
+ rb_warning("method redefined; discarding old %s", rb_id2name(node->nd_mid));
}
- rb_clear_cache_by_id(node->nd_mid);
}
if (SCOPE_TEST(SCOPE_PRIVATE) || node->nd_mid == init) {
@@ -2396,24 +3679,15 @@ rb_eval(self, node)
else {
noex = NOEX_PUBLIC;
}
- if (body && origin == the_class && body->nd_noex & NOEX_UNDEF) {
- noex |= NOEX_UNDEF;
+ if (body && origin == ruby_class && body->nd_body == 0) {
+ noex |= NOEX_NOSUPER;
}
- rb_add_method(the_class, node->nd_mid, node->nd_defn, noex);
+
+ defn = 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(the_class),
- node->nd_mid, node->nd_defn, NOEX_PUBLIC);
- rb_funcall(the_class, rb_intern("singleton_method_added"),
- 1, INT2FIX(node->nd_mid));
- }
- if (FL_TEST(the_class, FL_SINGLETON)) {
- rb_funcall(rb_iv_get(the_class, "__attached__"),
- rb_intern("singleton_method_added"),
- 1, INT2FIX(node->nd_mid));
- }
- else {
- rb_funcall(the_class, rb_intern("method_added"),
- 1, INT2FIX(node->nd_mid));
+ rb_add_method(rb_singleton_class(ruby_class),
+ node->nd_mid, defn, NOEX_PUBLIC);
}
result = Qnil;
}
@@ -2423,66 +3697,48 @@ rb_eval(self, node)
if (node->nd_defn) {
VALUE recv = rb_eval(self, node->nd_recv);
VALUE klass;
- NODE *body = 0;
+ NODE *body = 0, *defn;
- if (FIXNUM_P(recv)) {
- TypeError("Can't define method \"%s\" for Fixnum",
- rb_id2name(node->nd_mid));
- }
- if (NIL_P(recv)) {
- TypeError("Can't define method \"%s\" for nil",
- rb_id2name(node->nd_mid));
+ if (ruby_safe_level >= 4 && !OBJ_TAINTED(recv)) {
+ rb_raise(rb_eSecurityError, "Insecure: can't define singleton method");
}
- if (rb_special_const_p(recv)) {
- TypeError("Can't define method \"%s\" for special constants",
- rb_id2name(node->nd_mid));
+ if (FIXNUM_P(recv) || SYMBOL_P(recv)) {
+ rb_raise(rb_eTypeError,
+ "can't define singleton method \"%s\" for %s",
+ rb_id2name(node->nd_mid),
+ rb_obj_classname(recv));
}
+ if (OBJ_FROZEN(recv)) rb_error_frozen("object");
klass = rb_singleton_class(recv);
- if (st_lookup(RCLASS(klass)->m_tbl, node->nd_mid, &body)) {
- Warning("redefine %s", rb_id2name(node->nd_mid));
+ if (st_lookup(RCLASS(klass)->m_tbl, node->nd_mid, (st_data_t *)&body)) {
+ if (ruby_safe_level >= 4) {
+ rb_raise(rb_eSecurityError, "redefining method prohibited");
+ }
+ if (RTEST(ruby_verbose)) {
+ rb_warning("redefine %s", rb_id2name(node->nd_mid));
+ }
}
- rb_clear_cache_by_id(node->nd_mid);
- rb_add_method(klass, node->nd_mid, node->nd_defn,
+ defn = 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));
- rb_funcall(recv, rb_intern("singleton_method_added"),
- 1, INT2FIX(node->nd_mid));
result = Qnil;
}
break;
case NODE_UNDEF:
- {
- VALUE origin;
- NODE *body;
-
- body = search_method(the_class, node->nd_mid, &origin);
- if (!body || !body->nd_body) {
- char *s0 = " class";
- VALUE klass = the_class;
-
- if (FL_TEST(the_class, FL_SINGLETON)) {
- VALUE obj = rb_iv_get(the_class, "__attached__");
- switch (TYPE(obj)) {
- case T_MODULE:
- case T_CLASS:
- klass = obj;
- s0 = "";
- }
- }
- NameError("undefined method `%s' for%s `%s'",
- rb_id2name(node->nd_mid),s0,rb_class2name(klass));
- }
- rb_clear_cache_by_id(node->nd_mid);
- rb_add_method(the_class, node->nd_mid, 0, NOEX_PUBLIC);
- result = Qnil;
+ if (NIL_P(ruby_class)) {
+ rb_raise(rb_eTypeError, "no class to undef method");
}
+ rb_undef(ruby_class, node->nd_mid);
+ result = Qnil;
break;
case NODE_ALIAS:
- rb_alias(the_class, node->nd_new, node->nd_old);
- rb_funcall(the_class, rb_intern("method_added"),
- 1, INT2FIX(node->nd_mid));
+ if (NIL_P(ruby_class)) {
+ rb_raise(rb_eTypeError, "no class to make alias");
+ }
+ rb_alias(ruby_class, node->nd_new, node->nd_old);
result = Qnil;
break;
@@ -2493,77 +3749,91 @@ rb_eval(self, node)
case NODE_CLASS:
{
- VALUE super, klass, tmp;
+ VALUE super, klass, tmp, cbase;
+ ID cname;
+ int gen = Qfalse;
+
+ cbase = class_prefix(self, node->nd_cpath);
+ cname = node->nd_cpath->nd_mid;
+ if (NIL_P(ruby_cbase)) {
+ rb_raise(rb_eTypeError, "no outer class/module");
+ }
if (node->nd_super) {
- super = superclass(self, node->nd_super);
+ super = rb_eval(self, node->nd_super);
+ rb_check_inheritable(super);
}
else {
super = 0;
}
- if (rb_const_defined_at(the_class, node->nd_cname) &&
- (the_class != cObject ||
- !rb_autoload_defined(node->nd_cname))) {
-
- klass = rb_const_get_at(the_class, node->nd_cname);
+ if (rb_const_defined_at(cbase, cname)) {
+ klass = rb_const_get_at(cbase, cname);
if (TYPE(klass) != T_CLASS) {
- TypeError("%s is not a class", rb_id2name(node->nd_cname));
+ rb_raise(rb_eTypeError, "%s is not a class",
+ rb_id2name(cname));
}
if (super) {
- tmp = RCLASS(klass)->super;
- if (FL_TEST(tmp, FL_SINGLETON)) {
- tmp = RCLASS(tmp)->super;
- }
- while (TYPE(tmp) == T_ICLASS) {
- tmp = RCLASS(tmp)->super;
- }
+ tmp = rb_class_real(RCLASS(klass)->super);
if (tmp != super) {
- TypeError("superclass mismatch for %s",
- rb_id2name(node->nd_cname));
+ rb_raise(rb_eTypeError, "superclass mismatch for class %s",
+ rb_id2name(cname));
}
+ super = 0;
}
- if (safe_level >= 3) {
- Raise(eSecurityError, "extending class prohibited");
+ if (ruby_safe_level >= 4) {
+ rb_raise(rb_eSecurityError, "extending class prohibited");
}
- rb_clear_cache();
}
else {
- if (!super) super = cObject;
- klass = rb_define_class_id(node->nd_cname, super);
- rb_const_set(the_class, node->nd_cname, klass);
- rb_set_class_path(klass,the_class,rb_id2name(node->nd_cname));
- obj_call_init(klass);
+ if (!super) super = rb_cObject;
+ klass = rb_define_class_id(cname, super);
+ rb_set_class_path(klass, cbase, rb_id2name(cname));
+ rb_const_set(cbase, cname, klass);
+ gen = Qtrue;
}
-
- return module_setup(klass, node->nd_body);
+ if (ruby_wrapper) {
+ rb_extend_object(klass, ruby_wrapper);
+ rb_include_module(klass, ruby_wrapper);
+ }
+ if (super && gen) {
+ rb_class_inherited(super, klass);
+ }
+ result = module_setup(klass, node);
}
break;
case NODE_MODULE:
{
- VALUE module;
-
- if (rb_const_defined_at(the_class, node->nd_cname) &&
- (the_class != cObject ||
- !rb_autoload_defined(node->nd_cname))) {
+ VALUE module, cbase;
+ ID cname;
- module = rb_const_get_at(the_class, node->nd_cname);
+ if (NIL_P(ruby_cbase)) {
+ rb_raise(rb_eTypeError, "no outer class/module");
+ }
+ cbase = class_prefix(self, node->nd_cpath);
+ cname = node->nd_cpath->nd_mid;
+ if (rb_const_defined_at(cbase, cname)) {
+ module = rb_const_get_at(cbase, cname);
if (TYPE(module) != T_MODULE) {
- TypeError("%s is not a module", rb_id2name(node->nd_cname));
+ rb_raise(rb_eTypeError, "%s is not a module",
+ rb_id2name(cname));
}
- if (safe_level >= 3) {
- Raise(eSecurityError, "extending module prohibited");
+ if (ruby_safe_level >= 4) {
+ rb_raise(rb_eSecurityError, "extending module prohibited");
}
}
else {
- module = rb_define_module_id(node->nd_cname);
- rb_const_set(the_class, node->nd_cname, module);
- rb_set_class_path(module,the_class,rb_id2name(node->nd_cname));
- obj_call_init(module);
+ module = rb_define_module_id(cname);
+ rb_set_class_path(module, cbase, rb_id2name(cname));
+ rb_const_set(cbase, cname, module);
+ }
+ if (ruby_wrapper) {
+ rb_extend_object(module, ruby_wrapper);
+ rb_include_module(module, ruby_wrapper);
}
- result = module_setup(module, node->nd_body);
+ result = module_setup(module, node);
}
break;
@@ -2571,22 +3841,21 @@ rb_eval(self, node)
{
VALUE klass;
- klass = rb_eval(self, node->nd_recv);
- if (FIXNUM_P(klass)) {
- TypeError("No virtual class for Fixnums");
- }
- if (NIL_P(klass)) {
- TypeError("No virtual class for nil");
- }
- if (rb_special_const_p(klass)) {
- TypeError("No virtual class for special constants");
+ result = rb_eval(self, node->nd_recv);
+ if (FIXNUM_P(result) || SYMBOL_P(result)) {
+ rb_raise(rb_eTypeError, "no virtual class for %s",
+ rb_obj_classname(result));
}
- if (FL_TEST(CLASS_OF(klass), FL_SINGLETON)) {
- rb_clear_cache();
+ if (ruby_safe_level >= 4 && !OBJ_TAINTED(result))
+ rb_raise(rb_eSecurityError, "Insecure: can't extend object");
+ klass = rb_singleton_class(result);
+
+ if (ruby_wrapper) {
+ rb_extend_object(klass, ruby_wrapper);
+ rb_include_module(klass, ruby_wrapper);
}
- klass = rb_singleton_class(klass);
-
- result = module_setup(klass, node->nd_body);
+
+ result = module_setup(klass, node);
}
break;
@@ -2595,77 +3864,81 @@ rb_eval(self, node)
char buf[20];
char *desc = is_defined(self, node->nd_head, buf);
- if (desc) result = str_new2(desc);
- else result = FALSE;
+ if (desc) result = rb_str_new2(desc);
+ else result = Qnil;
}
break;
- case NODE_NEWLINE:
- sourcefile = node->nd_file;
- sourceline = node->nd_nth;
+ case NODE_NEWLINE:
if (trace_func) {
- call_trace_func("line", sourcefile, sourceline,
- self, the_frame->last_func);
+ call_trace_func("line", node, self,
+ ruby_frame->last_func,
+ ruby_frame->last_class);
}
node = node->nd_next;
goto again;
default:
- Bug("unknown node type %d", nd_type(node));
+ rb_bug("unknown node type %d", nd_type(node));
}
finish:
CHECK_INTS;
+ if (contnode) {
+ node = contnode;
+ contnode = 0;
+ goto again;
+ }
return result;
}
static VALUE
-module_setup(module, node)
+module_setup(module, n)
VALUE module;
- NODE * volatile node;
+ NODE *n;
{
+ NODE * volatile node = n->nd_body;
int state;
- VALUE save = the_frame->cbase;
- VALUE result; /* OK */
- char *file = sourcefile;
- int line = sourceline;
+ struct FRAME frame;
+ VALUE result = Qnil; /* OK */
TMP_PROTECT;
- /* fill c-ref */
- node->nd_clss = module;
- node = node->nd_body;
+ frame = *ruby_frame;
+ frame.tmp = ruby_frame;
+ ruby_frame = &frame;
- PUSH_CLASS();
- the_class = module;
+ PUSH_CLASS(module);
PUSH_SCOPE();
+ PUSH_VARS();
- if (node->nd_rval) the_frame->cbase = node->nd_rval;
if (node->nd_tbl) {
- VALUE *vars = TMP_ALLOC(VALUE, node->nd_tbl[0]+1);
+ VALUE *vars = TMP_ALLOC(node->nd_tbl[0]+1);
*vars++ = (VALUE)node;
- the_scope->local_vars = vars;
- memclear(the_scope->local_vars, node->nd_tbl[0]);
- the_scope->local_tbl = node->nd_tbl;
+ ruby_scope->local_vars = vars;
+ rb_mem_clear(ruby_scope->local_vars, node->nd_tbl[0]);
+ ruby_scope->local_tbl = node->nd_tbl;
}
else {
- the_scope->local_vars = 0;
- the_scope->local_tbl = 0;
+ ruby_scope->local_vars = 0;
+ ruby_scope->local_tbl = 0;
}
+ PUSH_CREF(module);
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
if (trace_func) {
- call_trace_func("class", file, line,
- the_class, the_frame->last_func);
+ call_trace_func("class", n, ruby_cbase, ruby_frame->last_func, ruby_frame->last_class);
}
- result = rb_eval(the_class, node->nd_body);
+ result = rb_eval(ruby_cbase, node->nd_next);
}
POP_TAG();
+ POP_CREF();
+ POP_VARS();
POP_SCOPE();
POP_CLASS();
- the_frame->cbase = save;
+ ruby_frame = frame.tmp;
if (trace_func) {
- call_trace_func("end", file, line, 0, the_frame->last_func);
+ call_trace_func("end", n, 0, ruby_frame->last_func, ruby_frame->last_class);
}
if (state) JUMP_TAG(state);
@@ -2678,13 +3951,22 @@ rb_respond_to(obj, id)
ID id;
{
if (rb_method_boundp(CLASS_OF(obj), id, 0)) {
- return TRUE;
+ return Qtrue;
}
- return FALSE;
+ return Qfalse;
}
+/*
+ * call-seq:
+ * obj.respond_to?(symbol, include_private=false) => true or false
+ *
+ * Returns +true+> if _obj_ responds to the given
+ * method. Private methods are included in the search only if the
+ * optional second parameter evaluates to +true+.
+ */
+
static VALUE
-obj_respond_to(argc, argv, obj)
+rb_obj_respond_to(argc, argv, obj)
int argc;
VALUE *argv;
VALUE obj;
@@ -2695,19 +3977,178 @@ obj_respond_to(argc, argv, obj)
rb_scan_args(argc, argv, "11", &mid, &priv);
id = rb_to_id(mid);
if (rb_method_boundp(CLASS_OF(obj), id, !RTEST(priv))) {
- return TRUE;
- }
- return FALSE;
-}
+ return Qtrue;
+ }
+ return Qfalse;
+}
+
+/*
+ * call-seq:
+ * mod.method_defined?(symbol) => true or false
+ *
+ * Returns +true+ if the named method is defined by
+ * _mod_ (or its included modules and, if _mod_ is a class,
+ * its ancestors). Public and protected methods are matched.
+ *
+ * module A
+ * def method1() end
+ * end
+ * class B
+ * def method2() end
+ * end
+ * class C < B
+ * include A
+ * def method3() end
+ * end
+ *
+ * A.method_defined? :method1 #=> true
+ * C.method_defined? "method1" #=> true
+ * C.method_defined? "method2" #=> true
+ * C.method_defined? "method3" #=> true
+ * C.method_defined? "method4" #=> false
+ */
+
+static VALUE
+rb_mod_method_defined(mod, mid)
+ VALUE mod, mid;
+{
+ return rb_method_boundp(mod, rb_to_id(mid), 1);
+}
+
+#define VISI_CHECK(x,f) (((x)&NOEX_MASK) == (f))
+
+/*
+ * call-seq:
+ * mod.public_method_defined?(symbol) => true or false
+ *
+ * Returns +true+ if the named public method is defined by
+ * _mod_ (or its included modules and, if _mod_ is a class,
+ * its ancestors).
+ *
+ * module A
+ * def method1() end
+ * end
+ * class B
+ * protected
+ * def method2() end
+ * end
+ * class C < B
+ * include A
+ * def method3() end
+ * end
+ *
+ * A.method_defined? :method1 #=> true
+ * C.public_method_defined? "method1" #=> true
+ * C.public_method_defined? "method2" #=> false
+ * C.method_defined? "method2" #=> true
+ */
+
+static VALUE
+rb_mod_public_method_defined(mod, mid)
+ VALUE mod, mid;
+{
+ ID id = rb_to_id(mid);
+ int noex;
+
+ if (rb_get_method_body(&mod, &id, &noex)) {
+ if (VISI_CHECK(noex, NOEX_PUBLIC))
+ return Qtrue;
+ }
+ return Qfalse;
+}
+
+/*
+ * call-seq:
+ * mod.private_method_defined?(symbol) => true or false
+ *
+ * Returns +true+ if the named private method is defined by
+ * _ mod_ (or its included modules and, if _mod_ is a class,
+ * its ancestors).
+ *
+ * module A
+ * def method1() end
+ * end
+ * class B
+ * private
+ * def method2() end
+ * end
+ * class C < B
+ * include A
+ * def method3() end
+ * end
+ *
+ * A.method_defined? :method1 #=> true
+ * C.private_method_defined? "method1" #=> false
+ * C.private_method_defined? "method2" #=> true
+ * C.method_defined? "method2" #=> false
+ */
+
+static VALUE
+rb_mod_private_method_defined(mod, mid)
+ VALUE mod, mid;
+{
+ ID id = rb_to_id(mid);
+ int noex;
+
+ if (rb_get_method_body(&mod, &id, &noex)) {
+ if (VISI_CHECK(noex, NOEX_PRIVATE))
+ return Qtrue;
+ }
+ return Qfalse;
+}
+
+/*
+ * call-seq:
+ * mod.protected_method_defined?(symbol) => true or false
+ *
+ * Returns +true+ if the named protected method is defined
+ * by _mod_ (or its included modules and, if _mod_ is a
+ * class, its ancestors).
+ *
+ * module A
+ * def method1() end
+ * end
+ * class B
+ * protected
+ * def method2() end
+ * end
+ * class C < B
+ * include A
+ * def method3() end
+ * end
+ *
+ * A.method_defined? :method1 #=> true
+ * C.protected_method_defined? "method1" #=> false
+ * C.protected_method_defined? "method2" #=> true
+ * C.method_defined? "method2" #=> true
+ */
static VALUE
-mod_method_defined(mod, mid)
+rb_mod_protected_method_defined(mod, mid)
VALUE mod, mid;
{
- if (rb_method_boundp(mod, rb_to_id(mid), 1)) {
- return TRUE;
+ ID id = rb_to_id(mid);
+ int noex;
+
+ if (rb_get_method_body(&mod, &id, &noex)) {
+ if (VISI_CHECK(noex, NOEX_PROTECTED))
+ return Qtrue;
}
- return FALSE;
+ return Qfalse;
+}
+
+NORETURN(static VALUE terminate_process _((int, const char *, long)));
+static VALUE
+terminate_process(status, mesg, mlen)
+ int status;
+ const char *mesg;
+ long mlen;
+{
+ VALUE args[2];
+ args[0] = INT2NUM(status);
+ args[1] = rb_str_new(mesg, mlen);
+
+ rb_exc_raise(rb_class_new_instance(2, args, rb_eSystemExit));
}
void
@@ -2715,49 +4156,122 @@ rb_exit(status)
int status;
{
if (prot_tag) {
- exit_status = status;
- rb_raise(exc_new(eSystemExit, 0, 0));
+ terminate_process(status, "exit", 4);
}
+ ruby_finalize();
exit(status);
}
-static VALUE
-f_exit(argc, argv, obj)
+
+/*
+ * call-seq:
+ * exit(integer=0)
+ * Kernel::exit(integer=0)
+ * Process::exit(integer=0)
+ *
+ * Initiates the termination of the Ruby script by raising the
+ * <code>SystemExit</code> exception. This exception may be caught. The
+ * optional parameter is used to return a status code to the invoking
+ * environment.
+ *
+ * begin
+ * exit
+ * puts "never get here"
+ * rescue SystemExit
+ * puts "rescued a SystemExit exception"
+ * end
+ * puts "after begin block"
+ *
+ * <em>produces:</em>
+ *
+ * rescued a SystemExit exception
+ * after begin block
+ *
+ * Just prior to termination, Ruby executes any <code>at_exit</code> functions
+ * (see Kernel::at_exit) and runs any object finalizers (see
+ * ObjectSpace::define_finalizer).
+ *
+ * at_exit { puts "at_exit function" }
+ * ObjectSpace.define_finalizer("string", proc { puts "in finalizer" })
+ * exit
+ *
+ * <em>produces:</em>
+ *
+ * at_exit function
+ * in finalizer
+ */
+
+VALUE
+rb_f_exit(argc, argv)
int argc;
VALUE *argv;
- VALUE obj;
{
VALUE status;
+ int istatus;
- rb_secure(2);
+ rb_secure(4);
if (rb_scan_args(argc, argv, "01", &status) == 1) {
- status = NUM2INT(status);
+ switch (status) {
+ case Qtrue:
+ istatus = EXIT_SUCCESS;
+ break;
+ case Qfalse:
+ istatus = EXIT_FAILURE;
+ break;
+ default:
+ istatus = NUM2INT(status);
+ break;
+ }
}
else {
- status = 0;
+ istatus = EXIT_SUCCESS;
}
- rb_exit(status);
- /* not reached */
+ rb_exit(istatus);
+ return Qnil; /* not reached */
}
-static VALUE
-f_abort()
+
+/*
+ * call-seq:
+ * abort
+ * Kernel::abort
+ * Process::abort
+ *
+ * Terminate execution immediately, effectively by calling
+ * <code>Kernel.exit(1)</code>. If _msg_ is given, it is written
+ * to STDERR prior to terminating.
+ */
+
+VALUE
+rb_f_abort(argc, argv)
+ int argc;
+ VALUE *argv;
{
- rb_secure(2);
- if (errinfo) {
- error_print();
+ rb_secure(4);
+ if (argc == 0) {
+ if (!NIL_P(ruby_errinfo)) {
+ error_print();
+ }
+ rb_exit(EXIT_FAILURE);
+ }
+ else {
+ VALUE mesg;
+
+ rb_scan_args(argc, argv, "1", &mesg);
+ StringValue(argv[0]);
+ rb_io_puts(argc, argv, rb_stderr);
+ terminate_process(EXIT_FAILURE, RSTRING(argv[0])->ptr, RSTRING(argv[0])->len);
}
- rb_exit(1);
- /* not reached */
+ return Qnil; /* not reached */
}
void
rb_iter_break()
{
- JUMP_TAG(TAG_BREAK);
+ break_jump(Qnil);
}
-static void rb_longjmp _((int, VALUE)) NORETURN;
+NORETURN(static void rb_longjmp _((int, VALUE)));
static VALUE make_backtrace _((void));
static void
@@ -2767,43 +4281,73 @@ rb_longjmp(tag, mesg)
{
VALUE at;
- if (NIL_P(mesg)) mesg = errinfo;
+ if (thread_set_raised()) {
+ ruby_errinfo = exception_error;
+ JUMP_TAG(TAG_FATAL);
+ }
+ if (NIL_P(mesg)) mesg = ruby_errinfo;
if (NIL_P(mesg)) {
- mesg = exc_new(eRuntimeError, 0, 0);
+ mesg = rb_exc_new(rb_eRuntimeError, 0, 0);
}
- at = get_backtrace(mesg);
- if (NIL_P(at) && sourcefile && !NIL_P(mesg)) {
- at = make_backtrace();
- set_backtrace(mesg, at);
+ ruby_set_current_source();
+ if (ruby_sourcefile && !NIL_P(mesg)) {
+ at = get_backtrace(mesg);
+ if (NIL_P(at)) {
+ at = make_backtrace();
+ set_backtrace(mesg, at);
+ }
}
if (!NIL_P(mesg)) {
- errinfo = mesg;
+ ruby_errinfo = mesg;
}
- if (debug && !NIL_P(errinfo) && !obj_is_kind_of(errinfo, eSystemExit)) {
- fprintf(stderr, "Exception `%s' at %s:%d\n",
- rb_class2name(CLASS_OF(errinfo)),
- sourcefile, sourceline);
+ if (RTEST(ruby_debug) && !NIL_P(ruby_errinfo)
+ && !rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) {
+ VALUE e = ruby_errinfo;
+ int status;
+
+ PUSH_TAG(PROT_NONE);
+ if ((status = EXEC_TAG()) == 0) {
+ StringValue(e);
+ warn_printf("Exception `%s' at %s:%d - %s\n",
+ rb_obj_classname(ruby_errinfo),
+ ruby_sourcefile, ruby_sourceline,
+ RSTRING(e)->ptr);
+ }
+ POP_TAG();
+ if (status == TAG_FATAL && ruby_errinfo == exception_error) {
+ ruby_errinfo = mesg;
+ }
+ else if (status) {
+ thread_reset_raised();
+ JUMP_TAG(status);
+ }
}
- trap_restore_mask();
+ rb_trap_restore_mask();
if (trace_func && tag != TAG_FATAL) {
- call_trace_func("raise", sourcefile, sourceline,
- the_frame->self, the_frame->last_func);
+ call_trace_func("raise", ruby_current_node,
+ ruby_frame->self,
+ ruby_frame->last_func,
+ ruby_frame->last_class);
}
+ if (!prot_tag) {
+ error_print();
+ }
+ thread_reset_raised();
JUMP_TAG(tag);
}
void
-rb_raise(mesg)
+rb_exc_raise(mesg)
VALUE mesg;
{
rb_longjmp(TAG_RAISE, mesg);
}
void
-rb_fatal(mesg)
+rb_exc_fatal(mesg)
VALUE mesg;
{
rb_longjmp(TAG_FATAL, mesg);
@@ -2812,108 +4356,358 @@ rb_fatal(mesg)
void
rb_interrupt()
{
- Raise(eInterrupt, "");
+ rb_raise(rb_eInterrupt, "");
+}
+
+/*
+ * call-seq:
+ * raise
+ * raise(string)
+ * raise(exception [, string [, array]])
+ * fail
+ * fail(string)
+ * fail(exception [, string [, array]])
+ *
+ * With no arguments, raises the exception in <code>$!</code> or raises
+ * a <code>RuntimeError</code> if <code>$!</code> is +nil+.
+ * With a single +String+ argument, raises a
+ * +RuntimeError+ with the string as a message. Otherwise,
+ * the first parameter should be the name of an +Exception+
+ * class (or an object that returns an +Exception+ object when sent
+ * an +exception+ message). The optional second parameter sets the
+ * message associated with the exception, and the third parameter is an
+ * array of callback information. Exceptions are caught by the
+ * +rescue+ clause of <code>begin...end</code> blocks.
+ *
+ * raise "Failed to create socket"
+ * raise ArgumentError, "No parameters", caller
+ */
+
+static VALUE
+rb_f_raise(argc, argv)
+ int argc;
+ VALUE *argv;
+{
+ rb_raise_jump(rb_make_exception(argc, argv));
+ return Qnil; /* not reached */
}
static VALUE
-f_raise(argc, argv)
+rb_make_exception(argc, argv)
int argc;
VALUE *argv;
{
- VALUE arg1, arg2, arg3;
- VALUE etype, mesg;
+ VALUE mesg;
+ ID exception;
int n;
- etype = eRuntimeError;
mesg = Qnil;
- switch (n = rb_scan_args(argc, argv, "03", &arg1, &arg2, &arg3)) {
- case 1:
- mesg = arg1;
+ switch (argc) {
+ case 0:
+ mesg = Qnil;
break;
- case 3:
+ case 1:
+ if (NIL_P(argv[0])) break;
+ if (TYPE(argv[0]) == T_STRING) {
+ mesg = rb_exc_new3(rb_eRuntimeError, argv[0]);
+ break;
+ }
+ n = 0;
+ goto exception_call;
+
case 2:
- etype = arg1;
- mesg = arg2;
+ case 3:
+ n = 1;
+ exception_call:
+ exception = rb_intern("exception");
+ if (!rb_respond_to(argv[0], exception)) {
+ rb_raise(rb_eTypeError, "exception class/object expected");
+ }
+ mesg = rb_funcall(argv[0], exception, n, argv[1]);
+ break;
+ default:
+ rb_raise(rb_eArgError, "wrong number of arguments");
break;
}
-
- if (!NIL_P(mesg)) {
- if (n >= 2) {
- mesg = rb_funcall(etype, rb_intern("new"), 1, mesg);
- }
- else if (TYPE(mesg) == T_STRING) {
- mesg = exc_new3(eRuntimeError, mesg);
- }
- if (!obj_is_kind_of(mesg, eException)) {
- TypeError("casting non-exception");
- }
- set_backtrace(mesg, arg3);
+ if (argc > 0) {
+ if (!rb_obj_is_kind_of(mesg, rb_eException))
+ rb_raise(rb_eTypeError, "exception object expected");
+ if (argc>2)
+ set_backtrace(mesg, argv[2]);
}
- PUSH_FRAME(); /* fake frame */
- *the_frame = *_frame.prev->prev;
+ return mesg;
+}
+
+static void
+rb_raise_jump(mesg)
+ VALUE mesg;
+{
+ if (ruby_frame != top_frame) {
+ PUSH_FRAME(); /* fake frame */
+ *ruby_frame = *_frame.prev->prev;
+ rb_longjmp(TAG_RAISE, mesg);
+ POP_FRAME();
+ }
rb_longjmp(TAG_RAISE, mesg);
- POP_FRAME();
+}
+
+void
+rb_jump_tag(tag)
+ int tag;
+{
+ JUMP_TAG(tag);
}
int
-iterator_p()
+rb_block_given_p()
{
- if (the_frame->iter) return TRUE;
- return FALSE;
+ if (ruby_frame->iter == ITER_CUR && ruby_block)
+ return Qtrue;
+ return Qfalse;
}
+int
+rb_iterator_p()
+{
+ return rb_block_given_p();
+}
+
+/*
+ * call-seq:
+ * block_given? => true or false
+ * iterator? => true or false
+ *
+ * Returns <code>true</code> if <code>yield</code> would execute a
+ * block in the current context. The <code>iterator?</code> form
+ * is mildly deprecated.
+ *
+ * def try
+ * if block_given?
+ * yield
+ * else
+ * "no block"
+ * end
+ * end
+ * try #=> "no block"
+ * try { "hello" } #=> "hello"
+ * try do "hello" end #=> "hello"
+ */
+
+
static VALUE
-f_iterator_p()
+rb_f_block_given_p()
{
- if (the_frame->prev && the_frame->prev->iter) return TRUE;
- return FALSE;
+ if (ruby_frame->prev && ruby_frame->prev->iter == ITER_CUR && ruby_block)
+ return Qtrue;
+ return Qfalse;
}
-VALUE
-rb_yield_0(val, self)
- VALUE val;
- volatile VALUE self;
+static VALUE rb_eThreadError;
+
+NORETURN(static void proc_jump_error(int, VALUE));
+static void
+proc_jump_error(state, result)
+ int state;
+ VALUE result;
+{
+ char mesg[32];
+ char *statement;
+
+ switch (state) {
+ case TAG_BREAK:
+ statement = "break"; break;
+ case TAG_RETURN:
+ statement = "return"; break;
+ case TAG_RETRY:
+ statement = "retry"; break;
+ default:
+ statement = "local-jump"; break; /* should not happen */
+ }
+ snprintf(mesg, sizeof mesg, "%s from proc-closure", statement);
+ localjump_error(mesg, result, state);
+}
+
+static void
+return_jump(retval)
+ VALUE retval;
+{
+ struct tag *tt = prot_tag;
+ int yield = Qfalse;
+
+ if (retval == Qundef) retval = Qnil;
+ while (tt) {
+ if (tt->tag == PROT_YIELD) {
+ yield = Qtrue;
+ tt = tt->prev;
+ }
+ if (tt->tag == PROT_FUNC && tt->frame->uniq == ruby_frame->uniq) {
+ tt->dst = (VALUE)ruby_frame->uniq;
+ tt->retval = retval;
+ JUMP_TAG(TAG_RETURN);
+ }
+ if (tt->tag == PROT_LAMBDA && !yield) {
+ tt->dst = (VALUE)tt->frame->uniq;
+ tt->retval = retval;
+ JUMP_TAG(TAG_RETURN);
+ }
+ if (tt->tag == PROT_THREAD) {
+ rb_raise(rb_eThreadError, "return can't jump across threads");
+ }
+ tt = tt->prev;
+ }
+ localjump_error("unexpected return", retval, TAG_RETURN);
+}
+
+static void
+break_jump(retval)
+ VALUE retval;
+{
+ struct tag *tt = prot_tag;
+
+ if (retval == Qundef) retval = Qnil;
+ while (tt) {
+ switch (tt->tag) {
+ case PROT_THREAD:
+ case PROT_YIELD:
+ case PROT_LOOP:
+ case PROT_LAMBDA:
+ tt->dst = (VALUE)tt->frame->uniq;
+ tt->retval = retval;
+ JUMP_TAG(TAG_BREAK);
+ break;
+ default:
+ break;
+ }
+ tt = tt->prev;
+ }
+ localjump_error("unexpected break", retval, TAG_BREAK);
+}
+
+static VALUE
+rb_yield_0(val, self, klass, flags, avalue)
+ VALUE val, self, klass; /* OK */
+ int flags, avalue;
{
NODE *node;
volatile VALUE result = Qnil;
- struct BLOCK *block;
- struct SCOPE *old_scope;
+ volatile VALUE old_cref;
+ volatile VALUE old_wrapper;
+ struct BLOCK * volatile block;
+ struct SCOPE * volatile old_scope;
+ int old_vmode;
struct FRAME frame;
+ NODE *cnode = ruby_current_node;
+ int lambda = flags & YIELD_LAMBDA_CALL;
int state;
- static unsigned serial = 1;
- if (!iterator_p() || !the_block) {
- Raise(eLocalJumpError, "yield called out of iterator");
+ if (!rb_block_given_p()) {
+ localjump_error("no block given", Qnil, 0);
}
PUSH_VARS();
- PUSH_CLASS();
- block = the_block;
+ block = ruby_block;
frame = block->frame;
- frame.prev = the_frame;
- the_frame = &(frame);
- old_scope = the_scope;
- the_scope = block->scope;
- the_block = block->prev;
- mark_dvar(block->d_vars);
- the_class = block->klass;
- if (!self) self = block->self;
+ frame.prev = ruby_frame;
+ ruby_frame = &(frame);
+ old_cref = (VALUE)ruby_cref;
+ ruby_cref = block->cref;
+ old_wrapper = ruby_wrapper;
+ ruby_wrapper = block->wrapper;
+ old_scope = ruby_scope;
+ ruby_scope = block->scope;
+ old_vmode = scope_vmode;
+ scope_vmode = (flags & YIELD_PUBLIC_DEF) ? SCOPE_PUBLIC : block->vmode;
+ ruby_block = block->prev;
+ if (block->flags & BLOCK_D_SCOPE) {
+ /* put place holder for dynamic (in-block) local variables */
+ ruby_dyna_vars = new_dvar(0, 0, block->dyna_vars);
+ }
+ else {
+ /* FOR does not introduce new scope */
+ ruby_dyna_vars = block->dyna_vars;
+ }
+ PUSH_CLASS(klass ? klass : block->klass);
+ if (!klass) {
+ self = block->self;
+ }
node = block->body;
+
if (block->var) {
- if (nd_type(block->var) == NODE_MASGN)
- massign(self, block->var, val);
- else
- assign(self, block->var, val);
+ PUSH_TAG(PROT_NONE);
+ if ((state = EXEC_TAG()) == 0) {
+ if (block->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) {
+ 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) {
+ if (!avalue) {
+ val = svalue_to_mrhs(val, block->var->nd_head);
+ }
+ massign(self, block->var, val, lambda);
+ }
+ else {
+ int len = 0;
+ if (avalue) {
+ len = RARRAY(val)->len;
+ if (len == 0) {
+ goto zero_arg;
+ }
+ if (len == 1) {
+ val = RARRAY(val)->ptr[0];
+ }
+ else {
+ goto multi_values;
+ }
+ }
+ else if (val == Qundef) {
+ zero_arg:
+ val = Qnil;
+ multi_values:
+ {
+ ruby_current_node = block->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);
+ }
+ }
+ POP_TAG();
+ if (state) goto pop_state;
}
+ if (!node) {
+ state = 0;
+ goto pop_state;
+ }
+ ruby_current_node = node;
+
PUSH_ITER(block->iter);
- PUSH_TAG(PROT_NONE);
+ PUSH_TAG(lambda ? PROT_NONE : PROT_YIELD);
if ((state = EXEC_TAG()) == 0) {
redo:
- if (!node) {
- result = Qnil;
- }
- else if (nd_type(node) == NODE_CFUNC) {
+ if (nd_type(node) == NODE_CFUNC || nd_type(node) == NODE_IFUNC) {
+ if (node->nd_state == YIELD_FUNC_AVALUE) {
+ if (!avalue) {
+ val = svalue_to_avalue(val);
+ }
+ }
+ else {
+ if (avalue) {
+ val = avalue_to_svalue(val);
+ }
+ if (val == Qundef && node->nd_state != YIELD_FUNC_SVALUE)
+ val = Qnil;
+ }
result = (*node->nd_cfnc)(val, node->nd_tval, self);
}
else {
@@ -2924,16 +4718,19 @@ rb_yield_0(val, self)
switch (state) {
case TAG_REDO:
state = 0;
+ CHECK_INTS;
goto redo;
case TAG_NEXT:
state = 0;
- result = Qnil;
+ result = prot_tag->retval;
break;
case TAG_BREAK:
- case TAG_RETURN:
- state |= (serial++ << 8);
- state |= 0x10;
- block->tag->dst = state;
+ if (TAG_DST()) {
+ result = prot_tag->retval;
+ }
+ else {
+ lambda = Qtrue; /* just pass TAG_BREAK */
+ }
break;
default:
break;
@@ -2941,12 +4738,54 @@ rb_yield_0(val, self)
}
POP_TAG();
POP_ITER();
+ pop_state:
POP_CLASS();
+ if (ruby_dyna_vars && (block->flags & BLOCK_D_SCOPE) &&
+ !FL_TEST(ruby_dyna_vars, DVAR_DONT_RECYCLE)) {
+ struct RVarmap *vars = ruby_dyna_vars;
+
+ if (ruby_dyna_vars->id == 0) {
+ vars = ruby_dyna_vars->next;
+ rb_gc_force_recycle((VALUE)ruby_dyna_vars);
+ while (vars && vars->id != 0 && vars != block->dyna_vars) {
+ struct RVarmap *tmp = vars->next;
+ rb_gc_force_recycle((VALUE)vars);
+ vars = tmp;
+ }
+ }
+ }
POP_VARS();
- the_block = block;
- the_frame = the_frame->prev;
- the_scope = old_scope;
- if (state) JUMP_TAG(state);
+ ruby_block = block;
+ ruby_frame = ruby_frame->prev;
+ ruby_cref = (NODE*)old_cref;
+ ruby_wrapper = old_wrapper;
+ if (ruby_scope->flags & SCOPE_DONT_RECYCLE)
+ scope_dup(old_scope);
+ ruby_scope = old_scope;
+ scope_vmode = old_vmode;
+ switch (state) {
+ case 0:
+ break;
+ case TAG_BREAK:
+ if (!lambda) {
+ struct tag *tt = prot_tag;
+
+ while (tt) {
+ if (tt->tag == PROT_LOOP && tt->blkid == ruby_block->uniq) {
+ tt->dst = (VALUE)tt->frame->uniq;
+ tt->retval = result;
+ JUMP_TAG(TAG_BREAK);
+ }
+ tt = tt->prev;
+ }
+ proc_jump_error(TAG_BREAK, result);
+ }
+ /* fall through */
+ default:
+ JUMP_TAG(state);
+ break;
+ }
+ ruby_current_node = cnode;
return result;
}
@@ -2954,60 +4793,133 @@ VALUE
rb_yield(val)
VALUE val;
{
- return rb_yield_0(val, 0);
+ return rb_yield_0(val, 0, 0, 0, Qfalse);
+}
+
+VALUE
+#ifdef HAVE_STDARG_PROTOTYPES
+rb_yield_values(int n, ...)
+#else
+rb_yield_values(n, va_alist)
+ int n;
+ va_dcl
+#endif
+{
+ va_list args;
+ VALUE ary;
+
+ if (n == 0) {
+ return rb_yield_0(Qundef, 0, 0, 0, Qfalse);
+ }
+ ary = rb_ary_new2(n);
+ va_init_list(args, n);
+ while (n--) {
+ rb_ary_push(ary, va_arg(args, VALUE));
+ }
+ va_end(args);
+ return rb_yield_0(ary, 0, 0, 0, Qtrue);
}
+VALUE
+rb_yield_splat(values)
+ VALUE values;
+{
+ int avalue = Qfalse;
+
+ if (TYPE(values) == T_ARRAY) {
+ if (RARRAY(values)->len == 0) {
+ values = Qundef;
+ }
+ else {
+ avalue = Qtrue;
+ }
+ }
+ return rb_yield_0(values, 0, 0, 0, avalue);
+}
+
+/*
+ * call-seq:
+ * loop {|| block }
+ *
+ * Repeatedly executes the block.
+ *
+ * loop do
+ * print "Input: "
+ * line = gets
+ * break if !line or line =~ /^qQ/
+ * # ...
+ * end
+ */
+
static VALUE
-f_loop()
+rb_f_loop()
{
- for (;;) { rb_yield(Qnil); }
+ for (;;) {
+ rb_yield_0(Qundef, 0, 0, 0, Qfalse);
+ CHECK_INTS;
+ }
+ return Qnil; /* dummy */
}
static VALUE
-massign(self, node, val)
+massign(self, node, val, pcall)
VALUE self;
NODE *node;
VALUE val;
+ int pcall;
{
NODE *list;
- int i, len;
+ long i = 0, len;
+ len = RARRAY(val)->len;
list = node->nd_head;
-
- if (val) {
- if (TYPE(val) != T_ARRAY) {
- val = rb_Array(val);
+ for (; list && i<len; i++) {
+ assign(self, list->nd_head, RARRAY(val)->ptr[i], pcall);
+ list = list->nd_next;
+ }
+ if (pcall && list) goto arg_error;
+ if (node->nd_args) {
+ if ((long)(node->nd_args) == -1) {
+ /* no check for mere `*' */
}
- len = RARRAY(val)->len;
- for (i=0; list && i<len; i++) {
- assign(self, list->nd_head, RARRAY(val)->ptr[i]);
- list = list->nd_next;
+ else if (!list && i<len) {
+ assign(self, node->nd_args, rb_ary_new4(len-i, RARRAY(val)->ptr+i), pcall);
}
- if (node->nd_args) {
- if (!list && i<len) {
- assign(self, node->nd_args, ary_new4(len-i, RARRAY(val)->ptr+i));
- }
- else {
- assign(self, node->nd_args, ary_new2(0));
- }
+ else {
+ assign(self, node->nd_args, rb_ary_new2(0), pcall);
}
}
- else if (node->nd_args) {
- assign(self, node->nd_args, Qnil);
+ else if (pcall && i < len) {
+ goto arg_error;
}
+
while (list) {
- assign(self, list->nd_head, Qnil);
+ i++;
+ assign(self, list->nd_head, Qnil, pcall);
list = list->nd_next;
}
return val;
+
+ arg_error:
+ while (list) {
+ i++;
+ list = list->nd_next;
+ }
+ rb_raise(rb_eArgError, "wrong number of arguments (%ld for %ld)", len, i);
}
static void
-assign(self, lhs, val)
+assign(self, lhs, val, pcall)
VALUE self;
NODE *lhs;
VALUE val;
+ int pcall;
{
+ ruby_current_node = lhs;
+ if (val == Qundef) {
+ rb_warning("assigning void value");
+ val = Qnil;
+ }
switch (nd_type(lhs)) {
case NODE_GASGN:
rb_gvar_set(lhs->nd_entry, val);
@@ -3018,96 +4930,115 @@ assign(self, lhs, val)
break;
case NODE_LASGN:
- if (the_scope->local_vars == 0)
- Bug("unexpected iterator variable assignment");
- the_scope->local_vars[lhs->nd_cnt] = val;
+ if (ruby_scope->local_vars == 0)
+ rb_bug("unexpected local variable assignment");
+ ruby_scope->local_vars[lhs->nd_cnt] = val;
break;
case NODE_DASGN:
- dyna_var_asgn(lhs->nd_vid, val);
+ dvar_asgn(lhs->nd_vid, val);
+ break;
+
+ case NODE_DASGN_CURR:
+ dvar_asgn_curr(lhs->nd_vid, val);
+ break;
+
+ case NODE_CDECL:
+ if (lhs->nd_vid == 0) {
+ rb_const_set(class_prefix(self, lhs->nd_else), lhs->nd_else->nd_mid, val);
+ }
+ else {
+ rb_const_set(ruby_cbase, lhs->nd_vid, val);
+ }
break;
- case NODE_DASGN_PUSH:
- dvar_asgn_push(lhs->nd_vid, val);
+ case NODE_CVDECL:
+ if (RTEST(ruby_verbose) && FL_TEST(ruby_cbase, FL_SINGLETON)) {
+ rb_warn("declaring singleton class variable");
+ }
+ rb_cvar_set(cvar_cbase(), lhs->nd_vid, val, Qtrue);
break;
- case NODE_CASGN:
- rb_const_set(the_class, lhs->nd_vid, val);
+ case NODE_CVASGN:
+ rb_cvar_set(cvar_cbase(), lhs->nd_vid, val, Qfalse);
break;
case NODE_MASGN:
- massign(self, lhs, val);
+ massign(self, lhs, svalue_to_mrhs(val, lhs->nd_head), pcall);
break;
case NODE_CALL:
+ case NODE_ATTRASGN:
{
VALUE recv;
- recv = rb_eval(self, lhs->nd_recv);
- if (!lhs->nd_args->nd_head) {
+ int scope;
+ if (lhs->nd_recv == (NODE *)1) {
+ recv = self;
+ scope = 1;
+ }
+ else {
+ recv = rb_eval(self, lhs->nd_recv);
+ scope = 0;
+ }
+ if (!lhs->nd_args) {
/* attr set */
- rb_call(CLASS_OF(recv), recv, lhs->nd_mid, 1, &val, 0);
+ ruby_current_node = lhs;
+ SET_CURRENT_SOURCE();
+ rb_call(CLASS_OF(recv), recv, lhs->nd_mid, 1, &val, scope);
}
else {
/* array set */
VALUE args;
args = rb_eval(self, lhs->nd_args);
- RARRAY(args)->ptr[RARRAY(args)->len-1] = val;
+ rb_ary_push(args, val);
+ ruby_current_node = lhs;
+ SET_CURRENT_SOURCE();
rb_call(CLASS_OF(recv), recv, lhs->nd_mid,
- RARRAY(args)->len, RARRAY(args)->ptr, 0);
+ RARRAY(args)->len, RARRAY(args)->ptr, scope);
}
}
break;
default:
- Bug("bug in variable assignment");
+ rb_bug("bug in variable assignment");
break;
}
}
VALUE
rb_iterate(it_proc, data1, bl_proc, data2)
- VALUE (*it_proc)(), (*bl_proc)();
+ VALUE (*it_proc) _((VALUE)), (*bl_proc)(ANYARGS);
VALUE data1, data2;
{
int state;
volatile VALUE retval = Qnil;
- NODE *node = NEW_CFUNC(bl_proc, data2);
- VALUE self = TopSelf;
+ NODE *node = NEW_IFUNC(bl_proc, data2);
+ VALUE self = ruby_top_self;
- iter_retry:
PUSH_ITER(ITER_PRE);
+ PUSH_TAG(PROT_LOOP);
PUSH_BLOCK(0, node);
- PUSH_TAG(PROT_NONE);
-
state = EXEC_TAG();
if (state == 0) {
+ iter_retry:
retval = (*it_proc)(data1);
}
- if (the_block->tag->dst == state) {
- state &= TAG_MASK;
- if (state == TAG_RETURN) {
- retval = prot_tag->retval;
- }
+ else if (state == TAG_BREAK && TAG_DST()) {
+ retval = prot_tag->retval;
+ state = 0;
+ }
+ else if (state == TAG_RETRY) {
+ state = 0;
+ goto iter_retry;
}
- POP_TAG();
POP_BLOCK();
+ POP_TAG();
POP_ITER();
switch (state) {
case 0:
break;
-
- case TAG_RETRY:
- goto iter_retry;
-
- case TAG_BREAK:
- retval = Qnil;
- break;
-
- case TAG_RETURN:
- return_value(retval);
- /* fall through */
default:
JUMP_TAG(state);
}
@@ -3123,7 +5054,7 @@ handle_rescue(self, node)
TMP_PROTECT;
if (!node->nd_args) {
- return obj_is_kind_of(errinfo, eStandardError);
+ return rb_obj_is_kind_of(ruby_errinfo, rb_eStandardError);
}
BEGIN_CALLARGS;
@@ -3131,47 +5062,68 @@ handle_rescue(self, node)
END_CALLARGS;
while (argc--) {
- if (!obj_is_kind_of(argv[0], cModule)) {
- TypeError("class or module required for rescue clause");
+ if (!rb_obj_is_kind_of(argv[0], rb_cModule)) {
+ rb_raise(rb_eTypeError, "class or module required for rescue clause");
}
- if (obj_is_kind_of(errinfo, argv[0])) return 1;
+ if (RTEST(rb_funcall(*argv, eqq, 1, ruby_errinfo))) return 1;
argv++;
}
return 0;
}
VALUE
-rb_rescue(b_proc, data1, r_proc, data2)
- VALUE (*b_proc)(), (*r_proc)();
+#ifdef HAVE_STDARG_PROTOTYPES
+rb_rescue2(VALUE (*b_proc)(ANYARGS), VALUE data1, VALUE (*r_proc)(ANYARGS), VALUE data2, ...)
+#else
+rb_rescue2(b_proc, data1, r_proc, data2, va_alist)
+ VALUE (*b_proc)(ANYARGS), (*r_proc)(ANYARGS);
VALUE data1, data2;
+ va_dcl
+#endif
{
int state;
volatile VALUE result;
- volatile VALUE e_info = errinfo;
+ volatile VALUE e_info = ruby_errinfo;
+ va_list args;
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
retry_entry:
result = (*b_proc)(data1);
}
- else if (state == TAG_RAISE && obj_is_kind_of(errinfo, eStandardError)) {
- if (r_proc) {
- PUSH_TAG(PROT_NONE);
- if ((state = EXEC_TAG()) == 0) {
- result = (*r_proc)(data2, errinfo);
+ else if (state == TAG_RAISE) {
+ int handle = Qfalse;
+ VALUE eclass;
+
+ va_init_list(args, data2);
+ while (eclass = va_arg(args, VALUE)) {
+ if (rb_obj_is_kind_of(ruby_errinfo, eclass)) {
+ handle = Qtrue;
+ break;
}
- POP_TAG();
- if (state == TAG_RETRY) {
+ }
+ va_end(args);
+
+ if (handle) {
+ if (r_proc) {
+ PUSH_TAG(PROT_NONE);
+ if ((state = EXEC_TAG()) == 0) {
+ result = (*r_proc)(data2, ruby_errinfo);
+ }
+ POP_TAG();
+ if (state == TAG_RETRY) {
+ state = 0;
+ ruby_errinfo = Qnil;
+ goto retry_entry;
+ }
+ }
+ else {
+ result = Qnil;
state = 0;
- goto retry_entry;
}
- }
- else {
- result = Qnil;
- state = 0;
- }
- if (state == 0) {
- errinfo = e_info;
+ if (state == 0) {
+ ruby_errinfo = e_info;
+ }
}
}
POP_TAG();
@@ -3181,10 +5133,43 @@ rb_rescue(b_proc, data1, r_proc, data2)
}
VALUE
+rb_rescue(b_proc, data1, r_proc, data2)
+ VALUE (*b_proc)(), (*r_proc)();
+ VALUE data1, data2;
+{
+ return rb_rescue2(b_proc, data1, r_proc, data2, rb_eStandardError, (VALUE)0);
+}
+
+VALUE
+rb_protect(proc, data, state)
+ VALUE (*proc) _((VALUE));
+ VALUE data;
+ int *state;
+{
+ VALUE result = Qnil; /* OK */
+ int status;
+
+ PUSH_TAG(PROT_NONE);
+ if ((status = EXEC_TAG()) == 0) {
+ result = (*proc)(data);
+ }
+ POP_TAG();
+ if (state) {
+ *state = status;
+ }
+ if (status != 0) {
+ return Qnil;
+ }
+
+ return result;
+}
+
+VALUE
rb_ensure(b_proc, data1, e_proc, data2)
VALUE (*b_proc)();
+ VALUE data1;
VALUE (*e_proc)();
- VALUE data1, data2;
+ VALUE data2;
{
int state;
volatile VALUE result = Qnil;
@@ -3195,142 +5180,273 @@ rb_ensure(b_proc, data1, e_proc, data2)
result = (*b_proc)(data1);
}
POP_TAG();
- retval = prot_tag->retval; /* save retval */
+ retval = prot_tag ? prot_tag->retval : Qnil; /* save retval */
(*e_proc)(data2);
- return_value(retval);
+ if (prot_tag) return_value(retval);
+ if (state) JUMP_TAG(state);
+ return result;
+}
- if (state) {
- JUMP_TAG(state);
+VALUE
+rb_with_disable_interrupt(proc, data)
+ VALUE (*proc)();
+ VALUE data;
+{
+ VALUE result = Qnil; /* OK */
+ int status;
+
+ DEFER_INTS;
+ {
+ int thr_critical = rb_thread_critical;
+
+ rb_thread_critical = Qtrue;
+ PUSH_TAG(PROT_NONE);
+ if ((status = EXEC_TAG()) == 0) {
+ result = (*proc)(data);
+ }
+ POP_TAG();
+ rb_thread_critical = thr_critical;
}
+ ENABLE_INTS;
+ if (status) JUMP_TAG(status);
+
return result;
}
+static inline void
+stack_check()
+{
+ static int overflowing = 0;
+
+ 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);
+ }
+}
+
static int last_call_status;
#define CSTAT_PRIV 1
#define CSTAT_PROT 2
#define CSTAT_VCALL 4
+#define CSTAT_SUPER 8
+
+/*
+ * call-seq:
+ * obj.method_missing(symbol [, *args] ) => result
+ *
+ * Invoked by Ruby when <i>obj</i> is sent a message it cannot handle.
+ * <i>symbol</i> is the symbol for the method called, and <i>args</i>
+ * are any arguments that were passed to it. By default, the interpreter
+ * raises an error when this method is called. However, it is possible
+ * to override the method to provide more dynamic behavior.
+ * The example below creates
+ * a class <code>Roman</code>, which responds to methods with names
+ * consisting of roman numerals, returning the corresponding integer
+ * values.
+ *
+ * class Roman
+ * def romanToInt(str)
+ * # ...
+ * end
+ * def method_missing(methId)
+ * str = methId.id2name
+ * romanToInt(str)
+ * end
+ * end
+ *
+ * r = Roman.new
+ * r.iv #=> 4
+ * r.xxiii #=> 23
+ * r.mm #=> 2000
+ */
static VALUE
-f_missing(argc, argv, obj)
+rb_method_missing(argc, argv, obj)
int argc;
VALUE *argv;
VALUE obj;
{
- ID id;
- VALUE desc = 0;
+ ID id;
+ VALUE exc = rb_eNoMethodError;
char *format = 0;
- char *file = sourcefile;
- int line = sourceline;
-
- id = FIX2INT(argv[0]);
- argc--; argv++;
+ NODE *cnode = ruby_current_node;
- switch (TYPE(obj)) {
- case T_NIL:
- format = "undefined method `%s' for nil";
- break;
- case T_TRUE:
- format = "undefined method `%s' for TRUE";
- break;
- case T_FALSE:
- format = "undefined method `%s' for FALSE";
- break;
- case T_OBJECT:
- desc = any_to_s(obj);
- break;
- default:
- desc = rb_inspect(obj);
- break;
+ if (argc == 0 || !SYMBOL_P(argv[0])) {
+ rb_raise(rb_eArgError, "no id given");
}
- if (desc) {
- if (last_call_status & CSTAT_PRIV) {
- format = "private method `%s' called for %s";
- }
- if (last_call_status & CSTAT_PROT) {
- format = "protected method `%s' called for %s";
- }
- else if (iterator_p()) {
- format = "undefined iterator `%s' for %s";
- }
- else if (last_call_status & CSTAT_VCALL) {
- char *mname = rb_id2name(id);
- if (('a' <= mname[0] && mname[0] <= 'z') || mname[0] == '_') {
- format = "undefined local variable or method `%s' for %s";
- }
- }
- if (!format) {
- format = "undefined method `%s' for %s";
- }
- if (RSTRING(desc)->len > 65) {
- desc = any_to_s(obj);
- }
+ stack_check();
+
+ id = SYM2ID(argv[0]);
+
+ if (last_call_status & CSTAT_PRIV) {
+ format = "private method `%s' called for %s";
+ }
+ else if (last_call_status & CSTAT_PROT) {
+ format = "protected method `%s' called for %s";
+ }
+ else if (last_call_status & CSTAT_VCALL) {
+ format = "undefined local variable or method `%s' for %s";
+ exc = rb_eNameError;
+ }
+ else if (last_call_status & CSTAT_SUPER) {
+ format = "super: no superclass method `%s'";
+ }
+ if (!format) {
+ format = "undefined method `%s' for %s";
}
- sourcefile = file;
- sourceline = line;
- PUSH_FRAME(); /* fake frame */
- *the_frame = *_frame.prev->prev;
+ ruby_current_node = cnode;
+ {
+ int n = 0;
+ VALUE args[3];
- NameError(format,
- rb_id2name(id),
- desc?(char*)RSTRING(desc)->ptr:"");
- POP_FRAME();
+ args[n++] = rb_funcall(rb_const_get(exc, rb_intern("message")), '!',
+ 3, rb_str_new2(format), obj, argv[0]);
+ args[n++] = argv[0];
+ if (exc == rb_eNoMethodError) {
+ args[n++] = rb_ary_new4(argc-1, argv+1);
+ }
+ exc = rb_class_new_instance(n, args, exc);
+ ruby_frame = ruby_frame->prev; /* pop frame for "method_missing" */
+ rb_exc_raise(exc);
+ }
return Qnil; /* not reached */
}
static VALUE
-rb_undefined(obj, id, argc, argv, call_status)
+method_missing(obj, id, argc, argv, call_status)
VALUE obj;
ID id;
int argc;
- VALUE*argv;
+ const VALUE *argv;
int call_status;
{
VALUE *nargv;
+ last_call_status = call_status;
+
+ if (id == missing) {
+ PUSH_FRAME();
+ rb_method_missing(argc, argv, obj);
+ POP_FRAME();
+ }
+ else if (id == ID_ALLOCATOR) {
+ rb_raise(rb_eNoMethodError, "allocator undefined for %s", rb_class2name(obj));
+ }
+
nargv = ALLOCA_N(VALUE, argc+1);
- nargv[0] = INT2FIX(id);
+ nargv[0] = ID2SYM(id);
MEMCPY(nargv+1, argv, VALUE, argc);
- last_call_status = call_status;
-
- return rb_funcall2(obj, rb_intern("method_missing"), argc+1, nargv);
+ return rb_funcall2(obj, missing, argc+1, nargv);
}
-#ifdef DJGPP
-# define STACK_LEVEL_MAX 65535
-#else
-#ifdef __human68k__
-extern int _stacksize;
-# define STACK_LEVEL_MAX (_stacksize - 4096)
-#else
-# define STACK_LEVEL_MAX 655350
-#endif
-#endif
-extern VALUE *gc_stack_start;
-static int
-stack_length()
+static inline VALUE
+call_cfunc(func, recv, len, argc, argv)
+ VALUE (*func)();
+ VALUE recv;
+ int len, argc;
+ VALUE *argv;
{
- VALUE pos;
+ if (len >= 0 && argc != len) {
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
+ argc, len);
+ }
-#ifdef sparc
- return gc_stack_start - &pos + 0x80;
-#else
- return (&pos < gc_stack_start) ? gc_stack_start - &pos
- : &pos - gc_stack_start;
-#endif
+ switch (len) {
+ case -2:
+ return (*func)(recv, rb_ary_new4(argc, argv));
+ break;
+ case -1:
+ return (*func)(argc, argv, recv);
+ break;
+ case 0:
+ return (*func)(recv);
+ break;
+ case 1:
+ return (*func)(recv, argv[0]);
+ break;
+ case 2:
+ return (*func)(recv, argv[0], argv[1]);
+ break;
+ case 3:
+ return (*func)(recv, argv[0], argv[1], argv[2]);
+ break;
+ case 4:
+ return (*func)(recv, argv[0], argv[1], argv[2], argv[3]);
+ break;
+ case 5:
+ return (*func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4]);
+ break;
+ case 6:
+ return (*func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4],
+ argv[5]);
+ break;
+ case 7:
+ return (*func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4],
+ argv[5], argv[6]);
+ break;
+ case 8:
+ return (*func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4],
+ argv[5], argv[6], argv[7]);
+ break;
+ case 9:
+ return (*func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4],
+ argv[5], argv[6], argv[7], argv[8]);
+ break;
+ case 10:
+ return (*func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4],
+ argv[5], argv[6], argv[7], argv[8], argv[9]);
+ break;
+ case 11:
+ return (*func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4],
+ argv[5], argv[6], argv[7], argv[8], argv[9], argv[10]);
+ break;
+ case 12:
+ return (*func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4],
+ argv[5], argv[6], argv[7], argv[8], argv[9],
+ argv[10], argv[11]);
+ break;
+ case 13:
+ return (*func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4],
+ argv[5], argv[6], argv[7], argv[8], argv[9], argv[10],
+ argv[11], argv[12]);
+ break;
+ case 14:
+ return (*func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4],
+ argv[5], argv[6], argv[7], argv[8], argv[9], argv[10],
+ argv[11], argv[12], argv[13]);
+ break;
+ case 15:
+ return (*func)(recv, argv[0], argv[1], argv[2], argv[3], argv[4],
+ argv[5], argv[6], argv[7], argv[8], argv[9], argv[10],
+ argv[11], argv[12], argv[13], argv[14]);
+ break;
+ default:
+ rb_raise(rb_eArgError, "too many arguments(%d)", len);
+ break;
+ }
+ return Qnil; /* not reached */
}
static VALUE
-rb_call0(klass, recv, id, argc, argv, body, nosuper)
+rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
VALUE klass, recv;
ID id;
+ ID oid;
int argc; /* OK */
VALUE *argv; /* OK */
- NODE *body;
+ NODE *body; /* OK */
int nosuper;
{
NODE *b2; /* OK */
@@ -3339,7 +5455,7 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper)
static int tick;
TMP_PROTECT;
- switch (the_iter->iter) {
+ switch (ruby_iter->iter) {
case ITER_PRE:
itr = ITER_CUR;
break;
@@ -3349,161 +5465,99 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper)
break;
}
- if ((++tick & 0x3ff) == 0 && stack_length() > STACK_LEVEL_MAX)
- Raise(eSysStackError, "stack level too deep");
-
+ if ((++tick & 0xff) == 0) {
+ CHECK_INTS; /* better than nothing */
+ stack_check();
+ rb_gc_finalize_deferred();
+ }
PUSH_ITER(itr);
PUSH_FRAME();
- the_frame->last_func = id;
- the_frame->last_class = nosuper?0:klass;
- the_frame->self = recv;
- the_frame->argc = argc;
- the_frame->argv = argv;
+
+ ruby_frame->last_func = id;
+ ruby_frame->orig_func = oid;
+ ruby_frame->last_class = nosuper?0:klass;
+ ruby_frame->self = recv;
+ ruby_frame->argc = argc;
+ ruby_frame->argv = argv;
switch (nd_type(body)) {
case NODE_CFUNC:
{
int len = body->nd_argc;
- if (len >= 0 && argc != len) {
- ArgError("Wrong # of arguments(%d for %d)", argc, len);
+ if (len < -2) {
+ rb_bug("bad argc(%d) specified for `%s(%s)'",
+ len, rb_class2name(klass), rb_id2name(id));
}
+ if (trace_func) {
+ int state;
- switch (len) {
- case -2:
- result = (*body->nd_cfnc)(recv, ary_new4(argc, argv));
- break;
- case -1:
- result = (*body->nd_cfnc)(argc, argv, recv);
- break;
- case 0:
- result = (*body->nd_cfnc)(recv);
- break;
- case 1:
- result = (*body->nd_cfnc)(recv, argv[0]);
- break;
- case 2:
- result = (*body->nd_cfnc)(recv, argv[0], argv[1]);
- break;
- case 3:
- result = (*body->nd_cfnc)(recv, argv[0], argv[1], argv[2]);
- break;
- case 4:
- result = (*body->nd_cfnc)(recv, argv[0], argv[1], argv[2],
- argv[3]);
- break;
- case 5:
- result = (*body->nd_cfnc)(recv, argv[0], argv[1], argv[2],
- argv[3], argv[4]);
- break;
- case 6:
- result = (*body->nd_cfnc)(recv, argv[0], argv[1], argv[2],
- argv[3], argv[4], argv[5]);
- break;
- case 7:
- result = (*body->nd_cfnc)(recv, argv[0], argv[1], argv[2],
- argv[3], argv[4], argv[5],
- argv[6]);
- break;
- case 8:
- result = (*body->nd_cfnc)(recv, argv[0], argv[1], argv[2],
- argv[3], argv[4], argv[5],
- argv[6], argv[7]);
- break;
- case 9:
- result = (*body->nd_cfnc)(recv, argv[0], argv[1], argv[2],
- argv[3], argv[4], argv[5],
- argv[6], argv[7], argv[8]);
- break;
- case 10:
- result = (*body->nd_cfnc)(recv, argv[0], argv[1], argv[2],
- argv[3], argv[4], argv[5],
- argv[6], argv[7], argv[8],
- argv[6], argv[7], argv[8],
- argv[9]);
- break;
- case 11:
- result = (*body->nd_cfnc)(recv, argv[0], argv[1], argv[2],
- argv[3], argv[4], argv[5],
- argv[6], argv[7], argv[8],
- argv[6], argv[7], argv[8],
- argv[9], argv[10]);
- break;
- case 12:
- result = (*body->nd_cfnc)(recv, argv[0], argv[1], argv[2],
- argv[3], argv[4], argv[5],
- argv[6], argv[7], argv[8],
- argv[6], argv[7], argv[8],
- argv[9], argv[10], argv[11]);
- break;
- case 13:
- result = (*body->nd_cfnc)(recv, argv[0], argv[1], argv[2],
- argv[3], argv[4], argv[5],
- argv[6], argv[7], argv[8],
- argv[6], argv[7], argv[8],
- argv[9], argv[10], argv[11],
- argv[12]);
- break;
- case 14:
- result = (*body->nd_cfnc)(recv, argv[0], argv[1], argv[2],
- argv[3], argv[4], argv[5],
- argv[6], argv[7], argv[8],
- argv[6], argv[7], argv[8],
- argv[9], argv[10], argv[11],
- argv[12], argv[13]);
- break;
- case 15:
- result = (*body->nd_cfnc)(recv, argv[0], argv[1], argv[2],
- argv[3], argv[4], argv[5],
- argv[6], argv[7], argv[8],
- argv[6], argv[7], argv[8],
- argv[9], argv[10], argv[11],
- argv[12], argv[13], argv[14]);
- break;
- default:
- if (len < 0) {
- Bug("bad argc(%d) specified for `%s(%s)'",
- len, rb_class2name(klass), rb_id2name(id));
- }
- else {
- ArgError("too many arguments(%d)", len);
+ call_trace_func("c-call", ruby_current_node, recv, id, klass);
+ PUSH_TAG(PROT_FUNC);
+ if ((state = EXEC_TAG()) == 0) {
+ result = call_cfunc(body->nd_cfnc, recv, len, argc, argv);
}
- break;
+ POP_TAG();
+ ruby_current_node = ruby_frame->node;
+ call_trace_func("c-return", ruby_current_node, recv, id, klass);
+ if (state) JUMP_TAG(state);
+ }
+ else {
+ result = call_cfunc(body->nd_cfnc, recv, len, argc, argv);
}
}
break;
- /* for re-scoped/renamed method */
- case NODE_ZSUPER:
/* for attr get/set */
- case NODE_ATTRSET:
case NODE_IVAR:
+ if (argc != 0) {
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
+ }
+ result = rb_attr_get(recv, body->nd_vid);
+ break;
+
+ case NODE_ATTRSET:
+ /* for re-scoped/renamed method */
+ case NODE_ZSUPER:
result = rb_eval(recv, body);
break;
- default:
+ case NODE_DMETHOD:
+ result = method_call(argc, argv, umethod_bind(body->nd_cval, recv));
+ break;
+
+ case NODE_BMETHOD:
+ result = proc_invoke(body->nd_cval, rb_ary_new4(argc, argv), recv, klass);
+ break;
+
+ case NODE_SCOPE:
{
int state;
VALUE *local_vars; /* OK */
+ NODE *saved_cref = 0;
PUSH_SCOPE();
- if (body->nd_rval) the_frame->cbase = body->nd_rval;
+ if (body->nd_rval) {
+ saved_cref = ruby_cref;
+ ruby_cref = (NODE*)body->nd_rval;
+ }
+ PUSH_CLASS(ruby_cbase);
if (body->nd_tbl) {
- local_vars = TMP_ALLOC(VALUE, body->nd_tbl[0]+1);
+ local_vars = TMP_ALLOC(body->nd_tbl[0]+1);
*local_vars++ = (VALUE)body;
- memclear(local_vars, body->nd_tbl[0]);
- the_scope->local_tbl = body->nd_tbl;
- the_scope->local_vars = local_vars;
+ rb_mem_clear(local_vars, body->nd_tbl[0]);
+ ruby_scope->local_tbl = body->nd_tbl;
+ ruby_scope->local_vars = local_vars;
}
else {
- local_vars = the_scope->local_vars = 0;
- the_scope->local_tbl = 0;
+ local_vars = ruby_scope->local_vars = 0;
+ ruby_scope->local_tbl = 0;
}
- b2 = body = body->nd_body;
+ b2 = body = body->nd_next;
- PUSH_TAG(PROT_FUNC);
PUSH_VARS();
+ PUSH_TAG(PROT_FUNC);
if ((state = EXEC_TAG()) == 0) {
NODE *node = 0;
@@ -3519,25 +5573,28 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper)
}
if (node) {
if (nd_type(node) != NODE_ARGS) {
- Bug("no argument-node");
+ rb_bug("no argument-node");
}
i = node->nd_cnt;
if (i > argc) {
- ArgError("Wrong # of arguments(%d for %d)", argc, i);
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
+ argc, i);
}
- if (node->nd_rest == -1) {
- int opt = argc - i;
+ if ((long)node->nd_rest == -1) {
+ int opt = i;
NODE *optnode = node->nd_opt;
while (optnode) {
- opt--;
+ opt++;
optnode = optnode->nd_next;
}
- if (opt > 0) {
- ArgError("Wrong # of arguments(%d for %d)",
- argc, argc-opt);
+ if (opt < argc) {
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
+ argc, opt);
}
+ ruby_frame->argc = opt;
+ ruby_frame->argv = local_vars+2;
}
if (local_vars) {
@@ -3550,64 +5607,66 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper)
NODE *opt = node->nd_opt;
while (opt && argc) {
- assign(recv, opt->nd_head, *argv);
+ assign(recv, opt->nd_head, *argv, 1);
argv++; argc--;
opt = opt->nd_next;
}
- rb_eval(recv, opt);
+ if (opt) {
+ rb_eval(recv, opt);
+ }
}
- if (node->nd_rest >= 0) {
+ local_vars = ruby_scope->local_vars;
+ if ((long)node->nd_rest >= 0) {
+ VALUE v;
+
if (argc > 0)
- local_vars[node->nd_rest]=ary_new4(argc,argv);
+ v = rb_ary_new4(argc,argv);
else
- local_vars[node->nd_rest]=ary_new2(0);
+ v = rb_ary_new2(0);
+ ruby_scope->local_vars[node->nd_rest] = v;
}
}
}
if (trace_func) {
- call_trace_func("call", b2->nd_file, nd_line(b2),
- recv, the_frame->last_func);
+ call_trace_func("call", b2, recv, id, klass);
}
result = rb_eval(recv, body);
}
- else if (state == TAG_RETURN) {
+ else if (state == TAG_RETURN && TAG_DST()) {
result = prot_tag->retval;
state = 0;
}
- POP_VARS();
POP_TAG();
+ POP_VARS();
+ POP_CLASS();
POP_SCOPE();
+ ruby_cref = saved_cref;
if (trace_func) {
- char *file = the_frame->prev->file;
- int line = the_frame->prev->line;
- if (!file) {
- file = sourcefile;
- line = sourceline;
- }
- call_trace_func("return", file, line, 0, the_frame->last_func);
+ call_trace_func("return", ruby_frame->prev->node, recv, id, klass);
}
switch (state) {
case 0:
break;
- case TAG_NEXT:
- Raise(eLocalJumpError, "unexpected next");
- break;
case TAG_BREAK:
- Raise(eLocalJumpError, "unexpected break");
- break;
- case TAG_REDO:
- Raise(eLocalJumpError, "unexpected redo");
+ case TAG_RETURN:
+ JUMP_TAG(state);
break;
+
case TAG_RETRY:
- if (!iterator_p()) {
- Raise(eLocalJumpError, "retry outside of rescue clause");
- }
+ if (rb_block_given_p()) JUMP_TAG(state);
+ /* fall through */
default:
- JUMP_TAG(state);
+ jump_tag_but_local_jump(state, result);
+ break;
}
}
+ break;
+
+ default:
+ rb_bug("unknown node type %d", nd_type(body));
+ break;
}
POP_FRAME();
POP_ITER();
@@ -3619,7 +5678,7 @@ rb_call(klass, recv, mid, argc, argv, scope)
VALUE klass, recv;
ID mid;
int argc; /* OK */
- VALUE *argv; /* OK */
+ const VALUE *argv; /* OK */
int scope;
{
NODE *body; /* OK */
@@ -3627,9 +5686,15 @@ rb_call(klass, recv, mid, argc, argv, scope)
ID id = mid;
struct cache_entry *ent;
+ if (!klass) {
+ rb_raise(rb_eNotImpError, "method `%s' called on terminated object (0x%lx)",
+ rb_id2name(mid), recv);
+ }
/* is it in the method cache? */
ent = cache + EXPR1(klass, mid);
if (ent->mid == mid && ent->klass == klass) {
+ if (!ent->method)
+ return method_missing(recv, mid, argc, argv, scope==2?CSTAT_VCALL:0);
klass = ent->origin;
id = ent->mid0;
noex = ent->noex;
@@ -3637,20 +5702,29 @@ rb_call(klass, recv, mid, argc, argv, scope)
}
else if ((body = rb_get_method_body(&klass, &id, &noex)) == 0) {
if (scope == 3) {
- NameError("super: no superclass method `%s'", rb_id2name(mid));
+ return method_missing(recv, mid, argc, argv, CSTAT_SUPER);
}
- return rb_undefined(recv, mid, argc, argv, scope==2?CSTAT_VCALL:0);
+ return method_missing(recv, mid, argc, argv, scope==2?CSTAT_VCALL:0);
}
- /* receiver specified form for private method */
- if ((noex & NOEX_PRIVATE) && scope == 0)
- return rb_undefined(recv, mid, argc, argv, CSTAT_PRIV);
+ if (mid != missing) {
+ /* receiver specified form for private method */
+ if ((noex & NOEX_PRIVATE) && scope == 0)
+ return method_missing(recv, mid, argc, argv, CSTAT_PRIV);
+
+ /* self must be kind of a specified form for protected method */
+ if ((noex & NOEX_PROTECTED)) {
+ VALUE defined_class = klass;
- /* self must be kind of a specified form for private method */
- if ((noex & NOEX_PROTECTED) && !obj_is_kind_of(the_frame->self, klass))
- return rb_undefined(recv, mid, argc, argv, CSTAT_PROT);
+ if (TYPE(defined_class) == T_ICLASS) {
+ defined_class = RBASIC(defined_class)->klass;
+ }
+ if (!rb_obj_is_kind_of(ruby_frame->self, rb_class_real(defined_class)))
+ return method_missing(recv, mid, argc, argv, CSTAT_PROT);
+ }
+ }
- return rb_call0(klass, recv, id, argc, argv, body, noex & NOEX_UNDEF);
+ return rb_call0(klass, recv, mid, id, argc, argv, body, noex & NOEX_NOSUPER);
}
VALUE
@@ -3662,39 +5736,48 @@ rb_apply(recv, mid, args)
int argc;
VALUE *argv;
- argc = RARRAY(args)->len;
+ argc = RARRAY(args)->len; /* Assigns LONG, but argc is INT */
argv = ALLOCA_N(VALUE, argc);
MEMCPY(argv, RARRAY(args)->ptr, VALUE, argc);
return rb_call(CLASS_OF(recv), recv, mid, argc, argv, 1);
}
+/*
+ * call-seq:
+ * obj.send(symbol [, args...]) => obj
+ * obj.__send__(symbol [, args...]) => obj
+ *
+ * Invokes the method identified by _symbol_, passing it any
+ * arguments specified. You can use <code>__send__</code> if the name
+ * +send+ clashes with an existing method in _obj_.
+ *
+ * class Klass
+ * def hello(*args)
+ * "Hello " + args.join(' ')
+ * end
+ * end
+ * k = Klass.new
+ * k.send :hello, "gentle", "readers" #=> "Hello gentle readers"
+ */
+
static VALUE
-f_send(argc, argv, recv)
+rb_f_send(argc, argv, recv)
int argc;
VALUE *argv;
VALUE recv;
{
VALUE vid;
- if (argc == 0) ArgError("no method name given");
+ if (argc == 0) rb_raise(rb_eArgError, "no method name given");
vid = *argv++; argc--;
- PUSH_ITER(iterator_p()?ITER_PRE:ITER_NOT);
+ PUSH_ITER(rb_block_given_p()?ITER_PRE:ITER_NOT);
vid = rb_call(CLASS_OF(recv), recv, rb_to_id(vid), argc, argv, 1);
POP_ITER();
return vid;
}
-
-#ifdef HAVE_STDARG_PROTOTYPES
-#include <stdarg.h>
-#define va_init_list(a,b) va_start(a,b)
-#else
-#include <varargs.h>
-#define va_init_list(a,b) va_start(a)
-#endif
-
VALUE
#ifdef HAVE_STDARG_PROTOTYPES
rb_funcall(VALUE recv, ID mid, int n, ...)
@@ -3710,7 +5793,7 @@ rb_funcall(recv, mid, n, va_alist)
VALUE *argv;
if (n > 0) {
- int i;
+ long i;
argv = ALLOCA_N(VALUE, n);
@@ -3732,56 +5815,124 @@ rb_funcall2(recv, mid, argc, argv)
VALUE recv;
ID mid;
int argc;
- VALUE *argv;
+ const VALUE *argv;
{
return rb_call(CLASS_OF(recv), recv, mid, argc, argv, 1);
}
+VALUE
+rb_funcall3(recv, mid, argc, argv)
+ VALUE recv;
+ ID mid;
+ int argc;
+ const VALUE *argv;
+{
+ return rb_call(CLASS_OF(recv), recv, mid, argc, argv, 0);
+}
+
+VALUE
+rb_call_super(argc, argv)
+ int argc;
+ const VALUE *argv;
+{
+ VALUE result, self, klass, k;
+
+ if (ruby_frame->last_class == 0) {
+ rb_name_error(ruby_frame->last_func, "calling `super' from `%s' is prohibited",
+ rb_id2name(ruby_frame->last_func));
+ }
+
+ self = ruby_frame->self;
+ klass = ruby_frame->last_class;
+
+ PUSH_ITER(ruby_iter->iter ? ITER_PRE : ITER_NOT);
+ result = rb_call(RCLASS(klass)->super, self, ruby_frame->orig_func, argc, argv, 3);
+ POP_ITER();
+
+ return result;
+}
+
static VALUE
backtrace(lev)
int lev;
{
- struct FRAME *frame = the_frame;
+ struct FRAME *frame = ruby_frame;
char buf[BUFSIZ];
VALUE ary;
- int slev = safe_level;
+ NODE *n;
- safe_level = 0;
- ary = ary_new();
+ ary = rb_ary_new();
+ if (frame->last_func == ID_ALLOCATOR) {
+ frame = frame->prev;
+ }
if (lev < 0) {
+ ruby_set_current_source();
if (frame->last_func) {
- snprintf(buf, BUFSIZ, "%s:%d:in `%s'", sourcefile, sourceline,
- rb_id2name(frame->last_func));
+ snprintf(buf, BUFSIZ, "%s:%d:in `%s'",
+ ruby_sourcefile, ruby_sourceline,
+ rb_id2name(frame->last_func));
+ }
+ else if (ruby_sourceline == 0) {
+ snprintf(buf, BUFSIZ, "%s", ruby_sourcefile);
}
else {
- snprintf(buf, BUFSIZ, "%s:%d", sourcefile, sourceline);
+ snprintf(buf, BUFSIZ, "%s:%d", ruby_sourcefile, ruby_sourceline);
}
- ary_push(ary, str_new2(buf));
+ rb_ary_push(ary, rb_str_new2(buf));
+ if (lev < -1) return ary;
}
else {
while (lev-- > 0) {
frame = frame->prev;
- if (!frame) return Qnil;
+ if (!frame) {
+ ary = Qnil;
+ break;
+ }
}
}
- while (frame && frame->file) {
+ while (frame && (n = frame->node)) {
if (frame->prev && frame->prev->last_func) {
snprintf(buf, BUFSIZ, "%s:%d:in `%s'",
- frame->file, frame->line,
- rb_id2name(frame->prev->last_func));
+ n->nd_file, nd_line(n),
+ rb_id2name(frame->prev->last_func));
}
else {
- snprintf(buf, BUFSIZ, "%s:%d", frame->file, frame->line);
+ snprintf(buf, BUFSIZ, "%s:%d", n->nd_file, nd_line(n));
}
- ary_push(ary, str_new2(buf));
+ rb_ary_push(ary, rb_str_new2(buf));
frame = frame->prev;
}
- safe_level = slev;
+
return ary;
}
+/*
+ * call-seq:
+ * caller(start=1) => array
+ *
+ * Returns the current execution stack---an array containing strings in
+ * the form ``<em>file:line</em>'' or ``<em>file:line: in
+ * `method'</em>''. The optional _start_ parameter
+ * determines the number of initial stack entries to omit from the
+ * result.
+ *
+ * def a(skip)
+ * caller(skip)
+ * end
+ * def b(skip)
+ * a(skip)
+ * end
+ * def c(skip)
+ * b(skip)
+ * end
+ * c(0) #=> ["prog:2:in `a'", "prog:5:in `b'", "prog:8:in `c'", "prog:10"]
+ * c(1) #=> ["prog:5:in `b'", "prog:8:in `c'", "prog:11"]
+ * c(2) #=> ["prog:8:in `c'", "prog:12"]
+ * c(3) #=> ["prog:13"]
+ */
+
static VALUE
-f_caller(argc, argv)
+rb_f_caller(argc, argv)
int argc;
VALUE *argv;
{
@@ -3792,7 +5943,7 @@ f_caller(argc, argv)
if (NIL_P(level)) lev = 1;
else lev = NUM2INT(level);
- if (lev < 0) ArgError("negative level(%d)", lev);
+ if (lev < 0) rb_raise(rb_eArgError, "negative level(%d)", lev);
return backtrace(lev);
}
@@ -3800,10 +5951,9 @@ f_caller(argc, argv)
void
rb_backtrace()
{
- int i, lev;
+ long i;
VALUE ary;
- lev = INT2FIX(0);
ary = backtrace(-1);
for (i=0; i<RARRAY(ary)->len; i++) {
printf("\tfrom %s\n", RSTRING(RARRAY(ary)->ptr[i])->ptr);
@@ -3813,30 +5963,32 @@ rb_backtrace()
static VALUE
make_backtrace()
{
- VALUE lev;
-
- lev = INT2FIX(0);
return backtrace(-1);
}
ID
rb_frame_last_func()
{
- return the_frame->last_func;
+ return ruby_frame->last_func;
}
static NODE*
-compile(src, place)
+compile(src, file, line)
VALUE src;
- char *place;
+ char *file;
+ int line;
{
NODE *node;
+ int critical;
- Check_Type(src, T_STRING);
- if (place == 0) place = sourcefile;
- node = compile_string(place, RSTRING(src)->ptr, RSTRING(src)->len);
+ ruby_nerrs = 0;
+ StringValue(src);
+ critical = rb_thread_critical;
+ rb_thread_critical = Qtrue;
+ node = rb_compile_string(file, src, line);
+ rb_thread_critical = critical;
- if (nerrs == 0) return node;
+ if (ruby_nerrs == 0) return node;
return 0;
}
@@ -3846,104 +5998,131 @@ eval(self, src, scope, file, line)
char *file;
int line;
{
- struct BLOCK *data;
+ struct BLOCK *data = NULL;
volatile VALUE result = Qnil;
struct SCOPE * volatile old_scope;
struct BLOCK * volatile old_block;
- struct RVarmap * volatile old_d_vars;
+ struct RVarmap * volatile old_dyna_vars;
+ VALUE volatile old_cref;
int volatile old_vmode;
+ volatile VALUE old_wrapper;
struct FRAME frame;
- char *filesave = sourcefile;
- int linesave = sourceline;
- volatile int iter = the_frame->iter;
+ NODE *nodesave = ruby_current_node;
+ volatile int iter = ruby_frame->iter;
+ volatile int safe = ruby_safe_level;
int state;
- if (file == 0) {
- file = sourcefile;
- line = sourceline;
- }
if (!NIL_P(scope)) {
- if (!obj_is_block(scope)) {
- TypeError("wrong argument type %s (expected Proc/Binding)",
- rb_class2name(CLASS_OF(scope)));
+ if (!rb_obj_is_proc(scope)) {
+ rb_raise(rb_eTypeError, "wrong argument type %s (expected Proc/Binding)",
+ rb_obj_classname(scope));
}
Data_Get_Struct(scope, struct BLOCK, data);
-
/* PUSH BLOCK from data */
frame = data->frame;
- frame.prev = the_frame;
- the_frame = &(frame);
- old_scope = the_scope;
- the_scope = data->scope;
- old_block = the_block;
- the_block = data->prev;
- old_d_vars = the_dyna_vars;
- the_dyna_vars = data->d_vars;
+ frame.tmp = ruby_frame; /* gc protection */
+ ruby_frame = &(frame);
+ old_scope = ruby_scope;
+ ruby_scope = data->scope;
+ old_block = ruby_block;
+ ruby_block = data->prev;
+ old_dyna_vars = ruby_dyna_vars;
+ ruby_dyna_vars = data->dyna_vars;
old_vmode = scope_vmode;
scope_vmode = data->vmode;
+ old_cref = (VALUE)ruby_cref;
+ ruby_cref = data->cref;
+ old_wrapper = ruby_wrapper;
+ ruby_wrapper = data->wrapper;
+ if ((file == 0 || (line == 1 && strcmp(file, "(eval)") == 0)) && data->frame.node) {
+ file = data->frame.node->nd_file;
+ if (!file) file = "__builtin__";
+ line = nd_line(data->frame.node);
+ }
self = data->self;
- the_frame->iter = data->iter;
+ ruby_frame->iter = data->iter;
}
else {
- if (the_frame->prev) {
- the_frame->iter = the_frame->prev->iter;
+ if (ruby_frame->prev) {
+ ruby_frame->iter = ruby_frame->prev->iter;
}
}
- PUSH_CLASS();
- the_class = ((NODE*)the_frame->cbase)->nd_clss;
-
- rb_in_eval++;
- if (TYPE(the_class) == T_ICLASS) {
- the_class = RBASIC(the_class)->klass;
+ if (file == 0) {
+ ruby_set_current_source();
+ file = ruby_sourcefile;
+ line = ruby_sourceline;
+ }
+ PUSH_CLASS(ruby_cbase);
+ ruby_in_eval++;
+ if (TYPE(ruby_class) == T_ICLASS) {
+ ruby_class = RBASIC(ruby_class)->klass;
}
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
- sourcefile = file;
- sourceline = line;
- compile(src, file);
- if (nerrs > 0) {
+ NODE *node;
+
+ ruby_safe_level = 0;
+ result = ruby_errinfo;
+ ruby_errinfo = Qnil;
+ node = compile(src, file, line);
+ ruby_safe_level = safe;
+ if (ruby_nerrs > 0) {
compile_error(0);
}
- result = eval_node(self);
+ if (!NIL_P(result)) ruby_errinfo = result;
+ result = eval_node(self, node);
}
POP_TAG();
POP_CLASS();
- rb_in_eval--;
+ ruby_in_eval--;
+ ruby_safe_level = safe;
if (!NIL_P(scope)) {
- the_frame = the_frame->prev;
- the_scope = old_scope;
- the_block = old_block;
- data->d_vars = the_dyna_vars;
- the_dyna_vars = old_d_vars;
+ int dont_recycle = ruby_scope->flags & SCOPE_DONT_RECYCLE;
+
+ ruby_wrapper = old_wrapper;
+ ruby_cref = (NODE*)old_cref;
+ ruby_frame = frame.tmp;
+ ruby_scope = old_scope;
+ ruby_block = old_block;
+ ruby_dyna_vars = old_dyna_vars;
data->vmode = scope_vmode; /* write back visibility mode */
scope_vmode = old_vmode;
+ if (dont_recycle) {
+ struct tag *tag;
+ struct RVarmap *vars;
+
+ scope_dup(ruby_scope);
+ for (tag=prot_tag; tag; tag=tag->prev) {
+ scope_dup(tag->scope);
+ }
+ for (vars = ruby_dyna_vars; vars; vars = vars->next) {
+ FL_SET(vars, DVAR_DONT_RECYCLE);
+ }
+ }
}
else {
- the_frame->iter = iter;
+ ruby_frame->iter = iter;
}
- sourcefile = filesave;
- sourceline = linesave;
+ ruby_current_node = nodesave;
+ ruby_set_current_source();
if (state) {
if (state == TAG_RAISE) {
- VALUE err;
- VALUE errat;
-
- errat = get_backtrace(errinfo);
if (strcmp(file, "(eval)") == 0) {
- if (sourceline > 1) {
- err = RARRAY(errat)->ptr[0];
- str_cat(err, ": ", 2);
- str_concat(err, errinfo);
- }
- else {
- err = str_dup(errinfo);
+ VALUE mesg, errat;
+
+ errat = get_backtrace(ruby_errinfo);
+ mesg = rb_attr_get(ruby_errinfo, rb_intern("mesg"));
+ if (!NIL_P(errat) && TYPE(errat) == T_ARRAY) {
+ 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]);
+ }
+ RARRAY(errat)->ptr[0] = RARRAY(backtrace(-2))->ptr[0];
}
- errat = Qnil;
- rb_raise(exc_new3(CLASS_OF(errinfo), err));
}
- rb_raise(errinfo);
+ rb_exc_raise(ruby_errinfo);
}
JUMP_TAG(state);
}
@@ -3951,48 +6130,91 @@ eval(self, src, scope, file, line)
return result;
}
+/*
+ * call-seq:
+ * eval(string [, binding [, filename [,lineno]]]) => obj
+ *
+ * Evaluates the Ruby expression(s) in <em>string</em>. If
+ * <em>binding</em> is given, the evaluation is performed in its
+ * context. The binding may be a <code>Binding</code> object or a
+ * <code>Proc</code> object. If the optional <em>filename</em> and
+ * <em>lineno</em> parameters are present, they will be used when
+ * reporting syntax errors.
+ *
+ * def getBinding(str)
+ * return binding
+ * end
+ * str = "hello"
+ * eval "str + ' Fred'" #=> "hello Fred"
+ * eval "str + ' Fred'", getBinding("bye") #=> "bye Fred"
+ */
+
static VALUE
-f_eval(argc, argv, self)
+rb_f_eval(argc, argv, self)
int argc;
VALUE *argv;
VALUE self;
{
VALUE src, scope, vfile, vline;
char *file = "(eval)";
- int line = 0;
+ int line = 1;
rb_scan_args(argc, argv, "13", &src, &scope, &vfile, &vline);
+ if (ruby_safe_level >= 4) {
+ StringValue(src);
+ if (!NIL_P(scope) && !OBJ_TAINTED(scope)) {
+ rb_raise(rb_eSecurityError, "Insecure: can't modify trusted binding");
+ }
+ }
+ else {
+ SafeStringValue(src);
+ }
if (argc >= 3) {
- Check_Type(vfile, T_STRING);
- file = RSTRING(vfile)->ptr;
+ StringValue(vfile);
}
if (argc >= 4) {
line = NUM2INT(vline);
}
- Check_SafeStr(src);
+ if (!NIL_P(vfile)) file = RSTRING(vfile)->ptr;
+ if (NIL_P(scope) && ruby_frame->prev) {
+ struct FRAME *prev;
+ VALUE val;
+
+ prev = ruby_frame;
+ PUSH_FRAME();
+ *ruby_frame = *prev->prev;
+ ruby_frame->prev = prev;
+ val = eval(self, src, scope, file, line);
+ POP_FRAME();
+
+ return val;
+ }
return eval(self, src, scope, file, line);
}
+/* function to call func under the specified class/module context */
static VALUE
-exec_under(func, under, args)
+exec_under(func, under, cbase, args)
VALUE (*func)();
- VALUE under;
+ VALUE under, cbase;
void *args;
{
- VALUE val; /* OK */
+ VALUE val = Qnil; /* OK */
int state;
int mode;
- VALUE cbase = the_frame->cbase;
- PUSH_CLASS();
- the_class = under;
+ PUSH_CLASS(under);
PUSH_FRAME();
- the_frame->last_func = _frame.prev->last_func;
- the_frame->last_class = _frame.prev->last_class;
- the_frame->argc = _frame.prev->argc;
- the_frame->argv = _frame.prev->argv;
- the_frame->cbase = (VALUE)node_newnode(NODE_CREF,under,0,cbase);
+ ruby_frame->self = _frame.prev->self;
+ ruby_frame->last_func = _frame.prev->last_func;
+ ruby_frame->last_class = _frame.prev->last_class;
+ ruby_frame->argc = _frame.prev->argc;
+ ruby_frame->argv = _frame.prev->argv;
+ if (cbase) {
+ PUSH_CREF(cbase);
+ }
+
mode = scope_vmode;
SCOPE_SET(SCOPE_PUBLIC);
PUSH_TAG(PROT_NONE);
@@ -4000,6 +6222,7 @@ exec_under(func, under, args)
val = (*func)(args);
}
POP_TAG();
+ if (cbase) POP_CREF();
SCOPE_SET(mode);
POP_FRAME();
POP_CLASS();
@@ -4015,351 +6238,608 @@ eval_under_i(args)
return eval(args[0], args[1], Qnil, (char*)args[2], (int)args[3]);
}
+/* string eval under the class/module context */
static VALUE
eval_under(under, self, src, file, line)
VALUE under, self, src;
- char *file;
+ const char *file;
int line;
{
VALUE args[4];
+ if (ruby_safe_level >= 4) {
+ StringValue(src);
+ }
+ else {
+ SafeStringValue(src);
+ }
args[0] = self;
args[1] = src;
args[2] = (VALUE)file;
args[3] = (VALUE)line;
- return exec_under(eval_under_i, under, args);
+ return exec_under(eval_under_i, under, under, args);
}
static VALUE
yield_under_i(self)
VALUE self;
{
- return rb_yield_0(self, self);
+ return rb_yield_0(self, self, ruby_class, YIELD_PUBLIC_DEF, Qfalse);
}
+/* block eval under the class/module context */
static VALUE
yield_under(under, self)
VALUE under, self;
{
- return exec_under(yield_under_i, under, self);
+ return exec_under(yield_under_i, under, 0, self);
}
static VALUE
-obj_instance_eval(argc, argv, self)
+specific_eval(argc, argv, klass, self)
int argc;
VALUE *argv;
- VALUE self;
+ VALUE klass, self;
{
- char *file = 0;
- int line = 0;
-
- if (argc == 0) {
- if (!iterator_p()) {
- ArgError("block not supplied");
+ if (rb_block_given_p()) {
+ if (argc > 0) {
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
}
- }
- else if (argc < 4) {
- Check_SafeStr(argv[0]);
- if (argc > 1) file = STR2CSTR(argv[1]);
- if (argc > 2) line = NUM2INT(argv[2]);
+ return yield_under(klass, self);
}
else {
- ArgError("Wrong # of arguments: %s(src) or %s{..}",
- rb_id2name(the_frame->last_func),
- rb_id2name(the_frame->last_func));
- }
+ char *file = "(eval)";
+ int line = 1;
- if (argc == 0) {
- return yield_under(rb_singleton_class(self), self);
- }
- else {
- return eval_under(rb_singleton_class(self), self, argv[0], file, line);
- }
-}
+ if (argc == 0) {
+ rb_raise(rb_eArgError, "block not supplied");
+ }
+ else {
+ if (ruby_safe_level >= 4) {
+ StringValue(argv[0]);
+ }
+ else {
+ SafeStringValue(argv[0]);
+ }
+ if (argc > 3) {
+ rb_raise(rb_eArgError, "wrong number of arguments: %s(src) or %s{..}",
+ rb_id2name(ruby_frame->last_func),
+ rb_id2name(ruby_frame->last_func));
+ }
+ if (argc > 2) line = NUM2INT(argv[2]);
+ if (argc > 1) {
+ file = StringValuePtr(argv[1]);
+ }
+ }
+ return eval_under(klass, self, argv[0], file, line);
+ }
+}
+
+/*
+ * call-seq:
+ * obj.instance_eval(string [, filename [, lineno]] ) => obj
+ * obj.instance_eval {| | block } => obj
+ *
+ * Evaluates a string containing Ruby source code, or 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. In the version of <code>instance_eval</code>
+ * that takes a +String+, the optional second and third
+ * parameters supply a filename and starting line number that are used
+ * when reporting compilation errors.
+ *
+ * class Klass
+ * def initialize
+ * @secret = 99
+ * end
+ * end
+ * k = Klass.new
+ * k.instance_eval { @secret } #=> 99
+ */
-static VALUE
-mod_module_eval(argc, argv, mod)
+VALUE
+rb_obj_instance_eval(argc, argv, self)
int argc;
VALUE *argv;
- VALUE mod;
+ VALUE self;
{
- char *file = 0;
- int line = 0;
-
- if (argc == 0) {
- if (!iterator_p()) {
- ArgError("block not supplied");
- }
- }
- else if (argc < 4) {
- Check_SafeStr(argv[0]);
- if (argc > 1) file = STR2CSTR(argv[1]);
- if (argc > 2) line = NUM2INT(argv[2]);
- }
- else {
- ArgError("Wrong # of arguments: %s(src) or %s{..}",
- rb_id2name(the_frame->last_func),
- rb_id2name(the_frame->last_func));
- }
+ VALUE klass;
- if (argc == 0) {
- return yield_under(mod, mod);
+ if (FIXNUM_P(self) || SYMBOL_P(self)) {
+ klass = Qnil;
}
else {
- return eval_under(mod, mod, argv[0], file, line);
- }
-}
-
-VALUE rb_load_path;
+ klass = rb_singleton_class(self);
+ }
+ return specific_eval(argc, argv, klass, self);
+}
+
+/*
+ * call-seq:
+ * mod.class_eval(string [, filename [, lineno]]) => obj
+ * mod.module_eval {|| block } => obj
+ *
+ * Evaluates the string or block in the context of _mod_. This can
+ * be used to add methods to a class. <code>module_eval</code> returns
+ * the result of evaluating its argument. The optional _filename_
+ * and _lineno_ parameters set the text for error messages.
+ *
+ * class Thing
+ * end
+ * a = %q{def hello() "Hello there!" end}
+ * Thing.module_eval(a)
+ * puts Thing.new.hello()
+ * Thing.module_eval("invalid code", "dummy", 123)
+ *
+ * <em>produces:</em>
+ *
+ * Hello there!
+ * dummy:123:in `module_eval': undefined local variable
+ * or method `code' for Thing:Class
+ */
-static int
-is_absolute_path(path)
- char *path;
+VALUE
+rb_mod_module_eval(argc, argv, mod)
+ int argc;
+ VALUE *argv;
+ VALUE mod;
{
- if (path[0] == '/') return 1;
-# if defined(MSDOS) || defined(NT) || defined(__human68k__)
- if (path[0] == '\\') return 1;
- if (strlen(path) > 2 && path[1] == ':') return 1;
-# endif
- return 0;
+ return specific_eval(argc, argv, mod, mod);
}
-static char*
-find_file(file)
- char *file;
-{
- extern VALUE rb_load_path;
- VALUE vpath;
- char *path;
-
- if (is_absolute_path(file)) {
- FILE *f = fopen(file, "r");
-
- if (f == NULL) return 0;
- fclose(f);
- return file;
- }
-
- if (rb_load_path) {
- int i;
-
- Check_Type(rb_load_path, T_ARRAY);
- for (i=0;i<RARRAY(rb_load_path)->len;i++) {
- Check_SafeStr(RARRAY(rb_load_path)->ptr[i]);
- }
- vpath = ary_join(rb_load_path, str_new2(RUBY_LIB_SEP));
- Check_SafeStr(vpath);
- path = RSTRING(vpath)->ptr;
- }
- else {
- path = 0;
- }
+VALUE rb_load_path;
- return dln_find_file(file, path);
-}
+NORETURN(static void load_failed _((VALUE)));
-VALUE
-f_load(obj, fname)
- VALUE obj, fname;
+void
+rb_load(fname, wrap)
+ VALUE fname;
+ int wrap;
{
+ VALUE tmp;
int state;
- char *file;
+ volatile int prohibit_int = rb_prohibit_interrupt;
volatile ID last_func;
+ volatile VALUE wrapper = ruby_wrapper;
+ volatile VALUE self = ruby_top_self;
+ NODE *volatile last_node;
+ NODE *saved_cref = ruby_cref;
TMP_PROTECT;
- Check_SafeStr(fname);
-#ifndef __MACOS__
- if (RSTRING(fname)->ptr[0] == '~') {
- fname = file_s_expand_path(1, &fname);
+ if (wrap && ruby_safe_level >= 4) {
+ StringValue(fname);
}
-#endif
- file = find_file(RSTRING(fname)->ptr);
- if (!file) LoadError("No such file to load -- %s", RSTRING(fname)->ptr);
+ else {
+ SafeStringValue(fname);
+ }
+ fname = rb_str_new4(fname);
+ tmp = rb_find_file(fname);
+ if (!tmp) {
+ load_failed(fname);
+ }
+ fname = tmp;
+ ruby_errinfo = Qnil; /* ensure */
PUSH_VARS();
- PUSH_TAG(PROT_NONE);
- PUSH_CLASS();
- the_class = cObject;
- PUSH_SCOPE();
- if (top_scope->local_tbl) {
- int len = top_scope->local_tbl[0]+1;
- ID *tbl = ALLOC_N(ID, len);
- VALUE *vars = TMP_ALLOC(VALUE, len);
- *vars++ = 0;
- MEMCPY(tbl, top_scope->local_tbl, ID, len);
- MEMCPY(vars, top_scope->local_vars, ID, len-1);
- the_scope->local_tbl = tbl;
- the_scope->local_vars = vars;
+ PUSH_CLASS(ruby_wrapper);
+ ruby_cref = top_cref;
+ if (!wrap) {
+ rb_secure(4); /* should alter global state */
+ ruby_class = rb_cObject;
+ ruby_wrapper = 0;
}
+ else {
+ /* load in anonymous module as toplevel */
+ ruby_class = ruby_wrapper = rb_module_new();
+ self = rb_obj_clone(ruby_top_self);
+ rb_extend_object(self, ruby_wrapper);
+ PUSH_CREF(ruby_wrapper);
+ }
+ PUSH_ITER(ITER_NOT);
+ PUSH_FRAME();
+ ruby_frame->last_func = 0;
+ ruby_frame->last_class = 0;
+ ruby_frame->self = self;
+ PUSH_SCOPE();
/* default visibility is private at loading toplevel */
SCOPE_SET(SCOPE_PRIVATE);
-
+ PUSH_TAG(PROT_NONE);
state = EXEC_TAG();
- last_func = the_frame->last_func;
- the_frame->last_func = 0;
- if (state == 0) {
- rb_in_eval++;
- rb_load_file(file);
- rb_in_eval--;
- if (nerrs == 0) {
- eval_node(TopSelf);
- }
+ last_func = ruby_frame->last_func;
+ last_node = ruby_current_node;
+ if (!ruby_current_node && ruby_sourcefile) {
+ last_node = NEW_NEWLINE(0);
}
- the_frame->last_func = last_func;
- if (the_scope->flag == SCOPE_ALLOCA && the_scope->local_tbl) {
- free(the_scope->local_tbl);
+ ruby_current_node = 0;
+ if (state == 0) {
+ NODE *node;
+ volatile int critical;
+
+ DEFER_INTS;
+ ruby_in_eval++;
+ critical = rb_thread_critical;
+ rb_thread_critical = Qtrue;
+ rb_load_file(RSTRING(fname)->ptr);
+ ruby_in_eval--;
+ node = ruby_eval_tree;
+ rb_thread_critical = critical;
+ ALLOW_INTS;
+ if (ruby_nerrs == 0) {
+ eval_node(self, node);
+ }
+ }
+ ruby_frame->last_func = last_func;
+ ruby_current_node = last_node;
+ ruby_sourcefile = 0;
+ ruby_set_current_source();
+ if (ruby_scope->flags == SCOPE_ALLOCA && ruby_class == rb_cObject) {
+ if (ruby_scope->local_tbl) /* toplevel was empty */
+ free(ruby_scope->local_tbl);
}
+ POP_TAG();
+ rb_prohibit_interrupt = prohibit_int;
+ ruby_cref = saved_cref;
POP_SCOPE();
+ POP_FRAME();
+ POP_ITER();
POP_CLASS();
- POP_TAG();
POP_VARS();
- if (nerrs > 0) {
- rb_raise(errinfo);
+ ruby_wrapper = wrapper;
+ if (ruby_nerrs > 0) {
+ ruby_nerrs = 0;
+ rb_exc_raise(ruby_errinfo);
}
- if (state) JUMP_TAG(state);
+ if (state) jump_tag_but_local_jump(state, Qundef);
+ if (!NIL_P(ruby_errinfo)) /* exception during load */
+ rb_exc_raise(ruby_errinfo);
+}
+
+void
+rb_load_protect(fname, wrap, state)
+ VALUE fname;
+ int wrap;
+ int *state;
+{
+ int status;
- return TRUE;
+ PUSH_TAG(PROT_NONE);
+ if ((status = EXEC_TAG()) == 0) {
+ rb_load(fname, wrap);
+ }
+ POP_TAG();
+ if (state) *state = status;
}
+/*
+ * call-seq:
+ * load(filename, wrap=false) => true
+ *
+ * Loads and executes the Ruby
+ * program in the file _filename_. If the filename does not
+ * resolve to an absolute path, the file is searched for in the library
+ * directories listed in <code>$:</code>. If the optional _wrap_
+ * parameter is +true+, the loaded script will be executed
+ * under an anonymous module, protecting the calling program's global
+ * namespace. In no circumstance will any local variables in the loaded
+ * file be propagated to the loading environment.
+ */
+
+
+static VALUE
+rb_f_load(argc, argv)
+ int argc;
+ VALUE *argv;
+{
+ VALUE fname, wrap;
+
+ rb_scan_args(argc, argv, "11", &fname, &wrap);
+ rb_load(fname, RTEST(wrap));
+ return Qtrue;
+}
+
+VALUE ruby_dln_librefs;
static VALUE rb_features;
+static st_table *loading_tbl;
-static int
-rb_provided(feature)
- char *feature;
+#define IS_SOEXT(e) (strcmp(e, ".so") == 0 || strcmp(e, ".o") == 0)
+#ifdef DLEXT2
+#define IS_DLEXT(e) (strcmp(e, DLEXT) == 0 || strcmp(e, DLEXT2) == 0)
+#else
+#define IS_DLEXT(e) (strcmp(e, DLEXT) == 0)
+#endif
+
+static char *
+rb_feature_p(feature, ext, rb)
+ const char *feature, *ext;
+ int rb;
{
- VALUE *p, *pend;
- char *f;
- int len;
+ VALUE v;
+ char *f, *e;
+ long i, len, elen;
- p = RARRAY(rb_features)->ptr;
- pend = p + RARRAY(rb_features)->len;
- while (p < pend) {
- f = STR2CSTR(*p);
- if (strcmp(f, feature) == 0) return TRUE;
+ if (ext) {
+ len = ext - feature;
+ elen = strlen(ext);
+ }
+ else {
len = strlen(feature);
- if (strncmp(f, feature, len) == 0
- && (strcmp(f+len, ".rb") == 0 ||strcmp(f+len, ".o") == 0)) {
- return TRUE;
+ elen = 0;
+ }
+ for (i = 0; i < RARRAY(rb_features)->len; ++i) {
+ v = RARRAY(rb_features)->ptr[i];
+ f = StringValuePtr(v);
+ if (strncmp(f, feature, len) != 0) continue;
+ if (!*(e = f + len)) {
+ if (ext) continue;
+ return e;
+ }
+ if (*e != '.') continue;
+ if ((!rb || !ext) && (IS_SOEXT(e) || IS_DLEXT(e))) {
+ return e;
+ }
+ if ((rb || !ext) && (strcmp(e, ".rb") == 0)) {
+ return e;
}
- p++;
}
- return FALSE;
+ return 0;
}
-#ifdef THREAD
-static int thread_loading _((char*));
-static void thread_loading_done _((void));
+static const char *const loadable_ext[] = {
+ ".rb", DLEXT,
+#ifdef DLEXT2
+ DLEXT2,
#endif
+ 0
+};
-void
-rb_provide(feature)
- char *feature;
+int
+rb_provided(feature)
+ const char *feature;
{
- char *buf, *ext;
+ int i;
+ char *buf;
- if (!rb_provided(feature)) {
- ext = strrchr(feature, '.');
- if (strcmp(DLEXT, ext) == 0) {
- buf = ALLOCA_N(char, strlen(feature)+1);
- strcpy(buf, feature);
- ext = strrchr(buf, '.');
- strcpy(ext, ".o");
- feature = buf;
- }
- ary_push(rb_features, str_new2(feature));
+ if (rb_feature_p(feature, 0, Qfalse))
+ return Qtrue;
+ if (!loading_tbl) return Qfalse;
+ if (st_lookup(loading_tbl, (st_data_t)feature, 0)) return Qtrue;
+ buf = ALLOCA_N(char, strlen(feature)+8);
+ strcpy(buf, feature);
+ for (i=0; ; i++) {
+ if (!loadable_ext[i]) break;
+ strcpy(buf+strlen(feature), loadable_ext[i]);
+ if (st_lookup(loading_tbl, (st_data_t)buf, 0)) return Qtrue;
}
+ return Qfalse;
+}
+
+static void
+rb_provide_feature(feature)
+ VALUE feature;
+{
+ rb_ary_push(rb_features, feature);
+}
+
+void
+rb_provide(feature)
+ const char *feature;
+{
+ rb_provide_feature(rb_str_new2(feature));
}
+static void
+load_wait(ftptr)
+ char *ftptr;
+{
+ st_data_t th;
+
+ if (!loading_tbl) return;
+ if (!st_lookup(loading_tbl, (st_data_t)ftptr, &th)) return;
+ if ((rb_thread_t)th == curr_thread) return;
+ do {
+ CHECK_INTS;
+ rb_thread_schedule();
+ } while (st_lookup(loading_tbl, (st_data_t)ftptr, &th));
+}
+
+/*
+ * call-seq:
+ * require(string) => true or false
+ *
+ * Ruby tries to load the library named _string_, returning
+ * +true+ if successful. If the filename does not resolve to
+ * an absolute path, it will be searched for in the directories listed
+ * in <code>$:</code>. If the file has the extension ``.rb'', it is
+ * loaded as a source file; if the extension is ``.so'', ``.o'', or
+ * ``.dll'', or whatever the default shared library extension is on
+ * the current platform, Ruby loads the shared library as a Ruby
+ * extension. Otherwise, Ruby tries adding ``.rb'', ``.so'', and so on
+ * to the name. The name of the loaded feature is added to the array in
+ * <code>$"</code>. A feature will not be loaded if it's name already
+ * appears in <code>$"</code>. However, the file name is not converted
+ * to an absolute path, so that ``<code>require 'a';require
+ * './a'</code>'' will load <code>a.rb</code> twice.
+ *
+ * require "my-library.rb"
+ * require "db-driver"
+ */
+
VALUE
-f_require(obj, fname)
+rb_f_require(obj, fname)
VALUE obj, fname;
{
- char *ext, *file, *feature, *buf; /* OK */
- VALUE load;
+ return rb_require_safe(fname, ruby_safe_level);
+}
- Check_SafeStr(fname);
- if (rb_provided(RSTRING(fname)->ptr))
- return FALSE;
+static int
+search_required(fname, featurep, path)
+ VALUE fname, *featurep, *path;
+{
+ VALUE tmp;
+ char *ext, *ftptr;
+ int type;
- ext = strrchr(RSTRING(fname)->ptr, '.');
- if (ext) {
+ *featurep = fname;
+ *path = 0;
+ ext = strrchr(ftptr = RSTRING(fname)->ptr, '.');
+ if (ext && !strchr(ext, '/')) {
if (strcmp(".rb", ext) == 0) {
- feature = file = RSTRING(fname)->ptr;
- file = find_file(file);
- if (file) goto rb_load;
- }
- else if (strcmp(".o", ext) == 0) {
- file = feature = RSTRING(fname)->ptr;
- if (strcmp(".o", DLEXT) != 0) {
- buf = ALLOCA_N(char, strlen(file)+sizeof(DLEXT)+1);
- strcpy(buf, feature);
- ext = strrchr(buf, '.');
- strcpy(ext, DLEXT);
- file = find_file(buf);
- }
- if (file) goto dyna_load;
- }
- else if (strcmp(DLEXT, ext) == 0) {
- feature = RSTRING(fname)->ptr;
- file = find_file(feature);
- if (file) goto dyna_load;
- }
- }
- buf = ALLOCA_N(char, strlen(RSTRING(fname)->ptr) + 5);
- sprintf(buf, "%s.rb", RSTRING(fname)->ptr);
- file = find_file(buf);
- if (file) {
- fname = str_new2(file);
- feature = buf;
- goto rb_load;
- }
- sprintf(buf, "%s%s", RSTRING(fname)->ptr, DLEXT);
- file = find_file(buf);
- if (file) {
- feature = buf;
- goto dyna_load;
- }
- LoadError("No such file to load -- %s", RSTRING(fname)->ptr);
-
- dyna_load:
-#ifdef THREAD
- if (thread_loading(feature)) return FALSE;
- else {
- int state;
- PUSH_TAG(PROT_NONE);
- if ((state = EXEC_TAG()) == 0) {
+ if (rb_feature_p(ftptr, ext, Qtrue)) return 'r';
+ if (*path = rb_find_file(fname)) return 'r';
+ return 0;
+ }
+ else if (IS_SOEXT(ext)) {
+ if (rb_feature_p(ftptr, ext, Qfalse)) return 's';
+ tmp = rb_str_new(RSTRING(fname)->ptr, ext-RSTRING(fname)->ptr);
+ *featurep = tmp;
+#ifdef DLEXT2
+ OBJ_FREEZE(tmp);
+ if (rb_find_file_ext(&tmp, loadable_ext+1)) {
+ *featurep = tmp;
+ *path = rb_find_file(tmp);
+ return 's';
+ }
+#else
+ rb_str_cat2(tmp, DLEXT);
+ OBJ_FREEZE(tmp);
+ if (*path = rb_find_file(tmp)) {
+ return 's';
+ }
#endif
- load = str_new2(file);
- file = RSTRING(load)->ptr;
- dln_load(file);
- rb_provide(feature);
-#ifdef THREAD
}
- POP_TAG();
- thread_loading_done();
- if (state) JUMP_TAG(state);
+ else if (IS_DLEXT(ext)) {
+ if (rb_feature_p(ftptr, ext, Qfalse)) return 's';
+ if (*path = rb_find_file(fname)) return 's';
+ }
}
-#endif
- return TRUE;
+ tmp = fname;
+ switch (type = rb_find_file_ext(&tmp, loadable_ext)) {
+ case 0:
+ if ((ext = rb_feature_p(ftptr, 0, Qfalse))) {
+ type = strcmp(".rb", ext);
+ break;
+ }
+ return 0;
- rb_load:
-#ifdef THREAD
- if (thread_loading(feature)) return FALSE;
- else {
- int state;
- PUSH_TAG(PROT_NONE);
- if ((state = EXEC_TAG()) == 0) {
-#endif
- f_load(obj, fname);
- rb_provide(feature);
-#ifdef THREAD
+ default:
+ *featurep = tmp;
+ ext = strrchr(ftptr = RSTRING(tmp)->ptr, '.');
+ if (rb_feature_p(ftptr, ext, !--type)) break;
+ *path = rb_find_file(tmp);
+ }
+ return type ? 's' : 'r';
+}
+
+static void
+load_failed(fname)
+ VALUE fname;
+{
+ rb_raise(rb_eLoadError, "No such file to load -- %s", RSTRING(fname)->ptr);
+}
+
+VALUE
+rb_require_safe(fname, safe)
+ VALUE fname;
+ int safe;
+{
+ VALUE result = Qnil;
+ volatile VALUE errinfo = ruby_errinfo;
+ int state;
+ struct {
+ NODE *node;
+ ID func;
+ int vmode, safe;
+ } volatile saved;
+ char *volatile ftptr = 0;
+
+ if (OBJ_TAINTED(fname)) {
+ rb_check_safe_obj(fname);
+ }
+ StringValue(fname);
+ fname = rb_str_new4(fname);
+ saved.vmode = scope_vmode;
+ saved.node = ruby_current_node;
+ saved.func = ruby_frame->last_func;
+ saved.safe = ruby_safe_level;
+ PUSH_TAG(PROT_NONE);
+ if ((state = EXEC_TAG()) == 0) {
+ VALUE feature, path;
+ long handle;
+ int found;
+
+ ruby_safe_level = safe;
+ found = search_required(fname, &feature, &path);
+ if (found) {
+ if (!path) {
+ load_wait(RSTRING(feature)->ptr);
+ result = Qfalse;
+ }
+ else {
+ ruby_safe_level = 0;
+ rb_provide_feature(feature);
+ switch (found) {
+ case 'r':
+ /* loading ruby library should be serialized. */
+ if (!loading_tbl) {
+ loading_tbl = st_init_strtable();
+ }
+ /* partial state */
+ ftptr = ruby_strdup(RSTRING(feature)->ptr);
+ st_insert(loading_tbl, (st_data_t)ftptr, (st_data_t)curr_thread);
+ rb_load(path, 0);
+ break;
+
+ case 's':
+ ruby_current_node = 0;
+ ruby_sourcefile = rb_source_filename(RSTRING(path)->ptr);
+ ruby_sourceline = 0;
+ ruby_frame->last_func = 0;
+ SCOPE_SET(SCOPE_PUBLIC);
+ handle = (long)dln_load(RSTRING(path)->ptr);
+ rb_ary_push(ruby_dln_librefs, LONG2NUM(handle));
+ break;
+ }
+ result = Qtrue;
+ }
}
- POP_TAG();
- thread_loading_done();
- if (state) JUMP_TAG(state);
}
-#endif
- return TRUE;
+ POP_TAG();
+ ruby_current_node = saved.node;
+ ruby_set_current_source();
+ ruby_frame->last_func = saved.func;
+ SCOPE_SET(saved.vmode);
+ ruby_safe_level = saved.safe;
+ if (ftptr) {
+ if (st_delete(loading_tbl, (st_data_t *)&ftptr, 0)) { /* loading done */
+ free(ftptr);
+ }
+ }
+ if (state) JUMP_TAG(state);
+ if (NIL_P(result)) {
+ load_failed(fname);
+ }
+ ruby_errinfo = errinfo;
+
+ return result;
+}
+
+VALUE
+rb_require(fname)
+ const char *fname;
+{
+ VALUE fn = rb_str_new2(fname);
+ OBJ_FREEZE(fn);
+ return rb_require_safe(fn, ruby_safe_level);
+}
+
+static void
+secure_visibility(self)
+ VALUE self;
+{
+ if (ruby_safe_level >= 4 && !OBJ_TAINTED(self)) {
+ rb_raise(rb_eSecurityError, "Insecure: can't change method visibility");
+ }
}
static void
@@ -4367,21 +6847,34 @@ set_method_visibility(self, argc, argv, ex)
VALUE self;
int argc;
VALUE *argv;
- int ex;
+ ID ex;
{
int i;
+ secure_visibility(self);
for (i=0; i<argc; i++) {
rb_export_method(self, rb_to_id(argv[i]), ex);
}
+ rb_clear_cache_by_class(self);
}
+/*
+ * call-seq:
+ * public => self
+ * public(symbol, ...) => self
+ *
+ * With no arguments, sets the default visibility for subsequently
+ * defined methods to public. With arguments, sets the named methods to
+ * have public visibility.
+ */
+
static VALUE
-mod_public(argc, argv, module)
+rb_mod_public(argc, argv, module)
int argc;
VALUE *argv;
VALUE module;
{
+ secure_visibility(module);
if (argc == 0) {
SCOPE_SET(SCOPE_PUBLIC);
}
@@ -4391,12 +6884,23 @@ mod_public(argc, argv, module)
return module;
}
+/*
+ * call-seq:
+ * protected => self
+ * protected(symbol, ...) => self
+ *
+ * With no arguments, sets the default visibility for subsequently
+ * defined methods to protected. With arguments, sets the named methods
+ * to have protected visibility.
+ */
+
static VALUE
-mod_protected(argc, argv, module)
+rb_mod_protected(argc, argv, module)
int argc;
VALUE *argv;
VALUE module;
{
+ secure_visibility(module);
if (argc == 0) {
SCOPE_SET(SCOPE_PROTECTED);
}
@@ -4406,12 +6910,32 @@ mod_protected(argc, argv, module)
return module;
}
+/*
+ * call-seq:
+ * private => self
+ * private(symbol, ...) => self
+ *
+ * With no arguments, sets the default visibility for subsequently
+ * defined methods to private. With arguments, sets the named methods
+ * to have private visibility.
+ *
+ * module Mod
+ * def a() end
+ * def b() end
+ * private
+ * def c() end
+ * private :a
+ * end
+ * Mod.private_instance_methods #=> ["a", "c"]
+ */
+
static VALUE
-mod_private(argc, argv, module)
+rb_mod_private(argc, argv, module)
int argc;
VALUE *argv;
VALUE module;
{
+ secure_visibility(module);
if (argc == 0) {
SCOPE_SET(SCOPE_PRIVATE);
}
@@ -4421,8 +6945,15 @@ mod_private(argc, argv, module)
return module;
}
+/*
+ * call-seq:
+ * mod.public_class_method(symbol, ...) => mod
+ *
+ * Makes a list of existing class methods public.
+ */
+
static VALUE
-mod_public_method(argc, argv, obj)
+rb_mod_public_method(argc, argv, obj)
int argc;
VALUE *argv;
VALUE obj;
@@ -4431,8 +6962,24 @@ mod_public_method(argc, argv, obj)
return obj;
}
+/*
+ * call-seq:
+ * mod.private_class_method(symbol, ...) => mod
+ *
+ * Makes existing class methods private. Often used to hide the default
+ * constructor <code>new</code>.
+ *
+ * class SimpleSingleton # Not thread safe
+ * private_class_method :new
+ * def SimpleSingleton.create(*args, &block)
+ * @me = new(*args, &block) if ! @me
+ * @me
+ * end
+ * end
+ */
+
static VALUE
-mod_private_method(argc, argv, obj)
+rb_mod_private_method(argc, argv, obj)
int argc;
VALUE *argv;
VALUE obj;
@@ -4441,12 +6988,22 @@ mod_private_method(argc, argv, obj)
return obj;
}
+/*
+ * call-seq:
+ * public
+ * public(symbol, ...)
+ *
+ * With no arguments, sets the default visibility for subsequently
+ * defined methods to public. With arguments, sets the named methods to
+ * have public visibility.
+ */
+
static VALUE
top_public(argc, argv)
int argc;
VALUE *argv;
{
- return mod_public(argc, argv, cObject);
+ return rb_mod_public(argc, argv, rb_cObject);
}
static VALUE
@@ -4454,11 +7011,47 @@ top_private(argc, argv)
int argc;
VALUE *argv;
{
- return mod_private(argc, argv, cObject);
-}
+ return rb_mod_private(argc, argv, rb_cObject);
+}
+
+/*
+ * call-seq:
+ * module_function(symbol, ...) => self
+ *
+ * Creates module functions for the named methods. These functions may
+ * be called with the module as a receiver, and also become available
+ * as instance methods to classes that mix in the module. Module
+ * functions are copies of the original, and so may be changed
+ * independently. The instance-method versions are made private. If
+ * used with no arguments, subsequently defined methods become module
+ * functions.
+ *
+ * module Mod
+ * def one
+ * "This is one"
+ * end
+ * module_function :one
+ * end
+ * class Cls
+ * include Mod
+ * def callOne
+ * one
+ * end
+ * end
+ * Mod.one #=> "This is one"
+ * c = Cls.new
+ * c.callOne #=> "This is one"
+ * module Mod
+ * def one
+ * "This is the new one"
+ * end
+ * end
+ * Mod.one #=> "This is one"
+ * c.callOne #=> "This is the new one"
+ */
static VALUE
-mod_modfunc(argc, argv, module)
+rb_mod_modfunc(argc, argv, module)
int argc;
VALUE *argv;
VALUE module;
@@ -4467,6 +7060,11 @@ mod_modfunc(argc, argv, module)
ID id;
NODE *body;
+ if (TYPE(module) != T_MODULE) {
+ rb_raise(rb_eTypeError, "module_function must be called for modules");
+ }
+
+ secure_visibility(module);
if (argc == 0) {
SCOPE_SET(SCOPE_MODFUNC);
return module;
@@ -4474,20 +7072,42 @@ mod_modfunc(argc, argv, module)
set_method_visibility(module, argc, argv, NOEX_PRIVATE);
for (i=0; i<argc; i++) {
+ VALUE m = module;
+
id = rb_to_id(argv[i]);
- body = search_method(module, id, 0);
- if (body == 0 || body->nd_body == 0) {
- NameError("undefined method `%s' for module `%s'",
- rb_id2name(id), rb_class2name(module));
+ for (;;) {
+ body = search_method(m, id, &m);
+ if (body == 0) {
+ body = search_method(rb_cObject, id, &m);
+ }
+ if (body == 0 || body->nd_body == 0) {
+ rb_bug("undefined method `%s'; can't happen", rb_id2name(id));
+ }
+ if (nd_type(body->nd_body) != NODE_ZSUPER) {
+ break; /* normal case: need not to follow 'super' link */
+ }
+ m = RCLASS(m)->super;
+ if (!m) break;
}
- rb_clear_cache_by_id(id);
rb_add_method(rb_singleton_class(module), id, body->nd_body, NOEX_PUBLIC);
}
return module;
}
+/*
+ * call-seq:
+ * append_features(mod) => mod
+ *
+ * When this module is included in another, Ruby calls
+ * <code>append_features</code> in this module, passing it the
+ * receiving module in _mod_. Ruby's default implementation is
+ * to add the constants, methods, and module variables of this module
+ * to _mod_ if this module has not already been added to
+ * _mod_ or one of its ancestors. See also <code>Module#include</code>.
+ */
+
static VALUE
-mod_append_features(module, include)
+rb_mod_append_features(module, include)
VALUE module, include;
{
switch (TYPE(include)) {
@@ -4503,54 +7123,38 @@ mod_append_features(module, include)
return module;
}
+/*
+ * call-seq:
+ * include(module, ...) => self
+ *
+ * Invokes <code>Module.append_features</code> on each parameter in turn.
+ */
+
static VALUE
-mod_include(argc, argv, module)
+rb_mod_include(argc, argv, module)
int argc;
VALUE *argv;
VALUE module;
{
int i;
- for (i=0; i<argc; i++) {
- Check_Type(argv[i], T_MODULE);
- rb_funcall(argv[i], rb_intern("append_features"), 1, module);
+ for (i=0; i<argc; i++) Check_Type(argv[i], T_MODULE);
+ while (argc--) {
+ rb_funcall(argv[argc], rb_intern("append_features"), 1, module);
+ rb_funcall(argv[argc], rb_intern("included"), 1, module);
}
return module;
}
void
-obj_call_init(obj)
- VALUE obj;
-{
- PUSH_ITER(iterator_p()?ITER_PRE:ITER_NOT);
- rb_funcall2(obj, init, the_frame->argc, the_frame->argv);
- POP_ITER();
-}
-
-VALUE
-class_new_instance(argc, argv, klass)
- int argc;
- VALUE *argv;
- VALUE klass;
-{
+rb_obj_call_init(obj, argc, argv)
VALUE obj;
-
- if (FL_TEST(klass, FL_SINGLETON)) {
- TypeError("can't create instance of virtual class");
- }
- obj = obj_alloc(klass);
- obj_call_init(obj);
-
- return obj;
-}
-
-static VALUE
-top_include(argc, argv)
int argc;
VALUE *argv;
{
- rb_secure(4);
- return mod_include(argc, argv, cObject);
+ PUSH_ITER(rb_block_given_p()?ITER_PRE:ITER_NOT);
+ rb_funcall2(obj, init, argc, argv);
+ POP_ITER();
}
void
@@ -4560,31 +7164,110 @@ rb_extend_object(obj, module)
rb_include_module(rb_singleton_class(obj), module);
}
+/*
+ * call-seq:
+ * extend_object(obj) => obj
+ *
+ * Extends the specified object by adding this module's constants and
+ * methods (which are added as singleton methods). This is the callback
+ * method used by <code>Object#extend</code>.
+ *
+ * module Picky
+ * def Picky.extend_object(o)
+ * if String === o
+ * puts "Can't add Picky to a String"
+ * else
+ * puts "Picky added to #{o.class}"
+ * super
+ * end
+ * end
+ * end
+ * (s = Array.new).extend Picky # Call Object.extend
+ * (s = "quick brown fox").extend Picky
+ *
+ * <em>produces:</em>
+ *
+ * Picky added to Array
+ * Can't add Picky to a String
+ */
+
static VALUE
-mod_extend_object(mod, obj)
+rb_mod_extend_object(mod, obj)
VALUE mod, obj;
{
rb_extend_object(obj, mod);
return obj;
}
+/*
+ * call-seq:
+ * obj.extend(module, ...) => obj
+ *
+ * Adds to _obj_ the instance methods from each module given as a
+ * parameter.
+ *
+ * module Mod
+ * def hello
+ * "Hello from Mod.\n"
+ * end
+ * end
+ *
+ * class Klass
+ * def hello
+ * "Hello from Klass.\n"
+ * end
+ * end
+ *
+ * k = Klass.new
+ * k.hello #=> "Hello from Klass.\n"
+ * k.extend(Mod) #=> #<Klass:0x401b3bc8>
+ * k.hello #=> "Hello from Mod.\n"
+ */
+
static VALUE
-obj_extend(argc, argv, obj)
+rb_obj_extend(argc, argv, obj)
int argc;
VALUE *argv;
VALUE obj;
{
int i;
+ if (argc == 0) {
+ rb_raise(rb_eArgError, "wrong number of arguments (0 for 1)");
+ }
for (i=0; i<argc; i++) Check_Type(argv[i], T_MODULE);
- for (i=0; i<argc; i++) {
- rb_funcall(argv[i], rb_intern("extend_object"), 1, obj);
+ while (argc--) {
+ rb_funcall(argv[argc], rb_intern("extend_object"), 1, obj);
+ rb_funcall(argv[argc], rb_intern("extended"), 1, obj);
}
return obj;
}
-VALUE f_trace_var();
-VALUE f_untrace_var();
+/*
+ * call-seq:
+ * include(module, ...) => self
+ *
+ * Invokes <code>Module.append_features</code>
+ * on each parameter in turn. Effectively adds the methods and constants
+ * in each module to the receiver.
+ */
+
+static VALUE
+top_include(argc, argv, self)
+ int argc;
+ VALUE *argv;
+ VALUE self;
+{
+ rb_secure(4);
+ if (ruby_wrapper) {
+ rb_warning("main#include in the wrapped load is effective only in wrapper module");
+ return rb_mod_include(argc, argv, ruby_wrapper);
+ }
+ return rb_mod_include(argc, argv, rb_cObject);
+}
+
+VALUE rb_f_trace_var();
+VALUE rb_f_untrace_var();
static void
errinfo_setter(val, id, var)
@@ -4592,8 +7275,8 @@ errinfo_setter(val, id, var)
ID id;
VALUE *var;
{
- if (!obj_is_kind_of(val, eException)) {
- TypeError("assigning non-exception to $!");
+ if (!NIL_P(val) && !rb_obj_is_kind_of(val, rb_eException)) {
+ rb_raise(rb_eTypeError, "assigning non-exception to $!");
}
*var = val;
}
@@ -4602,7 +7285,7 @@ static VALUE
errat_getter(id)
ID id;
{
- return get_backtrace(errinfo);
+ return get_backtrace(ruby_errinfo);
}
static void
@@ -4611,35 +7294,46 @@ errat_setter(val, id, var)
ID id;
VALUE *var;
{
- if (NIL_P(errinfo)) {
- ArgError("$! not set");
+ if (NIL_P(ruby_errinfo)) {
+ rb_raise(rb_eArgError, "$! not set");
}
- set_backtrace(errinfo, val);
+ set_backtrace(ruby_errinfo, val);
}
-VALUE f_global_variables();
-VALUE f_instance_variables();
+/*
+ * call-seq:
+ * local_variables => array
+ *
+ * Returns the names of the current local variables.
+ *
+ * fred = 1
+ * for i in 1..10
+ * # ...
+ * end
+ * local_variables #=> ["fred", "i"]
+ */
-VALUE
-f_local_variables()
+static VALUE
+rb_f_local_variables()
{
ID *tbl;
int n, i;
- VALUE ary = ary_new();
+ VALUE ary = rb_ary_new();
struct RVarmap *vars;
- tbl = the_scope->local_tbl;
+ tbl = ruby_scope->local_tbl;
if (tbl) {
n = *tbl++;
for (i=2; i<n; i++) { /* skip first 2 ($_ and $~) */
- ary_push(ary, str_new2(rb_id2name(tbl[i])));
+ if (!rb_is_local_id(tbl[i])) continue; /* skip flip states */
+ rb_ary_push(ary, rb_str_new2(rb_id2name(tbl[i])));
}
}
- vars = the_dyna_vars;
+ vars = ruby_dyna_vars;
while (vars) {
- if (vars->id) {
- ary_push(ary, str_new2(rb_id2name(vars->id)));
+ if (vars->id && rb_is_local_id(vars->id)) { /* skip $_, $~ and flip states */
+ rb_ary_push(ary, rb_str_new2(rb_id2name(vars->id)));
}
vars = vars->next;
}
@@ -4647,65 +7341,162 @@ f_local_variables()
return ary;
}
-static VALUE f_catch();
-static VALUE f_throw();
+static VALUE rb_f_catch _((VALUE,VALUE));
+NORETURN(static VALUE rb_f_throw _((int,VALUE*)));
struct end_proc_data {
void (*func)();
VALUE data;
+ int safe;
struct end_proc_data *next;
-} *end_proc_data;
+};
+
+static struct end_proc_data *end_procs, *ephemeral_end_procs, *tmp_end_procs;
void
rb_set_end_proc(func, data)
- void (*func)();
+ void (*func) _((VALUE));
VALUE data;
{
struct end_proc_data *link = ALLOC(struct end_proc_data);
+ struct end_proc_data **list;
- link->next = end_proc_data;
+ if (ruby_wrapper) list = &ephemeral_end_procs;
+ else list = &end_procs;
+ link->next = *list;
link->func = func;
link->data = data;
- rb_global_variable(&link->data);
- end_proc_data = link;
+ link->safe = ruby_safe_level;
+ *list = link;
+}
+
+void
+rb_mark_end_proc()
+{
+ struct end_proc_data *link;
+
+ link = end_procs;
+ while (link) {
+ rb_gc_mark(link->data);
+ link = link->next;
+ }
+ link = ephemeral_end_procs;
+ while (link) {
+ rb_gc_mark(link->data);
+ link = link->next;
+ }
+ link = tmp_end_procs;
+ while (link) {
+ rb_gc_mark(link->data);
+ link = link->next;
+ }
}
+static void call_end_proc _((VALUE data));
+
static void
call_end_proc(data)
VALUE data;
{
- proc_call(data, Qnil);
+ PUSH_ITER(ITER_NOT);
+ PUSH_FRAME();
+ ruby_frame->self = ruby_frame->prev->self;
+ ruby_frame->node = 0;
+ ruby_frame->last_func = 0;
+ ruby_frame->last_class = 0;
+ proc_invoke(data, rb_ary_new2(0), Qundef, 0);
+ POP_FRAME();
+ POP_ITER();
}
static void
-f_END()
+rb_f_END()
{
PUSH_FRAME();
- the_frame->argc = 0;
- rb_set_end_proc(call_end_proc, f_lambda());
+ ruby_frame->argc = 0;
+ ruby_frame->iter = ITER_CUR;
+ rb_set_end_proc(call_end_proc, rb_block_proc());
POP_FRAME();
}
+/*
+ * call-seq:
+ * at_exit { block } -> proc
+ *
+ * Converts _block_ to a +Proc+ object (and therefore
+ * binds it at the point of call) and registers it for execution when
+ * the program exits. If multiple handlers are registered, they are
+ * executed in reverse order of registration.
+ *
+ * def do_at_exit(str1)
+ * at_exit { print str1 }
+ * end
+ * at_exit { puts "cruel world" }
+ * do_at_exit("goodbye ")
+ * exit
+ *
+ * <em>produces:</em>
+ *
+ * goodbye cruel world
+ */
+
static VALUE
-f_at_exit()
+rb_f_at_exit()
{
VALUE proc;
- proc = f_lambda();
-
+ if (!rb_block_given_p()) {
+ rb_raise(rb_eArgError, "called without a block");
+ }
+ proc = rb_block_proc();
rb_set_end_proc(call_end_proc, proc);
return proc;
}
-static void
-exec_end_proc()
+void
+rb_exec_end_proc()
{
- struct end_proc_data *link = end_proc_data;
+ struct end_proc_data *link, *tmp;
+ int status;
+ volatile int safe = ruby_safe_level;
- while (link) {
- (*link->func)(link->data);
- link = link->next;
+ while (ephemeral_end_procs) {
+ tmp_end_procs = link = ephemeral_end_procs;
+ ephemeral_end_procs = 0;
+ while (link) {
+ PUSH_TAG(PROT_NONE);
+ if ((status = EXEC_TAG()) == 0) {
+ ruby_safe_level = link->safe;
+ (*link->func)(link->data);
+ }
+ POP_TAG();
+ if (status) {
+ error_handle(status);
+ }
+ tmp = link;
+ tmp_end_procs = link = link->next;
+ free(tmp);
+ }
+ }
+ while (end_procs) {
+ tmp_end_procs = link = end_procs;
+ end_procs = 0;
+ while (link) {
+ PUSH_TAG(PROT_NONE);
+ if ((status = EXEC_TAG()) == 0) {
+ ruby_safe_level = link->safe;
+ (*link->func)(link->data);
+ }
+ POP_TAG();
+ if (status) {
+ error_handle(status);
+ }
+ tmp = link;
+ tmp_end_procs = link = link->next;
+ free(tmp);
+ }
}
+ ruby_safe_level = safe;
}
void
@@ -4718,92 +7509,188 @@ Init_eval()
aref = rb_intern("[]");
aset = rb_intern("[]=");
match = rb_intern("=~");
+ missing = rb_intern("method_missing");
+ added = rb_intern("method_added");
+ singleton_added = rb_intern("singleton_method_added");
+ removed = rb_intern("method_removed");
+ singleton_removed = rb_intern("singleton_method_removed");
+ undefined = rb_intern("method_undefined");
+ singleton_undefined = rb_intern("singleton_method_undefined");
+
+ __id__ = rb_intern("__id__");
+ __send__ = rb_intern("__send__");
rb_global_variable((VALUE*)&top_scope);
- rb_global_variable((VALUE*)&eval_tree_begin);
+ rb_global_variable((VALUE*)&ruby_eval_tree_begin);
- rb_global_variable((VALUE*)&eval_tree);
- rb_global_variable((VALUE*)&the_dyna_vars);
+ rb_global_variable((VALUE*)&ruby_eval_tree);
+ rb_global_variable((VALUE*)&ruby_dyna_vars);
rb_define_virtual_variable("$@", errat_getter, errat_setter);
- rb_define_hooked_variable("$!", &errinfo, 0, errinfo_setter);
+ rb_define_hooked_variable("$!", &ruby_errinfo, 0, errinfo_setter);
+
+ rb_define_global_function("eval", rb_f_eval, -1);
+ rb_define_global_function("iterator?", rb_f_block_given_p, 0);
+ rb_define_global_function("block_given?", rb_f_block_given_p, 0);
+ rb_define_global_function("method_missing", rb_method_missing, -1);
+ rb_define_global_function("loop", rb_f_loop, 0);
- rb_define_global_function("eval", f_eval, -1);
- rb_define_global_function("iterator?", f_iterator_p, 0);
- rb_define_global_function("method_missing", f_missing, -1);
- rb_define_global_function("loop", f_loop, 0);
+ rb_define_method(rb_mKernel, "respond_to?", rb_obj_respond_to, -1);
- rb_define_method(mKernel, "respond_to?", obj_respond_to, -1);
+ rb_define_global_function("raise", rb_f_raise, -1);
+ rb_define_global_function("fail", rb_f_raise, -1);
- rb_define_global_function("raise", f_raise, -1);
- rb_define_alias(mKernel, "fail", "raise");
+ rb_define_global_function("caller", rb_f_caller, -1);
- rb_define_global_function("caller", f_caller, -1);
+ rb_define_global_function("exit", rb_f_exit, -1);
+ rb_define_global_function("abort", rb_f_abort, -1);
- rb_define_global_function("exit", f_exit, -1);
- rb_define_global_function("abort", f_abort, 0);
+ rb_define_global_function("at_exit", rb_f_at_exit, 0);
- rb_define_global_function("at_exit", f_at_exit, 0);
+ rb_define_global_function("catch", rb_f_catch, 1);
+ rb_define_global_function("throw", rb_f_throw, -1);
+ 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("catch", f_catch, 1);
- rb_define_global_function("throw", f_throw, -1);
- rb_define_global_function("global_variables", f_global_variables, 0);
- rb_define_global_function("local_variables", f_local_variables, 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(mKernel, "send", f_send, -1);
- rb_define_method(mKernel, "__send__", f_send, -1);
- rb_define_method(mKernel, "instance_eval", obj_instance_eval, -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);
+ rb_define_private_method(rb_cModule, "include", rb_mod_include, -1);
+ rb_define_private_method(rb_cModule, "public", rb_mod_public, -1);
+ rb_define_private_method(rb_cModule, "protected", rb_mod_protected, -1);
+ rb_define_private_method(rb_cModule, "private", rb_mod_private, -1);
+ rb_define_private_method(rb_cModule, "module_function", rb_mod_modfunc, -1);
+ rb_define_method(rb_cModule, "method_defined?", rb_mod_method_defined, 1);
+ rb_define_method(rb_cModule, "public_method_defined?", rb_mod_public_method_defined, 1);
+ rb_define_method(rb_cModule, "private_method_defined?", rb_mod_private_method_defined, 1);
+ rb_define_method(rb_cModule, "protected_method_defined?", rb_mod_protected_method_defined, 1);
+ 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, "class_eval", rb_mod_module_eval, -1);
- rb_define_private_method(cModule, "append_features", mod_append_features, 1);
- rb_define_private_method(cModule, "extend_object", mod_extend_object, 1);
- rb_define_private_method(cModule, "include", mod_include, -1);
- rb_define_private_method(cModule, "public", mod_public, -1);
- rb_define_private_method(cModule, "protected", mod_protected, -1);
- rb_define_private_method(cModule, "private", mod_private, -1);
- rb_define_private_method(cModule, "module_function", mod_modfunc, -1);
- rb_define_method(cModule, "method_defined?", mod_method_defined, 1);
- rb_define_method(cModule, "public_class_method", mod_public_method, -1);
- rb_define_method(cModule, "private_class_method", mod_private_method, -1);
- rb_define_method(cModule, "module_eval", mod_module_eval, -1);
- rb_define_method(cModule, "class_eval", mod_module_eval, -1);
+ rb_undef_method(rb_cClass, "module_function");
- rb_define_private_method(cModule, "remove_method", mod_remove_method, 1);
- rb_define_private_method(cModule, "undef_method", mod_undef_method, 1);
- rb_define_private_method(cModule, "alias_method", mod_alias_method, 2);
+ rb_define_private_method(rb_cModule, "remove_method", rb_mod_remove_method, -1);
+ rb_define_private_method(rb_cModule, "undef_method", rb_mod_undef_method, -1);
+ rb_define_private_method(rb_cModule, "alias_method", rb_mod_alias_method, 2);
+ rb_define_private_method(rb_cModule, "define_method", rb_mod_define_method, -1);
- rb_define_singleton_method(cModule, "nesting", mod_nesting, 0);
- rb_define_singleton_method(cModule, "constants", mod_s_constants, 0);
+ rb_define_singleton_method(rb_cModule, "nesting", rb_mod_nesting, 0);
+ rb_define_singleton_method(rb_cModule, "constants", rb_mod_s_constants, 0);
- rb_define_singleton_method(TopSelf, "include", top_include, -1);
- rb_define_singleton_method(TopSelf, "public", top_public, -1);
- rb_define_singleton_method(TopSelf, "private", top_private, -1);
+ rb_define_singleton_method(ruby_top_self, "include", top_include, -1);
+ rb_define_singleton_method(ruby_top_self, "public", top_public, -1);
+ rb_define_singleton_method(ruby_top_self, "private", top_private, -1);
- rb_define_method(mKernel, "extend", obj_extend, -1);
+ rb_define_method(rb_mKernel, "extend", rb_obj_extend, -1);
- rb_define_global_function("trace_var", f_trace_var, -1);
- rb_define_global_function("untrace_var", f_untrace_var, -1);
+ rb_define_global_function("trace_var", rb_f_trace_var, -1); /* in variable.c */
+ rb_define_global_function("untrace_var", rb_f_untrace_var, -1); /* in variable.c */
rb_define_global_function("set_trace_func", set_trace_func, 1);
+ rb_global_variable(&trace_func);
rb_define_virtual_variable("$SAFE", safe_getter, safe_setter);
}
-VALUE f_autoload();
+/*
+ * call-seq:
+ * mod.autoload(name, filename) => nil
+ *
+ * Registers _filename_ to be loaded (using <code>Kernel::require</code>)
+ * the first time that _module_ (which may be a <code>String</code> or
+ * a symbol) is accessed in the namespace of _mod_.
+ *
+ * module A
+ * end
+ * A.autoload(:B, "b")
+ * A::B.doit # autoloads "b"
+ */
+
+static VALUE
+rb_mod_autoload(mod, sym, file)
+ VALUE mod;
+ VALUE sym;
+ VALUE file;
+{
+ ID id = rb_to_id(sym);
+
+ Check_SafeStr(file);
+ rb_autoload(mod, id, RSTRING(file)->ptr);
+ return Qnil;
+}
+
+/*
+ * MISSING: documentation
+ */
+
+static VALUE
+rb_mod_autoload_p(mod, sym)
+ VALUE mod, sym;
+{
+ return rb_autoload_p(mod, rb_to_id(sym));
+}
+
+/*
+ * call-seq:
+ * autoload(module, filename) => nil
+ *
+ * Registers _filename_ to be loaded (using <code>Kernel::require</code>)
+ * the first time that _module_ (which may be a <code>String</code> or
+ * a symbol) is accessed.
+ *
+ * autoload(:MyModule, "/usr/local/lib/modules/my_module.rb")
+ */
+
+static VALUE
+rb_f_autoload(obj, sym, file)
+ VALUE obj;
+ VALUE sym;
+ VALUE file;
+{
+ return rb_mod_autoload(ruby_cbase, sym, file);
+}
+
+
+/*
+ * MISSING: documentation
+ */
+
+static VALUE
+rb_f_autoload_p(obj, sym)
+ VALUE obj;
+ VALUE sym;
+{
+ /* use ruby_cbase as same as rb_f_autoload. */
+ return rb_mod_autoload_p(ruby_cbase, sym);
+}
void
Init_load()
{
- rb_load_path = ary_new();
+ rb_load_path = rb_ary_new();
rb_define_readonly_variable("$:", &rb_load_path);
rb_define_readonly_variable("$-I", &rb_load_path);
rb_define_readonly_variable("$LOAD_PATH", &rb_load_path);
- rb_features = ary_new();
+ rb_features = rb_ary_new();
rb_define_readonly_variable("$\"", &rb_features);
+ rb_define_readonly_variable("$LOADED_FEATURES", &rb_features);
+
+ rb_define_global_function("load", rb_f_load, -1);
+ rb_define_global_function("require", rb_f_require, 1);
+ rb_define_method(rb_cModule, "autoload", rb_mod_autoload, 2);
+ rb_define_method(rb_cModule, "autoload?", rb_mod_autoload_p, 1);
+ rb_define_global_function("autoload", rb_f_autoload, 2);
+ rb_define_global_function("autoload?", rb_f_autoload_p, 1);
+ rb_global_variable(&ruby_wrapper);
- rb_define_global_function("load", f_load, 1);
- rb_define_global_function("require", f_require, 1);
- rb_define_global_function("autoload", f_autoload, 2);
+ ruby_dln_librefs = rb_ary_new();
+ rb_global_variable(&ruby_dln_librefs);
}
static void
@@ -4813,7 +7700,8 @@ scope_dup(scope)
ID *tbl;
VALUE *vars;
- if (scope->flag & SCOPE_MALLOC) return;
+ scope->flags |= SCOPE_DONT_RECYCLE;
+ if (scope->flags & SCOPE_MALLOC) return;
if (scope->local_tbl) {
tbl = scope->local_tbl;
@@ -4821,10 +7709,7 @@ scope_dup(scope)
*vars++ = scope->local_vars[-1];
MEMCPY(vars, scope->local_vars, VALUE, tbl[0]);
scope->local_vars = vars;
- scope->flag = SCOPE_MALLOC;
- }
- else {
- scope->flag = SCOPE_NOSTACK;
+ scope->flags |= SCOPE_MALLOC;
}
}
@@ -4833,24 +7718,45 @@ blk_mark(data)
struct BLOCK *data;
{
while (data) {
- gc_mark_frame(&data->frame);
- gc_mark(data->scope);
- gc_mark(data->var);
- gc_mark(data->body);
- gc_mark(data->self);
- gc_mark(data->d_vars);
+ rb_gc_mark_frame(&data->frame);
+ rb_gc_mark((VALUE)data->scope);
+ rb_gc_mark((VALUE)data->var);
+ rb_gc_mark((VALUE)data->body);
+ rb_gc_mark((VALUE)data->self);
+ rb_gc_mark((VALUE)data->dyna_vars);
+ rb_gc_mark((VALUE)data->cref);
+ rb_gc_mark(data->wrapper);
+ rb_gc_mark(data->block_obj);
data = data->prev;
}
}
static void
+frame_free(frame)
+ struct FRAME *frame;
+{
+ struct FRAME *tmp;
+
+ if (frame->argc > 0 && (frame->flags & FRAME_MALLOC))
+ free(frame->argv);
+ frame = frame->prev;
+ while (frame) {
+ if (frame->argc > 0 && (frame->flags & FRAME_MALLOC))
+ free(frame->argv);
+ tmp = frame;
+ frame = frame->prev;
+ free(tmp);
+ }
+}
+
+static void
blk_free(data)
struct BLOCK *data;
{
- struct BLOCK *tmp;
-
+ void *tmp;
+
while (data) {
- free(data->frame.argv);
+ frame_free(&data->frame);
tmp = data;
data = data->prev;
free(tmp);
@@ -4858,65 +7764,141 @@ blk_free(data)
}
static void
+frame_dup(frame)
+ struct FRAME *frame;
+{
+ VALUE *argv;
+ struct FRAME *tmp;
+
+ for (;;) {
+ if (frame->argc > 0) {
+ argv = ALLOC_N(VALUE, frame->argc);
+ MEMCPY(argv, frame->argv, VALUE, frame->argc);
+ frame->argv = argv;
+ frame->flags |= FRAME_MALLOC;
+ }
+ frame->tmp = 0; /* should not preserve tmp */
+ if (!frame->prev) break;
+ tmp = ALLOC(struct FRAME);
+ *tmp = *frame->prev;
+ frame->prev = tmp;
+ frame = tmp;
+ }
+}
+
+
+static void
blk_copy_prev(block)
struct BLOCK *block;
{
struct BLOCK *tmp;
+ struct RVarmap* vars;
while (block->prev) {
tmp = ALLOC_N(struct BLOCK, 1);
MEMCPY(tmp, block->prev, struct BLOCK, 1);
- tmp->frame.argv = ALLOC_N(VALUE, tmp->frame.argc);
- MEMCPY(tmp->frame.argv, block->frame.argv, VALUE, tmp->frame.argc);
+ scope_dup(tmp->scope);
+ frame_dup(&tmp->frame);
+
+ for (vars = tmp->dyna_vars; vars; vars = vars->next) {
+ if (FL_TEST(vars, DVAR_DONT_RECYCLE)) break;
+ FL_SET(vars, DVAR_DONT_RECYCLE);
+ }
+
block->prev = tmp;
block = tmp;
}
}
+static void
+blk_dup(dup, orig)
+ struct BLOCK *dup, *orig;
+{
+ MEMCPY(dup, orig, struct BLOCK, 1);
+ frame_dup(&dup->frame);
+
+ if (dup->iter) {
+ blk_copy_prev(dup);
+ }
+ else {
+ dup->prev = 0;
+ }
+}
+
+/*
+ * MISSING: documentation
+ */
+
static VALUE
-bind_clone(self)
+proc_clone(self)
VALUE self;
{
struct BLOCK *orig, *data;
VALUE bind;
Data_Get_Struct(self, struct BLOCK, orig);
- bind = Data_Make_Struct(self,struct BLOCK,blk_mark,blk_free,data);
- MEMCPY(data, orig, struct BLOCK, 1);
- data->frame.argv = ALLOC_N(VALUE, orig->frame.argc);
- MEMCPY(data->frame.argv, orig->frame.argv, VALUE, orig->frame.argc);
+ bind = Data_Make_Struct(rb_obj_class(self),struct BLOCK,blk_mark,blk_free,data);
+ CLONESETUP(bind, self);
+ blk_dup(data, orig);
- if (data->iter) {
- blk_copy_prev(data);
- }
- else {
- data->prev = 0;
- }
+ return bind;
+}
+
+/*
+ * MISSING: documentation
+ */
+
+static VALUE
+proc_dup(self)
+ VALUE self;
+{
+ struct BLOCK *orig, *data;
+ VALUE bind;
+
+ 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);
return bind;
}
+/*
+ * call-seq:
+ * binding -> a_binding
+ *
+ * Returns a +Binding+ object, describing the variable and
+ * method bindings at the point of call. This object can be used when
+ * calling +eval+ to execute the evaluated command in this
+ * environment. Also see the description of class +Binding+.
+ *
+ * def getBinding(param)
+ * return binding
+ * end
+ * b = getBinding("hello")
+ * eval("param", b) #=> "hello"
+ */
+
static VALUE
-f_binding(self)
+rb_f_binding(self)
VALUE self;
{
- struct BLOCK *data;
+ struct BLOCK *data, *p;
+ struct RVarmap *vars;
VALUE bind;
PUSH_BLOCK(0,0);
- bind = Data_Make_Struct(cBinding,struct BLOCK,blk_mark,blk_free,data);
- MEMCPY(data, the_block, struct BLOCK, 1);
+ bind = Data_Make_Struct(rb_cBinding,struct BLOCK,blk_mark,blk_free,data);
+ *data = *ruby_block;
-#ifdef THREAD
- data->orig_thread = thread_current();
-#endif
- data->iter = f_iterator_p();
- if (the_frame->prev) {
- data->frame.last_func = the_frame->prev->last_func;
+ data->orig_thread = rb_thread_current();
+ data->wrapper = ruby_wrapper;
+ data->iter = rb_f_block_given_p();
+ frame_dup(&data->frame);
+ if (ruby_frame->prev) {
+ data->frame.last_func = ruby_frame->prev->last_func;
+ data->frame.last_class = ruby_frame->prev->last_class;
}
- data->frame.argv = ALLOC_N(VALUE, data->frame.argc);
- MEMCPY(data->frame.argv, the_block->frame.argv, VALUE, data->frame.argc);
if (data->iter) {
blk_copy_prev(data);
@@ -4925,38 +7907,74 @@ f_binding(self)
data->prev = 0;
}
+ for (p = data; p; p = p->prev) {
+ for (vars = p->dyna_vars; vars; vars = vars->next) {
+ if (FL_TEST(vars, DVAR_DONT_RECYCLE)) break;
+ FL_SET(vars, DVAR_DONT_RECYCLE);
+ }
+ }
scope_dup(data->scope);
POP_BLOCK();
return bind;
}
-#define PROC_TAINT FL_USER0
-#define PROC_T3 FL_USER1
-#define PROC_T4 FL_USER2
-#define PROC_T5 (FL_USER1|FL_USER2)
-#define PROC_TMASK (FL_USER1|FL_USER2)
+#define PROC_TSHIFT (FL_USHIFT+1)
+#define PROC_TMASK (FL_USER1|FL_USER2|FL_USER3)
+#define PROC_TMAX (PROC_TMASK >> PROC_TSHIFT)
+
+#define SAFE_LEVEL_MAX PROC_TMASK
+
+static void
+proc_save_safe_level(data)
+ VALUE data;
+{
+ int safe = ruby_safe_level;
+ if (safe > PROC_TMAX) safe = PROC_TMAX;
+ FL_SET(data, (safe << PROC_TSHIFT) & PROC_TMASK);
+}
+
+static int
+proc_get_safe_level(data)
+ VALUE data;
+{
+ return (RBASIC(data)->flags & PROC_TMASK) >> PROC_TSHIFT;
+}
+
+static void
+proc_set_safe_level(data)
+ VALUE data;
+{
+ ruby_safe_level = proc_get_safe_level(data);
+}
static VALUE
-proc_s_new(klass)
+proc_alloc(klass, proc)
VALUE klass;
+ int proc;
{
- volatile VALUE proc;
- struct BLOCK *data;
+ volatile VALUE block;
+ struct BLOCK *data, *p;
+ struct RVarmap *vars;
- if (!iterator_p() && !f_iterator_p()) {
- ArgError("tryed to create Procedure-Object out of iterator");
+ if (!rb_block_given_p() && !rb_f_block_given_p()) {
+ rb_raise(rb_eArgError, "tried to create Proc object without a block");
+ }
+ if (proc && !rb_block_given_p()) {
+ rb_warn("tried to create Proc object without a block");
}
- proc = Data_Make_Struct(klass, struct BLOCK, blk_mark, blk_free, data);
- *data = *the_block;
+ if (!proc && ruby_block->block_obj && CLASS_OF(ruby_block->block_obj) == klass) {
+ return ruby_block->block_obj;
+ }
+ block = Data_Make_Struct(klass, struct BLOCK, blk_mark, blk_free, data);
+ *data = *ruby_block;
-#ifdef THREAD
- data->orig_thread = thread_current();
-#endif
- data->iter = data->prev?TRUE:FALSE;
- data->frame.argv = ALLOC_N(VALUE, data->frame.argc);
- MEMCPY(data->frame.argv, the_block->frame.argv, VALUE, data->frame.argc);
+ data->orig_thread = rb_thread_current();
+ data->wrapper = ruby_wrapper;
+ data->iter = data->prev?Qtrue:Qfalse;
+ data->block_obj = block;
+ frame_dup(&data->frame);
if (data->iter) {
blk_copy_prev(data);
}
@@ -4964,133 +7982,389 @@ proc_s_new(klass)
data->prev = 0;
}
- scope_dup(data->scope);
- if (safe_level >= 3) {
- FL_SET(proc, PROC_TAINT);
- switch (safe_level) {
- case 3:
- FL_SET(proc, PROC_T3);
- break;
- case 4:
- FL_SET(proc, PROC_T4);
- break;
- case 5:
- FL_SET(proc, PROC_T5);
- break;
+ for (p = data; p; p = p->prev) {
+ for (vars = p->dyna_vars; vars; vars = vars->next) {
+ if (FL_TEST(vars, DVAR_DONT_RECYCLE)) break;
+ FL_SET(vars, DVAR_DONT_RECYCLE);
}
}
- obj_call_init(proc);
+ scope_dup(data->scope);
+ proc_save_safe_level(block);
+ if (proc) {
+ data->flags |= BLOCK_LAMBDA;
+ }
+ else {
+ ruby_block->block_obj = block;
+ }
- return proc;
+ return block;
+}
+
+/*
+ * call-seq:
+ * Proc.new {|...| block } => a_proc
+ * Proc.new => a_proc
+ *
+ * Creates a new <code>Proc</code> object, bound to the current
+ * context. <code>Proc::new</code> may be called without a block only
+ * within a method with an attached block, in which case that block is
+ * converted to the <code>Proc</code> object.
+ *
+ * def proc_from
+ * Proc.new
+ * end
+ * proc = proc_from { "hello" }
+ * proc.call #=> "hello"
+ */
+
+static VALUE
+proc_s_new(argc, argv, klass)
+ int argc;
+ VALUE *argv;
+ VALUE klass;
+{
+ VALUE block = proc_alloc(klass, Qfalse);
+
+ rb_obj_call_init(block, argc, argv);
+ return block;
}
VALUE
-f_lambda()
+rb_block_proc()
{
- return proc_s_new(cProc);
+ return proc_alloc(rb_cProc, Qfalse);
+}
+
+VALUE
+rb_f_lambda()
+{
+ rb_warn("rb_f_lambda() is deprecated; use rb_block_proc() instead");
+ return proc_alloc(rb_cProc, Qtrue);
+}
+
+/*
+ * call-seq:
+ * proc { |...| block } => a_proc
+ * lambda { |...| block } => a_proc
+ *
+ * Equivalent to <code>Proc.new</code>, except the resulting Proc objects
+ * check the number of parameters passed when called.
+ */
+
+static VALUE
+proc_lambda()
+{
+ return proc_alloc(rb_cProc, Qtrue);
}
static int
-blk_orphan(data)
+block_orphan(data)
struct BLOCK *data;
{
- if (data->scope && data->scope != top_scope &&
- (data->scope->flag & SCOPE_NOSTACK)) {
+ if (data->scope->flags & SCOPE_NOSTACK) {
return 1;
}
-#ifdef THREAD
- if (data->orig_thread != thread_current()) {
+ if (data->orig_thread != rb_thread_current()) {
return 1;
}
-#endif
return 0;
}
static VALUE
-proc_call(proc, args)
+proc_invoke(proc, args, self, klass)
VALUE proc, args; /* OK */
+ VALUE self, klass;
{
struct BLOCK * volatile old_block;
+ struct BLOCK _block;
struct BLOCK *data;
- volatile VALUE result = Qnil;
+ volatile VALUE result = Qundef;
int state;
- volatile int orphan;
- volatile int safe = safe_level;
+ volatile int safe = ruby_safe_level;
+ volatile VALUE old_wrapper = ruby_wrapper;
+ volatile int pcall, avalue = Qtrue;
- if (TYPE(args) == T_ARRAY) {
- switch (RARRAY(args)->len) {
- case 0:
- args = Qnil;
- break;
- case 1:
- args = RARRAY(args)->ptr[0];
- break;
- }
+ 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));
}
Data_Get_Struct(proc, struct BLOCK, data);
- orphan = blk_orphan(data);
+ pcall = (data->flags & BLOCK_LAMBDA) ? YIELD_LAMBDA_CALL : 0;
+ if (!pcall && RARRAY(args)->len == 1) {
+ avalue = Qfalse;
+ args = RARRAY(args)->ptr[0];
+ }
+ PUSH_VARS();
+ ruby_wrapper = data->wrapper;
+ ruby_dyna_vars = data->dyna_vars;
/* PUSH BLOCK from data */
- old_block = the_block;
- the_block = data;
+ old_block = ruby_block;
+ _block = *data;
+ if (self != Qundef) _block.frame.self = self;
+ if (klass) _block.frame.last_class = klass;
+ ruby_block = &_block;
+
PUSH_ITER(ITER_CUR);
- the_frame->iter = ITER_CUR;
+ ruby_frame->iter = ITER_CUR;
+ PUSH_TAG(pcall ? PROT_LAMBDA : PROT_NONE);
+ 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);
+ }
+ else if (TAG_DST()) {
+ result = prot_tag->retval;
+ }
+ POP_TAG();
+ POP_ITER();
+ ruby_block = old_block;
+ ruby_wrapper = old_wrapper;
+ POP_VARS();
+ ruby_safe_level = safe;
- if (orphan) {/* orphan procedure */
- if (iterator_p()) {
- the_block->frame.iter = ITER_CUR;
+ switch (state) {
+ case 0:
+ break;
+ case TAG_RETRY:
+ proc_jump_error(TAG_RETRY, Qnil); /* xxx */
+ JUMP_TAG(state);
+ break;
+ case TAG_BREAK:
+ if (!pcall && result != Qundef) {
+ proc_jump_error(state, result);
}
- else {
- the_block->frame.iter = ITER_NOT;
+ case TAG_RETURN:
+ if (result != Qundef) {
+ if (pcall) break;
+ return_jump(result);
}
+ default:
+ JUMP_TAG(state);
}
+ return result;
+}
- if (FL_TEST(proc, PROC_TAINT)) {
- switch (RBASIC(proc)->flags & PROC_TMASK) {
- case PROC_T3:
- safe_level = 3;
- break;
- case PROC_T4:
- safe_level = 4;
- break;
- case PROC_T5:
- safe_level = 5;
- break;
+/* CHECKME: are the argument checking semantics correct? */
+
+/*
+ * call-seq:
+ * prc.call(params,...) => obj
+ * prc[params,...] => obj
+ *
+ * Invokes the block, setting the block's parameters to the values in
+ * <i>params</i> using something close to method calling semantics.
+ * Generates a warning if multiple values are passed to a proc that
+ * expects just one (previously this silently converted the parameters
+ * to an array).
+ *
+ * For procs created using <code>Kernel.proc</code>, generates an
+ * error if the wrong number of parameters
+ * are passed to a proc with multiple parameters. For procs created using
+ * <code>Proc.new</code>, extra parameters are silently discarded.
+ *
+ * Returns the value of the last expression evaluated in the block. See
+ * also <code>Proc#yield</code>.
+ *
+ * a_proc = Proc.new {|a, *b| b.collect {|i| i*a }}
+ * a_proc.call(9, 1, 2, 3) #=> [9, 18, 27]
+ * a_proc[9, 1, 2, 3] #=> [9, 18, 27]
+ * a_proc = Proc.new {|a,b| a}
+ * a_proc.call(1,2,3)
+ *
+ * <em>produces:</em>
+ *
+ * prog.rb:5: wrong number of arguments (3 for 2) (ArgumentError)
+ * from prog.rb:4:in `call'
+ * from prog.rb:5
+ */
+
+static VALUE
+proc_call(proc, args)
+ VALUE proc, args; /* OK */
+{
+ return proc_invoke(proc, args, Qundef, 0);
+}
+
+static VALUE bmcall _((VALUE, VALUE));
+static VALUE method_arity _((VALUE));
+
+/*
+ * call-seq:
+ * prc.arity -> fixnum
+ *
+ * Returns the number of arguments required by the block. If the block
+ * is declared to take no arguments, returns 0. If the block is known
+ * to take exactly n arguments, returns n. If the block has optional
+ * arguments, return -n-1, where n is the number of mandatory
+ * arguments. A <code>proc</code> with no argument declarations
+ * returns -1, as it can accept (and ignore) an arbitrary number of
+ * parameters.
+ *
+ * Proc.new {}.arity #=> -1
+ * Proc.new {||}.arity #=> 0
+ * Proc.new {|a|}.arity #=> 1
+ * Proc.new {|a,b|}.arity #=> 2
+ * Proc.new {|a,b,c|}.arity #=> 3
+ * Proc.new {|*a|}.arity #=> -1
+ * Proc.new {|a,*b|}.arity #=> -2
+ */
+
+static VALUE
+proc_arity(proc)
+ VALUE proc;
+{
+ struct BLOCK *data;
+ NODE *list;
+ int n;
+
+ Data_Get_Struct(proc, struct BLOCK, data);
+ if (data->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);
}
-
- PUSH_TAG(PROT_NONE);
- state = EXEC_TAG();
- if (state == 0) {
- result = rb_yield(args);
+ if (data->var == (NODE*)1) return INT2FIX(0);
+ if (data->var == (NODE*)2) return INT2FIX(0);
+ switch (nd_type(data->var)) {
+ default:
+ return INT2FIX(1);
+ case NODE_MASGN:
+ list = data->var->nd_head;
+ n = 0;
+ while (list) {
+ n++;
+ list = list->nd_next;
+ }
+ if (data->var->nd_args) return INT2FIX(-n-1);
+ return INT2FIX(n);
}
- POP_TAG();
+}
- POP_ITER();
- if (the_block->tag->dst == state) {
- state &= TAG_MASK;
+/*
+ * call-seq:
+ * prc == other_proc => true or false
+ *
+ * Return <code>true</code> if <i>prc</i> is the same object as
+ * <i>other_proc</i>, or if they are both procs with the same body.
+ */
+
+static VALUE
+proc_eq(self, other)
+ VALUE self, other;
+{
+ struct BLOCK *data, *data2;
+
+ if (self == other) return Qtrue;
+ if (TYPE(other) != T_DATA) return Qfalse;
+ if (RDATA(other)->dmark != (RUBY_DATA_FUNC)blk_mark) return Qfalse;
+ if (CLASS_OF(self) != CLASS_OF(other)) return Qfalse;
+ Data_Get_Struct(self, struct BLOCK, data);
+ Data_Get_Struct(other, struct BLOCK, data2);
+ if (data->body != data2->body) return Qfalse;
+ if (data->var != data2->var) return Qfalse;
+ if (data->scope != data2->scope) return Qfalse;
+ if (data->dyna_vars != data2->dyna_vars) return Qfalse;
+ if (data->flags != data2->flags) return Qfalse;
+
+ return Qtrue;
+}
+
+/*
+ * call-seq:
+ * prc.to_s => string
+ *
+ * Shows the unique identifier for this proc, along with
+ * an indication of where the proc was defined.
+ */
+
+static VALUE
+proc_to_s(self)
+ VALUE self;
+{
+ struct BLOCK *data;
+ NODE *node;
+ char *cname = rb_obj_classname(self);
+ const int w = (SIZEOF_LONG * CHAR_BIT) / 4;
+ long len = strlen(cname)+6+w; /* 6:tags 16:addr */
+ VALUE str;
+
+ Data_Get_Struct(self, struct BLOCK, data);
+ if ((node = data->frame.node) || (node = data->body)) {
+ len += strlen(node->nd_file) + 2 + (SIZEOF_LONG*CHAR_BIT-NODE_LSHIFT)/3;
+ str = rb_str_new(0, len);
+ sprintf(RSTRING(str)->ptr, "#<%s:0x%.*lx@%s:%d>", cname, w, (VALUE)data->body,
+ node->nd_file, nd_line(node));
+ }
+ else {
+ str = rb_str_new(0, len);
+ sprintf(RSTRING(str)->ptr, "#<%s:0x%.*lx>", cname, w, (VALUE)data->body);
}
- the_block = old_block;
- safe_level = safe;
+ RSTRING(str)->len = strlen(RSTRING(str)->ptr);
+ if (OBJ_TAINTED(self)) OBJ_TAINT(str);
- if (state) {
- if (orphan) {/* orphan procedure */
- switch (state) {
- case TAG_BREAK:
- Raise(eLocalJumpError, "break from proc-closure");
- break;
- case TAG_RETRY:
- Raise(eLocalJumpError, "retry from proc-closure");
- break;
- case TAG_RETURN:
- Raise(eLocalJumpError, "return from proc-closure");
- break;
- }
- }
- JUMP_TAG(state);
+ return str;
+}
+
+/*
+ * call-seq:
+ * prc.to_proc -> prc
+ *
+ * Part of the protocol for converting objects to <code>Proc</code>
+ * objects. Instances of class <code>Proc</code> simply return
+ * themselves.
+ */
+
+static VALUE
+proc_to_self(self)
+ VALUE self;
+{
+ return self;
+}
+
+/*
+ * call-seq:
+ * prc.binding => binding
+ *
+ * Returns the binding associated with <i>prc</i>. Note that
+ * <code>Kernel#eval</code> accepts either a <code>Proc</code> or a
+ * <code>Binding</code> object as its second parameter.
+ *
+ * def fred(param)
+ * proc {}
+ * end
+ *
+ * b = fred(99)
+ * eval("param", b.binding) #=> 99
+ * eval("param", b) #=> 99
+ */
+
+static VALUE
+proc_binding(proc)
+ VALUE proc;
+{
+ struct BLOCK *orig, *data;
+ VALUE bind;
+
+ Data_Get_Struct(proc, struct BLOCK, orig);
+ bind = Data_Make_Struct(rb_cBinding,struct BLOCK,blk_mark,blk_free,data);
+ MEMCPY(data, orig, struct BLOCK, 1);
+ frame_dup(&data->frame);
+
+ if (data->iter) {
+ blk_copy_prev(data);
}
- return result;
+ else {
+ data->prev = 0;
+ }
+
+ return bind;
}
static VALUE
@@ -5098,83 +8372,95 @@ block_pass(self, node)
VALUE self;
NODE *node;
{
- VALUE block = rb_eval(self, node->nd_body);
+ VALUE proc = rb_eval(self, node->nd_body); /* OK */
+ VALUE b;
struct BLOCK * volatile old_block;
+ struct BLOCK _block;
struct BLOCK *data;
volatile VALUE result = Qnil;
int state;
volatile int orphan;
- volatile int safe = safe_level;
+ volatile int safe = ruby_safe_level;
- if (NIL_P(block)) {
- return rb_eval(self, node->nd_iter);
+ if (NIL_P(proc)) {
+ PUSH_ITER(ITER_NOT);
+ result = rb_eval(self, node->nd_iter);
+ POP_ITER();
+ return result;
+ }
+ if (!rb_obj_is_proc(proc)) {
+ b = rb_check_convert_type(proc, T_DATA, "Proc", "to_proc");
+ if (!rb_obj_is_proc(b)) {
+ rb_raise(rb_eTypeError, "wrong argument type %s (expected Proc)",
+ rb_obj_classname(proc));
+ }
+ proc = b;
}
- if (obj_is_kind_of(block, cMethod)) {
- block = method_proc(block);
+
+ if (ruby_safe_level >= 1 && OBJ_TAINTED(proc)) {
+ if (ruby_safe_level > proc_get_safe_level(proc)) {
+ rb_raise(rb_eSecurityError, "Insecure: tainted block value");
+ }
}
- else if (!obj_is_proc(block)) {
- TypeError("wrong argument type %s (expected Proc)",
- rb_class2name(CLASS_OF(block)));
+
+ if (ruby_block && ruby_block->block_obj == proc) {
+ PUSH_ITER(ITER_PRE);
+ result = rb_eval(self, node->nd_iter);
+ POP_ITER();
+ return result;
}
- Data_Get_Struct(block, struct BLOCK, data);
- orphan = blk_orphan(data);
+ Data_Get_Struct(proc, struct BLOCK, data);
+ orphan = block_orphan(data);
/* PUSH BLOCK from data */
- old_block = the_block;
- the_block = data;
+ old_block = ruby_block;
+ _block = *data;
+ _block.outer = ruby_block;
+ _block.uniq = block_unique++;
+ ruby_block = &_block;
PUSH_ITER(ITER_PRE);
- the_frame->iter = ITER_PRE;
- if (FL_TEST(block, PROC_TAINT)) {
- switch (RBASIC(block)->flags & PROC_TMASK) {
- case PROC_T3:
- safe_level = 3;
- break;
- case PROC_T4:
- safe_level = 4;
- break;
- case PROC_T5:
- safe_level = 5;
- break;
- }
- }
+ if (ruby_frame->iter == ITER_NOT)
+ ruby_frame->iter = ITER_PRE;
- PUSH_TAG(PROT_NONE);
+ PUSH_TAG(PROT_LOOP);
state = EXEC_TAG();
if (state == 0) {
+ retry:
+ proc_set_safe_level(proc);
+ if (safe > ruby_safe_level)
+ ruby_safe_level = safe;
result = rb_eval(self, node->nd_iter);
}
+ else if (state == TAG_BREAK && TAG_DST()) {
+ result = prot_tag->retval;
+ state = 0;
+ }
+ else if (state == TAG_RETRY) {
+ state = 0;
+ goto retry;
+ }
POP_TAG();
-
POP_ITER();
- if (the_block->tag->dst == state) {
- state &= TAG_MASK;
- orphan = 2;
- }
- the_block = old_block;
- safe_level = safe;
+ ruby_block = old_block;
+ ruby_safe_level = safe;
- if (state) {
- if (orphan == 2) {/* escape from orphan procedure */
- switch (state) {
- case TAG_BREAK:
- Raise(eLocalJumpError, "break from proc-closure");
- break;
- case TAG_RETRY:
- Raise(eLocalJumpError, "retry from proc-closure");
- break;
- case TAG_RETURN:
- Raise(eLocalJumpError, "return from proc-closure");
- break;
- }
+ switch (state) {/* escape from orphan block */
+ case 0:
+ break;
+ case TAG_RETURN:
+ if (orphan) {
+ proc_jump_error(state, prot_tag->retval);
}
+ default:
JUMP_TAG(state);
}
+
return result;
}
struct METHOD {
- VALUE klass, oklass;
+ VALUE klass, rklass;
VALUE recv;
ID id, oid;
NODE *body;
@@ -5184,29 +8470,27 @@ static void
bm_mark(data)
struct METHOD *data;
{
- gc_mark(data->oklass);
- gc_mark(data->klass);
- gc_mark(data->recv);
- gc_mark(data->body);
+ rb_gc_mark(data->rklass);
+ rb_gc_mark(data->klass);
+ rb_gc_mark(data->recv);
+ rb_gc_mark((VALUE)data->body);
}
static VALUE
-obj_method(obj, vid)
- VALUE obj;
- VALUE vid;
+mnew(klass, obj, id, mklass)
+ VALUE klass, obj, mklass;
+ ID id;
{
VALUE method;
- VALUE klass = CLASS_OF(obj);
- ID id;
NODE *body;
int noex;
struct METHOD *data;
-
- id = rb_to_id(vid);
+ VALUE rklass = klass;
+ ID oid = id;
again:
if ((body = rb_get_method_body(&klass, &id, &noex)) == 0) {
- return rb_undefined(obj, rb_to_id(vid), 0, 0, 0);
+ print_undef(rklass, oid);
}
if (nd_type(body) == NODE_ZSUPER) {
@@ -5214,66 +8498,499 @@ obj_method(obj, vid)
goto again;
}
- method = Data_Make_Struct(cMethod, struct METHOD, bm_mark, free, data);
+ while (rklass != klass &&
+ (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;
data->id = id;
data->body = body;
- data->oklass = CLASS_OF(obj);
- data->oid = rb_to_id(vid);
+ data->rklass = rklass;
+ data->oid = oid;
+ OBJ_INFECT(method, klass);
return method;
}
+
+/**********************************************************************
+ *
+ * Document-class : Method
+ *
+ * Method objects are created by <code>Object#method</code>, and are
+ * associated with a particular object (not just with a class). They
+ * may be used to invoke the method within the object, and as a block
+ * associated with an iterator. They may also be unbound from one
+ * object (creating an <code>UnboundMethod</code>) and bound to
+ * another.
+ *
+ * class Thing
+ * def square(n)
+ * n*n
+ * end
+ * end
+ * thing = Thing.new
+ * meth = thing.method(:square)
+ *
+ * meth.call(9) #=> 81
+ * [ 1, 2, 3 ].collect(&meth) #=> [1, 4, 9]
+ *
+ */
+
+/*
+ * call-seq:
+ * meth == other_meth => true or false
+ *
+ * Two method objects are equal if that are bound to the same
+ * object and contain the same body.
+ */
+
+
+static VALUE
+method_eq(method, other)
+ VALUE method, other;
+{
+ struct METHOD *m1, *m2;
+
+ if (TYPE(other) != T_DATA || RDATA(other)->dmark != (RUBY_DATA_FUNC)bm_mark)
+ return Qfalse;
+ if (CLASS_OF(method) != CLASS_OF(other))
+ return Qfalse;
+
+ Data_Get_Struct(method, struct METHOD, m1);
+ Data_Get_Struct(other, struct METHOD, m2);
+
+ if (m1->klass != m2->klass || m1->rklass != m2->rklass ||
+ m1->recv != m2->recv || m1->body != m2->body)
+ return Qfalse;
+
+ return Qtrue;
+}
+
+/*
+ * call-seq:
+ * meth.unbind => unbound_method
+ *
+ * Dissociates <i>meth</i> from it's current receiver. The resulting
+ * <code>UnboundMethod</code> can subsequently be bound to a new object
+ * of the same class (see <code>UnboundMethod</code>).
+ */
+
+static VALUE
+method_unbind(obj)
+ VALUE obj;
+{
+ VALUE method;
+ struct METHOD *orig, *data;
+
+ Data_Get_Struct(obj, struct METHOD, orig);
+ method = Data_Make_Struct(rb_cUnboundMethod, struct METHOD, bm_mark, free, data);
+ data->klass = orig->klass;
+ data->recv = Qundef;
+ data->id = orig->id;
+ data->body = orig->body;
+ data->rklass = orig->rklass;
+ data->oid = orig->oid;
+ OBJ_INFECT(method, obj);
+
+ return method;
+}
+
+/*
+ * call-seq:
+ * obj.method(sym) => method
+ *
+ * Looks up the named method as a receiver in <i>obj</i>, returning a
+ * <code>Method</code> object (or raising <code>NameError</code>). The
+ * <code>Method</code> object acts as a closure in <i>obj</i>'s object
+ * instance, so instance variables and the value of <code>self</code>
+ * remain available.
+ *
+ * class Demo
+ * def initialize(n)
+ * @iv = n
+ * end
+ * def hello()
+ * "Hello, @iv = #{@iv}"
+ * end
+ * end
+ *
+ * k = Demo.new(99)
+ * m = k.method(:hello)
+ * m.call #=> "Hello, @iv = 99"
+ *
+ * l = Demo.new('Fred')
+ * m = l.method("hello")
+ * m.call #=> "Hello, @iv = Fred"
+ */
+
+static VALUE
+rb_obj_method(obj, vid)
+ VALUE obj;
+ VALUE vid;
+{
+ return mnew(CLASS_OF(obj), obj, rb_to_id(vid), rb_cMethod);
+}
+
+/*
+ * call-seq:
+ * mod.instance_method(symbol) => unbound_method
+ *
+ * Returns an +UnboundMethod+ representing the given
+ * instance method in _mod_.
+ *
+ * class Interpreter
+ * def do_a() print "there, "; end
+ * def do_d() print "Hello "; end
+ * def do_e() print "!\n"; end
+ * def do_v() print "Dave"; end
+ * Dispatcher = {
+ * ?a => instance_method(:do_a),
+ * ?d => instance_method(:do_d),
+ * ?e => instance_method(:do_e),
+ * ?v => instance_method(:do_v)
+ * }
+ * def interpret(string)
+ * string.each_byte {|b| Dispatcher[b].bind(self).call }
+ * end
+ * end
+ *
+ *
+ * interpreter = Interpreter.new
+ * interpreter.interpret('dave')
+ *
+ * <em>produces:</em>
+ *
+ * Hello there, Dave!
+ */
+
+static VALUE
+rb_mod_method(mod, vid)
+ VALUE mod;
+ VALUE vid;
+{
+ return mnew(mod, Qundef, rb_to_id(vid), rb_cUnboundMethod);
+}
+
+/*
+ * MISSING: documentation
+ */
+
+static VALUE
+method_clone(self)
+ VALUE self;
+{
+ 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);
+ CLONESETUP(clone, self);
+ *data = *orig;
+
+ return clone;
+}
+
+/*
+ * call-seq:
+ * meth.call(args, ...) => obj
+ * meth[args, ...] => obj
+ *
+ * Invokes the <i>meth</i> with the specified arguments, returning the
+ * method's return value.
+ *
+ * m = 12.method("+")
+ * m.call(3) #=> 15
+ * m.call(20) #=> 32
+ */
+
static VALUE
method_call(argc, argv, method)
int argc;
VALUE *argv;
VALUE method;
{
- VALUE result;
+ VALUE result = Qnil; /* OK */
struct METHOD *data;
+ int state;
+ volatile int safe = -1;
Data_Get_Struct(method, struct METHOD, data);
- PUSH_ITER(iterator_p()?ITER_PRE:ITER_NOT);
- result = rb_call0(data->klass, data->recv, data->id,
- argc, argv, data->body, 0);
+ if (data->recv == Qundef) {
+ rb_raise(rb_eTypeError, "you cannot call unbound method; bind first");
+ }
+ PUSH_ITER(rb_block_given_p()?ITER_PRE:ITER_NOT);
+ PUSH_TAG(PROT_NONE);
+ if (OBJ_TAINTED(method)) {
+ safe = ruby_safe_level;
+ if (ruby_safe_level < 4) ruby_safe_level = 4;
+ }
+ if ((state = EXEC_TAG()) == 0) {
+ result = rb_call0(data->klass,data->recv,data->id,data->oid,argc,argv,data->body,0);
+ }
+ POP_TAG();
POP_ITER();
+ if (safe >= 0) ruby_safe_level = safe;
+ if (state) JUMP_TAG(state);
return result;
}
+/**********************************************************************
+ *
+ * Document-class: UnboundMethod
+ *
+ * Ruby supports two forms of objectified methods. Class
+ * <code>Method</code> is used to represent methods that are associated
+ * with a particular object: these method objects are bound to that
+ * object. Bound method objects for an object can be created using
+ * <code>Object#method</code>.
+ *
+ * Ruby also supports unbound methods; methods objects that are not
+ * associated with a particular object. These can be created either by
+ * calling <code>Module#instance_method</code> or by calling
+ * <code>unbind</code> on a bound method object. The result of both of
+ * these is an <code>UnboundMethod</code> object.
+ *
+ * Unbound methods can only be called after they are bound to an
+ * object. That object must be be a kind_of? the method's original
+ * class.
+ *
+ * class Square
+ * def area
+ * @side * @side
+ * end
+ * def initialize(side)
+ * @side = side
+ * end
+ * end
+ *
+ * area_un = Square.instance_method(:area)
+ *
+ * s = Square.new(12)
+ * area = area_un.bind(s)
+ * area.call #=> 144
+ *
+ * Unbound methods are a reference to the method at the time it was
+ * objectified: subsequent changes to the underlying class will not
+ * affect the unbound method.
+ *
+ * class Test
+ * def test
+ * :original
+ * end
+ * end
+ * um = Test.instance_method(:test)
+ * class Test
+ * def test
+ * :modified
+ * end
+ * end
+ * t = Test.new
+ * t.test #=> :modified
+ * um.bind(t).call #=> :original
+ *
+ */
+
+/*
+ * call-seq:
+ * umeth.bind(obj) -> method
+ *
+ * Bind <i>umeth</i> to <i>obj</i>. If <code>Klass</code> was the class
+ * from which <i>umeth</i> was obtained,
+ * <code>obj.kind_of?(Klass)</code> must be true.
+ *
+ * class A
+ * def test
+ * puts "In test, class = #{self.class}"
+ * end
+ * end
+ * class B < A
+ * end
+ * class C < B
+ * end
+ *
+ *
+ * um = B.instance_method(:test)
+ * bm = um.bind(C.new)
+ * bm.call
+ * bm = um.bind(B.new)
+ * bm.call
+ * bm = um.bind(A.new)
+ * bm.call
+ *
+ * <em>produces:</em>
+ *
+ * In test, class = C
+ * In test, class = B
+ * prog.rb:16:in `bind': bind argument must be an instance of B (TypeError)
+ * from prog.rb:16
+ */
+
+static VALUE
+umethod_bind(method, recv)
+ VALUE method, recv;
+{
+ struct METHOD *data, *bound;
+
+ Data_Get_Struct(method, struct METHOD, data);
+ if (data->rklass != CLASS_OF(recv)) {
+ if (FL_TEST(data->rklass, FL_SINGLETON)) {
+ rb_raise(rb_eTypeError, "singleton method called for a different object");
+ }
+ if(!rb_obj_is_kind_of(recv, data->rklass)) {
+ rb_raise(rb_eTypeError, "bind argument must be an instance of %s",
+ rb_class2name(data->rklass));
+ }
+ }
+
+ method = Data_Make_Struct(rb_cMethod,struct METHOD,bm_mark,free,bound);
+ *bound = *data;
+ bound->recv = recv;
+ bound->rklass = CLASS_OF(recv);
+
+ return method;
+}
+
+/*
+ * call-seq:
+ * meth.arity => fixnum
+ *
+ * Returns an indication of the number of arguments accepted by a
+ * method. Returns a nonnegative integer for methods that take a fixed
+ * number of arguments. For Ruby methods that take a variable number of
+ * arguments, returns -n-1, where n is the number of required
+ * arguments. For methods written in C, returns -1 if the call takes a
+ * variable number of arguments.
+ *
+ * class C
+ * def one; end
+ * def two(a); end
+ * def three(*a); end
+ * def four(a, b); end
+ * def five(a, b, *c); end
+ * def six(a, b, *c, &d); end
+ * end
+ * c = C.new
+ * c.method(:one).arity #=> 0
+ * c.method(:two).arity #=> 1
+ * c.method(:three).arity #=> -1
+ * c.method(:four).arity #=> 2
+ * c.method(:five).arity #=> -3
+ * c.method(:six).arity #=> -3
+ *
+ * "cat".method(:size).arity #=> 0
+ * "cat".method(:replace).arity #=> 1
+ * "cat".method(:squeeze).arity #=> -1
+ * "cat".method(:count).arity #=> -1
+ */
+
+static VALUE
+method_arity(method)
+ VALUE method;
+{
+ struct METHOD *data;
+ NODE *body;
+ int n;
+
+ Data_Get_Struct(method, struct METHOD, data);
+
+ body = data->body;
+ switch (nd_type(body)) {
+ case NODE_CFUNC:
+ if (body->nd_argc < 0) return INT2FIX(-1);
+ return INT2FIX(body->nd_argc);
+ case NODE_ZSUPER:
+ return INT2FIX(-1);
+ case NODE_ATTRSET:
+ return INT2FIX(1);
+ case NODE_IVAR:
+ return INT2FIX(0);
+ case NODE_BMETHOD:
+ case NODE_DMETHOD:
+ return proc_arity(body->nd_cval);
+ default:
+ body = body->nd_next; /* skip NODE_SCOPE */
+ if (nd_type(body) == NODE_BLOCK)
+ body = body->nd_head;
+ if (!body) return INT2FIX(0);
+ n = body->nd_cnt;
+ if (body->nd_opt || body->nd_rest != -1)
+ n = -n-1;
+ return INT2FIX(n);
+ }
+}
+
+/*
+ * call-seq:
+ * meth.to_s => string
+ * meth.inspect => string
+ *
+ * Show the name of the underlying method.
+ *
+ * "cat".method(:count).inspect #=> "#<Method: String#count>"
+ */
+
static VALUE
method_inspect(method)
VALUE method;
{
struct METHOD *data;
VALUE str;
- char *s;
+ const char *s;
+ char *sharp = "#";
Data_Get_Struct(method, struct METHOD, data);
- str = str_new2("#<");
- s = rb_class2name(CLASS_OF(method));
- str_cat(str, s, strlen(s));
- str_cat(str, ": ", 2);
- s = rb_class2name(data->oklass);
- str_cat(str, s, strlen(s));
- str_cat(str, "#", 1);
- s = rb_id2name(data->oid);
- str_cat(str, s, strlen(s));
- str_cat(str, ">", 1);
+ str = rb_str_buf_new2("#<");
+ s = rb_obj_classname(method);
+ rb_str_buf_cat2(str, s);
+ rb_str_buf_cat2(str, ": ");
+
+ if (FL_TEST(data->klass, FL_SINGLETON)) {
+ VALUE v = rb_iv_get(data->klass, "__attached__");
+
+ if (data->recv == Qundef) {
+ rb_str_buf_append(str, rb_inspect(data->klass));
+ }
+ else if (data->recv == v) {
+ rb_str_buf_append(str, rb_inspect(v));
+ sharp = ".";
+ }
+ else {
+ rb_str_buf_append(str, rb_inspect(data->recv));
+ rb_str_buf_cat2(str, "(");
+ rb_str_buf_append(str, rb_inspect(v));
+ rb_str_buf_cat2(str, ")");
+ sharp = ".";
+ }
+ }
+ else {
+ rb_str_buf_cat2(str, rb_class2name(data->rklass));
+ if (data->rklass != data->klass) {
+ rb_str_buf_cat2(str, "(");
+ rb_str_buf_cat2(str, rb_class2name(data->klass));
+ rb_str_buf_cat2(str, ")");
+ }
+ }
+ rb_str_buf_cat2(str, sharp);
+ rb_str_buf_cat2(str, rb_id2name(data->oid));
+ rb_str_buf_cat2(str, ">");
return str;
}
static VALUE
-mproc()
+mproc(method)
+ VALUE method;
{
VALUE proc;
/* emulate ruby's method call */
PUSH_ITER(ITER_CUR);
PUSH_FRAME();
- proc = f_lambda();
+ proc = rb_block_proc();
POP_FRAME();
POP_ITER();
@@ -5281,102 +8998,398 @@ mproc()
}
static VALUE
-mcall(args, method)
+bmcall(args, method)
VALUE args, method;
{
- if (TYPE(args) == T_ARRAY) {
- return method_call(RARRAY(args)->len, RARRAY(args)->ptr, method);
- }
- return method_call(1, &args, method);
+ volatile VALUE a;
+
+ a = svalue_to_avalue(args);
+ return method_call(RARRAY(a)->len, RARRAY(a)->ptr, method);
}
+VALUE
+rb_proc_new(func, val)
+ VALUE (*func)(ANYARGS); /* VALUE yieldarg[, VALUE procarg] */
+ VALUE val;
+{
+ struct BLOCK *data;
+ VALUE proc = rb_iterate((VALUE(*)_((VALUE)))mproc, 0, func, val);
+
+ Data_Get_Struct(proc, struct BLOCK, data);
+ data->body->nd_state = YIELD_FUNC_AVALUE;
+ return proc;
+}
+
+/*
+ * call-seq:
+ * meth.to_proc => prc
+ *
+ * Returns a <code>Proc</code> object corresponding to this method.
+ */
+
static VALUE
method_proc(method)
VALUE method;
{
- return rb_iterate(mproc, 0, mcall, method);
+ VALUE proc;
+ struct METHOD *mdata;
+ struct BLOCK *bdata;
+
+ proc = rb_iterate((VALUE(*)_((VALUE)))mproc, 0, bmcall, method);
+ Data_Get_Struct(method, struct METHOD, mdata);
+ Data_Get_Struct(proc, struct BLOCK, bdata);
+ bdata->body->nd_file = mdata->body->nd_file;
+ nd_set_line(bdata->body, nd_line(mdata->body));
+ bdata->body->nd_state = YIELD_FUNC_SVALUE;
+
+ return proc;
}
-void
-Init_Proc()
+static VALUE
+rb_obj_is_method(m)
+ VALUE m;
+{
+ if (TYPE(m) == T_DATA && RDATA(m)->dmark == (RUBY_DATA_FUNC)bm_mark) {
+ return Qtrue;
+ }
+ return Qfalse;
+}
+
+/*
+ * call-seq:
+ * define_method(symbol, method) => new_method
+ * define_method(symbol) { block } => proc
+ *
+ * Defines an instance method in the receiver. The _method_
+ * parameter can be a +Proc+ or +Method+ object.
+ * If a block is specified, it is used as the method body. This block
+ * is evaluated using <code>instance_eval</code>, a point that is
+ * tricky to demonstrate because <code>define_method</code> is private.
+ * (This is why we resort to the +send+ hack in this example.)
+ *
+ * class A
+ * def fred
+ * puts "In Fred"
+ * end
+ * def create_method(name, &block)
+ * self.class.send(:define_method, name, &block)
+ * end
+ * define_method(:wilma) { puts "Charge it!" }
+ * end
+ * class B < A
+ * define_method(:barney, instance_method(:fred))
+ * end
+ * a = B.new
+ * a.barney
+ * a.wilma
+ * a.create_method(:betty) { p self }
+ * a.betty
+ *
+ * <em>produces:</em>
+ *
+ * In Fred
+ * Charge it!
+ * #<B:0x401b39e8>
+ */
+
+static VALUE
+rb_mod_define_method(argc, argv, mod)
+ int argc;
+ VALUE *argv;
+ VALUE mod;
{
- eLocalJumpError = rb_define_class("LocalJumpError", eStandardError);
- eSysStackError = rb_define_class("SystemStackError", eStandardError);
+ ID id;
+ VALUE body;
+ NODE *node;
+ int noex;
- cProc = rb_define_class("Proc", cObject);
- rb_define_singleton_method(cProc, "new", proc_s_new, 0);
+ if (argc == 1) {
+ id = rb_to_id(argv[0]);
+ body = proc_lambda();
+ }
+ else if (argc == 2) {
+ id = rb_to_id(argv[0]);
+ body = argv[1];
+ if (!rb_obj_is_method(body) && !rb_obj_is_proc(body)) {
+ rb_raise(rb_eTypeError, "wrong argument type %s (expected Proc/Method)",
+ rb_obj_classname(body));
+ }
+ }
+ else {
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
+ }
+ if (RDATA(body)->dmark == (RUBY_DATA_FUNC)bm_mark) {
+ node = NEW_DMETHOD(method_unbind(body));
+ }
+ else if (RDATA(body)->dmark == (RUBY_DATA_FUNC)blk_mark) {
+ struct BLOCK *block;
- rb_define_method(cProc, "call", proc_call, -2);
- rb_define_global_function("proc", f_lambda, 0);
- rb_define_global_function("lambda", f_lambda, 0);
- rb_define_global_function("binding", f_binding, 0);
- cBinding = rb_define_class("Binding", cObject);
- rb_undef_method(CLASS_OF(cMethod), "new");
- rb_define_method(cBinding, "clone", bind_clone, 0);
+ body = proc_clone(body);
+ Data_Get_Struct(body, struct BLOCK, block);
+ block->frame.last_func = id;
+ block->frame.orig_func = id;
+ block->frame.last_class = mod;
+ node = NEW_BMETHOD(body);
+ }
+ else {
+ /* type error */
+ rb_raise(rb_eTypeError, "wrong argument type (expected Proc/Method)");
+ }
- cMethod = rb_define_class("Method", cObject);
- rb_undef_method(CLASS_OF(cMethod), "new");
- rb_define_method(cMethod, "call", method_call, -1);
- rb_define_method(cMethod, "inspect", method_inspect, 0);
- rb_define_method(cMethod, "to_s", method_inspect, 0);
- rb_define_method(cMethod, "to_proc", method_proc, 0);
- rb_define_method(mKernel, "method", obj_method, 1);
+ if (SCOPE_TEST(SCOPE_PRIVATE)) {
+ noex = NOEX_PRIVATE;
+ }
+ else if (SCOPE_TEST(SCOPE_PROTECTED)) {
+ noex = NOEX_PROTECTED;
+ }
+ else {
+ noex = NOEX_PUBLIC;
+ }
+ rb_add_method(mod, id, node, noex);
+ return body;
}
-#ifdef THREAD
+/*
+ * <code>Proc</code> objects are blocks of code that have been bound to
+ * a set of local variables. Once bound, the code may be called in
+ * different contexts and still access those variables.
+ *
+ * def gen_times(factor)
+ * return Proc.new {|n| n*factor }
+ * end
+ *
+ * times3 = gen_times(3)
+ * times5 = gen_times(5)
+ *
+ * times3.call(12) #=> 36
+ * times5.call(5) #=> 25
+ * times3.call(times5.call(4)) #=> 60
+ *
+ */
-static VALUE eThreadError;
+void
+Init_Proc()
+{
+ rb_eLocalJumpError = rb_define_class("LocalJumpError", rb_eStandardError);
+ rb_define_method(rb_eLocalJumpError, "exit_value", localjump_xvalue, 0);
+ rb_define_method(rb_eLocalJumpError, "reason", localjump_reason, 0);
+
+ exception_error = rb_exc_new2(rb_eFatal, "exception reentered");
+ rb_global_variable(&exception_error);
+
+ rb_eSysStackError = rb_define_class("SystemStackError", rb_eStandardError);
+ sysstack_error = rb_exc_new2(rb_eSysStackError, "stack level too deep");
+ OBJ_TAINT(sysstack_error);
+ rb_global_variable(&sysstack_error);
+
+ rb_cProc = rb_define_class("Proc", rb_cObject);
+ rb_undef_alloc_func(rb_cProc);
+ rb_define_singleton_method(rb_cProc, "new", proc_s_new, -1);
+
+ 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, "arity", proc_arity, 0);
+ rb_define_method(rb_cProc, "[]", 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);
+ rb_define_method(rb_cProc, "binding", proc_binding, 0);
+
+ rb_define_global_function("proc", proc_lambda, 0);
+ rb_define_global_function("lambda", proc_lambda, 0);
+
+ rb_cMethod = rb_define_class("Method", rb_cObject);
+ rb_undef_alloc_func(rb_cMethod);
+ rb_undef_method(CLASS_OF(rb_cMethod), "new");
+ rb_define_method(rb_cMethod, "==", method_eq, 1);
+ rb_define_method(rb_cMethod, "clone", method_clone, 0);
+ rb_define_method(rb_cMethod, "call", method_call, -1);
+ rb_define_method(rb_cMethod, "[]", method_call, -1);
+ rb_define_method(rb_cMethod, "arity", method_arity, 0);
+ 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, "unbind", method_unbind, 0);
+ rb_define_method(rb_mKernel, "method", rb_obj_method, 1);
+
+ rb_cUnboundMethod = rb_define_class("UnboundMethod", rb_cObject);
+ rb_undef_alloc_func(rb_cUnboundMethod);
+ rb_undef_method(CLASS_OF(rb_cUnboundMethod), "new");
+ rb_define_method(rb_cUnboundMethod, "==", method_eq, 1);
+ rb_define_method(rb_cUnboundMethod, "clone", method_clone, 0);
+ 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, "bind", umethod_bind, 1);
+ rb_define_method(rb_cModule, "instance_method", rb_mod_method, 1);
+}
+
+/*
+ * Objects of class <code>Binding</code> encapsulate the execution
+ * context at some particular place in the code and retain this context
+ * for future use. The variables, methods, value of <code>self</code>,
+ * and possibly an iterator block that can be accessed in this context
+ * are all retained. Binding objects can be created using
+ * <code>Kernel#binding</code>, and are made available to the callback
+ * of <code>Kernel#set_trace_func</code>.
+ *
+ * These binding objects can be passed as the second argument of the
+ * <code>Kernel#eval</code> method, establishing an environment for the
+ * evaluation.
+ *
+ * class Demo
+ * def initialize(n)
+ * @secret = n
+ * end
+ * def getBinding
+ * return binding()
+ * end
+ * end
+ *
+ * k1 = Demo.new(99)
+ * b1 = k1.getBinding
+ * k2 = Demo.new(-3)
+ * b2 = k2.getBinding
+ *
+ * eval("@secret", b1) #=> 99
+ * eval("@secret", b2) #=> -3
+ * eval("@secret") #=> nil
+ *
+ * Binding objects have no class-specific methods.
+ *
+ */
+
+void
+Init_Binding()
+{
+ rb_cBinding = rb_define_class("Binding", rb_cObject);
+ rb_undef_alloc_func(rb_cBinding);
+ rb_undef_method(CLASS_OF(rb_cBinding), "new");
+ rb_define_method(rb_cBinding, "clone", proc_clone, 0);
+ rb_define_global_function("binding", rb_f_binding, 0);
+}
+
+#ifdef __ia64__
+#if defined(__FreeBSD__)
+/*
+ * FreeBSD/ia64 currently does not have a way for a process to get the
+ * base address for the RSE backing store, so hardcode it.
+ */
+#define __libc_ia64_register_backing_store_base (4ULL<<61)
+#else
+#pragma weak __libc_ia64_register_backing_store_base
+extern unsigned long __libc_ia64_register_backing_store_base;
+#endif
+#endif
-int thread_pending = 0;
+/* Windows SEH refers data on the stack. */
+#undef SAVE_WIN32_EXCEPTION_LIST
+#if defined _WIN32 || defined __CYGWIN__
+#if defined __CYGWIN__
+typedef unsigned long DWORD;
+#endif
-VALUE cThread;
+static inline DWORD
+win32_get_exception_list()
+{
+ DWORD p;
+# if defined _MSC_VER
+# ifdef _M_IX86
+# define SAVE_WIN32_EXCEPTION_LIST
+# if _MSC_VER >= 1310
+ /* warning: unsafe assignment to fs:0 ... this is ok */
+# pragma warning(disable: 4733)
+# endif
+ __asm mov eax, fs:[0];
+ __asm mov p, eax;
+# endif
+# elif defined __GNUC__
+# ifdef __i386__
+# define SAVE_WIN32_EXCEPTION_LIST
+ __asm__("movl %%fs:0,%0" : "=r"(p));
+# endif
+# elif defined __BORLANDC__
+# define SAVE_WIN32_EXCEPTION_LIST
+ __emit__(0x64, 0xA1, 0, 0, 0, 0); /* mov eax, fs:[0] */
+ p = _EAX;
+# endif
+ return p;
+}
+
+static inline void
+win32_set_exception_list(p)
+ DWORD p;
+{
+# if defined _MSC_VER
+# ifdef _M_IX86
+ __asm mov eax, p;
+ __asm mov fs:[0], eax;
+# endif
+# elif defined __GNUC__
+# ifdef __i386__
+ __asm__("movl %0,%%fs:0" :: "r"(p));
+# endif
+# elif defined __BORLANDC__
+ _EAX = p;
+ __emit__(0x64, 0xA3, 0, 0, 0, 0); /* mov fs:[0], eax */
+# endif
+}
-#include <sys/types.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#else
-#ifndef NT
-struct timeval {
- long tv_sec; /* seconds */
- long tv_usec; /* and microseconds */
-};
-#endif /* NT */
+#if !defined SAVE_WIN32_EXCEPTION_LIST && !defined _WIN32_WCE
+# error unsupported platform
#endif
-#include <signal.h>
-#include <errno.h>
-
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
#endif
-extern VALUE last_status;
+int rb_thread_pending = 0;
+
+VALUE rb_cThread;
+
+extern VALUE rb_last_status;
enum thread_status {
+ THREAD_TO_KILL,
THREAD_RUNNABLE,
THREAD_STOPPED,
- THREAD_TO_KILL,
THREAD_KILLED,
};
#define WAIT_FD (1<<0)
-#define WAIT_TIME (1<<1)
-#define WAIT_JOIN (1<<2)
+#define WAIT_SELECT (1<<1)
+#define WAIT_TIME (1<<2)
+#define WAIT_JOIN (1<<3)
+#define WAIT_PID (1<<4)
/* +infty, for this purpose */
#define DELAY_INFTY 1E30
-typedef struct thread * thread_t;
+#if !defined HAVE_PAUSE
+# if defined _WIN32 && !defined __CYGWIN__
+# define pause() Sleep(INFINITE)
+# else
+# define pause() sleep(0x7fffffff)
+# endif
+#endif
+
+/* typedef struct thread * rb_thread_t; */
struct thread {
struct thread *next, *prev;
- jmp_buf context;
+ rb_jmpbuf_t context;
+#ifdef SAVE_WIN32_EXCEPTION_LIST
+ DWORD win32_exception_list;
+#endif
VALUE result;
- int stk_len;
- int stk_max;
- VALUE*stk_ptr;
- VALUE*stk_pos;
+ long stk_len;
+ long stk_max;
+ VALUE *stk_ptr;
+ VALUE *stk_pos;
+#ifdef __ia64__
+ VALUE *bstr_ptr;
+ long bstr_len;
+#endif
struct FRAME *frame;
struct SCOPE *scope;
@@ -5385,13 +9398,14 @@ struct thread {
struct iter *iter;
struct tag *tag;
VALUE klass;
+ VALUE wrapper;
+ NODE *cref;
- VALUE trace;
- int misc; /* misc. states (vmode/trap_immediate) */
+ int flags; /* misc. states (vmode/rb_trap_immediate/raised) */
- char *file;
- int line;
+ NODE *node;
+ int tracing;
VALUE errinfo;
VALUE last_status;
VALUE last_line;
@@ -5399,21 +9413,28 @@ struct thread {
int safe;
- enum thread_status status;
+ enum thread_status status;
int wait_for;
int fd;
+ fd_set readfds;
+ fd_set writefds;
+ fd_set exceptfds;
+ int select_value;
double delay;
- thread_t join;
+ rb_thread_t join;
int abort;
+ int priority;
+ VALUE thgroup;
+
+ st_table *locals;
VALUE thread;
};
-static thread_t curr_thread;
-static int num_waiting_on_fd;
-static int num_waiting_on_timer;
-static int num_waiting_on_join;
+#define THREAD_RAISED 0x200 /* temporary flag */
+#define THREAD_TERMINATING 0x400 /* persistent flag */
+#define THREAD_FLAGS_MASK 0x400 /* 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)
@@ -5421,6 +9442,152 @@ static int num_waiting_on_join;
#define FOREACH_THREAD(x) FOREACH_THREAD_FROM(curr_thread,x)
#define END_FOREACH(x) END_FOREACH_FROM(curr_thread,x)
+struct thread_status_t {
+ NODE *node;
+
+ int tracing;
+ VALUE errinfo;
+ VALUE last_status;
+ VALUE last_line;
+ VALUE last_match;
+
+ int safe;
+
+ enum thread_status status;
+ int wait_for;
+ int fd;
+ fd_set readfds;
+ fd_set writefds;
+ fd_set exceptfds;
+ int select_value;
+ double delay;
+ rb_thread_t join;
+};
+
+#define THREAD_COPY_STATUS(src, dst) (void)( \
+ (dst)->node = (src)->node, \
+ \
+ (dst)->tracing = (src)->tracing, \
+ (dst)->errinfo = (src)->errinfo, \
+ (dst)->last_status = (src)->last_status, \
+ (dst)->last_line = (src)->last_line, \
+ (dst)->last_match = (src)->last_match, \
+ \
+ (dst)->safe = (src)->safe, \
+ \
+ (dst)->status = (src)->status, \
+ (dst)->wait_for = (src)->wait_for, \
+ (dst)->fd = (src)->fd, \
+ (dst)->readfds = (src)->readfds, \
+ (dst)->writefds = (src)->writefds, \
+ (dst)->exceptfds = (src)->exceptfds, \
+ (dst)->select_value = (src)->select_value, \
+ (dst)->delay = (src)->delay, \
+ (dst)->join = (src)->join, \
+ 0)
+
+static int
+thread_set_raised()
+{
+ if (curr_thread->flags & THREAD_RAISED) return 1;
+ curr_thread->flags |= THREAD_RAISED;
+ return 0;
+}
+
+static int
+thread_reset_raised()
+{
+ if (!(curr_thread->flags & THREAD_RAISED)) return 0;
+ curr_thread->flags &= ~THREAD_RAISED;
+ return 1;
+}
+
+static void rb_thread_ready _((rb_thread_t));
+
+static VALUE
+rb_trap_eval(cmd, sig, safe)
+ VALUE cmd;
+ int sig, safe;
+{
+ int state;
+ VALUE val = Qnil; /* OK */
+ volatile struct thread_status_t save;
+
+ THREAD_COPY_STATUS(curr_thread, &save);
+ rb_thread_ready(curr_thread);
+ PUSH_TAG(PROT_NONE);
+ PUSH_ITER(ITER_NOT);
+ if ((state = EXEC_TAG()) == 0) {
+ val = rb_eval_cmd(cmd, rb_ary_new3(1, INT2FIX(sig)), safe);
+ }
+ POP_ITER();
+ POP_TAG();
+ THREAD_COPY_STATUS(&save, curr_thread);
+
+ if (state) {
+ rb_trap_immediate = 0;
+ JUMP_TAG(state);
+ }
+
+ if (curr_thread->status == THREAD_STOPPED) {
+ rb_thread_schedule();
+ }
+ errno = EINTR;
+
+ return val;
+}
+
+static const char *
+thread_status_name(status)
+ enum thread_status status;
+{
+ switch (status) {
+ case THREAD_RUNNABLE:
+ return "run";
+ case THREAD_STOPPED:
+ return "sleep";
+ case THREAD_TO_KILL:
+ return "aborting";
+ case THREAD_KILLED:
+ return "dead";
+ default:
+ return "unknown";
+ }
+}
+
+/* $SAFE accessor */
+void
+rb_set_safe_level(level)
+ int level;
+{
+ if (level > ruby_safe_level) {
+ if (level > SAFE_LEVEL_MAX) level = SAFE_LEVEL_MAX;
+ ruby_safe_level = level;
+ curr_thread->safe = level;
+ }
+}
+
+static VALUE
+safe_getter()
+{
+ return INT2NUM(ruby_safe_level);
+}
+
+static void
+safe_setter(val)
+ VALUE val;
+{
+ int level = NUM2INT(val);
+
+ if (level < ruby_safe_level) {
+ rb_raise(rb_eSecurityError, "tried to downgrade safe level from %d to %d",
+ ruby_safe_level, level);
+ }
+ if (level > SAFE_LEVEL_MAX) level = SAFE_LEVEL_MAX;
+ ruby_safe_level = level;
+ curr_thread->safe = level;
+}
+
/* Return the current time as a floating-point number */
static double
timeofday()
@@ -5430,154 +9597,289 @@ timeofday()
return (double)tv.tv_sec + (double)tv.tv_usec * 1e-6;
}
-static thread_t main_thread;
-
-#define ADJ(addr) (void*)(((VALUE*)(addr)-th->stk_pos)+th->stk_ptr)
-#define STACK(addr) (th->stk_pos<(addr) && (addr)<th->stk_pos+th->stk_len)
+#define STACK(addr) (th->stk_pos<(VALUE*)(addr) && (VALUE*)(addr)<th->stk_pos+th->stk_len)
+#define ADJ(addr) (void*)(STACK(addr)?(((VALUE*)(addr)-th->stk_pos)+th->stk_ptr):(VALUE*)(addr))
+#ifdef C_ALLOCA
+# define MARK_FRAME_ADJ(f) rb_gc_mark_frame(f)
+#else
+# define MARK_FRAME_ADJ(f) mark_frame_adj(f, th)
+static void
+mark_frame_adj(frame, th)
+ struct FRAME *frame;
+ rb_thread_t th;
+{
+ if (frame->flags & FRAME_MALLOC) {
+ rb_gc_mark_locations(frame->argv, frame->argv+frame->argc);
+ }
+ else {
+ VALUE *start = ADJ(frame->argv);
+ rb_gc_mark_locations(start, start+frame->argc);
+ }
+ rb_gc_mark((VALUE)frame->node);
+}
+#endif
static void
thread_mark(th)
- thread_t th;
+ rb_thread_t th;
{
struct FRAME *frame;
struct BLOCK *block;
- gc_mark(th->result);
- gc_mark(th->thread);
- if (th->join) gc_mark(th->join->thread);
+ rb_gc_mark(th->result);
+ rb_gc_mark(th->thread);
+ if (th->join) rb_gc_mark(th->join->thread);
+
+ rb_gc_mark(th->klass);
+ rb_gc_mark(th->wrapper);
+ rb_gc_mark((VALUE)th->cref);
- gc_mark(th->scope);
- gc_mark(th->dyna_vars);
- gc_mark(th->errinfo);
- gc_mark(th->last_line);
- gc_mark(th->last_match);
+ rb_gc_mark((VALUE)th->scope);
+ rb_gc_mark((VALUE)th->dyna_vars);
+ rb_gc_mark(th->errinfo);
+ rb_gc_mark(th->last_line);
+ rb_gc_mark(th->last_match);
+ rb_mark_tbl(th->locals);
/* mark data in copied stack */
+ if (th == curr_thread) return;
+ if (th->status == THREAD_KILLED) return;
if (th->stk_len == 0) return; /* stack not active, no need to mark. */
if (th->stk_ptr) {
- gc_mark_locations(th->stk_ptr, th->stk_ptr+th->stk_len);
+ rb_gc_mark_locations(th->stk_ptr, th->stk_ptr+th->stk_len);
#if defined(THINK_C) || defined(__human68k__)
- gc_mark_locations(th->stk_ptr+2, th->stk_ptr+th->stk_len+2);
+ rb_gc_mark_locations(th->stk_ptr+2, th->stk_ptr+th->stk_len+2);
+#endif
+#ifdef __ia64__
+ if (th->bstr_ptr) {
+ rb_gc_mark_locations(th->bstr_ptr, th->bstr_ptr+th->bstr_len);
+ }
#endif
}
frame = th->frame;
while (frame && frame != top_frame) {
frame = ADJ(frame);
- if (frame->argv && !STACK(frame->argv)) {
- gc_mark_frame(frame);
+ MARK_FRAME_ADJ(frame);
+ if (frame->tmp) {
+ struct FRAME *tmp = frame->tmp;
+
+ while (tmp && tmp != top_frame) {
+ tmp = ADJ(tmp);
+ MARK_FRAME_ADJ(tmp);
+ tmp = tmp->prev;
+ }
}
frame = frame->prev;
}
block = th->block;
while (block) {
block = ADJ(block);
- if (block->frame.argv && !STACK(block->frame.argv)) {
- gc_mark_frame(&block->frame);
- }
+ MARK_FRAME_ADJ(&block->frame);
block = block->prev;
}
}
void
-gc_mark_threads()
+rb_gc_mark_threads()
{
- thread_t th;
+ rb_thread_t th;
+
+ /* static global mark */
+ rb_gc_mark((VALUE)ruby_cref);
if (!curr_thread) return;
FOREACH_THREAD(th) {
- thread_mark(th);
+ rb_gc_mark(th->thread);
} END_FOREACH(th);
}
static void
thread_free(th)
- thread_t th;
+ rb_thread_t th;
{
if (th->stk_ptr) free(th->stk_ptr);
th->stk_ptr = 0;
+#ifdef __ia64__
+ if (th->bstr_ptr) free(th->bstr_ptr);
+ th->bstr_ptr = 0;
+#endif
+ if (th->locals) st_free_table(th->locals);
+ if (th->status != THREAD_KILLED) {
+ if (th->prev) th->prev->next = th->next;
+ if (th->next) th->next->prev = th->prev;
+ }
if (th != main_thread) free(th);
}
-static thread_t
-thread_check(data)
+static rb_thread_t
+rb_thread_check(data)
VALUE data;
{
- if (TYPE(data) != T_DATA || RDATA(data)->dfree != thread_free) {
- TypeError("wrong argument type %s (expected Thread)",
- rb_class2name(CLASS_OF(data)));
+ if (TYPE(data) != T_DATA || RDATA(data)->dmark != (RUBY_DATA_FUNC)thread_mark) {
+ rb_raise(rb_eTypeError, "wrong argument type %s (expected Thread)",
+ rb_obj_classname(data));
}
- return (thread_t)RDATA(data)->data;
+ return (rb_thread_t)RDATA(data)->data;
}
+static VALUE rb_thread_raise _((int, VALUE*, rb_thread_t));
+
+static VALUE th_raise_exception;
+static NODE *th_raise_node;
+static VALUE th_cmd;
+static int th_sig, th_safe;
+static char *th_signm;
+
+#define RESTORE_NORMAL 1
+#define RESTORE_FATAL 2
+#define RESTORE_INTERRUPT 3
+#define RESTORE_TRAP 4
+#define RESTORE_RAISE 5
+#define RESTORE_SIGNAL 6
+#define RESTORE_EXIT 7
+
+extern VALUE *rb_gc_stack_start;
+
static void
-thread_save_context(th)
- thread_t th;
+rb_thread_save_context(th)
+ rb_thread_t th;
{
- VALUE v;
+ VALUE *pos;
+ int len;
+ static VALUE tval;
- int len = stack_length();
+ len = ruby_stack_length(&pos);
th->stk_len = 0;
- th->stk_pos = (gc_stack_start<(VALUE*)&v)?gc_stack_start
- :gc_stack_start - len;
- if (len > th->stk_max) {
+ th->stk_pos = pos;
+ if (len > th->stk_max) {
REALLOC_N(th->stk_ptr, VALUE, len);
th->stk_max = len;
}
th->stk_len = len;
- FLUSH_REGISTER_WINDOWS;
+ FLUSH_REGISTER_WINDOWS;
MEMCPY(th->stk_ptr, th->stk_pos, VALUE, th->stk_len);
+#ifdef __ia64__
+ {
+ ucontext_t ctx;
+ VALUE *top, *bot;
+
+ getcontext(&ctx);
+ bot = (VALUE*)__libc_ia64_register_backing_store_base;
+#if defined(__FreeBSD__)
+ top = (VALUE*)ctx.uc_mcontext.mc_special.bspstore;
+#else
+ top = (VALUE*)ctx.uc_mcontext.sc_ar_bsp;
+#endif
+ th->bstr_len = top - bot;
+ REALLOC_N(th->bstr_ptr, VALUE, th->bstr_len);
+ MEMCPY(th->bstr_ptr, (VALUE*)__libc_ia64_register_backing_store_base, VALUE, th->bstr_len);
+ }
+#endif
+#ifdef SAVE_WIN32_EXCEPTION_LIST
+ th->win32_exception_list = win32_get_exception_list();
+#endif
- th->frame = the_frame;
- th->scope = the_scope;
- th->klass = the_class;
- th->dyna_vars = the_dyna_vars;
- th->block = the_block;
- th->misc = scope_vmode | (trap_immediate<<8);
- th->iter = the_iter;
+ th->frame = ruby_frame;
+ th->scope = ruby_scope;
+ th->klass = ruby_class;
+ th->wrapper = ruby_wrapper;
+ th->cref = ruby_cref;
+ th->dyna_vars = ruby_dyna_vars;
+ th->block = ruby_block;
+ th->flags &= THREAD_FLAGS_MASK;
+ th->flags |= (rb_trap_immediate<<8) | scope_vmode;
+ th->iter = ruby_iter;
th->tag = prot_tag;
- th->errinfo = errinfo;
- th->last_status = last_status;
- th->last_line = lastline_get();
- th->last_match = backref_get();
- th->safe = safe_level;
+ th->tracing = tracing;
+ th->errinfo = ruby_errinfo;
+ th->last_status = rb_last_status;
+ tval = rb_lastline_get();
+ rb_lastline_set(th->last_line);
+ th->last_line = tval;
+ tval = rb_backref_get();
+ rb_backref_set(th->last_match);
+ th->last_match = tval;
+ th->safe = ruby_safe_level;
+
+ th->node = ruby_current_node;
+}
- th->trace = trace_func;
- th->file = sourcefile;
- th->line = sourceline;
+static int
+rb_thread_switch(n)
+ int n;
+{
+ rb_trap_immediate = (curr_thread->flags&0x100)?1:0;
+ switch (n) {
+ case 0:
+ return 0;
+ case RESTORE_FATAL:
+ JUMP_TAG(TAG_FATAL);
+ break;
+ case RESTORE_INTERRUPT:
+ rb_interrupt();
+ break;
+ case RESTORE_TRAP:
+ rb_trap_eval(th_cmd, th_sig, th_safe);
+ break;
+ case RESTORE_RAISE:
+ ruby_frame->last_func = 0;
+ ruby_current_node = th_raise_node;
+ rb_raise_jump(th_raise_exception);
+ break;
+ case RESTORE_SIGNAL:
+ rb_raise(rb_eSignal, "SIG%s", th_signm);
+ break;
+ case RESTORE_EXIT:
+ ruby_errinfo = th_raise_exception;
+ ruby_current_node = th_raise_node;
+ error_print();
+ terminate_process(EXIT_FAILURE, 0, 0);
+ break;
+ case RESTORE_NORMAL:
+ default:
+ break;
+ }
+ return 1;
}
-static void thread_restore_context _((thread_t,int));
+#define THREAD_SAVE_CONTEXT(th) \
+ (rb_thread_save_context(th),\
+ rb_thread_switch((FLUSH_REGISTER_WINDOWS, setjmp((th)->context))))
+NORETURN(static void rb_thread_restore_context _((rb_thread_t,int)));
+
+# if _MSC_VER >= 1300
+__declspec(noinline)
+# endif
static void
stack_extend(th, exit)
- thread_t th;
+ rb_thread_t th;
int exit;
{
VALUE space[1024];
memset(space, 0, 1); /* prevent array from optimization */
- thread_restore_context(th, exit);
+ rb_thread_restore_context(th, exit);
}
-static int th_raise_argc;
-static VALUE th_raise_argv[2];
-static char *th_raise_file;
-static int th_raise_line;
-static VALUE th_cmd;
-static int th_sig;
-
static void
-thread_restore_context(th, exit)
- thread_t th;
+rb_thread_restore_context(th, exit)
+ rb_thread_t th;
int exit;
{
VALUE v;
- static thread_t tmp;
+ static rb_thread_t tmp;
static int ex;
+ static VALUE tval;
- if (!th->stk_ptr) Bug("unsaved context");
+ if (!th->stk_ptr) rb_bug("unsaved context");
- if (&v < gc_stack_start) {
+#if STACK_GROW_DIRECTION < 0
+ if (&v > th->stk_pos) stack_extend(th, exit);
+#elif STACK_GROW_DIRECTION > 0
+ if (&v < th->stk_pos + th->stk_len) stack_extend(th, exit);
+#else
+ if (&v < rb_gc_stack_start) {
/* Stack grows downward */
if (&v > th->stk_pos) stack_extend(th, exit);
}
@@ -5585,113 +9887,227 @@ thread_restore_context(th, exit)
/* Stack grows upward */
if (&v < th->stk_pos + th->stk_len) stack_extend(th, exit);
}
+#endif
- the_frame = th->frame;
- the_scope = th->scope;
- the_class = th->klass;
- the_dyna_vars = th->dyna_vars;
- the_block = th->block;
- scope_vmode = th->misc&SCOPE_MASK;
- trap_immediate = th->misc>>8;
- the_iter = th->iter;
+ rb_trap_immediate = 0; /* inhibit interrupts from here */
+ ruby_frame = th->frame;
+ ruby_scope = th->scope;
+ ruby_class = th->klass;
+ ruby_wrapper = th->wrapper;
+ ruby_cref = th->cref;
+ ruby_dyna_vars = th->dyna_vars;
+ ruby_block = th->block;
+ scope_vmode = th->flags&SCOPE_MASK;
+ ruby_iter = th->iter;
prot_tag = th->tag;
- errinfo = th->errinfo;
- last_status = th->last_status;
- safe_level = th->safe;
+ tracing = th->tracing;
+ ruby_errinfo = th->errinfo;
+ rb_last_status = th->last_status;
+ ruby_safe_level = th->safe;
- trace_func = th->trace;
- sourcefile = th->file;
- sourceline = th->line;
+ ruby_current_node = th->node;
+#ifdef SAVE_WIN32_EXCEPTION_LIST
+ win32_set_exception_list(th->win32_exception_list);
+#endif
tmp = th;
ex = exit;
FLUSH_REGISTER_WINDOWS;
MEMCPY(tmp->stk_pos, tmp->stk_ptr, VALUE, tmp->stk_len);
+#ifdef __ia64__
+ MEMCPY((VALUE*)__libc_ia64_register_backing_store_base, tmp->bstr_ptr, VALUE, tmp->bstr_len);
+#endif
- lastline_set(tmp->last_line);
- backref_set(tmp->last_match);
+ tval = rb_lastline_get();
+ rb_lastline_set(tmp->last_line);
+ tmp->last_line = tval;
+ tval = rb_backref_get();
+ rb_backref_set(tmp->last_match);
+ tmp->last_match = tval;
- switch (ex) {
- case 1:
- JUMP_TAG(TAG_FATAL);
- break;
+ longjmp(tmp->context, ex);
+}
- case 2:
- rb_interrupt();
- break;
+static void
+rb_thread_ready(th)
+ rb_thread_t th;
+{
+ th->wait_for = 0;
+ if (th->status != THREAD_TO_KILL) {
+ th->status = THREAD_RUNNABLE;
+ }
+}
- case 3:
- rb_trap_eval(th_cmd, th_sig);
- errno = EINTR;
- break;
+static void
+rb_thread_die(th)
+ rb_thread_t th;
+{
+ th->thgroup = 0;
+ th->status = THREAD_KILLED;
+ if (th->stk_ptr) free(th->stk_ptr);
+ th->stk_ptr = 0;
+}
- case 4:
- the_frame->last_func = 0;
- sourcefile = th_raise_file;
- sourceline = th_raise_line;
- f_raise(th_raise_argc, th_raise_argv);
- break;
+static void
+rb_thread_remove(th)
+ rb_thread_t th;
+{
+ if (th->status == THREAD_KILLED) return;
- default:
- longjmp(tmp->context, 1);
+ rb_thread_ready(th);
+ rb_thread_die(th);
+ th->prev->next = th->next;
+ th->next->prev = th->prev;
+}
+
+static int
+rb_thread_dead(th)
+ rb_thread_t th;
+{
+ return th->status == THREAD_KILLED;
+}
+
+void
+rb_thread_fd_close(fd)
+ int fd;
+{
+ rb_thread_t th;
+
+ FOREACH_THREAD(th) {
+ if (((th->wait_for & WAIT_FD) && fd == th->fd) ||
+ ((th->wait_for & WAIT_SELECT) && (fd < th->fd) &&
+ (FD_ISSET(fd, &th->readfds) ||
+ FD_ISSET(fd, &th->writefds) ||
+ FD_ISSET(fd, &th->exceptfds)))) {
+ VALUE exc = rb_exc_new2(rb_eIOError, "stream closed");
+ rb_thread_raise(1, &exc, th);
+ }
}
+ END_FOREACH(th);
}
+NORETURN(static void rb_thread_main_jump _((VALUE, int)));
static void
-thread_ready(th)
- thread_t th;
+rb_thread_main_jump(err, tag)
+ VALUE err;
+ int tag;
{
- /* The thread is no longer waiting on anything */
- if (th->wait_for & WAIT_FD) {
- num_waiting_on_fd--;
- }
- if (th->wait_for & WAIT_TIME) {
- num_waiting_on_timer--;
- }
- if (th->wait_for & WAIT_JOIN) {
- num_waiting_on_join--;
+ curr_thread = main_thread;
+ th_raise_exception = err;
+ th_raise_node = ruby_current_node;
+ rb_thread_restore_context(main_thread, tag);
+}
+
+NORETURN(static void rb_thread_deadlock _((void)));
+static void
+rb_thread_deadlock()
+{
+ char msg[21+SIZEOF_LONG*2];
+ VALUE e;
+
+ sprintf(msg, "Thread(0x%lx): deadlock", curr_thread->thread);
+ e = rb_exc_new2(rb_eFatal, msg);
+ if (curr_thread == main_thread) {
+ rb_exc_raise(e);
}
- th->wait_for = 0;
- th->status = THREAD_RUNNABLE;
+ rb_thread_main_jump(e, RESTORE_RAISE);
}
static void
-thread_remove()
+copy_fds(dst, src, max)
+ fd_set *dst, *src;
+ int max;
{
- thread_ready(curr_thread);
- curr_thread->status = THREAD_KILLED;
- curr_thread->prev->next = curr_thread->next;
- curr_thread->next->prev = curr_thread->prev;
+ int n = 0;
+ int i;
+
+ for (i=0; i<=max; i++) {
+ if (FD_ISSET(i, src)) {
+ n = i;
+ FD_SET(i, dst);
+ }
+ }
}
static int
-thread_dead(th)
- thread_t th;
+match_fds(dst, src, max)
+ fd_set *dst, *src;
+ int max;
{
- return th->status == THREAD_KILLED;
+ int i;
+
+ for (i=0; i<=max; i++) {
+ if (FD_ISSET(i, src) && FD_ISSET(i, dst)) {
+ return Qtrue;
+ }
+ }
+ return Qfalse;
}
-static void
-thread_deadlock()
+static int
+intersect_fds(src, dst, max)
+ fd_set *src, *dst;
+ int max;
{
- curr_thread = main_thread;
- th_raise_argc = 1;
- th_raise_argv[0] = exc_new2(eFatal, "Thread: deadlock");
- th_raise_file = sourcefile;
- th_raise_line = sourceline;
- f_abort();
+ int i, n = 0;
+
+ for (i=0; i<=max; i++) {
+ if (FD_ISSET(i, dst)) {
+ if (FD_ISSET(i, src)) {
+ /* Wake up only one thread per fd. */
+ FD_CLR(i, src);
+ n++;
+ }
+ else {
+ FD_CLR(i, dst);
+ }
+ }
+ }
+ return n;
}
-void
-thread_schedule()
+static int
+find_bad_fds(dst, src, max)
+ fd_set *dst, *src;
+ int max;
{
- thread_t next; /* OK */
- thread_t th;
- thread_t curr;
+ int i, test = Qfalse;
- select_err:
- thread_pending = 0;
- if (curr_thread == curr_thread->next) return;
+ for (i=0; i<=max; i++) {
+ if (FD_ISSET(i, src) && !FD_ISSET(i, dst)) {
+ FD_CLR(i, src);
+ test = Qtrue;
+ }
+ }
+ return test;
+}
+
+void
+rb_thread_schedule()
+{
+ rb_thread_t next; /* OK */
+ rb_thread_t th;
+ rb_thread_t curr;
+ int found = 0;
+
+ fd_set readfds;
+ fd_set writefds;
+ fd_set exceptfds;
+ struct timeval delay_tv, *delay_ptr;
+ double delay, now; /* OK */
+ int n, max;
+ int need_select = 0;
+ int select_timeout = 0;
+
+#ifdef HAVE_NATIVETHREAD
+ if (!is_ruby_native_thread()) {
+ rb_bug("cross-thread violation on rb_thread_schedule()");
+ }
+#endif
+ rb_thread_pending = 0;
+ if (curr_thread == curr_thread->next
+ && curr_thread->status == THREAD_RUNNABLE)
+ return;
next = 0;
curr = curr_thread; /* starting thread */
@@ -5700,200 +10116,294 @@ thread_schedule()
curr = curr->prev;
}
+ again:
+ max = -1;
+ FD_ZERO(&readfds);
+ FD_ZERO(&writefds);
+ FD_ZERO(&exceptfds);
+ delay = DELAY_INFTY;
+ now = -1.0;
+
FOREACH_THREAD_FROM(curr, th) {
- if (th->status != THREAD_STOPPED && th->status != THREAD_KILLED) {
- next = th;
- break;
- }
- }
- END_FOREACH_FROM(curr, th);
+ if (!found && th->status <= THREAD_RUNNABLE) {
+ found = 1;
+ }
+ if (th->status != THREAD_STOPPED) continue;
+ if (th->wait_for & WAIT_JOIN) {
+ if (rb_thread_dead(th->join)) {
+ th->status = THREAD_RUNNABLE;
+ found = 1;
+ }
+ }
+ if (th->wait_for & WAIT_FD) {
+ FD_SET(th->fd, &readfds);
+ if (max < th->fd) max = th->fd;
+ need_select = 1;
+ }
+ if (th->wait_for & WAIT_SELECT) {
+ copy_fds(&readfds, &th->readfds, th->fd);
+ copy_fds(&writefds, &th->writefds, th->fd);
+ copy_fds(&exceptfds, &th->exceptfds, th->fd);
+ if (max < th->fd) max = th->fd;
+ need_select = 1;
+ if (th->wait_for & WAIT_TIME) {
+ select_timeout = 1;
+ }
+ th->select_value = 0;
+ }
+ if (th->wait_for & WAIT_TIME) {
+ double th_delay;
- if (num_waiting_on_join) {
- FOREACH_THREAD_FROM(curr, th) {
- if ((th->wait_for&WAIT_JOIN) && thread_dead(th->join)) {
- th->join = 0;
- th->wait_for &= ~WAIT_JOIN;
+ if (now < 0.0) now = timeofday();
+ th_delay = th->delay - now;
+ if (th_delay <= 0.0) {
th->status = THREAD_RUNNABLE;
- num_waiting_on_join--;
- if (!next) next = th;
+ found = 1;
+ }
+ else if (th_delay < delay) {
+ delay = th_delay;
+ need_select = 1;
+ }
+ else if (th->delay == DELAY_INFTY) {
+ need_select = 1;
}
}
- END_FOREACH_FROM(curr, th);
}
+ END_FOREACH_FROM(curr, th);
- if (num_waiting_on_fd > 0 || num_waiting_on_timer > 0) {
- fd_set readfds;
- struct timeval delay_tv, *delay_ptr;
- double delay, now; /* OK */
+ /* Do the select if needed */
+ if (need_select) {
+ /* Convert delay to a timeval */
+ /* If a thread is runnable, just poll */
+ if (found) {
+ delay_tv.tv_sec = 0;
+ delay_tv.tv_usec = 0;
+ delay_ptr = &delay_tv;
+ }
+ else if (delay == DELAY_INFTY) {
+ delay_ptr = 0;
+ }
+ else {
+ delay_tv.tv_sec = delay;
+ delay_tv.tv_usec = (delay - (double)delay_tv.tv_sec)*1e6;
+ delay_ptr = &delay_tv;
+ }
- int n, max;
+ n = select(max+1, &readfds, &writefds, &exceptfds, delay_ptr);
+ if (n < 0) {
+ int e = errno;
- do {
- max = 0;
- FD_ZERO(&readfds);
- if (num_waiting_on_fd > 0) {
- FOREACH_THREAD_FROM(curr, th) {
- if (th->wait_for & WAIT_FD) {
- FD_SET(th->fd, &readfds);
- if (th->fd > max) max = th->fd;
- }
- }
- END_FOREACH_FROM(curr, th);
- }
-
- delay = DELAY_INFTY;
- if (num_waiting_on_timer > 0) {
- now = timeofday();
- FOREACH_THREAD_FROM(curr, th) {
- if (th->wait_for & WAIT_TIME) {
- if (th->delay <= now) {
- th->delay = 0.0;
- th->wait_for &= ~WAIT_TIME;
- th->status = THREAD_RUNNABLE;
- num_waiting_on_timer--;
- next = th;
- } else if (th->delay < delay) {
- delay = th->delay;
- }
+ if (rb_trap_pending) rb_trap_exec();
+ if (e == EINTR) goto again;
+#ifdef ERESTART
+ if (e == ERESTART) goto again;
+#endif
+ FOREACH_THREAD_FROM(curr, th) {
+ if (th->wait_for & WAIT_SELECT) {
+ int v = 0;
+
+ v |= find_bad_fds(&readfds, &th->readfds, th->fd);
+ v |= find_bad_fds(&writefds, &th->writefds, th->fd);
+ v |= find_bad_fds(&exceptfds, &th->exceptfds, th->fd);
+ if (v) {
+ th->select_value = n;
+ n = max;
}
}
- END_FOREACH_FROM(curr, th);
- }
- /* Do the select if needed */
- if (num_waiting_on_fd > 0 || !next) {
- /* Convert delay to a timeval */
- /* If a thread is runnable, just poll */
- if (next) {
- delay_tv.tv_sec = 0;
- delay_tv.tv_usec = 0;
- delay_ptr = &delay_tv;
- }
- else if (delay == DELAY_INFTY) {
- delay_ptr = 0;
+ }
+ END_FOREACH_FROM(curr, th);
+ }
+ if (select_timeout && n == 0) {
+ if (now < 0.0) now = timeofday();
+ FOREACH_THREAD_FROM(curr, th) {
+ if (((th->wait_for&(WAIT_SELECT|WAIT_TIME)) == (WAIT_SELECT|WAIT_TIME)) &&
+ th->delay <= now) {
+ th->status = THREAD_RUNNABLE;
+ th->wait_for = 0;
+ th->select_value = 0;
+ found = 1;
+ intersect_fds(&readfds, &th->readfds, max);
+ intersect_fds(&writefds, &th->writefds, max);
+ intersect_fds(&exceptfds, &th->exceptfds, max);
}
- else {
- delay -= now;
- delay_tv.tv_sec = (unsigned int)delay;
- delay_tv.tv_usec = (delay - (double)delay_tv.tv_sec) * 1e6;
- delay_ptr = &delay_tv;
+ }
+ END_FOREACH_FROM(curr, th);
+ }
+ if (n > 0) {
+ now = -1.0;
+ /* Some descriptors are ready.
+ Make the corresponding threads runnable. */
+ FOREACH_THREAD_FROM(curr, th) {
+ if ((th->wait_for&WAIT_FD) && FD_ISSET(th->fd, &readfds)) {
+ /* Wake up only one thread per fd. */
+ FD_CLR(th->fd, &readfds);
+ th->status = THREAD_RUNNABLE;
+ th->fd = 0;
+ th->wait_for = 0;
+ found = 1;
}
-
- n = select(max+1, &readfds, 0, 0, delay_ptr);
- if (n < 0) {
- if (trap_pending) rb_trap_exec();
- goto select_err;
- }
- if (n > 0) {
- /* Some descriptors are ready.
- Make the corresponding threads runnable. */
- FOREACH_THREAD_FROM(curr, th) {
- if ((th->wait_for&WAIT_FD)
- && FD_ISSET(th->fd, &readfds)) {
- /* Wake up only one thread per fd. */
- FD_CLR(th->fd, &readfds);
- th->status = THREAD_RUNNABLE;
- th->fd = 0;
- th->wait_for &= ~WAIT_FD;
- num_waiting_on_fd--;
- if (!next) next = th; /* Found one. */
- }
- }
- END_FOREACH_FROM(curr, th);
+ if ((th->wait_for&WAIT_SELECT) &&
+ (match_fds(&readfds, &th->readfds, max) ||
+ match_fds(&writefds, &th->writefds, max) ||
+ match_fds(&exceptfds, &th->exceptfds, max))) {
+ /* Wake up only one thread per fd. */
+ th->status = THREAD_RUNNABLE;
+ th->wait_for = 0;
+ n = intersect_fds(&readfds, &th->readfds, max) +
+ intersect_fds(&writefds, &th->writefds, max) +
+ intersect_fds(&exceptfds, &th->exceptfds, max);
+ th->select_value = n;
+ found = 1;
}
}
- /* The delays for some of the threads should have expired.
- Go through the loop once more, to check the delays. */
- } while (!next && delay != DELAY_INFTY);
+ END_FOREACH_FROM(curr, th);
+ }
+ /* The delays for some of the threads should have expired.
+ Go through the loop once more, to check the delays. */
+ if (!found && delay != DELAY_INFTY)
+ goto again;
+ }
+
+ FOREACH_THREAD_FROM(curr, th) {
+ if (th->status == THREAD_TO_KILL) {
+ next = th;
+ break;
+ }
+ if (th->status == THREAD_RUNNABLE && th->stk_ptr) {
+ if (!next || next->priority < th->priority)
+ next = th;
+ }
}
+ END_FOREACH_FROM(curr, th);
if (!next) {
- curr_thread->file = sourcefile;
- curr_thread->line = sourceline;
+ /* raise fatal error to main thread */
+ curr_thread->node = ruby_current_node;
+ if (curr->next == curr) {
+ TRAP_BEG;
+ pause();
+ TRAP_END;
+ }
FOREACH_THREAD_FROM(curr, th) {
- fprintf(stderr, "%s:%d:deadlock 0x%x: %d:%d %s\n",
- th->file, th->line, th->thread, th->status,
- th->wait_for, th==main_thread?"(main)":"");
+ warn_printf("deadlock 0x%lx: %s:",
+ th->thread, thread_status_name(th->status));
+ if (th->wait_for & WAIT_FD) warn_printf("F(%d)", th->fd);
+ if (th->wait_for & WAIT_SELECT) warn_printf("S");
+ if (th->wait_for & WAIT_TIME) warn_printf("T(%f)", th->delay);
+ if (th->wait_for & WAIT_JOIN)
+ warn_printf("J(0x%lx)", th->join ? th->join->thread : 0);
+ if (th->wait_for & WAIT_PID) warn_printf("P");
+ if (!th->wait_for) warn_printf("-");
+ warn_printf(" %s - %s:%d\n",
+ th==main_thread ? "(main)" : "",
+ th->node->nd_file, nd_line(th->node));
}
END_FOREACH_FROM(curr, th);
- /* raise fatal error to main thread */
- thread_deadlock();
+ next = main_thread;
+ rb_thread_ready(next);
+ next->status = THREAD_TO_KILL;
+ if (!rb_thread_dead(curr_thread)) {
+ rb_thread_save_context(curr_thread);
+ }
+ rb_thread_deadlock();
}
+ next->wait_for = 0;
if (next->status == THREAD_RUNNABLE && next == curr_thread) {
return;
}
/* context switch */
if (curr == curr_thread) {
- thread_save_context(curr);
- if (setjmp(curr->context)) {
+ if (THREAD_SAVE_CONTEXT(curr)) {
return;
}
}
curr_thread = next;
if (next->status == THREAD_TO_KILL) {
- /* execute ensure-clause if any */
- thread_restore_context(next, 1);
+ if (!(next->flags & THREAD_TERMINATING)) {
+ next->flags |= THREAD_TERMINATING;
+ /* terminate; execute ensure-clause if any */
+ rb_thread_restore_context(next, RESTORE_FATAL);
+ }
}
- thread_restore_context(next, 0);
+ rb_thread_restore_context(next, RESTORE_NORMAL);
}
void
-thread_wait_fd(fd)
+rb_thread_wait_fd(fd)
int fd;
{
+ if (rb_thread_critical) return;
+ if (ruby_in_compile) return;
if (curr_thread == curr_thread->next) return;
+ if (curr_thread->status == THREAD_TO_KILL) return;
curr_thread->status = THREAD_STOPPED;
curr_thread->fd = fd;
- num_waiting_on_fd++;
- curr_thread->wait_for |= WAIT_FD;
- thread_schedule();
+ curr_thread->wait_for = WAIT_FD;
+ rb_thread_schedule();
}
-void
-thread_fd_writable(fd)
+int
+rb_thread_fd_writable(fd)
int fd;
{
- struct timeval zero;
- fd_set fds;
+ if (rb_thread_critical) return Qtrue;
+ if (curr_thread == curr_thread->next) return Qtrue;
+ if (curr_thread->status == THREAD_TO_KILL) return Qtrue;
- if (curr_thread == curr_thread->next) return;
-
- zero.tv_sec = zero.tv_usec = 0;
- for (;;) {
- FD_ZERO(&fds);
- FD_SET(fd, &fds);
- if (select(fd+1, 0, &fds, 0, &zero) == 1) break;
- thread_schedule();
- }
+ curr_thread->status = THREAD_STOPPED;
+ FD_ZERO(&curr_thread->readfds);
+ FD_ZERO(&curr_thread->writefds);
+ FD_SET(fd, &curr_thread->writefds);
+ FD_ZERO(&curr_thread->exceptfds);
+ curr_thread->fd = fd+1;
+ curr_thread->wait_for = WAIT_SELECT;
+ rb_thread_schedule();
+ return Qfalse;
}
void
-thread_wait_for(time)
+rb_thread_wait_for(time)
struct timeval time;
{
double date;
- if (curr_thread == curr_thread->next) {
+ if (rb_thread_critical ||
+ curr_thread == curr_thread->next ||
+ curr_thread->status == THREAD_TO_KILL) {
int n;
+ int thr_critical = rb_thread_critical;
#ifndef linux
double d, limit;
limit = timeofday()+(double)time.tv_sec+(double)time.tv_usec*1e-6;
#endif
for (;;) {
+ rb_thread_critical = Qtrue;
TRAP_BEG;
n = select(0, 0, 0, 0, &time);
+ rb_thread_critical = thr_critical;
TRAP_END;
if (n == 0) return;
-
+ if (n < 0) {
+ switch (errno) {
+ case EINTR:
+#ifdef ERESTART
+ case ERESTART:
+#endif
+ return;
+ default:
+ rb_sys_fail("sleep");
+ }
+ }
#ifndef linux
d = limit - timeofday();
time.tv_sec = (int)d;
time.tv_usec = (int)((d - (int)d)*1e6);
if (time.tv_usec < 0) {
- time.tv_usec += 1e6;
+ time.tv_usec += (long)1e6;
time.tv_sec -= 1;
}
if (time.tv_sec < 0) return;
@@ -5904,36 +10414,33 @@ thread_wait_for(time)
date = timeofday() + (double)time.tv_sec + (double)time.tv_usec*1e-6;
curr_thread->status = THREAD_STOPPED;
curr_thread->delay = date;
- num_waiting_on_timer++;
- curr_thread->wait_for |= WAIT_TIME;
- thread_schedule();
+ curr_thread->wait_for = WAIT_TIME;
+ rb_thread_schedule();
}
-void thread_sleep_forever _((void));
+void rb_thread_sleep_forever _((void));
int
-thread_alone()
+rb_thread_alone()
{
return curr_thread == curr_thread->next;
}
int
-thread_select(max, read, write, except, timeout)
+rb_thread_select(max, read, write, except, timeout)
int max;
fd_set *read, *write, *except;
struct timeval *timeout;
{
double limit;
- struct timeval zero;
- fd_set r, *rp, w, *wp, x, *xp;
int n;
if (!read && !write && !except) {
if (!timeout) {
- thread_sleep_forever();
+ rb_thread_sleep_forever();
return 0;
}
- thread_wait_for(*timeout);
+ rb_thread_wait_for(*timeout);
return 0;
}
@@ -5942,7 +10449,9 @@ thread_select(max, read, write, except, timeout)
(double)timeout->tv_sec+(double)timeout->tv_usec*1e-6;
}
- if (curr_thread == curr_thread->next) { /* no other thread */
+ if (rb_thread_critical ||
+ curr_thread == curr_thread->next ||
+ curr_thread->status == THREAD_TO_KILL) {
#ifndef linux
struct timeval tv, *tvp = timeout;
@@ -5950,167 +10459,448 @@ thread_select(max, read, write, except, timeout)
tv = *timeout;
tvp = &tv;
}
+#else
+ struct timeval *const tvp = timeout;
+#endif
for (;;) {
TRAP_BEG;
n = select(max, read, write, except, tvp);
TRAP_END;
- if (n < 0 && errno == EINTR) {
- if (timeout) {
- double d = timeofday() - limit;
+ if (n < 0) {
+ switch (errno) {
+ case EINTR:
+#ifdef ERESTART
+ case ERESTART:
+#endif
+#ifndef linux
+ if (timeout) {
+ double d = limit - timeofday();
- tv.tv_sec = (unsigned int)d;
- tv.tv_usec = (d - (double)tv.tv_sec) * 1e6;
+ tv.tv_sec = (unsigned int)d;
+ tv.tv_usec = (long)((d-(double)tv.tv_sec)*1e6);
+ if (tv.tv_sec < 0) tv.tv_sec = 0;
+ if (tv.tv_usec < 0) tv.tv_usec = 0;
+ }
+#endif
+ continue;
+ default:
+ break;
}
- continue;
}
return n;
}
-#else
- for (;;) {
- TRAP_BEG;
- n = select(max, read, write, except, timeout);
- TRAP_END;
- if (n < 0 && errno == EINTR) {
- continue;
- }
- return n;
- }
-#endif
-
}
- for (;;) {
- zero.tv_sec = zero.tv_usec = 0;
- if (read) {rp = &r; r = *read;} else {rp = 0;}
- if (write) {wp = &w; w = *write;} else {wp = 0;}
- if (except) {xp = &x; x = *except;} else {xp = 0;}
- n = select(max, rp, wp, xp, &zero);
- if (n > 0) {
- /* write back fds */
- if (read) {*read = r;}
- if (write) {*write = w;}
- if (except) {*except = x;}
- return n;
- }
- if (n < 0 && errno != EINTR) {
- return n;
- }
- if (timeout) {
- if (timeout->tv_sec == 0 && timeout->tv_usec == 0) return 0;
- if (limit <= timeofday()) return 0;
- }
-
- thread_schedule();
- CHECK_INTS;
+ curr_thread->status = THREAD_STOPPED;
+ if (read) curr_thread->readfds = *read;
+ else FD_ZERO(&curr_thread->readfds);
+ if (write) curr_thread->writefds = *write;
+ else FD_ZERO(&curr_thread->writefds);
+ if (except) curr_thread->exceptfds = *except;
+ else FD_ZERO(&curr_thread->exceptfds);
+ curr_thread->fd = max;
+ curr_thread->wait_for = WAIT_SELECT;
+ if (timeout) {
+ curr_thread->delay = timeofday() +
+ (double)timeout->tv_sec + (double)timeout->tv_usec*1e-6;
+ curr_thread->wait_for |= WAIT_TIME;
}
+ rb_thread_schedule();
+ if (read) *read = curr_thread->readfds;
+ if (write) *write = curr_thread->writefds;
+ if (except) *except = curr_thread->exceptfds;
+ return curr_thread->select_value;
}
+static int rb_thread_join _((rb_thread_t, double));
+
+static int
+rb_thread_join(th, limit)
+ rb_thread_t th;
+ double limit;
+{
+ enum thread_status last_status = THREAD_RUNNABLE;
+
+ if (rb_thread_critical) rb_thread_deadlock();
+ if (!rb_thread_dead(th)) {
+ if (th == curr_thread)
+ rb_raise(rb_eThreadError, "thread 0x%lx tried to join itself",
+ th->thread);
+ if ((th->wait_for & WAIT_JOIN) && th->join == curr_thread)
+ rb_raise(rb_eThreadError, "Thread#join: deadlock 0x%lx - mutual join(0x%lx)",
+ curr_thread->thread, th->thread);
+ if (curr_thread->status == THREAD_TO_KILL)
+ last_status = THREAD_TO_KILL;
+ if (limit == 0) return Qfalse;
+ curr_thread->status = THREAD_STOPPED;
+ curr_thread->join = th;
+ curr_thread->wait_for = WAIT_JOIN;
+ curr_thread->delay = timeofday() + limit;
+ if (limit < DELAY_INFTY) curr_thread->wait_for |= WAIT_TIME;
+ rb_thread_schedule();
+ curr_thread->status = last_status;
+ if (!rb_thread_dead(th)) return Qfalse;
+ }
+
+ if (!NIL_P(th->errinfo) && (th->flags & THREAD_RAISED)) {
+ VALUE oldbt = get_backtrace(th->errinfo);
+ VALUE errat = make_backtrace();
+ VALUE errinfo = rb_obj_dup(th->errinfo);
+
+ if (TYPE(oldbt) == T_ARRAY && RARRAY(oldbt)->len > 0) {
+ rb_ary_unshift(errat, rb_ary_entry(oldbt, 0));
+ }
+ set_backtrace(errinfo, errat);
+ rb_exc_raise(errinfo);
+ }
+
+ return Qtrue;
+}
+
+
+/*
+ * call-seq:
+ * thr.join => thr
+ * thr.join(limit) => thr
+ *
+ * The calling thread will suspend execution and run <i>thr</i>. Does not
+ * return until <i>thr</i> exits or until <i>limit</i> seconds have passed. If
+ * the time limit expires, <code>nil</code> will be returned, otherwise
+ * <i>thr</i> is returned.
+ *
+ * Any threads not joined will be killed when the main program exits. If
+ * <i>thr</i> had previously raised an exception and the
+ * <code>abort_on_exception</code> and <code>$DEBUG</code> flags are not set
+ * (so the exception has not yet been processed) it will be processed at this
+ * time.
+ *
+ * a = Thread.new { print "a"; sleep(10); print "b"; print "c" }
+ * x = Thread.new { print "x"; Thread.pass; print "y"; print "z" }
+ * x.join # Let x thread finish, a will be killed on exit.
+ *
+ * <em>produces:</em>
+ *
+ * axyz
+ *
+ * The following example illustrates the <i>limit</i> parameter.
+ *
+ * y = Thread.new { 4.times { sleep 0.1; puts 'tick... ' }}
+ * puts "Waiting" until y.join(0.15)
+ *
+ * <em>produces:</em>
+ *
+ * tick...
+ * Waiting
+ * tick...
+ * Waitingtick...
+ *
+ *
+ * tick...
+ */
+
static VALUE
-thread_join(dmy, thread)
- VALUE dmy;
+rb_thread_join_m(argc, argv, thread)
+ int argc;
+ VALUE *argv;
VALUE thread;
{
- thread_t th = thread_check(thread);
-
- if (thread_dead(th)) return thread;
- if ((th->wait_for & WAIT_JOIN) && th->join == curr_thread)
- Raise(eThreadError, "Thread.join: deadlock");
- curr_thread->status = THREAD_STOPPED;
- curr_thread->join = th;
- num_waiting_on_join++;
- curr_thread->wait_for |= WAIT_JOIN;
- thread_schedule();
+ VALUE limit;
+ double delay = DELAY_INFTY;
+ rb_thread_t th = rb_thread_check(thread);
+ rb_scan_args(argc, argv, "01", &limit);
+ if (!NIL_P(limit)) delay = rb_num2dbl(limit);
+ if (!rb_thread_join(th, delay))
+ return Qnil;
return thread;
}
-static VALUE
-thread_current()
+
+/*
+ * call-seq:
+ * Thread.current => thread
+ *
+ * Returns the currently executing thread.
+ *
+ * Thread.current #=> #<Thread:0x401bdf4c run>
+ */
+
+VALUE
+rb_thread_current()
{
return curr_thread->thread;
}
-static VALUE
-thread_main()
+
+/*
+ * call-seq:
+ * Thread.main => thread
+ *
+ * Returns the main thread for the process.
+ *
+ * Thread.main #=> #<Thread:0x401bdf4c run>
+ */
+
+VALUE
+rb_thread_main()
{
return main_thread->thread;
}
-static VALUE
-thread_wakeup(thread)
+
+/*
+ * call-seq:
+ * Thread.list => array
+ *
+ * Returns an array of <code>Thread</code> objects for all threads that are
+ * either runnable or stopped.
+ *
+ * Thread.new { sleep(200) }
+ * Thread.new { 1000000.times {|i| i*i } }
+ * Thread.new { Thread.stop }
+ * Thread.list.each {|t| p t}
+ *
+ * <em>produces:</em>
+ *
+ * #<Thread:0x401b3e84 sleep>
+ * #<Thread:0x401b3f38 run>
+ * #<Thread:0x401b3fb0 sleep>
+ * #<Thread:0x401bdf4c run>
+ */
+
+VALUE
+rb_thread_list()
+{
+ rb_thread_t th;
+ VALUE ary = rb_ary_new();
+
+ FOREACH_THREAD(th) {
+ switch (th->status) {
+ case THREAD_RUNNABLE:
+ case THREAD_STOPPED:
+ case THREAD_TO_KILL:
+ rb_ary_push(ary, th->thread);
+ default:
+ break;
+ }
+ }
+ END_FOREACH(th);
+
+ return ary;
+}
+
+
+/*
+ * call-seq:
+ * thr.wakeup => thr
+ *
+ * Marks <i>thr</i> as eligible for scheduling (it may still remain blocked on
+ * I/O, however). Does not invoke the scheduler (see <code>Thread#run</code>).
+ *
+ * c = Thread.new { Thread.stop; puts "hey!" }
+ * c.wakeup
+ *
+ * <em>produces:</em>
+ *
+ * hey!
+ */
+
+VALUE
+rb_thread_wakeup(thread)
VALUE thread;
{
- thread_t th = thread_check(thread);
+ rb_thread_t th = rb_thread_check(thread);
- if (th->status == THREAD_KILLED) Raise(eThreadError, "killed thread");
- thread_ready(th);
+ if (th->status == THREAD_KILLED)
+ rb_raise(rb_eThreadError, "killed thread");
+ rb_thread_ready(th);
return thread;
}
-static VALUE
-thread_run(thread)
+
+/*
+ * call-seq:
+ * thr.run => thr
+ *
+ * Wakes up <i>thr</i>, making it eligible for scheduling. If not in a critical
+ * section, then invokes the scheduler.
+ *
+ * a = Thread.new { puts "a"; Thread.stop; puts "c" }
+ * Thread.pass
+ * puts "Got here"
+ * a.run
+ * a.join
+ *
+ * <em>produces:</em>
+ *
+ * a
+ * Got here
+ * c
+ */
+
+VALUE
+rb_thread_run(thread)
VALUE thread;
{
- thread_wakeup(thread);
- if (!thread_critical) thread_schedule();
+ rb_thread_wakeup(thread);
+ if (!rb_thread_critical) rb_thread_schedule();
return thread;
}
-static VALUE
-thread_kill(thread)
+
+/*
+ * call-seq:
+ * thr.exit => thr or nil
+ * thr.kill => thr or nil
+ * thr.terminate => thr or nil
+ *
+ * Terminates <i>thr</i> and schedules another thread to be run. If this thread
+ * is already marked to be killed, <code>exit</code> returns the
+ * <code>Thread</code>. If this is the main thread, or the last thread, exits
+ * the process.
+ */
+
+VALUE
+rb_thread_kill(thread)
VALUE thread;
{
- thread_t th = thread_check(thread);
+ rb_thread_t th = rb_thread_check(thread);
+ if (th != curr_thread && th->safe < 4) {
+ rb_secure(4);
+ }
if (th->status == THREAD_TO_KILL || th->status == THREAD_KILLED)
- return thread;
- if (th == th->next || th == main_thread) rb_exit(0);
+ return thread;
+ if (th == th->next || th == main_thread) rb_exit(EXIT_SUCCESS);
- thread_ready(th);
+ rb_thread_ready(th);
th->status = THREAD_TO_KILL;
- thread_schedule();
- return Qnil; /* not reached */
+ if (!rb_thread_critical) rb_thread_schedule();
+ return thread;
}
+
+/*
+ * call-seq:
+ * Thread.kill(thread) => thread
+ *
+ * Causes the given <em>thread</em> to exit (see <code>Thread::exit</code>).
+ *
+ * count = 0
+ * a = Thread.new { loop { count += 1 } }
+ * sleep(0.1) #=> 0
+ * Thread.kill(a) #=> #<Thread:0x401b3d30 dead>
+ * count #=> 93947
+ * a.alive? #=> false
+ */
+
static VALUE
-thread_s_kill(obj, th)
+rb_thread_s_kill(obj, th)
VALUE obj, th;
{
- return thread_kill(th);
+ return rb_thread_kill(th);
}
+
+/*
+ * call-seq:
+ * Thread.exit => thread
+ *
+ * Terminates the currently running thread and schedules another thread to be
+ * run. If this thread is already marked to be killed, <code>exit</code>
+ * returns the <code>Thread</code>. If this is the main thread, or the last
+ * thread, exit the process.
+ */
+
static VALUE
-thread_exit()
-{
- return thread_kill(curr_thread->thread);
-}
+rb_thread_exit()
+{
+ return rb_thread_kill(curr_thread->thread);
+}
+
+
+/*
+ * call-seq:
+ * Thread.pass => nil
+ *
+ * Invokes the thread scheduler to pass execution to another thread.
+ *
+ * a = Thread.new { print "a"; Thread.pass;
+ * print "b"; Thread.pass;
+ * print "c" }
+ * b = Thread.new { print "x"; Thread.pass;
+ * print "y"; Thread.pass;
+ * print "z" }
+ * a.join
+ * b.join
+ *
+ * <em>produces:</em>
+ *
+ * axbycz
+ */
static VALUE
-thread_pass()
+rb_thread_pass()
{
- thread_schedule();
+ rb_thread_schedule();
return Qnil;
}
-static VALUE
-thread_stop()
+
+/*
+ * call-seq:
+ * Thread.stop => nil
+ *
+ * Stops execution of the current thread, putting it into a ``sleep'' state,
+ * and schedules execution of another thread. Resets the ``critical'' condition
+ * to <code>false</code>.
+ *
+ * a = Thread.new { print "a"; Thread.stop; print "c" }
+ * Thread.pass
+ * print "b"
+ * a.run
+ * a.join
+ *
+ * <em>produces:</em>
+ *
+ * abc
+ */
+
+VALUE
+rb_thread_stop()
{
- thread_critical = 0;
- curr_thread->status = THREAD_STOPPED;
+ enum thread_status last_status = THREAD_RUNNABLE;
+
+ rb_thread_critical = 0;
if (curr_thread == curr_thread->next) {
- Raise(eThreadError, "stopping only thread");
+ rb_raise(rb_eThreadError, "stopping only thread\n\tnote: use sleep to stop forever");
}
- thread_schedule();
+ if (curr_thread->status == THREAD_TO_KILL)
+ last_status = THREAD_TO_KILL;
+ curr_thread->status = THREAD_STOPPED;
+ rb_thread_schedule();
+ curr_thread->status = last_status;
return Qnil;
}
-struct timeval time_timeval();
+struct timeval rb_time_timeval();
+
+void
+rb_thread_polling()
+{
+ if (curr_thread != curr_thread->next) {
+ curr_thread->status = THREAD_STOPPED;
+ curr_thread->delay = timeofday() + (double)0.06;
+ curr_thread->wait_for = WAIT_TIME;
+ rb_thread_schedule();
+ }
+}
void
-thread_sleep(sec)
+rb_thread_sleep(sec)
int sec;
{
if (curr_thread == curr_thread->next) {
@@ -6119,111 +10909,294 @@ thread_sleep(sec)
TRAP_END;
return;
}
- thread_wait_for(time_timeval(INT2FIX(sec)));
+ rb_thread_wait_for(rb_time_timeval(INT2FIX(sec)));
}
void
-thread_sleep_forever()
+rb_thread_sleep_forever()
{
- if (curr_thread == curr_thread->next) {
+ int thr_critical = rb_thread_critical;
+ if (curr_thread == curr_thread->next ||
+ curr_thread->status == THREAD_TO_KILL) {
+ rb_thread_critical = Qtrue;
TRAP_BEG;
- sleep((32767L<<16)+32767);
+ pause();
+ rb_thread_critical = thr_critical;
TRAP_END;
return;
}
- num_waiting_on_timer++;
curr_thread->delay = DELAY_INFTY;
- curr_thread->wait_for |= WAIT_TIME;
+ curr_thread->wait_for = WAIT_TIME;
curr_thread->status = THREAD_STOPPED;
- thread_schedule();
+ rb_thread_schedule();
}
-static int thread_abort;
+
+/*
+ * call-seq:
+ * thr.priority => integer
+ *
+ * Returns the priority of <i>thr</i>. Default is zero; higher-priority threads
+ * will run before lower-priority threads.
+ *
+ * Thread.current.priority #=> 0
+ */
static VALUE
-thread_s_abort_exc()
+rb_thread_priority(thread)
+ VALUE thread;
{
- return thread_abort?TRUE:FALSE;
+ return INT2NUM(rb_thread_check(thread)->priority);
+}
+
+
+/*
+ * call-seq:
+ * thr.priority= integer => thr
+ *
+ * Sets the priority of <i>thr</i> to <i>integer</i>. Higher-priority threads
+ * will run before lower-priority threads.
+ *
+ * count1 = count2 = 0
+ * a = Thread.new do
+ * loop { count1 += 1 }
+ * end
+ * a.priority = -1
+ *
+ * b = Thread.new do
+ * loop { count2 += 1 }
+ * end
+ * b.priority = -2
+ * sleep 1 #=> 1
+ * Thread.critical = 1
+ * count1 #=> 622504
+ * count2 #=> 5832
+ */
+
+static VALUE
+rb_thread_priority_set(thread, prio)
+ VALUE thread, prio;
+{
+ rb_thread_t th;
+
+ rb_secure(4);
+ th = rb_thread_check(thread);
+
+ th->priority = NUM2INT(prio);
+ rb_thread_schedule();
+ return prio;
}
+
+/*
+ * call-seq:
+ * thr.safe_level => integer
+ *
+ * Returns the safe level in effect for <i>thr</i>. Setting thread-local safe
+ * levels can help when implementing sandboxes which run insecure code.
+ *
+ * thr = Thread.new { $SAFE = 3; sleep }
+ * Thread.current.safe_level #=> 0
+ * thr.safe_level #=> 3
+ */
+
+static VALUE
+rb_thread_safe_level(thread)
+ VALUE thread;
+{
+ rb_thread_t th;
+
+ th = rb_thread_check(thread);
+ if (th == curr_thread) {
+ return INT2NUM(ruby_safe_level);
+ }
+ return INT2NUM(th->safe);
+}
+
+static int ruby_thread_abort;
+static VALUE thgroup_default;
+
+
+/*
+ * call-seq:
+ * Thread.abort_on_exception => true or false
+ *
+ * Returns the status of the global ``abort on exception'' condition. The
+ * default is <code>false</code>. When set to <code>true</code>, or if the
+ * global <code>$DEBUG</code> flag is <code>true</code> (perhaps because the
+ * command line option <code>-d</code> was specified) all threads will abort
+ * (the process will <code>exit(0)</code>) if an exception is raised in any
+ * thread. See also <code>Thread::abort_on_exception=</code>.
+ */
+
static VALUE
-thread_s_abort_exc_set(self, val)
+rb_thread_s_abort_exc()
+{
+ return ruby_thread_abort?Qtrue:Qfalse;
+}
+
+
+/*
+ * call-seq:
+ * Thread.abort_on_exception= boolean => true or false
+ *
+ * When set to <code>true</code>, all threads will abort if an exception is
+ * raised. Returns the new state.
+ *
+ * Thread.abort_on_exception = true
+ * t1 = Thread.new do
+ * puts "In new thread"
+ * raise "Exception from thread"
+ * end
+ * sleep(1)
+ * puts "not reached"
+ *
+ * <em>produces:</em>
+ *
+ * In new thread
+ * prog.rb:4: Exception from thread (RuntimeError)
+ * from prog.rb:2:in `initialize'
+ * from prog.rb:2:in `new'
+ * from prog.rb:2
+ */
+
+static VALUE
+rb_thread_s_abort_exc_set(self, val)
VALUE self, val;
{
- thread_abort = RTEST(val);
+ rb_secure(4);
+ ruby_thread_abort = RTEST(val);
return val;
}
+
+/*
+ * call-seq:
+ * thr.abort_on_exception => true or false
+ *
+ * Returns the status of the thread-local ``abort on exception'' condition for
+ * <i>thr</i>. The default is <code>false</code>. See also
+ * <code>Thread::abort_on_exception=</code>.
+ */
+
static VALUE
-thread_abort_exc(thread)
+rb_thread_abort_exc(thread)
VALUE thread;
{
- thread_t th = thread_check(thread);
-
- return th->abort?TRUE:FALSE;
+ return rb_thread_check(thread)->abort?Qtrue:Qfalse;
}
+
+/*
+ * call-seq:
+ * thr.abort_on_exception= boolean => true or false
+ *
+ * When set to <code>true</code>, causes all threads (including the main
+ * program) to abort if an exception is raised in <i>thr</i>. The process will
+ * effectively <code>exit(0)</code>.
+ */
+
static VALUE
-thread_abort_exc_set(thread, val)
+rb_thread_abort_exc_set(thread, val)
VALUE thread, val;
{
- thread_t th = thread_check(thread);
-
- th->abort = RTEST(val);
+ rb_secure(4);
+ rb_thread_check(thread)->abort = RTEST(val);
return val;
}
-static thread_t
-thread_alloc()
+
+/*
+ * call-seq:
+ * thr.group => thgrp or nil
+ *
+ * Returns the <code>ThreadGroup</code> which contains <i>thr</i>, or nil if
+ * the thread is not a member of any group.
+ *
+ * Thread.main.group #=> #<ThreadGroup:0x4029d914>
+ */
+
+VALUE
+rb_thread_group(thread)
+ VALUE thread;
{
- thread_t th;
+ VALUE group = rb_thread_check(thread)->thgroup;
+ if (!group) {
+ group = Qnil;
+ }
+ return group;
+}
- th = ALLOC(struct thread);
- th->status = THREAD_RUNNABLE;
+#ifdef __ia64__
+# define IA64_INIT(x) x
+#else
+# define IA64_INIT(x)
+#endif
- th->status = 0;
- th->result = 0;
- th->errinfo = Qnil;
+#define THREAD_ALLOC(th) do {\
+ th = ALLOC(struct thread);\
+\
+ th->next = 0;\
+ th->prev = 0;\
+\
+ th->status = THREAD_RUNNABLE;\
+ th->result = 0;\
+ th->flags = 0;\
+\
+ th->stk_ptr = 0;\
+ th->stk_len = 0;\
+ th->stk_max = 0;\
+ th->wait_for = 0;\
+ IA64_INIT(th->bstr_ptr = 0);\
+ IA64_INIT(th->bstr_len = 0);\
+ FD_ZERO(&th->readfds);\
+ FD_ZERO(&th->writefds);\
+ FD_ZERO(&th->exceptfds);\
+ th->delay = 0.0;\
+ th->join = 0;\
+\
+ th->frame = 0;\
+ th->scope = 0;\
+ th->klass = 0;\
+ th->wrapper = 0;\
+ th->cref = ruby_cref;\
+ th->dyna_vars = ruby_dyna_vars;\
+ th->block = 0;\
+ th->iter = 0;\
+ th->tag = 0;\
+ th->tracing = 0;\
+ th->errinfo = Qnil;\
+ th->last_status = 0;\
+ th->last_line = 0;\
+ th->last_match = Qnil;\
+ th->abort = 0;\
+ th->priority = 0;\
+ th->thgroup = thgroup_default;\
+ th->locals = 0;\
+ th->thread = 0;\
+} while (0)
+
+static rb_thread_t
+rb_thread_alloc(klass)
+ VALUE klass;
+{
+ rb_thread_t th;
+ struct RVarmap *vars;
- th->stk_ptr = 0;
- th->stk_len = 0;
- th->stk_max = 0;
- th->wait_for = 0;
- th->fd = 0;
- th->delay = 0.0;
- th->join = 0;
-
- th->frame = 0;
- th->scope = 0;
- th->klass = 0;
- th->dyna_vars = 0;
- th->block = 0;
- th->iter = 0;
- th->tag = 0;
- th->errinfo = 0;
- th->last_status = 0;
- th->last_line = 0;
- th->last_match = 0;
- th->abort = 0;
-
- th->thread = data_object_alloc(cThread, th, 0, thread_free);
-
- if (curr_thread) {
- th->prev = curr_thread;
- curr_thread->next->prev = th;
- th->next = curr_thread->next;
- curr_thread->next = th;
- }
- else {
- curr_thread = th->prev = th->next = th;
- th->status = THREAD_RUNNABLE;
- }
+ THREAD_ALLOC(th);
+ th->thread = Data_Wrap_Struct(klass, thread_mark, thread_free, th);
+ for (vars = th->dyna_vars; vars; vars = vars->next) {
+ if (FL_TEST(vars, DVAR_DONT_RECYCLE)) break;
+ FL_SET(vars, DVAR_DONT_RECYCLE);
+ }
return th;
}
-#if defined(HAVE_SETITIMER) && !defined(__BOW__)
+static int thread_init = 0;
+
+#if defined(_THREAD_SAFE)
static void
catch_timer(sig)
int sig;
@@ -6231,347 +11204,1276 @@ catch_timer(sig)
#if !defined(POSIX_SIGNAL) && !defined(BSD_SIGNAL)
signal(sig, catch_timer);
#endif
- if (!thread_critical) {
- if (trap_immediate) {
- thread_schedule();
+ /* cause EINTR */
+}
+
+static pthread_t time_thread;
+
+static void*
+thread_timer(dummy)
+ void *dummy;
+{
+ for (;;) {
+#ifdef HAVE_NANOSLEEP
+ struct timespec req, rem;
+
+ req.tv_sec = 0;
+ req.tv_nsec = 10000000;
+ nanosleep(&req, &rem);
+#else
+ struct timeval tv;
+ tv.tv_sec = 0;
+ tv.tv_usec = 10000;
+ select(0, NULL, NULL, NULL, &tv);
+#endif
+ if (!rb_thread_critical) {
+ rb_thread_pending = 1;
+ if (rb_trap_immediate) {
+ pthread_kill(ruby_thid, SIGVTALRM);
+ }
}
- else thread_pending = 1;
}
}
-#else
-int thread_tick = THREAD_TICK;
+
+void
+rb_thread_start_timer()
+{
+}
+
+void
+rb_thread_stop_timer()
+{
+}
+#elif defined(HAVE_SETITIMER)
+static void
+catch_timer(sig)
+ int sig;
+{
+#if !defined(POSIX_SIGNAL) && !defined(BSD_SIGNAL)
+ signal(sig, catch_timer);
#endif
+ if (!rb_thread_critical) {
+ rb_thread_pending = 1;
+ }
+ /* cause EINTR */
+}
+
+void
+rb_thread_start_timer()
+{
+ struct itimerval tval;
-static VALUE thread_raise _((int, VALUE*, VALUE));
+ if (!thread_init) return;
+ tval.it_interval.tv_sec = 0;
+ tval.it_interval.tv_usec = 10000;
+ tval.it_value = tval.it_interval;
+ setitimer(ITIMER_VIRTUAL, &tval, NULL);
+}
-VALUE
-thread_create(fn, arg)
+void
+rb_thread_stop_timer()
+{
+ struct itimerval tval;
+
+ if (!thread_init) return;
+ tval.it_interval.tv_sec = 0;
+ tval.it_interval.tv_usec = 0;
+ tval.it_value = tval.it_interval;
+ setitimer(ITIMER_VIRTUAL, &tval, NULL);
+}
+#else /* !(_THREAD_SAFE || HAVE_SETITIMER) */
+int rb_thread_tick = THREAD_TICK;
+#endif
+
+static VALUE
+rb_thread_start_0(fn, arg, th)
VALUE (*fn)();
void *arg;
+ rb_thread_t th;
{
- thread_t th = thread_alloc();
- int state;
+ volatile rb_thread_t th_save = th;
+ volatile VALUE thread = th->thread;
+ struct BLOCK *volatile saved_block = 0, *block;
enum thread_status status;
+ int state;
-#if defined(HAVE_SETITIMER) && !defined(__BOW__)
- static init = 0;
-
- if (!init) {
- struct itimerval tval;
+ if (OBJ_FROZEN(curr_thread->thgroup)) {
+ rb_raise(rb_eThreadError,
+ "can't start a new thread (frozen ThreadGroup)");
+ }
-#ifdef POSIX_SIGNAL
+ if (!thread_init) {
+ thread_init = 1;
+#if defined(HAVE_SETITIMER) || defined(_THREAD_SAFE)
+#if defined(POSIX_SIGNAL)
posix_signal(SIGVTALRM, catch_timer);
- posix_signal(SIGALRM, catch_timer);
#else
signal(SIGVTALRM, catch_timer);
- signal(SIGALRM, catch_timer);
#endif
- tval.it_interval.tv_sec = 0;
- tval.it_interval.tv_usec = 100000;
- tval.it_value = tval.it_interval;
- setitimer(ITIMER_VIRTUAL, &tval, NULL);
- init = 1;
- }
+#ifdef _THREAD_SAFE
+ pthread_create(&time_thread, 0, thread_timer, 0);
+#else
+ rb_thread_start_timer();
+#endif
#endif
+ }
- thread_save_context(curr_thread);
- if (setjmp(curr_thread->context)) {
- return th->thread;
+ if (THREAD_SAVE_CONTEXT(curr_thread)) {
+ return thread;
+ }
+
+ if (ruby_block) { /* should nail down higher blocks */
+ struct BLOCK dummy;
+
+ dummy.prev = ruby_block;
+ blk_copy_prev(&dummy);
+ saved_block = ruby_block = dummy.prev;
+ }
+ scope_dup(ruby_scope);
+
+ if (!th->next) {
+ /* merge in thread list */
+ th->prev = curr_thread;
+ curr_thread->next->prev = th;
+ th->next = curr_thread->next;
+ curr_thread->next = th;
+ th->priority = curr_thread->priority;
+ th->thgroup = curr_thread->thgroup;
}
PUSH_TAG(PROT_THREAD);
if ((state = EXEC_TAG()) == 0) {
- thread_save_context(th);
- if (setjmp(th->context) == 0) {
+ if (THREAD_SAVE_CONTEXT(th) == 0) {
curr_thread = th;
th->result = (*fn)(arg, th);
}
+ th = th_save;
+ }
+ else if (TAG_DST()) {
+ th = th_save;
+ th->result = prot_tag->retval;
}
POP_TAG();
status = th->status;
- thread_remove();
- if (state && status != THREAD_TO_KILL && !NIL_P(errinfo)) {
- if (state == TAG_FATAL) {
+
+ if (th == main_thread) ruby_stop(state);
+ rb_thread_remove(th);
+
+ if (saved_block) {
+ blk_free(saved_block);
+ }
+
+ if (state && status != THREAD_TO_KILL && !NIL_P(ruby_errinfo)) {
+ th->flags |= THREAD_RAISED;
+ if (state == TAG_FATAL) {
/* fatal error within this thread, need to stop whole script */
- main_thread->errinfo = errinfo;
- thread_cleanup();
+ main_thread->errinfo = ruby_errinfo;
+ rb_thread_cleanup();
}
- else if (obj_is_kind_of(errinfo, eSystemExit)) {
- /* delegate exception to main_thread */
- thread_raise(1, &errinfo, main_thread->thread);
+ else if (rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) {
+ if (th->safe >= 4) {
+ char buf[32];
+
+ sprintf(buf, "Insecure exit at level %d", th->safe);
+ th->errinfo = rb_exc_new2(rb_eSecurityError, buf);
+ }
+ else {
+ /* delegate exception to main_thread */
+ rb_thread_main_jump(ruby_errinfo, RESTORE_RAISE);
+ }
}
- else if (thread_abort || curr_thread->abort || RTEST(debug)) {
- VALUE err = exc_new(eSystemExit, 0, 0);
- error_print();
+ else if (th->safe < 4 && (ruby_thread_abort || th->abort || RTEST(ruby_debug))) {
/* exit on main_thread */
- thread_raise(1, &err, main_thread->thread);
+ rb_thread_main_jump(ruby_errinfo, RESTORE_EXIT);
}
else {
- curr_thread->errinfo = errinfo;
+ th->errinfo = ruby_errinfo;
}
}
- thread_schedule();
+ rb_thread_schedule();
+ ruby_stop(0); /* last thread termination */
return 0; /* not reached */
}
-static VALUE
-thread_yield(arg, th)
- int arg;
- thread_t th;
+VALUE
+rb_thread_create(fn, arg)
+ VALUE (*fn)();
+ void *arg;
{
- scope_dup(the_block->scope);
- return rb_yield(th->thread);
+ Init_stack((VALUE*)&arg);
+ return rb_thread_start_0(fn, arg, rb_thread_alloc(rb_cThread));
}
static VALUE
-thread_start()
+rb_thread_yield(arg, th)
+ VALUE arg;
+ rb_thread_t th;
+{
+ const ID *tbl;
+
+ scope_dup(ruby_block->scope);
+
+ tbl = ruby_scope->local_tbl;
+ if (tbl) {
+ int n = *tbl++;
+ for (tbl += 2, n -= 2; n > 0; --n) { /* skip first 2 ($_ and $~) */
+ ID id = *tbl++;
+ if (id != 0 && !rb_is_local_id(id)) /* push flip states */
+ rb_dvar_push(id, Qfalse);
+ }
+ }
+ rb_dvar_push('_', Qnil);
+ rb_dvar_push('~', Qnil);
+ ruby_block->dyna_vars = ruby_dyna_vars;
+
+ return rb_yield_0(arg, 0, 0, YIELD_LAMBDA_CALL, Qtrue);
+}
+
+/*
+ * call-seq:
+ * Thread.new([arg]*) {|args| block } => thread
+ *
+ * Creates and runs a new thread to execute the instructions given in
+ * <i>block</i>. Any arguments passed to <code>Thread::new</code> are passed
+ * into the block.
+ *
+ * x = Thread.new { sleep 0.1; print "x"; print "y"; print "z" }
+ * a = Thread.new { print "a"; print "b"; sleep 0.2; print "c" }
+ * x.join # Let the threads finish before
+ * a.join # main thread exits...
+ *
+ * <em>produces:</em>
+ *
+ * abxyzc
+ */
+
+static VALUE
+rb_thread_s_new(argc, argv, klass)
+ int argc;
+ VALUE *argv;
+ VALUE klass;
{
- if (!iterator_p()) {
- Raise(eThreadError, "must be called as iterator");
+ rb_thread_t th = rb_thread_alloc(klass);
+ volatile VALUE *pos;
+
+ pos = th->stk_pos;
+ rb_obj_call_init(th->thread, argc, argv);
+ if (th->stk_pos == 0) {
+ rb_raise(rb_eThreadError, "uninitialized thread - check `%s#initialize'",
+ rb_class2name(klass));
}
- return thread_create(thread_yield, 0);
+
+ return th->thread;
}
+
+/*
+ * call-seq:
+ * Thread.new([arg]*) {|args| block } => thread
+ *
+ * Creates and runs a new thread to execute the instructions given in
+ * <i>block</i>. Any arguments passed to <code>Thread::new</code> are passed
+ * into the block.
+ *
+ * x = Thread.new { sleep 0.1; print "x"; print "y"; print "z" }
+ * a = Thread.new { print "a"; print "b"; sleep 0.2; print "c" }
+ * x.join # Let the threads finish before
+ * a.join # main thread exits...
+ *
+ * <em>produces:</em>
+ *
+ * abxyzc
+ */
+
static VALUE
-thread_value(thread)
- VALUE thread;
+rb_thread_initialize(thread, args)
+ VALUE thread, args;
{
- thread_t th = thread_check(thread);
+ if (!rb_block_given_p()) {
+ rb_raise(rb_eThreadError, "must be called with a block");
+ }
+ return rb_thread_start_0(rb_thread_yield, args, rb_thread_check(thread));
+}
- thread_join(0, thread);
- if (!NIL_P(th->errinfo)) {
- VALUE oldbt = get_backtrace(th->errinfo);
- VALUE errat = make_backtrace();
- ary_unshift(errat, ary_entry(oldbt, 0));
- set_backtrace(th->errinfo, errat);
- rb_raise(th->errinfo);
+/*
+ * call-seq:
+ * Thread.start([args]*) {|args| block } => thread
+ * Thread.fork([args]*) {|args| block } => thread
+ *
+ * Basically the same as <code>Thread::new</code>. However, if class
+ * <code>Thread</code> is subclassed, then calling <code>start</code> in that
+ * subclass will not invoke the subclass's <code>initialize</code> method.
+ */
+
+static VALUE
+rb_thread_start(klass, args)
+ VALUE klass, args;
+{
+ if (!rb_block_given_p()) {
+ rb_raise(rb_eThreadError, "must be called with a block");
}
+ return rb_thread_start_0(rb_thread_yield, args, rb_thread_alloc(klass));
+}
+
+
+/*
+ * call-seq:
+ * thr.value => obj
+ *
+ * Waits for <i>thr</i> to complete (via <code>Thread#join</code>) and returns
+ * its value.
+ *
+ * a = Thread.new { 2 + 2 }
+ * a.value #=> 4
+ */
+
+static VALUE
+rb_thread_value(thread)
+ VALUE thread;
+{
+ rb_thread_t th = rb_thread_check(thread);
+
+ while (!rb_thread_join(th, DELAY_INFTY));
return th->result;
}
+
+/*
+ * call-seq:
+ * thr.status => string, false or nil
+ *
+ * Returns the status of <i>thr</i>: ``<code>sleep</code>'' if <i>thr</i> is
+ * sleeping or waiting on I/O, ``<code>run</code>'' if <i>thr</i> is executing,
+ * ``<code>aborting</code>'' if <i>thr</i> is aborting, <code>false</code> if
+ * <i>thr</i> terminated normally, and <code>nil</code> if <i>thr</i>
+ * terminated with an exception.
+ *
+ * a = Thread.new { raise("die now") }
+ * b = Thread.new { Thread.stop }
+ * c = Thread.new { Thread.exit }
+ * d = Thread.new { sleep }
+ * Thread.critical = true
+ * d.kill #=> #<Thread:0x401b3678 aborting>
+ * a.status #=> nil
+ * b.status #=> "sleep"
+ * c.status #=> false
+ * d.status #=> "aborting"
+ * Thread.current.status #=> "run"
+ */
+
static VALUE
-thread_status(thread)
+rb_thread_status(thread)
VALUE thread;
{
- thread_t th = thread_check(thread);
+ rb_thread_t th = rb_thread_check(thread);
- if (thread_dead(th)) {
- if (NIL_P(th->errinfo)) return FALSE;
- return Qnil;
+ if (rb_thread_dead(th)) {
+ if (!NIL_P(th->errinfo) && (th->flags & THREAD_RAISED))
+ return Qnil;
+ return Qfalse;
}
- return TRUE;
+ return rb_str_new2(thread_status_name(th->status));
+}
+
+
+/*
+ * call-seq:
+ * thr.alive? => true or false
+ *
+ * Returns <code>true</code> if <i>thr</i> is running or sleeping.
+ *
+ * thr = Thread.new { }
+ * thr.join #=> #<Thread:0x401b3fb0 dead>
+ * Thread.current.alive? #=> true
+ * thr.alive? #=> false
+ */
+
+static VALUE
+rb_thread_alive_p(thread)
+ VALUE thread;
+{
+ rb_thread_t th = rb_thread_check(thread);
+
+ if (rb_thread_dead(th)) return Qfalse;
+ return Qtrue;
}
+
+/*
+ * call-seq:
+ * thr.stop? => true or false
+ *
+ * Returns <code>true</code> if <i>thr</i> is dead or sleeping.
+ *
+ * a = Thread.new { Thread.stop }
+ * b = Thread.current
+ * a.stop? #=> true
+ * b.stop? #=> false
+ */
+
static VALUE
-thread_stop_p(thread)
+rb_thread_stop_p(thread)
VALUE thread;
{
- thread_t th = thread_check(thread);
+ rb_thread_t th = rb_thread_check(thread);
- if (thread_dead(th)) return TRUE;
- if (th->status == THREAD_STOPPED) return TRUE;
- return FALSE;
+ if (rb_thread_dead(th)) return Qtrue;
+ if (th->status == THREAD_STOPPED) return Qtrue;
+ return Qfalse;
}
static void
-thread_wait_other_threads()
+rb_thread_wait_other_threads()
{
+ rb_thread_t th;
+ int found;
+
/* wait other threads to terminate */
while (curr_thread != curr_thread->next) {
- thread_schedule();
+ found = 0;
+ FOREACH_THREAD(th) {
+ if (th != curr_thread && th->status != THREAD_STOPPED) {
+ found = 1;
+ break;
+ }
+ }
+ END_FOREACH(th);
+ if (!found) return;
+ rb_thread_schedule();
}
}
static void
-thread_cleanup()
+rb_thread_cleanup()
{
- thread_t th;
+ rb_thread_t curr, th;
- if (curr_thread != curr_thread->next->prev) {
- curr_thread = curr_thread->prev;
+ curr = curr_thread;
+ while (curr->status == THREAD_KILLED) {
+ curr = curr->prev;
}
- FOREACH_THREAD(th) {
- if (th != curr_thread && th->status != THREAD_KILLED) {
- th->status = THREAD_TO_KILL;
- th->wait_for = 0;
+ FOREACH_THREAD_FROM(curr, th) {
+ if (th->status != THREAD_KILLED) {
+ rb_thread_ready(th);
+ if (th != main_thread) {
+ th->thgroup = 0;
+ th->priority = 0;
+ th->status = THREAD_TO_KILL;
+ RDATA(th->thread)->dfree = NULL;
+ }
}
}
- END_FOREACH(th);
+ END_FOREACH_FROM(curr, th);
}
-int thread_critical;
+int rb_thread_critical;
+
+
+/*
+ * call-seq:
+ * Thread.critical => true or false
+ *
+ * Returns the status of the global ``thread critical'' condition.
+ */
static VALUE
-thread_get_critical()
+rb_thread_critical_get()
{
- return thread_critical?TRUE:FALSE;
+ return rb_thread_critical?Qtrue:Qfalse;
}
+
+/*
+ * call-seq:
+ * Thread.critical= boolean => true or false
+ *
+ * Sets the status of the global ``thread critical'' condition and returns
+ * it. When set to <code>true</code>, prohibits scheduling of any existing
+ * thread. Does not block new threads from being created and run. Certain
+ * thread operations (such as stopping or killing a thread, sleeping in the
+ * current thread, and raising an exception) may cause a thread to be scheduled
+ * even when in a critical section. <code>Thread::critical</code> is not
+ * intended for daily use: it is primarily there to support folks writing
+ * threading libraries.
+ */
+
static VALUE
-thread_set_critical(obj, val)
+rb_thread_critical_set(obj, val)
VALUE obj, val;
{
- thread_critical = RTEST(val);
+ rb_thread_critical = RTEST(val);
return val;
}
void
-thread_interrupt()
+rb_thread_interrupt()
{
- thread_critical = 0;
- thread_ready(main_thread);
+ rb_thread_critical = 0;
+ rb_thread_ready(main_thread);
if (curr_thread == main_thread) {
rb_interrupt();
}
- thread_save_context(curr_thread);
- if (setjmp(curr_thread->context)) {
- return;
+ if (!rb_thread_dead(curr_thread)) {
+ if (THREAD_SAVE_CONTEXT(curr_thread)) {
+ return;
+ }
}
curr_thread = main_thread;
- thread_restore_context(curr_thread, 2);
+ rb_thread_restore_context(curr_thread, RESTORE_INTERRUPT);
}
void
-thread_trap_eval(cmd, sig)
- VALUE cmd;
- int sig;
+rb_thread_signal_raise(sig)
+ char *sig;
{
- thread_critical = 0;
- if (!thread_dead(curr_thread)) {
- thread_ready(curr_thread);
- rb_trap_eval(cmd, sig);
- return;
+ if (sig == 0) return; /* should not happen */
+ rb_thread_critical = 0;
+ if (curr_thread == main_thread) {
+ rb_thread_ready(curr_thread);
+ rb_raise(rb_eSignal, "SIG%s", sig);
}
- thread_ready(main_thread);
- thread_save_context(curr_thread);
- if (setjmp(curr_thread->context)) {
- return;
+ rb_thread_ready(main_thread);
+ if (!rb_thread_dead(curr_thread)) {
+ if (THREAD_SAVE_CONTEXT(curr_thread)) {
+ return;
+ }
+ }
+ th_signm = sig;
+ curr_thread = main_thread;
+ rb_thread_restore_context(curr_thread, RESTORE_SIGNAL);
+}
+
+void
+rb_thread_trap_eval(cmd, sig, safe)
+ VALUE cmd;
+ int sig, safe;
+{
+ rb_thread_critical = 0;
+ if (!rb_thread_dead(curr_thread)) {
+ if (THREAD_SAVE_CONTEXT(curr_thread)) {
+ return;
+ }
}
th_cmd = cmd;
th_sig = sig;
+ th_safe = safe;
curr_thread = main_thread;
- thread_restore_context(curr_thread, 3);
+ rb_thread_restore_context(curr_thread, RESTORE_TRAP);
}
static VALUE
-thread_raise(argc, argv, thread)
+rb_thread_raise(argc, argv, th)
int argc;
VALUE *argv;
- VALUE thread;
+ rb_thread_t th;
{
- thread_t th = thread_check(thread);
+ volatile rb_thread_t th_save = th;
+ VALUE exc;
- if (thread_dead(th)) return thread;
+ if (!th->next) {
+ rb_raise(rb_eArgError, "unstarted thread");
+ }
+ if (rb_thread_dead(th)) return Qnil;
+ exc = rb_make_exception(argc, argv);
if (curr_thread == th) {
- f_raise(argc, argv);
+ rb_raise_jump(exc);
}
- if (curr_thread->status != THREAD_KILLED)
- thread_save_context(curr_thread);
- if (setjmp(curr_thread->context)) {
- return thread;
+ if (!rb_thread_dead(curr_thread)) {
+ if (THREAD_SAVE_CONTEXT(curr_thread)) {
+ return th_save->thread;
+ }
}
- rb_scan_args(argc, argv, "11", &th_raise_argv[0], &th_raise_argv[1]);
- thread_ready(th);
+ rb_thread_ready(th);
curr_thread = th;
- th_raise_argc = argc;
- th_raise_file = sourcefile;
- th_raise_line = sourceline;
- thread_restore_context(curr_thread, 4);
+ th_raise_exception = exc;
+ th_raise_node = ruby_current_node;
+ rb_thread_restore_context(curr_thread, RESTORE_RAISE);
return Qnil; /* not reached */
}
-static thread_t loading_thread;
-static int loading_nest;
+
+/*
+ * call-seq:
+ * thr.raise(exception)
+ *
+ * Raises an exception (see <code>Kernel::raise</code>) from <i>thr</i>. The
+ * caller does not have to be <i>thr</i>.
+ *
+ * Thread.abort_on_exception = true
+ * a = Thread.new { sleep(200) }
+ * a.raise("Gotcha")
+ *
+ * <em>produces:</em>
+ *
+ * prog.rb:3: Gotcha (RuntimeError)
+ * from prog.rb:2:in `initialize'
+ * from prog.rb:2:in `new'
+ * from prog.rb:2
+ */
+
+static VALUE
+rb_thread_raise_m(argc, argv, thread)
+ int argc;
+ VALUE *argv;
+ VALUE thread;
+{
+ rb_thread_t th = rb_thread_check(thread);
+
+ if (ruby_safe_level > th->safe) {
+ rb_secure(4);
+ }
+ rb_thread_raise(argc, argv, th);
+ return Qnil; /* not reached */
+}
+
+VALUE
+rb_thread_local_aref(thread, id)
+ VALUE thread;
+ ID id;
+{
+ rb_thread_t th;
+ VALUE val;
+
+ th = rb_thread_check(thread);
+ if (ruby_safe_level >= 4 && th != curr_thread) {
+ rb_raise(rb_eSecurityError, "Insecure: thread locals");
+ }
+ if (!th->locals) return Qnil;
+ if (st_lookup(th->locals, id, &val)) {
+ return val;
+ }
+ return Qnil;
+}
+
+
+/*
+ * call-seq:
+ * thr[sym] => obj or nil
+ *
+ * Attribute Reference---Returns the value of a thread-local variable, using
+ * either a symbol or a string name. If the specified variable does not exist,
+ * returns <code>nil</code>.
+ *
+ * a = Thread.new { Thread.current["name"] = "A"; Thread.stop }
+ * b = Thread.new { Thread.current[:name] = "B"; Thread.stop }
+ * c = Thread.new { Thread.current["name"] = "C"; Thread.stop }
+ * Thread.list.each {|x| puts "#{x.inspect}: #{x[:name]}" }
+ *
+ * <em>produces:</em>
+ *
+ * #<Thread:0x401b3b3c sleep>: C
+ * #<Thread:0x401b3bc8 sleep>: B
+ * #<Thread:0x401b3c68 sleep>: A
+ * #<Thread:0x401bdf4c run>:
+ */
+
+static VALUE
+rb_thread_aref(thread, id)
+ VALUE thread, id;
+{
+ return rb_thread_local_aref(thread, rb_to_id(id));
+}
+
+VALUE
+rb_thread_local_aset(thread, id, val)
+ VALUE thread;
+ ID id;
+ VALUE val;
+{
+ rb_thread_t th = rb_thread_check(thread);
+
+ if (ruby_safe_level >= 4 && th != curr_thread) {
+ rb_raise(rb_eSecurityError, "Insecure: can't modify thread locals");
+ }
+ if (OBJ_FROZEN(thread)) rb_error_frozen("thread locals");
+
+ if (!th->locals) {
+ th->locals = st_init_numtable();
+ }
+ if (NIL_P(val)) {
+ st_delete(th->locals, (st_data_t*)&id, 0);
+ return Qnil;
+ }
+ st_insert(th->locals, id, val);
+
+ return val;
+}
+
+
+/*
+ * call-seq:
+ * thr[sym] = obj => obj
+ *
+ * Attribute Assignment---Sets or creates the value of a thread-local variable,
+ * using either a symbol or a string. See also <code>Thread#[]</code>.
+ */
+
+static VALUE
+rb_thread_aset(thread, id, val)
+ VALUE thread, id, val;
+{
+ return rb_thread_local_aset(thread, rb_to_id(id), val);
+}
+
+
+/*
+ * call-seq:
+ * thr.key?(sym) => true or false
+ *
+ * Returns <code>true</code> if the given string (or symbol) exists as a
+ * thread-local variable.
+ *
+ * me = Thread.current
+ * me[:oliver] = "a"
+ * me.key?(:oliver) #=> true
+ * me.key?(:stanley) #=> false
+ */
+
+static VALUE
+rb_thread_key_p(thread, id)
+ VALUE thread, id;
+{
+ rb_thread_t th = rb_thread_check(thread);
+
+ if (!th->locals) return Qfalse;
+ if (st_lookup(th->locals, rb_to_id(id), 0))
+ return Qtrue;
+ return Qfalse;
+}
static int
-thread_loading(feature)
- char *feature;
+thread_keys_i(key, value, ary)
+ ID key;
+ VALUE value, ary;
{
- if (curr_thread != curr_thread->next && loading_thread) {
- while (loading_thread != curr_thread) {
- thread_schedule();
- CHECK_INTS;
+ rb_ary_push(ary, ID2SYM(key));
+ return ST_CONTINUE;
+}
+
+
+/*
+ * call-seq:
+ * thr.keys => array
+ *
+ * Returns an an array of the names of the thread-local variables (as Symbols).
+ *
+ * thr = Thread.new do
+ * Thread.current[:cat] = 'meow'
+ * Thread.current["dog"] = 'woof'
+ * end
+ * thr.join #=> #<Thread:0x401b3f10 dead>
+ * thr.keys #=> [:dog, :cat]
+ */
+
+static VALUE
+rb_thread_keys(thread)
+ VALUE thread;
+{
+ rb_thread_t th = rb_thread_check(thread);
+ VALUE ary = rb_ary_new();
+
+ if (th->locals) {
+ st_foreach(th->locals, thread_keys_i, ary);
+ }
+ return ary;
+}
+
+/*
+ * call-seq:
+ * thr.inspect => string
+ *
+ * Dump the name, id, and status of _thr_ to a string.
+ */
+
+static VALUE
+rb_thread_inspect(thread)
+ VALUE thread;
+{
+ char *cname = rb_obj_classname(thread);
+ rb_thread_t th = rb_thread_check(thread);
+ const char *status = thread_status_name(th->status);
+ VALUE str;
+
+ str = rb_str_new(0, strlen(cname)+7+16+9+1); /* 7:tags 16:addr 9:status 1:nul */
+ sprintf(RSTRING(str)->ptr, "#<%s:0x%lx %s>", cname, thread, status);
+ RSTRING(str)->len = strlen(RSTRING(str)->ptr);
+ OBJ_INFECT(str, thread);
+
+ return str;
+}
+
+void
+rb_thread_atfork()
+{
+ rb_thread_t th;
+
+ if (rb_thread_alone()) return;
+ FOREACH_THREAD(th) {
+ if (th != curr_thread) {
+ rb_thread_die(th);
}
- if (rb_provided(feature)) return TRUE; /* no need to load */
}
+ END_FOREACH(th);
+ main_thread = curr_thread;
+ curr_thread->next = curr_thread;
+ curr_thread->prev = curr_thread;
+}
+
+
+/*
+ * Document-class: Continuation
+ *
+ * Continuation objects are generated by
+ * <code>Kernel#callcc</code>. They hold a return address and execution
+ * context, allowing a nonlocal return to the end of the
+ * <code>callcc</code> block from anywhere within a program.
+ * Continuations are somewhat analogous to a structured version of C's
+ * <code>setjmp/longjmp</code> (although they contain more state, so
+ * you might consider them closer to threads).
+ *
+ * For instance:
+ *
+ * arr = [ "Freddie", "Herbie", "Ron", "Max", "Ringo" ]
+ * callcc{|$cc|}
+ * puts(message = arr.shift)
+ * $cc.call unless message =~ /Max/
+ *
+ * <em>produces:</em>
+ *
+ * Freddie
+ * Herbie
+ * Ron
+ * Max
+ *
+ * This (somewhat contrived) example allows the inner loop to abandon
+ * processing early:
+ *
+ * callcc {|cont|
+ * for i in 0..4
+ * print "\n#{i}: "
+ * for j in i*5...(i+1)*5
+ * cont.call() if j == 17
+ * printf "%3d", j
+ * end
+ * end
+ * }
+ * print "\n"
+ *
+ * <em>produces:</em>
+ *
+ * 0: 0 1 2 3 4
+ * 1: 5 6 7 8 9
+ * 2: 10 11 12 13 14
+ * 3: 15 16
+ */
+
+static VALUE rb_cCont;
+
+/*
+ * call-seq:
+ * callcc {|cont| block } => obj
+ *
+ * Generates a <code>Continuation</code> object, which it passes to the
+ * associated block. Performing a <em>cont</em><code>.call</code> will
+ * cause the <code>callcc</code> to return (as will falling through the
+ * end of the block). The value returned by the <code>callcc</code> is
+ * the value of the block, or the value passed to
+ * <em>cont</em><code>.call</code>. See class <code>Continuation</code>
+ * for more details. Also see <code>Kernel::throw</code> for
+ * an alternative mechanism for unwinding a call stack.
+ */
+
+static VALUE
+rb_callcc(self)
+ VALUE self;
+{
+ volatile VALUE cont;
+ rb_thread_t th;
+ volatile rb_thread_t th_save;
+ struct tag *tag;
+ struct RVarmap *vars;
+ struct BLOCK *blk;
+
+ THREAD_ALLOC(th);
+ cont = Data_Wrap_Struct(rb_cCont, thread_mark, thread_free, th);
+
+ scope_dup(ruby_scope);
+ for (tag=prot_tag; tag; tag=tag->prev) {
+ scope_dup(tag->scope);
+ }
+ th->thread = curr_thread->thread;
- loading_thread = curr_thread;
- loading_nest++;
+ for (vars = ruby_dyna_vars; vars; vars = vars->next) {
+ if (FL_TEST(vars, DVAR_DONT_RECYCLE)) break;
+ FL_SET(vars, DVAR_DONT_RECYCLE);
+ }
+ th_save = th;
+ if (THREAD_SAVE_CONTEXT(th)) {
+ return th_save->result;
+ }
+ else {
+ return rb_yield(cont);
+ }
+}
+
+/*
+ * call-seq:
+ * cont.call(args, ...)
+ * cont[args, ...]
+ *
+ * Invokes the continuation. The program continues from the end of the
+ * <code>callcc</code> block. If no arguments are given, the original
+ * <code>callcc</code> returns <code>nil</code>. If one argument is
+ * given, <code>callcc</code> returns it. Otherwise, an array
+ * containing <i>args</i> is returned.
+ *
+ * callcc {|cont| cont.call } #=> nil
+ * callcc {|cont| cont.call 1 } #=> 1
+ * callcc {|cont| cont.call 1, 2, 3 } #=> [1, 2, 3]
+ */
- return FALSE;
+static VALUE
+rb_cont_call(argc, argv, cont)
+ int argc;
+ VALUE *argv;
+ VALUE cont;
+{
+ rb_thread_t th = rb_thread_check(cont);
+
+ if (th->thread != curr_thread->thread) {
+ rb_raise(rb_eRuntimeError, "continuation called across threads");
+ }
+ switch (argc) {
+ case 0:
+ th->result = Qnil;
+ break;
+ case 1:
+ th->result = argv[0];
+ break;
+ default:
+ th->result = rb_ary_new4(argc, argv);
+ break;
+ }
+
+ rb_thread_restore_context(th, RESTORE_NORMAL);
+ return Qnil;
}
-static void
-thread_loading_done()
+struct thgroup {
+ int enclosed;
+ VALUE group;
+};
+
+
+/*
+ * Document-class: ThreadGroup
+ *
+ * <code>ThreadGroup</code> provides a means of keeping track of a number of
+ * threads as a group. A <code>Thread</code> can belong to only one
+ * <code>ThreadGroup</code> at a time; adding a thread to a new group will
+ * remove it from any previous group.
+ *
+ * Newly created threads belong to the same group as the thread from which they
+ * were created.
+ */
+
+static VALUE thgroup_s_alloc _((VALUE));
+static VALUE
+thgroup_s_alloc(klass)
+ VALUE klass;
+{
+ VALUE group;
+ struct thgroup *data;
+
+ group = Data_Make_Struct(klass, struct thgroup, 0, free, data);
+ data->enclosed = 0;
+ data->group = group;
+
+ return group;
+}
+
+
+/*
+ * call-seq:
+ * thgrp.list => array
+ *
+ * Returns an array of all existing <code>Thread</code> objects that belong to
+ * this group.
+ *
+ * ThreadGroup::Default.list #=> [#<Thread:0x401bdf4c run>]
+ */
+
+static VALUE
+thgroup_list(group)
+ VALUE group;
{
- if (--loading_nest == 0) {
- loading_thread = 0;
+ struct thgroup *data;
+ rb_thread_t th;
+ VALUE ary;
+
+ Data_Get_Struct(group, struct thgroup, data);
+ ary = rb_ary_new();
+
+ FOREACH_THREAD(th) {
+ if (th->thgroup == data->group) {
+ rb_ary_push(ary, th->thread);
+ }
}
+ END_FOREACH(th);
+
+ return ary;
}
-void
-Init_Thread()
+
+/*
+ * call-seq:
+ * thgrp.enclose => thgrp
+ *
+ * Prevents threads from being added to or removed from the receiving
+ * <code>ThreadGroup</code>. New threads can still be started in an enclosed
+ * <code>ThreadGroup</code>.
+ *
+ * ThreadGroup::Default.enclose #=> #<ThreadGroup:0x4029d914>
+ * thr = Thread::new { Thread.stop } #=> #<Thread:0x402a7210 sleep>
+ * tg = ThreadGroup::new #=> #<ThreadGroup:0x402752d4>
+ * tg.add thr
+ *
+ * <em>produces:</em>
+ *
+ * ThreadError: can't move from the enclosed thread group
+ */
+
+VALUE
+thgroup_enclose(group)
+ VALUE group;
{
- eThreadError = rb_define_class("ThreadError", eStandardError);
- cThread = rb_define_class("Thread", cObject);
+ struct thgroup *data;
- rb_define_singleton_method(cThread, "new", thread_start, 0);
- rb_define_singleton_method(cThread, "start", thread_start, 0);
- rb_define_singleton_method(cThread, "fork", thread_start, 0);
+ Data_Get_Struct(group, struct thgroup, data);
+ data->enclosed = 1;
- rb_define_singleton_method(cThread, "stop", thread_stop, 0);
- rb_define_singleton_method(cThread, "kill", thread_s_kill, 1);
- rb_define_singleton_method(cThread, "exit", thread_exit, 0);
- rb_define_singleton_method(cThread, "pass", thread_pass, 0);
- rb_define_singleton_method(cThread, "join", thread_join, 1);
- rb_define_singleton_method(cThread, "current", thread_current, 0);
- rb_define_singleton_method(cThread, "main", thread_main, 0);
+ return group;
+}
- rb_define_singleton_method(cThread, "critical", thread_get_critical, 0);
- rb_define_singleton_method(cThread, "critical=", thread_set_critical, 1);
- rb_define_singleton_method(cThread, "abort_on_exception", thread_s_abort_exc, 0);
- rb_define_singleton_method(cThread, "abort_on_exception=", thread_s_abort_exc_set, 1);
+/*
+ * call-seq:
+ * thgrp.enclosed? => true or false
+ *
+ * Returns <code>true</code> if <em>thgrp</em> is enclosed. See also
+ * ThreadGroup#enclose.
+ */
- rb_define_method(cThread, "run", thread_run, 0);
- rb_define_method(cThread, "wakeup", thread_wakeup, 0);
- rb_define_method(cThread, "exit", thread_kill, 0);
- rb_define_method(cThread, "value", thread_value, 0);
- rb_define_method(cThread, "status", thread_status, 0);
- rb_define_method(cThread, "alive?", thread_status, 0);
- rb_define_method(cThread, "stop?", thread_stop_p, 0);
- rb_define_method(cThread, "raise", thread_raise, -1);
+static VALUE
+thgroup_enclosed_p(group)
+ VALUE group;
+{
+ struct thgroup *data;
+
+ Data_Get_Struct(group, struct thgroup, data);
+ if (data->enclosed) return Qtrue;
+ return Qfalse;
+}
+
+
+/*
+ * call-seq:
+ * thgrp.add(thread) => thgrp
+ *
+ * Adds the given <em>thread</em> to this group, removing it from any other
+ * group to which it may have previously belonged.
+ *
+ * puts "Initial group is #{ThreadGroup::Default.list}"
+ * tg = ThreadGroup.new
+ * t1 = Thread.new { sleep }
+ * t2 = Thread.new { sleep }
+ * puts "t1 is #{t1}"
+ * puts "t2 is #{t2}"
+ * tg.add(t1)
+ * puts "Initial group now #{ThreadGroup::Default.list}"
+ * puts "tg group now #{tg.list}"
+ *
+ * <em>produces:</em>
+ *
+ * Initial group is #<Thread:0x401bdf4c>
+ * t1 is #<Thread:0x401b3c90>
+ * t2 is #<Thread:0x401b3c18>
+ * Initial group now #<Thread:0x401b3c18>#<Thread:0x401bdf4c>
+ * tg group now #<Thread:0x401b3c90>
+ */
- rb_define_method(cThread, "abort_on_exception", thread_abort_exc, 0);
- rb_define_method(cThread, "abort_on_exception=", thread_abort_exc_set, 1);
+static VALUE
+thgroup_add(group, thread)
+ VALUE group, thread;
+{
+ rb_thread_t th;
+ struct thgroup *data;
- /* allocate main thread */
- main_thread = thread_alloc();
+ rb_secure(4);
+ th = rb_thread_check(thread);
+
+ if (OBJ_FROZEN(group)) {
+ rb_raise(rb_eThreadError, "can't move to the frozen thread group");
+ }
+ Data_Get_Struct(group, struct thgroup, data);
+ if (data->enclosed) {
+ rb_raise(rb_eThreadError, "can't move to the enclosed thread group");
+ }
+
+ if (!th->thgroup) {
+ return Qnil;
+ }
+ if (OBJ_FROZEN(th->thgroup)) {
+ rb_raise(rb_eThreadError, "can't move from the frozen thread group");
+ }
+ Data_Get_Struct(th->thgroup, struct thgroup, data);
+ if (data->enclosed) {
+ rb_raise(rb_eThreadError, "can't move from the enclosed thread group");
+ }
+
+ th->thgroup = group;
+ return group;
}
-#endif
+
+
+/*
+ * +Thread+ encapsulates the behavior of a thread of
+ * execution, including the main thread of the Ruby script.
+ *
+ * In the descriptions of the methods in this class, the parameter _sym_
+ * refers to a symbol, which is either a quoted string or a
+ * +Symbol+ (such as <code>:name</code>).
+ */
+
+void
+Init_Thread()
+{
+ VALUE cThGroup;
+
+ rb_eThreadError = rb_define_class("ThreadError", rb_eStandardError);
+ rb_cThread = rb_define_class("Thread", rb_cObject);
+ rb_undef_alloc_func(rb_cThread);
+
+ rb_define_singleton_method(rb_cThread, "new", rb_thread_s_new, -1);
+ rb_define_method(rb_cThread, "initialize", rb_thread_initialize, -2);
+ rb_define_singleton_method(rb_cThread, "start", rb_thread_start, -2);
+ rb_define_singleton_method(rb_cThread, "fork", rb_thread_start, -2);
+
+ rb_define_singleton_method(rb_cThread, "stop", rb_thread_stop, 0);
+ rb_define_singleton_method(rb_cThread, "kill", rb_thread_s_kill, 1);
+ rb_define_singleton_method(rb_cThread, "exit", rb_thread_exit, 0);
+ rb_define_singleton_method(rb_cThread, "pass", rb_thread_pass, 0);
+ rb_define_singleton_method(rb_cThread, "current", rb_thread_current, 0);
+ rb_define_singleton_method(rb_cThread, "main", rb_thread_main, 0);
+ rb_define_singleton_method(rb_cThread, "list", rb_thread_list, 0);
+
+ rb_define_singleton_method(rb_cThread, "critical", rb_thread_critical_get, 0);
+ rb_define_singleton_method(rb_cThread, "critical=", rb_thread_critical_set, 1);
+
+ rb_define_singleton_method(rb_cThread, "abort_on_exception", rb_thread_s_abort_exc, 0);
+ rb_define_singleton_method(rb_cThread, "abort_on_exception=", rb_thread_s_abort_exc_set, 1);
+
+ rb_define_method(rb_cThread, "run", rb_thread_run, 0);
+ rb_define_method(rb_cThread, "wakeup", rb_thread_wakeup, 0);
+ rb_define_method(rb_cThread, "kill", rb_thread_kill, 0);
+ rb_define_method(rb_cThread, "terminate", rb_thread_kill, 0);
+ rb_define_method(rb_cThread, "exit", rb_thread_kill, 0);
+ rb_define_method(rb_cThread, "value", rb_thread_value, 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);
+ rb_define_method(rb_cThread, "raise", rb_thread_raise_m, -1);
+
+ rb_define_method(rb_cThread, "abort_on_exception", rb_thread_abort_exc, 0);
+ rb_define_method(rb_cThread, "abort_on_exception=", rb_thread_abort_exc_set, 1);
+
+ rb_define_method(rb_cThread, "priority", rb_thread_priority, 0);
+ rb_define_method(rb_cThread, "priority=", rb_thread_priority_set, 1);
+ rb_define_method(rb_cThread, "safe_level", rb_thread_safe_level, 0);
+ rb_define_method(rb_cThread, "group", rb_thread_group, 0);
+
+ rb_define_method(rb_cThread, "[]", rb_thread_aref, 1);
+ rb_define_method(rb_cThread, "[]=", rb_thread_aset, 2);
+ rb_define_method(rb_cThread, "key?", rb_thread_key_p, 1);
+ rb_define_method(rb_cThread, "keys", rb_thread_keys, 0);
+
+ rb_define_method(rb_cThread, "inspect", rb_thread_inspect, 0);
+
+ rb_cCont = rb_define_class("Continuation", rb_cObject);
+ rb_undef_alloc_func(rb_cCont);
+ rb_undef_method(CLASS_OF(rb_cCont), "new");
+ rb_define_method(rb_cCont, "call", rb_cont_call, -1);
+ rb_define_method(rb_cCont, "[]", rb_cont_call, -1);
+ rb_define_global_function("callcc", rb_callcc, 0);
+
+ cThGroup = rb_define_class("ThreadGroup", rb_cObject);
+ rb_define_alloc_func(cThGroup, thgroup_s_alloc);
+ rb_define_method(cThGroup, "list", thgroup_list, 0);
+ rb_define_method(cThGroup, "enclose", thgroup_enclose, 0);
+ rb_define_method(cThGroup, "enclosed?", thgroup_enclosed_p, 0);
+ rb_define_method(cThGroup, "add", thgroup_add, 1);
+ thgroup_default = rb_obj_alloc(cThGroup);
+ rb_define_const(cThGroup, "Default", thgroup_default);
+ rb_global_variable(&thgroup_default);
+
+ /* allocate main thread */
+ main_thread = rb_thread_alloc(rb_cThread);
+ curr_thread = main_thread->prev = main_thread->next = main_thread;
+}
+
+/*
+ * call-seq:
+ * catch(symbol) {| | block } > obj
+ *
+ * +catch+ executes its block. If a +throw+ is
+ * executed, Ruby searches up its stack for a +catch+ block
+ * with a tag corresponding to the +throw+'s
+ * _symbol_. If found, that block is terminated, and
+ * +catch+ returns the value given to +throw+. If
+ * +throw+ is not called, the block terminates normally, and
+ * the value of +catch+ is the value of the last expression
+ * evaluated. +catch+ expressions may be nested, and the
+ * +throw+ call need not be in lexical scope.
+ *
+ * def routine(n)
+ * puts n
+ * throw :done if n <= 0
+ * routine(n-1)
+ * end
+ *
+ *
+ * catch(:done) { routine(3) }
+ *
+ * <em>produces:</em>
+ *
+ * 3
+ * 2
+ * 1
+ * 0
+ */
static VALUE
-f_catch(dmy, tag)
+rb_f_catch(dmy, tag)
VALUE dmy, tag;
{
int state;
- ID t;
- VALUE val; /* OK */
+ VALUE val = Qnil; /* OK */
- t = rb_to_id(tag);
- PUSH_TAG(t);
+ tag = ID2SYM(rb_to_id(tag));
+ PUSH_TAG(tag);
if ((state = EXEC_TAG()) == 0) {
- val = rb_yield(tag);
+ val = rb_yield_0(tag, 0, 0, 0, Qfalse);
}
- else if (state == TAG_THROW && t == prot_tag->dst) {
+ else if (state == TAG_THROW && tag == prot_tag->dst) {
val = prot_tag->retval;
state = 0;
}
@@ -6583,87 +12485,74 @@ f_catch(dmy, tag)
static VALUE
catch_i(tag)
- ID tag;
+ VALUE tag;
{
- return f_catch(0, FIX2INT(tag));
+ return rb_funcall(Qnil, rb_intern("catch"), 1, tag);
}
VALUE
-rb_catch(tag, proc, data)
- char *tag;
- VALUE (*proc)();
+rb_catch(tag, func, data)
+ const char *tag;
+ VALUE (*func)();
VALUE data;
{
- return rb_iterate(catch_i, rb_intern(tag), proc, data);
+ return rb_iterate((VALUE(*)_((VALUE)))catch_i, ID2SYM(rb_intern(tag)), func, data);
}
-
-static VALUE f_throw _((int,VALUE*)) NORETURN;
+/*
+ * call-seq:
+ * throw(symbol [, obj])
+ *
+ * Transfers control to the end of the active +catch+ block
+ * waiting for _symbol_. Raises +NameError+ if there
+ * is no +catch+ block for the symbol. The optional second
+ * parameter supplies a return value for the +catch+ block,
+ * which otherwise defaults to +nil+. For examples, see
+ * <code>Kernel::catch</code>.
+ */
static VALUE
-f_throw(argc, argv)
+rb_f_throw(argc, argv)
int argc;
VALUE *argv;
{
VALUE tag, value;
- ID t;
struct tag *tt = prot_tag;
rb_scan_args(argc, argv, "11", &tag, &value);
- t = rb_to_id(tag);
+ tag = ID2SYM(rb_to_id(tag));
while (tt) {
- if (tt->tag == t) {
- tt->dst = t;
+ if (tt->tag == tag) {
+ tt->dst = tag;
+ tt->retval = value;
break;
}
-#ifdef THREAD
if (tt->tag == PROT_THREAD) {
- Raise(eThreadError, "uncaught throw `%s' in thread 0x%x",
- rb_id2name(t),
- curr_thread);
+ rb_raise(rb_eThreadError, "uncaught throw `%s' in thread 0x%lx",
+ rb_id2name(SYM2ID(tag)),
+ curr_thread);
}
-#endif
tt = tt->prev;
}
if (!tt) {
- NameError("uncaught throw `%s'", rb_id2name(t));
+ rb_name_error(SYM2ID(tag), "uncaught throw `%s'", rb_id2name(SYM2ID(tag)));
}
- return_value(value);
- trap_restore_mask();
+ rb_trap_restore_mask();
JUMP_TAG(TAG_THROW);
- /* not reached */
+#ifndef __GNUC__
+ return Qnil; /* not reached */
+#endif
}
void
rb_throw(tag, val)
- char *tag;
+ const char *tag;
VALUE val;
{
VALUE argv[2];
- ID t = rb_intern(tag);
- argv[0] = FIX2INT(t);
+ argv[0] = ID2SYM(rb_intern(tag));
argv[1] = val;
- f_throw(2, argv);
-}
-
-static void
-return_check()
-{
-#ifdef THREAD
- struct tag *tt = prot_tag;
-
- while (tt) {
- if (tt->tag == PROT_FUNC) {
- break;
- }
- if (tt->tag == PROT_THREAD) {
- Raise(eThreadError, "return from within thread 0x%x",
- curr_thread);
- }
- tt = tt->prev;
- }
-#endif
+ rb_f_throw(2, argv);
}
-
diff --git a/ext/.cvsignore b/ext/.cvsignore
new file mode 100644
index 0000000000..ab2424ff7a
--- /dev/null
+++ b/ext/.cvsignore
@@ -0,0 +1,2 @@
+extinit.c
+*.log
diff --git a/ext/.document b/ext/.document
new file mode 100644
index 0000000000..797d8dcef8
--- /dev/null
+++ b/ext/.document
@@ -0,0 +1,5 @@
+# Add files to this as they become documented
+
+iconv/iconv.c
+strscan/strscan.c
+zlib/zlib.c
diff --git a/ext/Setup b/ext/Setup
index 9e3a2474c3..7b214abde3 100644
--- a/ext/Setup
+++ b/ext/Setup
@@ -1,13 +1,33 @@
#option nodynamic
-#GD
+#Win32API
+#bigdecimal
#curses
#dbm
+#digest
+#digest/md5
+#digest/rmd160
+#digest/sha1
+#digest/sha2
+#dl
+#enumerator
#etc
#fcntl
-#kconv
-#md5
+#gdbm
+#iconv
+#io/wait
+#nkf
+#pty
+#openssl
+#racc/cparse
+#readline
+#sdbm
#socket
-#tkutil
+#stringio
+#strscan
+#syck
+#syslog
#tcltklib
-#gtk
+#tk
+#win32ole
+#zlib
diff --git a/ext/Setup.atheos b/ext/Setup.atheos
new file mode 100644
index 0000000000..9b1bdecb95
--- /dev/null
+++ b/ext/Setup.atheos
@@ -0,0 +1,33 @@
+option nodynamic
+
+#Win32API
+bigdecimal
+curses
+dbm
+digest
+digest/md5
+digest/rmd160
+digest/sha1
+digest/sha2
+dl
+enumerator
+etc
+fcntl
+gdbm
+iconv
+io/wait
+nkf
+pty
+#openssl
+racc/parse
+readline
+sdbm
+socket
+stringio
+strscan
+syck
+syslog
+#tcltklib
+#tk
+#win32ole
+zlib
diff --git a/ext/Setup.dj b/ext/Setup.dj
index 25adea2035..f2ed3a4f16 100644
--- a/ext/Setup.dj
+++ b/ext/Setup.dj
@@ -1,12 +1,33 @@
option nodynamic
-#GD
-#curses
+#Win32API
+bigdecimal
+curses
dbm
-#etc
+digest
+digest/md5
+digest/rmd160
+digest/sha1
+digest/sha2
+#dl
+etc
+enumerator
fcntl
-kconv
-marshal
-md5
+gdbm
+#iconv
+#io/wait
+nkf
+#pty
+#openssl
+racc/cparse
+readline
+sdbm
#socket
-#tkutil
+stringio
+strscan
+syck
+#syslog
+#tcltklib
+#tk
+#win32ole
+zlib
diff --git a/ext/Setup.emx b/ext/Setup.emx
new file mode 100644
index 0000000000..7ea04543c5
--- /dev/null
+++ b/ext/Setup.emx
@@ -0,0 +1,33 @@
+option nodynamic
+
+#Win32API
+bigdecimal
+curses
+#dbm
+digest
+digest/md5
+digest/rmd160
+digest/sha1
+digest/sha2
+#dl
+enumerator
+etc
+fcntl
+#gdbm
+#iconv
+#io/wait
+nkf
+#pty
+#openssl
+racc/cparse
+#readline
+#sdbm
+socket
+stringio
+strscan
+#syck
+#syslog
+#tcltklib
+#tk
+#win32ole
+#zlib
diff --git a/ext/Setup.nt b/ext/Setup.nt
index b469709585..7a330f801a 100644
--- a/ext/Setup.nt
+++ b/ext/Setup.nt
@@ -1,12 +1,33 @@
-option nodynamic
+#option nodynamic
-#GD
+Win32API
+bigdecimal
#curses
#dbm
-#etc
+digest
+digest/md5
+digest/rmd160
+digest/sha1
+digest/sha2
+dl
+enumerator
+etc
fcntl
-kconv
-#marshal
-md5
+#gdbm
+#iconv
+#io/wait
+nkf
+#pty
+#openssl
+racc/cparse
+#readline
+sdbm
socket
-#tkutil
+stringio
+strscan
+syck
+#syslog
+#tcltklib
+#tk
+win32ole
+#zlib
diff --git a/ext/Setup.x68 b/ext/Setup.x68
index 25adea2035..9b9563d941 100644
--- a/ext/Setup.x68
+++ b/ext/Setup.x68
@@ -1,12 +1,33 @@
option nodynamic
-#GD
+#Win32API
+bigdecimal
#curses
dbm
+digest
+digest/md5
+digest/rmd160
+digest/sha1
+digest/sha2
+#dl
#etc
+enumerator
fcntl
-kconv
-marshal
-md5
+#gdbm
+#iconv
+#io/wait
+nkf
+#pty
+#openssl
+racc/cparse
+#readline
+#sdbm
#socket
-#tkutil
+stringio
+strscan
+#syck
+#syslog
+#tcltklib
+#tk
+#win32ole
+#zlib
diff --git a/ext/Win32API/.cvsignore b/ext/Win32API/.cvsignore
new file mode 100644
index 0000000000..90c83ed9b1
--- /dev/null
+++ b/ext/Win32API/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+*.log
+*.def
diff --git a/ext/Win32API/MANIFEST b/ext/Win32API/MANIFEST
deleted file mode 100644
index 7cc9ac445e..0000000000
--- a/ext/Win32API/MANIFEST
+++ /dev/null
@@ -1,7 +0,0 @@
-MANIFEST
-depend
-MANIFEST
-Win32API.c
-extconf.rb
-getch.rb
-point.rb
diff --git a/ext/Win32API/Win32API.c b/ext/Win32API/Win32API.c
index f4cb5c726f..776df56ecb 100644
--- a/ext/Win32API/Win32API.c
+++ b/ext/Win32API/Win32API.c
@@ -2,20 +2,17 @@
Win32API - Ruby Win32 API Import Facility
*/
+#if !defined _MSC_VER && !defined _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
+#endif
#define _T_VOID 0
#define _T_NUMBER 1
#define _T_POINTER 2
#define _T_INTEGER 3
-typedef char *ApiPointer(void);
-typedef long ApiNumber(void);
-typedef void ApiVoid(void);
-typedef int ApiInteger(void);
-
#include "ruby.h"
typedef struct {
@@ -46,62 +43,95 @@ Win32API_initialize(self, dllname, proc, import, export)
VALUE str;
VALUE a_import;
VALUE *ptr;
+ char *s;
int i;
int len;
- int ex;
-
- hdll = GetModuleHandle(RSTRING(dllname)->ptr);
- if (!hdll) {
- hdll = LoadLibrary(RSTRING(dllname)->ptr);
- if (!hdll)
- Fail("LoadLibrary: %s\n", RSTRING(dllname)->ptr);
- Data_Wrap_Struct(self, 0, Win32API_FreeLibrary, hdll);
- }
+ int ex = _T_VOID;
+
+ SafeStringValue(dllname);
+ SafeStringValue(proc);
+ hdll = LoadLibrary(RSTRING(dllname)->ptr);
+ if (!hdll)
+ rb_raise(rb_eRuntimeError, "LoadLibrary: %s\n", RSTRING(dllname)->ptr);
+ rb_iv_set(self, "__hdll__", Data_Wrap_Struct(rb_cData, 0, Win32API_FreeLibrary, hdll));
hproc = GetProcAddress(hdll, RSTRING(proc)->ptr);
if (!hproc) {
- str = str_new3(proc);
- str = str_cat(str, "A", 1);
+ str = rb_str_new3(proc);
+ str = rb_str_cat(str, "A", 1);
hproc = GetProcAddress(hdll, RSTRING(str)->ptr);
if (!hproc)
- Fail("GetProcAddress: %s or %s\n",
+ rb_raise(rb_eRuntimeError, "GetProcAddress: %s or %s\n",
RSTRING(proc)->ptr, RSTRING(str)->ptr);
}
- rb_iv_set(self, "__dll__", INT2NUM((int)hdll));
+ rb_iv_set(self, "__dll__", UINT2NUM((unsigned long)hdll));
rb_iv_set(self, "__dllname__", dllname);
- rb_iv_set(self, "__proc__", INT2NUM((int)hproc));
+ rb_iv_set(self, "__proc__", UINT2NUM((unsigned long)hproc));
- a_import = ary_new();
- ptr = RARRAY(import)->ptr;
- for (i = 0, len = RARRAY(import)->len; i < len; i++) {
- int c = *(char *)RSTRING(ptr[i])->ptr;
- switch (c) {
+ a_import = rb_ary_new();
+ switch (TYPE(import)) {
+ case T_NIL:
+ break;
+ case T_ARRAY:
+ ptr = RARRAY(import)->ptr;
+ for (i = 0, len = RARRAY(import)->len; i < len; i++) {
+ SafeStringValue(ptr[i]);
+ switch (*(char *)RSTRING(ptr[i])->ptr) {
+ case 'N': case 'n': case 'L': case 'l':
+ rb_ary_push(a_import, INT2FIX(_T_NUMBER));
+ break;
+ case 'P': case 'p':
+ rb_ary_push(a_import, INT2FIX(_T_POINTER));
+ break;
+ case 'I': case 'i':
+ rb_ary_push(a_import, INT2FIX(_T_INTEGER));
+ break;
+ }
+ }
+ break;
+ default:
+ SafeStringValue(import);
+ s = RSTRING(import)->ptr;
+ for (i = 0, len = RSTRING(import)->len; i < len; i++) {
+ switch (*s++) {
+ case 'N': case 'n': case 'L': case 'l':
+ rb_ary_push(a_import, INT2FIX(_T_NUMBER));
+ break;
+ case 'P': case 'p':
+ rb_ary_push(a_import, INT2FIX(_T_POINTER));
+ break;
+ case 'I': case 'i':
+ rb_ary_push(a_import, INT2FIX(_T_INTEGER));
+ break;
+ }
+ }
+ break;
+ }
+
+ if (16 < RARRAY(a_import)->len) {
+ rb_raise(rb_eRuntimeError, "too many parameters: %d\n", RARRAY(a_import)->len);
+ }
+
+ rb_iv_set(self, "__import__", a_import);
+
+ if (NIL_P(export)) {
+ ex = _T_VOID;
+ } else {
+ SafeStringValue(export);
+ switch (*RSTRING(export)->ptr) {
+ case 'V': case 'v':
+ ex = _T_VOID;
+ break;
case 'N': case 'n': case 'L': case 'l':
- ary_push(a_import, INT2FIX(_T_NUMBER));
+ ex = _T_NUMBER;
break;
case 'P': case 'p':
- ary_push(a_import, INT2FIX(_T_POINTER));
+ ex = _T_POINTER;
break;
case 'I': case 'i':
- ary_push(a_import, INT2FIX(_T_INTEGER));
+ ex = _T_INTEGER;
break;
}
}
- rb_iv_set(self, "__import__", a_import);
-
- switch (*RSTRING(export)->ptr) {
- case 'V': case 'v':
- ex = _T_VOID;
- break;
- case 'N': case 'n': case 'L': case 'l':
- ex = _T_NUMBER;
- break;
- case 'P': case 'p':
- ex = _T_POINTER;
- break;
- case 'I': case 'i':
- ex = _T_INTEGER;
- break;
- }
rb_iv_set(self, "__export__", INT2FIX(ex));
return Qnil;
@@ -109,114 +139,73 @@ Win32API_initialize(self, dllname, proc, import, export)
static VALUE
Win32API_Call(argc, argv, obj)
- VALUE argc;
- VALUE argv;
+ int argc;
+ VALUE *argv;
VALUE obj;
{
VALUE args;
+ unsigned long ret;
+ int i;
+ struct {
+ unsigned long params[16];
+ } param;
+#define params param.params
- FARPROC ApiFunction;
-
- ApiPointer *ApiFunctionPointer;
- ApiNumber *ApiFunctionNumber;
- ApiVoid *ApiFunctionVoid;
- ApiInteger *ApiFunctionInteger;
-
- long lParam;
- char *pParam;
-
- VALUE Return;
-
- VALUE obj_proc;
- VALUE obj_import;
- VALUE obj_export;
- VALUE import_type;
- int nimport, timport, texport, i;
- int items;
-
- items = rb_scan_args(argc, argv, "0*", &args);
-
- obj_proc = rb_iv_get(obj, "__proc__");
-
- ApiFunction = (FARPROC)NUM2INT(obj_proc);
+ VALUE obj_proc = rb_iv_get(obj, "__proc__");
+ VALUE obj_import = rb_iv_get(obj, "__import__");
+ VALUE obj_export = rb_iv_get(obj, "__export__");
+ FARPROC ApiFunction = (FARPROC)NUM2ULONG(obj_proc);
+ int items = rb_scan_args(argc, argv, "0*", &args);
+ int nimport = RARRAY(obj_import)->len;
- obj_import = rb_iv_get(obj, "__import__");
- obj_export = rb_iv_get(obj, "__export__");
- nimport = RARRAY(obj_import)->len;
- texport = FIX2INT(obj_export);
if (items != nimport)
- Fail("Wrong number of parameters: expected %d, got %d.\n",
+ rb_raise(rb_eRuntimeError, "Wrong number of parameters: expected %d, got %d.\n",
nimport, items);
- if (0 < nimport) {
- for (i = nimport - 1; 0 <= i; i--) {
+ for (i = 0; i < nimport; i++) {
+ unsigned long lParam = 0;
+ switch (FIX2INT(rb_ary_entry(obj_import, i))) {
VALUE str;
- import_type = ary_entry(obj_import, i);
- timport = FIX2INT(import_type);
- switch (timport) {
- case _T_NUMBER:
- case _T_INTEGER:
- lParam = NUM2INT(ary_entry(args, i));
-#if defined(_MSC_VER) || defined(__LCC__)
- _asm {
- mov eax, lParam
- push eax
- }
-#elif defined(__CYGWIN32__) || defined(__MINGW32__)
- asm volatile ("pushl %0" :: "g" (lParam));
-#else
-#error
-#endif
- break;
- case _T_POINTER:
- str = ary_entry(args, i);
- Check_Type(str, T_STRING);
- str_modify(str);
- pParam = RSTRING(str)->ptr;
-#if defined(_MSC_VER) || defined(__LCC__)
- _asm {
- mov eax, dword ptr pParam
- push eax
- }
-#elif defined(__CYGWIN32__) || defined(__MINGW32__)
- asm volatile ("pushl %0" :: "g" (pParam));
-#else
-#error
-#endif
- break;
+ case _T_NUMBER:
+ case _T_INTEGER:
+ default:
+ lParam = NUM2ULONG(rb_ary_entry(args, i));
+ break;
+ case _T_POINTER:
+ str = rb_ary_entry(args, i);
+ if (NIL_P(str)) {
+ lParam = 0;
+ } else if (FIXNUM_P(str)) {
+ lParam = NUM2ULONG(str);
+ } else {
+ StringValue(str);
+ rb_str_modify(str);
+ lParam = (unsigned long)StringValuePtr(str);
}
+ break;
}
-
+ params[i] = lParam;
}
- switch (texport) {
+ ret = ApiFunction(param);
+
+ switch (FIX2INT(obj_export)) {
case _T_NUMBER:
- ApiFunctionNumber = (ApiNumber *) ApiFunction;
- Return = INT2NUM(ApiFunctionNumber());
- break;
- case _T_POINTER:
- ApiFunctionPointer = (ApiPointer *) ApiFunction;
- Return = str_new2((char *)ApiFunctionPointer());
- break;
case _T_INTEGER:
- ApiFunctionInteger = (ApiInteger *) ApiFunction;
- Return = INT2NUM(ApiFunctionInteger());
- break;
+ return INT2NUM(ret);
+ case _T_POINTER:
+ return rb_str_new2((char *)ret);
case _T_VOID:
default:
- ApiFunctionVoid = (ApiVoid *) ApiFunction;
- ApiFunctionVoid();
- Return = INT2NUM(0);
- break;
+ return INT2NUM(0);
}
- return Return;
}
void
Init_Win32API()
{
- VALUE cWin32API = rb_define_class("Win32API", cObject);
+ VALUE cWin32API = rb_define_class("Win32API", rb_cObject);
rb_define_method(cWin32API, "initialize", Win32API_initialize, 4);
rb_define_method(cWin32API, "call", Win32API_Call, -1);
rb_define_alias(cWin32API, "Call", "call");
diff --git a/ext/Win32API/depend b/ext/Win32API/depend
new file mode 100644
index 0000000000..b224bb66c9
--- /dev/null
+++ b/ext/Win32API/depend
@@ -0,0 +1 @@
+Win32API.o : Win32API.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/Win32API/extconf.rb b/ext/Win32API/extconf.rb
index a03f358593..134a6e5b92 100644
--- a/ext/Win32API/extconf.rb
+++ b/ext/Win32API/extconf.rb
@@ -1,7 +1,5 @@
-case PLATFORM
-when /cygwin32/,/mingw32/
- $CFLAGS = "-fno-defer-pop"
- create_makefile("Win32API")
-when /win32/
+require 'mkmf'
+
+if have_header("windows.h") and have_library("kernel32")
create_makefile("Win32API")
end
diff --git a/ext/Win32API/lib/win32/registry.rb b/ext/Win32API/lib/win32/registry.rb
new file mode 100644
index 0000000000..2671551a33
--- /dev/null
+++ b/ext/Win32API/lib/win32/registry.rb
@@ -0,0 +1,831 @@
+=begin
+= Win32 Registry I/F
+win32/registry is registry accessor library for Win32 platform.
+It uses Win32API to call Win32 Registry APIs.
+
+== example
+ Win32::Registry::HKEY_CURRENT_USER.open('SOFTWARE\foo') do |reg|
+ value = reg['foo'] # read a value
+ value = reg['foo', Win32::Registry::REG_SZ] # read a value with type
+ type, value = reg.read('foo') # read a value
+ reg['foo'] = 'bar' # write a value
+ reg['foo', Win32::Registry::REG_SZ] = 'bar' # write a value with type
+ reg.write('foo', Win32::Registry::REG_SZ, 'bar') # write a value
+
+ reg.each_value { |name, type, data| ... } # Enumerate values
+ reg.each_key { |key, wtime| ... } # Enumerate subkeys
+
+ reg.delete_value(name) # Delete a value
+ reg.delete_key(name) # Delete a subkey
+ reg.delete_key(name, true) # Delete a subkey recursively
+ end
+
+= Reference
+
+== Win32::Registry class
+
+=== including modules
+
+* Enumerable
+* Registry::Constants
+
+=== class methods
+--- Registry.open(key, subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED)
+--- Registry.open(key, subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED) { |reg| ... }
+ Open the registry key ((|subkey|)) under ((|key|)).
+ ((|key|)) is Win32::Registry object of parent key.
+ You can use predefined key HKEY_* (see ((<constants>)))
+
+ ((|desired|)) and ((|opt|)) is access mask and key option.
+ For detail, see ((<MSDN Library|URL:http://msdn.microsoft.com/library/en-us/sysinfo/base/regopenkeyex.asp>)).
+
+ If block is given, the key is closed automatically.
+
+--- Registry.create(key, subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVED)
+--- Registry.create(key, subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVED) { |reg| ... }
+ Create or open the registry key ((|subkey|)) under ((|key|)).
+ You can use predefined key HKEY_* (see ((<constants>)))
+
+ If subkey is already exists, key is opened and Registry#((<created?>))
+ method will return false.
+
+ If block is given, the key is closed automatically.
+
+--- Registry.expand_environ(str)
+ Replace (({%\w+%})) into the environment value of ((|str|)).
+ This method is used for REG_EXPAND_SZ.
+
+ For detail, see ((<ExpandEnvironmentStrings|URL:http://msdn.microsoft.com/library/en-us/sysinfo/base/expandenvironmentstrings.asp>)) Win32 API.
+
+--- Registry.type2name(type)
+ Convert registry type value to readable string.
+
+--- Registry.wtime2time(wtime)
+ Convert 64-bit FILETIME integer into Time object.
+
+--- Registry.time2wtime(time)
+ Convert Time object or Integer object into 64-bit FILETIME.
+
+=== instance methods
+--- open(subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED)
+ Same as (({Win32::((<Registry.open>))(self, subkey, desired, opt)}))
+
+--- create(subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVED)
+ Same as (({Win32::((<Registry.create>))(self, subkey, desired, opt)}))
+
+--- close
+ Close key.
+
+ After closed, most method raises error.
+
+--- read(name, *rtype)
+ Read a registry value named ((|name|)) and return array of
+ [ ((|type|)), ((|data|)) ].
+ When name is nil, the `default' value is read.
+
+ ((|type|)) is value type. (see ((<Win32::Registry::Constants module>)))
+ ((|data|)) is value data, its class is:
+ :REG_SZ, REG_EXPAND_SZ
+ String
+ :REG_MULTI_SZ
+ Array of String
+ :REG_DWORD, REG_DWORD_BIG_ENDIAN, REG_QWORD
+ Integer
+ :REG_BINARY
+ String (contains binary data)
+
+ When ((|rtype|)) is specified, the value type must be included by
+ ((|rtype|)) array, or TypeError is raised.
+
+--- self[name, *rtype]
+ Read a registry value named ((|name|)) and return its value data.
+ The class of value is same as ((<read>)) method returns.
+
+ If the value type is REG_EXPAND_SZ, returns value data whose environment
+ variables are replaced.
+ If the value type is neither REG_SZ, REG_MULTI_SZ, REG_DWORD,
+ REG_DWORD_BIG_ENDIAN, nor REG_QWORD, TypeError is raised.
+
+ The meaning of ((|rtype|)) is same as ((<read>)) method.
+
+--- read_s(name)
+--- read_i(name)
+--- read_bin(name)
+ Read a REG_SZ(read_s), REG_DWORD(read_i), or REG_BINARY(read_bin)
+ registry value named ((|name|)).
+
+ If the values type does not match, TypeError is raised.
+
+--- read_s_expand(name)
+ Read a REG_SZ or REG_EXPAND_SZ registry value named ((|name|)).
+
+ If the value type is REG_EXPAND_SZ, environment variables are replaced.
+ Unless the value type is REG_SZ or REG_EXPAND_SZ, TypeError is raised.
+
+--- write(name, type, data)
+ Write ((|data|)) to a registry value named ((|name|)).
+ When name is nil, write to the `default' value.
+
+ ((|type|)) is type value. (see ((<Registry::Constants module>)))
+ Class of ((|data|)) must be same as which ((<read>))
+ method returns.
+
+--- self[name, wtype = nil] = value
+ Write ((|value|)) to a registry value named ((|name|)).
+
+ If ((|wtype|)) is specified, the value type is it.
+ Otherwise, the value type is depend on class of ((|value|)):
+ :Integer
+ REG_DWORD
+ :String
+ REG_SZ
+ :Array
+ REG_MULTI_SZ
+
+--- write_s(name, value)
+--- write_i(name, value)
+--- write_bin(name, value)
+ Write ((|value|)) to a registry value named ((|name|)).
+
+ The value type is REG_SZ(write_s), REG_DWORD(write_i), or
+ REG_BINARY(write_bin).
+
+--- each { |name, type, value| ... }
+--- each_value { |name, type, value| ... }
+ Enumerate values.
+
+--- each_key { |subkey, wtime| ... }
+ Enumerate subkeys.
+
+ ((|subkey|)) is String which contains name of subkey.
+ ((|wtime|)) is last write time as FILETIME (64-bit integer).
+ (see ((<Registry.wtime2time>)))
+
+--- delete(name)
+--- delete_value(name)
+ Delete a registry value named ((|name|)).
+ We can not delete the `default' value.
+
+--- delete_key(name, recursive = false)
+ Delete a subkey named ((|name|)) and all its values.
+
+ If ((|recursive|)) is false, the subkey must not have subkeys.
+ Otherwise, this method deletes all subkeys and values recursively.
+
+--- flush
+ Write all the attributes into the registry file.
+
+--- created?
+ Returns if key is created ((*newly*)).
+ (see ((<Registry.create>)))
+
+--- open?
+ Returns if key is not closed.
+
+--- hkey
+ Returns key handle value.
+
+--- parent
+ Win32::Registry object of parent key, or nil if predefeined key.
+
+--- keyname
+ Same as ((|subkey|)) value of ((<Registry.open>)) or
+ ((<Registry.create>)) method.
+
+--- disposition
+ Disposition value (REG_CREATED_NEW_KEY or REG_OPENED_EXISTING_KEY).
+
+--- name
+--- to_s
+ Full path of key such as (({'HKEY_CURRENT_USER\SOFTWARE\foo\bar'})).
+
+--- info
+ Returns key information as Array of:
+ :num_keys
+ The number of subkeys.
+ :max_key_length
+ Maximum length of name of subkeys.
+ :num_values
+ The number of values.
+ :max_value_name_length
+ Maximum length of name of values.
+ :max_value_length
+ Maximum length of value of values.
+ :descriptor_length
+ Length of security descriptor.
+ :wtime
+ Last write time as FILETIME(64-bit integer)
+
+ For detail, see ((<RegQueryInfoKey|URL:http://msdn.microsoft.com/library/en-us/sysinfo/base/regqueryinfokey.asp>)) Win32 API.
+
+--- num_keys
+--- max_key_length
+--- num_values
+--- max_value_name_length
+--- max_value_length
+--- descriptor_length
+--- wtime
+ Returns an item of key information.
+
+=== constants
+--- HKEY_CLASSES_ROOT
+--- HKEY_CURRENT_USER
+--- HKEY_LOCAL_MACHINE
+--- HKEY_PERFORMANCE_DATA
+--- HKEY_CURRENT_CONFIG
+--- HKEY_DYN_DATA
+ Win32::Registry object whose key is predefined key.
+ For detail, see ((<MSDN Library|URL:http://msdn.microsoft.com/library/en-us/sysinfo/base/predefined_keys.asp>)).
+
+== Win32::Registry::Constants module
+
+For detail, see ((<MSDN Library|URL:http://msdn.microsoft.com/library/en-us/sysinfo/base/registry.asp>)).
+
+--- HKEY_*
+ Predefined key ((*handle*)).
+ These are Integer, not Win32::Registry.
+
+--- REG_*
+ Registry value type.
+
+--- KEY_*
+ Security access mask.
+
+--- KEY_OPTIONS_*
+ Key options.
+
+--- REG_CREATED_NEW_KEY
+--- REG_OPENED_EXISTING_KEY
+ If the key is created newly or opened existing key.
+ See also Registry#((<disposition>)) method.
+
+=end
+
+require 'Win32API'
+
+module Win32
+ class Registry
+ module Constants
+ HKEY_CLASSES_ROOT = 0x80000000
+ HKEY_CURRENT_USER = 0x80000001
+ HKEY_LOCAL_MACHINE = 0x80000002
+ HKEY_USERS = 0x80000003
+ HKEY_PERFORMANCE_DATA = 0x80000004
+ HKEY_PERFORMANCE_TEXT = 0x80000050
+ HKEY_PERFORMANCE_NLSTEXT = 0x80000060
+ HKEY_CURRENT_CONFIG = 0x80000005
+ HKEY_DYN_DATA = 0x80000006
+
+ REG_NONE = 0
+ REG_SZ = 1
+ REG_EXPAND_SZ = 2
+ REG_BINARY = 3
+ REG_DWORD = 4
+ REG_DWORD_LITTLE_ENDIAN = 4
+ REG_DWORD_BIG_ENDIAN = 5
+ REG_LINK = 6
+ REG_MULTI_SZ = 7
+ REG_RESOURCE_LIST = 8
+ REG_FULL_RESOURCE_DESCRIPTOR = 9
+ REG_RESOURCE_REQUIREMENTS_LIST = 10
+ REG_QWORD = 11
+ REG_QWORD_LITTLE_ENDIAN = 11
+
+ STANDARD_RIGHTS_READ = 0x00020000
+ STANDARD_RIGHTS_WRITE = 0x00020000
+ KEY_QUERY_VALUE = 0x0001
+ KEY_SET_VALUE = 0x0002
+ KEY_CREATE_SUB_KEY = 0x0004
+ KEY_ENUMERATE_SUB_KEYS = 0x0008
+ KEY_NOTIFY = 0x0010
+ KEY_CREATE_LINK = 0x0020
+ KEY_READ = STANDARD_RIGHTS_READ |
+ KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY
+ KEY_WRITE = STANDARD_RIGHTS_WRITE |
+ KEY_SET_VALUE | KEY_CREATE_SUB_KEY
+ KEY_EXECUTE = KEY_READ
+ KEY_ALL_ACCESS = KEY_READ | KEY_WRITE | KEY_CREATE_LINK
+
+ REG_OPTION_RESERVED = 0x0000
+ REG_OPTION_NON_VOLATILE = 0x0000
+ REG_OPTION_VOLATILE = 0x0001
+ REG_OPTION_CREATE_LINK = 0x0002
+ REG_OPTION_BACKUP_RESTORE = 0x0004
+ REG_OPTION_OPEN_LINK = 0x0008
+ REG_LEGAL_OPTION = REG_OPTION_RESERVED |
+ REG_OPTION_NON_VOLATILE | REG_OPTION_CREATE_LINK |
+ REG_OPTION_BACKUP_RESTORE | REG_OPTION_OPEN_LINK
+
+ REG_CREATED_NEW_KEY = 1
+ REG_OPENED_EXISTING_KEY = 2
+
+ REG_WHOLE_HIVE_VOLATILE = 0x0001
+ REG_REFRESH_HIVE = 0x0002
+ REG_NO_LAZY_FLUSH = 0x0004
+ REG_FORCE_RESTORE = 0x0008
+
+ MAX_KEY_LENGTH = 514
+ MAX_VALUE_LENGTH = 32768
+ end
+ include Constants
+ include Enumerable
+
+ #
+ # Error
+ #
+ class Error < ::StandardError
+ FormatMessageA = Win32API.new('kernel32.dll', 'FormatMessageA', 'LPLLPLP', 'L')
+ def initialize(code)
+ @code = code
+ msg = "\0" * 1024
+ len = FormatMessageA.call(0x1200, 0, code, 0, msg, 1024, 0)
+ super msg[0, len].tr("\r", '').chomp
+ end
+ attr_reader :code
+ end
+
+ #
+ # Predefined Keys
+ #
+ class PredefinedKey < Registry
+ def initialize(hkey, keyname)
+ @hkey = hkey
+ @parent = nil
+ @keyname = keyname
+ @disposition = REG_OPENED_EXISTING_KEY
+ end
+
+ # Predefined keys cannot be closed
+ def close
+ raise Error.new(5) ## ERROR_ACCESS_DENIED
+ end
+
+ # Fake class for Registry#open, Registry#create
+ def class
+ Registry
+ end
+
+ # Make all
+ Constants.constants.grep(/^HKEY_/) do |c|
+ Registry.const_set c, new(Constants.const_get(c), c)
+ end
+ end
+
+ #
+ # Win32 APIs
+ #
+ module API
+ [
+ %w/RegOpenKeyExA LPLLP L/,
+ %w/RegCreateKeyExA LPLLLLPPP L/,
+ %w/RegEnumValueA LLPPPPPP L/,
+ %w/RegEnumKeyExA LLPPLLLP L/,
+ %w/RegQueryValueExA LPLPPP L/,
+ %w/RegSetValueExA LPLLPL L/,
+ %w/RegDeleteValue LP L/,
+ %w/RegDeleteKey LP L/,
+ %w/RegFlushKey L L/,
+ %w/RegCloseKey L L/,
+ %w/RegQueryInfoKey LPPPPPPPPPPP L/,
+ ].each do |fn|
+ const_set fn[0].intern, Win32API.new('advapi32.dll', *fn)
+ end
+
+ module_function
+
+ def check(result)
+ raise Error, result, caller(2) if result != 0
+ end
+
+ def packdw(dw)
+ [dw].pack('V')
+ end
+
+ def unpackdw(dw)
+ dw += [0].pack('V')
+ dw.unpack('V')[0]
+ end
+
+ def packqw(qw)
+ [ qw & 0xFFFFFFFF, qw >> 32 ].pack('VV')
+ end
+
+ def unpackqw(qw)
+ qw = qw.unpack('VV')
+ (qw[1] << 32) | qw[0]
+ end
+
+ def OpenKey(hkey, name, opt, desired)
+ result = packdw(0)
+ check RegOpenKeyExA.call(hkey, name, opt, desired, result)
+ unpackdw(result)
+ end
+
+ def CreateKey(hkey, name, opt, desired)
+ result = packdw(0)
+ disp = packdw(0)
+ check RegCreateKeyExA.call(hkey, name, 0, 0, opt, desired,
+ 0, result, disp)
+ [ unpackdw(result), unpackdw(disp) ]
+ end
+
+ def EnumValue(hkey, index)
+ name = ' ' * Constants::MAX_KEY_LENGTH
+ size = packdw(Constants::MAX_KEY_LENGTH)
+ check RegEnumValueA.call(hkey, index, name, size, 0, 0, 0, 0)
+ name[0, unpackdw(size)]
+ end
+
+ def EnumKey(hkey, index)
+ name = ' ' * Constants::MAX_KEY_LENGTH
+ size = packdw(Constants::MAX_KEY_LENGTH)
+ wtime = ' ' * 8
+ check RegEnumKeyExA.call(hkey, index, name, size, 0, 0, 0, wtime)
+ [ name[0, unpackdw(size)], unpackqw(wtime) ]
+ end
+
+ def QueryValue(hkey, name)
+ type = packdw(0)
+ size = packdw(0)
+ check RegQueryValueExA.call(hkey, name, 0, type, 0, size)
+ data = ' ' * unpackdw(size)
+ check RegQueryValueExA.call(hkey, name, 0, type, data, size)
+ [ unpackdw(type), data[0, unpackdw(size)] ]
+ end
+
+ def SetValue(hkey, name, type, data, size)
+ check RegSetValueExA.call(hkey, name, 0, type, data, size)
+ end
+
+ def DeleteValue(hkey, name)
+ check RegDeleteValue.call(hkey, name)
+ end
+
+ def DeleteKey(hkey, name)
+ check RegDeleteKey.call(hkey, name)
+ end
+
+ def FlushKey(hkey)
+ check RegFlushKey.call(hkey)
+ end
+
+ def CloseKey(hkey)
+ check RegCloseKey.call(hkey)
+ end
+
+ def QueryInfoKey(hkey)
+ subkeys = packdw(0)
+ maxsubkeylen = packdw(0)
+ values = packdw(0)
+ maxvaluenamelen = packdw(0)
+ maxvaluelen = packdw(0)
+ secdescs = packdw(0)
+ wtime = ' ' * 8
+ check RegQueryInfoKey.call(hkey, 0, 0, 0, subkeys, maxsubkeylen, 0,
+ values, maxvaluenamelen, maxvaluelen, secdescs, wtime)
+ [ unpackdw(subkeys), unpackdw(maxsubkeylen), unpackdw(values),
+ unpackdw(maxvaluenamelen), unpackdw(maxvaluelen),
+ unpackdw(secdescs), unpackqw(wtime) ]
+ end
+ end
+
+ #
+ # utility functions
+ #
+ def self.expand_environ(str)
+ str.gsub(/%([^%]+)%/) { ENV[$1] || $& }
+ end
+
+ @@type2name = { }
+ %w[
+ REG_NONE REG_SZ REG_EXPAND_SZ REG_BINARY REG_DWORD
+ REG_DWORD_BIG_ENDIAN REG_LINK REG_MULTI_SZ
+ REG_RESOURCE_LIST REG_FULL_RESOURCE_DESCRIPTOR
+ REG_RESOURCE_REQUIREMENTS_LIST REG_QWORD
+ ].each do |type|
+ @@type2name[Constants.const_get(type)] = type
+ end
+
+ def self.type2name(type)
+ @@type2name[type] || type.to_s
+ end
+
+ def self.wtime2time(wtime)
+ Time.at((wtime - 116444736000000000) / 10000000)
+ end
+
+ def self.time2wtime(time)
+ time.to_i * 10000000 + 116444736000000000
+ end
+
+ #
+ # constructors
+ #
+ private_class_method :new
+
+ def self.open(hkey, subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED)
+ subkey = subkey.chomp('\\')
+ newkey = API.OpenKey(hkey.hkey, subkey, opt, desired)
+ obj = new(newkey, hkey, subkey, REG_OPENED_EXISTING_KEY)
+ if block_given?
+ begin
+ yield obj
+ ensure
+ obj.close
+ end
+ else
+ obj
+ end
+ end
+
+ def self.create(hkey, subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVED)
+ newkey, disp = API.CreateKey(hkey.hkey, subkey, opt, desired)
+ obj = new(newkey, hkey, subkey, disp)
+ if block_given?
+ begin
+ yield obj
+ ensure
+ obj.close
+ end
+ else
+ obj
+ end
+ end
+
+ #
+ # finalizer
+ #
+ @@final = proc { |hkey| proc { API.CloseKey(hkey[0]) if hkey[0] } }
+
+ #
+ # initialize
+ #
+ def initialize(hkey, parent, keyname, disposition)
+ @hkey = hkey
+ @parent = parent
+ @keyname = keyname
+ @disposition = disposition
+ @hkeyfinal = [ hkey ]
+ ObjectSpace.define_finalizer self, @@final.call(@hkeyfinal)
+ end
+ attr_reader :hkey, :parent, :keyname, :disposition
+
+ #
+ # attributes
+ #
+ def created?
+ @disposition == REG_CREATED_NEW_KEY
+ end
+
+ def open?
+ !@hkey.nil?
+ end
+
+ def name
+ parent = self
+ name = @keyname
+ while parent = parent.parent
+ name = parent.keyname + '\\' + name
+ end
+ name
+ end
+
+ def inspect
+ "\#<Win32::Registry key=#{name.inspect}>"
+ end
+
+ #
+ # marshalling
+ #
+ def _dump(depth)
+ raise TypeError, "can't dump Win32::Registry"
+ end
+
+ #
+ # open/close
+ #
+ def open(subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED, &blk)
+ self.class.open(self, subkey, desired, opt, &blk)
+ end
+
+ def create(subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVED, &blk)
+ self.class.create(self, subkey, desired, opt, &blk)
+ end
+
+ def close
+ API.CloseKey(@hkey)
+ @hkey = @parent = @keyname = nil
+ @hkeyfinal[0] = nil
+ end
+
+ #
+ # iterator
+ #
+ def each_value
+ index = 0
+ while true
+ begin
+ subkey = API.EnumValue(@hkey, index)
+ rescue Error
+ break
+ end
+ begin
+ type, data = read(subkey)
+ rescue Error
+ next
+ end
+ yield subkey, type, data
+ index += 1
+ end
+ index
+ end
+ alias each each_value
+
+ def each_key
+ index = 0
+ while true
+ begin
+ subkey, wtime = API.EnumKey(@hkey, index)
+ rescue Error
+ break
+ end
+ yield subkey, wtime
+ index += 1
+ end
+ index
+ end
+
+ def keys
+ keys_ary = []
+ each_key { |key,| keys_ary << key }
+ keys_ary
+ end
+
+ #
+ # reader
+ #
+ def read(name, *rtype)
+ type, data = API.QueryValue(@hkey, name)
+ unless rtype.empty? or rtype.include?(type)
+ raise TypeError, "Type mismatch (expect #{rtype.inspect} but #{type} present)"
+ end
+ case type
+ when REG_SZ, REG_EXPAND_SZ
+ [ type, data.chop ]
+ when REG_MULTI_SZ
+ [ type, data.split(/\0/) ]
+ when REG_BINARY
+ [ type, data ]
+ when REG_DWORD
+ [ type, API.unpackdw(data) ]
+ when REG_DWORD_BIG_ENDIAN
+ [ type, data.unpack('N')[0] ]
+ when REG_QWORD
+ [ type, API.unpackqw(data) ]
+ else
+ raise TypeError, "Type #{type} is not supported."
+ end
+ end
+
+ def [](name, *rtype)
+ type, data = read(name, *rtype)
+ case type
+ when REG_SZ, REG_DWORD, REG_QWORD, REG_MULTI_SZ
+ data
+ when REG_EXPAND_SZ
+ Registry.expand_environ(data)
+ else
+ raise TypeError, "Type #{type} is not supported."
+ end
+ end
+
+ def read_s(name)
+ read(name, REG_SZ)[1]
+ end
+
+ def read_s_expand(name)
+ type, data = read(name, REG_SZ, REG_EXPAND_SZ)
+ if type == REG_EXPAND_SZ
+ Registry.expand_environ(data)
+ else
+ data
+ end
+ end
+
+ def read_i(name)
+ read(name, REG_DWORD, REG_DWORD_BIG_ENDIAN, REG_QWORD)[1]
+ end
+
+ def read_bin(name)
+ read(name, REG_BINARY)[1]
+ end
+
+ #
+ # writer
+ #
+ def write(name, type, data)
+ case type
+ when REG_SZ, REG_EXPAND_SZ
+ data = data.to_s + "\0"
+ when REG_MULTI_SZ
+ data = data.to_a.join("\0") + "\0\0"
+ when REG_BINARY
+ data = data.to_s
+ when REG_DWORD
+ data = API.packdw(data.to_i)
+ when REG_DWORD_BIG_ENDIAN
+ data = [data.to_i].pack('N')
+ when REG_QWORD
+ data = API.packqw(data.to_i)
+ else
+ raise TypeError, "Unsupported type #{type}"
+ end
+ API.SetValue(@hkey, name, type, data, data.length)
+ end
+
+ def []=(name, rtype, value = nil)
+ if value
+ write name, rtype, value
+ else
+ case value = rtype
+ when Integer
+ write name, REG_DWORD, value
+ when String
+ write name, REG_SZ, value
+ when Array
+ write name, REG_MULTI_SZ, value
+ else
+ raise TypeError, "Unexpected type #{value.class}"
+ end
+ end
+ value
+ end
+
+ def write_s(name, value)
+ write name, REG_SZ, value.to_s
+ end
+
+ def write_i(name, value)
+ write name, REG_DWORD, value.to_i
+ end
+
+ def write_bin(name, value)
+ write name, REG_BINARY, value.to_s
+ end
+
+ #
+ # delete
+ #
+ def delete_value(name)
+ API.DeleteValue(@hkey, name)
+ end
+ alias delete delete_value
+
+ def delete_key(name, recursive = false)
+ if recursive
+ open(name, KEY_ALL_ACCESS) do |reg|
+ reg.keys.each do |key|
+ begin
+ reg.delete_key(key, true)
+ rescue Error
+ #
+ end
+ end
+ end
+ API.DeleteKey(@hkey, name)
+ else
+ begin
+ API.EnumKey @hkey, 0
+ rescue Error
+ return API.DeleteKey(@hkey, name)
+ end
+ raise Error.new(5) ## ERROR_ACCESS_DENIED
+ end
+ end
+
+ #
+ # flush
+ #
+ def flush
+ API.FlushKey @hkey
+ end
+
+ #
+ # key information
+ #
+ def info
+ API.QueryInfoKey(@hkey)
+ end
+ %w[
+ num_keys max_key_length
+ num_values max_value_name_length max_value_length
+ descriptor_length wtime
+ ].each_with_index do |s, i|
+ eval <<-__END__
+ def #{s}
+ info[#{i}]
+ end
+ __END__
+ end
+ end
+end
diff --git a/ext/Win32API/lib/win32/resolv.rb b/ext/Win32API/lib/win32/resolv.rb
new file mode 100644
index 0000000000..5a99d04d55
--- /dev/null
+++ b/ext/Win32API/lib/win32/resolv.rb
@@ -0,0 +1,366 @@
+=begin
+= Win32 DNS and DHCP I/F
+
+=end
+
+require 'win32/registry'
+
+module Win32
+ module Resolv
+ API = Registry::API
+
+ def self.get_hosts_path
+ path = get_hosts_dir
+ path = File.join(path.gsub(/\\/, File::SEPARATOR), 'hosts')
+ File.exist?(path) ? path : nil
+ end
+
+ def self.get_resolv_info
+ search, nameserver = get_info
+ if search.empty?
+ search = nil
+ else
+ search.delete("")
+ search.uniq!
+ end
+ if nameserver.empty?
+ nameserver = nil
+ else
+ nameserver.delete("")
+ nameserver.delete("0.0.0.0")
+ nameserver.uniq!
+ end
+ [ search, nameserver ]
+ end
+
+getv = Win32API.new('kernel32.dll', 'GetVersionExA', 'P', 'L')
+info = [ 148, 0, 0, 0, 0 ].pack('V5') + "\0" * 128
+getv.call(info)
+if info.unpack('V5')[4] == 2 # VER_PLATFORM_WIN32_NT
+#====================================================================
+# Windows NT
+#====================================================================
+ module_eval <<-'__EOS__', __FILE__, __LINE__+1
+ TCPIP_NT = 'SYSTEM\CurrentControlSet\Services\Tcpip\Parameters'
+
+ class << self
+ private
+ def get_hosts_dir
+ Registry::HKEY_LOCAL_MACHINE.open(TCPIP_NT) do |reg|
+ reg.read_s_expand('DataBasePath')
+ end
+ end
+
+ def get_info
+ search = nil
+ nameserver = []
+ Registry::HKEY_LOCAL_MACHINE.open(TCPIP_NT) do |reg|
+ begin
+ slist = reg.read_s('SearchList')
+ search = slist.split(/,\s*/) unless slist.empty?
+ rescue Registry::Error
+ end
+
+ if add_search = search.nil?
+ search = []
+ begin
+ nvdom = reg.read_s('NV Domain')
+ unless nvdom.empty?
+ @search = [ nvdom ]
+ if reg.read_i('UseDomainNameDevolution') != 0
+ if /^[\w\d]+\./ =~ nvdom
+ devo = $'
+ end
+ end
+ end
+ rescue Registry::Error
+ end
+ end
+
+ reg.open('Interfaces') do |reg|
+ reg.each_key do |iface,|
+ reg.open(iface) do |regif|
+ begin
+ [ 'NameServer', 'DhcpNameServer' ].each do |key|
+ ns = regif.read_s(key)
+ unless ns.empty?
+ nameserver.concat(ns.split(/\s+/))
+ break
+ end
+ end
+ rescue Registry::Error
+ end
+
+ if add_search
+ begin
+ [ 'Domain', 'DhcpDomain' ].each do |key|
+ dom = regif.read_s(key)
+ unless dom.empty?
+ search.concat(dom.split(/,\s*/))
+ break
+ end
+ end
+ rescue Registry::Error
+ end
+ end
+ end
+ end
+ end
+ search << devo if add_search and devo
+ end
+ [ search.uniq, nameserver.uniq ]
+ end
+ end
+ __EOS__
+else
+#====================================================================
+# Windows 9x
+#====================================================================
+ module_eval <<-'__EOS__', __FILE__, __LINE__+1
+ TCPIP_9X = 'SYSTEM\CurrentControlSet\Services\VxD\MSTCP'
+ DHCP_9X = 'SYSTEM\CurrentControlSet\Services\VxD\DHCP'
+ WINDOWS = 'Software\Microsoft\Windows\CurrentVersion'
+
+ class << self
+ # private
+
+ def get_hosts_dir
+ Registry::HKEY_LOCAL_MACHINE.open(WINDOWS) do |reg|
+ reg.read_s_expand('SystemRoot')
+ end
+ end
+
+ def get_info
+ search = []
+ nameserver = []
+ begin
+ Registry::HKEY_LOCAL_MACHINE.open(TCPIP_9X) do |reg|
+ if reg.read_s("EnableDNS") == "1"
+ domain = reg.read_s("Domain")
+ ns = reg.read_s("NameServer")
+ slist = reg.read_s("SearchList")
+ search << domain unless domain.empty?
+ search.concat(slist.split(/,\s*/))
+ nameserver.concat(ns.split(/,\s*/))
+ end
+ end
+ rescue Registry::Error
+ end
+
+ dhcpinfo = get_dhcpinfo
+ search.concat(dhcpinfo[0])
+ nameserver.concat(dhcpinfo[1])
+ [ search, nameserver ]
+ end
+
+ def get_dhcpinfo
+ macaddrs = {}
+ ipaddrs = {}
+ WsControl.get_iflist.each do |index, macaddr, *ipaddr|
+ macaddrs[macaddr] = 1
+ ipaddr.each { |ipaddr| ipaddrs[ipaddr] = 1 }
+ end
+ iflist = [ macaddrs, ipaddrs ]
+
+ search = []
+ nameserver = []
+ version = -1
+ Registry::HKEY_LOCAL_MACHINE.open(DHCP_9X) do |reg|
+ begin
+ version = API.unpackdw(reg.read_bin("Version"))
+ rescue Registry::Error
+ end
+
+ reg.each_key do |key,|
+ catch(:not_used) do
+ reg.open(key) do |regdi|
+ dom, ns = get_dhcpinfo_key(version, regdi, iflist)
+ search << dom if dom
+ nameserver.concat(ns) if ns
+ end
+ end
+ end
+ end
+ [ search, nameserver ]
+ end
+
+ def get_dhcpinfo_95(reg)
+ dhcp = reg.read_bin("DhcpInfo")
+ [
+ API.unpackdw(dhcp[4..7]),
+ API.unpackdw(dhcp[8..11]),
+ 1,
+ dhcp[45..50],
+ reg.read_bin("OptionInfo"),
+ ]
+ end
+
+ def get_dhcpinfo_98(reg)
+ [
+ API.unpackdw(reg.read_bin("DhcpIPAddress")),
+ API.unpackdw(reg.read_bin("DhcpSubnetMask")),
+ API.unpackdw(reg.read_bin("HardwareType")),
+ reg.read_bin("HardwareAddress"),
+ reg.read_bin("OptionInfo"),
+ ]
+ end
+
+ def get_dhcpinfo_key(version, reg, iflist)
+ info = case version
+ when 1
+ get_dhcpinfo_95(reg)
+ when 2
+ get_dhcpinfo_98(reg)
+ else
+ begin
+ get_dhcpinfo_98(reg)
+ rescue Registry::Error
+ get_dhcpinfo_95(reg)
+ end
+ end
+ ipaddr, netmask, hwtype, macaddr, opt = info
+ throw :not_used unless
+ ipaddr and ipaddr != 0 and
+ netmask and netmask != 0 and
+ macaddr and macaddr.size == 6 and
+ hwtype == 1 and
+ iflist[0][macaddr] and iflist[1][ipaddr]
+
+ size = opt.size
+ idx = 0
+ while idx <= size
+ opttype = opt[idx]
+ optsize = opt[idx + 1]
+ optval = opt[idx + 2, optsize]
+ case opttype
+ when 0xFF ## term
+ break
+ when 0x0F ## domain
+ domain = optval.chomp("\0")
+ when 0x06 ## dns
+ nameserver = optval.scan(/..../).collect { |addr|
+ "%d.%d.%d.%d" % addr.unpack('C4')
+ }
+ end
+ idx += optsize + 2
+ end
+ [ domain, nameserver ]
+ rescue Registry::Error
+ throw :not_used
+ end
+ end
+
+ module WsControl
+ WsControl = Win32API.new('wsock32.dll', 'WsControl', 'LLPPPP', 'L')
+ WSAGetLastError = Win32API.new('wsock32.dll', 'WSAGetLastError', 'V', 'L')
+
+ MAX_TDI_ENTITIES = 512
+ IPPROTO_TCP = 6
+ WSCTL_TCP_QUERY_INFORMATION = 0
+ INFO_CLASS_GENERIC = 0x100
+ INFO_CLASS_PROTOCOL = 0x200
+ INFO_TYPE_PROVIDER = 0x100
+ ENTITY_LIST_ID = 0
+ GENERIC_ENTITY = 0
+ CL_NL_ENTITY = 0x301
+ IF_ENTITY = 0x200
+ ENTITY_TYPE_ID = 1
+ CL_NL_IP = 0x303
+ IF_MIB = 0x202
+ IF_MIB_STATS_ID = 1
+ IP_MIB_ADDRTABLE_ENTRY_ID = 0x102
+
+ def self.wsctl(tei_entity, tei_instance,
+ toi_class, toi_type, toi_id,
+ buffsize)
+ reqinfo = [
+ ## TDIEntityID
+ tei_entity, tei_instance,
+ ## TDIObjectID
+ toi_class, toi_type, toi_id,
+ ## TCP_REQUEST_INFORMATION_EX
+ ""
+ ].pack('VVVVVa16')
+ reqsize = API.packdw(reqinfo.size)
+ buff = "\0" * buffsize
+ buffsize = API.packdw(buffsize)
+ result = WsControl.call(
+ IPPROTO_TCP,
+ WSCTL_TCP_QUERY_INFORMATION,
+ reqinfo, reqsize,
+ buff, buffsize)
+ if result != 0
+ raise RuntimeError, "WsControl failed.(#{result})"
+ end
+ [ buff, API.unpackdw(buffsize) ]
+ end
+ private_class_method :wsctl
+
+ def self.get_iflist
+ # Get TDI Entity List
+ entities, size =
+ wsctl(GENERIC_ENTITY, 0,
+ INFO_CLASS_GENERIC,
+ INFO_TYPE_PROVIDER,
+ ENTITY_LIST_ID,
+ MAX_TDI_ENTITIES * 8) # sizeof(TDIEntityID)
+ entities = entities[0, size].
+ scan(/.{8}/).
+ collect { |e| e.unpack('VV') }
+
+ # Get MIB Interface List
+ iflist = []
+ ifcount = 0
+ entities.each do |entity, instance|
+ if( (entity & IF_ENTITY)>0 )
+ ifcount += 1
+ etype, = wsctl(entity, instance,
+ INFO_CLASS_GENERIC,
+ INFO_TYPE_PROVIDER,
+ ENTITY_TYPE_ID,
+ 4)
+ if( (API.unpackdw(etype) & IF_MIB)==IF_MIB )
+ ifentry, = wsctl(entity, instance,
+ INFO_CLASS_PROTOCOL,
+ INFO_TYPE_PROVIDER,
+ IF_MIB_STATS_ID,
+ 21 * 4 + 8 + 130) # sizeof(IFEntry)
+ iflist << [
+ API.unpackdw(ifentry[0,4]),
+ ifentry[20, 6]
+ ]
+ end
+ end
+ end
+
+ # Get IP Addresses
+ entities.each do |entity, instance|
+ if entity == CL_NL_ENTITY
+ etype, = wsctl(entity, instance,
+ INFO_CLASS_GENERIC,
+ INFO_TYPE_PROVIDER,
+ ENTITY_TYPE_ID,
+ 4)
+ if API.unpackdw(etype) == CL_NL_IP
+ ipentries, = wsctl(entity, instance,
+ INFO_CLASS_PROTOCOL,
+ INFO_TYPE_PROVIDER,
+ IP_MIB_ADDRTABLE_ENTRY_ID,
+ 24 * (ifcount+1)) # sizeof(IPAddrEntry)
+ ipentries.scan(/.{24}/) do |ipentry|
+ ipaddr, index = ipentry.unpack('VV')
+ if ifitem = iflist.assoc(index)
+ ifitem << ipaddr
+ end
+ end
+ end
+ end
+ end
+ iflist
+ end
+ end
+ __EOS__
+end
+#====================================================================
+ end
+end
diff --git a/ext/aix_ld.rb b/ext/aix_ld.rb
deleted file mode 100644
index 42b2087a46..0000000000
--- a/ext/aix_ld.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-#! /usr/local/bin/ruby
-
-def older(file1, file2)
- if !File.exist?(file1) then
- return TRUE
- end
- if !File.exist?(file2) then
- return FALSE
- end
- if File.mtime(file1) < File.mtime(file2)
- return TRUE
- end
- return FALSE
-end
-
-target = ARGV.shift
-unless target =~ /\.so/
- STDERR.printf "wrong suffix specified\n"
- exit 1
-end
-base = File.basename(target, ".so")
-entry="Init_#{base}"
-ldargs = "-e#{entry} -bI:../ruby.imp -bM:SRE -T512 -H512 -lc"
-
-def uniq(data)
- last=nil
- data.delete_if do |name|
- if last == name
- TRUE
- else
- last = name
- FALSE
- end
- end
-end
-
-def extract(nm, out)
- data = nm.readlines.collect{|line|
- line = line.split
- case line[1]
- when "B", "D", "T"
- line[2]
- else
- next
- end
- }.compact!.sort!
- uniq(data)
- exp = open(out, "w")
- for line in data
- exp.printf "%s\n", line
- end
- exp.close
- nm.close
-end
-if older("../ruby.imp", "../../miniruby")
-# nm = open("|/usr/ccs/bin/nm -Bex ../../*.o")
-# nm = open("|/usr/ccs/bin/nm -Bex ../../*.o")
- nm = open("|nm ../../*.o")
- extract(nm, "../ruby.imp")
-end
-
-objs = Dir["*.o"].join(" ")
-#nm = open("|/usr/ccs/bin/nm -Bex #{objs}")
-nm = open("|nm #{objs}")
-extract(nm, "#{base}.exp")
-
-#system format("/usr/ccs/bin/ld %s %s ",ldargs,ARGV.join(' '))
-#system "/bin/rm -f #{base}.exp"
-#system "chmod o-rwx ${base}.so"
-
-p format("/usr/ccs/bin/ld %s %s ",ldargs,ARGV.join(' '))
-p "/bin/rm -f #{base}.exp"
-p "chmod o-rwx ${base}.so"
diff --git a/ext/bigdecimal/.cvsignore b/ext/bigdecimal/.cvsignore
new file mode 100644
index 0000000000..4088712231
--- /dev/null
+++ b/ext/bigdecimal/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+mkmf.log
+*.def
diff --git a/ext/bigdecimal/README b/ext/bigdecimal/README
new file mode 100644
index 0000000000..a233f47f64
--- /dev/null
+++ b/ext/bigdecimal/README
@@ -0,0 +1,60 @@
+
+ Ruby BIGDECIMAL(Variable Precision) extension library.
+ Copyright (C) 1999 by Shigeo Kobayashi(shigeo@tinyforest.gr.jp)
+
+BigDecimal is copyrighted free software by Shigeo Kobayashi <shigeo@tinyforest.gr.jp>.
+You can redistribute it and/or modify it under either the terms of the GPL
+(see COPYING file), or the conditions below:
+
+ 1. You may make and give away verbatim copies of the source form of the
+ software without restriction, provided that you duplicate all of the
+ original copyright notices and associated disclaimers.
+
+ 2. You may modify your copy of the software in any way, provided that
+ you do at least ONE of the following:
+
+ a) place your modifications in the Public Domain or otherwise
+ make them Freely Available, such as by posting said
+ modifications to Usenet or an equivalent medium, or by allowing
+ the author to include your modifications in the software.
+
+ b) use the modified software only within your corporation or
+ organization.
+
+ c) rename any non-standard executables so the names do not conflict
+ with standard executables, which must also be provided.
+
+ d) make other distribution arrangements with the author.
+
+ 3. You may distribute the software in object code or executable
+ form, provided that you do at least ONE of the following:
+
+ a) distribute the executables and library files of the software,
+ together with instructions (in the manual page or equivalent)
+ on where to get the original distribution.
+
+ b) accompany the distribution with the machine-readable source of
+ the software.
+
+ c) give non-standard executables non-standard names, with
+ instructions on where to get the original software distribution.
+
+ d) make other distribution arrangements with the author.
+
+ 4. You may modify and include the part of the software into any other
+ software (possibly commercial).
+
+ 5. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE.
+
+* The Author
+
+Feel free to send comments and bug reports to the author. Here is the
+author's latest mail address:
+
+ shigeo@tinyforest.gr.jp
+
+-------------------------------------------------------
+created at: Thu Dec 22 1999
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
new file mode 100644
index 0000000000..4ccba8809a
--- /dev/null
+++ b/ext/bigdecimal/bigdecimal.c
@@ -0,0 +1,4057 @@
+/*
+ *
+ * Ruby BigDecimal(Variable decimal precision) extension library.
+ *
+ * Copyright(C) 2002 by Shigeo Kobayashi(shigeo@tinyforest.gr.jp)
+ *
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Artistic License, as specified in the README file
+ * of this BigDecimal distribution.
+ *
+ * NOTE: Change log in this source removed to reduce source code size.
+ * See rev. 1.25 if needed.
+ *
+ */
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <float.h>
+#include <math.h>
+#include "ruby.h"
+#include "math.h"
+#include "version.h"
+
+/* #define ENABLE_NUMERIC_STRING */
+
+VALUE rb_cBigDecimal;
+
+#include "bigdecimal.h"
+
+/* MACRO's to guard objects from GC by keeping them in stack */
+#define ENTER(n) volatile VALUE vStack[n];int iStack=0
+#define PUSH(x) vStack[iStack++] = (unsigned long)(x);
+#define SAVE(p) PUSH(p->obj);
+#define GUARD_OBJ(p,y) {p=y;SAVE(p);}
+
+/*
+ * ================== Ruby Interface part ==========================
+ */
+#define DoSomeOne(x,y) rb_num_coerce_bin(x,y)
+
+/*
+ * **** BigDecimal version ****
+ */
+static VALUE
+BigDecimal_version(VALUE self)
+{
+ /*
+ * 1.0.0: Ruby 1.8.0
+ * 1.0.1: Ruby 1.8.1
+ */
+ return rb_str_new2("1.0.1");
+}
+
+/*
+ * VP routines used in BigDecimal part
+ */
+static unsigned short VpGetException(void);
+static void VpSetException(unsigned short f);
+static void VpInternalRound(Real *c,int ixDigit,U_LONG vPrev,U_LONG v);
+static int VpLimitRound(Real *c,U_LONG ixDigit);
+
+/*
+ * **** BigDecimal part ****
+ */
+
+static void
+BigDecimal_delete(Real *pv)
+{
+ VpFree(pv);
+}
+
+static VALUE
+ToValue(Real *p)
+{
+ if(VpIsNaN(p)) {
+ VpException(VP_EXCEPTION_NaN,"Computation results to 'NaN'(Not a Number)",0);
+ } else if(VpIsPosInf(p)) {
+ VpException(VP_EXCEPTION_INFINITY,"Computation results to 'Infinity'",0);
+ } else if(VpIsNegInf(p)) {
+ VpException(VP_EXCEPTION_INFINITY,"Computation results to '-Infinity'",0);
+ }
+ return p->obj;
+}
+
+static Real *
+GetVpValue(VALUE v, int must)
+{
+ Real *pv;
+ VALUE bg;
+ char szD[128];
+
+ switch(TYPE(v))
+ {
+ case T_DATA:
+ if(RDATA(v)->dfree ==(void *) BigDecimal_delete) {
+ Data_Get_Struct(v, Real, pv);
+ return pv;
+ } else {
+ goto SomeOneMayDoIt;
+ }
+ break;
+ case T_FIXNUM:
+ sprintf(szD, "%ld", FIX2LONG(v));
+ return VpCreateRbObject(VpBaseFig() * 2 + 1, szD);
+
+#ifdef ENABLE_NUMERIC_STRING
+ case T_STRING:
+ SafeStringValue(v);
+ return VpCreateRbObject(strlen(RSTRING(v)->ptr) + VpBaseFig() + 1,
+ RSTRING(v)->ptr);
+#endif /* ENABLE_NUMERIC_STRING */
+
+ case T_BIGNUM:
+ bg = rb_big2str(v, 10);
+ return VpCreateRbObject(strlen(RSTRING(bg)->ptr) + VpBaseFig() + 1,
+ RSTRING(bg)->ptr);
+ default:
+ goto SomeOneMayDoIt;
+ }
+
+SomeOneMayDoIt:
+ if(must) {
+ rb_raise(rb_eTypeError, "%s can't be coerced into BigDecimal",
+ rb_special_const_p(v)?
+ RSTRING(rb_inspect(v))->ptr:
+ rb_obj_classname(v)
+ );
+ }
+ return NULL; /* NULL means to coerce */
+}
+
+static VALUE
+BigDecimal_double_fig(VALUE self)
+{
+ return INT2FIX(VpDblFig());
+}
+
+static VALUE
+BigDecimal_prec(VALUE self)
+{
+ ENTER(1);
+ Real *p;
+ VALUE obj;
+
+ GUARD_OBJ(p,GetVpValue(self,1));
+ obj = rb_assoc_new(INT2NUM(p->Prec*VpBaseFig()),
+ INT2NUM(p->MaxPrec*VpBaseFig()));
+ return obj;
+}
+
+static VALUE
+BigDecimal_hash(VALUE self)
+{
+ ENTER(1);
+ Real *p;
+ U_LONG hash,i;
+
+ GUARD_OBJ(p,GetVpValue(self,1));
+ hash = (U_LONG)p->sign;
+ /* hash!=2: the case for 0(1),NaN(0) or +-Infinity(3) is sign itself */
+ if(hash==2) {
+ for(i = 0; i < p->Prec;i++) {
+ hash = 31 * hash + p->frac[i];
+ hash ^= p->frac[i];
+ }
+ hash += p->exponent;
+ }
+ return INT2FIX(hash);
+}
+
+static VALUE
+BigDecimal_dump(int argc, VALUE *argv, VALUE self)
+{
+ ENTER(5);
+ char sz[50];
+ Real *vp;
+ char *psz;
+ VALUE dummy;
+ rb_scan_args(argc, argv, "01", &dummy);
+ GUARD_OBJ(vp,GetVpValue(self,1));
+ sprintf(sz,"%lu:",VpMaxPrec(vp)*VpBaseFig());
+ psz = ALLOCA_N(char,(unsigned int)VpNumOfChars(vp,"E")+strlen(sz));
+ sprintf(psz,"%s",sz);
+ VpToString(vp, psz+strlen(psz), 0, 0);
+ return rb_str_new2(psz);
+}
+
+static VALUE
+BigDecimal_load(VALUE self, VALUE str)
+{
+ ENTER(2);
+ Real *pv;
+ unsigned char *pch;
+ unsigned char ch;
+ unsigned long m=0;
+
+ SafeStringValue(str);
+ pch = RSTRING(str)->ptr;
+ /* First get max prec */
+ while((*pch)!=(unsigned char)'\0' && (ch=*pch++)!=(unsigned char)':') {
+ if(!ISDIGIT(ch)) {
+ rb_raise(rb_eTypeError, "Load failed: invalid character in the marshaled string");
+ }
+ m = m*10 + (unsigned long)(ch-'0');
+ }
+ if(m>VpBaseFig()) m -= VpBaseFig();
+ GUARD_OBJ(pv,VpNewRbClass(m,pch,self));
+ m /= VpBaseFig();
+ if(m && pv->MaxPrec>m) pv->MaxPrec = m+1;
+ return ToValue(pv);
+}
+
+static VALUE
+BigDecimal_mode(int argc, VALUE *argv, VALUE self)
+{
+ VALUE which;
+ VALUE val;
+ unsigned long f,fo;
+
+ if(rb_scan_args(argc,argv,"11",&which,&val)==1) val = Qnil;
+
+ Check_Type(which, T_FIXNUM);
+ f = (unsigned long)FIX2INT(which);
+
+ if(f&VP_EXCEPTION_ALL) {
+ /* Exception mode setting */
+ fo = VpGetException();
+ if(val==Qnil) return INT2FIX(fo);
+ if(val!=Qfalse && val!=Qtrue) {
+ rb_raise(rb_eTypeError, "The second argument must be true or false.");
+ return Qnil; /* Not reached */
+ }
+ if(f&VP_EXCEPTION_INFINITY) {
+ VpSetException((unsigned short)((val==Qtrue)?(fo|VP_EXCEPTION_INFINITY):
+ (fo&(~VP_EXCEPTION_INFINITY))));
+ }
+ if(f&VP_EXCEPTION_NaN) {
+ VpSetException((unsigned short)((val==Qtrue)?(fo|VP_EXCEPTION_NaN):
+ (fo&(~VP_EXCEPTION_NaN))));
+ }
+ fo = VpGetException();
+ return INT2FIX(fo);
+ }
+ if(VP_ROUND_MODE==f) {
+ /* Rounding mode setting */
+ fo = VpGetRoundMode();
+ if(val==Qnil) return INT2FIX(fo);
+ Check_Type(val, T_FIXNUM);
+ if(!VpIsRoundMode(FIX2INT(val))) {
+ rb_raise(rb_eTypeError, "Invalid rounding mode.");
+ return Qnil;
+ }
+ fo = VpSetRoundMode((unsigned long)FIX2INT(val));
+ return INT2FIX(fo);
+ }
+ rb_raise(rb_eTypeError, "The first argument for BigDecimal#mode is invalid.");
+ return Qnil;
+}
+
+static U_LONG
+GetAddSubPrec(Real *a, Real *b)
+{
+ U_LONG mxs;
+ U_LONG mx = a->Prec;
+ S_INT d;
+
+ if(!VpIsDef(a) || !VpIsDef(b)) return (-1L);
+ if(mx < b->Prec) mx = b->Prec;
+ if(a->exponent!=b->exponent) {
+ mxs = mx;
+ d = a->exponent - b->exponent;
+ if(d<0) d = -d;
+ mx = mx+(U_LONG)d;
+ if(mx<mxs) {
+ return VpException(VP_EXCEPTION_INFINITY,"Exponent overflow",0);
+ }
+ }
+ return mx;
+}
+
+static S_INT
+GetPositiveInt(VALUE v)
+{
+ S_INT n;
+ Check_Type(v, T_FIXNUM);
+ n = FIX2INT(v);
+ if(n < 0) {
+ rb_raise(rb_eArgError, "argument must be positive");
+ }
+ return n;
+}
+
+VP_EXPORT Real *
+VpNewRbClass(U_LONG mx, char *str, VALUE klass)
+{
+ Real *pv = VpAlloc(mx,str);
+ pv->obj = (VALUE)Data_Wrap_Struct(klass, 0, BigDecimal_delete, pv);
+ return pv;
+}
+
+VP_EXPORT Real *
+VpCreateRbObject(U_LONG mx, char *str)
+{
+ Real *pv = VpAlloc(mx,str);
+ pv->obj = (VALUE)Data_Wrap_Struct(rb_cBigDecimal, 0, BigDecimal_delete, pv);
+ return pv;
+}
+
+
+static VALUE
+BigDecimal_IsNaN(VALUE self)
+{
+ Real *p = GetVpValue(self,1);
+ if(VpIsNaN(p)) return Qtrue;
+ return Qfalse;
+}
+
+static VALUE
+BigDecimal_IsInfinite(VALUE self)
+{
+ Real *p = GetVpValue(self,1);
+ if(VpIsPosInf(p)) return INT2FIX(1);
+ if(VpIsNegInf(p)) return INT2FIX(-1);
+ return Qnil;
+}
+
+static VALUE
+BigDecimal_IsFinite(VALUE self)
+{
+ Real *p = GetVpValue(self,1);
+ if(VpIsNaN(p)) return Qfalse;
+ if(VpIsInf(p)) return Qfalse;
+ return Qtrue;
+}
+
+static VALUE
+BigDecimal_to_i(VALUE self)
+{
+ ENTER(5);
+ int e,n,i,nf;
+ U_LONG v,b,j;
+ char *psz,*pch;
+ Real *p;
+
+ GUARD_OBJ(p,GetVpValue(self,1));
+
+ /* Infinity or NaN not converted. */
+ if(VpIsNaN(p)) {
+ VpException(VP_EXCEPTION_NaN,"Computation results to 'NaN'(Not a Number)",0);
+ return Qnil;
+ } else if(VpIsPosInf(p)) {
+ VpException(VP_EXCEPTION_INFINITY,"Computation results to 'Infinity'",0);
+ return Qnil;
+ } else if(VpIsNegInf(p)) {
+ VpException(VP_EXCEPTION_INFINITY,"Computation results to '-Infinity'",0);
+ return Qnil;
+ }
+
+ e = VpExponent10(p);
+ if(e<=0) return INT2FIX(0);
+ nf = VpBaseFig();
+ if(e<=nf) {
+ e = VpGetSign(p)*p->frac[0];
+ return INT2FIX(e);
+ }
+ psz = ALLOCA_N(char,(unsigned int)(e+nf+2));
+
+ n = (e+nf-1)/nf;
+ pch = psz;
+ if(VpGetSign(p)<0) *pch++ = '-';
+ for(i=0;i<n;++i) {
+ b = VpBaseVal()/10;
+ if(i>=(int)p->Prec) {
+ while(b) {
+ *pch++ = '0';
+ b /= 10;
+ }
+ continue;
+ }
+ v = p->frac[i];
+ while(b) {
+ j = v/b;
+ *pch++ = (char)(j + '0');
+ v -= j*b;
+ b /= 10;
+ }
+ }
+ *pch++ = 0;
+ return rb_cstr2inum(psz,10);
+}
+
+static VALUE
+BigDecimal_induced_from(VALUE self, VALUE x)
+{
+ Real *p = GetVpValue(x,1);
+ return p->obj;
+}
+
+static VALUE
+BigDecimal_to_f(VALUE self)
+{
+ ENTER(1);
+ Real *p;
+ double d, d2;
+ S_LONG e;
+
+ GUARD_OBJ(p,GetVpValue(self,1));
+ if(VpVtoD(&d, &e, p)!=1) return rb_float_new(d);
+ errno = 0;
+ d2 = pow(10.0,(double)e);
+ if((errno == ERANGE && e>0) || (d2>1.0 && (fabs(d) > (DBL_MAX / d2)))) {
+ 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);
+}
+
+static VALUE
+BigDecimal_coerce(VALUE self, VALUE other)
+{
+ ENTER(2);
+ VALUE obj;
+ Real *b;
+ if(TYPE(other) == T_FLOAT) {
+ obj = rb_assoc_new(other, BigDecimal_to_f(self));
+ } else {
+ GUARD_OBJ(b,GetVpValue(other,1));
+ obj = rb_assoc_new(b->obj, self);
+ }
+ return obj;
+}
+
+static VALUE
+BigDecimal_uplus(VALUE self)
+{
+ return self;
+}
+
+static VALUE
+BigDecimal_add(VALUE self, VALUE r)
+{
+ ENTER(5);
+ Real *c, *a, *b;
+ U_LONG mx;
+ GUARD_OBJ(a,GetVpValue(self,1));
+ b = GetVpValue(r,0);
+ if(!b) return DoSomeOne(self,r);
+ SAVE(b);
+ if(VpIsNaN(b)) return b->obj;
+ if(VpIsNaN(a)) return a->obj;
+ mx = GetAddSubPrec(a,b);
+ if(mx==(-1L)) {
+ GUARD_OBJ(c,VpCreateRbObject(VpBaseFig() + 1, "0"));
+ VpAddSub(c, a, b, 1);
+ } else {
+ GUARD_OBJ(c,VpCreateRbObject(mx *(VpBaseFig() + 1), "0"));
+ if(!mx) {
+ VpSetInf(c,VpGetSign(a));
+ } else {
+ VpAddSub(c, a, b, 1);
+ }
+ }
+ return ToValue(c);
+}
+
+static VALUE
+BigDecimal_sub(VALUE self, VALUE r)
+{
+ ENTER(5);
+ Real *c, *a, *b;
+ U_LONG mx;
+
+ GUARD_OBJ(a,GetVpValue(self,1));
+ b = GetVpValue(r,0);
+ if(!b) return DoSomeOne(self,r);
+ SAVE(b);
+
+ if(VpIsNaN(b)) return b->obj;
+ if(VpIsNaN(a)) return a->obj;
+
+ mx = GetAddSubPrec(a,b);
+ if(mx==(-1L)) {
+ GUARD_OBJ(c,VpCreateRbObject(VpBaseFig() + 1, "0"));
+ VpAddSub(c, a, b, -1);
+ } else {
+ GUARD_OBJ(c,VpCreateRbObject(mx *(VpBaseFig() + 1), "0"));
+ if(!mx) {
+ VpSetInf(c,VpGetSign(a));
+ } else {
+ VpAddSub(c, a, b, -1);
+ }
+ }
+ return ToValue(c);
+}
+
+static VALUE
+BigDecimalCmp(VALUE self, VALUE r,char op)
+{
+ ENTER(5);
+ S_INT e;
+ Real *a, *b;
+ GUARD_OBJ(a,GetVpValue(self,1));
+ b = GetVpValue(r,0);
+ if(!b) return rb_num_coerce_cmp(self,r);
+ SAVE(b);
+ e = VpComp(a, b);
+ if(e==999) return Qnil;
+ switch(op)
+ {
+ case '*': return INT2FIX(e); /* any op */
+ case '=': if(e==0) return Qtrue ; return Qfalse;
+ case '!': if(e!=0) return Qtrue ; return Qfalse;
+ case 'G': if(e>=0) return Qtrue ; return Qfalse;
+ case '>': if(e> 0) return Qtrue ; return Qfalse;
+ case 'L': if(e<=0) return Qtrue ; return Qfalse;
+ case '<': if(e< 0) return Qtrue ; return Qfalse;
+ }
+ rb_bug("Undefined operation in BigDecimalCmp()");
+}
+
+static VALUE
+BigDecimal_zero(VALUE self)
+{
+ Real *a = GetVpValue(self,1);
+ return VpIsZero(a) ? Qtrue : Qfalse;
+}
+
+static VALUE
+BigDecimal_nonzero(VALUE self)
+{
+ Real *a = GetVpValue(self,1);
+ return VpIsZero(a) ? Qnil : self;
+}
+
+static VALUE
+BigDecimal_comp(VALUE self, VALUE r)
+{
+ return BigDecimalCmp(self, r, '*');
+}
+
+static VALUE
+BigDecimal_eq(VALUE self, VALUE r)
+{
+ return BigDecimalCmp(self, r, '=');
+}
+
+static VALUE
+BigDecimal_ne(VALUE self, VALUE r)
+{
+ return BigDecimalCmp(self, r, '!');
+}
+
+static VALUE
+BigDecimal_lt(VALUE self, VALUE r)
+{
+ return BigDecimalCmp(self, r, '<');
+}
+
+static VALUE
+BigDecimal_le(VALUE self, VALUE r)
+{
+ return BigDecimalCmp(self, r, 'L');
+}
+
+static VALUE
+BigDecimal_gt(VALUE self, VALUE r)
+{
+ return BigDecimalCmp(self, r, '>');
+}
+
+static VALUE
+BigDecimal_ge(VALUE self, VALUE r)
+{
+ return BigDecimalCmp(self, r, 'G');
+}
+
+static VALUE
+BigDecimal_neg(VALUE self)
+{
+ ENTER(5);
+ Real *c, *a;
+ GUARD_OBJ(a,GetVpValue(self,1));
+ GUARD_OBJ(c,VpCreateRbObject(a->Prec *(VpBaseFig() + 1), "0"));
+ VpAsgn(c, a, -1);
+ return ToValue(c);
+}
+
+static VALUE
+BigDecimal_mult(VALUE self, VALUE r)
+{
+ ENTER(5);
+ Real *c, *a, *b;
+ U_LONG mx;
+
+ GUARD_OBJ(a,GetVpValue(self,1));
+ b = GetVpValue(r,0);
+ if(!b) return DoSomeOne(self,r);
+ SAVE(b);
+
+ mx = a->Prec + b->Prec;
+ GUARD_OBJ(c,VpCreateRbObject(mx *(VpBaseFig() + 1), "0"));
+ VpMult(c, a, b);
+ return ToValue(c);
+}
+
+static VALUE
+BigDecimal_divide(Real **c, Real **res, Real **div, VALUE self, VALUE r)
+/* For c = self.div(r): with round operation */
+{
+ ENTER(5);
+ Real *a, *b;
+ U_LONG mx;
+
+ GUARD_OBJ(a,GetVpValue(self,1));
+ b = GetVpValue(r,0);
+ if(!b) return DoSomeOne(self,r);
+ SAVE(b);
+ *div = b;
+ mx =(a->MaxPrec + b->MaxPrec + 1) * VpBaseFig();
+ GUARD_OBJ((*c),VpCreateRbObject(mx, "#0"));
+ GUARD_OBJ((*res),VpCreateRbObject((mx+1) * 2 +(VpBaseFig() + 1), "#0"));
+ VpDivd(*c, *res, a, b);
+ return (VALUE)0;
+}
+
+static VALUE
+BigDecimal_div(VALUE self, VALUE r)
+/* For c = self/r: with round operation */
+{
+ ENTER(5);
+ Real *c=NULL, *res=NULL, *div = NULL;
+ r = BigDecimal_divide(&c, &res, &div, self, r);
+ if(r!=(VALUE)0) return r; /* coerced by other */
+ SAVE(c);SAVE(res);SAVE(div);
+ /* a/b = c + r/b */
+ /* c xxxxx
+ r 00000yyyyy ==> (y/b)*BASE >= HALF_BASE
+ */
+ /* Round */
+ if(VpHasVal(div)) { /* frac[0] must be zero for NaN,INF,Zero */
+ VpInternalRound(c,0,c->frac[c->Prec-1],(VpBaseVal()*res->frac[0])/div->frac[0]);
+ }
+ return ToValue(c);
+}
+
+/*
+ * %: mod = a%b = a - (a.to_f/b).floor * b
+ * div = (a.to_f/b).floor
+ */
+static VALUE
+BigDecimal_DoDivmod(VALUE self, VALUE r, Real **div, Real **mod)
+{
+ ENTER(8);
+ Real *c=NULL, *d=NULL, *res=NULL;
+ Real *a, *b;
+ U_LONG mx;
+
+ GUARD_OBJ(a,GetVpValue(self,1));
+ b = GetVpValue(r,0);
+ if(!b) return DoSomeOne(self,r);
+ SAVE(b);
+
+ if(VpIsNaN(a) || VpIsNaN(b)) goto NaN;
+ if(VpIsInf(a) || VpIsInf(b)) goto NaN;
+ if(VpIsZero(b)) goto NaN;
+ if(VpIsZero(a)) {
+ GUARD_OBJ(c,VpCreateRbObject(1, "0"));
+ GUARD_OBJ(d,VpCreateRbObject(1, "0"));
+ *div = d;
+ *mod = c;
+ return (VALUE)0;
+ }
+
+ mx = a->Prec;
+ if(mx<b->Prec) mx = b->Prec;
+ mx =(mx + 1) * VpBaseFig();
+ GUARD_OBJ(c,VpCreateRbObject(mx, "0"));
+ GUARD_OBJ(res,VpCreateRbObject((mx+1) * 2 +(VpBaseFig() + 1), "#0"));
+ VpDivd(c, res, a, b);
+ mx = c->Prec *(VpBaseFig() + 1);
+ GUARD_OBJ(d,VpCreateRbObject(mx, "0"));
+ VpActiveRound(d,c,VP_ROUND_DOWN,0);
+ VpMult(res,d,b);
+ VpAddSub(c,a,res,-1);
+ if(!VpIsZero(c) && (VpGetSign(a)*VpGetSign(b)<0)) {
+ VpAddSub(res,d,VpOne(),-1);
+ VpAddSub(d ,c,b, 1);
+ *div = res;
+ *mod = d;
+ } else {
+ *div = d;
+ *mod = c;
+ }
+ return (VALUE)0;
+
+NaN:
+ GUARD_OBJ(c,VpCreateRbObject(1, "NaN"));
+ GUARD_OBJ(d,VpCreateRbObject(1, "NaN"));
+ *div = d;
+ *mod = c;
+ return (VALUE)0;
+}
+
+static VALUE
+BigDecimal_mod(VALUE self, VALUE r) /* %: a%b = a - (a.to_f/b).floor * b */
+{
+ ENTER(3);
+ VALUE obj;
+ Real *div=NULL, *mod=NULL;
+
+ obj = BigDecimal_DoDivmod(self,r,&div,&mod);
+ if(obj!=(VALUE)0) return obj;
+ SAVE(div);SAVE(mod);
+ return ToValue(mod);
+}
+
+static VALUE
+BigDecimal_divremain(VALUE self, VALUE r, Real **dv, Real **rv)
+{
+ ENTER(10);
+ U_LONG mx;
+ Real *a=NULL, *b=NULL, *c=NULL, *res=NULL, *d=NULL, *rr=NULL, *ff=NULL;
+ Real *f=NULL;
+
+ GUARD_OBJ(a,GetVpValue(self,1));
+ b = GetVpValue(r,0);
+ if(!b) return DoSomeOne(self,r);
+ SAVE(b);
+
+ mx =(a->MaxPrec + b->MaxPrec) *VpBaseFig();
+ GUARD_OBJ(c ,VpCreateRbObject(mx, "0"));
+ GUARD_OBJ(res,VpCreateRbObject((mx+1) * 2 +(VpBaseFig() + 1), "#0"));
+ GUARD_OBJ(rr ,VpCreateRbObject((mx+1) * 2 +(VpBaseFig() + 1), "#0"));
+ GUARD_OBJ(ff ,VpCreateRbObject((mx+1) * 2 +(VpBaseFig() + 1), "#0"));
+
+ VpDivd(c, res, a, b);
+
+ mx = c->Prec *(VpBaseFig() + 1);
+
+ GUARD_OBJ(d,VpCreateRbObject(mx, "0"));
+ GUARD_OBJ(f,VpCreateRbObject(mx, "0"));
+
+ VpActiveRound(d,c,VP_ROUND_DOWN,0); /* 0: round off */
+
+ VpFrac(f, c);
+ VpMult(rr,f,b);
+ VpAddSub(ff,res,rr,1);
+
+ *dv = d;
+ *rv = ff;
+ return (VALUE)0;
+}
+
+static VALUE
+BigDecimal_remainder(VALUE self, VALUE r) /* remainder */
+{
+ VALUE f;
+ Real *d,*rv;
+ f = BigDecimal_divremain(self,r,&d,&rv);
+ if(f!=(VALUE)0) return f;
+ return ToValue(rv);
+}
+
+static VALUE
+BigDecimal_divmod(VALUE self, VALUE r)
+{
+ ENTER(5);
+ VALUE obj;
+ Real *div=NULL, *mod=NULL;
+
+ obj = BigDecimal_DoDivmod(self,r,&div,&mod);
+ if(obj!=(VALUE)0) return obj;
+ SAVE(div);SAVE(mod);
+ obj = rb_assoc_new(ToValue(div), ToValue(mod));
+ return obj;
+}
+
+static VALUE
+BigDecimal_div2(int argc, VALUE *argv, VALUE self)
+{
+ ENTER(5);
+ VALUE b,n;
+ int na = rb_scan_args(argc,argv,"11",&b,&n);
+ if(na==1) { /* div in Float sense */
+ VALUE obj;
+ Real *div=NULL;
+ Real *mod;
+ obj = BigDecimal_DoDivmod(self,b,&div,&mod);
+ if(obj!=(VALUE)0) return obj;
+ return ToValue(div);
+ } else { /* div in BigDecimal sense */
+ U_LONG ix = (U_LONG)GetPositiveInt(n);
+ if(ix==0) return BigDecimal_div(self,b);
+ else {
+ Real *res=NULL;
+ Real *av=NULL, *bv=NULL, *cv=NULL;
+ U_LONG mx = (ix+VpBaseFig()*2);
+ U_LONG pl = VpSetPrecLimit(0);
+
+ GUARD_OBJ(cv,VpCreateRbObject(mx,"0"));
+ GUARD_OBJ(av,GetVpValue(self,1));
+ GUARD_OBJ(bv,GetVpValue(b,1));
+ mx = av->Prec + bv->Prec + 2;
+ if(mx <= cv->MaxPrec) mx = cv->MaxPrec+1;
+ GUARD_OBJ(res,VpCreateRbObject((mx * 2 + 2)*VpBaseFig(), "#0"));
+ VpDivd(cv,res,av,bv);
+ VpSetPrecLimit(pl);
+ VpLeftRound(cv,VpGetRoundMode(),ix);
+ return ToValue(cv);
+ }
+ }
+}
+
+static VALUE
+BigDecimal_add2(VALUE self, VALUE b, VALUE n)
+{
+ ENTER(2);
+ Real *cv;
+ U_LONG mx = (U_LONG)GetPositiveInt(n);
+ if(mx==0) return BigDecimal_add(self,b);
+ else {
+ U_LONG pl = VpSetPrecLimit(0);
+ VALUE c = BigDecimal_add(self,b);
+ VpSetPrecLimit(pl);
+ GUARD_OBJ(cv,GetVpValue(c,1));
+ VpLeftRound(cv,VpGetRoundMode(),mx);
+ return ToValue(cv);
+ }
+}
+
+static VALUE
+BigDecimal_sub2(VALUE self, VALUE b, VALUE n)
+{
+ ENTER(2);
+ Real *cv;
+ U_LONG mx = (U_LONG)GetPositiveInt(n);
+ if(mx==0) return BigDecimal_sub(self,b);
+ else {
+ U_LONG pl = VpSetPrecLimit(0);
+ VALUE c = BigDecimal_sub(self,b);
+ VpSetPrecLimit(pl);
+ GUARD_OBJ(cv,GetVpValue(c,1));
+ VpLeftRound(cv,VpGetRoundMode(),mx);
+ return ToValue(cv);
+ }
+}
+
+static VALUE
+BigDecimal_mult2(VALUE self, VALUE b, VALUE n)
+{
+ ENTER(2);
+ Real *cv;
+ U_LONG mx = (U_LONG)GetPositiveInt(n);
+ if(mx==0) return BigDecimal_mult(self,b);
+ else {
+ U_LONG pl = VpSetPrecLimit(0);
+ VALUE c = BigDecimal_mult(self,b);
+ VpSetPrecLimit(pl);
+ GUARD_OBJ(cv,GetVpValue(c,1));
+ VpLeftRound(cv,VpGetRoundMode(),mx);
+ return ToValue(cv);
+ }
+}
+
+static VALUE
+BigDecimal_abs(VALUE self)
+{
+ ENTER(5);
+ Real *c, *a;
+ U_LONG mx;
+
+ GUARD_OBJ(a,GetVpValue(self,1));
+ mx = a->Prec *(VpBaseFig() + 1);
+ GUARD_OBJ(c,VpCreateRbObject(mx, "0"));
+ VpAsgn(c, a, 1);
+ VpChangeSign(c,(S_INT)1);
+ return ToValue(c);
+}
+
+static VALUE
+BigDecimal_sqrt(VALUE self, VALUE nFig)
+{
+ ENTER(5);
+ Real *c, *a;
+ S_INT mx, n;
+
+ GUARD_OBJ(a,GetVpValue(self,1));
+ mx = a->Prec *(VpBaseFig() + 1);
+
+ n = GetPositiveInt(nFig) + VpDblFig() + 1;
+ if(mx <= n) mx = n;
+ GUARD_OBJ(c,VpCreateRbObject(mx, "0"));
+ VpSqrt(c, a);
+ return ToValue(c);
+}
+
+static VALUE
+BigDecimal_fix(VALUE self)
+{
+ ENTER(5);
+ Real *c, *a;
+ U_LONG mx;
+
+ GUARD_OBJ(a,GetVpValue(self,1));
+ mx = a->Prec *(VpBaseFig() + 1);
+ GUARD_OBJ(c,VpCreateRbObject(mx, "0"));
+ VpActiveRound(c,a,VP_ROUND_DOWN,0); /* 0: round off */
+ return ToValue(c);
+}
+
+static VALUE
+BigDecimal_round(int argc, VALUE *argv, VALUE self)
+{
+ ENTER(5);
+ Real *c, *a;
+ int iLoc;
+ U_LONG mx;
+ VALUE vLoc;
+ VALUE vRound;
+ U_LONG pl;
+
+ int sw = VpGetRoundMode();
+
+ int na = rb_scan_args(argc,argv,"02",&vLoc,&vRound);
+ switch(na) {
+ case 0:
+ iLoc = 0;
+ break;
+ case 1:
+ Check_Type(vLoc, T_FIXNUM);
+ iLoc = FIX2INT(vLoc);
+ break;
+ case 2:
+ Check_Type(vLoc, T_FIXNUM);
+ iLoc = FIX2INT(vLoc);
+ Check_Type(vRound, T_FIXNUM);
+ sw = FIX2INT(vRound);
+ if(!VpIsRoundMode(sw)) {
+ rb_raise(rb_eTypeError, "Invalid rounding mode.");
+ return Qnil;
+ }
+ break;
+ }
+
+ pl = VpSetPrecLimit(0);
+ GUARD_OBJ(a,GetVpValue(self,1));
+ mx = a->Prec *(VpBaseFig() + 1);
+ GUARD_OBJ(c,VpCreateRbObject(mx, "0"));
+ VpSetPrecLimit(pl);
+ VpActiveRound(c,a,sw,iLoc);
+ return ToValue(c);
+}
+
+static VALUE
+BigDecimal_truncate(int argc, VALUE *argv, VALUE self)
+{
+ ENTER(5);
+ Real *c, *a;
+ int iLoc;
+ U_LONG mx;
+ VALUE vLoc;
+ U_LONG pl = VpSetPrecLimit(0);
+
+ if(rb_scan_args(argc,argv,"01",&vLoc)==0) {
+ iLoc = 0;
+ } else {
+ Check_Type(vLoc, T_FIXNUM);
+ iLoc = FIX2INT(vLoc);
+ }
+
+ GUARD_OBJ(a,GetVpValue(self,1));
+ mx = a->Prec *(VpBaseFig() + 1);
+ GUARD_OBJ(c,VpCreateRbObject(mx, "0"));
+ VpSetPrecLimit(pl);
+ VpActiveRound(c,a,VP_ROUND_DOWN,iLoc); /* 0: truncate */
+ return ToValue(c);
+}
+
+static VALUE
+BigDecimal_frac(VALUE self)
+{
+ ENTER(5);
+ Real *c, *a;
+ U_LONG mx;
+
+ GUARD_OBJ(a,GetVpValue(self,1));
+ mx = a->Prec *(VpBaseFig() + 1);
+ GUARD_OBJ(c,VpCreateRbObject(mx, "0"));
+ VpFrac(c, a);
+ return ToValue(c);
+}
+
+static VALUE
+BigDecimal_floor(int argc, VALUE *argv, VALUE self)
+{
+ ENTER(5);
+ Real *c, *a;
+ U_LONG mx;
+ int iLoc;
+ VALUE vLoc;
+ U_LONG pl = VpSetPrecLimit(0);
+
+ if(rb_scan_args(argc,argv,"01",&vLoc)==0) {
+ iLoc = 0;
+ } else {
+ Check_Type(vLoc, T_FIXNUM);
+ iLoc = FIX2INT(vLoc);
+ }
+
+ GUARD_OBJ(a,GetVpValue(self,1));
+ mx = a->Prec *(VpBaseFig() + 1);
+ GUARD_OBJ(c,VpCreateRbObject(mx, "0"));
+ VpSetPrecLimit(pl);
+ VpActiveRound(c,a,VP_ROUND_FLOOR,iLoc);
+ return ToValue(c);
+}
+
+static VALUE
+BigDecimal_ceil(int argc, VALUE *argv, VALUE self)
+{
+ ENTER(5);
+ Real *c, *a;
+ U_LONG mx;
+ int iLoc;
+ VALUE vLoc;
+ U_LONG pl = VpSetPrecLimit(0);
+
+ if(rb_scan_args(argc,argv,"01",&vLoc)==0) {
+ iLoc = 0;
+ } else {
+ Check_Type(vLoc, T_FIXNUM);
+ iLoc = FIX2INT(vLoc);
+ }
+
+ GUARD_OBJ(a,GetVpValue(self,1));
+ mx = a->Prec *(VpBaseFig() + 1);
+ GUARD_OBJ(c,VpCreateRbObject(mx, "0"));
+ VpSetPrecLimit(pl);
+ VpActiveRound(c,a,VP_ROUND_CEIL,iLoc);
+ return ToValue(c);
+}
+
+static VALUE
+BigDecimal_to_s(int argc, VALUE *argv, VALUE self)
+{
+ ENTER(5);
+ int fmt=0; /* 0:E format */
+ int fPlus=0; /* =0:default,=1: set ' ' before digits ,set '+' before digits. */
+ Real *vp;
+ char *psz;
+ char ch;
+ U_LONG nc;
+ S_INT mc = 0;
+ VALUE f;
+
+ GUARD_OBJ(vp,GetVpValue(self,1));
+
+ if(rb_scan_args(argc,argv,"01",&f)==1) {
+ if(TYPE(f)==T_STRING) {
+ SafeStringValue(f);
+ psz = RSTRING(f)->ptr;
+ if(*psz==' ') {
+ fPlus = 1; psz++;
+ } else if(*psz=='+') {
+ fPlus = 2; psz++;
+ }
+ while(ch=*psz++) {
+ if(ISSPACE(ch)) continue;
+ if(!ISDIGIT(ch)) {
+ if(ch=='F' || ch=='f') fmt = 1; /* F format */
+ break;
+ }
+ mc = mc * 10 + ch - '0';
+ }
+ } else {
+ mc = GetPositiveInt(f);
+ }
+ }
+ if(fmt) {
+ nc = VpNumOfChars(vp,"F");
+ } else {
+ nc = VpNumOfChars(vp,"E");
+ }
+ if(mc>0) nc += (nc + mc - 1) / mc + 1;
+
+ psz = ALLOCA_N(char,(unsigned int)nc);
+
+ if(fmt) {
+ VpToFString(vp, psz, mc, fPlus);
+ } else {
+ VpToString (vp, psz, mc, fPlus);
+ }
+ return rb_str_new2(psz);
+}
+
+static VALUE
+BigDecimal_split(VALUE self)
+{
+ ENTER(5);
+ Real *vp;
+ VALUE obj,obj1;
+ S_LONG e;
+ S_LONG s;
+ char *psz1;
+
+ GUARD_OBJ(vp,GetVpValue(self,1));
+ psz1 = ALLOCA_N(char,(unsigned int)VpNumOfChars(vp,"E"));
+ VpSzMantissa(vp,psz1);
+ s = 1;
+ if(psz1[0]=='-') {
+ s = -1; ++psz1;
+ }
+ if(psz1[0]=='N') s=0; /* NaN */
+ e = VpExponent10(vp);
+ obj1 = rb_str_new2(psz1);
+ obj = rb_ary_new2(4);
+ rb_ary_push(obj, INT2FIX(s));
+ rb_ary_push(obj, obj1);
+ rb_ary_push(obj, INT2FIX(10));
+ rb_ary_push(obj, INT2NUM(e));
+ return obj;
+}
+
+static VALUE
+BigDecimal_exponent(VALUE self)
+{
+ S_LONG e = VpExponent10(GetVpValue(self,1));
+ return INT2NUM(e);
+}
+
+static VALUE
+BigDecimal_inspect(VALUE self)
+{
+ ENTER(5);
+ Real *vp;
+ VALUE obj;
+ unsigned int nc;
+ char *psz1;
+ char *pszAll;
+
+ GUARD_OBJ(vp,GetVpValue(self,1));
+ nc = VpNumOfChars(vp,"E");
+ nc +=(nc + 9) / 10;
+
+ psz1 = ALLOCA_N(char,nc);
+ pszAll = ALLOCA_N(char,nc+256);
+ VpToString(vp, psz1, 10, 0);
+ sprintf(pszAll,"#<BigDecimal:%lx,'%s',%lu(%lu)>",self,psz1,VpPrec(vp)*VpBaseFig(),VpMaxPrec(vp)*VpBaseFig());
+ obj = rb_str_new2(pszAll);
+ return obj;
+}
+
+static VALUE
+BigDecimal_power(VALUE self, VALUE p)
+{
+ ENTER(5);
+ Real *x, *y;
+ S_LONG mp, ma, n;
+
+ Check_Type(p, T_FIXNUM);
+ n = FIX2INT(p);
+ ma = n;
+ if(ma < 0) ma = -ma;
+ if(ma == 0) ma = 1;
+
+ GUARD_OBJ(x,GetVpValue(self,1));
+ if(VpIsDef(x)) {
+ mp = x->Prec *(VpBaseFig() + 1);
+ GUARD_OBJ(y,VpCreateRbObject(mp *(ma + 1), "0"));
+ } else {
+ GUARD_OBJ(y,VpCreateRbObject(1, "0"));
+ }
+ VpPower(y, x, n);
+ return ToValue(y);
+}
+
+static VALUE
+BigDecimal_global_new(int argc, VALUE *argv, VALUE self)
+{
+ ENTER(5);
+ Real *pv;
+ S_LONG mf;
+ VALUE nFig;
+ VALUE iniValue;
+
+ if(rb_scan_args(argc,argv,"11",&iniValue,&nFig)==1) {
+ mf = 0;
+ } else {
+ mf = GetPositiveInt(nFig);
+ }
+ SafeStringValue(iniValue);
+ GUARD_OBJ(pv,VpCreateRbObject(mf, RSTRING(iniValue)->ptr));
+ return ToValue(pv);
+}
+
+static VALUE
+BigDecimal_new(int argc, VALUE *argv, VALUE self)
+{
+ ENTER(5);
+ Real *pv;
+ S_LONG mf;
+ VALUE nFig;
+ VALUE iniValue;
+
+ if(rb_scan_args(argc,argv,"11",&iniValue,&nFig)==1) {
+ mf = 0;
+ } else {
+ mf = GetPositiveInt(nFig);
+ }
+ SafeStringValue(iniValue);
+ GUARD_OBJ(pv,VpNewRbClass(mf, RSTRING(iniValue)->ptr,self));
+ return ToValue(pv);
+}
+
+static VALUE
+BigDecimal_limit(int argc, VALUE *argv, VALUE self)
+{
+ VALUE nFig;
+ VALUE nCur = INT2NUM(VpGetPrecLimit());
+
+ if(rb_scan_args(argc,argv,"01",&nFig)==1) {
+ int nf;
+ if(nFig==Qnil) return nCur;
+ Check_Type(nFig, T_FIXNUM);
+ nf = FIX2INT(nFig);
+ if(nf<0) {
+ rb_raise(rb_eArgError, "argument must be positive");
+ }
+ VpSetPrecLimit(nf);
+ }
+ return nCur;
+}
+
+static VALUE
+BigDecimal_sign(VALUE self)
+{ /* sign */
+ int s = GetVpValue(self,1)->sign;
+ return INT2FIX(s);
+}
+
+void
+Init_bigdecimal(void)
+{
+ /* Initialize VP routines */
+ VpInit((U_LONG)0);
+
+ /* Class and method registration */
+ rb_cBigDecimal = rb_define_class("BigDecimal",rb_cNumeric);
+
+ /* Global function */
+ rb_define_global_function("BigDecimal", BigDecimal_global_new, -1);
+
+ /* Class methods */
+ rb_define_singleton_method(rb_cBigDecimal, "new", BigDecimal_new, -1);
+ rb_define_singleton_method(rb_cBigDecimal, "mode", BigDecimal_mode, -1);
+ rb_define_singleton_method(rb_cBigDecimal, "limit", BigDecimal_limit, -1);
+ rb_define_singleton_method(rb_cBigDecimal, "double_fig", BigDecimal_double_fig, 0);
+ rb_define_singleton_method(rb_cBigDecimal, "induced_from",BigDecimal_induced_from, 1);
+ rb_define_singleton_method(rb_cBigDecimal, "_load", BigDecimal_load, 1);
+ rb_define_singleton_method(rb_cBigDecimal, "ver", BigDecimal_version, 0);
+
+ /* Constants definition */
+ rb_define_const(rb_cBigDecimal, "BASE", INT2FIX((S_INT)VpBaseVal()));
+
+ /* Exceptions */
+ rb_define_const(rb_cBigDecimal, "EXCEPTION_ALL",INT2FIX(VP_EXCEPTION_ALL));
+ rb_define_const(rb_cBigDecimal, "EXCEPTION_NaN",INT2FIX(VP_EXCEPTION_NaN));
+ rb_define_const(rb_cBigDecimal, "EXCEPTION_INFINITY",INT2FIX(VP_EXCEPTION_INFINITY));
+ rb_define_const(rb_cBigDecimal, "EXCEPTION_UNDERFLOW",INT2FIX(VP_EXCEPTION_UNDERFLOW));
+ rb_define_const(rb_cBigDecimal, "EXCEPTION_OVERFLOW",INT2FIX(VP_EXCEPTION_OVERFLOW));
+ rb_define_const(rb_cBigDecimal, "EXCEPTION_ZERODIVIDE",INT2FIX(VP_EXCEPTION_ZERODIVIDE));
+
+ /* Computation mode */
+ rb_define_const(rb_cBigDecimal, "ROUND_MODE",INT2FIX(VP_ROUND_MODE));
+ rb_define_const(rb_cBigDecimal, "ROUND_UP",INT2FIX(VP_ROUND_UP));
+ rb_define_const(rb_cBigDecimal, "ROUND_DOWN",INT2FIX(VP_ROUND_DOWN));
+ rb_define_const(rb_cBigDecimal, "ROUND_HALF_UP",INT2FIX(VP_ROUND_HALF_UP));
+ rb_define_const(rb_cBigDecimal, "ROUND_HALF_DOWN",INT2FIX(VP_ROUND_HALF_DOWN));
+ rb_define_const(rb_cBigDecimal, "ROUND_CEILING",INT2FIX(VP_ROUND_CEIL));
+ rb_define_const(rb_cBigDecimal, "ROUND_FLOOR",INT2FIX(VP_ROUND_FLOOR));
+ rb_define_const(rb_cBigDecimal, "ROUND_HALF_EVEN",INT2FIX(VP_ROUND_HALF_EVEN));
+
+ /* Constants for sign value */
+ rb_define_const(rb_cBigDecimal, "SIGN_NaN",INT2FIX(VP_SIGN_NaN));
+ rb_define_const(rb_cBigDecimal, "SIGN_POSITIVE_ZERO",INT2FIX(VP_SIGN_POSITIVE_ZERO));
+ rb_define_const(rb_cBigDecimal, "SIGN_NEGATIVE_ZERO",INT2FIX(VP_SIGN_NEGATIVE_ZERO));
+ rb_define_const(rb_cBigDecimal, "SIGN_POSITIVE_FINITE",INT2FIX(VP_SIGN_POSITIVE_FINITE));
+ rb_define_const(rb_cBigDecimal, "SIGN_NEGATIVE_FINITE",INT2FIX(VP_SIGN_NEGATIVE_FINITE));
+ rb_define_const(rb_cBigDecimal, "SIGN_POSITIVE_INFINITE",INT2FIX(VP_SIGN_POSITIVE_INFINITE));
+ rb_define_const(rb_cBigDecimal, "SIGN_NEGATIVE_INFINITE",INT2FIX(VP_SIGN_NEGATIVE_INFINITE));
+
+ /* instance methods */
+ rb_define_method(rb_cBigDecimal, "precs", BigDecimal_prec, 0);
+ rb_define_method(rb_cBigDecimal, "add", BigDecimal_add2, 2);
+ rb_define_method(rb_cBigDecimal, "sub", BigDecimal_sub2, 2);
+ rb_define_method(rb_cBigDecimal, "mult", BigDecimal_mult2, 2);
+ rb_define_method(rb_cBigDecimal, "div",BigDecimal_div2, -1);
+ rb_define_method(rb_cBigDecimal, "hash", BigDecimal_hash, 0);
+ rb_define_method(rb_cBigDecimal, "to_s", BigDecimal_to_s, -1);
+ rb_define_method(rb_cBigDecimal, "to_i", BigDecimal_to_i, 0);
+ rb_define_method(rb_cBigDecimal, "to_int", BigDecimal_to_i, 0);
+ rb_define_method(rb_cBigDecimal, "split", BigDecimal_split, 0);
+ rb_define_method(rb_cBigDecimal, "+", BigDecimal_add, 1);
+ rb_define_method(rb_cBigDecimal, "-", BigDecimal_sub, 1);
+ rb_define_method(rb_cBigDecimal, "+@", BigDecimal_uplus, 0);
+ rb_define_method(rb_cBigDecimal, "-@", BigDecimal_neg, 0);
+ rb_define_method(rb_cBigDecimal, "*", BigDecimal_mult, 1);
+ rb_define_method(rb_cBigDecimal, "/", BigDecimal_div, 1);
+ rb_define_method(rb_cBigDecimal, "quo", BigDecimal_div, 1);
+ rb_define_method(rb_cBigDecimal, "%", BigDecimal_mod, 1);
+ rb_define_method(rb_cBigDecimal, "modulo", BigDecimal_mod, 1);
+ rb_define_method(rb_cBigDecimal, "remainder", BigDecimal_remainder, 1);
+ rb_define_method(rb_cBigDecimal, "divmod", BigDecimal_divmod, 1);
+ /* rb_define_method(rb_cBigDecimal, "dup", BigDecimal_dup, 0); */
+ rb_define_method(rb_cBigDecimal, "to_f", BigDecimal_to_f, 0);
+ rb_define_method(rb_cBigDecimal, "abs", BigDecimal_abs, 0);
+ rb_define_method(rb_cBigDecimal, "sqrt", BigDecimal_sqrt, 1);
+ rb_define_method(rb_cBigDecimal, "fix", BigDecimal_fix, 0);
+ rb_define_method(rb_cBigDecimal, "round", BigDecimal_round, -1);
+ rb_define_method(rb_cBigDecimal, "frac", BigDecimal_frac, 0);
+ rb_define_method(rb_cBigDecimal, "floor", BigDecimal_floor, -1);
+ rb_define_method(rb_cBigDecimal, "ceil", BigDecimal_ceil, -1);
+ rb_define_method(rb_cBigDecimal, "power", BigDecimal_power, 1);
+ rb_define_method(rb_cBigDecimal, "**", BigDecimal_power, 1);
+ rb_define_method(rb_cBigDecimal, "<=>", BigDecimal_comp, 1);
+ rb_define_method(rb_cBigDecimal, "==", BigDecimal_eq, 1);
+ rb_define_method(rb_cBigDecimal, "===", BigDecimal_eq, 1);
+ rb_define_method(rb_cBigDecimal, "eql?", BigDecimal_eq, 1);
+ rb_define_method(rb_cBigDecimal, "!=", BigDecimal_ne, 1);
+ rb_define_method(rb_cBigDecimal, "<", BigDecimal_lt, 1);
+ rb_define_method(rb_cBigDecimal, "<=", BigDecimal_le, 1);
+ rb_define_method(rb_cBigDecimal, ">", BigDecimal_gt, 1);
+ rb_define_method(rb_cBigDecimal, ">=", BigDecimal_ge, 1);
+ rb_define_method(rb_cBigDecimal, "zero?", BigDecimal_zero, 0);
+ rb_define_method(rb_cBigDecimal, "nonzero?", BigDecimal_nonzero, 0);
+ rb_define_method(rb_cBigDecimal, "coerce", BigDecimal_coerce, 1);
+ rb_define_method(rb_cBigDecimal, "inspect", BigDecimal_inspect, 0);
+ rb_define_method(rb_cBigDecimal, "exponent", BigDecimal_exponent, 0);
+ rb_define_method(rb_cBigDecimal, "sign", BigDecimal_sign, 0);
+ rb_define_method(rb_cBigDecimal, "nan?", BigDecimal_IsNaN, 0);
+ rb_define_method(rb_cBigDecimal, "infinite?", BigDecimal_IsInfinite, 0);
+ rb_define_method(rb_cBigDecimal, "finite?", BigDecimal_IsFinite, 0);
+ rb_define_method(rb_cBigDecimal, "truncate", BigDecimal_truncate, -1);
+ rb_define_method(rb_cBigDecimal, "_dump", BigDecimal_dump, -1);
+}
+
+/*
+ *
+ * ============================================================================
+ *
+ * vp_ routines begin from here.
+ *
+ * ============================================================================
+ *
+ */
+#ifdef _DEBUG
+/*static int gfDebug = 1;*/ /* Debug switch */
+static int gfCheckVal = 1; /* Value checking flag in VpNmlz() */
+#endif /* _DEBUG */
+
+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 */
+
+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 */
+
+static Real *VpConstOne; /* constant 1.0 */
+static Real *VpPt5; /* constant 0.5 */
+static U_LONG maxnr = 100; /* Maximum iterations for calcurating sqrt. */
+ /* used in VpSqrt() */
+
+/* ETC */
+#define MemCmp(x,y,z) memcmp(x,y,z)
+#define StrCmp(x,y) strcmp(x,y)
+
+static int VpIsDefOP(Real *c,Real *a,Real *b,int sw);
+static int AddExponent(Real *a,S_INT n);
+static U_LONG VpAddAbs(Real *a,Real *b,Real *c);
+static U_LONG VpSubAbs(Real *a,Real *b,Real *c);
+static U_LONG VpSetPTR(Real *a,Real *b,Real *c,U_LONG *a_pos,U_LONG *b_pos,U_LONG *c_pos,U_LONG *av,U_LONG *bv);
+static int VpNmlz(Real *a);
+static void VpFormatSt(char *psz,S_INT fFmt);
+static int VpRdup(Real *m,U_LONG ind_m);
+
+#ifdef _DEBUG
+static int gnAlloc=0; /* Memory allocation counter */
+#endif /* _DEBUG */
+
+VP_EXPORT void *
+VpMemAlloc(U_LONG mb)
+{
+ void *p = xmalloc((unsigned int)mb);
+ if(!p) {
+ VpException(VP_EXCEPTION_MEMORY,"failed to allocate memory",1);
+ }
+ memset(p,0,mb);
+#ifdef _DEBUG
+ gnAlloc++; /* Count allocation call */
+#endif /* _DEBUG */
+ return p;
+}
+
+VP_EXPORT void
+VpFree(Real *pv)
+{
+ if(pv != NULL) {
+ xfree(pv);
+#ifdef _DEBUG
+ gnAlloc--; /* Decrement allocation count */
+ if(gnAlloc==0) {
+ printf(" *************** All memories allocated freed ****************");
+ getchar();
+ }
+ if(gnAlloc<0) {
+ printf(" ??????????? Too many memory free calls(%d) ?????????????\n",gnAlloc);
+ getchar();
+ }
+#endif /* _DEBUG */
+ }
+}
+
+/*
+ * EXCEPTION Handling.
+ */
+static unsigned short gfDoException = 0; /* Exception flag */
+
+static unsigned short
+VpGetException (void)
+{
+ return gfDoException;
+}
+
+static void
+VpSetException(unsigned short f)
+{
+ gfDoException = f;
+}
+
+/* These 2 functions added at v1.1.7 */
+VP_EXPORT U_LONG
+VpGetPrecLimit(void)
+{
+ return gnPrecLimit;
+}
+
+VP_EXPORT U_LONG
+VpSetPrecLimit(U_LONG n)
+{
+ U_LONG s = gnPrecLimit;
+ gnPrecLimit = n;
+ return s;
+}
+
+VP_EXPORT unsigned long
+VpGetRoundMode(void)
+{
+ return gfRoundMode;
+}
+
+VP_EXPORT int
+VpIsRoundMode(unsigned long n)
+{
+ if(n==VP_ROUND_UP || n!=VP_ROUND_DOWN ||
+ n==VP_ROUND_HALF_UP || n!=VP_ROUND_HALF_DOWN ||
+ n==VP_ROUND_CEIL || n!=VP_ROUND_FLOOR ||
+ n==VP_ROUND_HALF_EVEN
+ ) return 1;
+ return 0;
+}
+
+VP_EXPORT unsigned long
+VpSetRoundMode(unsigned long n)
+{
+ if(VpIsRoundMode(n)) gfRoundMode = n;
+ return gfRoundMode;
+}
+
+/*
+ * 0.0 & 1.0 generator
+ * These gZero_..... and gOne_..... can be any name
+ * referenced from nowhere except Zero() and One().
+ * gZero_..... and gOne_..... must have global scope
+ * (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;
+static double
+Zero(void)
+{
+ return gZero_ABCED9B1_CE73__00400511F31D;
+}
+
+static double
+One(void)
+{
+ return gOne_ABCED9B4_CE73__00400511F31D;
+}
+
+VP_EXPORT U_LONG
+VpBaseFig(void)
+{
+ return BASE_FIG;
+}
+
+VP_EXPORT U_LONG
+VpDblFig(void)
+{
+ return DBLE_FIG;
+}
+
+VP_EXPORT U_LONG
+VpBaseVal(void)
+{
+ return BASE;
+}
+
+/*
+ ----------------------------------------------------------------
+ Value of sign in Real structure is reserved for future use.
+ short sign;
+ ==0 : NaN
+ 1 : Positive zero
+ -1 : Negative zero
+ 2 : Positive number
+ -2 : Negative number
+ 3 : Positive infinite number
+ -3 : Negative infinite number
+ ----------------------------------------------------------------
+*/
+
+VP_EXPORT double
+VpGetDoubleNaN(void) /* Returns the value of NaN */
+{
+ static double fNaN = 0.0;
+ if(fNaN==0.0) fNaN = Zero()/Zero();
+ return fNaN;
+}
+
+VP_EXPORT double
+VpGetDoublePosInf(void) /* Returns the value of +Infinity */
+{
+ static double fInf = 0.0;
+ if(fInf==0.0) fInf = One()/Zero();
+ return fInf;
+}
+
+VP_EXPORT double
+VpGetDoubleNegInf(void) /* Returns the value of -Infinity */
+{
+ static double fInf = 0.0;
+ if(fInf==0.0) fInf = -(One()/Zero());
+ return fInf;
+}
+
+VP_EXPORT double
+VpGetDoubleNegZero(void) /* Returns the value of -0 */
+{
+ static double nzero = 1000.0;
+ if(nzero!=0.0) nzero = (One()/VpGetDoubleNegInf());
+ return nzero;
+}
+
+VP_EXPORT int
+VpIsNegDoubleZero(double v)
+{
+ double z = VpGetDoubleNegZero();
+ return MemCmp(&v,&z,sizeof(v))==0;
+}
+
+VP_EXPORT int
+VpException(unsigned short f,char *str,int always)
+{
+ VALUE exc;
+ int fatal=0;
+
+ if(f==VP_EXCEPTION_OP || f==VP_EXCEPTION_MEMORY) always = 1;
+
+ if(always||(gfDoException&f)) {
+ switch(f)
+ {
+ /*
+ case VP_EXCEPTION_ZERODIVIDE:
+ case VP_EXCEPTION_OVERFLOW:
+ */
+ case VP_EXCEPTION_INFINITY:
+ exc = rb_eFloatDomainError;
+ goto raise;
+ case VP_EXCEPTION_NaN:
+ exc = rb_eFloatDomainError;
+ goto raise;
+ case VP_EXCEPTION_UNDERFLOW:
+ exc = rb_eFloatDomainError;
+ goto raise;
+ case VP_EXCEPTION_OP:
+ exc = rb_eFloatDomainError;
+ goto raise;
+ case VP_EXCEPTION_MEMORY:
+ fatal = 1;
+ goto raise;
+ default:
+ fatal = 1;
+ goto raise;
+ }
+ }
+ return 0; /* 0 Means VpException() raised no exception */
+
+raise:
+ if(fatal) rb_fatal(str);
+ else rb_raise(exc,str);
+ return 0;
+}
+
+/* Throw exception or returns 0,when resulting c is Inf or NaN */
+/* sw=1:+ 2:- 3:* 4:/ */
+static int
+VpIsDefOP(Real *c,Real *a,Real *b,int sw)
+{
+ if(VpIsNaN(a) || VpIsNaN(b)) {
+ /* at least a or b is NaN */
+ VpSetNaN(c);
+ goto NaN;
+ }
+
+ if(VpIsInf(a)) {
+ if(VpIsInf(b)) {
+ switch(sw)
+ {
+ case 1: /* + */
+ if(VpGetSign(a)==VpGetSign(b)) {
+ VpSetInf(c,VpGetSign(a));
+ goto Inf;
+ } else {
+ VpSetNaN(c);
+ goto NaN;
+ }
+ case 2: /* - */
+ if(VpGetSign(a)!=VpGetSign(b)) {
+ VpSetInf(c,VpGetSign(a));
+ goto Inf;
+ } else {
+ VpSetNaN(c);
+ goto NaN;
+ }
+ break;
+ case 3: /* * */
+ VpSetInf(c,VpGetSign(a)*VpGetSign(b));
+ goto Inf;
+ break;
+ case 4: /* / */
+ VpSetNaN(c);
+ goto NaN;
+ }
+ VpSetNaN(c);
+ goto NaN;
+ }
+ /* Inf op Finite */
+ switch(sw)
+ {
+ case 1: /* + */
+ case 2: /* - */
+ VpSetInf(c,VpGetSign(a));
+ break;
+ case 3: /* * */
+ if(VpIsZero(b)) {
+ VpSetNaN(c);
+ goto NaN;
+ }
+ VpSetInf(c,VpGetSign(a)*VpGetSign(b));
+ break;
+ case 4: /* / */
+ VpSetInf(c,VpGetSign(a)*VpGetSign(b));
+ }
+ goto Inf;
+ }
+
+ if(VpIsInf(b)) {
+ switch(sw)
+ {
+ case 1: /* + */
+ VpSetInf(c,VpGetSign(b));
+ break;
+ case 2: /* - */
+ VpSetInf(c,-VpGetSign(b));
+ break;
+ case 3: /* * */
+ if(VpIsZero(a)) {
+ VpSetNaN(c);
+ goto NaN;
+ }
+ VpSetInf(c,VpGetSign(a)*VpGetSign(b));
+ break;
+ case 4: /* / */
+ VpSetZero(c,VpGetSign(a)*VpGetSign(b));
+ }
+ goto Inf;
+ }
+ return 1; /* Results OK */
+
+Inf:
+ return VpException(VP_EXCEPTION_INFINITY,"Computation results to 'Infinity'",0);
+NaN:
+ return VpException(VP_EXCEPTION_NaN,"Computation results to 'NaN'",0);
+}
+
+/*
+ ----------------------------------------------------------------
+*/
+
+/*
+ * returns number of chars needed to represent vp in specified format.
+ */
+VP_EXPORT U_LONG
+VpNumOfChars(Real *vp,char *pszFmt)
+{
+ S_INT ex;
+ U_LONG nc;
+
+ if(vp == NULL) return BASE_FIG*2+6;
+ if(!VpIsDef(vp)) return 32; /* not sure,may be OK */
+
+ switch(*pszFmt)
+ {
+ case 'F':
+ nc = BASE_FIG*(vp->Prec + 1)+2;
+ ex = vp->exponent;
+ if(ex<0) {
+ nc += BASE_FIG*(-ex);
+ } else {
+ if(ex > (S_INT)vp->Prec) {
+ nc += BASE_FIG*(ex - (S_INT)vp->Prec);
+ }
+ }
+ break;
+ case 'E':
+ default:
+ nc = BASE_FIG*(vp->Prec + 2)+6; /* 3: sign + exponent chars */
+ }
+ return nc;
+}
+
+/*
+ * Initializer for Vp routines and constants used.
+ * [Input]
+ * BaseVal: Base value(assigned to BASE) for Vp calculation.
+ * It must be the form BaseVal=10**n.(n=1,2,3,...)
+ * If Base <= 0L,then the BASE will be calcurated so
+ * that BASE is as large as possible satisfying the
+ * relation MaxVal <= BASE*(BASE+1). Where the value
+ * MaxVal is the largest value which can be represented
+ * by one U_LONG word(LONG) in the computer used.
+ *
+ * [Returns]
+ * DBLE_FIG ... OK
+ */
+VP_EXPORT U_LONG
+VpInit(U_LONG BaseVal)
+{
+ U_LONG w;
+ double v;
+
+ /* Setup +/- Inf NaN -0 */
+ VpGetDoubleNaN();
+ VpGetDoublePosInf();
+ VpGetDoubleNegInf();
+ VpGetDoubleNegZero();
+
+ if(BaseVal <= 0) {
+ /* Base <= 0, then determine Base by calcuration. */
+ BASE = 1;
+ while(
+ (BASE > 0) &&
+ ((w = BASE *(BASE + 1)) > BASE) &&((w / BASE) ==(BASE + 1))
+ ) {
+ BaseVal = BASE;
+ BASE = BaseVal * 10L;
+ }
+ }
+ /* Set Base Values */
+ BASE = BaseVal;
+ HALF_BASE = BASE / 2;
+ BASE1 = BASE / 10;
+ BASE_FIG = 0;
+ while(BaseVal /= 10) ++BASE_FIG;
+ /* Allocates Vp constants. */
+ VpConstOne = VpAlloc((U_LONG)1, "1");
+ VpPt5 = VpAlloc((U_LONG)1, ".5");
+
+#ifdef _DEBUG
+ 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);
+ printf(" BASE = %lu\n", BASE);
+ printf(" HALF_BASE = %lu\n", HALF_BASE);
+ printf(" BASE1 = %lu\n", BASE1);
+ printf(" BASE_FIG = %lu\n", BASE_FIG);
+ printf(" DBLE_FIG = %lu\n", DBLE_FIG);
+ }
+#endif /* _DEBUG */
+
+ return DBLE_FIG;
+}
+
+VP_EXPORT Real *
+VpOne()
+{
+ return VpConstOne;
+}
+
+/* If exponent overflows,then raise exception or returns 0 */
+static int
+AddExponent(Real *a,S_INT n)
+{
+ S_INT e = a->exponent;
+ S_INT m = e+n;
+ S_INT eb,mb;
+ if(e>0) {
+ if(n>0) {
+ mb = m*BASE_FIG;
+ eb = e*BASE_FIG;
+ if(mb<eb) goto overflow;
+ }
+ } else if(n<0) {
+ mb = m*BASE_FIG;
+ eb = e*BASE_FIG;
+ if(mb>eb) goto underflow;
+ }
+ a->exponent = m;
+ return 1;
+
+/* Overflow/Underflow ==> Raise exception or returns 0 */
+underflow:
+ VpSetZero(a,VpGetSign(a));
+ return VpException(VP_EXCEPTION_UNDERFLOW,"Exponent underflow",0);
+
+overflow:
+ VpSetInf(a,VpGetSign(a));
+ return VpException(VP_EXCEPTION_OVERFLOW,"Exponent overflow",0);
+}
+
+/*
+ * Allocates variable.
+ * [Input]
+ * mx ... allocation unit, if zero then mx is determined by szVal.
+ * The mx is the number of effective digits can to be stored.
+ * szVal ... value assigned(char). If szVal==NULL,then zero is assumed.
+ * If szVal[0]=='#' then Max. Prec. will not be considered(1.1.7),
+ * full precision specified by szVal is allocated.
+ *
+ * [Returns]
+ * Pointer to the newly allocated variable, or
+ * NULL be returned if memory allocation is failed,or any error.
+ */
+VP_EXPORT Real *
+VpAlloc(U_LONG mx, char *szVal)
+{
+ U_LONG i, ni, ipn, ipf, nf, ipe, ne, nalloc;
+ char v,*psz;
+ int sign=1;
+ Real *vp = NULL;
+ U_LONG mf = VpGetPrecLimit();
+
+ mx = (mx + BASE_FIG - 1) / BASE_FIG + 1; /* Determine allocation unit. */
+ if(szVal) {
+ while(ISSPACE(*szVal)) szVal++;
+ if(*szVal!='#') {
+ if(mf) {
+ mf = (mf + BASE_FIG - 1) / BASE_FIG + 2; /* Needs 1 more for div */
+ if(mx>mf) {
+ mx = mf;
+ }
+ }
+ } else {
+ ++szVal;
+ }
+ } else {
+ /* necessary to be able to store */
+ /* at least mx digits. */
+ /* szVal==NULL ==> allocate zero value. */
+ vp = (Real *) VpMemAlloc(sizeof(Real) + mx * sizeof(U_LONG));
+ /* xmalloc() alway returns(or throw interruption) */
+ vp->MaxPrec = mx; /* set max precision */
+ VpSetZero(vp,1); /* initialize vp to zero. */
+ return vp;
+ }
+
+ /* Skip all spaces */
+ psz = ALLOCA_N(char,strlen(szVal)+1);
+ i = 0;
+ ipn = 0;
+ while(psz[i]=szVal[ipn]) {
+ if(ISSPACE(szVal[ipn])) {ipn++;continue;}
+ ++i; ++ipn;
+ }
+ szVal = psz;
+
+ /* Check on Inf & NaN */
+ if(StrCmp(szVal,SZ_PINF)==0 ||
+ StrCmp(szVal,SZ_INF)==0 ) {
+ vp = (Real *) VpMemAlloc(sizeof(Real) + sizeof(U_LONG));
+ vp->MaxPrec = 1; /* set max precision */
+ VpSetPosInf(vp);
+ return vp;
+ }
+ if(StrCmp(szVal,SZ_NINF)==0) {
+ vp = (Real *) VpMemAlloc(sizeof(Real) + sizeof(U_LONG));
+ vp->MaxPrec = 1; /* set max precision */
+ VpSetNegInf(vp);
+ return vp;
+ }
+ if(StrCmp(szVal,SZ_NaN)==0) {
+ vp = (Real *) VpMemAlloc(sizeof(Real) + sizeof(U_LONG));
+ vp->MaxPrec = 1; /* set max precision */
+ VpSetNaN(vp);
+ return vp;
+ }
+
+ /* check on number szVal[] */
+ ipn = i = 0;
+ if (szVal[i] == '-') {sign=-1;++i;}
+ else if(szVal[i] == '+') ++i;
+ /* Skip digits */
+ ni = 0; /* digits in mantissa */
+ while(v = szVal[i]) {
+ if(!ISDIGIT(v)) break;
+ ++i;
+ ++ni;
+ }
+ nf = 0;
+ ipf = 0;
+ ipe = 0;
+ ne = 0;
+ if(v) {
+ /* other than digit nor \0 */
+ if(szVal[i] == '.') { /* xxx. */
+ ++i;
+ ipf = i;
+ while(v = szVal[i]) { /* get fraction part. */
+ if(!ISDIGIT(v)) break;
+ ++i;
+ ++nf;
+ }
+ }
+ ipe = 0; /* Exponent */
+
+ switch(szVal[i]) {
+ case '\0': break;
+ case 'e':
+ case 'E':
+ case 'd':
+ case 'D':
+ ++i;
+ ipe = i;
+ v = szVal[i];
+ if((v == '-') ||(v == '+')) ++i;
+ while(v=szVal[i]) {
+ if(!ISDIGIT(v)) break;
+ ++i;
+ ++ne;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ nalloc =(ni + nf + BASE_FIG - 1) / BASE_FIG + 1; /* set effective allocation */
+ /* units for szVal[] */
+ if(mx <= 0) mx = 1;
+ nalloc = Max(nalloc, mx);
+ mx = nalloc;
+ vp =(Real *) VpMemAlloc(sizeof(Real) + mx * sizeof(U_LONG));
+ /* xmalloc() alway returns(or throw interruption) */
+ vp->MaxPrec = mx; /* set max precision */
+ VpSetZero(vp,sign);
+ VpCtoV(vp, &(szVal[ipn]), ni, &(szVal[ipf]), nf, &(szVal[ipe]), ne);
+ return vp;
+}
+
+/*
+ * Assignment(c=a).
+ * [Input]
+ * a ... RHSV
+ * isw ... switch for assignment.
+ * c = a when isw > 0
+ * c = -a when isw < 0
+ * if c->MaxPrec < a->Prec,then round operation
+ * will be performed.
+ * [Output]
+ * c ... LHSV
+ */
+VP_EXPORT int
+VpAsgn(Real *c, Real *a, int isw)
+{
+ U_LONG n;
+ if(VpIsNaN(a)) {
+ VpSetNaN(c);
+ return 0;
+ }
+ if(VpIsInf(a)) {
+ VpSetInf(c,isw*VpGetSign(a));
+ return 0;
+ }
+
+ /* check if the RHS is zero */
+ if(!VpIsZero(a)) {
+ c->exponent = a->exponent; /* store exponent */
+ VpSetSign(c,(isw*VpGetSign(a))); /* set sign */
+ n =(a->Prec < c->MaxPrec) ?(a->Prec) :(c->MaxPrec);
+ c->Prec = n;
+ memcpy(c->frac, a->frac, n * sizeof(U_LONG));
+ /* Needs round ? */
+ if(isw!=10) {
+ /* Not in ActiveRound */
+ if(c->Prec < a->Prec) {
+ VpInternalRound(c,n,(n>0)?a->frac[n-1]:0,a->frac[n]);
+ } else {
+ VpLimitRound(c,0);
+ }
+ }
+ } else {
+ /* The value of 'a' is zero. */
+ VpSetZero(c,isw*VpGetSign(a));
+ return 1;
+ }
+ return c->Prec*BASE_FIG;
+}
+
+/*
+ * c = a + b when operation = 1 or 2
+ * = a - b when operation = -1 or -2.
+ * Returns number of significant digits of c
+ */
+VP_EXPORT int
+VpAddSub(Real *c, Real *a, Real *b, int operation)
+{
+ S_INT sw, isw;
+ Real *a_ptr, *b_ptr;
+ U_LONG n, na, nb, i;
+ U_LONG mrv;
+
+#ifdef _DEBUG
+ if(gfDebug) {
+ VPrint(stdout, "VpAddSub(enter) a=% \n", a);
+ VPrint(stdout, " b=% \n", b);
+ printf(" operation=%d\n", operation);
+ }
+#endif /* _DEBUG */
+
+ if(!VpIsDefOP(c,a,b,(operation>0)?1:2)) return 0; /* No significant digits */
+
+ /* check if a or b is zero */
+ if(VpIsZero(a)) {
+ /* a is zero,then assign b to c */
+ if(!VpIsZero(b)) {
+ VpAsgn(c, b, operation);
+ } else {
+ /* Both a and b are zero. */
+ if(VpGetSign(a)<0 && operation*VpGetSign(b)<0) {
+ /* -0 -0 */
+ VpSetZero(c,-1);
+ } else {
+ VpSetZero(c,1);
+ }
+ return 1; /* 0: 1 significant digits */
+ }
+ return c->Prec*BASE_FIG;
+ }
+ if(VpIsZero(b)) {
+ /* b is zero,then assign a to c. */
+ VpAsgn(c, a, 1);
+ return c->Prec*BASE_FIG;
+ }
+
+ if(operation < 0) sw = -1;
+ else sw = 1;
+
+ /* compare absolute value. As a result,|a_ptr|>=|b_ptr| */
+ if(a->exponent > b->exponent) {
+ a_ptr = a;
+ b_ptr = b;
+ } /* |a|>|b| */
+ else if(a->exponent < b->exponent) {
+ a_ptr = b;
+ b_ptr = a;
+ } /* |a|<|b| */
+ else {
+ /* Exponent part of a and b is the same,then compare fraction */
+ /* part */
+ na = a->Prec;
+ nb = b->Prec;
+ n = Min(na, nb);
+ for(i=0;i < n; ++i) {
+ if(a->frac[i] > b->frac[i]) {
+ a_ptr = a;
+ b_ptr = b;
+ goto end_if;
+ } else if(a->frac[i] < b->frac[i]) {
+ a_ptr = b;
+ b_ptr = a;
+ goto end_if;
+ }
+ }
+ if(na > nb) {
+ a_ptr = a;
+ b_ptr = b;
+ goto end_if;
+ } else if(na < nb) {
+ a_ptr = b;
+ b_ptr = a;
+ goto end_if;
+ }
+ /* |a| == |b| */
+ if(VpGetSign(a) + sw *VpGetSign(b) == 0) {
+ VpSetZero(c,1); /* abs(a)=abs(b) and operation = '-' */
+ return c->Prec*BASE_FIG;
+ }
+ a_ptr = a;
+ b_ptr = b;
+ }
+
+end_if:
+ isw = VpGetSign(a) + sw *VpGetSign(b);
+ /*
+ * isw = 0 ...( 1)+(-1),( 1)-( 1),(-1)+(1),(-1)-(-1)
+ * = 2 ...( 1)+( 1),( 1)-(-1)
+ * =-2 ...(-1)+(-1),(-1)-( 1)
+ * If isw==0, then c =(Sign a_ptr)(|a_ptr|-|b_ptr|)
+ * else c =(Sign ofisw)(|a_ptr|+|b_ptr|)
+ */
+ if(isw) { /* addition */
+ VpSetSign(c,(S_INT)1);
+ mrv = VpAddAbs(a_ptr, b_ptr, c);
+ VpSetSign(c,isw / 2);
+ } else { /* subtraction */
+ VpSetSign(c,(S_INT)1);
+ mrv = VpSubAbs(a_ptr, b_ptr, c);
+ if(a_ptr == a) {
+ VpSetSign(c,VpGetSign(a));
+ } else {
+ VpSetSign(c,VpGetSign(a_ptr) * sw);
+ }
+ }
+ VpInternalRound(c,0,(c->Prec>0)?c->frac[c->Prec-1]:0,mrv);
+
+#ifdef _DEBUG
+ if(gfDebug) {
+ VPrint(stdout, "VpAddSub(result) c=% \n", c);
+ VPrint(stdout, " a=% \n", a);
+ VPrint(stdout, " b=% \n", b);
+ printf(" operation=%d\n", operation);
+ }
+#endif /* _DEBUG */
+ return c->Prec*BASE_FIG;
+}
+
+/*
+ * Addition of two variable precisional variables
+ * a and b assuming abs(a)>abs(b).
+ * c = abs(a) + abs(b) ; where |a|>=|b|
+ */
+static U_LONG
+VpAddAbs(Real *a, Real *b, Real *c)
+{
+ U_LONG word_shift;
+ U_LONG carry;
+ U_LONG ap;
+ U_LONG bp;
+ U_LONG cp;
+ U_LONG a_pos;
+ U_LONG b_pos;
+ U_LONG c_pos;
+ U_LONG av, bv, mrv;
+
+#ifdef _DEBUG
+ if(gfDebug) {
+ VPrint(stdout, "VpAddAbs called: a = %\n", a);
+ VPrint(stdout, " b = %\n", b);
+ }
+#endif /* _DEBUG */
+
+ word_shift = VpSetPTR(a, b, c, &ap, &bp, &cp, &av, &bv);
+ a_pos = ap;
+ b_pos = bp;
+ c_pos = cp;
+ if(word_shift==-1L) return 0; /* Overflow */
+ if(b_pos == -1L) goto Assign_a;
+
+ mrv = av + bv; /* Most right val. Used for round. */
+
+ /* Just assign the last few digits of b to c because a has no */
+ /* corresponding digits to be added. */
+ while(b_pos + word_shift > a_pos) {
+ --c_pos;
+ if(b_pos > 0) {
+ c->frac[c_pos] = b->frac[--b_pos];
+ } else {
+ --word_shift;
+ c->frac[c_pos] = 0;
+ }
+ }
+
+ /* Just assign the last few digits of a to c because b has no */
+ /* corresponding digits to be added. */
+ bv = b_pos + word_shift;
+ while(a_pos > bv) {
+ c->frac[--c_pos] = a->frac[--a_pos];
+ }
+ carry = 0; /* set first carry be zero */
+
+ /* Now perform addition until every digits of b will be */
+ /* exhausted. */
+ while(b_pos > 0) {
+ c->frac[--c_pos] = a->frac[--a_pos] + b->frac[--b_pos] + carry;
+ if(c->frac[c_pos] >= BASE) {
+ c->frac[c_pos] -= BASE;
+ carry = 1;
+ } else {
+ carry = 0;
+ }
+ }
+
+ /* Just assign the first few digits of a with considering */
+ /* the carry obtained so far because b has been exhausted. */
+ while(a_pos > 0) {
+ c->frac[--c_pos] = a->frac[--a_pos] + carry;
+ if(c->frac[c_pos] >= BASE) {
+ c->frac[c_pos] -= BASE;
+ carry = 1;
+ } else {
+ carry = 0;
+ }
+ }
+ if(c_pos) c->frac[c_pos - 1] += carry;
+ goto Exit;
+
+Assign_a:
+ VpAsgn(c, a, 1);
+ mrv = 0;
+
+Exit:
+
+#ifdef _DEBUG
+ if(gfDebug) {
+ VPrint(stdout, "VpAddAbs exit: c=% \n", c);
+ }
+#endif /* _DEBUG */
+ return mrv;
+}
+
+/*
+ * c = abs(a) - abs(b)
+ */
+static U_LONG
+VpSubAbs(Real *a, Real *b, Real *c)
+{
+ U_LONG word_shift;
+ U_LONG mrv;
+ U_LONG borrow;
+ U_LONG ap;
+ U_LONG bp;
+ U_LONG cp;
+ U_LONG a_pos;
+ U_LONG b_pos;
+ U_LONG c_pos;
+ U_LONG av, bv;
+
+#ifdef _DEBUG
+ if(gfDebug) {
+ VPrint(stdout, "VpSubAbs called: a = %\n", a);
+ VPrint(stdout, " b = %\n", b);
+ }
+#endif /* _DEBUG */
+
+ word_shift = VpSetPTR(a, b, c, &ap, &bp, &cp, &av, &bv);
+ a_pos = ap;
+ b_pos = bp;
+ c_pos = cp;
+ if(word_shift==-1L) return 0; /* Overflow */
+ if(b_pos == -1L) goto Assign_a;
+
+ if(av >= bv) {
+ mrv = av - bv;
+ borrow = 0;
+ } else {
+ mrv = 0;
+ borrow = 1;
+ }
+
+ /* Just assign the values which are the BASE subtracted by */
+ /* each of the last few digits of the b because the a has no */
+ /* corresponding digits to be subtracted. */
+ if(b_pos + word_shift > a_pos) {
+ while(b_pos + word_shift > a_pos) {
+ --c_pos;
+ if(b_pos > 0) {
+ c->frac[c_pos] = BASE - b->frac[--b_pos] - borrow;
+ } else {
+ --word_shift;
+ c->frac[c_pos] = BASE - borrow;
+ }
+ borrow = 1;
+ }
+ }
+ /* Just assign the last few digits of a to c because b has no */
+ /* corresponding digits to subtract. */
+
+ bv = b_pos + word_shift;
+ while(a_pos > bv) {
+ c->frac[--c_pos] = a->frac[--a_pos];
+ }
+
+ /* Now perform subtraction until every digits of b will be */
+ /* exhausted. */
+ while(b_pos > 0) {
+ --c_pos;
+ if(a->frac[--a_pos] < b->frac[--b_pos] + borrow) {
+ c->frac[c_pos] = BASE + a->frac[a_pos] - b->frac[b_pos] - borrow;
+ borrow = 1;
+ } else {
+ c->frac[c_pos] = a->frac[a_pos] - b->frac[b_pos] - borrow;
+ borrow = 0;
+ }
+ }
+
+ /* Just assign the first few digits of a with considering */
+ /* the borrow obtained so far because b has been exhausted. */
+ while(a_pos > 0) {
+ --c_pos;
+ if(a->frac[--a_pos] < borrow) {
+ c->frac[c_pos] = BASE + a->frac[a_pos] - borrow;
+ borrow = 1;
+ } else {
+ c->frac[c_pos] = a->frac[a_pos] - borrow;
+ borrow = 0;
+ }
+ }
+ if(c_pos) c->frac[c_pos - 1] -= borrow;
+ goto Exit;
+
+Assign_a:
+ VpAsgn(c, a, 1);
+ mrv = 0;
+
+Exit:
+#ifdef _DEBUG
+ if(gfDebug) {
+ VPrint(stdout, "VpSubAbs exit: c=% \n", c);
+ }
+#endif /* _DEBUG */
+ return mrv;
+}
+
+/*
+ * Note: If(av+bv)>= HALF_BASE,then 1 will be added to the least significant
+ * digit of c(In case of addition).
+ * ------------------------- figure of output -----------------------------------
+ * a = xxxxxxxxxxx
+ * b = xxxxxxxxxx
+ * c =xxxxxxxxxxxxxxx
+ * word_shift = | |
+ * right_word = | | (Total digits in RHSV)
+ * left_word = | | (Total digits in LHSV)
+ * a_pos = |
+ * b_pos = |
+ * c_pos = |
+ */
+static U_LONG
+VpSetPTR(Real *a, Real *b, Real *c, U_LONG *a_pos, U_LONG *b_pos, U_LONG *c_pos, U_LONG *av, U_LONG *bv)
+{
+ U_LONG left_word, right_word, word_shift;
+ c->frac[0] = 0;
+ *av = *bv = 0;
+ word_shift =((a->exponent) -(b->exponent));
+ left_word = b->Prec + word_shift;
+ right_word = Max((a->Prec),left_word);
+ left_word =(c->MaxPrec) - 1; /* -1 ... prepare for round up */
+ /*
+ * check if 'round' is needed.
+ */
+ if(right_word > left_word) { /* round ? */
+ /*---------------------------------
+ * Actual size of a = xxxxxxAxx
+ * Actual size of b = xxxBxxxxx
+ * Max. size of c = xxxxxx
+ * Round off = |-----|
+ * c_pos = |
+ * right_word = |
+ * a_pos = |
+ */
+ *c_pos = right_word = left_word + 1; /* Set resulting precision */
+ /* be equal to that of c */
+ if((a->Prec) >=(c->MaxPrec)) {
+ /*
+ * a = xxxxxxAxxx
+ * c = xxxxxx
+ * a_pos = |
+ */
+ *a_pos = left_word;
+ *av = a->frac[*a_pos]; /* av is 'A' shown in above. */
+ } else {
+ /*
+ * a = xxxxxxx
+ * c = xxxxxxxxxx
+ * a_pos = |
+ */
+ *a_pos = a->Prec;
+ }
+ if((b->Prec + word_shift) >= c->MaxPrec) {
+ /*
+ * a = xxxxxxxxx
+ * b = xxxxxxxBxxx
+ * c = xxxxxxxxxxx
+ * b_pos = |
+ */
+ if(c->MaxPrec >=(word_shift + 1)) {
+ *b_pos = c->MaxPrec - word_shift - 1;
+ *bv = b->frac[*b_pos];
+ } else {
+ *b_pos = -1L;
+ }
+ } else {
+ /*
+ * a = xxxxxxxxxxxxxxxx
+ * b = xxxxxx
+ * c = xxxxxxxxxxxxx
+ * b_pos = |
+ */
+ *b_pos = b->Prec;
+ }
+ } else { /* The MaxPrec of c - 1 > The Prec of a + b */
+ /*
+ * a = xxxxxxx
+ * b = xxxxxx
+ * c = xxxxxxxxxxx
+ * c_pos = |
+ */
+ *b_pos = b->Prec;
+ *a_pos = a->Prec;
+ *c_pos = right_word + 1;
+ }
+ c->Prec = *c_pos;
+ c->exponent = a->exponent;
+ if(!AddExponent(c,(S_LONG)1)) return (-1L);
+ return word_shift;
+}
+
+/*
+ * Return number og significant digits
+ * c = a * b , Where a = a0a1a2 ... an
+ * b = b0b1b2 ... bm
+ * c = c0c1c2 ... cl
+ * a0 a1 ... an * bm
+ * a0 a1 ... an * bm-1
+ * . . .
+ * . . .
+ * a0 a1 .... an * b0
+ * +_____________________________
+ * c0 c1 c2 ...... cl
+ * nc <---|
+ * MaxAB |--------------------|
+ */
+VP_EXPORT int
+VpMult(Real *c, Real *a, Real *b)
+{
+ U_LONG MxIndA, MxIndB, MxIndAB, MxIndC;
+ U_LONG ind_c, i, ii, nc;
+ U_LONG ind_as, ind_ae, ind_bs, ind_be;
+ U_LONG Carry, s;
+ Real *w;
+
+#ifdef _DEBUG
+ if(gfDebug) {
+ VPrint(stdout, "VpMult(Enter): a=% \n", a);
+ VPrint(stdout, " b=% \n", b);
+ }
+#endif /* _DEBUG */
+
+ if(!VpIsDefOP(c,a,b,3)) return 0; /* No significant digit */
+
+ if(VpIsZero(a) || VpIsZero(b)) {
+ /* at least a or b is zero */
+ VpSetZero(c,VpGetSign(a)*VpGetSign(b));
+ return 1; /* 0: 1 significant digit */
+ }
+
+ if(VpIsOne(a)) {
+ VpAsgn(c, b, VpGetSign(a));
+ goto Exit;
+ }
+ if(VpIsOne(b)) {
+ VpAsgn(c, a, VpGetSign(b));
+ goto Exit;
+ }
+ if((b->Prec) >(a->Prec)) {
+ /* Adjust so that digits(a)>digits(b) */
+ w = a;
+ a = b;
+ b = w;
+ }
+ w = NULL;
+ MxIndA = a->Prec - 1;
+ MxIndB = b->Prec - 1;
+ MxIndC = c->MaxPrec - 1;
+ MxIndAB = a->Prec + b->Prec - 1;
+
+ if(MxIndC < MxIndAB) { /* The Max. prec. of c < Prec(a)+Prec(b) */
+ w = c;
+ c = VpAlloc((U_LONG)((MxIndAB + 1) * BASE_FIG), "#0");
+ MxIndC = MxIndAB;
+ }
+
+ /* set LHSV c info */
+
+ c->exponent = a->exponent; /* set exponent */
+ if(!AddExponent(c,b->exponent)) return 0;
+ VpSetSign(c,VpGetSign(a)*VpGetSign(b)); /* set sign */
+ Carry = 0;
+ nc = ind_c = MxIndAB;
+ memset(c->frac, 0, (nc + 1) * sizeof(U_LONG)); /* Initialize c */
+ c->Prec = nc + 1; /* set precision */
+ for(nc = 0; nc < MxIndAB; ++nc, --ind_c) {
+ if(nc < MxIndB) { /* The left triangle of the Fig. */
+ ind_as = MxIndA - nc;
+ ind_ae = MxIndA;
+ ind_bs = MxIndB;
+ ind_be = MxIndB - nc;
+ } else if(nc <= MxIndA) { /* The middle rectangular of the Fig. */
+ ind_as = MxIndA - nc;
+ ind_ae = MxIndA -(nc - MxIndB);
+ ind_bs = MxIndB;
+ ind_be = 0;
+ } else if(nc > MxIndA) { /* The right triangle of the Fig. */
+ ind_as = 0;
+ ind_ae = MxIndAB - nc - 1;
+ ind_bs = MxIndB -(nc - MxIndA);
+ ind_be = 0;
+ }
+
+ for(i = ind_as; i <= ind_ae; ++i) {
+ s =((a->frac[i]) *(b->frac[ind_bs--]));
+ Carry = s / BASE;
+ s = s -(Carry * BASE);
+ c->frac[ind_c] += s;
+ if(c->frac[ind_c] >= BASE) {
+ s = c->frac[ind_c] / BASE;
+ Carry += s;
+ c->frac[ind_c] -= (s * BASE);
+ }
+ if(Carry) {
+ ii = ind_c;
+ while((--ii) >= 0) {
+ c->frac[ii] += Carry;
+ if(c->frac[ii] >= BASE) {
+ Carry = c->frac[ii] / BASE;
+ c->frac[ii] -=(Carry * BASE);
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ }
+ if(w != NULL) { /* free work variable */
+ VpNmlz(c);
+ VpAsgn(w, c, 1);
+ VpFree(c);
+ c = w;
+ } else {
+ VpLimitRound(c,0);
+ }
+
+Exit:
+#ifdef _DEBUG
+ if(gfDebug) {
+ VPrint(stdout, "VpMult(c=a*b): c=% \n", c);
+ VPrint(stdout, " a=% \n", a);
+ VPrint(stdout, " b=% \n", b);
+ }
+#endif /*_DEBUG */
+ return c->Prec*BASE_FIG;
+}
+
+/*
+ * c = a / b, remainder = r
+ */
+VP_EXPORT int
+VpDivd(Real *c, Real *r, Real *a, Real *b)
+{
+ U_LONG word_a, word_b, word_c, word_r;
+ U_LONG i, n, ind_a, ind_b, ind_c, ind_r;
+ U_LONG nLoop;
+ U_LONG q, b1, b1p1, b1b2, b1b2p1, r1r2;
+ U_LONG borrow, borrow1, borrow2, qb;
+
+#ifdef _DEBUG
+ if(gfDebug) {
+ VPrint(stdout, " VpDivd(c=a/b) a=% \n", a);
+ VPrint(stdout, " b=% \n", b);
+ }
+#endif /*_DEBUG */
+
+ VpSetNaN(r);
+ if(!VpIsDefOP(c,a,b,4)) goto Exit;
+ if(VpIsZero(a)&&VpIsZero(b)) {
+ VpSetNaN(c);
+ return VpException(VP_EXCEPTION_NaN,"(VpDivd) 0/0 not defined(NaN)",0);
+ }
+ if(VpIsZero(b)) {
+ VpSetInf(c,VpGetSign(a)*VpGetSign(b));
+ return VpException(VP_EXCEPTION_ZERODIVIDE,"(VpDivd) Divide by zero",0);
+ }
+ if(VpIsZero(a)) {
+ /* numerator a is zero */
+ VpSetZero(c,VpGetSign(a)*VpGetSign(b));
+ VpSetZero(r,VpGetSign(a)*VpGetSign(b));
+ goto Exit;
+ }
+ if(VpIsOne(b)) {
+ /* divide by one */
+ VpAsgn(c, a, VpGetSign(b));
+ VpSetZero(r,VpGetSign(a));
+ goto Exit;
+ }
+
+ word_a = a->Prec;
+ word_b = b->Prec;
+ word_c = c->MaxPrec;
+ word_r = r->MaxPrec;
+
+ ind_c = 0;
+ ind_r = 1;
+
+ if(word_a >= word_r) goto space_error;
+
+ r->frac[0] = 0;
+ while(ind_r <= word_a) {
+ r->frac[ind_r] = a->frac[ind_r - 1];
+ ++ind_r;
+ }
+
+ while(ind_r < word_r) r->frac[ind_r++] = 0;
+ while(ind_c < word_c) c->frac[ind_c++] = 0;
+
+ /* initial procedure */
+ b1 = b1p1 = b->frac[0];
+ if(b->Prec <= 1) {
+ b1b2p1 = b1b2 = b1p1 * BASE;
+ } else {
+ b1p1 = b1 + 1;
+ b1b2p1 = b1b2 = b1 * BASE + b->frac[1];
+ if(b->Prec > 2) ++b1b2p1;
+ }
+
+ /* */
+ /* loop start */
+ ind_c = word_r - 1;
+ nLoop = Min(word_c,ind_c);
+ ind_c = 1;
+ while(ind_c < nLoop) {
+ if(r->frac[ind_c] == 0) {
+ ++ind_c;
+ continue;
+ }
+ r1r2 = r->frac[ind_c] * BASE + r->frac[ind_c + 1];
+ if(r1r2 == b1b2) {
+ /* The first two word digits is the same */
+ ind_b = 2;
+ ind_a = ind_c + 2;
+ while(ind_b < word_b) {
+ if(r->frac[ind_a] < b->frac[ind_b]) goto div_b1p1;
+ if(r->frac[ind_a] > b->frac[ind_b]) break;
+ ++ind_a;
+ ++ind_b;
+ }
+ /* The first few word digits of r and b is the same and */
+ /* the first different word digit of w is greater than that */
+ /* of b, so quotinet is 1 and just subtract b from r. */
+ borrow = 0; /* quotient=1, then just r-b */
+ ind_b = b->Prec - 1;
+ ind_r = ind_c + ind_b;
+ if(ind_r >= word_r) goto space_error;
+ n = ind_b;
+ for(i = 0; i <= n; ++i) {
+ if(r->frac[ind_r] < b->frac[ind_b] + borrow) {
+ r->frac[ind_r] +=(BASE -(b->frac[ind_b] + borrow));
+ borrow = 1;
+ } else {
+ r->frac[ind_r] = r->frac[ind_r] - b->frac[ind_b] - borrow;
+ borrow = 0;
+ }
+ --ind_r;
+ --ind_b;
+ }
+ ++(c->frac[ind_c]);
+ goto carry;
+ }
+ /* The first two word digits is not the same, */
+ /* then compare magnitude, and divide actually. */
+ if(r1r2 >= b1b2p1) {
+ q = r1r2 / b1b2p1;
+ c->frac[ind_c] += q;
+ ind_r = b->Prec + ind_c - 1;
+ goto sub_mult;
+ }
+
+div_b1p1:
+ if(ind_c + 1 >= word_c) goto out_side;
+ q = r1r2 / b1p1;
+ c->frac[ind_c + 1] += q;
+ ind_r = b->Prec + ind_c;
+
+sub_mult:
+ borrow1 = borrow2 = 0;
+ ind_b = word_b - 1;
+ if(ind_r >= word_r) goto space_error;
+ n = ind_b;
+ for(i = 0; i <= n; ++i) {
+ /* now, perform r = r - q * b */
+ qb = q *(b->frac[ind_b]);
+ if(qb < BASE) borrow1 = 0;
+ else {
+ borrow1 = qb / BASE;
+ qb = qb - borrow1 * BASE;
+ }
+ if(r->frac[ind_r] < qb) {
+ r->frac[ind_r] +=(BASE - qb);
+ borrow2 = borrow2 + borrow1 + 1;
+ } else {
+ r->frac[ind_r] -= qb;
+ borrow2 += borrow1;
+ }
+ if(borrow2) {
+ if(r->frac[ind_r - 1] < borrow2) {
+ r->frac[ind_r - 1] +=(BASE - borrow2);
+ borrow2 = 1;
+ } else {
+ r->frac[ind_r - 1] -= borrow2;
+ borrow2 = 0;
+ }
+ }
+ --ind_r;
+ --ind_b;
+ }
+
+ r->frac[ind_r] -= borrow2;
+carry:
+ ind_r = ind_c;
+ while(c->frac[ind_r] >= BASE) {
+ c->frac[ind_r] -= BASE;
+ --ind_r;
+ ++(c->frac[ind_r]);
+ }
+ }
+ /* End of operation, now final arrangement */
+out_side:
+ c->Prec = word_c;
+ c->exponent = a->exponent;
+ if(!AddExponent(c,(S_LONG)2)) return 0;
+ if(!AddExponent(c,-(b->exponent))) return 0;
+
+ VpSetSign(c,VpGetSign(a)*VpGetSign(b));
+ VpNmlz(c); /* normalize c */
+ r->Prec = word_r;
+ r->exponent = a->exponent;
+ if(!AddExponent(r,(S_LONG)1)) return 0;
+ VpSetSign(r,VpGetSign(a));
+ VpNmlz(r); /* normalize r(remainder) */
+ goto Exit;
+
+space_error:
+#ifdef _DEBUG
+ if(gfDebug) {
+ printf(" word_a=%lu\n", word_a);
+ printf(" word_b=%lu\n", word_b);
+ printf(" word_c=%lu\n", word_c);
+ printf(" word_r=%lu\n", word_r);
+ printf(" ind_r =%lu\n", ind_r);
+ }
+#endif /* _DEBUG */
+ rb_bug("ERROR(VpDivd): space for remainder too small.");
+
+Exit:
+#ifdef _DEBUG
+ if(gfDebug) {
+ VPrint(stdout, " VpDivd(c=a/b), c=% \n", c);
+ VPrint(stdout, " r=% \n", r);
+ }
+#endif /* _DEBUG */
+ return c->Prec*BASE_FIG;
+}
+
+/*
+ * Input a = 00000xxxxxxxx En(5 preceeding zeros)
+ * Output a = xxxxxxxx En-5
+ */
+static int
+VpNmlz(Real *a)
+{
+ U_LONG ind_a, i;
+
+ if(!VpIsDef(a)) goto NoVal;
+ if(VpIsZero(a)) goto NoVal;
+
+ ind_a = a->Prec;
+ while(ind_a--) {
+ if(a->frac[ind_a]) {
+ a->Prec = ind_a + 1;
+ i = 0;
+ while(a->frac[i] == 0) ++i; /* skip the first few zeros */
+ if(i) {
+ a->Prec -= i;
+ if(!AddExponent(a,-((S_INT)i))) return 0;
+ memmove(&(a->frac[0]),&(a->frac[i]),(a->Prec)*sizeof(U_LONG));
+ }
+ return 1;
+ }
+ }
+ /* a is zero(no non-zero digit) */
+ VpSetZero(a,VpGetSign(a));
+ return 0;
+
+NoVal:
+ a->frac[0] = 0;
+ a->Prec=1;
+ return 0;
+}
+
+/*
+ * VpComp = 0 ... if a=b,
+ * Pos ... a>b,
+ * Neg ... a<b.
+ * 999 ... result undefined(NaN)
+ */
+VP_EXPORT int
+VpComp(Real *a, Real *b)
+{
+ int val;
+ U_LONG mx, ind;
+ int e;
+ val = 0;
+ if(VpIsNaN(a)||VpIsNaN(b)) return 999;
+ if(!VpIsDef(a)) {
+ if(!VpIsDef(b)) e = a->sign - b->sign;
+ else e = a->sign;
+ if(e>0) return 1;
+ else if(e<0) return -1;
+ else return 0;
+ }
+ if(!VpIsDef(b)) {
+ e = -b->sign;
+ if(e>0) return 1;
+ else return -1;
+ }
+ /* Zero check */
+ if(VpIsZero(a)) {
+ if(VpIsZero(b)) return 0; /* both zero */
+ val = -VpGetSign(b);
+ goto Exit;
+ }
+ if(VpIsZero(b)) {
+ val = VpGetSign(a);
+ goto Exit;
+ }
+
+ /* compare sign */
+ if(VpGetSign(a) > VpGetSign(b)) {
+ val = 1; /* a>b */
+ goto Exit;
+ }
+ if(VpGetSign(a) < VpGetSign(b)) {
+ val = -1; /* a<b */
+ goto Exit;
+ }
+
+ /* a and b have same sign, && signe!=0,then compare exponent */
+ if((a->exponent) >(b->exponent)) {
+ val = VpGetSign(a);
+ goto Exit;
+ }
+ if((a->exponent) <(b->exponent)) {
+ val = -VpGetSign(b);
+ goto Exit;
+ }
+
+ /* a and b have same exponent, then compare significand. */
+ mx =((a->Prec) <(b->Prec)) ?(a->Prec) :(b->Prec);
+ ind = 0;
+ while(ind < mx) {
+ if((a->frac[ind]) >(b->frac[ind])) {
+ val = VpGetSign(a);
+ goto Exit;
+ }
+ if((a->frac[ind]) <(b->frac[ind])) {
+ val = -VpGetSign(b);
+ goto Exit;
+ }
+ ++ind;
+ }
+ if((a->Prec) >(b->Prec)) {
+ val = VpGetSign(a);
+ } else if((a->Prec) <(b->Prec)) {
+ val = -VpGetSign(b);
+ }
+
+Exit:
+ if (val> 1) val = 1;
+ else if(val<-1) val = -1;
+
+#ifdef _DEBUG
+ if(gfDebug) {
+ VPrint(stdout, " VpComp a=%\n", a);
+ VPrint(stdout, " b=%\n", b);
+ printf(" ans=%d\n", val);
+ }
+#endif /* _DEBUG */
+ return (int)val;
+}
+
+#ifdef _DEBUG
+/*
+ * cntl_chr ... ASCIIZ Character, print control characters
+ * Available control codes:
+ * % ... VP variable. To print '%', use '%%'.
+ * \n ... new line
+ * \b ... backspace
+ * ... tab
+ * Note: % must must not appear more than once
+ * a ... VP variable to be printed
+ */
+VP_EXPORT int
+VPrint(FILE *fp, char *cntl_chr, Real *a)
+{
+ U_LONG i, j, nc, nd, ZeroSup;
+ U_LONG n, m, e, nn;
+
+ /* Check if NaN & Inf. */
+ if(VpIsNaN(a)) {
+ fprintf(fp,SZ_NaN);
+ return 8;
+ }
+ if(VpIsPosInf(a)) {
+ fprintf(fp,SZ_INF);
+ return 8;
+ }
+ if(VpIsNegInf(a)) {
+ fprintf(fp,SZ_NINF);
+ return 9;
+ }
+ if(VpIsZero(a)) {
+ fprintf(fp,"0.0");
+ return 3;
+ }
+
+ j = 0;
+ nd = nc = 0; /* nd : number of digits in fraction part(every 10 digits, */
+ /* nd<=10). */
+ /* nc : number of caracters printed */
+ ZeroSup = 1; /* Flag not to print the leading zeros as 0.00xxxxEnn */
+ while(*(cntl_chr + j)) {
+ if((*(cntl_chr + j) == '%') &&(*(cntl_chr + j + 1) != '%')) {
+ nc = 0;
+ if(!VpIsZero(a)) {
+ if(VpGetSign(a) < 0) {
+ fprintf(fp, "-");
+ ++nc;
+ }
+ nc += fprintf(fp, "0.");
+ n = a->Prec;
+ for(i=0;i < n;++i) {
+ m = BASE1;
+ e = a->frac[i];
+ while(m) {
+ nn = e / m;
+ if((!ZeroSup) || nn) {
+ nc += fprintf(fp, "%lu", nn); /* The reading zero(s) */
+ /* as 0.00xx will not */
+ /* be printed. */
+ ++nd;
+ ZeroSup = 0; /* Set to print succeeding zeros */
+ }
+ if(nd >= 10) { /* print ' ' after every 10 digits */
+ nd = 0;
+ nc += fprintf(fp, " ");
+ }
+ e = e - nn * m;
+ m /= 10;
+ }
+ }
+ nc += fprintf(fp, "E%ld", VpExponent10(a));
+ } else {
+ nc += fprintf(fp, "0.0");
+ }
+ } else {
+ ++nc;
+ if(*(cntl_chr + j) == '\\') {
+ switch(*(cntl_chr + j + 1)) {
+ case 'n':
+ fprintf(fp, "\n");
+ ++j;
+ break;
+ case 't':
+ fprintf(fp, "\t");
+ ++j;
+ break;
+ case 'b':
+ fprintf(fp, "\n");
+ ++j;
+ break;
+ default:
+ fprintf(fp, "%c", *(cntl_chr + j));
+ break;
+ }
+ } else {
+ fprintf(fp, "%c", *(cntl_chr + j));
+ if(*(cntl_chr + j) == '%') ++j;
+ }
+ }
+ j++;
+ }
+ return (int)nc;
+}
+#endif /* _DEBUG */
+
+static void
+VpFormatSt(char *psz,S_INT fFmt)
+{
+ U_LONG ie;
+ U_LONG i;
+ S_INT nf = 0;
+ char ch;
+
+ if(fFmt<=0) return;
+
+ ie = strlen(psz);
+ for(i = 0; i < ie; ++i) {
+ ch = psz[i];
+ if(!ch) break;
+ if(ISSPACE(ch) || ch=='-' || ch=='+') continue;
+ if(ch == '.') { nf = 0;continue;}
+ if(ch == 'E') break;
+ nf++;
+ if(nf > fFmt) {
+ memmove(psz + i + 1, psz + i, ie - i + 1);
+ ++ie;
+ nf = 0;
+ psz[i] = ' ';
+ }
+ }
+}
+
+VP_EXPORT S_LONG
+VpExponent10(Real *a)
+{
+ S_LONG ex;
+ U_LONG n;
+
+ if(!VpHasVal(a)) return 0;
+
+ ex =(a->exponent) * BASE_FIG;
+ n = BASE1;
+ while((a->frac[0] / n) == 0) {
+ --ex;
+ n /= 10;
+ }
+ return ex;
+}
+
+VP_EXPORT void
+VpSzMantissa(Real *a,char *psz)
+{
+ U_LONG i, ZeroSup;
+ U_LONG n, m, e, nn;
+
+ if(VpIsNaN(a)) {
+ sprintf(psz,SZ_NaN);
+ return;
+ }
+ if(VpIsPosInf(a)) {
+ sprintf(psz,SZ_INF);
+ return;
+ }
+ if(VpIsNegInf(a)) {
+ sprintf(psz,SZ_NINF);
+ return;
+ }
+
+ ZeroSup = 1; /* Flag not to print the leading zeros as 0.00xxxxEnn */
+ if(!VpIsZero(a)) {
+ if(VpGetSign(a) < 0) *psz++ = '-';
+ n = a->Prec;
+ for(i=0;i < n;++i) {
+ m = BASE1;
+ e = a->frac[i];
+ while(m) {
+ nn = e / m;
+ if((!ZeroSup) || nn) {
+ sprintf(psz, "%lu", nn); /* The reading zero(s) */
+ psz += strlen(psz);
+ /* as 0.00xx will be ignored. */
+ ZeroSup = 0; /* Set to print succeeding zeros */
+ }
+ e = e - nn * m;
+ m /= 10;
+ }
+ }
+ *psz = 0;
+ while(psz[-1]=='0') *(--psz) = 0;
+ } else {
+ if(VpIsPosZero(a)) sprintf(psz, "0");
+ else sprintf(psz, "-0");
+ }
+}
+
+VP_EXPORT int
+VpToSpecialString(Real *a,char *psz,int fPlus)
+/* fPlus =0:default, =1: set ' ' before digits , =2: set '+' before digits. */
+{
+ if(VpIsNaN(a)) {
+ sprintf(psz,SZ_NaN);
+ return 1;
+ }
+
+ if(VpIsPosInf(a)) {
+ if(fPlus==1) {
+ *psz++ = ' ';
+ } else if(fPlus==2) {
+ *psz++ = '+';
+ }
+ sprintf(psz,SZ_INF);
+ return 1;
+ }
+ if(VpIsNegInf(a)) {
+ sprintf(psz,SZ_NINF);
+ return 1;
+ }
+ if(VpIsZero(a)) {
+ if(VpIsPosZero(a)) {
+ if(fPlus==1) sprintf(psz, " 0.0");
+ else if(fPlus==2) sprintf(psz, "+0.0");
+ else sprintf(psz, "0.0");
+ } else sprintf(psz, "-0.0");
+ return 1;
+ }
+ return 0;
+}
+
+VP_EXPORT void
+VpToString(Real *a,char *psz,int fFmt,int fPlus)
+/* fPlus =0:default, =1: set ' ' before digits , =2:set '+' before digits. */
+{
+ U_LONG i, ZeroSup;
+ U_LONG n, m, e, nn;
+ char *pszSav = psz;
+ S_LONG ex;
+
+ if(VpToSpecialString(a,psz,fPlus)) return;
+
+ ZeroSup = 1; /* Flag not to print the leading zeros as 0.00xxxxEnn */
+
+ if(VpGetSign(a) < 0) *psz++ = '-';
+ else if(fPlus==1) *psz++ = ' ';
+ else if(fPlus==2) *psz++ = '+';
+
+ *psz++ = '0';
+ *psz++ = '.';
+ n = a->Prec;
+ for(i=0;i < n;++i) {
+ m = BASE1;
+ e = a->frac[i];
+ while(m) {
+ nn = e / m;
+ if((!ZeroSup) || nn) {
+ sprintf(psz, "%lu", nn); /* The reading zero(s) */
+ psz += strlen(psz);
+ /* as 0.00xx will be ignored. */
+ ZeroSup = 0; /* Set to print succeeding zeros */
+ }
+ e = e - nn * m;
+ m /= 10;
+ }
+ }
+ ex =(a->exponent) * BASE_FIG;
+ n = BASE1;
+ while((a->frac[0] / n) == 0) {
+ --ex;
+ n /= 10;
+ }
+ while(psz[-1]=='0') *(--psz) = 0;
+ sprintf(psz, "E%ld", ex);
+ if(fFmt) VpFormatSt(pszSav, fFmt);
+}
+
+VP_EXPORT void
+VpToFString(Real *a,char *psz,int fFmt,int fPlus)
+/* fPlus =0:default,=1: set ' ' before digits ,set '+' before digits. */
+{
+ U_LONG i;
+ U_LONG n, m, e, nn;
+ char *pszSav = psz;
+ S_LONG ex;
+
+ if(VpToSpecialString(a,psz,fPlus)) return;
+
+ if(VpGetSign(a) < 0) *psz++ = '-';
+ else if(fPlus==1) *psz++ = ' ';
+ else if(fPlus==2) *psz++ = '+';
+
+ n = a->Prec;
+ ex = a->exponent;
+ if(ex<=0) {
+ *psz++ = '0';*psz++ = '.';
+ while(ex<0) {
+ for(i=0;i<BASE_FIG;++i) *psz++ = '0';
+ ++ex;
+ }
+ ex = -1;
+ }
+
+ for(i=0;i < n;++i) {
+ --ex;
+ if(i==0 && ex >= 0) {
+ sprintf(psz, "%lu", a->frac[i]);
+ psz += strlen(psz);
+ } else {
+ m = BASE1;
+ e = a->frac[i];
+ while(m) {
+ nn = e / m;
+ *psz++ = (char)(nn + '0');
+ e = e - nn * m;
+ m /= 10;
+ }
+ }
+ if(ex == 0) *psz++ = '.';
+ }
+ while(--ex>=0) {
+ m = BASE;
+ while(m/=10) *psz++ = '0';
+ if(ex == 0) *psz++ = '.';
+ }
+ *psz = 0;
+ while(psz[-1]=='0') *(--psz) = 0;
+ if(psz[-1]=='.') sprintf(psz, "0");
+ if(fFmt) VpFormatSt(pszSav, fFmt);
+}
+
+/*
+ * [Output]
+ * a[] ... variable to be assigned the value.
+ * [Input]
+ * int_chr[] ... integer part(may include '+/-').
+ * ni ... number of characters in int_chr[],not including '+/-'.
+ * frac[] ... fraction part.
+ * nf ... number of characters in frac[].
+ * exp_chr[] ... exponent part(including '+/-').
+ * ne ... number of characters in exp_chr[],not including '+/-'.
+ */
+VP_EXPORT int
+VpCtoV(Real *a, char *int_chr, U_LONG ni, char *frac, U_LONG nf, char *exp_chr, U_LONG ne)
+{
+ U_LONG i, j, ind_a, ma, mi, me;
+ U_LONG loc;
+ S_INT e,es, eb, ef;
+ S_INT sign, signe;
+ /* get exponent part */
+ e = 0;
+ ma = a->MaxPrec;
+ mi = ni;
+ me = ne;
+ signe = 1;
+ memset(a->frac, 0, ma * sizeof(U_LONG));
+ if(ne > 0) {
+ i = 0;
+ if(exp_chr[0] == '-') {
+ signe = -1;
+ ++i;
+ ++me;
+ } else if(exp_chr[0] == '+') {
+ ++i;
+ ++me;
+ }
+ while(i < me) {
+ es = e*((S_INT)BASE_FIG);
+ e = e * 10 + exp_chr[i] - '0';
+ if(es>e*((S_INT)BASE_FIG)) {
+ return VpException(VP_EXCEPTION_INFINITY,"Exponent overflow",0);
+ }
+ ++i;
+ }
+ }
+
+ /* get integer part */
+ i = 0;
+ sign = 1;
+ if(ni > 0) {
+ if(int_chr[0] == '-') {
+ sign = -1;
+ ++i;
+ ++mi;
+ } else if(int_chr[0] == '+') {
+ ++i;
+ ++mi;
+ }
+ }
+
+ e = signe * e; /* e: The value of exponent part. */
+ e = e + ni; /* set actual exponent size. */
+
+ if(e > 0) signe = 1;
+ else signe = -1;
+
+ /* Adjust the exponent so that it is the multiple of BASE_FIG. */
+ j = 0;
+ ef = 1;
+ while(ef) {
+ if(e>=0) eb = e;
+ else eb = -e;
+ ef = eb / ((S_INT)BASE_FIG);
+ ef = eb - ef * ((S_INT)BASE_FIG);
+ if(ef) {
+ ++j; /* Means to add one more preceeding zero */
+ ++e;
+ }
+ }
+
+ eb = e / ((S_INT)BASE_FIG);
+
+ ind_a = 0;
+ while(i < mi) {
+ a->frac[ind_a] = 0;
+ while((j < (U_LONG)BASE_FIG) &&(i < mi)) {
+ a->frac[ind_a] = a->frac[ind_a] * 10 + int_chr[i] - '0';
+ ++j;
+ ++i;
+ }
+ if(i < mi) {
+ ++ind_a;
+ if(ind_a >= ma) goto over_flow;
+ j = 0;
+ }
+ }
+ loc = 1;
+
+ /* get fraction part */
+
+ i = 0;
+ while(i < nf) {
+ while((j < (U_LONG)BASE_FIG) &&(i < nf)) {
+ a->frac[ind_a] = a->frac[ind_a] * 10 + frac[i] - '0';
+ ++j;
+ ++i;
+ }
+ if(i < nf) {
+ ++ind_a;
+ if(ind_a >= ma) goto over_flow;
+ j = 0;
+ }
+ }
+ goto Final;
+
+over_flow:
+ rb_warn("Conversion from String to BigDecimal overflow (last few digits discarded).");
+
+Final:
+ if(ind_a >= ma) ind_a = ma - 1;
+ while(j < (U_LONG)BASE_FIG) {
+ a->frac[ind_a] = a->frac[ind_a] * 10;
+ ++j;
+ }
+ a->Prec = ind_a + 1;
+ a->exponent = eb;
+ VpSetSign(a,sign);
+ VpNmlz(a);
+ return 1;
+}
+
+/*
+ * [Input]
+ * *m ... Real
+ * [Output]
+ * *d ... fraction part of m(d = 0.xxxxxxx). where # of 'x's is fig.
+ * *e ... U_LONG,exponent of m.
+ * DBLE_FIG ... Number of digits in a double variable.
+ *
+ * m -> d*10**e, 0<d<BASE
+ * [Returns]
+ * 0 ... Zero
+ * 1 ... Normal
+ * 2 ... Infinity
+ * -1 ... NaN
+ */
+VP_EXPORT int
+VpVtoD(double *d, S_LONG *e, Real *m)
+{
+ U_LONG ind_m, mm, fig;
+ double div;
+ int f = 1;
+
+ if(VpIsNaN(m)) {
+ *d = VpGetDoubleNaN();
+ *e = 0;
+ f = -1; /* NaN */
+ goto Exit;
+ } else
+ if(VpIsPosZero(m)) {
+ *d = 0.0;
+ *e = 0;
+ f = 0;
+ goto Exit;
+ } else
+ if(VpIsNegZero(m)) {
+ *d = VpGetDoubleNegZero();
+ *e = 0;
+ f = 0;
+ goto Exit;
+ } else
+ if(VpIsPosInf(m)) {
+ *d = VpGetDoublePosInf();
+ *e = 0;
+ f = 2;
+ goto Exit;
+ } else
+ if(VpIsNegInf(m)) {
+ *d = VpGetDoubleNegInf();
+ *e = 0;
+ f = 2;
+ goto Exit;
+ }
+ /* Normal number */
+ fig =(DBLE_FIG + BASE_FIG - 1) / BASE_FIG;
+ ind_m = 0;
+ mm = Min(fig,(m->Prec));
+ *d = 0.0;
+ div = 1.;
+ while(ind_m < mm) {
+ div /=(double)((S_INT)BASE);
+ *d = *d +((double) ((S_INT)m->frac[ind_m++])) * div;
+ }
+ *e = m->exponent * ((S_INT)BASE_FIG);
+ *d *= VpGetSign(m);
+
+Exit:
+#ifdef _DEBUG
+ if(gfDebug) {
+ VPrint(stdout, " VpVtoD: m=%\n", m);
+ printf(" d=%e * 10 **%ld\n", *d, *e);
+ printf(" DBLE_FIG = %ld\n", DBLE_FIG);
+ }
+#endif /*_DEBUG */
+ return f;
+}
+
+/*
+ * m <- d
+ */
+VP_EXPORT void
+VpDtoV(Real *m, double d)
+{
+ U_LONG i, ind_m, mm;
+ U_LONG ne;
+ double val, val2;
+
+ if(isnan(d)) {
+ VpSetNaN(m);
+ goto Exit;
+ }
+ if(isinf(d)) {
+ if(d>0.0) VpSetPosInf(m);
+ else VpSetNegInf(m);
+ goto Exit;
+ }
+
+ if(d == 0.0) {
+ VpSetZero(m,1);
+ goto Exit;
+ }
+ val =(d > 0.) ? d :(-d);
+ ne = 0;
+ if(val >= 1.0) {
+ while(val >= 1.0) {
+ val /=(double)((S_INT)BASE);
+ ++ne;
+ }
+ } else {
+ val2 = 1.0 /(double)((S_INT)BASE);
+ while(val < val2) {
+ val *=(double)((S_INT)BASE);
+ --ne;
+ }
+ }
+ /* Now val = 0.xxxxx*BASE**ne */
+
+ mm = m->MaxPrec;
+ memset(m->frac, 0, mm * sizeof(U_LONG));
+ for(ind_m = 0;val > 0.0 && ind_m < mm;ind_m++) {
+ val *=(double)((S_INT)BASE);
+ i =(U_LONG) val;
+ val -=(double)((S_INT)i);
+ m->frac[ind_m] = i;
+ }
+ if(ind_m >= mm) ind_m = mm - 1;
+ if(d > 0.0) {
+ VpSetSign(m, (S_INT)1);
+ } else {
+ VpSetSign(m,-(S_INT)1);
+ }
+ m->Prec = ind_m + 1;
+ m->exponent = ne;
+
+ VpInternalRound(m,0,(m->Prec>0)?m->frac[m->Prec-1]:0,
+ (U_LONG)(val*((double)((S_INT)BASE))));
+
+Exit:
+#ifdef _DEBUG
+ if(gfDebug) {
+ printf("VpDtoV d=%30.30e\n", d);
+ VPrint(stdout, " m=%\n", m);
+ }
+#endif /* _DEBUG */
+ return;
+}
+
+/*
+ * m <- ival
+ */
+VP_EXPORT void
+VpItoV(Real *m, S_INT ival)
+{
+ U_LONG mm, ind_m;
+ U_LONG val, v1, v2, v;
+ int isign;
+ S_INT ne;
+
+ if(ival == 0) {
+ VpSetZero(m,1);
+ goto Exit;
+ }
+ isign = 1;
+ val = ival;
+ if(ival < 0) {
+ isign = -1;
+ val =(U_LONG)(-ival);
+ }
+ ne = 0;
+ ind_m = 0;
+ mm = m->MaxPrec;
+ while(ind_m < mm) {
+ m->frac[ind_m] = 0;
+ ++ind_m;
+ }
+ ind_m = 0;
+ while(val > 0) {
+ if(val) {
+ v1 = val;
+ v2 = 1;
+ while(v1 >= BASE) {
+ v1 /= BASE;
+ v2 *= BASE;
+ }
+ val = val - v2 * v1;
+ v = v1;
+ } else {
+ v = 0;
+ }
+ m->frac[ind_m] = v;
+ ++ind_m;
+ ++ne;
+ }
+ m->Prec = ind_m - 1;
+ m->exponent = ne;
+ VpSetSign(m,isign);
+ VpNmlz(m);
+
+Exit:
+#ifdef _DEBUG
+ if(gfDebug) {
+ printf(" VpItoV i=%d\n", ival);
+ VPrint(stdout, " m=%\n", m);
+ }
+#endif /* _DEBUG */
+ return;
+}
+
+/*
+ * y = SQRT(x), y*y - x =>0
+ */
+VP_EXPORT int
+VpSqrt(Real *y, Real *x)
+{
+ Real *f = NULL;
+ Real *r = NULL;
+ S_LONG y_prec, f_prec;
+ S_LONG n;
+ S_LONG e;
+ S_LONG prec;
+ S_LONG nr;
+ double val;
+
+ /* Zero, NaN or Infinity ? */
+ if(!VpHasVal(x)) {
+ if(VpIsZero(x)||VpGetSign(x)>0) {
+ VpAsgn(y,x,1);
+ goto Exit;
+ }
+ VpSetNaN(y);
+ return VpException(VP_EXCEPTION_OP,"(VpSqrt) SQRT(NaN or negative value)",0);
+ goto Exit;
+ }
+
+ /* Negative ? */
+ if(VpGetSign(x) < 0) {
+ VpSetNaN(y);
+ return VpException(VP_EXCEPTION_OP,"(VpSqrt) SQRT(negative value)",0);
+ }
+
+ /* One ? */
+ if(VpIsOne(x)) {
+ VpSetOne(y);
+ goto Exit;
+ }
+
+ n = (S_LONG)y->MaxPrec;
+ if((S_LONG)x->MaxPrec > n) n = (S_LONG)x->MaxPrec;
+ /* allocate temporally variables */
+ f = VpAlloc(y->MaxPrec *(BASE_FIG + 2), "#1");
+ r = VpAlloc((n + n) *(BASE_FIG + 2), "#1");
+
+ nr = 0;
+ y_prec = (S_LONG)y->MaxPrec;
+ f_prec = (S_LONG)f->MaxPrec;
+
+ prec = x->exponent;
+ if(prec > 0) ++prec;
+ else --prec;
+ prec = prec - (S_LONG)y->MaxPrec;
+ VpVtoD(&val, &e, x); /* val <- x */
+ e /= ((S_LONG)BASE_FIG);
+ n = e / 2;
+ if(e - n * 2 != 0) {
+ val /=(double)((S_INT)BASE);
+ n =(e + 1) / 2;
+ }
+ VpDtoV(y, sqrt(val)); /* y <- sqrt(val) */
+ y->exponent += n;
+ n = (DBLE_FIG + BASE_FIG - 1) / BASE_FIG;
+ y->MaxPrec = (U_LONG)Min(n , y_prec);
+ f->MaxPrec = y->MaxPrec + 1;
+ n = y_prec*((S_LONG)BASE_FIG);
+ if((U_LONG)n<maxnr) n = (U_LONG)maxnr;
+ do {
+ y->MaxPrec *= 2;
+ if(y->MaxPrec > (U_LONG)y_prec) y->MaxPrec = (U_LONG)y_prec;
+ f->MaxPrec = y->MaxPrec;
+ VpDivd(f, r, x, y); /* f = x/y */
+ VpAddSub(r, f, y, -1); /* r = f - y */
+ VpMult(f, VpPt5, r); /* f = 0.5*r */
+ if(VpIsZero(f)) goto converge;
+ VpAddSub(r, f, y, 1); /* r = y + f */
+ VpAsgn(y, r, 1); /* y = r */
+ if(f->exponent <= prec) goto converge;
+ } while(++nr < n);
+ /* */
+#ifdef _DEBUG
+ if(gfDebug) {
+ printf("ERROR(VpSqrt): did not converge within %ld iterations.\n",
+ nr);
+ }
+#endif /* _DEBUG */
+ y->MaxPrec = y_prec;
+
+converge:
+ VpChangeSign(y,(S_INT)1);
+#ifdef _DEBUG
+ if(gfDebug) {
+ VpMult(r, y, y);
+ VpAddSub(f, x, r, -1);
+ printf("VpSqrt: iterations = %lu\n", nr);
+ VPrint(stdout, " y =% \n", y);
+ VPrint(stdout, " x =% \n", x);
+ VPrint(stdout, " x-y*y = % \n", f);
+ }
+#endif /* _DEBUG */
+ y->MaxPrec = y_prec;
+
+Exit:
+ VpFree(f);
+ VpFree(r);
+ return 1;
+}
+
+/*
+ *
+ * f = 0: Round off/Truncate, 1: round up, 2:ceil, 3: floor, 4: Banker's rounding
+ * nf: digit position for operation.
+ *
+ */
+VP_EXPORT int
+VpMidRound(Real *y, int f, int nf)
+/*
+ * Round reletively from the decimal point.
+ * f: rounding mode
+ * nf: digit location to round from the the decimal point.
+ */
+{
+ int n,i,ix,ioffset;
+ U_LONG v;
+ U_LONG div;
+
+ nf += y->exponent*((int)BASE_FIG);
+ /* ix: x->fraq[ix] contains round position */
+ ix = nf/(int)BASE_FIG;
+ if(ix<0 || ((U_LONG)ix)>=y->Prec) return 0; /* Unable to round */
+ ioffset = nf - ix*((int)BASE_FIG);
+
+ memset(y->frac+ix+1, 0, (y->Prec - (ix+1)) * sizeof(U_LONG));
+ v = y->frac[ix];
+ /* drop digits after pointed digit */
+ n = BASE_FIG - ioffset - 1;
+ for(i=0;i<n;++i) v /= 10;
+ div = v/10;
+ v = v - div*10;
+ switch(f) {
+ case VP_ROUND_DOWN: /* Truncate */
+ break;
+ case VP_ROUND_UP: /* Roundup */
+ if(v) ++div;
+ break;
+ case VP_ROUND_HALF_UP: /* Round half up */
+ if(v>=5) ++div;
+ break;
+ case VP_ROUND_HALF_DOWN: /* Round half down */
+ if(v>=6) ++div;
+ break;
+ case VP_ROUND_CEIL: /* ceil */
+ if(v && (VpGetSign(y)>0)) ++div;
+ break;
+ case VP_ROUND_FLOOR: /* floor */
+ if(v && (VpGetSign(y)<0)) ++div;
+ break;
+ case VP_ROUND_HALF_EVEN: /* Banker's rounding */
+ if(v>5) ++div;
+ else if(v==5) {
+ if((U_LONG)i==(BASE_FIG-1)) {
+ if(ix && (y->frac[ix-1]%2)) ++div;
+ } else {
+ if(div%2) ++div;
+ }
+ }
+ break;
+ }
+ for(i=0;i<=n;++i) div *= 10;
+ if(div>=BASE) {
+ if(ix) {
+ y->frac[ix] = 0;
+ VpRdup(y,ix);
+ } else {
+ S_INT s = VpGetSign(y);
+ VpSetOne(y);
+ VpSetSign(y,s);
+ }
+ } else {
+ y->frac[ix] = div;
+ VpNmlz(y);
+ }
+ return 1;
+}
+
+VP_EXPORT int
+VpLeftRound(Real *y, int f, int nf)
+/*
+ * Round from the left hand side of the digits.
+ */
+{
+ U_LONG v;
+ if(!VpHasVal(y)) return 0; /* Unable to round */
+ v = y->frac[0];
+ nf -= VpExponent(y)*BASE_FIG;
+ while(v=v/10) nf--;
+ nf += (BASE_FIG-1);
+ return VpMidRound(y,f,nf);
+}
+
+VP_EXPORT int
+VpActiveRound(Real *y, Real *x, int f, int nf)
+{
+ /* First,assign whole value in truncation mode */
+ if(VpAsgn(y, x, 10)<=1) return 0; /* Zero,NaN,or Infinity */
+ return VpMidRound(y,f,nf);
+}
+
+static int
+VpLimitRound(Real *c,U_LONG ixDigit)
+{
+ U_LONG ix = VpGetPrecLimit();
+ if(!VpNmlz(c)) return -1;
+ if(!ix) return 0;
+ if(!ixDigit) ixDigit = c->Prec-1;
+ if((ix+BASE_FIG-1)/BASE_FIG > ixDigit+1) return 0;
+ return VpLeftRound(c,VpGetRoundMode(),ix);
+}
+
+static void
+VpInternalRound(Real *c,int ixDigit,U_LONG vPrev,U_LONG v)
+{
+ int f = 0;
+
+ if(VpLimitRound(c,ixDigit)) return;
+ if(!v) return;
+
+ v /= BASE1;
+ switch(gfRoundMode) {
+ case VP_ROUND_DOWN:
+ break;
+ case VP_ROUND_UP:
+ if(v) f = 1;
+ break;
+ case VP_ROUND_HALF_UP:
+ if(v >= 5) f = 1;
+ break;
+ case VP_ROUND_HALF_DOWN:
+ if(v >= 6) f = 1;
+ break;
+ case VP_ROUND_CEIL: /* ceil */
+ if(v && (VpGetSign(c)>0)) f = 1;
+ break;
+ case VP_ROUND_FLOOR: /* floor */
+ if(v && (VpGetSign(c)<0)) f = 1;
+ break;
+ case VP_ROUND_HALF_EVEN: /* Banker's rounding */
+ if(v>5) f = 1;
+ else if(v==5 && vPrev%2) f = 1;
+ break;
+ }
+ if(f) {
+ VpRdup(c,ixDigit); /* round up */
+ VpNmlz(c);
+ }
+}
+
+/*
+ * Rounds up m(plus one to final digit of m).
+ */
+static int
+VpRdup(Real *m,U_LONG ind_m)
+{
+ U_LONG carry;
+
+ if(!ind_m) ind_m = m->Prec;
+
+ carry = 1;
+ while(carry > 0 && (ind_m--)) {
+ m->frac[ind_m] += carry;
+ if(m->frac[ind_m] >= BASE) m->frac[ind_m] -= BASE;
+ else carry = 0;
+ }
+ if(carry > 0) { /* Overflow,count exponent and set fraction part be 1 */
+ if(!AddExponent(m,(S_LONG)1)) return 0;
+ m->Prec = m->frac[0] = 1;
+ } else {
+ VpNmlz(m);
+ }
+ return 1;
+}
+
+/*
+ * y = x - fix(x)
+ */
+VP_EXPORT void
+VpFrac(Real *y, Real *x)
+{
+ U_LONG my, ind_y, ind_x;
+
+ if(!VpHasVal(x)) {
+ VpAsgn(y,x,1);
+ goto Exit;
+ }
+
+ if(x->exponent > 0 && (U_LONG)x->exponent >= x->Prec) {
+ VpSetZero(y,VpGetSign(x));
+ goto Exit;
+ } else if(x->exponent <= 0) {
+ VpAsgn(y, x, 1);
+ goto Exit;
+ }
+
+ y->Prec = x->Prec -(U_LONG) x->exponent;
+ y->Prec = Min(y->Prec, y->MaxPrec);
+ y->exponent = 0;
+ VpSetSign(y,VpGetSign(x));
+ ind_y = 0;
+ my = y->Prec;
+ ind_x = x->exponent;
+ while(ind_y < my) {
+ y->frac[ind_y] = x->frac[ind_x];
+ ++ind_y;
+ ++ind_x;
+ }
+ VpNmlz(y);
+
+Exit:
+#ifdef _DEBUG
+ if(gfDebug) {
+ VPrint(stdout, "VpFrac y=%\n", y);
+ VPrint(stdout, " x=%\n", x);
+ }
+#endif /* _DEBUG */
+ return;
+}
+
+/*
+ * y = x ** n
+ */
+VP_EXPORT int
+VpPower(Real *y, Real *x, S_INT n)
+{
+ U_LONG s, ss;
+ S_LONG sign;
+ Real *w1 = NULL;
+ Real *w2 = NULL;
+
+ if(VpIsZero(x)) {
+ if(n==0) {
+ VpSetOne(y);
+ goto Exit;
+ }
+ sign = VpGetSign(x);
+ if(n<0) {
+ n = -n;
+ if(sign<0) sign = (n%2)?(-1):(1);
+ VpSetInf (y,sign);
+ } else {
+ if(sign<0) sign = (n%2)?(-1):(1);
+ VpSetZero(y,sign);
+ }
+ goto Exit;
+ }
+ if(!VpIsDef(x)) {
+ VpSetNaN(y); /* Not sure !!! */
+ goto Exit;
+ }
+
+ if((x->exponent == 1) &&(x->Prec == 1) &&(x->frac[0] == 1)) {
+ /* abs(x) = 1 */
+ VpSetOne(y);
+ if(VpGetSign(x) > 0) goto Exit;
+ if((n % 2) == 0) goto Exit;
+ VpSetSign(y,-(S_INT)1);
+ goto Exit;
+ }
+
+ if(n > 0) sign = 1;
+ else if(n < 0) {
+ sign = -1;
+ n = -n;
+ } else {
+ VpSetOne(y);
+ goto Exit;
+ }
+
+ /* Allocate working variables */
+
+ w1 = VpAlloc((y->MaxPrec + 2) * BASE_FIG, "#0");
+ w2 = VpAlloc((w1->MaxPrec * 2 + 1) * BASE_FIG, "#0");
+ /* calculation start */
+
+ VpAsgn(y, x, 1);
+ --n;
+ while(n > 0) {
+ VpAsgn(w1, x, 1);
+ s = 1;
+loop1: ss = s;
+ s += s;
+ if(s >(U_LONG) n) goto out_loop1;
+ VpMult(w2, w1, w1);
+ VpAsgn(w1, w2, 1);
+ goto loop1;
+out_loop1:
+ n -= ss;
+ VpMult(w2, y, w1);
+ VpAsgn(y, w2, 1);
+ }
+ if(sign < 0) {
+ VpDivd(w1, w2, VpConstOne, y);
+ VpAsgn(y, w1, 1);
+ }
+
+Exit:
+#ifdef _DEBUG
+ if(gfDebug) {
+ VPrint(stdout, "VpPower y=%\n", y);
+ VPrint(stdout, "VpPower x=%\n", x);
+ printf(" n=%d\n", n);
+ }
+#endif /* _DEBUG */
+ VpFree(w2);
+ VpFree(w1);
+ return 1;
+}
+
+#ifdef _DEBUG
+int
+VpVarCheck(Real * v)
+/*
+ * Checks the validity of the Real variable v.
+ * [Input]
+ * v ... Real *, variable to be checked.
+ * [Returns]
+ * 0 ... correct v.
+ * other ... error
+ */
+{
+ U_LONG i;
+
+ if(v->MaxPrec <= 0) {
+ printf("ERROR(VpVarCheck): Illegal Max. Precision(=%lu)\n",
+ v->MaxPrec);
+ return 1;
+ }
+ if((v->Prec <= 0) ||((v->Prec) >(v->MaxPrec))) {
+ printf("ERROR(VpVarCheck): Illegal Precision(=%lu)\n", v->Prec);
+ printf(" Max. Prec.=%lu\n", v->MaxPrec);
+ return 2;
+ }
+ for(i = 0; i < v->Prec; ++i) {
+ if((v->frac[i] >= BASE)) {
+ printf("ERROR(VpVarCheck): Illegal fraction\n");
+ printf(" Frac[%ld]=%lu\n", i, v->frac[i]);
+ printf(" Prec. =%lu\n", v->Prec);
+ printf(" Exp. =%d\n", v->exponent);
+ printf(" BASE =%lu\n", BASE);
+ return 3;
+ }
+ }
+ return 0;
+}
+#endif /* _DEBUG */
diff --git a/ext/bigdecimal/bigdecimal.def b/ext/bigdecimal/bigdecimal.def
new file mode 100644
index 0000000000..8450e164e6
--- /dev/null
+++ b/ext/bigdecimal/bigdecimal.def
@@ -0,0 +1,2 @@
+EXPORTS
+Init_bigdecimal
diff --git a/ext/bigdecimal/bigdecimal.h b/ext/bigdecimal/bigdecimal.h
new file mode 100644
index 0000000000..aabc551a76
--- /dev/null
+++ b/ext/bigdecimal/bigdecimal.h
@@ -0,0 +1,216 @@
+/*
+ *
+ * Ruby BigDecimal(Variable decimal precision) extension library.
+ *
+ * Copyright(C) 2002 by Shigeo Kobayashi(shigeo@tinyforest.gr.jp)
+ *
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Artistic License, as specified in the README file
+ * of this BigDecimal distribution.
+ *
+ * NOTES:
+ * 2003-03-28 V1.0 checked in.
+ *
+ */
+
+#ifndef ____BIG_DECIMAL__H____
+#define ____BIG_DECIMAL__H____
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/*
+ * NaN & Infinity
+ */
+#define SZ_NaN "NaN"
+#define SZ_INF "Infinity"
+#define SZ_PINF "+Infinity"
+#define SZ_NINF "-Infinity"
+
+/*
+ * #define VP_EXPORT other than static to let VP_ routines
+ * be called from outside of this module.
+ */
+#define VP_EXPORT static
+
+#define U_LONG unsigned long
+#define S_LONG long
+#define U_INT unsigned int
+#define S_INT int
+
+/* Exception codes */
+#define VP_EXCEPTION_ALL ((unsigned short)0x00FF)
+#define VP_EXCEPTION_INFINITY ((unsigned short)0x0001)
+#define VP_EXCEPTION_NaN ((unsigned short)0x0002)
+#define VP_EXCEPTION_UNDERFLOW ((unsigned short)0x0004)
+#define VP_EXCEPTION_OVERFLOW ((unsigned short)0x0001) /* 0x0008) */
+#define VP_EXCEPTION_ZERODIVIDE ((unsigned short)0x0001) /* 0x0010) */
+
+/* Following 2 exceptions cann't controlled by user */
+#define VP_EXCEPTION_OP ((unsigned short)0x0020)
+#define VP_EXCEPTION_MEMORY ((unsigned short)0x0040)
+
+/* Computation mode */
+#define VP_ROUND_MODE ((unsigned short)0x0100)
+#define VP_ROUND_UP 1
+#define VP_ROUND_DOWN 2
+#define VP_ROUND_HALF_UP 3
+#define VP_ROUND_HALF_DOWN 4
+#define VP_ROUND_CEIL 5
+#define VP_ROUND_FLOOR 6
+#define VP_ROUND_HALF_EVEN 7
+
+#define VP_SIGN_NaN 0 /* NaN */
+#define VP_SIGN_POSITIVE_ZERO 1 /* Positive zero */
+#define VP_SIGN_NEGATIVE_ZERO -1 /* Negative zero */
+#define VP_SIGN_POSITIVE_FINITE 2 /* Positive finite number */
+#define VP_SIGN_NEGATIVE_FINITE -2 /* Negative finite number */
+#define VP_SIGN_POSITIVE_INFINITE 3 /* Positive infinite number */
+#define VP_SIGN_NEGATIVE_INFINITE -3 /* Negative infinite number */
+
+/*
+ * VP representation
+ * r = 0.xxxxxxxxx *BASE**exponent
+ */
+typedef struct {
+ VALUE obj; /* Back pointer(VALUE) for Ruby object. */
+ U_LONG MaxPrec; /* Maximum precision size */
+ /* This is the actual size of pfrac[] */
+ /*(frac[0] to frac[MaxPrec] are available). */
+ U_LONG Prec; /* Current precision size. */
+ /* This indicates how much the. */
+ /* the array frac[] is actually used. */
+ S_INT exponent;/* Exponent part. */
+ short sign; /* Attributes of the value. */
+ /*
+ * ==0 : NaN
+ * 1 : Positive zero
+ * -1 : Negative zero
+ * 2 : Positive number
+ * -2 : Negative number
+ * 3 : Positive infinite number
+ * -3 : Negative infinite number
+ */
+ short flag; /* Not used in vp_routines,space for user. */
+ U_LONG frac[1]; /* Pointer to array of fraction part. */
+} Real;
+
+/*
+ * ------------------
+ * EXPORTables.
+ * ------------------
+ */
+
+VP_EXPORT Real *
+VpNewRbClass(U_LONG mx,char *str,VALUE klass);
+
+VP_EXPORT Real *VpCreateRbObject(U_LONG mx,char *str);
+
+VP_EXPORT U_LONG VpBaseFig(void);
+VP_EXPORT U_LONG VpDblFig(void);
+VP_EXPORT U_LONG VpBaseVal(void);
+
+/* Zero,Inf,NaN (isinf(),isnan() used to check) */
+VP_EXPORT double VpGetDoubleNaN(void);
+VP_EXPORT double VpGetDoublePosInf(void);
+VP_EXPORT double VpGetDoubleNegInf(void);
+VP_EXPORT double VpGetDoubleNegZero(void);
+
+/* These 2 functions added at v1.1.7 */
+VP_EXPORT U_LONG VpGetPrecLimit(void);
+VP_EXPORT U_LONG VpSetPrecLimit(U_LONG n);
+
+/* Round mode */
+VP_EXPORT int VpIsRoundMode(unsigned long n);
+VP_EXPORT unsigned long VpGetRoundMode(void);
+VP_EXPORT unsigned long VpSetRoundMode(unsigned long n);
+
+VP_EXPORT int VpException(unsigned short f,char *str,int always);
+VP_EXPORT int VpIsNegDoubleZero(double v);
+VP_EXPORT U_LONG VpNumOfChars(Real *vp,char *pszFmt);
+VP_EXPORT U_LONG VpInit(U_LONG BaseVal);
+VP_EXPORT void *VpMemAlloc(U_LONG mb);
+VP_EXPORT void VpFree(Real *pv);
+VP_EXPORT Real *VpAlloc(U_LONG mx, char *szVal);
+VP_EXPORT int VpAsgn(Real *c,Real *a,int isw);
+VP_EXPORT int VpAddSub(Real *c,Real *a,Real *b,int operation);
+VP_EXPORT int VpMult(Real *c,Real *a,Real *b);
+VP_EXPORT int VpDivd(Real *c,Real *r,Real *a,Real *b);
+VP_EXPORT int VpComp(Real *a,Real *b);
+VP_EXPORT S_LONG VpExponent10(Real *a);
+VP_EXPORT void VpSzMantissa(Real *a,char *psz);
+VP_EXPORT int VpToSpecialString(Real *a,char *psz,int fPlus);
+VP_EXPORT void VpToString(Real *a,char *psz,int fFmt,int fPlus);
+VP_EXPORT void VpToFString(Real *a,char *psz,int fFmt,int fPlus);
+VP_EXPORT int VpCtoV(Real *a,char *int_chr,U_LONG ni,char *frac,U_LONG nf,char *exp_chr,U_LONG ne);
+VP_EXPORT int VpVtoD(double *d,S_LONG *e,Real *m);
+VP_EXPORT void VpDtoV(Real *m,double d);
+VP_EXPORT void VpItoV(Real *m,S_INT ival);
+VP_EXPORT int VpSqrt(Real *y,Real *x);
+VP_EXPORT int VpActiveRound(Real *y,Real *x,int f,int il);
+VP_EXPORT int VpMidRound(Real *y, int f, int nf);
+VP_EXPORT int VpLeftRound(Real *y, int f, int nf);
+VP_EXPORT void VpFrac(Real *y,Real *x);
+VP_EXPORT int VpPower(Real *y,Real *x,S_INT n);
+
+/* VP constants */
+VP_EXPORT Real *VpOne();
+
+/*
+ * ------------------
+ * MACRO definitions.
+ * ------------------
+ */
+#define Abs(a) (((a)>= 0)?(a):(-(a)))
+#define Max(a, b) (((a)>(b))?(a):(b))
+#define Min(a, b) (((a)>(b))?(b):(a))
+
+#define VpMaxPrec(a) ((a)->MaxPrec)
+#define VpPrec(a) ((a)->Prec)
+#define VpGetFlag(a) ((a)->flag)
+
+/* Sign */
+
+/* VpGetSign(a) returns 1,-1 if a>0,a<0 respectively */
+#define VpGetSign(a) (((a)->sign>0)?1:(-1))
+/* Change sign of a to a>0,a<0 if s = 1,-1 respectively */
+#define VpChangeSign(a,s) {if((s)>0) (a)->sign=(short)Abs((S_LONG)(a)->sign);else (a)->sign=-(short)Abs((S_LONG)(a)->sign);}
+/* Sets sign of a to a>0,a<0 if s = 1,-1 respectively */
+#define VpSetSign(a,s) {if((s)>0) (a)->sign=(short)VP_SIGN_POSITIVE_FINITE;else (a)->sign=(short)VP_SIGN_NEGATIVE_FINITE;}
+
+/* 1 */
+#define VpSetOne(a) {(a)->frac[0]=(a)->exponent=(a)->Prec=1;(a)->sign=VP_SIGN_POSITIVE_FINITE;}
+
+/* ZEROs */
+#define VpIsPosZero(a) ((a)->sign==VP_SIGN_POSITIVE_ZERO)
+#define VpIsNegZero(a) ((a)->sign==VP_SIGN_NEGATIVE_ZERO)
+#define VpIsZero(a) (VpIsPosZero(a) || VpIsNegZero(a))
+#define VpSetPosZero(a) ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_POSITIVE_ZERO)
+#define VpSetNegZero(a) ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_NEGATIVE_ZERO)
+#define VpSetZero(a,s) ( ((s)>0)?VpSetPosZero(a):VpSetNegZero(a) )
+
+/* NaN */
+#define VpIsNaN(a) ((a)->sign==VP_SIGN_NaN)
+#define VpSetNaN(a) ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_NaN)
+
+/* Infinity */
+#define VpIsPosInf(a) ((a)->sign==VP_SIGN_POSITIVE_INFINITE)
+#define VpIsNegInf(a) ((a)->sign==VP_SIGN_NEGATIVE_INFINITE)
+#define VpIsInf(a) (VpIsPosInf(a) || VpIsNegInf(a))
+#define VpIsDef(a) ( !(VpIsNaN(a)||VpIsInf(a)) )
+#define VpSetPosInf(a) ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_POSITIVE_INFINITE)
+#define VpSetNegInf(a) ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_NEGATIVE_INFINITE)
+#define VpSetInf(a,s) ( ((s)>0)?VpSetPosInf(a):VpSetNegInf(a) )
+#define VpHasVal(a) (a->frac[0])
+#define VpIsOne(a) ((a->Prec==1)&&(a->frac[0]==1)&&(a->exponent==1))
+#define VpExponent(a) (a->exponent)
+#ifdef _DEBUG
+int VpVarCheck(Real * v);
+VP_EXPORT int VPrint(FILE *fp,char *cntl_chr,Real *a);
+#endif /* _DEBUG */
+
+#if defined(__cplusplus)
+} /* extern "C" { */
+#endif
+#endif /* ____BIG_DECIMAL__H____ */
diff --git a/ext/bigdecimal/bigdecimal_en.html b/ext/bigdecimal/bigdecimal_en.html
new file mode 100644
index 0000000000..02c88df43e
--- /dev/null
+++ b/ext/bigdecimal/bigdecimal_en.html
@@ -0,0 +1,797 @@
+<!-- saved from url=(0022)http://internet.e-mail -->
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html">
+<style type="text/css"><!--
+body { color: #3f0f0f; background: #fefeff; margin-left: 2em; margin-right: 2em;}
+h1 { color: #ffffff; background-color: #3939AD; border-color: #FF00FF; width: 100%; border-style: solid;
+ border-top-width: 0.1em; border-bottom-width: 0.1em; border-right: none; border-left: none;
+ padding: 0.1em; font-weight: bold; font-size: 160%; text-align: center;}
+h2 { color: #00007f; background-color: #e7e7ff; border-color: #000094; width: 100%; border-style: solid; border-le ft: none; border-right: none; border-top-width: 0.1em; border-bottom-width: 0.1em; padding: 0.1em;
+ font-weight: bold; font-size: 110%;
+}
+h3 { color: #00007f; padding: 0.2em; font-size: 110%;}
+h4, h5 { color: #000000; padding: 0.2em; font-size: 100%;}
+table { margin-top: 0.2em; margin-bottom: 0.2em; margin-left: 2em; margin-right: 2em;}
+caption { color: #7f0000; font-weight: bold;}
+th { background: #e7e7ff; padding-left: 0.2em; padding-right: 0.2em;}
+td { background: #f3f7ff; padding-left: 0.2em; padding-right: 0.2em;}
+code { color: #0000df;}
+dt { margin-top: 0.2em;}
+li { margin-top: 0.2em;}
+pre
+{ BACKGROUND-COLOR: #d0d0d0; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none;
+ BORDER-RIGHT: medium none; BORDER-TOP: medium none; LINE-HEIGHT: 100%; MARGIN: 12px 12px 12px 12px;
+ PADDING-BOTTOM: 12px; PADDING-LEFT: 12px; PADDING-RIGHT: 12px; PADDING-TOP: 12px;
+ WHITE-SPACE: pre; WIDTH: 100%
+}
+--></style>
+
+<TITLE>BigDecimal:An extension library for Ruby</TITLE>
+</HEAD>
+<BODY BGCOLOR=#FFFFE0>
+<H1>BigDecimal(Variable Precision Floating Library for Ruby)</H1>
+<DIV align="right"><A HREF="./bigdecimal_ja.html">Japanese</A></DIV><BR>
+BigDecimal is an extension library for the Ruby interpreter.
+Using BigDecimal class, you can obtain any number of significant digits in computation.
+For the details about Ruby see:<BR>
+<UL>
+<LI><A HREF="http://www.ruby-lang.org/en/">http://www.ruby-lang.org/en/</A>:Official Ruby page(English).</LI>
+<LI><A HREF="http://kahori.com/ruby/ring/">http://kahori.com/ruby/ring/</A>:Mutually linked pages relating to Ruby(Japanese).
+</LI>
+</UL>
+NOTE:<BR>
+ This software is provided "AS IS" and without any express or
+ implied warranties,including,without limitation,the implied
+ warranties of merchantibility and fitness for a particular
+ purpose. For the details,see COPYING and README included in this
+ distribution.
+<BR>
+<hr>
+
+<H2>Contents</H2>
+<UL>
+<LI><A HREF="#INTRO">Introduction</LI>
+<LI><A HREF="#SPEC">Usage and methods</A></LI>
+<LI><A HREF="#UNDEF">Infinity,NaN,Zero</A></LI>
+<LI><A HREF="#STRUCT">Internal structure</A></LI>
+<LI><A HREF="#BASE">Binary or decimal number representation</A></LI>
+<LI><A HREF="#PREC">Resulting number of significant digits</A></LI>
+</UL>
+<HR>
+
+<A NAME="#INTRO">
+<H2>Introduction</H2>
+Ruby already has builtin (variable length integer number) class Bignum. Using Bignum class,you can obtain
+ any integer value in magnitude. But, variable length decimal number class is not yet built in.
+This is why I made variable length floating class BigDecimal.
+Feel free to send any comments or bug reports to me.
+<A HREF="mailto:shigeo@tinyforest.gr.jp">shigeo@tinyforest.gr.jp</A>
+I will try(but can't promise) to fix bugs reported.
+<hr>
+<H2>Installation</H2>
+The Ruby latest version can be downloaded from <A HREF="http://www.ruby-lang.org/en/">Official Ruby page</A>.
+Once decompress the downloaded Ruby archive,follow the normal installation procedures according to the
+documents included.
+
+<A NAME="#SPEC">
+<H2>Usage and methods</H2>
+Suppose you already know Ruby programming,
+to create BigDecimal objects,the program would like:<BR>
+
+<CODE><PRE>
+ require 'bigdecimal'
+ a=BigDecimal::new("0.123456789123456789")
+ b=BigDecimal("123456.78912345678",40)
+ c=a+b
+</PRE></CODE>
+
+<H3>List of methods</H3>
+In 32 bits integer system,every 4 digits(in decimal) are computed simultaneously.
+This means the number of significant digits in BigDecimal is always a multiple of 4.
+<P>
+Some more methods are available in Ruby code (not C code).
+Functions such as sin,cos ...,are in math.rb in bigdecimal directory.
+To use them,require math.rb as:
+<CODE><PRE>
+require "bigdecimal/math.rb"
+</PRE></CODE>
+For details,see the math.rb code and comments.
+Other utility methods are in util.rb.
+To use util.rb, require it as:
+<CODE><PRE>
+require "bigdecimal/util.rb"
+</PRE></CODE>
+For details,see the util.rb code.
+
+<H4><U>Class methods</U></H4>
+<UL>
+<LI><B>new</B></LI><BLOCKQUOTE>
+"new" method creates a new BigDecimal object.<BR>
+a=BigDecimal::new(s[,n]) or<BR>
+a=BigDecimal(s[,n]) or<BR>
+where:<BR>
+s: Initial value string. Spaces will be ignored. Any unrecognizable character for
+representing initial value terminates the string.<BR>
+n: Maximum number of significant digits of a. n must be a Fixnum object.
+If n is omitted or is equal to 0,then the maximum number of significant digits of a is determined from the length of s.
+Actual number of digits handled in computations are usually gretaer than n.<BR>
+n is useful when performing divisions like
+<CODE><PRE>
+BigDecimal("1") / BigDecimal("3") # => 0.3333333333 33E0
+BigDecimal("1",10) / BigDecimal("3",10) # => 0.3333333333 3333333333 33333333E0
+</PRE></CODE>
+but the resulting digits obtained may differ in future version.
+</BLOCKQUOTE>
+
+<LI><B>mode</B></LI><BLOCKQUOTE>
+f = BigDecimal.mode(s[,v])<BR>
+mode method controls BigDecimal computation. If the second argument is not given or is nil,then the value
+of current setting is returned.
+Following usage are defined.<BR>
+<P><B>[EXCEPTION control]</B><P>
+Actions when computation results NaN or Infinity can be defined as follows.
+<P>
+<BLOCKQUOTE>
+f = BigDecimal::mode(BigDecimal::EXCEPTION_NaN,flag)<BR>
+f = BigDecimal::mode(BigDecimal::EXCEPTION_INFINITY,flag)<BR>
+f = BigDecimal::mode(BigDecimal::EXCEPTION_UNDERFLOW,flag)<BR>
+f = BigDecimal::mode(BigDecimal::EXCEPTION_OVERFLOW,flag)<BR>
+f = BigDecimal::mode(BigDecimal::EXCEPTION_ZERODIVIDE,flag)<BR>
+f = BigDecimal::mode(BigDecimal::EXCEPTION_ALL,flag)<BR>
+</BLOCKQUOTE>
+EXCEPTION_NaN controls the execution when computation results to NaN.<BR>
+EXCEPTION_INFINITY controls the execution when computation results to Infinity(}Infinity).<BR>
+EXCEPTION_UNDERFLOW controls the execution when computation underflows.<BR>
+EXCEPTION_OVERFLOW controls the execution when computation overflows.<BR>
+EXCEPTION_ZERODIVIDE controls the execution when zero-division occures.<BR>
+EXCEPTION_ALL controls the execution for any exception defined occures.<BR>
+If the flag is true,then the relating exception is thrown.<BR>
+No exception is thrown when the flag is false(default) and computation
+continues with the result:<BR>
+<BLOCKQUOTE>
+EXCEPTION_NaN results to NaN<BR>
+EXCEPTION_INFINITY results to +Infinity or -Infinity<BR>
+EXCEPTION_UNDERFLOW results to 0.<BR>
+EXCEPTION_OVERFLOW results to +Infinity or -Infinity<BR>
+EXCEPTION_ZERODIVIDE results to +Infinity or -Infinity<BR>
+</BLOCKQUOTE>
+EXCEPTION_INFINITY,EXCEPTION_OVERFLOW, and EXCEPTION_ZERODIVIDE are
+ currently the same.<BR>
+The return value of mode method is the value set.<BR>
+If nil is specified for the second argument,then current setting is returned.<BR>
+Suppose the return value of the mode method is f,then
+ f &amp; BigDecimal::EXCEPTION_NaN !=0 means EXCEPTION_NaN is set to on.
+<P>
+<B>[ROUND error control]</B><P>
+Rounding operation can be controlled as:
+<BLOCKQUOTE>
+f = BigDecimal::mode(BigDecimal::ROUND_MODE,flag)
+</BLOCKQUOTE>
+where flag must be one of:
+<TABLE>
+
+<TR><TD>ROUND_UP</TD><TD>round away from zero.</TD></TR>
+<TR><TD>ROUND_DOWN</TD><TD>round towards zero(truncate).</TD></TR>
+<TR><TD>ROUND_HALF_UP</TD><TD>round up if the digit &gt;= 5 otherwise truncated(default).</TD></TR>
+<TR><TD>ROUND_HALF_DOWN</TD><TD>round up if the digit &gt;= 6 otherwise truncated.</TD></TR>
+<TR><TD>ROUND_HALF_EVEN</TD><TD>round towards the even neighbor(Banker's rounding).
+<TR><TD>ROUND_CEILING</TD><TD>round towards positive infinity(ceil).</TD></TR>
+<TR><TD>ROUND_FLOOR</TD><TD>round towards negative infinity(floor).</TD></TR>
+</TABLE>
+New rounding mode is returned. If nil is specified for the second argument,then current setting is returned.<BR>
+The digit location for rounding operation can not be specified by this mode method,
+use truncate/round/ceil/floor/add/sub/mult/div mthods for each instance instead.
+</BLOCKQUOTE>
+
+<LI><B>limit[(n)]</B></LI><BLOCKQUOTE>
+Limits the maximum digits that the newly created BigDecimal objects can hold never exceed n.
+This means the rounding operation specified by BigDecimal.mode is
+performed if necessary.
+limit returns the value before set if n is nil or is not specified.
+Zero,the default value,means no upper limit.<BR>
+The limit has no more priority than instance methods such as truncate,round,ceil,floor,add,sub,mult,and div. <BR>
+mf = BigDecimal::limit(n)<BR>
+</BLOCKQUOTE>
+
+<LI><B>double_fig</B></LI><BLOCKQUOTE>
+double_fig is a class method which returns the number of digits
+the Float class can have.
+<CODE><PRE>
+ p BigDecimal::double_fig # ==> 20 (depends on the CPU etc.)
+</PRE></CODE>
+The equivalent C programs which calculates the value of
+double_fig is:
+<CODE><PRE>
+ double v = 1.0;
+ int double_fig = 0;
+ while(v + 1.0 > 1.0) {
+ ++double_fig;
+ v /= 10;
+ }
+</PRE></CODE>
+</BLOCKQUOTE>
+
+<LI><B>BASE</B></LI><BLOCKQUOTE>
+Base value used in the BigDecimal calculation.
+On 32 bits integer system,the value of BASE is 10000.<BR>
+b = BigDecimal::BASE<BR>
+</BLOCKQUOTE>
+</UL>
+
+<H4><U>Instance methods</U></H4>
+<UL>
+<LI><B>+</B></LI><BLOCKQUOTE>
+addition(c = a + b)<BR>
+For the resulting number of significant digits of c,see <A HREF="#PREC">Resulting number of significant digits</A>.
+
+</BLOCKQUOTE>
+<LI><B>-</B></LI><BLOCKQUOTE>
+subtraction (c = a - b) or negation (c = -a)<BR>
+For the resulting number of significant digits of c,see <A HREF="#PREC">Resulting number of significant digits</A>.
+
+</BLOCKQUOTE>
+<LI><B>*</B></LI><BLOCKQUOTE>
+multiplication(c = a * b)<BR>
+For the resulting number of significant digits of c,see <A HREF="#PREC">Resulting number of significant digits</A>.
+
+</BLOCKQUOTE>
+<LI><B>/</B></LI><BLOCKQUOTE>
+division(c = a / b)<BR>
+For the resulting number of significant digits of c,see <A HREF="#PREC">Resulting number of significant digits</A>.
+</BLOCKQUOTE>
+
+<LI><B>add(b,n)</B></LI><BLOCKQUOTE>
+c = a.add(b,n)<BR>
+c = a.add(b,n) performs c = a + b.<BR>
+If n is less than the actual significant digits of a + b,
+then c is rounded properly according to the BigDecimal.limit.<BR>
+If n is zero,then the result is the same as +'s.
+</BLOCKQUOTE>
+<LI><B>sub(b,n)</B></LI><BLOCKQUOTE>
+c = a.sub(b,n)<BR>
+c = a.sub(b,n) performs c = a - b.<BR>
+If n is less than the actual significant digits of a - b,
+then c is rounded properly according to the BigDecimal.limit.<BR>
+If n is zero,then the result is the same as -'s.
+
+</BLOCKQUOTE>
+<LI><B>mult(b,n)</B></LI><BLOCKQUOTE>
+c = a.mult(b,n)<BR>
+c = a.mult(b,n) performs c = a * b.<BR>
+If n is less than the actual significant digits of a * b,
+then c is rounded properly according to the BigDecimal.limit.<BR>
+If n is zero,then the result is the same as *'s.
+
+</BLOCKQUOTE>
+<LI><B>div(b[,n])</B></LI><BLOCKQUOTE>
+c = a.div(b,n)<BR>
+c = a.div(b,n) performs c = a / b.<BR>
+If n is less than the actual significant digits of a / b,
+then c is rounded properly according to the BigDecimal.limit.<BR>
+If n is zero,then the result is the same as /'s.
+If n is not given,then the result will be an integer(BigDecimal) like Float#div.
+</BLOCKQUOTE>
+
+<LI><B>fix</B></LI><BLOCKQUOTE>
+c = a.fix<BR>
+returns integer part of a.<BR>
+
+</BLOCKQUOTE>
+<LI><B>frac</B></LI><BLOCKQUOTE>
+c = a.frac<BR>
+returns fraction part of a.<BR>
+
+</BLOCKQUOTE>
+<LI><B>floor[(n)]</B></LI><BLOCKQUOTE>
+c = a.floor<BR>
+returns the maximum integer value (in BigDecimal) which is less than or equal to a.
+<CODE><PRE>
+ c = BigDecimal("1.23456").floor # ==> 1
+ c = BigDecimal("-1.23456").floor # ==> -2
+</PRE></CODE>
+
+As shown in the following example,an optional integer argument (n) specifying the position
+of the target digit can be given.<BR>
+If n> 0,then the (n+1)th digit counted from the decimal point in fraction part is processed(resulting number of fraction part digits is less than or equal to n).<BR>
+If n<0,then the n-th digit counted from the decimal point in integer part is processed(at least n 0's are placed from the decimal point to left).
+<CODE><PRE>
+ c = BigDecimal("1.23456").floor(4) # ==> 1.2345
+ c = BigDecimal("15.23456").floor(-1) # ==> 10.0
+</PRE></CODE>
+
+</BLOCKQUOTE>
+<LI><B>ceil[(n)]</B></LI><BLOCKQUOTE>
+c = a.ceil<BR>
+returns the minimum integer value (in BigDecimal) which is greater than or equal to a.
+<CODE><PRE>
+ c = BigDecimal("1.23456").ceil # ==> 2
+ c = BigDecimal("-1.23456").ceil # ==> -1
+</PRE></CODE>
+
+As shown in the following example,an optional integer argument (n) specifying the position
+of the target digit can be given.<BR>
+If n>0,then the (n+1)th digit counted from the decimal point in fraction part is processed(resulting number of fraction part digits is less than or equal to n).<BR>
+If n<0,then the n-th digit counted from the decimal point in integer part is processed(at least n 0's are placed from the decimal point to left).
+<CODE><PRE>
+ c = BigDecimal("1.23456").ceil(4) # ==> 1.2346
+ c = BigDecimal("15.23456").ceil(-1) # ==> 20.0
+</PRE></CODE>
+
+</BLOCKQUOTE>
+<LI><B>round[(n[,b])]</B></LI><BLOCKQUOTE>
+c = a.round<BR>
+round a to the nearest 1(default)D<BR>
+<CODE><PRE>
+ c = BigDecimal("1.23456").round # ==> 1
+ c = BigDecimal("-1.23456").round # ==> -1
+</PRE></CODE>
+The rounding operation changes according to BigDecimal::mode(BigDecimal::ROUND_MODE,flag) if specified.
+
+As shown in the following example,an optional integer argument (n) specifying the position
+of the target digit can be given.<BR>
+If n>0,then the (n+1)th digit counted from the decimal point in fraction part is processed(resulting number of fraction part digits is less than or equal to n).<BR>
+If n<0,then the n-th digit counted from the decimal point in integer part is processed(at least n 0's are placed from the decimal point to left).
+<CODE><PRE>
+c = BigDecimal::new("1.23456").round(4) # ==> 1.2346
+c = BigDecimal::new("15.23456").round(-1) # ==> 20.0
+</PRE></CODE>
+
+Rounding operation can be specified by setting the second optional argument b with the valid ROUND_MODE.<BR>
+<CODE><PRE>
+c = BigDecimal::new("1.23456").round(3,BigDecimal::ROUND_HALF_EVEN) # ==> 1.234
+c = BigDecimal::new("1.23356").round(3,BigDecimal::ROUND_HALF_EVEN) # ==> 1.234
+</PRE></CODE>
+
+</BLOCKQUOTE>
+<LI><B>truncate[(n)]</B></LI><BLOCKQUOTE>
+c = a.truncate<BR>
+truncate a to the nearest 1D<BR>
+As shown in the following example,an optional integer argument (n) specifying the position
+of the target digit can be given.<BR>
+If n>0,then the (n+1)th digit counted from the decimal point in fraction part is processed(resulting number of fraction part digits is less than or equal to n).<BR>
+If n<0,then the n-th digit counted from the decimal point in integer part is processed(at least n 0's are placed from the decimal point to left).
+
+<CODE><PRE>
+c = BigDecimal::new("1.23456").truncate(4) # ==> 1.2345
+c = BigDecimal::new("15.23456").truncate(-1) # ==> 10.0
+</PRE></CODE>
+</BLOCKQUOTE>
+<LI><B>abs</B></LI><BLOCKQUOTE>
+c = a.abs<BR>
+returns an absolute value of a.<BR>
+
+</BLOCKQUOTE>
+<LI><B>to_i</B></LI><BLOCKQUOTE>
+changes a to an integer.<BR>
+i = a.to_i<BR>
+i becomes to Fixnum or Bignum.
+If a is Infinity or NaN,then i becomes to nil.
+
+</BLOCKQUOTE>
+<LI><B>to_s[(n)]</B></LI><BLOCKQUOTE>
+converts to string(default results look like "0.xxxxxEn").
+<CODE><PRE>
+BigDecimal("1.23456").to_s # ==> "0.123456E1"
+</PRE></CODE>
+If n(>0) is given,then a space is inserted to each of two parts divided by the decimal point
+after every n digits for readability.
+<CODE><PRE>
+BigDecimal("0.1234567890123456789").to_s(10) # ==> "0.1234567890 123456789E0"
+</PRE></CODE>
+n can be an string representing a positive integer number.
+<CODE><PRE>
+BigDecimal("0.1234567890123456789").to_s("10") # ==> "0.1234567890 123456789E0"
+</PRE></CODE>
+If the first character is '+'(or ' '),then '+'(or ' ') will be set before value string
+when the value is positive.
+<CODE><PRE>
+BigDecimal("0.1234567890123456789").to_s(" 10") # ==> " 0.1234567890 123456789E0"
+BigDecimal("0.1234567890123456789").to_s("+10") # ==> "+0.1234567890 123456789E0"
+BigDecimal("-0.1234567890123456789").to_s("10") # ==> "-0.1234567890 123456789E0"
+</PRE></CODE>
+
+At the end of the string,'E'(or 'e') or 'F'(or 'f') can be specified to change
+number representation.
+<CODE><PRE>
+BigDecimal("1234567890.123456789").to_s("E") # ==> "0.1234567890123456789E10"
+BigDecimal("1234567890.123456789").to_s("F") # ==> "1234567890.123456789"
+BigDecimal("1234567890.123456789").to_s("5E") # ==> "0.12345 67890 12345 6789E10"
+BigDecimal("1234567890.123456789").to_s("5F") # ==> "12345 67890.12345 6789"
+</PRE></CODE>
+
+</BLOCKQUOTE>
+<LI><B>exponent</B></LI><BLOCKQUOTE>
+returns an integer holding exponent value of a.<BR>
+n = a.exponent <BR>
+means a = 0.xxxxxxx*10**n.
+</BLOCKQUOTE>
+
+<LI><B>precs</B></LI><BLOCKQUOTE>
+n,m = a.precs <BR>
+prec returns number of significant digits (n) and maximum number of
+significant digits (m) of a.
+</BLOCKQUOTE>
+
+<LI><B>to_f</B></LI><BLOCKQUOTE>
+Creates a new Float object having (nearly) the same value.
+Use split method if you want to convert by yourself.
+</BLOCKQUOTE>
+
+</BLOCKQUOTE>
+<LI><B>sign</B></LI><BLOCKQUOTE>
+n = a.sign <BR>
+returns positive value if a &gt; 0,negative value if a &lt; 0,
+otherwise zero if a == 0.<BR>
+where the value of n means that a is:<BR>
+n = BigDecimal::SIGN_NaN(0) : a is NaN<BR>
+n = BigDecimal::SIGN_POSITIVE_ZERO(1) : a is +0<BR>
+n = BigDecimal::SIGN_NEGATIVE_ZERO(-1) : a is -0<BR>
+n = BigDecimal::SIGN_POSITIVE_FINITE(2) : a is positive<BR>
+n = BigDecimal::SIGN_NEGATIVE_FINITE(-2) : a is negative<BR>
+n = BigDecimal::SIGN_POSITIVE_INFINITE(3) : a is +Infinity<BR>
+n = BigDecimal::SIGN_NEGATIVE_INFINITE(-3) : a is -Infinity<BR>
+The value in () is the actual value,see (<A HREF="#STRUCT">Internal structure</A>.<BR>
+
+</BLOCKQUOTE>
+<LI><B>nan?</B></LI><BLOCKQUOTE>
+a.nan? returns True when a is NaN.
+
+</BLOCKQUOTE>
+<LI><B>infinite?</B></LI><BLOCKQUOTE>
+a.infinite? returns 1 when a is +,-1 when a is -, nil otherwise.
+
+</BLOCKQUOTE>
+<LI><B>finite?</B></LI><BLOCKQUOTE>
+a.finite? returns true when a is neither nor NaN.
+</BLOCKQUOTE>
+
+<LI><B>zero?</B></LI><BLOCKQUOTE>
+c = a.zero?<BR>
+returns true if a is equal to 0,otherwise returns false<BR>
+</BLOCKQUOTE>
+<LI><B>nonzero?</B></LI><BLOCKQUOTE>
+c = a.nonzero?<BR>
+returns nil if a is 0,otherwise returns a itself.<BR>
+</BLOCKQUOTE>
+
+<LI><B>split</B></LI><BLOCKQUOTE>
+decomposes a BigDecimal value to 4 parts.
+All 4 parts are returned as an array.<BR>
+Parts consist of a sign(0 when the value is NaN,+1 for positive and
+ -1 for negative value), a string representing fraction part,base value(always 10 currently),and an integer(Fixnum) for exponent respectively.
+a=BigDecimal::new("3.14159265")<BR>
+f,x,y,z = a.split<BR>
+where f=+1,x="314159265",y=10 and z=1<BR>
+therefore,you can translate BigDecimal value to Float as:<BR>
+s = "0."+x<BR>
+b = f*(s.to_f)*(y**z)<BR>
+
+</BLOCKQUOTE>
+<LI><B>inspect</B></LI><BLOCKQUOTE>
+is used for debugging output.<BR>
+p a=BigDecimal::new("3.14",10)<BR>
+should produce output like "#&lt;0x112344:'0.314E1',4(12)%gt;".
+where "0x112344" is the address,
+'0.314E1' is the value,4 is the number of the significant digits,
+and 12 is the maximum number of the significant digits
+the object can hold.
+</BLOCKQUOTE>
+
+<LI><B>sqrt</B></LI><BLOCKQUOTE>
+c = a.sqrt(n)<BR>
+computes square root value of a with significant digit number n at least.<BR>
+</BLOCKQUOTE>
+
+<LI><B>**</B></LI><BLOCKQUOTE>
+c = a ** n<BR>
+returns the value of a powered by n.
+n must be an integer.<BR>
+
+</BLOCKQUOTE>
+<LI><B>power</B></LI><BLOCKQUOTE>
+The same as ** method.<BR>
+c = a.power(n)<BR>
+returns the value of a powered by n(c=a**n).
+n must be an integer.<BR>
+</BLOCKQUOTE>
+
+<LI><B>divmod,quo,modulo,%,remainder</B></LI><BLOCKQUOTE>
+See,corresponding methods in Float class.
+</BLOCKQUOTE>
+
+</BLOCKQUOTE>
+<LI><B>&lt;=&gt;</B></LI><BLOCKQUOTE>
+c = a &lt;=&gt; b <BR>
+returns 0 if a==b,1 if a &gt b,and returns -1 if a &lt b.<BR>
+</BLOCKQUOTE>
+</UL>
+
+Following methods need no explanation.<BR>
+<UL>
+<LI>==</LI>
+<LI>===</LI>
+same as ==,used in case statement.
+<LI>!=</LI>
+<LI>&lt;</LI>
+<LI>&lt;=</LI>
+<LI>&gt;</LI>
+<LI>&gt;=</LI>
+</UL>
+
+<HR>
+<H3>About 'coerce'</H3>
+<B>For the binary operation like A op B:</B>
+<DL>
+<DT> 1.Both A and B are BigDecimal objects</DT>
+<DD> A op B is normally performed.</DD>
+<DT> 2.A is the BigDecimal object but B is other than BigDecimal object</DT>
+<DD> Operation is performed,after B is translated to correcponding BigDecimal object(because BigDecimal supports coerce method).</DD>
+<DT> 3.A is not the BigDecimal object but B is BigDecimal object</DT>
+<DD>If A has coerce mthod,then B will translate A to corresponding
+BigDecimal object and the operation is performed,otherwise an error occures.</DD>
+</DL>
+
+String is not translated to BigDecimal in default.
+Uncomment /* #define ENABLE_NUMERIC_STRING */ in bigdecimal.c, compile and install
+again if you want to enable string to BigDecimal conversion.
+Translation stops without error at the character representing non digit.
+For instance,"10XX" is translated to 10,"XXXX" is translated to 0.<BR>
+String representing zero or infinity such as "Infinity","+Infinity","-Infinity",and "NaN" can also be translated to BigDecimal unless false is specified by mode method.<BR>
+
+BigDecimal class supports coerce method(for the details about coerce method,see Ruby documentations). This means the most binary operation can be performed if the BigDecimal object is at the left hand side of the operation.<BR><BR>
+
+ For example:
+<CODE><PRE>
+ a = BigDecimal.E(20)
+ c = a * "0.123456789123456789123456789" # A String is changed to BigDecimal object.
+</PRE></CODE>
+is performed normally.<BR>
+ But,because String does not have coerce method,the following example can not be performed.<BR>
+
+<CODE><PRE>
+ a = BigDecimal.E(20)
+ c = "0.123456789123456789123456789" * a # ERROR
+</PRE></CODE>
+
+If you actually have any inconvenience about the error above.
+You can define a new class derived from String class,
+and define coerce method within the new class.<BR>
+
+<hr>
+<A NAME="#UNDEF">
+<H2>Infinity,Not a Number(NaN),Zero</H2>
+Infinite numbers and NaN can be represented by string writing "+Infinity"(or "Infinity"),"-Infinity",and "NaN" respectively in your program.
+Infinite numbers can be obtained by 1.0/0.0(=Infinity) or -1.0/0.0(=-Infinity).
+<BR><BR>
+NaN(Not a number) can be obtained by undefined computation like 0.0/0.0
+or Infinity-Infinity.
+Any computation including NaN results to NaN.
+Comparisons with NaN never become true,including comparison with NaN itself.
+<BR><BR>
+Zero has two different variations as +0.0 and -0.0.
+But,still, +0.0==-0.0 is true.
+<BR><BR>
+Computation results including Infinity,NaN,+0.0 or -0.0 become complicated.
+Run following program and comfirm the results.
+Send me any incorrect result if you find.
+
+<CODE><PRE>
+ require "bigdecimal"
+ aa = %w(1 -1 +0.0 -0.0 +Infinity -Infinity NaN)
+ ba = %w(1 -1 +0.0 -0.0 +Infinity -Infinity NaN)
+ opa = %w(+ - * / <=> > >= < == != <=)
+ for a in aa
+ for b in ba
+ for op in opa
+ x = BigDecimal::new(a)
+ y = BigDecimal::new(b)
+ eval("ans= x #{op} y;print a,' ',op,' ',b,' ==> ',ans.to_s,\"\n\"")
+ end
+ end
+ end
+</PRE></CODE>
+<hr>
+
+<A NAME="#STRUCT">
+<H2>Internal structure</H2>
+BigDecimal number is defined by the structure Real in BigDecimal.h.
+Digits representing a float number are kept in the array frac[] defined in the structure.
+In the program,any floating number(BigDecimal number) is represented as:<BR>
+ <BigDecimal number> = 0.xxxxxxxxx*BASE**n<BR><BR>
+where 'x' is any digit representing mantissa(kept in the array frac[]),
+BASE is base value(=10000 in 32 bit integer system),
+and n is the exponent value.<BR>
+Larger BASE value enables smaller size of the array frac[],and increases computation speed.
+The value of BASE is defined ind VpInit(). In 32 bit integer system,this value is
+10000. In 64 bit integer system,the value becomes larger.
+BigDecimal has not yet been compiled and tested on 64 bit integer system.
+It will be very nice if anyone try to run BigDecimal on 64 bit system and
+ inform me the results.
+When BASE is 10000,an element of the array frac[] can have vale of from 0 to 9999.
+(up to 4 digits).<BR>
+The structure Real is defined in bigdecimal.h as:<BR>
+<CODE><PRE>
+ typedef struct {
+ VALUE obj; /* Back pointer(VALUE) for Ruby object. */
+ unsigned long MaxPrec; /* The size of the array frac[] */
+ unsigned long Prec; /* Current size of frac[] actually used. */
+ short sign; /* Attribute of the value. */
+ /* ==0 : NaN */
+ /* 1 : +0 */
+ /* -1 : -0 */
+ /* 2 : Positive number */
+ /* -2 : Negative number */
+ /* 3 : +Infinity */
+ /* -3 : -Infinity */
+ unsigned short flag; /* Control flag */
+ int exponent; /* Exponent value(0.xxxx*BASE**exponent) */
+ unsigned long frac[1]; /* An araay holding mantissa(Variable) */
+ } Real;
+</CODE></PRE>
+The decimal value 1234.56784321 is represented as(BASE=10000):<BR>
+<PRE>
+ 0.1234 5678 4321*(10000)**1
+</PRE>
+where frac[0]=1234,frac[1]=5678,frac[2]=4321,
+Prec=3,sign=2,exponent=1. MaxPrec can be any value greater than or equal to
+Prec.
+<hr>
+
+<A NAME="#BASE">
+<H2>Binary or decimal number representation</H2>
+I adopted decimal number representation for BigDecimal implementation.
+Of cource,binary number representation is common on the most computers.
+
+<H3>Advantages using decimal representation</H3>
+The reason why I adopted decimal number representation for BigDecimal is:<BR>
+<DL>
+<DT>Easy for debugging
+<DD>The floating number 1234.56784321 can be easily represented as:<BR>
+ frac[0]=1234,frac[1]=5678,frac[2]=4321,exponent=1,and sign=2.
+<DT>Exact representation
+<DD>Following program can add all numbers(in decimal) in a file
+ without any error(no round operation).<BR>
+
+<CODE><PRE>
+ file = File::open(....,"r")
+ s = BigDecimal::new("0")
+ while line = file.gets
+ s = s + line
+ end
+</PRE></CODE>
+
+If the internal representation is binary,translation from decimal to
+binary is required and the translation error is inevitable.
+For example, 0.1 can not exactly be represented in binary.<BR>
+0.1 => b1*2**(-1)+b1*2**(-2)+b3*2**(-3)+b4*2**(-4)....<BR>
+where b1=0,b2=0,b3=0,b4=1...<BR>
+bn(n=1,2,3,...) is infinite series of digit with value of 0 or 1,
+and rounding operation is necessary but where we should round the series ?
+Of cource,exact "0.1" is printed if the rouding operation is properly done,
+<DT>Significant digit we can have is automatically determined
+<DD>In binary representation,0.1 can not be represented in finite series of digit.
+
+But we only need one element(frac[0]=1) in decimal representation.
+This means that we can always determine the size of the array frac[] in Real
+structure.
+</DL>
+
+<H3>Disadvantage of decimal representation</H3>
+Advantages stated so far can also be disadvantages if the input from outside is
+ represented in binary.
+Translation error from decimal to binary or vice versa is inevitable.
+So,translation from Float(binary) to BigDecimal(decimal) is not alway done exactly.
+
+<H4>Which is the first input?</H4>
+Because most people uses decimal notatin for numeric data representation,
+BigDecimal can handle numeric data without loss of translation error.
+<hr>
+
+<A NAME="#PREC">
+<H2>Resulting number of significant digits</H2>
+For the fundamental arithmetics such as addition,subtraction,
+multiplication,and division,I prepared 2 group of methods<BR>
+
+<H3>1. +,-,*,/</H3>
+For the operation + - * /,you can not specify the resulting
+number of significant digits.<BR>
+Resulting number of significant digits are defined as:<BR>
+1.1 For *,resulting number of significant digits is the sum of the
+significant digits of both side of the operator. For / ,resulting number of significant digits is the sum of the
+maximum significant digits of both side of the operator.<BR>
+1.2 For + and -,resulting number of significant digits is determined so that
+ no round operation is needed. <br>
+For example, c has more than 100 siginificant digits if c is computed as:<BR>
+c = 0.1+0.1*10**(-100)<br>
+<BR>
+As +,-,and * are always exact(no round operation is performed unless BigDecimal.limit is specified),
+which means more momories are required to keep computation results.
+But,the division such as c=1.0/3.0 will always be rounded.<BR>
+
+<H3>2. add,sub,mult,div</H3>
+The length of the significant digits obtained from +,-,*,/
+is always defined by that of right and left side of the operator.
+To specify the length of the significant digits by your self,
+use methos add,sub,mult,div.
+<CODE><PRE>
+ BigDecimal("2").div(3,12) # 2.0/3.0 => 0.6666666666 67E0
+</PRE></CODE>
+</BLOCKQUOTE>
+
+<H3>3. truncate,round,ceil,floor</H3>
+Using these methods,you can specify rounding location relatively from
+decimal point.
+<CODE><PRE>
+ BigDecimal("6.66666666666666").round(12) # => 0.6666666666 667E1
+</PRE></CODE>
+</BLOCKQUOTE>
+
+
+<H3>4. Example</H3>
+Following example compute the ratio of the circumference of a circle to
+its dirmeter(pi=3.14159265358979....) using J.Machin's formula.
+<BR><BR>
+<CODE><PRE>
+#!/usr/local/bin/ruby
+
+require "bigdecimal"
+#
+# Calculates 3.1415.... (the number of times that a circle's diameter
+# will fit around the circle) using J. Machin's formula.
+#
+def big_pi(sig) # sig: Number of significant figures
+ exp = -sig
+ pi = BigDecimal::new("0")
+ two = BigDecimal::new("2")
+ m25 = BigDecimal::new("-0.04")
+ m57121 = BigDecimal::new("-57121")
+
+ u = BigDecimal::new("1")
+ k = BigDecimal::new("1")
+ w = BigDecimal::new("1")
+ t = BigDecimal::new("-80")
+ while (u.nonzero? && u.exponent >= exp)
+ t = t*m25
+ u = t.div(k,sig)
+ pi = pi + u
+ k = k+two
+ end
+
+ u = BigDecimal::new("1")
+ k = BigDecimal::new("1")
+ w = BigDecimal::new("1")
+ t = BigDecimal::new("956")
+ while (u.nonzero? && u.exponent >= exp )
+ t = t.div(m57121,sig)
+ u = t.div(k,sig)
+ pi = pi + u
+ k = k+two
+ end
+ pi
+end
+
+if $0 == __FILE__
+ if ARGV.size == 1
+ print "PI("+ARGV[0]+"):\n"
+ p big_pi(ARGV[0].to_i)
+ else
+ print "TRY: ruby pi.rb 1000 \n"
+ end
+end
+
+</PRE></CODE>
+<HR>
+<FONT size=2>
+<I>
+<A HREF="http://www.tinyforest.gr.jp">
+Shigeo Kobayashi
+</A>
+(E-Mail:<A HREF="mailto:shigeo@tinyforest.gr.jp">&lt;shigeo@tinyforest.gr.jp&gt;</U></A>)
+</I>
+</FONT>
+</TD>
+</TR>
+</TABLE>
+</BODY>
+</HTML>
diff --git a/ext/bigdecimal/bigdecimal_ja.html b/ext/bigdecimal/bigdecimal_ja.html
new file mode 100644
index 0000000000..8fd95a6fe3
--- /dev/null
+++ b/ext/bigdecimal/bigdecimal_ja.html
@@ -0,0 +1,798 @@
+<!-- saved from url=(0022)http://internet.e-mail -->
+<HTML>
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Shift_JIS">
+<style type="text/css"><!--
+body { color: #3f0f0f; background: #fefeff; margin-left: 2em; margin-right: 2em;}
+h1 { color: #ffffff; background-color: #3939AD; border-color: #FF00FF; width: 100%;
+ border-style: solid; border-top-width: 0.1em; border-bottom-width: 0.1em; border-right: none;
+ border-left: none; padding: 0.1em; font-weight: bold; font-size: 160%; text-align: center;
+}
+h2 { color: #00007f; background-color: #e7e7ff; border-color: #000094; width: 100%;
+ border-style: solid; border-left: none; border-right: none; border-top-width: 0.1em; border-bottom-width: 0.1em;
+ padding: 0.1em;
+ font-weight: bold; font-size: 110%;
+}
+h3 { color: #00007f; padding: 0.2em; font-size: 110%;}
+h4, h5 { color: #000000; padding: 0.2em; font-size: 100%;}
+table { margin-top: 0.2em; margin-bottom: 0.2em; margin-left: 2em; margin-right: 2em;}
+caption { color: #7f0000; font-weight: bold;}
+th { background: #e7e7ff; padding-left: 0.2em; padding-right: 0.2em;}
+td { background: #f3f7ff; padding-left: 0.2em; padding-right: 0.2em;}
+code { color: #0000df;}
+dt { margin-top: 0.2em;}
+li { margin-top: 0.2em;}
+pre
+{ BACKGROUND-COLOR: #d0d0d0; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none;
+ BORDER-RIGHT: medium none; BORDER-TOP: medium none; LINE-HEIGHT: 100%; MARGIN: 12px 12px 12px 12px;
+ PADDING-BOTTOM: 12px; PADDING-LEFT: 12px; PADDING-RIGHT: 12px; PADDING-TOP: 12px;
+ WHITE-SPACE: pre; WIDTH: 100%
+}
+--></style>
+
+<TITLE>BigDecimal:An extension library for Ruby</TITLE>
+</HEAD>
+<BODY BGCOLOR=#FFFFE0>
+<H1>BigDecimal(_ZpgCu)</H1>
+<DIV align="right"><A HREF="./bigdecimal_en.html">English</A></DIV><BR>
+BigDecimal IuWFNgwXNvg Ruby _
+vZ@\gCuB
+Ruby eURLQB
+<UL>
+<LI><A HREF="http://www.ruby-lang.org/ja/">http://www.ruby-lang.org/ja/</A>FRubyy[W</LI>
+<LI><A HREF="http://kahori.com/ruby/ring/">http://kahori.com/ruby/ring/</A>FRubyy[WH</LI>
+</UL>
+<hr>
+<H2></H2>
+<UL>
+<LI><A HREF="#INTRO"></LI>
+<LI><A HREF="#SPEC">gp@\bh</A></LI>
+<LI><A HREF="#UNDEF">AA[</A></LI>
+<LI><A HREF="#STRUCT">\</A></LI>
+<LI><A HREF="#BASE">2i10i</A></LI>
+<LI><A HREF="#PREC">vZx</A></LI>
+</UL>
+
+<HR>
+<A NAME="#INTRO">
+<H2></H2>
+Ruby Bignum NXASvZB
+AC_ZpNXBA
+C_ZpgCu BigDecimal B
+sEA
+<A HREF="mailto:shigeo@tinyforest.gr.jp">shigeo@tinyforest.gr.jp</A>
+mBsCBAW
+BAB
+\AB
+<BR><BR>
+vOARzzE\BAB
+zzE Ruby B README B
+
+<hr>
+<H2>CXg[</H2>
+BigDecimal Ruby V<A HREF="http://www.ruby-lang.org/ja/">Rubyy[W</A>_E[hB
+_E[hVACXg[sB
+Ruby CXg[A BigDecimal pB
+\[Xt@C
+bigdecimal.c,bigdecimal.h
+QB<BR>
+
+<hr>
+<A NAME="#SPEC">
+<H2>gp@\bh</H2>
+uRubyvOA
+<CODE><PRE>
+require 'bigdecimal'
+a=BigDecimal::new("0.123456789123456789")
+b=BigDecimal("123456.78912345678",40)
+c=a+b
+</PRE></CODE>
+<br>
+gpB
+
+<H3>\bh</H3>
+\bhp\B
+uLv BigDecimal xB
+A]TvZB
+ARQrbgVXePOiSvZB]AA
+uLvS{B
+<P>
+\bhOA(C ) Ruby \[X`
+BA
+<CODE><PRE>
+require "bigdecimal/math.rb"
+</PRE></CODE>
+Asin cos gpB
+gp@A math.rb eQB
+
+AFloat \bh util.rb T|[gB
+p
+<CODE><PRE>
+require "bigdecimal/util.rb"
+</PRE></CODE>
+B util.rb eQB
+
+<H4><U>NX\bh</U></H4>
+<UL>
+<LI><B>new</B></LI><BLOCKQUOTE>
+V BigDecimal IuWFNgB<BR>
+a=BigDecimal::new(s[,n]) <BR>
+a=BigDecimal(s[,n])<BR>
+s \lwB
+Xy[XBAfo_
+IB
+n KvLia LjwB
+n 0 An l s LB
+s L n n=0 B
+a L n lpB
+LZsB
+<CODE><PRE>
+BigDecimal("1") / BigDecimal("3") # => 0.3333333333 33E0
+BigDecimal("1",10) / BigDecimal("3",10) # => 0.3333333333 3333333333 33333333E0
+</PRE></CODE>
+AXZL n o[W
+X\B
+</BLOCKQUOTE>
+
+<LI><B>mode</B></LI><BLOCKQUOTE>
+f = BigDecimal.mode(s[,v])<BR>
+BigDecimalsBQA nil w
+lB<BR>
+gp@`B
+<P>
+<B>[O]</B><P>
+vZ(NaN)[Z`B
+<BLOCKQUOTE>
+f = BigDecimal::mode(BigDecimal::EXCEPTION_NaN,flag)<BR>
+f = BigDecimal::mode(BigDecimal::EXCEPTION_INFINITY,flag)<BR>
+f = BigDecimal::mode(BigDecimal::EXCEPTION_UNDERFLOW,flag)<BR>
+f = BigDecimal::mode(BigDecimal::EXCEPTION_OVERFLOW,flag)<BR>
+f = BigDecimal::mode(BigDecimal::EXCEPTION_ZERODIVIDE,flag)<BR>
+f = BigDecimal::mode(BigDecimal::EXCEPTION_ALL,flag)<BR>
+</BLOCKQUOTE>
+
+EXCEPTION_NaN NaN wB<BR>
+EXCEPTION_INFINITY (}Infinity)wB<BR>
+EXCEPTION_UNDERFLOW wA_[t[wB<BR>
+EXCEPTION_OVERFLOW wI[o[t[wB<BR>
+EXCEPTION_ZERODIVIDE [ZswB<BR>
+EXCEPTION_ALL A\SgpB<BR><BR>
+
+flag true AwOsB<BR>
+flag falseiftHgjAOsBvZB<BR>
+<BLOCKQUOTE>
+EXCEPTION_NaN A(NaN)<BR>
+EXCEPTION_INFINITY A(+ or -Infinity)<BR>
+EXCEPTION_UNDERFLOW A[<BR>
+EXCEPTION_OVERFLOW A+Infinity -Infinity<BR>
+EXCEPTION_ZERODIVIDE A+Infinity -Infinity<BR>
+</BLOCKQUOTE>
+EXCEPTION_INFINITYAEXCEPTION_OVERFLOWAEXCEPTION_ZERODIVIDE
+B<BR>
+lAlBulvA
+BigDecimal::EXCEPTION_NaNulv & [O
+EXCEPTION_NaNB
+
+<P>
+<B>[w]</B><P>
+vZrwB
+<BLOCKQUOTE>
+f = BigDecimal::mode(BigDecimal::ROUND_MODE,flag)
+</BLOCKQUOTE>
+`wB<BR>
+Aflag (CX^X\bh)wB
+<TABLE>
+<TR><TD>ROUND_UP</TD><TD>SB</TD></TR>
+<TR><TD>ROUND_DOWN</TD><TD>S(truncate)B</TD></TR>
+<TR><TD>ROUND_HALF_UP</TD><TD>l(ftHg)B</TD></TR>
+<TR><TD>ROUND_HALF_DOWN</TD><TD>ZB</TD></TR>
+<TR><TD>ROUND_HALF_EVEN</TD><TD>lZBTPJ(Banker's rounding)B</TD></TR>
+<TR><TD>ROUND_CEILING</TD><TD>lJ(ceil)B</TD></TR>
+<TR><TD>ROUND_FLOOR</TD><TD>lJ(floor)B</TD></TR>
+
+</TABLE>
+lw flag lB
+Q nil wAlB
+mode \bhu[UwB
+u BigDecimal::limit truncate/round/ceil/floorA
+add/sub/mult/div CX^X\bhgpB
+</BLOCKQUOTE>
+<LI><B>limit([n])</B></LI><BLOCKQUOTE>
+BigDecimalIuWFNgnB
+lOlBlftHglOAB
+n wA n nil AB<BR>
+vZsA
+ limit \B BigDecimal.mode w
+sB
+ACX^X\bh (truncate/round/ceil/floor/add/sub/mult/div)
+ limit DB<BR>
+mf = BigDecimal::limit(n)<BR>
+</BLOCKQUOTE>
+
+<LI><B>double_fig</B></LI><BLOCKQUOTE>
+Ruby Float NXLB
+<CODE><PRE>
+ p BigDecimal::double_fig # ==> 20 (depends on the CPU etc.)
+</PRE></CODE>
+double_fig C vOB
+<CODE><PRE>
+ double v = 1.0;
+ int double_fig = 0;
+ while(v + 1.0 > 1.0) {
+ ++double_fig;
+ v /= 10;
+ }
+</PRE></CODE>
+</BLOCKQUOTE>
+
+<LI><B>BASE</B></LI><BLOCKQUOTE>
+gplB 32 rbgn10000B<BR>
+b = BigDecimal::BASE<BR>
+</BLOCKQUOTE>
+</UL>
+
+<H4><U>CX^X\bh</U></H4>
+<UL>
+<LI><B>+</B></LI><BLOCKQUOTE>
+Zic = a + bj<BR>
+c xu<A HREF="#PREC">vZx</A>vQB
+</BLOCKQUOTE>
+
+<LI><B>-</B></LI><BLOCKQUOTE>
+Zic = a - bjA]ic = -aj<BR>
+c xu<A HREF="#PREC">vZx</A>vQB
+
+</BLOCKQUOTE>
+<LI><B>*</B></LI><BLOCKQUOTE>
+Z(c = a * b)<BR>
+cx(ax)+(bx)xB<br>
+u<A HREF="#PREC">vZx</A>vQB
+
+</BLOCKQUOTE>
+<LI><B>/</B></LI><BLOCKQUOTE>
+Z(c = a / b)<BR>
+c xu<A HREF="#PREC">vZx</A>vQB
+
+</BLOCKQUOTE>
+
+<LI><B>add(b,n)</B></LI><BLOCKQUOTE>
+gpB<BR>
+c = a.add(b,n)<BR>
+c = a + b n vZB<BR>
+a + b x n BigDecimal.mode w@B<BR>
+n [ + B
+</BLOCKQUOTE>
+<LI><B>sub(b,n)</B></LI><BLOCKQUOTE>
+gpB<BR>
+c = a.sub(b,n)<BR>
+c = a - b n vZB<BR>
+a - b x n BigDecimal.mode w@B<BR>
+n [ - B
+
+</BLOCKQUOTE>
+<LI><B>mult(b,n)</B></LI><BLOCKQUOTE>
+gpB<BR>
+c = a.mult(b,n)<BR>
+c = a * b n vZB<BR>
+a * b x n BigDecimal.mode w@B<BR>
+n [ * B
+
+</BLOCKQUOTE>
+<LI><B>div(b[,n])</B></LI><BLOCKQUOTE>
+gpB<BR>
+c = a.div(b,n)<BR>
+c = a / b n vZB
+a / b x n BigDecimal.mode w@B<BR>
+n [ / B<BR>
+n Float#div l(BigDecimal)B
+</BLOCKQUOTE>
+
+<LI><B>fix</B></LI><BLOCKQUOTE>
+a _B<BR>
+c = a.fix
+</BLOCKQUOTE>
+<LI><B>frac</B></LI><BLOCKQUOTE>
+a B<BR>
+c = a.frac
+</BLOCKQUOTE>
+
+<LI><B>floor[(n)]</B></LI><BLOCKQUOTE>
+c = a.floor<BR>
+a iBigDecimal ljB
+<CODE><PRE>
+c = BigDecimal("1.23456").floor # ==> 1
+c = BigDecimal("-1.23456").floor # ==> -2
+</PRE></CODE>
+ n ^B<BR>
+n>=0 A_ n+1 (_A n )B<BR>
+n _ n (_u n 0 )B<BR>
+<CODE><PRE>
+ c = BigDecimal("1.23456").floor(4) # ==> 1.2345
+ c = BigDecimal("15.23456").floor(-1) # ==> 10.0
+</PRE></CODE>
+
+</BLOCKQUOTE>
+<LI><B>ceil[(n)]</B></LI><BLOCKQUOTE>
+c = a.ceil<BR>
+a AvZAliBigDecimal ljB
+<CODE><PRE>
+c = BigDecimal("1.23456").ceil # ==> 2
+c = BigDecimal("-1.23456").ceil # ==> -1
+</PRE></CODE>
+
+^A_ n+1 B<BR>
+n>=0 A_ n+1 (_A n )B<BR>
+ n _ n (_u n 0 )B<BR>
+<CODE><PRE>
+ c = BigDecimal("1.23456").ceil(4) # ==> 1.2346
+ c = BigDecimal("15.23456").ceil(-1) # ==> 20.0
+</PRE></CODE>
+
+</BLOCKQUOTE>
+<LI><B>round[(n[,b])]</B></LI><BLOCKQUOTE>
+c = a.round<BR>
+
+NX\bh BigDecimal::mode(BigDecimal::ROUND_MODE,flag) w
+ROUND_MODE ]sB
+BigDecimal::mode(BigDecimal::ROUND_MODE,flag) wAA
+wu_liBigDecimal ljvB<BR>
+<CODE><PRE>
+ c = BigDecimal("1.23456").round # ==> 1
+ c = BigDecimal("-1.23456").round # ==> -1
+</PRE></CODE>
+
+^A_ n+1 B<BR>
+n A_ n+1 (_A n )B<BR>
+n _ n (_u n 0 )B
+<CODE><PRE>
+c = BigDecimal("1.23456").round(4) # ==> 1.2346
+c = BigDecimal("15.23456").round(-1) # ==> 20.0
+</PRE></CODE>
+QwABigDecimal#mode wAw@
+sB
+<CODE><PRE>
+c = BigDecimal("1.23456").round(3,BigDecimal::ROUND_HALF_EVEN) # ==> 1.234
+c = BigDecimal("1.23356").round(3,BigDecimal::ROUND_HALF_EVEN) # ==> 1.234
+</PRE></CODE>
+
+</BLOCKQUOTE>
+<LI><B>truncate</B></LI><BLOCKQUOTE>
+c = a.truncate<BR>
+_iBigDecimal ljB<BR>
+^A_ n+1 B<BR>
+n A_ n+1 (_A n )B
+n _ n (_u n 0 )B<BR>
+<CODE><PRE>
+c = BigDecimal("1.23456").truncate(4) # ==> 1.2345
+c = BigDecimal("15.23456").truncate(-1) # ==> 10.0
+</PRE></CODE>
+</BLOCKQUOTE>
+
+</BLOCKQUOTE>
+<LI><B>abs</B></LI><BLOCKQUOTE>
+l<BR>
+c = a.abs<BR>
+
+</BLOCKQUOTE>
+<LI><B>to_i</B></LI><BLOCKQUOTE>
+_B<BR>
+i = a.to_i<BR>
+i l Fixnum Bignum B
+a Infinity NaN Ai nil B
+</BLOCKQUOTE>
+<LI><B>to_f</B></LI><BLOCKQUOTE>
+Float IuWFNgB
+lKv split \bhp
+B
+</BLOCKQUOTE>
+<LI><B>to_s[(n)]</B></LI><BLOCKQUOTE>
+(ftHg "0.xxxxxEn" `jB
+<CODE><PRE>
+BigDecimal("1.23456").to_s # ==> "0.123456E1"
+</PRE></CODE>
+ n wA_EA n
+B
+<CODE><PRE>
+BigDecimal("0.1234567890123456789").to_s(10) # ==> "0.1234567890 123456789E0"
+</PRE></CODE>
+ n \wB
+<CODE><PRE>
+BigDecimal("0.1234567890123456789").to_s("10") # ==> "0.1234567890 123456789E0"
+</PRE></CODE>
+ '+'i ' 'jtAlA '+'i ' 'jt
+iA '-' tBjB
+<CODE><PRE>
+BigDecimal("0.1234567890123456789").to_s(" 10") # ==> " 0.1234567890 123456789E0"
+BigDecimal("0.1234567890123456789").to_s("+10") # ==> "+0.1234567890 123456789E0"
+BigDecimal("-0.1234567890123456789").to_s("10") # ==> "-0.1234567890 123456789E0"
+</PRE></CODE>
+
+ E( e) F( f) wA
+\`XB
+<CODE><PRE>
+BigDecimal("1234567890.123456789").to_s("E") # ==> "0.1234567890123456789E10"
+BigDecimal("1234567890.123456789").to_s("F") # ==> "1234567890.123456789"
+BigDecimal("1234567890.123456789").to_s("5E") # ==> "0.12345 67890 12345 6789E10"
+BigDecimal("1234567890.123456789").to_s("5F") # ==> "12345 67890.12345 6789"
+</PRE></CODE>
+
+</BLOCKQUOTE>
+<LI><B>exponent</B></LI><BLOCKQUOTE>
+wlB
+n = a.exponent <BR>
+ a l 0.xxxxxxx*10**n B
+</BLOCKQUOTE>
+
+<LI><B>precs</B></LI><BLOCKQUOTE>
+n,m = a.precs<BR>
+a L (n) L (m) zB
+
+</BLOCKQUOTE>
+
+<LI><B>sign</B></LI><BLOCKQUOTE>
+l(sign &gt; 0)A(sign &lt; 0)A(sigh==0)B
+n = a.sign <BR>
+ n l a B<BR>
+() Al(<A HREF="#STRUCT">u\v</A>Q)B<BR>
+n = BigDecimal::SIGN_NaN(0) : a NaN<BR>
+n = BigDecimal::SIGN_POSITIVE_ZERO(1) : a +0<BR>
+n = BigDecimal::SIGN_NEGATIVE_ZERO(-1) : a -0<BR>
+n = BigDecimal::SIGN_POSITIVE_FINITE(2) : a l<BR>
+n = BigDecimal::SIGN_NEGATIVE_FINITE(-2) : a l<BR>
+n = BigDecimal::SIGN_POSITIVE_INFINITE(3) : a +Infinity<BR>
+n = BigDecimal::SIGN_NEGATIVE_INFINITE(-3) : a -Infinity<BR>
+
+</BLOCKQUOTE>
+<LI><B>nan?</B></LI><BLOCKQUOTE>
+a.nan? a NaN^B
+</BLOCKQUOTE>
+<LI><B>infinite?</B></LI><BLOCKQUOTE>
+a.infinite? a + 1 A- -1AO nil B
+</BLOCKQUOTE>
+<LI><B>finite?</B></LI><BLOCKQUOTE>
+a.finite? a NaN ^B
+</BLOCKQUOTE>
+
+<LI><B>zero?</B></LI><BLOCKQUOTE>
+a 0 true B<BR>
+c = a.zero?
+</BLOCKQUOTE>
+<LI><B>nonzero?</B></LI><BLOCKQUOTE>
+a 0 nilA0 O a B<BR>
+c = a.nonzero?
+
+</BLOCKQUOTE>
+<LI><B>split</B></LI><BLOCKQUOTE>
+BigDecimal l 0.xxxxxxx*10**n \AiNaN
+0AO+1-1jA
+i"xxxxxxx"jAi10jAXw n z
+B<BR>
+a=BigDecimal::new("3.14159265")<BR>
+f,x,y,z = a.split<BR>
+Af=+1Ax="314159265"Ay=10Az=1B<BR>
+]A<BR>
+s = "0."+x<BR>
+b = f*(s.to_f)*(y**z)<BR>
+ Float B
+</BLOCKQUOTE>
+<LI><B>inspect</B></LI><BLOCKQUOTE>
+fobOogpB<BR>
+p a=BigDecimal::new("3.14",10)<BR>
+A[0x112344:'0.314E1',4(12)]oB
+16iIuWFNgAhXA '0.314E1' lA
+4L(\)A
+IuWFNgB
+</BLOCKQUOTE>
+<LI><B>**</B></LI><BLOCKQUOTE>
+a n vZBB<BR>
+c = a ** n<BR>
+ c L a n {B
+</BLOCKQUOTE>
+<LI><B>power</B></LI><BLOCKQUOTE>
+** Aa n vZBB<BR>
+c = a.power(n)<BR>
+ c L a n {B
+</BLOCKQUOTE>
+<LI><B>sqrt</B></LI><BLOCKQUOTE>
+aL n in j
+j[g@vZB<BR>
+c = a.sqrt(n)<BR>
+</BLOCKQUOTE>
+
+<LI><B>divmod,quo,modulo,%,remainder</B></LI><BLOCKQUOTE>
+ Float e\bhQB
+</BLOCKQUOTE>
+
+<LI><B>&lt=&gt</B></LI><BLOCKQUOTE>
+a==b 0Aa &gt b 1Aa &lt b -1 B<BR>
+c = a &lt=&gt b
+</BLOCKQUOTE>
+</UL>
+A@B<BR>
+<UL>
+<LI><B>==</B></LI>
+<LI><B>===</B></LI>
+u==v case gpB
+<LI><B>!=</B></LI>
+<LI><B>&lt</B></LI>
+<LI><B>&lt=</B></LI>
+<LI><B>&gt</B></LI>
+<LI><B>&gt=</B></LI>
+</UL>
+
+<H3>coerce</H3>
+BigDecimal IuWFNgZpZqABigDecimal IuWFNg
+EIuWFNg(Kv) BigDecimal vZB
+]ABigDecimal IuWFNgOlEu
+Z\B<BR>
+AijlB
+l bigfloat.c
+u/* #define ENABLE_NUMERIC_STRING */vRgOA
+RpCACXg[KvB
+l^KvBlA
+P~G[B"10XX"POA"XXXX"O
+B<BR>
+<CODE><PRE>
+ a = BigDecimal.E(20)
+ c = a * "0.123456789123456789123456789" # BigDecimal vZ
+</PRE></CODE>
+\A"Infinity"A"+Infinity"A"-Infinity"A"NaN"
+gp(E)BAmode \bh false
+wOB
+<BR>
+ABigDecimalNX coerceiRuby{QjT|[gB
+]ABigDecimal IuWFNgEvB
+A Ruby C^v^dlAvZB<BR>
+<CODE><PRE>
+ a = BigDecimal.E(20)
+ c = "0.123456789123456789123456789" * a # G[
+</PRE></CODE>
+KvvAl
+ String IuWFNgpVNXA
+NX coerce T|[gB
+
+<hr>
+<A NAME="#UNDEF">
+<H2>AA[</H2>
+uv\B
+ +Infinityij -Infinityij
+\LB
+ 1.0/0.0 [vZB
+<BR><BR>
+uv 0.0/0.0 Infinity-Infinity `
+vZB NaNiNot a Numberj\LB
+NaN vZS NaN B NaN A
+vB
+<BR><BR>
+[ +0.0 -0.0 BA+0.0==-0.0 true B
+<BR><BR>
+InfinityANaNA +0.0 -0.0 vZg
+GBlAvOs
+mFiA^
+mjB
+
+<PRE>
+<CODE>
+require "bigdecimal"
+
+aa = %w(1 -1 +0.0 -0.0 +Infinity -Infinity NaN)
+ba = %w(1 -1 +0.0 -0.0 +Infinity -Infinity NaN)
+opa = %w(+ - * / <=> > >= < == != <=)
+
+for a in aa
+ for b in ba
+ for op in opa
+ x = BigDecimal::new(a)
+ y = BigDecimal::new(b)
+ eval("ans= x #{op} y;print a,' ',op,' ',b,' ==> ',ans.to_s,\"\n\"")
+ end
+ end
+end
+</CODE>
+</PRE>
+
+<hr>
+<A NAME="#STRUCT">
+<H2>\</H2>
+BigDecimal_\(Real)\B
+ unsigned long z(\vffrac)B
+TOIAB<BR><BR>
+ <_> = 0.xxxxxxxxx*BASE**n<BR><BR>
+Ax\ABASEiPOiPOjAnw\
+lBBASEAl\BAzTCY
+BBASEsAfobO
+lA10000iBASEVpInit()IvZjB
+A32rbgB64rbglB
+cOA64rbgeXgiA
+jB
+BASE10000Az(frac)evfS
+i[B<BR><BR>
+_\(Real)B
+<BR>
+<CODE><PRE>
+ typedef struct {
+ unsigned long MaxPrec; // x(frac[]zTCY)
+ unsigned long Prec; // x(frac[]gpTCY)
+ short sign; // `B
+ // ==0 : NaN
+ // 1 : +0
+ // -1 : -0
+ // 2 : l
+ // -2 : l
+ // 3 : +Infinity
+ // -3 : -Infinity
+ unsigned short flag; // etbO
+ int exponent; // wl(*BASE**exponent)
+ unsigned long frac[1]; // z()
+ } Real;
+</CODE></PRE>
+ 1234.56784321 (BASE=10000)<BR>
+<PRE>
+ 0.1234 5678 4321*(10000)**1
+</PRE>
+ frac[0]=1234Afrac[1]=5678Afrac[2]=4321A
+Prec=3Asign=2Aexponent=1 BMaxPrec
+Prec Bflag
+gp@gpB
+
+<hr>
+<A NAME="#BASE">
+<H2>2i10i</H2>
+BigDecimal <_> = 0.xxxxxxxxx*10**n 10i`lB
+AvZ@_\A <_> = 0.bbbbbbbb*2**n
+2i`(x 0 9 Ab 0 1 )B
+BigDecimal 10i\`pB
+<H4>10ibg</H4>
+<DL>
+<DT>fobO
+<DD>AvOyBfrac[0]=1234Afrac[1]=5678Afrac[2]=4321A
+exponent=1Asign=2 l 1234.56784321 B
+
+<DT>10i\Llm\
+<DD>AvOS
+vZBAsl
+t@C file vlB
+<CODE><PRE>
+ file = File::open(....,"r")
+ s = BigDecimal::new("0")
+ while line = file.gets
+ s = s + line
+ end
+</PRE></CODE>
+2i\B
+ 0.1 2i\ 0.1 = b1*2**(-1)+b1*2**(-2)+b3*2**(-3)+b4*2**(-4)....
+(b1=0,b2=0,b3=0,b4=1...)B bn(n=1,2,3,...)
+2i\ 0 1 B]AKvB
+BAx10i\L
+Kilj "0.1" \BA
+m 0.1 B
+
+<DT>LLij
+<DD>0.1 \zvfi frac[0]=1 jB
+zvf10ilIBA_Z
+Bt 0.1 2i\2iL 0.1
+B
+</DL>
+
+<H3>10ifbg</H3>
+bgAfbgB
+A10i2iA2i10i
+B
+vZ@2il BigDecimal \
+B
+
+<H3>H</H3>
+vZ2iglB
+vZ@f[^A
+10iBAdouble vZ@
+\B
+BigDecimal [UB
+fobOAf[^
+bgB
+
+<hr>
+<A NAME="#PREC">
+<H2>vZx</H2>
+c = a op b vZ(op + - * /)
+B<BR><BR>
+PDZ(a L)+(b L)A
+Z(a L)+(b L)iA]TA
+j c VB
+ZAox c B
+ c = 0.1+0.1*10**(-100) Ac xPOOx
+B
+<BR><BR>
+QD c = a op b vZsB<BR><BR>
+AZZ c Kuovx
+(BigDecimal.limit w)B
+Z(a L)+(b L)
+ c Ac = 1.0/3.0 vZA
+ c xvZB<BR><BR>
+Ac x a b c Kv
+[B
+<BR><BR>
+Fu+,-,*,/vxiLjwB
+xRg[ACX^X\bhgpB<BR>
+<UL>
+<LI>add,sub,mult,div</LI><BLOCKQUOTE>
+\bh()wB
+<CODE><PRE>
+ BigDecimal("2").div(3,12) # 2.0/3.0 => 0.6666666666 67E0
+</PRE></CODE>
+</BLOCKQUOTE>
+<LI>truncate,round,ceil,floor</LI><BLOCKQUOTE>
+\bh_uwB
+<CODE><PRE>
+ BigDecimal("6.66666666666666").round(12) # => 0.6666666666 667E1
+</PRE></CODE>
+</BLOCKQUOTE>
+</UL>
+<H3>xRg[</H3>
+x(L)Rg[ addAsubAmultAdiv \bh
+gpB
+~vZvOA
+wB
+<BR><BR>
+<CODE><PRE>
+#!/usr/local/bin/ruby
+
+require "bigdecimal"
+#
+# Calculates 3.1415.... (the number of times that a circle's diameter
+# will fit around the circle) using J. Machin's formula.
+#
+def big_pi(sig) # sig: Number of significant figures
+ exp = -sig
+ pi = BigDecimal::new("0")
+ two = BigDecimal::new("2")
+ m25 = BigDecimal::new("-0.04")
+ m57121 = BigDecimal::new("-57121")
+
+ u = BigDecimal::new("1")
+ k = BigDecimal::new("1")
+ w = BigDecimal::new("1")
+ t = BigDecimal::new("-80")
+ while (u.nonzero? && u.exponent >= exp)
+ t = t*m25
+ u = t.div(k,sig)
+ pi = pi + u
+ k = k+two
+ end
+
+ u = BigDecimal::new("1")
+ k = BigDecimal::new("1")
+ w = BigDecimal::new("1")
+ t = BigDecimal::new("956")
+ while (u.nonzero? && u.exponent >= exp )
+ t = t.div(m57121,sig)
+ u = t.div(k,sig)
+ pi = pi + u
+ k = k+two
+ end
+ pi
+end
+
+if $0 == __FILE__
+ if ARGV.size == 1
+ print "PI("+ARGV[0]+"):\n"
+ p big_pi(ARGV[0].to_i)
+ else
+ print "TRY: ruby pi.rb 1000 \n"
+ end
+end
+
+</PRE></CODE>
+<HR>
+<FONT size=2>
+<I>
+<A HREF="http://www.tinyforest.gr.jp">
+ Y
+</A>
+(E-Mail:<A HREF="mailto:shigeo@tinyforest.gr.jp">&ltshigeo@tinyforest.gr.jp&gt</U></A>)
+</I>
+</FONT>
+</TD>
+</TR>
+</TABLE>
+</BODY>
+</HTML>
diff --git a/ext/bigdecimal/depend b/ext/bigdecimal/depend
new file mode 100644
index 0000000000..402cae95dd
--- /dev/null
+++ b/ext/bigdecimal/depend
@@ -0,0 +1 @@
+bigdecimal.o: bigdecimal.c bigdecimal.h $(hdrdir)/ruby.h
diff --git a/ext/bigdecimal/extconf.rb b/ext/bigdecimal/extconf.rb
new file mode 100644
index 0000000000..a68a656044
--- /dev/null
+++ b/ext/bigdecimal/extconf.rb
@@ -0,0 +1,2 @@
+require 'mkmf'
+create_makefile('bigdecimal')
diff --git a/ext/bigdecimal/lib/bigdecimal/jacobian.rb b/ext/bigdecimal/lib/bigdecimal/jacobian.rb
new file mode 100644
index 0000000000..34a60ae67a
--- /dev/null
+++ b/ext/bigdecimal/lib/bigdecimal/jacobian.rb
@@ -0,0 +1,63 @@
+#
+# jacobian.rb
+#
+# Computes Jacobian matrix of f at x
+#
+module Jacobian
+ def isEqual(a,b,zero=0.0,e=1.0e-8)
+ aa = a.abs
+ bb = b.abs
+ if aa == zero && bb == zero then
+ true
+ else
+ if ((a-b)/(aa+bb)).abs < e then
+ true
+ else
+ false
+ end
+ end
+ end
+
+ def dfdxi(f,fx,x,i)
+ nRetry = 0
+ n = x.size
+ xSave = x[i]
+ ok = 0
+ ratio = f.ten*f.ten*f.ten
+ dx = x[i].abs/ratio
+ dx = fx[i].abs/ratio if isEqual(dx,f.zero,f.zero,f.eps)
+ dx = f.one/f.ten if isEqual(dx,f.zero,f.zero,f.eps)
+ until ok>0 do
+ s = f.zero
+ deriv = []
+ if(nRetry>100) then
+ raize "Singular Jacobian matrix. No change at x[" + i.to_s + "]"
+ end
+ dx = dx*f.two
+ x[i] += dx
+ fxNew = f.values(x)
+ for j in 0...n do
+ if !isEqual(fxNew[j],fx[j],f.zero,f.eps) then
+ ok += 1
+ deriv <<= (fxNew[j]-fx[j])/dx
+ else
+ deriv <<= f.zero
+ end
+ end
+ x[i] = xSave
+ end
+ deriv
+ end
+
+ def jacobian(f,fx,x)
+ n = x.size
+ dfdx = Array::new(n*n)
+ for i in 0...n do
+ df = dfdxi(f,fx,x,i)
+ for j in 0...n do
+ dfdx[j*n+i] = df[j]
+ end
+ end
+ dfdx
+ end
+end
diff --git a/ext/bigdecimal/lib/bigdecimal/ludcmp.rb b/ext/bigdecimal/lib/bigdecimal/ludcmp.rb
new file mode 100644
index 0000000000..1d5d3170cc
--- /dev/null
+++ b/ext/bigdecimal/lib/bigdecimal/ludcmp.rb
@@ -0,0 +1,77 @@
+#
+# ludcmp.rb
+#
+module LUSolve
+ def ludecomp(a,n,zero=0,one=1)
+ prec = BigDecimal.limit(nil)
+ ps = []
+ scales = []
+ for i in 0...n do # pick up largest(abs. val.) element in each row.
+ ps <<= i
+ nrmrow = zero
+ ixn = i*n
+ for j in 0...n do
+ biggst = a[ixn+j].abs
+ nrmrow = biggst if biggst>nrmrow
+ end
+ if nrmrow>zero then
+ scales <<= one.div(nrmrow,prec)
+ else
+ raise "Singular matrix"
+ end
+ end
+ n1 = n - 1
+ for k in 0...n1 do # Gaussian elimination with partial pivoting.
+ biggst = zero;
+ for i in k...n do
+ size = a[ps[i]*n+k].abs*scales[ps[i]]
+ if size>biggst then
+ biggst = size
+ pividx = i
+ end
+ end
+ raise "Singular matrix" if biggst<=zero
+ if pividx!=k then
+ j = ps[k]
+ ps[k] = ps[pividx]
+ ps[pividx] = j
+ end
+ pivot = a[ps[k]*n+k]
+ for i in (k+1)...n do
+ psin = ps[i]*n
+ a[psin+k] = mult = a[psin+k].div(pivot,prec)
+ if mult!=zero then
+ pskn = ps[k]*n
+ for j in (k+1)...n do
+ a[psin+j] -= mult.mult(a[pskn+j],prec)
+ end
+ end
+ end
+ end
+ raise "Singular matrix" if a[ps[n1]*n+n1] == zero
+ ps
+ end
+
+ def lusolve(a,b,ps,zero=0.0)
+ prec = BigDecimal.limit(nil)
+ n = ps.size
+ x = []
+ for i in 0...n do
+ dot = zero
+ psin = ps[i]*n
+ for j in 0...i do
+ dot = a[psin+j].mult(x[j],prec) + dot
+ end
+ x <<= b[ps[i]] - dot
+ end
+ (n-1).downto(0) do |i|
+ dot = zero
+ psin = ps[i]*n
+ for j in (i+1)...n do
+ dot = a[psin+j].mult(x[j],prec) + dot
+ end
+ x[i] = (x[i]-dot).div(a[psin+i],prec)
+ end
+ x
+ end
+end
diff --git a/ext/bigdecimal/lib/bigdecimal/math.rb b/ext/bigdecimal/lib/bigdecimal/math.rb
new file mode 100644
index 0000000000..7b3f46ed1a
--- /dev/null
+++ b/ext/bigdecimal/lib/bigdecimal/math.rb
@@ -0,0 +1,196 @@
+#
+# Contents:
+# sqrt(x, prec)
+# sin (x, prec)
+# cos (x, prec)
+# atan(x, prec) Note: |x|<1, x=0.9999 may not converge.
+# exp (x, prec)
+# log (x, prec)
+# PI (prec)
+# E (prec) == exp(1.0,prec)
+#
+# where:
+# x ... BigDecimal number to be computed.
+# |x| must be small enough to get convergence.
+# prec ... Number of digits to be obtained.
+#
+# Usage:
+# require "bigdecimal"
+# require "bigdecimal/math.rb"
+# include BigMath
+# a = BigDecimal((PI(100)/2).to_s)
+# puts sin(a,100) # => 0.10000000000000000000......E1
+#
+module BigMath
+ def sqrt(x,prec)
+ x.sqrt(prec)
+ end
+
+ def sin(x, prec)
+ raise ArgumentError, "Zero or negative precision for sin" if prec <= 0
+ return BigDecimal("NaN") if x.infinite? || x.nan?
+ n = prec + BigDecimal.double_fig
+ one = BigDecimal("1")
+ two = BigDecimal("2")
+ x1 = x
+ x2 = x.mult(x,n)
+ sign = 1
+ y = x
+ d = y
+ i = one
+ z = one
+ while d.nonzero? && ((m = n - (y.exponent - d.exponent).abs) > 0)
+ m = BigDecimal.double_fig if m < BigDecimal.double_fig
+ sign = -sign
+ x1 = x2.mult(x1,n)
+ i += two
+ z *= (i-one) * i
+ d = sign * x1.div(z,m)
+ y += d
+ end
+ y
+ end
+
+ def cos(x, prec)
+ raise ArgumentError, "Zero or negative precision for cos" if prec <= 0
+ return BigDecimal("NaN") if x.infinite? || x.nan?
+ n = prec + BigDecimal.double_fig
+ one = BigDecimal("1")
+ two = BigDecimal("2")
+ x1 = one
+ x2 = x.mult(x,n)
+ sign = 1
+ y = one
+ d = y
+ i = BigDecimal("0")
+ z = one
+ while d.nonzero? && ((m = n - (y.exponent - d.exponent).abs) > 0)
+ m = BigDecimal.double_fig if m < BigDecimal.double_fig
+ sign = -sign
+ x1 = x2.mult(x1,n)
+ i += two
+ z *= (i-one) * i
+ d = sign * x1.div(z,m)
+ y += d
+ end
+ y
+ end
+
+ def atan(x, prec)
+ raise ArgumentError, "Zero or negative precision for atan" if prec <= 0
+ return BigDecimal("NaN") if x.infinite? || x.nan?
+ raise ArgumentError, "x.abs must be less than 1.0" if x.abs>=1
+ n = prec + BigDecimal.double_fig
+ y = x
+ d = y
+ t = x
+ r = BigDecimal("3")
+ x2 = x.mult(x,n)
+ while d.nonzero? && ((m = n - (y.exponent - d.exponent).abs) > 0)
+ m = BigDecimal.double_fig if m < BigDecimal.double_fig
+ t = -t.mult(x2,n)
+ d = t.div(r,m)
+ y += d
+ r += 2
+ end
+ y
+ end
+
+ def exp(x, prec)
+ raise ArgumentError, "Zero or negative precision for exp" if prec <= 0
+ return BigDecimal("NaN") if x.infinite? || x.nan?
+ n = prec + BigDecimal.double_fig
+ one = BigDecimal("1")
+ x1 = one
+ y = one
+ d = y
+ z = one
+ i = 0
+ while d.nonzero? && ((m = n - (y.exponent - d.exponent).abs) > 0)
+ m = BigDecimal.double_fig if m < BigDecimal.double_fig
+ x1 = x1.mult(x,n)
+ i += 1
+ z *= i
+ d = x1.div(z,m)
+ y += d
+ end
+ y
+ end
+
+ def log(x, prec)
+ raise ArgumentError, "Zero or negative argument for log" if x <= 0 || prec <= 0
+ return x if x.infinite? || x.nan?
+ one = BigDecimal("1")
+ two = BigDecimal("2")
+ n = prec + BigDecimal.double_fig
+ x = (x - one).div(x + one,n)
+ x2 = x.mult(x,n)
+ y = x
+ d = y
+ i = one
+ while d.nonzero? && ((m = n - (y.exponent - d.exponent).abs) > 0)
+ m = BigDecimal.double_fig if m < BigDecimal.double_fig
+ x = x2.mult(x,n)
+ i += two
+ d = x.div(i,m)
+ y += d
+ end
+ y*two
+ end
+
+ def PI(prec)
+ raise ArgumentError, "Zero or negative argument for PI" if prec <= 0
+ n = prec + BigDecimal.double_fig
+ zero = BigDecimal("0")
+ one = BigDecimal("1")
+ two = BigDecimal("2")
+
+ m25 = BigDecimal("-0.04")
+ m57121 = BigDecimal("-57121")
+
+ pi = zero
+
+ d = one
+ k = one
+ w = one
+ t = BigDecimal("-80")
+ while d.nonzero? && ((m = n - (pi.exponent - d.exponent).abs) > 0)
+ m = BigDecimal.double_fig if m < BigDecimal.double_fig
+ t = t*m25
+ d = t.div(k,m)
+ k = k+two
+ pi = pi + d
+ end
+
+ d = one
+ k = one
+ w = one
+ t = BigDecimal("956")
+ while d.nonzero? && ((m = n - (pi.exponent - d.exponent).abs) > 0)
+ m = BigDecimal.double_fig if m < BigDecimal.double_fig
+ t = t.div(m57121,n)
+ d = t.div(k,m)
+ pi = pi + d
+ k = k+two
+ end
+ pi
+ end
+
+ def E(prec)
+ raise ArgumentError, "Zero or negative precision for E" if prec <= 0
+ n = prec + BigDecimal.double_fig
+ one = BigDecimal("1")
+ y = one
+ d = y
+ z = one
+ i = 0
+ while d.nonzero? && ((m = n - (y.exponent - d.exponent).abs) > 0)
+ m = BigDecimal.double_fig if m < BigDecimal.double_fig
+ i += 1
+ z *= i
+ d = one.div(z,m)
+ y += d
+ end
+ y
+ end
+end
diff --git a/ext/bigdecimal/lib/bigdecimal/newton.rb b/ext/bigdecimal/lib/bigdecimal/newton.rb
new file mode 100644
index 0000000000..67a92474ac
--- /dev/null
+++ b/ext/bigdecimal/lib/bigdecimal/newton.rb
@@ -0,0 +1,75 @@
+#
+# newton.rb
+#
+# Solves nonlinear algebraic equation system f = 0 by Newton's method.
+# (This program is not dependent on BigDecimal)
+#
+# To call:
+# n = nlsolve(f,x)
+# where n is the number of iterations required.
+# x is the solution vector.
+# f is the object to be solved which must have following methods.
+#
+# f ... Object to compute Jacobian matrix of the equation systems.
+# [Methods required for f]
+# f.values(x) returns values of all functions at x.
+# f.zero returns 0.0
+# f.one returns 1.0
+# f.two returns 1.0
+# f.ten returns 10.0
+# f.eps convergence criterion
+# x ... initial values
+#
+require "ludcmp"
+require "jacobian"
+
+module Newton
+ include LUSolve
+ include Jacobian
+
+ def norm(fv,zero=0.0)
+ s = zero
+ n = fv.size
+ for i in 0...n do
+ s += fv[i]*fv[i]
+ end
+ s
+ end
+
+ def nlsolve(f,x)
+ nRetry = 0
+ n = x.size
+
+ f0 = f.values(x)
+ zero = f.zero
+ one = f.one
+ two = f.two
+ p5 = one/two
+ d = norm(f0,zero)
+ minfact = f.ten*f.ten*f.ten
+ minfact = one/minfact
+ e = f.eps
+ while d >= e do
+ nRetry += 1
+ # Not yet converged. => Compute Jacobian matrix
+ dfdx = jacobian(f,f0,x)
+ # Solve dfdx*dx = -f0 to estimate dx
+ dx = lusolve(dfdx,f0,ludecomp(dfdx,n,zero,one),zero)
+ fact = two
+ xs = x.dup
+ begin
+ fact *= p5
+ if fact < minfact then
+ raize "Failed to reduce function values."
+ end
+ for i in 0...n do
+ x[i] = xs[i] - dx[i]*fact
+ end
+ f0 = f.values(x)
+ dn = norm(f0,zero)
+ end while(dn>=d)
+ d = dn
+ end
+ nRetry
+ end
+end
diff --git a/ext/bigdecimal/lib/bigdecimal/nlsolve.rb b/ext/bigdecimal/lib/bigdecimal/nlsolve.rb
new file mode 100644
index 0000000000..08f17f9ecd
--- /dev/null
+++ b/ext/bigdecimal/lib/bigdecimal/nlsolve.rb
@@ -0,0 +1,38 @@
+#!/usr/local/bin/ruby
+
+#
+# nlsolve.rb
+# An example for solving nonlinear algebraic equation system.
+#
+
+require "bigdecimal"
+require "newton"
+include Newton
+
+class Function
+ def initialize()
+ @zero = BigDecimal::new("0.0")
+ @one = BigDecimal::new("1.0")
+ @two = BigDecimal::new("2.0")
+ @ten = BigDecimal::new("10.0")
+ @eps = BigDecimal::new("1.0e-16")
+ end
+ def zero;@zero;end
+ def one ;@one ;end
+ def two ;@two ;end
+ def ten ;@ten ;end
+ def eps ;@eps ;end
+ def values(x) # <= defines functions solved
+ f = []
+ f1 = x[0]*x[0] + x[1]*x[1] - @two # f1 = x**2 + y**2 - 2 => 0
+ f2 = x[0] - x[1] # f2 = x - y => 0
+ f <<= f1
+ f <<= f2
+ f
+ end
+end
+ f = BigDecimal::limit(100)
+ f = Function.new
+ x = [f.zero,f.zero] # Initial values
+ n = nlsolve(f,x)
+ p x
diff --git a/ext/bigdecimal/lib/bigdecimal/util.rb b/ext/bigdecimal/lib/bigdecimal/util.rb
new file mode 100644
index 0000000000..1f8d6c7a49
--- /dev/null
+++ b/ext/bigdecimal/lib/bigdecimal/util.rb
@@ -0,0 +1,68 @@
+#
+# BigDecimal utility library.
+# ----------------------------------------------------------------------
+# Contents:
+#
+# String#
+# to_d ... to BigDecimal
+#
+# Float#
+# to_d ... to BigDecimal
+#
+# BigDecimal#
+# to_r ... to Rational
+#
+# Rational#
+# to_d ... to BigDecimal
+#
+# ----------------------------------------------------------------------
+#
+class Float < Numeric
+ def to_d
+ BigDecimal(self.to_s)
+ end
+end
+
+class String
+ def to_d
+ BigDecimal(self)
+ end
+end
+
+class BigDecimal < Numeric
+ # to "nnnnnn.mmm" form digit string
+ # Use BigDecimal#to_s("F") instead.
+ def to_digits
+ if self.nan? || self.infinite? || self.zero?
+ self.to_s
+ else
+ i = self.to_i.to_s
+ s,f,y,z = self.frac.split
+ i + "." + ("0"*(-z)) + f
+ end
+ end
+
+ # Convert BigDecimal to Rational
+ def to_r
+ sign,digits,base,power = self.split
+ numerator = sign*digits.to_i
+ denomi_power = power - digits.size # base is always 10
+ if denomi_power < 0
+ denominator = base ** (-denomi_power)
+ else
+ denominator = base ** denomi_power
+ end
+ Rational(numerator,denominator)
+ end
+end
+
+class Rational < Numeric
+ # Convert Rational to BigDecimal
+ def to_d(nFig=0)
+ num = self.numerator.to_s
+ if nFig<=0
+ nFig = BigDecimal.double_fig*2+1
+ end
+ BigDecimal.new(num).div(self.denominator,nFig)
+ end
+end
diff --git a/ext/bigdecimal/sample/linear.rb b/ext/bigdecimal/sample/linear.rb
new file mode 100644
index 0000000000..7c8ca263eb
--- /dev/null
+++ b/ext/bigdecimal/sample/linear.rb
@@ -0,0 +1,71 @@
+#!/usr/local/bin/ruby
+
+#
+# linear.rb
+#
+# Solves linear equation system(A*x = b) by LU decomposition method.
+# where A is a coefficient matrix,x is an answer vector,b is a constant vector.
+#
+# USAGE:
+# ruby linear.rb [input file solved]
+#
+
+require "bigdecimal"
+require "ludcmp"
+
+#
+# NOTE:
+# Change following BigDecimal::limit() if needed.
+BigDecimal::limit(100)
+#
+
+include LUSolve
+def rd_order(na)
+ printf("Number of equations ?") if(na <= 0)
+ n = ARGF.gets().to_i
+end
+
+na = ARGV.size
+zero = BigDecimal::new("0.0")
+one = BigDecimal::new("1.0")
+
+while (n=rd_order(na))>0
+ a = []
+ as= []
+ b = []
+ if na <= 0
+ # Read data from console.
+ printf("\nEnter coefficient matrix element A[i,j]\n");
+ for i in 0...n do
+ for j in 0...n do
+ printf("A[%d,%d]? ",i,j); s = ARGF.gets
+ a << BigDecimal::new(s);
+ as << BigDecimal::new(s);
+ end
+ printf("Contatant vector element b[%d] ? ",i); b << BigDecimal::new(ARGF.gets);
+ end
+ else
+ # Read data from specified file.
+ printf("Coefficient matrix and constant vector.\n");
+ for i in 0...n do
+ s = ARGF.gets
+ printf("%d) %s",i,s)
+ s = s.split
+ for j in 0...n do
+ a << BigDecimal::new(s[j]);
+ as << BigDecimal::new(s[j]);
+ end
+ b << BigDecimal::new(s[n]);
+ end
+ end
+ x = lusolve(a,b,ludecomp(a,n,zero,one),zero)
+ printf("Answer(x[i] & (A*x-b)[i]) follows\n")
+ for i in 0...n do
+ printf("x[%d]=%s ",i,x[i].to_s)
+ s = zero
+ for j in 0...n do
+ s = s + as[i*n+j]*x[j]
+ end
+ printf(" & %s\n",(s-b[i]).to_s)
+ end
+end
diff --git a/ext/bigdecimal/sample/nlsolve.rb b/ext/bigdecimal/sample/nlsolve.rb
new file mode 100644
index 0000000000..08f17f9ecd
--- /dev/null
+++ b/ext/bigdecimal/sample/nlsolve.rb
@@ -0,0 +1,38 @@
+#!/usr/local/bin/ruby
+
+#
+# nlsolve.rb
+# An example for solving nonlinear algebraic equation system.
+#
+
+require "bigdecimal"
+require "newton"
+include Newton
+
+class Function
+ def initialize()
+ @zero = BigDecimal::new("0.0")
+ @one = BigDecimal::new("1.0")
+ @two = BigDecimal::new("2.0")
+ @ten = BigDecimal::new("10.0")
+ @eps = BigDecimal::new("1.0e-16")
+ end
+ def zero;@zero;end
+ def one ;@one ;end
+ def two ;@two ;end
+ def ten ;@ten ;end
+ def eps ;@eps ;end
+ def values(x) # <= defines functions solved
+ f = []
+ f1 = x[0]*x[0] + x[1]*x[1] - @two # f1 = x**2 + y**2 - 2 => 0
+ f2 = x[0] - x[1] # f2 = x - y => 0
+ f <<= f1
+ f <<= f2
+ f
+ end
+end
+ f = BigDecimal::limit(100)
+ f = Function.new
+ x = [f.zero,f.zero] # Initial values
+ n = nlsolve(f,x)
+ p x
diff --git a/ext/bigdecimal/sample/pi.rb b/ext/bigdecimal/sample/pi.rb
new file mode 100644
index 0000000000..2f7dd27d60
--- /dev/null
+++ b/ext/bigdecimal/sample/pi.rb
@@ -0,0 +1,20 @@
+#!/usr/local/bin/ruby
+
+#
+# pi.rb
+#
+# Calculates 3.1415.... (the number of times that a circle's diameter
+# will fit around the circle) using J. Machin's formula.
+#
+
+require "bigdecimal"
+require "bigdecimal/math.rb"
+
+include BigMath
+
+if ARGV.size == 1
+ print "PI("+ARGV[0]+"):\n"
+ p PI(ARGV[0].to_i)
+else
+ print "TRY: ruby pi.rb 1000 \n"
+end
diff --git a/ext/curses/.cvsignore b/ext/curses/.cvsignore
new file mode 100644
index 0000000000..4088712231
--- /dev/null
+++ b/ext/curses/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+mkmf.log
+*.def
diff --git a/ext/curses/MANIFEST b/ext/curses/MANIFEST
deleted file mode 100644
index db5e54ffe8..0000000000
--- a/ext/curses/MANIFEST
+++ /dev/null
@@ -1,6 +0,0 @@
-MANIFEST
-curses.c
-extconf.rb
-hello.rb
-rain.rb
-view.rb
diff --git a/ext/curses/curses.c b/ext/curses/curses.c
index d8305a9db8..106c43da4c 100644
--- a/ext/curses/curses.c
+++ b/ext/curses/curses.c
@@ -1,55 +1,86 @@
-/*
+/* -*- C -*-
+ * $Id$
+ *
* ext/curses/curses.c
*
* by MAEDA Shugo (ender@pic-internet.or.jp)
- * modified by Yukihiro Matsumoto (matz@netlab.co.jp)
+ * modified by Yukihiro Matsumoto (matz@netlab.co.jp),
+ * Toki Yoshinori,
+ * Hitoshi Takahashi,
+ * and Takaaki Tateishi (ttate@kt.jaist.ac.jp)
+ *
+ * maintainers:
+ * - Takaaki Tateishi (ttate@kt.jaist.ac.jp)
*/
-#ifdef HAVE_NCURSES_H
+#include "ruby.h"
+#include "rubyio.h"
+
+#if defined(HAVE_NCURSES_H)
# include <ncurses.h>
+#elif defined(HAVE_NCURSES_CURSES_H)
+# include <ncurses/curses.h>
+#elif defined(HAVE_CURSES_COLR_CURSES_H)
+# include <varargs.h>
+# include <curses_colr/curses.h>
#else
-# ifdef HAVE_NCURSES_CURSES_H
-# include <ncurses/curses.h>
-# else
-# include <curses.h>
-# if (defined(__bsdi__) || defined(__NetBSD__)) && !defined(_maxx)
-# define _maxx maxx
+# include <curses.h>
+# if defined(__bsdi__) || defined(__NetBSD__) || defined(__APPLE__)
+# if !defined(_maxx)
+# define _maxx maxx
# endif
-# if (defined(__bsdi__) || defined(__NetBSD__)) && !defined(_maxy)
-# define _maxy maxy
+# if !defined(_maxy)
+# define _maxy maxy
# endif
-# if (defined(__bsdi__) || defined(__NetBSD__)) && !defined(_begx)
-# define _begx begx
+# if !defined(_begx)
+# define _begx begx
# endif
-# if (defined(__bsdi__) || defined(__NetBSD__)) && !defined(_begy)
-# define _begy begy
+# if !defined(_begy)
+# define _begy begy
# endif
# endif
#endif
-#include "ruby.h"
+#ifdef HAVE_INIT_COLOR
+# define USE_COLOR 1
+#endif
+
+/* supports only ncurses mouse routines */
+#ifdef NCURSES_MOUSE_VERSION
+# define USE_MOUSE 1
+#endif
static VALUE mCurses;
+static VALUE mKey;
static VALUE cWindow;
+#ifdef USE_MOUSE
+static VALUE cMouseEvent;
+#endif
-VALUE rb_stdscr;
+static VALUE rb_stdscr;
struct windata {
WINDOW *window;
};
+#define CHECK(c) c
+
+static VALUE window_attroff();
+static VALUE window_attron();
+static VALUE window_attrset();
+
static void
no_window()
{
- Fail("already closed window");
+ rb_raise(rb_eRuntimeError, "already closed window");
}
-#define GetWINDOW(obj, winp) {\
+#define GetWINDOW(obj, winp) do {\
+ if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)\
+ rb_raise(rb_eSecurityError, "Insecure: operation on untainted window");\
Data_Get_Struct(obj, struct windata, winp);\
if (winp->window == 0) no_window();\
-}
-
-#define CHECK(c) c
+} while (0)
static void
free_window(winp)
@@ -69,10 +100,11 @@ prep_window(class, window)
struct windata *winp;
if (window == NULL) {
- Fail("failed to create window");
+ rb_raise(rb_eRuntimeError, "failed to create window");
}
- obj = Data_Make_Struct(class, struct windata, 0, free_window, winp);
+ obj = rb_obj_alloc(class);
+ Data_Get_Struct(obj, struct windata, winp);
winp->window = window;
return obj;
@@ -84,22 +116,19 @@ prep_window(class, window)
static VALUE
curses_init_screen()
{
+ rb_secure(4);
+ if (rb_stdscr) return rb_stdscr;
initscr();
if (stdscr == 0) {
- Fail("cannot initialize curses");
+ rb_raise(rb_eRuntimeError, "cannot initialize curses");
}
clear();
rb_stdscr = prep_window(cWindow, stdscr);
- return Qnil;
+ return rb_stdscr;
}
/* def stdscr */
-static VALUE
-curses_stdscr()
-{
- if (rb_stdscr == 0) curses_init_screen();
- return rb_stdscr;
-}
+#define curses_stdscr curses_init_screen
/* def close_screen */
static VALUE
@@ -109,11 +138,12 @@ curses_close_screen()
if (!isendwin())
#endif
endwin();
+ rb_stdscr = 0;
return Qnil;
}
static void
-curses_finalize()
+curses_finalize(VALUE dummy)
{
if (stdscr
#ifdef HAVE_ISENDWIN
@@ -121,6 +151,8 @@ curses_finalize()
#endif
)
endwin();
+ rb_stdscr = 0;
+ rb_gc_unregister_address(&rb_stdscr);
}
/* def closed? */
@@ -129,9 +161,9 @@ curses_closed()
{
#ifdef HAVE_ISENDWIN
if (isendwin()) {
- return TRUE;
+ return Qtrue;
}
- return FALSE;
+ return Qfalse;
#else
rb_notimplement();
#endif
@@ -142,6 +174,7 @@ static VALUE
curses_clear(obj)
VALUE obj;
{
+ curses_stdscr();
wclear(stdscr);
return Qnil;
}
@@ -151,6 +184,7 @@ static VALUE
curses_refresh(obj)
VALUE obj;
{
+ curses_stdscr();
refresh();
return Qnil;
}
@@ -160,6 +194,7 @@ static VALUE
curses_doupdate(obj)
VALUE obj;
{
+ curses_stdscr();
#ifdef HAVE_DOUPDATE
doupdate();
#else
@@ -173,6 +208,7 @@ static VALUE
curses_echo(obj)
VALUE obj;
{
+ curses_stdscr();
echo();
return Qnil;
}
@@ -182,6 +218,7 @@ static VALUE
curses_noecho(obj)
VALUE obj;
{
+ curses_stdscr();
noecho();
return Qnil;
}
@@ -191,6 +228,7 @@ static VALUE
curses_raw(obj)
VALUE obj;
{
+ curses_stdscr();
raw();
return Qnil;
}
@@ -200,6 +238,7 @@ static VALUE
curses_noraw(obj)
VALUE obj;
{
+ curses_stdscr();
noraw();
return Qnil;
}
@@ -209,6 +248,7 @@ static VALUE
curses_cbreak(obj)
VALUE obj;
{
+ curses_stdscr();
cbreak();
return Qnil;
}
@@ -218,6 +258,7 @@ static VALUE
curses_nocbreak(obj)
VALUE obj;
{
+ curses_stdscr();
nocbreak();
return Qnil;
}
@@ -227,6 +268,7 @@ static VALUE
curses_nl(obj)
VALUE obj;
{
+ curses_stdscr();
nl();
return Qnil;
}
@@ -236,6 +278,7 @@ static VALUE
curses_nonl(obj)
VALUE obj;
{
+ curses_stdscr();
nonl();
return Qnil;
}
@@ -246,6 +289,7 @@ curses_beep(obj)
VALUE obj;
{
#ifdef HAVE_BEEP
+ curses_stdscr();
beep();
#endif
return Qnil;
@@ -257,6 +301,7 @@ curses_flash(obj)
VALUE obj;
{
#ifdef HAVE_FLASH
+ curses_stdscr();
flash();
#endif
return Qnil;
@@ -269,6 +314,7 @@ curses_ungetch(obj, ch)
VALUE ch;
{
#ifdef HAVE_UNGETCH
+ curses_stdscr();
ungetch(NUM2INT(ch));
#else
rb_notimplement();
@@ -283,6 +329,7 @@ curses_setpos(obj, y, x)
VALUE y;
VALUE x;
{
+ curses_stdscr();
move(NUM2INT(y), NUM2INT(x));
return Qnil;
}
@@ -310,6 +357,7 @@ static VALUE
curses_inch(obj)
VALUE obj;
{
+ curses_stdscr();
return CHR2FIX(inch());
}
@@ -319,6 +367,7 @@ curses_addch(obj, ch)
VALUE obj;
VALUE ch;
{
+ curses_stdscr();
addch(NUM2CHR(ch));
return Qnil;
}
@@ -329,6 +378,7 @@ curses_insch(obj, ch)
VALUE obj;
VALUE ch;
{
+ curses_stdscr();
insch(NUM2CHR(ch));
return Qnil;
}
@@ -339,6 +389,7 @@ curses_addstr(obj, str)
VALUE obj;
VALUE str;
{
+ curses_stdscr();
if (!NIL_P(str)) {
addstr(STR2CSTR(str));
}
@@ -350,7 +401,9 @@ static VALUE
curses_getch(obj)
VALUE obj;
{
- return CHR2FIX(getch());
+ rb_read_check(stdin);
+ curses_stdscr();
+ return UINT2NUM(getch());
}
/* def getstr */
@@ -359,8 +412,14 @@ curses_getstr(obj)
VALUE obj;
{
char rtn[1024]; /* This should be big enough.. I hope */
+
+ rb_read_check(stdin);
+#if defined(HAVE_GETNSTR)
+ getnstr(rtn,1023);
+#else
getstr(rtn);
- return str_taint(str_new2(rtn));
+#endif
+ return rb_tainted_str_new2(rtn);
}
/* def delch */
@@ -377,8 +436,30 @@ static VALUE
curses_deleteln(obj)
VALUE obj;
{
+#if defined(HAVE_DELETELN) || defined(deleteln)
deleteln();
+#endif
+ return Qnil;
+}
+
+/* def keyname */
+static VALUE
+curses_keyname(obj, c)
+ VALUE obj;
+ VALUE c;
+{
+#ifdef HAVE_KEYNAME
+ const char *name;
+
+ name = keyname(NUM2INT(c));
+ if (name) {
+ return rb_str_new2(name);
+ } else {
return Qnil;
+ }
+#else
+ return Qnil;
+#endif
}
static VALUE
@@ -393,44 +474,313 @@ curses_cols()
return INT2FIX(COLS);
}
+static VALUE
+curses_curs_set(VALUE obj, VALUE visibility)
+{
+#ifdef HAVE_CURS_SET
+ int n;
+ return (n = curs_set(NUM2INT(visibility)) != ERR) ? INT2FIX(n) : Qnil;
+#else
+ return Qnil;
+#endif
+}
+
+static VALUE
+curses_scrl(VALUE obj, VALUE n)
+{
+ /* may have to raise exception on ERR */
+#ifdef HAVE_SCRL
+ return (scrl(NUM2INT(n)) == OK) ? Qtrue : Qfalse;
+#else
+ return Qfalse;
+#endif
+}
+
+static VALUE
+curses_setscrreg(VALUE obj, VALUE top, VALUE bottom)
+{
+ /* may have to raise exception on ERR */
+#ifdef HAVE_SETSCRREG
+ return (setscrreg(NUM2INT(top), NUM2INT(bottom)) == OK) ? Qtrue : Qfalse;
+#else
+ return Qfalse;
+#endif
+}
+
+static VALUE
+curses_attroff(VALUE obj, VALUE attrs)
+{
+ return window_attroff(rb_stdscr,attrs);
+ /* return INT2FIX(attroff(NUM2INT(attrs))); */
+}
+
+static VALUE
+curses_attron(VALUE obj, VALUE attrs)
+{
+ return window_attron(rb_stdscr,attrs);
+ /* return INT2FIX(attroff(NUM2INT(attrs))); */
+}
+
+static VALUE
+curses_attrset(VALUE obj, VALUE attrs)
+{
+ return window_attrset(rb_stdscr,attrs);
+ /* return INT2FIX(attroff(NUM2INT(attrs))); */
+}
+
+static VALUE
+curses_bkgdset(VALUE obj, VALUE ch)
+{
+#ifdef HAVE_BKGDSET
+ bkgdset(NUM2CHR(ch));
+#endif
+ return Qnil;
+}
+
+static VALUE
+curses_bkgd(VALUE obj, VALUE ch)
+{
+#ifdef HAVE_BKGD
+ return (bkgd(NUM2CHR(ch)) == OK) ? Qtrue : Qfalse;
+#else
+ return Qfalse;
+#endif
+}
+
+static VALUE
+curses_resizeterm(VALUE obj, VALUE lin, VALUE col)
+{
+#if defined(HAVE_RESIZETERM)
+ return (resizeterm(NUM2INT(lin),NUM2INT(col)) == OK) ? Qtrue : Qfalse;
+#else
+ return Qnil;
+#endif
+}
+
+#ifdef USE_COLOR
+static VALUE
+curses_start_color(VALUE obj)
+{
+ /* may have to raise exception on ERR */
+ return (start_color() == OK) ? Qtrue : Qfalse;
+}
+
+static VALUE
+curses_init_pair(VALUE obj, VALUE pair, VALUE f, VALUE b)
+{
+ /* may have to raise exception on ERR */
+ return (init_pair(NUM2INT(pair),NUM2INT(f),NUM2INT(b)) == OK) ? Qtrue : Qfalse;
+}
+
+static VALUE
+curses_init_color(VALUE obj, VALUE color, VALUE r, VALUE g, VALUE b)
+{
+ /* may have to raise exception on ERR */
+ return (init_color(NUM2INT(color),NUM2INT(r),
+ NUM2INT(g),NUM2INT(b)) == OK) ? Qtrue : Qfalse;
+}
+
+static VALUE
+curses_has_colors(VALUE obj)
+{
+ return has_colors() ? Qtrue : Qfalse;
+}
+
+static VALUE
+curses_can_change_color(VALUE obj)
+{
+ return can_change_color() ? Qtrue : Qfalse;
+}
+
+static VALUE
+curses_color_content(VALUE obj, VALUE color)
+{
+ short r,g,b;
+
+ color_content(NUM2INT(color),&r,&g,&b);
+ return rb_ary_new3(3,INT2FIX(r),INT2FIX(g),INT2FIX(b));
+}
+
+static VALUE
+curses_pair_content(VALUE obj, VALUE pair)
+{
+ short f,b;
+
+ pair_content(NUM2INT(pair),&f,&b);
+ return rb_ary_new3(2,INT2FIX(f),INT2FIX(b));
+}
+
+static VALUE
+curses_color_pair(VALUE obj, VALUE attrs)
+{
+ return INT2FIX(COLOR_PAIR(NUM2INT(attrs)));
+}
+
+static VALUE
+curses_pair_number(VALUE obj, VALUE attrs)
+{
+ return INT2FIX(PAIR_NUMBER(NUM2INT(attrs)));
+}
+#endif /* USE_COLOR */
+
+#ifdef USE_MOUSE
+struct mousedata {
+ MEVENT *mevent;
+};
+
+static void
+no_mevent()
+{
+ rb_raise(rb_eRuntimeError, "no such mouse event");
+}
+
+#define GetMOUSE(obj, data) do {\
+ if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)\
+ rb_raise(rb_eSecurityError, "Insecure: operation on untainted mouse");\
+ Data_Get_Struct(obj, struct mousedata, data);\
+ if (data->mevent == 0) no_mevent();\
+} while (0)
+
+static void
+curses_mousedata_free(struct mousedata *mdata)
+{
+ if (mdata->mevent)
+ free(mdata->mevent);
+}
+
+static VALUE
+curses_getmouse(VALUE obj)
+{
+ struct mousedata *mdata;
+ VALUE val;
+
+ val = Data_Make_Struct(cMouseEvent,struct mousedata,
+ 0,curses_mousedata_free,mdata);
+ mdata->mevent = (MEVENT*)malloc(sizeof(MEVENT));
+ return (getmouse(mdata->mevent) == OK) ? val : Qnil;
+}
+
+static VALUE
+curses_ungetmouse(VALUE obj, VALUE mevent)
+{
+ struct mousedata *mdata;
+
+ GetMOUSE(mevent,mdata);
+ return (ungetmouse(mdata->mevent) == OK) ? Qtrue : Qfalse;
+}
+
+static VALUE
+curses_mouseinterval(VALUE obj, VALUE interval)
+{
+ return mouseinterval(NUM2INT(interval)) ? Qtrue : Qfalse;
+}
+
+static VALUE
+curses_mousemask(VALUE obj, VALUE mask)
+{
+ return INT2NUM(mousemask(NUM2UINT(mask),NULL));
+}
+
+#define DEFINE_MOUSE_GET_MEMBER(func_name,mem) \
+static VALUE func_name (VALUE mouse) \
+{ \
+ struct mousedata *mdata; \
+ GetMOUSE(mouse, mdata); \
+ return (UINT2NUM(mdata->mevent -> mem)); \
+}
+
+DEFINE_MOUSE_GET_MEMBER(curs_mouse_id, id)
+DEFINE_MOUSE_GET_MEMBER(curs_mouse_x, x)
+DEFINE_MOUSE_GET_MEMBER(curs_mouse_y, y)
+DEFINE_MOUSE_GET_MEMBER(curs_mouse_z, z)
+DEFINE_MOUSE_GET_MEMBER(curs_mouse_bstate, bstate)
+#undef define_curs_mouse_member
+#endif /* USE_MOUSE */
+
+static VALUE
+curses_timeout(VALUE obj, VALUE delay)
+{
+#ifdef HAVE_TIMEOUT
+ timeout(NUM2INT(delay));
+ return Qnil;
+#else
+ rb_notimplement();
+#endif
+}
+
+static VALUE
+curses_def_prog_mode(VALUE obj)
+{
+#ifdef HAVE_DEF_PROG_MODE
+ return def_prog_mode() == OK ? Qtrue : Qfalse;
+#else
+ rb_notimplement();
+#endif
+}
+
+static VALUE
+curses_reset_prog_mode(VALUE obj)
+{
+#ifdef HAVE_RESET_PROG_MODE
+ return reset_prog_mode() == OK ? Qtrue : Qfalse;
+#else
+ rb_notimplement();
+#endif
+}
+
/*-------------------------- class Window --------------------------*/
-/* def new(lines, cols, top, left) */
+/* def self.allocate */
static VALUE
-window_s_new(class, lines, cols, top, left)
- VALUE class;
- VALUE lines;
- VALUE cols;
+window_s_allocate(VALUE class)
+{
+ struct windata *winp;
+
+ return Data_Make_Struct(class, struct windata, 0, free_window, winp);
+}
+
+/* def initialize(h, w, top, left) */
+static VALUE
+window_initialize(obj, h, w, top, left)
+ VALUE obj;
+ VALUE h;
+ VALUE w;
VALUE top;
VALUE left;
{
- VALUE w;
+ struct windata *winp;
WINDOW *window;
-
- window = newwin(NUM2INT(lines), NUM2INT(cols), NUM2INT(top), NUM2INT(left));
+
+ rb_secure(4);
+ curses_init_screen();
+ Data_Get_Struct(obj, struct windata, winp);
+ if (winp->window) delwin(winp->window);
+ window = newwin(NUM2INT(h), NUM2INT(w), NUM2INT(top), NUM2INT(left));
wclear(window);
- w = prep_window(class, window);
- obj_call_init(w);
+ winp->window = window;
- return w;
+ return obj;
}
-/* def subwin(lines, cols, top, left) */
+/* def subwin(h, w, top, left) */
static VALUE
-window_subwin(obj, lines, cols, top, left)
+window_subwin(obj, h, w, top, left)
VALUE obj;
- VALUE lines;
- VALUE cols;
+ VALUE h;
+ VALUE w;
VALUE top;
VALUE left;
{
struct windata *winp;
WINDOW *window;
+ VALUE win;
GetWINDOW(obj, winp);
- window = subwin(winp->window, NUM2INT(lines), NUM2INT(cols),
+ window = subwin(winp->window, NUM2INT(h), NUM2INT(w),
NUM2INT(top), NUM2INT(left));
- return prep_window(cWindow, window);
+ win = prep_window(rb_obj_class(obj), window);
+
+ return win;
}
/* def close */
@@ -473,22 +823,23 @@ window_refresh(obj)
return Qnil;
}
-/* def box(vert, hor) */
+/* def noutrefresh */
static VALUE
-window_box(obj, vert, hor)
+window_noutrefresh(obj)
VALUE obj;
- VALUE vert;
- VALUE hor;
{
- struct windata *winp;
-
+ struct windata *winp;
+
GetWINDOW(obj, winp);
- box(winp->window, NUM2CHR(vert), NUM2CHR(hor));
-
+#ifdef HAVE_DOUPDATE
+ wnoutrefresh(winp->window);
+#else
+ wrefresh(winp->window);
+#endif
+
return Qnil;
}
-
/* def move(y, x) */
static VALUE
window_move(obj, y, x)
@@ -550,19 +901,19 @@ window_maxy(obj)
VALUE obj;
{
struct windata *winp;
- int x, y;
GetWINDOW(obj, winp);
-#ifdef getmaxy
+#if defined(getmaxy)
return INT2FIX(getmaxy(winp->window));
-#else
-#ifdef getmaxyx
- getmaxyx(winp->window, y, x);
- return INT2FIX(y);
+#elif defined(getmaxyx)
+ {
+ int x, y;
+ getmaxyx(winp->window, y, x);
+ return INT2FIX(y);
+ }
#else
return INT2FIX(winp->window->_maxy+1);
#endif
-#endif
}
/* def maxx */
@@ -571,19 +922,19 @@ window_maxx(obj)
VALUE obj;
{
struct windata *winp;
- int x, y;
GetWINDOW(obj, winp);
-#ifdef getmaxx
+#if defined(getmaxx)
return INT2FIX(getmaxx(winp->window));
-#else
-#ifdef getmaxyx
- getmaxyx(winp->window, y, x);
- return INT2FIX(x);
+#elif defined(getmaxyx)
+ {
+ int x, y;
+ getmaxyx(winp->window, y, x);
+ return INT2FIX(x);
+ }
#else
return INT2FIX(winp->window->_maxx+1);
#endif
-#endif
}
/* def begy */
@@ -620,6 +971,42 @@ window_begx(obj)
#endif
}
+/* def box(vert, hor) */
+static VALUE
+window_box(argc, argv, self)
+ int argc;
+ VALUE argv[], self;
+{
+ struct windata *winp;
+ VALUE vert, hor, corn;
+
+ rb_scan_args(argc, argv, "21", &vert, &hor, &corn);
+
+ GetWINDOW(self, winp);
+ box(winp->window, NUM2CHR(vert), NUM2CHR(hor));
+
+ if (!NIL_P(corn)) {
+ int cur_x, cur_y, x, y;
+ char c;
+
+ c = NUM2CHR(corn);
+ getyx(winp->window, cur_y, cur_x);
+ x = NUM2INT(window_maxx(self)) - 1;
+ y = NUM2INT(window_maxy(self)) - 1;
+ wmove(winp->window, 0, 0);
+ waddch(winp->window, c);
+ wmove(winp->window, y, 0);
+ waddch(winp->window, c);
+ wmove(winp->window, y, x);
+ waddch(winp->window, c);
+ wmove(winp->window, 0, x);
+ waddch(winp->window, c);
+ wmove(winp->window, cur_y, cur_x);
+ }
+
+ return Qnil;
+}
+
/* def standout */
static VALUE
window_standout(obj)
@@ -715,8 +1102,9 @@ window_getch(obj)
{
struct windata *winp;
+ rb_read_check(stdin);
GetWINDOW(obj, winp);
- return CHR2FIX(wgetch(winp->window));
+ return UINT2NUM(wgetch(winp->window));
}
/* def getstr */
@@ -728,8 +1116,13 @@ window_getstr(obj)
char rtn[1024]; /* This should be big enough.. I hope */
GetWINDOW(obj, winp);
+ rb_read_check(stdin);
+#if defined(HAVE_WGETNSTR)
+ wgetnstr(winp->window, rtn, 1023);
+#else
wgetstr(winp->window, rtn);
- return str_taint(str_new2(rtn));
+#endif
+ return rb_tainted_str_new2(rtn);
}
/* def delch */
@@ -749,18 +1142,249 @@ static VALUE
window_deleteln(obj)
VALUE obj;
{
+#if defined(HAVE_WDELETELN) || defined(wdeleteln)
struct windata *winp;
GetWINDOW(obj, winp);
wdeleteln(winp->window);
+#endif
return Qnil;
}
+static VALUE
+window_scrollok(VALUE obj, VALUE bf)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ scrollok(winp->window, RTEST(bf) ? TRUE : FALSE);
+ return Qnil;
+}
+
+static VALUE
+window_idlok(VALUE obj, VALUE bf)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ idlok(winp->window, RTEST(bf) ? TRUE : FALSE);
+ return Qnil;
+}
+
+static VALUE
+window_setscrreg(VALUE obj, VALUE top, VALUE bottom)
+{
+#ifdef HAVE_WSETSCRREG
+ struct windata *winp;
+ int res;
+
+ GetWINDOW(obj, winp);
+ res = wsetscrreg(winp->window, NUM2INT(top), NUM2INT(bottom));
+ /* may have to raise exception on ERR */
+ return (res == OK) ? Qtrue : Qfalse;
+#else
+ return Qfalse;
+#endif
+}
+
+static VALUE
+window_scroll(VALUE obj)
+{
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ /* may have to raise exception on ERR */
+ return (scroll(winp->window) == OK) ? Qtrue : Qfalse;
+}
+
+static VALUE
+window_scrl(VALUE obj, VALUE n)
+{
+#ifdef HAVE_WSCRL
+ struct windata *winp;
+
+ GetWINDOW(obj, winp);
+ /* may have to raise exception on ERR */
+ return (wscrl(winp->window,NUM2INT(n)) == OK) ? Qtrue : Qfalse;
+#else
+ return Qfalse;
+#endif
+}
+
+static VALUE
+window_attroff(VALUE obj, VALUE attrs)
+{
+#ifdef HAVE_WATTROFF
+ struct windata *winp;
+
+ GetWINDOW(obj,winp);
+ return INT2FIX(wattroff(winp->window,NUM2INT(attrs)));
+#else
+ return Qtrue;
+#endif
+}
+
+static VALUE
+window_attron(VALUE obj, VALUE attrs)
+{
+#ifdef HAVE_WATTRON
+ struct windata *winp;
+ VALUE val;
+
+ GetWINDOW(obj,winp);
+ val = INT2FIX(wattron(winp->window,NUM2INT(attrs)));
+ if( rb_block_given_p() ){
+ rb_yield(val);
+ wattroff(winp->window,NUM2INT(attrs));
+ return val;
+ }
+ else{
+ return val;
+ }
+#else
+ return Qtrue;
+#endif
+}
+
+static VALUE
+window_attrset(VALUE obj, VALUE attrs)
+{
+#ifdef HAVE_WATTRSET
+ struct windata *winp;
+
+ GetWINDOW(obj,winp);
+ return INT2FIX(wattrset(winp->window,NUM2INT(attrs)));
+#else
+ return Qtrue;
+#endif
+}
+
+static VALUE
+window_bkgdset(VALUE obj, VALUE ch)
+{
+#ifdef HAVE_WBKGDSET
+ struct windata *winp;
+
+ GetWINDOW(obj,winp);
+ wbkgdset(winp->window, NUM2CHR(ch));
+#endif
+ return Qnil;
+}
+
+static VALUE
+window_bkgd(VALUE obj, VALUE ch)
+{
+#ifdef HAVE_WBKGD
+ struct windata *winp;
+
+ GetWINDOW(obj,winp);
+ return (wbkgd(winp->window, NUM2CHR(ch)) == OK) ? Qtrue : Qfalse;
+#else
+ return Qfalse;
+#endif
+}
+
+static VALUE
+window_getbkgd(VALUE obj)
+{
+#ifdef HAVE_WGETBKGD
+ char c;
+ struct windata *winp;
+
+ GetWINDOW(obj,winp);
+ return (c = getbkgd(winp->window) != ERR) ? CHR2FIX(c) : Qnil;
+#else
+ return Qnil;
+#endif
+}
+
+static VALUE
+window_resize(VALUE obj, VALUE lin, VALUE col)
+{
+#if defined(HAVE_WRESIZE)
+ struct windata *winp;
+
+ GetWINDOW(obj,winp);
+ return wresize(winp->window, NUM2INT(lin), NUM2INT(col)) == OK ? Qtrue : Qfalse;
+#else
+ return Qnil;
+#endif
+}
+
+
+static VALUE
+window_keypad(VALUE obj, VALUE val)
+{
+#ifdef HAVE_KEYPAD
+ struct windata *winp;
+
+ GetWINDOW(obj,winp);
+ /* keypad() of NetBSD's libcurses returns no value */
+#if defined(__NetBSD__) && !defined(NCURSES_VERSION)
+ keypad(winp->window,(RTEST(val) ? TRUE : FALSE));
+ return Qnil;
+#else
+ /* may have to raise exception on ERR */
+ return (keypad(winp->window,RTEST(val) ? TRUE : FALSE)) == OK ?
+ Qtrue : Qfalse;
+#endif
+#else
+ rb_notimplement();
+#endif /* HAVE_KEYPAD */
+}
+
+static VALUE
+window_nodelay(VALUE obj, VALUE val)
+{
+#ifdef HAVE_NODELAY
+ struct windata *winp;
+ GetWINDOW(obj,winp);
+
+ /* nodelay() of NetBSD's libcurses returns no value */
+#if defined(__NetBSD__) && !defined(NCURSES_VERSION)
+ nodelay(winp->window, RTEST(val) ? TRUE : FALSE);
+ return Qnil;
+#else
+ return nodelay(winp->window,RTEST(val) ? TRUE : FALSE) == OK ? Qtrue : Qfalse;
+#endif
+#else
+ rb_notimplement();
+#endif
+}
+
+static VALUE
+window_timeout(VALUE obj, VALUE delay)
+{
+#ifdef HAVE_WTIMEOUT
+ struct windata *winp;
+ GetWINDOW(obj,winp);
+
+ wtimeout(winp->window,NUM2INT(delay));
+ return Qnil;
+#else
+ rb_notimplement();
+#endif
+}
+
/*------------------------- Initialization -------------------------*/
void
Init_curses()
{
- mCurses = rb_define_module("Curses");
+ mCurses = rb_define_module("Curses");
+ mKey = rb_define_module_under(mCurses, "Key");
+
+ rb_gc_register_address(&rb_stdscr);
+
+#ifdef USE_MOUSE
+ cMouseEvent = rb_define_class_under(mCurses,"MouseEvent",rb_cObject);
+ rb_undef_method(CLASS_OF(cMouseEvent),"new");
+ rb_define_method(cMouseEvent, "eid", curs_mouse_id, 0);
+ rb_define_method(cMouseEvent, "x", curs_mouse_x, 0);
+ rb_define_method(cMouseEvent, "y", curs_mouse_y, 0);
+ rb_define_method(cMouseEvent, "z", curs_mouse_z, 0);
+ rb_define_method(cMouseEvent, "bstate", curs_mouse_bstate, 0);
+#endif /* USE_MOUSE */
+
rb_define_module_function(mCurses, "init_screen", curses_init_screen, 0);
rb_define_module_function(mCurses, "close_screen", curses_close_screen, 0);
rb_define_module_function(mCurses, "closed?", curses_closed, 0);
@@ -792,16 +1416,51 @@ Init_curses()
rb_define_module_function(mCurses, "getstr", curses_getstr, 0);
rb_define_module_function(mCurses, "delch", curses_delch, 0);
rb_define_module_function(mCurses, "deleteln", curses_deleteln, 0);
+ rb_define_module_function(mCurses, "keyname", curses_keyname, 1);
rb_define_module_function(mCurses, "lines", curses_lines, 0);
rb_define_module_function(mCurses, "cols", curses_cols, 0);
-
- cWindow = rb_define_class_under(mCurses, "Window", cObject);
- rb_define_singleton_method(cWindow, "new", window_s_new, 4);
+ rb_define_module_function(mCurses, "curs_set", curses_curs_set, 1);
+ rb_define_module_function(mCurses, "scrl", curses_scrl, 1);
+ rb_define_module_function(mCurses, "setscrreg", curses_setscrreg, 2);
+ rb_define_module_function(mCurses, "attroff", curses_attroff, 1);
+ rb_define_module_function(mCurses, "attron", curses_attron, 1);
+ rb_define_module_function(mCurses, "attrset", curses_attrset, 1);
+ rb_define_module_function(mCurses, "bkgdset", curses_bkgdset, 1);
+ rb_define_module_function(mCurses, "bkgd", curses_bkgd, 1);
+ rb_define_module_function(mCurses, "resizeterm", curses_resizeterm, 2);
+ rb_define_module_function(mCurses, "resize", curses_resizeterm, 2);
+#ifdef USE_COLOR
+ rb_define_module_function(mCurses, "start_color", curses_start_color, 0);
+ rb_define_module_function(mCurses, "init_pair", curses_init_pair, 3);
+ rb_define_module_function(mCurses, "init_color", curses_init_color, 4);
+ rb_define_module_function(mCurses, "has_colors?", curses_has_colors, 0);
+ rb_define_module_function(mCurses, "can_change_color?",
+ curses_can_change_color, 0);
+ rb_define_module_function(mCurses, "color_content", curses_color_content, 1);
+ rb_define_module_function(mCurses, "pair_content", curses_pair_content, 1);
+ rb_define_module_function(mCurses, "color_pair", curses_color_pair, 1);
+ rb_define_module_function(mCurses, "pair_number", curses_pair_number, 1);
+#endif /* USE_COLOR */
+#ifdef USE_MOUSE
+ rb_define_module_function(mCurses, "getmouse", curses_getmouse, 0);
+ rb_define_module_function(mCurses, "ungetmouse", curses_ungetmouse, 1);
+ rb_define_module_function(mCurses, "mouseinterval", curses_mouseinterval, 1);
+ rb_define_module_function(mCurses, "mousemask", curses_mousemask, 1);
+#endif /* USE_MOUSE */
+
+ rb_define_module_function(mCurses, "timeout=", curses_timeout, 1);
+ rb_define_module_function(mCurses, "def_prog_mode", curses_def_prog_mode, 0);
+ rb_define_module_function(mCurses, "reset_prog_mode", curses_reset_prog_mode, 0);
+
+ cWindow = rb_define_class_under(mCurses, "Window", rb_cData);
+ rb_define_alloc_func(cWindow, window_s_allocate);
+ rb_define_method(cWindow, "initialize", window_initialize, 4);
rb_define_method(cWindow, "subwin", window_subwin, 4);
rb_define_method(cWindow, "close", window_close, 0);
rb_define_method(cWindow, "clear", window_clear, 0);
rb_define_method(cWindow, "refresh", window_refresh, 0);
- rb_define_method(cWindow, "box", window_box, 2);
+ rb_define_method(cWindow, "noutrefresh", window_noutrefresh, 0);
+ rb_define_method(cWindow, "box", window_box, -1);
rb_define_method(cWindow, "move", window_move, 2);
rb_define_method(cWindow, "setpos", window_setpos, 2);
rb_define_method(cWindow, "cury", window_cury, 0);
@@ -821,6 +1480,544 @@ Init_curses()
rb_define_method(cWindow, "getstr", window_getstr, 0);
rb_define_method(cWindow, "delch", window_delch, 0);
rb_define_method(cWindow, "deleteln", window_deleteln, 0);
+ rb_define_method(cWindow, "scroll", window_scroll, 0);
+ rb_define_method(cWindow, "scrollok", window_scrollok, 1);
+ rb_define_method(cWindow, "idlok", window_idlok, 1);
+ rb_define_method(cWindow, "setscrreg", window_setscrreg, 2);
+ rb_define_method(cWindow, "scrl", window_scrl, 1);
+ rb_define_method(cWindow, "resize", window_resize, 2);
+ rb_define_method(cWindow, "keypad", window_keypad, 1);
+ rb_define_method(cWindow, "keypad=", window_keypad, 1);
+
+ rb_define_method(cWindow, "attroff", window_attroff, 1);
+ rb_define_method(cWindow, "attron", window_attron, 1);
+ rb_define_method(cWindow, "attrset", window_attrset, 1);
+ rb_define_method(cWindow, "bkgdset", window_bkgdset, 1);
+ rb_define_method(cWindow, "bkgd", window_bkgd, 1);
+ rb_define_method(cWindow, "getbkgd", window_getbkgd, 0);
+
+ rb_define_method(cWindow, "nodelay=", window_nodelay, 1);
+ rb_define_method(cWindow, "timeout=", window_timeout, 1);
+
+#define rb_curses_define_const(c) rb_define_const(mCurses,#c,UINT2NUM(c))
+
+#ifdef USE_COLOR
+ rb_curses_define_const(A_ATTRIBUTES);
+#ifdef A_NORMAL
+ rb_curses_define_const(A_NORMAL);
+#endif
+ rb_curses_define_const(A_STANDOUT);
+ rb_curses_define_const(A_UNDERLINE);
+ rb_curses_define_const(A_REVERSE);
+ rb_curses_define_const(A_BLINK);
+ rb_curses_define_const(A_DIM);
+ rb_curses_define_const(A_BOLD);
+ rb_curses_define_const(A_PROTECT);
+#ifdef A_INVIS /* for NetBSD */
+ rb_curses_define_const(A_INVIS);
+#endif
+ rb_curses_define_const(A_ALTCHARSET);
+ rb_curses_define_const(A_CHARTEXT);
+#ifdef A_HORIZONTAL
+ rb_curses_define_const(A_HORIZONTAL);
+#endif
+#ifdef A_LEFT
+ rb_curses_define_const(A_LEFT);
+#endif
+#ifdef A_LOW
+ rb_curses_define_const(A_LOW);
+#endif
+#ifdef A_RIGHT
+ rb_curses_define_const(A_RIGHT);
+#endif
+#ifdef A_TOP
+ rb_curses_define_const(A_TOP);
+#endif
+#ifdef A_VERTICAL
+ rb_curses_define_const(A_VERTICAL);
+#endif
+ rb_curses_define_const(A_COLOR);
+
+#ifdef COLORS
+ rb_curses_define_const(COLORS);
+#endif
+ rb_curses_define_const(COLOR_BLACK);
+ rb_curses_define_const(COLOR_RED);
+ rb_curses_define_const(COLOR_GREEN);
+ rb_curses_define_const(COLOR_YELLOW);
+ rb_curses_define_const(COLOR_BLUE);
+ rb_curses_define_const(COLOR_MAGENTA);
+ rb_curses_define_const(COLOR_CYAN);
+ rb_curses_define_const(COLOR_WHITE);
+#endif /* USE_COLOR */
+#ifdef USE_MOUSE
+#ifdef BUTTON1_PRESSED
+ rb_curses_define_const(BUTTON1_PRESSED);
+#endif
+#ifdef BUTTON1_RELEASED
+ rb_curses_define_const(BUTTON1_RELEASED);
+#endif
+#ifdef BUTTON1_CLICKED
+ rb_curses_define_const(BUTTON1_CLICKED);
+#endif
+#ifdef BUTTON1_DOUBLE_CLICKED
+ rb_curses_define_const(BUTTON1_DOUBLE_CLICKED);
+#endif
+#ifdef BUTTON1_TRIPLE_CLICKED
+ rb_curses_define_const(BUTTON1_TRIPLE_CLICKED);
+#endif
+#ifdef BUTTON2_PRESSED
+ rb_curses_define_const(BUTTON2_PRESSED);
+#endif
+#ifdef BUTTON2_RELEASED
+ rb_curses_define_const(BUTTON2_RELEASED);
+#endif
+#ifdef BUTTON2_CLICKED
+ rb_curses_define_const(BUTTON2_CLICKED);
+#endif
+#ifdef BUTTON2_DOUBLE_CLICKED
+ rb_curses_define_const(BUTTON2_DOUBLE_CLICKED);
+#endif
+#ifdef BUTTON2_TRIPLE_CLICKED
+ rb_curses_define_const(BUTTON2_TRIPLE_CLICKED);
+#endif
+#ifdef BUTTON3_PRESSED
+ rb_curses_define_const(BUTTON3_PRESSED);
+#endif
+#ifdef BUTTON3_RELEASED
+ rb_curses_define_const(BUTTON3_RELEASED);
+#endif
+#ifdef BUTTON3_CLICKED
+ rb_curses_define_const(BUTTON3_CLICKED);
+#endif
+#ifdef BUTTON3_DOUBLE_CLICKED
+ rb_curses_define_const(BUTTON3_DOUBLE_CLICKED);
+#endif
+#ifdef BUTTON3_TRIPLE_CLICKED
+ rb_curses_define_const(BUTTON3_TRIPLE_CLICKED);
+#endif
+#ifdef BUTTON4_PRESSED
+ rb_curses_define_const(BUTTON4_PRESSED);
+#endif
+#ifdef BUTTON4_RELEASED
+ rb_curses_define_const(BUTTON4_RELEASED);
+#endif
+#ifdef BUTTON4_CLICKED
+ rb_curses_define_const(BUTTON4_CLICKED);
+#endif
+#ifdef BUTTON4_DOUBLE_CLICKED
+ rb_curses_define_const(BUTTON4_DOUBLE_CLICKED);
+#endif
+#ifdef BUTTON4_TRIPLE_CLICKED
+ rb_curses_define_const(BUTTON4_TRIPLE_CLICKED);
+#endif
+#ifdef BUTTON_SHIFT
+ rb_curses_define_const(BUTTON_SHIFT);
+#endif
+#ifdef BUTTON_CTRL
+ rb_curses_define_const(BUTTON_CTRL);
+#endif
+#ifdef BUTTON_ALT
+ rb_curses_define_const(BUTTON_ALT);
+#endif
+#ifdef ALL_MOUSE_EVENTS
+ rb_curses_define_const(ALL_MOUSE_EVENTS);
+#endif
+#ifdef REPORT_MOUSE_POSITION
+ rb_curses_define_const(REPORT_MOUSE_POSITION);
+#endif
+#endif /* USE_MOUSE */
+
+#if defined(KEY_MOUSE) && defined(USE_MOUSE)
+ rb_curses_define_const(KEY_MOUSE);
+ rb_define_const(mKey, "MOUSE", INT2NUM(KEY_MOUSE));
+#endif
+#ifdef KEY_MIN
+ rb_curses_define_const(KEY_MIN);
+ rb_define_const(mKey, "MIN", INT2NUM(KEY_MIN));
+#endif
+#ifdef KEY_BREAK
+ rb_curses_define_const(KEY_BREAK);
+ rb_define_const(mKey, "BREAK", INT2NUM(KEY_BREAK));
+#endif
+#ifdef KEY_DOWN
+ rb_curses_define_const(KEY_DOWN);
+ rb_define_const(mKey, "DOWN", INT2NUM(KEY_DOWN));
+#endif
+#ifdef KEY_UP
+ rb_curses_define_const(KEY_UP);
+ rb_define_const(mKey, "UP", INT2NUM(KEY_UP));
+#endif
+#ifdef KEY_LEFT
+ rb_curses_define_const(KEY_LEFT);
+ rb_define_const(mKey, "LEFT", INT2NUM(KEY_LEFT));
+#endif
+#ifdef KEY_RIGHT
+ rb_curses_define_const(KEY_RIGHT);
+ rb_define_const(mKey, "RIGHT", INT2NUM(KEY_RIGHT));
+#endif
+#ifdef KEY_HOME
+ rb_curses_define_const(KEY_HOME);
+ rb_define_const(mKey, "HOME", INT2NUM(KEY_HOME));
+#endif
+#ifdef KEY_BACKSPACE
+ rb_curses_define_const(KEY_BACKSPACE);
+ rb_define_const(mKey, "BACKSPACE", INT2NUM(KEY_BACKSPACE));
+#endif
+#ifdef KEY_F
+ /* KEY_F(n) : 0 <= n <= 63 */
+ {
+ int i;
+ char c[8];
+ for( i=0; i<64; i++ ){
+ sprintf(c, "KEY_F%d", i);
+ rb_define_const(mCurses, c, INT2NUM(KEY_F(i)));
+ sprintf(c, "F%d", i);
+ rb_define_const(mKey, c, INT2NUM(KEY_F(i)));
+ }
+ }
+#endif
+#ifdef KEY_DL
+ rb_curses_define_const(KEY_DL);
+ rb_define_const(mKey, "DL", INT2NUM(KEY_DL));
+#endif
+#ifdef KEY_IL
+ rb_curses_define_const(KEY_IL);
+ rb_define_const(mKey, "IL", INT2NUM(KEY_IL));
+#endif
+#ifdef KEY_DC
+ rb_curses_define_const(KEY_DC);
+ rb_define_const(mKey, "DC", INT2NUM(KEY_DC));
+#endif
+#ifdef KEY_IC
+ rb_curses_define_const(KEY_IC);
+ rb_define_const(mKey, "IC", INT2NUM(KEY_IC));
+#endif
+#ifdef KEY_EIC
+ rb_curses_define_const(KEY_EIC);
+ rb_define_const(mKey, "EIC", INT2NUM(KEY_EIC));
+#endif
+#ifdef KEY_CLEAR
+ rb_curses_define_const(KEY_CLEAR);
+ rb_define_const(mKey, "CLEAR", INT2NUM(KEY_CLEAR));
+#endif
+#ifdef KEY_EOS
+ rb_curses_define_const(KEY_EOS);
+ rb_define_const(mKey, "EOS", INT2NUM(KEY_EOS));
+#endif
+#ifdef KEY_EOL
+ rb_curses_define_const(KEY_EOL);
+ rb_define_const(mKey, "EOL", INT2NUM(KEY_EOL));
+#endif
+#ifdef KEY_SF
+ rb_curses_define_const(KEY_SF);
+ rb_define_const(mKey, "SF", INT2NUM(KEY_SF));
+#endif
+#ifdef KEY_SR
+ rb_curses_define_const(KEY_SR);
+ rb_define_const(mKey, "SR", INT2NUM(KEY_SR));
+#endif
+#ifdef KEY_NPAGE
+ rb_curses_define_const(KEY_NPAGE);
+ rb_define_const(mKey, "NPAGE", INT2NUM(KEY_NPAGE));
+#endif
+#ifdef KEY_PPAGE
+ rb_curses_define_const(KEY_PPAGE);
+ rb_define_const(mKey, "PPAGE", INT2NUM(KEY_PPAGE));
+#endif
+#ifdef KEY_STAB
+ rb_curses_define_const(KEY_STAB);
+ rb_define_const(mKey, "STAB", INT2NUM(KEY_STAB));
+#endif
+#ifdef KEY_CTAB
+ rb_curses_define_const(KEY_CTAB);
+ rb_define_const(mKey, "CTAB", INT2NUM(KEY_CTAB));
+#endif
+#ifdef KEY_CATAB
+ rb_curses_define_const(KEY_CATAB);
+ rb_define_const(mKey, "CATAB", INT2NUM(KEY_CATAB));
+#endif
+#ifdef KEY_ENTER
+ rb_curses_define_const(KEY_ENTER);
+ rb_define_const(mKey, "ENTER", INT2NUM(KEY_ENTER));
+#endif
+#ifdef KEY_SRESET
+ rb_curses_define_const(KEY_SRESET);
+ rb_define_const(mKey, "SRESET", INT2NUM(KEY_SRESET));
+#endif
+#ifdef KEY_RESET
+ rb_curses_define_const(KEY_RESET);
+ rb_define_const(mKey, "RESET", INT2NUM(KEY_RESET));
+#endif
+#ifdef KEY_PRINT
+ rb_curses_define_const(KEY_PRINT);
+ rb_define_const(mKey, "PRINT", INT2NUM(KEY_PRINT));
+#endif
+#ifdef KEY_LL
+ rb_curses_define_const(KEY_LL);
+ rb_define_const(mKey, "LL", INT2NUM(KEY_LL));
+#endif
+#ifdef KEY_A1
+ rb_curses_define_const(KEY_A1);
+ rb_define_const(mKey, "A1", INT2NUM(KEY_A1));
+#endif
+#ifdef KEY_A3
+ rb_curses_define_const(KEY_A3);
+ rb_define_const(mKey, "A3", INT2NUM(KEY_A3));
+#endif
+#ifdef KEY_B2
+ rb_curses_define_const(KEY_B2);
+ rb_define_const(mKey, "B2", INT2NUM(KEY_B2));
+#endif
+#ifdef KEY_C1
+ rb_curses_define_const(KEY_C1);
+ rb_define_const(mKey, "C1", INT2NUM(KEY_C1));
+#endif
+#ifdef KEY_C3
+ rb_curses_define_const(KEY_C3);
+ rb_define_const(mKey, "C3", INT2NUM(KEY_C3));
+#endif
+#ifdef KEY_BTAB
+ rb_curses_define_const(KEY_BTAB);
+ rb_define_const(mKey, "BTAB", INT2NUM(KEY_BTAB));
+#endif
+#ifdef KEY_BEG
+ rb_curses_define_const(KEY_BEG);
+ rb_define_const(mKey, "BEG", INT2NUM(KEY_BEG));
+#endif
+#ifdef KEY_CANCEL
+ rb_curses_define_const(KEY_CANCEL);
+ rb_define_const(mKey, "CANCEL", INT2NUM(KEY_CANCEL));
+#endif
+#ifdef KEY_CLOSE
+ rb_curses_define_const(KEY_CLOSE);
+ rb_define_const(mKey, "CLOSE", INT2NUM(KEY_CLOSE));
+#endif
+#ifdef KEY_COMMAND
+ rb_curses_define_const(KEY_COMMAND);
+ rb_define_const(mKey, "COMMAND", INT2NUM(KEY_COMMAND));
+#endif
+#ifdef KEY_COPY
+ rb_curses_define_const(KEY_COPY);
+ rb_define_const(mKey, "COPY", INT2NUM(KEY_COPY));
+#endif
+#ifdef KEY_CREATE
+ rb_curses_define_const(KEY_CREATE);
+ rb_define_const(mKey, "CREATE", INT2NUM(KEY_CREATE));
+#endif
+#ifdef KEY_END
+ rb_curses_define_const(KEY_END);
+ rb_define_const(mKey, "END", INT2NUM(KEY_END));
+#endif
+#ifdef KEY_EXIT
+ rb_curses_define_const(KEY_EXIT);
+ rb_define_const(mKey, "EXIT", INT2NUM(KEY_EXIT));
+#endif
+#ifdef KEY_FIND
+ rb_curses_define_const(KEY_FIND);
+ rb_define_const(mKey, "FIND", INT2NUM(KEY_FIND));
+#endif
+#ifdef KEY_HELP
+ rb_curses_define_const(KEY_HELP);
+ rb_define_const(mKey, "HELP", INT2NUM(KEY_HELP));
+#endif
+#ifdef KEY_MARK
+ rb_curses_define_const(KEY_MARK);
+ rb_define_const(mKey, "MARK", INT2NUM(KEY_MARK));
+#endif
+#ifdef KEY_MESSAGE
+ rb_curses_define_const(KEY_MESSAGE);
+ rb_define_const(mKey, "MESSAGE", INT2NUM(KEY_MESSAGE));
+#endif
+#ifdef KEY_MOVE
+ rb_curses_define_const(KEY_MOVE);
+ rb_define_const(mKey, "MOVE", INT2NUM(KEY_MOVE));
+#endif
+#ifdef KEY_NEXT
+ rb_curses_define_const(KEY_NEXT);
+ rb_define_const(mKey, "NEXT", INT2NUM(KEY_NEXT));
+#endif
+#ifdef KEY_OPEN
+ rb_curses_define_const(KEY_OPEN);
+ rb_define_const(mKey, "OPEN", INT2NUM(KEY_OPEN));
+#endif
+#ifdef KEY_OPTIONS
+ rb_curses_define_const(KEY_OPTIONS);
+ rb_define_const(mKey, "OPTIONS", INT2NUM(KEY_OPTIONS));
+#endif
+#ifdef KEY_PREVIOUS
+ rb_curses_define_const(KEY_PREVIOUS);
+ rb_define_const(mKey, "PREVIOUS", INT2NUM(KEY_PREVIOUS));
+#endif
+#ifdef KEY_REDO
+ rb_curses_define_const(KEY_REDO);
+ rb_define_const(mKey, "REDO", INT2NUM(KEY_REDO));
+#endif
+#ifdef KEY_REFERENCE
+ rb_curses_define_const(KEY_REFERENCE);
+ rb_define_const(mKey, "REFERENCE", INT2NUM(KEY_REFERENCE));
+#endif
+#ifdef KEY_REFRESH
+ rb_curses_define_const(KEY_REFRESH);
+ rb_define_const(mKey, "REFRESH", INT2NUM(KEY_REFRESH));
+#endif
+#ifdef KEY_REPLACE
+ rb_curses_define_const(KEY_REPLACE);
+ rb_define_const(mKey, "REPLACE", INT2NUM(KEY_REPLACE));
+#endif
+#ifdef KEY_RESTART
+ rb_curses_define_const(KEY_RESTART);
+ rb_define_const(mKey, "RESTART", INT2NUM(KEY_RESTART));
+#endif
+#ifdef KEY_RESUME
+ rb_curses_define_const(KEY_RESUME);
+ rb_define_const(mKey, "RESUME", INT2NUM(KEY_RESUME));
+#endif
+#ifdef KEY_SAVE
+ rb_curses_define_const(KEY_SAVE);
+ rb_define_const(mKey, "SAVE", INT2NUM(KEY_SAVE));
+#endif
+#ifdef KEY_SBEG
+ rb_curses_define_const(KEY_SBEG);
+ rb_define_const(mKey, "SBEG", INT2NUM(KEY_SBEG));
+#endif
+#ifdef KEY_SCANCEL
+ rb_curses_define_const(KEY_SCANCEL);
+ rb_define_const(mKey, "SCANCEL", INT2NUM(KEY_SCANCEL));
+#endif
+#ifdef KEY_SCOMMAND
+ rb_curses_define_const(KEY_SCOMMAND);
+ rb_define_const(mKey, "SCOMMAND", INT2NUM(KEY_SCOMMAND));
+#endif
+#ifdef KEY_SCOPY
+ rb_curses_define_const(KEY_SCOPY);
+ rb_define_const(mKey, "SCOPY", INT2NUM(KEY_SCOPY));
+#endif
+#ifdef KEY_SCREATE
+ rb_curses_define_const(KEY_SCREATE);
+ rb_define_const(mKey, "SCREATE", INT2NUM(KEY_SCREATE));
+#endif
+#ifdef KEY_SDC
+ rb_curses_define_const(KEY_SDC);
+ rb_define_const(mKey, "SDC", INT2NUM(KEY_SDC));
+#endif
+#ifdef KEY_SDL
+ rb_curses_define_const(KEY_SDL);
+ rb_define_const(mKey, "SDL", INT2NUM(KEY_SDL));
+#endif
+#ifdef KEY_SELECT
+ rb_curses_define_const(KEY_SELECT);
+ rb_define_const(mKey, "SELECT", INT2NUM(KEY_SELECT));
+#endif
+#ifdef KEY_SEND
+ rb_curses_define_const(KEY_SEND);
+ rb_define_const(mKey, "SEND", INT2NUM(KEY_SEND));
+#endif
+#ifdef KEY_SEOL
+ rb_curses_define_const(KEY_SEOL);
+ rb_define_const(mKey, "SEOL", INT2NUM(KEY_SEOL));
+#endif
+#ifdef KEY_SEXIT
+ rb_curses_define_const(KEY_SEXIT);
+ rb_define_const(mKey, "SEXIT", INT2NUM(KEY_SEXIT));
+#endif
+#ifdef KEY_SFIND
+ rb_curses_define_const(KEY_SFIND);
+ rb_define_const(mKey, "SFIND", INT2NUM(KEY_SFIND));
+#endif
+#ifdef KEY_SHELP
+ rb_curses_define_const(KEY_SHELP);
+ rb_define_const(mKey, "SHELP", INT2NUM(KEY_SHELP));
+#endif
+#ifdef KEY_SHOME
+ rb_curses_define_const(KEY_SHOME);
+ rb_define_const(mKey, "SHOME", INT2NUM(KEY_SHOME));
+#endif
+#ifdef KEY_SIC
+ rb_curses_define_const(KEY_SIC);
+ rb_define_const(mKey, "SIC", INT2NUM(KEY_SIC));
+#endif
+#ifdef KEY_SLEFT
+ rb_curses_define_const(KEY_SLEFT);
+ rb_define_const(mKey, "SLEFT", INT2NUM(KEY_SLEFT));
+#endif
+#ifdef KEY_SMESSAGE
+ rb_curses_define_const(KEY_SMESSAGE);
+ rb_define_const(mKey, "SMESSAGE", INT2NUM(KEY_SMESSAGE));
+#endif
+#ifdef KEY_SMOVE
+ rb_curses_define_const(KEY_SMOVE);
+ rb_define_const(mKey, "SMOVE", INT2NUM(KEY_SMOVE));
+#endif
+#ifdef KEY_SNEXT
+ rb_curses_define_const(KEY_SNEXT);
+ rb_define_const(mKey, "SNEXT", INT2NUM(KEY_SNEXT));
+#endif
+#ifdef KEY_SOPTIONS
+ rb_curses_define_const(KEY_SOPTIONS);
+ rb_define_const(mKey, "SOPTIONS", INT2NUM(KEY_SOPTIONS));
+#endif
+#ifdef KEY_SPREVIOUS
+ rb_curses_define_const(KEY_SPREVIOUS);
+ rb_define_const(mKey, "SPREVIOUS", INT2NUM(KEY_SPREVIOUS));
+#endif
+#ifdef KEY_SPRINT
+ rb_curses_define_const(KEY_SPRINT);
+ rb_define_const(mKey, "SPRINT", INT2NUM(KEY_SPRINT));
+#endif
+#ifdef KEY_SREDO
+ rb_curses_define_const(KEY_SREDO);
+ rb_define_const(mKey, "SREDO", INT2NUM(KEY_SREDO));
+#endif
+#ifdef KEY_SREPLACE
+ rb_curses_define_const(KEY_SREPLACE);
+ rb_define_const(mKey, "SREPLACE", INT2NUM(KEY_SREPLACE));
+#endif
+#ifdef KEY_SRIGHT
+ rb_curses_define_const(KEY_SRIGHT);
+ rb_define_const(mKey, "SRIGHT", INT2NUM(KEY_SRIGHT));
+#endif
+#ifdef KEY_SRSUME
+ rb_curses_define_const(KEY_SRSUME);
+ rb_define_const(mKey, "SRSUME", INT2NUM(KEY_SRSUME));
+#endif
+#ifdef KEY_SSAVE
+ rb_curses_define_const(KEY_SSAVE);
+ rb_define_const(mKey, "SSAVE", INT2NUM(KEY_SSAVE));
+#endif
+#ifdef KEY_SSUSPEND
+ rb_curses_define_const(KEY_SSUSPEND);
+ rb_define_const(mKey, "SSUSPEND", INT2NUM(KEY_SSUSPEND));
+#endif
+#ifdef KEY_SUNDO
+ rb_curses_define_const(KEY_SUNDO);
+ rb_define_const(mKey, "SUNDO", INT2NUM(KEY_SUNDO));
+#endif
+#ifdef KEY_SUSPEND
+ rb_curses_define_const(KEY_SUSPEND);
+ rb_define_const(mKey, "SUSPEND", INT2NUM(KEY_SUSPEND));
+#endif
+#ifdef KEY_UNDO
+ rb_curses_define_const(KEY_UNDO);
+ rb_define_const(mKey, "UNDO", INT2NUM(KEY_UNDO));
+#endif
+#ifdef KEY_RESIZE
+ rb_curses_define_const(KEY_RESIZE);
+ rb_define_const(mKey, "RESIZE", INT2NUM(KEY_RESIZE));
+#endif
+#ifdef KEY_MAX
+ rb_curses_define_const(KEY_MAX);
+ rb_define_const(mKey, "MAX", INT2NUM(KEY_MAX));
+#endif
+ {
+ int c;
+ char name[] = "KEY_CTRL_x";
+ for( c = 'A'; c <= 'Z'; c++ ){
+ sprintf(name, "KEY_CTRL_%c", c);
+ rb_define_const(mCurses, name, INT2FIX(c - 'A' + 1));
+ }
+ }
+#undef rb_curses_define_const
rb_set_end_proc(curses_finalize, 0);
}
diff --git a/ext/curses/depend b/ext/curses/depend
new file mode 100644
index 0000000000..ecb79e512d
--- /dev/null
+++ b/ext/curses/depend
@@ -0,0 +1 @@
+curses.o: curses.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/curses/extconf.rb b/ext/curses/extconf.rb
index 244c9085c4..9b319ba30e 100644
--- a/ext/curses/extconf.rb
+++ b/ext/curses/extconf.rb
@@ -1,22 +1,31 @@
require 'mkmf'
-$CFLAGS="-I/usr/include/ncurses -I/usr/local/include/ncurses"
-$LDFLAGS="-L/usr/local/lib"
-make=FALSE
-if have_header("ncurses.h") and have_library("ncurses", "initscr")
- make=TRUE
-elsif have_header("ncurses/curses.h") and have_library("ncurses", "initscr")
- make=TRUE
-else
- $CFLAGS=nil
- have_library("termcap", "tgetent")
- if have_library("curses", "initscr")
- make=TRUE
- end
+
+dir_config('curses')
+dir_config('ncurses')
+dir_config('termcap')
+
+make=false
+have_library("mytinfo", "tgetent") if /bow/ =~ RUBY_PLATFORM
+have_library("tinfo", "tgetent") or have_library("termcap", "tgetent")
+if have_header(*curses=%w"ncurses.h") and have_library("ncurses", "initscr")
+ make=true
+elsif have_header(*curses=%w"ncurses/curses.h") and have_library("ncurses", "initscr")
+ make=true
+elsif have_header(*curses=%w"curses_colr/curses.h") and have_library("cur_colr", "initscr")
+ curses.unshift("varargs.h")
+ make=true
+elsif have_header(*curses=%w"curses.h") and have_library("curses", "initscr")
+ make=true
end
-if make then
- for f in ["isendwin", "ungetch", "beep", "doupdate", "flash"]
+if make
+ for f in %w(beep bkgd bkgdset curs_set deleteln doupdate flash getbkgd getnstr init isendwin keyname keypad resizeterm scrl set setscrreg ungetch wattroff wattron wattrset wbkgd wbkgdset wdeleteln wgetnstr wresize wscrl wsetscrreg def_prog_mode reset_prog_mode timeout wtimeout nodelay init_color)
have_func(f)
end
+ flag = "-D_XOPEN_SOURCE_EXTENDED"
+ src = "int test_var[(sizeof(char*)>sizeof(int))*2-1];"
+ if try_compile(cpp_include(%w[stdio.h stdlib.h]+curses)+src , flag)
+ $defs << flag
+ end
create_makefile("curses")
end
diff --git a/ext/curses/hello.rb b/ext/curses/hello.rb
index a1915ce60d..7f57d801a3 100644
--- a/ext/curses/hello.rb
+++ b/ext/curses/hello.rb
@@ -7,7 +7,7 @@ def show_message(message)
width = message.length + 6
win = Window.new(5, width,
(lines - 5) / 2, (cols - width) / 2)
- win.box(?|, ?=)
+ win.box(?|, ?-)
win.setpos(2, 3)
win.addstr(message)
win.refresh
diff --git a/ext/curses/mouse.rb b/ext/curses/mouse.rb
new file mode 100644
index 0000000000..c42bc31f33
--- /dev/null
+++ b/ext/curses/mouse.rb
@@ -0,0 +1,53 @@
+#!/usr/local/bin/ruby
+
+require "curses"
+include Curses
+
+def show_message(*msgs)
+ message = msgs.join
+ width = message.length + 6
+ win = Window.new(5, width,
+ (lines - 5) / 2, (cols - width) / 2)
+ win.keypad = true
+ win.attron(color_pair(COLOR_RED)){
+ win.box(?|, ?-, ?+)
+ }
+ win.setpos(2, 3)
+ win.addstr(message)
+ win.refresh
+ win.getch
+ win.close
+end
+
+init_screen
+start_color
+init_pair(COLOR_BLUE,COLOR_BLUE,COLOR_WHITE)
+init_pair(COLOR_RED,COLOR_RED,COLOR_WHITE)
+crmode
+noecho
+stdscr.keypad(true)
+
+begin
+ mousemask(BUTTON1_CLICKED|BUTTON2_CLICKED|BUTTON3_CLICKED|BUTTON4_CLICKED)
+ setpos((lines - 5) / 2, (cols - 10) / 2)
+ attron(color_pair(COLOR_BLUE)|A_BOLD){
+ addstr("click")
+ }
+ refresh
+ while( true )
+ c = getch
+ case c
+ when KEY_MOUSE
+ m = getmouse
+ if( m )
+ show_message("getch = #{c.inspect}, ",
+ "mouse event = #{'0x%x' % m.bstate}, ",
+ "axis = (#{m.x},#{m.y},#{m.z})")
+ end
+ break
+ end
+ end
+ refresh
+ensure
+ close_screen
+end
diff --git a/ext/curses/view2.rb b/ext/curses/view2.rb
new file mode 100644
index 0000000000..18d9619216
--- /dev/null
+++ b/ext/curses/view2.rb
@@ -0,0 +1,115 @@
+#!/usr/local/bin/ruby
+
+require "curses"
+
+if ARGV.size != 1 then
+ printf("usage: view file\n");
+ exit
+end
+begin
+ fp = open(ARGV[0], "r")
+rescue
+ raise "cannot open file: #{ARGV[1]}"
+end
+
+# signal(SIGINT, finish)
+
+Curses.init_screen
+Curses.nonl
+Curses.cbreak
+Curses.noecho
+
+$screen = Curses.stdscr
+
+$screen.scrollok(true)
+#$screen.keypad(true)
+
+# slurp the file
+$data_lines = []
+fp.each_line { |l|
+ $data_lines.push(l.chop)
+}
+fp.close
+
+$top = 0
+$data_lines[0..$screen.maxy-1].each_with_index{|line, idx|
+ $screen.setpos(idx, 0)
+ $screen.addstr(line)
+}
+$screen.setpos(0,0)
+$screen.refresh
+
+def scroll_up
+ if( $top > 0 )
+ $screen.scrl(-1)
+ $top -= 1
+ str = $data_lines[$top]
+ if( str )
+ $screen.setpos(0, 0)
+ $screen.addstr(str)
+ end
+ return true
+ else
+ return false
+ end
+end
+
+def scroll_down
+ if( $top + $screen.maxy < $data_lines.length )
+ $screen.scrl(1)
+ $top += 1
+ str = $data_lines[$top + $screen.maxy - 1]
+ if( str )
+ $screen.setpos($screen.maxy - 1, 0)
+ $screen.addstr(str)
+ end
+ return true
+ else
+ return false
+ end
+end
+
+while true
+ result = true
+ c = Curses.getch
+ case c
+ when Curses::KEY_DOWN, Curses::KEY_CTRL_N
+ result = scroll_down
+ when Curses::KEY_UP, Curses::KEY_CTRL_P
+ result = scroll_up
+ when Curses::KEY_NPAGE, ?\s # white space
+ for i in 0..($screen.maxy - 2)
+ if( ! scroll_down )
+ if( i == 0 )
+ result = false
+ end
+ break
+ end
+ end
+ when Curses::KEY_PPAGE
+ for i in 0..($screen.maxy - 2)
+ if( ! scroll_up )
+ if( i == 0 )
+ result = false
+ end
+ break
+ end
+ end
+ when Curses::KEY_LEFT, Curses::KEY_CTRL_T
+ while( scroll_up )
+ end
+ when Curses::KEY_RIGHT, Curses::KEY_CTRL_B
+ while( scroll_down )
+ end
+ when ?q
+ break
+ else
+ $screen.setpos(0,0)
+ $screen.addstr("[unknown key `#{Curses.keyname(c)}'=#{c}] ")
+ end
+ if( !result )
+ Curses.beep
+ end
+ $screen.setpos(0,0)
+end
+Curses.close_screen
diff --git a/ext/cygwin32_ld.rb b/ext/cygwin32_ld.rb
deleted file mode 100644
index a9c8e21cb0..0000000000
--- a/ext/cygwin32_ld.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/local/bin/ruby
-require '../../rbconfig'
-include Config
-
-args = ARGV.join(" ")
-
-objs = []
-flags = []
-libname = ''
-Init = "../init"
-
-path = ''
-
-def writeInit
- out = open("#{Init}.c", "w")
-
- out.print %q@
-#include <windows.h>
-#include <stdio.h>
-
-extern struct _reent *__imp_reent_data;
-WINAPI dll_entry(int a, int b, int c)
-{
- _impure_ptr =__imp_reent_data;
- return 1;
-}
-main(){}
-//void impure_setup(struct _reent *_impure_ptrMain)
-//{
-// _impure_ptr =__imp_reent_data;
-//}
-@
- out.close
-end
-
-def xsystem cmd
- print cmd, "\n"
- system cmd
-end
-
-if args =~ /-o (\w+)\.dll/i
- libname = $1
- # Check for path:
- if libname =~ /(\w+\/)(\w+)$/
- path = $1
- libname = $2
- end
- for arg in ARGV
- case arg
- when /\.[oa]$/i
- objs.push(arg)
- when /-o/, /\w+\.dll/i
- ;
- else
- flags << arg
- end
- end
-
- writeInit unless FileTest.exist?("#{Init}.c")
- unless FileTest.exist?("#{Init}.o") and
- File.mtime("#{Init}.c") < File.mtime("#{Init}.o")
- xsystem "gcc -c #{Init}.c -o #{Init}.o"
- end
-
- command = "echo EXPORTS > #{libname}.def"
- xsystem command
-# xsystem "echo impure_setup >> #{libname}.def"
- xsystem "nm --extern-only " + objs.join(" ") +
- " | sed -n '/^........ [CDT] _/s///p' >> #{libname}.def"
-
- command = "gcc -nostdlib -o junk.o -Wl,--base-file,#{libname}.base,--dll " +
- objs.join(" ") + " #{Init}.o "
- command.concat(flags.join(" ") +
- " -Wl,-e,_dll_entry@12 -lcygwin -lkernel32 #{CONFIG['srcdir']}/libruby.a")
- xsystem command
-
- command = "dlltool --as=as --dllname #{libname}.dll --def #{libname}.def --base-file #{libname}.base --output-exp #{libname}.exp"
- xsystem command
-
- command = "gcc -s -nostdlib -o #{libname}.dll -Wl,--dll #{libname}.exp " +
- objs.join(" ") + " #{Init}.o "
- command.concat(flags.join(" ") +
- " -Wl,-e,_dll_entry@12 -lcygwin -lkernel32 #{CONFIG['srcdir']}/libruby.a")
- xsystem command
- File.unlink "junk.o" if FileTest.exist? "junk.o"
-
-else
- # no special processing, just call ld
- xsystem "ld #{args}"
-end
diff --git a/ext/dbm/.cvsignore b/ext/dbm/.cvsignore
new file mode 100644
index 0000000000..4088712231
--- /dev/null
+++ b/ext/dbm/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+mkmf.log
+*.def
diff --git a/ext/dbm/MANIFEST b/ext/dbm/MANIFEST
deleted file mode 100644
index 8beec6783d..0000000000
--- a/ext/dbm/MANIFEST
+++ /dev/null
@@ -1,4 +0,0 @@
-MANIFEST
-dbm.c
-depend
-extconf.rb
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c
index 9bd981862e..e609327c46 100644
--- a/ext/dbm/dbm.c
+++ b/ext/dbm/dbm.c
@@ -6,22 +6,25 @@
$Date$
created at: Mon Jan 24 15:59:52 JST 1994
- Copyright (C) 1995-1998 Yukihiro Matsumoto
+ Copyright (C) 1995-2001 Yukihiro Matsumoto
************************************************/
#include "ruby.h"
-#include <ndbm.h>
+#ifdef HAVE_CDEFS_H
+# include <cdefs.h>
+#endif
+#ifdef HAVE_SYS_CDEFS_H
+# include <sys/cdefs.h>
+#endif
+#include DBM_HDR
#include <fcntl.h>
#include <errno.h>
-#ifdef USE_CWGUSI
-# include <sys/errno.h>
-#endif
-VALUE cDBM;
+static VALUE rb_cDBM, rb_eDBMError;
-extern VALUE mEnumerable;
+#define RUBY_DBM_RW_BIT 0x20000000
struct dbmdata {
int di_size;
@@ -31,11 +34,12 @@ struct dbmdata {
static void
closed_dbm()
{
- Fail("closed DBM file");
+ rb_raise(rb_eDBMError, "closed DBM file");
}
#define GetDBM(obj, dbmp) {\
Data_Get_Struct(obj, struct dbmdata, dbmp);\
+ if (dbmp == 0) closed_dbm();\
if (dbmp->di_dbm == 0) closed_dbm();\
}
@@ -43,23 +47,45 @@ static void
free_dbm(dbmp)
struct dbmdata *dbmp;
{
- if (dbmp->di_dbm) dbm_close(dbmp->di_dbm);
- free(dbmp);
+ if (dbmp) {
+ if (dbmp->di_dbm) dbm_close(dbmp->di_dbm);
+ free(dbmp);
+ }
+}
+
+static VALUE
+fdbm_close(obj)
+ VALUE obj;
+{
+ struct dbmdata *dbmp;
+
+ GetDBM(obj, dbmp);
+ dbm_close(dbmp->di_dbm);
+ dbmp->di_dbm = 0;
+
+ return Qnil;
+}
+
+static VALUE fdbm_alloc _((VALUE));
+static VALUE
+fdbm_alloc(klass)
+ VALUE klass;
+{
+ return Data_Wrap_Struct(klass, 0, free_dbm, 0);
}
static VALUE
-fdbm_s_open(argc, argv, class)
+fdbm_initialize(argc, argv, obj)
int argc;
VALUE *argv;
- VALUE class;
+ VALUE obj;
{
- VALUE file, vmode;
+ VALUE file, vmode, vflags;
DBM *dbm;
struct dbmdata *dbmp;
- int mode;
- VALUE obj;
+ int mode, flags = 0;
- if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
+ if (rb_scan_args(argc, argv, "12", &file, &vmode, &vflags) == 1) {
mode = 0666; /* default value */
}
else if (NIL_P(vmode)) {
@@ -68,52 +94,70 @@ fdbm_s_open(argc, argv, class)
else {
mode = NUM2INT(vmode);
}
- Check_SafeStr(file);
- dbm = 0;
- if (mode >= 0)
- dbm = dbm_open(RSTRING(file)->ptr, O_RDWR|O_CREAT, mode);
- if (!dbm)
- dbm = dbm_open(RSTRING(file)->ptr, O_RDWR, mode);
- if (!dbm)
- dbm = dbm_open(RSTRING(file)->ptr, O_RDONLY, mode);
+ if (!NIL_P(vflags))
+ flags = NUM2INT(vflags);
+
+ SafeStringValue(file);
+
+ if (flags & RUBY_DBM_RW_BIT) {
+ flags &= ~RUBY_DBM_RW_BIT;
+ dbm = dbm_open(RSTRING(file)->ptr, flags, mode);
+ }
+ else {
+ dbm = 0;
+ if (mode >= 0) {
+ dbm = dbm_open(RSTRING(file)->ptr, O_RDWR|O_CREAT, mode);
+ }
+ if (!dbm) {
+ dbm = dbm_open(RSTRING(file)->ptr, O_RDWR, 0);
+ }
+ if (!dbm) {
+ dbm = dbm_open(RSTRING(file)->ptr, O_RDONLY, 0);
+ }
+ }
if (!dbm) {
if (mode == -1) return Qnil;
rb_sys_fail(RSTRING(file)->ptr);
}
- obj = Data_Make_Struct(class,struct dbmdata,0,free_dbm,dbmp);
+ dbmp = ALLOC(struct dbmdata);
+ DATA_PTR(obj) = dbmp;
dbmp->di_dbm = dbm;
dbmp->di_size = -1;
- obj_call_init(obj);
return obj;
}
static VALUE
-fdbm_close(obj)
- VALUE obj;
+fdbm_s_open(argc, argv, klass)
+ int argc;
+ VALUE *argv;
+ VALUE klass;
{
- struct dbmdata *dbmp;
+ VALUE obj = Data_Wrap_Struct(klass, 0, free_dbm, 0);
- Data_Get_Struct(obj, struct dbmdata, dbmp);
- if (dbmp->di_dbm == 0) closed_dbm();
- dbm_close(dbmp->di_dbm);
- dbmp->di_dbm = 0;
+ if (NIL_P(fdbm_initialize(argc, argv, obj))) {
+ return Qnil;
+ }
- return Qnil;
+ if (rb_block_given_p()) {
+ return rb_ensure(rb_yield, obj, fdbm_close, obj);
+ }
+
+ return obj;
}
static VALUE
-fdbm_fetch(obj, keystr)
- VALUE obj, keystr;
+fdbm_fetch(obj, keystr, ifnone)
+ VALUE obj, keystr, ifnone;
{
datum key, value;
struct dbmdata *dbmp;
DBM *dbm;
- Check_Type(keystr, T_STRING);
+ StringValue(keystr);
key.dptr = RSTRING(keystr)->ptr;
key.dsize = RSTRING(keystr)->len;
@@ -121,9 +165,58 @@ fdbm_fetch(obj, keystr)
dbm = dbmp->di_dbm;
value = dbm_fetch(dbm, key);
if (value.dptr == 0) {
- return Qnil;
+ if (ifnone == Qnil && rb_block_given_p())
+ return rb_yield(rb_tainted_str_new(key.dptr, key.dsize));
+ return ifnone;
+ }
+ return rb_tainted_str_new(value.dptr, value.dsize);
+}
+
+static VALUE
+fdbm_aref(obj, keystr)
+ VALUE obj, keystr;
+{
+ return fdbm_fetch(obj, keystr, Qnil);
+}
+
+static VALUE
+fdbm_fetch_m(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE keystr, valstr, ifnone;
+
+ rb_scan_args(argc, argv, "11", &keystr, &ifnone);
+ valstr = fdbm_fetch(obj, keystr, ifnone);
+ if (argc == 1 && !rb_block_given_p() && NIL_P(valstr))
+ rb_raise(rb_eIndexError, "key not found");
+
+ return valstr;
+}
+
+static VALUE
+fdbm_index(obj, valstr)
+ VALUE obj, valstr;
+{
+ datum key, val;
+ struct dbmdata *dbmp;
+ DBM *dbm;
+
+ StringValue(valstr);
+ val.dptr = RSTRING(valstr)->ptr;
+ val.dsize = RSTRING(valstr)->len;
+
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+ for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
+ val = dbm_fetch(dbm, key);
+ if (val.dsize == RSTRING(valstr)->len &&
+ memcmp(val.dptr, RSTRING(valstr)->ptr, val.dsize) == 0) {
+ return rb_tainted_str_new(key.dptr, key.dsize);
+ }
}
- return str_taint(str_new(value.dptr, value.dsize));
+ return Qnil;
}
static VALUE
@@ -135,14 +228,78 @@ fdbm_indexes(argc, argv, obj)
VALUE new;
int i;
- new = ary_new2(argc);
+ new = rb_ary_new2(argc);
+ for (i=0; i<argc; i++) {
+ rb_ary_push(new, fdbm_fetch(obj, argv[i], Qnil));
+ }
+
+ return new;
+}
+
+static VALUE
+fdbm_select(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE new = rb_ary_new2(argc);
+ int i;
+
+ if (rb_block_given_p()) {
+ datum key, val;
+ DBM *dbm;
+ struct dbmdata *dbmp;
+
+ if (argc > 0) {
+ rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc);
+ }
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+
+ for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
+ VALUE assoc;
+ val = dbm_fetch(dbm, key);
+ assoc = rb_assoc_new(rb_tainted_str_new(key.dptr, key.dsize),
+ rb_tainted_str_new(val.dptr, val.dsize));
+ if (RTEST(rb_yield(assoc)))
+ rb_ary_push(new, assoc);
+ }
+ }
+ else {
+ rb_warn("DBM#select(index..) is deprecated; use DBM#values_at");
+
+ for (i=0; i<argc; i++) {
+ rb_ary_push(new, fdbm_fetch(obj, argv[i], Qnil));
+ }
+ }
+
+ return new;
+}
+
+static VALUE
+fdbm_values_at(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE new = rb_ary_new2(argc);
+ int i;
+
for (i=0; i<argc; i++) {
- ary_push(new, fdbm_fetch(obj, argv[i]));
+ rb_ary_push(new, fdbm_fetch(obj, argv[i], Qnil));
}
return new;
}
+static void
+fdbm_modify(obj)
+ VALUE obj;
+{
+ rb_secure(4);
+ if (OBJ_FROZEN(obj)) rb_error_frozen("DBM");
+}
+
static VALUE
fdbm_delete(obj, keystr)
VALUE obj, keystr;
@@ -150,9 +307,10 @@ fdbm_delete(obj, keystr)
datum key, value;
struct dbmdata *dbmp;
DBM *dbm;
+ VALUE valstr;
- rb_secure(4);
- Check_Type(keystr, T_STRING);
+ fdbm_modify(obj);
+ StringValue(keystr);
key.dptr = RSTRING(keystr)->ptr;
key.dsize = RSTRING(keystr)->len;
@@ -161,18 +319,21 @@ fdbm_delete(obj, keystr)
value = dbm_fetch(dbm, key);
if (value.dptr == 0) {
- if (iterator_p()) rb_yield(keystr);
+ if (rb_block_given_p()) return rb_yield(keystr);
return Qnil;
}
+ /* need to save value before dbm_delete() */
+ valstr = rb_tainted_str_new(value.dptr, value.dsize);
+
if (dbm_delete(dbm, key)) {
dbmp->di_size = -1;
- Fail("dbm_delete failed");
+ rb_raise(rb_eDBMError, "dbm_delete failed");
}
else if (dbmp->di_size >= 0) {
dbmp->di_size--;
}
- return obj;
+ return valstr;
}
static VALUE
@@ -184,18 +345,19 @@ fdbm_shift(obj)
DBM *dbm;
VALUE keystr, valstr;
- rb_secure(4);
+ fdbm_modify(obj);
GetDBM(obj, dbmp);
dbm = dbmp->di_dbm;
+ dbmp->di_size = -1;
key = dbm_firstkey(dbm);
if (!key.dptr) return Qnil;
val = dbm_fetch(dbm, key);
+ keystr = rb_tainted_str_new(key.dptr, key.dsize);
+ valstr = rb_tainted_str_new(val.dptr, val.dsize);
dbm_delete(dbm, key);
- keystr = str_taint(str_new(key.dptr, key.dsize));
- valstr = str_taint(str_new(val.dptr, val.dsize));
- return assoc_new(keystr, valstr);
+ return rb_assoc_new(keystr, valstr);
}
static VALUE
@@ -206,20 +368,36 @@ fdbm_delete_if(obj)
struct dbmdata *dbmp;
DBM *dbm;
VALUE keystr, valstr;
+ VALUE ret, ary = rb_ary_new();
+ int i, status = 0, n;
- rb_secure(4);
+ fdbm_modify(obj);
GetDBM(obj, dbmp);
dbm = dbmp->di_dbm;
+ n = dbmp->di_size;
+ dbmp->di_size = -1;
+
for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
val = dbm_fetch(dbm, key);
- keystr = str_taint(str_new(key.dptr, key.dsize));
- valstr = str_taint(str_new(val.dptr, val.dsize));
- if (RTEST(rb_yield(assoc_new(keystr, valstr)))) {
- if (dbm_delete(dbm, key)) {
- Fail("dbm_delete failed");
- }
+ keystr = rb_tainted_str_new(key.dptr, key.dsize);
+ valstr = rb_tainted_str_new(val.dptr, val.dsize);
+ ret = rb_protect(rb_yield, rb_assoc_new(rb_str_dup(keystr), valstr), &status);
+ if (status != 0) break;
+ if (RTEST(ret)) rb_ary_push(ary, keystr);
+ }
+
+ for (i = 0; i < RARRAY(ary)->len; i++) {
+ keystr = RARRAY(ary)->ptr[i];
+ StringValue(keystr);
+ key.dptr = RSTRING(keystr)->ptr;
+ key.dsize = RSTRING(keystr)->len;
+ if (dbm_delete(dbm, key)) {
+ rb_raise(rb_eDBMError, "dbm_delete failed");
}
}
+ if (status) rb_jump_tag(status);
+ if (n > 0) dbmp->di_size = n - RARRAY(ary)->len;
+
return obj;
}
@@ -231,15 +409,17 @@ fdbm_clear(obj)
struct dbmdata *dbmp;
DBM *dbm;
- rb_secure(4);
+ fdbm_modify(obj);
GetDBM(obj, dbmp);
dbm = dbmp->di_dbm;
dbmp->di_size = -1;
- for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
+ while (key = dbm_firstkey(dbm), key.dptr) {
if (dbm_delete(dbm, key)) {
- Fail("dbm_delete failed");
+ rb_raise(rb_eDBMError, "dbm_delete failed");
}
}
+ dbmp->di_size = 0;
+
return obj;
}
@@ -251,19 +431,21 @@ fdbm_invert(obj)
struct dbmdata *dbmp;
DBM *dbm;
VALUE keystr, valstr;
- VALUE hash = hash_new();
+ VALUE hash = rb_hash_new();
GetDBM(obj, dbmp);
dbm = dbmp->di_dbm;
for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
val = dbm_fetch(dbm, key);
- keystr = str_taint(str_new(key.dptr, key.dsize));
- valstr = str_taint(str_new(val.dptr, val.dsize));
- hash_aset(hash, valstr, keystr);
+ keystr = rb_tainted_str_new(key.dptr, key.dsize);
+ valstr = rb_tainted_str_new(val.dptr, val.dsize);
+ rb_hash_aset(hash, valstr, keystr);
}
- return obj;
+ return hash;
}
+static VALUE each_pair _((VALUE));
+
static VALUE
each_pair(obj)
VALUE obj;
@@ -279,7 +461,7 @@ update_i(pair, dbm)
{
Check_Type(pair, T_ARRAY);
if (RARRAY(pair)->len < 2) {
- ArgError("pair must be [key, value]");
+ rb_raise(rb_eArgError, "pair must be [key, value]");
}
fdbm_store(dbm, RARRAY(pair)->ptr[0], RARRAY(pair)->ptr[1]);
return Qnil;
@@ -310,32 +492,25 @@ fdbm_store(obj, keystr, valstr)
struct dbmdata *dbmp;
DBM *dbm;
- if (valstr == Qnil) {
- fdbm_delete(obj, keystr);
- return Qnil;
- }
-
- rb_secure(4);
- keystr = obj_as_string(keystr);
+ fdbm_modify(obj);
+ keystr = rb_obj_as_string(keystr);
key.dptr = RSTRING(keystr)->ptr;
key.dsize = RSTRING(keystr)->len;
- if (NIL_P(valstr)) return fdbm_delete(obj, keystr);
-
- valstr = obj_as_string(valstr);
+ valstr = rb_obj_as_string(valstr);
val.dptr = RSTRING(valstr)->ptr;
val.dsize = RSTRING(valstr)->len;
- Data_Get_Struct(obj, struct dbmdata, dbmp);
+ GetDBM(obj, dbmp);
dbmp->di_size = -1;
dbm = dbmp->di_dbm;
if (dbm_store(dbm, key, val, DBM_REPLACE)) {
-#ifdef HAVE_DBM_CLAERERR
+#ifdef HAVE_DBM_CLEARERR
dbm_clearerr(dbm);
#endif
if (errno == EPERM) rb_sys_fail(0);
- Fail("dbm_store failed");
+ rb_raise(rb_eDBMError, "dbm_store failed");
}
return valstr;
@@ -350,7 +525,7 @@ fdbm_length(obj)
DBM *dbm;
int i = 0;
- Data_Get_Struct(obj, struct dbmdata, dbmp);
+ GetDBM(obj, dbmp);
if (dbmp->di_size > 0) return INT2FIX(dbmp->di_size);
dbm = dbmp->di_dbm;
@@ -371,7 +546,7 @@ fdbm_empty_p(obj)
DBM *dbm;
int i = 0;
- Data_Get_Struct(obj, struct dbmdata, dbmp);
+ GetDBM(obj, dbmp);
if (dbmp->di_size < 0) {
dbm = dbmp->di_dbm;
@@ -382,8 +557,8 @@ fdbm_empty_p(obj)
else {
i = dbmp->di_size;
}
- if (i == 0) return TRUE;
- return FALSE;
+ if (i == 0) return Qtrue;
+ return Qfalse;
}
static VALUE
@@ -398,7 +573,7 @@ fdbm_each_value(obj)
dbm = dbmp->di_dbm;
for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
val = dbm_fetch(dbm, key);
- rb_yield(str_taint(str_new(val.dptr, val.dsize)));
+ rb_yield(rb_tainted_str_new(val.dptr, val.dsize));
}
return obj;
}
@@ -414,7 +589,7 @@ fdbm_each_key(obj)
GetDBM(obj, dbmp);
dbm = dbmp->di_dbm;
for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
- rb_yield(str_taint(str_new(key.dptr, key.dsize)));
+ rb_yield(rb_tainted_str_new(key.dptr, key.dsize));
}
return obj;
}
@@ -433,9 +608,9 @@ fdbm_each_pair(obj)
for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
val = dbm_fetch(dbm, key);
- keystr = str_taint(str_new(key.dptr, key.dsize));
- valstr = str_taint(str_new(val.dptr, val.dsize));
- rb_yield(assoc_new(keystr, valstr));
+ keystr = rb_tainted_str_new(key.dptr, key.dsize);
+ valstr = rb_tainted_str_new(val.dptr, val.dsize);
+ rb_yield(rb_assoc_new(keystr, valstr));
}
return obj;
@@ -453,9 +628,9 @@ fdbm_keys(obj)
GetDBM(obj, dbmp);
dbm = dbmp->di_dbm;
- ary = ary_new();
+ ary = rb_ary_new();
for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
- ary_push(ary, str_taint(str_new(key.dptr, key.dsize)));
+ rb_ary_push(ary, rb_tainted_str_new(key.dptr, key.dsize));
}
return ary;
@@ -473,10 +648,10 @@ fdbm_values(obj)
GetDBM(obj, dbmp);
dbm = dbmp->di_dbm;
- ary = ary_new();
+ ary = rb_ary_new();
for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
val = dbm_fetch(dbm, key);
- ary_push(ary, str_taint(str_new(val.dptr, val.dsize)));
+ rb_ary_push(ary, rb_tainted_str_new(val.dptr, val.dsize));
}
return ary;
@@ -490,15 +665,15 @@ fdbm_has_key(obj, keystr)
struct dbmdata *dbmp;
DBM *dbm;
- Check_Type(keystr, T_STRING);
+ StringValue(keystr);
key.dptr = RSTRING(keystr)->ptr;
key.dsize = RSTRING(keystr)->len;
GetDBM(obj, dbmp);
dbm = dbmp->di_dbm;
val = dbm_fetch(dbm, key);
- if (val.dptr) return TRUE;
- return FALSE;
+ if (val.dptr) return Qtrue;
+ return Qfalse;
}
static VALUE
@@ -509,7 +684,7 @@ fdbm_has_value(obj, valstr)
struct dbmdata *dbmp;
DBM *dbm;
- Check_Type(valstr, T_STRING);
+ StringValue(valstr);
val.dptr = RSTRING(valstr)->ptr;
val.dsize = RSTRING(valstr)->len;
@@ -519,9 +694,9 @@ fdbm_has_value(obj, valstr)
val = dbm_fetch(dbm, key);
if (val.dsize == RSTRING(valstr)->len &&
memcmp(val.dptr, RSTRING(valstr)->ptr, val.dsize) == 0)
- return TRUE;
+ return Qtrue;
}
- return FALSE;
+ return Qfalse;
}
static VALUE
@@ -536,50 +711,102 @@ fdbm_to_a(obj)
GetDBM(obj, dbmp);
dbm = dbmp->di_dbm;
- ary = ary_new();
+ ary = rb_ary_new();
for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
val = dbm_fetch(dbm, key);
- ary_push(ary, assoc_new(str_taint(str_new(key.dptr, key.dsize)),
- str_taint(str_new(val.dptr, val.dsize))));
+ rb_ary_push(ary, rb_assoc_new(rb_tainted_str_new(key.dptr, key.dsize),
+ rb_tainted_str_new(val.dptr, val.dsize)));
}
return ary;
}
+static VALUE
+fdbm_to_hash(obj)
+ VALUE obj;
+{
+ datum key, val;
+ struct dbmdata *dbmp;
+ DBM *dbm;
+ VALUE hash;
+
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+
+ hash = rb_hash_new();
+ for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
+ val = dbm_fetch(dbm, key);
+ rb_hash_aset(hash, rb_tainted_str_new(key.dptr, key.dsize),
+ rb_tainted_str_new(val.dptr, val.dsize));
+ }
+
+ return hash;
+}
+
+static VALUE
+fdbm_reject(obj)
+ VALUE obj;
+{
+ return rb_hash_delete_if(fdbm_to_hash(obj));
+}
+
+void
Init_dbm()
{
- cDBM = rb_define_class("DBM", cObject);
- rb_include_module(cDBM, mEnumerable);
-
- rb_define_singleton_method(cDBM, "open", fdbm_s_open, -1);
- rb_define_singleton_method(cDBM, "new", fdbm_s_open, -1);
- rb_define_method(cDBM, "close", fdbm_close, 0);
- rb_define_method(cDBM, "[]", fdbm_fetch, 1);
- rb_define_method(cDBM, "[]=", fdbm_store, 2);
- rb_define_method(cDBM, "indexes", fdbm_indexes, -1);
- rb_define_method(cDBM, "indices", fdbm_indexes, -1);
- rb_define_method(cDBM, "length", fdbm_length, 0);
- rb_define_alias(cDBM, "size", "length");
- rb_define_method(cDBM, "empty?", fdbm_empty_p, 0);
- rb_define_method(cDBM, "each", fdbm_each_pair, 0);
- rb_define_method(cDBM, "each_value", fdbm_each_value, 0);
- rb_define_method(cDBM, "each_key", fdbm_each_key, 0);
- rb_define_method(cDBM, "each_pair", fdbm_each_pair, 0);
- rb_define_method(cDBM, "keys", fdbm_keys, 0);
- rb_define_method(cDBM, "values", fdbm_values, 0);
- rb_define_method(cDBM, "shift", fdbm_shift, 1);
- rb_define_method(cDBM, "delete", fdbm_delete, 1);
- rb_define_method(cDBM, "delete_if", fdbm_delete_if, 0);
- rb_define_method(cDBM, "clear", fdbm_clear, 0);
- rb_define_method(cDBM,"invert", fdbm_invert, 0);
- rb_define_method(cDBM,"update", fdbm_update, 1);
- rb_define_method(cDBM,"replace", fdbm_replace, 1);
-
- rb_define_method(cDBM, "include?", fdbm_has_key, 1);
- rb_define_method(cDBM, "has_key?", fdbm_has_key, 1);
- rb_define_method(cDBM, "has_value?", fdbm_has_value, 1);
- rb_define_method(cDBM, "key?", fdbm_has_key, 1);
- rb_define_method(cDBM, "value?", fdbm_has_value, 1);
-
- rb_define_method(cDBM, "to_a", fdbm_to_a, 0);
+ rb_cDBM = rb_define_class("DBM", rb_cObject);
+ rb_eDBMError = rb_define_class("DBMError", rb_eStandardError);
+ rb_include_module(rb_cDBM, rb_mEnumerable);
+
+ rb_define_alloc_func(rb_cDBM, fdbm_alloc);
+ rb_define_singleton_method(rb_cDBM, "open", fdbm_s_open, -1);
+
+ rb_define_method(rb_cDBM, "initialize", fdbm_initialize, -1);
+ rb_define_method(rb_cDBM, "close", fdbm_close, 0);
+ rb_define_method(rb_cDBM, "[]", fdbm_aref, 1);
+ rb_define_method(rb_cDBM, "fetch", fdbm_fetch_m, -1);
+ rb_define_method(rb_cDBM, "[]=", fdbm_store, 2);
+ rb_define_method(rb_cDBM, "store", fdbm_store, 2);
+ rb_define_method(rb_cDBM, "index", fdbm_index, 1);
+ rb_define_method(rb_cDBM, "indexes", fdbm_indexes, -1);
+ rb_define_method(rb_cDBM, "indices", fdbm_indexes, -1);
+ rb_define_method(rb_cDBM, "select", fdbm_select, 0);
+ rb_define_method(rb_cDBM, "values_at", fdbm_values_at, -1);
+ rb_define_method(rb_cDBM, "length", fdbm_length, 0);
+ rb_define_method(rb_cDBM, "size", fdbm_length, 0);
+ rb_define_method(rb_cDBM, "empty?", fdbm_empty_p, 0);
+ rb_define_method(rb_cDBM, "each", fdbm_each_pair, 0);
+ rb_define_method(rb_cDBM, "each_value", fdbm_each_value, 0);
+ rb_define_method(rb_cDBM, "each_key", fdbm_each_key, 0);
+ rb_define_method(rb_cDBM, "each_pair", fdbm_each_pair, 0);
+ rb_define_method(rb_cDBM, "keys", fdbm_keys, 0);
+ rb_define_method(rb_cDBM, "values", fdbm_values, 0);
+ rb_define_method(rb_cDBM, "shift", fdbm_shift, 0);
+ rb_define_method(rb_cDBM, "delete", fdbm_delete, 1);
+ rb_define_method(rb_cDBM, "delete_if", fdbm_delete_if, 0);
+ rb_define_method(rb_cDBM, "reject!", fdbm_delete_if, 0);
+ rb_define_method(rb_cDBM, "reject", fdbm_reject, 0);
+ rb_define_method(rb_cDBM, "clear", fdbm_clear, 0);
+ rb_define_method(rb_cDBM,"invert", fdbm_invert, 0);
+ rb_define_method(rb_cDBM,"update", fdbm_update, 1);
+ rb_define_method(rb_cDBM,"replace", fdbm_replace, 1);
+
+ rb_define_method(rb_cDBM, "include?", fdbm_has_key, 1);
+ rb_define_method(rb_cDBM, "has_key?", fdbm_has_key, 1);
+ rb_define_method(rb_cDBM, "member?", fdbm_has_key, 1);
+ rb_define_method(rb_cDBM, "has_value?", fdbm_has_value, 1);
+ rb_define_method(rb_cDBM, "key?", fdbm_has_key, 1);
+ rb_define_method(rb_cDBM, "value?", fdbm_has_value, 1);
+
+ rb_define_method(rb_cDBM, "to_a", fdbm_to_a, 0);
+ rb_define_method(rb_cDBM, "to_hash", fdbm_to_hash, 0);
+
+ /* flags for dbm_open() */
+ rb_define_const(rb_cDBM, "READER", INT2FIX(O_RDONLY|RUBY_DBM_RW_BIT));
+ rb_define_const(rb_cDBM, "WRITER", INT2FIX(O_RDWR|RUBY_DBM_RW_BIT));
+ rb_define_const(rb_cDBM, "WRCREAT", INT2FIX(O_RDWR|O_CREAT|RUBY_DBM_RW_BIT));
+ rb_define_const(rb_cDBM, "NEWDB", INT2FIX(O_RDWR|O_CREAT|O_TRUNC|RUBY_DBM_RW_BIT));
+
+#ifdef DB_VERSION_STRING
+ rb_define_const(rb_cDBM, "VERSION", rb_str_new2(DB_VERSION_STRING));
+#endif
}
diff --git a/ext/dbm/depend b/ext/dbm/depend
index d7f1f419d4..5fae80b096 100644
--- a/ext/dbm/depend
+++ b/ext/dbm/depend
@@ -1 +1 @@
-dbm.o: dbm.c $(hdrdir)/ruby.h $(hdrdir)/config.h $(hdrdir)/defines.h
+dbm.o: dbm.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/dbm/extconf.rb b/ext/dbm/extconf.rb
index 3a96cee12f..5a67603e69 100644
--- a/ext/dbm/extconf.rb
+++ b/ext/dbm/extconf.rb
@@ -1,9 +1,61 @@
require 'mkmf'
-$LDFLAGS = "-L/usr/local/lib"
-have_library("gdbm", "dbm_open") or
- have_library("db", "dbm_open") or
- have_library("dbm", "dbm_open")
-if have_func("dbm_open")
- have_func("dbm_clearerr")
+
+dir_config("dbm")
+
+dblib = with_config("dbm-type", nil)
+
+$dbm_conf_headers = {
+ "db" => ["db.h"],
+ "db1" => ["db1/ndbm.h", "db1.h", "ndbm.h"],
+ "db2" => ["db2/db.h", "db2.h", "db.h"],
+ "dbm" => ["ndbm.h"],
+ "gdbm" => ["gdbm-ndbm.h", "ndbm.h"],
+ "gdbm_compat" => ["gdbm-ndbm.h", "ndbm.h"],
+ "qdbm" => ["relic.h"],
+}
+
+def db_check(db)
+ $dbm_conf_db_prefix = ""
+ $dbm_conf_have_gdbm = false
+ hsearch = ""
+
+ case db
+ when /^db2?$/
+ $dbm_conf_db_prefix = "__db_n"
+ hsearch = "-DDB_DBM_HSEARCH "
+ when "gdbm"
+ $dbm_conf_have_gdbm = true
+ when "gdbm_compat"
+ $dbm_conf_have_gdbm = true
+ have_library("gdbm") or return false
+ end
+
+ if have_library(db, db_prefix("dbm_open")) || have_func(db_prefix("dbm_open"))
+ for hdr in $dbm_conf_headers.fetch(db, ["ndbm.h"])
+ if have_header(hdr.dup) and have_type("DBM", hdr.dup, hsearch)
+ $CFLAGS += " " + hsearch + '-DDBM_HDR="<'+hdr+'>"'
+ return true
+ end
+ end
+ end
+ return false
+end
+
+def db_prefix(func)
+ $dbm_conf_db_prefix+func
+end
+
+if dblib
+ db_check(dblib)
+else
+ for dblib in %w(db db2 db1 dbm gdbm gdbm_compat qdbm)
+ db_check(dblib) and break
+ end
+end
+
+have_header("cdefs.h")
+have_header("sys/cdefs.h")
+if /DBM_HDR/ =~ $CFLAGS and have_func(db_prefix("dbm_open"))
+ have_func(db_prefix("dbm_clearerr")) unless $dbm_conf_have_gdbm
create_makefile("dbm")
end
diff --git a/ext/dbm/testdbm.rb b/ext/dbm/testdbm.rb
new file mode 100644
index 0000000000..4942ffb64a
--- /dev/null
+++ b/ext/dbm/testdbm.rb
@@ -0,0 +1,593 @@
+require 'runit/testcase'
+require 'runit/cui/testrunner'
+
+if $".grep(/\bdbm.so\b/).empty?
+ begin
+ require './dbm'
+ rescue LoadError
+ require 'dbm'
+ end
+end
+
+def uname_s
+ require 'rbconfig'
+ case Config::CONFIG['host_os']
+ when 'cygwin'
+ require 'Win32API'
+ uname = Win32API.new('cygwin1', 'uname', 'P', 'I')
+ utsname = ' ' * 100
+ raise 'cannot get system name' if uname.call(utsname) == -1
+
+ utsname.unpack('A20' * 5)[0]
+ else
+ Config::CONFIG['host_os']
+ end
+end
+
+SYSTEM = uname_s
+
+class TestDBM < RUNIT::TestCase
+ def setup
+ @path = "tmptest_dbm_"
+ assert_instance_of(DBM, @dbm = DBM.new(@path))
+
+ # prepare to make readonly DBM file
+ DBM.open("tmptest_dbm_rdonly") {|dbm|
+ dbm['foo'] = 'FOO'
+ }
+
+ File.chmod(0400, *Dir.glob("tmptest_dbm_rdonly.*"))
+
+ assert_instance_of(DBM, @dbm_rdonly = DBM.new("tmptest_dbm_rdonly", nil))
+ end
+ def teardown
+ assert_nil(@dbm.close)
+ assert_nil(@dbm_rdonly.close)
+ GC.start
+ File.delete *Dir.glob("tmptest_dbm*").to_a
+ p Dir.glob("tmptest_dbm*") if $DEBUG
+ end
+
+ def check_size(expect, dbm=@dbm)
+ assert_equals(expect, dbm.size)
+ n = 0
+ dbm.each { n+=1 }
+ assert_equals(expect, n)
+ if expect == 0
+ assert_equals(true, dbm.empty?)
+ else
+ assert_equals(false, dbm.empty?)
+ end
+ end
+
+ def test_version
+ STDERR.print DBM::VERSION
+ end
+
+ def test_s_new_has_no_block
+ # DBM.new ignore the block
+ foo = true
+ assert_instance_of(DBM, dbm = DBM.new("tmptest_dbm") { foo = false })
+ assert_equals(foo, true)
+ assert_nil(dbm.close)
+ end
+ def test_s_open_no_create
+ assert_nil(dbm = DBM.open("tmptest_dbm", nil))
+ ensure
+ dbm.close if dbm
+ end
+ def test_s_open_with_block
+ assert_equals(DBM.open("tmptest_dbm") { :foo }, :foo)
+ end
+ def test_s_open_lock
+ fork() {
+ assert_instance_of(DBM, dbm = DBM.open("tmptest_dbm", 0644))
+ sleep 2
+ }
+ begin
+ sleep 1
+ assert_exception(Errno::EWOULDBLOCK, "NEVER MIND IF YOU USE Berkeley DB3") {
+ begin
+ assert_instance_of(DBM, dbm2 = DBM.open("tmptest_dbm", 0644))
+ rescue Errno::EAGAIN, Errno::EACCES, Errno::EINVAL
+ raise Errno::EWOULDBLOCK
+ end
+ }
+ ensure
+ Process.wait
+ end
+ end
+
+=begin
+ # Is it guaranteed on many OS?
+ def test_s_open_lock_one_process
+ # locking on one process
+ assert_instance_of(DBM, dbm = DBM.open("tmptest_dbm", 0644))
+ assert_exception(Errno::EWOULDBLOCK) {
+ begin
+ DBM.open("tmptest_dbm", 0644)
+ rescue Errno::EAGAIN
+ raise Errno::EWOULDBLOCK
+ end
+ }
+ end
+=end
+
+ def test_s_open_nolock
+ # dbm 1.8.0 specific
+ if not defined? DBM::NOLOCK
+ return
+ end
+
+ fork() {
+ assert_instance_of(DBM, dbm = DBM.open("tmptest_dbm", 0644,
+ DBM::NOLOCK))
+ sleep 2
+ }
+ sleep 1
+ begin
+ dbm2 = nil
+ assert_no_exception(Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EACCES) {
+ assert_instance_of(DBM, dbm2 = DBM.open("tmptest_dbm", 0644))
+ }
+ ensure
+ Process.wait
+ dbm2.close if dbm2
+ end
+
+ p Dir.glob("tmptest_dbm*") if $DEBUG
+
+ fork() {
+ assert_instance_of(DBM, dbm = DBM.open("tmptest_dbm", 0644))
+ sleep 2
+ }
+ begin
+ sleep 1
+ dbm2 = nil
+ assert_no_exception(Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EACCES) {
+ # this test is failed on Cygwin98 (???)
+ assert_instance_of(DBM, dbm2 = DBM.open("tmptest_dbm", 0644,
+ DBM::NOLOCK))
+ }
+ ensure
+ Process.wait
+ dbm2.close if dbm2
+ end
+ end
+
+ def test_s_open_error
+ assert_instance_of(DBM, dbm = DBM.open("tmptest_dbm", 0))
+ assert_exception(Errno::EACCES, "NEVER MIND IF YOU USE Berkeley DB3") {
+ DBM.open("tmptest_dbm", 0)
+ }
+ dbm.close
+ end
+
+ def test_close
+ assert_instance_of(DBM, dbm = DBM.open("tmptest_dbm"))
+ assert_nil(dbm.close)
+
+ # closed DBM file
+ assert_exception(DBMError) { dbm.close }
+ end
+
+ def test_aref
+ assert_equals('bar', @dbm['foo'] = 'bar')
+ assert_equals('bar', @dbm['foo'])
+
+ assert_nil(@dbm['bar'])
+ end
+
+ def test_fetch
+ assert_equals('bar', @dbm['foo']='bar')
+ assert_equals('bar', @dbm.fetch('foo'))
+
+ # key not found
+ assert_exception(IndexError) {
+ @dbm.fetch('bar')
+ }
+
+ # test for `ifnone' arg
+ assert_equals('baz', @dbm.fetch('bar', 'baz'))
+
+ # test for `ifnone' block
+ assert_equals('foobar', @dbm.fetch('bar') {|key| 'foo' + key })
+ end
+
+ def test_aset
+ num = 0
+ 2.times {|i|
+ assert_equals('foo', @dbm['foo'] = 'foo')
+ assert_equals('foo', @dbm['foo'])
+ assert_equals('bar', @dbm['foo'] = 'bar')
+ assert_equals('bar', @dbm['foo'])
+
+ num += 1 if i == 0
+ assert_equals(num, @dbm.size)
+
+ # assign nil
+ assert_equals('', @dbm['bar'] = '')
+ assert_equals('', @dbm['bar'])
+
+ num += 1 if i == 0
+ assert_equals(num, @dbm.size)
+
+ # empty string
+ assert_equals('', @dbm[''] = '')
+ assert_equals('', @dbm[''])
+
+ num += 1 if i == 0
+ assert_equals(num, @dbm.size)
+
+ # Fixnum
+ assert_equals('200', @dbm['100'] = '200')
+ assert_equals('200', @dbm['100'])
+
+ num += 1 if i == 0
+ assert_equals(num, @dbm.size)
+
+ # Big key and value
+ assert_equals('y' * 100, @dbm['x' * 100] = 'y' * 100)
+ assert_equals('y' * 100, @dbm['x' * 100])
+
+ num += 1 if i == 0
+ assert_equals(num, @dbm.size)
+ }
+ end
+
+ def test_index
+ assert_equals('bar', @dbm['foo'] = 'bar')
+ assert_equals('foo', @dbm.index('bar'))
+ assert_nil(@dbm['bar'])
+ end
+
+ def test_indexes
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+ @dbm[keys[0]], @dbm[keys[1]], @dbm[keys[2]] = values
+ assert_equals(values.reverse, @dbm.indexes(*keys.reverse))
+ end
+
+ def test_values_at
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+ @dbm[keys[0]], @dbm[keys[1]], @dbm[keys[2]] = values
+ assert_equals(values.reverse, @dbm.values_at(*keys.reverse))
+ end
+
+ def test_select_with_block
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+ @dbm[keys[0]], @dbm[keys[1]], @dbm[keys[2]] = values
+ ret = @dbm.select {|k,v|
+ assert_equals(k.upcase, v)
+ k != "bar"
+ }
+ assert_equals([['baz', 'BAZ'], ['foo', 'FOO']],
+ ret.sort)
+ end
+
+ def test_length
+ num = 10
+ assert_equals(0, @dbm.size)
+ num.times {|i|
+ i = i.to_s
+ @dbm[i] = i
+ }
+ assert_equals(num, @dbm.size)
+
+ @dbm.shift
+
+ assert_equals(num - 1, @dbm.size)
+ end
+
+ def test_empty?
+ assert_equals(true, @dbm.empty?)
+ @dbm['foo'] = 'FOO'
+ assert_equals(false, @dbm.empty?)
+ end
+
+ def test_each_pair
+ n = 0
+ @dbm.each_pair { n += 1 }
+ assert_equals(0, n)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @dbm[keys[0]], @dbm[keys[1]], @dbm[keys[2]] = values
+
+ n = 0
+ ret = @dbm.each_pair {|key, val|
+ assert_not_nil(i = keys.index(key))
+ assert_equals(val, values[i])
+
+ n += 1
+ }
+ assert_equals(keys.size, n)
+ assert_equals(@dbm, ret)
+ end
+
+ def test_each_value
+ n = 0
+ @dbm.each_value { n += 1 }
+ assert_equals(0, n)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @dbm[keys[0]], @dbm[keys[1]], @dbm[keys[2]] = values
+
+ n = 0
+ ret = @dbm.each_value {|val|
+ assert_not_nil(key = @dbm.index(val))
+ assert_not_nil(i = keys.index(key))
+ assert_equals(val, values[i])
+
+ n += 1
+ }
+ assert_equals(keys.size, n)
+ assert_equals(@dbm, ret)
+ end
+
+ def test_each_key
+ n = 0
+ @dbm.each_key { n += 1 }
+ assert_equals(0, n)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @dbm[keys[0]], @dbm[keys[1]], @dbm[keys[2]] = values
+
+ n = 0
+ ret = @dbm.each_key {|key|
+ assert_not_nil(i = keys.index(key))
+ assert_equals(@dbm[key], values[i])
+
+ n += 1
+ }
+ assert_equals(keys.size, n)
+ assert_equals(@dbm, ret)
+ end
+
+ def test_keys
+ assert_equals([], @dbm.keys)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @dbm[keys[0]], @dbm[keys[1]], @dbm[keys[2]] = values
+
+ assert_equals(keys.sort, @dbm.keys.sort)
+ assert_equals(values.sort, @dbm.values.sort)
+ end
+
+ def test_values
+ test_keys
+ end
+
+ def test_shift
+ assert_nil(@dbm.shift)
+ assert_equals(0, @dbm.size)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @dbm[keys[0]], @dbm[keys[1]], @dbm[keys[2]] = values
+
+ ret_keys = []
+ ret_values = []
+ while ret = @dbm.shift
+ ret_keys.push ret[0]
+ ret_values.push ret[1]
+
+ assert_equals(keys.size - ret_keys.size, @dbm.size)
+ end
+
+ assert_equals(keys.sort, ret_keys.sort)
+ assert_equals(values.sort, ret_values.sort)
+ end
+
+ def test_delete
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+ key = keys[1]
+
+ assert_nil(@dbm.delete(key))
+ assert_equals(0, @dbm.size)
+
+ @dbm[keys[0]], @dbm[keys[1]], @dbm[keys[2]] = values
+
+ assert_equals('BAR', @dbm.delete(key))
+ assert_nil(@dbm[key])
+ assert_equals(2, @dbm.size)
+
+ assert_nil(@dbm.delete(key))
+
+ if /^CYGWIN_9/ !~ SYSTEM
+ assert_exception(DBMError) {
+ @dbm_rdonly.delete("foo")
+ }
+
+ assert_nil(@dbm_rdonly.delete("bar"))
+ end
+ end
+ def test_delete_with_block
+ key = 'no called block'
+ @dbm[key] = 'foo'
+ assert_equals('foo', @dbm.delete(key) {|k| k.replace 'called block'})
+ assert_equals('no called block', key)
+ assert_equals(0, @dbm.size)
+
+ key = 'no called block'
+ assert_equals(:blockval,
+ @dbm.delete(key) {|k| k.replace 'called block'; :blockval})
+ assert_equals('called block', key)
+ assert_equals(0, @dbm.size)
+ end
+
+ def test_delete_if
+ v = "0"
+ 100.times {@dbm[v] = v; v = v.next}
+
+ ret = @dbm.delete_if {|key, val| key.to_i < 50}
+ assert_equals(@dbm, ret)
+ check_size(50, @dbm)
+
+ ret = @dbm.delete_if {|key, val| key.to_i >= 50}
+ assert_equals(@dbm, ret)
+ check_size(0, @dbm)
+
+ # break
+ v = "0"
+ 100.times {@dbm[v] = v; v = v.next}
+ check_size(100, @dbm)
+ n = 0;
+ @dbm.delete_if {|key, val|
+ break if n > 50
+ n+=1
+ true
+ }
+ assert_equals(51, n)
+ check_size(49, @dbm)
+
+ @dbm.clear
+
+ # raise
+ v = "0"
+ 100.times {@dbm[v] = v; v = v.next}
+ check_size(100, @dbm)
+ n = 0;
+ begin
+ @dbm.delete_if {|key, val|
+ raise "runtime error" if n > 50
+ n+=1
+ true
+ }
+ rescue
+ end
+ assert_equals(51, n)
+ check_size(49, @dbm)
+ end
+
+ def test_reject
+ v = "0"
+ 100.times {@dbm[v] = v; v = v.next}
+
+ hash = @dbm.reject {|key, val| key.to_i < 50}
+ assert_instance_of(Hash, hash)
+ assert_equals(100, @dbm.size)
+
+ assert_equals(50, hash.size)
+ hash.each_pair {|key,val|
+ assert_equals(false, key.to_i < 50)
+ assert_equals(key, val)
+ }
+
+ hash = @dbm.reject {|key, val| key.to_i < 100}
+ assert_instance_of(Hash, hash)
+ assert_equals(true, hash.empty?)
+ end
+
+ def test_clear
+ v = "1"
+ 100.times {v = v.next; @dbm[v] = v}
+
+ assert_equals(@dbm, @dbm.clear)
+
+ # validate DBM#size
+ i = 0
+ @dbm.each { i += 1 }
+ assert_equals(@dbm.size, i)
+ assert_equals(0, i)
+ end
+
+ def test_invert
+ v = "0"
+ 100.times {@dbm[v] = v; v = v.next}
+
+ hash = @dbm.invert
+ assert_instance_of(Hash, hash)
+ assert_equals(100, hash.size)
+ hash.each_pair {|key, val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+
+ def test_update
+ hash = {}
+ v = "0"
+ 100.times {v = v.next; hash[v] = v}
+
+ @dbm["101"] = "101"
+ @dbm.update hash
+ assert_equals(101, @dbm.size)
+ @dbm.each_pair {|key, val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+
+ def test_replace
+ hash = {}
+ v = "0"
+ 100.times {v = v.next; hash[v] = v}
+
+ @dbm["101"] = "101"
+ @dbm.replace hash
+ assert_equals(100, @dbm.size)
+ @dbm.each_pair {|key, val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+
+ def test_haskey?
+ assert_equals('bar', @dbm['foo']='bar')
+ assert_equals(true, @dbm.has_key?('foo'))
+ assert_equals(false, @dbm.has_key?('bar'))
+ end
+
+ def test_has_value?
+ assert_equals('bar', @dbm['foo']='bar')
+ assert_equals(true, @dbm.has_value?('bar'))
+ assert_equals(false, @dbm.has_value?('foo'))
+ end
+
+ def test_to_a
+ v = "0"
+ 100.times {v = v.next; @dbm[v] = v}
+
+ ary = @dbm.to_a
+ assert_instance_of(Array, ary)
+ assert_equals(100, ary.size)
+ ary.each {|key,val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+
+ def test_to_hash
+ v = "0"
+ 100.times {v = v.next; @dbm[v] = v}
+
+ hash = @dbm.to_hash
+ assert_instance_of(Hash, hash)
+ assert_equals(100, hash.size)
+ hash.each {|key,val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+end
+
+if $0 == __FILE__
+ if ARGV.size == 0
+ suite = RUNIT::TestSuite.new
+ suite.add_test(TestDBM.suite)
+ else
+ suite = RUNIT::TestSuite.new
+ ARGV.each do |testmethod|
+ suite.add_test(TestDBM.new(testmethod))
+ end
+ end
+
+ RUNIT::CUI::TestRunner.run(suite)
+end
diff --git a/ext/digest/.cvsignore b/ext/digest/.cvsignore
new file mode 100644
index 0000000000..4088712231
--- /dev/null
+++ b/ext/digest/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+mkmf.log
+*.def
diff --git a/ext/digest/defs.h b/ext/digest/defs.h
new file mode 100644
index 0000000000..5cfc77dd24
--- /dev/null
+++ b/ext/digest/defs.h
@@ -0,0 +1,37 @@
+/* -*- C -*-
+ * $Id$
+ */
+
+#ifndef DEFS_H
+#define DEFS_H
+
+#include "ruby.h"
+#include <sys/types.h>
+
+#if defined(HAVE_SYS_CDEFS_H)
+# include <sys/cdefs.h>
+#endif
+#if !defined(__BEGIN_DECLS)
+# define __BEGIN_DECLS
+# define __END_DECLS
+#endif
+
+#if defined(HAVE_INTTYPES_H)
+# include <inttypes.h>
+#elif !defined __CYGWIN__ || !defined __uint8_t_defined
+ typedef unsigned char uint8_t;
+ typedef unsigned int uint32_t;
+# if SIZEOF_LONG == 8
+ typedef unsigned long uint64_t;
+# elif defined(__GNUC__)
+ typedef unsigned long long uint64_t;
+# elif defined(_MSC_VER)
+ typedef unsigned _int64 uint64_t;
+# elif defined(__BORLANDC__)
+ typedef unsigned __int64 uint64_t;
+# else
+# define NO_UINT64_T
+# endif
+#endif
+
+#endif /* DEFS_H */
diff --git a/ext/digest/depend b/ext/digest/depend
new file mode 100644
index 0000000000..43601a208f
--- /dev/null
+++ b/ext/digest/depend
@@ -0,0 +1,2 @@
+digest.o: digest.c digest.h $(hdrdir)/ruby.h $(topdir)/config.h \
+ $(hdrdir)/defines.h $(hdrdir)/intern.h
diff --git a/ext/digest/digest.c b/ext/digest/digest.c
new file mode 100644
index 0000000000..70f986327a
--- /dev/null
+++ b/ext/digest/digest.c
@@ -0,0 +1,316 @@
+/************************************************
+
+ digest.c -
+
+ $Author$
+ created at: Fri May 25 08:57:27 JST 2001
+
+ Copyright (C) 1995-2001 Yukihiro Matsumoto
+ Copyright (C) 2001 Akinori MUSHA
+
+ $RoughId: digest.c,v 1.16 2001/07/13 15:38:27 knu Exp $
+ $Id$
+
+************************************************/
+
+/*
+ * This module provides an interface to the following hash algorithms:
+ *
+ * - the MD5 Message-Digest Algorithm by the RSA Data Security,
+ * Inc., described in RFC 1321
+ *
+ * - the SHA-1 Secure Hash Algorithm by NIST (the US' National
+ * Institute of Standards and Technology), described in FIPS PUB
+ * 180-1.
+ *
+ * - the SHA-256/384/512 Secure Hash Algorithm by NIST (the US'
+ * National Institute of Standards and Technology), described in
+ * FIPS PUB 180-2.
+ *
+ * - the RIPEMD-160 cryptographic hash function, designed by Hans
+ * Dobbertin, Antoon Bosselaers, and Bart Preneel.
+ */
+
+#include "digest.h"
+
+static VALUE mDigest, cDigest_Base;
+static ID id_metadata;
+
+/*
+ * Digest::Base
+ */
+
+static algo_t *
+get_digest_base_metadata(klass)
+ VALUE klass;
+{
+ VALUE obj;
+ algo_t *algo;
+
+ if (rb_cvar_defined(klass, id_metadata) == Qfalse) {
+ rb_notimplement();
+ }
+
+ obj = rb_cvar_get(klass, id_metadata);
+
+ Data_Get_Struct(obj, algo_t, algo);
+
+ return algo;
+}
+
+static VALUE rb_digest_base_alloc _((VALUE));
+static VALUE
+rb_digest_base_alloc(klass)
+ VALUE klass;
+{
+ algo_t *algo;
+ VALUE obj;
+ void *pctx;
+
+ if (klass == cDigest_Base) {
+ rb_raise(rb_eNotImpError, "Digest::Base is an abstract class");
+ }
+
+ algo = get_digest_base_metadata(klass);
+
+ /* XXX: An uninitialized buffer leads ALGO_Equal() to fail */
+ pctx = xcalloc(algo->ctx_size, 1);
+ algo->init_func(pctx);
+
+ obj = Data_Wrap_Struct(klass, 0, free, pctx);
+
+ return obj;
+}
+
+static VALUE
+rb_digest_base_s_digest(klass, str)
+ VALUE klass;
+ VALUE str;
+{
+ algo_t *algo;
+ void *pctx;
+ size_t len;
+ unsigned char *digest;
+ VALUE obj = rb_digest_base_alloc(klass);
+
+ algo = get_digest_base_metadata(klass);
+ Data_Get_Struct(obj, void, pctx);
+
+ StringValue(str);
+ algo->update_func(pctx, RSTRING(str)->ptr, RSTRING(str)->len);
+
+ len = algo->digest_len;
+
+ digest = xmalloc(len);
+ algo->final_func(digest, pctx);
+
+ obj = rb_str_new(digest, len);
+
+ free(digest);
+
+ return obj;
+}
+
+static VALUE
+rb_digest_base_s_hexdigest(klass, str)
+ VALUE klass;
+ VALUE str;
+{
+ algo_t *algo;
+ void *pctx;
+ size_t len;
+ unsigned char *hexdigest;
+ VALUE obj = rb_digest_base_alloc(klass);
+
+ algo = get_digest_base_metadata(klass);
+ Data_Get_Struct(obj, void, pctx);
+
+ StringValue(str);
+ algo->update_func(pctx, RSTRING(str)->ptr, RSTRING(str)->len);
+
+ len = algo->digest_len * 2;
+
+ hexdigest = xmalloc(len + 1); /* +1 is for '\0' */
+ algo->end_func(pctx, hexdigest);
+
+ obj = rb_str_new(hexdigest, len);
+
+ free(hexdigest);
+
+ return obj;
+}
+
+static VALUE
+rb_digest_base_copy(copy, obj)
+ VALUE copy, obj;
+{
+ algo_t *algo;
+ void *pctx1, *pctx2;
+
+ if (copy == obj) return copy;
+ rb_check_frozen(copy);
+ algo = get_digest_base_metadata(rb_obj_class(copy));
+ if (algo != get_digest_base_metadata(rb_obj_class(obj))) {
+ rb_raise(rb_eTypeError, "wrong argument class");
+ }
+ Data_Get_Struct(obj, void, pctx1);
+ Data_Get_Struct(copy, void, pctx2);
+ memcpy(pctx2, pctx1, algo->ctx_size);
+
+ return copy;
+}
+
+static VALUE
+rb_digest_base_update(self, str)
+ VALUE self, str;
+{
+ algo_t *algo;
+ void *pctx;
+
+ StringValue(str);
+ algo = get_digest_base_metadata(rb_obj_class(self));
+ Data_Get_Struct(self, void, pctx);
+
+ algo->update_func(pctx, RSTRING(str)->ptr, RSTRING(str)->len);
+
+ return self;
+}
+
+static VALUE
+rb_digest_base_init(argc, argv, self)
+ int argc;
+ VALUE* argv;
+ VALUE self;
+{
+ VALUE arg;
+
+ rb_scan_args(argc, argv, "01", &arg);
+
+ if (!NIL_P(arg)) rb_digest_base_update(self, arg);
+
+ return self;
+}
+
+static VALUE
+rb_digest_base_digest(self)
+ VALUE self;
+{
+ algo_t *algo;
+ void *pctx1, *pctx2;
+ unsigned char *digest;
+ size_t len;
+ VALUE str;
+
+ algo = get_digest_base_metadata(rb_obj_class(self));
+ Data_Get_Struct(self, void, pctx1);
+
+ len = algo->ctx_size;
+
+ pctx2 = xmalloc(len);
+ memcpy(pctx2, pctx1, len);
+
+ len = algo->digest_len;
+
+ digest = xmalloc(len);
+ algo->final_func(digest, pctx2);
+
+ str = rb_str_new(digest, len);
+
+ free(digest);
+ free(pctx2);
+
+ return str;
+}
+
+static VALUE
+rb_digest_base_hexdigest(self)
+ VALUE self;
+{
+ algo_t *algo;
+ void *pctx1, *pctx2;
+ unsigned char *hexdigest;
+ size_t len;
+ VALUE str;
+
+ algo = get_digest_base_metadata(rb_obj_class(self));
+ Data_Get_Struct(self, void, pctx1);
+
+ len = algo->ctx_size;
+
+ pctx2 = xmalloc(len);
+ memcpy(pctx2, pctx1, len);
+
+ len = algo->digest_len * 2;
+
+ hexdigest = xmalloc(len + 1); /* +1 is for '\0' */
+ algo->end_func(pctx2, hexdigest);
+
+ str = rb_str_new(hexdigest, len);
+
+ free(hexdigest);
+ free(pctx2);
+
+ return str;
+}
+
+static VALUE
+rb_digest_base_equal(self, other)
+ VALUE self, other;
+{
+ algo_t *algo;
+ VALUE klass;
+ VALUE str1, str2;
+
+ klass = rb_obj_class(self);
+ algo = get_digest_base_metadata(klass);
+
+ if (rb_obj_class(other) == klass) {
+ void *pctx1, *pctx2;
+
+ Data_Get_Struct(self, void, pctx1);
+ Data_Get_Struct(other, void, pctx2);
+
+ return algo->equal_func(pctx1, pctx2) ? Qtrue : Qfalse;
+ }
+
+ StringValue(other);
+ str2 = other;
+
+ if (RSTRING(str2)->len == algo->digest_len)
+ str1 = rb_digest_base_digest(self);
+ else
+ str1 = rb_digest_base_hexdigest(self);
+
+ if (RSTRING(str1)->len == RSTRING(str2)->len
+ && rb_str_cmp(str1, str2) == 0)
+ return Qtrue;
+
+ return Qfalse;
+}
+
+/*
+ * Init
+ */
+
+void
+Init_digest()
+{
+ mDigest = rb_define_module("Digest");
+
+ cDigest_Base = rb_define_class_under(mDigest, "Base", rb_cObject);
+
+ rb_define_alloc_func(cDigest_Base, rb_digest_base_alloc);
+ rb_define_singleton_method(cDigest_Base, "digest", rb_digest_base_s_digest, 1);
+ rb_define_singleton_method(cDigest_Base, "hexdigest", rb_digest_base_s_hexdigest, 1);
+
+ rb_define_method(cDigest_Base, "initialize", rb_digest_base_init, -1);
+ rb_define_method(cDigest_Base, "initialize_copy", rb_digest_base_copy, 1);
+ rb_define_method(cDigest_Base, "update", rb_digest_base_update, 1);
+ rb_define_method(cDigest_Base, "<<", rb_digest_base_update, 1);
+ rb_define_method(cDigest_Base, "digest", rb_digest_base_digest, 0);
+ rb_define_method(cDigest_Base, "hexdigest", rb_digest_base_hexdigest, 0);
+ rb_define_method(cDigest_Base, "to_s", rb_digest_base_hexdigest, 0);
+ rb_define_method(cDigest_Base, "==", rb_digest_base_equal, 1);
+
+ id_metadata = rb_intern("metadata");
+}
diff --git a/ext/digest/digest.h b/ext/digest/digest.h
new file mode 100644
index 0000000000..5e846df040
--- /dev/null
+++ b/ext/digest/digest.h
@@ -0,0 +1,32 @@
+/************************************************
+
+ digest.c -
+
+ $Author$
+ created at: Fri May 25 08:54:56 JST 2001
+
+
+ Copyright (C) 2001 Akinori MUSHA
+
+ $RoughId: digest.h,v 1.3 2001/07/13 15:38:27 knu Exp $
+ $Id$
+
+************************************************/
+
+#include "ruby.h"
+
+typedef void (*hash_init_func_t) _((void *));
+typedef void (*hash_update_func_t) _((void *, unsigned char *, size_t));
+typedef void (*hash_end_func_t) _((void *, unsigned char *));
+typedef void (*hash_final_func_t) _((unsigned char *, void *));
+typedef int (*hash_equal_func_t) _((void *, void *));
+
+typedef struct {
+ size_t digest_len;
+ size_t ctx_size;
+ hash_init_func_t init_func;
+ hash_update_func_t update_func;
+ hash_end_func_t end_func;
+ hash_final_func_t final_func;
+ hash_equal_func_t equal_func;
+} algo_t;
diff --git a/ext/digest/digest.txt b/ext/digest/digest.txt
new file mode 100644
index 0000000000..5797dd18f9
--- /dev/null
+++ b/ext/digest/digest.txt
@@ -0,0 +1,113 @@
+.\" digest.txt - -*- Indented-Text -*- created at: Fri May 25 08:13:50 JST 2001
+$RoughId: digest.txt,v 1.9 2001/07/13 19:46:51 knu Exp $
+$Id$
+
+** MD5(Class)
+
+A class to implement the MD5 Message-Digest Algorithm by RSA Data
+Security, Inc., described in RFC1321.
+
+Superclass: Digest::Base
+
+require 'digest/md5'
+
+** SHA1(Class)
+
+A class to implement the SHA-1 Secure Hash Algorithm by NIST (the US'
+National Institute of Standards and Technology), described in FIPS PUB
+180-1.
+
+Superclass: Digest::Base
+
+require 'digest/sha1'
+
+** SHA256(Class)
+** SHA384(Class)
+** SHA512(Class)
+
+Classes to implement the SHA-256/384/512 Secure Hash Algorithm(s) by
+NIST (the US' National Institute of Standards and Technology),
+described in FIPS PUB 180-2.
+
+Superclass: Digest::Base
+
+require 'digest/sha2'
+
+** RMD160(Class)
+
+A class to implement the RIPEMD-160 cryptographic hash function,
+designed by Hans Dobbertin, Antoon Bosselaers, and Bart Preneel.
+
+Superclass: Digest::Base
+
+require 'digest/rmd160'
+
+
+Those above classes provide a common interface as shown below.
+
+
+Class Methods:
+
+ new([str])
+
+ Creates a new digest object. If a string argument is given,
+ it is added to the object. (see update.)
+
+ digest(str)
+
+ Immediately calculates and return the hash of the given
+ strings as a string. Equivalent to new(str).digest.
+
+ hexdigest(str)
+
+ Immediately calculates and return the hash of the given
+ strings as a string of hexadecimal digits. Equivalent to
+ new(str).hexdigest.
+
+Methods:
+
+ clone
+
+ Creates a copy of the digest object.
+
+ digest
+
+ Returns the hash of the added strings as a string of 16 bytes
+ for MD5, 20 bytes for SHA1 and RMD160, 32 bytes for SHA256, 48
+ bytes for SHA384, and 64 bytes for SHA512.
+
+ hexdigest
+ to_s
+
+ Returns the hash of the added strings as a string of 32
+ hexadecimal digits for MD5, 40 hexadecimal digits for SHA1 and
+ RMD160, 64 hexadecimal digits for SHA256, 96 hexadecimal
+ digits for SHA384, and 128 hexadecimal digits for SHA512.
+ This method is equal to:
+
+ def hexdigest
+ digest.unpack("H*")[0]
+ end
+
+ update(str)
+ << str
+
+ Appends the string str to the digest object. Repeated calls
+ are equivalent to a single call with the concatenation of all
+ the arguments, i.e. m.update(a); m.update(b) is equivalent to
+ m.update(a + b) and m << a << b is equivalent to m << a + b.
+
+ == md
+
+ Checks if the object is equal to the given digest object.
+
+ == str
+
+ Regards the value as either a digest value or a hexdigest
+ value (depending on the length) and checks if the object is
+ equal to the given string.
+
+-------------------------------------------------------
+Local variables:
+fill-column: 70
+end:
diff --git a/ext/digest/digest.txt.ja b/ext/digest/digest.txt.ja
new file mode 100644
index 0000000000..8997d25b9d
--- /dev/null
+++ b/ext/digest/digest.txt.ja
@@ -0,0 +1,111 @@
+.\" digest.txt.ja - -*- Indented-Text -*- created at: Fri May 25 08:22:19 JST 2001
+$RoughId: digest.txt.jp,v 1.8 2001/07/13 15:38:27 knu Exp $
+$Id$
+
+** MD5()
+
+RFC1321RSA Data Security, Inc. MD5 Message-Digest
+Algorithm
+
+Superclass: Digest::Base
+
+require 'digest/md5'
+
+** SHA1()
+
+FIPS PUB 180-1NIST (the US' National Institute of
+Standards and Technology) SHA-1 Secure Hash Algorithm
+
+Superclass: Digest::Base
+
+require 'digest/sha1'
+
+** SHA256()
+** SHA384()
+** SHA512()
+
+FIPS PUB 180-2NIST (the US' National Institute of
+Standards and Technology) SHA-256/384/512 Secure Hash Algorithm
+
+
+Superclass: Digest::Base
+
+require 'digest/sha2'
+
+** RMD160()
+
+Hans Dobbertin, Antoon Bosselaers, Bart Preneel
+RIPEMD-160
+
+Superclass: Digest::Base
+
+require 'digest/rmd160'
+
+
+
+
+
+Class Methods:
+
+ new([str])
+
+
+ (see update)
+
+ digest(str)
+
+
+ new(str).digest
+
+ hexdigest(str)
+
+ ASCII
+ 16
+ new(str).hexdigest
+
+Methods:
+
+ clone
+
+
+
+ digest
+
+ MD5
+ 16SHA1RMD16020SHA25632
+ SHA38448SHA51264
+
+ hexdigest
+ to_s
+
+ ASCII
+ 16MD532
+ SHA1RMD16040SHA25664SHA384
+ 96SHA512128Ruby
+
+ def hexdigest
+ digest.unpack("H*")[0]
+ end
+
+ update(str)
+ << str
+
+ update
+ update m.update(a); m.update(b)
+ m.update(a + b) m << a << b m << a + b
+
+
+ == md
+
+
+
+ == str
+
+ digest hexdigest
+
+
+
+-------------------------------------------------------
+Local variables:
+fill-column: 70
+end:
diff --git a/ext/digest/extconf.rb b/ext/digest/extconf.rb
new file mode 100644
index 0000000000..cd512622a4
--- /dev/null
+++ b/ext/digest/extconf.rb
@@ -0,0 +1,6 @@
+# $RoughId: extconf.rb,v 1.6 2001/07/13 15:38:27 knu Exp $
+# $Id$
+
+require "mkmf"
+
+create_makefile("digest")
diff --git a/ext/digest/lib/md5.rb b/ext/digest/lib/md5.rb
new file mode 100644
index 0000000000..1d05d7d04e
--- /dev/null
+++ b/ext/digest/lib/md5.rb
@@ -0,0 +1,14 @@
+# just for compatibility; requiring "md5" is obsoleted
+#
+# $RoughId: md5.rb,v 1.4 2001/07/13 15:38:27 knu Exp $
+# $Id$
+
+require 'digest/md5'
+
+MD5 = Digest::MD5
+
+class MD5
+ def self.md5(*args)
+ new(*args)
+ end
+end
diff --git a/ext/digest/lib/sha1.rb b/ext/digest/lib/sha1.rb
new file mode 100644
index 0000000000..c4ac6f66ea
--- /dev/null
+++ b/ext/digest/lib/sha1.rb
@@ -0,0 +1,14 @@
+# just for compatibility; requiring "sha1" is obsoleted
+#
+# $RoughId: sha1.rb,v 1.4 2001/07/13 15:38:27 knu Exp $
+# $Id$
+
+require 'digest/sha1'
+
+SHA1 = Digest::SHA1
+
+class SHA1
+ def self.sha1(*args)
+ new(*args)
+ end
+end
diff --git a/ext/digest/md5/.cvsignore b/ext/digest/md5/.cvsignore
new file mode 100644
index 0000000000..4088712231
--- /dev/null
+++ b/ext/digest/md5/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+mkmf.log
+*.def
diff --git a/ext/digest/md5/depend b/ext/digest/md5/depend
new file mode 100644
index 0000000000..8eaec20b4b
--- /dev/null
+++ b/ext/digest/md5/depend
@@ -0,0 +1,6 @@
+md5.o: md5.c md5.h $(srcdir)/../defs.h $(hdrdir)/ruby.h $(topdir)/config.h \
+ $(hdrdir)/defines.h $(hdrdir)/intern.h
+md5init.o: md5init.c $(srcdir)/../digest.h $(hdrdir)/ruby.h \
+ $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h md5.h \
+ $(srcdir)/../defs.h
+md5ossl.o: md5ossl.h
diff --git a/ext/digest/md5/extconf.rb b/ext/digest/md5/extconf.rb
new file mode 100644
index 0000000000..9acf7ba9c0
--- /dev/null
+++ b/ext/digest/md5/extconf.rb
@@ -0,0 +1,26 @@
+# $RoughId: extconf.rb,v 1.3 2001/08/14 19:54:51 knu Exp $
+# $Id$
+
+require "mkmf"
+
+$CFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.."
+
+$objs = [ "md5init.#{$OBJEXT}" ]
+
+dir_config("openssl")
+
+if !with_config("bundled-md5") &&
+ have_library("crypto") && have_header("openssl/md5.h")
+ $objs << "md5ossl.#{$OBJEXT}"
+
+else
+ $objs << "md5.#{$OBJEXT}"
+end
+
+have_header("sys/cdefs.h")
+
+have_header("inttypes.h")
+
+have_header("unistd.h")
+
+create_makefile("digest/md5")
diff --git a/ext/digest/md5/md5.c b/ext/digest/md5/md5.c
new file mode 100644
index 0000000000..6b61f031c4
--- /dev/null
+++ b/ext/digest/md5/md5.c
@@ -0,0 +1,432 @@
+/*
+ Copyright (C) 1999, 2000 Aladdin Enterprises. All rights reserved.
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ L. Peter Deutsch
+ ghost@aladdin.com
+
+ */
+
+/*
+ Independent implementation of MD5 (RFC 1321).
+
+ This code implements the MD5 Algorithm defined in RFC 1321.
+ It is derived directly from the text of the RFC and not from the
+ reference implementation.
+
+ The original and principal author of md5.c is L. Peter Deutsch
+ <ghost@aladdin.com>. Other authors are noted in the change history
+ that follows (in reverse chronological order):
+
+ 2000-07-03 lpd Patched to eliminate warnings about "constant is
+ unsigned in ANSI C, signed in traditional";
+ made test program self-checking.
+ 1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
+ 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5).
+ 1999-05-03 lpd Original version.
+ */
+
+/*$OrigId: md5c.c,v 1.2 2001/03/26 08:57:14 matz Exp $ */
+/*$RoughId: md5.c,v 1.2 2001/07/13 19:48:41 knu Exp $ */
+/*$Id$ */
+
+#include "md5.h"
+
+#ifdef TEST
+/*
+ * Compile with -DTEST to create a self-contained executable test program.
+ * The test program should print out the same values as given in section
+ * A.5 of RFC 1321, reproduced below.
+ */
+#include <string.h>
+main()
+{
+ static const char *const test[7*2] = {
+ "", "d41d8cd98f00b204e9800998ecf8427e",
+ "a", "0cc175b9c0f1b6a831c399e269772661",
+ "abc", "900150983cd24fb0d6963f7d28e17f72",
+ "message digest", "f96b697d7cb7938d525a2f31aaf161d0",
+ "abcdefghijklmnopqrstuvwxyz", "c3fcd3d76192e4007dfb496cca67e13b",
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
+ "d174ab98d277d9f5a5611c2c9f419d9f",
+ "12345678901234567890123456789012345678901234567890123456789012345678901234567890", "57edf4a22be3c955ac49da2e2107b67a"
+ };
+ int i;
+
+ for (i = 0; i < 7*2; i += 2) {
+ MD5_CTX state;
+ uint8_t digest[16];
+ char hex_output[16*2 + 1];
+ int di;
+
+ MD5_Init(&state);
+ MD5_Update(&state, (const uint8_t *)test[i], strlen(test[i]));
+ MD5_Final(digest, &state);
+ printf("MD5 (\"%s\") = ", test[i]);
+ for (di = 0; di < 16; ++di)
+ sprintf(hex_output + di * 2, "%02x", digest[di]);
+ puts(hex_output);
+ if (strcmp(hex_output, test[i + 1]))
+ printf("**** ERROR, should be: %s\n", test[i + 1]);
+ }
+ return 0;
+}
+#endif /* TEST */
+
+
+/*
+ * For reference, here is the program that computed the T values.
+ */
+#ifdef COMPUTE_T_VALUES
+#include <math.h>
+main()
+{
+ int i;
+ for (i = 1; i <= 64; ++i) {
+ unsigned long v = (unsigned long)(4294967296.0 * fabs(sin((double)i)));
+
+ /*
+ * The following nonsense is only to avoid compiler warnings about
+ * "integer constant is unsigned in ANSI C, signed with -traditional".
+ */
+ if (v >> 31) {
+ printf("#define T%d /* 0x%08lx */ (T_MASK ^ 0x%08lx)\n", i,
+ v, (unsigned long)(unsigned int)(~v));
+ } else {
+ printf("#define T%d 0x%08lx\n", i, v);
+ }
+ }
+ return 0;
+}
+#endif /* COMPUTE_T_VALUES */
+/*
+ * End of T computation program.
+ */
+#ifdef T_MASK
+#undef T_MASK
+#endif
+#define T_MASK ((uint32_t)~0)
+#define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87)
+#define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9)
+#define T3 0x242070db
+#define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111)
+#define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050)
+#define T6 0x4787c62a
+#define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec)
+#define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe)
+#define T9 0x698098d8
+#define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850)
+#define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e)
+#define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841)
+#define T13 0x6b901122
+#define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c)
+#define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71)
+#define T16 0x49b40821
+#define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d)
+#define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf)
+#define T19 0x265e5a51
+#define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855)
+#define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2)
+#define T22 0x02441453
+#define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e)
+#define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437)
+#define T25 0x21e1cde6
+#define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829)
+#define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278)
+#define T28 0x455a14ed
+#define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa)
+#define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07)
+#define T31 0x676f02d9
+#define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375)
+#define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd)
+#define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e)
+#define T35 0x6d9d6122
+#define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3)
+#define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb)
+#define T38 0x4bdecfa9
+#define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f)
+#define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f)
+#define T41 0x289b7ec6
+#define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805)
+#define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a)
+#define T44 0x04881d05
+#define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6)
+#define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a)
+#define T47 0x1fa27cf8
+#define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a)
+#define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb)
+#define T50 0x432aff97
+#define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58)
+#define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6)
+#define T53 0x655b59c3
+#define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d)
+#define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82)
+#define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e)
+#define T57 0x6fa87e4f
+#define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f)
+#define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb)
+#define T60 0x4e0811a1
+#define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d)
+#define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca)
+#define T63 0x2ad7d2bb
+#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e)
+
+
+static void
+md5_process(MD5_CTX *pms, const uint8_t *data /*[64]*/)
+{
+ uint32_t
+ a = pms->state[0], b = pms->state[1],
+ c = pms->state[2], d = pms->state[3];
+ uint32_t t;
+
+#ifdef WORDS_BIGENDIAN
+
+ /*
+ * On big-endian machines, we must arrange the bytes in the right
+ * order. (This also works on machines of unknown byte order.)
+ */
+ uint32_t X[16];
+ const uint8_t *xp = data;
+ int i;
+
+ for (i = 0; i < 16; ++i, xp += 4)
+ X[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);
+
+#else
+
+ /*
+ * On little-endian machines, we can process properly aligned data
+ * without copying it.
+ */
+ uint32_t xbuf[16];
+ const uint32_t *X;
+
+ if (!((data - (const uint8_t *)0) & 3)) {
+ /* data are properly aligned */
+ X = (const uint32_t *)data;
+ } else {
+ /* not aligned */
+ memcpy(xbuf, data, 64);
+ X = xbuf;
+ }
+#endif
+
+#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
+
+ /* Round 1. */
+ /* Let [abcd k s i] denote the operation
+ a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */
+#define F(x, y, z) (((x) & (y)) | (~(x) & (z)))
+#define SET(a, b, c, d, k, s, Ti)\
+ t = a + F(b,c,d) + X[k] + Ti;\
+ a = ROTATE_LEFT(t, s) + b
+ /* Do the following 16 operations. */
+ SET(a, b, c, d, 0, 7, T1);
+ SET(d, a, b, c, 1, 12, T2);
+ SET(c, d, a, b, 2, 17, T3);
+ SET(b, c, d, a, 3, 22, T4);
+ SET(a, b, c, d, 4, 7, T5);
+ SET(d, a, b, c, 5, 12, T6);
+ SET(c, d, a, b, 6, 17, T7);
+ SET(b, c, d, a, 7, 22, T8);
+ SET(a, b, c, d, 8, 7, T9);
+ SET(d, a, b, c, 9, 12, T10);
+ SET(c, d, a, b, 10, 17, T11);
+ SET(b, c, d, a, 11, 22, T12);
+ SET(a, b, c, d, 12, 7, T13);
+ SET(d, a, b, c, 13, 12, T14);
+ SET(c, d, a, b, 14, 17, T15);
+ SET(b, c, d, a, 15, 22, T16);
+#undef SET
+
+ /* Round 2. */
+ /* Let [abcd k s i] denote the operation
+ a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */
+#define G(x, y, z) (((x) & (z)) | ((y) & ~(z)))
+#define SET(a, b, c, d, k, s, Ti)\
+ t = a + G(b,c,d) + X[k] + Ti;\
+ a = ROTATE_LEFT(t, s) + b
+ /* Do the following 16 operations. */
+ SET(a, b, c, d, 1, 5, T17);
+ SET(d, a, b, c, 6, 9, T18);
+ SET(c, d, a, b, 11, 14, T19);
+ SET(b, c, d, a, 0, 20, T20);
+ SET(a, b, c, d, 5, 5, T21);
+ SET(d, a, b, c, 10, 9, T22);
+ SET(c, d, a, b, 15, 14, T23);
+ SET(b, c, d, a, 4, 20, T24);
+ SET(a, b, c, d, 9, 5, T25);
+ SET(d, a, b, c, 14, 9, T26);
+ SET(c, d, a, b, 3, 14, T27);
+ SET(b, c, d, a, 8, 20, T28);
+ SET(a, b, c, d, 13, 5, T29);
+ SET(d, a, b, c, 2, 9, T30);
+ SET(c, d, a, b, 7, 14, T31);
+ SET(b, c, d, a, 12, 20, T32);
+#undef SET
+
+ /* Round 3. */
+ /* Let [abcd k s t] denote the operation
+ a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */
+#define H(x, y, z) ((x) ^ (y) ^ (z))
+#define SET(a, b, c, d, k, s, Ti)\
+ t = a + H(b,c,d) + X[k] + Ti;\
+ a = ROTATE_LEFT(t, s) + b
+ /* Do the following 16 operations. */
+ SET(a, b, c, d, 5, 4, T33);
+ SET(d, a, b, c, 8, 11, T34);
+ SET(c, d, a, b, 11, 16, T35);
+ SET(b, c, d, a, 14, 23, T36);
+ SET(a, b, c, d, 1, 4, T37);
+ SET(d, a, b, c, 4, 11, T38);
+ SET(c, d, a, b, 7, 16, T39);
+ SET(b, c, d, a, 10, 23, T40);
+ SET(a, b, c, d, 13, 4, T41);
+ SET(d, a, b, c, 0, 11, T42);
+ SET(c, d, a, b, 3, 16, T43);
+ SET(b, c, d, a, 6, 23, T44);
+ SET(a, b, c, d, 9, 4, T45);
+ SET(d, a, b, c, 12, 11, T46);
+ SET(c, d, a, b, 15, 16, T47);
+ SET(b, c, d, a, 2, 23, T48);
+#undef SET
+
+ /* Round 4. */
+ /* Let [abcd k s t] denote the operation
+ a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */
+#define I(x, y, z) ((y) ^ ((x) | ~(z)))
+#define SET(a, b, c, d, k, s, Ti)\
+ t = a + I(b,c,d) + X[k] + Ti;\
+ a = ROTATE_LEFT(t, s) + b
+ /* Do the following 16 operations. */
+ SET(a, b, c, d, 0, 6, T49);
+ SET(d, a, b, c, 7, 10, T50);
+ SET(c, d, a, b, 14, 15, T51);
+ SET(b, c, d, a, 5, 21, T52);
+ SET(a, b, c, d, 12, 6, T53);
+ SET(d, a, b, c, 3, 10, T54);
+ SET(c, d, a, b, 10, 15, T55);
+ SET(b, c, d, a, 1, 21, T56);
+ SET(a, b, c, d, 8, 6, T57);
+ SET(d, a, b, c, 15, 10, T58);
+ SET(c, d, a, b, 6, 15, T59);
+ SET(b, c, d, a, 13, 21, T60);
+ SET(a, b, c, d, 4, 6, T61);
+ SET(d, a, b, c, 11, 10, T62);
+ SET(c, d, a, b, 2, 15, T63);
+ SET(b, c, d, a, 9, 21, T64);
+#undef SET
+
+ /* Then perform the following additions. (That is increment each
+ of the four registers by the value it had before this block
+ was started.) */
+ pms->state[0] += a;
+ pms->state[1] += b;
+ pms->state[2] += c;
+ pms->state[3] += d;
+}
+
+void
+MD5_Init(MD5_CTX *pms)
+{
+ pms->count[0] = pms->count[1] = 0;
+ pms->state[0] = 0x67452301;
+ pms->state[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476;
+ pms->state[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301;
+ pms->state[3] = 0x10325476;
+}
+
+void
+MD5_Update(MD5_CTX *pms, const uint8_t *data, size_t nbytes)
+{
+ const uint8_t *p = data;
+ size_t left = nbytes;
+ size_t offset = (pms->count[0] >> 3) & 63;
+ uint32_t nbits = (uint32_t)(nbytes << 3);
+
+ if (nbytes <= 0)
+ return;
+
+ /* Update the message length. */
+ pms->count[1] += nbytes >> 29;
+ pms->count[0] += nbits;
+ if (pms->count[0] < nbits)
+ pms->count[1]++;
+
+ /* Process an initial partial block. */
+ if (offset) {
+ size_t copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
+
+ memcpy(pms->buffer + offset, p, copy);
+ if (offset + copy < 64)
+ return;
+ p += copy;
+ left -= copy;
+ md5_process(pms, pms->buffer);
+ }
+
+ /* Process full blocks. */
+ for (; left >= 64; p += 64, left -= 64)
+ md5_process(pms, p);
+
+ /* Process a final partial block. */
+ if (left)
+ memcpy(pms->buffer, p, left);
+}
+
+void
+MD5_Final(uint8_t *digest, MD5_CTX *pms)
+{
+ static const uint8_t pad[64] = {
+ 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+ uint8_t data[8];
+ size_t i;
+
+ /* Save the length before padding. */
+ for (i = 0; i < 8; ++i)
+ data[i] = (uint8_t)(pms->count[i >> 2] >> ((i & 3) << 3));
+ /* Pad to 56 bytes mod 64. */
+ MD5_Update(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
+ /* Append the length. */
+ MD5_Update(pms, data, 8);
+ for (i = 0; i < 16; ++i)
+ digest[i] = (uint8_t)(pms->state[i >> 2] >> ((i & 3) << 3));
+}
+
+void
+MD5_End(MD5_CTX *pctx, uint8_t *hexdigest)
+{
+ unsigned char digest[16];
+ size_t i;
+
+ MD5_Final(digest, pctx);
+
+ for (i = 0; i < 16; i++)
+ sprintf(hexdigest + i * 2, "%02x", digest[i]);
+}
+
+int MD5_Equal(MD5_CTX* pctx1, MD5_CTX* pctx2) {
+ return memcmp(pctx1->count, pctx2->count, sizeof(pctx1->count)) == 0
+ && memcmp(pctx1->state, pctx2->state, sizeof(pctx1->state)) == 0
+ && memcmp(pctx1->buffer, pctx2->buffer, sizeof(pctx1->buffer)) == 0;
+}
diff --git a/ext/digest/md5/md5.h b/ext/digest/md5/md5.h
new file mode 100644
index 0000000000..fc41380d38
--- /dev/null
+++ b/ext/digest/md5/md5.h
@@ -0,0 +1,83 @@
+/*
+ Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ L. Peter Deutsch
+ ghost@aladdin.com
+
+ */
+/*
+ Independent implementation of MD5 (RFC 1321).
+
+ This code implements the MD5 Algorithm defined in RFC 1321.
+ It is derived directly from the text of the RFC and not from the
+ reference implementation.
+
+ The original and principal author of md5.h is L. Peter Deutsch
+ <ghost@aladdin.com>. Other authors are noted in the change history
+ that follows (in reverse chronological order):
+
+ 1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
+ 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);
+ added conditionalization for C++ compilation from Martin
+ Purschke <purschke@bnl.gov>.
+ 1999-05-03 lpd Original version.
+ */
+
+/* $OrigId: md5.h,v 1.2 2001/03/26 08:57:14 matz Exp $ */
+/* $RoughId: md5.h,v 1.3 2002/02/24 08:14:31 knu Exp $ */
+/* $Id$ */
+
+#ifndef MD5_INCLUDED
+# define MD5_INCLUDED
+
+#include "defs.h"
+
+/*
+ * This code has some adaptations for the Ghostscript environment, but it
+ * will compile and run correctly in any environment with 8-bit chars and
+ * 32-bit ints. Specifically, it assumes that if the following are
+ * defined, they have the same meaning as in Ghostscript: P1, P2, P3.
+ */
+
+/* Define the state of the MD5 Algorithm. */
+typedef struct md5_state_s {
+ uint32_t count[2]; /* message length in bits, lsw first */
+ uint32_t state[4]; /* digest buffer */
+ uint8_t buffer[64]; /* accumulate block */
+} MD5_CTX;
+
+#ifdef RUBY
+#define MD5_Init rb_Digest_MD5_Init
+#define MD5_Update rb_Digest_MD5_Update
+#define MD5_Final rb_Digest_MD5_Final
+#define MD5_End rb_Digest_MD5_End
+#define MD5_Equal rb_Digest_MD5_Equal
+#endif
+
+void MD5_Init _((MD5_CTX *pms));
+void MD5_Update _((MD5_CTX *pms, const uint8_t *data, size_t nbytes));
+void MD5_Final _((uint8_t *digest, MD5_CTX *pms));
+void MD5_End _((MD5_CTX *pctx, uint8_t *hexdigest));
+int MD5_Equal _((MD5_CTX *pctx1, MD5_CTX *pctx2));
+
+#define MD5_BLOCK_LENGTH 64
+#define MD5_DIGEST_LENGTH 16
+#define MD5_DIGEST_STRING_LENGTH (MD5_DIGEST_LENGTH * 2 + 1)
+
+#endif /* MD5_INCLUDED */
diff --git a/ext/digest/md5/md5init.c b/ext/digest/md5/md5init.c
new file mode 100644
index 0000000000..2acca16a46
--- /dev/null
+++ b/ext/digest/md5/md5init.c
@@ -0,0 +1,35 @@
+/* $RoughId: md5init.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
+/* $Id$ */
+
+#include "digest.h"
+#if defined(HAVE_OPENSSL_MD5_H)
+#include "md5ossl.h"
+#else
+#include "md5.h"
+#endif
+
+static algo_t md5 = {
+ MD5_DIGEST_LENGTH,
+ sizeof(MD5_CTX),
+ (hash_init_func_t)MD5_Init,
+ (hash_update_func_t)MD5_Update,
+ (hash_end_func_t)MD5_End,
+ (hash_final_func_t)MD5_Final,
+ (hash_equal_func_t)MD5_Equal,
+};
+
+void
+Init_md5()
+{
+ VALUE mDigest, cDigest_Base, cDigest_MD5;
+
+ rb_require("digest.so");
+
+ mDigest = rb_path2class("Digest");
+ cDigest_Base = rb_path2class("Digest::Base");
+
+ cDigest_MD5 = rb_define_class_under(mDigest, "MD5", cDigest_Base);
+
+ rb_cvar_set(cDigest_MD5, rb_intern("metadata"),
+ Data_Wrap_Struct(rb_cObject, 0, 0, &md5), Qtrue);
+}
diff --git a/ext/digest/md5/md5ossl.c b/ext/digest/md5/md5ossl.c
new file mode 100644
index 0000000000..d930c7ab51
--- /dev/null
+++ b/ext/digest/md5/md5ossl.c
@@ -0,0 +1,30 @@
+/* $Id$ */
+
+#include "md5ossl.h"
+#include <sys/types.h>
+#include <stdio.h>
+#include <string.h>
+
+void
+MD5_End(MD5_CTX *pctx, unsigned char *hexdigest)
+{
+ unsigned char digest[16];
+ size_t i;
+
+ MD5_Final(digest, pctx);
+
+ for (i = 0; i < 16; i++)
+ sprintf(hexdigest + i * 2, "%02x", digest[i]);
+}
+
+int
+MD5_Equal(MD5_CTX* pctx1, MD5_CTX* pctx2) {
+ return pctx1->num == pctx2->num
+ && pctx1->A == pctx2->A
+ && pctx1->B == pctx2->B
+ && pctx1->C == pctx2->C
+ && pctx1->D == pctx2->D
+ && pctx1->Nl == pctx2->Nl
+ && pctx1->Nh == pctx2->Nh
+ && memcmp(pctx1->data, pctx2->data, sizeof(pctx1->data)) == 0;
+}
diff --git a/ext/digest/md5/md5ossl.h b/ext/digest/md5/md5ossl.h
new file mode 100644
index 0000000000..dda7c743ed
--- /dev/null
+++ b/ext/digest/md5/md5ossl.h
@@ -0,0 +1,11 @@
+/* $Id$ */
+
+#ifndef MD5OSSL_H_INCLUDED
+#define MD5OSSL_H_INCLUDED
+
+#include <openssl/md5.h>
+
+void MD5_End(MD5_CTX *pctx, unsigned char *hexdigest);
+int MD5_Equal(MD5_CTX *pctx1, MD5_CTX *pctx2);
+
+#endif
diff --git a/ext/digest/rmd160/.cvsignore b/ext/digest/rmd160/.cvsignore
new file mode 100644
index 0000000000..4088712231
--- /dev/null
+++ b/ext/digest/rmd160/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+mkmf.log
+*.def
diff --git a/ext/digest/rmd160/depend b/ext/digest/rmd160/depend
new file mode 100644
index 0000000000..0ca79c5f40
--- /dev/null
+++ b/ext/digest/rmd160/depend
@@ -0,0 +1,8 @@
+rmd160.o: rmd160.c rmd160.h $(srcdir)/../defs.h $(hdrdir)/ruby.h \
+ $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h
+rmd160hl.o: rmd160hl.c rmd160.h $(srcdir)/../defs.h $(hdrdir)/ruby.h \
+ $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h
+rmd160init.o: rmd160init.c $(srcdir)/../digest.h $(hdrdir)/ruby.h \
+ $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h \
+ rmd160.h $(srcdir)/../defs.h
+rmd160ossl.o: rmd160ossl.h $(srcdir)/../defs.h
diff --git a/ext/digest/rmd160/extconf.rb b/ext/digest/rmd160/extconf.rb
new file mode 100644
index 0000000000..5bc968385c
--- /dev/null
+++ b/ext/digest/rmd160/extconf.rb
@@ -0,0 +1,25 @@
+# $RoughId: extconf.rb,v 1.3 2001/08/14 19:54:51 knu Exp $
+# $Id$
+
+require "mkmf"
+
+$CFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.."
+
+$objs = [ "rmd160init.#{$OBJEXT}" ]
+
+dir_config("openssl")
+
+if !with_config("bundled-rmd160") &&
+ have_library("crypto") && have_header("openssl/ripemd.h")
+ $objs << "rmd160ossl.#{$OBJEXT}"
+else
+ $objs << "rmd160.#{$OBJEXT}" << "rmd160hl.#{$OBJEXT}"
+end
+
+have_header("sys/cdefs.h")
+
+have_header("inttypes.h")
+
+have_header("unistd.h")
+
+create_makefile("digest/rmd160")
diff --git a/ext/digest/rmd160/rmd160.c b/ext/digest/rmd160/rmd160.c
new file mode 100644
index 0000000000..2de3c99b29
--- /dev/null
+++ b/ext/digest/rmd160/rmd160.c
@@ -0,0 +1,464 @@
+/* $NetBSD: rmd160.c,v 1.1.1.1 2001/03/06 11:21:05 agc Exp $ */
+/* $RoughId: rmd160.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
+/* $Id$ */
+
+/********************************************************************\
+ *
+ * FILE: rmd160.c
+ *
+ * CONTENTS: A sample C-implementation of the RIPEMD-160
+ * hash-function.
+ * TARGET: any computer with an ANSI C compiler
+ *
+ * AUTHOR: Antoon Bosselaers, ESAT-COSIC
+ * (Arranged for libc by Todd C. Miller)
+ * DATE: 1 March 1996
+ * VERSION: 1.0
+ *
+ * Copyright (c) Katholieke Universiteit Leuven
+ * 1996, All Rights Reserved
+ *
+\********************************************************************/
+
+#include "rmd160.h"
+
+#ifndef lint
+/* __RCSID("$NetBSD: rmd160.c,v 1.1.1.1 2001/03/06 11:21:05 agc Exp $"); */
+#endif /* not lint */
+
+/* header files */
+
+#ifdef HAVE_SYS_ENDIAN_H_
+#include <sys/endian.h>
+#endif
+
+#ifdef HAVE_MACHINE_ENDIAN_H_
+#include <machine/endian.h>
+#endif
+
+/* #include "namespace.h" */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef _DIAGASSERT
+#define _DIAGASSERT(cond) assert(cond)
+#endif
+
+
+/********************************************************************/
+
+/* macro definitions */
+
+/* collect four bytes into one word: */
+#define BYTES_TO_DWORD(strptr) \
+ (((uint32_t) *((strptr)+3) << 24) | \
+ ((uint32_t) *((strptr)+2) << 16) | \
+ ((uint32_t) *((strptr)+1) << 8) | \
+ ((uint32_t) *(strptr)))
+
+/* ROL(x, n) cyclically rotates x over n bits to the left */
+/* x must be of an unsigned 32 bits type and 0 <= n < 32. */
+#define ROL(x, n) (((x) << (n)) | ((x) >> (32-(n))))
+
+/* the three basic functions F(), G() and H() */
+#define F(x, y, z) ((x) ^ (y) ^ (z))
+#define G(x, y, z) (((x) & (y)) | (~(x) & (z)))
+#define H(x, y, z) (((x) | ~(y)) ^ (z))
+#define I(x, y, z) (((x) & (z)) | ((y) & ~(z)))
+#define J(x, y, z) ((x) ^ ((y) | ~(z)))
+
+/* the eight basic operations FF() through III() */
+#define FF(a, b, c, d, e, x, s) { \
+ (a) += F((b), (c), (d)) + (x); \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+#define GG(a, b, c, d, e, x, s) { \
+ (a) += G((b), (c), (d)) + (x) + 0x5a827999U; \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+#define HH(a, b, c, d, e, x, s) { \
+ (a) += H((b), (c), (d)) + (x) + 0x6ed9eba1U; \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+#define II(a, b, c, d, e, x, s) { \
+ (a) += I((b), (c), (d)) + (x) + 0x8f1bbcdcU; \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+#define JJ(a, b, c, d, e, x, s) { \
+ (a) += J((b), (c), (d)) + (x) + 0xa953fd4eU; \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+#define FFF(a, b, c, d, e, x, s) { \
+ (a) += F((b), (c), (d)) + (x); \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+#define GGG(a, b, c, d, e, x, s) { \
+ (a) += G((b), (c), (d)) + (x) + 0x7a6d76e9U; \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+#define HHH(a, b, c, d, e, x, s) { \
+ (a) += H((b), (c), (d)) + (x) + 0x6d703ef3U; \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+#define III(a, b, c, d, e, x, s) { \
+ (a) += I((b), (c), (d)) + (x) + 0x5c4dd124U; \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+#define JJJ(a, b, c, d, e, x, s) { \
+ (a) += J((b), (c), (d)) + (x) + 0x50a28be6U; \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+
+/********************************************************************/
+
+void
+RMD160_Init(RMD160_CTX *context)
+{
+
+ _DIAGASSERT(context != NULL);
+
+ /* ripemd-160 initialization constants */
+ context->state[0] = 0x67452301U;
+ context->state[1] = 0xefcdab89U;
+ context->state[2] = 0x98badcfeU;
+ context->state[3] = 0x10325476U;
+ context->state[4] = 0xc3d2e1f0U;
+ context->length[0] = context->length[1] = 0;
+ context->buflen = 0;
+}
+
+/********************************************************************/
+
+void
+RMD160_Transform(uint32_t state[5], const uint32_t block[16])
+{
+ uint32_t aa, bb, cc, dd, ee;
+ uint32_t aaa, bbb, ccc, ddd, eee;
+
+ _DIAGASSERT(state != NULL);
+ _DIAGASSERT(block != NULL);
+
+ aa = aaa = state[0];
+ bb = bbb = state[1];
+ cc = ccc = state[2];
+ dd = ddd = state[3];
+ ee = eee = state[4];
+
+ /* round 1 */
+ FF(aa, bb, cc, dd, ee, block[ 0], 11);
+ FF(ee, aa, bb, cc, dd, block[ 1], 14);
+ FF(dd, ee, aa, bb, cc, block[ 2], 15);
+ FF(cc, dd, ee, aa, bb, block[ 3], 12);
+ FF(bb, cc, dd, ee, aa, block[ 4], 5);
+ FF(aa, bb, cc, dd, ee, block[ 5], 8);
+ FF(ee, aa, bb, cc, dd, block[ 6], 7);
+ FF(dd, ee, aa, bb, cc, block[ 7], 9);
+ FF(cc, dd, ee, aa, bb, block[ 8], 11);
+ FF(bb, cc, dd, ee, aa, block[ 9], 13);
+ FF(aa, bb, cc, dd, ee, block[10], 14);
+ FF(ee, aa, bb, cc, dd, block[11], 15);
+ FF(dd, ee, aa, bb, cc, block[12], 6);
+ FF(cc, dd, ee, aa, bb, block[13], 7);
+ FF(bb, cc, dd, ee, aa, block[14], 9);
+ FF(aa, bb, cc, dd, ee, block[15], 8);
+
+ /* round 2 */
+ GG(ee, aa, bb, cc, dd, block[ 7], 7);
+ GG(dd, ee, aa, bb, cc, block[ 4], 6);
+ GG(cc, dd, ee, aa, bb, block[13], 8);
+ GG(bb, cc, dd, ee, aa, block[ 1], 13);
+ GG(aa, bb, cc, dd, ee, block[10], 11);
+ GG(ee, aa, bb, cc, dd, block[ 6], 9);
+ GG(dd, ee, aa, bb, cc, block[15], 7);
+ GG(cc, dd, ee, aa, bb, block[ 3], 15);
+ GG(bb, cc, dd, ee, aa, block[12], 7);
+ GG(aa, bb, cc, dd, ee, block[ 0], 12);
+ GG(ee, aa, bb, cc, dd, block[ 9], 15);
+ GG(dd, ee, aa, bb, cc, block[ 5], 9);
+ GG(cc, dd, ee, aa, bb, block[ 2], 11);
+ GG(bb, cc, dd, ee, aa, block[14], 7);
+ GG(aa, bb, cc, dd, ee, block[11], 13);
+ GG(ee, aa, bb, cc, dd, block[ 8], 12);
+
+ /* round 3 */
+ HH(dd, ee, aa, bb, cc, block[ 3], 11);
+ HH(cc, dd, ee, aa, bb, block[10], 13);
+ HH(bb, cc, dd, ee, aa, block[14], 6);
+ HH(aa, bb, cc, dd, ee, block[ 4], 7);
+ HH(ee, aa, bb, cc, dd, block[ 9], 14);
+ HH(dd, ee, aa, bb, cc, block[15], 9);
+ HH(cc, dd, ee, aa, bb, block[ 8], 13);
+ HH(bb, cc, dd, ee, aa, block[ 1], 15);
+ HH(aa, bb, cc, dd, ee, block[ 2], 14);
+ HH(ee, aa, bb, cc, dd, block[ 7], 8);
+ HH(dd, ee, aa, bb, cc, block[ 0], 13);
+ HH(cc, dd, ee, aa, bb, block[ 6], 6);
+ HH(bb, cc, dd, ee, aa, block[13], 5);
+ HH(aa, bb, cc, dd, ee, block[11], 12);
+ HH(ee, aa, bb, cc, dd, block[ 5], 7);
+ HH(dd, ee, aa, bb, cc, block[12], 5);
+
+ /* round 4 */
+ II(cc, dd, ee, aa, bb, block[ 1], 11);
+ II(bb, cc, dd, ee, aa, block[ 9], 12);
+ II(aa, bb, cc, dd, ee, block[11], 14);
+ II(ee, aa, bb, cc, dd, block[10], 15);
+ II(dd, ee, aa, bb, cc, block[ 0], 14);
+ II(cc, dd, ee, aa, bb, block[ 8], 15);
+ II(bb, cc, dd, ee, aa, block[12], 9);
+ II(aa, bb, cc, dd, ee, block[ 4], 8);
+ II(ee, aa, bb, cc, dd, block[13], 9);
+ II(dd, ee, aa, bb, cc, block[ 3], 14);
+ II(cc, dd, ee, aa, bb, block[ 7], 5);
+ II(bb, cc, dd, ee, aa, block[15], 6);
+ II(aa, bb, cc, dd, ee, block[14], 8);
+ II(ee, aa, bb, cc, dd, block[ 5], 6);
+ II(dd, ee, aa, bb, cc, block[ 6], 5);
+ II(cc, dd, ee, aa, bb, block[ 2], 12);
+
+ /* round 5 */
+ JJ(bb, cc, dd, ee, aa, block[ 4], 9);
+ JJ(aa, bb, cc, dd, ee, block[ 0], 15);
+ JJ(ee, aa, bb, cc, dd, block[ 5], 5);
+ JJ(dd, ee, aa, bb, cc, block[ 9], 11);
+ JJ(cc, dd, ee, aa, bb, block[ 7], 6);
+ JJ(bb, cc, dd, ee, aa, block[12], 8);
+ JJ(aa, bb, cc, dd, ee, block[ 2], 13);
+ JJ(ee, aa, bb, cc, dd, block[10], 12);
+ JJ(dd, ee, aa, bb, cc, block[14], 5);
+ JJ(cc, dd, ee, aa, bb, block[ 1], 12);
+ JJ(bb, cc, dd, ee, aa, block[ 3], 13);
+ JJ(aa, bb, cc, dd, ee, block[ 8], 14);
+ JJ(ee, aa, bb, cc, dd, block[11], 11);
+ JJ(dd, ee, aa, bb, cc, block[ 6], 8);
+ JJ(cc, dd, ee, aa, bb, block[15], 5);
+ JJ(bb, cc, dd, ee, aa, block[13], 6);
+
+ /* parallel round 1 */
+ JJJ(aaa, bbb, ccc, ddd, eee, block[ 5], 8);
+ JJJ(eee, aaa, bbb, ccc, ddd, block[14], 9);
+ JJJ(ddd, eee, aaa, bbb, ccc, block[ 7], 9);
+ JJJ(ccc, ddd, eee, aaa, bbb, block[ 0], 11);
+ JJJ(bbb, ccc, ddd, eee, aaa, block[ 9], 13);
+ JJJ(aaa, bbb, ccc, ddd, eee, block[ 2], 15);
+ JJJ(eee, aaa, bbb, ccc, ddd, block[11], 15);
+ JJJ(ddd, eee, aaa, bbb, ccc, block[ 4], 5);
+ JJJ(ccc, ddd, eee, aaa, bbb, block[13], 7);
+ JJJ(bbb, ccc, ddd, eee, aaa, block[ 6], 7);
+ JJJ(aaa, bbb, ccc, ddd, eee, block[15], 8);
+ JJJ(eee, aaa, bbb, ccc, ddd, block[ 8], 11);
+ JJJ(ddd, eee, aaa, bbb, ccc, block[ 1], 14);
+ JJJ(ccc, ddd, eee, aaa, bbb, block[10], 14);
+ JJJ(bbb, ccc, ddd, eee, aaa, block[ 3], 12);
+ JJJ(aaa, bbb, ccc, ddd, eee, block[12], 6);
+
+ /* parallel round 2 */
+ III(eee, aaa, bbb, ccc, ddd, block[ 6], 9);
+ III(ddd, eee, aaa, bbb, ccc, block[11], 13);
+ III(ccc, ddd, eee, aaa, bbb, block[ 3], 15);
+ III(bbb, ccc, ddd, eee, aaa, block[ 7], 7);
+ III(aaa, bbb, ccc, ddd, eee, block[ 0], 12);
+ III(eee, aaa, bbb, ccc, ddd, block[13], 8);
+ III(ddd, eee, aaa, bbb, ccc, block[ 5], 9);
+ III(ccc, ddd, eee, aaa, bbb, block[10], 11);
+ III(bbb, ccc, ddd, eee, aaa, block[14], 7);
+ III(aaa, bbb, ccc, ddd, eee, block[15], 7);
+ III(eee, aaa, bbb, ccc, ddd, block[ 8], 12);
+ III(ddd, eee, aaa, bbb, ccc, block[12], 7);
+ III(ccc, ddd, eee, aaa, bbb, block[ 4], 6);
+ III(bbb, ccc, ddd, eee, aaa, block[ 9], 15);
+ III(aaa, bbb, ccc, ddd, eee, block[ 1], 13);
+ III(eee, aaa, bbb, ccc, ddd, block[ 2], 11);
+
+ /* parallel round 3 */
+ HHH(ddd, eee, aaa, bbb, ccc, block[15], 9);
+ HHH(ccc, ddd, eee, aaa, bbb, block[ 5], 7);
+ HHH(bbb, ccc, ddd, eee, aaa, block[ 1], 15);
+ HHH(aaa, bbb, ccc, ddd, eee, block[ 3], 11);
+ HHH(eee, aaa, bbb, ccc, ddd, block[ 7], 8);
+ HHH(ddd, eee, aaa, bbb, ccc, block[14], 6);
+ HHH(ccc, ddd, eee, aaa, bbb, block[ 6], 6);
+ HHH(bbb, ccc, ddd, eee, aaa, block[ 9], 14);
+ HHH(aaa, bbb, ccc, ddd, eee, block[11], 12);
+ HHH(eee, aaa, bbb, ccc, ddd, block[ 8], 13);
+ HHH(ddd, eee, aaa, bbb, ccc, block[12], 5);
+ HHH(ccc, ddd, eee, aaa, bbb, block[ 2], 14);
+ HHH(bbb, ccc, ddd, eee, aaa, block[10], 13);
+ HHH(aaa, bbb, ccc, ddd, eee, block[ 0], 13);
+ HHH(eee, aaa, bbb, ccc, ddd, block[ 4], 7);
+ HHH(ddd, eee, aaa, bbb, ccc, block[13], 5);
+
+ /* parallel round 4 */
+ GGG(ccc, ddd, eee, aaa, bbb, block[ 8], 15);
+ GGG(bbb, ccc, ddd, eee, aaa, block[ 6], 5);
+ GGG(aaa, bbb, ccc, ddd, eee, block[ 4], 8);
+ GGG(eee, aaa, bbb, ccc, ddd, block[ 1], 11);
+ GGG(ddd, eee, aaa, bbb, ccc, block[ 3], 14);
+ GGG(ccc, ddd, eee, aaa, bbb, block[11], 14);
+ GGG(bbb, ccc, ddd, eee, aaa, block[15], 6);
+ GGG(aaa, bbb, ccc, ddd, eee, block[ 0], 14);
+ GGG(eee, aaa, bbb, ccc, ddd, block[ 5], 6);
+ GGG(ddd, eee, aaa, bbb, ccc, block[12], 9);
+ GGG(ccc, ddd, eee, aaa, bbb, block[ 2], 12);
+ GGG(bbb, ccc, ddd, eee, aaa, block[13], 9);
+ GGG(aaa, bbb, ccc, ddd, eee, block[ 9], 12);
+ GGG(eee, aaa, bbb, ccc, ddd, block[ 7], 5);
+ GGG(ddd, eee, aaa, bbb, ccc, block[10], 15);
+ GGG(ccc, ddd, eee, aaa, bbb, block[14], 8);
+
+ /* parallel round 5 */
+ FFF(bbb, ccc, ddd, eee, aaa, block[12] , 8);
+ FFF(aaa, bbb, ccc, ddd, eee, block[15] , 5);
+ FFF(eee, aaa, bbb, ccc, ddd, block[10] , 12);
+ FFF(ddd, eee, aaa, bbb, ccc, block[ 4] , 9);
+ FFF(ccc, ddd, eee, aaa, bbb, block[ 1] , 12);
+ FFF(bbb, ccc, ddd, eee, aaa, block[ 5] , 5);
+ FFF(aaa, bbb, ccc, ddd, eee, block[ 8] , 14);
+ FFF(eee, aaa, bbb, ccc, ddd, block[ 7] , 6);
+ FFF(ddd, eee, aaa, bbb, ccc, block[ 6] , 8);
+ FFF(ccc, ddd, eee, aaa, bbb, block[ 2] , 13);
+ FFF(bbb, ccc, ddd, eee, aaa, block[13] , 6);
+ FFF(aaa, bbb, ccc, ddd, eee, block[14] , 5);
+ FFF(eee, aaa, bbb, ccc, ddd, block[ 0] , 15);
+ FFF(ddd, eee, aaa, bbb, ccc, block[ 3] , 13);
+ FFF(ccc, ddd, eee, aaa, bbb, block[ 9] , 11);
+ FFF(bbb, ccc, ddd, eee, aaa, block[11] , 11);
+
+ /* combine results */
+ ddd += cc + state[1]; /* final result for state[0] */
+ state[1] = state[2] + dd + eee;
+ state[2] = state[3] + ee + aaa;
+ state[3] = state[4] + aa + bbb;
+ state[4] = state[0] + bb + ccc;
+ state[0] = ddd;
+}
+
+/********************************************************************/
+
+void
+RMD160_Update(RMD160_CTX *context, const uint8_t *data, size_t nbytes)
+{
+ uint32_t X[16];
+ uint32_t ofs = 0;
+ uint32_t i;
+#ifdef WORDS_BIGENDIAN
+ uint32_t j;
+#endif
+
+ _DIAGASSERT(context != NULL);
+ _DIAGASSERT(data != NULL);
+
+ /* update length[] */
+ if (context->length[0] + nbytes < context->length[0])
+ context->length[1]++; /* overflow to msb of length */
+ context->length[0] += nbytes;
+
+ (void)memset(X, 0, sizeof(X));
+
+ if ( context->buflen + nbytes < 64 )
+ {
+ (void)memcpy(context->bbuffer + context->buflen, data, nbytes);
+ context->buflen += nbytes;
+ }
+ else
+ {
+ /* process first block */
+ ofs = 64 - context->buflen;
+ (void)memcpy(context->bbuffer + context->buflen, data, ofs);
+#ifndef WORDS_BIGENDIAN
+ (void)memcpy(X, context->bbuffer, sizeof(X));
+#else
+ for (j=0; j < 16; j++)
+ X[j] = BYTES_TO_DWORD(context->bbuffer + (4 * j));
+#endif
+ RMD160_Transform(context->state, X);
+ nbytes -= ofs;
+
+ /* process remaining complete blocks */
+ for (i = 0; i < (nbytes >> 6); i++) {
+#ifndef WORDS_BIGENDIAN
+ (void)memcpy(X, data + (64 * i) + ofs, sizeof(X));
+#else
+ for (j=0; j < 16; j++)
+ X[j] = BYTES_TO_DWORD(data + (64 * i) + (4 * j) + ofs);
+#endif
+ RMD160_Transform(context->state, X);
+ }
+
+ /*
+ * Put last bytes from data into context's buffer
+ */
+ context->buflen = nbytes & 63;
+ memcpy(context->bbuffer, data + (64 * i) + ofs, context->buflen);
+ }
+}
+
+/********************************************************************/
+
+void
+RMD160_Final(uint8_t digest[20], RMD160_CTX *context)
+{
+ uint32_t i;
+ uint32_t X[16];
+#ifdef WORDS_BIGENDIAN
+ uint32_t j;
+#endif
+
+ _DIAGASSERT(digest != NULL);
+ _DIAGASSERT(context != NULL);
+
+ /* append the bit m_n == 1 */
+ context->bbuffer[context->buflen] = (uint8_t)'\200';
+
+ (void)memset(context->bbuffer + context->buflen + 1, 0,
+ 63 - context->buflen);
+#ifndef WORDS_BIGENDIAN
+ (void)memcpy(X, context->bbuffer, sizeof(X));
+#else
+ for (j=0; j < 16; j++)
+ X[j] = BYTES_TO_DWORD(context->bbuffer + (4 * j));
+#endif
+ if ((context->buflen) > 55) {
+ /* length goes to next block */
+ RMD160_Transform(context->state, X);
+ (void)memset(X, 0, sizeof(X));
+ }
+
+ /* append length in bits */
+ X[14] = context->length[0] << 3;
+ X[15] = (context->length[0] >> 29) |
+ (context->length[1] << 3);
+ RMD160_Transform(context->state, X);
+
+ if (digest != NULL) {
+ for (i = 0; i < 20; i += 4) {
+ /* extracts the 8 least significant bits. */
+ digest[i] = context->state[i>>2];
+ digest[i + 1] = (context->state[i>>2] >> 8);
+ digest[i + 2] = (context->state[i>>2] >> 16);
+ digest[i + 3] = (context->state[i>>2] >> 24);
+ }
+ }
+}
+
+int RMD160_Equal(RMD160_CTX* pctx1, RMD160_CTX* pctx2) {
+ return pctx1->buflen == pctx2->buflen
+ && memcmp(pctx1->length, pctx2->length, sizeof(pctx1->length)) == 0
+ && memcmp(pctx1->state, pctx2->state, sizeof(pctx1->state)) == 0
+ && memcmp(pctx1->bbuffer, pctx2->bbuffer, sizeof(pctx1->bbuffer)) == 0;
+}
+
+/************************ end of file rmd160.c **********************/
diff --git a/ext/digest/rmd160/rmd160.h b/ext/digest/rmd160/rmd160.h
new file mode 100644
index 0000000000..24f9a025f0
--- /dev/null
+++ b/ext/digest/rmd160/rmd160.h
@@ -0,0 +1,68 @@
+/* $NetBSD: rmd160.h,v 1.2 2000/07/07 10:47:06 ad Exp $ */
+/* $RoughId: rmd160.h,v 1.3 2002/02/24 08:14:31 knu Exp $ */
+/* $Id$ */
+
+/********************************************************************\
+ *
+ * FILE: rmd160.h
+ *
+ * CONTENTS: Header file for a sample C-implementation of the
+ * RIPEMD-160 hash-function.
+ * TARGET: any computer with an ANSI C compiler
+ *
+ * AUTHOR: Antoon Bosselaers, ESAT-COSIC
+ * DATE: 1 March 1996
+ * VERSION: 1.0
+ *
+ * Copyright (c) Katholieke Universiteit Leuven
+ * 1996, All Rights Reserved
+ *
+\********************************************************************/
+
+/*
+ * from OpenBSD: rmd160.h,v 1.4 1999/08/16 09:59:04 millert Exp
+ */
+
+#ifndef _RMD160_H_
+#define _RMD160_H_
+
+#include "defs.h"
+
+typedef struct {
+ uint32_t state[5]; /* state (ABCDE) */
+ uint32_t length[2]; /* number of bits */
+ uint8_t bbuffer[64]; /* overflow buffer */
+ uint32_t buflen; /* number of chars in bbuffer */
+} RMD160_CTX;
+
+#ifdef RUBY
+#define RMD160_Init rb_Digest_RMD160_Init
+#define RMD160_Transform rb_Digest_RMD160_Transform
+#define RMD160_Update rb_Digest_RMD160_Update
+#define RMD160_Final rb_Digest_RMD160_Final
+#define RMD160_Equal rb_Digest_RMD160_Equal
+#ifndef _KERNEL
+#define RMD160_End rb_Digest_RMD160_End
+#define RMD160_File rb_Digest_RMD160_File
+#define RMD160_Data rb_Digest_RMD160_Data
+#endif /* _KERNEL */
+#endif
+
+__BEGIN_DECLS
+void RMD160_Init _((RMD160_CTX *));
+void RMD160_Transform _((uint32_t[5], const uint32_t[16]));
+void RMD160_Update _((RMD160_CTX *, const uint8_t *, size_t));
+void RMD160_Final _((uint8_t[20], RMD160_CTX *));
+int RMD160_Equal _((RMD160_CTX *, RMD160_CTX *));
+#ifndef _KERNEL
+char *RMD160_End _((RMD160_CTX *, char *));
+char *RMD160_File _((char *, char *));
+char *RMD160_Data _((const uint8_t *, size_t, char *));
+#endif /* _KERNEL */
+__END_DECLS
+
+#define RMD160_BLOCK_LENGTH 64
+#define RMD160_DIGEST_LENGTH 20
+#define RMD160_DIGEST_STRING_LENGTH (RMD160_DIGEST_LENGTH * 2 + 1)
+
+#endif /* !_RMD160_H_ */
diff --git a/ext/digest/rmd160/rmd160hl.c b/ext/digest/rmd160/rmd160hl.c
new file mode 100644
index 0000000000..4c5e0217d9
--- /dev/null
+++ b/ext/digest/rmd160/rmd160hl.c
@@ -0,0 +1,96 @@
+/* $NetBSD: rmd160hl.c,v 1.1.1.1 2001/03/06 11:21:05 agc Exp $ */
+/* $RoughId: rmd160hl.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
+/* $Id$ */
+
+/* rmd160hl.c
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
+ * ----------------------------------------------------------------------------
+ *
+ * from OpenBSD: rmd160hl.c,v 1.2 1999/08/17 09:13:12 millert Exp $
+ */
+
+#include "rmd160.h"
+
+#ifndef lint
+/* __RCSID("$NetBSD: rmd160hl.c,v 1.1.1.1 2001/03/06 11:21:05 agc Exp $"); */
+#endif /* not lint */
+
+/* #include "namespace.h" */
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#if defined(HAVE_UNISTD_H)
+# include <unistd.h>
+#endif
+
+#ifndef _DIAGASSERT
+#define _DIAGASSERT(cond) assert(cond)
+#endif
+
+
+char *
+RMD160_End(RMD160_CTX *ctx, char *buf)
+{
+ size_t i;
+ char *p = buf;
+ uint8_t digest[20];
+ static const char hex[]="0123456789abcdef";
+
+ _DIAGASSERT(ctx != NULL);
+ /* buf may be NULL */
+
+ if (p == NULL && (p = malloc(41)) == NULL)
+ return 0;
+
+ RMD160_Final(digest,ctx);
+ for (i = 0; i < 20; i++) {
+ p[i + i] = hex[(uint32_t)digest[i] >> 4];
+ p[i + i + 1] = hex[digest[i] & 0x0f];
+ }
+ p[i + i] = '\0';
+ return(p);
+}
+
+char *
+RMD160_File(char *filename, char *buf)
+{
+ uint8_t buffer[BUFSIZ];
+ RMD160_CTX ctx;
+ int fd, num, oerrno;
+
+ _DIAGASSERT(filename != NULL);
+ /* XXX: buf may be NULL ? */
+
+ RMD160_Init(&ctx);
+
+ if ((fd = open(filename, O_RDONLY)) < 0)
+ return(0);
+
+ while ((num = read(fd, buffer, sizeof(buffer))) > 0)
+ RMD160_Update(&ctx, buffer, (size_t)num);
+
+ oerrno = errno;
+ close(fd);
+ errno = oerrno;
+ return(num < 0 ? 0 : RMD160_End(&ctx, buf));
+}
+
+char *
+RMD160_Data(const uint8_t *data, size_t len, char *buf)
+{
+ RMD160_CTX ctx;
+
+ _DIAGASSERT(data != NULL);
+ /* XXX: buf may be NULL ? */
+
+ RMD160_Init(&ctx);
+ RMD160_Update(&ctx, data, len);
+ return(RMD160_End(&ctx, buf));
+}
diff --git a/ext/digest/rmd160/rmd160init.c b/ext/digest/rmd160/rmd160init.c
new file mode 100644
index 0000000000..b16cdbbed8
--- /dev/null
+++ b/ext/digest/rmd160/rmd160init.c
@@ -0,0 +1,38 @@
+/* $RoughId: rmd160init.c,v 1.3 2001/07/13 20:00:43 knu Exp $ */
+/* $Id$ */
+
+#include "digest.h"
+#if defined(HAVE_OPENSSL_RIPEMD_H)
+#include "rmd160ossl.h"
+#else
+#include "rmd160.h"
+#endif
+
+static algo_t rmd160 = {
+ RMD160_DIGEST_LENGTH,
+ sizeof(RMD160_CTX),
+ (hash_init_func_t)RMD160_Init,
+ (hash_update_func_t)RMD160_Update,
+ (hash_end_func_t)RMD160_End,
+ (hash_final_func_t)RMD160_Final,
+ (hash_equal_func_t)RMD160_Equal,
+};
+
+void
+Init_rmd160()
+{
+ VALUE mDigest, cDigest_Base, cDigest_RMD160;
+ ID id_metadata;
+
+ rb_require("digest.so");
+
+ mDigest = rb_path2class("Digest");
+ cDigest_Base = rb_path2class("Digest::Base");
+
+ cDigest_RMD160 = rb_define_class_under(mDigest, "RMD160", cDigest_Base);
+
+ id_metadata = rb_intern("metadata");
+
+ rb_cvar_set(cDigest_RMD160, id_metadata,
+ Data_Wrap_Struct(rb_cObject, 0, 0, &rmd160), Qtrue);
+}
diff --git a/ext/digest/rmd160/rmd160ossl.c b/ext/digest/rmd160/rmd160ossl.c
new file mode 100644
index 0000000000..be66d81ff9
--- /dev/null
+++ b/ext/digest/rmd160/rmd160ossl.c
@@ -0,0 +1,45 @@
+/* $Id$ */
+
+#include "rmd160ossl.h"
+#include "defs.h"
+#include <assert.h>
+#include <stdlib.h>
+
+#ifndef _DIAGASSERT
+#define _DIAGASSERT(cond) assert(cond)
+#endif
+
+char *
+RMD160_End(RMD160_CTX *ctx, char *buf)
+{
+ size_t i;
+ char *p = buf;
+ uint8_t digest[20];
+ static const char hex[]="0123456789abcdef";
+
+ _DIAGASSERT(ctx != NULL);
+ /* buf may be NULL */
+
+ if (p == NULL && (p = malloc(41)) == NULL)
+ return 0;
+
+ RMD160_Final(digest,ctx);
+ for (i = 0; i < 20; i++) {
+ p[i + i] = hex[(uint32_t)digest[i] >> 4];
+ p[i + i + 1] = hex[digest[i] & 0x0f];
+ }
+ p[i + i] = '\0';
+ return(p);
+}
+
+int RMD160_Equal(RMD160_CTX* pctx1, RMD160_CTX* pctx2) {
+ return pctx1->num == pctx2->num
+ && pctx1->A == pctx2->A
+ && pctx1->B == pctx2->B
+ && pctx1->C == pctx2->C
+ && pctx1->D == pctx2->D
+ && pctx1->E == pctx2->E
+ && pctx1->Nl == pctx2->Nl
+ && pctx1->Nh == pctx2->Nh
+ && memcmp(pctx1->data, pctx2->data, sizeof(pctx1->data)) == 0;
+}
diff --git a/ext/digest/rmd160/rmd160ossl.h b/ext/digest/rmd160/rmd160ossl.h
new file mode 100644
index 0000000000..824a1bf32f
--- /dev/null
+++ b/ext/digest/rmd160/rmd160ossl.h
@@ -0,0 +1,20 @@
+/* $Id$ */
+
+#ifndef RMD160OSSL_H_INCLUDED
+#define RMD160OSSL_H_INCLUDED
+
+#include <openssl/ripemd.h>
+
+#define RMD160_CTX RIPEMD160_CTX
+
+#define RMD160_Init RIPEMD160_Init
+#define RMD160_Update RIPEMD160_Update
+#define RMD160_Final RIPEMD160_Final
+
+#define RMD160_BLOCK_LENGTH RIPEMD160_CBLOCK
+#define RMD160_DIGEST_LENGTH RIPEMD160_DIGEST_LENGTH
+
+char *RMD160_End(RMD160_CTX *ctx, char *buf);
+int RMD160_Equal(RMD160_CTX *pctx1, RMD160_CTX *pctx2);
+
+#endif
diff --git a/ext/digest/sha1/.cvsignore b/ext/digest/sha1/.cvsignore
new file mode 100644
index 0000000000..4088712231
--- /dev/null
+++ b/ext/digest/sha1/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+mkmf.log
+*.def
diff --git a/ext/digest/sha1/depend b/ext/digest/sha1/depend
new file mode 100644
index 0000000000..a159f456d3
--- /dev/null
+++ b/ext/digest/sha1/depend
@@ -0,0 +1,8 @@
+sha1.o: sha1.c sha1.h $(srcdir)/../defs.h $(hdrdir)/ruby.h \
+ $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h
+sha1hl.o: sha1hl.c sha1.h $(srcdir)/../defs.h $(hdrdir)/ruby.h \
+ $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h
+sha1init.o: sha1init.c $(srcdir)/../digest.h $(hdrdir)/ruby.h \
+ $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h \
+ sha1.h $(srcdir)/../defs.h
+sha1ossl.o: sha1ossl.h $(srcdir)/../defs.h
diff --git a/ext/digest/sha1/extconf.rb b/ext/digest/sha1/extconf.rb
new file mode 100644
index 0000000000..c249a415ed
--- /dev/null
+++ b/ext/digest/sha1/extconf.rb
@@ -0,0 +1,25 @@
+# $RoughId: extconf.rb,v 1.3 2001/08/14 19:54:51 knu Exp $
+# $Id$
+
+require "mkmf"
+
+$CFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.."
+
+$objs = [ "sha1init.#{$OBJEXT}" ]
+
+dir_config("openssl")
+
+if !with_config("bundled-sha1") &&
+ have_library("crypto") && have_header("openssl/sha.h")
+ $objs << "sha1ossl.#{$OBJEXT}"
+else
+ $objs << "sha1.#{$OBJEXT}" << "sha1hl.#{$OBJEXT}"
+end
+
+have_header("sys/cdefs.h")
+
+have_header("inttypes.h")
+
+have_header("unistd.h")
+
+create_makefile("digest/sha1")
diff --git a/ext/digest/sha1/sha1.c b/ext/digest/sha1/sha1.c
new file mode 100644
index 0000000000..1012ef8751
--- /dev/null
+++ b/ext/digest/sha1/sha1.c
@@ -0,0 +1,283 @@
+/* $NetBSD: sha1.c,v 1.2 2001/03/22 09:51:48 agc Exp $ */
+/* $OpenBSD: sha1.c,v 1.9 1997/07/23 21:12:32 kstailey Exp $ */
+/* $RoughId: sha1.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
+/* $Id$ */
+
+/*
+ * SHA-1 in C
+ * By Steve Reid <steve@edmweb.com>
+ * 100% Public Domain
+ *
+ * Test Vectors (from FIPS PUB 180-1)
+ * "abc"
+ * A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
+ * "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
+ * 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
+ * A million repetitions of "a"
+ * 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
+ */
+
+#include "sha1.h"
+
+#define SHA1HANDSOFF /* Copies data before messing with it. */
+
+#if defined(_KERNEL) || defined(_STANDALONE)
+#include <sys/param.h>
+#include <sys/systm.h>
+#define _DIAGASSERT(x) (void)0
+#else
+/* #include "namespace.h" */
+#include <assert.h>
+#include <string.h>
+#endif
+
+#ifndef _DIAGASSERT
+#define _DIAGASSERT(cond) assert(cond)
+#endif
+
+/*
+ * XXX Kludge until there is resolution regarding mem*() functions
+ * XXX in the kernel.
+ */
+#if defined(_KERNEL) || defined(_STANDALONE)
+#define memcpy(s, d, l) bcopy((d), (s), (l))
+#endif
+
+#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
+
+/*
+ * blk0() and blk() perform the initial expand.
+ * I got the idea of expanding during the round function from SSLeay
+ */
+#ifndef WORDS_BIGENDIAN
+# define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
+ |(rol(block->l[i],8)&0x00FF00FF))
+#else
+# define blk0(i) block->l[i]
+#endif
+#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
+ ^block->l[(i+2)&15]^block->l[i&15],1))
+
+/*
+ * (R0+R1), R2, R3, R4 are the different operations (rounds) used in SHA1
+ */
+#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);
+#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);
+#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);
+#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);
+#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
+
+
+typedef union {
+ uint8_t c[64];
+ uint32_t l[16];
+} CHAR64LONG16;
+
+#ifdef __sparc_v9__
+void do_R01(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *);
+void do_R2(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *);
+void do_R3(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *);
+void do_R4(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *);
+
+#define nR0(v,w,x,y,z,i) R0(*v,*w,*x,*y,*z,i)
+#define nR1(v,w,x,y,z,i) R1(*v,*w,*x,*y,*z,i)
+#define nR2(v,w,x,y,z,i) R2(*v,*w,*x,*y,*z,i)
+#define nR3(v,w,x,y,z,i) R3(*v,*w,*x,*y,*z,i)
+#define nR4(v,w,x,y,z,i) R4(*v,*w,*x,*y,*z,i)
+
+void
+do_R01(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *block)
+{
+ nR0(a,b,c,d,e, 0); nR0(e,a,b,c,d, 1); nR0(d,e,a,b,c, 2); nR0(c,d,e,a,b, 3);
+ nR0(b,c,d,e,a, 4); nR0(a,b,c,d,e, 5); nR0(e,a,b,c,d, 6); nR0(d,e,a,b,c, 7);
+ nR0(c,d,e,a,b, 8); nR0(b,c,d,e,a, 9); nR0(a,b,c,d,e,10); nR0(e,a,b,c,d,11);
+ nR0(d,e,a,b,c,12); nR0(c,d,e,a,b,13); nR0(b,c,d,e,a,14); nR0(a,b,c,d,e,15);
+ nR1(e,a,b,c,d,16); nR1(d,e,a,b,c,17); nR1(c,d,e,a,b,18); nR1(b,c,d,e,a,19);
+}
+
+void
+do_R2(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *block)
+{
+ nR2(a,b,c,d,e,20); nR2(e,a,b,c,d,21); nR2(d,e,a,b,c,22); nR2(c,d,e,a,b,23);
+ nR2(b,c,d,e,a,24); nR2(a,b,c,d,e,25); nR2(e,a,b,c,d,26); nR2(d,e,a,b,c,27);
+ nR2(c,d,e,a,b,28); nR2(b,c,d,e,a,29); nR2(a,b,c,d,e,30); nR2(e,a,b,c,d,31);
+ nR2(d,e,a,b,c,32); nR2(c,d,e,a,b,33); nR2(b,c,d,e,a,34); nR2(a,b,c,d,e,35);
+ nR2(e,a,b,c,d,36); nR2(d,e,a,b,c,37); nR2(c,d,e,a,b,38); nR2(b,c,d,e,a,39);
+}
+
+void
+do_R3(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *block)
+{
+ nR3(a,b,c,d,e,40); nR3(e,a,b,c,d,41); nR3(d,e,a,b,c,42); nR3(c,d,e,a,b,43);
+ nR3(b,c,d,e,a,44); nR3(a,b,c,d,e,45); nR3(e,a,b,c,d,46); nR3(d,e,a,b,c,47);
+ nR3(c,d,e,a,b,48); nR3(b,c,d,e,a,49); nR3(a,b,c,d,e,50); nR3(e,a,b,c,d,51);
+ nR3(d,e,a,b,c,52); nR3(c,d,e,a,b,53); nR3(b,c,d,e,a,54); nR3(a,b,c,d,e,55);
+ nR3(e,a,b,c,d,56); nR3(d,e,a,b,c,57); nR3(c,d,e,a,b,58); nR3(b,c,d,e,a,59);
+}
+
+void
+do_R4(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *block)
+{
+ nR4(a,b,c,d,e,60); nR4(e,a,b,c,d,61); nR4(d,e,a,b,c,62); nR4(c,d,e,a,b,63);
+ nR4(b,c,d,e,a,64); nR4(a,b,c,d,e,65); nR4(e,a,b,c,d,66); nR4(d,e,a,b,c,67);
+ nR4(c,d,e,a,b,68); nR4(b,c,d,e,a,69); nR4(a,b,c,d,e,70); nR4(e,a,b,c,d,71);
+ nR4(d,e,a,b,c,72); nR4(c,d,e,a,b,73); nR4(b,c,d,e,a,74); nR4(a,b,c,d,e,75);
+ nR4(e,a,b,c,d,76); nR4(d,e,a,b,c,77); nR4(c,d,e,a,b,78); nR4(b,c,d,e,a,79);
+}
+#endif
+
+/*
+ * Hash a single 512-bit block. This is the core of the algorithm.
+ */
+void SHA1_Transform(state, buffer)
+ uint32_t state[5];
+ const uint8_t buffer[64];
+{
+ uint32_t a, b, c, d, e;
+ CHAR64LONG16 *block;
+
+#ifdef SHA1HANDSOFF
+ CHAR64LONG16 workspace;
+#endif
+
+ _DIAGASSERT(buffer != 0);
+ _DIAGASSERT(state != 0);
+
+#ifdef SHA1HANDSOFF
+ block = &workspace;
+ (void)memcpy(block, buffer, 64);
+#else
+ block = (CHAR64LONG16 *)(void *)buffer;
+#endif
+
+ /* Copy context->state[] to working vars */
+ a = state[0];
+ b = state[1];
+ c = state[2];
+ d = state[3];
+ e = state[4];
+
+#ifdef __sparc_v9__
+ do_R01(&a, &b, &c, &d, &e, block);
+ do_R2(&a, &b, &c, &d, &e, block);
+ do_R3(&a, &b, &c, &d, &e, block);
+ do_R4(&a, &b, &c, &d, &e, block);
+#else
+ /* 4 rounds of 20 operations each. Loop unrolled. */
+ R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
+ R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
+ R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
+ R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
+ R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
+ R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
+ R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
+ R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
+ R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
+ R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
+ R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
+ R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
+ R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
+ R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
+ R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
+ R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
+ R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
+ R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
+ R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
+ R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
+#endif
+
+ /* Add the working vars back into context.state[] */
+ state[0] += a;
+ state[1] += b;
+ state[2] += c;
+ state[3] += d;
+ state[4] += e;
+
+ /* Wipe variables */
+ a = b = c = d = e = 0;
+}
+
+
+/*
+ * SHA1_Init - Initialize new context
+ */
+void SHA1_Init(context)
+ SHA1_CTX *context;
+{
+
+ _DIAGASSERT(context != 0);
+
+ /* SHA1 initialization constants */
+ context->state[0] = 0x67452301;
+ context->state[1] = 0xEFCDAB89;
+ context->state[2] = 0x98BADCFE;
+ context->state[3] = 0x10325476;
+ context->state[4] = 0xC3D2E1F0;
+ context->count[0] = context->count[1] = 0;
+}
+
+
+/*
+ * Run your data through this.
+ */
+void SHA1_Update(context, data, len)
+ SHA1_CTX *context;
+ const uint8_t *data;
+ size_t len;
+{
+ uint32_t i, j;
+
+ _DIAGASSERT(context != 0);
+ _DIAGASSERT(data != 0);
+
+ j = context->count[0];
+ if ((context->count[0] += len << 3) < j)
+ context->count[1] += (len>>29)+1;
+ j = (j >> 3) & 63;
+ if ((j + len) > 63) {
+ (void)memcpy(&context->buffer[j], data, (i = 64-j));
+ SHA1_Transform(context->state, context->buffer);
+ for ( ; i + 63 < len; i += 64)
+ SHA1_Transform(context->state, &data[i]);
+ j = 0;
+ } else {
+ i = 0;
+ }
+ (void)memcpy(&context->buffer[j], &data[i], len - i);
+}
+
+
+/*
+ * Add padding and return the message digest.
+ */
+void SHA1_Final(digest, context)
+ uint8_t digest[20];
+ SHA1_CTX* context;
+{
+ size_t i;
+ uint8_t finalcount[8];
+
+ _DIAGASSERT(digest != 0);
+ _DIAGASSERT(context != 0);
+
+ for (i = 0; i < 8; i++) {
+ finalcount[i] = (uint8_t)((context->count[(i >= 4 ? 0 : 1)]
+ >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */
+ }
+ SHA1_Update(context, (const uint8_t *)"\200", 1);
+ while ((context->count[0] & 504) != 448)
+ SHA1_Update(context, (const uint8_t *)"\0", 1);
+ SHA1_Update(context, finalcount, 8); /* Should cause a SHA1_Transform() */
+
+ if (digest) {
+ for (i = 0; i < 20; i++)
+ digest[i] = (uint8_t)
+ ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
+ }
+}
+
+int SHA1_Equal(SHA1_CTX* pctx1, SHA1_CTX* pctx2) {
+ return memcmp(pctx1->count, pctx2->count, sizeof(pctx1->count)) == 0
+ && memcmp(pctx1->state, pctx2->state, sizeof(pctx1->state)) == 0
+ && memcmp(pctx1->buffer, pctx2->buffer, sizeof(pctx1->buffer)) == 0;
+}
diff --git a/ext/digest/sha1/sha1.h b/ext/digest/sha1/sha1.h
new file mode 100644
index 0000000000..2303cecc2b
--- /dev/null
+++ b/ext/digest/sha1/sha1.h
@@ -0,0 +1,50 @@
+/* $NetBSD: sha1.h,v 1.2 1998/05/29 22:55:44 thorpej Exp $ */
+/* $RoughId: sha1.h,v 1.3 2002/02/24 08:14:32 knu Exp $ */
+/* $Id$ */
+
+/*
+ * SHA-1 in C
+ * By Steve Reid <steve@edmweb.com>
+ * 100% Public Domain
+ */
+
+#ifndef _SYS_SHA1_H_
+#define _SYS_SHA1_H_
+
+#include "defs.h"
+
+typedef struct {
+ uint32_t state[5];
+ uint32_t count[2];
+ uint8_t buffer[64];
+} SHA1_CTX;
+
+#ifdef RUBY
+#define SHA1_Transform rb_Digest_SHA1_Transform
+#define SHA1_Init rb_Digest_SHA1_Init
+#define SHA1_Update rb_Digest_SHA1_Update
+#define SHA1_Final rb_Digest_SHA1_Final
+#define SHA1_Equal rb_Digest_SHA1_Equal
+#ifndef _KERNEL
+#define SHA1_End rb_Digest_SHA1_End
+#define SHA1_File rb_Digest_SHA1_File
+#define SHA1_Data rb_Digest_SHA1_Data
+#endif /* _KERNEL */
+#endif
+
+void SHA1_Transform _((uint32_t state[5], const uint8_t buffer[64]));
+void SHA1_Init _((SHA1_CTX *context));
+void SHA1_Update _((SHA1_CTX *context, const uint8_t *data, size_t len));
+void SHA1_Final _((uint8_t digest[20], SHA1_CTX *context));
+int SHA1_Equal _((SHA1_CTX *pctx1, SHA1_CTX *pctx2));
+#ifndef _KERNEL
+char *SHA1_End _((SHA1_CTX *, char *));
+char *SHA1_File _((char *, char *));
+char *SHA1_Data _((const uint8_t *, size_t, char *));
+#endif /* _KERNEL */
+
+#define SHA1_BLOCK_LENGTH 64
+#define SHA1_DIGEST_LENGTH 20
+#define SHA1_DIGEST_STRING_LENGTH (SHA1_DIGEST_LENGTH * 2 + 1)
+
+#endif /* _SYS_SHA1_H_ */
diff --git a/ext/digest/sha1/sha1hl.c b/ext/digest/sha1/sha1hl.c
new file mode 100644
index 0000000000..d1a236b22c
--- /dev/null
+++ b/ext/digest/sha1/sha1hl.c
@@ -0,0 +1,102 @@
+/* $NetBSD: sha1hl.c,v 1.2 2001/03/10 15:55:14 tron Exp $ */
+/* $RoughId: sha1hl.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
+/* $Id$ */
+
+/* sha1hl.c
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
+ * ----------------------------------------------------------------------------
+ */
+
+/* #include "namespace.h" */
+
+#include "sha1.h"
+#include <fcntl.h>
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#if defined(HAVE_UNISTD_H)
+# include <unistd.h>
+#endif
+
+#if defined(LIBC_SCCS) && !defined(lint)
+/* __RCSID("$NetBSD: sha1hl.c,v 1.2 2001/03/10 15:55:14 tron Exp $"); */
+#endif /* LIBC_SCCS and not lint */
+
+#ifndef _DIAGASSERT
+#define _DIAGASSERT(cond) assert(cond)
+#endif
+
+
+/* ARGSUSED */
+char *
+SHA1_End(ctx, buf)
+ SHA1_CTX *ctx;
+ char *buf;
+{
+ int i;
+ char *p = buf;
+ uint8_t digest[20];
+ static const char hex[]="0123456789abcdef";
+
+ _DIAGASSERT(ctx != NULL);
+ /* buf may be NULL */
+
+ if (p == NULL && (p = malloc(41)) == NULL)
+ return 0;
+
+ SHA1_Final(digest,ctx);
+ for (i = 0; i < 20; i++) {
+ p[i + i] = hex[((uint32_t)digest[i]) >> 4];
+ p[i + i + 1] = hex[digest[i] & 0x0f];
+ }
+ p[i + i] = '\0';
+ return(p);
+}
+
+char *
+SHA1_File (filename, buf)
+ char *filename;
+ char *buf;
+{
+ uint8_t buffer[BUFSIZ];
+ SHA1_CTX ctx;
+ int fd, num, oerrno;
+
+ _DIAGASSERT(filename != NULL);
+ /* XXX: buf may be NULL ? */
+
+ SHA1_Init(&ctx);
+
+ if ((fd = open(filename,O_RDONLY)) < 0)
+ return(0);
+
+ while ((num = read(fd, buffer, sizeof(buffer))) > 0)
+ SHA1_Update(&ctx, buffer, (size_t)num);
+
+ oerrno = errno;
+ close(fd);
+ errno = oerrno;
+ return(num < 0 ? 0 : SHA1_End(&ctx, buf));
+}
+
+char *
+SHA1_Data (data, len, buf)
+ const uint8_t *data;
+ size_t len;
+ char *buf;
+{
+ SHA1_CTX ctx;
+
+ _DIAGASSERT(data != NULL);
+ /* XXX: buf may be NULL ? */
+
+ SHA1_Init(&ctx);
+ SHA1_Update(&ctx, data, len);
+ return(SHA1_End(&ctx, buf));
+}
diff --git a/ext/digest/sha1/sha1init.c b/ext/digest/sha1/sha1init.c
new file mode 100644
index 0000000000..426afb7cd0
--- /dev/null
+++ b/ext/digest/sha1/sha1init.c
@@ -0,0 +1,38 @@
+/* $RoughId: sha1init.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
+/* $Id$ */
+
+#include "digest.h"
+#if defined(HAVE_OPENSSL_SHA_H)
+#include "sha1ossl.h"
+#else
+#include "sha1.h"
+#endif
+
+static algo_t sha1 = {
+ SHA1_DIGEST_LENGTH,
+ sizeof(SHA1_CTX),
+ (hash_init_func_t)SHA1_Init,
+ (hash_update_func_t)SHA1_Update,
+ (hash_end_func_t)SHA1_End,
+ (hash_final_func_t)SHA1_Final,
+ (hash_equal_func_t)SHA1_Equal,
+};
+
+void
+Init_sha1()
+{
+ VALUE mDigest, cDigest_Base, cDigest_SHA1;
+ ID id_metadata;
+
+ rb_require("digest.so");
+
+ mDigest = rb_path2class("Digest");
+ cDigest_Base = rb_path2class("Digest::Base");
+
+ cDigest_SHA1 = rb_define_class_under(mDigest, "SHA1", cDigest_Base);
+
+ id_metadata = rb_intern("metadata");
+
+ rb_cvar_set(cDigest_SHA1, id_metadata,
+ Data_Wrap_Struct(rb_cObject, 0, 0, &sha1), Qtrue);
+}
diff --git a/ext/digest/sha1/sha1ossl.c b/ext/digest/sha1/sha1ossl.c
new file mode 100644
index 0000000000..b125128f82
--- /dev/null
+++ b/ext/digest/sha1/sha1ossl.c
@@ -0,0 +1,45 @@
+/* $Id$ */
+
+#include "sha1ossl.h"
+#include "defs.h"
+#include <assert.h>
+#include <stdlib.h>
+
+#ifndef _DIAGASSERT
+#define _DIAGASSERT(cond) assert(cond)
+#endif
+
+char *
+SHA1_End(SHA1_CTX *ctx, char *buf)
+{
+ int i;
+ char *p = buf;
+ uint8_t digest[20];
+ static const char hex[]="0123456789abcdef";
+
+ _DIAGASSERT(ctx != NULL);
+ /* buf may be NULL */
+
+ if (p == NULL && (p = malloc(41)) == NULL)
+ return 0;
+
+ SHA1_Final(digest,ctx);
+ for (i = 0; i < 20; i++) {
+ p[i + i] = hex[((uint32_t)digest[i]) >> 4];
+ p[i + i + 1] = hex[digest[i] & 0x0f];
+ }
+ p[i + i] = '\0';
+ return(p);
+}
+
+int SHA1_Equal(SHA1_CTX* pctx1, SHA1_CTX* pctx2) {
+ return pctx1->num == pctx2->num
+ && pctx1->h0 == pctx2->h0
+ && pctx1->h1 == pctx2->h1
+ && pctx1->h2 == pctx2->h2
+ && pctx1->h3 == pctx2->h3
+ && pctx1->h4 == pctx2->h4
+ && pctx1->Nl == pctx2->Nl
+ && pctx1->Nh == pctx2->Nh
+ && memcmp(pctx1->data, pctx2->data, sizeof(pctx1->data)) == 0;
+}
diff --git a/ext/digest/sha1/sha1ossl.h b/ext/digest/sha1/sha1ossl.h
new file mode 100644
index 0000000000..e8d7e74baf
--- /dev/null
+++ b/ext/digest/sha1/sha1ossl.h
@@ -0,0 +1,16 @@
+/* $Id$ */
+
+#ifndef SHA1OSSL_H_INCLUDED
+#define SHA1OSSL_H_INCLUDED
+
+#include <openssl/sha.h>
+
+#define SHA1_CTX SHA_CTX
+
+#define SHA1_BLOCK_LENGTH SHA_BLOCK_LENGTH
+#define SHA1_DIGEST_LENGTH SHA_DIGEST_LENGTH
+
+char *SHA1_End(SHA1_CTX *ctx, char *buf);
+int SHA1_Equal(SHA1_CTX *pctx1, SHA1_CTX *pctx2);
+
+#endif
diff --git a/ext/digest/sha2/.cvsignore b/ext/digest/sha2/.cvsignore
new file mode 100644
index 0000000000..4088712231
--- /dev/null
+++ b/ext/digest/sha2/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+mkmf.log
+*.def
diff --git a/ext/digest/sha2/depend b/ext/digest/sha2/depend
new file mode 100644
index 0000000000..2587415fdc
--- /dev/null
+++ b/ext/digest/sha2/depend
@@ -0,0 +1,7 @@
+sha2.o: sha2.c sha2.h $(srcdir)/../defs.h $(hdrdir)/ruby.h \
+ $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h
+sha2hl.o: sha2hl.c sha2.h $(srcdir)/../defs.h $(hdrdir)/ruby.h \
+ $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h
+sha2init.o: sha2init.c $(srcdir)/../digest.h $(hdrdir)/ruby.h \
+ $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h \
+ sha2.h $(srcdir)/../defs.h
diff --git a/ext/digest/sha2/extconf.rb b/ext/digest/sha2/extconf.rb
new file mode 100644
index 0000000000..c982aa64de
--- /dev/null
+++ b/ext/digest/sha2/extconf.rb
@@ -0,0 +1,28 @@
+# $RoughId: extconf.rb,v 1.4 2001/08/14 19:54:51 knu Exp $
+# $Id$
+
+require "mkmf"
+
+$CFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.."
+
+$objs = [
+ "sha2.#{$OBJEXT}",
+ "sha2hl.#{$OBJEXT}",
+ "sha2init.#{$OBJEXT}",
+]
+
+have_header("sys/cdefs.h")
+
+have_header("inttypes.h")
+
+have_header("unistd.h")
+
+if try_cpp(<<SRC, $defs.join(' '))
+#include "defs.h"
+#ifdef NO_UINT64_T
+ #error ** Cannot find a 64bit integer type - skipping the SHA2 module.
+#endif
+SRC
+then
+ create_makefile("digest/sha2")
+end
diff --git a/ext/digest/sha2/sha2.c b/ext/digest/sha2/sha2.c
new file mode 100644
index 0000000000..24a57ded0d
--- /dev/null
+++ b/ext/digest/sha2/sha2.c
@@ -0,0 +1,937 @@
+/*
+ * sha2.c
+ *
+ * Version 1.0.0beta1
+ *
+ * Written by Aaron D. Gifford <me@aarongifford.com>
+ *
+ * Copyright 2000 Aaron D. Gifford. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTOR(S) ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTOR(S) BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/* $RoughId: sha2.c,v 1.3 2002/02/26 22:03:36 knu Exp $ */
+/* $Id$ */
+
+#include "sha2.h"
+#include <stdio.h>
+#include <string.h> /* memcpy()/memset() or bcopy()/bzero() */
+#include <assert.h> /* assert() */
+
+/*
+ * ASSERT NOTE:
+ * Some sanity checking code is included using assert(). On my FreeBSD
+ * system, this additional code can be removed by compiling with NDEBUG
+ * defined. Check your own systems manpage on assert() to see how to
+ * compile WITHOUT the sanity checking code on your system.
+ *
+ * UNROLLED TRANSFORM LOOP NOTE:
+ * You can define SHA2_UNROLL_TRANSFORM to use the unrolled transform
+ * loop version for the hash transform rounds (defined using macros
+ * later in this file). Either define on the command line, for example:
+ *
+ * cc -DSHA2_UNROLL_TRANSFORM -o sha2 sha2.c sha2prog.c
+ *
+ * or define below:
+ *
+ * #define SHA2_UNROLL_TRANSFORM
+ *
+ */
+
+
+/*** SHA-256/384/512 Machine Architecture Definitions *****************/
+typedef uint8_t sha2_byte; /* Exactly 1 byte */
+typedef uint32_t sha2_word32; /* Exactly 4 bytes */
+typedef uint64_t sha2_word64; /* Exactly 8 bytes */
+
+#if defined(__GNUC__) || defined(_HPUX_SOURCE)
+#define ULL(number) number##ULL
+#else
+#define ULL(number) (uint64_t)(number)
+#endif
+
+
+/*** SHA-256/384/512 Various Length Definitions ***********************/
+/* NOTE: Most of these are in sha2.h */
+#define SHA256_SHORT_BLOCK_LENGTH (SHA256_BLOCK_LENGTH - 8)
+#define SHA384_SHORT_BLOCK_LENGTH (SHA384_BLOCK_LENGTH - 16)
+#define SHA512_SHORT_BLOCK_LENGTH (SHA512_BLOCK_LENGTH - 16)
+
+
+/*** ENDIAN REVERSAL MACROS *******************************************/
+#ifndef WORDS_BIGENDIAN
+#define REVERSE32(w,x) { \
+ sha2_word32 tmp = (w); \
+ tmp = (tmp >> 16) | (tmp << 16); \
+ (x) = ((tmp & 0xff00ff00UL) >> 8) | ((tmp & 0x00ff00ffUL) << 8); \
+}
+#define REVERSE64(w,x) { \
+ sha2_word64 tmp = (w); \
+ tmp = (tmp >> 32) | (tmp << 32); \
+ tmp = ((tmp & ULL(0xff00ff00ff00ff00)) >> 8) | \
+ ((tmp & ULL(0x00ff00ff00ff00ff)) << 8); \
+ (x) = ((tmp & ULL(0xffff0000ffff0000)) >> 16) | \
+ ((tmp & ULL(0x0000ffff0000ffff)) << 16); \
+}
+#endif
+
+/*
+ * Macro for incrementally adding the unsigned 64-bit integer n to the
+ * unsigned 128-bit integer (represented using a two-element array of
+ * 64-bit words):
+ */
+#define ADDINC128(w,n) { \
+ (w)[0] += (sha2_word64)(n); \
+ if ((w)[0] < (n)) { \
+ (w)[1]++; \
+ } \
+}
+
+/*
+ * Macros for copying blocks of memory and for zeroing out ranges
+ * of memory. Using these macros makes it easy to switch from
+ * using memset()/memcpy() and using bzero()/bcopy().
+ *
+ * Please define either SHA2_USE_MEMSET_MEMCPY or define
+ * SHA2_USE_BZERO_BCOPY depending on which function set you
+ * choose to use:
+ */
+#if !defined(SHA2_USE_MEMSET_MEMCPY) && !defined(SHA2_USE_BZERO_BCOPY)
+/* Default to memset()/memcpy() if no option is specified */
+#define SHA2_USE_MEMSET_MEMCPY 1
+#endif
+#if defined(SHA2_USE_MEMSET_MEMCPY) && defined(SHA2_USE_BZERO_BCOPY)
+/* Abort with an error if BOTH options are defined */
+#error Define either SHA2_USE_MEMSET_MEMCPY or SHA2_USE_BZERO_BCOPY, not both!
+#endif
+
+#ifdef SHA2_USE_MEMSET_MEMCPY
+#define MEMSET_BZERO(p,l) memset((p), 0, (l))
+#define MEMCPY_BCOPY(d,s,l) memcpy((d), (s), (l))
+#endif
+#ifdef SHA2_USE_BZERO_BCOPY
+#define MEMSET_BZERO(p,l) bzero((p), (l))
+#define MEMCPY_BCOPY(d,s,l) bcopy((s), (d), (l))
+#endif
+
+
+/*** THE SIX LOGICAL FUNCTIONS ****************************************/
+/*
+ * Bit shifting and rotation (used by the six SHA-XYZ logical functions:
+ *
+ * NOTE: The naming of R and S appears backwards here (R is a SHIFT and
+ * S is a ROTATION) because the SHA-256/384/512 description document
+ * (see http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf) uses this
+ * same "backwards" definition.
+ */
+/* Shift-right (used in SHA-256, SHA-384, and SHA-512): */
+#define R(b,x) ((x) >> (b))
+/* 32-bit Rotate-right (used in SHA-256): */
+#define S32(b,x) (((x) >> (b)) | ((x) << (32 - (b))))
+/* 64-bit Rotate-right (used in SHA-384 and SHA-512): */
+#define S64(b,x) (((x) >> (b)) | ((x) << (64 - (b))))
+
+/* Two of six logical functions used in SHA-256, SHA-384, and SHA-512: */
+#define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z)))
+#define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
+
+/* Four of six logical functions used in SHA-256: */
+#define Sigma0_256(x) (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x)))
+#define Sigma1_256(x) (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x)))
+#define sigma0_256(x) (S32(7, (x)) ^ S32(18, (x)) ^ R(3 , (x)))
+#define sigma1_256(x) (S32(17, (x)) ^ S32(19, (x)) ^ R(10, (x)))
+
+/* Four of six logical functions used in SHA-384 and SHA-512: */
+#define Sigma0_512(x) (S64(28, (x)) ^ S64(34, (x)) ^ S64(39, (x)))
+#define Sigma1_512(x) (S64(14, (x)) ^ S64(18, (x)) ^ S64(41, (x)))
+#define sigma0_512(x) (S64( 1, (x)) ^ S64( 8, (x)) ^ R( 7, (x)))
+#define sigma1_512(x) (S64(19, (x)) ^ S64(61, (x)) ^ R( 6, (x)))
+
+/*** INTERNAL FUNCTION PROTOTYPES *************************************/
+/* NOTE: These should not be accessed directly from outside this
+ * library -- they are intended for private internal visibility/use
+ * only.
+ */
+void SHA512_Last(SHA512_CTX*);
+void SHA256_Transform(SHA256_CTX*, const sha2_word32*);
+void SHA512_Transform(SHA512_CTX*, const sha2_word64*);
+
+
+/*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/
+/* Hash constant words K for SHA-256: */
+const static sha2_word32 K256[64] = {
+ 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL,
+ 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL,
+ 0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL,
+ 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL,
+ 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL,
+ 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL,
+ 0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL,
+ 0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL,
+ 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL,
+ 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL,
+ 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL,
+ 0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL,
+ 0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL,
+ 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL,
+ 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
+ 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL
+};
+
+/* Initial hash value H for SHA-256: */
+const static sha2_word32 sha256_initial_hash_value[8] = {
+ 0x6a09e667UL,
+ 0xbb67ae85UL,
+ 0x3c6ef372UL,
+ 0xa54ff53aUL,
+ 0x510e527fUL,
+ 0x9b05688cUL,
+ 0x1f83d9abUL,
+ 0x5be0cd19UL
+};
+
+/* Hash constant words K for SHA-384 and SHA-512: */
+const static sha2_word64 K512[80] = {
+ ULL(0x428a2f98d728ae22), ULL(0x7137449123ef65cd),
+ ULL(0xb5c0fbcfec4d3b2f), ULL(0xe9b5dba58189dbbc),
+ ULL(0x3956c25bf348b538), ULL(0x59f111f1b605d019),
+ ULL(0x923f82a4af194f9b), ULL(0xab1c5ed5da6d8118),
+ ULL(0xd807aa98a3030242), ULL(0x12835b0145706fbe),
+ ULL(0x243185be4ee4b28c), ULL(0x550c7dc3d5ffb4e2),
+ ULL(0x72be5d74f27b896f), ULL(0x80deb1fe3b1696b1),
+ ULL(0x9bdc06a725c71235), ULL(0xc19bf174cf692694),
+ ULL(0xe49b69c19ef14ad2), ULL(0xefbe4786384f25e3),
+ ULL(0x0fc19dc68b8cd5b5), ULL(0x240ca1cc77ac9c65),
+ ULL(0x2de92c6f592b0275), ULL(0x4a7484aa6ea6e483),
+ ULL(0x5cb0a9dcbd41fbd4), ULL(0x76f988da831153b5),
+ ULL(0x983e5152ee66dfab), ULL(0xa831c66d2db43210),
+ ULL(0xb00327c898fb213f), ULL(0xbf597fc7beef0ee4),
+ ULL(0xc6e00bf33da88fc2), ULL(0xd5a79147930aa725),
+ ULL(0x06ca6351e003826f), ULL(0x142929670a0e6e70),
+ ULL(0x27b70a8546d22ffc), ULL(0x2e1b21385c26c926),
+ ULL(0x4d2c6dfc5ac42aed), ULL(0x53380d139d95b3df),
+ ULL(0x650a73548baf63de), ULL(0x766a0abb3c77b2a8),
+ ULL(0x81c2c92e47edaee6), ULL(0x92722c851482353b),
+ ULL(0xa2bfe8a14cf10364), ULL(0xa81a664bbc423001),
+ ULL(0xc24b8b70d0f89791), ULL(0xc76c51a30654be30),
+ ULL(0xd192e819d6ef5218), ULL(0xd69906245565a910),
+ ULL(0xf40e35855771202a), ULL(0x106aa07032bbd1b8),
+ ULL(0x19a4c116b8d2d0c8), ULL(0x1e376c085141ab53),
+ ULL(0x2748774cdf8eeb99), ULL(0x34b0bcb5e19b48a8),
+ ULL(0x391c0cb3c5c95a63), ULL(0x4ed8aa4ae3418acb),
+ ULL(0x5b9cca4f7763e373), ULL(0x682e6ff3d6b2b8a3),
+ ULL(0x748f82ee5defb2fc), ULL(0x78a5636f43172f60),
+ ULL(0x84c87814a1f0ab72), ULL(0x8cc702081a6439ec),
+ ULL(0x90befffa23631e28), ULL(0xa4506cebde82bde9),
+ ULL(0xbef9a3f7b2c67915), ULL(0xc67178f2e372532b),
+ ULL(0xca273eceea26619c), ULL(0xd186b8c721c0c207),
+ ULL(0xeada7dd6cde0eb1e), ULL(0xf57d4f7fee6ed178),
+ ULL(0x06f067aa72176fba), ULL(0x0a637dc5a2c898a6),
+ ULL(0x113f9804bef90dae), ULL(0x1b710b35131c471b),
+ ULL(0x28db77f523047d84), ULL(0x32caab7b40c72493),
+ ULL(0x3c9ebe0a15c9bebc), ULL(0x431d67c49c100d4c),
+ ULL(0x4cc5d4becb3e42b6), ULL(0x597f299cfc657e2a),
+ ULL(0x5fcb6fab3ad6faec), ULL(0x6c44198c4a475817)
+};
+
+/* Initial hash value H for SHA-384 */
+const static sha2_word64 sha384_initial_hash_value[8] = {
+ ULL(0xcbbb9d5dc1059ed8),
+ ULL(0x629a292a367cd507),
+ ULL(0x9159015a3070dd17),
+ ULL(0x152fecd8f70e5939),
+ ULL(0x67332667ffc00b31),
+ ULL(0x8eb44a8768581511),
+ ULL(0xdb0c2e0d64f98fa7),
+ ULL(0x47b5481dbefa4fa4)
+};
+
+/* Initial hash value H for SHA-512 */
+const static sha2_word64 sha512_initial_hash_value[8] = {
+ ULL(0x6a09e667f3bcc908),
+ ULL(0xbb67ae8584caa73b),
+ ULL(0x3c6ef372fe94f82b),
+ ULL(0xa54ff53a5f1d36f1),
+ ULL(0x510e527fade682d1),
+ ULL(0x9b05688c2b3e6c1f),
+ ULL(0x1f83d9abfb41bd6b),
+ ULL(0x5be0cd19137e2179)
+};
+
+
+/*** SHA-256: *********************************************************/
+void SHA256_Init(SHA256_CTX* context) {
+ if (context == (SHA256_CTX*)0) {
+ return;
+ }
+ MEMCPY_BCOPY(context->state, sha256_initial_hash_value, SHA256_DIGEST_LENGTH);
+ MEMSET_BZERO(context->buffer, SHA256_BLOCK_LENGTH);
+ context->bitcount = 0;
+}
+
+#ifdef SHA2_UNROLL_TRANSFORM
+
+/* Unrolled SHA-256 round macros: */
+
+#ifndef WORDS_BIGENDIAN
+
+#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \
+ REVERSE32(*data++, W256[j]); \
+ T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \
+ K256[j] + W256[j]; \
+ (d) += T1; \
+ (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
+ j++
+
+
+#else
+
+#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \
+ T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \
+ K256[j] + (W256[j] = *data++); \
+ (d) += T1; \
+ (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
+ j++
+
+#endif
+
+#define ROUND256(a,b,c,d,e,f,g,h) \
+ s0 = W256[(j+1)&0x0f]; \
+ s0 = sigma0_256(s0); \
+ s1 = W256[(j+14)&0x0f]; \
+ s1 = sigma1_256(s1); \
+ T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + K256[j] + \
+ (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); \
+ (d) += T1; \
+ (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
+ j++
+
+void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) {
+ sha2_word32 a, b, c, d, e, f, g, h, s0, s1;
+ sha2_word32 T1, *W256;
+ int j;
+
+ W256 = (sha2_word32*)context->buffer;
+
+ /* Initialize registers with the prev. intermediate value */
+ a = context->state[0];
+ b = context->state[1];
+ c = context->state[2];
+ d = context->state[3];
+ e = context->state[4];
+ f = context->state[5];
+ g = context->state[6];
+ h = context->state[7];
+
+ j = 0;
+ do {
+ /* Rounds 0 to 15 (unrolled): */
+ ROUND256_0_TO_15(a,b,c,d,e,f,g,h);
+ ROUND256_0_TO_15(h,a,b,c,d,e,f,g);
+ ROUND256_0_TO_15(g,h,a,b,c,d,e,f);
+ ROUND256_0_TO_15(f,g,h,a,b,c,d,e);
+ ROUND256_0_TO_15(e,f,g,h,a,b,c,d);
+ ROUND256_0_TO_15(d,e,f,g,h,a,b,c);
+ ROUND256_0_TO_15(c,d,e,f,g,h,a,b);
+ ROUND256_0_TO_15(b,c,d,e,f,g,h,a);
+ } while (j < 16);
+
+ /* Now for the remaining rounds to 64: */
+ do {
+ ROUND256(a,b,c,d,e,f,g,h);
+ ROUND256(h,a,b,c,d,e,f,g);
+ ROUND256(g,h,a,b,c,d,e,f);
+ ROUND256(f,g,h,a,b,c,d,e);
+ ROUND256(e,f,g,h,a,b,c,d);
+ ROUND256(d,e,f,g,h,a,b,c);
+ ROUND256(c,d,e,f,g,h,a,b);
+ ROUND256(b,c,d,e,f,g,h,a);
+ } while (j < 64);
+
+ /* Compute the current intermediate hash value */
+ context->state[0] += a;
+ context->state[1] += b;
+ context->state[2] += c;
+ context->state[3] += d;
+ context->state[4] += e;
+ context->state[5] += f;
+ context->state[6] += g;
+ context->state[7] += h;
+
+ /* Clean up */
+ a = b = c = d = e = f = g = h = T1 = 0;
+}
+
+#else /* SHA2_UNROLL_TRANSFORM */
+
+void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) {
+ sha2_word32 a, b, c, d, e, f, g, h, s0, s1;
+ sha2_word32 T1, T2, *W256;
+ int j;
+
+ W256 = (sha2_word32*)context->buffer;
+
+ /* Initialize registers with the prev. intermediate value */
+ a = context->state[0];
+ b = context->state[1];
+ c = context->state[2];
+ d = context->state[3];
+ e = context->state[4];
+ f = context->state[5];
+ g = context->state[6];
+ h = context->state[7];
+
+ j = 0;
+ do {
+#ifndef WORDS_BIGENDIAN
+ /* Copy data while converting to host byte order */
+ REVERSE32(*data++,W256[j]);
+ /* Apply the SHA-256 compression function to update a..h */
+ T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + W256[j];
+#else
+ /* Apply the SHA-256 compression function to update a..h with copy */
+ T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j] = *data++);
+#endif
+ T2 = Sigma0_256(a) + Maj(a, b, c);
+ h = g;
+ g = f;
+ f = e;
+ e = d + T1;
+ d = c;
+ c = b;
+ b = a;
+ a = T1 + T2;
+
+ j++;
+ } while (j < 16);
+
+ do {
+ /* Part of the message block expansion: */
+ s0 = W256[(j+1)&0x0f];
+ s0 = sigma0_256(s0);
+ s1 = W256[(j+14)&0x0f];
+ s1 = sigma1_256(s1);
+
+ /* Apply the SHA-256 compression function to update a..h */
+ T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] +
+ (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0);
+ T2 = Sigma0_256(a) + Maj(a, b, c);
+ h = g;
+ g = f;
+ f = e;
+ e = d + T1;
+ d = c;
+ c = b;
+ b = a;
+ a = T1 + T2;
+
+ j++;
+ } while (j < 64);
+
+ /* Compute the current intermediate hash value */
+ context->state[0] += a;
+ context->state[1] += b;
+ context->state[2] += c;
+ context->state[3] += d;
+ context->state[4] += e;
+ context->state[5] += f;
+ context->state[6] += g;
+ context->state[7] += h;
+
+ /* Clean up */
+ a = b = c = d = e = f = g = h = T1 = T2 = 0;
+}
+
+#endif /* SHA2_UNROLL_TRANSFORM */
+
+void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) {
+ unsigned int freespace, usedspace;
+
+ if (len == 0) {
+ /* Calling with no data is valid - we do nothing */
+ return;
+ }
+
+ /* Sanity check: */
+ assert(context != NULL && data != NULL);
+
+ usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
+ if (usedspace > 0) {
+ /* Calculate how much free space is available in the buffer */
+ freespace = SHA256_BLOCK_LENGTH - usedspace;
+
+ if (len >= freespace) {
+ /* Fill the buffer completely and process it */
+ MEMCPY_BCOPY(&context->buffer[usedspace], data, freespace);
+ context->bitcount += freespace << 3;
+ len -= freespace;
+ data += freespace;
+ SHA256_Transform(context, (sha2_word32*)context->buffer);
+ } else {
+ /* The buffer is not yet full */
+ MEMCPY_BCOPY(&context->buffer[usedspace], data, len);
+ context->bitcount += len << 3;
+ /* Clean up: */
+ usedspace = freespace = 0;
+ return;
+ }
+ }
+ while (len >= SHA256_BLOCK_LENGTH) {
+ /* Process as many complete blocks as we can */
+ SHA256_Transform(context, (const sha2_word32*)data);
+ context->bitcount += SHA256_BLOCK_LENGTH << 3;
+ len -= SHA256_BLOCK_LENGTH;
+ data += SHA256_BLOCK_LENGTH;
+ }
+ if (len > 0) {
+ /* There's left-overs, so save 'em */
+ MEMCPY_BCOPY(context->buffer, data, len);
+ context->bitcount += len << 3;
+ }
+ /* Clean up: */
+ usedspace = freespace = 0;
+}
+
+void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
+ sha2_word32 *d = (sha2_word32*)digest;
+ unsigned int usedspace;
+
+ /* Sanity check: */
+ assert(context != NULL);
+
+ /* If no digest buffer is passed, we don't bother doing this: */
+ if (digest != (sha2_byte*)0) {
+ usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
+#ifndef WORDS_BIGENDIAN
+ /* Convert FROM host byte order */
+ REVERSE64(context->bitcount,context->bitcount);
+#endif
+ if (usedspace > 0) {
+ /* Begin padding with a 1 bit: */
+ context->buffer[usedspace++] = 0x80;
+
+ if (usedspace <= SHA256_SHORT_BLOCK_LENGTH) {
+ /* Set-up for the last transform: */
+ MEMSET_BZERO(&context->buffer[usedspace], SHA256_SHORT_BLOCK_LENGTH - usedspace);
+ } else {
+ if (usedspace < SHA256_BLOCK_LENGTH) {
+ MEMSET_BZERO(&context->buffer[usedspace], SHA256_BLOCK_LENGTH - usedspace);
+ }
+ /* Do second-to-last transform: */
+ SHA256_Transform(context, (sha2_word32*)context->buffer);
+
+ /* And set-up for the last transform: */
+ MEMSET_BZERO(context->buffer, SHA256_SHORT_BLOCK_LENGTH);
+ }
+ } else {
+ /* Set-up for the last transform: */
+ MEMSET_BZERO(context->buffer, SHA256_SHORT_BLOCK_LENGTH);
+
+ /* Begin padding with a 1 bit: */
+ *context->buffer = 0x80;
+ }
+ /* Set the bit count: */
+ *(sha2_word64*)&context->buffer[SHA256_SHORT_BLOCK_LENGTH] = context->bitcount;
+
+ /* Final transform: */
+ SHA256_Transform(context, (sha2_word32*)context->buffer);
+
+#ifndef WORDS_BIGENDIAN
+ {
+ /* Convert TO host byte order */
+ int j;
+ for (j = 0; j < 8; j++) {
+ REVERSE32(context->state[j],context->state[j]);
+ *d++ = context->state[j];
+ }
+ }
+#else
+ MEMCPY_BCOPY(d, context->state, SHA256_DIGEST_LENGTH);
+#endif
+ }
+
+ /* Clean up state data: */
+ MEMSET_BZERO(context, sizeof(SHA256_CTX));
+ usedspace = 0;
+}
+
+int SHA256_Equal(SHA256_CTX* pctx1, SHA256_CTX* pctx2) {
+ return pctx1->bitcount == pctx2->bitcount
+ && memcmp(pctx1->state, pctx2->state, sizeof(pctx1->state)) == 0
+ && memcmp(pctx1->buffer, pctx2->buffer, sizeof(pctx1->buffer)) == 0;
+}
+
+/*** SHA-512: *********************************************************/
+void SHA512_Init(SHA512_CTX* context) {
+ if (context == (SHA512_CTX*)0) {
+ return;
+ }
+ MEMCPY_BCOPY(context->state, sha512_initial_hash_value, SHA512_DIGEST_LENGTH);
+ MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH);
+ context->bitcount[0] = context->bitcount[1] = 0;
+}
+
+#ifdef SHA2_UNROLL_TRANSFORM
+
+/* Unrolled SHA-512 round macros: */
+#ifndef WORDS_BIGENDIAN
+
+#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \
+ REVERSE64(*data++, W512[j]); \
+ T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \
+ K512[j] + W512[j]; \
+ (d) += T1, \
+ (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)), \
+ j++
+
+
+#else
+
+#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \
+ T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \
+ K512[j] + (W512[j] = *data++); \
+ (d) += T1; \
+ (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \
+ j++
+
+#endif
+
+#define ROUND512(a,b,c,d,e,f,g,h) \
+ s0 = W512[(j+1)&0x0f]; \
+ s0 = sigma0_512(s0); \
+ s1 = W512[(j+14)&0x0f]; \
+ s1 = sigma1_512(s1); \
+ T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + K512[j] + \
+ (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); \
+ (d) += T1; \
+ (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \
+ j++
+
+void SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) {
+ sha2_word64 a, b, c, d, e, f, g, h, s0, s1;
+ sha2_word64 T1, *W512 = (sha2_word64*)context->buffer;
+ int j;
+
+ /* Initialize registers with the prev. intermediate value */
+ a = context->state[0];
+ b = context->state[1];
+ c = context->state[2];
+ d = context->state[3];
+ e = context->state[4];
+ f = context->state[5];
+ g = context->state[6];
+ h = context->state[7];
+
+ j = 0;
+ do {
+ ROUND512_0_TO_15(a,b,c,d,e,f,g,h);
+ ROUND512_0_TO_15(h,a,b,c,d,e,f,g);
+ ROUND512_0_TO_15(g,h,a,b,c,d,e,f);
+ ROUND512_0_TO_15(f,g,h,a,b,c,d,e);
+ ROUND512_0_TO_15(e,f,g,h,a,b,c,d);
+ ROUND512_0_TO_15(d,e,f,g,h,a,b,c);
+ ROUND512_0_TO_15(c,d,e,f,g,h,a,b);
+ ROUND512_0_TO_15(b,c,d,e,f,g,h,a);
+ } while (j < 16);
+
+ /* Now for the remaining rounds up to 79: */
+ do {
+ ROUND512(a,b,c,d,e,f,g,h);
+ ROUND512(h,a,b,c,d,e,f,g);
+ ROUND512(g,h,a,b,c,d,e,f);
+ ROUND512(f,g,h,a,b,c,d,e);
+ ROUND512(e,f,g,h,a,b,c,d);
+ ROUND512(d,e,f,g,h,a,b,c);
+ ROUND512(c,d,e,f,g,h,a,b);
+ ROUND512(b,c,d,e,f,g,h,a);
+ } while (j < 80);
+
+ /* Compute the current intermediate hash value */
+ context->state[0] += a;
+ context->state[1] += b;
+ context->state[2] += c;
+ context->state[3] += d;
+ context->state[4] += e;
+ context->state[5] += f;
+ context->state[6] += g;
+ context->state[7] += h;
+
+ /* Clean up */
+ a = b = c = d = e = f = g = h = T1 = 0;
+}
+
+#else /* SHA2_UNROLL_TRANSFORM */
+
+void SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) {
+ sha2_word64 a, b, c, d, e, f, g, h, s0, s1;
+ sha2_word64 T1, T2, *W512 = (sha2_word64*)context->buffer;
+ int j;
+
+ /* Initialize registers with the prev. intermediate value */
+ a = context->state[0];
+ b = context->state[1];
+ c = context->state[2];
+ d = context->state[3];
+ e = context->state[4];
+ f = context->state[5];
+ g = context->state[6];
+ h = context->state[7];
+
+ j = 0;
+ do {
+#ifndef WORDS_BIGENDIAN
+ /* Convert TO host byte order */
+ REVERSE64(*data++, W512[j]);
+ /* Apply the SHA-512 compression function to update a..h */
+ T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + W512[j];
+#else
+ /* Apply the SHA-512 compression function to update a..h with copy */
+ T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + (W512[j] = *data++);
+#endif
+ T2 = Sigma0_512(a) + Maj(a, b, c);
+ h = g;
+ g = f;
+ f = e;
+ e = d + T1;
+ d = c;
+ c = b;
+ b = a;
+ a = T1 + T2;
+
+ j++;
+ } while (j < 16);
+
+ do {
+ /* Part of the message block expansion: */
+ s0 = W512[(j+1)&0x0f];
+ s0 = sigma0_512(s0);
+ s1 = W512[(j+14)&0x0f];
+ s1 = sigma1_512(s1);
+
+ /* Apply the SHA-512 compression function to update a..h */
+ T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] +
+ (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0);
+ T2 = Sigma0_512(a) + Maj(a, b, c);
+ h = g;
+ g = f;
+ f = e;
+ e = d + T1;
+ d = c;
+ c = b;
+ b = a;
+ a = T1 + T2;
+
+ j++;
+ } while (j < 80);
+
+ /* Compute the current intermediate hash value */
+ context->state[0] += a;
+ context->state[1] += b;
+ context->state[2] += c;
+ context->state[3] += d;
+ context->state[4] += e;
+ context->state[5] += f;
+ context->state[6] += g;
+ context->state[7] += h;
+
+ /* Clean up */
+ a = b = c = d = e = f = g = h = T1 = T2 = 0;
+}
+
+#endif /* SHA2_UNROLL_TRANSFORM */
+
+void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) {
+ unsigned int freespace, usedspace;
+
+ if (len == 0) {
+ /* Calling with no data is valid - we do nothing */
+ return;
+ }
+
+ /* Sanity check: */
+ assert(context != NULL && data != NULL);
+
+ usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
+ if (usedspace > 0) {
+ /* Calculate how much free space is available in the buffer */
+ freespace = SHA512_BLOCK_LENGTH - usedspace;
+
+ if (len >= freespace) {
+ /* Fill the buffer completely and process it */
+ MEMCPY_BCOPY(&context->buffer[usedspace], data, freespace);
+ ADDINC128(context->bitcount, freespace << 3);
+ len -= freespace;
+ data += freespace;
+ SHA512_Transform(context, (const sha2_word64*)context->buffer);
+ } else {
+ /* The buffer is not yet full */
+ MEMCPY_BCOPY(&context->buffer[usedspace], data, len);
+ ADDINC128(context->bitcount, len << 3);
+ /* Clean up: */
+ usedspace = freespace = 0;
+ return;
+ }
+ }
+ while (len >= SHA512_BLOCK_LENGTH) {
+ /* Process as many complete blocks as we can */
+ SHA512_Transform(context, (const sha2_word64*)data);
+ ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3);
+ len -= SHA512_BLOCK_LENGTH;
+ data += SHA512_BLOCK_LENGTH;
+ }
+ if (len > 0) {
+ /* There's left-overs, so save 'em */
+ MEMCPY_BCOPY(context->buffer, data, len);
+ ADDINC128(context->bitcount, len << 3);
+ }
+ /* Clean up: */
+ usedspace = freespace = 0;
+}
+
+void SHA512_Last(SHA512_CTX* context) {
+ unsigned int usedspace;
+
+ usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
+#ifndef WORDS_BIGENDIAN
+ /* Convert FROM host byte order */
+ REVERSE64(context->bitcount[0],context->bitcount[0]);
+ REVERSE64(context->bitcount[1],context->bitcount[1]);
+#endif
+ if (usedspace > 0) {
+ /* Begin padding with a 1 bit: */
+ context->buffer[usedspace++] = 0x80;
+
+ if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) {
+ /* Set-up for the last transform: */
+ MEMSET_BZERO(&context->buffer[usedspace], SHA512_SHORT_BLOCK_LENGTH - usedspace);
+ } else {
+ if (usedspace < SHA512_BLOCK_LENGTH) {
+ MEMSET_BZERO(&context->buffer[usedspace], SHA512_BLOCK_LENGTH - usedspace);
+ }
+ /* Do second-to-last transform: */
+ SHA512_Transform(context, (const sha2_word64*)context->buffer);
+
+ /* And set-up for the last transform: */
+ MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH - 2);
+ }
+ } else {
+ /* Prepare for final transform: */
+ MEMSET_BZERO(context->buffer, SHA512_SHORT_BLOCK_LENGTH);
+
+ /* Begin padding with a 1 bit: */
+ *context->buffer = 0x80;
+ }
+ /* Store the length of input data (in bits): */
+ *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1];
+ *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0];
+
+ /* Final transform: */
+ SHA512_Transform(context, (const sha2_word64*)context->buffer);
+}
+
+void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
+ sha2_word64 *d = (sha2_word64*)digest;
+
+ /* Sanity check: */
+ assert(context != NULL);
+
+ /* If no digest buffer is passed, we don't bother doing this: */
+ if (digest != (sha2_byte*)0) {
+ SHA512_Last(context);
+
+ /* Save the hash data for output: */
+#ifndef WORDS_BIGENDIAN
+ {
+ /* Convert TO host byte order */
+ int j;
+ for (j = 0; j < 8; j++) {
+ REVERSE64(context->state[j],context->state[j]);
+ *d++ = context->state[j];
+ }
+ }
+#else
+ MEMCPY_BCOPY(d, context->state, SHA512_DIGEST_LENGTH);
+#endif
+ }
+
+ /* Zero out state data */
+ MEMSET_BZERO(context, sizeof(SHA512_CTX));
+}
+
+int SHA512_Equal(SHA512_CTX* pctx1, SHA512_CTX* pctx2) {
+ return memcmp(pctx1->bitcount, pctx2->bitcount, sizeof(pctx1->bitcount)) == 0
+ && memcmp(pctx1->state, pctx2->state, sizeof(pctx1->state)) == 0
+ && memcmp(pctx1->buffer, pctx2->buffer, sizeof(pctx1->buffer)) == 0;
+}
+
+/*** SHA-384: *********************************************************/
+void SHA384_Init(SHA384_CTX* context) {
+ if (context == (SHA384_CTX*)0) {
+ return;
+ }
+ MEMCPY_BCOPY(context->state, sha384_initial_hash_value, SHA512_DIGEST_LENGTH);
+ MEMSET_BZERO(context->buffer, SHA384_BLOCK_LENGTH);
+ context->bitcount[0] = context->bitcount[1] = 0;
+}
+
+void SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) {
+ SHA512_Update((SHA512_CTX*)context, data, len);
+}
+
+void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
+ sha2_word64 *d = (sha2_word64*)digest;
+
+ /* Sanity check: */
+ assert(context != NULL);
+
+ /* If no digest buffer is passed, we don't bother doing this: */
+ if (digest != (sha2_byte*)0) {
+ SHA512_Last((SHA512_CTX*)context);
+
+ /* Save the hash data for output: */
+#ifndef WORDS_BIGENDIAN
+ {
+ /* Convert TO host byte order */
+ int j;
+ for (j = 0; j < 6; j++) {
+ REVERSE64(context->state[j],context->state[j]);
+ *d++ = context->state[j];
+ }
+ }
+#else
+ MEMCPY_BCOPY(d, context->state, SHA384_DIGEST_LENGTH);
+#endif
+ }
+
+ /* Zero out state data */
+ MEMSET_BZERO(context, sizeof(SHA384_CTX));
+}
+
+int SHA384_Equal(SHA384_CTX* pctx1, SHA384_CTX* pctx2) {
+ return memcmp(pctx1->bitcount, pctx2->bitcount, sizeof(pctx1->bitcount)) == 0
+ && memcmp(pctx1->state, pctx2->state, sizeof(pctx1->state)) == 0
+ && memcmp(pctx1->buffer, pctx2->buffer, sizeof(pctx1->buffer)) == 0;
+}
diff --git a/ext/digest/sha2/sha2.h b/ext/digest/sha2/sha2.h
new file mode 100644
index 0000000000..4689ad93ce
--- /dev/null
+++ b/ext/digest/sha2/sha2.h
@@ -0,0 +1,133 @@
+/*
+ * sha2.h
+ *
+ * Version 1.0.0beta1
+ *
+ * Written by Aaron D. Gifford <me@aarongifford.com>
+ *
+ * Copyright 2000 Aaron D. Gifford. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTOR(S) ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTOR(S) BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/* $RoughId: sha2.h,v 1.3 2002/02/24 08:14:32 knu Exp $ */
+/* $Id$ */
+
+#ifndef __SHA2_H__
+#define __SHA2_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "defs.h"
+
+
+/*** SHA-256/384/512 Various Length Definitions ***********************/
+#define SHA256_BLOCK_LENGTH 64
+#define SHA256_DIGEST_LENGTH 32
+#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1)
+#define SHA384_BLOCK_LENGTH 128
+#define SHA384_DIGEST_LENGTH 48
+#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1)
+#define SHA512_BLOCK_LENGTH 128
+#define SHA512_DIGEST_LENGTH 64
+#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
+
+
+/*** SHA-256/384/512 Context Structures *******************************/
+
+typedef struct _SHA256_CTX {
+ uint32_t state[8];
+ uint64_t bitcount;
+ uint8_t buffer[SHA256_BLOCK_LENGTH];
+} SHA256_CTX;
+typedef struct _SHA512_CTX {
+ uint64_t state[8];
+ uint64_t bitcount[2];
+ uint8_t buffer[SHA512_BLOCK_LENGTH];
+} SHA512_CTX;
+
+typedef SHA512_CTX SHA384_CTX;
+
+
+#ifdef RUBY
+#define SHA256_Init rb_Digest_SHA256_Init
+#define SHA256_Update rb_Digest_SHA256_Update
+#define SHA256_Final rb_Digest_SHA256_Final
+#define SHA256_End rb_Digest_SHA256_End
+#define SHA256_Data rb_Digest_SHA256_Data
+#define SHA256_File rb_Digest_SHA256_File
+#define SHA256_Equal rb_Digest_SHA256_Equal
+
+#define SHA384_Init rb_Digest_SHA384_Init
+#define SHA384_Update rb_Digest_SHA384_Update
+#define SHA384_Final rb_Digest_SHA384_Final
+#define SHA384_End rb_Digest_SHA384_End
+#define SHA384_Data rb_Digest_SHA384_Data
+#define SHA384_File rb_Digest_SHA384_File
+#define SHA384_Equal rb_Digest_SHA384_Equal
+
+#define SHA512_Init rb_Digest_SHA512_Init
+#define SHA512_Update rb_Digest_SHA512_Update
+#define SHA512_Final rb_Digest_SHA512_Final
+#define SHA512_End rb_Digest_SHA512_End
+#define SHA512_Data rb_Digest_SHA512_Data
+#define SHA512_File rb_Digest_SHA512_File
+#define SHA512_Equal rb_Digest_SHA512_Equal
+#endif
+
+/*** SHA-256/384/512 Function Prototypes ******************************/
+void SHA256_Init _((SHA256_CTX *));
+void SHA256_Update _((SHA256_CTX*, const uint8_t*, size_t));
+void SHA256_Final _((uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*));
+char* SHA256_End _((SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]));
+char* SHA256_Data _((const uint8_t*, size_t, char[SHA256_DIGEST_STRING_LENGTH]));
+char *SHA256_File _((char *, char *));
+int SHA256_Equal _((SHA256_CTX*, SHA256_CTX*));
+
+void SHA384_Init _((SHA384_CTX*));
+void SHA384_Update _((SHA384_CTX*, const uint8_t*, size_t));
+void SHA384_Final _((uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*));
+char* SHA384_End _((SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]));
+char* SHA384_Data _((const uint8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]));
+char *SHA384_File _((char *, char *));
+int SHA384_Equal _((SHA384_CTX*, SHA384_CTX*));
+
+void SHA512_Init _((SHA512_CTX*));
+void SHA512_Update _((SHA512_CTX*, const uint8_t*, size_t));
+void SHA512_Final _((uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*));
+char* SHA512_End _((SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]));
+char* SHA512_Data _((const uint8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]));
+char *SHA512_File _((char *, char *));
+int SHA512_Equal _((SHA512_CTX*, SHA512_CTX*));
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __SHA2_H__ */
+
diff --git a/ext/digest/sha2/sha2hl.c b/ext/digest/sha2/sha2hl.c
new file mode 100644
index 0000000000..03fde538c3
--- /dev/null
+++ b/ext/digest/sha2/sha2hl.c
@@ -0,0 +1,252 @@
+/* $NetBSD: sha2hl.c,v 1.1 2001/03/12 09:08:40 agc Exp $ */
+/* $RoughId: sha2hl.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
+/* $Id$ */
+
+/*
+ * sha2hl.c
+ * This code includes some functions taken from sha2.c, hence the
+ * following licence reproduction.
+ *
+ * This code is not a verbatim copy, since some routines have been added,
+ * and some bugs have been fixed.
+ *
+ * Version 1.0.0beta1
+ *
+ * Written by Aaron D. Gifford <me@aarongifford.com>
+ *
+ * Copyright 2000 Aaron D. Gifford. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTOR(S) ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTOR(S) BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include "sha2.h"
+
+#ifndef lint
+/* __RCSID("$NetBSD: sha2hl.c,v 1.1 2001/03/12 09:08:40 agc Exp $"); */
+#endif /* not lint */
+
+/* #include "namespace.h" */
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#if defined(HAVE_UNISTD_H)
+# include <unistd.h>
+#endif
+
+#ifndef _DIAGASSERT
+#define _DIAGASSERT(cond) assert(cond)
+#endif
+
+/*
+ * Constant used by SHA256/384/512_End() functions for converting the
+ * digest to a readable hexadecimal character string:
+ */
+static const char sha2_hex_digits[] = "0123456789abcdef";
+
+char *
+SHA256_File(char *filename, char *buf)
+{
+ uint8_t buffer[BUFSIZ * 20];
+ SHA256_CTX ctx;
+ int fd, num, oerrno;
+
+ _DIAGASSERT(filename != NULL);
+ /* XXX: buf may be NULL ? */
+
+ SHA256_Init(&ctx);
+
+ if ((fd = open(filename, O_RDONLY)) < 0)
+ return (0);
+
+ while ((num = read(fd, buffer, sizeof(buffer))) > 0)
+ SHA256_Update(&ctx, buffer, (size_t) num);
+
+ oerrno = errno;
+ close(fd);
+ errno = oerrno;
+ return (num < 0 ? 0 : SHA256_End(&ctx, buf));
+}
+
+
+char *
+SHA256_End(SHA256_CTX *ctx, char buffer[])
+{
+ uint8_t digest[SHA256_DIGEST_LENGTH], *d = digest;
+ uint8_t *ret;
+ int i;
+
+ /* Sanity check: */
+ assert(ctx != NULL);
+
+ if ((ret = buffer) != NULL) {
+ SHA256_Final(digest, ctx);
+
+ for (i = 0; i < SHA256_DIGEST_LENGTH; i++) {
+ *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
+ *buffer++ = sha2_hex_digits[*d & 0x0f];
+ d++;
+ }
+ *buffer = (char) 0;
+ } else {
+ (void) memset(ctx, 0, sizeof(SHA256_CTX));
+ }
+ (void) memset(digest, 0, SHA256_DIGEST_LENGTH);
+ return ret;
+}
+
+char *
+SHA256_Data(const uint8_t * data, size_t len, char *digest)
+{
+ SHA256_CTX ctx;
+
+ SHA256_Init(&ctx);
+ SHA256_Update(&ctx, data, len);
+ return SHA256_End(&ctx, digest);
+}
+
+char *
+SHA384_File(char *filename, char *buf)
+{
+ SHA384_CTX ctx;
+ uint8_t buffer[BUFSIZ * 20];
+ int fd, num, oerrno;
+
+ _DIAGASSERT(filename != NULL);
+ /* XXX: buf may be NULL ? */
+
+ SHA384_Init(&ctx);
+
+ if ((fd = open(filename, O_RDONLY)) < 0)
+ return (0);
+
+ while ((num = read(fd, buffer, sizeof(buffer))) > 0)
+ SHA384_Update(&ctx, buffer, (size_t) num);
+
+ oerrno = errno;
+ close(fd);
+ errno = oerrno;
+ return (num < 0 ? 0 : SHA384_End(&ctx, buf));
+}
+
+char *
+SHA384_End(SHA384_CTX * ctx, char buffer[])
+{
+ uint8_t digest[SHA384_DIGEST_LENGTH], *d = digest;
+ uint8_t *ret;
+ int i;
+
+ /* Sanity check: */
+ assert(ctx != NULL);
+
+ if ((ret = buffer) != NULL) {
+ SHA384_Final(digest, ctx);
+
+ for (i = 0; i < SHA384_DIGEST_LENGTH; i++) {
+ *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
+ *buffer++ = sha2_hex_digits[*d & 0x0f];
+ d++;
+ }
+ *buffer = (char) 0;
+ } else {
+ (void) memset(ctx, 0, sizeof(SHA384_CTX));
+ }
+ (void) memset(digest, 0, SHA384_DIGEST_LENGTH);
+ return ret;
+}
+
+char *
+SHA384_Data(const uint8_t * data, size_t len, char *digest)
+{
+ SHA384_CTX ctx;
+
+ SHA384_Init(&ctx);
+ SHA384_Update(&ctx, data, len);
+ return SHA384_End(&ctx, digest);
+}
+
+char *
+SHA512_File(char *filename, char *buf)
+{
+ SHA512_CTX ctx;
+ uint8_t buffer[BUFSIZ * 20];
+ int fd, num, oerrno;
+
+ _DIAGASSERT(filename != NULL);
+ /* XXX: buf may be NULL ? */
+
+ SHA512_Init(&ctx);
+
+ if ((fd = open(filename, O_RDONLY)) < 0)
+ return (0);
+
+ while ((num = read(fd, buffer, sizeof(buffer))) > 0)
+ SHA512_Update(&ctx, buffer, (size_t) num);
+
+ oerrno = errno;
+ close(fd);
+ errno = oerrno;
+ return (num < 0 ? 0 : SHA512_End(&ctx, buf));
+}
+
+char *
+SHA512_End(SHA512_CTX * ctx, char buffer[])
+{
+ uint8_t digest[SHA512_DIGEST_LENGTH], *d = digest;
+ uint8_t *ret;
+ int i;
+
+ /* Sanity check: */
+ assert(ctx != NULL);
+
+ if ((ret = buffer) != NULL) {
+ SHA512_Final(digest, ctx);
+
+ for (i = 0; i < SHA512_DIGEST_LENGTH; i++) {
+ *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
+ *buffer++ = sha2_hex_digits[*d & 0x0f];
+ d++;
+ }
+ *buffer = (char) 0;
+ } else {
+ (void) memset(ctx, 0, sizeof(SHA512_CTX));
+ }
+ (void) memset(digest, 0, SHA512_DIGEST_LENGTH);
+ return ret;
+}
+
+char *
+SHA512_Data(const uint8_t * data, size_t len, char *digest)
+{
+ SHA512_CTX ctx;
+
+ SHA512_Init(&ctx);
+ SHA512_Update(&ctx, data, len);
+ return SHA512_End(&ctx, digest);
+}
diff --git a/ext/digest/sha2/sha2init.c b/ext/digest/sha2/sha2init.c
new file mode 100644
index 0000000000..4b14031811
--- /dev/null
+++ b/ext/digest/sha2/sha2init.c
@@ -0,0 +1,47 @@
+/* $RoughId: sha2init.c,v 1.3 2001/07/13 20:00:43 knu Exp $ */
+/* $Id$ */
+
+#include "digest.h"
+#include "sha2.h"
+
+#define FOREACH_BITLEN(func) func(256) func(384) func(512)
+
+#define DEFINE_ALGO_METADATA(bitlen) \
+static algo_t sha##bitlen = { \
+ SHA##bitlen##_DIGEST_LENGTH, \
+ sizeof(SHA##bitlen##_CTX), \
+ (hash_init_func_t)SHA##bitlen##_Init, \
+ (hash_update_func_t)SHA##bitlen##_Update, \
+ (hash_end_func_t)SHA##bitlen##_End, \
+ (hash_final_func_t)SHA##bitlen##_Final, \
+ (hash_equal_func_t)SHA##bitlen##_Equal, \
+};
+
+FOREACH_BITLEN(DEFINE_ALGO_METADATA)
+
+void
+Init_sha2()
+{
+ VALUE mDigest, cDigest_Base;
+ ID id_metadata;
+
+#define DECLARE_ALGO_CLASS(bitlen) \
+ VALUE cDigest_SHA##bitlen;
+
+ FOREACH_BITLEN(DECLARE_ALGO_CLASS)
+
+ rb_require("digest.so");
+
+ id_metadata = rb_intern("metadata");
+
+ mDigest = rb_path2class("Digest");
+ cDigest_Base = rb_path2class("Digest::Base");
+
+#define DEFINE_ALGO_CLASS(bitlen) \
+ cDigest_SHA##bitlen = rb_define_class_under(mDigest, "SHA" #bitlen, cDigest_Base); \
+\
+ rb_cvar_set(cDigest_SHA##bitlen, id_metadata, \
+ Data_Wrap_Struct(rb_cObject, 0, 0, &sha##bitlen), Qtrue);
+
+ FOREACH_BITLEN(DEFINE_ALGO_CLASS)
+}
diff --git a/ext/digest/test.sh b/ext/digest/test.sh
new file mode 100644
index 0000000000..6fb07d2177
--- /dev/null
+++ b/ext/digest/test.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# $RoughId: test.sh,v 1.5 2001/07/13 15:38:27 knu Exp $
+# $Id$
+
+RUBY=${RUBY:=ruby}
+MAKE=${MAKE:=make}
+CFLAGS=${CFLAGS:=-Wall}
+
+${RUBY} extconf.rb --with-cflags="${CFLAGS}"
+${MAKE} clean
+${MAKE}
+
+mkdir -p lib/digest
+
+for algo in md5 rmd160 sha1 sha2; do
+ args=--with-cflags="${CFLAGS}"
+
+ if [ $WITH_BUNDLED_ENGINES ]; then
+ args="$args --with-bundled-$algo"
+ fi
+
+ (cd $algo &&
+ ${RUBY} extconf.rb $args;
+ ${MAKE} clean;
+ ${MAKE})
+ ln -sf ../../$algo/$algo.so lib/digest/
+done
+
+${RUBY} -I. -I./lib test.rb
+
+rm lib/digest/*.so
+rmdir lib/digest
diff --git a/ext/dl/.cvsignore b/ext/dl/.cvsignore
new file mode 100644
index 0000000000..6d884b6cec
--- /dev/null
+++ b/ext/dl/.cvsignore
@@ -0,0 +1,8 @@
+Makefile
+mkmf.log
+dlconfig.h
+dlconfig.rb
+*.func
+*.o
+*~
+*.def
diff --git a/ext/dl/depend b/ext/dl/depend
new file mode 100644
index 0000000000..fba3df7a3d
--- /dev/null
+++ b/ext/dl/depend
@@ -0,0 +1,46 @@
+LDSHARED_TEST = $(LDSHARED) $(LDFLAGS) test/test.o -o test/libtest.so $(LOCAL_LIBS)
+
+libtest.so: test/libtest.so
+
+test/libtest.so: test/test.o $(srcdir)/test/libtest.def
+ $(RUBY) -rftools -e 'ARGV.each do|d|File.mkpath(File.dirname(d))end' $@
+ $(LDSHARED_TEST:dl.def=test/libtest.def)
+
+test/test.o: $(srcdir)/test/test.c
+ @$(RUBY) -rftools -e 'File.mkpath(*ARGV)' test
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/test/test.c -o $@
+
+test:: dl.so libtest.so force
+ $(RUBY) -I. -I$(srcdir)/lib $(srcdir)/test/test.rb
+
+force:
+
+.PHONY: force test
+
+allclean: distclean
+ @rm -f $(CLEANFILES) $(DISTCLEANFILES)
+
+$(OBJS): ./dlconfig.h
+
+sym.o: dl.h call.func
+
+dl.o: dl.h callback.func cbtable.func
+
+ptr.o: dl.h
+
+handle.o: dl.h
+
+call.func: $(srcdir)/mkcall.rb ./dlconfig.rb
+ @echo "Generating call.func"
+ @$(RUBY) $(srcdir)/mkcall.rb > $@
+
+callback.func: $(srcdir)/mkcallback.rb ./dlconfig.rb
+ @echo "Generating callback.func"
+ @$(RUBY) $(srcdir)/mkcallback.rb > $@
+
+cbtable.func: $(srcdir)/mkcbtable.rb ./dlconfig.rb
+ @echo "Generating cbtable.func"
+ @$(RUBY) $(srcdir)/mkcbtable.rb > $@
+
+debug:
+ $(MAKE) CPPFLAGS="$(CPPFLAGS) -DDEBUG"
diff --git a/ext/dl/dl.c b/ext/dl/dl.c
new file mode 100644
index 0000000000..22abb754d2
--- /dev/null
+++ b/ext/dl/dl.c
@@ -0,0 +1,714 @@
+/*
+ * $Id$
+ */
+
+#include <ruby.h>
+#include <rubyio.h>
+#include <ctype.h>
+#include "dl.h"
+
+VALUE rb_mDL;
+VALUE rb_eDLError;
+VALUE rb_eDLTypeError;
+
+static VALUE DLFuncTable;
+static void *rb_dl_callback_table[CALLBACK_TYPES][MAX_CALLBACK];
+static ID id_call;
+
+static int
+rb_dl_scan_callback_args(long stack[], const char *proto,
+ int *argc, VALUE argv[])
+{
+ int i;
+ long *sp;
+ VALUE val;
+
+ sp = stack;
+ for (i=1; proto[i]; i++) {
+ switch (proto[i]) {
+ case 'C':
+ {
+ char v;
+ v = (char)(*sp);
+ sp++;
+ val = INT2NUM(v);
+ }
+ break;
+ case 'H':
+ {
+ short v;
+ v = (short)(*sp);
+ sp++;
+ val = INT2NUM(v);
+ }
+ break;
+ case 'I':
+ {
+ int v;
+ v = (int)(*sp);
+ sp++;
+ val = INT2NUM(v);
+ }
+ break;
+ case 'L':
+ {
+ long v;
+ v = (long)(*sp);
+ sp++;
+ val = INT2NUM(v);
+ }
+ break;
+ case 'F':
+ {
+ float v;
+ memcpy(&v, sp, sizeof(float));
+ sp += sizeof(float)/sizeof(long);
+ val = rb_float_new(v);
+ }
+ break;
+ case 'D':
+ {
+ double v;
+ memcpy(&v, sp, sizeof(double));
+ sp += sizeof(double)/sizeof(long);
+ val = rb_float_new(v);
+ }
+ break;
+ case 'P':
+ {
+ void *v;
+ memcpy(&v, sp, sizeof(void*));
+ sp++;
+ val = rb_dlptr_new(v, 0, 0);
+ }
+ break;
+ case 'S':
+ {
+ char *v;
+ memcpy(&v, sp, sizeof(void*));
+ sp++;
+ val = rb_tainted_str_new2(v);
+ }
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unsupported type `%c'", proto[i]);
+ break;
+ }
+ argv[i-1] = val;
+ }
+ *argc = (i - 1);
+
+ return (*argc);
+}
+
+#include "callback.func"
+
+static void
+init_dl_func_table(){
+#include "cbtable.func"
+}
+
+void *
+dlmalloc(size_t size)
+{
+ DEBUG_CODE2({
+ void *ptr;
+
+ printf("dlmalloc(%d)",size);
+ ptr = xmalloc(size);
+ printf(":0x%x\n",ptr);
+ return ptr;
+ },
+ {
+ return xmalloc(size);
+ });
+}
+
+void *
+dlrealloc(void *ptr, size_t size)
+{
+ DEBUG_CODE({
+ printf("dlrealloc(0x%x,%d)\n",ptr,size);
+ });
+ return xrealloc(ptr, size);
+}
+
+void
+dlfree(void *ptr)
+{
+ DEBUG_CODE({
+ printf("dlfree(0x%x)\n",ptr);
+ });
+ xfree(ptr);
+}
+
+char*
+dlstrdup(const char *str)
+{
+ char *newstr;
+
+ newstr = (char*)dlmalloc(strlen(str));
+ strcpy(newstr,str);
+
+ return newstr;
+}
+
+size_t
+dlsizeof(const char *cstr)
+{
+ size_t size;
+ int i, len, n, dlen;
+ char *d;
+
+ len = strlen(cstr);
+ size = 0;
+ for (i=0; i<len; i++) {
+ n = 1;
+ if (isdigit(cstr[i+1])) {
+ dlen = 1;
+ while (isdigit(cstr[i+dlen])) { dlen ++; };
+ dlen --;
+ d = ALLOCA_N(char, dlen + 1);
+ strncpy(d, cstr + i + 1, dlen);
+ d[dlen] = '\0';
+ n = atoi(d);
+ }
+ else{
+ dlen = 0;
+ }
+
+ switch (cstr[i]) {
+ case 'I':
+ DLALIGN(0,size,INT_ALIGN);
+ case 'i':
+ size += sizeof(int) * n;
+ break;
+ case 'L':
+ DLALIGN(0,size,LONG_ALIGN);
+ case 'l':
+ size += sizeof(long) * n;
+ break;
+ case 'F':
+ DLALIGN(0,size,FLOAT_ALIGN);
+ case 'f':
+ size += sizeof(float) * n;
+ break;
+ case 'D':
+ DLALIGN(0,size,DOUBLE_ALIGN);
+ case 'd':
+ size += sizeof(double) * n;
+ break;
+ case 'C':
+ case 'c':
+ size += sizeof(char) * n;
+ break;
+ case 'H':
+ DLALIGN(0,size,SHORT_ALIGN);
+ case 'h':
+ size += sizeof(short) * n;
+ break;
+ case 'P':
+ case 'S':
+ DLALIGN(0,size,VOIDP_ALIGN);
+ case 'p':
+ case 's':
+ size += sizeof(void*) * n;
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unexpected type '%c'", cstr[i]);
+ break;
+ }
+ i += dlen;
+ }
+
+ return size;
+}
+
+static float *
+c_farray(VALUE v, long *size)
+{
+ int i, len;
+ float *ary;
+ VALUE e;
+
+ len = RARRAY(v)->len;
+ *size = sizeof(float) * len;
+ ary = dlmalloc(*size);
+ for (i=0; i < len; i++) {
+ e = rb_ary_entry(v, i);
+ switch (TYPE(e)) {
+ case T_FLOAT:
+ ary[i] = (float)(RFLOAT(e)->value);
+ break;
+ case T_NIL:
+ ary[i] = 0.0;
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unexpected type of the element #%d", i);
+ break;
+ }
+ }
+
+ return ary;
+}
+
+static double *
+c_darray(VALUE v, long *size)
+{
+ int i, len;
+ double *ary;
+ VALUE e;
+
+ len = RARRAY(v)->len;
+ *size = sizeof(double) * len;
+ ary = dlmalloc(*size);
+ for (i=0; i < len; i++) {
+ e = rb_ary_entry(v, i);
+ switch (TYPE(e)) {
+ case T_FLOAT:
+ ary[i] = (double)(RFLOAT(e)->value);
+ break;
+ case T_NIL:
+ ary[i] = 0.0;
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unexpected type of the element #%d", i);
+ break;
+ }
+ }
+
+ return ary;
+}
+
+static long *
+c_larray(VALUE v, long *size)
+{
+ int i, len;
+ long *ary;
+ VALUE e;
+
+ len = RARRAY(v)->len;
+ *size = sizeof(long) * len;
+ ary = dlmalloc(*size);
+ for (i=0; i < len; i++) {
+ e = rb_ary_entry(v, i);
+ switch (TYPE(e)) {
+ case T_FIXNUM:
+ case T_BIGNUM:
+ ary[i] = (long)(NUM2INT(e));
+ break;
+ case T_NIL:
+ ary[i] = 0;
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unexpected type of the element #%d", i);
+ break;
+ }
+ }
+
+ return ary;
+}
+
+static int *
+c_iarray(VALUE v, long *size)
+{
+ int i, len;
+ int *ary;
+ VALUE e;
+
+ len = RARRAY(v)->len;
+ *size = sizeof(int) * len;
+ ary = dlmalloc(*size);
+ for (i=0; i < len; i++) {
+ e = rb_ary_entry(v, i);
+ switch (TYPE(e)) {
+ case T_FIXNUM:
+ case T_BIGNUM:
+ ary[i] = (int)(NUM2INT(e));
+ break;
+ case T_NIL:
+ ary[i] = 0;
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unexpected type of the element #%d", i);
+ break;
+ }
+ }
+
+ return ary;
+}
+
+static short *
+c_harray(VALUE v, long *size)
+{
+ int i, len;
+ short *ary;
+ VALUE e;
+
+ len = RARRAY(v)->len;
+ *size = sizeof(short) * len;
+ ary = dlmalloc(*size);
+ for (i=0; i < len; i++) {
+ e = rb_ary_entry(v, i);
+ switch (TYPE(e)) {
+ case T_FIXNUM:
+ case T_BIGNUM:
+ ary[i] = (short)(NUM2INT(e));
+ break;
+ case T_NIL:
+ ary[i] = 0;
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unexpected type of the element #%d", i);
+ break;
+ }
+ }
+
+ return ary;
+}
+
+static char *
+c_carray(VALUE v, long *size)
+{
+ int i, len;
+ char *ary;
+ VALUE e;
+
+ len = RARRAY(v)->len;
+ *size = sizeof(char) * len;
+ ary = dlmalloc(*size);
+ for (i=0; i < len; i++) {
+ e = rb_ary_entry(v, i);
+ switch (TYPE(e)) {
+ case T_FIXNUM:
+ case T_BIGNUM:
+ ary[i] = (char)(NUM2INT(e));
+ break;
+ case T_NIL:
+ ary[i] = 0;
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unexpected type of the element #%d", i);
+ break;
+ }
+ }
+
+ return ary;
+}
+
+static void *
+c_parray(VALUE v, long *size)
+{
+ int i, len;
+ void **ary;
+ VALUE e, tmp;
+
+ len = RARRAY(v)->len;
+ *size = sizeof(void*) * len;
+ ary = dlmalloc(*size);
+ for (i=0; i < len; i++) {
+ e = rb_ary_entry(v, i);
+ switch (TYPE(e)) {
+ default:
+ tmp = rb_check_string_type(e);
+ if (NIL_P(tmp)) {
+ rb_raise(rb_eDLTypeError, "unexpected type of the element #%d", i);
+ }
+ e = tmp;
+ /* fall through */
+ case T_STRING:
+ rb_check_safe_str(e);
+ {
+ char *str, *src;
+ src = RSTRING(e)->ptr;
+ str = dlstrdup(src);
+ ary[i] = (void*)str;
+ }
+ break;
+ case T_NIL:
+ ary[i] = NULL;
+ break;
+ case T_DATA:
+ if (rb_obj_is_kind_of(e, rb_cDLPtrData)) {
+ struct ptr_data *pdata;
+ Data_Get_Struct(e, struct ptr_data, pdata);
+ ary[i] = (void*)(pdata->ptr);
+ }
+ else{
+ rb_raise(rb_eDLTypeError, "unexpected type of the element #%d", i);
+ }
+ break;
+ }
+ }
+
+ return ary;
+}
+
+void *
+rb_ary2cary(char t, VALUE v, long *size)
+{
+ int len;
+ VALUE val0;
+
+ val0 = rb_check_array_type(v);
+ if(NIL_P(TYPE(val0))) {
+ rb_raise(rb_eDLTypeError, "an array is expected.");
+ }
+ v = val0;
+
+ len = RARRAY(v)->len;
+ if (len == 0) {
+ return NULL;
+ }
+
+ if (!size) {
+ size = ALLOCA_N(long,1);
+ }
+
+ val0 = rb_ary_entry(v,0);
+ switch (TYPE(val0)) {
+ case T_FIXNUM:
+ case T_BIGNUM:
+ switch (t) {
+ case 'C': case 'c':
+ return (void*)c_carray(v,size);
+ case 'H': case 'h':
+ return (void*)c_harray(v,size);
+ case 'I': case 'i':
+ return (void*)c_iarray(v,size);
+ case 'L': case 'l': case 0:
+ return (void*)c_larray(v,size);
+ default:
+ rb_raise(rb_eDLTypeError, "type mismatch");
+ }
+ case T_STRING:
+ return (void*)c_parray(v,size);
+ case T_FLOAT:
+ switch (t) {
+ case 'F': case 'f':
+ return (void*)c_farray(v,size);
+ case 'D': case 'd': case 0:
+ return (void*)c_darray(v,size);
+ }
+ rb_raise(rb_eDLTypeError, "type mismatch");
+ case T_DATA:
+ if (rb_obj_is_kind_of(val0, rb_cDLPtrData)) {
+ return (void*)c_parray(v,size);
+ }
+ rb_raise(rb_eDLTypeError, "type mismatch");
+ case T_NIL:
+ return (void*)c_parray(v, size);
+ default:
+ rb_raise(rb_eDLTypeError, "unsupported type");
+ }
+}
+
+VALUE
+rb_str_to_ptr(VALUE self)
+{
+ char *ptr;
+ int len;
+
+ 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);
+}
+
+VALUE
+rb_ary_to_ptr(int argc, VALUE argv[], VALUE self)
+{
+ void *ptr;
+ VALUE t;
+ long size;
+
+ switch (rb_scan_args(argc, argv, "01", &t)) {
+ case 1:
+ ptr = rb_ary2cary(StringValuePtr(t)[0], self, &size);
+ break;
+ case 0:
+ ptr = rb_ary2cary(0, self, &size);
+ break;
+ }
+ return ptr ? rb_dlptr_new(ptr, size, dlfree) : Qnil;
+}
+
+VALUE
+rb_io_to_ptr(VALUE self)
+{
+ OpenFile *fptr;
+ FILE *fp;
+
+ GetOpenFile(self, fptr);
+ fp = fptr->f;
+
+ return fp ? rb_dlptr_new(fp, sizeof(FILE), 0) : Qnil;
+}
+
+VALUE
+rb_dl_dlopen(int argc, VALUE argv[], VALUE self)
+{
+ rb_secure(4);
+ return rb_class_new_instance(argc, argv, rb_cDLHandle);
+}
+
+VALUE
+rb_dl_malloc(VALUE self, VALUE size)
+{
+ rb_secure(4);
+ return rb_dlptr_malloc(DLNUM2LONG(size), dlfree);
+}
+
+VALUE
+rb_dl_strdup(VALUE self, VALUE str)
+{
+ SafeStringValue(str);
+ return rb_dlptr_new(strdup(RSTRING(str)->ptr), RSTRING(str)->len, dlfree);
+}
+
+static VALUE
+rb_dl_sizeof(VALUE self, VALUE str)
+{
+ return INT2NUM(dlsizeof(StringValuePtr(str)));
+}
+
+static VALUE
+rb_dl_callback(int argc, VALUE argv[], VALUE self)
+{
+ VALUE type, proc;
+ int rettype, entry, i;
+ char fname[127];
+
+ rb_secure(4);
+ proc = Qnil;
+ switch (rb_scan_args(argc, argv, "11", &type, &proc)) {
+ case 1:
+ if (rb_block_given_p()) {
+ proc = rb_block_proc();
+ }
+ else{
+ proc = Qnil;
+ }
+ default:
+ break;
+ }
+
+ StringValue(type);
+ switch (RSTRING(type)->ptr[0]) {
+ case '0':
+ rettype = 0x00;
+ break;
+ case 'C':
+ rettype = 0x01;
+ break;
+ case 'H':
+ rettype = 0x02;
+ break;
+ case 'I':
+ rettype = 0x03;
+ break;
+ case 'L':
+ rettype = 0x04;
+ break;
+ case 'F':
+ rettype = 0x05;
+ break;
+ case 'D':
+ rettype = 0x06;
+ break;
+ case 'P':
+ rettype = 0x07;
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unsupported type `%c'", RSTRING(type)->ptr[0]);
+ }
+
+ entry = -1;
+ for (i=0; i < MAX_CALLBACK; i++) {
+ if (rb_hash_aref(DLFuncTable, rb_assoc_new(INT2NUM(rettype), INT2NUM(i))) == Qnil) {
+ entry = i;
+ break;
+ }
+ }
+ if (entry < 0) {
+ rb_raise(rb_eDLError, "too many callbacks are defined.");
+ }
+
+ rb_hash_aset(DLFuncTable,
+ rb_assoc_new(INT2NUM(rettype),INT2NUM(entry)),
+ rb_assoc_new(type,proc));
+ sprintf(fname, "rb_dl_callback_func_%d_%d", rettype, entry);
+ return rb_dlsym_new((void (*)())rb_dl_callback_table[rettype][entry],
+ fname, RSTRING(type)->ptr);
+}
+
+static VALUE
+rb_dl_remove_callback(VALUE mod, VALUE sym)
+{
+ freefunc_t f;
+ int i, j;
+
+ rb_secure(4);
+ f = rb_dlsym2csym(sym);
+ for (i=0; i < CALLBACK_TYPES; i++) {
+ for (j=0; j < MAX_CALLBACK; j++) {
+ if (rb_dl_callback_table[i][j] == f) {
+ rb_hash_aset(DLFuncTable, rb_assoc_new(INT2NUM(i),INT2NUM(j)),Qnil);
+ break;
+ }
+ }
+ }
+ return Qnil;
+}
+
+void
+Init_dl()
+{
+ void Init_dlptr();
+ void Init_dlsym();
+ void Init_dlhandle();
+
+ id_call = rb_intern("call");
+
+ rb_mDL = rb_define_module("DL");
+
+ rb_eDLError = rb_define_class_under(rb_mDL, "DLError", rb_eStandardError);
+ rb_eDLTypeError = rb_define_class_under(rb_mDL, "DLTypeError", rb_eDLError);
+
+ DLFuncTable = rb_hash_new();
+ init_dl_func_table();
+ rb_define_const(rb_mDL, "FuncTable", DLFuncTable);
+
+ rb_define_const(rb_mDL, "RTLD_GLOBAL", INT2NUM(RTLD_GLOBAL));
+ rb_define_const(rb_mDL, "RTLD_LAZY", INT2NUM(RTLD_LAZY));
+ rb_define_const(rb_mDL, "RTLD_NOW", INT2NUM(RTLD_NOW));
+
+ rb_define_const(rb_mDL, "ALIGN_INT", INT2NUM(ALIGN_INT));
+ rb_define_const(rb_mDL, "ALIGN_LONG", INT2NUM(ALIGN_LONG));
+ rb_define_const(rb_mDL, "ALIGN_FLOAT", INT2NUM(ALIGN_FLOAT));
+ rb_define_const(rb_mDL, "ALIGN_SHORT", INT2NUM(ALIGN_SHORT));
+ rb_define_const(rb_mDL, "ALIGN_DOUBLE",INT2NUM(ALIGN_DOUBLE));
+ rb_define_const(rb_mDL, "ALIGN_VOIDP", INT2NUM(ALIGN_VOIDP));
+
+ rb_define_const(rb_mDL, "MAX_ARG", INT2NUM(MAX_ARG));
+ rb_define_const(rb_mDL, "DLSTACK", rb_tainted_str_new2(DLSTACK_METHOD));
+
+ rb_define_module_function(rb_mDL, "dlopen", rb_dl_dlopen, -1);
+ rb_define_module_function(rb_mDL, "callback", rb_dl_callback, -1);
+ rb_define_module_function(rb_mDL, "define_callback", rb_dl_callback, -1);
+ rb_define_module_function(rb_mDL, "remove_callback", rb_dl_remove_callback, 1);
+ rb_define_module_function(rb_mDL, "malloc", rb_dl_malloc, 1);
+ rb_define_module_function(rb_mDL, "strdup", rb_dl_strdup, 1);
+ rb_define_module_function(rb_mDL, "sizeof", rb_dl_sizeof, 1);
+
+ Init_dlptr();
+ Init_dlsym();
+ Init_dlhandle();
+
+ rb_define_const(rb_mDL, "FREE", rb_dlsym_new(dlfree, "free", "0P"));
+
+ rb_define_method(rb_cString, "to_ptr", rb_str_to_ptr, 0);
+ rb_define_method(rb_cArray, "to_ptr", rb_ary_to_ptr, -1);
+ rb_define_method(rb_cIO, "to_ptr", rb_io_to_ptr, 0);
+}
diff --git a/ext/dl/dl.def b/ext/dl/dl.def
new file mode 100644
index 0000000000..cdab4af90d
--- /dev/null
+++ b/ext/dl/dl.def
@@ -0,0 +1,59 @@
+EXPORTS
+Init_dl
+dlfree
+dlmalloc
+dlrealloc
+dlstrdup
+rb_ary_to_ptr
+rb_dl_dlopen
+rb_dl_malloc
+rb_dl_strdup
+rb_eDLError
+rb_eDLTypeError
+rb_io_to_ptr
+rb_mDL
+rb_str_to_ptr
+Init_dlhandle
+rb_cDLHandle
+rb_dlhandle_close
+rb_dlhandle_disable_close
+rb_dlhandle_enable_close
+rb_dlhandle_sym
+Init_dlptr
+rb_cDLPtrData
+rb_dlmem_each
+rb_dlptr2cptr
+rb_dlptr_malloc
+rb_dlptr_aref
+rb_dlptr_aset
+rb_dlptr_cmp
+rb_dlptr_define_data_type
+rb_dlptr_define_struct
+rb_dlptr_define_union
+rb_dlptr_eql
+rb_dlptr_free_get
+rb_dlptr_free_set
+rb_dlptr_get_data_type
+rb_dlptr_inspect
+rb_dlptr_minus
+rb_dlptr_new
+rb_dlptr_new2
+rb_dlptr_null_p
+rb_dlptr_plus
+rb_dlptr_ptr
+rb_dlptr_ref
+rb_dlptr_to_array
+rb_dlptr_to_i
+rb_dlptr_to_s
+rb_dlptr_to_str
+rb_mDLMemorySpace
+Init_dlsym
+rb_cDLSymbol
+rb_dlsym2csym
+rb_dlsym_call
+rb_dlsym_cproto
+rb_dlsym_inspect
+rb_dlsym_name
+rb_dlsym_new
+rb_dlsym_proto
+rb_dlsym_to_ptr
diff --git a/ext/dl/dl.h b/ext/dl/dl.h
new file mode 100644
index 0000000000..1faa316cf1
--- /dev/null
+++ b/ext/dl/dl.h
@@ -0,0 +1,313 @@
+/* -*- C -*-
+ * $Id$
+ */
+
+#ifndef RUBY_DL_H
+#define RUBY_DL_H
+
+#include <ruby.h>
+#include <dlconfig.h>
+
+#if defined(HAVE_DLFCN_H)
+# include <dlfcn.h>
+# /* some stranger systems may not define all of these */
+#ifndef RTLD_LAZY
+#define RTLD_LAZY 0
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+#ifndef RTLD_NOW
+#define RTLD_NOW 0
+#endif
+#else
+# if defined(HAVE_WINDOWS_H)
+# include <windows.h>
+# define dlclose(ptr) FreeLibrary((HINSTANCE)ptr)
+# define dlopen(name,flag) ((void*)LoadLibrary(name))
+# define dlerror() "unknown error"
+# define dlsym(handle,name) ((void*)GetProcAddress(handle,name))
+# define RTLD_LAZY -1
+# define RTLD_NOW -1
+# define RTLD_GLOBAL -1
+# endif
+#endif
+
+#if !defined(StringValue)
+# define StringValue(v) if(TYPE(v) != T_STRING) v = rb_str_to_str(v)
+#endif
+#if !defined(StringValuePtr)
+# define StringValuePtr(v) RSTRING((TYPE(v) == T_STRING) ? (v) : rb_str_to_str(v))->ptr
+#endif
+
+#ifdef DEBUG
+#define DEBUG_CODE(b) {printf("DEBUG:%d\n",__LINE__);b;}
+#define DEBUG_CODE2(b1,b2) {printf("DEBUG:%d\n",__LINE__);b1;}
+#else
+#define DEBUG_CODE(b)
+#define DEBUG_CODE2(b1,b2) b2
+#endif
+
+#define VOID_DLTYPE 0x00
+#define CHAR_DLTYPE 0x01
+#define SHORT_DLTYPE 0x02
+#define INT_DLTYPE 0x03
+#define LONG_DLTYPE 0x04
+#define FLOAT_DLTYPE 0x05
+#define DOUBLE_DLTYPE 0x06
+#define VOIDP_DLTYPE 0x07
+
+#define ARG_TYPE(x,i) (((x) & (0x07 << ((i)*3))) >> ((i)*3))
+#define PUSH_ARG(x,t) do{x <<= 3; x |= t;}while(0)
+#define PUSH_0(x) PUSH_ARG(x,VOID_DLTYPE)
+
+#if SIZEOF_INT == SIZEOF_LONG
+# define PUSH_I(x) PUSH_ARG(x,LONG_DLTYPE)
+# define ANY2I(x) x.l
+# define DLINT(x) (long)x
+#else
+# define PUSH_I(x) PUSH_ARG(x,INT_DLTYPE)
+# define ANY2I(x) x.i
+# define DLINT(x) (int)x
+#endif
+#define PUSH_L(x) PUSH_ARG(x,LONG_DLTYPE)
+#define ANY2L(x) x.l
+#define DLLONG(x) (long)x
+
+#if defined(WITH_TYPE_FLOAT)
+# if SIZEOF_FLOAT == SIZEOF_DOUBLE
+# define PUSH_F(x) PUSH_ARG(x,DOUBLE_DLTYPE)
+# define ANY2F(x) (x.d)
+# define DLFLOAT(x) ((double)x)
+# else
+# define PUSH_F(x) PUSH_ARG(x,FLOAT_DLTYPE)
+# define ANY2F(x) (x.f)
+# define DLFLOAT(x) ((float)x)
+# endif
+#else
+# define PUSH_F(x) PUSH_ARG(x,DOUBLE_DLTYPE)
+# define ANY2F(x) (x.d)
+# define DLFLOAT(x) ((double)x)
+#endif
+#define PUSH_D(x) PUSH_ARG(x,DOUBLE_DLTYPE)
+#define ANY2D(x) (x.d)
+#define DLDOUBLE(x) ((double)x)
+
+#if SIZEOF_INT == SIZEOF_VOIDP && SIZEOF_INT != SIZEOF_LONG
+# define PUSH_P(x) PUSH_ARG(x,INT_DLTYPE)
+# define ANY2P(x) (x.i)
+# define DLVOIDP(x) ((int)x)
+#elif SIZEOF_LONG == SIZEOF_VOIDP
+# define PUSH_P(x) PUSH_ARG(x,LONG_DLTYPE)
+# define ANY2P(x) (x.l)
+# define DLVOIDP(x) ((long)x)
+#else
+# define PUSH_P(x) PUSH_ARG(x,VOIDP_DLTYPE)
+# define ANY2P(x) (x.p)
+# define DLVOIDP(x) ((void*)p)
+#endif
+
+#if defined(WITH_TYPE_CHAR)
+# define PUSH_C(x) PUSH_ARG(x,CHAR_DLTYPE)
+# define ANY2C(x) (x.c)
+# define DLCHAR(x) ((char)x)
+#else
+# define PUSH_C(x) PUSH_I(x)
+# define ANY2C(x) ANY2I(x)
+# define DLCHAR(x) DLINT(x)
+#endif
+
+#if defined(WITH_TYPE_SHORT)
+# define PUSH_H(x) PUSH_ARG(x,SHORT_DLTYPE)
+# define ANY2H(x) (x.h)
+# define DLSHORT(x) ((short)x)
+#else
+# define PUSH_H(x) PUSH_I(x)
+# define ANY2H(x) ANY2I(x)
+# define DLSHORT(x) DLINT(x)
+#endif
+
+#define PUSH_S(x) PUSH_P(x)
+#define ANY2S(x) ANY2P(x)
+#define DLSTR(x) DLVOIDP(x)
+
+#define CBPUSH_0(x) PUSH_0(x)
+#define CBPUSH_C(x) PUSH_C(x)
+#define CBPUSH_H(x) PUSH_H(x)
+#define CBPUSH_I(x) PUSH_I(x)
+#define CBPUSH_L(x) PUSH_L(x)
+#define CBPUSH_F(x) PUSH_F(x)
+#define CBPUSH_D(x) PUSH_D(x)
+#if defined(WITH_CBTYPE_VOIDP)
+# define CBPUSH_P(x) PUSH_ARG(x,VOIDP_DLTYPE)
+#else
+# define CBPUSH_P(x) PUSH_P(x)
+#endif
+
+
+#if defined(USE_INLINE_ASM)
+# if defined(__i386__) && defined(__GNUC__)
+# define DLSTACK
+# define DLSTACK_METHOD "asm"
+# define DLSTACK_REVERSE
+# define DLSTACK_PROTO
+# define DLSTACK_ARGS
+# define DLSTACK_START(sym)
+# define DLSTACK_END(sym)
+# define DLSTACK_PUSH_C(x) asm volatile ("pushl %0" :: "g" (x));
+# define DLSTACK_PUSH_H(x) asm volatile ("pushl %0" :: "g" (x));
+# define DLSTACK_PUSH_I(x) asm volatile ("pushl %0" :: "g" (x));
+# define DLSTACK_PUSH_L(x) asm volatile ("pushl %0" :: "g" (x));
+# define DLSTACK_PUSH_P(x) asm volatile ("pushl %0" :: "g" (x));
+# define DLSTACK_PUSH_F(x) asm volatile ("flds %0"::"g"(x));\
+ asm volatile ("subl $4,%esp");\
+ asm volatile ("fstps (%esp)");
+# define DLSTACK_PUSH_D(x) asm volatile ("fldl %0"::"g"(x));\
+ asm volatile ("subl $8,%esp");\
+ asm volatile ("fstpl (%esp)")
+# else
+# error --with-asm is not supported on this machine
+# endif
+#elif defined(USE_DLSTACK)
+# define DLSTACK
+# define DLSTACK_GUARD
+# define DLSTACK_METHOD "dl"
+# define DLSTACK_PROTO long,long,long,long,long,\
+ long,long,long,long,long,\
+ long,long,long,long,long
+# define DLSTACK_ARGS stack[0],stack[1],stack[2],stack[3],stack[4],\
+ stack[5],stack[6],stack[7],stack[8],stack[9],\
+ stack[10],stack[11],stack[12],stack[13],stack[14]
+# define DLSTACK_SIZE (sizeof(long)*15)
+# define DLSTACK_START(sym)
+# define DLSTACK_END(sym)
+# define DLSTACK_PUSH_C(x) {long v=(long)x; memcpy(sp,&v,sizeof(long)); sp++;}
+# define DLSTACK_PUSH_H(x) {long v=(long)x; memcpy(sp,&v,sizeof(long)); sp++;}
+# define DLSTACK_PUSH_I(x) {long v=(long)x; memcpy(sp,&v,sizeof(long)); sp++;}
+# define DLSTACK_PUSH_L(x) memcpy(sp,&x,sizeof(long)); sp++;
+# define DLSTACK_PUSH_P(x) memcpy(sp,&x,sizeof(void*)); sp++;
+# define DLSTACK_PUSH_F(x) memcpy(sp,&x,sizeof(float)); sp+=sizeof(float)/sizeof(long);
+# define DLSTACK_PUSH_D(x) memcpy(sp,&x,sizeof(double)); sp+=sizeof(double)/sizeof(long);
+#else
+# define DLSTACK_METHOD "none"
+#endif
+
+extern VALUE rb_mDL;
+extern VALUE rb_mDLMemorySpace;
+extern VALUE rb_cDLHandle;
+extern VALUE rb_cDLSymbol;
+extern VALUE rb_cDLPtrData;
+extern VALUE rb_cDLStructData;
+
+extern VALUE rb_eDLError;
+extern VALUE rb_eDLTypeError;
+
+#if defined(LONG2NUM) && (SIZEOF_LONG == SIZEOF_VOIDP)
+# define DLLONG2NUM(x) LONG2NUM((long)x)
+# define DLNUM2LONG(x) (long)(NUM2LONG(x))
+#else
+# define DLLONG2NUM(x) INT2NUM((long)x)
+# define DLNUM2LONG(x) (long)(NUM2INT(x))
+#endif
+
+typedef struct { char c; void *x; } s_voidp;
+typedef struct { char c; short x; } s_short;
+typedef struct { char c; int x; } s_int;
+typedef struct { char c; long x; } s_long;
+typedef struct { char c; float x; } s_float;
+typedef struct { char c; double x; } s_double;
+
+#define ALIGN_VOIDP (sizeof(s_voidp) - sizeof(void *))
+#define ALIGN_SHORT (sizeof(s_short) - sizeof(short))
+#define ALIGN_INT (sizeof(s_int) - sizeof(int))
+#define ALIGN_LONG (sizeof(s_long) - sizeof(long))
+#define ALIGN_FLOAT (sizeof(s_float) - sizeof(float))
+#define ALIGN_DOUBLE (sizeof(s_double) - sizeof(double))
+
+/* for compatibility */
+#define VOIDP_ALIGN ALIGN_VOIDP
+#define SHORT_ALIGN ALIGN_SHORT
+#define INT_ALIGN ALIGN_INT
+#define LONG_ALIGN ALIGN_LONG
+#define FLOAT_ALIGN ALIGN_FLOAT
+#define DOUBLE_ALIGN ALIGN_DOUBLE
+
+#define DLALIGN(ptr,offset,align) {\
+ while( (((unsigned long)((char *)ptr + offset)) % align) != 0 ) offset++;\
+}
+
+typedef void (*freefunc_t)(void *);
+#define DLFREEFUNC(func) ((freefunc_t)(func))
+
+typedef union {
+ void* p;
+ char c;
+ short h;
+ int i;
+ long l;
+ float f;
+ double d;
+ char *s;
+} ANY_TYPE;
+
+struct dl_handle {
+ void *ptr;
+ int open;
+ int enable_close;
+};
+
+struct sym_data {
+ void *func;
+ char *name;
+ char *type;
+ int len;
+};
+
+enum DLPTR_CTYPE {
+ DLPTR_CTYPE_UNKNOWN,
+ DLPTR_CTYPE_STRUCT,
+ DLPTR_CTYPE_UNION
+};
+
+struct ptr_data {
+ void *ptr; /* a pointer to the data */
+ freefunc_t free; /* free() */
+ char *stype; /* array of type specifiers */
+ int *ssize; /* size[i] = sizeof(type[i]) > 0 */
+ int slen; /* the number of type specifiers */
+ ID *ids;
+ int ids_num;
+ int ctype; /* DLPTR_CTYPE_UNKNOWN, DLPTR_CTYPE_STRUCT, DLPTR_CTYPE_UNION */
+ long size;
+};
+
+#define RDLPTR(obj) ((struct ptr_data *)(DATA_PTR(obj)))
+#define RDLSYM(obj) ((struct sym_data *)(DATA_PTR(obj)))
+
+void dlfree(void*);
+void *dlmalloc(size_t);
+void *dlrealloc(void*,size_t);
+char *dlstrdup(const char *);
+size_t dlsizeof(const char *);
+
+void *rb_ary2cary(char t, VALUE ary, long *size);
+
+/*
+void rb_dlmem_delete(void *ptr);
+void rb_dlmem_aset(void *ptr, VALUE obj);
+VALUE rb_dlmem_aref(void *ptr);
+*/
+
+void dlptr_free(struct ptr_data *data);
+void dlptr_init(VALUE val);
+
+VALUE rb_dlptr_new(void *ptr, long size, freefunc_t func);
+VALUE rb_dlptr_new2(VALUE klass, void *ptr, long size, freefunc_t func);
+VALUE rb_dlptr_malloc(long size, freefunc_t func);
+void *rb_dlptr2cptr(VALUE val);
+
+VALUE rb_dlsym_new(void (*func)(), const char *name, const char *type);
+freefunc_t rb_dlsym2csym(VALUE val);
+
+
+#endif /* RUBY_DL_H */
diff --git a/ext/dl/doc/dl.txt b/ext/dl/doc/dl.txt
new file mode 100644
index 0000000000..893bd21d79
--- /dev/null
+++ b/ext/dl/doc/dl.txt
@@ -0,0 +1,266 @@
+=begin
+
+= Ruby/DL
+
+Ruby/DL provides an interface to the dynamic linker such as dlopen() on UNIX
+and LoadLibrary() on Windows.
+
+= Building and Installing
+
+ $ ruby extconf.rb # to create the Makefile
+ $ make # to build the library 'dl.so'
+ $ make libtest.so # to build the C library 'libtest.so' for the test script
+ $ make test # to run the test script
+ $ make install # to install the library
+ $ make clean # to remove the created files without Makefile
+ $ make distclean # to remove the all created files
+
+= Using Ruby/DL
+
+We should usually use DL::Importable module provided by "dl/import.rb".
+It has high-level functions to access library functions. We use
+DL::Importable module to extend a module as follows:
+
+ require "dl/import"
+ module LIBC
+ extend DL::Importable
+ end
+
+Now we can use methods dlload and extern in this module. We load the
+libraries using dlload, and define wrapper methods to library functions
+using extern respectively as follows:
+
+ module LIBC
+ extend DL::Importable
+ dlload "libc.so.6","libm.so.6"
+ extern "int strlen(char*)"
+ end
+ # Note that we should not include the module LIBC from some reason.
+
+We can call the library function strlen() using LIBC.strlen. If the first
+character of given function name is an uppercase, the first character of the
+defined method name becomes lowercase.
+We can also construct memory images of structures and unions using functions
+struct and union which are defined in "dl/struct.rb" as follows:
+
+ require "dl/import"
+ require "dl/struct"
+ module LIBC
+ extend DL::Importable
+ Timeval = struct [ # define timeval structure.
+ "long tv_sec",
+ "long tv_uses",
+ ]
+ end
+ val = LIBC::Timeval.malloc # allocate memory.
+
+Notice that the above example takes LIBC::Timeval.malloc to allocate memory,
+rather than LIBC::Timeval.new. It is because DL::Timeval.new is for wrapping
+an object, PtrData, which has already been created.
+
+We can define a callback using the module function "callback" as follows:
+
+ module Foo
+ extend DL::Importable
+ def my_comp(str1,str2)
+ str1 <=> str2
+ end
+ COMPARE = callback "int my_comp(char*,char*)"
+ end
+
+where Foo::COMPARE is a Symbol object which invokes the method "my_comp".
+
+DL::Importable module is very useful. However, we sometimes encounter a case
+that we must directly use low-level functions such as dlsym(). In such case,
+we would use DL module functions. They are described in next section.
+
+= DL module
+
+Module DL consists of three classes, a few module functions and constants.
+The class Symbol represents the symbol we can call. The class PtrData
+indicates a memory block such as a pointer in C. An object instantiated from
+the class Handle keeps a handle to opened library.
+
+== Constants
+
+* VERSION
+* MAJOR_VERSION
+* MINOR_VERSION
+* PATCH_VERSION
+* RTLD_GLOBAL
+* RTLD_LAZY
+* RTLD_NOW
+* MAX_ARG
+* MAX_CBARG
+* MAX_CBENT
+
+== Functions
+
+* handle = dlopen(lib){|handle| ... }
+ * is quite equal to `Handle.new(lib)'
+
+* sym = set_callback(cbtype, entry){|args| ... }
+* sym = set_callback(cbtype, entry, proc)
+ * makes entry-th pre-defined function to call the proc or given block. the
+ entry-th pre-defined function is specified by cbtype and entry. cbtype is a
+ prototype of the callback. see also the section `Type specifiers' about
+ cbtype.
+
+* sym = get_callback(cbtype, entry)
+ * returns the Proc object which is given by the above function
+ `set_callback'.
+
+* ptr = malloc(size, [free = nil])
+ * allocates the size bytes, and returns the pointer as a PtrData object ptr.
+
+* ptr = strdup(str)
+ * returns a PtrData object ptr which represents the pointer to a new string
+ which is a duplicate of the string str.
+
+* size = sizeof(type)
+ * returns the size of type. `sizeof("C") + sizeof("L")' is not equal to
+ `sizeof("CL")'. the latter is assumed to returns the enough size of the
+ structure `struct foo { char c; long l; }', but the size may not equal to
+ `sizeof(foo)' of C.
+
+== Handle class
+
+* handle = Handle.new(lib){|handle| ... }
+ * opens a library lib and returns a Handle object handle. if a block is
+ given, the handle is automatically closed as the block ends.
+
+* Handle#close
+ * closes the handle opened by the above Handle.new(lib).
+
+* sym = Handle#sym(func, prototype = "0"),
+ sym = Handle#[func, prototype = nil]
+
+ * obtains the pointer to a function called func and returns a Symbol object
+ or a DataPtr object. prototype is a string which consists of type
+ specifiers, it indicates the function's prototype. see also the section
+ `Type specifiers'.
+
+== Symbol class
+
+* sym = Symbol.new(addr, type = nil, name = nil)
+ * creates the Symbol object sym with the type type if type is not nil. addr
+ is the address where the function is allocated. If type is nil, it returns
+ a DataPtr object.
+
+* Symbol::char2type(char)
+ * takes a character char that represents a type and returns the type
+ specifier of the C language.
+
+* str = Symbol#proto()
+ * returns the function prototype.
+
+* str = Symbol#name()
+ * Returns the function name.
+
+* str = Symbol#cproto(),
+ str = Symbol#to_s()
+ * returns the prototype of the C language.
+
+* str = Symbol#inspect()
+ * returns the inspectable string.
+
+* r,rs = Symbol#call(arg1,arg2,...,argN),
+ r,rs = Symbol#[](arg1,arg2,...,argN)
+ * calls the function with parameters arg1, arg2, ..., argN. and the result
+ consists of the return value r and parameters rs. rs is an array.
+
+* ptr = Symbol#to_ptr
+ * returns the corresponding PtrData object ptr.
+
+== PtrData class
+
+* ptr = PtrData.new(addr, [size = 0, free = nil])
+ * returns the PtrData object representing the pointer which indicates the
+ address addr. GC frees the memory using the free function.
+
+* PtrData#free=(sym)
+ * If you specify a symbol object sym, GC frees the memory using the function
+ represented by sym.
+
+* sym = PtrData#free
+ * returns a symbol object sym which is used when GC frees the memory. it
+ usually configured by `PtrData#free=' or `PtrData.new'.
+
+* size = PtrData#size, PtrData#size=(size)
+ * gets and sets allocated size of the memory.
+
+* ary = PtrData#to_a(type, [size])
+ * returns an array of the type which specified with type. type must be one of
+ 'S','P','I','L','D' and 'F'.
+
+* str = PtrData#to_s([len])
+ * returns a string which length is len. if len is omitted, the end of the
+ string is '\0'.
+
+* ptr = PtrData#ptr,+@
+ * returns the pointed value as a PtrData object ptr.
+
+* ptr = PtrData#ref,-@
+ * returns the reference as a PtrData object ptr.
+
+* ptr = PtrData#+
+ * returns the PtrData object
+
+* ptr = PtrData#-
+ * returns the PtrData object
+
+* PtrData#struct!(type, *members)
+ * defines the data type to get access to a structure member with a symbol.
+ (see also PtrData#[])
+
+* PtrData#union!(type, *members)
+ * defines the data type to get access to a union member with a symbol. (see
+ also PtrData#[])
+
+* val = PtrData#[key], PtrData#[key, num = 0]
+ * if the key is a string or symbol, this method returns the value of the
+ structure/union member which has the type defined by PtrData#
+ {struct!,union!}. if the key is a integer value and this object represents
+ the pointer ptr, it returns the value of `(ptr + key).to_s(num)'
+
+* PtrData#[key,num]=val, PtrData#[key]=val
+ * if the key is a string or symbol, this method substitute the value of the
+ structure/union member with val. if the key is a integer value and val is a
+ string, this method copies num bytes of val to the memory area ptr using
+ memcpy(3).
+
+== Type specifiers
+
+the prototype consists of the following type specifiers, first element of
+prototype represents the type of return value, and remaining elements represent
+the type of each argument.
+
+ C : char
+ c : char *
+ H : short
+ h : short *
+ I : int
+ i : int *
+ L : long
+ l : long *
+ F : float
+ f : float *
+ D : double
+ d : double *
+ S : const char *
+ s : char *
+ A : const type[]
+ a : type[] (allocates new memory space)
+ P : void * (same as 'p')
+ p : void * (same as 'P')
+ 0 : void function (this must be a first character of the prototype)
+
+the cbtype consists of type specifiers 0, C, I, H, L, F, D, S and P.
+for example:
+
+ DL.callback('IPP'){|ptr1,ptr2|
+ str1 = ptr1.ptr.to_s
+ str2 = ptr2.ptr.to_s
+ str1 <=> str2
+ }
+=end
diff --git a/ext/dl/extconf.rb b/ext/dl/extconf.rb
new file mode 100644
index 0000000000..beb15ab04c
--- /dev/null
+++ b/ext/dl/extconf.rb
@@ -0,0 +1,193 @@
+require 'mkmf'
+
+begin # for the exception SystemExit
+
+$:.unshift File.dirname(__FILE__)
+require 'type'
+
+if( ARGV.include?("--help") )
+ print <<EOF
+ --help print this messages
+ --with-type-char strictly use type 'char'
+ --with-type-short strictly use type 'short'
+ --with-type-float strictly use type 'float'
+ --with-args=<max_arg>
+ --with-callback=<max_callback>
+ --enable-asm use the embedded assembler for passing arguments.
+ (this option is available for i386 machine now.)
+ --enable-dlstack use a stack emulation for constructing function call.
+EOF
+ exit(0)
+end
+
+($CPPFLAGS || $CFLAGS) << " -I."
+
+if (Config::CONFIG['CC'] =~ /gcc/) # from Win32API
+ $CFLAGS << " -fno-defer-pop -fno-omit-frame-pointer"
+end
+
+$with_dlstack ||= true
+$with_asm = ! $with_dlstack
+
+$with_type_int = try_cpp(<<EOF)
+#include "config.h"
+#if SIZEOF_INT == SIZEOF_LONG
+#error int not needed
+#endif
+EOF
+
+$with_type_float = try_cpp(<<EOF)
+#include "config.h"
+#if SIZEOF_FLOAT == SIZEOF_DOUBLE
+#error float not needed
+#endif
+EOF
+
+$with_type_voidp = try_cpp(<<EOF)
+#include "config.h"
+#if SIZEOF_VOIDP == SIZEOF_INT || SIZEOF_VOIDP == SIZEOF_LONG
+#error void* not needed
+#endif
+EOF
+
+$with_type_char = DLTYPE[CHAR][:sym]
+$with_type_short = DLTYPE[SHORT][:sym]
+$with_type_long = DLTYPE[LONG][:sym]
+$with_type_double= DLTYPE[DOUBLE][:sym]
+$with_type_int &= DLTYPE[INT][:sym]
+$with_type_float &= DLTYPE[FLOAT][:sym]
+$with_type_voidp &= DLTYPE[VOIDP][:sym]
+
+$with_type_char = enable_config("type-char", $with_type_char)
+$with_type_short = enable_config("type-short", $with_type_short)
+$with_type_float = enable_config("type-float", $with_type_float)
+
+$with_asm = enable_config("asm", $with_asm)
+$with_dlstack = enable_config("dlstack", $with_dlstack)
+
+args = with_config("args")
+max_arg = nil
+if( $with_asm || $with_dlstack )
+ $with_type_char = true
+ $with_type_short = true
+ $with_type_float = true
+ max_arg = 0
+end
+if( args )
+ max_arg = args.to_i
+ if( !max_arg )
+ print("--with-args=<max_arg>\n")
+ exit(1)
+ end
+end
+max_arg ||= 6
+
+max_callback = with_config("callback","10").to_i
+callback_types = DLTYPE.keys.length
+
+
+$dlconfig_h = <<EOF
+#define MAX_ARG #{max_arg}
+EOF
+
+def dlc_define(const)
+ $dlconfig_h << "#if !defined(#{const})\n" +
+ "# define #{const}\n" +
+ "#endif\n"
+end
+
+$dlconfig_h << "#define MAX_CALLBACK #{max_callback}\n"
+$dlconfig_h << "#define CALLBACK_TYPES #{callback_types}\n"
+if( $with_dlstack )
+ $dlconfig_h << "#define USE_DLSTACK\n"
+else
+ if( $with_asm )
+ $dlconfig_h << "#define USE_INLINE_ASM\n"
+ end
+end
+if( $with_type_char )
+ $dlconfig_h << "#define WITH_TYPE_CHAR\n"
+end
+if( $with_type_short )
+ $dlconfig_h << "#define WITH_TYPE_SHORT\n"
+end
+if( $with_type_long )
+ $dlconfig_h << "#define WITH_TYPE_LONG\n"
+end
+if( $with_type_double )
+ $dlconfig_h << "#define WITH_TYPE_DOUBLE\n"
+end
+if( $with_type_float )
+ $dlconfig_h << "#define WITH_TYPE_FLOAT\n"
+end
+if( $with_type_int )
+ $dlconfig_h << "#define WITH_TYPE_INT\n"
+end
+if( $with_type_voidp )
+ $dlconfig_h << "#define WITH_TYPE_VOIDP\n"
+end
+
+if( have_header("windows.h") )
+ have_library("kernel32")
+ have_func("GetLastError", "windows.h")
+ dlc_define("HAVE_WINDOWS_H")
+ have_windows_h = true
+end
+
+if( have_header("dlfcn.h") )
+ dlc_define("HAVE_DLFCN_H")
+ have_library("dl")
+ have_func("dlopen")
+ have_func("dlclose")
+ have_func("dlsym")
+ if( have_func("dlerror") )
+ dlc_define("HAVE_DLERROR")
+ end
+elsif ( have_windows_h )
+ have_func("LoadLibrary")
+ have_func("FreeLibrary")
+ have_func("GetProcAddress")
+else
+ exit(0)
+end
+
+def File.update(file, str)
+ begin
+ open(file){|f|f.read} == str
+ rescue Errno::ENOENT
+ false
+ end or open(file, "w"){|f|f.print(str)}
+end
+
+File.update("dlconfig.h", <<EOF)
+#ifndef DLCONFIG_H
+#define DLCONFIG_H
+#{$dlconfig_h}
+#endif /* DLCONFIG_H */
+EOF
+
+File.update("dlconfig.rb", <<EOF)
+MAX_ARG = #{max_arg}
+MAX_CALLBACK = #{max_callback}
+CALLBACK_TYPES = #{callback_types}
+DLTYPE[CHAR][:sym] = #{$with_type_char}
+DLTYPE[SHORT][:sym] = #{$with_type_short}
+DLTYPE[INT][:sym] = #{$with_type_int}
+DLTYPE[LONG][:sym] = #{$with_type_long}
+DLTYPE[FLOAT][:sym] = #{$with_type_float}
+DLTYPE[DOUBLE][:sym]= #{$with_type_double}
+DLTYPE[VOIDP][:sym] = #{$with_type_voidp}
+EOF
+
+$INSTALLFILES = [
+ ["./dlconfig.h", "$(archdir)$(target_prefix)", "."],
+ ["dl.h", "$(archdir)$(target_prefix)", ""],
+]
+$cleanfiles = %w[test/test.o]
+$distcleanfiles = %w[call.func callback.func cbtable.func dlconfig.rb
+./dlconfig.h test/libtest.so test/*~ *~ mkmf.log]
+
+create_makefile('dl')
+rescue SystemExit
+ # do nothing
+end
diff --git a/ext/dl/h2rb b/ext/dl/h2rb
new file mode 100644
index 0000000000..00fbd60c82
--- /dev/null
+++ b/ext/dl/h2rb
@@ -0,0 +1,500 @@
+#!/usr/bin/env ruby
+# -*- ruby -*-
+# $Id$
+
+require 'mkmf'
+require 'ftools'
+
+$recursive = false
+$force = false
+$conly = true
+$inc_path = []
+$infilename= nil
+$insert_require = true
+
+def valid_ruby_code?(code)
+ begin
+ eval("BEGIN {return true}; #{code}")
+ rescue SyntaxError
+ return false
+ end
+ return false
+end
+
+def print_usage
+ print <<EOF
+h2rb [-r] [-I <path>] [-d] [<filename>]
+EOF
+end
+
+while( ARGV[0] )
+ case( ARGV[0] )
+ when "-r"
+ ARGV.shift
+ $recursive = true
+ when "-R"
+ ARGV.shift
+ $recursive = false
+ when "-l"
+ ARGV.shift
+ $insert_require = true
+ when "-L"
+ ARGV.shift
+ $insert_require = false
+ when "-c"
+ ARGV.shift
+ $conly = true
+ when "-C"
+ ARGV.shift
+ $conly = false
+ when "-f"
+ ARGV.shift
+ $force = true
+ when "-F"
+ ARGV.shift
+ $force = false
+ when "-I"
+ ARGV.shift
+ $inc_path << ARGV.shift
+ when "-d"
+ ARGV.shift
+ $DEBUG = true
+ when "-h","--help"
+ print_usage()
+ exit 0
+ when /-.*/
+ $stderr.print("unknown option '#{ARGV[0]}'.\n")
+ print_usage()
+ exit 0
+ else
+ $infilename = ARGV.shift
+ end
+end
+
+$inc_dir = File.join(CONFIG["prefix"], "lib", "ruby",
+ CONFIG["MAJOR"] + "." + CONFIG["MINOR"],
+ "dl")
+
+class H2RBError < StandardError; end
+
+
+class H2RB
+ def initialize(inc_dir = nil, inc_path = nil, insert_require = nil)
+ @inc_path = inc_path || []
+ @inc_dir = inc_dir || '.'
+ @indent = 0
+ @parsed_files = []
+ @insert_require = insert_require || false
+ end
+
+ def find_path(file)
+ if( ! file )
+ return nil
+ end
+ if( File.exist?(file) )
+ if( file[0] == ?/ )
+ return file
+ else
+ return file
+ end
+ end
+ @inc_path.each{|path|
+ full = File.join(path, file)
+ if( File.exist?(full) )
+ return full
+ end
+ }
+ return nil
+ end
+
+ def strip_comment(line)
+ if( @commented )
+ if( e = line.index("*/") )
+ line[0..(e+1)] = ""
+ @commented = false
+ else
+ line = ""
+ end
+ else
+ if( s = line.index("/*") )
+ if( e = line.index("*/") )
+ line[s..(e+1)] = ""
+ else
+ line[s..-1] = ""
+ @commented = true
+ end
+ elsif( s = line.index("//") )
+ line[s..(-1)] = ""
+ end
+ end
+
+ line.gsub!(/\s+$/,"")
+ return line
+ end
+
+ def up_indent
+ @indent += 1
+ end
+
+ def down_indent
+ @indent -= 1
+ if( @indent < 0 )
+ raise
+ end
+ end
+
+ def indent
+ " " * @indent
+ end
+
+ def rescue_begin
+ line = "#{indent}begin"
+ up_indent
+ return line
+ end
+
+ def rescue_nameerror
+ down_indent
+ line = [
+ "#{indent}rescue NameError => e",
+ "#{indent} raise e if( $DEBUG )",
+ "#{indent}end"].join($/)
+ return line
+ end
+
+ def parse_enum(line)
+ if( line =~ /enum\s+(\S+\s+)?\{(.+)\}/ )
+ enum_name = $1
+ enum_block = $2
+ if( enum_name )
+ line = "#{indent}# -- enum #{enum_name}\n"
+ else
+ line = "#{indent}# -- enum\n"
+ end
+ enums = enum_block.split(/,/).collect{|e| e.strip}
+ i = 0
+ enums.each{|elem|
+ var,val = elem.split(/=/).collect{|e| e.strip}
+ if( val )
+ i = val.to_i
+ end
+ line += "#{indent}#{var} = #{i.to_s}\n"
+ i += 1
+ }
+ line += "#{indent}# -- end of enum"
+ return line
+ else
+ return nil
+ end
+ end
+
+ def parse_define(line)
+ case line
+ when /^#\s*define\s+(\S+)\(\)/
+ line = nil
+ when /^#\s*define\s+(\S+)\((.+)\)\s+(.+)$/
+ if( @conly )
+ line = nil
+ else
+ defname = $1
+ defargs = $2
+ defval = $3
+ if( !valid_ruby_code?(defval) )
+ defval = "nil # #{defval}"
+ end
+ if( defname[0,1] =~ /^[A-Z]$/ )
+ line = "#{indent}#{defname} = proc{|#{defargs}| #{defval}}"
+ else
+ line = [
+ "#{indent}def #{defname}(#{defargs})",
+ "#{indent} #{defval}",
+ "#{indent}end"
+ ].join("\n")
+ end
+ end
+ when /^#\s*define\s+(\S+)\((.+)\)$/
+ if( @conly )
+ line = nil
+ else
+ defname = $1
+ defargs = $2
+ defval = nil
+ if( !valid_ruby_code?(defval) )
+ defval = "nil # #{defval}"
+ end
+ if( defname[0,1] =~ /^[A-Z]$/ )
+ line = "#{indent}#{defname} = proc{|#{defargs}| #{defval}}"
+ else
+ line = [
+ "#{indent}def #{defname}(#{defargs})",
+ "#{indent} #{defval}",
+ "#{indent}end"
+ ].join("\n")
+ end
+ end
+ when /^#\s*define\s+(\S+)\s+(.+)$/
+ defname = $1
+ defval = $2
+ if( !valid_ruby_code?(defval) )
+ defval = "nil # #{defval}"
+ end
+ line = [rescue_begin, "#{indent}#{defname} = #{defval}", rescue_nameerror].join($/)
+ when /^#\s*define\s+(\S+)$/
+ defname = $1
+ line = "#{indent}#{defname} = nil"
+ else
+ line = nil
+ end
+ return line
+ end
+
+ def parse_undef(line)
+ case line
+ when /^#\s*undef\s+([A-Z]\S+)$/
+ defname = $1
+ line = "#{indent}remove_const(:#{defname})"
+ when /^#\s*undef\s+(\S+)$/
+ defname = $1
+ line = "#{indent}#{defname} = nil"
+ else
+ line = nil
+ end
+ return line
+ end
+
+ def parse_ifdef(line)
+ case line
+ when /^#\s*ifdef\s+(\S+)$/
+ defname = $1
+ line = [
+ rescue_begin,
+ "#{indent}if( defined?(#{defname}) && ! #{defname}.nil? )"].join($/)
+ else
+ line = nil
+ end
+ return line
+ end
+
+ def parse_ifndef(line)
+ case line
+ when /^#\s*ifndef\s+(\S+)$/
+ defname = $1
+ line = [
+ rescue_begin,
+ "#{indent}if( ! defined?(#{defname}) || #{defname}.nil? )"].join($/)
+ else
+ line = nil
+ end
+ return line
+ end
+
+ def parse_if(line)
+ case line
+ when /^#\s*if\s+(.+)$/
+ cond = $1
+ cond.gsub!(/defined(.+)/){ "defined?(#{$1}) && ! #{$1}.nil?" }
+ if( valid_ruby_code?(cond) )
+ line = "#{indent}if( #{cond} )"
+ else
+ line = "#{indent}if( false ) # #{cond}"
+ end
+ line = [rescue_begin, line].join($/)
+ else
+ line = nil
+ end
+ return line
+ end
+
+ def parse_elif(line)
+ case line
+ when /^#\s*elif\s+(.+)$/
+ cond = $1
+ cond.gsub!("defined","defined?")
+ line = "#{indent}elsif( #{cond} )"
+ else
+ line = nil
+ end
+ return line
+ end
+
+ def parse_else(line)
+ case line
+ when /^#\s*else\s*/
+ line = "#{indent}else"
+ else
+ line = nil
+ end
+ return line
+ end
+
+ def parse_endif(line)
+ case line
+ when /^#\s*endif\s*$/
+ line = ["#{indent}end", rescue_nameerror].join($/)
+ else
+ line = nil
+ end
+ return line
+ end
+
+ def parse_include(line)
+ if( ! @insert_require )
+ return nil
+ end
+
+ file = nil
+ case line
+ when /^#\s*include "(.+)"$/
+ file = $1
+ line = "#{indent}require '#{file}'"
+ when /^#\s*include \<(.+)\>$/
+ file = $1
+ line = "#{indent}require '#{file}'"
+ else
+ line = nil
+ end
+ if( @recursive && file && (!@parsed_files.include?(file)) )
+ parse(file, @recursive, @force, @conly)
+ end
+ return line
+ end
+
+
+ def open_files(infilename)
+ if( ! infilename )
+ return [$stdin, $stdout]
+ end
+
+ old_infilename = infilename
+ infilename = find_path(infilename)
+ if( ! infilename )
+ $stderr.print("'#{old_infilename}' was not found.\n")
+ return [nil,nil]
+ end
+
+ if( infilename )
+ if( infilename[0,1] == '/' )
+ outfilename = File.join(@inc_dir, infilename[1..-1] + ".rb")
+ else
+ outfilename = infilename + ".rb"
+ end
+ File.mkpath(File.dirname(outfilename))
+ else
+ outfilename = nil
+ end
+
+ if( infilename )
+ fin = File.open(infilename,"r")
+ else
+ fin = $stdin
+ end
+ if( outfilename )
+ if( File.exist?(outfilename) && (!@force) )
+ $stderr.print("'#{outfilename}' have already existed.\n")
+ return [fin, nil]
+ end
+ fout = File.open(outfilename,"w")
+ else
+ fout = $stdout
+ end
+
+ $stderr.print("#{infilename} -> #{outfilename}\n")
+ if( fout )
+ dir = File.dirname(outfilename)
+ if( dir[0,1] != "." && dir != "" )
+ fout.print("if( ! $LOAD_PATH.include?('#{dir}') )\n",
+ " $LOAD_PATH.push('#{dir}')\n",
+ "end\n")
+ end
+ end
+ return [fin,fout]
+ end
+
+ def parse(infilename = nil, recursive = false, force = false, conly = false)
+ @commented = false
+ @recursive = recursive
+ @force = force
+ @conly = conly
+ @parsed_files << infilename
+
+ fin,fout = open_files(infilename)
+ if( !fin )
+ return
+ end
+
+ begin
+ line_number = 0
+ pre_line = nil
+ fin.each_line{|line|
+ line_number += 1
+ line.chop!
+ if( $DEBUG )
+ $stderr.print("#{line_number}:(#{@indent}):", line, "\n")
+ end
+
+ if( pre_line )
+ line = pre_line + line
+ pre_line = nil
+ end
+
+ if( line[-1,1] == "\\" )
+ pre_line = line[0..-2]
+ next
+ end
+
+ if( eidx = line.index("enum ") )
+ pre_line = line[eidx .. -1]
+ if( i = line.index("{") && j = line.index("}") )
+ line = line[0..j]
+ pre_line = nil
+ else
+ next
+ end
+ end
+
+ line = strip_comment(line)
+ case line
+ when /^enum\s/
+ line = parse_enum(line)
+ when /^#\s*define\s/
+ line = parse_define(line)
+ when /^#\s*undef\s/
+ line = parse_undef(line)
+ when /^#\s*ifdef\s/
+ line = parse_ifdef(line)
+ up_indent
+ when /^#\s*ifndef\s/
+ line = parse_ifndef(line)
+ up_indent
+ when /^#\s*if\s/
+ line = parse_if(line)
+ up_indent
+ when /^#\s*elif\s/
+ down_indent
+ line = parse_elif(line)
+ up_indent
+ when /^#\s*else/
+ down_indent
+ line = parse_else(line)
+ up_indent
+ when /^#\s*endif/
+ down_indent
+ line = parse_endif(line)
+ when /^#\s*include\s/
+ line = parse_include(line)
+ else
+ line = nil
+ end
+ if( line && fout )
+ fout.print(line, " # #{line_number}",$/)
+ end
+ }
+ ensure
+ fin.close if fin
+ fout.close if fout
+ end
+ end
+end
+
+h2rb = H2RB.new($inc_dir, $inc_path, $insert_require)
+h2rb.parse($infilename, $recursive, $force, $conly)
diff --git a/ext/dl/handle.c b/ext/dl/handle.c
new file mode 100644
index 0000000000..95b6dc74dc
--- /dev/null
+++ b/ext/dl/handle.c
@@ -0,0 +1,215 @@
+/* -*- C -*-
+ * $Id$
+ */
+
+#include <ruby.h>
+#include "dl.h"
+
+VALUE rb_cDLHandle;
+
+void
+dlhandle_free(struct dl_handle *dlhandle)
+{
+ if (dlhandle->ptr && dlhandle->open && dlhandle->enable_close) {
+ dlclose(dlhandle->ptr);
+ }
+}
+
+VALUE
+rb_dlhandle_close(VALUE self)
+{
+ struct dl_handle *dlhandle;
+
+ Data_Get_Struct(self, struct dl_handle, dlhandle);
+ dlhandle->open = 0;
+ return INT2NUM(dlclose(dlhandle->ptr));
+}
+
+VALUE
+rb_dlhandle_s_allocate(VALUE klass)
+{
+ VALUE obj;
+ struct dl_handle *dlhandle;
+
+ obj = Data_Make_Struct(rb_cDLHandle, struct dl_handle, 0,
+ dlhandle_free, dlhandle);
+ dlhandle->ptr = 0;
+ dlhandle->open = 0;
+ dlhandle->enable_close = 0;
+
+ return obj;
+}
+
+VALUE
+rb_dlhandle_initialize(int argc, VALUE argv[], VALUE self)
+{
+ void *ptr;
+ struct dl_handle *dlhandle;
+ VALUE lib, flag;
+ char *clib;
+ int cflag;
+ const char *err;
+
+ switch (rb_scan_args(argc, argv, "11", &lib, &flag)) {
+ case 1:
+ clib = NIL_P(lib) ? NULL : StringValuePtr(lib);
+ cflag = RTLD_LAZY | RTLD_GLOBAL;
+ break;
+ case 2:
+ clib = NIL_P(lib) ? NULL : StringValuePtr(lib);
+ cflag = NUM2INT(flag);
+ break;
+ default:
+ rb_bug("rb_dlhandle_new");
+ }
+
+ ptr = dlopen(clib, cflag);
+#if defined(HAVE_DLERROR)
+ if (!ptr && (err = dlerror())) {
+ rb_raise(rb_eRuntimeError, err);
+ }
+#else
+ if (!ptr) {
+ err = dlerror();
+ rb_raise(rb_eRuntimeError, err);
+ }
+#endif
+ Data_Get_Struct(self, struct dl_handle, dlhandle);
+ if (dlhandle->ptr && dlhandle->open && dlhandle->enable_close) {
+ dlclose(dlhandle->ptr);
+ }
+ dlhandle->ptr = ptr;
+ dlhandle->open = 1;
+ dlhandle->enable_close = 0;
+
+ if (rb_block_given_p()) {
+ rb_ensure(rb_yield, self, rb_dlhandle_close, self);
+ }
+
+ return Qnil;
+}
+
+VALUE
+rb_dlhandle_enable_close(VALUE self)
+{
+ struct dl_handle *dlhandle;
+
+ Data_Get_Struct(self, struct dl_handle, dlhandle);
+ dlhandle->enable_close = 1;
+ return Qnil;
+}
+
+VALUE
+rb_dlhandle_disable_close(VALUE self)
+{
+ struct dl_handle *dlhandle;
+
+ Data_Get_Struct(self, struct dl_handle, dlhandle);
+ dlhandle->enable_close = 0;
+ return Qnil;
+}
+
+VALUE
+rb_dlhandle_to_i(VALUE self)
+{
+ struct dl_handle *dlhandle;
+
+ Data_Get_Struct(self, struct dl_handle, dlhandle);
+ return DLLONG2NUM(dlhandle);
+}
+
+VALUE
+rb_dlhandle_to_ptr(VALUE self)
+{
+ struct dl_handle *dlhandle;
+
+ Data_Get_Struct(self, struct dl_handle, dlhandle);
+ return rb_dlptr_new(dlhandle, sizeof(dlhandle), 0);
+}
+
+VALUE
+rb_dlhandle_sym(int argc, VALUE argv[], VALUE self)
+{
+ VALUE sym, type;
+ void (*func)();
+ VALUE val;
+ struct dl_handle *dlhandle;
+ void *handle;
+ const char *name, *stype;
+ const char *err;
+
+ rb_secure(2);
+ if (rb_scan_args(argc, argv, "11", &sym, &type) == 2) {
+ SafeStringValue(type);
+ stype = StringValuePtr(type);
+ }
+ else{
+ stype = NULL;
+ }
+
+ if (sym == Qnil) {
+#if defined(RTLD_NEXT)
+ name = RTLD_NEXT;
+#else
+ name = NULL;
+#endif
+ }
+ else{
+ SafeStringValue(sym);
+ name = StringValuePtr(sym);
+ }
+
+ Data_Get_Struct(self, struct dl_handle, dlhandle);
+ if (!dlhandle->open) {
+ rb_raise(rb_eRuntimeError, "Closed handle.");
+ }
+ handle = dlhandle->ptr;
+
+ func = dlsym(handle, name);
+#if defined(HAVE_DLERROR)
+ if (!func && (err = dlerror()))
+#else
+ if (!func)
+#endif
+ {
+#if defined(__CYGWIN__) || defined(WIN32) || defined(__MINGW32__)
+ {
+ int len = strlen(name);
+ char *name_a = (char*)dlmalloc(len+2);
+ strcpy(name_a, name);
+ name_a[len] = 'A';
+ name_a[len+1] = '\0';
+ func = dlsym(handle, name_a);
+ dlfree(name_a);
+#if defined(HAVE_DLERROR)
+ if (!func && (err = dlerror()))
+#else
+ if (!func)
+#endif
+ {
+ rb_raise(rb_eRuntimeError, "Unknown symbol \"%sA\".", name);
+ }
+ }
+#else
+ rb_raise(rb_eRuntimeError, "Unknown symbol \"%s\".", name);
+#endif
+ }
+ val = rb_dlsym_new(func, name, stype);
+
+ return val;
+}
+
+void
+Init_dlhandle()
+{
+ rb_cDLHandle = rb_define_class_under(rb_mDL, "Handle", rb_cObject);
+ rb_define_alloc_func(rb_cDLHandle, rb_dlhandle_s_allocate);
+ rb_define_method(rb_cDLHandle, "initialize", rb_dlhandle_initialize, -1);
+ rb_define_method(rb_cDLHandle, "to_i", rb_dlhandle_to_i, 0);
+ rb_define_method(rb_cDLHandle, "to_ptr", rb_dlhandle_to_ptr, 0);
+ rb_define_method(rb_cDLHandle, "close", rb_dlhandle_close, 0);
+ rb_define_method(rb_cDLHandle, "sym", rb_dlhandle_sym, -1);
+ rb_define_method(rb_cDLHandle, "[]", rb_dlhandle_sym, -1);
+ rb_define_method(rb_cDLHandle, "disable_close", rb_dlhandle_disable_close, 0);
+ rb_define_method(rb_cDLHandle, "enable_close", rb_dlhandle_enable_close, 0);
+}
diff --git a/ext/dl/install.rb b/ext/dl/install.rb
new file mode 100644
index 0000000000..69b1834301
--- /dev/null
+++ b/ext/dl/install.rb
@@ -0,0 +1,49 @@
+require 'mkmf'
+require 'ftools'
+
+SO_LIBS = ["dl.so"]
+
+$ruby_version = CONFIG['MAJOR'] + "." + CONFIG['MINOR']
+$prefix = CONFIG['prefix']
+$libdir = File.join($prefix,'lib')
+$rubylibdir = File.join($libdir, 'ruby', $ruby_version)
+$arch = CONFIG['arch']
+$archdir = File.join($rubylibdir, $arch)
+
+def find(dir, match = /./)
+ Dir.chdir(dir)
+ files = []
+ Dir.new(".").each{|file|
+ if( file != "." && file != ".." )
+ case File.ftype(file)
+ when "file"
+ if( file =~ match )
+ files.push(File.join(dir,file))
+ end
+ when "directory"
+ files += find(file, match).collect{|f| File.join(dir,f)}
+ end
+ end
+ }
+ Dir.chdir("..")
+ return files
+end
+
+def install()
+ rb_files = find(File.join(".","lib"), /.rb$/)
+
+ SO_LIBS.each{|f|
+ File.makedirs($rubylibdir, "#{$archdir}")
+ File.install(f, File.join($archdir,f), 0555, true)
+ }
+
+ rb_files.each{|f|
+ origfile = f
+ instfile = File.join($rubylibdir, origfile.sub("./lib/",""))
+ instdir = File.dirname(instfile)
+ File.makedirs(instdir)
+ File.install(origfile, instfile, 0644, true)
+ }
+end
+
+install()
diff --git a/ext/dl/lib/dl/import.rb b/ext/dl/lib/dl/import.rb
new file mode 100644
index 0000000000..1ab5145def
--- /dev/null
+++ b/ext/dl/lib/dl/import.rb
@@ -0,0 +1,215 @@
+# -*- ruby -*-
+
+require 'dl'
+require 'dl/types'
+
+module DL
+ module Importable
+ LIB_MAP = {}
+
+ module Internal
+ def init_types()
+ @types ||= ::DL::Types.new
+ end
+
+ def init_sym()
+ @SYM ||= {}
+ end
+
+ def [](name)
+ return @SYM[name.to_s][0]
+ end
+
+ def dlload(*libnames)
+ if( !defined?(@LIBS) )
+ @LIBS = []
+ end
+ libnames.each{|libname|
+ if( !LIB_MAP[libname] )
+ LIB_MAP[libname] = DL.dlopen(libname)
+ end
+ @LIBS.push(LIB_MAP[libname])
+ }
+ end
+ alias dllink :dlload
+
+ def parse_cproto(proto)
+ proto = proto.gsub(/\s+/, " ").strip
+ case proto
+ when /^([\d\w\*_\s]+)\(([\d\w\*_\s\,\[\]]*)\)$/
+ ret = $1
+ args = $2
+ ret = ret.split(/\s+/)
+ args = args.split(/\s*,\s*/)
+ func = ret.pop
+ if( func =~ /^\*/ )
+ func.gsub!(/^\*+/,"")
+ ret.push("*")
+ end
+ ret = ret.join(" ")
+ return [func, ret, args]
+ else
+ raise(RuntimeError,"can't parse the function prototype: #{proto}")
+ end
+ end
+
+ # example:
+ # extern "int strlen(char*)"
+ #
+ def extern(proto)
+ func,ret,args = parse_cproto(proto)
+ return import(func, ret, args)
+ end
+
+ # example:
+ # callback "int method_name(int, char*)"
+ #
+ def callback(proto)
+ func,ret,args = parse_cproto(proto)
+
+ init_types()
+ init_sym()
+
+ rty,renc,rdec = @types.encode_type(ret)
+ ty,enc,dec = encode_types(args)
+ symty = rty + ty
+
+ module_eval("module_function :#{func}")
+ sym = module_eval([
+ "DL::callback(\"#{symty}\"){|*args|",
+ " sym,rdec,enc,dec = @SYM['#{func}']",
+ " args = enc.call(args) if enc",
+ " r,rs = #{func}(*args)",
+ " r = renc.call(r) if rdec",
+ " rs = dec.call(rs) if (dec && rs)",
+ " @retval = r",
+ " @args = rs",
+ " @retval",
+ "}",
+ ].join("\n"))
+
+ @SYM[func] = [sym,rdec,enc,dec]
+
+ return sym
+ end
+
+ # example:
+ # typealias("uint", "unsigned int")
+ #
+ def typealias(*args)
+ init_types()
+ @types.typealias(*args)
+ end
+
+ # example:
+ # symbol "foo_value"
+ # symbol "foo_func", "IIP"
+ #
+ def symbol(name, ty = nil)
+ sym = nil
+ @LIBS.each{|lib|
+ begin
+ if( ty )
+ sym = lib[name, ty]
+ else
+ sym = lib[name]
+ end
+ rescue
+ next
+ end
+ }
+ if( !sym )
+ raise(RuntimeError, "can't find the symbol `#{name}'")
+ end
+ return sym
+ end
+
+ # example:
+ # import("get_length", "int", ["void*", "int"])
+ #
+ def import(name, rettype, argtypes = nil)
+ init_types()
+ init_sym()
+
+ rty,_,rdec = @types.encode_type(rettype)
+ ty,enc,dec = encode_types(argtypes)
+ symty = rty + ty
+
+ sym = symbol(name, symty)
+
+ mname = name.dup
+ if( ?A <= mname[0] && mname[0] <= ?Z )
+ mname[0,1] = mname[0,1].downcase
+ end
+ @SYM[mname] = [sym,rdec,enc,dec]
+
+ module_eval [
+ "def #{mname}(*args)",
+ " sym,rdec,enc,dec = @SYM['#{mname}']",
+ " args = enc.call(args) if enc",
+ if( $DEBUG )
+ " p \"[DL] call #{mname} with \#{args.inspect}\""
+ else
+ ""
+ end,
+ " r,rs = sym.call(*args)",
+ if( $DEBUG )
+ " p \"[DL] retval=\#{r.inspect} args=\#{rs.inspect}\""
+ else
+ ""
+ end,
+ " r = rdec.call(r) if rdec",
+ " rs = dec.call(rs) if dec",
+ " @retval = r",
+ " @args = rs",
+ " return @retval",
+ "end",
+ "module_function :#{mname}",
+ ].join("\n")
+
+ return sym
+ end
+
+ def _args_
+ return @args
+ end
+
+ def _retval_
+ return @retval
+ end
+
+ def encode_types(tys)
+ init_types()
+ encty = []
+ enc = nil
+ dec = nil
+ tys.each_with_index{|ty,idx|
+ ty,c1,c2,_,_ = @types.encode_type(ty)
+ encty.push(ty)
+ if( enc )
+ if( c1 )
+ conv1 = enc
+ enc = proc{|v| v = conv1.call(v); v[idx] = c1.call(v[idx]); v}
+ end
+ else
+ if( c1 )
+ enc = proc{|v| v[idx] = c1.call(v[idx]); v}
+ end
+ end
+ if( dec )
+ if( c2 )
+ conv2 = dec
+ dec = proc{|v| v = conv2.call(v); v[idx] = c2.call(v[idx]); v}
+ end
+ else
+ if( c2 )
+ dec = proc{|v| v[idx] = c2.call(v[idx]); v}
+ end
+ end
+ }
+ return [encty.join, enc, dec]
+ end
+ end # end of Internal
+ include Internal
+ end # end of Importable
+end
diff --git a/ext/dl/lib/dl/struct.rb b/ext/dl/lib/dl/struct.rb
new file mode 100644
index 0000000000..2c52d5040d
--- /dev/null
+++ b/ext/dl/lib/dl/struct.rb
@@ -0,0 +1,146 @@
+# -*- ruby -*-
+
+require 'dl'
+require 'dl/import'
+
+module DL
+ module Importable
+ module Internal
+ def define_struct(contents)
+ init_types()
+ Struct.new(@types, contents)
+ end
+ alias struct define_struct
+
+ def define_union(contents)
+ init_types()
+ Union.new(@types, contents)
+ end
+ alias union define_union
+
+ class Memory
+ def initialize(ptr, names, ty, len, enc, dec)
+ @ptr = ptr
+ @names = names
+ @ty = ty
+ @len = len
+ @enc = enc
+ @dec = dec
+
+ # define methods
+ @names.each{|name|
+ instance_eval [
+ "def #{name}",
+ " v = @ptr[\"#{name}\"]",
+ " if( @len[\"#{name}\"] )",
+ " v = v.collect{|x| @dec[\"#{name}\"].call(x) if @dec[\"#{name}\"] }",
+ " else",
+ " v = @dec[\"#{name}\"].call(v) if @dec[\"#{name}\"]",
+ " end",
+ " return v",
+ "end",
+ "def #{name}=(v)",
+ " if( @len[\"#{name}\"] )",
+ " v = v.collect{|x| @enc[\"#{name}\"].call(x) if @enc[\"#{name}\"] }",
+ " else",
+ " v = @enc[\"#{name}\"].call(v) if @enc[\"#{name}\"]",
+ " end",
+ " @ptr[\"#{name}\"] = v",
+ " return v",
+ "end",
+ ].join("\n")
+ }
+ end
+
+ def to_ptr
+ return @ptr
+ end
+
+ def size
+ return @ptr.size
+ end
+ end
+
+ class Struct
+ def initialize(types, contents)
+ @names = []
+ @ty = {}
+ @len = {}
+ @enc = {}
+ @dec = {}
+ @size = 0
+ @tys = ""
+ @types = types
+ parse(contents)
+ end
+
+ def size
+ return @size
+ end
+
+ def members
+ return @names
+ end
+
+ # ptr must be a PtrData object.
+ def new(ptr)
+ ptr.struct!(@tys, *@names)
+ mem = Memory.new(ptr, @names, @ty, @len, @enc, @dec)
+ return mem
+ end
+
+ def malloc(size = nil)
+ if( !size )
+ size = @size
+ end
+ ptr = DL::malloc(size)
+ return new(ptr)
+ end
+
+ def parse(contents)
+ contents.each{|elem|
+ name,ty,num,enc,dec = parse_elem(elem)
+ @names.push(name)
+ @ty[name] = ty
+ @len[name] = num
+ @enc[name] = enc
+ @dec[name] = dec
+ if( num )
+ @tys += "#{ty}#{num}"
+ else
+ @tys += ty
+ end
+ }
+ @size = DL.sizeof(@tys)
+ end
+
+ def parse_elem(elem)
+ elem.strip!
+ case elem
+ when /^([\w\d_\*]+)([\*\s]+)([\w\d_]+)$/
+ ty = ($1 + $2).strip
+ name = $3
+ num = nil;
+ when /^([\w\d_\*]+)([\*\s]+)([\w\d_]+)\[(\d+)\]$/
+ ty = ($1 + $2).strip
+ name = $3
+ num = $4.to_i
+ else
+ raise(RuntimeError, "invalid element: #{elem}")
+ end
+ ty,_,_,enc,dec = @types.encode_type(ty)
+ return [name,ty,num,enc,dec]
+ end
+ end # class Struct
+
+ class Union < Struct
+ def new
+ ptr = DL::malloc(@size)
+ ptr.union!(@tys, *@names)
+ mem = Memory.new(ptr, @names, @ty, @len, @enc, @dec)
+ return mem
+ end
+ end
+ end # module Internal
+ end # module Importable
+end # module DL
diff --git a/ext/dl/lib/dl/types.rb b/ext/dl/lib/dl/types.rb
new file mode 100644
index 0000000000..139426473a
--- /dev/null
+++ b/ext/dl/lib/dl/types.rb
@@ -0,0 +1,180 @@
+# -*- ruby -*-
+
+require 'dl'
+
+module DL
+ class Types
+ TYPES = [
+ # FORMAT:
+ # ["alias name", "type name",
+ # encoding_method, decoding_method, for function prototypes
+ # encoding_method, decoding_method] for structures (not implemented)
+
+ # for Windows
+ ["DWORD", "unsigned long", nil, nil, nil, nil],
+ ["PDWORD", "unsigned long *", nil, nil, nil, nil],
+ ["WORD", "unsigned short", nil, nil, nil, nil],
+ ["PWORD", "unsigned int *", nil, nil, nil, nil],
+ ["BYTE", "unsigned char", nil, nil, nil, nil],
+ ["PBYTE", "unsigned char *", nil, nil, nil, nil],
+ ["BOOL", "ibool", nil, nil, nil, nil],
+ ["ATOM", "int", nil, nil, nil, nil],
+ ["BYTE", "unsigned char", nil, nil, nil, nil],
+ ["PBYTE", "unsigned char *", nil, nil, nil, nil],
+ ["UINT", "unsigned int", nil, nil, nil, nil],
+ ["ULONG", "unsigned long", nil, nil, nil, nil],
+ ["UCHAR", "unsigned char", nil, nil, nil, nil],
+ ["HANDLE", "unsigned long", nil, nil, nil, nil],
+ ["PHANDLE","void*", nil, nil, nil, nil],
+ ["PVOID", "void*", nil, nil, nil, nil],
+ ["LPCSTR", "char*", nil, nil, nil, nil],
+ ["HDC", "unsigned int", nil, nil, nil, nil],
+ ["HWND", "unsigned int", nil, nil, nil, nil],
+
+ # Others
+ ["uint", "unsigned int", nil, nil, nil, nil],
+ ["u_int", "unsigned int", nil, nil, nil, nil],
+ ["ulong", "unsigned long", nil, nil, nil, nil],
+ ["u_long", "unsigned long", nil, nil, nil, nil],
+
+ # DL::Importable primitive types
+ ["ibool", "I",
+ proc{|v| v ? 1 : 0},
+ proc{|v| (v != 0) ? true : false},
+ proc{|v| v ? 1 : 0 },
+ proc{|v| (v != 0) ? true : false} ],
+ ["cbool", "C",
+ proc{|v| v ? 1 : 0},
+ proc{|v| (v != 0) ? true : false},
+ proc{|v,len| v ? 1 : 0},
+ proc{|v,len| (v != 0) ? true : false}],
+ ["lbool", "L",
+ proc{|v| v ? 1 : 0},
+ proc{|v| (v != 0) ? true : false},
+ proc{|v,len| v ? 1 : 0},
+ proc{|v,len| (v != 0) ? true : false}],
+ ["unsigned char", "C",
+ proc{|v| [v].pack("C").unpack("c")[0]},
+ proc{|v| [v].pack("c").unpack("C")[0]},
+ proc{|v| [v].pack("C").unpack("c")[0]},
+ proc{|v| [v].pack("c").unpack("C")[0]}],
+ ["unsigned short", "H",
+ proc{|v| [v].pack("S").unpack("s")[0]},
+ proc{|v| [v].pack("s").unpack("S")[0]},
+ proc{|v| [v].pack("S").unpack("s")[0]},
+ proc{|v| [v].pack("s").unpack("S")[0]}],
+ ["unsigned int", "I",
+ proc{|v| [v].pack("I").unpack("i")[0]},
+ proc{|v| [v].pack("i").unpack("I")[0]},
+ proc{|v| [v].pack("I").unpack("i")[0]},
+ proc{|v| [v].pack("i").unpack("I")[0]}],
+ ["unsigned long", "L",
+ proc{|v| [v].pack("L").unpack("l")[0]},
+ proc{|v| [v].pack("l").unpack("L")[0]},
+ proc{|v| [v].pack("L").unpack("l")[0]},
+ proc{|v| [v].pack("l").unpack("L")[0]}],
+ ["unsigned char ref", "c",
+ proc{|v| [v].pack("C").unpack("c")[0]},
+ proc{|v| [v].pack("c").unpack("C")[0]},
+ nil, nil],
+ ["unsigned int ref", "i",
+ proc{|v| [v].pack("I").unpack("i")[0]},
+ proc{|v| [v].pack("i").unpack("I")[0]},
+ nil, nil],
+ ["unsigned long ref", "l",
+ proc{|v| [v].pack("L").unpack("l")[0]},
+ proc{|v| [v].pack("l").unpack("L")[0]},
+ nil, nil],
+ ["char ref", "c", nil, nil, nil, nil],
+ ["short ref", "h", nil, nil, nil, nil],
+ ["int ref", "i", nil, nil, nil, nil],
+ ["long ref", "l", nil, nil, nil, nil],
+ ["float ref", "f", nil, nil, nil, nil],
+ ["double ref","d", nil, nil, nil, nil],
+ ["char", "C", nil, nil, nil, nil],
+ ["short", "H", nil, nil, nil, nil],
+ ["int", "I", nil, nil, nil, nil],
+ ["long", "L", nil, nil, nil, nil],
+ ["float", "F", nil, nil, nil, nil],
+ ["double", "D", nil, nil, nil, nil],
+ [/^char\s*\*$/,"s",nil, nil, nil, nil],
+ [/^const char\s*\*$/,"S",nil, nil, nil, nil],
+ [/^.+\*$/, "p", nil, nil, nil, nil],
+ [/^.+\[\]$/, "a", nil, nil, nil, nil],
+ ["void", "0", nil, nil, nil, nil],
+ ]
+
+ def initialize
+ init_types()
+ end
+
+ def typealias(ty1, ty2, enc=nil, dec=nil, senc=nil, sdec=nil)
+ @TYDEFS.unshift([ty1,ty2, enc,dec, senc, sdec])
+ end
+
+ def init_types
+ @TYDEFS = TYPES.dup
+ end
+
+ def encode_type(ty)
+ orig_ty = ty
+ enc = nil
+ dec = nil
+ senc = nil
+ sdec = nil
+ @TYDEFS.each{|t1,t2,c1,c2,c3,c4|
+# if( t1.is_a?(String) )
+# t1 = Regexp.new("^" + t1 + "$")
+# end
+ if( (t1.is_a?(Regexp) && (t1 =~ ty)) || (t1 == ty) )
+ ty = ty.gsub(t1,t2)
+ if( enc )
+ if( c1 )
+ conv1 = enc
+ enc = proc{|v| c1.call(conv1.call(v))}
+ end
+ else
+ if( c1 )
+ enc = c1
+ end
+ end
+ if( dec )
+ if( c2 )
+ conv2 = dec
+ dec = proc{|v| c2.call(conv2.call(v))}
+ end
+ else
+ if( c2 )
+ dec = c2
+ end
+ end
+ if( senc )
+ if( c3 )
+ conv3 = senc
+ senc = proc{|v| c3.call(conv3.call(v))}
+ end
+ else
+ if( c3 )
+ senc = c3
+ end
+ end
+ if( sdec )
+ if( c4 )
+ conv4 = sdec
+ sdec = proc{|v| c4.call(conv4.call(v))}
+ end
+ else
+ if( c4 )
+ sdec = c4
+ end
+ end
+ end
+ }
+ ty = ty.strip
+ if( ty.length != 1 )
+ raise(TypeError, "unknown type: #{orig_ty}.")
+ end
+ return [ty,enc,dec,senc,sdec]
+ end
+ end # end of Types
+end
diff --git a/ext/dl/lib/dl/win32.rb b/ext/dl/lib/dl/win32.rb
new file mode 100644
index 0000000000..92f473d392
--- /dev/null
+++ b/ext/dl/lib/dl/win32.rb
@@ -0,0 +1,25 @@
+# -*- ruby -*-
+
+require 'dl'
+
+class Win32API
+ DLL = {}
+
+ def initialize(dllname, func, import, export = "0")
+ prototype = (export + import.to_s).tr("VPpNnLlIi", "0SSI")
+ handle = DLL[dllname] ||= DL::Handle.new(dllname)
+ @sym = handle.sym(func, prototype)
+ end
+
+ def call(*args)
+ import = @sym.proto.split("", 2)[1]
+ args.each_with_index do |x, i|
+ args[i] = nil if x == 0 and import[i] == ?S
+ args[i], = [x].pack("I").unpack("i") if import[i] == ?I
+ end
+ ret, = @sym.call(*args)
+ return ret || 0
+ end
+
+ alias Call call
+end
diff --git a/ext/dl/mkcall.rb b/ext/dl/mkcall.rb
new file mode 100644
index 0000000000..6a85570152
--- /dev/null
+++ b/ext/dl/mkcall.rb
@@ -0,0 +1,62 @@
+# -*- ruby -*-
+
+require 'mkmf'
+$:.unshift File.dirname(__FILE__)
+require 'type'
+require 'dlconfig'
+
+def output_arg(x,i)
+ "args[#{i}].#{DLTYPE[x][:stmem]}"
+end
+
+def output_args(types)
+ t = []
+ types[1..-1].each_with_index{|x,i| t.push(output_arg(x,i))}
+ t.join(",")
+end
+
+def output_callfunc(types)
+ t = types[0]
+ stmem = DLTYPE[t][:stmem]
+ ctypes = types2ctypes(types)
+ if( t == VOID )
+ callstm = "(*f)(#{output_args(types)})"
+ else
+ callstm = "ret.#{stmem} = (*f)(#{output_args(types)})"
+ end
+ [ "{",
+ "#{ctypes[0]} (*f)(#{ctypes[1..-1].join(',')}) = func;",
+ "#{callstm};",
+ "}"].join(" ")
+end
+
+def output_case(types)
+ num = types2num(types)
+ callfunc_stm = output_callfunc(types)
+<<EOF
+ case #{num}:
+#ifdef DEBUG
+ printf("#{callfunc_stm}\\n");
+#endif
+ #{callfunc_stm};
+ break;
+EOF
+end
+
+def rec_output(types = [VOID])
+ print output_case(types)
+ if( types.length <= MAX_ARG )
+ DLTYPE.keys.sort.each{|t|
+ if( t != VOID && DLTYPE[t][:sym] )
+ rec_output(types + [t])
+ end
+ }
+ end
+end
+
+DLTYPE.keys.sort.each{|t|
+ if( DLTYPE[t][:sym] )
+ $stderr.printf(" #{DLTYPE[t][:ctype]}\n")
+ rec_output([t])
+ end
+}
diff --git a/ext/dl/mkcallback.rb b/ext/dl/mkcallback.rb
new file mode 100644
index 0000000000..b7ea1718d0
--- /dev/null
+++ b/ext/dl/mkcallback.rb
@@ -0,0 +1,53 @@
+# -*- ruby -*-
+
+require 'mkmf'
+$:.unshift File.dirname(__FILE__)
+require 'type'
+require 'dlconfig'
+
+def mkfunc(rettype, fnum, argc)
+ args = (0..(argc-1)).collect{|i| "long arg#{i}"}.join(", ")
+
+ subst_code = (0..(argc-1)).collect{|i|
+ " buff[#{i.to_s}] = arg#{i.to_s};"
+ }.join("\n")
+
+ ret_code =
+ if( DLTYPE[rettype][:c2rb] )
+ " return #{DLTYPE[rettype][:rb2c]['retval']};"
+ else
+ " /* no return value */"
+ end
+
+ code = [
+ "static #{DLTYPE[rettype][:ctype]}",
+ "rb_dl_callback_func_#{rettype.to_s}_#{fnum.to_s}(#{args})",
+ "{",
+ " VALUE retval, proto, proc, obj;",
+ " VALUE argv[#{argc.to_s}];",
+ " int argc;",
+ " long buff[#{argc.to_s}];",
+ "",
+ subst_code,
+ "",
+ " obj = rb_hash_aref(DLFuncTable, rb_assoc_new(INT2NUM(#{rettype.to_s}),INT2NUM(#{fnum.to_s})));",
+ " proto = rb_ary_entry(obj, 0);",
+ " proc = rb_ary_entry(obj, 1);",
+ " Check_Type(proto, T_STRING);",
+ " if( RSTRING(proto)->len >= #{argc.to_s} )",
+ " rb_raise(rb_eArgError, \"too many arguments\");",
+ " rb_dl_scan_callback_args(buff, RSTRING(proto)->ptr, &argc, argv);",
+ " retval = rb_funcall2(proc, id_call, argc, argv);",
+ "",
+ ret_code,
+ "}",
+ ].join("\n")
+
+ return code
+end
+
+DLTYPE.keys.sort.each{|t|
+ for n in 0..(MAX_CALLBACK - 1)
+ print(mkfunc(t, n, 15), "\n\n")
+ end
+}
diff --git a/ext/dl/mkcbtable.rb b/ext/dl/mkcbtable.rb
new file mode 100644
index 0000000000..165c4bdc88
--- /dev/null
+++ b/ext/dl/mkcbtable.rb
@@ -0,0 +1,18 @@
+# -*- ruby -*-
+
+require 'mkmf'
+$:.unshift File.dirname(__FILE__)
+require 'type'
+require 'dlconfig'
+
+def mktable(rettype, fnum, argc)
+ code =
+ "rb_dl_callback_table[#{rettype}][#{fnum}] = &rb_dl_callback_func_#{rettype.to_s}_#{fnum};"
+ return code
+end
+
+DLTYPE.keys.sort.each{|t|
+ for n in 0..(MAX_CALLBACK - 1)
+ print(mktable(t, n, 15), "\n")
+ end
+}
diff --git a/ext/dl/ptr.c b/ext/dl/ptr.c
new file mode 100644
index 0000000000..32f78c4de5
--- /dev/null
+++ b/ext/dl/ptr.c
@@ -0,0 +1,1065 @@
+/* -*- C -*-
+ * $Id$
+ */
+
+#include <ruby.h>
+#include <ctype.h>
+#include <version.h> /* for ruby version code */
+#include "dl.h"
+
+VALUE rb_cDLPtrData;
+VALUE rb_mDLMemorySpace;
+static VALUE DLMemoryTable;
+
+#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));
+}
+
+static void
+rb_dlmem_aset(void *ptr, VALUE obj)
+{
+ if (obj == Qnil) {
+ rb_dlmem_delete(ptr);
+ }
+ else{
+ rb_hash_aset(DLMemoryTable, DLLONG2NUM(ptr), DLLONG2NUM(obj));
+ }
+}
+
+static VALUE
+rb_dlmem_aref(void *ptr)
+{
+ VALUE val;
+
+ val = rb_hash_aref(DLMemoryTable, DLLONG2NUM(ptr));
+ return val == Qnil ? Qnil : (VALUE)DLNUM2LONG(val);
+}
+
+void
+dlptr_free(struct ptr_data *data)
+{
+ if (data->ptr) {
+ DEBUG_CODE({
+ printf("dlptr_free(): removing the pointer `0x%x' from the MemorySpace\n",
+ data->ptr);
+ });
+ rb_dlmem_delete(data->ptr);
+ if (data->free) {
+ DEBUG_CODE({
+ printf("dlptr_free(): 0x%x(data->ptr:0x%x)\n",data->free,data->ptr);
+ });
+ (*(data->free))(data->ptr);
+ }
+ }
+ if (data->stype) dlfree(data->stype);
+ if (data->ssize) dlfree(data->ssize);
+ if (data->ids) dlfree(data->ids);
+}
+
+void
+dlptr_init(VALUE val)
+{
+ struct ptr_data *data;
+
+ Data_Get_Struct(val, struct ptr_data, data);
+ DEBUG_CODE({
+ printf("dlptr_init(): add the pointer `0x%x' to the MemorySpace\n",
+ data->ptr);
+ });
+ rb_dlmem_aset(data->ptr, val);
+ OBJ_TAINT(val);
+}
+
+VALUE
+rb_dlptr_new2(VALUE klass, void *ptr, long size, freefunc_t func)
+{
+ struct ptr_data *data;
+ VALUE val;
+
+ rb_secure(4);
+ if (ptr) {
+ val = rb_dlmem_aref(ptr);
+ if (val == Qnil) {
+ val = Data_Make_Struct(klass, struct ptr_data,
+ 0, dlptr_free, data);
+ data->ptr = ptr;
+ data->free = func;
+ data->ctype = DLPTR_CTYPE_UNKNOWN;
+ data->stype = NULL;
+ data->ssize = NULL;
+ data->slen = 0;
+ data->size = size;
+ data->ids = NULL;
+ data->ids_num = 0;
+ dlptr_init(val);
+ }
+ else{
+ if (func) {
+ Data_Get_Struct(val, struct ptr_data, data);
+ data->free = func;
+ }
+ }
+ }
+ else{
+ val = Qnil;
+ }
+
+ return val;
+}
+
+VALUE
+rb_dlptr_new(void *ptr, long size, freefunc_t func)
+{
+ return rb_dlptr_new2(rb_cDLPtrData, ptr, size, func);
+}
+
+VALUE
+rb_dlptr_malloc(long size, freefunc_t func)
+{
+ void *ptr;
+
+ rb_secure(4);
+ ptr = dlmalloc((size_t)size);
+ memset(ptr,0,(size_t)size);
+ return rb_dlptr_new(ptr, size, func);
+}
+
+void *
+rb_dlptr2cptr(VALUE val)
+{
+ struct ptr_data *data;
+ void *ptr;
+
+ if (rb_obj_is_kind_of(val, rb_cDLPtrData)) {
+ Data_Get_Struct(val, struct ptr_data, data);
+ ptr = data->ptr;
+ }
+ else if (val == Qnil) {
+ ptr = NULL;
+ }
+ else{
+ rb_raise(rb_eTypeError, "DL::PtrData was expected");
+ }
+
+ return ptr;
+}
+
+static VALUE
+rb_dlptr_s_allocate(VALUE klass)
+{
+ VALUE obj;
+ struct ptr_data *data;
+
+ rb_secure(4);
+ obj = Data_Make_Struct(klass, struct ptr_data, 0, dlptr_free, data);
+ data->ptr = 0;
+ data->free = 0;
+ data->ctype = DLPTR_CTYPE_UNKNOWN;
+ data->stype = NULL;
+ data->ssize = NULL;
+ data->slen = 0;
+ data->size = 0;
+ data->ids = NULL;
+ data->ids_num = 0;
+
+ return obj;
+}
+
+static VALUE
+rb_dlptr_initialize(int argc, VALUE argv[], VALUE self)
+{
+ VALUE ptr, sym, size;
+ struct ptr_data *data;
+ void *p = NULL;
+ freefunc_t f = NULL;
+ long s = 0;
+
+ switch (rb_scan_args(argc, argv, "12", &ptr, &size, &sym)) {
+ case 1:
+ p = (void*)(DLNUM2LONG(rb_Integer(ptr)));
+ break;
+ case 2:
+ p = (void*)(DLNUM2LONG(rb_Integer(ptr)));
+ s = DLNUM2LONG(size);
+ break;
+ case 3:
+ p = (void*)(DLNUM2LONG(rb_Integer(ptr)));
+ s = DLNUM2LONG(size);
+ f = rb_dlsym2csym(sym);
+ break;
+ default:
+ rb_bug("rb_dlptr_initialize");
+ }
+
+ if (p) {
+ Data_Get_Struct(self, struct ptr_data, data);
+ if (data->ptr && data->free) {
+ /* Free previous memory. Use of inappropriate initialize may cause SEGV. */
+ (*(data->free))(data->ptr);
+ }
+ data->ptr = p;
+ data->size = s;
+ data->free = f;
+ }
+
+ return Qnil;
+}
+
+static VALUE
+rb_dlptr_s_malloc(int argc, VALUE argv[], VALUE klass)
+{
+ VALUE size, sym, obj;
+ int s;
+ freefunc_t f = NULL;
+
+ switch (rb_scan_args(argc, argv, "11", &size, &sym)) {
+ case 1:
+ s = NUM2INT(size);
+ break;
+ case 2:
+ s = NUM2INT(size);
+ f = rb_dlsym2csym(sym);
+ break;
+ default:
+ rb_bug("rb_dlptr_s_malloc");
+ }
+
+ obj = rb_dlptr_malloc(s,f);
+
+ return obj;
+}
+
+VALUE
+rb_dlptr_to_i(VALUE self)
+{
+ struct ptr_data *data;
+
+ Data_Get_Struct(self, struct ptr_data, data);
+ return DLLONG2NUM(data->ptr);
+}
+
+VALUE
+rb_dlptr_ptr(VALUE self)
+{
+ struct ptr_data *data;
+
+ Data_Get_Struct(self, struct ptr_data, data);
+ return rb_dlptr_new(*((void**)(data->ptr)),0,0);
+}
+
+VALUE
+rb_dlptr_ref(VALUE self)
+{
+ struct ptr_data *data;
+
+ Data_Get_Struct(self, struct ptr_data, data);
+ return rb_dlptr_new(&(data->ptr),0,0);
+}
+
+VALUE
+rb_dlptr_null_p(VALUE self)
+{
+ struct ptr_data *data;
+
+ Data_Get_Struct(self, struct ptr_data, data);
+ return data->ptr ? Qfalse : Qtrue;
+}
+
+VALUE
+rb_dlptr_free_set(VALUE self, VALUE val)
+{
+ struct ptr_data *data;
+
+ Data_Get_Struct(self, struct ptr_data, data);
+
+ data->free = DLFREEFUNC(rb_dlsym2csym(val));
+
+ return Qnil;
+}
+
+VALUE
+rb_dlptr_free_get(VALUE self)
+{
+ struct ptr_data *pdata;
+
+ Data_Get_Struct(self, struct ptr_data, pdata);
+
+ return rb_dlsym_new(pdata->free,"(free)","0P");
+}
+
+VALUE
+rb_dlptr_to_array(int argc, VALUE argv[], VALUE self)
+{
+ struct ptr_data *data;
+ int n;
+ int i;
+ int t;
+ VALUE ary;
+ VALUE type, size;
+
+ Data_Get_Struct(self, struct ptr_data, data);
+
+ switch (rb_scan_args(argc, argv, "11", &type, &size)) {
+ case 2:
+ t = StringValuePtr(type)[0];
+ n = NUM2INT(size);
+ break;
+ case 1:
+ t = StringValuePtr(type)[0];
+ switch (t) {
+ case 'C':
+ n = data->size;
+ break;
+ case 'H':
+ n = data->size / sizeof(short);
+ break;
+ case 'I':
+ n = data->size / sizeof(int);
+ break;
+ case 'L':
+ n = data->size / sizeof(long);
+ break;
+ case 'F':
+ n = data->size / sizeof(float);
+ break;
+ case 'D':
+ n = data->size / sizeof(double);
+ break;
+ case 'P': case 'p':
+ n = data->size / sizeof(void*);
+ break;
+ case 'S': case 's':
+ for (n=0; ((void**)(data->ptr))[n]; n++) {};
+ break;
+ default:
+ n = 0;
+ }
+ break;
+ default:
+ rb_bug("rb_dlptr_to_array");
+ }
+
+ ary = rb_ary_new();
+
+ for (i=0; i < n; i++) {
+ switch (t) {
+ case 'C':
+ rb_ary_push(ary, INT2NUM(((char*)(data->ptr))[i]));
+ break;
+ case 'H':
+ rb_ary_push(ary, INT2NUM(((short*)(data->ptr))[i]));
+ break;
+ case 'I':
+ rb_ary_push(ary, INT2NUM(((int*)(data->ptr))[i]));
+ break;
+ case 'L':
+ rb_ary_push(ary, DLLONG2NUM(((long*)(data->ptr))[i]));
+ break;
+ case 'D':
+ rb_ary_push(ary, rb_float_new(((double*)(data->ptr))[i]));
+ break;
+ case 'F':
+ rb_ary_push(ary, rb_float_new(((float*)(data->ptr))[i]));
+ break;
+ case 'S':
+ {
+ char *str = ((char**)(data->ptr))[i];
+ if (str) {
+ rb_ary_push(ary, rb_tainted_str_new2(str));
+ }
+ else{
+ rb_ary_push(ary, Qnil);
+ }
+ }
+ break;
+ case 's':
+ {
+ char *str = ((char**)(data->ptr))[i];
+ if (str) {
+ rb_ary_push(ary, rb_tainted_str_new2(str));
+ xfree(str);
+ }
+ else{
+ rb_ary_push(ary, Qnil);
+ }
+ }
+ break;
+ case 'P':
+ rb_ary_push(ary, rb_dlptr_new(((void**)(data->ptr))[i],0,0));
+ break;
+ case 'p':
+ rb_ary_push(ary,
+ rb_dlptr_new(((void**)(data->ptr))[i],0,dlfree));
+ break;
+ }
+ }
+
+ return ary;
+}
+
+
+VALUE
+rb_dlptr_to_s(int argc, VALUE argv[], VALUE self)
+{
+ struct ptr_data *data;
+ VALUE arg1, val;
+ int len;
+
+ Data_Get_Struct(self, struct ptr_data, data);
+ switch (rb_scan_args(argc, argv, "01", &arg1)) {
+ case 0:
+ val = rb_tainted_str_new2((char*)(data->ptr));
+ break;
+ case 1:
+ len = NUM2INT(arg1);
+ val = rb_tainted_str_new((char*)(data->ptr), len);
+ break;
+ default:
+ rb_bug("rb_dlptr_to_s");
+ }
+
+ return val;
+}
+
+VALUE
+rb_dlptr_to_str(int argc, VALUE argv[], VALUE self)
+{
+ struct ptr_data *data;
+ VALUE arg1, val;
+ int len;
+
+ Data_Get_Struct(self, struct ptr_data, data);
+ switch (rb_scan_args(argc, argv, "01", &arg1)) {
+ case 0:
+ val = rb_tainted_str_new((char*)(data->ptr),data->size);
+ break;
+ case 1:
+ len = NUM2INT(arg1);
+ val = rb_tainted_str_new((char*)(data->ptr), len);
+ break;
+ default:
+ rb_bug("rb_dlptr_to_str");
+ }
+
+ return val;
+}
+
+VALUE
+rb_dlptr_inspect(VALUE self)
+{
+ struct ptr_data *data;
+ char str[1024];
+
+ Data_Get_Struct(self, struct ptr_data, data);
+ snprintf(str, 1023, "#<%s:0x%p ptr=0x%p size=%ld free=0x%p>",
+ rb_class2name(CLASS_OF(self)), data, data->ptr, data->size, data->free);
+ return rb_str_new2(str);
+}
+
+VALUE
+rb_dlptr_eql(VALUE self, VALUE other)
+{
+ void *ptr1, *ptr2;
+ ptr1 = rb_dlptr2cptr(self);
+ ptr2 = rb_dlptr2cptr(other);
+
+ return ptr1 == ptr2 ? Qtrue : Qfalse;
+}
+
+VALUE
+rb_dlptr_cmp(VALUE self, VALUE other)
+{
+ void *ptr1, *ptr2;
+ ptr1 = rb_dlptr2cptr(self);
+ ptr2 = rb_dlptr2cptr(other);
+ return DLLONG2NUM((long)ptr1 - (long)ptr2);
+}
+
+VALUE
+rb_dlptr_plus(VALUE self, VALUE other)
+{
+ void *ptr;
+ long num, size;
+
+ ptr = rb_dlptr2cptr(self);
+ size = RDLPTR(self)->size;
+ num = DLNUM2LONG(other);
+ return rb_dlptr_new((char *)ptr + num, size - num, 0);
+}
+
+VALUE
+rb_dlptr_minus(VALUE self, VALUE other)
+{
+ void *ptr;
+ long num, size;
+
+ ptr = rb_dlptr2cptr(self);
+ size = RDLPTR(self)->size;
+ num = DLNUM2LONG(other);
+ return rb_dlptr_new((char *)ptr - num, size + num, 0);
+}
+
+VALUE
+rb_dlptr_define_data_type(int argc, VALUE argv[], VALUE self)
+{
+ VALUE data_type, type, rest, vid;
+ struct ptr_data *data;
+ int i, t, num;
+ char *ctype;
+
+ rb_scan_args(argc, argv, "11*", &data_type, &type, &rest);
+ Data_Get_Struct(self, struct ptr_data, data);
+
+ if (argc == 1 || (argc == 2 && type == Qnil)) {
+ if (NUM2INT(data_type) == DLPTR_CTYPE_UNKNOWN) {
+ data->ctype = DLPTR_CTYPE_UNKNOWN;
+ data->slen = 0;
+ data->ids_num = 0;
+ if (data->stype) {
+ dlfree(data->stype);
+ data->stype = NULL;
+ }
+ if (data->ids) {
+ dlfree(data->ids);
+ data->ids = NULL;
+ }
+ return Qnil;
+ }
+ else{
+ rb_raise(rb_eArgError, "wrong arguments");
+ }
+ }
+
+ t = NUM2INT(data_type);
+ StringValue(type);
+ Check_Type(rest, T_ARRAY);
+ num = RARRAY(rest)->len;
+ for (i=0; i<num; i++) {
+ rb_to_id(rb_ary_entry(rest,i));
+ }
+
+ data->ctype = t;
+ data->slen = num;
+ data->ids_num = num;
+ if (data->stype) dlfree(data->stype);
+ data->stype = (char*)dlmalloc(sizeof(char) * num);
+ if (data->ssize) dlfree(data->ssize);
+ data->ssize = (int*)dlmalloc(sizeof(int) * num);
+ if (data->ids) dlfree(data->ids);
+ data->ids = (ID*)dlmalloc(sizeof(ID) * data->ids_num);
+
+ ctype = StringValuePtr(type);
+ for (i=0; i<num; i++) {
+ vid = rb_ary_entry(rest,i);
+ data->ids[i] = rb_to_id(vid);
+ data->stype[i] = *ctype;
+ ctype ++;
+ if (isdigit(*ctype)) {
+ char *p, *d;
+ for (p=ctype; isdigit(*p); p++) ;
+ d = ALLOCA_N(char, p - ctype + 1);
+ strncpy(d, ctype, p - ctype);
+ d[p - ctype] = '\0';
+ data->ssize[i] = atoi(d);
+ ctype = p;
+ }
+ else{
+ data->ssize[i] = 1;
+ }
+ }
+
+ if (*ctype) {
+ rb_raise(rb_eArgError, "too few/many arguments");
+ }
+
+ if (!data->size)
+ data->size = dlsizeof(RSTRING(type)->ptr);
+
+ return Qnil;
+}
+
+VALUE
+rb_dlptr_define_struct(int argc, VALUE argv[], VALUE self)
+{
+ VALUE *pass_argv;
+ int pass_argc, i;
+
+ pass_argc = argc + 1;
+ pass_argv = ALLOCA_N(VALUE, pass_argc);
+ pass_argv[0] = INT2FIX(DLPTR_CTYPE_STRUCT);
+ for (i=1; i<pass_argc; i++) {
+ pass_argv[i] = argv[i-1];
+ }
+ return rb_dlptr_define_data_type(pass_argc, pass_argv, self);
+}
+
+VALUE
+rb_dlptr_define_union(int argc, VALUE argv[], VALUE self)
+{
+ VALUE *pass_argv;
+ int pass_argc, i;
+
+ pass_argc = argc + 1;
+ pass_argv = ALLOCA_N(VALUE, pass_argc);
+ pass_argv[0] = INT2FIX(DLPTR_CTYPE_UNION);
+ for (i=1; i<pass_argc; i++) {
+ pass_argv[i] = argv[i-1];
+ }
+ return rb_dlptr_define_data_type(pass_argc, pass_argv, self);
+}
+
+VALUE
+rb_dlptr_get_data_type(VALUE self)
+{
+ struct ptr_data *data;
+
+ Data_Get_Struct(self, struct ptr_data, data);
+ if (data->stype)
+ return rb_assoc_new(INT2FIX(data->ctype),
+ rb_tainted_str_new(data->stype, data->slen));
+ else
+ return rb_assoc_new(INT2FIX(data->ctype), Qnil);
+}
+
+static VALUE
+cary2ary(void *ptr, char t, int len)
+{
+ VALUE ary;
+ VALUE elem;
+ int i;
+
+ if (len < 1)
+ return Qnil;
+
+ if (len == 1) {
+ switch (t) {
+ case 'I':
+ elem = INT2NUM(*((int*)ptr));
+ ptr = (char *)ptr + sizeof(int);
+ break;
+ case 'L':
+ elem = DLLONG2NUM(*((long*)ptr));
+ ptr = (char *)ptr + sizeof(long);
+ break;
+ case 'P':
+ case 'S':
+ elem = rb_dlptr_new(*((void**)ptr),0, 0);
+ ptr = (char *)ptr + sizeof(void*);
+ break;
+ case 'F':
+ elem = rb_float_new(*((float*)ptr));
+ ptr = (char *)ptr + sizeof(float);
+ break;
+ case 'D':
+ elem = rb_float_new(*((double*)ptr));
+ ptr = (char *)ptr + sizeof(double);
+ break;
+ case 'C':
+ elem = INT2NUM(*((char*)ptr));
+ ptr = (char *)ptr + sizeof(char);
+ break;
+ case 'H':
+ elem = INT2NUM(*((short*)ptr));
+ ptr = (char *)ptr + sizeof(short);
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unsupported type '%c'", t);
+ }
+ return elem;
+ }
+
+ ary = rb_ary_new();
+ for (i=0; i < len; i++) {
+ switch (t) {
+ case 'I':
+ elem = INT2NUM(*((int*)ptr));
+ ptr = (char *)ptr + sizeof(int);
+ break;
+ case 'L':
+ elem = DLLONG2NUM(*((long*)ptr));
+ ptr = (char *)ptr + sizeof(long);
+ break;
+ case 'P':
+ case 'S':
+ elem = rb_dlptr_new(*((void**)ptr), 0, 0);
+ ptr = (char *)ptr + sizeof(void*);
+ break;
+ case 'F':
+ elem = rb_float_new(*((float*)ptr));
+ ptr = (char *)ptr + sizeof(float);
+ break;
+ case 'D':
+ elem = rb_float_new(*((float*)ptr));
+ ptr = (char *)ptr + sizeof(double);
+ break;
+ case 'C':
+ elem = INT2NUM(*((char*)ptr));
+ ptr = (char *)ptr + sizeof(char);
+ break;
+ case 'H':
+ elem = INT2NUM(*((short*)ptr));
+ ptr = (char *)ptr + sizeof(short);
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unsupported type '%c'", t);
+ }
+ rb_ary_push(ary, elem);
+ }
+
+ return ary;
+}
+
+VALUE
+rb_dlptr_aref(int argc, VALUE argv[], VALUE self)
+{
+ VALUE key = Qnil, num = Qnil;
+ ID id;
+ struct ptr_data *data;
+ int i;
+ int offset;
+
+ if (rb_scan_args(argc, argv, "11", &key, &num) == 1) {
+ num = INT2NUM(0);
+ }
+
+ if (TYPE(key) == T_FIXNUM || TYPE(key) == T_BIGNUM) {
+ VALUE pass[1];
+ pass[0] = num;
+ return rb_dlptr_to_str(1, pass, rb_dlptr_plus(self, key));
+ }
+ rb_to_id(key);
+ if (! (TYPE(key) == T_STRING || TYPE(key) == T_SYMBOL)) {
+ rb_raise(rb_eTypeError, "the key must be a string or symbol");
+ }
+
+ id = rb_to_id(key);
+ Data_Get_Struct(self, struct ptr_data, data);
+ offset = 0;
+ switch (data->ctype) {
+ case DLPTR_CTYPE_STRUCT:
+ for (i=0; i < data->ids_num; i++) {
+ if (data->ids[i] == id) {
+ switch (data->stype[i]) {
+ case 'I':
+ DLALIGN(data->ptr,offset,INT_ALIGN);
+ break;
+ case 'L':
+ DLALIGN(data->ptr,offset,LONG_ALIGN);
+ break;
+ case 'P':
+ case 'S':
+ DLALIGN(data->ptr,offset,VOIDP_ALIGN);
+ break;
+ case 'F':
+ DLALIGN(data->ptr,offset,FLOAT_ALIGN);
+ break;
+ case 'D':
+ DLALIGN(data->ptr,offset,DOUBLE_ALIGN);
+ break;
+ case 'C':
+ break;
+ case 'H':
+ DLALIGN(data->ptr,offset,SHORT_ALIGN);
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]);
+ }
+ return cary2ary((char *)data->ptr + offset, data->stype[i], data->ssize[i]);
+ }
+ switch (data->stype[i]) {
+ case 'I':
+ offset += sizeof(int) * data->ssize[i];
+ break;
+ case 'L':
+ offset += sizeof(long) * data->ssize[i];
+ break;
+ case 'P':
+ case 'S':
+ offset += sizeof(void*) * data->ssize[i];
+ break;
+ case 'F':
+ offset += sizeof(float) * data->ssize[i];
+ break;
+ case 'D':
+ offset += sizeof(double) * data->ssize[i];
+ break;
+ case 'C':
+ offset += sizeof(char) * data->ssize[i];
+ break;
+ case 'H':
+ offset += sizeof(short) * data->ssize[i];
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]);
+ }
+ }
+ break;
+ case DLPTR_CTYPE_UNION:
+ for (i=0; i < data->ids_num; i++) {
+ if (data->ids[i] == id) {
+ return cary2ary((char *)data->ptr + offset, data->stype[i], data->ssize[i]);
+ }
+ }
+ break;
+ } /* end of switch */
+
+ rb_raise(rb_eNameError, "undefined key `%s' for %s",
+ rb_id2name(id), rb_class2name(CLASS_OF(self)));
+
+ return Qnil;
+}
+
+static void *
+ary2cary(char t, VALUE val, long *size)
+{
+ void *ptr;
+
+ if (TYPE(val) == T_ARRAY) {
+ ptr = rb_ary2cary(t, val, size);
+ }
+ else{
+ ptr = rb_ary2cary(t, rb_ary_new3(1, val), size);
+ }
+ return ptr;
+}
+
+VALUE
+rb_dlptr_aset(int argc, VALUE argv[], VALUE self)
+{
+ VALUE key = Qnil, num = Qnil, val = Qnil;
+ ID id;
+ struct ptr_data *data;
+ int i;
+ int offset;
+ long memsize;
+ void *memimg;
+
+ rb_secure(4);
+ switch (rb_scan_args(argc, argv, "21", &key, &num, &val)) {
+ case 2:
+ val = num;
+ num = Qnil;
+ break;
+ }
+
+ if (TYPE(key) == T_FIXNUM || TYPE(key) == T_BIGNUM) {
+ void *dst, *src;
+ long len;
+
+ StringValue(val);
+ Data_Get_Struct(self, struct ptr_data, data);
+ dst = (void*)((long)(data->ptr) + DLNUM2LONG(key));
+ src = RSTRING(val)->ptr;
+ len = RSTRING(val)->len;
+ if (num == Qnil) {
+ memcpy(dst, src, len);
+ }
+ else{
+ long n = NUM2INT(num);
+ memcpy(dst, src, n < len ? n : len);
+ if (n > len) MEMZERO((char*)dst + len, char, n - len);
+ }
+ return val;
+ }
+
+ id = rb_to_id(key);
+ Data_Get_Struct(self, struct ptr_data, data);
+ switch (data->ctype) {
+ case DLPTR_CTYPE_STRUCT:
+ offset = 0;
+ for (i=0; i < data->ids_num; i++) {
+ if (data->ids[i] == id) {
+ switch (data->stype[i]) {
+ case 'I':
+ DLALIGN(data->ptr,offset,INT_ALIGN);
+ break;
+ case 'L':
+ DLALIGN(data->ptr,offset,LONG_ALIGN);
+ break;
+ case 'P':
+ case 'S':
+ DLALIGN(data->ptr,offset,VOIDP_ALIGN);
+ break;
+ case 'D':
+ DLALIGN(data->ptr,offset,DOUBLE_ALIGN);
+ break;
+ case 'F':
+ DLALIGN(data->ptr,offset,FLOAT_ALIGN);
+ break;
+ case 'C':
+ break;
+ case 'H':
+ DLALIGN(data->ptr,offset,SHORT_ALIGN);
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]);
+ }
+ memimg = ary2cary(data->stype[i], val, &memsize);
+ memcpy((char *)data->ptr + offset, memimg, memsize);
+ return val;
+ }
+ switch (data->stype[i]) {
+ case 'I':
+ case 'i':
+ offset += sizeof(int) * data->ssize[i];
+ break;
+ case 'L':
+ case 'l':
+ offset += sizeof(long) * data->ssize[i];
+ break;
+ case 'P':
+ case 'p':
+ case 'S':
+ case 's':
+ offset += sizeof(void*) * data->ssize[i];
+ break;
+ case 'D':
+ case 'd':
+ offset += sizeof(double) * data->ssize[i];
+ break;
+ case 'F':
+ case 'f':
+ offset += sizeof(float) * data->ssize[i];
+ break;
+ case 'C':
+ case 'c':
+ offset += sizeof(char) * data->ssize[i];
+ break;
+ case 'H':
+ case 'h':
+ offset += sizeof(short) * data->ssize[i];
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]);
+ }
+ }
+ return val;
+ /* break; */
+ case DLPTR_CTYPE_UNION:
+ for (i=0; i < data->ids_num; i++) {
+ if (data->ids[i] == id) {
+ switch (data->stype[i]) {
+ case 'I': case 'i':
+ memsize = sizeof(int) * data->ssize[i];
+ break;
+ case 'L': case 'l':
+ memsize = sizeof(long) * data->ssize[i];
+ break;
+ case 'P': case 'p':
+ case 'S': case 's':
+ memsize = sizeof(void*) * data->ssize[i];
+ break;
+ case 'F': case 'f':
+ memsize = sizeof(float) * data->ssize[i];
+ break;
+ case 'D': case 'd':
+ memsize = sizeof(double) * data->ssize[i];
+ break;
+ case 'C': case 'c':
+ memsize = sizeof(char) * data->ssize[i];
+ break;
+ case 'H': case 'h':
+ memsize = sizeof(short) * data->ssize[i];
+ break;
+ default:
+ rb_raise(rb_eDLTypeError, "unsupported type '%c'", data->stype[i]);
+ }
+ memimg = ary2cary(data->stype[i], val, NULL);
+ memcpy(data->ptr, memimg, memsize);
+ }
+ }
+ return val;
+ /* break; */
+ }
+
+ rb_raise(rb_eNameError, "undefined key `%s' for %s",
+ rb_id2name(id), rb_class2name(CLASS_OF(self)));
+
+ return Qnil;
+}
+
+VALUE
+rb_dlptr_size(int argc, VALUE argv[], VALUE self)
+{
+ VALUE size;
+
+ if (rb_scan_args(argc, argv, "01", &size) == 0){
+ return DLLONG2NUM(RDLPTR(self)->size);
+ }
+ else{
+ RDLPTR(self)->size = DLNUM2LONG(size);
+ return size;
+ }
+}
+
+static VALUE
+dlmem_each_i(VALUE assoc, void *data)
+{
+ VALUE key, val;
+ key = rb_ary_entry(assoc, 0);
+ val = rb_ary_entry(assoc, 1);
+ rb_yield(rb_assoc_new(key,(VALUE)DLNUM2LONG(val)));
+ return Qnil;
+}
+
+VALUE
+rb_dlmem_each(VALUE self)
+{
+ rb_iterate(rb_each, DLMemoryTable, dlmem_each_i, 0);
+ return Qnil;
+}
+
+void
+Init_dlptr()
+{
+ rb_cDLPtrData = rb_define_class_under(rb_mDL, "PtrData", rb_cObject);
+ rb_define_alloc_func(rb_cDLPtrData, rb_dlptr_s_allocate);
+ rb_define_singleton_method(rb_cDLPtrData, "malloc", rb_dlptr_s_malloc, -1);
+ rb_define_method(rb_cDLPtrData, "initialize", rb_dlptr_initialize, -1);
+ rb_define_method(rb_cDLPtrData, "free=", rb_dlptr_free_set, 1);
+ rb_define_method(rb_cDLPtrData, "free", rb_dlptr_free_get, 0);
+ rb_define_method(rb_cDLPtrData, "to_i", rb_dlptr_to_i, 0);
+ rb_define_method(rb_cDLPtrData, "ptr", rb_dlptr_ptr, 0);
+ rb_define_method(rb_cDLPtrData, "+@", rb_dlptr_ptr, 0);
+ rb_define_method(rb_cDLPtrData, "ref", rb_dlptr_ref, 0);
+ rb_define_method(rb_cDLPtrData, "-@", rb_dlptr_ref, 0);
+ rb_define_method(rb_cDLPtrData, "null?", rb_dlptr_null_p, 0);
+ rb_define_method(rb_cDLPtrData, "to_a", rb_dlptr_to_array, -1);
+ rb_define_method(rb_cDLPtrData, "to_s", rb_dlptr_to_s, -1);
+ rb_define_method(rb_cDLPtrData, "to_str", rb_dlptr_to_str, -1);
+ rb_define_method(rb_cDLPtrData, "inspect", rb_dlptr_inspect, 0);
+ rb_define_method(rb_cDLPtrData, "<=>", rb_dlptr_cmp, 1);
+ rb_define_method(rb_cDLPtrData, "==", rb_dlptr_eql, 1);
+ rb_define_method(rb_cDLPtrData, "eql?", rb_dlptr_eql, 1);
+ rb_define_method(rb_cDLPtrData, "+", rb_dlptr_plus, 1);
+ rb_define_method(rb_cDLPtrData, "-", rb_dlptr_minus, 1);
+ rb_define_method(rb_cDLPtrData, "define_data_type",
+ rb_dlptr_define_data_type, -1);
+ rb_define_method(rb_cDLPtrData, "struct!", rb_dlptr_define_struct, -1);
+ rb_define_method(rb_cDLPtrData, "union!", rb_dlptr_define_union, -1);
+ rb_define_method(rb_cDLPtrData, "data_type", rb_dlptr_get_data_type, 0);
+ rb_define_method(rb_cDLPtrData, "[]", rb_dlptr_aref, -1);
+ rb_define_method(rb_cDLPtrData, "[]=", rb_dlptr_aset, -1);
+ rb_define_method(rb_cDLPtrData, "size", rb_dlptr_size, -1);
+ 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);
+ rb_define_module_function(rb_mDLMemorySpace, "each", rb_dlmem_each, 0);
+}
diff --git a/ext/dl/sample/c++sample.C b/ext/dl/sample/c++sample.C
new file mode 100644
index 0000000000..d083d337a7
--- /dev/null
+++ b/ext/dl/sample/c++sample.C
@@ -0,0 +1,35 @@
+#include <stdio.h>
+
+class Person {
+private:
+ const char *name;
+ int age;
+
+public:
+ Person(const char *name, int age);
+ const char * get_name();
+ int get_age();
+ void set_age(int i);
+};
+
+Person::Person(const char *name, int age)
+ : name(name), age(age)
+{
+ /* empty */
+}
+
+const char *
+Person::get_name()
+{
+ return name;
+}
+
+int
+Person::get_age(){
+ return age;
+}
+
+void
+Person::set_age(int i){
+ age = i;
+}
diff --git a/ext/dl/sample/c++sample.rb b/ext/dl/sample/c++sample.rb
new file mode 100644
index 0000000000..29887df845
--- /dev/null
+++ b/ext/dl/sample/c++sample.rb
@@ -0,0 +1,60 @@
+=begin
+ This script shows how to deal with C++ classes using Ruby/DL.
+ You must build a dynamic loadable library using "c++sample.C"
+ to run this script as follows:
+ $ g++ -o libsample.so -shared c++sample.C
+=end
+
+require 'dl'
+require 'dl/import'
+require 'dl/struct'
+
+# Give a name of dynamic loadable library
+LIBNAME = ARGV[0] || "libsample.so"
+
+class Person
+ module Core
+ extend DL::Importable
+
+ dlload LIBNAME
+
+ # mangled symbol names
+ extern "void __6PersonPCci(void *, const char *, int)"
+ extern "const char *get_name__6Person(void *)"
+ extern "int get_age__6Person(void *)"
+ extern "void set_age__6Personi(void *, int)"
+
+ Data = struct [
+ "char *name",
+ "int age",
+ ]
+ end
+
+ def initialize(name, age)
+ @ptr = Core::Data.alloc
+ Core::__6PersonPCci(@ptr, name, age)
+ end
+
+ def get_name()
+ str = Core::get_name__6Person(@ptr)
+ if( str )
+ str.to_s
+ else
+ nil
+ end
+ end
+
+ def get_age()
+ Core::get_age__6Person(@ptr)
+ end
+
+ def set_age(age)
+ Core::set_age__6Personi(@ptr, age)
+ end
+end
+
+obj = Person.new("ttate", 1)
+p obj.get_name()
+p obj.get_age()
+obj.set_age(10)
+p obj.get_age()
diff --git a/ext/dl/sample/drives.rb b/ext/dl/sample/drives.rb
new file mode 100644
index 0000000000..8a590404b1
--- /dev/null
+++ b/ext/dl/sample/drives.rb
@@ -0,0 +1,70 @@
+# -*- ruby -*-
+# drives.rb -- find existing drives and show the drive type.
+
+require 'dl'
+require 'dl/import'
+
+module Kernel32
+ extend DL::Importable
+
+ dlload "kernel32"
+
+ extern "long GetLogicalDrives()"
+ extern "int GetDriveType(char*)"
+ extern "long GetDiskFreeSpace(char*, long ref, long ref, long ref, long ref)"
+end
+
+include Kernel32
+
+buff = Kernel32.getLogicalDrives()
+
+i = 0
+ds = []
+while( i < 26 )
+ mask = (1 << i)
+ if( buff & mask > 0 )
+ ds.push((65+i).chr)
+ end
+ i += 1
+end
+
+=begin
+From the cygwin's /usr/include/w32api/winbase.h:
+#define DRIVE_UNKNOWN 0
+#define DRIVE_NO_ROOT_DIR 1
+#define DRIVE_REMOVABLE 2
+#define DRIVE_FIXED 3
+#define DRIVE_REMOTE 4
+#define DRIVE_CDROM 5
+#define DRIVE_RAMDISK 6
+=end
+
+types = [
+ "unknown",
+ "no root dir",
+ "Removable",
+ "Fixed",
+ "Remote",
+ "CDROM",
+ "RAM",
+]
+print("Drive : Type (Free Space/Available Space)\n")
+ds.each{|d|
+ t = Kernel32.getDriveType(d + ":\\")
+ Kernel32.getDiskFreeSpace(d + ":\\", 0, 0, 0, 0)
+ _,sec_per_clus,byte_per_sec,free_clus,total_clus = Kernel32._args_
+ fbytes = sec_per_clus * byte_per_sec * free_clus
+ tbytes = sec_per_clus * byte_per_sec * total_clus
+ unit = "B"
+ if( fbytes > 1024 && tbytes > 1024 )
+ fbytes = fbytes / 1024
+ tbytes = tbytes / 1024
+ unit = "K"
+ end
+ if( fbytes > 1024 && tbytes > 1024 )
+ fbytes = fbytes / 1024
+ tbytes = tbytes / 1024
+ unit = "M"
+ end
+ print("#{d} : #{types[t]} (#{fbytes} #{unit}/#{tbytes} #{unit})\n")
+}
diff --git a/ext/dl/sample/getch.rb b/ext/dl/sample/getch.rb
new file mode 100644
index 0000000000..3f7261c979
--- /dev/null
+++ b/ext/dl/sample/getch.rb
@@ -0,0 +1,5 @@
+require 'dl'
+
+crtdll = DL::dlopen("crtdll")
+getch = crtdll['_getch', 'L']
+print(getch.call, "\n")
diff --git a/ext/dl/sample/libc.rb b/ext/dl/sample/libc.rb
new file mode 100644
index 0000000000..a1f6fbe543
--- /dev/null
+++ b/ext/dl/sample/libc.rb
@@ -0,0 +1,69 @@
+require "dl/import"
+require "dl/struct"
+
+module LIBC
+ extend DL::Importable
+
+ begin
+ dlload "libc.so.6"
+ rescue
+ dlload "libc.so.5"
+ end
+
+ extern "int atoi(char*)"
+ extern "ibool isdigit(int)"
+ extern "int gettimeofday(struct timeval *, struct timezone *)"
+ extern "char* strcat(char*, char*)"
+ extern "FILE* fopen(char*, char*)"
+ extern "int fclose(FILE*)"
+ extern "int fgetc(FILE*)"
+ extern "int strlen(char*)"
+ extern "void qsort(void*, int, int, void*)"
+
+ def str_qsort(ary, comp)
+ len = ary.length
+ r,rs = qsort(ary, len, DL.sizeof('P'), comp)
+ return rs[0].to_a('S', len)
+ end
+
+ Timeval = struct [
+ "long tv_sec",
+ "long tv_usec",
+ ]
+
+ Timezone = struct [
+ "int tz_minuteswest",
+ "int tz_dsttime",
+ ]
+
+ def my_compare(ptr1, ptr2)
+ ptr1.ptr.to_s <=> ptr2.ptr.to_s
+ end
+ COMPARE = callback("int my_compare(char**, char**)")
+end
+
+
+$cb1 = DL.callback('IPP'){|ptr1, ptr2|
+ str1 = ptr1.ptr.to_s
+ str2 = ptr2.ptr.to_s
+ str1 <=> str2
+}
+
+p LIBC.atoi("10")
+
+p LIBC.isdigit(?1)
+
+p LIBC.isdigit(?a)
+
+p LIBC.strcat("a", "b")
+
+ary = ["a","c","b"]
+ptr = ary.to_ptr
+LIBC.qsort(ptr, ary.length, DL.sizeof('P'), LIBC::COMPARE)
+p ptr.to_a('S', ary.length)
+
+tv = LIBC::Timeval.malloc
+tz = LIBC::Timezone.malloc
+LIBC.gettimeofday(tv, tz)
+
+p Time.at(tv.tv_sec)
diff --git a/ext/dl/sample/msgbox.rb b/ext/dl/sample/msgbox.rb
new file mode 100644
index 0000000000..091e646091
--- /dev/null
+++ b/ext/dl/sample/msgbox.rb
@@ -0,0 +1,19 @@
+# This script works on Windows.
+
+require 'dl'
+
+User32 = DL.dlopen("user32")
+Kernel32 = DL.dlopen("kernel32")
+
+MB_OK = 0
+MB_OKCANCEL = 1
+
+message_box = User32['MessageBoxA', 'ILSSI']
+r,rs = message_box.call(0, 'ok?', 'error', MB_OKCANCEL)
+
+case r
+when 1
+ print("OK!\n")
+when 2
+ print("Cancel!\n")
+end
diff --git a/ext/dl/sample/msgbox2.rb b/ext/dl/sample/msgbox2.rb
new file mode 100644
index 0000000000..e49846cc5e
--- /dev/null
+++ b/ext/dl/sample/msgbox2.rb
@@ -0,0 +1,18 @@
+# This script works on Windows.
+
+require 'dl/win32'
+
+MB_OK = 0
+MB_OKCANCEL = 1
+
+message_box = Win32API.new("user32",'MessageBoxA', 'ISSI', 'I')
+r = message_box.call(0, 'ok?', 'error', MB_OKCANCEL)
+
+case r
+when 1
+ print("OK!\n")
+when 2
+ print("Cancel!\n")
+else
+ p r
+end
diff --git a/ext/dl/sample/stream.rb b/ext/dl/sample/stream.rb
new file mode 100644
index 0000000000..179836999d
--- /dev/null
+++ b/ext/dl/sample/stream.rb
@@ -0,0 +1,87 @@
+# -*- ruby -*-
+# Display a file name and stream names of a file with those size.
+
+require 'dl'
+require 'dl/import'
+
+module NTFS
+ extend DL::Importable
+
+ dlload "kernel32.dll"
+
+ OPEN_EXISTING = 3
+ GENERIC_READ = 0x80000000
+ BACKUP_DATA = 0x00000001
+ BACKUP_ALTERNATE_DATA = 0x00000004
+ FILE_SHARE_READ = 0x00000001
+ FILE_FLAG_BACKUP_SEMANTICS = 0x02000000
+
+ typealias "LPSECURITY_ATTRIBUTES", "void*"
+
+ extern "BOOL BackupRead(HANDLE, PBYTE, DWORD, PDWORD, BOOL, BOOL, PVOID)"
+ extern "BOOL BackupSeek(HANDLE, DWORD, DWORD, PDWORD, PDWORD, PVOID)"
+ extern "BOOL CloseHandle(HANDLE)"
+ extern "HANDLE CreateFile(LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES,
+ DWORD, DWORD, HANDLE)"
+
+ module_function
+
+ def streams(filename)
+ status = []
+ h = createFile(filename,GENERIC_READ,FILE_SHARE_READ,nil,
+ OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,0)
+ if( h != 0 )
+ begin
+ # allocate the memory for backup data used in backupRead().
+ data = DL.malloc(DL.sizeof("L5"))
+ data.struct!("LLLLL", :id, :attrs, :size_low, :size_high, :name_size)
+
+ # allocate memories for references to long values used in backupRead().
+ context = DL.malloc(DL.sizeof("L"))
+ lval = DL.malloc(DL.sizeof("L"))
+
+ while( backupRead(h, data, data.size, lval, false, false, context) )
+ size = data[:size_low] + (data[:size_high] << (DL.sizeof("I") * 8))
+ case data[:id]
+ when BACKUP_ALTERNATE_DATA
+ stream_name = DL.malloc(data[:name_size])
+ backupRead(h, stream_name, stream_name.size,
+ lval, false, false, context)
+ name = stream_name[0, stream_name.size]
+ name.tr!("\000","")
+ if( name =~ /^:(.*?):.*$/ )
+ status.push([$1,size])
+ end
+ when BACKUP_DATA
+ status.push([nil,size])
+ else
+ raise(RuntimeError, "unknown data type #{data[:id]}.")
+ end
+ l1 = DL.malloc(DL.sizeof("L"))
+ l2 = DL.malloc(DL.sizeof("L"))
+ if( !backupSeek(h, data[:size_low], data[:size_high], l1, l2, context) )
+ break
+ end
+ end
+ ensure
+ backupRead(h, nil, 0, lval, true, false, context)
+ closeHandle(h)
+ end
+ return status
+ else
+ raise(RuntimeError, "can't open #{filename}.\n")
+ end
+ end
+end
+
+ARGV.each{|filename|
+ if( File.exist?(filename) )
+ NTFS.streams(filename).each{|name,size|
+ if( name )
+ print("#{filename}:#{name}\t#{size}bytes\n")
+ else
+ print("#{filename}\t#{size}bytes\n")
+ end
+ }
+ end
+}
diff --git a/ext/dl/sym.c b/ext/dl/sym.c
new file mode 100644
index 0000000000..c2f5434c61
--- /dev/null
+++ b/ext/dl/sym.c
@@ -0,0 +1,990 @@
+/* -*- C -*-
+ * $Id$
+ */
+
+#include <ruby.h>
+#include <errno.h>
+#include "dl.h"
+
+VALUE rb_cDLSymbol;
+
+static const char *
+char2type(int ch)
+{
+ switch (ch) {
+ case '0':
+ return "void";
+ case 'P':
+ return "void *";
+ case 'p':
+ return "void *";
+ case 'C':
+ return "char";
+ case 'c':
+ return "char *";
+ case 'H':
+ return "short";
+ case 'h':
+ return "short *";
+ case 'I':
+ return "int";
+ case 'i':
+ return "int *";
+ case 'L':
+ return "long";
+ case 'l':
+ return "long *";
+ case 'F':
+ return "double";
+ case 'f':
+ return "double *";
+ case 'D':
+ return "double";
+ case 'd':
+ return "double *";
+ case 'S':
+ return "const char *";
+ case 's':
+ return "char *";
+ case 'A':
+ return "[]";
+ case 'a':
+ return "[]"; /* ?? */
+ }
+ return NULL;
+}
+
+void
+dlsym_free(struct sym_data *data)
+{
+ if( data->name ){
+ DEBUG_CODE({
+ printf("dlsym_free(): free(data->name:%s)\n",data->name);
+ });
+ free(data->name);
+ }
+ if( data->type ){
+ DEBUG_CODE({
+ printf("dlsym_free(): free(data->type:%s)\n",data->type);
+ });
+ free(data->type);
+ }
+}
+
+VALUE
+rb_dlsym_new(void (*func)(), const char *name, const char *type)
+{
+ VALUE val;
+ struct sym_data *data;
+ const char *ptype;
+
+ rb_secure(4);
+ if( !type || !type[0] ){
+ return rb_dlptr_new((void*)func, 0, 0);
+ }
+
+ for( ptype = type; *ptype; ptype ++ ){
+ if( ! char2type(*ptype) ){
+ rb_raise(rb_eDLTypeError, "unknown type specifier '%c'", *ptype);
+ }
+ }
+
+ if( func ){
+ val = Data_Make_Struct(rb_cDLSymbol, struct sym_data, 0, dlsym_free, data);
+ data->func = func;
+ data->name = name ? strdup(name) : NULL;
+ data->type = type ? strdup(type) : NULL;
+ data->len = type ? strlen(type) : 0;
+#if !(defined(DLSTACK))
+ if( data->len - 1 > MAX_ARG ){
+ rb_raise(rb_eDLError, "maximum number of arguments is %d.", MAX_ARG);
+ }
+#endif
+ }
+ else{
+ val = Qnil;
+ }
+
+ return val;
+}
+
+freefunc_t
+rb_dlsym2csym(VALUE val)
+{
+ struct sym_data *data;
+ freefunc_t func;
+
+ if( rb_obj_is_kind_of(val, rb_cDLSymbol) ){
+ Data_Get_Struct(val, struct sym_data, data);
+ func = data->func;
+ }
+ else if( val == Qnil ){
+ func = NULL;
+ }
+ else{
+ rb_raise(rb_eTypeError, "DL::Symbol was expected");
+ }
+
+ return func;
+}
+
+VALUE
+rb_dlsym_s_allocate(VALUE klass)
+{
+ VALUE obj;
+ struct sym_data *data;
+
+ obj = Data_Make_Struct(klass, struct sym_data, 0, dlsym_free, data);
+ data->func = 0;
+ data->name = 0;
+ data->type = 0;
+ data->len = 0;
+
+ return obj;
+}
+
+VALUE
+rb_dlsym_initialize(int argc, VALUE argv[], VALUE self)
+{
+ VALUE addr, name, type;
+ struct sym_data *data;
+ void *saddr;
+ const char *sname, *stype;
+
+ rb_scan_args(argc, argv, "12", &addr, &name, &type);
+
+ saddr = (void*)(DLNUM2LONG(rb_Integer(addr)));
+ sname = NIL_P(name) ? NULL : StringValuePtr(name);
+ stype = NIL_P(type) ? NULL : StringValuePtr(type);
+
+ if( saddr ){
+ Data_Get_Struct(self, struct sym_data, data);
+ if( data->name ) free(data->name);
+ if( data->type ) free(data->type);
+ data->func = saddr;
+ data->name = sname ? strdup(sname) : 0;
+ data->type = stype ? strdup(stype) : 0;
+ data->len = stype ? strlen(stype) : 0;
+ }
+
+ return Qnil;
+}
+
+VALUE
+rb_s_dlsym_char2type(VALUE self, VALUE ch)
+{
+ const char *type;
+
+ type = char2type(StringValuePtr(ch)[0]);
+
+ if (type == NULL)
+ return Qnil;
+ else
+ return rb_str_new2(type);
+}
+
+VALUE
+rb_dlsym_name(VALUE self)
+{
+ struct sym_data *sym;
+
+ Data_Get_Struct(self, struct sym_data, sym);
+ return sym->name ? rb_tainted_str_new2(sym->name) : Qnil;
+}
+
+VALUE
+rb_dlsym_proto(VALUE self)
+{
+ struct sym_data *sym;
+
+ Data_Get_Struct(self, struct sym_data, sym);
+ return sym->type ? rb_tainted_str_new2(sym->type) : Qnil;
+}
+
+VALUE
+rb_dlsym_cproto(VALUE self)
+{
+ struct sym_data *sym;
+ const char *ptype, *typestr;
+ size_t len;
+ VALUE val;
+
+ Data_Get_Struct(self, struct sym_data, sym);
+
+ ptype = sym->type;
+
+ if( ptype ){
+ typestr = char2type(*ptype++);
+ len = strlen(typestr);
+
+ val = rb_tainted_str_new(typestr, len);
+ if (typestr[len - 1] != '*')
+ rb_str_cat(val, " ", 1);
+
+ if( sym->name ){
+ rb_str_cat2(val, sym->name);
+ }
+ else{
+ rb_str_cat2(val, "(null)");
+ }
+ rb_str_cat(val, "(", 1);
+
+ while (*ptype) {
+ const char *ty = char2type(*ptype++);
+ rb_str_cat2(val, ty);
+ if (*ptype)
+ rb_str_cat(val, ", ", 2);
+ }
+
+ rb_str_cat(val, ");", 2);
+ }
+ else{
+ val = rb_tainted_str_new2("void (");
+ if( sym->name ){
+ rb_str_cat2(val, sym->name);
+ }
+ else{
+ rb_str_cat2(val, "(null)");
+ }
+ rb_str_cat2(val, ")()");
+ }
+
+ return val;
+}
+
+VALUE
+rb_dlsym_inspect(VALUE self)
+{
+ VALUE proto;
+ VALUE val;
+ char *str;
+ int str_size;
+ struct sym_data *sym;
+
+ Data_Get_Struct(self, struct sym_data, sym);
+ proto = rb_dlsym_cproto(self);
+
+ str_size = RSTRING(proto)->len + 100;
+ str = dlmalloc(str_size);
+ snprintf(str, str_size - 1,
+ "#<DL::Symbol:0x%p func=0x%p '%s'>",
+ sym, sym->func, RSTRING(proto)->ptr);
+ val = rb_tainted_str_new2(str);
+ dlfree(str);
+
+ return val;
+}
+
+static int
+stack_size(struct sym_data *sym)
+{
+ int i;
+ int size;
+
+ size = 0;
+ for( i=1; i < sym->len; i++ ){
+ switch(sym->type[i]){
+ case 'C':
+ case 'H':
+ case 'I':
+ case 'L':
+ size += sizeof(long);
+ break;
+ case 'F':
+ size += sizeof(float);
+ break;
+ case 'D':
+ size += sizeof(double);
+ break;
+ case 'c':
+ case 'h':
+ case 'i':
+ case 'l':
+ case 'f':
+ case 'd':
+ case 'p':
+ case 'P':
+ case 's':
+ case 'S':
+ case 'a':
+ case 'A':
+ size += sizeof(void*);
+ break;
+ default:
+ return -(sym->type[i]);
+ }
+ }
+ return size;
+}
+
+static ID rb_dl_id_DLErrno;
+
+static VALUE
+rb_dl_get_last_error(VALUE self)
+{
+ return rb_thread_local_aref(rb_thread_current(), rb_dl_id_DLErrno);
+}
+
+static VALUE
+rb_dl_set_last_error(VALUE self, VALUE val)
+{
+ errno = NUM2INT(val);
+ rb_thread_local_aset(rb_thread_current(), rb_dl_id_DLErrno, val);
+ return Qnil;
+}
+
+#ifdef HAVE_WINDOWS_H
+#include <windows.h>
+static ID rb_dl_id_DLW32Error;
+
+static VALUE
+rb_dl_win32_get_last_error(VALUE self)
+{
+ return rb_thread_local_aref(rb_thread_current(), rb_dl_id_DLW32Error);
+}
+
+static VALUE
+rb_dl_win32_set_last_error(VALUE self, VALUE val)
+{
+ SetLastError(NUM2INT(val));
+ rb_thread_local_aset(rb_thread_current(), rb_dl_id_DLW32Error, val);
+ return Qnil;
+}
+#endif
+
+#ifdef DLSTACK_GUARD
+# ifdef __MSVC_RUNTIME_CHECKS
+# pragma runtime_checks("s", off)
+# endif
+# if _MSC_VER >= 1300
+__declspec(noinline)
+# endif
+static int
+rb_dlsym_guardcall(char type, ANY_TYPE *ret, long *stack, void *func)
+{
+ char *volatile guard = ALLOCA_N(char, 1); /* guard stack pointer */
+ switch(type){
+ case '0':
+ {
+ void (*f)(DLSTACK_PROTO) = func;
+ f(DLSTACK_ARGS);
+ }
+ break;
+ case 'P':
+ case 'p':
+ {
+ void * (*f)(DLSTACK_PROTO) = func;
+ ret->p = f(DLSTACK_ARGS);
+ }
+ break;
+ case 'C':
+ case 'c':
+ {
+ char (*f)(DLSTACK_PROTO) = func;
+ ret->c = f(DLSTACK_ARGS);
+ }
+ break;
+ case 'H':
+ case 'h':
+ {
+ short (*f)(DLSTACK_PROTO) = func;
+ ret->h = f(DLSTACK_ARGS);
+ }
+ break;
+ case 'I':
+ case 'i':
+ {
+ int (*f)(DLSTACK_PROTO) = func;
+ ret->i = f(DLSTACK_ARGS);
+ }
+ break;
+ case 'L':
+ case 'l':
+ {
+ long (*f)(DLSTACK_PROTO) = func;
+ ret->l = f(DLSTACK_ARGS);
+ }
+ break;
+ case 'F':
+ case 'f':
+ {
+ float (*f)(DLSTACK_PROTO) = func;
+ ret->f = f(DLSTACK_ARGS);
+ }
+ break;
+ case 'D':
+ case 'd':
+ {
+ double (*f)(DLSTACK_PROTO) = func;
+ ret->d = f(DLSTACK_ARGS);
+ }
+ break;
+ case 'S':
+ case 's':
+ {
+ char * (*f)(DLSTACK_PROTO) = func;
+ ret->s = f(DLSTACK_ARGS);
+ }
+ break;
+ default:
+ return 0;
+ }
+ return 1;
+}
+# ifdef __MSVC_RUNTIME_CHECKS
+# pragma runtime_checks("s", restore)
+# endif
+#endif /* defined(DLSTACK_GUARD) */
+
+VALUE
+rb_dlsym_call(int argc, VALUE argv[], VALUE self)
+{
+ struct sym_data *sym;
+ ANY_TYPE *args;
+ ANY_TYPE *dargs;
+ ANY_TYPE ret;
+ int *dtypes;
+ VALUE val;
+ VALUE dvals;
+ int i;
+ long ftype;
+ void *func;
+
+ rb_secure_update(self);
+ Data_Get_Struct(self, struct sym_data, sym);
+ DEBUG_CODE({
+ printf("rb_dlsym_call(): type = '%s', func = 0x%x\n", sym->type, sym->func);
+ });
+ if( (sym->len - 1) != argc ){
+ rb_raise(rb_eArgError, "%d arguments are needed", sym->len - 1);
+ }
+
+ ftype = 0;
+ dvals = Qnil;
+
+ args = ALLOC_N(ANY_TYPE, sym->len - 1);
+ dargs = ALLOC_N(ANY_TYPE, sym->len - 1);
+ dtypes = ALLOC_N(int, sym->len - 1);
+#define FREE_ARGS {xfree(args); xfree(dargs); xfree(dtypes);}
+
+ for( i = sym->len - 2; i >= 0; i-- ){
+ dtypes[i] = 0;
+
+ switch( sym->type[i+1] ){
+ case 'p':
+ dtypes[i] = 'p';
+ case 'P':
+ {
+ struct ptr_data *data;
+ VALUE pval;
+
+ if( argv[i] == Qnil ){
+ ANY2P(args[i]) = DLVOIDP(0);
+ }
+ else{
+ if( rb_obj_is_kind_of(argv[i], rb_cDLPtrData) ){
+ pval = argv[i];
+ }
+ else{
+ pval = rb_funcall(argv[i], rb_intern("to_ptr"), 0);
+ if( !rb_obj_is_kind_of(pval, rb_cDLPtrData) ){
+ rb_raise(rb_eDLTypeError, "unexpected type of argument #%d", i);
+ }
+ }
+ Data_Get_Struct(pval, struct ptr_data, data);
+ ANY2P(args[i]) = DLVOIDP(data->ptr);
+ }
+ }
+ PUSH_P(ftype);
+ break;
+ case 'a':
+ dtypes[i] = 'a';
+ case 'A':
+ if( argv[i] == Qnil ){
+ ANY2P(args[i]) = DLVOIDP(0);
+ }
+ else{
+ ANY2P(args[i]) = DLVOIDP(rb_ary2cary(0, argv[i], NULL));
+ }
+ PUSH_P(ftype);
+ break;
+ case 'C':
+ ANY2C(args[i]) = DLCHAR(NUM2CHR(argv[i]));
+ PUSH_C(ftype);
+ break;
+ case 'c':
+ ANY2C(dargs[i]) = DLCHAR(NUM2CHR(argv[i]));
+ ANY2P(args[i]) = DLVOIDP(&(ANY2C(dargs[i])));
+ dtypes[i] = 'c';
+ PUSH_P(ftype);
+ break;
+ case 'H':
+ ANY2H(args[i]) = DLSHORT(NUM2INT(argv[i]));
+ PUSH_C(ftype);
+ break;
+ case 'h':
+ ANY2H(dargs[i]) = DLSHORT(NUM2INT(argv[i]));
+ ANY2P(args[i]) = DLVOIDP(&(ANY2H(dargs[i])));
+ dtypes[i] = 'h';
+ PUSH_P(ftype);
+ break;
+ case 'I':
+ ANY2I(args[i]) = DLINT(NUM2INT(argv[i]));
+ PUSH_I(ftype);
+ break;
+ case 'i':
+ ANY2I(dargs[i]) = DLINT(NUM2INT(argv[i]));
+ ANY2P(args[i]) = DLVOIDP(&(ANY2I(dargs[i])));
+ dtypes[i] = 'i';
+ PUSH_P(ftype);
+ break;
+ case 'L':
+ ANY2L(args[i]) = DLNUM2LONG(argv[i]);
+ PUSH_L(ftype);
+ break;
+ case 'l':
+ ANY2L(dargs[i]) = DLNUM2LONG(argv[i]);
+ ANY2P(args[i]) = DLVOIDP(&(ANY2L(dargs[i])));
+ dtypes[i] = 'l';
+ PUSH_P(ftype);
+ break;
+ case 'F':
+ Check_Type(argv[i], T_FLOAT);
+ ANY2F(args[i]) = DLFLOAT(RFLOAT(argv[i])->value);
+ PUSH_F(ftype);
+ break;
+ case 'f':
+ Check_Type(argv[i], T_FLOAT);
+ ANY2F(dargs[i]) = DLFLOAT(RFLOAT(argv[i])->value);
+ ANY2P(args[i]) = DLVOIDP(&(ANY2F(dargs[i])));
+ dtypes[i] = 'f';
+ PUSH_P(ftype);
+ break;
+ case 'D':
+ Check_Type(argv[i], T_FLOAT);
+ ANY2D(args[i]) = RFLOAT(argv[i])->value;
+ PUSH_D(ftype);
+ break;
+ case 'd':
+ Check_Type(argv[i], T_FLOAT);
+ ANY2D(dargs[i]) = RFLOAT(argv[i])->value;
+ ANY2P(args[i]) = DLVOIDP(&(ANY2D(dargs[i])));
+ dtypes[i] = 'd';
+ PUSH_P(ftype);
+ break;
+ case 'S':
+ if( argv[i] == Qnil ){
+ ANY2S(args[i]) = DLSTR(0);
+ }
+ else{
+ VALUE str = argv[i];
+ SafeStringValue(str);
+ ANY2S(args[i]) = DLSTR(RSTRING(str)->ptr);
+ }
+ PUSH_P(ftype);
+ break;
+ case 's':
+ {
+ VALUE str = argv[i];
+ SafeStringValue(str);
+ ANY2S(args[i]) = DLSTR(dlmalloc(RSTRING(str)->len + 1));
+ memcpy((char*)(ANY2S(args[i])), RSTRING(str)->ptr, RSTRING(str)->len + 1);
+ dtypes[i] = 's';
+ }
+ PUSH_P(ftype);
+ break;
+ default:
+ FREE_ARGS;
+ rb_raise(rb_eDLTypeError,
+ "unknown type '%c' of the return value.",
+ sym->type[i+1]);
+ }
+ }
+
+ switch( sym->type[0] ){
+ case '0':
+ PUSH_0(ftype);
+ break;
+ case 'P':
+ case 'p':
+ case 'S':
+ case 's':
+ case 'A':
+ case 'a':
+ PUSH_P(ftype);
+ break;
+ case 'C':
+ case 'c':
+ PUSH_C(ftype);
+ break;
+ case 'H':
+ case 'h':
+ PUSH_H(ftype);
+ break;
+ case 'I':
+ case 'i':
+ PUSH_I(ftype);
+ break;
+ case 'L':
+ case 'l':
+ PUSH_L(ftype);
+ break;
+ case 'F':
+ case 'f':
+ PUSH_F(ftype);
+ break;
+ case 'D':
+ case 'd':
+ PUSH_D(ftype);
+ break;
+ default:
+ FREE_ARGS;
+ rb_raise(rb_eDLTypeError,
+ "unknown type `%c' of the return value.",
+ sym->type[0]);
+ }
+
+ func = sym->func;
+
+#if defined(DLSTACK)
+ {
+#if defined(DLSTACK_SIZE)
+ int stk_size;
+ long stack[DLSTACK_SIZE];
+ long *sp;
+
+ sp = stack;
+ stk_size = stack_size(sym);
+ if( stk_size < 0 ){
+ FREE_ARGS;
+ rb_raise(rb_eDLTypeError, "unknown type '%c'.", -stk_size);
+ }
+ else if( stk_size > (int)(DLSTACK_SIZE) ){
+ FREE_ARGS;
+ rb_raise(rb_eArgError, "too many arguments.");
+ }
+#endif
+
+ DLSTACK_START(sym);
+
+#if defined(DLSTACK_REVERSE)
+ for( i = sym->len - 2; i >= 0; i-- )
+#else
+ for( i = 0; i <= sym->len -2; i++ )
+#endif
+ {
+ switch( sym->type[i+1] ){
+ case 'p':
+ case 'P':
+ DLSTACK_PUSH_P(ANY2P(args[i]));
+ break;
+ case 'a':
+ case 'A':
+ DLSTACK_PUSH_P(ANY2P(args[i]));
+ break;
+ case 'C':
+ DLSTACK_PUSH_C(ANY2C(args[i]));
+ break;
+ case 'c':
+ DLSTACK_PUSH_P(ANY2P(args[i]));
+ break;
+ case 'H':
+ DLSTACK_PUSH_H(ANY2H(args[i]));
+ break;
+ case 'h':
+ DLSTACK_PUSH_P(ANY2P(args[i]));
+ break;
+ case 'I':
+ DLSTACK_PUSH_I(ANY2I(args[i]));
+ break;
+ case 'i':
+ DLSTACK_PUSH_P(ANY2P(args[i]));
+ break;
+ case 'L':
+ DLSTACK_PUSH_L(ANY2L(args[i]));
+ break;
+ case 'l':
+ DLSTACK_PUSH_P(ANY2P(args[i]));
+ break;
+ case 'F':
+ DLSTACK_PUSH_F(ANY2F(args[i]));
+ break;
+ case 'f':
+ DLSTACK_PUSH_P(ANY2P(args[i]));
+ break;
+ case 'D':
+ DLSTACK_PUSH_D(ANY2D(args[i]));
+ break;
+ case 'd':
+ DLSTACK_PUSH_P(ANY2P(args[i]));
+ break;
+ case 'S':
+ case 's':
+ DLSTACK_PUSH_P(ANY2S(args[i]));
+ break;
+ }
+ }
+ DLSTACK_END(sym->type);
+
+#ifdef DLSTACK_GUARD
+ if(!rb_dlsym_guardcall(sym->type[0], &ret, stack, func)) {
+ FREE_ARGS;
+ rb_raise(rb_eDLTypeError, "unknown type `%c'", sym->type[0]);
+ }
+#else /* defined(DLSTACK_GUARD) */
+ {
+ switch( sym->type[0] ){
+ case '0':
+ {
+ void (*f)(DLSTACK_PROTO) = func;
+ f(DLSTACK_ARGS);
+ }
+ break;
+ case 'P':
+ case 'p':
+ {
+ void * (*f)(DLSTACK_PROTO) = func;
+ ret.p = f(DLSTACK_ARGS);
+ }
+ break;
+ case 'C':
+ case 'c':
+ {
+ char (*f)(DLSTACK_PROTO) = func;
+ ret.c = f(DLSTACK_ARGS);
+ }
+ break;
+ case 'H':
+ case 'h':
+ {
+ short (*f)(DLSTACK_PROTO) = func;
+ ret.h = f(DLSTACK_ARGS);
+ }
+ break;
+ case 'I':
+ case 'i':
+ {
+ int (*f)(DLSTACK_PROTO) = func;
+ ret.i = f(DLSTACK_ARGS);
+ }
+ break;
+ case 'L':
+ case 'l':
+ {
+ long (*f)(DLSTACK_PROTO) = func;
+ ret.l = f(DLSTACK_ARGS);
+ }
+ break;
+ case 'F':
+ case 'f':
+ {
+ float (*f)(DLSTACK_PROTO) = func;
+ ret.f = f(DLSTACK_ARGS);
+ }
+ break;
+ case 'D':
+ case 'd':
+ {
+ double (*f)(DLSTACK_PROTO) = func;
+ ret.d = f(DLSTACK_ARGS);
+ }
+ break;
+ case 'S':
+ case 's':
+ {
+ char * (*f)(DLSTACK_PROTO) = func;
+ ret.s = f(DLSTACK_ARGS);
+ }
+ break;
+ default:
+ FREE_ARGS;
+ rb_raise(rb_eDLTypeError, "unknown type `%c'", sym->type[0]);
+ }
+ }
+#endif /* defubed(DLSTACK_GUARD) */
+
+ {
+ /*
+ * We should get the value of errno/GetLastError() before calling another functions.
+ */
+ int last_errno = errno;
+#ifdef _WIN32
+ DWORD win32_last_err = GetLastError();
+#endif
+
+ rb_thread_local_aset(rb_thread_current(), rb_dl_id_DLErrno, INT2NUM(last_errno));
+#ifdef _WIN32
+ rb_thread_local_aset(rb_thread_current(), rb_dl_id_DLW32Error, INT2NUM(win32_last_err));
+#endif
+ }
+
+ }
+#else /* defined(DLSTACK) */
+ switch(ftype){
+#include "call.func"
+ default:
+ FREE_ARGS;
+ rb_raise(rb_eDLTypeError, "unsupported function type `%s'", sym->type);
+ }
+#endif /* defined(DLSTACK) */
+
+ switch( sym->type[0] ){
+ case '0':
+ val = Qnil;
+ break;
+ case 'P':
+ val = rb_dlptr_new((void*)(ANY2P(ret)), 0, 0);
+ break;
+ case 'p':
+ val = rb_dlptr_new((void*)(ANY2P(ret)), 0, dlfree);
+ break;
+ case 'C':
+ case 'c':
+ val = CHR2FIX((char)(ANY2C(ret)));
+ break;
+ case 'H':
+ case 'h':
+ val = INT2NUM((short)(ANY2H(ret)));
+ break;
+ case 'I':
+ case 'i':
+ val = INT2NUM((int)(ANY2I(ret)));
+ break;
+ case 'L':
+ case 'l':
+ val = DLLONG2NUM((long)(ANY2L(ret)));
+ break;
+ case 'F':
+ case 'f':
+ val = rb_float_new((double)(ANY2F(ret)));
+ break;
+ case 'D':
+ case 'd':
+ val = rb_float_new((double)(ANY2D(ret)));
+ break;
+ case 'S':
+ if( ANY2S(ret) ){
+ val = rb_tainted_str_new2((char*)(ANY2S(ret)));
+ }
+ else{
+ val = Qnil;
+ }
+ break;
+ case 's':
+ if( ANY2S(ret) ){
+ val = rb_tainted_str_new2((char*)(ANY2S(ret)));
+ DEBUG_CODE({
+ printf("dlfree(%s)\n",(char*)(ANY2S(ret)));
+ });
+ dlfree((void*)(ANY2S(ret)));
+ }
+ else{
+ val = Qnil;
+ }
+ break;
+ default:
+ FREE_ARGS;
+ rb_raise(rb_eDLTypeError, "unknown type `%c'", sym->type[0]);
+ }
+
+ dvals = rb_ary_new();
+ for( i = 0; i <= sym->len - 2; i++ ){
+ if( dtypes[i] ){
+ switch( dtypes[i] ){
+ case 'c':
+ rb_ary_push(dvals, CHR2FIX(*((char*)(ANY2P(args[i])))));
+ break;
+ case 'h':
+ rb_ary_push(dvals, INT2NUM(*((short*)(ANY2P(args[i])))));
+ break;
+ case 'i':
+ rb_ary_push(dvals, INT2NUM(*((int*)(ANY2P(args[i])))));
+ break;
+ case 'l':
+ rb_ary_push(dvals, DLLONG2NUM(*((long*)(ANY2P(args[i])))));
+ break;
+ case 'f':
+ rb_ary_push(dvals, rb_float_new(*((float*)(ANY2P(args[i])))));
+ break;
+ case 'd':
+ rb_ary_push(dvals, rb_float_new(*((double*)(ANY2P(args[i])))));
+ break;
+ case 'p':
+ rb_ary_push(dvals, rb_dlptr_new((void*)(ANY2P(args[i])), 0, 0));
+ break;
+ case 'a':
+ rb_ary_push(dvals, rb_dlptr_new((void*)ANY2P(args[i]), 0, 0));
+ break;
+ case 's':
+ rb_ary_push(dvals, rb_tainted_str_new2((char*)ANY2S(args[i])));
+ DEBUG_CODE({
+ printf("dlfree(%s)\n",(char*)ANY2S(args[i]));
+ });
+ dlfree((void*)ANY2S(args[i]));
+ break;
+ default:
+ {
+ char c = dtypes[i];
+ FREE_ARGS;
+ rb_raise(rb_eRuntimeError, "unknown argument type '%c'", i, c);
+ }
+ }
+ }
+ else{
+ switch( sym->type[i+1] ){
+ case 'A':
+ dlfree((void*)ANY2P(args[i]));
+ break;
+ }
+ rb_ary_push(dvals, argv[i]);
+ }
+ }
+
+#undef FREE_ARGS
+ return rb_assoc_new(val,dvals);
+}
+
+VALUE
+rb_dlsym_to_i(VALUE self)
+{
+ struct sym_data *sym;
+
+ Data_Get_Struct(self, struct sym_data, sym);
+ return DLLONG2NUM(sym);
+}
+
+VALUE
+rb_dlsym_to_ptr(VALUE self)
+{
+ struct sym_data *sym;
+
+ Data_Get_Struct(self, struct sym_data, sym);
+ return rb_dlptr_new(sym->func, sizeof(freefunc_t), 0);
+}
+
+void
+Init_dlsym()
+{
+ rb_cDLSymbol = rb_define_class_under(rb_mDL, "Symbol", rb_cObject);
+ rb_define_alloc_func(rb_cDLSymbol, rb_dlsym_s_allocate);
+ rb_define_singleton_method(rb_cDLSymbol, "char2type", rb_s_dlsym_char2type, 1);
+ rb_define_method(rb_cDLSymbol, "initialize", rb_dlsym_initialize, -1);
+ rb_define_method(rb_cDLSymbol, "call", rb_dlsym_call, -1);
+ rb_define_method(rb_cDLSymbol, "[]", rb_dlsym_call, -1);
+ rb_define_method(rb_cDLSymbol, "name", rb_dlsym_name, 0);
+ rb_define_method(rb_cDLSymbol, "proto", rb_dlsym_proto, 0);
+ rb_define_method(rb_cDLSymbol, "cproto", rb_dlsym_cproto, 0);
+ rb_define_method(rb_cDLSymbol, "inspect", rb_dlsym_inspect, 0);
+ rb_define_method(rb_cDLSymbol, "to_s", rb_dlsym_cproto, 0);
+ rb_define_method(rb_cDLSymbol, "to_ptr", rb_dlsym_to_ptr, 0);
+ rb_define_method(rb_cDLSymbol, "to_i", rb_dlsym_to_i, 0);
+
+ rb_dl_id_DLErrno = rb_intern("DLErrno");
+ rb_define_singleton_method(rb_mDL, "last_error", rb_dl_get_last_error, 0);
+ rb_define_singleton_method(rb_mDL, "last_error=", rb_dl_set_last_error, 1);
+#ifdef _WIN32
+ rb_dl_id_DLW32Error = rb_intern("DLW32Error");
+ rb_define_singleton_method(rb_mDL, "win32_last_error", rb_dl_win32_get_last_error, 0);
+ rb_define_singleton_method(rb_mDL, "win32_last_error=", rb_dl_win32_set_last_error, 1);
+#endif
+}
diff --git a/ext/dl/test/libtest.def b/ext/dl/test/libtest.def
new file mode 100644
index 0000000000..8ecefc917b
--- /dev/null
+++ b/ext/dl/test/libtest.def
@@ -0,0 +1,28 @@
+EXPORTS
+test_alloc_test_struct
+test_append
+test_arylen
+test_c2i
+test_call_func1
+test_callback1
+test_close
+test_d2f
+test_f2d
+test_fill_test_struct
+test_fill_test_union
+test_gets
+test_i2c
+test_init
+test_isucc
+test_lcc
+test_lsucc
+test_open
+test_strcat
+test_strlen
+test_succ
+test_data_init
+test_data_add
+test_data_aref
+test_set_long_value
+test_get_long_value
+internal_long_value
diff --git a/ext/dl/test/test.c b/ext/dl/test/test.c
new file mode 100644
index 0000000000..7321379390
--- /dev/null
+++ b/ext/dl/test/test.c
@@ -0,0 +1,247 @@
+#include <stdio.h>
+#include <string.h>
+
+static char internal_string[] = "internal_string";
+long internal_long_value = 100;
+
+struct test_struct {
+ char c;
+ long l;
+};
+
+union test_union {
+ char c;
+ int i;
+ long l;
+ void *p;
+};
+
+struct test_data {
+ char name[1024];
+ struct test_data *next;
+};
+
+long
+test_get_long_value()
+{
+ return internal_long_value;
+};
+
+void
+test_set_long_value(long l)
+{
+ internal_long_value = l;
+};
+
+void
+test_fill_test_struct(struct test_struct *ptr, char c, long l)
+{
+ ptr->c = c;
+ ptr->l = l;
+};
+
+void
+test_fill_test_union(union test_union *ptr, long l)
+{
+ ptr->l = l;
+};
+
+struct test_struct *
+test_alloc_test_struct(char c, long l)
+{
+ struct test_struct *data;
+
+ data = (struct test_struct *)malloc(sizeof(struct test_struct));
+ data->c = c;
+ data->l = l;
+
+ return data;
+};
+
+int
+test_c2i(char c)
+{
+ return (int)c;
+};
+
+char
+test_i2c(int i)
+{
+ return (char)i;
+};
+
+long
+test_lcc(char c1, char c2)
+{
+ return (long)(c1 + c2);
+};
+
+double
+test_f2d(float f)
+{
+ double d;
+ d = f;
+ return d;
+};
+
+float
+test_d2f(double d)
+{
+ float f;
+ f = d;
+ return f;
+};
+
+int
+test_strlen(const char *str)
+{
+ return strlen(str);
+};
+
+int
+test_isucc(int i)
+{
+ return (i+1);
+};
+
+long
+test_lsucc(long l)
+{
+ return (l+1);
+};
+
+void
+test_succ(long *l)
+{
+ (*l)++;
+};
+
+char *
+test_strcat(char *str1, const char *str2)
+{
+ return strcat(str1, str2);
+};
+
+int
+test_arylen(char *ary[])
+{
+ int i;
+ for( i=0; ary[i]; i++ ){};
+ return i;
+};
+
+void
+test_append(char *ary[], int len, char *astr)
+{
+ int i;
+ int size1,size2;
+ char *str;
+
+ size2 = strlen(astr);
+
+ for( i=0; i <= len - 1; i++ ){
+ size1 = strlen(ary[i]);
+ str = (char*)malloc(size1 + size2 + 1);
+ strcpy(str, ary[i]);
+ strcat(str, astr);
+ ary[i] = str;
+ };
+};
+
+int
+test_init(int *argc, char **argv[])
+{
+ int i;
+ char s[256];
+
+ for( i=0; i < (*argc); i++ ){
+ sprintf(s, "arg%d", i);
+ if( strcmp((*argv)[i], s) != 0 ){
+ return 1;
+ }
+ }
+ return 0;
+}
+
+FILE *
+test_open(const char *filename, const char *mode)
+{
+ FILE *file;
+ file = fopen(filename,mode);
+ return file;
+};
+
+void
+test_close(FILE *file)
+{
+ fclose(file);
+};
+
+char *
+test_gets(char *s, int size, FILE *f)
+{
+ return fgets(s,size,f);
+};
+
+typedef int callback1_t(int, char *);
+#define CALLBACK_MSG "callback message"
+
+int
+test_callback1(int err, const char *msg)
+{
+ if( strcmp(msg, CALLBACK_MSG) == 0 ){
+ return 1;
+ }
+ else{
+ return 0;
+ }
+}
+
+int
+test_call_func1(callback1_t *func)
+{
+ if( func ){
+ return (*func)(0, CALLBACK_MSG);
+ }
+ else{
+ return 0;
+ }
+}
+
+struct test_data *
+test_data_init()
+{
+ struct test_data *data;
+
+ data = (struct test_data *)malloc(sizeof(struct test_data));
+ data->next = NULL;
+ memset(data->name, 0, 1024);
+
+ return data;
+};
+
+void
+test_data_add(struct test_data *list, const char *name)
+{
+ struct test_data *data;
+
+ data = (struct test_data *)malloc(sizeof(struct test_data));
+ memset(data->name, 0, 1024);
+ strncpy(data->name, name, 1024);
+ data->next = list->next;
+ list->next = data;
+};
+
+struct test_data *
+test_data_aref(struct test_data *list, int i)
+{
+ struct test_data *data;
+ int j;
+
+ for( data = list->next, j=0; data; data = data->next, j++ ){
+ if( i == j ){
+ return data;
+ };
+ };
+ return NULL;
+};
diff --git a/ext/dl/test/test.rb b/ext/dl/test/test.rb
new file mode 100644
index 0000000000..52be04699f
--- /dev/null
+++ b/ext/dl/test/test.rb
@@ -0,0 +1,295 @@
+# -*- ruby -*-
+
+require 'dl'
+require 'dl/import'
+
+$FAIL = 0
+$TOTAL = 0
+
+def assert(label, ty, *conds)
+ $TOTAL += 1
+ cond = !conds.include?(false)
+ if( cond )
+ printf("succeed in `#{label}'\n")
+ else
+ $FAIL += 1
+ case ty
+ when :may
+ printf("fail in `#{label}' ... expected\n")
+ when :must
+ printf("fail in `#{label}' ... unexpected\n")
+ when :raise
+ raise(RuntimeError, "fail in `#{label}'")
+ end
+ end
+end
+
+def debug(*xs)
+ if( $DEBUG )
+ xs.each{|x|
+ p x
+ }
+ end
+end
+
+print("DLSTACK = #{DL::DLSTACK}\n")
+print("MAX_ARG = #{DL::MAX_ARG}\n")
+print("\n")
+print("DL::FREE = #{DL::FREE.inspect}\n")
+print("\n")
+
+$LIB = nil
+if( !$LIB && File.exist?("libtest.so") )
+ $LIB = "./libtest.so"
+end
+if( !$LIB && File.exist?("test/libtest.so") )
+ $LIB = "./test/libtest.so"
+end
+
+module LIBTest
+ extend DL::Importable
+
+ dlload($LIB)
+ extern "int test_c2i(char)"
+ extern "char test_i2c(int)"
+ extern "long test_lcc(char, char)"
+ extern "double test_f2d(float)"
+ extern "float test_d2f(double)"
+ extern "int test_strlen(char*)"
+ extern "int test_isucc(int)"
+ extern "long test_lsucc(long)"
+ extern "void test_succ(long *)"
+ extern "int test_arylen(int [])"
+ extern "void test_append(char*[], int, char *)"
+end
+
+DL.dlopen($LIB){|h|
+ c2i = h["test_c2i","IC"]
+ debug c2i
+ r,rs = c2i[?a]
+ debug r,rs
+ assert("c2i", :may, r == ?a)
+ assert("extern c2i", :must, r == LIBTest.test_c2i(?a))
+
+ i2c = h["test_i2c","CI"]
+ debug i2c
+ r,rs = i2c[?a]
+ debug r,rs
+ assert("i2c", :may, r == ?a)
+ assert("exern i2c", :must, r == LIBTest.test_i2c(?a))
+
+ lcc = h["test_lcc","LCC"]
+ debug lcc
+ r,rs = lcc[1,2]
+ assert("lcc", :may, r == 3)
+ assert("extern lcc", :must, r == LIBTest.test_lcc(1,2))
+
+ f2d = h["test_f2d","DF"]
+ debug f2d
+ r,rs = f2d[20.001]
+ debug r,rs
+ assert("f2d", :may, r.to_i == 20)
+ assert("extern f2d", :must, r = LIBTest.test_f2d(20.001))
+
+ d2f = h["test_d2f","FD"]
+ debug d2f
+ r,rs = d2f[20.001]
+ debug r,rs
+ assert("d2f", :may, r.to_i == 20)
+ assert("extern d2f", :must, r == LIBTest.test_d2f(20.001))
+
+ strlen = h["test_strlen","IS"]
+ debug strlen
+ r,rs = strlen["0123456789"]
+ debug r,rs
+ assert("strlen", :must, r == 10)
+ assert("extern strlen", :must, r == LIBTest.test_strlen("0123456789"))
+
+ isucc = h["test_isucc","II"]
+ debug isucc
+ r,rs = isucc[2]
+ debug r,rs
+ assert("isucc", :must, r == 3)
+ assert("extern isucc", :must, r == LIBTest.test_isucc(2))
+
+ lsucc = h["test_lsucc","LL"]
+ debug lsucc
+ r,rs = lsucc[10000000]
+ debug r,rs
+ assert("lsucc", :must, r == 10000001)
+ assert("extern lsucc", :must, r == LIBTest.test_lsucc(10000000))
+
+ succ = h["test_succ","0l"]
+ debug succ
+ r,rs = succ[0]
+ debug r,rs
+ assert("succ", :must, rs[0] == 1)
+ l = DL.malloc(DL.sizeof("L"))
+ l.struct!("L",:lval)
+ LIBTest.test_succ(l)
+ assert("extern succ", :must, rs[0] == l[:lval])
+
+ arylen = h["test_arylen","IA"]
+ debug arylen
+ r,rs = arylen[["a","b","c","d",nil]]
+ debug r,rs
+ assert("arylen", :must, r == 4)
+
+ arylen = h["test_arylen","IP"]
+ debug arylen
+ r,rs = arylen[["a","b","c","d",nil]]
+ debug r,rs
+ assert("arylen", :must, r == 4)
+ assert("extern arylen", :must, r == LIBTest.test_arylen(["a","b","c","d",nil]))
+
+ append = h["test_append","0aIS"]
+ debug append
+ r,rs = append[["a","b","c"],3,"x"]
+ debug r,rs
+ assert("append", :must, rs[0].to_a('S',3) == ["ax","bx","cx"])
+
+ LIBTest.test_append(["a","b","c"],3,"x")
+ assert("extern append", :must, rs[0].to_a('S',3) == LIBTest._args_[0].to_a('S',3))
+
+ strcat = h["test_strcat","SsS"]
+ debug strcat
+ r,rs = strcat["abc\0","x"]
+ debug r,rs
+ assert("strcat", :must, rs[0].to_s == "abcx")
+
+ init = h["test_init","IiP"]
+ debug init
+ argc = 3
+ argv = ["arg0","arg1","arg2"].to_ptr
+ r,rs = init[argc, argv.ref]
+ assert("init", :must, r == 0)
+}
+
+
+h = DL.dlopen($LIB)
+
+sym_open = h["test_open", "PSS"]
+sym_gets = h["test_gets", "SsIP"]
+sym_close = h["test_close", "0P"]
+debug sym_open,sym_gets,sym_close
+
+line = "Hello world!\n"
+File.open("tmp.txt", "w"){|f|
+ f.print(line)
+}
+
+fp,rs = sym_open["tmp.txt", "r"]
+if( fp )
+ fp.free = sym_close
+ r,rs = sym_gets[" " * 256, 256, fp]
+ debug r,rs
+ assert("open,gets", :must, rs[0] == line)
+ ObjectSpace.define_finalizer(fp) {File.unlink("tmp.txt")}
+ fp = nil
+else
+ assert("open,gets", :must, line == nil)
+ File.unlink("tmp.txt")
+end
+
+
+callback1 = h["test_callback1"]
+debug callback1
+r,rs = h["test_call_func1", "IP"][callback1]
+debug r,rs
+assert("callback1", :must, r == 1)
+
+
+callback2 = DL.callback("LLP"){|num,ptr|
+ msg = ptr.to_s
+ if( msg == "callback message" )
+ 2
+ else
+ 0
+ end
+}
+debug callback2
+r,rs = h["test_call_func1", "IP"][callback2]
+debug r,rs
+assert("callback2", :must, r == 2)
+DL.remove_callback(callback2)
+
+ptr = DL.malloc(DL.sizeof('CL'))
+ptr.struct!("CL", :c, :l)
+ptr["c"] = 0
+ptr["l"] = 0
+r,rs = h["test_fill_test_struct","0PIL"][ptr,100,1000]
+debug r,rs
+assert("fill_test_struct", :must, ptr["c"] == 100, ptr["l"] == 1000)
+assert("fill_test_struct", :must, ptr[:c] == 100, ptr[:l] == 1000) unless (Fixnum === :-)
+
+
+r,rs = h["test_alloc_test_struct", "PIL"][100,200]
+r.free = DL::FREE
+r.struct!("CL", :c, :l)
+assert("alloc_test_struct", :must, r["c"] == 100, r["l"] == 200)
+assert("alloc_test_struct", :must, r[:c] == 100, r[:l] == 200) unless (Fixnum === :-)
+
+ptr = h["test_strlen"]
+sym1 = DL::Symbol.new(ptr,"foo","0")
+sym2 = h["test_strlen","LS"]
+assert("Symbol.new", :must, ptr == sym1.to_ptr, sym1.to_ptr == sym2.to_ptr)
+
+set_val = h["test_set_long_value","0"]
+get_val = h["test_get_long_value","L"]
+lval = get_val[][0]
+ptr = h["internal_long_value"]
+ptr.struct!("L", :l)
+assert("get value", :must, ptr["l"] == lval)
+assert("get value", :must, ptr[:l] == lval) unless (Fixnum === :-)
+ptr["l"] = 200
+lval = get_val[][0]
+assert("set value", :must, ptr["l"] == lval)
+assert("set value", :must, ptr[:l] == lval) unless (Fixnum === :-)
+
+
+data_init = h["test_data_init", "P"]
+data_add = h["test_data_add", "0PS"]
+data_aref = h["test_data_aref", "PPI"]
+r,rs = data_init[]
+ptr = r
+data_add[ptr, "name1"]
+data_add[ptr, "name2"]
+data_add[ptr, "name3"]
+
+r,rs = data_aref[ptr, 1]
+ptr = r
+ptr.struct!("C1024P", :name, :next)
+assert("data_aref", :must,
+ ptr["name"].collect{|c| c.chr}.join.split("\0")[0] == "name2")
+assert("data_aref", :must,
+ ptr["name"].collect{|c| c.chr}.join.split("\0")[0] == "name2") unless (Fixnum === :-)
+
+ptr = ptr["next"]
+ptr.struct!("C1024P", :name, :next)
+assert("data_aref", :must,
+ ptr["name"].collect{|c| c.chr}.join.split("\0")[0] == "name1")
+assert("data_aref", :must,
+ ptr["name"].collect{|c| c.chr}.join.split("\0")[0] == "name1") unless (Fixnum === :-)
+
+GC.start
+
+ptr = DL::malloc(1024)
+ptr.struct!("CHIL", "c", "h", "i", "l")
+ptr["c"] = 1
+ptr["h"] = 2
+ptr["i"] = 3
+ptr["l"] = 4
+assert("struct!", :must,
+ ptr["c"] == 1 &&
+ ptr["h"] == 2 &&
+ ptr["i"] == 3 &&
+ ptr["l"] == 4)
+
+ptr = DL::malloc(DL::sizeof("IP"))
+ptr.struct!("IP", "n", "ptr")
+ptr["n"] = 10
+ptr["ptr"] = nil
+assert("struct!", :must, ptr["n"] == 10 && ptr["ptr"] == nil)
+
+GC.start
+printf("fail/total = #{$FAIL}/#{$TOTAL}\n")
diff --git a/ext/dl/type.rb b/ext/dl/type.rb
new file mode 100644
index 0000000000..804420c395
--- /dev/null
+++ b/ext/dl/type.rb
@@ -0,0 +1,115 @@
+# example:
+# DLTYPE[INT][:rb2c]["arg0"] => "NUM2INT(arg0)"
+# DLTYPE[DOUBLE][:c2rb]["r"] => "rb_float_new(r)"
+
+DLTYPE = {
+ VOID = 0x00 => {
+ :name => 'VOID',
+ :rb2c => nil,
+ :c2rb => nil,
+ :ctype => "void",
+ :stmem => "v",
+ :sym => true,
+ :cb => true,
+ },
+ CHAR = 0x01 => {
+ :name => 'CHAR',
+ :rb2c => proc{|x| "NUM2CHR(#{x})"},
+ :c2rb => proc{|x| "CHR2FIX(#{x})"},
+ :ctype => "char",
+ :stmem => "c",
+ :sym => false,
+ :cb => false,
+ },
+ SHORT = 0x02 => {
+ :name => 'SHORT',
+ :rb2c => proc{|x| "FIX2INT(#{x})"},
+ :c2rb => proc{|x| "INT2FIX(#{x})"},
+ :ctype => "short",
+ :stmem => "h",
+ :sym => false,
+ :cb => false,
+ },
+ INT = 0x03 => {
+ :name => 'INT',
+ :rb2c => proc{|x| "NUM2INT(#{x})"},
+ :c2rb => proc{|x| "INT2NUM(#{x})"},
+ :ctype => "int",
+ :stmem => "i",
+ :sym => true,
+ :cb => false,
+ },
+ LONG = 0x04 => {
+ :name => 'LONG',
+ :rb2c => proc{|x| "NUM2INT(#{x})"},
+ :c2rb => proc{|x| "INT2NUM(#{x})"},
+ :ctype => "long",
+ :stmem => "l",
+ :sym => true,
+ :cb => true,
+ },
+ FLOAT = 0x05 => {
+ :name => 'FLOAT',
+ :rb2c => proc{|x| "(float)(RFLOAT(#{x})->value)"},
+ :c2rb => proc{|x| "rb_float_new((double)#{x})"},
+ :ctype => "float",
+ :stmem => "f",
+ :sym => false,
+ :cb => false,
+ },
+ DOUBLE = 0x06 => {
+ :name => 'DOUBLE',
+ :rb2c => proc{|x| "RFLOAT(#{x})->value"},
+ :c2rb => proc{|x| "rb_float_new(#{x})"},
+ :ctype => "double",
+ :stmem => "d",
+ :sym => true,
+ :cb => true,
+ },
+ VOIDP = 0x07 => {
+ :name => 'VOIDP',
+ :rb2c => proc{|x| "rb_dlptr2cptr(#{x})"},
+ :c2rb => proc{|x| "rb_dlptr_new(#{x},sizeof(void*),0)"},
+ :ctype => "void *",
+ :stmem => "p",
+ :sym => true,
+ :cb => true,
+ },
+}
+
+def tpush(t, x)
+ (t << 3)|x
+end
+
+def tget(t, i)
+ (t & (0x07 << (i * 3))) >> (i * 3)
+end
+
+def types2num(types)
+ res = 0x00
+ r = types.reverse
+ r.each{|t|
+ res = tpush(res,t)
+ }
+ res
+end
+
+def num2types(num)
+ ts = []
+ i = 0
+ t = tget(num,i)
+ while( (t != VOID && i > 0) || (i == 0) )
+ ts.push(DLTYPE[t][:ctype])
+ i += 1
+ t = tget(num,i)
+ end
+ ts
+end
+
+def types2ctypes(types)
+ res = []
+ types.each{|t|
+ res.push(DLTYPE[t][:ctype])
+ }
+ res
+end
diff --git a/ext/enumerator/.cvsignore b/ext/enumerator/.cvsignore
new file mode 100644
index 0000000000..fc802ff1c2
--- /dev/null
+++ b/ext/enumerator/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+mkmf.log
diff --git a/ext/enumerator/enumerator.c b/ext/enumerator/enumerator.c
new file mode 100644
index 0000000000..74785569e7
--- /dev/null
+++ b/ext/enumerator/enumerator.c
@@ -0,0 +1,195 @@
+/************************************************
+
+ 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"
+
+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;
+
+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);
+}
+
+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;
+}
+
+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;
+}
+
+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;
+}
+
+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;
+}
+
+static VALUE
+enumerator_enum_cons(obj, n)
+ VALUE obj, n;
+{
+ return rb_funcall(rb_cEnumerator, id_new, 3, obj, sym_each_cons, n);
+}
+
+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);
+}
+
+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
new file mode 100644
index 0000000000..64c7d50226
--- /dev/null
+++ b/ext/enumerator/enumerator.txt
@@ -0,0 +1,102 @@
+.\" 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
new file mode 100644
index 0000000000..94e2ee38b2
--- /dev/null
+++ b/ext/enumerator/extconf.rb
@@ -0,0 +1,2 @@
+require 'mkmf'
+create_makefile('enumerator')
diff --git a/ext/etc/.cvsignore b/ext/etc/.cvsignore
new file mode 100644
index 0000000000..4088712231
--- /dev/null
+++ b/ext/etc/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+mkmf.log
+*.def
diff --git a/ext/etc/MANIFEST b/ext/etc/MANIFEST
deleted file mode 100644
index a0f521b386..0000000000
--- a/ext/etc/MANIFEST
+++ /dev/null
@@ -1,5 +0,0 @@
-MANIFEST
-etc.c
-etc.doc
-depend
-extconf.rb
diff --git a/ext/etc/depend b/ext/etc/depend
index fb3318a0c6..ac706477b0 100644
--- a/ext/etc/depend
+++ b/ext/etc/depend
@@ -1 +1 @@
-etc.o : etc.c $(hdrdir)/ruby.h $(hdrdir)/config.h $(hdrdir)/defines.h
+etc.o : etc.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index 1cf06768c8..c42f279d58 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -10,6 +10,11 @@
#include "ruby.h"
+#include <sys/types.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
#ifdef HAVE_GETPWENT
#include <pwd.h>
#endif
@@ -20,16 +25,19 @@
static VALUE sPasswd, sGroup;
+#ifndef _WIN32
+char *getenv();
+#endif
+char *getlogin();
+
static VALUE
etc_getlogin(obj)
VALUE obj;
{
- char *getenv();
char *login;
+ rb_secure(4);
#ifdef HAVE_GETLOGIN
- char *getlogin();
-
login = getlogin();
if (!login) login = getenv("USER");
#else
@@ -37,46 +45,58 @@ etc_getlogin(obj)
#endif
if (login)
- return str_new2(login);
+ return rb_tainted_str_new2(login);
return Qnil;
}
+#if defined(HAVE_GETPWENT) || defined(HAVE_GETGRENT)
+static VALUE
+safe_setup_str(str)
+ const char *str;
+{
+ if (str == 0) str = "";
+ return rb_tainted_str_new2(str);
+}
+#endif
+
#ifdef HAVE_GETPWENT
static VALUE
setup_passwd(pwd)
struct passwd *pwd;
{
if (pwd == 0) rb_sys_fail("/etc/passwd");
- return struct_new(sPasswd,
- str_new2(pwd->pw_name),
- str_new2(pwd->pw_passwd),
- INT2FIX(pwd->pw_uid),
- INT2FIX(pwd->pw_gid),
-#ifdef PW_GECOS
- str_new2(pwd->pw_gecos),
+ return rb_struct_new(sPasswd,
+ safe_setup_str(pwd->pw_name),
+#ifdef HAVE_ST_PW_PASSWD
+ safe_setup_str(pwd->pw_passwd),
#endif
- str_new2(pwd->pw_dir),
- str_new2(pwd->pw_shell),
-#ifdef PW_CHANGE
- INT2FIX(pwd->pw_change),
+ INT2FIX(pwd->pw_uid),
+ INT2FIX(pwd->pw_gid),
+#ifdef HAVE_ST_PW_GECOS
+ safe_setup_str(pwd->pw_gecos),
#endif
-#ifdef PW_QUOTA
- INT2FIX(pwd->pw_quota),
+ safe_setup_str(pwd->pw_dir),
+ safe_setup_str(pwd->pw_shell),
+#ifdef HAVE_ST_PW_CHANGE
+ INT2FIX(pwd->pw_change),
#endif
-#ifdef PW_AGE
- INT2FIX(pwd->pw_age),
+#ifdef HAVE_ST_PW_QUOTA
+ INT2FIX(pwd->pw_quota),
#endif
-#ifdef PW_CLASS
- str_new2(pwd->pw_class),
+#ifdef HAVE_ST_PW_AGE
+ INT2FIX(pwd->pw_age),
#endif
-#ifdef PW_COMMENT
- str_new2(pwd->pw_comment),
+#ifdef HAVE_ST_PW_CLASS
+ safe_setup_str(pwd->pw_class),
#endif
-#ifdef PW_EXPIRE
- INT2FIX(pwd->pw_expire),
+#ifdef HAVE_ST_PW_COMMENT
+ safe_setup_str(pwd->pw_comment),
#endif
- 0 /*dummy*/
- );
+#ifdef HAVE_ST_PW_EXPIRE
+ INT2FIX(pwd->pw_expire),
+#endif
+ 0 /*dummy*/
+ );
}
#endif
@@ -86,11 +106,12 @@ etc_getpwuid(argc, argv, obj)
VALUE *argv;
VALUE obj;
{
-#ifdef HAVE_GETPWENT
+#if defined(HAVE_GETPWENT)
VALUE id;
int uid;
struct passwd *pwd;
+ rb_secure(4);
if (rb_scan_args(argc, argv, "01", &id) == 1) {
uid = NUM2INT(id);
}
@@ -98,7 +119,7 @@ etc_getpwuid(argc, argv, obj)
uid = getuid();
}
pwd = getpwuid(uid);
- if (pwd == 0) Fail("can't find user for %d", uid);
+ if (pwd == 0) rb_raise(rb_eArgError, "can't find user for %d", uid);
return setup_passwd(pwd);
#else
return Qnil;
@@ -112,36 +133,92 @@ etc_getpwnam(obj, nam)
#ifdef HAVE_GETPWENT
struct passwd *pwd;
- Check_Type(nam, T_STRING);
+ SafeStringValue(nam);
pwd = getpwnam(RSTRING(nam)->ptr);
- if (pwd == 0) Fail("can't find user for %s", RSTRING(nam)->ptr);
+ if (pwd == 0) rb_raise(rb_eArgError, "can't find user for %s", RSTRING(nam)->ptr);
return setup_passwd(pwd);
#else
return Qnil;
#endif
}
+#ifdef HAVE_GETPWENT
+static int passwd_blocking = 0;
+static VALUE
+passwd_ensure()
+{
+ passwd_blocking = Qfalse;
+ return Qnil;
+}
+
+static VALUE
+passwd_iterate()
+{
+ struct passwd *pw;
+
+ setpwent();
+ while (pw = getpwent()) {
+ rb_yield(setup_passwd(pw));
+ }
+ endpwent();
+ return Qnil;
+}
+#endif
+
static VALUE
etc_passwd(obj)
VALUE obj;
{
-#if defined(HAVE_GETPWENT)
+#ifdef HAVE_GETPWENT
struct passwd *pw;
- if (iterator_p()) {
- setpwent();
- while (pw = getpwent()) {
- rb_yield(setup_passwd(pw));
+ rb_secure(4);
+ if (rb_block_given_p()) {
+ if (passwd_blocking) {
+ rb_raise(rb_eRuntimeError, "parallel passwd iteration");
}
- endpwent();
- return obj;
+ passwd_blocking = Qtrue;
+ rb_ensure(passwd_iterate, 0, passwd_ensure, 0);
}
- pw = getpwent();
- if (pw == 0) Fail("can't fetch next -- /etc/passwd");
- return setup_passwd(pw);
-#else
+ if (pw = getpwent()) {
+ return setup_passwd(pw);
+ }
+#endif
+ return Qnil;
+}
+
+static VALUE
+etc_setpwent(obj)
+ VALUE obj;
+{
+#ifdef HAVE_GETPWENT
+ setpwent();
+#endif
return Qnil;
+}
+
+static VALUE
+etc_endpwent(obj)
+ VALUE obj;
+{
+#ifdef HAVE_GETPWENT
+ endpwent();
#endif
+ return Qnil;
+}
+
+static VALUE
+etc_getpwent(obj)
+ VALUE obj;
+{
+#ifdef HAVE_GETPWENT
+ struct passwd *pw;
+
+ if (pw = getpwent()) {
+ return setup_passwd(pw);
+ }
+#endif
+ return Qnil;
}
#ifdef HAVE_GETGRENT
@@ -152,17 +229,19 @@ setup_group(grp)
VALUE mem;
char **tbl;
- mem = ary_new();
+ mem = rb_ary_new();
tbl = grp->gr_mem;
while (*tbl) {
- ary_push(mem, str_new2(*tbl));
+ rb_ary_push(mem, safe_setup_str(*tbl));
tbl++;
}
- return struct_new(sGroup,
- str_new2(grp->gr_name),
- str_new2(grp->gr_passwd),
- INT2FIX(grp->gr_gid),
- mem);
+ return rb_struct_new(sGroup,
+ safe_setup_str(grp->gr_name),
+#ifdef HAVE_ST_GR_PASSWD
+ safe_setup_str(grp->gr_passwd),
+#endif
+ INT2FIX(grp->gr_gid),
+ mem);
}
#endif
@@ -174,9 +253,10 @@ etc_getgrgid(obj, id)
int gid;
struct group *grp;
+ rb_secure(4);
gid = NUM2INT(id);
grp = getgrgid(gid);
- if (grp == 0) Fail("can't find group for %d", gid);
+ if (grp == 0) rb_raise(rb_eArgError, "can't find group for %d", gid);
return setup_group(grp);
#else
return Qnil;
@@ -190,15 +270,39 @@ etc_getgrnam(obj, nam)
#ifdef HAVE_GETGRENT
struct group *grp;
- Check_Type(nam, T_STRING);
+ rb_secure(4);
+ SafeStringValue(nam);
grp = getgrnam(RSTRING(nam)->ptr);
- if (grp == 0) Fail("can't find group for %s", RSTRING(nam)->ptr);
+ if (grp == 0) rb_raise(rb_eArgError, "can't find group for %s", RSTRING(nam)->ptr);
return setup_group(grp);
#else
return Qnil;
#endif
}
+#ifdef HAVE_GETGRENT
+static int group_blocking = 0;
+static VALUE
+group_ensure()
+{
+ group_blocking = Qfalse;
+ return Qnil;
+}
+
+static VALUE
+group_iterate()
+{
+ struct group *pw;
+
+ setgrent();
+ while (pw = getgrent()) {
+ rb_yield(setup_group(pw));
+ }
+ endgrent();
+ return Qnil;
+}
+#endif
+
static VALUE
etc_group(obj)
VALUE obj;
@@ -206,18 +310,53 @@ etc_group(obj)
#ifdef HAVE_GETGRENT
struct group *grp;
- if (iterator_p()) {
- setgrent();
- while (grp = getgrent()) {
- rb_yield(setup_group(grp));
+ rb_secure(4);
+ if (rb_block_given_p()) {
+ if (group_blocking) {
+ rb_raise(rb_eRuntimeError, "parallel group iteration");
}
- endgrent();
- return obj;
+ group_blocking = Qtrue;
+ rb_ensure(group_iterate, 0, group_ensure, 0);
}
- return setup_group(getgrent());
-#else
+ if (grp = getgrent()) {
+ return setup_group(grp);
+ }
+#endif
return Qnil;
+}
+
+static VALUE
+etc_setgrent(obj)
+ VALUE obj;
+{
+#ifdef HAVE_GETGRENT
+ setgrent();
#endif
+ return Qnil;
+}
+
+static VALUE
+etc_endgrent(obj)
+ VALUE obj;
+{
+#ifdef HAVE_GETGRENT
+ endgrent();
+#endif
+ return Qnil;
+}
+
+static VALUE
+etc_getgrent(obj)
+ VALUE obj;
+{
+#ifdef HAVE_GETGRENT
+ struct group *gr;
+
+ if (gr = getgrent()) {
+ return setup_group(gr);
+ }
+#endif
+ return Qnil;
}
static VALUE mEtc;
@@ -231,41 +370,47 @@ Init_etc()
rb_define_module_function(mEtc, "getpwuid", etc_getpwuid, -1);
rb_define_module_function(mEtc, "getpwnam", etc_getpwnam, 1);
+ rb_define_module_function(mEtc, "setpwent", etc_setpwent, 0);
+ rb_define_module_function(mEtc, "endpwent", etc_endpwent, 0);
+ rb_define_module_function(mEtc, "getpwent", etc_getpwent, 0);
rb_define_module_function(mEtc, "passwd", etc_passwd, 0);
rb_define_module_function(mEtc, "getgrgid", etc_getgrgid, 1);
rb_define_module_function(mEtc, "getgrnam", etc_getgrnam, 1);
rb_define_module_function(mEtc, "group", etc_group, 0);
-
- sPasswd = struct_define("Passwd",
- "name", "passwd", "uid", "gid",
-#ifdef PW_GECOS
- "gecos",
+ rb_define_module_function(mEtc, "setgrent", etc_setgrent, 0);
+ rb_define_module_function(mEtc, "endgrent", etc_endgrent, 0);
+ rb_define_module_function(mEtc, "getgrent", etc_getgrent, 0);
+
+ sPasswd = rb_struct_define("Passwd",
+ "name", "passwd", "uid", "gid",
+#ifdef HAVE_ST_PW_GECOS
+ "gecos",
#endif
- "dir", "shell",
-#ifdef PW_CHANGE
- "change",
+ "dir", "shell",
+#ifdef HAVE_ST_PW_CHANGE
+ "change",
#endif
-#ifdef PW_QUOTA
- "quota",
+#ifdef HAVE_ST_PW_QUOTA
+ "quota",
#endif
-#ifdef PW_AGE
- "age",
+#ifdef HAVE_ST_PW_AGE
+ "age",
#endif
-#ifdef PW_CLASS
- "class",
+#ifdef HAVE_ST_PW_CLASS
+ "uclass",
#endif
-#ifdef PW_COMMENT
- "comment",
+#ifdef HAVE_ST_PW_COMMENT
+ "comment",
#endif
-#ifdef PW_EXPIRE
- "expire",
+#ifdef HAVE_ST_PW_EXPIRE
+ "expire",
#endif
- 0);
+ NULL);
rb_global_variable(&sPasswd);
#ifdef HAVE_GETGRENT
- sGroup = struct_define("Group", "name", "passwd", "gid", "mem", 0);
+ sGroup = rb_struct_define("Group", "name", "passwd", "gid", "mem", NULL);
rb_global_variable(&sGroup);
#endif
}
diff --git a/ext/etc/etc.txt b/ext/etc/etc.txt
new file mode 100644
index 0000000000..534790172c
--- /dev/null
+++ b/ext/etc/etc.txt
@@ -0,0 +1,72 @@
+.\" etc.txt - -*- Indented-Text -*- created at: Fri Jul 14 00:47:15 JST 1995
+
+** Etc(Module)
+
+The module to retrieve information under /etc directory. Available
+only on UNIX platforms. All operations defined in this module are
+module functions, so that you can include Etc module into your class.
+
+Module Function:
+
+ getlogin
+
+ returns login name of the user. It this fails, try getpwuid().
+
+ getpwnam(name)
+
+ searches in /etc/passwd file (or equivalent database), and
+ returns password entry for the user. The return value is an
+ passwd structure, which has members described below.
+
+ struct passwd
+ name # user name(string)
+ passwd # encrypted password(string)
+ uid # user ID(integer)
+ gid # group ID(integer)
+ gecos # gecos field(string)
+ dir # home directory(string)
+ shell # login shell(string)
+ # members below are optional
+ change # password change time(integer)
+ quota # quota value(integer)
+ age # password age(integer)
+ class # user access class(string)
+ comment # comment(string)
+ expire # account expiration time(integer)
+ end
+
+ See getpwnam(3) for detail.
+
+ getpwuid([uid])
+
+ returns passwd entry for the specified user id. If uid is
+ ommitted, use the value from getuid(). See getpwuid(3) for
+ detail.
+
+ getgrgid(gid)
+
+ searches in /etc/group file (or equivalent database), and
+ returns group entry for the group id. The return value is an
+ group structure, which has members described below.
+
+ struct group
+ name # group name(string)
+ passwd # group password(string)
+ gid # group ID(integer)
+ mem # array of the group member names
+ end
+
+ See getgrgid(3) for detail.
+
+ getgrnam(name)
+
+ returns the group entry for the specified name. The return
+ value is the group structure. See getgrnam(3) for detail.
+
+ group
+
+ iterates over all group entries.
+
+ passwd
+
+ iterates over all passwd entries.
diff --git a/ext/etc/etc.doc b/ext/etc/etc.txt.ja
index 2af895c9de..2dddcfb036 100644
--- a/ext/etc/etc.doc
+++ b/ext/etc/etc.txt.ja
@@ -1,12 +1,11 @@
-.\" etc.doc - -*- Indented-Text -*- created at: Fri Jul 14 00:47:15 JST 1995
+.\" etc.txt.ja - -*- Indented-Text -*- created at: Fri Jul 14 00:47:15 JST 1995
** Etc()
/etc
-Methods:
-Single Methods:
+Module Function:
getlogin
diff --git a/ext/etc/extconf.rb b/ext/etc/extconf.rb
index 4cf04a3ec3..16f2da352b 100644
--- a/ext/etc/extconf.rb
+++ b/ext/etc/extconf.rb
@@ -1,31 +1,18 @@
require 'mkmf'
-def etc_grep_header(field)
- f = open("conftest.c", "w")
- f.print <<EOF
-#include <pwd.h>
-EOF
- f.close
- begin
- if xsystem("#{CPP} | egrep #{field}")
- $defs.push(format("-D%s", field.upcase))
- end
- ensure
- system "rm -f conftest.c"
- end
-end
-
have_library("sun", "getpwnam") # NIS (== YP) interface for IRIX 4
a = have_func("getlogin")
b = have_func("getpwent")
c = have_func("getgrent")
if a or b or c
- etc_grep_header("pw_gecos")
- etc_grep_header("pw_change")
- etc_grep_header("pw_quota")
- etc_grep_header("pw_age")
- etc_grep_header("pw_class")
- etc_grep_header("pw_comment")
- etc_grep_header("pw_expire")
+ have_struct_member('struct passwd', 'pw_gecos', 'pwd.h')
+ have_struct_member('struct passwd', 'pw_change', 'pwd.h')
+ have_struct_member('struct passwd', 'pw_quota', 'pwd.h')
+ have_struct_member('struct passwd', 'pw_age', 'pwd.h')
+ have_struct_member('struct passwd', 'pw_class', 'pwd.h')
+ have_struct_member('struct passwd', 'pw_comment', 'pwd.h') unless /cygwin/ === RUBY_PLATFORM
+ have_struct_member('struct passwd', 'pw_expire', 'pwd.h')
+ have_struct_member('struct passwd', 'pw_passwd', 'pwd.h')
+ have_struct_member('struct group', 'gr_passwd', 'grp.h')
create_makefile("etc")
end
diff --git a/ext/extmk.rb b/ext/extmk.rb
new file mode 100644
index 0000000000..5d26b43e13
--- /dev/null
+++ b/ext/extmk.rb
@@ -0,0 +1,312 @@
+#! /usr/local/bin/ruby
+# -*- ruby -*-
+
+$force_static = nil
+$install = nil
+$destdir = nil
+$clean = nil
+$nodynamic = nil
+$extinit = nil
+$extobjs = nil
+$ignore = nil
+$message = nil
+
+$progname = $0
+alias $PROGRAM_NAME $0
+alias $0 $progname
+
+$extlist = []
+
+$:.replace ["."]
+require 'rbconfig'
+
+srcdir = File.dirname(File.dirname(__FILE__))
+
+$:.replace [srcdir, srcdir+"/lib", "."]
+
+require 'mkmf'
+require 'getopts'
+
+$topdir = "."
+$top_srcdir = srcdir
+$hdrdir = $top_srcdir
+
+def sysquote(x)
+ @quote ||= /human|os2|macos/ =~ (CROSS_COMPILING || RUBY_PLATFORM)
+ @quote ? x.quote : x
+end
+
+def extmake(target)
+ print "#{$message} #{target}\n"
+ $stdout.flush
+ if $force_static or $static_ext[target]
+ $static = target
+ else
+ $static = false
+ end
+
+ unless $ignore
+ return true if $nodynamic and not $static
+ end
+
+ init_mkmf
+
+ begin
+ dir = Dir.pwd
+ FileUtils.mkpath target unless File.directory?(target)
+ Dir.chdir target
+ top_srcdir = $top_srcdir
+ topdir = $topdir
+ prefix = "../" * (target.count("/")+1)
+ if File.expand_path(top_srcdir) != File.expand_path(top_srcdir, dir)
+ $hdrdir = $top_srcdir = prefix + top_srcdir
+ end
+ $topdir = prefix + $topdir
+ $target = target
+ $mdir = target
+ $srcdir = File.join($top_srcdir, "ext", $mdir)
+ $preload = nil
+ makefile = "./Makefile"
+ unless $ignore
+ if $static ||
+ !(t = modified?(makefile, MTIMES)) ||
+ %W<#{$srcdir}/makefile.rb #{$srcdir}/extconf.rb
+ #{$srcdir}/depend>.any? {|f| modified?(f, [t])}
+ then
+ $defs = []
+ Logging::logfile 'mkmf.log'
+ Config::CONFIG["srcdir"] = $srcdir
+ rm_f makefile
+ begin
+ if File.exist?($0 = "#{$srcdir}/makefile.rb")
+ load $0
+ elsif File.exist?($0 = "#{$srcdir}/extconf.rb")
+ load $0
+ else
+ create_makefile(target)
+ end
+ File.exist?(makefile)
+ rescue SystemExit
+ # ignore
+ ensure
+ rm_f "conftest*"
+ $0 = $PROGRAM_NAME
+ Config::CONFIG["srcdir"] = $top_srcdir
+ end
+ else
+ true
+ end
+ else
+ File.exist?(makefile)
+ end or open(makefile, "w") do |f|
+ f.print dummy_makefile($srcdir)
+ return true
+ end
+ args = sysquote($mflags)
+ if $static
+ args += ["static"]
+ $extlist.push [$static, $target, File.basename($target), $preload]
+ end
+ unless system($make, *args)
+ $ignore or $continue or return false
+ end
+ if $static
+ $extflags ||= ""
+ $extlibs ||= []
+ $extpath ||= []
+ $extflags += " " + $DLDFLAGS unless $DLDFLAGS.empty?
+ $extflags += " " + $LDFLAGS unless $LDFLAGS.empty?
+ $extlibs = merge_libs($extlibs, $libs.split, $LOCAL_LIBS.split)
+ $extpath |= $LIBPATH
+ end
+ ensure
+ $hdrdir = $top_srcdir = top_srcdir
+ $topdir = topdir
+ Dir.chdir dir
+ end
+ true
+end
+
+def parse_args()
+ getopts('n', 'extstatic:', 'dest-dir:',
+ 'make:', 'make-flags:', 'mflags:')
+
+ $dryrun = $OPT['n']
+ $force_static = $OPT['extstatic'] == 'static'
+ $destdir = $OPT['dest-dir'] || ''
+ $make = $OPT['make'] || $make || 'make'
+ mflags = ($OPT['make-flags'] || '').strip
+ mflags = ($OPT['mflags'] || '').strip if mflags.empty?
+
+ $mflags = Shellwords.shellwords(mflags)
+ if arg = $mflags.first
+ arg.insert(0, '-') if /\A[^-][^=]*\Z/ =~ arg
+ end
+
+ $make, *rest = Shellwords.shellwords($make)
+ $mflags.unshift(*rest) unless rest.empty?
+
+ def $mflags.set?(flag)
+ grep(/\A-(?!-).*#{'%c' % flag}/i) { return true }
+ false
+ end
+
+ if $mflags.set?(?n)
+ $dryrun = true
+ else
+ $mflags.unshift '-n' if $dryrun
+ end
+
+ $continue = $mflags.set?(?k)
+ $mflags |= ["DESTDIR=#{$destdir}"]
+end
+
+parse_args()
+
+unless $message
+ if $message = ARGV.shift and /^[a-z]+$/ =~ $message
+ $mflags.push($message)
+ $message = $message.sub(/^(?:dist|real)(?=(?:clean)?$)/, '\1')
+ case $message
+ when "clean"
+ $ignore ||= true
+ when "install"
+ $ignore ||= true
+ $mflags.unshift("INSTALL_PROG=install -c -p -m 0755",
+ "INSTALL_DATA=install -c -p -m 0644",
+ "MAKEDIRS=mkdir -p") if $dryrun
+ end
+ $message.sub!(/e?$/, "ing")
+ else
+ $message = "compiling"
+ end
+end
+
+EXEEXT = CONFIG['EXEEXT']
+if CROSS_COMPILING
+ $ruby = CONFIG['MINIRUBY']
+elsif $nmake
+ $ruby = '$(topdir:/=\\)\\miniruby' + EXEEXT
+else
+ $ruby = '$(topdir)/miniruby' + EXEEXT
+end
+$ruby << " -I$(topdir) -I$(hdrdir)/lib"
+$config_h = '$(topdir)/config.h'
+
+MTIMES = [__FILE__, 'rbconfig.rb', srcdir+'/lib/mkmf.rb'].collect {|f| File.mtime(f)}
+
+# get static-link modules
+$static_ext = {}
+for dir in ["ext", File::join($top_srcdir, "ext")]
+ setup = File::join(dir, CONFIG['setup'])
+ if File.file? setup
+ f = open(setup)
+ while line = f.gets()
+ line.chomp!
+ line.sub!(/#.*$/, '')
+ next if /^\s*$/ =~ line
+ target, opt = line.split(nil, 3)
+ if target == 'option'
+ case opt
+ when 'nodynamic'
+ $nodynamic = true
+ end
+ next
+ end
+ target = target.downcase if /mswin32|bccwin32/ =~ RUBY_PLATFORM
+ $static_ext[target] = true
+ end
+ MTIMES << f.mtime
+ $setup = setup
+ f.close
+ break
+ end
+end
+
+dir = Dir.pwd
+FileUtils::makedirs('ext')
+Dir::chdir('ext')
+
+if File.expand_path(srcdir) != File.expand_path(srcdir, dir)
+ $hdrdir = $top_srcdir = "../" + srcdir
+end
+$topdir = ".."
+ext_prefix = "#{$top_srcdir}/ext"
+Dir.glob("#{ext_prefix}/*/**/extconf.rb") do |d|
+ d = File.dirname(d)
+ d.slice!(0, ext_prefix.length + 1)
+ extmake(d) or exit(1)
+end
+$hdrdir = $top_srcdir = srcdir
+$topdir = "."
+
+if $ignore
+ Dir.chdir ".."
+ exit
+end
+
+if $extlist.size > 0
+ $extinit ||= ""
+ $extobjs ||= ""
+ list = $extlist.dup
+ built = []
+ while e = list.shift
+ s,t,i,r = e
+ if r and !(r -= built).empty?
+ l = list.size
+ if (while l > 0; break true if r.include?(list[l-=1][1]) end)
+ list.insert(l + 1, e)
+ end
+ next
+ end
+ f = format("%s/%s.%s", s, i, $LIBEXT)
+ if File.exist?(f)
+ $extinit += "\tinit(Init_#{i}, \"#{t}.so\");\n"
+ $extobjs += "ext/#{f} "
+ built << t
+ end
+ end
+
+ src = <<SRC
+extern char *ruby_sourcefile, *rb_source_filename();
+#define init(func, name) (ruby_sourcefile = src = rb_source_filename(name), func(), rb_provide(src))
+void Init_ext() {\n\tchar* src;\n#$extinit}
+SRC
+ if !modified?("extinit.c", MTIMES) || IO.read("extinit.c") != src
+ open("extinit.c", "w") {|f| f.print src}
+ end
+
+ $extobjs = "ext/extinit.#{$OBJEXT} " + $extobjs
+ if RUBY_PLATFORM =~ /m68k-human|beos/
+ $extflags.delete("-L/usr/local/lib")
+ end
+ $extpath.delete("$(topdir)")
+ $extflags = libpathflag($extpath) << " " << $extflags.strip
+ conf = [
+ ['SETUP', $setup], [$enable_shared ? 'DLDOBJS' : 'EXTOBJS', $extobjs],
+ ['EXTLIBS', $extlibs.join(' ')], ['EXTLDFLAGS', $extflags]
+ ].map {|n, v|
+ "#{n}=#{v}" if v and !(v = v.strip).empty?
+ }.compact
+ puts conf
+ $stdout.flush
+ $mflags.concat(conf)
+end
+rubies = []
+%w[RUBY RUBYW].each {|r|
+ config_string(r+"_INSTALL_NAME") {|r| rubies << r+EXEEXT}
+}
+
+Dir.chdir ".."
+if $extlist.size > 0
+ rm_f(Config::CONFIG["LIBRUBY_SO"])
+end
+puts "making #{rubies.join(', ')}"
+$stdout.flush
+$mflags.concat(rubies)
+
+system($make, *sysquote($mflags)) or exit($?.exitstatus)
+
+#Local variables:
+# mode: ruby
+#end:
diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in
deleted file mode 100644
index aaa3b6d3cf..0000000000
--- a/ext/extmk.rb.in
+++ /dev/null
@@ -1,556 +0,0 @@
-#! /usr/local/bin/ruby
-
-$".push 'mkmf.rb' #"
-load '@top_srcdir@/lib/find.rb'
-
-if ARGV[0] == 'static'
- $force_static = TRUE
- ARGV.shift
-elsif ARGV[0] == 'install'
- $install = TRUE
- ARGV.shift
-elsif ARGV[0] == 'clean'
- $clean = TRUE
- ARGV.shift
-end
-
-$extlist = []
-
-$cache_mod = FALSE;
-$lib_cache = {}
-$func_cache = {}
-$hdr_cache = {}
-$top_srcdir = "@top_srcdir@"
-if $top_srcdir !~ "^/"
- # get absolute path
- save = Dir.pwd
- Dir.chdir $top_srcdir
- $top_srcdir = Dir.pwd
- Dir.chdir save
-end
-$topdir = ".."
-if $topdir !~ "^/"
- # get absolute path
- save = Dir.pwd
- Dir.chdir $topdir
- $topdir = Dir.pwd
- Dir.chdir save
-end
-$dots = if "@INSTALL@" =~ /^\// then "" else "#{$topdir}/ext/" end
-
-if File.exist?("config.cache") then
- f = open("config.cache", "r")
- while f.gets
- case $_
- when /^lib: (.+) (yes|no)/
- $lib_cache[$1] = $2
- when /^func: ([\w_]+) (yes|no)/
- $func_cache[$1] = $2
- when /^hdr: (.+) (yes|no)/
- $hdr_cache[$1] = $2
- end
- end
- f.close
-end
-
-def older(file1, file2)
- if !File.exist?(file1) then
- return TRUE
- end
- if !File.exist?(file2) then
- return FALSE
- end
- if File.mtime(file1) < File.mtime(file2)
- return TRUE
- end
- return FALSE
-end
-
-if PLATFORM == "m68k-human"
-CFLAGS = "@CFLAGS@".gsub(/-c..-stack=[0-9]+ */, '')
-else
-CFLAGS = "@CFLAGS@"
-end
-LINK = "@CC@ -o conftest -I#{$topdir} -I#{$top_srcdir} -I@includedir@ " + CFLAGS + " %s @LDFLAGS@ %s conftest.c @LIBS@ %s"
-CPP = "@CPP@ @CPPFLAGS@ -I#{$topdir} -I#{$top_srcdir} -I@includedir@ " + CFLAGS + " %s conftest.c"
-
-if /win32|djgpp|mingw32|m68k-human/i =~ PLATFORM
- $null = open("nul", "w")
-else
- $null = open("/dev/null", "w")
-end
-
-$orgerr = $stderr.dup
-$orgout = $stdout.dup
-def xsystem command
- if $DEBUG
- return system(command)
- end
- $stderr.reopen($null)
- $stdout.reopen($null)
- r = system(command)
- $stderr.reopen($orgerr)
- $stdout.reopen($orgout)
- return r
-end
-
-def try_link(libs)
- xsystem(format(LINK, $CFLAGS, $LDFLAGS, libs))
-end
-
-def try_cpp
- xsystem(format(CPP, $CFLAGS))
-end
-
-def install_rb(mfile)
- path = []
- dir = []
- Find.find("lib") do |f|
- next unless /\.rb$/ =~ f
- f = f[4..-1]
- path.push f
- dir |= File.dirname(f)
- end
- for f in dir
- next if f == "."
- mfile.printf "\t@test -d $(libdir)/%s || mkdir $(libdir)/%s\n", f, f
- end
- for f in path
- mfile.printf "\t$(INSTALL_DATA) lib/%s $(libdir)/%s\n", f, f
- end
-end
-
-def have_library(lib, func)
- if $lib_cache[lib]
- if $lib_cache[lib] == "yes"
- if $libs
- $libs = "-l" + lib + " " + $libs
- else
- $libs = "-l" + lib
- end
- return TRUE
- else
- return FALSE
- end
- end
-
- cfile = open("conftest.c", "w")
- cfile.printf "\
-int main() { return 0; }
-int t() { %s(); return 0; }
-", func
- cfile.close
-
- begin
- if $libs
- libs = "-l" + lib + " " + $libs
- else
- libs = "-l" + lib
- end
- unless try_link(libs)
- $lib_cache[lib] = 'no'
- $cache_mod = TRUE
- return FALSE
- end
- ensure
- system "rm -f conftest*"
- end
-
- $libs = libs
- $lib_cache[lib] = 'yes'
- $cache_mod = TRUE
- return TRUE
-end
-
-def have_func(func)
- if $func_cache[func]
- if $func_cache[func] == "yes"
- $defs.push(format("-DHAVE_%s", func.upcase))
- return TRUE
- else
- return FALSE
- end
- end
-
- cfile = open("conftest.c", "w")
- cfile.printf "\
-char %s();
-int main() { return 0; }
-int t() { %s(); return 0; }
-", func, func
- cfile.close
-
- libs = $libs
- libs = "" if libs == nil
-
- begin
- unless try_link(libs)
- $func_cache[func] = 'no'
- $cache_mod = TRUE
- return FALSE
- end
- ensure
- system "rm -f conftest*"
- end
- $defs.push(format("-DHAVE_%s", func.upcase))
- $func_cache[func] = 'yes'
- $cache_mod = TRUE
- return TRUE
-end
-
-def have_header(header)
- if $hdr_cache[header]
- if $hdr_cache[header] == "yes"
- header.tr!("a-z./\055", "A-Z___")
- $defs.push(format("-DHAVE_%s", header))
- return TRUE
- else
- return FALSE
- end
- end
-
- cfile = open("conftest.c", "w")
- cfile.printf "\
-#include <%s>
-", header
- cfile.close
-
- begin
- unless try_cpp
- $hdr_cache[header] = 'no'
- $cache_mod = TRUE
- return FALSE
- end
- ensure
- system "rm -f conftest*"
- end
- $hdr_cache[header] = 'yes'
- header.tr!("a-z./\055", "A-Z___")
- $defs.push(format("-DHAVE_%s", header))
- $cache_mod = TRUE
- return TRUE
-end
-
-def create_header()
- if $defs.length > 0
- hfile = open("extconf.h", "w")
- for line in $defs
- line =~ /^-D(.*)/
- hfile.printf "#define %s 1\n", $1
- end
- hfile.close
- end
-end
-
-def create_makefile(target)
-
- if $libs and "@DLEXT@" == "o"
- libs = $libs.split
- for lib in libs
- lib.sub!(/-l(.*)/, '"lib\1.a"')
- end
- $defs.push(format("-DEXTLIB='%s'", libs.join(",")))
- end
-
- $DLDFLAGS = '@DLDFLAGS@'
-
- if PLATFORM =~ /beos/
- if $libs
- $libs = $libs + " -lruby"
- else
- $libs = "-lruby"
- end
- $DLDFLAGS = $DLDFLAGS + " -L" + $topdir
- end
-
- $srcdir = $top_srcdir + "/ext/" + target
- mfile = open("Makefile", "w")
- mfile.printf "\
-SHELL = /bin/sh
-
-#### Start of system configuration section. ####
-
-srcdir = #{$srcdir}
-VPATH = #{$srcdir}
-
-hdrdir = #{$topdir}
-
-CC = @CC@
-
-prefix = @prefix@
-CFLAGS = %s -I#{$topdir} -I#{$top_srcdir} -I@includedir@ %s #$CFLAGS %s
-DLDFLAGS = #$DLDFLAGS #$LDFLAGS
-LDSHARED = @LDSHARED@
-", if $static then "" else "@CCDLFLAGS@" end, CFLAGS, $defs.join(" ")
-
- mfile.printf "\
-
-program_transform_name = -e @program_transform_name@
-RUBY_INSTALL_NAME = `t='$(program_transform_name)'; echo ruby | sed $$t`
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-libdir = @libdir@/$(RUBY_INSTALL_NAME)
-archdir = $(libdir)/@arch@
-@SET_MAKE@
-
-#### End of system configuration section. ####
-
-"
- mfile.printf "LOCAL_LIBS = %s\n", $local_libs if $local_libs
- mfile.printf "LIBS = %s\n", $libs
- mfile.printf "OBJS = "
- if !$objs then
- $objs = []
- for f in Dir["#{$top_srcdir}/ext/#{target}/*.{c,cc}"]
- f = File.basename(f)
- f.sub!(/\.(c|cc)$/, ".o")
- $objs.push f
- end
- end
- mfile.printf $objs.join(" ")
- mfile.printf "\n"
-
- mfile.printf "\
-TARGET = %s.%s
-
-INSTALL = %s@INSTALL@
-INSTALL_DATA = %s@INSTALL_DATA@
-
-binsuffix = @binsuffix@
-
-all: $(TARGET)
-
-clean:; @rm -f *.o *.so *.sl
- @rm -f Makefile extconf.h conftest.*
- @rm -f core ruby$(binsuffix) *~
-
-realclean: clean
-", target,
- if $static then "a" else "@DLEXT@" end, $dots, $dots
-
- mfile.printf "\
-
-install:
- @test -d $(libdir) || mkdir $(libdir)
- @test -d $(archdir) || mkdir $(archdir)
-"
- if !$static
- mfile.printf "\
- $(INSTALL) $(TARGET) $(archdir)/$(TARGET)
-"
- end
- install_rb(mfile)
- mfile.printf "\n"
-
- if $static
- mfile.printf "\
-$(TARGET): $(OBJS)
- @AR@ cru $(TARGET) $(OBJS)
- @-@RANLIB@ $(LIBRUBY) 2> /dev/null || true
-"
- elsif "@DLEXT@" != "o"
- mfile.printf "\
-$(TARGET): $(OBJS)
- $(LDSHARED) $(DLDFLAGS) -o $(TARGET) $(OBJS) $(LOCAL_LIBS) $(LIBS)
-"
- elsif not File.exist?(target + ".c") and not File.exist?(target + ".cc")
- if PLATFORM == "m68k-human"
- mfile.printf "\
-$(TARGET): $(OBJS)
- ar cru $(TARGET) $(OBJS)
-"
- elsif PLATFORM =~ "-nextstep" || PLATFORM =~ "-openstep" || PLATFORM =~ "-rhapsody"
- mfile.printf "\
-$(TARGET): $(OBJS)
- cc -r $(CFLAGS) -o $(TARGET) $(OBJS)
-"
- else
- mfile.printf "\
-$(TARGET): $(OBJS)
- ld $(DLDFLAGS) -r -o $(TARGET) $(OBJS)
-"
- end
- end
-
- if File.exist?("depend")
- dfile = open("depend", "r")
- mfile.printf "###\n"
- while line = dfile.gets()
- mfile.printf "%s", line
- end
- dfile.close
- end
- mfile.close
-
- if PLATFORM =~ /beos/
- if PLATFORM =~ /^powerpc/ then
- deffilename = "ruby.exp"
- else
- deffilename = "ruby.def"
- end
- print "creating ruby.def\n"
- open(deffilename, "w") do |file|
- file.print("EXPORTS\n") if PLATFORM =~ /^i/
- file.print("Init_#{target}\n")
- end
- end
-end
-
-def extmake(target)
- if $force_static or $static_ext[target]
- $static = target
- else
- $static = FALSE
- end
-
- return if $nodynamic and not $static
-
- $objs = nil
- $libs = PLATFORM =~ /cygwin32|beos|openstep|nextstep|rhapsody/ ? nil : "-lc"
- $local_libs = nil # to be assigned in extconf.rb
- $CFLAGS = nil
- $LDFLAGS = nil
-
- begin
- system "mkdir " + target unless File.directory?(target)
- Dir.chdir target
- if $static_ext.size > 0 ||
- !File.exist?("./Makefile") ||
- older("./Makefile", "#{$top_srcdir}/ext/@setup@") ||
- older("./Makefile", "../extmk.rb") ||
- older("./Makefile", "#{$top_srcdir}/ext/#{target}/extconf.rb")
- then
- $defs = []
- if File.exist?("#{$top_srcdir}/ext/#{target}/extconf.rb")
- load "#{$top_srcdir}/ext/#{target}/extconf.rb"
- else
- create_makefile(target);
- end
- end
- if File.exist?("./Makefile")
- if $static
- $extlist.push [$static,target]
- end
- if $install
- system "make install"
- elsif $clean
- system "make clean"
- else
- system "make all"
- end
- end
- if $static
- $extlibs = "" unless $extlibs
- $extlibs += " " + $LDFLAGS if $LDFLAGS
- $extlibs += " " + $local_libs if $local_libs
- $extlibs += " " + $libs if $libs
- end
- ensure
- Dir.chdir ".."
- end
-end
-
-# get static-link modules
-$static_ext = {}
-for setup in ["@setup@", "#{$top_srcdir}/ext/@setup@"]
- if File.file? setup
- f = open(setup)
- while f.gets()
- $_.chomp!
- sub!(/#.*$/, '')
- next if /^\s*$/
- if /^option +nodynamic/
- $nodynamic = TRUE
- next
- end
- $static_ext[$_.split[0]] = TRUE
- end
- f.close
- break
- end
-end
-
-for d in Dir["#{$top_srcdir}/ext/*"]
- File.directory?(d) || next
- File.file?(d + "/MANIFEST") || next
-
- d = File.basename(d)
- if $install
- print "installing ", d, "\n"
- elsif $clean
- print "cleaning ", d, "\n"
- else
- print "compiling ", d, "\n"
- end
- extmake(d)
-end
-
-if $cache_mod
- f = open("config.cache", "w")
- for k,v in $lib_cache
- f.printf "lib: %s %s\n", k, v
- end
- for k,v in $func_cache
- f.printf "func: %s %s\n", k, v
- end
- for k,v in $hdr_cache
- f.printf "hdr: %s %s\n", k, v
- end
- f.close
-end
-
-exit if $install or $clean
-$extinit = "" unless $extinit
-if $extlist.size > 0
- for s,t in $extlist
- f = format("%s/%s.a", s, t)
- if File.exist?(f)
- $extinit += format("\
-\tInit_%s();\n\
-\trb_provide(\"%s.o\");\n\
-", t, t)
- $extobjs = "" unless $extobjs
- $extobjs += "ext/"
- $extobjs += f
- $extobjs += " "
- else
- FALSE
- end
- end
-
- if older("extinit.c", "#{$top_srcdir}/ext/@setup@")
- f = open("extinit.c", "w")
- f.printf "void Init_ext() {\n"
- f.printf $extinit
- f.printf "}\n"
- f.close
- end
- if older("extinit.o", "extinit.c")
- cmd = "@CC@ " + CFLAGS + " -c extinit.c"
- print cmd, "\n"
- system cmd or exit 1
- end
-
- Dir.chdir ".."
-
- if older("ruby@binsuffix@", "#{$top_srcdir}/ext/@setup@") or older("ruby@binsuffix@", "miniruby@binsuffix@")
- `rm -f ruby@binsuffix@`
- end
-
- $extobjs = "ext/extinit.o " + $extobjs
- if PLATFORM =~ /m68k-human|beos/
- $extlibs.gsub!("-L/usr/local/lib", "") if $extlibs
- end
- system format('make ruby@binsuffix@ EXTOBJS="%s" EXTLIBS="%s"', $extobjs, $extlibs)
-else
- Dir.chdir ".."
- if older("ruby@binsuffix@", "miniruby@binsuffix@")
- `rm -f ruby@binsuffix@`
- system("make ruby@binsuffix@")
- end
-end
-
-#Local variables:
-# mode: ruby
-#end:
diff --git a/ext/extmk.rb.nt b/ext/extmk.rb.nt
deleted file mode 100644
index 5836e5c681..0000000000
--- a/ext/extmk.rb.nt
+++ /dev/null
@@ -1,501 +0,0 @@
-#! /usr/local/bin/ruby
-
-$".push 'mkmf.rb' #"
-
-if ARGV[0] == 'static'
- $force_static = TRUE
- ARGV.shift
-elsif ARGV[0] == 'install'
- $install = TRUE
- ARGV.shift
-elsif ARGV[0] == 'clean'
- $clean = TRUE
- ARGV.shift
-end
-
-$extlist = []
-
-$cache_mod = FALSE;
-$lib_cache = {}
-$func_cache = {}
-$hdr_cache = {}
-
-#$dllopt = '-MD'
-$dllopt = ''
-
-if File.exist?("config.cache") then
- f = open("config.cache", "r")
- while f.gets
- case $_
- when /^lib: ([\w_]+) (yes|no)/
- $lib_cache[$1] = $2
- when /^func: ([\w_]+) (yes|no)/
- $func_cache[$1] = $2
- when /^hdr: (.+) (yes|no)/
- $hdr_cache[$1] = $2
- end
- end
- f.close
-end
-
-def older(file1, file2)
- if !File.exist?(file1) then
- return TRUE
- end
- if !File.exist?(file2) then
- return FALSE
- end
- if File.mtime(file1) < File.mtime(file2)
- return TRUE
- end
- return FALSE
-end
-
-#LINK = "cl -o conftest.exe -I../.. -Zi -O -I. %s conftest.c %s > nul"
-LINK = "cl -o conftest.exe -Zi -O %s conftest.c %s > nul"
-CPP = "cl -E -I../.. -I../../missing -I../../win32 -I. -Zi -O %s conftest.c > nul"
-
-def try_link(libs)
- #print(format("try #{LINK}", $CFLAGS, $LDFLAGS, libs))
- #system(format(LINK, $CFLAGS, $LDFLAGS, libs))
- print(format("try #{LINK}\n", $CFLAGS, libs))
- system(format(LINK, $CFLAGS, libs))
-end
-
-def try_cpp
- system(format(CPP, $CFLAGS))
-end
-
-def have_library(lib, func)
- #print format("have_library(%s, %s)\n", lib, func)
- if $lib_cache[lib]
- if $lib_cache[lib] == "yes"
- if $libs#
- $libs = lib + ".lib " + $libs
- else
- $libs = lib + ".lib "
- end
- return TRUE
- else
- return FALSE
- end
- end
-
- cfile = open("conftest.c", "w")
- cfile.printf "\
-#include <windows.h>
-#include <winsock.h>
-int main() { return 0; }
-int t() { %s(); return 0; }
-", func
- cfile.close
-
- begin
- if $libs
- libs = lib + ".lib " + $libs
- else
- libs = lib + ".lib"
- end
- #print "libs=#{libs}\n"
- unless try_link(libs)
- #print "fail : #{libs}\n"
- $lib_cache[lib] = 'no'
- $cache_mod = TRUE
- return FALSE
- end
- ensure
- system "rm -f conftest*"
- end
-
- $libs = libs
- $lib_cache[lib] = 'yes'
- $cache_mod = TRUE
- return TRUE
-end
-
-def have_func(func)
- if $func_cache[func]
- if $func_cache[func] == "yes"
- $defs.push(format("-DHAVE_%s", func.upcase))
- return TRUE
- else
- return FALSE
- end
- end
-
- cfile = open("conftest.c", "w")
- cfile.printf "\
-#include <windows.h>
-#include <winsock.h>
-//char %s();
-int main() { return 0; }
-int t() { %s(); return 0; }
-", func, func
- cfile.close
-
- libs = $libs
- libs = "" if libs == nil
-
- begin
- #print "libs=#{libs}\n"
- unless try_link(libs)
- $func_cache[func] = 'no'
- $cache_mod = TRUE
- return FALSE
- end
- ensure
- system "rm -f conftest*"
- end
- $defs.push(format("-DHAVE_%s", func.upcase))
- $func_cache[func] = 'yes'
- $cache_mod = TRUE
- return TRUE
-end
-
-def have_header(header)
- if $hdr_cache[header]
- if $hdr_cache[header] == "yes"
- header.tr!("a-z./\055", "A-Z___")
- $defs.push(format("-DHAVE_%s", header))
- return TRUE
- else
- return FALSE
- end
- end
-
- cfile = open("conftest.c", "w")
- cfile.printf "\
-#include <%s>
-", header
- cfile.close
-
- begin
- unless try_cpp
- $hdr_cache[header] = 'no'
- $cache_mod = TRUE
- return FALSE
- end
- ensure
- system "rm -f conftest*"
- end
- $hdr_cache[header] = 'yes'
- header.tr!("a-z./\055", "A-Z___")
- $defs.push(format("-DHAVE_%s", header))
- $cache_mod = TRUE
- return TRUE
-end
-
-def create_header()
- if $defs.length > 0
- hfile = open("extconf.h", "w")
- for line in $defs
- line =~ /^-D(.*)/
- hfile.printf "#define %s 1\n", $1
- end
- hfile.close
- end
-end
-
-def create_makefile(target)
-
- if $libs and "obj" == "obj"
- libs = $libs.split
- for lib in libs
- lib.sub!(/(.*)/, '"\1.lib"') if /.lib$/ !~ lib
- end
- $defs.push(format("-DEXTLIB='%s'", libs.join(",")))
- end
- $libs = "" unless $libs
-
- mfile = open("Makefile", "w")
- mfile.printf "\
-SHELL = $(COMPSEC)
-
-#### Start of system configuration section. ####
-
-srcdir = .
-VPATH = .
-
-CC = cl
-
-CFLAGS = %s -I../.. -I../../missing -I../../win32 -I. -O -DNT %s #$CFLAGS %s
-
-RUBYLIB = ../../ruby.lib
-DLDFLAGS = /DLL
-LDSHARED =
-", if $static then "" else "-fpic" end, $dllopt, $defs.join(" ")
-
- if $force_static
- print "static\n"
- else
- print "non static\n"
- end
-
- mfile.printf "\
-
-libdir = /usr/local/lib/ruby/i386-mswin32
-
-
-#### End of system configuration section. ####
-"
- mfile.printf "LOCAL_LIBS = %s\n", $local_libs if $local_libs
- mfile.printf "LIBS = %s\n", $libs
- mfile.printf "OBJS = "
- if !$objs then
- $objs = Dir["*.c"]
- for f in $objs
- f.sub!(/\.c$/, ".obj")
- end
- end
- mfile.printf $objs.join(" ")
- mfile.printf "\n"
-
- dots = if "ginstall -c" =~ /^\// then "" else "../" end
- mfile.printf "\
-TARGET = %s.%s
-
-INSTALL = %sginstall -c
-
-DEFFILE = %s.def
-
-all: $(TARGET)
-
-clean:; @rm -f *.obj *.lib *.exp vc*.pdb *.bak *.def
- @rm -f Makefile extconf.h conftest.*
-
-realclean: clean
-", target,
- if $force_static then "lib" else "dll" end, dots, target
-
- if !$static
- mfile.printf "\
-
-install: $(libdir)/$(TARGET)
-
-$(libdir)/$(TARGET): $(TARGET)
- @test -d $(libdir) || mkdir $(libdir)
- $(INSTALL) $(TARGET) $(libdir)/$(TARGET)
-"
- else
- mfile.printf "\
-
-install:;
-"
- end
-
- if $force_static
- mfile.printf "\
-$(TARGET): $(OBJS)
- lib /OUT:$(TARGET) $(OBJS)
-"
- else
- mfile.printf "\
-$(DEFFILE):
- echo $(DEFFILE)
-
-$(TARGET): $(OBJS) $(DEFFILE)
- cl -DLL -o$(TARGET) $(OBJS) $(RUBYLIB) -link /DEF:$(DEFFILE)
-"
- end
-
- if File.exist?("depend")
- dfile = open("depend", "r")
- mfile.printf "###\n"
- while line = dfile.gets()
- mfile.printf "%s", line
- end
- dfile.close
- end
- mfile.close
- if $static
- #printf format("push %s,%s\n", $static, target); ##debug print##
- $extlist.push [$static,target]
- end
-end
-
-#template of .def file.
-def create_def(basename)
- defname = sprintf("%s.def", basename)
- f = open(defname, "w")
- f.printf "\
-LIBRARY %s.dll
-CODE LOADONCALL
-DATA LOADONCALL
-DESCRIPTION 'win32 %s.dll'
-EXPORTS
-
- Init_%s
-", basename, basename, basename
- f.close
-
-end
-
-def extmake(target)
- if $force_static or $static_ext[target]
- $static = target
- else
- $static = FALSE
- end
-
- return if $nodynamic and not $static
-
- $local_libs = nil
- $libs = nil
- $objs = nil
- $CFLAGS = nil
- $LDFLAGS = nil
-
- begin
- Dir.chdir target
- if $static_ext.size > 0 ||
- !File.exist?("./Makefile") ||
- older("./Makefile", "../Setup") ||
- older("./Makefile", "../extmk.rb") ||
- older("./Makefile", "./extconf.rb")
- then
- $defs = []
- if File.exist?("extconf.rb")
- load "extconf.rb"
- else
- create_makefile(target);
- end
- end
-
- if !File.exist?("#{target}.def")
- create_def(target)
- end
-
- if File.exist?("./Makefile")
- if $install
- system "nmake install"
- if File.directory? "./lib"
- for i in Dir["./lib/*.rb"]
- system "ginstall -c #{i} /usr/local/lib/ruby/i386-mswin32"
- end
- end
- elsif $clean
- system "nmake clean"
- else
- #print "!!!make!!!\n"
- system "nmake all"
- end
- end
- if $static
- $extlibs = " "
- $extlibs += " " + $LDFLAGS if $LDFLAGS
- $extlibs += " " + $local_libs if $local_libs
- $extlibs += " " + $libs if $libs
- end
- ensure
- Dir.chdir ".."
- end
-end
-
-# get static-link modules
-$static_ext = {}
-if File.file? "./Setup"
- f = open("./Setup")
- while f.gets()
- $_.chop!
- sub!(/#.*$/, '')
- next if /^\s*$/
- #print $_, "\n"
-
- if /^option +nodynamic/
- $nodynamic = TRUE
- next
- end
- $static_ext[$_.split[0]] = TRUE
- end
- f.close
-end
-
-for d in Dir["*"]
- File.directory?(d) || next
- File.file?(d + "/MANIFEST") || next
-
- d = $1 if d =~ /\/([\/]*)$/
- if $install
- print "installing ", d, "\n"
- elsif $clean
- print "cleaning ", d, "\n"
- else
- print "compiling ", d, "\n"
- end
- extmake(d)
-end
-
-if $cache_mod
- f = open("config.cache", "w")
- for k,v in $lib_cache
- f.printf "lib: %s %s\n", k, v
- end
- for k,v in $func_cache
- f.printf "func: %s %s\n", k, v
- end
- for k,v in $hdr_cache
- f.printf "hdr: %s %s\n", k, v
- end
- f.close
-end
-
-exit if $install or $clean
-$extinit = " " unless $extinit
-$extobjs = ""
-if $extlist.size > 0
- for s,t in $extlist
- #for s,t in $static_ext
- #f = format("%s/%s.obj", s, t)
- #f = format("%s/%s.obj", s, s)
- l = format("%s/%s.lib", s, s)
- if File.exist?(l)
- $extinit += format("\
-\tInit_%s();\n\
-\trb_provide(\"%s.o\");\n\
-", s, s)
- $extobjs += "ext/"
- #$extobjs += f # *.obj
- $extobjs += l # *.lib
- $extobjs += " "
- else
- FALSE
- end
- end
-
- if older("extinit.c", "Setup")
- f = open("extinit.c", "w")
- f.printf "void Init_ext() {\n"
- f.printf $extinit
- f.printf "}\n"
- f.close
- end
- if older("extinit.obj", "extinit.c")
- cmd = "cl -Zi -O -I. -c extinit.c"
- print cmd, "\n"
- system cmd or exit 1
- end
-
- Dir.chdir ".."
-
- if older("ruby.exe", "ext/Setup") or older("ruby.exe", "miniruby.exe")
- `rm -f ruby.exe`
- end
-
- $extobjs = "ext/extinit.obj " + $extobjs
- #$extlibs = ""
- #print "EXTLIBS=#{$extlibs}\n"
- $extlibs.gsub!("-L/usr/local/lib", "") if $extlibs
- $extlibs.gsub!(" +", " ") if $extlibs
- #print "EXTLIBS=#{$extlibs}\n"
-
- system format('nmake ruby.exe EXTOBJS="%s" EXTLIBS="%s"', $extobjs, $extlibs)
-else
- Dir.chdir ".."
- if older("ruby.exe", "miniruby.exe")
- `rm -f ruby.exe`
- `cp miniruby.exe ruby.exe`
- end
-end
-#Local variables:
-# mode: ruby
-#end:
diff --git a/ext/fcntl/.cvsignore b/ext/fcntl/.cvsignore
new file mode 100644
index 0000000000..4088712231
--- /dev/null
+++ b/ext/fcntl/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+mkmf.log
+*.def
diff --git a/ext/fcntl/MANIFEST b/ext/fcntl/MANIFEST
deleted file mode 100644
index aef7ad4ca0..0000000000
--- a/ext/fcntl/MANIFEST
+++ /dev/null
@@ -1,3 +0,0 @@
-MANIFEST
-depend
-fcntl.c
diff --git a/ext/fcntl/depend b/ext/fcntl/depend
index a7915c7d92..10eab64a46 100644
--- a/ext/fcntl/depend
+++ b/ext/fcntl/depend
@@ -1 +1 @@
-fcntl.o: fcntl.c $(hdrdir)/ruby.h $(hdrdir)/config.h $(hdrdir)/defines.h
+fcntl.o: fcntl.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/fcntl/extconf.rb b/ext/fcntl/extconf.rb
new file mode 100644
index 0000000000..8b717d4a5b
--- /dev/null
+++ b/ext/fcntl/extconf.rb
@@ -0,0 +1,2 @@
+require 'mkmf'
+create_makefile('fcntl')
diff --git a/ext/fcntl/fcntl.c b/ext/fcntl/fcntl.c
index 186f9ac893..d48630fc66 100644
--- a/ext/fcntl/fcntl.c
+++ b/ext/fcntl/fcntl.c
@@ -5,7 +5,7 @@
$Author$
created at: Mon Apr 7 18:53:05 JST 1997
- Copyright (C) 1997-1998 Yukihiro Matsumoto
+ Copyright (C) 1997-2001 Yukihiro Matsumoto
************************************************/
@@ -34,6 +34,7 @@ pack up your own arguments to pass as args for locking functions, etc.
#include "ruby.h"
#include <fcntl.h>
+void
Init_fcntl()
{
VALUE mFcntl = rb_define_module("Fcntl");
@@ -103,4 +104,9 @@ Init_fcntl()
#ifdef O_WRONLY
rb_define_const(mFcntl, "O_WRONLY", INT2NUM(O_WRONLY));
#endif
+#ifdef O_ACCMODE
+ rb_define_const(mFcntl, "O_ACCMODE", INT2FIX(O_ACCMODE));
+#else
+ rb_define_const(mFcntl, "O_ACCMODE", INT2FIX(O_RDONLY | O_WRONLY | O_RDWR));
+#endif
}
diff --git a/ext/gdbm/.cvsignore b/ext/gdbm/.cvsignore
new file mode 100644
index 0000000000..4088712231
--- /dev/null
+++ b/ext/gdbm/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+mkmf.log
+*.def
diff --git a/ext/gdbm/README b/ext/gdbm/README
new file mode 100644
index 0000000000..df7a261c68
--- /dev/null
+++ b/ext/gdbm/README
@@ -0,0 +1 @@
+gdbm ext-library for Ruby 1.3 or later
diff --git a/ext/gdbm/depend b/ext/gdbm/depend
new file mode 100644
index 0000000000..c080a81619
--- /dev/null
+++ b/ext/gdbm/depend
@@ -0,0 +1 @@
+gdbm.o: gdbm.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/gdbm/extconf.rb b/ext/gdbm/extconf.rb
new file mode 100644
index 0000000000..5a09492e5e
--- /dev/null
+++ b/ext/gdbm/extconf.rb
@@ -0,0 +1,7 @@
+require 'mkmf'
+
+dir_config("gdbm")
+if have_library("gdbm", "gdbm_open") and
+ have_header("gdbm.h")
+ create_makefile("gdbm")
+end
diff --git a/ext/gdbm/gdbm.c b/ext/gdbm/gdbm.c
new file mode 100644
index 0000000000..799445a89c
--- /dev/null
+++ b/ext/gdbm/gdbm.c
@@ -0,0 +1,1030 @@
+/************************************************
+
+ gdbm.c -
+
+ $Author$
+ $Date$
+ modified at: Mon Jan 24 15:59:52 JST 1994
+
+************************************************/
+
+#include "ruby.h"
+
+#include <gdbm.h>
+#include <fcntl.h>
+#include <errno.h>
+
+static VALUE rb_cGDBM, rb_eGDBMError, rb_eGDBMFatalError;
+
+#define RUBY_GDBM_RW_BIT 0x20000000
+
+#define MY_BLOCK_SIZE (2048)
+#define MY_FATAL_FUNC rb_gdbm_fatal
+static void
+rb_gdbm_fatal(msg)
+ char *msg;
+{
+ rb_raise(rb_eGDBMFatalError, msg);
+}
+
+struct dbmdata {
+ int di_size;
+ GDBM_FILE di_dbm;
+};
+
+static void
+closed_dbm()
+{
+ rb_raise(rb_eRuntimeError, "closed GDBM file");
+}
+
+#define GetDBM(obj, dbmp) do {\
+ Data_Get_Struct(obj, struct dbmdata, dbmp);\
+ if (dbmp == 0) closed_dbm();\
+ if (dbmp->di_dbm == 0) closed_dbm();\
+} while (0)
+
+static void
+free_dbm(dbmp)
+ struct dbmdata *dbmp;
+{
+ if (dbmp) {
+ if (dbmp->di_dbm) gdbm_close(dbmp->di_dbm);
+ free(dbmp);
+ }
+}
+
+static VALUE
+fgdbm_close(obj)
+ VALUE obj;
+{
+ struct dbmdata *dbmp;
+
+ GetDBM(obj, dbmp);
+ gdbm_close(dbmp->di_dbm);
+ dbmp->di_dbm = 0;
+
+ return Qnil;
+}
+
+static VALUE fgdbm_s_alloc _((VALUE));
+
+static VALUE
+fgdbm_s_alloc(klass)
+ VALUE klass;
+{
+ return Data_Wrap_Struct(klass, 0, free_dbm, 0);
+}
+
+static VALUE
+fgdbm_initialize(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE file, vmode, vflags;
+ GDBM_FILE dbm;
+ struct dbmdata *dbmp;
+ int mode, flags = 0;
+
+ if (rb_scan_args(argc, argv, "12", &file, &vmode, &vflags) == 1) {
+ mode = 0666; /* default value */
+ }
+ else if (NIL_P(vmode)) {
+ mode = -1; /* return nil if DB not exist */
+ }
+ else {
+ mode = NUM2INT(vmode);
+ }
+
+ if (!NIL_P(vflags))
+ flags = NUM2INT(vflags);
+
+ SafeStringValue(file);
+
+ if (flags & RUBY_GDBM_RW_BIT) {
+ flags &= ~RUBY_GDBM_RW_BIT;
+ dbm = gdbm_open(RSTRING(file)->ptr, MY_BLOCK_SIZE,
+ flags, mode, MY_FATAL_FUNC);
+ }
+ else {
+ dbm = 0;
+ if (mode >= 0)
+ dbm = gdbm_open(RSTRING(file)->ptr, MY_BLOCK_SIZE,
+ GDBM_WRCREAT|flags, mode, MY_FATAL_FUNC);
+ if (!dbm)
+ dbm = gdbm_open(RSTRING(file)->ptr, MY_BLOCK_SIZE,
+ GDBM_WRITER|flags, 0, MY_FATAL_FUNC);
+ if (!dbm)
+ dbm = gdbm_open(RSTRING(file)->ptr, MY_BLOCK_SIZE,
+ GDBM_READER|flags, 0, MY_FATAL_FUNC);
+ }
+
+ if (!dbm) {
+ if (mode == -1) return Qnil;
+
+ if (gdbm_errno == GDBM_FILE_OPEN_ERROR ||
+ gdbm_errno == GDBM_CANT_BE_READER ||
+ gdbm_errno == GDBM_CANT_BE_WRITER)
+ rb_sys_fail(RSTRING(file)->ptr);
+ else
+ rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
+ }
+
+ dbmp = ALLOC(struct dbmdata);
+ free_dbm(DATA_PTR(obj));
+ DATA_PTR(obj) = dbmp;
+ dbmp->di_dbm = dbm;
+ dbmp->di_size = -1;
+
+ return obj;
+}
+
+static VALUE
+fgdbm_s_open(argc, argv, klass)
+ int argc;
+ VALUE *argv;
+ VALUE klass;
+{
+ VALUE obj = Data_Wrap_Struct(klass, 0, free_dbm, 0);
+
+ if (NIL_P(fgdbm_initialize(argc, argv, obj))) {
+ return Qnil;
+ }
+
+ if (rb_block_given_p()) {
+ return rb_ensure(rb_yield, obj, fgdbm_close, obj);
+ }
+
+ return obj;
+}
+
+static VALUE
+rb_gdbm_fetch(dbm, key)
+ GDBM_FILE dbm;
+ datum key;
+{
+ datum val;
+ VALUE str;
+
+ val = gdbm_fetch(dbm, key);
+ if (val.dptr == 0)
+ return Qnil;
+
+ str = rb_obj_alloc(rb_cString);
+ RSTRING(str)->len = val.dsize;
+ RSTRING(str)->aux.capa = val.dsize;
+ RSTRING(str)->ptr = REALLOC_N(val.dptr,char,val.dsize+1);
+ RSTRING(str)->ptr[val.dsize] = '\0';
+
+ OBJ_TAINT(str);
+ return (VALUE)str;
+}
+
+static VALUE
+rb_gdbm_fetch2(dbm, keystr)
+ GDBM_FILE dbm;
+ VALUE keystr;
+{
+ datum key;
+
+ StringValue(keystr);
+ key.dptr = RSTRING(keystr)->ptr;
+ key.dsize = RSTRING(keystr)->len;
+
+ return rb_gdbm_fetch(dbm, key);
+}
+
+static VALUE
+rb_gdbm_fetch3(obj, keystr)
+ VALUE obj, keystr;
+{
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+ return rb_gdbm_fetch2(dbm, keystr);
+}
+
+static VALUE
+rb_gdbm_firstkey(dbm)
+ GDBM_FILE dbm;
+{
+ datum key;
+ VALUE str;
+
+ key = gdbm_firstkey(dbm);
+ if (key.dptr == 0)
+ return Qnil;
+
+ str = rb_obj_alloc(rb_cString);
+ RSTRING(str)->len = key.dsize;
+ RSTRING(str)->aux.capa = key.dsize;
+ RSTRING(str)->ptr = REALLOC_N(key.dptr,char,key.dsize+1);
+ RSTRING(str)->ptr[RSTRING(str)->len] = '\0';
+
+ OBJ_TAINT(str);
+ return str;
+}
+
+static VALUE
+rb_gdbm_nextkey(dbm, keystr)
+ GDBM_FILE dbm;
+ VALUE keystr;
+{
+ datum key, key2;
+ VALUE str;
+
+ key.dptr = RSTRING(keystr)->ptr;
+ key.dsize = RSTRING(keystr)->len;
+ key2 = gdbm_nextkey(dbm, key);
+ if (key2.dptr == 0)
+ return Qnil;
+
+ str = rb_obj_alloc(rb_cString);
+ RSTRING(str)->len = key2.dsize;
+ RSTRING(str)->aux.capa = key2.dsize;
+ RSTRING(str)->ptr = REALLOC_N(key2.dptr,char,key2.dsize+1);
+ RSTRING(str)->ptr[RSTRING(str)->len] = '\0';
+
+ OBJ_TAINT(str);
+ return str;
+}
+
+static VALUE
+fgdbm_fetch(obj, keystr, ifnone)
+ VALUE obj, keystr, ifnone;
+{
+ VALUE valstr;
+
+ valstr = rb_gdbm_fetch3(obj, keystr);
+ if (NIL_P(valstr)) {
+ if (ifnone == Qnil && rb_block_given_p())
+ return rb_yield(keystr);
+ return ifnone;
+ }
+ return valstr;
+}
+
+static VALUE
+fgdbm_aref(obj, keystr)
+ VALUE obj, keystr;
+{
+ return rb_gdbm_fetch3(obj, keystr);
+}
+
+static VALUE
+fgdbm_fetch_m(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE keystr, valstr, ifnone;
+
+ rb_scan_args(argc, argv, "11", &keystr, &ifnone);
+ valstr = fgdbm_fetch(obj, keystr, ifnone);
+ if (argc == 1 && !rb_block_given_p() && NIL_P(valstr))
+ rb_raise(rb_eIndexError, "key not found");
+
+ return valstr;
+}
+
+static VALUE
+fgdbm_index(obj, valstr)
+ VALUE obj, valstr;
+{
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+ VALUE keystr, valstr2;
+
+ StringValue(valstr);
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+ for (keystr = rb_gdbm_firstkey(dbm); RTEST(keystr);
+ keystr = rb_gdbm_nextkey(dbm, keystr)) {
+
+ valstr2 = rb_gdbm_fetch2(dbm, keystr);
+ if (!NIL_P(valstr2) &&
+ RSTRING(valstr)->len == RSTRING(valstr2)->len &&
+ memcmp(RSTRING(valstr)->ptr, RSTRING(valstr2)->ptr,
+ RSTRING(valstr)->len) == 0) {
+ return keystr;
+ }
+ }
+ return Qnil;
+}
+
+static VALUE
+fgdbm_indexes(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE new;
+ int i;
+
+ new = rb_ary_new2(argc);
+ for (i=0; i<argc; i++) {
+ rb_ary_push(new, rb_gdbm_fetch3(obj, argv[i]));
+ }
+
+ return new;
+}
+
+static VALUE
+fgdbm_select(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE new = rb_ary_new2(argc);
+ int i;
+
+ if (rb_block_given_p()) {
+ GDBM_FILE dbm;
+ struct dbmdata *dbmp;
+ VALUE keystr;
+
+ if (argc > 0) {
+ rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc);
+ }
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+
+ for (keystr = rb_gdbm_firstkey(dbm); RTEST(keystr);
+ keystr = rb_gdbm_nextkey(dbm, keystr)) {
+ VALUE assoc = rb_assoc_new(keystr, rb_gdbm_fetch2(dbm, keystr));
+
+ if (RTEST(rb_yield(assoc)))
+ rb_ary_push(new, assoc);
+ }
+ }
+ else {
+ rb_warn("GDBM#select(index..) is deprecated; use GDBM#values_at");
+
+ for (i=0; i<argc; i++) {
+ rb_ary_push(new, rb_gdbm_fetch3(obj, argv[i]));
+ }
+ }
+
+ return new;
+}
+
+static VALUE
+fgdbm_values_at(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
+{
+ VALUE new = rb_ary_new2(argc);
+ int i;
+
+ for (i=0; i<argc; i++) {
+ rb_ary_push(new, rb_gdbm_fetch3(obj, argv[i]));
+ }
+
+ return new;
+}
+
+static void
+rb_gdbm_modify(obj)
+ VALUE obj;
+{
+ rb_secure(4);
+ if (OBJ_FROZEN(obj)) rb_error_frozen("GDBM");
+}
+
+static VALUE
+rb_gdbm_delete(obj, keystr)
+ VALUE obj, keystr;
+{
+ datum key;
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+
+ rb_gdbm_modify(obj);
+ StringValue(keystr);
+ key.dptr = RSTRING(keystr)->ptr;
+ key.dsize = RSTRING(keystr)->len;
+
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+
+ if (!gdbm_exists(dbm, key)) {
+ return Qnil;
+ }
+
+ if (gdbm_delete(dbm, key)) {
+ dbmp->di_size = -1;
+ rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
+ }
+ else if (dbmp->di_size >= 0) {
+ dbmp->di_size--;
+ }
+ return obj;
+}
+
+static VALUE
+fgdbm_delete(obj, keystr)
+ VALUE obj, keystr;
+{
+ VALUE valstr;
+
+ valstr = fgdbm_fetch(obj, keystr, Qnil);
+ rb_gdbm_delete(obj, keystr);
+ return valstr;
+}
+
+static VALUE
+fgdbm_shift(obj)
+ VALUE obj;
+{
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+ VALUE keystr, valstr;
+
+ rb_gdbm_modify(obj);
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+
+ keystr = rb_gdbm_firstkey(dbm);
+ if (NIL_P(keystr)) return Qnil;
+ valstr = rb_gdbm_fetch2(dbm, keystr);
+ rb_gdbm_delete(obj, keystr);
+
+ return rb_assoc_new(keystr, valstr);
+}
+
+static VALUE
+fgdbm_delete_if(obj)
+ VALUE obj;
+{
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+ VALUE keystr, valstr;
+ VALUE ret, ary = rb_ary_new();
+ int i, status = 0, n;
+
+ rb_gdbm_modify(obj);
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+ n = dbmp->di_size;
+ dbmp->di_size = -1;
+
+ for (keystr = rb_gdbm_firstkey(dbm); RTEST(keystr);
+ keystr = rb_gdbm_nextkey(dbm, keystr)) {
+
+ valstr = rb_gdbm_fetch2(dbm, keystr);
+ ret = rb_protect(rb_yield, rb_assoc_new(keystr, valstr), &status);
+ if (status != 0) break;
+ if (RTEST(ret)) rb_ary_push(ary, keystr);
+ }
+
+ for (i = 0; i < RARRAY(ary)->len; i++)
+ rb_gdbm_delete(obj, RARRAY(ary)->ptr[i]);
+ if (status) rb_jump_tag(status);
+ if (n > 0) dbmp->di_size = n - RARRAY(ary)->len;
+
+ return obj;
+}
+
+static VALUE
+fgdbm_clear(obj)
+ VALUE obj;
+{
+ datum key, nextkey;
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+
+ rb_gdbm_modify(obj);
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+ dbmp->di_size = -1;
+
+#if 0
+ while (key = gdbm_firstkey(dbm), key.dptr) {
+ if (gdbm_delete(dbm, key)) {
+ free(key.dptr);
+ rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
+ }
+ free(key.dptr);
+ }
+#else
+ while (key = gdbm_firstkey(dbm), key.dptr) {
+ for (; key.dptr; key = nextkey) {
+ nextkey = gdbm_nextkey(dbm, key);
+ if (gdbm_delete(dbm, key)) {
+ free(key.dptr);
+ if (nextkey.dptr) free(nextkey.dptr);
+ rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
+ }
+ free(key.dptr);
+ }
+ }
+#endif
+ dbmp->di_size = 0;
+
+ return obj;
+}
+
+static VALUE
+fgdbm_invert(obj)
+ VALUE obj;
+{
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+ VALUE keystr, valstr;
+ VALUE hash = rb_hash_new();
+
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+ for (keystr = rb_gdbm_firstkey(dbm); RTEST(keystr);
+ keystr = rb_gdbm_nextkey(dbm, keystr)) {
+ valstr = rb_gdbm_fetch2(dbm, keystr);
+
+ rb_hash_aset(hash, valstr, keystr);
+ }
+ return hash;
+}
+
+static VALUE each_pair _((VALUE));
+
+static VALUE
+each_pair(obj)
+ VALUE obj;
+{
+ return rb_funcall(obj, rb_intern("each_pair"), 0, 0);
+}
+
+static VALUE fgdbm_store _((VALUE,VALUE,VALUE));
+
+static VALUE
+update_i(pair, dbm)
+ VALUE pair, dbm;
+{
+ Check_Type(pair, T_ARRAY);
+ if (RARRAY(pair)->len < 2) {
+ rb_raise(rb_eArgError, "pair must be [key, value]");
+ }
+ fgdbm_store(dbm, RARRAY(pair)->ptr[0], RARRAY(pair)->ptr[1]);
+ return Qnil;
+}
+
+static VALUE
+fgdbm_update(obj, other)
+ VALUE obj, other;
+{
+ rb_iterate(each_pair, other, update_i, obj);
+ return obj;
+}
+
+static VALUE
+fgdbm_replace(obj, other)
+ VALUE obj, other;
+{
+ fgdbm_clear(obj);
+ rb_iterate(each_pair, other, update_i, obj);
+ return obj;
+}
+
+static VALUE
+fgdbm_store(obj, keystr, valstr)
+ VALUE obj, keystr, valstr;
+{
+ datum key, val;
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+
+ rb_gdbm_modify(obj);
+ StringValue(keystr);
+ key.dptr = RSTRING(keystr)->ptr;
+ key.dsize = RSTRING(keystr)->len;
+
+ StringValue(valstr);
+ val.dptr = RSTRING(valstr)->ptr;
+ val.dsize = RSTRING(valstr)->len;
+
+ GetDBM(obj, dbmp);
+ dbmp->di_size = -1;
+ dbm = dbmp->di_dbm;
+ if (gdbm_store(dbm, key, val, GDBM_REPLACE)) {
+ if (errno == EPERM) rb_sys_fail(0);
+ rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
+ }
+
+ return valstr;
+}
+
+static VALUE
+fgdbm_length(obj)
+ VALUE obj;
+{
+ datum key, nextkey;
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+ int i = 0;
+
+ GetDBM(obj, dbmp);
+ if (dbmp->di_size > 0) return INT2FIX(dbmp->di_size);
+ dbm = dbmp->di_dbm;
+
+ for (key = gdbm_firstkey(dbm); key.dptr; key = nextkey) {
+ nextkey = gdbm_nextkey(dbm, key);
+ free(key.dptr);
+ i++;
+ }
+ dbmp->di_size = i;
+
+ return INT2FIX(i);
+}
+
+static VALUE
+fgdbm_empty_p(obj)
+ VALUE obj;
+{
+ datum key;
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+
+ GetDBM(obj, dbmp);
+ if (dbmp->di_size < 0) {
+ dbm = dbmp->di_dbm;
+
+ key = gdbm_firstkey(dbm);
+ if (key.dptr) {
+ free(key.dptr);
+ return Qfalse;
+ }
+ return Qtrue;
+ }
+
+ if (dbmp->di_size == 0) return Qtrue;
+ return Qfalse;
+}
+
+static VALUE
+fgdbm_each_value(obj)
+ VALUE obj;
+{
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+ VALUE keystr;
+
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+
+ for (keystr = rb_gdbm_firstkey(dbm); RTEST(keystr);
+ keystr = rb_gdbm_nextkey(dbm, keystr)) {
+
+ rb_yield(rb_gdbm_fetch2(dbm, keystr));
+ }
+ return obj;
+}
+
+static VALUE
+fgdbm_each_key(obj)
+ VALUE obj;
+{
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+ VALUE keystr;
+
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+
+ for (keystr = rb_gdbm_firstkey(dbm); RTEST(keystr);
+ keystr = rb_gdbm_nextkey(dbm, keystr)) {
+
+ rb_yield(keystr);
+ }
+ return obj;
+}
+
+static VALUE
+fgdbm_each_pair(obj)
+ VALUE obj;
+{
+ GDBM_FILE dbm;
+ struct dbmdata *dbmp;
+ VALUE keystr;
+
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+
+ for (keystr = rb_gdbm_firstkey(dbm); RTEST(keystr);
+ keystr = rb_gdbm_nextkey(dbm, keystr)) {
+
+ rb_yield(rb_assoc_new(keystr, rb_gdbm_fetch2(dbm, keystr)));
+ }
+
+ return obj;
+}
+
+static VALUE
+fgdbm_keys(obj)
+ VALUE obj;
+{
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+ VALUE keystr, ary;
+
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+
+ ary = rb_ary_new();
+ for (keystr = rb_gdbm_firstkey(dbm); RTEST(keystr);
+ keystr = rb_gdbm_nextkey(dbm, keystr)) {
+
+ rb_ary_push(ary, keystr);
+ }
+
+ return ary;
+}
+
+static VALUE
+fgdbm_values(obj)
+ VALUE obj;
+{
+ datum key, nextkey;
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+ VALUE valstr, ary;
+
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+
+ ary = rb_ary_new();
+ for (key = gdbm_firstkey(dbm); key.dptr; key = nextkey) {
+ nextkey = gdbm_nextkey(dbm, key);
+ valstr = rb_gdbm_fetch(dbm, key);
+ free(key.dptr);
+ rb_ary_push(ary, valstr);
+ }
+
+ return ary;
+}
+
+static VALUE
+fgdbm_has_key(obj, keystr)
+ VALUE obj, keystr;
+{
+ datum key;
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+
+ StringValue(keystr);
+ key.dptr = RSTRING(keystr)->ptr;
+ key.dsize = RSTRING(keystr)->len;
+
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+ if (gdbm_exists(dbm, key))
+ return Qtrue;
+ return Qfalse;
+}
+
+static VALUE
+fgdbm_has_value(obj, valstr)
+ VALUE obj, valstr;
+{
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+ VALUE keystr, valstr2;
+
+ StringValue(valstr);
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+ for (keystr = rb_gdbm_firstkey(dbm); RTEST(keystr);
+ keystr = rb_gdbm_nextkey(dbm, keystr)) {
+
+ valstr2 = rb_gdbm_fetch2(dbm, keystr);
+
+ if (!NIL_P(valstr2) &&
+ RSTRING(valstr)->len == RSTRING(valstr2)->len &&
+ memcmp(RSTRING(valstr)->ptr, RSTRING(valstr2)->ptr,
+ RSTRING(valstr)->len) == 0) {
+ return Qtrue;
+ }
+ }
+ return Qfalse;
+}
+
+static VALUE
+fgdbm_to_a(obj)
+ VALUE obj;
+{
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+ VALUE keystr, ary;
+
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+
+ ary = rb_ary_new();
+ for (keystr = rb_gdbm_firstkey(dbm); RTEST(keystr);
+ keystr = rb_gdbm_nextkey(dbm, keystr)) {
+
+ rb_ary_push(ary, rb_assoc_new(keystr, rb_gdbm_fetch2(dbm, keystr)));
+ }
+
+ return ary;
+}
+
+static VALUE
+fgdbm_reorganize(obj)
+ VALUE obj;
+{
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+
+ rb_gdbm_modify(obj);
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+ gdbm_reorganize(dbm);
+ return obj;
+}
+
+static VALUE
+fgdbm_sync(obj)
+ VALUE obj;
+{
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+
+ rb_gdbm_modify(obj);
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+ gdbm_sync(dbm);
+ return obj;
+}
+
+static VALUE
+fgdbm_set_cachesize(obj, val)
+ VALUE obj, val;
+{
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+ int optval;
+
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+
+ optval = FIX2INT(val);
+ if (gdbm_setopt(dbm, GDBM_CACHESIZE, &optval, sizeof(optval)) == -1) {
+ rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
+ }
+ return val;
+}
+
+static VALUE
+fgdbm_set_fastmode(obj, val)
+ VALUE obj, val;
+{
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+ int optval;
+
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+
+ optval = 0;
+ if (RTEST(val))
+ optval = 1;
+
+ if (gdbm_setopt(dbm, GDBM_FASTMODE, &optval, sizeof(optval)) == -1) {
+ rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
+ }
+ return val;
+}
+
+static VALUE
+fgdbm_set_syncmode(obj, val)
+ VALUE obj, val;
+{
+#if !defined(GDBM_SYNCMODE)
+ fgdbm_set_fastmode(obj, RTEST(val) ? Qfalse : Qtrue);
+ return val;
+#else
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+ int optval;
+
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+
+ optval = 0;
+ if (RTEST(val))
+ optval = 1;
+
+ if (gdbm_setopt(dbm, GDBM_FASTMODE, &optval, sizeof(optval)) == -1) {
+ rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
+ }
+ return val;
+#endif
+}
+
+static VALUE
+fgdbm_to_hash(obj)
+ VALUE obj;
+{
+ struct dbmdata *dbmp;
+ GDBM_FILE dbm;
+ VALUE keystr, hash;
+
+ GetDBM(obj, dbmp);
+ dbm = dbmp->di_dbm;
+
+ hash = rb_hash_new();
+ for (keystr = rb_gdbm_firstkey(dbm); RTEST(keystr);
+ keystr = rb_gdbm_nextkey(dbm, keystr)) {
+
+ rb_hash_aset(hash, keystr, rb_gdbm_fetch2(dbm, keystr));
+ }
+
+ return hash;
+}
+
+static VALUE
+fgdbm_reject(obj)
+ VALUE obj;
+{
+ return rb_hash_delete_if(fgdbm_to_hash(obj));
+}
+
+void
+Init_gdbm()
+{
+ rb_cGDBM = rb_define_class("GDBM", rb_cObject);
+ rb_eGDBMError = rb_define_class("GDBMError", rb_eStandardError);
+ rb_eGDBMFatalError = rb_define_class("GDBMFatalError", rb_eException);
+ rb_include_module(rb_cGDBM, rb_mEnumerable);
+
+ rb_define_alloc_func(rb_cGDBM, fgdbm_s_alloc);
+ rb_define_singleton_method(rb_cGDBM, "open", fgdbm_s_open, -1);
+
+ rb_define_method(rb_cGDBM, "initialize", fgdbm_initialize, -1);
+ rb_define_method(rb_cGDBM, "close", fgdbm_close, 0);
+ rb_define_method(rb_cGDBM, "[]", fgdbm_aref, 1);
+ rb_define_method(rb_cGDBM, "fetch", fgdbm_fetch_m, -1);
+ rb_define_method(rb_cGDBM, "[]=", fgdbm_store, 2);
+ rb_define_method(rb_cGDBM, "store", fgdbm_store, 2);
+ rb_define_method(rb_cGDBM, "index", fgdbm_index, 1);
+ rb_define_method(rb_cGDBM, "indexes", fgdbm_indexes, -1);
+ rb_define_method(rb_cGDBM, "indices", fgdbm_indexes, -1);
+ rb_define_method(rb_cGDBM, "select", fgdbm_select, -1);
+ rb_define_method(rb_cGDBM, "values_at", fgdbm_values_at, -1);
+ rb_define_method(rb_cGDBM, "length", fgdbm_length, 0);
+ rb_define_method(rb_cGDBM, "size", fgdbm_length, 0);
+ rb_define_method(rb_cGDBM, "empty?", fgdbm_empty_p, 0);
+ rb_define_method(rb_cGDBM, "each", fgdbm_each_pair, 0);
+ rb_define_method(rb_cGDBM, "each_value", fgdbm_each_value, 0);
+ rb_define_method(rb_cGDBM, "each_key", fgdbm_each_key, 0);
+ rb_define_method(rb_cGDBM, "each_pair", fgdbm_each_pair, 0);
+ rb_define_method(rb_cGDBM, "keys", fgdbm_keys, 0);
+ rb_define_method(rb_cGDBM, "values", fgdbm_values, 0);
+ rb_define_method(rb_cGDBM, "shift", fgdbm_shift, 0);
+ rb_define_method(rb_cGDBM, "delete", fgdbm_delete, 1);
+ rb_define_method(rb_cGDBM, "delete_if", fgdbm_delete_if, 0);
+ rb_define_method(rb_cGDBM, "reject!", fgdbm_delete_if, 0);
+ rb_define_method(rb_cGDBM, "reject", fgdbm_reject, 0);
+ rb_define_method(rb_cGDBM, "clear", fgdbm_clear, 0);
+ rb_define_method(rb_cGDBM,"invert", fgdbm_invert, 0);
+ rb_define_method(rb_cGDBM,"update", fgdbm_update, 1);
+ rb_define_method(rb_cGDBM,"replace", fgdbm_replace, 1);
+ rb_define_method(rb_cGDBM,"reorganize", fgdbm_reorganize, 0);
+ rb_define_method(rb_cGDBM,"sync", fgdbm_sync, 0);
+ /* rb_define_method(rb_cGDBM,"setopt", fgdbm_setopt, 2); */
+ rb_define_method(rb_cGDBM,"cachesize=", fgdbm_set_cachesize, 1);
+ rb_define_method(rb_cGDBM,"fastmode=", fgdbm_set_fastmode, 1);
+ rb_define_method(rb_cGDBM,"syncmode=", fgdbm_set_syncmode, 1);
+
+ rb_define_method(rb_cGDBM, "include?", fgdbm_has_key, 1);
+ rb_define_method(rb_cGDBM, "has_key?", fgdbm_has_key, 1);
+ rb_define_method(rb_cGDBM, "member?", fgdbm_has_key, 1);
+ rb_define_method(rb_cGDBM, "has_value?", fgdbm_has_value, 1);
+ rb_define_method(rb_cGDBM, "key?", fgdbm_has_key, 1);
+ rb_define_method(rb_cGDBM, "value?", fgdbm_has_value, 1);
+
+ rb_define_method(rb_cGDBM, "to_a", fgdbm_to_a, 0);
+ rb_define_method(rb_cGDBM, "to_hash", fgdbm_to_hash, 0);
+
+ /* flags for gdbm_open() */
+ rb_define_const(rb_cGDBM, "READER", INT2FIX(GDBM_READER|RUBY_GDBM_RW_BIT));
+ rb_define_const(rb_cGDBM, "WRITER", INT2FIX(GDBM_WRITER|RUBY_GDBM_RW_BIT));
+ rb_define_const(rb_cGDBM, "WRCREAT", INT2FIX(GDBM_WRCREAT|RUBY_GDBM_RW_BIT));
+ rb_define_const(rb_cGDBM, "NEWDB", INT2FIX(GDBM_NEWDB|RUBY_GDBM_RW_BIT));
+
+ rb_define_const(rb_cGDBM, "FAST", INT2FIX(GDBM_FAST));
+ /* this flag is obsolete in gdbm 1.8.
+ On gdbm 1.8, fast mode is default behavior. */
+
+ /* gdbm version 1.8 specific */
+#if defined(GDBM_SYNC)
+ rb_define_const(rb_cGDBM, "SYNC", INT2FIX(GDBM_SYNC));
+#endif
+#if defined(GDBM_NOLOCK)
+ rb_define_const(rb_cGDBM, "NOLOCK", INT2FIX(GDBM_NOLOCK));
+#endif
+ rb_define_const(rb_cGDBM, "VERSION", rb_str_new2(gdbm_version));
+}
diff --git a/ext/gdbm/testgdbm.rb b/ext/gdbm/testgdbm.rb
new file mode 100644
index 0000000000..a435498640
--- /dev/null
+++ b/ext/gdbm/testgdbm.rb
@@ -0,0 +1,663 @@
+require 'runit/testcase'
+require 'runit/cui/testrunner'
+
+if $".grep(/\bgdbm.so\b/).empty?
+ begin
+ require './gdbm'
+ rescue LoadError
+ require 'gdbm'
+ end
+end
+
+def uname_s
+ require 'rbconfig'
+ case Config::CONFIG['host_os']
+ when 'cygwin'
+ require 'Win32API'
+ uname = Win32API.new('cygwin1', 'uname', 'P', 'I')
+ utsname = ' ' * 100
+ raise 'cannot get system name' if uname.call(utsname) == -1
+
+ utsname.unpack('A20' * 5)[0]
+ else
+ Config::CONFIG['host_os']
+ end
+end
+
+SYSTEM = uname_s
+
+class TestGDBM < RUNIT::TestCase
+ def setup
+ @path = "tmptest_gdbm_"
+ assert_instance_of(GDBM, @gdbm = GDBM.new(@path))
+
+ # prepare to make readonly GDBM file
+ GDBM.open("tmptest_gdbm_rdonly", 0400) {|gdbm|
+ gdbm['foo'] = 'FOO'
+ }
+ assert_instance_of(GDBM, @gdbm_rdonly = GDBM.new("tmptest_gdbm_rdonly", nil))
+ end
+ def teardown
+ assert_nil(@gdbm.close)
+ assert_nil(@gdbm_rdonly.close)
+ GC.start
+ File.delete *Dir.glob("tmptest_gdbm*").to_a
+ p Dir.glob("tmptest_gdbm*") if $DEBUG
+ end
+
+ def check_size(expect, gdbm=@gdbm)
+ assert_equals(expect, gdbm.size)
+ n = 0
+ gdbm.each { n+=1 }
+ assert_equals(expect, n)
+ if expect == 0
+ assert_equals(true, gdbm.empty?)
+ else
+ assert_equals(false, gdbm.empty?)
+ end
+ end
+
+ def test_version
+ STDERR.print GDBM::VERSION
+ end
+
+ def test_s_new_has_no_block
+ # GDBM.new ignore the block
+ foo = true
+ assert_instance_of(GDBM, gdbm = GDBM.new("tmptest_gdbm") { foo = false })
+ assert_equals(foo, true)
+ assert_nil(gdbm.close)
+ end
+ def test_s_open_create_new
+ return if /^CYGWIN_9/ =~ SYSTEM
+
+ save_mask = File.umask(0)
+ begin
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm"))
+ gdbm.close
+ assert_equals(File.stat("tmptest_gdbm").mode & 0777, 0666)
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm2", 0644))
+ gdbm.close
+ assert_equals(File.stat("tmptest_gdbm2").mode & 0777, 0644)
+ ensure
+ File.umask save_mask
+ end
+ end
+ def test_s_open_no_create
+ # this test is failed on libgdbm 1.8.0
+ assert_nil(gdbm = GDBM.open("tmptest_gdbm", nil))
+ ensure
+ gdbm.close if gdbm
+ end
+ def test_s_open_3rd_arg
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm", 0644,
+ GDBM::FAST))
+ gdbm.close
+
+ # gdbm 1.8.0 specific
+ if defined? GDBM::SYNC
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm", 0644,
+ GDBM::SYNC))
+ gdbm.close
+ end
+ # gdbm 1.8.0 specific
+ if defined? GDBM::NOLOCK
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm", 0644,
+ GDBM::NOLOCK))
+ gdbm.close
+ end
+ end
+ def test_s_open_with_block
+ assert_equals(GDBM.open("tmptest_gdbm") { :foo }, :foo)
+ end
+ def test_s_open_lock
+ fork() {
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm", 0644))
+ sleep 2
+ }
+ begin
+ sleep 1
+ assert_exception(Errno::EWOULDBLOCK) {
+ begin
+ assert_instance_of(GDBM, gdbm2 = GDBM.open("tmptest_gdbm", 0644))
+ rescue Errno::EAGAIN, Errno::EACCES
+ raise Errno::EWOULDBLOCK
+ end
+ }
+ ensure
+ Process.wait
+ end
+ end
+
+=begin
+ # Is it guaranteed on many OS?
+ def test_s_open_lock_one_process
+ # locking on one process
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm", 0644))
+ assert_exception(Errno::EWOULDBLOCK) {
+ begin
+ GDBM.open("tmptest_gdbm", 0644)
+ rescue Errno::EAGAIN
+ raise Errno::EWOULDBLOCK
+ end
+ }
+ end
+=end
+
+ def test_s_open_nolock
+ # gdbm 1.8.0 specific
+ if not defined? GDBM::NOLOCK
+ return
+ end
+
+ fork() {
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm", 0644,
+ GDBM::NOLOCK))
+ sleep 2
+ }
+ sleep 1
+ begin
+ gdbm2 = nil
+ assert_no_exception(Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EACCES) {
+ assert_instance_of(GDBM, gdbm2 = GDBM.open("tmptest_gdbm", 0644))
+ }
+ ensure
+ Process.wait
+ gdbm2.close if gdbm2
+ end
+
+ p Dir.glob("tmptest_gdbm*") if $DEBUG
+
+ fork() {
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm", 0644))
+ sleep 2
+ }
+ begin
+ sleep 1
+ gdbm2 = nil
+ assert_no_exception(Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EACCES) {
+ # this test is failed on Cygwin98 (???)
+ assert_instance_of(GDBM, gdbm2 = GDBM.open("tmptest_gdbm", 0644,
+ GDBM::NOLOCK))
+ }
+ ensure
+ Process.wait
+ gdbm2.close if gdbm2
+ end
+ end
+
+ def test_s_open_error
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm", 0))
+ assert_exception(Errno::EACCES) {
+ GDBM.open("tmptest_gdbm", 0)
+ }
+ gdbm.close
+ end
+
+ def test_close
+ assert_instance_of(GDBM, gdbm = GDBM.open("tmptest_gdbm"))
+ assert_nil(gdbm.close)
+
+ # closed GDBM file
+ assert_exception(RuntimeError) { gdbm.close }
+ end
+
+ def test_aref
+ assert_equals('bar', @gdbm['foo'] = 'bar')
+ assert_equals('bar', @gdbm['foo'])
+
+ assert_nil(@gdbm['bar'])
+ end
+
+ def test_fetch
+ assert_equals('bar', @gdbm['foo']='bar')
+ assert_equals('bar', @gdbm.fetch('foo'))
+
+ # key not found
+ assert_exception(IndexError) {
+ @gdbm.fetch('bar')
+ }
+
+ # test for `ifnone' arg
+ assert_equals('baz', @gdbm.fetch('bar', 'baz'))
+
+ # test for `ifnone' block
+ assert_equals('foobar', @gdbm.fetch('bar') {|key| 'foo' + key })
+ end
+
+ def test_aset
+ num = 0
+ 2.times {|i|
+ assert_equals('foo', @gdbm['foo'] = 'foo')
+ assert_equals('foo', @gdbm['foo'])
+ assert_equals('bar', @gdbm['foo'] = 'bar')
+ assert_equals('bar', @gdbm['foo'])
+
+ num += 1 if i == 0
+ assert_equals(num, @gdbm.size)
+
+ # assign nil
+ assert_equals('', @gdbm['bar'] = '')
+ assert_equals('', @gdbm['bar'])
+
+ num += 1 if i == 0
+ assert_equals(num, @gdbm.size)
+
+ # empty string
+ assert_equals('', @gdbm[''] = '')
+ assert_equals('', @gdbm[''])
+
+ num += 1 if i == 0
+ assert_equals(num, @gdbm.size)
+
+ # Fixnum
+ assert_equals('200', @gdbm['100'] = '200')
+ assert_equals('200', @gdbm['100'])
+
+ num += 1 if i == 0
+ assert_equals(num, @gdbm.size)
+
+ # Big key and value
+ assert_equals('y' * 100, @gdbm['x' * 100] = 'y' * 100)
+ assert_equals('y' * 100, @gdbm['x' * 100])
+
+ num += 1 if i == 0
+ assert_equals(num, @gdbm.size)
+ }
+ end
+
+ def test_index
+ assert_equals('bar', @gdbm['foo'] = 'bar')
+ assert_equals('foo', @gdbm.index('bar'))
+ assert_nil(@gdbm['bar'])
+ end
+
+ def test_indexes
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+ @gdbm[keys[0]], @gdbm[keys[1]], @gdbm[keys[2]] = values
+ assert_equals(values.reverse, @gdbm.indexes(*keys.reverse))
+ end
+
+ def test_values_at
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+ @gdbm[keys[0]], @gdbm[keys[1]], @gdbm[keys[2]] = values
+ assert_equals(values.reverse, @gdbm.values_at(*keys.reverse))
+ end
+
+ def test_select_with_block
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+ @gdbm[keys[0]], @gdbm[keys[1]], @gdbm[keys[2]] = values
+ ret = @gdbm.select {|k,v|
+ assert_equals(k.upcase, v)
+ k != "bar"
+ }
+ assert_equals([['baz', 'BAZ'], ['foo', 'FOO']],
+ ret.sort)
+ end
+
+ def test_length
+ num = 10
+ assert_equals(0, @gdbm.size)
+ num.times {|i|
+ i = i.to_s
+ @gdbm[i] = i
+ }
+ assert_equals(num, @gdbm.size)
+
+ @gdbm.shift
+
+ assert_equals(num - 1, @gdbm.size)
+ end
+
+ def test_empty?
+ assert_equals(true, @gdbm.empty?)
+ @gdbm['foo'] = 'FOO'
+ assert_equals(false, @gdbm.empty?)
+ end
+
+ def test_each_pair
+ n = 0
+ @gdbm.each_pair { n += 1 }
+ assert_equals(0, n)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @gdbm[keys[0]], @gdbm[keys[1]], @gdbm[keys[2]] = values
+
+ n = 0
+ ret = @gdbm.each_pair {|key, val|
+ assert_not_nil(i = keys.index(key))
+ assert_equals(val, values[i])
+
+ n += 1
+ }
+ assert_equals(keys.size, n)
+ assert_equals(@gdbm, ret)
+ end
+
+ def test_each_value
+ n = 0
+ @gdbm.each_value { n += 1 }
+ assert_equals(0, n)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @gdbm[keys[0]], @gdbm[keys[1]], @gdbm[keys[2]] = values
+
+ n = 0
+ ret = @gdbm.each_value {|val|
+ assert_not_nil(key = @gdbm.index(val))
+ assert_not_nil(i = keys.index(key))
+ assert_equals(val, values[i])
+
+ n += 1
+ }
+ assert_equals(keys.size, n)
+ assert_equals(@gdbm, ret)
+ end
+
+ def test_each_key
+ n = 0
+ @gdbm.each_key { n += 1 }
+ assert_equals(0, n)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @gdbm[keys[0]], @gdbm[keys[1]], @gdbm[keys[2]] = values
+
+ n = 0
+ ret = @gdbm.each_key {|key|
+ assert_not_nil(i = keys.index(key))
+ assert_equals(@gdbm[key], values[i])
+
+ n += 1
+ }
+ assert_equals(keys.size, n)
+ assert_equals(@gdbm, ret)
+ end
+
+ def test_keys
+ assert_equals([], @gdbm.keys)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @gdbm[keys[0]], @gdbm[keys[1]], @gdbm[keys[2]] = values
+
+ assert_equals(keys.sort, @gdbm.keys.sort)
+ assert_equals(values.sort, @gdbm.values.sort)
+ end
+
+ def test_values
+ test_keys
+ end
+
+ def test_shift
+ assert_nil(@gdbm.shift)
+ assert_equals(0, @gdbm.size)
+
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+
+ @gdbm[keys[0]], @gdbm[keys[1]], @gdbm[keys[2]] = values
+
+ ret_keys = []
+ ret_values = []
+ while ret = @gdbm.shift
+ ret_keys.push ret[0]
+ ret_values.push ret[1]
+
+ assert_equals(keys.size - ret_keys.size, @gdbm.size)
+ end
+
+ assert_equals(keys.sort, ret_keys.sort)
+ assert_equals(values.sort, ret_values.sort)
+ end
+
+ def test_delete
+ keys = %w(foo bar baz)
+ values = %w(FOO BAR BAZ)
+ key = keys[1]
+
+ assert_nil(@gdbm.delete(key))
+ assert_equals(0, @gdbm.size)
+
+ @gdbm[keys[0]], @gdbm[keys[1]], @gdbm[keys[2]] = values
+
+ assert_equals('BAR', @gdbm.delete(key))
+ assert_nil(@gdbm[key])
+ assert_equals(2, @gdbm.size)
+
+ assert_nil(@gdbm.delete(key))
+
+ if /^CYGWIN_9/ !~ SYSTEM
+ assert_exception(GDBMError) {
+ @gdbm_rdonly.delete("foo")
+ }
+
+ assert_nil(@gdbm_rdonly.delete("bar"))
+ end
+ end
+ def test_delete_with_block
+ key = 'no called block'
+ @gdbm[key] = 'foo'
+ assert_equals('foo', @gdbm.delete(key) {|k| k.replace 'called block'})
+ assert_equals('no called block', key)
+ assert_equals(0, @gdbm.size)
+
+ key = 'no called block'
+ assert_equals(:blockval,
+ @gdbm.delete(key) {|k| k.replace 'called block'; :blockval})
+ assert_equals('called block', key)
+ assert_equals(0, @gdbm.size)
+ end
+
+ def test_delete_if
+ v = "0"
+ 100.times {@gdbm[v] = v; v = v.next}
+
+ ret = @gdbm.delete_if {|key, val| key.to_i < 50}
+ assert_equals(@gdbm, ret)
+ check_size(50, @gdbm)
+
+ ret = @gdbm.delete_if {|key, val| key.to_i >= 50}
+ assert_equals(@gdbm, ret)
+ check_size(0, @gdbm)
+
+ # break
+ v = "0"
+ 100.times {@gdbm[v] = v; v = v.next}
+ check_size(100, @gdbm)
+ n = 0;
+ @gdbm.delete_if {|key, val|
+ break if n > 50
+ n+=1
+ true
+ }
+ assert_equals(51, n)
+ check_size(49, @gdbm)
+
+ @gdbm.clear
+
+ # raise
+ v = "0"
+ 100.times {@gdbm[v] = v; v = v.next}
+ check_size(100, @gdbm)
+ n = 0;
+ begin
+ @gdbm.delete_if {|key, val|
+ raise "runtime error" if n > 50
+ n+=1
+ true
+ }
+ rescue
+ end
+ assert_equals(51, n)
+ check_size(49, @gdbm)
+ end
+
+ def test_reject
+ v = "0"
+ 100.times {@gdbm[v] = v; v = v.next}
+
+ hash = @gdbm.reject {|key, val| key.to_i < 50}
+ assert_instance_of(Hash, hash)
+ assert_equals(100, @gdbm.size)
+
+ assert_equals(50, hash.size)
+ hash.each_pair {|key,val|
+ assert_equals(false, key.to_i < 50)
+ assert_equals(key, val)
+ }
+
+ hash = @gdbm.reject {|key, val| key.to_i < 100}
+ assert_instance_of(Hash, hash)
+ assert_equals(true, hash.empty?)
+ end
+
+ def test_clear
+ v = "1"
+ 100.times {v = v.next; @gdbm[v] = v}
+
+ assert_equals(@gdbm, @gdbm.clear)
+
+ # validate GDBM#size
+ i = 0
+ @gdbm.each { i += 1 }
+ assert_equals(@gdbm.size, i)
+ assert_equals(0, i)
+ end
+
+ def test_invert
+ v = "0"
+ 100.times {@gdbm[v] = v; v = v.next}
+
+ hash = @gdbm.invert
+ assert_instance_of(Hash, hash)
+ assert_equals(100, hash.size)
+ hash.each_pair {|key, val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+
+ def test_update
+ hash = {}
+ v = "0"
+ 100.times {v = v.next; hash[v] = v}
+
+ @gdbm["101"] = "101"
+ @gdbm.update hash
+ assert_equals(101, @gdbm.size)
+ @gdbm.each_pair {|key, val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+
+ def test_replace
+ hash = {}
+ v = "0"
+ 100.times {v = v.next; hash[v] = v}
+
+ @gdbm["101"] = "101"
+ @gdbm.replace hash
+ assert_equals(100, @gdbm.size)
+ @gdbm.each_pair {|key, val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+
+ def test_reorganize
+ size1 = File.size(@path)
+ i = "1"
+ 1000.times {i = i.next; @gdbm[i] = i}
+ @gdbm.clear
+ @gdbm.sync
+
+ size2 = File.size(@path)
+ @gdbm.reorganize
+ size3 = File.size(@path)
+
+ # p [size1, size2, size3]
+ assert_equals(true, size1 < size2)
+ # this test is failed on Cygwin98. `GDBM version 1.8.0, as of May 19, 1999'
+ assert_equals(true, size3 < size2)
+ assert_equals(size1, size3)
+ end
+
+ def test_sync
+ assert_instance_of(GDBM, gdbm = GDBM.open('tmptest_gdbm', 0666, GDBM::FAST))
+ assert_equals(gdbm.sync, gdbm)
+ gdbm.close
+ assert_instance_of(GDBM, gdbm = GDBM.open('tmptest_gdbm', 0666))
+ assert_equals(gdbm.sync, gdbm)
+ gdbm.close
+ end
+
+ def test_cachesize=
+ assert_equals(@gdbm.cachesize = 1024, 1024)
+ end
+
+ def test_fastmode=
+ assert_equals(@gdbm.fastmode = true, true)
+ end
+
+ def test_syncmode=
+ assert_equals(@gdbm.syncmode = true, true)
+ end
+
+ def test_haskey?
+ assert_equals('bar', @gdbm['foo']='bar')
+ assert_equals(true, @gdbm.has_key?('foo'))
+ assert_equals(false, @gdbm.has_key?('bar'))
+ end
+
+ def test_has_value?
+ assert_equals('bar', @gdbm['foo']='bar')
+ assert_equals(true, @gdbm.has_value?('bar'))
+ assert_equals(false, @gdbm.has_value?('foo'))
+ end
+
+ def test_to_a
+ v = "0"
+ 100.times {v = v.next; @gdbm[v] = v}
+
+ ary = @gdbm.to_a
+ assert_instance_of(Array, ary)
+ assert_equals(100, ary.size)
+ ary.each {|key,val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+
+ def test_to_hash
+ v = "0"
+ 100.times {v = v.next; @gdbm[v] = v}
+
+ hash = @gdbm.to_hash
+ assert_instance_of(Hash, hash)
+ assert_equals(100, hash.size)
+ hash.each {|key,val|
+ assert_equals(key.to_i, val.to_i)
+ }
+ end
+end
+
+if $0 == __FILE__
+ if ARGV.size == 0
+ suite = RUNIT::TestSuite.new
+ suite.add_test(TestGDBM.suite)
+ else
+ suite = RUNIT::TestSuite.new
+ ARGV.each do |testmethod|
+ suite.add_test(TestGDBM.new(testmethod))
+ end
+ end
+
+ RUNIT::CUI::TestRunner.run(suite)
+end
diff --git a/ext/iconv/.cvsignore b/ext/iconv/.cvsignore
new file mode 100644
index 0000000000..394787fced
--- /dev/null
+++ b/ext/iconv/.cvsignore
@@ -0,0 +1,5 @@
+Makefile
+mkmf.log
+*.def
+iconv.rb
+config.charset
diff --git a/ext/iconv/charset_alias.rb b/ext/iconv/charset_alias.rb
new file mode 100644
index 0000000000..65fd41759b
--- /dev/null
+++ b/ext/iconv/charset_alias.rb
@@ -0,0 +1,52 @@
+#! /usr/bin/ruby
+# :stopdoc:
+require 'rbconfig'
+
+# http://www.ctan.org/tex-archive/macros/texinfo/texinfo/intl/config.charset
+# Fri, 30 May 2003 00:09:00 GMT'
+
+OS = Config::CONFIG["target"]
+SHELL = Config::CONFIG['SHELL']
+
+class Hash::Ordered < Hash
+ def [](key)
+ val = super and val.last
+ end
+ def []=(key, val)
+ ary = fetch(key) {return super(key, [self.size, key, val])} and
+ ary.last = val
+ end
+ def each
+ values.sort.each {|i, key, val| yield key, val}
+ end
+end
+
+def charset_alias(config_charset, mapfile, target = OS)
+ map = Hash::Ordered.new
+ comments = []
+ IO.foreach("|#{SHELL} #{config_charset} #{target}") do |list|
+ next comments << list if /^\#/ =~ list
+ next unless /^(\S+)\s+(\S+)$/ =~ list
+ sys, can = $1, $2
+ can.downcase!
+ map[can] = sys
+ end
+ case target
+ when /linux|-gnu/
+ map.delete('ascii')
+ when /cygwin/
+ # get rid of tilde/yen problem.
+ map['shift_jis'] = 'cp932'
+ end
+ open(mapfile, "w") do |f|
+ f.puts("require 'iconv.so'")
+ f.puts
+ f.puts(comments)
+ f.puts("class Iconv")
+ map.each {|can, sys| f.puts(" charset_map['#{can}'.freeze] = '#{sys}'.freeze")}
+ f.puts("end")
+ end
+end
+
+(2..3) === ARGV.size or abort "usage: #$0 config.status map.rb [target]"
+charset_alias(*ARGV)
diff --git a/ext/iconv/depend b/ext/iconv/depend
new file mode 100644
index 0000000000..688ddd97b7
--- /dev/null
+++ b/ext/iconv/depend
@@ -0,0 +1,2 @@
+iconv.o: iconv.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h \
+ $(hdrdir)/intern.h
diff --git a/ext/iconv/extconf.rb b/ext/iconv/extconf.rb
new file mode 100644
index 0000000000..65ea327950
--- /dev/null
+++ b/ext/iconv/extconf.rb
@@ -0,0 +1,49 @@
+require 'mkmf'
+
+dir_config("iconv")
+
+conf = File.exist?(File.join($srcdir, "config.charset"))
+conf = with_config("config-charset", enable_config("config-charset", conf))
+
+if have_func("iconv", "iconv.h") or
+ have_library("iconv", "iconv") {|s| s.sub(/(?=\n\/\*top\*\/)/, "#include <iconv.h>")}
+ if checking_for("const of iconv() 2nd argument") do
+ create_tmpsrc(cpp_include("iconv.h") + "---> iconv(cd,0,0,0,0) <---")
+ src = xpopen(cpp_command("")) {|f|f.read}
+ if !(func = src[/^--->\s*(\w+).*\s*<---/, 1])
+ Logging::message "iconv function name not found"
+ false
+ elsif !(second = src[%r"\b#{func}\s*\(.*?,(.*?),.*?\)\s*;"m, 1])
+ Logging::message "prototype for #{func}() not found"
+ false
+ else
+ Logging::message $&+"\n"
+ /\bconst\b/ =~ second
+ end
+ end
+ $defs.push('-DICONV_INPTR_CAST=""')
+ else
+ $defs.push('-DICONV_INPTR_CAST="(char **)"')
+ end
+ if conf
+ prefix = '$(srcdir)'
+ prefix = $nmake ? "{#{prefix}}" : "#{prefix}/"
+ wrapper = "./iconv.rb"
+ $INSTALLFILES = [[wrapper, "$(RUBYARCHDIR)"]]
+ if String === conf
+ require 'uri'
+ scheme = URI.parse(conf).scheme
+ else
+ conf = prefix + "config.charset"
+ end
+ $cleanfiles << wrapper
+ end
+ create_makefile("iconv")
+ if conf
+ open("Makefile", "a") do |mf|
+ mf.print("\nall: #{wrapper}\n\n#{wrapper}: #{prefix}charset_alias.rb")
+ mf.print(" ", conf) unless scheme
+ mf.print("\n\t$(RUBY) ", prefix, "charset_alias.rb ", conf, " $@\n")
+ end
+ end
+end
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
new file mode 100644
index 0000000000..29ab2c7d7b
--- /dev/null
+++ b/ext/iconv/iconv.c
@@ -0,0 +1,885 @@
+/* -*- mode:c; c-file-style:"ruby" -*- */
+/**********************************************************************
+
+ iconv.c -
+
+ $Author$
+ $Date$
+ created at: Wed Dec 1 20:28:09 JST 1999
+
+ All the files in this distribution are covered under the Ruby's
+ license (see the file COPYING).
+
+ Documentation by Yukihiro Matsumoto and Gavin Sinclair.
+
+**********************************************************************/
+
+#include "ruby.h"
+#include <errno.h>
+#include <iconv.h>
+#include <assert.h>
+#include "st.h"
+#include "intern.h"
+
+/*
+ * Document-class: Iconv
+ *
+ * == Summary
+ *
+ * Ruby extension for charset conversion.
+ *
+ * == Abstract
+ *
+ * Iconv is a wrapper class for the UNIX 95 <tt>iconv()</tt> function family,
+ * which translates string between various encoding systems.
+ *
+ * See Open Group's on-line documents for more details.
+ * * <tt>iconv.h</tt>: http://www.opengroup.org/onlinepubs/007908799/xsh/iconv.h.html
+ * * <tt>iconv_open()</tt>: http://www.opengroup.org/onlinepubs/007908799/xsh/iconv_open.html
+ * * <tt>iconv()</tt>: http://www.opengroup.org/onlinepubs/007908799/xsh/iconv.html
+ * * <tt>iconv_close()</tt>: http://www.opengroup.org/onlinepubs/007908799/xsh/iconv_close.html
+ *
+ * Which coding systems are available is platform-dependent.
+ *
+ * == Examples
+ *
+ * 1. Instantiate a new Iconv and use method Iconv#iconv.
+ *
+ * cd = Iconv.new(to, from)
+ * begin
+ * input.each { |s| output << cd.iconv(s) }
+ * output << cd.iconv(nil) # Don't forget this!
+ * ensure
+ * cd.close
+ * end
+ *
+ * 2. 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).
+ *
+ * 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
+ big enough to keep iconv_t */
+#define VALUE2ICONV(v) ((iconv_t)((VALUE)(v) ^ -1))
+#define ICONV2VALUE(c) ((VALUE)(c) ^ -1)
+
+struct iconv_env_t
+{
+ iconv_t cd;
+ int argc;
+ VALUE *argv;
+ VALUE ret;
+ VALUE (*append)_((VALUE, VALUE));
+};
+
+static VALUE rb_eIconvFailure;
+static VALUE rb_eIconvIllegalSeq;
+static VALUE rb_eIconvInvalidChar;
+static VALUE rb_eIconvOutOfRange;
+
+static ID rb_success, rb_failed;
+static VALUE iconv_fail _((VALUE error, VALUE success, VALUE failed, struct iconv_env_t* env, const char *mesg));
+static VALUE iconv_failure_initialize _((VALUE error, VALUE mesg, VALUE success, VALUE failed));
+static VALUE iconv_failure_success _((VALUE self));
+static VALUE iconv_failure_failed _((VALUE self));
+
+static iconv_t iconv_create _((VALUE to, VALUE from));
+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_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));
+static VALUE iconv_s_convert _((struct iconv_env_t* env));
+static VALUE iconv_s_iconv _((int argc, VALUE *argv, VALUE self));
+static VALUE iconv_init_state _((VALUE cd));
+static VALUE iconv_finish _((VALUE self));
+static VALUE iconv_iconv _((int argc, VALUE *argv, VALUE self));
+
+static VALUE charset_map;
+
+static VALUE charset_map_get _((void))
+{
+ return charset_map;
+}
+
+static char *
+map_charset
+#ifdef HAVE_PROTOTYPES
+ (VALUE *code)
+#else /* HAVE_PROTOTYPES */
+ (code)
+ VALUE *code;
+#endif /* HAVE_PROTOTYPES */
+{
+ VALUE val = *code;
+
+ if (RHASH(charset_map)->tbl && RHASH(charset_map)->tbl->num_entries) {
+ VALUE key = rb_funcall2(val, rb_intern("downcase"), 0, 0);
+ StringValuePtr(key);
+ if (st_lookup(RHASH(charset_map)->tbl, key, &val)) {
+ *code = val;
+ }
+ }
+ return StringValuePtr(*code);
+}
+
+static iconv_t
+iconv_create
+#ifdef HAVE_PROTOTYPES
+ (VALUE to, VALUE from)
+#else /* HAVE_PROTOTYPES */
+ (to, from)
+ VALUE to;
+ VALUE from;
+#endif /* HAVE_PROTOTYPES */
+{
+ const char* tocode = map_charset(&to);
+ const char* fromcode = map_charset(&from);
+
+ iconv_t cd = iconv_open(tocode, fromcode);
+
+ if (cd == (iconv_t)-1) {
+ switch (errno) {
+ case EMFILE:
+ case ENFILE:
+ case ENOMEM:
+ rb_gc();
+ cd = iconv_open(tocode, fromcode);
+ }
+ if (cd == (iconv_t)-1) {
+ volatile VALUE msg = rb_str_new2("iconv(\"");
+ rb_str_buf_cat2(rb_str_buf_append(msg, to), "\", \"");
+ rb_str_buf_cat2(rb_str_buf_append(msg, from), "\")");
+ rb_sys_fail(StringValuePtr(msg));
+ }
+ }
+
+ return cd;
+}
+
+static void
+iconv_dfree
+#ifdef HAVE_PROTOTYPES
+ (void *cd)
+#else /* HAVE_PROTOTYPES */
+ (cd)
+ void *cd;
+#endif /* HAVE_PROTOTYPES */
+{
+ iconv_close(VALUE2ICONV(cd));
+}
+
+#define ICONV_FREE iconv_dfree
+
+static VALUE
+iconv_free
+#ifdef HAVE_PROTOTYPES
+ (VALUE cd)
+#else /* HAVE_PROTOTYPES */
+ (cd)
+ VALUE cd;
+#endif /* HAVE_PROTOTYPES */
+{
+ if (cd && iconv_close(VALUE2ICONV(cd)) == -1)
+ rb_sys_fail("iconv_close");
+ return Qnil;
+}
+
+static VALUE
+check_iconv
+#ifdef HAVE_PROTOTYPES
+ (VALUE obj)
+#else /* HAVE_PROTOTYPES */
+ (obj)
+ VALUE obj;
+#endif /* HAVE_PROTOTYPES */
+{
+ Check_Type(obj, T_DATA);
+ if (RDATA(obj)->dfree != ICONV_FREE) {
+ rb_raise(rb_eArgError, "Iconv expected (%s)", rb_class2name(CLASS_OF(obj)));
+ }
+ return (VALUE)DATA_PTR(obj);
+}
+
+static VALUE
+iconv_try
+#ifdef HAVE_PROTOTYPES
+ (iconv_t cd, const char **inptr, size_t *inlen, char **outptr, size_t *outlen)
+#else /* HAVE_PROTOTYPES */
+ (cd, inptr, inlen, outptr, outlen)
+ iconv_t cd;
+ const char **inptr;
+ size_t *inlen;
+ char **outptr;
+ size_t *outlen;
+#endif /* HAVE_PROTOTYPES */
+{
+ size_t ret = iconv(cd, ICONV_INPTR_CAST inptr, inlen, outptr, outlen);
+ if (ret == (size_t)-1) {
+ if (!*inlen)
+ return Qfalse;
+ switch (errno) {
+ case E2BIG:
+ /* try the left in next loop */
+ break;
+ case EILSEQ:
+ return rb_eIconvIllegalSeq;
+ case EINVAL:
+ return rb_eIconvInvalidChar;
+ default:
+ rb_sys_fail("iconv");
+ }
+ }
+ else if (*inlen > 0) {
+ /* something goes wrong */
+ return rb_eIconvIllegalSeq;
+ }
+ else if (ret) {
+ return Qnil; /* conversion */
+ }
+ return Qfalse;
+}
+
+#define FAILED_MAXLEN 16
+
+static VALUE iconv_failure_initialize
+#ifdef HAVE_PROTOTYPES
+ (VALUE error, VALUE mesg, VALUE success, VALUE failed)
+#else /* HAVE_PROTOTYPES */
+ (error, mesg, success, failed)
+ VALUE error, mesg, success, failed;
+#endif /* HAVE_PROTOTYPES */
+{
+ rb_call_super(1, &mesg);
+ rb_ivar_set(error, rb_success, success);
+ rb_ivar_set(error, rb_failed, failed);
+ return error;
+}
+
+static VALUE
+iconv_fail
+#ifdef HAVE_PROTOTYPES
+ (VALUE error, VALUE success, VALUE failed, struct iconv_env_t* env, const char *mesg)
+#else /* HAVE_PROTOTYPES */
+ (error, success, failed, env, mesg)
+ VALUE error, success, failed;
+ struct iconv_env_t *env;
+ const char *mesg;
+#endif /* HAVE_PROTOTYPES */
+{
+ VALUE args[3];
+
+ if (mesg && *mesg) {
+ args[0] = rb_str_new2(mesg);
+ }
+ else if (TYPE(failed) != T_STRING || RSTRING(failed)->len < FAILED_MAXLEN) {
+ args[0] = rb_inspect(failed);
+ }
+ else {
+ args[0] = rb_inspect(rb_str_substr(failed, 0, FAILED_MAXLEN));
+ rb_str_cat2(args[0], "...");
+ }
+ args[1] = success;
+ args[2] = failed;
+ if (env) {
+ args[1] = env->append(rb_obj_dup(env->ret), success);
+ if (env->argc > 0) {
+ *(env->argv) = failed;
+ args[2] = rb_ary_new4(env->argc, env->argv);
+ }
+ }
+ error = rb_class_new_instance(3, args, error);
+ if (!rb_block_given_p()) rb_exc_raise(error);
+ ruby_errinfo = error;
+ return rb_yield(failed);
+}
+
+static VALUE
+rb_str_derive
+#ifdef HAVE_PROTOTYPES
+ (VALUE str, const char* ptr, int len)
+#else /* HAVE_PROTOTYPES */
+ (str, ptr, len)
+ VALUE str;
+ const char *ptr;
+ int len;
+#endif /* HAVE_PROTOTYPES */
+{
+ VALUE ret;
+
+ if (NIL_P(str))
+ return rb_str_new(ptr, len);
+ if (RSTRING(str)->ptr == ptr && RSTRING(str)->len == len)
+ return str;
+ if (RSTRING(str)->ptr + RSTRING(str)->len == ptr + len)
+ ret = rb_str_substr(str, ptr - RSTRING(str)->ptr, len);
+ else
+ ret = rb_str_new(ptr, len);
+ OBJ_INFECT(ret, str);
+ return ret;
+}
+
+static VALUE
+iconv_convert
+#ifdef HAVE_PROTOTYPES
+ (iconv_t cd, VALUE str, int start, int length, struct iconv_env_t* env)
+#else /* HAVE_PROTOTYPES */
+ (cd, str, start, length, env)
+ iconv_t cd;
+ VALUE str;
+ int start;
+ int length;
+ struct iconv_env_t *env;
+#endif /* HAVE_PROTOTYPES */
+{
+ VALUE ret = Qfalse;
+ VALUE error = Qfalse;
+ VALUE rescue;
+ const char *inptr, *instart;
+ size_t inlen;
+ /* I believe ONE CHARACTER never exceed this. */
+ char buffer[BUFSIZ];
+ char *outptr;
+ size_t outlen;
+
+ if (cd == (iconv_t)-1)
+ rb_raise(rb_eArgError, "closed iconv");
+
+ if (NIL_P(str)) {
+ /* Reset output pointer or something. */
+ inptr = "";
+ inlen = 0;
+ outptr = buffer;
+ outlen = sizeof(buffer);
+ error = iconv_try(cd, &inptr, &inlen, &outptr, &outlen);
+ if (RTEST(error)) {
+ unsigned int i;
+ rescue = iconv_fail(error, Qnil, Qnil, env, 0);
+ if (TYPE(rescue) == T_ARRAY) {
+ str = RARRAY(rescue)->len > 0 ? RARRAY(rescue)->ptr[0] : Qnil;
+ }
+ if (FIXNUM_P(str) && (i = FIX2INT(str)) <= 0xff) {
+ char c = i;
+ str = rb_str_new(&c, 1);
+ }
+ else if (!NIL_P(str)) {
+ StringValue(str);
+ }
+ }
+
+ inptr = NULL;
+ length = 0;
+ }
+ else {
+ int slen;
+
+ StringValue(str);
+ 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;
+ }
+ instart = inptr;
+ inlen = length;
+
+ do {
+ char errmsg[50];
+ const char *tmpstart = inptr;
+ outptr = buffer;
+ outlen = sizeof(buffer);
+
+ errmsg[0] = 0;
+ error = iconv_try(cd, &inptr, &inlen, &outptr, &outlen);
+
+ if (0 <= outlen && outlen <= sizeof(buffer)) {
+ outlen = sizeof(buffer) - outlen;
+ if (NIL_P(error) || /* something converted */
+ outlen > inptr - tmpstart || /* input can't contain output */
+ (outlen < inptr - tmpstart && inlen > 0) || /* something skipped */
+ memcmp(buffer, tmpstart, outlen)) /* something differs */
+ {
+ if (NIL_P(str)) {
+ ret = rb_str_new(buffer, outlen);
+ }
+ else {
+ if (ret) {
+ ret = rb_str_buf_cat(ret, instart, tmpstart - instart);
+ }
+ else {
+ ret = rb_str_new(instart, tmpstart - instart);
+ OBJ_INFECT(ret, str);
+ }
+ ret = rb_str_buf_cat(ret, buffer, outlen);
+ instart = inptr;
+ }
+ }
+ else if (!inlen) {
+ inptr = tmpstart + outlen;
+ }
+ }
+ else {
+ /* Some iconv() have a bug, return *outlen out of range */
+ sprintf(errmsg, "bug?(output length = %ld)", (long)(sizeof(buffer) - outlen));
+ error = rb_eIconvOutOfRange;
+ }
+
+ if (RTEST(error)) {
+ long len = 0;
+
+ if (!ret)
+ ret = rb_str_derive(str, instart, inptr - instart);
+ else if (inptr > instart)
+ rb_str_cat(ret, instart, inptr - instart);
+ str = rb_str_derive(str, inptr, inlen);
+ rescue = iconv_fail(error, ret, str, env, errmsg);
+ if (TYPE(rescue) == T_ARRAY) {
+ if ((len = RARRAY(rescue)->len) > 0)
+ rb_str_concat(ret, RARRAY(rescue)->ptr[0]);
+ if (len > 1 && !NIL_P(str = RARRAY(rescue)->ptr[1])) {
+ StringValue(str);
+ inlen = length = RSTRING(str)->len;
+ instart = inptr = RSTRING(str)->ptr;
+ continue;
+ }
+ }
+ else if (!NIL_P(rescue)) {
+ rb_str_concat(ret, rescue);
+ }
+ break;
+ }
+ } while (inlen > 0);
+
+ if (!ret)
+ ret = rb_str_derive(str, instart, inptr - instart);
+ else if (inptr > instart)
+ rb_str_cat(ret, instart, inptr - instart);
+ return ret;
+}
+
+static VALUE
+iconv_s_allocate
+#ifdef HAVE_PROTOTYPES
+ (VALUE klass)
+#else /* HAVE_PROTOTYPES */
+ (klass)
+ VALUE klass;
+#endif /* HAVE_PROTOTYPES */
+{
+ return Data_Wrap_Struct(klass, 0, ICONV_FREE, 0);
+}
+
+/*
+ * Document-method: new
+ * call-seq: Iconv.new(to, from)
+ *
+ * Creates new code converter from a coding-system designated with +from+
+ * to another one designated with +to+.
+ *
+ * === Parameters
+ *
+ * +to+:: encoding name for destination
+ * +from+:: encoding name for source
+ *
+ * === Exceptions
+ *
+ * TypeError:: if +to+ or +from+ aren't String
+ * ArgumentError:: if designated converter couldn't find out
+ * SystemCallError:: if <tt>iconv_open3</tt> fails
+ */
+static VALUE
+iconv_initialize
+#ifdef HAVE_PROTOTYPES
+ (VALUE self, VALUE to, VALUE from)
+#else /* HAVE_PROTOTYPES */
+ (self, to, from)
+ VALUE self;
+ VALUE to;
+ VALUE from;
+#endif /* HAVE_PROTOTYPES */
+{
+ iconv_free(check_iconv(self));
+ DATA_PTR(self) = NULL;
+ DATA_PTR(self) = (void *)ICONV2VALUE(iconv_create(to, from));
+ return self;
+}
+
+/*
+ * Document-method: open
+ * call-seq: Iconv.open(to, from) { |iconv| ... }
+ *
+ * Equivalent to Iconv.new except that when it is called with a block, it
+ * yields with the new instance and closes it, and returns the result which
+ * returned from the block.
+ */
+static VALUE
+iconv_s_open
+#ifdef HAVE_PROTOTYPES
+ (VALUE self, VALUE to, VALUE from)
+#else /* HAVE_PROTOTYPES */
+ (self, to, from)
+ VALUE self;
+ VALUE to;
+ VALUE from;
+#endif /* HAVE_PROTOTYPES */
+{
+ VALUE cd = ICONV2VALUE(iconv_create(to, from));
+
+ self = Data_Wrap_Struct(self, NULL, ICONV_FREE, (void *)cd);
+ if (rb_block_given_p()) {
+ return rb_ensure(rb_yield, self, (VALUE(*)())iconv_finish, self);
+ }
+ else {
+ return self;
+ }
+}
+
+static VALUE
+iconv_s_convert
+#ifdef HAVE_PROTOTYPES
+ (struct iconv_env_t* env)
+#else /* HAVE_PROTOTYPES */
+ (env)
+ struct iconv_env_t *env;
+#endif /* HAVE_PROTOTYPES */
+{
+ VALUE last = 0;
+
+ for (; env->argc > 0; --env->argc, ++env->argv) {
+ VALUE s = iconv_convert(env->cd, last = *(env->argv), 0, -1, env);
+ env->append(env->ret, s);
+ }
+
+ if (!NIL_P(last)) {
+ VALUE s = iconv_convert(env->cd, Qnil, 0, 0, env);
+ if (RSTRING(s)->len)
+ env->append(env->ret, s);
+ }
+
+ return env->ret;
+}
+
+/*
+ * Document-method: iconv
+ * call-seq: Iconv.iconv(to, from, *strs)
+ *
+ * Shorthand for
+ * Iconv.open(to, from) { |cd|
+ * (strs + [nil]).collect { |s| cd.iconv(s) }
+ * }
+ *
+ * === Parameters
+ *
+ * <tt>to, from</tt>:: see Iconv.new
+ * <tt>strs</tt>:: strings to be converted
+ *
+ * === Exceptions
+ *
+ * Exceptions thrown by Iconv.new, Iconv.open and Iconv#iconv.
+*/
+static VALUE
+iconv_s_iconv
+#ifdef HAVE_PROTOTYPES
+ (int argc, VALUE *argv, VALUE self)
+#else /* HAVE_PROTOTYPES */
+ (argc, argv, self)
+ int argc;
+ VALUE *argv;
+ VALUE self;
+#endif /* HAVE_PROTOTYPES */
+{
+ struct iconv_env_t arg;
+
+ if (argc < 2) /* needs `to' and `from' arguments at least */
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", argc, 2);
+
+ arg.argc = argc -= 2;
+ arg.argv = argv + 2;
+ arg.append = rb_ary_push;
+ arg.ret = rb_ary_new2(argc);
+ arg.cd = iconv_create(argv[0], argv[1]);
+ return rb_ensure(iconv_s_convert, (VALUE)&arg, iconv_free, ICONV2VALUE(arg.cd));
+}
+
+/*
+ * Document-method: Iconv::conv
+ * call-seq: Iconv.iconv(to, from, *strs)
+ *
+ * See Iconv.iconv ???
+ */
+static VALUE
+iconv_s_conv
+#ifdef HAVE_PROTOTYPES
+ (VALUE self, VALUE to, VALUE from, VALUE str)
+#else /* HAVE_PROTOTYPES */
+ (self, to, from, str)
+ VALUE self, to, from, str;
+#endif /* HAVE_PROTOTYPES */
+{
+ struct iconv_env_t arg;
+
+ arg.argc = 1;
+ arg.argv = &str;
+ arg.append = rb_str_append;
+ arg.ret = rb_str_new(0, 0);
+ arg.cd = iconv_create(to, from);
+ return rb_ensure(iconv_s_convert, (VALUE)&arg, iconv_free, ICONV2VALUE(arg.cd));
+}
+
+/*
+ * Document-method: close
+ *
+ * Finishes conversion.
+ *
+ * After calling this, calling Iconv#iconv will cause an exception, but
+ * multiple calls of #close are guaranteed to end successfully.
+ *
+ * Returns a string containing the byte sequence to change the output buffer to
+ * its initial shift state. <i>???</i>
+*/
+static VALUE
+iconv_init_state
+#ifdef HAVE_PROTOTYPES
+ (VALUE cd)
+#else /* HAVE_PROTOTYPES */
+ (cd)
+ VALUE cd;
+#endif /* HAVE_PROTOTYPES */
+{
+ return iconv_convert(VALUE2ICONV(cd), Qnil, 0, 0, NULL);
+}
+
+static VALUE
+iconv_finish
+#ifdef HAVE_PROTOTYPES
+ (VALUE self)
+#else /* HAVE_PROTOTYPES */
+ (self)
+ VALUE self;
+#endif /* HAVE_PROTOTYPES */
+{
+ VALUE cd = check_iconv(self);
+
+ if (!cd) return Qnil;
+ DATA_PTR(self) = NULL;
+
+ return rb_ensure(iconv_init_state, cd, iconv_free, cd);
+}
+
+/*
+ * Document-method: iconv
+ * call-seq: iconv(str, start=0, length=-1)
+ *
+ * Converts string and returns the result.
+ * * If +str+ is a String, converts <tt>str[start, length]</tt> and returns the converted string.
+ * * If +str+ is +nil+, places converter itself into initial shift state and
+ * just returns a string containing the byte sequence to change the output
+ * buffer to its initial shift state.
+ * * Otherwise, raises an exception.
+ *
+ * === Parameters
+ *
+ * str:: string to be converted, or nil
+ * start:: starting offset
+ * length:: conversion length; nil or -1 means whole the string from start
+ *
+ * === Exceptions
+ *
+ * * IconvIllegalSequence
+ * * IconvInvalidCharacter
+ * * IconvOutOfRange
+ *
+ * === Examples
+ *
+ * See the Iconv documentation.
+*/
+static VALUE
+iconv_iconv
+#ifdef HAVE_PROTOTYPES
+ (int argc, VALUE *argv, VALUE self)
+#else /* HAVE_PROTOTYPES */
+ (argc, argv, self)
+ int argc;
+ VALUE *argv;
+ VALUE self;
+#endif /* HAVE_PROTOTYPES */
+{
+ VALUE str, n1, n2;
+ VALUE cd = check_iconv(self);
+
+ n1 = n2 = Qnil;
+ rb_scan_args(argc, argv, "12", &str, &n1, &n2);
+
+ return iconv_convert(VALUE2ICONV(cd), str,
+ NIL_P(n1) ? 0 : NUM2INT(n1),
+ NIL_P(n2) ? -1 : NUM2INT(n1),
+ NULL);
+}
+
+/*
+ * Document-class: Iconv::Failure
+ *
+ * Base attributes for Iconv exceptions.
+ *
+ * === Iconv::Failure#success
+ *
+ * Returns string(s) translated successfully until the exception occurred.
+ * * In the case of failure occurred within Iconv.iconv, returned
+ * value is an array of strings translated successfully preceding
+ * failure and the last element is string on the way.
+ *
+ * === Iconv::Failure#failed
+ *
+ * Returns substring of the original string passed to Iconv that starts at the
+ * character caused the exception.
+ *
+ * === Iconv::Failure#inspect
+ *
+ * Returns inspected string like as: #<_class_: _success_, _failed_>
+ */
+static VALUE
+iconv_failure_success
+#ifdef HAVE_PROTOTYPES
+(VALUE self)
+#else /* HAVE_PROTOTYPES */
+ (self)
+ VALUE self;
+#endif /* HAVE_PROTOTYPES */
+{
+ return rb_attr_get(self, rb_success);
+}
+
+/*
+ * Comment!
+ */
+static VALUE
+iconv_failure_failed
+#ifdef HAVE_PROTOTYPES
+(VALUE self)
+#else /* HAVE_PROTOTYPES */
+ (self)
+ VALUE self;
+#endif /* HAVE_PROTOTYPES */
+{
+ return rb_attr_get(self, rb_failed);
+}
+
+static VALUE
+iconv_failure_inspect
+#ifdef HAVE_PROTOTYPES
+ (VALUE self)
+#else /* HAVE_PROTOTYPES */
+ (self)
+ VALUE self;
+#endif /* HAVE_PROTOTYPES */
+{
+ 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);
+ str = rb_str_buf_cat(str, ": ", 2);
+ str = rb_str_buf_append(str, rb_inspect(success));
+ str = rb_str_buf_cat(str, ", ", 2);
+ str = rb_str_buf_append(str, rb_inspect(failed));
+ return rb_str_buf_cat(str, ">", 1);
+}
+
+/*
+ * Document-class: Iconv::IllegalSequence
+ *
+ * Input conversion stopped due to an input byte that does not belong to
+ * the input codeset, or the output codeset does not contain the
+ * character.
+ *
+ * === Superclass
+ *
+ * ArgumentError
+ *
+ * === Included Modules
+ *
+ * Iconv::Failure
+ */
+
+/*
+ * Document-class: Iconv::InvalidCharacter
+ *
+ * Input conversion stopped due to an incomplete character or shift
+ * sequence at the end of the input buffer.
+ *
+ * === Superclass
+ *
+ * ArgumentError
+ *
+ * === Included Modules
+ *
+ * Iconv::Failure
+ */
+
+/*
+ * Document-class: Iconv::OutOfRange
+ *
+ * Iconv library internal error. Must not occur.
+ *
+ * === Superclass
+ *
+ * RuntimeError
+ *
+ * === Included Modules
+ *
+ * Iconv::Failure
+ */
+
+void
+Init_iconv _((void))
+{
+ VALUE rb_cIconv = rb_define_class("Iconv", rb_cData);
+
+ rb_define_alloc_func(rb_cIconv, iconv_s_allocate);
+ rb_define_singleton_method(rb_cIconv, "open", iconv_s_open, 2);
+ rb_define_singleton_method(rb_cIconv, "iconv", iconv_s_iconv, -1);
+ rb_define_singleton_method(rb_cIconv, "conv", iconv_s_conv, 3);
+ rb_define_method(rb_cIconv, "initialize", iconv_initialize, 2);
+ rb_define_method(rb_cIconv, "close", iconv_finish, 0);
+ rb_define_method(rb_cIconv, "iconv", iconv_iconv, -1);
+
+ rb_eIconvFailure = rb_define_module_under(rb_cIconv, "Failure");
+ rb_define_method(rb_eIconvFailure, "initialize", iconv_failure_initialize, 3);
+ rb_define_method(rb_eIconvFailure, "success", iconv_failure_success, 0);
+ rb_define_method(rb_eIconvFailure, "failed", iconv_failure_failed, 0);
+ rb_define_method(rb_eIconvFailure, "inspect", iconv_failure_inspect, 0);
+
+ rb_eIconvIllegalSeq = rb_define_class_under(rb_cIconv, "IllegalSequence", rb_eArgError);
+ rb_eIconvInvalidChar = rb_define_class_under(rb_cIconv, "InvalidCharacter", rb_eArgError);
+ rb_eIconvOutOfRange = rb_define_class_under(rb_cIconv, "OutOfRange", rb_eRuntimeError);
+ rb_include_module(rb_eIconvIllegalSeq, rb_eIconvFailure);
+ rb_include_module(rb_eIconvInvalidChar, rb_eIconvFailure);
+ rb_include_module(rb_eIconvOutOfRange, rb_eIconvFailure);
+
+ rb_success = rb_intern("success");
+ rb_failed = rb_intern("failed");
+
+ charset_map = rb_hash_new();
+ rb_gc_register_address(&charset_map);
+ rb_define_singleton_method(rb_cIconv, "charset_map", charset_map_get, 0);
+}
+
diff --git a/ext/io/wait/.cvsignore b/ext/io/wait/.cvsignore
new file mode 100644
index 0000000000..fc802ff1c2
--- /dev/null
+++ b/ext/io/wait/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+mkmf.log
diff --git a/ext/io/wait/extconf.rb b/ext/io/wait/extconf.rb
new file mode 100644
index 0000000000..ea7dc9f6cf
--- /dev/null
+++ b/ext/io/wait/extconf.rb
@@ -0,0 +1,12 @@
+require 'mkmf'
+target = "io/wait"
+
+unless macro_defined?("DOSISH", "#include <ruby.h>")
+ fionread = %w[sys/ioctl.h sys/filio.h].find do |h|
+ checking_for("FIONREAD") {macro_defined?("FIONREAD", "#include <#{h}>\n")}
+ end
+ if fionread
+ $defs << "-DFIONREAD_HEADER=\"<#{fionread}>\""
+ create_makefile(target)
+ end
+end
diff --git a/ext/io/wait/lib/nonblock.rb b/ext/io/wait/lib/nonblock.rb
new file mode 100644
index 0000000000..46511fb40c
--- /dev/null
+++ b/ext/io/wait/lib/nonblock.rb
@@ -0,0 +1,23 @@
+require "fcntl"
+class IO
+ def nonblock?
+ (fcntl(Fcntl::F_GETFL) & File::NONBLOCK) != 0
+ end
+
+ def nonblock=(nb)
+ f = fcntl(Fcntl::F_GETFL)
+ if nb
+ f |= File::NONBLOCK
+ else
+ f &= ~File::NONBLOCK
+ end
+ fcntl(Fcntl::F_SETFL, f)
+ end
+
+ def nonblock(nb = true)
+ nb, self.nonblock = nonblock?, nb
+ yield
+ ensure
+ self.nonblock = nb
+ end
+end
diff --git a/ext/io/wait/wait.c b/ext/io/wait/wait.c
new file mode 100644
index 0000000000..53d5bd7d18
--- /dev/null
+++ b/ext/io/wait/wait.c
@@ -0,0 +1,106 @@
+/**********************************************************************
+
+ io/wait.c -
+
+ $Author$
+ $Date$
+ created at: Tue Aug 28 09:08:06 JST 2001
+
+ All the files in this distribution are covered under the Ruby's
+ license (see the file COPYING).
+
+**********************************************************************/
+
+#include "ruby.h"
+#include "rubyio.h"
+
+#include <sys/types.h>
+#include FIONREAD_HEADER
+
+static VALUE io_ready_p _((VALUE io));
+static VALUE io_wait _((int argc, VALUE *argv, VALUE io));
+void Init_wait _((void));
+
+EXTERN struct timeval rb_time_interval _((VALUE time));
+
+/*
+=begin
+= IO wait methods.
+=end
+ */
+
+/*
+=begin
+--- IO#ready?
+ returns non-nil if input available without blocking, or nil.
+=end
+*/
+static VALUE
+io_ready_p(io)
+ VALUE io;
+{
+ OpenFile *fptr;
+ FILE *fp;
+ int n;
+
+ GetOpenFile(io, fptr);
+ rb_io_check_readable(fptr);
+ fp = fptr->f;
+ if (feof(fp)) return Qfalse;
+ if (rb_read_pending(fp)) return Qtrue;
+ if (ioctl(fileno(fp), FIONREAD, &n)) rb_sys_fail(0);
+ if (n > 0) return INT2NUM(n);
+ return Qnil;
+}
+
+/*
+=begin
+--- IO#wait([timeout])
+ waits until input available or timed out and returns self, or nil
+ when EOF reached.
+=end
+*/
+static VALUE
+io_wait(argc, argv, io)
+ int argc;
+ VALUE *argv;
+ VALUE io;
+{
+ OpenFile *fptr;
+ fd_set rd;
+ FILE *fp;
+ int fd, n;
+ VALUE timeout;
+ struct timeval *tp, timerec;
+
+ GetOpenFile(io, fptr);
+ rb_io_check_readable(fptr);
+ rb_scan_args(argc, argv, "01", &timeout);
+ if (NIL_P(timeout)) {
+ tp = 0;
+ }
+ else {
+ timerec = rb_time_interval(timeout);
+ tp = &timerec;
+ }
+
+ fp = fptr->f;
+ if (feof(fp)) return Qfalse;
+ if (rb_read_pending(fp)) return Qtrue;
+ fd = fileno(fp);
+ FD_ZERO(&rd);
+ FD_SET(fd, &rd);
+ if (rb_thread_select(fd + 1, &rd, NULL, NULL, tp) < 0)
+ rb_sys_fail(0);
+ rb_io_check_closed(fptr);
+ if (ioctl(fileno(fp), FIONREAD, &n)) rb_sys_fail(0);
+ if (n > 0) return io;
+ return Qnil;
+}
+
+void
+Init_wait()
+{
+ rb_define_method(rb_cIO, "ready?", io_ready_p, 0);
+ rb_define_method(rb_cIO, "wait", io_wait, -1);
+}
diff --git a/ext/kconv/MANIFEST b/ext/kconv/MANIFEST
deleted file mode 100644
index cb89e8239c..0000000000
--- a/ext/kconv/MANIFEST
+++ /dev/null
@@ -1,3 +0,0 @@
-MANIFEST
-depend
-kconv.c
diff --git a/ext/kconv/depend b/ext/kconv/depend
deleted file mode 100644
index 8f09d95130..0000000000
--- a/ext/kconv/depend
+++ /dev/null
@@ -1 +0,0 @@
-kconv.o: kconv.c $(hdrdir)/ruby.h $(hdrdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/kconv/kconv.c b/ext/kconv/kconv.c
deleted file mode 100644
index 0cb9b10a0b..0000000000
--- a/ext/kconv/kconv.c
+++ /dev/null
@@ -1,2016 +0,0 @@
-/** Network Kanji Filter. (PDS Version)
-************************************************************************
-** Copyright (C) 1987, Fujitsu LTD. (Itaru ICHIKAWA)
-**
-** E-Mail Address: ichikawa@flab.fujitsu.co.jp
-** Copyright (C) 1996
-** mine/X0208 support
-** E-Mail Address: kono@ie.u-ryukyu.ac.jp
-** COW for DOS & Win16 & Win32 & OS/2
-** E-Mail Address: GHG00637@niftyserve.or.jp
-**
-**
-**
-** Everyone is permitted to do anything on this program
-** including copying, modifying, improving
-** as long as you don't try to make money off it,
-** or pretend that you wrote it.
-** i.e., the above copyright notice has to appear in all copies.
-** THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE.
-***********************************************************************/
-
-/***********************************************************************
-** 1996/03/10 modified for Kconv - by Ikuo Nakagawa
-***********************************************************************/
-/***********************************************************************
-** 1996/12/18 modified for kconv(ruby) - by matz@ruby.club.or.jp
-***********************************************************************/
-
-static char *CopyRight =
- "Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa),1996 S. Kono, COW";
-static char *Version =
- "1.62";
-static char *Patchlevel =
- "5/9612/Shinji Kono, COW matz";
-
-#include "ruby.h"
-
-/*
-**
-**
-**
-** USAGE: nkf [flags] [file]
-**
-** Flags:
-** b Output is bufferred (DEFAULT)
-** u Output is unbufferred
-**
-** t no operation
-**
-** j Outout code is JIS 7 bit (DEFAULT SELECT)
-** s Output code is MS Kanji (DEFAULT SELECT)
-** e Output code is AT&T JIS (DEFAULT SELECT)
-** l Output code is JIS 7bit and ISO8859-1 Latin-1
-**
-** m MIME conversion for ISO-2022-JP
-** i_ Output sequence to designate JIS-kanji (DEFAULT_J)
-** o_ Output sequence to designate single-byte roman characters (DEFAULT_R)
-**
-** r {de/en}crypt ROT13/47
-**
-** v display Version
-**
-** T Text mode output (for MS-DOS)
-**
-** x Do not convert X0201 kana into X0208
-** Z Convert X0208 alphabet to ASCII
-**
-** f60 fold option
-**
-** m MIME decode
-** B try to fix broken JIS, missing Escape
-** B[1-9] broken level
-**
-** O Output to 'nkf.out' file
-** d Delete \r in line feed
-** c Add \r in line feed
-**/
-/******************************/
-/* */
-/* Select DEFAULT_CODE */
-#define DEFAULT_CODE_JIS
-/* #define DEFAULT_CODE_SJIS */
-/* #define DEFAULT_CODE_EUC */
-/******************************/
-
-/* for Kconv: _AUTO, _EUC, _SJIS, _JIS */
-#define _AUTO 0
-#define _JIS 1
-#define _EUC 2
-#define _SJIS 3
-#define _BINARY 4
-#define _NOCONV 4
-#define _UNKNOWN _AUTO
-
-#if (defined(__TURBOC__) || defined(LSI_C)) && !defined(MSDOS)
-#define MSDOS
-#endif
-
-#include <stdio.h>
-
-#if defined(MSDOS) || defined(__OS2__)
-#include <stdlib.h>
-#include <fcntl.h>
-#include <io.h>
-#endif
-
-#ifdef MSDOS
-#ifdef LSI_C
-#define setbinmode(fp) fsetbin(fp)
-#else /* Microsoft C, Turbo C */
-#define setbinmode(fp) setmode(fileno(fp), O_BINARY)
-#endif
-#else /* UNIX,OS/2 */
-#define setbinmode(fp)
-#endif
-
-#ifdef _IOFBF /* SysV and MSDOS */
-#define setvbuffer(fp, buf, size) setvbuf(fp, buf, _IOFBF, size)
-#else /* BSD */
-#define setvbuffer(fp, buf, size) setbuffer(fp, buf, size)
-#endif
-
-/*Borland C++ 4.5 EasyWin*/
-#if defined(__TURBOC__) && defined(_Windows) && !defined(__WIN32__) /*Easy Win */
-#define EASYWIN
-#include <windows.h>
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#define TRUE 1
-#endif
-
-/* state of output_mode and input_mode */
-
-#define ASCII 0
-#define X0208 1
-#define X0201 2
-#define NO_X0201 3
-#define JIS_INPUT 4
-#define SJIS_INPUT 5
-#define LATIN1_INPUT 6
-#define FIXED_MIME 7
-#define DOUBLE_SPACE -2
-
-#define NL 0x0a
-#define ESC 0x1b
-#define SP 0x20
-#define AT 0x40
-#define SSP 0xa0
-#define DEL 0x7f
-#define SI 0x0f
-#define SO 0x0e
-#define SSO 0x8e
-
-#define HOLD_SIZE 32
-#define IOBUF_SIZE 16384
-
-#define DEFAULT_J 'B'
-#define DEFAULT_R 'B'
-
-#define SJ0162 0x00e1 /* 01 - 62 ku offset */
-#define SJ6394 0x0161 /* 63 - 94 ku offset */
-
-
-/* MIME preprocessor */
-
-#define _GETC() (*inptr ? (int)(*inptr++) : EOF)
-#define _UNGETC(c) (*--inptr = (c))
-#define PUTCHAR(c) (outlen + 1 < outsiz ? \
- ((outptr[outlen++] = (c)), (outptr[outlen] = '\0')) : EOF)
-#define GETC() ((!mime_mode)?_GETC():mime_getc())
-#define UNGETC(c) ((!mime_mode)?_UNGETC(c):mime_ungetc(c))
-
-#ifdef EASYWIN /*Easy Win */
-extern POINT _BufferSize;
-#endif
-
-/* buffers */
-
-static unsigned char hold_buf[HOLD_SIZE*2];
-static int hold_count;
-static unsigned char *inptr;
-static char *outptr;
-static int outsiz;
-static int outlen;
-
-/* MIME preprocessor fifo */
-
-#define MIME_BUF_SIZE (1024) /* 2^n ring buffer */
-#define MIME_BUF_MASK (MIME_BUF_SIZE-1)
-#define Fifo(n) mime_buf[(n)&MIME_BUF_MASK]
-static unsigned char mime_buf[MIME_BUF_SIZE];
-static unsigned int mime_top = 0;
-static unsigned int mime_last = 0; /* decoded */
-static unsigned int mime_input = 0; /* undecoded */
-
-/* flags */
-static int unbuf_f = FALSE;
-static int estab_f = FALSE;
-static int rot_f = FALSE; /* rot14/43 mode */
-static int input_f = FALSE; /* non fixed input code */
-static int alpha_f = FALSE; /* convert JIx0208 alphbet to ASCII */
-static int mime_f = FALSE; /* convert MIME B base64 or Q */
-static int mimebuf_f = FALSE; /* MIME buffered input */
-static int broken_f = FALSE; /* convert ESC-less broken JIS */
-static int iso8859_f = FALSE; /* ISO8859 through */
-#if defined(MSDOS) || defined(__OS2__)
-static int x0201_f = TRUE; /* Assume JISX0201 kana */
-#else
-static int x0201_f = NO_X0201; /* Assume NO JISX0201 */
-#endif
-
-/* X0208 -> ASCII converter */
-
-static int c1_return;
-
-/* fold parameter */
-static int line = 0; /* chars in line */
-static int prev = 0;
-static int fold_f = FALSE;
-static int fold_len = 0;
-
-/* options */
-static char kanji_intro = DEFAULT_J,
- ascii_intro = DEFAULT_R;
-
-/* Folding */
-
-#define FOLD_MARGIN 10
-#define DEFAULT_FOLD 60
-
-/* Global states */
-static int output_mode = ASCII, /* output kanji mode */
- input_mode = ASCII, /* input kanji mode */
- shift_mode = FALSE; /* TRUE shift out, or X0201 */
-static int mime_mode = FALSE; /* MIME mode B base64, Q hex */
-
-/* X0208 -> ASCII translation table */
-/* X0201 / X0208 conversion tables */
-
-/* X0201 kana conversion table */
-/* 90-9F A0-DF */
-static unsigned char cv[]= {
-0x21,0x21,0x21,0x23,0x21,0x56,0x21,0x57,
-0x21,0x22,0x21,0x26,0x25,0x72,0x25,0x21,
-0x25,0x23,0x25,0x25,0x25,0x27,0x25,0x29,
-0x25,0x63,0x25,0x65,0x25,0x67,0x25,0x43,
-0x21,0x3c,0x25,0x22,0x25,0x24,0x25,0x26,
-0x25,0x28,0x25,0x2a,0x25,0x2b,0x25,0x2d,
-0x25,0x2f,0x25,0x31,0x25,0x33,0x25,0x35,
-0x25,0x37,0x25,0x39,0x25,0x3b,0x25,0x3d,
-0x25,0x3f,0x25,0x41,0x25,0x44,0x25,0x46,
-0x25,0x48,0x25,0x4a,0x25,0x4b,0x25,0x4c,
-0x25,0x4d,0x25,0x4e,0x25,0x4f,0x25,0x52,
-0x25,0x55,0x25,0x58,0x25,0x5b,0x25,0x5e,
-0x25,0x5f,0x25,0x60,0x25,0x61,0x25,0x62,
-0x25,0x64,0x25,0x66,0x25,0x68,0x25,0x69,
-0x25,0x6a,0x25,0x6b,0x25,0x6c,0x25,0x6d,
-0x25,0x6f,0x25,0x73,0x21,0x2b,0x21,0x2c,
-0x00,0x00};
-
-
-/* X0201 kana conversion table for daguten */
-/* 90-9F A0-DF */
-static unsigned char dv[]= {
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x25,0x2c,0x25,0x2e,
-0x25,0x30,0x25,0x32,0x25,0x34,0x25,0x36,
-0x25,0x38,0x25,0x3a,0x25,0x3c,0x25,0x3e,
-0x25,0x40,0x25,0x42,0x25,0x45,0x25,0x47,
-0x25,0x49,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x25,0x50,0x25,0x53,
-0x25,0x56,0x25,0x59,0x25,0x5c,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00};
-
-/* X0201 kana conversion table for han-daguten */
-/* 90-9F A0-DF */
-static unsigned char ev[]= {
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x25,0x51,0x25,0x54,
-0x25,0x57,0x25,0x5a,0x25,0x5d,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00};
-
-
-/* X0208 kigou conversion table */
-/* 0x8140 - 0x819e */
-static unsigned char fv[] = {
-0x00,0x00,0x00,0x00,0x2c,0x2e,0x00,0x3a,
-0x3b,0x3f,0x21,0x00,0x00,0x27,0x60,0x00,
-0x5e,0x00,0x5f,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x2d,0x00,0x2f,
-0x5c,0x00,0x00,0x7c,0x00,0x00,0x60,0x27,
-0x22,0x22,0x28,0x29,0x00,0x00,0x5b,0x5d,
-0x7b,0x7d,0x3c,0x3e,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x2b,0x2d,0x00,0x00,
-0x00,0x3d,0x00,0x3c,0x3e,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x24,0x00,0x00,0x25,0x23,0x26,0x2a,0x40,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
-} ;
-
-
-/* This converts =?ISO-2022-JP?B?HOGE HOGE?= */
-
-static unsigned char *mime_pattern[] = {
- (unsigned char *)"\075?ISO-8859-1?Q?",
- (unsigned char *)"\075?ISO-2022-JP?B?",
- (unsigned char *)"\075?ISO-2022-JP?Q?",
- NULL
-};
-
-static int mime_encode[] = {
- 'Q', 'B', 'Q',
- 0
-};
-
-static int add_cr = FALSE;
-static int del_cr = FALSE;
-
-static void (*iconv) _((register int c2,register int c1)); /* s_iconv or oconv */
-static void (*oconv) _((register int c2,register int c1)); /* [ejs]_oconv */
-static int do_kconv _((char *i, char *o, int siz, int out_code, int in_code));
-static void h_conv _((register int c2,register int c1));
-static int push_hold_buf _((int c2,int c1));
-static void s_iconv _((register int c2,register int c1));
-static void e_oconv _((register int c2,register int c1));
-static void s_oconv _((register int c2,register int c1));
-static void j_oconv _((register int c2,register int c1));
-static int fold _((register int c2,register int c1));
-static int pre_convert _((register int c1,register int c2));
-static int mime_begin _((void));
-static int mime_getc _((void));
-static int mime_ungetc _((unsigned int c));
-static int mime_integrity _((unsigned char *p));
-static int base64decode _((int c));
-
-#ifdef notdef
-main (argc, argv)
- int argc;
- char **argv;
-{
- register FILE *fin;
- register char *cp;
-
-#ifdef EASYWIN /*Easy Win */
- _BufferSize.y = 400;/*Set Scroll Buffer Size*/
-#endif
-#ifdef DEFAULT_CODE_JIS
- oconv = j_oconv; /* DEFAULT Code is JIS */
-#endif
-#ifdef DEFAULT_CODE_SJIS
- oconv = s_oconv; /* DEFAULT Code is S-JIS */
-#endif
-#ifdef DEFAULT_CODE_EUC
- oconv = e_oconv; /* DEFAULT Code is EUC */
-#endif
-
- for (argc--,argv++; (argc > 0) && **argv == '-'; argc--, argv++) {
- cp = *argv;
- while (*cp) {
- switch (*cp++) {
- case 'b': /* buffered mode */
- unbuf_f = FALSE;
- continue;
- case 'u': /* non bufferd mode */
- unbuf_f = TRUE;
- continue;
- case 'j': /* JIS output */
- case 'n':
- oconv = j_oconv;
- continue;
- case 'e': /* AT&T EUC output */
- oconv = e_oconv;
- continue;
- case 's': /* SJIS output */
- oconv = s_oconv;
- continue;
- case 'l': /* ISO8859 Latin-1 support, no conversion */
- iso8859_f = TRUE; /* Only compatible with ISO-2022-JP */
- input_f = LATIN1_INPUT;
- continue;
- case 'i': /* Kanji IN ESC-$-@/B */
- if(*cp=='@'||*cp=='B')
- kanji_intro = *cp++;
- continue;
- case 'o': /* ASCII IN ESC-(-J/B */
- if(*cp=='J'||*cp=='B'||*cp=='H')
- ascii_intro = *cp++;
- continue;
- case 'r':
- rot_f = TRUE;
- continue;
-#if defined(MSDOS) || defined(__OS2__)
- case 'T':
- binmode_f = FALSE;
- continue;
-#endif
- case 'v':
- usage();
- exit(1);
- break;
- /* Input code assumption */
- case 'J': /* JIS input */
- case 'E': /* AT&T EUC input */
- input_f = JIS_INPUT;
- continue;
- case 'S': /* MS Kanji input */
- input_f = SJIS_INPUT;
- if(x0201_f==NO_X0201) x0201_f=TRUE;
- continue;
- case 'Z': /* Convert X0208 alphabet to asii */
- /* bit:0 Convert X0208
- bit:1 Convert Kankaku to one space
- bit:2 Convert Kankaku to two spaces
- */
- if('9'>= *cp && *cp>='0')
- alpha_f |= 1<<(*cp++ -'0');
- else
- alpha_f |= TRUE;
- continue;
- case 'x': /* Convert X0201 kana to X0208 or X0201 Conversion */
- x0201_f = FALSE; /* No X0201->X0208 conversion */
- /* accept X0201
- ESC-(-I in JIS, EUC, MS Kanji
- SI/SO in JIS, EUC, MS Kanji
- SSO in EUC, JIS, not in MS Kanji
- MS Kanji (0xa0-0xdf)
- output X0201
- ESC-(-I in JIS (0x20-0x5f)
- SSO in EUC (0xa0-0xdf)
- 0xa0-0xd in MS Kanji (0xa0-0xdf)
- */
- continue;
- case 'X': /* Assume X0201 kana */
- /* Default value is NO_X0201 for EUC/MS-Kanji mix */
- x0201_f = TRUE;
- continue;
- case 'f': /* folding -f60 or -f */
- fold_f = TRUE;
- fold_len = atoi(cp);
- if(!(0<fold_len && fold_len<BUFSIZ))
- fold_len = DEFAULT_FOLD;
- while('0'<= *cp && *cp <='9') cp++;
- continue;
- case 'm': /* MIME support */
- mime_f = TRUE;
- if(*cp=='B'||*cp=='Q') {
- mime_mode = *cp++;
- mimebuf_f = FIXED_MIME;
- }
- continue;
- case 'B': /* Broken JIS support */
- /* bit:0 no ESC JIS
- bit:1 allow any x on ESC-(-x or ESC-$-x
- bit:2 reset to ascii on NL
- */
- if('9'>= *cp && *cp>='0')
- broken_f |= 1<<(*cp++ -'0');
- else
- broken_f |= TRUE;
- continue;
- case 'O':/* for Output file */
- file_out = TRUE;
- continue;
- case 'c':/* add cr code */
- add_cr = TRUE;
- continue;
- case 'd':/* delete cr code */
- del_cr = TRUE;
- continue;
- default:
- /* bogus option but ignored */
- continue;
- }
- }
- }
-
- if(iso8859_f && (oconv != j_oconv || !x0201_f )) {
- fprintf(stderr,"Mixed ISO8859/JISX0201/SJIS/EUC output is not allowed.\n");
- exit(1);
- }
-
- if(binmode_f == TRUE)
-#ifdef __OS2__
- if(freopen("","wb",stdout) == NULL)
- return (-1);
-#else
- setbinmode(stdout);
-#endif
-
- if(unbuf_f)
- setbuf (stdout, (char *) NULL);
- else
- setvbuffer (stdout, stdobuf, IOBUF_SIZE);
-
- if(argc == 0) {
- if(binmode_f == TRUE)
-#ifdef __OS2__
- if(freopen("","rb",stdin) == NULL) return (-1);
-#else
- setbinmode(stdin);
-#endif
- setvbuffer (stdin, stdibuf, IOBUF_SIZE);
- convert (stdin);
- } else {
- while (argc--) {
- if((fin = fopen (*argv++, "r")) == NULL) {
- perror (*--argv);
- return (-1);
- } else {
-/* reopen file for stdout */
- if(file_out == TRUE){
- if(argc == 1 ) {
- if(freopen(*argv++, "w", stdout) == NULL) {
- perror (*--argv);
- return (-1);
- }
- argc--;
- } else {
- if(freopen("nkf.out", "w", stdout) == NULL) {
- perror (*--argv);
- return (-1);
- }
- }
- if(binmode_f == TRUE) {
-#ifdef __OS2__
- if(freopen("","wb",stdout) == NULL)
- return (-1);
-#else
- setbinmode(stdout);
-#endif
- }
- }
- if(binmode_f == TRUE)
-#ifdef __OS2__
- if(freopen("","rb",fin) == NULL)
- return (-1);
-#else
- setbinmode(fin);
-#endif
- setvbuffer (fin, stdibuf, IOBUF_SIZE);
- convert (fin);
- fclose (fin);
- }
- }
- }
-#ifdef EASYWIN /*Easy Win */
- if(file_out == FALSE)
- scanf("%d",&end_check);
- else
- fclose(stdout);
-#else /* for Other OS */
- if(file_out == TRUE)
- fclose(stdout);
-#endif
- return (0);
-}
-#endif /* notdef */
-
-static int
-do_kconv(i, o, siz, out_code, in_code)
- char *i;
- char *o;
- int siz, out_code, in_code;
-{
- register int c1,
- c2;
-
- c2 = 0;
-
- if (siz <= 0) {
- return 0;
- }
- *o = '\0';
-
- inptr = (unsigned char *)i; /* input buffer */
- outptr = o; /* output buffer */
- outsiz = siz; /* output buffer size */
- outlen = 0; /* current length of output string */
- x0201_f = TRUE; /* don't assume JISX0201 kana */
- rot_f = FALSE; /* rot14/43 mode */
- input_f = FALSE; /* non fixed input code */
- alpha_f = FALSE; /* convert JISX0208 alphbet to ASCII */
- mime_f = TRUE; /* convert MIME base64 */
- broken_f = FALSE; /* convert ESC-less broken JIS */
-
- switch (out_code) {
- case _SJIS:
- oconv = s_oconv;
- break;
- case _EUC:
- oconv = e_oconv;
- break;
- default:
- oconv = j_oconv;
- break;
- }
-
- switch (in_code) {
- case _SJIS:
- input_f = SJIS_INPUT;
- x0201_f = TRUE;
- break;
- case _EUC:
- case _JIS:
- input_f = JIS_INPUT;
- break;
- default:
- input_f = FALSE;
- break;
- }
-
- if(input_f == JIS_INPUT || input_f == LATIN1_INPUT) {
- estab_f = TRUE; iconv = oconv;
- } else if(input_f == SJIS_INPUT) {
- estab_f = TRUE; iconv = s_iconv;
- } else {
- estab_f = FALSE; iconv = oconv;
- }
- input_mode = ASCII;
- output_mode = ASCII;
- shift_mode = FALSE;
- mime_mode = FALSE;
-
-#define NEXT continue /* no output, get next */
-#define SEND ; /* output c1 and c2, get next */
-#define LAST break /* end of loop, go closing */
-
- while ((c1 = GETC()) != EOF) {
- if(!c2 && !input_mode && c1<DEL && !mime_mode && !output_mode
- && !shift_mode && !fold_f && !rot_f) {
- /* plain ASCII tight loop, no conversion and no fold */
- while(c1!='=' && c1!=SO && c1!=EOF &&
- c1!=ESC && c1!='$' && c1<DEL && c1!='\r' && c1!='\n') {
- PUTCHAR(c1);
- c1 = _GETC();
- }
- if(c1==EOF) LAST;
- }
- if(c2) {
- /* second byte */
- if(c2 > DEL) {
- /* in case of 8th bit is on */
- if(!estab_f) {
- /* in case of not established yet */
- if(c1 > SSP) {
- /* It is still ambiguious */
- h_conv (c2, c1);
- c2 = 0;
- NEXT;
- } else if(c1 < AT) {
- /* ignore bogus code */
- c2 = 0;
- NEXT;
- } else {
- /* established */
- /* it seems to be MS Kanji */
- estab_f = TRUE;
- iconv = s_iconv;
- SEND;
- }
- } else
- /* in case of already established */
- if(c1 < AT) {
- /* ignore bogus code */
- c2 = 0;
- NEXT;
- } else
- SEND;
- } else
- /* 7 bit code */
- /* it might be kanji shitfted */
- if((c1 == DEL) || (c1 <= SP)) {
- /* ignore bogus first code */
- c2 = 0;
- NEXT;
- } else
- SEND;
- } else {
- /* first byte */
- if(c1 > DEL) {
- /* 8 bit code */
- if(!estab_f && !iso8859_f) {
- /* not established yet */
- if(c1 < SSP) {
- /* it seems to be MS Kanji */
- estab_f = TRUE;
- iconv = s_iconv;
- } else if(c1 < 0xe0) {
- /* it seems to be EUC */
- estab_f = TRUE;
- iconv = oconv;
- } else {
- /* still ambiguious */
- }
- c2 = c1;
- NEXT;
- } else { /* estab_f==TRUE */
- if(iso8859_f) {
- SEND;
- } else if(SSP<=c1 && c1<0xe0 && iconv == s_iconv) {
- /* SJIS X0201 Case... */
- /* This is too arrogant, but ... */
- if(x0201_f==NO_X0201) {
- iconv = oconv;
- c2 = c1;
- NEXT;
- } else
- if(x0201_f) {
- if(dv[(c1-SSP)*2]||ev[(c1-SSP)*2]) {
- /* look ahead for X0201/X0208conversion */
- if((c2 = GETC()) == EOF) {
- (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]);
- LAST;
- } else if(c2==(0xde)) { /* */
- (*oconv)(dv[(c1-SSP)*2],dv[(c1-SSP)*2+1]);
- c2=0;
- NEXT;
- } else if(c2==(0xdf)&&ev[(c1-SSP)*2]) {
- /* */
- (*oconv)(ev[(c1-SSP)*2],ev[(c1-SSP)*2+1]);
- c2=0;
- NEXT;
- }
- UNGETC(c2); c2 = 0;
- }
- (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]);
- NEXT;
- } else
- SEND;
- } else if(c1==SSO && iconv != s_iconv) {
- /* EUC X0201 Case */
- /* This is too arrogant
- if(x0201_f == NO_X0201) {
- estab_f = FALSE;
- c2 = 0;
- NEXT;
- } */
- c1 = GETC(); /* skip SSO */
- euc_1byte_check:
- if(x0201_f && SSP<=c1 && c1<0xe0) {
- if(dv[(c1-SSP)*2]||ev[(c1-SSP)*2]) {
- if((c2 = GETC()) == EOF) {
- (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]);
- LAST;
- }
- /* forward lookup / */
- if(c2 != SSO) {
- UNGETC(c2); c2 = 0;
- (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]);
- NEXT;
- } else if((c2 = GETC()) == EOF) {
- (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]);
- (*oconv)(0,SSO);
- LAST;
- } else if(c2==(0xde)) { /* */
- (*oconv)(dv[(c1-SSP)*2],dv[(c1-SSP)*2+1]);
- c2=0;
- NEXT;
- } else if(c2==(0xdf)&&ev[(c1-SSP)*2]) {
- /* */
- (*oconv)(ev[(c1-SSP)*2],ev[(c1-SSP)*2+1]);
- c2=0;
- NEXT;
- } else {
- (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]);
- /* we have to check this c2 */
- /* and no way to push back SSO */
- c1 = c2; c2 = 0;
- goto euc_1byte_check;
- }
- }
- (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]);
- NEXT;
- } else
- SEND;
- } else if(c1 < SSP && iconv != s_iconv) {
- /* strange code in EUC */
- iconv = s_iconv; /* try SJIS */
- c2 = c1;
- NEXT;
- } else {
- /* already established */
- c2 = c1;
- NEXT;
- }
- }
- } else if((c1 > SP) && (c1 != DEL)) {
- /* in case of Roman characters */
- if(shift_mode) {
- c1 |= 0x80;
- /* output 1 shifted byte */
- if(x0201_f && (!iso8859_f||input_mode==X0201) &&
- SSP<=c1 && c1<0xe0 ) {
- if(dv[(c1-SSP)*2]||ev[(c1-SSP)*2]) {
- if((c2 = GETC()) == EOF) {
- (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]);
- LAST;
- } else if(c2==(0xde&0x7f)) { /* */
- (*oconv)(dv[(c1-SSP)*2],dv[(c1-SSP)*2+1]);
- c2=0;
- NEXT;
- } else if(c2==(0xdf&0x7f)&&ev[(c1-SSP)*2]) {
- /* */
- (*oconv)(ev[(c1-SSP)*2],ev[(c1-SSP)*2+1]);
- c2=0;
- NEXT;
- }
- UNGETC(c2); c2 = 0;
- }
- (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]);
- NEXT;
- } else
- SEND;
- } else if(c1 == '(' && broken_f && input_mode == X0208
- && !mime_mode ) {
- /* Try to recover missing escape */
- if((c1 = GETC()) == EOF) {
- (*oconv) (0, '(');
- LAST;
- } else {
- if(c1 == 'B' || c1 == 'J' || c1 == 'H') {
- input_mode = ASCII; shift_mode = FALSE;
- NEXT;
- } else {
- (*oconv) (0, '(');
- /* do not modify various input_mode */
- /* It can be vt100 sequence */
- SEND;
- }
- }
- } else if(input_mode == X0208) {
- /* in case of Kanji shifted */
- c2 = c1;
- NEXT;
- /* goto next_byte */
- } else if(c1 == '=' && mime_f && !mime_mode ) {
- if((c1 = _GETC()) == EOF) {
- (*oconv) (0, '=');
- LAST;
- } else if(c1 == '?') {
- /* =? is mime conversion start sequence */
- if(mime_begin() == EOF) /* check in detail */
- LAST;
- else
- NEXT;
- } else {
- (*oconv) (0, '=');
- _UNGETC(c1);
- NEXT;
- }
- } else if(c1 == '$' && broken_f && !mime_mode) {
- /* try to recover missing escape */
- if((c1 = GETC()) == EOF) {
- (*oconv) (0, '$');
- LAST;
- } else if(c1 == '@'|| c1 == 'B') {
- /* in case of Kanji in ESC sequence */
- input_mode = X0208;
- shift_mode = FALSE;
- NEXT;
- } else {
- /* sorry */
- (*oconv) (0, '$');
- (*oconv) (0, c1);
- NEXT;
- }
- } else
- SEND;
- } else if(c1 == SI) {
- shift_mode = FALSE;
- NEXT;
- } else if(c1 == SO) {
- shift_mode = TRUE;
- NEXT;
- } else if(c1 == ESC ) {
- if((c1 = GETC()) == EOF) {
- (*oconv) (0, ESC);
- LAST;
- } else if(c1 == '$') {
- if((c1 = GETC()) == EOF) {
- (*oconv) (0, ESC);
- (*oconv) (0, '$');
- LAST;
- } else if(c1 == '@'|| c1 == 'B') {
- /* This is kanji introduction */
- input_mode = X0208;
- shift_mode = FALSE;
- NEXT;
- } else if(broken_f&0x2) {
- input_mode = X0208;
- shift_mode = FALSE;
- NEXT;
- } else {
- (*oconv) (0, ESC);
- (*oconv) (0, '$');
- (*oconv) (0, c1);
- NEXT;
- }
- } else if(c1 == '(') {
- if((c1 = GETC()) == EOF) {
- (*oconv) (0, ESC);
- (*oconv) (0, '(');
- LAST;
- } else {
- if(c1 == 'I') {
- /* This is X0201 kana introduction */
- input_mode = X0201; shift_mode = X0201;
- NEXT;
- } else if(c1 == 'B' || c1 == 'J' || c1 == 'H') {
- /* This is X0208 kanji introduction */
- input_mode = ASCII; shift_mode = FALSE;
- NEXT;
- } else if(broken_f&0x2) {
- input_mode = ASCII; shift_mode = FALSE;
- NEXT;
- } else {
- (*oconv) (0, ESC);
- (*oconv) (0, '(');
- /* maintain various input_mode here */
- SEND;
- }
- }
- } else {
- /* lonely ESC */
- (*oconv) (0, ESC);
- SEND;
- }
- } else if(c1 == NL && broken_f&4) {
- input_mode = ASCII;
- SEND;
- } else
- SEND;
- }
- /* send: */
- if(input_mode == X0208)
- (*oconv) (c2, c1); /* this is JIS, not SJIS/EUC case */
- else
- (*iconv) (c2, c1); /* can be EUC/SJIS */
- c2 = 0;
- continue;
- /* goto next_word */
- }
-
- /* epilogue */
- (*iconv) (EOF, 0);
- return outlen;
-}
-
-
-static void
-h_conv (c2, c1)
- register int c1,
- c2;
-{
- register int wc;
-
-
- /** it must NOT be in the kanji shifte sequence */
- /** it must NOT be written in JIS7 */
- /** and it must be after 2 byte 8bit code */
-
- hold_count = 0;
- push_hold_buf (c2, c1);
- c2 = 0;
-
- while ((c1 = GETC()) != EOF) {
- if(c2) {
- /* second byte */
- if(!estab_f) {
- /* not established */
- if(c1 > SSP) {
- /* it is still ambiguious yet */
- SEND;
- } else if(c1 < AT) {
- /* ignore bogus first byte */
- c2 = 0;
- SEND;
- } else {
- /* now established */
- /* it seems to be MS Kanji */
- estab_f = TRUE;
- iconv = s_iconv;
- SEND;
- }
- } else
- SEND;
- } else {
- /* First byte */
- if(c1 > DEL) {
- /* 8th bit is on */
- if(c1 < SSP) {
- /* it seems to be MS Kanji */
- estab_f = TRUE;
- iconv = s_iconv;
- } else if(c1 < 0xe0) {
- /* it seems to be EUC */
- estab_f = TRUE;
- iconv = oconv;
- } else {
- /* still ambiguious */
- }
- c2 = c1;
- NEXT;
- } else
- /* 7 bit code , then send without any process */
- SEND;
- }
- /* send: */
- if((push_hold_buf (c2, c1) == EOF) || estab_f)
- break;
- c2 = 0;
- continue;
- }
-
- /** now,
- ** 1) EOF is detected, or
- ** 2) Code is established, or
- ** 3) Buffer is FULL (but last word is pushed)
- **
- ** in 1) and 3) cases, we continue to use
- ** Kanji codes by oconv and leave estab_f unchanged.
- **/
-
- for (wc = 0; wc < hold_count; wc += 2) {
- c2 = hold_buf[wc];
- c1 = hold_buf[wc+1];
- (*iconv) (c2, c1);
- }
- return;
-}
-
-
-
-static int
-push_hold_buf (c2, c1)
- int c2,
- c1;
-{
- if(hold_count >= HOLD_SIZE*2)
- return (EOF);
- hold_buf[hold_count++] = c2;
- hold_buf[hold_count++] = c1;
- return ((hold_count >= HOLD_SIZE*2) ? EOF : hold_count);
-}
-
-
-static void
-s_iconv (c2, c1)
- register int c2,
- c1;
-{
- if((c2 == EOF) || (c2 == 0)) {
- /* NOP */
- } else {
- c2 = c2 + c2 - ((c2 <= 0x9f) ? SJ0162 : SJ6394);
- if(c1 < 0x9f)
- c1 = c1 - ((c1 > DEL) ? SP : 0x1f);
- else {
- c1 = c1 - 0x7e;
- c2++;
- }
- }
- (*oconv) (c2, c1);
-}
-
-
-static void
-e_oconv (c2, c1)
- register int c2,
- c1;
-{
- c2 = pre_convert(c1,c2); c1 = c1_return;
- if(fold_f) {
- switch(fold(c2,c1)) {
- case '\n':
- if(add_cr == TRUE) {
- PUTCHAR('\r');
- c1 = '\n';
- }
- PUTCHAR('\n');
- break;
- case 0: return;
- case '\r':
- c1 = '\n'; c2 = 0;
- break;
- case '\t':
- case ' ':
- c1 = ' '; c2 = 0;
- break;
- }
- }
- if(c2==DOUBLE_SPACE) {
- PUTCHAR(' '); PUTCHAR(' ');
- return;
- }
- if(c2 == EOF)
- return;
- else if(c2 == 0 && (c1&0x80)) {
- PUTCHAR(SSO); PUTCHAR(c1);
- } else if(c2 == 0) {
- if(c1 == '\n' && add_cr == TRUE)
- PUTCHAR('\r');
- if(c1 != '\r')
- PUTCHAR(c1);
- else if(del_cr == FALSE)
- PUTCHAR(c1);
- } else {
- if((c1<0x20 || 0x7e<c1) ||
- (c2<0x20 || 0x7e<c2)) {
- estab_f = FALSE;
- return; /* too late to rescue this char */
- }
- PUTCHAR(c2 | 0x080);
- PUTCHAR(c1 | 0x080);
- }
-}
-
-
-static void
-s_oconv (c2, c1)
- register int c2,
- c1;
-{
- c2 = pre_convert(c1,c2); c1 = c1_return;
- if(fold_f) {
- switch(fold(c2,c1)) {
- case '\n':
- if(add_cr == TRUE) {
- PUTCHAR('\r');
- c1 = '\n';
- }
- PUTCHAR('\n');
- break;
- case '\r':
- c1 = '\n'; c2 = 0;
- break;
- case 0: return;
- case '\t':
- case ' ':
- c1 = ' '; c2 = 0;
- break;
- }
- }
- if(c2==DOUBLE_SPACE) {
- PUTCHAR(' '); PUTCHAR(' ');
- return;
- }
- if(c2 == EOF)
- return;
- else if(c2 == 0) {
- if(c1 == '\n' && add_cr == TRUE)
- PUTCHAR('\r');
- if(c1 != '\r')
- PUTCHAR(c1);
- else if(del_cr == FALSE)
- PUTCHAR(c1);
- } else {
- if((c1<0x20 || 0x7e<c1) ||
- (c2<0x20 || 0x7e<c2)) {
- estab_f = FALSE;
- return; /* too late to rescue this char */
- }
- PUTCHAR((((c2 - 1) >> 1) + ((c2 <= 0x5e) ? 0x71 : 0xb1)));
- PUTCHAR((c1 + ((c2 & 1) ? ((c1 < 0x60) ? 0x1f : 0x20) : 0x7e)));
- }
-}
-
-static void
-j_oconv (c2, c1)
- register int c2,
- c1;
-{
- c2 = pre_convert(c1,c2); c1 = c1_return;
- if(fold_f) {
- switch(fold(c2,c1)) {
- case '\n':
- if(output_mode) {
- PUTCHAR(ESC);
- PUTCHAR('(');
- PUTCHAR(ascii_intro);
- }
- if(add_cr == TRUE) {
- PUTCHAR('\r');
- c1 = '\n';
- }
- PUTCHAR('\n');
- output_mode = ASCII;
- break;
- case '\r':
- c1 = '\n'; c2 = 0;
- break;
- case '\t':
- case ' ':
- c1 = ' '; c2 = 0;
- break;
- case 0: return;
- }
- }
- if(c2 == EOF) {
- if(output_mode) {
- PUTCHAR(ESC);
- PUTCHAR('(');
- PUTCHAR(ascii_intro);
- }
- } else if(c2 == 0 && (c1 & 0x80)) {
- if(input_mode==X0201 || !iso8859_f) {
- if(output_mode!=X0201) {
- PUTCHAR(ESC);
- PUTCHAR('(');
- PUTCHAR('I');
- output_mode = X0201;
- }
- c1 &= 0x7f;
- } else {
- /* iso8859 introduction, or 8th bit on */
- /* Can we convert in 7bit form using ESC-'-'-A ?
- Is this popular? */
- }
- PUTCHAR(c1);
- } else if(c2 == 0) {
- if(output_mode) {
- PUTCHAR(ESC);
- PUTCHAR('(');
- PUTCHAR(ascii_intro);
- output_mode = ASCII;
- }
- if(c1 == '\n' && add_cr == TRUE)
- PUTCHAR('\r');
- if(c1 != '\r')
- PUTCHAR(c1);
- else if(del_cr == FALSE)
- PUTCHAR(c1);
- } else if(c2 == DOUBLE_SPACE) {
- if(output_mode) {
- PUTCHAR(ESC);
- PUTCHAR('(');
- PUTCHAR(ascii_intro);
- output_mode = ASCII;
- }
- PUTCHAR(' ');
- if(c1 == '\n' && add_cr == TRUE)
- PUTCHAR('\r');
- if(c1 != '\r')
- PUTCHAR(c1);
- else if(del_cr == FALSE)
- PUTCHAR(c1);
- } else {
- if(output_mode != X0208) {
- PUTCHAR(ESC);
- PUTCHAR('$');
- PUTCHAR(kanji_intro);
- output_mode = X0208;
- }
- if(c1<0x20 || 0x7e<c1)
- return;
- if(c2<0x20 || 0x7e<c2)
- return;
- PUTCHAR(c2);
- if(c1 == '\n' && add_cr == TRUE)
- PUTCHAR('\r');
- if(c1 != '\r')
- PUTCHAR(c1);
- else if(del_cr == FALSE)
- PUTCHAR(c1);
- }
-}
-
-
-#define rot13(c) ( \
- ( c < 'A' ) ? c: \
- (c <= 'M') ? (c + 13): \
- (c <= 'Z') ? (c - 13): \
- (c < 'a') ? (c): \
- (c <= 'm') ? (c + 13): \
- (c <= 'z') ? (c - 13): \
- (c) \
-)
-
-#define rot47(c) ( \
- ( c < '!' ) ? c: \
- ( c <= 'O' ) ? (c + 47) : \
- ( c <= '~' ) ? (c - 47) : \
- c \
-)
-
-/*
- Return value of fold()
-
- \n add newline and output char
- \r add newline and output nothing
- ' ' space
- 0 skip
- 1 (or else) normal output
-
- fold state in prev (previous character)
-
- >0x80 Japanese (X0208/X0201)
- <0x80 ASCII
- \n new line
- ' ' space
-
- This fold algorthm does not preserve heading space in a line.
- This is the main difference from fmt.
-*/
-
-static int
-fold(c2,c1)
-register int c2,c1;
-{
- int prev0;
- if(c1=='\r')
- return 0; /* ignore cr */
- if(c1== 8) {
- if(line>0) line--;
- return 1;
- }
- if(c2==EOF && line != 0) /* close open last line */
- return '\n';
- /* new line */
- if(c1=='\n') {
- if(prev == c1) { /* duplicate newline */
- if(line) {
- line = 0;
- return '\n'; /* output two newline */
- } else {
- line = 0;
- return 1;
- }
- } else {
- if(prev&0x80) { /* Japanese? */
- prev = c1;
- return 0; /* ignore given single newline */
- } else if(prev==' ') {
- return 0;
- } else {
- prev = c1;
- if(++line<=fold_len)
- return ' ';
- else {
- line = 0;
- return '\r'; /* fold and output nothing */
- }
- }
- }
- }
- if(c1=='\f') {
- prev = '\n';
- if(line==0)
- return 1;
- line = 0;
- return '\n'; /* output newline and clear */
- }
- /* X0208 kankaku or ascii space */
- if( (c2==0&&c1==' ')||
- (c2==0&&c1=='\t')||
- (c2==DOUBLE_SPACE)||
- (c2=='!'&& c1=='!')) {
- if(prev == ' ') {
- return 0; /* remove duplicate spaces */
- }
- prev = ' ';
- if(++line<=fold_len)
- return ' '; /* output ASCII space only */
- else {
- prev = ' '; line = 0;
- return '\r'; /* fold and output nothing */
- }
- }
- prev0 = prev; /* we still need this one... , but almost done */
- prev = c1;
- if(c2 || (SSP<=c1 && c1<=0xdf))
- prev |= 0x80; /* this is Japanese */
- line += (c2==0)?1:2;
- if(line<=fold_len) { /* normal case */
- return 1;
- }
- if(line>=fold_len+FOLD_MARGIN) { /* too many kinsou suspension */
- line = (c2==0)?1:2;
- return '\n'; /* We can't wait, do fold now */
- }
- /* simple kinsoku rules return 1 means no folding */
- if(c2==0) {
- if(c1==0xde) return 1; /* */
- if(c1==0xdf) return 1; /* */
- if(c1==0xa4) return 1; /* */
- if(c1==0xa3) return 1; /* */
- if(c1==0xa1) return 1; /* */
- if(c1==0xb0) return 1; /* - */
- if(SSP<=c1 && c1<=0xdf) { /* X0201 */
- line = 1;
- return '\n';/* add one new line before this character */
- }
- /* fold point in ASCII { [ ( */
- if(( c1!=')'&&
- c1!=']'&&
- c1!='}'&&
- c1!='.'&&
- c1!=','&&
- c1!='!'&&
- c1!='?'&&
- c1!='/'&&
- c1!=':'&&
- c1!=';')&&
- ((prev0=='\n')|| (prev0==' ')|| /* ignored new line */
- (prev0&0x80)) /* X0208 - ASCII */
- ) {
- line = 1;
- return '\n';/* add one new line before this character */
- }
- return 1; /* default no fold in ASCII */
- } else {
- if(c2=='!') {
- if(c1=='"') return 1; /* */
- if(c1=='#') return 1; /* */
- if(c1=='$') return 1; /* */
- if(c1=='%') return 1; /* */
- if(c1=='\'') return 1; /* */
- if(c1=='(') return 1; /* */
- if(c1==')') return 1; /* */
- if(c1=='*') return 1; /* */
- if(c1=='+') return 1; /* */
- if(c1==',') return 1; /* */
- }
- line = 2;
- return '\n'; /* add one new line before this character */
- }
-}
-
-static int
-pre_convert(c1,c2)
-register int c1,c2;
-{
- if(c2) c1 &= 0x7f;
- c1_return = c1;
- if(c2==EOF) return c2;
- c2 &= 0x7f;
- if(rot_f) {
- if(c2) {
- c1 = rot47(c1);
- c2 = rot47(c2);
- } else {
- if(!(c1 & 0x80))
- c1 = rot13(c1);
- }
- c1_return = c1;
- }
- /* JISX0208 Alphabet */
- if(alpha_f && c2 == 0x23 ) return 0;
- /* JISX0208 Kigou */
- if(alpha_f && c2 == 0x21 ) {
- if(0x21==c1) {
- if(alpha_f&0x2) {
- c1_return = ' ';
- return 0;
- } else if(alpha_f&0x4) {
- c1_return = ' ';
- return DOUBLE_SPACE;
- } else {
- return c2;
- }
- } else if(0x20<c1 && c1<0x7f && fv[c1-0x20]) {
- c1_return = fv[c1-0x20];
- return 0;
- }
- }
- return c2;
-}
-
-
-static int iso8859_f_save;
-
-#define nkf_toupper(c) (('a'<=c && c<='z')?(c-('a'-'A')):c)
-/* I don't trust portablity of toupper */
-
-static int
-mime_begin()
-{
- int c1;
- int i,j,k;
- unsigned char *p,*q;
- int r[20]; /* recovery buffer, max mime pattern lenght */
-
- mime_mode = FALSE;
- /* =? has been checked */
- j = 0;
- p = mime_pattern[j];
- r[0]='='; r[1]='?';
-
- for(i=2;p[i]>' ';i++) { /* start at =? */
- if( ((r[i] = c1 = _GETC())==EOF) || nkf_toupper(c1) != p[i] ) {
- /* pattern fails, try next one */
- q = p;
- while (p = mime_pattern[++j]) {
- for(k=2;k<i;k++) /* assume length(p) > i */
- if(p[k]!=q[k]) break;
- if(k==i && nkf_toupper(c1)==p[k]) break;
- }
- if(p) continue; /* found next one, continue */
- /* all fails, output from recovery buffer */
- _UNGETC(c1);
- for(j=0;j<i;j++) {
- (*oconv)(0,r[j]);
- }
- return c1;
- }
- }
- iso8859_f_save = iso8859_f;
- if(j==0) {
- iso8859_f = TRUE;
- }
- mime_mode = mime_encode[j];
- if(mime_mode=='B') {
- mimebuf_f = unbuf_f;
- if(!unbuf_f) {
- /* do MIME integrity check */
- return mime_integrity(mime_pattern[j]);
- }
- }
- mimebuf_f = TRUE;
- return c1;
-}
-
-#define mime_getc0() (mimebuf_f?_GETC():Fifo(mime_input++))
-#define mime_ungetc0(c) (mimebuf_f?_UNGETC(c):mime_input--)
-
-static int
-mime_getc()
-{
- int c1, c2, c3, c4, cc;
- int t1, t2, t3, t4, mode, exit_mode;
-
- if(mime_top != mime_last) { /* Something is in FIFO */
- return Fifo(mime_top++);
- }
-
- if(mimebuf_f == FIXED_MIME)
- exit_mode = mime_mode;
- else
- exit_mode = FALSE;
- if(mime_mode == 'Q') {
- if((c1 = mime_getc0()) == EOF) return (EOF);
- if(c1=='_') return ' ';
- if(c1!='=' && c1!='?')
- return c1;
- mime_mode = exit_mode; /* prepare for quit */
- if(c1<=' ') return c1;
- if((c2 = mime_getc0()) == EOF) return (EOF);
- if(c2<=' ') return c2;
- if(c1=='?'&&c2=='=') {
- /* end Q encoding */
- input_mode = exit_mode;
- iso8859_f = iso8859_f_save;
- return _GETC();
- }
- if(c1=='?') {
- mime_mode = 'Q'; /* still in MIME */
- mime_ungetc0(c2);
- return c1;
- }
- if((c3 = mime_getc0()) == EOF) return (EOF);
- if(c2<=' ') return c2;
- mime_mode = 'Q'; /* still in MIME */
-#define hex(c) (('0'<=c&&c<='9')?(c-'0'):\
- ('A'<=c&&c<='F')?(c-'A'+10):('a'<=c&&c<='f')?(c-'a'+10):0)
- return ((hex(c2)<<4) + hex(c3));
- }
-
- if(mime_mode != 'B') {
- mime_mode = FALSE;
- return _GETC();
- }
-
-
- /* Base64 encoding */
- /*
- MIME allows line break in the middle of
- Base64, but we are very pessimistic in decoding
- in unbuf mode because MIME encoded code may broken by
- less or editor's control sequence (such as ESC-[-K in unbuffered
- mode. ignore incomplete MIME.
- */
- mode = mime_mode;
- mime_mode = exit_mode; /* prepare for quit */
-
- while ((c1 = mime_getc0())<=' ') {
- if(c1==EOF)
- return (EOF);
- }
- if((c2 = mime_getc0())<=' ') {
- if(c2==EOF)
- return (EOF);
- if(mimebuf_f!=FIXED_MIME) input_mode = ASCII;
- return c2;
- }
- if((c1 == '?') && (c2 == '=')) {
- input_mode = ASCII;
- while((c1 = _GETC())==' ' /* || c1=='\n' || c1=='\r' */);
- return c1;
- }
- if((c3 = mime_getc0())<=' ') {
- if(c3==EOF)
- return (EOF);
- if(mimebuf_f!=FIXED_MIME) input_mode = ASCII;
- return c3;
- }
- if((c4 = mime_getc0())<=' ') {
- if(c4==EOF)
- return (EOF);
- if(mimebuf_f!=FIXED_MIME) input_mode = ASCII;
- return c4;
- }
-
- mime_mode = mode; /* still in MIME sigh... */
-
- /* BASE 64 decoding */
-
- t1 = 0x3f & base64decode(c1);
- t2 = 0x3f & base64decode(c2);
- t3 = 0x3f & base64decode(c3);
- t4 = 0x3f & base64decode(c4);
- cc = ((t1 << 2) & 0x0fc) | ((t2 >> 4) & 0x03);
- if(c2 != '=') {
- Fifo(mime_last++) = cc;
- cc = ((t2 << 4) & 0x0f0) | ((t3 >> 2) & 0x0f);
- if(c3 != '=') {
- Fifo(mime_last++) = cc;
- cc = ((t3 << 6) & 0x0c0) | (t4 & 0x3f);
- if(c4 != '=')
- Fifo(mime_last++) = cc;
- }
- } else {
- return c1;
- }
- return Fifo(mime_top++);
-}
-
-static int
-mime_ungetc(c)
-unsigned int c;
-{
- Fifo(mime_last++) = c;
- return c;
-}
-
-
-static int
-mime_integrity(p)
-unsigned char *p;
-{
- int c,d;
- unsigned int q;
- /* In buffered mode, read until =? or NL or buffer full
- */
- mime_input = mime_top;
- mime_last = mime_top;
- while(*p) Fifo(mime_input++) = *p++;
- d = 0;
- q = mime_input;
- while((c=_GETC())!=EOF) {
- if(((mime_input-mime_top)&MIME_BUF_MASK)==0) break;
- if(c=='=' && d=='?') {
- /* checked. skip header, start decode */
- Fifo(mime_input++) = c;
- mime_input = q;
- return 1;
- }
- if(!( (c=='+'||c=='/'|| c=='=' || c=='?' ||
- ('a'<=c && c<='z')||('A'<= c && c<='Z')||('0'<=c && c<='9'))))
- break;
- /* Should we check length mod 4? */
- Fifo(mime_input++) = c;
- d=c;
- }
- /* In case of Incomplete MIME, no MIME decode */
- Fifo(mime_input++) = c;
- mime_last = mime_input; /* point undecoded buffer */
- mime_mode = 1; /* no decode on Fifo last in mime_getc */
- return 1;
-}
-
-static int
-base64decode(c)
- int c;
-{
- int i;
- if(c > '@')
- if(c < '[')
- i = c - 'A'; /* A..Z 0-25 */
- else
- i = c - 'G' /* - 'a' + 26 */ ; /* a..z 26-51 */
- else if(c > '/')
- i = c - '0' + '4' /* - '0' + 52 */ ; /* 0..9 52-61 */
- else if(c == '+')
- i = '>' /* 62 */ ; /* + 62 */
- else
- i = '?' /* 63 */ ; /* / 63 */
- return (i);
-}
-
-#ifdef notdef
-int
-usage()
-{
- fprintf(stderr,"USAGE: nkf(nkf32,wnkf,nkf2) -[flags] [in file] .. [out file for -O flag]\n");
- fprintf(stderr,"Flags:\n");
- fprintf(stderr,"b,u Output is bufferred (DEFAULT),Output is unbufferred\n");
-#ifdef DEFAULT_CODE_SJIS
- fprintf(stderr,"j,s,e Outout code is JIS 7 bit, Shift JIS (DEFAULT), AT&T JIS (EUC)\n");
-#endif
-#ifdef DEFAULT_CODE_JIS
- fprintf(stderr,"j,s,e Outout code is JIS 7 bit (DEFAULT), Shift JIS, AT&T JIS (EUC)\n");
-#endif
-#ifdef DEFAULT_CODE_EUC
- fprintf(stderr,"j,s,e Outout code is JIS 7 bit, Shift JIS, AT&T JIS (EUC) (DEFAULT)\n");
-#endif
- fprintf(stderr,"J,S,E Input assumption is JIS 7 bit , Shift JIS, AT&T JIS (EUC)\n");
- fprintf(stderr,"t no conversion\n");
- fprintf(stderr,"i_ Output sequence to designate JIS-kanji (DEFAULT B)\n");
- fprintf(stderr,"o_ Output sequence to designate ASCII (DEFAULT B)\n");
- fprintf(stderr,"r {de/en}crypt ROT13/47\n");
- fprintf(stderr,"v Show this usage\n");
- fprintf(stderr,"m[BQ] MIME decode [B:base64 stream,Q:quoted stream]\n");
- fprintf(stderr,"l ISO8859-1 (Latin-1) support\n");
- fprintf(stderr,"f Folding: -f60 or -f\n");
- fprintf(stderr,"Z[0-2] Convert X0208 alphabet to ASCII 1: Kankaku to space,2: 2 spaces\n");
- fprintf(stderr,"X,x Assume X0201 kana in MS-Kanji, -x preserves X0201\n");
- fprintf(stderr,"B[0-2] Broken input 0: missing ESC,1: any X on ESC-[($]-X,2: ASCII on NL\n");
-#ifdef MSDOS
- fprintf(stderr,"T Text mode output\n");
-#endif
- fprintf(stderr,"O Output to File (DEFAULT 'nkf.out')\n");
- fprintf(stderr,"d,c Delete \\r in line feed, Add \\r in line feed\n");
- fprintf(stderr,"Network Kanji Filter Version %s (%s) "
-#if defined(MSDOS) && !defined(_Windows)
- "for DOS"
-#endif
-#if !defined(__WIN32__) && defined(_Windows)
- "for Win16"
-#endif
-#if defined(__WIN32__) && defined(_Windows)
- "for Win32"
-#endif
-#ifdef __OS2__
- "for OS/2"
-#endif
- ,Version,Patchlevel);
- fprintf(stderr,"\n%s\n",CopyRight);
- return 0;
-}
-#endif /* notdef */
-
-static VALUE
-kconv_kconv(argc, argv)
- int argc;
- VALUE *argv;
-{
- VALUE src, dst;
- VALUE in, out;
- int in_code, out_code;
- char *codename = 0;
-
- rb_scan_args(argc, argv, "12", &src, &out, &in);
- Check_Type(src, T_STRING);
-
- if (NIL_P(out)) {
- codename = rb_get_kcode();
- goto codeselect;
- }
- else if (TYPE(out) == T_STRING) {
- codename = RSTRING(out)->ptr;
- codeselect:
- switch (codename[0]) {
- case 'E': case 'e':
- out_code = _EUC;
- break;
- case 'S': case 's':
- out_code = _SJIS;
- break;
- case 'J': case 'j':
- default:
- out_code = _JIS;
- break;
- }
- }
- else {
- out_code = NUM2INT(out);
- if (out_code == _NOCONV) return (VALUE)src;
- }
- if (NIL_P(in)) {
- in_code = _AUTO;
- }
- else if (TYPE(in) == T_STRING) {
- switch (RSTRING(in)->ptr[0]) {
- case 'E': case 'e':
- in_code = _EUC;
- break;
- case 'S': case 's':
- in_code = _SJIS;
- break;
- case 'J': case 'j':
- in_code = _JIS;
- break;
- default:
- in_code = _AUTO;
- break;
- }
- }
- else {
- in_code = NUM2INT(in);
- if (in_code == _NOCONV) return (VALUE)src;
- }
-
- dst = str_new(0, RSTRING(src)->len*3+10); /* large enough? */
- RSTRING(dst)->len = do_kconv(RSTRING(src)->ptr, RSTRING(dst)->ptr, RSTRING(dst)->len, out_code, in_code);
-
- return dst;
-}
-
-static VALUE
-kconv_tojis(obj, src)
- VALUE obj, src;
-{
- VALUE dst;
-
- Check_Type(src, T_STRING);
-
- dst = str_new(0, RSTRING(src)->len*3+10); /* large enough? */
- RSTRING(dst)->len = do_kconv(RSTRING(src)->ptr, RSTRING(dst)->ptr, RSTRING(dst)->len, _JIS, _AUTO);
-
- return dst;
-}
-
-static VALUE
-kconv_toeuc(obj, src)
- VALUE obj, src;
-{
- VALUE dst;
-
- Check_Type(src, T_STRING);
-
- dst = str_new(0, RSTRING(src)->len*3+10); /* large enough? */
- RSTRING(dst)->len = do_kconv(RSTRING(src)->ptr, RSTRING(dst)->ptr, RSTRING(dst)->len, _EUC, _AUTO);
-
- return (VALUE)dst;
-}
-
-static VALUE
-kconv_tosjis(obj, src)
- VALUE obj, src;
-{
- VALUE dst;
-
- Check_Type(src, T_STRING);
-
- dst = str_new(0, RSTRING(src)->len*3+10); /* large enough? */
- RSTRING(dst)->len = do_kconv(RSTRING(src)->ptr, RSTRING(dst)->ptr, RSTRING(dst)->len, _SJIS, _AUTO);
-
- return dst;
-}
-
-/*
- * Character code detection - Algorithm described in:
- * Ken Lunde. `Understanding Japanese Information Processing'
- * Sebastopol, CA: O'Reilly & Associates.
- */
-
-static VALUE
-kconv_guess(obj, src)
- VALUE obj, src;
-{
- unsigned char *p;
- unsigned char *pend;
- int sequence_counter = 0;
-
- Check_Type(src, T_STRING);
-
- p = RSTRING(src)->ptr;
- pend = p + RSTRING(src)->len;
-
-#define INCR do {\
- p++;\
- if (p==pend) return INT2FIX(_UNKNOWN);\
- sequence_counter++;\
- if (sequence_counter % 2 == 1 && *p != 0xa4)\
- sequence_counter = 0;\
- if (6 <= sequence_counter) {\
- sequence_counter = 0;\
- return INT2FIX(_EUC);\
- }\
-} while (0)
-
- if (*p == 0xa4)
- sequence_counter = 1;
-
- while (p<pend) {
- if (*p == '\033') {
- return INT2FIX(_JIS);
- }
- if ('\000' < *p && *p < '\006'
- || *p == 0x7f
- || *p == 0xdf) {
- return INT2FIX(_BINARY);
- }
- if (0x81 <= *p && *p <= 0x8d) {
- return INT2FIX(_SJIS);
- }
- if (0x8f <= *p && *p <= 0x9f) {
- return INT2FIX(_SJIS);
- }
- if (*p == 0x8e) { /* SS2 */
- INCR;
- if ((0x40 <= *p && *p <= 0x7e) ||
- (0x80 <= *p && *p <= 0xa0) ||
- (0xe0 <= *p && *p <= 0xfc))
- return INT2FIX(_SJIS);
- }
- else if (0xa1 <= *p && *p <= 0xdf) {
- INCR;
- if (0xf0 <= *p && *p <= 0xfe)
- return INT2FIX(_EUC);
- if (0xe0 <= *p && *p <= 0xef) {
- while (p < pend && *p >= 0x40) {
- if (*p >= 0x81) {
- if (*p <= 0x8d || (0x8f <= *p && *p <= 0x9f)) {
- return INT2FIX(_SJIS);
- }
- else if (0xfd <= *p && *p <= 0xfe) {
- return INT2FIX(_EUC);
- }
- }
- INCR;
- }
- }
- else if (*p <= 0x9f) {
- return INT2FIX(_SJIS);
- }
- }
- else if (0xf0 <= *p && *p <= 0xfe) {
- return INT2FIX(_EUC);
- }
- else if (0xe0 <= *p && *p <= 0xef) {
- INCR;
- if ((0x40 <= *p && *p <= 0x7e) ||
- (0x80 <= *p && *p <= 0xa0)) {
- return INT2FIX(_SJIS);
- }
- if (0xfd <= *p && *p <= 0xfe) {
- return INT2FIX(_EUC);
- }
- }
- INCR;
- }
- return INT2FIX(_UNKNOWN);
-}
-
-void
-Init_kconv()
-{
- VALUE mKconv = rb_define_module("Kconv");
-
- rb_define_module_function(mKconv, "kconv", kconv_kconv, -1);
- rb_define_module_function(mKconv, "tojis", kconv_tojis, 1);
- rb_define_module_function(mKconv, "toeuc", kconv_toeuc, 1);
- rb_define_module_function(mKconv, "tosjis", kconv_tosjis, 1);
- rb_define_module_function(mKconv, "guess", kconv_guess, 1);
-
- rb_define_const(mKconv, "AUTO", INT2FIX(_AUTO));
- rb_define_const(mKconv, "JIS", INT2FIX(_JIS));
- rb_define_const(mKconv, "EUC", INT2FIX(_EUC));
- rb_define_const(mKconv, "SJIS", INT2FIX(_SJIS));
- rb_define_const(mKconv, "BINARY", INT2FIX(_BINARY));
- rb_define_const(mKconv, "NOCONV", INT2FIX(_NOCONV));
- rb_define_const(mKconv, "UNKNOWN", INT2FIX(_UNKNOWN));
-}
-
-/**
- **
- ** void@merope.pleiades.or.jp (Kusakabe Youichi)
- ** NIDE Naoyuki <nide@ics.nara-wu.ac.jp>
- ** ohta@src.ricoh.co.jp (Junn Ohta)
- ** inouet@strl.nhk.or.jp (Tomoyuki Inoue)
- ** kiri@pulser.win.or.jp (Tetsuaki Kiriyama)
- ** Kimihiko Sato <sato@sail.t.u-tokyo.ac.jp>
- ** a_kuroe@kuroe.aoba.yokohama.jp (Akihiko Kuroe)
- ** kono@ie.u-ryukyu.ac.jp (Shinji Kono)
- ** GHG00637@nifty-serve.or.jp (COW)
- ** j_kuro@pluto.ai.kyutech.ac.jp (Jun Kuroda)
- **
- **
- ** 1996.12.18
- **/
-
-/* end */
diff --git a/ext/md5/MANIFEST b/ext/md5/MANIFEST
deleted file mode 100644
index e4f0004b4a..0000000000
--- a/ext/md5/MANIFEST
+++ /dev/null
@@ -1,6 +0,0 @@
-MANIFEST
-depend
-md5.doc
-md5.h
-md5c.c
-md5init.c
diff --git a/ext/md5/depend b/ext/md5/depend
deleted file mode 100644
index abb2a47419..0000000000
--- a/ext/md5/depend
+++ /dev/null
@@ -1,2 +0,0 @@
-md5c.o: md5c.c md5.h
-md5init.o: md5init.c $(hdrdir)/ruby.h $(hdrdir)/config.h $(hdrdir)/defines.h md5.h
diff --git a/ext/md5/md5.doc b/ext/md5/md5.doc
deleted file mode 100644
index 2203404602..0000000000
--- a/ext/md5/md5.doc
+++ /dev/null
@@ -1,36 +0,0 @@
-.\" md5.doc - -*- Indented-Text -*- created at: Fri Aug 2 12:01:27 JST 1996
-
-** MD5()
-
-RFC1321RSA Data Security, Inc. MD5 Message-Digest
-Algorithm
-
-SuperClass: Object
-
-Class Methods:
-
- new([str])
- md5([str])
-
- MD5
- (see update)
-
-Methods:
-
- clone
-
- MD5
-
- digest
-
- 16
-
-
- update(str)
-
- key
-
--------------------------------------------------------
-Local variables:
-fill-column: 70
-end:
diff --git a/ext/md5/md5.h b/ext/md5/md5.h
deleted file mode 100644
index 81a6d7ff36..0000000000
--- a/ext/md5/md5.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* MD5.H - header file for MD5C.C
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
-
-License to copy and use this software is granted provided that it
-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-Algorithm" in all material mentioning or referencing this software
-or this function.
-
-License is also granted to make and use derivative works provided
-that such works are identified as "derived from the RSA Data
-Security, Inc. MD5 Message-Digest Algorithm" in all material
-mentioning or referencing the derived work.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
- */
-
-/* ========== include global.h ========== */
-/* GLOBAL.H - RSAREF types and constants
- */
-
-/* PROTOTYPES should be set to one if and only if the compiler supports
- function argument prototyping.
-The following makes PROTOTYPES default to 0 if it has not already
- been defined with C compiler flags.
- */
-#ifdef HAVE_PROTOTYPES
-#define PROTOTYPES 1
-#endif
-#ifndef PROTOTYPES
-#define PROTOTYPES 0
-#endif
-
-/* POINTER defines a generic pointer type */
-typedef unsigned char *POINTER;
-
-/* UINT2 defines a two byte word */
-typedef unsigned short int UINT2;
-
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#else
-/* Wild guess */
-#define LONG_MAX 2147483647L
-#endif
-
-/* UINT4 defines a four byte word */
-#if defined(INT_MAX) && INT_MAX == 2147483647
-typedef unsigned int UINT4;
-#else
-#if defined(LONG_MAX) && LONG_MAX == 2147483647L
-typedef unsigned long int UINT4;
-#endif
-/* Too bad if neither is */
-#endif
-
-/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
-If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
- returns an empty list.
- */
-#if PROTOTYPES
-#define PROTO_LIST(list) list
-#else
-#define PROTO_LIST(list) ()
-#endif
-/* ========== End global.h; continue md5.h ========== */
-
-/* MD5 context. */
-typedef struct {
- UINT4 state[4]; /* state (ABCD) */
- UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
- unsigned char buffer[64]; /* input buffer */
-} MD5_CTX;
-
-void MD5Init PROTO_LIST ((MD5_CTX *));
-void MD5Update PROTO_LIST
- ((MD5_CTX *, unsigned char *, unsigned int));
-void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));
diff --git a/ext/md5/md5c.c b/ext/md5/md5c.c
deleted file mode 100644
index d7c7e4fb27..0000000000
--- a/ext/md5/md5c.c
+++ /dev/null
@@ -1,337 +0,0 @@
-/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
-
-License to copy and use this software is granted provided that it
-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-Algorithm" in all material mentioning or referencing this software
-or this function.
-
-License is also granted to make and use derivative works provided
-that such works are identified as "derived from the RSA Data
-Security, Inc. MD5 Message-Digest Algorithm" in all material
-mentioning or referencing the derived work.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "md5.h"
-
-/* Constants for MD5Transform routine.
- */
-
-#define S11 7
-#define S12 12
-#define S13 17
-#define S14 22
-#define S21 5
-#define S22 9
-#define S23 14
-#define S24 20
-#define S31 4
-#define S32 11
-#define S33 16
-#define S34 23
-#define S41 6
-#define S42 10
-#define S43 15
-#define S44 21
-
-static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64]));
-static void Encode PROTO_LIST
- ((unsigned char *, UINT4 *, unsigned int));
-static void Decode PROTO_LIST
- ((UINT4 *, unsigned char *, unsigned int));
-static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
-static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
-
-static unsigned char PADDING[64] = {
- 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-/* F, G, H and I are basic MD5 functions.
- */
-#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
-#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-#define I(x, y, z) ((y) ^ ((x) | (~z)))
-
-/* ROTATE_LEFT rotates x left n bits.
- */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-
-/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
-Rotation is separate from addition to prevent recomputation.
- */
-#define FF(a, b, c, d, x, s, ac) { \
- (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define GG(a, b, c, d, x, s, ac) { \
- (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define HH(a, b, c, d, x, s, ac) { \
- (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define II(a, b, c, d, x, s, ac) { \
- (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-
-/* MD5 initialization. Begins an MD5 operation, writing a new context.
- */
-void MD5Init (context)
-MD5_CTX *context; /* context */
-{
- context->count[0] = context->count[1] = 0;
- /* Load magic initialization constants.
-*/
- context->state[0] = 0x67452301;
- context->state[1] = 0xefcdab89;
- context->state[2] = 0x98badcfe;
- context->state[3] = 0x10325476;
-}
-
-/* MD5 block update operation. Continues an MD5 message-digest
- operation, processing another message block, and updating the
- context.
- */
-void MD5Update (context, input, inputLen)
-MD5_CTX *context; /* context */
-unsigned char *input; /* input block */
-unsigned int inputLen; /* length of input block */
-{
- unsigned int i, index, partLen;
-
- /* Compute number of bytes mod 64 */
- index = (unsigned int)((context->count[0] >> 3) & 0x3F);
-
- /* Update number of bits */
- if ((context->count[0] += ((UINT4)inputLen << 3))
- < ((UINT4)inputLen << 3))
- context->count[1]++;
- context->count[1] += ((UINT4)inputLen >> 29);
-
- partLen = 64 - index;
-
- /* Transform as many times as possible.
-*/
- if (inputLen >= partLen) {
- MD5_memcpy
- ((POINTER)&context->buffer[index], (POINTER)input, partLen);
- MD5Transform (context->state, context->buffer);
-
- for (i = partLen; i + 63 < inputLen; i += 64)
- MD5Transform (context->state, &input[i]);
-
- index = 0;
- }
- else
- i = 0;
-
- /* Buffer remaining input */
- MD5_memcpy
- ((POINTER)&context->buffer[index], (POINTER)&input[i],
- inputLen-i);
-}
-
-/* MD5 finalization. Ends an MD5 message-digest operation, writing the
- the message digest and zeroizing the context.
- */
-void MD5Final (digest, context)
-unsigned char digest[16]; /* message digest */
-MD5_CTX *context; /* context */
-{
- unsigned char bits[8];
- unsigned int index, padLen;
-
- /* Save number of bits */
- Encode (bits, context->count, 8);
-
- /* Pad out to 56 mod 64.
-*/
- index = (unsigned int)((context->count[0] >> 3) & 0x3f);
- padLen = (index < 56) ? (56 - index) : (120 - index);
- MD5Update (context, PADDING, padLen);
-
- /* Append length (before padding) */
- MD5Update (context, bits, 8);
-
- /* Store state in digest */
- Encode (digest, context->state, 16);
-
- /* Zeroize sensitive information.
-*/
- MD5_memset ((POINTER)context, 0, sizeof (*context));
-}
-
-/* MD5 basic transformation. Transforms state based on block.
- */
-static void MD5Transform (state, block)
-UINT4 state[4];
-unsigned char block[64];
-{
- UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
-
- Decode (x, block, 64);
-
- /* Round 1 */
- FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
- FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
- FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
- FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
- FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
- FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
- FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
- FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
- FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
- FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
- FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
- FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
- FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
- FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
- FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
- FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
-
- /* Round 2 */
- GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
- GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
- GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
- GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
- GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
- GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */
- GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
- GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
- GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
- GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
- GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
- GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
- GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
- GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
- GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
- GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
-
- /* Round 3 */
- HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
- HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
- HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
- HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
- HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
- HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
- HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
- HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
- HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
- HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
- HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
- HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
- HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
- HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
- HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
- HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
-
- /* Round 4 */
- II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
- II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
- II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
- II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
- II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
- II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
- II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
- II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
- II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
- II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
- II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
- II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
- II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
- II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
- II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
- II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
-
- state[0] += a;
- state[1] += b;
- state[2] += c;
- state[3] += d;
-
- /* Zeroize sensitive information.
-*/
- MD5_memset ((POINTER)x, 0, sizeof (x));
-}
-
-/* Encodes input (UINT4) into output (unsigned char). Assumes len is
- a multiple of 4.
- */
-static void Encode (output, input, len)
-unsigned char *output;
-UINT4 *input;
-unsigned int len;
-{
- unsigned int i, j;
-
- for (i = 0, j = 0; j < len; i++, j += 4) {
- output[j] = (unsigned char)(input[i] & 0xff);
- output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
- output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
- output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
- }
-}
-
-/* Decodes input (unsigned char) into output (UINT4). Assumes len is
- a multiple of 4.
- */
-static void Decode (output, input, len)
-UINT4 *output;
-unsigned char *input;
-unsigned int len;
-{
- unsigned int i, j;
-
- for (i = 0, j = 0; j < len; i++, j += 4)
- output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
- (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
-}
-
-/* Note: Replace "for loop" with standard memcpy if possible.
- */
-
-static void MD5_memcpy (output, input, len)
-POINTER output;
-POINTER input;
-unsigned int len;
-{
- unsigned int i;
-
- for (i = 0; i < len; i++)
- output[i] = input[i];
-}
-
-/* Note: Replace "for loop" with standard memset if possible.
- */
-static void MD5_memset (output, value, len)
-POINTER output;
-int value;
-unsigned int len;
-{
- unsigned int i;
-
- for (i = 0; i < len; i++)
- ((char *)output)[i] = (char)value;
-}
diff --git a/ext/md5/md5init.c b/ext/md5/md5init.c
deleted file mode 100644
index 65fd996ca9..0000000000
--- a/ext/md5/md5init.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/************************************************
-
- md5init.c -
-
- $Author$
- created at: Fri Aug 2 09:24:12 JST 1996
-
- Copyright (C) 1995-1998 Yukihiro Matsumoto
-
-************************************************/
-/* This module provides an interface to the RSA Data Security,
- Inc. MD5 Message-Digest Algorithm, described in RFC 1321.
- It requires the files md5c.c and md5.h (which are slightly changed
- from the versions in the RFC to avoid the "global.h" file.) */
-
-#include "ruby.h"
-#include "md5.h"
-
-static VALUE cMD5;
-
-static VALUE
-md5_update(obj, str)
- VALUE obj;
- struct RString *str;
-{
- MD5_CTX *md5;
-
- Check_Type(str, T_STRING);
- Data_Get_Struct(obj, MD5_CTX, md5);
- MD5Update(md5, str->ptr, str->len);
-
- return Qnil;
-}
-static VALUE
-md5_digest(obj)
- VALUE obj;
-{
- MD5_CTX *md5, ctx;
- unsigned char digest[16];
-
- Data_Get_Struct(obj, MD5_CTX, md5);
- ctx = *md5;
- MD5Final(digest, &ctx);
-
- return str_new(digest, 16);
-}
-
-static VALUE
-md5_clone(obj)
- VALUE obj;
-{
- VALUE clone;
- MD5_CTX *md5, *md5_new;
-
- Data_Get_Struct(obj, MD5_CTX, md5);
- obj = Data_Make_Struct(CLASS_OF(obj), MD5_CTX, 0, 0, md5_new);
- *md5_new = *md5;
-
- return obj;
-}
-
-static VALUE
-md5_new(argc, argv, class)
- int argc;
- VALUE* argv;
- VALUE class;
-{
- int i;
- VALUE arg, obj;
- MD5_CTX *md5;
-
- rb_scan_args(argc, argv, "01", &arg);
- if (!NIL_P(arg)) Check_Type(arg, T_STRING);
-
- obj = Data_Make_Struct(class, MD5_CTX, 0, 0, md5);
- MD5Init(md5);
- if (!NIL_P(arg)) {
- md5_update(obj, arg);
- }
- obj_call_init(obj);
-
- return obj;
-}
-
-Init_md5()
-{
- cMD5 = rb_define_class("MD5", cObject);
-
- rb_define_singleton_method(cMD5, "new", md5_new, -1);
-
- rb_define_method(cMD5, "update", md5_update, 1);
- rb_define_method(cMD5, "digest", md5_digest, 0);
- rb_define_method(cMD5, "clone", md5_clone, 0);
-}
diff --git a/ext/nkf/.cvsignore b/ext/nkf/.cvsignore
new file mode 100644
index 0000000000..4088712231
--- /dev/null
+++ b/ext/nkf/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+mkmf.log
+*.def
diff --git a/ext/nkf/depend b/ext/nkf/depend
new file mode 100644
index 0000000000..0ed8fea8d2
--- /dev/null
+++ b/ext/nkf/depend
@@ -0,0 +1 @@
+nkf.o : nkf.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h $(srcdir)/nkf-utf8/nkf.c $(srcdir)/nkf-utf8/utf8tbl.c $(srcdir)/nkf-utf8/config.h
diff --git a/ext/nkf/extconf.rb b/ext/nkf/extconf.rb
new file mode 100644
index 0000000000..710662f19c
--- /dev/null
+++ b/ext/nkf/extconf.rb
@@ -0,0 +1,2 @@
+require 'mkmf'
+create_makefile('nkf')
diff --git a/ext/nkf/lib/kconv.rb b/ext/nkf/lib/kconv.rb
new file mode 100644
index 0000000000..1fd28a5a59
--- /dev/null
+++ b/ext/nkf/lib/kconv.rb
@@ -0,0 +1,226 @@
+require 'nkf'
+
+module Kconv
+ #Constant of Encoding
+ AUTO = ::NKF::AUTO
+ JIS = ::NKF::JIS
+ EUC = ::NKF::EUC
+ SJIS = ::NKF::SJIS
+ BINARY = ::NKF::BINARY
+ NOCONV = ::NKF::NOCONV
+ ASCII = ::NKF::ASCII
+ UTF8 = ::NKF::UTF8
+ UTF16 = ::NKF::UTF16
+ UTF32 = ::NKF::UTF32
+ UNKNOWN = ::NKF::UNKNOWN
+
+ #Regexp of Encoding
+ Iconv_Shift_JIS = /\A(?:
+ [\x00-\x7f\xa1-\xdf] |
+ \x81[\x40-\x7e\x80-\xac\xb8-\xbf\xc8-\xce\xda-\xe8\xf0-\xf7\xfc] |
+ \x82[\x4f-\x58\x60-\x79\x81-\x9a\x9f-\xf1] |
+ \x83[\x40-\x7e\x80-\x96\x9f-\xb6\xbf-\xd6\x40-\x60] |
+ \x84[\x40-\x60\x70-\x7e\x80-\x91\x9f-\xbe\x9f-\xfc] |
+ [\x89-\x8f\x90-\x97\x99-\x9f\xe0-\xea][\x40-\x7e] |
+ [\x89-\x97\x99-\x9f\xe0-\xe9][\x80-\xfc] |
+ \x98[\x40-\x72\x9f-\xfc] |
+ \xea[\x80-\xa4]
+ )*\z/nx
+ Iconv_EUC_JP = /\A(?:
+ [\x00-\x7f] |
+ \x8e [\xa1-\xdf] |
+ \x8f [\xa1-\xdf] [\xa1-\xdf] |
+ [\xa1\xb0-\xbce\xd0-\xf3][\xa1-\xfe] |
+ \xa2[\xa1-\xae\xba-\xc1\xca-\xd0\xdc-\xea\xf2-\xf9\xfe] |
+ \xa3[\xb0-\xb9\xc1-\xda\xe1-\xfa] |
+ \xa4[\xa1-\xf3] |
+ \xa5[\xa1-\xf6] |
+ \xa6[\xa1-\xb8\xc1-\xd8] |
+ \xa7[\xa1-\xc1\xd1-\xf1] |
+ \xa8[\xa1-\xc0] |
+ \xcf[\xa1-\xd3] |
+ \xf4[\xa1-\xa6]
+ )*\z/nx
+ Iconv_UTF8 = /\A(?:\xef\xbb\xbf)?(?:
+ [\x00-\x7f] |
+ \xc2[\x80-\x8d\x90-\x9f\xa1\xaa\xac\xae-\xb1\xb4\xb6\xb8\xba\xbf] |
+ \xc3[\x80-\xbf] |
+ \xc4[\x80-\x93\x96-\xa2\xa4-\xab\xae-\xbf] |
+ \xc5[\x80-\x8d\x90-\xbe] |
+ \xc7[\x8d-\x9c\xb5] |
+ \xcb[\x87\x98-\x9b\x9d] |
+ \xce[\x84-\x86\x88-\x8a\x8c\x8e-\xa1\xa3-\xbf] |
+ \xcf[\x80-\x8e] |
+ \xd0[\x81-\x8c\x8e-\xbf] |
+ \xd1[\x80-\x8f\x91-\x9f] |
+ \xe2\x84[\x83\x96\xa2\xab] |
+ \xe2\x86[\x83\x91-\x93\x96\xa2\xab] |
+ \xe2\x87[\x83\x91-\x94\x96\xa2\xab] |
+ \xe2\x88[\x82-\x83\x87-\x88\x8b\x91-\x94\x96\x9a\x9d-\x9e\xa0\xa2\xa7-\xac\xb4-\xb5\xbd] |
+ \xe2\x89[\x82-\x83\x87-\x88\x8b\x91-\x94\x96\x9a\x9d-\x9e\xa0-\xa2\xa6-\xac\xb4-\xb5\xbd] |
+ \xe2[\x8a\x8c][\x82-\x83\x86-\x88\x8b\x91-\x94\x96\x9a\x9d-\x9e\xa0-\xa2\xa5-\xac\xb4-\xb5\xbd] |
+ \xe2[\x94-\x99][\x81-\x83\x86-\x88\x8b-\x8c\x8f-\x94\x96-\x98\x9a-\x9e\xa0-\xac\xaf-\xb0\xb3-\xb5\xb7-\xb8\xbb-\xbd\xbf] |
+ \xe3\x80[\x81-\x83\x85-\x98\x9a-\x9e\xa0-\xad\xaf-\xb0\xb2-\xb5\xb7-\xb8\xbb-\xbd\xbf] |
+ \xe3[\x81-\x83\xb8-\xbf][\x81-\xbf] |
+ [\xe5-\xe7][\x80-\xbf][\x81-\xbf] |
+ \xe8[\x80-\xae\xb0-\xbf][\x81-\xbf] |
+ \xe9[\x80-\x92\x95-\xb1\xb3-\xbe][\x81-\xbf] |
+ \xef[\xbc-\xbe][\x81-\xbf] |
+ )*\z/nx
+ RegexpShiftjis = /\A(?:
+ [\x00-\x7f\xa1-\xdf] |
+ [\x81-\x9f\xe0-\xfc][\x40-\x7e\x80-\xfc]
+ )*\z/nx
+ RegexpEucjp = /\A(?:
+ [\x00-\x7f] |
+ \x8e [\xa1-\xdf] |
+ \x8f [\xa1-\xdf] [\xa1-\xdf] |
+ [\xa1-\xdf] [\xa1-\xdf]
+ )*\z/nx
+ RegexpUtf8 = /\A(?:
+ [\x00-\x7f] |
+ [\xc2-\xdf] [\x80-\xbf] |
+ \xe0 [\xa0-\xbf] [\x80-\xbf] |
+ [\xe1-\xef] [\x80-\xbf] [\x80-\xbf] |
+ \xf0 [\x90-\xbf] [\x80-\xbf] [\x80-\xbf] |
+ [\xf1-\xf3] [\x80-\xbf] [\x80-\xbf] [\x80-\xbf] |
+ \xf4 [\x80-\x8f] [\x80-\xbf] [\x80-\xbf]
+ )*\z/nx
+
+ #
+ # kconv
+ #
+
+ def kconv(str, out_code, in_code = AUTO)
+ opt = '-'
+ case in_code
+ when ::NKF::JIS
+ opt << 'J'
+ when ::NKF::EUC
+ opt << 'E'
+ when ::NKF::SJIS
+ opt << 'S'
+ when ::NKF::UTF8
+ when ::NKF::UTF16
+ opt << 'W'
+ end
+
+ case out_code
+ when ::NKF::JIS
+ opt << 'j'
+ when ::NKF::EUC
+ opt << 'e'
+ when ::NKF::SJIS
+ opt << 's'
+ when ::NKF::UTF8
+ when ::NKF::UTF16
+ opt << 'w'
+ when ::NKF::NOCONV
+ return str
+ end
+
+ opt = '' if opt == '-'
+
+ ::NKF::nkf(opt, str)
+ end
+ module_function :kconv
+
+ #
+ # Encode to
+ #
+
+ def tojis(str)
+ ::NKF::nkf('-j', str)
+ end
+ module_function :tojis
+
+ def toeuc(str)
+ ::NKF::nkf('-e', str)
+ end
+ module_function :toeuc
+
+ def tosjis(str)
+ ::NKF::nkf('-s', str)
+ end
+ module_function :tosjis
+
+ def toutf8(str)
+ ::NKF::nkf('-w', str)
+ end
+ module_function :toutf8
+
+ def toutf16(str)
+ ::NKF::nkf('-w16', str)
+ end
+ module_function :toutf16
+
+ #
+ # guess
+ #
+
+ def guess(str)
+ ::NKF::guess(str)
+ end
+ module_function :guess
+
+ def guess_old(str)
+ ::NKF::guess_old(str)
+ end
+ module_function :guess_old
+
+ #
+ # isEncoding
+ #
+
+ def iseuc(str)
+ RegexpEucjp.match( str )
+ end
+ module_function :iseuc
+
+ def issjis(str)
+ RegexpShiftjis.match( str )
+ end
+ module_function :issjis
+
+ def isutf8(str)
+ RegexpUtf8.match( str )
+ end
+ module_function :isutf8
+
+end
+
+class String
+ def kconv(out_code, in_code=Kconv::AUTO)
+ Kconv::kconv(self, out_code, in_code)
+ end
+
+ # to Encoding
+ def tojis
+ ::NKF::nkf('-j', self)
+ end
+ def toeuc
+ ::NKF::nkf('-e', self)
+ end
+ def tosjis
+ ::NKF::nkf('-s', self)
+ end
+ def toutf8
+ ::NKF::nkf('-w', self)
+ end
+ def toutf16
+ ::NKF::nkf('-w16', self)
+ end
+
+ # is Encoding
+ def iseuc
+ Kconv.iseuc( self )
+ end
+
+ def issjis
+ Kconv.issjis( self )
+ end
+
+ def isutf8
+ Kconv.isutf8( self )
+ end
+end
diff --git a/ext/nkf/nkf-utf8/config.h b/ext/nkf/nkf-utf8/config.h
new file mode 100644
index 0000000000..0f202baafd
--- /dev/null
+++ b/ext/nkf/nkf-utf8/config.h
@@ -0,0 +1,52 @@
+#ifndef _CONFIG_H_
+#define _CONFIG_H_
+
+/* UTF8 入出力 */
+#define UTF8_INPUT_ENABLE
+#define UTF8_OUTPUT_ENABLE
+
+/* Shift_JIS 範囲外の文字を、CP932 で同値な文字に読み換える */
+#define SHIFTJIS_CP932
+
+/* オプションで入力を指定した時に、文字コ・踉札匹鮓把蠅垢蝟昭粡竚癈鷭п粐Ь粤肅鈬緑孕瀉歪冬読惻蝟昭粡竚癈鷭п粐Ь蝟昭粡竚癈鷭п粐Ь阮纈蜚オプション */
+/* by Satoru Takabayashi <ccsatoru@vega.aichi-u.ac.jp> */
+#define OVERWRITE
+
+/* --cap-input, --url-input オプション */
+#define INPUT_OPTION
+
+/* --numchar-input オプション */
+#define NUMCHAR_OPTION
+
+/* --debug, --no-output オプション */
+#define CHECK_OPTION
+
+/* --exec-in, --exec-out オプション
+ * pipe, fork, execvp あたりが無いと動きません。
+ * MS-DOS, MinGW などでは undef にしてください
+ * child process 終了時の処理がいいかげんなので、
+ * デフォルトで無効にしています。
+ */
+/* #define EXEC_IO */
+
+/* SunOS の cc を使う瘢雹ときは undef にしてください */
+#define ANSI_C_PROTOTYPE
+
+/* int が 32bit 未満の環境で NUMCHAR_OPTION を使う瘢雹には、
+ * コメントを外してください。
+ */
+/* #define INT_IS_SHORT */
+
+/******************************/
+/* デフォルトの出力コ・踉札描蝟昭粡竚癈鷭п粐Ь嚆跂笏兎奏猛瀉歪鹿粡寂蝟赱齠洲痲筵娼d繙蜴津徳嫐壥地津瀛瓶鹿粡寂蝟赱齠洲痲筵娼粤肅鈬兎奏猛瀉歪冬喨瓶蝟昭粡竚癈鷭п粐Ьd繙蜴津徳嫐壥地津濺嫦蝟昭粡竚癈鷭п粐Ьd繙蜴津徳嫐壥地津炙堝鹿粡寂蝟赱齠洲痲筵娼鹿粡寂蝟赱齠洲痲筵娼鹿粡寂蝟赱齠洲痲筵娼e鈔蜀瀉藁読梅庇蝟昭粡竚癈鷭ц縺筵鞘蜀芍甎纔鉉罸鉉罩羝諞諞諞遣鉉罧禺碣鈬肅跂閼碓斡幹錫鬲冗鈔纔旭旭旭旭握畄禊宜盡骸碣纐貅碣皴釈鱚羹Н鴣磔蜚鱚絲纔鉉罸鉉罩羝諞粋叙円互貨頏纐蜈逅脂篏娯姥箘鴻鍵妓甬禊盞遺贋粐圧盍竇經験甦厩瘋Ь纔鉉罸鉉罩羝諞鹿畩鹿粡寂蝟赱齠洲蔘鉉Ь誓穐斡誓鹿粡寂蝟赱齠洲痲筵娼励闥磨鉅鍋踉纈柘纈皷闔蝟昭粡竚癈鷭п粐Ь蝟昭粡竚癈鷭п粐Ь衷顆鱸艾厩厳弐裼猛町部癇秒班冒彖蝟昭粡竚癈鷭п粐Ь連絡先: (株)富士通研瘢雹究所 ソフト3研瘢雹 市川 至
+** (E-Mail Address: ichikawa@flab.fujitsu.co.jp)
+** Copyright (C) 1996,1998
+** Copyright (C) 2002
+** 連絡先: 琉球大学霾鷙慍ぢ河野 真迚辣芦宛竟鶯鹿粡寂蝟赱齠洲痲筵娼ぢ(E-Mail Address: kono@ie.u-ryukyu.ac.jp)
+** 連絡先: COW for DOS & Win16 & Win32 & OS/2
+** (E-Mail Address: GHG00637@niftyserve.or.p)
+**
+** このソ・踉札垢里い覆詈踉嗣,改変,修正も許諾します。ただし、
+** その際には、誰が貢献したを┐垢海良鮖弔垢海函鹿粡寂蝟赱齠洲痲筵娼再配布や雑誌の付録などの問い合わせも必要ありません。
+** 営利利用も綉鉾燭靴覆と楼呂乃弔靴泙后鹿粡寂蝟赱齠洲痲筵娼バイナリの配布の際にはversion messageを保存することを魴錣箸靴泙后鹿粡寂蝟赱齠洲痲筵娼このプログラムについては特に何の保擇發靴覆ぁ靴蕕此鹿粡寂蝟赱齠洲痲筵娼鹿粡寂蝟赱齠洲痲筵娼当纈鈬鞳鴉蜚瘤蓍鈑蜩鳫苒瘢蝟昭粡竚癈鷭п粐Ь釿跿粡鈑關鈑迴粡胱蜴膃逅鳫鈑蝟昭粡竚癈鷭п粐Ь跫鈑粹逾鱚鈔葹阡蜚蝟昭粡竚癈鷭п粐Ь蒹硼關蜃蔗阡蜒葹韶縺蜴跛關蜈鶤鹿粡寂蝟赱齠洲痲筵娼醍釶鴒蜩蛯蜿鱚髟蜥纉鱸芍釶鴦蜿辣齠瘍纉蝟昭粡竚癈鷭п粐Ь阨闔癘鼡繙闥竢顆蜴膃繖蜩蛯蜿闥跚鼈蜴膊鹿粡寂蝟赱齠洲痲筵娼堡奏堡碗瓶談蘇羊面倉卅淋錨徂堡吐倉塹班嗜瀞彖凖蝟昭粡竚癈鷭п粐Ь蝟昭粡竚癈鷭п粐Ь蝟昭粡竚癈鷭п粐Ь蝟昭粡竚癈鷭п粐Ь孕騰サポ・踉札箸砲弔い鹿粡寂蝟赱齠洲痲筵娼拾苳四茲諞ぢと入れかえてそのまま使えるよう瘢雹になっています
+** nkf -e などとして起動すると、鞍淑未堝ぢと判定されれば、
+** そのまま euc-jp に変換されます
+**
+** まだバグがある可能性が高いです。
+** (特に鞍淑漫▲魁ド混在、エラ・踉蚕萢蝟昭粡竚癈鷭п粐Ь蝟昭粡竚癈鷭п粐Ьぢ何か問題を見つけたら、
+** E-Mail: furukawa@tcp-ip.or.jp
+** まで御連絡をお願いします。
+***********************************************************************/
+#include "config.h"
+
+static char *CopyRight =
+ "Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa),2000 S. Kono, COW, 2002-2004 Kono, Furukawa";
+static char *Version =
+ "2.0";
+static char *Patchlevel =
+ "4/0401/Shinji Kono";
+
+/*
+**
+**
+**
+** USAGE: nkf [flags] [file]
+**
+** Flags:
+** b Output is buffered (DEFAULT)
+** u Output is unbuffered
+**
+** t no operation
+**
+** j Outout code is JIS 7 bit (DEFAULT SELECT)
+** s Output code is MS Kanji (DEFAULT SELECT)
+** e Output code is AT&T JIS (DEFAULT SELECT)
+** w Output code is AT&T JIS (DEFAULT SELECT)
+** l Output code is JIS 7bit and ISO8859-1 Latin-1
+**
+** m MIME conversion for ISO-2022-JP
+** I Convert non ISO-2022-JP charactor to GETA by Pekoe <pekoe@lair.net>
+** i_ Output sequence to designate JIS-kanji (DEFAULT_J)
+** o_ Output sequence to designate single-byte roman characters (DEFAULT_R)
+** M MIME output conversion
+**
+** r {de/en}crypt ROT13/47
+**
+** v display Version
+**
+** T Text mode output (for MS-DOS)
+**
+** x Do not convert X0201 kana into X0208
+** Z Convert X0208 alphabet to ASCII
+**
+** f60 fold option
+**
+** m MIME decode
+** B try to fix broken JIS, missing Escape
+** B[1-9] broken level
+**
+** O Output to 'nkf.out' file or last file name
+** d Delete \r in line feed
+** c Add \r in line feed
+** -- other long option
+** -- ignore following option (don't use with -O )
+**
+**/
+
+#if (defined(__TURBOC__) || defined(_MSC_VER) || defined(LSI_C) || defined(__MINGW32__)) && !defined(MSDOS)
+#define MSDOS
+#if (defined(__Win32__) || defined(_WIN32)) && !defined(__WIN32__)
+#define __WIN32__
+#endif
+#endif
+
+#ifdef PERL_XS
+#undef OVERWRITE
+#endif
+
+#ifndef PERL_XS
+#include <stdio.h>
+#endif
+
+#if defined(MSDOS) || defined(__OS2__)
+#include <fcntl.h>
+#include <io.h>
+#endif
+
+#ifdef MSDOS
+#ifdef LSI_C
+#define setbinmode(fp) fsetbin(fp)
+#else /* Microsoft C, Turbo C */
+#define setbinmode(fp) setmode(fileno(fp), O_BINARY)
+#endif
+#else /* UNIX,OS/2 */
+#define setbinmode(fp)
+#endif
+
+#ifdef _IOFBF /* SysV and MSDOS, Windows */
+#define setvbuffer(fp, buf, size) setvbuf(fp, buf, _IOFBF, size)
+#else /* BSD */
+#define setvbuffer(fp, buf, size) setbuffer(fp, buf, size)
+#endif
+
+/*Borland C++ 4.5 EasyWin*/
+#if defined(__TURBOC__) && defined(_Windows) && !defined(__WIN32__) /*Easy Win */
+#define EASYWIN
+#ifndef __WIN16__
+#define __WIN16__
+#endif
+#include <windows.h>
+#endif
+
+#ifdef OVERWRITE
+/* added by satoru@isoternet.org */
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#ifndef MSDOS /* UNIX, OS/2 */
+#include <unistd.h>
+#include <utime.h>
+#else
+#if defined(_MSC_VER) || defined(__MINGW32__) /* VC++, MinGW */
+#include <sys/utime.h>
+#elif defined(__TURBOC__) /* BCC */
+#include <utime.h>
+#elif defined(LSI_C) /* LSI C */
+#endif
+#endif
+#endif
+
+#ifdef INT_IS_SHORT
+#define int long
+#endif
+
+#define FALSE 0
+#define TRUE 1
+
+/* state of output_mode and input_mode
+
+ c2 0 means ASCII
+ X0201
+ ISO8859_1
+ X0208
+ EOF all termination
+ c1 32bit data
+
+ */
+
+#define ASCII 0
+#define X0208 1
+#define X0201 2
+#define ISO8859_1 8
+#define NO_X0201 3
+
+/* Input Assumption */
+
+#define JIS_INPUT 4
+#define SJIS_INPUT 5
+#define LATIN1_INPUT 6
+#define FIXED_MIME 7
+#define STRICT_MIME 8
+
+/* MIME ENCODE */
+
+#define ISO2022JP 9
+#define JAPANESE_EUC 10
+#define SHIFT_JIS 11
+
+#define UTF8 12
+#define UTF8_INPUT 13
+#define UTF16_INPUT 14
+#define UTF16BE_INPUT 15
+
+#define WISH_TRUE 15
+
+/* ASCII CODE */
+
+#define BS 0x08
+#define NL 0x0a
+#define CR 0x0d
+#define ESC 0x1b
+#define SPACE 0x20
+#define AT 0x40
+#define SSP 0xa0
+#define DEL 0x7f
+#define SI 0x0f
+#define SO 0x0e
+#define SSO 0x8e
+
+#define is_alnum(c) \
+ (('a'<=c && c<='z')||('A'<= c && c<='Z')||('0'<=c && c<='9'))
+
+#define HOLD_SIZE 1024
+#define IOBUF_SIZE 16384
+
+#define DEFAULT_J 'B'
+#define DEFAULT_R 'B'
+
+#define SJ0162 0x00e1 /* 01 - 62 ku offset */
+#define SJ6394 0x0161 /* 63 - 94 ku offset */
+
+#define RANGE_NUM_MAX 18
+#define GETA1 0x22
+#define GETA2 0x2e
+
+
+#if defined( UTF8_OUTPUT_ENABLE ) || defined( UTF8_INPUT_ENABLE )
+#define sizeof_euc_utf8 94
+#define sizeof_euc_to_utf8_1byte 94
+#define sizeof_euc_to_utf8_2bytes 94
+#define sizeof_utf8_to_euc_C2 64
+#define sizeof_utf8_to_euc_E5B8 64
+#define sizeof_utf8_to_euc_2bytes 112
+#define sizeof_utf8_to_euc_3bytes 112
+#endif
+
+/* MIME preprocessor */
+
+
+#ifdef EASYWIN /*Easy Win */
+extern POINT _BufferSize;
+#endif
+
+/* function prototype */
+
+#ifdef ANSI_C_PROTOTYPE
+#define PROTO(x) x
+#define STATIC static
+#else
+#define PROTO(x) ()
+#define STATIC
+#endif
+
+struct input_code{
+ char *name;
+ int stat;
+ int score;
+ int index;
+ int buf[3];
+ void (*status_func)PROTO((struct input_code *, int));
+ int (*iconv_func)PROTO((int c2, int c1, int c0));
+ int _file_stat;
+};
+
+STATIC char *input_codename = "";
+
+STATIC int noconvert PROTO((FILE *f));
+STATIC int kanji_convert PROTO((FILE *f));
+STATIC int h_conv PROTO((FILE *f,int c2,int c1));
+STATIC int push_hold_buf PROTO((int c2));
+STATIC void set_iconv PROTO((int f, int (*iconv_func)()));
+STATIC int s_iconv PROTO((int c2,int c1,int c0));
+STATIC int s2e_conv PROTO((int c2, int c1, int *p2, int *p1));
+STATIC int e_iconv PROTO((int c2,int c1,int c0));
+#ifdef UTF8_INPUT_ENABLE
+STATIC int w2e_conv PROTO((int c2,int c1,int c0,int *p2,int *p1));
+STATIC int w_iconv PROTO((int c2,int c1,int c0));
+STATIC int w_iconv16 PROTO((int c2,int c1,int c0));
+STATIC int w_iconv_common PROTO((int c1,int c0,unsigned short **pp,int psize,int *p2,int *p1));
+STATIC int ww16_conv PROTO((int c2, int c1, int c0));
+#endif
+#ifdef UTF8_OUTPUT_ENABLE
+STATIC int e2w_conv PROTO((int c2,int c1));
+STATIC void w_oconv PROTO((int c2,int c1));
+STATIC void w_oconv16 PROTO((int c2,int c1));
+#endif
+STATIC void e_oconv PROTO((int c2,int c1));
+STATIC void e2s_conv PROTO((int c2, int c1, int *p2, int *p1));
+STATIC void s_oconv PROTO((int c2,int c1));
+STATIC void j_oconv PROTO((int c2,int c1));
+STATIC void fold_conv PROTO((int c2,int c1));
+STATIC void cr_conv PROTO((int c2,int c1));
+STATIC void z_conv PROTO((int c2,int c1));
+STATIC void rot_conv PROTO((int c2,int c1));
+STATIC void hira_conv PROTO((int c2,int c1));
+STATIC void base64_conv PROTO((int c2,int c1));
+STATIC void iso2022jp_check_conv PROTO((int c2,int c1));
+STATIC void no_connection PROTO((int c2,int c1));
+STATIC int no_connection2 PROTO((int c2,int c1,int c0));
+
+STATIC void code_score PROTO((struct input_code *ptr));
+STATIC void code_status PROTO((int c));
+
+STATIC void std_putc PROTO((int c));
+STATIC int std_getc PROTO((FILE *f));
+STATIC int std_ungetc PROTO((int c,FILE *f));
+
+STATIC int broken_getc PROTO((FILE *f));
+STATIC int broken_ungetc PROTO((int c,FILE *f));
+
+STATIC int mime_begin PROTO((FILE *f));
+STATIC int mime_getc PROTO((FILE *f));
+STATIC int mime_ungetc PROTO((int c,FILE *f));
+
+STATIC int mime_begin_strict PROTO((FILE *f));
+STATIC int mime_getc_buf PROTO((FILE *f));
+STATIC int mime_ungetc_buf PROTO((int c,FILE *f));
+STATIC int mime_integrity PROTO((FILE *f,unsigned char *p));
+
+STATIC int base64decode PROTO((int c));
+STATIC void mime_putc PROTO((int c));
+STATIC void open_mime PROTO((int c));
+STATIC void close_mime PROTO(());
+STATIC void usage PROTO(());
+STATIC void version PROTO(());
+STATIC void options PROTO((unsigned char *c));
+#ifdef PERL_XS
+STATIC void reinit PROTO(());
+#endif
+
+/* buffers */
+
+static unsigned char stdibuf[IOBUF_SIZE];
+static unsigned char stdobuf[IOBUF_SIZE];
+static unsigned char hold_buf[HOLD_SIZE*2];
+static int hold_count;
+
+/* MIME preprocessor fifo */
+
+#define MIME_BUF_SIZE (1024) /* 2^n ring buffer */
+#define MIME_BUF_MASK (MIME_BUF_SIZE-1)
+#define Fifo(n) mime_buf[(n)&MIME_BUF_MASK]
+static unsigned char mime_buf[MIME_BUF_SIZE];
+static unsigned int mime_top = 0;
+static unsigned int mime_last = 0; /* decoded */
+static unsigned int mime_input = 0; /* undecoded */
+
+/* flags */
+static int unbuf_f = FALSE;
+static int estab_f = FALSE;
+static int nop_f = FALSE;
+static int binmode_f = TRUE; /* binary mode */
+static int rot_f = FALSE; /* rot14/43 mode */
+static int hira_f = FALSE; /* hira/kata henkan */
+static int input_f = FALSE; /* non fixed input code */
+static int alpha_f = FALSE; /* convert JIx0208 alphbet to ASCII */
+static int mime_f = STRICT_MIME; /* convert MIME B base64 or Q */
+static int mimebuf_f = FALSE; /* MIME buffered input */
+static int broken_f = FALSE; /* convert ESC-less broken JIS */
+static int iso8859_f = FALSE; /* ISO8859 through */
+static int mimeout_f = FALSE; /* base64 mode */
+#if defined(MSDOS) || defined(__OS2__)
+static int x0201_f = TRUE; /* Assume JISX0201 kana */
+#else
+static int x0201_f = NO_X0201; /* Assume NO JISX0201 */
+#endif
+static int iso2022jp_f = FALSE; /* convert ISO-2022-JP */
+#ifdef UTF8_OUTPUT_ENABLE
+static int w_oconv16_begin_f= 0; /* utf-16 header */
+static int w_oconv16_LE = 0; /* utf-16 little endian */
+#endif
+
+
+#ifdef NUMCHAR_OPTION
+
+#define CLASS_MASK 0x0f000000
+#define CLASS_UTF16 0x01000000
+#endif
+
+#ifdef INPUT_OPTION
+static int cap_f = FALSE;
+static int (*i_cgetc)PROTO((FILE *)) = std_getc; /* input of cgetc */
+static int (*i_cungetc)PROTO((int c ,FILE *f)) = std_ungetc;
+STATIC int cap_getc PROTO((FILE *f));
+STATIC int cap_ungetc PROTO((int c,FILE *f));
+
+static int url_f = FALSE;
+static int (*i_ugetc)PROTO((FILE *)) = std_getc; /* input of ugetc */
+static int (*i_uungetc)PROTO((int c ,FILE *f)) = std_ungetc;
+STATIC int url_getc PROTO((FILE *f));
+STATIC int url_ungetc PROTO((int c,FILE *f));
+
+static int numchar_f = FALSE;
+static int (*i_ngetc)PROTO((FILE *)) = std_getc; /* input of ugetc */
+static int (*i_nungetc)PROTO((int c ,FILE *f)) = std_ungetc;
+STATIC int numchar_getc PROTO((FILE *f));
+STATIC int numchar_ungetc PROTO((int c,FILE *f));
+#endif
+
+#ifdef CHECK_OPTION
+static int noout_f = FALSE;
+STATIC void no_putc PROTO((int c));
+static int debug_f = FALSE;
+STATIC void debug PROTO((char *str));
+#endif
+
+static int guess_f = FALSE;
+STATIC void print_guessed_code PROTO((char *filename));
+STATIC void set_input_codename PROTO((char *codename));
+static int is_inputcode_mixed = FALSE;
+static int is_inputcode_set = FALSE;
+
+#ifdef EXEC_IO
+static int exec_f = 0;
+#endif
+
+#ifdef SHIFTJIS_CP932
+STATIC int cp932_f = TRUE;
+#define CP932_TABLE_BEGIN (0xfa)
+#define CP932_TABLE_END (0xfc)
+
+STATIC int cp932inv_f = FALSE;
+#define CP932INV_TABLE_BEGIN (0xed)
+#define CP932INV_TABLE_END (0xee)
+
+#endif /* SHIFTJIS_CP932 */
+
+STATIC unsigned char prefix_table[256];
+
+STATIC void e_status PROTO((struct input_code *, int));
+STATIC void s_status PROTO((struct input_code *, int));
+
+#ifdef UTF8_INPUT_ENABLE
+STATIC void w_status PROTO((struct input_code *, int));
+STATIC void w16_status PROTO((struct input_code *, int));
+static int utf16_mode = UTF16_INPUT;
+#endif
+
+struct input_code input_code_list[] = {
+ {"EUC-JP", 0, 0, 0, {0, 0, 0}, e_status, e_iconv, 0},
+ {"Shift_JIS", 0, 0, 0, {0, 0, 0}, s_status, s_iconv, 0},
+ {"UTF-8", 0, 0, 0, {0, 0, 0}, w_status, w_iconv, 0},
+ {"UTF-16", 0, 0, 0, {0, 0, 0}, w16_status, w_iconv16, 0},
+ {0}
+};
+
+static int mimeout_mode = 0;
+static int base64_count = 0;
+
+/* X0208 -> ASCII converter */
+
+/* fold parameter */
+static int f_line = 0; /* chars in line */
+static int f_prev = 0;
+static int fold_preserve_f = FALSE; /* preserve new lines */
+static int fold_f = FALSE;
+static int fold_len = 0;
+
+/* options */
+static unsigned char kanji_intro = DEFAULT_J,
+ ascii_intro = DEFAULT_R;
+
+/* Folding */
+
+#define FOLD_MARGIN 10
+#define DEFAULT_FOLD 60
+
+static int fold_margin = FOLD_MARGIN;
+
+/* converters */
+
+#ifdef DEFAULT_CODE_JIS
+# define DEFAULT_CONV j_oconv
+#endif
+#ifdef DEFAULT_CODE_SJIS
+# define DEFAULT_CONV s_oconv
+#endif
+#ifdef DEFAULT_CODE_EUC
+# define DEFAULT_CONV e_oconv
+#endif
+#ifdef DEFAULT_CODE_UTF8
+# define DEFAULT_CONV w_oconv
+#endif
+
+/* process default */
+static void (*output_conv)PROTO((int c2,int c1)) = DEFAULT_CONV;
+
+static void (*oconv)PROTO((int c2,int c1)) = no_connection;
+/* s_iconv or oconv */
+static int (*iconv)PROTO((int c2,int c1,int c0)) = no_connection2;
+
+static void (*o_zconv)PROTO((int c2,int c1)) = no_connection;
+static void (*o_fconv)PROTO((int c2,int c1)) = no_connection;
+static void (*o_crconv)PROTO((int c2,int c1)) = no_connection;
+static void (*o_rot_conv)PROTO((int c2,int c1)) = no_connection;
+static void (*o_hira_conv)PROTO((int c2,int c1)) = no_connection;
+static void (*o_base64conv)PROTO((int c2,int c1)) = no_connection;
+static void (*o_iso2022jp_check_conv)PROTO((int c2,int c1)) = no_connection;
+
+/* static redirections */
+
+static void (*o_putc)PROTO((int c)) = std_putc;
+
+static int (*i_getc)PROTO((FILE *f)) = std_getc; /* general input */
+static int (*i_ungetc)PROTO((int c,FILE *f)) =std_ungetc;
+
+static int (*i_bgetc)PROTO((FILE *)) = std_getc; /* input of mgetc */
+static int (*i_bungetc)PROTO((int c ,FILE *f)) = std_ungetc;
+
+static void (*o_mputc)PROTO((int c)) = std_putc ; /* output of mputc */
+
+static int (*i_mgetc)PROTO((FILE *)) = std_getc; /* input of mgetc */
+static int (*i_mungetc)PROTO((int c ,FILE *f)) = std_ungetc;
+
+/* for strict mime */
+static int (*i_mgetc_buf)PROTO((FILE *)) = std_getc; /* input of mgetc_buf */
+static int (*i_mungetc_buf)PROTO((int c,FILE *f)) = std_ungetc;
+
+/* Global states */
+static int output_mode = ASCII, /* output kanji mode */
+ input_mode = ASCII, /* input kanji mode */
+ shift_mode = FALSE; /* TRUE shift out, or X0201 */
+static int mime_decode_mode = FALSE; /* MIME mode B base64, Q hex */
+
+/* X0201 / X0208 conversion tables */
+
+/* X0201 kana conversion table */
+/* 90-9F A0-DF */
+static
+unsigned char cv[]= {
+ 0x21,0x21,0x21,0x23,0x21,0x56,0x21,0x57,
+ 0x21,0x22,0x21,0x26,0x25,0x72,0x25,0x21,
+ 0x25,0x23,0x25,0x25,0x25,0x27,0x25,0x29,
+ 0x25,0x63,0x25,0x65,0x25,0x67,0x25,0x43,
+ 0x21,0x3c,0x25,0x22,0x25,0x24,0x25,0x26,
+ 0x25,0x28,0x25,0x2a,0x25,0x2b,0x25,0x2d,
+ 0x25,0x2f,0x25,0x31,0x25,0x33,0x25,0x35,
+ 0x25,0x37,0x25,0x39,0x25,0x3b,0x25,0x3d,
+ 0x25,0x3f,0x25,0x41,0x25,0x44,0x25,0x46,
+ 0x25,0x48,0x25,0x4a,0x25,0x4b,0x25,0x4c,
+ 0x25,0x4d,0x25,0x4e,0x25,0x4f,0x25,0x52,
+ 0x25,0x55,0x25,0x58,0x25,0x5b,0x25,0x5e,
+ 0x25,0x5f,0x25,0x60,0x25,0x61,0x25,0x62,
+ 0x25,0x64,0x25,0x66,0x25,0x68,0x25,0x69,
+ 0x25,0x6a,0x25,0x6b,0x25,0x6c,0x25,0x6d,
+ 0x25,0x6f,0x25,0x73,0x21,0x2b,0x21,0x2c,
+ 0x00,0x00};
+