diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index 6036a2c8b8..0000000000 --- a/.cvsignore +++ /dev/null @@ -1,53 +0,0 @@ -*.bak -*.orig -*.rej -*.sav -*~ -.ccmalloc -.ppack -COPYING.LIB -ChangeLog.pre-alpha -ChangeLog.pre1_1 -Makefile -README.fat-patch -README.v6 -a.rb -archive -autom4te*.cache -automake -beos -config.cache -config.h -config.h.in -config.log -config.status -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 -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/COPYING b/COPYING deleted file mode 100644 index 870a5f22d6..0000000000 --- a/COPYING +++ /dev/null @@ -1,56 +0,0 @@ -Ruby is copyrighted free software by Yukihiro Matsumoto . -You can redistribute it and/or modify it under either the terms of the GPL -(see the file GPL), 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) give non-standard binaries non-standard names, with - instructions on where to get the original software distribution. - - d) make other distribution arrangements with the author. - - 3. You may distribute the software in object code or binary form, - provided that you do at least ONE of the following: - - 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. - - b) accompany the distribution with the machine-readable source of - the software. - - c) give non-standard binaries 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). But some files in the distribution - are not written by the author, so that they are not under these terms. - - For the list of those files and their copying conditions, see the - file LEGAL. - - 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. - - 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 deleted file mode 100644 index 933cc7cb9a..0000000000 --- a/COPYING.ja +++ /dev/null @@ -1,51 +0,0 @@ -$BK\%W%m%0%i%`$O%U%j!<%=%U%H%&%'%"$G$9!%(BGPL(the GNU General -Public License)$B$^$?$O0J2<$K<($9>r7o$GK\%W%m%0%i%`$r:FG[I[$G(B -$B$-$^$9!%(BGPL$B$K$D$$$F$O(BGPL$B%U%!%$%k$r;2>H$7$F2<$5$$!%(B - - 1. $BJ#@=$O@)8B$J$/<+M3$G$9!%(B - - 2. $B0J2<$N>r7o$N$$$:$l$+$rK~$?$9;~$KK\%W%m%0%i%`$N%=!<%9$r(B - $B<+M3$KJQ99$G$-$^$9!%(B - - (a) $B%M%C%H%K%e!<%:$K%]%9%H$7$?$j!$:nA0$rJQ99$9$k!%(B - $B$=$N%=%U%H%&%'%"$rG[I[$9$k;~$K$OJQ99A0$NK\%W%m%0%i(B - $B%`$bF1;~$KG[I[$9$k!%$^$?$OJQ99A0$NK\%W%m%0%i%`$N%=!<(B - $B%9$NF~$NJQ99>r7o$r:nr7o$N$$$:$l$+$rK~$?$9;~$KK\%W%m%0%i%`$r%3%s%Q%$(B - $B%k$7$?%*%V%8%'%/%H%3!<%I$dA0$rJQ99$7$?$&$(!$%*%j%8%J(B - $B%k$N%=!<%9%3!<%I$NF~$NG[I[>r7o$r:n$N%W%m%0%i%`$X$N0zMQ$O$$$+$J$kL\E*$G$"$l<+M3$G$9!%$?(B - $B$@$7!$K\%W%m%0%i%`$K4^$^$l$kB>$N:n$l$N:nl9g$,$"$j$^$9!%(B - - $B$=$l$i%U%!%$%k$N0lMw$H$=$l$>$l$NG[I[>r7o$J$I$KIU$$$F$O(B - LEGAL$B%U%!%$%k$r;2>H$7$F$/$@$5$$!%(B - - 5. $BK\%W%m%0%i%`$X$NF~NO$H$J$k%9%/%j%W%H$*$h$S!$K\%W%m%0%i(B - $B%`$+$i$N=PNO$N8"Mx$OK\%W%m%0%i%`$N:n(B - $B$l$NF~=PNO$r@8@.$7$??M$KB0$7$^$9!%$^$?!$K\%W%m%0%i%`$K(B - $BAH$_9~$^$l$k$?$a$N3HD%%i%$%V%i%j$K$D$$$F$bF1MM$G$9!%(B - - 6. $BK\%W%m%0%i%`$OL5J]>Z$G$9!%:n - - * irb 0.9 - -Fri Jul 5 08:59:15 2002 Michal Rokos - - * enum.c: Fix bug in enum_sort_by and some code indents - -Fri Jul 5 05:00:40 2002 Wakou Aoyama - - * lib/cgi.rb (CGI#initialize): improvement for mod_ruby. - thanks to Sean Chittenden , Shugo Maeda - - -Thu Jul 4 23:43:26 2002 Minero Aoki - - * parse.y: remove useless function str_extend_p(). - -Wed Jul 3 14:26:40 2002 Sean Chittenden - - * 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 - - * 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 - - * lib/net/ftp.rb: use &block and yield for speed. - -Wed Jul 3 02:32:31 2002 Wakou Aoyama - - * lib/cgi.rb (CGI#initialize): improvement for mod_ruby. - -Tue Jul 2 14:13:11 2002 Wakou Aoyama - - * lib/cgi.rb (CGI#header): accept any type as value. - -Sun Jun 30 17:05:29 2002 WATANABE Hirofumi - - * 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 - - * 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 - - * pack.c (pack_unpack): change names of local variables because their - names are overlapped. - -Fri Jun 28 17:54:07 2002 Tanaka Akira - - * lib/pp.rb: fix object address. - -Thu Jun 27 23:55:50 2002 NAKAMURA Usaku - - * win32/win32.c (rb_w32_stat): fix buffer overflow. (ruby-bugs:PR#329) - -Thu Jun 27 20:57:45 2002 Tanaka Akira - - * lib/prettyprint.rb, lib/pp.rb: convenience methods added. - -Thu Jun 27 15:22:18 2002 Tanaka Akira - - * 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 - - * 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 - - * re.c (rb_reg_expr_str): need to process backslashes properly. - -Wed Jun 26 17:33:38 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * parse.y (string1, xstring, regexp): moved lex_strnest - initialization to string_contents/xstring_contents. - -Tue Jun 25 19:24:38 2002 KONISHI Hiromasa - - * dln.c: remove definition rb_loaderror(). - -Tue Jun 25 00:34:54 2002 Yukihiro Matsumoto - - * 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 - - * dln.c: remark definition rb_loaderror(). - -Tue Jun 25 00:14:07 2002 Nobuyoshi Nakada - - * parse.y (string_dvar): allow back references in interpolation. - -Mon Jun 24 16:32:31 2002 Nobuyoshi Nakada - - * 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/concatinate 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 - - * lib/date.rb, lib/date/format.rb, sample/cal.rb, sample/goodfriday.rb: - updated to the new version (based on date2 3.3). - -Fri Jun 21 18:49:58 2002 Yukihiro Matsumoto - - * parse.y (yylex): __END__ should not be effective within - string literals. - -Thu Jun 20 21:09:37 2002 Nobuyoshi Nakada - - * 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 - - * 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 - - * ext/extmk.rb, lib/mkmf.rb (xsystem): open the log file if xsystem - is called. - -Wed Jun 19 01:01:13 2002 Yukihiro Matsumoto - - * parse.y (here_document): should be aware of __END__ within here - documents. - -Wed Jun 19 00:50:50 2002 Nobuyoshi Nakada - - * parse.y (yylex): ? followed by successive word charaters 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 - - * win32/mkexports.rb: remove unnecessary exports. (ruby-dev:17418) - -Tue Jun 18 12:50:17 2002 Nobuyoshi Nakada - - * 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 - - * string.c (rb_str_crypt): result need not be tainted always. - -Mon Jun 17 10:51:37 2002 Nobuyoshi Nakada - - * 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 - - * parse.y (yylex): obsolete '?'; use '?\s', '?\n', - etc, instead. - -Sat Jun 15 18:51:13 2002 Akinori MUSHA - - * 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 - - * 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 - - * bcc32/mkexports.rb: insert sleep(1) for win9x. - - * bcc32/configure.bat: change return code LF -> CRLF fo win9x. - - * win32/win32.c: fix rb_w32_open_osfhandle() - -Fri Jun 14 15:22:19 2002 Nobuyoshi Nakada - - * 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 - - * bignum.c (rb_big2dbl): return canonical HUGE_VAL for infinity. - -Thu Jun 13 09:43:37 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * parse.y (stmt): fix typo. - -Wed Jun 12 01:10:55 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * lib/net/ftp.rb (noop): new method. - - * lib/net/ftp.rb (site): ditto. - -Tue Jun 11 13:15:41 2002 NAKAMURA Usaku - - * 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 - - * bcc32/configure.bat fix. - -Tue Jun 11 10:18:23 2002 KONISHI Hiromasa - - * 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 - - * 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 - - * 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 - - * ext/dl: change the callback mechanism. - -Sat Jun 8 00:48:38 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * ext/socket/socket.c (ipaddr): need not to taint hostnames. - -Thu Jun 6 12:04:30 2002 NAKAMURA Usaku - - * win32/Makefile.sub (config.status): use sub! instead of []= because - []= causes exception. - -Thu Jun 6 11:42:15 2002 Nobuyoshi Nakada - - * lib/thread.rb (Queue::pop): get rid of race condition. - -Tue Jun 4 23:09:24 2002 Yukihiro Matsumoto - - * 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 - - * ext/socket/extconf.rb: The IPv6 stack of Cygwin is still incomplete. - - * ext/Win32API/extconf.rb: refactoring. - -Tue Jun 4 00:45:50 2002 Nobuyoshi Nakada - - * 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 - - * ext/win32ole/extconf.rb : change PLATFORM with RUBY_PLATFORM. - -Mon Jun 3 07:07:07 2002 Nobuyoshi Nakada - - * 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 - - * 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 - - * ext/win32ole: merge from rough. - -Fri May 31 17:11:42 2002 Yukihiro Matsumoto - - * lib/tempfile.rb (Tempfile::size): added. - -Thu May 30 12:52:42 2002 Yukihiro Matsumoto - - * 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 - - * lib/cgi.rb: if StringIO is usable then use it. - -Wed May 29 18:55:47 2002 KONISHI Hiromasa - - * 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 - - * time.c (tmcmp, search_time_t): activate unless HAVE_TIMEGM. - -Wed May 29 13:45:15 2002 Wakou Aoyama - - * lib/cgi.rb: not use const if GET, HEAD. check multipart form head. - -Tue May 28 17:56:02 2002 Sean Chittenden - - * 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 - - * 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 - - * 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 - - * time.c (time_arg): nil test against v[6] (usec). - -Thu May 23 16:39:21 2002 Nobuyoshi Nakada - - * ruby.c (proc_options): option parsing problem. - (ruby-bugs-ja:PR#233) - -Thu May 23 09:13:56 2002 Yukihiro Matsumoto - - * 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 - - * ruby.c (proc_options): -T consumes digits only. - -Wed May 22 20:18:31 2002 WATANABE Hirofumi - - * configure.in: need not link vsnprintf.o on MinGW. - -Wed May 22 18:34:23 2002 Minero Aoki - - * parse.y (yylex): Here-document label ate '-'. - -Tue May 21 13:25:18 2002 Nobuyoshi Nakada - - * misc/ruby-mode.el (ruby-font-lock-keywords): symbols end with - '_'. - -Tue May 21 04:48:37 2002 Sean Chittenden - - * 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 - - * parse.y (bodystmt): ensure clause was excuted on else clause - without rescue clause. - -Tue May 21 00:20:25 2002 Takaaki Tateishi - - * 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 - - * 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 - - * io.c (rb_io_clone): writing stream was not copied properly. - -Sat May 18 21:38:11 2002 Tadayoshi Funaba - - * 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 - - * win32/Makefile.sub (config.h): add VC++4/5 support about noreturn - directive. - -Sat May 18 02:16:41 2002 Yukihiro Matsumoto - - * pack.c (pack_pack): should propagate taintedness. - - * pack.c (pack_unpack): ditto. - -Fri May 17 16:16:19 2002 WATANABE Hirofumi - - * sampl/test.rb: use eval instead of './miniruby -c', - in order to check a syntax error. - -Thu May 16 14:46:34 2002 Nobuyoshi Nakada - - * eval.c (rb_thread_select): cleanup conditional compilation. - -Wed May 15 06:13:35 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * djgpp/config.hin, djgpp/config.sed: catch up with the latest change. - -Mon May 13 01:59:55 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * ext/dl: enable dl's stack emulation for constructing function call. - -Sat May 11 10:52:09 2002 Nobuyoshi Nakada - - * dir.c (glob_helper): remove escaping backslashes. - -Sat May 11 02:46:43 2002 Yukihiro Matsumoto - - * 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 - - * parse.y (here_document): preserve line number begins here - document. - -Fri May 10 01:55:44 2002 Nobuyoshi Nakada - - * 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 - - * 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 - - * configure.in: forgot to add '-Wl,' to the gcc option on Cygwin/MinGW. - -Tue May 7 15:41:33 2002 Nobuyoshi Nakada - - * ext/iconv/iconv.c (iconv_try): should initialize exceptions - properly. (ruby-bugs-ja:PR#232) - -Tue May 7 15:28:03 2002 Minero Aoki - - * eval.c (rb_yield_0): The destination of the goto jump was wrong. - -Tue May 7 09:17:51 2002 Minero Aoki - - * eval.c (superclass): undesirable "unexpected return" when the - superclass is not a Class. - -Sun May 5 06:53:45 2002 Akinori MUSHA - - * 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 - - * configure.in: add #include in AC_CHECK_DECLS(). - - * win32/config.h.in: define HAVE_DECL_SYS_NERR. - -Thu May 2 23:42:40 2002 Yukihiro Matsumoto - - * re.c (rb_reg_s_quote): # also should be quoted. - -Thu May 2 18:27:13 2002 WATANABE Hirofumi - - * ext/extmk.rb.in, lib/mkmf.rb: use 'do...end' instead of '{}' for - Borland make. - -Thu May 2 08:01:56 2002 Chris Thomas - - * error.c: use HAVE_DECL_SYS_NERR instead of platform names. - -Tue Apr 30 09:23:05 2002 Yukihiro Matsumoto - - * numeric.c (num_step): better iteration condition for float - values; suggested by Masahiro TANAKA . - -Tue Apr 30 05:59:42 2002 Michal Rokos - - * range.c (range_step): step (for Range#step method) <= 0 makes no - sence, 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 - - * file.c (rb_find_file): load must be done from an abolute path if - $SAFE >= 4. - -Sun Apr 28 17:01:56 2002 WATANABE Hirofumi - - * win32/win32.c (insert): fix prototype for ANSI C. - -Fri Apr 26 13:47:15 2002 Yukihiro Matsumoto - - * enum.c (enum_partition): new method. [new] - -Fri Apr 26 13:41:00 2002 Yukihiro Matsumoto - - * re.c (rb_reg_s_quote): quote whitespaces for /x cases. - -Fri Apr 26 06:48:23 2002 Takaaki Tateishi - - * ext/dl/ptr.c (cary2ary): missing break in switch statements. - -Fri Apr 26 09:35:47 2002 Nobuyoshi Nakada - - * 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 - - * 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 - - * configure.in: set size of the initial stack from - 2MB to 32MB on MinGW/Cygwin. - -Wed Apr 24 14:06:35 2002 Yukihiro Matsumoto - - * numeric.c (num_step): try to reduce residual on Float operations. - -Wed Apr 24 06:48:31 2002 Koji Arai - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * win32/Makefile.sub: add -DNT to $CFLAGS instead of $CPPFLAGS. - - * win32/setup.mak: ditto. - -Fri Apr 19 17:24:22 2002 Yukihiro Matsumoto - - * marshal.c (w_object): T_DATA process patch from Joel VanderWerf - . 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 - - * 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 - - * ext/socket/extconf.rb: include , on _WIN32. - - * win32/win32.c: include 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 - - * re.c (rb_reg_to_s): remove redundant shy group. - -Fri Apr 19 01:08:20 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * ext/dl/ptr.c (rb_dlptr_cast): removed. - -Thu Apr 18 17:01:43 2002 Tanaka Akira - - * re.c (rb_reg_to_s): new function for Regexp#to_s. - -Wed Apr 17 23:55:34 2002 Akinori MUSHA - - * 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 - - * re.c (rb_reg_expr_str): should treat backslash specially in - escaping. - -Wed Apr 17 08:16:41 2002 Michal Rokos - - * 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 - - * dir.c: wrap multi-statment macro by do { } while (0) - - * eval.c, numeric,c, sprintf.c, util.c: ditto. - -Tue Apr 16 08:59:50 2002 Nobuyoshi Nakada - - * eval.c (assign): convert mrhs to mvalue. - -Mon Apr 15 18:12:57 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * struct.c (rb_struct_select): fix typo. - -Fri Apr 12 00:34:17 2002 Nobuyoshi Nakada - - * 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 - - * 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 - - * 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 - - * ext/dl/ptr.c: raise() -> rb_raise(). (Thanks Tetsuya Watanabe) - - * ext/dl/sym.c: ditto. - -Thu Apr 11 07:57:48 2002 Michal Rokos - - * 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 - - * ext/dl: Add dl.txt instead of README and README.html. - -Thu Apr 11 01:55:52 2002 Wakou Aoyama - - * lib/cgi/session.rb: support for multipart form. - -Wed Apr 10 18:42:23 2002 Tachino Nobuhiro - - * 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 - - * 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 - - * misc/ruby-mode.el (ruby-font-lock-keywords): fontify symbols for - unary operators and aset. - -Tue Apr 9 13:40:31 2002 Nobuyoshi Nakada - - * 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 - - * 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 - - * re.c (match_select): fix index references and make - MatchData#select actually work. - -Tue Apr 9 00:20:52 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * class.c (rb_singleton_class): wrong condition; was creating - unnecessary singleton class. - -Sat Apr 6 01:09:41 2002 Yukihiro Matsumoto - - * sprintf.c (remove_sign_bits): simplifies the condition. - - * bignum.c (get2comp): calculate proper carry over. - -Fri Apr 5 05:07:28 2002 Takaaki Tateishi - - * ext/dl: Add dl/struct.rb. - -Thu Apr 4 14:08:52 2002 Takaaki Tateishi - - * ext/dl/lib/dl/import.rb: Get rid of ineffective - encoding/decoding procedures. - -Thu Apr 4 01:08:23 2002 Yukihiro Matsumoto - - * numeric.c (int_step): step may be a float less than 1. - -Wed Apr 3 20:42:34 2002 Takaaki Tateishi - - * 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 - - * ext/dl: Add dl/types.rb. - -Wed Apr 3 01:54:10 2002 Nobuyoshi Nakada - - * ext/extmk.rb.in (enable_config): follow lib/mkmf.rb. - -Tue Apr 2 19:59:13 2002 Takaaki Tateishi - - * ext/dl: Merge from rough. - -Tue Apr 2 15:17:54 2002 Yukihiro Matsumoto - - * 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 - - * ext/socket/socket.c (sock_addrinfo): should clear addrinfo hints. - -Mon Apr 1 23:48:12 2002 Takaaki Tateishi - - * lib/mkmf.rb: install any files using $INSTALLFILES. - (see also [ruby-dev:16683]) - -Mon Apr 1 17:25:50 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * re.c (match_setter): it's OK to assign nil to $~. - -Mon Apr 1 03:55:46 2002 Yukihiro Matsumoto - - * 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 - - * lib/mkmf.rb (create_makefile): default FLAGS to empty strings. - -Fri Mar 29 16:36:52 2002 Nobuyoshi Nakada - - * 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 - - * win32/README.win32: follow recent changes. - -Fri Mar 29 14:44:05 2002 Yukihiro Matsumoto - - * io.c (io_fflush): DRY patch from /Christoph applied. - -Thu Mar 28 18:58:13 2002 Usaku Nakamura - - * win32/Makefile.sub (config.status): reflect user defined $CC in - config.status. - -Thu Mar 28 18:03:51 2002 Minero Aoki - - * 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 - - * ext/socket/socket.c (sock_addrinfo): should specify socktype - from outside. - -Wed Mar 27 17:04:30 2002 Yukihiro Matsumoto - - * 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 - - * io.c (READ_DATA_PENDING): configure.in has supported for uClibc, - so remove uClibc stuff. - -Wed Mar 27 13:14:43 2002 Yukihiro Matsumoto - - * io.c (rb_io_sysseek): new method based on a patch from Aristarkh - A Zagorodnikov . [new] - - * io.c (READ_DATA_PENDING): use !feof(fp) for default behavior. - -Tue Mar 26 20:28:50 2002 Minero Aoki - - * 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 - - * 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 - - * 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 - - * 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 - - * ext/socket/socket.c (sock_addrinfo): should specify ai_socktype - for getaddrinfo hints. - -Mon Mar 25 17:18:48 2002 Nobuyoshi Nakada - - * dir.c (rb_push_glob): local variable 'maxnest' was - uninitialized. - -Mon Mar 25 16:53:30 2002 Yukihiro Matsumoto - - * 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 - - * win32/mkexports.rb: support VC++.NET. - -Tue Mar 26 14:00:17 2002 Akinori MUSHA - - * 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 - - * lib/fileutils.rb: new file. - -Tue Mar 26 03:23:50 2002 Tanaka Akira - - * lib/pp.rb (pp): return nil like p. - -Tue Mar 26 01:48:01 2002 Akinori MUSHA - - * 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 - - * configure.in (FILE_READPTR): check _p for 4.4BSD. - -Mon Mar 25 23:39:25 2002 Nobuyoshi Nakada - - * 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 chagend. - - * 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 - - * ext/extmk.rb.in (arg_config): get rid of single quotes - for autoconf 2.53. - -Mon Mar 25 17:49:41 2002 Nobuyoshi Nakada - - * 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 - - * 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 - - * 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 - - * dir.c (fnmatch): "*/bar" (with FNM_PATHNAME flag) does not - match "foo/bar". - -Sun Mar 24 00:46:05 2002 WATANABE Hirofumi - - * util.c (push_element): avoid warning for djgpp. - -Sat Mar 23 01:50:30 2002 Yukihiro Matsumoto - - * io.c (read_all): files on /proc filesystem with zero stat size, - may have contents. - -Fri Mar 22 18:07:29 2002 Yukihiro Matsumoto - - * 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 - - * ext/extmk.rb.in: replace mkdir with mkpath to compile racc/cparse. - -Fri Mar 22 16:22:55 2002 Yukihiro Matsumoto - - * the VMS support patch submitted by Akiyoshi, Masamichi - is merged. - -Fri Mar 22 16:27:24 2002 Minero Aoki - - * 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 - - * 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 - - * ext/strscan/MANIFEST, strscan.c, depend, extconf.rb: new files. - - * ext/Setup*: add strscan entry. - -Fri Mar 22 14:32:14 2002 Minero Aoki - - * lib/net/protocol.rb: Protocol#start should return self. - -Fri Mar 22 14:14:21 2002 Tanaka Akira - - * 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 - - * 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 - - * sprintf.c (rb_f_printf): discard meaningless prefix ".." for '%u'. - -Thu Mar 21 01:11:37 2002 Usaku Nakamura - - * win32/Makefile.sub (config.status): fix install path (prefix). - -Thu Mar 21 01:03:05 2002 Nobuyoshi Nakada - - * ext/configsub.rb: latest autoconf style support. - -Wed Mar 20 22:16:25 2002 Usaku Nakamura - - * mkconfig.rb: close duplicated $stdout before renaming rbconfig.rb. - -Wed Mar 20 21:54:17 2002 Nobuyoshi Nakada - - * 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 - - * variable.c (rb_const_list): a temporary table must be freed. - -Wed Mar 20 19:44:09 2002 Tanaka Akira - - * mkconfig.rb: don't touch rbconfig.rb if there is a trouble. - -Wed Mar 20 16:05:37 2002 Yukihiro Matsumoto - - * 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 - - * file.c (rb_file_s_expand_path): memory leak fixed. - -Wed Mar 20 00:36:43 2002 Akinori MUSHA - - * 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 - - * ext/stringio/stringio.c (check_modifiable): wrong declaration. - -Mon Mar 18 18:04:05 2002 Nobuyoshi Nakada - - * 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 - - * 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 - - * ext/iconv/extconf.rb: workaround for GNU libiconv. - -Mon Mar 18 10:55:03 2002 Nobuyoshi Nakada - - * 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 - - * 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 - - * ext/iconv/depend: added. - - * ext/stringio/depend: added. - -Sat Mar 16 22:43:53 2002 WATANABE Hirofumi - - * missing/fileblocks.c: add for autoconf. - -Sat Mar 16 15:30:40 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * win32/win32.c (StartSockets): remove duplicated lines. - -Fri Mar 15 17:44:08 2002 Usaku Nakamura - - * 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 - - * ext/iconv/iconv.c: fixed document, Iconv#new is no longer an - iterator. thanks to Tanaka Akira . - -Thu Mar 14 22:17:45 2002 Nobuyoshi Nakada - - * ext/iconv: imported. - -Thu Mar 14 16:42:37 2002 Yukihiro Matsumoto - - * class.c (rb_define_class): should handle autoload. - - * class.c (rb_define_module): ditto. - -Thu Mar 14 16:18:12 2002 WATANABE Hirofumi - - * configure.in: autoconf 2.53 support. use AC_LIBOBJ. - -Thu Mar 14 00:29:12 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * dir.c (rb_push_glob): avoid SEGV when a block given. - -Thu Mar 14 00:16:02 2002 Nobuyoshi Nakada - - * string.c (rb_str_subpat_set): must make str independent after - rb_reg_search() matched. - -Wed Mar 13 19:05:15 2002 Akinori MUSHA - - * 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 - - * 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 - - * 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 - - * eval.c (rb_f_abort): optional message argument that be printed - on termination. - -Tue Mar 12 17:12:06 2002 Tanaka Akira - - * lib/resolv.rb: don't complete domains for absolute FQNs. - -Mon Mar 11 23:08:48 2002 Tanaka Akira - - * lib/tsort.rb: new file. - -Mon Mar 11 21:03:37 2002 Nobuyoshi Nakada - - * ext/stringio: new. - -Mon Mar 11 18:03:37 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * ext/socket/extconf.rb (have_struct_member): don't print checked - result. - -Fri Mar 8 12:19:15 2002 Tanaka Akira - - * lib/resolv.rb: use its own thread group for background threads. - -Fri Mar 8 02:21:32 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * dln.c (dln_load): use LoadLibrary instead of LoadLibraryEx. - -Wed Mar 6 16:50:37 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * ext/socket/{addinfo.h,getaddrinfo.c} (gai_strerror): add const - qualifier only for uClibc. - -Fri Mar 1 11:22:51 2002 Amos Gouaux - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * bignum.c (rb_big_2comp): void function cannot return any value. - -Tue Feb 26 16:52:12 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * lib/uri/generic.rb: merge0 shuld 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 - - * ext/syslog/syslog.c: Merge from rough. Use SafeStringValue(). - -Mon Feb 25 21:12:08 2002 Akinori MUSHA - - * 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 - - * sample/test.rb (system): test with scripts under the source - directory. - -Mon Feb 25 15:14:01 2002 Yukihiro Matsumoto - - * 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 - - * lib/shell.rb (Shell::expand_path): relative to @cwd. - -Mon Feb 25 06:30:11 2002 Koji Arai - - * hash.c (env_select): should path the assoc list. - -Sun Feb 24 17:20:22 2002 Akinori MUSHA - - * ext/digest/*/*.h: Merge from rough. - - Avoid namespace pollution. (MD5_* -> rb_Digest_MD5_*, etc.) - -Sat Feb 23 21:12:13 2002 Yukihiro Matsumoto - - * process.c (rb_syswait): thread kludge; should be fixed to - support native thread. - -Fri Feb 22 21:20:53 2002 Minero Aoki - - * 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 - - * win32/config.status.in: set LIBRUBY_SO. - -Fri Feb 22 03:34:38 2002 Yukihiro Matsumoto - - * 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 - - * lib/prettyprint.rb: FillGroup implemented. - -Thu Feb 21 21:40:18 2002 Usaku Nakamura - - * ext/extmk.rb.in (create_makefile): remove unnecessary -L option from - LIBS macro. - -Thu Feb 21 02:49:12 2002 Koji Arai - - * pack.c (pack_pack): wrong # comment treatment. - - * pack.c (pack_unpack): ditto. - -Wed Feb 20 15:15:03 2002 Nobuyoshi Nakada - - * 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 - - * io.c (rb_io_close): return Qnil. - -Wed Feb 20 12:41:59 2002 Yukihiro Matsumoto - - * 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 - - * 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: devide 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 - - * parse.y (str_extend): backslash escape was done wrong. - -Tue Feb 19 17:10:25 2002 Nobuyoshi Nakada - - * file.c (path_check_1): do not fail on world writable *parent* - directories too. - -Tue Feb 19 15:51:41 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * regex.c: fix prototypes of xmalloc(), xcalloc() and xrealloc(). - -Tue Feb 19 13:16:08 2002 Nobuyoshi Nakada - - * io.c (rb_io_ungetc): don't fail pushed EOF back. - -Mon Feb 18 20:48:40 2002 Nobuyoshi Nakada - - * pack.c (pack_pack): avoid infinite loop at comment. - - * pack.c (pack_unpack): ditto. - -Mon Feb 18 14:06:28 2002 Nobuyoshi Nakada - - * misc/ruby-mode.el (ruby-block-hanging-re): rescue block was too - indented. - -Mon Feb 18 13:56:44 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * pack.c (pack_pack): allows comment in template strings. - - * pack.c (pack_unpack): ditto. - -Sun Feb 17 23:41:37 2002 Nobuyoshi Nakada - - * 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 - - * 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 - - * 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 - - * misc/ruby-mode.el (ruby-font-lock-keywords): fontify - instance/class/global variables start with '_'. - -Fri Feb 15 14:40:38 2002 Yukihiro Matsumoto - - * 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 - - * bignum.c (rb_big_rshift): should properly convert the nagative - value to 2's compliment. - -Thu Feb 14 17:38:35 2002 Nobuyoshi Nakada - - * parse.y: avoid SEGV at OP_ASIGN to pseudo variable. - -Thu Feb 14 14:13:16 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * parse.y (assignable): should emit CVASGN within the method - body. - -Mon Feb 11 06:13:53 2002 Matt Armstrong - - * dir.c (dir_s_glob): should not warn even if no match found. - -Mon Feb 11 04:25:54 2002 Yukihiro Matsumoto - - * 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 - - * regex.c (re_compile_fastmap): skip begpos. - -Sun Feb 10 16:52:53 2002 Nobuyoshi Nakada - - * ruby.c (load_file): avoid SEGV on '#' only input. - -Fri Feb 8 23:07:23 2002 Yukihiro Matsumoto - - * eval.c (rb_eval): singleton chech 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 - - * 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 - - * 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 sington def statements. - -Thu Feb 07 13:44:08 2002 akira yamada - - * 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 - - * 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 - - * configure.in: keep old config.h unless changed. - -Wed Feb 6 13:28:53 2002 Amos Gouaux - - * 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 - - * 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 to get proper CLK_TCK. - -Wed Feb 6 02:10:30 2002 Nobuyoshi Nakada - - * io.c (fptr_finalize): ignore EBADF when f and f2 use same - descriptor. - -Tue Feb 5 16:17:20 2002 Yukihiro Matsumoto - - * 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 - - * file.c (rb_file_s_expand_path): should terminate. - -Mon Feb 4 15:38:29 2002 Yukihiro Matsumoto - - * 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 - - * 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): wapper 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 - - * 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 - - * file.c (rb_stat_inspect): print dev, rdev in hexadecimal. - -Thu Jan 31 20:45:33 2002 Nobuyoshi Nakada - - * 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 - - * lib/pp.rb (File::Stat#pretty_print): print rdev_major and rdev_minor. - -Wed Jan 30 15:58:04 2002 K.Kosako - - * 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 - - * re.c (rb_reg_search): should set regs.allocated. - -Wed Jan 30 02:25:38 2002 Nobuyoshi Nakada - - * regex.c (re_adjust_startpos): search start of multibyte - backward. - - * regex.c (mbc_startpos): ditto. - -Tue Jan 29 17:59:20 2002 Tanaka Akira - - * 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 - - * array.c (rb_ary_fill): shouldn't yield unless block given. - -Mon Jan 28 18:33:18 2002 Nobuyoshi Nakada - - * parse.y (yylex): strict check for numbers. - -Mon Jan 28 18:01:01 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * configure.in (solaris): add '-shared' only for GNU ld. - -Fri Jan 25 17:16:23 2002 Yukihiro Matsumoto - - * class.c (rb_include_module): detect cyclic module inclusion. - -Fri Jan 25 02:17:56 2002 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * array.c (Init_Array): remove Array#filter. - -Wed Jan 23 13:27:44 2002 Nobuyoshi Nakada - - * eval.c (rb_yield_0): restore source file/line after yield. - -Wed Jan 23 02:00:14 2002 Yukihiro Matsumoto - - * 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 - - * io.c (rb_io_fsync): new method. [new] - -Mon Jan 21 22:57:18 2002 Nobuyoshi Nakada - - * signal.c (ruby_signal): must define sighandler_t for every - occasion. - -Mon Jan 21 08:25:30 2002 Yukihiro Matsumoto - - * 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 - - * eval.c (rb_eval): need not to clar 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 - - * 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 - - * 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 - - * 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 - - * ext/socket/socket.c (tcp_svr_s_open): fix typo. - -Fri Jan 18 02:27:48 2002 Yukihiro Matsumoto - - * 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 - - * parse.y (fixpos): orig may be (NODE*)1, which should not be - dereferenced. - -Thu Jan 17 16:21:42 2002 Yukihiro Matsumoto - - * 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 - - * ext/socket/socket.c: support subclassing by proper "initialize" - calling convention. [new] - -Wed Jan 16 18:25:08 2002 Yukihiro Matsumoto - - * st.c: primes should be primes. - -Wed Jan 16 12:29:14 2002 Tanaka Akira - - * 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 - - * 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 - - * eval.c (is_defined): method defined? check should honor - protected too. - -Mon Jan 14 13:06:02 2002 Yukihiro Matsumoto - - * eval.c (block_pass): should not pass tainted block, if $SAFE > 0. - -Sun Jan 13 09:31:41 2002 Koji Arai - - * variable.c (rb_mod_remove_cvar): should pass the char*. - -Fri Jan 11 05:06:25 2002 Nobuyoshi Nakada - - * 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 - - * 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 - - * win32/resource.rb: Modify copyright in resource script. - -Thu Jan 10 07:15:44 2002 takuma ozawa - - * re.c (match_select): should propagate taintness. - -Thu Jan 10 00:54:57 2002 Yukihiro Matsumoto - - * hash.c (rb_hash_set_default): Hash#default= should return the - new value. - -Wed Jan 9 20:21:09 2002 Nobuyoshi Nakada - - * 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 - - * 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 - - * eval.c (rb_add_method): clear replaced method from the cache. - -Mon Jan 7 12:38:47 2002 Tanaka Akira - - * 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 - - * range.c (range_member): beginning check was - wrong. [ruby-talk:30252] - -Sat Jan 5 03:07:34 2002 Yukihiro Matsumoto - - * string.c (rb_str_new2): NULL pointer check added. - -Sat Jan 5 00:19:12 2002 Nobuyoshi Nakada - - * parse.y (yycompile): strdup()'ed twice. - -Fri Jan 4 18:29:10 2002 Michal Rokos - - * class.c (rb_define_module_under): should locate predefined - module using rb_const_defined_at(). - -Fri Jan 4 17:23:49 2002 Nobuyoshi Nakada - - * 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 - - * 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 - - * process.c (rb_f_system): abandon vfork. - - * io.c (pipe_open): ditto. - -Tue Jan 1 02:16:48 2002 WATANABE Hirofumi - - * ext/curses/extconf.rb: add dir_config. - - * Makefile.in (fake.rb): set RUBY_VERSION. - -Mon Dec 31 14:20:46 2001 Nobuyoshi Nakada - - * 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 - - * defines.h: sparc linux needs different FLUSH_REGISTER_WINDOWS - -Mon Dec 31 04:27:28 2001 Minero Aoki - - * 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 - - * ext/extmk.rb.in, lib/mkmf.rb (have_library): accept -lm - unconditionally on mswin32/mingw32. - -Sat Dec 29 01:55:42 2001 Yukihiro Matsumoto - - * regex.c (re_search): abandon stclass optimization. - -Fri Dec 28 14:39:05 2001 Nobuyoshi Nakada - - * array.c (rb_cmpint): fixed typo. - -Thu Dec 27 18:43:04 2001 Nobuyoshi Nakada - - * bignum.c (rb_cstr2inum): deny "0_". - -Thu Dec 27 01:54:02 2001 Nobuyoshi Nakada - - * bignum.c (rb_cstr2inum): allow "0\n" and so on. - -Wed Dec 26 19:24:21 2001 Yukihiro Matsumoto - - * 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 - - * object.c (rb_convert_type): no longer use rb_rescue(). - -Tue Dec 25 18:32:16 2001 K.Kosako - - * re.c (rb_reg_search): initialize taint status of match object. - -Tue Dec 25 02:37:49 2001 Tanaka Akira - - * lib/pp.rb, lib/prettyprint.rb: new files. - -Tue Dec 25 02:11:17 2001 Yukihiro Matsumoto - - * object.c (rb_convert_type): check method responce check before - invoking rb_rescue(). - - * object.c (rb_check_convert_type): ditto. - -Mon Dec 24 02:37:40 2001 Le Wang - - * 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 - - * time.c (time_timeval): wrong cast to time_t. - - * time.c (time_plus): ditto. - -Fri Dec 21 20:33:34 2001 K.Kosako - - * parse.y (str_extend): make up "#$;" handling. - -Fri Dec 21 16:18:17 2001 Nobuyoshi Nakada - - * dln.h, ruby.h, util.h: enable prototypes in C++. - -Fri Dec 21 15:12:41 2001 Yukihiro Matsumoto - - * 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 - - * eval.c (rb_mod_define_method): must not convert Method to Proc. - -Fri Dec 21 01:17:57 2001 Nobuyoshi Nakada - - * 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 - - * lib/net/protocol.rb: rename Net::Socket to Net::BufferedSocket - -Thu Dec 20 13:51:52 2001 K.Kosako - - * 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 - - * re.c (match_to_a): should propagate taint. - - * re.c (rb_reg_s_quote): ditto. - -Wed Dec 19 16:58:29 2001 Shugo Maeda - - * 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 - - * 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 - - * string.c: use RESIZE_CAPA for capacity change. - -Wed Dec 19 03:08:40 2001 Tanaka Akira - - * 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 - - * ext/socket/socket.c (Init_socket): add listen method to - TCPServer and UNIXServer. - -Tue Dec 18 17:54:53 2001 WATANABE Hirofumi - - * sample/test.rb: Hash#indexes -> Hash#select. - -Tue Dec 18 01:02:13 2001 Yukihiro Matsumoto - - * eval.c (rb_thread_schedule): should not select a thread which is - not yet initialized. - -Mon Dec 17 18:53:49 2001 K.Kosako - - * string.c (rb_str_replace): swap arguments of OBJ_INFECT. - -Mon Dec 17 16:52:20 2001 Nobuyoshi Nakada - - * 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 - - * time.c (time_plus): wrong boundary check. - - * time.c (time_minus): ditto. - -Mon Dec 17 15:19:32 2001 Tanaka Akira - - * 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 - - * variable.c (find_class_path): should initialize iv_tbl if it's - NULL. - -Fri Dec 14 04:23:36 2001 Minero Aoki - - * 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 - - * class.c (rb_define_class): should return the existing class if - the class is already defined and its superclass is ideintical 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 - - * 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 - - * array.c (rb_ary_pop): should ELTS_SHARED flag check before - REALLOC. - -Tue Dec 11 12:45:28 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * object.c (rb_class_real): follow included modules. - -Mon Dec 10 23:37:51 2001 Usaku Nakamura - - * util.h: change prototype of ruby_qsort() to accord with its - definition. - -Mon Dec 10 20:30:01 2001 K.Kosako - - * gc.c (STR_ASSOC): use FL_USER3 instead of FL_USER2. - -Mon Dec 10 17:40:02 2001 K.Kosako - - * parse.y (str_extend): make up pushback call. - -Mon Dec 10 02:09:28 2001 Yukihiro Matsumoto - - * 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 - - * parse.y (gettable): should freeze __FILE__ string. - -Sun Dec 9 18:06:26 2001 Minero Aoki - - * lib/net/protocol.rb: calls on_connect before conn_command - -Sat Dec 8 23:27:44 2001 Yukihiro Matsumoto - - * io.c (rb_io_puts): old behavoir 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 - - * 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 - corrensponding 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 optinal "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 - - * object.c (Init_Object): undef Data.allocate, left Data.new. - -Fri Dec 7 19:12:14 2001 Minero Aoki - - * 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 algolithm. - -Fri Dec 7 15:49:39 2001 Usaku Nakamura - - * ext/extmk.rb.in: ignore adding -Wl,-R to DLDFLAGS when the directory - is $topdir. - -Fri Dec 7 13:58:58 2001 Yukihiro Matsumoto - - * 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 - - * parse.y (str_extend): should not process immature #$x and - #@x interpolation, e.g #@#@ etc. - -Fri Dec 7 03:21:18 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * regex.c (WC2MBC1ST): should not pass through > 0x80 number in UTF-8. - -Wed Dec 5 20:05:18 2001 Florian Frank - - * 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 - - * 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 - - * 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 - * matrix.rb: Vector#* bug. reported from Massimiliano Mirra - . - -Sun Dec 9 22:15:59 2001 Nobuyoshi Nakada - - * enum.c (enum_sort_by): should replace with last elements. - -Mon Dec 3 16:06:57 2001 WATANABE Hirofumi - - * 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 - - * configure.in: not use X11BASE, since it's not always set. - -Mon Dec 3 13:53:49 2001 Tanaka Akira - - * 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 - - * 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 - - * configure.in: apply patch from NetBSD's pkgsrc (patch-aa). - -Sun Dec 2 22:01:52 2001 WATANABE Hirofumi - - * 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 - - * 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 - - * 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 - - * README.EXT: Appendix B is duplicated. - - * README.EXT.ja: ditto. - -Thu Nov 29 00:28:07 2001 Yukihiro Matsumoto - - * string.c (rb_str_equal): object with to_str must be treated as a - string. - -Wed Nov 28 18:46:28 2001 Ville Mattila - - * eval.c (rb_thread_select): should subtract timeofday() from - limit, not reverse. - -Wed Nov 28 16:03:28 2001 K.Kosako - - * util.c (scan_hex): x is not a hexadecimal digit. - -Wed Nov 28 13:38:04 2001 Yukihiro Matsumoto - - * 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 actually fixed - this bug. - -Tue Nov 27 02:15:25 2001 Yukihiro Matsumoto - - * marshal.c (w_float): must distinguish -0.0 from 0.0. - -Mon Nov 26 20:57:24 2001 Akinori MUSHA - - * ext/Setup*, ext/syslog/*: import the "syslog" module from the - rough ruby project. - -Mon Nov 26 16:14:42 2001 K.Kosako - - * 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 - - * 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 - - * enum.c (sort_by_i): slight performance boost. - -Sun Nov 25 21:02:18 2001 Usaku Nakamura - - * parse.y (str_extend): change types of second and third arguments - from char to int. - -Thu Nov 22 20:15:28 2001 TAMURA Takashi - - * gc.c (gc_mark_rest): should call gc_mark_children(), not gc_mark(). - - * gc.c (rb_gc_mark): may cause infinite looop. - -Thu Nov 22 00:28:13 2001 Yukihiro Matsumoto - - * parse.y (str_extend): should check nesting parentheses in #{}. - -Wed Nov 21 12:22:52 2001 Shugo Maeda - - * 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 - - * 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 - - * 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 - - * parse.y (call_args2): block_arg may follow the first argument in - call_args2. - -Tue Nov 20 02:01:15 2001 Yukihiro Matsumoto - - * eval.c (stack_check): should avoid stack length check during - raising SystemStackError exception. - -Tue Nov 20 01:07:13 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * string.c (rb_str_succ): there was buffer overrun. - -Mon Nov 19 14:14:58 2001 Yukihiro Matsumoto - - * parse.y (str_extend): term can be any character. - -Mon Nov 19 04:58:42 2001 Wakou Aoyama - - * lib/cgi.rb (header): support for Apache. thanks to - Shugo Maeda . - -Sun Nov 18 19:37:55 2001 Nobuyoshi Nakada - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * array.c (rb_ary_to_s): if rb_output_fs is nil, insert newlines - between array elements (use rb_default_rs as newline litral) - [experimental]. - -Wed Nov 14 15:16:23 2001 K.Kosako - - * 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 - - * 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 - - * 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 - - * configure.in: do not override CC if set. - -Tue Nov 13 16:49:16 2001 Usaku Nakamura - - * 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 - - * signal.c (sighandle): should not re-register sighandler if - POSIX_SIGNAL is defined. - -Tue Nov 13 12:55:59 2001 Usaku Nakamura - - * 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 - - * 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 - - * eval.c (error_print): errat array may be empty. - -Mon Nov 12 01:30:37 2001 Yukihiro Matsumoto - - * 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 - - * gc.c: do not use static stack until system stack overflows. - -Sat Nov 10 03:57:09 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * win32/config.status.in: make CFLAGS same as Makefile's one. - -Thu Nov 8 20:20:37 2001 Nobuyoshi Nakada - - * 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 - - * 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 - - * file.c (path_check_1): forgot to initialize 'p'. - -Thu Nov 8 14:52:15 2001 Tanaka Akira - - * mkconfig.rb: use String#dump to generate Ruby string literal. - -Thu Nov 8 15:46:54 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * eval.c (rb_yield_0): should not call rb_f_block_given_p(). - -Sat Nov 3 23:33:18 2001 Yukihiro Matsumoto - - * string.c (rb_str_chomp_bang): should terminate string by NUL. - -Sat Nov 3 22:28:51 2001 Keiju Ishitsuka - - * 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 - - * eval.c (rb_yield_0): better error message. - -Thu Nov 1 14:08:42 2001 Yukihiro Matsumoto - - * 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 - - * gc.c (gc_mark_children): should NOT treat last element of - structs and arrays specially. - -Wed Oct 31 16:59:25 2001 Yukihiro Matsumoto - - * eval.c (exec_under): should initialize ruby_frame->self; - -Wed Oct 31 15:09:28 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * lib/cgi.rb: CGI::Cookie::parse(): Ignore duplicate keys caused by - Netscape bug. - -Tue Oct 30 18:21:51 2001 Usaku Nakamura - - * win32/mkexports.rb: follow the change of rb_io_puts(). - -Tue Oct 30 14:04:04 2001 Yukihiro Matsumoto - - * 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 - - * regex.c (re_compile_pattern): should preserve p0 value. - -Mon Oct 29 14:56:44 2001 Usaku Nakamura - - * 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 - - * 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 - - * bignum.c (rb_big_eq): convert Bignum to Float, instead of - reverse. - -Fri Oct 26 06:19:29 2001 Yukihiro Matsumoto - - * 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 - - * eval.c (rb_eval_cmd): should not invoke "call" with a block on - any occasion. - -Wed Oct 24 03:25:31 2001 Yukihiro Matsumoto - - * numeric.c (fix_aref): idx may be a Bignum. - -Tue Oct 23 01:21:19 2001 Nobuyoshi Nakada - - * 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 - - * 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 - - * numeric.c (num_remainder): a bug in Numeric#remainder. - -Mon Oct 22 15:21:55 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * object.c (rb_mod_initialize): optional block with - Module.new. [new] (from 2001-10-10) - -Tue Oct 16 00:07:06 2001 Nobuyoshi Nakada - - * parse.y (yylex): disallow alpha-numeric and mbchar for - terminator of %string. - -Mon Oct 15 18:00:05 2001 Pit Capitain - - * string.c (rb_str_index): wrong increment for non alphanumeric - string. - -Mon Oct 15 05:23:02 2001 Koji Arai - - * sprintf.c (rb_f_sprintf): support "%B". - -Wed Oct 10 03:11:47 2001 Yukihiro Matsumoto - - * 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 - - * process.c (Init_process): activate the case NT. - -Tue Oct 9 17:08:00 2001 Nobuyoshi Nakada - - * 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 - - * eval.c (rb_eval): NODE_MATCH3 was confusing left and right. sigh. - -Fri Oct 5 15:19:46 2001 Yukihiro Matsumoto - - * marshal.c (w_unique): should not dump anonymous class. - -Fri Oct 5 11:59:13 2001 Nobuyoshi Nakada - - * 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 - - * 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 - - * re.c (rb_reg_s_alloc): avoid inifinte recursion. - -Wed Oct 3 16:49:49 2001 Nobuyoshi Nakada - - * ext/gdbm/gdbm.c (rb_gdbm_fetch): str is a VALUE now. - -Wed Oct 3 13:32:06 2001 Yukihiro Matsumoto - - * 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 - - * lib/ftools.rb (catname): allow trailing '/' for the destination. - -Tue Oct 2 18:31:20 2001 Yukihiro Matsumoto - - * eval.c (rb_eval): should override existing class. - -Tue Oct 2 17:08:49 2001 Yukihiro Matsumoto - - * 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 - - * marshal.c (r_object): TYPE_UCLASS check should be inversed. - -Mon Oct 1 19:18:54 2001 Tanaka Akira - - * 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 - - * 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 - - * 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 - - * string.c (rb_str_aref_m): new argument pattern - String#[re,offset]. [new] - -Wed Sep 26 19:02:39 2001 Guy Decoux - - * parse.y: allow 'primary[] = arg' - -Tue Sep 25 10:46:42 2001 Usaku Nakamura - - * win32/win32.c (isInternalCmd): check return value of NtMakeCmdVector - (Tietew 's patch). - -Mon Sep 24 00:55:06 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * eval.c (eval): retrieves file, line information from binding. - -Thu Sep 20 21:25:00 2001 Nobuyoshi Nakada - - * eval.c (MATCH_DATA): access via rb_svar(). - -Thu Sep 20 15:20:00 2001 Nobuyoshi Nakada - - * 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 - - * 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 - - * 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 - - * string.c (rb_str_init): String.new() => "" [new] - -Tue Sep 11 20:53:56 2001 Yukihiro Matsumoto - - * 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 - - * lib/net/telnet.rb: waitfor(): improvement. thanks to - nobu.nakada@nifty.ne.jp - -Sat Sep 8 04:34:17 2001 Yukihiro Matsumoto - - * 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 - - * numeric.c (flo_to_s): should handle negative float value. - -Fri Sep 7 09:44:44 2001 Wakou Aoyama - - * lib/net/telnet.rb: waitfor(): bug fix. - -Fri Sep 7 07:11:34 2001 Wakou Aoyama - - * 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 - - * 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 - - * ext/digest/digest.c (rb_digest_base_s_hexdigest): remove a debug - print. - -Thu Sep 6 13:56:14 2001 Akinori MUSHA - - * 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 - - * lib/jcode.rb (_regexp_quote): fix quote handling, again. - -Thu Sep 6 07:28:56 2001 Nobuyoshi Nakada - - * 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 - - * ext/socket/socket.c (Init_socket): remove duplicating constants. - -Thu Sep 6 03:15:24 2001 Yukihiro Matsumoto - - * class.c (rb_include_module): should check whole ancestors to - avoid duplicate module inclusion. - -Wed Sep 5 20:02:27 2001 Shin'ya Adzumi - - * string.c (trnext): should check backslash before updating "now" - position. - -Wed Sep 5 17:41:11 2001 WATANABE Hirofumi - - * lib/jcode.rb (_regexp_quote): fix quote handling. - -Tue Sep 4 01:03:18 2001 Yukihiro Matsumoto - - * re.c (Init_Regexp): to_s to be alias to inspect. - -Mon Sep 3 22:46:59 2001 Yukihiro Matsumoto - - * parse.y (yylex): should support 'keyword='. - -Mon Sep 3 20:26:08 2001 Nobuyoshi Nakada - - * intern.h (rb_find_file_ext): changed from rb_find_file_noext(). - -Mon Sep 3 15:12:49 2001 Yukihiro Matsumoto - - * ruby.c (proc_options): should not adjust argc/argv if -e option - is supplied. - -Mon Sep 3 14:11:17 2001 Akinori MUSHA - - * 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 - - * 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 - - * 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 - - * ruby.c (set_arg0): use setprogtitle() if it's available. - -Sat Sep 1 03:49:11 2001 Yukihiro Matsumoto - - * io.c (rb_io_popen): accept integer flags as mode. - -Fri Aug 31 19:46:05 2001 Nobuyoshi Nakada - - * 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 - - * eval.c (rb_provided): should also check feature without - extension. - -Fri Aug 31 13:06:33 2001 Yukihiro Matsumoto - - * numeric.c (flo_to_s): do not rely on decimal point to be '.' - -Wed Aug 29 02:18:53 2001 Yukihiro Matsumoto - - * parse.y (yylex): ternary ? can be followed by newline. - -Tue Aug 28 00:40:48 2001 Yukihiro Matsumoto - - * eval.c (rb_f_require): should check static linked libraries - before raising exception. - -Fri Aug 24 15:17:40 2001 Yukihiro Matsumoto - - * array.c (rb_ary_equal): check identiry equality first. - - * string.c (rb_str_equal): ditto. - - * struct.c (rb_struct_equal): ditto. - -Fri Aug 24 14:38:17 2001 Usaku Nakamura - - * dln.c (dln_strerror): fix a bug that sometimes made null message on - win32 (Tietew 's patch). - - * win32/win32.c (mystrerror): ditto. - -Fri Aug 24 03:15:07 2001 Yukihiro Matsumoto - - * numeric.c (Init_Numeric): undef Integer::new. - -Fri Aug 24 00:46:44 2001 Yukihiro Matsumoto - - * 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 - - * enum.c (sort_by_i): fix typo. - -Thu Aug 23 10:10:59 2001 Yukihiro Matsumoto - - * 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 - - * hash.c (rb_hash_equal): check identiry equality first. - -Wed Aug 22 19:58:59 2001 Nobuyoshi Nakada - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * enum.c (enum_sort_by): new method for Schewartzian transformed - stable sort. - -Mon Aug 20 16:09:05 2001 Yukihiro Matsumoto - - * variable.c (mod_av_set): detect constant overriding for built-in - classes/modules. - -Mon Aug 20 15:14:27 2001 Yukihiro Matsumoto - - * parse.y (tokadd_escape): escaped backslashes too much. - -Mon Aug 20 13:24:08 2001 Yukihiro Matsumoto - - * range.c (range_step): 'iter' here should be an array. - -Mon Aug 20 12:43:08 2001 Yukihiro Matsumoto - - * marshal.c (w_object): should retrieve __member__ data from - non-singleton class. - -Sat Aug 18 23:11:14 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * parse.y (parse_regx): handle backslash escaping of delimiter here. - -Thu Aug 16 23:03:40 2001 Koji Arai - - * io.c: prevent recursive malloc calls on NEC UX/4800. - - * ext/socket/socket.c: ditto. - -Thu Aug 16 13:54:04 2001 Usaku Nakamura - - * ext/socket/socket.c (s_recvfrom): fix typo. - -Thu Aug 16 09:53:28 2001 Usaku Nakamura - - * ext/socket/socket.c (s_recvfrom): avoid VC++6 warning. - -Thu Aug 16 03:50:33 2001 Usaku Nakamura - - * win32/win32.c (NtCmdGlob): avoid VC++ warning. - - * lib/mkmf.rb: add -I$(srcdir) to CPPFLAGS. - -Wed Aug 15 04:59:15 2001 Akinori MUSHA - - * ext/digest/*/extconf.rb: really fix so that they build from any - directory. - -Wed Aug 15 04:04:02 2001 Akinori MUSHA - - * ext/digest/sha2/extconf.rb: fix so that they build from any - directory. - -Wed Aug 15 01:59:19 2001 Akinori MUSHA - - * 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 - - * 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 - - * range.c (range_step): new method. - -Tue Aug 14 11:49:00 2001 TOYOFUKU Chikanobu - - * string.c (rb_str_cmp): remove needless conditional. - -Tue Aug 14 03:23:25 2001 Koji Arai - - * string.c (rb_str_lstrip_bang) `return Qnil' was missing. - -Mon Aug 13 14:16:46 2001 Akinori MUSHA - - * bignum.c, marshal.c: Detypo: s/SIZEOF_ING/SIZEOF_INT/. - -Sun Aug 12 15:01:58 2001 Nobuyoshi Nakada - - * 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 - - * array.c (rb_inspecting_p): initialize inspect_key if it is - not initialized yet. - -Fri Aug 10 22:14:37 2001 Yukihiro Matsumoto - - * parse.y (cond0): operands of logical operators are not treated - as conditional expresion anymore, but propagate conditional - status if used in conditionals. - -Tue Aug 7 09:10:32 2001 Usaku Nakamura - - * win32/win32.h: fix problems with BC++ (ruby-bugs#PR161). - -Mon Aug 6 23:47:46 2001 Nobuyoshi Nakada - - * 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 - - * eval.c (rb_gc_mark_threads): should mark ruby_cref. - -Mon Aug 6 14:31:37 2001 Usaku Nakamura - - * numeric.c (num_divmod): fix typo. - -Mon Aug 6 03:29:03 2001 Yukihiro Matsumoto - - * 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 - - * struct.c (rb_struct_modify): should check frozen and taint - status. - -Sun Aug 5 19:28:39 2001 Nobuyoshi Nakada - - * string.c (rb_str_associate): should consider STR_ASSOC too. - -Sun Aug 5 07:46:18 2001 Nobuyoshi Nakada - - * eval.c (rb_undefined): do not recurse if method_missing is - undefined. - -Thu Aug 2 21:37:32 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * eval.c (ruby_run): avoid VC++ warning. - -Tue Jul 31 17:30:53 2001 Usaku Nakamura - - * marshal.c (Init_marshal): fix typos. - -Tue Jul 31 15:16:39 2001 Nobuyoshi Nakada - - * 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 - - * marshal.c (Init_marshal): new constant Marshal::MAJOR_VERSION - and Marshal::MINOR_VERSION. - -Tue Jul 31 07:18:04 2001 Nobuyoshi Nakada - - * 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 - - * marshal.c (marshal_load): ruby_verbose test should be wrapped by - RTEST(). - -Mon Jul 30 17:54:23 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * lib/net/imap.rb: added new commands for managing folder quotas - and folder ACLs. - -Mon Jul 30 03:19:53 2001 Yukihiro Matsumoto - - * bignum.c (rb_cstr2inum): "0 ff".hex should return 0, not 255. - -Fri Jul 27 22:29:41 2001 Nobuyoshi Nakada - - * file.c (rb_file_s_expand_path): fixed using CharNext(). - -Fri Jul 27 18:07:27 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * file.c (rb_find_file_noext, rb_find_file): fix tilde expansion - problem. - -Wed Jul 25 17:54:20 2001 Yukihiro Matsumoto - - * file.c (rb_file_s_expand_path): use CharNext() to expand. - -Wed Jul 25 17:16:26 2001 Akinori MUSHA - - * intern.h: add some missing function prototypes. - -Wed Jul 25 15:50:05 2001 Guy Decoux - - * file.c (rb_file_s_expand_path): should not expand "." and ".." - not following dirsep. - -Wed Jul 25 12:15:32 2001 WATANABE Hirofumi - - * 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 - - * file.c (strrdirsep): multi-byte pathname and DOSish separater - supprot. 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 - - * 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 - - * eval.c (rb_provide_feature): should not tweak extension used for - loading. - -Sun Jul 22 21:16:43 2001 Akinori MUSHA - - * 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 - - * io.c (io_fread): use fread(3) if PENDING_COUNT is available. - -Fri Jul 20 22:55:01 2001 Akinori MUSHA - - * 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 - - * class.c (rb_mod_include_p): Module#include? added. [new] - -Fri Jul 20 01:05:50 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * ruby.h: enable volatile directive with VC++. - - * regex.c: ditto. - -Tue Jul 17 06:01:12 2001 Minero Aoki - - * 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 - - * 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 - - * 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 - - * 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 - - * file.c (file_load_ok): fix typo. - -Mon Jul 16 12:58:07 2001 Yukihiro Matsumoto - - * eval.c (proc_invoke): should preserve iter status for embedded - frame in the block. - -Mon Jul 16 00:04:39 2001 Yukihiro Matsumoto - - * file.c (rb_file_s_expand_path): may overrun buffer on stack. - -Sun Jul 15 01:38:28 2001 Guy Decoux - - * string.c (rb_str_insert): forgot to call rb_str_modify(). - -Sat Jul 14 12:26:30 2001 Nobuyoshi Nakada - - * ext/digest/*/extconf.rb: fix so that they build from any - directory. - -Sat Jul 14 06:20:17 2001 WATANABE Hirofumi - - * lib/net/http.rb: HTTP#proxy? did not worked. - -Sat Jul 14 02:56:19 2001 Akinori MUSHA - - * 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 - - * ext/.cvsignore: let cvs ignore extinit.c. - -Fri Jul 13 23:47:35 2001 Yukihiro Matsumoto - - * regex.c (re_search): should consider reverse search. - -Fri Jul 13 22:26:09 2001 Akinori MUSHA - - * 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 - - * 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 - - * ext/socket/socket.c (ruby_connect): workaround for the setup of - Cygwin socket(EALREADY). - -Mon Jul 9 16:49:30 2001 WATANABE Hirofumi - - * ext/extmk.rb.in: modify RM macro. - - * lib/mkmf.rb: ditto. - -Sun Jul 8 20:52:02 2001 Akinori MUSHA - - * ruby.h: fix a wrong function name: rb_iglob() -> rb_globi(). - -Sun Jul 8 16:04:35 2001 Minero Aoki - - * 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 - - * 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 - - * 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 - - * lib/tempfile.rb: a tempfile must be created with mode 0600. - -Thu Jul 5 20:28:53 2001 Tietew - - * 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 - - * 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 - - * dln.c (dln_load): should use NSLINKMODULE_OPTION_BINDNOW. - -Thu Jul 5 13:44:03 2001 Yukihiro Matsumoto - - * ruby.c (load_file): local variables 'c' remain uninitialized on - xflag. - -Thu Jul 5 10:00:59 2001 Yukihiro Matsumoto - - * regex.c (re_match): prefetched escaped character too early. - -Wed Jul 4 08:58:30 2001 Yukihiro Matsumoto - - * eval.c (rb_call0): add argument check for attr_readers. - -Wed Jul 4 04:22:44 2001 Minero Aoki - - * lib/net/http.rb (HTTP#request_by_name): arg order changes. - -Wed Jul 4 04:07:36 2001 Minero Aoki - - * 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 - - * 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 - - * lib/mkmf.rb: distclean should remove mkmf.log as well. - -Tue Jul 3 18:35:49 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * error.c (rb_name_error): raise NameError instead of LoadError. - -Mon Jul 2 17:22:00 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * lex.c (rb_reserved_word): lex_state after tRESCUE should be - EXPR_MID. - -Thu Jun 28 00:21:28 2001 Keiju Ishitsuka - - * 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 - - * 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 - - * gc.c (add_heap): allocation size of the heap unit is doubled for - each allocation. - -Mon Jun 25 09:54:48 2001 Yukihiro Matsumoto - - * dir.c (isdelim): space, tab, and newline are no longer - delimiters for glob patterns. - -Sat Jun 23 22:28:52 2001 Yukihiro Matsumoto - - * 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 - - * ext/readline/readline.c (readline_event): a non-void function - should return a value. - -Fri Jun 22 23:17:28 2001 WATANABE Hirofumi - - * ext/socket/socket.c (ruby_connect): workaround for the setup of - Cygwin socket. - -Fri Jun 22 23:11:17 2001 Keiju Ishitsuka - - * lib/irb/locale.rb: fix for require "kconv" problem - -Fri Jun 22 18:08:45 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * gc.c (rb_setjmp): avoid GCC 3.0 warnings. - -Tue Jun 19 18:19:30 2001 Akinori MUSHA - - * 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 - - * 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 - - * 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 - - * 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 - - * eval.c (rb_load): tainted string is OK if wrapped *and* - $SAFE >= 4. - -Thu Jun 14 16:27:07 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * lib/mkmf.rb: target_prefix is only for installation, not for - build. - -Tue Jun 12 00:41:18 2001 Yukihiro Matsumoto - - * eval.c (method_eq): new method Method#==. [new] - -Mon Jun 11 14:29:41 2001 WATANABE Hirofumi - - * confgure.in: add RUBY_CANONICAL_BUILD. - -Sun Jun 10 17:31:47 2001 Guy Decoux - - * 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 - - * 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 - - * hash.c (ruby_setenv): readline library leaves their environment - strings uncopied. "free" check revised. - -Sat Jun 9 16:31:03 2001 Usaku Nakamura - - * 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 - - * gc.c (Init_stack): avoid __builtin_frame_address(2) to retrieve - stack bottom line. - -Fri Jun 8 18:14:12 2001 Yukihiro Matsumoto - - * st.c (numhash): should shuffle bits by dividing by prime number. - -Fri Jun 8 17:05:21 2001 Yukihiro Matsumoto - - * eval.c (rb_eval): multiple assignment behavior fixed, which - results "*a = nil" makes "a == []" now. - -Fri Jun 8 15:25:09 2001 Yukihiro Matsumoto - - * eval.c (rb_f_require): should set SCOPE_PUBLIC before calling - dln_load(). - -Thu Jun 7 17:28:00 2001 Yukihiro Matsumoto - - * parse.y (yylex): exclude kDO_BLOCK too much by false condition. - -Wed Jun 6 23:02:36 2001 Keiju Ishitsuka - - * 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 - - * eval.c (rb_load): should check if tainted even when wrap is - specified. - -Wed Jun 6 14:34:27 2001 Yukihiro Matsumoto - - * 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 - - * variable.c (fc_i): removed vast string allocation. - -Tue Jun 5 16:45:48 2001 Yukihiro Matsumoto - - * error.c (Init_Exception): NameError went under StandardError, - and NoMethodError went under NameError. - -Tue Jun 5 16:40:06 2001 Yukihiro Matsumoto - - * parse.y (rb_intern): non identifier symbols should be - categorized as ID_JUNK. [new] - -Tue Jun 5 16:15:58 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * ext/etc/extconf.rb: use egrep_cpp. - -Tue Jun 5 12:44:59 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * lib/shellwords.rb: don't destroy argument. - -Sat Jun 2 23:23:05 2001 Yukihiro Matsumoto - - * regex.c (re_compile_pattern): should push option modifier at the - right place. - -Sat Jun 2 23:05:20 2001 Shugo Maeda - - * lib/cgi/session.rb: don't use module_function for Class. - -Sat Jun 2 00:02:22 2001 Keiju Ishitsuka - - * irb messages: fix typos. - -Fri Jun 1 17:26:24 2001 K.Kosako - - * hash.c (replace_i): ignore when key == Qundef. - -Fri Jun 1 16:50:59 2001 Yukihiro Matsumoto - - * parse.y (call_args2): confusion with list_append() and - list_concat() was fixed. - -Fri Jun 1 15:01:40 2001 Yukihiro Matsumoto - - * 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 - - * configure.in: use waitpid on mingw32. - - * ext/dbm/extconf.rb: include , not . - -Thu May 31 18:34:57 2001 K.Kosako - - * file.c (rb_file_s_unlink): should not allow if $SAFE >= 2. - -Thu May 31 17:23:25 2001 Yukihiro Matsumoto - - * range.c (Init_Range): define "to_ary". - -Thu May 31 13:30:25 2001 WATANABE Hirofumi - - * mkconfig.rb, ext/configsub.rb: VERSION -> RUBY_VERSION. - -Thu May 31 08:00:58 2001 Usaku Nakamura - - * win32/dir.h: re-add. - -Thu May 31 01:25:59 2001 Akinori MUSHA - - * configure.in: default --with-libc_r to `no' until the problem is - fixed. (FreeBSD only) - -Tue May 29 17:24:23 2001 K.Kosako - - * ruby.c (proc_options): unexpected SecurityError happens when -T4. - -Tue May 29 18:46:04 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * configure.in: remove unnecessary AC_CANONICAL_BUILD - - * defins.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 - - * 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 - - * time.c (make_time_t): local time adjustment revised. - -Mon May 28 02:20:38 2001 Akinori MUSHA - - * 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 - - * parse.y: accomplish extended syntax described in [ruby-talk:14525] - using tSPC token. [new, experimental] - -Sat May 26 07:05:45 2001 Usaku Nakamura - - * MANIFEST: add win32/dir.h . - -Fri May 25 20:03:51 2001 Pascal Rigaux - - * dln.c (dln_find_1): should exclude directories in executable - file lookup. - -Fri May 25 18:00:26 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * MANIFEST: update the entries I forgot to add or remove. - -Fri May 25 00:57:25 2001 Akinori MUSHA - - * 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 - - * ext/dbm/extconf.rb: fix support for *BSD and set $CFLAGS - properly. - -Thu May 24 16:10:33 2001 Yukihiro Matsumoto - - * 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 - - * mkconfig.rb: autoconf 2.50 support. - -Thu May 24 14:23:35 2001 Yukihiro Matsumoto - - * eval.c (rb_yield_0): need argument adjustment for C defined - blocks too. - -Thu May 24 01:11:30 2001 Yukihiro Matsumoto - - * ext/dbm/extconf.rb: header search added. [new] - -Wed May 23 02:58:21 2001 Tanaka Akira - - * time.c (make_time_t): fix ad-hoc local time adjustment, using - binary tree search. - -Tue May 22 17:10:35 2001 K.Kosako - - * variable.c (rb_alias_variable): should not allow variable - aliasing if $SAFE >= 4. - -Tue May 22 02:37:45 2001 Yukihiro Matsumoto - - * 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 - - * bignum.c (rb_big2str): t should be protected from GC. - -Sat May 19 09:29:07 2001 Yukihiro Matsumoto - - * process.c (rb_proc_times): need not to check retrun value from - times(2). - -Fri May 18 05:36:08 2001 Akinori MUSHA - - * ext/extmk.rb.in (xsystem): backout the previous fix which was - bogus. - -Fri May 18 05:19:55 2001 Akinori MUSHA - - * 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 - - * lib/mkmf.rb: unbreak "make install". lib/* must be installed - under $rubylibdir, not under $libdir. - -Fri May 18 01:28:07 2001 Yukihiro Matsumoto - - * parse.y (expr): break, next, redo, retry are moved from primary. - -Fri May 18 01:11:02 2001 Usaku Nakamura - - * 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 - - * ext/sha1/sha1.txt, ext/sha1/sha1.txt.jp: fix typos. - -Thu May 17 19:17:11 2001 Akinori MUSHA - - * 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 - - * 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 - - * eval.c (rb_call0): address of local_vars might change during eval. - -Thu May 17 07:27:09 2001 Akinori MUSHA - - * ext/md5/md5.txt.jp, ext/sha1/sha1.txt.jp: - s/SuperClass/Superclass/. - -Thu May 17 07:21:44 2001 Akinori MUSHA - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * signal.c: SIGINFO added. - -Mon May 14 08:57:06 2001 Yukihiro Matsumoto - - * eval.c (rb_ensure): should not SEGV when prot_tag is NULL. - -Sun May 13 23:51:14 2001 Usaku Nakamura - - * win32/resource.rb: Modify copyright in resource script. - -Sun May 13 14:03:33 2001 Okada Jun - - * lib/thread.rb: fix Queue#pop and SizedQueue#max= to avoid - deadlock. - -Sat May 12 15:43:55 2001 Usaku Nakamura - - * win32/win32.c (kill): add support of signal 9 on mswin32/mingw32. - -Fri May 11 15:09:52 2001 WATANABE Hirofumi - - * 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 - - * README.EXT: Document find_library(), with_config() and - dir_config(). - -Fri May 11 03:34:20 2001 Akinori MUSHA - - * 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 - - * README, README.jp: Fix CVS access and mailing lists info. - -Fri May 11 02:00:44 2001 Ryo HAYASAKA - - * bignum.c (bigdivrem): access boundary bug. - -Thu May 10 02:40:47 2001 Yukihiro Matsumoto - - * 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 - - * eval.c (rb_yield_0): preserve and restore ruby_cref as well. - -Tue May 8 18:28:19 2001 Keiju Ishitsuka - - * 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 - - * 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 - - * 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 - - * doc/forwardable.rd, doc/forwardable.rd.jp, lib/forwardable.rb: - Import forwardable 1.1. - -Tue May 8 08:34:33 2001 Akinori MUSHA - - * 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 - - * sample/rbc.rb: Obsoleted by IRB. - -Mon May 7 15:58:45 2001 Yukihiro Matsumoto - - * 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 - - * lib/ftools.rb (syscopy): chmod destination file only if - it does not exist. - -Mon May 7 14:35:57 2001 Yukihiro Matsumoto - - * object.c (rb_obj_is_instance_of): takes only class/module as an - argument. - -Sun May 6 16:27:29 2001 Koji Arai - - * eval.c (is_defined): rb_reg_nth_defined() may return Qnil. - -Thu May 3 03:15:06 2001 SHIROYAMA Takayuki - - * 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 - - * win32/config.h.in: add SIZEOF___INT64 definition. - -Wed May 2 20:39:35 2001 WATANABE Hirofumi - - * dir.c (rb_glob, rb_globi): remove unnecessary FNM_PATHNAME. - -Wed May 2 11:46:13 2001 K.Kosako - - * eval.c (block_pass): should not downgrade safe level. - -Wed May 2 03:07:49 2001 Yukihiro Matsumoto - - * 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 - - * string.c (rb_str_insert): new method. - -Tue May 1 17:55:58 2001 Yukihiro Matsumoto - - * parse.y (yylex): lex_state after RESCUE_MOD should be EXPR_BEG. - -Tue May 1 16:23:03 2001 Yukihiro Matsumoto - - * array.c (rb_ary_insert): new method. - - * array.c (rb_ary_update): new utility function. - -Tue May 1 03:24:05 2001 Akinori MUSHA - - * 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 - - * 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 - - * io.c (set_outfile): should check if closed before assignment. - -Thu Apr 26 22:36:11 2001 WATANABE Hirofumi - - * 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 - - * eval.c (rb_eval): should preserve value of ruby_errinfo. - -Thu Apr 26 10:36:09 2001 Yukihiro Matsumoto - - * eval.c (rb_thread_schedule): infinite sleep should not cause - dead lock. - -Wed Apr 25 16:40:44 2001 Yukihiro Matsumoto - - * array.c (rb_ary_flatten_bang): proper recursive detection. - -Wed Apr 25 15:36:15 2001 K.Kosako - - * eval.c (yield_under): need not to prohibit at safe level 4. - -Wed Apr 25 15:22:20 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * marshal.c (w_float): precision changed to "%.16g" - -Sat Apr 21 22:07:58 2001 Guy Decoux - - * eval.c (rb_call0): wrong retry behavior. - -Fri Apr 20 19:12:20 2001 Yukihiro Matsumoto - - * numeric.c (fix_aref): a bug on long>int architecture. - -Fri Apr 20 14:57:15 2001 K.Kosako - - * eval.c (rb_eval_string_wrap): should restore ruby_wrapper. - -Sun Apr 22 17:44:37 2001 WATANABE Hirofumi - - * 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 - - * lib/cgi.rb: CGI::Cookie: no use PATH_INFO. - -Wed Apr 18 00:24:40 2001 Yukihiro Matsumoto - - * regex.c (re_compile_pattern): char class at either edge of range - should be invalid. - -Tue Apr 17 17:33:55 2001 Yukihiro Matsumoto - - * 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 - - * eval.c (safe_getter): should use INT2NUM(). - -Tue Apr 17 15:12:56 2001 Yukihiro Matsumoto - - * bignum.c (rb_big2long): 2**31 cannot fit in 31 bit long. - -Sat Apr 14 22:46:43 2001 Guy Decoux - - * regex.c (calculate_must_string): wrong length calculation. - -Sat Apr 14 13:37:32 2001 Usaku Nakamura - - * win32/config.status.in: no longer use missing/alloca.c. - - * win32/Makefile.sub: ditto. - -Fri Apr 13 12:40:48 2001 K.Kosako - - * eval.c (rb_thread_start_0): fixed memory leak. - -Fri Apr 13 16:41:18 2001 Yukihiro Matsumoto - - * parse.y (none): should clear cmdarg_stack too. - -Fri Apr 13 06:19:29 2001 GOTOU YUUZOU - - * io.c (rb_fopen): use setvbuf() to avoid recursive malloc() on - some platforms. - -Wed Apr 11 23:36:26 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * eval.c (rb_mod_included): new hook called from rb_mod_include(). - -Tue Apr 10 02:24:40 2001 Nobuyoshi Nakada - - * io.c (opt_i_set): should strdup() inplace_edit string. - -Mon Apr 9 23:29:54 2001 Yukihiro Matsumoto - - * eval.c (exec_under): need to push cref too. - -Mon Apr 9 15:20:21 2001 Yukihiro Matsumoto - - * 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 - - * file.c (Init_File): should redifine "new" class method. - -Mon Apr 9 11:56:52 2001 Shugo Maeda - - * lib/net/imap.rb: fix typo. - -Fri Apr 6 01:46:35 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * object.c (rb_obj_is_instance_of): nil belongs to false, not true. - -Thu Apr 5 02:19:03 2001 Yukihiro Matsumoto - - * 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 - - * eval.c (proc_eq): class check aded. - - * eval.c (proc_eq): typo fixed ("return" was ommitted). - - * 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 - - * 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 - - * 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 - - * process.c (proc_waitall): should push Process::Status instead of - Finuxm 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 - - * lib/monitor.rb (wait): ensure reentrance. - - * lib/monitor.rb (wait): fix timeout support. - -Mon Apr 2 12:40:45 2001 Shugo Maeda - - * lib/net/imap.rb (media_subtype): return subtype. - -Mon Apr 2 12:01:15 2001 Shugo Maeda - - * lib/net/imap.rb (flag_list): capitalize flags. - -Mon Apr 2 01:32:38 2001 Akinori MUSHA - - * 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 extention 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 - - * 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 - - * numeric.c (flodivmod): a bug in no fmod case. - -Sun Apr 1 18:36:14 2001 Koji Arai - - * process.c (pst_wifsignaled): should apply WIFSIGNALED for status - (int), not st (VALUE). - -Sat Mar 31 04:47:55 2001 Shugo Maeda - - * lib/net/imap.rb: add document and example code. - -Sat Mar 31 03:24:10 2001 Yukihiro Matsumoto - - * 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 - - * eval.c (rb_load): should not copy topleve local variables. It - cause variable/method ambiguity. Thanks to L. Peter Deutsch. - -Fri Mar 30 22:56:56 2001 Shugo Maeda - - * lib/net/imap.rb: rename ContinueRequest to ContinuationRequest. - -Fri Mar 30 12:51:19 2001 Yukihiro Matsumoto - - * class.c (rb_include_module): freeze check at first. - -Thu Mar 29 17:05:09 2001 Yukihiro Matsumoto - - * eval.c (rb_attr): sprintf() and rb_intern() moved into - conditional body. - -Wed Mar 28 23:43:00 2001 Nobuyoshi Nakada - - * 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 - - * ext/extmk.rb.in, lib/mkmf.rb: move C++ rules to the right place. - -Wed Mar 28 17:39:04 2001 Yukihiro Matsumoto - - * object.c (rb_str2cstr): warn if string contains \0 and length - value is ignored. - -Wed Mar 28 15:00:31 2001 K.Kosako - - * class.c (rb_singleton_class_clone): should copy class constant - table as well. - -Wed Mar 28 14:23:23 2001 Yukihiro Matsumoto - - * 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 - - * win32/Makefile.sub: disable global optimization. - -Tue Mar 27 15:00:54 2001 K.Kosako - - * 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 - - * ruby.h: changed "extern INLINE" to "static inline". - -Mon Mar 26 23:19:33 2001 WATANABE Hirofumi - - * time.c (rb_strftime): check whether strftime returns empty string. - -Mon Mar 26 21:16:56 2001 Shugo Maeda - - * lib/net/imap.rb: supports response handlers and multiple commands. - -Mon Mar 26 17:21:07 2001 Yukihiro Matsumoto - - * eval.c: remove TMP_PROTECT_END to prevent C_ALLOCA crash. - -Mon Mar 26 14:04:41 2001 WATANABE Hirofumi - - * ext/Win32API/Win32API.c: remove Init_win32api(). - -Sun Mar 25 16:52:48 2001 Koji Arai - - * 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 - - * 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 - - * 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 - - * pack.c (pack_unpack): string from P/p should be tainted. - -Fri Mar 23 12:18:44 2001 SHIROYAMA Takayuki - - * 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 - - * marshal.c (w_object): should truncate trailing zero short for - bignums. - -Fri Mar 23 09:49:02 2001 Yukihiro Matsumoto - - * object.c (sym_intern): new method. - -Thu Mar 22 22:15:45 2001 WATANABE Hirofumi - - * ext/Win32API/extconf.rb: add -fno-omit-frame-pointer. - -Thu Mar 22 18:17:36 2001 Yukihiro Matsumoto - - * eval.c (rb_mod_nesting): should not include Object at the - toplevel. - -Thu Mar 22 17:43:44 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * win32/win32.c (win32_stat): WinNT/2k "//host/share" support. - -Wed Mar 21 08:05:35 2001 Nobuyoshi Nakada - - * win32/dir.h: replace missing/dir.h . - - * win32/win32.h: ditto. - - * win32/win32.c: ditto. - -Wed Mar 21 01:26:14 2001 Yukihiro Matsumoto - - * gc.c (id2ref): sometimes confused symbol and reference. - -Tue Mar 20 23:09:33 2001 WATANABE Hirofumi - - * win32/win32.c (win32_stat): UNC support. - - * dir.c (extract_path): fix "./*" problem. - -Tue Mar 20 15:10:00 2001 Yukihiro Matsumoto - - * dir.c (glob_helper): breaks loop after calling recusive - 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 Koji Arai - - * object.c (sym_inspect): did allocate extra byte space. - -Mon Mar 19 19:14:47 2001 Guy Decoux - - * marshal.c (shortlen): shortlen should return number of bytes - written. - -Mon Mar 19 16:52:23 2001 K.Kosako - - * 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 - - * time.c (time_zone): return "UTC" for UTC time objects. - -Mon Mar 19 16:27:32 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * lib/cgi.rb: // === '' --> //.match('') - - * lib/cgi.rb: cgi#header(): improvement for mod_ruby. - - * lib/cgi.rb: cgi#rfc1123date(): improvement. - thanks to TADA Tadashi . - - * lib/cgi.rb: cgi#rfc1123date(): document bug fix. - thanks to Kazuhiro NISHIYAMA . - - * lib/cgi.rb: cgi#header(): bug fix. - thanks to IWATSUKI Hiroyuki . - -Sat Mar 17 11:11:24 2001 Yukihiro Matsumoto - - * dir.c (glob_helper): * should follow symlink, whereas ** should - not follow. - -Thu Mar 15 01:28:02 2001 Yukihiro Matsumoto - - * dir.c (dir_s_chdir): block form of Dir.chdir. (RCR#U016). - -Fri Mar 16 17:14:17 2001 Akinori MUSHA - - * 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 - - * eval.c (rb_thread_schedule): raise FATAL just once to - THREAD_TO_KILL. - -Wed Mar 14 10:41:34 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * dir.c (rb_glob_helper): fix drive letter handling on DOSISH. - -Tue Mar 13 14:54:39 2001 Minero Aoki - - * 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 - - * io.c (argf_seek_m): wrong calling sequence of rb_io_seek(). - -Tue Mar 13 09:14:19 2001 Yukihiro Matsumoto - - * parse.y (cond0): no special treatment of string literal in - condition. - -Mon Mar 12 18:59:38 2001 WATANABE Hirofumi - - * lib/mkmf.rb (create_makefile): save/restore $libs and $LIBPATH. - -Sun Mar 11 18:13:34 2001 Masahiro Tanaka - - * math.c: add acos, asin, atan, conh, sinh, tanh and hypot to Math. - - * configure.in: check hypot availablility. - - * missing/hypot.c: public domain rewrite of hypot. - -Sun Mar 11 13:21:04 2001 Koji Arai - - * 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 - - * lib/mkmf.rb (install_rb): fix handling of destination path. - -Sat Mar 10 22:56:44 2001 Yukihiro Matsumoto - - * 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 retruns true for any of elements. - -Sat Mar 10 02:34:18 2001 WATANABE Hirofumi - - * 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 - - * marshal.c (marshal_load): do not give warning unless explicitly - set to verbose. - -Fri Mar 9 02:07:53 2001 Yukihiro Matsumoto - - * 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 - - * lib/net/protocol.rb: one write(2) per one line. - -Wed Mar 7 14:26:11 2001 WATANABE Hirofumi - - * math.c (math_log, math_log10): should return NaN if x < 0.0 - on Cygwin. - -Thu Mar 7 10:31:26 2001 Nobuyoshi Nakada - - * parse.y (stmt): while/until modifier must work for empty body. - -Tue Mar 6 22:53:58 2001 Kazuhiro Yoshida - - * ruby.c (ruby_set_argv): clear ARGV contents before adding args. - -Tue Mar 6 10:50:29 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * win32/win32.c (gettimeofday): use GetLocalTime() instead of ftime() - for high-resolution timing. - -Sun Mar 4 17:01:09 2001 WATANABE Hirofumi - - * string.c (trnext): support backslash escape in String#tr. - -Sat Mar 3 16:15:16 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * dir.c (rb_glob_helper): "./foo" should match "foo", not "./foo". - -Tue Feb 27 16:38:15 2001 Yukihiro Matsumoto - - * 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 shoule 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 - - * 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 - - * 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 - - * 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 - - * ext/extmk.rb.in, lib/mkmf.rb: add C++ rules in addition to C - rules. - -Mon Feb 26 00:04:52 2001 Yukihiro Matsumoto - - * 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 - - * lib/net/telnet.rb: #telnetmode(), #binmode(): bug fix. - thanks to nobu.nakada@nifty.ne.jp. - -Mon Feb 26 04:55:50 2001 Wakou Aoyama - - * lib/cgi.rb: CGI#form(): bug fix. - thanks to MoonWolf . - - * lib/cgi.rb: CGI#rfc1123_date(): improvement. - thanks to Tomoyasu Akita . - - * lib/cgi.rb: CGI#header(): improvement for mod_ruby. - thanks to Shugo Maeda . - -Sun Feb 25 02:45:30 2001 WATANABE Hirofumi - - * file.c (rb_file_s_rename): avoid Cygwin's bug. - -Sat Feb 24 23:32:55 2001 Yukihiro Matsumoto - - * eval.c (rb_thread_fd_close): should save current context before - raising exception. - -Sat Feb 24 22:14:00 2001 WATANABE Hirofumi - - * win32/win32.c (myrename): fix error handling. - -Sat Feb 24 13:58:48 2001 Minero Aoki - - * 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 - - * io.c (set_stdin): preserve original stdin. - - * io.c (set_outfile): preserve original stdout/stderr. - -Fri Feb 23 08:28:58 2001 Minero Aoki - - * 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 - - * process.c: add W* macro if not available. - -Tue Feb 20 16:37:58 2001 Yukihiro Matsumoto - - * 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 - - * string.c (rb_str_substr): "a"[1,2] should return ""; need - rubicon upgrade. - -Mon Feb 19 12:10:36 2001 Triet H. Lai - - * 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 - - * eval.c (secure_visibility): visibility check for untainted modules. - -Mon Feb 19 00:29:29 2001 Nobuyoshi Nakada - - * 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 - - * 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 - - * lib/net/http.rb: Response#range_length was not debugged. - -Sun Feb 18 04:02:03 2001 Yasushi Shoji - - * array.c (rb_ary_subseq): wrong boundary check. - -Sun Feb 18 00:09:50 2001 Nobuyoshi Nakada - - * 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 - - * parse.y (cond0): integer literal in condition should not be - compared to lineno ($.). - -Fri Feb 16 01:44:56 2001 Yukihiro Matsumoto - - * 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 - - * lib/cgi/session.rb (close): fixed reversed condition. - -Thu Feb 15 08:34:14 2001 Yukihiro Matsumoto - - * process.c (proc_waitall): new method based on a patch from Brian - Fundakowski Feldman . - - * process.c (last_status_set): objectify $? value (Process::Status). - -Wed Feb 14 17:28:24 2001 Shugo Maeda - - * lib/net/imap.rb: supports unknown resp_text_code. - -Wed Feb 14 00:44:17 2001 Yukihiro Matsumoto - - * 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 - - * dir.c (lstat): should use rb_sys_stat if lstat(2) is not - available. - -Tue Feb 13 08:43:10 2001 Yukihiro Matsumoto - - * 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 - - * eval.c (rb_load): raise LocaJumpError 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 - - * 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 - - * hash.c (rb_any_hash): dumped core on machines sizeof(int) != sizeof(long). - -Sat Feb 10 23:07:15 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * ruby.c (ruby_init_loadpath): convert '\\' to '/' - before finding executable file path. - -Fri Feb 9 17:41:53 2001 Triet H. Lai - - * dir.c (rb_glob_helper): do not follow symbolic links. - -Thu Feb 8 21:27:24 2001 WATANABE Hirofumi - - * 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 - - * 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 - - * 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 - - * parse.y (parse_quotedwords): %w should allow parenthesis escape. - -Wed Feb 7 00:57:42 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * error.c (Init_Exception): make Interrupt a subclass of - SignalException. - -Mon Feb 5 00:39:06 2001 KANEKO Naoshi - - * 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 - - * 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 - - * 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 - - * 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 - - * array.c (rb_ary_fetch): new method. - -Mon Jan 29 17:36:19 2001 TOYOFUKU Chikanobu - - * 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 - - * eval.c (block_pass): return from block jumps directory to - block invoker. - -Mon Jan 29 01:40:27 2001 Yukihiro Matsumoto - - * string.c (str_independent): should not clear str->orig here. - it's too early. - -Fri Jan 26 01:42:40 2001 Yukihiro Matsumoto - - * parse.y: clarify do ambiguity, bit more complex but natural - from my point of view. - -Wed Jan 24 14:58:08 2001 Akinori MUSHA - - * 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 - - * 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 - - * 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 - - * 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 - - * mkconfig.rb: autoconf 2.49 support. - -Mon Jan 22 00:32:44 2001 Yukihiro Matsumoto - - * eval.c (block_pass): behavior consistency with proc_call(). do - not propagate `break'. - -Sat Jan 20 03:54:00 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * configure.in: remove DEFS definition. - - * mkconfig.rb: ditto. - - * win32/config.status.in: ditto. - -Tue Jan 16 17:00:50 2001 Minero Aoki - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * enum.c (enum_inject): new method. - -Tue Jan 9 02:16:42 2001 Yukihiro Matsumoto - - * 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 - - * 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 - - * file.c (path_check_1): should restore modified path. - -Mon Jan 8 03:09:58 2001 Yukihiro Matsumoto - - * 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 - - * pack.c (pack_pack): avoid infinite loop(pack 'm2'). - -Fri Jan 5 01:02:17 2001 Yukihiro Matsumoto - - * 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 - - * re.c (reg_s_last_match): Regexp::last_match(nth) returns nth - substring of the match (alternative for $& and $). - -Sun Dec 31 01:39:16 2000 Guy Decoux - - * eval.c (rb_mod_define_method): wrong comparison for blocks. - -Sat Dec 30 19:28:50 2000 Yukihiro Matsumoto - - * gc.c (id2ref): should handle Symbol too. - - * gc.c (id2ref): should print original ptr value - -Sat Dec 30 03:14:22 2000 Yukihiro Matsumoto - - * 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 - - * gc.c (mem_error): prohibit recursive mem_error(). - (ruby-bugs-ja:PR#36) - -Fri Dec 29 11:05:41 2000 Yukihiro Matsumoto - - * 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 - - * m17n.c: new file - core functions of M17N. - -Tue Dec 26 18:46:41 2000 NAKAMURA Hiroshi - - * 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 - - * 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 - - * string.c (rb_str_inspect): should treat multibyte chracters - properly. - -Mon Dec 25 17:49:08 2000 K.Kosako - - * 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 - - * 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 - - * stable version 1.6.2 released. - -Mon Dec 25 05:11:04 2000 Wakou Aoyama - - * 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 - - * lib/net/http.rb: does not send HEAD on closing socket. - -Mon Dec 25 00:44:48 2000 Yukihiro Matsumoto - - * 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 - - * eval.c (rb_thread_schedule): initial value of `max' changed to -1. - -Mon Dec 25 00:16:14 2000 Yukihiro Matsumoto - - * 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 - - * bignum.c (rb_cstr2inum): Integer("") should not return 0. - -Sat Dec 23 11:55:57 2000 Yukihiro Matsumoto - - * array.c (rb_ary_and): Array#& should preverve original order. - -Sat Dec 23 03:44:16 2000 Minero Aoki - - * 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 - - * eval.c (rb_feature_p): ext might be null. - -Fri Dec 22 17:04:12 2000 Nobuyoshi Nakada - - * win32/win32.c (myselect): avoid busy loop by adjusting fd_count. - -Fri Dec 22 15:07:55 2000 Yukihiro Matsumoto - - * bignum.c (rb_cstr2inum): prefix like '0x' had removed too much. - -Thu Dec 21 13:01:46 2000 Tanaka Akira - - * lib/net/ftp.rb (makeport): don't use TCPsocket.getaddress. - -Wed Dec 20 12:00:15 2000 Yukihiro Matsumoto - - * bignum.c (rb_big_lshift): should cast up to BDIGIT_DBL. - - * parse.y (yylex): disallow trailing '_' for numeric litrals. - - * 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 - - * io.c (rb_f_p): should flush rb_defout, not stdout. - -Tue Dec 19 00:57:10 2000 Yukihiro Matsumoto - - * 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 - - * util.c (mblen, __crt0_glob_function): add for multibyte - on DJGPP 2.03. - -Mon Dec 18 18:10:30 2000 Yukihiro Matsumoto - - * time.c (time_plus): usec might underflow (ruby-bugs-ja:#PR33). - -Mon Dec 18 08:11:20 2000 Yukihiro Matsumoto - - * hash.c (rb_hash_set_default): should call rb_hash_modify(). - -Sat Dec 16 02:58:26 2000 Minero Aoki - - * eval.c (rb_eval): should clear ruby_errinfo on retry. - - * eval.c (rb_rescue2): ditto. - -Thu Dec 14 13:06:18 2000 Nobuyoshi Nakada - - * class.c (rb_include_module): prohibit fronzen 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 - - * 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 - - * 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 - - * ruby.c (proc_options): accept "--^M" for DOS line endings. - -Tue Dec 12 15:45:42 2000 Yukihiro Matsumoto - - * parse.y (newline_node): cancel newline unification. - -Mon Dec 11 23:01:57 2000 Yukihiro Matsumoto - - * parse.y (yylex): supports cases `?' precedes EOF and newline. - -Mon Dec 11 12:11:25 2000 Yukihiro Matsumoto - - * eval.c (call_end_proc): some frame members were left - uninitialized. - -Mon Dec 11 01:14:58 2000 Yukihiro Matsumoto - - * io.c (rb_io_fptr_finalize): do not fclose stdin, stdout and - stderr at exit. - -Sat Dec 9 17:34:48 2000 Tachino Nobuhiro - - * 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 - - * sprintf.c (rb_f_sprintf): proper string precision treat. - -Fri Dec 8 10:44:05 2000 Yukihiro Matsumoto - - * variable.c (rb_mod_remove_cvar): Module#remove_class_variable - added. - -Thu Dec 7 17:35:51 2000 Shugo Maeda - - * eval.c (stack_length): don't use __builtin_frame_address() on alpha. - -Wed Dec 6 18:07:13 2000 WATANABE Hirofumi - - * 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 - - * array.c (rb_ary_and): tuning, make hash from shorter operand. - -Wed Dec 6 01:28:50 2000 SHIROYAMA Takayuki - - * 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 - - * lib/jcode.rb: consider multibyte. not /n. - -Mon Dec 4 09:49:36 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * eval.c (rb_eval): should not redefine builtin classes/modules - from within wrapped load. - -Mon Nov 27 08:57:33 2000 Yukihiro Matsumoto - - * eval.c (call_end_proc): should be isolated from outer block. - -Mon Nov 27 00:10:08 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * range.c (EXCL): exclusive infomation 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 - - * process.c (proc_waitpid2): returns nil if no pid found. - -Wed Nov 22 23:45:15 2000 Yukihiro Matsumoto - - * range.c (range_eq): new method. Compares start and end of range - respectively. - -Wed Nov 22 11:01:32 2000 Yukihiro Matsumoto - - * variable.c (rb_mod_class_variables): should honor singleton - class variable rule defined yesterday. - -Tue Nov 21 23:24:14 2000 Mitsuteru S Nakao - - * numeric.c (flodivmod): missing second operand (typo). - -Tue Nov 21 03:39:41 2000 Yukihiro Matsumoto - - * marshal.c (marshal_load): marshal format compatibility check - revised. greater minor revision is UPWARD compatibile; - 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 - - * 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 - - * dir.c, win32/win32.c, ruby.h: add rb_iglob(). - -Mon Nov 20 00:18:16 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * lib/net/http.rb: Socket#readline() reads until "\n", not "\r\n" - -Fri Nov 17 14:55:18 2000 WATANABE Hirofumi - - * string.c (rb_str_succ): output should be NUL terminated. - -Fri Nov 17 02:54:15 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * bignum.c (bigdivrem): should have incremented ny first. - -Thu Nov 16 14:58:00 2000 Nobuyoshi Nakada - - * 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 - - * 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 - - * 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 - - * error.c (rb_bug): print version to stderr. - -Mon Nov 13 19:02:08 2000 WATANABE Hirofumi - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * bignum.c (bigdivrem): use bit shift to make y's MSB set. - -Mon Nov 6 1:22:49 2000 Yukihiro Matsumoto - - * 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 - - * random.c (rb_f_rand): half-baked float support fixed. This fix - was originally proposed by K.Kosako . - -Tue Oct 31 17:27:17 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * bignum.c (rb_cstr2inum): wrongly assigned base to c before - badcheck check. - -Thu Oct 26 02:42:50 2000 Minero Aoki - - * 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 - - * 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 - - * eval.c (rb_eval): ARGSPUSH should not modify args array. - -Thu Oct 19 14:58:17 2000 WATANABE Tetsuya - - * pack.c (NUM2U32): should use NUM2ULONG(). - -Tue Oct 17 17:30:34 2000 WATANABE Hirofumi - - * eval.c (error_print): ruby_sourcefile may be NULL. - -Tue Oct 17 16:36:28 2000 Wes Nakamura - - * pack.c (NATINT_U32): wrong use of sizeof. - -Tue Oct 17 12:48:20 2000 Katsuyuki Komatsu - - * 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 - - * 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 - - * object.c (sym_inspect): used `name' before initialization. - -Mon Oct 16 14:06:00 2000 Yukihiro Matsumoto - - * 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 - - * lib/net/http.rb: hex-alpha is not [a-h] but [a-f]. - -Mon Oct 16 01:02:02 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * lib/net/imap.rb: new file. - -Thu Oct 12 18:56:28 2000 Minero Aoki - - * 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 - - * lib/cgi.rb: bug fix: CGI::html(): PRETTY option didn't work. - -Thu Oct 12 00:03:02 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * eval.c (rb_thread_start_0): should check insecure exit. - -Wed Oct 11 14:29:51 2000 Minero Aoki - - * 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 - - * 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 - - * dln.c (dln_load): remove unused code for Cygwin. - -Tue Oct 10 09:49:23 2000 Yukihiro Matsumoto - - * file.c (Init_File): FileTest.size should return 0 (not nil) for - empty files. - -Sun Oct 8 13:20:26 2000 Guy Decoux - - * eval.c (POP_SCOPE): not just set SCOPE_DONT_RECYCLE, but do - scope_dup(). - -Sat Oct 7 15:10:50 2000 Yukihiro Matsumoto - - * string.c (rb_str_reverse_bang): unnecessary ALLOCA_N() was - removed. - -Fri Oct 6 14:50:24 2000 WATANABE Hirofumi - - * 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 - - * 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 - - * object.c (rb_obj_dup): should have propagated taint flag. - (ruby-bugs:#PR64,65) - -Wed Oct 4 00:26:11 2000 Yukihiro Matsumoto - - * eval.c (proc_arity): proc{|a|}'s arity should be -1. - -Mon Oct 2 05:28:58 2000 akira yamada - - * string.c (trnext): minus at the end of pattern. - -Sun Oct 1 00:43:34 2000 WATANABE Hirofumi - - * configure.in: exp-name was wrong on cygwin and mingw32. - -Thu Sep 28 14:57:09 2000 Yukihiro Matsumoto - - * regex.c (re_compile_pattern): should try must_string calculation - every time. - -Tue Sep 19 23:47:44 2000 SHIROYAMA Takayuki - - * configure.in, config.guess, config.sub: MacOS X support. - -Wed Sep 27 18:40:05 2000 Yukihiro Matsumoto - - * stable version 1.6.1 released. - -Wed Sep 27 16:13:05 2000 WATANABE Hirofumi - - * mkconfig.rb: variables should be expanded only if /\$\{?\w+\}?/. - -Tue Sep 26 18:09:51 2000 WATANABE Hirofumi - - * string.c: include - -Tue Sep 26 15:59:50 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * regex.c: include . - - * 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 - - * win32/win32.c (NtCmdGlob): substitute '\\' with '/'. - -Mon Sep 25 00:35:01 2000 WATANABE Hirofumi - - * defines.h: #undef HAVE_SETITIMER on cygwin. - -Sun Sep 24 03:01:53 2000 Minero Aoki - - * lib/net/protocol.rb, http.rb: typo. - -Sat Sep 23 07:33:20 2000 Aleksi Niemela - - * regex.c (re_compile_pattern): nicer regexp error messages for - invalid patterns. - -Sat Sep 23 03:06:25 2000 Yukihiro Matsumoto - - * variable.c (rb_autoload_load): should not require already - provided features. - -Fri Sep 22 15:46:21 2000 Minero Aoki - - * lib/net/http.rb: too early parameter expansion in string. - -Fri Sep 22 13:58:51 2000 WATANABE Hirofumi - - * ext/extmk.rb.in: don't use default $: - -Fri Sep 22 13:42:50 2000 Katsuyuki Komatsu - - * 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 - - * win32/config.h.in: add HAVE_TELLDIR, HAVE_SEEKDIR - -Thu Sep 21 19:04:34 2000 WATANABE Hirofumi - - * ext/extmk.rb, lib/mkmf.rb (install_rb): check whether libdir is - directory or not. - -Thu Sep 21 17:23:05 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * lib/find.rb (find): should not follow symbolic links; - tuned performance too. - -Wed Sep 20 23:21:38 2000 Yukihiro Matsumoto - - * 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 - - * 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): fiil dyna_vars field by ruby_dyna_vars. - -Tue Sep 19 17:47:03 2000 Yukihiro Matsumoto - - * stable version 1.6.0 released. - -Tue Sep 19 16:24:52 2000 Yukihiro Matsumoto - - * marshal.c (Init_marshal): provide marshal.so no more. - -Tue Sep 19 14:01:01 2000 WATANABE Hirofumi - - * configure.in, win32/setup.mak: include version number - in RUBY_SO_NAME. - -Tue Sep 19 13:07:47 2000 Yukihiro Matsumoto - - * parse.y (yylex): was confusing $~ and $_. - -Tue Sep 19 13:06:53 2000 GOTOU YUUZOU - - * 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 - - * 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 - - * 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 - - * eval.c (rb_thread_yield): array strip should be done in this - function. - -Wed Sep 13 17:01:03 2000 Yukihiro Matsumoto - - * bignum.c (rb_big_eq): incomplete value comparison of bignums. - -Wed Sep 13 06:39:54 2000 Yukihiro Matsumoto - - * variable.c (rb_mod_class_variables): Module#class_variables added. - -Wed Sep 13 06:09:26 2000 Wakou Aoyama - - * lib/cgi.rb: bug fix: CGI::header(): output status header. - -Wed Sep 13 01:09:12 2000 Yukihiro Matsumoto - - * parse.y (yylex): allow global variables like '$__a'. - -Tue Sep 12 22:28:43 2000 WATANABE Hirofumi - - * ext/socket/extconf.rb: avoid using terrible - on cygwin 1.1.5. - -Tue Sep 12 16:01:58 2000 WATANABE Hirofumi - - * array.c (rb_ary_unshift_m): typo. - -Tue Sep 12 15:37:55 2000 Yukihiro Matsumoto - - * eval.c (rb_yield_0): stripped array too much, should remove just - for proc_call(). - -Tue Sep 12 07:05:24 2000 Wakou Aoyama - - * 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 - - * 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 - - * 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 - - * 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 - - * gc.c (STR_NO_ORIG): should be FL_USER2. - -Thu Sep 7 14:17:51 2000 Yukihiro Matsumoto - - * string.c (rb_str_cat): should work even for concatenating same - string. - -Wed Sep 6 17:06:38 2000 Yukihiro Matsumoto - - * variable.c (rb_cvar_declare): should check superclass's class - variable first. - -Wed Sep 6 10:42:02 2000 Yukihiro Matsumoto - - * 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 - - * misc/ruby-mode.el (ruby-parse-region): modifier was not handled - well on emacs19. - -Tue Sep 5 17:10:12 2000 Yukihiro Matsumoto - - * time.c (time_to_s): fixed zone string UTC for utc time object. - -Tue Sep 5 00:26:06 2000 Yukihiro Matsumoto - - * regex.c (re_search): range worked wrongly on bm_search(). - -Mon Sep 4 13:40:40 2000 WATANABE Hirofumi - - * configure.in: renamed libruby.a to libruby.{cygwin,mingw32}.a - on cygwin and mingw32. - -Sun Sep 3 23:44:04 2000 Noriaki Harada - - * io.c (NO_SAFE_RENAME): for BeOS too. - -Sun Sep 3 11:31:53 2000 Takaaki Tateishi - - * parse.y (rescue): no assignment was done if rescue body was - empty. - -Sat Sep 2 10:52:21 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * ext/Win32API/Win32API.c (Win32API_initialize): AlphaNT support. - -Wed Aug 30 14:19:07 2000 Yukihiro Matsumoto - - * parse.y (node_assign): should support NODE_CVASGN2 too. - -Wed Aug 30 11:31:47 2000 Nobuyoshi Nakada - - * 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 - - * io.c (rb_f_p): flush output buffer. - -Tue Aug 29 16:29:15 2000 Yukihiro Matsumoto - - * parse.y (assignable): remove NODE_CVASGN3. - - * parse.y (gettable): remove NODE_CVAR3. - -Tue Aug 29 02:02:14 2000 Yukihiro Matsumoto - - * 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 - - * 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 . - -Fri Aug 25 15:24:39 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * ext/socket/socketport.h: use `extern int h_errno' if needed. - -Sat Aug 19 01:34:02 2000 WATANABE Hirofumi - - * 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 - - * eval.c (rb_eval): should preserve and clear $! value before - compilation. - - * eval.c (eval): ditto. - -Fri Aug 18 11:06:19 2000 Shugo Maeda - - * ext/socket/socket.c (s_accept): start GC on EMFILE/ENFILE. - -Thu Aug 17 16:04:48 2000 Yukihiro Matsumoto - - * eval.c (is_defined): should clear ruby_errinfo. - -Thu Aug 17 04:26:31 2000 Minero Aoki - - * 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 - - * time.c (time_s_times): use CLK_TCK for HZ if it's defined. - -Tue Aug 15 17:30:59 2000 Yukihiro Matsumoto - - * 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 - - * configure.in: add ac_cv_func_times=yes for mingw32. - - * win32/win32.c (mytimes): typo. - -Tue Aug 15 01:45:28 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * eval.c (rb_undef): give warning for undefining __id__, __send__. - -Thu Aug 10 08:05:03 2000 Yukihiro Matsumoto - - * eval.c (rb_callcc): returned current thread instead of - continuation wrongly. - -Thu Aug 10 05:40:28 2000 WATANABE Hirofumi - - * 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 - - * 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 - - * win32/win32.[ch]: emulate rename(2). - -Tue Aug 8 14:01:46 2000 WATANABE Hirofumi - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * ruby.c (rubylib_mangle): provide another buffer for the result. - -Wed Jul 26 10:09:01 2000 WATANABE Hirofumi - - * 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 - - * 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 - - * 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 - - * io.c (rb_p): redirect to $defout. - -Mon Jul 24 18:52:55 2000 WATANABE Hirofumi - - * win32/win32.c (win32_getenv): should remove `static'. - - * ruby.c (rubylib_mangle): support "/hoge;/foo" - -Mon Jul 24 10:28:55 2000 GOTO Kentaro - - * string.c (rb_str_count): raise exception if no argument is - given. - -Sun Jul 23 12:55:04 2000 Dave Thomas - - * string.c (rb_str_rindex): Support negative end position. - -Fri Jul 21 17:35:01 2000 Yukihiro Matsumoto - - * 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 - - * bignum.c (bigdivrem): should use rb_int2big(), not rb_uint2big(). - -Tue Jul 18 14:58:30 2000 Yukihiro Matsumoto - - * 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 - - * lib/mkmf.rb: converts extension of $objs into $OBJEXT. - -Sun Jul 16 03:02:34 2000 Dave Thomas - - * lib/weakref.rb: Change to use new ObjectSpace calls. - -Sat Jul 15 21:59:58 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * cygwin/GNUmakefile.in: use miniruby instead of sed. - -Fri Jul 14 12:49:50 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * bignum.c (bigdivrem): defer bignorm(). - - * bignum.c (bignorm): accepts accidental fixnums. - -Tue Jul 11 16:54:17 2000 Yukihiro Matsumoto - - * parse.y (yylex): `@' is no longer a valid instance - variable name. - -Tue Jul 11 01:51:50 2000 Yukihiro Matsumoto - - * 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 - - * io.c (pipe_finalize): should set rb_last_status when pclose(). - -Mon Jul 10 09:07:54 2000 Yukihiro Matsumoto - - * error.c (rb_bug): print version number and such too. - -Sat Jul 8 23:08:40 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * win32/win32.c (NtCmdGlob): patterns should be separated and - NUL terminated. - -Wed Jul 5 22:27:56 2000 WATANABE Hirofumi - - * 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 - - * 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 - - * ext/extmk.rb.in: join ' ' -> join(' '). - - * lib/mkmf.rb: ditto. - -Tue Jul 4 13:51:29 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * util.c (rb_type): should add T_UNDEF. - -Tue Jul 4 09:30:35 2000 Yukihiro Matsumoto - - * 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 - - * win32/ruby.def: remove ruby_mktemp. - -Tue Jul 4 01:27:13 2000 Yukihiro Matsumoto - - * 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 - - * numeric.c (Init_Numeric): forgot to register Numeric#remainder. - -Mon Jul 3 23:46:56 2000 Katsuyuki Komatsu - - * 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 - - * lib/mkmf.rb: use null device if it exists for cross-compiling. - -Mon Jul 3 18:19:51 2000 Minero Aoki - - * 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 - - * 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 - - * 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 - - * configure.in: use AC_CANONICAL_SYSTEM. - -Sun Jul 2 21:17:37 2000 WATANABE Hirofumi - - * 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 - - * eval.c (TMP_PROTECT_END): tmp__protect_tmp may be NULL. - -Sun Jul 2 03:37:50 2000 Minero Aoki - - * 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 - - * numeric.c (fix_rshift): should handle shift value more than - sizeof(long). - -Sat Jul 1 15:22:35 2000 Yukihiro Matsumoto - - * 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 - - * re.c (rb_reg_initialize): was freeing invalid pointer. - -Sat Jul 1 03:25:56 2000 Yukihiro Matsumoto - - * 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 - - * parse.y (f_norm_arg): better, nicer error message. - -Thu Jun 29 07:45:33 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * config.sub: NetBSD/hpcmips support. - -Wed Jun 28 10:11:06 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * win32.c (myfdclr): new function. - - * win32.h: add FD_CLR. - -Mon Jun 26 23:41:41 2000 WATANABE Hirofumi - - * 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 - - * 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 - - * eval.c (rb_thread_schedule): wait_for cleared too early. - -Mon Jun 26 09:15:31 2000 Yukihiro Matsumoto - - * pack.c: remove obsolete 'F', 'D' specifiers. - -Sun Jun 25 00:55:03 2000 Katsuyuki Komatsu - - * 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 - - * config*.dj, configure.bat, top.sed: move to djgpp/. - -Sat Jun 24 02:34:17 2000 Yukihiro Matsumoto - - * ruby.c (load_file): call require_libraries() here to let - debug.rb work properly. - -Fri Jun 23 22:34:51 2000 Katsuyuki Komatsu - - * 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 - - * 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 - - * 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 - - * lib/net/ftp.rb: support resuming. - -Thu Jun 22 13:37:19 2000 WATANABE Hirofumi - - * eval.c (rb_thread_sleep_forever): merge pause() macro. - -Wed Jun 21 08:49:04 2000 Yukihiro Matsumoto - - * eval.c (rb_eval): should not raise exception just by defining - singleton class. - -Wed Jun 21 01:18:03 2000 Yukihiro Matsumoto - - * 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 - - * time.c (make_time_t): bug in DST boundary. - -Tue Jun 20 10:54:19 2000 WATANABE Hirofumi - - * configure.in: add eval sitedir. - -Tue Jun 20 06:14:43 2000 Wakou Aoyama - - * 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 - - * 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 - - * variable.c (rb_cvar_set): forgot to add security check for class - variable assignment. - -Sun Jun 18 22:49:13 2000 WATANABE Hirofumi - - * 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 - - * 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 - - * 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 - - * re.c (rb_reg_clone): should initialize member fields. - -Fri Jun 16 22:49:34 2000 Yukihiro Matsumoto - - * io.c (rb_io_rewind): set lineno to zero. - -Fri Jun 16 22:47:47 2000 Minero Aoki - - * 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 - - * configure.in: add pause(2) checking. - - * eval.c: define pause() if missing. - -Fri Jun 16 18:41:58 2000 Koji Arai - - * 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 - - * file.c (rb_stat_inspect): gives detailed information; - compatibility with ruby-1.4.x. - -Fri Jun 16 05:18:45 2000 Yasuhiro Fukuma - - * configure.in: FreeBSD: do not link dummy libxpg4 which was - merged into libc. - -Fri Jun 16 03:17:36 2000 Satoshi Nojo - - * 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 - - * eval.c (rb_thread_sleep_forever): pause(2) instead of sleep(3). - -Thu Jun 15 10:46:36 2000 Yukihiro Matsumoto - - * string.c (rb_str_sub_bang): should probagate taintness from - replacement string. - -Wed Jun 14 17:01:41 2000 Katsuyuki Komatsu - - * rubytest.rb: add CONFIG['EXEEXT'] to the executable file name. - -Wed Jun 14 14:50:00 2000 Yukihiro Matsumoto - - * 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 - - * 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 when daylight checking. - -Wed Jun 14 11:36:52 2000 WATANABE Hirofumi - - * marshal.c (r_object): modified for symbols. - - * marshal.c (w_object): ditto. - -Wed Jun 14 10:04:58 2000 Yukihiro Matsumoto - - * 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 - - * io.c (rb_io_set_lineno): should have returned VALUE, not - integer. - -Wed Jun 14 09:29:42 2000 Yukihiro Matsumoto - - * string.c (rb_str_dup): dup should always propagate taintness. - -Wed Jun 14 00:50:14 2000 Wakou Aoyama - - * lib/cgi.rb: read_multipart(): if no content body then raise EOFError. - -Tue Jun 13 11:46:17 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * configure.in (daylight): avoid GCC optimization. - -Mon Jun 12 19:02:27 2000 WATANABE Hirofumi - - * configure.in: cygwin has strange timezone. - - * time.c (time_zone): use tzname and daylight. - -Sat Jun 10 23:10:32 2000 Yukihiro Matsumoto - - * io.c (rb_io_seek): whence is optional, default is SEEK_SET. - -Fri Jun 9 17:00:29 2000 Minero Aoki - - * 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 - - * 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 - - * 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 - - * numeric.c: add nan?, infinite?, and finite? to Float - -Thu Jun 8 00:31:04 2000 WATANABE Hirofumi - - * 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 - - * file.c (rb_file_s_basename): might dump core. - -Tue Jun 6 03:29:12 2000 Yukihiro Matsumoto - - * 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 - - * bignum.c: avoid conflict with USHORT on mingw32. - -Mon Jun 5 00:13:35 2000 WATANABE Hirofumi - - * eval.c (rb_thread_schedule): =/== typo. - -Sun Jun 4 03:17:36 2000 Wakou Aoyama - - * lib/cgi.rb: improve: CGI::pretty() - -Sun Jun 4 02:01:10 2000 WATANABE Hirofumi - - * lib/mkmf.rb: do not need to add -L$(topdir) in --enable-shared case. - -Sat Jun 3 13:50:06 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - - * eval.c (rb_thread_cleanup): should clear priority for thread - termination. - -Thu Jun 01 22:39:41 2000 Minero Aoki - - * 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 - - * eval.c (rb_yield_0): convert Qundef to []. - -Wed May 31 20:45:59 2000 Dave Thomas - - * string.c (rb_str_slice_bang): wrong argument number. - -Wed May 31 12:37:04 2000 Yukihiro Matsumoto - - * eval.c (rb_exec_end_proc): print error message from END procs. - -Wed May 31 04:06:41 2000 Wakou Aoyama - - * lib/cgi.rb: change: CGI#out() if "HEAD" == REQUEST_METHOD then - output only HTTP header. - -Wed May 31 01:54:21 2000 Yukihiro Matsumoto - - * 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 - - * lib/mkmf.rb (create_makefile): add $(TARGET).ilk and *.pdb - to cleanup files for mswin32. - -Mon May 29 10:41:10 2000 Nobuyoshi Nakada - - * file.c (rb_file_s_basename): should propagate taintness. - -Sun May 28 21:37:13 2000 WATANABE Hirofumi - - * eval.c: bug fix: DLEXT2. - -Sun May 28 19:21:43 2000 WATANABE Hirofumi - - * 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 - - * ext/extmk.rb.in: use "ftools" instead of "rm -f". - - * lib/mkmf.rb: ditto. - -Thu May 25 22:01:32 2000 Katsuyuki Komatsu - - * 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 - - * re.c (rb_reg_expr_str): escape un-printable character. - -Thu May 25 01:35:15 2000 Yukihiro Matsumoto - - * 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 - - * object.c (rb_mod_initialize): should provide initialize. - -Wed May 24 23:17:50 2000 Katsuyuki Komatsu - - * win32/Makefile: remove unnecessary mv and rm command call. - -Wed May 24 21:01:04 2000 Katsuyuki Komatsu - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * struct.c (rb_struct_getmember): should use ID2SYM, not INT2NUM. - -Mon May 22 15:07:37 2000 Yukihiro Matsumoto - - * file.c (rb_find_file): should check if the file really exists. - -Mon May 22 09:08:12 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * pack.c: fix OFF16 and OFF32 definitions for Alpha and IRIX64. - -Sun May 21 17:31:37 2000 WATANABE Hirofumi - - * instruby.rb: support "make install" for cross-compiling. - - * ext/extmk.rb.in: ditto. - -Sun May 21 14:22:49 2000 WATANABE Hirofumi - - * Makefile.in: rename prep.rb to fake.rb. - - * configure.in: ditto. - -Sat May 20 23:29:14 2000 Yukihiro Matsumoto - - * 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 - - * 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 . - -Thu May 18 23:55:26 2000 Katsuyuki Komatsu - - * 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 - - * 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 - - * 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 - - * 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 - - * re.c (rb_reg_new_1): use /m instead of /p. - -Wed May 17 02:22:03 2000 Yukihiro Matsumoto - - * 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 - - * io.c (rb_io_binmode): should check PLATFORMs, not O_BINARY, sigh... - -Wed May 17 00:40:15 2000 Katsuyuki Komatsu - - * 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 - - * 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 . - Export both ruby_xmalloc and xmalloc etc. - -Tue May 16 17:00:05 2000 Masaki Fukushima - - * eval.c (rb_thread_select): should check whether fds are null. - -Tue May 16 11:51:31 2000 Yukihiro Matsumoto - - * io.c (pipe_open): synchronize subprocess stdout/stderr. - -Mon May 15 15:38:09 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * io.c (rb_io_s_popen): _exit after Proc execution. - -Sun May 14 18:05:59 2000 WATANABE Hirofumi - - * 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 - - * lib/irb/ruby-lex.rb: '/' should be escaped in character class. - -Sun May 14 00:54:43 2000 WATANABE Hirofumi - - * 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 - - * io.c (rb_io_s_popen): should check whether a block is given. - -Fri May 12 17:33:44 2000 Yukihiro Matsumoto - - * regex.c (re_compile_pattern): charset_not should not exclude - newline from matching set. - -Thu May 11 22:51:05 2000 Ryunosuke Ohshima - - * pack.c (pack_pack): Bignum support. - - * pack.c (pack_unpack): ditto. - -Thu May 11 21:19:29 2000 Hiroshi Igarashi - - * 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 - - * 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 - - * 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 - - * parse.y (parse_regx): remove in_brack. - -Wed May 10 12:51:18 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * eval.c (rb_callcc): prev & next should be initialized to zero. - -Mon May 8 23:17:36 2000 Yukihiro Matsumoto - - * dln.c (dln_init): remove possible buffer overrun. This is - suggested by Aleksi Niemela . - - * dln.c (init_funcname): ditto. - -Sat May 6 23:35:47 2000 Yukihiro Matsumoto - - * parse.y (lhs): should allow `obj.Attr = 5' type expression. - -Sat May 6 15:46:08 2000 WATANABE Hirofumi - - * 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 - - * parse.y (yylex): allow '$1foo' and such. - -Fri May 5 17:57:24 2000 Minero Aoki - - * 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 - - * regex.c (re_compile_fastmap): charset_not for multibyte - characters excluded too many characters. - -Tue May 2 13:23:43 2000 Yukihiro Matsumoto - - * eval.c (rb_thread_schedule): little bit more impartial context - switching. - -Tue May 2 09:50:03 2000 Katsuyuki Komatsu - - * 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 - - * 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 - - * array.c (rb_ary_unshift_m): performance improvement. - -Fri Apr 28 00:19:22 2000 Nobuyoshi Nakada - - * array.c (rb_ary_unshift_m): takes items to push. - -Wed Apr 26 15:23:02 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * io.c (rb_io_gets_internal): shortcut when rs == rb_default_rs. - -Sat Apr 22 23:14:41 2000 SHIROYAMA Takayuki - - * configure.in: MacOS X support. - -Sat Apr 22 16:37:10 2000 Minero Aoki - - * 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 - - * io.c (rb_io_s_pipe): should set FMODE_SYNC. - -Thu Apr 20 16:59:22 2000 Nobuyoshi Nakada - - * eval.c (massign): `*lvalue = false' should assign `[false]' to - lvalue. - -Wed Apr 19 08:35:08 2000 Yukihiro Matsumoto - - * class.c (rb_singleton_class): generate singleton class for - special constants: nil, true, false. - -Wed Apr 19 02:09:30 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * array.c (rb_ary_collect_bang): Array#filter renamed. - -Fri Apr 14 19:47:11 2000 Minero Aoki - - * 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 - - * 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 - - * bignum.c (rb_big_2comp): unnecessary lvalue cast removed. - -Tue Apr 11 02:25:53 2000 Yukihiro Matsumoto - - * 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 - - * parse.y (str_extend): Allow class variables to be expanded. - -Fri Apr 7 02:03:54 2000 Yukihiro Matsumoto - - * error.c (rb_sys_fail): escape non-printable characters. - -Thu Apr 6 20:10:47 2000 Katsuyuki Komatsu - - * 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 - - * error.c (rb_sys_fail): need rb_exc_new2() call on BeOS. - -Mon Apr 3 17:22:27 2000 Yukihiro Matsumoto - - * io.c (rb_io_reopen): support tempfile. - - * eval.c (catch_i): should supply argument. - -Sat Apr 1 22:50:28 2000 Yukihiro Matsumoto - - * marshal.c (r_object): wrong symbol restoration. - -Sat Apr 1 21:30:53 2000 WATANABE Hirofumi - - * io.c (rb_io_printf, rb_f_printf): should use rb_io_write. - -Sat Apr 1 00:16:05 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * enum.c (enum_find): rb_eval_cmd() should be called with array. - -Tue Mar 28 13:57:05 2000 Clemens Hintze - - * 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 - - * 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 - - * 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 - - * 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 - - * marshal.c (w_object): symbols should be converted to ID before - dumping out. - -Fri Mar 24 18:26:51 2000 Yukihiro Matsumoto - - * file.c (test_check): should have checked exact number of arguments. - -Fri Mar 24 21:02:11 2000 Koji Arai - - * signal.c (trap): should treat some symbols as the signal. - -Fri Mar 24 06:58:03 2000 Minero Aoki - - * 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 - - * 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 - - * 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 - - * 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 - - * object.c (rb_class_s_new): Class::new should call `inherited'. - -Sat Mar 18 12:36:09 2000 Nobuyoshi Nakada - - * 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 - - * 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 - - * 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 - - * string.c (str_gsub): forgot to initialize str->orig. - -Fri Mar 17 01:24:59 2000 Dave Thomas - - * 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 - - * array.c (rb_ary_join): 'result' is always duplicated - before concat string. - -Wed Mar 15 17:26:05 2000 Yukihiro Matsumoto - - * hash.c (rb_hash_s_create): unexpected recursive call removed. - this bug was found by Satoshi Nojo . - -Wed Mar 15 13:12:39 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * parse.y (f_norm_arg): proper error message when constant comes - in formal argument list. this message is suggested by Muvaw - Pnazte . - - * 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 - - * signal.c (rb_f_kill): should treat some symbols as the signal. - -Sat Mar 11 22:03:03 2000 Yukihiro Matsumoto - - * 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 - - * struct.c (rb_struct_aref): struct aref by symbol. - -Sat Mar 11 05:07:11 2000 Yukihiro Matsumoto - - * process.c (proc_setpriority): should return 0, not nil. - - * process.c (proc_setpgid): ditto. - -Fri Mar 10 18:14:54 2000 Yukihiro Matsumoto - - * file.c (path_check_1): confusing buf and path. this bug found - by . - -Fri Mar 10 09:37:49 2000 Katsuyuki Komatsu - - * 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 - - * regex.c (re_compile_fastmap): fixed embarrassing brace bug. - -Thu Mar 9 01:36:32 2000 WATANABE Hirofumi - - * missing/flock.c: emulate missing flock() with fcntl(). - -Thu Mar 9 00:29:35 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 . - -Sun Mar 5 20:35:45 2000 WATANABE Hirofumi - - * 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 - - * 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 - - * 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 - - * 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 - - * string.c (rb_str_times): fix String#* with huge string. - -Sat Feb 26 00:14:59 2000 Yukihiro Matsumoto - - * dir.c (dir_s_new): call `initialize' in Dir::new. - -Fri Feb 25 23:01:49 2000 Katsuyuki Komatsu - - * ruby.h: export ruby_safe_level by EXTERN for mswin32. - * win32/ruby.def: regular maintenance. - -Fri Feb 25 22:12:46 2000 Yukihiro Matsumoto - - * 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 - - * eval.c (rb_thread_start_timer): interval changed to 10ms from 50ms. - -Fri Feb 25 06:42:26 2000 GOTOU YUUZOU - - * ext/socket/socket.c (ip_addrsetup): hostp should remain NULL if - host is nil. - -Thu Feb 24 16:53:47 2000 Yukihiro Matsumoto - - * eval.c (rb_thread_schedule): priority check for sleep expired - threads needed. - -Wed Feb 23 14:22:32 2000 Yukihiro Matsumoto - - * array.c (rb_ary_join): forgot to initialize a local variable - `taint'. - -Tue Feb 22 07:40:55 2000 Yukihiro Matsumoto - - * re.c (Init_Regexp): renamed to MatchData, old name MatchingData - remain as alias. - -Tue Feb 22 00:20:21 2000 Minero Aoki - - * 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 - - * regex.c (re_match): pop_loop should not pop at forward jump. - -Fri Feb 18 17:15:40 2000 Yukihiro Matsumoto - - * eval.c (method_clone): method objects are now clonable. - -Fri Feb 18 00:27:34 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * process.c (rb_f_waitpid): pid_t should be signed. - -Mon Feb 14 13:59:01 2000 Yukihiro Matsumoto - - * 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 - - * parse.y (yylex): `foo.bar=1' should be <.><=><1>, - not <.><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 - - * ruby.c (require_libraries): don't access freed memory. - - * ruby.c (add_modules): ditto. - -Fri Feb 11 12:06:22 2000 Yukihiro Matsumoto - - * 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 - - * string.c (rb_str_index_m): did not support negative offset. - -Wed Feb 9 21:54:26 2000 Katsuyuki Komatsu - - * 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 - - * numeric.c (num_coerce): should return [y, x]. - -Wed Feb 9 11:07:30 2000 Yukihiro Matsumoto - - * ruby.c (ruby_prog_init): loadpath structure changed. - -Tue Feb 8 02:07:33 2000 Yukihiro Matsumoto - - * 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 - - * regex.c (re_match): now understands interrupts under Ruby. - -Mon Feb 7 07:51:52 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * ext/socket/socket.c (s_recv): TRAP_BEG after retry entry. - -Wed Feb 2 22:33:45 2000 Nobuyoshi Nakada - - * 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 - - * 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 - - * samples/eval.rb: Rescue new ScriptError exception - -Wed Feb 2 02:06:07 2000 Yukihiro Matsumoto - - * 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 - - * string.c (str_sub_bang): bang method returns string always. - experimental. - -Sun Jan 30 17:58:09 2000 WATANABE Hirofumi - - * 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 - - * eval.c: use getrlimit(2) on DJGPP. - -Thu Jan 27 01:27:10 2000 GOTO Kentaro - - * dir.c (glob): glob pattern "/*" did not match. - -Wed Jan 26 22:30:47 2000 Shigeo Kobayashi - - * numeric.c (flo_modulo): wrong result for negative modulo. - -Wed Jan 26 02:01:57 2000 Yukihiro Matsumoto - - * 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 - - * object.c (rb_obj_freeze): all objects made freezable. - -Tue Jan 25 00:37:01 2000 WATANABE Hirofumi - - * configure.in: use AC_CHECK_TOOL for cross compiling. - -Mon Jan 24 19:01:54 2000 Nobuyoshi Nakada - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * eval.c (thgroup_s_new): new class ThreadGroup. - -Tue Jan 18 12:24:28 2000 Yukihiro Matsumoto - - * struct.c (Init_Struct): remove Struct's own hash and eql?. - -Sat Jan 15 22:21:08 2000 Nobuyoshi Nakada - - * eval.c (search_method): argument klass may be 0. - -Sat Jan 15 15:03:46 2000 Yukihiro Matsumoto - - * 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 - - * 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 - - * parse.y (arg_add): use new node, ARGSPUSH. - -Mon Jan 10 18:32:28 2000 Koji Arai - - * marshal.c (w_object): forgot an argument to call w_ivar(). - -Sun Jan 9 18:13:51 2000 Katsuyuki Komatsu - - * random.c: first was not defined unless HAVE_RANDOM. - -Sat Jan 8 19:02:49 2000 Yukihiro Matsumoto - - * 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 - - * io.c (io_fread): TRAP_BEG/TRAP_END added around getc(). - -Thu Jan 6 00:39:54 2000 Yukihiro Matsumoto - - * random.c (rb_f_rand): should be initialized unless srand is - called before. - -Wed Jan 5 16:59:34 2000 Minero Aoki - - * 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 - - * parse.y: Fix SEGV on empty parens with UMINUS or UPLUS. - -Tue Jan 4 22:25:54 2000 Yukihiro Matsumoto - - * parse.y (stmt): `() while cond' dumped core. - -Tue Jan 4 06:04:14 2000 WATANABE Hirofumi - - * 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 - - * 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 - - * 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 - - * 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 - - * eval.c: thread independent trace_func not needed. - -Thu Dec 30 14:47:31 1999 akira yamada - - * configure.in: specifies -soname in LIBRUBY_DLDFLAGS on linux - platforms. - -Thu Dec 30 10:51:27 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * ext/Win32API/Win32API.c (Win32API_Call): remove 'dword ptr' - from _asm. - -Fri Dec 24 10:26:47 1999 Koji Oda - - * win32/win32.h: use "C++" linkage. - -Fri Dec 24 02:00:57 1999 Yukihiro Matsumoto - - * eval.c (THREAD_ALLOC): should initialize th->trace. - -Fri Dec 24 00:43:39 1999 KANEKO Naoshi - - * 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 - - * 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 - - * ext/socket/socket.c (sock_finalize): mswin32: fix FILE* leak. - -Tue Dec 21 05:33:56 1999 Minero Aoki - - * 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 - - * file.c (rb_file_s_expand_path): handle dir separator correctly. - -Sun Dec 19 22:56:31 1999 KANEKO Naoshi - - * 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 - - * 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 - - * 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 - - * eval.c (rb_load): should initialize ruby_frame->last_class. - -Wed Dec 15 01:35:29 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * error.c (exc_set_backtrace): forgot to declare a VALUE argument. - -Thu Dec 9 14:19:31 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * eval.c (rb_eval): should try autoloading before defining - class/module at the toplevel. - -Tue Dec 7 22:15:30 1999 EGUCHI Osamu - - * 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 - - * eval.c (Init_eval): calculate stack limit from rlimit where - getrlimit(2) is available. - -Tue Dec 7 09:57:33 1999 Katsuyuki Komatsu - - * file.c (rb_file_ftype): should have removed mode_t. - -Mon Dec 6 15:55:30 1999 EGUCHI Osamu - - * 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 - - * 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 - - * eval.c (Init_Proc): simple typo. - - * gc.c (add_heap): sizeof(RVALUE*), not sizeof(RVALUE). - -Sat Dec 4 01:40:22 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * eval.c (rb_thread_loading): should maintain loading_tbl. - -Thu Dec 2 10:21:43 1999 Yukihiro Matsumoto - - * eval.c (rb_thread_loading_done): wrong parameter to st_delete(). - -Wed Dec 1 11:24:06 1999 Nobuyoshi Nakada - - * ruby.c (process_sflag): process -s properly (should not force `--'). - -Wed Dec 1 09:47:33 1999 Kazunori NISHI - - * string.c (rb_str_split_method): should increment end too. - -Tue Nov 30 18:00:45 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * file.c (stat_new): Struct::Stat -> File::Stat; Stat is no longer - a Struct. - -Mon Nov 29 15:28:52 1999 Yukihiro Matsumoto - - * variable.c (rb_path2class): evaluated value from path should be - module or class. - -Fri Nov 26 18:12:49 1999 Yukihiro Matsumoto - - * 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 - - * ruby.c (proc_options): variable e_script should be visited by - garbage collector. - -Sat Nov 20 10:10:41 1999 Yukihiro Matsumoto - - * hash.c (inspect_i): value may be nil, check revised. - -Fri Nov 19 18:06:21 1999 Yukihiro Matsumoto - - * dir.c (glob): recursive wildcard match by `**' ala zsh. - -Fri Nov 19 11:44:26 1999 EGUCHI Osamu - - * variable.c: was returning void value. - -Fri Nov 19 03:57:22 1999 Nobuyoshi Nakada - - * file.c: add methods Stat struct class to reduce stat(2). - -Thu Nov 18 16:18:27 1999 Yukihiro Matsumoto - - * lib/pstore.rb: mutual lock by flock(2). - -Thu Nov 18 11:44:13 1999 Masahiro Tomita - - * io.c (read_all): should check bytes too. - -Wed Nov 17 02:40:40 1999 Yukihiro Matsumoto - - * io.c (Init_IO): $defout (alias of $>) added. - -Tue Nov 16 09:47:14 1999 Yukihiro Matsumoto - - * lib/pstore.rb: add mutual lock using symlink. - -Mon Nov 15 16:50:34 1999 Yukihiro Matsumoto - - * 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 - - * re.c (rb_reg_source): should not call rb_reg_expr_str() - everytime. - -Sat Nov 13 07:34:18 1999 Yukihiro Matsumoto - - * 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 - - * process.c (rb_f_system): argument check for NT, __EMX__, DJGPP. - -Wed Nov 10 21:54:11 1999 EGUCHI Osamu - - * hash.c (rb_any_cmp): Fixed return without value. - -Wed Nov 10 17:57:06 1999 Yukihiro Matsumoto - - * sprintf.c: incorporate 's sprintf patch at - [ruby-dev:7754]. - -Wed Nov 10 08:28:53 1999 Yukihiro Matsumoto - - * eval.c (rb_call0): supply class parameter for each invocation. - -Tue Nov 9 13:21:04 1999 EGUCHI Osamu - - * configure.in: AC_MINIX move to before AC_EXEEXT and AC_OBJEXT. - -Mon Nov 8 19:52:29 1999 EGUCHI Osamu - - * 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 - - * 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 - - * eval.c (is_defined): last_class may be 0. - -Sat Nov 6 19:26:55 1999 EGUCHI Osamu - - * Makefile.in: Added depend entry make parse.@OBJEXT@ from parse.c - for UCB make - -Thu Nov 4 17:41:18 1999 Yukihiro Matsumoto - - * regex.c (re_compile_pattern): \< (wordbeg), \> (wordend) disabled. - -Wed Nov 3 08:52:57 1999 Masaki Fukushima - - * io.c (Init_IO): forgot to use INT2FIX() around SEEK_SET, etc. - -Wed Nov 3 00:25:20 1999 Yukihiro Matsumoto - - * string.c (rb_str_split_method): use mbclen2() to handle kcode - option of regexp objects. - -Mon Nov 1 14:22:15 1999 EGUCHI Osamu - - * eval.c (rb_eval): reduce recursive calls to rb_eval() - case of ||= and &&= . - -Sun Oct 31 13:12:42 1999 WATANABE Hirofumi - - * regex.c (re_compile_pattern): wrong [\W] match. - -Fri Oct 29 16:57:30 1999 Yukihiro Matsumoto - - * 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 - - * string.c (rb_str_split_method): should be mbchar aware with - single char separators. - -Wed Oct 27 12:57:21 1999 Yukihiro Matsumoto - - * random.c (rb_f_srand): random seed should be unsigned. - -Tue Oct 26 23:58:15 1999 Yukihiro Matsumoto - - * array.c (rb_ary_collect): collect for better performance. - -Tue Oct 26 19:20:54 1999 Koji Arai - - * marshal.c (r_object): should register class/module objects. - -Sat Oct 23 15:59:39 1999 Takaaki Tateishi - - * process.c (rb_f_system): should require at least one argument. - -Sat Oct 23 12:42:44 1999 Nobuyoshi Nakada - - * enum.c (enum_collect): collect without block will collect - elements in enumerable. - -Thu Oct 21 16:14:19 1999 Yukihiro Matsumoto - - * 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 - - * marshal.c (marshal_load): should protect the generated object - table (arg->data) from GC. - -Mon Oct 18 16:15:52 1999 Yukihiro Matsumoto - - * ext/nkf/nkf.c (rb_nkf_kconv): output should be NUL terminated. - -Mon Oct 18 09:03:01 1999 Minero Aoki - - * 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 - - * array.c (rb_ary_pop): forgot some freeze checks. - -Sat Oct 16 12:57:53 1999 EGUCHI Osamu - - * array.c (rb_ary_sort): always returns the copied array. - -Fri Oct 15 22:50:41 1999 WATANABE Hirofumi - - * error.c (sys_nerr): on CYGWIN, it is _sys_nerr. - -Fri Oct 15 01:32:31 1999 WATANABE Hirofumi - - * 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 - - * 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 - - * parse.y (string): compile time string concatenation. - -Wed Oct 13 07:28:09 1999 Minero Aoki - - * 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 - - * 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 - - * 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 - - * io.c (io_read): length may be 0 or negative. - -Tue Oct 12 13:26:27 1999 Jun-ichiro itojun Hagino - - * signal.c (posix_signal): RETSIGTYPE may be void. - -Tue Oct 12 03:28:03 1999 EGUCHI Osamu - - * array.c (rb_ary_delete_at): allows negative position. - -Mon Oct 11 17:42:25 1999 Nobuyoshi Nakada - - * 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 - - * 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 - - * ruby.c (addpath): rubylib_mangled_path() modified. - -Mon Oct 4 12:42:32 1999 Kazuhiko Izawa - - * pack.c (pack_unpack): % in printf format should be %%. - -Mon Oct 4 10:01:40 1999 Yukihiro Matsumoto - - * 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 - - * pack.c (OFF16): need to adjust pointer address to pack/unpack on - 64bit machines. - -Sun Oct 03 03:05:59 1999 WATANABE Hirofumi - - * time.c (time_arg): mktime y2k problem. - -Sun Sep 26 16:54:45 1999 WATANABE Hirofumi - - * parse.y (here_document): `\r' handling for here documents. - -Wed Sep 22 09:20:11 1999 Masahiro Tomita - - * ext/socket/socket.c: SOCKS5 support. - -Wed Sep 22 07:33:23 1999 Minero Aoki - - * 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 - - * 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 - - * 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 - - * eval.c (call_trace_func): should not propagate retval in - trace_func. - -Mon Sep 20 21:35:39 1999 Katsuyuki Komatsu - - * win32/win32.c (myselect): assume non socket files are always - readable/writable. - -Mon Sep 20 01:08:02 1999 Yukihiro Matsumoto - - * 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 - - * stable version 1.4.2 released. - -Fri Sep 17 23:24:17 1999 Katsuyuki Komatsu - - * eval.c (rb_f_missing): dumped core if no argument given. - -Fri Sep 17 23:21:06 1999 Katsuyuki Komatsu - - * win32/win32.c (myselect): translate WSAEINTR, WSAENOTSOCK into - UNIX errno constants. - -Fri Sep 17 00:52:27 1999 Yukihiro Matsumoto - - * parse.y (arg): assignable() may return 0. - -Thu Sep 16 20:46:23 1999 WATANABE Hirofumi - - * eval.c (rb_eval): was doubly evaluating the return expression. - -Thu Sep 16 18:40:08 1999 Yukihiro Matsumoto - - * stable version 1.4.1 released. - -Thu Sep 16 11:33:22 1999 WATANABE Hirofumi - - * string.c (rb_str_match): should return nil. - -Wed Sep 15 22:46:37 1999 Yukihiro Matsumoto - - * re.c (rb_reg_s_quote): should quote `-' too. - -Tue Sep 14 15:23:22 1999 Nobuyoshi Nakada - - * 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 - - * eval.c (rb_eval): needless RTEST(ruby_verbose) removed. - -Mon Sep 13 09:10:11 1999 Minero Aoki - - * lib/net/session.rb, smtp.rb, pop.rb: 1.0.0 - -Wed Sep 8 11:37:38 1999 Tadayoshi Funaba - - * time.c (make_time_t): bit more strict comparison. - -Tue Sep 7 00:50:56 1999 Yukihiro Matsumoto - - * 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 - - * eval.c (rb_eval): break/next/redo available within -n/-p loop. - -Fri Sep 3 11:14:31 1999 Yukihiro Matsumoto - - * compar.c (cmp_equal): should not raise exception; protect by - rb_rescue(). - -Thu Sep 2 05:23:05 1999 WATANABE Hirofumi - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * sprintf.c (rb_f_sprintf): "%%" is legal, but "%3.14%" is not. - -Mon Aug 23 00:00:54 1999 Tsukada Takuya - - * regex.c (re_compile_fastmap): wrong macro caused memory leak. - -Sat Aug 21 11:30:51 1999 Yukihiro Matsumoto - - * eval.c (ADJ): should not adjust addresses to data on heap. - -Fri Aug 20 20:50:58 1999 Kenji Nagasawa - - * defines.h (PATH_SEP): path separator is ";" for OS/2. - -Thu Aug 19 10:50:43 1999 WATANABE Tetsuya - - * gc.c (rb_gc): add volatile to avoid GCC optimize bug(?). - -Wed Aug 18 23:48:10 1999 Yukihiro Matsumoto - - * 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 - - * stable version 1.4.0 released. - -Fri Aug 13 03:16:07 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * eval.c (rb_eval): no automatic aggregate initialization. - - * eval.c (module_setup): ditto. - -Wed Aug 11 18:18:41 1999 WATANABE Tetsuya - - * eval.c (yield_under_i): automatic aggregate initialization is an - ANSI feature. - -Wed Aug 11 10:10:02 1999 Yukihiro Matsumoto - - * 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 - - * regex.c (re_match): bug on backward jump adjustment concerning - stop_paren. - -Tue Aug 10 14:54:25 1999 Yukihiro Matsumoto - - * ext/nkf/nkf.c (rb_nkf_guess): binary detection was wrong. - -Tue Aug 10 00:07:36 1999 Yukihiro Matsumoto - - * io.c (rb_io_clone): should use CLONESETUP(). - -Mon Aug 9 23:57:07 1999 Yukihiro Matsumoto - - * ruby.h (CLONESETUP): should have copied generic instance - variables too. - -Mon Aug 9 10:46:54 1999 Katsuyuki Komatsu - - * ext/socket/extconf.rb: add check for and - . - -Sat Aug 7 13:19:06 1999 EGUCHI Osamu - - * numeric.c (flo_cmp): comparing NaN should not return value. - raises FloatDomainError. - -Sat Aug 7 03:09:08 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * object.c (rb_mod_clone): should check if iv_tbl, m_tbl are - initialized. - -Tue Aug 3 19:03:02 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * object.c (rb_mod_ge): wrong comparison. - -Fri Jul 30 12:15:44 1999 Katsuyuki Komatsu - - * 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 - - * 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 . - -Wed Jul 28 01:18:28 1999 WATANABE Hirofumi - - * 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 - - * version 1.3.6 - version 1.4 alpha - -Tue Jul 27 09:38:08 1999 EGUCHI Osamu - - * eval.c (rb_eval): reduce recursive rb_eval() calls by - NODE_BLOCKs. - -Tue Jul 27 01:20:40 1999 WATANABE Hirofumi - - * file.c (rb_file_s_expand_path): drive letter patch. - -Mon Jul 26 02:36:31 1999 Shugo Maeda - - * 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 - - * dir.c (push_braces): should treat nested braces. - -Fri Jul 23 02:49:49 1999 Yukihiro Matsumoto - - * hash.c (rb_hash_clear): dummy argument added; suggested by - . thanks. - -Thu Jul 22 19:37:22 1999 Yukihiro Matsumoto - - * eval.c (rb_thread_join): get_backtrace() may return Qnil. - typecheck added. - -Tue Jul 20 14:36:43 1999 WATANABE Hirofumi - - * range.c (range_each): do not treat String specially (for future - override). - -Tue Jul 20 02:28:34 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * lib/jcode.rb: replaced by faster code. - -Mon Jul 19 01:57:28 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * lib/telnet.rb: version 0.231. - -Fri Jul 16 10:58:22 1999 WATANABE Tetsuya - - * regex.c (re_match): debug print removed. - -Fri Jul 16 09:58:15 1999 Katsuyuki Komatsu - - * 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 - - * 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 - - * lib/debug.rb: better display & frame treatment. - -Thu Jul 15 21:16:41 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * ext/tcltklib/tcltklib.c: move `#include "ruby.h"' forward. - -Thu Jul 15 16:54:16 1999 Yukihiro Matsumoto - - * version 1.3.5 - version 1.4 alpha - -Wed Jul 14 23:45:33 1999 Katsuyuki Komatsu - - * eval.c (ruby_init): initialize for the first time only. - -Tue Jul 13 00:15:19 1999 Yukihiro Matsumoto - - * 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 - - * io.c (rb_file_sysopen): wrong number of argument. - -Mon Jul 12 11:52:35 1999 Yukihiro Matsumoto - - * 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 - - * lib/debug.rb: patch to show proper position. - -Fri Jul 9 23:56:14 1999 WATANABE Hirofumi - - * 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 - - * random.c (RANDOM_NUMBER): should place parentheses. - -Fri Jul 8 11:00:51 1999 Shugo Maeda - - * 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 - - * st.c (st_delete_safe): was modifying wrong slot. - -Mon Jul 5 13:17:46 1999 Yukihiro Matsumoto - - * gc.c (rb_gc_call_finalizer_at_exit): close all files at exit. - -Fri Jul 2 18:00:21 1999 Minero Aoki - - * lib/Mail/README: Mail-0.3.0 added to the distribution. - -Fri Jul 2 01:45:32 1999 Yukihiro Matsumoto - - * regex.c (re_compile_fastmap): avoid allocation of register - variables for each invocation of re_match(). Suggested by - Zasukhin Ruslan . Thanks. - -Tue Jun 29 20:39:24 1999 Koji Arai - - * 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 - - * lib/CGI.rb: 0.30 - cleanup release, incompatible. - - * lib/telnet.rb: 0.22 - timeout added. - -Tue Jun 29 10:49:25 1999 SHIROYAMA Takayuki - - * configure.in: better Rhapsody support. - - * lib/mkmf.rb: Rhapsody/NEXTSTEP support. - -Tue Jun 29 01:42:13 1999 Yukihiro Matsumoto - - * ext/pty/pty.c (chld_changed): should use POSIX.1 style wait. - -Mon Jun 28 21:07:36 1999 KIMURA Koichi - - * ext/extmk.rb.nt: wrong result for have_library(). - -Mon Jun 28 15:24:05 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * string.c (rb_str_rindex): wrong position to search. - -Sat Jun 26 04:05:30 1999 Takaaki Tateishi - - * 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 - - * 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 - - * missing/isinf.c: include "config.h" added. - -Fri Jun 25 07:25:05 1999 Katsuyuki Komatsu - - * 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 - - * 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 - - * 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 - - * 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 - - * pack.c (uv_to_utf8): mask needed. - -Wed Jun 23 21:03:56 1999 Tadayoshi Funaba - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * pack.c (pack_pack): should initialize local variable `j'. - -Wed Jun 22 15:24:59 1999 Koji Arai - - * parse.y (here_document): a bug for multiline heredoc. - -Tue Jun 22 15:06:36 1999 WATANABE Hirofumi - - * ext/socket/socket.c (ruby_socket): forgot to return fd - explicitly. - -Tue Jun 22 13:34:12 1999 Yukihiro Matsumoto - - * rubyio.h (MakeOpenFile): should initialize member `iv_tbl'. - -Wed Jun 22 10:35:51 1999 Katsuyuki Komatsu - - * io.c (rb_io_gets_internal): getc(3) may not set errno on - interrupt. - -Mon Jun 21 22:39:28 1999 Yukihiro Matsumoto - - * 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 - - * ext/dbm/dbm.c: include for solaris 2.6. - -Mon Jun 21 15:59:47 1999 Nobuyoshi Nakada - - * ext/socket/socket.c (ip_addrsetup): forgot to put `else'. - -Mon Jun 21 15:38:37 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * string.c (rb_str_each_line): should have checked string - boundary. - -Sat Jun 19 22:24:12 1999 Kenji Nagasawa - - * OS/2 patch improved. - -Fri Jun 18 08:30:17 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * pack.c (pack_pack): template `Z' should be allowed. - -Wed Jun 9 13:26:38 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * regex.c (read_backslash): should decode \b within class. - -Thu Jun 3 01:06:18 1999 Katsuyuki Komatsu - - * dln.c (dln_load): AIX improvement (aix_findmain removed). - -Wed Jun 2 00:41:31 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * version 1.3.4 - preliminary release for 1.4 - -Mon May 31 15:57:41 1999 Yukihiro Matsumoto - - * 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 - - * regex.c (re_match): stack boundary check needed. - -Sat May 29 12:27:00 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - . - -Thu May 27 12:27:42 1999 Yukihiro Matsumoto - - * string.c (tr_trans): should handle NUL (\0) within strings. - -Tue May 25 16:45:11 1999 Yukihiro Matsumoto - - * 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 - - * regex.c (read_backslash): read backslash by regex. - -Sun May 23 19:44:58 1999 WATANABE Hirofumi - - * ext/pty/pty.c (getDevice): portability patch. - -Fri May 21 23:01:26 1999 Katsuyuki Komatsu - - * ext/socket/getaddrinfo.c (GET_AI): should set error code. - -Thu May 20 03:43:44 1999 Jun-ichiro itojun Hagino - - * 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 - - * 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 - - * regex.c (re_search): a bug in range adjustment. - -Tue May 18 11:35:59 1999 WATANABE Hirofumi - - * dln.c (conv_to_posix_path): path_len argument added. - -Mon May 17 12:26:31 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * regex.c (re_compile_fastmap): it should be k != 0 to skip. - -Fri May 14 12:46:56 1999 Yukihiro Matsumoto - - * 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 - - * regex.c (re_match): a bug in inline `.*' etc. - -Fri May 14 09:58:46 1999 Minero Aoki - - * ruby.c (addpath): should have specified string length. - -Thu May 13 10:40:44 1999 Yukihiro Matsumoto - - * 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 - - * struct.c (iv_get): in case of inheritance of generated struct - class, __member__ and __size__ should also be inherited. - Thanks for Pros Yeboah . - - * io.c (rb_f_gets_internal): should check number of arguments - before checking rb_rs == rb_default_rs. Thanks for Koji Arai - . - -Tue May 11 08:29:28 1999 Yukihiro Matsumoto - - * regex.c (re_compile_pattern): .?, .+ did not work. - -Mon May 10 00:59:33 1999 Yukihiro Matsumoto - - * 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 - - * ext/socket/socket.c (sock_s_getaddrinfo): conversion from - Fixnums to C integers needed. - -Sun May 9 11:51:43 1999 Koji Arai - - * 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 - - * 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 - - * 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 - - * dir.c (glob): removed GPL'ed glob.c completely. - -Fri May 7 08:17:19 1999 Yukihiro Matsumoto - - * ext/sdbm/extconf.rb: sdbm extension added to the distribution. - -Fri May 7 01:42:20 1999 Yukihiro Matsumoto - - * ext/socket/socket.c (tcp_s_gethostbyname): avoid using struct - sockaddr_storage. - -Thu May 6 13:21:41 1999 Yukihiro Matsumoto - - * array.c (rb_ary_indexes): should not use rb_ary_concat(). - -Thu May 4 12:34:18 1999 Koji Arai - - * 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 - - * 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 - - * ext/socket/socket.c (open_inet): typo (res and res0). - -Tue May 4 02:07:49 1999 Yukihiro Matsumoto - - * mkconfig.rb: leave undefined $(VARIABLE) unexpanded in the - Config::CONFIG hash table. - -Mon May 3 09:37:22 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * string.c (rb_str_aset): last index should not append. - -Thu Apr 29 18:55:31 1999 WATANABE Hirofumi - - * 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 - - * 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 - . - -Mon Apr 26 16:46:59 1999 Yukihiro Matsumoto - - * 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 - - * parse.y (operation): syntax like `a.[]=(1,2)' is allowed. - -Fri Apr 23 23:54:09 1999 Yukihiro Matsumoto - - * io.c (argf_binmode): binmode method added to ARGF. - -Fri Apr 23 13:55:22 1999 Yukihiro Matsumoto - - * 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 - - * eval.c (rb_callcc): call scope_dup() for all scopes in - the interpreter stack. - -Tue Apr 20 11:24:18 1999 Yukihiro Matsumoto - - * string.c (rb_str_dump): `#' should be escaped. - -Tue Apr 20 02:32:42 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * eval.c (eval): should restore ruby_dyna_vars. - -Fri Apr 16 21:40:43 1999 Nobuyoshi Nakada - - * 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 - - * 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 - - * ruby.c (rubylib_mangle): mangle path by RUBYLIB_PREFIX. - -Wed Apr 14 23:52:51 1999 SHIROYAMA Takayuki - - * node.h (NODE_LMASK): should be long to avoid overflow. - -Wed Apr 14 13:14:35 1999 Katsuyuki Komatsu - - * dln.c: AIX dynamic link. - - * ext/aix_ld.rb: ditto. - -Wed Apr 14 12:19:09 1999 Yukihiro Matsumoto - - * lib/thread.rb: Queue#{enq,deq} added. - -Tue Apr 13 17:43:56 1999 Yukihiro Matsumoto - - * hash.c (rb_hash_s_create): Hash::[] acts more like casting. - -Tue Apr 13 00:33:52 1999 Yukihiro Matsumoto - - * 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 - - * io.c (rb_io_reopen): check for reopening same IO. - -Fri Apr 9 17:45:11 1999 Yukihiro Matsumoto - - * 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 - - * pack.c (PACK_LENGTH_ADJUST): need to adjust for `*' length. - -Tue Apr 6 23:28:44 1999 Yukihiro Matsumoto - - * parse.y (void_check): add void context checks. - -Mon Apr 5 12:23:42 1999 Yukihiro Matsumoto - - * 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 - - * lib/debug.rb: wrong command interpreting. - -Fri Apr 2 11:46:22 1999 Yukihiro Matsumoto - - * version 1.3.2 - -Fri Apr 2 10:40:04 1999 Yukihiro Matsumoto - - * io.c (rb_io_s_pipe): forgot to define IO::pipe. - -Thu Apr 1 14:40:46 1999 Yukihiro Matsumoto - - * 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 - - * ext/nkf/nkf.c (rb_nkf_kconv): check size output_ctr before - decrement. - -Thu Mar 25 09:11:03 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * configure.in: AC_C_CONST check added. - -Tue Mar 23 02:07:35 1999 Yukihiro Matsumoto - - * time.c (time_plus): preserve gmt-mode for result. - -Mon Mar 22 01:32:37 1999 Yukihiro Matsumoto - - * 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 - - * lib/weakref.rb: avoid leak for two weakrefs for one object. - -Fri Mar 19 11:26:45 1999 WATANABE Hirofumi - - * eval.c (ruby_run): needed to eval END{} on exit. - - * eval.c (rb_exit): ditto. - -Fri Mar 19 02:17:27 1999 Yukihiro Matsumoto - - * signal.c (Init_signal): handles terminating signals HUP, TERM, - QUIT, PIPE, etc. - -Thu Mar 18 15:47:18 1999 Yukihiro Matsumoto - - * 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 - - * ext/extmk.rb.in: static linking cause infinite make loop. - -Tue Mar 16 18:50:04 1999 Yoshida Masato - - * 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 - - * file.c (utime_internal): suppress warning by const. - - * time.c (time_gmtime): ditto. - -Tue Mar 16 10:23:05 1999 Yukihiro Matsumoto - - * time.c (time_clone): Time object can be cloned. - -Tue Mar 16 03:13:10 1999 Koji Arai - - * ruby.c (load_file): argv[argc] should be NULL. - -Mon Mar 15 22:12:08 1999 Tadayoshi Funaba - - * sprintf.c (rb_f_sprintf): typo in arg_num check at exit. - -Mon Mar 15 16:42:22 1999 Yukihiro Matsumoto - - * array.c (rb_ary_dup): dup2 should copy class too. - -Mon Mar 15 15:12:53 1999 Yasuhiro Fukuma - - * lib/mkmf.rb: install program relative path check. - -Mon Mar 15 14:05:25 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * ext/readline/readline.c (readline_s_vi_editing_mode): wrong - number of arguments. - -Fri Mar 12 02:12:50 1999 Yukihiro Matsumoto - - * pack.c (PACK_ITEM_ADJUST): "a".unpack("C3") => [97, nil, nil] - -Thu Mar 11 18:23:50 1999 WATANABE Tetsuya - - * ext/socket/socket.c (Init_socket): UDPsocket was omitted. - -Thu Mar 11 16:43:30 1999 Yukihiro Matsumoto - - * 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 - - * hash.c (ruby_unsetenv): use ruby_setenv(name, 0). - - * hash.c (env_delete): ditto. - - * string.c (rb_str_upto): do not check `beg - - * string.c (rb_str_index): wrong end point calculation. - -Sat Mar 6 02:19:12 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * configure.in: remove --disable-thread, thread feature is no - longer optional. - -Thu Mar 4 00:32:17 1999 Yasuhiro Fukuma - - * parse.y (read_escape): wrong arguments for scan_oct,scan_hex. - -Wed Mar 3 11:51:53 1999 Yukihiro Matsumoto - - * ext/socket/socket.c (Init_socket): rename class names as - TCPsocket -> TCPSocket etc. - -Tue Mar 2 19:46:42 1999 WATANABE Hirofumi - - * configure.in (LDSHARED): use gcc -Wl,-G for solaris with gcc. - -Tue Mar 2 17:04:19 1999 Yukihiro Matsumoto - - * parse.y (yylex): backslashes do not concatenate comment lines - anymore. - -Mon Mar 1 14:05:12 1999 Yukihiro Matsumoto - - * 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 - - * parse.y (nextc): backslash at the eof cause infinite loop - -Sun Feb 28 11:01:26 1999 Tadayoshi Funaba - - * time.c (make_time_t): month range check added. - -Sat Feb 27 02:36:05 1999 Yukihiro Matsumoto - - * 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 - - * eval.c (error_print): bug for error message with newlines. - -Fri Feb 26 12:00:04 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * time.c (time_load): tm_year should be packed in 17 bits, not 18. - -Thu Feb 25 12:50:25 1999 Yukihiro Matsumoto - - * 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 - - * eval.c (rb_call): should handle T_ICLASS properly. - -Thu Feb 25 00:04:00 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * parse.y (yylex): warn if identifier! immediately followed by `='. - -Tue Feb 23 12:32:41 1999 WATANABE Hirofumi - - * 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 - - * 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 - - * 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 - - * numeric.c (rb_num2long): no implicit conversion from boolean. - -Sat Feb 20 09:58:42 1999 EGUCHI Osamu - - * numeric.c (flo_to_s): portable Infinity and NaN support. - -Sat Feb 20 07:13:31 1999 WATANABE Tetsuya - - * io.c (rb_file_sysopen): forgot to initialize a local variable. - -Fri Feb 19 23:05:07 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * missing/fnmatch.c: moved to missing directory. - -Wed Feb 17 16:22:26 1999 Yukihiro Matsumoto - - * struct.c (rb_struct_alloc): actual initialization now be done in - `initialize'. - -Wed Feb 17 09:47:15 1999 okabe katsuyuki - - * 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 - - * 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 - - * configure.in: BeOS patch. - -Tue Feb 16 14:25:00 1999 Yukihiro Matsumoto - - * 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 - - * configure.in: specify `-Wl,-E' only for GNU ld. - -Mon Feb 15 11:43:22 1999 GOTO Kentaro - - * array.c (rb_inspecting_p): should return Qfalse. - -Sun Feb 14 22:36:40 1999 EGUCHI Osamu - - * sprintf.c (rb_f_sprintf): `%G' was omitted. - -Sun Feb 14 12:47:48 1999 EGUCHI Osamu - - * 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 - - * eval.c (rb_thread_create_0): should protect th->thread. - -Fri Feb 12 16:16:47 1999 Yasuhiro Fukuma - - * string.c (rb_str_inspect): wrong mbc position. - -Fri Feb 12 16:21:17 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * numeric.c (fix_pow): `(5**1).type' should be Integer. - -Tue Feb 9 01:22:49 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * re.c (match_getter): accessing $~ without matching caused SEGV. - -Fri Feb 5 22:11:08 1999 EGUCHI Osamu - - * 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 - - * ruby.c (proc_options): -e without program prints error. - -Fri Feb 5 00:01:50 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * parse.y (yylex): too big float raise warning, not error. - -Tue Feb 2 23:41:42 1999 Yoshida Masato - - * 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 - - * 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 - - * string.c (rb_str_gsub_bang): too small realloc condition. - -Mon Feb 1 10:01:17 1999 EGUCHI Osamu - - * parse.y (yylex): range check for the float literal. - -Sat Jan 30 18:34:16 1999 Yukihiro Matsumoto - - * ruby.c (usage): -h option to show brief command description. - -Sat Jan 30 08:45:16 1999 IKARASHI Akira - - * lib/cgi-lib.rb: cookie support added. - -Sat Jan 30 13:38:24 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * hash.c (rb_f_setenv): SEGV caused by small typo. - -Fri Jan 29 00:15:58 1999 Yukihiro Matsumoto - - * 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 - - * numeric.c (flo_to_s): float format changed to "%16.10g". - -Thu Jan 28 02:13:11 1999 Yoshinori Toki - - * array.c (rb_ary_store): expand allocated buffer by 3/2. - -Wed Jan 27 17:50:02 1999 Kazuhiro HIWADA - - * 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 - - * 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 - - * prec.c: Precision support for numbers. - -Thu Jan 21 19:08:14 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * parse.y (here_document): need to protect lex_lastline. - - * parse.y (yylex): disable %//, %'', %``. - -Tue Jan 19 05:01:16 1999 Koji Arai - - * array.c (beg_len): round range value too much. - -Mon Jan 18 13:02:27 1999 Kuroda Jun - - * hash.c (env_keys): strchr() may return NULL. - -Mon Jan 18 17:51:47 1999 Yukihiro Matsumoto - - * 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 - - * eval.c (rb_callcc): experimental continuation support. - -Sun Jan 17 19:45:37 1999 WATANABE Hirofumi - - * pack.c (pack_pack): nil packing caused SEGV. - -Sat Jan 16 13:18:03 1999 Yukihiro Matsumoto - - * 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 - - * string.c (rb_str_split_method): UTF-8 support. - - * regex.c: UTF-8 support. - -Thu Jan 14 00:42:55 1999 Yukihiro Matsumoto - - * 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 - - * hash.c (rb_f_setenv): name and value can be tainted. - -Wed Jan 6 02:42:08 1999 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * gc.c (rb_gc_mark): should not return on FL_EXIVAR. - -Fri Dec 25 11:56:51 1998 Yukihiro Matsumoto - - * 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 - - * development version 1.3 released. - -Thu Dec 24 00:17:00 1998 Yukihiro Matsumoto - - * 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 - - * regex.c (re_match): avoid too many loop pops for (?:..). - -Tue Dec 22 18:01:08 1998 Yukihiro Matsumoto - - * experimental version 1.1d1 released. - -Mon Dec 21 01:33:03 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * experimental version 1.1d0 (pre1.2) released. - -Wed Dec 16 10:43:34 1998 Yukihiro Matsumoto - - * regex.c (re_search): bound check before calling re_match(). - -Tue Dec 15 13:59:01 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * ruby.c (set_arg0): $0 support for HP-UX. - -Mon Dec 7 01:30:28 1998 WATANABE Hirofumi - - * dln.c (dln_strerror): better error messages on win32. - -Sat Dec 5 23:27:23 1998 Yukihiro Matsumoto - - * parse.y (here_document): indentable here-doc delimiter by - `<<-'. Proposed by Clemens . Thanks. - -Thu Dec 3 16:50:17 1998 Yukihiro Matsumoto - - * ext/extmk.rb.in (realclean): trouble on install. - -Sun Nov 29 22:25:39 1998 Takaaki Tateishi - - * process.c (f_exec): check number of argument. - -Thu Nov 26 17:27:30 1998 Yukihiro Matsumoto - - * version 1.1c9 released. - -Wed Nov 25 13:07:12 1998 Yukihiro Matsumoto - - * 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 - - * st.c (st_init_table_with_size): round size up to prime number. - -Sat Nov 21 23:27:23 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * lib/delegate.rb: do not propagate hash and eql?. - -Thu Nov 19 01:40:52 1998 Yukihiro Matsumoto - - * 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 - - * class.c (rb_define_global_function): global functions now be - module function of the Kernel. - -Wed Nov 18 10:48:09 1998 Yukihiro Matsumoto - - * io.c (read_all): SEGV on large files. - -Tue Nov 17 18:11:20 1998 Yukihiro Matsumoto - - * version 1.1c8 released. - -Tue Nov 17 16:58:47 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * sprintf.c (f_sprintf): %l%%c -> %%l%c - -Tue Nov 17 01:08:50 1998 Yukihiro Matsumoto - - * 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 - - * parse.y (primary): exec else clause if no exception raised. - -Sun Nov 15 15:44:07 1998 Tadayoshi Funaba - - * ext/extmk.rb.in (install): bug in target. - -Sat Nov 14 11:02:05 1998 Motoyuki Kasahara - - * 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 - - * 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 - - * missing/nt.c (SafeFree): wrong free offset. - -Thu Nov 12 20:11:53 1998 Koji Arai - - * sample/ruby-mode.el: wrong highlight. - - * parse.y (parse_regx): newline in regexp was ignored. - -Wed Nov 11 10:54:57 1998 Yukihiro Matsumoto - - * 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 - - * configure.in: elf support for FreeBSD 3.x - -Tue Nov 10 00:05:43 1998 Yukihiro Matsumoto - - * parse.y (yylex): here document available in eval. - -Mon Nov 9 17:55:19 1998 Yukihiro Matsumoto - - * version 1.1c7 released. - -Fri Nov 6 19:25:27 1998 Takao KAWAMURA - - * sample/ruby-mode.el: font-lock patch. - -Thu Nov 5 15:42:22 1998 Yukihiro Matsumoto - - * sample/README, lib/README: simple description for each file. - -Wed Nov 4 18:14:19 1998 Yukihiro Matsumoto - - * eval.c (assign): attribute assignment should be called as public. - -Tue Nov 3 23:36:39 1998 Yukihiro Matsumoto - - * 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 - - * string.c (rb_str_aset): `str[str]' replaces first match. - -Mon Nov 2 18:24:33 1998 Yukihiro Matsumoto - - * eval.c (thread_create): was accessing modified status. - -Sun Nov 1 01:18:52 1998 EGUCHI Osamu - - * gc.c (xrealloc): size 0 needs round up to 1. - -Sat Oct 31 23:18:34 1998 Yukihiro Matsumoto - - * 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 - - * string.c (str_aref): regexp index SEGVed. - -Fri Oct 30 14:33:47 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * regex.c (re_match): access out of boundary fixed. - -Wed Oct 28 11:37:42 1998 TAMITO - - * io.c (f_select): fd number comparison bug. - -Tue Oct 27 23:07:11 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * regex.c (set_list_bits): was using wrong offset. - -Thu Oct 22 00:07:11 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * eval.c (rb_eval): reduce recursive calls to rb_eval(). - -Fri Oct 16 15:31:45 1998 Yukihiro Matsumoto - - * time.c (time_new_internal): timeval must be positive. - -Thu Oct 15 13:54:48 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * eval.c (rb_call0): check stack depth more frequently. - -Mon Oct 12 08:08:30 1998 Yukihiro Matsumoto - - * io.c (rb_p): can print even in secure mode. - -Sun Oct 11 22:50:13 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * version 1.1c6 released. - -Fri Oct 2 14:22:33 1998 Yukihiro Matsumoto - - * regex.c (re_search): `/\s*(--)$/ =~ "- --"' did not match, - because of wrong optimize condition. - -Mon Oct 1 01:55:16 1998 Yukihiro Matsumoto - - * 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 - - * eval.c (rb_thread_start): supports making a subclass of the - Thread class. - -Tue Sep 29 17:46:01 1998 Yukihiro Matsumoto - - * eval.c (rb_thread_join): join is now an instance method. - -Fri Sep 25 12:01:19 1998 Yukihiro Matsumoto - - * parse.y (yylex): `@foo!' should be an error. - -Thu Sep 24 14:55:06 1998 WATANABE Tetsuya - - * ext/etc/etc.c (Init_etc): wrong field definition. - -Thu Sep 17 17:09:05 1998 Yukihiro Matsumoto - - * io.c (io_reopen): was creating FILE* for wrong fd. - -Tue Sep 15 05:28:11 1998 Koji Arai - - * regex.c (re_compile_pattern): forgot to fixup for the pattern - like (?=(A)|(B)). - -Tue Sep 15 01:06:08 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * regex.c (re_search): range value should be maintained. - -Thu Sep 10 10:55:00 1998 Yukihiro Matsumoto - - * parse.y (backref_error): yyerror does not understand formats. - -Tue Sep 8 18:05:33 1998 Yukihiro Matsumoto - - * version 1.1c5 released. - -Tue Sep 8 10:03:39 1998 Yukihiro Matsumoto - - * 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 - - * bignum.c (bigadd): proper sign combination. - - * regex.c (re_search): wrong return value for \A. - -Thu Sep 3 14:08:14 1998 Yukihiro Matsumoto - - * version 1.1c4 released. - -Tue Sep 1 10:47:16 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * sprintf.c (f_sprintf): wrong buffer size check. - -Fri Aug 28 01:57:04 1998 Yukihiro Matsumoto - - * regex.c (re_compile_pattern): accepts (?ix-ix) and (?ix-ix:...). - -Fri Aug 28 12:25:33 1998 Hiroshi Igarashi - - * ruby.c (ruby_require_modules): load modules in appearing order. - -Fri Aug 28 01:57:04 1998 Yukihiro Matsumoto - - * regex.c (re_compile_pattern): accepts (?ix-ix) and (?ix-ix:...). - -Thu Aug 27 12:54:28 1998 Yukihiro Matsumoto - - * version 1.1c3 released. - -Wed Aug 26 14:40:56 1998 Yukihiro Matsumoto - - * 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 - - * regex.c (re_match): pop non-greedy stack elements on success. - -Wed Aug 26 09:25:35 1998 WATANABE Hirofumi - - * ruby.h: add #define environ for cygwin32. - -Tue Aug 25 08:57:41 1998 Yukihiro Matsumoto - - * array.c (rb_ary_sort_bang): temporarily freeze sorting array. - -Mon Aug 24 18:46:44 1998 WATANABE Hirofumi - - * dln.c (dln_find_1): path check was too strict. - -Mon Aug 24 15:28:11 1998 WATANABE Hirofumi - - * parse.y (f_arglist): opt_nl added after f_args. - -Fri Aug 21 01:06:01 1998 Yukihiro Matsumoto - - * 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 - - * io.c (io_ctl): forgot to place TRAP_END at right position. - -Fri Aug 14 11:01:47 1998 Yukihiro Matsumoto - - * 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 - - * array.c (ary_s_new): was marking unallocated region on GC. - -Tue Aug 11 11:57:35 1998 Yukihiro Matsumoto - - * version 1.1c2 released. - -Mon Aug 10 14:05:30 1998 Yukihiro Matsumoto - - * process.c (f_system): removed fflush(stdin). - -Fri Aug 7 17:44:44 1998 Yukihiro Matsumoto - - * 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 - - * re.c (rb_reg_search): recycle match object. - -Mon Aug 3 09:17:55 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * string.c (str_replace): zero fill for expansion gap. - - * regex.c (mbctab_euc): set flags on for 0xA1-0xFE. suggested by - . - - * string.c (str_inspect): consider current_mbctype. - -Sun Jul 26 15:37:11 1998 Tadayoshi Funaba - - * array.c (ary_s_new): Array.new(1<<30) dumps core. - -Fri Jul 24 13:40:19 1998 Yukihiro Matsumoto - - * version 1.1c1 released. - -Fri Jul 24 02:10:22 1998 Yukihiro Matsumoto - - * 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 - - * eval.c (rb_attr): argument should be symbol or string. - -Wed Jul 22 11:59:34 1998 Yukihiro Matsumoto - - * regex.c (calculate_must_string): wrong offset added. - -Wed Jul 22 11:59:59 1998 Yukihiro Matsumoto - - * st.c (rehash): still had a GC problem. fixed. - -Tue Jul 21 13:19:30 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * sprintf.c (f_sprintf): proper sign position for %X and %O. - -Fri Jul 17 14:10:20 1998 Yukihiro Matsumoto - - * version 1.1c0 released. - -Fri Jul 17 08:01:49 1998 Tadayoshi Funaba - - * 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 - - * 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 - - * 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 - - * experimental release 1.1b9_31. - -Wed Jul 15 15:05:27 1998 Yukihiro Matsumoto - - * eval.c (thread_create): exit() and abort() in threads now - forwarded to main_thread. - -Tue Jul 14 14:03:47 1998 Yukihiro Matsumoto - - * 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 - - * object.c (str2cstr): should not return NULL. - -Fri Jul 10 11:51:46 1998 Yukihiro Matsumoto - - * parse.y (gettable): needed to add dyna_in_block() check. - -Thu Jul 9 17:38:23 1998 Yukihiro Matsumoto - - * experimental release 1.1b9_30. - -Thu Jul 9 16:01:48 1998 Yukihiro Matsumoto - - * 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 - - * bignum.c (big_pow): abandon power by bignum (too big). - -Tue Jul 7 13:58:43 1998 Yukihiro Matsumoto - - * eval.c (rb_catch): add C level catch/throw feature. - -Mon Jul 6 15:18:09 1998 Yukihiro Matsumoto - - * parse.y (arg): proper return values for `||=' and `&&='. - -Fri Jul 3 16:05:11 1998 Yukihiro Matsumoto - - * experimental release 1.1b9_29. - -Fri Jul 3 11:20:46 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * numeric.c (flo_plus): should not allow addition with strings. - -Wed Jul 1 13:09:01 1998 Keiju ISHITSUKA - - * numeric.c (num_uminus): wrong coerce direction. - -Tue Jun 30 10:13:44 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * experimental release 1.1b9_28. - -Fri Jun 26 11:01:26 1998 WATANABE Hirofumi - - * string.c (str_aset_method): needed to convert to string. - -Thu Jun 25 02:05:50 1998 Yukihiro Matsumoto - - * 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 - - * re.c (reg_s_new): flag value was wrong. - -Wed Jun 24 23:45:06 1998 Yukihiro Matsumoto - - * regex.c (re_search): wrong anchor handling for reverse search. - -Wed Jun 24 02:18:57 1998 Yukihiro Matsumoto - - * 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 - - * parse.y (yylex): `&&=' and `||=' added. - -Sat Jun 20 02:53:50 1998 Yukihiro Matsumoto - - * 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 - - * experimental release 1.1b9_27. - -Fri Jun 19 14:34:49 1998 Yukihiro Matsumoto - - * 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 - - * experimental release 1.1b9_26. - -Thu Jun 18 13:37:19 1998 Yukihiro Matsumoto - - * 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 - - * parse.y (gettable): nesting local variables should have higher - priority than normal local variables. - -Tue Jun 16 12:30:46 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * eval.c (eval): write back the_dyna_var into the block. - -Thu Jun 11 18:19:18 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * string.c (str_split_method): split dumped core for "\xff". - -Tue Jun 9 16:22:12 1998 Yukihiro Matsumoto - - * experimental release 1.1b9_24. - -Tue Jun 9 16:04:07 1998 WATANABE Hirofumi - - * 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 - - * 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 - - * lib/parsedate.rb: wday moved to the last in the return values. - -Mon Jun 8 10:40:16 1998 Yukihiro Matsumoto - - * string.c (str_split_method): split dumped core for "\0". - -Sat Jun 6 22:50:52 1998 Yukihiro Matsumoto - - * 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 - - * re.c (reg_raise): check rb_in_compile, not rb_in_eval. - -Mon Jun 1 05:26:06 1998 WATANABE Tetsuya - - * string.c (trnext): casting to signed char* needed. - -Tue Jun 2 16:00:12 1998 Yukihiro Matsumoto - - * 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 - - * re.c (reg_prepare_re): no more needless regular expression - recompile on casefold conditions. - -Thu May 28 18:02:55 1998 Yukihiro Matsumoto - - * object.c (nil_plus): no more `+' method for nil. - -Wed May 27 17:33:46 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * regex.c (re_compile_pattern): (?XI) for turns off the - corresponding option. - -Mon May 25 12:38:56 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * BeOS patch. - -Wed May 20 16:32:19 1998 Yukihiro Matsumoto - - * bignum.c (BIGDN): use RSHIFT(), instead of mere `>>'. - -Tue May 19 16:36:26 1998 Yukihiro Matsumoto - - * experimental release 1.1b9_22. - -Tue May 19 16:31:57 1998 Yukihiro Matsumoto - - * 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 - - * numeric.c (num2int): re-defined (extensions may use this). - -Mon May 18 16:40:50 1998 MAEDA shugo - - * 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 added. - -Mon May 18 14:52:21 1998 Yukihiro Matsumoto - - * experimental release 1.1b9_21. - -Mon May 18 03:27:57 1998 MAEDA shugo - - * file.c (file_s_expand_path): optional second argument - `default_directory' added. - -Sat May 16 22:06:52 1998 WATANABE Hirofumi - - * error.c (RAISE_ERROR): wrong error message - -Fri May 15 14:43:25 1998 Yukihiro Matsumoto - - * experimental release 1.1b9_20. - -Thu May 14 14:44:21 1998 WATANABE Hirofumi - - * sun4 cc patches for intern.h and regex.h. - -Thu May 14 14:03:16 1998 Yukihiro Matsumoto - - * 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 - - * BeOS patches for io.c, error.c and config.guess. - -Wed May 13 14:56:23 1998 Yukihiro Matsumoto - - * 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 - - * experimental release 1.1b9_18. - -Tue May 12 11:38:08 1998 Yukihiro Matsumoto - - * 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 - - * io.c (io_tell etc.): moved from File class to IO class. - -Fri May 8 12:26:37 1998 Yukihiro Matsumoto - - * pack.c (pack_unpack): should be unsigned int (was signed int). - -Thu May 7 16:34:10 1998 Yukihiro Matsumoto - - * 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 - - * ruby.c (ruby_process_options): modified for DJGPP. - -Wed May 6 15:48:03 1998 Yukihiro Matsumoto - - * experimental release 1.1b9_17. - -Wed May 6 01:37:39 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * ruby.c (proc_options): option '-e' via tempfile. - -Tue Apr 28 15:27:58 1998 Yukihiro Matsumoto - - * experimental release 1.1b9_16. - -Tue Apr 28 00:07:38 1998 Yukihiro Matsumoto - - * eval.c (obj_is_proc): type check predicate. - - * eval.c (obj_is_block): ditto. - -Mon Apr 27 16:59:17 1998 Yukihiro Matsumoto - - * 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 - - * array.c (ary_sort): use dup, not clone. - -Mon Apr 27 13:46:27 1998 Tadahiro Maebashi - - * 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 - - * random.c (f_rand): do not call srand() implicitly. - -Fri Apr 24 14:35:45 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * array.c (ary_rindex): embarrassing typo. - -Tue Apr 21 12:31:48 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * variable.c (mod_remove_const): new method. - -Sat Apr 18 03:53:27 1998 Yukihiro Matsumoto - - * 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 - - * marshal.c (r_long): r_byte() may return signed byte. - -Fri Apr 17 11:58:30 1998 NAGAI Hidetoshi - - * ext/tcltklib/tcltklib.c (lib_mainloop): thread and interrupt check. - -Fri Apr 17 11:06:30 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * struct.c (struct_inspect): remove restriction for struct names. - -Wed Apr 15 02:55:02 1998 Kazuya 'Sharl' Masuda - - * x68 patches to config.sub, ext/extmk.rb.in - -Wed Apr 15 01:22:56 1998 Yukihiro Matsumoto - - * 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 - - * struct.c (struct_aref): should not subtract negative index. - -Tue Apr 14 11:34:50 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * eval.c (thread_trap_eval): all signals delivered to main_thread. - -Mon Apr 13 12:47:03 1998 TAKAHASHI Masayoshi - - * re.c (kcode_set_option): did not set SJIS on SJIS condition. - -Sun Apr 12 22:14:07 1998 Kazunori NISHI - - * array.c (ary_uniq_bang): should be `==', not `='. embarrassing. - -Sat Apr 11 02:13:30 1998 Yukihiro Matsumoto - - * array.c (ary_subseq): SEGVed for `[][1,1]'. - -Fri Apr 10 21:29:06 1998 Tadayoshi Funaba - - * array.c (ary_subseq): add check for beg larger than array length. - -Wed Apr 8 17:24:11 1998 MAEDA shugo - - * 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 - - * 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 - - * 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 - - * re.c (reg_regsub): need to check string boundary. - -Tue Apr 7 19:19:12 1998 Yukihiro Matsumoto - - * 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 - - * experimental release 1.1b9_08. - -Tue Apr 7 18:31:27 1998 WATANABE Hirofumi - - * instruby.rb (mandir): dll installation for cygwin32 - -Tue Apr 7 01:16:45 1998 Yukihiro Matsumoto - - * 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 - - * eval.c (thread_yield): must return evaluated value. - -Fri Apr 3 13:07:29 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * eval.c (obj_call_init): every object call `initialize'. - -Wed Apr 1 08:51:53 1998 Tadayoshi Funaba - - * parse.y (stmt): UNTIL_MOD should be for stmt, not only for expr. - -Wed Apr 1 01:20:31 1998 Yukihiro Matsumoto - - * object.c (true_and): boolean operators &, | and ^. - -Tue Mar 31 13:23:58 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * eval.c (f_throw): nil returned always. - -Sat Mar 28 20:40:12 1998 Yukihiro Matsumoto - - * experimental release 1.1b9_06. - -Sat Mar 28 16:07:11 1998 WATANABE Hirofumi - - * 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 - - * 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 - - * 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 - - * 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 - - * string.c (str_reverse_bang): string copied to wrong place. - -Wed Mar 25 08:12:07 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * experimental release 1.1b9_04. - - * parse.y (yylex): `10e0.9' should cause syntax error. - -Wed Mar 18 17:46:31 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * experimental release 1.1b9_03. - -Mon Mar 16 16:33:53 1998 WATANABE Hirofumi - - * io.c (pipe_finalize): needed to add pipe_finalize to pipes on - cygwin32. - -Mon Mar 16 14:11:06 1998 Yukihiro Matsumoto - - * class.c (ins_methods_i): needed to consider NOEX_UNDEF. - -Mon Mar 16 13:23:53 1998 WATANABE Hirofumi - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * numeric.c (flo_gt,etc.): do not depend on `<=>', to handle NaN. - -Tue Mar 10 00:03:24 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * class.c (ins_methods_i): body may be NULL for some case. - -Fri Mar 6 17:23:07 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * io.c (io_putc): new method. - -Tue Mar 3 11:21:28 1998 Yukihiro Matsumoto - - * 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 - - * struct.c (struct_alloc): incomplete struct initialization made - GC to access unallocated addresses. - -Mon Mar 2 16:28:27 1998 Yukihiro Matsumoto - - * eval.c (thread_stop_method): remove Thread#stop. - -Fri Feb 27 18:16:26 1998 Yukihiro Matsumoto - - * version 1.1b9 released. - -Fri Feb 27 09:36:35 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * io.c (f_syscall): no argument check. - -Fri Feb 20 10:17:51 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * parse.y (here_document): needed to set lex_state to EXPR_END. - -Wed Feb 18 18:45:10 1998 WATANABE Hirofumi - - * patches for cygwin32 applied. - -Wed Feb 18 00:41:31 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * regex.c (re_compile_pattern): need to fetch mbchar's second byte - without translation. - -Mon Feb 16 12:29:27 1998 MAEDA shugo - - * eval.c (f_pass_block): pass iterator block to other method. - -Fri Feb 13 08:16:11 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * string.c (str_empty): new method - -Fri Feb 6 01:42:15 1998 Yukihiro Matsumoto - - * time.c (time_asctime): use asctime(3), not strftime(3). - -Thu Feb 5 18:58:46 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * string.c (str_upcase_bang): multi byte character support. - -Wed Feb 4 13:55:26 1998 Yukihiro Matsumoto - - * array.c (ary_reverse): SEGV on empty array reverse. - -Tue Feb 3 12:24:07 1998 Yukihiro Matsumoto - - * 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 - - * numeric.c (fix_rshift): use `sizeof(INT)*8' instead of 32. - -Mon Feb 2 14:09:24 1998 Yukihiro Matsumoto - - * ruby.c (set_arg0): grab environment region too. - -Thu Jan 29 18:36:25 1998 WATANABE Hirofumi - - * process.c (rb_proc_exec): check `sh' to be exist. - -Thu Jan 29 18:18:19 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * ext/socket/socket.c (udp_addrsetup): forgot to use htons(). - -Tue Jan 27 23:15:24 1998 Yukihiro Matsumoto - - * keywords: __FILE__, __LINE__ are available again. - -Fri Jan 23 14:19:28 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * version 1.1b5 released. - - * process.c (rb_syswait): no exception raised. - -Fri Jan 16 00:43:43 1998 Yukihiro Matsumoto - - * 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 - - * ruby.c (proc_options): -S does not recognize PATH. - -Thu Jan 15 02:03:12 1998 Yukihiro Matsumoto - - * eval.c (rb_clear_cache_by_id): clear only affected cache - entries. - -Wed Jan 14 02:14:48 1998 Yukihiro Matsumoto - - * ext/socket/socket.c: new UDP/IP socket classes. - -Tue Jan 13 10:00:18 1998 Yukihiro Matsumoto - - * string.c (str_cmp): ignorecase($=) works wrong. - -Fri Jan 9 13:19:55 1998 Yukihiro Matsumoto - - * 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 - - * parse.y (aryset): expr in the brackets can be null. - -Wed Jan 7 21:13:56 1998 Yukihiro Matsumoto - - * io.c (io_reopen): keep stderr unclosed. - - * io.c (io_errset): keep stderr unclosed. - -Tue Jan 6 00:27:43 1998 Yukihiro Matsumoto - - * 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 - - * file.c (file_s_basename): removes any extension by ".*". - -Sun Jan 4 19:36:22 1998 WATANABE Hirofumi - - * parse.y (yylex): needed to update lex_p (reading point). - -Sat Jan 3 19:14:14 1998 WATANABE Hirofumi - - * class.c,object.c: duplicate defines mKernel and cFinxnum. - -Fri Jan 2 20:38:59 1998 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * version 1.1b3 released. - - * ruby.h: inlining some functions on gcc 2.x - -Tue Dec 23 02:47:33 1997 Yukihiro Matsumoto - - * 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 - - * regex.c (must_instr): need to skip 2 bytes for mbchars. - -Fri Dec 19 01:18:29 1997 Yukihiro Matsumoto - - * 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 - - * string.c (str_rindex): now accepts regexp as index. - -Thu Dec 18 18:42:50 1997 WATANABE Hirofumi - - * ext/socket/extconf.rb: modified to detect win32 socket lib. - -Thu Dec 18 00:25:03 1997 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * pack.c: sun4 cc patch - -Wed Dec 10 15:21:36 1997 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * io.c (io_puts): core dumped without any argument. - -Fri Dec 5 18:17:17 1997 Yukihiro Matsumoto - - * 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 - - * version 1.1b0 released. - - * string.c (str_aref): called str_index for regexp. - -Mon Dec 1 15:24:41 1997 Yukihiro Matsumoto - - * compar.c (cmp_between): wrong comparison made. - -Wed Nov 26 18:18:05 1997 Yukihiro Matsumoto - - * 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 - - * parse.y (yylex): skip multibyte characters in comments. - -Wed Nov 19 17:19:20 1997 Yukihiro Matsumoto - - * object.c (nil_to_a): nil.to_a => []. - - * parse.y (call_args): wrong node generation. - -Tue Nov 18 10:13:08 1997 Yukihiro Matsumoto - - * 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 - - * 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 - - * io.c (io_s_popen): "rb" detection - -Fri Nov 14 18:28:40 1997 Yukihiro Matsumoto - - * string.c (scan_once): returns whole match if the pattern does - not contain any parentheses. - -Thu Nov 13 14:39:06 1997 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * regex.c (re_compile_pattern): perl5 regxp \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 - - * string.c (str_sub_s): "".sub! "", "" => "\000" - -Fri Oct 31 15:52:10 1997 Yukihiro Matsumoto - - * parse.y (assoc): keyword assoc like {fg->"black"}. - -Thu Oct 30 17:33:38 1997 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * io.c (io_s_with_open_stream): ensures to close stream. - -Thu Oct 23 11:17:44 1997 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * intern.h: function prototypes added. - -Mon Oct 13 16:54:18 1997 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * ext/kconv/kconv.c (kconv_guess): code to guess character code - from string. - -Mon Oct 6 18:38:17 1997 WATANABE Hirofumi - - * pack.c: now encode/decode base64 by `m' template. - -Fri Oct 3 10:51:10 1997 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * ext/marshal/marshal.c (w_byte): argument must be char. - -Wed Oct 1 10:30:22 1997 Yukihiro Matsumoto - - * 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 - - * ext/marshal/marshal.c (w_object): marshal dumped core. - -Tue Sep 30 10:27:39 1997 Yukihiro Matsumoto - - * 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 - - * 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 - - * bignum.c: modified for speeding. - -Fri Sep 26 18:27:59 1997 WATANABE Hirofumi - - * sample/from.rb: some extensions. - -Mon Sep 29 13:15:56 1997 Yukihiro Matsumoto - - * parse.y (lhs): no more syntax error on `obj.CONSTANT = value'. - -Fri Sep 26 14:41:46 1997 Yukihiro Matsumoto - - * eval.c (ruby_run): deferred calling Init_ext() just before eval_node. - -Fri Sep 26 13:27:24 1997 WATANABE Hirofumi - - * io.c (io_isatty): forgot to return TRUE value. - -Fri Sep 25 11:10:58 1997 EGUCHI Osamu - - * eval.c: use _setjmp/_longjmp instead of setjmp/longjmp on some - platforms. - -Wed Sep 24 17:43:13 1997 Yukihiro Matsumoto - - * 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 - - * X68000 patch. - -Tue Sep 23 20:42:30 1997 EGUCHI Osamu - - * parse.y (node_newnode): SEGV on null node setup. - -Mon Sep 22 11:22:46 1997 Yukihiro Matsumoto - - * ruby.c (ruby_prog_init): wrong safe condition check. - -Sun Sep 21 14:46:02 1997 MAEDA shugo - - * error.c (exc_inspect): garbage added to classpath. - -Fri Sep 19 11:49:23 1997 Yukihiro Matsumoto - - * 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 - - * 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 - - * regex.c (re_compile_pattern): \w{3} and \W{3} did not work. - -Thu Sep 11 10:31:48 1997 Yukihiro Matsumoto - - * 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 - - * ext/marshal/marshal.c (r_bytes0): extra big length check. - -Tue Sep 9 16:27:14 1997 Yukihiro Matsumoto - - * 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 - - * io.c (io_s_new): dereferenced nil for optional mode. - -Fri Sep 5 10:26:03 1997 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * class.c (ins_methods_i): do not list undef'ed methods. - -Mon Sep 1 13:42:48 1997 Yukihiro Matsumoto - - * 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 - - * parse.y (yylex): heredoc dropped an extra character. - -Fri Aug 29 11:10:21 1997 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * parse.y (assignable): remove unnecessary local variable - initialize by nil. - -Fri Aug 22 14:26:40 1997 Yukihiro Matsumoto - - * eval.c (error_print): modified exception print format. - -Thu Aug 21 16:10:58 1997 Yukihiro Matsumoto - - * sample/ruby-mode.el (ruby-calculate-indent): wrong indent level - calculated with keyword operators. - -Thu Aug 21 11:36:58 1997 WATANABE Hirofumi - - * parse.y (arg): ary[0] += 1 cause SEGV - -Wed Aug 20 17:28:50 1997 Yukihiro Matsumoto - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * ext/socket/socket.c (Init_socket): small typo caused SEGV. - -Wed Aug 13 17:51:46 1997 Yukihiro Matsumoto - - * version 1.1 alpha0 released. diff --git a/GPL b/GPL deleted file mode 100644 index 5b6e7c66c2..0000000000 --- a/GPL +++ /dev/null @@ -1,340 +0,0 @@ - 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. - - - Copyright (C) - - 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. - - , 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 deleted file mode 100644 index dba950076b..0000000000 --- a/LEGAL +++ /dev/null @@ -1,323 +0,0 @@ -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 - Perl5 extension added by matz - UTF-8 extension added Jan 16 1999 by Yoshida Masato - -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. - -st.[ch]: -x68/*: -missing/alloca.c: -missing/dup2.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): - 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 - and Jan Dubois - - 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 deleted file mode 100644 index b1e3f5a263..0000000000 --- a/LGPL +++ /dev/null @@ -1,504 +0,0 @@ - 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. - - - Copyright (C) - - 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. - - , 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 dcbbe05c74..0000000000 --- a/MANIFEST +++ /dev/null @@ -1,301 +0,0 @@ -COPYING -COPYING.ja -ChangeLog -GPL -LEGAL -LGPL -MANIFEST -Makefile.in -README -README.ja -README.EXT -README.EXT.ja -ToDo -array.c -bignum.c -class.c -compar.c -configure -configure.in -config.guess -config.sub -defines.h -dir.c -dln.c -dln.h -dmyext.c -enum.c -env.h -error.c -eval.c -file.c -gc.c -hash.c -inits.c -install-sh -instruby.rb -intern.h -io.c -keywords -lex.c -main.c -marshal.c -math.c -missing.h -mkconfig.rb -node.h -numeric.c -object.c -pack.c -parse.c -parse.y -prec.c -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 -util.h -util.c -variable.c -version.c -version.h -djgpp/README.djgpp -djgpp/config.hin -djgpp/config.sed -djgpp/configure.bat -djgpp/mkver.sed -cygwin/GNUmakefile.in -doc/NEWS -doc/forwardable.rd -doc/forwardable.rd.ja -doc/irb/irb-tools.rd.ja -doc/irb/irb.rd -doc/irb/irb.rd.ja -doc/net/http.rd.ja -doc/net/pop.rd.ja -doc/net/smtp.rd.ja -doc/shell.rd -doc/shell.rd.ja -ext/Setup -ext/Setup.dj -ext/Setup.emx -ext/Setup.nt -ext/Setup.x68 -ext/aix_mksym.rb -ext/configsub.rb -ext/extmk.rb.in -lib/English.rb -lib/Env.rb -lib/README -lib/base64.rb -lib/benchmark.rb -lib/cgi.rb -lib/cgi/session.rb -lib/cgi-lib.rb -lib/complex.rb -lib/date.rb -lib/date/format.rb -lib/date2.rb -lib/debug.rb -lib/delegate.rb -lib/e2mmap.rb -lib/eregex.rb -lib/fileutils.rb -lib/find.rb -lib/final.rb -lib/finalize.rb -lib/forwardable.rb -lib/ftplib.rb -lib/ftools.rb -lib/getopts.rb -lib/getoptlong.rb -lib/importenv.rb -lib/irb.rb -lib/irb/completion.rb -lib/irb/context.rb -lib/irb/extend-command.rb -lib/irb/frame.rb -lib/irb/help.rb -lib/irb/init.rb -lib/irb/input-method.rb -lib/irb/lc/error.rb -lib/irb/lc/help-message -lib/irb/lc/ja/error.rb -lib/irb/lc/ja/help-message -lib/irb/loader.rb -lib/irb/locale.rb -lib/irb/multi-irb.rb -lib/irb/ruby-lex.rb -lib/irb/ruby-token.rb -lib/irb/slex.rb -lib/irb/version.rb -lib/irb/workspace.rb -lib/irb/ws-for-case-2.rb -lib/irb/xmp.rb -lib/jcode.rb -lib/mailread.rb -lib/mathn.rb -lib/matrix.rb -lib/mkmf.rb -lib/monitor.rb -lib/mutex_m.rb -lib/net/ftp.rb -lib/net/http.rb -lib/net/imap.rb -lib/net/pop.rb -lib/net/protocol.rb -lib/net/smtp.rb -lib/net/telnet.rb -lib/observer.rb -lib/open3.rb -lib/ostruct.rb -lib/parsearg.rb -lib/parsedate.rb -lib/ping.rb -lib/pp.rb -lib/prettyprint.rb -lib/profile.rb -lib/pstore.rb -lib/rational.rb -lib/readbytes.rb -lib/shell.rb -lib/shell/builtin-command.rb -lib/shell/command-processor.rb -lib/shell/error.rb -lib/shell/filter.rb -lib/shell/process-controller.rb -lib/shell/system-command.rb -lib/shell/version.rb -lib/shellwords.rb -lib/singleton.rb -lib/sync.rb -lib/telnet.rb -lib/tempfile.rb -lib/thread.rb -lib/thwait.rb -lib/time.rb -lib/timeout.rb -lib/tracer.rb -lib/tsort.rb -lib/uri.rb -lib/uri/common.rb -lib/uri/ftp.rb -lib/uri/generic.rb -lib/uri/http.rb -lib/uri/https.rb -lib/uri/ldap.rb -lib/uri/mailto.rb -lib/weakref.rb -misc/README -misc/inf-ruby.el -misc/ruby-mode.el -misc/rubydb2x.el -misc/rubydb3x.el -missing/acosh.c -missing/alloca.c -missing/crypt.c -missing/dup2.c -missing/file.h -missing/finite.c -missing/fileblocks.c -missing/flock.c -missing/hypot.c -missing/isinf.c -missing/isnan.c -missing/memcmp.c -missing/memmove.c -missing/mkdir.c -missing/os2.c -missing/strcasecmp.c -missing/strncasecmp.c -missing/strchr.c -missing/strerror.c -missing/strftime.c -missing/strstr.c -missing/strtod.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/dualstack-fetch.rb -sample/dualstack-httpd.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/irb.rb -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/rename.rb -sample/rcs.awk -sample/rcs.dat -sample/rcs.rb -sample/regx.rb -sample/sieve.rb -sample/svr.rb -sample/test.rb -sample/time.rb -sample/trojan.rb -sample/tsvr.rb -sample/uumerge.rb -win32/Makefile.sub -win32/README.win32 -win32/config.h.in -win32/config.status.in -win32/configure.bat -win32/dir.h -win32/mkexports.rb -win32/resource.rb -win32/setup.mak -win32/win32.c -win32/win32.h -win32/winmain.c -x68/fconvert.c -x68/select.c -x68/_dtos18.c -x68/_round.c diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index c9660106de..0000000000 --- a/Makefile.in +++ /dev/null @@ -1,303 +0,0 @@ -SHELL = /bin/sh - -#### Start of system configuration section. #### - -srcdir = @srcdir@ -VPATH = $(srcdir):$(srcdir)/missing - -CC = @CC@ -YACC = @YACC@ -PURIFY = -AUTOCONF = autoconf -@SET_MAKE@ - -prefix = @prefix@ -CFLAGS = @CFLAGS@ -CPPFLAGS = -I. -I$(srcdir) -LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@ -XLDFLAGS = @XLDFLAGS@ -EXTLIBS = -LIBS = @LIBS@ $(EXTLIBS) -MISSING = @LIBOBJS@ @ALLOCA@ -LDSHARED = @LIBRUBY_LDSHARED@ -DLDFLAGS = @LIBRUBY_DLDFLAGS@ -SOLIBS = @SOLIBS@ -MAINLIBS = @MAINLIBS@ - -RUBY_INSTALL_NAME=@RUBY_INSTALL_NAME@ -RUBY_SO_NAME=@RUBY_SO_NAME@ -EXEEXT = @EXEEXT@ -PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT) - -#### 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@ - -EXTOBJS = - -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$(EXEEXT) @PREP@ rbconfig.rb $(LIBRUBY) - @@MINIRUBY@ -Cext extmk.rb @EXTSTATIC@ - -miniruby$(EXEEXT): config.status $(LIBRUBY_A) $(MAINOBJ) dmyext.@OBJEXT@ - @rm -f $@ - $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) dmyext.@OBJEXT@ $(LIBRUBY_A) $(LIBS) -o $@ - -$(PROGRAM): $(LIBRUBY) $(MAINOBJ) $(EXTOBJS) - @rm -f $@ - $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@ - -$(LIBRUBY_A): $(OBJS) dmyext.@OBJEXT@ - @AR@ rcu $@ $(OBJS) dmyext.@OBJEXT@ - @-@RANLIB@ $@ 2> /dev/null || true - -$(LIBRUBY_SO): $(OBJS) dmyext.@OBJEXT@ miniruby$(EXEEXT) - $(LDSHARED) $(DLDFLAGS) $(OBJS) dmyext.@OBJEXT@ $(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@ $(srcdir)/instruby.rb $(DESTDIR) - -clean-ext:; @-@MINIRUBY@ -Cext extmk.rb 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@ -Cext extmk.rb distclean 2> /dev/null || true - -distclean-local: clean-local - @rm -f Makefile ext/extmk.rb 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 - -realclean: distclean - @rm -f parse.c - @rm -f lex.c - -test: miniruby$(EXEEXT) rbconfig.rb - @./miniruby$(EXEEXT) $(srcdir)/rubytest.rb - -rbconfig.rb: miniruby$(EXEEXT) $(srcdir)/mkconfig.rb config.status - @@MINIRUBY@ $(srcdir)/mkconfig.rb rbconfig.rb - -fake.rb: miniruby$(EXEEXT) - @echo ' \ - class Object; \ - remove_const :RUBY_PLATFORM; \ - remove_const :RUBY_VERSION; \ - RUBY_PLATFORM = "@arch@"; \ - RUBY_VERSION = "@MAJOR@.@MINOR@.@TEENY@"; \ - CROSS_COMPILING = true; \ - end \ - ' > $@ - -config.status: $(srcdir)/configure - $(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 - -parse.c: parse.y - $(YACC) $< - mv -f y.tab.c parse.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 - -crypt.@OBJEXT@: $(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 - -fileblocks.@OBJEXT@: $(srcdir)/missing/fileblocks.c - $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/fileblocks.c - -finite.@OBJEXT@: $(srcdir)/missing/finite.c - $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/finite.c - -flock.@OBJEXT@: $(srcdir)/missing/flock.c - $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/flock.c - -isinf.@OBJEXT@: $(srcdir)/missing/isinf.c - $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/isinf.c - -isnan.@OBJEXT@: $(srcdir)/missing/isnan.c - $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/isnan.c - -fnmatch.@OBJEXT@: $(srcdir)/missing/fnmatch.c - $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/fnmatch.c - -memcmp.@OBJEXT@: $(srcdir)/missing/memcmp.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/memcmp.c - -memmove.@OBJEXT@: $(srcdir)/missing/memmove.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/memmove.c - -mkdir.@OBJEXT@: $(srcdir)/missing/mkdir.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/mkdir.c - -vsnprintf.@OBJEXT@: $(srcdir)/missing/vsnprintf.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/vsnprintf.c - -strcasecmp.@OBJEXT@: $(srcdir)/missing/strcasecmp.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strcasecmp.c - -strncasecmp.@OBJEXT@: $(srcdir)/missing/strncasecmp.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strncasecmp.c - -strchr.@OBJEXT@: $(srcdir)/missing/strchr.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strchr.c - -strerror.@OBJEXT@: $(srcdir)/missing/strerror.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strerror.c - -strftime.@OBJEXT@: $(srcdir)/missing/strftime.c - $(CC) -I. $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strftime.c - -strstr.@OBJEXT@: $(srcdir)/missing/strstr.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/strstr.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: -### -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 config.h defines.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 version.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 -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 -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 deleted file mode 100644 index bde22dff78..0000000000 --- a/README +++ /dev/null @@ -1,106 +0,0 @@ -* What's Ruby - -Ruby is the interpreted scripting language for quick and -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 - + *Normal* Object-Oriented features(ex. class, method calls) - + *Advanced* Object-Oriented features(ex. Mix-in, Singleton-method) - + Operator Overloading - + Exception Handling - + Iterators and Closures - + Garbage Collection - + Dynamic Loading of Object files(on some architecture) - + 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: - - ftp://ftp.ruby-lang.org/pub/ruby/ - -You can get it by anonymous CVS. How to check out is: - - $ 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 - - -* Ruby home-page - -The URL of the Ruby home-page is: - - http://www.ruby-lang.org/ - - -* Mailing list - -There is a mailing list to talk about Ruby. -To subscribe this list, please send the following phrase - - subscribe YourFirstName YourFamilyName -e.g. - subscribe Joseph Smith - -in the mail body (not subject) to the address . - - -* How to compile and install - -This is what you need to do to compile and install Ruby: - - 1. If ./configure does not exist or is older than configure.in, - run autoconf to (re)generate configure. - - 2. Run ./configure, which will generate config.h and Makefile. - - 3. Edit defines.h if you need. Probably this step will not need. - - 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. - - 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. - - 5. Run make. - - 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). - - 7. Run 'make install' - - You may have to be a super user to install ruby. - -If you fail to compile ruby, please send the detailed error report with -the error log and machine/OS type, to help others. - - -* Copying - -See the file COPYING. - - -* The Author - -Feel free to send comments and bug reports to the author. Here is the -author's latest mail address: - - matz@netlab.jp - -------------------------------------------------------- -created at: Thu Aug 3 11:57:36 JST 1995 -Local variables: -mode: indented-text -end: diff --git a/README.EXT b/README.EXT deleted file mode 100644 index 49279db73f..0000000000 --- a/README.EXT +++ /dev/null @@ -1,1026 +0,0 @@ -.\" README.EXT - -*- Text -*- created at: Mon Aug 7 16:45:54 JST 1995 - -This document explains how to make extension libraries for Ruby. - -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. - -Data in Ruby represented C type `VALUE'. Each VALUE data have its -data-type. - -To retrieve an C data from the VALUE, you need to: - - (1) Identify VALUE's data type - (2) Convert VALUE into C data - -Converting to wrong data type may cause serious problems. - - -1.1 Data-types - -Ruby interpreter has data-types as below: - - T_NIL nil - T_OBJECT ordinary object - T_CLASS class - T_MODULE module - T_FLOAT floating point number - T_STRING string - T_REGEXP regular expression - T_ARRAY array - T_FIXNUM Fixnum(31bit integer) - T_HASH associative array - T_STRUCT (Ruby) structure - T_BIGNUM multi precision integer - T_TRUE true - T_FALSE false - T_DATA data - T_SYMBOL symbol - -Otherwise, there are several other types used internally: - - T_ICLASS - T_MATCH - T_UNDEF - T_VARMAP - T_SCOPE - T_NODE - -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. -TYPE() returns the constant number T_XXXX described above. To handle -data-types, the code will be like: - - switch (TYPE(obj)) { - case T_FIXNUM: - /* process Fixnum */ - break; - case T_STRING: - /* process String */ - break; - case T_ARRAY: - /* process Array */ - break; - default: - /* raise exception */ - rb_raise(rb_eTypeError, "not valid value"); - break; - } - -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. - -There are faster check-macros for fixnums and nil. - - FIXNUM_P(obj) - NIL_P(obj) - -1.3 Convert VALUE into C data - -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 the 31bit length fixed integer (63bit length on -some machines), which can be convert to the C integer by using -FIX2INT() macro. There also be NUM2INT() which converts any Ruby -numbers into C integer. The NUM2INT() macro includes type check, so -the exception will be raised if conversion failed. - -Other data types have corresponding C structures, e.g. struct RArray -for T_ARRAY etc. VALUE of the type which has corresponding structure -can be cast to retrieve the pointer to the struct. The casting macro -RXXXX for each data type like RARRAY(obj). see "ruby.h". - -For example, `RSTRING(size)->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, `RARRAY(ary)->len' and -`RARRAY(ary)->ptr' respectively. - -Notice: Do not change the value of the structure directly, unless you -are responsible about the result. It will be the cause of interesting -bugs. - -1.4 Convert C data into VALUE - -To convert C data to the values of Ruby: - - * FIXNUM - - left shift 1 bit, and turn on LSB. - - * Other pointer values - - cast to VALUE. - -You can determine whether VALUE is pointer or not, by checking LSB. - -Notice Ruby does not allow arbitrary pointer value to be VALUE. They -should be pointers to the structures which Ruby knows. The known -structures are defined in . - -To convert C numbers to Ruby value, use these macros. - - INT2FIX() for integers within 31bits. - INT2NUM() for arbitrary sized integer. - -INT2NUM() converts integers into Bignums, if it is out of FIXNUM -range, but bit slower. - -1.5 Manipulate Ruby data - -As I already told, it is not recommended to modify object's internal -structure. To manipulate objects, use functions supplied by Ruby -interpreter. Useful functions are listed below (not all): - - String functions - - rb_str_new(const char *ptr, long len) - - Creates a new Ruby string. - - rb_str_new2(const char *ptr) - - Creates a new Ruby string from C string. This is equivalent to - rb_str_new(ptr, strlen(ptr)). - - rb_tainted_str_new(const char *ptr, long len) - - Creates a new tainted Ruby string. Strings from external data - should be tainted. - - rb_tainted_str_new2(const char *ptr) - - Creates a new tainted Ruby string from C string. - - rb_str_cat(VALUE str, const char *ptr, long len) - - Appends len bytes data from ptr to the Ruby string. - - Array functions - - rb_ary_new() - - Creates an array with no element. - - rb_ary_new2(long len) - - Creates an array with no element, with allocating internal buffer - for len elements. - - rb_ary_new3(long n, ...) - - Creates an n-elements array from arguments. - - rb_ary_new4(long n, VALUE *elts) - - Creates an n-elements array from C array. - - 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.1 Add new features to Ruby - -You can add new features (classes, methods, etc.) to the Ruby -interpreter. Ruby provides the API to define things below: - - * Classes, Modules - * Methods, Singleton Methods - * Constants - -2.1.1 Class/module definition - -To define class or module, use functions below: - - 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 the variable to use later. - -To define nested class or module, use 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 functions below: - - void rb_define_method(VALUE klass, const 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. :-) - -If `argc' is negative, it specifies calling sequence, not number of -the arguments. - -If argc is -1, the function will be called like: - - VALUE func(int argc, VALUE *argv, VALUE obj) - -where argc is the actual number of arguments, argv is the C array of -the arguments, and obj is the receiver. - -if argc is -2, the arguments are passed in 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. - -There're two more functions to define method. One is to define -private method: - - void rb_define_private_method(VALUE klass, const char *name, - VALUE (*func)(), int argc) - -The other is to define module function, which is private AND singleton -method 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 function - - void rb_define_module_function(VALUE module, const char *name, - VALUE (*func)(), int argc) - -Oh, in addition, function-like method, which is private method defined -in Kernel module, can be defined using: - - 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 klass, const char *name, VALUE val) - void rb_define_global_const(const char *name, VALUE val) - -The former is to define constant under specified class/module. The -latter is to define global constant. - -2.2 Use Ruby features from C - -There are several ways to invoke Ruby's features from C code. - -2.2.1 Evaluate Ruby Program in String - -Easiest way to call Ruby's function from C program is to evaluate the -string as Ruby program. This function will do the job. - - VALUE rb_eval_string(const char *str) - -Evaluation is done under current context, thus current local variables -of the innermost method (which is defined by Ruby) can be accessed. - -2.2.2 ID or Symbol - -You can invoke methods directly, without parsing the string. First I -need to explain about symbols (which 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 like: - - :Identifier - -You can get the symbol value from string within C code, by using - - rb_intern(const char *name) - -2.2.3 Invoke Ruby method from C - -To invoke methods directly, you can use the function below - - VALUE rb_funcall(VALUE recv, ID mid, int argc, ...) - -This function invokes the method of the recv, which name is specified -by the symbol mid. - -2.2.4 Accessing the variables and constants - -You can access class variables, and instance variables using access -functions. Also, global variables can be shared between both worlds. -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) - -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) - -See 2.1.3 for defining new constant. - -3. Information sharing between Ruby and C - -3.1 Ruby constant that C can be accessed from C - -Following Ruby constants can be referred from C. - - Qtrue - Qfalse - -Boolean values. Qfalse is false in the C also (i.e. 0). - - Qnil - -Ruby nil in C scope. - -3.2 Global variables shared between C and Ruby - -Information can be shared between two worlds, using shared global -variables. To define them, you can use functions listed below: - - void rb_define_variable(const char *name, VALUE *var) - -This function defines the variable which is shared by the both world. -The value of the global variable pointed by `var', can be accessed -through Ruby's global variable named `name'. - -You can define read-only (from Ruby, of course) variable by the -function below. - - void rb_define_readonly_variable(const char *name, VALUE *var) - -You can defined hooked variables. The accessor functions (getter and -setter) are called on access to the hooked variables. - - void rb_define_hooked_variable(constchar *name, VALUE *var, - VALUE (*getter)(), void (*setter)()) - -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(). - - void rb_define_virtual_variable(const char *name, - VALUE (*getter)(), void (*setter)()) - -This function defines the Ruby global variable without corresponding C -variable. The value of the variable will be set/get only by hooks. - -The prototypes of the getter and setter functions are as following: - - (*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 - -To wrapping and objectify the C pointer as Ruby object (so called -DATA), use Data_Wrap_Struct(). - - Data_Wrap_Struct(klass, mark, free, ptr) - -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. The functions, mark and -free, will be called from garbage collector. - -You can allocate and wrap the structure in one step. - - Data_Make_Struct(klass, type, mark, free, sval) - -This macro returns an allocated Data object, wrapping the pointer to -the structure, which is also allocated. This macro works like: - - (sval = ALLOC(type), Data_Wrap_Struct(klass, mark, free, sval)) - -Arguments, klass, mark, free, works like their counterpart of -Data_Wrap_Struct(). The pointer to allocated structure will be -assigned to sval, which should be the pointer to the type specified. - -To retrieve the C pointer from the Data object, use the macro -Data_Get_Struct(). - - Data_Get_Struct(obj, type, sval) - -The pointer to the structure will be assigned to the variable sval. - -See example below for detail. - -4. Example - Creating dbm extension - -OK, here's the example to make extension library. This is the -extension to access dbm. The full source is included in ext/ -directory in the Ruby's source tree. - -(1) make the directory - - % mkdir ext/dbm - -Make a directory for the extension library under ext directory. - -(2) create MANIFEST file - - % cd ext/dbm - % touch MANIFEST - -There should be MANIFEST file in the directory for the extension -library. Make empty file now. - -(3) design the library - -You need to design the library features, before making it. - -(4) write C code. - -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 plural source -files, avoid choosing ``LIBRARY.c'' for a file name. It may conflict -with intermediate file ``LIBRARY.o'' on some platforms. - -Ruby will execute the initializing function named ``Init_LIBRARY'' in -the library. For example, ``Init_dbm()'' will be executed when loading -the library. - -Here's the example of an initializing function. - --- -Init_dbm() -{ - /* define DBM class */ - cDBM = rb_define_class("DBM", rb_cObject); - /* DBM includes Enumerate module */ - rb_include_module(cDBM, rb_mEnumerable); - - /* DBM has class method open(): arguments are received as C array */ - rb_define_singleton_method(cDBM, "open", fdbm_s_open, -1); - - /* DBM instance method close(): no args */ - rb_define_method(cDBM, "close", fdbm_close, 0); - /* DBM instance method []: 1 argument */ - rb_define_method(cDBM, "[]", fdbm_fetch, 1); - : - -} --- - -The dbm extension wrap dbm struct in C world using Data_Make_Struct. - --- -struct dbmdata { - int di_size; - DBM *di_dbm; -}; - - -obj = Data_Make_Struct(klass, struct dbmdata, 0, free_dbm, dbmp); --- - -This code wraps dbmdata structure into Ruby object. We avoid wrapping -DBM* directly, because we want to cache size information. - -To retrieve dbmdata structure from Ruby object, we define the macro below: - --- -#define GetDBM(obj, dbmp) {\ - Data_Get_Struct(obj, struct dbmdata, dbmp);\ - if (dbmp->di_dbm == 0) closed_dbm();\ -} --- - -This sort of complicated macro do the retrieving and close check for -the DBM. - -There are three kind of way to receiving method arguments. First, the -methods with fixed number of arguments receives arguments like this: - --- -static VALUE -fdbm_delete(obj, keystr) - VALUE obj, keystr; -{ - : -} --- - -The first argument of the C function is the self, the rest are the -arguments to the method. - -Second, the methods with arbitrary number of arguments receives -arguments like this: - --- -static VALUE -fdbm_s_open(argc, argv, klass) - int argc; - VALUE *argv; - VALUE klass; -{ - : - if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) { - mode = 0666; /* default value */ - } - : -} --- - -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. - -You can use the function rb_scan_args() to check and retrieve the -arguments. For example "11" means, the method requires at least one -argument, and at most receives two arguments. - -The methods with arbitrary number of arguments can receives arguments -by Ruby's array, like this: - --- -static VALUE -fdbm_indexes(obj, args) - VALUE obj, args; -{ - : -} --- - -The first argument is the receiver, the second one is the Ruby array -which contains the arguments to the method. - -** Notice - -GC should know about global variables which refers Ruby's objects, but -not exported to the Ruby world. You need to protect them by - - void rb_global_variable(VALUE *var) - -(5) prepare extconf.rb - -If there exists the file named extconf.rb, it will be executed to -generate Makefile. If not, compilation scheme try to generate -Makefile anyway. - -The extconf.rb is the file to check compilation condition etc. You -need to put - - require 'mkmf' - -at the top of the file. You can use the functions below to check the -condition. - - 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 - -The value of variables below will affect Makefile. - - $CFLAGS: included in CFLAGS make variable (such as -I) - $LDFLAGS: included in LDFLAGS make variable (such as -L) - -If compilation condition is not fulfilled, you do not call -``create_makefile''. Makefile will not generated, compilation will -not be done. - -(6) prepare depend (optional) - -If the file named depend exists, Makefile will include that file to -check dependency. You can make this file by invoking - - % gcc -MM *.c > depend - -It's no harm. Prepare it. - -(7) put file names into MANIFEST (optional) - - % find * -type f -print > MANIFEST - % vi MANIFEST - -Append file names into MANIFEST. The compilation scheme requires -MANIFEST only to be exist. But, you'd better take this step to -distinguish required files. - -(8) generate Makefile - -Try generate Makefile by: - - ruby extconf.rb - -You don't need this step, if you put extension library under ext -directory of the ruby source tree. In that case, compilation of the -interpreter will do this step for you. - -(9) make - -Type - - make - -to compile your extension. You don't need this step neither, if you -put extension library under ext directory of the ruby source tree. - -(9) debug - -You may need to rb_debug the extension. The extensions can be linked -statically by adding directory name in the ext/Setup file, so that you -can inspect the extension with the debugger. - -(10) done, now you have the extension library - -You can do anything you want with your library. The author of Ruby -will not claim any restriction about your code depending Ruby API. -Feel free to use, modify, distribute or sell your program. - -Appendix A. Ruby source files overview - -ruby language core - - class.c - error.c - eval.c - gc.c - object.c - parse.y - variable.c - -utility functions - - dln.c - regex.c - st.c - util.c - -ruby interpreter implementation - - dmyext.c - inits.c - main.c - ruby.c - version.c - -class library - - array.c - bignum.c - compar.c - dir.c - enum.c - file.c - hash.c - io.c - marshal.c - math.c - numeric.c - pack.c - prec.c - process.c - random.c - range.c - re.c - signal.c - sprintf.c - string.c - struct.c - time.c - -Appendix B. Ruby extension API reference - -** Types - - VALUE - -The type for 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 - - Qnil - -const: nil object - - Qtrue - -const: true object(default true value) - - Qfalse - -const: false object - -** C pointer wrapping - - Data_Wrap_Struct(VALUE klass, void (*mark)(), void (*free)(), void *sval) - -Wrap C pointer into Ruby object. If object has references to other -Ruby object, they should be marked by using mark function during 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(klass, type, mark, free, sval) - -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) - -This macro retrieves the pointer value from DATA, and assigns it to -the variable sval. - -** defining class/module - - VALUE rb_define_class(const char *name, VALUE super) - -Defines new Ruby class as subclass of super. - - VALUE rb_define_class_under(VALUE module, const char *name, VALUE super) - -Creates new Ruby class as subclass of super, under the module's -namespace. - - VALUE rb_define_module(const char *name) - -Defines new Ruby module. - - VALUE rb_define_module_under(VALUE module, const char *name, VALUE super) - -Defines new Ruby module, under the module's namespace. - - void rb_include_module(VALUE klass, VALUE module) - -Includes module into class. If class already includes it, just -ignore. - - void rb_extend_object(VALUE object, VALUE module) - -Extend the object with module's attribute. - -** Defining Global Variables - - void rb_define_variable(const char *name, VALUE *var) - -Defines a global variable which is shared between C and Ruby. If name -contains the character which is not allowed to be part of the symbol, -it can't be seen from Ruby programs. - - void rb_define_readonly_variable(const char *name, VALUE *var) - -Defines a read-only global variable. Works just like -rb_define_variable(), except defined variable is read-only. - - void rb_define_virtual_variable(const char *name, - VALUE (*getter)(), VALUE (*setter)()) - -Defines a virtual variable, whose behavior is defined by 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) - -The getter function must return the value for the access. - - void rb_define_hooked_variable(const char *name, VALUE *var, - VALUE (*getter)(), VALUE (*setter)()) - -Defines hooked variable. It's virtual variable with C variable. The -getter is called as - - VALUE getter(ID id, VALUE *var) - -returning new value. The setter is called as - - void setter(VALUE val, ID id, VALUE *var) - -GC requires to mark the C global variables which hold Ruby values. - - void rb_global_variable(VALUE *var) - -Tells GC to protect these variables. - -** Constant Definition - - void rb_define_const(VALUE klass, const char *name, VALUE val) - -Defines a new constant under the class/module. - - void rb_define_global_const(const char *name, VALUE val) - -Defines global constant. This is just work as - - rb_define_const(cKernal, name, val) - -** Method Definition - - rb_define_method(VALUE klass, const 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 the Ruby array of -the method arguments. - - rb_define_private_method(VALUE klass, const char *name, VALUE (*func)(), int argc) - -Defines a private method for the class. Arguments are same as -rb_define_method(). - - rb_define_singleton_method(VALUE klass, const char *name, VALUE (*func)(), int argc) - -Defines a singleton method. Arguments are same as rb_define_method(). - - rb_scan_args(int argc, VALUE *argv, const 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 corresponding variable, packed in -array. - -** Invoking Ruby method - - VALUE rb_funcall(VALUE recv, ID mid, int narg, ...) - -Invokes the method. To retrieve mid from method name, use rb_intern(). - - VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv) - -Invokes method, passing arguments by array of values. - - VALUE rb_eval_string(const char *str) - -Compiles and executes the string as Ruby program. - - ID rb_intern(const char *name) - -Returns ID corresponding the name. - - char *rb_id2name(ID id) - -Returns the name corresponding ID. - - char *rb_class2name(VALUE klass) - -Returns the name of the class. - - int rb_respond_to(VALUE object, ID id) - -Returns true if the object responds to the message specified by id. - -** Instance Variables - - VALUE rb_iv_get(VALUE obj, const char *name) - -Retrieve the value of the instance variable. If the name is not -prefixed by `@', that variable shall be inaccessible from Ruby. - - 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) - -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) - -Evaluates the block with value val. - - VALUE rb_rescue(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2) - -Calls the function func1, with arg1 as the argument. If 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) - -Calls the function func1 with arg1 as the argument, then calls func2 -with arg2, whenever execution terminated. The return value from -rb_ensure() is that of func1. - -** Exceptions and Errors - - void rb_warn(const char *fmt, ...) - -Prints warning message according to the printf-like format. - - void rb_warning(const char *fmt, ...) - -Prints warning message according to the printf-like format, if -$VERBOSE is true. - - void rb_raise(VALUE exception, const char *fmt, ...) - -Raises an exception of class exception. The fmt is the format string -just like printf(). - - void rb_fatal(const char *fmt, ...) - -Raises fatal error, terminates the interpreter. No exception handling -will be done for fatal error, but ensure blocks will be executed. - - void rb_bug(const 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 - -The embedding API are below (not needed for extension libraries): - - void ruby_init() - -Initializes the interpreter. - - void ruby_options(int argc, char **argv) - -Process command line arguments for the interpreter. - - void ruby_run() - -Starts execution of the interpreter. - - void ruby_script(char *name) - -Specifies the name of the script ($0). - -Appendix C. Functions Available in extconf.rb - -These functions are available in extconf.rb: - - have_library(lib, func) - -Checks whether library which contains specified function exists. -Returns true if the library exists. - - find_library(lib, func, path...) - -Checks whether library which contains specified function exists in -path. Returns true if the library exists. - - have_func(func, header) - -Checks whether func exists with header. Returns true if the function -exists. To check functions in the additional library, you need to -check that library first using have_library(). - - have_header(header) - -Checks whether header exists. Returns true if the header file exists. - - create_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-. - - dir_config(target[, default_dir]) - dir_config(target[, default_include, default_lib]) - -Parses the command line options and adds the directories specified by ---with--dir, --with--include, and/or --with--lib -to $CFLAGS and/or $LDFLAGS. --with--dir=/path is equivalent to ---with--include=/path/include --with--lib=/path/lib. -Returns an array of the added directories ([include_dir, lib_dir]). - -/* - * Local variables: - * fill-column: 70 - * end: - */ diff --git a/README.EXT.ja b/README.EXT.ja deleted file mode 100644 index 0ef67497ce..0000000000 --- a/README.EXT.ja +++ /dev/null @@ -1,1187 +0,0 @@ -.\" README.EXT.ja - -*- Text -*- created at: Mon Aug 7 16:45:54 JST 1995 - -Rubyの拡張ライブラリの作り方を説明します. - -1.基礎知識 - -Cの変数には型があり,データには型がありません.ですから,た -とえばポインタをintの変数に代入すると,その値は整数として取 -り扱われます.逆にRubyの変数には型がなく,データに型がありま -す.この違いのため,CとRubyは相互に変換しなければ,お互いの -データをアクセスできません. - -RubyのデータはVALUEというCの型で表現されます.VALUE型のデー -タはそのデータタイプを自分で知っています.このデータタイプと -いうのはデータ(オブジェクト)の実際の構造を意味していて,Ruby -のクラスとはまた違ったものです. - -VALUEからCにとって意味のあるデータを取り出すためには - - (1) VALUEのデータタイプを知る - (2) VALUEをCのデータに変換する - -の両方が必要です.(1)を忘れると間違ったデータの変換が行われ -て,最悪プログラムがcore dumpします. - -1.1 データタイプ - -Rubyにはユーザが使う可能性のある以下のタイプがあります. - - T_NIL nil - T_OBJECT 通常のオブジェクト - T_CLASS クラス - T_MODULE モジュール - T_FLOAT 浮動小数点数 - T_STRING 文字列 - T_REGEXP 正規表現 - T_ARRAY 配列 - T_FIXNUM Fixnum(31bit長整数) - T_HASH 連想配列 - T_STRUCT (Rubyの)構造体 - T_BIGNUM 多倍長整数 - T_FILE 入出力 - T_TRUE 真 - T_FALSE 偽 - T_DATA データ - T_SYMBOL シンボル - -その他に内部で利用されている以下のタイプがあります. - - T_ICLASS - T_MATCH - T_UNDEF - T_VARMAP - T_SCOPE - T_NODE - -ほとんどのタイプはCの構造体で実装されています. - -1.2 VALUEのデータタイプをチェックする - -ruby.hではTYPE()というマクロが定義されていて,VALUEのデータ -タイプを知ることが出来ます.TYPE()マクロは上で紹介したT_XXXX -の形式の定数を返します.VALUEのデータタイプに応じて処理する -場合には,TYPE()の値で分岐することになります. - - switch (TYPE(obj)) { - case T_FIXNUM: - /* FIXNUMの処理 */ - break; - case T_STRING: - /* 文字列の処理 */ - break; - case T_ARRAY: - /* 配列の処理 */ - break; - default: - /* 例外を発生させる */ - rb_raise(rb_eTypeError, "not valid value"); - break; - } - -それとデータタイプをチェックして,正しくなければ例外を発生す -る関数が用意されています. - - void Check_Type(VALUE value, int type) - -この関数はvalueがtypeで無ければ,例外を発生させます.引数と -して与えられたVALUEのデータタイプが正しいかどうかチェックす -るためには,この関数を使います. - -FIXNUMとNILに関してはより高速な判別マクロが用意されています. - - FIXNUM_P(obj) - NIL_P(obj) - -1.3 VALUEをCのデータに変換する - -データタイプがT_NIL, T_FALSE, T_TRUEである時,データはそれぞ -れnil, false, trueです.このデータタイプのオブジェクトはひと -つずつしか存在しません. - -データタイプがT_FIXNUMの時,これは31bitのサイズを持つ整数で -す.FIXNUMをCの整数に変換するためにはマクロ「FIX2INT()」を使 -います.それから,FIXNUMに限らずRubyのデータを整数に変換する -「NUM2INT()」というマクロがあります.このマクロはデータタイ -プのチェック無しで使えます(整数に変換できない場合には例外が -発生する). - -同様にチェック無しで使える変換マクロはdoubleを取り出す -「NUM2DBL()」とchar*を取り出す「STR2CSTR()」があります. - -それ以外のデータタイプは対応するCの構造体があります.対応す -る構造体のあるVALUEはそのままキャスト(型変換)すれば構造体の -ポインタに変換できます. - -構造体は「struct RXxxxx」という名前でruby.hで定義されていま -す.例えば文字列は「struct RString」です.実際に使う可能性が -あるのは文字列と配列くらいだと思います. - -ruby.hでは構造体へキャストするマクロも「RXXXXX()」(全部大文 -字にしたもの)という名前で提供されています(例: RSTRING()). - -例えば,文字列strの長さを得るためには「RSTRING(str)->len」と -し,文字列strをchar*として得るためには「RSTRING(str)->ptr」 -とします.配列の場合には,それぞれ「RARRAY(ary)->len」, -「RARRAY(ary)->ptr」となります. - -Rubyの構造体を直接アクセスする時に気をつけなければならないこ -とは,配列や文字列の構造体の中身は参照するだけで,直接変更し -ないことです.直接変更した場合,オブジェクトの内容の整合性が -とれなくなって,思わぬバグの原因になります. - -1.4 CのデータをVALUEに変換する - -VALUEの実際の構造は - - * FIXNUMの場合 - - 1bit左シフトして,LSBを立てる. - - * その他のポインタの場合 - - そのままVALUEにキャストする. - -となっています.よって,LSBをチェックすればVALUEがFIXNUMかど -うかわかるわけです(ポインタのLSBが立っていないことを仮定して -いる). - -ですから,FIXNUM以外のRubyのオブジェクトの構造体は単にVALUE -にキャストするだけでVALUEに変換出来ます.ただし,任意の構造 -体がVALUEにキャスト出来るわけではありません.キャストするの -はRubyの知っている構造体(ruby.hで定義されているstruct RXxxx -のもの)だけです. - -FIXNUMに関しては変換マクロを経由する必要があります.Cの整数 -からVALUEに変換するマクロは以下のものがあります.必要に応じ -て使い分けてください. - - INT2FIX() もとの整数が31bit以内に収まる自信がある時 - INT2NUM() 任意の整数からVALUEへ - -INT2NUM()は整数がFIXNUMの範囲に収まらない場合,Bignumに変換 -してくれます(が,少し遅い). - -1.5 Rubyのデータを操作する - -先程も述べた通り,Rubyの構造体をアクセスする時に内容の更新を -行うことは勧められません.で,Rubyのデータを操作する時には -Rubyが用意している関数を用いてください. - -ここではもっとも使われるであろう文字列と配列の生成/操作を行 -い関数をあげます(全部ではないです). - - 文字列に対する関数 - - rb_str_new(const char *ptr, long len) - - 新しいRubyの文字列を生成する. - - rb_str_new2(const char *ptr) - - Cの文字列からRubyの文字列を生成する.この関数の機能は - rb_str_new(ptr, strlen(ptr))と同等である. - - rb_tainted_str_new(const char *ptr, long len) - - 汚染マークが付加された新しいRubyの文字列を生成する.外部 - からのデータに基づく文字列には汚染マークが付加されるべき - である. - - rb_tainted_str_new2(const char *ptr) - - Cの文字列から汚染マークが付加されたRubyの文字列を生成する. - - rb_str_cat(VALUE str, const char *ptr, long len) - - Rubyの文字列strにlenバイトの文字列ptrを追加する. - - 配列に対する関数 - - rb_ary_new() - - 要素が0の配列を生成する. - - rb_ary_new2(long len) - - 要素が0の配列を生成する.len要素分の領域をあらかじめ割り - 当てておく. - - rb_ary_new3(long n, ...) - - 引数で指定したn要素を含む配列を生成する. - - rb_ary_new4(long n, VALUE *elts) - - 配列で与えたn要素の配列を生成する. - - 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の同名のメソッドと同じ働きをする関数.第1引数は必ず - 配列でなければならない. - -2.Rubyの機能を使う - -原理的にRubyで書けることはCでも書けます.RubyそのものがCで記 -述されているんですから,当然といえば当然なんですけど.ここで -はRubyの拡張に使うことが多いだろうと予測される機能を中心に紹 -介します. - -2.1 Rubyに機能を追加する - -Rubyで提供されている関数を使えばRubyインタプリタに新しい機能 -を追加することができます.Rubyでは以下の機能を追加する関数が -提供されています. - - * クラス,モジュール - * メソッド,特異メソッドなど - * 定数 - -では順に紹介します. - -2.1.1 クラス/モジュール定義 - -クラスやモジュールを定義するためには,以下の関数を使います. - - VALUE rb_define_class(const char *name, VALUE super) - VALUE rb_define_module(const 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 klass, const char *name, - VALUE (*func)(), int argc) - - void rb_define_singleton_method(VALUE object, const char *name, - VALUE (*func)(), int argc) - - -念のため説明すると「特異メソッド」とは,その特定のオブジェク -トに対してだけ有効なメソッドです.RubyではよくSmalltalkにお -けるクラスメソッドとして,クラスに対する特異メソッドが使われ -ます. - -これらの関数の argcという引数はCの関数へ渡される引数の数(と -形式)を決めます.argcが0以上の時は関数に引き渡す引数の数を意 -味します.16個以上の引数は使えません(が,要りませんよね,そ -んなに).実際の関数には先頭の引数としてselfが与えられますの -で,指定した数より1多い引数を持つことになります. - -argcが負の時は引数の数ではなく,形式を指定したことになります. -argcが-1の時は引数を配列に入れて渡されます.argcが-2の時は引 -数はRubyの配列として渡されます. - -メソッドを定義する関数はもう二つあります.ひとつはprivateメ -ソッドを定義する関数で,引数はrb_define_method()と同じです. - - void rb_define_private_method(VALUE klass, const char *name, - VALUE (*func)(), int argc) - -privateメソッドとは関数形式でしか呼び出すことの出来ないメソッ -ドです. - -もうひとつはモジュール関数を定義するものです.モジュール関数 -とはモジュールの特異メソッドであり,同時にprivateメソッドで -もあるものです.例をあげるとMathモジュールのsqrt()などがあげ -られます.このメソッドは - - Math.sqrt(4) - -という形式でも - - include Math - sqrt(4) - -という形式でも使えます.モジュール関数を定義する関数は以下の -通りです. - - void rb_define_module_function(VALUE module, const char *name, - VALUE (*func)(), int argc) - -関数的メソッド(Kernelモジュールのprivate method)を定義するた -めの関数は以下の通りです. - - 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 klass, const char *name, VALUE val) - void rb_define_global_const(const char *name, VALUE val) - -前者は特定のクラス/モジュールに属する定数を定義するもの,後 -者はグローバルな定数を定義するものです. - -2.2 Rubyの機能をCから呼び出す - -既に『1.5 Rubyのデータを操作する』で一部紹介したような関数を -使えば,Rubyの機能を実現している関数を直接呼び出すことが出来 -ます. - -# このような関数の一覧表はいまのところありません.ソースを見 -# るしかないですね. - -それ以外にもRubyの機能を呼び出す方法はいくつかあります. - -2.2.1 Rubyのプログラムをevalする - -CからRubyの機能を呼び出すもっとも簡単な方法として,文字列で -与えられたRubyのプログラムを評価する以下の関数があります. - - VALUE rb_eval_string(const char *str) - -この評価は現在の環境で行われます.つまり,現在のローカル変数 -などを受け継ぎます. - -2.2.2 IDまたはシンボル - -Cから文字列を経由せずにRubyのメソッドを呼び出すこともできま -す.その前に,Rubyインタプリタ内でメソッドや変数名を指定する -時に使われているIDについて説明しておきましょう. - -IDとは変数名,メソッド名を表す整数です.Rubyの中では - - :識別子 - -でアクセスできます.Cからこの整数を得るためには関数 - - rb_intern(const char *name) - -を使います.Rubyから引数として与えられたシンボル(または文字 -列)をIDに変換するには以下の関数を使います. - - rb_to_id(VALUE symbol) - -2.2.3 CからRubyのメソッドを呼び出す - -Cから文字列を経由せずにRubyのメソッドを呼び出すためには以下 -の関数を使います. - - VALUE rb_funcall(VALUE recv, ID mid, int argc, ...) - -この関数はオブジェクトrecvのmidで指定されるメソッドを呼び出 -します.その他に引数の指定の仕方が違う以下の関数もあります. - - VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv) - VALUE rb_apply(VALUE recv, ID mid, VALUE args) - -applyには引数としてRubyの配列を与えます. - -2.2.4 変数/定数を参照/更新する - -Cから関数を使って参照・更新できるのは,定数,インスタンス変 -数です.大域変数は一部のものはCの大域変数としてアクセスでき -ます.ローカル変数を参照する方法は公開していません. - -オブジェクトのインスタンス変数を参照・更新する関数は以下の通 -りです. - - VALUE rb_ivar_get(VALUE obj, ID id) - VALUE rb_ivar_set(VALUE obj, ID id, VALUE val) - -idはrb_intern()で得られるものを使ってください. - -定数を参照するには以下の関数を使ってください. - - VALUE rb_const_get(VALUE obj, ID id) - -定数を新しく定義するためには『2.1.3 定数定義』で紹介さ -れている関数を使ってください. - -3.RubyとCとの情報共有 - -C言語とRubyの間で情報を共有する方法について解説します. - -3.1 Cから参照できるRubyの定数 - -以下のRubyの定数はCのレベルから参照できます. - - Qtrue - Qfalse - - 真偽値.QfalseはC言語でも偽とみなされます(つまり0). - - Qnil - - C言語から見た「nil」. - -3.2 CとRubyで共有される大域変数 - -CとRubyで大域変数を使って情報を共有できます.共有できる大域 -変数にはいくつかの種類があります.そのなかでもっとも良く使わ -れると思われるのはrb_define_variable()です. - - void rb_define_variable(const char *name, VALUE *var) - -この関数はRubyとCとで共有する大域変数を定義します.変数名が -`$'で始まらない時には自動的に追加されます.この変数の値を変 -更すると自動的にRubyの対応する変数の値も変わります. - -またRuby側からは更新できない変数もあります.このread onlyの -変数は以下の関数で定義します. - - void rb_define_readonly_variable(const char *name, VALUE *var) - -これら変数の他にhookをつけた大域変数を定義できます.hook付き -の大域変数は以下の関数を用いて定義します.hook付き大域変数の -値の参照や設定はhookで行う必要があります. - - void rb_define_hooked_variable(const char *name, VALUE *var, - VALUE (*getter)(), void (*setter)()) - -この関数はCの関数によってhookのつけられた大域変数を定義しま -す.変数が参照された時には関数getterが,変数に値がセットされ -た時には関数setterが呼ばれる.hookを指定しない場合はgetterや -setterに0を指定します. - -# getterもsetterも0ならばrb_define_variable()と同じになる. - -それから,Cの関数によって実現されるRubyの大域変数を定義する -関数があります. - - void rb_define_virtual_variable(const char *name, - VALUE (*getter)(), void (*setter)()) - -この関数によって定義されたRubyの大域変数が参照された時には -getterが,変数に値がセットされた時にはsetterが呼ばれます. - -getterとsetterの仕様は以下の通りです. - - (*getter)(ID id, void *data, struct global_entry* entry); - (*setter)(VALUE val, ID id, void *data, struct global_entry* entry); - -3.3 CのデータをRubyオブジェクトにする - -Cの世界で定義されたデータ(構造体)をRubyのオブジェクトとして -取り扱いたい場合がありえます.このような場合には,Dataという -RubyオブジェクトにCの構造体(へのポインタ)をくるむことでRuby -オブジェクトとして取り扱えるようになります. - -Dataオブジェクトを生成して構造体をRubyオブジェクトにカプセル -化するためには,以下のマクロを使います. - - Data_Wrap_Struct(klass, mark, free, ptr) - -このマクロの戻り値は生成されたDataオブジェクトです. - -klassはこのDataオブジェクトのクラスです.ptrはカプセル化する -Cの構造体へのポインタです.markはこの構造体がRubyのオブジェ -クトへの参照がある時に使う関数です.そのような参照を含まない -時には0を指定します. - -# そのような参照は勧められません. - -freeはこの構造体がもう不要になった時に呼ばれる関数です.この -関数がガーベージコレクタから呼ばれます. - -Cの構造体の割当とDataオブジェクトの生成を同時に行うマクロと -して以下のものが提供されています. - - Data_Make_Struct(klass, type, mark, free, sval) - -このマクロの戻り値は生成されたDataオブジェクトです. - -klass, mark, freeはData_Wrap_Structと同じ働きをします.type -は割り当てるC構造体の型です.割り当てられた構造体は変数sval -に代入されます.この変数の型は (type*) である必要があります. - -Dataオブジェクトからポインタを取り出すのは以下のマクロを用い -ます. - - Data_Get_Struct(obj, type, sval) - -Cの構造体へのポインタは変数svalに代入されます. - -これらのDataの使い方はちょっと分かりにくいので,後で説明する -例題を参照してください. - -4.例題 - dbmパッケージを作る - -ここまでの説明でとりあえず拡張ライブラリは作れるはずです. -Rubyのextディレクトリにすでに含まれているdbmライブラリを例に -して段階的に説明します. - -(1) ディレクトリを作る - - % mkdir ext/dbm - -Ruby 1.1からは任意のディレクトリでダイナミックライブラリを作 -ることができるようになりました.Rubyに静的にリンクする場合に -はRubyを展開したディレクトリの下,extディレクトリの中に拡張 -ライブラリ用のディレクトリを作る必要があります.名前は適当に -選んで構いません. - -(2) MANIFESTファイルを作る - - % cd ext/dbm - % touch MANIFEST - -拡張ライブラリのディレクトリの下にはMANIFESTというファイルが -必要なので,とりあえず空のファイルを作っておきます.後でこの -ファイルには必要なファイル一覧が入ることになります. - -MANIFESTというファイルは,静的リンクのmakeの時にディレクトリ -が拡張ライブラリを含んでいるかどうか判定するために使われれて -います.ダイナミックライブラリを作る場合には必ずしも必要では -ありません. - -(3) 設計する - -まあ,当然なんですけど,どういう機能を実現するかどうかまず設 -計する必要があります.どんなクラスをつくるか,そのクラスには -どんなメソッドがあるか,クラスが提供する定数などについて設計 -します. - -(4) Cコードを書く - -拡張ライブラリ本体となるC言語のソースを書きます.C言語のソー -スがひとつの時には「ライブラリ名.c」を選ぶと良いでしょう.C -言語のソースが複数の場合には逆に「ライブラリ名.c」というファ -イル名は避ける必要があります.オブジェクトファイルとモジュー -ル生成時に中間的に生成される「ライブラリ名.o」というファイル -とが衝突するからです. - -Rubyは拡張ライブラリをロードする時に「Init_ライブラリ名」と -いう関数を自動的に実行します.dbmライブラリの場合「Init_dbm」 -です.この関数の中でクラス,モジュール,メソッド,定数などの -定義を行います.dbm.cから一部引用します. - --- -Init_dbm() -{ - /* DBMクラスを定義する */ - cDBM = rb_define_class("DBM", rb_cObject); - /* DBMはEnumerateモジュールをインクルードする */ - rb_include_module(cDBM, rb_mEnumerable); - - /* DBMクラスのクラスメソッドopen(): 引数はCの配列で受ける */ - rb_define_singleton_method(cDBM, "open", fdbm_s_open, -1); - - /* DBMクラスのメソッドclose(): 引数はなし */ - rb_define_method(cDBM, "close", fdbm_close, 0); - /* DBMクラスのメソッド[]: 引数は1個 */ - rb_define_method(cDBM, "[]", fdbm_fetch, 1); - : - - /* DBMデータを格納するインスタンス変数名のためのID */ - id_dbm = rb_intern("dbm"); -} --- - -DBMライブラリはdbmのデータと対応するオブジェクトになるはずで -すから,Cの世界のdbmをRubyの世界に取り込む必要があります. - - -dbm.cではData_Make_Structを以下のように使っています. - --- -struct dbmdata { - int di_size; - DBM *di_dbm; -}; - - -obj = Data_Make_Struct(klass, struct dbmdata, 0, free_dbm, dbmp); --- - -ここではdbmstruct構造体へのポインタをDataにカプセル化してい -ます.DBM*を直接カプセル化しないのはclose()した時の処理を考 -えてのことです. - -Dataオブジェクトからdbmstruct構造体のポインタを取り出すため -に以下のマクロを使っています. - --- -#define GetDBM(obj, dbmp) {\ - Data_Get_Struct(obj, struct dbmdata, dbmp);\ - if (dbmp->di_dbm == 0) closed_dbm();\ -} --- - -ちょっと複雑なマクロですが,要するにdbmdata構造体のポインタ -の取り出しと,closeされているかどうかのチェックをまとめてい -るだけです. - -DBMクラスにはたくさんメソッドがありますが,分類すると3種類の -引数の受け方があります.ひとつは引数の数が固定のもので,例と -してはdeleteメソッドがあります.deleteメソッドを実装している -fdbm_delete()はこのようになっています. - --- -static VALUE -fdbm_delete(obj, keystr) - VALUE obj, keystr; -{ - : -} --- - -引数の数が固定のタイプは第1引数がself,第2引数以降がメソッド -の引数となります. - -引数の数が不定のものはCの配列で受けるものとRubyの配列で受け -るものとがあります.dbmライブラリの中で,Cの配列で受けるもの -はDBMのクラスメソッドであるopen()です.これを実装している関 -数fdbm_s_open()はこうなっています. - --- -static VALUE -fdbm_s_open(argc, argv, klass) - int argc; - VALUE *argv; - VALUE klass; -{ - : - if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) { - mode = 0666; /* default value */ - } - : -} --- - -このタイプの関数は第1引数が与えられた引数の数,第2引数が与え -られた引数の入っている配列になります.selfは第3引数として与 -えられます. - -この配列で与えられた引数を解析するための関数がopen()でも使わ -れているrb_scan_args()です.第3引数に指定したフォーマットに -従い,第4変数以降に指定した変数に値を代入してくれます.この -フォーマットは,第1文字目が省略できない引数の数,第2文字目が -省略できる引数の数,第3文字目が対応する相手が無いあまりの引 -数があるかどうかを示す"*"です.2文字目と3文字目は省略できま -す.dbm.cの例では,フォーマットは"11"ですから,引数は最低1つ -で,2つまで許されるという意味になります.省略されている時の -変数の値はnil(C言語のレベルではQnil)になります. - -Rubyの配列で引数を受け取るものはindexesがあります.実装はこ -うです. - --- -static VALUE -fdbm_indexes(obj, args) - VALUE obj, args; -{ - : -} --- - -第1引数はself,第2引数はRubyの配列です. - -** 注意事項 - -Rubyと共有はしないがRubyのオブジェクトを格納する可能性のある -Cの大域変数は以下の関数を使ってRubyインタプリタに変数の存在 -を教えてあげてください.でないとGCでトラブルを起こします. - - void rb_global_variable(VALUE *var) - -(5) extconf.rbを用意する - -Makefileを作る場合の雛型になるextconf.rbというファイルを作り -ます.extconf.rbはライブラリのコンパイルに必要な条件のチェッ -クなどを行うことが目的です.まず, - - require 'mkmf' - -をextconf.rbの先頭に置きます.extconf.rbの中では以下のRuby関 -数を使うことが出来ます. - - have_library(lib, func): ライブラリの存在チェック - have_func(func, header): 関数の存在チェック - have_header(header): ヘッダファイルの存在チェック - create_makefile(target): Makefileの生成 - -以下の変数を使うことができます. - - $CFLAGS: コンパイル時に追加的に指定するフラグ(-Iなど) - $LDFLAGS: リンク時に追加的に指定するフラグ(-Lなど) - -ライブラリをコンパイルする条件が揃わず,そのライブラリをコン -パイルしない時にはcreate_makefileを呼ばなければMakefileは生 -成されず,コンパイルも行われません. - -(6) dependを用意する - -もし,ディレクトリにdependというファイルが存在すれば, -Makefileが依存関係をチェックしてくれます. - - % gcc -MM *.c > depend - -などで作ることが出来ます.あって損は無いでしょう. - -(7) MANIFESTファイルにファイル名を入れる - - % find * -type f -print > MANIFEST - % vi MANIFEST - -*.o, *~など不必要なファイル以外はMANIFESTに追加しておきます. -make時にはMANIFESTの内容は参照しませんので,空のままでも問題 -は起きませんが,パッケージングの時に参照することがあるのと, -必要なファイルを区別できるので,用意しておいた方が良いでしょ -う. - -(8) Makefileを生成する - -Makefileを実際に生成するためには - - ruby extconf.rb - -とします.extconf.rbに require 'mkmf' の行がない場合にはエラー -になりますので,引数を追加して - - ruby -r mkmf extconf.rb - -としてください. - -ディレクトリをext以下に用意した場合にはRuby全体のmakeの時に -自動的にMakefileが生成されますので,このステップは不要です. - -(9) makeする - -動的リンクライブラリを生成する場合にはその場でmakeしてくださ -い.必要であれば make install でインストールされます. - -ext以下にディレクトリを用意した場合は,Rubyのディレクトリで -makeを実行するとMakefileを生成からmake,必要によってはそのモ -ジュールのRubyへのリンクまで自動的に実行してくれます. -extconf.rbを書き換えるなどしてMakefileの再生成が必要な時はま -たRubyディレクトリでmakeしてください. - -拡張ライブラリはmake installでRubyライブラリのディレクトリの -下にコピーされます.もし拡張ライブラリと協調して使うRubyで記 -述されたプログラムがあり,Rubyライブラリに置きたい場合には, -拡張ライブラリ用のディレクトリの下に lib というディレクトリ -を作り,そこに 拡張子 .rb のファイルを置いておけば同時にイン -ストールされます. - -(10) デバッグ - -まあ,デバッグしないと動かないでしょうね.ext/Setupにディレ -クトリ名を書くと静的にリンクするのでデバッガが使えるようにな -ります.その分コンパイルが遅くなりますけど. - -(11) できあがり - -後はこっそり使うなり,広く公開するなり,売るなり,ご自由にお -使いください.Rubyの作者は拡張ライブラリに関して一切の権利を -主張しません. - -Appendix A. Rubyのソースコードの分類 - -Rubyのソースはいくつかに分類することが出来ます.このうちクラ -スライブラリの部分は基本的に拡張ライブラリと同じ作り方になっ -ています.これらのソースは今までの説明でほとんど理解できると -思います. - -Ruby言語のコア - - class.c - error.c - eval.c - gc.c - object.c - parse.y - variable.c - -ユーティリティ関数 - - dln.c - regex.c - st.c - util.c - -Rubyコマンドの実装 - - dmyext.c - inits.c - main.c - ruby.c - version.c - -クラスライブラリ - - array.c - bignum.c - compar.c - dir.c - enum.c - file.c - hash.c - io.c - marshal.c - math.c - numeric.c - pack.c - prec.c - process.c - random.c - range.c - re.c - signal.c - sprintf.c - string.c - struct.c - time.c - -Appendix B. 拡張用関数リファレンス - -C言語からRubyの機能を利用するAPIは以下の通りである. - -** 型 - -VALUE - - Rubyオブジェクトを表現する型.必要に応じてキャストして用いる. - 組み込み型を表現するCの型はruby.hに記述してあるRで始まる構造 - 体である.VALUE型をこれらにキャストするためにRで始まる構造体 - 名を全て大文字にした名前のマクロが用意されている. - -** 変数・定数 - -Qnil - - 定数: nilオブジェクト - -Qtrue - - 定数: trueオブジェクト(真のデフォルト値) - -Qfalse - - 定数: falseオブジェクト - -** Cデータのカプセル化 - -Data_Wrap_Struct(VALUE klass, void (*mark)(), void (*free)(), void *sval) - - Cの任意のポインタをカプセル化したRubyオブジェクトを返す.こ - のポインタがRubyからアクセスされなくなった時,freeで指定した - 関数が呼ばれる.また,このポインタの指すデータが他のRubyオブ - ジェクトを指している場合,markに指定する関数でマークする必要 - がある. - -Data_Make_Struct(klass, type, mark, free, sval) - - type型のメモリをmallocし,変数svalに代入した後,それをカプセ - ル化したデータを返すマクロ. - -Data_Get_Struct(data, type, sval) - - dataからtype型のポインタを取り出し変数svalに代入するマクロ. - -** 型チェック - -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) -rb_float_new(f) -STR2CSTR(value) -rb_str_new2(s) - -** クラス/モジュール定義 - -VALUE rb_define_class(const char *name, VALUE super) - - superのサブクラスとして新しいRubyクラスを定義する. - -VALUE rb_define_class_under(VALUE module, const char *name, VALUE super) - - superのサブクラスとして新しいRubyクラスを定義し,moduleの - 定数として定義する. - -VALUE rb_define_module(const char *name) - - 新しいRubyモジュールを定義する. - -VALUE rb_define_module_under(VALUE module, const char *name, VALUE super) - - 新しいRubyモジュールを定義し,moduleの定数として定義する. - -void rb_include_module(VALUE klass, VALUE module) - - モジュールをインクルードする.classがすでにmoduleをインク - ルードしている時には何もしない(多重インクルードの禁止). - -void rb_extend_object(VALUE object, VALUE module) - - オブジェクトをモジュール(で定義されているメソッド)で拡張する. - -** 大域変数定義 - -void rb_define_variable(const char *name, VALUE *var) - - RubyとCとで共有するグローバル変数を定義する.変数名が`$'で - 始まらない時には自動的に追加される.nameとしてRubyの識別子 - として許されない文字(例えば` ')を含む場合にはRubyプログラ - ムからは見えなくなる. - -void rb_define_readonly_variable(const char *name, VALUE *var) - - RubyとCとで共有するread onlyのグローバル変数を定義する. - read onlyであること以外はrb_define_variable()と同じ. - -void rb_define_virtual_variable(const char *name, - VALUE (*getter)(), void (*setter)()) - - 関数によって実現されるRuby変数を定義する.変数が参照された - 時にはgetterが,変数に値がセットされた時にはsetterが呼ばれ - る. - -void rb_define_hooked_variable(const char *name, VALUE *var, - VALUE (*getter)(), void (*setter)()) - - 関数によってhookのつけられたグローバル変数を定義する.変数 - が参照された時にはgetterが,関数に値がセットされた時には - setterが呼ばれる.getterやsetterに0を指定した時にはhookを - 指定しないのと同じ事になる. - -void rb_global_variable(VALUE *var) - - GCのため,Rubyプログラムからはアクセスされないが, Rubyオブ - ジェクトを含む大域変数をマークする. - -** 定数 - -void rb_define_const(VALUE klass, const char *name, VALUE val) - - 定数を定義する. - -void rb_define_global_const(const char *name, VALUE val) - - 大域定数を定義する. - - rb_define_const(rb_cObject, name, val) - - と同じ意味. - -** メソッド定義 - -rb_define_method(VALUE klass, const char *name, VALUE (*func)(), int argc) - - メソッドを定義する.argcはselfを除く引数の数.argcが-1の時, - 関数には引数の数(selfを含まない)を第1引数, 引数の配列を第2 - 引数とする形式で与えられる(第3引数はself).argcが-2の時, - 第1引数がself, 第2引数がargs(argsは引数を含むRubyの配列)と - いう形式で与えられる. - -rb_define_private_method(VALUE klass, const char *name, VALUE (*func)(), int argc) - - privateメソッドを定義する.引数はrb_define_method()と同じ. - -rb_define_singleton_method(VALUE klass, const char *name, VALUE (*func)(), int argc) - - 特異メソッドを定義する.引数はrb_define_method()と同じ. - -rb_scan_args(int argc, VALUE *argv, const char *fmt, ...) - - argc, argv形式で与えられた引数を分解する.fmtは必須引数の数, - 付加引数の数, 残りの引数があるかを指定する文字列で, "数字 - 数字*"という形式である. 2 番目の数字と"*"はそれぞれ省略可 - 能である.必須引数が一つもない場合は0を指定する.第3引数以 - 降は変数へのポインタで, 該当する要素がその変数に格納される. - 付加引数に対応する引数が与えられていない場合は変数にQnilが - 代入される. - -** Rubyメソッド呼び出し - -VALUE rb_funcall(VALUE recv, ID mid, int narg, ...) - - メソッド呼び出し.文字列からmidを得るためにはrb_intern()を - 使う. - -VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv) - - メソッド呼び出し.引数をargc, argv形式で渡す. - -VALUE rb_eval_string(const char *str) - - 文字列をRubyスクリプトとしてコンパイル・実行する. - -ID rb_intern(const char *name) - - 文字列に対応するIDを返す. - -char *rb_id2name(ID id) - - IDに対応する文字列を返す(デバッグ用). - -char *rb_class2name(VALUE klass) - - クラスの名前を返す(デバッグ用).クラスが名前を持たない時には, - 祖先を遡って名前を持つクラスの名前を返す. - -int rb_respond_to(VALUE obj, ID id) - - objがidで示されるメソッドを持つかどうかを返す。 - -** インスタンス変数 - -VALUE rb_iv_get(VALUE obj, const char *name) - - objのインスタンス変数の値を得る.`@'で始まらないインスタン - ス変数は Rubyプログラムからアクセスできない「隠れた」イン - スタンス変数になる.定数は大文字の名前を持つクラス(または - モジュール)のインスタンス変数として実装されている. - -VALUE rb_iv_set(VALUE obj, const char *name, VALUE val) - - objのインスタンス変数をvalにセットする. - -** 制御構造 - -VALUE rb_iterate(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) - - func2をブロックとして設定し, func1をイテレータとして呼ぶ. - func1には arg1が引数として渡され, func2には第1引数にイテレー - タから与えられた値, 第2引数にarg2が渡される. - -VALUE rb_yield(VALUE val) - - valを値としてイテレータブロックを呼び出す. - -VALUE rb_rescue(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) - - 関数func1をarg1を引数に呼び出す.func1の実行中に例外が発生 - した時には func2をarg2を引数として呼ぶ.戻り値は例外が発生 - しなかった時はfunc1の戻り値, 例外が発生した時にはfunc2の戻 - り値である. - -VALUE rb_ensure(VALUE (*func1)(), VALUE arg1, void (*func2)(), VALUE arg2) - - 関数func1をarg1を引数として実行し, 実行終了後(たとえ例外が - 発生しても) func2をarg2を引数として実行する.戻り値はfunc1 - の戻り値である(例外が発生した時は戻らない). - -** 例外・エラー - -void rb_warning(const char *fmt, ...) - - rb_verbose時に標準エラー出力に警告情報を表示する.引数は - printf()と同じ. - -void rb_raise(rb_eRuntimeError, const char *fmt, ...) - - RuntimeError例外を発生させる.引数はprintf()と同じ. - -void rb_raise(VALUE exception, const char *fmt, ...) - - exceptionで指定した例外を発生させる.fmt以下の引数は - printf()と同じ. - -void rb_fatal(const char *fmt, ...) - - 致命的例外を発生させる.通常の例外処理は行なわれず, インター - プリタが終了する(ただしensureで指定されたコードは終了前に - 実行される). - -void rb_bug(const char *fmt, ...) - - インタープリタなどプログラムのバグでしか発生するはずのない - 状況の時呼ぶ.インタープリタはコアダンプし直ちに終了する. - 例外処理は一切行なわれない. - -** Rubyの初期化・実行 - -Rubyをアプリケーションに埋め込む場合には以下のインタフェース -を使う.通常の拡張ライブラリには必要ない. - -void ruby_init() - - Rubyインタプリタの初期化を行なう. - -void ruby_options(int argc, char **argv) - - Rubyインタプリタのコマンドライン引数の処理を行なう. - -void ruby_run() - - Rubyインタプリタを実行する. - -void ruby_script(char *name) - - Rubyのスクリプト名($0)を設定する. - - -Appendix C. extconf.rbで使える関数たち - -extconf.rbの中では利用可能なコンパイル条件チェックの関数は以 -下の通りである. - -have_library(lib, func) - - 関数funcを定義しているライブラリlibの存在をチェックする. - ライブラリが存在する時,trueを返す. - -find_library(lib, func, path...) - - 関数funcを定義しているライブラリlibの存在を -Lpath を追加 - しながらチェックする.ライブラリが見付かった時,trueを返す. - -have_func(func, header) - - ヘッダファイルheaderをインクルードして関数funcの存在をチェッ - クする.funcが標準ではリンクされないライブラリ内のものであ - る時には先にhave_libraryでそのライブラリをチェックしておく - 事.関数が存在する時trueを返す. - -have_header(header) - - ヘッダファイルの存在をチェックする.ヘッダファイルが存在す - る時trueを返す. - -create_makefile(target) - - 拡張ライブラリ用のMakefileを生成する.この関数を呼ばなけれ - ばそのライブラリはコンパイルされない.targetはモジュール名 - を表す. - -with_config(withval[, default=nil]) - - コマンドライン上の--with-で指定されたオプション値を得る. - -dir_config(target[, default_dir]) -dir_config(target[, default_include, default_lib]) - - コマンドライン上の--with--dir, --with--include, - --with--libのいずれかで指定されるディレクトリを - $CFLAGS や $LDFLAGS に追加する.--with--dir=/pathは - --with--include=/path/include --with--lib=/path/lib - と等価である.追加された include ディレクトリと lib ディレクトリの - 配列を返す. ([include_dir, lib_dir]) - -/* - * Local variables: - * fill-column: 60 - * end: - */ diff --git a/README.ja b/README.ja deleted file mode 100644 index fc502dd440..0000000000 --- a/README.ja +++ /dev/null @@ -1,153 +0,0 @@ -* Rubyとは - -Rubyはシンプルかつ強力なオブジェクト指向スクリプト言語です. -Rubyは最初から純粋なオブジェクト指向言語として設計されていま -すから,オブジェクト指向プログラミングを手軽に行う事が出来ま -す.もちろん通常の手続き型のプログラミングも可能です. - -Rubyはテキスト処理関係の能力などに優れ,Perlと同じくらい強力 -です.さらにシンプルな文法と,例外処理やイテレータなどの機構 -によって,より分かりやすいプログラミングが出来ます. - - -* Rubyの特長 - - + シンプルな文法 - + 普通のオブジェクト指向機能(クラス,メソッドコールなど) - + 特殊なオブジェクト指向機能(Mixin, 特異メソッドなど) - + 演算子オーバーロード - + 例外処理機能 - + イテレータとクロージャ - + ガーベージコレクタ - + ダイナミックローディング (アーキテクチャによる) - + 移植性が高い.多くのUNIX上で動くだけでなく,DOSやWindows, - Mac,BeOSなどの上でも動く - - -* 入手法 - -** ftpで - -以下の場所においてあります. - - 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 - - -* ホームページ - -RubyのホームページのURLは - - http://www.ruby-lang.org/ - -です. - - -* メーリングリスト - -Rubyのメーリングリストがあります。参加希望の方は - - ruby-list-ctl@ruby-lang.org - -まで本文に - - subscribe YourFirstName YourFamilyName - -と書いて送って下さい。 - -Ruby開発者向けメーリングリストもあります。こちらではrubyのバ -グ、将来の仕様拡張など実装上の問題について議論されています。 -参加希望の方は - - ruby-dev-ctl@ruby-lang.org - -までruby-listと同様の方法でメールしてください。 - -Ruby拡張モジュールについて話し合うruby-extメーリングリストと -数学関係の話題について話し合うruby-mathメーリングリストと -英語で話し合うruby-talkメーリングリストもあります。参加方法 -はどれも同じです。 - - -* コンパイル・インストール - -以下の手順で行ってください. - - 1. もしconfigureファイルが見つからない、もしくは - configure.inより古いようなら、autoconfを実行して - 新しくconfigureを生成する - - 2. configureを実行してMakefileなどを生成する - - 3. (必要ならば)defines.hを編集する - - 多分,必要無いと思います. - - 4. (必要ならば)ext/Setupに静的にリンクする拡張モジュールを - 指定する - - ext/Setupに記述したモジュールは静的にリンクされます. - - ダイナミックローディングをサポートしていないアーキテク - チャではSetupの1行目の「option nodynamic」という行のコ - メントを外す必要があります.また,このアーキテクチャで - 拡張モジュールを利用するためには,あらかじめ静的にリン - クしておく必要があります. - - 5. makeを実行してコンパイルする - - 6. make testでテストを行う. - - 「test succeeded」と表示されれば成功です.ただしテスト - に成功しても完璧だと保証されている訳ではありません. - - 7. make install - - rootで作業する必要があるかもしれません. - -もし,コンパイル時にエラーが発生した場合にはエラーのログとマ -シン,OSの種類を含むできるだけ詳しいレポートを作者に送ってく -ださると他の方のためにもなります. - - -* 移植 - -UNIXであればconfigureがほとんどの差異を吸収してくれるはずで -すが,思わぬ見落としがあった場合(あるに違いない),作者にその -ことをレポートすれば,解決できるかも知れません. - -アーキテクチャにもっとも依存するのはGC部です.RubyのGCは対象 -のアーキテクチャがsetjmp()によって全てのレジスタを jmp_bufに -格納することと,jmp_bufとスタックが32bitアラインメントされて -いることを仮定しています.特に前者が成立しない場合の対応は非 -常に困難でしょう.後者の解決は比較的簡単で,gc.cでスタックを -マークしている部分にアラインメントのバイト数だけずらしてマー -クするコードを追加するだけで済みます.「defined(THINK_C)」で -括られている部分を参考にしてください - -# 実際にはRubyはThink Cではコンパイルできません. - -レジスタウィンドウを持つCPUでは,レジスタウィンドウをスタッ -クにフラッシュするアセンブラコードを追加する必要があるかも知 -れません. - - -* 配布条件 - -COPYING.jaファイルを参照してください。 - - -* 著者 - -コメント,バグレポートその他は matz@netlab.jp まで. -------------------------------------------------------- -created at: Thu Aug 3 11:57:36 JST 1995 -Local variables: -mode: indented-text -end: diff --git a/ToDo b/ToDo deleted file mode 100644 index d34bedbaf1..0000000000 --- a/ToDo +++ /dev/null @@ -1,128 +0,0 @@ -Language Spec. - -- Class#allocate - basicNew -* 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 ?? -* class Foo::Bar 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 RubyBehevior -* private instance variable (as in Python?) @_foo in class Foo => @_Foo_foo -* warn/error "bare word" method, like "foo", you should type "foo()" - -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...) -* 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. -* remove dependency on MAXPATHLEN. -* pointer share mechanism similar to one in String for Array. -* deprecate Array#indexes, and Array#indices. -* require "1.6" etc. by /usr/lib/ruby/1.6/1.6.rb ;-) -* save both "feature names" and "normalized path" in $" - -Extension Libraries - -* ptk.rb pTk wrapper that is compatible to tk.rb -* Berkeley DB extension -* BitVector -* thread-safe fcgi - -Ruby Libraries - -* add uri.rb -* urllib.rb, nttplib.rb, etc. -* format like perl's - -Tools - -* freeze or undump to bundle everything -* bundle using zlib - -Misc - -- publish Ruby books -- publish Ruby books in English diff --git a/array.c b/array.c deleted file mode 100644 index 90acbce6e2..0000000000 --- a/array.c +++ /dev/null @@ -1,1922 +0,0 @@ -/********************************************************************** - - array.c - - - $Author$ - $Date$ - created at: Fri Aug 6 09:46:12 JST 1993 - - Copyright (C) 1993-2002 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 rb_cArray; -static ID id_cmp; - -#define ARY_DEFAULT_SIZE 16 - -void -rb_mem_clear(mem, size) - register VALUE *mem; - register long size; -{ - while (size--) { - *mem++ = Qnil; - } -} - -static void -memfill(mem, size, val) - register VALUE *mem; - register long size; - register VALUE val; -{ - while (size--) { - *mem++ = val; - } -} - -#define ARY_TMPLOCK FL_USER1 - -static 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_eTypeError, "can't modify array during sort"); - if (!OBJ_TAINTED(ary) && rb_safe_level() >= 4) - rb_raise(rb_eSecurityError, "Insecure: can't modify array"); -} - -static void -rb_ary_modify(ary) - VALUE ary; -{ - 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 -rb_ary_freeze(ary) - VALUE ary; -{ - return rb_obj_freeze(ary); -} - -static VALUE -rb_ary_frozen_p(ary) - VALUE ary; -{ - if (FL_TEST(ary, FL_FREEZE|ARY_TMPLOCK)) - return Qtrue; - return Qfalse; -} - -static VALUE -rb_ary_s_alloc(klass) - VALUE klass; -{ - NEWOBJ(ary, struct RArray); - OBJSETUP(ary, klass, T_ARRAY); - - ary->len = 0; - ary->ptr = 0; - ary->aux.capa = 0; - - return (VALUE)ary; -} - -static VALUE -ary_new(klass, len) - VALUE klass; - long len; -{ - VALUE ary = rb_obj_alloc(klass); - - if (len < 0) { - rb_raise(rb_eArgError, "negative array size (or size too big)"); - } - if (len > 0 && len * sizeof(VALUE) <= 0) { - 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 -rb_ary_new2(len) - long len; -{ - return ary_new(rb_cArray, len); -} - - -VALUE -rb_ary_new() -{ - return rb_ary_new2(ARY_DEFAULT_SIZE); -} - -#ifdef HAVE_STDARG_PROTOTYPES -#include -#define va_init_list(a,b) va_start(a,b) -#else -#include -#define va_init_list(a,b) va_start(a) -#endif - -VALUE -#ifdef HAVE_STDARG_PROTOTYPES -rb_ary_new3(long n, ...) -#else -rb_ary_new3(n, va_alist) - long n; - va_dcl -#endif -{ - va_list ar; - VALUE ary; - long i; - - ary = rb_ary_new2(n); - - va_init_list(ar, n); - for (i=0; iptr[i] = va_arg(ar, VALUE); - } - va_end(ar); - - RARRAY(ary)->len = n; - return ary; -} - -VALUE -rb_ary_new4(n, elts) - long n; - const VALUE *elts; -{ - VALUE ary; - - ary = rb_ary_new2(n); - if (n > 0 && elts) { - MEMCPY(RARRAY(ary)->ptr, elts, VALUE, n); - } - RARRAY(ary)->len = n; - - return ary; -} - -VALUE -rb_assoc_new(car, cdr) - VALUE car, cdr; -{ - VALUE ary; - - ary = rb_ary_new2(2); - RARRAY(ary)->ptr[0] = car; - RARRAY(ary)->ptr[1] = cdr; - RARRAY(ary)->len = 2; - - return ary; -} - -static VALUE -to_ary(ary) - VALUE ary; -{ - return rb_convert_type(ary, T_ARRAY, "Array", "to_ary"); -} - -static VALUE rb_ary_replace _((VALUE, VALUE)); - -static VALUE -rb_ary_initialize(argc, argv, ary) - int argc; - VALUE *argv; - VALUE ary; -{ - long len; - VALUE size, val; - - rb_ary_modify(ary); - if (rb_scan_args(argc, argv, "02", &size, &val) == 0) { - RARRAY(ary)->len = 0; - if (rb_block_given_p()) { - rb_warning("given block not used"); - } - return ary; - } - - if (argc == 1 && !FIXNUM_P(size)) { - val = rb_check_convert_type(size, T_ARRAY, "Array", "to_ary"); - if (!NIL_P(val)) { - rb_ary_replace(ary, val); - return ary; - } - } - - len = NUM2LONG(size); - if (len < 0) { - rb_raise(rb_eArgError, "negative array size"); - } - if (len > 0 && len * sizeof(VALUE) <= 0) { - rb_raise(rb_eArgError, "array size too big"); - } - if (len > RARRAY(ary)->aux.capa) { - RARRAY(ary)->aux.capa = len; - REALLOC_N(RARRAY(ary)->ptr, VALUE, len); - } - if (rb_block_given_p()) { - long i; - - if (argc > 1) { - rb_raise(rb_eArgError, "wrong number of arguments"); - } - for (i=0; iptr[i] = rb_yield(INT2NUM(i)); - RARRAY(ary)->len = i + 1; - } - } - else { - memfill(RARRAY(ary)->ptr, len, val); - RARRAY(ary)->len = len; - } - - return ary; -} - -static VALUE -rb_ary_s_create(argc, argv, klass) - int argc; - VALUE *argv; - VALUE klass; -{ - VALUE ary = rb_obj_alloc(klass); - - if (argc < 0) { - rb_raise(rb_eArgError, "negative number of arguments"); - } - 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 ary; -} - -void -rb_ary_store(ary, idx, val) - VALUE ary; - long idx; - VALUE val; -{ - rb_ary_modify(ary); - if (idx < 0) { - idx += RARRAY(ary)->len; - if (idx < 0) { - rb_raise(rb_eIndexError, "index %ld out of array", - idx - RARRAY(ary)->len); - } - } - - if (idx >= 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 = idx + capa_inc; - REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->aux.capa); - } - if (idx > RARRAY(ary)->len) { - rb_mem_clear(RARRAY(ary)->ptr+RARRAY(ary)->len, - idx-RARRAY(ary)->len + 1); - } - - if (idx >= RARRAY(ary)->len) { - RARRAY(ary)->len = idx + 1; - } - RARRAY(ary)->ptr[idx] = val; -} - -VALUE -rb_ary_push(ary, item) - VALUE ary; - VALUE item; -{ - rb_ary_store(ary, RARRAY(ary)->len, item); - return ary; -} - -static VALUE -rb_ary_push_m(argc, argv, ary) - int argc; - VALUE *argv; - VALUE ary; -{ - if (argc <= 0) { - rb_raise(rb_eArgError, "wrong number arguments (at least 1)"); - } - while (argc--) { - rb_ary_push(ary, *argv++); - } - return ary; -} - -VALUE -rb_ary_pop(ary) - VALUE ary; -{ - rb_ary_modify_check(ary); - if (RARRAY(ary)->len == 0) return Qnil; - if (!FL_TEST(ary, ELTS_SHARED) && - RARRAY(ary)->len * 2 < RARRAY(ary)->aux.capa && - RARRAY(ary)->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 void -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); - } -} - -VALUE -rb_ary_shift(ary) - VALUE ary; -{ - VALUE top; - - rb_ary_modify_check(ary); - if (RARRAY(ary)->len == 0) return Qnil; - top = RARRAY(ary)->ptr[0]; - ary_make_shared(ary); - RARRAY(ary)->ptr++; /* shift ptr */ - RARRAY(ary)->len--; - - return top; -} - -VALUE -rb_ary_unshift(ary, item) - VALUE ary, item; -{ - 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); - - RARRAY(ary)->len++; - RARRAY(ary)->ptr[0] = item; - - return ary; -} - -static VALUE -rb_ary_unshift_m(argc, argv, ary) - int argc; - VALUE *argv; - VALUE ary; -{ - long len = RARRAY(ary)->len; - - if (argc <= 0) { - rb_raise(rb_eArgError, "wrong number of arguments (at least 1)"); - } - - /* 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; -} - -VALUE -rb_ary_entry(ary, offset) - VALUE ary; - long offset; -{ - if (RARRAY(ary)->len == 0) return Qnil; - - if (offset < 0) { - offset += RARRAY(ary)->len; - } - if (offset < 0 || RARRAY(ary)->len <= offset) { - return Qnil; - } - - return RARRAY(ary)->ptr[offset]; -} - -static VALUE -rb_ary_subseq(ary, beg, len) - VALUE ary; - long beg, len; -{ - VALUE klass, ary2; - - if (beg > RARRAY(ary)->len) return Qnil; - if (beg < 0 || len < 0) return Qnil; - - if (beg + len > RARRAY(ary)->len) { - len = RARRAY(ary)->len - beg; - if (len < 0) - len = 0; - } - klass = rb_obj_class(ary); - if (len == 0) return ary_new(klass, 0); - - ary_make_shared(ary); - ary2 = rb_obj_alloc(klass); - RARRAY(ary2)->ptr = RARRAY(ary)->ptr + beg; - RARRAY(ary2)->len = len; - RARRAY(ary2)->aux.shared = RARRAY(ary)->aux.shared; - FL_SET(ary2, ELTS_SHARED); - - return ary2; -} - -VALUE -rb_ary_aref(argc, argv, ary) - int argc; - VALUE *argv; - VALUE ary; -{ - VALUE arg; - long beg, len; - - if (argc == 2) { - 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); - } - arg = argv[0]; - /* special case - speeding up */ - if (FIXNUM_P(arg)) { - return rb_ary_entry(ary, FIX2LONG(arg)); - } - if (TYPE(arg) == T_BIGNUM) { - rb_raise(rb_eIndexError, "index too big"); - } - /* 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)); -} - -static VALUE -rb_ary_at(ary, pos) - VALUE ary, pos; -{ - return rb_ary_entry(ary, NUM2LONG(pos)); -} - -static VALUE -rb_ary_first(ary) - VALUE ary; -{ - if (RARRAY(ary)->len == 0) return Qnil; - return RARRAY(ary)->ptr[0]; -} - -static VALUE -rb_ary_last(ary) - VALUE ary; -{ - if (RARRAY(ary)->len == 0) return Qnil; - return RARRAY(ary)->ptr[RARRAY(ary)->len-1]; -} - -static VALUE -rb_ary_fetch(argc, argv, ary) - int argc; - VALUE *argv; - VALUE ary; -{ - VALUE pos, ifnone; - long idx; - - rb_scan_args(argc, argv, "11", &pos, &ifnone); - idx = NUM2LONG(pos); - - if (idx < 0) { - idx += RARRAY(ary)->len; - } - if (idx < 0 || RARRAY(ary)->len <= idx) { - if (rb_block_given_p()) { - if (argc > 1) { - rb_raise(rb_eArgError, "wrong number of arguments"); - } - return rb_yield(pos); - } - if (argc == 1) { - rb_raise(rb_eIndexError, "index %ld out of array", idx); - } - return ifnone; - } - return RARRAY(ary)->ptr[idx]; -} - -static VALUE -rb_ary_index(ary, val) - VALUE ary; - VALUE val; -{ - long i; - - for (i=0; ilen; i++) { - if (rb_equal(RARRAY(ary)->ptr[i], val)) - return LONG2NUM(i); - } - return Qnil; -} - -static VALUE -rb_ary_rindex(ary, val) - VALUE ary; - VALUE val; -{ - long i = RARRAY(ary)->len; - - while (i--) { - if (rb_equal(RARRAY(ary)->ptr[i], val)) - return INT2NUM(i); - } - return Qnil; -} - -static VALUE -rb_ary_indexes(argc, argv, ary) - int argc; - VALUE *argv; - VALUE ary; -{ - VALUE new_ary; - long i; - - rb_warn("Array#%s is deprecated; use Array#select", - rb_id2name(rb_frame_last_func())); - new_ary = rb_ary_new2(argc); - for (i=0; ilen; - - if (len < 0) rb_raise(rb_eIndexError, "negative length (%ld)", len); - if (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 (beg >= RARRAY(ary)->len) { - len = beg + rlen; - if (len >= RARRAY(ary)->aux.capa) { - RARRAY(ary)->aux.capa = len; - REALLOC_N(RARRAY(ary)->ptr, VALUE, len); - } - rb_mem_clear(RARRAY(ary)->ptr + RARRAY(ary)->len, beg - RARRAY(ary)->len); - MEMCPY(RARRAY(ary)->ptr + beg, RARRAY(rpl)->ptr, VALUE, rlen); - RARRAY(ary)->len = len; - } - else { - long alen; - - if (beg + len > RARRAY(ary)->len) { - len = RARRAY(ary)->len - beg; - } - - alen = RARRAY(ary)->len + rlen - len; - if (alen >= RARRAY(ary)->aux.capa) { - RARRAY(ary)->aux.capa = alen; - REALLOC_N(RARRAY(ary)->ptr, VALUE, alen); - } - - if (len != rlen) { - MEMMOVE(RARRAY(ary)->ptr + beg + rlen, RARRAY(ary)->ptr + beg + len, - VALUE, RARRAY(ary)->len - (beg + len)); - RARRAY(ary)->len = alen; - } - MEMMOVE(RARRAY(ary)->ptr + beg, RARRAY(rpl)->ptr, VALUE, rlen); - } -} - -static VALUE -rb_ary_aset(argc, argv, ary) - int argc; - VALUE *argv; - VALUE ary; -{ - long offset, beg, len; - - if (argc == 3) { - rb_ary_update(ary, NUM2LONG(argv[0]), NUM2LONG(argv[1]), argv[2]); - return argv[2]; - } - 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; - } - if (TYPE(argv[0]) == T_BIGNUM) { - rb_raise(rb_eIndexError, "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 = NUM2LONG(argv[0]); -fixnum: - rb_ary_store(ary, offset, argv[1]); - return argv[1]; -} - -static VALUE -rb_ary_insert(argc, argv, ary) - int argc; - VALUE *argv; - VALUE ary; -{ - long pos; - - if (argc < 2) { - rb_raise(rb_eArgError, "wrong number of arguments (at least 2)"); - } - pos = NUM2LONG(argv[0]); - if (pos == -1) { - pos = RSTRING(ary)->len; - } - else if (pos < 0) { - pos++; - } - - rb_ary_update(ary, pos, 0, rb_ary_new4(argc - 1, argv + 1)); - return ary; -} - -VALUE -rb_ary_each(ary) - VALUE ary; -{ - long i; - - for (i=0; ilen; i++) { - rb_yield(RARRAY(ary)->ptr[i]); - } - return ary; -} - -static VALUE -rb_ary_each_index(ary) - VALUE ary; -{ - long i; - - for (i=0; ilen; i++) { - rb_yield(INT2NUM(i)); - } - return ary; -} - -static VALUE -rb_ary_reverse_each(ary) - VALUE ary; -{ - long len = RARRAY(ary)->len; - - while (len--) { - rb_yield(RARRAY(ary)->ptr[len]); - } - return ary; -} - -static VALUE -rb_ary_length(ary) - VALUE ary; -{ - return INT2NUM(RARRAY(ary)->len); -} - -static VALUE -rb_ary_empty_p(ary) - VALUE ary; -{ - if (RARRAY(ary)->len == 0) - return Qtrue; - return Qfalse; -} - -static VALUE -ary_copy(ary, clone) - VALUE ary; - int clone; -{ - VALUE copy; - - ary_make_shared(ary); - copy = rb_obj_alloc(rb_cArray); - if (clone) CLONESETUP(copy, ary); - else DUPSETUP(copy, ary); - RARRAY(copy)->ptr = RARRAY(ary)->ptr; - RARRAY(copy)->len = RARRAY(ary)->len; - RARRAY(copy)->aux.shared = RARRAY(ary)->aux.shared; - FL_SET(copy, ELTS_SHARED); - - return copy; -} - -static VALUE -rb_ary_clone(ary) - VALUE ary; -{ - return ary_copy(ary, Qtrue); -} - -VALUE -rb_ary_dup(ary) - VALUE ary; -{ - return ary_copy(ary, Qfalse); -} - -static VALUE -ary_dup(ary) - VALUE ary; -{ - VALUE dup = rb_ary_new2(RARRAY(ary)->len); - - DUPSETUP(dup, ary); - MEMCPY(RARRAY(dup)->ptr, RARRAY(ary)->ptr, VALUE, RARRAY(ary)->len); - RARRAY(dup)->len = RARRAY(ary)->len; - return dup; -} - -extern VALUE rb_output_fs; - -static VALUE -inspect_join(ary, arg) - VALUE ary; - VALUE *arg; -{ - return rb_ary_join(arg[0], arg[1]); -} - -VALUE -rb_ary_join(ary, sep) - VALUE ary, sep; -{ - long len = 1, i; - int taint = Qfalse; - VALUE result, tmp; - - if (RARRAY(ary)->len == 0) return rb_str_new(0, 0); - if (OBJ_TAINTED(ary) || OBJ_TAINTED(sep)) taint = Qtrue; - - for (i=0; ilen; i++) { - if (TYPE(RARRAY(ary)->ptr[i]) == T_STRING) { - len += RSTRING(RARRAY(ary)->ptr[i])->len; - } - else { - len += 10; - } - } - if (!NIL_P(sep)) { - StringValue(sep); - len += RSTRING(sep)->len * (RARRAY(ary)->len - 1); - } - result = rb_str_buf_new(len); - for (i=0; ilen; i++) { - tmp = RARRAY(ary)->ptr[i]; - switch (TYPE(tmp)) { - case T_STRING: - break; - case T_ARRAY: - 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 = rb_obj_as_string(tmp); - } - 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; -} - -static VALUE -rb_ary_join_m(argc, argv, ary) - int argc; - VALUE *argv; - VALUE ary; -{ - VALUE sep; - - rb_scan_args(argc, argv, "01", &sep); - if (NIL_P(sep)) sep = rb_output_fs; - - return rb_ary_join(ary, sep); -} - -VALUE -rb_ary_to_s(ary) - VALUE ary; -{ - 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 -inspect_ensure(obj) - VALUE obj; -{ - VALUE inspect_tbl; - - inspect_tbl = rb_thread_local_aref(rb_thread_current(), inspect_key); - 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 = rb_thread_local_aref(rb_thread_current(), inspect_key); - if (NIL_P(inspect_tbl)) { - inspect_tbl = rb_ary_new(); - rb_thread_local_aset(rb_thread_current(), inspect_key, inspect_tbl); - } - 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 = rb_thread_local_aref(rb_thread_current(), inspect_key); - 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 tainted = OBJ_TAINTED(ary); - long i; - VALUE s, str; - - str = rb_str_buf_new2("["); - for (i=0; ilen; i++) { - s = rb_inspect(RARRAY(ary)->ptr[i]); - if (OBJ_TAINTED(s)) tainted = Qtrue; - if (i > 0) rb_str_buf_cat2(str, ", "); - rb_str_buf_append(str, s); - } - rb_str_buf_cat2(str, "]"); - if (tainted) OBJ_TAINT(str); - return str; -} - -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); -} - -static VALUE -rb_ary_to_a(ary) - VALUE ary; -{ - return ary; -} - -VALUE -rb_ary_reverse(ary) - VALUE ary; -{ - VALUE *p1, *p2; - VALUE tmp; - - rb_ary_modify(ary); - if (RARRAY(ary)->len <= 1) return ary; - - p1 = RARRAY(ary)->ptr; - p2 = p1 + RARRAY(ary)->len - 1; /* points last item */ - - while (p1 < p2) { - tmp = *p1; - *p1++ = *p2; - *p2-- = tmp; - } - - return ary; -} - -static VALUE -rb_ary_reverse_bang(ary) - VALUE ary; -{ - if (RARRAY(ary)->len <= 1) return Qnil; - return rb_ary_reverse(ary); -} - -static VALUE -rb_ary_reverse_m(ary) - VALUE ary; -{ - return rb_ary_reverse(ary_dup(ary)); -} - -int -rb_cmpint(cmp) - VALUE cmp; -{ - if (FIXNUM_P(cmp)) return FIX2INT(cmp); - if (TYPE(cmp) == T_BIGNUM) { - if (RBIGNUM(cmp)->sign) return 1; - return -1; - } - if (RTEST(rb_funcall(cmp, '>', 1, INT2FIX(0)))) return 1; - if (RTEST(rb_funcall(cmp, '<', 1, INT2FIX(0)))) return -1; - return 0; -} - -static int -sort_1(a, b) - VALUE *a, *b; -{ - VALUE retval = rb_yield(rb_assoc_new(*a, *b)); - return rb_cmpint(retval); -} - -static int -sort_2(a, b) - VALUE *a, *b; -{ - VALUE retval; - - if (FIXNUM_P(*a) && FIXNUM_P(*b)) { - return *a - *b; - } - if (TYPE(*a) == T_STRING && TYPE(*b) == T_STRING) { - return rb_str_cmp(*a, *b); - } - - retval = rb_funcall(*a, id_cmp, 1, *b); - return rb_cmpint(retval); -} - -static VALUE -sort_internal(ary) - VALUE ary; -{ - qsort(RARRAY(ary)->ptr, RARRAY(ary)->len, sizeof(VALUE), - rb_block_given_p()?sort_1:sort_2); - return ary; -} - -static VALUE -sort_unlock(ary) - VALUE ary; -{ - FL_UNSET(ary, ARY_TMPLOCK); - return ary; -} - -VALUE -rb_ary_sort_bang(ary) - VALUE ary; -{ - rb_ary_modify(ary); - if (RARRAY(ary)->len <= 1) return ary; - - FL_SET(ary, ARY_TMPLOCK); /* prohibit modification during sort */ - rb_ensure(sort_internal, ary, sort_unlock, ary); - return ary; -} - -VALUE -rb_ary_sort(ary) - VALUE ary; -{ - ary = ary_dup(ary); - rb_ary_sort_bang(ary); - return ary; -} - -static VALUE -rb_ary_collect(ary) - VALUE ary; -{ - long len, i; - VALUE collect; - - if (!rb_block_given_p()) { - return rb_ary_new4(RARRAY(ary)->len, RARRAY(ary)->ptr); - } - - len = RARRAY(ary)->len; - collect = rb_ary_new2(len); - for (i=0; iptr[i])); - } - return collect; -} - -static VALUE -rb_ary_collect_bang(ary) - VALUE ary; -{ - long i; - - rb_ary_modify(ary); - for (i = 0; i < RARRAY(ary)->len; i++) { - RARRAY(ary)->ptr[i] = rb_yield(RARRAY(ary)->ptr[i]); - } - return ary; -} - -static VALUE -rb_ary_select(argc, argv, ary) - int argc; - VALUE *argv; - VALUE ary; -{ - VALUE result = rb_ary_new(); - long i; - - if (rb_block_given_p()) { - if (argc > 0) { - rb_raise(rb_eArgError, "wrong number arguments (%d for 0)", argc); - } - for (i = 0; i < RARRAY(ary)->len; i++) { - if (RTEST(rb_yield(RARRAY(ary)->ptr[i]))) { - rb_ary_push(result, RARRAY(ary)->ptr[i]); - } - } - } - else { - for (i=0; ilen; i1++) { - if (rb_equal(RARRAY(ary)->ptr[i1], item)) continue; - if (i1 != i2) { - RARRAY(ary)->ptr[i2] = RARRAY(ary)->ptr[i1]; - } - i2++; - } - if (RARRAY(ary)->len == i2) { - if (rb_block_given_p()) { - return rb_yield(item); - } - return Qnil; - } - - RARRAY(ary)->len = i2; - if (i2 * 2 < RARRAY(ary)->aux.capa && - RARRAY(ary)->aux.capa > ARY_DEFAULT_SIZE) { - RARRAY(ary)->aux.capa = i2 * 2; - REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->aux.capa); - } - - return item; -} - -VALUE -rb_ary_delete_at(ary, pos) - VALUE ary; - long pos; -{ - long i, len = RARRAY(ary)->len; - VALUE del; - - rb_ary_modify(ary); - if (pos >= len) return Qnil; - if (pos < 0) { - pos += len; - if (pos < 0) return Qnil; - } - - 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; -} - -static VALUE -rb_ary_delete_at_m(ary, pos) - VALUE ary, pos; -{ - return rb_ary_delete_at(ary, NUM2LONG(pos)); -} - -static VALUE -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)); -} - -static VALUE -rb_ary_reject_bang(ary) - VALUE ary; -{ - long i1, i2; - - rb_ary_modify(ary); - for (i1 = i2 = 0; i1 < RARRAY(ary)->len; i1++) { - if (RTEST(rb_yield(RARRAY(ary)->ptr[i1]))) continue; - if (i1 != i2) { - RARRAY(ary)->ptr[i2] = RARRAY(ary)->ptr[i1]; - } - i2++; - } - if (RARRAY(ary)->len == i2) return Qnil; - RARRAY(ary)->len = i2; - - return ary; -} - -static VALUE -rb_ary_reject(ary) - VALUE ary; -{ - ary = ary_dup(ary); - rb_ary_reject_bang(ary); - return ary; -} - -static VALUE -rb_ary_delete_if(ary) - VALUE ary; -{ - rb_ary_reject_bang(ary); - return ary; -} - -static VALUE -rb_ary_replace(ary, ary2) - VALUE ary, ary2; -{ - if (ary == ary2) return ary; - ary2 = to_ary(ary2); - rb_ary_update(ary, 0, RARRAY(ary)->len, ary2); - return ary; -} - -VALUE -rb_ary_clear(ary) - VALUE ary; -{ - rb_ary_modify(ary); - RARRAY(ary)->len = 0; - if (ARY_DEFAULT_SIZE * 2 < RARRAY(ary)->aux.capa) { - RARRAY(ary)->aux.capa = ARY_DEFAULT_SIZE * 2; - REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->aux.capa); - } - return ary; -} - -static VALUE -rb_ary_fill(argc, argv, ary) - int argc; - VALUE *argv; - VALUE ary; -{ - VALUE item, arg1, arg2; - long beg, end, len; - VALUE *p, *pend; - int block_p = Qfalse; - - if (rb_block_given_p()) { - block_p = Qtrue; - rb_scan_args(argc, argv, "02", &arg1, &arg2); - argc += 1; /* hackish */ - } - else { - 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 : NUM2LONG(arg2); - break; - } - rb_ary_modify(ary); - end = beg + len; - if (end > RARRAY(ary)->len) { - if (end >= RARRAY(ary)->aux.capa) { - RARRAY(ary)->aux.capa = end; - REALLOC_N(RARRAY(ary)->ptr, VALUE, end); - } - if (beg > 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; - - if (block_p) { - while (p < pend) { - *p++ = rb_yield(INT2NUM(beg++)); - } - } - else { - while (p < pend) { - *p++ = item; - } - } - return ary; -} - -VALUE -rb_ary_plus(x, y) - VALUE x, y; -{ - VALUE z; - long 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 = len; - return z; -} - -VALUE -rb_ary_concat(x, y) - VALUE x, y; -{ - y = to_ary(y); - if (RARRAY(y)->len > 0) { - rb_ary_update(x, RARRAY(x)->len, 0, y); - } - return x; -} - -static VALUE -rb_ary_times(ary, times) - VALUE ary; - VALUE times; -{ - VALUE ary2; - long i, len; - - if (TYPE(times) == T_STRING) { - return rb_ary_join(ary, times); - } - - len = NUM2LONG(times); - if (len < 0) { - rb_raise(rb_eArgError, "negative argument"); - } - len *= RARRAY(ary)->len; - - ary2 = ary_new(rb_obj_class(ary), len); - RARRAY(ary2)->len = len; - - for (i=0; ilen) { - MEMCPY(RARRAY(ary2)->ptr+i, RARRAY(ary)->ptr, VALUE, RARRAY(ary)->len); - } - OBJ_INFECT(ary2, ary); - - return ary2; -} - -VALUE -rb_ary_assoc(ary, key) - VALUE ary, key; -{ - VALUE *p, *pend; - - p = RARRAY(ary)->ptr; - pend = p + RARRAY(ary)->len; - - while (p < pend) { - if (TYPE(*p) == T_ARRAY && - RARRAY(*p)->len > 0 && - rb_equal(RARRAY(*p)->ptr[0], key)) - return *p; - p++; - } - return Qnil; -} - -VALUE -rb_ary_rassoc(ary, value) - VALUE ary; - VALUE value; -{ - VALUE *p, *pend; - - 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++; - } - return Qnil; -} - -static VALUE -rb_ary_equal(ary1, ary2) - VALUE ary1, ary2; -{ - long i; - - if (ary1 == ary2) return Qtrue; - if (TYPE(ary2) != T_ARRAY) return Qfalse; - if (RARRAY(ary1)->len != RARRAY(ary2)->len) return Qfalse; - for (i=0; ilen; i++) { - if (!rb_equal(RARRAY(ary1)->ptr[i], RARRAY(ary2)->ptr[i])) - return Qfalse; - } - return Qtrue; -} - -static VALUE -rb_ary_eql(ary1, ary2) - VALUE ary1, ary2; -{ - long i; - - if (TYPE(ary2) != T_ARRAY) return Qfalse; - if (RARRAY(ary1)->len != RARRAY(ary2)->len) return Qfalse; - for (i=0; ilen; i++) { - if (!rb_eql(RARRAY(ary1)->ptr[i], RARRAY(ary2)->ptr[i])) - return Qfalse; - } - return Qtrue; -} - -static VALUE -rb_ary_hash(ary) - VALUE ary; -{ - long i; - VALUE n; - long h; - - h = RARRAY(ary)->len; - for (i=0; ilen; i++) { - h = (h << 1) | (h<0 ? 1 : 0); - n = rb_hash(RARRAY(ary)->ptr[i]); - h ^= NUM2LONG(n); - } - return LONG2FIX(h); -} - -VALUE -rb_ary_includes(ary, item) - VALUE ary; - VALUE item; -{ - long i; - for (i=0; ilen; i++) { - if (rb_equal(RARRAY(ary)->ptr[i], item)) { - return Qtrue; - } - } - return Qfalse; -} - -VALUE -rb_ary_cmp(ary, ary2) - VALUE ary; - VALUE ary2; -{ - long i, len; - - if (TYPE(ary2) != T_ARRAY) { - ary2 = to_ary(ary2); - } - len = RARRAY(ary)->len; - if (len > RARRAY(ary2)->len) { - len = RARRAY(ary2)->len; - } - for (i=0; iptr[i],id_cmp,1,RARRAY(ary2)->ptr[i]); - if (v != INT2FIX(0)) { - return v; - } - } - len = RARRAY(ary)->len - RARRAY(ary2)->len; - if (len == 0) return INT2FIX(0); - if (len > 0) return INT2FIX(1); - return INT2FIX(-1); -} - -static VALUE -rb_ary_diff(ary1, ary2) - VALUE ary1, ary2; -{ - VALUE ary3; - long i; - - ary2 = to_ary(ary2); - ary3 = rb_ary_new(); - for (i=0; ilen; i++) { - if (rb_ary_includes(ary2, RARRAY(ary1)->ptr[i])) continue; - if (rb_ary_includes(ary3, RARRAY(ary1)->ptr[i])) continue; - rb_ary_push(ary3, RARRAY(ary1)->ptr[i]); - } - return ary3; -} - -static VALUE -ary_make_hash(ary1, ary2) - VALUE ary1, ary2; -{ - VALUE hash = rb_hash_new(); - int i; - - for (i=0; ilen; i++) { - rb_hash_aset(hash, RARRAY(ary1)->ptr[i], Qtrue); - } - if (ary2) { - for (i=0; ilen; i++) { - rb_hash_aset(hash, RARRAY(ary2)->ptr[i], Qtrue); - } - } - return hash; -} - -static VALUE -rb_ary_and(ary1, ary2) - VALUE ary1, ary2; -{ - VALUE hash; - VALUE ary3 = rb_ary_new(); - long i; - - ary2 = to_ary(ary2); - hash = ary_make_hash(ary2, 0); - - for (i=0; ilen; i++) { - VALUE v = RARRAY(ary1)->ptr[i]; - if (st_delete(RHASH(hash)->tbl, &v, 0)) { - rb_ary_push(ary3, RARRAY(ary1)->ptr[i]); - } - } - - return ary3; -} - -static VALUE -rb_ary_or(ary1, ary2) - VALUE ary1, ary2; -{ - VALUE hash; - VALUE ary3 = rb_ary_new(); - VALUE v; - long i; - - ary2 = to_ary(ary2); - hash = ary_make_hash(ary1, ary2); - - for (i=0; ilen; i++) { - v = RARRAY(ary1)->ptr[i]; - if (st_delete(RHASH(hash)->tbl, &v, 0)) { - rb_ary_push(ary3, RARRAY(ary1)->ptr[i]); - } - } - for (i=0; ilen; i++) { - v = RARRAY(ary2)->ptr[i]; - if (st_delete(RHASH(hash)->tbl, &v, 0)) { - rb_ary_push(ary3, RARRAY(ary2)->ptr[i]); - } - } - - return ary3; -} - -static VALUE -rb_ary_uniq_bang(ary) - VALUE ary; -{ - VALUE hash = ary_make_hash(ary, 0); - VALUE *p, *q, *end; - - if (RARRAY(ary)->len == RHASH(hash)->tbl->num_entries) { - return Qnil; - } - - rb_ary_modify(ary); - p = q = RARRAY(ary)->ptr; - end = p + RARRAY(ary)->len; - while (p < end) { - VALUE v = *p; - if (st_delete(RHASH(hash)->tbl, &v, 0)) { - *q++ = *p; - } - p++; - } - RARRAY(ary)->len = (q - RARRAY(ary)->ptr); - - return ary; -} - -static VALUE -rb_ary_uniq(ary) - VALUE ary; -{ - ary = ary_dup(ary); - rb_ary_uniq_bang(ary); - return ary; -} - -static VALUE -rb_ary_compact_bang(ary) - VALUE ary; -{ - VALUE *p, *t, *end; - - 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++; - } - if (RARRAY(ary)->len == (p - RARRAY(ary)->ptr)) { - return Qnil; - } - RARRAY(ary)->len = RARRAY(ary)->aux.capa = (p - RARRAY(ary)->ptr); - REALLOC_N(RARRAY(ary)->ptr, VALUE, RARRAY(ary)->len); - - return ary; -} - -static VALUE -rb_ary_compact(ary) - VALUE ary; -{ - ary = ary_dup(ary); - rb_ary_compact_bang(ary); - return ary; -} - -static VALUE -rb_ary_nitems(ary) - VALUE ary; -{ - 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 INT2NUM(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) { - if (TYPE(RARRAY(ary)->ptr[i]) == T_ARRAY) { - n = flatten(ary, i, RARRAY(ary)->ptr[i], memo); - i += n; lim += n; - } - i++; - } - rb_ary_pop(memo); - - return lim - idx - 1; /* returns number of increased items */ -} - -static VALUE -rb_ary_flatten_bang(ary) - VALUE ary; -{ - long i = 0; - int mod = 0; - VALUE memo = Qnil; - - rb_ary_modify(ary); - while (ilen) { - VALUE ary2 = RARRAY(ary)->ptr[i]; - - if (TYPE(ary2) == T_ARRAY) { - if (NIL_P(memo)) { - memo = rb_ary_new(); - } - i += flatten(ary, i, ary2, memo); - mod = 1; - } - i++; - } - if (mod == 0) return Qnil; - return ary; -} - -static VALUE -rb_ary_flatten(ary) - VALUE ary; -{ - ary = ary_dup(ary); - rb_ary_flatten_bang(ary); - return ary; -} - -void -Init_Array() -{ - rb_cArray = rb_define_class("Array", rb_cObject); - rb_include_module(rb_cArray, rb_mEnumerable); - - rb_define_singleton_method(rb_cArray, "allocate", rb_ary_s_alloc, 0); - 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, "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_a, 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_equal, 1); - - 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, 0); - rb_define_method(rb_cArray, "last", rb_ary_last, 0); - 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, "clone", rb_ary_clone, 0); - rb_define_method(rb_cArray, "dup", rb_ary_dup, 0); - 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, "select", rb_ary_select, -1); - 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, "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, "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 deleted file mode 100644 index c5f7c16efb..0000000000 --- a/bcc32/Makefile.sub +++ /dev/null @@ -1,545 +0,0 @@ -SHELL = $(COMSPEC) - -#### Start of system configuration section. #### - -## 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 = rubybcc -!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 RC -RC = brc32 -!endif -!ifndef YACC -YACC = byacc -!endif -PURIFY = -AUTOCONF = autoconf - -!if !defined(PROCESSOR_ARCHITECTURE) || "$(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 = i$(PROCESSOR_LEVEL)86 -!else -CPU = $(PROCESSOR_ARCHITECTURE) -ARCH = $(PROCESSOR_ARCHITECTURE) -!endif -!ifndef DEBUGFLAGS -DEBUGFLAGS = -!endif -!ifndef OPTFLAGS -OPTFLAGS = -O -!endif -OS = bccwin32 - -!ifndef prefix -prefix = /usr -!endif -!ifndef DESTDIR -DESTDIR = $(prefix) -!endif -!ifndef CFLAGS -CFLAGS = -DNT=1 $(DEBUGFLAGS) $(OPTFLAGS) $(PROCESSOR_FLAG) -w-aus -w-par -w-pro -!endif -!ifndef CPPFLAGS -CPPFLAGS = -I. -I$(srcdir) -I$(srcdir)missing -DLIBRUBY_SO=\"$(LIBRUBY_SO)\" -!endif -!ifndef LDFLAGS -LDFLAGS = $(CFLAGS) -!endif -!ifndef XLDFLAGS -XLDFLAGS = -!endif -!ifndef RFLAGS -RFLAGS = -r -!endif -!ifndef EXTLIBS -EXTLIBS = # cw32.lib -!endif -LIBS = $(EXTLIBS) -MISSING = acosh.obj crypt.obj win32.obj - -!ifndef STACK -STACK = 0x2000000 -!endif - -LDSHARED = $(CC) -lS:$(STACK) -LINK = $(LDSHARED) -WC -LINK_W = $(LDSHARED) -W -LINK_SO = $(LDSHARED) -WD - -DLDFLAGS = -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 = lib$(RUBY_INSTALL_NAME).lib -LIBRUBY_SO = $(RUBY_SO_NAME).dll -LIBRUBY = $(RUBY_SO_NAME).lib -LIBRUBYARG = $(LIBRUBY) - -EXTOBJS = dmyext.obj - -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) - -all: miniruby$(EXEEXT) rbconfig.rb ext/extmk.rb \ - $(LIBRUBY) $(MISCLIBS) - @.\miniruby$(EXEEXT) -Cext extmk.rb - -ruby: $(PROGRAM) -rubyw: $(WPROGRAM) -lib: $(LIBRUBY) -dll: $(LIBRUBY_SO) - -config: config.h config.status - -config.h: Makefile $(srcdir)bcc32/Makefile.sub - @echo Creating config.h - type > $@ &&| -\#define HAVE_PROTOTYPES 1 -\#define HAVE_STDARG_PROTOTYPES 1 -/* \#define HAVE_ATTR_NORETURN 1 */ -\#define NORETURN(x) x -\#define TOKEN_PASTE(x,y) x\#\#y -\#define inline __inline -/* \#define HAVE_DIRENT_H 1 */ -/* \#define HAVE_UNISTD_H 1 */ -\#define HAVE_STDLIB_H 1 -\#define HAVE_LIMITS_H 1 -/* \#define HAVE_SYS_FILE_H 1 */ -\#define HAVE_FCNTL_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_ST_BLKSIZE 1 */ -\#define HAVE_ST_RDEV 1 -/* \#define GETGROUPS_T gid_t */ -\#define GETGROUPS_T int -\#define RETSIGTYPE void -\#define HAVE_ALLOCA 1 -\#define vfork fork -\#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_GETLOGIN 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)>>y) -\#define FILE_COUNT level -\#define FILE_READPTR curp -\#define DEFAULT_KCODE KCODE_NONE -\#define DLEXT ".so" -\#define DLEXT2 ".dll" -\#define RUBY_LIB "/lib/ruby/1.7" -\#define RUBY_SITE_LIB "/lib/ruby/site_ruby" -\#define RUBY_SITE_LIB2 "/lib/ruby/site_ruby/1.7" -\#define RUBY_PLATFORM "$(ARCH)-$(OS)" -\#define RUBY_ARCHLIB "/lib/ruby/1.7/$(ARCH)-$(OS)" -\#define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/1.7/$(ARCH)-$(OS)" - -\#define SIZEOF_INT 4 -\#define SIZEOF_SHORT 2 -\#define SIZEOF_LONG 4 -\#define SIZEOF___INT64 8 -\#define SIZEOF_VOIDP 4 -\#define SIZEOF_FLOAT 4 -\#define SIZEOF_DOUBLE 8 - -\#define HAVE_DECL_SYS_NERR 1 -\#define HAVE_ISINF 1 -\#define HAVE_ISNAN 1 -\#define HAVE_MEMMOVE 1 -\#define HAVE_MKDIR 1 -\#define HAVE_STRCASECMP 1 -\#define HAVE_STRNCASECMP 1 -\#define HAVE_STRCHR 1 -\#define HAVE_STRERROR 1 -\#define HAVE_STRFTIME 1 -\#define HAVE_STRSTR 1 -\#define HAVE_STRTOD 1 -\#define HAVE_STRTOUL 1 -| - -config.status: Makefile $(srcdir)bcc32/Makefile.sub $(MINIRUBY) - @echo Creating config.status - @$(MINIRUBY) -pe "~/@CFLAGS@/||$$_.sub!(/'$(CFLAGS)'/, '$$(CFLAGS)')" > $@ &&| -# 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@,$(LDFLAGS),;t t -s,@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@,rem,;t t -s,@AR@,tlib -nologo,;t t -s,@LN_S@,$(LN_S),;t t -s,@SET_MAKE@,$(SET_MAKE),;t t -s,@LIBOBJS@, acosh.obj crypt.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,@XLDFLAGS@,$(XLDFLAGS),;t t -s,@DLDFLAGS@,$$(CFLAGS),;t t -s,@STATIC@,$(STATIC),;t t -s,@CCDLFLAGS@,-DIMPORT,;t t -s,@LDSHARED@,ilink32 -S:$(STACK) -Tpd,;t t -s,@DLEXT@,so,;t t -s,@DLEXT2@,dll,;t t -s,@STRIP@,$(STRIP),;t t -s,@EXTSTATIC@,$(EXTSTATIC),;t t -s,@setup@,Setup,;t t -s,@LIBRUBY_LDSHARED@,$(LIBRUBY_LDSHARED),;t t -s,@LIBRUBY_DLDFLAGS@,$(LIBRUBY_DLDFLAGS),;t t -s,@RUBY_INSTALL_NAME@,$(RUBY_INSTALL_NAME),;t t -s,@RUBY_SO_NAME@,$(RUBY_SO_NAME),;t t -s,@LIBRUBY_A@,lib$$(RUBY_INSTALL_NAME).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@,$$(RUBY_SO_NAME).lib,;t t -s,@SOLIBS@,$(SOLIBS),;t t -s,@DLDLIBS@,$(DLDLIBS),;t t -s,@ENABLE_SHARED@,yes,;t t -s,@arch@,$(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 -| - -ext/extmk.rb: $(srcdir)ext/extmk.rb.in config.status - @echo Creating ext/extmk.rb - @.\miniruby$(EXEEXT) $(srcdir)ext/configsub.rb \ - -srcdir=$(srcdir) \ - -install_name=$(RUBY_INSTALL_NAME) \ - -so_name=$(RUBY_SO_NAME) \ - -output=$@ $(srcdir)ext/extmk.rb.in - -miniruby$(EXEEXT): $(OBJS) $(MAINOBJ) $(EXTOBJS) - @echo $(EXTOBJS) - @echo $(LIBS) - $(LINK) -e$@ $(MAINOBJ) $(EXTOBJS) $(OBJS) $(LIBS) - -$(PROGRAM): $(MAINOBJ) $(LIBRUBY_SO) $(*:.exe=.res) - $(LINK) -e$@ $(MAINOBJ) $(LIBRUBYARG) - -$(WPROGRAM): $(MAINOBJ) $(WINMAINOBJ) $(LIBRUBY_SO) $(*:.exe=.res) - $(LINK_W) -e$@ $(MAINOBJ) $(WINMAINOBJ) $(LIBRUBYARG) - -$(LIBRUBY_A): $(OBJS) dmyext.obj - @-if exist $@ del $@ - tlib $@ /a @&&| -$(OBJS) dmyext.obj -| - -$(LIBRUBY): $(LIBRUBY_SO) - implib $@ $(LIBRUBY_SO) - -$(LIBRUBY_SO): $(LIBRUBY_A) $(EXTOBJS) $(RUBYDEF) $(*:.dll=.res) - $(LINK_SO) -e$@ $(MAINOBJ) $(EXTOBJS) $(LIBRUBY_A) $(LIBS) - -$(RUBYDEF): $(LIBRUBY_A) miniruby$(EXEEXT) - .\miniruby$(EXEEXT) $(srcdir)bcc32/mkexports.rb -output=$@ $(LIBRUBY_A) - -install: rbconfig.rb - .\miniruby$(EXEEXT) $(srcdir)instruby.rb $(DESTDIR) - -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 - -clean-ext: - @-.\miniruby$(EXEEXT) -Cext extmk.rb clean - -distclean: distclean-ext distclean-local - -distclean-local: clean-local - @if exist Makefile del Makefile - @if exist ext\extmk.rb del ext\extmk.rb - @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 pub.def del pub.def - @if exist $(RUBY_INSTALL_NAME).rc del $(RUBY_INSTALL_NAME).rc - @if exist $(RUBYW_INSTALL_NAME).rc del $(RUBYW_INSTALL_NAME).rc - @if exist $(LIBRUBY_SO).rc del $(LIBRUBY_SO).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$(EXEEXT) -Cext extmk.rb distclean - -realclean: distclean - @if exist parse.c del parse.c - @if exist lex.c del lex.c - -test: miniruby$(EXEEXT) - @.\miniruby$(EXEEXT) $(srcdir)rubytest.rb - -rbconfig.rb: miniruby$(EXEEXT) config.status - @.\miniruby$(EXEEXT) $(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 $(LIBRUBY_SO).rc: rbconfig.rb - @.\miniruby$(EXEEXT) $(srcdir)win32/resource.rb \ - -ruby_name=$(RUBY_INSTALL_NAME) \ - -rubyw_name=$(RUBYW_INSTALL_NAME) \ - -so_name=$(LIBRUBY_SO) \ - . $(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) -I. $(CPPFLAGS) -c $(<:/=\) - -.rc.res: - $(RC) -I. -I$( $(@F) - @del y.tab.c - -parse.c: parse.y - -acosh.obj: acosh.c win32.h -alloca.obj: alloca.c win32.h -crypt.obj: crypt.c win32.h -dup2.obj: dup2.c win32.h -finite.obj: finite.c win32.h -flock.obj: flock.c win32.h -isinf.obj: isinf.c win32.h -isnan.obj: isnan.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 - -### -parse.obj: parse.c ruby.h config.h defines.h intern.h env.h node.h st.h regex.h util.h lex.c win32.h -### -array.obj: array.c ruby.h config.h defines.h intern.h win32.h -bignum.obj: bignum.c ruby.h config.h defines.h intern.h win32.h -class.obj: class.c ruby.h config.h defines.h intern.h node.h st.h win32.h -compar.obj: compar.c ruby.h config.h defines.h intern.h win32.h -dir.obj: dir.c ruby.h config.h defines.h intern.h win32.h -dln.obj: dln.c config.h defines.h dln.h win32.h -dmyext.obj: dmyext.c win32.h -enum.obj: enum.c ruby.h config.h defines.h intern.h win32.h -error.obj: error.c ruby.h config.h defines.h intern.h env.h win32.h -eval.obj: eval.c ruby.h config.h defines.h intern.h node.h env.h rubysig.h st.h dln.h win32.h -file.obj: file.c ruby.h config.h defines.h intern.h rubyio.h rubysig.h win32.h -gc.obj: gc.c ruby.h config.h defines.h intern.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 st.h rubysig.h util.h win32.h -inits.obj: inits.c ruby.h config.h defines.h intern.h win32.h -io.obj: io.c ruby.h config.h defines.h intern.h rubyio.h rubysig.h env.h win32.h -main.obj: main.c ruby.h config.h defines.h intern.h win32.h -marshal.obj: marshal.c ruby.h config.h defines.h intern.h rubyio.h st.h win32.h -prec.obj: prec.c ruby.h config.h defines.h intern.h win32.h -math.obj: math.c ruby.h config.h defines.h intern.h win32.h -numeric.obj: numeric.c ruby.h config.h defines.h intern.h win32.h -object.obj: object.c ruby.h config.h defines.h intern.h st.h win32.h -pack.obj: pack.c ruby.h config.h defines.h intern.h win32.h -process.obj: process.c ruby.h config.h defines.h intern.h rubysig.h st.h win32.h -random.obj: random.c ruby.h config.h defines.h intern.h win32.h -range.obj: range.c ruby.h config.h defines.h intern.h win32.h -re.obj: re.c ruby.h config.h defines.h intern.h re.h regex.h win32.h -regex.obj: regex.c config.h regex.h util.h win32.h -ruby.obj: ruby.c ruby.h config.h defines.h intern.h dln.h util.h win32.h -signal.obj: signal.c ruby.h config.h defines.h intern.h rubysig.h win32.h -sprintf.obj: sprintf.c ruby.h config.h defines.h intern.h win32.h -st.obj: st.c config.h st.h win32.h -string.obj: string.c ruby.h config.h defines.h intern.h re.h regex.h win32.h -struct.obj: struct.c ruby.h config.h defines.h intern.h win32.h -time.obj: time.c ruby.h config.h defines.h intern.h win32.h -util.obj: util.c ruby.h config.h defines.h intern.h util.h win32.h -variable.obj: variable.c ruby.h config.h defines.h intern.h env.h node.h st.h win32.h -version.obj: version.c ruby.h config.h defines.h intern.h version.h win32.h diff --git a/bcc32/README.bcc32 b/bcc32/README.bcc32 deleted file mode 100644 index fe55046013..0000000000 --- a/bcc32/README.bcc32 +++ /dev/null @@ -1,123 +0,0 @@ -=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%))' - - This command will create following directories and install files onto them. - * \bin - * \lib - * \lib\ruby - * \lib\ruby\. - * \lib\ruby\.\ - * \lib\ruby\site_ruby - * \lib\ruby\site_ruby\. - * \lib\ruby\site_ruby\.\ - * \man\man1 - If Ruby's version is `x.y.z', the ((||)) is `x' and the ((||)) is `y'. - The ((||)) 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. - -* (()) or - (()) -* (()) or - (()) - -== 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. - - ex.) - ruby source directory: C:\ruby - build directory: C:\ruby\bccwin32 - install directory: C:\usr\local - - C: - cd \ruby - mkdir bccwin32 - cd bccwin32 - ..\bcc32\configure - 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 deleted file mode 100644 index 0025fa685e..0000000000 --- a/bcc32/configure.bat +++ /dev/null @@ -1,11 +0,0 @@ -@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 -Dbcc32dir="$(@D)" -f$(@D)/setup.mak %1 -make -f ~tmp~.mak diff --git a/bcc32/mkexports.rb b/bcc32/mkexports.rb deleted file mode 100644 index 531ba3a001..0000000000 --- a/bcc32/mkexports.rb +++ /dev/null @@ -1,26 +0,0 @@ -#!./miniruby -s - -SYM = {} -objs = ARGV.collect {|s| s.tr('/', '\\')} -system("tdump -oiPUBDEF -oiPUBD32 #{objs.join(' ')} > pub.def") -sleep(1) -IO.foreach('pub.def'){|l| - next unless /(PUBDEF|PUBD32)/ =~ l - /'(.*?)'/ =~ l - SYM[$1] = true -} - -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 deleted file mode 100644 index 38c98133fb..0000000000 --- a/bcc32/setup.mak +++ /dev/null @@ -1,50 +0,0 @@ -# -*- makefile -*- - -!if "$(bcc32dir)" == "bcc32/" -srcdir = ./ -!elseif "$(bcc32dir)" == "../bcc32/" -srcdir = ../ -!else -srcdir = $(bcc32dir)../ -!endif - -OS = bccwin32 - -all: ext makefile - @echo type `make' to make ruby for bccwin32. - -makefile: make_s make_e - -make_s: - @if exist makefile @del makefile - @echo ### makefile for ruby $(OS) ###> makefile - @echo srcdir = $(srcdir:\=/)>> makefile - @echo RUBY_INSTALL_NAME = ruby>> makefile - @echo RUBY_SO_NAME = $(OS)_$$(RUBY_INSTALL_NAME)17>> makefile - -make_e: - @echo !INCLUDE $$(srcdir)bcc32/makefile.sub>> makefile - -ext: - @if not exist $@\* mkdir $@ - -pl3: - @echo PROCESSOR_LEVEL = 3 >> makefile - -pl4: - @echo PROCESSOR_LEVEL = 4 >> makefile - -pl5: - @echo PROCESSOR_LEVEL = 5 >> makefile - -pl6: - @echo PROCESSOR_LEVEL = 6 >> makefile - -3: ext make_s pl3 make_e - -4: ext make_s pl4 make_e - -5: ext make_s pl5 make_e - -6: ext make_s pl6 make_e - diff --git a/bignum.c b/bignum.c deleted file mode 100644 index ddb1636d69..0000000000 --- a/bignum.c +++ /dev/null @@ -1,1747 +0,0 @@ -/********************************************************************** - - bignum.c - - - $Author$ - $Date$ - created at: Fri Jun 10 00:48:55 JST 1994 - - Copyright (C) 1993-2002 Yukihiro Matsumoto - -**********************************************************************/ - -#include "ruby.h" - -#include -#include - -VALUE rb_cBignum; - -#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))) - -static VALUE -bignew_1(klass, len, sign) - VALUE klass; - long len; - char sign; -{ - NEWOBJ(big, struct RBignum); - OBJSETUP(big, klass, T_BIGNUM); - big->sign = sign; - big->len = len; - big->digits = ALLOC_N(BDIGIT, len); - - return (VALUE)big; -} - -#define bignew(len,sign) bignew_1(rb_cBignum,len,sign) - -VALUE -rb_big_clone(x) - VALUE x; -{ - VALUE z = bignew_1(CLASS_OF(x), RBIGNUM(x)->len, RBIGNUM(x)->sign); - - MEMCPY(BDIGITS(z), BDIGITS(x), BDIGIT, RBIGNUM(x)->len); - return z; -} - -static void -get2comp(x, carry) /* get 2's complement */ - VALUE x; - int carry; -{ - long i = RBIGNUM(x)->len; - BDIGIT *ds = BDIGITS(x); - BDIGIT_DBL num; - - while (i--) ds[i] = ~ds[i]; - i = 0; num = 1; - do { - num += ds[i]; - ds[i++] = BIGLO(num); - num = BIGDN(num); - } while (i < 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] = ~0; - } -} - -void -rb_big_2comp(x) /* get 2's complement */ - VALUE x; -{ - get2comp(x, Qtrue); -} - -static VALUE -bignorm(x) - VALUE x; -{ - if (!FIXNUM_P(x)) { - long len = RBIGNUM(x)->len; - BDIGIT *ds = BDIGITS(x); - - while (len-- && !ds[len]) ; - RBIGNUM(x)->len = ++len; - - 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 INT2FIX(num); - } - else if (NEGFIXABLE(-(long)num)) return INT2FIX(-(long)num); - } - } - } - return x; -} - -VALUE -rb_big_norm(x) - VALUE x; -{ - return bignorm(x); -} - -VALUE -rb_uint2big(n) - unsigned long n; -{ - BDIGIT_DBL num = n; - long i = 0; - BDIGIT *digits; - VALUE big; - - i = 0; - big = bignew(DIGSPERLONG, 1); - digits = BDIGITS(big); - while (i < DIGSPERLONG) { - digits[i++] = BIGLO(num); - num = BIGDN(num); - } - - i = DIGSPERLONG; - while (i-- && !digits[i]) ; - RBIGNUM(big)->len = i+1; - return big; -} - -VALUE -rb_int2big(n) - long n; -{ - long neg = 0; - VALUE big; - - if (n < 0) { - n = -n; - neg = 1; - } - big = rb_uint2big(n); - if (neg) { - RBIGNUM(big)->sign = 0; - } - return big; -} - -VALUE -rb_uint2inum(n) - unsigned long n; -{ - if (POSFIXABLE(n)) return INT2FIX(n); - return rb_uint2big(n); -} - -VALUE -rb_int2inum(n) - long n; -{ - if (FIXABLE(n)) return INT2FIX(n); - return rb_int2big(n); -} - -#ifdef HAVE_LONG_LONG - -#define DIGSPERLONGLONG ((unsigned int)(SIZEOF_LONG_LONG/SIZEOF_BDIGITS)) - -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; - - ds = BDIGITS(val); - q = 0; - while (len--) { - q = BIGUP(q); - q += ds[len]; - } - } - 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 = 0; - BDIGIT *digits; - VALUE big; - - memcpy(&q, buf, SIZEOF_LONG_LONG); - if (sign) { - if (FIXABLE((LONG_LONG)q)) return INT2FIX((LONG_LONG)q); - if ((LONG_LONG)q < 0) { - q = -(LONG_LONG)q; - neg = 1; - } - } - else { - if (POSFIXABLE(q)) return INT2FIX(q); - } - - i = 0; - big = bignew(DIGSPERLONGLONG, 1); - digits = BDIGITS(big); - while (i < DIGSPERLONGLONG) { - digits[i++] = BIGLO(q); - q = BIGDN(q); - } - - i = DIGSPERLONGLONG; - 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) len = QUAD_SIZE; - 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 -rb_cstr_to_inum(str, base, badcheck) - const char *str; - int base; - int badcheck; -{ - const char *s = str; - char *end; - char sign = 1, c, nondigit = 0; - BDIGIT_DBL num; - long len, blen = 1; - long i; - VALUE z; - BDIGIT *zds; - - if (badcheck) { - while (ISSPACE(*str)) str++; - } - else { - while (ISSPACE(*str) || *str == '_') str++; - } - - if (str[0] == '+') { - str++; - } - else if (str[0] == '-') { - str++; - sign = 0; - } - if (str[0] == '+' || str[0] == '-') { - if (badcheck) goto bad; - return INT2FIX(0); - } - if (base <= 0) { - if (str[0] == '0') { - if (str[1] == 'x' || str[1] == 'X') { - base = 16; - } - else if (str[1] == 'b' || str[1] == 'B') { - base = 2; - } - else { - base = 8; - } - } - else if (base < -1) { - base = -base; - } - else { - base = 10; - } - } - if (base == 8) { - len = 3; - } - else { /* base == 10, 2 or 16 */ - if (base == 16 && str[0] == '0' && (str[1] == 'x'||str[1] == 'X')) { - str += 2; - } - else if (base == 2 && str[0] == '0' && (str[1] == 'b'||str[1] == 'B')) { - str += 2; - } - len = 4; - } - if (*str == '0') { /* squeeze preceeding 0s */ - while (*++str == '0'); - --str; - } - len *= strlen(str)*sizeof(char); - - if (len <= (sizeof(VALUE)*CHAR_BIT)) { - 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) { /* trailing garbage */ - bad: - rb_invalid_str(s, "Integer"); - } - } - - if (POSFIXABLE(val)) { - if (sign) return INT2FIX(val); - else { - long result = -(long)val; - return INT2FIX(result); - } - } - else { - VALUE big = rb_uint2big(val); - RBIGNUM(big)->sign = sign; - return 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 '8': case '9': - if (base == 8) { - c = base; - break; - } - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': - c = c - '0'; - nondigit = 0; - break; - case 'a': case 'b': case 'c': - case 'd': case 'e': case 'f': - c -= 'a' - 'A'; - case 'A': case 'B': case 'C': - case 'D': case 'E': case 'F': - if (base != 16) { - nondigit = c; - c = base; - } - else { - c = c - 'A' + 10; - nondigit = 0; - } - break; - case '_': - if (badcheck) { - if (nondigit) goto bad; - nondigit = c; - } - continue; - default: - c = base; - break; - } - if (c >= base) break; - i = 0; - num = c; - for (;;) { - while (iptr; - 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; - } - if (badcheck && len != strlen(s)) { - rb_raise(rb_eArgError, "string for Integer contains null byte"); - } - 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; - - i = 0; - 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 INT2FIX(n); - return rb_ull2big(n); -} - -VALUE -rb_ll2inum(n) - LONG_LONG n; -{ - if (FIXABLE(n)) return INT2FIX(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); -} - -static char hexmap[] = "0123456789abcdef"; -VALUE -rb_big2str(x, base) - VALUE x; - int base; -{ - volatile VALUE t; - BDIGIT *ds; - long i, j, hbase; - VALUE ss; - char *s, c; - - if (FIXNUM_P(x)) { - return rb_fix2str(x, base); - } - i = RBIGNUM(x)->len; - if (i == 0) return rb_str_new2("0"); - if (base == 10) { - j = (SIZEOF_BDIGITS/sizeof(char)*CHAR_BIT*i*241L)/800+2; - hbase = 10000; - } - else if (base == 16) { - j = (SIZEOF_BDIGITS/sizeof(char)*CHAR_BIT*i)/4+2; - hbase = 0x10000; - } - else if (base == 8) { - j = (SIZEOF_BDIGITS/sizeof(char)*CHAR_BIT*i)+2; - hbase = 010000; - } - else if (base == 2) { - j = (SIZEOF_BDIGITS*CHAR_BIT*i)+2; - hbase = 020; - } - else { - rb_raise(rb_eArgError, "illegal radix %d", base); - } - - t = rb_big_clone(x); - ds = BDIGITS(t); - ss = rb_str_new(0, j); - s = RSTRING(ss)->ptr; - - s[0] = RBIGNUM(x)->sign ? '+' : '-'; - while (i && j) { - long k = i; - BDIGIT_DBL num = 0; - - while (k--) { - num = BIGUP(num) + ds[k]; - ds[k] = (BDIGIT)(num / hbase); - num %= hbase; - } - if (ds[i-1] == 0) i--; - k = 4; - while (k--) { - c = (char)(num % base); - s[--j] = hexmap[(int)c]; - num /= base; - if (i == 0 && num == 0) break; - } - } - while (s[j] == '0') j++; - RSTRING(ss)->len -= RBIGNUM(x)->sign?j:j-1; - memmove(RBIGNUM(x)->sign?s:s+1, s+j, RSTRING(ss)->len); - s[RSTRING(ss)->len] = '\0'; - - return ss; -} - -static VALUE -rb_big_to_s(argc, argv, x) - int argc; - VALUE *argv; - VALUE x; -{ - 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); -} - -static unsigned long -big2ulong(x, type) - VALUE x; - char *type; -{ - long len = RBIGNUM(x)->len; - BDIGIT_DBL num; - BDIGIT *ds; - - 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--) { - num = BIGUP(num); - num += ds[len]; - } - return num; -} - -unsigned long -rb_big2ulong(x) - VALUE x; -{ - unsigned long num = big2ulong(x, "unsigned long"); - - if (!RBIGNUM(x)->sign) return -num; - return num; -} - -long -rb_big2long(x) - VALUE x; -{ - unsigned long num = big2ulong(x, "int"); - - if ((long)num < 0 && (RBIGNUM(x)->sign || (long)num != LONG_MIN)) { - rb_raise(rb_eRangeError, "bignum too big to convert into `int'"); - } - if (!RBIGNUM(x)->sign) return -(long)num; - return num; -} - -#if HAVE_LONG_LONG - -static unsigned LONG_LONG -big2ull(x, type) - VALUE x; - char *type; -{ - long len = RBIGNUM(x)->len; - BDIGIT_DBL num; - BDIGIT *ds; - - 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; -} - -LONG_LONG -rb_big2ll(x) - VALUE 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; -} - -#endif /* HAVE_LONG_LONG */ - -static VALUE -dbl2big(d) - double d; -{ - long i = 0; - BDIGIT c; - BDIGIT *digits; - VALUE z; - double u = (d < 0)?-d:d; - - 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++; - } - z = bignew(i, d>=0); - digits = BDIGITS(z); - while (i--) { - u *= BIGRAD; - c = (BDIGIT)u; - u -= c; - digits[i] = c; - } - - return z; -} - -VALUE -rb_dbl2big(d) - double d; -{ - return bignorm(dbl2big(d)); -} - -double -rb_big2dbl(x) - VALUE x; -{ - double d = 0.0; - long i = RBIGNUM(x)->len; - BDIGIT *ds = BDIGITS(x); - - while (i--) { - d = ds[i] + BIGRAD*d; - } - if (isinf(d)) d = HUGE_VAL; - if (!RBIGNUM(x)->sign) d = -d; - return d; -} - -static VALUE -rb_big_to_f(x) - VALUE x; -{ - return rb_float_new(rb_big2dbl(x)); -} - -static VALUE -rb_big_cmp(x, y) - VALUE x, y; -{ - long xlen = RBIGNUM(x)->len; - - switch (TYPE(y)) { - case T_FIXNUM: - y = rb_int2big(FIX2LONG(y)); - break; - - case T_BIGNUM: - break; - - case T_FLOAT: - { - double d = rb_big2dbl(x); - - if (d == RFLOAT(y)->value) return INT2FIX(0); - if (d > RFLOAT(y)->value) return INT2FIX(1); - if (d < RFLOAT(y)->value) return INT2FIX(-1); - } - break; - - default: - return rb_num_coerce_bin(x, y); - } - - if (RBIGNUM(x)->sign > RBIGNUM(y)->sign) return INT2FIX(1); - if (RBIGNUM(x)->sign < RBIGNUM(y)->sign) return INT2FIX(-1); - if (xlen < RBIGNUM(y)->len) - return (RBIGNUM(x)->sign) ? INT2FIX(-1) : INT2FIX(1); - if (xlen > RBIGNUM(y)->len) - return (RBIGNUM(x)->sign) ? INT2FIX(1) : INT2FIX(-1); - - while(xlen-- && (BDIGITS(x)[xlen]==BDIGITS(y)[xlen])); - if (-1 == xlen) return INT2FIX(0); - return (BDIGITS(x)[xlen] > BDIGITS(y)[xlen]) ? - (RBIGNUM(x)->sign ? INT2FIX(1) : INT2FIX(-1)) : - (RBIGNUM(x)->sign ? INT2FIX(-1) : INT2FIX(1)); -} - -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: - if (rb_big2dbl(x) == RFLOAT(y)->value) - return Qtrue; - else - return 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; -} - -static VALUE -rb_big_eql(x, y) - VALUE x, y; -{ - 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; -} - -static VALUE -rb_big_uminus(x) - VALUE x; -{ - VALUE z = rb_big_clone(x); - - RBIGNUM(z)->sign = !RBIGNUM(x)->sign; - - return bignorm(z); -} - -static VALUE -rb_big_neg(x) - VALUE x; -{ - VALUE z = rb_big_clone(x); - long i = RBIGNUM(x)->len; - BDIGIT *ds = BDIGITS(z); - - if (!RBIGNUM(x)->sign) get2comp(z, Qtrue); - while (i--) ds[i] = ~ds[i]; - if (RBIGNUM(x)->sign) get2comp(z, Qfalse); - RBIGNUM(z)->sign = !RBIGNUM(z)->sign; - - return bignorm(z); -} - -static VALUE -bigsub(x, y) - VALUE x, y; -{ - VALUE z = 0; - BDIGIT *zds; - BDIGIT_DBL_SIGNED num; - long i; - - 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 */ - } - else if (RBIGNUM(x)->len == RBIGNUM(y)->len) { - while (i > 0) { - i--; - if (BDIGITS(x)[i] > BDIGITS(y)[i]) { - break; - } - if (BDIGITS(x)[i] < BDIGITS(y)[i]) { - z = x; x = y; y = z; /* swap x y */ - break; - } - } - } - - z = bignew(RBIGNUM(x)->len, (z == 0)?1:0); - zds = BDIGITS(z); - - for (i = 0, num = 0; i < RBIGNUM(y)->len; i++) { - num += (BDIGIT_DBL_SIGNED)BDIGITS(x)[i] - BDIGITS(y)[i]; - zds[i] = BIGLO(num); - num = BIGDN(num); - } - while (num && i < RBIGNUM(x)->len) { - num += BDIGITS(x)[i]; - zds[i++] = BIGLO(num); - num = BIGDN(num); - } - while (i < RBIGNUM(x)->len) { - zds[i] = BDIGITS(x)[i]; - i++; - } - - return z; -} - -static VALUE -bigadd(x, y, sign) - VALUE x, y; - char sign; -{ - VALUE z; - BDIGIT_DBL num; - long i, len; - - sign = (sign == RBIGNUM(y)->sign); - if (RBIGNUM(x)->sign != sign) { - if (sign) return bigsub(y, x); - return bigsub(x, y); - } - - if (RBIGNUM(x)->len > RBIGNUM(y)->len) { - len = RBIGNUM(x)->len + 1; - z = x; x = y; y = z; - } - else { - len = RBIGNUM(y)->len + 1; - } - z = bignew(len, sign); - - len = RBIGNUM(x)->len; - for (i = 0, num = 0; i < len; i++) { - num += (BDIGIT_DBL)BDIGITS(x)[i] + BDIGITS(y)[i]; - BDIGITS(z)[i] = BIGLO(num); - num = BIGDN(num); - } - len = RBIGNUM(y)->len; - while (num && i < len) { - num += BDIGITS(y)[i]; - BDIGITS(z)[i++] = BIGLO(num); - num = BIGDN(num); - } - while (i < len) { - BDIGITS(z)[i] = BDIGITS(y)[i]; - i++; - } - BDIGITS(z)[i] = (BDIGIT)num; - - return z; -} - -VALUE -rb_big_plus(x, y) - VALUE x, y; -{ - switch (TYPE(y)) { - case T_FIXNUM: - y = rb_int2big(FIX2LONG(y)); - /* fall through */ - case T_BIGNUM: - return bignorm(bigadd(x, y, 1)); - - case T_FLOAT: - return rb_float_new(rb_big2dbl(x) + RFLOAT(y)->value); - - default: - return rb_num_coerce_bin(x, y); - } -} - -VALUE -rb_big_minus(x, y) - VALUE x, y; -{ - switch (TYPE(y)) { - case T_FIXNUM: - y = rb_int2big(FIX2LONG(y)); - /* fall through */ - case T_BIGNUM: - return bignorm(bigadd(x, y, 0)); - - case T_FLOAT: - return rb_float_new(rb_big2dbl(x) - RFLOAT(y)->value); - - default: - return rb_num_coerce_bin(x, y); - } -} - -VALUE -rb_big_mul(x, y) - VALUE x, y; -{ - long i, j; - BDIGIT_DBL n = 0; - VALUE z; - BDIGIT *zds; - - if (FIXNUM_P(x)) x = rb_int2big(FIX2LONG(x)); - switch (TYPE(y)) { - case T_FIXNUM: - y = rb_int2big(FIX2LONG(y)); - break; - - case T_BIGNUM: - break; - - case T_FLOAT: - return rb_float_new(rb_big2dbl(x) * RFLOAT(y)->value); - - default: - return rb_num_coerce_bin(x, y); - } - - j = RBIGNUM(x)->len + RBIGNUM(y)->len + 1; - z = bignew(j, RBIGNUM(x)->sign==RBIGNUM(y)->sign); - zds = BDIGITS(z); - while (j--) zds[j] = 0; - for (i = 0; i < RBIGNUM(x)->len; i++) { - BDIGIT_DBL dd = BDIGITS(x)[i]; - if (dd == 0) continue; - n = 0; - for (j = 0; j < RBIGNUM(y)->len; 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); - } - if (n) { - zds[i + j] = n; - } - } - - return bignorm(z); -} - -static void -bigdivrem(x, y, divp, modp) - VALUE x, y; - VALUE *divp, *modp; -{ - long nx = RBIGNUM(x)->len, ny = RBIGNUM(y)->len; - long i, j; - VALUE yy, z; - BDIGIT *xds, *yds, *zds, *tds; - BDIGIT_DBL t2; - BDIGIT_DBL_SIGNED num; - BDIGIT dd, q; - - yds = BDIGITS(y); - if (ny == 0 && yds[0] == 0) rb_num_zerodiv(); - 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 = rb_big_clone(x); - zds = BDIGITS(z); - t2 = 0; i = nx; - while (i--) { - t2 = BIGUP(t2) + zds[i]; - zds[i] = (BDIGIT)(t2 / dd); - t2 %= dd; - } - 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--; - - 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; - t2 = 0; - while (j= ny); - 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(*divp)->len = i; - } - if (modp) { /* just normalize remainder */ - *modp = rb_big_clone(z); - zds = BDIGITS(*modp); - while (ny-- && !zds[ny]); ++ny; - if (dd) { - t2 = 0; i = ny; - while(i--) { - t2 = (t2 | zds[i]) >> dd; - q = zds[i]; - zds[i] = BIGLO(t2); - t2 = BIGUP(q); - } - } - 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 && RBIGNUM(mod)->len > 0) { - 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; - } -} - -static VALUE -rb_big_div(x, y) - VALUE x, y; -{ - VALUE z; - - switch (TYPE(y)) { - case T_FIXNUM: - y = rb_int2big(FIX2LONG(y)); - break; - - case T_BIGNUM: - break; - - case T_FLOAT: - return rb_float_new(rb_big2dbl(x) / RFLOAT(y)->value); - - default: - return rb_num_coerce_bin(x, y); - } - bigdivmod(x, y, &z, 0); - - return bignorm(z); -} - - -static VALUE -rb_big_modulo(x, y) - VALUE x, y; -{ - 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); - } - bigdivmod(x, y, 0, &z); - - return bignorm(z); -} - -static VALUE -rb_big_remainder(x, y) - VALUE x, y; -{ - 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); -} - -VALUE -rb_big_divmod(x, y) - VALUE x, y; -{ - 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)); -} - -VALUE -rb_big_pow(x, y) - VALUE x, y; -{ - double d; - long yy; - - if (y == INT2FIX(0)) return INT2FIX(1); - switch (TYPE(y)) { - case T_FLOAT: - d = RFLOAT(y)->value; - break; - - case T_BIGNUM: - rb_warn("in a**b, b may be too big"); - d = rb_big2dbl(y); - break; - - case T_FIXNUM: - yy = NUM2LONG(y); - if (yy > 0) { - VALUE z = x; - - for (;;) { - yy -= 1; - if (yy == 0) break; - while (yy % 2 == 0) { - yy /= 2; - x = rb_big_mul(x, x); - } - z = rb_big_mul(z, x); - } - return bignorm(z); - } - d = (double)yy; - break; - - default: - return rb_num_coerce_bin(x, y); - } - return rb_float_new(pow(rb_big2dbl(x), d)); -} - -VALUE -rb_big_and(x, y) - VALUE x, y; -{ - VALUE z; - BDIGIT *ds1, *ds2, *zds; - long i, l1, l2; - char sign; - - if (FIXNUM_P(y)) { - y = rb_int2big(FIX2LONG(y)); - } - else { - Check_Type(y, T_BIGNUM); - } - - if (!RBIGNUM(y)->sign) { - y = rb_big_clone(y); - get2comp(y, Qtrue); - } - if (!RBIGNUM(x)->sign) { - x = rb_big_clone(x); - get2comp(x, Qtrue); - } - if (RBIGNUM(x)->len > RBIGNUM(y)->len) { - l1 = RBIGNUM(y)->len; - l2 = RBIGNUM(x)->len; - ds1 = BDIGITS(y); - ds2 = BDIGITS(x); - sign = RBIGNUM(y)->sign; - } - else { - l1 = RBIGNUM(x)->len; - l2 = RBIGNUM(y)->len; - ds1 = BDIGITS(x); - ds2 = BDIGITS(y); - sign = RBIGNUM(x)->sign; - } - z = bignew(l2, RBIGNUM(x)->sign || RBIGNUM(y)->sign); - zds = BDIGITS(z); - - for (i=0; isign) get2comp(z, Qfalse); - return bignorm(z); -} - -VALUE -rb_big_or(x, y) - VALUE x, y; -{ - VALUE z; - BDIGIT *ds1, *ds2, *zds; - long i, l1, l2; - char sign; - - if (FIXNUM_P(y)) { - y = rb_int2big(FIX2LONG(y)); - } - else { - Check_Type(y, T_BIGNUM); - } - - if (!RBIGNUM(y)->sign) { - y = rb_big_clone(y); - get2comp(y, Qtrue); - } - if (!RBIGNUM(x)->sign) { - x = rb_big_clone(x); - get2comp(x, Qtrue); - } - if (RBIGNUM(x)->len > RBIGNUM(y)->len) { - l1 = RBIGNUM(y)->len; - l2 = RBIGNUM(x)->len; - ds1 = BDIGITS(y); - ds2 = BDIGITS(x); - sign = RBIGNUM(y)->sign; - } - else { - l1 = RBIGNUM(x)->len; - l2 = RBIGNUM(y)->len; - ds1 = BDIGITS(x); - ds2 = BDIGITS(y); - sign = RBIGNUM(x)->sign; - } - z = bignew(l2, RBIGNUM(x)->sign && RBIGNUM(y)->sign); - zds = BDIGITS(z); - - for (i=0; isign) get2comp(z, Qfalse); - - return bignorm(z); -} - -VALUE -rb_big_xor(x, y) - VALUE x, y; -{ - VALUE z; - BDIGIT *ds1, *ds2, *zds; - long i, l1, l2; - char sign; - - if (FIXNUM_P(y)) { - y = rb_int2big(FIX2LONG(y)); - } - else { - Check_Type(y, T_BIGNUM); - } - - if (!RBIGNUM(y)->sign) { - y = rb_big_clone(y); - get2comp(y, Qtrue); - } - if (!RBIGNUM(x)->sign) { - x = rb_big_clone(x); - get2comp(x, Qtrue); - } - if (RBIGNUM(x)->len > RBIGNUM(y)->len) { - l1 = RBIGNUM(y)->len; - l2 = RBIGNUM(x)->len; - ds1 = BDIGITS(y); - ds2 = BDIGITS(x); - sign = RBIGNUM(y)->sign; - } - else { - l1 = RBIGNUM(x)->len; - l2 = RBIGNUM(y)->len; - ds1 = BDIGITS(x); - ds2 = BDIGITS(y); - sign = RBIGNUM(x)->sign; - } - RBIGNUM(x)->sign = RBIGNUM(x)->sign?1:0; - RBIGNUM(y)->sign = RBIGNUM(y)->sign?1:0; - z = bignew(l2, !(RBIGNUM(x)->sign ^ RBIGNUM(y)->sign)); - zds = BDIGITS(z); - - for (i=0; isign) get2comp(z, Qfalse); - - return bignorm(z); -} - -static VALUE rb_big_rshift _((VALUE,VALUE)); - -VALUE -rb_big_lshift(x, y) - VALUE x, y; -{ - BDIGIT *xds, *zds; - int shift = NUM2INT(y); - int s1 = shift/BITSPERDIG; - int s2 = shift%BITSPERDIG; - VALUE z; - BDIGIT_DBL num = 0; - long len, i; - - 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; ilen; - long j; - - if (shift < 0) return rb_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); - 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); -} - -static VALUE -rb_big_aref(x, y) - VALUE x, y; -{ - BDIGIT *xds; - int shift; - int 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 = rb_big_clone(x); - get2comp(x, Qtrue); - } - else { - if (s1 >= RBIGNUM(x)->len) return INT2FIX(0); - } - xds = BDIGITS(x); - if (xds[s1] & (1<len; - for (i=0; isign) { - x = rb_big_clone(x); - RBIGNUM(x)->sign = 1; - } - return x; -} - -/* !!!warnig!!!! - this is not really a random number!! -*/ - -VALUE -rb_big_rand(max, rand) - VALUE max; - double rand; -{ - VALUE v; - long len; - - len = RBIGNUM(max)->len; - v = bignew(len,1); - while (len--) { - BDIGITS(v)[len] = ((BDIGIT)~0) * rand; - } - - return rb_big_modulo((VALUE)v, max); -} - -static VALUE -rb_big_size(big) - VALUE big; -{ - return INT2FIX(RBIGNUM(big)->len*SIZEOF_BDIGITS); -} - -static VALUE -rb_big_zero_p(big) - VALUE big; -{ - return Qfalse; -} - -void -Init_Bignum() -{ - 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, "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, "**", 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, "===", 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); - rb_define_method(rb_cBignum, "zero?", rb_big_zero_p, 0); -} diff --git a/class.c b/class.c deleted file mode 100644 index 962a9abefc..0000000000 --- a/class.c +++ /dev/null @@ -1,863 +0,0 @@ -/********************************************************************** - - class.c - - - $Author$ - $Date$ - created at: Tue Aug 10 15:05:44 JST 1993 - - Copyright (C) 1993-2002 Yukihiro Matsumoto - -**********************************************************************/ - -#include "ruby.h" -#include "rubysig.h" -#include "node.h" -#include "st.h" -#include - -extern st_table *rb_class_tbl; - -VALUE -rb_class_boot(super) - VALUE super; -{ - NEWOBJ(klass, struct RClass); - OBJSETUP(klass, rb_cClass, T_CLASS); - - klass->super = super; - klass->iv_tbl = 0; - klass->m_tbl = 0; /* safe GC */ - klass->m_tbl = st_init_numtable(); - - OBJ_INFECT(klass, super); - return (VALUE)klass; -} - -VALUE -rb_class_new(super) - VALUE super; -{ - 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 -clone_method(mid, body, tbl) - ID mid; - NODE *body; - st_table *tbl; -{ - st_insert(tbl, mid, NEW_METHOD(body->nd_body, body->nd_noex)); - return ST_CONTINUE; -} - -VALUE -rb_mod_clone(module) - VALUE module; -{ - NEWOBJ(clone, struct RClass); - CLONESETUP(clone, module); - - RCLASS(clone)->super = RCLASS(module)->super; - if (RCLASS(module)->iv_tbl) { - ID id; - - RCLASS(clone)->iv_tbl = st_copy(RCLASS(module)->iv_tbl); - id = rb_intern("__classpath__"); - st_delete(RCLASS(clone)->iv_tbl, &id, 0); - id = rb_intern("__classid__"); - st_delete(RCLASS(clone)->iv_tbl, &id, 0); - } - if (RCLASS(module)->m_tbl) { - RCLASS(clone)->m_tbl = st_init_numtable(); - st_foreach(RCLASS(module)->m_tbl, clone_method, RCLASS(clone)->m_tbl); - } - - return (VALUE)clone; -} - -VALUE -rb_mod_dup(mod) - VALUE mod; -{ - VALUE dup = rb_mod_clone(mod); - - DUPSETUP(dup, mod); - if (FL_TEST(mod, FL_SINGLETON)) { - FL_SET(dup, FL_SINGLETON); - } - return dup; -} - -VALUE -rb_singleton_class_new(super) - VALUE super; -{ - VALUE klass = rb_class_boot(super); - - FL_SET(klass, FL_SINGLETON); - return klass; -} - -VALUE -rb_singleton_class_clone(klass) - VALUE klass; -{ - if (!FL_TEST(klass, FL_SINGLETON)) - return klass; - else { - /* copy singleton(unnamed) class */ - NEWOBJ(clone, struct RClass); - CLONESETUP(clone, klass); - - clone->super = RCLASS(klass)->super; - clone->iv_tbl = 0; - clone->m_tbl = 0; - 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, clone->m_tbl); - FL_SET(clone, FL_SINGLETON); - return (VALUE)clone; - } -} - -void -rb_singleton_class_attached(klass, obj) - VALUE klass, 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, klass) - VALUE obj, klass; -{ - klass = rb_singleton_class_new(klass); - RBASIC(obj)->klass = klass; - rb_singleton_class_attached(klass, obj); - return klass; -} - -VALUE -rb_define_class_id(id, super) - ID id; - VALUE super; -{ - VALUE klass; - - if (!super) super = rb_cObject; - klass = rb_class_new(super); - rb_name_class(klass, id); - rb_make_metaclass(klass, RBASIC(super)->klass); - - return klass; -} - -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) - const char *name; - VALUE super; -{ - VALUE klass; - ID id; - - id = rb_intern(name); - if (rb_autoload_defined(id)) { - rb_autoload_load(id); - } - 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); - rb_class_inherited(super, klass); - st_add_direct(rb_class_tbl, id, klass); - - return klass; -} - -VALUE -rb_define_class_under(outer, name, super) - VALUE outer; - const char *name; - VALUE super; -{ - VALUE klass; - ID id; - - id = rb_intern(name); - if (rb_const_defined_at(outer, id)) { - klass = rb_const_get(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_set_class_path(klass, outer, name); - rb_class_inherited(super, klass); - rb_const_set(outer, id, klass); - - return klass; -} - -VALUE -rb_module_new() -{ - NEWOBJ(mdl, struct RClass); - OBJSETUP(mdl, rb_cModule, T_MODULE); - - mdl->super = 0; - mdl->iv_tbl = 0; - mdl->m_tbl = 0; - mdl->m_tbl = st_init_numtable(); - - return (VALUE)mdl; -} - -VALUE -rb_define_module_id(id) - ID id; -{ - VALUE mdl; - - mdl = rb_module_new(); - rb_name_class(mdl, id); - - return mdl; -} - -VALUE -rb_define_module(name) - const char *name; -{ - VALUE module; - ID id; - - id = rb_intern(name); - if (rb_autoload_defined(id)) { - rb_autoload_load(id); - } - 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_class2name(CLASS_OF(module))); - } - module = rb_define_module_id(id); - st_add_direct(rb_class_tbl, id, module); - - return module; -} - -VALUE -rb_define_module_under(outer, name) - VALUE outer; - const char *name; -{ - VALUE module; - ID id; - - id = rb_intern(name); - if (rb_const_defined_at(outer, id)) { - module = rb_const_get(outer, id); - if (TYPE(module) == T_MODULE) - return module; - rb_raise(rb_eTypeError, "%s::%s is not a module", - rb_class2name(outer), rb_class2name(CLASS_OF(module))); - } - module = rb_define_module_id(id); - rb_const_set(outer, id, module); - rb_set_class_path(module, outer, name); - - return module; -} - -static VALUE -include_class_new(module, super) - VALUE module, super; -{ - NEWOBJ(klass, struct RClass); - OBJSETUP(klass, rb_cClass, T_ICLASS); - - 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; - } - else { - RBASIC(klass)->klass = module; - } - OBJ_INFECT(klass, module); - OBJ_INFECT(klass, super); - - return (VALUE)klass; -} - -void -rb_include_module(klass, module) - VALUE klass, module; -{ - 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: - Check_Type(module, T_MODULE); - } - - OBJ_INFECT(klass, module); - c = klass; - while (module) { - 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) { - if (RCLASS(p)->m_tbl == RCLASS(module)->m_tbl) { - c = p; /* move insertion point */ - goto skip; - } - } - } - RCLASS(c)->super = include_class_new(module, RCLASS(c)->super); - c = RCLASS(c)->super; - changed = 1; - skip: - module = RCLASS(module)->super; - } - if (changed) rb_clear_cache(); -} - -VALUE -rb_mod_included_modules(mod) - VALUE mod; -{ - VALUE ary = rb_ary_new(); - VALUE p; - - for (p = RCLASS(mod)->super; p; p = RCLASS(p)->super) { - if (BUILTIN_TYPE(p) == T_ICLASS) { - rb_ary_push(ary, RBASIC(p)->klass); - } - } - return ary; -} - -VALUE -rb_mod_include_p(mod, mod2) - VALUE mod; - VALUE mod2; -{ - 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; -} - -VALUE -rb_mod_ancestors(mod) - VALUE mod; -{ - VALUE ary = rb_ary_new(); - VALUE p; - - for (p = mod; p; p = RCLASS(p)->super) { - if (FL_TEST(p, FL_SINGLETON)) - continue; - if (BUILTIN_TYPE(p) == T_ICLASS) { - rb_ary_push(ary, RBASIC(p)->klass); - } - else { - rb_ary_push(ary, p); - } - } - return ary; -} - -static int -ins_methods_i(key, body, ary) - ID key; - NODE *body; - VALUE ary; -{ - if ((body->nd_noex&(NOEX_PRIVATE|NOEX_PROTECTED)) == 0) { - VALUE name = rb_str_new2(rb_id2name(key)); - - if (!rb_ary_includes(ary, name)) { - if (!body->nd_body) { - rb_ary_push(ary, Qnil); - } - rb_ary_push(ary, name); - } - } - else if (body->nd_body && nd_type(body->nd_body) == NODE_ZSUPER) { - rb_ary_push(ary, Qnil); - rb_ary_push(ary, rb_str_new2(rb_id2name(key))); - } - return ST_CONTINUE; -} - -static int -ins_methods_prot_i(key, body, ary) - ID key; - NODE *body; - VALUE ary; -{ - if (!body->nd_body) { - rb_ary_push(ary, Qnil); - rb_ary_push(ary, rb_str_new2(rb_id2name(key))); - } - else if (body->nd_noex & NOEX_PROTECTED) { - VALUE name = rb_str_new2(rb_id2name(key)); - - if (!rb_ary_includes(ary, name)) { - rb_ary_push(ary, name); - } - } - else if (nd_type(body->nd_body) == NODE_ZSUPER) { - rb_ary_push(ary, Qnil); - rb_ary_push(ary, rb_str_new2(rb_id2name(key))); - } - return ST_CONTINUE; -} - -static int -ins_methods_priv_i(key, body, ary) - ID key; - NODE *body; - VALUE ary; -{ - if (!body->nd_body) { - rb_ary_push(ary, Qnil); - rb_ary_push(ary, rb_str_new2(rb_id2name(key))); - } - else if (body->nd_noex & NOEX_PRIVATE) { - VALUE name = rb_str_new2(rb_id2name(key)); - - if (!rb_ary_includes(ary, name)) { - rb_ary_push(ary, name); - } - } - else if (nd_type(body->nd_body) == NODE_ZSUPER) { - rb_ary_push(ary, Qnil); - rb_ary_push(ary, rb_str_new2(rb_id2name(key))); - } - return ST_CONTINUE; -} - -static VALUE -method_list(mod, option, func) - VALUE mod; - int option; - int (*func)(); -{ - VALUE ary; - VALUE klass; - VALUE *p, *q, *pend; - - ary = rb_ary_new(); - for (klass = mod; klass; klass = RCLASS(klass)->super) { - st_foreach(RCLASS(klass)->m_tbl, func, ary); - if (!option) break; - } - p = q = RARRAY(ary)->ptr; pend = p + RARRAY(ary)->len; - while (p < pend) { - if (*p == Qnil) { - p+=2; - continue; - } - *q++ = *p++; - } - RARRAY(ary)->len = q - RARRAY(ary)->ptr; - return ary; -} - -VALUE -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); -} - -VALUE -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); -} - -VALUE -rb_class_private_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_priv_i); -} - -VALUE -rb_obj_singleton_methods(argc, argv, obj) - int argc; - VALUE *argv; - VALUE obj; -{ - VALUE all; - VALUE ary; - VALUE klass; - VALUE *p, *q, *pend; - - rb_scan_args(argc, argv, "01", &all); - ary = rb_ary_new(); - klass = CLASS_OF(obj); - while (klass && FL_TEST(klass, FL_SINGLETON)) { - st_foreach(RCLASS(klass)->m_tbl, ins_methods_i, ary); - klass = RCLASS(klass)->super; - } - if (RTEST(all)) { - while (klass && TYPE(klass) == T_ICLASS) { - st_foreach(RCLASS(klass)->m_tbl, ins_methods_i, ary); - klass = RCLASS(klass)->super; - } - } - p = q = RARRAY(ary)->ptr; pend = p + RARRAY(ary)->len; - while (p < pend) { - if (*p == Qnil) { - p+=2; - continue; - } - *q++ = *p++; - } - RARRAY(ary)->len = q - RARRAY(ary)->ptr; - - return ary; -} - -void -rb_define_method_id(klass, name, func, argc) - VALUE klass; - ID name; - VALUE (*func)(); - int argc; -{ - rb_add_method(klass, name, NEW_CFUNC(func,argc), NOEX_PUBLIC|NOEX_CFUNC); -} - -void -rb_define_method(klass, name, func, argc) - VALUE klass; - const char *name; - VALUE (*func)(); - int argc; -{ - ID id = rb_intern(name); - - rb_add_method(klass, id, NEW_CFUNC(func, argc), - ((name[0] == 'i' && id == rb_intern("initialize"))? - NOEX_PRIVATE:NOEX_PUBLIC)|NOEX_CFUNC); -} - -void -rb_define_protected_method(klass, name, func, argc) - VALUE klass; - const char *name; - VALUE (*func)(); - int argc; -{ - rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc), - NOEX_PROTECTED|NOEX_CFUNC); -} - -void -rb_define_private_method(klass, name, func, argc) - VALUE klass; - const char *name; - VALUE (*func)(); - int argc; -{ - rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc), - NOEX_PRIVATE|NOEX_CFUNC); -} - -void -rb_undef_method(klass, name) - VALUE klass; - const char *name; -{ - rb_add_method(klass, rb_intern(name), 0, NOEX_UNDEF); -} - -#if 0 - -#define SPECIAL_SINGLETON(x,c) do { - if (obj == (x)) {\ - if (!FL_TEST(c, FL_SINGLETON)) {\ - c = rb_singleton_class_new(c);\ - rb_singleton_class_attached(c,obj);\ - }\ - return c;\ - }\ -} while (0) - -#else - -#define SPECIAL_SINGLETON(x,c) do {\ - if (obj == (x)) {\ - return c;\ - }\ -} while (0) - -#endif - -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)) { - SPECIAL_SINGLETON(Qnil, rb_cNilClass); - SPECIAL_SINGLETON(Qfalse, rb_cFalseClass); - SPECIAL_SINGLETON(Qtrue, rb_cTrueClass); - rb_bug("unknown immediate %ld", obj); - } - - DEFER_INTS; - if (FL_TEST(RBASIC(obj)->klass, FL_SINGLETON) && - ((BUILTIN_TYPE(obj) != T_CLASS && BUILTIN_TYPE(obj) != T_MODULE) || - rb_iv_get(RBASIC(obj)->klass, "__attached__") == obj)) { - klass = RBASIC(obj)->klass; - } - else { - klass = rb_make_metaclass(obj, RBASIC(obj)->klass); - RBASIC(klass)->klass = CLASS_OF(RCLASS(klass)->super); - } - 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; - const char *name; - VALUE (*func)(); - int argc; -{ - rb_define_method(rb_singleton_class(obj), name, func, argc); -} - -void -rb_define_module_function(module, name, func, argc) - VALUE module; - const char *name; - VALUE (*func)(); - int argc; -{ - rb_define_private_method(module, name, func, argc); - rb_define_singleton_method(module, name, func, argc); -} - -void -rb_define_global_function(name, func, argc) - const char *name; - VALUE (*func)(); - int argc; -{ - rb_define_module_function(rb_mKernel, name, func, argc); -} - -void -rb_define_alias(klass, name1, name2) - VALUE klass; - const char *name1, *name2; -{ - rb_alias(klass, rb_intern(name1), rb_intern(name2)); -} - -void -rb_define_attr(klass, name, read, write) - VALUE klass; - const char *name; - int read, write; -{ - rb_attr(klass, rb_intern(name), read, write, Qfalse); -} - -#ifdef HAVE_STDARG_PROTOTYPES -#include -#define va_init_list(a,b) va_start(a,b) -#else -#include -#define va_init_list(a,b) va_start(a) -#endif - -int -#ifdef HAVE_STDARG_PROTOTYPES -rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...) -#else -rb_scan_args(argc, argv, fmt, va_alist) - int argc; - const VALUE *argv; - const char *fmt; - va_dcl -#endif -{ - int n, i = 0; - const char *p = fmt; - VALUE *var; - va_list vargs; - - va_init_list(vargs, fmt); - - if (*p == '*') goto rest_arg; - - if (ISDIGIT(*p)) { - n = *p - '0'; - if (n > argc) - rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", argc, n); - for (i=0; i i) { - if (var) *var = argv[i]; - } - else { - if (var) *var = Qnil; - } - } - p++; - } - - if(*p == '*') { - rest_arg: - var = va_arg(vargs, VALUE*); - if (argc > i) { - if (var) *var = rb_ary_new4(argc-i, argv+i); - i = argc; - } - else { - if (var) *var = rb_ary_new(); - } - p++; - } - - if (*p == '&') { - var = va_arg(vargs, VALUE*); - if (rb_block_given_p()) { - *var = rb_f_lambda(); - } - else { - *var = Qnil; - } - p++; - } - va_end(vargs); - - if (*p != '\0') { - goto error; - } - - if (argc > i) { - rb_raise(rb_eArgError, "wrong number of arguments(%d for %d)", argc, i); - } - - return argc; - - error: - rb_fatal("bad scan arg format: %s", fmt); - return 0; -} diff --git a/compar.c b/compar.c deleted file mode 100644 index ebdd47a8d7..0000000000 --- a/compar.c +++ /dev/null @@ -1,101 +0,0 @@ -/********************************************************************** - - compar.c - - - $Author$ - $Date$ - created at: Thu Aug 26 14:39:48 JST 1993 - - Copyright (C) 1993-2002 Yukihiro Matsumoto - -**********************************************************************/ - -#include "ruby.h" - -VALUE rb_mComparable; - -static ID cmp; - -static VALUE -cmp_equal(x, y) - VALUE x, y; -{ - VALUE c = rb_funcall(x, cmp, 1, y); - - if (NIL_P(c)) return Qfalse; - if (NUM2LONG(c) == 0) return Qtrue; - return Qfalse; -} - -static VALUE -cmp_gt(x, y) - VALUE x, y; -{ - VALUE c = rb_funcall(x, cmp, 1, y); - - if (NIL_P(c)) return Qfalse; - if (NUM2LONG(c) > 0) return Qtrue; - return Qfalse; -} - -static VALUE -cmp_ge(x, y) - VALUE x, y; -{ - VALUE c = rb_funcall(x, cmp, 1, y); - - if (NIL_P(c)) return Qfalse; - if (NUM2LONG(c) >= 0) return Qtrue; - return Qfalse; -} - -static VALUE -cmp_lt(x, y) - VALUE x, y; -{ - VALUE c = rb_funcall(x, cmp, 1, y); - - if (NIL_P(c)) return Qfalse; - if (NUM2LONG(c) < 0) return Qtrue; - return Qfalse; -} - -static VALUE -cmp_le(x, y) - VALUE x, y; -{ - VALUE c = rb_funcall(x, cmp, 1, y); - - if (NIL_P(c)) return Qfalse; - if (NUM2LONG(c) <= 0) return Qtrue; - return Qfalse; -} - -static VALUE -cmp_between(x, min, max) - VALUE x, min, max; -{ - VALUE c = rb_funcall(x, cmp, 1, min); - - if (NIL_P(c)) return Qfalse; - if (NUM2LONG(c) < 0) return Qfalse; - - c = rb_funcall(x, cmp, 1, max); - if (NIL_P(c)) return Qfalse; - if (NUM2LONG(c) > 0) return Qfalse; - return Qtrue; -} - -void -Init_Comparable() -{ - 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 deleted file mode 100644 index acf6a089e5..0000000000 --- a/config.guess +++ /dev/null @@ -1,1391 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. - -timestamp='2001-07-13' - -# 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. - -# Written by Per Bothner . -# Please send patches to . -# -# 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 build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -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 ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000 -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 - - -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int dummy(){}" > $dummy.c - for c in cc gcc c89 ; do - ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 - if test $? = 0 ; then - CC_FOR_BUILD="$c"; break - fi - done - rm -f $dummy.c $dummy.o $dummy.rel - 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 - -# Modified for Human68k by K.Okabe 1997.07.09 -# Last change: 1997.07.09 - -case "$KSH_VERSION" in -*X6*) - echo m68k-sharp-human - exit 0 ;; -*) - ;; -esac - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 8/24/94.) -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_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *: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. - # Determine the machine/vendor (is the vendor relevant). - case "${UNAME_MACHINE}" in - amiga) machine=m68k-unknown ;; - arm32) machine=arm-unknown ;; - atari*) machine=m68k-atari ;; - sun3*) machine=m68k-sun ;; - mac68k) machine=m68k-apple ;; - macppc) machine=powerpc-apple ;; - hp3[0-9][05]) machine=m68k-hp ;; - ibmrt|romp-ibm) machine=romp-ibm ;; - *) machine=${UNAME_MACHINE}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE}" in - i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) - 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 - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - # 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;; - 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 <$dummy.s - .data -\$Lformat: - .byte 37,100,45,37,120,10,0 # "%d-%x\n" - - .text - .globl main - .align 4 - .ent main -main: - .frame \$30,16,\$26,0 - ldgp \$29,0(\$27) - .prologue 1 - .long 0x47e03d80 # implver \$0 - lda \$2,-1 - .long 0x47e20c21 # amask \$2,\$1 - lda \$16,\$Lformat - mov \$0,\$17 - not \$1,\$18 - jsr \$26,printf - ldgp \$29,0(\$26) - mov 0,\$16 - jsr \$26,exit - .end main -EOF - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - case `./$dummy` in - 0-0) - UNAME_MACHINE="alpha" - ;; - 1-0) - UNAME_MACHINE="alphaev5" - ;; - 1-1) - UNAME_MACHINE="alphaev56" - ;; - 1-101) - UNAME_MACHINE="alphapca56" - ;; - 2-303) - UNAME_MACHINE="alphaev6" - ;; - 2-307) - UNAME_MACHINE="alphaev67" - ;; - esac - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - 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 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - 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} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit 0 ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit 0;; - 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 - else - echo pyramid-pyramid-bsd - fi - exit 0 ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit 0 ;; - 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 ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; - sun3*:SunOS:*:*) - 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` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit 0 ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; - atari*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - # 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 ;; - 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 ;; - 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} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; - macppc:NetBSD:*:*) - echo powerpc-apple-netbsd${UNAME_RELEASE} - exit 0 ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit 0 ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* 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); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD $dummy.c -o $dummy \ - && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit 0 ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit 0 ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit 0 ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit 0 ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit 0 ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - 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 - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit 0 ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit 0 ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit 0 ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit 0 ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit 0 ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; - ????????: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:*:*) - 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 - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo rs6000-ibm-aix3.2.5 - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit 0 ;; - *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | 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 - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit 0 ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit 0 ;; - 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:*:*) - echo rs6000-bull-bosx - exit 0 ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit 0 ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit 0 ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit 0 ;; - 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/[678][0-9][0-9]) - case "${HPUX_REV}" in - 11.[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" ;; - esac ;; - esac - fi ;; - esac - if [ "${HP_ARCH}" = "" ]; then - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - 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 $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` - if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi - rm -f $dummy.c $dummy - fi ;; - esac - 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 - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo unknown-hitachi-hiuxwe2 - exit 0 ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit 0 ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit 0 ;; - *9??*: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:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit 0 ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit 0 ;; - hppa*:OpenBSD:*:*) - echo hppa-unknown-openbsd - exit 0 ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit 0 ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit 0 ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit 0 ;; - 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} - 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/ - exit 0 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3D:*:*:*) - echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - 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 ;; - CRAY-2:*:*:*) - echo cray2-cray-unicos - 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 "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:FreeBSD:*:*) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - 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 i386-pc-interix - exit 0 ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit 0 ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - *:GNU:*:*) - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux - exit 0 ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux - exit 0 ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux - exit 0 ;; - mips:Linux:*:*) - cat >$dummy.c < /* for printf() prototype */ -int main (int argc, char *argv[]) { -#else -int main (argc, argv) int argc; char *argv[]; { -#endif -#ifdef __MIPSEB__ - printf ("%s-unknown-linux\n", argv[1]); -#endif -#ifdef __MIPSEL__ - printf ("%sel-unknown-linux\n", argv[1]); -#endif - return 0; -} -EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - ;; - ppc:Linux:*:*) - # Determine Lib Version - cat >$dummy.c < -#if defined(__GLIBC__) -extern char __libc_version[]; -extern char __libc_release[]; -#endif -main(argc, argv) - int argc; - char *argv[]; -{ -#if defined(__GLIBC__) - printf("%s %s\n", __libc_version, __libc_release); -#else - printf("unknown\n"); -#endif - return 0; -} -EOF - LIBC="" - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy | grep 1\.99 > /dev/null - if test "$?" = 0 ; then LIBC="libc1" ; fi - fi - rm -f $dummy.c $dummy - echo powerpc-unknown-linux-${LIBC} - exit 0 ;; - alpha:Linux:*:*) - cat <$dummy.s - .data - \$Lformat: - .byte 37,100,45,37,120,10,0 # "%d-%x\n" - .text - .globl main - .align 4 - .ent main - main: - .frame \$30,16,\$26,0 - ldgp \$29,0(\$27) - .prologue 1 - .long 0x47e03d80 # implver \$0 - lda \$2,-1 - .long 0x47e20c21 # amask \$2,\$1 - lda \$16,\$Lformat - mov \$0,\$17 - not \$1,\$18 - jsr \$26,printf - ldgp \$29,0(\$26) - mov 0,\$16 - jsr \$26,exit - .end main -EOF - LIBC="" - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - case `./$dummy` in - 0-0) UNAME_MACHINE="alpha" ;; - 1-0) UNAME_MACHINE="alphaev5" ;; - 1-1) UNAME_MACHINE="alphaev56" ;; - 1-101) UNAME_MACHINE="alphapca56" ;; - 2-303) UNAME_MACHINE="alphaev6" ;; - 2-307) UNAME_MACHINE="alphaev67" ;; - 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 ;; - 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 ;; - PA8*) echo hppa2.0-unknown-linux ;; - *) echo hppa-unknown-linux ;; - esac - exit 0 ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux - exit 0 ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux - exit 0 ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux - exit 0 ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux - exit 0 ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # 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. - ld_supported_emulations=`cd /; ld --help 2>&1 \ - | sed -ne '/supported emulations:/!d - s/[ ][ ]*/ /g - s/.*supported emulations: *// - s/ .*// - p'` - case "$ld_supported_emulations" in - i*86linux) - echo "${UNAME_MACHINE}-pc-linux-aout" - exit 0 - ;; - elf_i*86) - TENTATIVE="${UNAME_MACHINE}-pc-linux" - ;; - i*86coff) - echo "${UNAME_MACHINE}-pc-linux-coff" - exit 0 - ;; - esac - # Either a pre-BFD a.out linker (linux-oldld) - # or one that does not give us useful --help. - # GCC wants to distinguish between linux-oldld and linux-aout. - # If ld does not provide *any* "supported emulations:" - # that means it is gnuoldld. - test -z "$ld_supported_emulations" && echo "${UNAME_MACHINE}-pc-linux-oldld" && exit 0 - case "${UNAME_MACHINE}" in - i*86) - VENDOR=pc; - ;; - *) - VENDOR=unknown; - ;; - esac - # Determine whether the default compiler is a.out or elf - cat >$dummy.c < -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif -#ifdef __ELF__ -# ifdef __GLIBC__ -# if __GLIBC__ >= 2 - printf ("%s-${VENDOR}-linux\n", argv[1]); -# else - printf ("%s-${VENDOR}-linux-libc1\n", argv[1]); -# endif -# else - printf ("%s-${VENDOR}-linux-libc1\n", argv[1]); -# endif -#else - printf ("%s-${VENDOR}-linux-aout\n", argv[1]); -#endif - return 0; -} -EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 - ;; -# 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*:*) - echo i386-sequent-sysv4 - exit 0 ;; - 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, - # I just have to hope. -- rms. - # 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.*:*) - 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_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit 0 ;; - i*86:*:5:7*) - # Fixed at (any) Pentium or better - UNAME_MACHINE=i586 - if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then - echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} - fi - exit 0 ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /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_MACHINE=i586 - (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit 0 ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - 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 - exit 0 ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit 0 ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit 0 ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit 0 ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; - 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: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.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - 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 ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit 0 ;; - PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit 0 ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit 0 ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit 0 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - 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 ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit 0 ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit 0 ;; - 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 ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Darwin:*:*) - echo `uname -p`-apple-darwin${UNAME_RELEASE} - exit 0 ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - if test "${UNAME_MACHINE}" = "x86pc"; then - UNAME_MACHINE=pc - fi - echo `uname -p`-${UNAME_MACHINE}-nto-qnx - exit 0 ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit 0 ;; - NSR-[KW]: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 ;; - 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 ;; - *: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 ;; -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 < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -#if !defined (ultrix) -# include -# 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) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 -rm -f $dummy.c $dummy - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit 0 ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - c34*) - echo c34-convex-bsd - exit 0 ;; - c38*) - echo c38-convex-bsd - exit 0 ;; - c4*) - echo c4-convex-bsd - exit 0 ;; - esac -fi - -cat >&2 < 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 deleted file mode 100644 index 914903cfed..0000000000 --- a/config.sub +++ /dev/null @@ -1,1370 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. - -timestamp='2001-04-20' - -# 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. -# -# 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. - -# Please send patches to . -# -# 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. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -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 ." - -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 - nto-qnx* | linux-gnu* | linux-libc1 | storm-chaos* | os2-emx*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -hiuxmpp) - os=-hiuxmpp - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - 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/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -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 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ - | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ - | pyramid | mn10200 | mn10300 | tron | a29k \ - | 580 | i960 | h8300 \ - | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ - | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ - | hppa64 \ - | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ - | alphaev6[78] \ - | we32k | ns16k | clipper | i370 | sh | sh[34] \ - | powerpc | powerpcle \ - | 1750a | dsp16xx | pdp10 | pdp11 \ - | mips16 | mips64 | mipsel | mips64el \ - | mips64orion | mips64orionel | mipstx39 | mipstx39el \ - | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ - | mips64vr5000 | miprs64vr5000el | mcore | s390 | s390x \ - | sparc | sparclet | sparclite | sparc64 | sparcv9 | sparcv9b \ - | v850 | c4x \ - | thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \ - | pj | pjl | h8500) - 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 | z8k | v70 | w65) - ;; - - # 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*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # 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. - # FIXME: clean up the formatting here. - vax-* | tahoe-* | i*86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ - | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ - | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ - | xmp-* | ymp-* \ - | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ - | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ - | hppa2.0n-* | hppa64-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ - | alphaev6[78]-* \ - | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ - | clipper-* | orion-* \ - | sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ - | sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \ - | mips16-* | mips64-* | mipsel-* \ - | mips64el-* | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ - | mipstx39-* | mipstx39el-* | mcore-* \ - | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ - | [cjt]90-* \ - | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ - | thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \ - | bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*) - ;; - # 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 - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - 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 - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | ymp) - basic_machine=ymp-cray - os=-unicos - ;; - cray2) - basic_machine=cray2-cray - os=-unicos - ;; - [cjt]90) - basic_machine=${basic_machine}-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 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - 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 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - 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 - ;; - 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]) - basic_machine=hppa1.0-hp - ;; - 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 - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - 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 - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mipsel*-linux*) - basic_machine=mipsel-unknown - os=-linux - ;; - mips*-linux*) - basic_machine=mips-unknown - os=-linux - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - 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 - ;; - 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 - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - 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 - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pentium | p5 | k5 | k6 | nexgen) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon) - basic_machine=i686-pc - ;; - pentiumii | pentium2) - basic_machine=i686-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - 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/^[^-]*-//'` - ;; - 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 - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sparclite-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=t3e-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xmp) - basic_machine=xmp-cray - os=-unicos - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# 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. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - mips) - if [ x$os = x-linux ]; then - basic_machine=mips-unknown - else - basic_machine=mips-mips - fi - ;; - romp) - basic_machine=romp-ibm - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - 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 - ;; - sh3 | sh4) - basic_machine=sh-unknown - ;; - sparc | sparcv9 | sparcv9b) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - c4x*) - basic_machine=c4x-none - os=-coff - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -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* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto*) - os=-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|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -uxpds) - os=-uxpds - ;; - -human) - ;; - -beos) - os=-beos - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - *-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 - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -vxsim* | -vxworks*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - 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/configure.in b/configure.in deleted file mode 100644 index 7ce581d79e..0000000000 --- a/configure.in +++ /dev/null @@ -1,1165 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -AC_INIT() - -AC_PREREQ(2.50) - -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], [ - case $withval in - no) : ${CC=cc} - ;; - yes) : ${CC=gcc} - ;; - *) CC=$withval - ;; - 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_MSG_ERROR(cached CC is different -- throw away $cache_file -(it is also a good idea to do 'make clean' before compiling)) -fi - -AC_CANONICAL_TARGET - -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) - - case "$target_os" in - rhapsody*) - echo -n "MacOS X Server: " - if test "$TARGET_ARCHS" = "" ; then - TARGET_ARCHS="ppc i386" - fi - ;; - nextstep*|openstep*) - echo -n "NeXTSTEP/OPENSTEP: " - if test "$TARGET_ARCHS" = "" ; then - if test `/usr/bin/arch` = "m68k" ; then - TARGET_ARCHS="m68k i486" - else # Black and Native one - TARGET_ARCHS="m68k `/usr/bin/arch`" - fi - fi - # to ensure AC_HEADER_SYS_WAIT works - AC_DEFINE(_POSIX_SOURCE) - ;; - macos*|darwin*) - echo -n "MacOS X (Darwin): " - if test "$TARGET_ARCHS" = "" ; then - TARGET_ARCHS="ppc i386" - fi - ;; - esac - # /usr/lib/arch_tool -archify_list $TARGET_ARCHS - for archs in $TARGET_ARCHS - do - ARCH_FLAG="$ARCH_FLAG -arch $archs " - echo -n " $archs" - done - AC_DEFINE(NEXT_FAT_BINARY) - echo "." -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 - -AC_PROG_YACC -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(AR, ar) -AC_CHECK_PROGS(AR, ar aal, ar) - -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} - ;; -esac - -# by TOYODA Eizi -case "$target_os" in -hiuxmpp*) - 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 - -dnl check for large file stuff -AC_SYS_LARGEFILE - -AC_CHECK_TYPES([long long, off_t]) - -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_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)]) -if test "$rb_cv_have_prototypes" = yes; then - AC_DEFINE(HAVE_PROTOTYPES) -fi - -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 -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; -} -], [return foo(10, "", 3.14);], - rb_cv_stdarg=yes, - rb_cv_stdarg=no)]) -if test "$rb_cv_stdarg" = yes; then - AC_DEFINE(HAVE_STDARG_PROTOTYPES) -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 ]) - -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]) - -dnl Checks for libraries. -case "$target_os" in -nextstep*) ;; -openstep*) ;; -rhapsody*) ;; -darwin*) LIBS="-lobjc $LIBS";; -human*) ac_cv_func_getpgrp_void=yes;; -beos*) ;; -cygwin*) rb_cv_have_daylight=no - ac_cv_var_tzname=no;; -mingw*) LIBS="-lwsock32 -lmsvcrt $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_vsnprintf=yes - ac_cv_func_seekdir=yes - ac_cv_func_telldir=yes - ;; -os2_emx*) LIBS="-lm $LIBS" - ac_cv_lib_dir_opendir=no;; -msdosdjgpp*) LIBS="-lm $LIBS" - ac_cv_func_getpgrp_void=yes;; -freebsd*) LIBS="-lm $LIBS" - AC_CACHE_CHECK([whether -lxpg4 has to be linked], - rb_cv_lib_xpg4_needed, - [AC_TRY_CPP([ -#include -#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 -#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" - else - MAINLIBS="-pthread $MAINLIBS" - CFLAGS="-D_THREAD_SAFE $CFLAGS" - fi - fi - ;; -linux*) LIBS="-lm $LIBS" - case "$target_cpu" in - alpha*) - CFLAGS="-mieee $CFLAGS" ;; - esac ;; -osf*) LIBS="-lm $LIBS" - case "$target_cpu"::"$GCC" in - alpha*::yes) - CFLAGS="-mieee $CFLAGS" ;; - alpha*::no|alpha*::) - CFLAGS="-ieee $CFLAGS" ;; - esac ;; -*) 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 - -dnl Checks for header files. -AC_HEADER_DIRENT -AC_HEADER_STDC -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 a.out.h utime.h memory.h direct.h sys/resource.h \ - sys/mkdev.h) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_TYPE_UID_T -AC_TYPE_SIZE_T -AC_STRUCT_ST_BLKSIZE -AC_STRUCT_ST_BLOCKS -AC_STRUCT_ST_RDEV - -dnl Checks for library functions. -AC_TYPE_GETGROUPS -AC_TYPE_SIGNAL -AC_FUNC_ALLOCA -AC_FUNC_MEMCMP -AC_FUNC_FSEEKO -AC_CHECK_FUNCS(ftello) -AC_REPLACE_FUNCS(dup2 memmove mkdir strcasecmp strncasecmp strerror strftime\ - strchr strstr strtoul crypt flock vsnprintf\ - isinf isnan finite hypot acosh) -AC_CHECK_FUNCS(fmod killpg drand48 random wait4 waitpid syscall chroot fsync\ - truncate chsize times utimes fcntl lockf lstat symlink readlink\ - setitimer setruid seteuid setreuid setresuid setproctitle\ - setrgid setegid setregid setresgid pause lchown lchmod\ - getpgrp setpgrp getpgid setpgid getgroups getpriority getrlimit\ - dlopen sigprocmask sigaction _setjmp setsid telldir seekdir fchmod\ - mktime timegm cosh sinh tanh initstate) -AC_STRUCT_TIMEZONE -AC_CACHE_CHECK(for struct tm.tm_gmtoff, rb_cv_member_struct_tm_tm_gmtoff, - [AC_TRY_COMPILE([#include ], - [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 - 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 - -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_CACHE_CHECK(for BSD signal semantics, rb_cv_bsd_signal, - [AC_TRY_RUN([ -#include -#include - -void -sig_handler(dummy) - int dummy; -{ -} - -int -main() -{ - signal(SIGINT, sig_handler); - kill(getpid(), SIGINT); - kill(getpid(), SIGINT); - return 0; -} -], - rb_cv_bsd_signal=yes, - rb_cv_bsd_signal=no, - rb_cv_bsd_signal=no)]) - if test "$rb_cv_bsd_signal" = yes; then - AC_DEFINE(BSD_SIGNAL) - fi -fi - -AC_FUNC_GETPGRP -AC_FUNC_SETPGRP - -AC_CACHE_CHECK(for working strtod, rb_cv_func_strtod, -[AC_TRY_RUN([ -double strtod (); -int -main() -{ - { - /* Some versions of Linux strtod mis-parse strings with leading '+'. */ - char *string = " +69"; - char *term; - double value; - value = strtod(string, &term); - if (value != 69 || term != (string + 4)) - exit(1); - } - - { - /* Under Solaris 2.4, strtod returns the wrong value for the - terminating character under some conditions. */ - char *string = "NaN"; - char *term; - strtod(string, &term); - if (term != string && *(term - 1) == 0) - exit(1); - } - exit(0); -} -], rb_cv_func_strtod=yes, rb_cv_func_strtod=no, rb_cv_func_strtod=no)]) -test $rb_cv_func_strtod = no && AC_LIBOBJ([strtod]) - -AC_C_BIGENDIAN -AC_C_CONST -AC_C_CHAR_UNSIGNED -AC_C_INLINE - -AC_CACHE_CHECK(whether right shift preserve sign bit, rb_cv_rshift_sign, - [AC_TRY_RUN([ -int -main() -{ - if (-1==(-1>>1)) - return 0; - return 1; -} -], - rb_cv_rshift_sign=yes, - rb_cv_rshift_sign=no, - rb_cv_rshift_sign=yes)]) -if test "$rb_cv_rshift_sign" = yes; then - AC_DEFINE(RSHIFT(x,y), ((x)>>(int)y)) -else - AC_DEFINE(RSHIFT(x,y), (((x)<0) ? ~((~(x))>>y) : (x)>>y)) -fi - -AC_MSG_CHECKING(read count field in FILE structures) -AC_CACHE_VAL(rb_cv_fcnt, -[for fcnt in dnl - _cnt dnl - __cnt dnl - _r dnl - readCount dnl - _rcount dnl for emx0.9c -; do - AC_TRY_COMPILE([#include -], - [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 - AC_MSG_RESULT($rb_cv_fcnt) - AC_DEFINE_UNQUOTED(FILE_COUNT, $rb_cv_fcnt) -fi - -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 -], - [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 - ], - [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 - -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]) - -AC_SUBST(XLDFLAGS)dnl - -AC_CACHE_CHECK(whether ELF binaries are produced, rb_cv_binary_elf, -[AC_TRY_RUN([ -/* Test for whether ELF binaries are produced */ -#include -#include -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) */ -} -], -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*) - if test "$rb_cv_binary_elf" = no; then - with_dln_a_out=yes - target_os=${target_os}-a_out - else - LDFLAGS="-rdynamic" - fi;; -netbsd*) - if [[ "`$CC -dM -E - &1 | grep "GNU ld" > /dev/null; then - LDFLAGS="-Wl,-E" - LDSHARED="$LDSHARED -shared" - fi - else - LDSHARED='ld -G' - fi - rb_cv_dlopen=yes;; - sunos*) LDSHARED='ld -assert nodefinitions' - rb_cv_dlopen=yes;; - irix*) LDSHARED='ld -shared' - rb_cv_dlopen=yes;; - sysv4*) LDSHARED='ld -G' - rb_cv_dlopen=yes;; - nto-qnx*) LDSHARED="qcc -shared" - rb_cv_dlopen=yes ;; - esix*|uxpds*) LDSHARED="ld -G" - rb_cv_dlopen=yes ;; - osf*) LDSHARED="$CC -shared" - rb_cv_dlopen=yes ;; - linux*) LDSHARED="$CC -shared" - rb_cv_dlopen=yes ;; - gnu*) LDSHARED="$CC -shared" - rb_cv_dlopen=yes - LDFLAGS="-rdynamic" ;; - freebsd*) LDSHARED="$CC -shared" - if test "$rb_cv_binary_elf" = yes; then - LDFLAGS="-rdynamic" - DLDFLAGS='-Wl,-soname,$(.TARGET)' - else - test "$GCC" = yes && `$CC --print-prog-name=ld` -v 2>&1 | grep "GNU ld" > /dev/null || LDSHARED="ld -Bshareable" - fi - rb_cv_dlopen=yes ;; - netbsd*) LDSHARED='${CC} -shared' - if test "$rb_cv_binary_elf" = yes; then - LDFLAGS="-Wl,-export-dynamic" - fi - rb_cv_dlopen=yes ;; - openbsd*) LDSHARED="ld -Bforcearchive -Bshareable" - rb_cv_dlopen=yes ;; - bsdi3*) case "$CC" in - *shlicc*) LDSHARED="$CC -r" - rb_cv_dlopen=yes ;; - esac ;; - bsdi*) LDSHARED="ld -shared" - LDFLAGS='-rdynamic -Wl,-rpath,$(prefix)/lib/ruby/$(MAJOR).$(MINOR)/i386-bsdi4.0' - rb_cv_dlopen=yes ;; - nextstep*) LDSHARED='cc -r -nostdlib' - 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 ;; - darwin*) LDSHARED='cc -dynamic -bundle -undefined suppress -flat_namespace' - LDFLAGS="" - DLDFLAGS="$ARCH_FLAG" - rb_cv_dlopen=yes ;; - aix*) LDSHARED='/usr/ccs/bin/ld' - XLDFLAGS='-Wl,-bE:ruby.imp' - DLDFLAGS='-brtl -eInit_$(TARGET) -bI:$(topdir)/ruby.imp -bM:SRE -T512 -H512 -lc' - LDFLAGS="-brtl" - rb_cv_dlopen=yes ;; - - human*) DLDFLAGS='' - LDSHARED='' - LDFLAGS='' - rb_cv_dlopen=yes ;; - beos*) case "$target_cpu" in - powerpc*) - LDSHARED="ld -xms" - DLDFLAGS='-export Init_$(TARGET) -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o' - ;; - i586*) - LDSHARED="ld -shared" - DLDFLAGS="-L/boot/develop/lib/x86 -lbe -lroot" - ;; - esac - rb_cv_dlopen=yes ;; - nto-qnx*) DLDFLAGS="-L/lib -L/usr/lib -L/usr/local/lib" - LDSHARED='ld -Bshareable -x' - LDFLAGS="-L/lib -L/usr/lib -L/usr/local/lib" - rb_cv_dlopen=yes;; - cygwin*|mingw*) : ${LDSHARED="${CC} -shared -s"} - LDFLAGS='-Wl,--stack,0x02000000' - rb_cv_dlopen=yes ;; - hiuxmpp) LDSHARED='ld -r' ;; - *) LDSHARED='ld' ;; - esac - AC_MSG_RESULT($rb_cv_dlopen) -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 - cat confdefs.h > config.h - AC_CACHE_CHECK(whether matz's dln works, rb_cv_dln_a_out, - [AC_TRY_COMPILE([ -#define USE_DLN_A_OUT -#include "dln.c" -], - [], - rb_cv_dln_a_out=yes, - rb_cv_dln_a_out=no)]) - if test "$rb_cv_dln_a_out" = yes; then - dln_a_out_works=yes - AC_DEFINE(USE_DLN_A_OUT) - fi - fi -fi - -if test "$dln_a_out_works" = yes; then - if test "$GCC" = yes; then - STATIC=-static - else - STATIC=-Bstatic - fi - DLEXT=so - AC_DEFINE(DLEXT, ".so") - CCDLFLAGS= -else - case "$target_os" in - hpux*) DLEXT=sl - AC_DEFINE(DLEXT, ".sl");; - nextstep*) DLEXT=bundle - AC_DEFINE(DLEXT, ".bundle");; - openstep*) DLEXT=bundle - AC_DEFINE(DLEXT, ".bundle");; - rhapsody*) DLEXT=bundle - AC_DEFINE(DLEXT, ".bundle");; - 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 -fi - -AC_SUBST(STRIP)dnl -if test "$with_dln_a_out" = yes; then - STRIP=true -else - STRIP=strip -fi - -case "$target_os" in - linux*) - STRIP='strip -S -x';; - gnu*) - STRIP='strip -S -x';; - nextstep*) - STRIP='strip -A -n';; - openstep*) - 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], - [case $withval in - yes) STATIC= - EXTSTATIC=static;; - *) ;; - esac]) - -case "$target_os" in - human*) - AC_CHECK_LIB(signal, _harderr) - AC_CHECK_LIB(hmem, hmemset) - 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 -<< -#include -main () -{ - char buf[256]; - sprintf (buf, "%g", 1e+300); - exit (strcmp (buf, "1e+300") ? 0 : 1); -} ->>, -changequote([, ])dnl -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_CACHE_CHECK(whether PD libc fconvert fail to round, - rb_cv_missing_fconvert, - [AC_TRY_RUN( -changequote(<<, >>)dnl -<< -#include -#include -main () -{ - char buf[256]; - sprintf (buf, "%f", log(exp(1.0))); - exit (strcmp (buf, "1.000000") ? 0 : 1); -} ->>, -changequote([, ])dnl -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 - AC_LIBOBJ([x68.o]) - CFLAGS="$CFLAGS -fansi-only -cc1-stack=262144 -cpp-stack=2694144" - EXEEXT=.x - OBJEXT=o - setup=Setup.x68 - ;; - dnl OS/2 environment w/ Autoconf 2.1x for EMX - os2_emx) - AC_LIBOBJ([os2]) - setup=Setup.emx - ;; - *djgpp*) - setup=Setup.dj - ;; - *) - setup=Setup - ;; -esac - -AC_SUBST(setup) - -if test "$prefix" = NONE; then - prefix=$ac_default_prefix -fi - -if test "$fat_binary" = yes ; then - CFLAGS="$CFLAGS $ARCH_FLAG" -fi - -if test x"$cross_compiling" = xyes; then - MINIRUBY="ruby -I`pwd` -rfake" - PREP=fake.rb -else - MINIRUBY='./miniruby$(EXEEXT)' - PREP='' -fi -AC_SUBST(MINIRUBY) -AC_SUBST(PREP) - -FIRSTMAKEFILE="" -LIBRUBY_A='lib$(RUBY_INSTALL_NAME).a' -LIBRUBY='$(LIBRUBY_A)' -LIBRUBYARG='$(LIBRUBY_A)' -SOLIBS= - -case "$target_os" in - cygwin*|mingw*|beos*|openstep*|nextstep*|rhapsody*|darwin*|os2_emx*) - DLDLIBS="" - ;; - *) - DLDLIBS="-lc" - ;; -esac - -LIBRUBY_LDSHARED=$LDSHARED -LIBRUBY_DLDFLAGS=$DLDFLAGS -LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR).$(TEENY)' -LIBRUBY_ALIASES='lib$(RUBY_INSTALL_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='-L. -l$(RUBY_INSTALL_NAME)' - 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_INSTALL_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_INSTALL_NAME).so' - ;; - linux*) - LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR)' - LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_INSTALL_NAME).so' - ;; - gnu*) - LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR)' - LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_INSTALL_NAME).so' - ;; - freebsd*) - SOLIBS='$(LIBS)' - LIBRUBY_SO='lib$(RUBY_INSTALL_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_INSTALL_NAME).so.$(MAJOR)$(MINOR).$(TEENY)' - LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_INSTALL_NAME).so.$(MAJOR)$(MINOR)' - LIBRUBYARG='-Wl,-R -Wl,${prefix}/lib -L${prefix}/lib -L. -l$(RUBY_INSTALL_NAME)' - if test "$rb_cv_binary_elf" = yes; then # ELF platforms - LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR)$(MINOR) lib$(RUBY_INSTALL_NAME).so' - else # a.out platforms - LIBRUBY_ALIASES="" - fi - ;; - openbsd*) - SOLIBS='$(LIBS)' - ;; - solaris*) - XLDFLAGS='-R${prefix}/lib' - ;; - hpux*) - XLDFLAGS='-Wl,+s,+b,$(prefix)/lib' - LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).sl.$(MAJOR).$(MINOR).$(TEENY)' - LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).sl.$(MAJOR).$(MINOR) lib$(RUBY_INSTALL_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='-L${prefix}/lib -Wl,lib$(RUBY_INSTALL_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_INSTALL_NAME).$(MAJOR).$(MINOR).$(TEENY).dylib' - LIBRUBY_LDSHARED='cc -dynamiclib -undefined suppress -flat_namespace' - LIBRUBY_DLDFLAGS='-install_name $(prefix)/lib/lib$(RUBY_INSTALL_NAME).dylib -current_version $(MAJOR).$(MINOR).$(TEENY) -compatibility_version $(MAJOR).$(MINOR)' - LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).$(MAJOR).$(MINOR).dylib lib$(RUBY_INSTALL_NAME).dylib' - ;; - *) - ;; - esac -fi - -case "$target_os" in - netbsd*) - CFLAGS="$CFLAGS -pipe" - ;; - nextstep*) - CFLAGS="$CFLAGS -pipe" - ;; - openstep*) - CFLAGS="$CFLAGS -pipe" - ;; - rhapsody*) - CFLAGS="$CFLAGS -pipe -no-precomp" - ;; - darwin*) - CFLAGS="$CFLAGS -pipe -no-precomp" - ;; - os2_emx) - CFLAGS="$CFLAGS -DOS2" - ;; - 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 - ;; - beos*) - case "$target_cpu" in - powerpc*) - CFLAGS="$CFLAGS -relax_pointers" - ;; - esac - ;; - cygwin*|mingw*) - RUBY_SO_NAME=$target_os-'$(RUBY_INSTALL_NAME)'${MAJOR}${MINOR} - if test x"$enable_shared" = xyes; then - LIBRUBY_SO='$(RUBY_SO_NAME)'.dll - LIBRUBY_DLDFLAGS='-Wl,--out-implib=$(LIBRUBY) $(RUBYDEF)' - LIBRUBY='lib$(LIBRUBY_SO).a' - else - LIBRUBY_SO=dummy - LIBRUBY_DLDFLAGS='' - LIBRUBY='lib$(RUBY_SO_NAME).a' - fi - LIBRUBY_ALIASES='' - LIBRUBY_A='lib$(RUBY_INSTALL_NAME)s.a' - LIBRUBYARG='-L. -l$(RUBY_SO_NAME)' - FIRSTMAKEFILE=GNUmakefile:cygwin/GNUmakefile.in - SOLIBS='$(LIBS)' - case "$target_os" in - cygwin*) - AC_LIBOBJ([strftime]) - CCDLFLAGS=-DUSEIMPORTLIB ;; - mingw*) - AC_LIBOBJ([win32]) - CFLAGS="-DNT -D__NO_ISOCEXT $CFLAGS" - CCDLFLAGS=-DIMPORT ;; - esac - ;; - *) - ;; -esac - -AC_SUBST(LIBRUBY_LDSHARED) -AC_SUBST(LIBRUBY_DLDFLAGS) -AC_SUBST(RUBY_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(SOLIBS) -AC_SUBST(DLDLIBS) -AC_SUBST(ENABLE_SHARED) -AC_SUBST(MAINLIBS) - -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}" -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(sitedir)dnl - -configure_args=$ac_configure_args -AC_SUBST(configure_args)dnl - -if test "$fat_binary" = yes ; then - arch="fat-${target_os}" - - AC_DEFINE_UNQUOTED(RUBY_THIN_ARCHLIB, - "${RUBY_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}") - - AC_DEFINE_UNQUOTED(RUBY_SITE_THIN_ARCHLIB, - "${RUBY_SITE_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}") - AC_DEFINE_UNQUOTED(RUBY_PLATFORM, __ARCHITECTURE__ "-${target_os}") -else - arch="${target_cpu}-${target_os}" - AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "${arch}") -fi - -AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, "${RUBY_LIB_PATH}/${arch}") -AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${RUBY_SITE_LIB_PATH2}/${arch}") - -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 - -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_CONFIG_FILES([$FIRSTMAKEFILE Makefile ext/extmk.rb]) -AC_OUTPUT diff --git a/cygwin/GNUmakefile.in b/cygwin/GNUmakefile.in deleted file mode 100644 index 3fd5b5ad53..0000000000 --- a/cygwin/GNUmakefile.in +++ /dev/null @@ -1,48 +0,0 @@ -include Makefile - -ENABLE_SHARED=@ENABLE_SHARED@ - -ifeq ($(ENABLE_SHARED),yes) - CPPFLAGS += -DLIBRUBY_SO=\"$(LIBRUBY_SO)\" -else - RUBY_EXP = $(RUBY_INSTALL_NAME).exp - EXTOBJS = $(RUBY_EXP) - LIBRUBYARG = $(LIBRUBY_A) -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) -RUBYDEF = $(RUBY_INSTALL_NAME).def -SOLIBS := $(LIBRUBY_SO).res.@OBJEXT@ $(SOLIBS) -EXTOBJS += $(@:$(EXEEXT)=.res.@OBJEXT@) - -$(LIBRUBY_SO): $(RUBYDEF) $(LIBRUBY_SO).res.@OBJEXT@ $(RUBY_EXP) -$(LIBRUBY): $(LIBRUBY_SO) - -%.res.@OBJEXT@: %.rc - @WINDRES@ --include-dir . --include-dir $( $(RUBYDEF) - @NM@ --extern-only --defined-only $(LIBRUBY_A) | \ - @MINIRUBY@ -ne 'puts $$1 if / [CDT] _(.*)$$/' >> $(RUBYDEF) -$(RUBY_EXP): $(RUBYDEF) - @DLLWRAP@ --output-exp=$(RUBY_EXP) --output-lib=$(LIBRUBY) \ - --def=$(RUBYDEF) $(LIBRUBY_A) $(LIBS) -o $(PROGRAM) - rm $(PROGRAM) diff --git a/defines.h b/defines.h deleted file mode 100644 index b4a1894d71..0000000000 --- a/defines.h +++ /dev/null @@ -1,161 +0,0 @@ -/************************************************ - - defines.h - - - $Author$ - $Date$ - created at: Wed May 18 00:21:44 JST 1994 - -************************************************/ -#ifndef DEFINES_H -#define DEFINES_H - -#define RUBY - -#if !defined(__STDC__) && !defined(_MSC_VER) -# define volatile -#endif - -#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 -#else -# define BDIGIT unsigned short -# define SIZEOF_BDIGITS SIZEOF_SHORT -# define BDIGIT_DBL unsigned long -# define BDIGIT_DBL_SIGNED long -#endif - -/* define RUBY_USE_EUC/SJIS for default kanji-code */ -#ifndef DEFAULT_KCODE -#if defined(MSDOS) || defined(__CYGWIN__) || defined(__human68k__) || defined(__MACOS__) || defined(__EMX__) || defined(OS2) || defined(NT) -#define DEFAULT_KCODE KCODE_SJIS -#else -#define DEFAULT_KCODE KCODE_EUC -#endif -#endif - -#ifdef NeXT -#define DYNAMIC_ENDIAN /* determine endian at runtime */ -#ifndef __APPLE__ -#define S_IXUSR _S_IXUSR /* execute/search permission, owner */ -#endif -#define S_IXGRP 0000010 /* execute/search permission, group */ -#define S_IXOTH 0000001 /* execute/search permission, other */ - -#define HAVE_SYS_WAIT_H /* configure fails to find this */ -#endif /* NeXT */ - -#ifdef NT -#include "win32/win32.h" -#endif - -#if defined(__VMS) -#include "vms/vms.h" -#endif - -#if defined __CYGWIN__ -# undef EXTERN -# if defined USEIMPORTLIB -# define EXTERN extern __declspec(dllimport) -# else -# define EXTERN extern __declspec(dllexport) -# endif -#endif - -#ifndef EXTERN -#define EXTERN extern -#endif - -#if defined(sparc) || defined(__sparc__) -# if defined(linux) || defined(__linux__) -#define FLUSH_REGISTER_WINDOWS asm("ta 0x83") -# else /* Solaris, not sparc linux */ -#define FLUSH_REGISTER_WINDOWS asm("ta 0x03") -# endif /* trap always to flush register windows if we are on a Sparc system */ -#else /* Not a sparc, so */ -#define FLUSH_REGISTER_WINDOWS /* empty -- nothing to do here */ -#endif - -#if defined(MSDOS) || defined(_WIN32) || defined(__human68k__) || defined(__EMX__) -#define DOSISH 1 -#endif - -#if defined(MSDOS) || defined(NT) || defined(__human68k__) || defined(OS2) -#define PATH_SEP ";" -#elif defined(riscos) -#define PATH_SEP "," -#else -#define PATH_SEP ":" -#endif -#define PATH_SEP_CHAR PATH_SEP[0] - -#if defined(__human68k__) -#undef HAVE_RANDOM -#undef HAVE_SETITIMER -#endif - -#if defined(DJGPP) || defined(__BOW__) -#undef HAVE_SETITIMER -#endif - -#ifndef RUBY_PLATFORM -#define RUBY_PLATFORM "unknown-unknown" -#endif - -#endif diff --git a/dir.c b/dir.c deleted file mode 100644 index 5f6e707a81..0000000000 --- a/dir.c +++ /dev/null @@ -1,1067 +0,0 @@ -/********************************************************************** - - dir.c - - - $Author$ - $Date$ - created at: Wed Jan 5 09:51:01 JST 1994 - - Copyright (C) 1993-2002 Yukihiro Matsumoto - Copyright (C) 2000 Network Applied Communication Laboratory, Inc. - Copyright (C) 2000 Information-technology Promotion Agency, Japan - -**********************************************************************/ - -#include "ruby.h" - -#include -#include - -#ifdef HAVE_SYS_PARAM_H -# include -#else -# define MAXPATHLEN 1024 -#endif -#ifdef HAVE_UNISTD_H -#include -#endif - -#if defined HAVE_DIRENT_H && !defined NT -# include -# define NAMLEN(dirent) strlen((dirent)->d_name) -#elif defined HAVE_DIRECT_H && !defined NT -# include -# define NAMLEN(dirent) strlen((dirent)->d_name) -#else -# define dirent direct -# define NAMLEN(dirent) (dirent)->d_namlen -# if HAVE_SYS_NDIR_H -# include -# endif -# if HAVE_SYS_DIR_H -# include -# endif -# if HAVE_NDIR_H -# include -# endif -# if defined(NT) -# include "win32/dir.h" -# endif -#endif - -#include - -#ifndef HAVE_STDLIB_H -char *getenv(); -#endif - -#ifndef HAVE_STRING_H -char *strchr _((char*,char)); -#endif - -#include - -#include "util.h" - -#ifndef HAVE_LSTAT -#define lstat(path,st) stat(path,st) -#endif - -#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) == '\\') -static char * -find_dirsep(s) - char *s; -{ - while (*s) { - if (isdirsep(*s)) - return s; - s = CharNext(s); - } - return 0; -} -#else -#define isdirsep(c) ((c) == '/') -#define find_dirsep(s) strchr(s, '/') -#endif - -static char * -range(pat, test, flags) - char *pat; - char 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; - cstart = cend = *pat++; - if (cstart == ']') - return ok == not ? 0 : pat; - else if (escape && cstart == '\\') - cstart = cend = *pat++; - if (*pat == '-' && pat[1] != ']') { - if (escape && pat[1] == '\\') - pat++; - cend = pat[1]; - if (!cend) - return 0; - pat += 2; - } - if (downcase(cstart) <= test && test <= downcase(cend)) - ok = 1; - } - return 0; -} - -#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 && find_dirsep(s)) - return FNM_NOMATCH; - else - return 0; - } - else if (ISDIRSEP(c)) { - s = find_dirsep(s); - if (s) { - s++; - break; - } - return FNM_NOMATCH; - } - - test = escape && c == '\\' ? *pat : c; - test = downcase(test); - pat--; - while (*s) { - if ((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) - 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) - struct dir_data *dir; -{ - if (dir && dir->dir) closedir(dir->dir); -} - -static VALUE dir_close _((VALUE)); - -static VALUE -dir_s_alloc(klass) - VALUE klass; -{ - struct dir_data *dirp; - VALUE obj = Data_Make_Struct(klass, struct dir_data, 0, free_dir, dirp); - - dirp->dir = NULL; - dirp->path = NULL; - - return obj; -} - -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) { - rb_gc(); - dp->dir = opendir(RSTRING(dirname)->ptr); - } - if (dp->dir == NULL) { - rb_sys_fail(RSTRING(dirname)->ptr); - } - } - dp->path = strdup(RSTRING(dirname)->ptr); - - return dir; -} - -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); - - dir_initialize(dir, dirname); - if (rb_block_given_p()) { - return rb_ensure(rb_yield, dir, dir_close, dir); - } - - return dir; -} - -static void -dir_closed() -{ - rb_raise(rb_eIOError, "closed directory"); -} - -#define GetDIR(obj, dirp) do {\ - Data_Get_Struct(obj, struct dir_data, dirp);\ - if (dirp->dir == NULL) dir_closed();\ -} while (0) - -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); -} - -static VALUE -dir_read(dir) - VALUE dir; -{ - struct dir_data *dirp; - struct dirent *dp; - - GetDIR(dir, dirp); - errno = 0; - 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 */ -} - -static VALUE -dir_each(dir) - VALUE dir; -{ - struct dir_data *dirp; - struct dirent *dp; - - GetDIR(dir, dirp); - 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; -} - -static VALUE -dir_tell(dir) - VALUE dir; -{ -#ifdef HAVE_TELLDIR - struct dir_data *dirp; - long pos; - - GetDIR(dir, dirp); - pos = telldir(dirp->dir); - return rb_int2inum(pos); -#else - rb_notimplement(); -#endif -} - -static VALUE -dir_seek(dir, pos) - VALUE dir, pos; -{ - struct dir_data *dirp; - -#ifdef HAVE_SEEKDIR - GetDIR(dir, dirp); - seekdir(dirp->dir, NUM2INT(pos)); - return dir; -#else - rb_notimplement(); -#endif -} - -static VALUE -dir_set_pos(dir, pos) - VALUE dir, pos; -{ - dir_seek(dir, pos); - return pos; -} - -static VALUE -dir_rewind(dir) - VALUE dir; -{ - struct dir_data *dirp; - - GetDIR(dir, dirp); - rewinddir(dirp->dir); - return dir; -} - -static VALUE -dir_close(dir) - VALUE dir; -{ - struct dir_data *dirp; - - GetDIR(dir, dirp); - closedir(dirp->dir); - dirp->dir = NULL; - - return Qnil; -} - -static void -dir_chdir(path) - const char *path; -{ - if (chdir(path) < 0) - rb_sys_fail(path); -} - -static int chdir_blocking = 0; -static VALUE chdir_thread = Qnil; - -static VALUE -chdir_restore(path) - char *path; -{ - chdir_blocking--; - if (chdir_blocking == 0) - chdir_thread = Qnil; - dir_chdir(path); - free(path); - return Qnil; -} - -static VALUE -dir_s_chdir(argc, argv, obj) - int argc; - VALUE *argv; - VALUE obj; -{ - VALUE path = Qnil; - char *dist = ""; - - rb_secure(2); - if (rb_scan_args(argc, argv, "01", &path) == 1) { - SafeStringValue(path); - dist = RSTRING(path)->ptr; - } - else { - dist = getenv("HOME"); - if (!dist) { - dist = getenv("LOGDIR"); - if (!dist) rb_raise(rb_eArgError, "HOME/LOGDIR not set"); - } - } - - 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()) { - char *cwd = my_getcwd(); - chdir_blocking++; - if (chdir_thread == Qnil) - chdir_thread = rb_thread_current(); - dir_chdir(dist); - return rb_ensure(rb_yield, path, chdir_restore, (VALUE)cwd); - } - dir_chdir(dist); - - return INT2FIX(0); -} - -static VALUE -dir_s_getwd(dir) - VALUE dir; -{ - char *path = my_getcwd(); - VALUE cwd = rb_tainted_str_new2(path); - - free(path); - return cwd; -} - -static VALUE -dir_s_chroot(dir, path) - VALUE dir, path; -{ -#if defined(HAVE_CHROOT) && !defined(__CHECKER__) - rb_secure(2); - SafeStringValue(path); - - if (chroot(RSTRING(path)->ptr) == -1) - rb_sys_fail(RSTRING(path)->ptr); - - return INT2FIX(0); -#else - rb_notimplement(); - return Qnil; /* not reached */ -#endif -} - -static VALUE -dir_s_mkdir(argc, argv, obj) - int argc; - VALUE *argv; - VALUE obj; -{ - VALUE path, vmode; - int mode; - - if (rb_scan_args(argc, argv, "11", &path, &vmode) == 2) { - mode = NUM2INT(vmode); - } - else { - mode = 0777; - } - - SafeStringValue(path); - rb_secure(2); -#if !defined(NT) - if (mkdir(RSTRING(path)->ptr, mode) == -1) - rb_sys_fail(RSTRING(path)->ptr); -#else - if (mkdir(RSTRING(path)->ptr) == -1) - rb_sys_fail(RSTRING(path)->ptr); -#endif - - return INT2FIX(0); -} - -static VALUE -dir_s_rmdir(obj, dir) - VALUE obj, dir; -{ - SafeStringValue(dir); - rb_secure(2); - if (rmdir(RSTRING(dir)->ptr) < 0) - rb_sys_fail(RSTRING(dir)->ptr); - - return INT2FIX(0); -} - -/* Return nonzero if S has any special globbing chars in it. */ -static int -has_magic(s, send, flags) - char *s, *send; - int flags; -{ - register 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; - } - - if (send && p >= send) break; - } - return Qfalse; -} - -static char* -extract_path(p, pend) - 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 - && pend[-2] != ':' -#endif - ) { - alloc[len-1] = 0; - } - else { - alloc[len] = 0; - } - - return alloc; -} - -static char* -extract_elem(path) - char *path; -{ - char *pend; - - pend = strchr(path, '/'); - if (!pend) pend = path + strlen(path); - - return extract_path(path, pend); -} - -static void -remove_backslashes(p) - char *p; -{ - char *pend = p + strlen(p); - char *t = p; - - while (p < pend) { - if (*p == '\\') { - if (++p == pend) break; - } - *t++ = *p++; - } - *t = '\0'; -} - -#ifndef S_ISDIR -# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR) -#endif - -static void -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; - - 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) { - (*func)(path, arg); - } - 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; - } - - while (p) { - 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 = 0; - - 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); - 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); - glob_helper(buf, buf+n, flags, func, arg); - free(buf); - } - dirp = opendir(dir); - if (dirp == NULL) { - rb_sys_warning(dir); - free(base); - break; - } - } - else { - free(base); - break; - } - -#if defined DOSISH -#define BASE (*base && !((isdirsep(*base) && !base[1]) || (base[1] == ':' && isdirsep(base[2]) && !base[3]))) -#else -#define BASE (*base && !(*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; - 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); - continue; - } - if (S_ISDIR(st.st_mode)) { - char *t = buf+strlen(buf); - strcpy(t, "/**"); - strcpy(t+3, m); - glob_helper(buf, t, flags, func, arg); - } - 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) { - (*func)(buf, arg); - free(buf); - continue; - } - tmp = ALLOC(struct d_link); - tmp->path = buf; - tmp->next = link; - link = tmp; - } - } - closedir(dirp); - free(base); - free(magic); - if (link) { - while (link) { - 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); - 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; - } -} - -static void -rb_glob2(path, flags, func, arg) - char *path; - int flags; - void (*func) _((const char*, VALUE)); - VALUE arg; -{ - glob_helper(path, 0, flags, func, arg); -} - -void -rb_glob(path, func, arg) - char *path; - void (*func) _((const char*, VALUE)); - VALUE arg; -{ - rb_glob2(path, 0, func, arg); -} - -void -rb_globi(path, func, arg) - char *path; - void (*func) _((const char*, VALUE)); - VALUE arg; -{ - rb_glob2(path, FNM_CASEFOLD, func, arg); -} - -static void -push_pattern(path, ary) - const char *path; - VALUE ary; -{ - VALUE str = rb_tainted_str_new2(path); - - if (ary) { - rb_ary_push(ary, str); - } - else { - rb_yield(str); - } -} - -static void -push_globs(ary, s, flags) - VALUE ary; - char *s; - int flags; -{ - rb_glob2(s, flags, push_pattern, ary); -} - -static void -push_braces(ary, s, flags) - VALUE ary; - char *s; - int flags; -{ - char *buf; - char *p, *t, *b; - char *lbrace, *rbrace; - int nest = 0; - - p = s; - lbrace = rbrace = 0; - while (*p) { - if (*p == '{') { - lbrace = p; - break; - } - p++; - } - while (*p) { - if (*p == '{') nest++; - if (*p == '}' && --nest == 0) { - rbrace = p; - break; - } - p++; - } - - if (lbrace) { - int len = strlen(s); - buf = xmalloc(len + 1); - memcpy(buf, s, lbrace-s); - b = buf + (lbrace-s); - p = lbrace; - while (*p != '}') { - t = p + 1; - for (p = t; *p!='}' && *p!=','; p++) { - /* skip inner braces */ - if (*p == '{') while (*p!='}') p++; - } - memcpy(b, t, p-t); - strcpy(b+(p-t), rbrace+1); - push_braces(ary, buf, flags); - } - free(buf); - } - else { - push_globs(ary, s, flags); - } -} - -#define isdelim(c) ((c)=='\0') - -static VALUE -rb_push_glob(str, flags) - VALUE str; - int flags; -{ - char *p, *pend; - char *buf; - char *t; - int nest, maxnest; - int noescape = flags & FNM_NOESCAPE; - VALUE ary; - - if (rb_block_given_p()) - ary = 0; - else - 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'; - if (maxnest == 0) { - push_globs(ary, buf, flags); - } - else if (nest == 0) { - push_braces(ary, buf, flags); - } - /* else unmatched braces */ - } - free(buf); - - return ary; -} - -static VALUE -dir_s_aref(obj, str) - VALUE obj, str; -{ - return rb_push_glob(str, 0); -} - -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); -} - -static VALUE -dir_foreach(io, dirname) - VALUE io, dirname; -{ - VALUE dir; - - dir = rb_funcall(rb_cDir, rb_intern("open"), 1, dirname); - rb_ensure(dir_each, dir, dir_close, dir); - return Qnil; -} - -static VALUE -dir_entries(io, dirname) - VALUE io, dirname; -{ - VALUE dir; - - dir = rb_funcall(rb_cDir, rb_intern("open"), 1, dirname); - return rb_ensure(rb_Array, dir, dir_close, dir); -} - -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; -} - -void -Init_Dir() -{ - rb_cDir = rb_define_class("Dir", rb_cObject); - - rb_include_module(rb_cDir, rb_mEnumerable); - - rb_define_singleton_method(rb_cDir, "allocate", dir_s_alloc, 0); - 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/README.djgpp b/djgpp/README.djgpp deleted file mode 100644 index d81259ccac..0000000000 --- a/djgpp/README.djgpp +++ /dev/null @@ -1,21 +0,0 @@ -* 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 - and ext/extmk.rb(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 deleted file mode 100644 index 862ef8dc2a..0000000000 --- a/djgpp/config.hin +++ /dev/null @@ -1,116 +0,0 @@ - -#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_DRAND48 1 -#define HAVE_RANDOM 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_INITSTATE 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 DEFAULT_KCODE KCODE_NONE -#define DLEXT ".o" -#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 deleted file mode 100644 index c2f0661913..0000000000 --- a/djgpp/config.sed +++ /dev/null @@ -1,81 +0,0 @@ -/^SHELL/s,/bin/sh,$(COMSPEC), -s%@srcdir@%.%g -s%@top_srcdir@%..% -s%@CFLAGS@%-O2%g -s%@CPPFLAGS@%%g -s%@CXXFLAGS@%%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-msdosdjgpp%g -s%@host_alias@%i386-msdosdjgpp%g -s%@host_cpu@%i386%g -s%@host_vendor@%pc%g -s%@host_os@%msdosdjgpp%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 vsnprintf.o%g -s%@ALLOCA@%%g -s%@DEFAULT_KCODE@%%g -s%@EXEEXT@%.exe%g -s%@OBJEXT@%o%g -s%@XLDFLAGS@%%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.dj%g -s%@LIBRUBY@%libruby.a%g -s%@LIBRUBY_A@%libruby.a%g -s%@LIBRUBYARG@%libruby.a%g -s%@LIBRUBY_SO@%%g -s%@SOLIBS@%%g -s%@arch@%i386-msdosdjgpp%g -;s%/bin/rm%rm% -s%@DLDLIBS@%-lc%g -s%@MAINLIBS@%%g -s%@PREP@%% -s%@RUBY_INSTALL_NAME@%ruby%g -s%@RUBY_SO_NAME@%%g -s%@arch@%i386-msdosdjgpp%g -s%@sitedir@%${prefix}/lib/ruby/site_ruby%g -s%@configure_args@%%g -s%@MINIRUBY@%./miniruby% -s%@archlib@%/lib/ruby/i386-msdosdjgpp% -;s%|| true%% -;/\/dev\/null/ { -;s,/dev/null 2>&1, nul, -;s,2> /dev/null,, -;} -;/^config.status/ { -; N;N;N;N;N;d -;} -#;s%mv -f y\.tab\.c%if exist parse.c del parse.c\ -# ren y_tab.c% -#;s%y\.tab\.c%y_tab.c% -/^,THIS_IS_DUMMY_PATTERN_/i\ -ac_given_srcdir=. diff --git a/djgpp/config.status b/djgpp/config.status deleted file mode 100644 index 7a10754d1d..0000000000 --- a/djgpp/config.status +++ /dev/null @@ -1,77 +0,0 @@ -/^SHELL/s,/bin/sh,$(COMPSEC), -s%@srcdir@%.%g -s%@top_srcdir@%..% -s%@CFLAGS@%-O2%g -s%@CPPFLAGS@%%g -s%@CXXFLAGS@%%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-msdosdjgpp%g -s%@host_alias@%i386-msdosdjgpp%g -s%@host_cpu@%i386%g -s%@host_vendor@%pc%g -s%@host_os@%msdosdjgpp%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 vsnprintf.o%g -s%@ALLOCA@%%g -s%@DEFAULT_KCODE@%%g -s%@EXEEXT@%.exe%g -s%@OBJEXT@%o%g -s%@XLDFLAGS@%%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.dj%g -s%@LIBRUBY@%libruby.a%g -s%@LIBRUBY_A@%libruby.a%g -s%@LIBRUBYARG@%libruby.a%g -s%@LIBRUBY_SO@%%g -s%@SOLIBS@%%g -s%@arch@%i386-msdosdjgpp%g -;s%/bin/rm%rm% -s%@DLDLIBS@%-lc%g -s%@PREP@%% -s%@RUBY_INSTALL_NAME@%ruby%g -s%@RUBY_SO_NAME@%%g -s%@arch@%i386-msdosdjgpp%g -s%@sitedir@%${prefix}/lib/ruby/site_ruby%g -s%@MINIRUBY@%./miniruby% -s%@archlib@%/usr/local/lib/ruby/i386-msdosdjgpp% -;s%|| true%% -;/\/dev\/null/ { -;s,/dev/null 2>&1, nul, -;s,2> /dev/null,, -;} -;/^config.status/ { -; N;N;N;N;N;d -;} -;s%y\.tab\.c%y_tab.c% -/^,THIS_IS_DUMMY_PATTERN_/i\ -ac_given_srcdir=. diff --git a/djgpp/configure.bat b/djgpp/configure.bat deleted file mode 100644 index dbb4a08528..0000000000 --- a/djgpp/configure.bat +++ /dev/null @@ -1,21 +0,0 @@ -@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_% < ext\extmk.rb.in > ext\extmk.rb -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 deleted file mode 100644 index f29b9ddd3e..0000000000 --- a/djgpp/mkver.sed +++ /dev/null @@ -1 +0,0 @@ -/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 deleted file mode 100644 index 90c5213bf6..0000000000 --- a/dln.c +++ /dev/null @@ -1,1797 +0,0 @@ -/********************************************************************** - - dln.c - - - $Author$ - $Date$ - created at: Tue Jan 18 17:05:06 JST 1994 - - Copyright (C) 1993-2002 Yukihiro Matsumoto - -**********************************************************************/ - -#include "ruby.h" -#include "dln.h" - -#ifdef HAVE_STDLIB_H -# include -#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__) -#include -#endif - -#ifdef HAVE_STRING_H -# include -#else -# include -#endif - -#ifndef xmalloc -void *xmalloc(); -void *xcalloc(); -void *xrealloc(); -#endif - -#include -#if defined(NT) || defined(__VMS) -#include "missing/file.h" -#endif -#include -#include - -#ifndef S_ISDIR -# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR) -#endif - -#ifdef HAVE_SYS_PARAM_H -# include -#else -# define MAXPATHLEN 1024 -#endif - -#ifdef HAVE_UNISTD_H -# include -#endif - -#ifndef NT -char *getenv(); -#endif - -#if defined(__VMS) -#pragma builtins -#include -#endif - -#ifdef __MACOS__ -# include -# include -# include -# include "macruby_private.h" -#endif - -#ifdef __BEOS__ -# include -#endif - -int eaccess(); - -#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(_AIX) -/* dynamic load with dlopen() */ -# define USE_DLN_DLOPEN -#endif - -#ifndef FUNCNAME_PATTERN -# if defined(__hp9000s300) || (defined(__NetBSD__) && !defined(__ELF__)) || defined(__BORLANDC__) || (defined(__FreeBSD__) && !defined(__ELF__)) || defined(__OpenBSD__) || defined(NeXT) || defined(__WATCOMC__) || defined(__APPLE__) -# define FUNCNAME_PATTERN "_Init_%s" -# else -# define FUNCNAME_PATTERN "Init_%s" -# endif -#endif - -static void -init_funcname(buf, file) - char **buf; - char *file; -{ - char *p, *slash; - - /* Load the file as an object one */ - for (p = file, slash = p-1; *p; p++) /* Find position of last '/' */ -#ifdef __MACOS__ - if (*p == ':') slash = p; -#else - if (*p == '/') slash = p; -#endif - -/* This assumes that systems without length limitation for file names - provide asprintf(). This shouldn't be too unlikely. */ -#ifdef MAXPATHLEN - *buf = xmalloc(MAXPATHLEN); - snprintf(*buf, MAXPATHLEN, FUNCNAME_PATTERN, slash + 1); -#else - asprintf(buf, FUNCNAME_PATTERN, slash + 1); -#endif - for (p = *buf; *p; p++) { /* Delete suffix if it exists */ - if (*p == '.') { - *p = '\0'; break; - } - } -} - -#ifdef USE_DLN_A_OUT - -#ifndef LIBC_NAME -# define LIBC_NAME "libc.a" -#endif - -#ifndef DLN_DEFAULT_LIB_PATH -# define DLN_DEFAULT_LIB_PATH "/lib:/usr/lib:/usr/local/lib:." -#endif - -#include - -static int dln_errno; - -#define DLN_ENOEXEC ENOEXEC /* Exec format error */ -#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 -#include -#ifndef N_COMM -# define N_COMM 0x12 -#endif -#ifndef N_MAGIC -# define N_MAGIC(x) (x).a_magic -#endif - -#define INVALID_OBJECT(h) (N_MAGIC(h) != OMAGIC) - -#include "util.h" -#include "st.h" - -static st_table *sym_tbl; -static st_table *undef_tbl; - -static int load_lib(); - -static int -load_header(fd, hdrp, disp) - int fd; - struct exec *hdrp; - long disp; -{ - int size; - - lseek(fd, disp, 0); - size = read(fd, hdrp, sizeof(struct exec)); - if (size == -1) { - dln_errno = errno; - return -1; - } - if (size != sizeof(struct exec) || N_BADMAG(*hdrp)) { - dln_errno = DLN_ENOEXEC; - return -1; - } - return 0; -} - -#if defined(sequent) -#define RELOC_SYMBOL(r) ((r)->r_symbolnum) -#define RELOC_MEMORY_SUB_P(r) ((r)->r_bsr) -#define RELOC_PCREL_P(r) ((r)->r_pcrel || (r)->r_bsr) -#define RELOC_TARGET_SIZE(r) ((r)->r_length) -#endif - -/* Default macros */ -#ifndef RELOC_ADDRESS -#define RELOC_ADDRESS(r) ((r)->r_address) -#define RELOC_EXTERN_P(r) ((r)->r_extern) -#define RELOC_SYMBOL(r) ((r)->r_symbolnum) -#define RELOC_MEMORY_SUB_P(r) 0 -#define RELOC_PCREL_P(r) ((r)->r_pcrel) -#define RELOC_TARGET_SIZE(r) ((r)->r_length) -#endif - -#if defined(sun) && defined(sparc) -/* Sparc (Sun 4) macros */ -# undef relocation_info -# define relocation_info reloc_info_sparc -# define R_RIGHTSHIFT(r) (reloc_r_rightshift[(r)->r_type]) -# define R_BITSIZE(r) (reloc_r_bitsize[(r)->r_type]) -# define R_LENGTH(r) (reloc_r_length[(r)->r_type]) -static int reloc_r_rightshift[] = { - 0, 0, 0, 0, 0, 0, 2, 2, 10, 0, 0, 0, 0, 0, 0, -}; -static int reloc_r_bitsize[] = { - 8, 16, 32, 8, 16, 32, 30, 22, 22, 22, 13, 10, 32, 32, 16, -}; -static int reloc_r_length[] = { - 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -}; -# define R_PCREL(r) \ - ((r)->r_type >= RELOC_DISP8 && (r)->r_type <= RELOC_WDISP22) -# define R_SYMBOL(r) ((r)->r_index) -#endif - -#if defined(sequent) -#define R_SYMBOL(r) ((r)->r_symbolnum) -#define R_MEMORY_SUB(r) ((r)->r_bsr) -#define R_PCREL(r) ((r)->r_pcrel || (r)->r_bsr) -#define R_LENGTH(r) ((r)->r_length) -#endif - -#ifndef R_SYMBOL -# define R_SYMBOL(r) ((r)->r_symbolnum) -# define R_MEMORY_SUB(r) 0 -# define R_PCREL(r) ((r)->r_pcrel) -# define R_LENGTH(r) ((r)->r_length) -#endif - -static struct relocation_info * -load_reloc(fd, hdrp, disp) - int fd; - struct exec *hdrp; - long disp; -{ - struct relocation_info *reloc; - int size; - - lseek(fd, disp + N_TXTOFF(*hdrp) + hdrp->a_text + hdrp->a_data, 0); - size = hdrp->a_trsize + hdrp->a_drsize; - reloc = (struct relocation_info*)xmalloc(size); - if (reloc == NULL) { - dln_errno = errno; - return NULL; - } - - if (read(fd, reloc, size) != size) { - dln_errno = errno; - free(reloc); - return NULL; - } - - return reloc; -} - -static struct nlist * -load_sym(fd, hdrp, disp) - int fd; - struct exec *hdrp; - long disp; -{ - struct nlist * buffer; - struct nlist * sym; - struct nlist * end; - long displ; - int size; - - lseek(fd, N_SYMOFF(*hdrp) + hdrp->a_syms + disp, 0); - if (read(fd, &size, sizeof(int)) != sizeof(int)) { - goto err_noexec; - } - - buffer = (struct nlist*)xmalloc(hdrp->a_syms + size); - if (buffer == NULL) { - dln_errno = errno; - return NULL; - } - - lseek(fd, disp + N_SYMOFF(*hdrp), 0); - if (read(fd, buffer, hdrp->a_syms + size) != hdrp->a_syms + size) { - free(buffer); - goto err_noexec; - } - - sym = buffer; - end = sym + hdrp->a_syms / sizeof(struct nlist); - displ = (long)buffer + (long)(hdrp->a_syms); - - while (sym < end) { - sym->n_un.n_name = (char*)sym->n_un.n_strx + displ; - sym++; - } - return buffer; - - err_noexec: - dln_errno = DLN_ENOEXEC; - return NULL; -} - -static st_table * -sym_hash(hdrp, syms) - struct exec *hdrp; - struct nlist *syms; -{ - st_table *tbl; - struct nlist *sym = syms; - struct nlist *end = syms + (hdrp->a_syms / sizeof(struct nlist)); - - tbl = st_init_strtable(); - if (tbl == NULL) { - dln_errno = errno; - return NULL; - } - - while (sym < end) { - st_insert(tbl, sym->n_un.n_name, sym); - sym++; - } - return tbl; -} - -static int -dln_init(prog) - const char *prog; -{ - char *file; - int fd; - struct exec hdr; - struct nlist *syms; - - if (dln_init_p == 1) return 0; - - file = dln_find_exe(prog, NULL); - if (file == NULL || (fd = open(file, O_RDONLY)) < 0) { - dln_errno = errno; - return -1; - } - - if (load_header(fd, &hdr, 0) == -1) return -1; - syms = load_sym(fd, &hdr, 0); - if (syms == NULL) { - close(fd); - return -1; - } - sym_tbl = sym_hash(&hdr, syms); - if (sym_tbl == NULL) { /* file may be start with #! */ - char c = '\0'; - char buf[MAXPATHLEN]; - char *p; - - free(syms); - lseek(fd, 0L, 0); - if (read(fd, &c, 1) == -1) { - dln_errno = errno; - return -1; - } - if (c != '#') goto err_noexec; - if (read(fd, &c, 1) == -1) { - dln_errno = errno; - return -1; - } - if (c != '!') goto err_noexec; - - p = buf; - /* skip forwading spaces */ - while (read(fd, &c, 1) == 1) { - if (c == '\n') goto err_noexec; - if (c != '\t' && c != ' ') { - *p++ = c; - break; - } - } - /* read in command name */ - 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'; - - return dln_init(buf); - } - dln_init_p = 1; - undef_tbl = st_init_strtable(); - close(fd); - return 0; - - err_noexec: - close(fd); - dln_errno = DLN_ENOEXEC; - return -1; -} - -static long -load_text_data(fd, hdrp, bss, disp) - int fd; - struct exec *hdrp; - int bss; - long disp; -{ - int size; - unsigned char* addr; - - lseek(fd, disp + N_TXTOFF(*hdrp), 0); - size = hdrp->a_text + hdrp->a_data; - - if (bss == -1) size += hdrp->a_bss; - else if (bss > 1) size += bss; - - addr = (unsigned char*)xmalloc(size); - if (addr == NULL) { - dln_errno = errno; - return 0; - } - - if (read(fd, addr, size) != size) { - dln_errno = errno; - free(addr); - return 0; - } - - if (bss == -1) { - memset(addr + hdrp->a_text + hdrp->a_data, 0, hdrp->a_bss); - } - else if (bss > 0) { - memset(addr + hdrp->a_text + hdrp->a_data, 0, bss); - } - - return (long)addr; -} - -static int -undef_print(key, value) - char *key, *value; -{ - fprintf(stderr, " %s\n", key); - return ST_CONTINUE; -} - -static void -dln_print_undef() -{ - fprintf(stderr, " Undefined symbols:\n"); - st_foreach(undef_tbl, undef_print, NULL); -} - -static void -dln_undefined() -{ - if (undef_tbl->num_entries > 0) { - fprintf(stderr, "dln: Calling undefined function\n"); - dln_print_undef(); - rb_exit(1); - } -} - -struct undef { - char *name; - struct relocation_info reloc; - long base; - char *addr; - union { - char c; - short s; - long l; - } u; -}; - -static st_table *reloc_tbl = NULL; -static void -link_undef(name, base, reloc) - const char *name; - long base; - struct relocation_info *reloc; -{ - static int u_no = 0; - struct undef *obj; - char *addr = (char*)(reloc->r_address + base); - - obj = (struct undef*)xmalloc(sizeof(struct undef)); - obj->name = strdup(name); - obj->reloc = *reloc; - obj->base = base; - switch (R_LENGTH(reloc)) { - case 0: /* byte */ - obj->u.c = *addr; - break; - case 1: /* word */ - obj->u.s = *(short*)addr; - break; - case 2: /* long */ - obj->u.l = *(long*)addr; - break; - } - if (reloc_tbl == NULL) { - reloc_tbl = st_init_numtable(); - } - st_insert(reloc_tbl, u_no++, obj); -} - -struct reloc_arg { - const char *name; - long value; -}; - -static int -reloc_undef(no, undef, arg) - int no; - struct undef *undef; - struct reloc_arg *arg; -{ - int datum; - char *address; -#if defined(sun) && defined(sparc) - unsigned int mask = 0; -#endif - - if (strcmp(arg->name, undef->name) != 0) return ST_CONTINUE; - address = (char*)(undef->base + undef->reloc.r_address); - datum = arg->value; - - if (R_PCREL(&(undef->reloc))) datum -= undef->base; -#if defined(sun) && defined(sparc) - datum += undef->reloc.r_addend; - datum >>= R_RIGHTSHIFT(&(undef->reloc)); - mask = (1 << R_BITSIZE(&(undef->reloc))) - 1; - mask |= mask -1; - datum &= mask; - switch (R_LENGTH(&(undef->reloc))) { - case 0: - *address = undef->u.c; - *address &= ~mask; - *address |= datum; - break; - case 1: - *(short *)address = undef->u.s; - *(short *)address &= ~mask; - *(short *)address |= datum; - break; - case 2: - *(long *)address = undef->u.l; - *(long *)address &= ~mask; - *(long *)address |= datum; - break; - } -#else - switch (R_LENGTH(&(undef->reloc))) { - case 0: /* byte */ - if (R_MEMORY_SUB(&(undef->reloc))) - *address = datum - *address; - else *address = undef->u.c + datum; - break; - case 1: /* word */ - if (R_MEMORY_SUB(&(undef->reloc))) - *(short*)address = datum - *(short*)address; - else *(short*)address = undef->u.s + datum; - break; - case 2: /* long */ - if (R_MEMORY_SUB(&(undef->reloc))) - *(long*)address = datum - *(long*)address; - else *(long*)address = undef->u.l + datum; - break; - } -#endif - free(undef->name); - free(undef); - return ST_DELETE; -} - -static void -unlink_undef(name, value) - const char *name; - long value; -{ - struct reloc_arg arg; - - arg.name = name; - arg.value = value; - st_foreach(reloc_tbl, reloc_undef, &arg); -} - -#ifdef N_INDR -struct indr_data { - char *name0, *name1; -}; - -static int -reloc_repl(no, undef, data) - int no; - struct undef *undef; - struct indr_data *data; -{ - if (strcmp(data->name0, undef->name) == 0) { - free(undef->name); - undef->name = strdup(data->name1); - } - return ST_CONTINUE; -} -#endif - -static int -load_1(fd, disp, need_init) - int fd; - long disp; - const char *need_init; -{ - static char *libc = LIBC_NAME; - struct exec hdr; - struct relocation_info *reloc = NULL; - long block = 0; - long new_common = 0; /* Length of new common */ - struct nlist *syms = NULL; - struct nlist *sym; - struct nlist *end; - int init_p = 0; - - if (load_header(fd, &hdr, disp) == -1) return -1; - if (INVALID_OBJECT(hdr)) { - dln_errno = DLN_ENOEXEC; - return -1; - } - reloc = load_reloc(fd, &hdr, disp); - if (reloc == NULL) return -1; - syms = load_sym(fd, &hdr, disp); - if (syms == NULL) return -1; - - sym = syms; - end = syms + (hdr.a_syms / sizeof(struct nlist)); - while (sym < end) { - struct nlist *old_sym; - int value = sym->n_value; - -#ifdef N_INDR - if (sym->n_type == (N_INDR | N_EXT)) { - 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)) { - unlink_undef(key, old_sym->n_value); - free(key); - } - } - else { - struct indr_data data; - - data.name0 = sym->n_un.n_name; - data.name1 = sym[1].n_un.n_name; - 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)) { - free(key); - } - } - sym += 2; - continue; - } -#endif - if (sym->n_type == (N_UNDF | N_EXT)) { - if (st_lookup(sym_tbl, sym->n_un.n_name, &old_sym) == 0) { - old_sym = NULL; - } - - if (value) { - if (old_sym) { - sym->n_type = N_EXT | N_COMM; - sym->n_value = old_sym->n_value; - } - else { - int rnd = - value >= sizeof(double) ? sizeof(double) - 1 - : value >= sizeof(long) ? sizeof(long) - 1 - : sizeof(short) - 1; - - sym->n_type = N_COMM; - new_common += rnd; - new_common &= ~(long)rnd; - sym->n_value = new_common; - new_common += value; - } - } - else { - if (old_sym) { - sym->n_type = N_EXT | N_COMM; - sym->n_value = old_sym->n_value; - } - else { - sym->n_value = (long)dln_undefined; - st_insert(undef_tbl, strdup(sym->n_un.n_name), NULL); - } - } - } - sym++; - } - - block = load_text_data(fd, &hdr, hdr.a_bss + new_common, disp); - if (block == 0) goto err_exit; - - sym = syms; - while (sym < end) { - struct nlist *new_sym; - char *key; - - switch (sym->n_type) { - case N_COMM: - sym->n_value += hdr.a_text + hdr.a_data; - case N_TEXT|N_EXT: - case N_DATA|N_EXT: - - sym->n_value += block; - - if (st_lookup(sym_tbl, sym->n_un.n_name, &new_sym) != 0 - && new_sym->n_value != (long)dln_undefined) { - dln_errno = DLN_ECONFL; - goto err_exit; - } - - key = sym->n_un.n_name; - if (st_delete(undef_tbl, &key, NULL) != 0) { - unlink_undef(key, sym->n_value); - free(key); - } - - new_sym = (struct nlist*)xmalloc(sizeof(struct nlist)); - *new_sym = *sym; - new_sym->n_un.n_name = strdup(sym->n_un.n_name); - st_insert(sym_tbl, new_sym->n_un.n_name, new_sym); - break; - - case N_TEXT: - case N_DATA: - sym->n_value += block; - break; - } - sym++; - } - - /* - * First comes the text-relocation - */ - { - struct relocation_info * rel = reloc; - struct relocation_info * rel_beg = reloc + - (hdr.a_trsize/sizeof(struct relocation_info)); - struct relocation_info * rel_end = reloc + - (hdr.a_trsize+hdr.a_drsize)/sizeof(struct relocation_info); - - while (rel < rel_end) { - char *address = (char*)(rel->r_address + block); - long datum = 0; -#if defined(sun) && defined(sparc) - unsigned int mask = 0; -#endif - - if(rel >= rel_beg) - address += hdr.a_text; - - if (rel->r_extern) { /* Look it up in symbol-table */ - sym = &(syms[R_SYMBOL(rel)]); - switch (sym->n_type) { - case N_EXT|N_UNDF: - link_undef(sym->n_un.n_name, block, rel); - case N_EXT|N_COMM: - case N_COMM: - datum = sym->n_value; - break; - default: - goto err_exit; - } - } /* end.. look it up */ - else { /* is static */ - switch (R_SYMBOL(rel)) { - case N_TEXT: - case N_DATA: - datum = block; - break; - case N_BSS: - datum = block + new_common; - break; - case N_ABS: - break; - } - } /* end .. is static */ - if (R_PCREL(rel)) datum -= block; - -#if defined(sun) && defined(sparc) - datum += rel->r_addend; - datum >>= R_RIGHTSHIFT(rel); - mask = (1 << R_BITSIZE(rel)) - 1; - mask |= mask -1; - datum &= mask; - - switch (R_LENGTH(rel)) { - case 0: - *address &= ~mask; - *address |= datum; - break; - case 1: - *(short *)address &= ~mask; - *(short *)address |= datum; - break; - case 2: - *(long *)address &= ~mask; - *(long *)address |= datum; - break; - } -#else - switch (R_LENGTH(rel)) { - case 0: /* byte */ - if (datum < -128 || datum > 127) goto err_exit; - *address += datum; - break; - case 1: /* word */ - *(short *)address += datum; - break; - case 2: /* long */ - *(long *)address += datum; - break; - } -#endif - rel++; - } - } - - 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); - len = strlen(buf); - - for (sym = syms; symn_un.n_name; - if (name[0] == '_' && sym->n_value >= block) { - 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) { - init_p = 1; - ((int (*)())sym->n_value)(); - } - } - } - free (buf); - if (libs_to_be_linked && undef_tbl->num_entries > 0) { - while (*libs_to_be_linked) { - load_lib(*libs_to_be_linked); - libs_to_be_linked++; - } - } - } - free(reloc); - free(syms); - if (need_init) { - if (init_p == 0) { - dln_errno = DLN_ENOINIT; - return -1; - } - if (undef_tbl->num_entries > 0) { - if (load_lib(libc) == -1) goto err_exit; - if (undef_tbl->num_entries > 0) { - dln_errno = DLN_EUNDEF; - return -1; - } - } - } - return 0; - - err_exit: - if (syms) free(syms); - if (reloc) free(reloc); - if (block) free((char*)block); - return -1; -} - -static int target_offset; -static int -search_undef(key, value, lib_tbl) - const char *key; - int value; - st_table *lib_tbl; -{ - long offset; - - if (st_lookup(lib_tbl, key, &offset) == 0) return ST_CONTINUE; - target_offset = offset; - return ST_STOP; -} - -struct symdef { - int rb_str_index; - int lib_offset; -}; - -char *dln_librrb_ary_path = DLN_DEFAULT_LIB_PATH; - -static int -load_lib(lib) - const char *lib; -{ - char *path, *file; - char armagic[SARMAG]; - int fd, size; - struct ar_hdr ahdr; - st_table *lib_tbl = NULL; - int *data, nsym; - struct symdef *base; - char *name_base; - - if (dln_init_p == 0) { - dln_errno = DLN_ENOINIT; - return -1; - } - - if (undef_tbl->num_entries == 0) return 0; - dln_errno = DLN_EBADLIB; - - if (lib[0] == '-' && lib[1] == 'l') { - char *p = alloca(strlen(lib) + 4); - sprintf(p, "lib%s.a", lib+2); - lib = p; - } - - /* library search path: */ - /* look for environment variable DLN_LIBRARY_PATH first. */ - /* then variable dln_librrb_ary_path. */ - /* if path is still NULL, use "." for path. */ - path = getenv("DLN_LIBRARY_PATH"); - if (path == NULL) path = dln_librrb_ary_path; - - file = dln_find_file(lib, path); - fd = open(file, O_RDONLY); - if (fd == -1) goto syserr; - size = read(fd, armagic, SARMAG); - if (size == -1) goto syserr; - - if (size != SARMAG) { - dln_errno = DLN_ENOTLIB; - goto badlib; - } - size = read(fd, &ahdr, sizeof(ahdr)); - if (size == -1) goto syserr; - if (size != sizeof(ahdr) || sscanf(ahdr.ar_size, "%d", &size) != 1) { - goto badlib; - } - - if (strncmp(ahdr.ar_name, "__.SYMDEF", 9) == 0) { - /* make hash table from __.SYMDEF */ - - lib_tbl = st_init_strtable(); - data = (int*)xmalloc(size); - if (data == NULL) goto syserr; - size = read(fd, data, size); - nsym = *data / sizeof(struct symdef); - base = (struct symdef*)(data + 1); - name_base = (char*)(base + nsym) + sizeof(int); - while (nsym > 0) { - char *name = name_base + base->rb_str_index; - - st_insert(lib_tbl, name, base->lib_offset + sizeof(ahdr)); - nsym--; - base++; - } - for (;;) { - target_offset = -1; - st_foreach(undef_tbl, search_undef, lib_tbl); - if (target_offset == -1) break; - if (load_1(fd, target_offset, 0) == -1) { - st_free_table(lib_tbl); - free(data); - goto badlib; - } - if (undef_tbl->num_entries == 0) break; - } - free(data); - st_free_table(lib_tbl); - } - else { - /* linear library, need to scan (FUTURE) */ - - for (;;) { - int offset = SARMAG; - int found = 0; - struct exec hdr; - struct nlist *syms, *sym, *end; - - while (undef_tbl->num_entries > 0) { - found = 0; - lseek(fd, offset, 0); - size = read(fd, &ahdr, sizeof(ahdr)); - if (size == -1) goto syserr; - if (size == 0) break; - if (size != sizeof(ahdr) - || sscanf(ahdr.ar_size, "%d", &size) != 1) { - goto badlib; - } - offset += sizeof(ahdr); - if (load_header(fd, &hdr, offset) == -1) - goto badlib; - syms = load_sym(fd, &hdr, offset); - if (syms == NULL) goto badlib; - sym = syms; - end = syms + (hdr.a_syms / sizeof(struct nlist)); - while (sym < end) { - if (sym->n_type == N_EXT|N_TEXT - && st_lookup(undef_tbl, sym->n_un.n_name, NULL)) { - break; - } - sym++; - } - if (sym < end) { - found++; - free(syms); - if (load_1(fd, offset, 0) == -1) { - goto badlib; - } - } - offset += size; - if (offset & 1) offset++; - } - if (found) break; - } - } - close(fd); - return 0; - - syserr: - dln_errno = errno; - badlib: - if (fd >= 0) close(fd); - return -1; -} - -static int -load(file) - const char *file; -{ - int fd; - int result; - - if (dln_init_p == 0) { - if (dln_init(dln_argv0) == -1) return -1; - } - result = strlen(file); - if (file[result-1] == 'a') { - return load_lib(file); - } - - fd = open(file, O_RDONLY); - if (fd == -1) { - dln_errno = errno; - return -1; - } - result = load_1(fd, 0, file); - close(fd); - - return result; -} - -void* -dln_sym(name) - const char *name; -{ - struct nlist *sym; - - if (st_lookup(sym_tbl, name, &sym)) - return (void*)sym->n_value; - return NULL; -} - -#endif /* USE_DLN_A_OUT */ - -#ifdef USE_DLN_DLOPEN -# ifdef __NetBSD__ -# include -# include -# else -# include -# endif -#endif - -#ifdef __hpux -#include -#include "dl.h" -#endif - -#if defined(_AIX) -#include /* for isdigit() */ -#include /* for global errno */ -#include -#endif - -#ifdef NeXT -#if NS_TARGET_MAJOR < 4 -#include -#else -#include -#endif -#endif -#ifdef __APPLE__ -#include -#endif - - -#if defined _WIN32 && !defined __CYGWIN__ -#include -#endif - -static const char * -dln_strerror() -{ -#ifdef USE_DLN_A_OUT - char *strerror(); - - switch (dln_errno) { - case DLN_ECONFL: - return "Symbol name conflict"; - case DLN_ENOINIT: - return "No inititalizer given"; - case DLN_EUNDEF: - return "Unresolved symbols"; - case DLN_ENOTLIB: - return "Not a library file"; - case DLN_EBADLIB: - return "Malformed library file"; - case DLN_EINIT: - return "Not initialized"; - default: - return strerror(dln_errno); - } -#endif - -#ifdef USE_DLN_DLOPEN - return (char*)dlerror(); -#endif - -#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_IGNORE_INSERTS, - NULL, - 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 -} - - -#if defined(_AIX) && ! defined(_IA64) -static void -aix_loaderror(const char *pathname) -{ - char *message[8], errbuf[1024]; - int i,j; - - struct errtab { - int errno; - char *errstr; - } load_errtab[] = { - {L_ERROR_TOOMANY, "too many errors, rest skipped."}, - {L_ERROR_NOLIB, "can't load library:"}, - {L_ERROR_UNDEF, "can't find symbol in library:"}, - {L_ERROR_RLDBAD, - "RLD index out of range or bad relocation type:"}, - {L_ERROR_FORMAT, "not a valid, executable xcoff file:"}, - {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_SYSTEM, "System error:"}, - {L_ERROR_ERRNO, NULL} - }; - -#define LOAD_ERRTAB_LEN (sizeof(load_errtab)/sizeof(load_errtab[0])) -#define ERRBUF_APPEND(s) strncat(errbuf, s, sizeof(errbuf)-strlen(errbuf)-1) - - 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= MAXPATHLEN) rb_loaderror("filename too long"); - - /* Load the file as an object one */ - init_funcname(&buf, file); - - strcpy(winfile, file); - - /* Load file */ - if ((handle = LoadLibrary(winfile)) == NULL) { - error = dln_strerror(); - goto failed; - } - - if ((init_fct = (void(*)())GetProcAddress(handle, buf)) == NULL) { - rb_loaderror("%s - %s\n%s", dln_strerror(), buf, file); - } - free(buf); - - /* Call the init code */ - (*init_fct)(); - return handle; -#else -#ifdef USE_DLN_A_OUT - if (load(file) == -1) { - error = dln_strerror(); - goto failed; - } - return 0; -#else - - char *buf; - /* Load the file as an object one */ - init_funcname(&buf, file); - -#ifdef USE_DLN_DLOPEN -#define DLN_DEFINED - { - void *handle; - void (*init_fct)(); - -#ifndef RTLD_LAZY -# define RTLD_LAZY 1 -#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; - } - - init_fct = (void(*)())dlsym(handle, buf); - free(buf); - if (init_fct == NULL) { - error = DLN_ERROR(); - dlclose(handle); - goto failed; - } - /* Call the init code */ - (*init_fct)(); - - return handle; - } -#endif /* USE_DLN_DLOPEN */ - -#ifdef __hpux -#define DLN_DEFINED - { - shl_t lib = NULL; - int flags; - void (*init_fct)(); - - flags = BIND_DEFERRED; - lib = shl_load(file, flags, 0); - if (lib == NULL) { - extern int errno; - rb_loaderror("%s - %s", strerror(errno), file); - } - shl_findsym(&lib, buf, TYPE_PROCEDURE, (void*)&init_fct); - free(buf); - if (init_fct == NULL) { - shl_findsym(&lib, buf, TYPE_UNDEFINED, (void*)&init_fct); - if (init_fct == NULL) { - errno = ENOSYM; - rb_loaderror("%s - %s", strerror(ENOSYM), file); - } - } - (*init_fct)(); - return (void*)lib; - } -#endif /* hpux */ - -#if defined(_AIX) && ! defined(_IA64) -#define DLN_DEFINED - { - void (*init_fct)(); - - 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 (void*)init_fct; - } -#endif /* _AIX */ - -#if defined(NeXT) || defined(__APPLE__) -#define DLN_DEFINED -/*---------------------------------------------------- - By SHIROYAMA Takayuki Psi@fortune.nest.or.jp - - Special Thanks... - Yu tomoak-i@is.aist-nara.ac.jp, - Mi hisho@tasihara.nest.or.jp, - and... Miss ARAI Akino(^^;) - ----------------------------------------------------*/ -#if defined(NeXT) && (NS_TARGET_MAJOR < 4)/* NeXTSTEP rld functions */ - - { - unsigned long init_address; - char *object_files[2] = {NULL, NULL}; - - void (*init_fct)(); - - object_files[0] = file; - - /* Load object file, if return value ==0 , load failed*/ - if(rld_load(NULL, NULL, object_files, NULL) == 0) { - rb_loaderror("Failed to load %.200s", file); - } - - /* lookup the initial function */ - if(rld_lookup(NULL, buf, &init_address) == 0) { - rb_loaderror("Failed to lookup Init function %.200s", file); - } - free(buf); - - /* Cannot call *init_address directory, so copy this value to - funtion pointer */ - - init_fct = (void(*)())init_address; - (*init_fct)(); - return (void*)init_address; - } -#else/* OPENSTEP dyld functions */ - { - int dyld_result; - NSObjectFileImage obj_file; /* handle, but not use it */ - /* "file" is module file name . - "buf" is pointer to initial function name with "_" . */ - - void (*init_fct)(); - - - dyld_result = NSCreateObjectFileImageFromFile(file, &obj_file); - - if (dyld_result != NSObjectFileImageSuccess) { - rb_loaderror("Failed to load %.200s", file); - } - - NSLinkModule(obj_file, file, NSLINKMODULE_OPTION_BINDNOW); - - /* lookup the initial function */ - /*NSIsSymbolNameDefined require function name without "_" */ - if(NSIsSymbolNameDefined(buf + 1)) { - rb_loaderror("Failed to lookup Init function %.200s",file); - } - - /* NSLookupAndBindSymbol require function name with "_" !! */ - init_fct = NSAddressOfSymbol(NSLookupAndBindSymbol(buf)); - free(buf); - (*init_fct)(); - - return (void*)init_fct; - } -#endif /* rld or dyld */ -#endif - -#ifdef __BEOS__ -# define DLN_DEFINED - { - status_t err_stat; /* BeOS error status code */ - image_id img_id; /* extention module unique id */ - void (*init_fct)(); /* initialize function for extention module */ - - /* load extention module */ - img_id = load_add_on(file); - if (img_id <= 0) { - 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 ? */ - err_stat = get_image_symbol(img_id, buf, - B_SYMBOL_TYPE_TEXT, (void **)&init_fct); - - if (err_stat != B_NO_ERROR) { - 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, (void **)&init_fct); - } - - if ((B_BAD_IMAGE_ID == err_stat) || (B_BAD_INDEX == err_stat)) { - unload_add_on(img_id); - free(buf); - 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); - free(buf); - rb_loaderror(errmsg, strerror(err_stat), buf); - } - - free(buf); - /* call module initialize function. */ - (*init_fct)(); - return (void*)img_id; - } -#endif /* __BEOS__*/ - -#ifdef __MACOS__ -# define DLN_DEFINED - { - OSErr err; - FSSpec libspec; - CFragConnectionID connID; - Ptr mainAddr; - char errMessage[1024]; - Boolean isfolder, didsomething; - Str63 fragname; - Ptr symAddr; - CFragSymbolClass class; - void (*init_fct)(); - char fullpath[MAXPATHLEN]; - - strcpy(fullpath, file); - - /* resolve any aliases to find the real file */ - c2pstr(fullpath); - (void)FSMakeFSSpec(0, 0, fullpath, &libspec); - err = ResolveAliasFile(&libspec, 1, &isfolder, &didsomething); - if (err) { - rb_loaderror("Unresolved Alias - %s", file); - } - - /* Load the fragment (or return the connID if it is already loaded */ - fragname[0] = 0; - err = GetDiskFragment(&libspec, 0, 0, fragname, - kLoadCFrag, &connID, &mainAddr, - errMessage); - 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); - free(buf); - if (err) { - rb_loaderror("Unresolved symbols - %s" , file); - } - init_fct = (void (*)())symAddr; - (*init_fct)(); - return (void*)init_fct; - } -#endif /* __MACOS__ */ - -#if defined(__VMS) -#define DLN_DEFINED - { - void *handle, (*init_fct)(); - char *fname, *p1, *p2; - - fname = (char *)__alloca(strlen(file)+1); - strcpy(fname,file); - if (p1 = strrchr(fname,'/')) - fname = p1 + 1; - if (p2 = strrchr(fname,'.')) - *p2 = '\0'; - - if ((handle = (void*)dlopen(fname, 0)) == NULL) { - error = dln_strerror(); - goto failed; - } - - if ((init_fct = (void (*)())dlsym(handle, buf)) == NULL) { - error = DLN_ERROR(); - dlclose(handle); - goto failed; - } - /* Call the init code */ - (*init_fct)(); - return handle; - } -#endif /* __VMS */ - -#ifndef DLN_DEFINED - rb_notimplement(); -#endif - -#endif /* USE_DLN_A_OUT */ -#endif -#if !defined(_AIX) && !defined(NeXT) - failed: - rb_loaderror("%s - %s", error, file); -#endif - return 0; /* dummy return */ -} - -static char *dln_find_1(); - -char * -dln_find_exe(fname, path) - const char *fname; - const char *path; -{ - if (!path) { -#if defined(__human68k__) - path = getenv("path"); -#else - path = getenv("PATH"); -#endif - } - - if (!path) { -#if defined(MSDOS) || defined(NT) || defined(__human68k__) || defined(__MACOS__) - path = "/usr/local/bin;/usr/ucb;/usr/bin;/bin;."; -#else - path = "/usr/local/bin:/usr/ucb:/usr/bin:/bin:."; -#endif - } - return dln_find_1(fname, path, 1); -} - -char * -dln_find_file(fname, 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__) -const char * -conv_to_posix_path(win32, posix, len) - char *win32; - char *posix; - int len; -{ - char *first = win32; - char *p = win32; - char *dst = posix; - - for (p = win32; *p; p++) - if (*p == ';') { - *p = 0; - cygwin32_conv_to_posix_path(first, posix); - posix += strlen(posix); - *posix++ = ':'; - first = p + 1; - *p = ';'; - } - if (len < strlen(first)) - fprintf(stderr, "PATH length too long: %s\n", first); - else - cygwin32_conv_to_posix_path(first, posix); - return dst; -} -#endif - -static char fbuf[MAXPATHLEN]; - -static char * -dln_find_1(fname, path, exe_flag) - char *fname; - char *path; - int exe_flag; /* non 0 if looking for executable. */ -{ - register char *dp; - register char *ep; - register char *bp; - struct stat st; -#ifdef __MACOS__ - const char* mac_fullpath; -#endif - - 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__) || defined(__EMX__) - if (fname[0] == '\\') return fname; - if (strlen(fname) > 2 && fname[1] == ':') return fname; - if (strncmp(".\\", fname, 2) == 0 || strncmp("..\\", fname, 3) == 0) - return fname; - if (exe_flag && strchr(fname, '\\')) return fname; -#endif - - for (dp = path;; dp = ++ep) { - register int l; - int i; - int fspace; - - /* extract a component */ - ep = strchr(dp, PATH_SEP[0]); - if (ep == NULL) - ep = dp+strlen(dp); - - /* find the length of that component */ - l = ep - dp; - bp = fbuf; - fspace = sizeof fbuf - 2; - if (l > 0) { - /* - ** If the length of the component is zero length, - ** start from the current directory. If the - ** component begins with "~", start from the - ** user's $HOME environment variable. Otherwise - ** take the path literally. - */ - - if (*dp == '~' && (l == 1 || -#if defined(MSDOS) || defined(NT) || defined(__human68k__) || defined(__EMX__) - dp[1] == '\\' || -#endif - dp[1] == '/')) { - char *home; - - home = getenv("HOME"); - if (home != NULL) { - i = strlen(home); - if ((fspace -= i) < 0) - goto toolong; - memcpy(bp, home, i); - bp += i; - } - dp++; - l--; - } - if (l > 0) { - if ((fspace -= l) < 0) - goto toolong; - memcpy(bp, dp, l); - bp += l; - } - - /* add a "/" between directory and filename */ - if (ep[-1] != '/') - *bp++ = '/'; - } - - /* now append the file name */ - i = strlen(fname); - if ((fspace -= i) < 0) { - toolong: - fprintf(stderr, "openpath: pathname too long (ignored)\n"); - *bp = '\0'; - fprintf(stderr, "\tDirectory \"%s\"\n", fbuf); - fprintf(stderr, "\tFile \"%s\"\n", fname); - continue; - } - memcpy(bp, fname, i + 1); - -#ifndef __MACOS__ - if (stat(fbuf, &st) == 0) { - if (exe_flag == 0) return fbuf; - /* looking for executable */ - if (!S_ISDIR(st.st_mode) && eaccess(fbuf, X_OK) == 0) - return fbuf; - } -#else - if (mac_fullpath = _macruby_exist_file_in_libdir_as_posix_name(fbuf)) { - if (exe_flag == 0) return mac_fullpath; - /* looking for executable */ - if (stat(mac_fullpath, &st) == 0) { - if (!S_ISDIR(st.st_mode) && eaccess(mac_fullpath, X_OK) == 0) - return mac_fullpath; - } - } -#endif -#if defined(MSDOS) || defined(NT) || defined(__human68k__) || defined(__EMX__) - if (exe_flag) { - static const char *extension[] = { -#if defined(MSDOS) - ".com", ".exe", ".bat", -#if defined(DJGPP) - ".btm", ".sh", ".ksh", ".pl", ".sed", -#endif -#elif defined(__EMX__) || defined(NT) - ".exe", ".com", ".cmd", ".bat", -/* end of __EMX__ or NT*/ -#else - ".r", ".R", ".x", ".X", ".bat", ".BAT", -/* __human68k__ */ -#endif - (char *) NULL - }; - int j; - - for (j = 0; extension[j]; j++) { - if (fspace < strlen(extension[j])) { - fprintf(stderr, "openpath: pathname too long (ignored)\n"); - fprintf(stderr, "\tDirectory \"%.*s\"\n", (int) (bp - fbuf), fbuf); - fprintf(stderr, "\tFile \"%s%s\"\n", fname, extension[j]); - 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__ or __EMX__ */ - /* if not, and no other alternatives, life is bleak */ - if (*ep == '\0') { - return NULL; - } - - /* otherwise try the next component in the search path */ - } -} diff --git a/dln.h b/dln.h deleted file mode 100644 index adef813953..0000000000 --- a/dln.h +++ /dev/null @@ -1,40 +0,0 @@ -/********************************************************************** - - dln.h - - - $Author$ - $Date$ - created at: Wed Jan 19 16:53:09 JST 1994 - - Copyright (C) 1993-2002 Yukihiro Matsumoto - -**********************************************************************/ - -#ifndef DLN_H -#define DLN_H - -#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 _((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 _((const char*)); -#endif diff --git a/dmyext.c b/dmyext.c deleted file mode 100644 index 4120d493c3..0000000000 --- a/dmyext.c +++ /dev/null @@ -1,4 +0,0 @@ -void -Init_ext() -{ -} diff --git a/doc/NEWS b/doc/NEWS deleted file mode 100644 index 521a5f268d..0000000000 --- a/doc/NEWS +++ /dev/null @@ -1,525 +0,0 @@ -: parser - - %W(...) notation, word list literal like %w(...) with the - exception that #{} interpolation is allowed. - -: parser - - Now arbitrary statements are allowed inside #{} interpolation - without escapes. In other hand, they can no longer access to - variables defined in eval. - -: parser - - Digits preceded minus sign is a literal integer. - -: IO::sysopen - - a new method to get a raw file descriptor. - -: 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. - -: Thread#join - - Optional argument limits maximum time to wait the thread in second. - And returns nil if timed out. - -: dl module - - Imported. An interface to the dynamic linker. - -: IO#sysseek - - Added. - -: IO - - 64bit off_t support by Janathan Baker. - -: abort() - - optional terminate message argument. - -: iconv module - - Imported. Wrapper library of (({iconv})). - -: Dir::glob - - Now accepts optional FNM_* flags via the second argument, whereas - Dir::[] doesn't. - - Dir.glob("makefile", File::FNM_CASEFOLD) #=> ['Makefile', 'makefile'] - -: fileutils module - - Imported. File utility library. - -: racc runtime module - - Imported. Racc runtime library. (Racc is a parser generator for ruby) - -: tsort module - - Imported. Topological sorting library. - -: stringio module - - Imported. Pseudo (({IO})) class from/to (({String})). - -: strscan module - - Imported. Fast string scanner library. - -: 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#fill - - takes block to get the values to fill. - -: Array#new - - takes block to get the values to fill. - -: Array#fetch - - takes block to get the default value. - -: Hash#update - - takes block to resolve key conflict. - -: IO#fsync - - Added. - -: 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 - -: allocation framework - - any instance of class can be allocated by class.allocate, - (except a few classes). - -: break and next - - Extended to take an optional expression, which is used as a value - for termination. [experimental] - -: 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. - -: expression parenthesis in the first argument - - Experimentally 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 - - is 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 < -: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] - -: pp module - - Imported. Prity Printing library. - -: open - - Extended so that when the third argument is permission flags it - calls open(2) instead of fopen(3). - -: Array#fetch - - Added. - -: 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] - -: Curses - - Updated. New methods and constants for using the mouse, character - attributes, colors and key codes have been 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 - } - } - -: Enumerable#all? -: Enumerable#any? -: Enumerable#inject -: Enumerable#sort_by - - Added. - -: 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. - -: IO#puts - - do not treat Array specially. - -: IO.for_fd - - Added. - -: IO.read - - Added. [ruby-talk:9460] - -: Interrupt - - Made a subclass of SignalException. (It was a subclass of - Exception in 1.6 and prior) - -: Marshal - - Fixed not to dump anonymous classes/modules. - - Fixed with loading modules. - -: MatchData#to_ary - - Added for convenience of Regexp#match. [ruby-dev:12766] - - Previously we had to do: - - foo, bar, baz = /(\w+?)\s+(\w+?)\s+(\w+)/.match("foo bar baz").to_a[1..-1] - p [foo, bar, baz] - - But now can do: - - _, foo, bar, baz = /(\w+?)\s+(\w+?)\s+(\w+)/.match("foo bar baz") - p [foo, bar, baz] - -: Math.acos(x) -: Math.asin(x) -: Math.atan(x) -: Math.cosh(x) -: Math.hypot(x,y) -: Math.sinh(x) -: Math.tanh(x) - - Added. - -: Method#== - - Added. - -: 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. - -: Multiple assignment behavior - - Fixed so that "*a = nil" results in "a == []". - -: NameError and NoMethodError - - Moved and now NoMethodError < NameError < StandardError. - -: NoMethodError - - Added. [ruby-dev:12763] - -: NotImplementError - - Finally obsoleted. Use NotImplementedError. - -: Object#singleton_method_removed -: Object#singleton_method_undefined - - Added. - -: Proc#== - - Added. - -: Proc#yield - - Added. This is equivalent to Proc#call except it does not check the - number of given arguments, which are thus passed to the proc as-is. - -: 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. - -: Range#step([step=1]) - - Added. - -: Range#to_ary - - Added. You can now do something like this: - - a, b, c = 1..3 - -: Regexp#options - - Added. - -: Regexp.last_match(n) - - Extended to take an optional argument. - -: Signal - - Added. This module has module functions Signal.trap and Signal.list. - -: 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. - -: String#[regexp, nth] - - Extended to accepts optional second argument. - - 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] - -: SystemCallError.=== - - Added. (See the "Comparison of exception classes in a rescue clause" - paragraph above) [ruby-dev:12670] - -: SystemExit#status - - Added. - -: 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. - -: 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. - -To be investigated: - - Sat Feb 24 03:15:49 2001 Yukihiro Matsumoto - - * io.c (set_stdin): preserve original stdin. - - * io.c (set_outfile): preserve original stdout/stderr. - diff --git a/doc/forwardable.rd b/doc/forwardable.rd deleted file mode 100644 index 7272c374b6..0000000000 --- a/doc/forwardable.rd +++ /dev/null @@ -1,84 +0,0 @@ - -- 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 deleted file mode 100644 index d928fddc5e..0000000000 --- a/doc/forwardable.rd.ja +++ /dev/null @@ -1,81 +0,0 @@ - -- 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/shell.rd b/doc/shell.rd deleted file mode 100644 index 02ee1b020a..0000000000 --- a/doc/shell.rd +++ /dev/null @@ -1,348 +0,0 @@ - -- 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 as a Shell method - . - - 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
 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
-      .
-
-== Process management
-
---- Shell#jobs
-
-      Returns a list of scheduled jobs.
-
---- Shell#kill sig, job
-
-      Sends a signal  to .
-
-== Current directory operations
-
---- Shell#cd(path, &block)
---- Shell#chdir
-
-      Changes the current directory to .  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 .  If  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  with .
-
-      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 .
-
-== 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 , which is either a string of a file name or an
-      IO.
-
---- Filter#>(to)
-
-      Outputs to , which is either a string of a file name or an
-      IO.
-
---- Filter#>>(to)
-
-      Appends the ouput 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
deleted file mode 100644
index 073e71ea42..0000000000
--- a/doc/shell.rd.ja
+++ /dev/null
@@ -1,336 +0,0 @@
- -- shell.rb
-				$Release Version: 0.6.0 $
-			   	$Revision$
-			   	$Date$
-			   	by Keiju ISHITSUKA(keiju@ishitsuka.com)
-
-=begin
-
-= 目的
-
-ruby上でsh/cshのようにコマンドの実行及びフィルタリングを手軽に行う.
-sh/cshの制御文はrubyの機能を用いて実現する.
-
-= 主なクラス一覧
-
-== Shell
-
-Shellオブジェクトはカレントディレクトリを持ち, コマンド実行はそこからの
-相対パスになります.
-
---- Shell#cwd
---- Shell#dir
---- Shell#getwd
---- Shell#pwd
-
-      カレントディレクトリを返す。
-
---- Shell#system_path
-
-      コマンドサーチパスの配列を返す。
-
---- Shell#umask
-
-      umaskを返す。
-
-== Filter
-
-コマンドの実行結果はすべてFilterとしてかえります. Enumerableをincludeし
-ています.
-
-= 主なメソッド一覧
-
-== コマンド定義
-
-OS上のコマンドを実行するにはまず, Shellのメソッドとして定義します.
-
-注) コマンドを定義しなくとも直接実行できるShell#systemコマンドもあります.
-
---- Shell.def_system_command(command, path = command)
-
-      Shellのメソッドとしてcommandを登録します. 
-
-      例)
-      Shell.def_system_command "ls"
-        ls を定義
-
-      Shell.def_system_command "sys_sort", "sort"
-        sortコマンドをsys_sortとして定義
-
---- Shell.undef_system_command(command)
-
-      commandを削除します.
-
---- Shell.alias_command(ali, command, *opts) {...}
-
-      commandのaliasをします. 
-
-      例)
-        Shell.alias_command "lsC", "ls", "-CBF", "--show-control-chars"
-        Shell.alias_command("lsC", "ls"){|*opts| ["-CBF", "--show-control-chars", *opts]}
-
---- Shell.unalias_command(ali)
-
-      commandのaliasを削除します.
-
---- Shell.install_system_commands(pre = "sys_")
-
-      system_path上にある全ての実行可能ファイルをShellに定義する. メソッ
-      ド名は元のファイル名の頭にpreをつけたものとなる.
-
-== 生成
-
---- Shell.new
-
-      プロセスのカレントディレクトリをカレントディレクトリとするShellオ
-      ブジェクトを生成します.
-
---- Shell.cd(path)
-
-      pathをカレントディレクトリとするShellオブジェクトを生成します.
-
-== プロセス管理
-
---- Shell#jobs
-
-      スケジューリングされているjobの一覧を返す.
-
---- Shell#kill sig, job
-
-      jobにシグナルsigを送る
-
-== カレントディレクトリ操作
-
---- 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
-
-      ブロック中ではshellをselfとして実行する.
-      例)
-        sh.transact{system("ls", "-l") | head > STDOUT}
-
---- Shell#out(dev = STDOUT, &block)
-
-      transactを呼び出しその結果をdevに出力する.
-
-== 内部コマンド
-
---- 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
deleted file mode 100644
index f426bc3303..0000000000
--- a/enum.c
+++ /dev/null
@@ -1,521 +0,0 @@
-/**********************************************************************
-
-  enum.c -
-
-  $Author$
-  $Date$
-  created at: Fri Oct  1 15:15:19 JST 1993
-
-  Copyright (C) 1993-2002 Yukihiro Matsumoto
-
-**********************************************************************/
-
-#include "ruby.h"
-#include "node.h"
-#include "util.h"
-
-VALUE rb_mEnumerable;
-static ID id_each, id_eqq, id_cmp;
-
-VALUE
-rb_each(obj)
-    VALUE obj;
-{
-    return rb_funcall(obj, id_each, 0, 0);
-}
-
-static VALUE
-grep_i(i, arg)
-    VALUE i, *arg;
-{
-    if (RTEST(rb_funcall(arg[0], id_eqq, 1, i))) {
-	rb_ary_push(arg[1], i);
-    }
-    return Qnil;
-}
-
-static VALUE
-grep_iter_i(i, arg)
-    VALUE i, *arg;
-{
-    if (RTEST(rb_funcall(arg[0], id_eqq, 1, i))) {
-	rb_ary_push(arg[1], rb_yield(i));
-    }
-    return Qnil;
-}
-
-static VALUE
-enum_grep(obj, pat)
-    VALUE obj, pat;
-{
-    VALUE ary = rb_ary_new();
-    VALUE arg[2];
-
-    arg[0] = pat;
-    arg[1] = ary;
-
-    rb_iterate(rb_each, obj, rb_block_given_p() ? grep_iter_i : grep_i, (VALUE)arg);
-    
-    return ary;
-}
-
-static VALUE
-find_i(i, memo)
-    VALUE i;
-    NODE *memo;
-{
-    if (RTEST(rb_yield(i))) {
-	memo->u2.value = Qtrue;
-	memo->u1.value = i;
-	rb_iter_break();
-    }
-    return Qnil;
-}
-
-static VALUE
-enum_find(argc, argv, obj)
-    int argc;
-    VALUE* argv;
-    VALUE obj;
-{
-    NODE *memo = rb_node_newnode(NODE_MEMO, Qnil, Qfalse, 0);
-    VALUE if_none;
-
-    rb_scan_args(argc, argv, "01", &if_none);
-    rb_iterate(rb_each, obj, find_i, (VALUE)memo);
-    if (memo->u2.value) {
-	VALUE result = memo->u1.value;
-	rb_gc_force_recycle((VALUE)memo);
-	return result;
-    }
-    rb_gc_force_recycle((VALUE)memo);
-    if (!NIL_P(if_none)) {
-	rb_eval_cmd(if_none, rb_ary_new2(0), 0);
-    }
-    return Qnil;
-}
-
-static VALUE
-find_all_i(i, ary)
-    VALUE i, ary;
-{
-    if (RTEST(rb_yield(i))) {
-	rb_ary_push(ary, i);
-    }
-    return Qnil;
-}
-
-static VALUE
-enum_find_all(obj)
-    VALUE obj;
-{
-    VALUE ary = rb_ary_new();
-    
-    rb_iterate(rb_each, obj, find_all_i, ary);
-
-    return ary;
-}
-
-static VALUE
-reject_i(i, ary)
-    VALUE i, ary;
-{
-    if (!RTEST(rb_yield(i))) {
-	rb_ary_push(ary, i);
-    }
-    return Qnil;
-}
-
-static VALUE
-enum_reject(obj)
-    VALUE obj;
-{
-    VALUE ary = rb_ary_new();
-    
-    rb_iterate(rb_each, obj, reject_i, ary);
-
-    return ary;
-}
-
-static VALUE
-collect_i(i, ary)
-    VALUE i, ary;
-{
-    rb_ary_push(ary, rb_yield(i));
-    
-    return Qnil;
-}
-
-static VALUE
-collect_all(i, ary)
-    VALUE i, ary;
-{
-    rb_ary_push(ary, i);
-    
-    return Qnil;
-}
-
-static VALUE
-enum_to_a(obj)
-    VALUE obj;
-{
-    VALUE ary = rb_ary_new();
-    
-    rb_iterate(rb_each, obj, collect_all, ary);
-
-    return ary;
-}
-
-static VALUE
-enum_collect(obj)
-    VALUE obj;
-{
-    VALUE ary = rb_ary_new();
-    
-    rb_iterate(rb_each, obj, rb_block_given_p() ? collect_i : collect_all, ary);
-
-    return ary;
-}
-
-static VALUE
-inject_i(i, memo)
-    VALUE i;
-    NODE *memo;
-{
-    if (memo->u2.value) {
-        memo->u2.value = Qfalse;
-        memo->u1.value = i;
-    }
-    else {
-        memo->u1.value = rb_yield(rb_assoc_new(memo->u1.value, i));
-    }
-    return Qnil;
-}
-
-static VALUE
-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;
-    rb_gc_force_recycle((VALUE)memo);
-    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;
-}
-
-static VALUE
-enum_partition(obj)
-    VALUE obj;
-{
-    VALUE ary[2];
-
-    ary[0] = rb_ary_new();
-    ary[1] = rb_ary_new();
-    rb_iterate(rb_each, obj, partition_i, (VALUE)ary);
-
-    return rb_assoc_new(ary[0], ary[1]);
-}
-
-static VALUE
-enum_sort(obj)
-    VALUE obj;
-{
-    return rb_ary_sort(enum_to_a(obj));
-}
-
-static VALUE
-sort_by_i(i, ary)
-    VALUE i, ary;
-{
-    VALUE v, e;
-
-    v = rb_yield(i);
-    e = rb_assoc_new(v, i);
-    rb_ary_push(ary, e);
-    return Qnil;
-}
-
-static int
-sort_by_cmp(a, b)
-    VALUE *a, *b;
-{
-    VALUE retval;
-
-    retval = rb_funcall(RARRAY(*a)->ptr[0], id_cmp, 1, RARRAY(*b)->ptr[0]);
-    return rb_cmpint(retval);
-}
-
-static VALUE
-enum_sort_by(obj)
-    VALUE obj;
-{
-    VALUE ary;
-    long i;
-
-    ary  = rb_ary_new2((TYPE(obj) == T_ARRAY) ? RARRAY(obj)->len : 2000);
-    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);
-    }
-    for (i=0; ilen; i++) {
-	VALUE e = RARRAY(ary)->ptr[i];
-	RARRAY(ary)->ptr[i] = RARRAY(e)->ptr[1];
-    }
-    return ary;
-}
-
-static VALUE
-all_i(i, memo)
-    VALUE i;
-    NODE *memo;
-{
-    if (!RTEST(rb_yield(i))) {
-	memo->u1.value = Qfalse;
-	rb_iter_break();
-    }
-    return Qnil;
-}
-
-static VALUE
-enum_all(obj)
-    VALUE obj;
-{
-    VALUE result;
-    NODE *memo = rb_node_newnode(NODE_MEMO, Qnil, 0, 0);
-
-    memo->u1.value = Qtrue;
-    rb_iterate(rb_each, obj, all_i, (VALUE)memo);
-    result = memo->u1.value;
-    rb_gc_force_recycle((VALUE)memo);
-    return result;
-}
-
-static VALUE
-any_i(i, memo)
-    VALUE i;
-    NODE *memo;
-{
-    if (RTEST(rb_yield(i))) {
-	memo->u1.value = Qtrue;
-	rb_iter_break();
-    }
-    return Qnil;
-}
-
-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, any_i, (VALUE)memo);
-    result = memo->u1.value;
-    rb_gc_force_recycle((VALUE)memo);
-    return result;
-}
-
-static VALUE
-min_i(i, memo)
-    VALUE i;
-    NODE *memo;
-{
-    VALUE cmp;
-
-    if (NIL_P(memo->u1.value)) {
-	memo->u1.value = i;
-    }
-    else {
-	cmp = rb_funcall(i, id_cmp, 1, memo->u1.value);
-	if (rb_cmpint(cmp) < 0) {
-	    memo->u1.value = i;
-	}
-    }
-    return Qnil;
-}
-
-static VALUE
-min_ii(i, memo)
-    VALUE i;
-    NODE *memo;
-{
-    VALUE cmp;
-
-    if (NIL_P(memo->u1.value)) {
-	memo->u1.value = i;
-    }
-    else {
-	cmp = rb_yield(rb_assoc_new(i, memo->u1.value));
-	if (rb_cmpint(cmp) < 0) {
-	    memo->u1.value = i;
-	}
-    }
-    return Qnil;
-}
-
-static VALUE
-enum_min(obj)
-    VALUE obj;
-{
-    VALUE result;
-    NODE *memo = rb_node_newnode(NODE_MEMO, Qnil, 0, 0);
-
-    rb_iterate(rb_each, obj, rb_block_given_p() ? min_ii : min_i, (VALUE)memo);
-    result = memo->u1.value;
-    rb_gc_force_recycle((VALUE)memo);
-    return result;
-}
-
-static VALUE
-max_i(i, memo)
-    VALUE i;
-    NODE *memo;
-{
-    VALUE cmp;
-
-    if (NIL_P(memo->u1.value)) {
-	memo->u1.value = i;
-    }
-    else {
-	cmp = rb_funcall(i, id_cmp, 1, memo->u1.value);
-	if (rb_cmpint(cmp) > 0) {
-	    memo->u1.value = i;
-	}
-    }
-    return Qnil;
-}
-
-static VALUE
-max_ii(i, memo)
-    VALUE i;
-    NODE *memo;
-{
-    VALUE cmp;
-
-    if (NIL_P(memo->u1.value)) {
-	memo->u1.value = i;
-    }
-    else {
-	cmp = rb_yield(rb_assoc_new(i, memo->u1.value));
-	if (rb_cmpint(cmp) > 0) {
-	    memo->u1.value = i;
-	}
-    }
-    return Qnil;
-}
-
-static VALUE
-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;
-    rb_gc_force_recycle((VALUE)memo);
-    return result;
-}
-
-static VALUE
-member_i(item, memo)
-    VALUE item;
-    NODE *memo;
-{
-    if (rb_equal(item, memo->u1.value)) {
-	memo->u2.value = Qtrue;
-	rb_iter_break();
-    }
-    return Qnil;
-}
-
-static VALUE
-enum_member(obj, val)
-    VALUE obj, val;
-{
-    VALUE result;
-    NODE *memo = rb_node_newnode(NODE_MEMO, val, Qfalse, 0);
-
-    rb_iterate(rb_each, obj, member_i, (VALUE)memo);
-    result = memo->u2.value;
-    rb_gc_force_recycle((VALUE)memo);
-    return result;
-}
-
-static VALUE
-each_with_index_i(val, memo)
-    VALUE val;
-    NODE *memo;
-{
-    rb_yield(rb_assoc_new(val, INT2FIX(memo->u3.cnt)));
-    memo->u3.cnt++;
-    return Qnil;
-}
-
-static VALUE
-enum_each_with_index(obj)
-    VALUE obj;
-{
-    NODE *memo = rb_node_newnode(NODE_MEMO, 0, 0, 0);
-
-    rb_iterate(rb_each, obj, each_with_index_i, (VALUE)memo);
-    rb_gc_force_recycle((VALUE)memo);
-    return obj;
-}
-
-void
-Init_Enumerable()
-{
-    rb_mEnumerable = rb_define_module("Enumerable");
-
-    rb_define_method(rb_mEnumerable,"to_a", enum_to_a, 0);
-    rb_define_method(rb_mEnumerable,"entries", enum_to_a, 0);
-
-    rb_define_method(rb_mEnumerable,"sort", enum_sort, 0);
-    rb_define_method(rb_mEnumerable,"sort_by", enum_sort_by, 0);
-    rb_define_method(rb_mEnumerable,"grep", enum_grep, 1);
-    rb_define_method(rb_mEnumerable,"find", enum_find, -1);
-    rb_define_method(rb_mEnumerable,"detect", enum_find, -1);
-    rb_define_method(rb_mEnumerable,"find_all", enum_find_all, 0);
-    rb_define_method(rb_mEnumerable,"select", enum_find_all, 0);
-    rb_define_method(rb_mEnumerable,"reject", enum_reject, 0);
-    rb_define_method(rb_mEnumerable,"collect", enum_collect, 0);
-    rb_define_method(rb_mEnumerable,"map", enum_collect, 0);
-    rb_define_method(rb_mEnumerable,"inject", enum_inject, -1);
-    rb_define_method(rb_mEnumerable,"partition", enum_partition, 0);
-    rb_define_method(rb_mEnumerable,"all?", enum_all, 0);
-    rb_define_method(rb_mEnumerable,"any?", enum_any, 0);
-    rb_define_method(rb_mEnumerable,"min", enum_min, 0);
-    rb_define_method(rb_mEnumerable,"max", enum_max, 0);
-    rb_define_method(rb_mEnumerable,"member?", enum_member, 1);
-    rb_define_method(rb_mEnumerable,"include?", enum_member, 1);
-    rb_define_method(rb_mEnumerable,"each_with_index", enum_each_with_index, 0);
-
-    id_eqq  = rb_intern("===");
-    id_each = rb_intern("each");
-    id_cmp  = rb_intern("<=>");
-}
-
diff --git a/env.h b/env.h
deleted file mode 100644
index b185d1262f..0000000000
--- a/env.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/**********************************************************************
-
-  env.h -
-
-  $Author$
-  $Date$
-  created at: Mon Jul 11 11:53:03 JST 1994
-
-  Copyright (C) 1993-2002 Yukihiro Matsumoto
-
-**********************************************************************/
-
-#ifndef ENV_H
-#define ENV_H
-
-extern struct FRAME {
-    VALUE self;
-    int argc;
-    VALUE *argv;
-    ID last_func;
-    VALUE last_class;
-    VALUE cbase;
-    struct FRAME *prev;
-    struct FRAME *tmp;
-    char *file;
-    int line;
-    int iter;
-    int flags;
-} *ruby_frame;
-
-void rb_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 flags;
-} *ruby_scope;
-
-#define SCOPE_ALLOCA  0
-#define SCOPE_MALLOC  1
-#define SCOPE_NOSTACK 2
-#define SCOPE_DONT_RECYCLE 4
-
-extern int ruby_in_eval;
-
-extern VALUE ruby_class;
-
-struct RVarmap {
-    struct RBasic super;
-    ID id;
-    VALUE val;
-    struct RVarmap *next;
-};
-extern struct RVarmap *ruby_dyna_vars;
-
-#endif /* ENV_H */
diff --git a/error.c b/error.c
deleted file mode 100644
index 26c16328df..0000000000
--- a/error.c
+++ /dev/null
@@ -1,1230 +0,0 @@
-/**********************************************************************
-
-  error.c -
-
-  $Author$
-  $Date$
-  created at: Mon Aug  9 16:11:34 JST 1993
-
-  Copyright (C) 1993-2002 Yukihiro Matsumoto
-
-**********************************************************************/
-
-#include "ruby.h"
-#include "env.h"
-#include "version.h"
-
-#include 
-#ifdef HAVE_STDARG_PROTOTYPES
-#include 
-#define va_init_list(a,b) va_start(a,b)
-#else
-#include 
-#define va_init_list(a,b) va_start(a)
-#endif
-
-#if defined __CYGWIN__
-# include 
-# if (CYGWIN_VERSION_API_MAJOR > 0) || (CYGWIN_VERSION_API_MINOR >= 8)
-#  define sys_nerr _sys_nerr
-# endif
-#endif
-
-int ruby_nerrs;
-
-static void
-err_snprintf(buf, len, fmt, args)
-    char *buf, *fmt;
-    int len;
-    va_list args;
-{
-    int n;
-
-    if (!ruby_sourcefile) {
-	vsnprintf(buf, len, fmt, args);
-	return;
-    }
-    else if (ruby_sourceline == 0) {
-	n = snprintf(buf, len, "%s: ", ruby_sourcefile);
-    }
-    else {
-	n = snprintf(buf, len, "%s:%d: ", ruby_sourcefile, ruby_sourceline);
-    }
-    if (len > n) {
-	vsnprintf((char*)buf+n, len-n, fmt, args);
-    }
-}
-
-static void err_append _((const char*));
-static void
-err_print(fmt, args)
-    const char *fmt;
-    va_list args;
-{
-    char buf[BUFSIZ];
-
-    err_snprintf(buf, BUFSIZ, fmt, args);
-    err_append(buf);
-}
-
-void
-#ifdef HAVE_STDARG_PROTOTYPES
-rb_compile_error(const char *fmt, ...)
-#else
-rb_compile_error(fmt, va_alist)
-    const char *fmt;
-    va_dcl
-#endif
-{
-    va_list args;
-
-    va_init_list(args, fmt);
-    err_print(fmt, args);
-    va_end(args);
-    ruby_nerrs++;
-}
-
-void
-#ifdef HAVE_STDARG_PROTOTYPES
-rb_compile_error_append(const char *fmt, ...)
-#else
-rb_compile_error_append(fmt, va_alist)
-    const char *fmt;
-    va_dcl
-#endif
-{
-    va_list args;
-    char buf[BUFSIZ];
-
-    va_init_list(args, fmt);
-    vsnprintf(buf, BUFSIZ, fmt, args);
-    va_end(args);
-    err_append(buf);
-}
-
-static void
-warn_print(fmt, args)
-    const char *fmt;
-    va_list args;
-{
-    char buf[BUFSIZ];
-
-    err_snprintf(buf, BUFSIZ, fmt, args);
-    fputs(buf, stderr);
-    fputs("\n", stderr);
-    fflush(stderr);
-}
-
-void
-#ifdef HAVE_STDARG_PROTOTYPES
-rb_warn(const char *fmt, ...)
-#else
-rb_warn(fmt, va_alist)
-    const char *fmt;
-    va_dcl
-#endif
-{
-    char buf[BUFSIZ];
-    va_list args;
-
-    snprintf(buf, BUFSIZ, "warning: %s", fmt);
-
-    va_init_list(args, fmt);
-    warn_print(buf, args);
-    va_end(args);
-}
-
-/* rb_warning() reports only in verbose mode */
-void
-#ifdef HAVE_STDARG_PROTOTYPES
-rb_warning(const char *fmt, ...)
-#else
-rb_warning(fmt, va_alist)
-    const char *fmt;
-    va_dcl
-#endif
-{
-    char buf[BUFSIZ];
-    va_list args;
-
-    if (!RTEST(ruby_verbose)) return;
-
-    snprintf(buf, BUFSIZ, "warning: %s", fmt);
-
-    va_init_list(args, fmt);
-    warn_print(buf, args);
-    va_end(args);
-}
-
-void
-#ifdef HAVE_STDARG_PROTOTYPES
-rb_bug(const char *fmt, ...)
-#else
-rb_bug(fmt, va_alist)
-    const char *fmt;
-    va_dcl
-#endif
-{
-    char buf[BUFSIZ];
-    va_list args;
-
-    snprintf(buf, BUFSIZ, "[BUG] %s", fmt);
-    ruby_in_eval = 0;
-
-    va_init_list(args, fmt);
-    warn_print(buf, args);
-    va_end(args);
-    fprintf(stderr, "ruby %s (%s) [%s]\n", RUBY_VERSION, RUBY_RELEASE_DATE, RUBY_PLATFORM);
-    abort();
-}
-
-static struct types {
-    int type;
-    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_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
-rb_check_type(x, t)
-    VALUE x;
-    int t;
-{
-    struct types *type = builtin_types;
-
-    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;
-
-		if (NIL_P(x)) {
-		    etype = "nil";
-		}
-		else if (FIXNUM_P(x)) {
-		    etype = "Fixnum";
-		}
-		else if (rb_special_const_p(x)) {
-		    etype = RSTRING(rb_obj_as_string(x))->ptr;
-		}
-		else {
-		    etype = rb_class2name(CLASS_OF(x));
-		}
-		rb_raise(rb_eTypeError, "wrong argument type %s (expected %s)",
-			 etype, type->name);
-	    }
-	    type++;
-	}
-	rb_bug("unknown type 0x%x", t);
-    }
-}
-
-/* exception classes */
-#include 
-
-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;
-
-VALUE rb_eScriptError;
-VALUE rb_eSyntaxError;
-VALUE rb_eLoadError;
-
-VALUE rb_eSystemCallError;
-VALUE rb_mErrno;
-
-VALUE
-rb_exc_new(etype, ptr, len)
-    VALUE etype;
-    const char *ptr;
-    long len;
-{
-    return rb_funcall(etype, rb_intern("new"), 1, rb_str_new(ptr, len));
-}
-
-VALUE
-rb_exc_new2(etype, s)
-    VALUE etype;
-    const char *s;
-{
-    return rb_exc_new(etype, s, strlen(s));
-}
-
-VALUE
-rb_exc_new3(etype, str)
-    VALUE etype, str;
-{
-    StringValue(str);
-    return rb_exc_new(etype, RSTRING(str)->ptr, RSTRING(str)->len);
-}
-
-static VALUE
-exc_initialize(argc, argv, exc)
-    int argc;
-    VALUE *argv;
-    VALUE exc;
-{
-    VALUE mesg;
-
-    if (rb_scan_args(argc, argv, "01", &mesg) == 1) {
-	StringValue(mesg);	/* ensure mesg can be converted to String */
-    }
-    rb_iv_set(exc, "mesg", mesg);
-    rb_iv_set(exc, "bt", Qnil);
-
-    return exc;
-}
-
-static VALUE
-exc_exception(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    VALUE exc;
-
-    if (argc == 0) return self;
-    if (argc == 1 && self == argv[0]) return self;
-    exc = rb_obj_clone(self);
-    exc_initialize(argc, argv, exc);
-
-    return exc;
-}
-
-static VALUE
-exc_to_s(exc)
-    VALUE exc;
-{
-    VALUE mesg = rb_iv_get(exc, "mesg");
-
-    if (NIL_P(mesg)) return rb_class_path(CLASS_OF(exc));
-    if (OBJ_TAINTED(exc)) OBJ_TAINT(mesg);
-    return mesg;
-}
-
-static VALUE
-exc_inspect(exc)
-    VALUE exc;
-{
-    VALUE str, klass;
-
-    klass = CLASS_OF(exc);
-    exc = rb_obj_as_string(exc);
-    if (RSTRING(exc)->len == 0) {
-	return rb_str_dup(rb_class_path(klass));
-    }
-
-    str = rb_str_buf_new2("#<");
-    klass = rb_class_path(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;
-}
-
-static VALUE
-exc_backtrace(exc)
-    VALUE exc;
-{
-    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;
-    static char *err = "backtrace must be Array of String";
-
-    if (!NIL_P(bt)) {
-	int t = TYPE(bt);
-
-	if (t == T_STRING) return rb_ary_new3(1, bt);
-	if (t != T_ARRAY) {
-	    rb_raise(rb_eTypeError, err);
-	}
-	for (i=0;ilen;i++) {
-	    if (TYPE(RARRAY(bt)->ptr[i]) != T_STRING) {
-		rb_raise(rb_eTypeError, err);
-	    }
-	}
-    }
-    return bt;
-}
-
-static VALUE
-exc_set_backtrace(exc, bt)
-    VALUE exc;
-    VALUE bt;
-{
-    return rb_iv_set(exc, "bt", check_backtrace(bt));
-}
-
-static VALUE
-exit_status(exc)
-    VALUE exc;
-{
-    return rb_iv_get(exc, "status");
-}
-
-void
-#ifdef HAVE_STDARG_PROTOTYPES
-rb_name_error(ID id, const char *fmt, ...)
-#else
-rb_name_error(id, fmt, va_alist)
-    ID id;
-    const char *fmt;
-    va_dcl
-#endif
-{
-    VALUE exc;
-
-    va_list args;
-    char buf[BUFSIZ];
-
-    va_init_list(args, fmt);
-    vsnprintf(buf, BUFSIZ, fmt, args);
-    va_end(args);
-    exc = rb_exc_new2(rb_eNameError, buf);
-    rb_iv_set(exc, "name", ID2SYM(id));
-    rb_exc_raise(exc);
-}
-
-static VALUE
-name_err_name(self)
-    VALUE self;
-{
-    return rb_iv_get(self, "name");
-}
-
-static VALUE
-nometh_err_args(self)
-    VALUE self;
-{
-    return rb_iv_get(self, "args");
-}
-
-void
-rb_invalid_str(str, type)
-    const char *str, *type;
-{
-    VALUE s = rb_str_inspect(rb_str_new2(str));
-
-    rb_raise(rb_eArgError, "invalid value for %s: %s", type, RSTRING(s)->ptr);
-}
-
-#ifdef __BEOS__
-typedef struct {
-   VALUE *list;
-   int n;
-} syserr_list_entry;
-
-typedef struct {
-   int ix;
-   int n;
-} syserr_index_entry;
-
-static VALUE syserr_error;
-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},
-};
-#else
-static VALUE *syserr_list;
-#endif
-
-#if !HAVE_DECL_SYS_NERR
-extern int sys_nerr;
-#endif
-
-static VALUE
-set_syserr(i, name)
-    int i;
-    const char *name;
-{
-#ifdef __BEOS__
-   VALUE *list;
-   int ix, offset;
-#endif
-    VALUE error = rb_define_class_under(rb_mErrno, name, rb_eSystemCallError);
-    rb_define_const(error, "Errno", INT2NUM(i));
-#ifdef __BEOS__
-   if (i == B_ERROR) {
-      syserr_error = error;
-      rb_global_variable(&syserr_error);
-      return error;
-   }
-   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;
-    }
-#endif
-    return error;
-}
-
-static VALUE
-syserr_errno(self)
-    VALUE self;
-{
-    return rb_iv_get(self, "errno");
-}
-
-static VALUE
-syserr_eqq(self, exc)
-    VALUE self, exc;
-{
-    VALUE num;
-
-    if (!rb_obj_is_kind_of(exc, rb_eSystemCallError)) return Qfalse;
-    if (self == rb_eSystemCallError) return Qtrue;
-
-    num = rb_iv_get(exc, "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"));
-    }
-    if (rb_const_get(self, rb_intern("Errno")) == num)
-	return Qtrue;
-    return Qfalse;
-}
-
-#ifdef __BEOS__
-static VALUE
-get_syserr(int i)
-{
-   VALUE *list;
-   int ix, offset;
-   
-   if (i == B_ERROR) return syserr_error;
-   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;
-}
-#endif /* __BEOS__ */
-
-static void init_syserr _((void));
-
-void
-Init_Exception()
-{
-    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_s, 0);
-    rb_define_method(rb_eException, "message", exc_to_s, 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, "status", exit_status, 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, "name", name_err_name, 0);
-    rb_eNoMethodError = rb_define_class("NoMethodError", rb_eNameError);
-    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);
-
-    init_syserr();
-}
-
-void
-#ifdef HAVE_STDARG_PROTOTYPES
-rb_raise(VALUE exc, const char *fmt, ...)
-#else
-rb_raise(exc, fmt, va_alist)
-    VALUE exc;
-    const char *fmt;
-    va_dcl
-#endif
-{
-    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
-rb_loaderror(const char *fmt, ...)
-#else
-rb_loaderror(fmt, va_alist)
-    const char *fmt;
-    va_dcl
-#endif
-{
-    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(rb_eLoadError, buf));
-}
-
-void
-rb_notimplement()
-{
-    rb_raise(rb_eNotImpError,
-	     "The %s() function is unimplemented on this machine",
-	     rb_id2name(ruby_frame->last_func));
-}
-
-void
-#ifdef HAVE_STDARG_PROTOTYPES
-rb_fatal(const char *fmt, ...)
-#else
-rb_fatal(fmt, va_alist)
-    const char *fmt;
-    va_dcl
-#endif
-{
-    va_list args;
-    char buf[BUFSIZ];
-
-    va_init_list(args, fmt);
-    vsnprintf(buf, BUFSIZ, fmt, args);
-    va_end(args);
-
-    ruby_in_eval = 0;
-    rb_exc_fatal(rb_exc_new2(rb_eFatal, buf));
-}
-
-void
-rb_sys_fail(mesg)
-    const char *mesg;
-{
-#if !defined(NT) && !defined(__VMS)
-    char *strerror();
-#endif
-    char *err;
-    char *buf;
-    extern int errno;
-    int n = errno;
-    VALUE ee;
-
-    if (errno == 0) {
-	rb_bug("rb_sys_fail() - errno == 0");
-    }
-
-#ifdef __BORLANDC__
-    if (errno == EPIPE) return; // (*moriq*)
-#endif
-    err = strerror(errno);
-    if (mesg) {
-	volatile VALUE tmp = rb_str_inspect(rb_str_new2(mesg));
-
-	buf = ALLOCA_N(char, strlen(err)+RSTRING(tmp)->len+4);
-	sprintf(buf, "%s - %s", err, RSTRING(tmp)->ptr);
-    }
-    else {
-	buf = ALLOCA_N(char, strlen(err)+1);
-	strcpy(buf, err);
-    }
-
-    errno = 0;
-#ifdef __BEOS__
-    ee = get_syserr(n);
-    if (!ee) {
-	char name[12];
-      
-	sprintf(name, "E%03d", n);
-	ee = set_syserr(n, name);
-   }
-#else
-    if (n > sys_nerr || !syserr_list[n]) {
-	char name[12];
-
-	sprintf(name, "E%03d", n);
-	ee = set_syserr(n, name);
-    }
-    else {
-	ee = syserr_list[n];
-    }
-#endif
-    ee = rb_exc_new2(ee, buf);
-    rb_iv_set(ee, "errno", INT2NUM(n));
-    rb_exc_raise(ee);
-}
-
-void
-#ifdef HAVE_STDARG_PROTOTYPES
-rb_sys_warning(const char *fmt, ...)
-#else
-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)
-    char *path;
-{
-    rb_loaderror("%s -- %s", strerror(errno), path);
-}
-
-void
-rb_error_frozen(what)
-    char *what;
-{
-    rb_raise(rb_eTypeError, "can't modify frozen %s", what);
-}
-
-static void
-init_syserr()
-{
-#ifdef __BEOS__
-   int i, ix, offset;
-#endif
-    rb_eSystemCallError = rb_define_class("SystemCallError", rb_eStandardError);
-    rb_define_method(rb_eSystemCallError, "errno", syserr_errno, 0);
-    rb_define_singleton_method(rb_eSystemCallError, "===", syserr_eqq, 1);
-
-    rb_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);
-      }
-   }
-   set_syserr(B_ERROR, "ERROR");
-#else
-    syserr_list = ALLOC_N(VALUE, sys_nerr+1);
-    MEMZERO(syserr_list, VALUE, sys_nerr+1);
-#endif
-
-#ifdef EPERM
-    set_syserr(EPERM, "EPERM");
-#endif
-#ifdef ENOENT
-    set_syserr(ENOENT, "ENOENT");
-#endif
-#ifdef ESRCH
-    set_syserr(ESRCH, "ESRCH");
-#endif
-#ifdef EINTR
-    set_syserr(EINTR, "EINTR");
-#endif
-#ifdef EIO
-    set_syserr(EIO, "EIO");
-#endif
-#ifdef ENXIO
-    set_syserr(ENXIO, "ENXIO");
-#endif
-#ifdef E2BIG
-    set_syserr(E2BIG, "E2BIG");
-#endif
-#ifdef ENOEXEC
-    set_syserr(ENOEXEC, "ENOEXEC");
-#endif
-#ifdef EBADF
-    set_syserr(EBADF, "EBADF");
-#endif
-#ifdef ECHILD
-    set_syserr(ECHILD, "ECHILD");
-#endif
-#ifdef EAGAIN
-    set_syserr(EAGAIN, "EAGAIN");
-#endif
-#ifdef ENOMEM
-    set_syserr(ENOMEM, "ENOMEM");
-#endif
-#ifdef EACCES
-    set_syserr(EACCES, "EACCES");
-#endif
-#ifdef EFAULT
-    set_syserr(EFAULT, "EFAULT");
-#endif
-#ifdef ENOTBLK
-    set_syserr(ENOTBLK, "ENOTBLK");
-#endif
-#ifdef EBUSY
-    set_syserr(EBUSY, "EBUSY");
-#endif
-#ifdef EEXIST
-    set_syserr(EEXIST, "EEXIST");
-#endif
-#ifdef EXDEV
-    set_syserr(EXDEV, "EXDEV");
-#endif
-#ifdef ENODEV
-    set_syserr(ENODEV, "ENODEV");
-#endif
-#ifdef ENOTDIR
-    set_syserr(ENOTDIR, "ENOTDIR");
-#endif
-#ifdef EISDIR
-    set_syserr(EISDIR, "EISDIR");
-#endif
-#ifdef EINVAL
-    set_syserr(EINVAL, "EINVAL");
-#endif
-#ifdef ENFILE
-    set_syserr(ENFILE, "ENFILE");
-#endif
-#ifdef EMFILE
-    set_syserr(EMFILE, "EMFILE");
-#endif
-#ifdef ENOTTY
-    set_syserr(ENOTTY, "ENOTTY");
-#endif
-#ifdef ETXTBSY
-    set_syserr(ETXTBSY, "ETXTBSY");
-#endif
-#ifdef EFBIG
-    set_syserr(EFBIG, "EFBIG");
-#endif
-#ifdef ENOSPC
-    set_syserr(ENOSPC, "ENOSPC");
-#endif
-#ifdef ESPIPE
-    set_syserr(ESPIPE, "ESPIPE");
-#endif
-#ifdef EROFS
-    set_syserr(EROFS, "EROFS");
-#endif
-#ifdef EMLINK
-    set_syserr(EMLINK, "EMLINK");
-#endif
-#ifdef EPIPE
-    set_syserr(EPIPE, "EPIPE");
-#endif
-#ifdef EDOM
-    set_syserr(EDOM, "EDOM");
-#endif
-#ifdef ERANGE
-    set_syserr(ERANGE, "ERANGE");
-#endif
-#ifdef EDEADLK
-    set_syserr(EDEADLK, "EDEADLK");
-#endif
-#ifdef ENAMETOOLONG
-    set_syserr(ENAMETOOLONG, "ENAMETOOLONG");
-#endif
-#ifdef ENOLCK
-    set_syserr(ENOLCK, "ENOLCK");
-#endif
-#ifdef ENOSYS
-    set_syserr(ENOSYS, "ENOSYS");
-#endif
-#ifdef ENOTEMPTY
-    set_syserr(ENOTEMPTY, "ENOTEMPTY");
-#endif
-#ifdef ELOOP
-    set_syserr(ELOOP, "ELOOP");
-#endif
-#ifdef EWOULDBLOCK
-    set_syserr(EWOULDBLOCK, "EWOULDBLOCK");
-#endif
-#ifdef ENOMSG
-    set_syserr(ENOMSG, "ENOMSG");
-#endif
-#ifdef EIDRM
-    set_syserr(EIDRM, "EIDRM");
-#endif
-#ifdef ECHRNG
-    set_syserr(ECHRNG, "ECHRNG");
-#endif
-#ifdef EL2NSYNC
-    set_syserr(EL2NSYNC, "EL2NSYNC");
-#endif
-#ifdef EL3HLT
-    set_syserr(EL3HLT, "EL3HLT");
-#endif
-#ifdef EL3RST
-    set_syserr(EL3RST, "EL3RST");
-#endif
-#ifdef ELNRNG
-    set_syserr(ELNRNG, "ELNRNG");
-#endif
-#ifdef EUNATCH
-    set_syserr(EUNATCH, "EUNATCH");
-#endif
-#ifdef ENOCSI
-    set_syserr(ENOCSI, "ENOCSI");
-#endif
-#ifdef EL2HLT
-    set_syserr(EL2HLT, "EL2HLT");
-#endif
-#ifdef EBADE
-    set_syserr(EBADE, "EBADE");
-#endif
-#ifdef EBADR
-    set_syserr(EBADR, "EBADR");
-#endif
-#ifdef EXFULL
-    set_syserr(EXFULL, "EXFULL");
-#endif
-#ifdef ENOANO
-    set_syserr(ENOANO, "ENOANO");
-#endif
-#ifdef EBADRQC
-    set_syserr(EBADRQC, "EBADRQC");
-#endif
-#ifdef EBADSLT
-    set_syserr(EBADSLT, "EBADSLT");
-#endif
-#ifdef EDEADLOCK
-    set_syserr(EDEADLOCK, "EDEADLOCK");
-#endif
-#ifdef EBFONT
-    set_syserr(EBFONT, "EBFONT");
-#endif
-#ifdef ENOSTR
-    set_syserr(ENOSTR, "ENOSTR");
-#endif
-#ifdef ENODATA
-    set_syserr(ENODATA, "ENODATA");
-#endif
-#ifdef ETIME
-    set_syserr(ETIME, "ETIME");
-#endif
-#ifdef ENOSR
-    set_syserr(ENOSR, "ENOSR");
-#endif
-#ifdef ENONET
-    set_syserr(ENONET, "ENONET");
-#endif
-#ifdef ENOPKG
-    set_syserr(ENOPKG, "ENOPKG");
-#endif
-#ifdef EREMOTE
-    set_syserr(EREMOTE, "EREMOTE");
-#endif
-#ifdef ENOLINK
-    set_syserr(ENOLINK, "ENOLINK");
-#endif
-#ifdef EADV
-    set_syserr(EADV, "EADV");
-#endif
-#ifdef ESRMNT
-    set_syserr(ESRMNT, "ESRMNT");
-#endif
-#ifdef ECOMM
-    set_syserr(ECOMM, "ECOMM");
-#endif
-#ifdef EPROTO
-    set_syserr(EPROTO, "EPROTO");
-#endif
-#ifdef EMULTIHOP
-    set_syserr(EMULTIHOP, "EMULTIHOP");
-#endif
-#ifdef EDOTDOT
-    set_syserr(EDOTDOT, "EDOTDOT");
-#endif
-#ifdef EBADMSG
-    set_syserr(EBADMSG, "EBADMSG");
-#endif
-#ifdef EOVERFLOW
-    set_syserr(EOVERFLOW, "EOVERFLOW");
-#endif
-#ifdef ENOTUNIQ
-    set_syserr(ENOTUNIQ, "ENOTUNIQ");
-#endif
-#ifdef EBADFD
-    set_syserr(EBADFD, "EBADFD");
-#endif
-#ifdef EREMCHG
-    set_syserr(EREMCHG, "EREMCHG");
-#endif
-#ifdef ELIBACC
-    set_syserr(ELIBACC, "ELIBACC");
-#endif
-#ifdef ELIBBAD
-    set_syserr(ELIBBAD, "ELIBBAD");
-#endif
-#ifdef ELIBSCN
-    set_syserr(ELIBSCN, "ELIBSCN");
-#endif
-#ifdef ELIBMAX
-    set_syserr(ELIBMAX, "ELIBMAX");
-#endif
-#ifdef ELIBEXEC
-    set_syserr(ELIBEXEC, "ELIBEXEC");
-#endif
-#ifdef EILSEQ
-    set_syserr(EILSEQ, "EILSEQ");
-#endif
-#ifdef ERESTART
-    set_syserr(ERESTART, "ERESTART");
-#endif
-#ifdef ESTRPIPE
-    set_syserr(ESTRPIPE, "ESTRPIPE");
-#endif
-#ifdef EUSERS
-    set_syserr(EUSERS, "EUSERS");
-#endif
-#ifdef ENOTSOCK
-    set_syserr(ENOTSOCK, "ENOTSOCK");
-#endif
-#ifdef EDESTADDRREQ
-    set_syserr(EDESTADDRREQ, "EDESTADDRREQ");
-#endif
-#ifdef EMSGSIZE
-    set_syserr(EMSGSIZE, "EMSGSIZE");
-#endif
-#ifdef EPROTOTYPE
-    set_syserr(EPROTOTYPE, "EPROTOTYPE");
-#endif
-#ifdef ENOPROTOOPT
-    set_syserr(ENOPROTOOPT, "ENOPROTOOPT");
-#endif
-#ifdef EPROTONOSUPPORT
-    set_syserr(EPROTONOSUPPORT, "EPROTONOSUPPORT");
-#endif
-#ifdef ESOCKTNOSUPPORT
-    set_syserr(ESOCKTNOSUPPORT, "ESOCKTNOSUPPORT");
-#endif
-#ifdef EOPNOTSUPP
-    set_syserr(EOPNOTSUPP, "EOPNOTSUPP");
-#endif
-#ifdef EPFNOSUPPORT
-    set_syserr(EPFNOSUPPORT, "EPFNOSUPPORT");
-#endif
-#ifdef EAFNOSUPPORT
-    set_syserr(EAFNOSUPPORT, "EAFNOSUPPORT");
-#endif
-#ifdef EADDRINUSE
-    set_syserr(EADDRINUSE, "EADDRINUSE");
-#endif
-#ifdef EADDRNOTAVAIL
-    set_syserr(EADDRNOTAVAIL, "EADDRNOTAVAIL");
-#endif
-#ifdef ENETDOWN
-    set_syserr(ENETDOWN, "ENETDOWN");
-#endif
-#ifdef ENETUNREACH
-    set_syserr(ENETUNREACH, "ENETUNREACH");
-#endif
-#ifdef ENETRESET
-    set_syserr(ENETRESET, "ENETRESET");
-#endif
-#ifdef ECONNABORTED
-    set_syserr(ECONNABORTED, "ECONNABORTED");
-#endif
-#ifdef ECONNRESET
-    set_syserr(ECONNRESET, "ECONNRESET");
-#endif
-#ifdef ENOBUFS
-    set_syserr(ENOBUFS, "ENOBUFS");
-#endif
-#ifdef EISCONN
-    set_syserr(EISCONN, "EISCONN");
-#endif
-#ifdef ENOTCONN
-    set_syserr(ENOTCONN, "ENOTCONN");
-#endif
-#ifdef ESHUTDOWN
-    set_syserr(ESHUTDOWN, "ESHUTDOWN");
-#endif
-#ifdef ETOOMANYREFS
-    set_syserr(ETOOMANYREFS, "ETOOMANYREFS");
-#endif
-#ifdef ETIMEDOUT
-    set_syserr(ETIMEDOUT, "ETIMEDOUT");
-#endif
-#ifdef ECONNREFUSED
-    set_syserr(ECONNREFUSED, "ECONNREFUSED");
-#endif
-#ifdef EHOSTDOWN
-    set_syserr(EHOSTDOWN, "EHOSTDOWN");
-#endif
-#ifdef EHOSTUNREACH
-    set_syserr(EHOSTUNREACH, "EHOSTUNREACH");
-#endif
-#ifdef EALREADY
-    set_syserr(EALREADY, "EALREADY");
-#endif
-#ifdef EINPROGRESS
-    set_syserr(EINPROGRESS, "EINPROGRESS");
-#endif
-#ifdef ESTALE
-    set_syserr(ESTALE, "ESTALE");
-#endif
-#ifdef EUCLEAN
-    set_syserr(EUCLEAN, "EUCLEAN");
-#endif
-#ifdef ENOTNAM
-    set_syserr(ENOTNAM, "ENOTNAM");
-#endif
-#ifdef ENAVAIL
-    set_syserr(ENAVAIL, "ENAVAIL");
-#endif
-#ifdef EISNAM
-    set_syserr(EISNAM, "EISNAM");
-#endif
-#ifdef EREMOTEIO
-    set_syserr(EREMOTEIO, "EREMOTEIO");
-#endif
-#ifdef EDQUOT
-    set_syserr(EDQUOT, "EDQUOT");
-#endif
-}
-
-static void
-err_append(s)
-    const char *s;
-{
-    extern VALUE ruby_errinfo;
-
-    if (ruby_in_eval) {
-	if (NIL_P(ruby_errinfo)) {
-	    ruby_errinfo = rb_exc_new2(rb_eSyntaxError, s);
-	}
-	else {
-	    VALUE str = rb_str_to_str(ruby_errinfo);
-
-	    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);
-    }
-}
diff --git a/eval.c b/eval.c
deleted file mode 100644
index 236d48adbe..0000000000
--- a/eval.c
+++ /dev/null
@@ -1,9338 +0,0 @@
-/**********************************************************************
-
-  eval.c -
-
-  $Author$
-  $Date$
-  created at: Thu Jun 10 14:22:17 JST 1993
-
-  Copyright (C) 1993-2002 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"
-
-#include 
-#include 
-#include "st.h"
-#include "dln.h"
-
-/* Make alloca work the best possible way.  */
-#ifdef __GNUC__
-# ifndef atarist
-#  ifndef alloca
-#   define alloca __builtin_alloca
-#  endif
-# endif /* atarist */
-#else
-# if defined(HAVE_ALLOCA_H)
-#  include 
-# elif !defined(alloca)
-char *alloca();
-# endif
-#endif /* __GNUC__ */
-
-#ifdef _AIX
-#pragma alloca
-#endif
-
-#ifdef HAVE_STDARG_PROTOTYPES
-#include 
-#define va_init_list(a,b) va_start(a,b)
-#else
-#include 
-#define va_init_list(a,b) va_start(a)
-#endif
-
-#ifndef HAVE_STRING_H
-char *strrchr _((const char*,const char));
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include 
-#endif
-
-#ifdef __BEOS__
-#include 
-#endif
-
-#ifdef __MACOS__
-#include "macruby_private.h"
-#endif
-
-#ifndef setjmp
-#ifdef HAVE__SETJMP
-#define setjmp(env) _setjmp(env)
-#define longjmp(env,val) _longjmp(env,val)
-#endif
-#endif
-
-#include 
-#ifdef HAVE_SYS_TIME_H
-# include 
-#else
-#ifndef NT
-struct timeval {
-        long    tv_sec;         /* seconds */
-        long    tv_usec;        /* and microseconds */
-};
-#endif /* NT */
-#endif
-#include 
-#include 
-
-#if defined(__VMS)
-#pragma nostandard
-#endif
-
-#ifdef HAVE_SYS_SELECT_H
-#include 
-#endif
-
-#include 
-
-VALUE rb_cProc;
-static VALUE rb_cBinding;
-static VALUE proc_invoke _((VALUE,VALUE,int,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 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));
-
-static int scope_vmode;
-#define SCOPE_PUBLIC    0
-#define SCOPE_PRIVATE   1
-#define SCOPE_PROTECTED 2
-#define SCOPE_MODFUNC   5
-#define SCOPE_MASK      7
-#define SCOPE_SET(f)  (scope_vmode=(f))
-#define SCOPE_TEST(f) (scope_vmode&(f))
-
-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 genetated 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) {
-	rb_raise(rb_eSecurityError, "Insecure operation `%s' at level %d",
-		 rb_id2name(ruby_frame->last_func), ruby_safe_level);
-    }
-}
-
-void
-rb_check_safe_str(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);
-    if (TYPE(x)!= T_STRING) {
-	rb_raise(rb_eTypeError, "wrong argument type %s (expected String)",
-		 rb_class2name(CLASS_OF(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 */
-    ID mid0;			/* method's original id */
-    VALUE klass;		/* receiver's class */
-    VALUE origin;		/* where method defined  */
-    NODE *method;
-    int noex;
-};
-
-static struct cache_entry cache[CACHE_SIZE];
-
-void
-rb_clear_cache()
-{
-   struct cache_entry *ent, *end;
-
-    ent = cache; end = ent + CACHE_SIZE;
-    while (ent < end) {
-	ent->mid = 0;
-	ent++;
-    }
-}
-
-static void
-rb_clear_cache_by_id(id)
-    ID id;
-{
-    struct cache_entry *ent, *end;
-
-    ent = cache; end = ent + CACHE_SIZE;
-    while (ent < end) {
-	if (ent->mid == id) {
-	    ent->mid = 0;
-	}
-	ent++;
-    }
-}
-
-static void
-rb_clear_cache_by_class(klass)
-    VALUE klass;
-{
-    struct cache_entry *ent, *end;
-
-    ent = cache; end = ent + CACHE_SIZE;
-    while (ent < end) {
-	if (ent->origin == klass) {
-	    ent->mid = 0;
-	}
-	ent++;
-    }
-}
-
-void
-rb_add_method(klass, mid, node, noex)
-    VALUE klass;
-    ID mid;
-    NODE *node;
-    int noex;
-{
-    NODE *body;
-
-    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 (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);
-}
-
-static NODE*
-search_method(klass, id, origin)
-    VALUE klass, *origin;
-    ID id;
-{
-    NODE *body;
-
-    if (!klass) return 0;
-    while (!st_lookup(RCLASS(klass)->m_tbl, id, &body)) {
-	klass = RCLASS(klass)->super;
-	if (!klass) return 0;
-    }
-
-    if (origin) *origin = klass;
-    return body;
-}
-
-static NODE*
-rb_get_method_body(klassp, idp, noexp)
-    VALUE *klassp;
-    ID *idp;
-    int *noexp;
-{
-    ID id = *idp;
-    VALUE klass = *klassp;
-    VALUE origin;
-    NODE * volatile body;
-    struct cache_entry *ent;
-
-    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;
-    }
-
-    /* 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;
-    }
-    else {
-	*klassp = origin;
-	ent->origin = origin;
-	ent->mid = ent->mid0 = id;
-	ent->method = body;
-    }
-
-    if (noexp) *noexp = ent->noex;
-    return body;
-}
-
-static void
-remove_method(klass, mid)
-    VALUE klass;
-    ID mid;
-{
-    NODE *body;
-
-    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 (!st_delete(RCLASS(klass)->m_tbl, &mid, &body) || !body->nd_body) {
-	rb_name_error(mid, "method `%s' not defined in %s",
-		      rb_id2name(mid), rb_class2name(klass));
-    }
-    rb_clear_cache_by_id(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));
-    }
-}
-
-void
-rb_remove_method(klass, name)
-    VALUE klass;
-    const char *name;
-{
-    remove_method(klass, rb_intern(name));
-}
-
-static VALUE
-rb_mod_remove_method(mod, name)
-    VALUE mod, name;
-{
-    remove_method(mod, rb_to_id(name));
-    return mod;
-}
-
-void
-rb_disable_super(klass, name)
-    VALUE klass;
-    const char *name;
-{
-    VALUE origin;
-    NODE *body;
-    ID mid = rb_intern(name);
-
-    body = search_method(klass, mid, &origin);
-    if (!body || !body->nd_body) {
-	print_undef(klass, mid);
-    }
-    if (origin == klass) {
-	body->nd_noex |= NOEX_UNDEF;
-    }
-    else {
-	rb_add_method(klass, mid, 0, NOEX_UNDEF);
-    }
-}
-
-void
-rb_enable_super(klass, name)
-    VALUE klass;
-    const char *name;
-{
-    VALUE origin;
-    NODE *body;
-    ID mid = rb_intern(name);
-
-    body = search_method(klass, mid, &origin);
-    if (!body) {
-	print_undef(klass, mid);
-    }
-    if (!body->nd_body) {
-	remove_method(klass, mid);
-    }
-    else {
-	body->nd_noex &= ~NOEX_UNDEF;
-    }
-}
-
-static void
-rb_export_method(klass, name, noex)
-    VALUE klass;
-    ID name;
-    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(rb_cObject, name, &origin);
-    }
-    if (!body) {
-	print_undef(klass, name);
-    }
-    if (body->nd_noex != noex) {
-	if (klass == origin) {
-	    body->nd_noex = noex;
-	}
-	else {
-	    rb_add_method(klass, name, NEW_ZSUPER(), noex);
-	}
-    }
-}
-
-int
-rb_method_boundp(klass, id, ex)
-    VALUE klass;
-    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 Qfalse;
-	return Qtrue;
-    }
-    return Qfalse;
-}
-
-static ID init, alloc, eqq, each, aref, aset, match, missing;
-static ID added, singleton_added;
-static ID __id__, __send__;
-
-void
-rb_attr(klass, id, read, write, ex)
-    VALUE klass;
-    ID id;
-    int read, write, ex;
-{
-    const char *name;
-    char *buf;
-    ID attriv;
-    int noex;
-
-    if (!ex) noex = NOEX_PUBLIC;
-    else {
-	if (SCOPE_TEST(SCOPE_PRIVATE)) {
-	    noex = NOEX_PRIVATE;
-	    rb_warning((scope_vmode == SCOPE_MODFUNC) ?
-		       "attribute accessor as module_function" :
-		       "private attribute?");
-	}
-	else if (SCOPE_TEST(SCOPE_PROTECTED)) {
-	    noex = NOEX_PROTECTED;
-	}
-	else {
-	    noex = NOEX_PUBLIC;
-	}
-    }
-
-    name = rb_id2name(id);
-    if (!name) {
-	rb_raise(rb_eArgError, "argument needs to be symbol or string");
-    }
-    buf = ALLOCA_N(char,strlen(name)+2);
-    sprintf(buf, "@%s", name);
-    attriv = rb_intern(buf);
-    if (read) {
-	rb_add_method(klass, id, NEW_IVAR(attriv), noex);
-	rb_funcall(klass, added, 1, ID2SYM(id));
-    }
-    if (write) {
-	sprintf(buf, "%s=", name);
-	id = rb_intern(buf);
-	rb_add_method(klass, id, NEW_ATTRSET(attriv), noex);
-	rb_funcall(klass, added, 1, ID2SYM(id));
-    }
-}
-
-extern int ruby_in_compile;
-
-VALUE ruby_errinfo = Qnil;
-extern NODE *ruby_eval_tree_begin;
-extern NODE *ruby_eval_tree;
-extern int ruby_nerrs;
-
-static VALUE rb_eLocalJumpError;
-static VALUE rb_eSysStackError;
-
-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() do {		\
-    struct FRAME _frame;		\
-    _frame.prev = ruby_frame;		\
-    _frame.tmp  = 0;			\
-    _frame.file = ruby_sourcefile;	\
-    _frame.line = ruby_sourceline;	\
-    _frame.iter = ruby_iter->iter;	\
-    _frame.cbase = ruby_frame->cbase;	\
-    _frame.argc = 0;			\
-    _frame.argv = 0;			\
-    _frame.flags = FRAME_ALLOCA;	\
-    ruby_frame = &_frame
-
-#define POP_FRAME()  			\
-    ruby_sourcefile = _frame.file;	\
-    ruby_sourceline = _frame.line;	\
-    ruby_frame = _frame.prev;		\
-} while (0)
-
-struct BLOCKTAG {
-    struct RBasic super;
-    long dst;
-    long flags;
-};
-
-struct BLOCK {
-    NODE *var;
-    NODE *body;
-    VALUE self;
-    struct FRAME frame;
-    struct SCOPE *scope;
-    struct BLOCKTAG *tag;
-    VALUE klass;
-    int iter;
-    int vmode;
-    int flags;
-    struct RVarmap *dyna_vars;
-    VALUE orig_thread;
-    VALUE wrapper;
-    struct BLOCK *prev;
-};
-
-#define BLOCK_D_SCOPE 1
-#define BLOCK_DYNAMIC 2
-#define BLOCK_ORPHAN  4
-
-static struct BLOCK *ruby_block;
-
-static struct BLOCKTAG*
-new_blktag()
-{
-    NEWOBJ(blktag, struct BLOCKTAG);
-    OBJSETUP(blktag, 0, T_BLKTAG);
-    blktag->dst = 0;
-    blktag->flags = 0;
-    return blktag;
-}
-
-#define PUSH_BLOCK(v,b) do {		\
-    struct BLOCK _block;		\
-    _block.tag = new_blktag();		\
-    _block.var = v;			\
-    _block.body = b;			\
-    _block.self = self;			\
-    _block.frame = *ruby_frame;		\
-    _block.klass = ruby_class;		\
-    _block.frame.file = ruby_sourcefile;\
-    _block.frame.line = ruby_sourceline;\
-    _block.scope = ruby_scope;		\
-    _block.prev = ruby_block;		\
-    _block.iter = ruby_iter->iter;	\
-    _block.vmode = scope_vmode;		\
-    _block.flags = BLOCK_D_SCOPE;	\
-    _block.dyna_vars = ruby_dyna_vars;	\
-    _block.wrapper = ruby_wrapper;	\
-    ruby_block = &_block
-
-#define POP_BLOCK() 			\
-   if (_block.tag->flags & (BLOCK_DYNAMIC)) \
-       _block.tag->flags |= BLOCK_ORPHAN; \
-   else	if (!(_block.scope->flags & SCOPE_DONT_RECYCLE)) \
-       rb_gc_force_recycle((VALUE)_block.tag); \
-   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 DVAR_DONT_RECYCLE FL_USER2
-
-static struct RVarmap*
-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 = prev;
-
-    return vars;
-}
-
-VALUE
-rb_dvar_defined(id)
-    ID id;
-{
-    struct RVarmap *vars = ruby_dyna_vars;
-
-    while (vars) {
-	if (vars->id == id) return Qtrue;
-	vars = vars->next;
-    }
-    return Qfalse;
-}
-
-VALUE
-rb_dvar_curr(id)
-    ID id;
-{
-    struct RVarmap *vars = ruby_dyna_vars;
-
-    while (vars) {
-	if (vars->id == 0) break;
-	if (vars->id == id) return Qtrue;
-	vars = vars->next;
-    }
-    return Qfalse;
-}
-
-VALUE
-rb_dvar_ref(id)
-    ID id;
-{
-    struct RVarmap *vars = ruby_dyna_vars;
-
-    while (vars) {
-	if (vars->id == id) {
-	    return vars->val;
-	}
-	vars = vars->next;
-    }
-    return Qnil;
-}
-
-void
-rb_dvar_push(id, value)
-    ID id;
-    VALUE value;
-{
-    ruby_dyna_vars = new_dvar(id, value, ruby_dyna_vars);
-}
-
-static void
-dvar_asgn_internal(id, value, curr)
-    ID id;
-    VALUE value;
-    int curr;
-{
-    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;
-	}
-	vars = vars->next;
-    }
-    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 inline void
-dvar_asgn(id, value)
-    ID id;
-    VALUE value;
-{
-    dvar_asgn_internal(id, value, 0);
-}
-
-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 *ruby_iter;
-
-#define ITER_NOT 0
-#define ITER_PRE 1
-#define ITER_CUR 2
-
-#define PUSH_ITER(i) do {		\
-    struct iter _iter;			\
-    _iter.prev = ruby_iter;		\
-    _iter.iter = (i);			\
-    ruby_iter = &_iter
-
-#define POP_ITER()			\
-    ruby_iter = _iter.prev;		\
-} while (0)
-
-struct tag {
-    jmp_buf buf;
-    struct FRAME *frame;
-    struct iter *iter;
-    ID tag;
-    VALUE retval;
-    struct SCOPE *scope;
-    int dst;
-    struct tag *prev;
-};
-static struct tag *prot_tag;
-
-#define PUSH_TAG(ptag) do {		\
-    struct tag _tag;			\
-    _tag.retval = Qnil;			\
-    _tag.frame = ruby_frame;		\
-    _tag.iter = ruby_iter;		\
-    _tag.prev = prot_tag;		\
-    _tag.scope = ruby_scope;		\
-    _tag.tag = ptag;			\
-    _tag.dst = 0;			\
-    prot_tag = &_tag
-
-#define PROT_NONE   0
-#define PROT_FUNC   -1
-#define PROT_THREAD -2
-
-#define EXEC_TAG()    setjmp(prot_tag->buf)
-
-#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 POP_TMPTAG()			\
-    prot_tag = _tag.prev;		\
-} while (0)
-
-#define TAG_RETURN	0x1
-#define TAG_BREAK	0x2
-#define TAG_NEXT	0x3
-#define TAG_RETRY	0x4
-#define TAG_REDO	0x5
-#define TAG_RAISE	0x6
-#define TAG_THROW	0x7
-#define TAG_FATAL	0x8
-#define TAG_MASK	0xf
-
-VALUE ruby_class;
-static VALUE ruby_wrapper;	/* security wrapper */
-
-#define PUSH_CLASS() do {		\
-    VALUE _class = ruby_class
-
-#define POP_CLASS() ruby_class = _class; \
-} while (0)
-
-static NODE *ruby_cref = 0;
-static NODE *top_cref;
-#define PUSH_CREF(c) ruby_cref = rb_node_newnode(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->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*, int));
-
-static VALUE rb_yield_0 _((VALUE, VALUE, VALUE, int));
-static VALUE rb_call _((VALUE,VALUE,ID,int,const VALUE*,int));
-static VALUE module_setup _((VALUE,NODE*));
-
-static VALUE massign _((VALUE,NODE*,VALUE,int));
-static void assign _((VALUE,NODE*,VALUE,int));
-
-static VALUE trace_func = 0;
-static int tracing = 0;
-static void call_trace_func _((char*,char*,int,VALUE,ID,VALUE));
-
-static void
-error_pos()
-{
-    if (ruby_sourcefile) {
-	if (ruby_frame->last_func) {
-	    fprintf(stderr, "%s:%d:in `%s'", ruby_sourcefile, ruby_sourceline,
-		    rb_id2name(ruby_frame->last_func));
-	}
-	else if (ruby_sourceline == 0) {
-	    fprintf(stderr, "%s", ruby_sourcefile);
-	}
-	else {
-	    fprintf(stderr, "%s:%d", ruby_sourcefile, ruby_sourceline);
-	}
-    }
-}
-
-static VALUE
-get_backtrace(info)
-    VALUE info;
-{
-    if (NIL_P(info)) return Qnil;
-    return rb_funcall(info, rb_intern("backtrace"), 0);
-}
-
-static void
-set_backtrace(info, bt)
-    VALUE info, bt;
-{
-    rb_funcall(info, rb_intern("set_backtrace"), 1, bt);
-}
-
-static void
-error_print()
-{
-    VALUE errat = Qnil;		/* OK */
-    volatile VALUE eclass;
-    char *einfo;
-    int elen;
-
-    if (NIL_P(ruby_errinfo)) return;
-
-    PUSH_TAG(PROT_NONE);
-    if (EXEC_TAG() == 0) {
-	errat = get_backtrace(ruby_errinfo);
-    }
-    else {
-	errat = Qnil;
-    }
-    POP_TAG();
-    if (NIL_P(errat)){
-	if (ruby_sourcefile)
-	    fprintf(stderr, "%s:%d", ruby_sourcefile, ruby_sourceline);
-	else
-	    fprintf(stderr, "%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);
-	}
-    }
-
-    eclass = CLASS_OF(ruby_errinfo);
-    PUSH_TAG(PROT_NONE);
-    if (EXEC_TAG() == 0) {
-	VALUE e = rb_obj_as_string(ruby_errinfo);
-	einfo = RSTRING(e)->ptr;
-	elen = RSTRING(e)->len;
-    }
-    else {
-	einfo = "";
-	elen = 0;
-    }
-    POP_TAG();
-    if (eclass == rb_eRuntimeError && elen == 0) {
-	fprintf(stderr, ": unhandled exception\n");
-    }
-    else {
-	VALUE epath;
-
-	epath = rb_class_path(eclass);
-	if (elen == 0) {
-	    fprintf(stderr, ": ");
-	    fwrite(RSTRING(epath)->ptr, 1, RSTRING(epath)->len, stderr);
-	    putc('\n', stderr);
-	}
-	else {
-	    char *tail  = 0;
-	    int len = elen;
-
-	    if (RSTRING(epath)->ptr[0] == '#') epath = 0;
-	    if (tail = strchr(einfo, '\n')) {
-		len = tail - einfo;
-		tail++;		/* skip newline */
-	    }
-	    fprintf(stderr, ": ");
-	    fwrite(einfo, 1, len, stderr);
-	    if (epath) {
-		fprintf(stderr, " (");
-		fwrite(RSTRING(epath)->ptr, 1, RSTRING(epath)->len, stderr);
-		fprintf(stderr, ")\n");
-	    }
-	    if (tail) {
-		fwrite(tail, 1, elen-len-1, stderr);
-		putc('\n', stderr);
-	    }
-	}
-    }
-
-    if (!NIL_P(errat)) {
-	int i;
-	struct RArray *ep = RARRAY(errat);
-
-#define TRACE_MAX (TRACE_HEAD+TRACE_TAIL+5)
-#define TRACE_HEAD 8
-#define TRACE_TAIL 5
-
-	ep = RARRAY(errat);
-	for (i=1; ilen; i++) {
-	    if (TYPE(ep->ptr[i]) == T_STRING) {
-		fprintf(stderr, "\tfrom %s\n", RSTRING(ep->ptr[i])->ptr);
-	    }
-	    if (i == TRACE_HEAD && ep->len > TRACE_MAX) {
-		fprintf(stderr, "\t ... %ld levels...\n",
-			ep->len - TRACE_HEAD - TRACE_TAIL);
-		i = ep->len - TRACE_TAIL;
-	    }
-	}
-    }
-}
-
-#if !defined(NT) && !defined(__MACOS__)
-extern char **environ;
-#endif
-char **rb_origenviron;
-
-void rb_call_inits _((void));
-void Init_stack _((void*));
-void Init_heap _((void));
-void Init_ext _((void));
-
-void
-ruby_init()
-{
-    static int initialized = 0;
-    static struct FRAME frame;
-    static struct iter iter;
-    int state;
-
-    if (initialized)
-	return;
-    initialized = 1;
-
-    ruby_frame = top_frame = &frame;
-    ruby_iter = &iter;
-
-#ifdef __MACOS__
-    rb_origenviron = 0;
-#else
-    rb_origenviron = environ;
-#endif
-
-    Init_stack(0);
-    Init_heap();
-    PUSH_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);
-    if ((state = EXEC_TAG()) == 0) {
-	rb_call_inits();
-	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;
-	ruby_frame->cbase = (VALUE)ruby_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();
-    ruby_scope = top_scope;
-}
-
-static VALUE
-eval_node(self, node)
-    VALUE self;
-    NODE *node;
-{
-    NODE *beg_tree = ruby_eval_tree_begin;
-
-    ruby_eval_tree_begin = 0;
-    if (beg_tree) {
-	rb_eval(self, beg_tree);
-    }
-
-    if (!node) return Qnil;
-    return rb_eval(self, node);
-}
-
-int ruby_in_eval;
-
-static void rb_thread_cleanup _((void));
-static void rb_thread_wait_other_threads _((void));
-
-static int
-error_handle(ex)
-    int ex;
-{
-    switch (ex & TAG_MASK) {
-      case 0:
-	ex = 0;
-	break;
-
-      case TAG_RETURN:
-	error_pos();
-	fprintf(stderr, ": unexpected return\n");
-	ex = 1;
-	break;
-      case TAG_NEXT:
-	error_pos();
-	fprintf(stderr, ": unexpected next\n");
-	ex = 1;
-	break;
-      case TAG_BREAK:
-	error_pos();
-	fprintf(stderr, ": unexpected break\n");
-	ex = 1;
-	break;
-      case TAG_REDO:
-	error_pos();
-	fprintf(stderr, ": unexpected redo\n");
-	ex = 1;
-	break;
-      case TAG_RETRY:
-	error_pos();
-	fprintf(stderr, ": retry outside of rescue clause\n");
-	ex = 1;
-	break;
-      case TAG_RAISE:
-      case TAG_FATAL:
-	if (rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) {
-	    VALUE st = rb_iv_get(ruby_errinfo, "status");
-	    ex = NIL_P(st) ? 1 : NUM2INT(st);
-	}
-	else {
-	    error_print();
-	    ex = 1;
-	}
-	break;
-      default:
-	rb_bug("Unknown longjmp status %d", ex);
-	break;
-    }
-    return ex;
-}
-
-void
-ruby_options(argc, argv)
-    int argc;
-    char **argv;
-{
-    int state;
-
-    PUSH_TAG(PROT_NONE);
-    if ((state = EXEC_TAG()) == 0) {
-	ruby_process_options(argc, argv);
-    }
-    if (state) {
-	trace_func = 0;
-	tracing = 0;
-	exit(error_handle(state));
-    }
-    POP_TAG();
-}
-
-void rb_exec_end_proc _((void));
-
-void
-ruby_finalize()
-{
-    int state;
-
-    PUSH_TAG(PROT_NONE);
-    if ((state = EXEC_TAG()) == 0) {
-	rb_trap_exit();
-	rb_exec_end_proc();
-	rb_gc_call_finalizer_at_exit();
-    }
-    POP_TAG();
-}
-
-void
-ruby_stop(ex)
-    int ex;
-{
-    int state;
-
-    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();
-
-    trace_func = 0;
-    tracing = 0;
-    ex = error_handle(ex);
-    POP_TAG();
-    ruby_finalize();
-    exit(ex);
-}
-
-void
-ruby_run()
-{
-    int state;
-    static int ex;
-    volatile NODE *tmp;
-
-    if (ruby_nerrs > 0) exit(ruby_nerrs);
-
-    Init_stack((void*)&tmp);
-    PUSH_TAG(PROT_NONE);
-    PUSH_ITER(ITER_NOT);
-    if ((state = EXEC_TAG()) == 0) {
-	eval_node(ruby_top_self, ruby_eval_tree);
-    }
-    POP_ITER();
-    POP_TAG();
-
-    if (state && !ex) ex = state;
-    ruby_stop(ex);
-}
-
-static void
-compile_error(at)
-    const char *at;
-{
-    VALUE str;
-
-    ruby_nerrs = 0;
-    str = rb_str_buf_new2("compile error");
-    if (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, ruby_errinfo);
-    }
-    rb_exc_raise(rb_exc_new3(rb_eSyntaxError, str));
-}
-
-VALUE
-rb_eval_string(str)
-    const char *str;
-{
-    VALUE v;
-    char *oldsrc = ruby_sourcefile;
-
-    ruby_sourcefile = rb_source_filename("(eval)");
-    v = eval(ruby_top_self, rb_str_new2(str), Qnil, 0, 0);
-    ruby_sourcefile = oldsrc;
-
-    return v;
-}
-
-VALUE
-rb_eval_string_protect(str, state)
-    const char *str;
-    int *state;
-{
-    VALUE result;		/* OK */
-    int status;
-
-    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;
-    }
-
-    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;
-
-    PUSH_CLASS();
-    ruby_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->last_class = 0;
-    ruby_frame->self = self;
-    ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,ruby_wrapper,0,0);
-    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;
-}
-
-static void
-localjump_error(mesg, status)
-    const char *mesg;
-{
-    VALUE exc = rb_exc_new2(rb_eLocalJumpError, mesg);
-    rb_iv_set(exc, "@status", status);
-    rb_exc_raise(exc);
-}
-
-static VALUE
-localjump_exitstatus(exc)
-    VALUE exc;
-{
-    return rb_iv_get(exc, "@status");
-}
-
-static void
-jump_tag_but_local_jump(state)
-    int state;
-{
-    switch (state) {
-      case 0:
-	break;
-      case TAG_RETURN:
-	localjump_error("unexpected return", Qnil);
-	break;
-      case TAG_NEXT:
-	localjump_error("unexpected next", Qnil);
-	break;
-      case TAG_BREAK:
-	localjump_error("unexpected break", Qnil);
-	break;
-      case TAG_REDO:
-	localjump_error("unexpected redo", Qnil);
-	break;
-      case TAG_RETRY:
-	localjump_error("retry outside of rescue clause", Qnil);
-	break;
-      default:
-	JUMP_TAG(state);
-	break;
-    }
-}
-
-VALUE
-rb_eval_cmd(cmd, arg, tcheck)
-    VALUE cmd, arg;
-    int tcheck;
-{
-    int state;
-    VALUE val;			/* OK */
-    struct SCOPE *saved_scope;
-    volatile int safe = ruby_safe_level;
-
-    if (TYPE(cmd) != T_STRING) {
-	PUSH_ITER(ITER_NOT);
-	val = rb_funcall2(cmd, rb_intern("call"), RARRAY(arg)->len, RARRAY(arg)->ptr);
-	POP_ITER();
-	return val;
-    }
-
-    saved_scope = ruby_scope;
-    ruby_scope = top_scope;
-    PUSH_FRAME();
-    ruby_frame->last_func = 0;
-    ruby_frame->last_class = 0;
-    ruby_frame->self = ruby_top_self;
-    ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,0,0,0);
-    RNODE(ruby_frame->cbase)->nd_clss = ruby_wrapper ? ruby_wrapper : rb_cObject;
-
-    if (tcheck && OBJ_TAINTED(cmd)) {
-	ruby_safe_level = 4;
-    }
-
-    PUSH_TAG(PROT_NONE);
-    if ((state = EXEC_TAG()) == 0) {
-	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();
-    POP_FRAME();
-
-    jump_tag_but_local_jump(state);
-    return val;
-}
-
-static VALUE
-rb_trap_eval(cmd, sig)
-    VALUE cmd;
-    int sig;
-{
-    int state;
-    VALUE val;			/* OK */
-
-    PUSH_TAG(PROT_NONE);
-    PUSH_ITER(ITER_NOT);
-    if ((state = EXEC_TAG()) == 0) {
-	val = rb_eval_cmd(cmd, rb_ary_new3(1, INT2FIX(sig)), 0);
-    }
-    POP_ITER();
-    POP_TAG();
-    if (state) {
-	rb_trap_immediate = 0;
-	JUMP_TAG(state);
-    }
-    return val;
-}
-
-static VALUE
-superclass(self, node)
-    VALUE self;
-    NODE *node;
-{
-    VALUE val;			/* OK */
-    int state;
-
-    PUSH_TAG(PROT_NONE);
-    if ((state = EXEC_TAG()) == 0) {
-	val = rb_eval(self, node);
-    }
-    POP_TAG();
-    if (state) {
-	switch (nd_type(node)) {
-	  case NODE_COLON2:
-	    rb_raise(rb_eTypeError, "undefined superclass `%s'",
-		     rb_id2name(node->nd_mid));
-	  case NODE_CONST:
-	    rb_raise(rb_eTypeError, "undefined superclass `%s'",
-		     rb_id2name(node->nd_vid));
-	  default:
-	    break;
-	}
-	JUMP_TAG(state);
-    }
-    if (TYPE(val) != T_CLASS) {
-	rb_raise(rb_eTypeError, "superclass must be a Class (%s given)",
-		 rb_class2name(CLASS_OF(val)));
-    }
-    if (FL_TEST(val, FL_SINGLETON)) {
-	rb_raise(rb_eTypeError, "can't make subclass of virtual class");
-    }
-
-    return val;
-}
-
-#define ruby_cbase (RNODE(ruby_frame->cbase)->nd_clss)
-
-static VALUE
-ev_const_defined(cref, id, self)
-    NODE *cref;
-    ID id;
-    VALUE self;
-{
-    NODE *cbase = cref;
-
-    while (cbase && cbase->nd_next) {
-	struct RClass *klass = RCLASS(cbase->nd_clss);
-
-	if (NIL_P(klass)) return rb_const_defined(CLASS_OF(self), id);
-	if (klass->iv_tbl && st_lookup(klass->iv_tbl, id, 0)) {
-	    return Qtrue;
-	}
-	cbase = cbase->nd_next;
-    }
-    return rb_const_defined(cref->nd_clss, id);
-}
-
-static VALUE
-ev_const_get(cref, id, self)
-    NODE *cref;
-    ID id;
-    VALUE self;
-{
-    NODE *cbase = cref;
-    VALUE result;
-
-    while (cbase && cbase->nd_next) {
-	VALUE klass = cbase->nd_clss;
-
-	if (NIL_P(klass)) return rb_const_get(CLASS_OF(self), id);
-	if (RCLASS(klass)->iv_tbl && st_lookup(RCLASS(klass)->iv_tbl, id, &result)) {
-	    return result;
-	}
-	cbase = cbase->nd_next;
-    }
-    return rb_const_get(cref->nd_clss, id);
-}
-
-static VALUE
-cvar_cbase()
-{
-    NODE *cref = RNODE(ruby_frame->cbase);
-
-    while (cref && cref->nd_next && FL_TEST(cref->nd_clss, FL_SINGLETON)) {
-	cref = cref->nd_next;
-	if (!cref->nd_next) {
-	    rb_warn("class variable access from toplevel singleton method");
-	}
-    }
-    return cref->nd_clss;
-}
-
-static VALUE
-rb_mod_nesting()
-{
-    NODE *cbase = RNODE(ruby_frame->cbase);
-    VALUE ary = rb_ary_new();
-
-    while (cbase && cbase->nd_next) {
-	if (!NIL_P(cbase->nd_clss)) rb_ary_push(ary, cbase->nd_clss);
-	cbase = cbase->nd_next;
-    }
-    return ary;
-}
-
-static VALUE
-rb_mod_s_constants()
-{
-    NODE *cbase = RNODE(ruby_frame->cbase);
-    void *data = 0;
-
-    while (cbase) {
-	if (!NIL_P(cbase->nd_clss)) {
-	    data = rb_mod_const_at(cbase->nd_clss, data);
-	}
-	cbase = cbase->nd_next;
-    }
-
-    if (!NIL_P(ruby_cbase)) {
-	data = rb_mod_const_of(ruby_cbase, data);
-    }
-    return rb_const_list(data);
-}
-
-void
-rb_frozen_class_p(klass)
-    VALUE klass;
-{
-    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_class == rb_cObject) {
-	rb_secure(4);
-    }
-    if (ruby_safe_level >= 4 && !OBJ_TAINTED(klass)) {
-	rb_raise(rb_eSecurityError, "Insecure: can't undef");
-	if (id == __id__ || id == __send__ || id == init) {
-	    rb_name_error(id, "undefining `%s' prohibited", 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(ruby_class, 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));
-    }
-}
-
-static VALUE
-rb_mod_undef_method(mod, name)
-    VALUE mod, name;
-{
-    rb_undef(mod, rb_to_id(name));
-    return mod;
-}
-
-void
-rb_alias(klass, name, def)
-    VALUE klass;
-    ID name, def;
-{
-    VALUE origin;
-    NODE *orig, *body;
-
-    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);
-    }
-    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);
-    st_insert(RCLASS(klass)->m_tbl, name,
-	      NEW_METHOD(NEW_FBODY(body, def, origin), orig->nd_noex));
-    if (FL_TEST(klass, FL_SINGLETON)) {
-	rb_funcall(rb_iv_get(klass, "__attached__"),
-		   singleton_added, 1, ID2SYM(name));
-    }
-    else {
-	rb_funcall(klass, added, 1, ID2SYM(name));
-    }
-}
-
-static VALUE
-rb_mod_alias_method(mod, newname, oldname)
-    VALUE mod, newname, oldname;
-{
-    rb_alias(mod, rb_to_id(newname), rb_to_id(oldname));
-    return mod;
-}
-
-static NODE*
-copy_node_scope(node, rval)
-    NODE *node;
-    VALUE rval;
-{
-    NODE *copy = rb_node_newnode(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(n) ALLOCA_N(VALUE,n)
-#endif
-
-#define SETUP_ARGS(anode) 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 = ruby_sourcefile;\
-	    int line = ruby_sourceline;\
-            int i;\
-	    n = anode;\
-	    argv = TMP_ALLOC(argc);\
-	    for (i=0;ind_head);\
-		n=n->nd_next;\
-	    }\
-	    ruby_sourcefile = file;\
-	    ruby_sourceline = line;\
-        }\
-        else {\
-	    argc = 0;\
-	    argv = 0;\
-        }\
-    }\
-    else {\
-        VALUE args = rb_eval(self,n);\
-	char *file = ruby_sourcefile;\
-	int line = ruby_sourceline;\
-	if (TYPE(args) != T_ARRAY)\
-	    args = rb_ary_to_ary(args);\
-        argc = RARRAY(args)->len;\
-	argv = ALLOCA_N(VALUE, argc);\
-	MEMCPY(argv, RARRAY(args)->ptr, VALUE, argc);\
-	ruby_sourcefile = file;\
-	ruby_sourceline = line;\
-    }\
-} while (0)
-
-#define BEGIN_CALLARGS do {\
-    struct BLOCK *tmp_block = ruby_block;\
-    if (ruby_iter->iter == ITER_PRE) {\
-	ruby_block = ruby_block->prev;\
-    }\
-    PUSH_ITER(ITER_NOT)
-
-#define END_CALLARGS \
-    ruby_block = tmp_block;\
-    POP_ITER();\
-} while (0)
-
-#define MATCH_DATA *rb_svar(node->nd_cnt)
-
-static char* is_defined _((VALUE, NODE*, char*));
-
-static char*
-arg_defined(self, node, buf, type)
-    VALUE self;
-    NODE *node;
-    char *buf;
-    char *type;
-{
-    int argc;
-    int i;
-
-    if (!node) return type;	/* no args */
-    if (nd_type(node) == NODE_ARRAY) {
-	argc=node->nd_alen;
-        if (argc > 0) {
-	    for (i=0;ind_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;
-    NODE *node;			/* OK */
-    char *buf;
-{
-    VALUE val;			/* OK */
-    int state;
-
-  again:
-    if (!node) return "expression";
-    switch (nd_type(node)) {
-      case NODE_SUPER:
-      case NODE_ZSUPER:
-	if (ruby_frame->last_func == 0) return 0;
-	else if (ruby_frame->last_class == 0) return 0;
-	else if (rb_method_boundp(RCLASS(ruby_frame->last_class)->super,
-				  ruby_frame->last_func, 0)) {
-	    if (nd_type(node) == NODE_SUPER) {
-		return arg_defined(self, node->nd_args, buf, "super");
-	    }
-	    return "super";
-	}
-	break;
-
-      case NODE_VCALL:
-      case NODE_FCALL:
-	val = self;
-	goto check_bound;
-
-      case NODE_CALL:
-	PUSH_TAG(PROT_NONE);
-	if ((state = EXEC_TAG()) == 0) {
-	    val = rb_eval(self, node->nd_recv);
-	}
-	POP_TAG();
-	if (state) {
-	    ruby_errinfo = Qnil;
-	    return 0;
-	}
-      check_bound:
-	{
-	    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, "method");
-	}
-	break;
-
-      case NODE_MATCH2:
-      case NODE_MATCH3:
-	return "method";
-
-      case NODE_YIELD:
-	if (rb_block_given_p()) {
-	    return "yield";
-	}
-	break;
-
-      case NODE_SELF:
-	return "self";
-
-      case NODE_NIL:
-	return "nil";
-
-      case NODE_TRUE:
-	return "true";
-
-      case NODE_FALSE:
-	return "false";
-
-      case NODE_ATTRSET:
-      case NODE_OP_ASGN1:
-      case NODE_OP_ASGN2:
-      case NODE_MASGN:
-      case NODE_LASGN:
-      case NODE_DASGN:
-      case NODE_DASGN_CURR:
-      case NODE_GASGN:
-      case NODE_CDECL:
-      case NODE_CVDECL:
-      case NODE_CVASGN:
-	return "assignment";
-
-      case NODE_LVAR:
-	return "local-variable";
-      case NODE_DVAR:
-	return "local-variable(in-block)";
-
-      case NODE_GVAR:
-	if (rb_gvar_defined(node->nd_entry)) {
-	    return "global-variable";
-	}
-	break;
-
-      case NODE_IVAR:
-	if (rb_ivar_defined(self, node->nd_vid)) {
-	    return "instance-variable";
-	}
-	break;
-
-      case NODE_CONST:
-	if (ev_const_defined(RNODE(ruby_frame->cbase), 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) {
-	    val = rb_eval(self, node->nd_head);
-	}
-	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))
-		    return "constant";
-		break;
-	      default:
-		if (rb_method_boundp(CLASS_OF(val), node->nd_mid, 1)) {
-		    return "method";
-		}
-	    }
-	}
-	break;
-
-      case NODE_NTH_REF:
-	if (RTEST(rb_reg_nth_defined(node->nd_nth, MATCH_DATA))) {
-	    sprintf(buf, "$%d", node->nd_nth);
-	    return buf;
-	}
-	break;
-
-      case NODE_BACK_REF:
-	if (RTEST(rb_reg_nth_defined(0, MATCH_DATA))) {
-	    sprintf(buf, "$%c", 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) {
-	    rb_eval(self, node);
-	}
-	POP_TAG();
-	if (!state) {
-	    return "expression";
-	}
-	ruby_errinfo = Qnil;
-	break;
-    }
-    return 0;
-}
-
-static int handle_rescue _((VALUE,NODE*));
-
-static void blk_free();
-
-static VALUE
-rb_obj_is_block(block)
-    VALUE block;
-{
-    if (TYPE(block) == T_DATA && RDATA(block)->dfree == (RUBY_DATA_FUNC)blk_free) {
-	return Qtrue;
-    }
-    return Qfalse;
-}
-
-static VALUE
-rb_obj_is_proc(proc)
-    VALUE proc;
-{
-    if (rb_obj_is_block(proc) && rb_obj_is_kind_of(proc, rb_cProc)) {
-	return Qtrue;
-    }
-    return Qfalse;
-}
-
-static VALUE
-set_trace_func(obj, trace)
-    VALUE obj, trace;
-{
-    if (NIL_P(trace)) {
-	trace_func = 0;
-	return Qnil;
-    }
-    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, klass)
-    char *event;
-    char *file;
-    int line;
-    VALUE self;
-    ID id;
-    VALUE klass;		/* OK */
-{
-    int state;
-    struct FRAME *prev;
-    char *file_save = ruby_sourcefile;
-    int line_save = ruby_sourceline;
-    VALUE srcfile;
-
-    if (!trace_func) return;
-    if (tracing) return;
-
-    tracing = 1;
-    prev = ruby_frame;
-    PUSH_FRAME();
-    *ruby_frame = *prev;
-    ruby_frame->prev = prev;
-    ruby_frame->iter = 0;	/* blocks not available anyway */
-
-    if (file) {
-	ruby_frame->line = ruby_sourceline = line;
-	ruby_frame->file = ruby_sourcefile = file;
-    }
-    if (klass) {
-	if (TYPE(klass) == T_ICLASS) {
-	    klass = RBASIC(klass)->klass;
-	}
-	else if (FL_TEST(klass, FL_SINGLETON)) {
-	    klass = self;
-	}
-    }
-    PUSH_TAG(PROT_NONE);
-    if ((state = EXEC_TAG()) == 0) {
-	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),
-		    Qtrue, Qundef);
-    }
-    POP_TMPTAG();		/* do not propagate retval */
-    POP_FRAME();
-
-    tracing = 0;
-    ruby_sourceline = line_save;
-    ruby_sourcefile = file_save;
-    if (state) JUMP_TAG(state);
-}
-
-static VALUE
-svalue_to_avalue(v)
-    VALUE v;
-{
-    if (NIL_P(v)) return rb_ary_new2(0);
-    if (v == Qundef) return rb_ary_new2(0);
-    if (TYPE(v) == T_ARRAY) {
-	if (RARRAY(v)->len > 1) return v;
-	return rb_ary_new3(1, v);
-    }
-    else {
-	v = rb_ary_to_ary(v);
-    }
-    return v;
-}
-
-static VALUE
-avalue_to_svalue(v)
-    VALUE v;
-{
-    if (TYPE(v) != T_ARRAY) {
-	v = rb_ary_to_ary(v);
-    }
-    if (RARRAY(v)->len == 0) {
-	return Qnil;
-    }
-    if (RARRAY(v)->len == 1) {
-	return RARRAY(v)->ptr[0];
-    }
-    return v;
-}
-
-static VALUE
-avalue_to_yvalue(v)
-    VALUE v;
-{
-    if (TYPE(v) != T_ARRAY) {
-	v = rb_ary_to_ary(v);
-    }
-    if (RARRAY(v)->len == 0) {
-	return Qundef;
-    }
-    if (RARRAY(v)->len == 1) {
-	return RARRAY(v)->ptr[0];
-    }
-    return v;
-}
-
-static VALUE
-svalue_to_mvalue(v)
-    VALUE v;
-{
-    if (v == Qnil || v == Qundef)
-	return rb_ary_new2(0);
-    if (TYPE(v) == T_ARRAY) {
-	return v;
-    }
-    else {
-	v = rb_ary_to_ary(v);
-    }
-    return v;
-}
-
-static VALUE
-mvalue_to_svalue(v)
-    VALUE v;
-{
-    if (TYPE(v) != T_ARRAY) {
-	v = rb_ary_to_ary(v);
-    }
-    if (RARRAY(v)->len == 0) {
-	return Qnil;
-    }
-    if (RARRAY(v)->len == 1 && TYPE(RARRAY(v)->ptr[0]) != T_ARRAY) {
-	return RARRAY(v)->ptr[0];
-    }
-    return v;
-}
-
-static void return_check _((void));
-#define return_value(v) prot_tag->retval = (v)
-
-static VALUE
-rb_eval(self, n)
-    VALUE self;
-    NODE *n;
-{
-    NODE * volatile node = n;
-    int state;
-    volatile VALUE result = Qnil;
-
-#define RETURN(v) do { \
-    result = (v); \
-    goto finish; \
-} while (0)
-
-  again:
-    if (!node) RETURN(Qnil);
-
-    switch (nd_type(node)) {
-      case NODE_BLOCK:
-	while (node->nd_next) {
-	    rb_eval(self, node->nd_head);
-	    node = node->nd_next;
-	}
-	node = node->nd_head;
-	goto again;
-
-      case NODE_POSTEXE:
-	rb_f_END();
-	nd_set_type(node, NODE_NIL); /* exec just once */
-	result = Qnil;
-	break;
-
-	/* begin .. end without clauses */
-      case NODE_BEGIN:
-	node = node->nd_body;
-	goto again;
-
-	/* nodes for speed-up(default match) */
-      case NODE_MATCH:
-	result = rb_reg_match2(node->nd_lit);
-	break;
-
-	/* nodes for speed-up(literal match) */
-      case NODE_MATCH2:
-	result = rb_reg_match(rb_eval(self,node->nd_recv),
-			      rb_eval(self,node->nd_value));
-	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(l) == T_STRING) {
-		result = rb_reg_match(r, l);
-	    }
-	    else {
-		result = rb_funcall(l, match, 1, r);
-	    }
-	}
-	break;
-
-	/* node for speed-up(top-level loop for -n/-p) */
-      case NODE_OPT_N:
-	PUSH_TAG(PROT_NONE);
-	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:
-	RETURN(self);
-
-      case NODE_NIL:
-	RETURN(Qnil);
-
-      case NODE_TRUE:
-	RETURN(Qtrue);
-
-      case NODE_FALSE:
-	RETURN(Qfalse);
-
-      case NODE_IF:
-	ruby_sourceline = nd_line(node);
-	if (trace_func) {
-	    call_trace_func("line", node->nd_file, ruby_sourceline, self,
-			    ruby_frame->last_func,
-			    ruby_frame->last_class);	
-	}
-	if (RTEST(rb_eval(self, node->nd_cond))) {
-	    node = node->nd_body;
-	}
-	else {
-	    node = node->nd_else;
-	}
-	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->nd_file, nd_line(tag), self,
-				    ruby_frame->last_func,
-				    ruby_frame->last_class);	
-		}
-		ruby_sourcefile = tag->nd_file;
-		ruby_sourceline = nd_line(tag);
-		if (nd_type(tag->nd_head) == NODE_WHEN) {
-		    VALUE v = rb_eval(self, tag->nd_head->nd_head);
-		    int i;
-
-		    if (TYPE(v) != T_ARRAY) v = rb_ary_to_ary(v);
-		    for (i=0; ilen; 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;
-
-	    val = rb_eval(self, node->nd_head);
-	    node = node->nd_body;
-	    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->nd_file, nd_line(tag), self,
-					ruby_frame->last_func,
-					ruby_frame->last_class);	
-		    }
-		    ruby_sourcefile = tag->nd_file;
-		    ruby_sourceline = nd_line(tag);
-		    if (nd_type(tag->nd_head) == NODE_WHEN) {
-			VALUE v = rb_eval(self, tag->nd_head->nd_head);
-			int i;
-
-			if (TYPE(v) != T_ARRAY) v = rb_ary_to_ary(v);
-			for (i=0; ilen; i++) {
-			    if (RTEST(rb_funcall2(RARRAY(v)->ptr[i], eqq, 1, &val))){
-				node = node->nd_body;
-				goto again;
-			    }
-			}
-			tag = tag->nd_next;
-			continue;
-		    }
-		    if (RTEST(rb_funcall2(rb_eval(self, tag->nd_head), eqq, 1, &val))) {
-			node = node->nd_body;
-			goto again;
-		    }
-		    tag = tag->nd_next;
-		}
-		node = node->nd_next;
-	    }
-	}
-	RETURN(Qnil);
-
-      case NODE_WHILE:
-	PUSH_TAG(PROT_NONE);
-	result = Qnil;
-	switch (state = EXEC_TAG()) {
-	  case 0:
-	    ruby_sourceline = nd_line(node);
-	    if (node->nd_state && !RTEST(rb_eval(self, node->nd_cond)))
-		goto while_out;
-	    do {
-	      while_redo:
-		rb_eval(self, node->nd_body);
-	      while_next:
-		;
-	    } while (RTEST(rb_eval(self, node->nd_cond)));
-	    break;
-
-	  case TAG_REDO:
-	    state = 0;
-	    goto while_redo;
-	  case TAG_NEXT:
-	    state = 0;
-	    goto while_next;
-	  case TAG_BREAK:
-	    state = 0;
-	    result = prot_tag->retval;
-	  default:
-	    break;
-	}
-      while_out:
-	POP_TAG();
-	if (state) JUMP_TAG(state);
-	RETURN(result);
-
-      case NODE_UNTIL:
-	PUSH_TAG(PROT_NONE);
-	result = Qnil;
-	switch (state = EXEC_TAG()) {
-	  case 0:
-	    ruby_sourceline = nd_line(node);
-	    if (node->nd_state && RTEST(rb_eval(self, node->nd_cond)))
-		goto until_out;
-	    do {
-	      until_redo:
-		rb_eval(self, node->nd_body);
-	      until_next:
-		;
-	    } while (!RTEST(rb_eval(self, node->nd_cond)));
-	    break;
-
-	  case TAG_REDO:
-	    state = 0;
-	    goto until_redo;
-	  case TAG_NEXT:
-	    state = 0;
-	    goto until_next;
-	  case TAG_BREAK:
-	    state = 0;
-	    result = prot_tag->retval;
-	  default:
-	    break;
-	}
-      until_out:
-	POP_TAG();
-	if (state) JUMP_TAG(state);
-	RETURN(result);
-
-      case NODE_BLOCK_PASS:
-	result = block_pass(self, node);
-	break;
-
-      case NODE_ITER:
-      case NODE_FOR:
-	{
-	  iter_retry:
-	    PUSH_TAG(PROT_FUNC);
-	    PUSH_BLOCK(node->nd_var, node->nd_body);
-
-	    state = EXEC_TAG();
-	    if (state == 0) {
-		PUSH_ITER(ITER_PRE);
-		if (nd_type(node) == NODE_ITER) {
-		    result = rb_eval(self, node->nd_iter);
-		}
-		else {
-		    VALUE recv;
-		    char *file = ruby_sourcefile;
-		    int line = ruby_sourceline;
-
-		    _block.flags &= ~BLOCK_D_SCOPE;
-		    BEGIN_CALLARGS;
-		    recv = rb_eval(self, node->nd_iter);
-		    END_CALLARGS;
-		    ruby_sourcefile = file;
-		    ruby_sourceline = line;
-		    result = rb_call(CLASS_OF(recv),recv,each,0,0,0);
-		}
-		POP_ITER();
-	    }
-	    else if (_block.tag->dst == state) {
-		state &= TAG_MASK;
-		if (state == TAG_RETURN || state == TAG_BREAK) {
-		    result = prot_tag->retval;
-		}
-	    }
-	    POP_BLOCK();
-	    POP_TAG();
-	    switch (state) {
-	      case 0:
-		break;
-
-	      case TAG_RETRY:
-		goto iter_retry;
-
-	      case TAG_BREAK:
-		break;
-
-	      case TAG_RETURN:
-		return_value(result);
-		/* fall through */
-	      default:
-		JUMP_TAG(state);
-	    }
-	}
-	break;
-
-      case NODE_BREAK:
-	if (node->nd_stts) {
- 	    return_value(avalue_to_svalue(rb_eval(self, node->nd_stts)));
- 	}
-	else {
-	    return_value(Qnil);
-	}
-	JUMP_TAG(TAG_BREAK);
-	break;
-
-      case NODE_NEXT:
-	CHECK_INTS;
-	if (node->nd_stts) {
- 	    return_value(avalue_to_svalue(rb_eval(self, node->nd_stts)));
- 	}
-	else {
-	    return_value(Qnil);
-	}
-	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_RESTARGS:
-      case NODE_RESTARY:
-	result = rb_ary_to_ary(rb_eval(self, node->nd_head));
-	break;
-
-      case NODE_REXPAND:
-	result = avalue_to_svalue(rb_eval(self, node->nd_head));
-	break;
-
-      case NODE_YIELD:
-	if (node->nd_stts) {
-	    result = avalue_to_yvalue(rb_eval(self, node->nd_stts));
-	}
-	else {
-	    result = Qundef;	/* no arg */
-	}
-	result = rb_yield_0(result, 0, 0, 0);
-	break;
-
-      case NODE_RESCUE:
-      retry_entry:
-        {
-	    volatile VALUE e_info = ruby_errinfo;
-
-	    PUSH_TAG(PROT_NONE);
-	    if ((state = EXEC_TAG()) == 0) {
-		result = rb_eval(self, node->nd_head);
-	    }
-	    POP_TAG();
-	    if (state == TAG_RAISE) {
-		NODE * volatile resq = node->nd_resq;
-
-		ruby_sourceline = nd_line(node);
-		while (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 == TAG_RETRY) {
-			    state = 0;
-			    ruby_errinfo = Qnil;
-			    goto retry_entry;
-			}
-			if (state != TAG_RAISE) {
-			    ruby_errinfo = e_info;
-			}
-			break;
-		    }
-		    resq = resq->nd_head; /* next rescue */
-		}
-	    }
-	    else if (node->nd_else) { /* else clause given */
-		if (!state) {	/* no exception raised */
-		    result = rb_eval(self, node->nd_else);
-		}
-	    }
-	    if (state) JUMP_TAG(state);
-	}
-        break;
-
-      case NODE_ENSURE:
-	PUSH_TAG(PROT_NONE);
-	if ((state = EXEC_TAG()) == 0) {
-	    result = rb_eval(self, node->nd_head);
-	}
-	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);
-	break;
-
-      case NODE_AND:
-	result = rb_eval(self, node->nd_1st);
-	if (!RTEST(result)) break;
-	node = node->nd_2nd;
-	goto again;
-
-      case NODE_OR:
-	result = rb_eval(self, node->nd_1st);
-	if (RTEST(result)) break;
-	node = node->nd_2nd;
-	goto again;
-
-      case NODE_NOT:
-	if (RTEST(rb_eval(self, node->nd_body))) result = Qfalse;
-	else result = Qtrue;
-	break;
-
-      case NODE_DOT2:
-      case NODE_DOT3:
-	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 */
-	{
-	    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 {
-		if (RTEST(rb_eval(self, node->nd_end))) {
-		    *flip = Qfalse;
-		}
-		result = Qtrue;
-	    }
-	}
-	break;
-
-      case NODE_FLIP3:		/* like SED */
-	{
-	    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;
-	    }
-	    else {
-		if (RTEST(rb_eval(self, node->nd_end))) {
-		    *flip = Qfalse;
-		}
-		result = Qtrue;
-	    }
-	}
-	break;
-
-      case NODE_RETURN:
-	if (node->nd_stts) {
- 	    return_value(avalue_to_svalue(rb_eval(self, node->nd_stts)));
- 	}
-	else {
-	    return_value(Qnil);
-	}
-	return_check();
-	JUMP_TAG(TAG_RETURN);
-	break;
-
-      case NODE_ARGSCAT:
-	result = rb_ary_concat(rb_eval(self, node->nd_head),
-			       rb_eval(self, node->nd_body));
-	break;
-
-      case NODE_ARGSPUSH:
-	result = rb_ary_push(rb_ary_dup(rb_eval(self, node->nd_head)),
-			     rb_eval(self, node->nd_body));
-	break;
-
-      case NODE_CALL:
-	{
-	    VALUE recv;
-	    int argc; VALUE *argv; /* used in SETUP_ARGS */
-	    TMP_PROTECT;
-
-	    BEGIN_CALLARGS;
-	    recv = rb_eval(self, node->nd_recv);
-	    SETUP_ARGS(node->nd_args);
-	    END_CALLARGS;
-
-	    result = rb_call(CLASS_OF(recv),recv,node->nd_mid,argc,argv,0);
-	}
-	break;
-
-      case NODE_FCALL:
-	{
-	    int argc; VALUE *argv; /* used in SETUP_ARGS */
-	    TMP_PROTECT;
-
-	    BEGIN_CALLARGS;
-	    SETUP_ARGS(node->nd_args);
-	    END_CALLARGS;
-
-	    result = rb_call(CLASS_OF(self),self,node->nd_mid,argc,argv,1);
-	}
-	break;
-
-      case NODE_VCALL:
-	result = rb_call(CLASS_OF(self),self,node->nd_mid,0,0,2);
-	break;
-
-      case NODE_SUPER:
-      case NODE_ZSUPER:
-	{
-	    int argc; VALUE *argv; /* used in SETUP_ARGS */
-	    TMP_PROTECT;
-
-	    if (ruby_frame->last_class == 0) {	
-		if (ruby_frame->last_func) {
-		    rb_name_error(ruby_frame->last_func,
-				  "superclass method `%s' disabled",
-				  rb_id2name(ruby_frame->last_func));
-		}
-		else {
-		    rb_raise(rb_eNoMethodError, "super called outside of method");
-		}
-	    }
-	    if (nd_type(node) == NODE_ZSUPER) {
-		argc = ruby_frame->argc;
-		argv = ruby_frame->argv;
-	    }
-	    else {
-		BEGIN_CALLARGS;
-		SETUP_ARGS(node->nd_args);
-		END_CALLARGS;
-	    }
-
-	    PUSH_ITER(ruby_iter->iter?ITER_PRE:ITER_NOT);
-	    result = rb_call(RCLASS(ruby_frame->last_class)->super,
-			     ruby_frame->self, ruby_frame->last_func,
-			     argc, argv, 3);
-	    POP_ITER();
-	}
-	break;
-
-      case NODE_SCOPE:
-	{
-	    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) {
-		saved_cref = ruby_cref;
-		ruby_cref = (NODE*)node->nd_rval;
-		ruby_frame->cbase = node->nd_rval;
-	    }
-	    if (node->nd_tbl) {
-		VALUE *vars = ALLOCA_N(VALUE, node->nd_tbl[0]+1);
-		*vars++ = (VALUE)node;
-		ruby_scope->local_vars = vars;
-		rb_mem_clear(ruby_scope->local_vars, node->nd_tbl[0]);
-		ruby_scope->local_tbl = node->nd_tbl;
-	    }
-	    else {
-		ruby_scope->local_vars = 0;
-		ruby_scope->local_tbl  = 0;
-	    }
-	    if ((state = EXEC_TAG()) == 0) {
-		result = rb_eval(self, node->nd_next);
-	    }
-	    POP_TAG();
-	    POP_SCOPE();
-	    ruby_frame = frame.tmp;
-	    if (saved_cref)
-		ruby_cref = saved_cref;
-	    if (state) JUMP_TAG(state);
-	}
-	break;
-
-      case NODE_OP_ASGN1:
-	{
-	    int argc; VALUE *argv; /* used in SETUP_ARGS */
-	    VALUE recv, val;
-	    NODE *rval;
-	    TMP_PROTECT;
-
-	    recv = rb_eval(self, node->nd_recv);
-	    rval = node->nd_args->nd_head;
-	    SETUP_ARGS(node->nd_args->nd_next);
-	    val = rb_funcall2(recv, aref, argc-1, argv);
-	    switch (node->nd_mid) {
-	    case 0: /* OR */
-		if (RTEST(val)) RETURN(val);
-		val = rb_eval(self, rval);
-		break;
-	    case 1: /* AND */
-		if (!RTEST(val)) RETURN(val);
-		val = rb_eval(self, rval);
-		break;
-	    default:
-		val = rb_funcall(val, node->nd_mid, 1, rb_eval(self, rval));
-	    }
-	    argv[argc-1] = val;
-	    rb_funcall2(recv, aset, argc, argv);
-	    result = val;
-	}
-	break;
-
-      case NODE_OP_ASGN2:
-	{
-	    ID id = node->nd_next->nd_vid;
-	    VALUE recv, val;
-
-	    recv = rb_eval(self, node->nd_recv);
-	    val = rb_funcall(recv, id, 0);
-	    switch (node->nd_next->nd_mid) {
-	    case 0: /* OR */
-		if (RTEST(val)) RETURN(val);
-		val = rb_eval(self, node->nd_value);
-		break;
-	    case 1: /* AND */
-		if (!RTEST(val)) RETURN(val);
-		val = rb_eval(self, node->nd_value);
-		break;
-	    default:
-		val = rb_funcall(val, node->nd_next->nd_mid, 1,
-				 rb_eval(self, node->nd_value));
-	    }
-
-	    rb_funcall2(recv, node->nd_next->nd_aid, 1, &val);
-	    result = val;
-	}
-	break;
-
-      case NODE_OP_ASGN_AND:
-	result = rb_eval(self, node->nd_head);
-	if (!RTEST(result)) break;
-	node = node->nd_value;
-	goto again;
-
-      case NODE_OP_ASGN_OR:
-	if ((node->nd_aid && !rb_ivar_defined(self, node->nd_aid)) ||
-	    !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),0);
-	break;
-
-      case NODE_LASGN:
-	if (ruby_scope->local_vars == 0)
-	    rb_bug("unexpected local variable assignment");
-	result = rb_eval(self, node->nd_value);
-	ruby_scope->local_vars[node->nd_cnt] = result;
-	break;
-
-      case NODE_DASGN:
-	result = rb_eval(self, node->nd_value);
-	dvar_asgn(node->nd_vid, result);
-	break;
-
-      case NODE_DASGN_CURR:
-	result = rb_eval(self, node->nd_value);
-	dvar_asgn_curr(node->nd_vid, result);
-	break;
-
-      case NODE_GASGN:
-	result = rb_eval(self, node->nd_value);
-	rb_gvar_set(node->nd_entry, result);
-	break;
-
-      case NODE_IASGN:
-	result = rb_eval(self, node->nd_value);
-	rb_ivar_set(self, node->nd_vid, result);
-	break;
-
-      case NODE_CDECL:
-	if (NIL_P(ruby_class)) {
-	    rb_raise(rb_eTypeError, "no class/module to define constant");
-	}
-	result = rb_eval(self, node->nd_value);
-	rb_const_set(ruby_class, node->nd_vid, result);
-	break;
-
-      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 (ruby_scope->local_vars == 0) {
-	    rb_bug("unexpected local variable");
-	}
-	result = ruby_scope->local_vars[node->nd_cnt];
-	break;
-
-      case NODE_DVAR:
-	result = rb_dvar_ref(node->nd_vid);
-	break;
-
-      case NODE_GVAR:
-	result = rb_gvar_get(node->nd_entry);
-	break;
-
-      case NODE_IVAR:
-	result = rb_ivar_get(self, node->nd_vid);
-	break;
-
-      case NODE_CONST:
-	result = ev_const_get(RNODE(ruby_frame->cbase), node->nd_vid, self);
-	break;
-
-      case NODE_CVAR:
-	result = rb_cvar_get(cvar_cbase(), node->nd_vid);
-	break;
-
-      case NODE_BLOCK_ARG:
-	if (ruby_scope->local_vars == 0)
-	    rb_bug("unexpected block argument");
-	if (rb_block_given_p()) {
-	    result = rb_f_lambda();
-	    ruby_scope->local_vars[node->nd_cnt] = result;
-	}
-	else {
-	    result = Qnil;
-	}
-	break;
-
-      case NODE_COLON2:
-	{
-	    VALUE klass;
-
-	    klass = rb_eval(self, node->nd_head);
-	    switch (TYPE(klass)) {
-	      case T_CLASS:
-	      case T_MODULE:
-		break;
-	      default:
-		return rb_funcall(klass, node->nd_mid, 0, 0);
-	    }
-	    result = rb_const_get(klass, node->nd_mid);
-	}
-	break;
-
-      case NODE_COLON3:
-	result = rb_const_get_at(rb_cObject, node->nd_mid);
-	break;
-
-      case NODE_NTH_REF:
-	result = rb_reg_nth_match(node->nd_nth, MATCH_DATA);
-	break;
-
-      case NODE_BACK_REF:
-	switch (node->nd_nth) {
-	  case '&':
-	    result = rb_reg_last_match(MATCH_DATA);
-	    break;
-	  case '`':
-	    result = rb_reg_match_pre(MATCH_DATA);
-	    break;
-	  case '\'':
-	    result = rb_reg_match_post(MATCH_DATA);
-	    break;
-	  case '+':
-	    result = rb_reg_match_last(MATCH_DATA);
-	    break;
-	  default:
-	    rb_bug("unexpected back-ref");
-	}
-	break;
-
-      case NODE_HASH:
-	{
-	    NODE *list;
-	    VALUE hash = rb_hash_new();
-	    VALUE key, val;
-
-	    list = node->nd_head;
-	    while (list) {
-		key = rb_eval(self, list->nd_head);
-		list = list->nd_next;
-		if (list == 0)
-		    rb_bug("odd number list for Hash");
-		val = rb_eval(self, list->nd_head);
-		list = list->nd_next;
-		rb_hash_aset(hash, key, val);
-	    }
-	    result = hash;
-	}
-	break;
-
-      case NODE_ZARRAY:		/* zero length list */
-	result = rb_ary_new();
-	break;
-
-      case NODE_ARRAY:
-	{
-	    VALUE ary;
-	    int i;
-
-	    i = node->nd_alen;
-	    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;
-	    }
-
-	    result = ary;
-	}
-	break;
-
-      case NODE_STR:
-	result = rb_str_new3(node->nd_lit);
-	break;
-
-      case NODE_DSTR:
-      case NODE_DXSTR:
-      case NODE_DREGX:
-      case NODE_DREGX_ONCE:
-	{
-	    VALUE str, str2;
-	    NODE *list = node->nd_next;
-
-	    str = rb_str_new3(node->nd_lit);
-	    while (list) {
-		if (list->nd_head) {
-		    switch (nd_type(list->nd_head)) {
-		      case NODE_STR:
-			str2 = list->nd_head->nd_lit;
-			break;
-		      default:
-			ruby_sourceline = nd_line(list->nd_head);
-			str2 = rb_obj_as_string(rb_eval(self, list->nd_head));
-			break;
-		    }
-		    rb_str_append(str, str2);
-		    OBJ_INFECT(str, str2);
-		}
-		list = list->nd_next;
-	    }
-	    switch (nd_type(node)) {
-	      case NODE_DREGX:
-		result = rb_reg_new(RSTRING(str)->ptr, RSTRING(str)->len,
-				 node->nd_cflag);
-		break;
-	      case NODE_DREGX_ONCE:	/* regexp expand once */
-		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_DXSTR:
-		result = rb_funcall(self, '`', 1, str);
-		break;
-	      default:
-		result = str;
-		break;
-	    }
-	}
-	break;
-
-      case NODE_XSTR:
-	result = rb_funcall(self, '`', 1, node->nd_lit);
-	break;
-
-      case NODE_LIT:
-	result = node->nd_lit;
-	break;
-
-      case NODE_ATTRSET:
-	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,  *defn;
-	    VALUE origin;
-	    int noex;
-
-	    if (NIL_P(ruby_class)) {
-		rb_raise(rb_eTypeError, "no class/module to add method");
-	    }
-	    if (ruby_class == rb_cClass && node->nd_mid == alloc) {
-		rb_raise(rb_eNameError, "redefining Class#allocate will cause infinite loop");
-	    }
-	    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));
-	    }
-	    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) {
-		    rb_warning("method redefined; discarding old %s", rb_id2name(node->nd_mid));
-		}
-		if (node->nd_noex) { /* toplevel */
-		    /* should upgrade to rb_warn() if no super was called inside? */
-		    rb_warning("overriding global function `%s'",
-			       rb_id2name(node->nd_mid));
-		}
-	    }
-
-	    if (SCOPE_TEST(SCOPE_PRIVATE) || node->nd_mid == init) {
-		noex = NOEX_PRIVATE;
-	    }
-	    else if (SCOPE_TEST(SCOPE_PROTECTED)) {
-		noex = NOEX_PROTECTED;
-	    }
-	    else if (ruby_class == rb_cObject) {
-		noex =  node->nd_noex;
-	    }
-	    else {
-		noex = NOEX_PUBLIC;
-	    }
-	    if (body && origin == ruby_class && body->nd_noex & NOEX_UNDEF) {
-		noex |= NOEX_UNDEF;
-	    }
-
-	    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(ruby_class),
-			      node->nd_mid, defn, NOEX_PUBLIC);
-		rb_funcall(ruby_class, singleton_added, 1, ID2SYM(node->nd_mid));
-	    }
-	    if (FL_TEST(ruby_class, FL_SINGLETON)) {
-		rb_funcall(rb_iv_get(ruby_class, "__attached__"),
-			   singleton_added, 1, ID2SYM(node->nd_mid));
-	    }
-	    else {
-		rb_funcall(ruby_class, added, 1, ID2SYM(node->nd_mid));
-	    }
-	    result = Qnil;
-	}
-	break;
-
-      case NODE_DEFS:
-	if (node->nd_defn) {
-	    VALUE recv = rb_eval(self, node->nd_recv);
-	    VALUE klass;
-	    NODE *body = 0, *defn;
-
-	    if (ruby_safe_level >= 4 && !OBJ_TAINTED(recv)) {
-		rb_raise(rb_eSecurityError, "Insecure: can't define singleton method");
-	    }
-	    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_class2name(CLASS_OF(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)) {
-		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));
-		}
-	    }
-	    defn = copy_node_scope(node->nd_defn, ruby_cref);
-	    defn->nd_rval = (VALUE)ruby_cref;
-	    rb_add_method(klass, node->nd_mid, defn, 
-			  NOEX_PUBLIC|(body?body->nd_noex&NOEX_UNDEF:0));
-	    rb_funcall(recv, singleton_added, 1, ID2SYM(node->nd_mid));
-	    result = Qnil;
-	}
-	break;
-
-      case NODE_UNDEF:
-	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:
-	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;
-
-      case NODE_VALIAS:
-	rb_alias_variable(node->nd_new, node->nd_old);
-	result = Qnil;
-	break;
-
-      case NODE_CLASS:
-	{
-	    VALUE super, klass, tmp;
-
-	    if (NIL_P(ruby_class)) {
-		rb_raise(rb_eTypeError, "no outer class/module");
-	    }
-	    if (node->nd_super) {
-		super = superclass(self, node->nd_super);
-	    }
-	    else {
-		super = 0;
-	    }
-
-	    klass = 0;
-	    if ((ruby_class == rb_cObject) && rb_autoload_defined(node->nd_cname)) {
-		rb_autoload_load(node->nd_cname);
-	    }
-	    if (rb_const_defined_at(ruby_class, node->nd_cname)) {
-		klass = rb_const_get(ruby_class, node->nd_cname);
-	    }
-	    if (klass) {
-		if (TYPE(klass) != T_CLASS) {
-		    rb_raise(rb_eTypeError, "%s is not a class",
-			     rb_id2name(node->nd_cname));
-		}
-		if (super) {
-		    tmp = rb_class_real(RCLASS(klass)->super);
-		    if (tmp != super) {
-			goto override_class;
-		    }
-		}
-		if (ruby_safe_level >= 4) {
-		    rb_raise(rb_eSecurityError, "extending class prohibited");
-		}
-	    }
-	    else {
-	      override_class:
-		if (!super) super = rb_cObject;
-		klass = rb_define_class_id(node->nd_cname, super);
-		rb_set_class_path(klass,ruby_class,rb_id2name(node->nd_cname));
-		rb_class_inherited(super, klass);
-		rb_const_set(ruby_class, node->nd_cname, klass);
-	    }
-	    if (ruby_wrapper) {
-		rb_extend_object(klass, ruby_wrapper);
-		rb_include_module(klass, ruby_wrapper);
-	    }
-
-	    result = module_setup(klass, node->nd_body);
-	}
-	break;
-
-      case NODE_MODULE:
-	{
-	    VALUE module;
-
-	    if (NIL_P(ruby_class)) {
-		rb_raise(rb_eTypeError, "no outer class/module");
-	    }
-	    module = 0;
-	    if ((ruby_class == rb_cObject) && rb_autoload_defined(node->nd_cname)) {
-		rb_autoload_load(node->nd_cname);
-	    }
-	    if (rb_const_defined_at(ruby_class, node->nd_cname)) {
-		module = rb_const_get(ruby_class, node->nd_cname);
-	    }
-	    if (module) {
-		if (TYPE(module) != T_MODULE) {
-		    rb_raise(rb_eTypeError, "%s is not a module",
-			     rb_id2name(node->nd_cname));
-		}
-		if (ruby_safe_level >= 4) {
-		    rb_raise(rb_eSecurityError, "extending module prohibited");
-		}
-	    }
-	    else {
-		module = rb_define_module_id(node->nd_cname);
-		rb_const_set(ruby_class, node->nd_cname, module);
-		rb_set_class_path(module,ruby_class,rb_id2name(node->nd_cname));
-	    }
-	    if (ruby_wrapper) {
-		rb_extend_object(module, ruby_wrapper);
-		rb_include_module(module, ruby_wrapper);
-	    }
-
-	    result = module_setup(module, node->nd_body);
-	}
-	break;
-
-      case NODE_SCLASS:
-	{
-	    VALUE klass;
-
-	    result = rb_eval(self, node->nd_recv);
-	    if (FIXNUM_P(result) || SYMBOL_P(result)) {
-		rb_raise(rb_eTypeError, "no virtual class for %s",
-			 rb_class2name(CLASS_OF(result)));
-	    }
-	    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);
-	    }
-	    
-	    result = module_setup(klass, node->nd_body);
-	}
-	break;
-
-      case NODE_DEFINED:
-	{
-	    char buf[20];
-	    char *desc = is_defined(self, node->nd_head, buf);
-
-	    if (desc) result = rb_str_new2(desc);
-	    else result = Qnil;
-	}
-	break;
-
-    case NODE_NEWLINE:
-	ruby_sourcefile = node->nd_file;
-	ruby_sourceline = node->nd_nth;
-	if (trace_func) {
-	    call_trace_func("line", ruby_sourcefile, ruby_sourceline, self,
-			    ruby_frame->last_func,
-			    ruby_frame->last_class);	
-	}
-	node = node->nd_next;
-	goto again;
-
-      default:
-	rb_bug("unknown node type %d", nd_type(node));
-    }
-  finish:
-    CHECK_INTS;
-    return result;
-}
-
-static VALUE
-module_setup(module, n)
-    VALUE module;
-    NODE *n;
-{
-    NODE * volatile node = n;
-    int state;
-    struct FRAME frame;
-    VALUE result;		/* OK */
-    char *file = ruby_sourcefile;
-    int line = ruby_sourceline;
-    TMP_PROTECT;
-
-    frame = *ruby_frame;
-    frame.tmp = ruby_frame;
-    ruby_frame = &frame;
-
-    PUSH_CLASS();
-    ruby_class = module;
-    PUSH_SCOPE();
-    PUSH_VARS();
-
-    if (node->nd_tbl) {
-	VALUE *vars = TMP_ALLOC(node->nd_tbl[0]+1);
-	*vars++ = (VALUE)node;
-	ruby_scope->local_vars = vars;
-	rb_mem_clear(ruby_scope->local_vars, node->nd_tbl[0]);
-	ruby_scope->local_tbl = node->nd_tbl;
-    }
-    else {
-	ruby_scope->local_vars = 0;
-	ruby_scope->local_tbl  = 0;
-    }
-
-    PUSH_CREF(module);
-    ruby_frame->cbase = (VALUE)ruby_cref;
-    PUSH_TAG(PROT_NONE);
-    if ((state = EXEC_TAG()) == 0) {
-	if (trace_func) {
-	    call_trace_func("class", file, line, ruby_class,
-			    ruby_frame->last_func,
-			    ruby_frame->last_class);
-	}
-	result = rb_eval(ruby_class, node->nd_next);
-    }
-    POP_TAG();
-    POP_CREF();
-    POP_VARS();
-    POP_SCOPE();
-    POP_CLASS();
-
-    ruby_frame = frame.tmp;
-    if (trace_func) {
-	call_trace_func("end", file, line, 0,
-			ruby_frame->last_func, ruby_frame->last_class);
-    }
-    if (state) JUMP_TAG(state);
-
-    return result;
-}
-
-int
-rb_respond_to(obj, id)
-    VALUE obj;
-    ID id;
-{
-    if (rb_method_boundp(CLASS_OF(obj), id, 0)) {
-	return Qtrue;
-    }
-    return Qfalse;
-}
-
-static VALUE
-rb_obj_respond_to(argc, argv, obj)
-    int argc;
-    VALUE *argv;
-    VALUE obj;
-{
-    VALUE mid, priv;
-    ID id;
-
-    rb_scan_args(argc, argv, "11", &mid, &priv);
-    id = rb_to_id(mid);
-    if (rb_method_boundp(CLASS_OF(obj), id, !RTEST(priv))) {
-	return Qtrue;
-    }
-    return Qfalse;
-}
-
-static VALUE
-rb_mod_method_defined(mod, mid)
-    VALUE mod, mid;
-{
-    if (rb_method_boundp(mod, rb_to_id(mid), 1)) {
-	return Qtrue;
-    }
-    return Qfalse;
-}
-
-NORETURN(static void terminate_process _((int, const char*, int)));
-static void
-terminate_process(status, mesg, mlen)
-    int status;
-    const char *mesg;
-    int mlen;
-{
-    VALUE exit = rb_exc_new(rb_eSystemExit, mesg, mlen);
-
-    rb_iv_set(exit, "status", INT2NUM(status));
-    rb_exc_raise(exit);
-}
-
-void
-rb_exit(status)
-    int status;
-{
-    if (prot_tag) {
-	terminate_process(status, "exit", 4);
-    }
-    ruby_finalize();
-    exit(status);
-}
-
-static VALUE
-rb_f_exit(argc, argv, obj)
-    int argc;
-    VALUE *argv;
-    VALUE obj;
-{
-    VALUE status;
-    int istatus;
-
-    rb_secure(4);
-    if (rb_scan_args(argc, argv, "01", &status) == 1) {
-	istatus = NUM2INT(status);
-    }
-    else {
-	istatus = 0;
-    }
-    rb_exit(istatus);
-    return Qnil;		/* not reached */
-}
-
-static VALUE
-rb_f_abort(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    rb_secure(4);
-    if (argc == 0) {
-	if (!NIL_P(ruby_errinfo)) {
-	    error_print();
-	}
-	rb_exit(1);
-    }
-    else {
-	VALUE mesg;
-
-	rb_scan_args(argc, argv, "1", &mesg);
-	StringValue(argv[0]);
-	rb_io_puts(argc, argv, rb_stderr);
-	terminate_process(1, RSTRING(argv[0])->ptr, RSTRING(argv[0])->len);
-    }
-    return Qnil;		/* not reached */
-}
-
-void
-rb_iter_break()
-{
-    JUMP_TAG(TAG_BREAK);
-}
-
-NORETURN(static void rb_longjmp _((int, VALUE)));
-static VALUE make_backtrace _((void));
-
-static void
-rb_longjmp(tag, mesg)
-    int tag;
-    VALUE mesg;
-{
-    VALUE at;
-
-    if (NIL_P(mesg)) mesg = ruby_errinfo;
-    if (NIL_P(mesg)) {
-	mesg = rb_exc_new(rb_eRuntimeError, 0, 0);
-    }
-
-    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)) {
-	ruby_errinfo = mesg;
-    }
-
-    if (RTEST(ruby_debug) && !NIL_P(ruby_errinfo)
-	&& !rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) {
-	VALUE e = ruby_errinfo;
-
-	StringValue(e);
-	fprintf(stderr, "Exception `%s' at %s:%d - %s\n",
-		rb_class2name(CLASS_OF(ruby_errinfo)),
-		ruby_sourcefile, ruby_sourceline,
-		RSTRING(e)->ptr);
-    }
-
-    rb_trap_restore_mask();
-    if (trace_func && tag != TAG_FATAL) {
-	call_trace_func("raise", ruby_sourcefile, ruby_sourceline,
-			ruby_frame->self,
-			ruby_frame->last_func,
-			ruby_frame->last_class);
-    }
-    if (!prot_tag) {
-	error_print();
-    }
-    JUMP_TAG(tag);
-}
-
-void
-rb_exc_raise(mesg)
-    VALUE mesg;
-{
-    rb_longjmp(TAG_RAISE, mesg);
-}
-
-void
-rb_exc_fatal(mesg)
-    VALUE mesg;
-{
-    rb_longjmp(TAG_FATAL, mesg);
-}
-
-void
-rb_interrupt()
-{
-    rb_raise(rb_eInterrupt, "");
-}
-
-static VALUE
-rb_f_raise(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE mesg;
-    ID exception;
-    int n;
-
-    mesg = Qnil;
-    switch (argc) {
-      case 0:
-	mesg = Qnil;
-	break;
-      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:
-      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 (argc > 0) {
-	if (!rb_obj_is_kind_of(mesg, rb_eException))
-	    rb_raise(rb_eTypeError, "exception object expected");
-	set_backtrace(mesg, (argc>2)?argv[2]:Qnil);
-    }
-
-    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);
-
-    return Qnil;		/* not reached */
-}
-
-void
-rb_jump_tag(tag)
-    int tag;
-{
-    JUMP_TAG(tag);
-}
-
-int
-rb_block_given_p()
-{
-    if (ruby_frame->iter && ruby_block)
-	return Qtrue;
-    return Qfalse;
-}
-
-int
-rb_iterator_p()
-{
-    return rb_block_given_p();
-}
-
-static VALUE
-rb_f_block_given_p()
-{
-    if (ruby_frame->prev && ruby_frame->prev->iter && ruby_block)
-	return Qtrue;
-    return Qfalse;
-}
-
-static VALUE
-rb_yield_0(val, self, klass, pcall)
-    VALUE val, self, klass;	/* OK */
-    int pcall;
-{
-    NODE *node;
-    volatile VALUE result = Qnil;
-    volatile VALUE old_cref;
-    volatile VALUE old_wrapper;
-    struct BLOCK * volatile block;
-    struct SCOPE * volatile old_scope;
-    struct FRAME frame;
-    char *const file = ruby_sourcefile;
-    int line = ruby_sourceline;
-    int state;
-    static unsigned serial = 1;
-
-    if (!rb_block_given_p()) {
-	localjump_error("no block given", Qnil);
-    }
-
-    PUSH_VARS();
-    PUSH_CLASS();
-    block = ruby_block;
-    frame = block->frame;
-    frame.prev = ruby_frame;
-    ruby_frame = &(frame);
-    old_cref = (VALUE)ruby_cref;
-    ruby_cref = (NODE*)ruby_frame->cbase;
-    old_wrapper = ruby_wrapper;
-    ruby_wrapper = block->wrapper;
-    old_scope = ruby_scope;
-    ruby_scope = block->scope;
-    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;
-    }
-    ruby_class = klass?klass:block->klass;
-    if (!klass) self = block->self;
-    node = block->body;
-
-    if (block->var) {
-	PUSH_TAG(PROT_NONE);
-	if ((state = EXEC_TAG()) == 0) {
-	    if (block->var == (NODE*)1) {
-		if (pcall && 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) {
-		massign(self, block->var, val, pcall);
-	    }
-	    else {
-		if (pcall) {
-		    val = avalue_to_yvalue(val);
-		}
-		assign(self, block->var, val, pcall);
-	    }
-	}
-	POP_TAG();
-	if (state) goto pop_state;
-    }
-    else if (pcall) {
-	val = avalue_to_yvalue(val);
-    }
-
-    PUSH_ITER(block->iter);
-    PUSH_TAG(PROT_NONE);
-    if ((state = EXEC_TAG()) == 0) {
-      redo:
-	if (!node) {
-	    result = Qnil;
-	}
-	else if (nd_type(node) == NODE_CFUNC || nd_type(node) == NODE_IFUNC) {
-	    result = (*node->nd_cfnc)(val, node->nd_tval, self);
-	}
-	else {
-	    result = rb_eval(self, node);
-	}
-    }
-    else {
-	switch (state) {
-	  case TAG_REDO:
-	    state = 0;
-	    CHECK_INTS;
-	    goto redo;
-	  case TAG_NEXT:
-	    state = 0;
-	    result = prot_tag->retval;
-	    break;
-	  case TAG_BREAK:
-	  case TAG_RETURN:
-	    state |= (serial++ << 8);
-	    state |= 0x10;
-	    block->tag->dst = state;
-	    break;
-	  default:
-	    break;
-	}
-    }
-    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();
-    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;
-    ruby_sourcefile = file;
-    ruby_sourceline = line;
-    if (state) {
-	if (!block->tag) {
-	    switch (state & TAG_MASK) {
-	      case TAG_BREAK:
-	      case TAG_RETURN:
-		jump_tag_but_local_jump(state & TAG_MASK);
-		break;
-	    }
-	}
-	JUMP_TAG(state);
-    }
-    return result;
-}
-
-VALUE
-rb_yield(val)
-    VALUE val;
-{
-    return rb_yield_0(val, 0, 0, 0);
-}
-
-static VALUE
-rb_f_loop()
-{
-    for (;;) {
-	rb_yield_0(Qundef, 0, 0, 0);
-	CHECK_INTS;
-    }
-    return Qnil;		/* dummy */
-}
-
-static VALUE
-massign(self, node, val, pcall)
-    VALUE self;
-    NODE *node;
-    VALUE val;
-    int pcall;
-{
-    NODE *list;
-    long i = 0, len;
-
-    if (!pcall) {
-	val = svalue_to_mvalue(val);
-    }
-    len = RARRAY(val)->len;
-    list = node->nd_head;
-    for (i=0; list && ind_head, RARRAY(val)->ptr[i], pcall);
-	list = list->nd_next;
-    }
-    if (pcall && list) goto arg_error;
-    if (node->nd_args) {
-	if (node->nd_args == (NODE*)-1) {
-	    /* no check for mere `*' */
-	}
-	else if (!list && ind_args, rb_ary_new4(len-i, RARRAY(val)->ptr+i), pcall);
-	}
-	else {
-	    assign(self, node->nd_args, rb_ary_new2(0), pcall);
-	}
-    }
-    else if (pcall && i < len) {
-	goto arg_error;
-    }
-
-    while (list) {
-	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, pcall)
-    VALUE self;
-    NODE *lhs;
-    VALUE val;
-    int pcall;
-{
-    if (val == Qundef) {
-	rb_warning("assigning void value");
-	val = Qnil;
-    }
-    switch (nd_type(lhs)) {
-      case NODE_GASGN:
-	rb_gvar_set(lhs->nd_entry, val);
-	break;
-
-      case NODE_IASGN:
-	rb_ivar_set(self, lhs->nd_vid, val);
-	break;
-
-      case NODE_LASGN:
-	if (ruby_scope->local_vars == 0)
-	    rb_bug("unexpected local variable assignment");
-	ruby_scope->local_vars[lhs->nd_cnt] = val;
-	break;
-
-      case NODE_DASGN:
-	dvar_asgn(lhs->nd_vid, val);
-	break;
-
-      case NODE_DASGN_CURR:
-	dvar_asgn_curr(lhs->nd_vid, val);
-	break;
-
-      case NODE_CDECL:
-	rb_const_set(ruby_class, lhs->nd_vid, val);
-	break;
-
-      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_CVASGN:
-	rb_cvar_set(cvar_cbase(), lhs->nd_vid, val, Qfalse);
-	break;
-
-      case NODE_MASGN:
-	massign(self, lhs, svalue_to_mvalue(val), pcall);
-	break;
-
-      case NODE_CALL:
-	{
-	    VALUE recv;
-	    recv = rb_eval(self, lhs->nd_recv);
-	    if (!lhs->nd_args) {
-		/* attr set */
-		rb_call(CLASS_OF(recv), recv, lhs->nd_mid, 1, &val, 0);
-	    }
-	    else {
-		/* array set */
-		VALUE args;
-
-		args = rb_eval(self, lhs->nd_args);
-		rb_ary_push(args, val);
-		rb_call(CLASS_OF(recv), recv, lhs->nd_mid,
-			RARRAY(args)->len, RARRAY(args)->ptr, 0);
-	    }
-	}
-	break;
-
-      default:
-	rb_bug("bug in variable assignment");
-	break;
-    }
-}
-
-VALUE
-rb_iterate(it_proc, data1, bl_proc, data2)
-    VALUE (*it_proc) _((VALUE)), (*bl_proc)(ANYARGS);
-    VALUE data1, data2;
-{
-    int state;
-    volatile VALUE retval = Qnil;
-    NODE *node = NEW_IFUNC(bl_proc, data2);
-    VALUE self = ruby_top_self;
-
-  iter_retry:
-    PUSH_ITER(ITER_PRE);
-    PUSH_BLOCK(0, node);
-    PUSH_TAG(PROT_NONE);
-
-    state = EXEC_TAG();
-    if (state == 0) {
-	retval = (*it_proc)(data1);
-    }
-    if (ruby_block->tag->dst == state) {
-	state &= TAG_MASK;
-	if (state == TAG_RETURN || state == TAG_BREAK) {
-	    retval = prot_tag->retval;
-	}
-    }
-    POP_TAG();
-    POP_BLOCK();
-    POP_ITER();
-
-    switch (state) {
-      case 0:
-	break;
-
-      case TAG_RETRY:
-	goto iter_retry;
-
-      case TAG_BREAK:
-	break;
-
-      case TAG_RETURN:
-	return_value(retval);
-	/* fall through */
-      default:
-	JUMP_TAG(state);
-    }
-    return retval;
-}
-
-static int
-handle_rescue(self, node)
-    VALUE self;
-    NODE *node;
-{
-    int argc; VALUE *argv; /* used in SETUP_ARGS */
-    TMP_PROTECT;
-
-    if (!node->nd_args) {
-	return rb_obj_is_kind_of(ruby_errinfo, rb_eStandardError);
-    }
-
-    BEGIN_CALLARGS;
-    SETUP_ARGS(node->nd_args);
-    END_CALLARGS;
-
-    while (argc--) {
-	if (!rb_obj_is_kind_of(argv[0], rb_cModule)) {
-	    rb_raise(rb_eTypeError, "class or module required for rescue clause");
-	}
-	if (RTEST(rb_funcall(*argv, eqq, 1, ruby_errinfo))) return 1;
-	argv++;
-    }
-    return 0;
-}
-
-VALUE
-#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 = 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) {
-	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;
-	    }
-	}
-	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;
-	    }
-	    if (state == 0) {
-		ruby_errinfo = e_info;
-	    }
-	}
-    }
-    POP_TAG();
-    if (state) JUMP_TAG(state);
-
-    return result;
-}
-
-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, 0);
-}
-
-VALUE
-rb_protect(proc, data, state)
-    VALUE (*proc) _((VALUE));
-    VALUE data;
-    int *state;
-{
-    VALUE result;		/* 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 data2;
-{
-    int state;
-    volatile VALUE result = Qnil;
-    VALUE retval;
-
-    PUSH_TAG(PROT_NONE);
-    if ((state = EXEC_TAG()) == 0) {
-	result = (*b_proc)(data1);
-    }
-    POP_TAG();
-    retval = prot_tag ? prot_tag->retval : Qnil;	/* save retval */
-    (*e_proc)(data2);
-    if (prot_tag) return_value(retval);
-
-    if (state) JUMP_TAG(state);
-    return result;
-}
-
-VALUE
-rb_with_disable_interrupt(proc, data)
-    VALUE (*proc)();
-    VALUE data;
-{
-    VALUE result;		/* OK */
-    int status;
-
-    DEFER_INTS;
-    PUSH_TAG(PROT_NONE);
-    if ((status = EXEC_TAG()) == 0) {
-	result = (*proc)(data);
-    }
-    POP_TAG();
-    ALLOW_INTS;
-    if (status) JUMP_TAG(status);
-
-    return result;
-}
-
-static 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_raise(rb_eSysStackError, "stack level too deep");
-	}
-	POP_TAG();
-	overflowing = 0;
-	JUMP_TAG(state);
-    }
-}
-
-static int last_call_status;
-
-#define CSTAT_PRIV  1
-#define CSTAT_PROT  2
-#define CSTAT_VCALL 4
-
-static VALUE
-rb_f_missing(argc, argv, obj)
-    int argc;
-    VALUE *argv;
-    VALUE obj;
-{
-    ID id;
-    VALUE exc = rb_eNoMethodError;
-    volatile VALUE d = 0;
-    char *format = 0;
-    char *desc = "";
-    char *file = ruby_sourcefile;
-    int   line = ruby_sourceline;
-
-    if (argc == 0 || !SYMBOL_P(argv[0])) {
-	rb_raise(rb_eArgError, "no id given");
-    }
-
-    stack_check();
-
-    id = SYM2ID(argv[0]);
-
-    switch (TYPE(obj)) {
-      case T_NIL:
-	desc = "nil";
-	break;
-      case T_TRUE:
-	desc = "true";
-	break;
-      case T_FALSE:
-	desc = "false";
-	break;
-      case T_OBJECT:
-	d = rb_any_to_s(obj);
-	break;
-      default:
-	d = rb_inspect(obj);
-	break;
-    }
-    if (d) {
-	if (RSTRING(d)->len > 65) {
-	    d = rb_any_to_s(obj);
-	}
-	desc = RSTRING(d)->ptr;
-    }
-
-    if (last_call_status & CSTAT_PRIV) {
-	format = "private method `%s' called for %s%s%s";
-    }
-    if (last_call_status & CSTAT_PROT) {
-	format = "protected method `%s' called for %s%s%s";
-    }
-    else if (last_call_status & CSTAT_VCALL) {
-	const char *mname = rb_id2name(id);
-
-	if (('a' <= mname[0] && mname[0] <= 'z') || mname[0] == '_') {
-	    format = "undefined local variable or method `%s' for %s%s%s";
-	    exc = rb_eNameError;
-	}
-    }
-    if (!format) {
-	format = "undefined method `%s' for %s%s%s";
-    }
-
-    ruby_sourcefile = file;
-    ruby_sourceline = line;
-    PUSH_FRAME();		/* fake frame */
-    *ruby_frame = *_frame.prev->prev;
-    {
-	char buf[BUFSIZ];
-	int noclass = (!d || desc[0]=='#');
-
-	snprintf(buf, BUFSIZ, format, rb_id2name(id),
-		 desc, noclass ? "" : ":",
-		 noclass ? "" : rb_class2name(CLASS_OF(obj)));
-	exc = rb_exc_new2(exc, buf);
-	rb_iv_set(exc, "name", argv[0]);
-	rb_iv_set(exc, "args", rb_ary_new4(argc-1, argv+1));
-	rb_exc_raise(exc);
-    }
-    POP_FRAME();
-
-    return Qnil;		/* not reached */
-}
-
-static VALUE
-rb_undefined(obj, id, argc, argv, call_status)
-    VALUE obj;
-    ID    id;
-    int   argc;
-    VALUE*argv;
-    int   call_status;
-{
-    VALUE *nargv;
-
-    last_call_status = call_status;
-
-    if (id == missing) {
-	PUSH_FRAME();
-	rb_f_missing(argc, argv, obj);
-	POP_FRAME();
-    }
-
-    nargv = ALLOCA_N(VALUE, argc+1);
-    nargv[0] = ID2SYM(id);
-    MEMCPY(nargv+1, argv, VALUE, argc);
-
-    return rb_funcall2(obj, missing, argc+1, nargv);
-}
-
-static VALUE
-call_cfunc(func, recv, len, argc, argv)
-    VALUE (*func)();
-    VALUE recv;
-    int len, argc;
-    VALUE *argv;
-{
-    if (len >= 0 && argc != len) {
-	rb_raise(rb_eArgError, "wrong number of arguments(%d for %d)",
-		 argc, len);
-    }
-
-    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)
-    VALUE klass, recv;
-    ID    id;
-    int argc;			/* OK */
-    VALUE *argv;		/* OK */
-    NODE *body;			/* OK */
-    int nosuper;
-{
-    NODE *b2;		/* OK */
-    volatile VALUE result = Qnil;
-    int itr;
-    static int tick;
-    TMP_PROTECT;
-
-    switch (ruby_iter->iter) {
-      case ITER_PRE:
-	itr = ITER_CUR;
-	break;
-      case ITER_CUR:
-      default:
-	itr = ITER_NOT;
-	break;
-    }
-
-    if ((++tick & 0xff) == 0) {
-	CHECK_INTS;		/* better than nothing */
-	stack_check();
-    }
-    PUSH_ITER(itr);
-    PUSH_FRAME();
-
-    ruby_frame->last_func = id;
-    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 < -2) {
-		rb_bug("bad argc(%d) specified for `%s(%s)'",
-		       len, rb_class2name(klass), rb_id2name(id));
-	    }
-	    if (trace_func) {
-		int state;
-		char *file = ruby_frame->prev->file;
-		int line = ruby_frame->prev->line;
-		if (!file) {
-		    file = ruby_sourcefile;
-		    line = ruby_sourceline;
-		}
-
-		call_trace_func("c-call", 0, 0, recv, id, klass);
-		PUSH_TAG(PROT_FUNC);
-		if ((state = EXEC_TAG()) == 0) {
-		    result = call_cfunc(body->nd_cfnc, recv, len, argc, argv);
-		}
-		POP_TAG();
-		call_trace_func("c-return", 0, 0, recv, id, klass);
-		if (state) JUMP_TAG(state);
-	    }
-	    else {
-		result = call_cfunc(body->nd_cfnc, recv, len, argc, argv);
-	    }
-	}
-	break;
-
-	/* for attr get/set */
-      case NODE_IVAR:
-	if (argc != 0) {
-	    rb_raise(rb_eArgError, "wrong number of arguments(%d for 0)", argc);
-	}
-      case NODE_ATTRSET:
-	/* for re-scoped/renamed method */
-      case NODE_ZSUPER:
-	result = rb_eval(recv, body);
-	break;
-
-      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), Qtrue, recv);
-	break;
-
-      case NODE_SCOPE:
-	{
-	    int state;
-	    VALUE *local_vars;	/* OK */
-	    NODE *saved_cref = 0;
-
-	    PUSH_SCOPE();
-
-	    if (body->nd_rval) {
-		saved_cref = ruby_cref;
-		ruby_cref = (NODE*)body->nd_rval;
-		ruby_frame->cbase = body->nd_rval;
-	    }
-	    if (body->nd_tbl) {
-		local_vars = TMP_ALLOC(body->nd_tbl[0]+1);
-		*local_vars++ = (VALUE)body;
-		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 = ruby_scope->local_vars = 0;
-		ruby_scope->local_tbl  = 0;
-	    }
-	    b2 = body = body->nd_next;
-
-	    PUSH_VARS();
-	    PUSH_TAG(PROT_FUNC);
-
-	    if ((state = EXEC_TAG()) == 0) {
-		NODE *node = 0;
-		int i;
-
-		if (nd_type(body) == NODE_ARGS) {
-		    node = body;
-		    body = 0;
-		}
-		else if (nd_type(body) == NODE_BLOCK) {
-		    node = body->nd_head;
-		    body = body->nd_next;
-		}
-		if (node) {
-		    if (nd_type(node) != NODE_ARGS) {
-			rb_bug("no argument-node");
-		    }
-
-		    i = node->nd_cnt;
-		    if (i > argc) {
-			rb_raise(rb_eArgError, "wrong number of arguments(%d for %d)",
-				 argc, i);
-		    }
-		    if (node->nd_rest == -1) {
-			int opt = i;
-			NODE *optnode = node->nd_opt;
-
-			while (optnode) {
-			    opt++;
-			    optnode = optnode->nd_next;
-			}
-			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) {
-			if (i > 0) {
-			    /* +2 for $_ and $~ */
-			    MEMCPY(local_vars+2, argv, VALUE, i);
-			}
-			argv += i; argc -= i;
-			if (node->nd_opt) {
-			    NODE *opt = node->nd_opt;
-
-			    while (opt && argc) {
-				assign(recv, opt->nd_head, *argv, 1);
-				argv++; argc--;
-				opt = opt->nd_next;
-			    }
-			    if (opt) {
-				ruby_sourcefile = opt->nd_file;
-				ruby_sourceline = nd_line(opt);
-				rb_eval(recv, opt);
-			    }
-			}
-			local_vars = ruby_scope->local_vars;
-			if (node->nd_rest >= 0) {
-			    VALUE v;
-
-			    if (argc > 0)
-				v = rb_ary_new4(argc,argv);
-			    else
-				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, id, klass);
-		}
-		result = rb_eval(recv, body);
-	    }
-	    else if (state == TAG_RETURN) {
-		result = prot_tag->retval;
-		state = 0;
-	    }
-	    POP_TAG();
-	    POP_VARS();
-	    POP_SCOPE();
-	    ruby_cref = saved_cref;
-	    if (trace_func) {
-		char *file = ruby_frame->prev->file;
-		int line = ruby_frame->prev->line;
-		if (!file) {
-		    file = ruby_sourcefile;
-		    line = ruby_sourceline;
-		}
-		call_trace_func("return", file, line, recv, id, klass);
-	    }
-	    switch (state) {
-	      case 0:
-		break;
-
-	      case TAG_RETRY:
-		if (rb_block_given_p()) {
-                   JUMP_TAG(state);
-		}
-		/* fall through */
-	      default:
-		jump_tag_but_local_jump(state);
-		break;
-	    }
-	}
-	break;
-
-      default:
-	rb_bug("unknown node type %d", nd_type(body));
-	break;
-    }
-    POP_FRAME();
-    POP_ITER();
-    return result;
-}
-
-static VALUE
-rb_call(klass, recv, mid, argc, argv, scope)
-    VALUE klass, recv;
-    ID    mid;
-    int argc;			/* OK */
-    const VALUE *argv;		/* OK */
-    int scope;
-{
-    NODE  *body;		/* OK */
-    int    noex;
-    ID     id = mid;
-    struct cache_entry *ent;
-
-    if (!klass) {
-	rb_raise(rb_eNotImpError, "method `%s' called on terminated object (0x%x)",
-		 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 rb_undefined(recv, mid, argc, argv, scope==2?CSTAT_VCALL:0);
-	klass = ent->origin;
-	id    = ent->mid0;
-	noex  = ent->noex;
-	body  = ent->method;
-    }
-    else if ((body = rb_get_method_body(&klass, &id, &noex)) == 0) {
-	if (scope == 3) {
-	    rb_name_error(mid, "super: no superclass method `%s'",
-			  rb_id2name(mid));
-	}
-	return rb_undefined(recv, mid, argc, argv, scope==2?CSTAT_VCALL:0);
-    }
-
-    if (mid != missing) {
-	/* receiver specified form for private method */
-	if ((noex & NOEX_PRIVATE) && scope == 0)
-	    return rb_undefined(recv, mid, argc, argv, CSTAT_PRIV);
-
-	/* self must be kind of a specified form for private method */
-	if ((noex & NOEX_PROTECTED)) {
-	    VALUE defined_class = klass;
-
-	    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 rb_undefined(recv, mid, argc, argv, CSTAT_PROT);
-	}
-    }
-
-    return rb_call0(klass, recv, id, argc, argv, body, noex & NOEX_UNDEF);
-}
-
-VALUE
-rb_apply(recv, mid, args)
-    VALUE recv;
-    ID mid;
-    VALUE args;
-{
-    int argc;
-    VALUE *argv;
-
-    argc = RARRAY(args)->len;
-    argv = ALLOCA_N(VALUE, argc);
-    MEMCPY(argv, RARRAY(args)->ptr, VALUE, argc);
-    return rb_call(CLASS_OF(recv), recv, mid, argc, argv, 1);
-}
-
-static VALUE
-rb_f_send(argc, argv, recv)
-    int argc;
-    VALUE *argv;
-    VALUE recv;
-{
-    VALUE vid;
-
-    if (argc == 0) rb_raise(rb_eArgError, "no method name given");
-
-    vid = *argv++; argc--;
-    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 
-#define va_init_list(a,b) va_start(a,b)
-#else
-#include 
-#define va_init_list(a,b) va_start(a)
-#endif
-
-VALUE
-#ifdef HAVE_STDARG_PROTOTYPES
-rb_funcall(VALUE recv, ID mid, int n, ...)
-#else
-rb_funcall(recv, mid, n, va_alist)
-    VALUE recv;
-    ID mid;
-    int n;
-    va_dcl
-#endif
-{
-    va_list ar;
-    VALUE *argv;
-
-    if (n > 0) {
-	int i;
-
-	argv = ALLOCA_N(VALUE, n);
-
-	va_init_list(ar, n);
-	for (i=0;ilast_class == 0) {	
-	rb_name_error(ruby_frame->last_func, "superclass method `%s' must be enabled by rb_enable_super()",
-		      rb_id2name(ruby_frame->last_func));
-    }
-
-    PUSH_ITER(ruby_iter->iter?ITER_PRE:ITER_NOT);
-    result = rb_call(RCLASS(ruby_frame->last_class)->super,
-		     ruby_frame->self, ruby_frame->last_func,
-		     argc, argv, 3);
-    POP_ITER();
-
-    return result;
-}
-
-static VALUE
-backtrace(lev)
-    int lev;
-{
-    struct FRAME *frame = ruby_frame;
-    char buf[BUFSIZ];
-    VALUE ary;
-
-    ary = rb_ary_new();
-    if (lev < 0) {
-	if (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", ruby_sourcefile, ruby_sourceline);
-	}
-	rb_ary_push(ary, rb_str_new2(buf));
-    }
-    else {
-	while (lev-- > 0) {
-	    frame = frame->prev;
-	    if (!frame) {
-		ary = Qnil;
-		break;
-	    }
-	}
-    }
-    while (frame && frame->file) {
-	if (frame->prev && frame->prev->last_func) {
-	    snprintf(buf, BUFSIZ, "%s:%d:in `%s'",
-		     frame->file, frame->line,
-		     rb_id2name(frame->prev->last_func));
-	}
-	else {
-	    snprintf(buf, BUFSIZ, "%s:%d", frame->file, frame->line);
-	}
-	rb_ary_push(ary, rb_str_new2(buf));
-	frame = frame->prev;
-    }
-
-    return ary;
-}
-
-static VALUE
-rb_f_caller(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE level;
-    int lev;
-
-    rb_scan_args(argc, argv, "01", &level);
-
-    if (NIL_P(level)) lev = 1;
-    else lev = NUM2INT(level);
-    if (lev < 0) rb_raise(rb_eArgError, "negative level(%d)", lev);
-
-    return backtrace(lev);
-}
-
-void
-rb_backtrace()
-{
-    int i;
-    VALUE ary;
-
-    ary = backtrace(-1);
-    for (i=0; ilen; i++) {
-	printf("\tfrom %s\n", RSTRING(RARRAY(ary)->ptr[i])->ptr);
-    }
-}
-
-static VALUE
-make_backtrace()
-{
-    return backtrace(-1);
-}
-
-ID
-rb_frame_last_func()
-{
-    return ruby_frame->last_func;
-}
-
-static NODE*
-compile(src, file, line)
-    VALUE src;
-    char *file;
-    int line;
-{
-    NODE *node;
-
-    ruby_nerrs = 0;
-    Check_Type(src, T_STRING);
-    node = rb_compile_string(file, src, line);
-
-    if (ruby_nerrs == 0) return node;
-    return 0;
-}
-
-static VALUE
-eval(self, src, scope, file, line)
-    VALUE self, src, scope;
-    char *file;
-    int line;
-{
-    struct BLOCK *data = NULL;
-    volatile VALUE result = Qnil;
-    struct SCOPE * volatile old_scope;
-    struct BLOCK * volatile old_block;
-    struct RVarmap * volatile old_dyna_vars;
-    VALUE volatile old_cref;
-    int volatile old_vmode;
-    volatile VALUE old_wrapper;
-    struct FRAME frame;
-    char *filesave = ruby_sourcefile;
-    int linesave = ruby_sourceline;
-    volatile int iter = ruby_frame->iter;
-    int state;
-
-    if (!NIL_P(scope)) {
-	if (!rb_obj_is_block(scope)) {
-	    rb_raise(rb_eTypeError, "wrong argument type %s (expected Proc/Binding)",
-		     rb_class2name(CLASS_OF(scope)));
-	}
-
-	Data_Get_Struct(scope, struct BLOCK, data);
-	/* PUSH BLOCK from data */
-	frame = data->frame;
-	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 = (NODE*)ruby_frame->cbase;
-	old_wrapper = ruby_wrapper;
-	ruby_wrapper = data->wrapper;
-	if ((file == 0 || (line == 1 && strcmp(file, "(eval)") == 0)) &&
-	    data->body && data->body->nd_file) {
-	    file = data->body->nd_file;
-	    line = nd_line(data->body);
-	}
-
-	self = data->self;
-	ruby_frame->iter = data->iter;
-    }
-    else {
-	if (ruby_frame->prev) {
-	    ruby_frame->iter = ruby_frame->prev->iter;
-	}
-    }
-    if (file == 0) {
-	file = ruby_sourcefile;
-	line = ruby_sourceline;
-    }
-    PUSH_CLASS();
-    ruby_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) {
-	NODE *node;
-
-	result = ruby_errinfo;
-	ruby_errinfo = Qnil;
-	node = compile(src, file, line);
-	if (ruby_nerrs > 0) {
-	    compile_error(0);
-	}
-	if (!NIL_P(result)) ruby_errinfo = result;
-	result = eval_node(self, node); 
-    }
-    POP_TAG();
-    POP_CLASS();
-    ruby_in_eval--;
-    if (!NIL_P(scope)) {
-	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);
-	   }
-	   if (ruby_block) {
-	       struct BLOCK *block = ruby_block;
-	       while (block) {
-		   block->tag->flags |= BLOCK_DYNAMIC;
-		   block = block->prev;
-	       }
-	   }
-	   for (vars = ruby_dyna_vars; vars; vars = vars->next) {
-	       FL_SET(vars, DVAR_DONT_RECYCLE);
-	   }
-	}
-    }
-    else {
-	ruby_frame->iter = iter;
-    }
-    ruby_sourcefile = filesave;
-    ruby_sourceline = linesave;
-    if (state) {
-	if (state == TAG_RAISE) {
-	    VALUE err;
-	    VALUE errat;
-
-	    if (strcmp(file, "(eval)") == 0) {
-		if (ruby_sourceline > 1) {
-		    errat = get_backtrace(ruby_errinfo);
-		    err = rb_str_dup(RARRAY(errat)->ptr[0]);
-		    rb_str_cat2(err, ": ");
-		    rb_str_append(err, ruby_errinfo);
-		}
-		else {
-		    err = rb_str_dup(ruby_errinfo);
-		}
-		rb_exc_raise(rb_funcall(ruby_errinfo, rb_intern("exception"), 1, err));
-	    }
-	    rb_exc_raise(ruby_errinfo);
-	}
-	JUMP_TAG(state);
-    }
-
-    return result;
-}
-
-static VALUE
-rb_f_eval(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    VALUE src, scope, vfile, vline;
-    char *file = "(eval)";
-    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) {
-	file = StringValuePtr(vfile);
-    }
-    if (argc >= 4) {
-	line = NUM2INT(vline);
-    }
-
-    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, cbase, args)
-    VALUE (*func)();
-    VALUE under, cbase;
-    void *args;
-{
-    VALUE val;			/* OK */
-    int state;
-    int mode;
-
-    PUSH_CLASS();
-    ruby_class = under;
-    PUSH_FRAME();
-    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) {
-	if (ruby_cbase != cbase) {
-	    ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,under,0,ruby_frame->cbase);
-	}
-	PUSH_CREF(cbase);
-    }
-
-    mode = scope_vmode;
-    SCOPE_SET(SCOPE_PUBLIC);
-    PUSH_TAG(PROT_NONE);
-    if ((state = EXEC_TAG()) == 0) {
-	val = (*func)(args);
-    }
-    POP_TAG();
-    if (cbase) POP_CREF();
-    SCOPE_SET(mode);
-    POP_FRAME();
-    POP_CLASS();
-    if (state) JUMP_TAG(state);
-
-    return val;
-}
-
-static VALUE
-eval_under_i(args)
-    VALUE *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;
-    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, under, args);
-}
-
-static VALUE
-yield_under_i(self)
-    VALUE self;
-{
-    return rb_yield_0(self, self, ruby_class, 0);
-}
-
-/* block eval under the class/module context */
-static VALUE
-yield_under(under, self)
-    VALUE under, self;
-{
-    return exec_under(yield_under_i, under, 0, self);
-}
-
-static VALUE
-specific_eval(argc, argv, klass, self)
-    int argc;
-    VALUE *argv;
-    VALUE klass, self;
-{
-    if (rb_block_given_p()) {
-	if (argc > 0) {
-	    rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
-	}
-	return yield_under(klass, self);
-    }
-    else {
-	char *file = "(eval)";
-	int   line = 1;
-
-	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 > 1) {
-		file = StringValuePtr(argv[1]);
-	    }
-	    if (argc > 2) line = NUM2INT(argv[2]);
-	}
-	return eval_under(klass, self, argv[0], file, line);
-    }
-}
-
-VALUE
-rb_obj_instance_eval(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    VALUE klass;
-
-    if (rb_special_const_p(self)) {
-	klass = Qnil;
-    }
-    else {
-	klass = rb_singleton_class(self);
-    }
-
-    return specific_eval(argc, argv, klass, self);
-}
-
-VALUE
-rb_mod_module_eval(argc, argv, mod)
-    int argc;
-    VALUE *argv;
-    VALUE mod;
-{
-    return specific_eval(argc, argv, mod, mod);
-}
-
-VALUE rb_load_path;
-
-void
-rb_load(fname, wrap)
-    VALUE fname;
-    int wrap;
-{
-    VALUE tmp;
-    int state;
-    volatile ID last_func;
-    volatile VALUE wrapper = 0;
-    volatile VALUE self = ruby_top_self;
-    NODE *saved_cref = ruby_cref;
-    TMP_PROTECT;
-
-    if (wrap && ruby_safe_level >= 4) {
-	StringValue(fname);
-    }
-    else {
-	SafeStringValue(fname);
-    }
-    tmp = rb_find_file(fname);
-    if (!tmp) {
-	rb_raise(rb_eLoadError, "No such file to load -- %s", RSTRING(fname)->ptr);
-    }
-    fname = tmp;
-
-    ruby_errinfo = Qnil;	/* ensure */
-    PUSH_VARS();
-    PUSH_CLASS();
-    wrapper = 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_class);
-	PUSH_CREF(ruby_wrapper);
-    }
-    PUSH_FRAME();
-    ruby_frame->last_func = 0;
-    ruby_frame->last_class = 0;
-    ruby_frame->self = self;
-    ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,ruby_class,0,0);
-    PUSH_SCOPE();
-    /* default visibility is private at loading toplevel */
-    SCOPE_SET(SCOPE_PRIVATE);
-    PUSH_TAG(PROT_NONE);
-    state = EXEC_TAG();
-    last_func = ruby_frame->last_func;
-    if (state == 0) {
-	NODE *node;
-
-	DEFER_INTS;
-	ruby_in_eval++;
-	rb_load_file(RSTRING(fname)->ptr);
-	ruby_in_eval--;
-	node = ruby_eval_tree;
-	ALLOW_INTS;
-	if (ruby_nerrs == 0) {
-	    eval_node(self, node);
-	}
-    }
-    ruby_frame->last_func = last_func;
-    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();
-    ruby_cref = saved_cref;
-    POP_SCOPE();
-    POP_FRAME();
-    POP_CLASS();
-    POP_VARS();
-    ruby_wrapper = wrapper;
-    if (ruby_nerrs > 0) {
-	ruby_nerrs = 0;
-	rb_exc_raise(ruby_errinfo);
-    }
-    if (state) jump_tag_but_local_jump(state);
-    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;
-
-    PUSH_TAG(PROT_NONE);
-    if ((status = EXEC_TAG()) == 0) {
-	rb_load(fname, wrap);
-    }
-    POP_TAG();
-    if (state) *state = status;
-}
-
-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_feature_p(feature, wait)
-    const char *feature;
-    int wait;
-{
-    VALUE v;
-    char *f;
-    int i, len = strlen(feature);
-
-    for (i = 0; i < RARRAY(rb_features)->len; ++i) {
-	v = RARRAY(rb_features)->ptr[i];
-	f = StringValuePtr(v);
-	if (strcmp(f, feature) == 0) {
-	    goto load_wait;
-	}
-	if (strncmp(f, feature, len) == 0) {
-	    if (strcmp(f+len, ".so") == 0) {
-		return Qtrue;
-	    }
-	    if (strcmp(f+len, ".rb") == 0) {
-		if (wait) goto load_wait;
-		return Qtrue;
-	    }
-	}
-    }
-    return Qfalse;
-
-  load_wait:
-    if (loading_tbl) {
-	char *ext = strrchr(f, '.');
-	if (ext && strcmp(ext, ".rb") == 0) {
-	    rb_thread_t th;
-
-	    while (st_lookup(loading_tbl, f, &th)) {
-		if (th == curr_thread) {
-		    return Qtrue;
-		}
-		CHECK_INTS;
-		rb_thread_schedule();
-	    }
-	}
-    }
-    return Qtrue;
-}
-
-static const char *const loadable_ext[] = {
-    ".rb", DLEXT,
-#ifdef DLEXT2
-    DLEXT2,
-#endif
-    0
-};
-
-int
-rb_provided(feature)
-    const char *feature;
-{
-    VALUE f = rb_str_new2(feature);
-
-    if (strrchr(feature, '.') == 0) {
-	if (rb_find_file_ext(&f, loadable_ext) == 0) {
-	    return rb_feature_p(feature, Qfalse);
-	}
-    }
-    return rb_feature_p(RSTRING(f)->ptr, 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));
-}
-
-VALUE
-rb_f_require(obj, fname)
-    VALUE obj, fname;
-{
-    VALUE feature, tmp;
-    char *ext, *ftptr; /* OK */
-    int state;
-    volatile int safe = ruby_safe_level;
-
-    SafeStringValue(fname);
-    ext = strrchr(RSTRING(fname)->ptr, '.');
-    if (ext) {
-	if (strcmp(".rb", ext) == 0) {
-	    feature = rb_str_dup(fname);
-	    tmp = rb_find_file(fname);
-	    if (tmp) {
-		fname = tmp;
-		goto load_rb;
-	    }
-	}
-	else if (strcmp(".so", ext) == 0 || strcmp(".o", ext) == 0) {
-	    fname = rb_str_new(RSTRING(fname)->ptr, ext-RSTRING(fname)->ptr);
-#ifdef DLEXT2
-	    tmp = fname;
-	    if (rb_find_file_ext(&tmp, loadable_ext+1)) {
-		feature = tmp;
-		fname = rb_find_file(tmp);
-		goto load_dyna;
-	    }
-#else
-	    feature = tmp = rb_str_dup(fname);
-	    rb_str_cat2(tmp, DLEXT);
-	    tmp = rb_find_file(tmp);
-	    if (tmp) {
-		fname = tmp;
-		goto load_dyna;
-	    }
-#endif
-	}
-	else if (strcmp(DLEXT, ext) == 0) {
-	    tmp = rb_find_file(fname);
-	    if (tmp) {
-		feature = fname;
-		fname = tmp;
-		goto load_dyna;
-	    }
-	}
-#ifdef DLEXT2
-	else if (strcmp(DLEXT2, ext) == 0) {
-	    tmp = rb_find_file(fname);
-	    if (tmp) {
-		feature = fname;
-		fname = tmp;
-		goto load_dyna;
-	    }
-	}
-#endif
-    }
-    tmp = fname;
-    switch (rb_find_file_ext(&tmp, loadable_ext)) {
-      case 0:
-	break;
-
-      case 1:
-	feature = fname = tmp;
-	goto load_rb;
-
-      default:
-	feature = tmp;
-	fname = rb_find_file(tmp);
-	goto load_dyna;
-    }
-    if (rb_feature_p(RSTRING(fname)->ptr, Qfalse))
-	return Qfalse;
-    rb_raise(rb_eLoadError, "No such file to load -- %s", RSTRING(fname)->ptr);
-
-  load_dyna:
-    if (rb_feature_p(RSTRING(feature)->ptr, Qfalse))
-	return Qfalse;
-    rb_provide_feature(feature);
-    {
-	int volatile old_vmode = scope_vmode;
-
-	PUSH_TAG(PROT_NONE);
-	if ((state = EXEC_TAG()) == 0) {
-	    void *handle;
-
-	    SCOPE_SET(SCOPE_PUBLIC);
-	    handle = dln_load(RSTRING(fname)->ptr);
-	    rb_ary_push(ruby_dln_librefs, INT2NUM((long)handle));
-	}
-	POP_TAG();
-	SCOPE_SET(old_vmode);
-    }
-    if (state) JUMP_TAG(state);
-
-    return Qtrue;
-
-  load_rb:
-    if (rb_feature_p(RSTRING(feature)->ptr, Qtrue))
-	return Qfalse;
-    ruby_safe_level = 0;
-    rb_provide_feature(feature);
-    /* 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, ftptr, curr_thread);
-
-    PUSH_TAG(PROT_NONE);
-    if ((state = EXEC_TAG()) == 0) {
-	rb_load(fname, 0);
-    }
-    POP_TAG();
-    st_delete(loading_tbl, &ftptr, 0); /* loading done */
-    free(ftptr);
-    ruby_safe_level = safe;
-    if (state) JUMP_TAG(state);
-
-    return Qtrue;
-}
-
-VALUE
-rb_require(fname)
-    const char *fname;
-{
-    return rb_f_require(Qnil, rb_str_new2(fname));
-}
-
-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
-set_method_visibility(self, argc, argv, ex)
-    VALUE self;
-    int argc;
-    VALUE *argv;
-    ID ex;
-{
-    int i;
-
-    secure_visibility(self);
-    for (i=0; ind_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;
-	}
-	rb_add_method(rb_singleton_class(module), id, body->nd_body, NOEX_PUBLIC);
-	rb_funcall(module, singleton_added, 1, ID2SYM(id));
-    }
-    return module;
-}
-
-static VALUE
-rb_mod_append_features(module, include)
-    VALUE module, include;
-{
-    switch (TYPE(include)) {
-      case T_CLASS:
-      case T_MODULE:
-	break;
-      default:
-	Check_Type(include, T_CLASS);
-	break;
-    }
-    rb_include_module(include, module);
-
-    return module;
-}
-
-static VALUE
-rb_mod_include(argc, argv, module)
-    int argc;
-    VALUE *argv;
-    VALUE module;
-{
-    while (argc--) {
-	VALUE m = argv[argc];
-
-	Check_Type(m, T_MODULE);
-	rb_funcall(m, rb_intern("append_features"), 1, module);
-	rb_funcall(m, rb_intern("included"), 1, module);
-    }
-    return module;
-}
-
-void
-rb_obj_call_init(obj, argc, argv)
-    VALUE obj;
-    int argc;
-    VALUE *argv;
-{
-    PUSH_ITER(rb_block_given_p()?ITER_PRE:ITER_NOT);
-    rb_funcall2(obj, init, argc, argv);
-    POP_ITER();
-}
-
-static VALUE
-top_include(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    rb_secure(4);
-    return rb_mod_include(argc, argv, rb_cObject);
-}
-
-void
-rb_extend_object(obj, module)
-    VALUE obj, module;
-{
-    rb_include_module(rb_singleton_class(obj), module);
-}
-
-static VALUE
-rb_mod_extend_object(mod, obj)
-    VALUE mod, obj;
-{
-    rb_extend_object(obj, mod);
-    return obj;
-}
-
-static VALUE
-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; ilocal_tbl;
-    if (tbl) {
-	n = *tbl++;
-	for (i=2; iid) {
-	    rb_ary_push(ary, rb_str_new2(rb_id2name(vars->id)));
-	}
-	vars = vars->next;
-    }
-
-    return ary;
-}
-
-static VALUE rb_f_catch _((VALUE,VALUE));
-NORETURN(static VALUE rb_f_throw _((int,VALUE*)));
-
-struct end_proc_data {
-    void (*func)();
-    VALUE data;
-    struct end_proc_data *next;
-};
-
-static struct end_proc_data *end_procs, *ephemeral_end_procs;
-
-void
-rb_set_end_proc(func, data)
-    void (*func) _((VALUE));
-    VALUE data;
-{
-    struct end_proc_data *link = ALLOC(struct end_proc_data);
-    struct end_proc_data **list;
-
-    if (ruby_wrapper) list = &ephemeral_end_procs;
-    else              list = &end_procs;
-    link->next = *list;
-    link->func = func;
-    link->data = data;
-    *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;
-    }
-}
-
-static void call_end_proc _((VALUE data));
-
-static void
-call_end_proc(data)
-    VALUE data;
-{
-    PUSH_ITER(ITER_NOT);
-    PUSH_FRAME();
-    ruby_frame->self = ruby_frame->prev->self;
-    ruby_frame->last_func = 0;
-    ruby_frame->last_class = 0;
-    proc_invoke(data, rb_ary_new2(0), Qfalse, Qundef);
-    POP_FRAME();
-    POP_ITER();
-}
-
-static void
-rb_f_END()
-{
-    PUSH_FRAME();
-    ruby_frame->argc = 0;
-    rb_set_end_proc(call_end_proc, rb_f_lambda());
-    POP_FRAME();
-}
-
-static VALUE
-rb_f_at_exit()
-{
-    VALUE proc;
-
-    proc = rb_f_lambda();
-
-    rb_set_end_proc(call_end_proc, proc);
-    return proc;
-}
-
-void
-rb_exec_end_proc()
-{
-    struct end_proc_data *link, *save;
-    int status;
-
-    save = link = end_procs;
-    while (link) {
-	rb_protect((VALUE(*)_((VALUE)))link->func, link->data, &status);
-	if (status) {
-	    error_handle(status);
-	}
-	link = link->next;
-    }
-    link = end_procs;
-    while (link != save) {
-	rb_protect((VALUE(*)_((VALUE)))link->func, link->data, &status);
-	if (status) {
-	    error_handle(status);
-	}
-	link = link->next;
-    }
-    while (ephemeral_end_procs) {
-	link = ephemeral_end_procs;
-	ephemeral_end_procs = link->next;
-	rb_protect((VALUE(*)_((VALUE)))link->func, link->data, &status);
-	if (status) {
-	    error_handle(status);
-	}
-	free(link);
-    }
-}
-
-void
-Init_eval()
-{
-    init = rb_intern("initialize");
-    alloc = rb_intern("allocate");
-    eqq = rb_intern("===");
-    each = rb_intern("each");
-
-    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*)&ruby_eval_tree_begin);
-
-    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("$!", &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_f_missing, -1);
-    rb_define_global_function("loop", rb_f_loop, 0);
-
-    rb_define_method(rb_mKernel, "respond_to?", rb_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("caller", rb_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("at_exit", rb_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);
-    rb_define_global_function("local_variables", rb_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_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_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_undef_method(rb_cClass, "module_function");
-
-    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(rb_cModule, "nesting", rb_mod_nesting, 0);
-    rb_define_singleton_method(rb_cModule, "constants", rb_mod_s_constants, 0);
-
-    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(rb_mKernel, "extend", rb_obj_extend, -1);
-
-    rb_define_global_function("trace_var", rb_f_trace_var, -1);
-    rb_define_global_function("untrace_var", rb_f_untrace_var, -1);
-
-    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 rb_f_autoload();
-
-void
-Init_load()
-{
-    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 = rb_ary_new();
-    rb_define_readonly_variable("$\"", &rb_features);
-
-    rb_define_global_function("load", rb_f_load, -1);
-    rb_define_global_function("require", rb_f_require, 1);
-    rb_define_global_function("autoload", rb_f_autoload, 2);
-    rb_global_variable(&ruby_wrapper);
-
-    ruby_dln_librefs = rb_ary_new();
-    rb_global_variable(&ruby_dln_librefs);
-}
-
-static void
-scope_dup(scope)
-    struct SCOPE *scope;
-{
-    ID *tbl;
-    VALUE *vars;
-
-    scope->flags |= SCOPE_DONT_RECYCLE;
-    if (scope->flags & SCOPE_MALLOC) return;
-
-    if (scope->local_tbl) {
-	tbl = scope->local_tbl;
-	vars = ALLOC_N(VALUE, tbl[0]+1);
-	*vars++ = scope->local_vars[-1];
-	MEMCPY(vars, scope->local_vars, VALUE, tbl[0]);
-	scope->local_vars = vars;
-	scope->flags |= SCOPE_MALLOC;
-    }
-}
-
-static void
-blk_mark(data)
-    struct BLOCK *data;
-{
-    while (data) {
-	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->klass);
-	rb_gc_mark((VALUE)data->tag);
-	rb_gc_mark(data->wrapper);
-	data = data->prev;
-    }
-}
-
-static void
-blk_free(data)
-    struct BLOCK *data;
-{
-    struct FRAME *frame;
-    void *tmp;
-
-    frame = data->frame.prev;
-    while (frame) {
-	if (frame->argc > 0 && (frame->flags & FRAME_MALLOC))
-	    free(frame->argv);
-	tmp = frame;
-	frame = frame->prev;
-	free(tmp);
-    }
-    while (data) {
-	if (data->frame.argc > 0)
-	    free(data->frame.argv);
-	tmp = data;
-	data = data->prev;
-	free(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);
-	if (tmp->frame.argc > 0) {
-	    tmp->frame.argv = ALLOC_N(VALUE, tmp->frame.argc);
-	    MEMCPY(tmp->frame.argv, block->prev->frame.argv, VALUE, tmp->frame.argc);
-	    tmp->frame.flags |= FRAME_MALLOC;
-	}
-	scope_dup(tmp->scope);
-	tmp->tag->flags |= BLOCK_DYNAMIC;
-
-	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
-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 VALUE
-bind_clone(self)
-    VALUE self;
-{
-    struct BLOCK *orig, *data;
-    VALUE bind;
-
-    Data_Get_Struct(self, struct BLOCK, orig);
-    bind = Data_Make_Struct(rb_cBinding,struct BLOCK,blk_mark,blk_free,data);
-    CLONESETUP(bind, self);
-    MEMCPY(data, orig, struct BLOCK, 1);
-    frame_dup(&data->frame);
-
-    if (data->iter) {
-	blk_copy_prev(data);
-    }
-    else {
-	data->prev = 0;
-    }
-
-    return bind;
-}
-
-static VALUE
-rb_f_binding(self)
-    VALUE self;
-{
-    struct BLOCK *data, *p;
-    struct RVarmap *vars;
-    VALUE bind;
-
-    PUSH_BLOCK(0,0);
-    bind = Data_Make_Struct(rb_cBinding,struct BLOCK,blk_mark,blk_free,data);
-    *data = *ruby_block;
-
-    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;
-    }
-
-    if (data->iter) {
-	blk_copy_prev(data);
-    }
-    else {
-	data->prev = 0;
-    }
-    data->flags |= BLOCK_DYNAMIC;
-    data->tag->flags |= BLOCK_DYNAMIC;
-
-    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_T3    FL_USER1
-#define PROC_T4    FL_USER2
-#define PROC_TMAX  (FL_USER1|FL_USER2)
-#define PROC_TMASK (FL_USER1|FL_USER2)
-
-static void
-proc_save_safe_level(data)
-    VALUE data;
-{
-    if (OBJ_TAINTED(data)) {
-	switch (ruby_safe_level) {
-	  case 3:
-	    FL_SET(data, PROC_T3);
-	    break;
-	  case 4:
-	    FL_SET(data, PROC_T4);
-	    break;
-	  default:
-	    if (ruby_safe_level > 4) {
-		FL_SET(data, PROC_TMAX);
-	    }
-	    break;
-	}
-    }
-}
-
-static int
-proc_get_safe_level(data)
-    VALUE data;
-{
-    if (OBJ_TAINTED(data)) {
-	switch (RBASIC(data)->flags & PROC_TMASK) {
-	  case PROC_T3:
-	    return 3;
-	  case PROC_T4:
-	    return 4;
-	  case PROC_TMAX:
-	    return 5;
-	}
-	return 3;
-    }
-    return 0;
-}
-
-static void
-proc_set_safe_level(data)
-    VALUE data;
-{
-    if (OBJ_TAINTED(data)) {
-	ruby_safe_level = proc_get_safe_level(data);
-    }
-}
-
-static VALUE
-proc_new(klass)
-    VALUE klass;
-{
-    volatile VALUE proc;
-    struct BLOCK *data, *p;
-    struct RVarmap *vars;
-
-    if (!rb_block_given_p() && !rb_f_block_given_p()) {
-	rb_raise(rb_eArgError, "tried to create Proc object without a block");
-    }
-
-    proc = Data_Make_Struct(klass, struct BLOCK, blk_mark, blk_free, data);
-    *data = *ruby_block;
-
-    data->orig_thread = rb_thread_current();
-    data->wrapper = ruby_wrapper;
-    data->iter = data->prev?Qtrue:Qfalse;
-    frame_dup(&data->frame);
-    if (data->iter) {
-	blk_copy_prev(data);
-    }
-    else {
-	data->prev = 0;
-    }
-    data->flags |= BLOCK_DYNAMIC;
-    data->tag->flags |= BLOCK_DYNAMIC;
-
-    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);
-    proc_save_safe_level(proc);
-
-    return proc;
-}
-
-static VALUE
-proc_s_new(argc, argv, klass)
-    int argc;
-    VALUE *argv;
-    VALUE klass;
-{
-    VALUE proc = proc_new(klass);
-
-    rb_obj_call_init(proc, argc, argv);
-    return proc;
-}
-
-VALUE
-rb_f_lambda()
-{
-    return proc_new(rb_cProc);
-}
-
-static int
-blk_orphan(data)
-    struct BLOCK *data;
-{
-    if (!(data->scope->flags & SCOPE_NOSTACK)) {
-	return 0;
-    }
-    if ((data->tag->flags & BLOCK_ORPHAN)) {
-	return 1;
-    }
-    if (data->orig_thread != rb_thread_current()) {
-	return 1;
-    }
-    return 0;
-}
-
-static VALUE
-proc_invoke(proc, args, pcall, self)
-    VALUE proc, args;		/* OK */
-    int pcall;
-    VALUE self;
-{
-    struct BLOCK * volatile old_block;
-    struct BLOCK _block;
-    struct BLOCK *data;
-    volatile VALUE result = Qnil;
-    int state;
-    volatile int orphan;
-    volatile int safe = ruby_safe_level;
-    volatile VALUE old_wrapper = ruby_wrapper;
-    struct RVarmap * volatile old_dvars = ruby_dyna_vars;
-
-    if (rb_block_given_p() && ruby_frame->last_func) {
-	rb_warning("block for %s#%s is useless",
-		   rb_class2name(CLASS_OF(proc)),
-		   rb_id2name(ruby_frame->last_func));
-    }
-
-    Data_Get_Struct(proc, struct BLOCK, data);
-    orphan = blk_orphan(data);
-
-    ruby_wrapper = data->wrapper;
-    ruby_dyna_vars = data->dyna_vars;
-    /* PUSH BLOCK from data */
-    old_block = ruby_block;
-    _block = *data;
-    ruby_block = &_block;
-
-    PUSH_ITER(ITER_CUR);
-    ruby_frame->iter = ITER_CUR;
-
-    if (!pcall) {
-	args = avalue_to_yvalue(args);
-    }
-    PUSH_TAG(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);
-    }
-    POP_TAG();
-
-    POP_ITER();
-    if (ruby_block->tag->dst == state) {
-	state &= TAG_MASK;
-    }
-    ruby_block = old_block;
-    ruby_wrapper = old_wrapper;
-    ruby_dyna_vars = old_dvars;
-    ruby_safe_level = safe;
-
-    switch (state) {
-      case 0:
-	break;
-      case TAG_BREAK:
-	if (!pcall && orphan) {
-	    localjump_error("break from proc-closure", prot_tag->retval);
-	}
-	result = prot_tag->retval;
-	break;
-      case TAG_RETRY:
-	localjump_error("retry from proc-closure", Qnil);
-	break;
-      case TAG_RETURN:
-	if (orphan) {	/* orphan procedure */
-	    localjump_error("return from proc-closure", prot_tag->retval);
-	}
-	/* fall through */
-      default:
-	JUMP_TAG(state);
-    }
-    return result;
-}
-
-static VALUE
-proc_call(proc, args)
-    VALUE proc, args;		/* OK */
-{
-    return proc_invoke(proc, args, Qtrue, Qundef);
-}
-
-static VALUE
-proc_yield(proc, args)
-    VALUE proc, args;		/* OK */
-{
-    return proc_invoke(proc, args, Qfalse, Qundef);
-}
-
-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) return INT2FIX(-1);
-    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);
-    }
-}
-
-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->tag == data2->tag) return Qtrue;
-    return Qfalse;
-}
-
-static VALUE
-proc_to_s(self, other)
-    VALUE self, other;
-{
-    struct BLOCK *data;
-    char *cname = rb_class2name(CLASS_OF(self));
-    VALUE str;
-
-    Data_Get_Struct(self, struct BLOCK, data);
-    str = rb_str_new(0, strlen(cname)+6+16+1); /* 6:tags 16:addr 1:nul */
-    sprintf(RSTRING(str)->ptr, "#<%s:0x%p>", cname, data->tag);
-    RSTRING(str)->len = strlen(RSTRING(str)->ptr);
-    if (OBJ_TAINTED(self)) OBJ_TAINT(str);
-
-    return str;
-}
-
-static VALUE
-proc_to_proc(proc)
-    VALUE proc;
-{
-    return proc;
-}
-
-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);
-    }
-    else {
-	data->prev = 0;
-    }
-
-    return bind;
-}
-
-static VALUE
-block_pass(self, node)
-    VALUE self;
-    NODE *node;
-{
-    VALUE block = 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 = ruby_safe_level;
-
-    if (NIL_P(block)) {
-	PUSH_ITER(ITER_NOT);
-	result = rb_eval(self, node->nd_iter);
-	POP_ITER();
-	return result;
-    }
-    if (!rb_obj_is_proc(block)) {
-	b = rb_check_convert_type(block, T_DATA, "Proc", "to_proc");
-	if (!rb_obj_is_proc(b)) {
-	    rb_raise(rb_eTypeError, "wrong argument type %s (expected Proc)",
-		     rb_class2name(CLASS_OF(block)));
-	}
-	block = b;
-    }
-
-    if (ruby_safe_level >= 1 && OBJ_TAINTED(block)) {
-	if (ruby_safe_level > proc_get_safe_level(block)) {
-	    rb_raise(rb_eSecurityError, "Insecure: tainted block value");
-	}
-    }
-
-    Data_Get_Struct(block, struct BLOCK, data);
-    orphan = blk_orphan(data);
-
-  retry:
-    /* PUSH BLOCK from data */
-    old_block = ruby_block;
-    _block = *data;
-    ruby_block = &_block;
-    PUSH_ITER(ITER_PRE);
-    ruby_frame->iter = ITER_PRE;
-
-    PUSH_TAG(PROT_NONE);
-    state = EXEC_TAG();
-    if (state == 0) {
-	proc_set_safe_level(block);
-	if (safe > ruby_safe_level)
-	    ruby_safe_level = safe;
-	result = rb_eval(self, node->nd_iter);
-    }
-    POP_TAG();
-    POP_ITER();
-    if (_block.tag->dst == state) {
-	if (orphan) {
-	    state &= TAG_MASK;
-	}
-	else {
-	    struct BLOCK *ptr = old_block;
-
-	    while (ptr) {
-		if (ptr->scope == _block.scope) {
-		    ptr->tag->dst = state;
-		    break;
-		}
-		ptr = ptr->prev;
-	    }
-	    if (!ptr) {
-		state &= TAG_MASK;
-	    }
-	}
-    }
-    ruby_block = old_block;
-    ruby_safe_level = safe;
-
-    switch (state) {/* escape from orphan procedure */
-      case 0:
-	break;
-      case TAG_BREAK:
-	result = prot_tag->retval;
-	break;
-      case TAG_RETRY:
-	goto retry;
-      case TAG_RETURN:
-	if (orphan) {
-	    localjump_error("return from proc-closure", prot_tag->retval);
-	}
-      default:
-	JUMP_TAG(state);
-    }
-
-    return result;
-}
-
-struct METHOD {
-    VALUE klass, rklass;
-    VALUE recv;
-    ID id, oid;
-    NODE *body;
-};
-
-static void
-bm_mark(data)
-    struct METHOD *data;
-{
-    rb_gc_mark(data->rklass);
-    rb_gc_mark(data->klass);
-    rb_gc_mark(data->recv);
-    rb_gc_mark((VALUE)data->body);
-}
-
-static VALUE
-mnew(klass, obj, id, mklass)
-    VALUE klass, obj, mklass;
-    ID id;
-{
-    VALUE method;
-    NODE *body;
-    int noex;
-    struct METHOD *data;
-    VALUE rklass = klass;
-    ID oid = id;
-
-  again:
-    if ((body = rb_get_method_body(&klass, &id, &noex)) == 0) {
-	print_undef(rklass, oid);
-    }
-
-    if (nd_type(body) == NODE_ZSUPER) {
-	klass = RCLASS(klass)->super;
-	goto again;
-    }
-
-    method = Data_Make_Struct(mklass, struct METHOD, bm_mark, free, data);
-    data->klass = klass;
-    data->recv = obj;
-    data->id = id;
-    data->body = body;
-    data->rklass = rklass;
-    data->oid = oid;
-    OBJ_INFECT(method, klass);
-
-    return method;
-}
-
-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;
-}
-
-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;
-}
-
-static VALUE
-umethod_unbind(obj)
-    VALUE obj;
-{
-    return obj;
-}
-
-static VALUE
-rb_obj_method(obj, vid)
-    VALUE obj;
-    VALUE vid;
-{
-    return mnew(CLASS_OF(obj), obj, rb_to_id(vid), rb_cMethod);
-}
-
-static VALUE
-rb_mod_method(mod, vid)
-    VALUE mod;
-    VALUE vid;
-{
-    return mnew(mod, Qundef, rb_to_id(vid), rb_cUnboundMethod);
-}
-
-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;
-}
-
-static VALUE
-method_call(argc, argv, method)
-    int argc;
-    VALUE *argv;
-    VALUE method;
-{
-    VALUE result;
-    struct METHOD *data;
-    int state;
-    volatile int safe = ruby_safe_level;
-
-    Data_Get_Struct(method, struct METHOD, data);
-    PUSH_ITER(rb_block_given_p()?ITER_PRE:ITER_NOT);
-    PUSH_TAG(PROT_NONE);
-    if (OBJ_TAINTED(method) && ruby_safe_level < 4) {
-	ruby_safe_level = 4;
-    }
-    if ((state = EXEC_TAG()) == 0) {
-	result = rb_call0(data->klass,data->recv,data->id,argc,argv,data->body,0);
-    }
-    POP_TAG();
-    POP_ITER();
-    ruby_safe_level = safe;
-    if (state) JUMP_TAG(state);
-    return result;
-}
-
-static VALUE
-umethod_call(argc, argv, method)
-    int argc;
-    VALUE *argv;
-    VALUE method;
-{
-    rb_raise(rb_eTypeError, "you cannot call unbound method; bind first");
-    return Qnil;		/* not reached */
-}
-
-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 (FL_TEST(CLASS_OF(recv), FL_SINGLETON) &&
-	    st_lookup(RCLASS(CLASS_OF(recv))->m_tbl, data->oid, 0)) {
-	    rb_raise(rb_eTypeError, "method `%s' overridden", rb_id2name(data->oid));
-	}
-	if (!((TYPE(data->rklass) == T_MODULE) ?
-	      rb_obj_is_kind_of(recv, data->rklass) :
-	      rb_obj_is_instance_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;
-}
-
-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);
-      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);
-    }
-}
-
-static VALUE
-method_inspect(method)
-    VALUE method;
-{
-    struct METHOD *data;
-    VALUE str;
-    const char *s;
-    char *sharp = "#";
-
-    Data_Get_Struct(method, struct METHOD, data);
-    str = rb_str_buf_new2("#<");
-    s = rb_class2name(CLASS_OF(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()
-{
-    VALUE proc;
-
-    /* emulate ruby's method call */
-    PUSH_ITER(ITER_CUR);
-    PUSH_FRAME();
-    proc = rb_f_lambda();
-    POP_FRAME();
-    POP_ITER();
-
-    return proc;
-}
-
-static VALUE
-bmcall(args, method)
-    VALUE args, method;
-{
-    args = svalue_to_avalue(args);
-    return method_call(RARRAY(args)->len, RARRAY(args)->ptr, method);
-}
-
-static VALUE
-umcall(args, method)
-    VALUE args, method;
-{
-    return umethod_call(0, 0, method);
-}
-
-VALUE
-rb_proc_new(func, val)
-    VALUE (*func)(ANYARGS);	/* VALUE yieldarg[, VALUE procarg] */
-    VALUE val;
-{
-    return rb_iterate((VALUE(*)_((VALUE)))mproc, 0, func, val);
-}
-
-static VALUE
-method_proc(method)
-    VALUE method;
-{
-    return rb_iterate((VALUE(*)_((VALUE)))mproc, 0, bmcall, method);
-}
-
-static VALUE
-umethod_proc(method)
-    VALUE method;
-{
-    return rb_iterate((VALUE(*)_((VALUE)))mproc, 0, umcall, method);
-}
-
-static VALUE
-rb_mod_define_method(argc, argv, mod)
-    int argc;
-    VALUE *argv;
-    VALUE mod;
-{
-    ID id;
-    VALUE body;
-    NODE *node;
-    int noex;
-
-    if (argc == 1) {
-	id = rb_to_id(argv[0]);
-	body = rb_f_lambda();
-    }
-    else if (argc == 2) {
-	id = rb_to_id(argv[0]);
-	body = argv[1];
-	if (!rb_obj_is_kind_of(body, rb_cMethod) && !rb_obj_is_proc(body)) {
-	    rb_raise(rb_eTypeError, "wrong argument type %s (expected Proc/Method)",
-		     rb_class2name(CLASS_OF(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) {
-	node = NEW_BMETHOD(body);
-    }
-    else {
-	/* type error */
-	rb_raise(rb_eTypeError, "wrong argument type (expected Proc/Method)");
-    }
-
-    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);
-    if (scope_vmode == SCOPE_MODFUNC) {
-	rb_add_method(rb_singleton_class(mod), id, node, NOEX_PUBLIC);
-	rb_funcall(mod, singleton_added, 1, ID2SYM(id));
-    }
-    if (FL_TEST(mod, FL_SINGLETON)) {
-	rb_funcall(rb_iv_get(mod, "__attached__"), singleton_added, 1, ID2SYM(id));
-    }
-    else {
-	rb_funcall(mod, added, 1, ID2SYM(id));
-    }
-    return body;
-}
-
-void
-Init_Proc()
-{
-    rb_eLocalJumpError = rb_define_class("LocalJumpError", rb_eStandardError);
-    rb_define_method(rb_eLocalJumpError, "exitstatus", localjump_exitstatus, 0);
-
-    rb_eSysStackError = rb_define_class("SystemStackError", rb_eStandardError);
-
-    rb_cProc = rb_define_class("Proc", rb_cObject);
-    rb_undef_method(CLASS_OF(rb_cProc), "allocate");
-    rb_define_singleton_method(rb_cProc, "new", proc_s_new, -1);
-
-    rb_define_method(rb_cProc, "call", proc_call, -2);
-    rb_define_method(rb_cProc, "yield", proc_yield, -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_proc, 0);
-    rb_define_method(rb_cProc, "binding", proc_binding, 0);
-    rb_define_global_function("proc", rb_f_lambda, 0);
-    rb_define_global_function("lambda", rb_f_lambda, 0);
-    rb_define_global_function("binding", rb_f_binding, 0);
-    rb_cBinding = rb_define_class("Binding", rb_cObject);
-    rb_undef_method(CLASS_OF(rb_cBinding), "allocate");
-    rb_undef_method(CLASS_OF(rb_cBinding), "new");
-    rb_define_method(rb_cBinding, "clone", bind_clone, 0);
-
-    rb_cMethod = rb_define_class("Method", rb_cObject);
-    rb_undef_method(CLASS_OF(rb_cMethod), "allocate");
-    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_cMethod);
-    rb_define_method(rb_cUnboundMethod, "call", umethod_call, -1);
-    rb_define_method(rb_cUnboundMethod, "[]", umethod_call, -1);
-    rb_define_method(rb_cUnboundMethod, "to_proc", umethod_proc, 0);
-    rb_define_method(rb_cUnboundMethod, "bind", umethod_bind, 1);
-    rb_define_method(rb_cUnboundMethod, "unbind", umethod_unbind, 0);
-    rb_define_method(rb_cModule, "instance_method", rb_mod_method, 1);
-}
-
-static VALUE rb_eThreadError;
-
-int rb_thread_pending = 0;
-
-VALUE rb_cThread;
-
-extern VALUE rb_last_status;
-
-enum thread_status {
-    THREAD_TO_KILL,
-    THREAD_RUNNABLE,
-    THREAD_STOPPED,
-    THREAD_KILLED
-};
-
-#define WAIT_FD		(1<<0)
-#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 * rb_thread_t; */
-
-struct thread {
-    struct thread *next, *prev;
-    jmp_buf context;
-
-    VALUE result;
-
-    int   stk_len;
-    int   stk_max;
-    VALUE*stk_ptr;
-    VALUE*stk_pos;
-
-    struct FRAME *frame;
-    struct SCOPE *scope;
-    struct RVarmap *dyna_vars;
-    struct BLOCK *block;
-    struct iter *iter;
-    struct tag *tag;
-    VALUE klass;
-    VALUE wrapper;
-    NODE *cref;
-
-    int flags;		/* misc. states (vmode/rb_trap_immediate/raised) */
-
-    char *file;
-    int   line;
-
-    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;
-
-    int abort;
-    int priority;
-    int gid;
-
-    st_table *locals;
-
-    VALUE thread;
-};
-
-#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)
-
-#define FOREACH_THREAD(x) FOREACH_THREAD_FROM(curr_thread,x)
-#define END_FOREACH(x)    END_FOREACH_FROM(curr_thread,x)
-
-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) {
-	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);
-    }
-    ruby_safe_level = level;
-    curr_thread->safe = level;
-}
-
-/* Return the current time as a floating-point number */
-static double
-timeofday()
-{
-    struct timeval tv;
-    gettimeofday(&tv, NULL);
-    return (double)tv.tv_sec + (double)tv.tv_usec * 1e-6;
-}
-
-#define STACK(addr) (th->stk_pos<(VALUE*)(addr) && (VALUE*)(addr)stk_pos+th->stk_len)
-#define ADJ(addr) (void*)(STACK(addr)?(((VALUE*)(addr)-th->stk_pos)+th->stk_ptr):(VALUE*)(addr))
-
-static void
-thread_mark(th)
-    rb_thread_t th;
-{
-    struct FRAME *frame;
-    struct BLOCK *block;
-
-    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);
-
-    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) {
-	rb_gc_mark_locations(th->stk_ptr, th->stk_ptr+th->stk_len);
-#if defined(THINK_C) || defined(__human68k__)
-	rb_gc_mark_locations(th->stk_ptr+2, th->stk_ptr+th->stk_len+2);
-#endif
-    }
-    frame = th->frame;
-    while (frame && frame != top_frame) {
-	frame = ADJ(frame);
-	rb_gc_mark_frame(frame);
-	if (frame->tmp) {
-	    struct FRAME *tmp = frame->tmp;
-
-	    while (tmp && tmp != top_frame) {
-		tmp = ADJ(tmp);
-		rb_gc_mark_frame(tmp);
-		tmp = tmp->prev;
-	    }
-	}
-	frame = frame->prev;
-    }
-    block = th->block;
-    while (block) {
-	block = ADJ(block);
-	rb_gc_mark_frame(&block->frame);
-	block = block->prev;
-    }
-}
-
-void
-rb_gc_mark_threads()
-{
-    rb_thread_t th;
-
-    /* static global mark */
-    rb_gc_mark((VALUE)ruby_cref);
-
-    if (!curr_thread) return;
-    FOREACH_THREAD(th) {
-	rb_gc_mark(th->thread);
-    } END_FOREACH(th);
-}
-
-static void
-thread_free(th)
-    rb_thread_t th;
-{
-    if (th->stk_ptr) free(th->stk_ptr);
-    th->stk_ptr = 0;
-    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 rb_thread_t
-rb_thread_check(data)
-    VALUE 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_class2name(CLASS_OF(data)));
-    }
-    return (rb_thread_t)RDATA(data)->data;
-}
-
-static VALUE rb_thread_raise _((int, VALUE*, rb_thread_t));
-
-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 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
-
-extern VALUE *rb_gc_stack_start;
-
-static void
-rb_thread_save_context(th)
-    rb_thread_t th;
-{
-    VALUE *pos;
-    int len;
-    static VALUE tval;
-
-    len = ruby_stack_length(&pos);
-    th->stk_len = 0;
-    th->stk_pos = (rb_gc_stack_start th->stk_max) {
-	REALLOC_N(th->stk_ptr, VALUE, len);
-	th->stk_max = len;
-    }
-    th->stk_len = len;
-    FLUSH_REGISTER_WINDOWS; 
-    MEMCPY(th->stk_ptr, th->stk_pos, VALUE, th->stk_len);
-
-    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->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->file = ruby_sourcefile;
-    th->line = ruby_sourceline;
-}
-
-static int
-thread_switch(n)
-    int n;
-{
-    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);
-	errno = EINTR;
-	break;
-      case RESTORE_RAISE:
-	ruby_frame->last_func = 0;
-	ruby_sourcefile = th_raise_file;
-	ruby_sourceline = th_raise_line;
-	rb_f_raise(th_raise_argc, th_raise_argv);
-	break;
-      case RESTORE_SIGNAL:
-	rb_raise(rb_eSignal, "SIG%s", th_signm);
-	break;
-      case RESTORE_NORMAL:
-      default:
-	break;
-    }
-    return 1;
-}
-
-#define THREAD_SAVE_CONTEXT(th) \
-    (rb_thread_save_context(th),thread_switch(setjmp((th)->context)))
-
-static void rb_thread_restore_context _((rb_thread_t,int));
-
-static void
-stack_extend(th, exit)
-    rb_thread_t th;
-    int exit;
-{
-    VALUE space[1024];
-
-    memset(space, 0, 1);	/* prevent array from optimization */
-    rb_thread_restore_context(th, exit);
-}
-
-static void
-rb_thread_restore_context(th, exit)
-    rb_thread_t th;
-    int exit;
-{
-    VALUE v;
-    static rb_thread_t tmp;
-    static int ex;
-    static VALUE tval;
-
-    if (!th->stk_ptr) rb_bug("unsaved context");
-
-    if (&v < rb_gc_stack_start) {
-	/* Stack grows downward */
-	if (&v > th->stk_pos) stack_extend(th, exit);
-    }
-    else {
-	/* Stack grows upward */
-	if (&v < th->stk_pos + th->stk_len) stack_extend(th, exit);
-    }
-
-    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;
-    rb_trap_immediate = (th->flags&0x100)?1:0;
-    ruby_iter = th->iter;
-    prot_tag = th->tag;
-    tracing = th->tracing;
-    ruby_errinfo = th->errinfo;
-    rb_last_status = th->last_status;
-    ruby_safe_level = th->safe;
-
-    ruby_sourcefile = th->file;
-    ruby_sourceline = th->line;
-
-    tmp = th;
-    ex = exit;
-    FLUSH_REGISTER_WINDOWS;
-    MEMCPY(tmp->stk_pos, tmp->stk_ptr, VALUE, tmp->stk_len);
-
-    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;
-
-    longjmp(tmp->context, ex);
-}
-
-static void
-rb_thread_ready(th)
-    rb_thread_t th;
-{
-    th->wait_for = 0;
-    if (th->status != THREAD_TO_KILL) {
-	th->status = THREAD_RUNNABLE;
-    }
-}
-
-static void
-rb_thread_remove(th)
-    rb_thread_t th;
-{
-    if (th->status == THREAD_KILLED) return;
-
-    rb_thread_ready(th);
-    th->status = THREAD_KILLED;
-    th->gid = 0;
-    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) {
-	    VALUE exc = rb_exc_new2(rb_eIOError, "stream closed");
-	    rb_thread_raise(1, &exc, th);
-	}
-    }
-    END_FOREACH(th);
-}
-
-static void
-rb_thread_deadlock()
-{
-    if (curr_thread == main_thread) {
-	rb_raise(rb_eFatal, "Thread: deadlock");
-    }
-    curr_thread = main_thread;
-    th_raise_argc = 1;
-    th_raise_argv[0] = rb_exc_new2(rb_eFatal, "Thread: deadlock");
-    th_raise_file = ruby_sourcefile;
-    th_raise_line = ruby_sourceline;
-    rb_thread_restore_context(main_thread, RESTORE_RAISE);
-}
-
-static void
-copy_fds(dst, src, max)
-    fd_set *dst, *src;
-    int max;
-{
-    int n = 0;
-    int i;
-
-    for (i=0; i<=max; i++) {
-	if (FD_ISSET(i, src)) {
-	    n = i;
-	    FD_SET(i, dst);
-	}
-    }
-}
-
-static int
-match_fds(dst, src, max)
-    fd_set *dst, *src;
-    int max;
-{
-    int i;
-
-    for (i=0; i<=max; i++) {
-	if (FD_ISSET(i, src) && FD_ISSET(i, dst)) {
-	    return Qtrue;
-	}
-    }
-    return Qfalse;
-}
-
-static int
-intersect_fds(src, dst, max)
-    fd_set *src, *dst;
-    int max;
-{
-    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;
-}
-
-static int
-find_bad_fds(dst, src, max)
-    fd_set *dst, *src;
-    int max;
-{
-    int i, test = Qfalse;
-
-    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;
-
-    rb_thread_pending = 0;
-    if (curr_thread == curr_thread->next
-	&& curr_thread->status == THREAD_RUNNABLE)
-	return;
-
-    next = 0;
-    curr = curr_thread;		/* starting thread */
-
-    while (curr->status == THREAD_KILLED) {
-	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 (!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 (now < 0.0) now = timeofday();
-	    th_delay = th->delay - now;
-	    if (th_delay <= 0.0) {
-		th->status = THREAD_RUNNABLE;
-		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);
-    
-    /* 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;
-	}
-
-	n = select(max+1, &readfds, &writefds, &exceptfds, delay_ptr);
-	if (n < 0) {
-	    int e = errno;
-
-	    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);
-	}
- 	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);
-		}
-	    }
-	    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;
-		}
-		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;
-		}
-	    }
-	    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) {
-	/* raise fatal error to main thread */
-	curr_thread->file = ruby_sourcefile;
-	curr_thread->line = ruby_sourceline;
-	FOREACH_THREAD_FROM(curr, th) {
-	    fprintf(stderr, "deadlock 0x%lx: %d:%d %s - %s:%d\n", 
-		    th->thread, th->status,
-		    th->wait_for, th==main_thread ? "(main)" : "",
-		    th->file, th->line);
-	}
-	END_FOREACH_FROM(curr, th);
-	next = main_thread;
-	rb_thread_ready(next);
-	next->status = THREAD_TO_KILL;
-	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) {
-	if (THREAD_SAVE_CONTEXT(curr)) {
-	    return;
-	}
-    }
-
-    curr_thread = next;
-    if (next->status == THREAD_TO_KILL) {
-	if (!(next->flags & THREAD_TERMINATING)) {
-	    next->flags |= THREAD_TERMINATING;
-	    /* terminate; execute ensure-clause if any */
-	    rb_thread_restore_context(next, RESTORE_FATAL);
-	}
-    }
-    rb_thread_restore_context(next, RESTORE_NORMAL);
-}
-
-void
-rb_thread_wait_fd(fd)
-    int fd;
-{
-    if (rb_thread_critical) 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;
-    curr_thread->wait_for = WAIT_FD;
-    rb_thread_schedule();
-}
-
-int
-rb_thread_fd_writable(fd)
-    int fd;
-{
-    if (rb_thread_critical) return Qtrue;
-    if (curr_thread == curr_thread->next) return Qtrue;
-    if (curr_thread->status == THREAD_TO_KILL) return Qtrue;
-
-    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
-rb_thread_wait_for(time)
-    struct timeval time;
-{
-    double date;
-
-    if (rb_thread_critical ||
-	curr_thread == curr_thread->next ||
-	curr_thread->status == THREAD_TO_KILL) {
-	int n;
-#ifndef linux
-	double d, limit;
-	limit = timeofday()+(double)time.tv_sec+(double)time.tv_usec*1e-6;
-#endif
-	for (;;) {
-	    TRAP_BEG;
-	    n = select(0, 0, 0, 0, &time);
-	    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 += (long)1e6;
-		time.tv_sec -= 1;
-	    }
-	    if (time.tv_sec < 0) return;
-#endif
-	}
-    }
-
-    date = timeofday() + (double)time.tv_sec + (double)time.tv_usec*1e-6;
-    curr_thread->status = THREAD_STOPPED;
-    curr_thread->delay = date;
-    curr_thread->wait_for = WAIT_TIME;
-    rb_thread_schedule();
-}
-
-void rb_thread_sleep_forever _((void));
-
-int
-rb_thread_alone()
-{
-    return curr_thread == curr_thread->next;
-}
-
-int
-rb_thread_select(max, read, write, except, timeout)
-    int max;
-    fd_set *read, *write, *except;
-    struct timeval *timeout;
-{
-    double limit;
-    int n;
-
-    if (!read && !write && !except) {
-	if (!timeout) {
-	    rb_thread_sleep_forever();
-	    return 0;
-	}
-	rb_thread_wait_for(*timeout);
-	return 0;
-    }
-
-    if (timeout) {
-	limit = timeofday()+
-	    (double)timeout->tv_sec+(double)timeout->tv_usec*1e-6;
-    }
-
-    if (rb_thread_critical ||
-	curr_thread == curr_thread->next ||
-	curr_thread->status == THREAD_TO_KILL) {
-#ifndef linux
-	struct timeval tv, *tvp = timeout;
-
-	if (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) {
-		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 = (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;
-		}
-	    }
-	    return n;
-	}
-    }
-
-    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 tried to join itself");
-	if ((th->wait_for & WAIT_JOIN) && th->join == curr_thread)
-	    rb_raise(rb_eThreadError, "Thread#join: deadlock - mutual join");
-	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();
-
-	if (TYPE(oldbt) == T_ARRAY && RARRAY(oldbt)->len > 0) {
-	    rb_ary_unshift(errat, rb_ary_entry(oldbt, 0));
-	}
-	set_backtrace(th->errinfo, errat);
-	rb_exc_raise(th->errinfo);
-    }
-
-    return Qtrue;
-}
-
-static VALUE
-rb_thread_join_m(argc, argv, thread)
-    int argc;
-    VALUE *argv;
-{
-    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;
-}
-
-VALUE
-rb_thread_current()
-{
-    return curr_thread->thread;
-}
-
-VALUE
-rb_thread_main()
-{
-    return main_thread->thread;
-}
-
-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;
-}
-
-VALUE
-rb_thread_wakeup(thread)
-    VALUE thread;
-{
-    rb_thread_t th = rb_thread_check(thread);
-
-    if (th->status == THREAD_KILLED)
-	rb_raise(rb_eThreadError, "killed thread");
-    rb_thread_ready(th);
-
-    return thread;
-}
-
-VALUE
-rb_thread_run(thread)
-    VALUE thread;
-{
-    rb_thread_wakeup(thread);
-    if (!rb_thread_critical) rb_thread_schedule();
-
-    return thread;
-}
-
-static VALUE
-rb_thread_kill(thread)
-    VALUE 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);
-
-    rb_thread_ready(th);
-    th->gid = 0;
-    th->status = THREAD_TO_KILL;
-    if (!rb_thread_critical) rb_thread_schedule();
-    return thread;
-}
-
-static VALUE
-rb_thread_s_kill(obj, th)
-    VALUE obj, th;
-{
-    return rb_thread_kill(th);
-}
-
-static VALUE
-rb_thread_exit()
-{
-    return rb_thread_kill(curr_thread->thread);
-}
-
-static VALUE
-rb_thread_pass()
-{
-    rb_thread_schedule();
-    return Qnil;
-}
-
-VALUE
-rb_thread_stop()
-{
-    enum thread_status last_status = THREAD_RUNNABLE;
-
-    rb_thread_critical = 0;
-    if (curr_thread == curr_thread->next) {
-	rb_raise(rb_eThreadError, "stopping only thread\n\tnote: use sleep to stop forever");
-    }
-    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 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
-rb_thread_sleep(sec)
-    int sec;
-{
-    if (curr_thread == curr_thread->next) {
-	TRAP_BEG;
-	sleep(sec);
-	TRAP_END;
-	return;
-    }
-    rb_thread_wait_for(rb_time_timeval(INT2FIX(sec)));
-}
-
-#if !defined HAVE_PAUSE
-# if defined _WIN32 && !defined __CYGWIN__
-#  define pause() Sleep(INFINITE)
-# else
-#  define pause() sleep(0x7fffffff)
-# endif
-#endif
-
-void
-rb_thread_sleep_forever()
-{
-    if (curr_thread == curr_thread->next ||
-	curr_thread->status == THREAD_TO_KILL) {
-	TRAP_BEG;
-	pause();
-	TRAP_END;
-	return;
-    }
-
-    curr_thread->delay = DELAY_INFTY;
-    curr_thread->wait_for = WAIT_TIME;
-    curr_thread->status = THREAD_STOPPED;
-    rb_thread_schedule();
-}
-
-static VALUE
-rb_thread_priority(thread)
-    VALUE thread;
-{
-    return INT2NUM(rb_thread_check(thread)->priority);
-}
-
-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;
-}
-
-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 thread_abort;
-
-static VALUE
-rb_thread_s_abort_exc()
-{
-    return thread_abort?Qtrue:Qfalse;
-}
-
-static VALUE
-rb_thread_s_abort_exc_set(self, val)
-    VALUE self, val;
-{
-    rb_secure(4);
-    thread_abort = RTEST(val);
-    return val;
-}
-
-static VALUE
-rb_thread_abort_exc(thread)
-    VALUE thread;
-{
-    return rb_thread_check(thread)->abort?Qtrue:Qfalse;
-}
-
-static VALUE
-rb_thread_abort_exc_set(thread, val)
-    VALUE thread, val;
-{
-    rb_secure(4);
-    rb_thread_check(thread)->abort = RTEST(val);
-    return val;
-}
-
-#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;\
-    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->gid = 1;\
-    th->locals = 0;\
-} while (0)
-
-static rb_thread_t
-rb_thread_alloc(klass)
-    VALUE klass;
-{
-    rb_thread_t th;
-    struct RVarmap *vars;
-
-    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)
-static void
-catch_timer(sig)
-    int sig;
-{
-#if !defined(POSIX_SIGNAL) && !defined(BSD_SIGNAL)
-    signal(sig, catch_timer);
-#endif
-    if (!rb_thread_critical) {
-	if (rb_trap_immediate) {
-	    rb_thread_schedule();
-	}
-	else rb_thread_pending = 1;
-    }
-}
-#else
-int rb_thread_tick = THREAD_TICK;
-#endif
-
-#if defined(HAVE_SETITIMER)
-static int thread_init = 0;
-
-void
-rb_thread_start_timer()
-{
-    struct itimerval tval;
-
-    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);
-}
-
-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);
-}
-#endif
-
-static VALUE
-rb_thread_start_0(fn, arg, th_arg)
-    VALUE (*fn)();
-    void *arg;
-    rb_thread_t th_arg;
-{
-    volatile rb_thread_t th = th_arg;
-    volatile VALUE thread = th->thread;
-    struct BLOCK* saved_block = 0;
-    enum thread_status status;
-    int state;
-
-#if defined(HAVE_SETITIMER)
-    if (!thread_init) {
-#ifdef POSIX_SIGNAL
-	posix_signal(SIGVTALRM, catch_timer);
-#else
-	signal(SIGVTALRM, catch_timer);
-#endif
-
-	thread_init = 1;
-	rb_thread_start_timer();
-    }
-#endif
-
-    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->gid = curr_thread->gid;
-    }
-
-    PUSH_TAG(PROT_THREAD);
-    if ((state = EXEC_TAG()) == 0) {
-	if (THREAD_SAVE_CONTEXT(th) == 0) {
-	    curr_thread = th;
-	    th->result = (*fn)(arg, th);
-	}
-    }
-    POP_TAG();
-    status = th->status;
-
-    if (th == main_thread) ruby_stop(state);
-    rb_thread_remove(th);
-
-    while (saved_block) {
-	struct BLOCK *tmp = saved_block;
-
-	if (tmp->frame.argc > 0)
-	    free(tmp->frame.argv);
-	saved_block = tmp->prev;
-	free(tmp);
-    }
-
-    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 = ruby_errinfo;
-	    rb_thread_cleanup();
-	}
-	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_raise(1, &ruby_errinfo, main_thread);
-	    }
-	}
-	else if (th->safe < 4 && (thread_abort || th->abort || RTEST(ruby_debug))) {
-	    VALUE err = rb_exc_new(rb_eSystemExit, 0, 0);
-	    error_print();
-	    /* exit on main_thread */
-	    rb_thread_raise(1, &err, main_thread);
-	}
-	else {
-	    th->errinfo = ruby_errinfo;
-	}
-    }
-    rb_thread_schedule();
-    return 0;			/* not reached */
-}
-
-VALUE
-rb_thread_create(fn, arg)
-    VALUE (*fn)();
-    void *arg;
-{
-    return rb_thread_start_0(fn, arg, rb_thread_alloc(rb_cThread));
-}
-
-static VALUE
-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(mvalue_to_svalue(arg), 0, 0, Qtrue);
-}
-
-static VALUE
-rb_thread_s_new(argc, argv, klass)
-    int argc;
-    VALUE *argv;
-    VALUE klass;
-{
-    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 th->thread;
-}
-
-static VALUE
-rb_thread_initialize(thread, args)
-    VALUE thread, 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_check(thread));
-}
-
-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));
-}
-
-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;
-}
-
-static VALUE
-rb_thread_status(thread)
-    VALUE thread;
-{
-    rb_thread_t th = rb_thread_check(thread);
-
-    if (rb_thread_dead(th)) {
-	if (!NIL_P(th->errinfo) && (th->flags & THREAD_RAISED))
-	    return Qnil;
-	return Qfalse;
-    }
-
-    return rb_str_new2(thread_status_name(th->status));
-}
-
-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;
-}
-
-static VALUE
-rb_thread_stop_p(thread)
-    VALUE thread;
-{
-    rb_thread_t th = rb_thread_check(thread);
-
-    if (rb_thread_dead(th)) return Qtrue;
-    if (th->status == THREAD_STOPPED) return Qtrue;
-    return Qfalse;
-}
-
-static void
-rb_thread_wait_other_threads()
-{
-    rb_thread_t th;
-    int found;
-
-    /* wait other threads to terminate */
-    while (curr_thread != curr_thread->next) {
-	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
-rb_thread_cleanup()
-{
-    rb_thread_t th;
-
-    while (curr_thread->status == THREAD_KILLED) {
-	curr_thread = curr_thread->prev;
-    }
-
-    FOREACH_THREAD(th) {
-	if (th->status != THREAD_KILLED) {
-	    rb_thread_ready(th);
-	    th->gid = 0;
-	    th->priority = 0;
-	    if (th != main_thread) {
-		th->status = THREAD_TO_KILL;
-		RDATA(th->thread)->dfree = NULL;
-	    }
-	}
-    }
-    END_FOREACH(th);
-}
-
-int rb_thread_critical;
-
-static VALUE
-rb_thread_critical_get()
-{
-    return rb_thread_critical?Qtrue:Qfalse;
-}
-
-static VALUE
-rb_thread_critical_set(obj, val)
-    VALUE obj, val;
-{
-    rb_thread_critical = RTEST(val);
-    return val;
-}
-
-void
-rb_thread_interrupt()
-{
-    rb_thread_critical = 0;
-    rb_thread_ready(main_thread);
-    if (curr_thread == main_thread) {
-	rb_interrupt();
-    }
-    if (THREAD_SAVE_CONTEXT(curr_thread)) {
-	return;
-    }
-    curr_thread = main_thread;
-    rb_thread_restore_context(curr_thread, RESTORE_INTERRUPT);
-}
-
-void
-rb_thread_signal_raise(sig)
-    char *sig;
-{
-    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);
-    }
-    rb_thread_ready(main_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)
-    VALUE cmd;
-    int sig;
-{
-#if 0
-    rb_thread_critical = 0;
-    if (!rb_thread_dead(curr_thread)) {
-	rb_thread_ready(curr_thread);
-	rb_trap_eval(cmd, sig);
-	return;
-    }
-    rb_thread_ready(main_thread);
-    if (THREAD_SAVE_CONTEXT(curr_thread)) {
-	return;
-    }
-    th_cmd = cmd;
-    th_sig = sig;
-    curr_thread = main_thread;
-    rb_thread_restore_context(curr_thread, RESTORE_TRAP);
-#else
-    rb_thread_critical = 0;
-    if (!rb_thread_dead(curr_thread)) {
-	if (THREAD_SAVE_CONTEXT(curr_thread)) {
-	    return;
-	}
-    }
-    rb_thread_ready(main_thread);
-    th_cmd = cmd;
-    th_sig = sig;
-    curr_thread = main_thread;
-    rb_thread_restore_context(curr_thread, RESTORE_TRAP);
-#endif
-}
-
-static VALUE
-rb_thread_raise(argc, argv, th)
-    int argc;
-    VALUE *argv;
-    rb_thread_t th;
-{
-    if (rb_thread_dead(th)) return Qnil;
-    if (curr_thread == th) {
-	rb_f_raise(argc, argv);
-    }
-
-    if (THREAD_SAVE_CONTEXT(curr_thread)) {
-	return th->thread;
-    }
-
-    rb_scan_args(argc, argv, "11", &th_raise_argv[0], &th_raise_argv[1]);
-    rb_thread_ready(th);
-    curr_thread = th;
-
-    th_raise_argc = argc;
-    th_raise_file = ruby_sourcefile;
-    th_raise_line = ruby_sourceline;
-    rb_thread_restore_context(curr_thread, RESTORE_RAISE);
-    return Qnil;		/* not reached */
-}
-
-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;
-}
-
-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, &id, 0);
-	return Qnil;
-    }
-    st_insert(th->locals, id, val);
-
-    return val;
-}
-
-static VALUE
-rb_thread_aset(thread, id, val)
-    VALUE thread, id, val;
-{
-    return rb_thread_local_aset(thread, rb_to_id(id), val);
-}
-
-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_keys_i(key, value, ary)
-    ID key;
-    VALUE value, ary;
-{
-    rb_ary_push(ary, ID2SYM(key));
-    return ST_CONTINUE;
-}
-
-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;
-}
-
-static VALUE
-rb_thread_inspect(thread)
-    VALUE thread;
-{
-    char *cname = rb_class2name(CLASS_OF(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) {
-	    th->gid = 0;
-	    th->status = THREAD_KILLED;
-	}
-    }
-    END_FOREACH(th);
-    main_thread = curr_thread;
-    curr_thread->next = curr_thread;
-    curr_thread->prev = curr_thread;
-}
-
-static VALUE rb_cCont;
-
-static VALUE
-rb_callcc(self)
-    VALUE self;
-{
-    volatile VALUE cont;
-    rb_thread_t th;
-    struct tag *tag;
-    struct RVarmap *vars;
-
-    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);
-    }
-    if (ruby_block) {
-	struct BLOCK *block = ruby_block;
-
-	while (block) {
-	    block->tag->flags |= BLOCK_DYNAMIC;
-	    block = block->prev;
-	}
-    }
-    th->thread = curr_thread->thread;
-
-    for (vars = th->dyna_vars; vars; vars = vars->next) {
-	if (FL_TEST(vars, DVAR_DONT_RECYCLE)) break;
-	FL_SET(vars, DVAR_DONT_RECYCLE);
-    }
-
-    if (THREAD_SAVE_CONTEXT(th)) {
-	return th->result;
-    }
-    else {
-	return rb_yield(cont);
-    }
-}
-
-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;
-	break;
-      default:
-	th->result = rb_ary_new4(argc, argv);
-	break;
-    }
-
-    rb_thread_restore_context(th, RESTORE_NORMAL);
-    return Qnil;
-}
-
-struct thgroup {
-    int gid;
-};
-
-static VALUE
-thgroup_s_alloc(klass)
-    VALUE klass;
-{
-    VALUE group;
-    struct thgroup *data;
-    static int serial = 1;
-
-    group = Data_Make_Struct(klass, struct thgroup, 0, free, data);
-    data->gid = serial++;
-
-    return group;
-}
-
-static VALUE
-thgroup_list(group)
-    VALUE group;
-{
-    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->gid == data->gid) {
-	    rb_ary_push(ary, th->thread);
-	}
-    }
-    END_FOREACH(th);
-
-    return ary;
-}
-
-static VALUE
-thgroup_add(group, thread)
-    VALUE group, thread;
-{
-    rb_thread_t th;
-    struct thgroup *data;
-
-    rb_secure(4);
-    th = rb_thread_check(thread);
-    Data_Get_Struct(group, struct thgroup, data);
-
-    th->gid = data->gid;
-    return group;
-}
-
-void
-Init_Thread()
-{
-    VALUE cThGroup;
-
-    rb_eThreadError = rb_define_class("ThreadError", rb_eStandardError);
-    rb_cThread = rb_define_class("Thread", rb_cObject);
-    rb_undef_method(CLASS_OF(rb_cThread), "allocate");
-
-    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, "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, "[]", 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);
-
-    /* allocate main thread */
-    main_thread = rb_thread_alloc(rb_cThread);
-    curr_thread = main_thread->prev = main_thread->next = main_thread;
-
-    rb_cCont = rb_define_class("Continuation", rb_cObject);
-    rb_undef_method(CLASS_OF(rb_cCont), "allocate");
-    rb_undef_method(CLASS_OF(rb_cCont), "new");
-    rb_define_method(rb_cCont, "call", rb_cont_call, -1);
-    rb_define_global_function("callcc", rb_callcc, 0);
-
-    cThGroup = rb_define_class("ThreadGroup", rb_cObject);
-    rb_define_singleton_method(cThGroup, "allocate", thgroup_s_alloc, 0);
-    rb_define_method(cThGroup, "list", thgroup_list, 0);
-    rb_define_method(cThGroup, "add", thgroup_add, 1);
-    rb_define_const(cThGroup, "Default", rb_obj_alloc(cThGroup));
-}
-
-static VALUE
-rb_f_catch(dmy, tag)
-    VALUE dmy, tag;
-{
-    int state;
-    ID t;
-    VALUE val;			/* OK */
-
-    t = rb_to_id(tag);
-    PUSH_TAG(t);
-    if ((state = EXEC_TAG()) == 0) {
-	val = rb_yield_0(tag, 0, 0, 0);
-    }
-    else if (state == TAG_THROW && t == prot_tag->dst) {
-	val = prot_tag->retval;
-	state = 0;
-    }
-    POP_TAG();
-    if (state) JUMP_TAG(state);
-
-    return val;
-}
-
-static VALUE
-catch_i(tag)
-    ID tag;
-{
-    return rb_funcall(Qnil, rb_intern("catch"), 1, ID2SYM(tag));
-}
-
-VALUE
-rb_catch(tag, proc, data)
-    const char *tag;
-    VALUE (*proc)();
-    VALUE data;
-{
-    return rb_iterate((VALUE(*)_((VALUE)))catch_i, rb_intern(tag), proc, data);
-}
-
-static VALUE
-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);
-
-    while (tt) {
-	if (tt->tag == t) {
-	    tt->dst = t;
-	    break;
-	}
-	if (tt->tag == PROT_THREAD) {
-	    rb_raise(rb_eThreadError, "uncaught throw `%s' in thread 0x%x",
-		     rb_id2name(t),
-		     curr_thread);
-	}
-	tt = tt->prev;
-    }
-    if (!tt) {
-	rb_name_error(t, "uncaught throw `%s'", rb_id2name(t));
-    }
-    return_value(value);
-    rb_trap_restore_mask();
-    JUMP_TAG(TAG_THROW);
-}
-
-void
-rb_throw(tag, val)
-    const char *tag;
-    VALUE val;
-{
-    VALUE argv[2];
-    ID t = rb_intern(tag);
-
-    argv[0] = ID2SYM(t);
-    argv[1] = val;
-    rb_f_throw(2, argv);
-}
-
-static void
-return_check()
-{
-    struct tag *tt = prot_tag;
-
-    while (tt) {
-	if (tt->tag == PROT_FUNC) {
-	    break;
-	}
-	if (tt->tag == PROT_THREAD) {
-	    rb_raise(rb_eThreadError, "return from within thread 0x%x",
-		     curr_thread);
-	}
-	tt = tt->prev;
-    }
-}
diff --git a/ext/.cvsignore b/ext/.cvsignore
deleted file mode 100644
index a3fac48ae6..0000000000
--- a/ext/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-extinit.c
-extmk.log
-extmk.rb
diff --git a/ext/Setup b/ext/Setup
deleted file mode 100644
index be5f73a3c9..0000000000
--- a/ext/Setup
+++ /dev/null
@@ -1,27 +0,0 @@
-#option nodynamic
-
-#Win32API
-#curses
-#dbm
-#digest
-#digest/md5
-#digest/rmd160
-#digest/sha1
-#digest/sha2
-#dl
-#etc
-#fcntl
-#gdbm
-#iconv
-#nkf
-#pty
-#racc/cparse
-#readline
-#sdbm
-#socket
-#stringio
-#strscan
-#syslog
-#tcltklib
-#tk
-#win32ole
diff --git a/ext/Setup.dj b/ext/Setup.dj
deleted file mode 100644
index b6b5165bce..0000000000
--- a/ext/Setup.dj
+++ /dev/null
@@ -1,27 +0,0 @@
-option nodynamic
-
-#Win32API
-#curses
-dbm
-digest
-digest/md5
-digest/rmd160
-digest/sha1
-digest/sha2
-#dl
-#etc
-fcntl
-gdbm
-#iconv
-nkf
-#pty
-racc/cparse
-readline
-sdbm
-#socket
-stringio
-strscan
-#syslog
-#tcltklib
-#tk
-#win32ole
diff --git a/ext/Setup.emx b/ext/Setup.emx
deleted file mode 100644
index 90e1873702..0000000000
--- a/ext/Setup.emx
+++ /dev/null
@@ -1,27 +0,0 @@
-option nodynamic
-
-#Win32API
-curses
-#dbm
-digest
-digest/md5
-digest/rmd160
-digest/sha1
-digest/sha2
-#dl
-etc
-fcntl
-#gdbm
-#iconv
-nkf
-#pty
-racc/cparse
-#readline
-#sdbm
-socket
-stringio
-strscan
-#syslog
-#tcltklib
-#tk
-#win32ole
diff --git a/ext/Setup.nt b/ext/Setup.nt
deleted file mode 100644
index 02638c8eab..0000000000
--- a/ext/Setup.nt
+++ /dev/null
@@ -1,27 +0,0 @@
-#option nodynamic
-
-Win32API
-#curses
-#dbm
-digest
-digest/md5
-digest/rmd160
-digest/sha1
-digest/sha2
-#dl
-#etc
-fcntl
-#gdbm
-#iconv
-nkf
-#pty
-racc/cparse
-#readline
-sdbm
-socket
-stringio
-strscan
-#syslog
-#tcltklib
-#tk
-win32ole
diff --git a/ext/Setup.x68 b/ext/Setup.x68
deleted file mode 100644
index a5e4bc64bb..0000000000
--- a/ext/Setup.x68
+++ /dev/null
@@ -1,27 +0,0 @@
-option nodynamic
-
-#Win32API
-#curses
-dbm
-digest
-digest/md5
-digest/rmd160
-digest/sha1
-digest/sha2
-#dl
-#etc
-fcntl
-#gdbm
-#iconv
-nkf
-#pty
-racc/cparse
-#readline
-#sdbm
-#socket
-stringio
-strscan
-#syslog
-#tcltklib
-#tk
-#win32ole
diff --git a/ext/Win32API/.cvsignore b/ext/Win32API/.cvsignore
deleted file mode 100644
index f3c7a7c5da..0000000000
--- a/ext/Win32API/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-Makefile
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
deleted file mode 100644
index b9f16e2519..0000000000
--- a/ext/Win32API/Win32API.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
-  Win32API - Ruby Win32 API Import Facility
-*/
-
-#if !defined _MSC_VER && !defined NT
-#define  WIN32_LEAN_AND_MEAN
-#include 
-#include 
-#endif
-
-#if defined(_MSC_VER)
-#if defined(_M_ALPHA)
-#ifdef __cplusplus
-extern "C" { long __asm(char *,...); };
-#else
-long __asm(char *,...);
-#endif
-#pragma intrinsic(__asm)
-#endif
-#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 {
-    HANDLE dll;
-    HANDLE proc;
-    VALUE dllname;
-    VALUE import;
-    VALUE export;
-} Win32API;
-
-static void
-Win32API_FreeLibrary(hdll)
-    HINSTANCE hdll;
-{
-    FreeLibrary(hdll);
-}
-
-static VALUE
-Win32API_initialize(self, dllname, proc, import, export)
-    VALUE self;
-    VALUE dllname;
-    VALUE proc;
-    VALUE import;
-    VALUE export;
-{
-    HANDLE hproc;
-    HINSTANCE hdll;
-    VALUE str;
-    VALUE a_import;
-    VALUE *ptr;
-    char *s;
-    int i;
-    int len;
-    int ex;
-
-    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(self, 0, Win32API_FreeLibrary, hdll));
-    hproc = GetProcAddress(hdll, RSTRING(proc)->ptr);
-    if (!hproc) {
-	str = rb_str_new3(proc);
-	str = rb_str_cat(str, "A", 1);
-	hproc = GetProcAddress(hdll, RSTRING(str)->ptr);
-	if (!hproc)
-	    rb_raise(rb_eRuntimeError, "GetProcAddress: %s or %s\n",
-		RSTRING(proc)->ptr, RSTRING(str)->ptr);
-    }
-    rb_iv_set(self, "__dll__", UINT2NUM((unsigned long)hdll));
-    rb_iv_set(self, "__dllname__", dllname);
-    rb_iv_set(self, "__proc__", UINT2NUM((unsigned long)hproc));
-
-    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;
-    }
-    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':
-	    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;
-}
-
-#ifdef __BORLANDC__ 
-int c_m( FARPROC api, long* p )
-{
-  long pp[16];
-  memcpy( pp, p, 16*sizeof(long) );
-  return api();
-}
-#endif
-
-static VALUE
-Win32API_Call(argc, argv, obj)
-    int argc;
-    VALUE *argv;
-    VALUE obj;
-{
-    VALUE args;
-
-    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;
-    int ret;
-#ifdef __BORLANDC__ 
-    long* ptr;
-    long p[16];
-#endif
-
-    items = rb_scan_args(argc, argv, "0*", &args);
-
-    obj_proc = rb_iv_get(obj, "__proc__");
-
-    ApiFunction = (FARPROC)NUM2ULONG(obj_proc);
-
-    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)
-	rb_raise(rb_eRuntimeError, "Wrong number of parameters: expected %d, got %d.\n",
-	    nimport, items);
-
-    if (0 < nimport) {
-#ifdef __BORLANDC__ 
-       ptr = p + ( nimport - 1 );
-#endif
-	for (i = nimport - 1; 0 <= i; i--) {
-	    VALUE str;
-	    import_type = rb_ary_entry(obj_import, i);
-	    timport = FIX2INT(import_type);
-	    switch (timport) {
-	    case _T_NUMBER:
-	    case _T_INTEGER:
-		lParam = NUM2ULONG(rb_ary_entry(args, i));
-#if defined(_MSC_VER) || defined(__LCC__)
-#if defined(_M_IX86)
-		_asm {
-		    mov     eax, lParam
-		    push    eax
-		}
-#elif defined(_M_ALPHA)
-		__asm(
-			"ldl r0, 0(%0);"
-			"stq r0, -(sp);"
-			, lParam
-		);
-#else
-#error
-#endif
-#elif defined(__BORLANDC__)
-		*ptr = lParam;
-		--ptr;
-#elif defined __GNUC__
-		asm volatile ("pushl %0" :: "g" (lParam));
-#else
-#error
-#endif
-		break;
-	    case _T_POINTER:
-		str = rb_ary_entry(args, i);
-		if (NIL_P(str)) {
-		    pParam = 0;
-		} else if (FIXNUM_P(str)){
-		    pParam = (char *)NUM2ULONG(str);
-		} else {
-		    StringValue(str);
-		    rb_str_modify(str);
-		    pParam = RSTRING(str)->ptr;
-		}
-#if defined(_MSC_VER) || defined(__LCC__)
-#if defined(_M_IX86)
-		_asm {
-		    mov     eax, pParam
-		    push    eax
-		}
-#elif defined(_M_ALPHA)
-		__asm(
-			"ldl r0, 0(%0);"
-			"stq r0, -(sp);"
-			, pParam
-		);
-#else
-#error
-#endif
-#elif defined(__BORLANDC__)
-		*ptr = (long)pParam;
-		--ptr;
-#elif defined __GNUC__
-		asm volatile ("pushl %0" :: "g" (pParam));
-#else
-#error
-#endif
-		break;
-	    }
-	}
-    }
-
-#if defined __GNUC__
-    asm volatile ("call *%1" : "=r" (ret) : "g" (ApiFunction));
-    switch (texport) {
-    case _T_NUMBER:
-    case _T_INTEGER:
-	Return = INT2NUM(ret);
-	break;
-    case _T_POINTER:
-	Return = rb_str_new2((char *)ret);
-	break;
-    case _T_VOID:
-    default:
-	Return = INT2NUM(0);
-	break;
-    }
-#else
-    switch (texport) {
-    case _T_NUMBER:
-#if defined(__BORLANDC__)
-	Return = INT2NUM((long)c_m(ApiFunction, p));
-#else
-	ApiFunctionNumber = (ApiNumber *) ApiFunction;
-	Return = INT2NUM(ApiFunctionNumber());
-#endif
-	break;
-    case _T_POINTER:
-#if defined(__BORLANDC__)
-	Return = rb_str_new2((char *)c_m(ApiFunction, p));
-#else
-	ApiFunctionPointer = (ApiPointer *) ApiFunction;
-	Return = rb_str_new2((char *)ApiFunctionPointer());
-#endif
-	break;
-    case _T_INTEGER:
-#if defined(__BORLANDC__)
-	Return = INT2NUM((int)c_m(ApiFunction, p));
-#else
-	ApiFunctionInteger = (ApiInteger *) ApiFunction;
-	Return = INT2NUM(ApiFunctionInteger());
-#endif
-	break;
-    case _T_VOID:
-    default:
-	ApiFunctionVoid = (ApiVoid *) ApiFunction;
-	ApiFunctionVoid();
-	Return = INT2NUM(0);
-	break;
-    }
-#endif
-    return Return;
-}
-
-void
-Init_Win32API()
-{
-    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
deleted file mode 100644
index b224bb66c9..0000000000
--- a/ext/Win32API/depend
+++ /dev/null
@@ -1 +0,0 @@
-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
deleted file mode 100644
index b69459c275..0000000000
--- a/ext/Win32API/extconf.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'mkmf'
-
-if have_library("kernel32")
-  if Config::CONFIG["CC"] =~ /gcc/
-    $CFLAGS += "-fno-defer-pop -fno-omit-frame-pointer"
-  end
-  create_makefile("Win32API")
-end
diff --git a/ext/Win32API/getch.rb b/ext/Win32API/getch.rb
deleted file mode 100644
index c015bbe9bc..0000000000
--- a/ext/Win32API/getch.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'Win32API'
-
-getch = Win32API.new("crtdll", "_getch", [], 'L')
-
-puts getch.Call.chr
diff --git a/ext/Win32API/point.rb b/ext/Win32API/point.rb
deleted file mode 100644
index 60e265f3ee..0000000000
--- a/ext/Win32API/point.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-require 'Win32API'
-
-getCursorPos = Win32API.new("user32", "GetCursorPos", ['P'], 'V')
-
-lpPoint = " " * 8 # store two LONGs
-getCursorPos.Call(lpPoint)
-x, y = lpPoint.unpack("LL") # get the actual values
-
-print "x: ", x, "\n"
-print "y: ", y, "\n"
-
-ods = Win32API.new("kernel32", "OutputDebugString", ['P'], 'V')
-ods.Call("Hello, World\n");
-
-GetDesktopWindow = Win32API.new("user32", "GetDesktopWindow", [], 'L')
-GetActiveWindow = Win32API.new("user32", "GetActiveWindow", [], 'L')
-SendMessage = Win32API.new("user32", "SendMessage", ['L'] * 4, 'L')
-SendMessage.Call GetDesktopWindow.Call, 274, 0xf140, 0
diff --git a/ext/aix_mksym.rb b/ext/aix_mksym.rb
deleted file mode 100644
index 7e1af283dc..0000000000
--- a/ext/aix_mksym.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-
-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"
-      line[0]
-    else
-      next
-    end
-  }.compact!.sort!
-  uniq(data)
-  exp = open(out, "w")
-  exp.printf "#!\n"
-  for line in data
-    exp.printf "%s\n", line
-  end
-  exp.close
-  nm.close
-end
-extract(open("|/usr/ccs/bin/nm -p ../libruby.a"), "../ruby.imp")
diff --git a/ext/configsub.rb b/ext/configsub.rb
deleted file mode 100644
index 47689d7ec0..0000000000
--- a/ext/configsub.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-#!./miniruby -ps
-
-BEGIN {
-  CONFIG = {}
-
-  RUBY_VERSION.scan(/(\d+)\.(\d+)\.(\d+)/) do
-    # overridden if config.status has version
-    CONFIG['MAJOR'] = $1
-    CONFIG['MINOR'] = $2
-    CONFIG['TEENY'] = $3
-  end
-
-  File.foreach($config || "config.status") do |line|
-    next if /^#/ =~ line
-    if /^s[%,]@(\w+)@[%,](.*)[%,][g;]/ =~ line
-      name = $1
-      val = $2 || ""
-      next if /^(INSTALL|DEFS|configure_input|srcdir)$/ =~ name
-      val.gsub!(/\$\{([^{}]+)\}/) { "$(#{$1})" }
-      CONFIG[name] = val
-    end
-  end
-
-  CONFIG['top_srcdir'] = File.expand_path($srcdir || ".")
-  CONFIG['RUBY_INSTALL_NAME'] = $install_name if $install_name
-  CONFIG['RUBY_SO_NAME'] = $so_name if $so_name
-  $defout = open($output, 'w') if $output
-}
-
-gsub!(/@(\w+)@/) {CONFIG[$1] || $&}
-
-# vi:set sw=2:
diff --git a/ext/curses/.cvsignore b/ext/curses/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/curses/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/curses/MANIFEST b/ext/curses/MANIFEST
deleted file mode 100644
index 5882d682f0..0000000000
--- a/ext/curses/MANIFEST
+++ /dev/null
@@ -1,9 +0,0 @@
-MANIFEST
-curses.c
-depend
-extconf.rb
-hello.rb
-rain.rb
-view.rb
-view2.rb
-mouse.rb
diff --git a/ext/curses/curses.c b/ext/curses/curses.c
deleted file mode 100644
index 2a48508b01..0000000000
--- a/ext/curses/curses.c
+++ /dev/null
@@ -1,1874 +0,0 @@
-/* -*- C -*-
- * $Id$
- *
- * ext/curses/curses.c
- * 
- * by MAEDA Shugo (ender@pic-internet.or.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 
-#else
-# ifdef HAVE_NCURSES_CURSES_H
-#  include 
-#else
-# ifdef HAVE_CURSES_COLR_CURSES_H
-#  include 
-#  include 
-# else
-#  include 
-#  if (defined(__bsdi__) || defined(__NetBSD__) || defined(__APPLE__)) && !defined(_maxx)
-#   define _maxx maxx
-#  endif
-#  if (defined(__bsdi__) || defined(__NetBSD__) || defined(__APPLE__)) && !defined(_maxy)
-#   define _maxy maxy
-#  endif
-#  if (defined(__bsdi__) || defined(__NetBSD__) || defined(__APPLE__)) && !defined(_begx)
-#   define _begx begx
-#  endif
-#  if (defined(__bsdi__) || defined(__NetBSD__) || defined(__APPLE__)) && !defined(_begy)
-#   define _begy begy
-#  endif
-# endif
-#endif
-#endif
-
-#ifdef HAVE_INIT_COLOR
-# define USE_COLOR 1
-#endif
-
-/* supports only ncurses mouse routines */
-#ifdef NCURSES_MOUSE_VERSION
-# define USE_MOUSE 1
-#endif
-
-#include "stdio.h"
-#include "ruby.h"
-#include "rubyio.h"
-
-static VALUE mCurses;
-static VALUE mKey;
-static VALUE cWindow;
-#ifdef USE_MOUSE
-static VALUE cMouseEvent;
-#endif
-
-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()
-{
-    rb_raise(rb_eRuntimeError, "already closed window");
-}
-
-
-#define GetWINDOW(obj, winp) {\
-    Data_Get_Struct(obj, struct windata, winp);\
-    if (winp->window == 0) no_window();\
-}
-
-
-static void
-free_window(winp)
-    struct windata *winp;
-{
-    if (winp->window && winp->window != stdscr) delwin(winp->window);
-    winp->window = 0;
-    free(winp);
-}
-
-static VALUE
-prep_window(class, window)
-    VALUE class;
-    WINDOW *window;
-{
-    VALUE obj;
-    struct windata *winp;
-
-    if (window == NULL) {
-	rb_raise(rb_eRuntimeError, "failed to create window");
-    }
-
-    obj = Data_Make_Struct(class, struct windata, 0, free_window, winp);
-    winp->window = window;
-    
-    return obj;    
-}
-
-/*-------------------------- module Curses --------------------------*/
-
-/* def init_screen */
-static VALUE
-curses_init_screen()
-{
-    initscr();
-    if (stdscr == 0) {
-	rb_raise(rb_eRuntimeError, "cannot initialize curses");
-    }
-    clear();
-    rb_stdscr = prep_window(cWindow, stdscr);
-    return rb_stdscr;
-}
-
-/* def stdscr */
-static VALUE
-curses_stdscr()
-{
-    if (rb_stdscr == 0) curses_init_screen();
-    return rb_stdscr;
-}
-
-/* def close_screen */
-static VALUE
-curses_close_screen()
-{
-#ifdef HAVE_ISENDWIN
-    if (!isendwin())
-#endif
-	endwin();
-    return Qnil;
-}
-
-static void
-curses_finalize()
-{
-    if (stdscr
-#ifdef HAVE_ISENDWIN
-	&& !isendwin()
-#endif
-	)
-	endwin();
-}
-
-/* def closed? */
-static VALUE
-curses_closed()
-{
-#ifdef HAVE_ISENDWIN
-    if (isendwin()) {
-	return Qtrue;
-    }
-    return Qfalse;
-#else
-    rb_notimplement();
-#endif
-}
-
-/* def clear */
-static VALUE
-curses_clear(obj)
-    VALUE obj;
-{
-    wclear(stdscr);
-    return Qnil;
-}
-
-/* def refresh */
-static VALUE
-curses_refresh(obj)
-    VALUE obj;
-{
-    refresh();
-    return Qnil;
-}
-
-/* def doupdate */
-static VALUE
-curses_doupdate(obj)
-    VALUE obj;
-{
-#ifdef HAVE_DOUPDATE
-    doupdate();
-#else
-    refresh();
-#endif
-    return Qnil;
-}
-
-/* def echo */
-static VALUE
-curses_echo(obj)
-    VALUE obj;
-{
-    echo();
-    return Qnil;
-}
-
-/* def noecho */
-static VALUE
-curses_noecho(obj)
-    VALUE obj;
-{
-    noecho();
-    return Qnil;
-}
-
-/* def raw */
-static VALUE
-curses_raw(obj)
-    VALUE obj;
-{
-    raw();
-    return Qnil;
-}
-
-/* def noraw */
-static VALUE
-curses_noraw(obj)
-    VALUE obj;
-{
-    noraw();
-    return Qnil;
-}
-
-/* def cbreak */
-static VALUE
-curses_cbreak(obj)
-    VALUE obj;
-{
-    cbreak();
-    return Qnil;
-}
-
-/* def nocbreak */
-static VALUE
-curses_nocbreak(obj)
-    VALUE obj;
-{
-    nocbreak();
-    return Qnil;
-}
-
-/* def nl */
-static VALUE
-curses_nl(obj)
-    VALUE obj;
-{
-    nl();
-    return Qnil;
-}
-
-/* def nonl */
-static VALUE
-curses_nonl(obj)
-    VALUE obj;
-{
-    nonl();
-    return Qnil;
-}
-
-/* def beep */
-static VALUE
-curses_beep(obj)
-    VALUE obj;
-{
-#ifdef HAVE_BEEP
-    beep();
-#endif
-    return Qnil;
-}
-
-/* def flash */
-static VALUE
-curses_flash(obj)
-    VALUE obj;
-{
-#ifdef HAVE_FLASH
-    flash();
-#endif
-    return Qnil;
-}
-
-/* def ungetch */
-static VALUE
-curses_ungetch(obj, ch)
-    VALUE obj;
-    VALUE ch;
-{
-#ifdef HAVE_UNGETCH
-    ungetch(NUM2INT(ch));
-#else
-    rb_notimplement();
-#endif
-    return Qnil;
-}
-
-/* def setpos(y, x) */
-static VALUE
-curses_setpos(obj, y, x)
-    VALUE obj;
-    VALUE y;
-    VALUE x;
-{
-    move(NUM2INT(y), NUM2INT(x));
-    return Qnil;
-}
-
-/* def standout */
-static VALUE
-curses_standout(obj)
-    VALUE obj;
-{
-    standout();
-    return Qnil;
-}
-
-/* def standend */
-static VALUE
-curses_standend(obj)
-    VALUE obj;
-{
-    standend();
-    return Qnil;
-}
-
-/* def inch */
-static VALUE
-curses_inch(obj)
-    VALUE obj;
-{
-    return CHR2FIX(inch());
-}
-
-/* def addch(ch) */
-static VALUE
-curses_addch(obj, ch)
-    VALUE obj;
-    VALUE ch;
-{
-    addch(NUM2CHR(ch));
-    return Qnil;
-}
-
-/* def insch(ch) */
-static VALUE
-curses_insch(obj, ch)
-    VALUE obj;
-    VALUE ch;
-{
-    insch(NUM2CHR(ch));
-    return Qnil;
-}
-
-/* def addstr(str) */
-static VALUE
-curses_addstr(obj, str)
-    VALUE obj;
-    VALUE str;
-{
-    if (!NIL_P(str)) {
-	addstr(STR2CSTR(str));
-    }
-    return Qnil;
-}
-
-/* def getch */
-static VALUE
-curses_getch(obj)
-    VALUE obj;
-{
-    rb_read_check(stdin);
-    return UINT2NUM(getch());
-}
-
-/* def getstr */
-static VALUE
-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);
-#endif
-    return rb_tainted_str_new2(rtn);
-}
-
-/* def delch */
-static VALUE
-curses_delch(obj)
-    VALUE obj;
-{
-    delch();
-    return Qnil;
-}
-
-/* def delelteln */
-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
-curses_lines()
-{
-    return INT2FIX(LINES);
-}
-
-static VALUE
-curses_cols()
-{
-    return INT2FIX(COLS);
-}
-
-static VALUE
-curses_curs_set(VALUE obj, VALUE visibility)
-{
-  int n;
-  return (n = curs_set(NUM2INT(visibility)) != ERR) ? INT2FIX(n) : Qnil;
-}
-
-static VALUE
-curses_scrl(VALUE obj, VALUE n)
-{
-  /* may have to raise exception on ERR */
-  return (scrl(NUM2INT(n)) == OK) ? Qtrue : Qfalse;
-}
-
-static VALUE
-curses_setscrreg(VALUE obj, VALUE top, VALUE bottom)
-{
-  /* may have to raise exception on ERR */
-  return (setscrreg(NUM2INT(top), NUM2INT(bottom)) == OK) ? Qtrue : Qfalse;
-}
-
-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)
-{
-  bkgdset(NUM2CHR(ch));
-  return Qnil;
-}
-
-static VALUE
-curses_bkgd(VALUE obj, VALUE ch)
-{
-  return CHR2FIX(bkgd(NUM2CHR(ch)));
-}
-
-static VALUE
-curses_resizeterm(VALUE obj, VALUE lines, VALUE columns)
-{
-#if defined(HAVE_RESIZETERM)
-  return (resizeterm(NUM2INT(lines),NUM2INT(columns)) == 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
-
-#ifdef USE_MOUSE
-struct mousedata {
-  MEVENT *mevent;
-};
-
-static void
-no_mevent()
-{
-  rb_raise(rb_eRuntimeError, "no such mouse event");
-};
-
-#define GetMOUSE(obj, data) {\
-    Data_Get_Struct(obj, struct mousedata, data);\
-    if (data->mevent == 0) no_mevent();\
-}
-
-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 */
-
-/*-------------------------- class Window --------------------------*/
-
-/* def new(h, w, top, left) */
-static VALUE
-window_s_new(class, h, w, top, left)
-    VALUE class;
-    VALUE h;
-    VALUE w;
-    VALUE top;
-    VALUE left;
-{
-    VALUE win;
-    WINDOW *window;
-    VALUE args[4];
-    
-    window = newwin(NUM2INT(h), NUM2INT(w), NUM2INT(top), NUM2INT(left));
-    wclear(window);
-    win = prep_window(class, window);
-    args[0] = h; args[1] = w; args[2] = top; args[3] = left;
-
-    return win;
-}
-
-/* def subwin(h, w, top, left) */
-static VALUE
-window_subwin(obj, h, w, top, left)
-    VALUE obj;
-    VALUE h;
-    VALUE w;
-    VALUE top;
-    VALUE left;
-{
-    struct windata *winp;
-    WINDOW *window;
-    VALUE win;
-    VALUE args[4];
-
-    GetWINDOW(obj, winp);
-    window = subwin(winp->window, NUM2INT(h), NUM2INT(w),
-		                  NUM2INT(top), NUM2INT(left));
-    win = prep_window(cWindow, window);
-    args[0] = h; args[1] = w; args[2] = top; args[3] = left;
-
-    return win;
-}
-
-/* def close */
-static VALUE
-window_close(obj)
-    VALUE obj;
-{
-    struct windata *winp;
-    
-    GetWINDOW(obj, winp);
-    delwin(winp->window);
-    winp->window = 0;
-
-    return Qnil;
-}
-
-/* def clear */
-static VALUE
-window_clear(obj)
-    VALUE obj;
-{
-    struct windata *winp;
-    
-    GetWINDOW(obj, winp);
-    wclear(winp->window);
-    
-    return Qnil;
-}
-
-/* def refresh */
-static VALUE
-window_refresh(obj)
-    VALUE obj;
-{
-    struct windata *winp;
-    
-    GetWINDOW(obj, winp);
-    wrefresh(winp->window);
-    
-    return Qnil;
-}
-
-/* def noutrefresh */
-static VALUE
-window_noutrefresh(obj)
-    VALUE obj;
-{
-    struct windata *winp;
-
-    GetWINDOW(obj, winp);
-#ifdef HAVE_DOUPDATE
-    wnoutrefresh(winp->window);
-#else
-    wrefresh(winp->window);
-#endif
-
-    return Qnil;
-}
-
-/* def move(y, x) */
-static VALUE
-window_move(obj, y, x)
-    VALUE obj;
-    VALUE y;
-    VALUE x;
-{
-    struct windata *winp;
-    
-    GetWINDOW(obj, winp);
-    mvwin(winp->window, NUM2INT(y), NUM2INT(x));
-
-    return Qnil;
-}
-
-/* def setpos(y, x) */
-static VALUE
-window_setpos(obj, y, x)
-    VALUE obj;
-    VALUE y;
-    VALUE x;
-{
-    struct windata *winp;
-    
-    GetWINDOW(obj, winp);
-    wmove(winp->window, NUM2INT(y), NUM2INT(x));
-    return Qnil;
-}
-
-/* def cury */
-static VALUE
-window_cury(obj)
-    VALUE obj;
-{
-    struct windata *winp;
-    int x, y;
-
-    GetWINDOW(obj, winp);
-    getyx(winp->window, y, x);
-    return INT2FIX(y);
-}
-
-/* def curx */
-static VALUE
-window_curx(obj)
-    VALUE obj;
-{
-    struct windata *winp;
-    int x, y;
-
-    GetWINDOW(obj, winp);
-    getyx(winp->window, y, x);
-    return INT2FIX(x);
-}
-
-/* def maxy */
-static VALUE
-window_maxy(obj)
-    VALUE obj;
-{
-    struct windata *winp;
-    int x, y;
-
-    GetWINDOW(obj, winp);
-#ifdef getmaxy
-    return INT2FIX(getmaxy(winp->window));
-#else
-#ifdef getmaxyx
-    getmaxyx(winp->window, y, x);
-    return INT2FIX(y);
-#else
-    return INT2FIX(winp->window->_maxy+1);
-#endif
-#endif
-}
-
-/* def maxx */
-static VALUE
-window_maxx(obj)
-    VALUE obj;
-{
-    struct windata *winp;
-    int x, y;
-
-    GetWINDOW(obj, winp);
-#ifdef getmaxx
-    return INT2FIX(getmaxx(winp->window));
-#else
-#ifdef getmaxyx
-    getmaxyx(winp->window, y, x);
-    return INT2FIX(x);
-#else
-    return INT2FIX(winp->window->_maxx+1);
-#endif
-#endif
-}
-
-/* def begy */
-static VALUE
-window_begy(obj)
-    VALUE obj;
-{
-    struct windata *winp;
-    int x, y;
-
-    GetWINDOW(obj, winp);
-#ifdef getbegyx
-    getbegyx(winp->window, y, x);
-    return INT2FIX(y);
-#else
-    return INT2FIX(winp->window->_begy);
-#endif
-}
-
-/* def begx */
-static VALUE
-window_begx(obj)
-    VALUE obj;
-{
-    struct windata *winp;
-    int x, y;
-
-    GetWINDOW(obj, winp);
-#ifdef getbegyx
-    getbegyx(winp->window, y, x);
-    return INT2FIX(x);
-#else
-    return INT2FIX(winp->window->_begx);
-#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( argc == 3 ){
-      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)
-    VALUE obj;
-{
-    struct windata *winp;
-    
-    GetWINDOW(obj, winp);
-    wstandout(winp->window);
-    return Qnil;
-}
-
-/* def standend */
-static VALUE
-window_standend(obj)
-    VALUE obj;
-{
-    struct windata *winp;
-    
-    GetWINDOW(obj, winp);
-    wstandend(winp->window);
-    return Qnil;
-}
-
-/* def inch */
-static VALUE
-window_inch(obj)
-    VALUE obj;
-{
-    struct windata *winp;
-    
-    GetWINDOW(obj, winp);
-    return CHR2FIX(winch(winp->window));
-}
-
-/* def addch(ch) */
-static VALUE
-window_addch(obj, ch)
-    VALUE obj;
-    VALUE ch;
-{
-    struct windata *winp;
-    
-    GetWINDOW(obj, winp);
-    waddch(winp->window, NUM2CHR(ch));
-    
-    return Qnil;
-}
-
-/* def insch(ch) */
-static VALUE
-window_insch(obj, ch)
-    VALUE obj;
-    VALUE ch;
-{
-    struct windata *winp;
-    
-    GetWINDOW(obj, winp);
-    winsch(winp->window, NUM2CHR(ch));
-    
-    return Qnil;
-}
-
-/* def addstr(str) */
-static VALUE
-window_addstr(obj, str)
-    VALUE obj;
-    VALUE str;
-{
-    if (!NIL_P(str)) {
-	struct windata *winp;
-
-	GetWINDOW(obj, winp);
-	waddstr(winp->window, STR2CSTR(str));
-    }
-    return Qnil;
-}
-
-/* def <<(str) */
-static VALUE
-window_addstr2(obj, str)
-    VALUE obj;
-    VALUE str;
-{
-    window_addstr(obj, str);
-    return obj;
-}
-
-/* def getch */
-static VALUE
-window_getch(obj)
-    VALUE obj;
-{
-    struct windata *winp;
-    
-    rb_read_check(stdin);
-    GetWINDOW(obj, winp);
-    return UINT2NUM(wgetch(winp->window));
-}
-
-/* def getstr */
-static VALUE
-window_getstr(obj)
-    VALUE obj;
-{
-    struct windata *winp;
-    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);
-#endif
-    return rb_tainted_str_new2(rtn);
-}
-
-/* def delch */
-static VALUE
-window_delch(obj)
-    VALUE obj;
-{
-    struct windata *winp;
-    
-    GetWINDOW(obj, winp);
-    wdelch(winp->window);
-    return Qnil;
-}
-
-/* def delelteln */
-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;
-  int res;
-
-  GetWINDOW(obj, winp);
-  idlok(winp->window, RTEST(bf) ? TRUE : FALSE);
-  return Qnil;
-}
-
-static VALUE
-window_setscrreg(VALUE obj, VALUE top, VALUE bottom)
-{
-  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;
-};
-
-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)
-{
-  struct windata *winp;
-
-  GetWINDOW(obj, winp);
-  /* may have to raise exception on ERR */
-  return (wscrl(winp->window,NUM2INT(n)) == OK) ? Qtrue : Qfalse;
-}
-
-static VALUE
-window_attroff(VALUE obj, VALUE attrs)
-{
-  struct windata *winp;
-
-  GetWINDOW(obj,winp);
-  return INT2FIX(wattroff(winp->window,NUM2INT(attrs)));
-};
-
-static VALUE
-window_attron(VALUE obj, VALUE attrs)
-{
-  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;
-  };
-};
-
-static VALUE
-window_attrset(VALUE obj, VALUE attrs)
-{
-  struct windata *winp;
-
-  GetWINDOW(obj,winp);
-  return INT2FIX(wattrset(winp->window,NUM2INT(attrs)));
-}
-
-static VALUE
-window_bkgdset(VALUE obj, VALUE ch)
-{
-  struct windata *winp;
-
-  GetWINDOW(obj,winp);
-  wbkgdset(winp->window, NUM2CHR(ch));
-  return Qnil;
-}
-
-static VALUE
-window_bkgd(VALUE obj, VALUE ch)
-{
-  struct windata *winp;
-
-  GetWINDOW(obj,winp);
-  return CHR2FIX(wbkgd(winp->window, NUM2CHR(ch)));
-}
-
-static VALUE
-window_getbkgd(VALUE obj)
-{
-  struct windata *winp;
-
-  GetWINDOW(obj,winp);
-  return CHR2FIX(getbkgd(winp->window));
-}
-
-static VALUE
-window_resize(VALUE obj, VALUE lines, VALUE columns)
-{
-#if defined(HAVE_WRESIZE)
-  struct windata *winp;
-
-  GetWINDOW(obj,winp);
-  return wresize(winp->window, NUM2INT(lines), NUM2INT(columns)) == OK ? Qtrue : Qfalse;
-#else
-  return Qnil;
-#endif
-}
-
-
-#ifdef HAVE_KEYPAD
-static VALUE
-window_keypad(VALUE obj, VALUE val)
-{
-  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
-};
-#endif /* HAVE_KEYPAD */
-
-/*------------------------- Initialization -------------------------*/
-void
-Init_curses()
-{
-  mCurses    = rb_define_module("Curses");
-  mKey       = rb_define_module_under(mCurses, "Key");
-
-#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);
-    rb_define_module_function(mCurses, "stdscr", curses_stdscr, 0);
-    rb_define_module_function(mCurses, "refresh", curses_refresh, 0);
-    rb_define_module_function(mCurses, "doupdate", curses_doupdate, 0);
-    rb_define_module_function(mCurses, "clear", curses_clear, 0);
-    rb_define_module_function(mCurses, "echo", curses_echo, 0);
-    rb_define_module_function(mCurses, "noecho", curses_noecho, 0);
-    rb_define_module_function(mCurses, "raw", curses_raw, 0);
-    rb_define_module_function(mCurses, "noraw", curses_noraw, 0);
-    rb_define_module_function(mCurses, "cbreak", curses_cbreak, 0);
-    rb_define_module_function(mCurses, "nocbreak", curses_nocbreak, 0);
-    rb_define_alias(mCurses, "crmode", "cbreak");
-    rb_define_alias(mCurses, "nocrmode", "nocbreak");
-    rb_define_module_function(mCurses, "nl", curses_nl, 0);
-    rb_define_module_function(mCurses, "nonl", curses_nonl, 0);
-    rb_define_module_function(mCurses, "beep", curses_beep, 0);
-    rb_define_module_function(mCurses, "flash", curses_flash, 0);
-    rb_define_module_function(mCurses, "ungetch", curses_ungetch, 1);
-    rb_define_module_function(mCurses, "setpos", curses_setpos, 2);
-    rb_define_module_function(mCurses, "standout", curses_standout, 0);
-    rb_define_module_function(mCurses, "standend", curses_standend, 0);
-    rb_define_module_function(mCurses, "inch", curses_inch, 0);
-    rb_define_module_function(mCurses, "addch", curses_addch, 1);
-    rb_define_module_function(mCurses, "insch", curses_insch, 1);
-    rb_define_module_function(mCurses, "addstr", curses_addstr, 1);
-    rb_define_module_function(mCurses, "getch", curses_getch, 0);
-    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);
-    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_getmouse, 1);
-    rb_define_module_function(mCurses, "mouseinterval", curses_mouseinterval, 1);
-    rb_define_module_function(mCurses, "mousemask", curses_mousemask, 1);
-#endif /* USE_MOUSE */
-
-    cWindow = rb_define_class_under(mCurses, "Window", rb_cObject);
-    rb_define_singleton_method(cWindow, "new", window_s_new, 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, "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);
-    rb_define_method(cWindow, "curx", window_curx, 0);
-    rb_define_method(cWindow, "maxy", window_maxy, 0);
-    rb_define_method(cWindow, "maxx", window_maxx, 0);
-    rb_define_method(cWindow, "begy", window_begy, 0);
-    rb_define_method(cWindow, "begx", window_begx, 0);
-    rb_define_method(cWindow, "standout", window_standout, 0);
-    rb_define_method(cWindow, "standend", window_standend, 0);
-    rb_define_method(cWindow, "inch", window_inch, 0);
-    rb_define_method(cWindow, "addch", window_addch, 1);
-    rb_define_method(cWindow, "insch", window_insch, 1);
-    rb_define_method(cWindow, "addstr", window_addstr, 1);
-    rb_define_method(cWindow, "<<", window_addstr2, 1);
-    rb_define_method(cWindow, "getch", window_getch, 0);
-    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);
-#ifdef HAVE_KEYPAD
-    rb_define_method(cWindow, "keypad", window_keypad, 1);
-    rb_define_method(cWindow, "keypad=", window_keypad, 1);
-#endif
-#ifdef USE_COLOR
-    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);
-#endif /* USE_COLOR */
-
-
-#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
deleted file mode 100644
index ecb79e512d..0000000000
--- a/ext/curses/depend
+++ /dev/null
@@ -1 +0,0 @@
-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
deleted file mode 100644
index 94443b45e6..0000000000
--- a/ext/curses/extconf.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-require 'mkmf'
-
-dir_config('curses')
-dir_config('ncurses')
-dir_config('termcap')
-
-make=false
-have_library("mytinfo", "tgetent") if /bow/ =~ RUBY_PLATFORM
-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
-elsif have_header("curses_colr/curses.h") and have_library("cur_colr", "initscr")
-  make=true
-else
-  have_library("termcap", "tgetent") 
-  if have_header("curses.h") and have_library("curses", "initscr")
-    make=true
-  end
-end
-
-if make
-  for f in %w(isendwin ungetch beep getnstr wgetnstr doupdate flash deleteln wdeleteln keypad keyname init_color wresize resizeterm)
-    have_func(f)
-  end
-  create_makefile("curses")
-end
diff --git a/ext/curses/hello.rb b/ext/curses/hello.rb
deleted file mode 100644
index 7f57d801a3..0000000000
--- a/ext/curses/hello.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/local/bin/ruby
-
-require "curses"
-include Curses
-
-def show_message(message)
-  width = message.length + 6
-  win = Window.new(5, width,
-		   (lines - 5) / 2, (cols - width) / 2)
-  win.box(?|, ?-)
-  win.setpos(2, 3)
-  win.addstr(message)
-  win.refresh
-  win.getch
-  win.close
-end
-
-init_screen
-begin
-  crmode
-#  show_message("Hit any key")
-  setpos((lines - 5) / 2, (cols - 10) / 2)
-  addstr("Hit any key")
-  refresh
-  getch
-  show_message("Hello, World!")
-  refresh
-ensure
-  close_screen
-end
diff --git a/ext/curses/mouse.rb b/ext/curses/mouse.rb
deleted file mode 100644
index c42bc31f33..0000000000
--- a/ext/curses/mouse.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/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/rain.rb b/ext/curses/rain.rb
deleted file mode 100644
index 36f0f84de2..0000000000
--- a/ext/curses/rain.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/local/bin/ruby
-# rain for a curses test
-
-require "curses"
-include Curses
-
-def onsig(sig)
-  close_screen
-  exit sig
-end
-
-def ranf
-  rand(32767).to_f / 32767
-end
-
-# main #
-for i in 1 .. 15  # SIGHUP .. SIGTERM
-  if trap(i, "SIG_IGN") != 0 then  # 0 for SIG_IGN
-    trap(i) {|sig| onsig(sig) }
-  end
-end
-
-init_screen
-nl
-noecho
-srand
-
-xpos = {}
-ypos = {}
-r = lines - 4
-c = cols - 4
-for i in 0 .. 4
-  xpos[i] = (c * ranf).to_i + 2
-  ypos[i] = (r * ranf).to_i + 2
-end
-
-i = 0
-while TRUE
-  x = (c * ranf).to_i + 2
-  y = (r * ranf).to_i + 2
-
-
-  setpos(y, x); addstr(".")
-
-  setpos(ypos[i], xpos[i]); addstr("o")
-
-  i = if i == 0 then 4 else i - 1 end
-  setpos(ypos[i], xpos[i]); addstr("O")
-
-  i = if i == 0 then 4 else i - 1 end
-  setpos(ypos[i] - 1, xpos[i]);      addstr("-")
-  setpos(ypos[i],     xpos[i] - 1); addstr("|.|")
-  setpos(ypos[i] + 1, xpos[i]);      addstr("-")
-
-  i = if i == 0 then 4 else i - 1 end
-  setpos(ypos[i] - 2, xpos[i]);       addstr("-")
-  setpos(ypos[i] - 1, xpos[i] - 1);  addstr("/ \\")
-  setpos(ypos[i],     xpos[i] - 2); addstr("| O |")
-  setpos(ypos[i] + 1, xpos[i] - 1); addstr("\\ /")
-  setpos(ypos[i] + 2, xpos[i]);       addstr("-")
-
-  i = if i == 0 then 4 else i - 1 end
-  setpos(ypos[i] - 2, xpos[i]);       addstr(" ")
-  setpos(ypos[i] - 1, xpos[i] - 1);  addstr("   ")
-  setpos(ypos[i],     xpos[i] - 2); addstr("     ")
-  setpos(ypos[i] + 1, xpos[i] - 1);  addstr("   ")
-  setpos(ypos[i] + 2, xpos[i]);       addstr(" ")
-
-
-  xpos[i] = x
-  ypos[i] = y
-  refresh
-  sleep(0.5)
-end
-
-# end of main
diff --git a/ext/curses/view.rb b/ext/curses/view.rb
deleted file mode 100644
index 5ba1a8413c..0000000000
--- a/ext/curses/view.rb
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/local/bin/ruby
-
-require "curses"
-include Curses
-
-#
-# main
-#
-
-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)
-
-init_screen
-#keypad(stdscr, TRUE)
-nonl
-cbreak
-noecho
-#scrollok(stdscr, TRUE)
-
-# slurp the file
-data_lines = []
-fp.each_line { |l|
-  data_lines.push(l)
-}
-fp.close
-
-
-lptr = 0
-while TRUE
-  i = 0
-  while i < lines
-    setpos(i, 0)
-    #clrtoeol
-    addstr(data_lines[lptr + i]) #if data_lines[lptr + i]
-    i += 1
-  end
-  refresh
-
-  explicit = FALSE
-  n = 0
-  while TRUE
-    c = getch.chr
-    if c =~ "[0-9]" then
-      n = 10 * n + c.to_i
-    else
-      break
-    end
-  end
-
-  n = 1 if !explicit && n == 0
-
-  case c
-  when "n"  #when KEY_DOWN
-    i = 0
-    while i < n
-      if lptr + lines < data_lines.size then
-	lptr += 1
-      else
-	break
-      end
-      i += 1 
-    end
-    #wscrl(i)
-      
-  when "p"  #when KEY_UP
-    i = 0
-    while i < n
-      if lptr > 0 then
-	lptr -= 1
-      else
-	break
-      end
-      i += 1 
-    end    
-    #wscrl(-i)
-
-  when "q"
-    break
-  end
-
-end
-close_screen
diff --git a/ext/curses/view2.rb b/ext/curses/view2.rb
deleted file mode 100644
index 18d9619216..0000000000
--- a/ext/curses/view2.rb
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/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/dbm/.cvsignore b/ext/dbm/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/dbm/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
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
deleted file mode 100644
index f81f7efcb1..0000000000
--- a/ext/dbm/dbm.c
+++ /dev/null
@@ -1,764 +0,0 @@
-/************************************************
-
-  dbm.c -
-
-  $Author$
-  $Date$
-  created at: Mon Jan 24 15:59:52 JST 1994
-
-  Copyright (C) 1995-2001 Yukihiro Matsumoto
-
-************************************************/
-
-#include "ruby.h"
-
-#ifdef HAVE_CDEFS_H
-# include 
-#endif
-#ifdef HAVE_SYS_CDEFS_H
-# include 
-#endif
-#include DBM_HDR
-#include 
-#include 
-
-static VALUE rb_cDBM, rb_eDBMError;
-
-struct dbmdata {
-    int  di_size;
-    DBM *di_dbm;
-};
-
-static void
-closed_dbm()
-{
-    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();\
-}
-
-static void
-free_dbm(dbmp)
-    struct dbmdata *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_s_new(argc, argv, klass)
-    int argc;
-    VALUE *argv;
-    VALUE klass;
-{
-    VALUE obj = Data_Wrap_Struct(klass, 0, free_dbm, 0);
-    rb_obj_call_init(obj, argc, argv);
-    return obj;
-}
-
-static VALUE
-fdbm_initialize(argc, argv, obj)
-    int argc;
-    VALUE *argv;
-    VALUE obj;
-{
-    VALUE file, vmode;
-    DBM *dbm;
-    struct dbmdata *dbmp;
-    int mode;
-
-    if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
-	mode = 0666;		/* default value */
-    }
-    else if (NIL_P(vmode)) {
-	mode = -1;		/* return nil if DB not exist */
-    }
-    else {
-	mode = NUM2INT(vmode);
-    }
-    SafeStringValue(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, 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);
-    }
-
-    dbmp = ALLOC(struct dbmdata);
-    DATA_PTR(obj) = dbmp;
-    dbmp->di_dbm = dbm;
-    dbmp->di_size = -1;
-
-    return obj;
-}
-
-static VALUE
-fdbm_s_open(argc, argv, klass)
-    int argc;
-    VALUE *argv;
-    VALUE klass;
-{
-    VALUE obj = Data_Wrap_Struct(klass, 0, free_dbm, 0);
-
-    if (NIL_P(fdbm_initialize(argc, argv, obj))) {
-	return Qnil;
-    }
-
-    if (rb_block_given_p()) {
-        return rb_ensure(rb_yield, obj, fdbm_close, obj);
-    }
-
-    return obj;
-}
-
-static VALUE
-fdbm_fetch(obj, keystr, ifnone)
-    VALUE obj, keystr, ifnone;
-{
-    datum key, value;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-
-    StringValue(keystr);
-    key.dptr = RSTRING(keystr)->ptr;
-    key.dsize = RSTRING(keystr)->len;
-
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-    value = dbm_fetch(dbm, key);
-    if (value.dptr == 0) {
-	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 Qnil;
-}
-
-static VALUE
-fdbm_indexes(argc, argv, obj)
-    int argc;
-    VALUE *argv;
-    VALUE obj;
-{
-    VALUE new;
-    int i;
-
-    new = rb_ary_new2(argc);
-    for (i=0; i 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 {
-        for (i=0; iptr;
-    key.dsize = RSTRING(keystr)->len;
-
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-
-    value = dbm_fetch(dbm, key);
-    if (value.dptr == 0) {
-	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;
-	rb_raise(rb_eDBMError, "dbm_delete failed");
-    }
-    else if (dbmp->di_size >= 0) {
-	dbmp->di_size--;
-    }
-    return valstr;
-}
-
-static VALUE
-fdbm_shift(obj)
-    VALUE obj;
-{
-    datum key, val;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-    VALUE keystr, valstr;
-
-    rb_secure(4);
-    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);
-
-    return rb_assoc_new(keystr, valstr);
-}
-
-static VALUE
-fdbm_delete_if(obj)
-    VALUE obj;
-{
-    datum key, val;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-    VALUE keystr, valstr;
-    VALUE ret, ary = rb_ary_new();
-    int i, status = 0, n;
-
-    rb_secure(4);
-    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 = 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];
-	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;
-}
-
-static VALUE
-fdbm_clear(obj)
-    VALUE obj;
-{
-    datum key;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-
-    rb_secure(4);
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-    dbmp->di_size = -1;
-    while (key = dbm_firstkey(dbm), key.dptr) {
-	if (dbm_delete(dbm, key)) {
-	    rb_raise(rb_eDBMError, "dbm_delete failed");
-	}
-    }
-    dbmp->di_size = 0;
-
-    return obj;
-}
-
-static VALUE
-fdbm_invert(obj)
-    VALUE obj;
-{
-    datum key, val;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-    VALUE keystr, valstr;
-    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 = rb_tainted_str_new(key.dptr, key.dsize);
-	valstr = rb_tainted_str_new(val.dptr, val.dsize);
-	rb_hash_aset(hash, valstr, keystr);
-    }
-    return hash;
-}
-
-static VALUE
-each_pair(obj)
-    VALUE obj;
-{
-    return rb_funcall(obj, rb_intern("each_pair"), 0, 0);
-}
-
-static VALUE fdbm_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]");
-    }
-    fdbm_store(dbm, RARRAY(pair)->ptr[0], RARRAY(pair)->ptr[1]);
-    return Qnil;
-}
-
-static VALUE
-fdbm_update(obj, other)
-    VALUE obj, other;
-{
-    rb_iterate(each_pair, other, update_i, obj);
-    return obj;
-}
-
-static VALUE
-fdbm_replace(obj, other)
-    VALUE obj, other;
-{
-    fdbm_clear(obj);
-    rb_iterate(each_pair, other, update_i, obj);
-    return obj;
-}
-
-static VALUE
-fdbm_store(obj, keystr, valstr)
-    VALUE obj, keystr, valstr;
-{
-    datum key, val;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-
-    rb_secure(4);
-    keystr = rb_obj_as_string(keystr);
-
-    key.dptr = RSTRING(keystr)->ptr;
-    key.dsize = RSTRING(keystr)->len;
-
-    valstr = rb_obj_as_string(valstr);
-    val.dptr = RSTRING(valstr)->ptr;
-    val.dsize = RSTRING(valstr)->len;
-
-    GetDBM(obj, dbmp);
-    dbmp->di_size = -1;
-    dbm = dbmp->di_dbm;
-    if (dbm_store(dbm, key, val, DBM_REPLACE)) {
-#ifdef HAVE_DBM_CLEARERR
-	dbm_clearerr(dbm);
-#endif
-	if (errno == EPERM) rb_sys_fail(0);
-	rb_raise(rb_eDBMError, "dbm_store failed");
-    }
-
-    return valstr;
-}
-
-static VALUE
-fdbm_length(obj)
-    VALUE obj;
-{
-    datum key;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-    int i = 0;
-
-    GetDBM(obj, dbmp);
-    if (dbmp->di_size > 0) return INT2FIX(dbmp->di_size);
-    dbm = dbmp->di_dbm;
-
-    for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
-	i++;
-    }
-    dbmp->di_size = i;
-
-    return INT2FIX(i);
-}
-
-static VALUE
-fdbm_empty_p(obj)
-    VALUE obj;
-{
-    datum key;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-    int i = 0;
-
-    GetDBM(obj, dbmp);
-    if (dbmp->di_size < 0) {
-	dbm = dbmp->di_dbm;
-
-	for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
-	    i++;
-	}
-    }
-    else {
-	i = dbmp->di_size;
-    }
-    if (i == 0) return Qtrue;
-    return Qfalse;
-}
-
-static VALUE
-fdbm_each_value(obj)
-    VALUE obj;
-{
-    datum key, val;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-    for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
-	val = dbm_fetch(dbm, key);
-	rb_yield(rb_tainted_str_new(val.dptr, val.dsize));
-    }
-    return obj;
-}
-
-static VALUE
-fdbm_each_key(obj)
-    VALUE obj;
-{
-    datum key;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-    for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
-	rb_yield(rb_tainted_str_new(key.dptr, key.dsize));
-    }
-    return obj;
-}
-
-static VALUE
-fdbm_each_pair(obj)
-    VALUE obj;
-{
-    datum key, val;
-    DBM *dbm;
-    struct dbmdata *dbmp;
-    VALUE keystr, valstr;
-
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-
-    for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
-	val = dbm_fetch(dbm, key);
-	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;
-}
-
-static VALUE
-fdbm_keys(obj)
-    VALUE obj;
-{
-    datum key;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-    VALUE ary;
-
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-
-    ary = rb_ary_new();
-    for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
-	rb_ary_push(ary, rb_tainted_str_new(key.dptr, key.dsize));
-    }
-
-    return ary;
-}
-
-static VALUE
-fdbm_values(obj)
-    VALUE obj;
-{
-    datum key, val;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-    VALUE ary;
-
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-
-    ary = rb_ary_new();
-    for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
-	val = dbm_fetch(dbm, key);
-	rb_ary_push(ary, rb_tainted_str_new(val.dptr, val.dsize));
-    }
-
-    return ary;
-}
-
-static VALUE
-fdbm_has_key(obj, keystr)
-    VALUE obj, keystr;
-{
-    datum key, val;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-
-    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 Qtrue;
-    return Qfalse;
-}
-
-static VALUE
-fdbm_has_value(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 Qtrue;
-    }
-    return Qfalse;
-}
-
-static VALUE
-fdbm_to_a(obj)
-    VALUE obj;
-{
-    datum key, val;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-    VALUE ary;
-
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-
-    ary = rb_ary_new();
-    for (key = dbm_firstkey(dbm); key.dptr; key = dbm_nextkey(dbm)) {
-	val = dbm_fetch(dbm, key);
-	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()
-{
-    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_singleton_method(rb_cDBM, "new", fdbm_s_new, -1);
-    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, -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);
-}
diff --git a/ext/dbm/depend b/ext/dbm/depend
deleted file mode 100644
index 5fae80b096..0000000000
--- a/ext/dbm/depend
+++ /dev/null
@@ -1 +0,0 @@
-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
deleted file mode 100644
index 51b1bfd81b..0000000000
--- a/ext/dbm/extconf.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-require 'mkmf'
-
-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"],
-}
-
-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
-  end
-
-  if have_func(db_prefix("dbm_open")) || have_library(db, db_prefix("dbm_open"))
-    for hdr in $dbm_conf_headers.fetch(db, ["ndbm.h"])
-      if have_header(hdr.dup)
-	$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)
-    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
deleted file mode 100644
index 0be627d346..0000000000
--- a/ext/dbm/testdbm.rb
+++ /dev/null
@@ -1,590 +0,0 @@
-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", 0400) {|dbm|
-      dbm['foo'] = 'FOO'
-    }
-    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) {
-	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) {
-      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_select
-    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.select(*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
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/digest/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/digest/MANIFEST b/ext/digest/MANIFEST
deleted file mode 100644
index fd26581c63..0000000000
--- a/ext/digest/MANIFEST
+++ /dev/null
@@ -1,39 +0,0 @@
-MANIFEST
-defs.h
-digest.c
-digest.h
-digest.txt
-digest.txt.ja
-extconf.rb
-lib/md5.rb
-lib/sha1.rb
-md5/MANIFEST
-md5/extconf.rb
-md5/md5.c
-md5/md5.h
-md5/md5init.c
-md5/depend
-rmd160/MANIFEST
-rmd160/extconf.rb
-rmd160/rmd160.c
-rmd160/rmd160.h
-rmd160/rmd160hl.c
-rmd160/rmd160init.c
-rmd160/depend
-sha1/MANIFEST
-sha1/extconf.rb
-sha1/sha1.c
-sha1/sha1.h
-sha1/sha1hl.c
-sha1/sha1init.c
-sha1/depend
-sha2/MANIFEST
-sha2/extconf.rb
-sha2/sha2.c
-sha2/sha2.h
-sha2/sha2hl.c
-sha2/sha2init.c
-sha2/depend
-test.rb
-test.sh
-depend
diff --git a/ext/digest/defs.h b/ext/digest/defs.h
deleted file mode 100644
index 8e44cf6fa2..0000000000
--- a/ext/digest/defs.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- C -*-
- * $Id$
- */
-
-#ifndef DEFS_H
-#define DEFS_H
-
-#include "ruby.h"
-#include 
-
-#if defined(HAVE_SYS_CDEFS_H)
-# include 
-#endif
-#if !defined(__BEGIN_DECLS)
-# define __BEGIN_DECLS
-# define __END_DECLS
-#endif
-
-#if defined(HAVE_INTTYPES_H)
-# include 
-#else
-  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
deleted file mode 100644
index 43601a208f..0000000000
--- a/ext/digest/depend
+++ /dev/null
@@ -1,2 +0,0 @@
-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
deleted file mode 100644
index 3d47685aac..0000000000
--- a/ext/digest/digest.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/************************************************
-
-  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(class)
-    VALUE class;
-{
-    VALUE obj;
-    algo_t *algo;
-
-    if (rb_cvar_defined(class, id_metadata) == Qfalse)
-	rb_notimplement();
-
-    obj = rb_cvar_get(class, id_metadata);
-
-    Data_Get_Struct(obj, algo_t, algo);
-
-    return algo;
-}
-	
-static VALUE
-rb_digest_base_s_new(argc, argv, class)
-    int argc;
-    VALUE* argv;
-    VALUE class;
-{
-    algo_t *algo;
-    VALUE obj;
-    void *pctx;
-
-    if (class == cDigest_Base)
-	rb_raise(rb_eNotImpError, "Digest::Base is an abstract class");
-
-    algo = get_digest_base_metadata(class);
-
-    pctx = xmalloc(algo->ctx_size);
-    algo->init_func(pctx);
-
-    obj = Data_Wrap_Struct(class, 0, free, pctx);
-
-    rb_obj_call_init(obj, argc, argv);
-
-    return obj;
-}
-
-static VALUE
-rb_digest_base_s_digest(class, str)
-    VALUE class;
-    VALUE str;
-{
-    algo_t *algo;
-    void *pctx;
-    size_t len;
-    unsigned char *digest;
-    VALUE obj;
-
-    if (class == cDigest_Base)
-	rb_raise(rb_eNotImpError, "Digest::Base is an abstract class");
-
-#ifdef StringValue
-    StringValue(str);
-#else
-    Check_Type(str, T_STRING);
-#endif
-
-    algo = get_digest_base_metadata(class);
-
-    pctx = xmalloc(algo->ctx_size);
-    algo->init_func(pctx);
-    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);
-    free(pctx);
-
-    return obj;
-}
-
-static VALUE
-rb_digest_base_s_hexdigest(class, str)
-    VALUE class;
-    VALUE str;
-{
-    algo_t *algo;
-    void *pctx;
-    size_t len;
-    unsigned char *hexdigest;
-    VALUE obj;
-
-    if (class == cDigest_Base)
-	rb_raise(rb_eNotImpError, "Digest::Base is an abstract class");
-
-#ifdef StringValue
-    StringValue(str);
-#else
-    Check_Type(str, T_STRING);
-#endif
-
-    algo = get_digest_base_metadata(class);
-
-    pctx = xmalloc(algo->ctx_size);
-    algo->init_func(pctx);
-    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);
-    free(pctx);
-
-    return obj;
-}
-
-static VALUE
-rb_digest_base_clone(self)
-    VALUE self;
-{
-    algo_t *algo;
-    void *pctx1, *pctx2;
-    VALUE class;
-
-    class = CLASS_OF(self);
-    algo = get_digest_base_metadata(class);
-    Data_Get_Struct(self, void, pctx1);
-
-    pctx2 = xmalloc(algo->ctx_size);
-    memcpy(pctx2, pctx1, algo->ctx_size);
-
-    return Data_Wrap_Struct(class, 0, free, pctx2);
-}
-
-static VALUE
-rb_digest_base_update(self, str)
-    VALUE self, str;
-{
-    algo_t *algo;
-    void *pctx;
-
-#ifdef StringValue
-    StringValue(str);
-#else
-    Check_Type(str, T_STRING);
-#endif
-
-    algo = get_digest_base_metadata(CLASS_OF(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(CLASS_OF(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(CLASS_OF(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 class;
-    VALUE str1, str2;
-
-    class = CLASS_OF(self);
-    algo = get_digest_base_metadata(class);
-
-    if (CLASS_OF(other) == class) {
-	void *pctx1, *pctx2;
-
-	Data_Get_Struct(self, void, pctx1);
-	Data_Get_Struct(other, void, pctx2);
-
-	return algo->equal_func(pctx1, pctx2) ? Qtrue : Qfalse;
-    }
-
-#ifdef StringValue
-    StringValue(other);
-#else
-    Check_Type(other, T_STRING);
-#endif
-    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_singleton_method(cDigest_Base, "new", rb_digest_base_s_new, -1);
-    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, "clone",  rb_digest_base_clone, 0);
-    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
deleted file mode 100644
index 5e846df040..0000000000
--- a/ext/digest/digest.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/************************************************
-
-  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
deleted file mode 100644
index 5797dd18f9..0000000000
--- a/ext/digest/digest.txt
+++ /dev/null
@@ -1,113 +0,0 @@
-.\" 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
deleted file mode 100644
index 8997d25b9d..0000000000
--- a/ext/digest/digest.txt.ja
+++ /dev/null
@@ -1,111 +0,0 @@
-.\" 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(クラス)
-
-RFC1321に記述されているRSA Data Security, Inc. の MD5 Message-Digest
-Algorithmを実装するクラス。
-
-Superclass: Digest::Base
-
-require 'digest/md5'
-
-** SHA1(クラス)
-
-FIPS PUB 180-1に記述されているNIST (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-2に記述されているNIST (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では
-        16バイト長、SHA1およびRMD160では20バイト長、SHA256では32バイト長、
-	SHA384では48バイト長、SHA512では64バイト長となる。
-
-   hexdigest
-   to_s
-
-        今までに追加した文字列に対するハッシュ値を、ASCIIコードを使って
-        16進数の列を示す文字列にエンコードして返す。MD5では32バイト長、
-        SHA1およびRMD160では40バイト長、SHA256では64バイト長、SHA384では
-	96バイト長、SHA512では128バイト長となる。Rubyで書くと以下と同じ。
-
-	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
deleted file mode 100644
index cd512622a4..0000000000
--- a/ext/digest/extconf.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-# $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
deleted file mode 100644
index 1d05d7d04e..0000000000
--- a/ext/digest/lib/md5.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# 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
deleted file mode 100644
index c4ac6f66ea..0000000000
--- a/ext/digest/lib/sha1.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# 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
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/digest/md5/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/digest/md5/MANIFEST b/ext/digest/md5/MANIFEST
deleted file mode 100644
index 923af92ed2..0000000000
--- a/ext/digest/md5/MANIFEST
+++ /dev/null
@@ -1,5 +0,0 @@
-extconf.rb
-md5.c
-md5.h
-md5init.c
-depend
diff --git a/ext/digest/md5/depend b/ext/digest/md5/depend
deleted file mode 100644
index 30ad482101..0000000000
--- a/ext/digest/md5/depend
+++ /dev/null
@@ -1,5 +0,0 @@
-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
diff --git a/ext/digest/md5/extconf.rb b/ext/digest/md5/extconf.rb
deleted file mode 100644
index 93a14025d0..0000000000
--- a/ext/digest/md5/extconf.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# $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 = [
-  "md5.#{$OBJEXT}",
-  "md5init.#{$OBJEXT}",
-]
-
-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
deleted file mode 100644
index 6b61f031c4..0000000000
--- a/ext/digest/md5/md5.c
+++ /dev/null
@@ -1,432 +0,0 @@
-/*
-  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
-  .  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 
-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 
-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
deleted file mode 100644
index fc41380d38..0000000000
--- a/ext/digest/md5/md5.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-  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
-  .  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 .
-  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
deleted file mode 100644
index 90ab707433..0000000000
--- a/ext/digest/md5/md5init.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* $RoughId: md5init.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
-/* $Id$ */
-
-#include "digest.h"
-#include "md5.h"
-
-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;
-    ID id_metadata;
-
-    rb_require("digest.so");
-
-    mDigest = rb_path2class("Digest");
-    cDigest_Base = rb_path2class("Digest::Base");
-
-    cDigest_MD5 = rb_define_class_under(mDigest, "MD5", cDigest_Base);
-
-    id_metadata = rb_intern("metadata");
-
-    rb_cvar_set(cDigest_MD5, id_metadata,
-		Data_Wrap_Struct(rb_cObject, 0, 0, &md5), Qtrue);
-}
diff --git a/ext/digest/rmd160/.cvsignore b/ext/digest/rmd160/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/digest/rmd160/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/digest/rmd160/MANIFEST b/ext/digest/rmd160/MANIFEST
deleted file mode 100644
index 017976de0d..0000000000
--- a/ext/digest/rmd160/MANIFEST
+++ /dev/null
@@ -1,6 +0,0 @@
-extconf.rb
-rmd160.c
-rmd160.h
-rmd160hl.c
-rmd160init.c
-depend
diff --git a/ext/digest/rmd160/depend b/ext/digest/rmd160/depend
deleted file mode 100644
index 7cf1d5e639..0000000000
--- a/ext/digest/rmd160/depend
+++ /dev/null
@@ -1,7 +0,0 @@
-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
diff --git a/ext/digest/rmd160/extconf.rb b/ext/digest/rmd160/extconf.rb
deleted file mode 100644
index ce53c77b55..0000000000
--- a/ext/digest/rmd160/extconf.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# $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 = [
-  "rmd160.#{$OBJEXT}",
-  "rmd160hl.#{$OBJEXT}",
-  "rmd160init.#{$OBJEXT}",
-]
-
-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
deleted file mode 100644
index 2de3c99b29..0000000000
--- a/ext/digest/rmd160/rmd160.c
+++ /dev/null
@@ -1,464 +0,0 @@
-/*	$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 
-#endif
-
-#ifdef HAVE_MACHINE_ENDIAN_H_
-#include 
-#endif
-
-/* #include "namespace.h" */
-
-#include 
-#include 
-#include 
-#include 
-
-#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
deleted file mode 100644
index 24f9a025f0..0000000000
--- a/ext/digest/rmd160/rmd160.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*	$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
deleted file mode 100644
index 4c5e0217d9..0000000000
--- a/ext/digest/rmd160/rmd160hl.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*	$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):
- *  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 
-#include 
-#include 
-#include 
-#include 
-#if defined(HAVE_UNISTD_H)
-# include 
-#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
deleted file mode 100644
index 6955c2b64b..0000000000
--- a/ext/digest/rmd160/rmd160init.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* $RoughId: rmd160init.c,v 1.3 2001/07/13 20:00:43 knu Exp $ */
-/* $Id$ */
-
-#include "digest.h"
-#include "rmd160.h"
-
-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/sha1/.cvsignore b/ext/digest/sha1/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/digest/sha1/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/digest/sha1/MANIFEST b/ext/digest/sha1/MANIFEST
deleted file mode 100644
index 99b83addfd..0000000000
--- a/ext/digest/sha1/MANIFEST
+++ /dev/null
@@ -1,6 +0,0 @@
-extconf.rb
-sha1.c
-sha1.h
-sha1hl.c
-sha1init.c
-depend
diff --git a/ext/digest/sha1/depend b/ext/digest/sha1/depend
deleted file mode 100644
index 31a5da06cf..0000000000
--- a/ext/digest/sha1/depend
+++ /dev/null
@@ -1,7 +0,0 @@
-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
diff --git a/ext/digest/sha1/extconf.rb b/ext/digest/sha1/extconf.rb
deleted file mode 100644
index 45e374e369..0000000000
--- a/ext/digest/sha1/extconf.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# $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 = [
-  "sha1.#{$OBJEXT}",
-  "sha1hl.#{$OBJEXT}",
-  "sha1init.#{$OBJEXT}",
-]
-
-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
deleted file mode 100644
index 1012ef8751..0000000000
--- a/ext/digest/sha1/sha1.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/*	$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 
- * 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 
-#include 
-#define _DIAGASSERT(x)	(void)0
-#else
-/* #include "namespace.h" */
-#include 
-#include 
-#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
deleted file mode 100644
index 2303cecc2b..0000000000
--- a/ext/digest/sha1/sha1.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*	$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 
- * 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
deleted file mode 100644
index d1a236b22c..0000000000
--- a/ext/digest/sha1/sha1hl.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*	$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):
- *  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 
-
-#include 
-#include 
-#include 
-#include 
-#if defined(HAVE_UNISTD_H)
-# include 
-#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
deleted file mode 100644
index 70bc4f9f52..0000000000
--- a/ext/digest/sha1/sha1init.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* $RoughId: sha1init.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
-/* $Id$ */
-
-#include "digest.h"
-#include "sha1.h"
-
-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/sha2/.cvsignore b/ext/digest/sha2/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/digest/sha2/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/digest/sha2/MANIFEST b/ext/digest/sha2/MANIFEST
deleted file mode 100644
index f117b94771..0000000000
--- a/ext/digest/sha2/MANIFEST
+++ /dev/null
@@ -1,6 +0,0 @@
-extconf.rb
-sha2.c
-sha2.h
-sha2hl.c
-sha2init.c
-depend
diff --git a/ext/digest/sha2/depend b/ext/digest/sha2/depend
deleted file mode 100644
index 2587415fdc..0000000000
--- a/ext/digest/sha2/depend
+++ /dev/null
@@ -1,7 +0,0 @@
-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
deleted file mode 100644
index c982aa64de..0000000000
--- a/ext/digest/sha2/extconf.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# $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(<
- *
- * 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 
-#include 	/* memcpy()/memset() or bcopy()/bzero() */
-#include 	/* assert() */
-#include "sha2.h"
-
-/*
- * 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__)
-#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
deleted file mode 100644
index 4689ad93ce..0000000000
--- a/ext/digest/sha2/sha2.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * sha2.h
- *
- * Version 1.0.0beta1
- *
- * Written by Aaron D. Gifford 
- *
- * 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
deleted file mode 100644
index 03fde538c3..0000000000
--- a/ext/digest/sha2/sha2hl.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/* $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 
- *
- * 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 
-#include 
-#include 
-#include 
-#include 
-#include 
-#if defined(HAVE_UNISTD_H)
-# include 
-#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
deleted file mode 100644
index 4b14031811..0000000000
--- a/ext/digest/sha2/sha2init.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $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.rb b/ext/digest/test.rb
deleted file mode 100644
index 2f29948bb6..0000000000
--- a/ext/digest/test.rb
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/bin/env ruby
-#
-# $RoughId: test.rb,v 1.4 2001/07/13 15:38:27 knu Exp $
-# $Id$
-
-require 'runit/testcase'
-require 'runit/cui/testrunner'
-
-require 'digest/md5'
-require 'digest/rmd160'
-require 'digest/sha1'
-require 'digest/sha2'
-include Digest
-
-class TestDigest < RUNIT::TestCase
-  ALGOS = [
-    MD5,
-    SHA1,
-    SHA256,
-    SHA384,
-    SHA512,
-    RMD160
-  ]
-
-  DATA = {
-    "abc" => {
-      MD5 => "900150983cd24fb0d6963f7d28e17f72",
-      SHA1 => "a9993e364706816aba3e25717850c26c9cd0d89d",
-      SHA256 => "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",
-      SHA384 => "cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7",
-      SHA512 => "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f",
-      RMD160 => "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc"
-    },
-
-    "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" => {
-      MD5 => "8215ef0796a20bcaaae116d3876c664a",
-      SHA1 => "84983e441c3bd26ebaae4aa1f95129e5e54670f1",
-      SHA256 => "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1",
-      SHA384 => "3391fdddfc8dc7393707a65b1b4709397cf8b1d162af05abfe8f450de5f36bc6b0455a8520bc4e6f5fe95b1fe3c8452b",
-      SHA512 => "204a8fc6dda82f0a0ced7beb8e08a41657c16ef468b228a8279be331a703c33596fd15c13b1b07f9aa1d3bea57789ca031ad85c7a71dd70354ec631238ca3445",
-      RMD160 => "12a053384a9c0c88e405a06c27dcf49ada62eb2b"
-    }
-  }
-
-  def test_s_hexdigest
-    ALGOS.each do |algo|
-      DATA.each do |str, table|
-	assert_equal(table[algo], algo.hexdigest(str))
-      end
-    end
-  end
-
-  def test_s_digest
-    ALGOS.each do |algo|
-      DATA.each do |str, table|
-	assert_equal([table[algo]].pack("H*"), algo.digest(str))
-      end
-    end
-  end
-
-  def test_update
-    # This test is also for digest() and hexdigest()
-
-    str = "ABC"
-
-    ALGOS.each do |algo|
-      md = algo.new
-      md.update str
-      assert_equal(algo.hexdigest(str), md.hexdigest)
-      assert_equal(algo.digest(str), md.digest)
-    end
-  end
-
-  def test_eq
-    # This test is also for clone()
-
-    ALGOS.each do |algo|
-      md1 = algo.new("ABC")
-
-      assert_equal(md1, md1.clone)
-
-      md2 = algo.new
-      md2 << "A"
-
-      assert(md1 != md2)
-
-      md2 << "BC"
-
-      assert_equal(md1, md2)
-    end
-  end
-end
-
-if $0 == __FILE__
-  suite = RUNIT::TestSuite.new
-
-  suite.add_test(TestDigest.suite)
-
-  RUNIT::CUI::TestRunner.run(suite)
-end
diff --git a/ext/digest/test.sh b/ext/digest/test.sh
deleted file mode 100644
index 88b34b04c5..0000000000
--- a/ext/digest/test.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/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
-    (cd $algo &&
-	${RUBY} extconf.rb --with-cflags="${CFLAGS}";
-	${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
deleted file mode 100644
index 94a01c4ba7..0000000000
--- a/ext/dl/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-Makefile
-mkmf.log
-dlconfig.h
-dlconfig.rb
-*.func
-*.o
-*~
diff --git a/ext/dl/MANIFEST b/ext/dl/MANIFEST
deleted file mode 100644
index 261b4ad914..0000000000
--- a/ext/dl/MANIFEST
+++ /dev/null
@@ -1,32 +0,0 @@
-.cvsignore
-MANIFEST
-depend
-dl.c
-dl.def
-dl.h
-doc/dl.txt
-extconf.rb
-h2rb
-handle.c
-install.rb
-lib/dl/import.rb
-lib/dl/struct.rb
-lib/dl/types.rb
-lib/dl/win32.rb
-mkcall.rb
-mkcallback.rb
-mkcbtable.rb
-ptr.c
-sample/c++sample.C
-sample/c++sample.rb
-sample/drives.rb
-sample/getch.rb
-sample/libc.rb
-sample/msgbox.rb
-sample/msgbox2.rb
-sample/stream.rb
-sym.c
-test/libtest.def
-test/test.c
-test/test.rb
-type.rb
diff --git a/ext/dl/depend b/ext/dl/depend
deleted file mode 100644
index 7f1c2ecb15..0000000000
--- a/ext/dl/depend
+++ /dev/null
@@ -1,45 +0,0 @@
-CLEANFILES = test/test.o
-DISTCLEANFILES = call.func callback.func cbtable.func dlconfig.rb dlconfig.h \
-                 test/libtest.so test/*~ *~ mkmf.log
-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: call.func
-
-dl.o: callback.func cbtable.func
-
-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
deleted file mode 100644
index 073d8180d2..0000000000
--- a/ext/dl/dl.c
+++ /dev/null
@@ -1,704 +0,0 @@
-/*
- * $Id$
- */
-
-#include 
-#include 
-#include 
-#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; ilen;
-  *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;
-
-  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) ){
-    case T_STRING:
-      {
-	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;
-    default:
-      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;
-
-  if( TYPE(v) != T_ARRAY ){
-    rb_raise(rb_eDLTypeError, "an array is expected.");
-  };
-
-  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");
-  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)
-{
-  return rb_dlhandle_s_new(argc, argv, rb_cDLHandle);
-}
-
-VALUE
-rb_dl_malloc(VALUE self, VALUE size)
-{
-  return rb_dlptr_malloc(DLNUM2LONG(size), dlfree);
-}
-
-VALUE
-rb_dl_strdup(VALUE self, VALUE str)
-{
-  void *p;
-
-  str = rb_String(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];
-
-  proc = Qnil;
-  switch( rb_scan_args(argc, argv, "11", &type, &proc) ){
-  case 1:
-    if( rb_block_given_p() ){
-      proc = rb_f_lambda();
-    }
-    else{
-      proc = Qnil;
-    }
-  default:
-    break;
-  }
-
-  Check_Type(type, T_STRING);
-  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 = rb_dlsym2csym(sym);
-  int i, j;
-
-  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, "VERSION",     rb_tainted_str_new2(DL_VERSION));
-  rb_define_const(rb_mDL, "MAJOR_VERSION", INT2NUM(DL_MAJOR_VERSION));
-  rb_define_const(rb_mDL, "MINOR_VERSION", INT2NUM(DL_MINOR_VERSION));
-  rb_define_const(rb_mDL, "PATCH_VERSION", INT2NUM(DL_PATCH_VERSION));
-  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
deleted file mode 100644
index f537ab247f..0000000000
--- a/ext/dl/dl.def
+++ /dev/null
@@ -1,63 +0,0 @@
-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_init
-rb_dlhandle_s_new
-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_initialize
-rb_dlsym_inspect
-rb_dlsym_name
-rb_dlsym_new
-rb_dlsym_proto
-rb_dlsym_s_new
-rb_dlsym_to_ptr
diff --git a/ext/dl/dl.h b/ext/dl/dl.h
deleted file mode 100644
index 9554ea91ba..0000000000
--- a/ext/dl/dl.h
+++ /dev/null
@@ -1,307 +0,0 @@
-/* -*- C -*-
- * $Id$
- */
-
-#ifndef RUBY_DL_H
-#define RUBY_DL_H
-
-#include 
-#include 
-
-#define DL_VERSION     "1.2.0"
-#define DL_MAJOR_VERSION 1
-#define DL_MINOR_VERSION 2
-#define DL_PATCH_VERSION 0
-
-#if defined(HAVE_DLFCN_H)
-# include 
-#else
-# if defined(HAVE_WINDOWS_H)
-#   include 
-#   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_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
deleted file mode 100644
index 9964c4e12f..0000000000
--- a/ext/dl/doc/dl.txt
+++ /dev/null
@@ -1,267 +0,0 @@
-=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 the timeval structure.
-      "long tv_sec",
-      "long tv_uses",
-    ]
-  end
-  val = LIBC::Timeval.malloc # allocate the memory.
-
-The above example uses LIBC::Timeval.malloc, since we use LIBC::Timeval.new(ptr)
-to wrap the given PtrData object which is, for example, created by DL::malloc().
-DL::malloc() is a function to allocate a memory by using the C library function
-malloc().
-
-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, [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 : a character (char)
-    c : a pointer to a character (char *)
-    H : a short integer (short)
-    h : a pointer to a short integer (short *)
-    I : an integer (char, short, int)
-    i : a pointer to an integer (char *, short *, int *)
-    L : a long integer (long)
-    l : a pointer to a long integer (long *)
-    F : a real (float)
-    f : a pointer to a real (float *)
-    D : a real (double)
-    d : a pointer to a real (double *)
-    S : an immutable string (const char *)
-    s : a mutable string (char *)
-    A : an array (const type[])
-    a : a mutable array (type[])
-    P : a pointer (void *)
-    p : a mutable object (void *)
-    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
-      return str1 <=> str2
-    }
-=end
diff --git a/ext/dl/extconf.rb b/ext/dl/extconf.rb
deleted file mode 100644
index 46b3c6c87d..0000000000
--- a/ext/dl/extconf.rb
+++ /dev/null
@@ -1,197 +0,0 @@
-require 'mkmf'
-
-begin # for the exception SystemExit
-
-$:.unshift File.dirname(__FILE__)
-require 'type'
-
-if( ARGV.include?("--help") )
-  print <
-  --with-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
-
-if (Config::CONFIG['CC'] =~ /gcc/) && (Config::CONFIG['arch'] =~ /i.86/)
-  $with_asm = true
-else
-  $with_asm = false
-end
-$with_dlstack = ! $with_asm
-
-$with_type_int = try_run(<\n")
-    exit(1)
-  end
-end
-max_arg   ||= 6
-
-max_callback = with_config("callback","10").to_i
-callback_types = DLTYPE.keys.length
-
-
-$dlconfig_h = <] [-d] []
-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
deleted file mode 100644
index 6debf5e0c5..0000000000
--- a/ext/dl/handle.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/* -*- C -*-
- * $Id$
- */
-
-#include 
-#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_new(int argc, VALUE argv[], VALUE self)
-{
-  void *ptr;
-  VALUE val;
-  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 = StringValuePtr(lib);
-    cflag = RTLD_LAZY | RTLD_GLOBAL;
-    break;
-  case 2:
-    clib = StringValuePtr(lib);
-    cflag = NUM2INT(flag);
-    break;
-  default:
-    rb_bug("rb_dlhandle_new");
-  };
-
-  ptr = dlopen(clib, cflag);
-#if defined(HAVE_DLERROR)
-  if( (err = dlerror()) ){
-    rb_raise(rb_eRuntimeError, err);
-  };
-#else
-  if( !ptr ){
-    err = dlerror();
-    rb_raise(rb_eRuntimeError, err);
-  };
-#endif
-  val = Data_Make_Struct(rb_cDLHandle, struct dl_handle, 0,
-			 dlhandle_free, dlhandle);
-  dlhandle->ptr = ptr;
-  dlhandle->open = 1;
-  dlhandle->enable_close = 0;
-
-  rb_obj_call_init(val, argc, argv);
-
-  if( rb_block_given_p() ){
-    rb_ensure(rb_yield, val, rb_dlhandle_close, val);
-  };
-
-  return val;
-}
-
-VALUE
-rb_dlhandle_init(int argc, VALUE argv[], VALUE 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 sym_data *data;
-  int *ctypes;
-  int i, ctypes_len;
-  struct dl_handle *dlhandle;
-  void *handle;
-  const char *name, *stype;
-  const char *err;
-
-  if( rb_scan_args(argc, argv, "11", &sym, &type) == 2 ){
-    stype = StringValuePtr(type);
-  }
-  else{
-    stype = NULL;
-  };
-
-  if( sym == Qnil ){
-#if defined(RTLD_NEXT)
-    name = RTLD_NEXT;
-#else
-    name = NULL;
-#endif
-  }
-  else{
-    name = StringValuePtr(sym);
-  };
-
-
-  Data_Get_Struct(self, struct dl_handle, dlhandle);
-  handle = dlhandle->ptr;
-
-  func = dlsym(handle, name);
-#if defined(HAVE_DLERROR)
-  if( (err = dlerror()) && (!func) )
-#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( (err = dlerror()) && (!func) )
-#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_cData);
-  rb_define_singleton_method(rb_cDLHandle, "new", rb_dlhandle_s_new, -1);
-  rb_define_method(rb_cDLHandle, "initialize", rb_dlhandle_init, -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
deleted file mode 100644
index 69b1834301..0000000000
--- a/ext/dl/install.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-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
deleted file mode 100644
index 16ecf9c904..0000000000
--- a/ext/dl/lib/dl/import.rb
+++ /dev/null
@@ -1,219 +0,0 @@
-# -*- ruby -*-
-
-require 'dl'
-require 'dl/types'
-
-module DL
-  module Importable
-    LIB_MAP = {}
-
-    module Internal
-      def init_types()
-	if( !@types )
-	  @types = ::DL::Types.new
-	end
-      end
-
-      def init_sym()
-	if( !@SYM )
-	  @SYM = {}
-	end
-      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,_,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  = rdec.call(r) if rdec",
-	  "  rs = dec.call(rs) if dec",
-	  "  @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
deleted file mode 100644
index efa9118c11..0000000000
--- a/ext/dl/lib/dl/struct.rb
+++ /dev/null
@@ -1,138 +0,0 @@
-# -*- 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}\"]",
-	      "  v = @dec[\"#{name}\"].call(v,@len[\"#{name}\"]) if @dec[\"#{name}\"]",
-	      "  return v",
-	      "end",
-	      "def #{name}=(v)",
-	      "  v = @enc[\"#{name}\"].call(v,@len[\"#{name}\"]) if @enc[\"#{name}\"]",
-	      "  @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
deleted file mode 100644
index 53680ac536..0000000000
--- a/ext/dl/lib/dl/types.rb
+++ /dev/null
@@ -1,170 +0,0 @@
-# -*- 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],
-      ["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},
-	nil, nil],
-      ["cbool",   "C",
-	proc{|v| v ? 1 : 0},
-	proc{|v| (v != 0) ? true : false},
-	nil, nil],
-      ["lbool",   "L",
-	proc{|v| v ? 1 : 0},
-	proc{|v| (v != 0) ? true : false},
-	nil, nil],
-      ["unsigned char", "I",
-	proc{|v| [v].pack("C").unpack("c")[0]},
-	proc{|v| [v].pack("c").unpack("C")[0]},
-	nil, nil],
-      ["unsigned short", "H",
-	proc{|v| [v].pack("S").unpack("s")[0]},
-	proc{|v| [v].pack("s").unpack("S")[0]},
-	nil, nil],
-      ["unsigned int", "I",
-	proc{|v| [v].pack("I").unpack("i")[0]},
-	proc{|v| [v].pack("i").unpack("I")[0]},
-	nil, nil],
-      ["unsigned long", "L",
-	proc{|v| [v].pack("L").unpack("l")[0]},
-	proc{|v| [v].pack("l").unpack("L")[0]},
-	nil, nil],
-      ["unsigned char ref", "i",
-	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],
-      [/.+\*/,   "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( ty =~ t1 )
-	  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
deleted file mode 100644
index b507be5fde..0000000000
--- a/ext/dl/lib/dl/win32.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- ruby -*-
-
-require 'dl'
-
-class Win32API
-  LIBRARY = {}
-
-  attr_reader :val, :args
-
-  def initialize(lib, func, args, ret)
-    LIBRARY[lib] ||= DL.dlopen(lib)
-    ty = (ret + args).tr('V','0')
-    @sym = LIBRARY[lib].sym(func, ty)
-    @__dll__ = LIBRARY[lib].to_i
-    @__dllname__ = lib
-    @__proc__ = @sym.to_i
-    @val = nil
-    @args = []
-  end
-
-  def call(*args)
-    @val,@args = @sym.call(*args)
-    return @val
-  end
-  alias Call call
-end
diff --git a/ext/dl/mkcall.rb b/ext/dl/mkcall.rb
deleted file mode 100644
index dad101744b..0000000000
--- a/ext/dl/mkcall.rb
+++ /dev/null
@@ -1,68 +0,0 @@
-# -*- ruby -*-
-
-require 'mkmf'
-$:.unshift File.dirname(__FILE__)
-require 'type'
-require 'dlconfig'
-
-$int_eq_long = try_run(<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
deleted file mode 100644
index 165c4bdc88..0000000000
--- a/ext/dl/mkcbtable.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- 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
deleted file mode 100644
index 60b7f71860..0000000000
--- a/ext/dl/ptr.c
+++ /dev/null
@@ -1,1040 +0,0 @@
-/* -*- C -*-
- * $Id$
- */
-
-#include 
-#include  /* 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_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);
-}
-
-VALUE
-rb_dlptr_new2(VALUE klass, void *ptr, long size, freefunc_t func)
-{
-  struct ptr_data *data;
-  VALUE val;
-
-  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;
-
-  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_new(int argc, VALUE argv[], VALUE klass)
-{
-  VALUE ptr, sym, obj, size;
-  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_s_new");
-  };
-
-  obj = rb_dlptr_new(p,s,f);
-
-  rb_obj_call_init(obj, argc, argv);
-
-  return obj;
-}
-
-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_new");
-  };
-
-  obj = rb_dlptr_malloc(s,f);
-
-  return obj;
-}
-
-static VALUE
-rb_dlptr_init(int argc, VALUE argv[], VALUE self)
-{
-  return Qnil;
-}
-
-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;
-  int i;
-
-  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  'S': case 'P':
-      n = data->size / sizeof(void*);
-      break;
-    default:
-      if( t == 'p' || t == 's' ){
-	int i;
-	for( i=0; ((void**)(data->ptr))[i]; i++ ){};
-	n = i;
-      }
-      else{
-	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]));
-    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];
-  VALUE name;
-
-  Data_Get_Struct(self, struct ptr_data, data);
-  snprintf(str, 1023, "#<%s:0x%x ptr=0x%x size=%ld free=0x%x>",
-	   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, len, num;
-  char *ctype;
-  long size;
-
-  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; ictype = 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; iids[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; istype )
-    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':
-      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':
-      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 val, key = Qnil, num = Qnil;
-  ID id;
-  int idx;
-  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));
-  };
-
-  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':
-	  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':
-	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;
-
-  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;
-    int len;
-    
-    StringValue(val);
-    Data_Get_Struct(self, struct ptr_data, data);
-    dst = (void*)((long)(data->ptr) + DLNUM2LONG(key));
-    src = RSTRING(val)->ptr;
-    if( num == Qnil ){
-      len = RSTRING(val)->len;
-    }
-    else{
-      len = NUM2INT(num);
-    };
-    memcpy(dst, src, len);
-    return val;
-  };
-
-  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);
-  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':
-	  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':
-	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':
-	  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_cData);
-  rb_define_singleton_method(rb_cDLPtrData, "new", rb_dlptr_s_new, -1);
-  rb_define_singleton_method(rb_cDLPtrData, "malloc", rb_dlptr_s_malloc, -1);
-  rb_define_method(rb_cDLPtrData, "initialize", rb_dlptr_init, -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
deleted file mode 100644
index d083d337a7..0000000000
--- a/ext/dl/sample/c++sample.C
+++ /dev/null
@@ -1,35 +0,0 @@
-#include 
-
-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
deleted file mode 100644
index 29887df845..0000000000
--- a/ext/dl/sample/c++sample.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-=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
deleted file mode 100644
index 8a590404b1..0000000000
--- a/ext/dl/sample/drives.rb
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- 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
deleted file mode 100644
index 3f7261c979..0000000000
--- a/ext/dl/sample/getch.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-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
deleted file mode 100644
index 32816fd331..0000000000
--- a/ext/dl/sample/libc.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-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
deleted file mode 100644
index 091e646091..0000000000
--- a/ext/dl/sample/msgbox.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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
deleted file mode 100644
index e49846cc5e..0000000000
--- a/ext/dl/sample/msgbox2.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# 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
deleted file mode 100644
index 179836999d..0000000000
--- a/ext/dl/sample/stream.rb
+++ /dev/null
@@ -1,87 +0,0 @@
-# -*- 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
deleted file mode 100644
index 3326d6743f..0000000000
--- a/ext/dl/sym.c
+++ /dev/null
@@ -1,823 +0,0 @@
-/* -*- C -*-
- * $Id$
- */
-
-#include 
-#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;
-
-  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_new(int argc, VALUE argv[], VALUE self)
-{
-  VALUE addr, name, type;
-  VALUE val;
-  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);
-
-  val = rb_dlsym_new((void (*)())saddr, sname, stype);
-
-  if( val != Qnil ){
-    rb_obj_call_init(val, argc, argv);
-  };
-
-  return val;
-}
-
-VALUE
-rb_dlsym_initialize(int argc, VALUE argv[], VALUE self)
-{
-  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,
-	   "#",
-	   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;
-}
-
-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;
-
-  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(NUM2CHR(argv[i]));
-      PUSH_C(ftype);
-      break;
-    case 'h':
-      ANY2H(dargs[i]) = DLSHORT(NUM2CHR(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{
-	if( TYPE(argv[i]) != T_STRING ){
-	  rb_raise(rb_eDLError, "#%d must be a string",i);
-	};
-	ANY2S(args[i]) = DLSTR(RSTRING(argv[i])->ptr);
-      };
-      PUSH_P(ftype);
-      break;
-    case 's':
-      if( TYPE(argv[i]) != T_STRING ){
-	rb_raise(rb_eDLError, "#%d must be a string",i);
-      };
-      ANY2S(args[i]) = DLSTR(dlmalloc(RSTRING(argv[i])->len + 1));
-      memcpy((char*)(ANY2S(args[i])), RSTRING(argv[i])->ptr, RSTRING(argv[i])->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);
-
-  {
-    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]);
-    }
-  }
-  }
-#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_cData);
-  rb_define_singleton_method(rb_cDLSymbol, "new", rb_dlsym_s_new, -1);
-  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);
-}
diff --git a/ext/dl/test/libtest.def b/ext/dl/test/libtest.def
deleted file mode 100644
index 8ecefc917b..0000000000
--- a/ext/dl/test/libtest.def
+++ /dev/null
@@ -1,28 +0,0 @@
-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
deleted file mode 100644
index 7321379390..0000000000
--- a/ext/dl/test/test.c
+++ /dev/null
@@ -1,247 +0,0 @@
-#include 
-#include 
-
-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
deleted file mode 100644
index 3e124783fa..0000000000
--- a/ext/dl/test/test.rb
+++ /dev/null
@@ -1,294 +0,0 @@
-# -*- 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("VERSION       = #{DL::VERSION}\n")
-print("MAJOR_VERSION = #{DL::MAJOR_VERSION}\n")
-print("MINOR_VERSION = #{DL::MINOR_VERSION}\n")
-print("\n")
-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)
-
-GC.start
-
-printf("fail/total = #{$FAIL}/#{$TOTAL}\n")
diff --git a/ext/dl/type.rb b/ext/dl/type.rb
deleted file mode 100644
index 804420c395..0000000000
--- a/ext/dl/type.rb
+++ /dev/null
@@ -1,115 +0,0 @@
-# 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/etc/.cvsignore b/ext/etc/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/etc/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/etc/MANIFEST b/ext/etc/MANIFEST
deleted file mode 100644
index 62cf5be233..0000000000
--- a/ext/etc/MANIFEST
+++ /dev/null
@@ -1,6 +0,0 @@
-MANIFEST
-etc.c
-etc.txt
-etc.txt.ja
-depend
-extconf.rb
diff --git a/ext/etc/depend b/ext/etc/depend
deleted file mode 100644
index ac706477b0..0000000000
--- a/ext/etc/depend
+++ /dev/null
@@ -1 +0,0 @@
-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
deleted file mode 100644
index 76af10be77..0000000000
--- a/ext/etc/etc.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/************************************************
-
-  etc.c -
-
-  $Author$
-  $Date$
-  created at: Tue Mar 22 18:39:19 JST 1994
-
-************************************************/
-
-#include "ruby.h"
-
-#include 
-#ifdef HAVE_UNISTD_H
-#include 
-#endif
-
-#ifdef HAVE_GETPWENT
-#include 
-#endif
-
-#ifdef HAVE_GETGRENT
-#include 
-#endif
-
-static VALUE sPasswd, sGroup;
-
-char *getenv();
-char *getlogin();
-
-static VALUE
-etc_getlogin(obj)
-    VALUE obj;
-{
-    char *login;
-
-    rb_secure(4);
-#ifdef HAVE_GETLOGIN
-    login = getlogin();
-    if (!login) login = getenv("USER");
-#else
-    login = getenv("USER");
-#endif
-
-    if (login)
-	return rb_tainted_str_new2(login);
-    return Qnil;
-}
-
-#ifdef HAVE_GETPWENT
-static VALUE
-setup_passwd(pwd)
-    struct passwd *pwd;
-{
-    if (pwd == 0) rb_sys_fail("/etc/passwd");
-    return rb_struct_new(sPasswd,
-			 rb_tainted_str_new2(pwd->pw_name),
-			 rb_tainted_str_new2(pwd->pw_passwd),
-			 INT2FIX(pwd->pw_uid),
-			 INT2FIX(pwd->pw_gid),
-#ifdef PW_GECOS
-			 rb_tainted_str_new2(pwd->pw_gecos),
-#endif
-			 rb_tainted_str_new2(pwd->pw_dir),
-			 rb_tainted_str_new2(pwd->pw_shell),
-#ifdef PW_CHANGE
-			 INT2FIX(pwd->pw_change),
-#endif
-#ifdef PW_QUOTA
-			 INT2FIX(pwd->pw_quota),
-#endif
-#ifdef PW_AGE
-			 INT2FIX(pwd->pw_age),
-#endif
-#ifdef PW_CLASS
-			 rb_tainted_str_new2(pwd->pw_class),
-#endif
-#ifdef PW_COMMENT
-			 rb_tainted_str_new2(pwd->pw_comment),
-#endif
-#ifdef PW_EXPIRE
-			 INT2FIX(pwd->pw_expire),
-#endif
-			 0		/*dummy*/
-	);
-}
-#endif
-
-static VALUE
-etc_getpwuid(argc, argv, obj)
-    int argc;
-    VALUE *argv;
-    VALUE obj;
-{
-#if defined(HAVE_GETPWENT)
-    VALUE id, ary;
-    int uid;
-    struct passwd *pwd;
-
-    rb_secure(4);
-    if (rb_scan_args(argc, argv, "01", &id) == 1) {
-	uid = NUM2INT(id);
-    }
-    else {
-	uid = getuid();
-    }
-    pwd = getpwuid(uid);
-    if (pwd == 0) rb_raise(rb_eArgError, "can't find user for %d", uid);
-    return setup_passwd(pwd);
-#else 
-    return Qnil;
-#endif
-}
-
-static VALUE
-etc_getpwnam(obj, nam)
-    VALUE obj, nam;
-{
-#ifdef HAVE_GETPWENT
-    struct passwd *pwd;
-
-    SafeStringValue(nam);
-    pwd = getpwnam(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;
-{
-#ifdef HAVE_GETPWENT
-    struct passwd *pw;
-
-    rb_secure(4);
-    if (rb_block_given_p()) {
-	if (passwd_blocking) {
-	    rb_raise(rb_eRuntimeError, "parallel passwd iteration");
-	}
-	passwd_blocking = Qtrue;
-	rb_ensure(passwd_iterate, 0, passwd_ensure, 0);
-    }
-    if (pw = getpwent()) {
-	return setup_passwd(pw);
-    }
-#endif
-    return Qnil;
-}
-
-#ifdef HAVE_GETGRENT
-static VALUE
-setup_group(grp)
-    struct group *grp;
-{
-    VALUE mem;
-    char **tbl;
-
-    mem = rb_ary_new();
-    tbl = grp->gr_mem;
-    while (*tbl) {
-	rb_ary_push(mem, rb_tainted_str_new2(*tbl));
-	tbl++;
-    }
-    return rb_struct_new(sGroup,
-			 rb_tainted_str_new2(grp->gr_name),
-			 rb_tainted_str_new2(grp->gr_passwd),
-			 INT2FIX(grp->gr_gid),
-			 mem);
-}
-#endif
-
-static VALUE
-etc_getgrgid(obj, id)
-    VALUE obj, id;
-{
-#ifdef HAVE_GETGRENT
-    int gid;
-    struct group *grp;
-
-    rb_secure(4);
-    gid = NUM2INT(id);
-    grp = getgrgid(gid);
-    if (grp == 0) rb_raise(rb_eArgError, "can't find group for %d", gid);
-    return setup_group(grp);
-#else
-    return Qnil;
-#endif
-}
-
-static VALUE
-etc_getgrnam(obj, nam)
-    VALUE obj, nam;
-{
-#ifdef HAVE_GETGRENT
-    struct group *grp;
-
-    rb_secure(4);
-    SafeStringValue(nam);
-    grp = getgrnam(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;
-
-    setpwent();
-    while (pw = getgrent()) {
-	rb_yield(setup_group(pw));
-    }
-    endpwent();
-    return Qnil;
-}
-#endif
-
-static VALUE
-etc_group(obj)
-    VALUE obj;
-{
-#ifdef HAVE_GETGRENT
-    struct group *grp;
-
-    rb_secure(4);
-    if (rb_block_given_p()) {
-	if (group_blocking) {
-	    rb_raise(rb_eRuntimeError, "parallel group iteration");
-	}
-	group_blocking = Qtrue;
-	rb_ensure(group_iterate, 0, group_ensure, 0);
-    }
-    if (grp = getgrent()) {
-	return setup_group(grp);
-    }
-#endif
-    return Qnil;
-}
-
-static VALUE mEtc;
-
-void
-Init_etc()
-{
-    mEtc = rb_define_module("Etc");
-
-    rb_define_module_function(mEtc, "getlogin", etc_getlogin, 0);
-
-    rb_define_module_function(mEtc, "getpwuid", etc_getpwuid, -1);
-    rb_define_module_function(mEtc, "getpwnam", etc_getpwnam, 1);
-    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 =  rb_struct_define("Passwd",
-				"name", "passwd", "uid", "gid",
-#ifdef PW_GECOS
-				"gecos",
-#endif
-				"dir", "shell",
-#ifdef PW_CHANGE
-				"change",
-#endif
-#ifdef PW_QUOTA
-				"quota",
-#endif
-#ifdef PW_AGE
-				"age",
-#endif
-#ifdef PW_CLASS
-				"uclass",
-#endif
-#ifdef PW_COMMENT
-				"comment",
-#endif
-#ifdef PW_EXPIRE
-				"expire",
-#endif
-				0);
-    rb_global_variable(&sPasswd);
-
-#ifdef HAVE_GETGRENT
-    sGroup = rb_struct_define("Group", "name", "passwd", "gid", "mem", 0);
-    rb_global_variable(&sGroup);
-#endif
-}
diff --git a/ext/etc/etc.txt b/ext/etc/etc.txt
deleted file mode 100644
index 534790172c..0000000000
--- a/ext/etc/etc.txt
+++ /dev/null
@@ -1,72 +0,0 @@
-.\" 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.txt.ja b/ext/etc/etc.txt.ja
deleted file mode 100644
index 2dddcfb036..0000000000
--- a/ext/etc/etc.txt.ja
+++ /dev/null
@@ -1,72 +0,0 @@
-.\" etc.txt.ja -  -*- Indented-Text -*- created at: Fri Jul 14 00:47:15 JST 1995
-
-** Etc(モジュール)
-
-/etcディレクトリ以下の情報を得るためのモジュール.クラスにインクルード
-して使うこともできる.
-
-Module Function:
-
-   getlogin
-
-	自分のlogin名を返す.これが失敗した場合はgetpwuid()を用いると
-	良い.
-
-   getpwnam(name)
-
-	/etc/passwdファイル(あるいはDBMファイルやNISデータベース)を検
-	索し,nameの名前を持つpasswdエントリを返す.戻り値はpasswd構造
-	体で以下のメンバを持つ.
-
-	  struct passwd
-	    name 	# ユーザ名(文字列)
-	    passwd	# パスワード(文字列)
-	    uid		# ユーザID(整数)
-	    gid		# グループID(整数)
-	    gecos	# gecosフィールド(文字列)
-	    dir		# ホームディレクトリ(文字列)
-	    shell	# ログインシェル(文字列)
-	    # 以降のメンバはシステムによっては提供されない.
-	    change	# パスワード変更時間(整数)
-	    quota	# クォータ(整数)
-	    age		# エージ(整数)
-	    class	# ユーザアクセスクラス(文字列)
-	    comment	# コメント(文字列)
-	    expire	# アカウント有効期限(整数)	    
-	  end
-
-	詳細はgetpwnam(3)を参照のこと.
-
-   getpwuid([uid])
-
-	uidをユーザIDとするpasswdエントリを返す.戻り値はgetpwnam()と
-	同様である.引数を省略した場合にはgetuid()の値を用いる.詳細は
-	getpwuid(3)を参照のこと.
-
-   getgrgid(gid)
-
-	/etc/groupファイル(あるいは…getpwnam参照)を検索し,gidをグルー
-	プIDとするグループエントリを返す.戻り値はgroup構造体で以下の
-	メンバを持つ.
-
-	  struct group
-	    name 	# グループ名(文字列)
-	    passwd	# グループのパスワード(文字列)
-	    gid		# グループID(整数)
-	    mem		# グループメンバ名の配列
-	  end
-
-	詳細はgetgrgid(3)を参照のこと.
-
-   getgrnam(name)
-
-	nameという名前のグループエントリを返す.戻り値はgetgrgid()と同
-	様である.詳細はgetgrnam(3)を参照.
-
-   group
-
-	全てのグループエントリを順にアクセスするためのイテレータ.
-
-   passwd
-
-	全てのpasswdエントリを順にアクセスするためのイテレータ.
diff --git a/ext/etc/extconf.rb b/ext/etc/extconf.rb
deleted file mode 100644
index b920d91a95..0000000000
--- a/ext/etc/extconf.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-require 'mkmf'
-
-def etc_grep_header(field)
-  if egrep_cpp(field, "#include \n")
-    $defs.push(format("-D%s", field.upcase))
-  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") unless /cygwin/ === RUBY_PLATFORM
-  etc_grep_header("pw_expire")
-  create_makefile("etc")
-end
diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in
deleted file mode 100644
index c5a929d4fe..0000000000
--- a/ext/extmk.rb.in
+++ /dev/null
@@ -1,850 +0,0 @@
-#! /usr/local/bin/ruby
-# -*- ruby -*-
-
-$".push 'mkmf.rb' # "
-ORIG_LIBPATH = ENV['LIB']
-
-if ARGV[0] == 'static'
-  $force_static = true
-  ARGV.shift
-elsif ARGV[0] == 'install'
-  $install = true
-  $destdir = ARGV[1] || ''
-  ARGV.shift
-elsif ARGV[0] == 'clean'
-  $clean = "clean"
-  ARGV.shift
-elsif ARGV[0] == 'distclean'
-  $clean = "distclean"
-  ARGV.shift
-elsif ARGV[0] == 'realclean'
-  $clean = "realclean"
-  ARGV.shift
-end
-
-SRC_EXT = ["c", "cc", "m", "cxx", "cpp", "C"]
-$extlist = []
-
-$libdir = "@libdir@"
-
-$top_srcdir = "@top_srcdir@"
-if $top_srcdir !~ ("^" + File::SEPARATOR)
-  # get absolute path
-  $top_srcdir = File.expand_path($top_srcdir)
-end
-# get absolute path
-$topdir = File.expand_path("..")
-
-$:.replace [$topdir, $top_srcdir, $top_srcdir+"/lib", "."]
-
-require 'rbconfig.rb'
-require 'find'
-require 'ftools'
-require 'shellwords'
-
-def rm_f(*files)
-  targets = []
-  for file in files
-    targets.concat Dir[file]
-  end
-  if not targets.empty?
-    File::chmod(0777, *targets)
-    File::unlink(*targets)
-  end
-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
-
-CFLAGS = "@CFLAGS@"
-if RUBY_PLATFORM == "m68k-human"
-  CFLAGS.gsub!(/-c..-stack=[0-9]+ */, '')
-end
-if /mswin32/ =~ RUBY_PLATFORM
-  OUTFLAG = '-Fe'
-elsif /bccwin32/ =~ RUBY_PLATFORM
-  OUTFLAG = '-o'
-else
-  OUTFLAG = '-o '
-end
-LINK = "@CC@ #{OUTFLAG}conftest -I#$topdir -I#$top_srcdir #{CFLAGS} @LDFLAGS@ %s %s %s conftest.c %s %s @LIBS@"
-CPP = "@CPP@ @CPPFLAGS@ -I#$topdir -I#$top_srcdir #{CFLAGS} %s %s %s conftest.c"
-
-$log = nil
-$orgerr = $stderr.dup
-$orgout = $stdout.dup
-
-def xsystem command
-  if $DEBUG
-    puts command
-    $stdout.flush
-    return system(command)
-  end
-  $log ||= open(File.join($topdir, 'ext', 'extmk.log'), 'w')
-  $stderr.reopen($log) 
-  $stdout.reopen($log) 
-  puts command
-  $stdout.flush
-  r = system(command)
-  $stderr.reopen($orgerr)
-  $stdout.reopen($orgout)
-  return r
-end
-
-def try_link0(src, opt="")
-  cfile = open("conftest.c", "w")
-  cfile.print src
-  cfile.close
-  ldflags = $LDFLAGS
-  if /mswin32|bccwin32/ =~ RUBY_PLATFORM and !$LIBPATH.empty?
-    ENV['LIB'] = ($LIBPATH + [ORIG_LIBPATH]).compact.join(';')
-  else
-    ldflags = ldflags.dup
-    $LIBPATH.each {|d| ldflags << " -L" + d}
-  end
-  begin
-    xsystem(Config::expand(format(LINK, $CFLAGS, $CPPFLAGS, ldflags, opt, $LOCAL_LIBS)))
-  ensure
-    ENV['LIB'] = ORIG_LIBPATH if /mswin32|bccwin32/ =~ RUBY_PLATFORM
-  end
-end
-
-def try_link(src, opt="")
-  begin
-    try_link0(src, opt)
-  ensure
-    rm_f "conftest*"
-    if /bccwin32/ =~ RUBY_PLATFORM
-      rm_f "c0x32*"
-    end
-  end
-end
-
-def try_cpp(src, opt="")
-  cfile = open("conftest.c", "w")
-  cfile.print src
-  cfile.close
-  begin
-    xsystem(Config::expand(format(CPP, $CFLAGS, $CPPFLAGS, opt)))
-  ensure
-    rm_f "conftest*"
-  end
-end
-
-def egrep_cpp(pat, src, opt="")
-  cfile = open("conftest.c", "w")
-  cfile.print src
-  cfile.close
-  begin
-    xsystem(Config::expand(format(CPP, $CFLAGS, $CPPFLAGS, opt))+"|egrep #{pat}")
-  ensure
-    rm_f "conftest*"
-  end
-end
-
-def try_run(src, opt="")
-  begin
-    if try_link0(src, opt)
-      if xsystem("./conftest")
-	true
-      else
-	false
-      end
-    else
-      nil
-    end
-  ensure
-    rm_f "conftest*"
-  end
-end
-
-def install_rb(mfile, srcdir = nil)
-  libdir = "lib"
-  libdir = File.join(srcdir, libdir) if srcdir
-  path = []
-  dir = []
-  if File.directory? libdir
-    Find.find(libdir) do |f|
-      next unless /\.rb$/ =~ f
-      f = f[libdir.length+1..-1]
-      path.push f
-      dir |= [File.dirname(f)]
-    end
-  end
-  for f in dir
-    if f == "."
-      mfile.print "\t@$(RUBY) -r ftools -e 'File::makedirs(*ARGV)' $(DESTDIR)$(pkglibdir)$(target_prefix)\n"
-    else
-      mfile.printf "\t@$(RUBY) -r ftools -e 'File::makedirs(*ARGV)' $(DESTDIR)$(pkglibdir)$(target_prefix)/%s\n", f
-    end
-  end
-  for f in path
-    mfile.printf "\t@$(RUBY) -r ftools -e 'File::install(ARGV[0], ARGV[1], 0644, true)' $(srcdir)/lib/%s $(DESTDIR)$(pkglibdir)$(target_prefix)/%s\n", f, f
-  end
-end
-
-def append_library(libs, lib)
-  if /mswin32|bccwin32/ =~ RUBY_PLATFORM
-    lib + ".lib " + libs
-  else
-    "-l" + lib + " " + libs
-  end
-end
-
-def have_library(lib, func="main")
-  if func && func != ""
-    libs = append_library($libs, lib)
-    if /mswin32|bccwin32|mingw/ =~ RUBY_PLATFORM
-      return true if lib == 'm'
-      r = try_link(<<"SRC", libs)
-#include 
-#include 
-int main() { return 0; }
-int t() { #{func}(); return 0; }
-SRC
-      unless r
-        r = try_link(<<"SRC", libs)
-#include 
-#include 
-int main() { return 0; }
-int t() { void ((*p)()); p = (void ((*)()))#{func}; return 0; }
-SRC
-      end
-    else
-      r = try_link(<<"SRC", libs)
-int main() { return 0; }
-int t() { #{func}(); return 0; }
-SRC
-    end
-    unless r
-      return false
-    end
-  else
-    libs = append_library($libs, lib)
-  end
-
-  $libs = libs
-  return true
-end
-
-def find_library(lib, func, *paths)
-  libpath = $LIBPATH
-  libs = append_library($libs, lib)
-  until try_link(<<"SRC", libs)
-int main() { return 0; }
-int t() { #{func}(); return 0; }
-SRC
-    if paths.size == 0
-      $LIBPATH = libpath
-      return false
-    end
-    $LIBPATH = libpath | [paths.shift]
-  end
-  $libs = libs
-  return true
-end
-
-def have_func(func, header=nil)
-  libs = $libs
-  src = 
-    if /mswin32|bccwin32|mingw/ =~ RUBY_PLATFORM
-      r = <<"SRC"
-#include 
-#include 
-SRC
-    else
-      ""
-    end
-  unless header.nil?
-  src << <<"SRC"
-#include <#{header}>
-SRC
-  end
-  r = try_link(src + <<"SRC", libs)
-int main() { return 0; }
-int t() { #{func}(); return 0; }
-SRC
-  unless r
-    r = try_link(src + <<"SRC", libs)
-int main() { return 0; }
-int t() { void ((*p)()); p = (void ((*)()))#{func}; return 0; }
-SRC
-  end
-  unless r
-    return false
-  end
-  $defs.push(format("-DHAVE_%s", func.upcase))
-  return true
-end
-
-def have_header(header)
-  unless try_cpp(<<"SRC")
-#include <#{header}>
-SRC
-    return false
-  end
-  $defs.push(format("-DHAVE_%s", header.tr("a-z./\055", "A-Z___")))
-  return true
-end
-
-def arg_config(config, default=nil)
-  unless defined? $configure_args
-    $configure_args = {}
-    args = "@configure_args@"
-    if /mswin32|bccwin32|mingw/ =~ RUBY_PLATFORM and ENV["CONFIGURE_ARGS"]
-      args << " " << ENV["CONFIGURE_ARGS"]
-    end
-    for arg in Shellwords::shellwords(args)
-      next unless /^--/ =~ arg
-      arg, val = arg.split('=', 2)
-      $configure_args[arg] = val || true
-    end
-  end
-  $configure_args.fetch(config, default)
-end
-
-def with_config(config, default=nil)
-  unless /^--with-/ =~ config
-    config = '--with-' + config
-  end
-  arg_config(config, default)
-end
-
-def enable_config(config, default=nil)
-  if arg_config("--enable-"+config)
-    true
-  elsif arg_config("--disable-"+config)
-    false
-  else
-    default
-  end
-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 dir_config(target, idefault=nil, ldefault=nil)
-  if dir = with_config(target + "-dir", (idefault unless ldefault))
-    idefault = dir + "/include"
-    ldefault = dir + "/lib"
-  end
-
-  idir = with_config(target + "-include", idefault)
-  ldir = with_config(target + "-lib", ldefault)
-
-  if idir
-    idircflag = "-I" + idir
-    $CPPFLAGS += " " + idircflag unless $CPPFLAGS.split.include?(idircflag)
-  end
-
-  if ldir
-    $LIBPATH << ldir unless $LIBPATH.include?(ldir)
-  end
-
-  [idir, ldir]
-end
-
-def create_makefile(target)
-  $target = target
-  if target.include?('/')
-    target_prefix, target = File.split(target)
-    target_prefix[0,0] = '/'
-  else
-    target_prefix = ""
-  end
-  rm_f "conftest*"
-  if "@DLEXT@" == $OBJEXT
-    libs = $libs.split
-    for lib in libs
-      lib.sub!(/-l(.*)/, %%"lib\\1.#{$LIBEXT}"%)
-    end
-    $defs.push(format("-DEXTLIB='%s'", libs.join(",")))
-  end
-
-  $DLDFLAGS = '@DLDFLAGS@'
-
-  if $configure_args['--enable-shared'] or "@LIBRUBY@" != "@LIBRUBY_A@"
-    $libs = "@LIBRUBYARG@ " + $libs
-    $LIBPATH.unshift $topdir
-  end
-
-  defflag = ''
-  if RUBY_PLATFORM =~ /cygwin|mingw/ and not $static
-    if not File.exist? target + '.def'
-      open(target + '.def', 'wb') do |f|
-        f.print "EXPORTS\n", "Init_", target, "\n"
-      end
-    end
-    defflag = target + ".def"
-  elsif RUBY_PLATFORM =~ /bccwin32/
-    deffile = target + '.def'
-    if not File.exist? target + '.def'
-      open(deffile, 'wb') do |f|
-        f.print "EXPORTS\n", "_Init_", target, "\n"
-      end
-    end
-  end
-
-  if RUBY_PLATFORM =~ /mswin32|bccwin32/
-    libpath = $LIBPATH.join(';')
-  else
-    $LIBPATH.each {|d| $DLDFLAGS << " -L" << d}
-    if /netbsdelf/ =~ RUBY_PLATFORM
-      $LIBPATH.each {|d| $DLDFLAGS << " -Wl,-R" + d unless d == $topdir}
-    end
-  end
-
-  $srcdir = File.join($top_srcdir,"ext",$mdir)
-  mfile = open("Makefile", "w")
-  mfile.binmode if /mingw/ =~ RUBY_PLATFORM
-  mfile.printf < /dev/null || true
-"
-    end
-  elsif "@DLEXT@" != $OBJEXT
-    mfile.print "$(DLLIB): $(OBJS)\n"
-    if /bccwin32/ =~ RUBY_PLATFORM 
-      mfile.print "\t$(LDSHARED) $(DLDFLAGS) C0D32.OBJ $(OBJS), $@,, CW32.LIB IMPORT32.LIB WS2_32.LIB $(LIBS), #{deffile}\n"
-    else
-      if /mswin32/ =~ RUBY_PLATFORM
-        if /nmake/i =~ $make
-          mfile.print "\tset LIB=$(LIBPATH:/=\\);$(LIB)\n"
-        else
-          mfile.print "\tenv LIB='$(subst /,\\\\,$(LIBPATH));$(LIB)' \\\n"
-        end
-      end
-      mfile.print "\t$(LDSHARED) $(DLDFLAGS) #{OUTFLAG}$(DLLIB) $(OBJS) $(LIBS) $(LOCAL_LIBS)\n"
-    end
-  elsif RUBY_PLATFORM == "m68k-human"
-    mfile.printf "\
-$(DLLIB): $(OBJS)
-	ar cru $(DLLIB) $(OBJS)
-"
-  else
-    mfile.printf "\
-$(DLLIB): $(OBJS)
-	ld $(DLDFLAGS) -r -o $(DLLIB) $(OBJS)
-"
-  end
-
-  if File.exist?("#{$srcdir}/depend")
-    dfile = open("#{$srcdir}/depend", "r")
-    mfile.printf "###\n"
-    while line = dfile.gets()
-      line.gsub!(/\.o\b/, ".#{$OBJEXT}")
-      if /bccwin32/ =~ RUBY_PLATFORM
-        line.gsub!(/(\s)([^\s\/]+\.[ch])/, '\1{$(srcdir)}\2')
-      else
-        line.gsub!(/(\s)([^\s\/]+\.[ch])/, '\1{$(srcdir)}\2') if /nmake/i =~ $make
-      end
-      mfile.printf "%s", line.gsub('\$\(hdrdir\)/config.h', '$(topdir)/config.h')
-    end
-    dfile.close
-  end
-  mfile.close
-end
-
-def extmake(target)
-  if $force_static or $static_ext[target]
-    $static = target
-  else
-    $static = false
-  end
-
-  unless $install or $clean
-    return if $nodynamic and not $static
-  end
-
-  $OBJEXT = "@OBJEXT@"
-  $LIBEXT = "a"
-  $objs = nil
-  $libs = "@DLDLIBS@"
-  $local_flags = ""
-  if /mswin32/ =~ RUBY_PLATFORM
-    $LIBEXT = "lib"
-    $local_flags = "-link /INCREMENTAL:no /EXPORT:Init_$(TARGET)"
-  elsif /bccwin32/ =~ RUBY_PLATFORM
-    $LIBEXT = "lib"
-  end
-  $LOCAL_LIBS = ""		# to be assigned in extconf.rb
-  $CFLAGS = ""
-  $CPPFLAGS = "@CPPFLAGS@"
-  $LDFLAGS = ""
-  $LIBPATH = [$libdir]
-
-  dir_config("opt")
-
-  begin
-    dir = Dir.pwd
-    File.mkpath target unless File.directory?(target)
-    Dir.chdir target
-    $target = target
-    $mdir = target
-    unless $install or $clean
-      if $static_ext.size > 0 ||
-	!File.exist?("./Makefile") ||
-	older("./Makefile", "#{$top_srcdir}/ext/@setup@") ||
-	older("./Makefile", "#{$topdir}/ext/extmk.rb") ||
-	older("./Makefile", "#{$top_srcdir}/ext/#{target}/makefile.rb") ||
-	older("./Makefile", "#{$top_srcdir}/ext/#{target}/extconf.rb")
-      then
-	$defs = []
-	if File.exist?("#{$top_srcdir}/ext/#{target}/makefile.rb")
-	  load "#{$top_srcdir}/ext/#{target}/makefile.rb"
-	elsif File.exist?("#{$top_srcdir}/ext/#{target}/extconf.rb")
-	  load "#{$top_srcdir}/ext/#{target}/extconf.rb"
-	else
-	  create_makefile(target)
-	end
-      end
-    end
-    if File.exist?("./Makefile")
-      if $static
- 	$extlist.push [$static, File.basename($target)]
-      end
-      if $install
-        if /bccwin32/ =~ RUBY_PLATFORM
-          system "#{$make} -DDESTDIR=#{$destdir} install"
-        else
-          system "#{$make} install DESTDIR=#{$destdir}"
-        end
-      elsif $clean
-	system "#{$make} #{$clean}"
-      else
-	unless system "#{$make} all"
-	  if ENV["MAKEFLAGS"] != "k" and ENV["MFLAGS"] != "-k"
-	    exit
-	  end
-	end
-      end
-    end
-    if $static
-      $extlibs ||= ""
-      $extlibs += " " + $LDFLAGS unless $LDFLAGS == ""
-      $extlibs += " " + $libs unless $libs == ""
-      $extlibs += " " + $LOCAL_LIBS unless $LOCAL_LIBS == ""
-    end
-  ensure
-    rm_f "conftest*"
-    Dir.chdir dir
-  end
-end
-
-$make = ENV["MAKE"]
-$make ||= with_config("make-prog", "make")
-
-# get static-link modules
-$static_ext = {}
-for setup in ["@setup@", "#{$top_srcdir}/ext/@setup@"]
-  if File.file? setup
-    f = open(setup) 
-    while line = f.gets()
-      line.chomp!
-      line.sub!(/#.*$/, '')
-      next if /^\s*$/ =~ line
-      if /^option +nodynamic/ =~ line
-	$nodynamic = true
-	next
-      end
-      target = line.split[0]
-      target = target.downcase if /mswin32|bccwin32/ =~ RUBY_PLATFORM
-      $static_ext[target] = true
-    end
-    f.close
-    break
-  end
-end
-
-ext_prefix = "#{$top_srcdir}/ext"
-for d in Dir["#{ext_prefix}/**/*"]
-  File.directory?(d) || next
-  File.file?(d + "/MANIFEST") || next
-  
-  d.slice!(0, ext_prefix.length + 1)
-  if $install
-    print "installing ", d, "\n"
-  elsif $clean
-    print "cleaning ", d, "\n"
-  else
-    print "compiling ", d, "\n"
-    if RUBY_PLATFORM =~ /-aix/ and older("../ruby.imp", "../miniruby")
-      load "#{$top_srcdir}/ext/aix_mksym.rb"
-    end
-  end
-  $stdout.flush
-  extmake(d)
-end
-
-if $install or $clean
-  Dir.chdir ".."
-  exit
-end
-$extinit = "" unless $extinit
-
-ruby = "@RUBY_INSTALL_NAME@@EXEEXT@"
-miniruby = "miniruby@EXEEXT@"
-
-$extobjs = "" unless $extobjs
-if $extlist.size > 0
-  for s,t in $extlist
-    f = format("%s/%s.%s", s, t, $LIBEXT)
-    if File.exist?(f)
-      $extinit += format("\
-\tInit_%s();\n\
-\trb_provide(\"%s\");\n\
-", t, s)
-      $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.#{$OBJEXT}", "extinit.c")
-    cmd = "@CC@ " + CFLAGS + " -c extinit.c"
-    print cmd, "\n"
-    system cmd or exit 1
-  end
-
-  Dir.chdir ".."
-
-  if older(ruby, "#{$top_srcdir}/ext/@setup@") or older(ruby, miniruby)
-    rm_f ruby
-  end
-
-  $extobjs = "ext/extinit.#{$OBJEXT} " + $extobjs
-  if RUBY_PLATFORM =~ /m68k-human|beos/
-    $extlibs.gsub!("-L/usr/local/lib", "") if $extlibs
-  end
-  system format(%[#{$make} #{ruby} EXTOBJS='%s' EXTLIBS='%s'], $extobjs, $extlibs)
-else
-  Dir.chdir ".."
-  if older(ruby, miniruby)
-    rm_f ruby
-    system("#{$make} #{ruby}")
-  end
-end
-
-#Local variables:
-# mode: ruby
-#end:
diff --git a/ext/fcntl/.cvsignore b/ext/fcntl/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/fcntl/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
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
deleted file mode 100644
index 10eab64a46..0000000000
--- a/ext/fcntl/depend
+++ /dev/null
@@ -1 +0,0 @@
-fcntl.o: fcntl.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/fcntl/fcntl.c b/ext/fcntl/fcntl.c
deleted file mode 100644
index de0b284b36..0000000000
--- a/ext/fcntl/fcntl.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/************************************************
-
-  fcntl.c -
-
-  $Author$
-  created at: Mon Apr  7 18:53:05 JST 1997
-
-  Copyright (C) 1997-2001 Yukihiro Matsumoto
-
-************************************************/
-
-/************************************************
-= NAME
-
-fcntl - load the C fcntl.h defines
-
-= SYNOPSIS
-
-    require "fcntl"
-    m = s.fcntl(Fcntl::F_GETFL, 0)
-    f.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK|m)
-
-= DESCRIPTION
-
-This module is just a translation of the C  file.
-
-= NOTE
-
-Only #define symbols get translated; you must still correctly
-pack up your own arguments to pass as args for locking functions, etc.
-
-************************************************/
-
-#include "ruby.h"
-#include 
-
-void
-Init_fcntl()
-{
-    VALUE mFcntl = rb_define_module("Fcntl");
-#ifdef F_DUPFD
-    rb_define_const(mFcntl, "F_DUPFD", INT2NUM(F_DUPFD));
-#endif
-#ifdef F_GETFD
-    rb_define_const(mFcntl, "F_GETFD", INT2NUM(F_GETFD));
-#endif
-#ifdef F_GETLK
-    rb_define_const(mFcntl, "F_GETLK", INT2NUM(F_GETLK));
-#endif
-#ifdef F_SETFD
-    rb_define_const(mFcntl, "F_SETFD", INT2NUM(F_SETFD));
-#endif
-#ifdef F_GETFL
-    rb_define_const(mFcntl, "F_GETFL", INT2NUM(F_GETFL));
-#endif
-#ifdef F_SETFL
-    rb_define_const(mFcntl, "F_SETFL", INT2NUM(F_SETFL));
-#endif
-#ifdef F_SETLK
-    rb_define_const(mFcntl, "F_SETLK", INT2NUM(F_SETLK));
-#endif
-#ifdef F_SETLKW
-    rb_define_const(mFcntl, "F_SETLKW", INT2NUM(F_SETLKW));
-#endif
-#ifdef FD_CLOEXEC
-    rb_define_const(mFcntl, "FD_CLOEXEC", INT2NUM(FD_CLOEXEC));
-#endif
-#ifdef F_RDLCK
-    rb_define_const(mFcntl, "F_RDLCK", INT2NUM(F_RDLCK));
-#endif
-#ifdef F_UNLCK
-    rb_define_const(mFcntl, "F_UNLCK", INT2NUM(F_UNLCK));
-#endif
-#ifdef F_WRLCK
-    rb_define_const(mFcntl, "F_WRLCK", INT2NUM(F_WRLCK));
-#endif
-#ifdef O_CREAT
-    rb_define_const(mFcntl, "O_CREAT", INT2NUM(O_CREAT));
-#endif
-#ifdef O_EXCL
-    rb_define_const(mFcntl, "O_EXCL", INT2NUM(O_EXCL));
-#endif
-#ifdef O_NOCTTY
-    rb_define_const(mFcntl, "O_NOCTTY", INT2NUM(O_NOCTTY));
-#endif
-#ifdef O_TRUNC
-    rb_define_const(mFcntl, "O_TRUNC", INT2NUM(O_TRUNC));
-#endif
-#ifdef O_APPEND
-    rb_define_const(mFcntl, "O_APPEND", INT2NUM(O_APPEND));
-#endif
-#ifdef O_NONBLOCK
-    rb_define_const(mFcntl, "O_NONBLOCK", INT2NUM(O_NONBLOCK));
-#endif
-#ifdef O_NDELAY
-    rb_define_const(mFcntl, "O_NDELAY", INT2NUM(O_NDELAY));
-#endif
-#ifdef O_RDONLY
-    rb_define_const(mFcntl, "O_RDONLY", INT2NUM(O_RDONLY));
-#endif
-#ifdef O_RDWR
-    rb_define_const(mFcntl, "O_RDWR", INT2NUM(O_RDWR));
-#endif
-#ifdef O_WRONLY
-    rb_define_const(mFcntl, "O_WRONLY", INT2NUM(O_WRONLY));
-#endif
-}
diff --git a/ext/gdbm/.cvsignore b/ext/gdbm/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/gdbm/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/gdbm/MANIFEST b/ext/gdbm/MANIFEST
deleted file mode 100644
index 1359b4fdaf..0000000000
--- a/ext/gdbm/MANIFEST
+++ /dev/null
@@ -1,6 +0,0 @@
-MANIFEST
-README
-depend
-extconf.rb
-gdbm.c
-testgdbm.rb
diff --git a/ext/gdbm/README b/ext/gdbm/README
deleted file mode 100644
index df7a261c68..0000000000
--- a/ext/gdbm/README
+++ /dev/null
@@ -1 +0,0 @@
-gdbm ext-library for Ruby 1.3 or later
diff --git a/ext/gdbm/depend b/ext/gdbm/depend
deleted file mode 100644
index c080a81619..0000000000
--- a/ext/gdbm/depend
+++ /dev/null
@@ -1 +0,0 @@
-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
deleted file mode 100644
index 5a09492e5e..0000000000
--- a/ext/gdbm/extconf.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-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
deleted file mode 100644
index d30f5dec7a..0000000000
--- a/ext/gdbm/gdbm.c
+++ /dev/null
@@ -1,994 +0,0 @@
-/************************************************
-
-  gdbm.c -
-
-  $Author$
-  $Date$
-  modified at: Mon Jan 24 15:59:52 JST 1994
-
-************************************************/
-
-#include "ruby.h"
-
-#include 
-#include 
-#include 
-
-static VALUE rb_cGDBM, rb_eGDBMError, rb_eGDBMFatalError;
-
-#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) {\
-    Data_Get_Struct(obj, struct dbmdata, dbmp);\
-    if (dbmp == 0) closed_dbm();\
-    if (dbmp->di_dbm == 0) closed_dbm();\
-}
-
-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_new(argc, argv, klass)
-    int argc;
-    VALUE *argv;
-    VALUE klass;
-{
-    VALUE obj = Data_Wrap_Struct(klass, 0, free_dbm, 0);
-    rb_obj_call_init(obj, argc, argv);
-    return obj;
-}
-
-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);
-
-    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);
-    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 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 {
-        for (i=0; iptr;
-    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_secure(4);
-    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_secure(4);
-    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_secure(4);
-    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(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_secure(4);
-    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_secure(4);
-    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_secure(4);
-    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_singleton_method(rb_cGDBM, "new", fgdbm_s_new, -1);
-    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, "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_opn() */
-    /*
-    rb_define_const(rb_cGDBM, "READER",  INT2FIX(GDBM_READER));
-    rb_define_const(rb_cGDBM, "WRITER",  INT2FIX(GDBM_WRITER));
-    rb_define_const(rb_cGDBM, "WRCREAT", INT2FIX(GDBM_WRCREAT));
-    rb_define_const(rb_cGDBM, "NEWDB",   INT2FIX(GDBM_NEWDB));
-    */
-    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
deleted file mode 100644
index 524d3f8ca3..0000000000
--- a/ext/gdbm/testgdbm.rb
+++ /dev/null
@@ -1,663 +0,0 @@
-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_select
-    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.select(*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
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/iconv/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/iconv/MANIFEST b/ext/iconv/MANIFEST
deleted file mode 100644
index 643f3b7f4d..0000000000
--- a/ext/iconv/MANIFEST
+++ /dev/null
@@ -1,4 +0,0 @@
-MANIFEST
-extconf.rb
-iconv.c
-depend
diff --git a/ext/iconv/depend b/ext/iconv/depend
deleted file mode 100644
index 688ddd97b7..0000000000
--- a/ext/iconv/depend
+++ /dev/null
@@ -1,2 +0,0 @@
-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
deleted file mode 100644
index 55d9c5da5f..0000000000
--- a/ext/iconv/extconf.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'mkmf'
-
-dir_config("iconv")
-
-if have_header("iconv.h")
-  have_library("iconv")
-  create_makefile("iconv")
-end
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
deleted file mode 100644
index a7b1b4118e..0000000000
--- a/ext/iconv/iconv.c
+++ /dev/null
@@ -1,738 +0,0 @@
-/* -*- 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).
-
-**********************************************************************/
-
-/*
-=begin
-= Summary
-Ruby extension for codeset conversion.
-
-= Abstract
-Iconv is a wrapper class for UNIX 95 (({iconv()})) function family, which
-translates string between various coding systems.
-
-See (())'s on-line documents for more details.
-* (())
-* (())
-* (())
-* (())
-
-Which coding systems are available, it depends on the platform.
-
-=end
-*/
-
-#include 
-#include 
-#include 
-#include "ruby.h"
-#include "intern.h"
-
-/* 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;
-};
-
-static VALUE rb_eIconvFailure;
-static VALUE rb_eIconvIllegalSeq;
-static VALUE rb_eIconvInvalidChar;
-static VALUE rb_eIconvOutOfRange;
-static ID rb_inserter;
-
-static ID rb_success, rb_failed, rb_mesg;
-static VALUE iconv_failure_initialize _((VALUE error, VALUE success, VALUE failed, struct iconv_env_t* env));
-static VALUE iconv_failure_success _((VALUE self));
-static VALUE iconv_failure_failed _((VALUE self));
-
-static iconv_t iconv_create _((VALUE to, VALUE from));
-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));
-
-
-/*
-=begin
-= Classes & Modules
-=end
-*/
-
-/*
-=begin
-== Iconv
-=end
-*/
-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 = StringValuePtr(to);
-    const char* fromcode = StringValuePtr(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 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;
-}
-
-#define ICONV_FREE (RUBY_DATA_FUNC)iconv_free
-
-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 */
-{
-    if (iconv(cd, (char **)inptr, inlen, outptr, outlen) == (size_t)-1) {
-	if (!*inlen)
-	    return Qfalse;
-	switch (errno) {
-	  case E2BIG:
-	    /* try the left in next loop */
-	    break;
-	  case EILSEQ:
-	    return rb_class_new_instance(0, 0, rb_eIconvIllegalSeq);
-	  case EINVAL:
-	    return rb_class_new_instance(0, 0, rb_eIconvInvalidChar);
-	  default:
-	    rb_sys_fail("iconv");
-	}
-    }
-    else if (*inlen > 0) {
-	/* something goes wrong */
-	return rb_class_new_instance(0, 0, rb_eIconvIllegalSeq);
-    }
-    return Qfalse;
-}
-
-#define iconv_fail(error, success, failed, env) \
-	rb_exc_raise(iconv_failure_initialize(error, success, failed, env))
-
-static VALUE
-iconv_failure_initialize
-#ifdef HAVE_PROTOTYPES
-(VALUE error, VALUE success, VALUE failed, struct iconv_env_t* env)
-#else /* HAVE_PROTOTYPES */
-    (error, success, failed, env)
-    VALUE error;
-    VALUE success;
-    VALUE failed;
-    struct iconv_env_t *env;
-#endif /* HAVE_PROTOTYPES */
-{
-    if (!rb_ivar_defined(error, rb_mesg) || NIL_P(rb_ivar_get(error, rb_mesg)))
-	rb_ivar_set(error, rb_mesg, rb_inspect(failed));
-    if (env) {
-	success = rb_funcall3(env->ret, rb_inserter, 1, &success);
-	if (env->argc > 0) {
-	    *(env->argv) = failed;
-	    failed = rb_ary_new4(env->argc, env->argv);
-	}
-    }
-    rb_ivar_set(error, rb_success, success);
-    rb_ivar_set(error, rb_failed, failed);
-    return error;
-}
-
-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;
-    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;
-    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 (error)
-	    iconv_fail(error, Qnil, Qnil, env);
-
-	inptr = NULL;
-	length = 0;
-    }
-    else {
-	int slen;
-
-	Check_Type(str, T_STRING);
-	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 {
-	const char *tmpstart = inptr;
-	outptr = buffer;
-	outlen = sizeof(buffer);
-
-	error = iconv_try(cd, &inptr, &inlen, &outptr, &outlen);
-
-	if (0 <= outlen && outlen <= sizeof(buffer)) {
-	    outlen = sizeof(buffer) - outlen;
-	    if (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 */
-	    char errmsg[50];
-	    sprintf(errmsg, "bug?(output length = %d)", sizeof(buffer) - outlen);
-	    error = rb_exc_new2(rb_eIconvOutOfRange, errmsg);
-	}
-
-	if (error) {
-	    if (!ret)
-		ret = rb_str_derive(str, instart, inptr - instart);
-	    str = rb_str_derive(str, inptr, inlen);
-	    iconv_fail(error, ret, str, env);
-	}
-    } while (inlen > 0);
-
-    if (!ret)
-	ret = rb_str_derive(str, instart, inptr - instart);
-    return ret;
-}
-
-
-/*
-=begin
-=== Class methods
-=end
-*/
-/*
-=begin
---- Iconv.new(to, from) {|cd| ...}
-    Creates new code converter from a coding-system designated with ((|from|))
-    to another one designated with ((|to|)).
-    :Parameters
-      :((|to|))
-        coding-system name for destination.
-      :((|from|))
-        coding-system name for source.
-    :Exceptions
-      :(({TypeError}))
-        if ((|to|)) or ((|from|)) aren't String
-      :(({ArgumentError}))
-        if designated converter couldn't find out.
-      :(({SystemCallError}))
-        when (({iconv_open(3)})) failed.
-
---- Iconv.open(to, from)
-    Equivalents to (()) except with in the case of called
-    with a block, yields with the new instance and closes it, and
-    returns the result which returned from the block.
-=end
-*/
-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);
-}
-
-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((VALUE)(DATA_PTR(self)));
-    DATA_PTR(self) = NULL;
-    DATA_PTR(self) = (void *)ICONV2VALUE(iconv_create(to, from));
-    return self;
-}
-
-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));
-
-    if (rb_block_given_p()) {
-	self = Data_Wrap_Struct(self, NULL, NULL, (void *)cd);
-	return rb_ensure(rb_yield, self, (VALUE(*)())iconv_finish, self);
-    }
-    else {
-	return Data_Wrap_Struct(self, NULL, ICONV_FREE, (void *)cd);
-    }
-}
-
-/*
-=begin
---- Iconv.iconv(to, from, *strs)
-    Shorthand for
-      Iconv.open(to, from) {|cd| (strs + [nil]).collect {|s| cd.iconv(s)}}
-    :Parameters
-      :((|to|)), ((|from|))
-        see (()).
-      :((|strs|))
-        strings to be converted.
-    :Exceptions
-      exceptions thrown by (()), (()) and
-      (()).
-=end
-*/
-
-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);
-	rb_funcall3(env->ret, rb_inserter, 1, &s);
-    }
-
-    if (!NIL_P(last)) {
-	VALUE s = iconv_convert(env->cd, Qnil, 0, 0, env);
-	if (RSTRING(s)->len)
-	    rb_funcall3(env->ret, rb_inserter, 1, &s);
-    }
-
-    return env->ret;
-}
-
-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 # of arguments (%d for %d)", argc, 2);
-
-    arg.argc = argc -= 2;
-    arg.argv = argv + 2;
-    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));
-}
-
-
-/*
-=begin
-=== Instance methods
-=end
-*/
-/*
-=begin
---- Iconv#close
-    Finishes conversion.
-    * After calling this, invoking method (()) will cause
-      exception, but multiple calls of (({close})) are guaranteed to
-      end successfully.
-    * Returns a string contains the byte sequence to change the
-      output buffer to its initial shift state.
-=end
-*/
-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_Type(self, T_DATA);
-
-    cd = (VALUE)DATA_PTR(self);
-    if (!cd) return Qnil;
-    DATA_PTR(self) = NULL;
-
-    return rb_ensure(iconv_init_state, cd, iconv_free, cd);
-}
-
-/*
-=begin
---- Iconv#iconv(str, [ start = 0, [ length = -1 ] ])
-    Converts string and returns converted one.
-    * In the case of ((|str|)) is (({String})), converts (({str[start, length]})).
-      Returns converted string.
-    * In the case of ((|str|)) is (({nil})), places ((|converter|))
-      itself into initial shift state and just returns a string contains
-      the byte sequence to change the output buffer to its initial shift
-      state.
-    * Otherwise, causes exception.
-    :Parameters
-      :((|str|))
-        string to be converted or (({nil})).
-      :((|start|))
-        starting offset.
-      :((|length|))
-        conversion length,
-        (({nil})) or (({-1})) means whole string from (({start})).
-    :Exceptions
-      * (())
-      * (())
-      * (())
-=end
-*/
-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;
-
-    Check_Type(self, T_DATA);
-
-    n1 = n2 = Qnil;
-    rb_scan_args(argc, argv, "12", &str, &n1, &n2);
-
-    return iconv_convert(VALUE2ICONV(DATA_PTR(self)), str,
-			 NIL_P(n1) ? 0 : NUM2INT(n1),
-			 NIL_P(n2) ? -1 : NUM2INT(n1),
-			 NULL);
-}
-
-
-/*
-=begin
-= Exceptions
-=end
-*/
-/*
-=begin
-== Iconv::Failure
-Base exceptional attributes from (()).
-
-=== Instance methods
-=end
-*/
-/*
-=begin
---- Iconv::Failure#success
-    Returns string(s) translated successfully until the exception occurred.
-    * In the case of failure occurred within (()), returned
-      value is an array of strings translated successfully preceding
-      failure and the last element is string on the way.
-=end
-*/
-static VALUE
-iconv_failure_success
-#ifdef HAVE_PROTOTYPES
-(VALUE self)
-#else /* HAVE_PROTOTYPES */
-    (self)
-    VALUE self;
-#endif /* HAVE_PROTOTYPES */
-{
-    return rb_ivar_get(self, rb_success);
-}
-
-/*
-=begin
---- Iconv::Failure#failed
-    Returns substring of the original string passed to (()) that
-    starts at the character caused the exception. 
-=end
-*/
-static VALUE
-iconv_failure_failed
-#ifdef HAVE_PROTOTYPES
-(VALUE self)
-#else /* HAVE_PROTOTYPES */
-    (self)
-    VALUE self;
-#endif /* HAVE_PROTOTYPES */
-{
-    return rb_ivar_get(self, rb_failed);
-}
-
-/*
-=begin
---- Iconv::Failure#inspect
-    Returns inspected string like as: #<(({type})): "(({success}))", "(({failed}))">
-=end
-*/
-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 = iconv_failure_success(self);
-    VALUE failed = iconv_failure_failed(self);
-    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);
-}
-
-/*
-  Hmmm, I don't like to write RD inside of function :-<.
-
-=begin
-== 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::InvalidCharacter
-Input conversion stopped due to an incomplete character or shift
-sequence at the end of the input buffer.
-=== Superclass
-(({ArgumentError}))
-=== Included Modules
-(())
-
-== Iconv::OutOfRange
-Iconv library internal error.  Must not occur.
-=== Superclass
-(({RuntimeError}))
-=== Included Modules
-(())
-=end
-*/
-
-void
-Init_iconv _((void))
-{
-    VALUE rb_cIconv = rb_define_class("Iconv", rb_cData);
-    rb_define_singleton_method(rb_cIconv, "allocate", iconv_s_allocate, 0);
-    rb_define_singleton_method(rb_cIconv, "open", iconv_s_open, 2);
-    rb_define_singleton_method(rb_cIconv, "iconv", iconv_s_iconv, -1);
-    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, "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_inserter = rb_intern("<<");
-    rb_success = rb_intern("success");
-    rb_failed = rb_intern("failed");
-    rb_mesg = rb_intern("mesg");
-}
-
-
-/*
-=begin
-== Example
-(1) Instantiate a new (()), use method (()).
-      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 (()) 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)
-=end
-*/
diff --git a/ext/nkf/.cvsignore b/ext/nkf/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/nkf/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/nkf/MANIFEST b/ext/nkf/MANIFEST
deleted file mode 100644
index 5114a3762a..0000000000
--- a/ext/nkf/MANIFEST
+++ /dev/null
@@ -1,7 +0,0 @@
-MANIFEST
-depend
-extconf.rb
-lib/kconv.rb
-nkf.c
-nkf1.7/nkf.c
-test.rb
diff --git a/ext/nkf/depend b/ext/nkf/depend
deleted file mode 100644
index 13e32e6074..0000000000
--- a/ext/nkf/depend
+++ /dev/null
@@ -1 +0,0 @@
-nkf.o : nkf.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h $(srcdir)/nkf1.7/nkf.c
diff --git a/ext/nkf/extconf.rb b/ext/nkf/extconf.rb
deleted file mode 100644
index 710662f19c..0000000000
--- a/ext/nkf/extconf.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require 'mkmf'
-create_makefile('nkf')
diff --git a/ext/nkf/lib/kconv.rb b/ext/nkf/lib/kconv.rb
deleted file mode 100644
index af6d82275f..0000000000
--- a/ext/nkf/lib/kconv.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-require 'nkf'
-
-module Kconv
-  AUTO = NKF::AUTO
-  JIS = NKF::JIS
-  EUC = NKF::EUC
-  SJIS = NKF::SJIS
-  BINARY = NKF::BINARY
-  NOCONV = NKF::NOCONV
-  UNKNOWN = NKF::UNKNOWN
-  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'
-    end
-
-    case out_code
-    when NKF::JIS
-      opt << 'j'
-    when NKF::EUC
-      opt << 'e'
-    when NKF::SJIS
-      opt << 's'
-    when NKF::NOCONV
-      return str
-    end
-
-    opt = '' if opt == '-'
-
-    NKF::nkf(opt, str)
-  end
-  module_function :kconv
-
-  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 guess(str)
-    NKF::guess(str)
-  end
-  module_function :guess
-end
-
-class String
-  def kconv(out_code, in_code=Kconv::AUTO)
-    Kconv::kconv(self, out_code, in_code)
-  end
-  def tojis
-    NKF::nkf('-j', self)
-  end
-  def toeuc
-    NKF::nkf('-e', self)
-  end
-  def tosjis
-    NKF::nkf('-s', self)
-  end
-end
diff --git a/ext/nkf/nkf.c b/ext/nkf/nkf.c
deleted file mode 100644
index 50723467cd..0000000000
--- a/ext/nkf/nkf.c
+++ /dev/null
@@ -1,197 +0,0 @@
-#include "ruby.h"
-
-#define	_AUTO		0
-#define	_JIS		1
-#define	_EUC		2
-#define	_SJIS		3
-#define	_BINARY		4
-#define	_NOCONV		4
-#define	_UNKNOWN	_AUTO
-
-#undef getc
-#undef ungetc
-#define getc(f)   	(input_ctr= o_len) {
-    o_len += incsize;
-    rb_str_cat(dst, 0, incsize);
-    output = RSTRING(dst)->ptr;
-    incsize *= 2;
-  }
-  output[output_ctr++] = c;
-
-  return c;
-}
-
-#define PERL_XS 1
-#include "nkf1.7/nkf.c"
-
-static VALUE
-rb_nkf_kconv(obj, opt, src)
-     VALUE obj, opt, src;
-{
-  char *opt_ptr, *opt_end;
-  volatile VALUE v;
-
-  reinit();
-  StringValue(opt);
-  opt_ptr = RSTRING(opt)->ptr;
-  opt_end = opt_ptr + RSTRING(opt)->len;
-  for (; opt_ptr < opt_end; opt_ptr++) {
-    if (*opt_ptr != '-') {
-      continue;
-    }
-    arguments(opt_ptr);
-  }
-
-  incsize = INCSIZE;
-
-  input_ctr = 0; 
-  StringValue(src);
-  input = RSTRING(src)->ptr;
-  i_len = RSTRING(src)->len;
-  dst = rb_str_new(0, i_len*3 + 10);
-  v = dst;
-
-  output_ctr = 0;
-  output     = RSTRING(dst)->ptr;
-  o_len      = RSTRING(dst)->len;
-  *output    = '\0';
-
-  if(iso8859_f && (oconv != j_oconv || !x0201_f )) {
-    iso8859_f = FALSE;
-  } 
-
-  kanji_convert(NULL);
-  RSTRING(dst)->ptr[output_ctr] = '\0';
-  RSTRING(dst)->len = output_ctr;
-  OBJ_INFECT(dst, src);
-
-  return dst;
-}
-
-/*
- * Character code detection - Algorithm described in:
- * Ken Lunde. `Understanding Japanese Information Processing'
- * Sebastopol, CA: O'Reilly & Associates.
- */
-
-static VALUE
-rb_nkf_guess(obj, src)
-     VALUE obj, src;
-{
-  unsigned char *p;
-  unsigned char *pend;
-  int sequence_counter = 0;
-
-  StringValue(src);
-  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= 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_nkf()
-{
-    VALUE mKconv = rb_define_module("NKF");
-
-    rb_define_module_function(mKconv, "nkf", rb_nkf_kconv, 2);
-    rb_define_module_function(mKconv, "guess", rb_nkf_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));
-}
diff --git a/ext/nkf/nkf1.7/nkf.c b/ext/nkf/nkf1.7/nkf.c
deleted file mode 100644
index 09419f40a7..0000000000
--- a/ext/nkf/nkf1.7/nkf.c
+++ /dev/null
@@ -1,1900 +0,0 @@
-/** Network Kanji Filter. (PDS Version)
-************************************************************************
-** Copyright (C) 1987, Fujitsu LTD. (Itaru ICHIKAWA)
-** $BO"Mm@h!'(B $B!J3t!KIY;NDL8&5f=j!!%=%U%H#38&!!;T@n!!;j(B 
-** $B!J(BE-Mail Address: ichikawa@flab.fujitsu.co.jp$B!K(B
-** Copyright (C) 1996,1998
-** $BO"Mm@h!'(B $BN05eBg3X>pJs9)3X2J(B $B2OLn(B $B??<#(B  mine/X0208 support
-** $B!J(BE-Mail Address: kono@ie.u-ryukyu.ac.jp$B!K(B
-** $BO"Mm@h!'(B COW for DOS & Win16 & Win32 & OS/2
-** $B!J(BE-Mail Address: GHG00637@niftyserve.or.p$B!K(B
-**    $B$3$N%=!<%9$N$$$+$J$kJ#Z$b$7$J$$!"0-$7$+$i$:!#(B
-**    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.
-***********************************************************************/
-
-static char *CopyRight =
-      "Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa),1998 S. Kono, COW";
-static char *Version =
-      "1.7";
-static char *Patchlevel =
-      "0/9711/Shinji Kono";
-
-/*
-**
-**
-**
-** 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 
-**/
-/******************************/
-/* $B%G%U%)%k%H$N=PNO%3!<%IA*Br(B */
-/* Select DEFAULT_CODE */
-#define DEFAULT_CODE_JIS
-/* #define DEFAULT_CODE_SJIS */
-/* #define DEFAULT_CODE_EUC */
-/******************************/
-
-#if (defined(__TURBOC__) || defined(LSI_C)) && !defined(MSDOS)
-#define MSDOS
-#endif
-
-#ifndef PERL_XS
-#include 
-#endif
-
-#if defined(MSDOS) || defined(__OS2__) 
-#include 
-#include 
-#include 
-#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 
-#endif
-
-#define         FALSE   0
-#define         TRUE    1
-
-/* 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         SPACE   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 */
-
-#undef STRICT_MIME       /* do stupid strict mime integrity check */
-#define GETC(p) ((!mime_mode)?getc(p):mime_getc(p))
-#define UNGETC(c,p)     ((!mime_mode)?ungetc(c,p):mime_ungetc(c))
-
-
-#ifdef EASYWIN /*Easy Win */
-extern POINT _BufferSize;
-#endif
-
-/*      function prototype  */
-
-#ifndef _
-# ifdef __STDC__
-#  define _(args) args
-# else
-#  define _(args) ()
-# endif
-#endif
-
-#ifndef PERL_XS
-static  void    noconvert _((FILE *f));
-static  int     mime_integrity _((FILE *f,unsigned char *p));
-static  int     usage _((void));
-static char            stdibuf[IOBUF_SIZE];
-static char            stdobuf[IOBUF_SIZE];
-static unsigned int            mime_input = 0; /* undecoded */
-static int             end_check;
-#endif
-
-static  void    kanji_convert _((FILE *f));
-static  void    h_conv _((FILE *f,int c2,int c1));
-static  int     push_hold_buf _((int c2,int c1));
-static  void    s_iconv _((int c2,int c1));
-static  void    e_oconv _((int c2,int c1));
-static  void    s_oconv _((int c2,int c1));
-static  void    j_oconv _((int c2,int c1));
-static  int     line_fold _((int c2,int c1));
-static  int     pre_convert _((int c1,int c2));
-static  int     mime_begin _((FILE *f));
-static  int     mime_getc _((FILE *f));
-static  int     mime_ungetc _((unsigned int c));
-static  int     base64decode _((int c));
-static  void    arguments _((char *c));
-static  void    reinit _((void));
-
-/* buffers */
-
-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 */
-
-/* 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             input_f = FALSE;        /* non fixed input code  */
-static int             alpha_f = FALSE;        /* convert JIx0208 alphbet to ASCII */
-static int             mime_f = TRUE;         /* 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 */
-
-int line_fold();
-#define FOLD_MARGIN  10
-#define DEFAULT_FOLD 60
-
-/* 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
-
-static void            (*iconv) _((int c2,int c1));
-					/* s_iconv or oconv */
-static void            (*oconv) _((int c2,int c1)) = DEFAULT_CONV; 
-					  /* [ejs]_oconv */
-
-/* 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 */
-
-/* X0201 / X0208 conversion tables */
-
-/* X0201 kana conversion table */
-/* 90-9F A0-DF */
-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 */
-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 */
-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 */
-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
-} ;
-
-
-static int             file_out = FALSE;
-static int             add_cr = FALSE;
-static int             del_cr = FALSE;
-
-#ifndef PERL_XS
-int
-main(argc, argv)
-    int             argc;
-    char          **argv;
-{
-    FILE  *fin;
-    char  *cp;
-
-#ifdef EASYWIN /*Easy Win */
-    _BufferSize.y = 400;/*Set Scroll Buffer Size*/
-#endif
-
-    for (argc--,argv++; (argc > 0) && **argv == '-'; argc--, argv++) {
-        cp = *argv;
-	arguments(cp);
-    }
-
-    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);
-      if(nop_f)
-          noconvert(stdin);
-      else
-          kanji_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);
-              if(nop_f)
-                  noconvert(fin);
-              else
-                  kanji_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
-
-static void
-arguments(cp) 
-    char *cp;
-{
-    while (*cp) {
-	switch (*cp++) {
-	case 'b':           /* buffered mode */
-	    unbuf_f = FALSE;
-	    continue;
-	case 'u':           /* non bufferd mode */
-	    unbuf_f = TRUE;
-	    continue;
-	case 't':           /* transparent mode */
-	    nop_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
-#ifndef PERL_XS
-	case 'v':
-	    usage();
-	    exit(1);
-	    break;
-#endif
-	/* 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= *cp && *cp>='0') 
-		broken_f |= 1<<(*cp++ -'0');
-	    else 
-		broken_f |= TRUE;
-	    continue;
-#ifndef PERL_XS
-	case 'O':/* for Output file */
-	    file_out = TRUE;
-	    continue;
-#endif
-	case 'c':/* add cr code */
-	    add_cr = TRUE;
-	    continue;
-	case 'd':/* delete cr code */
-	    del_cr = TRUE;
-	    continue;
-	default:
-	    /* bogus option but ignored */
-	    continue;
-	}
-    }
-}
-
-#ifndef PERL_XS
-static void
-noconvert(f)
-    FILE  *f;
-{
-    int    c;
-
-    while ((c = getc(f)) != EOF)
-      putchar(c);
-}
-#endif
-
-
-static void
-kanji_convert(f)
-    FILE  *f;
-{
-    int    c1, c2;
-
-    c2 = 0;
-
-    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;
-
-#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(f)) != EOF) {
-        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(f, 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 <= SPACE)) {
-                    /* 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(f)) == EOF) {
-                                    (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]);
-                                    LAST;
-                                } else if(c2==(0xde)) { /* $BByE@(B */
-                                    (*oconv)(dv[(c1-SSP)*2],dv[(c1-SSP)*2+1]);
-                                    c2=0; 
-                                    NEXT;
-                                } else if(c2==(0xdf)&&ev[(c1-SSP)*2]) { 
-                                    /* $BH>ByE@(B */
-                                    (*oconv)(ev[(c1-SSP)*2],ev[(c1-SSP)*2+1]);
-                                    c2=0; 
-                                    NEXT;
-                                } 
-                                UNGETC(c2,f); 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(f);  /* skip SSO */
-                        euc_1byte_check:
-                        if(x0201_f && SSP<=c1 && c1<0xe0) {
-                            if(dv[(c1-SSP)*2]||ev[(c1-SSP)*2]) {
-                                if((c2 = GETC(f)) == EOF) {
-                                    (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]);
-                                    LAST;
-                                }
-                                /* forward lookup $BByE@(B/$BH>ByE@(B */
-                                if(c2 != SSO) {
-                                    UNGETC(c2,f); c2 = 0; 
-                                    (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]);
-                                    NEXT;
-                                } else if((c2 = GETC(f)) == EOF) {
-                                    (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]);
-                                    (*oconv)(0,SSO); 
-                                    LAST;
-                                } else if(c2==(0xde)) { /* $BByE@(B */
-                                    (*oconv)(dv[(c1-SSP)*2],dv[(c1-SSP)*2+1]);
-                                    c2=0; 
-                                    NEXT;
-                                } else if(c2==(0xdf)&&ev[(c1-SSP)*2]) { 
-                                    /* $BH>ByE@(B */
-                                    (*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 > SPACE) && (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(f)) == EOF) {
-                                (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]);
-                                LAST;
-                            } else if(c2==(0xde&0x7f)) { /* $BByE@(B */
-                                (*oconv)(dv[(c1-SSP)*2],dv[(c1-SSP)*2+1]);
-                                c2=0; 
-                                NEXT;
-                            } else if(c2==(0xdf&0x7f)&&ev[(c1-SSP)*2]) {  
-                                /* $BH>ByE@(B */
-                                (*oconv)(ev[(c1-SSP)*2],ev[(c1-SSP)*2+1]);
-                                c2=0; 
-                                NEXT;
-                            }
-                            UNGETC(c2,f); 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(f)) == 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(f)) == EOF) {
-                        (*oconv)(0, '=');
-                        LAST;
-                    } else if(c1 == '?') {
-                        /* =? is mime conversiooon start sequence */
-                        if(mime_begin(f) == EOF) /* check in detail */
-                            LAST;
-                        else
-                            NEXT;
-                    } else {
-                        (*oconv)(0, '=');
-                        ungetc(c1,f);
-                        NEXT;
-                    }
-                } else if(c1 == '$' && broken_f && !mime_mode) {
-                    /* try to recover missing escape */
-                    if((c1 = GETC(f)) == 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(f)) == EOF) {
-                    (*oconv)(0, ESC);
-                    LAST;
-                } else if(c1 == '$') {
-                    if((c1 = GETC(f)) == 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(c1 == '(') {
-			if((c1 = GETC(f)) == EOF) {
-			    (*oconv)(0, ESC);
-			    (*oconv)(0, '$');
-			    (*oconv)(0, '(');
-			    LAST;
-			} else if(c1 == '@'|| c1 == 'B') {
-			    /* This is kanji introduction */
-			    input_mode = X0208;
-			    shift_mode = FALSE;
-			    NEXT;
-			} else {
-			    (*oconv)(0, ESC);
-			    (*oconv)(0, '$');
-			    (*oconv)(0, '(');
-			    (*oconv)(0, c1);
-			    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(f)) == 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);
-}
-
-
-
-
-static void
-h_conv(f, c2, c1)
-    FILE  *f;
-    int    c1, c2;
-{
-    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(f)) != 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)
-    int    c2,
-                    c1;
-{
-    if((c2 == EOF) || (c2 == 0)) {
-        /* NOP */
-    } else {
-        c2 = c2 + c2 - ((c2 <= 0x9f) ? SJ0162 : SJ6394);
-        if(c1 < 0x9f)
-            c1 = c1 - ((c1 > DEL) ? SPACE : 0x1f);
-        else {
-            c1 = c1 - 0x7e;
-            c2++;
-        }
-    }
-    (*oconv)(c2, c1);
-}
-
-
-static void
-e_oconv(c2, c1)
-    int    c2, c1;
-{
-    c2 = pre_convert(c1,c2); c1 = c1_return;
-    if(fold_f) {
-        switch(line_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> 1) + ((c2 <= 0x5e) ? 0x71 : 0xb1)));
-        putchar((c1 + ((c2 & 1) ? ((c1 < 0x60) ? 0x1f : 0x20) : 0x7e)));
-    }
-    return;
-}
-
-
-static void
-j_oconv(c2, c1)
-    int    c2, c1;
-{
-    c2 = pre_convert(c1,c2); c1 = c1_return;
-    if(fold_f) {
-        switch(line_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 || 0x7e0x80 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
-line_fold(c2,c1) 
-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; /* $B!+(B*/
-        if(c1==0xdf) return 1; /* $B!,(B*/
-        if(c1==0xa4) return 1; /* $B!#(B*/
-        if(c1==0xa3) return 1; /* $B!$(B*/
-        if(c1==0xa1) return 1; /* $B!W(B*/
-        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; /* $B!"(B */
-            if(c1=='#')  return 1; /* $B!#(B */
-            if(c1=='$')  return 1; /* $B!$(B */
-            if(c1=='%')  return 1; /* $B!%(B */
-            if(c1=='\'') return 1; /* $B!\(B */
-            if(c1=='(')  return 1; /* $B!((B */
-            if(c1==')')  return 1; /* $B!)(B */
-            if(c1=='*')  return 1; /* $B!*(B */
-            if(c1=='+')  return 1; /* $B!+(B */
-            if(c1==',')  return 1; /* $B!,(B */
-        }
-        line = 2;
-        return '\n'; /* add one new line before this character */
-    }
-}
-
-static int
-pre_convert(c1,c2)
-    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' ';i++) {                   /* start at =? */
-        if( ((((r[i] = c1 = getc(f))==EOF) || nkf_toupper(c1) != p[i] ) {
-            /* pattern fails, try next one */
-            q = p;
-            while (p = mime_pattern[++j]) {
-                for(k=2;k 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,f);
-            for(j=0;j> 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;
-}
-
-#ifdef STRICT_MIME
-int
-mime_integrity(f,p)
-    FILE *f;
-    unsigned char *p;
-{
-    int c,d;
-    unsigned int q;
-    /* In buffered mode, read until =? or NL or buffer fffull
-     */
-    mime_input = mime_top;
-    mime_last = mime_top;
-    while(*p) Fifo(mime_input++) = *p++;
-    d = 0;
-    q = mime_input;
-    while((c=getc(f))!=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;
-}
-#endif
-
-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);
-}
-
-static void 
-reinit()
-{
-    unbuf_f = FALSE;
-    estab_f = FALSE;
-    nop_f = FALSE;
-    binmode_f = TRUE;       
-    rot_f = FALSE;         
-    input_f = FALSE;      
-    alpha_f = FALSE;     
-    mime_f = TRUE;      
-    mimebuf_f = FALSE; 
-    broken_f = FALSE;  
-    iso8859_f = FALSE; 
-    x0201_f = TRUE;    
-    x0201_f = NO_X0201; 
-    fold_f  = FALSE;
-    kanji_intro = DEFAULT_J;
-    ascii_intro = DEFAULT_R;
-    oconv = DEFAULT_CONV; 
-    output_mode = ASCII;
-    input_mode =  ASCII;
-    shift_mode =  FALSE;
-    mime_mode =   FALSE;
-    file_out = FALSE;
-    add_cr = FALSE;
-    del_cr = FALSE;
-    line = 0;
-}
-
-#ifndef PERL_XS
-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[BQ0]   MIME decode [B:base64,Q:quoted,0:no decode]\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
-
-/**
- ** $B%Q%C%A@):n
- **  ohta@src.ricoh.co.jp (Junn Ohta)
- **  inouet@strl.nhk.or.jp (Tomoyuki Inoue)
- **  kiri@pulser.win.or.jp (Tetsuaki Kiriyama)
- **  Kimihiko Sato 
- **  a_kuroe@kuroe.aoba.yokohama.jp (Akihiko Kuroe)
- **  kono@ie.u-ryukyu.ac.jp (Shinji Kono)
- **  GHG00637@nifty-serve.or.jp (COW)
- **
- ** $B:G=*99?7F|(B
- **  1998.11.7
- **/
-
-/* end */
diff --git a/ext/nkf/test.rb b/ext/nkf/test.rb
deleted file mode 100644
index 4519f8ba7e..0000000000
--- a/ext/nkf/test.rb
+++ /dev/null
@@ -1,318 +0,0 @@
-$counter = 0
-def result(result, message = nil)
-  $counter += 1
-  printf("%s %d%s\n",
-	 result ? 'ok' : 'no', 
-	 $counter, 
-	 message ? ' ... ' + message : '')
-end
-
-begin
-  require 'nkf'
-  include NKF
-rescue LoadError
-  result(false)
-end
-result(true)
-
-if nkf('-me', '1')
-  result(true);
-else
-  result(false);
-end
-
-output = nkf('-e', "\033\$@#1#3#2%B")
-if output
-  # print output, "\n"
-  result(true, output)
-else
-  result(false)
-end
-
-output = nkf('-Zj', "\033\$@#1#3#2%B")
-if output
-  # print output, "\n"
-  result(true, output)
-else
-  result(false)
-end
-
-output = "\244\306 " * 1024
-old =  output.length
-output = nkf("-j", output)
-if output
-  # print output, "\n"
-  result(true, "#{old} #{output.length}")
-else
-    result(false)
-end
-
-
-$detail = false
-def test(opt, input, expect)
-  print "\nINPUT:\n", input if $detail
-  print "\nEXPECT:\n", expect if $detail
-  result = nkf(opt, input)
-  print "\nGOT:\n", result if $detail
-
-  print result == expect ? "Ok\n" : "Fail\n"
-  return result
-end
-
-# Basic Conversion
-print "\nBasic Conversion test\n\n"
-
-example = {}
-example['jis'] = <<'eofeof'.unpack('u')[0]
-M1FERED"6GIAR(%-E8V]N9"!3=&%G92"8I9=Y($AI
-M#28./
->@Y*#DR!+:6=O=2"!18&'@D^"8(._@]:$081@A+X*
-eofeof
-#'
-
-example['euc'] = <<'eofeof'.unpack('u')[0]
-M1FERI?*E\R!+:6=O=2"AIJ'GH["CP:;!IMBGHJ?!J,`*
-eofeof
-#'
-
-example['amb'] = <<'eofeof'.unpack('u')[0]
-MI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&E
-MPK"QI<*PL:7"L+&EPK"QI<(*I<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*P
-ML:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<(*I<*PL:7"L+&E
-MPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"
-ML+&EPK"QI<(*I<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"Q
-MI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<(*I<*PL:7"L+&EPK"QI<*PL:7"
-ML+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<(*
-eofeof
-
-example['amb.euc'] = <<'eofeof'.unpack('u')[0]
-M&R1")4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25"
-M,#$E0C`Q)4(P,25",#$E0C`Q)4(;*$(*&R1")4(P,25",#$E0C`Q)4(P,25"
-M,#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(;
-M*$(*&R1")4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P
-M,25",#$E0C`Q)4(P,25",#$E0C`Q)4(;*$(*&R1")4(P,25",#$E0C`Q)4(P
-M,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q
-M)4(;*$(*&R1")4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q
->)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(;*$(*
-eofeof
-
-example['amb.sjis'] = <<'eofeof'.unpack('u')[0]
-M&RA))4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25"
-M,#$E0C`Q)4(P,25",#$E0C`Q)4(;*$(*&RA))4(P,25",#$E0C`Q)4(P,25"
-M,#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(;
-M*$(*&RA))4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P
-M,25",#$E0C`Q)4(P,25",#$E0C`Q)4(;*$(*&RA))4(P,25",#$E0C`Q)4(P
-M,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q
-M)4(;*$(*&RA))4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q
->)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(;*$(*
-eofeof
-
-example['x0201.sjis'] = <<'eofeof'.unpack('u')[0]
-MD5.*<(-*@TR#3H-0@U*#2X--@T^#48-3"I%3B7""8()A@F*"8X)D@F6"9H*!
-M@H*"@X*$@H6"AH*'"I%3BTR-AH%)@9>!E(&0@9.!3X&5@9:!:8%J@7R!>X&!
-M@6V!;H%O@7"!CPJ4O(IPMK>X/;FZMMZWWKC>N=ZZWH+&"I2\BG#*W\O?S-_-
-MW\[?M]^QW@K*W\O?S`IH86YK86MU(,K?R]_,I`K*W\O?S-VA"I2\BG""S(SC
-!"@!"
-eofeof
-#'
-
-example['x0201.euc'] = <<'eofeof'.unpack('u')[0]
-MP;2ST:6KI:VEKZ6QI;.EK*6NI;"ELJ6T"L&TL=&CP:/"H\.CQ*/%H\:CQZ/A
-MH^*CXZ/DH^6CYJ/G"L&TM:VYYJ&JH?>A]*'PH?.AL*'UH?:ARJ'+H=VAW*'A
-MHCK>.WHZXCMZ.N8[>CKJ.
-MWJ3("LB^L]&.RH[?CLN.WX[,CM^.S8[?CLZ.WXZWCM^.L8[>"H[*CM^.RX[?
-MCLP*:&%N:V%K=2".RH[?CLN.WX[,CJ0*CLJ.WX[+CM^.S([=CJ$*R+ZST:3.
-#N.4*
-eofeof
-#'
-
-example['x0201.jis'] = <<'eofeof'.unpack('u')[0]
-M&R1"030S424K)2TE+R4Q)3,E+"4N)3`E,B4T&RA""ALD0D$T,5$C02-"(T,C
-M1"-%(T8C1R-A(V(C8R-D(V4C9B-G&RA""ALD0D$T-2TY9B$J(7.5XZ7ALD0B1(&RA""ALD0D@^,U$;*$E*7TM?3%]-7TY?
-M-U\Q7ALH0@H;*$E*7TM?3!LH0@IH86YK86MU(!LH24I?2U],)!LH0@H;*$E*
-97TM?3%TA&RA""ALD0D@^,U$D3CAE&RA""@``
-eofeof
-#`
-
-example['x0201.sosi'] = <<'eofeof'.unpack('u')[0]
-M&R1"030S424K)2TE+R4Q)3,E+"4N)3`E,B4T&RA*"ALD0D$T,5$C02-"(T,C
-M1"-%(T8C1R-A(V(C8R-D(V4C9B-G&RA*"ALD0D$T-2TY9B$J(7.5XZ7@\;)$(D2!LH2@H;)$)(/C-1&RA*#DI?2U],7TU?
-M3E\W7S%>#PH.2E]+7TP/&RA*"FAA;FMA:W4@#DI?2U],)`\;*$H*#DI?2U],
-672$/&RA*"ALD0D@^,U$D3CAE&RA""@``
-eofeof
-#"
-
-example['x0201.x0208'] = <<'eofeof'.unpack('u')[0]
-M&R1"030S424K)2TE+R4Q)3,E+"4N)3`E,B4T&RA""ALD0D$T,5$;*$)!0D-$
-M149'86)C9&5F9PH;)$)!-#4M.68;*$(A0",D)5XF*B@I+2L]6UU[?1LD0B%O
-M&RA""ALD0D@^,U$E*R4M)2\;*$(]&R1")3$E,R4L)2XE,"4R)30D2!LH0@H;
-M)$)(/C-1)5$E5"57)5HE724M(2PE(B$K&RA""ALD0B51)50E51LH0@IH86YK
-M86MU(!LD0B51)50E52$B&RA""ALD0B51)50E525S(2,;*$(*&R1"2#XS421.
-&.&4;*$(*
-eofeof
-#`
-
-example['mime.iso2022'] = <<'eofeof'.unpack('u')[0]
-M/3])4T\M,C`R,BU*4#]"/T=Y4D%.144W96E23TI566Q/4U9)1WEH2S\]"CT_
-M:7-O+3(P,C(M2E`_0C]'>5)!3D5%-V5I4D]*55EL3U-624=Y:$L_/0H]/VES
-M;RTR,#(R+4I0/U$_/3%")$(D1B11/3%"*$)?96YD/ST*&R1`)#TD)B0K)$H;
-M*$H@/3])4T\M,C`R,BU*4#]"/T=Y4D%.144W96E23U!Y:S=D:'-O4V<]/3\]
-M(&5N9"!O9B!L:6YE"CT_25-/+3(P,C(M2E`_0C]'>5)!3D5%-V5I4D]0>6LW
-M9&AS;U-G/3T_/2`]/TE33RTR,#(R+4I0/T(_1WE204Y%13=E:5)/4'EK-V1H
-M5)!3D5%-V5I
-44D]*55EL3QM;2U-624=Y:$L_/0H_
-eofeof
-#'
-
-example['mime.ans.strict'] = <<'eofeof'.unpack('u')[0]
-M&R1"-$$[>B1.)48E.25(&RA""ALD0C1!.WHD3B5&)3DE2!LH0@H;)$(D1B11
-M&RA"(&5N9`H;)$(D/20F)"LD2ALH0B`;)$(T03MZ)$X_*3MV&RA"96YD(&]F
-M(&QI;F4*&R1"-$$[>B1./RD[=C1!.WHD3C\I.W8;*$(*0G)O:V5N(&-A5)!3D5%-V5I4D]*55EL3QM;2U-624=Y:$L_/0H_
-eofeof
-#'
-
-example['mime.unbuf.strict'] = <<'eofeof'.unpack('u')[0]
-M&R1"-$$[>B1.)48E.25(&RA""ALD0C1!.WHD3B5&)3DE2!LH0@H;)$(D1B11
-M&RA"(&5N9`H;)$(D/20F)"LD2ALH0B`;)$(T03MZ)$X_*3MV&RA"96YD(&]F
-M(&QI;F4*&R1"-$$[>B1./RD[=C1!.WHD3C\I.W8;*$(*0G)O:V5N(&-AB1./RD;*$)H5)!
-M3D5%-V5I4D]0>6LW9&AS;U-G/3T_/0H;)$(T03MZ)$XE1ALH0EM+4U9)1WEH
-$2S\]"F5I
-eofeof
-
-example['mime.ans'] = <<'eofeof'.unpack('u')[0]
-M&R1"-$$[>B1.)48E.25(&RA""ALD0C1!.WHD3B5&)3DE2!LH0@H;)$(D1B11
-M&RA"(&5N9`H;)$(D/20F)"LD2ALH0B`;)$(T03MZ)$X_*3MV&RA"96YD(&]F
-M(&QI;F4*&R1"-$$[>B1./RD[=C1!.WHD3C\I.W8;*$(*0G)O:V5N(&-AB1./RD;*$)HB1./RD[=ALH0@H;)$(T
-603MZ)$XE1ALH0EM+4U9)1WEH2S\]"@`*
-eofeof
-#"
-
-example['mime.unbuf'] = <<'eofeof'.unpack('u')[0]
-M&R1"-$$[>B1.)48E.25(&RA""ALD0C1!.WHD3B5&)3DE2!LH0@H;)$(D1B11
-M&RA"(&5N9`H;)$(D/20F)"LD2ALH0B`;)$(T03MZ)$X_*3MV&RA"96YD(&]F
-M(&QI;F4*&R1"-$$[>B1./RD[=C1!.WHD3C\I.W8;*$(*0G)O:V5N(&-AB1./RD;*$)HB1./RD[=ALH0@H;)$(T
-603MZ)$XE1ALH0EM+4U9)1WEH2S\]"@`*
-eofeof
-#"
-
-example['mime.base64'] = <<'eofeof'.unpack('u')[0]
-M9W-M5"])3&YG$I+-&=Q=4,S24LS9W%Q0E%:3TUI-39,,S0Q-&=S5T)1
-M43!+9VUA1%9O3T@*9S)+1%1O3'=K8C)1;$E+;V=Q2T-X24MG9W5M0W%*3EEG
-<$E+9V=U;4,X64Q&9W)70S592VMG<6U""F=Q
-eofeof
-#"
-
-example['mime.base64.ans'] = <<'eofeof'.unpack('u')[0]
-M&R1")$M&?B1I)#LD1D0Z)"TD7B0Y)"PA(D5L-7XV83E9)$2P@1$5.34%22R`@7"`B36EN(&OF<&AEX0208 conversion
-# X0208 aphabet -> ASCII
-# X0201 相互変換
-
-print "\nX0201 test\n\n"
-
-# -X is necessary to allow X0201 in SJIS
-# -Z convert X0208 alphabet to ASCII
-print 'X0201 conversion: SJIS '
-test('-XZ', example['x0201.sjis'], example['x0201.x0208'])
-print 'X0201 conversion: JIS  '
-test('-Z',  example['x0201.jis'],  example['x0201.x0208'])
-print 'X0201 conversion:SI/SO '
-test('-Z',  example['x0201.sosi'], example['x0201.x0208'])
-print 'X0201 conversion: EUC  '
-test('-Z',  example['x0201.euc'],  example['x0201.x0208'])
-# -x means X0201 output
-print 'X0201 output: SJIS     '
-test('-xs', example['x0201.euc'],  example['x0201.sjis'])
-print 'X0201 output: JIS      '
-test('-xj', example['x0201.sjis'], example['x0201.jis'])
-print 'X0201 output: EUC      '
-test('-xe', example['x0201.jis'],  example['x0201.euc'])
-
-# MIME decode
-
-print "\nMIME test\n\n"
-
-# MIME ISO-2022-JP
-
-print "Next test is expeced to Fail.\n"
-
-print 'MIME decode (strict)   '
-tmp = test('-m', example['mime.iso2022'], example['mime.ans.strict'])
-print 'MIME decode (nonstrict)'
-tmp = test('-m', example['mime.iso2022'], example['mime.ans'])
-#    open(OUT,'>tmp1');print OUT pack('u',$tmp);close(OUT);
-# unbuf mode implies more pessimistic decode
-print 'MIME decode (unbuf)    '
-test('-mu', example['mime.iso2022'], example['mime.unbuf'])
-print 'MIME decode (base64)   '
-t = test('-mB', example['mime.base64'],  example['mime.base64.ans'])
-
-# MIME ISO-8859-1
-
-# Without -l, ISO-8859-1 was handled as X0201.
-
-print 'MIME ISO-8859-1 (Q)    '
-test('-ml', example['mime.is8859'], example['mime.is8859.ans'])
diff --git a/ext/pty/.cvsignore b/ext/pty/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/pty/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/pty/MANIFEST b/ext/pty/MANIFEST
deleted file mode 100644
index 0535a5b7ef..0000000000
--- a/ext/pty/MANIFEST
+++ /dev/null
@@ -1,12 +0,0 @@
-MANIFEST
-README
-README.expect
-README.expect.ja
-README.ja
-depend
-expect_sample.rb
-extconf.rb
-lib/expect.rb
-pty.c
-script.rb
-shl.rb
diff --git a/ext/pty/README b/ext/pty/README
deleted file mode 100644
index a09469d39c..0000000000
--- a/ext/pty/README
+++ /dev/null
@@ -1,93 +0,0 @@
-pty extension version 0.3 by A.ito
-
-1. Introduction
-
-This extension module adds ruby a functionality to execute an 
-arbitrary command through pseudo tty (pty).
-
-2. Install
-
-Follow the instruction below.
-
-(1) Execute
-
-      ruby extconf.rb
-
-    then Makefile is generated.
-
-(3) Do make; make install.
-
-3. What you can do
-
-This extension module defines a module named PTY, which contains
-following module fungtions:
-
-   getpty(command)
-   spawn(command)
-
-      This function reserves a pty, executes command over the pty 
-      and returns an array. The return value is an array with three
-      elements. The first element in the array is for reading and the 
-      second for writing. The third element is the process ID of the
-      child process. If this function is called with an iterator block,
-      the array is passed to the block as block parameters, and the
-      function itself returns nil.
-
-      While the process spawned by this function is active, SIGCHLD
-      is captured to handle the change of the child process. When the
-      child process is suspended or finished, an exception is raised.
-      As all SIGCHLD signal is captured and processed by PTY module,
-      you can't use other function or method which spawns subprosesses
-      (including signal() and IO.popen()) while the PTY subprocesses
-      are active. Otherwise, unexpected exception will occur. To avoid
-      this problem, see protect_signal() below.
-
-      If this function is called with an iterator block, SIGCHLD signal
-      is captured only within the block. Therefore, it is risky to use
-      File objects for PTY subprocess outside the iterator block.
-
-
-   protect_signal
-
-      This function takes an iterator block. Within the iterator block,
-      no exception is raised even if any subprocess is terminated.
-      This function is used to enable functions like system() or IO.popen()
-      while PTY subprocess is active. For example,
-
-        PTY.spawn("command_foo") do |r,w|
-          ...
-          ...
-          PTY.protect_signal do
-            system "some other commands"
-          end
-          ...
-        end
-
-      disables to send exception when "some other commands" is 
-      terminated. 
-
-    reset_signal
-
-      Disables to handle SIGCHLD while PTY subprocess is active.
-
-
-4. License
-
-(C) Copyright 1998 by Akinori Ito.
-
-This software may be redistributed freely for this purpose, in full 
-or in part, provided that this entire copyright notice is included 
-on any copies of this software and applications and derivations thereof.
-
-This software is provided on an "as is" basis, without warranty of any
-kind, either expressed or implied, as to any matter including, but not
-limited to warranty of fitness of purpose, or merchantability, or
-results obtained from use of this software.
-
-5. Bug report
-
-Please feel free to send E-mail to
-
-   aito@ei5sun.yz.yamagata-u.ac.jp
-
-for any bug report, opinion, contribution, etc.
diff --git a/ext/pty/README.expect b/ext/pty/README.expect
deleted file mode 100644
index fddbb6fdad..0000000000
--- a/ext/pty/README.expect
+++ /dev/null
@@ -1,22 +0,0 @@
-	README for expect
-		by A. Ito, 28 October, 1998
-
-	Expect library adds IO class a method called expect(), which
-does similar act to tcl's expect extension. 
-
-The usage of the method is:
-
-   IO#expect(pattern,timeout=9999999)
-
-where `pattern' is an instance of String or Regexp and `timeout'
-is Fixnum, which can be omitted. 
-	When the method is called without block, it waits until the
-input which matches the pattern is obtained from the IO or the time
-specified as the timeout passes. When the pattern is obtained from the
-IO, the method returns an array. The first element of the array is the
-entire string obtained from the IO until the pattern matches. The
-following elements indicates the specific pattern which matched to the
-anchor in the regular expression. If the method ends because of
-timeout, it returns nil. 
- 	When the method is called with block, the array is passed as
-the block parameter.
diff --git a/ext/pty/README.expect.ja b/ext/pty/README.expect.ja
deleted file mode 100644
index db84695ee5..0000000000
--- a/ext/pty/README.expect.ja
+++ /dev/null
@@ -1,21 +0,0 @@
-	README for expect
-		by A. Ito, 28 October, 1998
-
-  Expectライブラリは,tcl の expect パッケージと似たような機能を
-IOクラスに追加します.
-
-  追加されるメソッドの使い方は次の通りです.
-
-   IO#expect(pattern,timeout=9999999)
-
-pattern は String か Regexp のインスタンス,timeout は Fixnum
-のインスタンスです.timeout は省略できます.
-  このメソッドがブロックなしで呼ばれた場合,まずレシーバである
-IOオブジェクトから pattern にマッチするパターンが読みこまれる
-まで待ちます.パターンが得られたら,そのパターンに関する配列を
-返します.配列の最初の要素は,pattern にマッチするまでに読みこ
-まれた内容の文字列です.2番目以降の要素は,pattern の正規表現
-の中にアンカーがあった場合に,そのアンカーにマッチする部分です.
-もしタイムアウトが起きた場合は,このメソッドはnilを返します.
-  このメソッドがブロック付きで呼ばれた場合には,マッチした要素の
-配列がブロック引数として渡され,ブロックが評価されます.
diff --git a/ext/pty/README.ja b/ext/pty/README.ja
deleted file mode 100644
index 5ae4fb06a0..0000000000
--- a/ext/pty/README.ja
+++ /dev/null
@@ -1,89 +0,0 @@
-pty 拡張モジュール version 0.3 by A.ito
-
-1. はじめに
-
-この拡張モジュールは,仮想tty (pty) を通して適当なコマンドを
-実行する機能を ruby に提供します.
-
-2. インストール
-
-次のようにしてインストールしてください.
-
-(1)  ruby extconf.rb
-
-    を実行すると Makefile が生成されます.
-
-(2) make; make install を実行してください.
-
-3. 何ができるか
-
-この拡張モジュールは,PTY というモジュールを定義します.その中
-には,次のようなモジュール関数が含まれています.
-
-   getpty(command)
-   spawn(command)
-
-      この関数は,仮想ttyを確保し,指定されたコマンドをその仮想tty
-      の向こうで実行し,配列を返します.戻り値は3つの要素からなる
-      配列です.最初の要素は仮想ttyから読み出すためのIOオブジェクト,
-      2番目は書きこむためのIOオブジェクト,3番目は子プロセスのプロ
-      セスIDです.この関数がイテレータとして呼ばれた場合,これらの
-      要素はブロックパラメータとして渡され,関数自体はnilを返します.
-
-      この関数によって作られたサブプロセスが動いている間,子プロセス
-      の状態を監視するために SIGCHLD シグナルを捕捉します.子プロセス
-      が終了したり停止した場合には,例外が発生します.この間,すべての
-      SIGCHLD が PTY モジュールのシグナルハンドラに捕捉されるので,
-      サブプロセスを生成する他の関数(system() とか IO.popen()など)を
-      使うと,予期しない例外が発生することがあります.これを防ぐため
-      には,下記のprotect_signal()を参照してください.
-
-      この関数がブロックパラメータ付きで呼ばれた場合には,そのブロック
-      の中でのみ SIGCHLD が捕捉されます.したがって,ブロックパラメータ
-      として渡されたIOオブジェクトを,ブロックの外に持ち出して使うの
-      は勧められません.
-
-
-   protect_signal
-
-      この関数はイテレータです.ここで指定されたブロックの中では,
-      子プロセスが終了しても例外を発生しません.この関数を使うことで,
-      PTYの子プロセスが動いている間でも,system()や IO.popen()などの
-      関数を安全に使うことができます.例えば,
-
-        PTY.spawn("command_foo") do |r,w|
-          ...
-          ...
-          PTY.protect_signal do
-            system "some other commands"
-          end
-          ...
-        end
-
-      このような記述により,"some other commands" が終了したときに
-      例外が発生するのを防げます.
-
-    reset_signal
-
-      PTY の子プロセスが動いていても,そのプロセスの終了時に例外が発生
-      しないようにします.
-
-4. 利用について
-
-伊藤彰則が著作権を保有します.
-
-ソースプログラムまたはドキュメントに元の著作権表示が改変されずに
-表示されている場合に限り,誰でも,このソフトウェアを無償かつ著作
-権者に無断で利用・配布・改変できます.利用目的は限定されていませ
-ん.
-
-このプログラムの利用・配布その他このプログラムに関係する行為によ
-って生じたいかなる損害に対しても,作者は一切責任を負いません.
-
-5. バグ報告等
-
-バグレポートは歓迎します.
-
-	aito@ei5sun.yz.yamagata-u.ac.jp
-
-まで電子メールでバグレポートをお送りください.
diff --git a/ext/pty/depend b/ext/pty/depend
deleted file mode 100644
index 888be6c301..0000000000
--- a/ext/pty/depend
+++ /dev/null
@@ -1 +0,0 @@
-pty.o: pty.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/pty/expect_sample.rb b/ext/pty/expect_sample.rb
deleted file mode 100644
index 1311476c5d..0000000000
--- a/ext/pty/expect_sample.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# sample program of expect.rb
-#
-#  by A. Ito
-#
-#  This program reports the latest version of ruby interpreter
-#  by connecting to ftp server at netlab.co.jp.
-#
-require 'pty'
-require 'expect'
-
-fnames = []
-PTY.spawn("ftp ftp.netlab.co.jp") do
-  |r_f,w_f,pid|
-  w_f.sync = true
-  
-  $expect_verbose = true
-  
-  r_f.expect(/^Name.*: /) do
-    w_f.print "ftp\n"
-  end
-  
-  if !ENV['USER'].nil?
-    username = ENV['USER']
-  elsif !ENV['LOGNAME'].nil?
-    username = ENV['LOGNAME']
-  else
-    username = 'guest'
-  end
-  
-  r_f.expect('word:') do
-    w_f.print username+"@\n"
-  end
-  r_f.expect("ftp> ") do
-    w_f.print "cd pub/lang/ruby\n"
-  end
-  r_f.expect("ftp> ") do
-    w_f.print "dir\n"
-  end
-  
-  r_f.expect("ftp> ") do |output|
-    for x in output[0].split("\n")
-      if x =~ /(ruby.*\.tar\.gz)/ then
-         fnames.push $1
-      end
-    end
-  end
-  begin
-    w_f.print "quit\n"
-  rescue
-  end
-end
-
-print "The latest ruby interpreter is "
-print fnames.sort.pop
-print "\n"
diff --git a/ext/pty/extconf.rb b/ext/pty/extconf.rb
deleted file mode 100644
index 5e126fe0cf..0000000000
--- a/ext/pty/extconf.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require 'mkmf'
-
-if /mswin32|mingw|bccwin32/ !~ RUBY_PLATFORM
-  have_header("sys/stropts.h")
-  have_func("setresuid")
-  have_header("libutil.h")
-  have_header("pty.h")
-  have_library("util", "openpty")
-  if have_func("openpty") or
-      have_func("_getpty") or
-      have_func("ptsname") or
-      have_func("ioctl")
-    create_makefile('pty')
-  end
-end
diff --git a/ext/pty/lib/expect.rb b/ext/pty/lib/expect.rb
deleted file mode 100644
index 5b5619e6b2..0000000000
--- a/ext/pty/lib/expect.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-$expect_verbose = false
-
-class IO
-  def expect(pat,timeout=9999999)
-    buf = ''
-    case pat
-    when String
-      e_pat = Regexp.new(Regexp.quote(pat))
-    when Regexp
-      e_pat = pat
-    end
-    while true
-      if IO.select([self],nil,nil,timeout).nil? then
-        result = nil
-        break
-      end
-      c = getc.chr
-      buf << c
-      if $expect_verbose
-        STDOUT.print c
-        STDOUT.flush
-      end
-      if buf =~ e_pat then
-        result = [buf,$1,$2,$3,$4,$5,$6,$7,$8,$9]
-        break
-      end
-    end
-    if block_given? then
-      yield result
-    else
-      return result
-    end
-    nil
-  end
-end
-
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
deleted file mode 100644
index b7c69fe400..0000000000
--- a/ext/pty/pty.c
+++ /dev/null
@@ -1,488 +0,0 @@
-#include	"config.h"
-#include	
-#include	
-#include	
-#include	
-#include	
-#include	
-#include	
-#if !defined(HAVE_OPENPTY) && !defined(HAVE__GETPTY)
-#include	
-#endif
-#ifdef HAVE_LIBUTIL_H
-#include	
-#endif
-#ifdef HAVE_PTY_H
-#include	
-#endif
-#ifdef HAVE_SYS_WAIT_H
-#include 
-#else
-#define WIFSTOPPED(status)    (((status) & 0xff) == 0x7f)
-#endif
-#include 
-
-#include "ruby.h"
-#include "rubyio.h"
-
-#include 
-#ifdef HAVE_SYS_STROPTS_H
-#include 
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include 
-#endif
-
-#define	DEVICELEN	16
-
-#if !defined(HAVE_OPENPTY)
-#ifdef __hpux
-static
-char	*MasterDevice = "/dev/ptym/pty%s",
-	*SlaveDevice =  "/dev/pty/tty%s",
-	*deviceNo[] = {
-		"p0","p1","p2","p3","p4","p5","p6","p7",
-		"p8","p9","pa","pb","pc","pd","pe","pf",
-		"q0","q1","q2","q3","q4","q5","q6","q7",
-		"q8","q9","qa","qb","qc","qd","qe","qf",
-		"r0","r1","r2","r3","r4","r5","r6","r7",
-		"r8","r9","ra","rb","rc","rd","re","rf",
-		"s0","s1","s2","s3","s4","s5","s6","s7",
-		"s8","s9","sa","sb","sc","sd","se","sf",
-		"t0","t1","t2","t3","t4","t5","t6","t7",
-		"t8","t9","ta","tb","tc","td","te","tf",
-		"u0","u1","u2","u3","u4","u5","u6","u7",
-		"u8","u9","ua","ub","uc","ud","ue","uf",
-		"v0","v1","v2","v3","v4","v5","v6","v7",
-		"v8","v9","va","vb","vc","vd","ve","vf",
-		"w0","w1","w2","w3","w4","w5","w6","w7",
-		"w8","w9","wa","wb","wc","wd","we","wf",
-		0,
-	};
-#else  /* NOT HPUX */
-#ifdef _IBMESA  /* AIX/ESA */
-static 
-char	*MasterDevice = "/dev/ptyp%s",
-  	*SlaveDevice = "/dev/ttyp%s",
-	*deviceNo[] = {
-"00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f",
-"10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f",
-"20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f",
-"30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f",
-"40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f",
-"50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f",
-"60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f",
-"70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f",
-"80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f",
-"90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f",
-"a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af",
-"b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf",
-"c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf",
-"d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df",
-"e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef",
-"f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff",
-		};
-#else
-static 
-char	*MasterDevice = "/dev/pty%s",
-	*SlaveDevice = "/dev/tty%s",
-	*deviceNo[] = {
-		"p0","p1","p2","p3","p4","p5","p6","p7",
-		"p8","p9","pa","pb","pc","pd","pe","pf",
-		"q0","q1","q2","q3","q4","q5","q6","q7",
-		"q8","q9","qa","qb","qc","qd","qe","qf",
-		"r0","r1","r2","r3","r4","r5","r6","r7",
-		"r8","r9","ra","rb","rc","rd","re","rf",
-		"s0","s1","s2","s3","s4","s5","s6","s7",
-		"s8","s9","sa","sb","sc","sd","se","sf",
-		0,
-	};
-#endif /* _IBMESA */
-#endif /* HPUX */
-#endif /* !defined(HAVE_OPENPTY) */
-
-static char SlaveName[DEVICELEN];
-
-extern int errno;
-
-#ifndef HAVE_SETEUID
-# ifdef HAVE_SETREUID
-#  define seteuid(e)	setreuid(-1, (e))
-# else /* NOT HAVE_SETREUID */
-#  ifdef HAVE_SETRESUID
-#   define seteuid(e)	setresuid(-1, (e), -1)
-#  else /* NOT HAVE_SETRESUID */
-    /* I can't set euid. (;_;) */
-#  endif /* HAVE_SETRESUID */
-# endif /* HAVE_SETREUID */
-#endif /* NO_SETEUID */
-
-static VALUE eChildExited;
-
-static VALUE
-echild_status(self)
-    VALUE self;
-{
-    return rb_ivar_get(self, rb_intern("status"));
-}
-
-struct pty_info {
-    int fd;
-    pid_t child_pid;
-    VALUE thread;
-};
-
-static VALUE
-pty_syswait(info)
-    struct pty_info *info;
-{
-    extern VALUE rb_last_status;
-    int cpid, status;
-    char buf[1024];
-    VALUE exc, st;
-    char *state = "changed";
-
-    cpid = rb_waitpid(info->child_pid, &status, WUNTRACED);
-    st = rb_last_status;
-    
-    if (cpid == 0 || cpid == -1)
-	return Qnil;
-
-#ifdef IF_STOPPED
-    if (IF_STOPPED(status)) { /* suspend */
-	state = "stopped";
-    }
-#else
-#ifdef WIFSTOPPED
-    if (WIFSTOPPED(status)) { /* suspend */
-	state = "stopped";
-    }
-#else
----->> Either IF_STOPPED or WIFSTOPPED is needed <<----
-#endif /* WIFSTOPPED */
-#endif /* IF_STOPPED */
-    if (WIFEXITED(status)) {
-	state = "exit";
-    }
-    
-    snprintf(buf, sizeof(buf), "pty - %s: %d", state, cpid);
-    exc = rb_exc_new2(eChildExited, buf);
-    rb_iv_set(exc, "status", st);
-    rb_funcall(info->thread, rb_intern("raise"), 1, exc);
-    return Qnil;
-}
-
-static void getDevice _((int*, int*));
-
-struct exec_info {
-    int argc;
-    VALUE *argv;
-};
-
-static VALUE
-pty_exec(arg)
-    struct exec_info *arg;
-{
-    return rb_f_exec(arg->argc, arg->argv);
-}
-
-static void
-establishShell(argc, argv, info)
-    int argc;
-    VALUE *argv;
-    struct pty_info *info;
-{	
-    static int		i,master,slave,currentPid;
-    char		*p,*getenv();
-    struct passwd	*pwent;
-    VALUE		v;
-    struct exec_info	arg;
-    int			status;
-
-    if (argc == 0) {
-	char *shellname;
-
-	if ((p = getenv("SHELL")) != NULL) {
-	    shellname = p;
-	}
-	else {
-	    pwent = getpwuid(getuid());
-	    if (pwent && pwent->pw_shell)
-		shellname = pwent->pw_shell;
-	    else
-		shellname = "/bin/sh";
-	}
-	v = rb_str_new2(shellname);
-	argc = 1;
-	argv = &v;
-    }
-    getDevice(&master,&slave);
-
-    info->thread = rb_thread_current();
-    currentPid = getpid();
-    if((i = fork()) < 0) {
-	rb_sys_fail("fork failed");
-    }
-
-    if(i == 0) {	/* child */
-	currentPid = getpid();	
-
-	/*
-	 * Set free from process group and controlling terminal
-	 */
-#ifdef HAVE_SETSID
-	(void) setsid();
-#else /* HAS_SETSID */
-# ifdef HAVE_SETPGRP
-#  ifdef SETGRP_VOID
-	if (setpgrp() == -1)
-	    perror("setpgrp()");
-#  else /* SETGRP_VOID */
-	if (setpgrp(0, currentPid) == -1)
-	    rb_sys_fail("setpgrp()");
-	if ((i = open("/dev/tty", O_RDONLY)) < 0)
-	    rb_sys_fail("/dev/tty");
-	else {
-	    if (ioctl(i, TIOCNOTTY, (char *)0))
-		perror("ioctl(TIOCNOTTY)");
-	    close(i);
-	}
-#  endif /* SETGRP_VOID */
-# endif /* HAVE_SETPGRP */
-#endif /* HAS_SETSID */
-
-	/*
-	 * obtain new controlling terminal
-	 */
-#if defined(TIOCSCTTY)
-	close(master);
-	(void) ioctl(slave, TIOCSCTTY, (char *)0);
-	/* errors ignored for sun */
-#else
-	close(slave);
-	slave = open(SlaveName, O_RDWR);
-	if (slave < 0) {
-	    perror("open: pty slave");
-	    _exit(1);
-	}
-	close(master);
-#endif
-	dup2(slave,0);
-	dup2(slave,1);
-	dup2(slave,2);
-	close(slave);
-#if defined(HAVE_SETEUID) || defined(HAVE_SETREUID) || defined(HAVE_SETRESUID)
-	seteuid(getuid());
-#endif
-
-	arg.argc = argc;
-	arg.argv = argv;
-	rb_protect(pty_exec, (VALUE)&arg, &status);
-	sleep(1);
-	_exit(1);
-    }
-
-    close(slave);
-
-    info->child_pid = i;
-    info->fd = master;
-}
-
-static VALUE
-pty_kill_child(info)
-    struct pty_info *info;
-{
-    if (rb_funcall(info->thread, rb_intern("alive?"), 0, 0) == Qtrue &&
-	kill(info->child_pid, 0) == 0) {
-	rb_thread_schedule();
-	if (kill(info->child_pid, SIGTERM) == 0) {
-	    rb_thread_schedule();
-	    if (kill(info->child_pid, 0) == 0) {
-		kill(info->child_pid, SIGINT);
-		rb_thread_schedule();
-		if (kill(info->child_pid, 0) == 0)
-		    kill(info->child_pid, SIGKILL);
-	    }
-	}
-    }
-    rb_funcall(info->thread, rb_intern("join"), 0, 0);
-    return Qnil;
-}
-
-
-#ifdef HAVE_OPENPTY
-/*
- * Use openpty(3) of 4.3BSD Reno and later,
- * or the same interface function.
- */
-static void
-getDevice(master,slave)
-    int	*master,*slave;
-{
-    if (openpty(master, slave, SlaveName,
-		(struct termios *)0, (struct winsize *)0) == -1) {
-	rb_raise(rb_eRuntimeError, "openpty() failed");
-    }
-}
-#else /* HAVE_OPENPTY */
-#ifdef HAVE__GETPTY
-static void
-getDevice(master,slave)
-    int	*master,*slave;
-{
-    char *name;
-
-    if (!(name = _getpty(master, O_RDWR, 0622, 0))) {
-	rb_raise(rb_eRuntimeError, "_getpty() failed");
-    }
-
-    *slave = open(name, O_RDWR);
-    strcpy(SlaveName, name);
-}
-#else /* HAVE__GETPTY */
-static void
-getDevice(master,slave)
-    int	*master,*slave;
-{
-    char **p;
-    int	 i,j;
-    char MasterName[DEVICELEN];
-
-#ifdef HAVE_PTSNAME
-    char *pn;
-    void (*s)();
-
-    extern char *ptsname(int);
-    extern int unlockpt(int);
-    extern int grantpt(int);
-
-    if((i = open("/dev/ptmx", O_RDWR, 0)) != -1) {
-	s = signal(SIGCHLD, SIG_DFL);
-	if(grantpt(i) != -1) {
-	    signal(SIGCHLD, s);
-	    if(unlockpt(i) != -1) {
-		if((pn = ptsname(i)) != NULL) {
-		    if((j = open(pn, O_RDWR, 0)) != -1) {
-#if defined I_PUSH && !defined linux
-			if(ioctl(j, I_PUSH, "ptem") != -1) {
-			    if(ioctl(j, I_PUSH, "ldterm") != -1) {
-#endif
-				*master = i;
-				*slave = j;
-				strcpy(SlaveName, pn);
-				return;
-#if defined I_PUSH && !defined linux
-			    }
-			}
-#endif
-		    }
-		}
-	    }
-	}
-	close(i);
-    }
-    rb_raise(rb_eRuntimeError, "Cannot get Master/Slave device");
-#else
-    for (p = deviceNo; *p != NULL; p++) {
-	sprintf(MasterName,MasterDevice,*p);
-	if ((i = open(MasterName,O_RDWR,0)) >= 0) {
-	    *master = i;
-	    sprintf(SlaveName,SlaveDevice,*p);
-	    if ((j = open(SlaveName,O_RDWR,0)) >= 0) {
-		*slave = j;
-		chown(SlaveName, getuid(), getgid());
-		chmod(SlaveName, 0622);
-		return;
-	    }
-	    close(i);
-	}
-    }
-    rb_raise(rb_eRuntimeError, "Cannot get %s", SlaveName);
-#endif
-}
-#endif /* HAVE__GETPTY */
-#endif /* HAVE_OPENPTY */
-
-static void
-freeDevice()
-{
-    chmod(SlaveName, 0666);
-    chown(SlaveName, 0, 0);
-}
-
-/* ruby function: getpty */
-static VALUE
-pty_getpty(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    VALUE res, th;
-    struct pty_info info, thinfo;
-    OpenFile *wfptr,*rfptr;
-    VALUE rport = rb_obj_alloc(rb_cFile);
-    VALUE wport = rb_obj_alloc(rb_cFile);
-  
-    MakeOpenFile(rport, rfptr);
-    MakeOpenFile(wport, wfptr);
-
-    establishShell(argc, argv, &info);
-
-    rfptr->mode = rb_io_mode_flags("r");
-    rfptr->f = fdopen(info.fd, "r");
-    rfptr->path = strdup(SlaveName);
-
-    wfptr->mode = rb_io_mode_flags("w") | FMODE_SYNC;
-    wfptr->f = fdopen(dup(info.fd), "w");
-    wfptr->path = strdup(SlaveName);
-
-    res = rb_ary_new2(3);
-    rb_ary_store(res,0,(VALUE)rport);
-    rb_ary_store(res,1,(VALUE)wport);
-    rb_ary_store(res,2,INT2FIX(info.child_pid));
-
-    th = rb_thread_create(pty_syswait, (void*)&info);
-    thinfo.thread = th;
-    thinfo.child_pid = info.child_pid;
-
-    if (rb_block_given_p()) {
-	rb_ensure(rb_yield, res, pty_kill_child, (VALUE)&thinfo);
-	return Qnil;
-    }
-    return res;
-}
-
-/* ruby function: protect_signal - obsolete */
-static VALUE
-pty_protect(self)
-    VALUE self;
-{
-    rb_warn("PTY::protect_signal is no longer needed");
-    rb_yield(Qnil);
-    return self;
-}
-
-/* ruby function: reset_signal - obsolete */
-static VALUE
-pty_reset_signal(self)
-    VALUE self;
-{
-    rb_warn("PTY::reset_signal is no longer needed");
-    return self;
-}
-
-static VALUE cPTY;
-
-void
-Init_pty()
-{
-    cPTY = rb_define_module("PTY");
-    rb_define_module_function(cPTY,"getpty",pty_getpty,-1);
-    rb_define_module_function(cPTY,"spawn",pty_getpty,-1);
-    rb_define_module_function(cPTY,"protect_signal",pty_protect,0);
-    rb_define_module_function(cPTY,"reset_signal",pty_reset_signal,0);
-
-    eChildExited = rb_define_class_under(cPTY,"ChildExited",rb_eRuntimeError);
-    rb_define_method(eChildExited,"status",echild_status,0);
-}
diff --git a/ext/pty/script.rb b/ext/pty/script.rb
deleted file mode 100644
index 3084935637..0000000000
--- a/ext/pty/script.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-require 'pty'
-
-if ARGV.size == 0 then
-  ofile = "typescript"
-else
-  ofile = ARGV[0]
-end
-
-logfile = File.open(ofile,"a")
-
-system "stty -echo raw lnext ^_"
-
-PTY.spawn("/bin/csh") do
-  |r_pty,w_pty,pid|
-
-  Thread.new do
-    while true
-      w_pty.print STDIN.getc.chr
-      w_pty.flush
-    end
-  end
-  
-  begin
-    while true
-      c = r_pty.sysread(512)
-      break if c.nil?
-      print c
-      STDOUT.flush
-      logfile.print c
-    end
-  rescue
-  #  print $@,':',$!,"\n"
-    logfile.close
-  end
-end
-
-system "stty echo -raw lnext ^v"
-
diff --git a/ext/pty/shl.rb b/ext/pty/shl.rb
deleted file mode 100644
index cdaf8d7398..0000000000
--- a/ext/pty/shl.rb
+++ /dev/null
@@ -1,92 +0,0 @@
-#
-#  old-fashioned 'shl' like program
-#  by A. Ito
-#
-#  commands:
-#     c        creates new shell
-#     C-z      suspends shell
-#     p        lists all shell
-#     0,1,...  choose shell
-#     q        quit
-
-require 'pty'
-
-$shells = []
-$n_shells = 0
-
-$r_pty = nil
-$w_pty = nil
-
-def writer
-  system "stty -echo raw"
-  begin
-    while true
-      c = STDIN.getc
-      if c == 26 then # C-z
-        $reader.raise(nil)
-        return 'Suspend'
-      end
-      $w_pty.print c.chr
-      $w_pty.flush
-    end
-  rescue
-    $reader.raise(nil)
-    return 'Exit'
-  ensure
-    system "stty echo -raw"
-  end
-end
-
-$reader = Thread.new {
-  while true
-    begin
-      next if $r_pty.nil?
-      c = $r_pty.getc
-      if c.nil? then
-        Thread.stop
-      end
-      print c.chr
-      STDOUT.flush
-    rescue
-      Thread.stop
-    end
-  end
-}
-
-# $reader.raise(nil)
-
-
-while true
-  print ">> "
-  STDOUT.flush
-  case gets
-  when /^c/i
-    $shells[$n_shells] = PTY.spawn("/bin/csh")
-    $r_pty,$w_pty = $shells[$n_shells]
-    $n_shells += 1
-    $reader.run
-    if writer == 'Exit'
-      $n_shells -= 1
-      $shells[$n_shells] = nil
-    end
-  when /^p/i
-    for i in 0..$n_shells
-      unless $shells[i].nil?
-        print i,"\n"
-      end
-    end
-  when /^([0-9]+)/
-    n = $1.to_i
-    if $shells[n].nil?
-      print "\##{i} doesn't exist\n"
-    else
-      $r_pty,$w_pty = $shells[n]
-      $reader.run
-      if writer == 'Exit' then
-        $shells[n] = nil
-      end
-    end
-  when /^q/i
-    exit
-  end
-end
diff --git a/ext/racc/cparse/.cvsignore b/ext/racc/cparse/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/racc/cparse/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/racc/cparse/MANIFEST b/ext/racc/cparse/MANIFEST
deleted file mode 100644
index daf1f846b9..0000000000
--- a/ext/racc/cparse/MANIFEST
+++ /dev/null
@@ -1,3 +0,0 @@
-MANIFEST
-cparse.c
-extconf.rb
diff --git a/ext/racc/cparse/cparse.c b/ext/racc/cparse/cparse.c
deleted file mode 100644
index 84d0af8295..0000000000
--- a/ext/racc/cparse/cparse.c
+++ /dev/null
@@ -1,767 +0,0 @@
-/* vi:set sw=4:
-
-    cparse.c
-  
-    Copyright (c) 1999-2002 Minero Aoki 
-  
-    This library is free software.
-    You can distribute/modify this program under the same terms of ruby.
-
-    $Id$
-
-*/
-
-#include 
-#include "ruby.h"
-
-#define RACC_VERSION "1.4.2"
-
-#define DFLT_TOK -1
-#define ERR_TOK   1
-#define FINAL_TOK 0
-
-#define vDFLT_TOK  INT2FIX(DFLT_TOK)
-#define vERR_TOK   INT2FIX(ERR_TOK)
-#define vFINAL_TOK INT2FIX(FINAL_TOK)
-
-static VALUE RaccBug;
-static VALUE CparseParams;
-
-static ID id_yydebug;
-static ID id_nexttoken;
-static ID id_onerror;
-static ID id_noreduce;
-static ID id_catch;
-static VALUE sym_raccjump;
-static ID id_errstatus;
-
-static ID id_d_shift;
-static ID id_d_reduce;
-static ID id_d_accept;
-static ID id_d_read_token;
-static ID id_d_next_state;
-static ID id_d_e_pop;
-
-
-#ifdef ID2SYM
-# define id_to_value(i) ID2SYM(i)
-#else
-# define id_to_value(i) ULONG2NUM(i)
-#endif
-
-static ID
-value_to_id(v)
-    VALUE v;
-{
-#ifndef SYMBOL_P
-#  define SYMBOL_P(v) FIXNUM_P(v)
-#endif
-    if (! SYMBOL_P(v)) {
-        rb_raise(rb_eTypeError, "not symbol");
-    }
-#ifdef SYM2ID
-    return SYM2ID(v);
-#else
-    return (ID)NUM2ULONG(v);
-#endif
-}
-
-#ifndef LONG2NUM
-#  define LONG2NUM(i) INT2NUM(i)
-#endif
-
-static VALUE
-slice_tail(stack, len)
-    VALUE stack;
-    long len;
-{
-    if (len < 0) return Qnil;  /* system error */
-    if (len > RARRAY(stack)->len) len = RARRAY(stack)->len;
-    return rb_ary_new4(len, RARRAY(stack)->ptr + RARRAY(stack)->len - len);
-}
-
-static void
-cut_off_tail(stack, len)
-    VALUE stack;
-    long len;
-{
-    while (len > 0) {
-        rb_ary_pop(stack);
-        len--;
-    }
-}
-
-#define STACK_INIT_LEN 64
-#define INIT_STACK(s) \
-    s = rb_ary_new2(STACK_INIT_LEN)
-
-#define AREF(s, idx) \
-    ((0 <= idx && idx < RARRAY(s)->len) ? RARRAY(s)->ptr[idx] : Qnil)
-
-#define PUSH(s, i) \
-    rb_ary_store(s, RARRAY(s)->len, i)
-
-#define POP(s) \
-    rb_ary_pop(s)
-
-#define LAST_I(s) \
-    ((RARRAY(s)->len > 0) ? RARRAY(s)->ptr[RARRAY(s)->len - 1] : Qnil)
-
-#define GET_TAIL(s, len) \
-    slice_tail(s, len)
-
-#define CUT_TAIL(s, len) \
-    cut_off_tail(s, len)
-
-
-struct cparse_params {
-    VALUE vv;
-
-    VALUE parser;
-    VALUE recv;
-    ID    mid;
-
-    VALUE action_table;
-    VALUE action_check;
-    VALUE action_default;
-    VALUE action_pointer;
-    VALUE goto_table;
-    VALUE goto_check;
-    VALUE goto_default;
-    VALUE goto_pointer;
-    long  nt_base;
-    VALUE reduce_table;
-    VALUE token_table;
-
-    VALUE state;
-    long curstate;
-    VALUE vstack;
-    VALUE tstack;
-    VALUE t;
-    long shift_n;
-    long reduce_n;
-    long ruleno;
-
-    long errstatus;
-    long nerr;
-
-    VALUE use_result_var;
-    VALUE iterator_p;
-
-    VALUE retval;
-    long fin;
-#define CP_FIN_ACCEPT  1
-#define CP_FIN_EOT     2
-#define CP_FIN_CANTPOP 3
-
-    VALUE debug;
-    VALUE in_debug;
-
-    long i;
-};
-
-
-static void initvars _((VALUE, struct cparse_params*, VALUE, VALUE, VALUE));
-static void wrap_yyparse _((struct cparse_params*));
-static void parser_core _((struct cparse_params*, VALUE, VALUE, int));
-static void extract_utok _((struct cparse_params*, VALUE, VALUE*, VALUE*));
-static VALUE catch_iter _((VALUE));
-static VALUE do_reduce _((VALUE, VALUE, VALUE));
-static VALUE call_scaniter _((VALUE));
-
-
-#define REDUCE(v, act) \
-    v->ruleno = -act * 3;                            \
-    tmp = rb_iterate(catch_iter, v->parser,          \
-                     do_reduce, v->vv);              \
-    code = NUM2LONG(tmp);                            \
-    tmp = rb_ivar_get(v->parser, id_errstatus);      \
-    v->errstatus = NUM2LONG(tmp);                    \
-    switch (code) {                                  \
-    case 0: /* normal */                             \
-        break;                                       \
-    case 1: /* yyerror */                            \
-        goto user_yyerror;                           \
-    case 2: /* yyaccept */                           \
-        goto accept;                                 \
-    default:                                         \
-        break;                                       \
-    }
-
-#define SHIFT(v, act, tok, val) \
-    PUSH(v->vstack, val);                            \
-    if (v->debug) {                                  \
-        PUSH(v->tstack, tok);                        \
-        rb_funcall(v->parser, id_d_shift,            \
-                   3, tok, v->tstack, v->vstack);    \
-    }                                                \
-    v->curstate = act;                               \
-    PUSH(v->state, LONG2NUM(v->curstate));
-
-#define ACCEPT(v) \
-    if (v->debug) rb_funcall(v->parser, id_d_accept, 0); \
-    v->retval = RARRAY(v->vstack)->ptr[0];               \
-    v->fin = CP_FIN_ACCEPT;                              \
-    return;
-
-
-#ifdef DEBUG
-# define D(code) if (v->in_debug) code
-#else
-# define D(code)
-#endif
-
-
-static VALUE
-racc_cparse(parser, arg, indebug)
-    VALUE parser, arg, indebug;
-{
-    struct cparse_params vv;
-    struct cparse_params *v;
-
-    v = &vv;
-    v->in_debug = RTEST(indebug);
-    D(puts("start C doparse"));
-    initvars(parser, v, arg, Qnil, Qnil);
-    v->iterator_p = Qfalse;
-    D(puts("params initialized"));
-    parser_core(v, Qnil, Qnil, 0);
-
-    return v->retval;
-}
-
-static VALUE
-racc_yyparse(parser, recv, mid, arg, indebug)
-    VALUE parser, recv, mid, arg, indebug;
-{
-    struct cparse_params vv;
-    struct cparse_params *v;
-
-    v = &vv;
-    v->in_debug = RTEST(indebug);
-    D(puts("start C yyparse"));
-    initvars(parser, v, arg, recv, mid);
-    v->iterator_p = Qtrue;
-    D(puts("params initialized"));
-    parser_core(v, Qnil, Qnil, 0);
-    wrap_yyparse(v);
-    if (! v->fin) {
-        rb_raise(rb_eArgError, "%s() is finished before EndOfToken",
-                 rb_id2name(v->mid));
-    }
-
-    return v->retval;
-}
-
-static VALUE call_scaniter _((VALUE));
-
-static VALUE
-call_scaniter(data)
-    VALUE data;
-{
-    struct cparse_params *v;
-
-    Data_Get_Struct(data, struct cparse_params, v);
-    rb_funcall(v->recv, v->mid, 0);
-
-    return Qnil;
-}
-
-static VALUE
-catch_scaniter(arr, data, self)
-    VALUE arr, data, self;
-{
-    struct cparse_params *v;
-    VALUE tok, val;
-
-    Data_Get_Struct(data, struct cparse_params, v);
-    if (v->fin)
-        rb_raise(rb_eArgError, "extra token after EndOfToken");
-    extract_utok(v, arr, &tok, &val);
-    parser_core(v, tok, val, 1);
-    if (v->fin && v->fin != CP_FIN_ACCEPT)
-       rb_iter_break(); 
-
-    return Qnil;
-}
-
-static void
-wrap_yyparse(v)
-    struct cparse_params *v;
-{
-    rb_iterate(call_scaniter, v->vv,
-               catch_scaniter, v->vv);
-}
-
-static void
-initvars(parser, v, arg, recv, mid)
-    VALUE parser, arg, recv, mid;
-    struct cparse_params *v;
-{
-    VALUE act_tbl, act_chk, act_def, act_ptr,
-          goto_tbl, goto_chk, goto_def, goto_ptr,
-          ntbas, red_tbl, tok_tbl, shi_n, red_n;
-    VALUE debugp;
-
-
-    v->vv = Data_Wrap_Struct(CparseParams, 0, 0, v);
-
-    v->parser = parser;
-    v->recv = recv;
-    if (! NIL_P(mid))
-        v->mid = value_to_id(mid);
-
-    debugp = rb_ivar_get(parser, id_yydebug);
-    v->debug = RTEST(debugp);
-
-    Check_Type(arg, T_ARRAY);
-    if (!(RARRAY(arg)->len == 13 ||
-          RARRAY(arg)->len == 14))
-        rb_raise(RaccBug, "[Racc Bug] wrong arg.size %ld", RARRAY(arg)->len);
-    act_tbl  = RARRAY(arg)->ptr[0];
-    act_chk  = RARRAY(arg)->ptr[1];
-    act_def  = RARRAY(arg)->ptr[2];
-    act_ptr  = RARRAY(arg)->ptr[3];
-    goto_tbl = RARRAY(arg)->ptr[4];
-    goto_chk = RARRAY(arg)->ptr[5];
-    goto_def = RARRAY(arg)->ptr[6];
-    goto_ptr = RARRAY(arg)->ptr[7];
-    ntbas    = RARRAY(arg)->ptr[8];
-    red_tbl  = RARRAY(arg)->ptr[9];
-    tok_tbl  = RARRAY(arg)->ptr[10];
-    shi_n    = RARRAY(arg)->ptr[11];
-    red_n    = RARRAY(arg)->ptr[12];
-    if (RARRAY(arg)->len > 13) {
-        VALUE useres;
-        useres = RARRAY(arg)->ptr[13];
-        v->use_result_var = RTEST(useres);
-    }
-    else {
-        v->use_result_var = Qtrue;
-    }
-    Check_Type(act_tbl,  T_ARRAY);
-    Check_Type(act_chk,  T_ARRAY);
-    Check_Type(act_def,  T_ARRAY);
-    Check_Type(act_ptr,  T_ARRAY);
-    Check_Type(goto_tbl, T_ARRAY);
-    Check_Type(goto_chk, T_ARRAY);
-    Check_Type(goto_def, T_ARRAY);
-    Check_Type(goto_ptr, T_ARRAY);
-    Check_Type(ntbas,    T_FIXNUM);
-    Check_Type(red_tbl,  T_ARRAY);
-    Check_Type(tok_tbl,  T_HASH);
-    Check_Type(shi_n,    T_FIXNUM);
-    Check_Type(red_n,    T_FIXNUM);
-    v->action_table   = act_tbl;
-    v->action_check   = act_chk;
-    v->action_default = act_def;
-    v->action_pointer = act_ptr;
-    v->goto_table     = goto_tbl;
-    v->goto_check     = goto_chk;
-    v->goto_default   = goto_def;
-    v->goto_pointer   = goto_ptr;
-    v->nt_base        = NUM2LONG(ntbas);
-    v->reduce_table   = red_tbl;
-    v->token_table    = tok_tbl;
-    v->shift_n        = NUM2LONG(shi_n);
-    v->reduce_n       = NUM2LONG(red_n);
-
-    if (v->debug) INIT_STACK(v->tstack);
-    INIT_STACK(v->vstack);
-    INIT_STACK(v->state);
-    v->curstate = 0;
-    PUSH(v->state, INT2FIX(0));
-    v->t = LONG2NUM(FINAL_TOK + 1); /* must not init to FINAL_TOK */
-    v->nerr = 0;
-    v->errstatus = 0;
-    rb_ivar_set(parser, id_errstatus, LONG2NUM(v->errstatus));
-
-    v->retval = Qnil;
-    v->fin = 0;
-
-    v->iterator_p = Qfalse;
-}
-
-static void
-extract_utok(v, arr, t_var, v_var)
-    struct cparse_params *v;
-    VALUE arr;
-    VALUE *t_var, *v_var;
-{
-    if (NIL_P(arr)) {
-        /* EOF */
-        *t_var = Qfalse;
-        *v_var = rb_str_new("$", 1);
-        return;
-    }
-    if (TYPE(arr) != T_ARRAY) {
-        rb_raise(rb_eTypeError,
-                 "%s() %s %s (must be Array[2])",
-                 v->iterator_p ? rb_id2name(v->mid) : "next_token",
-                 v->iterator_p ? "yielded" : "returned",
-                 rb_class2name(CLASS_OF(arr)));
-    }
-    if (RARRAY(arr)->len != 2)
-        rb_raise(rb_eArgError,
-                 "%s() %s wrong size of array (%ld for 2)",
-                 v->iterator_p ? rb_id2name(v->mid) : "next_token",
-                 v->iterator_p ? "yielded" : "returned",
-                 RARRAY(arr)->len);
-    *t_var = AREF(arr, 0);
-    *v_var = AREF(arr, 1);
-}
-
-static void
-parser_core(v, tok, val, resume)
-    struct cparse_params *v;
-    VALUE tok, val;
-    int resume;
-{
-    long act;
-    int read_next = 1;
-
-    if (resume)
-        goto resume;
-    
-    while (1) {
-        long i;
-        VALUE tmp;
-        VALUE vact = 1;
-
-        D(puts("enter new loop"));
-
-        /* decide action */
-
-        D(printf("(act) k1=%ld\n", v->curstate));
-        tmp = AREF(v->action_pointer, v->curstate);
-        if (! NIL_P(tmp)) {
-            i = NUM2LONG(tmp);
-
-            D(puts("(act) pointer[k1] true"));
-            D(printf("read_next=%d\n", read_next));
-            if (read_next) {
-                if (v->t != vFINAL_TOK) {
-    if (v->iterator_p) {
-    /***** BUG? ******/
-        D(puts("resuming..."));
-        if (v->fin) {
-            rb_raise(rb_eArgError,
-                     "token given after EndOfToken seen");
-        }
-        v->i = i;
-        return;
-    }
-                    tmp = rb_funcall(v->parser, id_nexttoken, 0);
-                    extract_utok(v, tmp, &tok, &val);
-    resume:
-    if (v->iterator_p) {
-        D(puts("resume"));
-        i = v->i;
-    }
-                    tmp = rb_hash_aref(v->token_table, tok);
-                    v->t = NIL_P(tmp) ? vERR_TOK : tmp;
-                    D(printf("(act) t(k2)=%ld\n", NUM2LONG(v->t)));
-                    if (v->debug) {
-                        rb_funcall(v->parser, id_d_read_token,
-                                   3, v->t, tok, val);
-                    }
-                }
-                read_next = 0;
-            }
-
-            i += NUM2LONG(v->t);
-            D(printf("(act) i=%ld\n", i));
-            if (i >= 0) {
-                vact = AREF(v->action_table, i);
-                D(printf("(act) table[i]=%ld\n", NUM2LONG(vact)));
-                if (! NIL_P(vact)) {
-                    tmp = AREF(v->action_check, i);
-                    D(printf("(act) check[i]=%ld\n", NUM2LONG(tmp)));
-                    if (! NIL_P(tmp) && NUM2LONG(tmp) == v->curstate) {
-                        D(puts("(act) found"));
-                        goto act_found;
-                    }
-                }
-            }
-        }
-        D(puts("(act) not found: use default"));
-        vact = AREF(v->action_default, v->curstate);
-
-    act_found:
-        act = NUM2LONG(vact);
-        D(printf("act=%ld\n", act));
-
-
-        if (act > 0 && act < v->shift_n) {
-            D(puts("shift"));
-
-            if (v->errstatus > 0) {
-                v->errstatus--;
-                rb_ivar_set(v->parser, id_errstatus, LONG2NUM(v->errstatus));
-            }
-            SHIFT(v, act, v->t, val);
-            read_next = 1;
-        }
-        else if (act < 0 && act > -(v->reduce_n)) {
-            int code;
-            D(puts("reduce"));
-
-            REDUCE(v, act);
-        }
-        else if (act == -(v->reduce_n)) {
-            D(printf("error detected, status=%ld\n", v->errstatus));
-
-            if (v->errstatus == 0) {
-                v->nerr++;
-                rb_funcall(v->parser, id_onerror,
-                           3, v->t, val, v->vstack);
-            }
-
-    user_yyerror:
-
-            if (v->errstatus == 3) {
-                if (v->t == vFINAL_TOK) {
-                    v->retval = Qfalse;
-                    v->fin = CP_FIN_EOT;
-                    return;
-                }
-                read_next = 1;
-            }
-            v->errstatus = 3;
-            rb_ivar_set(v->parser, id_errstatus, LONG2NUM(v->errstatus));
-
-            /* check if We can shift/reduce error token */
-            D(printf("(err) k1=%ld\n", v->curstate));
-            D(printf("(err) k2=%d (error)\n", ERR_TOK));
-            while (1) {
-                tmp = AREF(v->action_pointer, v->curstate);
-                if (! NIL_P(tmp)) {
-                    D(puts("(err) pointer[k1] true"));
-                    i = NUM2LONG(tmp) + ERR_TOK;
-                    D(printf("(err) i=%ld\n", i));
-                    if (i >= 0) {
-                        vact = AREF(v->action_table, i);
-                        if (! NIL_P(vact)) {
-                            D(printf("(err) table[i]=%ld\n", NUM2LONG(vact)));
-                            tmp = AREF(v->action_check, i);
-                            if (! NIL_P(tmp) && NUM2LONG(tmp) == v->curstate) {
-                                D(puts("(err) found: can handle error tok"));
-                                break;
-                            }
-                            else {
-                                D(puts("(err) check[i]!=k1 or nil"));
-                            }
-                        }
-                        else {
-                            D(puts("(err) table[i] == nil"));
-                        }
-                    }
-                }
-                D(puts("(err) not found: can't handle error tok: pop"));
-
-                if (RARRAY(v->state)->len == 0) {
-                    v->retval = Qnil;
-                    v->fin = CP_FIN_CANTPOP;
-                    return;
-                }
-                POP(v->state);
-                POP(v->vstack);
-                tmp = LAST_I(v->state);
-                v->curstate = NUM2LONG(tmp);
-                if (v->debug) {
-                    POP(v->tstack);
-                    rb_funcall(v->parser, id_d_e_pop,
-                               3, v->state, v->tstack, v->vstack);
-                }
-            }
-            act = NUM2LONG(vact);
-
-            /* shift|reduce error token */
-
-            if (act > 0 && act < v->shift_n) {
-                D(puts("e shift"));
-                SHIFT(v, act, ERR_TOK, val);
-            }
-            else if (act < 0 && act > -(v->reduce_n)) {
-                int code;
-
-                D(puts("e reduce"));
-                REDUCE(v, act);
-            }
-            else if (act == v->shift_n) {
-                D(puts("e accept"));
-                ACCEPT(v);
-            }
-            else {
-                rb_raise(RaccBug, "[Racc Bug] unknown act value %ld", act);
-            }
-        }
-        else if (act == v->shift_n) {
-    accept:
-            D(puts("accept"));
-            ACCEPT(v);
-        }
-        else {
-            rb_raise(RaccBug, "[Racc Bug] unknown act value %ld", act);
-        }
-
-        if (v->debug) {
-            rb_funcall(v->parser, id_d_next_state,
-                       2, LONG2NUM(v->curstate), v->state);
-        }
-    }
-}
-
-
-static VALUE
-catch_iter(parser)
-    VALUE parser;
-{
-    return rb_funcall(parser, id_catch, 1, sym_raccjump);
-}
-
-
-static VALUE
-do_reduce(val, data, self)
-    VALUE val, data, self;
-{
-    struct cparse_params *v;
-    VALUE reduce_to, reduce_len, method_id;
-    long len;
-    ID mid;
-    VALUE tmp, tmp_t, tmp_v;
-    long i, k1, k2;
-    VALUE ret;
-
-    Data_Get_Struct(data, struct cparse_params, v);
-    reduce_len = RARRAY(v->reduce_table)->ptr[v->ruleno];
-    reduce_to  = RARRAY(v->reduce_table)->ptr[v->ruleno+1];
-    method_id  = RARRAY(v->reduce_table)->ptr[v->ruleno+2];
-    len = NUM2LONG(reduce_len);
-    mid = value_to_id(method_id);
-
-    if (len == 0) {
-        tmp = Qnil;
-        if (mid != id_noreduce)
-            tmp_v = rb_ary_new();
-        if (v->debug)
-            tmp_t = rb_ary_new();
-    }
-    else {
-        if (mid != id_noreduce) {
-            tmp_v = GET_TAIL(v->vstack, len);
-            tmp = RARRAY(tmp_v)->ptr[0];
-        }
-        else {
-            tmp = RARRAY(v->vstack)->ptr[ RARRAY(v->vstack)->len - len ];
-        }
-        CUT_TAIL(v->vstack, len);
-        if (v->debug) {
-            tmp_t = GET_TAIL(v->tstack, len);
-            CUT_TAIL(v->tstack, len);
-        }
-        CUT_TAIL(v->state, len);
-    }
-
-    /* method call must be done before tstack.push */
-    if (mid != id_noreduce) {
-        if (v->use_result_var) {
-            tmp = rb_funcall(v->parser, mid,
-                             3, tmp_v, v->vstack, tmp);
-        }
-        else {
-            tmp = rb_funcall(v->parser, mid,
-                             2, tmp_v, v->vstack);
-        }
-    }
-    PUSH(v->vstack, tmp);
-    if (v->debug) {
-        PUSH(v->tstack, reduce_to);
-        rb_funcall(v->parser, id_d_reduce,
-                   4, tmp_t, reduce_to, v->tstack, v->vstack);
-    }
-
-    if (RARRAY(v->state)->len == 0) {
-        rb_raise(RaccBug, "state stack unexpected empty");
-    }
-    tmp = LAST_I(v->state);
-    k2 = NUM2LONG(tmp);
-    k1 = NUM2LONG(reduce_to) - v->nt_base;
-    D(printf("(goto) k1=%ld\n", k1));
-    D(printf("(goto) k2=%ld\n", k2));
-
-    tmp = AREF(v->goto_pointer, k1);
-    if (! NIL_P(tmp)) {
-        i = NUM2LONG(tmp) + k2;
-        D(printf("(goto) i=%ld\n", i));
-        if (i >= 0) {
-            ret = AREF(v->goto_table, i);
-            if (! NIL_P(ret)) {
-                D(printf("(goto) table[i]=%ld (ret)\n", NUM2LONG(ret)));
-                tmp = AREF(v->goto_check, i);
-                if (!NIL_P(tmp) && tmp == LONG2NUM(k1)) {
-                    D(printf("(goto) check[i]=%ld\n", NUM2LONG(tmp)));
-                    D(puts("(goto) found"));
-                    goto doret;
-                }
-                else {
-                    D(puts("(goto) check[i]!=table[i] or nil"));
-                }
-            }
-            else {
-                D(puts("(goto) table[i] == nil"));
-            }
-        }
-    }
-    D(puts("(goto) not found: use default"));
-    ret = AREF(v->goto_default, k1);
-
-doret:
-    PUSH(v->state, ret);
-    v->curstate = NUM2LONG(ret);
-
-    return INT2FIX(0);
-}
-
-
-void
-Init_cparse()
-{
-    VALUE Racc;
-    VALUE Parser;
-    ID id_racc = rb_intern("Racc");
-
-    if (rb_const_defined(rb_cObject, id_racc)) {
-        Racc = rb_const_get(rb_cObject, id_racc);
-        Parser = rb_const_get_at(Racc, rb_intern("Parser"));
-    }
-    else {
-        Racc = rb_define_module("Racc");
-        Parser = rb_define_class_under(Racc, "Parser", rb_cObject);
-    }
-    rb_define_private_method(Parser, "_racc_do_parse_c", racc_cparse, 2);
-    rb_define_private_method(Parser, "_racc_yyparse_c", racc_yyparse, 4);
-    rb_define_const(Parser, "Racc_Runtime_Core_Version_C",
-        rb_str_new2(RACC_VERSION));
-    rb_define_const(Parser, "Racc_Runtime_Core_Id_C",
-        rb_str_new2("$Id$"));
-
-    CparseParams = rb_define_class_under(Racc, "CparseParams", rb_cObject);
-
-    RaccBug = rb_eRuntimeError;
-
-    id_yydebug      = rb_intern("@yydebug");
-    id_nexttoken    = rb_intern("next_token");
-    id_onerror      = rb_intern("on_error");
-    id_noreduce     = rb_intern("_reduce_none");
-    id_catch        = rb_intern("catch");
-    id_errstatus    = rb_intern("@racc_error_status");
-    sym_raccjump    = id_to_value(rb_intern("racc_jump"));
-
-    id_d_shift       = rb_intern("racc_shift");
-    id_d_reduce      = rb_intern("racc_reduce");
-    id_d_accept      = rb_intern("racc_accept");
-    id_d_read_token  = rb_intern("racc_read_token");
-    id_d_next_state  = rb_intern("racc_next_state");
-    id_d_e_pop       = rb_intern("racc_e_pop");
-}
diff --git a/ext/racc/cparse/depend b/ext/racc/cparse/depend
deleted file mode 100644
index 7b06a880f5..0000000000
--- a/ext/racc/cparse/depend
+++ /dev/null
@@ -1 +0,0 @@
-cparse.o: cparse.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/racc/cparse/extconf.rb b/ext/racc/cparse/extconf.rb
deleted file mode 100644
index dd953a7e15..0000000000
--- a/ext/racc/cparse/extconf.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-# $Id$
-
-require 'mkmf'
-create_makefile 'racc/cparse'
diff --git a/ext/readline/.cvsignore b/ext/readline/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/readline/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/readline/MANIFEST b/ext/readline/MANIFEST
deleted file mode 100644
index 4dd1d9e1a1..0000000000
--- a/ext/readline/MANIFEST
+++ /dev/null
@@ -1,6 +0,0 @@
-MANIFEST
-README
-README.ja
-depend
-extconf.rb
-readline.c
diff --git a/ext/readline/README b/ext/readline/README
deleted file mode 100644
index 9bbf325c99..0000000000
--- a/ext/readline/README
+++ /dev/null
@@ -1,62 +0,0 @@
-Extension for GNU Readline Library
-
-Example:
-
-  require "readline"
-  include Readline
-
-  line = readline("Prompt> ", true)
-
-[Readline]
-
-
-
-readline(prompt, add_history=nil)
-
-  Reads one line with line editing.  The inputted line is added to the
-  history if add_history is true.
-
-
-
-completion_proc = proc
-
-  Specifies a Proc object to determine completion behavior.  It
-  should take input-string, and return an array of completion
-  candidates.
-
-completion_proc
-
-  Returns the completion Proc object.
-
-completion_case_fold = bool
-
-  Sets whether or not to ignore case on completion.
-
-completion_case_fold
-
-  Returns true if completion ignores case.
-
-completion_append_character = char
-
-  Specifies a character to be appended on completion.
-  Nothing will be appended if an empty string ("") or nil is
-  specified.
-
-completion_append_character
-
-  Returns a string containing a character to be appended on
-  completion.  The default is a space (" ").
-
-vi_editing_mode
-
-  Specifies VI editing mode.
-
-emacs_editing_mode
-
-  Specifies Emacs editing mode.
-
-
-
-HISTORY
-
-The history buffer.  It behaves just like an array.
diff --git a/ext/readline/README.ja b/ext/readline/README.ja
deleted file mode 100644
index beb951fbf0..0000000000
--- a/ext/readline/README.ja
+++ /dev/null
@@ -1,63 +0,0 @@
-GNU Readline Libraryを利用するための拡張モジュールです。
-
-require "readline"
-include Readline
-
-line = readline("Prompt> ", true)
-
-のように使用してください。
-
-[Readline]
-
-<モジュール関数>
-
-readline(prompt, add_history=nil)
-
-  一行入力を読み込みます。
-  add_historyがtrueの場合、ヒストリに読み込んだ文字列を追加します。
-
-<クラスメソッド>
-
-completion_proc = proc
-
-  補完時の動作を決定するProcオブジェクトを指定します。
-  procは引数に入力文字列を取り、候補文字列の配列を返すように
-  してください。
-
-completion_proc
-
-  補完時の動作を決定するProcオブジェクトを返します。
-
-completion_case_fold = case_fold
-
-  補完時に大文字小文字を区別しない場合、trueを指定します。
-
-completion_case_fold
-
-  補完時に大文字小文字を区別しない場合、trueを返します。
-
-completion_append_character = char
-
-  補完時に付加される文字を文字列で指定します。先頭の一文字が
-  設定され、空文字列 ("") または nil を指定すると何も付加
-  されなくなります。
-
-completion_append_character
-
-  補完時に付加される文字を文字列で返します。デフォルトは
-  空白 (" ") です。
-
-vi_editing_mode
-
-  VIモードになります。
-
-emacs_editing_mode
-
-  Emacsモードになります。
-
-<クラス定数>
-
-HISTORY
-
-ヒストリに対する操作はこの定数を通して行ってください。
-配列と同じように扱えるようになっています。
diff --git a/ext/readline/depend b/ext/readline/depend
deleted file mode 100644
index 6570c5a036..0000000000
--- a/ext/readline/depend
+++ /dev/null
@@ -1 +0,0 @@
-readline.o: readline.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/readline/extconf.rb b/ext/readline/extconf.rb
deleted file mode 100644
index b883de3e01..0000000000
--- a/ext/readline/extconf.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-require "mkmf"
-
-dir_config("readline")
-have_library("user32", nil) if /cygwin/ === RUBY_PLATFORM
-have_library("ncurses", "tgetnum") or
-  have_library("termcap", "tgetnum") or
-  have_library("curses", "tgetnum")
-
-if have_header("readline/readline.h") and
-    have_header("readline/history.h") and
-    have_library("readline", "readline")
-  if have_func("rl_filename_completion_function")
-    $CFLAGS += " -DREADLINE_42_OR_LATER"
-  end
-  if have_func("rl_cleanup_after_signal")
-    $CFLAGS += " -DREADLINE_40_OR_LATER"
-  end
-  if try_link(<
-#include 
-main() {rl_completion_append_character = 1;}
-EOF
-    # this feature is implemented in readline-2.1 or later. 
-    $CFLAGS += " -DREADLINE_21_OR_LATER"
-  end
-  create_makefile("readline")
-end
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
deleted file mode 100644
index 7162042163..0000000000
--- a/ext/readline/readline.c
+++ /dev/null
@@ -1,740 +0,0 @@
-/* readline.c -- GNU Readline module
-   Copyright (C) 1997-2001  Shugo Maeda */
-
-#include 
-#include 
-#include 
-#include 
-
-#include "ruby.h"
-#include "rubysig.h"
-
-static VALUE mReadline;
-
-#define TOLOWER(c) (isupper(c) ? tolower(c) : c)
-
-#define COMPLETION_PROC "completion_proc"
-#define COMPLETION_CASE_FOLD "completion_case_fold"
-
-#ifndef READLINE_42_OR_LATER
-# define rl_filename_completion_function filename_completion_function
-# define rl_username_completion_function username_completion_function
-# define rl_completion_matches completion_matches
-#endif
-
-static int
-readline_event()
-{
-    CHECK_INTS;
-    rb_thread_schedule();
-    return 0;
-}
-
-static VALUE
-readline_readline(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    VALUE tmp, add_hist, result;
-    char *prompt = NULL;
-    char *buff;
-    int status;
-
-    if (rb_scan_args(argc, argv, "02", &tmp, &add_hist) > 0) {
-	prompt = StringValuePtr(tmp);
-    }
-
-    if (!isatty(0) && errno == EBADF) rb_raise(rb_eIOError, "stdin closed");
-
-    buff = (char*)rb_protect((VALUE(*)_((VALUE)))readline, (VALUE)prompt,
-                              &status);
-    if (status) {
-#if READLINE_40_OR_LATER
-        /* restore terminal mode and signal handler*/
-        rl_cleanup_after_signal();
-#elif READLINE_21_OR_LATER
-        /* restore terminal mode */
-        (*rl_deprep_term_function)();
-#else
-        rl_deprep_terminal();
-#endif
-        rb_jump_tag(status);
-    }
-
-    if (RTEST(add_hist) && buff) {
-	add_history(buff);
-    }
-    if (buff)
-	result = rb_tainted_str_new2(buff);
-    else
-	result = Qnil;
-    if (buff) free(buff);
-    return result;
-}
-
-static VALUE
-readline_s_set_completion_proc(self, proc)
-    VALUE self;
-    VALUE proc;
-{
-    if (!rb_respond_to(proc, rb_intern("call")))
-	rb_raise(rb_eArgError, "argument have to respond to `call'");
-    return rb_iv_set(mReadline, COMPLETION_PROC, proc);
-}
-
-static VALUE
-readline_s_get_completion_proc(self)
-    VALUE self;
-{
-    return rb_iv_get(mReadline, COMPLETION_PROC);
-}
-
-static VALUE
-readline_s_set_completion_case_fold(self, val)
-    VALUE self;
-    VALUE val;
-{
-    return rb_iv_set(mReadline, COMPLETION_CASE_FOLD, val);
-}
-
-static VALUE
-readline_s_get_completion_case_fold(self)
-    VALUE self;
-{
-    return rb_iv_get(mReadline, COMPLETION_CASE_FOLD);
-}
-
-static char **
-readline_attempted_completion_function(text, start, end)
-    char *text;
-    int start;
-    int end;
-{
-    VALUE proc, ary, temp;
-    char **result;
-    int case_fold;
-    int i, matches;
-
-    proc = rb_iv_get(mReadline, COMPLETION_PROC);
-    if (NIL_P(proc))
-	return NULL;
-    rl_attempted_completion_over = 1;
-    case_fold = RTEST(rb_iv_get(mReadline, COMPLETION_CASE_FOLD));
-    ary = rb_funcall(proc, rb_intern("call"), 1, rb_tainted_str_new2(text));
-    if (TYPE(ary) != T_ARRAY)
-	ary = rb_Array(ary);
-    matches = RARRAY(ary)->len;
-    if (matches == 0)
-	return NULL;
-    result = ALLOC_N(char *, matches + 2);
-    for (i = 0; i < matches; i++) {
-	temp = rb_obj_as_string(RARRAY(ary)->ptr[i]);
-	result[i + 1] = ALLOC_N(char, RSTRING(temp)->len + 1);
-	strcpy(result[i + 1], RSTRING(temp)->ptr);
-    }
-    result[matches + 1] = NULL;
-
-    if (matches == 1) {
-	result[0] = result[1];
-	result[1] = NULL;
-    } else {
-	register int i = 1;
-	int low = 100000;
-
-	while (i < matches) {
-	    register int c1, c2, si;
-
-	    if (case_fold) {
-		for (si = 0;
-		     (c1 = TOLOWER(result[i][si])) &&
-			 (c2 = TOLOWER(result[i + 1][si]));
-		     si++)
-		    if (c1 != c2) break;
-	    } else {
-		for (si = 0;
-		     (c1 = result[i][si]) &&
-			 (c2 = result[i + 1][si]);
-		     si++)
-		    if (c1 != c2) break;
-	    }
-
-	    if (low > si) low = si;
-	    i++;
-	}
-	result[0] = ALLOC_N(char, low + 1);
-	strncpy(result[0], result[1], low);
-	result[0][low] = '\0';
-    }
-
-    return result;
-}
-
-static VALUE
-readline_s_vi_editing_mode(self)
-    VALUE self;
-{
-    rl_vi_editing_mode(1,0);
-    return Qnil;
-}
-
-static VALUE
-readline_s_emacs_editing_mode(self)
-    VALUE self;
-{
-    rl_emacs_editing_mode(1,0);
-    return Qnil;
-}
-
-static VALUE
-readline_s_set_completion_append_character(self, str)
-    VALUE self, str;
-{
-#ifdef READLINE_21_OR_LATER
-    if (NIL_P(str)) {
-	rl_completion_append_character = '\0';
-    } else {
-	StringValue(str);
-
-	rl_completion_append_character = RSTRING(str)->ptr[0];
-    }
-
-    return self;
-#else
-    rb_notimplement();
-#endif /* READLINE_21_OR_LATER */
-}
-
-static VALUE
-readline_s_get_completion_append_character(self)
-    VALUE self;
-{
-#ifdef READLINE_21_OR_LATER
-    VALUE str;
-
-    if (rl_completion_append_character == '\0')
-	return Qnil;
-
-    str = rb_str_new("", 1);
-    RSTRING(str)->ptr[0] = rl_completion_append_character;
-
-    return str;
-#else
-    rb_notimplement();
-#endif /* READLINE_21_OR_LATER */
-}
-
-static VALUE
-readline_s_set_basic_word_break_characters(self, str)
-    VALUE self, str;
-{
-#ifdef READLINE_21_OR_LATER
-    static char *basic_word_break_characters = NULL;
-    char *s;
-
-    StringValue(str);
-    if (basic_word_break_characters == NULL) {
-	basic_word_break_characters =
-	    ALLOC_N(char, RSTRING(str)->len + 1);
-    }
-    else {
-	REALLOC_N(basic_word_break_characters, char, RSTRING(str)->len + 1);
-    }
-    strncpy(basic_word_break_characters,
-	    RSTRING(str)->ptr, RSTRING(str)->len);
-    basic_word_break_characters[RSTRING(str)->len] = '\0';
-    rl_basic_word_break_characters = basic_word_break_characters;
-
-    return self;
-#else
-    rb_notimplement();
-#endif /* READLINE_21_OR_LATER */
-}
-
-static VALUE
-readline_s_get_basic_word_break_characters(self, str)
-    VALUE self, str;
-{
-#ifdef READLINE_21_OR_LATER
-    if (rl_basic_word_break_characters == NULL)
-	return Qnil;
-    return rb_str_new2(rl_basic_word_break_characters);
-#else
-    rb_notimplement();
-#endif /* READLINE_21_OR_LATER */
-}
-
-static VALUE
-readline_s_set_completer_word_break_characters(self, str)
-    VALUE self, str;
-{
-#ifdef READLINE_21_OR_LATER
-    static char *completer_word_break_characters = NULL;
-    char *s;
-
-    StringValue(str);
-    if (completer_word_break_characters == NULL) {
-	completer_word_break_characters =
-	    ALLOC_N(char, RSTRING(str)->len + 1);
-    }
-    else {
-	REALLOC_N(completer_word_break_characters, char, RSTRING(str)->len + 1);
-    }
-    strncpy(completer_word_break_characters,
-	    RSTRING(str)->ptr, RSTRING(str)->len);
-    completer_word_break_characters[RSTRING(str)->len] = '\0';
-    rl_completer_word_break_characters = completer_word_break_characters;
-
-    return self;
-#else
-    rb_notimplement();
-#endif /* READLINE_21_OR_LATER */
-}
-
-static VALUE
-readline_s_get_completer_word_break_characters(self, str)
-    VALUE self, str;
-{
-#ifdef READLINE_21_OR_LATER
-    if (rl_completer_word_break_characters == NULL)
-	return Qnil;
-    return rb_str_new2(rl_completer_word_break_characters);
-#else
-    rb_notimplement();
-#endif /* READLINE_21_OR_LATER */
-}
-
-static VALUE
-readline_s_set_basic_quote_characters(self, str)
-    VALUE self, str;
-{
-#ifdef READLINE_21_OR_LATER
-    static char *basic_quote_characters = NULL;
-    char *s;
-
-    StringValue(str);
-    if (basic_quote_characters == NULL) {
-	basic_quote_characters =
-	    ALLOC_N(char, RSTRING(str)->len + 1);
-    }
-    else {
-	REALLOC_N(basic_quote_characters, char, RSTRING(str)->len + 1);
-    }
-    strncpy(basic_quote_characters,
-	    RSTRING(str)->ptr, RSTRING(str)->len);
-    basic_quote_characters[RSTRING(str)->len] = '\0';
-    rl_basic_quote_characters = basic_quote_characters;
-
-    return self;
-#else
-    rb_notimplement();
-#endif /* READLINE_21_OR_LATER */
-}
-
-static VALUE
-readline_s_get_basic_quote_characters(self, str)
-    VALUE self, str;
-{
-#ifdef READLINE_21_OR_LATER
-    if (rl_basic_quote_characters == NULL)
-	return Qnil;
-    return rb_str_new2(rl_basic_quote_characters);
-#else
-    rb_notimplement();
-#endif /* READLINE_21_OR_LATER */
-}
-
-static VALUE
-readline_s_set_completer_quote_characters(self, str)
-    VALUE self, str;
-{
-#ifdef READLINE_21_OR_LATER
-    static char *completer_quote_characters = NULL;
-    char *s;
-
-    StringValue(str);
-    if (completer_quote_characters == NULL) {
-	completer_quote_characters =
-	    ALLOC_N(char, RSTRING(str)->len + 1);
-    }
-    else {
-	REALLOC_N(completer_quote_characters, char, RSTRING(str)->len + 1);
-    }
-    strncpy(completer_quote_characters,
-	    RSTRING(str)->ptr, RSTRING(str)->len);
-    completer_quote_characters[RSTRING(str)->len] = '\0';
-    rl_completer_quote_characters = completer_quote_characters;
-
-    return self;
-#else
-    rb_notimplement();
-#endif /* READLINE_21_OR_LATER */
-}
-
-static VALUE
-readline_s_get_completer_quote_characters(self, str)
-    VALUE self, str;
-{
-#ifdef READLINE_21_OR_LATER
-    if (rl_completer_quote_characters == NULL)
-	return Qnil;
-    return rb_str_new2(rl_completer_quote_characters);
-#else
-    rb_notimplement();
-#endif /* READLINE_21_OR_LATER */
-}
-
-static VALUE
-readline_s_set_filename_quote_characters(self, str)
-    VALUE self, str;
-{
-#ifdef READLINE_21_OR_LATER
-    static char *filename_quote_characters = NULL;
-    char *s;
-
-    StringValue(str);
-    if (filename_quote_characters == NULL) {
-	filename_quote_characters =
-	    ALLOC_N(char, RSTRING(str)->len + 1);
-    }
-    else {
-	REALLOC_N(filename_quote_characters, char, RSTRING(str)->len + 1);
-    }
-    strncpy(filename_quote_characters,
-	    RSTRING(str)->ptr, RSTRING(str)->len);
-    filename_quote_characters[RSTRING(str)->len] = '\0';
-    rl_filename_quote_characters = filename_quote_characters;
-
-    return self;
-#else
-    rb_notimplement();
-#endif /* READLINE_21_OR_LATER */
-}
-
-static VALUE
-readline_s_get_filename_quote_characters(self, str)
-    VALUE self, str;
-{
-#ifdef READLINE_21_OR_LATER
-    if (rl_filename_quote_characters == NULL)
-	return Qnil;
-    return rb_str_new2(rl_filename_quote_characters);
-#else
-    rb_notimplement();
-#endif /* READLINE_21_OR_LATER */
-}
-
-static VALUE
-rb_remove_history(index)
-    int index;
-{
-    HIST_ENTRY *entry;
-    VALUE val;
-
-    entry = remove_history(index);
-    if (entry) {
-        val = rb_tainted_str_new2(entry->line);
-        free(entry->line);
-        free(entry);
-        return val;
-    }
-    return Qnil;
-}
-
-static VALUE
-hist_to_s(self)
-    VALUE self;
-{
-    return rb_str_new2("HISTORY");
-}
-
-static VALUE
-hist_get(self, index)
-    VALUE self;
-    VALUE index;
-{
-    HISTORY_STATE *state;
-    int i;
-
-    state = history_get_history_state();
-    i = NUM2INT(index);
-    if (i < 0) {
-        i += state->length;
-    }
-    if (i < 0 || i > state->length - 1) {
-	rb_raise(rb_eIndexError, "Invalid index");
-    }
-    return rb_tainted_str_new2(state->entries[i]->line);
-}
-
-static VALUE
-hist_set(self, index, str)
-    VALUE self;
-    VALUE index;
-    VALUE str;
-{
-    HISTORY_STATE *state;
-    VALUE s = str;
-    int i;
-
-    state = history_get_history_state();
-    i = NUM2INT(index);
-    if (i < 0) {
-        i += state->length;
-    }
-    if (i < 0 || i > state->length - 1) {
-	rb_raise(rb_eIndexError, "Invalid index");
-    }
-    replace_history_entry(i, StringValuePtr(s), NULL);
-    return str;
-}
-
-static VALUE
-hist_push(self, str)
-    VALUE self;
-    VALUE str;
-{
-    add_history(StringValuePtr(str));
-    return self;
-}
-
-static VALUE
-hist_push_method(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    VALUE str;
-    
-    while (argc--) {
-	str = *argv++;
-	add_history(StringValuePtr(str));
-    }
-    return self;
-}
-
-static VALUE
-hist_pop(self)
-    VALUE self;
-{
-    HISTORY_STATE *state;
-
-    state = history_get_history_state();
-    if (state->length > 0) {
-	return rb_remove_history(state->length - 1);
-    } else {
-	return Qnil;
-    }
-}
-
-static VALUE
-hist_shift(self)
-    VALUE self;
-{
-    HISTORY_STATE *state;
-
-    state = history_get_history_state();
-    if (state->length > 0) {
-	return rb_remove_history(0);
-    } else {
-	return Qnil;
-    }
-}
-
-static VALUE
-hist_each(self)
-    VALUE self;
-{
-    HISTORY_STATE *state;
-    int i;
-
-    state = history_get_history_state();
-    for (i = 0; i < state->length; i++) {
-	rb_yield(rb_tainted_str_new2(state->entries[i]->line));
-    }
-    return self;
-}
-
-static VALUE
-hist_length(self)
-    VALUE self;
-{
-    HISTORY_STATE *state;
-
-    state = history_get_history_state();
-    return INT2NUM(state->length);
-}
-
-static VALUE
-hist_empty_p(self)
-    VALUE self;
-{
-    HISTORY_STATE *state;
-
-    state = history_get_history_state();
-    if (state->length == 0)
-	return Qtrue;
-    else
-	return Qfalse;
-}
-
-static VALUE
-hist_delete_at(self, index)
-    VALUE self;
-    VALUE index;
-{
-    HISTORY_STATE *state;
-    int i;
-
-    state = history_get_history_state();
-    i = NUM2INT(index);
-    if (i < 0)
-        i += state->length;
-    if (i < 0 || i > state->length - 1) {
-	rb_raise(rb_eIndexError, "Invalid index");
-    }
-    return rb_remove_history(i);
-}
-
-static VALUE
-filename_completion_proc_call(self, str)
-    VALUE self;
-    VALUE str;
-{
-    VALUE result;
-    char **matches;
-    int i;
-
-    matches = rl_completion_matches(StringValuePtr(str),
-				    rl_filename_completion_function);
-    if (matches) {
-	result = rb_ary_new();
-	for (i = 0; matches[i]; i++) {
-	    rb_ary_push(result, rb_tainted_str_new2(matches[i]));
-	    free(matches[i]);
-	}
-	free(matches);
-	if (RARRAY(result)->len >= 2)
-	    rb_ary_shift(result);
-    }
-    else {
-	result = Qnil;
-    }
-    return result;
-}
-
-static VALUE
-username_completion_proc_call(self, str)
-    VALUE self;
-    VALUE str;
-{
-    VALUE result;
-    char **matches;
-    int i;
-
-    matches = rl_completion_matches(StringValuePtr(str),
-				    rl_username_completion_function);
-    if (matches) {
-	result = rb_ary_new();
-	for (i = 0; matches[i]; i++) {
-	    rb_ary_push(result, rb_tainted_str_new2(matches[i]));
-	    free(matches[i]);
-	}
-	free(matches);
-	if (RARRAY(result)->len >= 2)
-	    rb_ary_shift(result);
-    }
-    else {
-	result = Qnil;
-    }
-    return result;
-}
-
-void
-Init_readline()
-{
-    VALUE histary, fcomp, ucomp;
-
-    /* Allow conditional parsing of the ~/.inputrc file. */
-    rl_readline_name = "Ruby";
-
-    using_history();
-
-    mReadline = rb_define_module("Readline");
-    rb_define_module_function(mReadline, "readline",
-			      readline_readline, -1);
-    rb_define_singleton_method(mReadline, "completion_proc=",
-			       readline_s_set_completion_proc, 1);
-    rb_define_singleton_method(mReadline, "completion_proc",
-			       readline_s_get_completion_proc, 0);
-    rb_define_singleton_method(mReadline, "completion_case_fold=",
-			       readline_s_set_completion_case_fold, 1);
-    rb_define_singleton_method(mReadline, "completion_case_fold",
-			       readline_s_get_completion_case_fold, 0);
-    rb_define_singleton_method(mReadline, "vi_editing_mode",
-			       readline_s_vi_editing_mode, 0);
-    rb_define_singleton_method(mReadline, "emacs_editing_mode",
-			       readline_s_emacs_editing_mode, 0);
-    rb_define_singleton_method(mReadline, "completion_append_character=",
-			       readline_s_set_completion_append_character, 1);
-    rb_define_singleton_method(mReadline, "completion_append_character",
-			       readline_s_get_completion_append_character, 0);
-    rb_define_singleton_method(mReadline, "basic_word_break_characters=",
-			       readline_s_set_basic_word_break_characters, 1);
-    rb_define_singleton_method(mReadline, "basic_word_break_characters",
-			       readline_s_get_basic_word_break_characters, 0);
-    rb_define_singleton_method(mReadline, "completer_word_break_characters=",
-			       readline_s_set_completer_word_break_characters, 1);
-    rb_define_singleton_method(mReadline, "completer_word_break_characters",
-			       readline_s_get_completer_word_break_characters, 0);
-    rb_define_singleton_method(mReadline, "basic_quote_characters=",
-			       readline_s_set_basic_quote_characters, 1);
-    rb_define_singleton_method(mReadline, "basic_quote_characters",
-			       readline_s_get_basic_quote_characters, 0);
-    rb_define_singleton_method(mReadline, "completer_quote_characters=",
-			       readline_s_set_completer_quote_characters, 1);
-    rb_define_singleton_method(mReadline, "completer_quote_characters",
-			       readline_s_get_completer_quote_characters, 0);
-    rb_define_singleton_method(mReadline, "filename_quote_characters=",
-			       readline_s_set_filename_quote_characters, 1);
-    rb_define_singleton_method(mReadline, "filename_quote_characters",
-			       readline_s_get_filename_quote_characters, 0);
-
-    histary = rb_obj_alloc(rb_cObject);
-    rb_extend_object(histary, rb_mEnumerable);
-    rb_define_singleton_method(histary,"to_s", hist_to_s, 0);
-    rb_define_singleton_method(histary,"[]", hist_get, 1);
-    rb_define_singleton_method(histary,"[]=", hist_set, 2);
-    rb_define_singleton_method(histary,"<<", hist_push, 1);
-    rb_define_singleton_method(histary,"push", hist_push_method, -1);
-    rb_define_singleton_method(histary,"pop", hist_pop, 0);
-    rb_define_singleton_method(histary,"shift", hist_shift, 0);
-    rb_define_singleton_method(histary,"each", hist_each, 0);
-    rb_define_singleton_method(histary,"length", hist_length, 0);
-    rb_define_singleton_method(histary,"size", hist_length, 0);
-
-    rb_define_singleton_method(histary,"empty?", hist_empty_p, 0);
-    rb_define_singleton_method(histary,"delete_at", hist_delete_at, 1);
-    rb_define_const(mReadline, "HISTORY", histary);
-
-    fcomp = rb_obj_alloc(rb_cObject);
-    rb_define_singleton_method(fcomp, "call",
-			       filename_completion_proc_call, 1);
-    rb_define_const(mReadline, "FILENAME_COMPLETION_PROC", fcomp);
-
-    ucomp = rb_obj_alloc(rb_cObject);
-    rb_define_singleton_method(ucomp, "call",
-			       username_completion_proc_call, 1);
-    rb_define_const(mReadline, "USERNAME_COMPLETION_PROC", ucomp);
-#if READLINE_21_OR_LATER
-    rb_define_const(mReadline, "VERSION", rb_str_new2(rl_library_version));
-#else
-    rb_define_const(mReadline, "VERSION",
-                    rb_str_new2("2.0 or before version"));
-#endif
-
-    rl_attempted_completion_function
-	= (CPPFunction *) readline_attempted_completion_function;
-    rl_event_hook = readline_event;
-    rl_clear_signals();
-}
diff --git a/ext/sdbm/.cvsignore b/ext/sdbm/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/sdbm/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/sdbm/MANIFEST b/ext/sdbm/MANIFEST
deleted file mode 100644
index 8888e69ad4..0000000000
--- a/ext/sdbm/MANIFEST
+++ /dev/null
@@ -1,6 +0,0 @@
-MANIFEST
-_sdbm.c
-depend
-extconf.rb
-init.c
-sdbm.h
diff --git a/ext/sdbm/_sdbm.c b/ext/sdbm/_sdbm.c
deleted file mode 100644
index d8bfae80b2..0000000000
--- a/ext/sdbm/_sdbm.c
+++ /dev/null
@@ -1,973 +0,0 @@
-/*
- * sdbm - ndbm work-alike hashed database library
- * based on Per-Aake Larson's Dynamic Hashing algorithms. BIT 18 (1978).
- * author: oz@nexus.yorku.ca
- * status: public domain.
- *
- * core routines
- */
-
-#ifndef lint
-/*char sdbm_rcsid[] = "$Id$";*/
-#endif
-
-#include "sdbm.h"
-#include "config.h"
-
-/*
- * sdbm - ndbm work-alike hashed database library
- * tuning and portability constructs [not nearly enough]
- * author: oz@nexus.yorku.ca
- */
-
-#define BYTESIZ		8
-
-#ifdef HAVE_UNISTD_H
-#include 
-#endif
-
-#ifdef BSD42
-#define SEEK_SET	L_SET
-#define	memset(s,c,n)	bzero(s, n)		/* only when c is zero */
-#define	memcpy(s1,s2,n)	bcopy(s2, s1, n)
-#define	memcmp(s1,s2,n)	bcmp(s1,s2,n)
-#endif
-
-/*
- * important tuning parms (hah)
- */
-
-#define SEEDUPS		/* always detect duplicates */
-#define BADMESS		/* generate a message for worst case:
-			   cannot make room after SPLTMAX splits */
-/*
- * misc
- */
-#ifdef DEBUG
-#define debug(x)	printf x
-#else
-#define debug(x)
-#endif
-
-#ifdef BIG_E
-#define GET_SHORT(p, i)	(((unsigned)((unsigned char *)(p))[(i)*2] << 8) + (((unsigned char *)(p))[(i)*2 + 1]))
-#define PUT_SHORT(p, i, s) (((unsigned char *)(p))[(i)*2] = (unsigned char)((s) >> 8), ((unsigned char *)(p))[(i)*2 + 1] = (unsigned char)(s))
-#else
-#define GET_SHORT(p, i)	((p)[i])
-#define PUT_SHORT(p, i, s)	((p)[i] = (s))
-#endif
-
-/*#include "pair.h"*/
-static int   fitpair proto((char *, int));
-static void  putpair proto((char *, datum, datum));
-static datum getpair proto((char *, datum));
-static int   delpair proto((char *, datum));
-static int   chkpage proto((char *));
-static datum getnkey proto((char *, int));
-static void  splpage proto((char *, char *, long));
-#ifdef SEEDUPS
-static int   duppair proto((char *, datum));
-#endif
-
-#include 
-#include 
-#ifdef MSDOS
-#include 
-#endif
-#include 
-#include 
-#ifdef BSD42
-#include 
-#else
-#include 
-/*#include */
-#endif
-#ifndef O_BINARY
-#define O_BINARY	0
-#endif
-
-#include 
-#ifndef EPERM
-#define EPERM	EACCES
-#endif
-#include 
-
-#ifdef __STDC__
-#include 
-#endif
-
-#ifndef NULL
-#define NULL	0
-#endif
-
-/*
- * externals
- */
-#if !defined sun && !defined MSDOS && !defined _WIN32 && !defined __CYGWIN__
-extern int errno;
-#endif
-
-/*
- * forward
- */
-static int getdbit proto((DBM *, long));
-static int setdbit proto((DBM *, long));
-static int getpage proto((DBM *, long));
-static datum getnext proto((DBM *));
-static int makroom proto((DBM *, long, int));
-
-/*
- * useful macros
- */
-#define bad(x)		((x).dptr == NULL || (x).dsize < 0)
-#define exhash(item)	sdbm_hash((item).dptr, (item).dsize)
-#define ioerr(db)	((db)->flags |= DBM_IOERR)
-
-#define OFF_PAG(off)	(long) (off) * PBLKSIZ
-#define OFF_DIR(off)	(long) (off) * DBLKSIZ
-
-static long masks[] = {
-	000000000000L, 000000000001L, 000000000003L,
-	000000000007L, 000000000017L, 000000000037L,
-	000000000077L, 000000000177L, 000000000377L,
-	000000000777L, 000000001777L, 000000003777L,
-	000000007777L, 000000017777L, 000000037777L,
-	000000077777L, 000000177777L, 000000377777L,
-	000000777777L, 000001777777L, 000003777777L,
-	000007777777L, 000017777777L, 000037777777L,
-	000077777777L, 000177777777L, 000377777777L,
-	000777777777L, 001777777777L, 003777777777L,
-	007777777777L, 017777777777L
-};
-
-datum nullitem = {NULL, 0};
-
-DBM *
-sdbm_open(file, flags, mode)
-register char *file;
-register int flags;
-register int mode;
-{
-	register DBM *db;
-	register char *dirname;
-	register char *pagname;
-	register int n;
-
-	if (file == NULL || !*file)
-		return errno = EINVAL, (DBM *) NULL;
-/*
- * need space for two seperate filenames
- */
-	n = strlen(file) * 2 + strlen(DIRFEXT) + strlen(PAGFEXT) + 2;
-
-	if ((dirname = malloc((unsigned) n)) == NULL)
-		return errno = ENOMEM, (DBM *) NULL;
-/*
- * build the file names
- */
-	dirname = strcat(strcpy(dirname, file), DIRFEXT);
-	pagname = strcpy(dirname + strlen(dirname) + 1, file);
-	pagname = strcat(pagname, PAGFEXT);
-
-	db = sdbm_prep(dirname, pagname, flags, mode);
-	free((char *) dirname);
-	return db;
-}
-
-DBM *
-sdbm_prep(dirname, pagname, flags, mode)
-char *dirname;
-char *pagname;
-int flags;
-int mode;
-{
-	register DBM *db;
-	struct stat dstat;
-
-	if ((db = (DBM *) malloc(sizeof(DBM))) == NULL)
-		return errno = ENOMEM, (DBM *) NULL;
-
-        db->flags = 0;
-        db->hmask = 0;
-        db->blkptr = 0;
-        db->keyptr = 0;
-/*
- * adjust user flags so that WRONLY becomes RDWR, 
- * as required by this package. Also set our internal
- * flag for RDONLY.
- */
-	if (flags & O_WRONLY)
-		flags = (flags & ~O_WRONLY) | O_RDWR;
-	if (flags & O_RDONLY)
-		db->flags = DBM_RDONLY;
-/*
- * open the files in sequence, and stat the dirfile.
- * If we fail anywhere, undo everything, return NULL.
- */
-	flags |= O_BINARY;
-	if ((db->pagf = open(pagname, flags, mode)) > -1) {
-		if ((db->dirf = open(dirname, flags, mode)) > -1) {
-/*
- * need the dirfile size to establish max bit number.
- */
-			if (fstat(db->dirf, &dstat) == 0) {
-/*
- * zero size: either a fresh database, or one with a single,
- * unsplit data page: dirpage is all zeros.
- */
-				db->dirbno = (!dstat.st_size) ? 0 : -1;
-				db->pagbno = -1;
-				db->maxbno = dstat.st_size * (long) BYTESIZ;
-
-				(void) memset(db->pagbuf, 0, PBLKSIZ);
-				(void) memset(db->dirbuf, 0, DBLKSIZ);
-			/*
-			 * success
-			 */
-				return db;
-			}
-			(void) close(db->dirf);
-		}
-		(void) close(db->pagf);
-	}
-	free((char *) db);
-	return (DBM *) NULL;
-}
-
-void
-sdbm_close(db)
-register DBM *db;
-{
-	if (db == NULL)
-		errno = EINVAL;
-	else {
-		(void) close(db->dirf);
-		(void) close(db->pagf);
-		free((char *) db);
-	}
-}
-
-datum
-sdbm_fetch(db, key)
-register DBM *db;
-datum key;
-{
-	if (db == NULL || bad(key))
-		return errno = EINVAL, nullitem;
-
-	if (getpage(db, exhash(key)))
-		return getpair(db->pagbuf, key);
-
-	return ioerr(db), nullitem;
-}
-
-int
-sdbm_delete(db, key)
-register DBM *db;
-datum key;
-{
-	if (db == NULL || bad(key))
-		return errno = EINVAL, -1;
-	if (sdbm_rdonly(db))
-		return errno = EPERM, -1;
-
-	if (getpage(db, exhash(key))) {
-		if (!delpair(db->pagbuf, key))
-			return -1;
-/*
- * update the page file
- */
-		if (lseek(db->pagf, OFF_PAG(db->pagbno), SEEK_SET) < 0
-		    || write(db->pagf, db->pagbuf, PBLKSIZ) < 0)
-			return ioerr(db), -1;
-
-		return 0;
-	}
-
-	return ioerr(db), -1;
-}
-
-int
-sdbm_store(db, key, val, flags)
-register DBM *db;
-datum key;
-datum val;
-int flags;
-{
-	int need;
-	register long hash;
-
-	if (db == NULL || bad(key))
-		return errno = EINVAL, -1;
-	if (sdbm_rdonly(db))
-		return errno = EPERM, -1;
-
-	need = key.dsize + val.dsize;
-/*
- * is the pair too big (or too small) for this database ??
- */
-	if (need < 0 || need > PAIRMAX)
-		return errno = EINVAL, -1;
-
-	if (getpage(db, (hash = exhash(key)))) {
-/*
- * if we need to replace, delete the key/data pair
- * first. If it is not there, ignore.
- */
-		if (flags == DBM_REPLACE)
-			(void) delpair(db->pagbuf, key);
-#ifdef SEEDUPS
-		else if (duppair(db->pagbuf, key))
-			return 1;
-#endif
-/*
- * if we do not have enough room, we have to split.
- */
-		if (!fitpair(db->pagbuf, need))
-			if (!makroom(db, hash, need))
-				return ioerr(db), -1;
-/*
- * we have enough room or split is successful. insert the key,
- * and update the page file.
- */
-		(void) putpair(db->pagbuf, key, val);
-
-		if (lseek(db->pagf, OFF_PAG(db->pagbno), SEEK_SET) < 0
-		    || write(db->pagf, db->pagbuf, PBLKSIZ) < 0)
-			return ioerr(db), -1;
-	/*
-	 * success
-	 */
-		return 0;
-	}
-
-	return ioerr(db), -1;
-}
-
-/*
- * makroom - make room by splitting the overfull page
- * this routine will attempt to make room for SPLTMAX times before
- * giving up.
- */
-static int
-makroom(db, hash, need)
-register DBM *db;
-long hash;
-int need;
-{
-	long newp;
-	char twin[PBLKSIZ];
-#if defined MSDOS || (defined _WIN32 && !defined __CYGWIN__)
-	char zer[PBLKSIZ];
-	long oldtail;
-#endif
-	char *pag = db->pagbuf;
-	char *new = twin;
-	register int smax = SPLTMAX;
-
-	do {
-/*
- * split the current page
- */
-		(void) splpage(pag, new, db->hmask + 1);
-/*
- * address of the new page
- */
-		newp = (hash & db->hmask) | (db->hmask + 1);
-		debug(("newp: %ld\n", newp));
-/*
- * write delay, read avoidence/cache shuffle:
- * select the page for incoming pair: if key is to go to the new page,
- * write out the previous one, and copy the new one over, thus making
- * it the current page. If not, simply write the new page, and we are
- * still looking at the page of interest. current page is not updated
- * here, as sdbm_store will do so, after it inserts the incoming pair.
- */
-
-#if defined MSDOS || (defined _WIN32 && !defined __CYGWIN__)
-	/*
-	 * Fill hole with 0 if made it.
-	 * (hole is NOT read as 0)
-	 */
-	oldtail = lseek(db->pagf, 0L, SEEK_END);
-	memset(zer, 0, PBLKSIZ);
-	while (OFF_PAG(newp) > oldtail) {
-		if (lseek(db->pagf, 0L, SEEK_END) < 0 ||
-		    write(db->pagf, zer, PBLKSIZ) < 0) {
-
-			return 0;
-		}
-		oldtail += PBLKSIZ;
-	}
-#endif
-
-		if (hash & (db->hmask + 1)) {
-			if (lseek(db->pagf, OFF_PAG(db->pagbno), SEEK_SET) < 0
-			    || write(db->pagf, db->pagbuf, PBLKSIZ) < 0)
-				return 0;
-			db->pagbno = newp;
-			(void) memcpy(pag, new, PBLKSIZ);
-		}
-		else if (lseek(db->pagf, OFF_PAG(newp), SEEK_SET) < 0
-			 || write(db->pagf, new, PBLKSIZ) < 0)
-			return 0;
-
-		if (!setdbit(db, db->curbit))
-			return 0;
-/*
- * see if we have enough room now
- */
-		if (fitpair(pag, need))
-			return 1;
-/*
- * try again... update curbit and hmask as getpage would have
- * done. because of our update of the current page, we do not
- * need to read in anything. BUT we have to write the current
- * [deferred] page out, as the window of failure is too great.
- */
-		db->curbit = 2 * db->curbit + 
-			((hash & (db->hmask + 1)) ? 2 : 1);
-		db->hmask |= (db->hmask + 1);
-
-		if (lseek(db->pagf, OFF_PAG(db->pagbno), SEEK_SET) < 0
-		    || write(db->pagf, db->pagbuf, PBLKSIZ) < 0)
-			return 0;
-
-	} while (--smax);
-/*
- * if we are here, this is real bad news. After SPLTMAX splits,
- * we still cannot fit the key. say goodnight.
- */
-#ifdef BADMESS
-	(void) write(2, "sdbm: cannot insert after SPLTMAX attempts.\n", 44);
-#endif
-	return 0;
-
-}
-
-/*
- * the following two routines will break if
- * deletions aren't taken into account. (ndbm bug)
- */
-datum
-sdbm_firstkey(db)
-register DBM *db;
-{
-	if (db == NULL)
-		return errno = EINVAL, nullitem;
-/*
- * start at page 0
- */
-	(void) memset(db->pagbuf, 0, PBLKSIZ);
-	if (lseek(db->pagf, OFF_PAG(0), SEEK_SET) < 0
-	    || read(db->pagf, db->pagbuf, PBLKSIZ) < 0)
-		return ioerr(db), nullitem;
-	db->pagbno = 0;
-	db->blkptr = 0;
-	db->keyptr = 0;
-
-	return getnext(db);
-}
-
-datum
-sdbm_nextkey(db)
-register DBM *db;
-{
-	if (db == NULL)
-		return errno = EINVAL, nullitem;
-	return getnext(db);
-}
-
-/*
- * all important binary trie traversal
- */
-static int
-getpage(db, hash)
-register DBM *db;
-register long hash;
-{
-	register int hbit;
-	register long dbit;
-	register long pagb;
-
-	dbit = 0;
-	hbit = 0;
-	while (dbit < db->maxbno && getdbit(db, dbit))
-		dbit = 2 * dbit + ((hash & ((long) 1 << hbit++)) ? 2 : 1);
-
-	debug(("dbit: %d...", dbit));
-
-	db->curbit = dbit;
-	db->hmask = masks[hbit];
-
-	pagb = hash & db->hmask;
-/*
- * see if the block we need is already in memory.
- * note: this lookaside cache has about 10% hit rate.
- */
-	if (pagb != db->pagbno) { 
-/*
- * note: here, we assume a "hole" is read as 0s.
- * if not, must zero pagbuf first.
- */
-		(void) memset(db->pagbuf, 0, PBLKSIZ);
-
-		if (lseek(db->pagf, OFF_PAG(pagb), SEEK_SET) < 0
-		    || read(db->pagf, db->pagbuf, PBLKSIZ) < 0)
-			return 0;
-		if (!chkpage(db->pagbuf)) {
-			return 0;
-		}
-		db->pagbno = pagb;
-
-		debug(("pag read: %d\n", pagb));
-	}
-	return 1;
-}
-
-static int
-getdbit(db, dbit)
-register DBM *db;
-register long dbit;
-{
-	register long c;
-	register long dirb;
-
-	c = dbit / BYTESIZ;
-	dirb = c / DBLKSIZ;
-
-	if (dirb != db->dirbno) {
-		if (lseek(db->dirf, OFF_DIR(dirb), SEEK_SET) < 0
-		    || read(db->dirf, db->dirbuf, DBLKSIZ) < 0)
-			return 0;
-		db->dirbno = dirb;
-
-		debug(("dir read: %d\n", dirb));
-	}
-
-	return db->dirbuf[c % DBLKSIZ] & (1 << (dbit % BYTESIZ));
-}
-
-static int
-setdbit(db, dbit)
-register DBM *db;
-register long dbit;
-{
-	register long c;
-	register long dirb;
-
-	c = dbit / BYTESIZ;
-	dirb = c / DBLKSIZ;
-
-	if (dirb != db->dirbno) {
-		if (lseek(db->dirf, OFF_DIR(dirb), SEEK_SET) < 0
-		    || read(db->dirf, db->dirbuf, DBLKSIZ) < 0)
-			return 0;
-		db->dirbno = dirb;
-
-		debug(("dir read: %d\n", dirb));
-	}
-
-	db->dirbuf[c % DBLKSIZ] |= (1 << (dbit % BYTESIZ));
-
-	if (dbit >= db->maxbno)
-		db->maxbno += (long) DBLKSIZ * BYTESIZ;
-
-	if (lseek(db->dirf, OFF_DIR(dirb), SEEK_SET) < 0
-	    || write(db->dirf, db->dirbuf, DBLKSIZ) < 0)
-		return 0;
-
-	return 1;
-}
-
-/*
- * getnext - get the next key in the page, and if done with
- * the page, try the next page in sequence
- */
-static datum
-getnext(db)
-register DBM *db;
-{
-	datum key;
-
-	for (;;) {
-		db->keyptr++;
-		key = getnkey(db->pagbuf, db->keyptr);
-		if (key.dptr != NULL)
-			return key;
-/*
- * we either run out, or there is nothing on this page..
- * try the next one... If we lost our position on the
- * file, we will have to seek.
- */
-		db->keyptr = 0;
-		if (db->pagbno != db->blkptr++)
-			if (lseek(db->pagf, OFF_PAG(db->blkptr), SEEK_SET) < 0)
-				break;
-		db->pagbno = db->blkptr;
-		if (read(db->pagf, db->pagbuf, PBLKSIZ) <= 0)
-			break;
-		if (!chkpage(db->pagbuf)) {
-			break;
-		}
-	}
-
-	return ioerr(db), nullitem;
-}
-
-/* pair.c */
-/*
- * sdbm - ndbm work-alike hashed database library
- * based on Per-Aake Larson's Dynamic Hashing algorithms. BIT 18 (1978).
- * author: oz@nexus.yorku.ca
- * status: public domain.
- *
- * page-level routines
- */
-
-#ifndef lint
-/*char pair_rcsid[] = "$Id$";*/
-#endif
-
-#ifndef BSD42
-/*#include */
-#endif
-
-#define exhash(item)	sdbm_hash((item).dptr, (item).dsize)
-
-/* 
- * forward 
- */
-static int seepair proto((char *, int, char *, int));
-
-/*
- * page format:
- *	+------------------------------+
- * ino	| n | keyoff | datoff | keyoff |
- * 	+------------+--------+--------+
- *	| datoff | - - - ---->	       |
- *	+--------+---------------------+
- *	|	 F R E E A R E A       |
- *	+--------------+---------------+
- *	|  <---- - - - | data          |
- *	+--------+-----+----+----------+
- *	|  key   | data     | key      |
- *	+--------+----------+----------+
- *
- * calculating the offsets for free area:  if the number
- * of entries (ino[0]) is zero, the offset to the END of
- * the free area is the block size. Otherwise, it is the
- * nth (ino[ino[0]]) entry's offset.
- */
-
-static int
-fitpair(pag, need)
-char *pag;
-int need;
-{
-	register int n;
-	register int off;
-	register int free;
-	register short *ino = (short *) pag;
-
-	off = ((n = GET_SHORT(ino,0)) > 0) ? GET_SHORT(ino,n) : PBLKSIZ;
-	free = off - (n + 1) * sizeof(short);
-	need += 2 * sizeof(short);
-
-	debug(("free %d need %d\n", free, need));
-
-	return need <= free;
-}
-
-static void
-putpair(pag, key, val)
-char *pag;
-datum key;
-datum val;
-{
-	register int n;
-	register int off;
-	register short *ino = (short *) pag;
-
-	off = ((n = GET_SHORT(ino,0)) > 0) ? GET_SHORT(ino,n) : PBLKSIZ;
-/*
- * enter the key first
- */
-	off -= key.dsize;
-	if (key.dsize)
-		(void) memcpy(pag + off, key.dptr, key.dsize);
-	PUT_SHORT(ino,n + 1,off);
-/*
- * now the data
- */
-	off -= val.dsize;
-	if (val.dsize)
-		(void) memcpy(pag + off, val.dptr, val.dsize);
-	PUT_SHORT(ino,n + 2,off);
-/*
- * adjust item count
- */
-	PUT_SHORT(ino,0,GET_SHORT(ino,0) + 2);
-}
-
-static datum
-getpair(pag, key)
-char *pag;
-datum key;
-{
-	register int i;
-	register int n;
-	datum val;
-	register short *ino = (short *) pag;
-
-	if ((n = GET_SHORT(ino,0)) == 0)
-		return nullitem;
-
-	if ((i = seepair(pag, n, key.dptr, key.dsize)) == 0)
-		return nullitem;
-
-	val.dptr = pag + GET_SHORT(ino,i + 1);
-	val.dsize = GET_SHORT(ino,i) - GET_SHORT(ino,i + 1);
-	return val;
-}
-
-#ifdef SEEDUPS
-static int
-duppair(pag, key)
-char *pag;
-datum key;
-{
-	register short *ino = (short *) pag;
-	return GET_SHORT(ino,0) > 0 &&
-		   seepair(pag, GET_SHORT(ino,0), key.dptr, key.dsize) > 0;
-}
-#endif
-
-static datum
-getnkey(pag, num)
-char *pag;
-int num;
-{
-	datum key;
-	register int off;
-	register short *ino = (short *) pag;
-
-	num = num * 2 - 1;
-	if (GET_SHORT(ino,0) == 0 || num > GET_SHORT(ino,0))
-		return nullitem;
-
-	off = (num > 1) ? GET_SHORT(ino,num - 1) : PBLKSIZ;
-
-	key.dptr = pag + GET_SHORT(ino,num);
-	key.dsize = off - GET_SHORT(ino,num);
-
-	return key;
-}
-
-static int
-delpair(pag, key)
-char *pag;
-datum key;
-{
-	register int n;
-	register int i;
-	register short *ino = (short *) pag;
-
-	if ((n = GET_SHORT(ino,0)) == 0)
-		return 0;
-
-	if ((i = seepair(pag, n, key.dptr, key.dsize)) == 0)
-		return 0;
-/*
- * found the key. if it is the last entry
- * [i.e. i == n - 1] we just adjust the entry count.
- * hard case: move all data down onto the deleted pair,
- * shift offsets onto deleted offsets, and adjust them.
- * [note: 0 < i < n]
- */
-	if (i < n - 1) {
-		register int m;
-		register char *dst = pag + (i == 1 ? PBLKSIZ : GET_SHORT(ino,i - 1));
-		register char *src = pag + GET_SHORT(ino,i + 1);
-		register int   zoo = dst - src;
-
-		debug(("free-up %d ", zoo));
-/*
- * shift data/keys down
- */
-		m = GET_SHORT(ino,i + 1) - GET_SHORT(ino,n);
-#ifdef DUFF
-#define MOVB 	*--dst = *--src
-
-		if (m > 0) {
-			register int loop = (m + 8 - 1) >> 3;
-
-			switch (m & (8 - 1)) {
-			case 0:	do {
-				MOVB;	case 7:	MOVB;
-			case 6:	MOVB;	case 5:	MOVB;
-			case 4:	MOVB;	case 3:	MOVB;
-			case 2:	MOVB;	case 1:	MOVB;
-				} while (--loop);
-			}
-		}
-#else
-#ifdef MEMMOVE
-		memmove(dst, src, m);
-#else
-		while (m--)
-			*--dst = *--src;
-#endif
-#endif
-/*
- * adjust offset index up
- */
-		while (i < n - 1) {
-			PUT_SHORT(ino,i, GET_SHORT(ino,i + 2) + zoo);
-			i++;
-		}
-	}
-	PUT_SHORT(ino, 0, GET_SHORT(ino, 0) - 2);
-	return 1;
-}
-
-/*
- * search for the key in the page.
- * return offset index in the range 0 < i < n.
- * return 0 if not found.
- */
-static int
-seepair(pag, n, key, siz)
-char *pag;
-register int n;
-register char *key;
-register int siz;
-{
-	register int i;
-	register int off = PBLKSIZ;
-	register short *ino = (short *) pag;
-
-	for (i = 1; i < n; i += 2) {
-		if (siz == off - GET_SHORT(ino,i) &&
-		    memcmp(key, pag + GET_SHORT(ino,i), siz) == 0)
-			return i;
-		off = GET_SHORT(ino,i + 1);
-	}
-	return 0;
-}
-
-static void
-splpage(pag, new, sbit)
-char *pag;
-char *new;
-long sbit;
-{
-	datum key;
-	datum val;
-
-	register int n;
-	register int off = PBLKSIZ;
-	char cur[PBLKSIZ];
-	register short *ino = (short *) cur;
-
-	(void) memcpy(cur, pag, PBLKSIZ);
-	(void) memset(pag, 0, PBLKSIZ);
-	(void) memset(new, 0, PBLKSIZ);
-
-	n = GET_SHORT(ino,0);
-	for (ino++; n > 0; ino += 2) {
-		key.dptr = cur + GET_SHORT(ino,0); 
-		key.dsize = off - GET_SHORT(ino,0);
-		val.dptr = cur + GET_SHORT(ino,1);
-		val.dsize = GET_SHORT(ino,0) - GET_SHORT(ino,1);
-/*
- * select the page pointer (by looking at sbit) and insert
- */
-		(void) putpair((exhash(key) & sbit) ? new : pag, key, val);
-
-		off = GET_SHORT(ino,1);
-		n -= 2;
-	}
-
-	debug(("%d split %d/%d\n", ((short *) cur)[0] / 2, 
-	       ((short *) new)[0] / 2,
-	       ((short *) pag)[0] / 2));
-}
-
-/*
- * check page sanity: 
- * number of entries should be something
- * reasonable, and all offsets in the index should be in order.
- * this could be made more rigorous.
- */
-static int
-chkpage(pag)
-char *pag;
-{
-	register int n;
-	register int off;
-	register short *ino = (short *) pag;
-
-	if ((n = GET_SHORT(ino,0)) < 0 || n > PBLKSIZ / sizeof(short))
-		return 0;
-
-	if (n > 0) {
-		off = PBLKSIZ;
-		for (ino++; n > 0; ino += 2) {
-			if (GET_SHORT(ino,0) > off || GET_SHORT(ino,1) > off ||
-			    GET_SHORT(ino,1) > GET_SHORT(ino,0))
-				return 0;
-			off = GET_SHORT(ino,1);
-			n -= 2;
-		}
-	}
-	return 1;
-}
-
-/* hash.c */
-/*
- * sdbm - ndbm work-alike hashed database library
- * based on Per-Aake Larson's Dynamic Hashing algorithms. BIT 18 (1978).
- * author: oz@nexus.yorku.ca
- * status: public domain. keep it that way.
- *
- * hashing routine
- */
-
-/*
- * polynomial conversion ignoring overflows
- * [this seems to work remarkably well, in fact better
- * then the ndbm hash function. Replace at your own risk]
- * use: 65599	nice.
- *      65587   even better. 
- */
-long
-sdbm_hash(str, len)
-register char *str;
-register int len;
-{
-	register unsigned long n = 0;
-
-#ifdef DUFF
-
-#define HASHC	n = *str++ + 65599 * n
-
-	if (len > 0) {
-		register int loop = (len + 8 - 1) >> 3;
-
-		switch(len & (8 - 1)) {
-		case 0:	do {
-			HASHC;	case 7:	HASHC;
-		case 6:	HASHC;	case 5:	HASHC;
-		case 4:	HASHC;	case 3:	HASHC;
-		case 2:	HASHC;	case 1:	HASHC;
-			} while (--loop);
-		}
-
-	}
-#else
-	while (len--)
-		n = ((*str++) & 255) + 65587L * n;
-#endif
-	return n;
-}
diff --git a/ext/sdbm/depend b/ext/sdbm/depend
deleted file mode 100644
index 1d8b13d13f..0000000000
--- a/ext/sdbm/depend
+++ /dev/null
@@ -1,2 +0,0 @@
-_sdbm.o: _sdbm.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
-init.o: init.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/sdbm/extconf.rb b/ext/sdbm/extconf.rb
deleted file mode 100644
index cc6c8cefd1..0000000000
--- a/ext/sdbm/extconf.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-require 'mkmf'
-
-create_makefile("sdbm")
diff --git a/ext/sdbm/init.c b/ext/sdbm/init.c
deleted file mode 100644
index 280637aa23..0000000000
--- a/ext/sdbm/init.c
+++ /dev/null
@@ -1,763 +0,0 @@
-/************************************************
-
-  sdbminit.c -
-
-  $Author$
-  $Date$
-  created at: Fri May  7 08:34:24 JST 1999
-
-  Copyright (C) 1995-2001 Yukihiro Matsumoto
-
-************************************************/
-
-#include "ruby.h"
-
-#include "sdbm.h"
-#include 
-#include 
-
-static VALUE rb_cDBM, rb_eDBMError;
-
-struct dbmdata {
-    int  di_size;
-    DBM *di_dbm;
-};
-
-static void
-closed_sdbm()
-{
-    rb_raise(rb_eDBMError, "closed SDBM file");
-}
-
-#define GetDBM(obj, dbmp) {\
-    Data_Get_Struct(obj, struct dbmdata, dbmp);\
-    if (dbmp->di_dbm == 0) closed_sdbm();\
-}
-
-static void
-free_sdbm(dbmp)
-    struct dbmdata *dbmp;
-{
-
-    if (dbmp->di_dbm) sdbm_close(dbmp->di_dbm);
-    free(dbmp);
-}
-
-static VALUE
-fsdbm_close(obj)
-    VALUE obj;
-{
-    struct dbmdata *dbmp;
-
-    GetDBM(obj, dbmp);
-    sdbm_close(dbmp->di_dbm);
-    dbmp->di_dbm = 0;
-
-    return Qnil;
-}
-
-static VALUE
-fsdbm_s_new(argc, argv, klass)
-    int argc;
-    VALUE *argv;
-    VALUE klass;
-{
-    VALUE obj = Data_Wrap_Struct(klass, 0, free_sdbm, 0);
-    rb_obj_call_init(obj, argc, argv);
-    return obj;
-}
-
-static VALUE
-fsdbm_initialize(argc, argv, obj)
-    int argc;
-    VALUE *argv;
-    VALUE obj;
-{
-    VALUE file, vmode;
-    DBM *dbm;
-    struct dbmdata *dbmp;
-    int mode;
-
-    if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
-	mode = 0666;		/* default value */
-    }
-    else if (NIL_P(vmode)) {
-	mode = -1;		/* return nil if DB not exist */
-    }
-    else {
-	mode = NUM2INT(vmode);
-    }
-    SafeStringValue(file);
-
-    dbm = 0;
-    if (mode >= 0)
-	dbm = sdbm_open(RSTRING(file)->ptr, O_RDWR|O_CREAT, mode);
-    if (!dbm)
-	dbm = sdbm_open(RSTRING(file)->ptr, O_RDWR, 0);
-    if (!dbm)
-	dbm = sdbm_open(RSTRING(file)->ptr, O_RDONLY, 0);
-
-    if (!dbm) {
-	if (mode == -1) return Qnil;
-	rb_sys_fail(RSTRING(file)->ptr);
-    }
-
-    dbmp = ALLOC(struct dbmdata);
-    DATA_PTR(obj) = dbmp;
-    dbmp->di_dbm = dbm;
-    dbmp->di_size = -1;
-
-    return obj;
-}
-
-static VALUE
-fsdbm_s_open(argc, argv, klass)
-    int argc;
-    VALUE *argv;
-    VALUE klass;
-{
-    VALUE obj = Data_Wrap_Struct(klass, 0, free_sdbm, 0);
-
-    if (NIL_P(fsdbm_initialize(argc, argv, obj))) {
-	return Qnil;
-    }
-
-    if (rb_block_given_p()) {
-        return rb_ensure(rb_yield, obj, fsdbm_close, obj);
-    }
-
-    return obj;
-}
-
-static VALUE
-fsdbm_fetch(obj, keystr, ifnone)
-    VALUE obj, keystr, ifnone;
-{
-    datum key, value;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-
-    StringValue(keystr);
-    key.dptr = RSTRING(keystr)->ptr;
-    key.dsize = RSTRING(keystr)->len;
-
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-    value = sdbm_fetch(dbm, key);
-    if (value.dptr == 0) {
-	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
-fsdbm_aref(obj, keystr)
-    VALUE obj, keystr;
-{
-    return fsdbm_fetch(obj, keystr, Qnil);
-}
-
-static VALUE
-fsdbm_fetch_m(argc, argv, obj)
-    int argc;
-    VALUE *argv;
-    VALUE obj;
-{
-    VALUE keystr, valstr, ifnone;
-
-    rb_scan_args(argc, argv, "11", &keystr, &ifnone);
-    valstr = fsdbm_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
-fsdbm_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 = sdbm_firstkey(dbm); key.dptr; key = sdbm_nextkey(dbm)) {
-	val = sdbm_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 Qnil;
-}
-
-static VALUE
-fsdbm_indexes(argc, argv, obj)
-    int argc;
-    VALUE *argv;
-    VALUE obj;
-{
-    VALUE new;
-    int i;
-
-    new = rb_ary_new2(argc);
-    for (i=0; i 0) {
-	    rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc);
-	}
-        GetDBM(obj, dbmp);
-        dbm = dbmp->di_dbm;
-
-        for (key = sdbm_firstkey(dbm); key.dptr; key = sdbm_nextkey(dbm)) {
-            VALUE assoc;
-            val = sdbm_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 {
-        for (i=0; iptr;
-    key.dsize = RSTRING(keystr)->len;
-
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-    dbmp->di_size = -1;
-
-    value = sdbm_fetch(dbm, key);
-    if (value.dptr == 0) {
-	if (rb_block_given_p()) return rb_yield(keystr);
-	return Qnil;
-    }
-
-    /* need to save value before sdbm_delete() */
-    valstr = rb_tainted_str_new(value.dptr, value.dsize);
-
-    if (sdbm_delete(dbm, key)) {
-	dbmp->di_size = -1;
-	rb_raise(rb_eDBMError, "dbm_delete failed");
-    }
-    else if (dbmp->di_size >= 0) {
-	dbmp->di_size--;
-    }
-    return valstr;
-}
-
-static VALUE
-fsdbm_shift(obj)
-    VALUE obj;
-{
-    datum key, val;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-    VALUE keystr, valstr;
-
-    rb_secure(4);
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-
-    key = sdbm_firstkey(dbm); 
-    if (!key.dptr) return Qnil;
-    val = sdbm_fetch(dbm, key);
-    keystr = rb_tainted_str_new(key.dptr, key.dsize);
-    valstr = rb_tainted_str_new(val.dptr, val.dsize);
-    sdbm_delete(dbm, key);
-    if (dbmp->di_size >= 0) {
-	dbmp->di_size--;
-    }
-
-    return rb_assoc_new(keystr, valstr);
-}
-
-static VALUE
-fsdbm_delete_if(obj)
-    VALUE obj;
-{
-    datum key, val;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-    VALUE keystr, valstr;
-    VALUE ret, ary = rb_ary_new();
-    int i, status = 0, n;
-
-    rb_secure(4);
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-    n = dbmp->di_size;
-    dbmp->di_size = -1;
-    for (key = sdbm_firstkey(dbm); key.dptr; key = sdbm_nextkey(dbm)) {
-	val = sdbm_fetch(dbm, key);
-	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];
-	key.dptr = RSTRING(keystr)->ptr;
-	key.dsize = RSTRING(keystr)->len;
-	if (sdbm_delete(dbm, key)) {
-	    rb_raise(rb_eDBMError, "sdbm_delete failed");
-	}
-    }
-    if (status) rb_jump_tag(status);
-    if (n > 0) dbmp->di_size = n - RARRAY(ary)->len;
-
-    return obj;
-}
-
-static VALUE
-fsdbm_clear(obj)
-    VALUE obj;
-{
-    datum key;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-
-    rb_secure(4);
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-    dbmp->di_size = -1;
-    while (key = sdbm_firstkey(dbm), key.dptr) {
-	if (sdbm_delete(dbm, key)) {
-	    rb_raise(rb_eDBMError, "sdbm_delete failed");
-	}
-    }
-    dbmp->di_size = 0;
-
-    return obj;
-}
-
-static VALUE
-fsdbm_invert(obj)
-    VALUE obj;
-{
-    datum key, val;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-    VALUE keystr, valstr;
-    VALUE hash = rb_hash_new();
-
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-    for (key = sdbm_firstkey(dbm); key.dptr; key = sdbm_nextkey(dbm)) {
-	val = sdbm_fetch(dbm, key);
-	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 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 fsdbm_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]");
-    }
-    fsdbm_store(dbm, RARRAY(pair)->ptr[0], RARRAY(pair)->ptr[1]);
-    return Qnil;
-}
-
-static VALUE
-fsdbm_update(obj, other)
-    VALUE obj, other;
-{
-    rb_iterate(each_pair, other, update_i, obj);
-    return obj;
-}
-
-static VALUE
-fsdbm_replace(obj, other)
-    VALUE obj, other;
-{
-    fsdbm_clear(obj);
-    rb_iterate(each_pair, other, update_i, obj);
-    return obj;
-}
-
-static VALUE
-fsdbm_store(obj, keystr, valstr)
-    VALUE obj, keystr, valstr;
-{
-    datum key, val;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-
-    if (valstr == Qnil) {
-	fsdbm_delete(obj, keystr);
-	return Qnil;
-    }
-
-    rb_secure(4);
-    keystr = rb_obj_as_string(keystr);
-
-    key.dptr = RSTRING(keystr)->ptr;
-    key.dsize = RSTRING(keystr)->len;
-
-    if (NIL_P(valstr)) return fsdbm_delete(obj, keystr);
-
-    valstr = rb_obj_as_string(valstr);
-    val.dptr = RSTRING(valstr)->ptr;
-    val.dsize = RSTRING(valstr)->len;
-
-    GetDBM(obj, dbmp);
-    dbmp->di_size = -1;
-    dbm = dbmp->di_dbm;
-    if (sdbm_store(dbm, key, val, DBM_REPLACE)) {
-#ifdef HAVE_DBM_CLAERERR
-	sdbm_clearerr(dbm);
-#endif
-	if (errno == EPERM) rb_sys_fail(0);
-	rb_raise(rb_eDBMError, "sdbm_store failed");
-    }
-
-    return valstr;
-}
-
-static VALUE
-fsdbm_length(obj)
-    VALUE obj;
-{
-    datum key;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-    int i = 0;
-
-    GetDBM(obj, dbmp);
-    if (dbmp->di_size > 0) return INT2FIX(dbmp->di_size);
-    dbm = dbmp->di_dbm;
-
-    for (key = sdbm_firstkey(dbm); key.dptr; key = sdbm_nextkey(dbm)) {
-	i++;
-    }
-    dbmp->di_size = i;
-
-    return INT2FIX(i);
-}
-
-static VALUE
-fsdbm_empty_p(obj)
-    VALUE obj;
-{
-    datum key;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-    int i = 0;
-
-    GetDBM(obj, dbmp);
-    if (dbmp->di_size < 0) {
-	dbm = dbmp->di_dbm;
-
-	for (key = sdbm_firstkey(dbm); key.dptr; key = sdbm_nextkey(dbm)) {
-	    i++;
-	}
-    }
-    else {
-	i = dbmp->di_size;
-    }
-    if (i == 0) return Qtrue;
-    return Qfalse;
-}
-
-static VALUE
-fsdbm_each_value(obj)
-    VALUE obj;
-{
-    datum key, val;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-    for (key = sdbm_firstkey(dbm); key.dptr; key = sdbm_nextkey(dbm)) {
-	val = sdbm_fetch(dbm, key);
-	rb_yield(rb_tainted_str_new(val.dptr, val.dsize));
-    }
-    return obj;
-}
-
-static VALUE
-fsdbm_each_key(obj)
-    VALUE obj;
-{
-    datum key;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-    for (key = sdbm_firstkey(dbm); key.dptr; key = sdbm_nextkey(dbm)) {
-	rb_yield(rb_tainted_str_new(key.dptr, key.dsize));
-    }
-    return obj;
-}
-
-static VALUE
-fsdbm_each_pair(obj)
-    VALUE obj;
-{
-    datum key, val;
-    DBM *dbm;
-    struct dbmdata *dbmp;
-    VALUE keystr, valstr;
-
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-
-    for (key = sdbm_firstkey(dbm); key.dptr; key = sdbm_nextkey(dbm)) {
-	val = sdbm_fetch(dbm, key);
-	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;
-}
-
-static VALUE
-fsdbm_keys(obj)
-    VALUE obj;
-{
-    datum key;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-    VALUE ary;
-
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-
-    ary = rb_ary_new();
-    for (key = sdbm_firstkey(dbm); key.dptr; key = sdbm_nextkey(dbm)) {
-	rb_ary_push(ary, rb_tainted_str_new(key.dptr, key.dsize));
-    }
-
-    return ary;
-}
-
-static VALUE
-fsdbm_values(obj)
-    VALUE obj;
-{
-    datum key, val;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-    VALUE ary;
-
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-
-    ary = rb_ary_new();
-    for (key = sdbm_firstkey(dbm); key.dptr; key = sdbm_nextkey(dbm)) {
-	val = sdbm_fetch(dbm, key);
-	rb_ary_push(ary, rb_tainted_str_new(val.dptr, val.dsize));
-    }
-
-    return ary;
-}
-
-static VALUE
-fsdbm_has_key(obj, keystr)
-    VALUE obj, keystr;
-{
-    datum key, val;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-
-    StringValue(keystr);
-    key.dptr = RSTRING(keystr)->ptr;
-    key.dsize = RSTRING(keystr)->len;
-
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-    val = sdbm_fetch(dbm, key);
-    if (val.dptr) return Qtrue;
-    return Qfalse;
-}
-
-static VALUE
-fsdbm_has_value(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 = sdbm_firstkey(dbm); key.dptr; key = sdbm_nextkey(dbm)) {
-	val = sdbm_fetch(dbm, key);
-	if (val.dsize == RSTRING(valstr)->len &&
-	    memcmp(val.dptr, RSTRING(valstr)->ptr, val.dsize) == 0)
-	    return Qtrue;
-    }
-    return Qfalse;
-}
-
-static VALUE
-fsdbm_to_a(obj)
-    VALUE obj;
-{
-    datum key, val;
-    struct dbmdata *dbmp;
-    DBM *dbm;
-    VALUE ary;
-
-    GetDBM(obj, dbmp);
-    dbm = dbmp->di_dbm;
-
-    ary = rb_ary_new();
-    for (key = sdbm_firstkey(dbm); key.dptr; key = sdbm_nextkey(dbm)) {
-	val = sdbm_fetch(dbm, key);
-	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
-fsdbm_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 = sdbm_firstkey(dbm); key.dptr; key = sdbm_nextkey(dbm)) {
-	val = sdbm_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
-fsdbm_reject(obj)
-    VALUE obj;
-{
-    return rb_hash_delete_if(fsdbm_to_hash(obj));
-}
-
-void
-Init_sdbm()
-{
-    rb_cDBM = rb_define_class("SDBM", rb_cObject);
-    rb_eDBMError = rb_define_class("SDBMError", rb_eStandardError);
-    rb_include_module(rb_cDBM, rb_mEnumerable);
-
-    rb_define_singleton_method(rb_cDBM, "new", fsdbm_s_new, -1);
-    rb_define_singleton_method(rb_cDBM, "open", fsdbm_s_open, -1);
-
-    rb_define_method(rb_cDBM, "initialize", fsdbm_initialize, -1);
-    rb_define_method(rb_cDBM, "close", fsdbm_close, 0);
-    rb_define_method(rb_cDBM, "[]", fsdbm_aref, 1);
-    rb_define_method(rb_cDBM, "fetch", fsdbm_fetch_m, -1);
-    rb_define_method(rb_cDBM, "[]=", fsdbm_store, 2);
-    rb_define_method(rb_cDBM, "store", fsdbm_store, 2);
-    rb_define_method(rb_cDBM, "index",  fsdbm_index, 1);
-    rb_define_method(rb_cDBM, "indexes",  fsdbm_indexes, -1);
-    rb_define_method(rb_cDBM, "indices",  fsdbm_indexes, -1);
-    rb_define_method(rb_cDBM, "select",  fsdbm_select, -1);
-    rb_define_method(rb_cDBM, "length", fsdbm_length, 0);
-    rb_define_method(rb_cDBM, "size", fsdbm_length, 0);
-    rb_define_method(rb_cDBM, "empty?", fsdbm_empty_p, 0);
-    rb_define_method(rb_cDBM, "each", fsdbm_each_pair, 0);
-    rb_define_method(rb_cDBM, "each_value", fsdbm_each_value, 0);
-    rb_define_method(rb_cDBM, "each_key", fsdbm_each_key, 0);
-    rb_define_method(rb_cDBM, "each_pair", fsdbm_each_pair, 0);
-    rb_define_method(rb_cDBM, "keys", fsdbm_keys, 0);
-    rb_define_method(rb_cDBM, "values", fsdbm_values, 0);
-    rb_define_method(rb_cDBM, "shift", fsdbm_shift, 0);
-    rb_define_method(rb_cDBM, "delete", fsdbm_delete, 1);
-    rb_define_method(rb_cDBM, "delete_if", fsdbm_delete_if, 0);
-    rb_define_method(rb_cDBM, "reject!", fsdbm_delete_if, 0);
-    rb_define_method(rb_cDBM, "reject", fsdbm_reject, 0);
-    rb_define_method(rb_cDBM, "clear", fsdbm_clear, 0);
-    rb_define_method(rb_cDBM,"invert", fsdbm_invert, 0);
-    rb_define_method(rb_cDBM,"update", fsdbm_update, 1);
-    rb_define_method(rb_cDBM,"replace", fsdbm_replace, 1);
-
-    rb_define_method(rb_cDBM, "include?", fsdbm_has_key, 1);
-    rb_define_method(rb_cDBM, "has_key?", fsdbm_has_key, 1);
-    rb_define_method(rb_cDBM, "member?", fsdbm_has_key, 1);
-    rb_define_method(rb_cDBM, "has_value?", fsdbm_has_value, 1);
-    rb_define_method(rb_cDBM, "key?", fsdbm_has_key, 1);
-    rb_define_method(rb_cDBM, "value?", fsdbm_has_value, 1);
-
-    rb_define_method(rb_cDBM, "to_a", fsdbm_to_a, 0);
-    rb_define_method(rb_cDBM, "to_hash", fsdbm_to_hash, 0);
-}
diff --git a/ext/sdbm/sdbm.h b/ext/sdbm/sdbm.h
deleted file mode 100644
index ce8f54c4d4..0000000000
--- a/ext/sdbm/sdbm.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * sdbm - ndbm work-alike hashed database library
- * based on Per-Ake Larson's Dynamic Hashing algorithms. BIT 18 (1978).
- * author: oz@nexus.yorku.ca
- * status: public domain. 
- */
-#ifndef	_SDBM_H_
-#define	_SDBM_H_
-
-#define DBLKSIZ 4096
-#define PBLKSIZ 1024
-#define PAIRMAX 1008			/* arbitrary on PBLKSIZ-N */
-#define SPLTMAX	10			/* maximum allowed splits */
-					/* for a single insertion */
-#define DIRFEXT	".dir"
-#define PAGFEXT	".pag"
-
-typedef struct {
-	int dirf;		       /* directory file descriptor */
-	int pagf;		       /* page file descriptor */
-	int flags;		       /* status/error flags, see below */
-	long maxbno;		       /* size of dirfile in bits */
-	long curbit;		       /* current bit number */
-	long hmask;		       /* current hash mask */
-	long blkptr;		       /* current block for nextkey */
-	int keyptr;		       /* current key for nextkey */
-	long blkno;		       /* current page to read/write */
-	long pagbno;		       /* current page in pagbuf */
-	char pagbuf[PBLKSIZ];	       /* page file block buffer */
-	long dirbno;		       /* current block in dirbuf */
-	char dirbuf[DBLKSIZ];	       /* directory file block buffer */
-} DBM;
-
-#define DBM_RDONLY	0x1	       /* data base open read-only */
-#define DBM_IOERR	0x2	       /* data base I/O error */
-
-/*
- * utility macros
- */
-#define sdbm_rdonly(db)		((db)->flags & DBM_RDONLY)
-#define sdbm_error(db)		((db)->flags & DBM_IOERR)
-
-#define sdbm_clearerr(db)	((db)->flags &= ~DBM_IOERR)  /* ouch */
-
-#define sdbm_dirfno(db)	((db)->dirf)
-#define sdbm_pagfno(db)	((db)->pagf)
-
-typedef struct {
-	char *dptr;
-	int dsize;
-} datum;
-
-extern datum nullitem;
-
-#if defined(__STDC__) || defined(MSDOS)
-#define proto(p) p
-#else
-#define proto(p) ()
-#endif
-
-/*
- * flags to sdbm_store
- */
-#define DBM_INSERT	0
-#define DBM_REPLACE	1
-
-/*
- * ndbm interface
- */
-extern DBM *sdbm_open proto((char *, int, int));
-extern void sdbm_close proto((DBM *));
-extern datum sdbm_fetch proto((DBM *, datum));
-extern int sdbm_delete proto((DBM *, datum));
-extern int sdbm_store proto((DBM *, datum, datum, int));
-extern datum sdbm_firstkey proto((DBM *));
-extern datum sdbm_nextkey proto((DBM *));
-
-/*
- * other
- */
-extern DBM *sdbm_prep proto((char *, char *, int, int));
-extern long sdbm_hash proto((char *, int));
-
-#endif	/* _SDBM_H_ */
diff --git a/ext/sdbm/testsdbm.rb b/ext/sdbm/testsdbm.rb
deleted file mode 100644
index 550b47a008..0000000000
--- a/ext/sdbm/testsdbm.rb
+++ /dev/null
@@ -1,556 +0,0 @@
-require 'runit/testcase'
-require 'runit/cui/testrunner'
-
-if $".grep(/\bsdbm.so\b/).empty?
-  begin
-    require './sdbm'
-  rescue LoadError
-    require 'sdbm'
-  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 TestSDBM < RUNIT::TestCase
-  def setup
-    @path = "tmptest_sdbm_"
-    assert_instance_of(SDBM, @sdbm = SDBM.new(@path))
-  end
-  def teardown
-    assert_nil(@sdbm.close)
-    GC.start
-    File.delete *Dir.glob("tmptest_sdbm*").to_a
-    p Dir.glob("tmptest_sdbm*") if $DEBUG
-  end
-
-  def check_size(expect, sdbm=@sdbm)
-    assert_equals(expect, sdbm.size)
-    n = 0
-    sdbm.each { n+=1 }
-    assert_equals(expect, n)
-    if expect == 0
-      assert_equals(true, sdbm.empty?)
-    else
-      assert_equals(false, sdbm.empty?)
-    end
-  end
-
-  def test_version
-    STDERR.print SDBM::VERSION
-  end
-
-  def test_s_new_has_no_block
-    # SDBM.new ignore the block
-    foo = true
-    assert_instance_of(SDBM, sdbm = SDBM.new("tmptest_sdbm") { foo = false })
-    assert_equals(foo, true)
-    assert_nil(sdbm.close)
-  end
-  def test_s_open_no_create
-    assert_nil(sdbm = SDBM.open("tmptest_sdbm", nil))
-  ensure
-    sdbm.close if sdbm
-  end
-  def test_s_open_with_block
-    assert_equals(SDBM.open("tmptest_sdbm") { :foo }, :foo)
-  end
-=begin
-  # Is it guaranteed on many OS?
-  def test_s_open_lock_one_process
-    # locking on one process
-    assert_instance_of(SDBM, sdbm  = SDBM.open("tmptest_sdbm", 0644))
-    assert_exception(Errno::EWOULDBLOCK) {
-      begin
-	SDBM.open("tmptest_sdbm", 0644)
-      rescue Errno::EAGAIN
-	raise Errno::EWOULDBLOCK
-      end
-    }
-  end
-=end
-
-  def test_s_open_nolock
-    # sdbm 1.8.0 specific
-    if not defined? SDBM::NOLOCK
-      return
-    end
-
-    fork() {
-      assert_instance_of(SDBM, sdbm  = SDBM.open("tmptest_sdbm", 0644,
-						SDBM::NOLOCK))
-      sleep 2
-    }
-    sleep 1
-    begin
-      sdbm2 = nil
-      assert_no_exception(Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EACCES) {
-	assert_instance_of(SDBM, sdbm2 = SDBM.open("tmptest_sdbm", 0644))
-      }
-    ensure
-      Process.wait
-      sdbm2.close if sdbm2
-    end
-
-    p Dir.glob("tmptest_sdbm*") if $DEBUG
-
-    fork() {
-      assert_instance_of(SDBM, sdbm  = SDBM.open("tmptest_sdbm", 0644))
-      sleep 2
-    }
-    begin
-      sleep 1
-      sdbm2 = nil
-      assert_no_exception(Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EACCES) {
-	# this test is failed on Cygwin98 (???)
-	assert_instance_of(SDBM, sdbm2 = SDBM.open("tmptest_sdbm", 0644,
-						   SDBM::NOLOCK))
-      }
-    ensure
-      Process.wait
-      sdbm2.close if sdbm2
-    end
-  end
-
-  def test_s_open_error
-    assert_instance_of(SDBM, sdbm = SDBM.open("tmptest_sdbm", 0))
-    assert_exception(Errno::EACCES) {
-      SDBM.open("tmptest_sdbm", 0)
-    }
-    sdbm.close
-  end
-
-  def test_close
-    assert_instance_of(SDBM, sdbm = SDBM.open("tmptest_sdbm"))
-    assert_nil(sdbm.close)
-
-    # closed SDBM file
-    assert_exception(SDBMError) { sdbm.close }
-  end
-
-  def test_aref
-    assert_equals('bar', @sdbm['foo'] = 'bar')
-    assert_equals('bar', @sdbm['foo'])
-
-    assert_nil(@sdbm['bar'])
-  end
-
-  def test_fetch
-    assert_equals('bar', @sdbm['foo']='bar')
-    assert_equals('bar', @sdbm.fetch('foo'))
-
-    # key not found
-    assert_exception(IndexError) {
-      @sdbm.fetch('bar')
-    }
-
-    # test for `ifnone' arg
-    assert_equals('baz', @sdbm.fetch('bar', 'baz'))
-
-    # test for `ifnone' block
-    assert_equals('foobar', @sdbm.fetch('bar') {|key| 'foo' + key })
-  end
-
-  def test_aset
-    num = 0
-    2.times {|i|
-      assert_equals('foo', @sdbm['foo'] = 'foo')
-      assert_equals('foo', @sdbm['foo'])
-      assert_equals('bar', @sdbm['foo'] = 'bar')
-      assert_equals('bar', @sdbm['foo'])
-
-      num += 1 if i == 0
-      assert_equals(num, @sdbm.size)
-
-      # assign nil
-      assert_equals('', @sdbm['bar'] = '')
-      assert_equals('', @sdbm['bar'])
-
-      num += 1 if i == 0
-      assert_equals(num, @sdbm.size)
-
-      # empty string
-      assert_equals('', @sdbm[''] = '')
-      assert_equals('', @sdbm[''])
-
-      num += 1 if i == 0
-      assert_equals(num, @sdbm.size)
-
-      # Fixnum
-      assert_equals('200', @sdbm['100'] = '200')
-      assert_equals('200', @sdbm['100'])
-
-      num += 1 if i == 0
-      assert_equals(num, @sdbm.size)
-
-      # Big key and value
-      assert_equals('y' * 100, @sdbm['x' * 100] = 'y' * 100)
-      assert_equals('y' * 100, @sdbm['x' * 100])
-
-      num += 1 if i == 0
-      assert_equals(num, @sdbm.size)
-    }
-  end
-
-  def test_index
-    assert_equals('bar', @sdbm['foo'] = 'bar')
-    assert_equals('foo', @sdbm.index('bar'))
-    assert_nil(@sdbm['bar'])
-  end
-
-  def test_indexes
-    keys = %w(foo bar baz)
-    values = %w(FOO BAR BAZ)
-    @sdbm[keys[0]], @sdbm[keys[1]], @sdbm[keys[2]] = values
-    assert_equals(values.reverse, @sdbm.indexes(*keys.reverse))
-  end
-
-  def test_select
-    keys = %w(foo bar baz)
-    values = %w(FOO BAR BAZ)
-    @sdbm[keys[0]], @sdbm[keys[1]], @sdbm[keys[2]] = values
-    assert_equals(values.reverse, @sdbm.select(*keys.reverse))
-  end
-
-  def test_select_with_block
-    keys = %w(foo bar baz)
-    values = %w(FOO BAR BAZ)
-    @sdbm[keys[0]], @sdbm[keys[1]], @sdbm[keys[2]] = values
-    ret = @sdbm.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, @sdbm.size)
-    num.times {|i|
-      i = i.to_s
-      @sdbm[i] = i
-    }
-    assert_equals(num, @sdbm.size)
-
-    @sdbm.shift
-
-    assert_equals(num - 1, @sdbm.size)
-  end
-
-  def test_empty?
-    assert_equals(true, @sdbm.empty?)
-    @sdbm['foo'] = 'FOO'
-    assert_equals(false, @sdbm.empty?)
-  end
-
-  def test_each_pair
-    n = 0
-    @sdbm.each_pair { n += 1 }
-    assert_equals(0, n)
-
-    keys = %w(foo bar baz)
-    values = %w(FOO BAR BAZ)
-
-    @sdbm[keys[0]], @sdbm[keys[1]], @sdbm[keys[2]] = values
-
-    n = 0
-    ret = @sdbm.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(@sdbm, ret)
-  end
-
-  def test_each_value
-    n = 0
-    @sdbm.each_value { n += 1 }
-    assert_equals(0, n)
-
-    keys = %w(foo bar baz)
-    values = %w(FOO BAR BAZ)
-
-    @sdbm[keys[0]], @sdbm[keys[1]], @sdbm[keys[2]] = values
-
-    n = 0
-    ret = @sdbm.each_value {|val|
-      assert_not_nil(key = @sdbm.index(val))
-      assert_not_nil(i = keys.index(key))
-      assert_equals(val, values[i])
-
-      n += 1
-    }
-    assert_equals(keys.size, n)
-    assert_equals(@sdbm, ret)
-  end
-
-  def test_each_key
-    n = 0
-    @sdbm.each_key { n += 1 }
-    assert_equals(0, n)
-
-    keys = %w(foo bar baz)
-    values = %w(FOO BAR BAZ)
-
-    @sdbm[keys[0]], @sdbm[keys[1]], @sdbm[keys[2]] = values
-
-    n = 0
-    ret = @sdbm.each_key {|key|
-      assert_not_nil(i = keys.index(key))
-      assert_equals(@sdbm[key], values[i])
-
-      n += 1
-    }
-    assert_equals(keys.size, n)
-    assert_equals(@sdbm, ret)
-  end
-
-  def test_keys
-    assert_equals([], @sdbm.keys)
-
-    keys = %w(foo bar baz)
-    values = %w(FOO BAR BAZ)
-
-    @sdbm[keys[0]], @sdbm[keys[1]], @sdbm[keys[2]] = values
-
-    assert_equals(keys.sort, @sdbm.keys.sort)
-    assert_equals(values.sort, @sdbm.values.sort)
-  end
-
-  def test_values
-    test_keys
-  end
-
-  def test_shift
-    assert_nil(@sdbm.shift)
-    assert_equals(0, @sdbm.size)
-
-    keys = %w(foo bar baz)
-    values = %w(FOO BAR BAZ)
-
-    @sdbm[keys[0]], @sdbm[keys[1]], @sdbm[keys[2]] = values
-
-    ret_keys = []
-    ret_values = []
-    while ret = @sdbm.shift
-      ret_keys.push ret[0]
-      ret_values.push ret[1]
-
-      assert_equals(keys.size - ret_keys.size, @sdbm.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(@sdbm.delete(key))
-    assert_equals(0, @sdbm.size)
-
-    @sdbm[keys[0]], @sdbm[keys[1]], @sdbm[keys[2]] = values
-
-    assert_equals('BAR', @sdbm.delete(key))
-    assert_nil(@sdbm[key])
-    assert_equals(2, @sdbm.size)
-
-    assert_nil(@sdbm.delete(key))
-  end
-  def test_delete_with_block
-    key = 'no called block'
-    @sdbm[key] = 'foo'
-    assert_equals('foo', @sdbm.delete(key) {|k| k.replace 'called block'})
-    assert_equals('no called block', key)
-    assert_equals(0, @sdbm.size)
-
-    key = 'no called block'
-    assert_equals(:blockval,
-		  @sdbm.delete(key) {|k| k.replace 'called block'; :blockval})
-    assert_equals('called block', key)
-    assert_equals(0, @sdbm.size)
-  end
-
-  def test_delete_if
-    v = "0"
-    100.times {@sdbm[v] = v; v = v.next}
-
-    ret = @sdbm.delete_if {|key, val| key.to_i < 50}
-    assert_equals(@sdbm, ret)
-    check_size(50, @sdbm)
-
-    ret = @sdbm.delete_if {|key, val| key.to_i >= 50}
-    assert_equals(@sdbm, ret)
-    check_size(0, @sdbm)
-
-    # break
-    v = "0"
-    100.times {@sdbm[v] = v; v = v.next}
-    check_size(100, @sdbm)
-    n = 0;
-    @sdbm.delete_if {|key, val|
-      break if n > 50
-      n+=1
-      true
-    }
-    assert_equals(51, n)
-    check_size(49, @sdbm)
-
-    @sdbm.clear
-
-    # raise
-    v = "0"
-    100.times {@sdbm[v] = v; v = v.next}
-    check_size(100, @sdbm)
-    n = 0;
-    begin
-      @sdbm.delete_if {|key, val|
-	raise "runtime error" if n > 50
-	n+=1
-	true
-      }
-    rescue
-    end
-    assert_equals(51, n)
-    check_size(49, @sdbm)
-  end
-
-  def test_reject
-    v = "0"
-    100.times {@sdbm[v] = v; v = v.next}
-
-    hash = @sdbm.reject {|key, val| key.to_i < 50}
-    assert_instance_of(Hash, hash)
-    assert_equals(100, @sdbm.size)
-
-    assert_equals(50, hash.size)
-    hash.each_pair {|key,val|
-      assert_equals(false, key.to_i < 50)
-      assert_equals(key, val)
-    }
-
-    hash = @sdbm.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; @sdbm[v] = v}
-
-    assert_equals(@sdbm, @sdbm.clear)
-
-    # validate SDBM#size
-    i = 0
-    @sdbm.each { i += 1 }
-    assert_equals(@sdbm.size, i)
-    assert_equals(0, i)
-  end
-
-  def test_invert
-    v = "0"
-    100.times {@sdbm[v] = v; v = v.next}
-
-    hash = @sdbm.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}
-
-    @sdbm["101"] = "101"
-    @sdbm.update hash
-    assert_equals(101, @sdbm.size)
-    @sdbm.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}
-
-    @sdbm["101"] = "101"
-    @sdbm.replace hash
-    assert_equals(100, @sdbm.size)
-    @sdbm.each_pair {|key, val|
-      assert_equals(key.to_i, val.to_i)
-    }
-  end
-
-  def test_haskey?
-    assert_equals('bar', @sdbm['foo']='bar')
-    assert_equals(true,  @sdbm.has_key?('foo'))
-    assert_equals(false, @sdbm.has_key?('bar'))
-  end
-
-  def test_has_value?
-    assert_equals('bar', @sdbm['foo']='bar')
-    assert_equals(true,  @sdbm.has_value?('bar'))
-    assert_equals(false, @sdbm.has_value?('foo'))
-  end
-
-  def test_to_a
-    v = "0"
-    100.times {v = v.next; @sdbm[v] = v}
-
-    ary = @sdbm.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; @sdbm[v] = v}
-
-    hash = @sdbm.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(TestSDBM.suite)
-  else
-    suite = RUNIT::TestSuite.new
-    ARGV.each do |testmethod|
-      suite.add_test(TestSDBM.new(testmethod))
-    end
-  end
-
-  RUNIT::CUI::TestRunner.run(suite)
-end
diff --git a/ext/socket/.cvsignore b/ext/socket/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/socket/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/socket/MANIFEST b/ext/socket/MANIFEST
deleted file mode 100644
index 616d459d92..0000000000
--- a/ext/socket/MANIFEST
+++ /dev/null
@@ -1,8 +0,0 @@
-MANIFEST
-addrinfo.h
-depend
-extconf.rb
-getaddrinfo.c
-getnameinfo.c
-sockport.h
-socket.c
diff --git a/ext/socket/addrinfo.h b/ext/socket/addrinfo.h
deleted file mode 100644
index 5beea2cec6..0000000000
--- a/ext/socket/addrinfo.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef ADDR_INFO_H
-#define ADDR_INFO_H
-#ifndef HAVE_GETADDRINFO
-
-/* special compatibility hack */
-#undef EAI_ADDRFAMILY
-#undef EAI_AGAIN
-#undef EAI_BADFLAGS
-#undef EAI_FAIL
-#undef EAI_FAMILY
-#undef EAI_MEMORY
-#undef EAI_NODATA
-#undef EAI_NONAME
-#undef EAI_SERVICE
-#undef EAI_SOCKTYPE
-#undef EAI_SYSTEM
-#undef EAI_BADHINTS
-#undef EAI_PROTOCOL
-#undef EAI_MAX
-
-#undef AI_PASSIVE
-#undef AI_CANONNAME
-#undef AI_NUMERICHOST
-#undef AI_ALL
-#undef AI_ADDRCONFIG
-#undef AI_V4MAPPED
-#undef AI_DEFAULT
-
-#undef NI_NOFQDN
-#undef NI_NUMERICHOST
-#undef NI_NAMEREQD
-#undef NI_NUMERICSERV
-#undef NI_DGRAM
-
-#define addrinfo addrinfo__compat
-#define getaddrinfo getaddrinfo__compat
-#define getnameinfo getnameinfo__compat
-#define freehostent freehostent__compat
-#define freeaddrinfo freeaddrinfo__compat
-
-#ifndef __P
-# ifdef HAVE_PROTOTYPES
-#  define __P(args) args
-# else
-#  define __P(args) ()
-# endif
-#endif
-
-/* special compatibility hack -- end*/
-
-
-/*
- * Error return codes from getaddrinfo()
- */
-#define	EAI_ADDRFAMILY	 1	/* address family for hostname not supported */
-#define	EAI_AGAIN	 2	/* temporary failure in name resolution */
-#define	EAI_BADFLAGS	 3	/* invalid value for ai_flags */
-#define	EAI_FAIL	 4	/* non-recoverable failure in name resolution */
-#define	EAI_FAMILY	 5	/* ai_family not supported */
-#define	EAI_MEMORY	 6	/* memory allocation failure */
-#define	EAI_NODATA	 7	/* no address associated with hostname */
-#define	EAI_NONAME	 8	/* hostname nor servname provided, or not known */
-#define	EAI_SERVICE	 9	/* servname not supported for ai_socktype */
-#define	EAI_SOCKTYPE	10	/* ai_socktype not supported */
-#define	EAI_SYSTEM	11	/* system error returned in errno */
-#define EAI_BADHINTS	12
-#define EAI_PROTOCOL	13
-#define EAI_MAX		14
-
-/*
- * Flag values for getaddrinfo()
- */
-#define	AI_PASSIVE	0x00000001 /* get address to use bind() */
-#define	AI_CANONNAME	0x00000002 /* fill ai_canonname */
-#define	AI_NUMERICHOST	0x00000004 /* prevent name resolution */
-/* valid flags for addrinfo */
-#define	AI_MASK		(AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST)
-
-#define	AI_ALL		0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
-#define	AI_V4MAPPED_CFG	0x00000200 /* accept IPv4-mapped if kernel supports */
-#define	AI_ADDRCONFIG	0x00000400 /* only if any address is assigned */
-#define	AI_V4MAPPED	0x00000800 /* accept IPv4-mapped IPv6 address */
-/* special recommended flags for getipnodebyname */
-#define	AI_DEFAULT	(AI_V4MAPPED_CFG | AI_ADDRCONFIG)
-
-/*
- * Constants for getnameinfo()
- */
-#define	NI_MAXHOST	1025
-#define	NI_MAXSERV	32
-
-/*
- * Flag values for getnameinfo()
- */
-#define	NI_NOFQDN	0x00000001
-#define	NI_NUMERICHOST	0x00000002
-#define	NI_NAMEREQD	0x00000004
-#define	NI_NUMERICSERV	0x00000008
-#define	NI_DGRAM	0x00000010
-
-struct addrinfo {
-	int	ai_flags;	/* AI_PASSIVE, AI_CANONNAME */
-	int	ai_family;	/* PF_xxx */
-	int	ai_socktype;	/* SOCK_xxx */
-	int	ai_protocol;	/* 0 or IPPROTO_xxx for IPv4 and IPv6 */
-	size_t	ai_addrlen;	/* length of ai_addr */
-	char	*ai_canonname;	/* canonical name for hostname */
-	struct sockaddr *ai_addr;	/* binary address */
-	struct addrinfo *ai_next;	/* next structure in linked list */
-};
-
-extern int getaddrinfo __P((
-	const char *hostname, const char *servname,
-	const struct addrinfo *hints,
-	struct addrinfo **res));
-
-extern int getnameinfo __P((
-	const struct sockaddr *sa,
-	size_t salen,
-	char *host,
-	size_t hostlen,
-	char *serv,
-	size_t servlen,
-	int flags));
-
-extern void freehostent __P((struct hostent *));
-extern void freeaddrinfo __P((struct addrinfo *));
-#if defined __UCLIBC__
-const
-#endif
-extern char *gai_strerror __P((int));
-
-/* In case there is no definition of offsetof() provided - though any proper
-Standard C system should have one. */
-
-#ifndef offsetof
-#define offsetof(p_type,field) ((size_t)&(((p_type *)0)->field))
-#endif
-
-#endif
-#endif
diff --git a/ext/socket/depend b/ext/socket/depend
deleted file mode 100644
index cca6d4e62a..0000000000
--- a/ext/socket/depend
+++ /dev/null
@@ -1,3 +0,0 @@
-socket.o : socket.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/rubyio.h $(hdrdir)/rubysig.h sockport.h
-getnameinfo.o: getnameinfo.c $(topdir)/config.h addrinfo.h sockport.h
-getaddrinfo.o: getaddrinfo.c $(topdir)/config.h addrinfo.h sockport.h
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb
deleted file mode 100644
index e178533bdc..0000000000
--- a/ext/socket/extconf.rb
+++ /dev/null
@@ -1,402 +0,0 @@
-require 'mkmf'
-
-$CPPFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len"
-
-def have_struct_member(type, member, header=nil)
-  #printf "checking for %s.%s... ", type, member
-  #STDOUT.flush
-
-  libs = $libs
-  src = 
-    if /mswin32|mingw/ =~ RUBY_PLATFORM
-      r = <<"SRC"
-#include 
-#include 
-SRC
-    else
-      ""
-    end
-  unless header.nil?
-    header = [header] unless header.kind_of? Array
-    header.each {|h|
-      src << <<"SRC"
-#include <#{h}>
-SRC
-    }
-  end
-  src << <<"SRC"
-int main() { return 0; }
-int s = (char *)&((#{type}*)0)->#{member} - (char *)0;
-SRC
-  r = try_link(src, libs) # xxx try_compile is not available.
-  unless r
-    #print "no\n"
-    return false
-  end
-  $defs.push(format("-DHAVE_ST_%s", member.upcase))
-  #print "yes\n"
-  return true
-end
-
-case RUBY_PLATFORM
-when /bccwin32/
-  test_func = "WSACleanup"
-  have_library("ws2_32", "WSACleanup")
-  have_func("closesocket")
-when /mswin32|mingw/
-  test_func = "WSACleanup"
-  have_library("wsock32", "WSACleanup")
-  have_func("closesocket")
-when /cygwin/
-#  $LDFLAGS << " -L/usr/lib" if File.directory?("/usr/lib")
-#  $CFLAGS << " -I/usr/include"
-  test_func = "socket"
-#  have_library("bind", "gethostbyaddr")
-when /beos/
-  test_func = "socket"
-  have_library("net", "socket")
-  have_func("closesocket")
-when /i386-os2_emx/
-  test_func = "socket"
-  have_library("socket", "socket")
-else
-  test_func = "socket"
-  have_library("nsl", "t_open")
-  have_library("socket", "socket")
-end
-
-$ipv6 = false
-default_ipv6 = /cygwin/ !~ RUBY_PLATFORM
-if enable_config("ipv6", default_ipv6)
-  if try_link(<
-#include 
-main()
-{
-  socket(AF_INET6, SOCK_STREAM, 0);
-}
-EOF
-    $CFLAGS+=" -DENABLE_IPV6"
-    $ipv6 = true
-  end
-end
-
-$ipv6type = nil
-$ipv6lib = nil
-$ipv6libdir = nil
-$ipv6trylibc = nil
-if $ipv6
-  if egrep_cpp("yes", <
-#ifdef IPV6_INRIA_VERSION
-yes
-#endif
-EOF
-    $ipv6type = "inria"
-    $CFLAGS="-DINET6 "+$CFLAGS
-  elsif egrep_cpp("yes", <
-#ifdef __KAME__
-yes
-#endif
-EOF
-    $ipv6type = "kame"
-    $ipv6lib="inet6"
-    $ipv6libdir="/usr/local/v6/lib"
-    $ipv6trylibc=true
-    $CFLAGS="-DINET6 "+$CFLAGS
-  elsif File.directory? "/usr/inet6"
-    $ipv6type = "linux"
-    $ipv6lib="inet6"
-    $ipv6libdir="/usr/inet6/lib"
-    $CFLAGS="-DINET6 -I/usr/inet6/include "+$CFLAGS
-  elsif egrep_cpp("yes", <
-#ifdef _TOSHIBA_INET6
-yes
-#endif
-EOF
-    $ipv6type = "toshiba"
-    $ipv6lib="inet6"
-    $ipv6libdir="/usr/local/v6/lib"
-    $CFLAGS="-DINET6 "+$CFLAGS
-  elsif egrep_cpp("yes", <
-#ifdef __V6D__
-yes
-#endif
-EOF
-    $ipv6type = "v6d"
-    $ipv6lib="v6"
-    $ipv6libdir="/usr/local/v6/lib"
-    $CFLAGS="-DINET6 -I/usr/local/v6/include "+$CFLAGS
-  elsif egrep_cpp("yes", <
-#ifdef _ZETA_MINAMI_INET6
-yes
-#endif
-EOF
-    $ipv6type = "zeta"
-    $ipv6lib="inet6"
-    $ipv6libdir="/usr/local/v6/lib"
-    $CFLAGS="-DINET6 "+$CFLAGS
-  else
-    $ipv6lib=with_config("ipv6-lib", nil)
-    $ipv6libdir=with_config("ipv6-libdir", nil)
-    $CFLAGS="-DINET6 "+$CFLAGS
-  end
-  
-  if $ipv6lib
-    if File.directory? $ipv6libdir and File.exist? "#{$ipv6libdir}/lib#{$ipv6lib}.a"
-      $LOCAL_LIBS = " -L#$ipv6libdir -l#$ipv6lib"
-    elsif !$ipv6trylibc
-      print <
-# include 
-#else
-# include 
-# include 
-# include 
-# include 
-# include 
-#endif
-int
-main()
-{
-   struct sockaddr_in sin;
-
-   sin.sin_len;
-   return 0;
-}
-EOF
-    $CFLAGS="-DHAVE_SIN_LEN "+$CFLAGS
-end
-
-  if try_link(<
-# include 
-#else
-# include 
-# include 
-# include 
-# include 
-#endif
-int
-main()
-{
-   struct sockaddr_storage ss;
-
-   ss.ss_family;
-   return 0;
-}
-EOF
-    $CFLAGS="-DHAVE_SOCKADDR_STORAGE "+$CFLAGS
-end
-
-  if try_link(<
-#include 
-#include 
-#include 
-#include 
-int
-main()
-{
-   struct sockaddr sa;
-
-   sa.sa_len;
-   return 0;
-}
-EOF
-    $CFLAGS="-DHAVE_SA_LEN "+$CFLAGS
-end
-
-have_header("netinet/tcp.h") if not /cygwin/ =~ RUBY_PLATFORM # for cygwin 1.1.5
-have_header("netinet/udp.h")
-
-have_struct_member('struct msghdr', 'msg_control', header=['sys/types.h', 'sys/socket.h'])
-have_struct_member('struct msghdr', 'msg_accrights', header=['sys/types.h', 'sys/socket.h'])
-
-$getaddr_info_ok = false
-if !enable_config("wide-getaddrinfo", false) and try_run(<
-#include 
-#include 
-#include 
-#include 
-
-#ifndef AF_LOCAL
-#define AF_LOCAL AF_UNIX
-#endif
-
-main()
-{
-  int passive, gaierr, inet4 = 0, inet6 = 0;
-  struct addrinfo hints, *ai, *aitop;
-  char straddr[INET6_ADDRSTRLEN], strport[16];
-
-  for (passive = 0; passive <= 1; passive++) {
-    memset(&hints, 0, sizeof(hints));
-    hints.ai_family = AF_UNSPEC;
-    hints.ai_flags = passive ? AI_PASSIVE : 0;
-    hints.ai_socktype = SOCK_STREAM;
-    if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
-      (void)gai_strerror(gaierr);
-      goto bad;
-    }
-    for (ai = aitop; ai; ai = ai->ai_next) {
-      if (ai->ai_family == AF_LOCAL) continue;
-      if (ai->ai_addr == NULL ||
-          ai->ai_addrlen == 0 ||
-          getnameinfo(ai->ai_addr, ai->ai_addrlen,
-                      straddr, sizeof(straddr), strport, sizeof(strport),
-                      NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
-        goto bad;
-      }
-      if (strcmp(strport, "54321") != 0) {
-        goto bad;
-      }
-      switch (ai->ai_family) {
-      case AF_INET:
-        if (passive) {
-          if (strcmp(straddr, "0.0.0.0") != 0) {
-            goto bad;
-          }
-        } else {
-          if (strcmp(straddr, "127.0.0.1") != 0) {
-            goto bad;
-          }
-        }
-        inet4++;
-        break;
-      case AF_INET6:
-        if (passive) {
-          if (strcmp(straddr, "::") != 0) {
-            goto bad;
-          }
-        } else {
-          if (strcmp(straddr, "::1") != 0) {
-            goto bad;
-          }
-        }
-        inet6++;
-        break;
-      case AF_UNSPEC:
-        goto bad;
-        break;
-      default:
-        /* another family support? */
-        break;
-      }
-    }
-  }
-
-  if (!(inet4 == 0 || inet4 == 2))
-    goto bad;
-  if (!(inet6 == 0 || inet6 == 2))
-    goto bad;
-
-  if (aitop)
-    freeaddrinfo(aitop);
-  exit(0);
-
- bad:
-  if (aitop)
-    freeaddrinfo(aitop);
-  exit(1);
-}
-EOF
-  $getaddr_info_ok = true
-end
-if $ipv6 and not $getaddr_info_ok
-      print <
-#include 
-#include 
-#include 
-#include 
-int
-main()
-{
-   socklen_t len;
-   return 0;
-}
-EOF
-  $CFLAGS="-Dsocklen_t=int "+$CFLAGS
-end
-
-have_header("sys/un.h")
-have_header("sys/uio.h")
-
-if have_func(test_func)
-  have_func("hsterror")
-  unless have_func("gethostname")
-    have_func("uname")
-  end
-  if ENV["SOCKS_SERVER"] or enable_config("socks", false)
-    if have_library("socks5", "SOCKSinit")
-      $CFLAGS+=" -DSOCKS5 -DSOCKS"
-    elsif have_library("socks", "Rconnect")
-      $CFLAGS+=" -DSOCKS"
-    end
-  end
-  create_makefile("socket")
-end
diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c
deleted file mode 100644
index 0a6af3111f..0000000000
--- a/ext/socket/getaddrinfo.c
+++ /dev/null
@@ -1,686 +0,0 @@
-/*
- * Copyright (C) 1995, 1996, 1997, and 1998 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.
- */
-
-/*
- * "#ifdef FAITH" part is local hack for supporting IPv4-v6 translator.
- *
- * Issues to be discussed:
- * - Thread safe-ness must be checked.
- * - Return values.  There are nonstandard return values defined and used
- *   in the source code.  This is because RFC2133 is silent about which error
- *   code must be returned for which situation.
- * - PF_UNSPEC case would be handled in getipnodebyname() with the AI_ALL flag.
- */
-
-#include "config.h"
-#include 
-#ifndef NT
-#include 
-#if defined(__BEOS__)
-# include 
-#else
-# include 
-#endif
-#include 
-#if defined(HAVE_ARPA_INET_H)
-#include 
-#endif
-#if defined(HAVE_ARPA_NAMESER_H)
-#include 
-#endif
-#include 
-#if defined(HAVE_RESOLV_H)
-#include 
-#endif
-#include 
-#else
-#include 
-#include 
-#endif
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#ifdef SOCKS5
-#include 
-#endif
-
-#include "addrinfo.h"
-#include "sockport.h"
-
-#if defined(__KAME__) && defined(INET6)
-# define FAITH
-#endif
-
-#define SUCCESS 0
-#define ANY 0
-#define YES 1
-#define NO  0
-
-#ifdef FAITH
-static int translate = NO;
-static struct in6_addr faith_prefix = IN6ADDR_ANY_INIT;
-#endif
-
-static const char in_addrany[] = { 0, 0, 0, 0 };
-static const char in6_addrany[] = {
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-static const char in_loopback[] = { 127, 0, 0, 1 }; 
-static const char in6_loopback[] = {
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
-};
-
-struct sockinet {
-	u_char	si_len;
-	u_char	si_family;
-	u_short	si_port;
-};
-
-static struct afd {
-	int a_af;
-	int a_addrlen;
-	int a_socklen;
-	int a_off;
-	const char *a_addrany;
-	const char *a_loopback;	
-} afdl [] = {
-#ifdef INET6
-#define N_INET6 0
-	{PF_INET6, sizeof(struct in6_addr),
-	 sizeof(struct sockaddr_in6),
-	 offsetof(struct sockaddr_in6, sin6_addr),
-	 in6_addrany, in6_loopback},
-#define N_INET  1
-#else
-#define N_INET  0
-#endif
-	{PF_INET, sizeof(struct in_addr),
-	 sizeof(struct sockaddr_in),
-	 offsetof(struct sockaddr_in, sin_addr),
-	 in_addrany, in_loopback},
-	{0, 0, 0, 0, NULL, NULL},
-};
-
-#ifdef INET6
-#define PTON_MAX	16
-#else
-#define PTON_MAX	4
-#endif
-
-static int get_name __P((const char *, struct afd *,
-			  struct addrinfo **, char *, struct addrinfo *,
-			  int));
-static int get_addr __P((const char *, int, struct addrinfo **,
-			struct addrinfo *, int));
-static int str_isnumber __P((const char *));
-	
-static const char *ai_errlist[] = {
-	"success.",
-	"address family for hostname not supported.",	/* EAI_ADDRFAMILY */
-	"temporary failure in name resolution.",	/* EAI_AGAIN      */
-	"invalid value for ai_flags.",		       	/* EAI_BADFLAGS   */
-	"non-recoverable failure in name resolution.", 	/* EAI_FAIL       */
-	"ai_family not supported.",			/* EAI_FAMILY     */
-	"memory allocation failure.", 			/* EAI_MEMORY     */
-	"no address associated with hostname.", 	/* EAI_NODATA     */
-	"hostname nor servname provided, or not known.",/* EAI_NONAME     */
-	"servname not supported for ai_socktype.",	/* EAI_SERVICE    */
-	"ai_socktype not supported.", 			/* EAI_SOCKTYPE   */
-	"system error returned in errno.", 		/* EAI_SYSTEM     */
-	"invalid value for hints.",			/* EAI_BADHINTS	  */
-	"resolved protocol is unknown.",		/* EAI_PROTOCOL   */
-	"unknown error.", 				/* EAI_MAX        */
-};
-
-#define GET_CANONNAME(ai, str) \
-if (pai->ai_flags & AI_CANONNAME) {\
-	if (((ai)->ai_canonname = (char *)malloc(strlen(str) + 1)) != NULL) {\
-		strcpy((ai)->ai_canonname, (str));\
-	} else {\
-		error = EAI_MEMORY;\
-		goto free;\
-	}\
-}
-
-#define GET_AI(ai, afd, addr, port) {\
-	char *p;\
-	if (((ai) = (struct addrinfo *)malloc(sizeof(struct addrinfo) +\
-					      ((afd)->a_socklen)))\
-	    == NULL) {\
-		error = EAI_MEMORY;\
-		goto free;\
-	}\
-	memcpy(ai, pai, sizeof(struct addrinfo));\
-	(ai)->ai_addr = (struct sockaddr *)((ai) + 1);\
-	memset((ai)->ai_addr, 0, (afd)->a_socklen);\
-	SET_SA_LEN((ai)->ai_addr, (ai)->ai_addrlen = (afd)->a_socklen);\
-	(ai)->ai_addr->sa_family = (ai)->ai_family = (afd)->a_af;\
-	((struct sockinet *)(ai)->ai_addr)->si_port = port;\
-	p = (char *)((ai)->ai_addr);\
-	memcpy(p + (afd)->a_off, (addr), (afd)->a_addrlen);\
-}
-
-#define ERR(err) { error = (err); goto bad; }
-
-#if defined __UCLIBC__
-const
-#endif
-char *
-gai_strerror(ecode)
-	int ecode;
-{
-	if (ecode < 0 || ecode > EAI_MAX)
-		ecode = EAI_MAX;
-	return (char *)ai_errlist[ecode];
-}
-
-void
-freeaddrinfo(ai)
-	struct addrinfo *ai;
-{
-	struct addrinfo *next;
-
-	do {
-		next = ai->ai_next;
-		if (ai->ai_canonname)
-			free(ai->ai_canonname);
-		/* no need to free(ai->ai_addr) */
-		free(ai);
-	} while ((ai = next) != NULL);
-}
-
-static int
-str_isnumber(p)
-	const char *p;
-{
-	char *q = (char *)p;
-	while (*q) {
-		if (! isdigit(*q))
-			return NO;
-		q++;
-	}
-	return YES;
-}
-
-#ifndef HAVE_INET_PTON
-
-static int
-inet_pton(af, hostname, pton)
-	int af;
-	const char *hostname;
-	void *pton;
-{
-	struct in_addr in;
-
-#ifdef HAVE_INET_ATON
-	if (!inet_aton(hostname, &in))
-	    return 0;
-#else
-	int d1, d2, d3, d4;
-	char ch;
-
-	if (sscanf(hostname, "%d.%d.%d.%d%c", &d1, &d2, &d3, &d4, &ch) == 4 &&
-	    0 <= d1 && d1 <= 255 && 0 <= d2 && d2 <= 255 &&
-	    0 <= d3 && d3 <= 255 && 0 <= d4 && d4 <= 255) {
-	    in.s_addr = htonl(
-		((long) d1 << 24) | ((long) d2 << 16) |
-		((long) d3 << 8) | ((long) d4 << 0));
-	}
-	else {
-	    return 0;
-	}
-#endif
-	memcpy(pton, &in, sizeof(in));
-	return 1;
-}
-#endif
-
-int
-getaddrinfo(hostname, servname, hints, res)
-	const char *hostname, *servname;
-	const struct addrinfo *hints;
-	struct addrinfo **res;
-{
-	struct addrinfo sentinel;
-	struct addrinfo *top = NULL;
-	struct addrinfo *cur;
-	int i, error = 0;
-	char pton[PTON_MAX];
-	struct addrinfo ai;
-	struct addrinfo *pai;
-	u_short port;
-
-#ifdef FAITH
-	static int firsttime = 1;
-
-	if (firsttime) {
-		/* translator hack */
-		{
-			char *q = getenv("GAI");
-			if (q && inet_pton(AF_INET6, q, &faith_prefix) == 1)
-				translate = YES;
-		}
-		firsttime = 0;
-	}
-#endif
-
-	/* initialize file static vars */
-	sentinel.ai_next = NULL;
-	cur = &sentinel;
-	pai = &ai;
-	pai->ai_flags = 0;
-	pai->ai_family = PF_UNSPEC;
-	pai->ai_socktype = ANY;
-	pai->ai_protocol = ANY;
-	pai->ai_addrlen = 0;
-	pai->ai_canonname = NULL;
-	pai->ai_addr = NULL;
-	pai->ai_next = NULL;
-	port = ANY;
-	
-	if (hostname == NULL && servname == NULL)
-		return EAI_NONAME;
-	if (hints) {
-		/* error check for hints */
-		if (hints->ai_addrlen || hints->ai_canonname ||
-		    hints->ai_addr || hints->ai_next)
-			ERR(EAI_BADHINTS); /* xxx */
-		if (hints->ai_flags & ~AI_MASK)
-			ERR(EAI_BADFLAGS);
-		switch (hints->ai_family) {
-		case PF_UNSPEC:
-		case PF_INET:
-#ifdef INET6
-		case PF_INET6:
-#endif
-			break;
-		default:
-			ERR(EAI_FAMILY);
-		}
-		memcpy(pai, hints, sizeof(*pai));
-		switch (pai->ai_socktype) {
-		case ANY:
-			switch (pai->ai_protocol) {
-			case ANY:
-				break;
-			case IPPROTO_UDP:
-				pai->ai_socktype = SOCK_DGRAM;
-				break;
-			case IPPROTO_TCP:
-				pai->ai_socktype = SOCK_STREAM;
-				break;
-			default:
-#if defined(SOCK_RAW)
-				pai->ai_socktype = SOCK_RAW;
-#endif
-				break;
-			}
-			break;
-#if defined(SOCK_RAW)
-		case SOCK_RAW:
-			break;
-#endif
-		case SOCK_DGRAM:
-			if (pai->ai_protocol != IPPROTO_UDP &&
-			    pai->ai_protocol != ANY)
-				ERR(EAI_BADHINTS);	/*xxx*/
-			pai->ai_protocol = IPPROTO_UDP;
-			break;
-		case SOCK_STREAM:
-			if (pai->ai_protocol != IPPROTO_TCP &&
-			    pai->ai_protocol != ANY)
-				ERR(EAI_BADHINTS);	/*xxx*/
-			pai->ai_protocol = IPPROTO_TCP;
-			break;
-		default:
-			ERR(EAI_SOCKTYPE);
-			break;
-		}
-	}
-
-	/*
-	 * service port
-	 */
-	if (servname) {
-		if (str_isnumber(servname)) {
-			if (pai->ai_socktype == ANY) {
-				/* caller accept *ANY* socktype */
-				pai->ai_socktype = SOCK_DGRAM;
-				pai->ai_protocol = IPPROTO_UDP;
-			}
-			port = htons((unsigned short)atoi(servname));
-		} else {
-			struct servent *sp;
-			char *proto;
-
-			proto = NULL;
-			switch (pai->ai_socktype) {
-			case ANY:
-				proto = NULL;
-				break;
-			case SOCK_DGRAM:
-				proto = "udp";
-				break;
-			case SOCK_STREAM:
-				proto = "tcp";
-				break;
-			default:
-				fprintf(stderr, "panic!\n");
-				break;
-			}
-			if ((sp = getservbyname(servname, proto)) == NULL)
-				ERR(EAI_SERVICE);
-			port = sp->s_port;
-			if (pai->ai_socktype == ANY)
-				if (strcmp(sp->s_proto, "udp") == 0) {
-					pai->ai_socktype = SOCK_DGRAM;
-					pai->ai_protocol = IPPROTO_UDP;
-				} else if (strcmp(sp->s_proto, "tcp") == 0) {
-					pai->ai_socktype = SOCK_STREAM;
-					pai->ai_protocol = IPPROTO_TCP;
-				} else
-					ERR(EAI_PROTOCOL);	/*xxx*/
-		}
-	}
-	
-	/*
-	 * hostname == NULL.
-	 * passive socket -> anyaddr (0.0.0.0 or ::)
-	 * non-passive socket -> localhost (127.0.0.1 or ::1)
-	 */
-	if (hostname == NULL) {
-		struct afd *afd;
-		int s;
-
-		for (afd = &afdl[0]; afd->a_af; afd++) {
-			if (!(pai->ai_family == PF_UNSPEC
-			   || pai->ai_family == afd->a_af)) {
-				continue;
-			}
-
-			/*
-			 * filter out AFs that are not supported by the kernel
-			 * XXX errno?
-			 */
-			s = socket(afd->a_af, SOCK_DGRAM, 0);
-			if (s < 0)
-				continue;
-#if defined(HAVE_CLOSESOCKET)
-			closesocket(s);
-#else
-			close(s);
-#endif
-
-			if (pai->ai_flags & AI_PASSIVE) {
-				GET_AI(cur->ai_next, afd, afd->a_addrany, port);
-				/* xxx meaningless?
-				 * GET_CANONNAME(cur->ai_next, "anyaddr");
-				 */
-			} else {
-				GET_AI(cur->ai_next, afd, afd->a_loopback,
-					port);
-				/* xxx meaningless?
-				 * GET_CANONNAME(cur->ai_next, "localhost");
-				 */
-			}
-			cur = cur->ai_next;
-		}
-		top = sentinel.ai_next;
-		if (top)
-			goto good;
-		else
-			ERR(EAI_FAMILY);
-	}
-	
-	/* hostname as numeric name */
-	for (i = 0; afdl[i].a_af; i++) {
-		if (inet_pton(afdl[i].a_af, hostname, pton)) {
-			u_long v4a;
-#ifdef INET6
-			u_char pfx;
-#endif
-
-			switch (afdl[i].a_af) {
-			case AF_INET:
-				v4a = ((struct in_addr *)pton)->s_addr;
-				if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a))
-					pai->ai_flags &= ~AI_CANONNAME;
-				v4a >>= IN_CLASSA_NSHIFT;
-				if (v4a == 0 || v4a == IN_LOOPBACKNET)
-					pai->ai_flags &= ~AI_CANONNAME;
-				break;
-#ifdef INET6
-			case AF_INET6:
-				pfx = ((struct in6_addr *)pton)->s6_addr8[0];
-				if (pfx == 0 || pfx == 0xfe || pfx == 0xff)
-					pai->ai_flags &= ~AI_CANONNAME;
-				break;
-#endif
-			}
-			
-			if (pai->ai_family == afdl[i].a_af ||
-			    pai->ai_family == PF_UNSPEC) {
-				if (! (pai->ai_flags & AI_CANONNAME)) {
-					GET_AI(top, &afdl[i], pton, port);
-					goto good;
-				}
-				/*
-				 * if AI_CANONNAME and if reverse lookup
-				 * fail, return ai anyway to pacify
-				 * calling application.
-				 *
-				 * XXX getaddrinfo() is a name->address
-				 * translation function, and it looks strange
-				 * that we do addr->name translation here.
-				 */
-				get_name(pton, &afdl[i], &top, pton, pai, port);
-				goto good;
-			} else 
-				ERR(EAI_FAMILY);	/*xxx*/
-		}
-	}
-
-	if (pai->ai_flags & AI_NUMERICHOST)
-		ERR(EAI_NONAME);
-
-	/* hostname as alphabetical name */
-	error = get_addr(hostname, pai->ai_family, &top, pai, port);
-	if (error == 0) {
-		if (top) {
- good:
-			*res = top;
-			return SUCCESS;
-		} else
-			error = EAI_FAIL;
-	}
- free:
-	if (top)
-		freeaddrinfo(top);
- bad:
-	*res = NULL;
-	return error;
-}
-
-static int
-get_name(addr, afd, res, numaddr, pai, port0)
-	const char *addr;
-	struct afd *afd;
-	struct addrinfo **res;
-	char *numaddr;
-	struct addrinfo *pai;
-	int port0;
-{
-	u_short port = port0 & 0xffff;
-	struct hostent *hp;
-	struct addrinfo *cur;
-	int error = 0;
-#ifdef INET6
-	int h_error;
-#endif
-
-#ifdef INET6
-	hp = getipnodebyaddr(addr, afd->a_addrlen, afd->a_af, &h_error);
-#else
-	hp = gethostbyaddr(addr, afd->a_addrlen, AF_INET);
-#endif
-	if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) {
-		GET_AI(cur, afd, hp->h_addr_list[0], port);
-		GET_CANONNAME(cur, hp->h_name);
-	} else
-		GET_AI(cur, afd, numaddr, port);
-	
-#ifdef INET6
-	if (hp)
-		freehostent(hp);
-#endif
-	*res = cur;
-	return SUCCESS;
- free:
-	if (cur)
-		freeaddrinfo(cur);
-#ifdef INET6
-	if (hp)
-		freehostent(hp);
-#endif
- /* bad: */
-	*res = NULL;
-	return error;
-}
-
-static int
-get_addr(hostname, af, res, pai, port0)
-	const char *hostname;
-	int af;
-	struct addrinfo **res;
-	struct addrinfo *pai;
-	int port0;
-{
-	u_short port = port0 & 0xffff;
-	struct addrinfo sentinel;
-	struct hostent *hp;
-	struct addrinfo *top, *cur;
-	struct afd *afd;
-	int i, error = 0, h_error;
-	char *ap;
-
-	top = NULL;
-	sentinel.ai_next = NULL;
-	cur = &sentinel;
-#ifdef INET6
-	if (af == AF_UNSPEC) {
-		hp = getipnodebyname(hostname, AF_INET6,
-				AI_ADDRCONFIG|AI_ALL|AI_V4MAPPED, &h_error);
-	} else
-		hp = getipnodebyname(hostname, af, AI_ADDRCONFIG, &h_error);
-#else
-	hp = gethostbyname(hostname);
-	h_error = h_errno;
-#endif
-	if (hp == NULL) {
-		switch (h_error) {
-		case HOST_NOT_FOUND:
-		case NO_DATA:
-			error = EAI_NODATA;
-			break;
-		case TRY_AGAIN:
-			error = EAI_AGAIN;
-			break;
-		case NO_RECOVERY:
-		default:
-			error = EAI_FAIL;
-			break;
-		}
-		goto bad;
-	}
-
-	if ((hp->h_name == NULL) || (hp->h_name[0] == 0) ||
-	    (hp->h_addr_list[0] == NULL))
-		ERR(EAI_FAIL);
-	
-	for (i = 0; (ap = hp->h_addr_list[i]) != NULL; i++) {
-		switch (af) {
-#ifdef INET6
-		case AF_INET6:
-			afd = &afdl[N_INET6];
-			break;
-#endif
-#ifndef INET6
-		default:	/* AF_UNSPEC */
-#endif
-		case AF_INET:
-			afd = &afdl[N_INET];
-			break;
-#ifdef INET6
-		default:	/* AF_UNSPEC */
-			if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)ap)) {
-				ap += sizeof(struct in6_addr) -
-					sizeof(struct in_addr);
-				afd = &afdl[N_INET];
-			} else
-				afd = &afdl[N_INET6];
-			break;
-#endif
-		}
-#ifdef FAITH
-		if (translate && afd->a_af == AF_INET) {
-			struct in6_addr *in6;
-
-			GET_AI(cur->ai_next, &afdl[N_INET6], ap, port);
-			in6 = &((struct sockaddr_in6 *)cur->ai_next->ai_addr)->sin6_addr;
-			memcpy(&in6->s6_addr32[0], &faith_prefix,
-			    sizeof(struct in6_addr) - sizeof(struct in_addr));
-			memcpy(&in6->s6_addr32[3], ap, sizeof(struct in_addr));
-		} else
-#endif /* FAITH */
-		GET_AI(cur->ai_next, afd, ap, port);
-		if (cur == &sentinel) {
-			top = cur->ai_next;
-			GET_CANONNAME(top, hp->h_name);
-		}
-		cur = cur->ai_next;
-	}
-#ifdef INET6
-	freehostent(hp);
-#endif
-	*res = top;
-	return SUCCESS;
- free:
-	if (top)
-		freeaddrinfo(top);
-#ifdef INET6
-	if (hp)
-		freehostent(hp);
-#endif
- bad:
-	*res = NULL;
-	return error;
-}
diff --git a/ext/socket/getnameinfo.c b/ext/socket/getnameinfo.c
deleted file mode 100644
index b8a1e310a3..0000000000
--- a/ext/socket/getnameinfo.c
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Copyright (C) 1995, 1996, 1997, and 1998 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.
- */
-
-/*
- * Issues to be discussed:
- * - Thread safe-ness must be checked
- * - Return values.  There seems to be no standard for return value (RFC2133)
- *   but INRIA implementation returns EAI_xxx defined for getaddrinfo().
- */
-
-#include "config.h"
-#include 
-#ifndef NT
-#if defined(__BEOS__)
-# include 
-#else
-# include 
-#endif
-#include 
-#if defined(HAVE_ARPA_INET_H)
-#include 
-#endif
-#if defined(HAVE_ARPA_NAMESER_H)
-#include 
-#endif
-#include 
-#if defined(HAVE_RESOLV_H)
-#include 
-#endif
-#endif
-#ifdef NT
-#include 
-#include 
-#define snprintf _snprintf
-#endif
-
-#include 
-#include 
-
-#ifdef SOCKS5
-#include 
-#endif
-
-#include "addrinfo.h"
-#include "sockport.h"
-
-#define SUCCESS 0
-#define ANY 0
-#define YES 1
-#define NO  0
-
-struct sockinet {
-	u_char	si_len;
-	u_char	si_family;
-	u_short	si_port;
-};
-
-static struct afd {
-	int a_af;
-	int a_addrlen;
-	int a_socklen;
-	int a_off;
-} afdl [] = {
-#ifdef INET6
-#define N_INET6 0
-	{PF_INET6, sizeof(struct in6_addr),
-	 sizeof(struct sockaddr_in6),
-	 offsetof(struct sockaddr_in6, sin6_addr)},
-#define N_INET  1
-#else
-#define N_INET  0
-#endif
-	{PF_INET, sizeof(struct in_addr),
-	 sizeof(struct sockaddr_in),
-	 offsetof(struct sockaddr_in, sin_addr)},
-	{0, 0, 0, 0},
-};
-
-#define ENI_NOSOCKET 	0
-#define ENI_NOSERVNAME	1
-#define ENI_NOHOSTNAME	2
-#define ENI_MEMORY	3
-#define ENI_SYSTEM	4
-#define ENI_FAMILY	5
-#define ENI_SALEN	6
-
-#ifndef HAVE_INET_NTOP
-static const char *
-inet_ntop(af, addr, numaddr, numaddr_len)
-	int af;
-	const void *addr;
-	char *numaddr;
-	size_t numaddr_len;
-{
-#ifdef HAVE_INET_NTOA
-	struct in_addr in;
-	memcpy(&in.s_addr, addr, sizeof(in.s_addr));
-	snprintf(numaddr, numaddr_len, "%s", inet_ntoa(in));
-#else
-	unsigned long x = ntohl(*(unsigned long*)addr);
-	snprintf(numaddr, numaddr_len, "%d.%d.%d.%d",
-		 (int) (x>>24) & 0xff, (int) (x>>16) & 0xff,
-		 (int) (x>> 8) & 0xff, (int) (x>> 0) & 0xff);
-#endif
-	return numaddr;
-}
-#endif
-
-int
-getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
-	const struct sockaddr *sa;
-	size_t salen;
-	char *host;
-	size_t hostlen;
-	char *serv;
-	size_t servlen;
-	int flags;
-{
-	struct afd *afd;
-	struct servent *sp;
-	struct hostent *hp;
-	u_short port;
-	int family, len, i;
-	char *addr, *p;
-	u_long v4a;
-#ifdef INET6
-	u_char pfx;
-#endif
-	int h_error;
-	char numserv[512];
-	char numaddr[512];
-
-	if (sa == NULL)
-		return ENI_NOSOCKET;
-
-	len = SA_LEN(sa);
-	if (len != salen) return ENI_SALEN;
-	
-	family = sa->sa_family;
-	for (i = 0; afdl[i].a_af; i++)
-		if (afdl[i].a_af == family) {
-			afd = &afdl[i];
-			goto found;
-		}
-	return ENI_FAMILY;
-	
- found:
-	if (len != afd->a_socklen) return ENI_SALEN;
-	
-	port = ((struct sockinet *)sa)->si_port; /* network byte order */
-	addr = (char *)sa + afd->a_off;
-
-	if (serv == NULL || servlen == 0) {
-		/* what we should do? */
-	} else if (flags & NI_NUMERICSERV) {
-		snprintf(numserv, sizeof(numserv), "%d", ntohs(port));
-		if (strlen(numserv) + 1 > servlen)
-			return ENI_MEMORY;
-		strcpy(serv, numserv);
-	} else {
-#if defined(HAVE_GETSERVBYPORT)
-		sp = getservbyport(port, (flags & NI_DGRAM) ? "udp" : "tcp");
-		if (sp) {
-			if (strlen(sp->s_name) + 1 > servlen)
-				return ENI_MEMORY;
-			strcpy(serv, sp->s_name);
-		} else
-			return ENI_NOSERVNAME;
-#else
-		return ENI_NOSERVNAME;
-#endif
-	}
-
-	switch (sa->sa_family) {
-	case AF_INET:
-		v4a = ntohl(((struct sockaddr_in *)sa)->sin_addr.s_addr);
-		if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a))
-			flags |= NI_NUMERICHOST;
-		v4a >>= IN_CLASSA_NSHIFT;
-		if (v4a == 0)
-			flags |= NI_NUMERICHOST;			
-		break;
-#ifdef INET6
-	case AF_INET6:
-		pfx = ((struct sockaddr_in6 *)sa)->sin6_addr.s6_addr8[0];
-		if (pfx == 0 || pfx == 0xfe || pfx == 0xff)
-			flags |= NI_NUMERICHOST;
-		break;
-#endif
-	}
-	if (host == NULL || hostlen == 0) {
-		/* what should we do? */
-	} else if (flags & NI_NUMERICHOST) {
-		if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr))
-		    == NULL)
-			return ENI_SYSTEM;
-		if (strlen(numaddr) > hostlen)
-			return ENI_MEMORY;
-		strcpy(host, numaddr);
-	} else {
-#ifdef INET6
-		hp = getipnodebyaddr(addr, afd->a_addrlen, afd->a_af, &h_error);
-#else
-		hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af);
-		h_error = h_errno;
-#endif
-
-		if (hp) {
-			if (flags & NI_NOFQDN) {
-				p = strchr(hp->h_name, '.');
-				if (p) *p = '\0';
-			}
-			if (strlen(hp->h_name) + 1 > hostlen) {
-#ifdef INET6
-				freehostent(hp);
-#endif
-				return ENI_MEMORY;
-			}
-			strcpy(host, hp->h_name);
-#ifdef INET6
-			freehostent(hp);
-#endif
-		} else {
-			if (flags & NI_NAMEREQD)
-				return ENI_NOHOSTNAME;
-			if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr))
-			    == NULL)
-				return ENI_NOHOSTNAME;
-			if (strlen(numaddr) > hostlen)
-				return ENI_MEMORY;
-			strcpy(host, numaddr);
-		}
-	}
-	return SUCCESS;
-}
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
deleted file mode 100644
index d0e3b9b574..0000000000
--- a/ext/socket/socket.c
+++ /dev/null
@@ -1,2932 +0,0 @@
-/************************************************
-
-  socket.c -
-
-  $Author$
-  $Date$
-  created at: Thu Mar 31 12:21:29 JST 1994
-
-  Copyright (C) 1993-2001 Yukihiro Matsumoto
-
-************************************************/
-
-#include "ruby.h"
-#include "rubyio.h"
-#include "rubysig.h"
-#include 
-#include 
-
-#ifdef HAVE_UNISTD_H
-#include 
-#endif
-
-#ifdef HAVE_SYS_UIO_H
-#include 
-#endif
-
-#ifndef NT
-#if defined(__BEOS__)
-# include 
-#else
-# include 
-#endif
-#include 
-#ifdef HAVE_NETINET_TCP_H
-# include 
-#endif
-#ifdef HAVE_NETINET_UDP_H
-# include 
-#endif
-#include 
-#endif
-#include 
-#ifdef HAVE_SYS_UN_H
-#include 
-#endif
-
-#if defined(HAVE_FCNTL)
-#ifdef HAVE_SYS_SELECT_H
-#include 
-#endif
-#include 
-#include 
-#include 
-#endif
-#ifndef EWOULDBLOCK
-#define EWOULDBLOCK EAGAIN
-#endif
-#ifndef HAVE_GETADDRINFO
-# include "addrinfo.h"
-#endif
-#include "sockport.h"
-
-static int do_not_reverse_lookup = 0;
-
-VALUE rb_cBasicSocket;
-VALUE rb_cIPSocket;
-VALUE rb_cTCPSocket;
-VALUE rb_cTCPServer;
-VALUE rb_cUDPSocket;
-#ifdef AF_UNIX
-VALUE rb_cUNIXSocket;
-VALUE rb_cUNIXServer;
-#endif
-VALUE rb_cSocket;
-
-static VALUE rb_eSocket;
-
-#ifdef SOCKS
-VALUE rb_cSOCKSSocket;
-#ifdef SOCKS5
-#include 
-#else
-void SOCKSinit();
-int Rconnect();
-#endif
-#endif
-
-#define INET_CLIENT 0
-#define INET_SERVER 1
-#define INET_SOCKS  2
-
-#ifndef HAVE_SOCKADDR_STORAGE
-/*
- * RFC 2553: protocol-independent placeholder for socket addresses
- */
-#define _SS_MAXSIZE	128
-#define _SS_ALIGNSIZE	(sizeof(double))
-#define _SS_PAD1SIZE	(_SS_ALIGNSIZE - sizeof(unsigned char) * 2)
-#define _SS_PAD2SIZE	(_SS_MAXSIZE - sizeof(unsigned char) * 2 - \
-				_SS_PAD1SIZE - _SS_ALIGNSIZE)
-
-struct sockaddr_storage {
-#ifdef HAVE_SA_LEN
-	unsigned char ss_len;		/* address length */
-	unsigned char ss_family;	/* address family */
-#else
-	unsigned short ss_family;
-#endif
-	char	__ss_pad1[_SS_PAD1SIZE];
-	double	__ss_align;	/* force desired structure storage alignment */
-	char	__ss_pad2[_SS_PAD2SIZE];
-};
-#endif
-
-#if defined(INET6) && (defined(LOOKUP_ORDER_HACK_INET) || defined(LOOKUP_ORDER_HACK_INET6))
-#define LOOKUP_ORDERS		3
-static int lookup_order_table[LOOKUP_ORDERS] = {
-#if defined(LOOKUP_ORDER_HACK_INET)
-    PF_INET, PF_INET6, PF_UNSPEC,
-#elif defined(LOOKUP_ORDER_HACK_INET6)
-    PF_INET6, PF_INET, PF_UNSPEC,
-#else
-    /* should not happen */
-#endif
-};
-
-static int
-ruby_getaddrinfo(nodename, servname, hints, res)
-     char *nodename;
-     char *servname;
-     struct addrinfo *hints;
-     struct addrinfo **res;
-{
-    struct addrinfo tmp_hints;
-    int i, af, error;
-
-    if (hints->ai_family != PF_UNSPEC) {
-	return getaddrinfo(nodename, servname, hints, res);
-    }
-
-    for (i = 0; i < LOOKUP_ORDERS; i++) {
-	af = lookup_order_table[i];
-	MEMCPY(&tmp_hints, hints, struct addrinfo, 1);
-	tmp_hints.ai_family = af;
-	error = getaddrinfo(nodename, servname, &tmp_hints, res);
-	if (error) {
-	    if (tmp_hints.ai_family == PF_UNSPEC) {
-		break;
-	    }
-	}
-	else {
-	    break;
-	}
-    }
-
-    return error;
-}
-#define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo((node),(serv),(hints),(res))
-#endif
-
-#ifdef HAVE_CLOSESOCKET
-#undef close
-#define close closesocket
-#endif
-
-#ifdef NT
-static void sock_finalize _((OpenFile *fptr));
-
-static void
-sock_finalize(fptr)
-    OpenFile *fptr;
-{
-    SOCKET s;
-
-    if (!fptr->f) return;
-    s = get_osfhandle(fileno(fptr->f));
-    rb_w32_fdclose(fptr->f);
-    if (fptr->f2) rb_w32_fdclose(fptr->f2);
-    closesocket(s);
-}
-#endif
-
-static VALUE
-init_sock(sock, fd)
-    VALUE sock;
-    int fd;
-{
-    OpenFile *fp;
-
-    MakeOpenFile(sock, fp);
-    fp->f = rb_fdopen(fd, "r");
-#ifdef NT
-    fp->finalize = sock_finalize;
-#endif
-    fp->f2 = rb_fdopen(fd, "w");
-    fp->mode = FMODE_READWRITE;
-    rb_io_synchronized(fp);
-
-    return sock;
-}
-
-static VALUE
-bsock_s_for_fd(klass, fd)
-    VALUE klass, fd;
-{
-    OpenFile *fptr;
-    VALUE sock = init_sock(rb_obj_alloc(klass), NUM2INT(fd));
-
-    GetOpenFile(sock, fptr);
-
-    return sock;
-}
-
-static VALUE
-bsock_shutdown(argc, argv, sock)
-    int argc;
-    VALUE *argv;
-    VALUE sock;
-{
-    VALUE howto;
-    int how;
-    OpenFile *fptr;
-
-    if (rb_safe_level() >= 4 && !OBJ_TAINTED(sock)) {
-	rb_raise(rb_eSecurityError, "Insecure: can't shutdown socket");
-    }
-    rb_scan_args(argc, argv, "01", &howto);
-    if (howto == Qnil)
-	how = 2;
-    else {
-	how = NUM2INT(howto);
-	if (how < 0 || 2 < how) {
-	    rb_raise(rb_eArgError, "`how' should be either 0, 1, 2");
-	}
-    }
-    GetOpenFile(sock, fptr);
-    if (shutdown(fileno(fptr->f), how) == -1)
-	rb_sys_fail(0);
-
-    return INT2FIX(0);
-}
-
-static VALUE
-bsock_close_read(sock)
-    VALUE sock;
-{
-    OpenFile *fptr;
-
-    if (rb_safe_level() >= 4 && !OBJ_TAINTED(sock)) {
-	rb_raise(rb_eSecurityError, "Insecure: can't close socket");
-    }
-    GetOpenFile(sock, fptr);
-    shutdown(fileno(fptr->f), 0);
-    if (!(fptr->mode & FMODE_WRITABLE)) {
-	return rb_io_close(sock);
-    }
-    fptr->mode &= ~FMODE_READABLE;
-
-    return Qnil;
-}
-
-static VALUE
-bsock_close_write(sock)
-    VALUE sock;
-{
-    OpenFile *fptr;
-
-    if (rb_safe_level() >= 4 && !OBJ_TAINTED(sock)) {
-	rb_raise(rb_eSecurityError, "Insecure: can't close socket");
-    }
-    GetOpenFile(sock, fptr);
-    if (!(fptr->mode & FMODE_READABLE)) {
-	return rb_io_close(sock);
-    }
-    shutdown(fileno(fptr->f2), 1);
-    fptr->mode &= ~FMODE_WRITABLE;
-
-    return Qnil;
-}
-
-static VALUE
-bsock_setsockopt(sock, lev, optname, val)
-    VALUE sock, lev, optname, val;
-{
-    int level, option;
-    OpenFile *fptr;
-    int i;
-    char *v;
-    int vlen;
-
-    rb_secure(2);
-    level = NUM2INT(lev);
-    option = NUM2INT(optname);
-    switch (TYPE(val)) {
-      case T_FIXNUM:
-	i = FIX2INT(val);
-	goto numval;
-      case T_FALSE:
-	i = 0;
-	goto numval;
-      case T_TRUE:
-	i = 1;
-      numval:
-	v = (char*)&i; vlen = sizeof(i);
-	break;
-      default:
-	StringValue(val);
-	v = RSTRING(val)->ptr;
-	vlen = RSTRING(val)->len;
-	break;
-    }
-
-    GetOpenFile(sock, fptr);
-    if (setsockopt(fileno(fptr->f), level, option, v, vlen) < 0)
-	rb_sys_fail(fptr->path);
-
-    return INT2FIX(0);
-}
-
-static VALUE
-bsock_getsockopt(sock, lev, optname)
-    VALUE sock, lev, optname;
-{
-#if !defined(__BEOS__)
-    int level, option;
-    socklen_t len;
-    char *buf;
-    OpenFile *fptr;
-
-    level = NUM2INT(lev);
-    option = NUM2INT(optname);
-    len = 256;
-    buf = ALLOCA_N(char,len);
-
-    GetOpenFile(sock, fptr);
-    if (getsockopt(fileno(fptr->f), level, option, buf, &len) < 0)
-	rb_sys_fail(fptr->path);
-
-    return rb_str_new(buf, len);
-#else
-    rb_notimplement();
-#endif
-}
-
-static VALUE
-bsock_getsockname(sock)
-   VALUE sock;
-{
-    char buf[1024];
-    socklen_t len = sizeof buf;
-    OpenFile *fptr;
-
-    GetOpenFile(sock, fptr);
-    if (getsockname(fileno(fptr->f), (struct sockaddr*)buf, &len) < 0)
-	rb_sys_fail("getsockname(2)");
-    return rb_str_new(buf, len);
-}
-
-static VALUE
-bsock_getpeername(sock)
-   VALUE sock;
-{
-    char buf[1024];
-    socklen_t len = sizeof buf;
-    OpenFile *fptr;
-
-    GetOpenFile(sock, fptr);
-    if (getpeername(fileno(fptr->f), (struct sockaddr*)buf, &len) < 0)
-	rb_sys_fail("getpeername(2)");
-    return rb_str_new(buf, len);
-}
-
-static VALUE
-bsock_send(argc, argv, sock)
-    int argc;
-    VALUE *argv;
-    VALUE sock;
-{
-    VALUE mesg, to;
-    VALUE flags;
-    OpenFile *fptr;
-    FILE *f;
-    int fd, n;
-
-    rb_secure(4);
-    rb_scan_args(argc, argv, "21", &mesg, &flags, &to);
-
-    GetOpenFile(sock, fptr);
-    f = GetWriteFile(fptr);
-    fd = fileno(f);
-  retry:
-    rb_thread_fd_writable(fd);
-    StringValue(mesg);
-    if (!NIL_P(to)) {
-	StringValue(to);
-	n = sendto(fd, RSTRING(mesg)->ptr, RSTRING(mesg)->len, NUM2INT(flags),
-		   (struct sockaddr*)RSTRING(to)->ptr, RSTRING(to)->len);
-    }
-    else {
-	n = send(fd, RSTRING(mesg)->ptr, RSTRING(mesg)->len, NUM2INT(flags));
-    }
-    if (n < 0) {
-	switch (errno) {
-	  case EINTR:
-	    rb_thread_schedule();
-	    goto retry;
-	}
-	rb_sys_fail("send(2)");
-    }
-    return INT2FIX(n);
-}
-
-static VALUE ipaddr _((struct sockaddr*));
-#ifdef HAVE_SYS_UN_H
-static VALUE unixaddr _((struct sockaddr_un*));
-#endif
-
-enum sock_recv_type {
-    RECV_RECV,			/* BasicSocket#recv(no from) */
-    RECV_IP,			/* IPSocket#recvfrom */
-    RECV_UNIX,			/* UNIXSocket#recvfrom */
-    RECV_SOCKET			/* Socket#recvfrom */
-};
-
-static VALUE
-s_recvfrom(sock, argc, argv, from)
-    VALUE sock;
-    int argc;
-    VALUE *argv;
-    enum sock_recv_type from;
-{
-    OpenFile *fptr;
-    VALUE str;
-    char buf[1024];
-    socklen_t alen = sizeof buf;
-    VALUE len, flg;
-    int fd, flags;
-
-    rb_scan_args(argc, argv, "11", &len, &flg);
-
-    if (flg == Qnil) flags = 0;
-    else             flags = NUM2INT(flg);
-
-    GetOpenFile(sock, fptr);
-    if (rb_read_pending(fptr->f)) {
-	rb_raise(rb_eIOError, "recv for buffered IO");
-    }
-    fd = fileno(fptr->f);
-
-    str = rb_tainted_str_new(0, NUM2INT(len));
-
-  retry:
-    rb_thread_wait_fd(fd);
-    TRAP_BEG;
-    RSTRING(str)->len = recvfrom(fd, RSTRING(str)->ptr, RSTRING(str)->len, flags,
-				 (struct sockaddr*)buf, &alen);
-    TRAP_END;
-
-    if (RSTRING(str)->len < 0) {
-	switch (errno) {
-	  case EINTR:
-	    rb_thread_schedule();
-	    goto retry;
-	}
-	rb_sys_fail("recvfrom(2)");
-    }
-    rb_obj_taint(str);
-    switch (from) {
-      case RECV_RECV:
-	return (VALUE)str;
-      case RECV_IP:
-#if 0
-	if (alen != sizeof(struct sockaddr_in)) {
-	    rb_raise(rb_eTypeError, "sockaddr size differs - should not happen");
-	}
-#endif
-	return rb_assoc_new(str, ipaddr((struct sockaddr*)buf));
-#ifdef HAVE_SYS_UN_H
-      case RECV_UNIX:
-	return rb_assoc_new(str, unixaddr((struct sockaddr_un*)buf));
-#endif
-      case RECV_SOCKET:
-	return rb_assoc_new(str, rb_str_new(buf, alen));
-      default:
-	rb_bug("s_recvfrom called with bad value");
-    }
-}
-
-static VALUE
-bsock_recv(argc, argv, sock)
-    int argc;
-    VALUE *argv;
-    VALUE sock;
-{
-    return s_recvfrom(sock, argc, argv, RECV_RECV);
-}
-
-static VALUE
-bsock_do_not_rev_lookup()
-{
-    return do_not_reverse_lookup?Qtrue:Qfalse;
-}
-
-static VALUE
-bsock_do_not_rev_lookup_set(self, val)
-{
-    rb_secure(4);
-    do_not_reverse_lookup = RTEST(val);
-    return val;
-}
-
-static void
-mkipaddr0(addr, buf, len)
-    struct sockaddr *addr;
-    char *buf;
-    size_t len;
-{
-    int error;
-
-    error = getnameinfo(addr, SA_LEN(addr), buf, len, NULL, 0, NI_NUMERICHOST);
-    if (error) {
-	rb_raise(rb_eSocket, "getnameinfo: %s", gai_strerror(error));
-    }
-}
-
-static VALUE
-mkipaddr(addr)
-    struct sockaddr *addr;
-{
-    char buf[1024];
-
-    mkipaddr0(addr, buf, sizeof(buf));
-    return rb_str_new2(buf);
-}
-
-static void
-mkinetaddr(host, buf, len)
-    long host;
-    char *buf;
-    size_t len;
-{
-    struct sockaddr_in sin;
-
-    MEMZERO(&sin, struct sockaddr_in, 1);
-    sin.sin_family = AF_INET;
-    SET_SIN_LEN(&sin, sizeof(sin));
-    sin.sin_addr.s_addr = host;
-    mkipaddr0((struct sockaddr*)&sin, buf, len);
-}
-
-static struct addrinfo*
-sock_addrinfo(host, port, socktype, flags)
-    VALUE host, port;
-    int socktype, flags;
-{
-    struct addrinfo hints, *hintsp, *res;
-    char *hostp, *portp;
-    int error;
-    char hbuf[1024], pbuf[16];
-
-    if (NIL_P(host)) {
-	hostp = NULL;
-    }
-    else if (rb_obj_is_kind_of(host, rb_cInteger)) {
-	long i = NUM2LONG(host);
-
-	mkinetaddr(htonl(i), hbuf, sizeof(hbuf));
-	hostp = hbuf;
-    }
-    else {
-	char *name;
-
-	SafeStringValue(host);
-	name = RSTRING(host)->ptr;
-	if (*name == 0 || (name[0] == '<' && strcmp(name, "") == 0)) {
-	    mkinetaddr(INADDR_ANY, hbuf, sizeof(hbuf));
-	}
-	else if (name[0] == '<' && strcmp(name, "") == 0) {
-	    mkinetaddr(INADDR_BROADCAST, hbuf, sizeof(hbuf));
-	}
-	else if (strlen(name) >= sizeof(hbuf)) {
-	    rb_raise(rb_eArgError, "hostname too long (%d)", strlen(name));
-	}
-	else {
-	    strcpy(hbuf, name);
-	}
-	hostp = hbuf;
-    }
-    if (NIL_P(port)) {
-	portp = 0;
-    }
-    else if (FIXNUM_P(port)) {
-	snprintf(pbuf, sizeof(pbuf), "%d", FIX2INT(port));
-	portp = pbuf;
-    }
-    else {
-	SafeStringValue(port);
-	portp = RSTRING(port)->ptr;
-    }
-
-    if (socktype == 0 && flags == 0) {
-	hintsp = 0;
-    }
-    else {
-	hintsp = &hints;
-	MEMZERO(&hints, struct addrinfo, 1);
-	hints.ai_family = PF_UNSPEC;
-	hints.ai_protocol = 0;
-	hints.ai_socktype = socktype;
-	hints.ai_flags = flags;
-    }
-    error = getaddrinfo(hostp, portp, hintsp, &res);
-    if (error) {
-	if (hostp && hostp[strlen(hostp)-1] == '\n') {
-	    rb_raise(rb_eSocket, "newline at the end of hostname");
-	}
-	rb_raise(rb_eSocket, "getaddrinfo: %s", gai_strerror(error));
-    }
-
-    return res;
-}
-
-static void
-setipaddr(name, addr)
-    VALUE name;
-    struct sockaddr_storage *addr;
-{
-    struct addrinfo *res = sock_addrinfo(name, Qnil, SOCK_STREAM, 0);
-
-    /* just take the first one */
-    memcpy(addr, res->ai_addr, res->ai_addrlen);
-    freeaddrinfo(res);
-}
-
-static VALUE
-ipaddr(sockaddr)
-    struct sockaddr *sockaddr;
-{
-    VALUE family, port, addr1, addr2;
-    VALUE ary;
-    int error;
-    char hbuf[1024], pbuf[1024];
-
-    switch (sockaddr->sa_family) {
-    case AF_UNSPEC:
-	family = rb_str_new2("AF_UNSPEC");
-	break;
-    case AF_INET:
-	family = rb_str_new2("AF_INET");
-	break;
-#ifdef INET6
-    case AF_INET6:
-	family = rb_str_new2("AF_INET6");
-	break;
-#endif
-#ifdef AF_LOCAL
-    case AF_LOCAL:
-	family = rb_str_new2("AF_LOCAL");
-	break;
-#elif  AF_UNIX
-    case AF_UNIX:
-	family = rb_str_new2("AF_UNIX");
-	break;
-#endif
-    default:
-        sprintf(pbuf, "unknown:%d", sockaddr->sa_family);
-	family = rb_str_new2(pbuf);
-	break;
-    }
-    if (!do_not_reverse_lookup) {
-	error = getnameinfo(sockaddr, SA_LEN(sockaddr), hbuf, sizeof(hbuf),
-			    NULL, 0, 0);
-	if (error) {
-	    rb_raise(rb_eSocket, "getnameinfo: %s", gai_strerror(error));
-	}
-	addr1 = rb_str_new2(hbuf);
-    }
-    error = getnameinfo(sockaddr, SA_LEN(sockaddr), hbuf, sizeof(hbuf),
-			pbuf, sizeof(pbuf), NI_NUMERICHOST | NI_NUMERICSERV);
-    if (error) {
-	rb_raise(rb_eSocket, "getnameinfo: %s", gai_strerror(error));
-    }
-    addr2 = rb_str_new2(hbuf);
-    if (do_not_reverse_lookup) {
-	addr1 = addr2;
-    }
-    port = INT2FIX(atoi(pbuf));
-    ary = rb_ary_new3(4, family, port, addr1, addr2);
-
-    return ary;
-}
-
-static int
-ruby_socket(domain, type, proto)
-    int domain, type, proto;
-{
-    int fd;
-
-    fd = socket(domain, type, proto);
-    if (fd < 0) {
-	if (errno == EMFILE || errno == ENFILE) {
-	    rb_gc();
-	    fd = socket(domain, type, proto);
-	}
-    }
-    return fd;
-}
-
-static void
-thread_read_select(fd)
-    int fd;
-{
-    fd_set fds;
-
-    FD_ZERO(&fds);
-    FD_SET(fd, &fds);
-    rb_thread_select(fd+1, &fds, 0, 0, 0);
-}
-
-static void
-thread_write_select(fd)
-    int fd;
-{
-    fd_set fds;
-
-    FD_ZERO(&fds);
-    FD_SET(fd, &fds);
-    rb_thread_select(fd+1, 0, &fds, 0, 0);
-}
-
-static int
-ruby_connect(fd, sockaddr, len, socks)
-    int fd;
-    struct sockaddr *sockaddr;
-    int len;
-    int socks;
-{
-    int status;
-    int mode;
-#if defined __CYGWIN__
-    int wait_in_progress = -1;
-#endif
-
-#if defined(HAVE_FCNTL)
-    mode = fcntl(fd, F_GETFL, 0);
-
-#ifdef O_NDELAY
-# define NONBLOCKING O_NDELAY
-#else
-#ifdef O_NBIO
-# define NONBLOCKING O_NBIO
-#else
-# define NONBLOCKING O_NONBLOCK
-#endif
-#endif
-#ifdef SOCKS5
-    if (!socks)
-#endif
-    fcntl(fd, F_SETFL, mode|NONBLOCKING);
-#endif /* HAVE_FCNTL */
-
-    for (;;) {
-#if defined(SOCKS) && !defined(SOCKS5)
-	if (socks) {
-	    status = Rconnect(fd, sockaddr, len);
-	}
-	else
-#endif
-	{
-	    status = connect(fd, sockaddr, len);
-	}
-	if (status < 0) {
-	    switch (errno) {
-	      case EAGAIN:
-#ifdef EINPROGRESS
-	      case EINPROGRESS:
-#ifdef __CYGWIN__
-	      case EALREADY:
-		wait_in_progress = 10;
-#endif
-#endif
-		thread_write_select(fd);
-		continue;
-
-#if defined __CYGWIN__
-	      case EINVAL:
-		if (wait_in_progress-- > 0) {
-		    struct timeval tv = {0, 100000};
-		    rb_thread_wait_for(tv);
-		    continue;
-		}
-		break;
-#endif
-
-#ifdef EISCONN
-	      case EISCONN:
-		status = 0;
-		errno = 0;
-		break;
-#endif
-	      default:
-		break;
-	    }
-	}
-#ifdef HAVE_FCNTL
-	fcntl(fd, F_SETFL, mode);
-#endif
-	return status;
-    }
-}
-
-static void
-load_addr_info(h, serv, type, res)
-    VALUE h, serv;
-    int type;
-    struct addrinfo **res;
-{
-    char *host;
-    char pbuf[1024], *portp;
-    struct addrinfo hints;
-    int error;
-
-    if (!NIL_P(h)) {
-	SafeStringValue(h);
-	host = RSTRING(h)->ptr;
-    }
-    else {
-	host = NULL;
-    }
-    if (FIXNUM_P(serv)) {
-	snprintf(pbuf, sizeof(pbuf), "%ld", FIX2UINT(serv));
-	portp = pbuf;
-    }
-    else {
-	SafeStringValue(serv);
-	if (RSTRING(serv)->len >= sizeof(pbuf))
-	    rb_raise(rb_eArgError, "servicename too long (%d)", RSTRING(serv)->len);
-	strcpy(pbuf, RSTRING(serv)->ptr);
-	portp = pbuf;
-    }
-    MEMZERO(&hints, struct addrinfo, 1);
-    hints.ai_family = PF_UNSPEC;
-    if (type == INET_SERVER) {
-	hints.ai_flags = AI_PASSIVE;
-    }
-    error = getaddrinfo(host, portp, &hints, res);
-    if (error) {
-	rb_raise(rb_eSocket, "getaddrinfo: %s", gai_strerror(error));
-    }
-}
-
-struct inetsock_arg
-{
-    VALUE sock;
-    struct {
-	VALUE host, serv;
-	struct addrinfo *res;
-    } remote, local;
-    int type;
-    int fd;
-};
-
-static VALUE
-inetsock_cleanup(arg)
-    struct inetsock_arg *arg;
-{
-    if (arg->remote.res) {
-	freeaddrinfo(arg->remote.res);
-	arg->remote.res = 0;
-    }
-    if (arg->local.res) {
-	freeaddrinfo(arg->local.res);
-	arg->local.res = 0;
-    }
-    if (arg->fd >= 0) {
-	close(arg->fd);
-    }
-    return Qnil;
-}
-
-static VALUE
-init_inetsock_internal(arg)
-    struct inetsock_arg *arg;
-{
-    int type = arg->type;
-    struct addrinfo hints, *res;
-    int fd, status;
-    char *syscall;
-
-    arg->remote.res = sock_addrinfo(arg->remote.host, arg->remote.serv, SOCK_STREAM,
-				    (type == INET_SERVER) ? AI_PASSIVE : 0);
-    /*
-     * Maybe also accept a local address
-     */
-
-    if (type != INET_SERVER && (!NIL_P(arg->local.host) || !NIL_P(arg->local.serv))) {
-	arg->local.res = sock_addrinfo(arg->local.host, arg->local.serv, SOCK_STREAM, 0);
-    }
-
-    arg->fd = fd = -1;
-    for (res = arg->remote.res; res; res = res->ai_next) {
-	status = ruby_socket(res->ai_family,res->ai_socktype,res->ai_protocol);
-	syscall = "socket(2)";
-	fd = status;
-	if (fd < 0) {
-	    continue;
-	}
-	arg->fd = fd;
-	if (type == INET_SERVER) {
-#ifndef NT
-	    status = 1;
-	    setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
-		       (char*)&status, sizeof(status));
-#endif
-	    status = bind(fd, res->ai_addr, res->ai_addrlen);
-	    syscall = "bind(2)";
-	}
-	else {
-	    if (arg->local.res) {
-		status = bind(fd, arg->local.res->ai_addr, arg->local.res->ai_addrlen);
-		syscall = "bind(2)";
-	    }
-
-	    if (status >= 0) {
-		status = ruby_connect(fd, res->ai_addr, res->ai_addrlen,
-				      (type == INET_SOCKS));
-		syscall = "connect(2)";
-	    }
-	}
-
-	if (status < 0) {
-	    close(fd);
-	    arg->fd = fd = -1;
-	    continue;
-	} else
-	    break;
-    }
-    if (status < 0) {
-	rb_sys_fail(syscall);
-    }
-
-    arg->fd = -1;
-
-    if (type == INET_SERVER)
-	listen(fd, 5);
-
-    /* create new instance */
-    return init_sock(arg->sock, fd);
-}
-
-static VALUE
-init_inetsock(sock, remote_host, remote_serv, local_host, local_serv, type)
-    VALUE sock, remote_host, remote_serv, local_host, local_serv;
-    int type;
-{
-    struct inetsock_arg arg;
-    arg.sock = sock;
-    arg.remote.host = remote_host;
-    arg.remote.serv = remote_serv;
-    arg.remote.res = 0;
-    arg.local.host = local_host;
-    arg.local.serv = local_serv;
-    arg.local.res = 0;
-    arg.type = type;
-    arg.fd = -1;
-    return rb_ensure(init_inetsock_internal, (VALUE)&arg,
-		     inetsock_cleanup, (VALUE)&arg);
-}
-
-static VALUE
-tcp_init(argc, argv, sock)
-     int argc;
-     VALUE *argv;
-     VALUE sock;
-{
-    VALUE remote_host, remote_serv;
-    VALUE local_host, local_serv;
-
-    int pcount = rb_scan_args(argc, argv, "22",
-			      &remote_host, &remote_serv,
-			      &local_host, &local_serv);
-
-    return init_inetsock(sock, remote_host, remote_serv,
-			 local_host, local_serv, INET_CLIENT);
-}
-
-#ifdef SOCKS
-static VALUE
-socks_init(sock, host, serv)
-    VALUE sock, host, serv;
-{
-    static init = 0;
-
-    if (init == 0) {
-	SOCKSinit("ruby");
-	init = 1;
-    }
-
-    return init_inetsock(class, host, serv, Qnil, Qnil, INET_SOCKS);
-}
-
-#ifdef SOCKS5
-static VALUE
-socks_s_close(sock)
-    VALUE sock;
-{
-    OpenFile *fptr;
-
-    if (rb_safe_level() >= 4 && !OBJ_TAINTED(sock)) {
-	rb_raise(rb_eSecurityError, "Insecure: can't close socket");
-    }
-    GetOpenFile(sock, fptr);
-    shutdown(fileno(fptr->f), 2);
-    shutdown(fileno(fptr->f2), 2);
-    return rb_io_close(sock);
-}
-#endif
-#endif
-
-/*
- * NOTE: using gethostbyname() against AF_INET6 is a bad idea, as it
- * does not initialize sin_flowinfo nor sin_scope_id properly.
- */
-
-struct hostent*
-sock_hostbyname(host)
-    VALUE host;
-{
-    struct sockaddr_storage addr;
-    struct hostent *h;
-
-    rb_secure(3);
-    setipaddr(host, &addr);
-    switch (addr.ss_family) {
-      case AF_INET:
-      {
-	struct sockaddr_in *sin;
-	sin = (struct sockaddr_in*)&addr;
-	h = gethostbyaddr((char*)&sin->sin_addr,
-			  sizeof(sin->sin_addr),
-			  sin->sin_family);
-	break;
-      }
-#ifdef INET6
-      case AF_INET6:
-      {
-	struct sockaddr_in6 *sin6;
-	sin6 = (struct sockaddr_in6*)&addr;
-	h = gethostbyaddr((char*)&sin6->sin6_addr,
-			  sizeof(sin6->sin6_addr),
-			  sin6->sin6_family);
-	break;
-      }
-#endif
-      default:
-	h = NULL;
-	break;
-    }
-
-    if (h == NULL) {
-#ifdef HAVE_HSTERROR
-	extern int h_errno;
-	rb_raise(rb_eSocket, "%s", (char*)hsterror(h_errno));
-#else
-	rb_raise(rb_eSocket, "host not found");
-#endif
-    }
-    return h;
-}
-
-static VALUE
-tcp_s_gethostbyname(obj, host)
-    VALUE obj, host;
-{
-    struct hostent *h = sock_hostbyname(host);
-    VALUE ary, names;
-    char **pch;
-    size_t size;
-
-    ary = rb_ary_new();
-    rb_ary_push(ary, rb_str_new2(h->h_name));
-    names = rb_ary_new();
-    rb_ary_push(ary, names);
-    for (pch = h->h_aliases; *pch; pch++) {
-	rb_ary_push(names, rb_str_new2(*pch));
-    }
-    rb_ary_push(ary, INT2NUM(h->h_addrtype));
-#ifdef h_addr
-    for (pch = h->h_addr_list; *pch; pch++) {
-	switch (h->h_length) {
-	  case 4: /* AF_INET */ {
-	    struct sockaddr_in sin;
-
-	    MEMZERO(&sin, struct sockaddr_in, 1);
-	    sin.sin_family = AF_INET;
-	    SET_SIN_LEN(&sin, sizeof(sin));
-	    memcpy((char*)&sin.sin_addr, *pch, h->h_length);
-	    rb_ary_push(ary, mkipaddr((struct sockaddr*)&sin));
-	    break;
-	  }
-#ifdef INET6
-	  case 8: /* AF_INET6 */ {
-	    struct sockaddr_in6 sin6;
-
-	    MEMZERO(&sin6, struct sockaddr_in6, 1);
-	    sin6.sin6_family = AF_INET6;
-#ifdef SIN6_LEN
-	    sin6.sin6_len = sizeof(sin6);
-#endif
-	    memcpy((char*)&sin6.sin6_addr, *pch, size);
-	    rb_ary_push(ary, mkipaddr((struct sockaddr*)&sin6));
-	    break;
-	  }
-#endif
-	  default:
-	    break;
-	}
-    }
-#else
-    memcpy((char*)&addr.sin_addr, h->h_addr, h->h_length);
-    rb_ary_push(ary, mkipaddr((struct sockaddr*)&addr));
-#endif
-
-    return ary;
-}
-
-static VALUE
-tcp_svr_init(argc, argv, sock)
-    int argc;
-    VALUE *argv;
-    VALUE sock;
-{
-    VALUE arg1, arg2;
-
-    if (rb_scan_args(argc, argv, "11", &arg1, &arg2) == 2)
-	return init_inetsock(sock, arg1, arg2, NULL, Qnil, INET_SERVER);
-    else
-	return init_inetsock(sock, Qnil, arg1, NULL, Qnil, INET_SERVER);
-}
-
-static VALUE
-s_accept(klass, fd, sockaddr, len)
-    VALUE klass;
-    int fd;
-    struct sockaddr *sockaddr;
-    socklen_t *len;
-{
-    int fd2;
-    int retry = 0;
-
-    rb_secure(3);
-  retry:
-    rb_thread_wait_fd(fd);
-#if defined(_nec_ews)
-    fd2 = accept(fd, sockaddr, len);
-#else
-    TRAP_BEG;
-    fd2 = accept(fd, sockaddr, len);
-    TRAP_END;
-#endif
-    if (fd2 < 0) {
-	switch (errno) {
-	  case EMFILE:
-	  case ENFILE:
-	    if (retry) break;
-	    rb_gc();
-	    retry = 1;
-	    goto retry;
-	  case EINTR:
-	    rb_thread_schedule();
-	    goto retry;
-	}
-	rb_sys_fail(0);
-    }
-    if (!klass) return INT2NUM(fd2);
-    return init_sock(rb_obj_alloc(klass), fd2);
-}
-
-static VALUE
-tcp_accept(sock)
-    VALUE sock;
-{
-    OpenFile *fptr;
-    struct sockaddr_storage from;
-    socklen_t fromlen;
-
-    GetOpenFile(sock, fptr);
-    fromlen = sizeof(from);
-    return s_accept(rb_cTCPSocket, fileno(fptr->f),
-		    (struct sockaddr*)&from, &fromlen);
-}
-
-static VALUE
-tcp_sysaccept(sock)
-    VALUE sock;
-{
-    OpenFile *fptr;
-    struct sockaddr_storage from;
-    socklen_t fromlen;
-
-    GetOpenFile(sock, fptr);
-    fromlen = sizeof(from);
-    return s_accept(0, fileno(fptr->f), (struct sockaddr*)&from, &fromlen);
-}
-
-#ifdef HAVE_SYS_UN_H
-struct unixsock_arg {
-    struct sockaddr_un *sockaddr;
-    int fd;
-};
-
-static VALUE
-unixsock_connect_internal(arg)
-    struct unixsock_arg *arg;
-{
-    return (VALUE)ruby_connect(arg->fd, arg->sockaddr, sizeof(*arg->sockaddr),
-			       0);
-}
-
-static VALUE
-init_unixsock(sock, path, server)
-    VALUE sock;
-    VALUE path;
-    int server;
-{
-    struct sockaddr_un sockaddr;
-    int fd, status;
-    OpenFile *fptr;
-
-    SafeStringValue(path);
-    fd = ruby_socket(AF_UNIX, SOCK_STREAM, 0);
-    if (fd < 0) {
-	rb_sys_fail("socket(2)");
-    }
-
-    MEMZERO(&sockaddr, struct sockaddr_un, 1);
-    sockaddr.sun_family = AF_UNIX;
-    strncpy(sockaddr.sun_path, RSTRING(path)->ptr, sizeof(sockaddr.sun_path)-1);
-    sockaddr.sun_path[sizeof(sockaddr.sun_path)-1] = '\0';
-
-    if (server) {
-        status = bind(fd, (struct sockaddr*)&sockaddr, sizeof(sockaddr));
-    }
-    else {
-	int prot;
-	struct unixsock_arg arg;
-	arg.sockaddr = &sockaddr;
-	arg.fd = fd;
-        status = rb_protect(unixsock_connect_internal, (VALUE)&arg, &prot);
-	if (prot) {
-	    close(fd);
-	    rb_jump_tag(prot);
-	}
-    }
-
-    if (status < 0) {
-	close(fd);
-	rb_sys_fail(sockaddr.sun_path);
-    }
-
-    if (server) listen(fd, 5);
-
-    init_sock(sock, fd);
-    GetOpenFile(sock, fptr);
-    fptr->path = strdup(RSTRING(path)->ptr);
-
-    return sock;
-}
-#endif
-
-static VALUE
-ip_addr(sock)
-    VALUE sock;
-{
-    OpenFile *fptr;
-    struct sockaddr_storage addr;
-    socklen_t len = sizeof addr;
-
-    GetOpenFile(sock, fptr);
-
-    if (getsockname(fileno(fptr->f), (struct sockaddr*)&addr, &len) < 0)
-	rb_sys_fail("getsockname(2)");
-    return ipaddr((struct sockaddr*)&addr);
-}
-
-static VALUE
-ip_peeraddr(sock)
-    VALUE sock;
-{
-    OpenFile *fptr;
-    struct sockaddr_storage addr;
-    socklen_t len = sizeof addr;
-
-    GetOpenFile(sock, fptr);
-
-    if (getpeername(fileno(fptr->f), (struct sockaddr*)&addr, &len) < 0)
-	rb_sys_fail("getpeername(2)");
-    return ipaddr((struct sockaddr*)&addr);
-}
-
-static VALUE
-ip_recvfrom(argc, argv, sock)
-    int argc;
-    VALUE *argv;
-    VALUE sock;
-{
-    return s_recvfrom(sock, argc, argv, RECV_IP);
-}
-
-static VALUE
-ip_s_getaddress(obj, host)
-    VALUE obj, host;
-{
-    struct sockaddr_storage addr;
-
-    setipaddr(host, &addr);
-    return mkipaddr((struct sockaddr*)&addr);
-}
-
-static VALUE
-udp_init(argc, argv, sock)
-    int argc;
-    VALUE *argv;
-    VALUE sock;
-{
-    VALUE arg;
-    int socktype = AF_INET;
-    int fd;
-
-    rb_secure(3);
-    if (rb_scan_args(argc, argv, "01", &arg) == 1) {
-	socktype = NUM2INT(arg);
-    }
-    fd = ruby_socket(socktype, SOCK_DGRAM, 0);
-    if (fd < 0) {
-	rb_sys_fail("socket(2) - udp");
-    }
-
-    return init_sock(sock, fd);
-}
-
-struct udp_arg
-{
-    struct addrinfo *res;
-    int fd;
-};
-
-static VALUE
-udp_connect_internal(arg)
-    struct udp_arg *arg;
-{
-    int fd = arg->fd;
-    struct addrinfo *res;
-
-    for (res = arg->res; res; res = res->ai_next) {
-	if (ruby_connect(fd, res->ai_addr, res->ai_addrlen, 0) >= 0) {
-	    return Qtrue;
-	}
-    }
-    return Qfalse;
-}
-
-static VALUE
-udp_connect(sock, host, port)
-    VALUE sock, host, port;
-{
-    OpenFile *fptr;
-    int fd;
-    struct udp_arg arg;
-    VALUE ret;
-
-    rb_secure(3);
-    GetOpenFile(sock, fptr);
-    arg.res = sock_addrinfo(host, port, SOCK_DGRAM, 0);
-    arg.fd = fileno(fptr->f);
-    ret = rb_ensure(udp_connect_internal, (VALUE)&arg,
-		    RUBY_METHOD_FUNC(freeaddrinfo), (VALUE)arg.res);
-    if (!ret) rb_sys_fail("connect(2)");
-    return INT2FIX(0);
-}
-
-static VALUE
-udp_bind(sock, host, port)
-    VALUE sock, host, port;
-{
-    OpenFile *fptr;
-    struct addrinfo *res0, *res;
-
-    rb_secure(3);
-    GetOpenFile(sock, fptr);
-    res0 = sock_addrinfo(host, port, SOCK_DGRAM, 0);
-    for (res = res0; res; res = res->ai_next) {
-	if (bind(fileno(fptr->f), res->ai_addr, res->ai_addrlen) < 0) {
-	    continue;
-	}
-	freeaddrinfo(res0);
-	return INT2FIX(0);
-    }
-    freeaddrinfo(res0);
-    rb_sys_fail("bind(2)");
-    return INT2FIX(0);
-}
-
-static VALUE
-udp_send(argc, argv, sock)
-    int argc;
-    VALUE *argv;
-    VALUE sock;
-{
-    VALUE mesg, flags, host, port;
-    OpenFile *fptr;
-    FILE *f;
-    int n;
-    struct addrinfo *res0, *res;
-
-    if (argc == 2 || argc == 3) {
-	return bsock_send(argc, argv, sock);
-    }
-    rb_secure(4);
-    rb_scan_args(argc, argv, "4", &mesg, &flags, &host, &port);
-
-    GetOpenFile(sock, fptr);
-    res0 = sock_addrinfo(host, port, SOCK_DGRAM, 0);
-    f = GetWriteFile(fptr);
-    StringValue(mesg);
-    for (res = res0; res; res = res->ai_next) {
-      retry:
-	n = sendto(fileno(f), RSTRING(mesg)->ptr, RSTRING(mesg)->len, NUM2INT(flags),
-		   res->ai_addr, res->ai_addrlen);
-	if (n >= 0) {
-	    freeaddrinfo(res0);
-	    return INT2FIX(n);
-	}
-	switch (errno) {
-	  case EINTR:
-	    rb_thread_schedule();
-	    goto retry;
-	}
-    }
-    freeaddrinfo(res0);
-    rb_sys_fail("sendto(2)");
-    return INT2FIX(n);
-}
-
-#ifdef HAVE_SYS_UN_H
-static VALUE
-unix_init(sock, path)
-    VALUE sock, path;
-{
-    return init_unixsock(sock, path, 0);
-}
-
-static VALUE
-unix_path(sock)
-    VALUE sock;
-{
-    OpenFile *fptr;
-
-    GetOpenFile(sock, fptr);
-    if (fptr->path == 0) {
-	struct sockaddr_un addr;
-	socklen_t len = sizeof(addr);
-	if (getsockname(fileno(fptr->f), (struct sockaddr*)&addr, &len) < 0)
-	    rb_sys_fail(0);
-	fptr->path = strdup(addr.sun_path);
-    }
-    return rb_str_new2(fptr->path);
-}
-
-static VALUE
-unix_svr_s_open(klass, path)
-    VALUE klass, path;
-{
-    return init_unixsock(rb_obj_alloc(klass), path, 1);
-}
-
-static VALUE
-unix_svr_init(sock, path)
-    VALUE sock, path;
-{
-    return init_unixsock(sock, path, 1);
-}
-
-static VALUE
-unix_recvfrom(argc, argv, sock)
-    int argc;
-    VALUE *argv;
-    VALUE sock;
-{
-    return s_recvfrom(sock, argc, argv, RECV_UNIX);
-}
-
-static VALUE
-unix_send_io(sock, val)
-    VALUE sock, val;
-{
-#if defined(HAVE_ST_MSG_CONTROL) || defined(HAVE_ST_MSG_ACCRIGHTS)
-    int fd;
-    OpenFile *fptr;
-    struct msghdr msg;
-    struct iovec vec[1];
-    char buf[1];
-
-#if defined(HAVE_ST_MSG_CONTROL)
-    struct {
-	struct cmsghdr hdr;
-	int fd;
-    } cmsg;
-#endif
-
-    if (rb_obj_is_kind_of(val, rb_cIO)) {
-        OpenFile *valfptr;
-	GetOpenFile(val, valfptr);
-	fd = fileno(valfptr->f);
-    }
-    else if (FIXNUM_P(val)) {
-        fd = FIX2INT(val);
-    }
-    else {
-	rb_raise(rb_eTypeError, "IO nor file descriptor");
-    }
-
-    GetOpenFile(sock, fptr);
-
-    msg.msg_name = NULL;
-    msg.msg_namelen = 0;
-
-    /* Linux and Solaris doesn't work if msg_iov is NULL. */
-    buf[0] = '\0';
-    vec[0].iov_base = buf;
-    vec[0].iov_len = 1;
-    msg.msg_iov = vec;
-    msg.msg_iovlen = 1;
-
-#if defined(HAVE_ST_MSG_CONTROL)
-    msg.msg_control = (caddr_t)&cmsg;
-    msg.msg_controllen = sizeof(struct cmsghdr) + sizeof(int);
-    msg.msg_flags = 0;
-    cmsg.hdr.cmsg_len = sizeof(struct cmsghdr) + sizeof(int);
-    cmsg.hdr.cmsg_level = SOL_SOCKET;
-    cmsg.hdr.cmsg_type = SCM_RIGHTS;
-    cmsg.fd = fd;
-#else
-    msg.msg_accrights = (caddr_t)&fd;
-    msg.msg_accrightslen = sizeof(fd);
-#endif
-
-    if (sendmsg(fileno(fptr->f), &msg, 0) == -1)
-	rb_sys_fail("sendmsg(2)");
-
-    return Qnil;
-#else
-    rb_notimplement();
-#endif
-}
-
-static VALUE
-unix_recv_io(argc, argv, sock)
-    int argc;
-    VALUE *argv;
-    VALUE sock;
-{
-#if defined(HAVE_ST_MSG_CONTROL) || defined(HAVE_ST_MSG_ACCRIGHTS)
-    VALUE klass, mode;
-    OpenFile *fptr;
-    struct msghdr msg;
-    struct iovec vec[2];
-    char buf[1];
-
-    int fd;
-#if defined(HAVE_ST_MSG_CONTROL)
-    struct {
-	struct cmsghdr hdr;
-	int fd;
-    } cmsg;
-#endif
-
-    rb_scan_args(argc, argv, "02", &klass, &mode);
-    if (argc == 0)
-	klass = rb_cIO;
-    if (argc <= 1)
-	mode = Qnil;
-
-    GetOpenFile(sock, fptr);
-
-    thread_read_select(fileno(fptr->f));
-
-    msg.msg_name = NULL;
-    msg.msg_namelen = 0;
-
-    vec[0].iov_base = buf;
-    vec[0].iov_len = sizeof(buf);
-    msg.msg_iov = vec;
-    msg.msg_iovlen = 1;
-
-#if defined(HAVE_ST_MSG_CONTROL)
-    msg.msg_control = (caddr_t)&cmsg;
-    msg.msg_controllen = sizeof(struct cmsghdr) + sizeof(int);
-    msg.msg_flags = 0;
-    cmsg.hdr.cmsg_len = sizeof(struct cmsghdr) + sizeof(int);
-    cmsg.hdr.cmsg_level = SOL_SOCKET;
-    cmsg.hdr.cmsg_type = SCM_RIGHTS;
-    cmsg.fd = -1;
-#else
-    msg.msg_accrights = (caddr_t)&fd;
-    msg.msg_accrightslen = sizeof(fd);
-    fd = -1;
-#endif
-
-    if (recvmsg(fileno(fptr->f), &msg, 0) == -1)
-	rb_sys_fail("recvmsg(2)");
-
-    if (
-#if defined(HAVE_ST_MSG_CONTROL)
-	msg.msg_controllen != sizeof(struct cmsghdr) + sizeof(int) ||
-        cmsg.hdr.cmsg_len != sizeof(struct cmsghdr) + sizeof(int) ||
-	cmsg.hdr.cmsg_level != SOL_SOCKET ||
-	cmsg.hdr.cmsg_type != SCM_RIGHTS
-#else
-        msg.msg_accrightslen != sizeof(fd)
-#endif
-	) {
-	rb_raise(rb_eSocket, "File descriptor was not passed");
-    }
-
-#if defined(HAVE_ST_MSG_CONTROL)
-    fd = cmsg.fd;
-#endif
-
-    if (klass == Qnil)
-	return INT2FIX(fd);
-    else {
-	static ID for_fd = 0;
-	int ff_argc;
-	VALUE ff_argv[2];
-	if (!for_fd)
-	    for_fd = rb_intern("for_fd");
-	ff_argc = mode == Qnil ? 1 : 2;
-	ff_argv[0] = INT2FIX(fd);
-	ff_argv[1] = mode;
-        return rb_funcall2(klass, for_fd, ff_argc, ff_argv);
-    }
-#else
-    rb_notimplement();
-#endif
-}
-
-static VALUE
-unix_accept(sock)
-    VALUE sock;
-{
-    OpenFile *fptr;
-    struct sockaddr_un from;
-    socklen_t fromlen;
-
-    GetOpenFile(sock, fptr);
-    fromlen = sizeof(struct sockaddr_un);
-    return s_accept(rb_cUNIXSocket, fileno(fptr->f),
-		    (struct sockaddr*)&from, &fromlen);
-}
-
-static VALUE
-unix_sysaccept(sock)
-    VALUE sock;
-{
-    OpenFile *fptr;
-    struct sockaddr_un from;
-    socklen_t fromlen;
-
-    GetOpenFile(sock, fptr);
-    fromlen = sizeof(struct sockaddr_un);
-    return s_accept(0, fileno(fptr->f), (struct sockaddr*)&from, &fromlen);
-}
-
-static VALUE
-unixaddr(sockaddr)
-    struct sockaddr_un *sockaddr;
-{
-    return rb_assoc_new(rb_str_new2("AF_UNIX"),
-			rb_str_new2(sockaddr->sun_path));
-}
-
-static VALUE
-unix_addr(sock)
-    VALUE sock;
-{
-    OpenFile *fptr;
-    struct sockaddr_un addr;
-    socklen_t len = sizeof addr;
-
-    GetOpenFile(sock, fptr);
-
-    if (getsockname(fileno(fptr->f), (struct sockaddr*)&addr, &len) < 0)
-	rb_sys_fail("getsockname(2)");
-    if (len == 0)
-        addr.sun_path[0] = '\0';
-    return unixaddr(&addr);
-}
-
-static VALUE
-unix_peeraddr(sock)
-    VALUE sock;
-{
-    OpenFile *fptr;
-    struct sockaddr_un addr;
-    socklen_t len = sizeof addr;
-
-    GetOpenFile(sock, fptr);
-
-    if (getpeername(fileno(fptr->f), (struct sockaddr*)&addr, &len) < 0)
-	rb_sys_fail("getsockname(2)");
-    if (len == 0)
-        addr.sun_path[0] = '\0';
-    return unixaddr(&addr);
-}
-#endif
-
-static void
-setup_domain_and_type(domain, dv, type, tv)
-    VALUE domain, type;
-    int *dv, *tv;
-{
-    char *ptr;
-
-    if (TYPE(domain) == T_STRING) {
-	SafeStringValue(domain);
-	ptr = RSTRING(domain)->ptr;
-	if (strcmp(ptr, "AF_INET") == 0)
-	    *dv = AF_INET;
-#ifdef AF_UNIX
-	else if (strcmp(ptr, "AF_UNIX") == 0)
-	    *dv = AF_UNIX;
-#endif
-#ifdef AF_ISO
-	else if (strcmp(ptr, "AF_ISO") == 0)
-	    *dv = AF_ISO;
-#endif
-#ifdef AF_NS
-	else if (strcmp(ptr, "AF_NS") == 0)
-	    *dv = AF_NS;
-#endif
-#ifdef AF_IMPLINK
-	else if (strcmp(ptr, "AF_IMPLINK") == 0)
-	    *dv = AF_IMPLINK;
-#endif
-#ifdef PF_INET
-	else if (strcmp(ptr, "PF_INET") == 0)
-	    *dv = PF_INET;
-#endif
-#ifdef PF_UNIX
-	else if (strcmp(ptr, "PF_UNIX") == 0)
-	    *dv = PF_UNIX;
-#endif
-#ifdef PF_IMPLINK
-	else if (strcmp(ptr, "PF_IMPLINK") == 0)
-	    *dv = PF_IMPLINK;
-	else if (strcmp(ptr, "AF_IMPLINK") == 0)
-	    *dv = AF_IMPLINK;
-#endif
-#ifdef PF_AX25
-	else if (strcmp(ptr, "PF_AX25") == 0)
-	    *dv = PF_AX25;
-#endif
-#ifdef PF_IPX
-	else if (strcmp(ptr, "PF_IPX") == 0)
-	    *dv = PF_IPX;
-#endif
-	else
-	    rb_raise(rb_eSocket, "Unknown socket domain %s", ptr);
-    }
-    else {
-	*dv = NUM2INT(domain);
-    }
-    if (TYPE(type) == T_STRING) {
-	SafeStringValue(type);
-	ptr = RSTRING(type)->ptr;
-	if (strcmp(ptr, "SOCK_STREAM") == 0)
-	    *tv = SOCK_STREAM;
-	else if (strcmp(ptr, "SOCK_DGRAM") == 0)
-	    *tv = SOCK_DGRAM;
-#ifdef SOCK_RAW
-	else if (strcmp(ptr, "SOCK_RAW") == 0)
-	    *tv = SOCK_RAW;
-#endif
-#ifdef SOCK_SEQPACKET
-	else if (strcmp(ptr, "SOCK_SEQPACKET") == 0)
-	    *tv = SOCK_SEQPACKET;
-#endif
-#ifdef SOCK_RDM
-	else if (strcmp(ptr, "SOCK_RDM") == 0)
-	    *tv = SOCK_RDM;
-#endif
-#ifdef SOCK_PACKET
-	else if (strcmp(ptr, "SOCK_PACKET") == 0)
-	    *tv = SOCK_PACKET;
-#endif
-	else
-	    rb_raise(rb_eSocket, "Unknown socket type %s", ptr);
-    }
-    else {
-	*tv = NUM2INT(type);
-    }
-}
-
-static VALUE
-sock_init(sock, domain, type, protocol)
-    VALUE sock, domain, type, protocol;
-{
-    int fd;
-    int d, t;
-
-    rb_secure(3);
-    setup_domain_and_type(domain, &d, type, &t);
-    fd = ruby_socket(d, t, NUM2INT(protocol));
-    if (fd < 0) rb_sys_fail("socket(2)");
-
-    return init_sock(sock, fd);
-}
-
-static VALUE
-sock_s_socketpair(klass, domain, type, protocol)
-    VALUE klass, domain, type, protocol;
-{
-#if !defined(NT) && !defined(__BEOS__) && !defined(__EMX__) && !defined(__QNXNTO__)
-    int d, t, sp[2];
-
-    setup_domain_and_type(domain, &d, type, &t);
-  again:
-    if (socketpair(d, t, NUM2INT(protocol), sp) < 0) {
-	if (errno == EMFILE || errno == ENFILE) {
-	    rb_gc();
-	    goto again;
-	}
-	rb_sys_fail("socketpair(2)");
-    }
-
-    return rb_assoc_new(init_sock(rb_obj_alloc(klass), sp[0]),
-			init_sock(rb_obj_alloc(klass), sp[1]));
-#else
-    rb_notimplement();
-#endif
-}
-
-#ifdef HAVE_SYS_UN_H
-static VALUE
-unix_s_socketpair(argc, argv, klass)
-    int argc;
-    VALUE *argv;
-    VALUE klass;
-{
-    VALUE domain, type, protocol;
-    domain = INT2FIX(PF_UNIX);
-
-    rb_scan_args(argc, argv, "02", &type, &protocol);
-    if (argc == 0)
-	type = INT2FIX(SOCK_STREAM);
-    if (argc <= 1)
-	protocol = INT2FIX(0);
-
-    return sock_s_socketpair(klass, domain, type, protocol);
-}
-#endif
-
-static VALUE
-sock_connect(sock, addr)
-    VALUE sock, addr;
-{
-    OpenFile *fptr;
-    int fd;
-
-    StringValue(addr);
-    rb_str_modify(addr);
-
-    GetOpenFile(sock, fptr);
-    fd = fileno(fptr->f);
-    if (ruby_connect(fd, (struct sockaddr*)RSTRING(addr)->ptr, RSTRING(addr)->len, 0) < 0) {
-	rb_sys_fail("connect(2)");
-    }
-
-    return INT2FIX(0);
-}
-
-static VALUE
-sock_bind(sock, addr)
-    VALUE sock, addr;
-{
-    OpenFile *fptr;
-
-    StringValue(addr);
-    rb_str_modify(addr);
-
-    GetOpenFile(sock, fptr);
-    if (bind(fileno(fptr->f), (struct sockaddr*)RSTRING(addr)->ptr, RSTRING(addr)->len) < 0)
-	rb_sys_fail("bind(2)");
-
-    return INT2FIX(0);
-}
-
-static VALUE
-sock_listen(sock, log)
-   VALUE sock, log;
-{
-    OpenFile *fptr;
-
-    rb_secure(4);
-    GetOpenFile(sock, fptr);
-    if (listen(fileno(fptr->f), NUM2INT(log)) < 0)
-	rb_sys_fail("listen(2)");
-
-    return INT2FIX(0);
-}
-
-static VALUE
-sock_recvfrom(argc, argv, sock)
-    int argc;
-    VALUE *argv;
-    VALUE sock;
-{
-    return s_recvfrom(sock, argc, argv, RECV_SOCKET);
-}
-
-static VALUE
-sock_accept(sock)
-   VALUE sock;
-{
-    OpenFile *fptr;
-    VALUE sock2;
-    char buf[1024];
-    socklen_t len = sizeof buf;
-
-    GetOpenFile(sock, fptr);
-    sock2 = s_accept(rb_cSocket,fileno(fptr->f),(struct sockaddr*)buf,&len);
-
-    return rb_assoc_new(sock2, rb_str_new(buf, len));
-}
-
-static VALUE
-sock_sysaccept(sock)
-   VALUE sock;
-{
-    OpenFile *fptr;
-    VALUE sock2;
-    char buf[1024];
-    socklen_t len = sizeof buf;
-
-    GetOpenFile(sock, fptr);
-    sock2 = s_accept(0,fileno(fptr->f),(struct sockaddr*)buf,&len);
-
-    return rb_assoc_new(sock2, rb_str_new(buf, len));
-}
-
-#ifdef HAVE_GETHOSTNAME
-static VALUE
-sock_gethostname(obj)
-    VALUE obj;
-{
-    char buf[1024];
-
-    rb_secure(3);
-    if (gethostname(buf, (int)sizeof buf - 1) < 0)
-	rb_sys_fail("gethostname");
-
-    buf[sizeof buf - 1] = '\0';
-    return rb_str_new2(buf);
-}
-#else
-#ifdef HAVE_UNAME
-
-#include 
-
-static VALUE
-sock_gethostname(obj)
-    VALUE obj;
-{
-    struct utsname un;
-
-    rb_secure(3);
-    uname(&un);
-    return rb_str_new2(un.nodename);
-}
-#else
-static VALUE
-sock_gethostname(obj)
-    VALUE obj;
-{
-    rb_notimplement();
-}
-#endif
-#endif
-
-static VALUE
-sock_mkhostent(h)
-    struct hostent *h;
-{
-    char **pch;
-    VALUE ary, names;
-
-    if (h == NULL) {
-#ifdef HAVE_HSTRERROR
-	extern int h_errno;
-	rb_raise(rb_eSocket, "%s", (char*)hstrerror(h_errno));
-#else
-	rb_raise(rb_eSocket, "host not found");
-#endif
-    }
-    ary = rb_ary_new();
-    rb_ary_push(ary, rb_str_new2(h->h_name));
-    names = rb_ary_new();
-    rb_ary_push(ary, names);
-    for (pch = h->h_aliases; *pch; pch++) {
-	rb_ary_push(names, rb_str_new2(*pch));
-    }
-    rb_ary_push(ary, INT2NUM(h->h_addrtype));
-#ifdef h_addr
-    for (pch = h->h_addr_list; *pch; pch++) {
-	rb_ary_push(ary, rb_str_new(*pch, h->h_length));
-    }
-#else
-    rb_ary_push(ary, rb_str_new(h->h_addr, h->h_length));
-#endif
-
-    return ary;
-}
-
-static VALUE
-mkaddrinfo(res0)
-    struct addrinfo *res0;
-{
-    VALUE base, ary;
-    struct addrinfo *res;
-
-    if (res0 == NULL) {
-	rb_raise(rb_eSocket, "host not found");
-    }
-    base = rb_ary_new();
-    for (res = res0; res; res = res->ai_next) {
-	ary = ipaddr(res->ai_addr);
-	rb_ary_push(ary, INT2FIX(res->ai_family));
-	rb_ary_push(ary, INT2FIX(res->ai_socktype));
-	rb_ary_push(ary, INT2FIX(res->ai_protocol));
-	rb_ary_push(base, ary);
-    }
-    return base;
-}
-
-static VALUE
-sock_s_gethostbyname(obj, host)
-    VALUE obj, host;
-{
-    return sock_mkhostent(sock_hostbyname(host));
-}
-
-static VALUE
-sock_s_gethostbyaddr(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE addr, type;
-    struct hostent *h;
-    struct sockaddr *sa;
-    int t = AF_INET;
-
-    rb_scan_args(argc, argv, "11", &addr, &type);
-    sa = (struct sockaddr*)StringValuePtr(addr);
-    if (!NIL_P(type)) {
-	t = NUM2INT(type);
-    }
-#ifdef INET6
-    else if (RSTRING(addr)->len == 16) {
-	t = AF_INET6;
-    }
-#endif
-    h = gethostbyaddr(RSTRING(addr)->ptr, RSTRING(addr)->len, t);
-
-    return sock_mkhostent(h);
-}
-
-static VALUE
-sock_s_getservbyaname(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE service, protocol;
-    char *proto;
-    struct servent *sp;
-    int port;
-
-    rb_scan_args(argc, argv, "11", &service, &protocol);
-    if (NIL_P(protocol)) proto = "tcp";
-    else proto = StringValuePtr(protocol);
-
-    StringValue(service);
-    sp = getservbyname(RSTRING(service)->ptr, proto);
-    if (sp) {
-	port = ntohs(sp->s_port);
-    }
-    else {
-	char *s = RSTRING(service)->ptr;
-	char *end;
-
-	port = strtoul(s, &end, 0);
-	if (*end != '\0') {
-	    rb_raise(rb_eSocket, "no such service %s/%s", s, proto);
-	}
-    }
-    return INT2FIX(port);
-}
-
-static VALUE
-sock_s_getaddrinfo(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE host, port, family, socktype, protocol, flags, ret;
-    char hbuf[1024], pbuf[1024];
-    char *hptr, *pptr;
-    struct addrinfo hints, *res;
-    int error;
-
-    host = port = family = socktype = protocol = flags = Qnil;
-    rb_scan_args(argc, argv, "24", &host, &port, &family, &socktype, &protocol, &flags);
-    if (NIL_P(host)) {
-	hptr = NULL;
-    }
-    else {
-	strncpy(hbuf, StringValuePtr(host), sizeof(hbuf));
-	hbuf[sizeof(hbuf) - 1] = '\0';
-	hptr = hbuf;
-    }
-    if (NIL_P(port)) {
-	pptr = NULL;
-    }
-    else if (FIXNUM_P(port)) {
-	snprintf(pbuf, sizeof(pbuf), "%ld", FIX2INT(port));
-	pptr = pbuf;
-    }
-    else {
-	strncpy(pbuf, StringValuePtr(port), sizeof(pbuf));
-	pbuf[sizeof(pbuf) - 1] = '\0';
-	pptr = pbuf;
-    }
-
-    MEMZERO(&hints, struct addrinfo, 1);
-    if (NIL_P(family)) {
-	hints.ai_family = PF_UNSPEC;
-    }
-    else if (FIXNUM_P(family)) {
-	hints.ai_family = FIX2INT(family);
-    }
-    else {
-	StringValue(family);
-	if (strcmp(RSTRING(family)->ptr, "AF_INET") == 0) {
-	    hints.ai_family = PF_INET;
-	}
-#ifdef INET6
-	else if (strcmp(RSTRING(family)->ptr, "AF_INET6") == 0) {
-	    hints.ai_family = PF_INET6;
-	}
-#endif
-    }
-
-    if (!NIL_P(socktype)) {
-	hints.ai_socktype = NUM2INT(socktype);
-    }
-    if (!NIL_P(protocol)) {
-	hints.ai_protocol = NUM2INT(protocol);
-    }
-    if (!NIL_P(flags)) {
-	hints.ai_flags = NUM2INT(flags);
-    }
-    error = getaddrinfo(hptr, pptr, &hints, &res);
-    if (error) {
-	rb_raise(rb_eSocket, "getaddrinfo: %s", gai_strerror(error));
-    }
-
-    ret = mkaddrinfo(res);
-    freeaddrinfo(res);
-    return ret;
-}
-
-static VALUE
-sock_s_getnameinfo(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE sa, af = Qnil, host = Qnil, port = Qnil, flags;
-    char *hptr, *pptr;
-    char hbuf[1024], pbuf[1024];
-    int fl;
-    struct addrinfo hints, *res = NULL, *r;
-    int error;
-    struct sockaddr_storage ss;
-    struct sockaddr *sap;
-    char *ep;
-
-    sa = flags = Qnil;
-    rb_scan_args(argc, argv, "11", &sa, &flags);
-
-    fl = 0;
-    if (!NIL_P(flags)) {
-	fl = NUM2INT(flags);
-    }
-    if (TYPE(sa) == T_STRING) {
-	if (sizeof(ss) < RSTRING(sa)->len) {
-	    rb_raise(rb_eTypeError, "sockaddr length too big");
-	}
-	memcpy(&ss, RSTRING(sa)->ptr, RSTRING(sa)->len);
-	if (RSTRING(sa)->len != SA_LEN((struct sockaddr*)&ss)) {
-	    rb_raise(rb_eTypeError, "sockaddr size differs - should not happen");
-	}
-	sap = (struct sockaddr*)&ss;
-    }
-    else if (TYPE(sa) == T_ARRAY) {
-	MEMZERO(&hints, struct addrinfo, 1);
-	if (RARRAY(sa)->len == 3) {
-	    af = RARRAY(sa)->ptr[0];
-	    port = RARRAY(sa)->ptr[1];
-	    host = RARRAY(sa)->ptr[2];
-	}
-	else if (RARRAY(sa)->len >= 4) {
-	    af = RARRAY(sa)->ptr[0];
-	    port = RARRAY(sa)->ptr[1];
-	    host = RARRAY(sa)->ptr[3];
-	    if (NIL_P(host)) {
-		host = RARRAY(sa)->ptr[2];
-	    }
-	    else {
-		/*
-		 * 4th element holds numeric form, don't resolve.
-		 * see ipaddr().
-		 */
-		hints.ai_flags |= AI_NUMERICHOST;
-	    }
-	}
-	else {
-	    rb_raise(rb_eArgError, "array size should be 3 or 4, %d given",
-		     RARRAY(sa)->len);
-	}
-	/* host */
-	if (NIL_P(host)) {
-	    hptr = NULL;
-	}
-	else {
-	    strncpy(hbuf, StringValuePtr(host), sizeof(hbuf));
-	    hbuf[sizeof(hbuf) - 1] = '\0';
-	    hptr = hbuf;
-	}
-	/* port */
-	if (NIL_P(port)) {
-	    strcpy(pbuf, "0");
-	    pptr = NULL;
-	}
-	else if (FIXNUM_P(port)) {
-	    snprintf(pbuf, sizeof(pbuf), "%ld", NUM2INT(port));
-	    pptr = pbuf;
-	}
-	else {
-	    strncpy(pbuf, StringValuePtr(port), sizeof(pbuf));
-	    pbuf[sizeof(pbuf) - 1] = '\0';
-	    pptr = pbuf;
-	}
-	hints.ai_socktype = (fl & NI_DGRAM) ? SOCK_DGRAM : SOCK_STREAM;
-	/* af */
-	if (NIL_P(af)) {
-	    hints.ai_family = PF_UNSPEC;
-	}
-	else if (FIXNUM_P(af)) {
-	    hints.ai_family = FIX2INT(af);
-	}
-	else {
-	    StringValue(af);
-	    if (strcmp(RSTRING(af)->ptr, "AF_INET") == 0) {
-		hints.ai_family = PF_INET;
-	    }
-#ifdef INET6
-	    else if (strcmp(RSTRING(af)->ptr, "AF_INET6") == 0) {
-		hints.ai_family = PF_INET6;
-	    }
-#endif
-	}
-	error = getaddrinfo(hptr, pptr, &hints, &res);
-	if (error) goto error_exit_addr;
-	sap = res->ai_addr;
-    }
-    else {
-	rb_raise(rb_eTypeError, "expecting String or Array");
-    }
-
-    error = getnameinfo(sap, SA_LEN(sap), hbuf, sizeof(hbuf),
-			pbuf, sizeof(pbuf), fl);
-    if (error) goto error_exit_name;
-    if (res) {
-	for (r = res->ai_next; r; r = r->ai_next) {
-	    char hbuf2[1024], pbuf2[1024];
-
-	    sap = r->ai_addr;
-	    error = getnameinfo(sap, SA_LEN(sap), hbuf2, sizeof(hbuf2),
-				pbuf2, sizeof(pbuf2), fl);
-	    if (error) goto error_exit_name;
-	    if (strcmp(hbuf, hbuf2) != 0|| strcmp(pbuf, pbuf2) != 0) {
-		freeaddrinfo(res);
-		rb_raise(rb_eSocket, "sockaddr resolved to multiple nodename");
-	    }
-	}
-	freeaddrinfo(res);
-    }
-    return rb_assoc_new(rb_str_new2(hbuf), rb_str_new2(pbuf));
-
-  error_exit_addr:
-    if (res) freeaddrinfo(res);
-    rb_raise(rb_eSocket, "getaddrinfo: %s", gai_strerror(error));
-
-  error_exit_name:
-    if (res) freeaddrinfo(res);
-    rb_raise(rb_eSocket, "getnameinfo: %s", gai_strerror(error));
-}
-
-static VALUE
-sock_s_pack_sockaddr_in(self, port, host)
-    VALUE self, port, host;
-{
-    struct addrinfo *res = sock_addrinfo(host, port, 0, 0);
-    VALUE addr = rb_str_new((char*)res->ai_addr, res->ai_addrlen);
-
-    freeaddrinfo(res);
-    OBJ_INFECT(addr, port);
-    OBJ_INFECT(addr, host);
-
-    return addr;
-}
-
-static VALUE
-sock_s_unpack_sockaddr_in(self, addr)
-    VALUE self, addr;
-{
-    struct sockaddr_in * sockaddr;
-    VALUE host;
-
-    sockaddr = (struct sockaddr_in*)StringValuePtr(addr);
-    if (RSTRING(addr)->len != sizeof(struct sockaddr_in)) {
-	rb_raise(rb_eTypeError, "sockaddr_in size differs - %d required; %d given",
-		 RSTRING(addr)->len, sizeof(struct sockaddr_in));
-    }
-    host = mkipaddr(sockaddr);
-    OBJ_INFECT(host, addr);
-    return rb_assoc_new(INT2NUM(ntohs(sockaddr->sin_port)), host);
-}
-
-#ifdef HAVE_SYS_UN_H
-static VALUE
-sock_s_pack_sockaddr_un(self, path)
-    VALUE self, path;
-{
-    struct sockaddr_un sockaddr;
-    VALUE addr;
-
-    MEMZERO(&sockaddr, struct sockaddr_un, 1);
-    sockaddr.sun_family = AF_UNIX;
-    strncpy(sockaddr.sun_path, StringValuePtr(path), sizeof(sockaddr.sun_path)-1);
-    addr = rb_str_new((char*)&sockaddr, sizeof(sockaddr));
-    OBJ_INFECT(addr, path);
-
-    return addr;
-}
-
-static VALUE
-sock_s_unpack_sockaddr_un(self, addr)
-    VALUE self, addr;
-{
-    struct sockaddr_un * sockaddr;
-    VALUE path;
-
-    sockaddr = (struct sockaddr_un*)StringValuePtr(addr);
-    if (RSTRING(addr)->len != sizeof(struct sockaddr_un)) {
-	rb_raise(rb_eTypeError, "sockaddr_un size differs - %d required; %d given",
-		 RSTRING(addr)->len, sizeof(struct sockaddr_un));
-    }
-    /* xxx: should I check against sun_path size? */
-    path = rb_str_new2(sockaddr->sun_path);
-    OBJ_INFECT(path, addr);
-    return path;
-}
-#endif
-
-static VALUE mConst;
-
-static void
-sock_define_const(name, value)
-    char *name;
-    int value;
-{
-    rb_define_const(rb_cSocket, name, INT2FIX(value));
-    rb_define_const(mConst, name, INT2FIX(value));
-}
-
-void
-Init_socket()
-{
-    rb_eSocket = rb_define_class("SocketError", rb_eStandardError);
-
-    rb_cBasicSocket = rb_define_class("BasicSocket", rb_cIO);
-    rb_undef_method(rb_cBasicSocket, "initialize");
-
-    rb_define_singleton_method(rb_cBasicSocket, "do_not_reverse_lookup",
-			       bsock_do_not_rev_lookup, 0);
-    rb_define_singleton_method(rb_cBasicSocket, "do_not_reverse_lookup=",
-			       bsock_do_not_rev_lookup_set, 1);
-    rb_define_singleton_method(rb_cBasicSocket, "for_fd", bsock_s_for_fd, 1);
-
-    rb_define_method(rb_cBasicSocket, "close_read", bsock_close_read, 0);
-    rb_define_method(rb_cBasicSocket, "close_write", bsock_close_write, 0);
-    rb_define_method(rb_cBasicSocket, "shutdown", bsock_shutdown, -1);
-    rb_define_method(rb_cBasicSocket, "setsockopt", bsock_setsockopt, 3);
-    rb_define_method(rb_cBasicSocket, "getsockopt", bsock_getsockopt, 2);
-    rb_define_method(rb_cBasicSocket, "getsockname", bsock_getsockname, 0);
-    rb_define_method(rb_cBasicSocket, "getpeername", bsock_getpeername, 0);
-    rb_define_method(rb_cBasicSocket, "send", bsock_send, -1);
-    rb_define_method(rb_cBasicSocket, "recv", bsock_recv, -1);
-
-    rb_cIPSocket = rb_define_class("IPSocket", rb_cBasicSocket);
-    rb_define_global_const("IPsocket", rb_cIPSocket);
-    rb_define_method(rb_cIPSocket, "addr", ip_addr, 0);
-    rb_define_method(rb_cIPSocket, "peeraddr", ip_peeraddr, 0);
-    rb_define_method(rb_cIPSocket, "recvfrom", ip_recvfrom, -1);
-    rb_define_singleton_method(rb_cIPSocket, "getaddress", ip_s_getaddress, 1);
-
-    rb_cTCPSocket = rb_define_class("TCPSocket", rb_cIPSocket);
-    rb_define_global_const("TCPsocket", rb_cTCPSocket);
-    rb_define_singleton_method(rb_cTCPSocket, "gethostbyname", tcp_s_gethostbyname, 1);
-    rb_define_method(rb_cTCPSocket, "initialize", tcp_init, -1);
-
-#ifdef SOCKS
-    rb_cSOCKSSocket = rb_define_class("SOCKSSocket", rb_cTCPSocket);
-    rb_define_global_const("SOCKSsocket", rb_cSOCKSSocket);
-    rb_define_method(rb_cSOCKSSocket, "initialize", socks_init, 2);
-#ifdef SOCKS5
-    rb_define_method(rb_cSOCKSSocket, "close", socks_s_close, 0);
-#endif
-#endif
-
-    rb_cTCPServer = rb_define_class("TCPServer", rb_cTCPSocket);
-    rb_define_global_const("TCPserver", rb_cTCPServer);
-    rb_define_method(rb_cTCPServer, "accept", tcp_accept, 0);
-    rb_define_method(rb_cTCPServer, "sysaccept", tcp_sysaccept, 0);
-    rb_define_method(rb_cTCPServer, "initialize", tcp_svr_init, -1);
-    rb_define_method(rb_cTCPServer, "listen", sock_listen, 1);
-
-    rb_cUDPSocket = rb_define_class("UDPSocket", rb_cIPSocket);
-    rb_define_global_const("UDPsocket", rb_cUDPSocket);
-    rb_define_method(rb_cUDPSocket, "initialize", udp_init, -1);
-    rb_define_method(rb_cUDPSocket, "connect", udp_connect, 2);
-    rb_define_method(rb_cUDPSocket, "bind", udp_bind, 2);
-    rb_define_method(rb_cUDPSocket, "send", udp_send, -1);
-
-#ifdef HAVE_SYS_UN_H
-    rb_cUNIXSocket = rb_define_class("UNIXSocket", rb_cBasicSocket);
-    rb_define_global_const("UNIXsocket", rb_cUNIXSocket);
-    rb_define_method(rb_cUNIXSocket, "initialize", unix_init, 1);
-    rb_define_method(rb_cUNIXSocket, "path", unix_path, 0);
-    rb_define_method(rb_cUNIXSocket, "addr", unix_addr, 0);
-    rb_define_method(rb_cUNIXSocket, "peeraddr", unix_peeraddr, 0);
-    rb_define_method(rb_cUNIXSocket, "recvfrom", unix_recvfrom, -1);
-    rb_define_method(rb_cUNIXSocket, "send_io", unix_send_io, 1);
-    rb_define_method(rb_cUNIXSocket, "recv_io", unix_recv_io, -1);
-    rb_define_singleton_method(rb_cUNIXSocket, "socketpair", unix_s_socketpair, -1);
-    rb_define_singleton_method(rb_cUNIXSocket, "pair", unix_s_socketpair, -1);
-
-    rb_cUNIXServer = rb_define_class("UNIXServer", rb_cUNIXSocket);
-    rb_define_global_const("UNIXserver", rb_cUNIXServer);
-    rb_define_method(rb_cUNIXServer, "initialize", unix_svr_init, 1);
-    rb_define_method(rb_cUNIXServer, "accept", unix_accept, 0);
-    rb_define_method(rb_cUNIXServer, "sysaccept", unix_sysaccept, 0);
-    rb_define_method(rb_cUNIXServer, "listen", sock_listen, 1);
-#endif
-
-    rb_cSocket = rb_define_class("Socket", rb_cBasicSocket);
-
-    rb_define_method(rb_cSocket, "initialize", sock_init, 3);
-    rb_define_method(rb_cSocket, "connect", sock_connect, 1);
-    rb_define_method(rb_cSocket, "bind", sock_bind, 1);
-    rb_define_method(rb_cSocket, "listen", sock_listen, 1);
-    rb_define_method(rb_cSocket, "accept", sock_accept, 0);
-    rb_define_method(rb_cSocket, "sysaccept", sock_sysaccept, 0);
-
-    rb_define_method(rb_cSocket, "recvfrom", sock_recvfrom, -1);
-
-    rb_define_singleton_method(rb_cSocket, "socketpair", sock_s_socketpair, 3);
-    rb_define_singleton_method(rb_cSocket, "pair", sock_s_socketpair, 3);
-    rb_define_singleton_method(rb_cSocket, "gethostname", sock_gethostname, 0);
-    rb_define_singleton_method(rb_cSocket, "gethostbyname", sock_s_gethostbyname, 1);
-    rb_define_singleton_method(rb_cSocket, "gethostbyaddr", sock_s_gethostbyaddr, -1);
-    rb_define_singleton_method(rb_cSocket, "getservbyname", sock_s_getservbyaname, -1);
-    rb_define_singleton_method(rb_cSocket, "getaddrinfo", sock_s_getaddrinfo, -1);
-    rb_define_singleton_method(rb_cSocket, "getnameinfo", sock_s_getnameinfo, -1);
-    rb_define_singleton_method(rb_cSocket, "sockaddr_in", sock_s_pack_sockaddr_in, 2);
-    rb_define_singleton_method(rb_cSocket, "pack_sockaddr_in", sock_s_pack_sockaddr_in, 2);
-    rb_define_singleton_method(rb_cSocket, "unpack_sockaddr_in", sock_s_unpack_sockaddr_in, 1);
-#ifdef HAVE_SYS_UN_H
-    rb_define_singleton_method(rb_cSocket, "sockaddr_un", sock_s_pack_sockaddr_un, 1);
-    rb_define_singleton_method(rb_cSocket, "pack_sockaddr_un", sock_s_pack_sockaddr_un, 1);
-    rb_define_singleton_method(rb_cSocket, "unpack_sockaddr_un", sock_s_unpack_sockaddr_un, 1);
-#endif
-
-    /* constants */
-    mConst = rb_define_module_under(rb_cSocket, "Constants");
-    sock_define_const("SOCK_STREAM", SOCK_STREAM);
-    sock_define_const("SOCK_DGRAM", SOCK_DGRAM);
-#ifdef SOCK_RAW
-    sock_define_const("SOCK_RAW", SOCK_RAW);
-#endif
-#ifdef SOCK_RDM
-    sock_define_const("SOCK_RDM", SOCK_RDM);
-#endif
-#ifdef SOCK_SEQPACKET
-    sock_define_const("SOCK_SEQPACKET", SOCK_SEQPACKET);
-#endif
-#ifdef SOCK_PACKET
-    sock_define_const("SOCK_PACKET", SOCK_PACKET);
-#endif
-
-    sock_define_const("AF_INET", AF_INET);
-#ifdef PF_INET
-    sock_define_const("PF_INET", PF_INET);
-#endif
-#ifdef AF_UNIX
-    sock_define_const("AF_UNIX", AF_UNIX);
-    sock_define_const("PF_UNIX", PF_UNIX);
-#endif
-#ifdef AF_AX25
-    sock_define_const("AF_AX25", AF_AX25);
-    sock_define_const("PF_AX25", PF_AX25);
-#endif
-#ifdef AF_IPX
-    sock_define_const("AF_IPX", AF_IPX);
-    sock_define_const("PF_IPX", PF_IPX);
-#endif
-#ifdef AF_APPLETALK
-    sock_define_const("AF_APPLETALK", AF_APPLETALK);
-    sock_define_const("PF_APPLETALK", PF_APPLETALK);
-#endif
-#ifdef AF_UNSPEC
-    sock_define_const("AF_UNSPEC", AF_UNSPEC);
-    sock_define_const("PF_UNSPEC", PF_UNSPEC);
-#endif
-#ifdef AF_INET6
-    sock_define_const("AF_INET6", AF_INET6);
-#endif
-#ifdef PF_INET6
-    sock_define_const("PF_INET6", PF_INET6);
-#endif
-
-    sock_define_const("MSG_OOB", MSG_OOB);
-#ifdef MSG_PEEK
-    sock_define_const("MSG_PEEK", MSG_PEEK);
-#endif
-#ifdef MSG_DONTROUTE
-    sock_define_const("MSG_DONTROUTE", MSG_DONTROUTE);
-#endif
-
-    sock_define_const("SOL_SOCKET", SOL_SOCKET);
-#ifdef SOL_IP
-    sock_define_const("SOL_IP", SOL_IP);
-#endif
-#ifdef SOL_IPX
-    sock_define_const("SOL_IPX", SOL_IPX);
-#endif
-#ifdef SOL_AX25
-    sock_define_const("SOL_AX25", SOL_AX25);
-#endif
-#ifdef SOL_ATALK
-    sock_define_const("SOL_ATALK", SOL_ATALK);
-#endif
-#ifdef SOL_TCP
-    sock_define_const("SOL_TCP", SOL_TCP);
-#endif
-#ifdef SOL_UDP
-    sock_define_const("SOL_UDP", SOL_UDP);
-#endif
-
-#ifdef	IPPROTO_IP
-    sock_define_const("IPPROTO_IP", IPPROTO_IP);
-#else
-    sock_define_const("IPPROTO_IP", 0);
-#endif
-#ifdef	IPPROTO_ICMP
-    sock_define_const("IPPROTO_ICMP", IPPROTO_ICMP);
-#else
-    sock_define_const("IPPROTO_ICMP", 1);
-#endif
-#ifdef	IPPROTO_IGMP
-    sock_define_const("IPPROTO_IGMP", IPPROTO_IGMP);
-#endif
-#ifdef	IPPROTO_GGP
-    sock_define_const("IPPROTO_GGP", IPPROTO_GGP);
-#endif
-#ifdef	IPPROTO_TCP
-    sock_define_const("IPPROTO_TCP", IPPROTO_TCP);
-#else
-    sock_define_const("IPPROTO_TCP", 6);
-#endif
-#ifdef	IPPROTO_EGP
-    sock_define_const("IPPROTO_EGP", IPPROTO_EGP);
-#endif
-#ifdef	IPPROTO_PUP
-    sock_define_const("IPPROTO_PUP", IPPROTO_PUP);
-#endif
-#ifdef	IPPROTO_UDP
-    sock_define_const("IPPROTO_UDP", IPPROTO_UDP);
-#else
-    sock_define_const("IPPROTO_UDP", 17);
-#endif
-#ifdef	IPPROTO_IDP
-    sock_define_const("IPPROTO_IDP", IPPROTO_IDP);
-#endif
-#ifdef	IPPROTO_HELLO
-    sock_define_const("IPPROTO_HELLO", IPPROTO_HELLO);
-#endif
-#ifdef	IPPROTO_ND
-    sock_define_const("IPPROTO_ND", IPPROTO_ND);
-#endif
-#ifdef	IPPROTO_TP
-    sock_define_const("IPPROTO_TP", IPPROTO_TP);
-#endif
-#ifdef	IPPROTO_XTP
-    sock_define_const("IPPROTO_XTP", IPPROTO_XTP);
-#endif
-#ifdef	IPPROTO_EON
-    sock_define_const("IPPROTO_EON", IPPROTO_EON);
-#endif
-#ifdef	IPPROTO_BIP
-    sock_define_const("IPPROTO_BIP", IPPROTO_BIP);
-#endif
-/**/
-#ifdef	IPPROTO_RAW
-    sock_define_const("IPPROTO_RAW", IPPROTO_RAW);
-#else
-    sock_define_const("IPPROTO_RAW", 255);
-#endif
-#ifdef	IPPROTO_MAX
-    sock_define_const("IPPROTO_MAX", IPPROTO_MAX);
-#endif
-
-	/* Some port configuration */
-#ifdef	IPPORT_RESERVED
-    sock_define_const("IPPORT_RESERVED", IPPORT_RESERVED);
-#else
-    sock_define_const("IPPORT_RESERVED", 1024);
-#endif
-#ifdef	IPPORT_USERRESERVED
-    sock_define_const("IPPORT_USERRESERVED", IPPORT_USERRESERVED);
-#else
-    sock_define_const("IPPORT_USERRESERVED", 5000);
-#endif
-	/* Some reserved IP v.4 addresses */
-#ifdef	INADDR_ANY
-    sock_define_const("INADDR_ANY", INADDR_ANY);
-#else
-    sock_define_const("INADDR_ANY", 0x00000000);
-#endif
-#ifdef	INADDR_BROADCAST
-    sock_define_const("INADDR_BROADCAST", INADDR_BROADCAST);
-#else
-    sock_define_const("INADDR_BROADCAST", 0xffffffff);
-#endif
-#ifdef	INADDR_LOOPBACK
-    sock_define_const("INADDR_LOOPBACK", INADDR_LOOPBACK);
-#else
-    sock_define_const("INADDR_LOOPBACK", 0x7F000001);
-#endif
-#ifdef	INADDR_UNSPEC_GROUP
-    sock_define_const("INADDR_UNSPEC_GROUP", INADDR_UNSPEC_GROUP);
-#else
-    sock_define_const("INADDR_UNSPEC_GROUP", 0xe0000000);
-#endif
-#ifdef	INADDR_ALLHOSTS_GROUP
-    sock_define_const("INADDR_ALLHOSTS_GROUP", INADDR_ALLHOSTS_GROUP);
-#else
-    sock_define_const("INADDR_ALLHOSTS_GROUP", 0xe0000001);
-#endif
-#ifdef	INADDR_MAX_LOCAL_GROUP
-    sock_define_const("INADDR_MAX_LOCAL_GROUP", INADDR_MAX_LOCAL_GROUP);
-#else
-    sock_define_const("INADDR_MAX_LOCAL_GROUP", 0xe00000ff);
-#endif
-#ifdef	INADDR_NONE
-    sock_define_const("INADDR_NONE", INADDR_NONE);
-#else
-    sock_define_const("INADDR_NONE", 0xffffffff);
-#endif
-	/* IP [gs]etsockopt options */
-#ifdef	IP_OPTIONS
-    sock_define_const("IP_OPTIONS", IP_OPTIONS);
-#endif
-#ifdef	IP_HDRINCL
-    sock_define_const("IP_HDRINCL", IP_HDRINCL);
-#endif
-#ifdef	IP_TOS
-    sock_define_const("IP_TOS", IP_TOS);
-#endif
-#ifdef	IP_TTL
-    sock_define_const("IP_TTL", IP_TTL);
-#endif
-#ifdef	IP_RECVOPTS
-    sock_define_const("IP_RECVOPTS", IP_RECVOPTS);
-#endif
-#ifdef	IP_RECVRETOPTS
-    sock_define_const("IP_RECVRETOPTS", IP_RECVRETOPTS);
-#endif
-#ifdef	IP_RECVDSTADDR
-    sock_define_const("IP_RECVDSTADDR", IP_RECVDSTADDR);
-#endif
-#ifdef	IP_RETOPTS
-    sock_define_const("IP_RETOPTS", IP_RETOPTS);
-#endif
-#ifdef	IP_MULTICAST_IF
-    sock_define_const("IP_MULTICAST_IF", IP_MULTICAST_IF);
-#endif
-#ifdef	IP_MULTICAST_TTL
-    sock_define_const("IP_MULTICAST_TTL", IP_MULTICAST_TTL);
-#endif
-#ifdef	IP_MULTICAST_LOOP
-    sock_define_const("IP_MULTICAST_LOOP", IP_MULTICAST_LOOP);
-#endif
-#ifdef	IP_ADD_MEMBERSHIP
-    sock_define_const("IP_ADD_MEMBERSHIP", IP_ADD_MEMBERSHIP);
-#endif
-#ifdef	IP_DROP_MEMBERSHIP
-    sock_define_const("IP_DROP_MEMBERSHIP", IP_DROP_MEMBERSHIP);
-#endif
-#ifdef	IP_DEFAULT_MULTICAST_TTL
-    sock_define_const("IP_DEFAULT_MULTICAST_TTL", IP_DEFAULT_MULTICAST_TTL);
-#endif
-#ifdef	IP_DEFAULT_MULTICAST_LOOP
-    sock_define_const("IP_DEFAULT_MULTICAST_LOOP", IP_DEFAULT_MULTICAST_LOOP);
-#endif
-#ifdef	IP_MAX_MEMBERSHIPS
-    sock_define_const("IP_MAX_MEMBERSHIPS", IP_MAX_MEMBERSHIPS);
-#endif
-#ifdef SO_DEBUG
-    sock_define_const("SO_DEBUG", SO_DEBUG);
-#endif
-    sock_define_const("SO_REUSEADDR", SO_REUSEADDR);
-#ifdef SO_TYPE
-    sock_define_const("SO_TYPE", SO_TYPE);
-#endif
-#ifdef SO_ERROR
-    sock_define_const("SO_ERROR", SO_ERROR);
-#endif
-#ifdef SO_DONTROUTE
-    sock_define_const("SO_DONTROUTE", SO_DONTROUTE);
-#endif
-#ifdef SO_BROADCAST
-    sock_define_const("SO_BROADCAST", SO_BROADCAST);
-#endif
-#ifdef SO_SNDBUF
-    sock_define_const("SO_SNDBUF", SO_SNDBUF);
-#endif
-#ifdef SO_RCVBUF
-    sock_define_const("SO_RCVBUF", SO_RCVBUF);
-#endif
-#ifdef SO_KEEPALIVE
-    sock_define_const("SO_KEEPALIVE", SO_KEEPALIVE);
-#endif
-#ifdef SO_OOBINLINE
-    sock_define_const("SO_OOBINLINE", SO_OOBINLINE);
-#endif
-#ifdef SO_NO_CHECK
-    sock_define_const("SO_NO_CHECK", SO_NO_CHECK);
-#endif
-#ifdef SO_PRIORITY
-    sock_define_const("SO_PRIORITY", SO_PRIORITY);
-#endif
-#ifdef SO_LINGER
-    sock_define_const("SO_LINGER", SO_LINGER);
-#endif
-#ifdef SO_PASSCRED
-    sock_define_const("SO_PASSCRED", SO_PASSCRED);
-#endif
-#ifdef SO_PEERCRED
-    sock_define_const("SO_PEERCRED", SO_PEERCRED);
-#endif
-#ifdef SO_RCVLOWAT
-    sock_define_const("SO_RCVLOWAT", SO_RCVLOWAT);
-#endif
-#ifdef SO_SNDLOWAT
-    sock_define_const("SO_SNDLOWAT", SO_SNDLOWAT);
-#endif
-#ifdef SO_RCVTIMEO
-    sock_define_const("SO_RCVTIMEO", SO_RCVTIMEO);
-#endif
-#ifdef SO_SNDTIMEO
-    sock_define_const("SO_SNDTIMEO", SO_SNDTIMEO);
-#endif
-
-#ifdef SO_SECURITY_AUTHENTICATION
-    sock_define_const("SO_SECURITY_AUTHENTICATION", SO_SECURITY_AUTHENTICATION);
-#endif
-#ifdef SO_SECURITY_ENCRYPTION_TRANSPORT
-    sock_define_const("SO_SECURITY_ENCRYPTION_TRANSPORT", SO_SECURITY_ENCRYPTION_TRANSPORT);
-#endif
-#ifdef SO_SECURITY_ENCRYPTION_NETWORK
-    sock_define_const("SO_SECURITY_ENCRYPTION_NETWORK", SO_SECURITY_ENCRYPTION_NETWORK);
-#endif
-
-#ifdef SO_BINDTODEVICE
-    sock_define_const("SO_BINDTODEVICE", SO_BINDTODEVICE);
-#endif
-#ifdef SO_ATTACH_FILTER
-    sock_define_const("SO_ATTACH_FILTER", SO_ATTACH_FILTER);
-#endif
-#ifdef SO_DETACH_FILTER
-    sock_define_const("SO_DETACH_FILTER", SO_DETACH_FILTER);
-#endif
-#ifdef SO_PEERNAME
-    sock_define_const("SO_PEERNAME", SO_PEERNAME);
-#endif
-#ifdef SO_TIMESTAMP
-    sock_define_const("SO_TIMESTAMP", SO_TIMESTAMP);
-#endif
-
-#ifdef SOPRI_INTERACTIVE
-    sock_define_const("SOPRI_INTERACTIVE", SOPRI_INTERACTIVE);
-#endif
-#ifdef SOPRI_NORMAL
-    sock_define_const("SOPRI_NORMAL", SOPRI_NORMAL);
-#endif
-#ifdef SOPRI_BACKGROUND
-    sock_define_const("SOPRI_BACKGROUND", SOPRI_BACKGROUND);
-#endif
-
-#ifdef IPX_TYPE
-    sock_define_const("IPX_TYPE", IPX_TYPE);
-#endif
-
-#ifdef TCP_NODELAY
-    sock_define_const("TCP_NODELAY", TCP_NODELAY);
-#endif
-#ifdef TCP_MAXSEG
-    sock_define_const("TCP_MAXSEG", TCP_MAXSEG);
-#endif
-
-#ifdef EAI_ADDRFAMILY
-    sock_define_const("EAI_ADDRFAMILY", EAI_ADDRFAMILY);
-#endif
-#ifdef EAI_AGAIN
-    sock_define_const("EAI_AGAIN", EAI_AGAIN);
-#endif
-#ifdef EAI_BADFLAGS
-    sock_define_const("EAI_BADFLAGS", EAI_BADFLAGS);
-#endif
-#ifdef EAI_FAIL
-    sock_define_const("EAI_FAIL", EAI_FAIL);
-#endif
-#ifdef EAI_FAMILY
-    sock_define_const("EAI_FAMILY", EAI_FAMILY);
-#endif
-#ifdef EAI_MEMORY
-    sock_define_const("EAI_MEMORY", EAI_MEMORY);
-#endif
-#ifdef EAI_NODATA
-    sock_define_const("EAI_NODATA", EAI_NODATA);
-#endif
-#ifdef EAI_NONAME
-    sock_define_const("EAI_NONAME", EAI_NONAME);
-#endif
-#ifdef EAI_SERVICE
-    sock_define_const("EAI_SERVICE", EAI_SERVICE);
-#endif
-#ifdef EAI_SOCKTYPE
-    sock_define_const("EAI_SOCKTYPE", EAI_SOCKTYPE);
-#endif
-#ifdef EAI_SYSTEM
-    sock_define_const("EAI_SYSTEM", EAI_SYSTEM);
-#endif
-#ifdef EAI_BADHINTS
-    sock_define_const("EAI_BADHINTS", EAI_BADHINTS);
-#endif
-#ifdef EAI_PROTOCOL
-    sock_define_const("EAI_PROTOCOL", EAI_PROTOCOL);
-#endif
-#ifdef EAI_MAX
-    sock_define_const("EAI_MAX", EAI_MAX);
-#endif
-#ifdef AI_PASSIVE
-    sock_define_const("AI_PASSIVE", AI_PASSIVE);
-#endif
-#ifdef AI_CANONNAME
-    sock_define_const("AI_CANONNAME", AI_CANONNAME);
-#endif
-#ifdef AI_NUMERICHOST
-    sock_define_const("AI_NUMERICHOST", AI_NUMERICHOST);
-#endif
-#ifdef AI_MASK
-    sock_define_const("AI_MASK", AI_MASK);
-#endif
-#ifdef AI_ALL
-    sock_define_const("AI_ALL", AI_ALL);
-#endif
-#ifdef AI_V4MAPPED_CFG
-    sock_define_const("AI_V4MAPPED_CFG", AI_V4MAPPED_CFG);
-#endif
-#ifdef AI_ADDRCONFIG
-    sock_define_const("AI_ADDRCONFIG", AI_ADDRCONFIG);
-#endif
-#ifdef AI_V4MAPPED
-    sock_define_const("AI_V4MAPPED", AI_V4MAPPED);
-#endif
-#ifdef AI_DEFAULT
-    sock_define_const("AI_DEFAULT", AI_DEFAULT);
-#endif
-#ifdef NI_MAXHOST
-    sock_define_const("NI_MAXHOST", NI_MAXHOST);
-#endif
-#ifdef NI_MAXSERV
-    sock_define_const("NI_MAXSERV", NI_MAXSERV);
-#endif
-#ifdef NI_NOFQDN
-    sock_define_const("NI_NOFQDN", NI_NOFQDN);
-#endif
-#ifdef NI_NUMERICHOST
-    sock_define_const("NI_NUMERICHOST", NI_NUMERICHOST);
-#endif
-#ifdef NI_NAMEREQD
-    sock_define_const("NI_NAMEREQD", NI_NAMEREQD);
-#endif
-#ifdef NI_NUMERICSERV
-    sock_define_const("NI_NUMERICSERV", NI_NUMERICSERV);
-#endif
-#ifdef NI_DGRAM
-    sock_define_const("NI_DGRAM", NI_DGRAM);
-#endif
-}
diff --git a/ext/socket/sockport.h b/ext/socket/sockport.h
deleted file mode 100644
index e1cddf53f4..0000000000
--- a/ext/socket/sockport.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/************************************************
-
-  sockport.h -
-
-  $Author$
-  $Date$
-  created at: Fri Apr 30 23:19:34 JST 1999
-
-************************************************/
-
-#ifndef SOCKPORT_H
-#define SOCKPORT_H
-
-#ifndef SA_LEN
-# ifdef HAVE_SA_LEN
-#  define SA_LEN(sa) (sa)->sa_len
-# else
-#  ifdef INET6
-#   define SA_LEN(sa) \
-	(((sa)->sa_family == AF_INET6) ? sizeof(struct sockaddr_in6) \
-				       : sizeof(struct sockaddr))
-#  else
-    /* by tradition, sizeof(struct sockaddr) covers most of the sockaddrs */
-#   define SA_LEN(sa)	(sizeof(struct sockaddr))
-#  endif
-# endif
-#endif
-
-#ifdef HAVE_SA_LEN
-# define SET_SA_LEN(sa, len) (sa)->sa_len = (len)
-#else
-# define SET_SA_LEN(sa, len) (len)
-#endif
-
-#ifdef HAVE_SIN_LEN
-# define SIN_LEN(si) (si)->sin_len
-# define SET_SIN_LEN(si,len) (si)->sin_len = (len)
-#else
-# define SIN_LEN(si) sizeof(struct sockaddr_in)
-# define SET_SIN_LEN(si,len)
-#endif
-
-#ifndef IN_MULTICAST
-# define IN_CLASSD(i)	(((long)(i) & 0xf0000000) == 0xe0000000)
-# define IN_MULTICAST(i)	IN_CLASSD(i)
-#endif
-
-#ifndef IN_EXPERIMENTAL
-# define IN_EXPERIMENTAL(i) ((((long)(i)) & 0xe0000000) == 0xe0000000)
-#endif
-
-#ifndef IN_CLASSA_NSHIFT
-# define IN_CLASSA_NSHIFT 24
-#endif
-
-#ifndef IN_LOOPBACKNET
-# define IN_LOOPBACKNET 127
-#endif
-
-#ifndef AF_UNSPEC
-# define AF_UNSPEC 0
-#endif
-
-#ifndef PF_UNSPEC
-# define PF_UNSPEC AF_UNSPEC
-#endif
-
-#ifndef PF_INET
-# define PF_INET AF_INET
-#endif
-
-#if defined(HOST_NOT_FOUND) && !defined(h_errno) && !defined(__CYGWIN__)
-extern int h_errno;
-#endif
-
-#endif
diff --git a/ext/stringio/.cvsignore b/ext/stringio/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/stringio/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/stringio/MANIFEST b/ext/stringio/MANIFEST
deleted file mode 100644
index 4f3a7dc6d0..0000000000
--- a/ext/stringio/MANIFEST
+++ /dev/null
@@ -1,4 +0,0 @@
-MANIFEST
-README
-stringio.c
-depend
diff --git a/ext/stringio/README b/ext/stringio/README
deleted file mode 100644
index c4031f7e97..0000000000
--- a/ext/stringio/README
+++ /dev/null
@@ -1,19 +0,0 @@
--*- rd -*-
-$Author$
-$Date$
-
-=begin
-
-= StringIO
-Pseudo (({IO})) class from/to (({String})).
-
-This library is based on MoonWolf version written in Ruby.  Thanks a lot.
-
-= Differences to (({IO}))
-
-* not implemented: (({fcntl})), (({reopen})).
-* (({fileno})) returns nil.
-* (({pos=})) returns new position, not 0.
-* (({ungetc})) does nothing at start of the string. 
-
-=end
diff --git a/ext/stringio/depend b/ext/stringio/depend
deleted file mode 100644
index cc9eae3f55..0000000000
--- a/ext/stringio/depend
+++ /dev/null
@@ -1,2 +0,0 @@
-stringio.o: stringio.c $(hdrdir)/ruby.h $(topdir)/config.h \
-  $(hdrdir)/defines.h $(hdrdir)/intern.h $(hdrdir)/rubyio.h
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
deleted file mode 100644
index 07ee38dd48..0000000000
--- a/ext/stringio/stringio.c
+++ /dev/null
@@ -1,932 +0,0 @@
-/**********************************************************************
-
-  stringio.c -
-
-  $Author$
-  $Date$
-  $RoughId: stringio.c,v 1.13 2002/03/14 03:24:18 nobu Exp $
-  created at: Tue Feb 19 04:10:38 JST 2002
-
-  All the files in this distribution are covered under the Ruby's
-  license (see the file COPYING).
-
-**********************************************************************/
-
-#include "ruby.h"
-#include "rubyio.h"
-
-#define STRIO_APPEND 4
-
-struct StringIO {
-    VALUE string;
-    long pos;
-    long lineno;
-    int flags;
-    int count;
-};
-
-static struct StringIO* strio_alloc _((void));
-static void strio_mark _((struct StringIO *));
-static void strio_free _((struct StringIO *));
-static struct StringIO* check_strio _((VALUE));
-static struct StringIO* get_strio _((VALUE));
-static struct StringIO* readable _((struct StringIO *));
-static struct StringIO* writable _((struct StringIO *));
-static void check_modifiable _((struct StringIO *));
-
-#define IS_STRIO(obj) (RDATA(obj)->dmark == (RUBY_DATA_FUNC)strio_mark)
-#define error_inval(msg) (errno = EINVAL, rb_sys_fail(msg))
-
-static struct StringIO *
-strio_alloc()
-{
-    struct StringIO *ptr = ALLOC(struct StringIO);
-    ptr->string = Qnil;
-    ptr->pos = 0;
-    ptr->lineno = 0;
-    ptr->flags = 0;
-    ptr->count = 1;
-    return ptr;
-}
-
-static void
-strio_mark(ptr)
-    struct StringIO *ptr;
-{
-    if (ptr) {
-	rb_gc_mark(ptr->string);
-    }
-}
-
-static void
-strio_free(ptr)
-    struct StringIO *ptr;
-{
-    if (--ptr->count <= 0) {
-	xfree(ptr);
-    }
-}
-
-static struct StringIO*
-check_strio(self)
-    VALUE self;
-{
-    Check_Type(self, T_DATA);
-    if (!IS_STRIO(self)) {
-	rb_raise(rb_eTypeError, "wrong argument type %s (expected String::IO)",
-		 rb_class2name(CLASS_OF(self)));
-    }
-    return DATA_PTR(self);
-}
-
-static struct StringIO*
-get_strio(self)
-    VALUE self;
-{
-    struct StringIO *ptr = check_strio(self);
-
-    if (!ptr) {
-	rb_raise(rb_eIOError, "uninitialized stream");
-    }
-    return ptr;
-}
-
-#define StringIO(obj) get_strio(obj)
-
-#define CLOSED(ptr) NIL_P((ptr)->string)
-#define READABLE(ptr) (!CLOSED(ptr) && ((ptr)->flags & FMODE_READABLE))
-#define WRITABLE(ptr) (!CLOSED(ptr) && ((ptr)->flags & FMODE_WRITABLE))
-
-static struct StringIO*
-readable(ptr)
-    struct StringIO *ptr;
-{
-    if (!READABLE(ptr)) {
-	rb_raise(rb_eIOError, "not opened for reading");
-    }
-    return ptr;
-}
-
-static struct StringIO*
-writable(ptr)
-    struct StringIO *ptr;
-{
-    if (!WRITABLE(ptr)) {
-	rb_raise(rb_eIOError, "not opened for writing");
-    }
-    if (!OBJ_TAINTED(ptr->string)) {
-	rb_secure(4);
-    }
-    return ptr;
-}
-
-static void
-check_modifiable(ptr)
-    struct StringIO *ptr;
-{
-    if (OBJ_FROZEN(ptr->string)) {
-	rb_raise(rb_eIOError, "not modifiable string");
-    }
-}
-
-static VALUE strio_s_allocate _((VALUE));
-static VALUE strio_s_open _((int, VALUE *, VALUE));
-static VALUE strio_initialize _((int, VALUE *, VALUE));
-static VALUE strio_finalize _((VALUE));
-static VALUE strio_self _((VALUE));
-static VALUE strio_false _((VALUE));
-static VALUE strio_nil _((VALUE));
-static VALUE strio_0 _((VALUE));
-static VALUE strio_first _((VALUE, VALUE));
-static VALUE strio_unimpl _((int, VALUE *, VALUE));
-static VALUE strio_get_string _((VALUE));
-static VALUE strio_set_string _((VALUE, VALUE));
-static VALUE strio_close _((VALUE));
-static VALUE strio_close_read _((VALUE));
-static VALUE strio_close_write _((VALUE));
-static VALUE strio_closed _((VALUE));
-static VALUE strio_closed_read _((VALUE));
-static VALUE strio_closed_write _((VALUE));
-static VALUE strio_eof _((VALUE));
-static VALUE strio_clone _((VALUE));
-static VALUE strio_get_lineno _((VALUE));
-static VALUE strio_set_lineno _((VALUE, VALUE));
-static VALUE strio_get_pos _((VALUE));
-static VALUE strio_set_pos _((VALUE, VALUE));
-static VALUE strio_rewind _((VALUE));
-static VALUE strio_seek _((int, VALUE *, VALUE));
-static VALUE strio_get_sync _((VALUE));
-static VALUE strio_set_sync _((VALUE, VALUE));
-static VALUE strio_each_byte _((VALUE));
-static VALUE strio_getc _((VALUE));
-static VALUE strio_ungetc _((VALUE, VALUE));
-static VALUE strio_readchar _((VALUE));
-static VALUE strio_gets_internal _((int, VALUE *, struct StringIO *));
-static VALUE strio_gets _((int, VALUE *, VALUE));
-static VALUE strio_readline _((int, VALUE *, VALUE));
-static VALUE strio_each _((int, VALUE *, VALUE));
-static VALUE strio_readlines _((int, VALUE *, VALUE));
-static VALUE strio_write _((VALUE, VALUE));
-static VALUE strio_print _((int, VALUE *, VALUE));
-static VALUE strio_printf _((int, VALUE *, VALUE));
-static VALUE strio_putc _((VALUE, VALUE));
-static VALUE strio_read _((int, VALUE *, VALUE));
-static VALUE strio_size _((VALUE));
-static VALUE strio_truncate _((VALUE, VALUE));
-void Init_stringio _((void));
-
-/* Boyer-Moore search: copied from regex.c */
-static void bm_init_skip _((long *, const char *, long));
-static long bm_search _((const char *, long, const char *, long, const long *));
-
-static VALUE
-strio_s_allocate(klass)
-    VALUE klass;
-{
-    return Data_Wrap_Struct(klass, strio_mark, strio_free, 0);
-}
-
-static VALUE
-strio_s_open(argc, argv, klass)
-    int argc;
-    VALUE *argv;
-    VALUE klass;
-{
-    VALUE obj = rb_class_new_instance(argc, argv, klass);
-    if (!rb_block_given_p()) return obj;
-    return rb_ensure(rb_yield, obj, strio_finalize, obj);
-}
-
-static VALUE
-strio_initialize(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    struct StringIO *ptr = check_strio(self);
-    VALUE string, mode;
-
-    if (!ptr) {
-	DATA_PTR(self) = ptr = strio_alloc();
-    }
-    rb_call_super(0, 0);
-    switch (rb_scan_args(argc, argv, "02", &string, &mode)) {
-      case 2:
-	StringValue(mode);
-	StringValue(string);
-	ptr->flags = rb_io_mode_flags(RSTRING(mode)->ptr);
-	if (ptr->flags & FMODE_WRITABLE && OBJ_FROZEN(string)) {
-	    errno = EACCES;
-	    rb_sys_fail(0);
-	}
-	switch (*RSTRING(mode)->ptr) {
-	  case 'a':
-	    ptr->flags |= STRIO_APPEND;
-	    break;
-	  case 'w':
-	    rb_str_resize(string, 0);
-	    break;
-	}
-	break;
-      case 1:
-	StringValue(string);
-	ptr->flags = OBJ_FROZEN(string) ? FMODE_READABLE : FMODE_READWRITE;
-	break;
-      case 0:
-	string = rb_str_new("", 0);
-	ptr->flags = FMODE_READWRITE;
-	break;
-    }
-    ptr->string = string;
-    return self;
-}
-
-static VALUE
-strio_finalize(self)
-    VALUE self;
-{
-    struct StringIO *ptr = StringIO(self);
-    ptr->string = Qnil;
-    ptr->flags &= ~FMODE_READWRITE;
-    return self;
-}
-
-static VALUE
-strio_false(self)
-    VALUE self;
-{
-    StringIO(self);
-    return Qfalse;
-}
-
-static VALUE
-strio_nil(self)
-    VALUE self;
-{
-    StringIO(self);
-    return Qnil;
-}
-
-static VALUE
-strio_self(self)
-    VALUE self;
-{
-    StringIO(self);
-    return self;
-}
-
-static VALUE
-strio_0(self)
-    VALUE self;
-{
-    StringIO(self);
-    return INT2FIX(0);
-}
-
-static VALUE
-strio_first(self, arg)
-    VALUE self, arg;
-{
-    StringIO(self);
-    return arg;
-}
-
-static VALUE
-strio_unimpl(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    StringIO(self);
-    rb_notimplement();
-    return Qnil;		/* not reached */
-}
-
-static VALUE
-strio_get_string(self)
-    VALUE self;
-{
-    return StringIO(self)->string;
-}
-
-static VALUE
-strio_set_string(self, string)
-    VALUE self, string;
-{
-    struct StringIO *ptr = StringIO(self);
-
-    if (NIL_P(string)) {
-	ptr->flags &= ~FMODE_READWRITE;
-    }
-    else {
-	StringValue(string);
-	ptr->flags |= FMODE_READWRITE;
-    }
-    return ptr->string = string;
-}
-
-static VALUE
-strio_close(self)
-    VALUE self;
-{
-    struct StringIO *ptr = StringIO(self);
-    if (CLOSED(ptr)) {
-	rb_raise(rb_eIOError, "closed stream");
-    }
-    ptr->string = Qnil;
-    ptr->flags &= ~FMODE_READWRITE;
-    return self;
-}
-
-static VALUE
-strio_close_read(self)
-    VALUE self;
-{
-    struct StringIO *ptr = StringIO(self);
-    if (!READABLE(ptr)) {
-	rb_raise(rb_eIOError, "closing non-duplex IO for reading");
-    }
-    if (!((ptr->flags &= ~FMODE_READABLE) & FMODE_READWRITE)) {
-	ptr->string = Qnil;
-    }
-    return self;
-}
-
-static VALUE
-strio_close_write(self)
-    VALUE self;
-{
-    struct StringIO *ptr = StringIO(self);
-    if (!WRITABLE(ptr)) {
-	rb_raise(rb_eIOError, "closing non-duplex IO for writing");
-    }
-    if (!((ptr->flags &= ~FMODE_WRITABLE) & FMODE_READWRITE)) {
-	ptr->string = Qnil;
-    }
-    return self;
-}
-
-static VALUE
-strio_closed(self)
-    VALUE self;
-{
-    struct StringIO *ptr = StringIO(self);
-    if (!CLOSED(ptr)) return Qfalse;
-    return Qtrue;
-}
-
-static VALUE
-strio_closed_read(self)
-    VALUE self;
-{
-    struct StringIO *ptr = StringIO(self);
-    if (READABLE(ptr)) return Qfalse;
-    return Qtrue;
-}
-
-static VALUE
-strio_closed_write(self)
-    VALUE self;
-{
-    struct StringIO *ptr = StringIO(self);
-    if (WRITABLE(ptr)) return Qfalse;
-    return Qtrue;
-}
-
-static VALUE
-strio_eof(self)
-    VALUE self;
-{
-    struct StringIO *ptr = readable(StringIO(self));
-    if (ptr->pos < RSTRING(ptr->string)->len) return Qfalse;
-    return Qtrue;
-}
-
-static VALUE
-strio_clone(self)
-    VALUE self;
-{
-    struct StringIO *ptr = StringIO(self);
-    VALUE clone = rb_call_super(0, 0);
-    DATA_PTR(clone) = ptr;
-    ++ptr->count;
-    return self;
-}
-
-static VALUE
-strio_get_lineno(self)
-    VALUE self;
-{
-    return LONG2NUM(StringIO(self)->lineno);
-}
-
-static VALUE
-strio_set_lineno(self, lineno)
-    VALUE self, lineno;
-{
-    StringIO(self)->lineno = NUM2LONG(lineno);
-    return lineno;
-}
-
-#define strio_binmode strio_self
-
-#define strio_reopen strio_unimpl
-
-#define strio_fcntl strio_unimpl
-
-#define strio_flush strio_self
-
-#define strio_fsync strio_0
-
-static VALUE
-strio_get_pos(self)
-    VALUE self;
-{
-    return LONG2NUM(StringIO(self)->pos);
-}
-
-static VALUE
-strio_set_pos(self, pos)
-    VALUE self;
-    VALUE pos;
-{
-    struct StringIO *ptr = StringIO(self);
-    long p = NUM2LONG(pos);
-    if (p < 0) {
-	error_inval(0);
-    }
-    ptr->pos = p;
-    return pos;
-}
-
-static VALUE
-strio_rewind(self)
-    VALUE self;
-{
-    struct StringIO *ptr = StringIO(self);
-    ptr->pos = 0;
-    ptr->lineno = 0;
-    return INT2FIX(0);
-}
-
-static VALUE
-strio_seek(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    VALUE whence;
-    struct StringIO *ptr = StringIO(self);
-    long offset;
-
-    rb_scan_args(argc, argv, "11", NULL, &whence);
-    offset = NUM2LONG(argv[0]);
-    switch (NIL_P(whence) ? 0 : NUM2LONG(whence)) {
-      case 0:
-	break;
-      case 1:
-	offset += ptr->pos;
-	break;
-      case 2:
-	offset += RSTRING(ptr->string)->len;
-	break;
-      default:
-	rb_raise(rb_eArgError, "invalid whence %ld", NUM2LONG(whence));
-    }
-    if (offset < 0) {
-	error_inval(0);
-    }
-    ptr->pos = offset;
-    return INT2FIX(0);
-}
-
-static VALUE
-strio_get_sync(self)
-    VALUE self;
-{
-    StringIO(self);
-    return Qtrue;
-}
-
-#define strio_set_sync strio_first
-
-#define strio_tell strio_get_pos
-
-static VALUE
-strio_each_byte(self)
-    VALUE self;
-{
-    struct StringIO *ptr = readable(StringIO(self));
-    while (ptr->pos < RSTRING(ptr->string)->len) {
-	char c = RSTRING(ptr->string)->ptr[ptr->pos++];
-	rb_yield(CHR2FIX(c));
-    }
-    return Qnil;
-}
-
-static VALUE
-strio_getc(self)
-    VALUE self;
-{
-    struct StringIO *ptr = readable(StringIO(self));
-    int c;
-    if (ptr->pos >= RSTRING(ptr->string)->len) {
-	return Qnil;
-    }
-    c = RSTRING(ptr->string)->ptr[ptr->pos++];
-    return CHR2FIX(c);
-}
-
-static VALUE
-strio_ungetc(self, ch)
-    VALUE self, ch;
-{
-    struct StringIO *ptr = readable(StringIO(self));
-    int cc = NUM2INT(ch);
-
-    if (cc != EOF && ptr->pos > 0) {
-	if ((unsigned char)RSTRING(ptr->string)->ptr[--ptr->pos] !=
-	    (unsigned char)cc) {
-	    check_modifiable(ptr);
-	    rb_str_modify(ptr->string);
-	    RSTRING(ptr->string)->ptr[ptr->pos] = cc;
-	}
-    }
-    return Qnil;
-}
-
-static VALUE
-strio_readchar(self)
-    VALUE self;
-{
-    VALUE c = strio_getc(self);
-    if (NIL_P(c)) rb_eof_error();
-    return c;
-}
-
-static void
-bm_init_skip(skip, pat, m)
-     long *skip;
-     const char *pat;
-     long m;
-{
-    int c;
-
-    for (c = 0; c < (1 << CHAR_BIT); c++) {
-	skip[c] = m;
-    }
-    while (--m) {
-	skip[(unsigned char)*pat++] = m;
-    }
-}
-
-static long
-bm_search(little, llen, big, blen, skip)
-    const char *little;
-    long llen;
-    const char *big;
-    long blen;
-    const long *skip;
-{
-    long i, j, k;
-
-    i = llen - 1;
-    while (i < blen) {
-	k = i;
-	j = llen - 1;
-	while (j >= 0 && big[k] == little[j]) {
-	    k--;
-	    j--;
-	}
-	if (j < 0) return k + 1;
-	i += skip[(unsigned char)big[i]];
-    }
-    return -1;
-}
-
-static VALUE
-strio_gets_internal(argc, argv, ptr)
-    int argc;
-    VALUE *argv;
-    struct StringIO *ptr;
-{
-    const char *s, *e, *p;
-    long n;
-    VALUE str;
-
-    if (argc == 0) {
-	str = rb_rs;
-    }
-    else {
-	rb_scan_args(argc, argv, "1", &str);
-	if (!NIL_P(str)) StringValue(str);
-    }
-
-    if (ptr->pos >= (n = RSTRING(ptr->string)->len)) return Qnil;
-    s = RSTRING(ptr->string)->ptr;
-    e = s + RSTRING(ptr->string)->len;
-    s += ptr->pos;
-    if (NIL_P(str)) {
-	str = rb_str_substr(ptr->string, ptr->pos, e - s);
-    }
-    else if ((n = RSTRING(str)->len) == 0) {
-	p = s;
-	while (*p == '\n') {
-	    if (++p == e) return Qnil;
-	}
-	s = p;
-	while (p = memchr(p, '\n', e - p)) {
-	    if (p == e) break;
-	    if (*++p == '\n') {
-		e = p;
-		break;
-	    }
-	}
-	str = rb_str_substr(ptr->string, s - RSTRING(ptr->string)->ptr, e - s); 
-    }
-    else if (n == 1) {
-	if (p = memchr(s, RSTRING(str)->ptr[0], e - s)) {
-	    e = p + 1;
-	}
-	str = rb_str_substr(ptr->string, ptr->pos, e - s);
-    }
-    else {
-	if (n < s - e) {
-	    if (s - e < 1024) {
-		for (p = s; p + n <= e; ++p) {
-		    if (MEMCMP(p, RSTRING(str)->ptr, char, n) == 0) {
-			e = p + n;
-			break;
-		    }
-		}
-	    }
-	    else {
-		long skip[1 << CHAR_BIT], pos;
-		p = RSTRING(str)->ptr;
-		bm_init_skip(skip, p, n);
-		if ((pos = bm_search(p, n, s, e - s, skip)) >= 0) {
-		    e = s + pos + n;
-		}
-	    }
-	}
-	str = rb_str_substr(ptr->string, ptr->pos, e - s);
-    }
-    ptr->pos = e - RSTRING(ptr->string)->ptr;
-    ptr->lineno++;
-    rb_lastline_set(str);
-    return str;
-}
-
-static VALUE
-strio_gets(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    return strio_gets_internal(argc, argv, readable(StringIO(self)));
-}
-
-static VALUE
-strio_readline(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    VALUE line = strio_gets_internal(argc, argv, readable(StringIO(self)));
-    if (NIL_P(line)) rb_eof_error();
-    return line;
-}
-
-static VALUE
-strio_each(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    struct StringIO *ptr = StringIO(self);
-    VALUE line;
-
-    while (!NIL_P(line = strio_gets_internal(argc, argv, readable(ptr)))) {
-	rb_yield(line);
-    }
-    return self;
-}
-
-static VALUE
-strio_readlines(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    struct StringIO *ptr = StringIO(self);
-    VALUE ary = rb_ary_new(), line;
-    while (!NIL_P(line = strio_gets_internal(argc, argv, readable(ptr)))) {
-	rb_ary_push(ary, line);
-    }
-    return ary;
-}
-
-static VALUE
-strio_write(self, str)
-    VALUE self, str;
-{
-    struct StringIO *ptr = writable(StringIO(self));
-    long len;
-
-    if (TYPE(str) != T_STRING)
-	str = rb_obj_as_string(str);
-    len = RSTRING(str)->len;
-    if (!len) return INT2FIX(0);
-    check_modifiable(ptr);
-    if (ptr->flags & STRIO_APPEND) {
-	ptr->pos = RSTRING(ptr->string)->len;
-    }
-    if (ptr->pos == RSTRING(ptr->string)->len) {
-	rb_str_cat(ptr->string, RSTRING(str)->ptr, len);
-    }
-    else {
-	if (ptr->pos + len > RSTRING(ptr->string)->len) {
-	    rb_str_resize(ptr->string, ptr->pos + len);
-	}
-	else {
-	    rb_str_modify(ptr->string);
-	}
-	rb_str_update(ptr->string, ptr->pos, len, str);
-    }
-    ptr->pos += len;
-    return LONG2NUM(len);
-}
-
-#define strio_addstr rb_io_addstr
-
-#define strio_print rb_io_print
-
-#define strio_printf rb_io_printf
-
-static VALUE
-strio_putc(self, ch)
-    VALUE self, ch;
-{
-    struct StringIO *ptr = writable(StringIO(self));
-    int c = NUM2CHR(ch);
-
-    check_modifiable(ptr);
-    if (ptr->flags & STRIO_APPEND) {
-	ptr->pos = RSTRING(ptr->string)->len;
-    }
-    if (ptr->pos >= RSTRING(ptr->string)->len) {
-	rb_str_resize(ptr->string, ptr->pos + 1);
-    }
-    else {
-	rb_str_modify(ptr->string);
-    }
-    RSTRING(ptr->string)->ptr[ptr->pos++] = c;
-    return ch;
-}
-
-#define strio_puts rb_io_puts
-
-static VALUE
-strio_read(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    struct StringIO *ptr = readable(StringIO(self));
-    VALUE str;
-    long len;
-
-    if (ptr->pos >= RSTRING(ptr->string)->len) {
-	return Qnil;
-    }
-    switch (argc) {
-      case 1:
-	if (!NIL_P(argv[0])) {
-	    len = NUM2LONG(argv[0]);
-	    break;
-	}
-	/* fall through */
-      case 0:
-	len = RSTRING(ptr->string)->len - ptr->pos;
-	break;
-      default:
-	rb_raise(rb_eArgError, "wrong number arguments (%d for 0)", argc);
-    }
-    str = rb_str_substr(ptr->string, ptr->pos, len);
-    ptr->pos += len;
-    return str;
-}
-
-static VALUE
-strio_sysread(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    VALUE val = strio_read(argc, argv, self);
-    if (NIL_P(val)) {
-	rb_eof_error();
-    }
-    return val;
-}
-
-#define strio_syswrite strio_write
-
-#define strio_path rb_inspect
-
-#define strio_isatty strio_false
-
-#define strio_pid strio_nil
-
-#define strio_fileno strio_nil
-
-static VALUE
-strio_size(self)
-    VALUE self;
-{
-    VALUE string = StringIO(self)->string;
-    if (NIL_P(string)) {
-	rb_raise(rb_eIOError, "not opened");
-    }
-    return ULONG2NUM(RSTRING(string)->len);
-}
-
-static VALUE
-strio_truncate(self, len)
-    VALUE self, len;
-{
-    VALUE string = writable(StringIO(self))->string;
-    long l = NUM2LONG(len);
-    if (l < 0) {
-	error_inval("negative legnth");
-    }
-    rb_str_resize(string, l);
-    return len;
-}
-
-void
-Init_stringio()
-{
-    VALUE StringIO = rb_define_class("StringIO", rb_cData);
-    rb_define_singleton_method(StringIO, "allocate", strio_s_allocate, 0);
-    rb_define_singleton_method(StringIO, "open", strio_s_open, -1);
-    rb_define_method(StringIO, "initialize", strio_initialize, -1);
-    rb_enable_super(StringIO, "initialize");
-    rb_define_method(StringIO, "clone", strio_clone, 0);
-    rb_enable_super(StringIO, "clone");
-    rb_define_method(StringIO, "reopen", strio_reopen, -1);
-
-    rb_define_method(StringIO, "string", strio_get_string, 0);
-    rb_define_method(StringIO, "string=", strio_set_string, 1);
-    rb_define_method(StringIO, "lineno", strio_get_lineno, 0);
-    rb_define_method(StringIO, "lineno=", strio_set_lineno, 1);
-
-    rb_define_method(StringIO, "binmode", strio_binmode, 0);
-    rb_define_method(StringIO, "close", strio_close, 0);
-    rb_define_method(StringIO, "close_read", strio_close_read, 0);
-    rb_define_method(StringIO, "close_write", strio_close_write, 0);
-    rb_define_method(StringIO, "closed?", strio_closed, 0);
-    rb_define_method(StringIO, "closed_read?", strio_closed_read, 0);
-    rb_define_method(StringIO, "closed_write?", strio_closed_write, 0);
-    rb_define_method(StringIO, "eof", strio_eof, 0);
-    rb_define_method(StringIO, "eof?", strio_eof, 0);
-    rb_define_method(StringIO, "fcntl", strio_fcntl, -1);
-    rb_define_method(StringIO, "flush", strio_flush, 0);
-    rb_define_method(StringIO, "fsync", strio_fsync, 0);
-    rb_define_method(StringIO, "pos", strio_get_pos, 0);
-    rb_define_method(StringIO, "pos=", strio_set_pos, 1);
-    rb_define_method(StringIO, "rewind", strio_rewind, 0);
-    rb_define_method(StringIO, "seek", strio_seek, -1);
-    rb_define_method(StringIO, "sync", strio_get_sync, 0);
-    rb_define_method(StringIO, "sync=", strio_set_sync, 1);
-    rb_define_method(StringIO, "tell", strio_tell, 0);
-    rb_define_method(StringIO, "path", strio_path, 0);
-
-    rb_define_method(StringIO, "each", strio_each, -1);
-    rb_define_method(StringIO, "each_byte", strio_each_byte, 0);
-    rb_define_method(StringIO, "each_line", strio_each, -1);
-    rb_define_method(StringIO, "getc", strio_getc, 0);
-    rb_define_method(StringIO, "ungetc", strio_ungetc, 1);
-    rb_define_method(StringIO, "readchar", strio_readchar, 0);
-    rb_define_method(StringIO, "gets", strio_gets, -1);
-    rb_define_method(StringIO, "readline", strio_readline, -1);
-    rb_define_method(StringIO, "readlines", strio_readlines, -1);
-    rb_define_method(StringIO, "read", strio_read, -1);
-    rb_define_method(StringIO, "sysread", strio_sysread, -1);
-
-    rb_define_method(StringIO, "write", strio_write, 1);
-    rb_define_method(StringIO, "<<", strio_addstr, 1);
-    rb_define_method(StringIO, "print", strio_print, -1);
-    rb_define_method(StringIO, "printf", strio_printf, -1);
-    rb_define_method(StringIO, "putc", strio_putc, 1);
-    rb_define_method(StringIO, "puts", strio_puts, -1);
-    rb_define_method(StringIO, "syswrite", strio_syswrite, 1);
-
-    rb_define_method(StringIO, "isatty", strio_isatty, 0);
-    rb_define_method(StringIO, "tty?", strio_isatty, 0);
-    rb_define_method(StringIO, "pid", strio_pid, 0);
-    rb_define_method(StringIO, "fileno", strio_fileno, 0);
-    rb_define_method(StringIO, "size", strio_size, 0);
-    rb_define_method(StringIO, "length", strio_size, 0);
-    rb_define_method(StringIO, "truncate", strio_truncate, 1);
-}
diff --git a/ext/strscan/.cvsignore b/ext/strscan/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/strscan/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/strscan/MANIFEST b/ext/strscan/MANIFEST
deleted file mode 100644
index 5fdf598f2c..0000000000
--- a/ext/strscan/MANIFEST
+++ /dev/null
@@ -1,4 +0,0 @@
-MANIFEST
-strscan.c
-extconf.rb
-depend
diff --git a/ext/strscan/depend b/ext/strscan/depend
deleted file mode 100644
index 9199574c3f..0000000000
--- a/ext/strscan/depend
+++ /dev/null
@@ -1 +0,0 @@
-strscan.o: strscan.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/strscan/extconf.rb b/ext/strscan/extconf.rb
deleted file mode 100644
index 0d21966fc2..0000000000
--- a/ext/strscan/extconf.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require 'mkmf'
-create_makefile 'strscan'
diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c
deleted file mode 100644
index 55c17a179a..0000000000
--- a/ext/strscan/strscan.c
+++ /dev/null
@@ -1,704 +0,0 @@
-/* vi:set sw=4:
-
-    strscan.c
-
-    Copyright (c) 1999-2002 Minero Aoki 
-
-    This program is free software.
-    You can distribute/modify this program
-    under the same terms of the ruby.
-
-    $Id$
-
-*/
-
-
-#include "ruby.h"
-#include "re.h"
-#include "version.h"
-
-#if (RUBY_VERSION_CODE < 150)
-#  define rb_eRangeError rb_eArgError
-#  define rb_obj_freeze(obj) rb_str_freeze(obj)
-#endif
-
-#define STRSCAN_VERSION "0.7.0"
-
-struct strscanner
-{
-    /* multi-purpose flags */
-    unsigned long flags;
-
-    /* the string to scan */
-    VALUE str;
-    
-    /* scan pointers */
-    long prev;   /* legal only when MATCHED_P(s) */
-    long curr;   /* always legal */
-
-    /* the regexp register; legal only when last match had successed */
-    struct re_registers regs;
-};
-
-#define S_PTR(s)  (RSTRING(s->str)->ptr)
-#define S_LEN(s)  (RSTRING(s->str)->len)
-#define S_END(s)  (S_PTR(s) + S_LEN(s))
-#define CURPTR(s) (S_PTR(s) + s->curr)
-#define S_RESTLEN(s) (S_LEN(s) - s->curr)
-
-#define FLAG_MATCHED (1UL)
-
-#define CLEAR_MATCH_STATUS(s)  s->flags &= ~FLAG_MATCHED
-#define MATCHED(s)             s->flags |= FLAG_MATCHED
-#define MATCHED_P(s)          (s->flags & FLAG_MATCHED)
-
-#define GET_SCANNER(obj,var) Data_Get_Struct(obj, struct strscanner, var)
-#define SCAN_FINISHED(s) ((s)->curr >= RSTRING(p->str)->len)
-
-static VALUE StringScanner;
-static VALUE ScanError;
-
-
-/* ------------------------------------------------------------- */
-
-static VALUE
-infect(str, p)
-    VALUE str;
-    struct strscanner *p;
-{
-    OBJ_INFECT(str, p->str);
-    return str;
-}
-
-static VALUE
-extract_range(p, beg_i, end_i)
-    struct strscanner *p;
-    long beg_i, end_i;
-{
-    return infect(rb_str_new(S_PTR(p) + beg_i, end_i - beg_i), p);
-}
-
-static VALUE
-extract_beg_len(p, beg_i, len)
-    struct strscanner *p;
-    long beg_i, len;
-{
-    return infect(rb_str_new(S_PTR(p) + beg_i, len), p);
-}
-
-/* ------------------------------------------------------------- */
-
-static VALUE
-strscan_s_mustc(self)
-    VALUE self;
-{
-    return self;
-}
-
-
-static void
-strscan_mark(p)
-    struct strscanner *p;
-{
-    rb_gc_mark(p->str);
-}
-
-static void
-strscan_free(p)
-    struct strscanner *p;
-{
-    re_free_registers(&(p->regs));
-    memset(p, sizeof(struct strscanner), 0);
-    free(p);
-}
-
-static VALUE
-strscan_s_new(argc, argv, klass)
-    int argc;
-    VALUE *argv, klass;
-{
-    VALUE str, dup_p;
-    struct strscanner *p;
-
-    if (rb_scan_args(argc, argv, "11", &str, &dup_p) == 1)
-        dup_p = Qtrue;
-    Check_Type(str, T_STRING);
-
-    p = ALLOC_N(struct strscanner, 1);
-    MEMZERO(p, struct strscanner, 1);
-    p->str = RTEST(dup_p) ? rb_str_dup(str) : str;
-    rb_obj_freeze(p->str);
-    CLEAR_MATCH_STATUS(p);
-    MEMZERO(&(p->regs), struct re_registers, 1);
-
-    return Data_Wrap_Struct(klass, strscan_mark, strscan_free, p);
-}
-
-
-static VALUE
-strscan_reset(self)
-    VALUE self;
-{
-    struct strscanner *p;
-
-    GET_SCANNER(self, p);
-    p->curr = 0;
-    CLEAR_MATCH_STATUS(p);
-    return self;
-}
-
-
-static VALUE
-strscan_terminate(self)
-    VALUE self;
-{
-    struct strscanner *p;
-
-    GET_SCANNER(self, p);
-    p->curr = S_LEN(p);
-    CLEAR_MATCH_STATUS(p);
-    return self;
-}
-
-static VALUE
-strscan_get_string(self)
-    VALUE self;
-{
-    struct strscanner *p;
-
-    GET_SCANNER(self, p);
-    return p->str;
-}
-
-static VALUE
-strscan_set_string(self, str)
-    VALUE self;
-{
-    struct strscanner *p;
-
-    GET_SCANNER(self, p);
-    Check_Type(str, T_STRING);
-    p->str = rb_str_dup(str);
-    rb_obj_freeze(p->str);
-    p->curr = 0;
-    CLEAR_MATCH_STATUS(p);
-    return str;
-}
-
-static VALUE
-strscan_get_pos(self)
-    VALUE self;
-{
-    struct strscanner *p;
-
-    GET_SCANNER(self, p);
-    return INT2FIX(p->curr);
-}
-
-static VALUE
-strscan_set_pos(self, v)
-    VALUE self, v;
-{
-    struct strscanner *p;
-    long i;
-
-    GET_SCANNER(self, p);
-    i = NUM2INT(v);
-    if (i < 0) i += S_LEN(p);
-    if (i < 0) rb_raise(rb_eRangeError, "index out of range");
-    if (i > S_LEN(p)) rb_raise(rb_eRangeError, "index out of range");
-    p->curr = i;
-    return INT2FIX(i);
-}
-
-
-/* I should implement this function? */
-#define strscan_prepare_re(re)  /* none */
-
-static VALUE
-strscan_do_scan(self, regex, succptr, getstr, headonly)
-    VALUE self, regex;
-    int succptr, getstr, headonly;
-{
-    struct strscanner *p;
-    int ret;
-
-    Check_Type(regex, T_REGEXP);
-    GET_SCANNER(self, p);
-
-    CLEAR_MATCH_STATUS(p);
-    strscan_prepare_re(regex);
-    if (headonly) {
-        ret = re_match(RREGEXP(regex)->ptr,
-                       CURPTR(p), S_RESTLEN(p),
-                       0,
-                       &(p->regs));
-    }
-    else {
-        ret = re_search(RREGEXP(regex)->ptr,
-                        CURPTR(p), S_RESTLEN(p),
-                        0,
-                        S_RESTLEN(p),
-                        &(p->regs));
-    }
-
-    if (ret == -2) rb_raise(ScanError, "regexp buffer overflow");
-    if (ret < 0) {
-        /* not matched */
-        return Qnil;
-    }
-
-    MATCHED(p);
-    p->prev = p->curr;
-    if (succptr) {
-        p->curr += p->regs.end[0];
-    }
-    if (getstr) {
-        return extract_beg_len(p, p->prev, p->regs.end[0]);
-    }
-    else {
-        return INT2FIX(p->regs.end[0]);
-    }
-}
-
-static VALUE
-strscan_scan(self, re)
-    VALUE self, re;
-{
-    return strscan_do_scan(self, re, 1, 1, 1);
-}
-
-static VALUE
-strscan_match_p(self, re)
-    VALUE self, re;
-{
-    return strscan_do_scan(self, re, 0, 0, 1);
-}
-
-static VALUE
-strscan_skip(self, re)
-    VALUE self, re;
-{
-    return strscan_do_scan(self, re, 1, 0, 1);
-}
-
-static VALUE
-strscan_check(self, re)
-    VALUE self, re;
-{
-    return strscan_do_scan(self, re, 0, 1, 1);
-}
-
-static VALUE
-strscan_scan_full(self, re, s, f)
-{
-    return strscan_do_scan(self, re, RTEST(s), RTEST(f), 1);
-}
-
-
-static VALUE
-strscan_scan_until(self, re)
-    VALUE self, re;
-{
-    return strscan_do_scan(self, re, 1, 1, 0);
-}
-
-static VALUE
-strscan_exist_p(self, re)
-    VALUE self, re;
-{
-    return strscan_do_scan(self, re, 0, 0, 0);
-}
-
-static VALUE
-strscan_skip_until(self, re)
-    VALUE self, re;
-{
-    return strscan_do_scan(self, re, 1, 0, 0);
-}
-
-static VALUE
-strscan_check_until(self, re)
-    VALUE self, re;
-{
-    return strscan_do_scan(self, re, 0, 1, 0);
-}
-
-static VALUE
-strscan_search_full(self, re, s, f)
-{
-    return strscan_do_scan(self, re, RTEST(s), RTEST(f), 0);
-}
-
-/* DANGEROUS; need to synchronize with regex.c */
-static void
-adjust_registers_to_matched(p)
-    struct strscanner *p;
-{
-    if (p->regs.allocated == 0) {
-        p->regs.beg = ALLOC_N(int, RE_NREGS);
-        p->regs.end = ALLOC_N(int, RE_NREGS);
-        p->regs.allocated = RE_NREGS;
-    }
-    p->regs.num_regs = 1;
-    p->regs.beg[0] = 0;
-    p->regs.end[0] = p->curr - p->prev;
-}
-
-static VALUE
-strscan_getch(self)
-    VALUE self;
-{
-    struct strscanner *p;
-    long len;
-
-    GET_SCANNER(self, p);
-    CLEAR_MATCH_STATUS(p);
-    if (SCAN_FINISHED(p))
-        return Qnil;
-
-    len = mbclen(*CURPTR(p));
-    if (p->curr + len > S_LEN(p))
-        len = S_LEN(p) - p->curr;
-    p->prev = p->curr;
-    p->curr += len;
-    MATCHED(p);
-    adjust_registers_to_matched(p);
-    return extract_range(p, p->prev + p->regs.beg[0],
-                            p->prev + p->regs.end[0]);
-}
-
-static VALUE
-strscan_get_byte(self)
-    VALUE self;
-{
-    struct strscanner *p;
-
-    GET_SCANNER(self, p);
-    CLEAR_MATCH_STATUS(p);
-    if (SCAN_FINISHED(p))
-        return Qnil;
-
-    p->prev = p->curr;
-    p->curr++;
-    MATCHED(p);
-    adjust_registers_to_matched(p);
-    return extract_range(p, p->prev + p->regs.beg[0],
-                            p->prev + p->regs.end[0]);
-}
-
-
-static VALUE
-strscan_peek(self, vlen)
-    VALUE self, vlen;
-{
-    struct strscanner *p;
-    long len;
-
-    GET_SCANNER(self, p);
-
-    len = NUM2LONG(vlen);
-    if (SCAN_FINISHED(p))
-        return infect(rb_str_new("", 0), p);
-
-    if (p->curr + len > S_LEN(p))
-        len = S_LEN(p) - p->curr;
-    return extract_beg_len(p, p->curr, len);
-}
-
-
-static VALUE
-strscan_unscan(self)
-    VALUE self;
-{
-    struct strscanner *p;
-
-    GET_SCANNER(self, p);
-    if (! MATCHED_P(p))
-        rb_raise(ScanError, "cannot unscan: prev match had failed");
-
-    p->curr = p->prev;
-    CLEAR_MATCH_STATUS(p);
-    return self;
-}
-
-
-static VALUE
-strscan_eos_p(self)
-    VALUE self;
-{
-    struct strscanner *p;
-
-    GET_SCANNER(self, p);
-    if (SCAN_FINISHED(p))
-        return Qtrue;
-    else
-        return Qfalse;
-}
-
-static VALUE
-strscan_rest_p(self)
-    VALUE self;
-{
-    struct strscanner *p;
-
-    GET_SCANNER(self, p);
-    if (SCAN_FINISHED(p))
-        return Qfalse;
-    else
-        return Qtrue;
-}
-
-
-static VALUE
-strscan_matched_p(self)
-    VALUE self;
-{
-    struct strscanner *p;
-
-    GET_SCANNER(self, p);
-    if (MATCHED_P(p))
-        return Qtrue;
-    else
-        return Qfalse;
-}
-
-static VALUE
-strscan_matched(self)
-    VALUE self;
-{
-    struct strscanner *p;
-
-    GET_SCANNER(self, p);
-    if (! MATCHED_P(p)) return Qnil;
-
-    return extract_range(p, p->prev + p->regs.beg[0],
-                            p->prev + p->regs.end[0]);
-}
-
-static VALUE
-strscan_matched_size(self)
-    VALUE self;
-{
-    struct strscanner *p;
-
-    GET_SCANNER(self, p);
-    if (! MATCHED_P(p)) return Qnil;
-
-    return INT2NUM(p->regs.end[0] - p->regs.beg[0]);
-}
-
-static VALUE
-strscan_aref(self, idx)
-    VALUE self, idx;
-{
-    struct strscanner *p;
-    long i;
-
-    GET_SCANNER(self, p);
-    if (! MATCHED_P(p))        return Qnil;
-    
-    i = NUM2LONG(idx);
-    if (i < 0)
-        i += p->regs.num_regs;
-    if (i < 0)                 return Qnil;
-    if (i >= p->regs.num_regs) return Qnil;
-    if (p->regs.beg[i] == -1)  return Qnil;
-
-    return extract_range(p, p->prev + p->regs.beg[i],
-                            p->prev + p->regs.end[i]);
-}
-
-static VALUE
-strscan_pre_match(self)
-    VALUE self;
-{
-    struct strscanner *p;
-
-    GET_SCANNER(self, p);
-    if (! MATCHED_P(p)) return Qnil;
-
-    return extract_range(p, 0, p->prev + p->regs.beg[0]);
-}
-
-static VALUE
-strscan_post_match(self)
-    VALUE self;
-{
-    struct strscanner *p;
-
-    GET_SCANNER(self, p);
-    if (! MATCHED_P(p)) return Qnil;
-
-    return extract_range(p, p->prev + p->regs.end[0], S_LEN(p));
-}
-
-
-static VALUE
-strscan_rest(self)
-    VALUE self;
-{
-    struct strscanner *p;
-
-    GET_SCANNER(self, p);
-    if (SCAN_FINISHED(p)) {
-        return infect(rb_str_new("", 0), p);
-    }
-    return extract_range(p, p->curr, S_LEN(p));
-}
-
-static VALUE
-strscan_rest_size(self)
-    VALUE self;
-{
-    struct strscanner *p;
-    long i;
-
-    GET_SCANNER(self, p);
-    if (SCAN_FINISHED(p)) {
-        return INT2FIX(0);
-    }
-
-    i = S_LEN(p) - p->curr;
-    return INT2FIX(i);
-}
-
-
-static void
-catchar(ret, c)
-    VALUE ret;
-    int c;
-{
-    char buf[1];
-
-    buf[0] = c;
-    rb_str_cat(ret, buf, 1);
-}
-
-#define CLEN 5
-
-static VALUE
-strscan_inspect(self)
-    VALUE self;
-{
-    struct strscanner *p;
-    char buf[128];
-    VALUE ret;
-    long len;
-
-    GET_SCANNER(self, p);
-    len = sprintf(buf, "#<%s %ld/%ld",
-                  rb_class2name(CLASS_OF(self)),
-                  p->curr, S_LEN(p));
-    ret = rb_str_new(buf, len);
-    
-    if (SCAN_FINISHED(p)) {
-        rb_str_cat(ret, " fin>", 4);
-    }
-    else {
-        char *sp;
-
-        sp = CURPTR(p) - CLEN;
-        if (sp < S_PTR(p)) sp = S_PTR(p);
-        if (sp != CURPTR(p)) {
-            rb_str_cat(ret, " \"", 2);
-            if (sp > S_PTR(p))
-                rb_str_cat(ret, "...", 3);
-            for (; sp < CURPTR(p); sp++) {
-                catchar(ret, *sp);
-            }
-            rb_str_cat(ret, "\"", 1);
-        }
-        rb_str_cat(ret, " @", 2);
-        if (sp != S_END(p)) {
-            char *e;
-
-            e = sp + CLEN;
-            if (e > S_END(p)) e = S_END(p);
-            rb_str_cat(ret, " \"", 2);
-            for (; sp < e; sp++) {
-                catchar(ret, *sp);
-            }
-            if (sp < S_END(p))
-                rb_str_cat(ret, "...", 3);
-            rb_str_cat(ret, "\"", 1);
-        }
-        rb_str_cat(ret, ">", 1);
-    }
-    return infect(ret, p);
-}
-
-/* ------------------------------------------------------------- */
-
-void
-Init_strscan()
-{
-    ID id_scanerr = rb_intern("ScanError");
-    VALUE tmp;
-
-    if (rb_const_defined(rb_cObject, id_scanerr)) {
-        ScanError = rb_const_get(rb_cObject, id_scanerr);
-    }
-    else {
-        ScanError = rb_define_class_id(id_scanerr, rb_eStandardError);
-    }
-
-    StringScanner = rb_define_class("StringScanner", rb_cObject);
-    tmp = rb_str_new2(STRSCAN_VERSION);
-    rb_obj_freeze(tmp);
-    rb_const_set(StringScanner, rb_intern("Version"), tmp);
-    tmp = rb_str_new2("$Id$");
-    rb_obj_freeze(tmp);
-    rb_const_set(StringScanner, rb_intern("Id"), tmp);
-    
-    rb_define_singleton_method(StringScanner, "new", strscan_s_new, -1);
-    rb_define_singleton_method(StringScanner,
-                               "must_C_version", strscan_s_mustc, 0);
-    rb_define_method(StringScanner, "reset",       strscan_reset,       0);
-    rb_define_method(StringScanner, "terminate",   strscan_terminate,   0);
-    rb_define_method(StringScanner, "clear",       strscan_terminate,   0);
-    rb_define_method(StringScanner, "string",      strscan_get_string,  0);
-    rb_define_method(StringScanner, "string=",     strscan_set_string,  1);
-    rb_define_method(StringScanner, "pos",         strscan_get_pos,     0);
-    rb_define_method(StringScanner, "pos=",        strscan_set_pos,     1);
-    rb_define_method(StringScanner, "pointer",     strscan_get_pos,     0);
-    rb_define_method(StringScanner, "pointer=",    strscan_set_pos,     1);
-
-    rb_define_method(StringScanner, "scan",        strscan_scan,        1);
-    rb_define_method(StringScanner, "skip",        strscan_skip,        1);
-    rb_define_method(StringScanner, "match?",      strscan_match_p,     1);
-    rb_define_method(StringScanner, "check",       strscan_check,       1);
-    rb_define_method(StringScanner, "scan_full",   strscan_scan_full,   3);
-
-    rb_define_method(StringScanner, "scan_until",  strscan_scan_until,  1);
-    rb_define_method(StringScanner, "skip_until",  strscan_skip_until,  1);
-    rb_define_method(StringScanner, "exist?",      strscan_exist_p,     1);
-    rb_define_method(StringScanner, "check_until", strscan_check_until, 1);
-    rb_define_method(StringScanner, "search_full", strscan_search_full, 3);
-
-    rb_define_method(StringScanner, "getch",       strscan_getch,       0);
-    rb_define_method(StringScanner, "get_byte",    strscan_get_byte,    0);
-    rb_define_method(StringScanner, "getbyte",     strscan_get_byte,    0);
-    rb_define_method(StringScanner, "peek",        strscan_peek,        1);
-    rb_define_method(StringScanner, "peep",        strscan_peek,        1);
-
-    rb_define_method(StringScanner, "unscan",      strscan_unscan,      0);
-
-    rb_define_method(StringScanner, "eos?",        strscan_eos_p,       0);
-    rb_define_method(StringScanner, "empty?",      strscan_eos_p,       0);
-    rb_define_method(StringScanner, "rest?",       strscan_rest_p,      0);
-
-    rb_define_method(StringScanner, "matched?",    strscan_matched_p,   0);
-    rb_define_method(StringScanner, "matched",     strscan_matched,     0);
-    rb_define_method(StringScanner, "matched_size", strscan_matched_size, 0);
-    rb_define_method(StringScanner, "matchedsize", strscan_matched_size, 0);
-    rb_define_method(StringScanner, "[]",          strscan_aref,        1);
-    rb_define_method(StringScanner, "pre_match",   strscan_pre_match,   0);
-    rb_define_method(StringScanner, "post_match",  strscan_post_match,  0);
-
-    rb_define_method(StringScanner, "rest",        strscan_rest,        0);
-    rb_define_method(StringScanner, "rest_size",   strscan_rest_size,   0);
-    rb_define_method(StringScanner, "restsize",    strscan_rest_size,   0);
-
-    rb_define_method(StringScanner, "inspect",     strscan_inspect,     0);
-}
diff --git a/ext/syslog/.cvsignore b/ext/syslog/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/syslog/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/syslog/MANIFEST b/ext/syslog/MANIFEST
deleted file mode 100644
index b5306034b7..0000000000
--- a/ext/syslog/MANIFEST
+++ /dev/null
@@ -1,6 +0,0 @@
-MANIFEST
-extconf.rb
-syslog.c
-syslog.txt
-test.rb
-depend
diff --git a/ext/syslog/depend b/ext/syslog/depend
deleted file mode 100644
index 45cbea293a..0000000000
--- a/ext/syslog/depend
+++ /dev/null
@@ -1,2 +0,0 @@
-syslog.o: syslog.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h \
-  $(hdrdir)/intern.h
diff --git a/ext/syslog/extconf.rb b/ext/syslog/extconf.rb
deleted file mode 100644
index 0fa0bc339b..0000000000
--- a/ext/syslog/extconf.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# $RoughId: extconf.rb,v 1.3 2001/11/24 17:49:26 knu Exp $
-# $Id$
-
-require 'mkmf'
-
-have_header("syslog.h") &&
-  have_func("openlog") &&
-  have_func("setlogmask") &&
-  create_makefile("syslog")
-
diff --git a/ext/syslog/syslog.c b/ext/syslog/syslog.c
deleted file mode 100644
index 22e1e02a87..0000000000
--- a/ext/syslog/syslog.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/* 
- * UNIX Syslog extension for Ruby
- * Amos Gouaux, University of Texas at Dallas
- * 
- *
- * $RoughId: syslog.c,v 1.21 2002/02/25 12:21:17 knu Exp $
- * $Id$
- */
-
-#include "ruby.h"
-#include 
-
-/* Syslog class */
-static VALUE mSyslog, mSyslogConstants;
-static VALUE syslog_ident = Qnil, syslog_options = INT2FIX(-1),
-  syslog_facility = INT2FIX(-1), syslog_mask = INT2FIX(-1);
-static int syslog_opened = 0;
-
-/* Package helper routines */
-static void syslog_write(int pri, int argc, VALUE *argv)
-{
-    VALUE str;
-
-    if (argc < 1) {
-        rb_raise(rb_eArgError, "no log message supplied");
-    }
-
-    if (!syslog_opened) {
-        rb_raise(rb_eRuntimeError, "must open syslog before write");
-    }
-
-    str = rb_f_sprintf(argc, argv);
-
-    syslog(pri, "%s", RSTRING(str)->ptr);
-}
-
-/* Syslog module methods */
-static VALUE mSyslog_close(VALUE self)
-{
-    closelog();
-    syslog_opened = 0;
-
-    return Qnil;
-}
-
-static VALUE mSyslog_open(int argc, VALUE *argv, VALUE self)
-{
-    VALUE ident, opt, fac;
-    int mask;
-
-    if (syslog_opened) {
-        rb_raise(rb_eRuntimeError, "syslog already open");
-    }
-    rb_scan_args(argc, argv, "03", &ident, &opt, &fac);
-    if (NIL_P(ident)) {
-        ident = rb_gv_get("$0"); 
-    }
-    if (NIL_P(opt)) {
-        opt = INT2NUM(LOG_PID | LOG_CONS);
-    }
-    if (NIL_P(fac)) {
-        fac = INT2NUM(LOG_USER);
-    }
-
-#ifdef SafeStringValue
-    SafeStringValue(ident);
-#else
-    Check_SafeStr(ident);
-#endif
-    syslog_ident = ident;
-    syslog_options = opt;
-    syslog_facility = fac;
-    openlog(RSTRING(ident)->ptr, NUM2INT(opt), NUM2INT(fac));
-    syslog_opened = 1;
-
-    setlogmask(mask = setlogmask(0));
-    syslog_mask = INT2NUM(mask);
-
-    /* be like File.new.open {...} */
-    if (rb_block_given_p()) {
-        rb_ensure(rb_yield, self, mSyslog_close, self);
-    }
-
-    return self;
-}
-
-static VALUE mSyslog_reopen(int argc, VALUE *argv, VALUE self)
-{
-    mSyslog_close(self);
-
-    return mSyslog_open(argc, argv, self);
-}
-
-static VALUE mSyslog_isopen(VALUE self)
-{
-    return syslog_opened ? Qtrue : Qfalse;
-}
-
-static VALUE mSyslog_ident(VALUE self)
-{
-    return syslog_ident;
-}
-
-static VALUE mSyslog_options(VALUE self)
-{
-    return syslog_options;
-}
-
-static VALUE mSyslog_facility(VALUE self)
-{
-    return syslog_facility;
-}
-
-static VALUE mSyslog_get_mask(VALUE self)
-{
-    return syslog_mask;
-}
-
-static VALUE mSyslog_set_mask(VALUE self, VALUE mask)
-{
-    if (!syslog_opened) {
-        rb_raise(rb_eRuntimeError, "must open syslog before setting log mask");
-    }
-
-    setlogmask(NUM2INT(mask));
-    syslog_mask = mask;
-
-    return mask;
-}
-
-static VALUE mSyslog_log(int argc, VALUE *argv, VALUE self)
-{
-    VALUE pri;
-
-    if (argc < 2) {
-        rb_raise(rb_eArgError, "wrong # of arguments(%d for 2+)", argc);
-    }
-
-    argc--;
-    pri = *argv++;
-
-    if (!FIXNUM_P(pri)) {
-      rb_raise(rb_eTypeError, "type mismatch: %s given", rb_class2name(CLASS_OF(pri)));
-    }
-
-    syslog_write(FIX2INT(pri), argc, argv);
-
-    return self;
-}
-
-static VALUE mSyslog_inspect(VALUE self)
-{
-#define N 7
-    int argc = N;
-    VALUE argv[N];
-    const char fmt[] =
-      "<#%s: opened=%s, ident=\"%s\", options=%d, facility=%d, mask=%d>";
-
-    argv[0] = rb_str_new(fmt, sizeof(fmt) - 1);
-    argv[1] = mSyslog;
-    argv[2] = syslog_opened ? Qtrue : Qfalse;
-    argv[3] = syslog_ident;
-    argv[4] = syslog_options;
-    argv[5] = syslog_facility;
-    argv[6] = syslog_mask;
-
-    return rb_f_sprintf(argc, argv);
-#undef N
-}
-
-static VALUE mSyslog_instance(VALUE self)
-{
-    return self;
-}
-
-#define define_syslog_shortcut_method(pri, name) \
-static VALUE mSyslog_##name(int argc, VALUE *argv, VALUE self) \
-{ \
-    syslog_write(pri, argc, argv); \
-\
-    return self; \
-}
-
-#ifdef LOG_EMERG
-define_syslog_shortcut_method(LOG_EMERG, emerg)
-#endif
-#ifdef LOG_ALERT
-define_syslog_shortcut_method(LOG_ALERT, alert)
-#endif
-#ifdef LOG_CRIT
-define_syslog_shortcut_method(LOG_CRIT, crit)
-#endif
-#ifdef LOG_ERR
-define_syslog_shortcut_method(LOG_ERR, err)
-#endif
-#ifdef LOG_WARNING
-define_syslog_shortcut_method(LOG_WARNING, warning)
-#endif
-#ifdef LOG_NOTICE
-define_syslog_shortcut_method(LOG_NOTICE, notice)
-#endif
-#ifdef LOG_INFO
-define_syslog_shortcut_method(LOG_INFO, info)
-#endif
-#ifdef LOG_DEBUG
-define_syslog_shortcut_method(LOG_DEBUG, debug)
-#endif
-
-static VALUE mSyslogConstants_LOG_MASK(VALUE klass, VALUE pri)
-{
-    return INT2FIX(LOG_MASK(FIX2INT(pri)));
-}
-
-static VALUE mSyslogConstants_LOG_UPTO(VALUE klass, VALUE pri)
-{
-    return INT2FIX(LOG_UPTO(FIX2INT(pri)));
-}
-
-/* Init for package syslog */
-void Init_syslog()
-{
-    mSyslog = rb_define_module("Syslog");
- 
-    mSyslogConstants = rb_define_module_under(mSyslog, "Constants");
-
-    rb_include_module(mSyslog, mSyslogConstants);
-
-    rb_define_module_function(mSyslog, "open", mSyslog_open, -1);
-    rb_define_module_function(mSyslog, "reopen", mSyslog_reopen, -1);
-    rb_define_module_function(mSyslog, "open!", mSyslog_reopen, -1);
-    rb_define_module_function(mSyslog, "opened?", mSyslog_isopen, 0);
-
-    rb_define_module_function(mSyslog, "ident", mSyslog_ident, 0);
-    rb_define_module_function(mSyslog, "options", mSyslog_options, 0);
-    rb_define_module_function(mSyslog, "facility", mSyslog_facility, 0);
-
-    rb_define_module_function(mSyslog, "log", mSyslog_log, -1);
-    rb_define_module_function(mSyslog, "close", mSyslog_close, 0);
-    rb_define_module_function(mSyslog, "mask", mSyslog_get_mask, 0);
-    rb_define_module_function(mSyslog, "mask=", mSyslog_set_mask, 1);
-
-    rb_define_module_function(mSyslog, "LOG_MASK", mSyslogConstants_LOG_MASK, 1);
-    rb_define_module_function(mSyslog, "LOG_UPTO", mSyslogConstants_LOG_UPTO, 1);
-
-    rb_define_module_function(mSyslog, "inspect", mSyslog_inspect, 0);
-    rb_define_module_function(mSyslog, "instance", mSyslog_instance, 0);
-
-    rb_define_module_function(mSyslogConstants, "LOG_MASK", mSyslogConstants_LOG_MASK, 1);
-    rb_define_module_function(mSyslogConstants, "LOG_UPTO", mSyslogConstants_LOG_UPTO, 1);
-
-#define rb_define_syslog_const(id) \
-    rb_define_const(mSyslogConstants, #id, INT2NUM(id))
-
-    /* Various options when opening log */
-#ifdef LOG_PID
-    rb_define_syslog_const(LOG_PID);
-#endif
-#ifdef LOG_CONS
-    rb_define_syslog_const(LOG_CONS);
-#endif
-#ifdef LOG_ODELAY
-    rb_define_syslog_const(LOG_ODELAY); /* deprecated */
-#endif
-#ifdef LOG_NDELAY
-    rb_define_syslog_const(LOG_NDELAY);
-#endif
-#ifdef LOG_NOWAIT
-    rb_define_syslog_const(LOG_NOWAIT); /* deprecated */
-#endif
-#ifdef LOG_PERROR
-    rb_define_syslog_const(LOG_PERROR);
-#endif
-
-    /* Various syslog facilities */
-#ifdef LOG_AUTH
-    rb_define_syslog_const(LOG_AUTH);
-#endif
-#ifdef LOG_AUTHPRIV
-    rb_define_syslog_const(LOG_AUTHPRIV);
-#endif
-#ifdef LOG_CONSOLE
-    rb_define_syslog_const(LOG_CONSOLE);
-#endif
-#ifdef LOG_CRON
-    rb_define_syslog_const(LOG_CRON);
-#endif
-#ifdef LOG_DAEMON
-    rb_define_syslog_const(LOG_DAEMON);
-#endif
-#ifdef LOG_FTP
-    rb_define_syslog_const(LOG_FTP);
-#endif
-#ifdef LOG_KERN
-    rb_define_syslog_const(LOG_KERN);
-#endif
-#ifdef LOG_LPR
-    rb_define_syslog_const(LOG_LPR);
-#endif
-#ifdef LOG_MAIL
-    rb_define_syslog_const(LOG_MAIL);
-#endif
-#ifdef LOG_NEWS
-    rb_define_syslog_const(LOG_NEWS);
-#endif
-#ifdef LOG_NTP
-   rb_define_syslog_const(LOG_NTP);
-#endif
-#ifdef LOG_SECURITY
-    rb_define_syslog_const(LOG_SECURITY);
-#endif
-#ifdef LOG_SYSLOG
-    rb_define_syslog_const(LOG_SYSLOG);
-#endif
-#ifdef LOG_USER
-    rb_define_syslog_const(LOG_USER);
-#endif
-#ifdef LOG_UUCP
-    rb_define_syslog_const(LOG_UUCP);
-#endif
-#ifdef LOG_LOCAL0
-    rb_define_syslog_const(LOG_LOCAL0);
-#endif
-#ifdef LOG_LOCAL1
-    rb_define_syslog_const(LOG_LOCAL1);
-#endif
-#ifdef LOG_LOCAL2
-    rb_define_syslog_const(LOG_LOCAL2);
-#endif
-#ifdef LOG_LOCAL3
-    rb_define_syslog_const(LOG_LOCAL3);
-#endif
-#ifdef LOG_LOCAL4
-    rb_define_syslog_const(LOG_LOCAL4);
-#endif
-#ifdef LOG_LOCAL5
-    rb_define_syslog_const(LOG_LOCAL5);
-#endif
-#ifdef LOG_LOCAL6
-    rb_define_syslog_const(LOG_LOCAL6);
-#endif
-#ifdef LOG_LOCAL7
-    rb_define_syslog_const(LOG_LOCAL7);
-#endif
-
-#define rb_define_syslog_shortcut(name) \
-    rb_define_module_function(mSyslog, #name, mSyslog_##name, -1)
-
-    /* Various syslog priorities and the shortcut methods */
-#ifdef LOG_EMERG
-    rb_define_syslog_const(LOG_EMERG);
-    rb_define_syslog_shortcut(emerg);
-#endif
-#ifdef LOG_ALERT
-    rb_define_syslog_const(LOG_ALERT);
-    rb_define_syslog_shortcut(alert);
-#endif
-#ifdef LOG_CRIT
-    rb_define_syslog_const(LOG_CRIT);
-    rb_define_syslog_shortcut(crit);
-#endif
-#ifdef LOG_ERR
-    rb_define_syslog_const(LOG_ERR);
-    rb_define_syslog_shortcut(err);
-#endif
-#ifdef LOG_WARNING
-    rb_define_syslog_const(LOG_WARNING);
-    rb_define_syslog_shortcut(warning);
-#endif
-#ifdef LOG_NOTICE
-    rb_define_syslog_const(LOG_NOTICE);
-    rb_define_syslog_shortcut(notice);
-#endif
-#ifdef LOG_INFO
-    rb_define_syslog_const(LOG_INFO);
-    rb_define_syslog_shortcut(info);
-#endif
-#ifdef LOG_DEBUG
-    rb_define_syslog_const(LOG_DEBUG);
-    rb_define_syslog_shortcut(debug);
-#endif
-}
diff --git a/ext/syslog/syslog.txt b/ext/syslog/syslog.txt
deleted file mode 100644
index 9aed35133d..0000000000
--- a/ext/syslog/syslog.txt
+++ /dev/null
@@ -1,121 +0,0 @@
-.\" syslog.txt -  -*- Indented-Text -*-
-$RoughId: syslog.txt,v 1.18 2002/02/25 08:20:14 knu Exp $
-$Id$
-
-UNIX Syslog extension for Ruby
-Amos Gouaux, University of Texas at Dallas
-
-&
-Akinori MUSHA
-
-
-** Syslog(Module)
-
-Included Modules: Syslog::Constants
-
-require 'syslog'
-
-A Simple wrapper for the UNIX syslog system calls that might be handy
-if you're writing a server in Ruby.  For the details of the syslog(8)
-architecture and constants, see the syslog(3) manual page of your
-platform.
-
-Module Methods:
-
-   open(ident = $0, logopt = Syslog::LOG_PID | Syslog::LOG_CONS,
-		facility = Syslog::LOG_USER) [{ |syslog| ... }]
-
-	Opens syslog with the given options and returns the module
-	itself.  If a block is given, calls it with an argument of
-	itself.  If syslog is already opened, raises RuntimeError.
-
-	Example:
-	  Syslog.open('ftpd', Syslog::LOG_PID | Syslog::LOG_NDELAY,
-			      Syslog::LOG_FTP)
-
-   open!(ident = $0, logopt = Syslog::LOG_PID | Syslog::LOG_CONS,
-		facility = Syslog::LOG_USER)
-   reopen(ident = $0, logopt = Syslog::LOG_PID | Syslog::LOG_CONS,
-		facility = Syslog::LOG_USER)
-
-	Same as open, but does a close first.
-
-   opened?
-
-	Returns true if syslog opened, otherwise false.
-
-   ident
-   options
-   facility
-
-	Returns the parameters given in the last open, respectively.
-	Every call of Syslog::open resets these values.
-
-   log(pri, message, ...)
-
-	Writes message to syslog.
-
-	Example:
-	  Syslog.log(Syslog::LOG_CRIT, "the sky is falling in %d seconds!", 10)
-
-   crit(message, ...)
-   emerg(message, ...)
-   alert(message, ...)
-   err(message, ...)
-   warning(message, ...)
-   notice(message, ...)
-   info(message, ...)
-   debug(message, ...)
-
-	These are shortcut methods of Syslog::log().  The lineup may
-	vary depending on what priorities are defined on your system.
-
-	Example:
-	  Syslog.crit("the sky is falling in %d seconds!", 5)
- 
-   mask
-   mask=(mask)
-
-	Returns or sets the log priority mask.  The value of the mask
-	is persistent and will not be reset by Syslog::open or
-	Syslog::close.
-
-	Example:
-	  Syslog.mask = Syslog::LOG_UPTO(Syslog::LOG_ERR)
-
-   close 
-
-	Closes syslog.
-
-   inspect
-
-	Returns the "inspect" string of the Syslog module.
-
-   instance
-
-	Returns the module itself. (Just for backward compatibility)
-
-   LOG_MASK(pri)
-
-	Creates a mask for one priority.
-
-   LOG_UPTO(pri)
-
-	Creates a mask for all priorities up to pri.
-
-** Syslog::Constants(Module)
-
-require 'syslog'
-include Syslog::Constants
-
-This module includes the LOG_* constants available on the system.
-
-Module Methods:
-
-   LOG_MASK(pri)
-
-	Creates a mask for one priority.
-
-   LOG_UPTO(pri)
-
-	Creates a mask for all priorities up to pri.
diff --git a/ext/syslog/test.rb b/ext/syslog/test.rb
deleted file mode 100644
index 6cd861b2b2..0000000000
--- a/ext/syslog/test.rb
+++ /dev/null
@@ -1,161 +0,0 @@
-#!/usr/bin/env ruby
-# $RoughId: test.rb,v 1.9 2002/02/25 08:20:14 knu Exp $
-# $Id$
-
-# Please only run this test on machines reasonable for testing.
-# If in doubt, ask your admin.
-
-require 'runit/testcase'
-require 'runit/cui/testrunner'
-
-# Prepend current directory to load path for testing.
-$:.unshift('.')
-
-require 'syslog'
-
-class TestSyslog < RUNIT::TestCase
-  def test_new
-    assert_exception(NameError) {
-      Syslog.new
-    }
-  end
-
-  def test_instance
-    sl1 = Syslog.instance
-    sl2 = Syslog.open
-    sl3 = Syslog.instance
-
-    assert_equal(Syslog, sl1)
-    assert_equal(Syslog, sl2)
-    assert_equal(Syslog, sl3)
-  ensure
-    Syslog.close
-  end
-
-  def test_open
-    # default parameters
-    Syslog.open
-
-    assert_equal($0, Syslog.ident)
-    assert_equal(Syslog::LOG_PID | Syslog::LOG_CONS, Syslog.options)
-    assert_equal(Syslog::LOG_USER, Syslog.facility)
-
-    # open without close
-    assert_exception(RuntimeError) {
-      Syslog.open
-    }
-
-    Syslog.close
-
-    # given parameters
-    Syslog.open("foo", Syslog::LOG_NDELAY | Syslog::LOG_PERROR, Syslog::LOG_DAEMON) 
-
-    assert_equal('foo', Syslog.ident)
-    assert_equal(Syslog::LOG_NDELAY | Syslog::LOG_PERROR, Syslog.options)
-    assert_equal(Syslog::LOG_DAEMON, Syslog.facility)
-
-    Syslog.close
-
-    # default parameters again (after close)
-    Syslog.open
-    Syslog.close
-
-    assert_equal($0, Syslog.ident)
-    assert_equal(Syslog::LOG_PID | Syslog::LOG_CONS, Syslog.options)
-    assert_equal(Syslog::LOG_USER, Syslog.facility)
-
-    # block
-    param = nil
-    Syslog.open { |param| }
-    assert_equal(Syslog, param)
-  ensure
-    Syslog.close
-  end
-
-  def test_opened?
-    assert_equal(false, Syslog.opened?)
-
-    Syslog.open
-    assert_equal(true, Syslog.opened?)
-
-    Syslog.close
-    assert_equal(false, Syslog.opened?)
-
-    Syslog.open {
-      assert_equal(true, Syslog.opened?)
-    }
-
-    assert_equal(false, Syslog.opened?)
-  end
-
-  def test_mask
-    Syslog.open
-
-    orig = Syslog.mask
-
-    Syslog.mask = Syslog.LOG_UPTO(Syslog::LOG_ERR)
-    assert_equal(Syslog.LOG_UPTO(Syslog::LOG_ERR), Syslog.mask)
-
-    Syslog.mask = Syslog.LOG_MASK(Syslog::LOG_CRIT)
-    assert_equal(Syslog.LOG_MASK(Syslog::LOG_CRIT), Syslog.mask)
-
-    Syslog.mask = orig
-  ensure
-    Syslog.close
-  end
-
-  def test_log
-    stderr = IO::pipe
-
-    pid = fork {
-      stderr[0].close
-      STDERR.reopen(stderr[1])
-      stderr[1].close
-
-      options = Syslog::LOG_PERROR | Syslog::LOG_NDELAY
-
-      Syslog.open("syslog_test", options) { |sl|
-	sl.log(Syslog::LOG_NOTICE, "test1 - hello, %s!", "world")
-	sl.notice("test1 - hello, %s!", "world")
-      }
-
-      Syslog.open("syslog_test", options | Syslog::LOG_PID) { |sl|
-	sl.log(Syslog::LOG_CRIT, "test2 - pid")
-	sl.crit("test2 - pid")
-      }
-      exit!
-    }
-
-    stderr[1].close
-    Process.waitpid(pid)
-
-    # LOG_PERROR is not yet implemented on Cygwin.
-    return if RUBY_PLATFORM =~ /cygwin/
-
-    2.times {
-      assert_equal("syslog_test: test1 - hello, world!\n", stderr[0].gets)
-    }
-
-    2.times {
-      assert_equal(format("syslog_test[%d]: test2 - pid\n", pid), stderr[0].gets)
-    }
-  end
-
-  def test_inspect
-    Syslog.open { |sl|
-      assert_equal(format('<#%s: opened=%s, ident="%s", ' +
-			  'options=%d, facility=%d, mask=%d>',
-			  Syslog, sl.opened?, sl.ident,
-			  sl.options, sl.facility, sl.mask),
-		   sl.inspect)
-    }
-  end
-end
-
-if $0 == __FILE__
-  suite = RUNIT::TestSuite.new
-
-  suite.add_test(TestSyslog.suite)
-
-  RUNIT::CUI::TestRunner.run(suite)
-end
diff --git a/ext/tcltklib/.cvsignore b/ext/tcltklib/.cvsignore
deleted file mode 100644
index f3c7a7c5da..0000000000
--- a/ext/tcltklib/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-Makefile
diff --git a/ext/tcltklib/MANIFEST b/ext/tcltklib/MANIFEST
deleted file mode 100644
index 4e37fb900f..0000000000
--- a/ext/tcltklib/MANIFEST
+++ /dev/null
@@ -1,16 +0,0 @@
-MANIFEST
-README.euc
-MANUAL.euc
-tcltklib.c
-stubs.c
-depend
-extconf.rb
-lib/tcltk.rb
-demo/lines1.rb
-demo/lines0.tcl
-demo/lines2.rb
-sample/sample1.rb
-sample/sample2.rb
-sample/maru.gif
-sample/batsu.gif
-sample/sample0.rb
diff --git a/ext/tcltklib/MANUAL.euc b/ext/tcltklib/MANUAL.euc
deleted file mode 100644
index 789e85a9de..0000000000
--- a/ext/tcltklib/MANUAL.euc
+++ /dev/null
@@ -1,124 +0,0 @@
-(tof)
-	MANUAL.euc
-		Sep. 19, 1997	Y. Shigehiro
-
-以下, 「tcl/tk」という表記は, tclsh や wish を実現している, 一般でいう
-ところの tcl/tk を指します. 「tcltk ライブラリ」, 「tcltklib ライブラ
-リ」という表記は, 本パッケージに含まれる ruby 用のライブラリを指します.
-
-<< tcltk ライブラリ >>
-
-tcl/tk の C ライブラリを利用するための高(中?)水準インターフェースを提
-供します.
-
-このライブラリは ruby から tcl/tk ライブラリを利用するためのもので, 内
-部で tcltklib ライブラリを利用しています.
-
-[説明]
-
-tcl/tk インタプリタでは, ウィジェットに何か指示を送るには, ウィジェッ
-ト名に続いてパラメータを書きます. したがって, ウィジェットがオブジェク
-トであり, それに対してメソッドを送っている, とみなすことができます. さ
-て, tcl/tk インタプリタでは, 組み込みコマンドも, 前述のウィジェットと
-同じような書式の命令で実行されます. すなわち, コマンドもオブジェクトで
-あると考えることができます.
-
-このような考えに基づき, tcltk ライブラリでは, tcl/tk のコマンドやウィ
-ジェットに対応するオブジェクトを生成します. オブジェクトに対するメソッ
-ド呼び出しは, e() メソッドにより実行されます. 例えば, tcl/tk の info 
-コマンドに対応する ruby のオブジェクトが info という名前であるとすると,
-tcl/tk の
-	info commands
-という命令は tcltk ライブラリでは
-	info.e("commands")
-と記述されます. また, 「.」というウィジェット (wish 実行時に自動的に生
-成されるルートウィジェット) に対応する ruby のオブジェクトが root とい
-う名前であるとすると,
-	. configure -height 300 -width 300
-という tcl/tk の命令は
-	root.e("configure -height 300 -width 300")
-と記述されます. このような記述は, 見ためには美しくありませんが, そして, 
-スクリプトを読む人には見づらいかも知れませんが, 実際にスクリプトを書い
-てみると予想外に手軽です.
-
-[使用法]
-
-1. ライブラリを読み込む.
-     require "tcltk"
-
-2. tcl/tk インタプリタを生成する.
-     ip = TclTkInterpreter.new()
-
-3. tcl/tk のコマンドに対応するオブジェクトを変数に代入しておく.
-     # コマンドに対応するオブジェクトが入った Hash を取り出す.
-     c = ip.commands()
-     # 使いたいコマンドに対応するオブジェクトを個別の変数に代入する.
-     bind, button, info, wm = c.indexes("bind", "button", "info", "wm")
-
-4. 必要な処理を行う.
-     詳しくは, サンプルを参照のこと.
-
-5. 準備ができたら, イベントループに入る.
-     TclTk.mainloop()
-
-(( 以下, モジュール, クラス等の説明を書く予定.))
-
-
-
-<< tcltklib ライブラリ >>
-
-tcl/tk の C ライブラリを利用するための低水準インターフェースを提供しま
-す.
-
-コンパイル/実行には, tcl/tk の C ライブラリが必要です.
-
-[説明]
-
-このライブラリを用いると, ruby から tcl/tk の C ライブラリを利用できま
-す. 具体的には, ruby インタプリタから tcl/tk インタプリタを呼び出すこ
-とができます. さらに, その(ruby インタプリタから呼び出した) tcl/tk イ
-ンタプリタから, 逆に ruby インタプリタを呼び出すこともできます.
-
-[使用法]
-
-require "tcltklib" すると, 以下のモジュール, クラスが利用可能です.
-
-モジュール TclTkLib
-    tcl/tk ライブラリを呼び出すメソッドを集めたモジュールです. ただし,
-    tcl/tk インタプリタ関係のメソッドはクラス TclTkIp にあります.
-
-  モジュールメソッド mainloop()
-      Tk_MainLoop を実行します. 全ての tk のウインドウが無くなると終了
-      します(例えば, tcl/tk で書くところの "destroy ." をした場合等).
-    引数: 無し
-    戻り値: nil
-
-クラス TclTkIp
-    インスタンスが tcl/tk のインタプリタに対応します. tcl/tk のライブ
-    ラリの仕様通り, インスタンスを複数個生成しても正しく動作します(そ
-    んなことをする必要はあまり無いはずですが). インタプリタは wish の
-    tcl/tk コマンドを実行できます. さらに, 以下のコマンドを実行できま
-    す.
-      コマンド ruby
-	引数を ruby で実行します(ruby_eval_string を実行します). 引数
-	は 1 つでなければなりません. 戻り値は ruby の実行結果です.
-	ruby の実行結果は nil か String でなければなりません.
-
-  クラスメソッド new()
-      TclTkIp クラスのインスタンスを生成します
-    引数: 無し
-    戻り値 (TclTkIp): 生成されたインスタンス
-
-  メソッド _eval(script)
-      インタプリタで script を評価します(Tcl_Eval を実行します). 前述
-      のように, ruby コマンドにより script 内から ruby スクリプトを実
-      行できます.
-    引数: script (String) - インタプリタで評価するスクリプト文字列
-    戻り値 (String): 評価結果 ((Tcl_Interp *)->result)
-
-  メソッド _return_value()
-      直前の Tcl_Eval の戻り値を返します. 0(TCL_OK) で正常終了です.
-    引数: 無し
-    戻り値 (Fixnum): 直前の Tcl_Eval() が返した値.
-
-(eof)
diff --git a/ext/tcltklib/README.euc b/ext/tcltklib/README.euc
deleted file mode 100644
index 290ffb0b60..0000000000
--- a/ext/tcltklib/README.euc
+++ /dev/null
@@ -1,133 +0,0 @@
-(tof)
-	tcltk ライブラリ
-	tcltklib ライブラリ
-		Sep. 19, 1997	Y. Shigehiro
-
-以下, 「tcl/tk」という表記は, tclsh や wish を実現している, 一般でいう
-ところの tcl/tk を指します. 「tcltk ライブラリ」, 「tcltklib ライブラ
-リ」という表記は, 本パッケージに含まれる ruby 用のライブラリを指します.
-
-[ファイルについて]
-
-README.euc : このファイル(注意, 特徴, インストールの方法).
-MANUAL.euc : マニュアル.
-
-lib/, ext/ : ライブラリの実体.
-
-sample/ : マニュアル代わりのサンプルプログラム.
-sample/sample0.rb : tcltklib ライブラリのテスト.
-sample/sample1.rb : tcltk ライブラリのテスト.
-    tcl/tk (wish) でできそうなことを一通り書いてみました.
-sample/sample2.rb : tcltk ライブラリのサンプル.
-    maeda shugo (shugo@po.aianet.ne.jp) 氏による
-    (`rb.tk' で書かれていた) ruby のサンプルプログラム
-	http://www.aianet.or.jp/~shugo/ruby/othello.rb.gz
-    を tcltk ライブラリを使うように, 機械的に変更してみました.
-
-demo/ : 100 本の線を 100 回描くデモプログラム.
-    最初に空ループの時間を測定し, 続いて実際に線を引く時間を測定します.
-    tcl/tk は(再)描画のときに backing store を使わずに律義に 10000 本(?)
-    線を引くので, (再)描画を始めると, マシンがかなり重くなります.
-demo/lines0.tcl : wish 用のスクリプト.
-demo/lines1.rb : `tk.rb' 用のスクリプト.
-demo/lines2.rb : tcltk ライブラリ用のスクリプト.
-
-[注意]
-
-コンパイル/実行には, tcl/tk の C ライブラリが必要です.
-
-このライブラリは,
-
-	ruby-1.0-970701, ruby-1.0-970911, ruby-1.0-970919
-	FreeBSD 2.2.2-RELEASE
-	およびそのパッケージ jp-tcl-7.6.tgz, jp-tk-4.2.tgz
-
-で作成/動作確認しました. 他の環境では動作するかどうかわかりません.
-
-TclTkLib.mainloop を実行中に Control-C が効かないのは不便なので, ruby 
-のソースを参考に, #include "sig.h" して trap_immediate を操作していま
-すが, ruby の README.EXT にも書いてないのに, こんなことをして良いのか
-どうかわかりません.
-
--d オプションでデバッグ情報を表示させるために, ruby のソースを参考に,
-debug という大域変数を参照していますが, ruby の README.EXT にも書いて
-ないのに, こんなことをして良いのかどうかわかりません.
-
-extconf.rb は書きましたが, (いろいろな意味で)これで良いのか良く分かり
-ません.
-
-[特徴]
-
-ruby から tcl/tk ライブラリを利用できます.
-
-tcl/tk インタプリタのスクリプトは, 機械的に tcltk ライブラリ用の ruby 
-スクリプトに変換できます.
-
-(`tk.rb' との違い)
-
-1. tcl/tk インタプリタのスクリプトが, どのように, tcltk ライブラリ用の 
-   ruby スクリプトに変換されるかが理解できれば, マニュアル類が無いに等
-   しい `tk.rb' とは異なり
-
-	tcl/tk のマニュアルやオンラインドキュメントを用いて
-
-   効率良くプログラミングを行うことができます.
-   記述方法がわからない, コマンドに与えるパラメータがわからない...
-     - Canvas.new { ... } と, なぜイテレータブロックを書けるの??
-     - Canvas の bbox は数値のリストを返すのに, xview は文字列を返すの??
-   と, いちいち, ライブラリのソースを追いかける必要はありません.
-
-2. 個々の機能(オプション)を個別処理によりサポートしており, そのためサ
-   ポートしていない機能は使うことができない(本当は使えないこともないの
-   ですが) `tk.rb' とは異なり, tcl/tk インタプリタで可能なことは
-
-	ほとんど
-
-   ruby からも実行できます. 現在, ruby から実行できないことが確認され
-   ているのは,
-
-	bind コマンドでスクリプトを追加する構文
-	「bind tag sequence +script」
-                            ^
-
-   のみです.
-     - `. configure -width' をしようとして, `Tk.root.height()' と書い
-      たのに, `undefined method `height'' と怒られてしまった. tk.rb を
-      読んでみて, ガーン. できないのか...
-   ということはありません.
-
-3. wish プロセスを起動しプロセス間通信で wish を利用する `tk.rb' とは
-   異なり, tcl/tk の C ライブラリをリンクし
-
-	より高速に (といっても, 思った程は速くないですが)
-
-   処理を行います.
-
-4. `tk.rb' ほど, 高水準なインターフェースを備えていないため, tcl/tk イ
-   ンタプリタの生成等
-
-	何から何まで自分で記述
-
-   しなければなりません(その代わり, tcl/tk ライブラリの仕様通り,
-   tcl/tk インタプリタを複数生成することもできますが).
-   インターフェースは(おそらく) ruby の思想に沿ったものではありません. 
-   また, スクリプトの記述は
-
-	ダサダサ
-
-   です. スクリプトは, 一見, 読みづらいものとなります. が, 書く人にとっ
-   ては, それほど煩わしいものではないと思います.
-
-[インストールの方法]
-
-0. ruby のソースファイル(ruby-1.0-なんたら.tgz)を展開しておきます.
-
-1. ruby-1.0-なんたら/ext に ext/tcltklib をコピーします.
-	cp -r ext/tcltklib ???/ruby-1.0-なんたら/ext/
-
-2. ruby のインストール法に従い make 等をします.
-
-3. ruby のライブラリ置場に lib/* をコピーします.
-	cp lib/* /usr/local/lib/ruby/
-
-(eof)
diff --git a/ext/tcltklib/demo/lines0.tcl b/ext/tcltklib/demo/lines0.tcl
deleted file mode 100644
index 8ed3c5e1c1..0000000000
--- a/ext/tcltklib/demo/lines0.tcl
+++ /dev/null
@@ -1,42 +0,0 @@
-#! /usr/local/bin/wish
-
-proc drawlines {} {
-    puts [clock format [clock seconds]]
-
-    for {set j 0} {$j < 100} {incr j} {
-	puts -nonewline "*"
-	flush stdout
-	if {$j & 1} {
-	    set c "blue"
-	} {
-	    set c "red"
-	}
-	for {set i 0} {$i < 100} {incr i} {
-#	    .a create line $i 0 0 [expr 500 - $i] -fill $c
-	}
-    }
-
-    puts [clock format [clock seconds]]
-
-    for {set j 0} {$j < 100} {incr j} {
-	puts -nonewline "*"
-	flush stdout
-	if {$j & 1} {
-	    set c "blue"
-	} {
-	    set c "red"
-	}
-	for {set i 0} {$i < 100} {incr i} {
-	    .a create line $i 0 0 [expr 500 - $i] -fill $c
-	}
-    }
-
-    puts [clock format [clock seconds]]
-#    destroy .
-}
-
-canvas .a -height 500 -width 500
-button .b -text draw -command drawlines
-pack .a .b -side left
-
-# eof
diff --git a/ext/tcltklib/demo/lines1.rb b/ext/tcltklib/demo/lines1.rb
deleted file mode 100644
index e459589f50..0000000000
--- a/ext/tcltklib/demo/lines1.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-#! /usr/local/bin/ruby
-
-require "tk"
-
-def drawlines()
-  print Time.now, "\n"
-
-  for j in 0 .. 99
-    print "*"
-    $stdout.flush
-    if (j & 1) != 0
-      col = "blue"
-    else
-      col = "red"
-    end
-    for i in 0 .. 99
-#      TkcLine.new($a, i, 0, 0, 500 - i, "-fill", col)
-    end
-  end
-
-  print Time.now, "\n"
-
-  for j in 0 .. 99
-    print "*"
-    $stdout.flush
-    if (j & 1) != 0
-      col = "blue"
-    else
-      col = "red"
-    end
-    for i in 0 .. 99
-      TkcLine.new($a, i, 0, 0, 500 - i, "-fill", col)
-    end
-  end
-
-  print Time.now, "\n"
-#  Tk.root.destroy
-end
-
-$a = TkCanvas.new{
-  height(500)
-  width(500)
-}
-
-$b = TkButton.new{
-  text("draw")
-  command(proc{drawlines()})
-}
-
-TkPack.configure($a, $b, {"side"=>"left"})
-
-Tk.mainloop
-
-# eof
diff --git a/ext/tcltklib/demo/lines2.rb b/ext/tcltklib/demo/lines2.rb
deleted file mode 100644
index 9f21ae6377..0000000000
--- a/ext/tcltklib/demo/lines2.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-#! /usr/local/bin/ruby
-
-require "tcltk"
-
-def drawlines()
-  print Time.now, "\n"
-
-  for j in 0 .. 99
-    print "*"
-    $stdout.flush
-    if (j & 1) != 0
-      col = "blue"
-    else
-      col = "red"
-    end
-    for i in 0 .. 99
-#      $a.e("create line", i, 0, 0, 500 - i, "-fill", col)
-    end
-  end
-
-  print Time.now, "\n"
-
-  for j in 0 .. 99
-    print "*"
-    $stdout.flush
-    if (j & 1) != 0
-      col = "blue"
-    else
-      col = "red"
-    end
-    for i in 0 .. 99
-      $a.e("create line", i, 0, 0, 500 - i, "-fill", col)
-    end
-  end
-
-  print Time.now, "\n"
-#  $ip.commands()["destroy"].e($root)
-end
-
-$ip = TclTkInterpreter.new()
-$root = $ip.rootwidget()
-$a = TclTkWidget.new($ip, $root, "canvas", "-height 500 -width 500")
-$c = TclTkCallback.new($ip, proc{drawlines()})
-$b = TclTkWidget.new($ip, $root, "button", "-text draw -command", $c)
-
-$ip.commands()["pack"].e($a, $b, "-side left")
-
-TclTk.mainloop
-
-# eof
diff --git a/ext/tcltklib/depend b/ext/tcltklib/depend
deleted file mode 100644
index 2cd9c400f7..0000000000
--- a/ext/tcltklib/depend
+++ /dev/null
@@ -1,2 +0,0 @@
-tcltklib.o: tcltklib.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
-stubs.o: stubs.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/tcltklib/extconf.rb b/ext/tcltklib/extconf.rb
deleted file mode 100644
index d58c8045a0..0000000000
--- a/ext/tcltklib/extconf.rb
+++ /dev/null
@@ -1,72 +0,0 @@
-# extconf.rb for tcltklib
-
-require 'mkmf'
-
-if RUBY_PLATFORM !~ /mswin32|mingw|cygwin|bccwin32/
-  have_library("nsl", "t_open")
-  have_library("socket", "socket")
-  have_library("dl", "dlopen")
-  have_library("m", "log") 
-end
-
-dir_config("tk")
-dir_config("tcl")
-dir_config("X11")
-
-tklib = with_config("tklib")
-tcllib = with_config("tcllib")
-stubs = enable_config("tcltk_stubs") || with_config("tcltk_stubs")
-
-def find_tcl(tcllib, stubs)
-  paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
-  func = stubs ? "Tcl_InitStubs" : "Tcl_FindExecutable"
-  if tcllib
-    find_library(tcllib, func, *paths)
-  elsif RUBY_PLATFORM =~ /mswin32|mingw|cygwin|bccwin32/
-    find_library("tcl", func, *paths) or
-      find_library("tcl84", func, *paths) or
-      find_library("tcl83", func, *paths) or
-      find_library("tcl82", func, *paths) or
-      find_library("tcl80", func, *paths) or
-      find_library("tcl76", func, *paths)
-  else
-    find_library("tcl", func, *paths) or
-      find_library("tcl8.4", func, *paths) or
-      find_library("tcl8.3", func, *paths) or
-      find_library("tcl8.2", func, *paths) or
-      find_library("tcl8.0", func, *paths) or
-      find_library("tcl7.6", func, *paths)
-  end
-end
-
-def find_tk(tklib, stubs)
-  paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
-  func = stubs ? "Tk_InitStubs" : "Tk_Init"
-  if tklib
-    find_library(tklib, func, *paths)
-  elsif RUBY_PLATFORM =~ /mswin32|mingw|cygwin|bccwin32/
-    find_library("tk", func, *paths) or
-      find_library("tk84", func, *paths) or
-      find_library("tk83", func, *paths) or
-      find_library("tk82", func, *paths) or
-      find_library("tk80", func, *paths) or
-      find_library("tk42", func, *paths)
-  else
-    find_library("tk", func, *paths) or
-      find_library("tk8.4", func, *paths) or
-      find_library("tk8.3", func, *paths) or
-      find_library("tk8.2", func, *paths) or
-      find_library("tk8.0", func, *paths) or
-      find_library("tk4.2", func, *paths)
-  end
-end
-
-if have_header("tcl.h") && have_header("tk.h") &&
-    (/mswin32|mingw|cygwin|bccwin32/ =~ RUBY_PLATFORM || find_library("X11", "XOpenDisplay",
-	"/usr/X11/lib", "/usr/X11R6/lib", "/usr/openwin/lib")) &&
-    find_tcl(tcllib, stubs) &&
-    find_tk(tklib, stubs)
-  $CPPFLAGS += ' -DUSE_TCL_STUBS -DUSE_TK_STUBS' if stubs
-  $CPPFLAGS += ' -D_WIN32' if /cygwin/ =~ RUBY_PLATFORM
-  create_makefile("tcltklib")
-end
diff --git a/ext/tcltklib/lib/tcltk.rb b/ext/tcltklib/lib/tcltk.rb
deleted file mode 100644
index 54a00e8f3c..0000000000
--- a/ext/tcltklib/lib/tcltk.rb
+++ /dev/null
@@ -1,367 +0,0 @@
-# tof
-
-#### tcltk library, more direct manipulation of tcl/tk
-####	Sep. 5, 1997	Y. Shigehiro
-
-require "tcltklib"
-
-################
-
-# module TclTk: collection of tcl/tk utilities (supplies namespace.)
-module TclTk
-
-  # initialize Hash to hold unique symbols and such
-  @namecnt = {}
-
-  # initialize Hash to hold callbacks
-  @callback = {}
-end
-
-# TclTk.mainloop(): call TclTkLib.mainloop()
-def TclTk.mainloop()
-  print("mainloop: start\n") if $DEBUG
-  TclTkLib.mainloop()
-  print("mainloop: end\n") if $DEBUG
-end
-
-# TclTk.deletecallbackkey(ca): remove callback from TclTk module
-#     this does not remove callbacks from tcl/tk interpreter
-#     without calling this method, TclTkInterpreter will not be GCed
-#   ca: callback(TclTkCallback)
-def TclTk.deletecallbackkey(ca)
-  print("deletecallbackkey: ", ca.to_s(), "\n") if $DEBUG
-  @callback.delete(ca.to_s)
-end
-
-# TclTk.dcb(ca, wid, W): call TclTk.deletecallbackkey() for each callbacks
-#     in an array.
-#     this is for callback for top-level 
-#   ca: array of callbacks(TclTkCallback)
-#   wid: top-level widget(TclTkWidget)
-#   w: information about window given by %W(String)
-def TclTk.dcb(ca, wid, w)
-  if wid.to_s() == w
-    ca.each{|i|
-      TclTk.deletecallbackkey(i)
-    }
-  end
-end
-
-# TclTk._addcallback(ca): register callback
-#   ca: callback(TclTkCallback)
-def TclTk._addcallback(ca)
-  print("_addcallback: ", ca.to_s(), "\n") if $DEBUG
-  @callback[ca.to_s()] = ca
-end
-
-# TclTk._callcallback(key, arg): invoke registered callback
-#   key: key to select callback (to_s value of the TclTkCallback)
-#   arg: parameter from tcl/tk interpreter
-def TclTk._callcallback(key, arg)
-  print("_callcallback: ", @callback[key].inspect, "\n") if $DEBUG
-  @callback[key]._call(arg)
-  # throw out callback value
-  # should return String to satisfy rb_eval_string()
-  return ""
-end
-
-# TclTk._newname(prefix): generate unique name(String)
-#   prefix: prefix of the unique name
-def TclTk._newname(prefix)
-  # generated name counter is stored in @namecnt
-  if !@namecnt.key?(prefix)
-    # first appearing prefix, initialize
-    @namecnt[prefix] = 1
-  else
-    # already appeared prefix, generate next name
-    @namecnt[prefix] += 1
-  end
-  return "#{prefix}#{@namecnt[prefix]}"
-end
-
-################
-
-# class TclTkInterpreter: tcl/tk interpreter
-class TclTkInterpreter
-
-  # initialize(): 
-  def initialize()
-    # generate interpreter object
-    @ip = TclTkIp.new()
-
-    # add ruby_fmt command to tcl interpreter
-    # ruby_fmt command format arguments by `format' and call `ruby' command
-    # (notice ruby command receives only one argument)
-    if $DEBUG
-      @ip._eval("proc ruby_fmt {fmt args} { puts \"ruby_fmt: $fmt $args\" ; ruby [format $fmt $args] }")
-    else
-      @ip._eval("proc ruby_fmt {fmt args} { ruby [format $fmt $args] }")
-    end
-
-    # @ip._get_eval_string(*args): generate string to evaluate in tcl interpreter
-    #   *args: script which is going to be evaluated under tcl/tk
-    def @ip._get_eval_string(*args)
-      argstr = ""
-      args.each{|arg|
-	argstr += " " if argstr != ""
-	# call to_eval if it is defined
-	if (arg.respond_to?(:to_eval))
-	  argstr += arg.to_eval()
-	else
-	  # call to_s unless defined
-	  argstr += arg.to_s()
-	end
-      }
-      return argstr
-    end
-
-    # @ip._eval_args(*args): evaluate string under tcl/tk interpreter
-    #     returns result string.
-    #   *args: script which is going to be evaluated under tcl/tk
-    def @ip._eval_args(*args)
-      # calculate the string to eval in the interpreter
-      argstr = _get_eval_string(*args)
-
-      # evaluate under the interpreter
-      print("_eval: \"", argstr, "\"") if $DEBUG
-      res = _eval(argstr)
-      if $DEBUG
-	print(" -> \"", res, "\"\n")
-      elsif  _return_value() != 0
-	print(res, "\n")
-      end
-      fail(%Q/can't eval "#{argstr}"/) if _return_value() != 0 #'
-      return res
-    end
-
-    # generate tcl/tk command object and register in the hash
-    @commands = {}
-    # for all commands registered in tcl/tk interpreter:
-    @ip._eval("info command").split(/ /).each{|comname|
-      if comname =~ /^[.]/
-	# if command is a widget (path), generate TclTkWidget,
-	# and register it in the hash
-	@commands[comname] = TclTkWidget.new(@ip, comname)
-      else
-	# otherwise, generate TclTkCommand
-	@commands[comname] = TclTkCommand.new(@ip, comname)
-      end
-    }
-  end
-
-  # commands(): returns hash of the tcl/tk commands
-  def commands()
-    return @commands
-  end
-
-  # rootwidget(): returns root widget(TclTkWidget)
-  def rootwidget()
-    return @commands["."]
-  end
-
-  # _tcltkip(): returns @ip(TclTkIp)
-  def _tcltkip()
-    return @ip
-  end
-
-  # method_missing(id, *args): execute undefined method as tcl/tk command
-  #   id: method symbol
-  #   *args: method arguments
-  def method_missing(id, *args)
-    # if command named by id registered, then execute it
-    if @commands.key?(id.id2name)
-      return @commands[id.id2name].e(*args)
-    else
-      # otherwise, exception
-      super
-    end
-  end
-end
-
-# class TclTkObject: base class of the tcl/tk objects
-class TclTkObject
-
-  # initialize(ip, exp): 
-  #   ip: interpreter(TclTkIp)
-  #   exp: tcl/tk representation
-  def initialize(ip, exp)
-    fail("type is not TclTkIp") if !ip.kind_of?(TclTkIp)
-    @ip = ip
-    @exp = exp
-  end
-
-  # to_s(): returns tcl/tk representation
-  def to_s()
-    return @exp
-  end
-end
-
-# class TclTkCommand: tcl/tk commands
-# you should not call TclTkCommand.new()
-# commands are created by TclTkInterpreter:initialize()
-class TclTkCommand < TclTkObject
-
-  # e(*args): execute command.  returns String (e is for exec or eval)
-  #   *args: command arguments
-  def e(*args)
-    return @ip._eval_args(to_s(), *args)
-  end
-end
-
-# class TclTkLibCommand: tcl/tk commands in the library
-class TclTkLibCommand < TclTkCommand
-
-  # initialize(ip, name): 
-  #   ip: interpreter(TclTkInterpreter)
-  #   name: command name (String)
-  def initialize(ip, name)
-    super(ip._tcltkip, name)
-  end
-end
-
-# class TclTkVariable: tcl/tk variable
-class TclTkVariable < TclTkObject
-
-  # initialize(interp, dat): 
-  #   interp: interpreter(TclTkInterpreter)
-  #   dat: the value to set(String)
-  #       if nil, not initialize variable
-  def initialize(interp, dat)
-    # auto-generate tcl/tk representation (variable name)
-    exp = TclTk._newname("v_")
-    # initialize TclTkObject
-    super(interp._tcltkip(), exp)
-    # safe this for `set' command
-    @set = interp.commands()["set"]
-    # set value
-    set(dat) if dat
-  end
-
-  # although you can set/refer variable by using set in tcl/tk,
-  # we provide the method for accessing variables
-
-  # set(data): set tcl/tk variable using `set'
-  #   data: new value
-  def set(data)
-    @set.e(to_s(), data.to_s())
-  end
-
-  # get(): read tcl/tk variable(String) using `set'
-  def get()
-    return @set.e(to_s())
-  end
-end
-
-# class TclTkWidget: tcl/tk widget
-class TclTkWidget < TclTkCommand
-
-  # initialize(*args): 
-  #   *args: parameters
-  def initialize(*args)
-    if args[0].kind_of?(TclTkIp)
-      # in case the 1st argument is TclTkIp:
-
-      # Wrap tcl/tk widget by TclTkWidget
-      # (used in TclTkInterpreter#initialize())
-
-      # need two arguments
-      fail("illegal # of parameter") if args.size != 2
-
-      # ip: interpreter(TclTkIp)
-      # exp: tcl/tk representation
-      ip, exp = args
-
-      # initialize TclTkObject
-      super(ip, exp)
-    elsif args[0].kind_of?(TclTkInterpreter)
-      # in case 1st parameter is TclTkInterpreter:
-
-      # generate new widget from parent widget
-
-      # interp: interpreter(TclTkInterpreter)
-      # parent: parent widget
-      # command: widget generating tk command(label 等)
-      # *args: argument to the command 
-      interp, parent, command, *args = args
-
-      # generate widget name
-      exp = parent.to_s()
-      exp += "." if exp !~ /[.]$/
-      exp += TclTk._newname("w_")
-      # initialize TclTkObject
-      super(interp._tcltkip(), exp)
-      # generate widget
-      res = @ip._eval_args(command, exp, *args)
-#      fail("can't create Widget") if res != exp
-      # for tk_optionMenu, it is legal res != exp
-    else
-      fail("first parameter is not TclTkInterpreter")
-    end
-  end
-end
-
-# class TclTkCallback: tcl/tk callbacks
-class TclTkCallback < TclTkObject
-
-  # initialize(interp, pr, arg): 
-  #   interp: interpreter(TclTkInterpreter)
-  #   pr: callback procedure(Proc)
-  #   arg: string to pass as block parameters of pr
-  #       bind command of tcl/tk uses % replacement for parameters
-  #       pr can receive replaced data using block parameter
-  #       its format is specified by arg string
-  #       You should not specify arg for the command like 
-  #       scrollbar with -command option, which receives parameters
-  #       without specifying any replacement
-  def initialize(interp, pr, arg = nil)
-    # auto-generate tcl/tk representation (variable name)
-    exp = TclTk._newname("c_")
-    # initialize TclTkObject
-    super(interp._tcltkip(), exp)
-    # save parameters
-    @pr = pr
-    @arg = arg
-    # register in the module
-    TclTk._addcallback(self)
-  end
-
-  # to_eval(): retuens string representation for @ip._eval_args
-  def to_eval()
-    if @arg
-      # bind replaces %s before calling ruby_fmt, so %%s is used
-      s = %Q/{ruby_fmt {TclTk._callcallback("#{to_s()}", "%%s")} #{@arg}}/
-    else
-      s = %Q/{ruby_fmt {TclTk._callcallback("#{to_s()}", "%s")}}/
-    end
-
-    return s
-  end
-
-  # _call(arg): invoke callback
-  #   arg: callback parameter
-  def _call(arg)
-    @pr.call(arg)
-  end
-end
-
-# class TclTkImage: tcl/tk images
-class TclTkImage < TclTkCommand
-
-  # initialize(interp, t, *args): 
-  #     generating image is done by TclTkImage.new()
-  #     destrying is done by image delete (inconsistent, sigh)
-  #   interp: interpreter(TclTkInterpreter)
-  #   t: image type (photo, bitmap, etc.)
-  #   *args: command argument
-  def initialize(interp, t, *args)
-    # auto-generate tcl/tk representation
-    exp = TclTk._newname("i_")
-    # initialize TclTkObject
-    super(interp._tcltkip(), exp)
-    # generate image
-    res = @ip._eval_args("image create", t, exp, *args)
-    fail("can't create Image") if res != exp
-  end
-end
-
-# eof
diff --git a/ext/tcltklib/sample/batsu.gif b/ext/tcltklib/sample/batsu.gif
deleted file mode 100644
index 880cc73e09..0000000000
Binary files a/ext/tcltklib/sample/batsu.gif and /dev/null differ
diff --git a/ext/tcltklib/sample/maru.gif b/ext/tcltklib/sample/maru.gif
deleted file mode 100644
index 2c0202892e..0000000000
Binary files a/ext/tcltklib/sample/maru.gif and /dev/null differ
diff --git a/ext/tcltklib/sample/sample0.rb b/ext/tcltklib/sample/sample0.rb
deleted file mode 100644
index cd4c8069b4..0000000000
--- a/ext/tcltklib/sample/sample0.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-#! /usr/local/bin/ruby -vd
-
-# tcltklib ライブラリのテスト
-
-require "tcltklib"
-
-def test
-  # インタプリタを生成する
-  ip1 = TclTkIp.new()
-
-  # 評価してみる
-  print ip1._return_value().inspect, "\n"
-  print ip1._eval("puts {abc}").inspect, "\n"
-
-  # ボタンを作ってみる
-  print ip1._return_value().inspect, "\n"
-  print ip1._eval("button .lab -text exit -command \"destroy .\"").inspect,
-    "\n"
-  print ip1._return_value().inspect, "\n"
-  print ip1._eval("pack .lab").inspect, "\n"
-  print ip1._return_value().inspect, "\n"
-
-  # インタプリタから ruby コマンドを評価してみる
-#  print ip1._eval(%q/ruby {print "print by ruby\n"}/).inspect, "\n"
-  print ip1._eval(%q+puts [ruby {print "print by ruby\n"; "puts by tcl/tk"}]+).inspect, "\n"
-  print ip1._return_value().inspect, "\n"
-
-  # もう一つインタプリタを生成してみる
-  ip2 = TclTkIp.new()
-  ip2._eval("button .lab -text test -command \"puts test ; destroy .\"")
-  ip2._eval("pack .lab")
-
-  TclTkLib.mainloop
-end
-
-test
-GC.start
-
-print "exit\n"
diff --git a/ext/tcltklib/sample/sample1.rb b/ext/tcltklib/sample/sample1.rb
deleted file mode 100644
index 21ee0f29d5..0000000000
--- a/ext/tcltklib/sample/sample1.rb
+++ /dev/null
@@ -1,634 +0,0 @@
-#! /usr/local/bin/ruby -d
-#! /usr/local/bin/ruby
-# -d オプションを付けると, デバッグ情報を表示する.
-
-# tcltk ライブラリのサンプル
-
-# まず, ライブラリを require する.
-require "tcltk"
-
-# 以下は, Test1 のインスタンスの initialize() で,
-# tcl/tk に関する処理を行う例である.
-# 必ずしもそのようにする必要は無く,
-# (もし, そうしたければ) class の外で tcl/tk に関する処理を行っても良い.
-
-class Test1
-  # 初期化(インタプリタを生成してウィジェットを生成する).
-  def initialize()
-
-    #### 使う前のおまじない
-
-    # インタプリタの生成.
-    ip = TclTkInterpreter.new()
-    # コマンドに対応するオブジェクトを c に設定しておく.
-    c = ip.commands()
-    # 使用するコマンドに対応するオブジェクトは変数に入れておく.
-    append, bind, button, destroy, incr, info, label, place, set, wm =
-      c.indexes(
-      "append", "bind", "button", "destroy", "incr", "info", "label", "place",
-      "set", "wm")
-
-    #### tcl/tk のコマンドに対応するオブジェクト(TclTkCommand)の操作
-
-    # 実行する時は, e() メソッドを使う.
-    # (以下は, tcl/tk における info command r* を実行.)
-    print info.e("command", "r*"), "\n"
-    # 引数は, まとめた文字列にしても同じ.
-    print info.e("command r*"), "\n"
-    # 変数を用いなくとも実行できるが, 見ためが悪い.
-    print c["info"].e("command", "r*"), "\n"
-    # インタプリタのメソッドとしても実行できるが, 効率が悪い.
-    print ip.info("command", "r*"), "\n"
-
-    ####
-
-    # 以下, 生成したオブジェクトは変数に代入しておかないと
-    # GC の対象になってしまう.
-
-    #### tcl/tk の変数に対応するオブジェクト(TclTkVariable)の操作
-
-    # 生成と同時に値を設定する.
-    v1 = TclTkVariable.new(ip, "20")
-    # 読み出しは get メソッドを使う.
-    print v1.get(), "\n"
-    # 設定は set メソッドを使う.
-    v1.set(40)
-    print v1.get(), "\n"
-    # set コマンドを使って読み出し, 設定は可能だが見ためが悪い.
-    # e() メソッド等の引数に直接 TclTkObject や数値を書いても良い.
-    set.e(v1, 30)
-    print set.e(v1), "\n"
-    # tcl/tk のコマンドで変数を操作できる.
-    incr.e(v1)
-    print v1.get(), "\n"
-    append.e(v1, 10)
-    print v1.get(), "\n"
-
-    #### tcl/tk のウィジェットに対応するオブジェクト(TclTkWidget)の操作
-
-    # ルートウィジェットを取り出す.
-    root = ip.rootwidget()
-    # ウィジェットの操作.
-    root.e("configure -height 300 -width 300")
-    # タイトルを付けるときは wm を使う.
-    wm.e("title", root, $0)
-    # 親ウィジェットとコマンドを指定して, ウィジェットを作る.
-    l1 = TclTkWidget.new(ip, root, label, "-text {type `x' to print}")
-    # place すると表示される.
-    place.e(l1, "-x 0 -rely 0.0 -relwidth 1 -relheight 0.1")
-    # コマンド名は文字列で指定しても良いが, 見ためが悪い.
-    # (コマンド名は独立した引数でなければならない.)
-    l2 = TclTkWidget.new(ip, root, "label")
-    # ウィジェットの操作.
-    l2.e("configure -text {type `q' to exit}")
-    place.e(l2, "-x 0 -rely 0.1 -relwidth 1 -relheight 0.1")
-
-    #### tcl/tk のコールバックに対応するオブジェクト(TclTkCallback)の操作
-
-    # コールバックを生成する.
-    c1 = TclTkCallback.new(ip, proc{sample(ip, root)})
-    # コールバックを持つウィジェットを生成する.
-    b1 = TclTkWidget.new(ip, root, button, "-text sample -command", c1)
-    place.e(b1, "-x 0 -rely 0.2 -relwidth 1 -relheight 0.1")
-    # イベントループを抜けるには destroy.e(root) する.
-    c2 = TclTkCallback.new(ip, proc{destroy.e(root)})
-    b2 = TclTkWidget.new(ip, root, button, "-text exit -command", c2)
-    place.e(b2, "-x 0 -rely 0.3 -relwidth 1 -relheight 0.1")
-
-    #### イベントのバインド
-    # script の追加 (bind tag sequence +script) は今のところできない.
-    # (イテレータ変数の設定がうまくいかない.)
-
-    # 基本的にはウィジェットに対するコールバックと同じ.
-    c3 = TclTkCallback.new(ip, proc{print("q pressed\n"); destroy.e(root)})
-    bind.e(root, "q", c3)
-    # bind コマンドで % 置換によりパラメータを受け取りたいときは,
-    # proc{} の後ろに文字列で指定すると,
-    # 置換結果をイテレータ変数を通して受け取ることができる.
-    # ただし proc{} の後ろの文字列は,
-    # bind コマンドに与えるコールバック以外で指定してはいけない.
-    c4 = TclTkCallback.new(ip, proc{|i| print("#{i} pressed\n")}, "%A")
-    bind.e(root, "x", c4)
-    # TclTkCallback を GC の対象にしたければ,
-    # dcb() (または deletecallbackkeys()) する必要がある.
-    cb = [c1, c2, c3, c4]
-    c5 = TclTkCallback.new(ip, proc{|w| TclTk.dcb(cb, root, w)}, "%W")
-    bind.e(root, "", c5)
-    cb.push(c5)
-
-    #### tcl/tk のイメージに対応するオブジェクト(TclTkImage)の操作
-
-    # データを指定して生成する.
-    i1 = TclTkImage.new(ip, "photo", "-file maru.gif")
-    # ラベルに張り付けてみる.
-    l3 = TclTkWidget.new(ip, root, label, "-relief raised -image", i1)
-    place.e(l3, "-x 0 -rely 0.4 -relwidth 0.2 -relheight 0.2")
-    # 空のイメージを生成して後で操作する.
-    i2 = TclTkImage.new(ip, "photo")
-    # イメージを操作する.
-    i2.e("copy", i1)
-    i2.e("configure -gamma 0.5")
-    l4 = TclTkWidget.new(ip, root, label, "-relief raised -image", i2)
-    place.e(l4, "-relx 0.2 -rely 0.4 -relwidth 0.2 -relheight 0.2")
-
-    ####
-  end
-
-  # サンプルのためのウィジェットを生成する.
-  def sample(ip, parent)
-    bind, button, destroy, grid, toplevel, wm = ip.commands().indexes(
-      "bind", "button", "destroy", "grid", "toplevel", "wm")
-
-    ## toplevel
-
-    # 新しいウインドウを開くには, toplevel を使う.
-    t1 = TclTkWidget.new(ip, parent, toplevel)
-    # タイトルを付けておく
-    wm.e("title", t1, "sample")
-
-    # ウィジェットが破壊されたとき, コールバックが GC の対象になるようにする.
-    cb = []
-    cb.push(c = TclTkCallback.new(ip, proc{|w| TclTk.dcb(cb, t1, w)}, "%W"))
-    bind.e(t1, "", c)
-
-    # ボタンの生成.
-    wid = []
-    # toplevel ウィジェットを破壊するには destroy する.
-    cb.push(c = TclTkCallback.new(ip, proc{destroy.e(t1)}))
-    wid.push(TclTkWidget.new(ip, t1, button, "-text close -command", c))
-    cb.push(c = TclTkCallback.new(ip, proc{test_label(ip, t1)}))
-    wid.push(TclTkWidget.new(ip, t1, button, "-text label -command", c))
-    cb.push(c = TclTkCallback.new(ip, proc{test_button(ip, t1)}))
-    wid.push(TclTkWidget.new(ip, t1, button, "-text button -command", c))
-    cb.push(c = TclTkCallback.new(ip, proc{test_checkbutton(ip, t1)}))
-    wid.push(TclTkWidget.new(ip, t1, button, "-text checkbutton -command", c))
-    cb.push(c = TclTkCallback.new(ip, proc{test_radiobutton(ip, t1)}))
-    wid.push(TclTkWidget.new(ip, t1, button, "-text radiobutton -command", c))
-    cb.push(c = TclTkCallback.new(ip, proc{test_scale(ip, t1)}))
-    wid.push(TclTkWidget.new(ip, t1, button, "-text scale -command", c))
-    cb.push(c = TclTkCallback.new(ip, proc{test_entry(ip, t1)}))
-    wid.push(TclTkWidget.new(ip, t1, button, "-text entry -command", c))
-    cb.push(c = TclTkCallback.new(ip, proc{test_text(ip, t1)}))
-    wid.push(TclTkWidget.new(ip, t1, button, "-text text -command", c))
-    cb.push(c = TclTkCallback.new(ip, proc{test_raise(ip, t1)}))
-    wid.push(TclTkWidget.new(ip, t1, button, "-text raise/lower -command", c))
-    cb.push(c = TclTkCallback.new(ip, proc{test_modal(ip, t1)}))
-    wid.push(TclTkWidget.new(ip, t1, button, "-text message/modal -command",
-      c))
-    cb.push(c = TclTkCallback.new(ip, proc{test_menu(ip, t1)}))
-    wid.push(TclTkWidget.new(ip, t1, button, "-text menu -command", c))
-    cb.push(c = TclTkCallback.new(ip, proc{test_listbox(ip, t1)}))
-    wid.push(TclTkWidget.new(ip, t1, button, "-text listbox/scrollbar",
-      "-command", c))
-    cb.push(c = TclTkCallback.new(ip, proc{test_canvas(ip, t1)}))
-    wid.push(TclTkWidget.new(ip, t1, button, "-text canvas -command", c))
-
-    # grid で表示する.
-    ro = co = 0
-    wid.each{|w|
-      grid.e(w, "-row", ro, "-column", co, "-sticky news")
-      ro += 1
-      if ro == 7
-	ro = 0
-	co += 1
-      end
-    }
-  end
-
-  # inittoplevel(ip, parent, title)
-  #   以下の処理をまとめて行う.
-  #       1. toplevel ウィジェットを作成する.
-  #       2. コールバックを登録する配列を用意し, toplevel ウィジェットの
-  #          イベントにコールバックを削除する手続きを登録する.
-  #       3. クローズボタンを作る.
-  #     作成した toplevel ウィジェット, クローズボタン, コールバック登録用変数
-  #     を返す.
-  #   ip: インタプリタ
-  #   parent: 親ウィジェット
-  #   title: toplevel ウィジェットのウインドウのタイトル
-  def inittoplevel(ip, parent, title)
-    bind, button, destroy, toplevel, wm = ip.commands().indexes(
-      "bind", "button", "destroy", "toplevel", "wm")
-
-    # 新しいウインドウを開くには, toplevel を使う.
-    t1 = TclTkWidget.new(ip, parent, toplevel)
-    # タイトルを付けておく
-    wm.e("title", t1, title)
-
-    # ウィジェットが破壊されたとき, コールバックが GC の対象になるようにする.
-    cb = []
-    cb.push(c = TclTkCallback.new(ip, proc{|w| TclTk.dcb(cb, t1, w)}, "%W"))
-    bind.e(t1, "", c)
-    # close ボタンを作っておく.
-    # toplevel ウィジェットを破壊するには destroy する.
-    cb.push(c = TclTkCallback.new(ip, proc{destroy.e(t1)}))
-    b1 = TclTkWidget.new(ip, t1, button, "-text close -command", c)
-
-    return t1, b1, cb
-  end
-
-  # label のサンプル.
-  def test_label(ip, parent)
-    button, global, label, pack = ip.commands().indexes(
-      "button", "global", "label", "pack")
-    t1, b1, cb = inittoplevel(ip, parent, "label")
-
-    ## label
-
-    # いろいろな形のラベル.
-    l1 = TclTkWidget.new(ip, t1, label, "-text {default(flat)}")
-    l2 = TclTkWidget.new(ip, t1, label, "-text raised -relief raised")
-    l3 = TclTkWidget.new(ip, t1, label, "-text sunken -relief sunken")
-    l4 = TclTkWidget.new(ip, t1, label, "-text groove -relief groove")
-    l5 = TclTkWidget.new(ip, t1, label, "-text ridge -relief ridge")
-    l6 = TclTkWidget.new(ip, t1, label, "-bitmap error")
-    l7 = TclTkWidget.new(ip, t1, label, "-bitmap questhead")
-
-    # pack しても表示される.
-    pack.e(b1, l1, l2, l3, l4, l5, l6, l7, "-pady 3")
-
-    ## -textvariable
-
-    # tcltk ライブラリの実装では, コールバックは tcl/tk の``手続き''を通して
-    # 呼ばれる. したがって, コールバックの中で(大域)変数にアクセスするときは,
-    # global する必要がある.
-    # global する前に変数に値を設定してしまうとエラーになるので,
-    # tcl/tk における表現形だけ生成して, 実際に値を設定しないように,
-    # 2 番目の引数には nil を与える.
-    v1 = TclTkVariable.new(ip, nil)
-    global.e(v1)
-    v1.set(100)
-    # -textvariable で変数を設定する.
-    l6 = TclTkWidget.new(ip, t1, label, "-textvariable", v1)
-    # コールバックの中から変数を操作する.
-    cb.push(c = TclTkCallback.new(ip, proc{
-      global.e(v1); v1.set(v1.get().to_i + 10)}))
-    b2 = TclTkWidget.new(ip, t1, button, "-text +10 -command", c)
-    cb.push(c = TclTkCallback.new(ip, proc{
-      global.e(v1); v1.set(v1.get().to_i - 10)}))
-    b3 = TclTkWidget.new(ip, t1, button, "-text -10 -command", c)
-    pack.e(l6, b2, b3)
-  end
-
-  # button のサンプル.
-  def test_button(ip, parent)
-    button, pack = ip.commands().indexes("button", "pack")
-    t1, b1, cb = inittoplevel(ip, parent, "button")
-
-    ## button
-
-    # コールバック内で参照する変数は先に宣言しておかなければならない.
-    b3 = b4 = nil
-    cb.push(c = TclTkCallback.new(ip, proc{b3.e("flash"); b4.e("flash")}))
-    b2 = TclTkWidget.new(ip, t1, button, "-text flash -command", c)
-    cb.push(c = TclTkCallback.new(ip, proc{b2.e("configure -state normal")}))
-    b3 = TclTkWidget.new(ip, t1, button, "-text normal -command", c)
-    cb.push(c = TclTkCallback.new(ip, proc{b2.e("configure -state disabled")}))
-    b4 = TclTkWidget.new(ip, t1, button, "-text disable -command", c)
-    pack.e(b1, b2, b3, b4)
-  end
-
-  # checkbutton のサンプル.
-  def test_checkbutton(ip, parent)
-    checkbutton, global, pack = ip.commands().indexes(
-      "checkbutton", "global", "pack")
-    t1, b1, cb = inittoplevel(ip, parent, "checkbutton")
-
-    ## checkbutton
-
-    v1 = TclTkVariable.new(ip, nil)
-    global.e(v1)
-    # -variable で変数を設定する.
-    ch1 = TclTkWidget.new(ip, t1, checkbutton, "-onvalue on -offvalue off",
-      "-textvariable", v1, "-variable", v1)
-    pack.e(b1, ch1)
-  end
-
-  # radiobutton のサンプル.
-  def test_radiobutton(ip, parent)
-    global, label, pack, radiobutton = ip.commands().indexes(
-      "global", "label", "pack", "radiobutton")
-    t1, b1, cb = inittoplevel(ip, parent, "radiobutton")
-
-    ## radiobutton
-
-    v1 = TclTkVariable.new(ip, nil)
-    global.e(v1)
-    # ヌルストリングは "{}" で指定する.
-    v1.set("{}")
-    l1 = TclTkWidget.new(ip, t1, label, "-textvariable", v1)
-    # -variable で同じ変数を指定すると同じグループになる.
-    ra1 = TclTkWidget.new(ip, t1, radiobutton,
-      "-text radio1 -value r1 -variable", v1)
-    ra2 = TclTkWidget.new(ip, t1, radiobutton,
-      "-text radio2 -value r2 -variable", v1)
-    cb.push(c = TclTkCallback.new(ip, proc{global.e(v1); v1.set("{}")}))
-    ra3 = TclTkWidget.new(ip, t1, radiobutton,
-      "-text clear -value r3 -variable", v1, "-command", c)
-    pack.e(b1, l1, ra1, ra2, ra3)
-  end
-
-  # scale のサンプル.
-  def test_scale(ip, parent)
-    global, pack, scale = ip.commands().indexes(
-      "global", "pack", "scale")
-    t1, b1, cb = inittoplevel(ip, parent, "scale")
-
-    ## scale
-
-    v1 = TclTkVariable.new(ip, nil)
-    global.e(v1)
-    v1.set(219)
-    # コールバック内で参照する変数は先に宣言しておかなければならない.
-    sca1 = nil
-    cb.push(c = TclTkCallback.new(ip, proc{global.e(v1); v = v1.get();
-      sca1.e("configure -background", format("#%02x%02x%02x", v, v, v))}))
-    sca1 = TclTkWidget.new(ip, t1, scale,
-      "-label scale -orient h -from 0 -to 255 -variable", v1, "-command", c)
-    pack.e(b1, sca1)
-  end
-
-  # entry のサンプル.
-  def test_entry(ip, parent)
-    button, entry, global, pack = ip.commands().indexes(
-      "button", "entry", "global", "pack")
-    t1, b1, cb = inittoplevel(ip, parent, "entry")
-
-    ## entry
-
-    v1 = TclTkVariable.new(ip, nil)
-    global.e(v1)
-    # ヌルストリングは "{}" で指定する.
-    v1.set("{}")
-    en1 = TclTkWidget.new(ip, t1, entry, "-textvariable", v1)
-    cb.push(c = TclTkCallback.new(ip, proc{
-      global.e(v1); print(v1.get(), "\n"); v1.set("{}")}))
-    b2 = TclTkWidget.new(ip, t1, button, "-text print -command", c)
-    pack.e(b1, en1, b2)
-  end
-
-  # text のサンプル.
-  def test_text(ip, parent)
-    button, pack, text = ip.commands().indexes(
-      "button", "pack", "text")
-    t1, b1, cb = inittoplevel(ip, parent, "text")
-
-    ## text
-
-    te1 = TclTkWidget.new(ip, t1, text)
-    cb.push(c = TclTkCallback.new(ip, proc{
-      # 1 行目の 0 文字目から最後までを表示し, 削除する.
-      print(te1.e("get 1.0 end")); te1.e("delete 1.0 end")}))
-    b2 = TclTkWidget.new(ip, t1, button, "-text print -command", c)
-    pack.e(b1, te1, b2)
-  end
-
-  # raise/lower のサンプル.
-  def test_raise(ip, parent)
-    button, frame, lower, pack, raise = ip.commands().indexes(
-      "button", "frame", "lower", "pack", "raise")
-    t1, b1, cb = inittoplevel(ip, parent, "raise/lower")
-
-    ## raise/lower
-
-    # button を隠すテストのために, frame を使う.
-    f1 = TclTkWidget.new(ip, t1, frame)
-    # コールバック内で参照する変数は先に宣言しておかなければならない.
-    b2 = nil
-    cb.push(c = TclTkCallback.new(ip, proc{raise.e(f1, b2)}))
-    b2 = TclTkWidget.new(ip, t1, button, "-text raise -command", c)
-    cb.push(c = TclTkCallback.new(ip, proc{lower.e(f1, b2)}))
-    b3 = TclTkWidget.new(ip, t1, button, "-text lower -command", c)
-    lower.e(f1, b3)
-
-    pack.e(b2, b3, "-in", f1)
-    pack.e(b1, f1)
-  end
-
-  # modal なウィジェットのサンプル.
-  def test_modal(ip, parent)
-    button, frame, message, pack, tk_chooseColor, tk_getOpenFile,
-      tk_messageBox = ip.commands().indexes(
-      "button", "frame", "message", "pack", "tk_chooseColor",
-      "tk_getOpenFile", "tk_messageBox")
-    # 最初に load されていないライブラリは ip.commands() に存在しないので,
-    # TclTkLibCommand を生成する必要がある.
-    tk_dialog = TclTkLibCommand.new(ip, "tk_dialog")
-    t1, b1, cb = inittoplevel(ip, parent, "message/modal")
-
-    ## message
-
-    mes = "これは message ウィジェットのテストです."
-    mes += "以下は modal なウィジェットのテストです."
-    me1 = TclTkWidget.new(ip, t1, message, "-text {#{mes}}")
-
-    ## modal
-
-    # tk_messageBox
-    cb.push(c = TclTkCallback.new(ip, proc{
-      print tk_messageBox.e("-type yesnocancel -message messageBox",
-      "-icon error -default cancel -title messageBox"), "\n"}))
-    b2 = TclTkWidget.new(ip, t1, button, "-text messageBox -command", c)
-    # tk_dialog
-    cb.push(c = TclTkCallback.new(ip, proc{
-      # ウィジェット名を生成するためにダミーの frame を生成.
-      print tk_dialog.e(TclTkWidget.new(ip, t1, frame),
-      "dialog dialog error 2 yes no cancel"), "\n"}))
-    b3 = TclTkWidget.new(ip, t1, button, "-text dialog -command", c)
-    # tk_chooseColor
-    cb.push(c = TclTkCallback.new(ip, proc{
-      print tk_chooseColor.e("-title chooseColor"), "\n"}))
-    b4 = TclTkWidget.new(ip, t1, button, "-text chooseColor -command", c)
-    # tk_getOpenFile
-    cb.push(c = TclTkCallback.new(ip, proc{
-      print tk_getOpenFile.e("-defaultextension .rb",
-      "-filetypes {{{Ruby Script} {.rb}} {{All Files} {*}}}",
-      "-title getOpenFile"), "\n"}))
-    b5 = TclTkWidget.new(ip, t1, button, "-text getOpenFile -command", c)
-
-    pack.e(b1, me1, b2, b3, b4, b5)
-  end
-
-  # menu のサンプル.
-  def test_menu(ip, parent)
-    global, menu, menubutton, pack = ip.commands().indexes(
-      "global", "menu", "menubutton", "pack")
-    tk_optionMenu = TclTkLibCommand.new(ip, "tk_optionMenu")
-    t1, b1, cb = inittoplevel(ip, parent, "menu")
-
-    ## menu
-
-    # menubutton を生成する.
-    mb1 = TclTkWidget.new(ip, t1, menubutton, "-text menu")
-    # menu を生成する.
-    me1 = TclTkWidget.new(ip, mb1, menu)
-    # mb1 から me1 が起動されるようにする.
-    mb1.e("configure -menu", me1)
-
-    # cascade で起動される menu を生成する.
-    me11 = TclTkWidget.new(ip, me1, menu)
-    # radiobutton のサンプル.
-    v1 = TclTkVariable.new(ip, nil); global.e(v1); v1.set("r1")
-    me11.e("add radiobutton -label radio1 -value r1 -variable", v1)
-    me11.e("add radiobutton -label radio2 -value r2 -variable", v1)
-    me11.e("add radiobutton -label radio3 -value r3 -variable", v1)
-    # cascade により mb11 が起動されるようにする.
-    me1.e("add cascade -label cascade -menu", me11)
-
-    # checkbutton のサンプル.
-    v2 = TclTkVariable.new(ip, nil); global.e(v2); v2.set("none")
-    me1.e("add checkbutton -label check -variable", v2)
-    # separator のサンプル.
-    me1.e("add separator")
-    # command のサンプル.
-    v3 = nil
-    cb.push(c = TclTkCallback.new(ip, proc{
-      global.e(v1, v2, v3); print "v1: ", v1.get(), ", v2: ", v2.get(),
-      ", v3: ", v3.get(), "\n"}))
-    me1.e("add command -label print -command", c)
-
-    ## tk_optionMenu
-
-    v3 = TclTkVariable.new(ip, nil); global.e(v3); v3.set("opt2")
-    om1 = TclTkWidget.new(ip, t1, tk_optionMenu, v3, "opt1 opt2 opt3 opt4")
-
-    pack.e(b1, mb1, om1, "-side left")
-  end
-
-  # listbox のサンプル.
-  def test_listbox(ip, parent)
-    clipboard, frame, grid, listbox, lower, menu, menubutton, pack, scrollbar,
-      selection = ip.commands().indexes(
-      "clipboard", "frame", "grid", "listbox", "lower", "menu", "menubutton",
-      "pack", "scrollbar", "selection")
-    t1, b1, cb = inittoplevel(ip, parent, "listbox")
-
-    ## listbox/scrollbar
-
-    f1 = TclTkWidget.new(ip, t1, frame)
-    # コールバック内で参照する変数は先に宣言しておかなければならない.
-    li1 = sc1 = sc2 = nil
-    # 実行時に, 後ろにパラメータがつくコールバックは,
-    # イテレータ変数でそのパラメータを受け取ることができる.
-    # (複数のパラメータはひとつの文字列にまとめられる.)
-    cb.push(c1 = TclTkCallback.new(ip, proc{|i| li1.e("xview", i)}))
-    cb.push(c2 = TclTkCallback.new(ip, proc{|i| li1.e("yview", i)}))
-    cb.push(c3 = TclTkCallback.new(ip, proc{|i| sc1.e("set", i)}))
-    cb.push(c4 = TclTkCallback.new(ip, proc{|i| sc2.e("set", i)}))
-    # listbox
-    li1 = TclTkWidget.new(ip, f1, listbox,
-      "-xscrollcommand", c3, "-yscrollcommand", c4,
-      "-selectmode extended -exportselection true")
-    for i in 1..20
-      li1.e("insert end {line #{i} line #{i} line #{i} line #{i} line #{i}}")
-    end
-    # scrollbar
-    sc1 = TclTkWidget.new(ip, f1, scrollbar, "-orient horizontal -command", c1)
-    sc2 = TclTkWidget.new(ip, f1, scrollbar, "-orient vertical -command", c2)
-
-    ## selection/clipboard
-
-    mb1 = TclTkWidget.new(ip, t1, menubutton, "-text edit")
-    me1 = TclTkWidget.new(ip, mb1, menu)
-    mb1.e("configure -menu", me1)
-    cb.push(c = TclTkCallback.new(ip, proc{
-      # clipboard をクリア.
-      clipboard.e("clear")
-      # selection から文字列を読み込み clipboard に追加する.
-      clipboard.e("append {#{selection.e('get')}}")}))
-    me1.e("add command -label {selection -> clipboard} -command",c)
-    cb.push(c = TclTkCallback.new(ip, proc{
-      # li1 をクリア.
-      li1.e("delete 0 end")
-      # clipboard から文字列を取り出し, 1 行ずつ
-      selection.e("get -selection CLIPBOARD").split(/\n/).each{|line|
-        # li1 に挿入する.
-        li1.e("insert end {#{line}}")}}))
-    me1.e("add command -label {clipboard -> listbox} -command",c)
-
-    grid.e(li1, "-row 0 -column 0 -sticky news")
-    grid.e(sc1, "-row 1 -column 0 -sticky ew")
-    grid.e(sc2, "-row 0 -column 1 -sticky ns")
-    grid.e("rowconfigure", f1, "0 -weight 100")
-    grid.e("columnconfigure", f1, "0 -weight 100")
-    f2 = TclTkWidget.new(ip, t1, frame)
-    lower.e(f2, b1)
-    pack.e(b1, mb1, "-in", f2, "-side left")
-    pack.e(f2, f1)
-  end
-
-  # canvas のサンプル.
-  def test_canvas(ip, parent)
-    canvas, lower, pack = ip.commands().indexes("canvas", "lower", "pack")
-    t1, b1, cb = inittoplevel(ip, parent, "canvas")
-
-    ## canvas
-
-    ca1 = TclTkWidget.new(ip, t1, canvas, "-width 400 -height 300")
-    lower.e(ca1, b1)
-    # rectangle を作る.
-    idr = ca1.e("create rectangle 10 10 20 20")
-    # oval を作る.
-    ca1.e("create oval 60 10 100 50")
-    # polygon を作る.
-    ca1.e("create polygon 110 10 110 30 140 10")
-    # line を作る.
-    ca1.e("create line 150 10 150 30 190 10")
-    # arc を作る.
-    ca1.e("create arc 200 10 250 50 -start 0 -extent 90 -style pieslice")
-    # i1 は本当は, どこかで破壊しなければならないが, 面倒なので放ってある.
-    i1 = TclTkImage.new(ip, "photo", "-file maru.gif")
-    # image を作る.
-    ca1.e("create image 100 100 -image", i1)
-    # bitmap を作る.
-    ca1.e("create bitmap 260 50 -bitmap questhead")
-    # text を作る.
-    ca1.e("create text 320 50 -text {drag rectangle}")
-    # window を作る(クローズボタン).
-    ca1.e("create window 200 200 -window", b1)
-
-    # bind により rectangle を drag できるようにする.
-    cb.push(c = TclTkCallback.new(ip, proc{|i|
-      # i に x と y を受け取るので, 取り出す.
-      x, y = i.split(/ /); x = x.to_f; y = y.to_f
-      # 座標を変更する.
-      ca1.e("coords current #{x - 5} #{y - 5} #{x + 5} #{y + 5}")},
-      # x, y 座標を空白で区切ったものをイテレータ変数へ渡すように指定.
-      "%x %y"))
-    # rectangle に bind する.
-    ca1.e("bind", idr, "", c)
-
-    pack.e(ca1)
-  end
-end
-
-# test driver
-
-if ARGV.size == 0
-  print "#{$0} n で, n 個のインタプリタを起動します.\n"
-  n = 1
-else
-  n = ARGV[0].to_i
-end
-
-print "start\n"
-ip = []
-
-# インタプリタ, ウィジェット等の生成.
-for i in 1 .. n
-  ip.push(Test1.new())
-end
-
-# 用意ができたらイベントループに入る.
-TclTk.mainloop()
-print "exit from mainloop\n"
-
-# インタプリタが GC されるかのテスト.
-ip = []
-print "GC.start\n" if $DEBUG
-GC.start() if $DEBUG
-print "end\n"
-
-exit
-
-# end
diff --git a/ext/tcltklib/sample/sample2.rb b/ext/tcltklib/sample/sample2.rb
deleted file mode 100644
index 969d8de09a..0000000000
--- a/ext/tcltklib/sample/sample2.rb
+++ /dev/null
@@ -1,449 +0,0 @@
-#!/usr/local/bin/ruby
-#----------------------> pretty simple othello game <-----------------------
-# othello.rb
-#
-# version 0.3
-# maeda shugo (shuto@po.aianet.ne.jp)
-#---------------------------------------------------------------------------
-
-#	Sep. 17, 1997	modified by Y. Shigehiro for tcltk library
-#	   maeda shugo (shugo@po.aianet.ne.jp) 氏による
-#          (ruby/tk で書かれていた) ruby のサンプルプログラム
-#		http://www.aianet.or.jp/~shugo/ruby/othello.rb.gz
-#	   を tcltk ライブラリを使うように, 機械的に変更してみました.
-#
-#	   なるべくオリジナルと同じになるようにしてあります.
-
-require "observer"
-require "tcltk"
-$ip = TclTkInterpreter.new()
-$root = $ip.rootwidget()
-$button, $canvas, $checkbutton, $frame, $label, $pack, $update, $wm =
-   $ip.commands().indexes(
-   "button", "canvas", "checkbutton", "frame", "label", "pack", "update", "wm")
-
-class Othello
-   
-   EMPTY = 0
-   BLACK = 1
-   WHITE = - BLACK
-   
-   attr :in_com_turn
-   attr :game_over
-   
-   class Board
-   
-      include Observable
-      
-      DIRECTIONS = [
-	 [-1, -1], [-1, 0], [-1, 1],
-	 [ 0, -1],          [ 0, 1],
-	 [ 1, -1], [ 1, 0], [ 1, 1]
-      ]
-      
-      attr :com_disk, TRUE
-   
-      def initialize(othello)
-	 @othello = othello
-	 reset
-      end
-   
-      def notify_observers(*arg)
-	 if @observer_peers != nil
-	    super(*arg)
-	 end
-      end
-      
-      def reset
-	 @data = [
-	    [EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY],
-	    [EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY],
-	    [EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY],
-	    [EMPTY, EMPTY, EMPTY, WHITE, BLACK, EMPTY, EMPTY, EMPTY],
-	    [EMPTY, EMPTY, EMPTY, BLACK, WHITE, EMPTY, EMPTY, EMPTY],
-	    [EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY],
-	    [EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY],
-	    [EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY]
-	 ]
-	 changed
-	 notify_observers
-      end
-      
-      def man_disk
-	 return - @com_disk
-      end
-      
-      def other_disk(disk)
-	 return - disk
-      end
-      
-      def get_disk(row, col)
-	 return @data[row][col]
-      end
-      
-      def reverse_to(row, col, my_disk, dir_y, dir_x)
-	 y = row
-	 x = col
-	 begin
-	    y += dir_y
-	    x += dir_x
-	    if y < 0 || x < 0 || y > 7 || x > 7 ||
-		  @data[y][x] == EMPTY
-	       return
-	    end
-	 end until @data[y][x] == my_disk
-	 begin
-	    @data[y][x] = my_disk
-	    changed
-	    notify_observers(y, x)
-	    y -= dir_y
-	    x -= dir_x
-	 end until y == row && x == col
-      end
-      
-      def put_disk(row, col, disk)
-	 @data[row][col] = disk
-	 changed
-	 notify_observers(row, col)
-	 DIRECTIONS.each do |dir|
-	    reverse_to(row, col, disk, *dir)
-	 end
-      end
-      
-      def count_disk(disk)
-	 num = 0
-	 @data.each do |rows|
-	    rows.each do |d|
-	       if d == disk
-		  num += 1
-	       end
-	    end
-	 end
-	 return num
-      end
-      
-      def count_point_to(row, col, my_disk, dir_y, dir_x)
-	 return 0 if @data[row][col] != EMPTY
-	 count = 0
-	 loop do
-	    row += dir_y
-	    col += dir_x
-	    break if row < 0 || col < 0 || row > 7 || col > 7
-	    case @data[row][col]
-	    when my_disk
-	       return count
-	    when other_disk(my_disk)
-	       count += 1
-	    when EMPTY
-	       break
-	    end
-	 end
-	 return 0
-      end
-      
-      def count_point(row, col, my_disk)
-	 count = 0
-	 DIRECTIONS.each do |dir|
-	    count += count_point_to(row, col, my_disk, *dir)
-	 end
-	 return count
-      end
-      
-      def corner?(row, col)
-	 return (row == 0 && col == 0) ||
-	    (row == 0 && col == 7) ||
-	    (row == 7 && col == 0) ||
-	    (row == 7 && col == 7)
-      end
-      
-      def search(my_disk)
-	 max = 0
-	 max_row = nil
-	 max_col = nil
-	 for row in 0 .. 7
-	    for col in 0 .. 7
-	       buf = count_point(row, col, my_disk)
-	       if (corner?(row, col) && buf > 0) || max < buf
-		  max = buf
-		  max_row = row
-		  max_col = col
-	       end
-	    end
-	 end
-	 return max_row, max_col
-      end
-   end #--------------------------> class Board ends here
-   
-   class BoardView < TclTkWidget
-      
-      BACK_GROUND_COLOR = "DarkGreen"
-      HILIT_BG_COLOR = "green"
-      BORDER_COLOR = "black"
-      BLACK_COLOR = "black"
-      WHITE_COLOR = "white"
-      STOP_COLOR = "red"
-      
-      attr :left
-      attr :top
-      attr :right
-      attr :bottom
-      
-      class Square
-	 
-	 attr :oval, TRUE
-	 attr :row
-	 attr :col
-	 
-	 def initialize(view, row, col)
-	    @view = view
-	    @id = @view.e("create rectangle", *view.tk_rect(view.left + col,
-				      view.top + row,
-				      view.left + col + 1,
-				      view.top + row + 1))
-	    @row = row
-	    @col = col
-	    @view.e("itemconfigure", @id,
-	      "-width 0.5m -outline #{BORDER_COLOR}")
-	    @view.e("bind", @id, "", TclTkCallback.new($ip, proc{
-	       if @oval == nil
-		  view.e("itemconfigure", @id, "-fill #{HILIT_BG_COLOR}")
-	       end
-	    }))
-	    @view.e("bind", @id, "", TclTkCallback.new($ip, proc{
-	       view.e("itemconfigure", @id, "-fill #{BACK_GROUND_COLOR}")
-	    }))
-	    @view.e("bind", @id, "", TclTkCallback.new($ip,
-	       proc{
-	       view.click_square(self)
-	    }))
-	 end
-	 
-	 def blink(color)
-	    @view.e("itemconfigure", @id, "-fill #{color}")
-	    $update.e()
-	    sleep(0.1)
-	    @view.e("itemconfigure", @id, "-fill #{BACK_GROUND_COLOR}")
-	 end
-      end #-----------------------> class Square ends here
-   
-      def initialize(othello, board)
-	 super($ip, $root, $canvas)
-	 @othello = othello
-	 @board = board
-	 @board.add_observer(self)
-	 
-	 @squares = Array.new(8)
-	 for i in 0 .. 7
-	    @squares[i] = Array.new(8)
-	 end
-	 @left = 1
-	 @top = 0.5
-	 @right = @left + 8
-	 @bottom = @top + 8
-	 
-	 i = self.e("create rectangle", *tk_rect(@left, @top, @right, @bottom))
-	 self.e("itemconfigure", i,
-	    "-width 1m -outline #{BORDER_COLOR} -fill #{BACK_GROUND_COLOR}")
-
-	 for row in 0 .. 7
-	    for col in 0 .. 7
-	       @squares[row][col] = Square.new(self, row, col)
-	    end
-	 end
-	 
-	 update
-      end
-      
-      def tk_rect(left, top, right, bottom)
-	 return left.to_s + "c", top.to_s + "c",
-	    right.to_s + "c", bottom.to_s + "c"
-      end
-      
-      def clear
-	 each_square do |square|
-	    if square.oval != nil
-	       self.e("delete", square.oval)
-	       square.oval = nil
-	    end
-	 end
-      end
-      
-      def draw_disk(row, col, disk)
-	 if disk == EMPTY
-	    if @squares[row][col].oval != nil
-	       self.e("delete", @squares[row][col].oval)
-	       @squares[row][col].oval = nil
-	    end
-	    return
-	 end
-	    
-	 $update.e()
-	 sleep(0.05)
-	 oval = @squares[row][col].oval
-	 if oval == nil
-	    oval = self.e("create oval", *tk_rect(@left + col + 0.2,
-					   @top + row + 0.2,
-					   @left + col + 0.8,
-					   @top + row + 0.8))
-	    @squares[row][col].oval = oval
-	 end
-	 case disk
-	 when BLACK
-	    color = BLACK_COLOR
-	 when WHITE
-	    color = WHITE_COLOR
-	 else
-	    fail format("Unknown disk type: %d", disk)
-	 end
-	 self.e("itemconfigure", oval, "-outline #{color} -fill #{color}")
-      end
-      
-      def update(row = nil, col = nil)
-	 if row && col
-	    draw_disk(row, col, @board.get_disk(row, col))
-	 else
-	    each_square do |square|
-	       draw_disk(square.row, square.col,
-			 @board.get_disk(square.row, square.col))
-	    end
-	 end
-	 @othello.show_point
-      end
-      
-      def each_square
-	 @squares.each do |rows|
-	    rows.each do |square|
-	       yield(square)
-	    end
-	 end
-      end
-      
-      def click_square(square)
-	 if @othello.in_com_turn || @othello.game_over ||
-	       @board.count_point(square.row,
-				  square.col,
-				  @board.man_disk) == 0
-	    square.blink(STOP_COLOR)
-	    return
-	 end
-	 @board.put_disk(square.row, square.col, @board.man_disk)
-	 @othello.com_turn
-      end
-      
-      private :draw_disk
-      public :update
-   end #----------------------> class BoardView ends here
-   
-   def initialize
-      @msg_label = TclTkWidget.new($ip, $root, $label)
-      $pack.e(@msg_label)
-      
-      @board = Board.new(self)
-      @board_view = BoardView.new(self, @board)
-      #### added by Y. Shigehiro
-      ## board_view の大きさを設定する.
-      x1, y1, x2, y2 = @board_view.e("bbox all").split(/ /).collect{|i| i.to_f}
-      @board_view.e("configure -width", x2 - x1)
-      @board_view.e("configure -height", y2 - y1)
-      ## scrollregion を設定する.
-      @board_view.e("configure -scrollregion {", @board_view.e("bbox all"),
-	 "}")
-      #### ここまで
-      $pack.e(@board_view, "-fill both -expand true")
-      
-      panel = TclTkWidget.new($ip, $root, $frame)
-      
-      @play_black = TclTkWidget.new($ip, panel, $checkbutton,
-        "-text {com is black} -command", TclTkCallback.new($ip, proc{
-	 switch_side
-      }))
-      $pack.e(@play_black, "-side left")
-            
-      quit = TclTkWidget.new($ip, panel, $button, "-text Quit -command",
-	 TclTkCallback.new($ip, proc{
-	 exit
-      }))
-      $pack.e(quit, "-side right -fill x")
-      
-      reset = TclTkWidget.new($ip, panel, $button, "-text Reset -command",
-	 TclTkCallback.new($ip, proc{
-	 reset_game
-      }))
-      $pack.e(reset, "-side right -fill x")
-      
-      $pack.e(panel, "-side bottom -fill x")
-      
-#      root = Tk.root
-      $wm.e("title", $root, "Othello")
-      $wm.e("iconname", $root, "Othello")
-      
-      @board.com_disk = WHITE
-      @game_over = FALSE
-      
-      TclTk.mainloop
-   end
-   
-   def switch_side
-      if @in_com_turn
-	 @play_black.e("toggle")
-      else
-	 @board.com_disk = @board.man_disk
-	 com_turn unless @game_over
-      end
-   end
-   
-   def reset_game
-      if @board.com_disk == BLACK
-	 @board.com_disk = WHITE
-	 @play_black.e("toggle")
-      end
-      @board_view.clear
-      @board.reset
-      $wm.e("title", $root, "Othello")
-      @game_over = FALSE
-   end
-      
-   def com_turn
-      @in_com_turn = TRUE
-      $update.e()
-      sleep(0.5)
-      begin
-	 com_disk = @board.count_disk(@board.com_disk)
-	 man_disk = @board.count_disk(@board.man_disk)
-	 if @board.count_disk(EMPTY) == 0
-	    if man_disk == com_disk
-	       $wm.e("title", $root, "{Othello - Draw!}")
-	    elsif man_disk > com_disk
-	       $wm.e("title", $root, "{Othello - You Win!}")
-	    else
-	       $wm.e("title", $root, "{Othello - You Loose!}")
-	    end
-	    @game_over = TRUE
-	    break
-	 elsif com_disk == 0
-	    $wm.e("title", $root, "{Othello - You Win!}")
-	    @game_over = TRUE
-	    break
-	 elsif man_disk == 0
-	    $wm.e("title", $root, "{Othello - You Loose!}")
-	    @game_over = TRUE
-	    break
-	 end
-	 row, col = @board.search(@board.com_disk)
-	 break if row == nil || col == nil
-	 @board.put_disk(row, col, @board.com_disk)
-      end while @board.search(@board.man_disk) == [nil, nil]
-      @in_com_turn = FALSE
-   end
-
-   def show_point
-      black = @board.count_disk(BLACK)
-      white = @board.count_disk(WHITE)
-      @msg_label.e("configure -text",
-	 %Q/{#{format("BLACK: %.2d    WHITE: %.2d", black, white)}}/)
-   end
-end #----------------------> class Othello ends here
-
-Othello.new
-
-#----------------------------------------------> othello.rb ends here
diff --git a/ext/tcltklib/stubs.c b/ext/tcltklib/stubs.c
deleted file mode 100644
index 69a5d6d3c0..0000000000
--- a/ext/tcltklib/stubs.c
+++ /dev/null
@@ -1,86 +0,0 @@
-#if defined USE_TCL_STUBS && defined USE_TK_STUBS
-#include 
-#include 
-#include "ruby.h"
-
-#if defined _WIN32 || defined __CYGWIN__
-# include 
-  typedef HINSTANCE DL_HANDLE;
-# define DL_OPEN LoadLibrary
-# define DL_SYM GetProcAddress
-# define TCL_INDEX 4
-# define TK_INDEX 3
-# define TCL_NAME "tcl89%s"
-# define TK_NAME "tk89%s"
-# undef DLEXT
-# define DLEXT ".dll"
-#elif defined HAVE_DLOPEN
-# include 
-  typedef void *DL_HANDLE;
-# define DL_OPEN(file) dlopen(file, RTLD_LAZY|RTLD_GLOBAL)
-# define DL_SYM dlsym
-# define TCL_INDEX 8
-# define TK_INDEX 7
-# define TCL_NAME "libtcl8.9%s"
-# define TK_NAME "libtk8.9%s"
-#endif
-
-int
-ruby_tcltk_stubs()
-{
-    DL_HANDLE tcl_dll;
-    DL_HANDLE tk_dll;
-    Tcl_Interp *(*p_Tcl_CreateInterp)();
-    int (*p_Tk_Init) _((Tcl_Interp *));
-    Tcl_Interp *tcl_ip;
-    int n;
-    char *ruby_tcl_dll;
-    char *ruby_tk_dll;
-    char tcl_name[20];
-    char tk_name[20];
-
-    ruby_tcl_dll = getenv("RUBY_TCL_DLL");
-    ruby_tk_dll = getenv("RUBY_TK_DLL");
-    if (ruby_tcl_dll && ruby_tk_dll) {
-	tcl_dll = (DL_HANDLE)DL_OPEN(ruby_tcl_dll);
-	tk_dll = (DL_HANDLE)DL_OPEN(ruby_tk_dll);
-    } else {
-	snprintf(tcl_name, sizeof tcl_name, TCL_NAME, DLEXT);
-	snprintf(tk_name, sizeof tk_name, TK_NAME, DLEXT);
-	/* examine from 8.9 to 8.1 */
-	for (n = '9'; n > '0'; n--) {
-	    tcl_name[TCL_INDEX] = n;
-	    tk_name[TK_INDEX] = n;
-	    tcl_dll = (DL_HANDLE)DL_OPEN(tcl_name);
-	    tk_dll = (DL_HANDLE)DL_OPEN(tk_name);
-	    if (tcl_dll && tk_dll)
-		break;
-	}
-    }
-
-    if (!tcl_dll || !tk_dll)
-	return -1;
-
-    p_Tcl_CreateInterp = (Tcl_Interp *(*)())DL_SYM(tcl_dll, "Tcl_CreateInterp");
-    if (!p_Tcl_CreateInterp)
-	return -2;
-
-    tcl_ip = (*p_Tcl_CreateInterp)();
-    if (!tcl_ip)
-	return -3;
-
-    p_Tk_Init = (int (*) _((Tcl_Interp *)))DL_SYM(tk_dll, "Tk_Init");
-    if (!p_Tk_Init)
-	return -4;
-    (*p_Tk_Init)(tcl_ip);
-
-    if (!Tcl_InitStubs(tcl_ip, "8.1", 0))
-	return -5;
-    if (!Tk_InitStubs(tcl_ip, "8.1", 0))
-	return -6;
-
-    Tcl_DeleteInterp(tcl_ip);
-
-    return 0;
-}
-#endif
diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c
deleted file mode 100644
index 9ff5972910..0000000000
--- a/ext/tcltklib/tcltklib.c
+++ /dev/null
@@ -1,877 +0,0 @@
-/*
- *	tcltklib.c
- *		Aug. 27, 1997	Y. Shigehiro
- *		Oct. 24, 1997	Y. Matsumoto
- */
-
-#include "ruby.h"
-#include "rubysig.h"
-#undef EXTERN	/* avoid conflict with tcl.h of tcl8.2 or before */
-#include 
-#include 
-#include 
-#include 
-
-#ifdef __MACOS__
-# include 
-# include 
-#endif
-
-/* for ruby_debug */
-
-#define DUMP1(ARG1) if (ruby_debug) { fprintf(stderr, "tcltklib: %s\n", ARG1);}
-#define DUMP2(ARG1, ARG2) if (ruby_debug) { fprintf(stderr, "tcltklib: ");\
-fprintf(stderr, ARG1, ARG2); fprintf(stderr, "\n"); }
-/*
-#define DUMP1(ARG1)
-#define DUMP2(ARG1, ARG2)
-*/
-
-/* for callback break & continue */
-static VALUE eTkCallbackBreak;
-static VALUE eTkCallbackContinue;
-
-static VALUE ip_invoke_real _((int, VALUE*, VALUE));
-
-/* from tkAppInit.c */
-
-#if !defined __MINGW32__
-/*
- * The following variable is a special hack that is needed in order for
- * Sun shared libraries to be used for Tcl.
- */
-
-extern int matherr();
-int *tclDummyMathPtr = (int *) matherr;
-#endif
-
-/*---- module TclTkLib ----*/
-
-struct invoke_queue {
-    Tcl_Event ev;
-    int argc;
-    VALUE *argv;
-    VALUE obj;
-    int done;
-    int safe_level;
-    VALUE *result;
-    VALUE thread;
-};
- 
-static VALUE main_thread;
-static VALUE eventloop_thread;
-static VALUE watchdog_thread;
-Tcl_Interp  *current_interp;
-
-/* 
- *  'event_loop_max' is a maximum events which the eventloop processes in one 
- *  term of thread scheduling. 'no_event_tick' is the count-up value when 
- *  there are no event for processing. 
- *  'timer_tick' is a limit of one term of thread scheduling. 
- *  If 'timer_tick' == 0, then not use the timer for thread scheduling.
- */
-static int tick_counter;
-#define DEFAULT_EVENT_LOOP_MAX  800
-#define DEFAULT_NO_EVENT_TICK    10
-#define DEFAULT_TIMER_TICK        0
-static int event_loop_max = DEFAULT_EVENT_LOOP_MAX;
-static int no_event_tick  = DEFAULT_NO_EVENT_TICK;
-static int timer_tick     = DEFAULT_TIMER_TICK;
-
-#if TCL_MAJOR_VERSION >= 8
-static int ip_ruby _((ClientData, Tcl_Interp *, int, Tcl_Obj *CONST*));
-#else
-static int ip_ruby _((ClientData, Tcl_Interp *, int, char **));
-#endif
-
-/* Tk_ThreadTimer */
-static Tcl_TimerToken timer_token = (Tcl_TimerToken)NULL;
-
-/* timer callback */
-static void _timer_for_tcl _((ClientData));
-static void
-_timer_for_tcl(clientData)
-    ClientData clientData;
-{
-    struct invoke_queue *q, *tmp;
-    VALUE thread;
-
-    Tk_DeleteTimerHandler(timer_token);
-    if (timer_tick > 0) {
-      timer_token = Tk_CreateTimerHandler(timer_tick, _timer_for_tcl, 
-					  (ClientData)0);
-    } else {
-      timer_token = (Tcl_TimerToken)NULL;
-    }
-
-    /* rb_thread_schedule(); */
-    timer_tick += event_loop_max;
-}
-
-static VALUE
-set_eventloop_tick(self, tick)
-    VALUE self;
-    VALUE tick;
-{
-    int ttick = NUM2INT(tick);
-
-    if (ttick < 0) {
-      rb_raise(rb_eArgError, "timer-tick parameter must be 0 or plus number");
-    }
-
-    /* delete old timer callback */
-    Tk_DeleteTimerHandler(timer_token);
-
-    timer_tick = ttick;
-    if (timer_tick > 0) {
-      /* start timer callback */
-      timer_token = Tk_CreateTimerHandler(timer_tick, _timer_for_tcl, 
-					  (ClientData)0);
-    } else {
-      timer_token = (Tcl_TimerToken)NULL;
-    }
-
-    return tick;
-}
-
-static VALUE
-get_eventloop_tick(self)
-    VALUE self;
-{
-    return INT2NUM(timer_tick);
-}
-
-static VALUE
-set_eventloop_weight(self, loop_max, no_event)
-    VALUE self;
-    VALUE loop_max;
-    VALUE no_event;
-{
-    int lpmax = NUM2INT(loop_max);
-    int no_ev = NUM2INT(no_event);
-
-    if (lpmax <= 0 || no_ev <= 0) {
-      rb_raise(rb_eArgError, "weight parameters must be plus number");
-    }
-
-    event_loop_max = lpmax;
-    no_event_tick  = no_ev;
-
-    return rb_ary_new3(2, loop_max, no_event);
-}
-
-static VALUE
-get_eventloop_weight(self)
-    VALUE self;
-{
-    return rb_ary_new3(2, INT2NUM(event_loop_max), INT2NUM(no_event_tick));
-}
-
-VALUE
-lib_mainloop_core(check_root_widget)
-    VALUE check_root_widget;
-{
-    VALUE current = eventloop_thread;
-    int check = (check_root_widget == Qtrue);
-
-    Tk_DeleteTimerHandler(timer_token);
-    if (timer_tick > 0) {
-      timer_token = Tk_CreateTimerHandler(timer_tick, _timer_for_tcl, 
-					  (ClientData)0);
-    } else {
-      timer_token = (Tcl_TimerToken)NULL;
-    }
-
-    for(;;) {
-      tick_counter = 0;
-      while(tick_counter < event_loop_max) {
-        if (Tcl_DoOneEvent(TCL_ALL_EVENTS | TCL_DONT_WAIT)) {
-          tick_counter++;
-	} else {
-          tick_counter += no_event_tick;
-	}
-	if (watchdog_thread != 0 && eventloop_thread != current) {
-	  return Qnil;
-	}
-      }
-      if (check && Tk_GetNumMainWindows() == 0) {
-	break;
-      }
-      rb_thread_schedule();
-    }
-    return Qnil;
-}
-
-VALUE
-lib_mainloop_ensure(parent_evloop)
-    VALUE parent_evloop;
-{
-    Tk_DeleteTimerHandler(timer_token);
-    timer_token = (Tcl_TimerToken)NULL;
-    DUMP2("mainloop-ensure: current-thread : %lx\n", rb_thread_current());
-    DUMP2("mainloop-ensure: eventloop-thread : %lx\n", eventloop_thread);
-    if (eventloop_thread == rb_thread_current()) {
-      DUMP2("tcltklib: eventloop-thread -> %lx\n", parent_evloop);
-      eventloop_thread = parent_evloop;
-    }
-    return Qnil;
-}
-
-static VALUE
-lib_mainloop_launcher(check_rootwidget)
-    VALUE check_rootwidget;
-{
-    VALUE parent_evloop = eventloop_thread;
-
-    eventloop_thread = rb_thread_current();
-
-    if (ruby_debug) { 
-      fprintf(stderr, "tcltklib: eventloop-thread : %lx -> %lx\n", 
-	      parent_evloop, eventloop_thread);
-    }
-
-    return rb_ensure(lib_mainloop_core, check_rootwidget, 
-		     lib_mainloop_ensure, parent_evloop);
-}
-
-/* execute Tk_MainLoop */
-static VALUE
-lib_mainloop(argc, argv, self)
-    int   argc;
-    VALUE *argv;
-    VALUE self;
-{
-    VALUE check_rootwidget;
-
-    if (rb_scan_args(argc, argv, "01", &check_rootwidget) == 0) {
-      check_rootwidget = Qtrue;
-    } else if (RTEST(check_rootwidget)) {
-      check_rootwidget = Qtrue;
-    } else {
-      check_rootwidget = Qfalse;
-    }
-
-    return lib_mainloop_launcher(check_rootwidget);
-}
-
-VALUE
-lib_watchdog_core(check_rootwidget)
-    VALUE check_rootwidget;
-{
-    VALUE current = eventloop_thread;
-    VALUE evloop;
-    int   check = (check_rootwidget == Qtrue);
-    ID    stop = rb_intern("stop?");
-
-    /* check other watchdog thread */
-    if (watchdog_thread != 0) {
-      if (rb_funcall(watchdog_thread, stop, 0) == Qtrue) {
-	rb_funcall(watchdog_thread, rb_intern("kill"), 0);
-      } else {
-	return Qnil;
-      }
-    }
-    watchdog_thread = rb_thread_current();
-
-    /* watchdog start */
-    do {
-      if (eventloop_thread == 0 
-	  || rb_funcall(eventloop_thread, stop, 0) == Qtrue) {
-	/* start new eventloop thread */
-	DUMP2("eventloop thread %lx is sleeping or dead", eventloop_thread);
-	evloop = rb_thread_create(lib_mainloop_launcher, 
-				  (void*)&check_rootwidget);
-	DUMP2("create new eventloop thread %lx", evloop);
-	rb_thread_run(evloop);
-      } else {
-	rb_thread_schedule();
-      }
-    } while(!check || Tk_GetNumMainWindows() != 0);
-
-    return Qnil;
-}
-
-VALUE
-lib_watchdog_ensure(arg)
-    VALUE arg;
-{
-    eventloop_thread = 0; /* stop eventloops */
-    return Qnil;
-}
-
-static VALUE
-lib_mainloop_watchdog(argc, argv, self)
-    int   argc;
-    VALUE *argv;
-    VALUE self;
-{
-    VALUE check_rootwidget;
-
-    if (rb_scan_args(argc, argv, "01", &check_rootwidget) == 0) {
-      check_rootwidget = Qtrue;
-    } else if (RTEST(check_rootwidget)) {
-      check_rootwidget = Qtrue;
-    } else {
-      check_rootwidget = Qfalse;
-    }
-
-    return rb_ensure(lib_watchdog_core, check_rootwidget, 
-		     lib_watchdog_ensure, Qnil);
-}
-
-static VALUE
-lib_do_one_event(argc, argv, self)
-    int   argc;
-    VALUE *argv;
-    VALUE self;
-{
-    VALUE obj, vflags;
-    int flags;
-
-    if (rb_scan_args(argc, argv, "01", &vflags) == 0) {
-      flags = 0;
-    } else {
-      Check_Type(vflags, T_FIXNUM);
-      flags = FIX2INT(vflags);
-    }
-    return INT2NUM(Tcl_DoOneEvent(flags));
-}
-
-/*---- class TclTkIp ----*/
-struct tcltkip {
-    Tcl_Interp *ip;		/* the interpreter */
-    int return_value;		/* return value */
-};
-
-/* Tcl command `ruby' */
-static VALUE
-ip_eval_rescue(failed, einfo)
-    VALUE *failed;
-    VALUE einfo;
-{
-    *failed = einfo;
-    return Qnil;
-}
-
-/* restart Tk */
-static VALUE
-lib_restart(self)
-    VALUE self;
-{
-    struct tcltkip *ptr;	/* tcltkip data struct */
-
-    /* get the data struct */
-    Data_Get_Struct(self, struct tcltkip, ptr);
-
-    /* destroy the root wdiget */
-    ptr->return_value = Tcl_Eval(ptr->ip, "destroy .");
-    /* ignore ERROR */
-    DUMP2("(TCL_Eval result) %d", ptr->return_value);
-
-    /* execute Tk_Init */
-    DUMP1("Tk_Init");
-    if (Tk_Init(ptr->ip) == TCL_ERROR) {
-	rb_raise(rb_eRuntimeError, "%s", ptr->ip->result);
-    }
-
-    return Qnil;
-}
-
-static int
-#if TCL_MAJOR_VERSION >= 8
-ip_ruby(clientData, interp, argc, argv)
-    ClientData clientData;
-    Tcl_Interp *interp; 
-    int argc;
-    Tcl_Obj *CONST argv[];
-#else
-ip_ruby(clientData, interp, argc, argv)
-    ClientData clientData;
-    Tcl_Interp *interp;
-    int argc;
-    char *argv[];
-#endif
-{
-    VALUE res;
-    int old_trapflg;
-    VALUE failed = 0;
-    char *arg;
-    int  dummy;
-
-    /* ruby command has 1 arg. */
-    if (argc != 2) {
-	rb_raise(rb_eArgError, "wrong # of arguments (%d for 1)", argc);
-    }
-
-    /* get C string from Tcl object */
-#if TCL_MAJOR_VERSION >= 8
-    arg = Tcl_GetStringFromObj(argv[1], &dummy);
-#else
-    arg = argv[1];
-#endif
-
-    /* evaluate the argument string by ruby */
-    DUMP2("rb_eval_string(%s)", arg);
-    old_trapflg = rb_trap_immediate;
-    rb_trap_immediate = 0;
-    res = rb_rescue2(rb_eval_string, (VALUE)arg,
-                     ip_eval_rescue, (VALUE)&failed,
-                     rb_eStandardError, rb_eScriptError, 0);
-    rb_trap_immediate = old_trapflg;
-
-    Tcl_ResetResult(interp);
-    if (failed) {
-        VALUE eclass = CLASS_OF(failed);
-	Tcl_AppendResult(interp, StringValuePtr(failed), (char*)NULL);
-        if (eclass == eTkCallbackBreak) {
-	    return TCL_BREAK;
-	} else if (eclass == eTkCallbackContinue) {
-	    return TCL_CONTINUE;
-	} else {
-	    return TCL_ERROR;
-	}
-    }
-
-    /* result must be string or nil */
-    if (NIL_P(res)) {
-	DUMP1("(rb_eval_string result) nil");
-	return TCL_OK;
-    }
-
-    /* copy result to the tcl interpreter */
-    DUMP2("(rb_eval_string result) %s", StringValuePtr(res));
-    DUMP1("Tcl_AppendResult");
-    Tcl_AppendResult(interp, StringValuePtr(res), (char *)NULL);
-
-    return TCL_OK;
-}
-
-/* destroy interpreter */
-static void
-ip_free(ptr)
-    struct tcltkip *ptr;
-{
-    DUMP1("Tcl_DeleteInterp");
-    Tcl_DeleteInterp(ptr->ip);
-    free(ptr);
-}
-
-/* create and initialize interpreter */
-static VALUE
-ip_new(self)
-    VALUE self;
-{
-    struct tcltkip *ptr;	/* tcltkip data struct */
-    VALUE obj;			/* newly created object */
-
-    /* create object */
-    obj = Data_Make_Struct(self, struct tcltkip, 0, ip_free, ptr);
-    ptr->return_value = 0;
-
-    /* from Tk_Main() */
-    DUMP1("Tcl_CreateInterp");
-    ptr->ip = Tcl_CreateInterp();
-    current_interp = ptr->ip;
-
-    /* from Tcl_AppInit() */
-    DUMP1("Tcl_Init");
-    if (Tcl_Init(ptr->ip) == TCL_ERROR) {
-	rb_raise(rb_eRuntimeError, "%s", ptr->ip->result);
-    }
-    DUMP1("Tk_Init");
-    if (Tk_Init(ptr->ip) == TCL_ERROR) {
-	rb_raise(rb_eRuntimeError, "%s", ptr->ip->result);
-    }
-    DUMP1("Tcl_StaticPackage(\"Tk\")");
-    Tcl_StaticPackage(ptr->ip, "Tk", Tk_Init,
-		      (Tcl_PackageInitProc *) NULL);
-
-    /* add ruby command to the interpreter */
-#if TCL_MAJOR_VERSION >= 8
-    DUMP1("Tcl_CreateObjCommand(\"ruby\")");
-    Tcl_CreateObjCommand(ptr->ip, "ruby", ip_ruby, (ClientData)NULL,
-			 (Tcl_CmdDeleteProc *)NULL);
-#else
-    DUMP1("Tcl_CreateCommand(\"ruby\")");
-    Tcl_CreateCommand(ptr->ip, "ruby", ip_ruby, (ClientData)NULL,
-		      (Tcl_CmdDeleteProc *)NULL);
-#endif
-
-    return obj;
-}
-
-/* eval string in tcl by Tcl_Eval() */
-static VALUE
-ip_eval(self, str)
-    VALUE self;
-    VALUE str;
-{
-    char *s;
-    char *buf;			/* Tcl_Eval requires re-writable string region */
-    struct tcltkip *ptr;	/* tcltkip data struct */
-
-    /* get the data struct */
-    Data_Get_Struct(self, struct tcltkip, ptr);
-
-    /* call Tcl_Eval() */
-    s = StringValuePtr(str);
-    buf = ALLOCA_N(char, strlen(s)+1);
-    strcpy(buf, s);
-    DUMP2("Tcl_Eval(%s)", buf);
-    ptr->return_value = Tcl_Eval(ptr->ip, buf);
-    if (ptr->return_value == TCL_ERROR) {
-	rb_raise(rb_eRuntimeError, "%s", ptr->ip->result);
-    }
-    DUMP2("(TCL_Eval result) %d", ptr->return_value);
-
-    /* pass back the result (as string) */
-    return(rb_str_new2(ptr->ip->result));
-}
-
-
-static VALUE
-ip_toUTF8(self, str, encodename)
-    VALUE self;
-    VALUE str;
-    VALUE encodename;
-{
-#ifdef TCL_UTF_MAX
-    Tcl_Interp *interp;
-    Tcl_Encoding encoding;
-    Tcl_DString dstr;
-    struct tcltkip *ptr;
-    char *buf;
-
-    Data_Get_Struct(self,struct tcltkip, ptr);
-    interp = ptr->ip;
-
-    StringValue(encodename);
-    StringValue(str);
-    encoding = Tcl_GetEncoding(interp, RSTRING(encodename)->ptr);
-    buf = ALLOCA_N(char,strlen(RSTRING(str)->ptr)+1);
-    strcpy(buf, RSTRING(str)->ptr);
-
-    Tcl_DStringInit(&dstr);
-    Tcl_DStringFree(&dstr);
-    Tcl_ExternalToUtfDString(encoding,buf,strlen(buf),&dstr);
-    str = rb_str_new2(Tcl_DStringValue(&dstr));
-
-    Tcl_FreeEncoding(encoding);
-    Tcl_DStringFree(&dstr);
-#endif
-    return str;
-}
-
-static VALUE
-ip_fromUTF8(self, str, encodename)
-    VALUE self;
-    VALUE str;
-    VALUE encodename;
-{
-#ifdef TCL_UTF_MAX
-    Tcl_Interp *interp;
-    Tcl_Encoding encoding;
-    Tcl_DString dstr;
-    struct tcltkip *ptr;
-    char *buf;
-
-    Data_Get_Struct(self,struct tcltkip, ptr);
-    interp = ptr->ip;
-
-    StringValue(encodename);
-    StringValue(str);
-    encoding = Tcl_GetEncoding(interp,RSTRING(encodename)->ptr);
-    buf = ALLOCA_N(char,strlen(RSTRING(str)->ptr)+1);
-    strcpy(buf,RSTRING(str)->ptr);
-
-    Tcl_DStringInit(&dstr);
-    Tcl_DStringFree(&dstr);
-    Tcl_UtfToExternalDString(encoding,buf,strlen(buf),&dstr);
-    str = rb_str_new2(Tcl_DStringValue(&dstr));
-
-    Tcl_FreeEncoding(encoding);
-    Tcl_DStringFree(&dstr);
-
-#endif
-    return str;
-}
-
-
-static VALUE
-ip_invoke_real(argc, argv, obj)
-    int argc;
-    VALUE *argv;
-    VALUE obj;
-{
-    VALUE v;
-    struct tcltkip *ptr;	/* tcltkip data struct */
-    int i;
-    Tcl_CmdInfo info;
-    char *cmd, *s;
-    char **av = (char **)NULL;
-#if TCL_MAJOR_VERSION >= 8
-    Tcl_Obj **ov = (Tcl_Obj **)NULL;
-    Tcl_Obj *resultPtr;
-#endif
-
-    /* get the data struct */
-    Data_Get_Struct(obj, struct tcltkip, ptr);
-
-    /* get the command name string */
-    v = argv[0];
-    cmd = StringValuePtr(v);
-
-    /* map from the command name to a C procedure */
-    if (!Tcl_GetCommandInfo(ptr->ip, cmd, &info)) {
-	rb_raise(rb_eNameError, "invalid command name `%s'", cmd);
-    }
-
-    /* memory allocation for arguments of this command */
-#if TCL_MAJOR_VERSION >= 8
-    if (info.isNativeObjectProc) {
-	/* object interface */
-	ov = (Tcl_Obj **)ALLOCA_N(Tcl_Obj *, argc+1);
-	for (i = 0; i < argc; ++i) {
-	    v = argv[i];
-	    s = StringValuePtr(v);
-	    ov[i] = Tcl_NewStringObj(s, RSTRING(v)->len);
-	    Tcl_IncrRefCount(ov[i]);
-	}
-	ov[argc] = (Tcl_Obj *)NULL;
-    } 
-    else
-#endif
-    {
-      /* string interface */
-	av = (char **)ALLOCA_N(char *, argc+1);
-	for (i = 0; i < argc; ++i) {
-	    v = argv[i];
-	    s = StringValuePtr(v);
-	    av[i] = ALLOCA_N(char, strlen(s)+1);
-	    strcpy(av[i], s);
-	}
-	av[argc] = (char *)NULL;
-    }
-
-    Tcl_ResetResult(ptr->ip);
-
-    /* Invoke the C procedure */
-#if TCL_MAJOR_VERSION >= 8
-    if (info.isNativeObjectProc) {
-	int dummy;
-	ptr->return_value = (*info.objProc)(info.objClientData,
-					    ptr->ip, argc, ov);
-
-	/* get the string value from the result object */
-	resultPtr = Tcl_GetObjResult(ptr->ip);
-	Tcl_SetResult(ptr->ip, Tcl_GetStringFromObj(resultPtr, &dummy),
-		      TCL_VOLATILE);
-
-	for (i=0; ireturn_value = (*info.proc)(info.clientData,
-					 ptr->ip, argc, av);
-    }
-
-    if (ptr->return_value == TCL_ERROR) {
-	rb_raise(rb_eRuntimeError, "%s", ptr->ip->result);
-    }
-
-    /* pass back the result (as string) */
-    return rb_str_new2(ptr->ip->result);
-}
-
-VALUE
-ivq_safelevel_handler(arg, ivq)
-    VALUE arg;
-    VALUE ivq;
-{
-    struct invoke_queue *q;
-
-    Data_Get_Struct(ivq, struct invoke_queue, q);
-    DUMP2("(safe-level handler) $SAFE = %d", q->safe_level);
-    rb_set_safe_level(q->safe_level);
-    return ip_invoke_real(q->argc, q->argv, q->obj);
-}
-
-int
-invoke_queue_handler(evPtr, flags)
-    Tcl_Event *evPtr;
-    int flags;
-{
-    struct invoke_queue *tmp, *q = (struct invoke_queue *)evPtr;
-
-    DUMP1("do_invoke_queue_handler");
-    DUMP2("invoke queue_thread : %lx", rb_thread_current());
-    DUMP2("added by thread : %lx", q->thread);
-
-    if (q->done) {
-      /* processed by another event-loop */
-      return 0;
-    }
-
-    /* process it */
-    q->done = 1;
-
-    /* check safe-level */
-    if (rb_safe_level() != q->safe_level) {
-      *(q->result) = rb_funcall(rb_proc_new(ivq_safelevel_handler, 
-					    Data_Wrap_Struct(rb_cData,0,0,q)), 
-				rb_intern("call"), 0);
-    } else {
-      *(q->result) = ip_invoke_real(q->argc, q->argv, q->obj);
-    }
-
-    /* back to caller */
-    rb_thread_run(q->thread);
-
-    /* end of handler : remove it */
-    return 1;
-}
-
-static VALUE
-ip_invoke(argc, argv, obj)
-    int argc;
-    VALUE *argv;
-    VALUE obj;
-{
-    struct invoke_queue *tmp;
-    VALUE current = rb_thread_current();
-    VALUE result;
-    VALUE *alloc_argv, *alloc_result;
-    Tcl_QueuePosition position;
-
-    if (eventloop_thread == 0 || current == eventloop_thread) {
-      DUMP2("invoke from current eventloop %lx", current);
-      return ip_invoke_real(argc, argv, obj);
-    }
-
-    DUMP2("invoke from thread %lx (NOT current eventloop)", current);
-
-    /* allocate memory (protected from Tcl_ServiceEvent) */
-    alloc_argv =  ALLOC_N(VALUE,argc);
-    MEMCPY(alloc_argv, argv, VALUE, argc);
-    alloc_result = ALLOC(VALUE);
-
-    /* allocate memory (freed by Tcl_ServiceEvent */
-    tmp = (struct invoke_queue *)Tcl_Alloc(sizeof(struct invoke_queue));
-
-    /* construct event data */
-    tmp->done = 0;
-    tmp->obj = obj;
-    tmp->argc = argc;
-    tmp->argv = alloc_argv;
-    tmp->result = alloc_result;
-    tmp->thread = current;
-    tmp->safe_level = rb_safe_level();
-    tmp->ev.proc = invoke_queue_handler;
-    position = TCL_QUEUE_TAIL;
-
-    /* add the handler to Tcl event queue */
-    Tcl_QueueEvent(&tmp->ev, position);
-
-    /* wait for the handler to be processed */
-    rb_thread_stop();
-
-    /* get result & free allocated memory */
-    result = *alloc_result;
-    free(alloc_argv);
-    free(alloc_result);
-
-    return result;
-}
-
-/* get return code from Tcl_Eval() */
-static VALUE
-ip_retval(self)
-    VALUE self;
-{
-    struct tcltkip *ptr;	/* tcltkip data struct */
-
-    /* get the data strcut */
-    Data_Get_Struct(self, struct tcltkip, ptr);
-
-    return (INT2FIX(ptr->return_value));
-}
-
-#ifdef __MACOS__
-static void
-_macinit()
-{
-    tcl_macQdPtr = &qd; /* setup QuickDraw globals */
-    Tcl_MacSetEventProc(TkMacConvertEvent); /* setup event handler */
-}
-#endif
-
-/*---- initialization ----*/
-void
-Init_tcltklib()
-{
-    VALUE lib = rb_define_module("TclTkLib");
-    VALUE ip = rb_define_class("TclTkIp", rb_cObject);
-
-    VALUE ev_flag = rb_define_module_under(lib, "EventFlag");
-
-#if defined USE_TCL_STUBS && defined USE_TK_STUBS
-    extern int ruby_tcltk_stubs();
-    int ret = ruby_tcltk_stubs();
-    if (ret)
-	rb_raise(rb_eLoadError, "tcltklib: tcltk_stubs init error(%d)", ret);
-#endif
-
-    rb_define_const(ev_flag, "WINDOW",    INT2FIX(TCL_WINDOW_EVENTS));
-    rb_define_const(ev_flag, "FILE",      INT2FIX(TCL_FILE_EVENTS));
-    rb_define_const(ev_flag, "TIMER",     INT2FIX(TCL_TIMER_EVENTS));
-    rb_define_const(ev_flag, "IDLE",      INT2FIX(TCL_IDLE_EVENTS));
-    rb_define_const(ev_flag, "ALL",       INT2FIX(TCL_ALL_EVENTS));
-    rb_define_const(ev_flag, "DONT_WAIT", INT2FIX(TCL_DONT_WAIT));
-
-    eTkCallbackBreak = rb_define_class("TkCallbackBreak", rb_eStandardError);
-    eTkCallbackContinue = rb_define_class("TkCallbackContinue",rb_eStandardError);
-
-    rb_define_module_function(lib, "mainloop", lib_mainloop, -1);
-    rb_define_module_function(lib, "mainloop_watchdog", 
-			      lib_mainloop_watchdog, -1);
-    rb_define_module_function(lib, "do_one_event", lib_do_one_event, -1);
-    rb_define_module_function(lib, "set_eventloop_tick",set_eventloop_tick,1);
-    rb_define_module_function(lib, "get_eventloop_tick",get_eventloop_tick,0);
-    rb_define_module_function(lib, "set_eventloop_weight", 
-			      set_eventloop_weight, 2);
-    rb_define_module_function(lib, "get_eventloop_weight", 
-			      get_eventloop_weight, 0);
-
-    rb_define_singleton_method(ip, "new", ip_new, 0);
-    rb_define_method(ip, "_eval", ip_eval, 1);
-    rb_define_method(ip, "_toUTF8",ip_toUTF8,2);
-    rb_define_method(ip, "_fromUTF8",ip_fromUTF8,2);
-    rb_define_method(ip, "_invoke", ip_invoke, -1);
-    rb_define_method(ip, "_return_value", ip_retval, 0);
-    rb_define_method(ip, "mainloop", lib_mainloop, -1);
-    rb_define_method(ip, "mainloop_watchdog", lib_mainloop_watchdog, -1);
-    rb_define_method(ip, "do_one_event", lib_do_one_event, -1);
-    rb_define_method(ip, "set_eventloop_tick", set_eventloop_tick, 1);
-    rb_define_method(ip, "get_eventloop_tick", get_eventloop_tick, 0);
-    rb_define_method(ip, "set_eventloop_weight", set_eventloop_weight, 2);
-    rb_define_method(ip, "get_eventloop_weight", get_eventloop_weight, 0);
-    rb_define_method(ip, "restart", lib_restart, 0);
-
-    main_thread = rb_thread_current();
-    eventloop_thread = 0;
-    watchdog_thread  = 0;
-
-#ifdef __MACOS__
-    _macinit();
-#endif
-
-    /*---- initialize tcl/tk libraries ----*/
-    /* from Tk_Main() */
-    DUMP1("Tcl_FindExecutable");
-    Tcl_FindExecutable(RSTRING(rb_argv0)->ptr);
-}
-
-/* eof */
diff --git a/ext/tk/.cvsignore b/ext/tk/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/tk/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/tk/MANIFEST b/ext/tk/MANIFEST
deleted file mode 100644
index 9689186bf0..0000000000
--- a/ext/tk/MANIFEST
+++ /dev/null
@@ -1,25 +0,0 @@
-MANIFEST
-extconf.rb
-depend
-tkutil.c
-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
-sample/tkbiff.rb
-sample/tkbrowse.rb
-sample/tkdialog.rb
-sample/tkfrom.rb
-sample/tkhello.rb
-sample/tkline.rb
-sample/tktimer.rb
diff --git a/ext/tk/depend b/ext/tk/depend
deleted file mode 100644
index fd63e230f0..0000000000
--- a/ext/tk/depend
+++ /dev/null
@@ -1 +0,0 @@
-tkutil.o: tkutil.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/tk/extconf.rb b/ext/tk/extconf.rb
deleted file mode 100644
index f769b06e30..0000000000
--- a/ext/tk/extconf.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require 'mkmf'
-create_makefile("tkutil")
diff --git a/ext/tk/lib/README b/ext/tk/lib/README
deleted file mode 100644
index 87b59f4972..0000000000
--- a/ext/tk/lib/README
+++ /dev/null
@@ -1,15 +0,0 @@
-README		this file
-tk.rb		Tk interface
-tkafter.rb	handles Tcl after
-tkbgerror.rb	Tk error module
-tkcanvas.rb	Tk canvas interface
-tkclass.rb	provides generic names for Tk classes
-tkdialog.rb	Tk dialog class
-tkentry.rb	Tk entry class
-tkfont.rb	Tk font support
-tkmenubar.rb	TK menubar utility
-tkmngfocus.rb	focus manager
-tkpalette.rb	pallete support
-tkscrollbox.rb	scroll box, also example of compound widget
-tktext.rb	text classes
-tkvirtevent.rb	virtual event support
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
deleted file mode 100644
index bc9cb0676f..0000000000
--- a/ext/tk/lib/tk.rb
+++ /dev/null
@@ -1,3780 +0,0 @@
-#
-#		tk.rb - Tk interface module using tcltklib
-#			$Date$
-#			by Yukihiro Matsumoto 
-
-# use Shigehiro's tcltklib
-require "tcltklib"
-require "tkutil"
-
-module TkComm
-  WidgetClassNames = {}
-
-  None = Object.new
-  def None.to_s
-    'None'
-  end
-
-  Tk_CMDTBL = {}
-  Tk_WINDOWS = {}
-
-  def error_at
-    frames = caller()
-    frames.delete_if do |c|
-      c =~ %r!/tk(|core|thcore|canvas|text|entry|scrollbox)\.rb:\d+!
-    end
-    frames
-  end
-  private :error_at
-
-  def _genobj_for_tkwidget(path)
-    return TkRoot.new if path == '.'
-
-    begin
-      tk_class = TkCore::INTERP._invoke('winfo', 'class', path)
-    rescue
-      return path
-    end
-
-    ruby_class = WidgetClassNames[tk_class]
-    gen_class_name = ruby_class.name + 'GeneratedOnTk'
-    unless Object.const_defined? gen_class_name
-      eval "class #{gen_class_name}<#{ruby_class.name}
-              def initialize(path)
-                @path=path
-                Tk_WINDOWS[@path] = self
-              end
-            end"
-    end
-    eval "#{gen_class_name}.new('#{path}')"
-  end
-
-  def tk_tcl2ruby(val)
-    if val =~ /^rb_out (c\d+)/
-      return Tk_CMDTBL[$1]
-    end
-    if val.include? ?\s
-      return val.split.collect{|v| tk_tcl2ruby(v)}
-    end
-    case val
-    when /^@font/
-      TkFont.get_obj(val)
-    when /^-?\d+$/
-      val.to_i
-    when /^\./
-      Tk_WINDOWS[val] ? Tk_WINDOWS[val] : _genobj_for_tkwidget(val)
-    when / /
-      val.split.collect{|elt|
-	tk_tcl2ruby(elt)
-      }
-    when /^-?\d+\.\d*$/
-      val.to_f
-    else
-      val
-    end
-  end
-
-  def tk_split_list(str)
-    return [] if str == ""
-    idx = str.index('{')
-    while idx and idx > 0 and str[idx-1] == ?\\
-      idx = str.index('{', idx+1)
-    end
-    return tk_tcl2ruby(str) unless idx
-
-    list = tk_tcl2ruby(str[0,idx])
-    list = [] if list == ""
-    str = str[idx+1..-1]
-    i = -1
-    brace = 1
-    str.each_byte {|c|
-      i += 1
-      brace += 1 if c == ?{
-      brace -= 1 if c == ?}
-      break if brace == 0
-    }
-    if str[0, i] == ' '
-      list.push ' '
-    else
-      list.push tk_split_list(str[0, i])
-    end
-    list += tk_split_list(str[i+1..-1])
-    list
-  end
-
-  def tk_split_simplelist(str)
-    return [] if str == ""
-    idx = str.index('{')
-    while idx and idx > 0 and str[idx-1] == ?\\
-      idx = str.index('{', idx+1)
-    end
-    return str.split unless idx
-
-    list = str[0,idx].split
-    str = str[idx+1..-1]
-    i = -1
-    brace = 1
-    str.each_byte {|c|
-      i += 1
-      brace += 1 if c == ?{
-      brace -= 1 if c == ?}
-      break if brace == 0
-    }
-    if i == 0
-      list.push ''
-    elsif str[0, i] == ' '
-      list.push ' '
-    else
-      list.push str[0..i-1]
-    end
-    list += tk_split_simplelist(str[i+1..-1])
-    list
-  end
-  private :tk_tcl2ruby, :tk_split_list, :tk_split_simplelist
-
-  def _symbolkey2str(keys)
-    h = {}
-    keys.each{|key,value| h[key.to_s] = value}
-    h
-  end
-  private :_symbolkey2str
-
-  def hash_kv(keys)
-    conf = []
-    if keys and keys != None
-      for k, v in keys
-	 conf.push("-#{k}")
-	 conf.push(v)
-      end
-    end
-    conf
-  end
-  private :hash_kv
-
-  def array2tk_list(ary)
-    ary.collect{|e|
-      if e.kind_of? Array
-	"{#{array2tk_list(e)}}"
-      elsif e.kind_of? Hash
-	"{#{e.to_a.collect{|ee| array2tk_list(ee)}.join(' ')}}"
-      else
-	s = _get_eval_string(e)
-	(s.index(/\s/))? "{#{s}}": s
-      end
-    }.join(" ")
-  end
-  private :array2tk_list
-
-  def bool(val)
-    case val
-    when "1", 1, 'yes', 'true'
-      TRUE
-    else
-      FALSE
-    end
-  end
-  def number(val)
-    case val
-    when /^-?\d+$/
-      val.to_i
-    when /^-?\d+\.\d*$/
-      val.to_f
-    else
-      val
-    end
-  end
-  def string(val)
-    if val == "{}"
-      ''
-    elsif val[0] == ?{
-      val[1..-2]
-    else
-      val
-    end
-  end
-  def list(val)
-    tk_split_list(val).to_a
-  end
-  def window(val)
-    Tk_WINDOWS[val]
-  end
-  def procedure(val)
-    if val =~ /^rb_out (c\d+)/
-      Tk_CMDTBL[$1]
-    else
-      nil
-    end
-  end
-  private :bool, :number, :string, :list, :window, :procedure
-
-  def _get_eval_string(str)
-    return nil if str == None
-    if str.kind_of?(String)
-      # do nothing
-    elsif str.kind_of?(Symbol)
-      str = str.id2name
-    elsif str.kind_of?(Hash)
-      str = hash_kv(str).join(" ")
-    elsif str.kind_of?(Array)
-      str = array2tk_list(str)
-    elsif str.kind_of?(Proc)
-      str = install_cmd(str)
-    elsif str == nil
-      str = ""
-    elsif str == false
-      str = "0"
-    elsif str == true
-      str = "1"
-    elsif (str.respond_to?(:to_eval))
-      str = str.to_eval()
-    else
-      str = str.to_s()
-    end
-    return str
-  end
-  private :_get_eval_string
-
-  def ruby2tcl(v)
-    if v.kind_of?(Hash)
-      v = hash_kv(v)
-      v.flatten!
-      v.collect{|e|ruby2tcl(e)}
-    else
-      _get_eval_string(v)
-    end
-  end
-  private :ruby2tcl
-
-  Tk_IDs = [0, 0]		# [0]-cmdid, [1]-winid
-  def _curr_cmd_id
-    id = format("c%.4d", Tk_IDs[0])
-  end
-  def _next_cmd_id
-    id = _curr_cmd_id
-    Tk_IDs[0] += 1
-    id
-  end
-  def install_cmd(cmd)
-    return '' if cmd == ''
-    id = _next_cmd_id
-    Tk_CMDTBL[id] = cmd
-    @cmdtbl = [] unless @cmdtbl
-    @cmdtbl.push id
-    return format("rb_out %s", id);
-  end
-  def uninstall_cmd(id)
-    id = $1 if /rb_out (c\d+)/ =~ id
-    Tk_CMDTBL[id] = nil
-  end
-  private :install_cmd, :uninstall_cmd
-
-  def install_win(ppath,name=nil)
-    if !name or name == ''
-      name = format("w%.4d", Tk_IDs[1])
-      Tk_IDs[1] += 1
-    end
-    if !ppath or ppath == "."
-      @path = format(".%s", name);
-    else
-      @path = format("%s.%s", ppath, name)
-    end
-    Tk_WINDOWS[@path] = self
-  end
-
-  def uninstall_win()
-    Tk_WINDOWS[@path] = nil
-  end
-
-  class Event
-    def initialize(seq,a,b,c,d,f,h,k,m,o,p,s,t,w,x,y,
-	           aa,bb,dd,ee,kk,nn,rr,ss,tt,ww,xx,yy)
-      @serial = seq
-      @above = a
-      @num = b
-      @count = c
-      @detail = d
-      @focus = (f == 1)
-      @height = h
-      @keycode = k
-      @mode = m
-      @override = (o == 1)
-      @place = p
-      @state = s
-      @time = t
-      @width = w
-      @x = x
-      @y = y
-      @char = aa
-      @borderwidth = bb
-      @wheel_delta = dd
-      @send_event = (ee == 1)
-      @keysym = kk
-      @keysym_num = nn
-      @rootwin_id = rr
-      @subwindow = ss
-      @type = tt
-      @widget = ww
-      @x_root = xx
-      @y_root = yy
-    end
-    attr :serial
-    attr :above
-    attr :num
-    attr :count
-    attr :detail
-    attr :focus
-    attr :height
-    attr :keycode
-    attr :mode
-    attr :override
-    attr :place
-    attr :state
-    attr :time
-    attr :width
-    attr :x
-    attr :y
-    attr :char
-    attr :borderwidth
-    attr :wheel_delta
-    attr :send_event
-    attr :keysym
-    attr :keysym_num
-    attr :rootwin_id
-    attr :subwindow
-    attr :type
-    attr :widget
-    attr :x_root
-    attr :y_root
-  end
-
-  def install_bind(cmd, args=nil)
-    if args
-      id = install_cmd(proc{|*arg|
-	TkUtil.eval_cmd cmd, *arg
-      })
-      id + " " + args
-    else
-      id = install_cmd(proc{|arg|
-	TkUtil.eval_cmd cmd, Event.new(*arg)
-      })
-      id + ' %# %a %b %c %d %f %h %k %m %o %p %s %t %w %x %y' + 
-	   ' %A %B %D %E %K %N %R %S %T %W %X %Y'
-    end
-  end
-
-  def tk_event_sequence(context)
-    if context.kind_of? TkVirtualEvent
-      context = context.path
-    end
-    if context.kind_of? Array
-      context = context.collect{|ev|
-	if ev.kind_of? TkVirtualEvent
-	  ev.path
-	else
-	  ev
-	end
-      }.join("><")
-    end
-    if /,/ =~ context
-      context = context.split(/\s*,\s*/).join("><")
-    else
-      context
-    end
-  end
-
-  def _bind_core(mode, what, context, cmd, args=nil)
-    id = install_bind(cmd, args) if cmd
-    begin
-      tk_call(*(what + ["<#{tk_event_sequence(context)}>", mode + id]))
-    rescue
-      uninstall_cmd(id) if cmd
-      fail
-    end
-  end
-
-  def _bind(what, context, cmd, args=nil)
-    _bind_core('', what, context, cmd, args)
-  end
-
-  def _bind_append(what, context, cmd, args=nil)
-    _bind_core('+', what, context, cmd, args)
-  end
-
-  def _bind_remove(what, context)
-    tk_call(*(what + ["<#{tk_event_sequence(context)}>", '']))
-  end
-
-  def _bindinfo(what, context=nil)
-    if context
-      tk_call(*what+["<#{tk_event_sequence(context)}>"]).collect {|cmdline|
-	if cmdline =~ /^rb_out (c\d+)\s+(.*)$/
-	  [Tk_CMDTBL[$1], $2]
-	else
-	  cmdline
-	end
-      }
-    else
-      tk_split_simplelist(tk_call(*what)).collect!{|seq|
-	l = seq.scan(/<*[^<>]+>*/).collect!{|subseq|
-	  case (subseq)
-	  when /^<<[^<>]+>>$/
-	    TkVirtualEvent.getobj(subseq[1..-2])
-	  when /^<[^<>]+>$/
-	    subseq[1..-2]
-	  else
-	    subseq.split('')
-	  end
-	}.flatten
-	(l.size == 1) ? l[0] : l
-      }
-    end
-  end
-  private :install_bind, :tk_event_sequence, 
-          :_bind_core, :_bind, :_bind_append, :_bind_remove, :_bindinfo
-
-  def bind(tagOrClass, context, cmd=Proc.new, args=nil)
-    _bind(["bind", tagOrClass], context, cmd, args)
-  end
-
-  def bind_append(tagOrClass, context, cmd=Proc.new, args=nil)
-    _bind_append(["bind", tagOrClass], context, cmd, args)
-  end
-
-  def bind_remove(tagOrClass, context)
-    _bind_remove(['bind', tagOrClass], context)
-  end
-
-  def bindinfo(tagOrClass, context=nil)
-    _bindinfo(['bind', tagOrClass], context)
-  end
-
-  def bind_all(context, cmd=Proc.new, args=nil)
-    _bind(['bind', 'all'], context, cmd, args)
-  end
-
-  def bind_append_all(context, cmd=Proc.new, args=nil)
-    _bind_append(['bind', 'all'], context, cmd, args)
-  end
-
-  def bindinfo_all(context=nil)
-    _bindinfo(['bind', 'all'], context)
-  end
-
-  def pack(*args)
-    TkPack.configure(*args)
-  end
-
-  def grid(*args)
-    TkGrid.configure(*args)
-  end
-
-  def update(idle=nil)
-    if idle
-      tk_call 'update', 'idletasks'
-    else
-      tk_call 'update'
-    end
-  end
-
-end
-
-module TkCore
-  include TkComm
-  extend TkComm
-
-  INTERP = TclTkIp.new
-
-  INTERP._invoke("proc", "rb_out", "args", <<-'EOL')
-    regsub -all {!} $args {\\!} args
-    regsub -all "{" $args "\\{" args
-    if {[set st [catch {ruby [format "TkCore.callback %%Q!%s!" $args]} ret]] != 0} {
-	return -code $st $ret
-    } {
-	return $ret
-    }
-  EOL
-
-  EventFlag = TclTkLib::EventFlag
-
-  def callback_break
-    fail TkCallbackBreak, "Tk callback returns 'break' status"
-  end
-
-  def callback_continue
-    fail TkCallbackContinue, "Tk callback returns 'continue' status"
-  end
-
-  def after(ms, cmd=Proc.new)
-    myid = _curr_cmd_id
-    cmdid = install_cmd(cmd)
-    tk_call("after",ms,cmdid)
-#    return
-#    if false #defined? Thread
-#      Thread.start do
-#	ms = Float(ms)/1000
-#	ms = 10 if ms == 0
-#	sleep ms/1000
-#	cmd.call
-#      end
-#    else
-#      cmdid = install_cmd(cmd)
-#      tk_call("after",ms,cmdid)
-#    end
-  end
-
-  def after_idle(cmd=Proc.new)
-    myid = _curr_cmd_id
-    cmdid = install_cmd(cmd)
-    tk_call('after','idle',cmdid)
-  end
-
-  def clock_clicks(ms=nil)
-    if ms
-      tk_call('clock','clicks','-milliseconds').to_i
-    else
-      tk_call('clock','clicks').to_i
-    end
-  end
-
-  def clock_format(clk, form=nil)
-    if form
-      tk_call('clock','format',clk,'-format',form).to_i
-    else
-      tk_call('clock','format',clk).to_i
-    end
-  end
-
-  def clock_formatGMT(clk, form=nil)
-    if form
-      tk_call('clock','format',clk,'-format',form,'-gmt','1').to_i
-    else
-      tk_call('clock','format',clk,'-gmt','1').to_i
-    end
-  end
-
-  def clock_scan(str, base=nil)
-    if base
-      tk_call('clock','scan',str,'-base',base).to_i
-    else
-      tk_call('clock','scan',str).to_i
-    end
-  end
-
-  def clock_scanGMT(str, base=nil)
-    if base
-      tk_call('clock','scan',str,'-base',base,'-gmt','1').to_i
-    else
-      tk_call('clock','scan',str,'-gmt','1').to_i
-    end
-  end
-
-  def clock_seconds
-    tk_call('clock','seconds').to_i
-  end
-
-  def TkCore.callback(arg)
-    arg = Array(tk_split_list(arg))
-    _get_eval_string(TkUtil.eval_cmd(Tk_CMDTBL[arg.shift], *arg))
-  end
-
-  def scaling(scale=nil)
-    if scale
-      tk_call('tk', 'scaling', scale)
-    else
-      Float(number(tk_call('tk', 'scaling')))
-    end
-  end
-  def scaling_displayof(win, scale=nil)
-    if scale
-      tk_call('tk', 'scaling', '-displayof', win, scale)
-    else
-      Float(number(tk_call('tk', '-displayof', win, 'scaling')))
-    end
-  end
-
-  def appname(name=None)
-    tk_call('tk', 'appname', name)
-  end
-
-  def appsend(interp, async, *args)
-    if async
-      tk_call('send', '-async', '--', interp, *args)
-    else
-      tk_call('send', '--', interp, *args)
-    end
-  end
-
-  def rb_appsend(interp, async, *args)
-    args = args.collect!{|c| _get_eval_string(c).gsub(/[][$"]/, '\\\\\&')}
-    args.push(').to_s"')
-    appsend(interp, async, 'ruby "(', *args)
-  end
-
-  def appsend_displayof(interp, win, async, *args)
-    win = '.' if win == nil
-    if async
-      tk_call('send', '-async', '-displayof', win, '--', interp, *args)
-    else
-      tk_call('send', '-displayor', win, '--', interp, *args)
-    end
-  end
-
-  def rb_appsend_displayof(interp, win, async, *args)
-    args = args.collect!{|c| _get_eval_string(c).gsub(/[][$"]/, '\\\\\&')}
-    args.push(').to_s"')
-    appsend_displayof(interp, win, async, 'ruby "(', *args)
-  end
-
-  def info(*args)
-    tk_call('info', *args)
-  end
-
-  def mainloop(check_root = true)
-    TclTkLib.mainloop(check_root)
-  end
-
-  def mainloop_watchdog(check_root = true)
-    TclTkLib.mainloop_watchdog(check_root)
-  end
-
-  def do_one_event(flag = 0)
-    TclTkLib.do_one_event(flag)
-  end
-
-  def set_eventloop_tick(timer_tick)
-    TclTkLib.set_eventloop_tick(timer_tick)
-  end
-
-  def get_eventloop_tick()
-    TclTkLib.get_eventloop_tick
-  end
-
-  def set_eventloop_weight(loop_max, no_event_tick)
-    TclTkLib.set_eventloop_weight(loop_max, no_event_tick)
-  end
-
-  def get_eventloop_weight()
-    TclTkLib.get_eventloop_weight
-  end
-
-  def restart(app_name = nil, use = nil)
-    tk_call('set', 'argv0', app_name) if app_name
-    if use
-      tk_call('set', 'argc', 2)
-      tk_call('set', 'argv', "-use #{use}")
-    end
-    TkCore::INTERP.restart
-    TkComm::Tk_CMDTBL.clear
-    TkComm::Tk_WINDOWS.clear
-    nil
-  end
-
-  def event_generate(window, context, keys=nil)
-    window = window.path if window.kind_of? TkObject
-    if keys
-      tk_call('event', 'generate', window, 
-	      "<#{tk_event_sequence(context)}>", *hash_kv(keys))
-    else
-      tk_call('event', 'generate', window, "<#{tk_event_sequence(context)}>")
-    end
-  end
-
-  def messageBox(keys)
-    tk_call 'tk_messageBox', *hash_kv(keys)
-  end
-
-  def getOpenFile(keys = nil)
-    tk_call 'tk_getOpenFile', *hash_kv(keys)
-  end
-
-  def getSaveFile(keys = nil)
-    tk_call 'tk_getSaveFile', *hash_kv(keys)
-  end
-
-  def chooseColor(keys = nil)
-    tk_call 'tk_chooseColor', *hash_kv(keys)
-  end
-
-  def chooseDirectory(keys = nil)
-    tk_call 'tk_chooseDirectory', *hash_kv(keys)
-  end
-
-  def tk_call(*args)
-    puts args.inspect if $DEBUG
-    args.collect! {|x|ruby2tcl(x)}
-    args.compact!
-    args.flatten!
-    print "=> ", args.join(" ").inspect, "\n" if $DEBUG
-    begin
-      res = INTERP._invoke(*args)
-    rescue NameError
-      err = $!
-      begin
-        args.unshift "unknown"
-        res = INTERP._invoke(*args)
-      rescue
-	fail unless /^invalid command/ =~ $!
-	fail err
-      end
-    end
-    if  INTERP._return_value() != 0
-      fail RuntimeError, res, error_at
-    end
-    print "==> ", res.inspect, "\n" if $DEBUG
-    return res
-  end
-end
-
-module TkPackage
-  include TkCore
-  extend TkPackage
-
-  def add_path(path)
-    Tk::AUTO_PATH.value = Tk::AUTO_PATH.to_a << path
-  end
-
-  def forget(package)
-    tk_call('package', 'forget', package)
-    nil
-  end
-
-  def names
-    tk_split_simplelist(tk_call('package', 'names'))
-  end
-
-  def provide(package, version=nil)
-    if version
-      tk_call('package', 'provide', package, version)
-      nil
-    else
-      tk_call('package', 'provide', package)
-    end
-  end
-
-  def present(package, version=None)
-    tk_call('package', 'present', package, version)
-  end
-
-  def present_exact(package, version)
-    tk_call('package', 'present', '-exact', package, version)
-  end
-
-  def require(package, version=None)
-    tk_call('package', 'require', package, version)
-  end
-
-  def require_exact(package, version)
-    tk_call('package', 'require', '-exact', package, version)
-  end
-
-  def versions(package)
-    tk_split_simplelist(tk_call('package', 'versions', package))
-  end
-
-  def vcompare(version1, version2)
-    Integer(tk_call('package', 'vcompare', version1, version2))
-  end
-
-  def vsatisfies(version1, version2)
-    bool(tk_call('package', 'vsatisfies', version1, version2))
-  end
-end
-
-module Tk
-  include TkCore
-  extend Tk
-
-  TCL_VERSION = INTERP._invoke("info", "tclversion")
-  TK_VERSION  = INTERP._invoke("set", "tk_version")
-
-  TCL_PATCHLEVEL = INTERP._invoke("info", "patchlevel")
-  TK_PATCHLEVEL  = INTERP._invoke("set", "tk_patchLevel")
-
-  TCL_LIBRARY = INTERP._invoke("set", "tcl_library")
-  TK_LIBRARY  = INTERP._invoke("set", "tk_library")
-  LIBRARY     = INTERP._invoke("info", "library")
-
-  PLATFORM = Hash[*tk_split_simplelist(INTERP._eval('array get tcl_platform'))]
-
-  JAPANIZED_TK = (INTERP._invoke("info", "commands", "kanji") != "")
-
-  def root
-    TkRoot.new
-  end
-
-  def bell
-    tk_call 'bell'
-  end
-
-  def Tk.focus(display=nil)
-    if display == nil
-      r = tk_call('focus')
-    else
-      r = tk_call('focus', '-displayof', display)
-    end
-    tk_tcl2ruby(r)
-  end
-
-  def Tk.focus_lastfor(win)
-    tk_tcl2ruby(tk_call('focus', '-lastfor', win))
-  end
-
-  def Tk.strictMotif(bool=None)
-    bool(tk_call('set', 'tk_strictMotif', bool))
-  end
-
-  def Tk.show_kinsoku(mode='both')
-    begin
-      if /^8\.*/ === TK_VERSION  && JAPANIZED_TK
-        tk_split_simplelist(tk_call('kinsoku', 'show', mode))
-      end
-    rescue
-    end
-  end
-  def Tk.add_kinsoku(chars, mode='both')
-    begin
-      if /^8\.*/ === TK_VERSION  && JAPANIZED_TK
-        tk_split_simplelist(tk_call('kinsoku', 'add', mode, 
-                                    *(chars.split(''))))
-      else
-        []
-      end
-    rescue
-      []
-    end
-  end
-  def Tk.delete_kinsoku(chars, mode='both')
-    begin
-      if /^8\.*/ === TK_VERSION  && JAPANIZED_TK
-        tk_split_simplelist(tk_call('kinsoku', 'delete', mode, 
-                            *(chars.split(''))))
-      end
-    rescue
-    end
-  end
-
-  def Tk.toUTF8(str,encoding)
-    INTERP._toUTF8(str,encoding)
-  end
-  
-  def Tk.fromUTF8(str,encoding)
-    INTERP._fromUTF8(str,encoding)
-  end
-
-  module Scrollable
-    def xscrollcommand(cmd=Proc.new)
-      configure_cmd 'xscrollcommand', cmd
-    end
-    def yscrollcommand(cmd=Proc.new)
-      configure_cmd 'yscrollcommand', cmd
-    end
-    def xview(*index)
-      v = tk_send('xview', *index)
-      list(v) if index.size == 0
-    end
-    def yview(*index)
-      v = tk_send('yview', *index)
-      list(v) if index.size == 0
-    end
-    def xscrollbar(bar=nil)
-      if bar
-	@xscrollbar = bar
-	@xscrollbar.orient 'horizontal'
-	self.xscrollcommand {|arg| @xscrollbar.set(*arg)}
-	@xscrollbar.command {|arg| self.xview(*arg)}
-      end
-      @xscrollbar
-    end
-    def yscrollbar(bar=nil)
-      if bar
-	@yscrollbar = bar
-	@yscrollbar.orient 'vertical'
-	self.yscrollcommand {|arg| @yscrollbar.set(*arg)}
-	@yscrollbar.command {|arg| self.yview(*arg)}
-      end
-      @yscrollbar
-    end
-  end
-
-  module Wm
-    include TkComm
-    def aspect(*args)
-      w = tk_call('wm', 'aspect', path, *args)
-      list(w) if args.length == 0
-    end
-    def client(name=None)
-      tk_call 'wm', 'client', path, name
-    end
-    def colormapwindows(*args)
-      list(tk_call('wm', 'colormapwindows', path, *args))
-    end
-    def wm_command(value=None)
-      string(tk_call('wm', 'command', path, value))
-    end
-    def deiconify
-      tk_call 'wm', 'deiconify', path
-    end
-    def focusmodel(*args)
-      tk_call 'wm', 'focusmodel', path, *args
-    end
-    def frame
-      tk_call('wm', 'frame', path)
-    end
-    def geometry(*args)
-      tk_call('wm', 'geometry', path, *args)
-    end
-    def grid(*args)
-      w = tk_call('wm', 'grid', path, *args)
-      list(w) if args.size == 0
-    end
-    def group(*args)
-      w = tk_call 'wm', 'group', path, *args
-      window(w) if args.size == 0
-    end
-    def iconbitmap(*args)
-      tk_call 'wm', 'iconbitmap', path, *args
-    end
-    def iconify
-      tk_call 'wm', 'iconify', path
-    end
-    def iconmask(*args)
-      tk_call 'wm', 'iconmask', path, *args
-    end
-    def iconname(*args)
-      tk_call 'wm', 'iconname', path, *args
-    end
-    def iconposition(*args)
-      w = tk_call('wm', 'iconposition', path, *args)
-      list(w) if args.size == 0
-    end
-    def iconwindow(*args)
-      w = tk_call('wm', 'iconwindow', path, *args)
-      window(w) if args.size == 0
-    end
-    def maxsize(*args)
-      w = tk_call('wm', 'maxsize', path, *args)
-      list(w) if args.size == 0
-    end
-    def minsize(*args)
-      w = tk_call('wm', 'minsize', path, *args)
-      list(w) if args.size == 0
-    end
-    def overrideredirect(bool=None)
-      if bool == None
-	bool(tk_call('wm', 'overrideredirect', path))
-      else
-	tk_call 'wm', 'overrideredirect', path, bool
-      end
-    end
-    def positionfrom(*args)
-      tk_call 'wm', 'positionfrom', path, *args
-    end
-    def protocol(name=nil, cmd=nil)
-      if cmd
-	tk_call('wm', 'protocol', path, name, cmd)
-      elsif name
-	result = tk_call('wm', 'protocol', path, name)
-	(result == "")? nil : tk_tcl2ruby(result)
-      else
-	tk_split_simplelist(tk_call('wm', 'protocol', path))
-      end
-    end
-    def resizable(*args)
-      w = tk_call('wm', 'resizable', path, *args)
-      if args.length == 0
-	list(w).collect{|e| bool(e)}
-      end
-    end
-    def sizefrom(*args)
-      tk_call('wm', 'sizefrom', path, *args)
-    end
-    def state(state=None)
-      tk_call 'wm', 'state', path, state
-    end
-    def title(*args)
-      tk_call 'wm', 'title', path, *args
-    end
-    def transient(*args)
-      window(tk_call('wm', 'transient', path, *args))
-    end
-    def withdraw
-      tk_call 'wm', 'withdraw', path
-    end
-  end
-end
-
-###########################################
-#  convert kanji string to/from utf-8
-###########################################
-if /^8\.[1-9]/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK
-  class TclTkIp
-    # from tkencoding.rb by ttate@jaist.ac.jp
-    alias __eval _eval
-    alias __invoke _invoke
-    private :__eval
-    private :__invoke
-    
-    attr_accessor :encoding
-    
-    def _eval(cmd)
-      if @encoding
-	_fromUTF8(__eval(_toUTF8(cmd, @encoding)), @encoding)
-      else
-	__eval(cmd)
-      end
-    end
-    
-    def _invoke(*cmds)
-      if @encoding
-	cmds = cmds.collect{|cmd| _toUTF8(cmd, @encoding)}
-	_fromUTF8(__invoke(*cmds), @encoding)
-      else
-	__invoke(*cmds)
-	end
-    end
-  end
-
-  module Tk
-    def encoding=(name)
-      INTERP.encoding = name
-    end
-
-    def encoding
-      INTERP.encoding
-    end
-
-    def encoding_names
-      tk_split_simplelist(tk_call('encoding', 'names'))
-    end
-
-    def encoding_system
-      tk_call('encoding', 'system')
-    end
-
-    def encoding_system=(enc)
-      tk_call('encoding', 'system', enc)
-    end
-  end
-
-  # estimate encoding
-  case $KCODE
-  when /^e/i  # EUC
-    Tk.encoding = 'euc-jp'
-  when /^s/i  # SJIS
-    Tk.encoding = 'shiftjis'
-  when /^u/i  # UTF8
-    Tk.encoding = 'utf-8'
-  else        # NONE
-    begin
-      Tk.encoding = Tk.encoding_system
-    rescue StandardError, NameError
-      Tk.encoding = 'utf-8'
-    end
-  end
-
-else
-  # dummy methods
-  module Tk
-    def encoding=(name)
-      nil
-    end
-    def encoding
-      nil
-    end
-    def encoding_names
-      nil
-    end
-    def encoding_system
-      nil
-    end
-    def encoding_system=(enc)
-      nil
-    end
-  end
-end
-
-module TkBindCore
-  def bind(context, cmd=Proc.new, args=nil)
-    Tk.bind(to_eval, context, cmd, args)
-  end
-
-  def bind_append(context, cmd=Proc.new, args=nil)
-    Tk.bind_append(to_eval, context, cmd, args)
-  end
-
-  def bind_remove(context)
-    Tk.bind_remove(to_eval, context)
-  end
-
-  def bindinfo(context=nil)
-    Tk.bindinfo(to_eval, context)
-  end
-end
-
-class TkBindTag
-  include TkBindCore
-
-  BTagID_TBL = {}
-  Tk_BINDTAG_ID = ["btag00000"]
-
-  def TkBindTag.id2obj(id)
-    BTagID_TBL[id]? BTagID_TBL[id]: id
-  end
-
-  ALL = self.new
-  ALL.instance_eval {
-    @id = 'all'
-    BTagID_TBL[@id] = self
-  }
-
-  def initialize(*args)
-    @id = Tk_BINDTAG_ID[0]
-    Tk_BINDTAG_ID[0] = Tk_BINDTAG_ID[0].succ
-    BTagID_TBL[@id] = self
-    bind(*args) if args != []
-  end
-
-  def to_eval
-    @id
-  end
-
-  def inspect
-    format "#", @id
-  end
-end
-
-class TkBindTagAll", @id
-  end
-
-  def ==(other)
-    case other
-    when TkVariable
-      self.equal(self)
-    when String
-      self.to_s == other
-    when Integer
-      self.to_i == other
-    when Float
-      self.to_f == other
-    when Array
-      self.to_a == other
-    else
-      false
-    end
-  end
-
-  def to_a
-    list(value)
-  end
-
-  def to_eval
-    @id
-  end
-
-  def unset(elem=nil)
-    if elem
-      INTERP._eval(format('global %s; unset %s(%s)', 
-			  @id, @id, tk_tcl2ruby(elem)))
-    else
-      INTERP._eval(format('global %s; unset %s', @id, @id))
-    end
-  end
-  alias remove unset
-
-  def trace_callback(elem, op)
-    if @trace_var.kind_of? Array
-      @trace_var.each{|m,e| e.call(self,elem,op) if m.index(op)}
-    end
-    if elem.kind_of? String
-      if @trace_elem[elem].kind_of? Array
-	@trace_elem[elem].each{|m,e| e.call(self,elem,op) if m.index(op)}
-      end
-    end
-  end
-
-  def trace(opts, cmd)
-    @trace_var = [] if @trace_var == nil
-    opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
-    @trace_var.unshift([opts,cmd])
-    if @trace_opts == nil
-      TkVar_CB_TBL[@id] = self
-      @trace_opts = opts
-      Tk.tk_call('trace', 'variable', @id, @trace_opts, 'rb_var')
-    else
-      newopts = @trace_opts.dup
-      opts.each_byte{|c| newopts += c.chr unless newopts.index(c)}
-      if newopts != @trace_opts
-	Tk.tk_call('trace', 'vdelete', @id, @trace_opts, 'rb_var')
-	@trace_opts.replace(newopts)
-	Tk.tk_call('trace', 'variable', @id, @trace_opts, 'rb_var')
-      end
-    end
-  end
-
-  def trace_element(elem, opts, cmd)
-    @trace_elem = {} if @trace_elem == nil
-    @trace_elem[elem] = [] if @trace_elem[elem] == nil
-    opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
-    @trace_elem[elem].unshift([opts,cmd])
-    if @trace_opts == nil
-      TkVar_CB_TBL[@id] = self
-      @trace_opts = opts
-      Tk.tk_call('trace', 'variable', @id, @trace_opts, 'rb_var')
-    else
-      newopts = @trace_opts.dup
-      opts.each_byte{|c| newopts += c.chr unless newopts.index(c)}
-      if newopts != @trace_opts
-	Tk.tk_call('trace', 'vdelete', @id, @trace_opts, 'rb_var')
-	@trace_opts.replace(newopts)
-	Tk.tk_call('trace', 'variable', @id, @trace_opts, 'rb_var')
-      end
-    end
-  end
-
-  def trace_vinfo
-    return [] unless @trace_var
-    @trace_var.dup
-  end
-  def trace_vinfo_for_element(elem)
-    return [] unless @trace_elem
-    return [] unless @trace_elem[elem]
-    @trace_elem[elem].dup
-  end
-
-  def trace_vdelete(opts,cmd)
-    return unless @trace_var.kind_of? Array
-    opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
-    idx = -1
-    newopts = ''
-    @trace_var.each_with_index{|e,i| 
-      if idx < 0 && e[0] == opts && e[1] == cmd
-	idx = i
-	next
-      end
-      e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
-    }
-    if idx >= 0
-      @trace_var.delete_at(idx) 
-    else
-      return
-    end
-
-    @trace_elem.each{|elem|
-      @trace_elem[elem].each{|e|
-	e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
-      }
-    }
-
-    newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
-    if newopts != @trace_opts
-      Tk.tk_call('trace', 'vdelete', @id, @trace_opts, 'rb_var')
-      @trace_opts.replace(newopts)
-      if @trace_opts != ''
-	Tk.tk_call('trace', 'variable', @id, @trace_opts, 'rb_var')
-      end
-    end
-  end
-
-  def trace_vdelete_for_element(elem,opts,cmd)
-    return unless @trace_elem.kind_of? Hash
-    return unless @trace_elem[elem].kind_of? Array
-    opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
-    idx = -1
-    @trace_elem[elem].each_with_index{|e,i| 
-      if idx < 0 && e[0] == opts && e[1] == cmd
-	idx = i
-	next
-      end
-    }
-    if idx >= 0
-      @trace_elem[elem].delete_at(idx)
-    else
-      return
-    end
-
-    newopts = ''
-    @trace_var.each{|e| 
-      e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
-    }
-    @trace_elem.each{|elem|
-      @trace_elem[elem].each{|e|
-	e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
-      }
-    }
-
-    newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
-    if newopts != @trace_opts
-      Tk.tk_call('trace', 'vdelete', @id, @trace_opts, 'rb_var')
-      @trace_opts.replace(newopts)
-      if @trace_opts != ''
-	Tk.tk_call('trace', 'variable', @id, @trace_opts, 'rb_var')
-      end
-    end
-  end
-end
-
-class TkVarAccess= Tk8.4a2 ?
-    if slot
-      conf = tk_split_list(tk_call('place', 'configure', 
-				   win.epath, "-#{slot}") )
-      conf[0] = conf[0][1..-1]
-      conf
-    else
-      tk_split_simplelist(tk_call('place', 'configure', 
-				  win.epath)).collect{|conflist|
-	conf = tk_split_simplelist(conflist)
-	conf[0] = conf[0][1..-1]
-	conf
-      }
-    end
-  end
-
-  def forget(win)
-    tk_call 'place', 'forget', win
-  end
-
-  def info(win)
-    ilist = list(tk_call('place', 'info', win.epath))
-    info = {}
-    while key = ilist.shift
-      info[key[1..-1]] = ilist.shift
-    end
-    return info
-  end
-
-  def slaves(master)
-    list(tk_call('place', 'slaves', master.epath))
-  end
-
-  module_function :configure, :configinfo, :forget, :info, :slaves
-end
-
-module TkOption
-  include Tk
-  extend Tk
-  def add pat, value, pri=None
-    tk_call 'option', 'add', pat, value, pri
-  end
-  def clear
-    tk_call 'option', 'clear'
-  end
-  def get win, name, klass
-    tk_call('option', 'get', win ,name, klass).taint
-  end
-  def readfile file, pri=None
-    tk_call 'option', 'readfile', file, pri
-  end
-  module_function :add, :clear, :get, :readfile
-
-  # support procs on the resource database
-  @@resource_proc_class = Class.new
-  class << @@resource_proc_class
-    private :new
-
-    CARRIER    = '.'.freeze
-    METHOD_TBL = {}
-    ADD_METHOD = false
-    SAFE_MODE  = 4
-
-    def __check_proc_string__(str)
-      # If you want to check the proc_string, do it in this method.
-      str
-    end
-
-    def method_missing(id, *args)
-      res_proc = self::METHOD_TBL[id]
-      unless res_proc.kind_of? Proc
-        if id == :new || (!self::METHOD_TBL.has_key?(id) && !self::ADD_METHOD)
-          raise NoMethodError, 
-                "not support resource-proc '#{id.id2name}' for #{self.name}"
-        end
-        proc_str = TkOption.get(self::CARRIER, id.id2name, '')
-        proc_str = '{' + proc_str + '}' unless /\A\{.*\}\Z/ =~ proc_str
-        proc_str = __check_proc_string__(proc_str)
-        res_proc = eval 'Proc.new' + proc_str
-        self::METHOD_TBL[id] = res_proc
-      end
-      proc{
-         $SAFE = self::SAFE_MODE
-         res_proc.call(*args)
-      }.call
-    end
-
-    private :__check_proc_string__, :method_missing
-  end
-
-  def new_proc_class(klass, func, safe = 4, add = false, parent = nil)
-    klass = klass.to_s if klass.kind_of? Symbol
-    unless (?A..?Z) === klass[0]
-      fail ArgumentError, "bad string '#{klass}' for class name"
-    end
-    unless func.kind_of? Array
-      fail ArgumentError, "method-list must be Array"
-    end
-    func_str = func.join(' ')
-    if parent == nil
-      install_win(parent)
-    elsif parent <= @@resource_proc_class
-      install_win(parent::CARRIER)
-    else
-      fail ArgumentError, "parent must be Resource-Proc class"
-    end
-    carrier = Tk.tk_call('frame', @path, '-class', klass)
-
-    body = <<-"EOD"
-      class #{klass} < TkOption.module_eval('@@resource_proc_class')
-        CARRIER    = '#{carrier}'.freeze
-        METHOD_TBL = {}
-        ADD_METHOD = #{add}
-        SAFE_MODE  = #{safe}
-        %w(#{func_str}).each{|f| METHOD_TBL[f.intern] = nil }
-      end
-    EOD
-
-    if parent.kind_of?(Class) && parent <= @@resource_proc_class
-      parent.class_eval body
-      eval parent.name + '::' + klass
-    else
-      eval body
-      eval 'TkOption::' + klass
-    end
-  end
-  module_function :new_proc_class
-end
-
-module TkTreatFont
-  def font_configinfo
-    ret = TkFont.used_on(self.path)
-    if ret == nil
-      ret = TkFont.init_widget_font(self.path, self.path, 'configure')
-    end
-    ret
-  end
-  alias fontobj font_configinfo
-
-  def font_configure(slot)
-    slot = _symbolkey2str(slot)
-    if (fnt = slot.delete('font'))
-      if fnt.kind_of? TkFont
-	return fnt.call_font_configure(self.path, self.path,'configure',slot)
-      else
-	latinfont_configure(fnt) if fnt
-      end
-    end
-    if (ltn = slot.delete('latinfont'))
-      latinfont_configure(ltn) if ltn
-    end
-    if (ltn = slot.delete('asciifont'))
-      latinfont_configure(ltn) if ltn
-    end
-    if (knj = slot.delete('kanjifont'))
-      kanjifont_configure(knj) if knj
-    end
-
-    tk_call(self.path, 'configure', *hash_kv(slot)) if slot != {}
-    self
-  end
-
-  def latinfont_configure(ltn, keys=nil)
-    fobj = fontobj
-    if ltn.kind_of? TkFont
-      conf = {}
-      ltn.latin_configinfo.each{|key,val| conf[key] = val}
-      if keys
-	fobj.latin_configure(conf.update(keys))
-      else
-	fobj.latin_configure(conf)
-      end
-    else
-      fobj.latin_replace(ltn)
-    end
-  end
-  alias asciifont_configure latinfont_configure
-
-  def kanjifont_configure(knj, keys=nil)
-    fobj = fontobj
-    if knj.kind_of? TkFont
-      conf = {}
-      knj.kanji_configinfo.each{|key,val| conf[key] = val}
-      if keys
-	fobj.kanji_configure(conf.update(keys))
-      else
-	fobj.kanji_configure(cond)
-      end
-    else
-      fobj.kanji_replace(knj)
-    end
-  end
-
-  def font_copy(window, tag=nil)
-    if tag
-      window.tagfontobj(tag).configinfo.each{|key,value|
-	fontobj.configure(key,value)
-      }
-      fontobj.replace(window.tagfontobj(tag).latin_font, 
-		      window.tagfontobj(tag).kanji_font)
-    else
-      window.fontobj.configinfo.each{|key,value|
-	fontobj.configure(key,value)
-      }
-      fontobj.replace(window.fontobj.latin_font, window.fontobj.kanji_font)
-    end
-  end
-
-  def latinfont_copy(window, tag=nil)
-    if tag
-      fontobj.latin_replace(window.tagfontobj(tag).latin_font)
-    else
-      fontobj.latin_replace(window.fontobj.latin_font)
-    end
-  end
-  alias asciifont_copy latinfont_copy
-
-  def kanjifont_copy(window, tag=nil)
-    if tag
-      fontobj.kanji_replace(window.tagfontobj(tag).kanji_font)
-    else
-      fontobj.kanji_replace(window.fontobj.kanji_font)
-    end
-  end
-end
-
-module TkTreatItemFont
-  def __conf_cmd(idx)
-    raise NotImplementError, "need to define `__conf_cmd'"
-  end
-  def __item_pathname(tagOrId)
-    raise NotImplementError, "need to define `__item_pathname'"
-  end
-  private :__conf_cmd, :__item_pathname
-
-  def tagfont_configinfo(tagOrId)
-    pathname = __item_pathname(tagOrId)
-    ret = TkFont.used_on(pathname)
-    if ret == nil
-      ret = TkFont.init_widget_font(pathname, self.path, 
-				    __conf_cmd(0), __conf_cmd(1), tagOrId)
-    end
-    ret
-  end
-  alias tagfontobj tagfont_configinfo
-
-  def tagfont_configure(tagOrId, slot)
-    pathname = __item_pathname(tagOrId)
-    slot = _symbolkey2str(slot)
-    if (fnt = slot.delete('font'))
-      if fnt.kind_of? TkFont
-	return fnt.call_font_configure(pathname, self.path, 
-				       __conf_cmd(0), __conf_cmd(1), 
-				       tagOrId, slot)
-      else
-	latintagfont_configure(tagOrId, fnt) if fnt
-      end
-    end
-    if (ltn = slot.delete('latinfont'))
-      latintagfont_configure(tagOrId, ltn) if ltn
-    end
-    if (ltn = slot.delete('asciifont'))
-      latintagfont_configure(tagOrId, ltn) if ltn
-    end
-    if (knj = slot.delete('kanjifont'))
-      kanjitagfont_configure(tagOrId, knj) if knj
-    end
-
-    tk_call(self.path, __conf_cmd(0), __conf_cmd(1), 
-	    tagOrId, *hash_kv(slot)) if slot != {}
-    self
-  end
-
-  def latintagfont_configure(tagOrId, ltn, keys=nil)
-    fobj = tagfontobj(tagOrId)
-    if ltn.kind_of? TkFont
-      conf = {}
-      ltn.latin_configinfo.each{|key,val| conf[key] = val if val != []}
-      if conf == {}
-	fobj.latin_replace(ltn)
-	fobj.latin_configure(keys) if keys
-      elsif keys
-	fobj.latin_configure(conf.update(keys))
-      else
-	fobj.latin_configure(conf)
-      end
-    else
-      fobj.latin_replace(ltn)
-    end
-  end
-  alias asciitagfont_configure latintagfont_configure
-
-  def kanjitagfont_configure(tagOrId, knj, keys=nil)
-    fobj = tagfontobj(tagOrId)
-    if knj.kind_of? TkFont
-      conf = {}
-      knj.kanji_configinfo.each{|key,val| conf[key] = val if val != []}
-      if conf == {}
-	fobj.kanji_replace(knj)
-	fobj.kanji_configure(keys) if keys
-      elsif keys
-	fobj.kanji_configure(conf.update(keys))
-      else
-	fobj.kanji_configure(conf)
-      end
-    else
-      fobj.kanji_replace(knj)
-    end
-  end
-
-  def tagfont_copy(tagOrId, window, wintag=nil)
-    if wintag
-      window.tagfontobj(wintag).configinfo.each{|key,value|
-	tagfontobj(tagOrId).configure(key,value)
-      }
-      tagfontobj(tagOrId).replace(window.tagfontobj(wintag).latin_font, 
-				window.tagfontobj(wintag).kanji_font)
-    else
-      window.tagfont(wintag).configinfo.each{|key,value|
-	tagfontobj(tagOrId).configure(key,value)
-      }
-      tagfontobj(tagOrId).replace(window.fontobj.latin_font, 
-				window.fontobj.kanji_font)
-    end
-  end
-
-  def latintagfont_copy(tagOrId, window, wintag=nil)
-    if wintag
-      tagfontobj(tagOrId).latin_replace(window.tagfontobj(wintag).latin_font)
-    else
-      tagfontobj(tagOrId).latin_replace(window.fontobj.latin_font)
-    end
-  end
-  alias asciitagfont_copy latintagfont_copy
-
-  def kanjitagfont_copy(tagOrId, window, wintag=nil)
-    if wintag
-      tagfontobj(tagOrId).kanji_replace(window.tagfontobj(wintag).kanji_font)
-    else
-      tagfontobj(tagOrId).kanji_replace(window.fontobj.kanji_font)
-    end
-  end
-end
-
-class TkObjectvalue})
-	end
-      else
-	tk_call path, 'configure', "-#{slot}", value
-      end
-    end
-  end
-
-  def configure_cmd(slot, value)
-    configure slot, install_cmd(value)
-  end
-
-  def configinfo(slot = nil)
-    if slot == 'font' || slot == :font || 
-       slot == 'kanjifont' || slot == :kanjifont
-      fontobj
-    else
-      if slot
-	case slot.to_s
-	when 'text', 'label', 'show', 'data', 'file'
-	  conf = tk_split_simplelist(tk_send('configure', "-#{slot}") )
-	else
-	  conf = tk_split_list(tk_send('configure', "-#{slot}") )
-	end
-	conf[0] = conf[0][1..-1]
-	conf
-      else
-	ret = tk_split_simplelist(tk_send('configure') ).collect{|conflist|
-	  conf = tk_split_simplelist(conflist)
-	  conf[0] = conf[0][1..-1]
-	  case conf[0]
-	  when 'text', 'label', 'show', 'data', 'file'
-	  else
-	    if conf[3]
-	      if conf[3].index('{')
-		conf[3] = tk_split_list(conf[3]) 
-	      else
-		conf[3] = tk_tcl2ruby(conf[3]) 
-	      end
-	    end
-	    if conf[4]
-	      if conf[4].index('{')
-		conf[4] = tk_split_list(conf[4]) 
-	      else
-		conf[4] = tk_tcl2ruby(conf[4]) 
-	      end
-	    end
-	  end
-	  conf
-	}
-	fontconf = ret.assoc('font')
-	if fontconf
-	  ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
-	  fontconf[4] = fontobj
-	  ret.push(fontconf)
-	else
-	  ret
-	end
-      end
-    end
-  end
-
-  def event_generate(context, keys=nil)
-    if keys
-      tk_call('event', 'generate', path, 
-	      "<#{tk_event_sequence(context)}>", *hash_kv(keys))
-    else
-      tk_call('event', 'generate', path, "<#{tk_event_sequence(context)}>")
-    end
-  end
-
-  def tk_trace_variable(v)
-    unless v.kind_of?(TkVariable)
-      fail ArgumentError, format("requires TkVariable given %s", v.type)
-    end
-    v
-  end
-  private :tk_trace_variable
-
-  def destroy
-    tk_call 'trace', 'vdelete', @tk_vn, 'w', @var_id if @var_id
-  end
-end
-
-class TkWindow= Tk8.4a2 ?
-    if slot
-      conf = tk_split_list(tk_call('place', 'configure', epath, "-#{slot}") )
-      conf[0] = conf[0][1..-1]
-      conf
-    else
-      tk_split_simplelist(tk_call('place', 
-				  'configure', epath)).collect{|conflist|
-	conf = tk_split_simplelist(conflist)
-	conf[0] = conf[0][1..-1]
-	conf
-      }
-    end
-  end
-
-  def place_info()
-    ilist = list(tk_call('place', 'info', epath))
-    info = {}
-    while key = ilist.shift
-      info[key[1..-1]] = ilist.shift
-    end
-    return info
-  end
-
-  def place_slaves()
-    list(tk_call('place', 'slaves', epath))
-  end
-
-  def focus(force=false)
-    if force
-      tk_call 'focus', '-force', path
-    else
-      tk_call 'focus', path
-    end
-    self
-  end
-
-  def grab(*args)
-    if !args or args.length == 0
-      tk_call 'grab', 'set', path
-    elsif args.length == 1
-      case args[0]
-      when 'global', :global
-	return(tk_call('grab', 'set', '-global', path))
-      when 'release', :release
-	return tk_call('grab', 'release', path)
-      else
-	val = tk_call('grab', args[0], path)
-      end
-      case args[0]
-      when 'current', :current
-	return window(val)
-      when 'status', :status
-	return val
-      end
-    else
-      fail ArgumentError, 'wrong # of args'
-    end
-  end
-
-  def lower(below=None)
-    tk_call 'lower', epath, below
-    self
-  end
-  def raise(above=None)
-    tk_call 'raise', epath, above
-    self
-  end
-
-  def command(cmd=Proc.new)
-    configure_cmd 'command', cmd
-  end
-
-  def colormodel model=None
-    tk_call 'tk', 'colormodel', path, model
-    self
-  end
-
-  def destroy
-    tk_call 'destroy', epath
-    if @cmdtbl
-      for id in @cmdtbl
-	uninstall_cmd id
-      end
-    end
-    uninstall_win
-  end
-
-  def wait_visibility
-    tk_call 'tkwait', 'visibility', path
-  end
-  alias wait wait_visibility
-
-  def wait_destroy
-    tk_call 'tkwait', 'window', epath
-  end
-
-  def bindtags(taglist=nil)
-    if taglist
-      fail ArgumentError unless taglist.kind_of? Array
-      tk_call('bindtags', path, taglist)
-    else
-      list(tk_call('bindtags', path)).collect{|tag|
-	if tag.kind_of?(String) 
-	  if cls = WidgetClassNames[tag]
-	    cls
-	  elsif btag = TkBindTag.id2obj(tag)
-	    btag
-	  else
-	    tag
-	  end
-	else
-	  tag
-	end
-      }
-    end
-  end
-end
-
-class TkRootparent}
-      end
-    end
-    if keys.key?('classname')
-       keys['class'] = keys.delete('classname')
-    end
-    @classname = keys['class']
-    @colormap  = keys['colormap']
-    @container = keys['container']
-    @visual    = keys['visual']
-    super(keys)
-  end
-
-  def create_self(keys)
-    if keys and keys != None
-      tk_call 'frame', @path, *hash_kv(keys)
-    else
-      tk_call 'frame', @path
-    end
-  end
-end
-
-class TkLabelval})
-      else
-	tk_call 'itemconfigure', index, "-#{key}", val
-      end
-    end
-  end
-
-  def itemconfiginfo(index, key=nil)
-    if key
-      case key.to_s
-      when 'text', 'label', 'show'
-	conf = tk_split_simplelist(tk_send('itemconfigure',index,"-#{key}"))
-      else
-	conf = tk_split_list(tk_send('itemconfigure',index,"-#{key}"))
-      end
-      conf[0] = conf[0][1..-1]
-      conf
-    else
-      tk_split_simplelist(tk_send('itemconfigure', index)).collect{|conflist|
-	conf = tk_split_simplelist(conflist)
-	conf[0] = conf[0][1..-1]
-	case conf[0]
-	when 'text', 'label', 'show'
-	else
-	  if conf[3]
-	    if conf[3].index('{')
-	      conf[3] = tk_split_list(conf[3]) 
-	    else
-	      conf[3] = tk_tcl2ruby(conf[3]) 
-	    end
-	  end
-	  if conf[4]
-	    if conf[4].index('{')
-	      conf[4] = tk_split_list(conf[4]) 
-	    else
-	      conf[4] = tk_tcl2ruby(conf[4]) 
-	    end
-	  end
-	end
-	conf
-      }
-    end
-  end
-end
-
-module TkTreatMenuEntryFont
-  include TkTreatItemFont
-
-  ItemCMD = ['entryconfigure', TkComm::None]
-  def __conf_cmd(idx)
-    ItemCMD[idx]
-  end
-  
-  def __item_pathname(tagOrId)
-    self.path + ';' + tagOrId.to_s
-  end
-end
-
-class TkMenuval})
-      else
-	tk_call 'entryconfigure', index, "-#{key}", val
-      end
-    end
-  end
-
-  def entryconfiginfo(index, key=nil)
-    if key
-      case key.to_s
-      when 'text', 'label', 'show'
-	conf = tk_split_simplelist(tk_send('entryconfigure',index,"-#{key}"))
-      else
-	conf = tk_split_list(tk_send('entryconfigure',index,"-#{key}"))
-      end
-      conf[0] = conf[0][1..-1]
-      conf
-    else
-      tk_split_simplelist(tk_send('entryconfigure', index)).collect{|conflist|
-	conf = tk_split_simplelist(conflist)
-	conf[0] = conf[0][1..-1]
-	case conf[0]
-	when 'text', 'label', 'show'
-	else
-	  if conf[3]
-	    if conf[3].index('{')
-	      conf[3] = tk_split_list(conf[3]) 
-	    else
-	      conf[3] = tk_tcl2ruby(conf[3]) 
-	    end
-	  end
-	  if conf[4]
-	    if conf[4].index('{')
-	      conf[4] = tk_split_list(conf[4]) 
-	    else
-	      conf[4] = tk_tcl2ruby(conf[4]) 
-	    end
-	  end
-	end
-	conf
-      }
-    end
-  end
-end
-
-class TkMenuClone@variable, 
-	      'label'=>value, 'value'=>value)
-  end
-  def index(index)
-    @menu.index(index)
-  end
-  def invoke(index)
-    @menu.invoke(index)
-  end
-  def insert(index, value)
-    @menu.add(index, 'radiobutton', 'variable'=>@variable, 
-	      'label'=>value, 'value'=>value)
-  end
-  def delete(index, last=None)
-    @menu.delete(index, last)
-  end
-  def yposition(index)
-    @menu.yposition(index)
-  end
-  def menucget(index, key)
-    @menu.cget(index, key)
-  end
-  def menuconfigure(index, key, val=None)
-    @menu.configure(index, key, val)
-  end
-  def menuconfiginfo(index, key=nil)
-    @menu.configinfo(index, key)
-  end
-  def entrycget(index, key)
-    @menu.entrycget(index, key)
-  end
-  def entryconfigure(index, key, val=None)
-    @menu.entryconfigure(index, key, val)
-  end
-  def entryconfiginfo(index, key=nil)
-    @menu.entryconfiginfo(index, key)
-  end
-end
-
-module TkComposite
-  include Tk
-  extend Tk
-
-  def initialize(parent=nil, *args)
-    if parent.kind_of? Hash
-      keys = _symbolkey2str(parent)
-      parent = keys['parent']
-      keys['parent'] = @frame = TkFrame.new(parent)
-      @path = @epath = @frame.path
-      initialize_composite(keys)
-    else
-      @frame = TkFrame.new(parent)
-      @path = @epath = @frame.path
-      initialize_composite(*args)
-    end
-  end
-
-  def epath
-    @epath
-  end
-
-  def initialize_composite(*args) end
-  private :initialize_composite
-
-  def delegate(option, *wins)
-    unless @delegates
-      @delegates = {} 
-      @delegates['DEFAULT'] = @frame
-    end
-    if @delegates[option].kind_of?(Array)
-      for i in wins
-	@delegates[option].push(i)
-      end
-    else
-      @delegates[option] = wins
-    end
-  end
-
-  def configure(slot, value=None)
-    if slot.kind_of? Hash
-      slot.each{|slot,value| configure slot, value}
-    else
-      if @delegates and @delegates[slot]
-	for i in @delegates[slot]
-	  if not i
-	    i = @delegates['DEFALUT']
-	    redo
-	  else
-	    last = i.configure(slot, value)
-	  end
-	end
-	last
-      else
-	super
-      end
-    end
-  end
-end
-
-module TkClipboard
-  include Tk
-  extend Tk
-
-  def clear
-    tk_call 'clipboard', 'clear'
-  end
-  def get
-    begin
-      tk_call 'selection', 'get', '-selection', 'CLIPBOARD'
-    rescue
-      ''
-    end
-  end
-  def set(data)
-    clear
-    append(data)
-  end
-  def append(data)
-    tk_call 'clipboard', 'append', data
-  end
-
-  module_function :clear, :set, :get, :append
-end
-
-autoload :TkCanvas, 'tkcanvas'
-autoload :TkImage, 'tkcanvas'
-autoload :TkBitmapImage, 'tkcanvas'
-autoload :TkPhotoImage, 'tkcanvas'
-autoload :TkEntry, 'tkentry'
-autoload :TkSpinbox, 'tkentry'
-autoload :TkText, 'tktext'
-autoload :TkDialog, 'tkdialog'
-autoload :TkWarning, 'tkdialog'
-autoload :TkMenubar, 'tkmenubar'
-autoload :TkAfter, 'tkafter'
-autoload :TkPalette, 'tkpalette'
-autoload :TkFont, 'tkfont'
-autoload :TkVirtualEvent, 'tkvirtevent'
-autoload :TkBgError, 'tkbgerror'
-autoload :TkManageFocus, 'tkmngfocus'
-autoload :TkPalette, 'tkpalette'
-autoload :TkWinDDE, 'tkwinpkg'
-autoload :TkWinRegistry, 'tkwinpkg'
-autoload :TkMacResource, 'tkmacpkg'
diff --git a/ext/tk/lib/tkafter.rb b/ext/tk/lib/tkafter.rb
deleted file mode 100644
index ec39d9957f..0000000000
--- a/ext/tk/lib/tkafter.rb
+++ /dev/null
@@ -1,312 +0,0 @@
-#
-#   tkafter.rb : methods for Tcl/Tk after command
-#
-#   $Id$
-#
-require 'tk'
-
-class TkAfter
-  include TkCore
-  extend TkCore
-
-  Tk_CBID = [0]
-  Tk_CBTBL = {}
-
-  INTERP._invoke("proc", "rb_after", "id", "ruby [format \"TkAfter.callback %%Q!%s!\" $id]")
-
-  ###############################
-  # class methods
-  ###############################
-  def TkAfter.callback(obj_id)
-    @after_id = nil
-    ex_obj = Tk_CBTBL[obj_id]
-    return nil if ex_obj == nil; # canceled
-    _get_eval_string(ex_obj.do_callback)
-  end
-
-  def TkAfter.info
-    tk_call('after', 'info').split(' ').collect!{|id|
-      ret = Tk_CBTBL.find{|key,val| val.after_id == id}
-      (ret == nil)? id: ret[1]
-    }
-  end
-
-  ###############################
-  # instance methods
-  ###############################
-  def do_callback
-    @in_callback = true
-    begin
-      @return_value = @current_proc.call(self)
-    rescue StandardError, NameError
-      if @cancel_on_exception
-	cancel
-	return nil
-      else
-	fail $!
-      end
-    end
-    if @set_next
-      set_next_callback(@current_args)
-    else
-      @set_next = true
-    end
-    @in_callback = false
-    @return_value
-  end
-
-  def set_callback(sleep, args=nil)
-    @after_script = "rb_after #{@id}"
-    @after_id = tk_call('after', sleep, @after_script)
-    @current_args = args
-    @current_script = [sleep, @after_script]
-  end
-
-  def set_next_callback(args)
-    if @running == false || @proc_max == 0 || @do_loop == 0
-      Tk_CBTBL[@id] = nil ;# for GC
-      @running = false
-      return
-    end
-    if @current_pos >= @proc_max
-      if @do_loop < 0 || (@do_loop -= 1) > 0
-	@current_pos = 0
-      else
-	Tk_CBTBL[@id] = nil ;# for GC
-	@running = false
-	return
-      end
-    end
-
-    @current_args = args
-
-    if @sleep_time.kind_of? Proc
-      sleep = @sleep_time.call(self)
-    else
-      sleep = @sleep_time
-    end
-    @current_sleep = sleep
-
-    cmd, *cmd_args = @loop_proc[@current_pos]
-    @current_pos += 1
-    @current_proc = cmd
-
-    set_callback(sleep, cmd_args)
-  end
-
-  def initialize(*args)
-    @id = format("a%.4d", Tk_CBID[0])
-    Tk_CBID[0] += 1
-
-    @set_next = true
-
-    @init_sleep = 0
-    @init_proc = nil
-    @init_args = []
-
-    @current_script = []
-    @current_proc = nil
-    @current_args = nil
-    @return_value = nil
-
-    @sleep_time = 0
-    @current_sleep = 0
-    @loop_exec = 0
-    @do_loop = 0
-    @loop_proc = []
-    @proc_max = 0
-    @current_pos = 0
-
-    @after_id = nil
-    @after_script = nil
-
-    @cancel_on_exception = true
-
-    set_procs(*args) if args != []
-
-    @running = false
-  end
-
-  attr :after_id
-  attr :after_script
-  attr :current_proc
-  attr :current_args
-  attr :current_sleep
-  alias :current_interval :current_sleep
-  attr :return_value
-
-  attr_accessor :loop_exec
-
-  def get_procs
-    [@init_sleep, @init_proc, @init_args, @sleep_time, @loop_exec, @loop_proc]
-  end
-
-  def current_status
-    [@running, @current_sleep, @current_proc, @current_args, 
-      @do_loop, @cancel_on_exception]
-  end
-
-  def cancel_on_exception?
-    @cancel_on_exception
-  end
-
-  def cancel_on_exception=(mode)
-    @cancel_on_exception = mode
-  end
-
-  def running?
-    @running
-  end
-
-  def loop_rest
-    @do_loop
-  end
-
-  def loop_rest=(rest)
-    @do_loop = rest
-  end
-
-  def set_procs(interval, loop_exec, *procs)
-    if !interval == 'idle' \
-       && !interval.kind_of?(Integer) && !interval.kind_of?(Proc)
-      fail format("%s need to be Integer or Proc", interval.inspect)
-    end
-    @sleep_time = interval
-
-    @loop_proc = []
-    procs.each{|e|
-      if e.kind_of? Proc
-	@loop_proc.push([e])
-      else
-	@loop_proc.push(e)
-      end
-    }
-    @proc_max = @loop_proc.size
-    @current_pos = 0
-
-    @do_loop = 0
-    if loop_exec
-      if loop_exec.kind_of?(Integer) && loop_exec < 0
-	@loop_exec = -1
-      elsif loop_exec == nil || loop_exec == false || loop_exec == 0
-	@loop_exec = 1
-      else
-	if not loop_exec.kind_of?(Integer)
-	  fail format("%s need to be Integer", loop_exec.inspect)
-	end
-	@loop_exec = loop_exec
-      end
-      @do_loop = @loop_exec
-    end
-
-    self
-  end
-
-  def add_procs(*procs)
-    procs.each{|e|
-      if e.kind_of? Proc
-	@loop_proc.push([e])
-      else
-	@loop_proc.push(e)
-      end
-    }
-    @proc_max = @loop_proc.size
-
-    self
-  end
-
-  def set_start_proc(sleep, init_proc, *init_args)
-    if !sleep == 'idle' && !sleep.kind_of?(Integer)
-      fail format("%s need to be Integer", sleep.inspect)
-    end
-    @init_sleep = sleep
-    @init_proc = init_proc
-    @init_args = init_args
-    self
-  end
-
-  def start(*init_args)
-    return nil if @running
-
-    Tk_CBTBL[@id] = self
-    @do_loop = @loop_exec
-    @current_pos = 0
-
-    argc = init_args.size
-    if argc > 0
-      sleep = init_args.shift
-      if !sleep == 'idle' && !sleep.kind_of?(Integer)
-	fail format("%s need to be Integer", sleep.inspect)
-      end
-      @init_sleep = sleep
-    end
-    @init_proc = init_args.shift if argc > 1
-    @init_args = init_args if argc > 0
-
-    @current_sleep = @init_sleep
-    @running = true
-    if @init_proc
-      if not @init_proc.kind_of? Proc
-	fail format("%s need to be Proc", @init_proc.inspect)
-      end
-      @current_proc = @init_proc
-      set_callback(sleep, @init_args)
-      @set_next = false if @in_callback
-    else
-      set_next_callback(@init_args)
-    end
-
-    self
-  end
-
-  def restart(*restart_args)
-    cancel if @running
-    if restart_args == []
-      start(@init_sleep, @init_proc, *@init_args)
-    else
-      start(*restart_args)
-    end
-  end
-
-  def cancel
-    @running = false
-    tk_call 'after', 'cancel', @after_id if @after_id
-    @after_id = nil
-    Tk_CBTBL[@id] = nil ;# for GC
-    self
-  end
-  alias stop cancel
-
-  def continue(wait=nil)
-    sleep, cmd = @current_script
-    return nil if cmd == nil || @running == true
-    if wait
-      if not wait.kind_of? Integer
-	fail format("%s need to be Integer", wait.inspect)
-      end
-      sleep = wait
-    end
-    Tk_CBTBL[@id] = self
-    @running = true
-    @after_id = tk_call('after', sleep, cmd)
-    self
-  end
-
-  def skip
-    return nil if @running == false
-    cancel
-    Tk_CBTBL[@id] = self
-    @running = true
-    set_next_callback(@current_args)
-    self
-  end
-
-  def info
-    if @after_id
-      inf = tk_split_list(tk_call('after', 'info', @after_id))
-      [Tk_CBTBL[inf[0][1]], inf[1]]
-    else
-      nil
-    end
-  end
-end
diff --git a/ext/tk/lib/tkbgerror.rb b/ext/tk/lib/tkbgerror.rb
deleted file mode 100644
index 8022077a3f..0000000000
--- a/ext/tk/lib/tkbgerror.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-#  tkbgerror -- bgerror ( tkerror ) module
-#                     1998/07/16 by Hidetoshi Nagai 
-#
-require 'tk'
-
-module TkBgError
-  extend Tk
-
-  def bgerror(message)
-    tk_call 'bgerror', message
-  end
-  alias tkerror bgerror
-  alias show bgerror
-
-  module_function :bgerror, :tkerror, :show
-end
diff --git a/ext/tk/lib/tkcanvas.rb b/ext/tk/lib/tkcanvas.rb
deleted file mode 100644
index 18febd2f13..0000000000
--- a/ext/tk/lib/tkcanvas.rb
+++ /dev/null
@@ -1,874 +0,0 @@
-#
-#		tkcanvas.rb - Tk canvas classes
-#			$Date$
-#			by Yukihiro Matsumoto 
-#			$Date$
-#			by Hidetoshi Nagai 
-
-require "tk"
-require 'tkfont'
-
-module TkTreatCItemFont
-  include TkTreatItemFont
-
-  ItemCMD = ['itemconfigure', TkComm::None]
-  def __conf_cmd(idx)
-    ItemCMD[idx]
-  end
-
-  def __item_pathname(tagOrId)
-    if tagOrId.kind_of?(TkcItem) || tagOrId.kind_of?(TkcTag)
-      self.path + ';' + tagOrId.id.to_s
-    else
-      self.path + ';' + tagOrId.to_s
-    end
-  end
-end
-
-class TkCanvasvalue})
-      else
-	tk_send 'itemconfigure', tagid(tagOrId), "-#{key}", value
-      end
-    end
-  end
-#  def itemconfigure(tagOrId, key, value=None)
-#    if key.kind_of? Hash
-#      tk_send 'itemconfigure', tagid(tagOrId), *hash_kv(key)
-#    else
-#      tk_send 'itemconfigure', tagid(tagOrId), "-#{key}", value
-#    end
-#  end
-#  def itemconfigure(tagOrId, keys)
-#    tk_send 'itemconfigure', tagid(tagOrId), *hash_kv(keys)
-#  end
-
-  def itemconfiginfo(tagOrId, key=nil)
-    if key
-      case key.to_s
-      when 'dash', 'activedash', 'disableddash'
-	conf = tk_split_simplelist(tk_send('itemconfigure', 
-					   tagid(tagOrId), "-#{key}"))
-	if conf[3] && conf[3] =~ /^[0-9]/
-	  conf[3] = list(conf[3])
-	end
-	if conf[4] && conf[4] =~ /^[0-9]/
-	  conf[4] = list(conf[4])
-	end
-      when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile'
-	conf = tk_split_simplelist(tk_send('itemconfigure', 
-					   tagid(tagOrId), "-#{key}"))
-      else
-	conf = tk_split_list(tk_send('itemconfigure', 
-				     tagid(tagOrId), "-#{key}"))
-      end
-      conf[0] = conf[0][1..-1]
-      conf
-    else
-      tk_split_simplelist(tk_send('itemconfigure', 
-				  tagid(tagOrId))).collect{|conflist|
-	conf = tk_split_simplelist(conflist)
-	conf[0] = conf[0][1..-1]
-	case conf[0]
-	when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile'
-	when 'dash', 'activedash', 'disableddash'
-	  if conf[3] && conf[3] =~ /^[0-9]/
-	    conf[3] = list(conf[3])
-	  end
-	  if conf[4] && conf[4] =~ /^[0-9]/
-	    conf[4] = list(conf[4])
-	  end
-	else
-	  if conf[3]
-	    if conf[3].index('{')
-	      conf[3] = tk_split_list(conf[3]) 
-	    else
-	      conf[3] = tk_tcl2ruby(conf[3]) 
-	    end
-	  end
-	  if conf[4]
-	    if conf[4].index('{')
-	      conf[4] = tk_split_list(conf[4]) 
-	    else
-	      conf[4] = tk_tcl2ruby(conf[4]) 
-	    end
-	  end
-	end
-	conf
-      }
-    end
-  end
-
-  def lower(tag, below=None)
-    tk_send 'lower', tagid(tag), tagid(below)
-  end
-
-  def move(tag, x, y)
-    tk_send 'move', tagid(tag), x, y
-  end
-
-  def postscript(keys)
-    tk_send "postscript", *hash_kv(keys)
-  end
-
-  def raise(tag, above=None)
-    tk_send 'raise', tagid(tag), tagid(above)
-  end
-
-  def scale(tag, x, y, xs, ys)
-    tk_send 'scale', tagid(tag), x, y, xs, ys
-  end
-
-  def scan_mark(x, y)
-    tk_send 'scan', 'mark', x, y
-  end
-  def scan_dragto(x, y)
-    tk_send 'scan', 'dragto', x, y
-  end
-
-  def select(mode, *args)
-    tk_send 'select', mode, *args
-  end
-  def select_adjust(tagOrId, index)
-    select('adjust', tagid(tagOrId), index)
-  end
-  def select_clear
-    select('clear')
-  end
-  def select_from(tagOrId, index)
-    select('from', tagid(tagOrId), index)
-  end
-  def select_item
-    select('item')
-  end
-  def select_to(tagOrId, index)
-    select('to', tagid(tagOrId), index)
-  end
-
-  def itemtype(tag)
-    TkcItem.type2class(tk_send('type', tagid(tag)))
-  end
-end
-
-module TkcTagAccess
-  include TkComm
-  include TkTreatTagFont
-
-  def addtag(tag)
-    @c.addtag(tag, 'with', @id)
-  end
-
-  def bbox
-    @c.bbox(@id)
-  end
-
-  def bind(seq, cmd=Proc.new, args=nil)
-    @c.itembind @id, seq, cmd, args
-  end
-
-  def bindinfo(seq=nil)
-    @c.itembindinfo @id, seq
-  end
-
-  def cget(option)
-    @c.itemcget @id, option
-  end
-
-  def configure(key, value=None)
-    @c.itemconfigure @id, key, value
-  end
-#  def configure(keys)
-#    @c.itemconfigure @id, keys
-#  end
-
-  def configinfo(key=nil)
-    @c.itemconfiginfo @id, key
-  end
-
-  def coords(*args)
-    @c.coords @id, *args
-  end
-
-  def dchars(first, last=None)
-    @c.dchars @id, first, last
-  end
-
-  def dtag(tag_to_del=None)
-    @c.dtag @id, tag_to_del
-  end
-
-  def find
-    @c.find 'withtag', @id
-  end
-  alias list find
-
-  def focus
-    @c.itemfocus @id
-  end
-
-  def gettags
-    @c.gettags @id
-  end
-
-  def icursor(index)
-    @c.icursor @id, index
-  end
-
-  def index(index)
-    @c.index @id, index
-  end
-
-  def insert(beforethis, string)
-    @c.insert @id, beforethis, string
-  end
-
-  def lower(belowthis=None)
-    @c.lower @id, belowthis
-  end
-
-  def move(xamount, yamount)
-    @c.move @id, xamount, yamount
-  end
-
-  def raise(abovethis=None)
-    @c.raise @id, abovethis
-  end
-
-  def scale(xorigin, yorigin, xscale, yscale)
-    @c.scale @id, xorigin, yorigin, xscale, yscale
-  end
-
-  def select_adjust(index)
-    @c.select('adjust', @id, index)
-  end
-  def select_from(index)
-    @c.select('from', @id, index)
-  end
-  def select_to(index)
-    @c.select('to', @id, index)
-  end
-
-  def itemtype
-    @c.itemtype @id
-  end
-
-  # Following operators support logical expressions of canvas tags
-  # (for Tk8.3+).
-  # If tag1.path is 't1' and tag2.path is 't2', then
-  #      ltag = tag1 & tag2; ltag.path => "(t1)&&(t2)"
-  #      ltag = tag1 | tag2; ltag.path => "(t1)||(t2)"
-  #      ltag = tag1 ^ tag2; ltag.path => "(t1)^(t2)"
-  #      ltag = - tag1;      ltag.path => "!(t1)"
-  def & (tag)
-    if tag.kind_of? TkObject
-      TkcTagString.new(@c, '(' + @id + ')&&(' + tag.path + ')')
-    else
-      TkcTagString.new(@c, '(' + @id + ')&&(' + tag.to_s + ')')
-    end
-  end
-
-  def | (tag)
-    if tag.kind_of? TkObject
-      TkcTagString.new(@c, '(' + @id + ')||(' + tag.path + ')')
-    else
-      TkcTagString.new(@c, '(' + @id + ')||(' + tag.to_s + ')')
-    end
-  end
-
-  def ^ (tag)
-    if tag.kind_of? TkObject
-      TkcTagString.new(@c, '(' + @id + ')^(' + tag.path + ')')
-    else
-      TkcTagString.new(@c, '(' + @id + ')^(' + tag.to_s + ')')
-    end
-  end
-
-  def -@
-    TkcTagString.new(@c, '!(' + @id + ')')
-  end
-end
-
-class TkcTag
-#
-#			$Id$
-
-require "tk"
-
-TopLevel = TkToplevel
-Frame = TkFrame
-Label = TkLabel
-Button = TkButton
-Radiobutton = TkRadioButton
-Checkbutton = TkCheckButton
-Message = TkMessage
-Entry = TkEntry
-Spinbox = TkSpinbox
-Text = TkText
-Scale = TkScale
-Scrollbar = TkScrollbar
-Listbox = TkListbox
-Menu = TkMenu
-Menubutton = TkMenubutton
-Canvas = TkCanvas
-Arc = TkcArc
-Bitmap = TkcBitmap
-Line = TkcLine
-Oval = TkcOval
-Polygon = TkcPolygon
-Rectangle = TkcRectangle
-TextItem = TkcText
-WindowItem = TkcWindow
-BitmapImage = TkBitmapImage
-PhotoImage = TkPhotoImage
-Selection = TkSelection
-Winfo = TkWinfo
-Pack = TkPack
-Grid = TkGrid
-Place = TkPlace
-Variable = TkVariable
-Font = TkFont
-VirtualEvent = TkVirtualEvent
-
-def Mainloop
-  Tk.mainloop
-end
diff --git a/ext/tk/lib/tkdialog.rb b/ext/tk/lib/tkdialog.rb
deleted file mode 100644
index 8b8ee69128..0000000000
--- a/ext/tk/lib/tkdialog.rb
+++ /dev/null
@@ -1,142 +0,0 @@
-require "tk"
-
-class TkDialog < TkWindow
-  extend Tk
-
-  # initialize tk_dialog
-  def initialize(keys = nil)
-    super()
-    @var = TkVariable.new
-    id = @var.id
-
-    @title   = title
-
-    @message = message
-    @message_config = message_config
-
-    @bitmap  = bitmap
-    @bitmap_config = message_config
-
-    @default_button = default_button
-
-    @buttons = buttons
-    @button_configs = proc{|num| button_configs num}
-
-    if keys.kind_of? Hash
-      keys = _symbolkey2str(keys)
-      @title   = keys['title'] if keys['title']
-      @message = keys['message'] if keys['message']
-      @bitmap  = keys['bitmap'] if keys['bitmap']
-      @default_button = keys['default'] if keys['default']
-      @buttons = keys['buttons'] if keys['buttons']
-
-      @command = keys['prev_command']
-
-      @message_config = keys['message_config'] if keys['message_config']
-      @bitmap_config  = keys['bitmap_config']  if keys['bitmap_config']
-      @button_configs = keys['button_configs'] if keys['button_configs']
-    end
-
-    if @title.include? ?\s
-      @title = '{' + @title + '}'
-    end
-
-    @buttons = tk_split_list(@buttons) if @buttons.kind_of? String
-    @buttons = @buttons.collect{|s|
-      if s.kind_of? Array
-	s = s.join(' ')
-      end
-      if s.include? ?\s
-	'{' + s + '}'
-      else
-	s
-      end
-    }
-
-    config = ""
-    if @message_config.kind_of? Hash
-      config << format("%s.msg configure %s\n", 
-		       @path, hash_kv(@message_config).join(' '))
-    end
-    if @bitmap_config.kind_of? Hash
-      config << format("%s.msg configure %s\n", 
-		       @path, hash_kv(@bitmap_config).join(' '))
-    end
-    if @button_configs.kind_of? Proc
-      @buttons.each_index{|i|
-	if (c = @button_configs.call(i)).kind_of? Hash
-	  config << format("%s.button%s configure %s\n", 
-			   @path, i, hash_kv(c).join(' '))
-	end
-      }
-    end
-    config = 'after idle {' + config + '};' if config != ""
-
-    if @command.kind_of? Proc
-      @command.call(self)
-    end
-
-    INTERP._eval('eval {global '+id+';'+config+
-		 'set '+id+' [tk_dialog '+ 
-		 @path+" "+@title+" {#{@message}} "+@bitmap+" "+
-		 String(@default_button)+" "+@buttons.join(' ')+']}')
-  end
-  def value
-    return @var.value.to_i
-  end
-  ######################################################
-  #                                                    #
-  # these methods must be overridden for each dialog   #
-  #                                                    #
-  ######################################################
-  def title
-    return "DIALOG"
-  end
-  def message
-    return "MESSAGE"
-  end
-  def message_config
-    return nil
-  end
-  def bitmap
-    return "info"
-  end
-  def bitmap_config
-    return nil
-  end
-  def default_button
-    return 0
-  end
-  def buttons
-    #return "BUTTON1 BUTTON2"
-    return ["BUTTON1", "BUTTON2"]
-  end
-  def button_configs(num)
-    return nil
-  end
-end
-
-#
-# dialog for warning
-#
-class TkWarning < TkDialog
-  def initialize(mes)
-    @mes = mes
-    super()
-  end
-  def message
-    return @mes
-  end
-  def title
-    return "WARNING";
-  end
-  def bitmap
-    return "warning";
-  end
-  def default_button
-    return 0;
-  end
-  def buttons
-    return "OK";
-  end
-end
diff --git a/ext/tk/lib/tkentry.rb b/ext/tk/lib/tkentry.rb
deleted file mode 100644
index 2772dfd676..0000000000
--- a/ext/tk/lib/tkentry.rb
+++ /dev/null
@@ -1,224 +0,0 @@
-#
-#		tkentry.rb - Tk entry classes
-#			$Date$
-#			by Yukihiro Matsumoto 
-
-require 'tk.rb'
-
-class TkEntry'Helvetica'.freeze, 'size'=>-12}
-	    knj = 'k14'
-	    #knj = '-misc-fixed-medium-r-normal--14-*-*-*-c-*-jisx0208.1983-0'
-	  when 'windows'
-	    ltn = {'family'=>'MS Sans Serif'.freeze, 'size'=>8}
-	    knj = 'mincho'
-	  when 'macintosh'
-	    ltn = 'system'
-	    knj = 'mincho'
-	  else # unknown
-	    ltn = 'Helvetica'
-	    knj = 'mincho'
-	  end
-        end
-      rescue
-        ltn = 'Helvetica'
-        knj = 'mincho'
-      end
-
-    else # not JAPANIZED_TK
-      begin
-	platform = tk_call('set', 'tcl_platform(platform)')
-	case platform
-	when 'unix'
-	  ltn = {'family'=>'Helvetica'.freeze, 'size'=>-12}
-	  knj = 'k14'
-	  #knj = '-misc-fixed-medium-r-normal--14-*-*-*-c-*-jisx0208.1983-0'
-	when 'windows'
-	  ltn = {'family'=>'MS Sans Serif'.freeze, 'size'=>8}
-	  knj = 'mincho'
-	when 'macintosh'
-	  ltn = 'system'
-	  knj = 'mincho'
-	else # unknown
-	  ltn = 'Helvetica'
-	  knj = 'mincho'
-	end
-      rescue
-	ltn = 'Helvetica'
-	knj = 'mincho'
-      end
-    end
-
-    DEFAULT_LATIN_FONT_NAME = ltn.freeze
-    DEFAULT_KANJI_FONT_NAME = knj.freeze
-
-  else # unknown version
-    DEFAULT_LATIN_FONT_NAME = 'Helvetica'.freeze
-    DEFAULT_KANJI_FONT_NAME = 'mincho'.freeze
-
-  end
-
-  if $DEBUG
-    print "default latin font = "; p DEFAULT_LATIN_FONT_NAME
-    print "default kanji font = "; p DEFAULT_KANJI_FONT_NAME
-  end
-
-  ###################################
-  # class methods
-  ###################################
-  def TkFont.families(window=nil)
-    case (Tk::TK_VERSION)
-    when /^4\.*/
-      ['fixed']
-
-    when /^8\.*/
-      if window
-	tk_split_simplelist(tk_call('font', 'families', '-displayof', window))
-      else
-	tk_split_simplelist(tk_call('font', 'families'))
-      end
-    end
-  end
-
-  def TkFont.names
-    case (Tk::TK_VERSION)
-    when /^4\.*/
-      r = ['fixed']
-      r += ['a14', 'k14'] if JAPANIZED_TK
-      Tk_FontNameTBL.each_value{|obj| r.push(obj)}
-      r | []
-
-    when /^8\.*/
-      tk_split_simplelist(tk_call('font', 'names'))
-
-    end
-  end
-
-  def TkFont.create_copy(font)
-    fail 'source-font need to be TkFont' unless font.kind_of? TkFont
-    keys = {}
-    font.configinfo.each{|key,value| keys[key] = value }
-    TkFont.new(font.latin_font, font.kanji_font, keys)
-  end
-
-  def TkFont.get_obj(name)
-    if name =~ /^(@font[0-9]+)(|c|l|k)$/
-      Tk_FontNameTBL[$1]
-    else
-      nil
-    end
-  end
-
-  def TkFont.init_widget_font(path, *args)
-    case (Tk::TK_VERSION)
-    when /^4\.*/
-      conf = tk_split_simplelist(tk_call(*args)).
-	find_all{|prop| prop[0..5]=='-font ' || prop[0..10]=='-kanjifont '}.
-	collect{|prop| tk_split_simplelist(prop)}
-      if font_inf = conf.assoc('-font')
-	ltn = font_inf[4]
-	ltn = nil if ltn == []
-      else 
-	#ltn = nil
-	raise RuntimeError, "unknown option '-font'"
-      end
-      if font_inf = conf.assoc('-kanjifont')
-	knj = font_inf[4]
-	knj = nil if knj == []
-      else
-	knj = nil
-      end
-      TkFont.new(ltn, knj).call_font_configure(path, *(args + [{}]))
-
-    when /^8\.*/
-      font_prop = tk_split_simplelist(tk_call(*args)).find{|prop| 
-	prop[0..5] == '-font '
-      }
-      unless font_prop
-	raise RuntimeError, "unknown option '-font'"
-      end
-      fnt = tk_split_simplelist(font_prop)[4]
-      if fnt == ""
-	TkFont.new(nil, nil).call_font_configure(path, *(args + [{}]))
-      else
-	begin
-	  compound = tk_split_simplelist(
-            Hash[*tk_split_simplelist(tk_call('font', 'configure', 
-					       fnt))].collect{|key,value|
-              [key[1..-1], value]
-            }.assoc('compound')[1])
-	rescue
-	  compound = []
-	end
-	if compound == []
-	  #TkFont.new(fnt, DEFAULT_KANJI_FONT_NAME) \
-	  #.call_font_configure(path, *(args + [{}]))
-	  TkFont.new(fnt).call_font_configure(path, *(args + [{}]))
-	else
-	  TkFont.new(compound[0], compound[1]) \
-	  .call_font_configure(path, *(args + [{}]))
-	end
-      end
-    end
-  end
-
-  def TkFont.used_on(path=nil)
-    if path
-      Tk_FontUseTBL[path]
-    else
-      Tk_FontUseTBL.values | []
-    end
-  end
-
-  def TkFont.failsafe(font)
-    begin
-      if /^8\.*/ === Tk::TK_VERSION  && JAPANIZED_TK
-        tk_call('font', 'failsafe', font)
-      end
-    rescue
-    end
-  end
-
-  ###################################
-  private
-  ###################################
-  def initialize(ltn=DEFAULT_LATIN_FONT_NAME, knj=nil, keys=nil)
-    @id = format("@font%.4d", Tk_FontID[0])
-    Tk_FontID[0] += 1
-    Tk_FontNameTBL[@id] = self
-    knj = DEFAULT_KANJI_FONT_NAME if JAPANIZED_TK && !knj
-    create_compoundfont(ltn, knj, keys)
-  end
-
-  def _get_font_info_from_hash(font)
-    font = _symbolkey2str(font)
-    foundry  = (info = font['foundry'] .to_s)?  info: '*'
-    family   = (info = font['family']  .to_s)?  info: '*'
-    weight   = (info = font['weight']  .to_s)?  info: '*'
-    slant    = (info = font['slant']   .to_s)?  info: '*'
-    swidth   = (info = font['swidth']  .to_s)?  info: '*'
-    adstyle  = (info = font['adstyle'] .to_s)?  info: '*'
-    pixels   = (info = font['pixels']  .to_s)?  info: '*'
-    points   = (info = font['points']  .to_s)?  info: '*'
-    resx     = (info = font['resx']    .to_s)?  info: '*'
-    resy     = (info = font['resy']    .to_s)?  info: '*'
-    space    = (info = font['space']   .to_s)?  info: '*'
-    avgWidth = (info = font['avgWidth'].to_s)?  info: '*'
-    charset  = (info = font['charset'] .to_s)?  info: '*'
-    encoding = (info = font['encoding'].to_s)?  info: '*'
-
-    [foundry, family, weight, slant, swidth, adstyle,
-      pixels, points, resx, resy, space, avgWidth, charset, encoding]
-  end
-
-  def create_latinfont_tk4x(font)
-    if font.kind_of? Hash
-      @latinfont = '-' + _get_font_info_from_hash(font).join('-') + '-'
-
-    elsif font.kind_of? Array
-      finfo = {}
-      finfo['family'] = font[0].to_s
-      if font[1]
-	fsize = font[1].to_s
-	if fsize != '0' && fsize =~ /^(|\+|-)([0-9]+)$/
-	  if $1 == '-'
-	    finfo['pixels'] = $2
-	  else
-	    finfo['points'] = $2
-	  end
-	else
-	  finfo['points'] = '13'
-	end
-      end
-      font[2..-1].each{|style|
-	case (style)
-	when 'normal'
-	  finfo['weight'] = style
-	when 'bold'
-	  finfo['weight'] = style
-	when 'roman'
-	  finfo['slant'] = 'r'
-	when 'italic'
-	  finfo['slant'] = 'i'
-	end
-      }
-
-      @latinfont = '-' + _get_font_info_from_hash(finfo).join('-') + '-'
-
-    elsif font.kind_of? TkFont
-      @latinfont = font.latin_font
-
-    else
-      if font
-        @latinfont = font
-      else
-        @latinfont = DEFAULT_LATIN_FONT_NAME
-      end
-
-    end
-  end
-
-  def create_kanjifont_tk4x(font)
-    unless JAPANIZED_TK
-      @kanjifont = ""
-      return
-    end
-
-    if font.kind_of? Hash
-      @kanjifont = '-' + _get_font_info_from_hash(font).join('-') + '-'
-
-    elsif font.kind_of? Array
-      finfo = {}
-      finfo['family'] = font[0].to_s
-      if font[1]
-	fsize = font[1].to_s
-	if fsize != '0' && fsize =~ /^(|\+|-)([0-9]+)$/
-	  if $1 == '-'
-	    finfo['pixels'] = $2
-	  else
-	    finfo['points'] = $2
-	  end
-	else
-	  finfo['points'] = '13'
-	end
-      end
-      font[2..-1].each{|style|
-	case (style)
-	when 'normal'
-	  finfo['weight'] = style
-	when 'bold'
-	  finfo['weight'] = style
-	when 'roman'
-	  finfo['slant'] = 'r'
-	when 'italic'
-	  finfo['slant'] = 'i'
-	end
-      }
-
-      @kanjifont = '-' + _get_font_info_from_hash(finfo).join('-') + '-'
-    elsif font.kind_of? TkFont
-      @kanjifont = font.kanji_font
-    else
-      if font
-        @kanjifont = font
-      else
-        @kanjifont = DEFAULT_KANJI_FONT_NAME
-      end
-    end
-  end
-
-  def create_compoundfont_tk4x(ltn, knj, keys)
-    create_latinfont(ltn)
-    create_kanjifont(knj)
-
-    if JAPANIZED_TK
-      @compoundfont = [[@latinfont], [@kanjifont]]
-      @fontslot = {'font'=>@latinfont, 'kanjifont'=>@kanjifont}
-    else
-      @compoundfont = @latinfont
-      @fontslot = {'font'=>@latinfont}
-    end
-  end
-
-  def create_latinfont_tk8x(font)
-    @latinfont = @id + 'l'
-
-    if JAPANIZED_TK
-      if font.kind_of? Hash
-	if font[:charset] || font['charset']
-	  tk_call('font', 'create', @latinfont, *hash_kv(font))
-	else
-	  tk_call('font', 'create', @latinfont, 
-                  '-charset', 'iso8859', *hash_kv(font))
-	end
-      elsif font.kind_of? Array
-	tk_call('font', 'create', @latinfont, '-copy', array2tk_list(font))
-        tk_call('font', 'configure', @latinfont, '-charset', 'iso8859')
-      elsif font.kind_of? TkFont
-	tk_call('font', 'create', @latinfont, '-copy', font.latin_font)
-      elsif font
-	tk_call('font', 'create', @latinfont, '-copy', font, 
-                '-charset', 'iso8859')
-      else
-	tk_call('font', 'create', @latinfont, '-charset', 'iso8859')
-      end
-    else
-      if font.kind_of? Hash
-	tk_call('font', 'create', @latinfont, *hash_kv(font))
-      else
-	keys = {}
-	if font.kind_of? Array
-	  actual_core(array2tk_list(font)).each{|key,val| keys[key] = val}
-	elsif font.kind_of? TkFont
-	  actual_core(font.latin_font).each{|key,val| keys[key] = val}
-	elsif font
-	  actual_core(font).each{|key,val| keys[key] = val}
-	end
-	tk_call('font', 'create', @latinfont, *hash_kv(keys))
-      end
-
-      if font && @compoundfont
-        keys = {}
-        actual_core(@latinfont).each{|key,val| keys[key] = val}
-	tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
-      end
-    end
-  end
-
-  def create_kanjifont_tk8x(font)
-    @kanjifont = @id + 'k'
-
-    if JAPANIZED_TK
-      if font.kind_of? Hash
-        if font[:charset] || font['charset']
-	  tk_call('font', 'create', @kanjifont, *hash_kv(font))
-        else
-	  tk_call('font', 'create', @kanjifont, 
-		  '-charset', 'jisx0208.1983', *hash_kv(font))
-        end
-      elsif font.kind_of? Array
-        tk_call('font', 'create', @kanjifont, '-copy', array2tk_list(font))
-        tk_call('font', 'configure', @kanjifont, '-charset', 'jisx0208.1983')
-      elsif font.kind_of? TkFont
-        tk_call('font', 'create', @kanjifont, '-copy', font.kanji_font)
-      elsif font
-        tk_call('font', 'create', @kanjifont, '-copy', font, 
-	        '-charset', 'jisx0208.1983')
-      else
-        tk_call('font', 'create', @kanjifont, '-charset', 'jisx0208.1983')
-      end
-      # end of JAPANIZED_TK
-
-    else
-      if font.kind_of? Hash
-        tk_call('font', 'create', @kanjifont, *hash_kv(font))
-      else
-        keys = {}
-        if font.kind_of? Array
-	  actual_core(array2tk_list(font)).each{|key,val| keys[key] = val}
-        elsif font.kind_of? TkFont
-	  actual_core(font.kanji_font).each{|key,val| keys[key] = val}
-        elsif font
-	  actual_core(font).each{|key,val| keys[key] = val}
-        end
-        tk_call('font', 'create', @kanjifont, *hash_kv(keys))
-      end
-
-      if font && @compoundfont
-        keys = {}
-        actual_core(@kanjifont).each{|key,val| keys[key] = val}
-        tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
-      end
-    end
-  end
-
-  def create_compoundfont_tk8x(ltn, knj, keys)
-    create_latinfont(ltn)
-    create_kanjifont(knj)
-
-    @compoundfont = @id + 'c'
-    if JAPANIZED_TK
-      @fontslot = {'font'=>@compoundfont}
-      tk_call('font', 'create', @compoundfont, 
-	      '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
-    else
-      tk_call('font', 'create', @compoundfont)
-
-      latinkeys = {}
-      begin
-	actual_core(@latinfont).each{|key,val| latinkeys[key] = val}
-      rescue
-	latinkeys {}
-      end
-      if latinkeys != {}
-	tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
-      end
-
-      if knj
-	kanjikeys = {}
-	begin
-	  actual_core(@kanjifont).each{|key,val| kanjikeys[key] = val}
-	rescue
-	  kanjikeys {}
-	end
-	if kanjikeys != {}
-	  tk_call('font', 'configure', @compoundfont, *hash_kv(kanjikeys))
-	end
-      end
-
-      @fontslot = {'font'=>@compoundfont}
-      tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
-    end
-  end
-
-  def actual_core_tk4x(font, window=nil, option=nil)
-    # dummy
-    if option
-      ""
-    else
-      [['family',[]], ['size',[]], ['weight',[]], ['slant',[]], 
-	['underline',[]], ['overstrike',[]], ['charset',[]], 
-	['pointadjust',[]]]
-    end
-  end
-
-  def actual_core_tk8x(font, window=nil, option=nil)
-    if option == 'compound'
-      ""
-    elsif option
-      if window
-	tk_call('font', 'actual', font, "-displayof", window, "-#{option}")
-      else
-	tk_call('font', 'actual', font, "-#{option}")
-      end
-    else
-      l = tk_split_simplelist(if window
-			 	 tk_call('font', 'actual', font, 
-					             "-displayof", window)
-			      else
-			  	 tk_call('font', 'actual', font)
-			      end)
-      r = []
-      while key=l.shift
-	if key == '-compound'
-	  l.shift
-	else
-	  r.push [key[1..-1], l.shift]
-	end
-      end
-      r
-    end
-  end
-
-  def configure_core_tk4x(font, slot, value=None)
-    ""
-  end
-
-  def configinfo_core_tk4x(font, option=nil)
-    # dummy
-    if option
-      ""
-    else
-      [['family',[]], ['size',[]], ['weight',[]], ['slant',[]], 
-	['underline',[]], ['overstrike',[]], ['charset',[]], 
-	['pointadjust',[]]]
-    end
-  end
-
-  def configure_core_tk8x(font, slot, value=None)
-    if slot.kind_of? Hash
-      tk_call 'font', 'configure', font, *hash_kv(slot)
-    else
-      tk_call 'font', 'configure', font, "-#{slot}", value
-    end
-  end
-
-  def configinfo_core_tk8x(font, option=nil)
-    if option == 'compound'
-      ""
-    elsif option
-      tk_call('font', 'configure', font, "-#{option}")
-    else
-      l = tk_split_simplelist(tk_call('font', 'configure', font))
-      r = []
-      while key=l.shift
-	if key == '-compound'
-	  l.shift
-	else
-	  r.push [key[1..-1], l.shift]
-	end
-      end
-      r
-    end
-  end
-
-  def delete_core_tk4x
-    Tk_FontNameTBL[@id] = nil
-    Tk_FontUseTBL.delete_if{|key,value| value == self}
-  end
-
-  def delete_core_tk8x
-    begin
-      tk_call('font', 'delete', @latinfont)
-    rescue
-    end
-    begin
-      tk_call('font', 'delete', @kanjifont)
-    rescue
-    end
-    begin
-      tk_call('font', 'delete', @compoundfont)
-    rescue
-    end
-    Tk_FontNameTBL[@id] = nil
-    Tk_FontUseTBL.delete_if{|key,value| value == self}
-  end
-
-  def latin_replace_core_tk4x(ltn)
-    create_latinfont_tk4x(ltn)
-    @compoundfont[0] = [@latinfont] if JAPANIZED_TK
-    @fontslot['font'] = @latinfont
-    Tk_FontUseTBL.dup.each{|w, fobj|
-      if self == fobj
-	begin
-	  if w.include?(';')
-	    win, tag = w.split(';')
-	    winobj = tk_tcl2ruby(win)
-#	    winobj.tagfont_configure(tag, {'font'=>@latinfont})
-	    if winobj.kind_of? TkText
-	      tk_call(win, 'tag', 'configure', tag, '-font', @latinfont)
-	    elsif winobj.kind_of? TkCanvas
-	      tk_call(win, 'itemconfigure', tag, '-font', @latinfont)
-	    elsif winobj.kind_of? TkMenu
-	      tk_call(win, 'entryconfigure', tag, '-font', @latinfont)
-	    else
-	      raise RuntimeError, "unknown widget type"
-	    end
-	  else
-#	    tk_tcl2ruby(w).font_configure('font'=>@latinfont)
-	    tk_call(w, 'configure', '-font', @latinfont)
-	  end
-	rescue
-	  Tk_FontUseTBL[w] = nil
-	end
-      end
-    }
-    self
-  end
-
-  def kanji_replace_core_tk4x(knj)
-    return self unless JAPANIZED_TK
-
-    create_kanjifont_tk4x(knj)
-    @compoundfont[1] = [@kanjifont]
-    @fontslot['kanjifont'] = @kanjifont
-    Tk_FontUseTBL.dup.each{|w, fobj|
-      if self == fobj
-	begin
-	  if w.include?(';')
-	    win, tag = w.split(';')
-	    winobj = tk_tcl2ruby(win)
-#	    winobj.tagfont_configure(tag, {'kanjifont'=>@kanjifont})
-	    if winobj.kind_of? TkText
-	      tk_call(win, 'tag', 'configure', tag, '-kanjifont', @kanjifont)
-	    elsif winobj.kind_of? TkCanvas
-	      tk_call(win, 'itemconfigure', tag, '-kanjifont', @kanjifont)
-	    elsif winobj.kind_of? TkMenu
-	      tk_call(win, 'entryconfigure', tag, '-kanjifont', @latinfont)
-	    else
-	      raise RuntimeError, "unknown widget type"
-	    end
-	  else
-#	    tk_tcl2ruby(w).font_configure('kanjifont'=>@kanjifont)
-	    tk_call(w, 'configure', '-kanjifont', @kanjifont)
-	  end
-	rescue
-	  Tk_FontUseTBL[w] = nil
-	end
-      end
-    }
-    self
-  end
-
-  def latin_replace_core_tk8x(ltn)
-    begin
-      tk_call('font', 'delete', @latinfont)
-    rescue
-    end
-    create_latinfont(ltn)
-    self
-  end
-
-  def kanji_replace_core_tk8x(knj)
-    begin
-      tk_call('font', 'delete', @kanjifont)
-    rescue
-    end
-    create_kanjifont(knj)
-    self
-  end
-
-  def measure_core_tk4x(window, text)
-    0
-  end
-
-  def measure_core_tk8x(window, text)
-    if window
-      number(tk_call('font', 'measure', @compoundfont, 
-		     '-displayof', window, text))
-    else
-      number(tk_call('font', 'measure', @compoundfont, text))
-    end
-  end
-
-  def metrics_core_tk4x(font, window, option=nil)
-    # dummy
-    if option
-      ""
-    else
-      [['ascent',[]], ['descent',[]], ['linespace',[]], ['fixed',[]]]
-    end
-  end
-
-  def metrics_core_tk8x(font, window, option=nil)
-    if option
-      if window
-	number(tk_call('font', 'metrics', font, 
-		       "-displayof", window, "-#{option}"))
-      else
-	number(tk_call('font', 'metrics', font, "-#{option}"))
-      end
-    else
-      l = tk_split_list(if window
-			  tk_call('font','metrics',font,"-displayof",window)
-			else
-			  tk_call('font','metrics',font)
-			end)
-      r = []
-      while key=l.shift
-	r.push [key[1..-1], l.shift.to_i]
-      end
-      r
-    end
-  end
-
-  ###################################
-  # private alias
-  ###################################
-  case (Tk::TK_VERSION)
-  when /^4\.*/
-    alias create_latinfont    create_latinfont_tk4x
-    alias create_kanjifont    create_kanjifont_tk4x
-    alias create_compoundfont create_compoundfont_tk4x
-    alias actual_core         actual_core_tk4x
-    alias configure_core      configure_core_tk4x
-    alias configinfo_core     configinfo_core_tk4x
-    alias delete_core         delete_core_tk4x
-    alias latin_replace_core  latin_replace_core_tk4x
-    alias kanji_replace_core  kanji_replace_core_tk4x
-    alias measure_core        measure_core_tk4x
-    alias metrics_core        metrics_core_tk4x
-
-  when /^8\.[0123]/
-    alias create_latinfont    create_latinfont_tk8x
-    alias create_kanjifont    create_kanjifont_tk8x
-    alias create_compoundfont create_compoundfont_tk8x
-    alias actual_core         actual_core_tk8x
-    alias configure_core      configure_core_tk8x
-    alias configinfo_core     configinfo_core_tk8x
-    alias delete_core         delete_core_tk8x
-    alias latin_replace_core  latin_replace_core_tk8x
-    alias kanji_replace_core  kanji_replace_core_tk8x
-    alias measure_core        measure_core_tk8x
-    alias metrics_core        metrics_core_tk8x
-
-  when /^8\.*/
-    alias create_latinfont    create_latinfont_tk8x
-    alias create_kanjifont    create_kanjifont_tk8x
-    alias create_compoundfont create_compoundfont_tk8x
-    alias actual_core         actual_core_tk8x
-    alias configure_core      configure_core_tk8x
-    alias configinfo_core     configinfo_core_tk8x
-    alias delete_core         delete_core_tk8x
-    alias latin_replace_core  latin_replace_core_tk8x
-    alias kanji_replace_core  kanji_replace_core_tk8x
-    alias measure_core        measure_core_tk8x
-    alias metrics_core        metrics_core_tk8x
-
-  end
-
-  ###################################
-  public
-  ###################################
-  def method_missing(id, *args)
-    name = id.id2name
-    case args.length
-    when 1
-      configure name, args[0]
-    when 0
-      begin
-	configinfo name
-      rescue
-	fail NameError, "undefined local variable or method `#{name}' for #{self.to_s}", error_at
-      end
-    else
-      fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at
-    end
-  end
-
-  def call_font_configure(path, *args)
-    args += hash_kv(args.pop.update(@fontslot))
-    tk_call(*args)
-    Tk_FontUseTBL[path] = self
-    self
-  end
-
-  def used
-    ret = []
-    Tk_FontUseTBL.each{|key,value|
-      if key.include?(';')
-	win, tag = key.split(';')
-	winobj = tk_tcl2ruby(win)
-	if winobj.kind_of? TkText
-	  ret.push([winobj, winobj.tagid2obj(tag)])
-	elsif winobj.kind_of? TkCanvas
-	  if (tagobj = TkcTag.id2obj(winobj, tag)).kind_of? TkcTag
-	    ret.push([winobj, tagobj])
-	  elsif (tagobj = TkcItem.id2obj(tag)).kind_of? TkcItem
-	    ret.push([winobj, tagobj])
-	  else
-	    ret.push([winobj, tag])
-	  end
-	elsif winobj.kind_of? TkMenu
-	  ret.push([winobj, tag])
-	else
-	  ret.push([win, tag])
-	end
-      else
-	ret.push(tk_tcl2ruby(key)) if value == self
-      end
-    }
-    ret
-  end
-
-  def id
-    @id
-  end
-
-  def to_eval
-    font
-  end
-
-  def font
-    @compoundfont
-  end
-
-  def latin_font
-    @latinfont
-  end
-
-  def kanji_font
-    @kanjifont
-  end
-
-  def actual(option=nil)
-    actual_core(@compoundfont, nil, option)
-  end
-
-  def actual_displayof(window, option=nil)
-    window = '.' unless window
-    actual_core(@compoundfont, window, option)
-  end
-
-  def latin_actual(option=nil)
-    actual_core(@latinfont, nil, option)
-  end
-
-  def latin_actual_displayof(window, option=nil)
-    window = '.' unless window
-    actual_core(@latinfont, window, option)
-  end
-
-  def kanji_actual(option=nil)
-    #if JAPANIZED_TK
-    if @kanjifont != ""
-      actual_core(@kanjifont, nil, option)
-    else
-      actual_core_tk4x(nil, nil, option)
-    end
-  end
-
-  def kanji_actual_displayof(window, option=nil)
-    #if JAPANIZED_TK
-    if @kanjifont != ""
-      window = '.' unless window
-      actual_core(@kanjifont, window, option)
-    else
-      actual_core_tk4x(nil, window, option)
-    end
-  end
-
-  def [](slot)
-    configinfo slot
-  end
-
-  def []=(slot, val)
-    configure slot, val
-  end
-
-  def configure(slot, value=None)
-    configure_core(@compoundfont, slot, value)
-  end
-
-  def configinfo(slot=nil)
-    configinfo_core(@compoundfont, slot)
-  end
-
-  def delete
-    delete_core
-  end
-
-  def latin_configure(slot, value=None)
-    if JAPANIZED_TK
-      configure_core(@latinfont, slot, value)
-    else
-      configure(slot, value)
-    end
-  end
-
-  def latin_configinfo(slot=nil)
-    if JAPANIZED_TK
-      configinfo_core(@latinfont, slot)
-    else
-      configinfo(slot)
-    end
-  end
-
-  def kanji_configure(slot, value=None)
-    #if JAPANIZED_TK
-    if @kanjifont != ""
-      configure_core(@kanjifont, slot, value)
-      configure('size'=>configinfo('size')) # to reflect new configuration
-    else
-      #""
-      configure(slot, value)
-    end
-  end
-
-  def kanji_configinfo(slot=nil)
-    #if JAPANIZED_TK
-    if @kanjifont != ""
-      configinfo_core(@kanjifont, slot)
-    else
-      #[]
-      configinfo(slot)
-    end
-  end
-
-  def replace(ltn, knj)
-    latin_replace(ltn)
-    kanji_replace(knj)
-    self
-  end
-
-  def latin_replace(ltn)
-    latin_replace_core(ltn)
-    reset_pointadjust
-  end
-
-  def kanji_replace(knj)
-    kanji_replace_core(knj)
-    reset_pointadjust
-  end
-
-  def measure(text)
-    measure_core(nil, text)
-  end
-
-  def measure_displayof(window, text)
-    window = '.' unless window
-    measure_core(window, text)
-  end
-
-  def metrics(option=nil)
-    metrics_core(@compoundfont, nil, option)
-  end
-
-  def metrics_displayof(window, option=nil)
-    window = '.' unless window
-    metrics_core(@compoundfont, window, option)
-  end
-
-  def latin_metrics(option=nil)
-    metrics_core(@latinfont, nil, option)
-  end
-
-  def latin_metrics_displayof(window, option=nil)
-    window = '.' unless window
-    metrics_core(@latinfont, window, option)
-  end
-
-  def kanji_metrics(option=nil)
-    if JAPANIZED_TK
-      metrics_core(@kanjifont, nil, option)
-    else
-      metrics_core_tk4x(nil, nil, option)
-    end
-  end
-
-  def kanji_metrics_displayof(window, option=nil)
-    if JAPANIZED_TK
-      window = '.' unless window
-      metrics_core(@kanjifont, window, option)
-    else
-      metrics_core_tk4x(nil, window, option)
-    end
-  end
-
-  def reset_pointadjust
-    begin
-      if /^8\.*/ === Tk::TK_VERSION  && JAPANIZED_TK
-        configure('pointadjust' => latin_actual.assoc('size')[1].to_f / 
-                                      kanji_actual.assoc('size')[1].to_f )
-      end
-    rescue
-    end
-    self
-  end
-
-  ###################################
-  # public alias
-  ###################################
-  alias ascii_font             latin_font
-  alias create_asciifont       create_latinfont
-  alias ascii_actual           latin_actual
-  alias ascii_actual_displayof latin_actual_displayof
-  alias ascii_configure        latin_configure
-  alias ascii_configinfo       latin_configinfo
-  alias ascii_replace          latin_replace
-  alias ascii_metrics          latin_metrics
-
-end
-
-module TkTreatTagFont
-  def font_configinfo
-    @parent.tagfont_configinfo(@id)
-  end
-#  alias font font_configinfo
-
-  def font_configure(slot)
-    @parent.tagfont_configure(@id, slot)
-  end
-
-  def latinfont_configure(ltn, keys=nil)
-    @parent.latintagfont_configure(@id, ltn, keys)
-  end
-  alias asciifont_configure latinfont_configure
-
-  def kanjifont_configure(knj, keys=nil)
-    @parent.kanjitagfont_configure(@id, ltn, keys)
-  end
-
-  def font_copy(window, wintag=nil)
-    @parent.tagfont_copy(@id, window, wintag)
-  end
-
-  def latinfont_copy(window, wintag=nil)
-    @parent.latintagfont_copy(@id, window, wintag)
-  end
-  alias asciifont_copy latinfont_copy
-
-  def kanjifont_copy(window, wintag=nil)
-    @parent.kanjitagfont_copy(@id, window, wintag)
-  end
-end
diff --git a/ext/tk/lib/tkmenubar.rb b/ext/tk/lib/tkmenubar.rb
deleted file mode 100644
index 0d29571eb7..0000000000
--- a/ext/tk/lib/tkmenubar.rb
+++ /dev/null
@@ -1,143 +0,0 @@
-#
-# tkmenubar.rb
-#
-# Copyright (C) 1998 maeda shugo. All rights reserved. 
-# This file can be distributed under the terms of the Ruby.
-
-# Usage:
-#
-# menu_spec = [
-#   [['File', 0],
-#     ['Open', proc{puts('Open clicked')}, 0],
-#     '---',
-#     ['Quit', proc{exit}, 0]],
-#   [['Edit', 0],
-#     ['Cut', proc{puts('Cut clicked')}, 2],
-#     ['Copy', proc{puts('Copy clicked')}, 0],
-#     ['Paste', proc{puts('Paste clicked')}, 0]]
-# ]
-# menubar = TkMenubar.new(nil, menu_spec,
-# 			'tearoff'=>false,
-# 			'foreground'=>'grey40',
-# 			'activeforeground'=>'red',
-# 			'font'=>'-adobe-helvetica-bold-r-*--12-*-iso8859-1')
-# menubar.pack('side'=>'top', 'fill'=>'x')
-#
-#
-# OR
-#
-#
-# menubar = TkMenubar.new
-# menubar.add_menu([['File', 0],
-# 		   ['Open', proc{puts('Open clicked')}, 0],
-# 		   '---',
-# 		   ['Quit', proc{exit}, 0]])
-# menubar.add_menu([['Edit', 0],
-# 		   ['Cut', proc{puts('Cut clicked')}, 2],
-# 		   ['Copy', proc{puts('Copy clicked')}, 0],
-# 		   ['Paste', proc{puts('Paste clicked')}, 0]])
-# menubar.configure('tearoff', false)
-# menubar.configure('foreground', 'grey40')
-# menubar.configure('activeforeground', 'red')
-# menubar.configure('font', '-adobe-helvetica-bold-r-*--12-*-iso8859-1')
-# menubar.pack('side'=>'top', 'fill'=>'x')
-
-# The format of the menu_spec is:
-# [
-#   [
-#     [button text, underline, accelerator],
-#     [menu label, command, underline, accelerator],
-#     '---', # separator
-#     ...
-#   ],
-#   ...
-# ]
-
-# underline and accelerator are optional parameters.
-# Hashes are OK instead of Arrays.
-
-# To use add_menu, configuration must be done by calling configure after
-# adding all menus by add_menu, not by the constructor arguments.
-
-require "tk"
-
-class TkMenubar item_info)
-      end
-    end
-    
-    mbtn.menu(menu)
-    @menus.push([mbtn, menu])
-    delegate('tearoff', menu)
-    delegate('foreground', mbtn, menu)
-    delegate('background', mbtn, menu)
-    delegate('disabledforeground', mbtn, menu)
-    delegate('activeforeground', mbtn, menu)
-    delegate('activebackground', mbtn, menu)
-    delegate('font', mbtn, menu)
-    delegate('kanjifont', mbtn, menu)
-    mbtn.pack('side' => 'left')
-  end
-  
-  def [](index)
-    return @menus[index]
-  end
-end
diff --git a/ext/tk/lib/tkmngfocus.rb b/ext/tk/lib/tkmngfocus.rb
deleted file mode 100644
index 921fb646e7..0000000000
--- a/ext/tk/lib/tkmngfocus.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-#   tkmngfocus.rb : methods for Tcl/Tk standard library 'focus.tcl'
-#                     1998/07/16 by Hidetoshi Nagai 
-#
-require 'tk'
-
-module TkManageFocus
-  extend Tk
-
-  def TkManageFocus.followsMouse
-    tk_call 'tk_focusFollowsMouse'
-  end
-
-  def TkManageFocus.next(window)
-    tk_call 'tk_focusNext', window
-  end
-  def focusNext
-    TkManageFocus.next(self)
-  end
-
-  def TkManageFocus.prev(window)
-    tk_call 'tk_focusPrev', window
-  end
-  def focusPrev
-    TkManageFocus.prev(self)
-  end
-end
diff --git a/ext/tk/lib/tkpalette.rb b/ext/tk/lib/tkpalette.rb
deleted file mode 100644
index a2dc7c87cb..0000000000
--- a/ext/tk/lib/tkpalette.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-#   tkpalette.rb : methods for Tcl/Tk standard library 'palette.tcl'
-#                     1998/06/21 by Hidetoshi Nagai 
-#
-require 'tk'
-
-module TkPalette
-  include Tk
-  extend Tk
-
-  def TkPalette.set(*args)
-    args = args.to_a.flatten if args.kind_of? Hash
-    tk_call 'tk_setPalette', *args
-  end
-  def TkPalette.setPalette(*args)
-    TkPalette.set(*args)
-  end
-
-  def TkPalette.bisque
-    tk_call 'tk_bisque'
-  end
-
-  def TkPalette.darken(color, percent)
-    tk_call 'tkDarken', color, percent
-  end
-
-  def TkPalette.recolorTree(window, colors)
-    if not colors.kind_of?(Hash)
-      fail "2nd arg need to be Hash"
-    end
-
-    colors.each{|key, value|
-      begin
-	if window.cget(key) == tk_call('set', "tkPalette(#{key})")
-	  window[key] = colors[key]
-	end
-      rescue
-	# ignore
-      end
-    }
-
-    TkWinfo.children(window).each{|w| TkPalette.recolorTree(w, colors)}
-  end
-
-  def recolorTree(colors)
-    TkPalette.recolorTree(self, colors)
-  end
-end
diff --git a/ext/tk/lib/tkscrollbox.rb b/ext/tk/lib/tkscrollbox.rb
deleted file mode 100644
index 6236430491..0000000000
--- a/ext/tk/lib/tkscrollbox.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-#		tkscrollbox.rb - Tk Listbox with Scrollbar
-#                                 as an example of Composite Widget
-#			$Date$
-#			by Yukihiro Matsumoto 
-
-require 'tk.rb'
-
-class TkScrollbox'left','fill'=>'both','expand'=>'yes'
-    scroll.configure 'command', list.path+" yview"
-    scroll.pack 'side'=>'right','fill'=>'y'
-
-    delegate('DEFAULT', list)
-    delegate('foreground', list)
-    delegate('background', list, scroll)
-    delegate('borderwidth', @frame)
-    delegate('relief', @frame)
-
-    configure keys if keys
-  end
-end
diff --git a/ext/tk/lib/tktext.rb b/ext/tk/lib/tktext.rb
deleted file mode 100644
index 952c05f566..0000000000
--- a/ext/tk/lib/tktext.rb
+++ /dev/null
@@ -1,1041 +0,0 @@
-#
-#		tktext.rb - Tk text classes
-#			$Date$
-#			by Yukihiro Matsumoto 
-
-require 'tk.rb'
-require 'tkfont'
-
-module TkTreatTextTagFont
-  include TkTreatItemFont
-
-  ItemCMD = ['tag', 'configure']
-  def __conf_cmd(idx)
-    ItemCMD[idx]
-  end
-
-  def __item_pathname(tagOrId)
-    if tagOrId.kind_of?(TkTextTag)
-      self.path + ';' + tagOrId.id
-    else
-      self.path + ';' + tagOrId
-    end
-  end
-end
-
-class TkTextval})
-      else
-	tk_send 'tag', 'configure', tag, "-#{key}", val
-      end
-    end
-  end
-
-  def tag_configinfo(tag, key=nil)
-    if key
-      case key.to_s
-      when 'text', 'label', 'show', 'data', 'file'
-	conf = tk_split_simplelist(tk_send('tag','configure',tag,"-#{key}"))
-      else
-	conf = tk_split_list(tk_send('tag','configure',tag,"-#{key}"))
-      end
-      conf[0] = conf[0][1..-1]
-      conf
-    else
-      tk_split_simplelist(tk_send('tag', 'configure', tag)).collect{|conflist|
-	conf = tk_split_simplelist(conflist)
-	conf[0] = conf[0][1..-1]
-	case conf[0]
-	when 'text', 'label', 'show', 'data', 'file'
-	else
-	  if conf[3]
-	    if conf[3].index('{')
-	      conf[3] = tk_split_list(conf[3]) 
-	    else
-	      conf[3] = tk_tcl2ruby(conf[3]) 
-	    end
-	  end
-	  if conf[4]
-	    if conf[4].index('{')
-	      conf[4] = tk_split_list(conf[4]) 
-	    else
-	      conf[4] = tk_tcl2ruby(conf[4]) 
-	    end
-	  end
-	end
-	conf
-      }
-    end
-  end
-
-  def tag_raise(tag, above=None)
-    tk_send 'tag', 'raise', tag, above
-  end
-
-  def tag_lower(tag, below=None)
-    tk_send 'tag', 'lower', tag, below
-  end
-
-  def tag_remove(tag, *index)
-    tk_send 'tag', 'remove', tag, *index
-  end
-
-  def tag_ranges(tag)
-    l = tk_split_simplelist(tk_send('tag', 'ranges', tag))
-    r = []
-    while key=l.shift
-      r.push [key, l.shift]
-    end
-    r
-  end
-
-  def tag_nextrange(tag, first, last=None)
-    tk_split_simplelist(tk_send('tag', 'nextrange', tag, first, last))
-  end
-
-  def tag_prevrange(tag, first, last=None)
-    tk_split_simplelist(tk_send('tag', 'prevrange', tag, first, last))
-  end
-
-  def _ktext_length(txt)
-    if $KCODE !~ /n/i
-      return txt.gsub(/[^\Wa-zA-Z_\d]/, ' ').length
-    end
-
-    # $KCODE == 'NONE'
-    if JAPANIZED_TK
-      tk_call('kstring', 'length', txt).to_i
-    else
-      begin
-	tk_call('encoding', 'convertto', 'ascii', txt).length
-      rescue StandardError, NameError
-	# sorry, I have no plan
-	txt.length
-      end
-    end
-  end
-  private :_ktext_length
-
-  def search_with_length(pat,start,stop=None)
-    pat = pat.chr if pat.kind_of? Integer
-    if stop != None
-      return ["", 0] if compare(start,'>=',stop)
-      txt = get(start,stop)
-      if (pos = txt.index(pat))
-	match = $&
-	#pos = txt[0..(pos-1)].split('').length if pos > 0
-	pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
-	if pat.kind_of? String
-	  #return [index(start + " + #{pos} chars"), pat.split('').length]
-	  return [index(start + " + #{pos} chars"), 
-		  _ktext_length(pat), pat.dup]
-	else
-	  #return [index(start + " + #{pos} chars"), $&.split('').length]
-	  return [index(start + " + #{pos} chars"), 
-		  _ktext_length(match), match]
-	end
-      else
-	return ["", 0]
-      end
-    else
-      txt = get(start,'end - 1 char')
-      if (pos = txt.index(pat))
-	match = $&
-	#pos = txt[0..(pos-1)].split('').length if pos > 0
-	pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
-	if pat.kind_of? String
-	  #return [index(start + " + #{pos} chars"), pat.split('').length]
-	  return [index(start + " + #{pos} chars"), 
-		  _ktext_length(pat), pat.dup]
-	else
-	  #return [index(start + " + #{pos} chars"), $&.split('').length]
-	  return [index(start + " + #{pos} chars"), 
-		  _ktext_length(match), match]
-	end
-      else
-	txt = get('1.0','end - 1 char')
-	if (pos = txt.index(pat))
-	  match = $&
-	  #pos = txt[0..(pos-1)].split('').length if pos > 0
-	  pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
-	  if pat.kind_of? String
-	    #return [index("1.0 + #{pos} chars"), pat.split('').length]
-	    return [index("1.0 + #{pos} chars"), 
-		    _ktext_length(pat), pat.dup]
-	  else
-	    #return [index("1.0 + #{pos} chars"), $&.split('').length]
-	    return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
-	  end
-	else
-	  return ["", 0]
-	end
-      end
-    end
-  end
-
-  def search(pat,start,stop=None)
-    search_with_length(pat,start,stop)[0]
-  end
-
-  def rsearch_with_length(pat,start,stop=None)
-    pat = pat.chr if pat.kind_of? Integer
-    if stop != None
-      return ["", 0] if compare(start,'<=',stop)
-      txt = get(stop,start)
-      if (pos = txt.rindex(pat))
-	match = $&
-	#pos = txt[0..(pos-1)].split('').length if pos > 0
-	pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
-	if pat.kind_of? String
-	  #return [index(stop + " + #{pos} chars"), pat.split('').length]
-	  return [index(stop + " + #{pos} chars"), _ktext_length(pat), pat.dup]
-	else
-	  #return [index(stop + " + #{pos} chars"), $&.split('').length]
-	  return [index(stop + " + #{pos} chars"), _ktext_length(match), match]
-	end
-      else
-	return ["", 0]
-      end
-    else
-      txt = get('1.0',start)
-      if (pos = txt.rindex(pat))
-	match = $&
-	#pos = txt[0..(pos-1)].split('').length if pos > 0
-	pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
-	if pat.kind_of? String
-	  #return [index("1.0 + #{pos} chars"), pat.split('').length]
-	  return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup]
-	else
-	  #return [index("1.0 + #{pos} chars"), $&.split('').length]
-	  return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
-	end
-      else
-	txt = get('1.0','end - 1 char')
-	if (pos = txt.rindex(pat))
-	  match = $&
-	  #pos = txt[0..(pos-1)].split('').length if pos > 0
-	  pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
-	  if pat.kind_of? String
-	    #return [index("1.0 + #{pos} chars"), pat.split('').length]
-	    return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup]
-	  else
-	    #return [index("1.0 + #{pos} chars"), $&.split('').length]
-	    return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
-	  end
-	else
-	  return ["", 0]
-	end
-      end
-    end
-  end
-
-  def rsearch(pat,start,stop=None)
-    rsearch_with_length(pat,start,stop)[0]
-  end
-
-  def dump(type_info, *index, &block)
-    args = type_info.collect{|inf| '-' + inf}
-    args << '-command' << Proc.new(&block) if iterator?
-    str = tk_send('dump', *(args + index))
-    result = []
-    sel = nil
-    i = 0
-    while i < str.size
-      # retrieve key
-      idx = str.index(/ /, i)
-      result.push str[i..(idx-1)]
-      i = idx + 1
-      
-      # retrieve value
-      case result[-1]
-      when 'text'
-	if str[i] == ?{
-	  # text formed as {...}
-	  val, i = _retrieve_braced_text(str, i)
-	  result.push val
-	else
-	  # text which may contain backslahes
-	  val, i = _retrieve_backslashed_text(str, i)
-	  result.push val
-	end
-      else
-	idx = str.index(/ /, i)
-	val = str[i..(idx-1)]
-	case result[-1]
-	when 'mark'
-	  case val
-	  when 'insert'
-	    result.push TkTextMarkInsert.new(self)
-	  when 'current'
-	    result.push TkTextMarkCurrent.new(self)
-	  when 'anchor'
-	    result.push TkTextMarkAnchor.new(self)
-	  else
-	    result.push tk_tcl2ruby(val)
-	  end
-	when 'tagon'
-	  if val == 'sel'
-	    if sel
-	      result.push sel
-	    else
-	      result.push TkTextTagSel.new(self)
-	    end
-	  else
-	    result.push tk_tcl2ruby(val)
-	  end
-	when 'tagoff'
-	    result.push tk_tcl2ruby(sel)
-	when 'window'
-	  result.push tk_tcl2ruby(val)
-	end
-	i = idx + 1
-      end
-
-      # retrieve index
-      idx = str.index(/ /, i)
-      if idx
-	result.push str[i..(idx-1)]
-	i = idx + 1
-      else
-	result.push str[i..-1]
-	break
-      end
-    end
-    
-    kvis = []
-    until result.empty?
-      kvis.push [result.shift, result.shift, result.shift]
-    end
-    kvis  # result is [[key1, value1, index1], [key2, value2, index2], ...]
-  end
-
-  def _retrieve_braced_text(str, i)
-    cnt = 0
-    idx = i
-    while idx < str.size
-      case str[idx]
-      when ?{
-	cnt += 1
-      when ?}
-	cnt -= 1
-	if cnt == 0
-	  break
-	end
-      end
-      idx += 1
-    end
-    return str[i+1..idx-1], idx + 2
-  end
-  private :_retrieve_braced_text
-
-  def _retrieve_backslashed_text(str, i)
-    j = i
-    idx = nil
-    loop {
-      idx = str.index(/ /, j)
-      if str[idx-1] == ?\\
-	j += 1
-      else
-	break
-      end
-    }
-    val = str[i..(idx-1)]
-    val.gsub!(/\\( |\{|\})/, '\1')
-    return val, idx + 1
-  end
-  private :_retrieve_backslashed_text
-
-  def dump_all(*index, &block)
-    dump(['all'], *index, &block)
-  end
-  def dump_mark(*index, &block)
-    dump(['mark'], *index, &block)
-  end
-  def dump_tag(*index, &block)
-    dump(['tag'], *index, &block)
-  end
-  def dump_text(*index, &block)
-    dump(['text'], *index, &block)
-  end
-  def dump_window(*index, &block)
-    dump(['window'], *index, &block)
-  end
-  def dump_image(*index, &block)
-    dump(['image'], *index, &block)
-  end
-end
-
-class TkTextTag 0
-	tk_call @t.path, 'window', 'configure', @index, *hash_kv(slot)
-      end
-    else
-      @id = value if slot == 'window' || slot == :window
-      if slot == 'create' || slot == :create
-	self.create=value
-      else
-	tk_call @t.path, 'window', 'configure', @index, "-#{slot}", value
-      end
-    end
-  end
-
-  def window
-    @id
-  end
-
-  def window=(value)
-    tk_call @t.path, 'window', 'configure', @index, '-window', value
-    @id = value
-  end
-
-  def create
-    @p_create
-  end
-
-  def create=(value)
-    @p_create = value
-    if @p_create.kind_of? Proc
-      value = install_cmd(proc{@id = @p_create.call})
-    end
-    tk_call @t.path, 'window', 'configure', @index, '-create', value
-  end
-
-  def configinfo(slot = nil)
-    if slot
-      case slot.to_s
-      when 'text', 'label', 'show', 'data', 'file'
-	conf = tk_split_simplelist(tk_call(@t.path, 'window', 'configure', 
-					   @index, "-#{slot}"))
-      else
-	conf = tk_split_list(tk_call(@t.path, 'window', 'configure', 
-				     @index, "-#{slot}"))
-      end
-      conf[0] = conf[0][1..-1]
-      conf
-    else
-      tk_split_simplelist(tk_call(@t.path, 'window', 'configure', 
-				  @index)).collect{|conflist|
-	conf = tk_split_simplelist(conflist)
-	conf[0] = conf[0][1..-1]
-	case conf[0]
-	when 'text', 'label', 'show', 'data', 'file'
-	else
-	  if conf[3]
-	    if conf[3].index('{')
-	      conf[3] = tk_split_list(conf[3]) 
-	    else
-	      conf[3] = tk_tcl2ruby(conf[3]) 
-	    end
-	  end
-	  if conf[4]
-	    if conf[4].index('{')
-	      conf[4] = tk_split_list(conf[4]) 
-	    else
-	      conf[4] = tk_tcl2ruby(conf[4]) 
-	    end
-	  end
-	end
-	conf
-      }
-    end
-  end
-
-end
-
-class TkTextImage
-#
-require 'tk'
-
-class TkVirtualEvent")
-	PreDefVirtEvent.new(event)
-      else
-	fail ArgumentError, "undefined virtual event '<#{event}>'"
-      end
-    end
-  end
-
-  def TkVirtualEvent.info
-    tk_call('event', 'info').split(/\s+/).collect!{|seq|
-      TkVirtualEvent.getobj(seq[1..-2])
-    }
-  end
-
-  def initialize(*sequences)
-    @path = @id = format("", TkVirtualEventID[0])
-    TkVirtualEventID[0] += 1
-    add(*sequences)
-  end
-
-  def add(*sequences)
-    if sequences != []
-      tk_call('event', 'add', "<#{@id}>", 
-	      *(sequences.collect{|seq| "<#{tk_event_sequence(seq)}>"}) )
-      TkVirtualEventTBL[@id] = self
-    end
-    self
-  end
-
-  def delete(*sequences)
-    if sequences == []
-      tk_call('event', 'delete', "<#{@id}>")
-      TkVirtualEventTBL[@id] = nil
-    else
-      tk_call('event', 'delete', "<#{@id}>", 
-	      *(sequences.collect{|seq| "<#{tk_event_sequence(seq)}>"}) )
-      TkVirtualEventTBL[@id] = nil if info == []
-    end
-    self
-  end
-
-  def info
-    tk_call('event', 'info', "<#{@id}>").split(/\s+/).collect!{|seq|
-      l = seq.scan(/<*[^<>]+>*/).collect!{|subseq|
-	case (subseq)
-	when /^<<[^<>]+>>$/
-	  TkVirtualEvent.getobj(subseq[1..-2])
-	when /^<[^<>]+>$/
-	  subseq[1..-2]
-	else
-	  subseq.split('')
-	end
-      }.flatten
-      (l.size == 1) ? l[0] : l
-    }
-  end
-end
diff --git a/ext/tk/sample/tkbiff.rb b/ext/tk/sample/tkbiff.rb
deleted file mode 100644
index ac27184437..0000000000
--- a/ext/tk/sample/tkbiff.rb
+++ /dev/null
@@ -1,149 +0,0 @@
-#! /usr/local/bin/ruby
-
-if ARGV[0] != '-d'
-  unless $DEBUG
-    exit if fork
-  end
-else
-  ARGV.shift
-end
-
-if ARGV.length == 0
-  if ENV['MAIL']
-    $spool = ENV['MAIL']
-  else  
-    $spool = '/usr/spool/mail/' + ENV['USER']
-  end
-else 
-  $spool = ARGV[0]
-end
-
-require "parsedate"
-require "base64"
-
-include ParseDate
-
-class Mail
-  def Mail.new(f)
-    if !f.kind_of?(IO)
-      f = open(f, "r")
-      me = super
-      f.close
-    else
-      me = super
-    end
-    return me
-  end
-
-  def initialize(f)
-    @header = {}
-    @body = []
-    while line = f.gets()
-      line.chop!
-      next if /^From / =~ line	# skip From-line  
-      break if /^$/ =~ line	# end of header
-      if /^(\S+):\s*(.*)/ =~ line
-	@header[attr = $1.capitalize] = $2
-      elsif attr
-	sub(/^\s*/, '')
-	@header[attr] += "\n" + $_
-      end
-    end
-
-    return unless $_
-
-    while line = f.gets()
-      break if /^From / =~ line
-      @body.push($_)
-    end
-  end
-
-  def header
-    return @header
-  end
-
-  def body
-    return @body
-  end
-
-end
-
-require "tkscrollbox"
-
-$top = TkRoot.new
-$top.withdraw
-$list = TkScrollbox.new($top) {
-  relief 'raised'
-  width 80
-  height 8
-  setgrid 'yes'
-  pack
-}
-TkButton.new($top) {
-  text 'Dismiss'
-  command proc {$top.withdraw}
-  pack('fill'=>'both','expand'=>'yes')
-}
-$top.bind "Control-c", proc{exit}
-$top.bind "Control-q", proc{exit}
-$top.bind "space", proc{exit}
-
-$spool_size = 0
-$check_time = Time.now
-
-def check
-  $check_time = Time.now
-  size = File.size($spool)
-  if size and size != $spool_size
-    $spool_size = size
-    pop_up if size > 0
-  end
-  Tk.after 5000, proc{check}
-end
-
-if defined? Thread
-  Thread.start do
-    loop do
-      sleep 600
-      if Time.now - $check_time > 200
-	Tk.after 5000, proc{check}
-      end
-    end
-  end
-end
-
-def pop_up
-  outcount = 0;
-  $list.delete 0, 'end'
-  f = open($spool, "r")
-  while !f.eof?
-    mail = Mail.new(f)
-    date, from, subj =  mail.header['Date'], mail.header['From'], mail.header['Subject']
-    next if !date
-    y = m = d = 0
-    y, m, d = parsedate(date) if date
-    from = "sombody@somewhere" if ! from
-    subj = "(nil)" if ! subj
-    from = decode_b(from)
-    subj = decode_b(subj)
-    $list.insert 'end', format('%-02d/%02d/%02d [%-28.28s] %s',y,m,d,from,subj)
-    outcount += 1
-  end
-  f.close
-  if outcount == 0
-    $list.insert 'end', "You have no mail."
-  else
-    $list.see 'end'
-  end
-  $top.deiconify
-  Tk.after 2000, proc{$top.withdraw}
-end
-
-$list.insert 'end', "You have no mail."
-check
-Tk.after 2000, proc{$top.withdraw}
-begin
-  Tk.mainloop
-rescue
-  `echo #$! > /tmp/tkbiff`
-end
diff --git a/ext/tk/sample/tkbrowse.rb b/ext/tk/sample/tkbrowse.rb
deleted file mode 100644
index 882f0a489b..0000000000
--- a/ext/tk/sample/tkbrowse.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/local/bin/ruby
-#
-# This script generates a directory browser, which lists the working
-# directory and allows you to open files or subdirectories by
-# double-clicking.
-
-# Create a scrollbar on the right side of the main window and a listbox
-# on the left side.
-
-require "tkscrollbox"
-
-# The procedure below is invoked to open a browser on a given file;  if the
-# file is a directory then another instance of this program is invoked; if
-# the file is a regular file then the Mx editor is invoked to display
-# the file.
-
-$dirlist = {}
-
-def browsedir (dir)
-  if $dirlist.key? dir
-    $dirlist[dir]
-  else
-    top = if $dirlist.size > 0 then TkToplevel.new else nil end
-    list = TkScrollbox.new(top) {
-      relief 'raised'
-      width 20
-      height 20
-      setgrid 'yes'
-      pack
-    }
-    list.insert 'end', *`ls #{dir}`.split
-
-    # Set up bindings for the browser.
-
-    list.focus
-    list.bind "Control-q", proc{exit}
-    list.bind "Control-c", proc{exit}
-    list.bind "Control-p", proc{
-      print "selection <", TkSelection.get, ">\n"
-    }
-
-    list.bind "Double-Button-1", proc{
-      for i in TkSelection.get.split
-	print "clicked ", i, "\n"
-	browse dir, i
-      end
-    }
-    $dirlist[dir] = list
-  end
-end
-
-def browse (dir, file)
-  file="#{dir}/#{file}"
-  if File.directory? file
-    browsedir(file)
-  else
-    if File.file? file
-      if ENV['EDITOR']
-	system format("%s %s&", ENV['EDITOR'], file)
-      else
-	system "xedit #{file}&"
-      end
-    else
-      STDERR.print "\"#{file}\" isn't a directory or regular file"
-    end
-  end
-end
-
-# Fill the listbox with a list of all the files in the directory (run
-# the "ls" command to get that information).
-
-if ARGV.length>0 
-  dir = ARGV[0]
-else
-  dir="."
-end
-
-browsedir(dir)
-Tk.mainloop
diff --git a/ext/tk/sample/tkdialog.rb b/ext/tk/sample/tkdialog.rb
deleted file mode 100644
index e83e16d0a8..0000000000
--- a/ext/tk/sample/tkdialog.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-#! /usr/local/bin/ruby
-require "tk"
-
-root = TkFrame.new
-top = TkFrame.new(root) {
-  relief 'raised'
-  border 1
-}
-msg = TkMessage.new(top) {
-  text "File main.c hasn't been saved to disk since \
-it was last modified.  What should I do?" 
-  justify 'center'
-  aspect 200
-  font '-Adobe-helvetica-medium-r-normal--*-240*'
-  pack('padx'=>5, 'pady'=>5, 'expand'=>'yes')
-}
-top.pack('fill'=>'both')
-root.pack
-
-bot = TkFrame.new(root) {
-  relief 'raised'
-  border 1
-}
-
-TkFrame.new(bot) { |left|
-  relief 'sunken'
-  border 1
-  pack('side'=>'left', 'expand'=>'yes', 'padx'=>10, 'pady'=> 10)
-  TkButton.new(left) {
-    text "Save File"
-    command "quit 'save'"
-    pack('expand'=>'yes','padx'=>6,'pady'=> 6)
-    top.bind "Enter", proc{state 'active'}
-    msg.bind "Enter", proc{state 'active'}
-    bot.bind "Enter", proc{state 'active'}
-    top.bind "Leave", proc{state 'normal'}
-    msg.bind "Leave", proc{state 'normal'}
-    bot.bind "Leave", proc{state 'normal'}
-    Tk.root.bind "ButtonRelease-1", proc{quit 'save'}
-    Tk.root.bind "Return", proc{quit 'save'}
-  }
-}
-TkButton.new(bot) {
-  text "Quit Anyway"
-  command "quit 'quit'"
-  pack('side'=>'left', 'expand'=>'yes', 'padx'=>10)
-}
-TkButton.new(bot) {
-  text "Return To Editor"
-  command "quit 'return'"
-  pack('side'=>'left', 'expand'=>'yes', 'padx'=>10)
-}
-bot.pack
-root.pack('side'=>'top', 'fill'=>'both', 'expand'=>'yes')
-
-def quit(button)
-  print "aaa\n"
-  print "You pressed the \"#{button}\" button;  bye-bye!\n"
-  exit
-end
-
-Tk.mainloop
diff --git a/ext/tk/sample/tkfrom.rb b/ext/tk/sample/tkfrom.rb
deleted file mode 100644
index 8c3efb8137..0000000000
--- a/ext/tk/sample/tkfrom.rb
+++ /dev/null
@@ -1,132 +0,0 @@
-#! /usr/local/bin/ruby
-
-require "parsedate"
-require "base64"
-
-include ParseDate
-
-class Mail
-  def Mail.new(f)
-    if !f.kind_of?(IO)
-      f = open(f, "r")
-      me = super(f)
-      f.close
-    else
-      me = super
-    end
-    return me
-  end
-
-  def initialize(f)
-    @header = {}
-    @body = []
-    while line = f.gets()
-      $_.chop!
-      next if /^From / =~ line	# skip From-line  
-      break if /^$/ =~ line	# end of header
-      if /^(\S+):\s*(.*)/ =~ line
-	@header[attr = $1.capitalize] = $2
-      elsif attr
-	sub(/^\s*/, '')
-	@header[attr] += "\n" + $_
-      end
-    end
-
-    return unless $_
-
-    while line = f.gets()
-      break if /^From / =~ line
-      @body.push($_)
-    end
-  end
-
-  def header
-    return @header
-  end
-
-  def body
-    return @body
-  end
-
-end
-
-if ARGV.length == 0
-  if ENV['MAIL']
-    ARGV[0] = ENV['MAIL']
-  elsif ENV['USER']
-    ARGV[0] = '/usr/spool/mail/' + ENV['USER']
-  elsif ENV['LOGNAME']
-    ARGV[0] = '/usr/spool/mail/' + ENV['LOGNAME']
-  end
-end
-
-require "tk"
-list = scroll = nil
-TkFrame.new{|f|
-  list = TkListbox.new(f) {
-    yscroll proc{|idx|
-	scroll.set *idx
-    }
-    relief 'raised'
-#    geometry "80x5"
-    width 80
-    height 5
-    setgrid 'yes'
-    pack('side'=>'left','fill'=>'both','expand'=>'yes')
-  }
-  scroll = TkScrollbar.new(f) {
-    command proc{|idx|
-      list.yview *idx
-    }
-    pack('side'=>'right','fill'=>'y')
-  }
-  pack
-}
-root = Tk.root
-TkButton.new(root) {
-  text 'Dismiss'
-  command proc {exit}
-  pack('fill'=>'both','expand'=>'yes')
-}
-root.bind "Control-c", proc{exit}
-root.bind "Control-q", proc{exit}
-root.bind "space", proc{exit}
-
-$outcount = 0;
-for file in ARGV
-  next if File.exist?(file)
-  atime = File.atime(file)
-  mtime = File.mtime(file)
-  f = open(file, "r")
-  begin
-    until f.eof
-      mail = Mail.new(f)
-      date = mail.header['Date']
-      next unless date
-      from = mail.header['From']
-      subj = mail.header['Subject']
-      y = m = d = 0
-      y, m, d = parsedate(date) if date
-      from = "sombody@somewhere" unless from
-      subj = "(nil)" unless subj
-      from = decode_b(from)
-      subj = decode_b(subj)
-      list.insert 'end', format('%-02d/%02d/%02d [%-28.28s] %s',y,m,d,from,subj)
-      $outcount += 1
-    end
-  ensure
-    f.close
-    File.utime(atime, mtime, file)
-    list.see 'end'
-  end
-end
-
-limit = 10000
-if $outcount == 0
-  list.insert 'end', "You have no mail."
-  limit = 2000
-end
-Tk.after limit, proc{
-  exit
-}
-Tk.mainloop
diff --git a/ext/tk/sample/tkhello.rb b/ext/tk/sample/tkhello.rb
deleted file mode 100644
index 5188fe1c8c..0000000000
--- a/ext/tk/sample/tkhello.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-require "tk"
-
-TkButton.new(nil, 
-	     'text' => 'hello',
-	     'command' => proc{print "hello\n"}).pack('fill'=>'x')
-TkButton.new(nil,
-	     'text' => 'quit',
-	     'command' => 'exit').pack('fill'=>'x')
-
-Tk.mainloop
diff --git a/ext/tk/sample/tkline.rb b/ext/tk/sample/tkline.rb
deleted file mode 100644
index 2406b0749f..0000000000
--- a/ext/tk/sample/tkline.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-
-require "tkclass"
-
-$tkline_init = FALSE
-def start_random
-  return if $tkline_init
-  $tkline_init = TRUE
-  if defined? Thread
-    Thread.start do
-      loop do
-	sleep 2
-	Line.new($c, rand(400), rand(200), rand(400), rand(200))
-      end
-    end
-  end
-end
-
-$c = Canvas.new
-$c.pack
-$start_x = start_y = 0
-
-def do_press(x, y)
-  $start_x = x
-  $start_y = y
-  $current_line = Line.new($c, x, y, x, y)
-  start_random
-end
-def do_motion(x, y)
-  if $current_line
-    $current_line.coords $start_x, $start_y, x, y
-  end
-end
-
-def do_release(x, y)
-  if $current_line
-    $current_line.coords $start_x, $start_y, x, y
-    $current_line.fill 'black'
-    $current_line = nil
-  end
-end
-
-$c.bind("1", proc{|e| do_press e.x, e.y})
-$c.bind("B1-Motion", proc{|x, y| do_motion x, y}, "%x %y")
-$c.bind("ButtonRelease-1", proc{|x, y| do_release x, y}, "%x %y")
-Tk.mainloop
diff --git a/ext/tk/sample/tktimer.rb b/ext/tk/sample/tktimer.rb
deleted file mode 100644
index 34377e2f39..0000000000
--- a/ext/tk/sample/tktimer.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/local/bin/ruby
-# This script generates a counter with start and stop buttons.
-
-require "tk"
-$label = TkLabel.new {
-  text '0.00'
-  relief 'raised'
-  width 10
-  pack('side'=>'bottom', 'fill'=>'both')
-}
-
-TkButton.new {
-  text 'Start'
-  command proc {
-    if $stopped
-      $stopped = FALSE
-      tick
-    end
-  }
-  pack('side'=>'left','fill'=>'both','expand'=>'yes')
-}
-TkButton.new {
-  text 'Stop'
-  command proc{
-    exit if $stopped
-    $stopped = TRUE
-  }
-  pack('side'=>'right','fill'=>'both','expand'=>'yes')
-}
-
-$seconds=0
-$hundredths=0
-$stopped=TRUE
-
-def tick
-  if $stopped then return end
-  Tk.after 50, proc{tick}
-  $hundredths+=5
-  if $hundredths >= 100
-    $hundredths=0
-    $seconds+=1
-  end
-  $label.text format("%d.%02d", $seconds, $hundredths)
-end
-
-root = Tk.root
-root.bind "Control-c", proc{root.destroy}
-root.bind "Control-q", proc{root.destroy}
-Tk.root.focus
-Tk.mainloop
diff --git a/ext/tk/tkutil.c b/ext/tk/tkutil.c
deleted file mode 100644
index b42069e234..0000000000
--- a/ext/tk/tkutil.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/************************************************
-
-  tk.c -
-
-  $Author$
-  $Date$
-  created at: Fri Nov  3 00:47:54 JST 1995
-
-************************************************/
-
-#include "ruby.h"
-
-static VALUE
-tk_eval_cmd(argc, argv)
-    int argc;
-    VALUE argv[];
-{
-    VALUE cmd, rest;
-
-    rb_scan_args(argc, argv, "1*", &cmd, &rest);
-    return rb_eval_cmd(cmd, rest, 0);
-}
-
-static VALUE
-tk_s_new(argc, argv, klass)
-    int argc;
-    VALUE *argv;
-    VALUE klass;
-{
-    VALUE obj = rb_class_new_instance(argc, argv, klass);
-
-    if (rb_block_given_p()) rb_obj_instance_eval(0, 0, obj);
-    return obj;
-}
-
-void
-Init_tkutil()
-{
-    VALUE mTK = rb_define_module("TkUtil");
-    VALUE cTK = rb_define_class("TkKernel", rb_cObject);
-
-    rb_define_singleton_method(mTK, "eval_cmd", tk_eval_cmd, -1);
-
-    rb_define_singleton_method(cTK, "new", tk_s_new, -1);
-}
diff --git a/ext/win32ole/.cvsignore b/ext/win32ole/.cvsignore
deleted file mode 100644
index fc802ff1c2..0000000000
--- a/ext/win32ole/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-mkmf.log
diff --git a/ext/win32ole/MANIFEST b/ext/win32ole/MANIFEST
deleted file mode 100644
index 8e9bd46211..0000000000
--- a/ext/win32ole/MANIFEST
+++ /dev/null
@@ -1,24 +0,0 @@
-MANIFEST
-depend
-doc/win32ole.rd
-extconf.rb
-lib/win32ole/property.rb
-sample/excel1.rb
-sample/excel2.rb
-sample/excel3.rb
-sample/ie.rb
-sample/ieconst.rb
-sample/ienavi.rb
-sample/oledirs.rb
-sample/olegen.rb
-sample/xml.rb
-tests/oleserver.rb
-tests/testOLEEVENT.rb
-tests/testOLEMETHOD.rb
-tests/testOLEPARAM.rb
-tests/testOLETYPE.rb
-tests/testOLEVARIABLE.rb
-tests/testVARIANT.rb
-tests/testWIN32OLE.rb
-tests/testall.rb
-win32ole.c
diff --git a/ext/win32ole/depend b/ext/win32ole/depend
deleted file mode 100644
index 4bf5ab5b94..0000000000
--- a/ext/win32ole/depend
+++ /dev/null
@@ -1 +0,0 @@
-win32ole.o : win32ole.c $(hdrdir)/ruby.h $(hdrdir)/config.h $(hdrdir)/defines.h 
diff --git a/ext/win32ole/doc/win32ole.rd b/ext/win32ole/doc/win32ole.rd
deleted file mode 100644
index c563ce5d5b..0000000000
--- a/ext/win32ole/doc/win32ole.rd
+++ /dev/null
@@ -1,294 +0,0 @@
-=begin
-= Win32OLE extension module
-
-== WIN32OLE 
-=== Constants
-: VERSION
-    The version number of WIN32OLE.
-
-: ARGV
-    The argument of the method invoked recently.
-    This constant is used to get value of argument 
-    when the argument is passed by reference.
-
-=== Class Method
-: connect(oleserver)
-   returns running OLE automation object or WIN32OLE object from moniker.
-
-: const_load(ole [,obj])
-   defines the constants of OLE automation
-   server as 'obj' class constants. If 'obj' omitted, the default
-   is WIN32OLE.
-
-: new(oleserver)
-   returns OLE Automation object.
-
-: ole_free(obj)
-   invokes Release method of Dispatch interface of WIN32OLE object.
-   This method should not be used because this method exists for debugging WIN32OLE.
-
-: ole_reference_count(obj)
-   returns reference counter of Dispatch interface.
-   This method should not be used because this method exists for debugging WIN32OLE.
-
-: ole_show_help(info [,helpcontext])
-   displays helpfile.
-   The first argument specifies WIN32OLE_TYPE object or WIN32OLE_METHOD object 
-   or helpfile.
-
-=== Method
-: self[property]
-   gets property of OLE object.
-
-: self[property]=
-   sets property of OLE object.
-
-: _invoke(dispid, args, types)
-   runs the early binding method.
-   The dispid specifies Dispatch ID, args specifies the array of arguments,
-   types specifies array of the type of arguments.
-
-: each {...}
-   Iterates over each item of OLE collection which has IEnumVARIANT
-   interface.
-
-: invoke(method, args,...)
-   runs OLE method.
-
-: ole_func_methods
-   returns array of WIN32OLE_METHOD object which corresponds with function.
-
-: ole_get_methods
-   returns array of WIN32OLE_METHOD object which corresponds with get properties.
-
-: ole_method(method)
-   returns WIN32OLE_METHOD object which coreesponds with method 
-   which specified by argument.
-
-: ole_method_help(method)
-   alias of ole_method.
-
-: ole_methods
-   returns WIN32OLE_METHOD object which coreesponds with method.
-
-: ole_obj_help
-   returns WIN32OLE_TYPE object.
-
-: ole_put_methods
-   returns array of WIN32OLE_METHOD object which corresponds with put properties.
-
-: setproperty(property, key, val)
-   set property of OLE object. 
-   This method is used when the property has argument.
-
-   For example, in VB
-     obj.item("key") = val
-   in Win32OLE
-     obj.setproperty("item", "key", val)
-
-
-== WIN32OLE_EVENT class
-
-=== Class Method
-
-: new(ole, interface)
-   The new class method creates OLE event sink object to connect ole.
-   The ole must be WIN32OLE object, and interface is the interface
-   name of event.
-
-: message_loop
-    The message_loop class method translates and dispatches Windows 
-    message.
-
-=== Method
-: on_event([event]){...}
-    defines the callback of event.
-    If event omitted, defines the callback of all events.
-
-: on_event_with_outargs([event]) {...}
-    defines the callback of event.
-    If you want modify argument in callback, 
-
-== WIN32OLE_METHOD
-
-=== Class Methods
-: new(win32ole_type, method)    
-   creates WIN32OLE_METHOD object.
-
-=== Methods
-: dispid
-   returns Dispatch ID.
-
-: event?
-   returns true if the method is event.
-
-: event_interface
-   returns interface name of event if the method is event.
-
-: helpcontext
-   returns help context.
-
-: helpfile
-   returns help file.
-
-: invkind
-   returns invkind.
-
-: invoke_kind
-   returns invoke kind string.
-
-: name
-   returns name of method.
-
-: offset_vtbl
-   returns the offset of Vtbl.
-
-: params
-   returns array of WIN32OLE_PARAM object.
-
-: return_type
-   returns string of return value type of method.
-
-: return_vtype
-   returns number of return value type of method.
-
-: return_type_detail
-   returns detail information of return value type of method.
-
-: size_params
-   returns the size of arguments.
-
-: size_opt_params
-   returns the size of optional arguments.
-
-: visible?
-   returns true if the method is public.
-
-== WIN32OLE_PARAM
-: default
-   returns default value.
-
-: input?
-   returns true if argument is input.
-
-: optional?
-   returns true if argument is optional.
-
-: output?
-   returns true if argument is output.
-
-: name
-   returns name.
-
-: ole_type
-   returns type of argument.
-
-: ole_type_detail
-   returns detail information of type of argument.
-
-: retval?
-   returns true if argument is return value.
-
-== WIN32OLE_TYPE
-=== Class Methods
-: new(typelibrary, class)
-    returns WIN32OLE_TYPE object.
-
-: ole_classes(typelibrary)
-    returns array of WIN32OLE_TYPE objects defined by Type Library.
-
-: progids
-    returns array of ProgID.
-
-: typelibs
-    returns array of type libraries.
-
-=== Methods
-: guid
-   returns GUID.
-
-: helpfile
-   returns helpfile.
-
-: helpcontext
-   returns helpcontext.
-
-: helpstring
-   returns help string.
-
-: major_version
-   returns major version.
-
-: minor_version
-   returns minor version.
-
-: name
-   returns name.
-
-: ole_methods
-   returns array of WIN32OLE_METHOD objects.
-
-: ole_type
-   returns type of class.
-
-: progid
-   returns ProgID if it exists. If not found, then returns nil.
-
-: src_type
-   returns source class when the OLE class is 'Alias'.
-
-: typekind
-   returns number which represents type.
-
-: variables
-   returns array of variables defined in OLE class.
-
-: visible?
-   returns true if the OLE class is public.
-
-== WIN32OLE_VARIABLE
-=== Methods
-: name
-   returns the name.
-
-: ole_type
-   returns type
-
-: ole_type_detail
-   returns detail information of type.
-
-: value
-   returns value.
-
-: variable_kind
-   returns variable kind string.
-
-: varkind
-   returns the number which represents variable kind.
-
-== WIN32OLE::VARIANT
-=== Constants
-  *VT_I4
-  *VT_R4
-  *VT_R8
-  *VT_CY
-  *VT_DATE
-  *VT_BSTR
-  *VT_USERDEFINED
-  *VT_PTR
-  *VT_DISPATCH
-  *VT_ERROR
-  *VT_BOOL
-  *VT_VARIANT
-  *VT_UNKNOWN
-  *VT_I1
-  *VT_UI1
-  *VT_UI2
-  *VT_UI4
-  *VT_INT
-  *VT_UINT
-  *VT_ARRAY
-  *VT_BYREF
-
-=end
-
diff --git a/ext/win32ole/extconf.rb b/ext/win32ole/extconf.rb
deleted file mode 100644
index f627fcabb4..0000000000
--- a/ext/win32ole/extconf.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#----------------------------------
-# extconf.rb
-# $Revision$
-# $Date$
-#----------------------------------
-require 'mkmf'
-
-def create_win32ole_makefile
-  if have_library("ole32") and
-     have_library("oleaut32") and
-     have_library("uuid") and 
-     have_library("user32") and
-     have_library("advapi32")
-    create_makefile("win32ole")
-  end
-end
-
-case RUBY_PLATFORM
-when /mswin32/
-  $CFLAGS='/W3'
-when /mingw/
-  $CFLAGS='-DNONAMELESSUNION'
-when /cygwin/
-  $CFLAGS='-DNONAMELESSUNION'
-end
-create_win32ole_makefile
diff --git a/ext/win32ole/lib/win32ole/property.rb b/ext/win32ole/lib/win32ole/property.rb
deleted file mode 100644
index a68bad9af8..0000000000
--- a/ext/win32ole/lib/win32ole/property.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# OLEProperty
-# helper class of Property with arguments.
-class OLEProperty
-  def initialize(obj, dispid, gettypes, settypes)
-    @obj = obj
-    @dispid = dispid
-    @gettypes = gettypes
-    @settypes = settypes
-  end
-  def [](*args)
-    @obj._getproperty(@dispid, args, @gettypes)
-  end
-  def []=(*args)
-    @obj._setproperty(@dispid, args, @settypes)
-  end
-end
diff --git a/ext/win32ole/sample/excel1.rb b/ext/win32ole/sample/excel1.rb
deleted file mode 100644
index e366a52839..0000000000
--- a/ext/win32ole/sample/excel1.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-require 'win32ole'
-
-#application = WIN32OLE.new('Excel.Application.5')
-application = WIN32OLE.new('Excel.Application')
-
-application.visible = TRUE
-workbook = application.Workbooks.Add();
-worksheet = workbook.Worksheets(1);
-worksheet.Range("A1:D1").value = ["North","South","East","West"];
-worksheet.Range("A2:B2").value = [5.2, 10];
-worksheet.Range("C2").value = 8;
-worksheet.Range("D2").value = 20;
-
-range = worksheet.Range("A1:D2");
-range.Select
-chart = workbook.Charts.Add;
-
-workbook.saved = TRUE;
-
-application.ActiveWorkbook.Close(0);
-application.Quit();
-
diff --git a/ext/win32ole/sample/excel2.rb b/ext/win32ole/sample/excel2.rb
deleted file mode 100644
index 46f459b36b..0000000000
--- a/ext/win32ole/sample/excel2.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-require 'win32ole'
-
-#   -4100 is the value for the Excel constant xl3DColumn.
-ChartTypeVal = -4100;
-
-#   Creates OLE object to Excel
-#excel = WIN32OLE.new("excel.application.5")
-excel = WIN32OLE.new("excel.application")
-
-# Create and rotate the chart
-
-excel['Visible'] = TRUE;
-excel.Workbooks.Add();
-excel.Range("a1")['Value'] = 3;
-excel.Range("a2")['Value'] = 2;
-excel.Range("a3")['Value'] = 1;
-excel.Range("a1:a3").Select();
-excelchart = excel.Charts.Add();
-excelchart['Type'] = ChartTypeVal;
-
-i = 30
-i.step(180, 10) do |rot|
-#    excelchart['Rotation'] = rot;
-    excelchart.rotation=rot;
-end
-# Done, bye
-
-excel.ActiveWorkbook.Close(0);
-excel.Quit();
-
diff --git a/ext/win32ole/sample/excel3.rb b/ext/win32ole/sample/excel3.rb
deleted file mode 100644
index 0f96717063..0000000000
--- a/ext/win32ole/sample/excel3.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-require 'win32ole'
-
-#application = WIN32OLE.new('Excel.Application.5')
-application = WIN32OLE.new('Excel.Application')
-
-application.visible = TRUE
-workbook = application.Workbooks.Add();
-sheet = workbook.Worksheets(1);
-sheetS = workbook.Worksheets
-puts "The number of sheets is #{sheetS.count}"
-puts "Now add 2 sheets after of `#{sheet.name}`"
-sheetS.add({'count'=>2, 'after'=>sheet})
-puts "The number of sheets is #{sheetS.count}"
diff --git a/ext/win32ole/sample/ie.rb b/ext/win32ole/sample/ie.rb
deleted file mode 100644
index 11dc861e0b..0000000000
--- a/ext/win32ole/sample/ie.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-require 'win32ole'
-url = 'http://www.ruby-lang.org/'
-ie = WIN32OLE.new('InternetExplorer.Application')
-ie.visible = TRUE
-ie.gohome
-print "Now navigate Ruby home page... Please enter."
-gets
-ie.navigate(url)
-print "Now quit Internet Explorer... Please enter."
-gets
-ie.Quit()
diff --git a/ext/win32ole/sample/ieconst.rb b/ext/win32ole/sample/ieconst.rb
deleted file mode 100644
index 234272c7ed..0000000000
--- a/ext/win32ole/sample/ieconst.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-require 'win32ole'
-
-ie = WIN32OLE.new('InternetExplorer.Application')
-=begin
-WIN32OLE.const_load(ie)
-WIN32OLE.constants.sort.each do |c|
-  puts "#{c} = #{WIN32OLE.const_get(c)}"
-end
-=end
-
-module IE_CONST
-end
-
-WIN32OLE.const_load(ie, IE_CONST)
-IE_CONST.constants.sort.each do |c|
-  puts "#{c} = #{IE_CONST.const_get(c)}"
-end
-
-#------------------------------------------------------------
-# Remark!!! CONSTANTS has not tested enoughly!!!
-# CONSTANTS is alpha release.
-# If there are constants which first letter is not [a-zA-Z],
-# like a '_Foo', then maybe you can access the value by 
-# using CONSTANTS['_Foo']
-#------------------------------------------------------------
-IE_CONST::CONSTANTS.each do |k, v|
-  puts "#{k} = #{v}"
-end
-
-puts WIN32OLE::VERSION
-ie.quit
-
diff --git a/ext/win32ole/sample/ienavi.rb b/ext/win32ole/sample/ienavi.rb
deleted file mode 100644
index c7fa3f5ec2..0000000000
--- a/ext/win32ole/sample/ienavi.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-require 'win32ole'
-
-$urls = []
-
-def navigate(url)
-  $urls << url
-end
-
-def stop_msg_loop
-  puts "Now Stop IE..."
-  $LOOP = FALSE;
-end
-
-def default_handler(event, *args)
-  case event
-  when "BeforeNavigate"
-    puts "Now Navigate #{args[0]}..."
-  end
-end
-
-ie = WIN32OLE.new('InternetExplorer.Application')
-ie.visible = TRUE
-ie.gohome
-
-ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents')
-
-ev.on_event {|*args| default_handler(*args)}
-ev.on_event("NavigateComplete") {|url| navigate(url)}
-ev.on_event("Quit") {|*args| stop_msg_loop} 
-
-$LOOP = TRUE
-while ($LOOP)
-  WIN32OLE_EVENT.message_loop
-end
-
-puts "You Navigated the URLs ..."
-$urls.each_with_index do |url, i|
-  puts "(#{i+1}) #{url}"
-end
-
diff --git a/ext/win32ole/sample/oledirs.rb b/ext/win32ole/sample/oledirs.rb
deleted file mode 100644
index 1c77e76f14..0000000000
--- a/ext/win32ole/sample/oledirs.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# You need WSH(Windows Scripting Host) to run this script.
-#
-
-require "win32ole"
-
-def listup(items)
-#  items.each do |i|
-  for i in items
-    puts i.name 
-  end
-end
-
-fs = WIN32OLE.new("Scripting.FileSystemObject")
-
-folder = fs.GetFolder(".")
-
-puts "--- folder of #{folder.path} ---"
-listup(folder.SubFolders)
-
-puts "--- files of #{folder.path} ---"
-listup(folder.Files)
-
diff --git a/ext/win32ole/sample/olegen.rb b/ext/win32ole/sample/olegen.rb
deleted file mode 100644
index 48d86893fe..0000000000
--- a/ext/win32ole/sample/olegen.rb
+++ /dev/null
@@ -1,348 +0,0 @@
-#-----------------------------
-# olegen.rb
-# $Date$
-# $Revision$
-#-----------------------------
-
-require 'win32ole'
-
-class WIN32COMGen
-  def initialize(typelib)
-    @typelib = typelib
-    @reciever = ""
-  end
-  attr_reader :typelib
-
-  def ole_classes(typelib)
-    begin
-      @ole = WIN32OLE.new(typelib)
-      [@ole.ole_obj_help]
-    rescue
-      WIN32OLE_TYPE.ole_classes(typelib)
-    end
-  end
-
-  def generate_args(method)
-    args = []
-    if method.size_opt_params >= 0
-      size_required_params = method.size_params - method.size_opt_params
-    else
-      size_required_params = method.size_params - 1
-    end
-    size_required_params.times do |i|
-      if method.params[i] && method.params[i].optional?
-        args.push "arg#{i}=nil"
-      else
-        args.push "arg#{i}"
-      end
-    end
-    if method.size_opt_params >= 0
-      method.size_opt_params.times do |i|
-        args.push "arg#{i + size_required_params}=nil"
-      end
-    else
-      args.push "*arg"
-    end
-    args.join(", ")
-  end
-
-  def generate_argtype(typedetails)
-    ts = ''
-    typedetails.each do |t|
-      case t
-      when 'CARRAY', 'VOID', 'UINT', 'RESULT', 'DECIMAL', 'I8', 'UI8' 
-#	  raise "Sorry type\"" + t + "\" not supported"
-      ts << "\"??? NOT SUPPORTED TYPE:`#{t}'\""
-      when 'USERDEFINED', 'Unknown Type 9'
-        ts << 'VT_DISPATCH'
-        break;
-      when 'SAFEARRAY'
-        ts << 'VT_ARRAY|'
-      when 'PTR'
-        ts << 'VT_BYREF|'
-      when 'INT'
-        ts << 'VT_I4'
-      else
-        if String === t
-          ts << 'VT_' + t
-        end
-      end
-    end
-    if ts.empty?
-      ts = 'VT_VARIANT'
-    elsif ts[-1] == ?|
-	ts += 'VT_VARIANT'
-    end
-    ts
-  end
-
-  def generate_argtypes(method, proptypes)
-    types = method.params.collect{|param|
-      generate_argtype(param.ole_type_detail)
-    }.join(", ")
-    if proptypes
-      types += ", " if types.size > 0 
-      types += generate_argtype(proptypes)
-    end
-    types
-  end
-
-  def generate_method_body(method, disptype, types=nil)
-    "    ret = #{@reciever}#{disptype}(#{method.dispid}, [" +
-    generate_args(method).gsub("=nil", "") +
-    "], [" +
-    generate_argtypes(method, types) +
-    "])\n" +
-    "    @lastargs = WIN32OLE::ARGV\n" +
-    "    ret"
-  end
-
-  def generate_method_help(method, type = nil)
-    str = "  # "  
-    if type 
-      str += type
-    else
-      str += method.return_type
-    end
-    str += " #{method.name}"
-    if method.event?
-      str += " EVENT"
-      str += " in #{method.event_interface}"
-    end
-    if method.helpstring && method.helpstring != ""
-      str += "\n  # "
-      str += method.helpstring
-    end
-    args_help = generate_method_args_help(method)
-    if args_help
-      str += "\n"
-      str += args_help
-    end
-    str
-  end
-
-  def generate_method_args_help(method)
-    args = []
-    method.params.each_with_index {|param, i|
-      h = "  #   #{param.ole_type} arg#{i} --- #{param.name}" 
-      inout = []
-      inout.push "IN" if param.input?
-      inout.push "OUT" if param.output?
-      h += " [#{inout.join('/')}]"
-      h += " ( = #{param.default})" if param.default
-      args.push h
-    }
-    if args.size > 0
-      args.join("\n")
-    else
-      nil
-    end
-  end
-
-  def generate_method(method, disptype, io = STDOUT, types = nil)
-    io.puts "\n"
-    io.puts  generate_method_help(method)
-    if method.invoke_kind == 'PROPERTYPUT'
-      io.print "  def #{method.name}=("
-    else
-      io.print "  def #{method.name}("
-    end
-    io.print generate_args(method)
-    io.puts ")"
-    io.puts generate_method_body(method, disptype, types)
-    io.puts "  end"
-  end
-
-  def generate_propputref_methods(klass, io = STDOUT)
-    klass.ole_methods.select {|method|
-      method.invoke_kind == 'PROPERTYPUTREF' && method.visible?
-    }.each do |method|
-      generate_method(method, io)
-    end
-  end
-
-  def generate_properties_with_args(klass, io = STDOUT)
-    klass.ole_methods.select {|method|
-      method.invoke_kind == 'PROPERTYGET' &&
-      method.visible? &&
-      method.size_params > 0
-    }.each do |method|
-      types = method.return_type_detail 
-      io.puts "\n"
-      io.puts  generate_method_help(method, types[0])
-      io.puts  "  def #{method.name}"
-      if klass.ole_type == "Class"
-        io.print "    OLEProperty.new(@dispatch, #{method.dispid}, [" 
-      else
-        io.print "    OLEProperty.new(self, #{method.dispid}, [" 
-      end
-      io.print generate_argtypes(method, nil)
-      io.print "], ["
-      io.print generate_argtypes(method, types)
-      io.puts "])"
-      io.puts  "  end"
-    end
-  end
-
-  def generate_propput_methods(klass, io = STDOUT)
-    klass.ole_methods.select {|method|
-      method.invoke_kind == 'PROPERTYPUT' && method.visible? &&
-      method.size_params == 1
-    }.each do |method|
-      ms = klass.ole_methods.select {|m|
-        m.invoke_kind == 'PROPERTYGET' &&
-        m.dispid == method.dispid
-      }
-      types = []
-      if ms.size == 1
-        types = ms[0].return_type_detail
-      end
-      generate_method(method, '_setproperty', io, types)
-    end
-  end
-
-  def generate_propget_methods(klass, io = STDOUT)
-    klass.ole_methods.select {|method|
-      method.invoke_kind == 'PROPERTYGET' && method.visible? &&
-      method.size_params == 0
-    }.each do |method|
-      generate_method(method, '_getproperty', io)
-    end
-  end
-
-  def generate_func_methods(klass, io = STDOUT)
-    klass.ole_methods.select {|method|
-      method.invoke_kind == "FUNC" && method.visible?
-    }.each do |method|
-      generate_method(method, '_invoke', io)
-    end
-  end
-
-  def generate_methods(klass, io = STDOUT)
-    generate_propget_methods(klass, io)
-    generate_propput_methods(klass, io)
-    generate_properties_with_args(klass, io)
-    generate_func_methods(klass, io)
-#   generate_propputref_methods(klass, io)
-  end
-
-  def generate_constants(klass, io = STDOUT)
-    klass.variables.select {|v|
-      v.visible? && v.variable_kind == 'CONSTANT'
-    }.each do |v|
-      io.print "  "
-      io.print v.name.sub(/^./){|c| c.upcase}
-      io.print " = "
-      io.puts  v.value
-    end
-  end
-
-  def class_name(klass)
-    klass_name = klass.name
-    if klass.ole_type == "Class" &&
-       klass.guid &&
-       klass.progid
-       klass_name = klass.progid.gsub(/\./, '_')
-    end
-    if /^[A-Z]/ !~ klass_name || Module.constants.include?(klass_name)
-      klass_name = 'OLE' + klass_name
-    end
-    klass_name
-  end
-
-  def define_initialize(klass)
-    < xml.rb
-# 
-require 'win32ole'
-require 'win32ole/property'
-
-# 
-module IXMLDOMImplementation
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # BOOL hasFeature
-  #   BSTR arg0 --- feature [IN]
-  #   BSTR arg1 --- version [IN]
-  def hasFeature(arg0, arg1)
-    ret = _invoke(145, [arg0, arg1], [VT_BSTR, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# Core DOM node interface
-module IXMLDOMNode
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # BSTR nodeName
-  # name of the node
-  def nodeName()
-    ret = _getproperty(2, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeValue
-  # value stored in the node
-  def nodeValue()
-    ret = _getproperty(3, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # DOMNodeType nodeType
-  # the node's type
-  def nodeType()
-    ret = _getproperty(4, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode parentNode
-  # parent of the node
-  def parentNode()
-    ret = _getproperty(6, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList childNodes
-  # the collection of the node's children
-  def childNodes()
-    ret = _getproperty(7, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode firstChild
-  # first child of the node
-  def firstChild()
-    ret = _getproperty(8, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode lastChild
-  # first child of the node
-  def lastChild()
-    ret = _getproperty(9, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode previousSibling
-  # left sibling of the node
-  def previousSibling()
-    ret = _getproperty(10, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nextSibling
-  # right sibling of the node
-  def nextSibling()
-    ret = _getproperty(11, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNamedNodeMap attributes
-  # the collection of the node's attributes
-  def attributes()
-    ret = _getproperty(12, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocument ownerDocument
-  # document that contains the node
-  def ownerDocument()
-    ret = _getproperty(18, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR nodeTypeString
-  # the type of node in string form
-  def nodeTypeString()
-    ret = _getproperty(21, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR text
-  # text content of the node and subtree
-  def text()
-    ret = _getproperty(24, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL specified
-  # indicates whether node is a default value
-  def specified()
-    ret = _getproperty(22, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode definition
-  # pointer to the definition of the node in the DTD or schema
-  def definition()
-    ret = _getproperty(23, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue()
-    ret = _getproperty(25, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT dataType
-  # the data type of the node
-  def dataType()
-    ret = _getproperty(26, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR xml
-  # return the XML source for the node and each of its descendants
-  def xml()
-    ret = _getproperty(27, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL parsed
-  # has sub-tree been completely parsed
-  def parsed()
-    ret = _getproperty(31, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR namespaceURI
-  # the URI for the namespace applying to the node
-  def namespaceURI()
-    ret = _getproperty(32, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR prefix
-  # the prefix for the namespace applying to the node
-  def prefix()
-    ret = _getproperty(33, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR baseName
-  # the base name of the node (nodename with the prefix stripped off)
-  def baseName()
-    ret = _getproperty(34, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeValue
-  # value stored in the node
-  def nodeValue=(arg0)
-    ret = _setproperty(3, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID text
-  # text content of the node and subtree
-  def text=(arg0)
-    ret = _setproperty(24, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue=(arg0)
-    ret = _setproperty(25, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID dataType
-  # the data type of the node
-  def dataType=(arg0)
-    ret = _setproperty(26, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode insertBefore
-  # insert a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   VARIANT arg1 --- refChild [IN]
-  def insertBefore(arg0, arg1)
-    ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode replaceChild
-  # replace a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   IXMLDOMNode arg1 --- oldChild [IN]
-  def replaceChild(arg0, arg1)
-    ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode removeChild
-  # remove a child node
-  #   IXMLDOMNode arg0 --- childNode [IN]
-  def removeChild(arg0)
-    ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode appendChild
-  # append a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  def appendChild(arg0)
-    ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL hasChildNodes
-  def hasChildNodes()
-    ret = _invoke(17, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode cloneNode
-  #   BOOL arg0 --- deep [IN]
-  def cloneNode(arg0)
-    ret = _invoke(19, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR transformNode
-  # apply the stylesheet to the subtree
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  def transformNode(arg0)
-    ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList selectNodes
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectNodes(arg0)
-    ret = _invoke(29, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode selectSingleNode
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectSingleNode(arg0)
-    ret = _invoke(30, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID transformNodeToObject
-  # apply the stylesheet to the subtree, returning the result through a document or a stream
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  #   VARIANT arg1 --- outputObject [IN]
-  def transformNodeToObject(arg0, arg1)
-    ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# Constants that define a node's type
-module OLEtagDOMNodeType
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-  NODE_INVALID = 0
-  NODE_ELEMENT = 1
-  NODE_ATTRIBUTE = 2
-  NODE_TEXT = 3
-  NODE_CDATA_SECTION = 4
-  NODE_ENTITY_REFERENCE = 5
-  NODE_ENTITY = 6
-  NODE_PROCESSING_INSTRUCTION = 7
-  NODE_COMMENT = 8
-  NODE_DOCUMENT = 9
-  NODE_DOCUMENT_TYPE = 10
-  NODE_DOCUMENT_FRAGMENT = 11
-  NODE_NOTATION = 12
-end
-
-# 
-module IXMLDOMNodeList
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # I4 length
-  # number of nodes in the collection
-  def length()
-    ret = _getproperty(74, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # PTR item
-  # collection of nodes
-  #   I4 arg0 --- index [IN]
-  def item
-    OLEProperty.new(self, 0, [VT_I4], [VT_I4, VT_BYREF|VT_DISPATCH])
-  end
-
-  # IXMLDOMNode nextNode
-  # get next node from iterator
-  def nextNode()
-    ret = _invoke(76, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID reset
-  # reset the position of iterator
-  def reset()
-    ret = _invoke(77, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# 
-module IXMLDOMNamedNodeMap
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # I4 length
-  # number of nodes in the collection
-  def length()
-    ret = _getproperty(74, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # PTR item
-  # collection of nodes
-  #   I4 arg0 --- index [IN]
-  def item
-    OLEProperty.new(self, 0, [VT_I4], [VT_I4, VT_BYREF|VT_DISPATCH])
-  end
-
-  # IXMLDOMNode getNamedItem
-  # lookup item by name
-  #   BSTR arg0 --- name [IN]
-  def getNamedItem(arg0)
-    ret = _invoke(83, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode setNamedItem
-  # set item by name
-  #   IXMLDOMNode arg0 --- newItem [IN]
-  def setNamedItem(arg0)
-    ret = _invoke(84, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode removeNamedItem
-  # remove item by name
-  #   BSTR arg0 --- name [IN]
-  def removeNamedItem(arg0)
-    ret = _invoke(85, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode getQualifiedItem
-  # lookup the item by name and namespace
-  #   BSTR arg0 --- baseName [IN]
-  #   BSTR arg1 --- namespaceURI [IN]
-  def getQualifiedItem(arg0, arg1)
-    ret = _invoke(87, [arg0, arg1], [VT_BSTR, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode removeQualifiedItem
-  # remove the item by name and namespace
-  #   BSTR arg0 --- baseName [IN]
-  #   BSTR arg1 --- namespaceURI [IN]
-  def removeQualifiedItem(arg0, arg1)
-    ret = _invoke(88, [arg0, arg1], [VT_BSTR, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nextNode
-  # get next node from iterator
-  def nextNode()
-    ret = _invoke(89, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID reset
-  # reset the position of iterator
-  def reset()
-    ret = _invoke(90, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# 
-module IXMLDOMDocument
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # BSTR nodeName
-  # name of the node
-  def nodeName()
-    ret = _getproperty(2, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeValue
-  # value stored in the node
-  def nodeValue()
-    ret = _getproperty(3, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # DOMNodeType nodeType
-  # the node's type
-  def nodeType()
-    ret = _getproperty(4, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode parentNode
-  # parent of the node
-  def parentNode()
-    ret = _getproperty(6, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList childNodes
-  # the collection of the node's children
-  def childNodes()
-    ret = _getproperty(7, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode firstChild
-  # first child of the node
-  def firstChild()
-    ret = _getproperty(8, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode lastChild
-  # first child of the node
-  def lastChild()
-    ret = _getproperty(9, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode previousSibling
-  # left sibling of the node
-  def previousSibling()
-    ret = _getproperty(10, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nextSibling
-  # right sibling of the node
-  def nextSibling()
-    ret = _getproperty(11, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNamedNodeMap attributes
-  # the collection of the node's attributes
-  def attributes()
-    ret = _getproperty(12, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocument ownerDocument
-  # document that contains the node
-  def ownerDocument()
-    ret = _getproperty(18, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR nodeTypeString
-  # the type of node in string form
-  def nodeTypeString()
-    ret = _getproperty(21, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR text
-  # text content of the node and subtree
-  def text()
-    ret = _getproperty(24, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL specified
-  # indicates whether node is a default value
-  def specified()
-    ret = _getproperty(22, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode definition
-  # pointer to the definition of the node in the DTD or schema
-  def definition()
-    ret = _getproperty(23, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue()
-    ret = _getproperty(25, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT dataType
-  # the data type of the node
-  def dataType()
-    ret = _getproperty(26, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR xml
-  # return the XML source for the node and each of its descendants
-  def xml()
-    ret = _getproperty(27, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL parsed
-  # has sub-tree been completely parsed
-  def parsed()
-    ret = _getproperty(31, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR namespaceURI
-  # the URI for the namespace applying to the node
-  def namespaceURI()
-    ret = _getproperty(32, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR prefix
-  # the prefix for the namespace applying to the node
-  def prefix()
-    ret = _getproperty(33, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR baseName
-  # the base name of the node (nodename with the prefix stripped off)
-  def baseName()
-    ret = _getproperty(34, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocumentType doctype
-  # node corresponding to the DOCTYPE
-  def doctype()
-    ret = _getproperty(38, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMImplementation implementation
-  # info on this DOM implementation
-  def implementation()
-    ret = _getproperty(39, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMElement documentElement
-  # the root of the tree
-  def documentElement()
-    ret = _getproperty(40, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # I4 readyState
-  # get the state of the XML document
-  def readyState()
-    ret = _getproperty(-525, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMParseError parseError
-  # get the last parser error
-  def parseError()
-    ret = _getproperty(59, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR url
-  # get the URL for the loaded XML document
-  def url()
-    ret = _getproperty(60, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL async
-  # flag for asynchronous download
-  def async()
-    ret = _getproperty(61, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL validateOnParse
-  # indicates whether the parser performs validation
-  def validateOnParse()
-    ret = _getproperty(65, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL resolveExternals
-  # indicates whether the parser resolves references to external DTD/Entities/Schema
-  def resolveExternals()
-    ret = _getproperty(66, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL preserveWhiteSpace
-  # indicates whether the parser preserves whitespace
-  def preserveWhiteSpace()
-    ret = _getproperty(67, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeValue
-  # value stored in the node
-  def nodeValue=(arg0)
-    ret = _setproperty(3, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID text
-  # text content of the node and subtree
-  def text=(arg0)
-    ret = _setproperty(24, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue=(arg0)
-    ret = _setproperty(25, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID dataType
-  # the data type of the node
-  def dataType=(arg0)
-    ret = _setproperty(26, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID async
-  # flag for asynchronous download
-  def async=(arg0)
-    ret = _setproperty(61, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID validateOnParse
-  # indicates whether the parser performs validation
-  def validateOnParse=(arg0)
-    ret = _setproperty(65, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID resolveExternals
-  # indicates whether the parser resolves references to external DTD/Entities/Schema
-  def resolveExternals=(arg0)
-    ret = _setproperty(66, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID preserveWhiteSpace
-  # indicates whether the parser preserves whitespace
-  def preserveWhiteSpace=(arg0)
-    ret = _setproperty(67, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID onreadystatechange
-  # register a readystatechange event handler
-  def onreadystatechange=(arg0)
-    ret = _setproperty(68, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID ondataavailable
-  # register an ondataavailable event handler
-  def ondataavailable=(arg0)
-    ret = _setproperty(69, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID ontransformnode
-  # register an ontransformnode event handler
-  def ontransformnode=(arg0)
-    ret = _setproperty(70, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode insertBefore
-  # insert a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   VARIANT arg1 --- refChild [IN]
-  def insertBefore(arg0, arg1)
-    ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode replaceChild
-  # replace a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   IXMLDOMNode arg1 --- oldChild [IN]
-  def replaceChild(arg0, arg1)
-    ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode removeChild
-  # remove a child node
-  #   IXMLDOMNode arg0 --- childNode [IN]
-  def removeChild(arg0)
-    ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode appendChild
-  # append a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  def appendChild(arg0)
-    ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL hasChildNodes
-  def hasChildNodes()
-    ret = _invoke(17, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode cloneNode
-  #   BOOL arg0 --- deep [IN]
-  def cloneNode(arg0)
-    ret = _invoke(19, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR transformNode
-  # apply the stylesheet to the subtree
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  def transformNode(arg0)
-    ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList selectNodes
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectNodes(arg0)
-    ret = _invoke(29, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode selectSingleNode
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectSingleNode(arg0)
-    ret = _invoke(30, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID transformNodeToObject
-  # apply the stylesheet to the subtree, returning the result through a document or a stream
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  #   VARIANT arg1 --- outputObject [IN]
-  def transformNodeToObject(arg0, arg1)
-    ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMElement createElement
-  # create an Element node
-  #   BSTR arg0 --- tagName [IN]
-  def createElement(arg0)
-    ret = _invoke(41, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocumentFragment createDocumentFragment
-  # create a DocumentFragment node
-  def createDocumentFragment()
-    ret = _invoke(42, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMText createTextNode
-  # create a text node
-  #   BSTR arg0 --- data [IN]
-  def createTextNode(arg0)
-    ret = _invoke(43, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMComment createComment
-  # create a comment node
-  #   BSTR arg0 --- data [IN]
-  def createComment(arg0)
-    ret = _invoke(44, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMCDATASection createCDATASection
-  # create a CDATA section node
-  #   BSTR arg0 --- data [IN]
-  def createCDATASection(arg0)
-    ret = _invoke(45, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMProcessingInstruction createProcessingInstruction
-  # create a processing instruction node
-  #   BSTR arg0 --- target [IN]
-  #   BSTR arg1 --- data [IN]
-  def createProcessingInstruction(arg0, arg1)
-    ret = _invoke(46, [arg0, arg1], [VT_BSTR, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMAttribute createAttribute
-  # create an attribute node
-  #   BSTR arg0 --- name [IN]
-  def createAttribute(arg0)
-    ret = _invoke(47, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMEntityReference createEntityReference
-  # create an entity reference node
-  #   BSTR arg0 --- name [IN]
-  def createEntityReference(arg0)
-    ret = _invoke(49, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList getElementsByTagName
-  # build a list of elements by name
-  #   BSTR arg0 --- tagName [IN]
-  def getElementsByTagName(arg0)
-    ret = _invoke(50, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode createNode
-  # create a node of the specified node type and name
-  #   VARIANT arg0 --- type [IN]
-  #   BSTR arg1 --- name [IN]
-  #   BSTR arg2 --- namespaceURI [IN]
-  def createNode(arg0, arg1, arg2)
-    ret = _invoke(54, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nodeFromID
-  # retrieve node from it's ID
-  #   BSTR arg0 --- idString [IN]
-  def nodeFromID(arg0)
-    ret = _invoke(56, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL load
-  # load document from the specified XML source
-  #   VARIANT arg0 --- xmlSource [IN]
-  def load(arg0)
-    ret = _invoke(58, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID abort
-  # abort an asynchronous download
-  def abort()
-    ret = _invoke(62, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL loadXML
-  # load the document from a string
-  #   BSTR arg0 --- bstrXML [IN]
-  def loadXML(arg0)
-    ret = _invoke(63, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID save
-  # save the document to a specified desination
-  #   VARIANT arg0 --- desination [IN]
-  def save(arg0)
-    ret = _invoke(64, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# 
-module IXMLDOMDocumentType
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # BSTR nodeName
-  # name of the node
-  def nodeName()
-    ret = _getproperty(2, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeValue
-  # value stored in the node
-  def nodeValue()
-    ret = _getproperty(3, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # DOMNodeType nodeType
-  # the node's type
-  def nodeType()
-    ret = _getproperty(4, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode parentNode
-  # parent of the node
-  def parentNode()
-    ret = _getproperty(6, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList childNodes
-  # the collection of the node's children
-  def childNodes()
-    ret = _getproperty(7, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode firstChild
-  # first child of the node
-  def firstChild()
-    ret = _getproperty(8, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode lastChild
-  # first child of the node
-  def lastChild()
-    ret = _getproperty(9, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode previousSibling
-  # left sibling of the node
-  def previousSibling()
-    ret = _getproperty(10, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nextSibling
-  # right sibling of the node
-  def nextSibling()
-    ret = _getproperty(11, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNamedNodeMap attributes
-  # the collection of the node's attributes
-  def attributes()
-    ret = _getproperty(12, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocument ownerDocument
-  # document that contains the node
-  def ownerDocument()
-    ret = _getproperty(18, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR nodeTypeString
-  # the type of node in string form
-  def nodeTypeString()
-    ret = _getproperty(21, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR text
-  # text content of the node and subtree
-  def text()
-    ret = _getproperty(24, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL specified
-  # indicates whether node is a default value
-  def specified()
-    ret = _getproperty(22, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode definition
-  # pointer to the definition of the node in the DTD or schema
-  def definition()
-    ret = _getproperty(23, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue()
-    ret = _getproperty(25, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT dataType
-  # the data type of the node
-  def dataType()
-    ret = _getproperty(26, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR xml
-  # return the XML source for the node and each of its descendants
-  def xml()
-    ret = _getproperty(27, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL parsed
-  # has sub-tree been completely parsed
-  def parsed()
-    ret = _getproperty(31, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR namespaceURI
-  # the URI for the namespace applying to the node
-  def namespaceURI()
-    ret = _getproperty(32, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR prefix
-  # the prefix for the namespace applying to the node
-  def prefix()
-    ret = _getproperty(33, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR baseName
-  # the base name of the node (nodename with the prefix stripped off)
-  def baseName()
-    ret = _getproperty(34, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR name
-  # name of the document type (root of the tree)
-  def name()
-    ret = _getproperty(131, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNamedNodeMap entities
-  # a list of entities in the document
-  def entities()
-    ret = _getproperty(132, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNamedNodeMap notations
-  # a list of notations in the document
-  def notations()
-    ret = _getproperty(133, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeValue
-  # value stored in the node
-  def nodeValue=(arg0)
-    ret = _setproperty(3, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID text
-  # text content of the node and subtree
-  def text=(arg0)
-    ret = _setproperty(24, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue=(arg0)
-    ret = _setproperty(25, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID dataType
-  # the data type of the node
-  def dataType=(arg0)
-    ret = _setproperty(26, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode insertBefore
-  # insert a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   VARIANT arg1 --- refChild [IN]
-  def insertBefore(arg0, arg1)
-    ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode replaceChild
-  # replace a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   IXMLDOMNode arg1 --- oldChild [IN]
-  def replaceChild(arg0, arg1)
-    ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode removeChild
-  # remove a child node
-  #   IXMLDOMNode arg0 --- childNode [IN]
-  def removeChild(arg0)
-    ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode appendChild
-  # append a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  def appendChild(arg0)
-    ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL hasChildNodes
-  def hasChildNodes()
-    ret = _invoke(17, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode cloneNode
-  #   BOOL arg0 --- deep [IN]
-  def cloneNode(arg0)
-    ret = _invoke(19, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR transformNode
-  # apply the stylesheet to the subtree
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  def transformNode(arg0)
-    ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList selectNodes
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectNodes(arg0)
-    ret = _invoke(29, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode selectSingleNode
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectSingleNode(arg0)
-    ret = _invoke(30, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID transformNodeToObject
-  # apply the stylesheet to the subtree, returning the result through a document or a stream
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  #   VARIANT arg1 --- outputObject [IN]
-  def transformNodeToObject(arg0, arg1)
-    ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# 
-module IXMLDOMElement
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # BSTR nodeName
-  # name of the node
-  def nodeName()
-    ret = _getproperty(2, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeValue
-  # value stored in the node
-  def nodeValue()
-    ret = _getproperty(3, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # DOMNodeType nodeType
-  # the node's type
-  def nodeType()
-    ret = _getproperty(4, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode parentNode
-  # parent of the node
-  def parentNode()
-    ret = _getproperty(6, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList childNodes
-  # the collection of the node's children
-  def childNodes()
-    ret = _getproperty(7, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode firstChild
-  # first child of the node
-  def firstChild()
-    ret = _getproperty(8, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode lastChild
-  # first child of the node
-  def lastChild()
-    ret = _getproperty(9, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode previousSibling
-  # left sibling of the node
-  def previousSibling()
-    ret = _getproperty(10, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nextSibling
-  # right sibling of the node
-  def nextSibling()
-    ret = _getproperty(11, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNamedNodeMap attributes
-  # the collection of the node's attributes
-  def attributes()
-    ret = _getproperty(12, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocument ownerDocument
-  # document that contains the node
-  def ownerDocument()
-    ret = _getproperty(18, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR nodeTypeString
-  # the type of node in string form
-  def nodeTypeString()
-    ret = _getproperty(21, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR text
-  # text content of the node and subtree
-  def text()
-    ret = _getproperty(24, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL specified
-  # indicates whether node is a default value
-  def specified()
-    ret = _getproperty(22, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode definition
-  # pointer to the definition of the node in the DTD or schema
-  def definition()
-    ret = _getproperty(23, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue()
-    ret = _getproperty(25, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT dataType
-  # the data type of the node
-  def dataType()
-    ret = _getproperty(26, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR xml
-  # return the XML source for the node and each of its descendants
-  def xml()
-    ret = _getproperty(27, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL parsed
-  # has sub-tree been completely parsed
-  def parsed()
-    ret = _getproperty(31, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR namespaceURI
-  # the URI for the namespace applying to the node
-  def namespaceURI()
-    ret = _getproperty(32, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR prefix
-  # the prefix for the namespace applying to the node
-  def prefix()
-    ret = _getproperty(33, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR baseName
-  # the base name of the node (nodename with the prefix stripped off)
-  def baseName()
-    ret = _getproperty(34, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR tagName
-  # get the tagName of the element
-  def tagName()
-    ret = _getproperty(97, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeValue
-  # value stored in the node
-  def nodeValue=(arg0)
-    ret = _setproperty(3, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID text
-  # text content of the node and subtree
-  def text=(arg0)
-    ret = _setproperty(24, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue=(arg0)
-    ret = _setproperty(25, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID dataType
-  # the data type of the node
-  def dataType=(arg0)
-    ret = _setproperty(26, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode insertBefore
-  # insert a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   VARIANT arg1 --- refChild [IN]
-  def insertBefore(arg0, arg1)
-    ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode replaceChild
-  # replace a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   IXMLDOMNode arg1 --- oldChild [IN]
-  def replaceChild(arg0, arg1)
-    ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode removeChild
-  # remove a child node
-  #   IXMLDOMNode arg0 --- childNode [IN]
-  def removeChild(arg0)
-    ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode appendChild
-  # append a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  def appendChild(arg0)
-    ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL hasChildNodes
-  def hasChildNodes()
-    ret = _invoke(17, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode cloneNode
-  #   BOOL arg0 --- deep [IN]
-  def cloneNode(arg0)
-    ret = _invoke(19, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR transformNode
-  # apply the stylesheet to the subtree
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  def transformNode(arg0)
-    ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList selectNodes
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectNodes(arg0)
-    ret = _invoke(29, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode selectSingleNode
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectSingleNode(arg0)
-    ret = _invoke(30, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID transformNodeToObject
-  # apply the stylesheet to the subtree, returning the result through a document or a stream
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  #   VARIANT arg1 --- outputObject [IN]
-  def transformNodeToObject(arg0, arg1)
-    ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT getAttribute
-  # look up the string value of an attribute by name
-  #   BSTR arg0 --- name [IN]
-  def getAttribute(arg0)
-    ret = _invoke(99, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID setAttribute
-  # set the string value of an attribute by name
-  #   BSTR arg0 --- name [IN]
-  #   VARIANT arg1 --- value [IN]
-  def setAttribute(arg0, arg1)
-    ret = _invoke(100, [arg0, arg1], [VT_BSTR, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID removeAttribute
-  # remove an attribute by name
-  #   BSTR arg0 --- name [IN]
-  def removeAttribute(arg0)
-    ret = _invoke(101, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMAttribute getAttributeNode
-  # look up the attribute node by name
-  #   BSTR arg0 --- name [IN]
-  def getAttributeNode(arg0)
-    ret = _invoke(102, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMAttribute setAttributeNode
-  # set the specified attribute on the element
-  #   IXMLDOMAttribute arg0 --- DOMAttribute [IN]
-  def setAttributeNode(arg0)
-    ret = _invoke(103, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMAttribute removeAttributeNode
-  # remove the specified attribute
-  #   IXMLDOMAttribute arg0 --- DOMAttribute [IN]
-  def removeAttributeNode(arg0)
-    ret = _invoke(104, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList getElementsByTagName
-  # build a list of elements by name
-  #   BSTR arg0 --- tagName [IN]
-  def getElementsByTagName(arg0)
-    ret = _invoke(105, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID normalize
-  # collapse all adjacent text nodes in sub-tree
-  def normalize()
-    ret = _invoke(106, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# 
-module IXMLDOMAttribute
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # BSTR nodeName
-  # name of the node
-  def nodeName()
-    ret = _getproperty(2, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeValue
-  # value stored in the node
-  def nodeValue()
-    ret = _getproperty(3, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # DOMNodeType nodeType
-  # the node's type
-  def nodeType()
-    ret = _getproperty(4, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode parentNode
-  # parent of the node
-  def parentNode()
-    ret = _getproperty(6, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList childNodes
-  # the collection of the node's children
-  def childNodes()
-    ret = _getproperty(7, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode firstChild
-  # first child of the node
-  def firstChild()
-    ret = _getproperty(8, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode lastChild
-  # first child of the node
-  def lastChild()
-    ret = _getproperty(9, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode previousSibling
-  # left sibling of the node
-  def previousSibling()
-    ret = _getproperty(10, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nextSibling
-  # right sibling of the node
-  def nextSibling()
-    ret = _getproperty(11, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNamedNodeMap attributes
-  # the collection of the node's attributes
-  def attributes()
-    ret = _getproperty(12, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocument ownerDocument
-  # document that contains the node
-  def ownerDocument()
-    ret = _getproperty(18, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR nodeTypeString
-  # the type of node in string form
-  def nodeTypeString()
-    ret = _getproperty(21, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR text
-  # text content of the node and subtree
-  def text()
-    ret = _getproperty(24, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL specified
-  # indicates whether node is a default value
-  def specified()
-    ret = _getproperty(22, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode definition
-  # pointer to the definition of the node in the DTD or schema
-  def definition()
-    ret = _getproperty(23, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue()
-    ret = _getproperty(25, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT dataType
-  # the data type of the node
-  def dataType()
-    ret = _getproperty(26, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR xml
-  # return the XML source for the node and each of its descendants
-  def xml()
-    ret = _getproperty(27, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL parsed
-  # has sub-tree been completely parsed
-  def parsed()
-    ret = _getproperty(31, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR namespaceURI
-  # the URI for the namespace applying to the node
-  def namespaceURI()
-    ret = _getproperty(32, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR prefix
-  # the prefix for the namespace applying to the node
-  def prefix()
-    ret = _getproperty(33, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR baseName
-  # the base name of the node (nodename with the prefix stripped off)
-  def baseName()
-    ret = _getproperty(34, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR name
-  # get name of the attribute
-  def name()
-    ret = _getproperty(118, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT value
-  # string value of the attribute
-  def value()
-    ret = _getproperty(120, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeValue
-  # value stored in the node
-  def nodeValue=(arg0)
-    ret = _setproperty(3, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID text
-  # text content of the node and subtree
-  def text=(arg0)
-    ret = _setproperty(24, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue=(arg0)
-    ret = _setproperty(25, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID dataType
-  # the data type of the node
-  def dataType=(arg0)
-    ret = _setproperty(26, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID value
-  # string value of the attribute
-  def value=(arg0)
-    ret = _setproperty(120, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode insertBefore
-  # insert a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   VARIANT arg1 --- refChild [IN]
-  def insertBefore(arg0, arg1)
-    ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode replaceChild
-  # replace a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   IXMLDOMNode arg1 --- oldChild [IN]
-  def replaceChild(arg0, arg1)
-    ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode removeChild
-  # remove a child node
-  #   IXMLDOMNode arg0 --- childNode [IN]
-  def removeChild(arg0)
-    ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode appendChild
-  # append a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  def appendChild(arg0)
-    ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL hasChildNodes
-  def hasChildNodes()
-    ret = _invoke(17, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode cloneNode
-  #   BOOL arg0 --- deep [IN]
-  def cloneNode(arg0)
-    ret = _invoke(19, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR transformNode
-  # apply the stylesheet to the subtree
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  def transformNode(arg0)
-    ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList selectNodes
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectNodes(arg0)
-    ret = _invoke(29, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode selectSingleNode
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectSingleNode(arg0)
-    ret = _invoke(30, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID transformNodeToObject
-  # apply the stylesheet to the subtree, returning the result through a document or a stream
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  #   VARIANT arg1 --- outputObject [IN]
-  def transformNodeToObject(arg0, arg1)
-    ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# 
-module IXMLDOMDocumentFragment
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # BSTR nodeName
-  # name of the node
-  def nodeName()
-    ret = _getproperty(2, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeValue
-  # value stored in the node
-  def nodeValue()
-    ret = _getproperty(3, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # DOMNodeType nodeType
-  # the node's type
-  def nodeType()
-    ret = _getproperty(4, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode parentNode
-  # parent of the node
-  def parentNode()
-    ret = _getproperty(6, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList childNodes
-  # the collection of the node's children
-  def childNodes()
-    ret = _getproperty(7, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode firstChild
-  # first child of the node
-  def firstChild()
-    ret = _getproperty(8, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode lastChild
-  # first child of the node
-  def lastChild()
-    ret = _getproperty(9, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode previousSibling
-  # left sibling of the node
-  def previousSibling()
-    ret = _getproperty(10, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nextSibling
-  # right sibling of the node
-  def nextSibling()
-    ret = _getproperty(11, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNamedNodeMap attributes
-  # the collection of the node's attributes
-  def attributes()
-    ret = _getproperty(12, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocument ownerDocument
-  # document that contains the node
-  def ownerDocument()
-    ret = _getproperty(18, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR nodeTypeString
-  # the type of node in string form
-  def nodeTypeString()
-    ret = _getproperty(21, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR text
-  # text content of the node and subtree
-  def text()
-    ret = _getproperty(24, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL specified
-  # indicates whether node is a default value
-  def specified()
-    ret = _getproperty(22, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode definition
-  # pointer to the definition of the node in the DTD or schema
-  def definition()
-    ret = _getproperty(23, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue()
-    ret = _getproperty(25, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT dataType
-  # the data type of the node
-  def dataType()
-    ret = _getproperty(26, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR xml
-  # return the XML source for the node and each of its descendants
-  def xml()
-    ret = _getproperty(27, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL parsed
-  # has sub-tree been completely parsed
-  def parsed()
-    ret = _getproperty(31, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR namespaceURI
-  # the URI for the namespace applying to the node
-  def namespaceURI()
-    ret = _getproperty(32, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR prefix
-  # the prefix for the namespace applying to the node
-  def prefix()
-    ret = _getproperty(33, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR baseName
-  # the base name of the node (nodename with the prefix stripped off)
-  def baseName()
-    ret = _getproperty(34, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeValue
-  # value stored in the node
-  def nodeValue=(arg0)
-    ret = _setproperty(3, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID text
-  # text content of the node and subtree
-  def text=(arg0)
-    ret = _setproperty(24, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue=(arg0)
-    ret = _setproperty(25, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID dataType
-  # the data type of the node
-  def dataType=(arg0)
-    ret = _setproperty(26, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode insertBefore
-  # insert a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   VARIANT arg1 --- refChild [IN]
-  def insertBefore(arg0, arg1)
-    ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode replaceChild
-  # replace a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   IXMLDOMNode arg1 --- oldChild [IN]
-  def replaceChild(arg0, arg1)
-    ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode removeChild
-  # remove a child node
-  #   IXMLDOMNode arg0 --- childNode [IN]
-  def removeChild(arg0)
-    ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode appendChild
-  # append a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  def appendChild(arg0)
-    ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL hasChildNodes
-  def hasChildNodes()
-    ret = _invoke(17, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode cloneNode
-  #   BOOL arg0 --- deep [IN]
-  def cloneNode(arg0)
-    ret = _invoke(19, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR transformNode
-  # apply the stylesheet to the subtree
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  def transformNode(arg0)
-    ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList selectNodes
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectNodes(arg0)
-    ret = _invoke(29, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode selectSingleNode
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectSingleNode(arg0)
-    ret = _invoke(30, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID transformNodeToObject
-  # apply the stylesheet to the subtree, returning the result through a document or a stream
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  #   VARIANT arg1 --- outputObject [IN]
-  def transformNodeToObject(arg0, arg1)
-    ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# 
-module IXMLDOMText
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # BSTR nodeName
-  # name of the node
-  def nodeName()
-    ret = _getproperty(2, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeValue
-  # value stored in the node
-  def nodeValue()
-    ret = _getproperty(3, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # DOMNodeType nodeType
-  # the node's type
-  def nodeType()
-    ret = _getproperty(4, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode parentNode
-  # parent of the node
-  def parentNode()
-    ret = _getproperty(6, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList childNodes
-  # the collection of the node's children
-  def childNodes()
-    ret = _getproperty(7, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode firstChild
-  # first child of the node
-  def firstChild()
-    ret = _getproperty(8, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode lastChild
-  # first child of the node
-  def lastChild()
-    ret = _getproperty(9, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode previousSibling
-  # left sibling of the node
-  def previousSibling()
-    ret = _getproperty(10, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nextSibling
-  # right sibling of the node
-  def nextSibling()
-    ret = _getproperty(11, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNamedNodeMap attributes
-  # the collection of the node's attributes
-  def attributes()
-    ret = _getproperty(12, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocument ownerDocument
-  # document that contains the node
-  def ownerDocument()
-    ret = _getproperty(18, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR nodeTypeString
-  # the type of node in string form
-  def nodeTypeString()
-    ret = _getproperty(21, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR text
-  # text content of the node and subtree
-  def text()
-    ret = _getproperty(24, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL specified
-  # indicates whether node is a default value
-  def specified()
-    ret = _getproperty(22, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode definition
-  # pointer to the definition of the node in the DTD or schema
-  def definition()
-    ret = _getproperty(23, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue()
-    ret = _getproperty(25, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT dataType
-  # the data type of the node
-  def dataType()
-    ret = _getproperty(26, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR xml
-  # return the XML source for the node and each of its descendants
-  def xml()
-    ret = _getproperty(27, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL parsed
-  # has sub-tree been completely parsed
-  def parsed()
-    ret = _getproperty(31, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR namespaceURI
-  # the URI for the namespace applying to the node
-  def namespaceURI()
-    ret = _getproperty(32, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR prefix
-  # the prefix for the namespace applying to the node
-  def prefix()
-    ret = _getproperty(33, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR baseName
-  # the base name of the node (nodename with the prefix stripped off)
-  def baseName()
-    ret = _getproperty(34, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR data
-  # value of the node
-  def data()
-    ret = _getproperty(109, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # I4 length
-  # number of characters in value
-  def length()
-    ret = _getproperty(110, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeValue
-  # value stored in the node
-  def nodeValue=(arg0)
-    ret = _setproperty(3, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID text
-  # text content of the node and subtree
-  def text=(arg0)
-    ret = _setproperty(24, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue=(arg0)
-    ret = _setproperty(25, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID dataType
-  # the data type of the node
-  def dataType=(arg0)
-    ret = _setproperty(26, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID data
-  # value of the node
-  def data=(arg0)
-    ret = _setproperty(109, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode insertBefore
-  # insert a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   VARIANT arg1 --- refChild [IN]
-  def insertBefore(arg0, arg1)
-    ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode replaceChild
-  # replace a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   IXMLDOMNode arg1 --- oldChild [IN]
-  def replaceChild(arg0, arg1)
-    ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode removeChild
-  # remove a child node
-  #   IXMLDOMNode arg0 --- childNode [IN]
-  def removeChild(arg0)
-    ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode appendChild
-  # append a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  def appendChild(arg0)
-    ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL hasChildNodes
-  def hasChildNodes()
-    ret = _invoke(17, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode cloneNode
-  #   BOOL arg0 --- deep [IN]
-  def cloneNode(arg0)
-    ret = _invoke(19, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR transformNode
-  # apply the stylesheet to the subtree
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  def transformNode(arg0)
-    ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList selectNodes
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectNodes(arg0)
-    ret = _invoke(29, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode selectSingleNode
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectSingleNode(arg0)
-    ret = _invoke(30, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID transformNodeToObject
-  # apply the stylesheet to the subtree, returning the result through a document or a stream
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  #   VARIANT arg1 --- outputObject [IN]
-  def transformNodeToObject(arg0, arg1)
-    ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR substringData
-  # retrieve substring of value
-  #   I4 arg0 --- offset [IN]
-  #   I4 arg1 --- count [IN]
-  def substringData(arg0, arg1)
-    ret = _invoke(111, [arg0, arg1], [VT_I4, VT_I4])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID appendData
-  # append string to value
-  #   BSTR arg0 --- data [IN]
-  def appendData(arg0)
-    ret = _invoke(112, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID insertData
-  # insert string into value
-  #   I4 arg0 --- offset [IN]
-  #   BSTR arg1 --- data [IN]
-  def insertData(arg0, arg1)
-    ret = _invoke(113, [arg0, arg1], [VT_I4, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID deleteData
-  # delete string within the value
-  #   I4 arg0 --- offset [IN]
-  #   I4 arg1 --- count [IN]
-  def deleteData(arg0, arg1)
-    ret = _invoke(114, [arg0, arg1], [VT_I4, VT_I4])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID replaceData
-  # replace string within the value
-  #   I4 arg0 --- offset [IN]
-  #   I4 arg1 --- count [IN]
-  #   BSTR arg2 --- data [IN]
-  def replaceData(arg0, arg1, arg2)
-    ret = _invoke(115, [arg0, arg1, arg2], [VT_I4, VT_I4, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMText splitText
-  # split the text node into two text nodes at the position specified
-  #   I4 arg0 --- offset [IN]
-  def splitText(arg0)
-    ret = _invoke(123, [arg0], [VT_I4])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# 
-module IXMLDOMCharacterData
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # BSTR nodeName
-  # name of the node
-  def nodeName()
-    ret = _getproperty(2, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeValue
-  # value stored in the node
-  def nodeValue()
-    ret = _getproperty(3, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # DOMNodeType nodeType
-  # the node's type
-  def nodeType()
-    ret = _getproperty(4, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode parentNode
-  # parent of the node
-  def parentNode()
-    ret = _getproperty(6, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList childNodes
-  # the collection of the node's children
-  def childNodes()
-    ret = _getproperty(7, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode firstChild
-  # first child of the node
-  def firstChild()
-    ret = _getproperty(8, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode lastChild
-  # first child of the node
-  def lastChild()
-    ret = _getproperty(9, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode previousSibling
-  # left sibling of the node
-  def previousSibling()
-    ret = _getproperty(10, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nextSibling
-  # right sibling of the node
-  def nextSibling()
-    ret = _getproperty(11, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNamedNodeMap attributes
-  # the collection of the node's attributes
-  def attributes()
-    ret = _getproperty(12, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocument ownerDocument
-  # document that contains the node
-  def ownerDocument()
-    ret = _getproperty(18, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR nodeTypeString
-  # the type of node in string form
-  def nodeTypeString()
-    ret = _getproperty(21, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR text
-  # text content of the node and subtree
-  def text()
-    ret = _getproperty(24, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL specified
-  # indicates whether node is a default value
-  def specified()
-    ret = _getproperty(22, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode definition
-  # pointer to the definition of the node in the DTD or schema
-  def definition()
-    ret = _getproperty(23, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue()
-    ret = _getproperty(25, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT dataType
-  # the data type of the node
-  def dataType()
-    ret = _getproperty(26, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR xml
-  # return the XML source for the node and each of its descendants
-  def xml()
-    ret = _getproperty(27, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL parsed
-  # has sub-tree been completely parsed
-  def parsed()
-    ret = _getproperty(31, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR namespaceURI
-  # the URI for the namespace applying to the node
-  def namespaceURI()
-    ret = _getproperty(32, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR prefix
-  # the prefix for the namespace applying to the node
-  def prefix()
-    ret = _getproperty(33, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR baseName
-  # the base name of the node (nodename with the prefix stripped off)
-  def baseName()
-    ret = _getproperty(34, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR data
-  # value of the node
-  def data()
-    ret = _getproperty(109, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # I4 length
-  # number of characters in value
-  def length()
-    ret = _getproperty(110, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeValue
-  # value stored in the node
-  def nodeValue=(arg0)
-    ret = _setproperty(3, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID text
-  # text content of the node and subtree
-  def text=(arg0)
-    ret = _setproperty(24, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue=(arg0)
-    ret = _setproperty(25, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID dataType
-  # the data type of the node
-  def dataType=(arg0)
-    ret = _setproperty(26, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID data
-  # value of the node
-  def data=(arg0)
-    ret = _setproperty(109, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode insertBefore
-  # insert a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   VARIANT arg1 --- refChild [IN]
-  def insertBefore(arg0, arg1)
-    ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode replaceChild
-  # replace a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   IXMLDOMNode arg1 --- oldChild [IN]
-  def replaceChild(arg0, arg1)
-    ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode removeChild
-  # remove a child node
-  #   IXMLDOMNode arg0 --- childNode [IN]
-  def removeChild(arg0)
-    ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode appendChild
-  # append a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  def appendChild(arg0)
-    ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL hasChildNodes
-  def hasChildNodes()
-    ret = _invoke(17, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode cloneNode
-  #   BOOL arg0 --- deep [IN]
-  def cloneNode(arg0)
-    ret = _invoke(19, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR transformNode
-  # apply the stylesheet to the subtree
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  def transformNode(arg0)
-    ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList selectNodes
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectNodes(arg0)
-    ret = _invoke(29, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode selectSingleNode
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectSingleNode(arg0)
-    ret = _invoke(30, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID transformNodeToObject
-  # apply the stylesheet to the subtree, returning the result through a document or a stream
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  #   VARIANT arg1 --- outputObject [IN]
-  def transformNodeToObject(arg0, arg1)
-    ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR substringData
-  # retrieve substring of value
-  #   I4 arg0 --- offset [IN]
-  #   I4 arg1 --- count [IN]
-  def substringData(arg0, arg1)
-    ret = _invoke(111, [arg0, arg1], [VT_I4, VT_I4])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID appendData
-  # append string to value
-  #   BSTR arg0 --- data [IN]
-  def appendData(arg0)
-    ret = _invoke(112, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID insertData
-  # insert string into value
-  #   I4 arg0 --- offset [IN]
-  #   BSTR arg1 --- data [IN]
-  def insertData(arg0, arg1)
-    ret = _invoke(113, [arg0, arg1], [VT_I4, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID deleteData
-  # delete string within the value
-  #   I4 arg0 --- offset [IN]
-  #   I4 arg1 --- count [IN]
-  def deleteData(arg0, arg1)
-    ret = _invoke(114, [arg0, arg1], [VT_I4, VT_I4])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID replaceData
-  # replace string within the value
-  #   I4 arg0 --- offset [IN]
-  #   I4 arg1 --- count [IN]
-  #   BSTR arg2 --- data [IN]
-  def replaceData(arg0, arg1, arg2)
-    ret = _invoke(115, [arg0, arg1, arg2], [VT_I4, VT_I4, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# 
-module IXMLDOMComment
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # BSTR nodeName
-  # name of the node
-  def nodeName()
-    ret = _getproperty(2, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeValue
-  # value stored in the node
-  def nodeValue()
-    ret = _getproperty(3, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # DOMNodeType nodeType
-  # the node's type
-  def nodeType()
-    ret = _getproperty(4, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode parentNode
-  # parent of the node
-  def parentNode()
-    ret = _getproperty(6, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList childNodes
-  # the collection of the node's children
-  def childNodes()
-    ret = _getproperty(7, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode firstChild
-  # first child of the node
-  def firstChild()
-    ret = _getproperty(8, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode lastChild
-  # first child of the node
-  def lastChild()
-    ret = _getproperty(9, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode previousSibling
-  # left sibling of the node
-  def previousSibling()
-    ret = _getproperty(10, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nextSibling
-  # right sibling of the node
-  def nextSibling()
-    ret = _getproperty(11, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNamedNodeMap attributes
-  # the collection of the node's attributes
-  def attributes()
-    ret = _getproperty(12, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocument ownerDocument
-  # document that contains the node
-  def ownerDocument()
-    ret = _getproperty(18, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR nodeTypeString
-  # the type of node in string form
-  def nodeTypeString()
-    ret = _getproperty(21, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR text
-  # text content of the node and subtree
-  def text()
-    ret = _getproperty(24, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL specified
-  # indicates whether node is a default value
-  def specified()
-    ret = _getproperty(22, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode definition
-  # pointer to the definition of the node in the DTD or schema
-  def definition()
-    ret = _getproperty(23, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue()
-    ret = _getproperty(25, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT dataType
-  # the data type of the node
-  def dataType()
-    ret = _getproperty(26, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR xml
-  # return the XML source for the node and each of its descendants
-  def xml()
-    ret = _getproperty(27, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL parsed
-  # has sub-tree been completely parsed
-  def parsed()
-    ret = _getproperty(31, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR namespaceURI
-  # the URI for the namespace applying to the node
-  def namespaceURI()
-    ret = _getproperty(32, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR prefix
-  # the prefix for the namespace applying to the node
-  def prefix()
-    ret = _getproperty(33, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR baseName
-  # the base name of the node (nodename with the prefix stripped off)
-  def baseName()
-    ret = _getproperty(34, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR data
-  # value of the node
-  def data()
-    ret = _getproperty(109, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # I4 length
-  # number of characters in value
-  def length()
-    ret = _getproperty(110, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeValue
-  # value stored in the node
-  def nodeValue=(arg0)
-    ret = _setproperty(3, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID text
-  # text content of the node and subtree
-  def text=(arg0)
-    ret = _setproperty(24, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue=(arg0)
-    ret = _setproperty(25, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID dataType
-  # the data type of the node
-  def dataType=(arg0)
-    ret = _setproperty(26, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID data
-  # value of the node
-  def data=(arg0)
-    ret = _setproperty(109, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode insertBefore
-  # insert a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   VARIANT arg1 --- refChild [IN]
-  def insertBefore(arg0, arg1)
-    ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode replaceChild
-  # replace a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   IXMLDOMNode arg1 --- oldChild [IN]
-  def replaceChild(arg0, arg1)
-    ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode removeChild
-  # remove a child node
-  #   IXMLDOMNode arg0 --- childNode [IN]
-  def removeChild(arg0)
-    ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode appendChild
-  # append a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  def appendChild(arg0)
-    ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL hasChildNodes
-  def hasChildNodes()
-    ret = _invoke(17, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode cloneNode
-  #   BOOL arg0 --- deep [IN]
-  def cloneNode(arg0)
-    ret = _invoke(19, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR transformNode
-  # apply the stylesheet to the subtree
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  def transformNode(arg0)
-    ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList selectNodes
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectNodes(arg0)
-    ret = _invoke(29, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode selectSingleNode
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectSingleNode(arg0)
-    ret = _invoke(30, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID transformNodeToObject
-  # apply the stylesheet to the subtree, returning the result through a document or a stream
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  #   VARIANT arg1 --- outputObject [IN]
-  def transformNodeToObject(arg0, arg1)
-    ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR substringData
-  # retrieve substring of value
-  #   I4 arg0 --- offset [IN]
-  #   I4 arg1 --- count [IN]
-  def substringData(arg0, arg1)
-    ret = _invoke(111, [arg0, arg1], [VT_I4, VT_I4])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID appendData
-  # append string to value
-  #   BSTR arg0 --- data [IN]
-  def appendData(arg0)
-    ret = _invoke(112, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID insertData
-  # insert string into value
-  #   I4 arg0 --- offset [IN]
-  #   BSTR arg1 --- data [IN]
-  def insertData(arg0, arg1)
-    ret = _invoke(113, [arg0, arg1], [VT_I4, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID deleteData
-  # delete string within the value
-  #   I4 arg0 --- offset [IN]
-  #   I4 arg1 --- count [IN]
-  def deleteData(arg0, arg1)
-    ret = _invoke(114, [arg0, arg1], [VT_I4, VT_I4])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID replaceData
-  # replace string within the value
-  #   I4 arg0 --- offset [IN]
-  #   I4 arg1 --- count [IN]
-  #   BSTR arg2 --- data [IN]
-  def replaceData(arg0, arg1, arg2)
-    ret = _invoke(115, [arg0, arg1, arg2], [VT_I4, VT_I4, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# 
-module IXMLDOMCDATASection
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # BSTR nodeName
-  # name of the node
-  def nodeName()
-    ret = _getproperty(2, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeValue
-  # value stored in the node
-  def nodeValue()
-    ret = _getproperty(3, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # DOMNodeType nodeType
-  # the node's type
-  def nodeType()
-    ret = _getproperty(4, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode parentNode
-  # parent of the node
-  def parentNode()
-    ret = _getproperty(6, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList childNodes
-  # the collection of the node's children
-  def childNodes()
-    ret = _getproperty(7, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode firstChild
-  # first child of the node
-  def firstChild()
-    ret = _getproperty(8, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode lastChild
-  # first child of the node
-  def lastChild()
-    ret = _getproperty(9, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode previousSibling
-  # left sibling of the node
-  def previousSibling()
-    ret = _getproperty(10, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nextSibling
-  # right sibling of the node
-  def nextSibling()
-    ret = _getproperty(11, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNamedNodeMap attributes
-  # the collection of the node's attributes
-  def attributes()
-    ret = _getproperty(12, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocument ownerDocument
-  # document that contains the node
-  def ownerDocument()
-    ret = _getproperty(18, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR nodeTypeString
-  # the type of node in string form
-  def nodeTypeString()
-    ret = _getproperty(21, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR text
-  # text content of the node and subtree
-  def text()
-    ret = _getproperty(24, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL specified
-  # indicates whether node is a default value
-  def specified()
-    ret = _getproperty(22, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode definition
-  # pointer to the definition of the node in the DTD or schema
-  def definition()
-    ret = _getproperty(23, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue()
-    ret = _getproperty(25, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT dataType
-  # the data type of the node
-  def dataType()
-    ret = _getproperty(26, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR xml
-  # return the XML source for the node and each of its descendants
-  def xml()
-    ret = _getproperty(27, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL parsed
-  # has sub-tree been completely parsed
-  def parsed()
-    ret = _getproperty(31, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR namespaceURI
-  # the URI for the namespace applying to the node
-  def namespaceURI()
-    ret = _getproperty(32, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR prefix
-  # the prefix for the namespace applying to the node
-  def prefix()
-    ret = _getproperty(33, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR baseName
-  # the base name of the node (nodename with the prefix stripped off)
-  def baseName()
-    ret = _getproperty(34, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR data
-  # value of the node
-  def data()
-    ret = _getproperty(109, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # I4 length
-  # number of characters in value
-  def length()
-    ret = _getproperty(110, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeValue
-  # value stored in the node
-  def nodeValue=(arg0)
-    ret = _setproperty(3, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID text
-  # text content of the node and subtree
-  def text=(arg0)
-    ret = _setproperty(24, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue=(arg0)
-    ret = _setproperty(25, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID dataType
-  # the data type of the node
-  def dataType=(arg0)
-    ret = _setproperty(26, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID data
-  # value of the node
-  def data=(arg0)
-    ret = _setproperty(109, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode insertBefore
-  # insert a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   VARIANT arg1 --- refChild [IN]
-  def insertBefore(arg0, arg1)
-    ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode replaceChild
-  # replace a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   IXMLDOMNode arg1 --- oldChild [IN]
-  def replaceChild(arg0, arg1)
-    ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode removeChild
-  # remove a child node
-  #   IXMLDOMNode arg0 --- childNode [IN]
-  def removeChild(arg0)
-    ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode appendChild
-  # append a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  def appendChild(arg0)
-    ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL hasChildNodes
-  def hasChildNodes()
-    ret = _invoke(17, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode cloneNode
-  #   BOOL arg0 --- deep [IN]
-  def cloneNode(arg0)
-    ret = _invoke(19, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR transformNode
-  # apply the stylesheet to the subtree
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  def transformNode(arg0)
-    ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList selectNodes
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectNodes(arg0)
-    ret = _invoke(29, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode selectSingleNode
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectSingleNode(arg0)
-    ret = _invoke(30, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID transformNodeToObject
-  # apply the stylesheet to the subtree, returning the result through a document or a stream
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  #   VARIANT arg1 --- outputObject [IN]
-  def transformNodeToObject(arg0, arg1)
-    ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR substringData
-  # retrieve substring of value
-  #   I4 arg0 --- offset [IN]
-  #   I4 arg1 --- count [IN]
-  def substringData(arg0, arg1)
-    ret = _invoke(111, [arg0, arg1], [VT_I4, VT_I4])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID appendData
-  # append string to value
-  #   BSTR arg0 --- data [IN]
-  def appendData(arg0)
-    ret = _invoke(112, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID insertData
-  # insert string into value
-  #   I4 arg0 --- offset [IN]
-  #   BSTR arg1 --- data [IN]
-  def insertData(arg0, arg1)
-    ret = _invoke(113, [arg0, arg1], [VT_I4, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID deleteData
-  # delete string within the value
-  #   I4 arg0 --- offset [IN]
-  #   I4 arg1 --- count [IN]
-  def deleteData(arg0, arg1)
-    ret = _invoke(114, [arg0, arg1], [VT_I4, VT_I4])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID replaceData
-  # replace string within the value
-  #   I4 arg0 --- offset [IN]
-  #   I4 arg1 --- count [IN]
-  #   BSTR arg2 --- data [IN]
-  def replaceData(arg0, arg1, arg2)
-    ret = _invoke(115, [arg0, arg1, arg2], [VT_I4, VT_I4, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMText splitText
-  # split the text node into two text nodes at the position specified
-  #   I4 arg0 --- offset [IN]
-  def splitText(arg0)
-    ret = _invoke(123, [arg0], [VT_I4])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# 
-module IXMLDOMProcessingInstruction
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # BSTR nodeName
-  # name of the node
-  def nodeName()
-    ret = _getproperty(2, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeValue
-  # value stored in the node
-  def nodeValue()
-    ret = _getproperty(3, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # DOMNodeType nodeType
-  # the node's type
-  def nodeType()
-    ret = _getproperty(4, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode parentNode
-  # parent of the node
-  def parentNode()
-    ret = _getproperty(6, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList childNodes
-  # the collection of the node's children
-  def childNodes()
-    ret = _getproperty(7, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode firstChild
-  # first child of the node
-  def firstChild()
-    ret = _getproperty(8, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode lastChild
-  # first child of the node
-  def lastChild()
-    ret = _getproperty(9, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode previousSibling
-  # left sibling of the node
-  def previousSibling()
-    ret = _getproperty(10, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nextSibling
-  # right sibling of the node
-  def nextSibling()
-    ret = _getproperty(11, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNamedNodeMap attributes
-  # the collection of the node's attributes
-  def attributes()
-    ret = _getproperty(12, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocument ownerDocument
-  # document that contains the node
-  def ownerDocument()
-    ret = _getproperty(18, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR nodeTypeString
-  # the type of node in string form
-  def nodeTypeString()
-    ret = _getproperty(21, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR text
-  # text content of the node and subtree
-  def text()
-    ret = _getproperty(24, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL specified
-  # indicates whether node is a default value
-  def specified()
-    ret = _getproperty(22, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode definition
-  # pointer to the definition of the node in the DTD or schema
-  def definition()
-    ret = _getproperty(23, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue()
-    ret = _getproperty(25, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT dataType
-  # the data type of the node
-  def dataType()
-    ret = _getproperty(26, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR xml
-  # return the XML source for the node and each of its descendants
-  def xml()
-    ret = _getproperty(27, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL parsed
-  # has sub-tree been completely parsed
-  def parsed()
-    ret = _getproperty(31, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR namespaceURI
-  # the URI for the namespace applying to the node
-  def namespaceURI()
-    ret = _getproperty(32, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR prefix
-  # the prefix for the namespace applying to the node
-  def prefix()
-    ret = _getproperty(33, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR baseName
-  # the base name of the node (nodename with the prefix stripped off)
-  def baseName()
-    ret = _getproperty(34, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR target
-  # the target
-  def target()
-    ret = _getproperty(127, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR data
-  # the data
-  def data()
-    ret = _getproperty(128, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeValue
-  # value stored in the node
-  def nodeValue=(arg0)
-    ret = _setproperty(3, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID text
-  # text content of the node and subtree
-  def text=(arg0)
-    ret = _setproperty(24, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue=(arg0)
-    ret = _setproperty(25, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID dataType
-  # the data type of the node
-  def dataType=(arg0)
-    ret = _setproperty(26, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID data
-  # the data
-  def data=(arg0)
-    ret = _setproperty(128, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode insertBefore
-  # insert a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   VARIANT arg1 --- refChild [IN]
-  def insertBefore(arg0, arg1)
-    ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode replaceChild
-  # replace a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   IXMLDOMNode arg1 --- oldChild [IN]
-  def replaceChild(arg0, arg1)
-    ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode removeChild
-  # remove a child node
-  #   IXMLDOMNode arg0 --- childNode [IN]
-  def removeChild(arg0)
-    ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode appendChild
-  # append a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  def appendChild(arg0)
-    ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL hasChildNodes
-  def hasChildNodes()
-    ret = _invoke(17, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode cloneNode
-  #   BOOL arg0 --- deep [IN]
-  def cloneNode(arg0)
-    ret = _invoke(19, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR transformNode
-  # apply the stylesheet to the subtree
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  def transformNode(arg0)
-    ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList selectNodes
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectNodes(arg0)
-    ret = _invoke(29, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode selectSingleNode
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectSingleNode(arg0)
-    ret = _invoke(30, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID transformNodeToObject
-  # apply the stylesheet to the subtree, returning the result through a document or a stream
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  #   VARIANT arg1 --- outputObject [IN]
-  def transformNodeToObject(arg0, arg1)
-    ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# 
-module IXMLDOMEntityReference
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # BSTR nodeName
-  # name of the node
-  def nodeName()
-    ret = _getproperty(2, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeValue
-  # value stored in the node
-  def nodeValue()
-    ret = _getproperty(3, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # DOMNodeType nodeType
-  # the node's type
-  def nodeType()
-    ret = _getproperty(4, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode parentNode
-  # parent of the node
-  def parentNode()
-    ret = _getproperty(6, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList childNodes
-  # the collection of the node's children
-  def childNodes()
-    ret = _getproperty(7, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode firstChild
-  # first child of the node
-  def firstChild()
-    ret = _getproperty(8, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode lastChild
-  # first child of the node
-  def lastChild()
-    ret = _getproperty(9, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode previousSibling
-  # left sibling of the node
-  def previousSibling()
-    ret = _getproperty(10, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nextSibling
-  # right sibling of the node
-  def nextSibling()
-    ret = _getproperty(11, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNamedNodeMap attributes
-  # the collection of the node's attributes
-  def attributes()
-    ret = _getproperty(12, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocument ownerDocument
-  # document that contains the node
-  def ownerDocument()
-    ret = _getproperty(18, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR nodeTypeString
-  # the type of node in string form
-  def nodeTypeString()
-    ret = _getproperty(21, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR text
-  # text content of the node and subtree
-  def text()
-    ret = _getproperty(24, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL specified
-  # indicates whether node is a default value
-  def specified()
-    ret = _getproperty(22, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode definition
-  # pointer to the definition of the node in the DTD or schema
-  def definition()
-    ret = _getproperty(23, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue()
-    ret = _getproperty(25, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT dataType
-  # the data type of the node
-  def dataType()
-    ret = _getproperty(26, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR xml
-  # return the XML source for the node and each of its descendants
-  def xml()
-    ret = _getproperty(27, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL parsed
-  # has sub-tree been completely parsed
-  def parsed()
-    ret = _getproperty(31, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR namespaceURI
-  # the URI for the namespace applying to the node
-  def namespaceURI()
-    ret = _getproperty(32, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR prefix
-  # the prefix for the namespace applying to the node
-  def prefix()
-    ret = _getproperty(33, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR baseName
-  # the base name of the node (nodename with the prefix stripped off)
-  def baseName()
-    ret = _getproperty(34, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeValue
-  # value stored in the node
-  def nodeValue=(arg0)
-    ret = _setproperty(3, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID text
-  # text content of the node and subtree
-  def text=(arg0)
-    ret = _setproperty(24, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue=(arg0)
-    ret = _setproperty(25, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID dataType
-  # the data type of the node
-  def dataType=(arg0)
-    ret = _setproperty(26, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode insertBefore
-  # insert a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   VARIANT arg1 --- refChild [IN]
-  def insertBefore(arg0, arg1)
-    ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode replaceChild
-  # replace a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   IXMLDOMNode arg1 --- oldChild [IN]
-  def replaceChild(arg0, arg1)
-    ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode removeChild
-  # remove a child node
-  #   IXMLDOMNode arg0 --- childNode [IN]
-  def removeChild(arg0)
-    ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode appendChild
-  # append a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  def appendChild(arg0)
-    ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL hasChildNodes
-  def hasChildNodes()
-    ret = _invoke(17, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode cloneNode
-  #   BOOL arg0 --- deep [IN]
-  def cloneNode(arg0)
-    ret = _invoke(19, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR transformNode
-  # apply the stylesheet to the subtree
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  def transformNode(arg0)
-    ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList selectNodes
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectNodes(arg0)
-    ret = _invoke(29, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode selectSingleNode
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectSingleNode(arg0)
-    ret = _invoke(30, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID transformNodeToObject
-  # apply the stylesheet to the subtree, returning the result through a document or a stream
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  #   VARIANT arg1 --- outputObject [IN]
-  def transformNodeToObject(arg0, arg1)
-    ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# structure for reporting parser errors
-module IXMLDOMParseError
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # I4 errorCode
-  # the error code
-  def errorCode()
-    ret = _getproperty(0, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR url
-  # the URL of the XML document containing the error
-  def url()
-    ret = _getproperty(179, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR reason
-  # the cause of the error
-  def reason()
-    ret = _getproperty(180, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR srcText
-  # the data where the error occurred
-  def srcText()
-    ret = _getproperty(181, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # I4 line
-  # the line number in the XML document where the error occurred
-  def line()
-    ret = _getproperty(182, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # I4 linepos
-  # the character position in the line containing the error
-  def linepos()
-    ret = _getproperty(183, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # I4 filepos
-  # the absolute file position in the XML document containing the error
-  def filepos()
-    ret = _getproperty(184, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# 
-module IXMLDOMNotation
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # BSTR nodeName
-  # name of the node
-  def nodeName()
-    ret = _getproperty(2, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeValue
-  # value stored in the node
-  def nodeValue()
-    ret = _getproperty(3, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # DOMNodeType nodeType
-  # the node's type
-  def nodeType()
-    ret = _getproperty(4, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode parentNode
-  # parent of the node
-  def parentNode()
-    ret = _getproperty(6, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList childNodes
-  # the collection of the node's children
-  def childNodes()
-    ret = _getproperty(7, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode firstChild
-  # first child of the node
-  def firstChild()
-    ret = _getproperty(8, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode lastChild
-  # first child of the node
-  def lastChild()
-    ret = _getproperty(9, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode previousSibling
-  # left sibling of the node
-  def previousSibling()
-    ret = _getproperty(10, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nextSibling
-  # right sibling of the node
-  def nextSibling()
-    ret = _getproperty(11, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNamedNodeMap attributes
-  # the collection of the node's attributes
-  def attributes()
-    ret = _getproperty(12, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocument ownerDocument
-  # document that contains the node
-  def ownerDocument()
-    ret = _getproperty(18, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR nodeTypeString
-  # the type of node in string form
-  def nodeTypeString()
-    ret = _getproperty(21, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR text
-  # text content of the node and subtree
-  def text()
-    ret = _getproperty(24, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL specified
-  # indicates whether node is a default value
-  def specified()
-    ret = _getproperty(22, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode definition
-  # pointer to the definition of the node in the DTD or schema
-  def definition()
-    ret = _getproperty(23, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue()
-    ret = _getproperty(25, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT dataType
-  # the data type of the node
-  def dataType()
-    ret = _getproperty(26, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR xml
-  # return the XML source for the node and each of its descendants
-  def xml()
-    ret = _getproperty(27, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL parsed
-  # has sub-tree been completely parsed
-  def parsed()
-    ret = _getproperty(31, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR namespaceURI
-  # the URI for the namespace applying to the node
-  def namespaceURI()
-    ret = _getproperty(32, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR prefix
-  # the prefix for the namespace applying to the node
-  def prefix()
-    ret = _getproperty(33, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR baseName
-  # the base name of the node (nodename with the prefix stripped off)
-  def baseName()
-    ret = _getproperty(34, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT publicId
-  # the public ID
-  def publicId()
-    ret = _getproperty(136, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT systemId
-  # the system ID
-  def systemId()
-    ret = _getproperty(137, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeValue
-  # value stored in the node
-  def nodeValue=(arg0)
-    ret = _setproperty(3, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID text
-  # text content of the node and subtree
-  def text=(arg0)
-    ret = _setproperty(24, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue=(arg0)
-    ret = _setproperty(25, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID dataType
-  # the data type of the node
-  def dataType=(arg0)
-    ret = _setproperty(26, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode insertBefore
-  # insert a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   VARIANT arg1 --- refChild [IN]
-  def insertBefore(arg0, arg1)
-    ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode replaceChild
-  # replace a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   IXMLDOMNode arg1 --- oldChild [IN]
-  def replaceChild(arg0, arg1)
-    ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode removeChild
-  # remove a child node
-  #   IXMLDOMNode arg0 --- childNode [IN]
-  def removeChild(arg0)
-    ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode appendChild
-  # append a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  def appendChild(arg0)
-    ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL hasChildNodes
-  def hasChildNodes()
-    ret = _invoke(17, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode cloneNode
-  #   BOOL arg0 --- deep [IN]
-  def cloneNode(arg0)
-    ret = _invoke(19, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR transformNode
-  # apply the stylesheet to the subtree
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  def transformNode(arg0)
-    ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList selectNodes
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectNodes(arg0)
-    ret = _invoke(29, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode selectSingleNode
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectSingleNode(arg0)
-    ret = _invoke(30, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID transformNodeToObject
-  # apply the stylesheet to the subtree, returning the result through a document or a stream
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  #   VARIANT arg1 --- outputObject [IN]
-  def transformNodeToObject(arg0, arg1)
-    ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# 
-module IXMLDOMEntity
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # BSTR nodeName
-  # name of the node
-  def nodeName()
-    ret = _getproperty(2, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeValue
-  # value stored in the node
-  def nodeValue()
-    ret = _getproperty(3, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # DOMNodeType nodeType
-  # the node's type
-  def nodeType()
-    ret = _getproperty(4, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode parentNode
-  # parent of the node
-  def parentNode()
-    ret = _getproperty(6, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList childNodes
-  # the collection of the node's children
-  def childNodes()
-    ret = _getproperty(7, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode firstChild
-  # first child of the node
-  def firstChild()
-    ret = _getproperty(8, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode lastChild
-  # first child of the node
-  def lastChild()
-    ret = _getproperty(9, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode previousSibling
-  # left sibling of the node
-  def previousSibling()
-    ret = _getproperty(10, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nextSibling
-  # right sibling of the node
-  def nextSibling()
-    ret = _getproperty(11, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNamedNodeMap attributes
-  # the collection of the node's attributes
-  def attributes()
-    ret = _getproperty(12, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocument ownerDocument
-  # document that contains the node
-  def ownerDocument()
-    ret = _getproperty(18, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR nodeTypeString
-  # the type of node in string form
-  def nodeTypeString()
-    ret = _getproperty(21, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR text
-  # text content of the node and subtree
-  def text()
-    ret = _getproperty(24, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL specified
-  # indicates whether node is a default value
-  def specified()
-    ret = _getproperty(22, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode definition
-  # pointer to the definition of the node in the DTD or schema
-  def definition()
-    ret = _getproperty(23, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue()
-    ret = _getproperty(25, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT dataType
-  # the data type of the node
-  def dataType()
-    ret = _getproperty(26, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR xml
-  # return the XML source for the node and each of its descendants
-  def xml()
-    ret = _getproperty(27, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL parsed
-  # has sub-tree been completely parsed
-  def parsed()
-    ret = _getproperty(31, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR namespaceURI
-  # the URI for the namespace applying to the node
-  def namespaceURI()
-    ret = _getproperty(32, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR prefix
-  # the prefix for the namespace applying to the node
-  def prefix()
-    ret = _getproperty(33, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR baseName
-  # the base name of the node (nodename with the prefix stripped off)
-  def baseName()
-    ret = _getproperty(34, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT publicId
-  # the public ID
-  def publicId()
-    ret = _getproperty(140, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT systemId
-  # the system ID
-  def systemId()
-    ret = _getproperty(141, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR notationName
-  # the name of the notation
-  def notationName()
-    ret = _getproperty(142, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeValue
-  # value stored in the node
-  def nodeValue=(arg0)
-    ret = _setproperty(3, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID text
-  # text content of the node and subtree
-  def text=(arg0)
-    ret = _setproperty(24, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue=(arg0)
-    ret = _setproperty(25, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID dataType
-  # the data type of the node
-  def dataType=(arg0)
-    ret = _setproperty(26, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode insertBefore
-  # insert a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   VARIANT arg1 --- refChild [IN]
-  def insertBefore(arg0, arg1)
-    ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode replaceChild
-  # replace a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   IXMLDOMNode arg1 --- oldChild [IN]
-  def replaceChild(arg0, arg1)
-    ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode removeChild
-  # remove a child node
-  #   IXMLDOMNode arg0 --- childNode [IN]
-  def removeChild(arg0)
-    ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode appendChild
-  # append a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  def appendChild(arg0)
-    ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL hasChildNodes
-  def hasChildNodes()
-    ret = _invoke(17, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode cloneNode
-  #   BOOL arg0 --- deep [IN]
-  def cloneNode(arg0)
-    ret = _invoke(19, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR transformNode
-  # apply the stylesheet to the subtree
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  def transformNode(arg0)
-    ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList selectNodes
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectNodes(arg0)
-    ret = _invoke(29, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode selectSingleNode
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectSingleNode(arg0)
-    ret = _invoke(30, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID transformNodeToObject
-  # apply the stylesheet to the subtree, returning the result through a document or a stream
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  #   VARIANT arg1 --- outputObject [IN]
-  def transformNodeToObject(arg0, arg1)
-    ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# XTL runtime object
-module IXTLRuntime
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # BSTR nodeName
-  # name of the node
-  def nodeName()
-    ret = _getproperty(2, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeValue
-  # value stored in the node
-  def nodeValue()
-    ret = _getproperty(3, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # DOMNodeType nodeType
-  # the node's type
-  def nodeType()
-    ret = _getproperty(4, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode parentNode
-  # parent of the node
-  def parentNode()
-    ret = _getproperty(6, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList childNodes
-  # the collection of the node's children
-  def childNodes()
-    ret = _getproperty(7, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode firstChild
-  # first child of the node
-  def firstChild()
-    ret = _getproperty(8, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode lastChild
-  # first child of the node
-  def lastChild()
-    ret = _getproperty(9, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode previousSibling
-  # left sibling of the node
-  def previousSibling()
-    ret = _getproperty(10, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nextSibling
-  # right sibling of the node
-  def nextSibling()
-    ret = _getproperty(11, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNamedNodeMap attributes
-  # the collection of the node's attributes
-  def attributes()
-    ret = _getproperty(12, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocument ownerDocument
-  # document that contains the node
-  def ownerDocument()
-    ret = _getproperty(18, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR nodeTypeString
-  # the type of node in string form
-  def nodeTypeString()
-    ret = _getproperty(21, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR text
-  # text content of the node and subtree
-  def text()
-    ret = _getproperty(24, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL specified
-  # indicates whether node is a default value
-  def specified()
-    ret = _getproperty(22, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode definition
-  # pointer to the definition of the node in the DTD or schema
-  def definition()
-    ret = _getproperty(23, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue()
-    ret = _getproperty(25, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT dataType
-  # the data type of the node
-  def dataType()
-    ret = _getproperty(26, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR xml
-  # return the XML source for the node and each of its descendants
-  def xml()
-    ret = _getproperty(27, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL parsed
-  # has sub-tree been completely parsed
-  def parsed()
-    ret = _getproperty(31, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR namespaceURI
-  # the URI for the namespace applying to the node
-  def namespaceURI()
-    ret = _getproperty(32, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR prefix
-  # the prefix for the namespace applying to the node
-  def prefix()
-    ret = _getproperty(33, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR baseName
-  # the base name of the node (nodename with the prefix stripped off)
-  def baseName()
-    ret = _getproperty(34, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeValue
-  # value stored in the node
-  def nodeValue=(arg0)
-    ret = _setproperty(3, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID text
-  # text content of the node and subtree
-  def text=(arg0)
-    ret = _setproperty(24, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue=(arg0)
-    ret = _setproperty(25, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID dataType
-  # the data type of the node
-  def dataType=(arg0)
-    ret = _setproperty(26, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode insertBefore
-  # insert a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   VARIANT arg1 --- refChild [IN]
-  def insertBefore(arg0, arg1)
-    ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode replaceChild
-  # replace a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   IXMLDOMNode arg1 --- oldChild [IN]
-  def replaceChild(arg0, arg1)
-    ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode removeChild
-  # remove a child node
-  #   IXMLDOMNode arg0 --- childNode [IN]
-  def removeChild(arg0)
-    ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode appendChild
-  # append a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  def appendChild(arg0)
-    ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL hasChildNodes
-  def hasChildNodes()
-    ret = _invoke(17, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode cloneNode
-  #   BOOL arg0 --- deep [IN]
-  def cloneNode(arg0)
-    ret = _invoke(19, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR transformNode
-  # apply the stylesheet to the subtree
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  def transformNode(arg0)
-    ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList selectNodes
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectNodes(arg0)
-    ret = _invoke(29, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode selectSingleNode
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectSingleNode(arg0)
-    ret = _invoke(30, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID transformNodeToObject
-  # apply the stylesheet to the subtree, returning the result through a document or a stream
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  #   VARIANT arg1 --- outputObject [IN]
-  def transformNodeToObject(arg0, arg1)
-    ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # I4 uniqueID
-  #   IXMLDOMNode arg0 --- pNode [IN]
-  def uniqueID(arg0)
-    ret = _invoke(187, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # I4 depth
-  #   IXMLDOMNode arg0 --- pNode [IN]
-  def depth(arg0)
-    ret = _invoke(188, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # I4 childNumber
-  #   IXMLDOMNode arg0 --- pNode [IN]
-  def childNumber(arg0)
-    ret = _invoke(189, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # I4 ancestorChildNumber
-  #   BSTR arg0 --- bstrNodeName [IN]
-  #   IXMLDOMNode arg1 --- pNode [IN]
-  def ancestorChildNumber(arg0, arg1)
-    ret = _invoke(190, [arg0, arg1], [VT_BSTR, VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # I4 absoluteChildNumber
-  #   IXMLDOMNode arg0 --- pNode [IN]
-  def absoluteChildNumber(arg0)
-    ret = _invoke(191, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR formatIndex
-  #   I4 arg0 --- lIndex [IN]
-  #   BSTR arg1 --- bstrFormat [IN]
-  def formatIndex(arg0, arg1)
-    ret = _invoke(192, [arg0, arg1], [VT_I4, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR formatNumber
-  #   R8 arg0 --- dblNumber [IN]
-  #   BSTR arg1 --- bstrFormat [IN]
-  def formatNumber(arg0, arg1)
-    ret = _invoke(193, [arg0, arg1], [VT_R8, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR formatDate
-  #   VARIANT arg0 --- varDate [IN]
-  #   BSTR arg1 --- bstrFormat [IN]
-  #   VARIANT arg2 --- varDestLocale [IN]
-  def formatDate(arg0, arg1, arg2=nil)
-    ret = _invoke(194, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR formatTime
-  #   VARIANT arg0 --- varTime [IN]
-  #   BSTR arg1 --- bstrFormat [IN]
-  #   VARIANT arg2 --- varDestLocale [IN]
-  def formatTime(arg0, arg1, arg2=nil)
-    ret = _invoke(195, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# W3C-DOM XML Document
-class Microsoft_XMLDOM_1_0 # DOMDocument
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-  attr_reader :dispatch
-  attr_reader :clsid
-  attr_reader :progid
-
-  def initialize(obj = nil)
-    @clsid = "{2933BF90-7B36-11D2-B20E-00C04F983E60}"
-    @progid = "Microsoft.XMLDOM.1.0"
-    if obj.nil?
-      @dispatch = WIN32OLE.new @progid
-    else
-      @dispatch = obj
-    end
-  end
-
-  def method_missing(cmd, *arg)
-    @dispatch.method_missing(cmd, *arg)
-  end
-
-  # BSTR nodeName
-  # name of the node
-  def nodeName()
-    ret = @dispatch._getproperty(2, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeValue
-  # value stored in the node
-  def nodeValue()
-    ret = @dispatch._getproperty(3, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # DOMNodeType nodeType
-  # the node's type
-  def nodeType()
-    ret = @dispatch._getproperty(4, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode parentNode
-  # parent of the node
-  def parentNode()
-    ret = @dispatch._getproperty(6, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList childNodes
-  # the collection of the node's children
-  def childNodes()
-    ret = @dispatch._getproperty(7, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode firstChild
-  # first child of the node
-  def firstChild()
-    ret = @dispatch._getproperty(8, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode lastChild
-  # first child of the node
-  def lastChild()
-    ret = @dispatch._getproperty(9, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode previousSibling
-  # left sibling of the node
-  def previousSibling()
-    ret = @dispatch._getproperty(10, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nextSibling
-  # right sibling of the node
-  def nextSibling()
-    ret = @dispatch._getproperty(11, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNamedNodeMap attributes
-  # the collection of the node's attributes
-  def attributes()
-    ret = @dispatch._getproperty(12, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocument ownerDocument
-  # document that contains the node
-  def ownerDocument()
-    ret = @dispatch._getproperty(18, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR nodeTypeString
-  # the type of node in string form
-  def nodeTypeString()
-    ret = @dispatch._getproperty(21, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR text
-  # text content of the node and subtree
-  def text()
-    ret = @dispatch._getproperty(24, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL specified
-  # indicates whether node is a default value
-  def specified()
-    ret = @dispatch._getproperty(22, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode definition
-  # pointer to the definition of the node in the DTD or schema
-  def definition()
-    ret = @dispatch._getproperty(23, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue()
-    ret = @dispatch._getproperty(25, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT dataType
-  # the data type of the node
-  def dataType()
-    ret = @dispatch._getproperty(26, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR xml
-  # return the XML source for the node and each of its descendants
-  def xml()
-    ret = @dispatch._getproperty(27, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL parsed
-  # has sub-tree been completely parsed
-  def parsed()
-    ret = @dispatch._getproperty(31, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR namespaceURI
-  # the URI for the namespace applying to the node
-  def namespaceURI()
-    ret = @dispatch._getproperty(32, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR prefix
-  # the prefix for the namespace applying to the node
-  def prefix()
-    ret = @dispatch._getproperty(33, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR baseName
-  # the base name of the node (nodename with the prefix stripped off)
-  def baseName()
-    ret = @dispatch._getproperty(34, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocumentType doctype
-  # node corresponding to the DOCTYPE
-  def doctype()
-    ret = @dispatch._getproperty(38, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMImplementation implementation
-  # info on this DOM implementation
-  def implementation()
-    ret = @dispatch._getproperty(39, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMElement documentElement
-  # the root of the tree
-  def documentElement()
-    ret = @dispatch._getproperty(40, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # I4 readyState
-  # get the state of the XML document
-  def readyState()
-    ret = @dispatch._getproperty(-525, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMParseError parseError
-  # get the last parser error
-  def parseError()
-    ret = @dispatch._getproperty(59, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR url
-  # get the URL for the loaded XML document
-  def url()
-    ret = @dispatch._getproperty(60, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL async
-  # flag for asynchronous download
-  def async()
-    ret = @dispatch._getproperty(61, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL validateOnParse
-  # indicates whether the parser performs validation
-  def validateOnParse()
-    ret = @dispatch._getproperty(65, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL resolveExternals
-  # indicates whether the parser resolves references to external DTD/Entities/Schema
-  def resolveExternals()
-    ret = @dispatch._getproperty(66, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL preserveWhiteSpace
-  # indicates whether the parser preserves whitespace
-  def preserveWhiteSpace()
-    ret = @dispatch._getproperty(67, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeValue
-  # value stored in the node
-  def nodeValue=(arg0)
-    ret = @dispatch._setproperty(3, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID text
-  # text content of the node and subtree
-  def text=(arg0)
-    ret = @dispatch._setproperty(24, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue=(arg0)
-    ret = @dispatch._setproperty(25, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID dataType
-  # the data type of the node
-  def dataType=(arg0)
-    ret = @dispatch._setproperty(26, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID async
-  # flag for asynchronous download
-  def async=(arg0)
-    ret = @dispatch._setproperty(61, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID validateOnParse
-  # indicates whether the parser performs validation
-  def validateOnParse=(arg0)
-    ret = @dispatch._setproperty(65, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID resolveExternals
-  # indicates whether the parser resolves references to external DTD/Entities/Schema
-  def resolveExternals=(arg0)
-    ret = @dispatch._setproperty(66, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID preserveWhiteSpace
-  # indicates whether the parser preserves whitespace
-  def preserveWhiteSpace=(arg0)
-    ret = @dispatch._setproperty(67, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID onreadystatechange
-  # register a readystatechange event handler
-  def onreadystatechange=(arg0)
-    ret = @dispatch._setproperty(68, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID ondataavailable
-  # register an ondataavailable event handler
-  def ondataavailable=(arg0)
-    ret = @dispatch._setproperty(69, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID ontransformnode
-  # register an ontransformnode event handler
-  def ontransformnode=(arg0)
-    ret = @dispatch._setproperty(70, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode insertBefore
-  # insert a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   VARIANT arg1 --- refChild [IN]
-  def insertBefore(arg0, arg1)
-    ret = @dispatch._invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode replaceChild
-  # replace a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   IXMLDOMNode arg1 --- oldChild [IN]
-  def replaceChild(arg0, arg1)
-    ret = @dispatch._invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode removeChild
-  # remove a child node
-  #   IXMLDOMNode arg0 --- childNode [IN]
-  def removeChild(arg0)
-    ret = @dispatch._invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode appendChild
-  # append a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  def appendChild(arg0)
-    ret = @dispatch._invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL hasChildNodes
-  def hasChildNodes()
-    ret = @dispatch._invoke(17, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode cloneNode
-  #   BOOL arg0 --- deep [IN]
-  def cloneNode(arg0)
-    ret = @dispatch._invoke(19, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR transformNode
-  # apply the stylesheet to the subtree
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  def transformNode(arg0)
-    ret = @dispatch._invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList selectNodes
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectNodes(arg0)
-    ret = @dispatch._invoke(29, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode selectSingleNode
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectSingleNode(arg0)
-    ret = @dispatch._invoke(30, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID transformNodeToObject
-  # apply the stylesheet to the subtree, returning the result through a document or a stream
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  #   VARIANT arg1 --- outputObject [IN]
-  def transformNodeToObject(arg0, arg1)
-    ret = @dispatch._invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMElement createElement
-  # create an Element node
-  #   BSTR arg0 --- tagName [IN]
-  def createElement(arg0)
-    ret = @dispatch._invoke(41, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocumentFragment createDocumentFragment
-  # create a DocumentFragment node
-  def createDocumentFragment()
-    ret = @dispatch._invoke(42, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMText createTextNode
-  # create a text node
-  #   BSTR arg0 --- data [IN]
-  def createTextNode(arg0)
-    ret = @dispatch._invoke(43, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMComment createComment
-  # create a comment node
-  #   BSTR arg0 --- data [IN]
-  def createComment(arg0)
-    ret = @dispatch._invoke(44, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMCDATASection createCDATASection
-  # create a CDATA section node
-  #   BSTR arg0 --- data [IN]
-  def createCDATASection(arg0)
-    ret = @dispatch._invoke(45, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMProcessingInstruction createProcessingInstruction
-  # create a processing instruction node
-  #   BSTR arg0 --- target [IN]
-  #   BSTR arg1 --- data [IN]
-  def createProcessingInstruction(arg0, arg1)
-    ret = @dispatch._invoke(46, [arg0, arg1], [VT_BSTR, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMAttribute createAttribute
-  # create an attribute node
-  #   BSTR arg0 --- name [IN]
-  def createAttribute(arg0)
-    ret = @dispatch._invoke(47, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMEntityReference createEntityReference
-  # create an entity reference node
-  #   BSTR arg0 --- name [IN]
-  def createEntityReference(arg0)
-    ret = @dispatch._invoke(49, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList getElementsByTagName
-  # build a list of elements by name
-  #   BSTR arg0 --- tagName [IN]
-  def getElementsByTagName(arg0)
-    ret = @dispatch._invoke(50, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode createNode
-  # create a node of the specified node type and name
-  #   VARIANT arg0 --- type [IN]
-  #   BSTR arg1 --- name [IN]
-  #   BSTR arg2 --- namespaceURI [IN]
-  def createNode(arg0, arg1, arg2)
-    ret = @dispatch._invoke(54, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nodeFromID
-  # retrieve node from it's ID
-  #   BSTR arg0 --- idString [IN]
-  def nodeFromID(arg0)
-    ret = @dispatch._invoke(56, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL load
-  # load document from the specified XML source
-  #   VARIANT arg0 --- xmlSource [IN]
-  def load(arg0)
-    ret = @dispatch._invoke(58, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID abort
-  # abort an asynchronous download
-  def abort()
-    ret = @dispatch._invoke(62, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL loadXML
-  # load the document from a string
-  #   BSTR arg0 --- bstrXML [IN]
-  def loadXML(arg0)
-    ret = @dispatch._invoke(63, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID save
-  # save the document to a specified desination
-  #   VARIANT arg0 --- desination [IN]
-  def save(arg0)
-    ret = @dispatch._invoke(64, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # HRESULT ondataavailable EVENT in XMLDOMDocumentEvents
-  def ondataavailable()
-    ret = @dispatch._invoke(198, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # HRESULT onreadystatechange EVENT in XMLDOMDocumentEvents
-  def onreadystatechange()
-    ret = @dispatch._invoke(-609, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# W3C-DOM XML Document (Apartment)
-class Microsoft_FreeThreadedXMLDOM_1_0 # DOMFreeThreadedDocument
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-  attr_reader :dispatch
-  attr_reader :clsid
-  attr_reader :progid
-
-  def initialize(obj = nil)
-    @clsid = "{2933BF91-7B36-11D2-B20E-00C04F983E60}"
-    @progid = "Microsoft.FreeThreadedXMLDOM.1.0"
-    if obj.nil?
-      @dispatch = WIN32OLE.new @progid
-    else
-      @dispatch = obj
-    end
-  end
-
-  def method_missing(cmd, *arg)
-    @dispatch.method_missing(cmd, *arg)
-  end
-
-  # BSTR nodeName
-  # name of the node
-  def nodeName()
-    ret = @dispatch._getproperty(2, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeValue
-  # value stored in the node
-  def nodeValue()
-    ret = @dispatch._getproperty(3, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # DOMNodeType nodeType
-  # the node's type
-  def nodeType()
-    ret = @dispatch._getproperty(4, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode parentNode
-  # parent of the node
-  def parentNode()
-    ret = @dispatch._getproperty(6, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList childNodes
-  # the collection of the node's children
-  def childNodes()
-    ret = @dispatch._getproperty(7, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode firstChild
-  # first child of the node
-  def firstChild()
-    ret = @dispatch._getproperty(8, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode lastChild
-  # first child of the node
-  def lastChild()
-    ret = @dispatch._getproperty(9, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode previousSibling
-  # left sibling of the node
-  def previousSibling()
-    ret = @dispatch._getproperty(10, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nextSibling
-  # right sibling of the node
-  def nextSibling()
-    ret = @dispatch._getproperty(11, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNamedNodeMap attributes
-  # the collection of the node's attributes
-  def attributes()
-    ret = @dispatch._getproperty(12, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocument ownerDocument
-  # document that contains the node
-  def ownerDocument()
-    ret = @dispatch._getproperty(18, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR nodeTypeString
-  # the type of node in string form
-  def nodeTypeString()
-    ret = @dispatch._getproperty(21, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR text
-  # text content of the node and subtree
-  def text()
-    ret = @dispatch._getproperty(24, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL specified
-  # indicates whether node is a default value
-  def specified()
-    ret = @dispatch._getproperty(22, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode definition
-  # pointer to the definition of the node in the DTD or schema
-  def definition()
-    ret = @dispatch._getproperty(23, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue()
-    ret = @dispatch._getproperty(25, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT dataType
-  # the data type of the node
-  def dataType()
-    ret = @dispatch._getproperty(26, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR xml
-  # return the XML source for the node and each of its descendants
-  def xml()
-    ret = @dispatch._getproperty(27, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL parsed
-  # has sub-tree been completely parsed
-  def parsed()
-    ret = @dispatch._getproperty(31, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR namespaceURI
-  # the URI for the namespace applying to the node
-  def namespaceURI()
-    ret = @dispatch._getproperty(32, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR prefix
-  # the prefix for the namespace applying to the node
-  def prefix()
-    ret = @dispatch._getproperty(33, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR baseName
-  # the base name of the node (nodename with the prefix stripped off)
-  def baseName()
-    ret = @dispatch._getproperty(34, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocumentType doctype
-  # node corresponding to the DOCTYPE
-  def doctype()
-    ret = @dispatch._getproperty(38, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMImplementation implementation
-  # info on this DOM implementation
-  def implementation()
-    ret = @dispatch._getproperty(39, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMElement documentElement
-  # the root of the tree
-  def documentElement()
-    ret = @dispatch._getproperty(40, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # I4 readyState
-  # get the state of the XML document
-  def readyState()
-    ret = @dispatch._getproperty(-525, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMParseError parseError
-  # get the last parser error
-  def parseError()
-    ret = @dispatch._getproperty(59, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR url
-  # get the URL for the loaded XML document
-  def url()
-    ret = @dispatch._getproperty(60, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL async
-  # flag for asynchronous download
-  def async()
-    ret = @dispatch._getproperty(61, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL validateOnParse
-  # indicates whether the parser performs validation
-  def validateOnParse()
-    ret = @dispatch._getproperty(65, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL resolveExternals
-  # indicates whether the parser resolves references to external DTD/Entities/Schema
-  def resolveExternals()
-    ret = @dispatch._getproperty(66, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL preserveWhiteSpace
-  # indicates whether the parser preserves whitespace
-  def preserveWhiteSpace()
-    ret = @dispatch._getproperty(67, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeValue
-  # value stored in the node
-  def nodeValue=(arg0)
-    ret = @dispatch._setproperty(3, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID text
-  # text content of the node and subtree
-  def text=(arg0)
-    ret = @dispatch._setproperty(24, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID nodeTypedValue
-  # get the strongly typed value of the node
-  def nodeTypedValue=(arg0)
-    ret = @dispatch._setproperty(25, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID dataType
-  # the data type of the node
-  def dataType=(arg0)
-    ret = @dispatch._setproperty(26, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID async
-  # flag for asynchronous download
-  def async=(arg0)
-    ret = @dispatch._setproperty(61, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID validateOnParse
-  # indicates whether the parser performs validation
-  def validateOnParse=(arg0)
-    ret = @dispatch._setproperty(65, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID resolveExternals
-  # indicates whether the parser resolves references to external DTD/Entities/Schema
-  def resolveExternals=(arg0)
-    ret = @dispatch._setproperty(66, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID preserveWhiteSpace
-  # indicates whether the parser preserves whitespace
-  def preserveWhiteSpace=(arg0)
-    ret = @dispatch._setproperty(67, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID onreadystatechange
-  # register a readystatechange event handler
-  def onreadystatechange=(arg0)
-    ret = @dispatch._setproperty(68, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID ondataavailable
-  # register an ondataavailable event handler
-  def ondataavailable=(arg0)
-    ret = @dispatch._setproperty(69, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID ontransformnode
-  # register an ontransformnode event handler
-  def ontransformnode=(arg0)
-    ret = @dispatch._setproperty(70, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode insertBefore
-  # insert a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   VARIANT arg1 --- refChild [IN]
-  def insertBefore(arg0, arg1)
-    ret = @dispatch._invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode replaceChild
-  # replace a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  #   IXMLDOMNode arg1 --- oldChild [IN]
-  def replaceChild(arg0, arg1)
-    ret = @dispatch._invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode removeChild
-  # remove a child node
-  #   IXMLDOMNode arg0 --- childNode [IN]
-  def removeChild(arg0)
-    ret = @dispatch._invoke(15, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode appendChild
-  # append a child node
-  #   IXMLDOMNode arg0 --- newChild [IN]
-  def appendChild(arg0)
-    ret = @dispatch._invoke(16, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL hasChildNodes
-  def hasChildNodes()
-    ret = @dispatch._invoke(17, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode cloneNode
-  #   BOOL arg0 --- deep [IN]
-  def cloneNode(arg0)
-    ret = @dispatch._invoke(19, [arg0], [VT_BOOL])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR transformNode
-  # apply the stylesheet to the subtree
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  def transformNode(arg0)
-    ret = @dispatch._invoke(28, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList selectNodes
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectNodes(arg0)
-    ret = @dispatch._invoke(29, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode selectSingleNode
-  # execute query on the subtree
-  #   BSTR arg0 --- queryString [IN]
-  def selectSingleNode(arg0)
-    ret = @dispatch._invoke(30, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID transformNodeToObject
-  # apply the stylesheet to the subtree, returning the result through a document or a stream
-  #   IXMLDOMNode arg0 --- stylesheet [IN]
-  #   VARIANT arg1 --- outputObject [IN]
-  def transformNodeToObject(arg0, arg1)
-    ret = @dispatch._invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMElement createElement
-  # create an Element node
-  #   BSTR arg0 --- tagName [IN]
-  def createElement(arg0)
-    ret = @dispatch._invoke(41, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMDocumentFragment createDocumentFragment
-  # create a DocumentFragment node
-  def createDocumentFragment()
-    ret = @dispatch._invoke(42, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMText createTextNode
-  # create a text node
-  #   BSTR arg0 --- data [IN]
-  def createTextNode(arg0)
-    ret = @dispatch._invoke(43, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMComment createComment
-  # create a comment node
-  #   BSTR arg0 --- data [IN]
-  def createComment(arg0)
-    ret = @dispatch._invoke(44, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMCDATASection createCDATASection
-  # create a CDATA section node
-  #   BSTR arg0 --- data [IN]
-  def createCDATASection(arg0)
-    ret = @dispatch._invoke(45, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMProcessingInstruction createProcessingInstruction
-  # create a processing instruction node
-  #   BSTR arg0 --- target [IN]
-  #   BSTR arg1 --- data [IN]
-  def createProcessingInstruction(arg0, arg1)
-    ret = @dispatch._invoke(46, [arg0, arg1], [VT_BSTR, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMAttribute createAttribute
-  # create an attribute node
-  #   BSTR arg0 --- name [IN]
-  def createAttribute(arg0)
-    ret = @dispatch._invoke(47, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMEntityReference createEntityReference
-  # create an entity reference node
-  #   BSTR arg0 --- name [IN]
-  def createEntityReference(arg0)
-    ret = @dispatch._invoke(49, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNodeList getElementsByTagName
-  # build a list of elements by name
-  #   BSTR arg0 --- tagName [IN]
-  def getElementsByTagName(arg0)
-    ret = @dispatch._invoke(50, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode createNode
-  # create a node of the specified node type and name
-  #   VARIANT arg0 --- type [IN]
-  #   BSTR arg1 --- name [IN]
-  #   BSTR arg2 --- namespaceURI [IN]
-  def createNode(arg0, arg1, arg2)
-    ret = @dispatch._invoke(54, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # IXMLDOMNode nodeFromID
-  # retrieve node from it's ID
-  #   BSTR arg0 --- idString [IN]
-  def nodeFromID(arg0)
-    ret = @dispatch._invoke(56, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL load
-  # load document from the specified XML source
-  #   VARIANT arg0 --- xmlSource [IN]
-  def load(arg0)
-    ret = @dispatch._invoke(58, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID abort
-  # abort an asynchronous download
-  def abort()
-    ret = @dispatch._invoke(62, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BOOL loadXML
-  # load the document from a string
-  #   BSTR arg0 --- bstrXML [IN]
-  def loadXML(arg0)
-    ret = @dispatch._invoke(63, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID save
-  # save the document to a specified desination
-  #   VARIANT arg0 --- desination [IN]
-  def save(arg0)
-    ret = @dispatch._invoke(64, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # HRESULT ondataavailable EVENT in XMLDOMDocumentEvents
-  def ondataavailable()
-    ret = @dispatch._invoke(198, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # HRESULT onreadystatechange EVENT in XMLDOMDocumentEvents
-  def onreadystatechange()
-    ret = @dispatch._invoke(-609, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# IXMLHttpRequest Interface
-module IXMLHttpRequest
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-
-  # I4 status
-  # Get HTTP status code
-  def status()
-    ret = _getproperty(7, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR statusText
-  # Get HTTP status text
-  def statusText()
-    ret = _getproperty(8, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # DISPATCH responseXML
-  # Get response body
-  def responseXML()
-    ret = _getproperty(9, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR responseText
-  # Get response body
-  def responseText()
-    ret = _getproperty(10, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT responseBody
-  # Get response body
-  def responseBody()
-    ret = _getproperty(11, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT responseStream
-  # Get response body
-  def responseStream()
-    ret = _getproperty(12, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # I4 readyState
-  # Get ready state
-  def readyState()
-    ret = _getproperty(13, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID onreadystatechange
-  # Register a complete event handler
-  def onreadystatechange=(arg0)
-    ret = _setproperty(14, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID open
-  # Open HTTP connection
-  #   BSTR arg0 --- bstrMethod [IN]
-  #   BSTR arg1 --- bstrUrl [IN]
-  #   VARIANT arg2 --- varAsync [IN]
-  #   VARIANT arg3 --- bstrUser [IN]
-  #   VARIANT arg4 --- bstrPassword [IN]
-  def open(arg0, arg1, arg2=nil, arg3=nil, arg4=nil)
-    ret = _invoke(1, [arg0, arg1, arg2, arg3, arg4], [VT_BSTR, VT_BSTR, VT_VARIANT, VT_VARIANT, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID setRequestHeader
-  # Add HTTP request header
-  #   BSTR arg0 --- bstrHeader [IN]
-  #   BSTR arg1 --- bstrValue [IN]
-  def setRequestHeader(arg0, arg1)
-    ret = _invoke(2, [arg0, arg1], [VT_BSTR, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR getResponseHeader
-  # Get HTTP response header
-  #   BSTR arg0 --- bstrHeader [IN]
-  def getResponseHeader(arg0)
-    ret = _invoke(3, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR getAllResponseHeaders
-  # Get all HTTP response headers
-  def getAllResponseHeaders()
-    ret = _invoke(4, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID send
-  # Send HTTP request
-  #   VARIANT arg0 --- varBody [IN]
-  def send(arg0=nil)
-    ret = _invoke(5, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID abort
-  # Abort HTTP request
-  def abort()
-    ret = _invoke(6, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# XML HTTP Request class.
-class Microsoft_XMLHTTP_1 # XMLHTTPRequest
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-  attr_reader :dispatch
-  attr_reader :clsid
-  attr_reader :progid
-
-  def initialize(obj = nil)
-    @clsid = "{ED8C108E-4349-11D2-91A4-00C04F7969E8}"
-    @progid = "Microsoft.XMLHTTP.1"
-    if obj.nil?
-      @dispatch = WIN32OLE.new @progid
-    else
-      @dispatch = obj
-    end
-  end
-
-  def method_missing(cmd, *arg)
-    @dispatch.method_missing(cmd, *arg)
-  end
-
-  # I4 status
-  # Get HTTP status code
-  def status()
-    ret = @dispatch._getproperty(7, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR statusText
-  # Get HTTP status text
-  def statusText()
-    ret = @dispatch._getproperty(8, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # DISPATCH responseXML
-  # Get response body
-  def responseXML()
-    ret = @dispatch._getproperty(9, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR responseText
-  # Get response body
-  def responseText()
-    ret = @dispatch._getproperty(10, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT responseBody
-  # Get response body
-  def responseBody()
-    ret = @dispatch._getproperty(11, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VARIANT responseStream
-  # Get response body
-  def responseStream()
-    ret = @dispatch._getproperty(12, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # I4 readyState
-  # Get ready state
-  def readyState()
-    ret = @dispatch._getproperty(13, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID onreadystatechange
-  # Register a complete event handler
-  def onreadystatechange=(arg0)
-    ret = @dispatch._setproperty(14, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID open
-  # Open HTTP connection
-  #   BSTR arg0 --- bstrMethod [IN]
-  #   BSTR arg1 --- bstrUrl [IN]
-  #   VARIANT arg2 --- varAsync [IN]
-  #   VARIANT arg3 --- bstrUser [IN]
-  #   VARIANT arg4 --- bstrPassword [IN]
-  def open(arg0, arg1, arg2=nil, arg3=nil, arg4=nil)
-    ret = @dispatch._invoke(1, [arg0, arg1, arg2, arg3, arg4], [VT_BSTR, VT_BSTR, VT_VARIANT, VT_VARIANT, VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID setRequestHeader
-  # Add HTTP request header
-  #   BSTR arg0 --- bstrHeader [IN]
-  #   BSTR arg1 --- bstrValue [IN]
-  def setRequestHeader(arg0, arg1)
-    ret = @dispatch._invoke(2, [arg0, arg1], [VT_BSTR, VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR getResponseHeader
-  # Get HTTP response header
-  #   BSTR arg0 --- bstrHeader [IN]
-  def getResponseHeader(arg0)
-    ret = @dispatch._invoke(3, [arg0], [VT_BSTR])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # BSTR getAllResponseHeaders
-  # Get all HTTP response headers
-  def getAllResponseHeaders()
-    ret = @dispatch._invoke(4, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID send
-  # Send HTTP request
-  #   VARIANT arg0 --- varBody [IN]
-  def send(arg0=nil)
-    ret = @dispatch._invoke(5, [arg0], [VT_VARIANT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID abort
-  # Abort HTTP request
-  def abort()
-    ret = @dispatch._invoke(6, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# XML Data Source Object
-class Microsoft_XMLDSO_1_0 # XMLDSOControl
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-  attr_reader :dispatch
-  attr_reader :clsid
-  attr_reader :progid
-
-  def initialize(obj = nil)
-    @clsid = "{550DDA30-0541-11D2-9CA9-0060B0EC3D39}"
-    @progid = "Microsoft.XMLDSO.1.0"
-    if obj.nil?
-      @dispatch = WIN32OLE.new @progid
-    else
-      @dispatch = obj
-    end
-  end
-
-  def method_missing(cmd, *arg)
-    @dispatch.method_missing(cmd, *arg)
-  end
-
-  # IXMLDOMDocument XMLDocument
-  def XMLDocument()
-    ret = @dispatch._getproperty(65537, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # I4 JavaDSOCompatible
-  def JavaDSOCompatible()
-    ret = @dispatch._getproperty(65538, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # I4 readyState
-  def readyState()
-    ret = @dispatch._getproperty(-525, [], [])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID XMLDocument
-  def XMLDocument=(arg0)
-    ret = @dispatch._setproperty(65537, [arg0], [VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # VOID JavaDSOCompatible
-  def JavaDSOCompatible=(arg0)
-    ret = @dispatch._setproperty(65538, [arg0], [VT_I4])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
-
-# Constants that define types for IXMLElement.
-module OLEtagXMLEMEM_TYPE
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-  XMLELEMTYPE_ELEMENT = 0
-  XMLELEMTYPE_TEXT = 1
-  XMLELEMTYPE_COMMENT = 2
-  XMLELEMTYPE_DOCUMENT = 3
-  XMLELEMTYPE_DTD = 4
-  XMLELEMTYPE_PI = 5
-  XMLELEMTYPE_OTHER = 6
-end
-
-# XMLDocument extends IXML Document.  It is obsolete.  You should use DOMDocument.  This object should not be confused with the XMLDocument property on the XML data island.
-class Msxml # XMLDocument
-  include WIN32OLE::VARIANT
-  attr_reader :lastargs
-  attr_reader :dispatch
-  attr_reader :clsid
-  attr_reader :progid
-
-  def initialize(obj = nil)
-    @clsid = "{CFC399AF-D876-11D0-9C10-00C04FC99C8E}"
-    @progid = "Msxml"
-    if obj.nil?
-      @dispatch = WIN32OLE.new @progid
-    else
-      @dispatch = obj
-    end
-  end
-
-  def method_missing(cmd, *arg)
-    @dispatch.method_missing(cmd, *arg)
-  end
-
-  # HRESULT url
-  # set URL to load an XML document from the URL.
-  #   BSTR arg0 --- p [IN]
-  def url=(arg0)
-    ret = @dispatch._setproperty(65641, [arg0], [VT_BSTR, VT_HRESULT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # HRESULT charset
-  # get encoding.
-  #   BSTR arg0 --- p [IN]
-  def charset=(arg0)
-    ret = @dispatch._setproperty(65645, [arg0], [VT_BSTR, VT_HRESULT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # HRESULT async
-  # get asynchronous loading flag.
-  #   BOOL arg0 --- pf [IN]
-  def async=(arg0)
-    ret = @dispatch._setproperty(65649, [arg0], [VT_BOOL, VT_HRESULT])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-
-  # HRESULT root
-  # get root IXMLElement of the XML document.
-  #   IXMLElement2,IXMLElement2 arg0 --- p [OUT]
-  def root
-    OLEProperty.new(@dispatch, 65637, [VT_BYREF|VT_BYREF|VT_DISPATCH], [VT_BYREF|VT_BYREF|VT_DISPATCH, VT_HRESULT])
-  end
-
-  # HRESULT url
-  # set URL to load an XML document from the URL.
-  #   BSTR arg0 --- p [OUT]
-  def url
-    OLEProperty.new(@dispatch, 65641, [VT_BYREF|VT_BSTR], [VT_BYREF|VT_BSTR, VT_HRESULT])
-  end
-
-  # HRESULT readyState
-  # get ready state.
-  #   I4 arg0 --- pl [OUT]
-  def readyState
-    OLEProperty.new(@dispatch, 65643, [VT_BYREF|VT_I4], [VT_BYREF|VT_I4, VT_HRESULT])
-  end
-
-  # HRESULT charset
-  # get encoding.
-  #   BSTR arg0 --- p [OUT]
-  def charset
-    OLEProperty.new(@dispatch, 65645, [VT_BYREF|VT_BSTR], [VT_BYREF|VT_BSTR, VT_HRESULT])
-  end
-
-  # HRESULT version
-  # get XML version number.
-  #   BSTR arg0 --- p [OUT]
-  def version
-    OLEProperty.new(@dispatch, 65646, [VT_BYREF|VT_BSTR], [VT_BYREF|VT_BSTR, VT_HRESULT])
-  end
-
-  # HRESULT doctype
-  # get document type.
-  #   BSTR arg0 --- p [OUT]
-  def doctype
-    OLEProperty.new(@dispatch, 65647, [VT_BYREF|VT_BSTR], [VT_BYREF|VT_BSTR, VT_HRESULT])
-  end
-
-  # HRESULT async
-  # get asynchronous loading flag.
-  #   BOOL arg0 --- pf [OUT]
-  def async
-    OLEProperty.new(@dispatch, 65649, [VT_BYREF|VT_BOOL], [VT_BYREF|VT_BOOL, VT_HRESULT])
-  end
-
-  # HRESULT createElement
-  # create different types of IXMLElements.
-  #   VARIANT arg0 --- vType [IN]
-  #   VARIANT arg1 --- var1 [IN]
-  #   IXMLElement2,IXMLElement2 arg2 --- ppElem [OUT]
-  def createElement(arg0, arg1=nil, arg2=nil)
-    ret = @dispatch._invoke(65644, [arg0, arg1, arg2], [VT_VARIANT, VT_VARIANT, VT_BYREF|VT_BYREF|VT_DISPATCH])
-    @lastargs = WIN32OLE::ARGV
-    ret
-  end
-end
diff --git a/ext/win32ole/tests/oleserver.rb b/ext/win32ole/tests/oleserver.rb
deleted file mode 100644
index bf721373e5..0000000000
--- a/ext/win32ole/tests/oleserver.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-require 'win32ole'
-def oletypelib_name(pat)
-  WIN32OLE_TYPE.typelibs.each do |lib|
-    return lib if pat =~ lib
-  end
-end
-module OLESERVER
-  MS_EXCEL_TYPELIB = oletypelib_name(/^Microsoft Excel .* Object Library$/)
-  MS_XML_TYPELIB = oletypelib_name(/^Microsoft XML/)
-end
diff --git a/ext/win32ole/tests/testOLEEVENT.rb b/ext/win32ole/tests/testOLEEVENT.rb
deleted file mode 100644
index 15b7ca8413..0000000000
--- a/ext/win32ole/tests/testOLEEVENT.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-require 'rubyunit'
-require 'win32ole'
-
-class TestWIN32OLE_EVENT < RUNIT::TestCase
-  def setup
-    @excel = WIN32OLE.new("Excel.Application")
-    @excel.visible = true
-  end
-  def test_on_event
-    book = @excel.workbooks.Add
-    value = ""
-    begin
-      ev = WIN32OLE_EVENT.new(book, 'WorkbookEvents')
-      ev.on_event('SheetChange'){|arg1, arg2| 
-        begin
-          value = arg1.value
-        rescue
-          value = $!.message
-        end
-      }
-      book.Worksheets(1).Range("A1").value = "OK"
-    ensure
-      book.saved = true
-    end
-    assert_equal("OK", value)
-  end
-  def teardown
-    @excel.quit
-    @excel = nil
-    GC.start
-  end
-end
-
diff --git a/ext/win32ole/tests/testOLEMETHOD.rb b/ext/win32ole/tests/testOLEMETHOD.rb
deleted file mode 100644
index 4f65ec96b4..0000000000
--- a/ext/win32ole/tests/testOLEMETHOD.rb
+++ /dev/null
@@ -1,83 +0,0 @@
-# You need RubyUnit and MS Excel and MSI to run this test script 
-
-require 'rubyunit'
-
-require 'win32ole'
-require 'oleserver'
-
-class TestOLEMETHOD < RUNIT::TestCase
-  include OLESERVER
-  def setup
-    @excel_app = WIN32OLE_TYPE.new(MS_EXCEL_TYPELIB, 'Application')
-  end
-  def test_s_new
-    m = WIN32OLE_METHOD.new(@excel_app, 'Quit')
-    assert_instance_of(WIN32OLE_METHOD, m)
-    m =  WIN32OLE_METHOD.new(@excel_app, 'WorkbookOpen')
-    assert_instance_of(WIN32OLE_METHOD, m)
-    m =  WIN32OLE_METHOD.new(@excel_app, 'workbookopen')
-    assert_instance_of(WIN32OLE_METHOD, m)
-  end
-  def test_name
-    m = WIN32OLE_METHOD.new(@excel_app, 'Quit')
-    assert_equal('Quit', m.name)
-  end
-  def test_return_type
-    m = WIN32OLE_METHOD.new(@excel_app, 'ActiveCell')
-    assert_equal('Range', m.return_type)
-    m = WIN32OLE_METHOD.new(@excel_app, 'ActivePrinter')
-    assert_equal('BSTR', m.return_type)
-  end
-  def test_return_vtype
-    m = WIN32OLE_METHOD.new(@excel_app, 'ActiveCell')
-    assert_equal(WIN32OLE::VARIANT::VT_PTR, m.return_vtype)
-    m = WIN32OLE_METHOD.new(@excel_app, 'ActivePrinter')
-    assert_equal(WIN32OLE::VARIANT::VT_BSTR, m.return_vtype)
-  end
-  def test_return_type_detail
-    m = WIN32OLE_METHOD.new(@excel_app, 'ActiveCell')
-    assert_equal(['PTR', 'USERDEFINED', 'Range'], m.return_type_detail)
-    m = WIN32OLE_METHOD.new(@excel_app, 'ActivePrinter')
-    assert_equal(['BSTR'], m.return_type_detail)
-  end
-
-  def test_invoke_kind
-    m = WIN32OLE_METHOD.new(@excel_app, 'ActiveCell')
-    assert_equal('PROPERTYGET', m.invoke_kind)
-  end
-  def test_visible
-    m = WIN32OLE_METHOD.new(@excel_app, 'ActiveCell')
-    assert(m.visible?)
-    m = WIN32OLE_METHOD.new(@excel_app, 'AddRef')
-    assert(!m.visible?)
-  end
-  def test_event
-    m =  WIN32OLE_METHOD.new(@excel_app, 'WorkbookOpen')
-    assert(m.event?)
-    m =  WIN32OLE_METHOD.new(@excel_app, 'ActiveCell')
-    assert(!m.event?)
-  end
-  def test_event_interface
-    m = WIN32OLE_METHOD.new(@excel_app, 'WorkbookOpen')
-    assert_equal('AppEvents', m.event_interface)
-    m = WIN32OLE_METHOD.new(@excel_app, 'ActiveCell')
-    assert_nil(m.event_interface)
-  end
-  def test_helpstring
-    domdoc = WIN32OLE_TYPE.new(MS_XML_TYPELIB, 'DOMDocument')
-    m =  WIN32OLE_METHOD.new(domdoc, 'abort')
-    assert_equal('abort an asynchronous download', m.helpstring)
-  end
-  def test_helpfile
-    m = WIN32OLE_METHOD.new(@excel_app, 'ActiveCell')
-    assert_match(/VBAXL.*\.(HLP|CHM)$/i, m.helpfile)
-  end
-  def test_helpcontext
-    m = WIN32OLE_METHOD.new(@excel_app, 'ActiveCell')
-    assert(m.helpcontext > 0)
-  end
-  def test_offset_vtbl
-    m = WIN32OLE_METHOD.new(@excel_app, 'QueryInterface')
-    assert_equal(0, m.offset_vtbl)
-  end
-end
diff --git a/ext/win32ole/tests/testOLEPARAM.rb b/ext/win32ole/tests/testOLEPARAM.rb
deleted file mode 100644
index 62fd2a1890..0000000000
--- a/ext/win32ole/tests/testOLEPARAM.rb
+++ /dev/null
@@ -1,67 +0,0 @@
-# You need RubyUnit and MS Excel and MSI to run this test script 
-
-require 'rubyunit'
-
-require 'win32ole'
-require 'oleserver'
-
-class TestOLEPARAM < RUNIT::TestCase
-  include OLESERVER
-  def test_name
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    sh = classes.find {|c| c.name == 'Worksheet'}
-    saveas = sh.ole_methods.find {|m| m.name == 'SaveAs'}
-    param_names = saveas.params.collect{|p| p.name}
-    assert(param_names.size > 0)
-    assert(param_names.include?('Filename'))
-  end
-  def test_ole_type
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    methods = classes.find {|c| c.name == 'Worksheet'}.ole_methods
-    f = methods.find {|m| m.name == 'SaveAs'}
-    assert_equal('BSTR', f.params[0].ole_type)
-    methods = classes.find {|c| c.name == 'Workbook'}.ole_methods
-    f = methods.find {|m| m.name == 'SaveAs'}
-    assert_equal('XlSaveAsAccessMode', f.params[6].ole_type)
-  end
-  def test_ole_type_detail
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    methods = classes.find {|c| c.name == 'Worksheet'}.ole_methods
-    f = methods.find {|m| m.name == 'SaveAs'}
-    assert_equal(['BSTR'], f.params[0].ole_type_detail)
-    methods = classes.find {|c| c.name == 'Workbook'}.ole_methods
-    f = methods.find {|m| m.name == 'SaveAs'}
-    assert_equal(['USERDEFINED', 'XlSaveAsAccessMode'], f.params[6].ole_type_detail)
-  end
-  def test_input
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    methods = classes.find {|c| c.name == 'Worksheet'}.ole_methods
-    f = methods.find {|m| m.name == 'SaveAs'}
-    assert(f.params[0].input?)
-  end
-  
-  def test_output
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    methods = classes.find {|c| c.name == 'Worksheet'}.ole_methods
-    f = methods.find {|m| m.name == 'SaveAs'}
-    assert(!f.params[0].output?)
-  end
-  def test_optional
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    methods = classes.find {|c| c.name == 'Worksheet'}.ole_methods
-    f = methods.find {|m| m.name == 'SaveAs'}
-    assert(!f.params[0].optional?)
-    methods = classes.find {|c| c.name == 'Workbook'}.ole_methods
-    f = methods.find {|m| m.name == 'SaveAs'}
-    assert(f.params[0].optional?)
-  end
-  def test_ole_type_detail
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    methods = classes.find {|c| c.name == 'Worksheet'}.ole_methods
-    f = methods.find {|m| m.name == 'SaveAs'}
-    assert_equal(nil, f.params[0].default)
-    methods = classes.find {|c| c.name == 'Workbook'}.ole_methods
-    f = methods.find {|m| m.name == 'SaveAs'}
-    assert_equal(1, f.params[6].default)
-  end
-end
diff --git a/ext/win32ole/tests/testOLETYPE.rb b/ext/win32ole/tests/testOLETYPE.rb
deleted file mode 100644
index 9840aac940..0000000000
--- a/ext/win32ole/tests/testOLETYPE.rb
+++ /dev/null
@@ -1,83 +0,0 @@
-# You need RubyUnit and MS Excel and MSI to run this test script 
-
-require 'rubyunit'
-
-require 'win32ole'
-require 'oleserver'
-
-class TestOLETYPE < RUNIT::TestCase
-  include OLESERVER
-  def test_s_new
-    type = WIN32OLE_TYPE.new(MS_EXCEL_TYPELIB, 'Application')
-    assert_instance_of(WIN32OLE_TYPE, type)
-  end
-  def test_s_ole_classes
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    assert(classes.size > 0)
-  end
-  def test_s_typelibs
-    libs = WIN32OLE_TYPE.typelibs
-    assert(libs.include?(MS_EXCEL_TYPELIB))
-    assert(libs.include?(MS_XML_TYPELIB))
-  end
-  def test_s_progids
-    progids = WIN32OLE_TYPE.progids
-    assert(progids.include?('Excel.Application'))
-  end
-  def test_name
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    class_names = classes.collect{|c|
-      c.name
-    }
-    assert(class_names.include?('Application'))
-  end
-  def test_ole_type
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    app = classes.find {|c| c.name == 'Application'}
-    assert_equal('Class', app.ole_type)
-    app = classes.find {|c| c.name == '_Application'}
-    assert_equal('Dispatch', app.ole_type)
-  end
-  def test_typekind
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    app = classes.find {|c| c.name == 'Application'}
-    assert_equal(5, app.typekind)
-  end
-  def test_visible
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    app = classes.find {|c| c.name == 'Application'}
-    assert(app.visible?)
-    app = classes.find {|c| c.name == 'IAppEvents'}
-    assert(!app.visible?)
-  end
-  def test_src_type
-    classes = WIN32OLE_TYPE.ole_classes(MS_XML_TYPELIB)
-    domnode = classes.find {|c| c.name == 'DOMNodeType'}
-    assert_equal('tagDOMNodeType', domnode.src_type)
-  end
-  def test_helpstring
-    classes = WIN32OLE_TYPE.ole_classes(MS_XML_TYPELIB)
-    domdoc = classes.find {|c| c.name == 'DOMDocument'}
-    assert_equal('W3C-DOM XML Document', domdoc.helpstring)
-  end
-  def test_variables
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    xlchart = classes.find {|c| c.name == 'XlChartType'}
-    assert(xlchart.variables.size > 0)
-  end
-  def test_ole_methods
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    worksheet = classes.find {|c| c.name == 'Worksheet'}
-    assert(worksheet.ole_methods.size > 0)
-  end
-  def test_helpfile
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    worksheet = classes.find {|c| c.name == 'Worksheet'}
-    assert_match(/VBAXL.*\.(CHM|HLP)$/, worksheet.helpfile)
-  end
-  def test_helpcontext
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    worksheet = classes.find {|c| c.name == 'Worksheet'}
-    assert_equal(131088, worksheet.helpcontext)
-  end
-end
diff --git a/ext/win32ole/tests/testOLEVARIABLE.rb b/ext/win32ole/tests/testOLEVARIABLE.rb
deleted file mode 100644
index b237d9b616..0000000000
--- a/ext/win32ole/tests/testOLEVARIABLE.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-# You need RubyUnit and MS Excel and MSI to run this test script 
-
-require 'rubyunit'
-
-require 'win32ole'
-require 'oleserver'
-
-class TestOLEVARIABLE < RUNIT::TestCase
-  include OLESERVER
-  def test_name
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    chart = classes.find {|c| c.name == 'XlChartType'}
-    var_names = chart.variables.collect {|m| m.name}
-    assert(var_names.size > 0)
-    assert(var_names.include?('xl3DColumn'))
-  end
-  def test_ole_type
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    chart = classes.find {|c| c.name == 'XlChartType'}
-    var = chart.variables.find {|m| m.name == 'xl3DColumn'}
-    assert_equal('INT', var.ole_type)
-  end
-  def test_ole_type_detail
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    chart = classes.find {|c| c.name == 'XlChartType'}
-    var = chart.variables.find {|m| m.name == 'xl3DColumn'}
-    assert_equal(['INT'], var.ole_type_detail)
-  end
-
-  def test_value
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    chart = classes.find {|c| c.name == 'XlChartType'}
-    var = chart.variables.find {|m| m.name == 'xl3DColumn'}
-    assert_equal(-4100, var.value)
-  end
-  def test_visible
-    classes = WIN32OLE_TYPE.ole_classes(MS_EXCEL_TYPELIB)
-    chart = classes.find {|c| c.name == 'XlChartType'}
-    var = chart.variables.find {|m| m.name == 'xl3DColumn'}
-    assert(var.visible?)
-  end
-end
diff --git a/ext/win32ole/tests/testVARIANT.rb b/ext/win32ole/tests/testVARIANT.rb
deleted file mode 100644
index f274778f27..0000000000
--- a/ext/win32ole/tests/testVARIANT.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# You need RubyUnit and MS Excel and MSI to run this test script 
-
-require 'rubyunit'
-
-require 'win32ole'
-
-class TestWin32OLE_VARIANT < RUNIT::TestCase
-  include WIN32OLE::VARIANT
-  def test_variant
-    assert_equal(2, VT_I2)
-    assert_equal(3, VT_I4)
-    assert_equal(4, VT_R4)
-    assert_equal(5, VT_R8)
-    assert_equal(6, VT_CY)
-    assert_equal(7, VT_DATE)
-    assert_equal(8, VT_BSTR)
-    assert_equal(9, VT_DISPATCH)
-    assert_equal(10, VT_ERROR)
-    assert_equal(11, VT_BOOL)
-    assert_equal(12, VT_VARIANT)
-    assert_equal(13, VT_UNKNOWN)
-    assert_equal(16, VT_I1)
-    assert_equal(17, VT_UI1)
-    assert_equal(18, VT_UI2)
-    assert_equal(19, VT_UI4)
-    assert_equal(22, VT_INT)
-    assert_equal(23, VT_UINT)
-    assert_equal(0x2000, VT_ARRAY)
-    assert_equal(0x4000, VT_BYREF)
-  end
-end
-
diff --git a/ext/win32ole/tests/testWIN32OLE.rb b/ext/win32ole/tests/testWIN32OLE.rb
deleted file mode 100644
index 7907fe36a9..0000000000
--- a/ext/win32ole/tests/testWIN32OLE.rb
+++ /dev/null
@@ -1,298 +0,0 @@
-# You need RubyUnit and MS Excel and MSI to run this test script 
-
-require 'runit/testcase'
-require 'runit/cui/testrunner'
-
-require 'win32ole'
-require 'oleserver'
-
-module EXCEL_CONST
-end
-
-module CONST1
-end
-
-module CONST2
-end
-
-module CONST3
-end
-
-class TestWin32OLE < RUNIT::TestCase
-  include OLESERVER
-  def setup
-    @excel = WIN32OLE.new("Excel.Application")
-    @excel.visible = true
-  end
-  def test_s_new
-    assert_instance_of(WIN32OLE, @excel)
-  end
-  def test_s_new_DCOM
-    rexcel = WIN32OLE.new("Excel.Application", "localhost")
-    assert_instance_of(WIN32OLE, rexcel)
-    rexcel.visible = true
-    rexcel.quit
-  end
-  def test_s_new_from_clsid
-    excel = WIN32OLE.new("{00024500-0000-0000-C000-000000000046}")
-    assert_instance_of(WIN32OLE, excel)
-    excel.quit
-    exc = assert_exception(WIN32OLERuntimeError) {
-      WIN32OLE.new("{000}")
-    }
-    assert_match(/Unknown OLE server : `\{000\}'/, exc.message)
-  end
-  def test_s_connect
-    excel2 = WIN32OLE.connect('Excel.Application')
-    assert_instance_of(WIN32OLE, excel2)
-  end
-
-  def test_s_const_load
-    assert(!defined?(EXCEL_CONST::XlTop))
-    WIN32OLE.const_load(@excel, EXCEL_CONST)
-    assert_equal(-4160, EXCEL_CONST::XlTop)
-
-    assert(!defined?(CONST1::XlTop))
-    WIN32OLE.const_load(MS_EXCEL_TYPELIB, CONST1)
-    assert_equal(-4160, CONST1::XlTop)
-  end
-
-  def test_get_win32ole_object
-    workbooks = @excel.Workbooks;
-    assert_instance_of(WIN32OLE, workbooks)
-  end
-  def test_each
-    workbooks = @excel.Workbooks
-    assert_no_exception {
-      i = 0;
-      workbooks.each do |workbook|
-        print i += 1
-      end
-    }
-    workbooks.add
-    workbooks.add
-    i = 0
-    workbooks.each do |workbook|
-      i+=1
-    end
-    assert_equal(2, i)
-    workbooks.each do |workbook|
-      workbook.saved = true
-    end
-  end
-  def test_setproperty_bracket
-    book = @excel.workbooks.add
-    sheet = book.worksheets(1)
-    begin
-      sheet.range("A1")['Value'] = 10
-      assert_equal(10, sheet.range("A1").value)
-      sheet['Cells', 1, 2] = 10
-      assert_equal(10, sheet.range("B1").value)
-    ensure
-      book.saved = true
-    end
-  end
-  def test_convert_bignum
-    book = @excel.workbooks.add
-    sheet = book.worksheets(1)
-    begin
-      sheet.range("A1").value = 999999999
-      sheet.range("A2").value = 9999999999
-      sheet.range("A3").value = "=A1*10 + 9"
-      assert_equal(9999999999, sheet.range("A2").value)
-      assert_equal(9999999999, sheet.range("A3").value)
-     
-    ensure
-      book.saved = true
-    end
-  end
-
-  def test_ole_invoke_with_named_arg
-    book = @excel.workbooks.add
-    sheets = book.worksheets
-    sheet = book.worksheets(1)
-    num = sheets.count
-    begin
-      sheets.add({'count' => 2, 'after'=>sheet})
-      assert_equal(2, sheets.count - num);
-    ensure
-      book.saved = true
-    end
-  end
-
-  def test_ole_invoke_with_named_arg_last
-    book = @excel.workbooks.add
-    sheets = book.worksheets
-    sheet = book.worksheets(1)
-    num = sheets.count
-    begin
-      sheets.add(sheet, {'count' => 2})
-      assert_equal(2, sheets.count - num);
-    ensure
-      book.saved = true
-    end
-  end
-
-  def test_setproperty
-    @excel.setproperty('Visible', false)
-    assert_equal(false, @excel.Visible)
-    @excel.setproperty('Visible', true)
-    assert_equal(true, @excel.Visible)
-    book = @excel.workbooks.add
-    sheet = book.worksheets(1)
-    begin
-      sheet.setproperty('Cells', 1, 2, 10)
-      assert_equal(10, sheet.range("B1").value)
-    ensure
-      book.saved = true
-    end
-  end
-  def test_no_exist_property
-    isok = false
-    begin
-      @excel.unknown_prop = 1
-    rescue WIN32OLERuntimeError
-      isok = true
-    end
-    assert(isok)
-
-    isok = false
-    begin
-      @excel['unknown_prop'] = 2
-    rescue WIN32OLERuntimeError
-      isok = true
-    end
-    assert(isok)
-  end
-
-  def test_setproperty_with_equal
-    book = @excel.workbooks.add
-    sheet = book.worksheets(1)
-    begin
-      sheet.range("B1").value = 10
-      assert_equal(10, sheet.range("B1").value)
-      sheet.range("C1:D1").value = [11, 12]
-      assert_equal(11, sheet.range("C1").value)
-      assert_equal(12, sheet.range("D1").value)
-    ensure
-      book.saved = true
-    end
-  end
-  def test_invoke
-    workbooks = @excel.invoke( 'workbooks' )
-    assert_instance_of(WIN32OLE, workbooks)
-    book = workbooks.invoke( 'add' )
-    assert_instance_of(WIN32OLE, book)
-  end
-  def test_ole_methods
-    methods = @excel.ole_methods
-    method_names = methods.collect{|m| m.name}
-    assert(method_names.include?("Quit"))
-  end
-  def test_ole_method_help
-    quit_info = @excel.ole_method_help("Quit")
-    assert_equal(0, quit_info.size_params)
-    assert_equal(0, quit_info.size_opt_params)
-
-    workbooks = @excel.Workbooks
-    add_info = workbooks.ole_method_help("Add")
-    assert_equal(1, add_info.size_params)
-    assert_equal(1, add_info.size_opt_params)
-    assert(add_info.params[0].input?)
-    assert(add_info.params[0].optional?)
-    assert_equal('VARIANT', add_info.params[0].ole_type)
-  end
-#  def test_ole_put_methods
-#    methods_list = @excel.ole_put_methods
-#    puts methods_list
-#  end
-  def teardown
-    @excel.quit
-    @excel = nil
-    GC.start
-  end
-end
-
-class TestWin32OLE_WITH_MSI < RUNIT::TestCase
-  def setup
-    installer = WIN32OLE.new("WindowsInstaller.Installer")
-    @record = installer.CreateRecord(2)
-  end
-
-  # Sorry, this test fails. 
-  # Win32OLE does not support this style to set property.
-  # Use Win32OLE#setproperty or Win32OLE#[]= .
-  # def test_invoke
-  #   @record.invoke("StringData", 1, 'cccc')
-  #   assert_equal('cccc', @record.StringData(1))
-  # end
-
-  def test_setproperty
-    @record.setproperty( "StringData", 1, 'dddd')
-    assert_equal('dddd', @record.StringData(1))
-  end
-  def test_bracket_equal_with_arg
-    @record[ "StringData", 1 ] =  'ffff'
-    assert_equal('ffff', @record.StringData(1))
-  end
-end
-
-# ---------------------
-#
-# a subclass of Win32OLE
-# override new() and connect()
-class MyExcel and Jan Dubois 
- *
- *  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.
- *
- */
-
-/*
-  $Date$
-  modified for win32ole (ruby) by Masaki.Suketa 
- */
-
-#include "ruby.h"
-#include "st.h"
-#include 
-#include 
-#include 
-#ifdef HAVE_STDARG_PROTOTYPES
-#include 
-#define va_init_list(a,b) va_start(a,b)
-#else
-#include 
-#define va_init_list(a,b) va_start(a)
-#endif
-
-#define DOUT fprintf(stderr,"[%d]\n",__LINE__)
-#define DOUTS(x) fprintf(stderr,"[%d]:" #x "=%s\n",__LINE__,x)
-#define DOUTMSG(x) fprintf(stderr, "[%d]:" #x "\n",__LINE__)
-#define DOUTI(x) fprintf(stderr, "[%ld]:" #x "=%d\n",__LINE__,x)
-#define DOUTD(x) fprintf(stderr, "[%d]:" #x "=%f\n",__LINE__,x)
-
-#if defined NONAMELESSUNION && __GNUC__
-#define V_UNION1(X, Y) ((X)->u.Y)
-#else
-#define V_UNION1(X, Y) ((X)->Y)
-#endif
-
-#if defined NONAMELESSUNION && __GNUC__
-#undef V_UNION
-#define V_UNION(X,Y) ((X)->n1.n2.n3.Y)
-
-#undef V_VT
-#define V_VT(X) ((X)->n1.n2.vt)
-
-#undef V_BOOL
-#define V_BOOL(X) V_UNION(X,boolVal)
-#endif
-
-#define OLE_RELEASE(X) ((X)->lpVtbl->Release(X))
-#define OLE_ADDREF(X)  ((X)->lpVtbl->AddRef(X))
-#define OLE_GET_TYPEATTR(X, Y) ((X)->lpVtbl->GetTypeAttr((X), (Y)))
-#define OLE_RELEASE_TYPEATTR(X, Y) ((X)->lpVtbl->ReleaseTypeAttr((X), (Y)))
-
-#define OLE_FREE(x) if(gOLEInitialized == Qtrue) {\
-                        if((x)) {\
-                            OLE_RELEASE((x));\
-                            (x) = 0;\
-                        }\
-                    }\
-                    ole_msg_loop();\
-                    CoFreeUnusedLibraries()
-
-#define WC2VSTR(x) ole_wc2vstr((x), TRUE)
-
-#define WIN32OLE_VERSION "0.5.2"
-
-typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
-    (REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
-
-typedef HWND (WINAPI FNHTMLHELP)(HWND hwndCaller, LPCSTR pszFile,
-				 UINT uCommand, DWORD dwData);
-typedef struct {
-    struct IEventSinkVtbl * lpVtbl;
-} IEventSink, *PEVENTSINK;
-
-typedef struct IEventSinkVtbl IEventSinkVtbl;
-
-struct IEventSinkVtbl {
-    STDMETHOD(QueryInterface)(
-        PEVENTSINK,
-        REFIID,
-        LPVOID *);
-    STDMETHOD_(ULONG, AddRef)(PEVENTSINK);
-    STDMETHOD_(ULONG, Release)(PEVENTSINK);
-
-    STDMETHOD(GetTypeInfoCount)(
-        PEVENTSINK,
-        UINT *);
-    STDMETHOD(GetTypeInfo)(
-        PEVENTSINK,
-        UINT,
-        LCID,
-        ITypeInfo **);
-    STDMETHOD(GetIDsOfNames)(
-        PEVENTSINK,
-        REFIID,
-        OLECHAR **,
-        UINT,
-        LCID,
-        DISPID *);
-    STDMETHOD(Invoke)(
-        PEVENTSINK,
-        DISPID,
-        REFIID,
-        LCID,
-        WORD,
-        DISPPARAMS *,
-        VARIANT *,
-        EXCEPINFO *,
-        UINT *);
-};
-
-typedef struct tagIEVENTSINKOBJ {
-    IEventSinkVtbl *lpVtbl;
-    DWORD m_cRef;
-    IID m_iid;
-    int m_event_id;
-    DWORD m_dwCookie;
-    IConnectionPoint *pConnectionPoint;
-    ITypeInfo *pTypeInfo;
-}IEVENTSINKOBJ, *PIEVENTSINKOBJ;
-
-VALUE cWIN32OLE;
-VALUE cWIN32OLE_TYPE;
-VALUE cWIN32OLE_VARIABLE;
-VALUE cWIN32OLE_METHOD;
-VALUE cWIN32OLE_PARAM;
-VALUE cWIN32OLE_EVENT;
-VALUE eWIN32OLE_RUNTIME_ERROR;
-VALUE mWIN32OLE_VARIANT;
-
-static VALUE ary_ole_event;
-static ID id_events;
-static BOOL gOLEInitialized = Qfalse;
-static HINSTANCE ghhctrl = NULL;
-static HINSTANCE gole32 = NULL;
-static FNCOCREATEINSTANCEEX *gCoCreateInstanceEx = NULL;
-
-struct oledata {
-    IDispatch *pDispatch;
-};
-
-struct oletypedata {
-    ITypeInfo *pTypeInfo;
-};
-
-struct olemethoddata {
-    ITypeInfo *pOwnerTypeInfo;
-    ITypeInfo *pTypeInfo;
-    UINT index;
-};
-
-struct olevariabledata {
-    ITypeInfo *pTypeInfo;
-    UINT index;
-};
-
-struct oleparamdata {
-    ITypeInfo *pTypeInfo;
-    UINT method_index;
-    UINT index;
-};
-
-struct oleeventdata {
-    IEVENTSINKOBJ *pEvent;
-};
-
-struct oleparam {
-    DISPPARAMS dp;
-    OLECHAR** pNamedArgs;
-};
-
-static VALUE folemethod_s_allocate _((VALUE));
-static VALUE olemethod_set_member _((VALUE, ITypeInfo *, ITypeInfo *, int, VALUE));
-static VALUE foletype_s_allocate _((VALUE));
-static VALUE oletype_set_member  _((VALUE, ITypeInfo *, VALUE));
-static VALUE olemethod_from_typeinfo _((VALUE, ITypeInfo *, VALUE));
-static HRESULT ole_docinfo_from_type _((ITypeInfo *, BSTR *, BSTR *, DWORD *, BSTR *));
-
-static void
-time2d(hh, mm, ss, pv)
-    int hh, mm, ss;
-    double *pv;
-{
-    *pv =  (hh * 60.0 * 60.0 + mm * 60.0 + ss) / 86400.0;
-}
-
-static void
-d2time(v, hh, mm, ss)
-    double v;
-    int *hh, *mm, *ss;
-{
-    double d_hh, d_mm, d_ss;
-    int    i_hh, i_mm, i_ss;
-
-    double d = v * 86400.0;
-
-    d_hh = d / 3600.0;
-    i_hh = (int)d_hh;
-
-    d = d - i_hh * 3600.0;
-
-    d_mm = d / 60.0;
-    i_mm = (int)d_mm;
-
-    d = d - i_mm * 60.0;
-
-    d_ss = d * 10.0 + 5;
-    
-    i_ss = (int)d_ss / 10;
-
-    if(i_ss == 60) {
-        i_mm += 1;
-        i_ss = 0;
-    }
-
-    if (i_mm == 60) {
-        i_hh += 1;
-        i_mm = 0;
-    }
-    if (i_hh == 24) {
-        i_hh = 0;
-    }
-    
-    *hh = i_hh;
-    *mm = i_mm;
-    *ss = i_ss;
-}
-
-static void
-civil2jd(y, m, d, jd)
-    int y, m, d;
-    long *jd;
-{
-    long a, b;
-    if (m <= 2) {
-        y -= 1;
-        m += 12;
-    }
-    a = (long)(y / 100.0);
-    b = 2 - a + (long)(a / 4.0);
-    *jd = (long)(365.25 * (double)(y + 4716))
-         + (long)(30.6001 * (m + 1))
-         + d + b - 1524;
-}
-
-static void
-jd2civil(day, yy, mm, dd)
-    long day;
-    int *yy, *mm, *dd;
-{
-    long x, a, b, c, d, e;
-    x = (long)(((double)day - 1867216.25) / 36524.25);
-    a = day + 1 + x - (long)(x / 4.0);
-    b = a + 1524;
-    c = (long)(((double)b -122.1) /365.25);
-    d = (long)(365.25 * c);
-    e = (long)((double)(b - d) / 30.6001);
-    *dd = b - d - (long)(30.6001 * e);
-    if (e <= 13) {
-        *mm = e - 1;
-        *yy = c - 4716;
-    }
-    else {
-        *mm = e - 13;
-        *yy = c - 4715;
-    }
-}
-
-static void
-double2time(v, y, m, d, hh, mm, ss)
-    double v;
-    int *y, *m, *d, *hh, *mm, *ss;
-{
-    long day;
-    double t;
-
-    day = (long)v;
-    t = v - day;
-    jd2civil(2415019 + day, y, m, d);
-
-    d2time(t, hh, mm, ss);
-}
-
-static double
-time_object2date(tmobj)
-    VALUE tmobj;
-{
-    long y, m, d, hh, mm, ss;
-    long day;
-    double t;
-    y = FIX2INT(rb_funcall(tmobj, rb_intern("year"), 0));
-    m = FIX2INT(rb_funcall(tmobj, rb_intern("month"), 0));
-    d = FIX2INT(rb_funcall(tmobj, rb_intern("mday"), 0));
-    hh = FIX2INT(rb_funcall(tmobj, rb_intern("hour"), 0));
-    mm = FIX2INT(rb_funcall(tmobj, rb_intern("min"), 0));
-    ss = FIX2INT(rb_funcall(tmobj, rb_intern("sec"), 0));
-    civil2jd(y, m, d, &day);
-    time2d(hh, mm, ss, &t);
-    return t + day - 2415019;
-}
-
-static VALUE
-date2time_str(date)
-    double date;
-{
-    int y, m, d, hh, mm, ss;
-    char szTime[20];
-    double2time(date, &y, &m, &d, &hh, &mm, &ss);
-    sprintf(szTime,
-            "%4.4d/%02.2d/%02.2d %02.2d:%02.2d:%02.2d",
-            y, m, d, hh, mm, ss);
-    return rb_str_new2(szTime);
-}
-
-static void ole_val2variant();
-
-static char *
-ole_wc2mb(pw)
-    LPWSTR pw;
-{
-    int size;
-    LPSTR pm;
-    size = WideCharToMultiByte(CP_ACP, 0, pw, -1, NULL, 0, NULL, NULL);
-    if (size) {
-        pm = ALLOC_N(char, size);    
-        WideCharToMultiByte(CP_ACP, 0, pw, -1, pm, size, NULL, NULL);
-    }
-    else {
-        pm = ALLOC_N(char, 1);
-        *pm = '\0';
-    }
-    return pm;
-} 
-
-static VALUE
-ole_hresult2msg(hr)
-    HRESULT hr;
-{
-    VALUE msg = Qnil;
-    char *p_msg;
-    DWORD dwCount;
-
-    char strhr[100];
-    sprintf(strhr, "    HRESULT error code:0x%08x\n      ", hr);
-    msg = rb_str_new2(strhr);
-
-    dwCount = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
-                            FORMAT_MESSAGE_FROM_SYSTEM |
-                            FORMAT_MESSAGE_IGNORE_INSERTS,
-                            NULL, hr, LOCALE_SYSTEM_DEFAULT,
-                            (LPTSTR)&p_msg, 0, NULL);
-    if (dwCount > 0) {
-        /* remove dots and CRs/LFs */
-        while (dwCount > 0 &&
-               (p_msg[dwCount-1] < ' ' || p_msg[dwCount-1] == '.')) {
-            p_msg[--dwCount] = '\0';
-        }
-        if (p_msg[0] != '\0') {
-            rb_str_cat2(msg, p_msg);
-        }
-    }
-    return msg;
-}
-
-static VALUE
-ole_excepinfo2msg(pExInfo)
-    EXCEPINFO *pExInfo;
-{
-    char error_code[40];
-    char *pSource = NULL;
-    char *pDescription = NULL;
-    VALUE error_msg;
-    if(pExInfo->pfnDeferredFillIn != NULL) {
-        (*pExInfo->pfnDeferredFillIn)(pExInfo);
-    }
-    if (pExInfo->bstrSource != NULL) {
-        pSource = ole_wc2mb(pExInfo->bstrSource);
-    }
-    if (pExInfo->bstrDescription != NULL) {
-        pDescription = ole_wc2mb(pExInfo->bstrDescription);
-    }
-    if(pExInfo->wCode == 0) {
-        sprintf(error_code, "\n    OLE error code:%lX in ", pExInfo->scode);
-    }
-    else{
-        sprintf(error_code, "\n    OLE error code:%u in ", pExInfo->wCode);
-    }
-    error_msg = rb_str_new2(error_code);
-    if(pSource != NULL) {
-        rb_str_cat(error_msg, pSource, strlen(pSource));
-    }
-    else {
-        rb_str_cat(error_msg, "", 9);
-    }
-    rb_str_cat2(error_msg, "\n      ");
-    if(pDescription != NULL) {
-        rb_str_cat2(error_msg, pDescription);
-    }
-    else {
-        rb_str_cat2(error_msg, "");
-    }
-    if(pSource) free(pSource);
-    if(pDescription) free(pDescription);
-    SysFreeString(pExInfo->bstrDescription);
-    SysFreeString(pExInfo->bstrSource);
-    SysFreeString(pExInfo->bstrHelpFile);
-    return error_msg;
-}
-
-static void
-#ifdef HAVE_STDARG_PROTOTYPES
-ole_raise(HRESULT hr, VALUE ecs, const char *fmt, ...)
-#else
-ole_raise(hr, exc, fmt, va_alist)
-    HRESULT hr;
-    VALUE exc;
-    const char *fmt;
-    va_dcl
-#endif
-{
-    va_list args;
-    char buf[BUFSIZ];
-    VALUE err_msg;
-    va_init_list(args, fmt);
-    vsnprintf(buf, BUFSIZ, fmt, args);
-    va_end(args);
-
-    err_msg = ole_hresult2msg(hr);
-    if(err_msg != Qnil) {
-        rb_raise(ecs, "%s\n%s", buf, StringValuePtr(err_msg));
-    }
-    else {
-        rb_raise(ecs, "%s", buf);
-    }
-}
-
-void
-ole_uninitialize()
-{
-    OleUninitialize();
-    gOLEInitialized = Qfalse;
-}
-
-static void
-ole_initialize() 
-{
-    HRESULT hr;
-    int rc;
-    
-    if(gOLEInitialized == Qfalse) {
-        hr = OleInitialize(NULL);
-        if(FAILED(hr)) {
-            ole_raise(hr, rb_eRuntimeError, "Fail : OLE initialize");
-        }
-        gOLEInitialized = Qtrue;
-        rc = atexit((void (*)(void))ole_uninitialize);
-    }
-}
-
-static void
-ole_msg_loop() {
-    MSG msg;
-    while(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) {
-        TranslateMessage(&msg);
-        DispatchMessage(&msg);
-    }
-}
-
-static void
-ole_free(pole)
-    struct oledata *pole;
-{
-    OLE_FREE(pole->pDispatch);
-}
-
-static void
-oletype_free(poletype)
-    struct oletypedata *poletype;
-{
-    OLE_FREE(poletype->pTypeInfo);
-}
-
-static void
-olemethod_free(polemethod)
-    struct olemethoddata *polemethod;
-{
-    OLE_FREE(polemethod->pTypeInfo);
-    OLE_FREE(polemethod->pOwnerTypeInfo);
-}
-
-static void
-olevariable_free(polevar)
-    struct olevariabledata *polevar;
-{
-    OLE_FREE(polevar->pTypeInfo);
-}
-
-static void
-oleparam_free(pole)
-    struct oleparamdata *pole;
-{
-    OLE_FREE(pole->pTypeInfo);
-}
-
-static LPWSTR
-ole_mb2wc(pm, len)
-    char *pm;
-    int  len;
-{
-    int size;
-    LPWSTR pw;
-    size = MultiByteToWideChar(CP_ACP, 0, pm, len, NULL, 0);
-    pw = SysAllocStringLen(NULL, size - 1);
-    MultiByteToWideChar(CP_ACP, 0, pm, len, pw, size);
-    return pw;
-}
-
-static VALUE
-ole_wc2vstr(pw, isfree)
-    LPWSTR pw;
-    BOOL isfree;
-{
-    char *p = ole_wc2mb(pw);
-    VALUE vstr = rb_str_new2(p);
-    if(isfree)
-        SysFreeString(pw);
-    free(p);
-    return vstr;
-}
-
-static VALUE
-ole_ary_m_entry(val, pid)
-    VALUE val;
-    long *pid;
-{
-    VALUE obj = Qnil;
-    int i = 0;
-    obj = val;
-    while(TYPE(obj) == T_ARRAY) {
-        obj = rb_ary_entry(obj, pid[i]);
-        i++;
-    }
-    return obj;
-}
-
-static void
-ole_set_safe_array(n, psa, pid, pub, val, dim)
-    long n;
-    SAFEARRAY *psa;
-    long *pid;
-    long *pub;
-    VALUE val;
-    long dim;
-{
-    VALUE val1;
-    VARIANT var;
-    VariantInit(&var);
-    if(n < 0) return;
-    if(n == dim) {
-        val1 = ole_ary_m_entry(val, pid);
-        ole_val2variant(val1, &var);
-        SafeArrayPutElement(psa, pid, &var);
-    }
-    pid[n] += 1;
-    if (pid[n] < pub[n]) {
-        ole_set_safe_array(dim, psa, pid, pub, val, dim);
-    }
-    else {
-        pid[n] = 0;
-        ole_set_safe_array(n-1, psa, pid, pub, val, dim);
-    }
-}
-
-static void
-ole_val2variant(val, var)
-    VALUE val;
-    VARIANT *var;
-{
-    struct oledata *pole;
-    if(rb_obj_is_kind_of(val, cWIN32OLE)) {
-        Data_Get_Struct(val, struct oledata, pole);
-	OLE_ADDREF(pole->pDispatch);
-        V_VT(var) = VT_DISPATCH;
-        V_DISPATCH(var) = pole->pDispatch;
-        return;
-    }
-    if (rb_obj_is_kind_of(val, rb_cTime)) {
-        V_VT(var) = VT_DATE;
-        V_DATE(var) = time_object2date(val);
-        return;
-    }
-    switch (TYPE(val)) {
-    case T_ARRAY:
-    {
-        VALUE val1;
-        long dim = 0;
-        int  i = 0;
-
-        HRESULT hr;
-        SAFEARRAYBOUND *psab;
-        SAFEARRAY *psa;
-        long      *pub, *pid;
-
-        val1 = val;
-        while(TYPE(val1) == T_ARRAY) {
-            val1 = rb_ary_entry(val1, 0);
-            dim += 1;
-        }
-        psab = ALLOC_N(SAFEARRAYBOUND, dim);
-        pub  = ALLOC_N(long, dim);
-        pid  = ALLOC_N(long, dim);
-
-        if(!psab || !pub || !pid) {
-            if(pub) free(pub);
-            if(psab) free(psab);
-            if(pid) free(pid);
-            rb_raise(rb_eRuntimeError, "memory allocate error");
-        }
-        val1 = val;
-        i = 0;
-        while(TYPE(val1) == T_ARRAY) {
-            psab[i].cElements = RARRAY(val1)->len;
-            psab[i].lLbound = 0;
-            pub[i] = psab[i].cElements;
-            pid[i] = 0;
-            i ++;
-            val1 = rb_ary_entry(val1, 0);
-        }
-        /* Create and fill VARIANT array */
-        psa = SafeArrayCreate(VT_VARIANT, dim, psab);
-        if (psa == NULL)
-            hr = E_OUTOFMEMORY;
-        else
-            hr = SafeArrayLock(psa);
-        if (SUCCEEDED(hr)) {
-            ole_set_safe_array(dim-1, psa, pid, pub, val, dim-1);
-            hr = SafeArrayUnlock(psa);
-        }
-        if(pub) free(pub);
-        if(psab) free(psab);
-        if(pid) free(pid);
-
-        if (SUCCEEDED(hr)) {
-            V_VT(var) = VT_VARIANT | VT_ARRAY;
-            V_ARRAY(var) = psa;
-        }
-        else if (psa != NULL)
-            SafeArrayDestroy(psa);
-        break;
-    }
-    case T_STRING:
-        V_VT(var) = VT_BSTR;
-        V_BSTR(var) = ole_mb2wc(StringValuePtr(val), -1);
-        break;
-    case T_FIXNUM:
-        V_VT(var) = VT_I4;
-        V_I4(var) = NUM2INT(val);
-        break;
-    case T_BIGNUM:
-	V_VT(var) = VT_R8;
-        V_R8(var) = rb_big2dbl(val);
-	break;
-    case T_FLOAT:
-        V_VT(var) = VT_R8;
-        V_R8(var) = NUM2DBL(val);
-        break;
-    case T_TRUE:
-        V_VT(var) = VT_BOOL;
-        V_BOOL(var) = VARIANT_TRUE;
-        break;
-    case T_FALSE:
-        V_VT(var) = VT_BOOL;
-        V_BOOL(var) = VARIANT_FALSE;
-        break;
-    case T_NIL:
-        V_VT(var) = VT_ERROR;
-        V_ERROR(var) = DISP_E_PARAMNOTFOUND;
-        break;
-    default:
-        rb_raise(rb_eTypeError, "not valid value");
-        break;
-    }
-}
-
-static VALUE
-ole_set_member(self, dispatch)
-    VALUE self;
-    IDispatch * dispatch;
-{
-    struct oledata *pole;
-    Data_Get_Struct(self, struct oledata, pole);
-    if (pole->pDispatch) {
-        OLE_RELEASE(pole->pDispatch);
-        pole->pDispatch = NULL;
-    }
-    pole->pDispatch = dispatch;
-    return self;
-}
-
-static VALUE
-fole_s_allocate(klass)
-    VALUE klass;
-{
-    struct oledata *pole;
-    VALUE obj;
-    ole_initialize();
-    obj = Data_Make_Struct(klass,struct oledata,0,ole_free,pole);
-    pole->pDispatch = NULL;
-    return obj;
-}
-
-static VALUE
-create_win32ole_object(klass, pDispatch, argc, argv)
-    VALUE klass;
-    IDispatch *pDispatch;
-    int argc;
-    VALUE *argv;
-{
-    VALUE obj = fole_s_allocate(klass);
-    ole_set_member(obj, pDispatch);
-    return obj;
-}
-
-static VALUE
-ole_variant2val(pvar)
-    VARIANT *pvar;
-{
-    VALUE obj = Qnil;
-    HRESULT hr;
-    while ( V_VT(pvar) == (VT_BYREF | VT_VARIANT) )
-        pvar = V_VARIANTREF(pvar);
-
-    if(V_ISARRAY(pvar)) {
-        SAFEARRAY *psa = V_ISBYREF(pvar) ? *V_ARRAYREF(pvar) : V_ARRAY(pvar);
-        long i;
-        long *pID, *pLB, *pUB;
-        VARIANT variant;
-        VALUE val;
-        VALUE val2;
-
-        int dim = SafeArrayGetDim(psa);
-        VariantInit(&variant);
-        V_VT(&variant) = (V_VT(pvar) & ~VT_ARRAY) | VT_BYREF;
-
-        pID = ALLOC_N(long, dim);
-        pLB = ALLOC_N(long, dim);
-        pUB = ALLOC_N(long, dim);
-
-        if(!pID || !pLB || !pUB) {
-            if(pID) free(pID);
-            if(pLB) free(pLB);
-            if(pUB) free(pUB);
-            rb_raise(rb_eRuntimeError, "memory allocate error");
-        }
-
-        obj = Qnil;
-
-        for(i = 0; i < dim; ++i) {
-            SafeArrayGetLBound(psa, i+1, &pLB[i]);
-            SafeArrayGetLBound(psa, i+1, &pID[i]);
-            SafeArrayGetUBound(psa, i+1, &pUB[i]);
-        }
-
-        hr = SafeArrayLock(psa);
-        if (SUCCEEDED(hr)) {
-            val2 = rb_ary_new();
-            while (i >= 0) {
-                hr = SafeArrayPtrOfIndex(psa, pID, &V_BYREF(&variant));
-                if (FAILED(hr))
-                    break;
-
-                val = ole_variant2val(&variant);
-                rb_ary_push(val2, val);
-                for (i = dim-1 ; i >= 0 ; --i) {
-                    if (++pID[i] <= pUB[i])
-                        break;
-
-                    pID[i] = pLB[i];
-                    if (i > 0) {
-                        if (obj == Qnil)
-                            obj = rb_ary_new();
-                        rb_ary_push(obj, val2);
-                        val2 = rb_ary_new();
-                    }
-                }
-            }
-            SafeArrayUnlock(psa);
-        }
-        if(pID) free(pID);
-        if(pLB) free(pLB);
-        if(pUB) free(pUB);
-        return (obj == Qnil) ? val2 : obj;
-    }
-    switch(V_VT(pvar) & ~VT_BYREF){
-    case VT_EMPTY:
-        break;
-    case VT_NULL:
-        break;
-    case VT_UI1:
-        if(V_ISBYREF(pvar)) 
-            obj = INT2NUM((long)*V_UI1REF(pvar));
-        else 
-            obj = INT2NUM((long)V_UI1(pvar));
-        break;
-
-    case VT_I2:
-        if(V_ISBYREF(pvar))
-            obj = INT2NUM((long)*V_I2REF(pvar));
-        else 
-            obj = INT2NUM((long)V_I2(pvar));
-        break;
-
-    case VT_I4:
-        if(V_ISBYREF(pvar))
-            obj = INT2NUM((long)*V_I4REF(pvar));
-        else 
-            obj = INT2NUM((long)V_I4(pvar));
-        break;
-
-    case VT_R4:
-        if(V_ISBYREF(pvar))
-            obj = rb_float_new(*V_R4REF(pvar));
-        else
-            obj = rb_float_new(V_R4(pvar));
-        break;
-
-    case VT_R8:
-        if(V_ISBYREF(pvar))
-            obj = rb_float_new(*V_R8REF(pvar));
-        else
-            obj = rb_float_new(V_R8(pvar));
-        break;
-
-    case VT_BSTR:
-    {
-        char *p;
-        if(V_ISBYREF(pvar))
-            p = ole_wc2mb(*V_BSTRREF(pvar));
-        else
-            p = ole_wc2mb(V_BSTR(pvar));
-        obj = rb_str_new2(p);
-        if(p) free(p);
-        break;
-    }
-
-    case VT_ERROR:
-        if(V_ISBYREF(pvar))
-            obj = INT2NUM(*V_ERRORREF(pvar));
-        else
-            obj = INT2NUM(V_ERROR(pvar));
-        break;
-
-    case VT_BOOL:
-        if (V_ISBYREF(pvar))
-            obj = (*V_BOOLREF(pvar) ? Qtrue : Qfalse);
-        else
-            obj = (V_BOOL(pvar) ? Qtrue : Qfalse);
-        break;
-
-    case VT_DISPATCH:
-    {
-        IDispatch *pDispatch;
-
-        if (V_ISBYREF(pvar))
-            pDispatch = *V_DISPATCHREF(pvar);
-        else
-            pDispatch = V_DISPATCH(pvar);
-
-        if (pDispatch != NULL ) {
-	    OLE_ADDREF(pDispatch);
-            obj = create_win32ole_object(cWIN32OLE, pDispatch, 0, 0);
-        }
-        break;
-    }
-
-    case VT_UNKNOWN:
-    {
-
-        /* get IDispatch interface from IUnknown interface */
-        IUnknown *punk;
-        IDispatch *pDispatch;
-        HRESULT hr;
-
-        if (V_ISBYREF(pvar))
-            punk = *V_UNKNOWNREF(pvar);
-        else
-            punk = V_UNKNOWN(pvar);
-
-        if(punk != NULL) {
-           hr = punk->lpVtbl->QueryInterface(punk, &IID_IDispatch,
-                                             (void **)&pDispatch);
-           if(SUCCEEDED(hr)) {
-               obj = create_win32ole_object(cWIN32OLE, pDispatch, 0, 0);
-           }
-        }
-        break;
-    }
-
-    case VT_DATE:
-    {
-        DATE date;
-        if(V_ISBYREF(pvar))
-            date = *V_DATEREF(pvar);
-        else
-            date = V_DATE(pvar);
-
-        obj =  date2time_str(date);
-        break;
-    }
-    case VT_CY:
-    default:
-        {
-        HRESULT hr;
-        VARIANT variant;
-        VariantInit(&variant);
-        hr = VariantChangeTypeEx(&variant, pvar, 
-                                  LOCALE_SYSTEM_DEFAULT, 0, VT_BSTR);
-        if (SUCCEEDED(hr) && V_VT(&variant) == VT_BSTR) {
-            char *p = ole_wc2mb(V_BSTR(&variant));
-            obj = rb_str_new2(p);
-            if(p) free(p);
-        }
-        VariantClear(&variant);
-        break;
-        }
-    }
-    return obj;
-}
-
-static LONG reg_open_key(hkey, name, phkey)
-    HKEY hkey;
-    const char *name;
-    HKEY *phkey;
-{
-    return RegOpenKeyEx(hkey, name, 0, KEY_READ, phkey);
-}
-
-static LONG reg_open_vkey(hkey, key, phkey)
-    HKEY hkey;
-    VALUE key;
-    HKEY *phkey;
-{
-    return reg_open_key(hkey, StringValuePtr(key), phkey);
-}
-
-static VALUE
-reg_enum_key(hkey, i)
-    HKEY hkey;
-    DWORD i;
-{
-    char buf[BUFSIZ];
-    DWORD size_buf = sizeof(buf);
-    FILETIME ft;
-    LONG err = RegEnumKeyEx(hkey, i, buf, &size_buf,
-                            NULL, NULL, NULL, &ft);
-    if(err == ERROR_SUCCESS) {
-        return rb_str_new2(buf);
-    }
-    return Qnil;
-}
-
-static VALUE
-reg_get_val(hkey, subkey)
-    HKEY hkey;
-    const char *subkey;
-{
-    char buf[BUFSIZ];
-    LONG size_buf = sizeof(buf);
-    LONG err = RegQueryValue(hkey, subkey, buf, &size_buf);
-    if (err == ERROR_SUCCESS) {
-        return rb_str_new2(buf);
-    }
-    return Qnil;
-}
-
-static VALUE
-typelib_file_from_clsid(ole)
-    VALUE ole;
-{
-    OLECHAR *pbuf;
-    CLSID clsid;
-    HRESULT hr;
-    HKEY hroot, hclsid;
-    LONG err;
-    VALUE typelib;
-    VALUE vclsid;
-    char *pclsid = NULL;
-
-    pbuf  = ole_mb2wc(StringValuePtr(ole), -1);
-    hr = CLSIDFromProgID(pbuf, &clsid);
-    SysFreeString(pbuf);
-    if (FAILED(hr)) {
-	return Qnil;
-    }
-    StringFromCLSID(&clsid, &pbuf);
-    vclsid = WC2VSTR(pbuf);
-    err = reg_open_key(HKEY_CLASSES_ROOT, "CLSID", &hroot);
-    if (err != ERROR_SUCCESS) {
-        return Qnil;
-    }
-    err = reg_open_key(hroot, StringValuePtr(vclsid), &hclsid);
-    if (err != ERROR_SUCCESS) {
-        RegCloseKey(hroot);
-        return Qnil;
-    }
-    typelib = reg_get_val(hclsid, "InprocServer32");
-    RegCloseKey(hroot);
-    RegCloseKey(hclsid);
-    return typelib;
-}
-
-static VALUE
-typelib_file_from_typelib(ole)
-    VALUE ole;
-{
-    HKEY htypelib, hclsid, hversion, hlang;
-    double fver;
-    DWORD i, j, k;
-    LONG err;
-    BOOL found = FALSE;
-    VALUE typelib;
-    VALUE file = Qnil;
-    VALUE clsid;
-    VALUE ver;
-    VALUE lang;
-
-    err = reg_open_key(HKEY_CLASSES_ROOT, "TypeLib", &htypelib);
-    if(err != ERROR_SUCCESS) {
-        return Qnil;
-    }
-    for(i = 0; !found; i++) {
-        clsid = reg_enum_key(htypelib, i);
-        if (clsid == Qnil)
-            break;
-        err = reg_open_vkey(htypelib, clsid, &hclsid);
-        if (err != ERROR_SUCCESS)
-            continue;
-        fver = 0;
-        for(j = 0; !found; j++) {
-            ver = reg_enum_key(hclsid, j);
-            if (ver == Qnil)
-                break;
-            err = reg_open_vkey(hclsid, ver, &hversion);
-            if (err != ERROR_SUCCESS || fver > atof(StringValuePtr(ver)))
-                continue;
-            fver = atof(StringValuePtr(ver));
-            typelib = reg_get_val(hversion, NULL);
-            if (typelib == Qnil)
-                continue;
-            if (rb_str_cmp(typelib, ole) == 0) {
-	        for(k = 0; !found; k++) {
-                    lang = reg_enum_key(hversion, k);
-                    if (lang == Qnil)
-                        break;
-                    err = reg_open_vkey(hversion, lang, &hlang);
-                    if (err == ERROR_SUCCESS) {
-                        if ((file = reg_get_val(hlang, "win32")) != Qnil) 
-                            found = TRUE;
-                        RegCloseKey(hlang);
-                    }
-                }
-            }
-            RegCloseKey(hversion);
-        }
-        RegCloseKey(hclsid);
-    }
-    RegCloseKey(htypelib);
-    return  file;
-}
-
-static VALUE
-typelib_file(ole)
-    VALUE ole;
-{
-    VALUE file = typelib_file_from_clsid(ole);
-    if (file != Qnil) {
-	return file;
-    }
-    return typelib_file_from_typelib(ole);
-}
-
-static void
-ole_const_load(pTypeLib, klass, self)
-    ITypeLib *pTypeLib;
-    VALUE klass;
-    VALUE self;
-{
-    unsigned int count;
-    unsigned int index;
-    int iVar;
-    ITypeInfo *pTypeInfo;
-    TYPEATTR  *pTypeAttr;
-    VARDESC   *pVarDesc;
-    HRESULT hr;
-    unsigned int len;
-    BSTR bstr;
-    char *pName = NULL;
-    VALUE val;
-    VALUE constant;
-    ID id;
-    constant = rb_hash_new();
-    count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib);
-    for (index = 0; index < count; index++) {
-        hr = pTypeLib->lpVtbl->GetTypeInfo(pTypeLib, index, &pTypeInfo);
-        if (FAILED(hr))
-            continue;
-        hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-        if(FAILED(hr)) {
-            OLE_RELEASE(pTypeInfo);
-            continue;
-        }
-        for(iVar = 0; iVar < pTypeAttr->cVars; iVar++) {
-            hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, iVar, &pVarDesc);
-            if(FAILED(hr))
-                continue;
-            if(pVarDesc->varkind == VAR_CONST &&
-               !(pVarDesc->wVarFlags & (VARFLAG_FHIDDEN |
-                                        VARFLAG_FRESTRICTED |
-                                        VARFLAG_FNONBROWSABLE))) {
-                hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, pVarDesc->memid, &bstr,
-                                                 1, &len);
-                if(FAILED(hr) || len == 0 || !bstr)
-                    continue;
-                pName = ole_wc2mb(bstr);
-                val = ole_variant2val(V_UNION1(pVarDesc, lpvarValue));
-                *pName = toupper(*pName);
-                id = rb_intern(pName);
-                if (rb_is_const_id(id)) {
-                    rb_define_const(klass, pName, val);
-                }
-                else {
-                    rb_hash_aset(constant, rb_str_new2(pName), val);
-                }
-                SysFreeString(bstr);
-                if(pName) {
-                    free(pName);
-                    pName = NULL;
-                }
-            }
-            pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
-        }
-        pTypeInfo->lpVtbl->ReleaseTypeAttr(pTypeInfo, pTypeAttr);
-        OLE_RELEASE(pTypeInfo);
-    }
-    rb_define_const(klass, "CONSTANTS", constant);
-}
-
-static HRESULT
-clsid_from_remote(host, com, pclsid)
-    VALUE host;
-    VALUE com;
-    CLSID *pclsid;
-{
-    HKEY hlm;
-    HKEY hpid;
-    VALUE subkey;
-    LONG err;
-    char clsid[100];
-    OLECHAR *pbuf;
-    DWORD len;
-    DWORD dwtype;
-    HRESULT hr = S_OK;
-    err = RegConnectRegistry(StringValuePtr(host), HKEY_LOCAL_MACHINE, &hlm);
-    if (err != ERROR_SUCCESS)
-        return HRESULT_FROM_WIN32(err);
-    subkey = rb_str_new2("SOFTWARE\\Classes\\");
-    rb_str_concat(subkey, com);
-    rb_str_cat2(subkey, "\\CLSID");
-    err = RegOpenKeyEx(hlm, StringValuePtr(subkey), 0, KEY_READ, &hpid);
-    if (err != ERROR_SUCCESS)
-        hr = HRESULT_FROM_WIN32(err);
-    else {
-        len = sizeof(clsid);
-        err = RegQueryValueEx(hpid, "", NULL, &dwtype, clsid, &len);
-        if (err == ERROR_SUCCESS && dwtype == REG_SZ) {
-            pbuf  = ole_mb2wc(clsid, -1);
-            hr = CLSIDFromString(pbuf, pclsid);
-            SysFreeString(pbuf);
-	}
-	else {
-            hr = HRESULT_FROM_WIN32(err);
-        }
-        RegCloseKey(hpid);
-    }
-    RegCloseKey(hlm);
-    return hr;
-}
-
-static VALUE
-ole_create_dcom(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    VALUE ole, host, others;
-    HRESULT hr;
-    CLSID   clsid;
-    OLECHAR *pbuf;
-
-    COSERVERINFO serverinfo;
-    MULTI_QI multi_qi;
-    DWORD clsctx = CLSCTX_REMOTE_SERVER;
-
-    if (!gole32)
-        gole32 = LoadLibrary("OLE32");
-    if (!gole32)
-        rb_raise(rb_eRuntimeError, "Fail to load OLE32.");
-    if (!gCoCreateInstanceEx)
-        gCoCreateInstanceEx = (FNCOCREATEINSTANCEEX*)
-            GetProcAddress(gole32, "CoCreateInstanceEx");
-    if (!gCoCreateInstanceEx)
-        rb_raise(rb_eRuntimeError, "CoCreateInstanceEx is not supported in this environment.");
-    rb_scan_args(argc, argv, "2*", &ole, &host, &others);
-
-    pbuf  = ole_mb2wc(StringValuePtr(ole), -1);
-    hr = CLSIDFromProgID(pbuf, &clsid);
-    if (FAILED(hr))
-        hr = clsid_from_remote(host, ole, &clsid);
-    if (FAILED(hr))
-        hr = CLSIDFromString(pbuf, &clsid);
-    SysFreeString(pbuf);
-    if (FAILED(hr))
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, 
-                  "Unknown OLE server : `%s'",
-                  StringValuePtr(ole));
-    memset(&serverinfo, 0, sizeof(COSERVERINFO));    
-    serverinfo.pwszName = ole_mb2wc(StringValuePtr(host), -1);
-    memset(&multi_qi, 0, sizeof(MULTI_QI));
-    multi_qi.pIID = &IID_IDispatch;
-    hr = gCoCreateInstanceEx(&clsid, NULL, clsctx, &serverinfo, 1, &multi_qi);
-    SysFreeString(serverinfo.pwszName);
-    if (FAILED(hr))
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, 
-                  "Fail to create DCOM server : `%s' in `%s'",
-                  StringValuePtr(ole),
-                  StringValuePtr(host));
-
-    ole_set_member(self, (IDispatch*)multi_qi.pItf);
-    return self;
-}
-
-static VALUE
-ole_bind_obj(moniker, argc, argv, self)
-    VALUE moniker;
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    IBindCtx *pBindCtx;
-    IMoniker *pMoniker;
-    IDispatch *pDispatch;
-    HRESULT hr;
-    OLECHAR *pbuf;
-    ULONG eaten = 0;
-    
-    ole_initialize();
-
-    hr = CreateBindCtx(0, &pBindCtx);
-    if(FAILED(hr)) {
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, 
-                  "Fail to create bind context");
-    }
-
-    pbuf  = ole_mb2wc(StringValuePtr(moniker), -1);
-    hr = MkParseDisplayName(pBindCtx, pbuf, &eaten, &pMoniker);
-    SysFreeString(pbuf);
-    if(FAILED(hr)) {
-        OLE_RELEASE(pBindCtx);
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR,
-                  "Faile to parse display name of moniker:%s",
-                  StringValuePtr(moniker));
-    }
-    hr = pMoniker->lpVtbl->BindToObject(pMoniker, pBindCtx, NULL, 
-                                        &IID_IDispatch,
-				        (void**)&pDispatch);
-    OLE_RELEASE(pMoniker);
-    OLE_RELEASE(pBindCtx);
-
-    if(FAILED(hr)) {
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR,
-                  "Faile to bind moniker:%s",
-                  StringValuePtr(moniker));
-    }
-    return create_win32ole_object(self, pDispatch, argc, argv);
-}
-
-/*
- * WIN32OLE.connect( ole ) --> aWIN32OLE
- * ----
- * Returns running OLE Automation object or WIN32OLE object from moniker.
- * 1st argument should be OLE program id or class id or moniker.
- */
-static VALUE
-fole_s_connect(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    VALUE svr_name;
-    VALUE others;
-    HRESULT hr;
-    CLSID   clsid;
-    OLECHAR *pBuf;
-    IDispatch *pDispatch;
-    IUnknown *pUnknown;
-
-    /* initialize to use OLE */
-    ole_initialize();
-
-    rb_scan_args(argc, argv, "1*", &svr_name, &others);
-
-    /* get CLSID from OLE server name */
-    pBuf  = ole_mb2wc(StringValuePtr(svr_name), -1);
-    hr = CLSIDFromProgID(pBuf, &clsid);
-    if(FAILED(hr)) {
-        hr = CLSIDFromString(pBuf, &clsid);
-    }
-    SysFreeString(pBuf);
-    if(FAILED(hr)) {
-        return ole_bind_obj(svr_name, argc, argv, self);
-    }
-
-    hr = GetActiveObject(&clsid, 0, &pUnknown);
-    if (FAILED(hr)) {
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, 
-                  "Not Running OLE server : `%s'", StringValuePtr(svr_name));
-    }
-    hr = pUnknown->lpVtbl->QueryInterface(pUnknown, &IID_IDispatch,
-                                             (void **)&pDispatch);
-    if(FAILED(hr)) {
-        OLE_RELEASE(pUnknown);
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, 
-                  "Fail to create WIN32OLE server : `%s'", 
-                  StringValuePtr(svr_name));
-    }
-
-    OLE_RELEASE(pUnknown);
-
-    return create_win32ole_object(self, pDispatch, argc, argv);
-}
-
-/* 
- * WIN32OLE.const_load( ole, mod = WIN32OLE)
- * ----
- * Defines the constants of OLE Automation server as mod's constants.
- * If 2nd argument is omitted, the default is WIN32OLE.
- */
-static VALUE
-fole_s_const_load(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    VALUE ole;
-    VALUE klass;
-    struct oledata *pole;
-    ITypeInfo *pTypeInfo;
-    ITypeLib *pTypeLib;
-    unsigned int index;
-    HRESULT hr;
-    OLECHAR *pBuf;
-    VALUE file;
-    LCID    lcid = LOCALE_SYSTEM_DEFAULT;
-    
-    rb_scan_args(argc, argv, "11", &ole, &klass);
-    if (TYPE(klass) != T_CLASS &&
-        TYPE(klass) != T_MODULE &&
-        TYPE(klass) != T_NIL) {
-        rb_raise(rb_eTypeError, "2nd paramator must be Class or Module.");
-    }
-    if (rb_obj_is_kind_of(ole, cWIN32OLE)) {
-        Data_Get_Struct(ole, struct oledata, pole);
-        hr = pole->pDispatch->lpVtbl->GetTypeInfo(pole->pDispatch,
-                                                  0, lcid, &pTypeInfo);
-        if(FAILED(hr)) {
-            ole_raise(hr, rb_eRuntimeError, "fail to GetTypeInfo");
-        }
-        hr = pTypeInfo->lpVtbl->GetContainingTypeLib(pTypeInfo, &pTypeLib, &index);
-        if(FAILED(hr)) {
-            OLE_RELEASE(pTypeInfo);
-            ole_raise(hr, rb_eRuntimeError, "fail to GetContainingTypeLib");
-        }
-        OLE_RELEASE(pTypeInfo);
-        if(TYPE(klass) != T_NIL) {
-            ole_const_load(pTypeLib, klass, self);
-        }
-        else {
-            ole_const_load(pTypeLib, cWIN32OLE, self);
-        }
-        OLE_RELEASE(pTypeLib);
-    }
-    else if(TYPE(ole) == T_STRING) {
-        file = typelib_file(ole);
-        if (file == Qnil) {
-	    file = ole;
-        }
-        pBuf = ole_mb2wc(StringValuePtr(file), -1);
-        hr = LoadTypeLibEx(pBuf, REGKIND_NONE, &pTypeLib);
-        SysFreeString(pBuf);
-	if (FAILED(hr))
-          ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Fail to LoadTypeLibEx");
-        if(TYPE(klass) != T_NIL) {
-            ole_const_load(pTypeLib, klass, self);
-        }
-        else {
-            ole_const_load(pTypeLib, cWIN32OLE, self);
-        }
-        OLE_RELEASE(pTypeLib);
-    }
-    else {
-        rb_raise(rb_eTypeError, "1st paramator must be WIN32OLE instance");
-    }
-    return Qnil;
-}
-
-static VALUE
-ole_classes_from_typelib(pTypeLib, classes)
-    ITypeLib *pTypeLib;
-    VALUE classes;
-{
-    
-    long count;
-    int i;
-    HRESULT hr;
-    BSTR bstr;
-    ITypeInfo *pTypeInfo;
-    VALUE type;
-  
-    count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib);
-    for (i = 0; i < count; i++) {
-        hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, i,
-                                                &bstr, NULL, NULL, NULL);
-        if (FAILED(hr)) 
-	    continue;
-
-        hr = pTypeLib->lpVtbl->GetTypeInfo(pTypeLib, i, &pTypeInfo);
-        if (FAILED(hr))
-            continue;
-
-        type = foletype_s_allocate(cWIN32OLE_TYPE);
-	oletype_set_member(type, pTypeInfo, WC2VSTR(bstr));
-
-	rb_ary_push(classes, type);
-	OLE_RELEASE(pTypeInfo);
-    }
-    return classes;
-}
-
-static ULONG
-reference_count(pole)
-    struct oledata * pole;
-{
-    ULONG n = 0;
-    if(pole->pDispatch) {
-	OLE_ADDREF(pole->pDispatch);
-        n = OLE_RELEASE(pole->pDispatch);
-    }
-    return n;
-}
-
-/*
- * WIN32OLE.ole_reference_count(aWIN32OLE) --> number
- * ----
- * Returns reference counter of Dispatch interface of WIN32OLE object. 
- * You should not use this method because this method
- * exists only for debugging WIN32OLE.
- */
-static VALUE
-fole_s_reference_count(self, obj)
-    VALUE self;
-    VALUE obj;
-{
-    struct oledata * pole;
-    Data_Get_Struct(obj, struct oledata, pole);
-    return INT2NUM(reference_count(pole));
-}
-
-/*
- * WIN32OLE.ole_free(aWIN32OLE) --> number
- * ----
- * Invokes Release method of Dispatch interface of WIN32OLE object. 
- * You should not use this method because this method
- * exists only for debugging WIN32OLE.
- * The return value is reference counter of OLE object.
- */
-static VALUE
-fole_s_free(self, obj)
-    VALUE self;
-    VALUE obj;
-{
-    ULONG n = 0;
-    struct oledata * pole;
-    Data_Get_Struct(obj, struct oledata, pole);
-    if(pole->pDispatch) {
-        if (reference_count(pole) > 0) {
-            n = OLE_RELEASE(pole->pDispatch);
-        }
-    }
-    return INT2NUM(n);
-}
-
-static HWND
-ole_show_help(helpfile, helpcontext)
-    VALUE helpfile;
-    VALUE helpcontext;
-{
-    FNHTMLHELP *pfnHtmlHelp;
-    HWND hwnd = 0;
-
-    if(!ghhctrl)
-        ghhctrl = LoadLibrary("HHCTRL.OCX");
-    if (!ghhctrl)
-        return hwnd;
-    pfnHtmlHelp = (FNHTMLHELP*)GetProcAddress(ghhctrl, "HtmlHelpA");
-    if (!pfnHtmlHelp)
-        return hwnd;
-    hwnd = pfnHtmlHelp(GetDesktopWindow(), StringValuePtr(helpfile), 
-                    0x0f, NUM2INT(helpcontext));
-    if (hwnd == 0)
-	hwnd = pfnHtmlHelp(GetDesktopWindow(), StringValuePtr(helpfile), 
-                 0,  NUM2INT(helpcontext));
-    return hwnd;
-}
-
-/*
- * WIN32OLE.ole_show_help(obj [,helpcontext])
- * ----
- * Displays helpfile. The 1st argument specifies WIN32OLE_TYPE
- * object or WIN32OLE_METHOD object or helpfile.
- */
-static VALUE
-fole_s_show_help(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    VALUE target;
-    VALUE helpcontext;
-    VALUE helpfile;
-    VALUE name;
-    HWND  hwnd;
-    rb_scan_args(argc, argv, "11", &target, &helpcontext);
-    if (rb_obj_is_kind_of(target, cWIN32OLE_TYPE) ||
-        rb_obj_is_kind_of(target, cWIN32OLE_METHOD)) {
-        helpfile = rb_funcall(target, rb_intern("helpfile"), 0);
-        if(strlen(StringValuePtr(helpfile)) == 0) {
-            name = rb_ivar_get(target, rb_intern("name"));
-            rb_raise(rb_eRuntimeError, "no helpfile of `%s'",
-                     StringValuePtr(name));
-        }
-        helpcontext = rb_funcall(target, rb_intern("helpcontext"), 0);
-    } else {
-        helpfile = target;
-    }
-    if (TYPE(helpfile) != T_STRING) {
-        rb_raise(rb_eTypeError, "1st parametor must be (String|WIN32OLE_TYPE|WIN32OLE_METHOD).");
-    }
-    hwnd = ole_show_help(helpfile, helpcontext);
-    if(hwnd == 0) {
-        rb_raise(rb_eRuntimeError, "fail to open help file:%s",
-                 StringValuePtr(helpfile));
-    }
-    return Qnil;
-}
-
-static VALUE
-fole_initialize(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    VALUE svr_name;
-    VALUE host;
-    VALUE others;
-    HRESULT hr;
-    CLSID   clsid;
-    OLECHAR *pBuf;
-    IDispatch *pDispatch;
-
-    rb_call_super(0, 0);
-    rb_scan_args(argc, argv, "11*", &svr_name, &host, &others);
-
-    if (!NIL_P(host))
-        return ole_create_dcom(argc, argv, self);
-
-    /* get CLSID from OLE server name */
-    pBuf  = ole_mb2wc(StringValuePtr(svr_name), -1);
-    hr = CLSIDFromProgID(pBuf, &clsid);
-    if(FAILED(hr)) {
-        hr = CLSIDFromString(pBuf, &clsid);
-    }
-    SysFreeString(pBuf);
-    if(FAILED(hr)) {
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, 
-                  "Unknown OLE server : `%s'",
-                  StringValuePtr(svr_name));
-    }
-
-    /* get IDispatch interface */
-    hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER,
-                          &IID_IDispatch, (void**)&pDispatch);
-    if(FAILED(hr)) {
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR,
-                  "Fail to create WIN32OLE object from `%s'",
-                  StringValuePtr(svr_name));
-    }
-    
-    ole_set_member(self, pDispatch);
-    return self;
-}
-
-static VALUE
-hash2named_arg(pair, pOp)
-    VALUE pair;
-    struct oleparam* pOp;
-{
-    unsigned int index, i;
-    VALUE key, value;
-    index = pOp->dp.cNamedArgs;
-
-    /*-------------------------------------
-      the data-type of key must be String
-    ---------------------------------------*/
-    key = rb_ary_entry(pair, 0);
-    if(TYPE(key) != T_STRING) {
-        /* clear name of dispatch parameters */
-        for(i = 1; i < index + 1; i++) {
-            SysFreeString(pOp->pNamedArgs[i]);
-        }
-        /* clear dispatch parameters */
-        for(i = 0; i < index; i++ ) {
-            VariantClear(&(pOp->dp.rgvarg[i]));
-        }
-        /* raise an exception */
-        Check_Type(key, T_STRING);
-    }
-
-    /* pNamedArgs[0] is , so "index + 1" */
-    pOp->pNamedArgs[index + 1] = ole_mb2wc(StringValuePtr(key), -1);
-
-    value = rb_ary_entry(pair, 1);
-    VariantInit(&(pOp->dp.rgvarg[index]));
-    ole_val2variant(value, &(pOp->dp.rgvarg[index]));
-
-    pOp->dp.cNamedArgs += 1;
-    return Qnil;
-}
-
-static VALUE
-ole_invoke(argc, argv, self, wFlags)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-    USHORT wFlags;
-{
-    LCID    lcid = LOCALE_SYSTEM_DEFAULT;
-    struct oledata *pole;
-    HRESULT hr;
-    VALUE cmd;
-    VALUE paramS;
-    VALUE param;
-    VALUE obj;
-    VALUE v;
-
-    BSTR wcmdname;
-
-    DISPID DispID;
-    DISPID* pDispID;
-    EXCEPINFO excepinfo;
-    VARIANT result;
-    VALUE args;
-    VARIANTARG* realargs = NULL;
-    unsigned int argErr = 0;
-    unsigned int i;
-    unsigned int cNamedArgs;
-    struct oleparam op;
-    memset(&excepinfo, 0, sizeof(EXCEPINFO));
-
-    VariantInit(&result);
-
-    op.dp.rgvarg = NULL;
-    op.dp.rgdispidNamedArgs = NULL;
-    op.dp.cNamedArgs = 0;
-    op.dp.cArgs = 0;
-
-    rb_scan_args(argc, argv, "1*", &cmd, ¶mS);
-    Data_Get_Struct(self, struct oledata, pole);
-    if(!pole->pDispatch) {
-	rb_raise(rb_eRuntimeError, "Fail to get dispatch interface.");
-    }
-    wcmdname = ole_mb2wc(StringValuePtr(cmd), -1);
-    hr = pole->pDispatch->lpVtbl->GetIDsOfNames( pole->pDispatch, &IID_NULL,
-                                                 &wcmdname, 1, lcid, &DispID);
-    SysFreeString(wcmdname);
-    if(FAILED(hr)) {
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, 
-                  "Unknown property or method : `%s'",
-                  StringValuePtr(cmd));
-    }
-
-    /* pick up last argument of method */
-    param = rb_ary_entry(paramS, argc-2);
-
-    op.dp.cNamedArgs = 0;
-
-    /* if last arg is hash object */
-    if(TYPE(param) == T_HASH) {
-        /*------------------------------------------ 
-          hash object ==> named dispatch parameters 
-        --------------------------------------------*/
-        cNamedArgs = NUM2INT(rb_funcall(param, rb_intern("length"), 0));
-        op.dp.cArgs = cNamedArgs + argc - 2;
-        op.pNamedArgs = ALLOCA_N(OLECHAR*, cNamedArgs + 1);
-        op.dp.rgvarg = ALLOCA_N(VARIANTARG, op.dp.cArgs);
-        rb_iterate(rb_each, param, hash2named_arg, (VALUE)&op);
-
-        pDispID = ALLOCA_N(DISPID, cNamedArgs + 1);
-        op.pNamedArgs[0] = ole_mb2wc(StringValuePtr(cmd), -1);
-        hr = pole->pDispatch->lpVtbl->GetIDsOfNames(pole->pDispatch,
-                                                    &IID_NULL,
-                                                    op.pNamedArgs,
-                                                    op.dp.cNamedArgs + 1,
-                                                    lcid, pDispID);
-        for(i = 0; i < op.dp.cNamedArgs + 1; i++) {
-            SysFreeString(op.pNamedArgs[i]);
-            op.pNamedArgs[i] = NULL;
-        }
-        if(FAILED(hr)) {
-            /* clear dispatch parameters */
-            for(i = 0; i < op.dp.cArgs; i++ ) {
-                VariantClear(&op.dp.rgvarg[i]);
-            }
-            ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, 
-                      "FAIL to get named argument info : `%s'",
-                      StringValuePtr(cmd));
-        }
-        op.dp.rgdispidNamedArgs = &(pDispID[1]);
-    }
-    else {
-        cNamedArgs = 0;
-        op.dp.cArgs = argc - 1;
-        op.pNamedArgs = ALLOCA_N(OLECHAR*, cNamedArgs + 1);
-        if (op.dp.cArgs > 0) {
-            op.dp.rgvarg  = ALLOCA_N(VARIANTARG, op.dp.cArgs);
-        }
-    }
-    /*--------------------------------------
-      non hash args ==> dispatch parameters 
-     ----------------------------------------*/
-    if(op.dp.cArgs > cNamedArgs) {
-        realargs = ALLOCA_N(VARIANTARG, op.dp.cArgs-cNamedArgs+1);
-        for(i = cNamedArgs; i < op.dp.cArgs; i++) {
-            int n = op.dp.cArgs - i + cNamedArgs - 1;
-            VariantInit(&realargs[n]);
-            VariantInit(&op.dp.rgvarg[n]);
-            param = rb_ary_entry(paramS, i-cNamedArgs);
-            
- 	    ole_val2variant(param, &realargs[n]);
-            V_VT(&op.dp.rgvarg[n]) = VT_VARIANT | VT_BYREF;
- 	    V_VARIANTREF(&op.dp.rgvarg[n]) = &realargs[n];
-
-        }
-    }
-    /* apparent you need to call propput, you need this */
-    if (wFlags & DISPATCH_PROPERTYPUT) {
-        if (op.dp.cArgs == 0)
-            return ResultFromScode(E_INVALIDARG);
-
-        op.dp.cNamedArgs = 1;
-        op.dp.rgdispidNamedArgs = ALLOCA_N( DISPID, 1 );
-        op.dp.rgdispidNamedArgs[0] = DISPID_PROPERTYPUT;
-    }
-    
-    hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DispID, 
-                                         &IID_NULL, lcid, wFlags, &op.dp, 
-                                         &result, &excepinfo, &argErr);
-    if (FAILED(hr)) {
-        /* mega kludge. if a method in WORD is called and we ask
-         * for a result when one is not returned then
-         * hResult == DISP_E_EXCEPTION. this only happens on
-         * functions whose DISPID > 0x8000 */
-        if (hr == DISP_E_EXCEPTION && DispID > 0x8000) {
-            memset(&excepinfo, 0, sizeof(EXCEPINFO));
-            hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DispID, 
-                                                 &IID_NULL, lcid, wFlags,
-                                                 &op.dp, NULL,
-                                                 &excepinfo, &argErr);
-
-        }
-    }
-    /* clear dispatch parameter */
-    if(op.dp.cArgs > cNamedArgs) {
-        args = rb_cvar_get(cWIN32OLE, rb_intern("ARGV"));
-        rb_funcall(args, rb_intern("clear"), 0);
-        for(i = cNamedArgs; i < op.dp.cArgs; i++) {
-            int n = op.dp.cArgs - i + cNamedArgs - 1;
-            rb_ary_push(args, ole_variant2val(&realargs[n]));
-            VariantClear(&realargs[n]);
-        }
-    }
-    else {
-        for(i = 0; i < op.dp.cArgs; i++) {
-            VariantClear(&op.dp.rgvarg[i]);
-        }
-    }
-
-    if (FAILED(hr)) {
-        v = ole_excepinfo2msg(&excepinfo);
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "%s%s",
-                  StringValuePtr(cmd), StringValuePtr(v));
-    }
-    obj = ole_variant2val(&result);
-    VariantClear(&result);
-    return obj;
-}
-
-static VALUE
-fole_invoke(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    return ole_invoke(argc, argv, self, DISPATCH_METHOD|DISPATCH_PROPERTYGET);
-}
-
-static VALUE
-ole_invoke2(self, dispid, args, types, dispkind)
-    VALUE self;
-    VALUE dispid;
-    VALUE args;
-    VALUE types;
-    USHORT dispkind;
-{
-    HRESULT hr;
-    struct oledata *pole;
-    unsigned int argErr = 0;
-    EXCEPINFO excepinfo;
-    VARIANT result;
-    DISPPARAMS dispParams;
-    VARIANTARG* realargs = NULL;
-    int i, j;
-    VALUE obj = Qnil;
-    VALUE tp, param;
-    VALUE v;
-    VARTYPE vt;
-
-    Check_Type(args, T_ARRAY);
-    Check_Type(types, T_ARRAY);
-    
-    memset(&excepinfo, 0, sizeof(EXCEPINFO));
-    memset(&dispParams, 0, sizeof(DISPPARAMS));
-    VariantInit(&result);
-    Data_Get_Struct(self, struct oledata, pole);
-
-    dispParams.cArgs = RARRAY(args)->len;
-    dispParams.rgvarg = ALLOCA_N(VARIANTARG, dispParams.cArgs);
-    realargs = ALLOCA_N(VARIANTARG, dispParams.cArgs);
-    for (i = 0, j = dispParams.cArgs - 1; i < (int)dispParams.cArgs; i++, j--)
-    {
-	VariantInit(&realargs[i]);
-	VariantInit(&dispParams.rgvarg[i]);
-	tp = rb_ary_entry(types, j);
-	vt = (VARTYPE)FIX2INT(tp);
-	V_VT(&dispParams.rgvarg[i]) = vt;
-	param = rb_ary_entry(args, j);
-	if (param == Qnil)
-	{
-
-	    V_VT(&dispParams.rgvarg[i]) = V_VT(&realargs[i]) = VT_ERROR;
-	    V_ERROR(&dispParams.rgvarg[i]) = V_ERROR(&realargs[i]) = DISP_E_PARAMNOTFOUND;
-	}
-	else
-	{
-	    if (vt & VT_ARRAY)
-	    {
-		int ent;
-		LPBYTE pb;
-		short* ps;
-		LPLONG pl;
-		VARIANT* pv;
-		CY *py;
-		VARTYPE v;
-		SAFEARRAYBOUND rgsabound[1];
-		Check_Type(param, T_ARRAY);
-		rgsabound[0].lLbound = 0;
-		rgsabound[0].cElements = RARRAY(param)->len;
-		v = vt & ~(VT_ARRAY | VT_BYREF);
-		V_ARRAY(&realargs[i]) = SafeArrayCreate(v, 1, rgsabound);
-		V_VT(&realargs[i]) = VT_ARRAY | v;
-		SafeArrayLock(V_ARRAY(&realargs[i]));
-		pb = V_ARRAY(&realargs[i])->pvData;
-		ps = V_ARRAY(&realargs[i])->pvData;
-		pl = V_ARRAY(&realargs[i])->pvData;
-		py = V_ARRAY(&realargs[i])->pvData;
-		pv = V_ARRAY(&realargs[i])->pvData;
-		for (ent = 0; ent < (int)rgsabound[0].cElements; ent++)
-		{
-		    VARIANT velem;
-		    VALUE elem = rb_ary_entry(param, ent);
-		    ole_val2variant(elem, &velem);
-		    if (v != VT_VARIANT)
-		    {
-			VariantChangeTypeEx(&velem, &velem,
-			    LOCALE_SYSTEM_DEFAULT, 0, v);
-		    }
-		    switch (v)
-		    {
-		    /* 128 bits */
-		    case VT_VARIANT:
-			*pv++ = velem;
-			break;
-		    /* 64 bits */
-		    case VT_R8:
-		    case VT_CY:
-		    case VT_DATE:
-			*py++ = V_CY(&velem);
-			break;
-		    /* 16 bits */
-		    case VT_BOOL:
-		    case VT_I2:
-		    case VT_UI2:
-			*ps++ = V_I2(&velem);
-			break;
-		    /* 8 bites */
-		    case VT_UI1:
-		    case VT_I1:
-			*pb++ = V_UI1(&velem);
-			break;
-		    /* 32 bits */
-		    default:
-			*pl++ = V_I4(&velem);
-			break;
-		    }
-		}
-		SafeArrayUnlock(V_ARRAY(&realargs[i]));
-	    }
-	    else
-	    {
-		ole_val2variant(param, &realargs[i]);
-		if ((vt & (~VT_BYREF)) != VT_VARIANT)
-		{
-		    hr = VariantChangeTypeEx(&realargs[i], &realargs[i],
-					     LOCALE_SYSTEM_DEFAULT, 0,
-					     (VARTYPE)(vt & (~VT_BYREF)));
-		    if (hr != S_OK)
-		    {
-			rb_raise(rb_eTypeError, "not valid value");
-		    }
-		}
-	    }
-	    if ((vt & VT_BYREF) || vt == VT_VARIANT)
-	    {
-		if (vt == VT_VARIANT)
-		    V_VT(&dispParams.rgvarg[i]) = VT_VARIANT | VT_BYREF;
-		switch (vt & (~VT_BYREF))
-		{
-		/* 128 bits */
-		case VT_VARIANT:
-		    V_VARIANTREF(&dispParams.rgvarg[i]) = &realargs[i];
-		    break;
-		/* 64 bits */
-		case VT_R8:
-		case VT_CY:
-		case VT_DATE:
-		    V_CYREF(&dispParams.rgvarg[i]) = &V_CY(&realargs[i]);
-		    break;
-		/* 16 bits */
-		case VT_BOOL:
-		case VT_I2:
-		case VT_UI2:
-		    V_I2REF(&dispParams.rgvarg[i]) = &V_I2(&realargs[i]);
-		    break;
-		/* 8 bites */
-		case VT_UI1:
-		case VT_I1:
-		    V_UI1REF(&dispParams.rgvarg[i]) = &V_UI1(&realargs[i]);
-		    break;
-		/* 32 bits */
-		default:
-		    V_I4REF(&dispParams.rgvarg[i]) = &V_I4(&realargs[i]);
-		    break;
-		}
-	    }
-	    else
-	    {
-		/* copy 64 bits of data */
-		V_CY(&dispParams.rgvarg[i]) = V_CY(&realargs[i]);
-	    }
-	}
-    }
-
-    if (dispkind & DISPATCH_PROPERTYPUT) {
-        dispParams.cNamedArgs = 1;
-        dispParams.rgdispidNamedArgs = ALLOCA_N( DISPID, 1 );
-        dispParams.rgdispidNamedArgs[0] = DISPID_PROPERTYPUT;
-    }
-
-    hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, FIX2INT(dispid),
-                                         &IID_NULL, LOCALE_SYSTEM_DEFAULT,
-                                         dispkind,
-                                         &dispParams, &result,
-                                         &excepinfo, &argErr);
-
-    if (FAILED(hr)) {
-        v = ole_excepinfo2msg(&excepinfo);
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "_invoke %s",
-                  StringValuePtr(v));
-    }
-
-    /* clear dispatch parameter */
-    if(dispParams.cArgs > 0) {
-        VALUE argv = rb_cvar_get(cWIN32OLE, rb_intern("ARGV"));
-        rb_funcall(argv, rb_intern("clear"), 0);
-        for(i = dispParams.cArgs - 1; i >= 0; i--) {
-            rb_ary_push(argv, ole_variant2val(&realargs[i]));
-            VariantClear(&realargs[i]);
-        }
-    }
-
-    obj = ole_variant2val(&result);
-    VariantClear(&result);
-    return obj;
-}
-
-/*
- * WIN32OLE#_invoke(dispid, args, types)
- * ----
- * Runs the early binding method.
- * The 1st argument specifies dispatch ID, 
- * the 2nd argument specifies the array of arguments,
- * the 3rd argument specifies the array of the type of arguments.
- */
-static VALUE
-fole_invoke2(self, dispid, args, types)
-    VALUE self;
-    VALUE dispid;
-    VALUE args;
-    VALUE types;
-{
-    return ole_invoke2(self, dispid, args, types, DISPATCH_METHOD);
-}
-
-/*
- * WIN32OLE#_getproperty(dispid, args, types)
- * ----
- * Runs the early binding method to get property.
- * The 1st argument specifies dispatch ID, 
- * the 2nd argument specifies the array of arguments,
- * the 3rd argument specifies the array of the type of arguments.
- */
-static VALUE
-fole_getproperty2(self, dispid, args, types)
-    VALUE self;
-    VALUE dispid;
-    VALUE args;
-    VALUE types;
-{
-    return ole_invoke2(self, dispid, args, types, DISPATCH_PROPERTYGET);
-}
-
-/*
- * WIN32OLE#_setproperty(dispid, args, types)
- * ----
- * Runs the early binding method to set property.
- * The 1st argument specifies dispatch ID, 
- * the 2nd argument specifies the array of arguments,
- * the 3rd argument specifies the array of the type of arguments.
- */
-static VALUE
-fole_setproperty2(self, dispid, args, types)
-    VALUE self;
-    VALUE dispid;
-    VALUE args;
-    VALUE types;
-{
-    return ole_invoke2(self, dispid, args, types, DISPATCH_PROPERTYPUT);
-}
-
-/*
- * WIN32OLE['property']=val 
- *
- * WIN32OLE.setproperty('property', [arg1, arg2,] val)
- * -----
- * Sets property of OLE object.
- * When you want to set property with argument, you can use setproperty method.
- */
-static VALUE
-fole_setproperty(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    return ole_invoke(argc, argv, self, DISPATCH_PROPERTYPUT);
-}
-
-/*
- * WIN32OLE['property'] 
- * -----
- * Returns property of OLE object.
- */
-static VALUE
-fole_getproperty(self, property)
-    VALUE self, property;
-{
-    return ole_invoke(1, &property, self, DISPATCH_PROPERTYGET);
-}
-
-static VALUE
-ole_propertyput(self, property, value)
-    VALUE self, property, value;
-{
-    struct oledata *pole;
-    unsigned argErr;
-    unsigned int index;
-    HRESULT hr;
-    EXCEPINFO excepinfo;
-    DISPID dispID = DISPID_VALUE;
-    DISPID dispIDParam = DISPID_PROPERTYPUT;
-    USHORT wFlags = DISPATCH_PROPERTYPUT;
-    DISPPARAMS dispParams;
-    VARIANTARG propertyValue[2];
-    OLECHAR* pBuf[1];
-    VALUE v;
-    LCID    lcid = LOCALE_SYSTEM_DEFAULT;
-    dispParams.rgdispidNamedArgs = &dispIDParam;
-    dispParams.rgvarg = propertyValue;
-    dispParams.cNamedArgs = 1;
-    dispParams.cArgs = 1;
-
-    VariantInit(&propertyValue[0]);
-    VariantInit(&propertyValue[1]);
-    memset(&excepinfo, 0, sizeof(excepinfo));
-
-    Data_Get_Struct(self, struct oledata, pole);
-
-    /* get ID from property name */
-    pBuf[0]  = ole_mb2wc(StringValuePtr(property), -1);
-    hr = pole->pDispatch->lpVtbl->GetIDsOfNames(pole->pDispatch, &IID_NULL,
-                                                pBuf, 1, lcid, &dispID);
-    SysFreeString(pBuf[0]);
-    pBuf[0] = NULL;
-
-    if(FAILED(hr)) {
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, 
-                  "Unknown property or method : `%s'",
-                  StringValuePtr(property));
-    }
-    /* set property value */
-    ole_val2variant(value, &propertyValue[0]);
-    hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, dispID, &IID_NULL, 
-                                         lcid, wFlags, &dispParams,
-                                         NULL, &excepinfo, &argErr);
-
-    for(index = 0; index < dispParams.cArgs; ++index) {
-        VariantClear(&propertyValue[index]);
-    }
-    if (FAILED(hr)) {
-        v = ole_excepinfo2msg(&excepinfo);
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, StringValuePtr(v));
-    }
-    return Qnil;
-}
-
-/*
- * WIN32OLE#each {|i|...}
- * -----
- * Iterates over each item of OLE collection which has IEnumVARIANT interface.
- */
-static VALUE
-fole_each(self)
-    VALUE self;
-{
-    LCID    lcid = LOCALE_SYSTEM_DEFAULT;
-
-    struct oledata *pole;
-
-    unsigned int argErr;
-    EXCEPINFO excepinfo;
-    DISPPARAMS dispParams;
-    VARIANT result, variant;
-    HRESULT hr;
-    IEnumVARIANT *pEnum = NULL;
-
-    VALUE obj;
-
-    VariantInit(&result);
-    dispParams.rgvarg = NULL;
-    dispParams.rgdispidNamedArgs = NULL;
-    dispParams.cNamedArgs = 0;
-    dispParams.cArgs = 0;
-    memset(&excepinfo, 0, sizeof(excepinfo));
-    
-    Data_Get_Struct(self, struct oledata, pole);
-    hr = pole->pDispatch->lpVtbl->Invoke(pole->pDispatch, DISPID_NEWENUM,
-                                         &IID_NULL, lcid,
-                                         DISPATCH_METHOD | DISPATCH_PROPERTYGET,
-                                         &dispParams, &result,
-                                         &excepinfo, &argErr);
-
-    if (FAILED(hr)) {
-        VariantClear(&result);
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Fail to get IEnum Interface");
-    }
-
-    if (V_VT(&result) == VT_UNKNOWN)
-        hr = V_UNKNOWN(&result)->lpVtbl->QueryInterface(V_UNKNOWN(&result),
-                                                        &IID_IEnumVARIANT,
-                                                        (void**)&pEnum);
-    else if (V_VT(&result) == VT_DISPATCH)
-        hr = V_DISPATCH(&result)->lpVtbl->QueryInterface(V_DISPATCH(&result),
-                                                         &IID_IEnumVARIANT,
-                                                         (void**)&pEnum);
-    if (FAILED(hr) || !pEnum) {
-        VariantClear(&result);
-        ole_raise(hr, rb_eRuntimeError, "Fail to get IEnum Interface");
-    }
-
-    VariantInit(&variant);
-    while(pEnum->lpVtbl->Next(pEnum, 1, &variant, NULL) == S_OK) {
-        obj = ole_variant2val(&variant);
-        rb_yield(obj);
-        VariantClear(&variant);
-        VariantInit(&variant);
-    }
-    VariantClear(&result);
-    OLE_RELEASE(pEnum);
-    return Qnil;
-}
-
-/*
- * WIN32OLE#method_missing(id [,arg1, arg2, ...])
- * ----
- * Calls WIN32OLE#invoke method.
- */
-static VALUE
-fole_missing(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    ID id;
-    char* mname;
-    int n;
-    id = rb_to_id(argv[0]);
-    mname = rb_id2name(id);
-    if(!mname) {
-        rb_raise(rb_eRuntimeError, "Fail : Unknown method or property");
-    }
-    n = strlen(mname);
-    if(mname[n-1] == '=') {
-        argv[0] = rb_str_new(mname, n-1);
-
-        return ole_propertyput(self, argv[0], argv[1]);
-    }
-    else {
-        argv[0] = rb_str_new2(mname);
-        return ole_invoke(argc, argv, self, DISPATCH_METHOD|DISPATCH_PROPERTYGET);
-    }
-}
-
-static VALUE
-ole_methods_sub(pOwnerTypeInfo, pTypeInfo, methods, mask)
-    ITypeInfo *pOwnerTypeInfo;
-    ITypeInfo *pTypeInfo;
-    VALUE     methods;
-    int       mask;
-{
-    HRESULT hr;
-    TYPEATTR *pTypeAttr;
-    BSTR bstr;
-    char *pstr;
-    FUNCDESC *pFuncDesc;
-    VALUE method;
-    WORD i;
-    hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-    if (FAILED(hr)) {
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Fail to GetTypeAttr");
-    }
-    for(i = 0; i < pTypeAttr->cFuncs; i++) {
-        pstr = NULL;
-        hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, i, &pFuncDesc);
-	if (FAILED(hr))
-	     continue;
-                 
-        hr = pTypeInfo->lpVtbl->GetDocumentation(pTypeInfo, pFuncDesc->memid,
-                                                 &bstr, NULL, NULL, NULL);
-        if (FAILED(hr)) {
-            pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-            continue;
-        }
-	if(pFuncDesc->invkind & mask) {
-	    method = folemethod_s_allocate(cWIN32OLE_METHOD);
-	    olemethod_set_member(method, pTypeInfo, pOwnerTypeInfo, 
-	                         i, WC2VSTR(bstr));
-            rb_ary_push(methods, method);
-        }
-        pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-	pFuncDesc=NULL;
-    }
-    OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-
-    return methods;
-}
-
-static VALUE
-ole_methods_from_typeinfo(pTypeInfo, mask)
-    ITypeInfo *pTypeInfo;
-    int mask;
-{
-    HRESULT hr;
-    TYPEATTR *pTypeAttr;
-    WORD i;
-    HREFTYPE href;
-    ITypeInfo *pRefTypeInfo;
-    VALUE methods = rb_ary_new();
-    hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-    if (FAILED(hr)) {
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Fail to GetTypeAttr");
-    }
-
-    ole_methods_sub(0, pTypeInfo, methods, mask);
-    for(i=0; i < pTypeAttr->cImplTypes; i++){
-       hr = pTypeInfo->lpVtbl->GetRefTypeOfImplType(pTypeInfo, i, &href);
-       if(FAILED(hr))
-           continue;
-       hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo, href, &pRefTypeInfo);
-       if (FAILED(hr))
-           continue;
-       ole_methods_sub(pTypeInfo, pRefTypeInfo, methods, mask);
-       OLE_RELEASE(pRefTypeInfo);
-    }
-    OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-    return methods;
-}
-
-static VALUE
-ole_methods(self,mask)
-    VALUE self;
-    int mask;
-{
-    UINT iVar;
-    UINT count;
-    ITypeInfo *pTypeInfo;
-    HRESULT hr;
-    VALUE methods;
-    struct oledata *pole;
-    LCID    lcid = LOCALE_SYSTEM_DEFAULT;
-
-    Data_Get_Struct(self, struct oledata, pole);
-    methods = rb_ary_new();
-    count = 0;
-
-    hr = pole->pDispatch->lpVtbl->GetTypeInfoCount(pole->pDispatch, &count);
-    if (FAILED(hr))
-        return methods;
-    for( iVar=0; iVarpDispatch->lpVtbl->GetTypeInfo( pole->pDispatch, 0, lcid, &pTypeInfo );
-        if(FAILED(hr)) 
-            continue;
-        rb_ary_concat(methods, ole_methods_from_typeinfo(pTypeInfo, mask));
-        OLE_RELEASE(pTypeInfo);
-    }
-    return methods;
-}
-
-/*
- * WIN32OLE#ole_methods
- * ----
- * Returns OLE methods
- */
-static VALUE
-fole_methods( self )
-    VALUE self;
-{
-    return ole_methods( self, INVOKE_FUNC | INVOKE_PROPERTYGET | INVOKE_PROPERTYPUT);
-}
-
-/*
- * WIN32OLE#ole_get_methods
- * ----
- * Returns get properties.
- */
-static VALUE
-fole_get_methods( argc, argv, self )
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    return ole_methods( self, INVOKE_PROPERTYGET);
-}
-
-/*
- * WIN32OLE#ole_put_methods
- * ----
- * Returns put properties.
- */
-static VALUE
-fole_put_methods( argc, argv, self )
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    return ole_methods( self, INVOKE_PROPERTYPUT);
-}
-
-/*
- * WIN32OLE#ole_func_methods
- * ---
- * Returns OLE func methods.
- */
-static VALUE
-fole_func_methods( argc, argv, self )
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    return ole_methods( self, INVOKE_FUNC);
-}
-
-/*
- * WIN32OLE#ole_obj_help
- * ----
- * Returns WIN32OLE_TYPE object.
- */
-static VALUE
-fole_obj_help( self )
-    VALUE self;
-{
-    unsigned int index;
-    ITypeInfo *pTypeInfo;
-    ITypeLib *pTypeLib;
-    HRESULT hr;
-    struct oledata *pole;
-    BSTR bstr;
-    LCID  lcid = LOCALE_SYSTEM_DEFAULT;
-    VALUE type = Qnil;
-
-    Data_Get_Struct(self, struct oledata, pole);
-
-    hr = pole->pDispatch->lpVtbl->GetTypeInfo( pole->pDispatch, 0, lcid, &pTypeInfo );
-    if(FAILED(hr)) {
-        ole_raise(hr, rb_eRuntimeError, "fail to GetTypeInfo");
-    }
-    hr = pTypeInfo->lpVtbl->GetContainingTypeLib( pTypeInfo, &pTypeLib, &index );
-    if(FAILED(hr)) {
-        OLE_RELEASE(pTypeInfo);
-        ole_raise(hr, rb_eRuntimeError, "fail to GetContainingTypeLib");
-    }
-    hr = pTypeLib->lpVtbl->GetDocumentation( pTypeLib, index,
-                                             &bstr, NULL, NULL, NULL);
-    if (SUCCEEDED(hr)) {
-        type = foletype_s_allocate(cWIN32OLE_TYPE);
-	oletype_set_member(type, pTypeInfo, WC2VSTR(bstr));
-    }
-    OLE_RELEASE(pTypeLib);
-    OLE_RELEASE(pTypeInfo);
-
-    return type;
-}
-
-static HRESULT
-ole_docinfo_from_type(pTypeInfo, name, helpstr, helpcontext, helpfile)
-    ITypeInfo *pTypeInfo;
-    BSTR *name;
-    BSTR *helpstr; 
-    DWORD *helpcontext;
-    BSTR *helpfile;
-{
-    HRESULT hr;
-    ITypeLib *pTypeLib;
-    UINT i;
-
-    hr = pTypeInfo->lpVtbl->GetContainingTypeLib(pTypeInfo, &pTypeLib, &i);
-    if (FAILED(hr)) {
-        return hr;
-    }
-    
-    hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, i,
-                                            name, helpstr, 
-                                            helpcontext, helpfile);
-    if (FAILED(hr)) {
-        OLE_RELEASE(pTypeLib);
-        return hr;
-    }
-    OLE_RELEASE(pTypeLib);
-    return hr;
-}
-
-static VALUE
-ole_usertype2val(pTypeInfo, pTypeDesc, typedetails)
-    ITypeInfo *pTypeInfo;
-    TYPEDESC *pTypeDesc;
-    VALUE typedetails;
-{
-    HRESULT hr;
-    BSTR bstr;
-    ITypeInfo *pRefTypeInfo;
-    VALUE type = Qnil;
-
-    hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo, 
-                                           V_UNION1(pTypeDesc, hreftype),
-				           &pRefTypeInfo);
-    if(FAILED(hr))
-        return Qnil;
-    hr = ole_docinfo_from_type(pRefTypeInfo, &bstr, NULL, NULL, NULL);
-    if(FAILED(hr)) {
-        OLE_RELEASE(pRefTypeInfo);
-        return Qnil;
-    }
-    OLE_RELEASE(pRefTypeInfo);
-    type = WC2VSTR(bstr);
-    if(typedetails != Qnil)
-        rb_ary_push(typedetails, type);
-    return type;
-}
-
-static VALUE ole_typedesc2val();
-static VALUE
-ole_ptrtype2val(pTypeInfo, pTypeDesc, typedetails) 
-    ITypeInfo *pTypeInfo;
-    TYPEDESC *pTypeDesc;
-    VALUE typedetails;
-{    
-    TYPEDESC *p = pTypeDesc;
-    VALUE type = rb_str_new2("");
-    while(p->vt == VT_PTR || p->vt == VT_SAFEARRAY) {
-	p = V_UNION1(p, lptdesc);
-	if(strlen(StringValuePtr(type)) == 0) {
-	   type = ole_typedesc2val(pTypeInfo, p, typedetails);
-	} else {
-	   rb_str_cat(type, ",", 1);
-           rb_str_concat(type, ole_typedesc2val(pTypeInfo, p, typedetails));
-	}
-    }
-    return type;
-}
-
-static VALUE
-ole_typedesc2val(pTypeInfo, pTypeDesc, typedetails)
-    ITypeInfo *pTypeInfo;
-    TYPEDESC *pTypeDesc;
-    VALUE typedetails;
-{
-    VALUE str;
-    switch(pTypeDesc->vt) {
-    case VT_I2:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("I2"));
-        return rb_str_new2("I2");
-    case VT_I4:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("I4"));
-        return rb_str_new2("I4");
-    case VT_R4:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("R4"));
-        return rb_str_new2("R4");
-    case VT_R8:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("R8"));
-        return rb_str_new2("R8");
-    case VT_CY:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("CY"));
-        return rb_str_new2("CY");
-    case VT_DATE:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("DATE"));
-        return rb_str_new2("DATE");
-    case VT_BSTR:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("BSTR"));
-        return rb_str_new2("BSTR");
-    case VT_BOOL:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("BOOL"));
-        return rb_str_new2("BOOL");
-    case VT_VARIANT:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("VARIANT"));
-        return rb_str_new2("VARIANT");
-    case VT_DECIMAL:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("DECIMAL"));
-        return rb_str_new2("DECIMAL");
-    case VT_I1:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("I1"));
-        return rb_str_new2("I1");
-    case VT_UI1:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("UI1"));
-        return rb_str_new2("UI1");
-    case VT_UI2:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("UI2"));
-        return rb_str_new2("UI2");
-    case VT_UI4:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("UI4"));
-        return rb_str_new2("UI4");
-    case VT_I8:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("I8"));
-        return rb_str_new2("I8");
-    case VT_UI8:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("UI8"));
-        return rb_str_new2("UI8");
-    case VT_INT:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("INT"));
-        return rb_str_new2("INT");
-    case VT_UINT:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("UINT"));
-        return rb_str_new2("UINT");
-    case VT_VOID:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("VOID"));
-        return rb_str_new2("VOID");
-    case VT_HRESULT:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("HRESULT"));
-        return rb_str_new2("HRESULT");
-    case VT_PTR:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("PTR"));
-        return ole_ptrtype2val(pTypeInfo, pTypeDesc, typedetails);
-    case VT_SAFEARRAY:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("SAFEARRAY"));
-        return ole_ptrtype2val(pTypeInfo, pTypeDesc, typedetails);
-    case VT_CARRAY:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("CARRAY"));
-        return rb_str_new2("CARRAY");
-    case VT_USERDEFINED:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("USERDEFINED"));
-        str = ole_usertype2val(pTypeInfo, pTypeDesc, typedetails);
-	if (str != Qnil) {
-	    return str;
-	}
-        return rb_str_new2("USERDEFINED");
-    case VT_UNKNOWN:
-	return rb_str_new2("UNKNOWN");
-    case VT_DISPATCH:
-        if(typedetails != Qnil)
-            rb_ary_push(typedetails, rb_str_new2("DISPATCH"));
-	return rb_str_new2("DISPATCH");
-    default:
-        str = rb_str_new2("Unknown Type ");
-        rb_str_concat(str, rb_fix2str(INT2FIX(pTypeDesc->vt), 10));
-        return str;
-    }
-}
-
-/*
- * WIN32OLE#ole_method_help(method)
- * -----
- * Returns WIN32OLE_METHOD object corresponding with method 
- * specified by 1st argument.
- */
-static VALUE
-fole_method_help( self, cmdname )
-    VALUE self;
-    VALUE cmdname;
-{
-    ITypeInfo *pTypeInfo;
-    HRESULT hr;
-    struct oledata *pole;
-    VALUE method, obj;
-    LCID    lcid = LOCALE_SYSTEM_DEFAULT;
-
-    Check_SafeStr(cmdname);
-    Data_Get_Struct(self, struct oledata, pole);
-    hr = pole->pDispatch->lpVtbl->GetTypeInfo( pole->pDispatch, 0, lcid, &pTypeInfo );
-    if(FAILED(hr)) {
-        ole_raise(hr, rb_eRuntimeError, "fail to GetTypeInfo");
-    }
-    method = folemethod_s_allocate(cWIN32OLE_METHOD);
-    obj = olemethod_from_typeinfo(method, pTypeInfo, cmdname);
-    OLE_RELEASE(pTypeInfo);
-    if (obj == Qnil)
-        rb_raise(eWIN32OLE_RUNTIME_ERROR, "Not found %s",
-	         StringValuePtr(cmdname));
-    return obj;
-}
-
-/*
- * WIN32OLE.ole_classes(typelibrary)
- * ----
- * Returns array of WIN32OLE_TYPE objects defined by type library.
- */
-static VALUE
-foletype_s_ole_classes(self, typelib)
-    VALUE self;
-    VALUE typelib;
-{
-    VALUE file, classes;
-    OLECHAR * pbuf;
-    ITypeLib *pTypeLib;
-    HRESULT hr;
-
-    classes = rb_ary_new();
-    if(TYPE(typelib) == T_STRING) {
-        file = typelib_file(typelib);
-        if (file == Qnil) {
-	    file = typelib;
-        }
-        pbuf = ole_mb2wc(StringValuePtr(file), -1);
-        hr = LoadTypeLibEx(pbuf, REGKIND_NONE, &pTypeLib);
-	if (FAILED(hr))
-          ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Fail to LoadTypeLibEx");
-        SysFreeString(pbuf);
-        ole_classes_from_typelib(pTypeLib, classes);
-	OLE_RELEASE(pTypeLib);
-    } else {
-	rb_raise(rb_eTypeError, "1st argument should be TypeLib string");
-    }
-    return classes;
-}
-
-/*
- * WIN32OLE_TYPE.typelibs
- * ----
- * Returns array of type libraries.
- */
-static VALUE
-foletype_s_typelibs(self)
-    VALUE self;
-{
-    HKEY htypelib, hclsid;
-    double fversion;
-    DWORD i, j;
-    LONG err;
-    VALUE clsid;
-    VALUE ver;
-    VALUE v = Qnil;
-    VALUE typelibs = rb_ary_new();
-
-    err = reg_open_key(HKEY_CLASSES_ROOT, "TypeLib", &htypelib);
-    if(err != ERROR_SUCCESS) {
-        return typelibs;
-    }
-    for(i = 0; ; i++) {
-        clsid = reg_enum_key(htypelib, i);
-        if (clsid == Qnil)
-            break;
-        err = reg_open_vkey(htypelib, clsid, &hclsid);
-        if (err != ERROR_SUCCESS)
-            continue;
-        fversion = 0;
-        for(j = 0; ; j++) {
-            ver = reg_enum_key(hclsid, j);
-            if (ver == Qnil)
-                break;
-            if (fversion > atof(StringValuePtr(ver)))
-                continue;
-            fversion = atof(StringValuePtr(ver));
-            if ( (v = reg_get_val(hclsid, StringValuePtr(ver))) != Qnil ) {
-                rb_ary_push(typelibs, v);
-            }
-        }
-        RegCloseKey(hclsid);
-    }
-    RegCloseKey(htypelib);
-    return typelibs;
-}
-
-/*
- * WIN32OLE_TYPE.progids
- * ---
- * Returns array of ProgID.
- */
-static VALUE
-foletype_s_progids(self)
-    VALUE self;
-{
-    HKEY hclsids, hclsid;
-    DWORD i;
-    LONG err;
-    VALUE clsid;
-    VALUE v = rb_str_new2("");
-    VALUE progids = rb_ary_new();
-
-    err = reg_open_key(HKEY_CLASSES_ROOT, "CLSID", &hclsids);
-    if(err != ERROR_SUCCESS) {
-        return progids;
-    }
-    for(i = 0; ; i++) {
-        clsid = reg_enum_key(hclsids, i);
-        if (clsid == Qnil)
-            break;
-        err = reg_open_vkey(hclsids, clsid, &hclsid);
-        if (err != ERROR_SUCCESS)
-            continue;
-        if ((v = reg_get_val(hclsid, "ProgID")) != Qnil) 
-            rb_ary_push(progids, v);
-        if ((v = reg_get_val(hclsid, "VersionIndependentProgID")) != Qnil)
-            rb_ary_push(progids, v);
-        RegCloseKey(hclsid);
-    }
-    RegCloseKey(hclsids);
-    return progids;
-}
-
-static VALUE
-foletype_s_allocate(klass)
-    VALUE klass;
-{
-    struct oletypedata *poletype;
-    VALUE obj;
-    ole_initialize();
-    obj = Data_Make_Struct(klass,struct oletypedata,0,oletype_free,poletype);
-    poletype->pTypeInfo = NULL;
-    return obj;
-}
-
-static VALUE
-oletype_set_member(self, pTypeInfo, name)
-    VALUE self;
-    ITypeInfo *pTypeInfo;
-    VALUE name;
-{
-    struct oletypedata *ptype;
-    Data_Get_Struct(self, struct oletypedata, ptype);
-    rb_ivar_set(self, rb_intern("name"), name);
-    ptype->pTypeInfo = pTypeInfo;
-    if(pTypeInfo) OLE_ADDREF(pTypeInfo);
-    return self;
-}
-
-static VALUE
-oleclass_from_typelib(self, pTypeLib, oleclass)
-    VALUE self;
-    ITypeLib *pTypeLib;
-    VALUE oleclass;
-{
-    
-    long count;
-    int i;
-    HRESULT hr;
-    BSTR bstr;
-    VALUE typelib;
-    ITypeInfo *pTypeInfo;
-
-    VALUE found = Qfalse;
-  
-    count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib);
-    for (i = 0; i < count && found == Qfalse; i++) {
-        hr = pTypeLib->lpVtbl->GetTypeInfo(pTypeLib, i, &pTypeInfo);
-        if (FAILED(hr))
-            continue;
-        hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, i,
-                                                &bstr, NULL, NULL, NULL);
-        if (FAILED(hr)) 
-	    continue;
-        typelib = WC2VSTR(bstr);
-	if (rb_str_cmp(oleclass, typelib) == 0) {
-            oletype_set_member(self, pTypeInfo, typelib);
-	    found = Qtrue;
-	}
-	OLE_RELEASE(pTypeInfo);
-    }
-    return found;
-}
-
-static VALUE
-foletype_initialize(self, typelib, oleclass)
-    VALUE self;
-    VALUE typelib;
-    VALUE oleclass;
-{
-    VALUE file;
-    OLECHAR * pbuf;
-    ITypeLib *pTypeLib;
-    HRESULT hr;
-
-    Check_SafeStr(oleclass);
-    Check_SafeStr(typelib);
-    file = typelib_file(typelib);
-    if (file == Qnil) {
-        file = typelib;
-    }
-    pbuf = ole_mb2wc(StringValuePtr(file), -1);
-    hr = LoadTypeLibEx(pbuf, REGKIND_NONE, &pTypeLib);
-    if (FAILED(hr))
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Fail to LoadTypeLibEx");
-    SysFreeString(pbuf);
-    if (oleclass_from_typelib(self, pTypeLib, oleclass) == Qfalse) {
-        OLE_RELEASE(pTypeLib);
-        rb_raise(eWIN32OLE_RUNTIME_ERROR, "Not found `%s` in `%s`",
-	         StringValuePtr(oleclass), StringValuePtr(typelib));
-    }
-    OLE_RELEASE(pTypeLib);
-    return self;
-}
-
-/*
- * WIN32OLE_TYPE#name
- * ---
- * Returns name.
- */
-static VALUE
-foletype_name(self)
-    VALUE self;
-{
-    return rb_ivar_get(self, rb_intern("name"));
-}
-
-static VALUE
-ole_ole_type(pTypeInfo)
-    ITypeInfo *pTypeInfo;
-{
-    HRESULT hr;
-    TYPEATTR *pTypeAttr;
-    VALUE type = Qnil;
-    hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-    if(FAILED(hr)){
-        return type;
-    }
-    switch(pTypeAttr->typekind) {
-    case TKIND_ENUM:
-        type = rb_str_new2("Enum");
-        break;
-    case TKIND_RECORD:
-        type = rb_str_new2("Record");
-        break;
-    case TKIND_MODULE:
-        type = rb_str_new2("Module");
-        break;
-    case TKIND_INTERFACE:
-        type = rb_str_new2("Interface");
-        break;
-    case TKIND_DISPATCH:
-        type = rb_str_new2("Dispatch");
-        break;
-    case TKIND_COCLASS:
-        type = rb_str_new2("Class");
-        break;
-    case TKIND_ALIAS:
-        type = rb_str_new2("Alias");
-        break;
-    case TKIND_UNION:
-        type = rb_str_new2("Union");
-        break;
-    case TKIND_MAX:
-        type = rb_str_new2("Max");
-        break;
-    default:
-        type = Qnil;
-        break;
-    }
-    OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-    return type;
-}
-
-/*
- * WIN32OLE_TYPE#ole_type
- * ----
- * returns type of class.
- */
-static VALUE
-foletype_ole_type(self)
-    VALUE self;
-{
-    struct oletypedata *ptype;
-    Data_Get_Struct(self, struct oletypedata, ptype);
-    return ole_ole_type(ptype->pTypeInfo);
-}
-
-static VALUE
-ole_type_guid(pTypeInfo) 
-    ITypeInfo *pTypeInfo;
-{
-    HRESULT hr;
-    TYPEATTR *pTypeAttr;
-    int len;
-    OLECHAR bstr[80];
-    VALUE guid = Qnil;
-    hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-    if (FAILED(hr)) 
-        return guid;
-    len = StringFromGUID2(&pTypeAttr->guid, bstr, sizeof(bstr)/sizeof(OLECHAR));
-    if (len > 3) {
-        guid = ole_wc2vstr(bstr, FALSE);
-    }
-    OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-    return guid;
-}
-
-/*
- * WIN32OLE_TYPE#guid
- * ----
- * Returns GUID.
- */
-static VALUE
-foletype_guid(self)
-{
-    struct oletypedata *ptype;
-    Data_Get_Struct(self, struct oletypedata, ptype);
-    return ole_type_guid(ptype->pTypeInfo);
-}
-
-static VALUE
-ole_type_progid(pTypeInfo)
-    ITypeInfo *pTypeInfo;
-{
-    HRESULT hr;
-    TYPEATTR *pTypeAttr;
-    OLECHAR *pbuf;
-    VALUE progid = Qnil;
-    hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-    if (FAILED(hr)) 
-        return progid;
-    hr = ProgIDFromCLSID(&pTypeAttr->guid, &pbuf);
-    if (SUCCEEDED(hr)) 
-        progid = WC2VSTR(pbuf);
-    OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-    return progid;
-}
-
-/*
- * WIN32OLE_TYPE#progid
- * ----
- * Returns ProgID if it exists. If not found, then returns nil.
- */
-static VALUE
-foletype_progid(self)
-{
-    struct oletypedata *ptype;
-    Data_Get_Struct(self, struct oletypedata, ptype);
-    return ole_type_progid(ptype->pTypeInfo);
-}
-
-
-static VALUE
-ole_type_visible(pTypeInfo) 
-    ITypeInfo *pTypeInfo;
-{
-    HRESULT hr;
-    TYPEATTR *pTypeAttr;
-    VALUE visible;
-    hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-    if (FAILED(hr)) 
-        return Qtrue;
-    if (pTypeAttr->wTypeFlags & (TYPEFLAG_FHIDDEN | TYPEFLAG_FRESTRICTED)) {
-        visible = Qfalse;
-    } else {
-        visible = Qtrue;
-    }
-    OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-    return visible;
-}
-
-/*
- * WIN32OLE_TYPE#visible
- * ----
- * returns true if the OLE class is public.
- */
-static VALUE
-foletype_visible(self)
-    VALUE self;
-{
-    struct oletypedata *ptype;
-    Data_Get_Struct(self, struct oletypedata, ptype);
-    return ole_type_visible(ptype->pTypeInfo);
-}
-
-static VALUE
-ole_type_major_version(pTypeInfo)
-    ITypeInfo *pTypeInfo;
-{
-    VALUE ver;
-    TYPEATTR *pTypeAttr;
-    HRESULT hr;
-    hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-    if (FAILED(hr))
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Fail to GetTypeAttr");
-    ver = INT2FIX(pTypeAttr->wMajorVerNum);
-    OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-    return ver;
-}
-
-/*
- * WIN32OLE_TYPE#major_version
- * ----
- * Returns major version.
- */
-static VALUE
-foletype_major_version(self)
-    VALUE self;
-{
-    struct oletypedata *ptype;
-    Data_Get_Struct(self, struct oletypedata, ptype);
-    return ole_type_major_version(ptype->pTypeInfo);
-}
-
-static VALUE
-ole_type_minor_version(pTypeInfo)
-    ITypeInfo *pTypeInfo;
-{
-    VALUE ver;
-    TYPEATTR *pTypeAttr;
-    HRESULT hr;
-    hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-    if (FAILED(hr))
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Fail to GetTypeAttr");
-    ver = INT2FIX(pTypeAttr->wMinorVerNum);
-    OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-    return ver;
-}
-
-/*
- * WIN32OLE_TYPE#minor_version
- * ----
- * Returns minor version.
- */
-static VALUE
-foletype_minor_version(self)
-    VALUE self;
-{
-    struct oletypedata *ptype;
-    Data_Get_Struct(self, struct oletypedata, ptype);
-    return ole_type_minor_version(ptype->pTypeInfo);
-}
-
-static VALUE
-ole_type_typekind(pTypeInfo)
-    ITypeInfo *pTypeInfo;
-{
-    VALUE typekind;
-    TYPEATTR *pTypeAttr;
-    HRESULT hr;
-    hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-    if (FAILED(hr))
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Fail to GetTypeAttr");
-    typekind = INT2FIX(pTypeAttr->typekind);
-    OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-    return typekind;
-}
-
-/*
- * WIN32OLE_TYPE#typekind
- * ----
- * Returns number which represents type.
- */
-static VALUE 
-foletype_typekind(self)
-    VALUE self;
-{
-    struct oletypedata *ptype;
-    Data_Get_Struct(self, struct oletypedata, ptype);
-    return ole_type_typekind(ptype->pTypeInfo);
-}
-
-static VALUE
-ole_type_helpstring(pTypeInfo)
-    ITypeInfo *pTypeInfo;
-{
-    HRESULT hr;
-    BSTR bhelpstr;
-    hr = ole_docinfo_from_type(pTypeInfo, NULL, &bhelpstr, NULL, NULL);
-    if(FAILED(hr)) {
-        return Qnil;
-    }
-    return WC2VSTR(bhelpstr);
-}
-
-/*
- * WIN32OLE_TYPE#helpstring
- * ---
- * Returns help string.
- */
-static VALUE 
-foletype_helpstring(self)
-    VALUE self;
-{
-    struct oletypedata *ptype;
-    Data_Get_Struct(self, struct oletypedata, ptype);
-    return ole_type_helpstring(ptype->pTypeInfo);
-}
-
-static VALUE
-ole_type_src_type(pTypeInfo)
-    ITypeInfo *pTypeInfo;
-{
-    HRESULT hr;
-    TYPEATTR *pTypeAttr;
-    VALUE alias = Qnil;
-    hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-    if (FAILED(hr))
-        return alias;
-    if(pTypeAttr->typekind != TKIND_ALIAS) {
-        OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-	return alias;
-    }
-    alias = ole_typedesc2val(pTypeInfo, &(pTypeAttr->tdescAlias), Qnil);
-    OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-    return alias;
-}
-
-/*
- * WIN32OLE_TYPE#src_type
- * ----
- * Returns source class when the OLE class is 'Alias'.
- */
-static VALUE
-foletype_src_type(self)
-    VALUE self;
-{
-    struct oletypedata *ptype;
-    Data_Get_Struct(self, struct oletypedata, ptype);
-    return ole_type_src_type(ptype->pTypeInfo);
-}
-
-static VALUE
-ole_type_helpfile(pTypeInfo)
-    ITypeInfo *pTypeInfo;
-{
-    HRESULT hr;
-    BSTR bhelpfile;
-    hr = ole_docinfo_from_type(pTypeInfo, NULL, NULL, NULL, &bhelpfile);
-    if(FAILED(hr)) {
-        return Qnil;
-    }
-    return WC2VSTR(bhelpfile);
-}
-
-/*
- * WIN32OLE_TYPE#helpfile
- * ----
- * Returns helpfile
- */
-static VALUE
-foletype_helpfile(self)
-    VALUE self;
-{
-    struct oletypedata *ptype;
-    Data_Get_Struct(self, struct oletypedata, ptype);
-    return ole_type_helpfile(ptype->pTypeInfo);
-}
-
-static VALUE
-ole_type_helpcontext(pTypeInfo)
-    ITypeInfo *pTypeInfo;
-{
-    HRESULT hr;
-    DWORD helpcontext;
-    hr = ole_docinfo_from_type(pTypeInfo, NULL, NULL, 
-                               &helpcontext, NULL);
-    if(FAILED(hr))
-        return Qnil;
-    return INT2FIX(helpcontext);
-}
-
-/*
- * WIN32OLE_TYPE#helpcontext
- * ---
- * Returns helpcontext.
- */
-static VALUE
-foletype_helpcontext(self)
-    VALUE self;
-{
-    struct oletypedata *ptype;
-    Data_Get_Struct(self, struct oletypedata, ptype);
-    return ole_type_helpcontext(ptype->pTypeInfo);
-}
-
-static VALUE
-ole_variables(pTypeInfo)
-    ITypeInfo *pTypeInfo;
-{
-    HRESULT hr;
-    TYPEATTR *pTypeAttr;
-    WORD i;
-    UINT len;
-    BSTR bstr;
-    char *pstr;
-    VARDESC *pVarDesc;
-    struct olevariabledata *pvar;
-    VALUE var;
-    VALUE variables = rb_ary_new();
-    hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-    if (FAILED(hr)) {
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Fail to GetTypeAttr");
-    }
-    
-    for(i = 0; i < pTypeAttr->cVars; i++) {
-        hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, i, &pVarDesc);
-        if(FAILED(hr))
-            continue;
-        len = 0;
-	pstr = NULL;
-        hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, pVarDesc->memid, &bstr,
-                                         1, &len);
-        if(FAILED(hr) || len == 0 || !bstr)
-            continue;
-
-        var = Data_Make_Struct(cWIN32OLE_VARIABLE, struct olevariabledata,
-	                       0,olevariable_free,pvar);
-        pvar->pTypeInfo = pTypeInfo;
-        OLE_ADDREF(pTypeInfo);
-        pvar->index = i;
-	rb_ivar_set(var, rb_intern("name"), WC2VSTR(bstr));
-        rb_ary_push(variables, var);
-
-        pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
-	pVarDesc = NULL;
-    }
-    OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-    return variables;
-}
-
-/*
- * WIN32OLE_TYPE#variables
- * ----
- * Returns array of variables defined in OLE class.
- */
-static VALUE
-foletype_variables(self)
-    VALUE self;
-{
-    struct oletypedata *ptype;
-    Data_Get_Struct(self, struct oletypedata, ptype);
-    return ole_variables(ptype->pTypeInfo);
-}
-
-/*
- * WIN32OLE_TYPE#ole_methods
- * ----
- * Returns array of WIN32OLE_METHOD objects.
- */
-static VALUE
-foletype_methods(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    struct oletypedata *ptype;
-    Data_Get_Struct(self, struct oletypedata, ptype);
-    return ole_methods_from_typeinfo(ptype->pTypeInfo, INVOKE_FUNC | INVOKE_PROPERTYGET | INVOKE_PROPERTYPUT | INVOKE_PROPERTYPUTREF);
-}
-
-/*
- * WIN32OLE_VARIABLE#name
- * ---
- * Returns the name.
- */
-static VALUE
-folevariable_name(self)
-    VALUE self;
-{
-    return rb_ivar_get(self, rb_intern("name"));
-}
-
-static ole_variable_ole_type(pTypeInfo, var_index)
-    ITypeInfo *pTypeInfo;
-    UINT var_index;
-{
-    VARDESC *pVarDesc;
-    HRESULT hr;
-    VALUE type;
-    hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
-    if (FAILED(hr))
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Fail to GetVarDesc");
-    type = ole_typedesc2val(pTypeInfo, &(pVarDesc->elemdescVar.tdesc), Qnil);
-    pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
-    return type;
-}
-
-/*
- * WIN32OLE_VARIABLE#ole_type
- * ----
- * Returns type.
- */
-static VALUE
-folevariable_ole_type(self)
-    VALUE self;
-{
-    struct olevariabledata *pvar;
-    Data_Get_Struct(self, struct olevariabledata, pvar);
-    return ole_variable_ole_type(pvar->pTypeInfo, pvar->index);
-}
-
-static ole_variable_ole_type_detail(pTypeInfo, var_index)
-    ITypeInfo *pTypeInfo;
-    UINT var_index;
-{
-    VARDESC *pVarDesc;
-    HRESULT hr;
-    VALUE type = rb_ary_new();
-    hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
-    if (FAILED(hr))
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Fail to GetVarDesc");
-    ole_typedesc2val(pTypeInfo, &(pVarDesc->elemdescVar.tdesc), type);
-    pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
-    return type;
-}
-
-/*
- * WIN32OLE_VARIABLE#ole_type_detail
- * ---
- * Returns detail information of type. The information is array of type.
- */
-static VALUE
-folevariable_ole_type_detail(self)
-    VALUE self;
-{
-    struct olevariabledata *pvar;
-    Data_Get_Struct(self, struct olevariabledata, pvar);
-    return ole_variable_ole_type_detail(pvar->pTypeInfo, pvar->index);
-}
-
-static ole_variable_value(pTypeInfo, var_index)
-    ITypeInfo *pTypeInfo;
-    UINT var_index;
-{
-    VARDESC *pVarDesc;
-    HRESULT hr;
-    VALUE val = Qnil;
-    hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
-    if (FAILED(hr))
-        return Qnil;
-    if(pVarDesc->varkind == VAR_CONST)
-        val = ole_variant2val(V_UNION1(pVarDesc, lpvarValue));
-    pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
-    return val;
-}
-
-/*
- * WIN32OLE_VARIABLE#value
- * ----
- * Returns value if value is exists. If the value does not exist, 
- * this method returns nil.
- */    
-static VALUE
-folevariable_value(self)
-    VALUE self;
-{
-    struct olevariabledata *pvar;
-    Data_Get_Struct(self, struct olevariabledata, pvar);
-    return ole_variable_value(pvar->pTypeInfo, pvar->index);
-}
-
-static ole_variable_visible(pTypeInfo, var_index)
-    ITypeInfo *pTypeInfo;
-    UINT var_index;
-{
-    VARDESC *pVarDesc;
-    HRESULT hr;
-    VALUE visible = Qfalse;
-    hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
-    if (FAILED(hr))
-        return visible;
-    if (!(pVarDesc->wVarFlags & (VARFLAG_FHIDDEN |
-                                 VARFLAG_FRESTRICTED |
-                                 VARFLAG_FNONBROWSABLE))) {
-        visible = Qtrue;
-    }
-    pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
-    return visible;
-}
-
-/*
- * WIN32OLE_VARIABLE#visible?
- * ----
- * Returns true if the variable is public.
- */
-static VALUE
-folevariable_visible(self)
-    VALUE self;
-{
-    struct olevariabledata *pvar;
-    Data_Get_Struct(self, struct olevariabledata, pvar);
-    return ole_variable_visible(pvar->pTypeInfo, pvar->index);
-}
-
-static VALUE
-ole_variable_kind(pTypeInfo, var_index)
-    ITypeInfo *pTypeInfo;
-    UINT var_index;
-{
-    VARDESC *pVarDesc;
-    HRESULT hr;
-    VALUE kind = rb_str_new2("UNKNOWN");
-    hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
-    if (FAILED(hr))
-        return kind;
-    switch(pVarDesc->varkind) {
-    case VAR_PERINSTANCE:
-        kind = rb_str_new2("PERINSTANCE");
-        break;
-    case VAR_STATIC:
-        kind = rb_str_new2("STATIC");
-        break;
-    case VAR_CONST:
-        kind = rb_str_new2("CONSTANT");
-        break;
-    case VAR_DISPATCH:
-        kind = rb_str_new2("DISPATCH");
-        break;
-    default:
-        break;
-    }
-    pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
-    return kind;
-}
-
-/*
- * WIN32OLE_VARIABLE#variable_kind
- * ----
- * Returns variable kind string.
- */
-static VALUE
-folevariable_variable_kind(self)
-    VALUE self;
-{
-    struct olevariabledata *pvar;
-    Data_Get_Struct(self, struct olevariabledata, pvar);
-    return ole_variable_kind(pvar->pTypeInfo, pvar->index);
-}
-
-static VALUE
-ole_variable_varkind(pTypeInfo, var_index)
-    ITypeInfo *pTypeInfo;
-    UINT var_index;
-{
-    VARDESC *pVarDesc;
-    HRESULT hr;
-    VALUE kind = Qnil;
-    hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, var_index, &pVarDesc);
-    if (FAILED(hr))
-        return kind;
-    pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
-    kind = INT2FIX(pVarDesc->varkind);    
-    return kind;
-}
-
-/*
- * WIN32OLE_VARIABLE#varkind
- * ----
- * Returns the number which represents variable kind.
- */
-static VALUE
-folevariable_varkind(self)
-    VALUE self;
-{
-    struct olevariabledata *pvar;
-    Data_Get_Struct(self, struct olevariabledata, pvar);
-    return ole_variable_varkind(pvar->pTypeInfo, pvar->index);
-}
-
-static VALUE
-ole_method_sub(self, pOwnerTypeInfo, pTypeInfo, name)
-    VALUE self;
-    ITypeInfo *pOwnerTypeInfo;
-    ITypeInfo *pTypeInfo;
-    VALUE name;
-{
-    HRESULT hr;
-    TYPEATTR *pTypeAttr;
-    BSTR bstr;
-    FUNCDESC *pFuncDesc;
-    WORD i;
-    VALUE fname;
-    VALUE method = Qnil;
-    hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-    if (FAILED(hr)) {
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Fail to GetTypeAttr");
-    }
-    for(i = 0; i < pTypeAttr->cFuncs && method == Qnil; i++) {
-        hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, i, &pFuncDesc);
-	if (FAILED(hr))
-	     continue;
-
-        hr = pTypeInfo->lpVtbl->GetDocumentation(pTypeInfo, pFuncDesc->memid,
-                                                 &bstr, NULL, NULL, NULL);
-        if (FAILED(hr)) {
-            pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-            continue;
-        }
-	fname = WC2VSTR(bstr);
-	if (strcasecmp(StringValuePtr(name), StringValuePtr(fname)) == 0) {
-	    olemethod_set_member(self, pTypeInfo, pOwnerTypeInfo, i, fname);
-            method = self;
-        }
-        pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-	pFuncDesc=NULL;
-    }
-    OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-    return method;
-}
-
-static VALUE
-olemethod_from_typeinfo(self, pTypeInfo, name)
-    VALUE self;
-    ITypeInfo *pTypeInfo;
-    VALUE name;
-{
-    HRESULT hr;
-    TYPEATTR *pTypeAttr;
-    WORD i;
-    HREFTYPE href;
-    ITypeInfo *pRefTypeInfo;
-    VALUE method = Qnil;
-    hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-    if (FAILED(hr)) {
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Fail to GetTypeAttr");
-    }
-    method = ole_method_sub(self, 0, pTypeInfo, name);
-    if (method != Qnil) {
-       return method;
-    }
-    for(i=0; i < pTypeAttr->cImplTypes && method == Qnil; i++){
-       hr = pTypeInfo->lpVtbl->GetRefTypeOfImplType(pTypeInfo, i, &href);
-       if(FAILED(hr))
-           continue;
-       hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo, href, &pRefTypeInfo);
-       if (FAILED(hr))
-           continue;
-       method = ole_method_sub(self, pTypeInfo, pRefTypeInfo, name);
-       OLE_RELEASE(pRefTypeInfo);
-    }
-    OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-    return method;
-}
-
-static VALUE
-olemethod_set_member(self, pTypeInfo, pOwnerTypeInfo, index, name)
-    VALUE self;
-    ITypeInfo *pTypeInfo;
-    ITypeInfo *pOwnerTypeInfo;
-    int index;
-    VALUE name;
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    pmethod->pTypeInfo = pTypeInfo;
-    OLE_ADDREF(pTypeInfo);
-    pmethod->pOwnerTypeInfo = pOwnerTypeInfo;
-    if(pOwnerTypeInfo) OLE_ADDREF(pOwnerTypeInfo);
-    pmethod->index = index;
-    rb_ivar_set(self, rb_intern("name"), name);
-    return self;
-}
-
-static VALUE
-folemethod_s_allocate(klass)
-    VALUE klass;
-{
-    struct olemethoddata *pmethod;
-    VALUE obj;
-    obj = Data_Make_Struct(klass, 
-                           struct olemethoddata,
-                           0, olemethod_free, pmethod);
-    pmethod->pTypeInfo = NULL;
-    pmethod->pOwnerTypeInfo = NULL;
-    pmethod->index = 0;
-    return obj;
-}
-
-static VALUE
-folemethod_initialize(self, oletype, method)
-    VALUE self;
-    VALUE oletype;
-    VALUE method;
-{
-    struct oletypedata *ptype;
-    VALUE obj = Qnil;
-    if (rb_obj_is_kind_of(oletype, cWIN32OLE_TYPE)) {
-        Check_SafeStr(method);
-        Data_Get_Struct(oletype, struct oletypedata, ptype);
-	obj = olemethod_from_typeinfo(self, ptype->pTypeInfo, method);
-	if (obj == Qnil) {
-            rb_raise(eWIN32OLE_RUNTIME_ERROR, "Not found %s",
-	             StringValuePtr(method));
-        }
-    }
-    else {
-        rb_raise(rb_eTypeError, "1st argument should be WIN32OLE_TYPE object.");
-    }
-    return obj;
-}
-
-/*
- * WIN32OLE_METHOD#name
- * ----
- * Returns the name of the method.
- */
-static VALUE
-folemethod_name(self)
-    VALUE self;
-{
-    return rb_ivar_get(self, rb_intern("name"));
-}
-
-static VALUE
-ole_method_return_type(pTypeInfo, method_index)
-    ITypeInfo *pTypeInfo;
-    UINT method_index;
-{
-    FUNCDESC *pFuncDesc;
-    HRESULT hr;
-    VALUE type;
-
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if (FAILED(hr)) 
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Fail to GetFuncDesc");
-    
-    type = ole_typedesc2val(pTypeInfo, &(pFuncDesc->elemdescFunc.tdesc), Qnil);
-    pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-    return type;
-}
-
-/*
- * WIN32OLE_METHOD#return_type
- * ----
- * Returns string of return value type of method.
- */
-static VALUE
-folemethod_return_type(self)
-    VALUE self;
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    return ole_method_return_type(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_return_vtype(pTypeInfo, method_index)
-    ITypeInfo *pTypeInfo;
-    UINT method_index;
-{
-    FUNCDESC *pFuncDesc;
-    HRESULT hr;
-    VALUE vt;
-
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if (FAILED(hr)) 
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Fail to GetFuncDesc");
-    
-    vt = INT2FIX(pFuncDesc->elemdescFunc.tdesc.vt);
-    pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-    return vt;
-}
-
-/*
- * WIN32OLE_METHOD#return_vtype
- * ----
- * Returns number of return value type of method.
- */
-static VALUE
-folemethod_return_vtype(self)
-    VALUE self;
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    return ole_method_return_vtype(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_return_type_detail(pTypeInfo, method_index)
-    ITypeInfo *pTypeInfo;
-    UINT method_index;
-{
-    FUNCDESC *pFuncDesc;
-    HRESULT hr;
-    VALUE type = rb_ary_new();
-
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if (FAILED(hr)) 
-        return type;
-    
-    ole_typedesc2val(pTypeInfo, &(pFuncDesc->elemdescFunc.tdesc), type);
-    pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-    return type;
-}
-
-/*
- * WIN32OLE_METHOD#return_type_detail
- * -----
- * Returns detail information of return value type of method.
- * The information is array.
- */
-static VALUE
-folemethod_return_type_detail(self)
-    VALUE self;
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    return ole_method_return_type_detail(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_invkind(pTypeInfo, method_index)
-    ITypeInfo *pTypeInfo;
-    UINT method_index;
-{
-    FUNCDESC *pFuncDesc;
-    HRESULT hr;
-    VALUE invkind;
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if(FAILED(hr)) 
-        ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Fail to GetFuncDesc");
-    invkind = INT2FIX(pFuncDesc->invkind);
-    pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-    return invkind;
-}
-
-static VALUE
-ole_method_invoke_kind(pTypeInfo, method_index)
-    ITypeInfo *pTypeInfo;
-    WORD method_index;
-{
-    VALUE type = rb_str_new2("UNKNOWN");
-    VALUE invkind = ole_method_invkind(pTypeInfo, method_index);
-    if((FIX2INT(invkind) & INVOKE_PROPERTYGET) &&
-       (FIX2INT(invkind) & INVOKE_PROPERTYPUT) ) {
-        type = rb_str_new2("PROPERTY");
-    } else if(FIX2INT(invkind) & INVOKE_PROPERTYGET) {
-        type =  rb_str_new2("PROPERTYGET");
-    } else if(FIX2INT(invkind) & INVOKE_PROPERTYPUT) {
-        type = rb_str_new2("PROPERTYPUT");
-    } else if(FIX2INT(invkind) & INVOKE_PROPERTYPUTREF) {
-        type = rb_str_new2("PROPERTYPUTREF");
-    } else if(FIX2INT(invkind) & INVOKE_FUNC) {
-        type = rb_str_new2("FUNC");
-    }
-    return type;
-}
-
-/*
- * WIN32OLE_MTHOD#invkind
- * ----
- * Returns invkind.
- */
-static VALUE
-folemethod_invkind(self)
-    VALUE self;
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    return ole_method_invkind(pmethod->pTypeInfo, pmethod->index);
-}
-
-/*
- * WIN32OLE_METHOD#invoke_kind
- * ----
- * Returns invoke kind string.
- */
-static VALUE
-folemethod_invoke_kind(self)
-    VALUE self;
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    return ole_method_invoke_kind(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_visible(pTypeInfo, method_index)
-    ITypeInfo *pTypeInfo;
-    UINT method_index;
-{
-    FUNCDESC *pFuncDesc;
-    HRESULT hr;
-    VALUE visible;
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if(FAILED(hr))
-        return Qfalse;
-    if (pFuncDesc->wFuncFlags & (FUNCFLAG_FRESTRICTED |
-                                 FUNCFLAG_FHIDDEN |
-				 FUNCFLAG_FNONBROWSABLE)) {
-        visible = Qfalse;
-    } else {
-        visible = Qtrue;
-    }
-    pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-    return visible;
-}
-
-/*
- * WIN32OLE_METHOD#visible?
- * ----
- * Returns true if the method is public.
- */
-static VALUE
-folemethod_visible(self) 
-    VALUE self;
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    return ole_method_visible(pmethod->pTypeInfo, pmethod->index);
-}
-
-static ole_method_event(pTypeInfo, method_index, method_name)
-    ITypeInfo *pTypeInfo;
-    WORD method_index;
-    VALUE method_name;
-{
-    TYPEATTR *pTypeAttr;
-    HRESULT hr;
-    WORD i;
-    int flags;
-    HREFTYPE href;
-    ITypeInfo *pRefTypeInfo;
-    FUNCDESC *pFuncDesc;
-    BSTR bstr;
-    VALUE name;
-    VALUE event = Qfalse;
-    
-    hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-    if (FAILED(hr)) 
-        return event;
-    if(pTypeAttr->typekind != TKIND_COCLASS) {
-        pTypeInfo->lpVtbl->ReleaseTypeAttr(pTypeInfo, pTypeAttr);
-        return event;
-    }
-    for (i = 0; i < pTypeAttr->cImplTypes; i++) {
-        hr = pTypeInfo->lpVtbl->GetImplTypeFlags(pTypeInfo, i, &flags);
-        if (FAILED(hr))
-            continue;
-
-        if (flags & IMPLTYPEFLAG_FSOURCE) {
-            hr = pTypeInfo->lpVtbl->GetRefTypeOfImplType(pTypeInfo,
-                                                         i, &href);
-            if (FAILED(hr))
-                continue;
-            hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo,
-                                                   href, &pRefTypeInfo);
-            if (FAILED(hr))
-	        continue;
-            hr = pRefTypeInfo->lpVtbl->GetFuncDesc(pRefTypeInfo, method_index, 
-	                                           &pFuncDesc);
-            if (FAILED(hr)) {
-	        OLE_RELEASE(pRefTypeInfo);
-		continue;
-            }
-
-            hr = pRefTypeInfo->lpVtbl->GetDocumentation(pRefTypeInfo, 
-	                                                pFuncDesc->memid,
-                                                        &bstr, NULL, NULL, NULL);
-            if (FAILED(hr)) {
-		pRefTypeInfo->lpVtbl->ReleaseFuncDesc(pRefTypeInfo, pFuncDesc);
-	        OLE_RELEASE(pRefTypeInfo);
-		continue;
-            }
-
-            name = WC2VSTR(bstr);
-	    pRefTypeInfo->lpVtbl->ReleaseFuncDesc(pRefTypeInfo, pFuncDesc);
-	    OLE_RELEASE(pRefTypeInfo);
-	    if (rb_str_cmp(method_name, name) == 0) {
-	        event = Qtrue;
-		break;
-            }
-        }
-    }
-    OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-    return event;
-}
-
-/*
- * WIN32OLE_METHOD#event?
- * ----
- * Returns true if the method is event.
- */
-static VALUE
-folemethod_event(self)
-    VALUE self;
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    if (!pmethod->pOwnerTypeInfo)
-        return Qfalse;
-    return ole_method_event(pmethod->pOwnerTypeInfo, 
-                            pmethod->index,
-                            rb_ivar_get(self, rb_intern("name")));
-}
-
-static VALUE
-folemethod_event_interface(self)
-    VALUE self;
-{
-    BSTR name;
-    struct olemethoddata *pmethod;
-    HRESULT hr;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    if(folemethod_event(self) == Qtrue) {
-        hr = ole_docinfo_from_type(pmethod->pTypeInfo, &name, NULL, NULL, NULL);
-	if(SUCCEEDED(hr))
-	    return WC2VSTR(name);
-    }
-    return Qnil;
-}
-
-static VALUE
-ole_method_docinfo_from_type(pTypeInfo, method_index, name, helpstr,
-                             helpcontext, helpfile)
-    ITypeInfo *pTypeInfo;
-    UINT method_index;
-    BSTR *name;
-    BSTR *helpstr;
-    DWORD *helpcontext;
-    BSTR *helpfile;
-{
-    FUNCDESC *pFuncDesc;
-    HRESULT hr;
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if (FAILED(hr))
-        return hr;
-    hr = pTypeInfo->lpVtbl->GetDocumentation(pTypeInfo, pFuncDesc->memid,
-                                             name, helpstr,
-                                             helpcontext, helpfile);
-    pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-    return hr;
-}
-
-static VALUE
-ole_method_helpstring(pTypeInfo, method_index)
-    ITypeInfo *pTypeInfo;
-    UINT method_index;
-{
-    HRESULT hr;
-    BSTR bhelpstring;
-    hr = ole_method_docinfo_from_type(pTypeInfo, method_index, NULL, &bhelpstring,
-                                      NULL, NULL); 
-    if (FAILED(hr))
-        return Qnil;
-    return WC2VSTR(bhelpstring);
-}
-
-static VALUE
-folemethod_helpstring(self)
-    VALUE self;
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    return ole_method_helpstring(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_helpfile(pTypeInfo, method_index)
-    ITypeInfo *pTypeInfo;
-    UINT method_index;
-{
-    HRESULT hr;
-    BSTR bhelpfile;
-    hr = ole_method_docinfo_from_type(pTypeInfo, method_index, NULL, NULL,
-                                      NULL, &bhelpfile); 
-    if (FAILED(hr))
-        return Qnil;
-    return WC2VSTR(bhelpfile);
-}
-
-/*
- * WIN32OLE_METHOD#helpfile
- * ---
- * Returns help file.
- */
-static VALUE
-folemethod_helpfile(self)
-    VALUE self;
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-
-    return ole_method_helpfile(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_helpcontext(pTypeInfo, method_index)
-    ITypeInfo *pTypeInfo;
-    UINT method_index;
-{
-    HRESULT hr;
-    DWORD helpcontext = 0;
-    hr = ole_method_docinfo_from_type(pTypeInfo, method_index, NULL, NULL,
-                                      &helpcontext, NULL); 
-    if (FAILED(hr))
-        return Qnil;
-    return INT2FIX(helpcontext);
-}
-
-/* 
- * WIN32OLE_METHOD#helpcontext
- * -----
- * Returns help context.
- */
-static VALUE
-folemethod_helpcontext(self)
-    VALUE self;
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    return ole_method_helpcontext(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_dispid(pTypeInfo, method_index)
-    ITypeInfo *pTypeInfo;
-    UINT method_index;
-{
-    FUNCDESC *pFuncDesc;
-    HRESULT hr;
-    VALUE dispid = Qnil;
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if (FAILED(hr))
-        return dispid;
-    dispid = INT2FIX(pFuncDesc->memid); 
-    pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-    return dispid;
-}
-
-/*
- * WIN32OLE_METHOD#dispid
- * ----
- * Returns dispatch ID.
- */
-static VALUE
-folemethod_dispid(self)
-    VALUE self;
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    return ole_method_dispid(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_offset_vtbl(pTypeInfo, method_index)
-    ITypeInfo *pTypeInfo;
-    UINT method_index;
-{
-    FUNCDESC *pFuncDesc;
-    HRESULT hr;
-    VALUE offset_vtbl = Qnil;
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if (FAILED(hr))
-        return offset_vtbl;
-    offset_vtbl = INT2FIX(pFuncDesc->oVft); 
-    pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-    return offset_vtbl;
-}
-
-/*
- * WIN32OLE_METHOD#offset_vtbl
- * ----
- * Returns the offset ov VTBL.
- */
-static VALUE
-folemethod_offset_vtbl(self)
-    VALUE self;
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    return ole_method_offset_vtbl(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_size_params(pTypeInfo, method_index)
-    ITypeInfo *pTypeInfo;
-    UINT method_index;
-{
-    FUNCDESC *pFuncDesc;
-    HRESULT hr;
-    VALUE size_params = Qnil;
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if (FAILED(hr))
-        return size_params;
-    size_params = INT2FIX(pFuncDesc->cParams);
-    pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-    return size_params;
-}
-
-/*
- * WIN32OLE_METHOD#size_params
- * ----
- * Returns the size of arguments.
- */
-static VALUE
-folemethod_size_params(self)
-    VALUE self;
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    return ole_method_size_params(pmethod->pTypeInfo, pmethod->index);
-}
-
-/*
- * WIN32OLE_METHOD#size_opt_params
- * ----
- * Returns the size of optional parameters.
- */
-static VALUE
-ole_method_size_opt_params(pTypeInfo, method_index)
-    ITypeInfo *pTypeInfo;
-    UINT method_index;
-{
-    FUNCDESC *pFuncDesc;
-    HRESULT hr;
-    VALUE size_opt_params = Qnil;
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if (FAILED(hr))
-        return size_opt_params;
-    size_opt_params = INT2FIX(pFuncDesc->cParamsOpt);
-    pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-    return size_opt_params;
-}
-
-static VALUE
-folemethod_size_opt_params(self)
-    VALUE self;
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    return ole_method_size_opt_params(pmethod->pTypeInfo, pmethod->index);
-}
-
-static VALUE
-ole_method_params(pTypeInfo, method_index)
-    ITypeInfo *pTypeInfo;
-    UINT method_index;
-{
-    FUNCDESC *pFuncDesc;
-    HRESULT hr;
-    BSTR *bstrs;
-    UINT len, i;
-    struct oleparamdata *pparam;
-    VALUE param;
-    VALUE params = rb_ary_new();
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if (FAILED(hr)) 
-        return params;
-
-    len = 0;
-    bstrs = ALLOCA_N(BSTR, pFuncDesc->cParams + 1);
-    hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, pFuncDesc->memid, 
-                                     bstrs, pFuncDesc->cParams + 1,
-                                     &len);
-    if (FAILED(hr)) {
-        pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-        return params;
-    }
-    SysFreeString(bstrs[0]);
-    if (pFuncDesc->cParams > 0) {
-        for(i = 1; i < len; i++) {
-            param = Data_Make_Struct(cWIN32OLE_PARAM, struct oleparamdata, 0,
-                                     oleparam_free, pparam);
-            pparam->pTypeInfo = pTypeInfo;
-            OLE_ADDREF(pTypeInfo);
-            pparam->method_index = method_index;
-            pparam->index = i - 1;
-            rb_ivar_set(param, rb_intern("name"), WC2VSTR(bstrs[i]));
-            rb_ary_push(params, param);
-         }
-     }
-     pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-     return params;
-}
-
-/*
- * WIN32OLE_METHOD#params
- * ----
- * returns array of WIN32OLE_PARAM object corresponding with method parameters.
- */
-static VALUE
-folemethod_params(self)
-    VALUE self;
-{
-    struct olemethoddata *pmethod;
-    Data_Get_Struct(self, struct olemethoddata, pmethod);
-    return ole_method_params(pmethod->pTypeInfo, pmethod->index);
-}
-
-/*
- * WIN32OLE_PARAM#name
- * ----
- * Returns name.
- */
-static VALUE
-foleparam_name(self)
-    VALUE self;
-{
-    return rb_ivar_get(self, rb_intern("name"));
-}
-
-static VALUE
-ole_param_ole_type(pTypeInfo, method_index, index)
-    ITypeInfo *pTypeInfo;
-    UINT method_index;
-    UINT index;
-{
-    FUNCDESC *pFuncDesc;
-    HRESULT hr;
-    VALUE type = rb_str_new2("UNKNOWN");
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if (FAILED(hr))
-        return type;
-    type = ole_typedesc2val(pTypeInfo, 
-                            &(pFuncDesc->lprgelemdescParam[index].tdesc), Qnil);
-    pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-    return type;
-}
-
-static VALUE 
-foleparam_ole_type(self)
-    VALUE self;
-{
-    struct oleparamdata *pparam;
-    Data_Get_Struct(self, struct oleparamdata, pparam);
-    return ole_param_ole_type(pparam->pTypeInfo, pparam->method_index, 
-                              pparam->index);
-}
-
-static VALUE
-ole_param_ole_type_detail(pTypeInfo, method_index, index)
-    ITypeInfo *pTypeInfo;
-    UINT method_index;
-    UINT index;
-{
-    FUNCDESC *pFuncDesc;
-    HRESULT hr;
-    VALUE typedetail = rb_ary_new();
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if (FAILED(hr))
-        return typedetail;
-    ole_typedesc2val(pTypeInfo, 
-                     &(pFuncDesc->lprgelemdescParam[index].tdesc), typedetail);
-    pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-    return typedetail;
-}
-
-static VALUE 
-foleparam_ole_type_detail(self)
-    VALUE self;
-{
-    struct oleparamdata *pparam;
-    Data_Get_Struct(self, struct oleparamdata, pparam);
-    return ole_param_ole_type_detail(pparam->pTypeInfo, pparam->method_index, 
-                                     pparam->index);
-}
-
-static VALUE
-ole_param_flag_mask(pTypeInfo, method_index, index, mask)
-    ITypeInfo *pTypeInfo;
-    UINT method_index;
-    UINT index;
-    USHORT mask;
-{
-    FUNCDESC *pFuncDesc;
-    HRESULT hr;
-    VALUE ret = Qfalse;
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if(FAILED(hr)) 
-        return ret;
-    if (V_UNION1((&(pFuncDesc->lprgelemdescParam[index])), paramdesc).wParamFlags &mask) 
-        ret = Qtrue;
-    pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-    return ret;
-}
-
-/*
- * WIN32OLE_PARAM#input?
- * ----
- * Returns true if the parameter is input.
- */
-static VALUE foleparam_input(self)
-    VALUE self;
-{
-    struct oleparamdata *pparam;
-    Data_Get_Struct(self, struct oleparamdata, pparam);
-    return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index, 
-                               pparam->index, PARAMFLAG_FIN);
-}
-
-/*
- * WIN32OLE#output?
- * ----
- * Returns true if argument is output.
- */
-static VALUE foleparam_output(self)
-    VALUE self;
-{
-    struct oleparamdata *pparam;
-    Data_Get_Struct(self, struct oleparamdata, pparam);
-    return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index, 
-                               pparam->index, PARAMFLAG_FOUT);
-}
-
-/*
- * WIN32OLE_PARAM#optional?
- * -----
- * Returns true if argument is output.
- */
-static VALUE foleparam_optional(self)
-    VALUE self;
-{
-    struct oleparamdata *pparam;
-    Data_Get_Struct(self, struct oleparamdata, pparam);
-    return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index, 
-                               pparam->index, PARAMFLAG_FOPT);
-}
-
-static VALUE foleparam_retval(self)
-    VALUE self;
-{
-    struct oleparamdata *pparam;
-    Data_Get_Struct(self, struct oleparamdata, pparam);
-    return ole_param_flag_mask(pparam->pTypeInfo, pparam->method_index, 
-                               pparam->index, PARAMFLAG_FRETVAL);
-}
-
-static VALUE
-ole_param_default(pTypeInfo, method_index, index)
-    ITypeInfo *pTypeInfo;
-    UINT method_index;
-    UINT index;
-{
-    FUNCDESC *pFuncDesc;
-    ELEMDESC *pElemDesc;
-    PARAMDESCEX * pParamDescEx;
-    HRESULT hr;
-    USHORT wParamFlags;
-    USHORT mask = PARAMFLAG_FOPT|PARAMFLAG_FHASDEFAULT;
-    VALUE defval = Qnil;
-    hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
-    if (FAILED(hr))
-        return defval;
-    pElemDesc = &pFuncDesc->lprgelemdescParam[index]; 
-    wParamFlags = V_UNION1(pElemDesc, paramdesc).wParamFlags;
-    if ((wParamFlags & mask) == mask) {
-         pParamDescEx = V_UNION1(pElemDesc, paramdesc).pparamdescex;
-         defval = ole_variant2val(&pParamDescEx->varDefaultValue);
-    }
-    pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);
-    return defval;
-}
-
-/*
- * WIN32OLE_PARAM#default
- * ----
- * Returns default value. If the default value does not exist, 
- * this method returns nil.
- */
-static VALUE foleparam_default(self)
-    VALUE self;
-{
-    struct oleparamdata *pparam;
-    Data_Get_Struct(self, struct oleparamdata, pparam);
-    return ole_param_default(pparam->pTypeInfo, pparam->method_index,
-                             pparam->index);
-}
-
-static IEventSinkVtbl vtEventSink;
-static BOOL g_IsEventSinkVtblInitialized = FALSE;
-
-void EVENTSINK_Destructor(PIEVENTSINKOBJ);
-
-STDMETHODIMP
-EVENTSINK_QueryInterface(
-    PEVENTSINK pEV,
-    REFIID     iid,
-    LPVOID*    ppv
-    ) {
-    if (IsEqualIID(iid, &IID_IUnknown) ||
-        IsEqualIID(iid, &IID_IDispatch) ||
-        IsEqualIID(iid, &((PIEVENTSINKOBJ)pEV)->m_iid)) {
-        *ppv = pEV;
-    }
-    else {
-        *ppv = NULL;
-        return E_NOINTERFACE;
-    }
-    ((LPUNKNOWN)*ppv)->lpVtbl->AddRef((LPUNKNOWN)*ppv);
-    return NOERROR;
-}
-
-STDMETHODIMP_(ULONG)
-EVENTSINK_AddRef(
-    PEVENTSINK pEV
-    ){
-    PIEVENTSINKOBJ pEVObj = (PIEVENTSINKOBJ)pEV;
-    return ++pEVObj->m_cRef;
-}
-
-STDMETHODIMP_(ULONG) EVENTSINK_Release(
-    PEVENTSINK pEV
-    ) {
-    PIEVENTSINKOBJ pEVObj = (PIEVENTSINKOBJ)pEV;
-    --pEVObj->m_cRef;
-    if(pEVObj->m_cRef != 0)
-        return pEVObj->m_cRef;
-    EVENTSINK_Destructor(pEVObj);
-    return 0;
-}
-
-STDMETHODIMP EVENTSINK_GetTypeInfoCount(
-    PEVENTSINK pEV,
-    UINT *pct
-    ) {
-    *pct = 0;
-    return NOERROR;
-}
-
-STDMETHODIMP EVENTSINK_GetTypeInfo(
-    PEVENTSINK pEV,
-    UINT info,
-    LCID lcid,
-    ITypeInfo **pInfo
-    ) {
-    *pInfo = NULL;
-    return DISP_E_BADINDEX;
-}
-
-STDMETHODIMP EVENTSINK_GetIDsOfNames(
-    PEVENTSINK pEV,
-    REFIID riid,
-    OLECHAR **szNames,
-    UINT cNames,
-    LCID lcid,
-    DISPID *pDispID
-    ) {
-    return DISP_E_UNKNOWNNAME;
-}
-
-static VALUE
-ole_search_event(ary, ev, is_default)
-    VALUE ary;
-    VALUE ev;
-    BOOL  *is_default;
-{
-    VALUE event;
-    VALUE def_event;
-    VALUE event_name;
-    int i, len;
-    *is_default = FALSE;
-    def_event = Qnil;
-    len = RARRAY(ary)->len;
-    for(i = 0; i < len; i++) {
-        event = rb_ary_entry(ary, i);
-        event_name = rb_ary_entry(event, 1);
-        if(NIL_P(event_name)) {
-            *is_default = TRUE;
-            def_event = event;
-        }
-        else if (rb_str_cmp(ev, event_name) == 0) {
-            *is_default = FALSE;
-            return event;
-        }
-    }
-    return def_event;
-}
-
-static void
-val2ptr_variant(val, var)
-    VALUE val;
-    VARIANT *var;
-{
-    switch (TYPE(val)) {
-    case T_STRING:
-        if (V_VT(var) == (VT_BSTR | VT_BYREF)) {
-            *V_BSTRREF(var) = ole_mb2wc(StringValuePtr(val), -1);
-        }
-        break;
-    case T_FIXNUM:
-        switch(V_VT(var)) {
-        case (VT_UI1 | VT_BYREF) :
-            *V_UI1REF(var) = NUM2CHR(val);
-            break;
-        case (VT_I2 | VT_BYREF) :
-            *V_I2REF(var) = (short)NUM2INT(val);
-            break;
-        case (VT_I4 | VT_BYREF) :
-            *V_I4REF(var) = NUM2INT(val);
-            break;
-        case (VT_R4 | VT_BYREF) :
-            *V_R4REF(var) = (float)NUM2INT(val);
-            break;
-        case (VT_R8 | VT_BYREF) :
-            *V_R8REF(var) = NUM2INT(val);
-            break;
-        default:
-            break;
-        }
-        break;
-    case T_FLOAT:
-        switch(V_VT(var)) {
-        case (VT_I2 | VT_BYREF) :
-            *V_I2REF(var) = (short)NUM2INT(val);
-            break;
-        case (VT_I4 | VT_BYREF) :
-            *V_I4REF(var) = NUM2INT(val);
-            break;
-        case (VT_R4 | VT_BYREF) :
-            *V_R4REF(var) = (float)NUM2DBL(val);
-            break;
-        case (VT_R8 | VT_BYREF) :
-            *V_R8REF(var) = NUM2DBL(val);
-            break;
-        default:
-            break;
-        }
-        break;
-    case T_BIGNUM:
-        if (V_VT(var) == (VT_R8 | VT_BYREF)) {
-            *V_R8REF(var) = rb_big2dbl(val);
-        }
-        break;
-    case T_TRUE:
-        if (V_VT(var) == (VT_BOOL | VT_BYREF)) {
-            *V_BOOLREF(var) = VARIANT_TRUE;
-        }
-        break;
-    case T_FALSE:
-        if (V_VT(var) == (VT_BOOL | VT_BYREF)) {
-            *V_BOOLREF(var) = VARIANT_FALSE;
-        }
-        break;
-    default:
-        break;
-    }
-}
-
-static void
-ary2ptr_dispparams(ary, pdispparams)
-    VALUE ary;
-    DISPPARAMS *pdispparams;
-{
-    int i;
-    VALUE v;
-    VARIANT *pvar;
-    for(i = 0; i < RARRAY(ary)->len && (unsigned int) i < pdispparams->cArgs; i++) {
-        v = rb_ary_entry(ary, i);
-        pvar = &pdispparams->rgvarg[pdispparams->cArgs-i-1];
-        val2ptr_variant(v, pvar);
-    }
-}
-
-STDMETHODIMP EVENTSINK_Invoke(
-    PEVENTSINK pEventSink,
-    DISPID dispid,
-    REFIID riid,
-    LCID lcid,
-    WORD wFlags,
-    DISPPARAMS *pdispparams,
-    VARIANT *pvarResult,
-    EXCEPINFO *pexcepinfo,
-    UINT *puArgErr
-    ) {
-
-    HRESULT hr;
-    BSTR bstr;
-    unsigned int count;
-    unsigned int i;
-    ITypeInfo *pTypeInfo;
-    VARIANT *pvar;
-    VALUE ary, obj, event, handler, args, argv, ev;
-    BOOL is_default_handler = FALSE;
-
-    PIEVENTSINKOBJ pEV = (PIEVENTSINKOBJ)pEventSink;
-    pTypeInfo = pEV->pTypeInfo;
-
-    obj = rb_ary_entry(ary_ole_event, pEV->m_event_id);
-    if (!rb_obj_is_kind_of(obj, cWIN32OLE_EVENT)) {
-        return NOERROR;
-    }
-
-    ary = rb_ivar_get(obj, id_events);
-    if (NIL_P(ary) || TYPE(ary) != T_ARRAY) {
-        return NOERROR;
-    }
-    hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, dispid,
-                                     &bstr, 1, &count);
-    if (FAILED(hr)) {
-        return NOERROR;
-    }
-    ev = WC2VSTR(bstr);
-    event = ole_search_event(ary, ev, &is_default_handler);
-    if (NIL_P(event)) {
-        return NOERROR;
-    }
-    args = rb_ary_new();
-    if (is_default_handler) {
-        rb_ary_push(args, ev);
-    }
-
-    /* make argument of event handler */
-    for (i = 0; i < pdispparams->cArgs; ++i) {
-        pvar = &pdispparams->rgvarg[pdispparams->cArgs-i-1];
-        rb_ary_push(args, ole_variant2val(pvar));
-    }
-    handler = rb_ary_entry(event, 0);
-
-    if (rb_ary_entry(event, 3) == Qtrue) {
-        argv = rb_ary_new();
-	rb_ary_push(args, argv);
-        rb_apply(handler, rb_intern("call"), args);
-        ary2ptr_dispparams(argv, pdispparams);
-    }
-    else {
-        rb_apply(handler, rb_intern("call"), args);
-    }
-    return NOERROR;
-}
-
-PIEVENTSINKOBJ
-EVENTSINK_Constructor() {
-    PIEVENTSINKOBJ pEv;
-    if (!g_IsEventSinkVtblInitialized) {
-        vtEventSink.QueryInterface=EVENTSINK_QueryInterface;
-        vtEventSink.AddRef = EVENTSINK_AddRef;
-        vtEventSink.Release = EVENTSINK_Release;
-        vtEventSink.Invoke = EVENTSINK_Invoke;
-        vtEventSink.GetIDsOfNames = EVENTSINK_GetIDsOfNames;
-        vtEventSink.GetTypeInfoCount = EVENTSINK_GetTypeInfoCount;
-        vtEventSink.GetTypeInfo = EVENTSINK_GetTypeInfo;
-
-        g_IsEventSinkVtblInitialized = TRUE;
-    }
-    pEv = ALLOC_N(IEVENTSINKOBJ, 1);
-    if(pEv == NULL) return NULL;
-    pEv->lpVtbl = &vtEventSink;
-    pEv->m_cRef = 0;
-    pEv->m_event_id = 0;
-    pEv->m_dwCookie = 0;
-    pEv->pConnectionPoint = NULL;
-    pEv->pTypeInfo = NULL;
-    return pEv;
-}
-
-void EVENTSINK_Destructor(
-    PIEVENTSINKOBJ pEVObj
-    ) {
-    if(pEVObj != NULL) {
-        free(pEVObj);
-    }
-}
-
-static HRESULT
-find_iid(ole, pitf, piid, ppTypeInfo)
-    VALUE ole;
-    char *pitf;
-    IID *piid;
-    ITypeInfo **ppTypeInfo;
-{
-    HRESULT hr;
-    IDispatch *pDispatch;
-    ITypeInfo *pTypeInfo;
-    ITypeLib *pTypeLib;
-    TYPEATTR *pTypeAttr;
-    HREFTYPE RefType;
-    ITypeInfo *pImplTypeInfo;
-    TYPEATTR *pImplTypeAttr;
-
-    struct oledata *pole;
-    unsigned int index;
-    unsigned int count;
-    int type;
-    BSTR bstr;
-    char *pstr;
-
-    BOOL is_found = FALSE;
-    LCID    lcid = LOCALE_SYSTEM_DEFAULT;
-
-    Data_Get_Struct(ole, struct oledata, pole);
-
-    pDispatch = pole->pDispatch;
-
-    hr = pDispatch->lpVtbl->GetTypeInfo(pDispatch, 0, lcid, &pTypeInfo);
-    if (FAILED(hr))
-        return hr;
-
-    hr = pTypeInfo->lpVtbl->GetContainingTypeLib(pTypeInfo,
-                                                 &pTypeLib,
-                                                 &index);
-    OLE_RELEASE(pTypeInfo);
-    if (FAILED(hr))
-        return hr;
-
-    if (!pitf) {
-        hr = pTypeLib->lpVtbl->GetTypeInfoOfGuid(pTypeLib,
-                                                 piid,
-                                                 ppTypeInfo);
-        OLE_RELEASE(pTypeLib);
-        return hr;
-    }
-    count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib);
-    for (index = 0; index < count; index++) {
-        hr = pTypeLib->lpVtbl->GetTypeInfo(pTypeLib,
-                                           index,
-                                           &pTypeInfo);
-        if (FAILED(hr))
-            break;
-        hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-
-        if(FAILED(hr)) {
-            OLE_RELEASE(pTypeInfo);
-            break;
-        }
-        if(pTypeAttr->typekind == TKIND_COCLASS) {
-            for (type = 0; type < pTypeAttr->cImplTypes; type++) {
-                hr = pTypeInfo->lpVtbl->GetRefTypeOfImplType(pTypeInfo,
-                                                             type,
-                                                             &RefType);
-                if (FAILED(hr))
-                    break;
-                hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo,
-                                                       RefType,
-                                                       &pImplTypeInfo);
-                if (FAILED(hr))
-                    break;
-
-                hr = pImplTypeInfo->lpVtbl->GetDocumentation(pImplTypeInfo,
-                                                             -1,
-                                                             &bstr,
-                                                             NULL, NULL, NULL);
-                if (FAILED(hr)) {
-                    OLE_RELEASE(pImplTypeInfo);
-                    break;
-                }
-                pstr = ole_wc2mb(bstr);
-                if (strcmp(pitf, pstr) == 0) {
-                    hr = pImplTypeInfo->lpVtbl->GetTypeAttr(pImplTypeInfo,
-                                                            &pImplTypeAttr);
-                    if (SUCCEEDED(hr)) {
-                        is_found = TRUE;
-                        *piid = pImplTypeAttr->guid;
-                        if (ppTypeInfo) {
-                            *ppTypeInfo = pImplTypeInfo;
-                            (*ppTypeInfo)->lpVtbl->AddRef((*ppTypeInfo));
-                        }
-                        pImplTypeInfo->lpVtbl->ReleaseTypeAttr(pImplTypeInfo,
-                                                               pImplTypeAttr);
-                    }
-                }
-                free(pstr);
-                OLE_RELEASE(pImplTypeInfo);
-                if (is_found || FAILED(hr))
-                    break;
-            }
-        }
-
-        OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-        OLE_RELEASE(pTypeInfo);
-        if (is_found || FAILED(hr))
-            break;
-    }
-    OLE_RELEASE(pTypeLib);
-    if(!is_found)
-        return E_NOINTERFACE;
-    return hr;
-}
-
-static HRESULT
-find_default_source(ole, piid, ppTypeInfo)
-    VALUE ole;
-    IID *piid;
-    ITypeInfo **ppTypeInfo;
-{
-    HRESULT hr;
-    IProvideClassInfo2 *pProvideClassInfo2;
-    IProvideClassInfo *pProvideClassInfo;
-
-    IDispatch *pDispatch;
-    ITypeInfo *pTypeInfo;
-    TYPEATTR *pTypeAttr;
-    int i;
-    int iFlags;
-    HREFTYPE hRefType;
-
-    struct oledata *pole;
-
-    Data_Get_Struct(ole, struct oledata, pole);
-    pDispatch = pole->pDispatch;
-    hr = pDispatch->lpVtbl->QueryInterface(pDispatch,
-                                           &IID_IProvideClassInfo2,
-                                           (void**)&pProvideClassInfo2);
-    if (SUCCEEDED(hr)) {
-        hr = pProvideClassInfo2->lpVtbl->GetGUID(pProvideClassInfo2,
-                                                 GUIDKIND_DEFAULT_SOURCE_DISP_IID,
-                                                 piid);
-        OLE_RELEASE(pProvideClassInfo2);
-        return find_iid(ole, NULL, piid, ppTypeInfo);
-    }
-    hr = pDispatch->lpVtbl->QueryInterface(pDispatch,
-                                           &IID_IProvideClassInfo,
-                                           (void**)&pProvideClassInfo);
-    if (FAILED(hr))
-        return hr;
-
-    hr = pProvideClassInfo->lpVtbl->GetClassInfo(pProvideClassInfo,
-                                                 &pTypeInfo);
-    OLE_RELEASE(pProvideClassInfo);
-    if (FAILED(hr))
-        return hr;
-
-    hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
-    if (FAILED(hr)) {
-        OLE_RELEASE(pTypeInfo);
-        return hr;
-    }
-    /* Enumerate all implemented types of the COCLASS */
-    for (i = 0; i < pTypeAttr->cImplTypes; i++) {
-        hr = pTypeInfo->lpVtbl->GetImplTypeFlags(pTypeInfo, i, &iFlags);
-        if (FAILED(hr))
-            continue;
-
-        /*
-           looking for the [default] [source]
-           we just hope that it is a dispinterface :-)
-        */
-        if ((iFlags & IMPLTYPEFLAG_FDEFAULT) &&
-            (iFlags & IMPLTYPEFLAG_FSOURCE)) {
-
-            hr = pTypeInfo->lpVtbl->GetRefTypeOfImplType(pTypeInfo,
-                                                         i, &hRefType);
-            if (FAILED(hr))
-                continue;
-            hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo,
-                                                   hRefType, ppTypeInfo);
-            if (SUCCEEDED(hr))
-                break;
-        }
-    }
-
-    OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
-    OLE_RELEASE(pTypeInfo);
-
-    /* Now that would be a bad surprise, if we didn't find it, wouldn't it? */
-    if (!*ppTypeInfo) {
-        if (SUCCEEDED(hr))
-            hr = E_UNEXPECTED;
-        return hr;
-    }
-
-    // Determine IID of default source interface
-    hr = (*ppTypeInfo)->lpVtbl->GetTypeAttr(*ppTypeInfo, &pTypeAttr);
-    if (SUCCEEDED(hr)) {
-        *piid = pTypeAttr->guid;
-        (*ppTypeInfo)->lpVtbl->ReleaseTypeAttr(*ppTypeInfo, pTypeAttr);
-    }
-    else
-        OLE_RELEASE(*ppTypeInfo);
-
-    return hr;
-
-}
-
-static void
-ole_event_free(poleev)
-    struct oleeventdata *poleev;
-{
-    ITypeInfo *pti = NULL;
-    IConnectionPoint *pcp = NULL;
-
-    if(poleev->pEvent) {
-        pti = poleev->pEvent->pTypeInfo;
-	if(pti) OLE_RELEASE(pti);
-	pcp = poleev->pEvent->pConnectionPoint;
-	if(pcp) {
-            pcp->lpVtbl->Unadvise(pcp, poleev->pEvent->m_dwCookie);
-            OLE_RELEASE(pcp);
-        }
-        ole_msg_loop();
-        CoFreeUnusedLibraries();
-    }
-}
-
-static VALUE
-fev_s_allocate(klass)
-    VALUE klass;
-{
-    VALUE obj;
-    struct oleeventdata *poleev;
-    obj = Data_Make_Struct(klass,struct oleeventdata,0,ole_event_free,poleev);
-    poleev->pEvent = NULL;
-    return obj;
-}
-
-static VALUE
-fev_initialize(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    VALUE ole, itf;
-    struct oledata *pole;
-    char *pitf;
-    HRESULT hr;
-    IID iid;
-    ITypeInfo *pTypeInfo;
-    IDispatch *pDispatch;
-    IConnectionPointContainer *pContainer;
-    IConnectionPoint *pConnectionPoint;
-    IEVENTSINKOBJ *pIEV;
-    DWORD dwCookie;
-    struct oleeventdata *poleev;
-
-    rb_scan_args(argc, argv, "11", &ole, &itf);
-
-    if (!rb_obj_is_kind_of(ole, cWIN32OLE)) {
-        rb_raise(rb_eTypeError, "1st parametor must be WIN32OLE object.");
-    }
-
-    if(TYPE(itf) != T_NIL) {
-        Check_SafeStr(itf);
-        pitf = StringValuePtr(itf);
-        hr = find_iid(ole, pitf, &iid, &pTypeInfo);
-    }
-    else {
-        hr = find_default_source(ole, &iid, &pTypeInfo);
-    }
-    if (FAILED(hr)) {
-        ole_raise(hr, rb_eRuntimeError, "not found interface");
-    }
-
-    Data_Get_Struct(ole, struct oledata, pole);
-    pDispatch = pole->pDispatch;
-    hr = pDispatch->lpVtbl->QueryInterface(pDispatch,
-                                           &IID_IConnectionPointContainer,
-                                           (void**)&pContainer);
-    if (FAILED(hr)) {
-        OLE_RELEASE(pTypeInfo);
-        ole_raise(hr, rb_eRuntimeError,
-                  "fail to query IConnectionPointContainer");
-    }
-
-    hr = pContainer->lpVtbl->FindConnectionPoint(pContainer,
-                                                 &iid,
-                                                 &pConnectionPoint);
-    OLE_RELEASE(pContainer);
-    if (FAILED(hr)) {
-        OLE_RELEASE(pTypeInfo);
-        ole_raise(hr, rb_eRuntimeError, "fail to query IConnectionPoint");
-    }
-    pIEV = EVENTSINK_Constructor();
-    pIEV->m_iid = iid;
-    hr = pConnectionPoint->lpVtbl->Advise(pConnectionPoint,
-                                          (IUnknown*)pIEV,
-                                          &dwCookie);
-    if (FAILED(hr)) {
-        ole_raise(hr, rb_eRuntimeError, "Advise Error");
-    }
-
-    Data_Get_Struct(self, struct oleeventdata, poleev);
-    poleev->pEvent = pIEV;
-    poleev->pEvent->m_event_id
-        = NUM2INT(rb_funcall(ary_ole_event, rb_intern("length"), 0));
-    poleev->pEvent->pConnectionPoint = pConnectionPoint;
-    poleev->pEvent->pTypeInfo = pTypeInfo;
-    poleev->pEvent->m_dwCookie = dwCookie;
-
-    rb_ary_push(ary_ole_event, self);
-    return self;
-}
-
-/*
- * WIN32OLE_EVENT.message_loop
- * ---
- * Translates and dispatches Windows message.
- */
-static VALUE
-fev_s_msg_loop(klass)
-    VALUE klass;
-{
-    ole_msg_loop();
-    return Qnil;
-}
-
-
-static void
-add_event_call_back(obj, data)
-    VALUE obj;
-    VALUE data;
-{
-    VALUE ary = rb_ivar_get(obj, id_events);
-    if (NIL_P(ary) || TYPE(ary) != T_ARRAY) {
-        ary = rb_ary_new();
-        rb_ivar_set(obj, id_events, ary);
-    }
-    rb_ary_push(ary, data);
-}
-
-static VALUE
-ev_on_event(argc, argv, self, is_ary_arg)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-    VALUE is_ary_arg;
-{
-    VALUE event, args, data;
-    rb_scan_args(argc, argv, "01*", &event, &args);
-    if(!NIL_P(event)) {
-        Check_SafeStr(event);
-    }
-    data = rb_ary_new3(4, rb_f_lambda(), event, args, is_ary_arg);
-    add_event_call_back(self, data);
-    return Qnil;
-}
-
-/*
- * WIN32OLE_EVENT#on_event([event]){...}
- * ----
- * defines the callback event.
- * If argument is omitted, this method defines the callback of all events.
- */
-static VALUE
-fev_on_event(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    return ev_on_event(argc, argv, self, Qfalse);
-}
-
-/*
- * WIN32OLE_EVENT#on_event_with_outargs([event]){...}
- * ----
- * defines the callback of event.
- * If you want modify argument in callback, 
- * you should use this method instead of WIN32OLE_EVENT#on_event.
- */
-static VALUE
-fev_on_event_with_outargs(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    return ev_on_event(argc, argv, self, Qtrue);
-}
-
-
-void
-Init_win32ole()
-{
-    ary_ole_event = rb_ary_new();
-    rb_global_variable(&ary_ole_event);
-    id_events = rb_intern("events");
-
-    cWIN32OLE = rb_define_class("WIN32OLE", rb_cObject);
-
-    rb_define_singleton_method(cWIN32OLE, "allocate", fole_s_allocate, 0);
-
-    rb_define_method(cWIN32OLE, "initialize", fole_initialize, -1);
-    rb_enable_super(cWIN32OLE, "initialize");
-
-    rb_define_singleton_method(cWIN32OLE, "connect", fole_s_connect, -1);
-    rb_define_singleton_method(cWIN32OLE, "const_load", fole_s_const_load, -1);
-
-    rb_define_singleton_method(cWIN32OLE, "ole_free", fole_s_free, 1);
-    rb_define_singleton_method(cWIN32OLE, "ole_reference_count", fole_s_reference_count, 1);
-    rb_define_singleton_method(cWIN32OLE, "ole_show_help", fole_s_show_help, -1);
-
-
-    rb_define_method(cWIN32OLE, "invoke", fole_invoke, -1);
-    rb_define_method(cWIN32OLE, "[]", fole_getproperty, 1);
-    rb_define_method(cWIN32OLE, "_invoke", fole_invoke2, 3);
-    rb_define_method(cWIN32OLE, "_getproperty", fole_getproperty2, 3);
-    rb_define_method(cWIN32OLE, "_setproperty", fole_setproperty2, 3);
-
-    /* support propput method that takes an argument */
-    rb_define_method(cWIN32OLE, "[]=", fole_setproperty, -1); 
-
-    rb_define_method(cWIN32OLE, "each", fole_each, 0);
-    rb_define_method(cWIN32OLE, "method_missing", fole_missing, -1);
-
-    /* support setproperty method much like Perl ;-) */
-    rb_define_method(cWIN32OLE, "setproperty", fole_setproperty, -1);
-
-    rb_define_method(cWIN32OLE, "ole_methods", fole_methods, 0);
-    rb_define_method(cWIN32OLE, "ole_get_methods", fole_get_methods, 0);
-    rb_define_method(cWIN32OLE, "ole_put_methods", fole_put_methods, 0);
-    rb_define_method(cWIN32OLE, "ole_func_methods", fole_func_methods, 0);
-
-    rb_define_method(cWIN32OLE, "ole_method", fole_method_help, 1);
-    rb_define_alias(cWIN32OLE, "ole_method_help", "ole_method");
-    rb_define_method(cWIN32OLE, "ole_obj_help", fole_obj_help, 0);
-
-    rb_define_const(cWIN32OLE, "VERSION", rb_str_new2(WIN32OLE_VERSION));
-    rb_define_const(cWIN32OLE, "ARGV", rb_ary_new());
-
-    mWIN32OLE_VARIANT = rb_define_module_under(cWIN32OLE, "VARIANT");
-    rb_define_const(mWIN32OLE_VARIANT, "VT_I2", INT2FIX(VT_I2));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_I4", INT2FIX(VT_I4));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_R4", INT2FIX(VT_R4));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_R8", INT2FIX(VT_R8));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_CY", INT2FIX(VT_CY));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_DATE", INT2FIX(VT_DATE));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_BSTR", INT2FIX(VT_BSTR));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_USERDEFINED", INT2FIX(VT_USERDEFINED));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_PTR", INT2FIX(VT_PTR));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_DISPATCH", INT2FIX(VT_DISPATCH));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_ERROR", INT2FIX(VT_ERROR));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_BOOL", INT2FIX(VT_BOOL));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_VARIANT", INT2FIX(VT_VARIANT));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_UNKNOWN", INT2FIX(VT_UNKNOWN));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_I1", INT2FIX(VT_I1));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_UI1", INT2FIX(VT_UI1));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_UI2", INT2FIX(VT_UI2));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_UI4", INT2FIX(VT_UI4));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_INT", INT2FIX(VT_INT));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_UINT", INT2FIX(VT_UINT));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_ARRAY", INT2FIX(VT_ARRAY));
-    rb_define_const(mWIN32OLE_VARIANT, "VT_BYREF", INT2FIX(VT_BYREF));
-    
-    cWIN32OLE_TYPE = rb_define_class("WIN32OLE_TYPE", rb_cObject);
-    rb_define_singleton_method(cWIN32OLE_TYPE, "ole_classes", foletype_s_ole_classes, 1);
-    rb_define_singleton_method(cWIN32OLE_TYPE, "typelibs", foletype_s_typelibs, 0);
-    rb_define_singleton_method(cWIN32OLE_TYPE, "progids", foletype_s_progids, 0);
-    rb_define_singleton_method(cWIN32OLE_TYPE, "allocate", foletype_s_allocate, 0);
-    rb_define_method(cWIN32OLE_TYPE, "initialize", foletype_initialize, 2);
-    rb_enable_super(cWIN32OLE_TYPE, "initialize");
-    rb_define_method(cWIN32OLE_TYPE, "name", foletype_name, 0);
-    rb_define_method(cWIN32OLE_TYPE, "ole_type", foletype_ole_type, 0);
-    rb_define_method(cWIN32OLE_TYPE, "guid", foletype_guid, 0);
-    rb_define_method(cWIN32OLE_TYPE, "progid", foletype_progid, 0);
-    rb_define_method(cWIN32OLE_TYPE, "visible?", foletype_visible, 0);
-
-    rb_define_method(cWIN32OLE_TYPE, "major_version", foletype_major_version, 0);
-    rb_define_method(cWIN32OLE_TYPE, "minor_version", foletype_minor_version, 0);
-    rb_define_method(cWIN32OLE_TYPE, "typekind", foletype_typekind, 0);
-    rb_define_method(cWIN32OLE_TYPE, "helpstring", foletype_helpstring, 0);
-    rb_define_method(cWIN32OLE_TYPE, "src_type", foletype_src_type, 0);
-    rb_define_method(cWIN32OLE_TYPE, "helpfile", foletype_helpfile, 0);
-    rb_define_method(cWIN32OLE_TYPE, "helpcontext", foletype_helpcontext, 0);
-    rb_define_method(cWIN32OLE_TYPE, "variables", foletype_variables, 0);
-    rb_define_method(cWIN32OLE_TYPE, "ole_methods", foletype_methods, -1);
-
-    cWIN32OLE_VARIABLE = rb_define_class("WIN32OLE_VARIABLE", rb_cObject);
-    rb_define_method(cWIN32OLE_VARIABLE, "name", folevariable_name, 0);
-    rb_define_method(cWIN32OLE_VARIABLE, "ole_type", folevariable_ole_type, 0);
-    rb_define_method(cWIN32OLE_VARIABLE, "ole_type_detail", folevariable_ole_type_detail, 0);
-    rb_define_method(cWIN32OLE_VARIABLE, "value", folevariable_value, 0);
-    rb_define_method(cWIN32OLE_VARIABLE, "visible?", folevariable_visible, 0);
-    rb_define_method(cWIN32OLE_VARIABLE, "variable_kind", folevariable_variable_kind, 0);
-    rb_define_method(cWIN32OLE_VARIABLE, "varkind", folevariable_varkind, 0);
-
-    cWIN32OLE_METHOD = rb_define_class("WIN32OLE_METHOD", rb_cObject);
-    rb_define_singleton_method(cWIN32OLE_METHOD, "allocate", folemethod_s_allocate, 0);
-    rb_define_method(cWIN32OLE_METHOD, "initialize", folemethod_initialize, 2);
-    rb_enable_super(cWIN32OLE_METHOD, "initialize");
-
-    rb_define_method(cWIN32OLE_METHOD, "name", folemethod_name, 0);
-    rb_define_method(cWIN32OLE_METHOD, "return_type", folemethod_return_type, 0);
-    rb_define_method(cWIN32OLE_METHOD, "return_vtype", folemethod_return_vtype, 0);
-    rb_define_method(cWIN32OLE_METHOD, "return_type_detail", folemethod_return_type_detail, 0);
-    rb_define_method(cWIN32OLE_METHOD, "invoke_kind", folemethod_invoke_kind, 0);
-    rb_define_method(cWIN32OLE_METHOD, "invkind", folemethod_invkind, 0);
-    rb_define_method(cWIN32OLE_METHOD, "visible?", folemethod_visible, 0);
-    rb_define_method(cWIN32OLE_METHOD, "event?", folemethod_event, 0);
-    rb_define_method(cWIN32OLE_METHOD, "event_interface", folemethod_event_interface, 0);
-    rb_define_method(cWIN32OLE_METHOD, "helpstring", folemethod_helpstring, 0);
-    rb_define_method(cWIN32OLE_METHOD, "helpfile", folemethod_helpfile, 0);
-    rb_define_method(cWIN32OLE_METHOD, "helpcontext", folemethod_helpcontext, 0);
-    rb_define_method(cWIN32OLE_METHOD, "dispid", folemethod_dispid, 0);
-    rb_define_method(cWIN32OLE_METHOD, "offset_vtbl", folemethod_offset_vtbl, 0);
-    rb_define_method(cWIN32OLE_METHOD, "size_params", folemethod_size_params, 0);
-    rb_define_method(cWIN32OLE_METHOD, "size_opt_params", folemethod_size_opt_params, 0);
-    rb_define_method(cWIN32OLE_METHOD, "params", folemethod_params, 0);
-
-    cWIN32OLE_PARAM = rb_define_class("WIN32OLE_PARAM", rb_cObject);
-    rb_define_method(cWIN32OLE_PARAM, "name", foleparam_name, 0);
-    rb_define_method(cWIN32OLE_PARAM, "ole_type", foleparam_ole_type, 0);
-    rb_define_method(cWIN32OLE_PARAM, "ole_type_detail", foleparam_ole_type_detail, 0);
-    rb_define_method(cWIN32OLE_PARAM, "input?", foleparam_input, 0);
-    rb_define_method(cWIN32OLE_PARAM, "output?", foleparam_output, 0);
-    rb_define_method(cWIN32OLE_PARAM, "optional?", foleparam_optional, 0);
-    rb_define_method(cWIN32OLE_PARAM, "retval?", foleparam_retval, 0);
-    rb_define_method(cWIN32OLE_PARAM, "default", foleparam_default, 0);
- 
-    cWIN32OLE_EVENT = rb_define_class("WIN32OLE_EVENT", rb_cObject);
-
-    rb_define_singleton_method(cWIN32OLE_EVENT, "allocate", fev_s_allocate, 0);
-    rb_define_method(cWIN32OLE_EVENT, "initialize", fev_initialize, -1);
-    rb_enable_super(cWIN32OLE_EVENT, "initialize");
-    rb_define_singleton_method(cWIN32OLE_EVENT, "message_loop", fev_s_msg_loop, 0);
-
-    rb_define_method(cWIN32OLE_EVENT, "on_event", fev_on_event, -1);
-    rb_define_method(cWIN32OLE_EVENT, "on_event_with_outargs", fev_on_event_with_outargs, -1);
-    eWIN32OLE_RUNTIME_ERROR = rb_define_class("WIN32OLERuntimeError", rb_eRuntimeError);
-}
diff --git a/file.c b/file.c
deleted file mode 100644
index 33b9cc985b..0000000000
--- a/file.c
+++ /dev/null
@@ -1,2697 +0,0 @@
-/**********************************************************************
-
-  file.c -
-
-  $Author$
-  $Date$
-  created at: Mon Nov 15 12:24:34 JST 1993
-
-  Copyright (C) 1993-2002 Yukihiro Matsumoto
-  Copyright (C) 2000  Network Applied Communication Laboratory, Inc.
-  Copyright (C) 2000  Information-technology Promotion Agency, Japan
-
-**********************************************************************/
-
-#ifdef NT
-#include "missing/file.h"
-#endif
-
-#include "ruby.h"
-#include "rubyio.h"
-#include "rubysig.h"
-#include "util.h"
-#include "dln.h"
-
-#ifdef HAVE_UNISTD_H
-#include 
-#endif
-
-#ifdef HAVE_SYS_FILE_H
-# include 
-#else
-int flock _((int, int));
-#endif
-
-#ifdef HAVE_SYS_PARAM_H
-# include 
-#else
-# define MAXPATHLEN 1024
-#endif
-
-#include 
-#ifdef HAVE_SYS_TIME_H
-# include 
-#else
-#ifndef NT
-struct timeval {
-        long    tv_sec;         /* seconds */
-        long    tv_usec;        /* and microseconds */
-};
-#endif /* NT */
-#endif
-
-VALUE rb_time_new _((time_t, time_t));
-
-#ifdef HAVE_UTIME_H
-#include 
-#endif
-
-#ifdef HAVE_PWD_H
-#include 
-#endif
-
-#ifndef HAVE_STRING_H
-char *strrchr _((const char*,const char));
-#endif
-
-#include 
-#include 
-
-#ifdef HAVE_SYS_MKDEV_H
-#include 
-#endif
-
-#ifndef HAVE_LSTAT
-#define lstat(path,st) stat(path,st)
-#endif
-
-VALUE rb_cFile;
-VALUE rb_mFileTest;
-static VALUE rb_cStat;
-
-static int
-apply2files(func, vargs, arg)
-    void (*func)();
-    VALUE vargs;
-    void *arg;
-{
-    int i;
-    VALUE path;
-    struct RArray *args = RARRAY(vargs);
-
-    for (i=0; ilen; i++) {
-	path = args->ptr[i];
-	SafeStringValue(path);
-	(*func)(RSTRING(path)->ptr, arg);
-    }
-
-    return args->len;
-}
-
-static VALUE
-rb_file_path(obj)
-    VALUE obj;
-{
-    OpenFile *fptr;
-
-    GetOpenFile(obj, fptr);
-    if (!fptr->path) return Qnil;
-    return rb_str_new2(fptr->path);
-}
-
-#ifdef NT
-#include "missing/file.h"
-#endif
-
-static VALUE
-stat_new_0(klass, st)
-    VALUE klass;
-    struct stat *st;
-{
-    struct stat *nst = 0;
-
-    if (st) {
-	nst = ALLOC(struct stat);
-	*nst = *st;
-    }
-    return Data_Wrap_Struct(klass, NULL, free, nst);
-}
-
-static VALUE
-stat_new(st)
-    struct stat *st;
-{
-    return stat_new_0(rb_cStat, st);
-}
-
-static struct stat*
-get_stat(self)
-    VALUE self;
-{
-    struct stat* st;
-    Data_Get_Struct(self, struct stat, st);
-    if (!st) rb_raise(rb_eTypeError, "uninitialized File::Stat");
-    return st;
-}
-
-static VALUE
-rb_stat_cmp(self, other)
-    VALUE self, other;
-{
-    if (rb_obj_is_kind_of(other, rb_obj_class(self))) {
-	time_t t1 = get_stat(self)->st_mtime;
-	time_t t2 = get_stat(other)->st_mtime;
-	if (t1 == t2)
-	    return INT2FIX(0);
-	else if (t1 < t2)
-	    return INT2FIX(-1);
-	else
-	    return INT2FIX(1);
-    }
-    rb_raise(rb_eTypeError, "operand is not File::Stat");
-}
-
-static VALUE
-rb_stat_dev(self)
-    VALUE self;
-{
-    return INT2NUM(get_stat(self)->st_dev);
-}
-
-static VALUE
-rb_stat_ino(self)
-    VALUE self;
-{
-    return ULONG2NUM(get_stat(self)->st_ino);
-}
-
-static VALUE
-rb_stat_mode(self)
-    VALUE self;
-{
-#ifdef __BORLANDC__
-    return UINT2NUM((unsigned short)(get_stat(self)->st_mode));
-#else
-     return UINT2NUM(get_stat(self)->st_mode);
-#endif
-}
-
-static VALUE
-rb_stat_nlink(self)
-    VALUE self;
-{
-    return UINT2NUM(get_stat(self)->st_nlink);
-}
-
-static VALUE
-rb_stat_uid(self)
-    VALUE self;
-{
-    return UINT2NUM(get_stat(self)->st_uid);
-}
-
-static VALUE
-rb_stat_gid(self)
-    VALUE self;
-{
-    return UINT2NUM(get_stat(self)->st_gid);
-}
-
-static VALUE
-rb_stat_rdev(self)
-    VALUE self;
-{
-#ifdef HAVE_ST_RDEV
-    return ULONG2NUM(get_stat(self)->st_rdev);
-#else
-    return INT2FIX(0);
-#endif
-}
-
-static VALUE
-rb_stat_rdev_major(self)
-    VALUE self;
-{
-#if defined(HAVE_ST_RDEV) && defined(major)
-    long rdev = get_stat(self)->st_rdev;
-    return ULONG2NUM(major(rdev));
-#else
-    return INT2FIX(0);
-#endif
-}
-
-static VALUE
-rb_stat_rdev_minor(self)
-    VALUE self;
-{
-#if defined(HAVE_ST_RDEV) && defined(minor)
-    long rdev = get_stat(self)->st_rdev;
-    return ULONG2NUM(minor(rdev));
-#else
-    return INT2FIX(0);
-#endif
-}
-
-static VALUE
-rb_stat_size(self)
-    VALUE self;
-{
-    return OFFT2NUM(get_stat(self)->st_size);
-}
-
-static VALUE
-rb_stat_blksize(self)
-    VALUE self;
-{
-#ifdef HAVE_ST_BLKSIZE
-    return ULONG2NUM(get_stat(self)->st_blksize);
-#else
-    return INT2FIX(0);
-#endif
-}
-
-static VALUE
-rb_stat_blocks(self)
-    VALUE self;
-{
-#ifdef HAVE_ST_BLOCKS
-    return ULONG2NUM(get_stat(self)->st_blocks);
-#else
-    return INT2FIX(0);
-#endif
-}
-
-static VALUE
-rb_stat_atime(self)
-    VALUE self;
-{
-    return rb_time_new(get_stat(self)->st_atime, 0);
-}
-
-static VALUE
-rb_stat_mtime(self)
-    VALUE self;
-{
-    return rb_time_new(get_stat(self)->st_mtime, 0);
-}
-
-static VALUE
-rb_stat_ctime(self)
-    VALUE self;
-{
-    return rb_time_new(get_stat(self)->st_ctime, 0);
-}
-
-static VALUE
-rb_stat_inspect(self)
-    VALUE self;
-{
-    VALUE str;
-    int i;
-    static struct {
-        char *name;
-        VALUE (*func)();
-    } member[] = {
-        {"dev",     rb_stat_dev},
-        {"ino",     rb_stat_ino},
-        {"mode",    rb_stat_mode},
-        {"nlink",   rb_stat_nlink},
-        {"uid",     rb_stat_uid},
-        {"gid",     rb_stat_gid},
-        {"rdev",    rb_stat_rdev},
-        {"size",    rb_stat_size},
-        {"blksize", rb_stat_blksize},
-        {"blocks",  rb_stat_blocks},
-        {"atime",   rb_stat_atime},
-        {"mtime",   rb_stat_mtime},
-        {"ctime",   rb_stat_ctime},
-    };
-
-    str = rb_str_buf_new2("#<");
-    rb_str_buf_cat2(str, rb_class2name(CLASS_OF(self)));
-    rb_str_buf_cat2(str, " ");
-
-    for (i = 0; i < sizeof(member)/sizeof(member[0]); i++) {
-	VALUE v;
-
-	if (i > 0) {
-	    rb_str_buf_cat2(str, ", ");
-	}
-	rb_str_buf_cat2(str, member[i].name);
-	rb_str_buf_cat2(str, "=");
-	v = (*member[i].func)(self);
-	if (i == 2) {		/* mode */
-	    char buf[32];
-
-	    sprintf(buf, "0%lo", NUM2INT(v));
-	    rb_str_buf_cat2(str, buf);
-	}
-	else if (i == 0 || i == 6) { /* dev/rdev */
-	    char buf[32];
-
-	    sprintf(buf, "0x%lx", NUM2ULONG(v));
-	    rb_str_buf_cat2(str, buf);
-	}
-	else {
-	    rb_str_append(str, rb_inspect(v));
-	}
-    }
-    rb_str_buf_cat2(str, ">");
-    OBJ_INFECT(str, self);
-
-    return str;
-}
-
-static int
-rb_stat(file, st)
-    VALUE file;
-    struct stat *st;
-{
-    if (TYPE(file) == T_FILE) {
-	OpenFile *fptr;
-
-	rb_secure(2);
-	GetOpenFile(file, fptr);
-	return fstat(fileno(fptr->f), st);
-    }
-    SafeStringValue(file);
-#if defined DJGPP
-    if (RSTRING(file)->len == 0) return -1;
-#endif
-    return stat(RSTRING(file)->ptr, st);
-}
-
-static VALUE
-rb_file_s_stat(klass, fname)
-    VALUE klass, fname;
-{
-    struct stat st;
-
-    SafeStringValue(fname);
-    if (stat(RSTRING(fname)->ptr, &st) == -1) {
-	rb_sys_fail(RSTRING(fname)->ptr);
-    }
-    return stat_new(&st);
-}
-
-static VALUE
-rb_io_stat(obj)
-    VALUE obj;
-{
-    OpenFile *fptr;
-    struct stat st;
-
-    GetOpenFile(obj, fptr);
-    if (fstat(fileno(fptr->f), &st) == -1) {
-	rb_sys_fail(fptr->path);
-    }
-    return stat_new(&st);
-}
-
-static VALUE
-rb_file_s_lstat(klass, fname)
-    VALUE klass, fname;
-{
-#ifdef HAVE_LSTAT
-    struct stat st;
-
-    SafeStringValue(fname);
-    if (lstat(RSTRING(fname)->ptr, &st) == -1) {
-	rb_sys_fail(RSTRING(fname)->ptr);
-    }
-    return stat_new(&st);
-#else
-    return rb_file_s_stat(klass, fname);
-#endif
-}
-
-static VALUE
-rb_file_lstat(obj)
-    VALUE obj;
-{
-#ifdef HAVE_LSTAT
-    OpenFile *fptr;
-    struct stat st;
-
-    rb_secure(2);
-    GetOpenFile(obj, fptr);
-    if (!fptr->path) return Qnil;
-    if (lstat(fptr->path, &st) == -1) {
-	rb_sys_fail(fptr->path);
-    }
-    return stat_new(&st);
-#else
-    return rb_io_stat(obj);
-#endif
-}
-
-static int
-group_member(gid)
-    GETGROUPS_T gid;
-{
-#if !defined(NT)
-    if (getgid() ==  gid)
-	return Qtrue;
-
-# ifdef HAVE_GETGROUPS
-#  ifndef NGROUPS
-#   ifdef NGROUPS_MAX
-#    define NGROUPS NGROUPS_MAX
-#   else
-#    define NGROUPS 32
-#   endif
-#  endif
-    {
-	GETGROUPS_T gary[NGROUPS];
-	int anum;
-
-	anum = getgroups(NGROUPS, gary);
-	while (--anum >= 0)
-	    if (gary[anum] == gid)
-		return Qtrue;
-    }
-# endif
-#endif
-    return Qfalse;
-}
-
-#ifndef S_IXUGO
-#  define S_IXUGO		(S_IXUSR | S_IXGRP | S_IXOTH)
-#endif
-
-int
-eaccess(path, mode)
-     const char *path;
-     int mode;
-{
-#ifdef S_IXGRP
-    struct stat st;
-    int euid;
-
-    if (stat(path, &st) < 0) return -1;
-
-    euid = geteuid();
-
-    if (euid == 0) {
-	/* Root can read or write any file. */
-	if (!(mode & X_OK))
-	    return 0;
-
-	/* Root can execute any file that has any one of the execute
-	   bits set. */
-	if (st.st_mode & S_IXUGO)
-	    return 0;
-
-	return -1;
-    }
-
-    if (st.st_uid == euid)        /* owner */
-	mode <<= 6;
-    else if (getegid() == st.st_gid || group_member(st.st_gid))
-	mode <<= 3;
-
-    if ((st.st_mode & mode) == mode) return 0;
-
-    return -1;
-#else
-    return access(path, mode);
-#endif
-}
-
-static VALUE
-test_d(obj, fname)
-    VALUE obj, fname;
-{
-#ifndef S_ISDIR
-#   define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
-#endif
-
-    struct stat st;
-
-    if (rb_stat(fname, &st) < 0) return Qfalse;
-    if (S_ISDIR(st.st_mode)) return Qtrue;
-    return Qfalse;
-}
-
-static VALUE
-test_p(obj, fname)
-    VALUE obj, fname;
-{
-#ifdef S_IFIFO
-#  ifndef S_ISFIFO
-#    define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO)
-#  endif
-
-    struct stat st;
-
-    if (rb_stat(fname, &st) < 0) return Qfalse;
-    if (S_ISFIFO(st.st_mode)) return Qtrue;
-
-#endif
-    return Qfalse;
-}
-
-static VALUE
-test_l(obj, fname)
-    VALUE obj, fname;
-{
-#ifndef S_ISLNK
-#  ifdef _S_ISLNK
-#    define S_ISLNK(m) _S_ISLNK(m)
-#  elif defined __BORLANDC__
-#    ifdef _S_IFLNK
-#      define S_ISLNK(m) (((unsigned short)(m) & S_IFMT) == _S_IFLNK)
-#    else
-#      ifdef S_IFLNK
-#        define S_ISLNK(m) (((unsigned short)(m) & S_IFMT) == S_IFLNK)
-#      endif
-#    endif
-#  else
-#    ifdef _S_IFLNK
-#      define S_ISLNK(m) ((m & S_IFMT) == _S_IFLNK)
-#    else
-#      ifdef S_IFLNK
-#	 define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK)
-#      endif
-#    endif
-#  endif
-#endif
-
-#ifdef S_ISLNK
-    struct stat st;
-
-    SafeStringValue(fname);
-    if (lstat(RSTRING(fname)->ptr, &st) < 0) return Qfalse;
-    if (S_ISLNK(st.st_mode)) return Qtrue;
-#endif
-
-    return Qfalse;
-}
-
-static VALUE
-test_S(obj, fname)
-    VALUE obj, fname;
-{
-#ifndef S_ISSOCK
-#  ifdef _S_ISSOCK
-#    define S_ISSOCK(m) _S_ISSOCK(m)
-#  elif defined __BORLANDC__
-#    ifdef _S_IFSOCK
-#      define S_ISSOCK(m) (((unsigned short)(m) & S_IFMT) == _S_IFSOCK)
-#    else
-#      ifdef S_IFSOCK
-#        define S_ISSOCK(m) (((unsigned short)(m) & S_IFMT) == S_IFSOCK)
-#      endif
-#    endif
-#  else
-#    ifdef _S_IFSOCK
-#      define S_ISSOCK(m) ((m & S_IFMT) == _S_IFSOCK)
-#    else
-#      ifdef S_IFSOCK
-#	 define S_ISSOCK(m) ((m & S_IFMT) == S_IFSOCK)
-#      endif
-#    endif
-#  endif
-#endif
-
-#ifdef S_ISSOCK
-    struct stat st;
-
-    if (rb_stat(fname, &st) < 0) return Qfalse;
-    if (S_ISSOCK(st.st_mode)) return Qtrue;
-
-#endif
-    return Qfalse;
-}
-
-static VALUE
-test_b(obj, fname)
-    VALUE obj, fname;
-{
-#ifndef S_ISBLK
-#   ifdef S_IFBLK
-#	define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK)
-#   else
-#	define S_ISBLK(m) (0)  /* anytime false */
-#   endif
-#endif
-
-#ifdef S_ISBLK
-    struct stat st;
-
-    if (rb_stat(fname, &st) < 0) return Qfalse;
-    if (S_ISBLK(st.st_mode)) return Qtrue;
-
-#endif
-    return Qfalse;
-}
-
-static VALUE
-test_c(obj, fname)
-    VALUE obj, fname;
-{
-#ifndef S_ISCHR
-#   define S_ISCHR(m) ((m & S_IFMT) == S_IFCHR)
-#endif
-
-    struct stat st;
-
-    if (rb_stat(fname, &st) < 0) return Qfalse;
-    if (S_ISCHR(st.st_mode)) return Qtrue;
-
-    return Qfalse;
-}
-
-static VALUE
-test_e(obj, fname)
-    VALUE obj, fname;
-{
-    struct stat st;
-
-    if (rb_stat(fname, &st) < 0) return Qfalse;
-    return Qtrue;
-}
-
-static VALUE
-test_r(obj, fname)
-    VALUE obj, fname;
-{
-    SafeStringValue(fname);
-    if (eaccess(RSTRING(fname)->ptr, R_OK) < 0) return Qfalse;
-    return Qtrue;
-}
-
-static VALUE
-test_R(obj, fname)
-    VALUE obj, fname;
-{
-    SafeStringValue(fname);
-    if (access(RSTRING(fname)->ptr, R_OK) < 0) return Qfalse;
-    return Qtrue;
-}
-
-static VALUE
-test_w(obj, fname)
-    VALUE obj, fname;
-{
-    SafeStringValue(fname);
-    if (eaccess(RSTRING(fname)->ptr, W_OK) < 0) return Qfalse;
-    return Qtrue;
-}
-
-static VALUE
-test_W(obj, fname)
-    VALUE obj, fname;
-{
-    SafeStringValue(fname);
-    if (access(RSTRING(fname)->ptr, W_OK) < 0) return Qfalse;
-    return Qtrue;
-}
-
-static VALUE
-test_x(obj, fname)
-    VALUE obj, fname;
-{
-    SafeStringValue(fname);
-    if (eaccess(RSTRING(fname)->ptr, X_OK) < 0) return Qfalse;
-    return Qtrue;
-}
-
-static VALUE
-test_X(obj, fname)
-    VALUE obj, fname;
-{
-    SafeStringValue(fname);
-    if (access(RSTRING(fname)->ptr, X_OK) < 0) return Qfalse;
-    return Qtrue;
-}
-
-#ifndef S_ISREG
-#   define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
-#endif
-
-static VALUE
-test_f(obj, fname)
-    VALUE obj, fname;
-{
-    struct stat st;
-
-    if (rb_stat(fname, &st) < 0) return Qfalse;
-    if (S_ISREG(st.st_mode)) return Qtrue;
-    return Qfalse;
-}
-
-static VALUE
-test_z(obj, fname)
-    VALUE obj, fname;
-{
-    struct stat st;
-
-    if (rb_stat(fname, &st) < 0) return Qfalse;
-    if (st.st_size == 0) return Qtrue;
-    return Qfalse;
-}
-
-static VALUE
-test_s(obj, fname)
-    VALUE obj, fname;
-{
-    struct stat st;
-
-    if (rb_stat(fname, &st) < 0) return Qnil;
-    if (st.st_size == 0) return Qnil;
-    return OFFT2NUM(st.st_size);
-}
-
-static VALUE
-test_owned(obj, fname)
-    VALUE obj, fname;
-{
-    struct stat st;
-
-    if (rb_stat(fname, &st) < 0) return Qfalse;
-    if (st.st_uid == geteuid()) return Qtrue;
-    return Qfalse;
-}
-
-static VALUE
-test_rowned(obj, fname)
-    VALUE obj, fname;
-{
-    struct stat st;
-
-    if (rb_stat(fname, &st) < 0) return Qfalse;
-    if (st.st_uid == getuid()) return Qtrue;
-    return Qfalse;
-}
-
-static VALUE
-test_grpowned(obj, fname)
-    VALUE obj, fname;
-{
-#ifndef NT
-    struct stat st;
-
-    if (rb_stat(fname, &st) < 0) return Qfalse;
-    if (st.st_gid == getegid()) return Qtrue;
-#endif
-    return Qfalse;
-}
-
-#if defined(S_ISUID) || defined(S_ISGID) || defined(S_ISVTX)
-static VALUE
-check3rdbyte(fname, mode)
-    VALUE fname;
-    int mode;
-{
-    struct stat st;
-
-    SafeStringValue(fname);
-    if (stat(RSTRING(fname)->ptr, &st) < 0) return Qfalse;
-    if (st.st_mode & mode) return Qtrue;
-    return Qfalse;
-}
-#endif
-
-static VALUE
-test_suid(obj, fname)
-    VALUE obj, fname;
-{
-#ifdef S_ISUID
-    return check3rdbyte(fname, S_ISUID);
-#else
-    return Qfalse;
-#endif
-}
-
-static VALUE
-test_sgid(obj, fname)
-    VALUE obj, fname;
-{
-#ifdef S_ISGID
-    return check3rdbyte(fname, S_ISGID);
-#else
-    return Qfalse;
-#endif
-}
-
-static VALUE
-test_sticky(obj, fname)
-    VALUE obj, fname;
-{
-#ifdef S_ISVTX
-    return check3rdbyte(fname, S_ISVTX);
-#else
-    return Qnil;
-#endif
-}
-
-static VALUE
-rb_file_s_size(klass, fname)
-    VALUE klass, fname;
-{
-    struct stat st;
-
-    if (rb_stat(fname, &st) < 0)
-	rb_sys_fail(RSTRING(fname)->ptr);
-    return rb_int2inum(st.st_size);
-}
-
-static VALUE
-rb_file_ftype(st)
-    struct stat *st;
-{
-    char *t;
-
-    if (S_ISREG(st->st_mode)) {
-	t = "file";
-    }
-    else if (S_ISDIR(st->st_mode)) {
-	t = "directory";
-    }
-    else if (S_ISCHR(st->st_mode)) {
-	t = "characterSpecial";
-    }
-#ifdef S_ISBLK
-    else if (S_ISBLK(st->st_mode)) {
-	t = "blockSpecial";
-    }
-#endif
-#ifdef S_ISFIFO
-    else if (S_ISFIFO(st->st_mode)) {
-	t = "fifo";
-    }
-#endif
-#ifdef S_ISLNK
-    else if (S_ISLNK(st->st_mode)) {
-	t = "link";
-    }
-#endif
-#ifdef S_ISSOCK
-    else if (S_ISSOCK(st->st_mode)) {
-	t = "socket";
-    }
-#endif
-    else {
-	t = "unknown";
-    }
-
-    return rb_str_new2(t);
-}
-
-static VALUE
-rb_file_s_ftype(klass, fname)
-    VALUE klass, fname;
-{
-    struct stat st;
-
-    SafeStringValue(fname);
-    if (lstat(RSTRING(fname)->ptr, &st) == -1) {
-	rb_sys_fail(RSTRING(fname)->ptr);
-    }
-
-    return rb_file_ftype(&st);
-}
-
-static VALUE
-rb_file_s_atime(klass, fname)
-    VALUE klass, fname;
-{
-    struct stat st;
-
-    if (rb_stat(fname, &st) < 0)
-	rb_sys_fail(RSTRING(fname)->ptr);
-    return rb_time_new(st.st_atime, 0);
-}
-
-static VALUE
-rb_file_atime(obj)
-    VALUE obj;
-{
-    OpenFile *fptr;
-    struct stat st;
-
-    GetOpenFile(obj, fptr);
-    if (fstat(fileno(fptr->f), &st) == -1) {
-	rb_sys_fail(fptr->path);
-    }
-    return rb_time_new(st.st_atime, 0);
-}
-
-static VALUE
-rb_file_s_mtime(klass, fname)
-    VALUE klass, fname;
-{
-    struct stat st;
-
-    if (rb_stat(fname, &st) < 0)
-	rb_sys_fail(RSTRING(fname)->ptr);
-    return rb_time_new(st.st_mtime, 0);
-}
-
-static VALUE
-rb_file_mtime(obj)
-    VALUE obj;
-{
-    OpenFile *fptr;
-    struct stat st;
-
-    GetOpenFile(obj, fptr);
-    if (fstat(fileno(fptr->f), &st) == -1) {
-	rb_sys_fail(fptr->path);
-    }
-    return rb_time_new(st.st_mtime, 0);
-}
-
-static VALUE
-rb_file_s_ctime(klass, fname)
-    VALUE klass, fname;
-{
-    struct stat st;
-
-    if (rb_stat(fname, &st) < 0)
-	rb_sys_fail(RSTRING(fname)->ptr);
-    return rb_time_new(st.st_ctime, 0);
-}
-
-static VALUE
-rb_file_ctime(obj)
-    VALUE obj;
-{
-    OpenFile *fptr;
-    struct stat st;
-
-    GetOpenFile(obj, fptr);
-    if (fstat(fileno(fptr->f), &st) == -1) {
-	rb_sys_fail(fptr->path);
-    }
-    return rb_time_new(st.st_ctime, 0);
-}
-
-static void
-chmod_internal(path, mode)
-    const char *path;
-    int mode;
-{
-    if (chmod(path, mode) < 0)
-	rb_sys_fail(path);
-}
-
-static VALUE
-rb_file_s_chmod(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE vmode;
-    VALUE rest;
-    int mode, n;
-
-    rb_secure(2);
-    rb_scan_args(argc, argv, "1*", &vmode, &rest);
-    mode = NUM2INT(vmode);
-
-    n = apply2files(chmod_internal, rest, mode);
-    return INT2FIX(n);
-}
-
-static VALUE
-rb_file_chmod(obj, vmode)
-    VALUE obj, vmode;
-{
-    OpenFile *fptr;
-    int mode;
-
-    rb_secure(2);
-    mode = NUM2INT(vmode);
-
-    GetOpenFile(obj, fptr);
-#ifdef HAVE_FCHMOD
-    if (fchmod(fileno(fptr->f), mode) == -1)
-	rb_sys_fail(fptr->path);
-#else
-    if (!fptr->path) return Qnil;
-    if (chmod(fptr->path, mode) == -1)
-	rb_sys_fail(fptr->path);
-#endif
-
-    return INT2FIX(0);
-}
-
-#if defined(HAVE_LCHMOD)
-static void
-lchmod_internal(path, mode)
-    const char *path;
-    int mode;
-{
-    if (lchmod(path, mode) < 0)
-	rb_sys_fail(path);
-}
-
-static VALUE
-rb_file_s_lchmod(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE vmode;
-    VALUE rest;
-    int mode, n;
-
-    rb_secure(2);
-    rb_scan_args(argc, argv, "1*", &vmode, &rest);
-    mode = NUM2INT(vmode);
-
-    n = apply2files(lchmod_internal, rest, mode);
-    return INT2FIX(n);
-}
-#else
-static VALUE
-rb_file_s_lchmod(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    rb_notimplement();
-}
-#endif
-
-struct chown_args {
-    int owner, group;
-};
-
-static void
-chown_internal(path, args)
-    const char *path;
-    struct chown_args *args;
-{
-    if (chown(path, args->owner, args->group) < 0)
-	rb_sys_fail(path);
-}
-
-static VALUE
-rb_file_s_chown(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE o, g, rest;
-    struct chown_args arg;
-    int n;
-
-    rb_secure(2);
-    rb_scan_args(argc, argv, "2*", &o, &g, &rest);
-    if (NIL_P(o)) {
-	arg.owner = -1;
-    }
-    else {
-	arg.owner = NUM2INT(o);
-    }
-    if (NIL_P(g)) {
-	arg.group = -1;
-    }
-    else {
-	arg.group = NUM2INT(g);
-    }
-
-    n = apply2files(chown_internal, rest, &arg);
-    return INT2FIX(n);
-}
-
-static VALUE
-rb_file_chown(obj, owner, group)
-    VALUE obj, owner, group;
-{
-    OpenFile *fptr;
-
-    rb_secure(2);
-    GetOpenFile(obj, fptr);
-#if defined(DJGPP) || defined(__CYGWIN32__) || defined(NT) || defined(__EMX__)
-    if (!fptr->path) return Qnil;
-    if (chown(fptr->path, NUM2INT(owner), NUM2INT(group)) == -1)
-	rb_sys_fail(fptr->path);
-#else
-    if (fchown(fileno(fptr->f), NUM2INT(owner), NUM2INT(group)) == -1)
-	rb_sys_fail(fptr->path);
-#endif
-
-    return INT2FIX(0);
-}
-
-#if defined(HAVE_LCHOWN) && !defined(__CHECKER__)
-static void
-lchown_internal(path, args)
-    const char *path;
-    struct chown_args *args;
-{
-    if (lchown(path, args->owner, args->group) < 0)
-	rb_sys_fail(path);
-}
-
-static VALUE
-rb_file_s_lchown(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE o, g, rest;
-    struct chown_args arg;
-    int n;
-
-    rb_secure(2);
-    rb_scan_args(argc, argv, "2*", &o, &g, &rest);
-    if (NIL_P(o)) {
-	arg.owner = -1;
-    }
-    else {
-	arg.owner = NUM2INT(o);
-    }
-    if (NIL_P(g)) {
-	arg.group = -1;
-    }
-    else {
-	arg.group = NUM2INT(g);
-    }
-
-    n = apply2files(lchown_internal, rest, &arg);
-    return INT2FIX(n);
-}
-#else
-static VALUE
-rb_file_s_lchown(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    rb_notimplement();
-}
-#endif
-
-struct timeval rb_time_timeval();
-
-#if defined(HAVE_UTIMES) && !defined(__CHECKER__)
-
-static void
-utime_internal(path, tvp)
-    char *path;
-    struct timeval tvp[];
-{
-    if (utimes(path, tvp) < 0)
-	rb_sys_fail(path);
-}
-
-static VALUE
-rb_file_s_utime(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE atime, mtime, rest;
-    struct timeval tvp[2];
-    int n;
-
-    rb_scan_args(argc, argv, "2*", &atime, &mtime, &rest);
-
-    tvp[0] = rb_time_timeval(atime);
-    tvp[1] = rb_time_timeval(mtime);
-
-    n = apply2files(utime_internal, rest, tvp);
-    return INT2FIX(n);
-}
-
-#else
-
-#ifndef HAVE_UTIME_H
-# ifdef NT
-#   if defined(__BORLANDC__)
-#     include 
-#   else
-#  include 
-#   endif
-#   if defined(_MSC_VER) || defined __MINGW32__
-#  define utimbuf _utimbuf
-#   endif
-# else
-struct utimbuf {
-    long actime;
-    long modtime;
-};
-# endif
-#endif
-
-static void
-utime_internal(path, utp)
-    const char *path;
-    struct utimbuf *utp;
-{
-    if (utime(path, utp) < 0)
-	rb_sys_fail(path);
-}
-
-static VALUE
-rb_file_s_utime(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE atime, mtime, rest;
-    int n;
-    struct timeval tv;
-    struct utimbuf utbuf;
-
-    rb_scan_args(argc, argv, "2*", &atime, &mtime, &rest);
-
-    tv = rb_time_timeval(atime);
-    utbuf.actime = tv.tv_sec;
-    tv = rb_time_timeval(mtime);
-    utbuf.modtime = tv.tv_sec;
-
-    n = apply2files(utime_internal, rest, &utbuf);
-    return INT2FIX(n);
-}
-
-#endif
-
-static VALUE
-rb_file_s_link(klass, from, to)
-    VALUE klass, from, to;
-{
-    SafeStringValue(from);
-    SafeStringValue(to);
-
-    if (link(RSTRING(from)->ptr, RSTRING(to)->ptr) < 0)
-	rb_sys_fail(RSTRING(from)->ptr);
-    return INT2FIX(0);
-}
-
-static VALUE
-rb_file_s_symlink(klass, from, to)
-    VALUE klass, from, to;
-{
-#ifdef HAVE_SYMLINK
-    SafeStringValue(from);
-    SafeStringValue(to);
-
-    if (symlink(RSTRING(from)->ptr, RSTRING(to)->ptr) < 0)
-	rb_sys_fail(RSTRING(from)->ptr);
-    return INT2FIX(0);
-#else
-    rb_notimplement();
-    return Qnil;		/* not reached */
-#endif
-}
-
-static VALUE
-rb_file_s_readlink(klass, path)
-    VALUE klass, path;
-{
-#ifdef HAVE_READLINK
-    char *buf;
-    int size = 100;
-    int rv;
-    VALUE v;
-
-    SafeStringValue(path);
-    buf = xmalloc(size);
-    if ((rv = readlink(RSTRING(path)->ptr, buf, size)) == size) {
-	size *= 2;
-	buf = xrealloc(buf, size);
-    }
-    if (rv < 0) rb_sys_fail(RSTRING(path)->ptr);
-    v = rb_tainted_str_new(buf, rv);
-    free(buf);
-
-    return v;
-#else
-    rb_notimplement();
-    return Qnil;		/* not reached */
-#endif
-}
-
-static void
-unlink_internal(path)
-    const char *path;
-{
-    if (unlink(path) < 0)
-	rb_sys_fail(path);
-}
-
-static VALUE
-rb_file_s_unlink(klass, args)
-    VALUE klass, args;
-{
-    int n;
-
-    rb_secure(2);
-    n = apply2files(unlink_internal, args, 0);
-    return INT2FIX(n);
-}
-
-static VALUE
-rb_file_s_rename(klass, from, to)
-    VALUE klass, from, to;
-{
-    SafeStringValue(from);
-    SafeStringValue(to);
-
-    if (rename(RSTRING(from)->ptr, RSTRING(to)->ptr) < 0) {
-#if defined __CYGWIN__
-	extern unsigned long __attribute__((stdcall)) GetLastError();
-	errno = GetLastError(); /* This is a Cygwin bug */
-#endif
-	rb_sys_fail(RSTRING(from)->ptr);
-    }
-
-    return INT2FIX(0);
-}
-
-static VALUE
-rb_file_s_umask(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    int omask = 0;
-
-    rb_secure(2);
-    if (argc == 0) {
-	omask = umask(0);
-	umask(omask);
-    }
-    else if (argc == 1) {
-	omask = umask(NUM2INT(argv[0]));
-    }
-    else {
-	rb_raise(rb_eArgError, "wrong number of argument");
-    }
-    return INT2FIX(omask);
-}
-
-#if defined DOSISH
-#define isdirsep(x) ((x) == '/' || (x) == '\\')
-#else
-#define isdirsep(x) ((x) == '/')
-#endif
-#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
-
-static char *
-strrdirsep(path)
-    char *path;
-{
-    char *last = NULL;
-    while (*path) {
-	if (isdirsep(*path)) {
-	    last = path++;
-	}
-	else {
-	    path = CharNext(path);
-	}
-    }
-    return last;
-}
-
-#define BUFCHECK(cond) while (cond) {\
-    long bdiff = p - buf;\
-    buflen *= 2;\
-    rb_str_resize(result, buflen);\
-    buf = RSTRING(result)->ptr;\
-    p = buf + bdiff;\
-    pend = buf + buflen;\
-}
-
-VALUE
-rb_file_s_expand_path(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE fname, dname, result;
-    char *s, *buf, *b, *p, *pend;
-    long buflen = MAXPATHLEN;
-    int tainted;
-
-    rb_scan_args(argc, argv, "11", &fname, &dname);
-    result = rb_str_new(0, buflen + 2);
-
-    s = StringValuePtr(fname);
-    p = buf = RSTRING(result)->ptr;
-    pend = p + buflen;
-    tainted = OBJ_TAINTED(fname);
-
-    if (s[0] == '~') {
-	if (isdirsep(s[1]) || s[1] == '\0') {
-	    char *dir = getenv("HOME");
-
-	    if (!dir) {
-		rb_raise(rb_eArgError, "couldn't find HOME environment -- expanding `%s'", s);
-	    }
-	    BUFCHECK (strlen(dir) > buflen);
-	    strcpy(buf, dir);
-	    p = buf + strlen(dir);
-	    s++;
-	    tainted = 1;
-	}
-	else {
-#ifdef HAVE_PWD_H
-	    struct passwd *pwPtr;
-	    s++;
-#endif
-	    b = s;
-	    while (*s && !isdirsep(*s)) {
-		s = CharNext(s);
-	    }
-	    BUFCHECK (p + (s-b) >= pend);
-	    memcpy(p, b, s-b);
-	    p += s-b;
-	    *p = '\0';
-#ifdef HAVE_PWD_H
-	    pwPtr = getpwnam(buf);
-	    if (!pwPtr) {
-		endpwent();
-		rb_raise(rb_eArgError, "user %s doesn't exist", buf);
-	    }
-	    BUFCHECK (strlen(pwPtr->pw_dir) > buflen);
-	    strcpy(buf, pwPtr->pw_dir);
-	    p = buf + strlen(pwPtr->pw_dir);
-	    endpwent();
-#endif
-	}
-    }
-#if defined DOSISH
-    /* skip drive letter */
-    else if (ISALPHA(s[0]) && s[1] == ':' && isdirsep(s[2])) {
-	b = s;
-	while (*s && !isdirsep(*s)) {
-	    s = CharNext(s);
-	}
-	BUFCHECK (p + (s-b) >= pend);
-	memcpy(p, b, s-b);
-	p += s-b;
-    }
-#endif
-    else if (!isdirsep(*s)) {
-	if (!NIL_P(dname)) {
-	    dname = rb_file_s_expand_path(1, &dname);
-	    if (OBJ_TAINTED(dname)) tainted = 1;
-	    BUFCHECK (RSTRING(dname)->len > buflen);
-	    memcpy(buf, RSTRING(dname)->ptr, RSTRING(dname)->len);
-	    p += RSTRING(dname)->len;
-	}
-	else {
-	    char *dir = my_getcwd();
-
-	    tainted = 1;
-	    BUFCHECK (strlen(dir) > buflen);
-	    strcpy(buf, dir);
-	    free(dir);
-	    p = &buf[strlen(buf)];
-	}
-	while (p > buf && *(p - 1) == '/') p--;
-    }
-    else {
-	while (*s && isdirsep(*s)) {
-	    *p++ = '/';
-	    BUFCHECK (p >= pend);
-	    s++;
-	}
-	if (p > buf && *s) p--;
-    }
-    *p = '/';
-
-    b = s;
-    while (*s) {
-	switch (*s) {
-	  case '.':
-	    if (b == s++) {	/* beginning of path element */
-		switch (*s) {
-		  case '\0':
-		    b = s;
-		    break;
-		  case '.':
-		    if (*(s+1) == '\0' || isdirsep(*(s+1))) {
-			/* We must go back to the parent */
-			*p = '\0';
-			if (!(b = strrdirsep(buf))) {
-			    *p = '/';
-			}
-			else {
-			    p = b;
-			}
-			b = ++s;
-		    }
-		    break;
-		  case '/':
-#if defined DOSISH
-		  case '\\':
-#endif
-		    b = ++s;
-		    break;
-		  default:
-		    /* ordinary path element, beginning don't move */
-		    break;
-		}
-	    }
-	    break;
-	  case '/':
-#if defined DOSISH
-	  case '\\':
-#endif
-	    if (s > b) {
-		BUFCHECK (p + (s-b+1) >= pend);
-		memcpy(++p, b, s-b);
-		p += s-b;
-		*p = '/';
-	    }
-	    b = ++s;
-	    break;
-	  default:
-	    s = CharNext(s);
-	    break;
-	}
-    }
-
-    if (s > b) {
-	BUFCHECK (p + (s-b) >= pend);
-	memcpy(++p, b, s-b);
-	p += s-b;
-    }
-#if defined(DOSISH)
-    else if (ISALPHA(buf[0]) && (buf[1] == ':') && isdirsep(buf[2])) {
-	/* root directory needs a trailing backslash,
-	   otherwise it mean the current directory of the drive */
-	if (p == (buf+2)) p++;
-    }
-    else if (isdirsep(buf[0]) && isdirsep(buf[1])) {
-	if (p == (buf+1)) p++;
-    }
-#endif
-
-    if (tainted) OBJ_TAINT(result);
-    RSTRING(result)->len = p - buf;
-    *p = '\0';
-    return result;
-}
-
-static int
-rmext(p, e)
-    const char *p, *e;
-{
-    int l1, l2;
-
-    if (!e) return 0;
-
-    l1 = strlen(p);
-    l2 = strlen(e);
-    if (l2 == 2 && e[1] == '*') {
-	e = strrchr(p, *e);
-	if (!e) return 0;
-	return e - p;
-    }
-    if (l1 < l2) return l1;
-
-    if (strcmp(p+l1-l2, e) == 0) {
-	return l1-l2;
-    }
-    return 0;
-}
-
-static VALUE
-rb_file_s_basename(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE fname, fext, basename;
-    char *name, *p, *ext = NULL;
-    int f;
-
-    if (rb_scan_args(argc, argv, "11", &fname, &fext) == 2) {
-	ext = StringValuePtr(fext);
-    }
-    name = StringValuePtr(fname);
-    p = strrdirsep(name);
-    if (!p) {
-	if (NIL_P(fext) || !(f = rmext(name, ext)))
-	    return fname;
-	basename = rb_str_new(name, f);
-    }
-    else {
-	p++;			/* skip last / */
-	if (NIL_P(fext) || !(f = rmext(p, ext))) {
-	    basename = rb_str_new2(p);
-	}
-	else {
-	    basename = rb_str_new(p, f);
-	}
-    }
-    OBJ_INFECT(basename, fname);
-    return basename;
-}
-
-static VALUE
-rb_file_s_dirname(klass, fname)
-    VALUE klass, fname;
-{
-    char *name, *p;
-    VALUE dirname;
-
-    name = StringValuePtr(fname);
-    p = strrdirsep(name);
-    if (!p) {
-	return rb_str_new2(".");
-    }
-    if (p == name)
-	p++;
-    dirname = rb_str_new(name, p - name);
-    OBJ_INFECT(dirname, fname);
-    return dirname;
-}
-
-static VALUE
-rb_file_s_extname(klass, fname)
-    VALUE klass, fname;
-{
-    char *name, *p, *e;
-    VALUE extname;
-
-    name = StringValuePtr(fname);
-    p = strrdirsep(name);	/* get the last path component */
-    if (!p)
- 	p = name;
-    else
- 	p++;
- 
-     e = strrchr(p, '.');	/* get the last dot of the last component */
-     if (!e || e == p)		/* no dot, or the only dot is first? */
-	 return rb_str_new2("");
-     extname = rb_str_new2(e);	/* keep the dot, too! */
-     OBJ_INFECT(extname, fname);
-     return extname;
-}
-
-static VALUE
-rb_file_s_split(klass, path)
-    VALUE klass, path;
-{
-    return rb_assoc_new(rb_file_s_dirname(Qnil, path), rb_file_s_basename(1,&path));
-}
-
-static VALUE separator;
-
-static VALUE
-rb_file_s_join(klass, args)
-    VALUE klass, args;
-{
-    return rb_ary_join(args, separator);
-}
-
-static VALUE
-rb_file_s_truncate(klass, path, len)
-    VALUE klass, path, len;
-{
-    rb_secure(2);
-    SafeStringValue(path);
-
-#ifdef HAVE_TRUNCATE
-    if (truncate(RSTRING(path)->ptr, NUM2OFFT(len)) < 0)
-	rb_sys_fail(RSTRING(path)->ptr);
-#else
-# ifdef HAVE_CHSIZE
-    {
-	int tmpfd;
-
-#  if defined(NT)
-	if ((tmpfd = open(RSTRING(path)->ptr, O_RDWR)) < 0) {
-	    rb_sys_fail(RSTRING(path)->ptr);
-	}
-#  else
-	if ((tmpfd = open(RSTRING(path)->ptr, 0)) < 0) {
-	    rb_sys_fail(RSTRING(path)->ptr);
-	}
-#  endif
-	if (chsize(tmpfd, NUM2OFFT(len)) < 0) {
-	    close(tmpfd);
-	    rb_sys_fail(RSTRING(path)->ptr);
-	}
-	close(tmpfd);
-    }
-# else
-    rb_notimplement();
-# endif
-#endif
-    return INT2FIX(0);
-}
-
-static VALUE
-rb_file_truncate(obj, len)
-    VALUE obj, len;
-{
-    OpenFile *fptr;
-
-    rb_secure(2);
-    GetOpenFile(obj, fptr);
-    if (!(fptr->mode & FMODE_WRITABLE)) {
-	rb_raise(rb_eIOError, "not opened for writing");
-    }
-#ifdef HAVE_TRUNCATE
-    if (ftruncate(fileno(fptr->f), NUM2OFFT(len)) < 0)
-	rb_sys_fail(fptr->path);
-#else
-# ifdef HAVE_CHSIZE
-    if (chsize(fileno(fptr->f), NUM2OFFT(len)) < 0)
-	rb_sys_fail(fptr->path);
-# else
-    rb_notimplement();
-# endif
-#endif
-    return INT2FIX(0);
-}
-
-# ifndef LOCK_SH
-#  define LOCK_SH 1
-# endif
-# ifndef LOCK_EX
-#  define LOCK_EX 2
-# endif
-# ifndef LOCK_NB
-#  define LOCK_NB 4
-# endif
-# ifndef LOCK_UN
-#  define LOCK_UN 8
-# endif
-
-#if 0
-static int
-rb_thread_flock(fd, op, fptr)
-    int fd, op;
-    OpenFile *fptr;
-{
-    if (rb_thread_alone() || (op & LOCK_NB)) {
-	return flock(fd, op);
-    }
-    op |= LOCK_NB;
-    while (flock(fd, op) < 0) {
-	switch (errno) {
-          case EAGAIN:
-          case EACCES:
-#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
-	  case EWOULDBLOCK:
-#endif
-	    rb_thread_polling();	/* busy wait */
-	    rb_io_check_closed(fptr);
-            continue;
-	  default:
-	    return -1;
-	}
-    }
-    return 0;
-}
-#define flock(fd, op) rb_thread_flock(fd, op, fptr)
-#endif
-
-static VALUE
-rb_file_flock(obj, operation)
-    VALUE obj;
-    VALUE operation;
-{
-#ifndef __CHECKER__
-    OpenFile *fptr;
-    int ret;
-
-    rb_secure(2);
-    GetOpenFile(obj, fptr);
-
-    if (fptr->mode & FMODE_WRITABLE) {
-	fflush(GetWriteFile(fptr));
-    }
-    TRAP_BEG;
-    ret = flock(fileno(fptr->f), NUM2INT(operation));
-    TRAP_END;
-    if (ret < 0) {
-        switch (errno) {
-          case EAGAIN:
-          case EACCES:
-#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
-          case EWOULDBLOCK:
-#endif
-              return Qfalse;
-        }
-	rb_sys_fail(fptr->path);
-    }
-#endif
-    return INT2FIX(0);
-}
-#undef flock
-
-static void
-test_check(n, argc, argv)
-    int n, argc;
-    VALUE *argv;
-{
-    int i;
-
-    n+=1;
-    if (n != argc) rb_raise(rb_eArgError, "wrong number of arguments(%d for %d)", argc, n);
-    for (i=1; iptr);
-	}
-
-	switch (cmd) {
-	  case 'A':
-	    return rb_time_new(st.st_atime, 0);
-	  case 'M':
-	    return rb_time_new(st.st_mtime, 0);
-	  case 'C':
-	    return rb_time_new(st.st_ctime, 0);
-	}
-    }
-
-    if (strchr("-=<>", cmd)) {
-	struct stat st1, st2;
-
-	CHECK(2);
-	if (rb_stat(argv[1], &st1) < 0) return Qfalse;
-	if (rb_stat(argv[2], &st2) < 0) return Qfalse;
-
-	switch (cmd) {
-	  case '-':
-	    if (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino)
-		return Qtrue;
-            return Qfalse;
-
-	  case '=':
-	    if (st1.st_mtime == st2.st_mtime) return Qtrue;
-	    return Qfalse;
-
-	  case '>':
-	    if (st1.st_mtime > st2.st_mtime) return Qtrue;
-	    return Qfalse;
-
-	  case '<':
-	    if (st1.st_mtime < st2.st_mtime) return Qtrue;
-	    return Qfalse;
-        }
-    }
-    /* unknown command */
-    rb_raise(rb_eArgError, "unknown command ?%c", cmd);
-    return Qnil;		/* not reached */
-}
-
-static VALUE
-rb_stat_s_alloc(klass)
-    VALUE klass;
-{
-    return stat_new_0(klass, 0);
-}
-
-static VALUE
-rb_stat_init(obj, fname)
-    VALUE obj, fname;
-{
-    struct stat st, *nst;
-
-    SafeStringValue(fname);
-
-    if (stat(RSTRING(fname)->ptr, &st) == -1) {
-	rb_sys_fail(RSTRING(fname)->ptr);
-    }
-    nst = ALLOC(struct stat);
-    *nst = st;
-    DATA_PTR(obj) = nst;
-
-    return Qnil;
-}
-
-static VALUE
-rb_stat_clone(obj)
-    VALUE obj;
-{
-    struct stat *nst;
-
-    VALUE clone;
-
-    clone = rb_obj_alloc(RBASIC(obj)->klass);
-    CLONESETUP(clone,obj);
-    if (DATA_PTR(obj)) {
-	nst = ALLOC(struct stat);
-	*nst = *(struct stat*)DATA_PTR(obj);
-	DATA_PTR(clone) = nst;
-    }
-
-    return clone;
-}
-
-static VALUE
-rb_stat_ftype(obj)
-    VALUE obj;
-{
-    return rb_file_ftype(get_stat(obj));
-}
-
-static VALUE
-rb_stat_d(obj)
-    VALUE obj;
-{
-    if (S_ISDIR(get_stat(obj)->st_mode)) return Qtrue;
-    return Qfalse;
-}
-
-static VALUE
-rb_stat_p(obj)
-    VALUE obj;
-{
-#ifdef S_IFIFO
-    if (S_ISFIFO(get_stat(obj)->st_mode)) return Qtrue;
-
-#endif
-    return Qfalse;
-}
-
-static VALUE
-rb_stat_l(obj)
-    VALUE obj;
-{
-#ifdef S_ISLNK
-    if (S_ISLNK(get_stat(obj)->st_mode)) return Qtrue;
-#endif
-    return Qfalse;
-}
-
-static VALUE
-rb_stat_S(obj)
-    VALUE obj;
-{
-#ifdef S_ISSOCK
-    if (S_ISSOCK(get_stat(obj)->st_mode)) return Qtrue;
-
-#endif
-    return Qfalse;
-}
-
-static VALUE
-rb_stat_b(obj)
-    VALUE obj;
-{
-#ifdef S_ISBLK
-    if (S_ISBLK(get_stat(obj)->st_mode)) return Qtrue;
-
-#endif
-    return Qfalse;
-}
-
-static VALUE
-rb_stat_c(obj)
-    VALUE obj;
-{
-    if (S_ISCHR(get_stat(obj)->st_mode)) return Qtrue;
-
-    return Qfalse;
-}
-
-static VALUE
-rb_stat_owned(obj)
-    VALUE obj;
-{
-    if (get_stat(obj)->st_uid == geteuid()) return Qtrue;
-    return Qfalse;
-}
-
-static VALUE
-rb_stat_rowned(obj)
-    VALUE obj;
-{
-    if (get_stat(obj)->st_uid == getuid()) return Qtrue;
-    return Qfalse;
-}
-
-static VALUE
-rb_stat_grpowned(obj)
-    VALUE obj;
-{
-#ifndef NT
-    if (get_stat(obj)->st_gid == getegid()) return Qtrue;
-#endif
-    return Qfalse;
-}
-
-static VALUE
-rb_stat_r(obj)
-    VALUE obj;
-{
-    struct stat *st = get_stat(obj);
-
-#ifdef S_IRUSR
-    if (rb_stat_owned(obj))
-	return st->st_mode & S_IRUSR ? Qtrue : Qfalse;
-#endif
-#ifdef S_IRGRP
-    if (rb_stat_grpowned(obj))
-	return st->st_mode & S_IRGRP ? Qtrue : Qfalse;
-#endif
-#ifdef S_IROTH
-    if (!(st->st_mode & S_IROTH)) return Qfalse;
-#endif
-    return Qtrue;
-}
-
-static VALUE
-rb_stat_R(obj)
-    VALUE obj;
-{
-    struct stat *st = get_stat(obj);
-
-#ifdef S_IRUSR
-    if (rb_stat_rowned(obj))
-	return st->st_mode & S_IRUSR ? Qtrue : Qfalse;
-#endif
-#ifdef S_IRGRP
-    if (group_member(get_stat(obj)->st_gid))
-	return st->st_mode & S_IRGRP ? Qtrue : Qfalse;
-#endif
-#ifdef S_IROTH
-    if (!(st->st_mode & S_IROTH)) return Qfalse;
-#endif
-    return Qtrue;
-}
-
-static VALUE
-rb_stat_w(obj)
-    VALUE obj;
-{
-    struct stat *st = get_stat(obj);
-
-#ifdef S_IWUSR
-    if (rb_stat_owned(obj))
-	return st->st_mode & S_IWUSR ? Qtrue : Qfalse;
-#endif
-#ifdef S_IWGRP
-    if (rb_stat_grpowned(obj))
-	return st->st_mode & S_IWGRP ? Qtrue : Qfalse;
-#endif
-#ifdef S_IWOTH
-    if (!(st->st_mode & S_IWOTH)) return Qfalse;
-#endif
-    return Qtrue;
-}
-
-static VALUE
-rb_stat_W(obj)
-    VALUE obj;
-{
-    struct stat *st = get_stat(obj);
-
-#ifdef S_IWUSR
-    if (rb_stat_rowned(obj))
-	return st->st_mode & S_IWUSR ? Qtrue : Qfalse;
-#endif
-#ifdef S_IWGRP
-    if (group_member(get_stat(obj)->st_gid))
-	return st->st_mode & S_IWGRP ? Qtrue : Qfalse;
-#endif
-#ifdef S_IWOTH
-    if (!(st->st_mode & S_IWOTH)) return Qfalse;
-#endif
-    return Qtrue;
-}
-
-static VALUE
-rb_stat_x(obj)
-    VALUE obj;
-{
-    struct stat *st = get_stat(obj);
-
-#ifdef S_IXUSR
-    if (rb_stat_owned(obj))
-	return st->st_mode & S_IXUSR ? Qtrue : Qfalse;
-#endif
-#ifdef S_IXGRP
-    if (rb_stat_grpowned(obj))
-	return st->st_mode & S_IXGRP ? Qtrue : Qfalse;
-#endif
-#ifdef S_IXOTH
-    if (!(st->st_mode & S_IXOTH)) return Qfalse;
-#endif
-    return Qtrue;
-}
-
-static VALUE
-rb_stat_X(obj)
-    VALUE obj;
-{
-    struct stat *st = get_stat(obj);
-
-#ifdef S_IXUSR
-    if (rb_stat_rowned(obj))
-	return st->st_mode & S_IXUSR ? Qtrue : Qfalse;
-#endif
-#ifdef S_IXGRP
-    if (group_member(get_stat(obj)->st_gid))
-	return st->st_mode & S_IXGRP ? Qtrue : Qfalse;
-#endif
-#ifdef S_IXOTH
-    if (!(st->st_mode & S_IXOTH)) return Qfalse;
-#endif
-    return Qtrue;
-}
-
-static VALUE
-rb_stat_f(obj)
-    VALUE obj;
-{
-    if (S_ISREG(get_stat(obj)->st_mode)) return Qtrue;
-    return Qfalse;
-}
-
-static VALUE
-rb_stat_z(obj)
-    VALUE obj;
-{
-    if (get_stat(obj)->st_size == 0) return Qtrue;
-    return Qfalse;
-}
-
-static VALUE
-rb_stat_s(obj)
-    VALUE obj;
-{
-    int size = get_stat(obj)->st_size;
-
-    if (size == 0) return Qnil;
-    return INT2FIX(size);
-}
-
-static VALUE
-rb_stat_suid(obj)
-    VALUE obj;
-{
-#ifdef S_ISUID
-    if (get_stat(obj)->st_mode & S_ISUID) return Qtrue;
-#endif
-    return Qfalse;
-}
-
-static VALUE
-rb_stat_sgid(obj)
-    VALUE obj;
-{
-#ifdef S_ISGID
-    if (get_stat(obj)->st_mode & S_ISGID) return Qtrue;
-#endif
-    return Qfalse;
-}
-
-static VALUE
-rb_stat_sticky(obj)
-    VALUE obj;
-{
-#ifdef S_ISVTX
-    if (get_stat(obj)->st_mode & S_ISVTX) return Qtrue;
-#endif
-    return Qfalse;
-}
-
-static VALUE rb_mFConst;
-
-void
-rb_file_const(name, value)
-    const char *name;
-    VALUE value;
-{
-    rb_define_const(rb_mFConst, name, value);
-    rb_define_const(rb_cIO, name, value);
-    rb_define_const(rb_cFile, name, value);
-}
-
-static int
-is_absolute_path(path)
-    const char *path;
-{
-#ifdef DOSISH
-    if (ISALPHA(path[0]) && path[1] == ':' && isdirsep(path[2])) return 1;
-    if (isdirsep(path[0]) && isdirsep(path[1])) return 1;
-#else
-    if (path[0] == '/') return 1;
-#endif
-    return 0;
-}
-
-static int
-path_check_1(path)
-     VALUE path;
-{
-    struct stat st;
-    char *p0 = RSTRING(path)->ptr;
-    char *p = 0, *s;
-
-    if (!is_absolute_path(p0)) {
-	char *buf = my_getcwd();
-	VALUE newpath;
-
-	newpath = rb_str_new2(buf);
-	free(buf);
-
-	rb_str_cat2(newpath, "/");
-	rb_str_cat2(newpath, p0);
-	return path_check_1(newpath);
-    }
-    for (;;) {
-#ifndef S_IWOTH
-# define S_IWOTH 002
-#endif
-	if (stat(p0, &st) == 0 && S_ISDIR(st.st_mode) && (st.st_mode & S_IWOTH)
-#ifdef S_ISVTX
-	    && (!p || !(st.st_mode & S_ISVTX))
-#endif
-	    ) {
-	    rb_warn("Unsecure world writeable dir %s , mode 0%o", p0, st.st_mode);
-	    if (p) *p = '/';
-	    return 0;
-	}
-	s = strrdirsep(p0);
-	if (p) *p = '/';
-	if (!s || s == p0) return 1;
-	p = s;
-	*p = '\0';
-    }
-}
-
-int
-rb_path_check(path)
-    char *path;
-{
-    char *p0, *p, *pend;
-    const char sep = PATH_SEP_CHAR;
-
-    if (!path) return 1;
-
-    pend = path + strlen(path);
-    p0 = path;
-    p = strchr(path, sep);
-    if (!p) p = pend;
-
-    for (;;) {
-	if (!path_check_1(rb_str_new(p0, p - p0))) {
-	    return 0;		/* not safe */
-	}
-	p0 = p + 1;
-	if (p0 > pend) break;
-	p = strchr(p0, sep);
-	if (!p) p = pend;
-    }
-    return 1;
-}
-
-#if defined(__MACOS__) || defined(riscos)
-static int
-is_macos_native_path(path)
-    const char *path;
-{
-    if (strchr(path, ':')) return 1;
-    return 0;
-}
-#endif
-
-static int
-file_load_ok(file)
-    char *file;
-{
-    FILE *f;
-
-    if (!file) return 0;
-    f = fopen(file, "r");
-    if (f == NULL) return 0;
-    fclose(f);
-    return 1;
-}
-
-extern VALUE rb_load_path;
-
-int
-rb_find_file_ext(filep, ext)
-    VALUE *filep;
-    const char * const *ext;
-{
-    char *path, *found;
-    char *f = RSTRING(*filep)->ptr;
-    VALUE fname;
-    int i, j;
-
-    if (f[0] == '~') {
-	fname = rb_file_s_expand_path(1, filep);
-	if (rb_safe_level() >= 2 && OBJ_TAINTED(fname)) {
-	    rb_raise(rb_eSecurityError, "loading from unsafe file %s", f);
-	}
-	f = StringValuePtr(fname);
-	*filep = fname;
-    }
-
-    if (is_absolute_path(f)) {
-	for (i=0; ext[i]; i++) {
-	    fname = rb_str_dup(*filep);
-	    rb_str_cat2(fname, ext[i]);
-	    if (file_load_ok(RSTRING(fname)->ptr)) {
-		*filep = fname;
-		return i+1;
-	    }
-	}
-	return 0;
-    }
-
-    if (!rb_load_path) return 0;
-
-    Check_Type(rb_load_path, T_ARRAY);
-    for (i=0;ilen;i++) {
-	VALUE str = RARRAY(rb_load_path)->ptr[i];
-
-	SafeStringValue(str);
-	path = RSTRING(str)->ptr;
-	for (j=0; ext[j]; j++) {
-	    fname = rb_str_dup(*filep);
-	    rb_str_cat2(fname, ext[j]);
-	    found = dln_find_file(RSTRING(fname)->ptr, path);
-	    if (found && file_load_ok(found)) {
-		*filep = fname;
-		return j+1;
-	    }
-	}
-    }
-    return 0;
-}
-
-VALUE
-rb_find_file(path)
-    VALUE path;
-{
-    VALUE tmp;
-    char *f = RSTRING(path)->ptr;
-    char *lpath;
-
-    if (f[0] == '~') {
-	path = rb_file_s_expand_path(1, &path);
-	if (rb_safe_level() >= 2 && OBJ_TAINTED(path)) {
-	    rb_raise(rb_eSecurityError, "loading from unsafe file %s", f);
-	}
-	f = StringValuePtr(path);
-    }
-
-#if defined(__MACOS__) || defined(riscos)
-    if (is_macos_native_path(f)) {
-	if (rb_safe_level() >= 2 && !rb_path_check(f)) {
-	    rb_raise(rb_eSecurityError, "loading from unsafe file %s", f);
-	}
-	if (file_load_ok(f)) return path;
-    }
-#endif
-
-    if (is_absolute_path(f)) {
-	if (rb_safe_level() >= 2 && !rb_path_check(f)) {
-	    rb_raise(rb_eSecurityError, "loading from unsafe file %s", f);
-	}
-	if (file_load_ok(f)) return path;
-    }
-
-    if (rb_safe_level() >= 4) {
-	rb_raise(rb_eSecurityError, "loading from non-absolute path %s", f);
-    }
-
-    if (rb_load_path) {
-	int i;
-
-	Check_Type(rb_load_path, T_ARRAY);
-	tmp = rb_ary_new();
-	for (i=0;ilen;i++) {
-	    VALUE str = RARRAY(rb_load_path)->ptr[i];
-	    SafeStringValue(str);
-	    if (RSTRING(str)->len > 0) {
-		rb_ary_push(tmp, str);
-	    }
-	}
-	tmp = rb_ary_join(tmp, rb_str_new2(PATH_SEP));
-	lpath = StringValuePtr(tmp);
-	if (rb_safe_level() >= 2 && !rb_path_check(lpath)) {
-	    rb_raise(rb_eSecurityError, "loading from unsafe path %s", lpath);
-	}
-    }
-    else {
-	lpath = 0;
-    }
-
-    f = dln_find_file(f, lpath);
-    if (file_load_ok(f)) {
-	return rb_str_new2(f);
-    }
-    return 0;
-}
-
-static void
-define_filetest_function(name, func, argc)
-    const char *name;
-    VALUE (*func)();
-    int argc;
-{
-    rb_define_module_function(rb_mFileTest, name, func, argc);
-    rb_define_singleton_method(rb_cFile, name, func, argc);
-}
-
-void
-Init_File()
-{
-    rb_mFileTest = rb_define_module("FileTest");
-    rb_cFile = rb_define_class("File", rb_cIO);
-
-    define_filetest_function("directory?", test_d, 1);
-    define_filetest_function("exist?", test_e, 1);
-    define_filetest_function("exists?", test_e, 1); /* temporary */
-    define_filetest_function("readable?", test_r, 1);
-    define_filetest_function("readable_real?", test_R, 1);
-    define_filetest_function("writable?", test_w, 1);
-    define_filetest_function("writable_real?", test_W, 1);
-    define_filetest_function("executable?", test_x, 1);
-    define_filetest_function("executable_real?", test_X, 1);
-    define_filetest_function("file?", test_f, 1);
-    define_filetest_function("zero?", test_z, 1);
-    define_filetest_function("size?", test_s, 1);
-    define_filetest_function("size", rb_file_s_size, 1);
-    define_filetest_function("owned?", test_owned, 1);
-    define_filetest_function("grpowned?", test_grpowned, 1);
-
-    define_filetest_function("pipe?", test_p, 1);
-    define_filetest_function("symlink?", test_l, 1);
-    define_filetest_function("socket?", test_S, 1);
-
-    define_filetest_function("blockdev?", test_b, 1);
-    define_filetest_function("chardev?", test_c, 1);
-
-    define_filetest_function("setuid?", test_suid, 1);
-    define_filetest_function("setgid?", test_sgid, 1);
-    define_filetest_function("sticky?", test_sticky, 1);
-
-    rb_define_singleton_method(rb_cFile, "stat",  rb_file_s_stat, 1);
-    rb_define_singleton_method(rb_cFile, "lstat", rb_file_s_lstat, 1);
-    rb_define_singleton_method(rb_cFile, "ftype", rb_file_s_ftype, 1);
-
-    rb_define_singleton_method(rb_cFile, "atime", rb_file_s_atime, 1);
-    rb_define_singleton_method(rb_cFile, "mtime", rb_file_s_mtime, 1);
-    rb_define_singleton_method(rb_cFile, "ctime", rb_file_s_ctime, 1);
-
-    rb_define_singleton_method(rb_cFile, "utime", rb_file_s_utime, -1);
-    rb_define_singleton_method(rb_cFile, "chmod", rb_file_s_chmod, -1);
-    rb_define_singleton_method(rb_cFile, "chown", rb_file_s_chown, -1);
-    rb_define_singleton_method(rb_cFile, "lchmod", rb_file_s_lchmod, -1);
-    rb_define_singleton_method(rb_cFile, "lchown", rb_file_s_lchown, -1);
-
-    rb_define_singleton_method(rb_cFile, "link", rb_file_s_link, 2);
-    rb_define_singleton_method(rb_cFile, "symlink", rb_file_s_symlink, 2);
-    rb_define_singleton_method(rb_cFile, "readlink", rb_file_s_readlink, 1);
-
-    rb_define_singleton_method(rb_cFile, "unlink", rb_file_s_unlink, -2);
-    rb_define_singleton_method(rb_cFile, "delete", rb_file_s_unlink, -2);
-    rb_define_singleton_method(rb_cFile, "rename", rb_file_s_rename, 2);
-    rb_define_singleton_method(rb_cFile, "umask", rb_file_s_umask, -1);
-    rb_define_singleton_method(rb_cFile, "truncate", rb_file_s_truncate, 2);
-    rb_define_singleton_method(rb_cFile, "expand_path", rb_file_s_expand_path, -1);
-    rb_define_singleton_method(rb_cFile, "basename", rb_file_s_basename, -1);
-    rb_define_singleton_method(rb_cFile, "dirname", rb_file_s_dirname, 1);
-    rb_define_singleton_method(rb_cFile, "extname", rb_file_s_extname, 1);
-
-    separator = rb_obj_freeze(rb_str_new2("/"));
-    rb_define_const(rb_cFile, "Separator", separator);
-    rb_define_const(rb_cFile, "SEPARATOR", separator);
-    rb_define_singleton_method(rb_cFile, "split",  rb_file_s_split, 1);
-    rb_define_singleton_method(rb_cFile, "join",   rb_file_s_join, -2);
-
-#if defined DOSISH && !defined __CYGWIN__
-    rb_define_const(rb_cFile, "ALT_SEPARATOR", rb_obj_freeze(rb_str_new2("\\")));
-#else
-    rb_define_const(rb_cFile, "ALT_SEPARATOR", Qnil);
-#endif
-    rb_define_const(rb_cFile, "PATH_SEPARATOR", rb_obj_freeze(rb_str_new2(PATH_SEP)));
-
-    rb_define_method(rb_cIO, "stat",  rb_io_stat, 0); /* this is IO's method */
-    rb_define_method(rb_cFile, "lstat",  rb_file_lstat, 0);
-
-    rb_define_method(rb_cFile, "atime", rb_file_atime, 0);
-    rb_define_method(rb_cFile, "mtime", rb_file_mtime, 0);
-    rb_define_method(rb_cFile, "ctime", rb_file_ctime, 0);
-
-    rb_define_method(rb_cFile, "chmod", rb_file_chmod, 1);
-    rb_define_method(rb_cFile, "chown", rb_file_chown, 2);
-    rb_define_method(rb_cFile, "truncate", rb_file_truncate, 1);
-
-    rb_define_method(rb_cFile, "flock", rb_file_flock, 1);
-
-    rb_mFConst = rb_define_module_under(rb_cFile, "Constants");
-    rb_include_module(rb_cFile, rb_mFConst);
-    rb_file_const("LOCK_SH", INT2FIX(LOCK_SH));
-    rb_file_const("LOCK_EX", INT2FIX(LOCK_EX));
-    rb_file_const("LOCK_UN", INT2FIX(LOCK_UN));
-    rb_file_const("LOCK_NB", INT2FIX(LOCK_NB));
-
-    rb_define_method(rb_cFile, "path",  rb_file_path, 0);
-    rb_define_global_function("test", rb_f_test, -1);
-
-    rb_cStat = rb_define_class_under(rb_cFile, "Stat", rb_cObject);
-    rb_define_singleton_method(rb_cStat, "allocate",  rb_stat_s_alloc, 0);
-    rb_define_method(rb_cStat, "initialize", rb_stat_init, 1);
-    rb_define_method(rb_cStat, "clone", rb_stat_clone, 0);
-
-    rb_include_module(rb_cStat, rb_mComparable);
-
-    rb_define_method(rb_cStat, "<=>", rb_stat_cmp, 1);
-
-    rb_define_method(rb_cStat, "dev", rb_stat_dev, 0);
-    rb_define_method(rb_cStat, "ino", rb_stat_ino, 0);
-    rb_define_method(rb_cStat, "mode", rb_stat_mode, 0);
-    rb_define_method(rb_cStat, "nlink", rb_stat_nlink, 0);
-    rb_define_method(rb_cStat, "uid", rb_stat_uid, 0);
-    rb_define_method(rb_cStat, "gid", rb_stat_gid, 0);
-    rb_define_method(rb_cStat, "rdev", rb_stat_rdev, 0);
-    rb_define_method(rb_cStat, "rdev_major", rb_stat_rdev_major, 0);
-    rb_define_method(rb_cStat, "rdev_minor", rb_stat_rdev_minor, 0);
-    rb_define_method(rb_cStat, "size", rb_stat_size, 0);
-    rb_define_method(rb_cStat, "blksize", rb_stat_blksize, 0);
-    rb_define_method(rb_cStat, "blocks", rb_stat_blocks, 0);
-    rb_define_method(rb_cStat, "atime", rb_stat_atime, 0);
-    rb_define_method(rb_cStat, "mtime", rb_stat_mtime, 0);
-    rb_define_method(rb_cStat, "ctime", rb_stat_ctime, 0);
-
-    rb_define_method(rb_cStat, "inspect", rb_stat_inspect, 0);
-
-    rb_define_method(rb_cStat, "ftype", rb_stat_ftype, 0);
-
-    rb_define_method(rb_cStat, "directory?",  rb_stat_d, 0);
-    rb_define_method(rb_cStat, "readable?",  rb_stat_r, 0);
-    rb_define_method(rb_cStat, "readable_real?",  rb_stat_R, 0);
-    rb_define_method(rb_cStat, "writable?",  rb_stat_w, 0);
-    rb_define_method(rb_cStat, "writable_real?",  rb_stat_W, 0);
-    rb_define_method(rb_cStat, "executable?",  rb_stat_x, 0);
-    rb_define_method(rb_cStat, "executable_real?",  rb_stat_X, 0);
-    rb_define_method(rb_cStat, "file?",  rb_stat_f, 0);
-    rb_define_method(rb_cStat, "zero?",  rb_stat_z, 0);
-    rb_define_method(rb_cStat, "size?",  rb_stat_s, 0);
-    rb_define_method(rb_cStat, "owned?",  rb_stat_owned, 0);
-    rb_define_method(rb_cStat, "grpowned?",  rb_stat_grpowned, 0);
-
-    rb_define_method(rb_cStat, "pipe?",  rb_stat_p, 0);
-    rb_define_method(rb_cStat, "symlink?",  rb_stat_l, 0);
-    rb_define_method(rb_cStat, "socket?",  rb_stat_S, 0);
-
-    rb_define_method(rb_cStat, "blockdev?",  rb_stat_b, 0);
-    rb_define_method(rb_cStat, "chardev?",  rb_stat_c, 0);
-
-    rb_define_method(rb_cStat, "setuid?",  rb_stat_suid, 0);
-    rb_define_method(rb_cStat, "setgid?",  rb_stat_sgid, 0);
-    rb_define_method(rb_cStat, "sticky?",  rb_stat_sticky, 0);
-}
diff --git a/gc.c b/gc.c
deleted file mode 100644
index 21a4c2e1cb..0000000000
--- a/gc.c
+++ /dev/null
@@ -1,1542 +0,0 @@
-/**********************************************************************
-
-  gc.c -
-
-  $Author$
-  $Date$
-  created at: Tue Oct  5 09:44:46 JST 1993
-
-  Copyright (C) 1993-2002 Yukihiro Matsumoto
-  Copyright (C) 2000  Network Applied Communication Laboratory, Inc.
-  Copyright (C) 2000  Information-technology Promotion Agency, Japan
-
-**********************************************************************/
-
-#include "ruby.h"
-#include "rubysig.h"
-#include "st.h"
-#include "node.h"
-#include "env.h"
-#include "re.h"
-#include 
-#include 
-#include 
-
-#ifdef HAVE_SYS_TIME_H
-#include 
-#endif
-
-#ifdef HAVE_SYS_RESOURCE_H
-#include 
-#endif
-
-void re_free_registers _((struct re_registers*));
-void rb_io_fptr_finalize _((struct OpenFile*));
-
-#ifndef setjmp
-#ifdef HAVE__SETJMP
-#define setjmp(env) _setjmp(env)
-#define longjmp(env,val) _longjmp(env,val)
-#endif
-#endif
-
-/* Make alloca work the best possible way.  */
-#ifndef __GNUC__
-# if HAVE_ALLOCA_H
-#  include 
-# else
-#  ifdef _AIX
-#   pragma alloca
-#  else
-#   ifndef alloca /* predefined by HP cc +Olibcalls */
-void *alloca ();
-#   endif
-#  endif
-# endif
-#endif
-
-static void run_final();
-
-#ifndef GC_MALLOC_LIMIT
-#if defined(MSDOS) || defined(__human68k__)
-#define GC_MALLOC_LIMIT 200000
-#else
-#define GC_MALLOC_LIMIT 8000000
-#endif
-#endif
-
-static unsigned long malloc_memories = 0;
-static VALUE nomem_error;
-
-void
-rb_memerror()
-{
-    static int recurse = 0;
-
-    if (recurse > 0 && rb_safe_level() < 4) {
-	fprintf(stderr, "[FATAL] failed to allocate memory\n");
-	exit(1);
-    }
-    recurse++;
-    rb_exc_raise(nomem_error);
-}
-
-void *
-ruby_xmalloc(size)
-    long size;
-{
-    void *mem;
-
-    if (size < 0) {
-	rb_raise(rb_eNoMemError, "negative allocation size (or too big)");
-    }
-    if (size == 0) size = 1;
-    malloc_memories += size;
-
-    if (malloc_memories > GC_MALLOC_LIMIT) {
-	rb_gc();
-    }
-    RUBY_CRITICAL(mem = malloc(size));
-    if (!mem) {
-	rb_gc();
-	RUBY_CRITICAL(mem = malloc(size));
-	if (!mem) {
-	    rb_memerror();
-	}
-    }
-
-    return mem;
-}
-
-void *
-ruby_xcalloc(n, size)
-    long n, size;
-{
-    void *mem;
-
-    mem = xmalloc(n * size);
-    memset(mem, 0, n * size);
-
-    return mem;
-}
-
-void *
-ruby_xrealloc(ptr, size)
-    void *ptr;
-    long size;
-{
-    void *mem;
-
-    if (size < 0) {
-	rb_raise(rb_eArgError, "negative re-allocation size");
-    }
-    if (!ptr) return xmalloc(size);
-    if (size == 0) size = 1;
-    malloc_memories += size;
-    RUBY_CRITICAL(mem = realloc(ptr, size));
-    if (!mem) {
-	rb_gc();
-	RUBY_CRITICAL(mem = realloc(ptr, size));
-	if (!mem) {
-	    rb_memerror();
-        }
-    }
-
-    return mem;
-}
-
-void
-ruby_xfree(x)
-    void *x;
-{
-    if (x)
-	RUBY_CRITICAL(free(x));
-}
-
-extern int ruby_in_compile;
-static int dont_gc;
-static int during_gc;
-static int need_call_final = 0;
-static st_table *finalizer_table = 0;
-
-VALUE
-rb_gc_enable()
-{
-    int old = dont_gc;
-
-    dont_gc = Qfalse;
-    return old;
-}
-
-VALUE
-rb_gc_disable()
-{
-    int old = dont_gc;
-
-    dont_gc = Qtrue;
-    return old;
-}
-
-VALUE rb_mGC;
-
-static struct gc_list {
-    VALUE *varptr;
-    struct gc_list *next;
-} *global_List = 0;
-
-void
-rb_gc_register_address(addr)
-    VALUE *addr;
-{
-    struct gc_list *tmp;
-
-    tmp = ALLOC(struct gc_list);
-    tmp->next = global_List;
-    tmp->varptr = addr;
-    global_List = tmp;
-}
-
-void
-rb_gc_unregister_address(addr)
-    VALUE *addr;
-{
-    struct gc_list *tmp = global_List;
-
-    if (tmp->varptr == addr) {
-	global_List = tmp->next;
-	RUBY_CRITICAL(free(tmp));
-	return;
-    }
-    while (tmp->next) {
-	if (tmp->next->varptr == addr) {
-	    struct gc_list *t = tmp->next;
-
-	    tmp->next = tmp->next->next;
-	    RUBY_CRITICAL(free(t));
-	    break;
-	}
-	tmp = tmp->next;
-    }
-}
-
-void
-rb_global_variable(var)
-    VALUE *var;
-{
-    rb_gc_register_address(var);
-}
-
-typedef struct RVALUE {
-    union {
-	struct {
-	    unsigned long flags;	/* always 0 for freed obj */
-	    struct RVALUE *next;
-	} free;
-	struct RBasic  basic;
-	struct RObject object;
-	struct RClass  klass;
-	struct RFloat  flonum;
-	struct RString string;
-	struct RArray  array;
-	struct RRegexp regexp;
-	struct RHash   hash;
-	struct RData   data;
-	struct RStruct rstruct;
-	struct RBignum bignum;
-	struct RFile   file;
-	struct RNode   node;
-	struct RMatch  match;
-	struct RVarmap varmap; 
-	struct SCOPE   scope;
-    } as;
-} RVALUE;
-
-static RVALUE *freelist = 0;
-static RVALUE *deferred_final_list = 0;
-
-#define HEAPS_INCREMENT 10
-static RVALUE **heaps;
-static int heaps_length = 0;
-static int heaps_used   = 0;
-
-#define HEAP_MIN_SLOTS 10000
-static int *heaps_limits;
-static int heap_slots = HEAP_MIN_SLOTS;
-
-#define FREE_MIN  4096
-
-static RVALUE *himem, *lomem;
-
-static void
-add_heap()
-{
-    RVALUE *p, *pend;
-
-    if (heaps_used == heaps_length) {
-	/* Realloc heaps */
-	heaps_length += HEAPS_INCREMENT;
-	RUBY_CRITICAL(heaps = (heaps_used>0)?
-			(RVALUE**)realloc(heaps, heaps_length*sizeof(RVALUE*)):
-			(RVALUE**)malloc(heaps_length*sizeof(RVALUE*)));
-	if (heaps == 0) rb_memerror();
-	RUBY_CRITICAL(heaps_limits = (heaps_used>0)?
-			(int*)realloc(heaps_limits, heaps_length*sizeof(int)):
-			(int*)malloc(heaps_length*sizeof(int)));
-	if (heaps_limits == 0) rb_memerror();
-    }
-
-    for (;;) {
-	RUBY_CRITICAL(p = heaps[heaps_used] = (RVALUE*)malloc(sizeof(RVALUE)*heap_slots));
-	heaps_limits[heaps_used] = heap_slots;
-	if (p == 0) {
-	    if (heap_slots == HEAP_MIN_SLOTS) {
-		rb_memerror();
-	    }
-	    heap_slots = HEAP_MIN_SLOTS;
-	    continue;
-	}
-	break;
-    }
-    pend = p + heap_slots;
-    if (lomem == 0 || lomem > p) lomem = p;
-    if (himem < pend) himem = pend;
-    heaps_used++;
-    heap_slots *= 1.8;
-
-    while (p < pend) {
-	p->as.free.flags = 0;
-	p->as.free.next = freelist;
-	freelist = p;
-	p++;
-    }
-}
-#define RANY(o) ((RVALUE*)(o))
-
-VALUE
-rb_newobj()
-{
-    VALUE obj;
-
-    if (!freelist) rb_gc();
-
-    obj = (VALUE)freelist;
-    freelist = freelist->as.free.next;
-    MEMZERO((void*)obj, RVALUE, 1);
-    return obj;
-}
-
-VALUE
-rb_data_object_alloc(klass, datap, dmark, dfree)
-    VALUE klass;
-    void *datap;
-    RUBY_DATA_FUNC dmark;
-    RUBY_DATA_FUNC dfree;
-{
-    NEWOBJ(data, struct RData);
-    OBJSETUP(data, klass, T_DATA);
-    data->data = datap;
-    data->dfree = dfree;
-    data->dmark = dmark;
-
-    return (VALUE)data;
-}
-
-extern st_table *rb_class_tbl;
-VALUE *rb_gc_stack_start = 0;
-
-#ifdef DJGPP
-static unsigned int STACK_LEVEL_MAX = 65535;
-#else
-#ifdef __human68k__
-extern unsigned int _stacksize;
-# define STACK_LEVEL_MAX (_stacksize - 4096)
-# undef HAVE_GETRLIMIT
-#else
-#ifdef HAVE_GETRLIMIT
-static unsigned int STACK_LEVEL_MAX = 655300;
-#else
-# define STACK_LEVEL_MAX 655300
-#endif
-#endif
-#endif
-
-#ifdef C_ALLOCA
-# define SET_STACK_END VALUE stack_end; alloca(0);
-# define STACK_END (&stack_end)
-#else
-# if defined(__GNUC__) && defined(USE_BUILTIN_FRAME_ADDRESS)
-#  define  SET_STACK_END    VALUE *stack_end = __builtin_frame_address(0)
-# else
-#  define  SET_STACK_END    VALUE *stack_end = alloca(1)
-# endif
-# define STACK_END (stack_end)
-#endif
-#ifdef __sparc__
-# define STACK_LENGTH  (rb_gc_stack_start - STACK_END + 0x80)
-#else
-# define STACK_LENGTH  ((STACK_END < rb_gc_stack_start) ? rb_gc_stack_start - STACK_END\
-                                           : STACK_END - rb_gc_stack_start)
-#endif
-
-#define CHECK_STACK(ret) do {\
-    SET_STACK_END;\
-    (ret) = (STACK_LENGTH > STACK_LEVEL_MAX);\
-} while (0)
-
-int
-ruby_stack_length(p)
-    VALUE **p;
-{
-    SET_STACK_END;
-    if (p) *p = STACK_END;
-    return STACK_LENGTH;
-}
-
-int
-ruby_stack_check()
-{
-    int ret;
-
-    CHECK_STACK(ret);
-    return ret;
-}
-
-#define MARK_STACK_MAX 1024
-static VALUE mark_stack[MARK_STACK_MAX];
-static VALUE *mark_stack_ptr;
-static int mark_stack_overflow;
-
-static void
-init_mark_stack()
-{
-    mark_stack_overflow = 0;
-    mark_stack_ptr = mark_stack;
-}
-
-#define MARK_STACK_EMPTY (mark_stack_ptr == mark_stack)
-            
-static void rb_gc_mark_children(VALUE ptr);
-
-static st_table *source_filenames;
-
-char *
-rb_source_filename(f)
-    const char *f;
-{
-    char *name;
-
-    if (!st_lookup(source_filenames, f, &name)) {
-	long len = strlen(f) + 1;
-	char *ptr = name = ALLOC_N(char, len + 1);
-	*ptr++ = 0;
-	MEMCPY(ptr, f, char, len);
-	st_add_direct(source_filenames, ptr, name);
-	return ptr;
-    }
-    return name + 1;
-}
-
-static void
-mark_source_filename(f)
-    char *f;
-{
-    if (f) {
-	f[-1] = 1;
-    }
-}
-
-static enum st_retval
-sweep_source_filename(key, value)
-    char *key, *value;
-{
-    if (*value) {
-	*value = 0;
-	return ST_CONTINUE;
-    }
-    else {
-	free(value);
-	return ST_DELETE;
-    }
-}
-
-static void
-gc_mark_all()
-{
-    RVALUE *p, *pend;
-    int i;
-
-    init_mark_stack();
-    for (i = 0; i < heaps_used; i++) {
-	p = heaps[i]; pend = p + heaps_limits[i];
-	while (p < pend) {
-	    if ((p->as.basic.flags & FL_MARK) &&
-		(p->as.basic.flags != FL_MARK)) {
-		rb_gc_mark_children((VALUE)p);
-	    }
-	    p++;
-	}
-    }
-}
-
-static void
-gc_mark_rest()
-{
-    VALUE tmp_arry[MARK_STACK_MAX];
-    VALUE *p;
-
-    p = (mark_stack_ptr - mark_stack) + tmp_arry;
-    MEMCPY(tmp_arry, mark_stack, VALUE, MARK_STACK_MAX);
-
-    init_mark_stack();
-    
-    while(p != tmp_arry){
-	p--;
-	rb_gc_mark_children(*p);
-    }
-}
-
-static inline int
-is_pointer_to_heap(ptr)
-    void *ptr;
-{
-    register RVALUE *p = RANY(ptr);
-    register RVALUE *heap_org;
-    register long i;
-
-    if (p < lomem || p > himem) return Qfalse;
-
-    /* check if p looks like a pointer */
-    for (i=0; i < heaps_used; i++) {
-	heap_org = heaps[i];
-	if (heap_org <= p && p < heap_org + heaps_limits[i] &&
-	    ((((char*)p)-((char*)heap_org))%sizeof(RVALUE)) == 0)
-	    return Qtrue;
-    }
-    return Qfalse;
-}
-
-static void
-mark_locations_array(x, n)
-    register VALUE *x;
-    register long n;
-{
-    while (n--) {
-	if (is_pointer_to_heap((void *)*x)) {
-	    rb_gc_mark(*x);
-	}
-	x++;
-    }
-}
-
-void
-rb_gc_mark_locations(start, end)
-    VALUE *start, *end;
-{
-    VALUE *tmp;
-    long n;
-
-    if (start > end) {
-	tmp = start;
-	start = end;
-	end = tmp;
-    }
-    n = end - start + 1;
-    mark_locations_array(start,n);
-}
-
-static int
-mark_entry(key, value)
-    ID key;
-    VALUE value;
-{
-    rb_gc_mark(value);
-    return ST_CONTINUE;
-}
-
-void
-rb_mark_tbl(tbl)
-    st_table *tbl;
-{
-    if (!tbl) return;
-    st_foreach(tbl, mark_entry, 0);
-}
-
-static int
-mark_hashentry(key, value)
-    VALUE key;
-    VALUE value;
-{
-    rb_gc_mark(key);
-    rb_gc_mark(value);
-    return ST_CONTINUE;
-}
-
-void
-rb_mark_hash(tbl)
-    st_table *tbl;
-{
-    if (!tbl) return;
-    st_foreach(tbl, mark_hashentry, 0);
-}
-
-void
-rb_gc_mark_maybe(obj)
-    VALUE obj;
-{
-    if (is_pointer_to_heap((void *)obj)) {
-	rb_gc_mark(obj);
-    }
-}
-
-void
-rb_gc_mark(ptr)
-    VALUE ptr;
-{
-    int ret;
-    register RVALUE *obj = RANY(ptr);
-
-    if (rb_special_const_p(ptr)) return; /* special const not marked */
-    if (obj->as.basic.flags == 0) return;       /* free cell */
-    if (obj->as.basic.flags & FL_MARK) return;  /* already marked */ 
-
-    obj->as.basic.flags |= FL_MARK;
-
-    CHECK_STACK(ret);
-    if (ret) {
-	if (!mark_stack_overflow) {
-	    if (mark_stack_ptr - mark_stack < MARK_STACK_MAX) {
-		*mark_stack_ptr = ptr;
-		mark_stack_ptr++;		
-	    }
-	    else {
-		mark_stack_overflow = 1;
-	    }
-	}
-    }
-    else {
-	rb_gc_mark_children(ptr);
-    }
-}
-
-void
-rb_gc_mark_children(ptr)
-    VALUE ptr;
-{
-    register RVALUE *obj = RANY(ptr);	
-    
-    if (FL_TEST(obj, FL_EXIVAR)) {
-	rb_mark_generic_ivar((VALUE)obj);
-    }
-
-    switch (obj->as.basic.flags & T_MASK) {
-      case T_NIL:
-      case T_FIXNUM:
-	rb_bug("rb_gc_mark() called for broken object");
-	break;
-
-      case T_NODE:
-	mark_source_filename(obj->as.node.nd_file);
-	switch (nd_type(obj)) {
-	  case NODE_IF:		/* 1,2,3 */
-	  case NODE_FOR:
-	  case NODE_ITER:
-	  case NODE_CREF:
-	  case NODE_WHEN:
-	  case NODE_MASGN:
-	  case NODE_RESCUE:
-	  case NODE_RESBODY:
-	    rb_gc_mark((VALUE)obj->as.node.u2.node);
-	    /* fall through */
-	  case NODE_BLOCK:	/* 1,3 */
-	  case NODE_ARRAY:
-	  case NODE_DSTR:
-	  case NODE_DXSTR:
-	  case NODE_EVSTR:
-	  case NODE_DREGX:
-	  case NODE_DREGX_ONCE:
-	  case NODE_FBODY:
-	  case NODE_ENSURE:
-	  case NODE_CALL:
-	  case NODE_DEFS:
-	  case NODE_OP_ASGN1:
-	    rb_gc_mark((VALUE)obj->as.node.u1.node);
-	    /* fall through */
-	  case NODE_SUPER:	/* 3 */
-	  case NODE_FCALL:
-	  case NODE_DEFN:
-	  case NODE_NEWLINE:
-	    rb_gc_mark((VALUE)obj->as.node.u3.node);	    
-	    break;
-
-	  case NODE_WHILE:	/* 1,2 */
-	  case NODE_UNTIL:
-	  case NODE_AND:
-	  case NODE_OR:
-	  case NODE_CASE:
-	  case NODE_SCLASS:
-	  case NODE_DOT2:
-	  case NODE_DOT3:
-	  case NODE_FLIP2:
-	  case NODE_FLIP3:
-	  case NODE_MATCH2:
-	  case NODE_MATCH3:
-	  case NODE_OP_ASGN_OR:
-	  case NODE_OP_ASGN_AND:
-	    rb_gc_mark((VALUE)obj->as.node.u1.node);
-	    /* fall through */
-	  case NODE_METHOD:	/* 2 */
-	  case NODE_NOT:
-	  case NODE_GASGN:
-	  case NODE_LASGN:
-	  case NODE_DASGN:
-	  case NODE_DASGN_CURR:
-	  case NODE_IASGN:
-	  case NODE_CDECL:
-	  case NODE_CVDECL:
-	  case NODE_CVASGN:
-	  case NODE_MODULE:
-	  case NODE_COLON3:
-	  case NODE_OPT_N:
-	    rb_gc_mark((VALUE)obj->as.node.u2.node);
-	    break;
-
-	  case NODE_HASH:	/* 1 */
-	  case NODE_LIT:
-	  case NODE_STR:
-	  case NODE_XSTR:
-	  case NODE_DEFINED:
-	  case NODE_MATCH:
-	  case NODE_RETURN:
-	  case NODE_BREAK:
-	  case NODE_NEXT:
-	  case NODE_YIELD:
-	  case NODE_COLON2:
-	  case NODE_ARGS:
-	    rb_gc_mark((VALUE)obj->as.node.u1.node);
-	    break;
-
-	  case NODE_SCOPE:	/* 2,3 */
-	  case NODE_CLASS:
-	  case NODE_BLOCK_PASS:
-	    rb_gc_mark((VALUE)obj->as.node.u3.node);
-	    rb_gc_mark((VALUE)obj->as.node.u2.node);
-	    break;
-
-	  case NODE_ZARRAY:	/* - */
-	  case NODE_ZSUPER:
-	  case NODE_CFUNC:
-	  case NODE_VCALL:
-	  case NODE_GVAR:
-	  case NODE_LVAR:
-	  case NODE_DVAR:
-	  case NODE_IVAR:
-	  case NODE_CVAR:
-	  case NODE_NTH_REF:
-	  case NODE_BACK_REF:
-	  case NODE_ALIAS:
-	  case NODE_VALIAS:
-	  case NODE_REDO:
-	  case NODE_RETRY:
-	  case NODE_UNDEF:
-	  case NODE_SELF:
-	  case NODE_NIL:
-	  case NODE_TRUE:
-	  case NODE_FALSE:
-	  case NODE_ATTRSET:
-	  case NODE_BLOCK_ARG:
-	  case NODE_POSTEXE:
-	    break;
-#ifdef C_ALLOCA
-	  case NODE_ALLOCA:
-	    mark_locations_array((VALUE*)obj->as.node.u1.value,
-				 obj->as.node.u3.cnt);
-	    rb_gc_mark((VALUE)obj->as.node.u2.node);	    
-	    break;
-#endif
-
-	  default:
-	    if (is_pointer_to_heap(obj->as.node.u1.node)) {
-		rb_gc_mark((VALUE)obj->as.node.u1.node);
-	    }
-	    if (is_pointer_to_heap(obj->as.node.u2.node)) {
-		rb_gc_mark((VALUE)obj->as.node.u2.node);
-	    }
-	    if (is_pointer_to_heap(obj->as.node.u3.node)) {
-		rb_gc_mark((VALUE)obj->as.node.u3.node);
-	    }
-	}
-	return;			/* no need to mark class. */
-    }
-
-    rb_gc_mark(obj->as.basic.klass);
-    switch (obj->as.basic.flags & T_MASK) {
-      case T_ICLASS:
-      case T_CLASS:
-      case T_MODULE:
-	rb_gc_mark(obj->as.klass.super);
-	rb_mark_tbl(obj->as.klass.m_tbl);
-	rb_mark_tbl(obj->as.klass.iv_tbl);
-	break;
-
-      case T_ARRAY:
-	{
-	    int i, len = obj->as.array.len;
-	    VALUE *ptr = obj->as.array.ptr;
-
-	    for (i=0; i < len; i++)
-		rb_gc_mark(*ptr++);
-	}
-	if (FL_TEST(obj, ELTS_SHARED))
-	    rb_gc_mark(obj->as.array.aux.shared);
-	break;
-
-      case T_HASH:
-	rb_mark_hash(obj->as.hash.tbl);
-	rb_gc_mark(obj->as.hash.ifnone);
-	break;
-
-      case T_STRING:
-#define STR_ASSOC FL_USER3   /* copied from string.c */
-	if (FL_TEST(obj, ELTS_SHARED|STR_ASSOC)) {
-	    rb_gc_mark(obj->as.string.aux.shared);
-	}
-	break;
-
-      case T_DATA:
-	if (obj->as.data.dmark) (*obj->as.data.dmark)(DATA_PTR(obj));
-	break;
-
-      case T_OBJECT:
-	rb_mark_tbl(obj->as.object.iv_tbl);
-	break;
-
-      case T_FILE:
-      case T_REGEXP:
-      case T_FLOAT:
-      case T_BIGNUM:
-      case T_BLKTAG:
-	break;
-
-      case T_MATCH:
-	if (obj->as.match.str) {
-	    rb_gc_mark((VALUE)obj->as.match.str);
-	}
-	break;
-
-      case T_VARMAP:
-	rb_gc_mark(obj->as.varmap.val);
-	rb_gc_mark((VALUE)obj->as.varmap.next);
-	break;
-
-      case T_SCOPE:
-	if (obj->as.scope.local_vars && (obj->as.scope.flags & SCOPE_MALLOC)) {
-	    int n = obj->as.scope.local_tbl[0]+1;
-	    VALUE *vars = &obj->as.scope.local_vars[-1];
-
-	    while (n--) {
-		rb_gc_mark(*vars);
-		vars++;
-	    }
-	}
-	break;
-
-      case T_STRUCT:
-	{
-	    int i, len = obj->as.rstruct.len;
-	    VALUE *ptr = obj->as.rstruct.ptr;
-
-	    for (i=0; i < len; i++)
-		rb_gc_mark(*ptr++);
-	}
-	break;
-
-      default:
-	rb_bug("rb_gc_mark(): unknown data type 0x%x(0x%x) %s",
-	       obj->as.basic.flags & T_MASK, obj,
-	       is_pointer_to_heap(obj) ? "corrupted object" : "non object");
-    }
-}
-
-static void obj_free _((VALUE));
-
-static void
-gc_sweep()
-{
-    RVALUE *p, *pend, *final_list;
-    int freed = 0;
-    int i, used = heaps_used;
-
-    if (ruby_in_compile) {
-	/* should not reclaim nodes during compilation */
-	for (i = 0; i < used; i++) {
-	    p = heaps[i]; pend = p + heaps_limits[i];
-	    while (p < pend) {
-		if (!(p->as.basic.flags&FL_MARK) && BUILTIN_TYPE(p) == T_NODE)
-		    rb_gc_mark((VALUE)p);
-		p++;
-	    }
-	}
-    }
-
-    mark_source_filename(ruby_sourcefile);
-    st_foreach(source_filenames, sweep_source_filename, 0);
-
-    freelist = 0;
-    final_list = deferred_final_list;
-    deferred_final_list = 0;
-    for (i = 0; i < used; i++) {
-	int n = 0;
-
-	p = heaps[i]; pend = p + heaps_limits[i];
-	while (p < pend) {
-	    if (!(p->as.basic.flags & FL_MARK)) {
-		if (p->as.basic.flags) {
-		    obj_free((VALUE)p);
-		}
-		if (need_call_final && FL_TEST(p, FL_FINALIZE)) {
-		    p->as.free.flags = FL_MARK; /* remain marked */
-		    p->as.free.next = final_list;
-		    final_list = p;
-		}
-		else {
-		    p->as.free.flags = 0;
-		    p->as.free.next = freelist;
-		    freelist = p;
-		}
-		n++;
-	    }
-	    else if (RBASIC(p)->flags == FL_MARK) {
-		/* objects to be finalized */
-		/* do notning remain marked */
-	    }
-	    else {
-		RBASIC(p)->flags &= ~FL_MARK;
-	    }
-	    p++;
-	}
-	freed += n;
-    }
-    if (freed < FREE_MIN) {
-	add_heap();
-    }
-    during_gc = 0;
-
-    /* clear finalization list */
-    if (final_list) {
-	RVALUE *tmp;
-
-	if (rb_prohibit_interrupt || ruby_in_compile) {
-	    deferred_final_list = final_list;
-	    return;
-	}
-
-	for (p = final_list; p; p = tmp) {
-	    tmp = p->as.free.next;
-	    run_final((VALUE)p);
-	    p->as.free.flags = 0;
-	    p->as.free.next = freelist;
-	    freelist = p;
-	}
-    }
-}
-
-void
-rb_gc_force_recycle(p)
-    VALUE p;
-{
-    RANY(p)->as.free.flags = 0;
-    RANY(p)->as.free.next = freelist;
-    freelist = RANY(p);
-}
-
-static void
-obj_free(obj)
-    VALUE obj;
-{
-    switch (RANY(obj)->as.basic.flags & T_MASK) {
-      case T_NIL:
-      case T_FIXNUM:
-      case T_TRUE:
-      case T_FALSE:
-	rb_bug("obj_free() called for broken object");
-	break;
-    }
-
-    if (FL_TEST(obj, FL_EXIVAR)) {
-	rb_free_generic_ivar((VALUE)obj);
-    }
-
-    switch (RANY(obj)->as.basic.flags & T_MASK) {
-      case T_OBJECT:
-	if (RANY(obj)->as.object.iv_tbl) {
-	    st_free_table(RANY(obj)->as.object.iv_tbl);
-	}
-	break;
-      case T_MODULE:
-      case T_CLASS:
-	st_free_table(RANY(obj)->as.klass.m_tbl);
-	if (RANY(obj)->as.object.iv_tbl) {
-	    st_free_table(RANY(obj)->as.object.iv_tbl);
-	}
-	break;
-      case T_STRING:
-	if (RANY(obj)->as.string.ptr && !FL_TEST(obj, ELTS_SHARED)) {
-	    RUBY_CRITICAL(free(RANY(obj)->as.string.ptr));
-	}
-	break;
-      case T_ARRAY:
-	if (RANY(obj)->as.array.ptr && !FL_TEST(obj, ELTS_SHARED)) {
-	    RUBY_CRITICAL(free(RANY(obj)->as.array.ptr));
-	}
-	break;
-      case T_HASH:
-	if (RANY(obj)->as.hash.tbl) {
-	    st_free_table(RANY(obj)->as.hash.tbl);
-	}
-	break;
-      case T_REGEXP:
-	if (RANY(obj)->as.regexp.ptr) {
-	    re_free_pattern(RANY(obj)->as.regexp.ptr);
-	}
-	if (RANY(obj)->as.regexp.str) {
-	    RUBY_CRITICAL(free(RANY(obj)->as.regexp.str));
-	}
-	break;
-      case T_DATA:
-	if (DATA_PTR(obj)) {
-	    if ((long)RANY(obj)->as.data.dfree == -1) {
-		RUBY_CRITICAL(free(DATA_PTR(obj)));
-	    }
-	    else if (RANY(obj)->as.data.dfree) {
-		(*RANY(obj)->as.data.dfree)(DATA_PTR(obj));
-	    }
-	}
-	break;
-      case T_MATCH:
-	if (RANY(obj)->as.match.regs) {
-	    re_free_registers(RANY(obj)->as.match.regs);
-	    RUBY_CRITICAL(free(RANY(obj)->as.match.regs));
-	}
-	break;
-      case T_FILE:
-	if (RANY(obj)->as.file.fptr) {
-	    rb_io_fptr_finalize(RANY(obj)->as.file.fptr);
-	    RUBY_CRITICAL(free(RANY(obj)->as.file.fptr));
-	}
-	break;
-      case T_ICLASS:
-	/* iClass shares table with the module */
-	break;
-
-      case T_FLOAT:
-      case T_VARMAP:
-      case T_BLKTAG:
-	break;
-
-      case T_BIGNUM:
-	if (RANY(obj)->as.bignum.digits) {
-	    RUBY_CRITICAL(free(RANY(obj)->as.bignum.digits));
-	}
-	break;
-      case T_NODE:
-	switch (nd_type(obj)) {
-	  case NODE_SCOPE:
-	    if (RANY(obj)->as.node.u1.tbl) {
-		RUBY_CRITICAL(free(RANY(obj)->as.node.u1.tbl));
-	    }
-	    break;
-#ifdef C_ALLOCA
-	  case NODE_ALLOCA:
-	    RUBY_CRITICAL(free(RANY(obj)->as.node.u1.node));
-	    break;
-#endif
-	}
-	return;			/* no need to free iv_tbl */
-
-      case T_SCOPE:
-	if (RANY(obj)->as.scope.local_vars &&
-            RANY(obj)->as.scope.flags != SCOPE_ALLOCA) {
-	    VALUE *vars = RANY(obj)->as.scope.local_vars-1;
-	    if (vars[0] == 0)
-		RUBY_CRITICAL(free(RANY(obj)->as.scope.local_tbl));
-	    if (RANY(obj)->as.scope.flags & SCOPE_MALLOC)
-		RUBY_CRITICAL(free(vars));
-	}
-	break;
-
-      case T_STRUCT:
-	if (RANY(obj)->as.rstruct.ptr) {
-	    RUBY_CRITICAL(free(RANY(obj)->as.rstruct.ptr));
-	}
-	break;
-
-      default:
-	rb_bug("gc_sweep(): unknown data type 0x%x(%d)", obj,
-	       RANY(obj)->as.basic.flags & T_MASK);
-    }
-}
-
-void
-rb_gc_mark_frame(frame)
-    struct FRAME *frame;
-{
-    mark_locations_array(frame->argv, frame->argc);
-    rb_gc_mark(frame->cbase);
-}
-
-#ifdef __GNUC__
-#if defined(__human68k__) || defined(DJGPP)
-#if defined(__human68k__)
-typedef unsigned long rb_jmp_buf[8];
-__asm__ (".even\n\
-_rb_setjmp:\n\
-	move.l	4(sp),a0\n\
-	movem.l	d3-d7/a3-a5,(a0)\n\
-	moveq.l	#0,d0\n\
-	rts");
-#ifdef setjmp
-#undef setjmp
-#endif
-#else
-#if defined(DJGPP)
-typedef unsigned long rb_jmp_buf[6];
-__asm__ (".align 4\n\
-_rb_setjmp:\n\
-	pushl	%ebp\n\
-	movl	%esp,%ebp\n\
-	movl	8(%ebp),%ebp\n\
-	movl	%eax,(%ebp)\n\
-	movl	%ebx,4(%ebp)\n\
-	movl	%ecx,8(%ebp)\n\
-	movl	%edx,12(%ebp)\n\
-	movl	%esi,16(%ebp)\n\
-	movl	%edi,20(%ebp)\n\
-	popl	%ebp\n\
-	xorl	%eax,%eax\n\
-	ret");
-#endif
-#endif
-int rb_setjmp (rb_jmp_buf);
-#define jmp_buf rb_jmp_buf
-#define setjmp rb_setjmp
-#endif /* __human68k__ or DJGPP */
-#endif /* __GNUC__ */
-
-void
-rb_gc()
-{
-    struct gc_list *list;
-    struct FRAME * volatile frame; /* gcc 2.7.2.3 -O2 bug??  */
-    jmp_buf save_regs_gc_mark;
-    SET_STACK_END;
-
-    if (dont_gc || during_gc) {
-	if (!freelist || malloc_memories > GC_MALLOC_LIMIT) {
-	    malloc_memories = 0;
-	    add_heap();
-	}
-	return;
-    }
-
-    malloc_memories = 0;
-
-    if (during_gc) return;
-    during_gc++;
-
-    init_mark_stack();
-    
-    /* mark frame stack */
-    for (frame = ruby_frame; frame; frame = frame->prev) {
-	rb_gc_mark_frame(frame); 
-	if (frame->tmp) {
-	    struct FRAME *tmp = frame->tmp;
-	    while (tmp) {
-		rb_gc_mark_frame(tmp);
-		tmp = tmp->prev;
-	    }
-	}
-    }
-    rb_gc_mark((VALUE)ruby_class);
-    rb_gc_mark((VALUE)ruby_scope);
-    rb_gc_mark((VALUE)ruby_dyna_vars);
-    if (finalizer_table) {
-	rb_mark_tbl(finalizer_table);
-    }
-
-    FLUSH_REGISTER_WINDOWS;
-    /* This assumes that all registers are saved into the jmp_buf */
-    setjmp(save_regs_gc_mark);
-    mark_locations_array((VALUE*)save_regs_gc_mark, sizeof(save_regs_gc_mark) / sizeof(VALUE *));
-    rb_gc_mark_locations(rb_gc_stack_start, (VALUE*)STACK_END);
-#if defined(__human68k__)
-    rb_gc_mark_locations((VALUE*)((char*)rb_gc_stack_start + 2),
-			 (VALUE*)((char*)STACK_END + 2));
-#endif
-    rb_gc_mark_threads();
-
-    /* mark protected global variables */
-    for (list = global_List; list; list = list->next) {
-	rb_gc_mark(*list->varptr);
-    }
-    rb_mark_end_proc();
-    rb_gc_mark_global_tbl();
-
-    rb_mark_tbl(rb_class_tbl);
-    rb_gc_mark_trap_list();
-
-    /* mark generic instance variables for special constants */
-    rb_mark_generic_ivar_tbl();
-    
-    /* gc_mark objects whose marking are not completed*/
-    while (!MARK_STACK_EMPTY){
-	if (mark_stack_overflow){
-	    gc_mark_all();
-	}
-	else {
-	    gc_mark_rest();
-	}
-    }
-    gc_sweep();
-}
-
-VALUE
-rb_gc_start()
-{
-    rb_gc();
-    return Qnil;
-}
-
-void
-Init_stack(addr)
-    VALUE *addr;
-{
-#if defined(__human68k__)
-    extern void *_SEND;
-    rb_gc_stack_start = _SEND;
-#else
-    VALUE start;
-
-    if (!addr) addr = &start;
-    rb_gc_stack_start = addr;
-#endif
-#ifdef HAVE_GETRLIMIT
-    {
-	struct rlimit rlim;
-
-	if (getrlimit(RLIMIT_STACK, &rlim) == 0) {
-	    double space = (double)rlim.rlim_cur*0.2;
-
-	    if (space > 1024*1024) space = 1024*1024;
-	    STACK_LEVEL_MAX = (rlim.rlim_cur - space) / sizeof(VALUE);
-	}
-    }
-#endif
-}
-
-void
-Init_heap()
-{
-    if (!rb_gc_stack_start) {
-	Init_stack(0);
-    }
-    add_heap();
-}
-
-static VALUE
-os_live_obj()
-{
-    int i;
-    int n = 0;
-
-    for (i = 0; i < heaps_used; i++) {
-	RVALUE *p, *pend;
-
-	p = heaps[i]; pend = p + heaps_limits[i];
-	for (;p < pend; p++) {
-	    if (p->as.basic.flags) {
-		switch (TYPE(p)) {
-		  case T_ICLASS:
-		  case T_VARMAP:
-		  case T_SCOPE:
-		  case T_NODE:
-		    continue;
-		  case T_CLASS:
-		    if (FL_TEST(p, FL_SINGLETON)) continue;
-		  default:
-		    if (!p->as.basic.klass) continue;
-		    rb_yield((VALUE)p);
-		    n++;
-		}
-	    }
-	}
-    }
-
-    return INT2FIX(n);
-}
-
-static VALUE
-os_obj_of(of)
-    VALUE of;
-{
-    int i;
-    int n = 0;
-
-    for (i = 0; i < heaps_used; i++) {
-	RVALUE *p, *pend;
-
-	p = heaps[i]; pend = p + heaps_limits[i];
-	for (;p < pend; p++) {
-	    if (p->as.basic.flags) {
-		switch (TYPE(p)) {
-		  case T_ICLASS:
-		  case T_VARMAP:
-		  case T_SCOPE:
-		  case T_NODE:
-		    continue;
-		  case T_CLASS:
-		    if (FL_TEST(p, FL_SINGLETON)) continue;
-		  default:
-		    if (!p->as.basic.klass) continue;
-		    if (rb_obj_is_kind_of((VALUE)p, of)) {
-			rb_yield((VALUE)p);
-			n++;
-		    }
-		}
-	    }
-	}
-    }
-
-    return INT2FIX(n);
-}
-
-static VALUE
-os_each_obj(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE of;
-
-    if (rb_scan_args(argc, argv, "01", &of) == 0) {
-	return os_live_obj();
-    }
-    else {
-	return os_obj_of(of);
-    }
-}
-
-static VALUE finalizers;
-
-static VALUE
-add_final(os, proc)
-    VALUE os, proc;
-{
-    rb_warn("ObjectSpace::add_finalizer is deprecated; use define_finalizer");
-    if (!rb_obj_is_kind_of(proc, rb_cProc)) {
-	rb_raise(rb_eArgError, "wrong type argument %s (Proc required)",
-		 rb_class2name(CLASS_OF(proc)));
-    }
-    rb_ary_push(finalizers, proc);
-    return proc;
-}
-
-static VALUE
-rm_final(os, proc)
-    VALUE os, proc;
-{
-    rb_warn("ObjectSpace::remove_finalizer is deprecated; use undefine_finalizer");
-    rb_ary_delete(finalizers, proc);
-    return proc;
-}
-
-static VALUE
-finals()
-{
-    rb_warn("ObjectSpace::finalizers is deprecated");
-    return finalizers;
-}
-
-static VALUE
-call_final(os, obj)
-    VALUE os, obj;
-{
-    rb_warn("ObjectSpace::call_final is deprecated; use define_finalizer");
-    need_call_final = 1;
-    FL_SET(obj, FL_FINALIZE);
-    return obj;
-}
-
-static VALUE
-undefine_final(os, obj)
-    VALUE os, obj;
-{
-    if (finalizer_table) {
-	st_delete(finalizer_table, &obj, 0);
-    }
-    return obj;
-}
-
-static VALUE
-define_final(argc, argv, os)
-    int argc;
-    VALUE *argv;
-    VALUE os;
-{
-    VALUE obj, proc, table;
-
-    rb_scan_args(argc, argv, "11", &obj, &proc);
-    if (argc == 1) {
-	proc = rb_f_lambda();
-    }
-    else if (!rb_obj_is_kind_of(proc, rb_cProc)) {
-	rb_raise(rb_eArgError, "wrong type argument %s (Proc required)",
-		 rb_class2name(CLASS_OF(proc)));
-    }
-    need_call_final = 1;
-    FL_SET(obj, FL_FINALIZE);
-
-    if (!finalizer_table) {
-	finalizer_table = st_init_numtable();
-    }
-    if (st_lookup(finalizer_table, obj, &table)) {
-	rb_ary_push(table, proc);
-    }
-    else {
-	st_add_direct(finalizer_table, obj, rb_ary_new3(1, proc));
-    }
-    return proc;
-}
-
-static VALUE
-run_single_final(args)
-    VALUE *args;
-{
-    rb_eval_cmd(args[0], args[1], 0);
-    return Qnil;
-}
-
-static void
-run_final(obj)
-    VALUE obj;
-{
-    int i, status;
-    VALUE args[2], table;
-
-    args[1] = rb_ary_new3(1, rb_obj_id(obj)); /* make obj into id */
-    for (i=0; ilen; i++) {
-	args[0] = RARRAY(finalizers)->ptr[i];
-	rb_protect((VALUE(*)_((VALUE)))run_single_final, (VALUE)args, &status);
-    }
-    if (finalizer_table && st_delete(finalizer_table, &obj, &table)) {
-	for (i=0; ilen; i++) {
-	    args[0] = RARRAY(table)->ptr[i];
-	    rb_protect((VALUE(*)_((VALUE)))run_single_final, (VALUE)args, &status);
-	}
-    }
-}
-
-void
-rb_gc_call_finalizer_at_exit()
-{
-    RVALUE *p, *pend;
-    int i;
-
-    /* run finalizers */
-    if (need_call_final) {
-	if (deferred_final_list) {
-	    p = deferred_final_list;
-	    while (p) {
-		RVALUE *tmp = p;
-		p = p->as.free.next;
-		run_final((VALUE)tmp);
-	    }
-	}
-	for (i = 0; i < heaps_used; i++) {
-	    p = heaps[i]; pend = p + heaps_limits[i];
-	    while (p < pend) {
-		if (FL_TEST(p, FL_FINALIZE)) {
-		    FL_UNSET(p, FL_FINALIZE);
-		    p->as.basic.klass = 0;
-		    run_final((VALUE)p);
-		}
-		p++;
-	    }
-	}
-    }
-    /* run data object's finaliers */
-    for (i = 0; i < heaps_used; i++) {
-	p = heaps[i]; pend = p + heaps_limits[i];
-	while (p < pend) {
-	    if (BUILTIN_TYPE(p) == T_DATA &&
-		DATA_PTR(p) && RANY(p)->as.data.dfree) {
-		p->as.free.flags = 0;
-		(*RANY(p)->as.data.dfree)(DATA_PTR(p));
-	    }
-	    else if (BUILTIN_TYPE(p) == T_FILE) {
-		p->as.free.flags = 0;
-		rb_io_fptr_finalize(RANY(p)->as.file.fptr);
-	    }
-	    p++;
-	}
-    }
-}
-
-static VALUE
-id2ref(obj, id)
-    VALUE obj, id;
-{
-    unsigned long ptr, p0;
-
-    rb_secure(4);
-    p0 = ptr = NUM2ULONG(id);
-    if (ptr == Qtrue) return Qtrue;
-    if (ptr == Qfalse) return Qfalse;
-    if (ptr == Qnil) return Qnil;
-    if (FIXNUM_P(ptr)) return (VALUE)ptr;
-    if (SYMBOL_P(ptr) && rb_id2name(SYM2ID((VALUE)ptr)) != 0) {
-	return (VALUE)ptr;
-    }
-
-    ptr = id ^ FIXNUM_FLAG;	/* unset FIXNUM_FLAG */
-    if (!is_pointer_to_heap((void *)ptr)) {
-	rb_raise(rb_eRangeError, "0x%x is not id value", p0);
-    }
-    if (BUILTIN_TYPE(ptr) == 0) {
-	rb_raise(rb_eRangeError, "0x%x is recycled object", p0);
-    }
-    return (VALUE)ptr;
-}
-
-void
-Init_GC()
-{
-    VALUE rb_mObSpace;
-
-    rb_mGC = rb_define_module("GC");
-    rb_define_singleton_method(rb_mGC, "start", rb_gc_start, 0);
-    rb_define_singleton_method(rb_mGC, "enable", rb_gc_enable, 0);
-    rb_define_singleton_method(rb_mGC, "disable", rb_gc_disable, 0);
-    rb_define_method(rb_mGC, "garbage_collect", rb_gc_start, 0);
-
-    rb_mObSpace = rb_define_module("ObjectSpace");
-    rb_define_module_function(rb_mObSpace, "each_object", os_each_obj, -1);
-    rb_define_module_function(rb_mObSpace, "garbage_collect", rb_gc_start, 0);
-    rb_define_module_function(rb_mObSpace, "add_finalizer", add_final, 1);
-    rb_define_module_function(rb_mObSpace, "remove_finalizer", rm_final, 1);
-    rb_define_module_function(rb_mObSpace, "finalizers", finals, 0);
-    rb_define_module_function(rb_mObSpace, "call_finalizer", call_final, 1);
-
-    rb_define_module_function(rb_mObSpace, "define_finalizer", define_final, -1);
-    rb_define_module_function(rb_mObSpace, "undefine_finalizer", undefine_final, 1);
-
-    rb_define_module_function(rb_mObSpace, "_id2ref", id2ref, 1);
-
-    rb_gc_register_address(&rb_mObSpace);
-    rb_global_variable(&finalizers);
-    rb_gc_unregister_address(&rb_mObSpace);
-    finalizers = rb_ary_new();
-
-    source_filenames = st_init_strtable();
-
-    nomem_error = rb_exc_new2(rb_eNoMemError, "failed to allocate memory");
-    rb_global_variable(&nomem_error);
-}
diff --git a/hash.c b/hash.c
deleted file mode 100644
index 5cc3638b83..0000000000
--- a/hash.c
+++ /dev/null
@@ -1,1666 +0,0 @@
-/**********************************************************************
-
-  hash.c -
-
-  $Author$
-  $Date$
-  created at: Mon Nov 22 18:51:18 JST 1993
-
-  Copyright (C) 1993-2002 Yukihiro Matsumoto
-  Copyright (C) 2000  Network Applied Communication Laboratory, Inc.
-  Copyright (C) 2000  Information-technology Promotion Agency, Japan
-
-**********************************************************************/
-
-#include "ruby.h"
-#include "st.h"
-#include "util.h"
-#include "rubysig.h"
-
-#define HASH_DELETED  FL_USER1
-#define HASH_PROC_DEFAULT FL_USER2
-
-static void
-rb_hash_modify(hash)
-    VALUE hash;
-{
-    if (OBJ_FROZEN(hash)) rb_error_frozen("hash");
-    if (!OBJ_TAINTED(hash) && rb_safe_level() >= 4)
-	rb_raise(rb_eSecurityError, "Insecure: can't modify hash");
-}
-
-VALUE
-rb_hash_freeze(hash)
-    VALUE hash;
-{
-    return rb_obj_freeze(hash);
-}
-
-VALUE rb_cHash;
-
-static VALUE envtbl;
-static ID id_hash, id_yield, id_default;
-
-VALUE
-rb_hash(obj)
-    VALUE obj;
-{
-    return rb_funcall(obj, id_hash, 0);
-}
-
-static VALUE
-eql(args)
-    VALUE *args;
-{
-    return (VALUE)rb_eql(args[0], args[1]);
-}
-
-static int
-rb_any_cmp(a, b)
-    VALUE a, b;
-{
-    VALUE args[2];
-    if (FIXNUM_P(a) && FIXNUM_P(b)) {
-	return a != b;
-    }
-    if (TYPE(a) == T_STRING && RBASIC(a)->klass == rb_cString &&
-	TYPE(b) == T_STRING && RBASIC(b)->klass == rb_cString) {
-	return rb_str_cmp(a, b);
-    }
-    if (SYMBOL_P(a) && SYMBOL_P(b)) {
-	return a != b;
-    }
-    if (a == Qundef || b == Qundef) return -1;
-
-    args[0] = a;
-    args[1] = b;
-    return !rb_with_disable_interrupt(eql, (VALUE)args);
-}
-
-static int
-rb_any_hash(a)
-    VALUE a;
-{
-    VALUE hval;
-
-    switch (TYPE(a)) {
-      case T_FIXNUM:
-      case T_SYMBOL:
-	return (int)a;
-	break;
-
-      case T_STRING:
-	return rb_str_hash(a);
-	break;
-
-      default:
-	DEFER_INTS;
-	hval = rb_funcall(a, id_hash, 0);
-	if (FIXNUM_P(hval)) {
-	    hval %= 536870923;
-	}
-	else {
-	    hval = rb_funcall(hval, '%', 1, INT2FIX(536870923));
-	}
-	ENABLE_INTS;
-	return (int)FIX2LONG(hval);
-    }
-}
-
-static struct st_hash_type objhash = {
-    rb_any_cmp,
-    rb_any_hash,
-};
-
-struct rb_hash_foreach_arg {
-    VALUE hash;
-    enum st_retval (*func)();
-    char *arg;
-};
-
-static int
-rb_hash_foreach_iter(key, value, arg)
-    VALUE key, value;
-    struct rb_hash_foreach_arg *arg;
-{
-    int status;
-    st_table *tbl = RHASH(arg->hash)->tbl;
-    struct st_table_entry **bins = tbl->bins;
-
-    if (key == Qundef) return ST_CONTINUE;
-    status = (*arg->func)(key, value, arg->arg);
-    if (RHASH(arg->hash)->tbl != tbl || RHASH(arg->hash)->tbl->bins != bins){
-	rb_raise(rb_eIndexError, "rehash occurred during iteration");
-    }
-    return status;
-}
-
-static VALUE
-rb_hash_foreach_call(arg)
-    struct rb_hash_foreach_arg *arg;
-{
-    st_foreach(RHASH(arg->hash)->tbl, rb_hash_foreach_iter, arg);
-    return Qnil;
-}
-
-static VALUE
-rb_hash_foreach_ensure(hash)
-    VALUE hash;
-{
-    RHASH(hash)->iter_lev--;
-
-    if (RHASH(hash)->iter_lev == 0) {
-	if (FL_TEST(hash, HASH_DELETED)) {
-	    st_cleanup_safe(RHASH(hash)->tbl, Qundef);
-	    FL_UNSET(hash, HASH_DELETED);
-	}
-    }
-    return 0;
-}
-
-static int
-rb_hash_foreach(hash, func, farg)
-    VALUE hash;
-    enum st_retval (*func)();
-    char *farg;
-{
-    struct rb_hash_foreach_arg arg;
-
-    RHASH(hash)->iter_lev++;
-    arg.hash = hash;
-    arg.func = func;
-    arg.arg  = farg;
-    return rb_ensure(rb_hash_foreach_call, (VALUE)&arg, rb_hash_foreach_ensure, hash);
-}
-
-static VALUE
-rb_hash_s_alloc(klass)
-    VALUE klass;
-{
-    NEWOBJ(hash, struct RHash);
-    OBJSETUP(hash, klass, T_HASH);
-
-    hash->ifnone = Qnil;
-    hash->tbl = st_init_table(&objhash);
-
-    return (VALUE)hash;
-}
-
-VALUE
-rb_hash_new()
-{
-    return rb_hash_s_alloc(rb_cHash);
-}
-
-static VALUE
-rb_hash_initialize(argc, argv, hash)
-    int argc;
-    VALUE *argv;
-    VALUE hash;
-{
-    VALUE ifnone;
-
-    rb_hash_modify(hash);
-    if (rb_block_given_p()) {
-	if (argc > 0) {
-	    rb_raise(rb_eArgError, "wrong number of arguments");
-	}
-	RHASH(hash)->ifnone = rb_f_lambda();
-	FL_SET(hash, HASH_PROC_DEFAULT);
-    }
-    else {
-	rb_scan_args(argc, argv, "01", &ifnone);
-	RHASH(hash)->ifnone = ifnone;
-    }
-
-    return hash;
-}
-
-static VALUE
-rb_hash_s_create(argc, argv, klass)
-    int argc;
-    VALUE *argv;
-    VALUE klass;
-{
-    VALUE hash;
-    int i;
-
-    if (argc == 1 && TYPE(argv[0]) == T_HASH) {
-	VALUE hash = rb_obj_alloc(klass);
-	    
-	RHASH(hash)->ifnone = Qnil;
-	RHASH(hash)->tbl = st_copy(RHASH(argv[0])->tbl);
-
-	return hash;
-    }
-
-    if (argc % 2 != 0) {
-	rb_raise(rb_eArgError, "odd number args for Hash");
-    }
-    hash = rb_hash_s_alloc(klass);
-
-    for (i=0; iifnone = RHASH(hash)->ifnone;
-    RHASH(clone)->tbl = (st_table*)st_copy(RHASH(hash)->tbl);
-
-    return clone;
-}
-
-static VALUE
-to_hash(hash)
-    VALUE hash;
-{
-    return rb_convert_type(hash, T_HASH, "Hash", "to_hash");
-}
-
-static int
-rb_hash_rehash_i(key, value, tbl)
-    VALUE key, value;
-    st_table *tbl;
-{
-    if (key != Qundef) st_insert(tbl, key, value);
-    return ST_CONTINUE;
-}
-
-static VALUE
-rb_hash_rehash(hash)
-    VALUE hash;
-{
-    st_table *tbl;
-
-    tbl = st_init_table_with_size(&objhash, RHASH(hash)->tbl->num_entries);
-    st_foreach(RHASH(hash)->tbl, rb_hash_rehash_i, tbl);
-    st_free_table(RHASH(hash)->tbl);
-    RHASH(hash)->tbl = tbl;
-
-    return hash;
-}
-
-VALUE
-rb_hash_aref(hash, key)
-    VALUE hash, key;
-{
-    VALUE val;
-
-    if (!st_lookup(RHASH(hash)->tbl, key, &val)) {
-	return rb_funcall(hash, id_default, 1, key);
-    }
-    return val;
-}
-
-static VALUE
-rb_hash_fetch(argc, argv, hash)
-    int argc;
-    VALUE *argv;
-    VALUE hash;
-{
-    VALUE key, if_none;
-    VALUE val;
-
-    rb_scan_args(argc, argv, "11", &key, &if_none);
-
-    if (!st_lookup(RHASH(hash)->tbl, key, &val)) {
-	if (rb_block_given_p()) {
-	    if (argc > 1) {
-               rb_raise(rb_eArgError, "wrong number of arguments");
-	    }
-	    return rb_yield(key);
-	}
-	if (argc == 1) {
-	    rb_raise(rb_eIndexError, "key not found");
-	}
-	return if_none;
-    }
-    return val;
-}
-
-static VALUE
-rb_hash_default(argc, argv, hash)
-    int argc;
-    VALUE *argv;
-    VALUE hash;
-{
-    VALUE key;
-
-    rb_scan_args(argc, argv, "01", &key);
-    if (FL_TEST(hash, HASH_PROC_DEFAULT)) {
-	return rb_funcall(RHASH(hash)->ifnone, id_yield, 2, hash, key);
-    }
-    return RHASH(hash)->ifnone;
-}
-
-static VALUE
-rb_hash_set_default(hash, ifnone)
-    VALUE hash, ifnone;
-{
-    rb_hash_modify(hash);
-    RHASH(hash)->ifnone = ifnone;
-    FL_UNSET(hash, HASH_PROC_DEFAULT);
-    return ifnone;
-}
-
-static int
-index_i(key, value, args)
-    VALUE key, value;
-    VALUE *args;
-{
-    if (rb_equal(value, args[0])) {
-	args[1] = key;
-	return ST_STOP;
-    }
-    return ST_CONTINUE;
-}
-
-static VALUE
-rb_hash_index(hash, value)
-    VALUE hash, value;
-{
-    VALUE args[2];
-
-    args[0] = value;
-    args[1] = Qnil;
-
-    st_foreach(RHASH(hash)->tbl, index_i, args);
-
-    return args[1];
-}
-
-static VALUE
-rb_hash_indexes(argc, argv, hash)
-    int argc;
-    VALUE *argv;
-    VALUE hash;
-{
-    VALUE indexes;
-    int i;
-
-    rb_warn("Hash#%s is deprecated; use Hash#select",
-	    rb_id2name(rb_frame_last_func()));
-    indexes = rb_ary_new2(argc);
-    for (i=0; iptr[i] = rb_hash_aref(hash, argv[i]);
-	RARRAY(indexes)->len++;
-    }
-    return indexes;
-}
-
-VALUE
-rb_hash_delete(hash, key)
-    VALUE hash, key;
-{
-    VALUE val;
-
-    rb_hash_modify(hash);
-    if (RHASH(hash)->iter_lev > 0) {
-	if (st_delete_safe(RHASH(hash)->tbl, &key, &val, Qundef)) {
-	    FL_SET(hash, HASH_DELETED);
-	    return val;
-	}
-    }
-    else if (st_delete(RHASH(hash)->tbl, &key, &val))
-	return val;
-    if (rb_block_given_p()) {
-	return rb_yield(key);
-    }
-    return Qnil;
-}
-
-struct shift_var {
-    int stop;
-    VALUE key;
-    VALUE val;
-};
-
-static int
-shift_i(key, value, var)
-    VALUE key, value;
-    struct shift_var *var;
-{
-    if (key == Qundef) return ST_CONTINUE;
-    if (var->stop) return ST_STOP;
-    var->stop = 1;
-    var->key = key;
-    var->val = value;
-    return ST_DELETE;
-}
-
-static VALUE
-rb_hash_shift(hash)
-    VALUE hash;
-{
-    struct shift_var var;
-
-    rb_hash_modify(hash);
-    var.stop = 0;
-    st_foreach(RHASH(hash)->tbl, shift_i, &var);
-
-    if (var.stop == 0) return RHASH(hash)->ifnone;
-    return rb_assoc_new(var.key, var.val);
-}
-
-static int
-delete_if_i(key, value)
-    VALUE key, value;
-{
-    if (key == Qundef) return ST_CONTINUE;
-    if (RTEST(rb_yield(rb_assoc_new(key, value))))
-	return ST_DELETE;
-    return ST_CONTINUE;
-}
-
-VALUE
-rb_hash_delete_if(hash)
-    VALUE hash;
-{
-    rb_hash_modify(hash);
-    rb_hash_foreach(hash, delete_if_i, 0);
-    return hash;
-}
-
-VALUE
-rb_hash_reject_bang(hash)
-    VALUE hash;
-{
-    int n = RHASH(hash)->tbl->num_entries;
-    rb_hash_delete_if(hash);
-    if (n == RHASH(hash)->tbl->num_entries) return Qnil;
-    return hash;
-}
-
-static VALUE
-rb_hash_reject(hash)
-    VALUE hash;
-{
-    return rb_hash_delete_if(rb_obj_dup(hash));
-}
-
-static int
-select_i(key, value, result)
-    VALUE key, value;
-{
-    VALUE assoc;
-
-    if (key == Qundef) return ST_CONTINUE;
-    assoc = rb_assoc_new(key, value);
-    if (RTEST(rb_yield(assoc)))
-	rb_ary_push(result, assoc);
-    return ST_CONTINUE;
-}
-
-VALUE
-rb_hash_select(argc, argv, hash)
-    int argc;
-    VALUE *argv;
-    VALUE hash;
-{
-    VALUE result = rb_ary_new();
-    long i;
-
-    if (rb_block_given_p()) {
-	if (argc > 0) {
-	    rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc);
-	}
-	rb_hash_foreach(hash, select_i, result);
-    }
-    else {
-	for (i=0; itbl, clear_i, 0);
-
-    return hash;
-}
-
-VALUE
-rb_hash_aset(hash, key, val)
-    VALUE hash, key, val;
-{
-    rb_hash_modify(hash);
-    if (TYPE(key) != T_STRING || st_lookup(RHASH(hash)->tbl, key, 0)) {
-	st_insert(RHASH(hash)->tbl, key, val);
-    }
-    else {
-	st_add_direct(RHASH(hash)->tbl, rb_str_new4(key), val);
-    }
-    return val;
-}
-
-static int
-replace_i(key, val, hash)
-    VALUE key, val, hash;
-{
-    if (key != Qundef) {
-	rb_hash_aset(hash, key, val);
-    }
-
-    return ST_CONTINUE;
-}
-
-static VALUE
-rb_hash_replace(hash, hash2)
-    VALUE hash, hash2;
-{
-    hash2 = to_hash(hash2);
-    rb_hash_clear(hash);
-    st_foreach(RHASH(hash2)->tbl, replace_i, hash);
-
-    return hash;
-}
-
-static VALUE
-rb_hash_size(hash)
-    VALUE hash;
-{
-    return INT2FIX(RHASH(hash)->tbl->num_entries);
-}
-
-static VALUE
-rb_hash_empty_p(hash)
-    VALUE hash;
-{
-    if (RHASH(hash)->tbl->num_entries == 0)
-	return Qtrue;
-    return Qfalse;
-}
-
-static int
-each_value_i(key, value)
-    VALUE key, value;
-{
-    if (key == Qundef) return ST_CONTINUE;
-    rb_yield(value);
-    return ST_CONTINUE;
-}
-
-static VALUE
-rb_hash_each_value(hash)
-    VALUE hash;
-{
-    rb_hash_foreach(hash, each_value_i, 0);
-    return hash;
-}
-
-static int
-each_key_i(key, value)
-    VALUE key, value;
-{
-    if (key == Qundef) return ST_CONTINUE;
-    rb_yield(key);
-    return ST_CONTINUE;
-}
-
-static VALUE
-rb_hash_each_key(hash)
-    VALUE hash;
-{
-    rb_hash_foreach(hash, each_key_i, 0);
-    return hash;
-}
-
-static int
-each_pair_i(key, value)
-    VALUE key, value;
-{
-    if (key == Qundef) return ST_CONTINUE;
-    rb_yield(rb_assoc_new(key, value));
-    return ST_CONTINUE;
-}
-
-static VALUE
-rb_hash_each_pair(hash)
-    VALUE hash;
-{
-    rb_hash_foreach(hash, each_pair_i, 0);
-    return hash;
-}
-
-static int
-to_a_i(key, value, ary)
-    VALUE key, value, ary;
-{
-    if (key == Qundef) return ST_CONTINUE;
-    rb_ary_push(ary, rb_assoc_new(key, value));
-    return ST_CONTINUE;
-}
-
-static VALUE
-rb_hash_to_a(hash)
-    VALUE hash;
-{
-    VALUE ary;
-
-    ary = rb_ary_new();
-    st_foreach(RHASH(hash)->tbl, to_a_i, ary);
-    if (OBJ_TAINTED(hash)) OBJ_TAINT(ary);
-
-    return ary;
-}
-
-static VALUE
-rb_hash_sort(hash)
-    VALUE hash;
-{
-    VALUE entries = rb_hash_to_a(hash);
-    rb_ary_sort_bang(entries);
-    return entries;
-}
-
-static int
-inspect_i(key, value, str)
-    VALUE key, value, str;
-{
-    VALUE str2;
-
-    if (key == Qundef) return ST_CONTINUE;
-    if (RSTRING(str)->len > 1) {
-	rb_str_cat2(str, ", ");
-    }
-    str2 = rb_inspect(key);
-    rb_str_buf_append(str, str2);
-    OBJ_INFECT(str, str2);
-    rb_str_buf_cat2(str, "=>");
-    str2 = rb_inspect(value);
-    rb_str_buf_append(str, str2);
-    OBJ_INFECT(str, str2);
-
-    return ST_CONTINUE;
-}
-
-static VALUE
-inspect_hash(hash)
-    VALUE hash;
-{
-    VALUE str;
-
-    str = rb_str_buf_new2("{");
-    st_foreach(RHASH(hash)->tbl, inspect_i, str);
-    rb_str_buf_cat2(str, "}");
-    OBJ_INFECT(str, hash);
-
-    return str;
-}
-
-static VALUE
-rb_hash_inspect(hash)
-    VALUE hash;
-{
-    if (RHASH(hash)->tbl == 0 || RHASH(hash)->tbl->num_entries == 0)
-	return rb_str_new2("{}");
-    if (rb_inspecting_p(hash)) return rb_str_new2("{...}");
-    return rb_protect_inspect(inspect_hash, hash, 0);
-}
-
-static VALUE
-to_s_hash(hash)
-    VALUE hash;
-{
-    return rb_ary_to_s(rb_hash_to_a(hash));
-}
-
-static VALUE
-rb_hash_to_s(hash)
-    VALUE hash;
-{
-    if (rb_inspecting_p(hash)) return rb_str_new2("{...}");
-    return rb_protect_inspect(to_s_hash, hash, 0);
-}
-
-static VALUE
-rb_hash_to_hash(hash)
-    VALUE hash;
-{
-    return hash;
-}
-
-static int
-keys_i(key, value, ary)
-    VALUE key, value, ary;
-{
-    if (key == Qundef) return ST_CONTINUE;
-    rb_ary_push(ary, key);
-    return ST_CONTINUE;
-}
-
-static VALUE
-rb_hash_keys(hash)
-    VALUE hash;
-{
-    VALUE ary;
-
-    ary = rb_ary_new();
-    st_foreach(RHASH(hash)->tbl, keys_i, ary);
-
-    return ary;
-}
-
-static int
-values_i(key, value, ary)
-    VALUE key, value, ary;
-{
-    if (key == Qundef) return ST_CONTINUE;
-    rb_ary_push(ary, value);
-    return ST_CONTINUE;
-}
-
-static VALUE
-rb_hash_values(hash)
-    VALUE hash;
-{
-    VALUE ary;
-
-    ary = rb_ary_new();
-    st_foreach(RHASH(hash)->tbl, values_i, ary);
-
-    return ary;
-}
-
-static VALUE
-rb_hash_has_key(hash, key)
-    VALUE hash;
-    VALUE key;
-{
-    if (st_lookup(RHASH(hash)->tbl, key, 0)) {
-	return Qtrue;
-    }
-    return Qfalse;
-}
-
-static int
-rb_hash_search_value(key, value, data)
-    VALUE key, value, *data;
-{
-    if (key == Qundef) return ST_CONTINUE;
-    if (rb_equal(value, data[1])) {
-	data[0] = Qtrue;
-	return ST_STOP;
-    }
-    return ST_CONTINUE;
-}
-
-static VALUE
-rb_hash_has_value(hash, val)
-    VALUE hash;
-    VALUE val;
-{
-    VALUE data[2];
-
-    data[0] = Qfalse;
-    data[1] = val;
-    st_foreach(RHASH(hash)->tbl, rb_hash_search_value, data);
-    return data[0];
-}
-
-struct equal_data {
-    int result;
-    st_table *tbl;
-};
-
-static int
-equal_i(key, val1, data)
-    VALUE key, val1;
-    struct equal_data *data;
-{
-    VALUE val2;
-
-    if (key == Qundef) return ST_CONTINUE;
-    if (!st_lookup(data->tbl, key, &val2)) {
-	data->result = Qfalse;
-	return ST_STOP;
-    }
-    if (!rb_equal(val1, val2)) {
-	data->result = Qfalse;
-	return ST_STOP;
-    }
-    return ST_CONTINUE;
-}
-
-static VALUE
-rb_hash_equal(hash1, hash2)
-    VALUE hash1, hash2;
-{
-    struct equal_data data;
-
-    if (hash1 == hash2) return Qtrue;
-    if (TYPE(hash2) != T_HASH) return Qfalse;
-    if (RHASH(hash1)->tbl->num_entries != RHASH(hash2)->tbl->num_entries)
-	return Qfalse;
-
-    data.tbl = RHASH(hash2)->tbl;
-    data.result = Qtrue;
-    st_foreach(RHASH(hash1)->tbl, equal_i, &data);
-
-    return data.result;
-}
-
-static int
-rb_hash_invert_i(key, value, hash)
-    VALUE key, value;
-    VALUE hash;
-{
-    if (key == Qundef) return ST_CONTINUE;
-    rb_hash_aset(hash, value, key);
-    return ST_CONTINUE;
-}
-
-static VALUE
-rb_hash_invert(hash)
-    VALUE hash;
-{
-    VALUE h = rb_hash_new();
-
-    st_foreach(RHASH(hash)->tbl, rb_hash_invert_i, h);
-    return h;
-}
-
-static int
-rb_hash_update_i(key, value, hash)
-    VALUE key, value;
-    VALUE hash;
-{
-    if (key == Qundef) return ST_CONTINUE;
-    rb_hash_aset(hash, key, value);
-    return ST_CONTINUE;
-}
-
-static int
-rb_hash_update_block_i(key, value, hash)
-    VALUE key, value;
-    VALUE hash;
-{
-    if (key == Qundef) return ST_CONTINUE;
-    if (rb_hash_has_key(hash, key)) {
-	value = rb_yield(rb_ary_new3(3, key, rb_hash_aref(hash, key), value));
-    }
-    rb_hash_aset(hash, key, value);
-    return ST_CONTINUE;
-}
-
-static VALUE
-rb_hash_update(hash1, hash2)
-    VALUE hash1, hash2;
-{
-    hash2 = to_hash(hash2);
-    if (rb_block_given_p()) {
-	st_foreach(RHASH(hash2)->tbl, rb_hash_update_block_i, hash1);
-    }
-    else {
-	st_foreach(RHASH(hash2)->tbl, rb_hash_update_i, hash1);
-    }
-    return hash1;
-}
-
-static int path_tainted = -1;
-
-static char **origenviron;
-#ifdef NT
-#define GET_ENVIRON(e) (e = rb_w32_get_environ())
-#define FREE_ENVIRON(e) rb_w32_free_environ(e)
-static char **my_environ;
-#undef environ
-#define environ my_environ
-#else
-extern char **environ;
-#define GET_ENVIRON(e) (e)
-#define FREE_ENVIRON(e)
-#endif
-
-static VALUE
-env_delete(obj, name)
-    VALUE obj, name;
-{
-    char *nam, *val;
-
-    rb_secure(4);
-    StringValue(name);
-    nam = RSTRING(name)->ptr;
-    if (strlen(nam) != RSTRING(name)->len) {
-	rb_raise(rb_eArgError, "bad environment variable name");
-    }
-    val = getenv(nam);
-    if (val) {
-	VALUE value = rb_tainted_str_new2(val);
-
-	ruby_setenv(nam, 0);
-#ifdef __BORLANDC__
-	if (strcmpi(nam, "PATH") == 0 && !OBJ_TAINTED(name)) {
-#else
-	if (strcmp(nam, "PATH") == 0 && !OBJ_TAINTED(name)) {
-#endif
-	    path_tainted = 0;
-	}
-	return value;
-    }
-    return Qnil;
-}
-
-static VALUE
-env_delete_m(obj, name)
-    VALUE obj, name;
-{
-    VALUE val = env_delete(obj, name);
-    if (rb_block_given_p()) rb_yield(name);
-    return val;
-}
-
-static VALUE
-rb_f_getenv(obj, name)
-    VALUE obj, name;
-{
-    char *nam, *env;
-
-    StringValue(name);
-    nam = RSTRING(name)->ptr;
-    if (strlen(nam) != RSTRING(name)->len) {
-	rb_raise(rb_eArgError, "bad environment variable name");
-    }
-    env = getenv(nam);
-    if (env) {
-#ifdef __BORLANDC__
-	if (strcmpi(nam, "PATH") == 0 && !rb_env_path_tainted())
-#else
-	if (strcmp(nam, "PATH") == 0 && !rb_env_path_tainted())
-#endif
-	    return rb_str_new2(env);
-	return rb_tainted_str_new2(env);
-    }
-    return Qnil;
-}
-
-static VALUE
-env_fetch(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE key, if_none;
-    char *nam, *env;
-
-    rb_scan_args(argc, argv, "11", &key, &if_none);
-    StringValue(key);
-    nam = RSTRING(key)->ptr;
-    if (strlen(nam) != RSTRING(key)->len) {
-	rb_raise(rb_eArgError, "bad environment variable name");
-    }
-    env = getenv(nam);
-    if (!env) {
-	if (rb_block_given_p()) {
-	    if (argc > 1) {
-		rb_raise(rb_eArgError, "wrong number of arguments");
-	    }
-	    return rb_yield(key);
-	}
-	if (argc == 1) {
-	    rb_raise(rb_eIndexError, "key not found");
-	}
-	return if_none;
-    }
-#ifdef __BORLANDC__
-    if (strcmpi(nam, "PATH") == 0 && !rb_env_path_tainted())
-#else
-    if (strcmp(nam, "PATH") == 0 && !rb_env_path_tainted())
-#endif
-	return rb_str_new2(env);
-    return rb_tainted_str_new2(env);
-}
-
-static void
-path_tainted_p(path)
-    char *path;
-{
-    path_tainted = rb_path_check(path)?0:1;
-}
-
-int
-rb_env_path_tainted()
-{
-    if (path_tainted < 0) {
-	path_tainted_p(getenv("PATH"));
-    }
-    return path_tainted;
-}
-
-static int
-envix(nam)
-char *nam;
-{
-    register int i, len = strlen(nam);
-    char **env;
-
-    env = GET_ENVIRON(environ);
-    for (i = 0; env[i]; i++) {
-	if (
-#ifdef WIN32
-	    strnicmp(env[i],nam,len) == 0
-#else
-	    memcmp(env[i],nam,len) == 0
-#endif
-	    && env[i][len] == '=')
-	    break;			/* memcmp must come first to avoid */
-    }					/* potential SEGV's */
-    FREE_ENVIRON(environ);
-    return i;
-}
-
-void
-ruby_setenv(name, value)
-    const char *name;
-    const char *value;
-{
-#if defined(WIN32) && !defined(__CYGWIN32__)
-    /* The sane way to deal with the environment.
-     * Has these advantages over putenv() & co.:
-     *  * enables us to store a truly empty value in the
-     *    environment (like in UNIX).
-     *  * we don't have to deal with RTL globals, bugs and leaks.
-     *  * Much faster.
-     * Why you may want to enable USE_WIN32_RTL_ENV:
-     *  * environ[] and RTL functions will not reflect changes,
-     *    which might be an issue if extensions want to access
-     *    the env. via RTL.  This cuts both ways, since RTL will
-     *    not see changes made by extensions that call the Win32
-     *    functions directly, either.
-     * GSAR 97-06-07
-     *
-     * REMARK: USE_WIN32_RTL_ENV is already obsoleted since we don't use
-     *         RTL's environ global variable directly yet.
-     */
-    SetEnvironmentVariable(name,value);
-#elif defined __CYGWIN__
-#undef setenv
-#undef unsetenv
-    if (value)
-	setenv(name,value,1);
-    else
-	unsetenv(name);
-#else  /* WIN32 */
-
-    int i=envix(name);		        /* where does it go? */
-
-    if (environ == origenviron) {	/* need we copy environment? */
-	int j;
-	int max;
-	char **tmpenv;
-
-	for (max = i; environ[max]; max++) ;
-	tmpenv = ALLOC_N(char*, max+2);
-	for (j=0; j= 4) {
-	rb_raise(rb_eSecurityError, "cannot change environment variable");
-    }
-
-    if (NIL_P(val)) {
-	env_delete(obj, nm);
-	return Qnil;
-    }
-
-    StringValue(nm);
-    StringValue(val);
-    name = RSTRING(nm)->ptr;
-    value = RSTRING(val)->ptr;
-    if (strlen(name) != RSTRING(nm)->len)
-	rb_raise(rb_eArgError, "bad environment variable name");
-    if (strlen(value) != RSTRING(val)->len)
-	rb_raise(rb_eArgError, "bad environment variable value");
-
-    ruby_setenv(name, value);
-    if (strcmp(name, "PATH") == 0) {
-	if (OBJ_TAINTED(val)) {
-	    /* already tainted, no check */
-	    path_tainted = 1;
-	    return val;
-	}
-	else {
-	    path_tainted_p(value);
-	}
-    }
-    return val;
-}
-
-static VALUE
-env_keys()
-{
-    char **env;
-    VALUE ary = rb_ary_new();
-
-    env = GET_ENVIRON(environ);
-    while (*env) {
-	char *s = strchr(*env, '=');
-	if (s) {
-	    rb_ary_push(ary, rb_tainted_str_new(*env, s-*env));
-	}
-	env++;
-    }
-    FREE_ENVIRON(environ);
-    return ary;
-}
-
-static VALUE
-env_each_key(hash)
-    VALUE hash;
-{
-    char **env;
-
-    env = GET_ENVIRON(environ);
-    while (*env) {
-	char *s = strchr(*env, '=');
-	if (s) {
-	    rb_yield(rb_tainted_str_new(*env, s-*env));
-	}
-	env++;
-    }
-    FREE_ENVIRON(environ);
-    return Qnil;
-}
-
-static VALUE
-env_values()
-{
-    char **env;
-    VALUE ary = rb_ary_new();
-
-    env = GET_ENVIRON(environ);
-    while (*env) {
-	char *s = strchr(*env, '=');
-	if (s) {
-	    rb_ary_push(ary, rb_tainted_str_new2(s+1));
-	}
-	env++;
-    }
-    FREE_ENVIRON(environ);
-    return ary;
-}
-
-static VALUE
-env_each_value(hash)
-    VALUE hash;
-{
-    char **env;
-
-    env = GET_ENVIRON(environ);
-    while (*env) {
-	char *s = strchr(*env, '=');
-	if (s) {
-	    rb_yield(rb_tainted_str_new2(s+1));
-	}
-	env++;
-    }
-    FREE_ENVIRON(environ);
-    return Qnil;
-}
-
-static VALUE
-env_each(hash)
-    VALUE hash;
-{
-    char **env;
-
-    env = GET_ENVIRON(environ);
-    while (*env) {
-	char *s = strchr(*env, '=');
-	if (s) {
-	    rb_yield(rb_assoc_new(rb_tainted_str_new(*env, s-*env),
-				  rb_tainted_str_new2(s+1)));
-	}
-	env++;
-    }
-    FREE_ENVIRON(environ);
-    return Qnil;
-}
-
-static VALUE
-env_reject_bang()
-{
-    volatile VALUE keys;
-    VALUE *ptr;
-    int len, del = 0;
-
-    rb_secure(4);
-    keys = env_keys();
-    ptr = RARRAY(keys)->ptr;
-    len = RARRAY(keys)->len; 
-
-    while (len--) {
-	VALUE val = rb_f_getenv(Qnil, *ptr);
-	if (!NIL_P(val)) {
-	    if (RTEST(rb_yield(rb_assoc_new(*ptr, val)))) {
-		env_delete(Qnil, *ptr);
-		del++;
-	    }
-	}
-	ptr++;
-    }
-    if (del == 0) return Qnil;
-    return envtbl;
-}
-
-static VALUE
-env_delete_if()
-{
-    env_reject_bang();
-    return envtbl;
-}
-
-static VALUE
-env_select(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE result = rb_ary_new();
-    long i;
-
-    if (rb_block_given_p()) {
-	char **env;
-
-	if (argc > 0) {
-	    rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc);
-	}
-	env = GET_ENVIRON(environ);
-	while (*env) {
-	    char *s = strchr(*env, '=');
-	    if (s) {
-                VALUE assoc = rb_assoc_new(rb_tainted_str_new(*env, s-*env),
-                                           rb_tainted_str_new2(s+1));
-		if (RTEST(rb_yield(assoc))) {
-		    rb_ary_push(result, assoc);
-		}
-	    }
-	    env++;
-	}
-	FREE_ENVIRON(environ);
-    }
-    else {
-	for (i=0; ilen)
-	rb_raise(rb_eArgError, "bad environment variable name");
-    if (getenv(s)) return Qtrue;
-    return Qfalse;
-}
-
-static VALUE
-env_has_value(dmy, value)
-    VALUE dmy, value;
-{
-    char **env;
-
-    if (TYPE(value) != T_STRING) return Qfalse;
-    env = GET_ENVIRON(environ);
-    while (*env) {
-	char *s = strchr(*env, '=')+1;
-	if (s) {
-	    if (strncmp(s, RSTRING(value)->ptr, strlen(s)) == 0) {
-		FREE_ENVIRON(environ);
-		return Qtrue;
-	    }
-	}
-	env++;
-    }
-    FREE_ENVIRON(environ);
-    return Qfalse;
-}
-
-static VALUE
-env_index(dmy, value)
-    VALUE dmy, value;
-{
-    char **env;
-    VALUE str;
-
-    if (TYPE(value) != T_STRING) return Qnil;
-    env = GET_ENVIRON(environ);
-    while (*env) {
-	char *s = strchr(*env, '=')+1;
-	if (s) {
-	    if (strncmp(s, RSTRING(value)->ptr, strlen(s)) == 0) {
-		str = rb_tainted_str_new(*env, s-*env-1);
-		FREE_ENVIRON(environ);
-		return str;
-	    }
-	}
-	env++;
-    }
-    FREE_ENVIRON(environ);
-    return Qnil;
-}
-
-static VALUE
-env_indexes(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    int i;
-    VALUE indexes = rb_ary_new2(argc);
-
-    rb_warn("ENV.%s is deprecated; use ENV.select",
-	    rb_id2name(rb_frame_last_func()));
-    for (i=0;iptr);
-	}
-	if (v) {
-	    RARRAY(indexes)->ptr[i] = rb_tainted_str_new2(v);
-	}
-	else {
-	    RARRAY(indexes)->ptr[i] = Qnil;
-	}
-	RARRAY(indexes)->len = i+1;
-    }
-
-    return indexes;
-}
-
-static VALUE
-env_to_hash()
-{
-    char **env;
-    VALUE hash = rb_hash_new();
-
-    env = GET_ENVIRON(environ);
-    while (*env) {
-	char *s = strchr(*env, '=');
-	if (s) {
-	    rb_hash_aset(hash, rb_tainted_str_new(*env, s-*env),
-			       rb_tainted_str_new2(s+1));
-	}
-	env++;
-    }
-    FREE_ENVIRON(environ);
-    return hash;
-}
-
-static VALUE
-env_reject()
-{
-    return rb_hash_delete_if(env_to_hash());
-}
-
-void
-Init_Hash()
-{
-    id_hash = rb_intern("hash");
-    id_yield = rb_intern("yield");
-    id_default = rb_intern("default");
-
-    rb_cHash = rb_define_class("Hash", rb_cObject);
-
-    rb_include_module(rb_cHash, rb_mEnumerable);
-
-    rb_define_singleton_method(rb_cHash, "allocate", rb_hash_s_alloc, 0);
-    rb_define_singleton_method(rb_cHash, "[]", rb_hash_s_create, -1);
-    rb_define_method(rb_cHash,"initialize", rb_hash_initialize, -1);
-
-    rb_define_method(rb_cHash,"clone", rb_hash_clone, 0);
-    rb_define_method(rb_cHash,"rehash", rb_hash_rehash, 0);
-
-    rb_define_method(rb_cHash,"to_hash", rb_hash_to_hash, 0);
-    rb_define_method(rb_cHash,"to_a", rb_hash_to_a, 0);
-    rb_define_method(rb_cHash,"to_s", rb_hash_to_s, 0);
-    rb_define_method(rb_cHash,"inspect", rb_hash_inspect, 0);
-
-    rb_define_method(rb_cHash,"==", rb_hash_equal, 1);
-    rb_define_method(rb_cHash,"[]", rb_hash_aref, 1);
-    rb_define_method(rb_cHash,"fetch", rb_hash_fetch, -1);
-    rb_define_method(rb_cHash,"[]=", rb_hash_aset, 2);
-    rb_define_method(rb_cHash,"store", rb_hash_aset, 2);
-    rb_define_method(rb_cHash,"default", rb_hash_default, -1);
-    rb_define_method(rb_cHash,"default=", rb_hash_set_default, 1);
-    rb_define_method(rb_cHash,"index", rb_hash_index, 1);
-    rb_define_method(rb_cHash,"indexes", rb_hash_indexes, -1);
-    rb_define_method(rb_cHash,"indices", rb_hash_indexes, -1);
-    rb_define_method(rb_cHash,"size", rb_hash_size, 0);
-    rb_define_method(rb_cHash,"length", rb_hash_size, 0);
-    rb_define_method(rb_cHash,"empty?", rb_hash_empty_p, 0);
-
-    rb_define_method(rb_cHash,"each", rb_hash_each_pair, 0);
-    rb_define_method(rb_cHash,"each_value", rb_hash_each_value, 0);
-    rb_define_method(rb_cHash,"each_key", rb_hash_each_key, 0);
-    rb_define_method(rb_cHash,"each_pair", rb_hash_each_pair, 0);
-    rb_define_method(rb_cHash,"sort", rb_hash_sort, 0);
-
-    rb_define_method(rb_cHash,"keys", rb_hash_keys, 0);
-    rb_define_method(rb_cHash,"values", rb_hash_values, 0);
-
-    rb_define_method(rb_cHash,"shift", rb_hash_shift, 0);
-    rb_define_method(rb_cHash,"delete", rb_hash_delete, 1);
-    rb_define_method(rb_cHash,"delete_if", rb_hash_delete_if, 0);
-    rb_define_method(rb_cHash,"select", rb_hash_select, -1);
-    rb_define_method(rb_cHash,"reject", rb_hash_reject, 0);
-    rb_define_method(rb_cHash,"reject!", rb_hash_reject_bang, 0);
-    rb_define_method(rb_cHash,"clear", rb_hash_clear, 0);
-    rb_define_method(rb_cHash,"invert", rb_hash_invert, 0);
-    rb_define_method(rb_cHash,"update", rb_hash_update, 1);
-    rb_define_method(rb_cHash,"replace", rb_hash_replace, 1);
-
-    rb_define_method(rb_cHash,"include?", rb_hash_has_key, 1);
-    rb_define_method(rb_cHash,"member?", rb_hash_has_key, 1);
-    rb_define_method(rb_cHash,"has_key?", rb_hash_has_key, 1);
-    rb_define_method(rb_cHash,"has_value?", rb_hash_has_value, 1);
-    rb_define_method(rb_cHash,"key?", rb_hash_has_key, 1);
-    rb_define_method(rb_cHash,"value?", rb_hash_has_value, 1);
-
-#ifndef __MACOS__ /* environment variables nothing on MacOS. */
-    origenviron = environ;
-    envtbl = rb_obj_alloc(rb_cObject);
-    rb_extend_object(envtbl, rb_mEnumerable);
-
-    rb_define_singleton_method(envtbl,"[]", rb_f_getenv, 1);
-    rb_define_singleton_method(envtbl,"fetch", env_fetch, -1);
-    rb_define_singleton_method(envtbl,"[]=", env_aset, 2);
-    rb_define_singleton_method(envtbl,"store", env_aset, 2);
-    rb_define_singleton_method(envtbl,"each", env_each, 0);
-    rb_define_singleton_method(envtbl,"each_pair", env_each, 0);
-    rb_define_singleton_method(envtbl,"each_key", env_each_key, 0);
-    rb_define_singleton_method(envtbl,"each_value", env_each_value, 0);
-    rb_define_singleton_method(envtbl,"delete", env_delete_m, 1);
-    rb_define_singleton_method(envtbl,"delete_if", env_delete_if, 0);
-    rb_define_singleton_method(envtbl,"reject", env_reject, 0);
-    rb_define_singleton_method(envtbl,"reject!", env_reject_bang, 0);
-    rb_define_singleton_method(envtbl,"select", env_select, -1);
-    rb_define_singleton_method(envtbl,"to_s", env_to_s, 0);
-    rb_define_singleton_method(envtbl,"inspect", env_inspect, 0);
-    rb_define_singleton_method(envtbl,"rehash", env_none, 0);
-    rb_define_singleton_method(envtbl,"to_a", env_to_a, 0);
-    rb_define_singleton_method(envtbl,"index", env_index, 1);
-    rb_define_singleton_method(envtbl,"indexes", env_indexes, -1);
-    rb_define_singleton_method(envtbl,"indices", env_indexes, -1);
-    rb_define_singleton_method(envtbl,"size", env_size, 0);
-    rb_define_singleton_method(envtbl,"length", env_size, 0);
-    rb_define_singleton_method(envtbl,"empty?", env_empty_p, 0);
-    rb_define_singleton_method(envtbl,"keys", env_keys, 0);
-    rb_define_singleton_method(envtbl,"values", env_values, 0);
-    rb_define_singleton_method(envtbl,"include?", env_has_key, 1);
-    rb_define_singleton_method(envtbl,"member?", env_has_key, 1);
-    rb_define_singleton_method(envtbl,"has_key?", env_has_key, 1);
-    rb_define_singleton_method(envtbl,"has_value?", env_has_value, 1);
-    rb_define_singleton_method(envtbl,"key?", env_has_key, 1);
-    rb_define_singleton_method(envtbl,"value?", env_has_value, 1);
-    rb_define_singleton_method(envtbl,"to_hash", env_to_hash, 0);
-
-    rb_define_global_const("ENV", envtbl);
-#else /* __MACOS__ */
-	envtbl = rb_hash_s_new(0, NULL, rb_cHash);
-    rb_define_global_const("ENV", envtbl);
-#endif  /* ifndef __MACOS__  environment variables nothing on MacOS. */
-}
diff --git a/inits.c b/inits.c
deleted file mode 100644
index dd7af5afb1..0000000000
--- a/inits.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/**********************************************************************
-
-  inits.c -
-
-  $Author$
-  $Date$
-  created at: Tue Dec 28 16:01:58 JST 1993
-
-  Copyright (C) 1993-2002 Yukihiro Matsumoto
-
-**********************************************************************/
-
-#include "ruby.h"
-
-void Init_Array _((void));
-void Init_Bignum _((void));
-void Init_Comparable _((void));
-void Init_Dir _((void));
-void Init_Enumerable _((void));
-void Init_Exception _((void));
-void Init_eval _((void));
-void Init_load _((void));
-void Init_Proc _((void));
-void Init_Thread _((void));
-void Init_File _((void));
-void Init_GC _((void));
-void Init_Hash _((void));
-void Init_IO _((void));
-void Init_Math _((void));
-void Init_marshal _((void));
-void Init_Numeric _((void));
-void Init_Object _((void));
-void Init_pack _((void));
-void Init_Precision _((void));
-void Init_sym _((void));
-void Init_process _((void));
-void Init_Random _((void));
-void Init_Range _((void));
-void Init_Regexp _((void));
-void Init_signal _((void));
-void Init_String _((void));
-void Init_Struct _((void));
-void Init_Time _((void));
-void Init_var_tables _((void));
-void Init_version _((void));
-
-void
-rb_call_inits()
-{
-    Init_sym();
-    Init_var_tables();
-    Init_Object();
-    Init_Comparable();
-    Init_Enumerable();
-    Init_Precision();
-    Init_eval();
-    Init_String();
-    Init_Exception();
-    Init_Thread();
-    Init_Numeric();
-    Init_Bignum();
-    Init_Array();
-    Init_Hash();
-    Init_Struct();
-    Init_Regexp();
-    Init_pack();
-    Init_Range();
-    Init_IO();
-    Init_Dir();
-    Init_Time();
-    Init_Random();
-    Init_signal();
-    Init_process();
-    Init_load();
-    Init_Proc();
-    Init_Math();
-    Init_GC();
-    Init_marshal();
-    Init_version();
-}
diff --git a/install-sh b/install-sh
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/instruby.rb b/instruby.rb
deleted file mode 100644
index a18e7f39a7..0000000000
--- a/instruby.rb
+++ /dev/null
@@ -1,102 +0,0 @@
-#!./miniruby
-
-load "./rbconfig.rb"
-include Config
-
-File.umask(0)
-destdir = ARGV[0] || ''
-
-$:.unshift CONFIG["srcdir"]+"/lib"
-require "ftools"
-require "find"
-
-exeext = CONFIG["EXEEXT"]
-if ENV["prefix"]
-  prefix = ENV["prefix"]
-else
-  prefix = CONFIG["prefix"]
-end
-
-ruby_install_name = CONFIG["ruby_install_name"]
-version = "/"+CONFIG["MAJOR"]+"."+CONFIG["MINOR"]
-arch = "/"+CONFIG["arch"]
-
-bindir = destdir+CONFIG["bindir"]
-libdir = destdir+CONFIG["libdir"]
-rubylibdir = destdir+CONFIG["prefix"]+"/lib/ruby"+version
-archlibdir = rubylibdir+arch
-sitelibdir = destdir+CONFIG["sitedir"]+version
-sitearchlibdir = sitelibdir+arch
-mandir = destdir+CONFIG["mandir"] + "/man1"
-wdir = Dir.getwd
-
-File.makedirs bindir, true
-File.install ruby_install_name+exeext,
-  "#{bindir}/#{ruby_install_name}#{exeext}", 0755, true
-rubyw = ruby_install_name.sub(/ruby/, '\&w')+exeext
-if File.exist? rubyw
-  File.install rubyw, "#{bindir}/#{rubyw}", 0755, true
-end
-for dll in Dir['*.dll']
-  File.install dll, "#{bindir}/#{dll}", 0755, true
-end
-File.makedirs libdir, true
-if CONFIG["LIBRUBY"] != CONFIG["LIBRUBY_A"]
-  for lib in [CONFIG["LIBRUBY"]]
-    if File.exist? lib
-      File.install lib, libdir, 0555, true
-    end
-  end
-end
-Dir.chdir libdir
-if File.exist? CONFIG["LIBRUBY_SO"]
-  for link in CONFIG["LIBRUBY_ALIASES"].split
-    if File.exist? link
-       File.delete link
-    end
-    File.symlink CONFIG["LIBRUBY_SO"], link
-    print "link #{CONFIG['LIBRUBY_SO']} -> #{link}\n"
-  end
-end
-Dir.chdir wdir
-File.makedirs rubylibdir, true
-File.makedirs archlibdir, true
-File.makedirs sitelibdir, true
-File.makedirs sitearchlibdir, true
-
-if RUBY_PLATFORM =~ /-aix/
-  File.install "ruby.imp", archlibdir, 0644, true
-end
-
-Dir.chdir "ext"
-if defined? CROSS_COMPILING
-  system "#{CONFIG['MINIRUBY']} extmk.rb install #{destdir}"
-else
-  system "../miniruby#{exeext} extmk.rb install #{destdir}"
-end
-Dir.chdir CONFIG["srcdir"]
-
-File.install "sample/irb.rb", "#{bindir}/irb", 0755, true
-
-Find.find("lib") do |f|
-  next unless /\.rb$/ =~ f || /help-message$/ =~ f
-  dir = rubylibdir+"/"+File.dirname(f[4..-1])
-  File.makedirs dir, true unless File.directory? dir
-  File.install f, dir, 0644, true
-end
-
-for f in Dir["*.h"]
-  File.install f, archlibdir, 0644, true
-end
-if RUBY_PLATFORM =~ /mswin32|mingw|bccwin32/
-  File.makedirs archlibdir + "/win32", true
-  File.install "win32/win32.h", archlibdir + "/win32", 0644, true
-end
-File.install wdir+'/'+CONFIG['LIBRUBY_A'], archlibdir, 0644, true
-
-File.makedirs mandir, true
-File.install "ruby.1", mandir+"/"+ruby_install_name+".1", 0644, true
-Dir.chdir wdir
-File.install "config.h", archlibdir, 0644, true
-File.install "rbconfig.rb", archlibdir, 0644, true
-# vi:set sw=2:
diff --git a/intern.h b/intern.h
deleted file mode 100644
index eef7235c70..0000000000
--- a/intern.h
+++ /dev/null
@@ -1,441 +0,0 @@
-/**********************************************************************
-
-  intern.h -
-
-  $Author$
-  $Date$
-  created at: Thu Jun 10 14:22:17 JST 1993
-
-  Copyright (C) 1993-2002 Yukihiro Matsumoto
-  Copyright (C) 2000  Network Applied Communication Laboratory, Inc.
-  Copyright (C) 2000  Information-technology Promotion Agency, Japan
-
-**********************************************************************/
-
-/* 
- * Functions and variables that are used by more than one source file of
- * the kernel.
- */
-
-/* array.c */
-void rb_mem_clear _((register VALUE*, register long));
-VALUE rb_assoc_new _((VALUE, VALUE));
-VALUE rb_ary_new _((void));
-VALUE rb_ary_new2 _((long));
-VALUE rb_ary_new3 __((long,...));
-VALUE rb_ary_new4 _((long, const VALUE *));
-VALUE rb_ary_freeze _((VALUE));
-VALUE rb_ary_aref _((int, VALUE*, VALUE));
-void rb_ary_store _((VALUE, long, VALUE));
-VALUE rb_ary_dup _((VALUE));
-VALUE rb_ary_to_ary _((VALUE));
-VALUE rb_ary_to_s _((VALUE));
-VALUE rb_ary_push _((VALUE, VALUE));
-VALUE rb_ary_pop _((VALUE));
-VALUE rb_ary_shift _((VALUE));
-VALUE rb_ary_unshift _((VALUE, VALUE));
-VALUE rb_ary_entry _((VALUE, long));
-VALUE rb_ary_each _((VALUE));
-VALUE rb_ary_join _((VALUE, VALUE));
-VALUE rb_ary_print_on _((VALUE, VALUE));
-VALUE rb_ary_reverse _((VALUE));
-VALUE rb_ary_sort _((VALUE));
-int rb_cmpint _((VALUE));
-VALUE rb_ary_sort_bang _((VALUE));
-VALUE rb_ary_delete _((VALUE, VALUE));
-VALUE rb_ary_delete_at _((VALUE, long));
-VALUE rb_ary_clear _((VALUE));
-VALUE rb_ary_plus _((VALUE, VALUE));
-VALUE rb_ary_concat _((VALUE, VALUE));
-VALUE rb_ary_assoc _((VALUE, VALUE));
-VALUE rb_ary_rassoc _((VALUE, VALUE));
-VALUE rb_ary_includes _((VALUE, VALUE));
-VALUE rb_ary_cmp _((VALUE, VALUE));
-VALUE rb_protect_inspect _((VALUE(*)(ANYARGS),VALUE,VALUE));
-VALUE rb_inspecting_p _((VALUE));
-/* bignum.c */
-VALUE rb_big_clone _((VALUE));
-void rb_big_2comp _((VALUE));
-VALUE rb_big_norm _((VALUE));
-VALUE rb_uint2big _((unsigned long));
-VALUE rb_int2big _((long));
-VALUE rb_uint2inum _((unsigned long));
-VALUE rb_int2inum _((long));
-VALUE rb_cstr_to_inum _((const char*, int, int));
-VALUE rb_str_to_inum _((VALUE, int, int));
-VALUE rb_cstr2inum _((const char*, int));
-VALUE rb_str2inum _((VALUE, int));
-VALUE rb_big2str _((VALUE, int));
-long rb_big2long _((VALUE));
-#define rb_big2int(x) rb_big2long(x)
-unsigned long rb_big2ulong _((VALUE));
-#define rb_big2uint(x) rb_big2ulong(x)
-#if HAVE_LONG_LONG
-VALUE rb_ll2inum _((LONG_LONG));
-VALUE rb_ull2inum _((unsigned LONG_LONG));
-LONG_LONG rb_big2ll _((VALUE));
-unsigned LONG_LONG rb_big2ull _((VALUE));
-#endif  /* HAVE_LONG_LONG */
-void rb_quad_pack _((char*,VALUE));
-VALUE rb_quad_unpack _((const char*,int));
-VALUE rb_dbl2big _((double));
-double rb_big2dbl _((VALUE));
-VALUE rb_big_plus _((VALUE, VALUE));
-VALUE rb_big_minus _((VALUE, VALUE));
-VALUE rb_big_mul _((VALUE, VALUE));
-VALUE rb_big_divmod _((VALUE, VALUE));
-VALUE rb_big_pow _((VALUE, VALUE));
-VALUE rb_big_and _((VALUE, VALUE));
-VALUE rb_big_or _((VALUE, VALUE));
-VALUE rb_big_xor _((VALUE, VALUE));
-VALUE rb_big_lshift _((VALUE, VALUE));
-VALUE rb_big_rand _((VALUE, double));
-/* class.c */
-VALUE rb_class_boot _((VALUE));
-VALUE rb_class_new _((VALUE));
-VALUE rb_mod_clone _((VALUE));
-VALUE rb_mod_dup _((VALUE));
-VALUE rb_singleton_class_new _((VALUE));
-VALUE rb_singleton_class_clone _((VALUE));
-void rb_singleton_class_attached _((VALUE,VALUE));
-VALUE rb_make_metaclass _((VALUE, VALUE));
-VALUE rb_class_inherited _((VALUE, VALUE));
-VALUE rb_define_class_id _((ID, VALUE));
-VALUE rb_module_new _((void));
-VALUE rb_define_module_id _((ID));
-VALUE rb_mod_included_modules _((VALUE));
-VALUE rb_mod_include_p _((VALUE, VALUE));
-VALUE rb_mod_ancestors _((VALUE));
-VALUE rb_class_instance_methods _((int, VALUE*, VALUE));
-VALUE rb_class_protected_instance_methods _((int, VALUE*, VALUE));
-VALUE rb_class_private_instance_methods _((int, VALUE*, VALUE));
-VALUE rb_obj_singleton_methods _((int, VALUE*, VALUE));
-void rb_define_method_id _((VALUE, ID, VALUE (*)(ANYARGS), int));
-void rb_frozen_class_p _((VALUE));
-void rb_undef _((VALUE, ID));
-void rb_define_protected_method _((VALUE, const char*, VALUE (*)(ANYARGS), int));
-void rb_define_private_method _((VALUE, const char*, VALUE (*)(ANYARGS), int));
-void rb_define_singleton_method _((VALUE, const char*, VALUE(*)(ANYARGS), int));
-void rb_define_private_method _((VALUE, const char*, VALUE(*)(ANYARGS), int));
-VALUE rb_singleton_class _((VALUE));
-/* enum.c */
-/* error.c */
-EXTERN int ruby_nerrs;
-VALUE rb_exc_new _((VALUE, const char*, long));
-VALUE rb_exc_new2 _((VALUE, const char*));
-VALUE rb_exc_new3 _((VALUE, VALUE));
-NORETURN(void rb_loaderror __((const char*, ...)));
-NORETURN(void rb_name_error __((VALUE id, const char*, ...)));
-NORETURN(void rb_invalid_str _((const char*, const char*)));
-void rb_compile_error __((const char*, ...));
-void rb_compile_error_append __((const char*, ...));
-NORETURN(void rb_load_fail _((char*)));
-NORETURN(void rb_error_frozen _((char*)));
-/* eval.c */
-NORETURN(void rb_exc_raise _((VALUE)));
-NORETURN(void rb_exc_fatal _((VALUE)));
-void rb_remove_method _((VALUE, const char*));
-void rb_disable_super _((VALUE, const char*));
-void rb_enable_super _((VALUE, const char*));
-void rb_clear_cache _((void));
-void rb_alias _((VALUE, ID, ID));
-void rb_attr _((VALUE,ID,int,int,int));
-int rb_method_boundp _((VALUE, ID, int));
-VALUE rb_dvar_defined _((ID));
-VALUE rb_dvar_curr _((ID));
-VALUE rb_dvar_ref _((ID));
-void rb_dvar_asgn _((ID, VALUE));
-void rb_dvar_push _((ID, VALUE));
-VALUE *rb_svar _((int));
-VALUE rb_eval_cmd _((VALUE, VALUE, int));
-int rb_respond_to _((VALUE, ID));
-void rb_interrupt _((void));
-VALUE rb_apply _((VALUE, ID, VALUE));
-void rb_backtrace _((void));
-ID rb_frame_last_func _((void));
-VALUE rb_obj_instance_eval _((int, VALUE*, VALUE));
-VALUE rb_mod_module_eval _((int, VALUE*, VALUE));
-void rb_load _((VALUE, int));
-void rb_load_protect _((VALUE, int, int*));
-NORETURN(void rb_jump_tag _((int)));
-int rb_provided _((const char*));
-void rb_provide _((const char*));
-VALUE rb_f_require _((VALUE, VALUE));
-void rb_obj_call_init _((VALUE, int, VALUE*));
-VALUE rb_class_new_instance _((int, VALUE*, VALUE));
-VALUE rb_f_lambda _((void));
-VALUE rb_proc_new _((VALUE (*)(ANYARGS/* VALUE yieldarg[, VALUE procarg] */), VALUE));
-VALUE rb_protect _((VALUE (*)(VALUE), VALUE, int*));
-void rb_set_end_proc _((void (*)(VALUE), VALUE));
-void rb_mark_end_proc _((void));
-void rb_exec_end_proc _((void));
-void ruby_finalize _((void));
-void ruby_stop _((int));
-void rb_gc_mark_threads _((void));
-void rb_thread_start_timer _((void));
-void rb_thread_stop_timer _((void));
-void rb_thread_schedule _((void));
-void rb_thread_wait_fd _((int));
-int rb_thread_fd_writable _((int));
-void rb_thread_fd_close _((int));
-int rb_thread_alone _((void));
-void rb_thread_polling _((void));
-void rb_thread_sleep _((int));
-void rb_thread_sleep_forever _((void));
-VALUE rb_thread_stop _((void));
-VALUE rb_thread_wakeup _((VALUE));
-VALUE rb_thread_run _((VALUE));
-VALUE rb_thread_create _((VALUE (*)(ANYARGS), void*));
-void rb_thread_interrupt _((void));
-void rb_thread_trap_eval _((VALUE, int));
-void rb_thread_signal_raise _((char*));
-int rb_thread_select(ANYARGS);
-void rb_thread_wait_for(ANYARGS);
-VALUE rb_thread_current _((void));
-VALUE rb_thread_main _((void));
-VALUE rb_thread_local_aref _((VALUE, ID));
-VALUE rb_thread_local_aset _((VALUE, ID, VALUE));
-void rb_thread_atfork _((void));
-/* file.c */
-int eaccess _((const char*, int));
-VALUE rb_file_s_expand_path _((int, VALUE *));
-void rb_file_const _((const char*, VALUE));
-int rb_find_file_ext _((VALUE*, const char* const*));
-VALUE rb_find_file _((VALUE));
-/* gc.c */
-NORETURN(void rb_memerror __((void)));
-int ruby_stack_check _((void));
-int ruby_stack_length _((VALUE**));
-char *rb_source_filename _((const char*));
-void rb_gc_mark_locations _((VALUE*, VALUE*));
-void rb_mark_tbl _((struct st_table*));
-void rb_mark_hash _((struct st_table*));
-void rb_gc_mark_maybe _((VALUE));
-void rb_gc_mark _((VALUE));
-void rb_gc_force_recycle _((VALUE));
-void rb_gc _((void));
-void rb_gc_call_finalizer_at_exit _((void));
-VALUE rb_gc_enable _((void));
-VALUE rb_gc_disable _((void));
-VALUE rb_gc_start _((void));
-/* hash.c */
-VALUE rb_hash _((VALUE));
-VALUE rb_hash_new _((void));
-VALUE rb_hash_freeze _((VALUE));
-VALUE rb_hash_aref _((VALUE, VALUE));
-VALUE rb_hash_aset _((VALUE, VALUE, VALUE));
-VALUE rb_hash_delete_if _((VALUE));
-VALUE rb_hash_delete _((VALUE,VALUE));
-int rb_path_check _((char*));
-int rb_env_path_tainted _((void));
-/* io.c */
-EXTERN VALUE rb_fs;
-EXTERN VALUE rb_output_fs;
-EXTERN VALUE rb_rs;
-EXTERN VALUE rb_default_rs;
-EXTERN VALUE rb_output_rs;
-VALUE rb_io_write _((VALUE, VALUE));
-VALUE rb_io_gets _((VALUE));
-VALUE rb_io_getc _((VALUE));
-VALUE rb_io_ungetc _((VALUE, VALUE));
-VALUE rb_io_close _((VALUE));
-VALUE rb_io_eof _((VALUE));
-VALUE rb_io_binmode _((VALUE));
-VALUE rb_io_addstr _((VALUE, VALUE));
-VALUE rb_io_printf _((int, VALUE*, VALUE));
-VALUE rb_io_print _((int, VALUE*, VALUE));
-VALUE rb_io_puts _((int, VALUE*, VALUE));
-VALUE rb_file_open _((const char*, const char*));
-VALUE rb_gets _((void));
-/* marshal.c */
-VALUE rb_marshal_dump _((VALUE, VALUE));
-VALUE rb_marshal_load _((VALUE));
-/* numeric.c */
-void rb_num_zerodiv _((void));
-VALUE rb_num_coerce_bin _((VALUE, VALUE));
-VALUE rb_float_new _((double));
-VALUE rb_num2fix _((VALUE));
-VALUE rb_fix2str _((VALUE, int));
-/* object.c */
-int rb_eql _((VALUE, VALUE));
-VALUE rb_any_to_s _((VALUE));
-VALUE rb_inspect _((VALUE));
-VALUE rb_obj_is_instance_of _((VALUE, VALUE));
-VALUE rb_obj_is_kind_of _((VALUE, VALUE));
-VALUE rb_obj_alloc _((VALUE));
-VALUE rb_obj_clone _((VALUE));
-VALUE rb_obj_dup _((VALUE));
-VALUE rb_obj_taint _((VALUE));
-VALUE rb_obj_tainted _((VALUE));
-VALUE rb_obj_untaint _((VALUE));
-VALUE rb_obj_freeze _((VALUE));
-VALUE rb_obj_id _((VALUE));
-VALUE rb_obj_class _((VALUE));
-VALUE rb_class_real _((VALUE));
-VALUE rb_convert_type _((VALUE,int,const char*,const char*));
-VALUE rb_check_convert_type _((VALUE,int,const char*,const char*));
-VALUE rb_to_int _((VALUE));
-VALUE rb_Integer _((VALUE));
-VALUE rb_Float _((VALUE));
-VALUE rb_String _((VALUE));
-VALUE rb_Array _((VALUE));
-double rb_cstr_to_dbl _((const char*, int));
-double rb_str_to_dbl _((VALUE, int));
-/* parse.y */
-EXTERN int   ruby_sourceline;
-EXTERN char *ruby_sourcefile;
-int yyparse _((void));
-ID rb_id_attrset _((ID));
-void rb_parser_append_print _((void));
-void rb_parser_while_loop _((int, int));
-int rb_is_const_id _((ID));
-int rb_is_instance_id _((ID));
-int rb_is_class_id _((ID));
-int rb_is_local_id _((ID));
-VALUE rb_backref_get _((void));
-void rb_backref_set _((VALUE));
-VALUE rb_lastline_get _((void));
-void rb_lastline_set _((VALUE));
-VALUE rb_sym_all_symbols _((void));
-/* process.c */
-int rb_proc_exec _((const char*));
-VALUE rb_f_exec _((int,VALUE*));
-int rb_waitpid _((int,int*,int));
-void rb_syswait _((int));
-VALUE rb_proc_times _((VALUE));
-/* range.c */
-VALUE rb_range_new _((VALUE, VALUE, int));
-VALUE rb_range_beg_len _((VALUE, long*, long*, long, int));
-VALUE rb_length_by_each _((VALUE));
-/* re.c */
-int rb_memcmp _((char*,char*,long));
-int rb_memcicmp _((char*,char*,long));
-VALUE rb_reg_nth_defined _((int, VALUE));
-VALUE rb_reg_nth_match _((int, VALUE));
-VALUE rb_reg_last_match _((VALUE));
-VALUE rb_reg_match_pre _((VALUE));
-VALUE rb_reg_match_post _((VALUE));
-VALUE rb_reg_match_last _((VALUE));
-VALUE rb_reg_new _((const char*, long, int));
-VALUE rb_reg_match _((VALUE, VALUE));
-VALUE rb_reg_match2 _((VALUE));
-int rb_reg_options _((VALUE));
-void rb_set_kcode _((const char*));
-const char* rb_get_kcode _((void));
-/* ruby.c */
-EXTERN VALUE rb_argv;
-EXTERN VALUE rb_argv0;
-void rb_load_file _((char*));
-void ruby_script _((char*));
-void ruby_prog_init _((void));
-void ruby_set_argv _((int, char**));
-void ruby_process_options _((int, char**));
-void ruby_load_script _((void));
-void ruby_init_loadpath _((void));
-void ruby_incpush _((const char*));
-/* signal.c */
-VALUE rb_f_kill _((int, VALUE*));
-void rb_gc_mark_trap_list _((void));
-#ifdef POSIX_SIGNAL
-#define posix_signal ruby_posix_signal
-void posix_signal _((int, RETSIGTYPE (*)(int)));
-#endif
-void rb_trap_exit _((void));
-void rb_trap_exec _((void));
-/* sprintf.c */
-VALUE rb_f_sprintf _((int, VALUE*));
-/* string.c */
-VALUE rb_str_new _((const char*, long));
-VALUE rb_str_new2 _((const char*));
-VALUE rb_str_new3 _((VALUE));
-VALUE rb_str_new4 _((VALUE));
-VALUE rb_str_new5 _((VALUE, const char*, long));
-VALUE rb_tainted_str_new _((const char*, long));
-VALUE rb_tainted_str_new2 _((const char*));
-VALUE rb_str_buf_new _((long));
-VALUE rb_str_buf_new2 _((const char*));
-VALUE rb_str_buf_append _((VALUE, VALUE));
-VALUE rb_str_buf_cat _((VALUE, const char*, long));
-VALUE rb_str_buf_cat2 _((VALUE, const char*));
-VALUE rb_obj_as_string _((VALUE));
-VALUE rb_str_dup _((VALUE));
-VALUE rb_str_dup_frozen _((VALUE));
-VALUE rb_str_plus _((VALUE, VALUE));
-VALUE rb_str_times _((VALUE, VALUE));
-VALUE rb_str_substr _((VALUE, long, long));
-void rb_str_modify _((VALUE));
-VALUE rb_str_freeze _((VALUE));
-VALUE rb_str_resize _((VALUE, long));
-VALUE rb_str_cat _((VALUE, const char*, long));
-VALUE rb_str_cat2 _((VALUE, const char*));
-VALUE rb_str_append _((VALUE, VALUE));
-VALUE rb_str_concat _((VALUE, VALUE));
-int rb_str_hash _((VALUE));
-int rb_str_cmp _((VALUE, VALUE));
-VALUE rb_str_upto _((VALUE, VALUE, int));
-void rb_str_update _((VALUE, long, long, VALUE));
-VALUE rb_str_inspect _((VALUE));
-VALUE rb_str_split _((VALUE, const char*));
-void rb_str_associate _((VALUE, VALUE));
-VALUE rb_str_associated _((VALUE));
-void rb_str_setter _((VALUE, ID, VALUE*));
-/* struct.c */
-VALUE rb_struct_new __((VALUE, ...));
-VALUE rb_struct_define __((const char*, ...));
-VALUE rb_struct_alloc _((VALUE, VALUE));
-VALUE rb_struct_aref _((VALUE, VALUE));
-VALUE rb_struct_aset _((VALUE, VALUE, VALUE));
-VALUE rb_struct_getmember _((VALUE, ID));
-VALUE rb_struct_iv_get _((VALUE, char*));
-/* time.c */
-VALUE rb_time_new(ANYARGS);
-/* variable.c */
-VALUE rb_mod_name _((VALUE));
-VALUE rb_class_path _((VALUE));
-void rb_set_class_path _((VALUE, VALUE, const char*));
-VALUE rb_path2class _((const char*));
-void rb_name_class _((VALUE, ID));
-void rb_autoload _((const char*, const char*));
-VALUE rb_f_autoload _((VALUE, VALUE, VALUE));
-void rb_gc_mark_global_tbl _((void));
-VALUE rb_f_trace_var _((int, VALUE*));
-VALUE rb_f_untrace_var _((int, VALUE*));
-VALUE rb_f_global_variables _((void));
-void rb_alias_variable _((ID, ID));
-struct st_table* rb_generic_ivar_table _((VALUE));
-void rb_copy_generic_ivar _((VALUE,VALUE));
-void rb_mark_generic_ivar _((VALUE));
-void rb_mark_generic_ivar_tbl _((void));
-void rb_free_generic_ivar _((VALUE));
-VALUE rb_ivar_get _((VALUE, ID));
-VALUE rb_ivar_set _((VALUE, ID, VALUE));
-VALUE rb_ivar_defined _((VALUE, ID));
-VALUE rb_iv_set _((VALUE, const char*, VALUE));
-VALUE rb_iv_get _((VALUE, const char*));
-VALUE rb_obj_instance_variables _((VALUE));
-VALUE rb_obj_remove_instance_variable _((VALUE, VALUE));
-void *rb_mod_const_at _((VALUE, void*));
-void *rb_mod_const_of _((VALUE, void*));
-VALUE rb_const_list _((void*));
-VALUE rb_mod_constants _((VALUE));
-VALUE rb_mod_remove_const _((VALUE, VALUE));
-int rb_const_defined_at _((VALUE, ID));
-int rb_autoload_defined _((ID));
-int rb_const_defined _((VALUE, ID));
-VALUE rb_const_get _((VALUE, ID));
-VALUE rb_const_get_at _((VALUE, ID));
-void rb_const_set _((VALUE, ID, VALUE));
-void rb_const_assign _((VALUE, ID, VALUE));
-VALUE rb_mod_constants _((VALUE));
-void rb_autoload_load _((ID));
-VALUE rb_cvar_defined _((VALUE, ID));
-void rb_cvar_set _((VALUE, ID, VALUE, int));
-VALUE rb_cvar_get _((VALUE, ID));
-void rb_cv_set _((VALUE, const char*, VALUE));
-VALUE rb_cv_get _((VALUE, const char*));
-void rb_define_class_variable _((VALUE, const char*, VALUE));
-VALUE rb_mod_class_variables _((VALUE));
-VALUE rb_mod_remove_cvar _((VALUE, VALUE));
-/* version.c */
-void ruby_show_version _((void));
-void ruby_show_copyright _((void));
diff --git a/io.c b/io.c
deleted file mode 100644
index 591ac8d105..0000000000
--- a/io.c
+++ /dev/null
@@ -1,3948 +0,0 @@
-/**********************************************************************
-
-  io.c -
-
-  $Author$
-  $Date$
-  created at: Fri Oct 15 18:08:59 JST 1993
-
-  Copyright (C) 1993-2002 Yukihiro Matsumoto
-  Copyright (C) 2000  Network Applied Communication Laboratory, Inc.
-  Copyright (C) 2000  Information-technology Promotion Agency, Japan
-
-**********************************************************************/
-
-#if defined(__VMS)
-#define _XOPEN_SOURCE
-#define _POSIX_C_SOURCE 2
-#endif
-
-#include "ruby.h"
-#include "rubyio.h"
-#include "rubysig.h"
-#include "env.h"
-#include 
-#include 
-
-#if defined(MSDOS) || defined(__BOW__) || defined(__CYGWIN__) || defined(NT) || defined(__human68k__) || defined(__EMX__) || defined(__BEOS__)
-# define NO_SAFE_RENAME
-#endif
-
-#if defined(MSDOS) || defined(__CYGWIN__) || defined(NT)
-# define NO_LONG_FNAME
-#endif
-
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(sun) || defined(_nec_ews)
-# define USE_SETVBUF
-#endif
-
-#ifdef __QNXNTO__
-#include "unix.h"
-#endif
-
-#include 
-#if !defined(DJGPP) && !defined(NT) && !defined(__human68k__)
-#include 
-#endif
-#if defined(HAVE_FCNTL_H) || defined(NT)
-#include 
-#elif defined(HAVE_SYS_FCNTL_H)
-#include 
-#endif
-
-#if !HAVE_OFF_T && !defined(off_t)
-# define off_t  long
-#endif
-#if !HAVE_FSEEKO && !defined(fseeko)
-# define fseeko  fseek
-#endif
-#if !HAVE_FTELLO && !defined(ftello)
-# define ftello  ftell
-#endif
-
-#ifdef HAVE_SYS_TIME_H
-# include 
-#else
-#ifndef NT
-struct timeval {
-        long    tv_sec;         /* seconds */
-        long    tv_usec;        /* and microseconds */
-};
-#endif
-#endif
-
-#include 
-
-/* EMX has sys/param.h, but.. */
-#if defined(HAVE_SYS_PARAM_H) && !(defined(__EMX__) || defined(__HIUX_MPP__))
-# include 
-#else
-# define NOFILE 64
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include 
-#endif
-
-extern void Init_File _((void));
-
-#ifdef __BEOS__
-# ifndef NOFILE
-#  define NOFILE (OPEN_MAX)
-# endif
-#include 
-#endif
-
-#include "util.h"
-
-#if SIZEOF_OFF_T > SIZEOF_LONG && !defined(HAVE_LONG_LONG)
-# error off_t is bigger than long, but you have no long long...
-#endif
-
-VALUE rb_cIO;
-VALUE rb_eEOFError;
-VALUE rb_eIOError;
-
-VALUE rb_stdin, rb_stdout, rb_stderr, rb_defout;
-static VALUE orig_stdin, orig_stdout, orig_stderr;
-static int saved_fd[3] = {0, 1, 2};
-
-VALUE rb_output_fs;
-VALUE rb_rs;
-VALUE rb_output_rs;
-VALUE rb_default_rs;
-
-static VALUE argf;
-
-static ID id_write;
-
-extern char *ruby_inplace_mode;
-
-struct timeval rb_time_interval _((VALUE));
-
-static VALUE filename, current_file;
-static int gets_lineno;
-static int init_p = 0, next_p = 0, first_p = 1;
-static VALUE lineno;
-
-#ifdef _STDIO_USES_IOSTREAM  /* GNU libc */
-#  ifdef _IO_fpos_t
-#    define READ_DATA_PENDING(fp) ((fp)->_IO_read_ptr != (fp)->_IO_read_end)
-#    define READ_DATA_PENDING_COUNT(fp) ((fp)->_IO_read_end - (fp)->_IO_read_ptr)
-#    define READ_DATA_PENDING_PTR(fp) ((fp)->_IO_read_ptr)
-#  else
-#    define READ_DATA_PENDING(fp) ((fp)->_gptr < (fp)->_egptr)
-#    define READ_DATA_PENDING_COUNT(fp) ((fp)->_egptr - (fp)->_gptr)
-#    define READ_DATA_PENDING_PTR(fp) ((fp)->_gptr)
-#  endif
-#elif defined(FILE_COUNT)
-#  define READ_DATA_PENDING(fp) ((fp)->FILE_COUNT > 0)
-#  define READ_DATA_PENDING_COUNT(fp) ((fp)->FILE_COUNT)
-#elif defined(FILE_READEND)
-#  define READ_DATA_PENDING(fp) ((fp)->FILE_READPTR < (fp)->FILE_READEND)
-#  define READ_DATA_PENDING_COUNT(fp) ((fp)->FILE_READEND - (fp)->FILE_READPTR)
-#elif defined(__BEOS__)
-#  define READ_DATA_PENDING(fp) (fp->_state._eof == 0)
-#elif defined(__VMS)
-#  define READ_DATA_PENDING(fp) (((unsigned int)((*(fp))->_flag) & _IOEOF) == 0)
-#else
-/* requires systems own version of the ReadDataPending() */
-extern int ReadDataPending();
-#  define READ_DATA_PENDING(fp) (!feof(fp))
-#endif
-#ifndef READ_DATA_PENDING_PTR
-# ifdef FILE_READPTR
-#  define READ_DATA_PENDING_PTR(fp) ((fp)->FILE_READPTR)
-# endif
-#endif
-
-#define READ_CHECK(fp) do {\
-    if (!READ_DATA_PENDING(fp)) {\
-	rb_thread_wait_fd(fileno(fp));\
-        rb_io_check_closed(fptr);\
-     }\
-} while(0)
-
-void
-rb_eof_error()
-{
-    rb_raise(rb_eEOFError, "End of file reached");
-}
-
-VALUE
-rb_io_taint_check(io)
-    VALUE io;
-{
-    if (!OBJ_TAINTED(io) && rb_safe_level() >= 4)
-	rb_raise(rb_eSecurityError, "Insecure: operation on untainted IO");
-    return io;
-}
-
-void
-rb_io_check_closed(fptr)
-    OpenFile *fptr;
-{
-    if (!fptr) {
-	rb_raise(rb_eIOError, "uninitialized stream");
-    }
-    if (!fptr->f && !fptr->f2) {
-	rb_raise(rb_eIOError, "closed stream");
-    }
-}
-
-void
-rb_io_check_readable(fptr)
-    OpenFile *fptr;
-{
-    if (!(fptr->mode & FMODE_READABLE)) {
-	rb_raise(rb_eIOError, "not opened for reading");
-    }
-}
-
-void
-rb_io_check_writable(fptr)
-    OpenFile *fptr;
-{
-    if (!(fptr->mode & FMODE_WRITABLE)) {
-	rb_raise(rb_eIOError, "not opened for writing");
-    }
-}
-
-int
-rb_read_pending(fp)
-    FILE *fp;
-{
-    return READ_DATA_PENDING(fp);
-}
-
-void
-rb_read_check(fp)
-    FILE *fp;
-{
-    if (!READ_DATA_PENDING(fp)) {
-	rb_thread_wait_fd(fileno(fp));
-    }
-}
-
-static int
-ruby_dup(orig)
-    int orig;
-{
-    int fd;
-
-    fd = dup(orig);
-    if (fd < 0) {
-	if (errno == EMFILE || errno == ENFILE) {
-	    rb_gc();
-	    fd = dup(orig);
-	}
-	if (fd < 0) {
-	    rb_sys_fail(0);
-	}
-    }
-    return fd;
-}
-
-static void
-io_fflush(f, fptr)
-    FILE *f;
-    OpenFile *fptr;
-{
-    int n;
-
-    rb_thread_fd_writable(fileno(f));
-    TRAP_BEG;
-    n = fflush(f);
-    TRAP_END;
-    if (n == EOF) rb_sys_fail(fptr->path);
-    fptr->mode &= ~FMODE_WBUF;
-}
-
-/* writing functions */
-static VALUE
-io_write(io, str)
-    VALUE io, str;
-{
-    OpenFile *fptr;
-    FILE *f;
-    long n;
-
-    rb_secure(4);
-    if (TYPE(str) != T_STRING)
-	str = rb_obj_as_string(str);
-    if (RSTRING(str)->len == 0) return INT2FIX(0);
-
-    if (TYPE(io) != T_FILE) {
-	/* port is not IO, call write method for it. */
-	return rb_funcall(io, id_write, 1, str);
-    }
-
-    GetOpenFile(io, fptr);
-    rb_io_check_writable(fptr);
-    f = GetWriteFile(fptr);
-
-#ifdef __human68k__
-    {
-	register char *ptr = RSTRING(str)->ptr;
-	n = RSTRING(str)->len;
-	while (--n >= 0)
-	    if (fputc(*ptr++, f) == EOF)
-		break;
-	n = ptr - RSTRING(str)->ptr;
-    }
-    if (n != RSTRING(str)->len && ferror(f))
-	rb_sys_fail(fptr->path);
-#else
-    n = fwrite(RSTRING(str)->ptr, 1, RSTRING(str)->len, f);
-    if (n != RSTRING(str)->len && ferror(f)) {
-	rb_sys_fail(fptr->path);
-    }
-#endif
-    if (fptr->mode & FMODE_SYNC) {
-	io_fflush(f, fptr);
-    }
-    else {
-	fptr->mode |= FMODE_WBUF;
-    }
-
-    return LONG2FIX(n);
-}
-
-VALUE
-rb_io_write(io, str)
-    VALUE io, str;
-{
-    return rb_funcall(io, id_write, 1, str);
-}
-
-VALUE
-rb_io_addstr(io, str)
-    VALUE io, str;
-{
-    rb_io_write(io, str);
-    return io;
-}
-
-static VALUE
-rb_io_flush(io)
-    VALUE io;
-{
-    OpenFile *fptr;
-    FILE *f;
-
-    GetOpenFile(io, fptr);
-    rb_io_check_writable(fptr);
-    f = GetWriteFile(fptr);
-
-    io_fflush(f, fptr);
-
-    return io;
-}
-
-static VALUE
-rb_io_tell(io)
-     VALUE io;
-{
-    OpenFile *fptr;
-    off_t pos;
-
-    GetOpenFile(io, fptr);
-    pos = ftello(fptr->f);
-    if (ferror(fptr->f)) rb_sys_fail(fptr->path);
-    return OFFT2NUM(pos);
-}
-
-#ifndef SEEK_CUR
-# define SEEK_SET 0
-# define SEEK_CUR 1
-# define SEEK_END 2
-#endif
-
-static VALUE
-rb_io_seek(io, offset, whence)
-    VALUE io, offset;
-    int whence;
-{
-    OpenFile *fptr;
-    off_t pos;
-
-    GetOpenFile(io, fptr);
-    pos = fseeko(fptr->f, NUM2OFFT(offset), whence);
-    if (pos != 0) rb_sys_fail(fptr->path);
-    clearerr(fptr->f);
-
-    return INT2FIX(0);
-}
-
-static VALUE
-rb_io_seek_m(argc, argv, io)
-    int argc;
-    VALUE *argv;
-    VALUE io;
-{
-    VALUE offset, ptrname;
-    int whence = SEEK_SET;
-
-    if (rb_scan_args(argc, argv, "11", &offset, &ptrname) == 2) {
-	whence = NUM2INT(ptrname);
-    }
-
-    return rb_io_seek(io, offset, whence);
-}
-
-static VALUE
-rb_io_set_pos(io, offset)
-     VALUE io, offset;
-{
-    OpenFile *fptr;
-    off_t pos;
-
-    GetOpenFile(io, fptr);
-    pos = fseeko(fptr->f, NUM2OFFT(offset), SEEK_SET);
-    if (pos != 0) rb_sys_fail(fptr->path);
-    clearerr(fptr->f);
-
-    return OFFT2NUM(pos);
-}
-
-static VALUE
-rb_io_rewind(io)
-    VALUE io;
-{
-    OpenFile *fptr;
-
-    GetOpenFile(io, fptr);
-    if (fseeko(fptr->f, 0L, 0) != 0) rb_sys_fail(fptr->path);
-    clearerr(fptr->f);
-    if (io == current_file) {
-	gets_lineno -= fptr->lineno;
-    }
-    fptr->lineno = 0;
-
-    return INT2FIX(0);
-}
-
-VALUE
-rb_io_eof(io)
-    VALUE io;
-{
-    OpenFile *fptr;
-    int ch;
-
-    GetOpenFile(io, fptr);
-    rb_io_check_readable(fptr);
-
-    if (feof(fptr->f)) return Qtrue;
-    if (READ_DATA_PENDING(fptr->f)) return Qfalse;
-    READ_CHECK(fptr->f);
-    TRAP_BEG;
-    ch = getc(fptr->f);
-    TRAP_END;
-
-    if (ch != EOF) {
-	ungetc(ch, fptr->f);
-	return Qfalse;
-    }
-    return Qtrue;
-}
-
-static VALUE
-rb_io_sync(io)
-    VALUE io;
-{
-    OpenFile *fptr;
-
-    GetOpenFile(io, fptr);
-    return (fptr->mode & FMODE_SYNC) ? Qtrue : Qfalse;
-}
-
-static VALUE
-rb_io_set_sync(io, mode)
-    VALUE io, mode;
-{
-    OpenFile *fptr;
-
-    GetOpenFile(io, fptr);
-    if (RTEST(mode)) {
-	fptr->mode |= FMODE_SYNC;
-    }
-    else {
-	fptr->mode &= ~FMODE_SYNC;
-    }
-    return mode;
-}
-
-static VALUE
-rb_io_fsync(io)
-    VALUE io;
-{
-#ifdef HAVE_FSYNC
-    OpenFile *fptr;
-    FILE *f;
-
-    GetOpenFile(io, fptr);
-    rb_io_check_writable(fptr);
-    f = GetWriteFile(fptr);
-
-    io_fflush(f, fptr);
-    if (fsync(fileno(f)) < 0)
-	rb_sys_fail(fptr->path);
-    return INT2FIX(0);
-#else
-    rb_notimplement();
-    return Qnil;		/* not reached */
-#endif
-}
-
-static VALUE
-rb_io_fileno(io)
-    VALUE io;
-{
-    OpenFile *fptr;
-    int fd;
-
-    GetOpenFile(io, fptr);
-    fd = fileno(fptr->f);
-    return INT2FIX(fd);
-}
-
-static VALUE
-rb_io_pid(io)
-    VALUE io;
-{
-    OpenFile *fptr;
-
-    GetOpenFile(io, fptr);
-    if (!fptr->pid)
-	return Qnil;
-    return INT2FIX(fptr->pid);
-}
-
-static VALUE
-rb_io_inspect(obj)
-    VALUE obj;
-{
-    OpenFile *fptr;
-    char *buf, *cname;
-
-    GetOpenFile(obj, fptr);
-    if (!fptr->path) return rb_any_to_s(obj);
-    cname = rb_class2name(CLASS_OF(obj));
-    buf = ALLOCA_N(char, strlen(cname) + strlen(fptr->path) + 5);
-    sprintf(buf, "#<%s:%s>", cname, fptr->path);
-    return rb_str_new2(buf);
-}
-
-static VALUE
-rb_io_to_io(io)
-    VALUE io;
-{
-    return io;
-}
-
-/* reading functions */
-
-static long
-io_fread(ptr, len, f)
-    char *ptr;
-    long len;
-    FILE *f;
-{
-    long n = len;
-    int c;
-
-    while (n > 0) {
-#ifdef READ_DATA_PENDING_COUNT
-	int i = READ_DATA_PENDING_COUNT(f);
-	if (i <= 0) {
-	    rb_thread_wait_fd(fileno(f));
-	    i = READ_DATA_PENDING_COUNT(f);
-	}
-	if (i > 0) {
-	    if (i > n) i = n;
-	    TRAP_BEG;
-	    c = fread(ptr, 1, i, f);
-	    TRAP_END;
-	    if (c < 0) goto eof;
-	    ptr += c;
-	    n -= c;
-	    if (c < i) goto eof;
-	    continue;
-	}
-#else
-	if (!READ_DATA_PENDING(f)) {
-	    rb_thread_wait_fd(fileno(f));
-	}
-#endif
-	TRAP_BEG;
-	c = getc(f);
-	TRAP_END;
-	if (c == EOF) {
-	  eof:
-	    if (ferror(f)) {
-		switch (errno) {
-		  case EINTR:
-		    continue;
-		  case EAGAIN:
-#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
-		  case EWOULDBLOCK:
-#endif
-#ifdef __BORLANDC__
-		  case EPIPE:
-#endif
-		    return len - n;
-		}
-		return 0;
-	    }
-	    *ptr = '\0';
-	    break;
-	}
-	*ptr++ = c;
-	n--;
-    }
-
-    return len - n;
-}
-
-#ifndef S_ISREG
-#   define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
-#endif
-
-#define SMALLBUF 100
-
-static long
-remain_size(fptr)
-    OpenFile *fptr;
-{
-    struct stat st;
-    off_t siz = BUFSIZ;
-    off_t pos;
-
-    if (feof(fptr->f)) return 0;
-    if (fstat(fileno(fptr->f), &st) == 0  && S_ISREG(st.st_mode)
-#ifdef __BEOS__
-	&& (st.st_dev > 3)
-#endif
-	)
-    {
-	pos = ftello(fptr->f);
-	if (st.st_size > pos && pos >= 0) {
-	    siz = st.st_size - pos + 1;
-	    if (siz > LONG_MAX) {
-		rb_raise(rb_eIOError, "file too big for single read");
-	    }
-	}
-    }
-    return (long)siz;
-}
-
-static VALUE
-read_all(fptr, siz)
-    OpenFile *fptr;
-    long siz;
-{
-    VALUE str;
-    long bytes = 0;
-    long n;
-
-    if (feof(fptr->f)) return Qnil;
-    READ_CHECK(fptr->f);
-    if (!siz) siz = BUFSIZ;
-    str = rb_tainted_str_new(0, siz);
-    for (;;) {
-	n = io_fread(RSTRING(str)->ptr+bytes, siz-bytes, fptr->f);
-	if (n == 0 && bytes == 0) {
-	    if (feof(fptr->f)) return Qnil;
-	    rb_sys_fail(fptr->path);
-	}
-	bytes += n;
-	if (bytes < siz) break;
-	siz += BUFSIZ;
-	rb_str_resize(str, siz);
-    }
-    if (bytes == 0) return rb_str_new(0,0);
-    if (bytes != siz) rb_str_resize(str, bytes);
-
-    return str;
-}
-
-static VALUE
-io_read(argc, argv, io)
-    int argc;
-    VALUE *argv;
-    VALUE io;
-{
-    OpenFile *fptr;
-    int n, len;
-    VALUE length, str;
-
-    rb_scan_args(argc, argv, "01", &length);
-
-    GetOpenFile(io, fptr);
-    rb_io_check_readable(fptr);
-    if (NIL_P(length)) {
-	return read_all(fptr, remain_size(fptr));
-    }
-
-    len = NUM2INT(length);
-    if (len < 0) {
-	rb_raise(rb_eArgError, "negative length %d given", len);
-    }
-
-    if (feof(fptr->f)) return Qnil;
-    str = rb_str_new(0, len);
-    if (len == 0) return str;
-
-    READ_CHECK(fptr->f);
-    n = io_fread(RSTRING(str)->ptr, len, fptr->f);
-    if (n == 0) {
-	if (feof(fptr->f)) return Qnil;
-	rb_sys_fail(fptr->path);
-    }
-    RSTRING(str)->len = n;
-    RSTRING(str)->ptr[n] = '\0';
-    OBJ_TAINT(str);
-
-    return str;
-}
-
-static int
-appendline(fptr, delim, strp)
-    OpenFile *fptr;
-    int delim;
-    VALUE *strp;
-{
-    FILE *f = fptr->f;
-    VALUE str = *strp;
-    int c = EOF;
-#ifndef READ_DATA_PENDING_PTR
-    char buf[8192];
-    char *bp = buf, *bpe = buf + sizeof buf - 3;
-    int cnt;
-#endif
-
-    do {
-#ifdef READ_DATA_PENDING_PTR
-	int pending = READ_DATA_PENDING_COUNT(f);
-	if (pending > 0) {
-	    const char *p = READ_DATA_PENDING_PTR(f);
-	    const char *e = memchr(p, delim, pending);
-	    long last = 0;
-	    if (e) pending = e - p + 1;
-	    if (!NIL_P(str)) {
-		last = RSTRING(str)->len;
-		rb_str_resize(str, last + (c != EOF) + pending);
-	    }
-	    else {
-		*strp = str = rb_str_new(0, (c != EOF) + pending);
-	    }
-	    if (c != EOF) {
-		RSTRING(str)->ptr[last++] = c;
-	    }
-	    fread(RSTRING(str)->ptr + last, 1, pending, f); /* must not fail */
-	    if (e) return delim;
-	}
-	rb_thread_wait_fd(fileno(f));
-	rb_io_check_closed(fptr);
-#else
-	READ_CHECK(f);
-#endif
-	TRAP_BEG;
-	c = getc(f);
-	TRAP_END;
-	if (c == EOF) {
-	    if (ferror(f)) {
-		if (errno == EINTR) continue;
-		rb_sys_fail(fptr->path);
-	    }
-	    return c;
-	}
-#ifndef READ_DATA_PENDING_PTR
-	if ((*bp++ = c) == delim || bp == bpe) {
-	    cnt = bp - buf;
-
-	    if (cnt > 0) {
-		if (!NIL_P(str))
-		    rb_str_cat(str, buf, cnt);
-		else
-		    *strp = str = rb_str_new(buf, cnt);
-	    }
-	    bp = buf;
-	}
-#endif
-    } while (c != delim);
-
-#ifdef READ_DATA_PENDING_PTR
-    {
-	char ch = c;
-	if (!NIL_P(str)) {
-	    rb_str_cat(str, &ch, 1);
-	}
-	else {
-	    *strp = str = rb_str_new(&ch, 1);
-	}
-    }
-#endif
-
-    return c;
-}
-
-static inline int
-swallow(fptr, term)
-    OpenFile *fptr;
-    int term;
-{
-    FILE *f = fptr->f;
-    int c;
-
-    do {
-#ifdef READ_DATA_PENDING_PTR
-	int cnt;
-	while ((cnt = READ_DATA_PENDING_COUNT(f)) > 0) {
-	    char buf[1024];
-	    const char *p = READ_DATA_PENDING_PTR(f);
-	    int i;
-	    if (cnt > sizeof buf) cnt = sizeof buf;
-	    if (*p != term) return Qtrue;
-	    i = cnt;
-	    while (--i && *++p == term);
-	    if (!fread(buf, 1, cnt - i, f)) /* must not fail */
-		rb_sys_fail(fptr->path);
-	}
-	rb_thread_wait_fd(fileno(f));
-	rb_io_check_closed(fptr);
-#else
-	READ_CHECK(f);
-#endif
-	TRAP_BEG;
-	c = getc(f);
-	TRAP_END;
-	if (c != term) {
-	    ungetc(c, f);
-	    return Qtrue;
-	}
-    } while (c != EOF);
-    return Qfalse;
-}
-
-static VALUE
-rb_io_getline_fast(fptr, delim)
-    OpenFile *fptr;
-    int delim;
-{
-    VALUE str = Qnil;
-    int c;
-
-    while ((c = appendline(fptr, delim, &str)) != EOF && c != delim);
-
-    if (!NIL_P(str)) {
-	fptr->lineno++;
-	lineno = INT2FIX(fptr->lineno);
-	OBJ_TAINT(str);
-    }
-
-    return str;
-}
-
-static VALUE
-rb_io_getline(rs, fptr)
-    VALUE rs;
-    OpenFile *fptr;
-{
-    VALUE str = Qnil;
-
-    if (NIL_P(rs)) {
-	str = read_all(fptr, 0);
-    }
-    else if (rs == rb_default_rs) {
-	return rb_io_getline_fast(fptr, '\n');
-    }
-    else {
-	int c, newline;
-	char *rsptr;
-	int rslen, rspara = 0;
-
-	StringValue(rs);
-	rslen = RSTRING(rs)->len;
-	if (rslen == 0) {
-	    rsptr = "\n\n";
-	    rslen = 2;
-	    rspara = 1;
-	    swallow(fptr, '\n');
-	}
-	else if (rslen == 1) {
-	    return rb_io_getline_fast(fptr, RSTRING(rs)->ptr[0]);
-	}
-	else {
-	    rsptr = RSTRING(rs)->ptr;
-	}
-	newline = rsptr[rslen - 1];
-
-	while ((c = appendline(fptr, newline, &str)) != EOF &&
-	       (c != newline || RSTRING(str)->len < rslen ||
-		memcmp(RSTRING(str)->ptr+RSTRING(str)->len-rslen,rsptr,rslen)));
-
-	if (rspara) {
-	    if (c != EOF) {
-		swallow(fptr, '\n');
-	    }
-	}
-    }
-
-    if (!NIL_P(str)) {
-	fptr->lineno++;
-	lineno = INT2FIX(fptr->lineno);
-	OBJ_TAINT(str);
-    }
-
-    return str;
-}
-
-VALUE
-rb_io_gets(io)
-    VALUE io;
-{
-    OpenFile *fptr;
-
-    GetOpenFile(io, fptr);
-    rb_io_check_readable(fptr);
-    return rb_io_getline_fast(fptr, '\n');
-}
-
-static VALUE
-rb_io_gets_m(argc, argv, io)
-    int argc;
-    VALUE *argv;
-    VALUE io;
-{
-    VALUE rs, str;
-    OpenFile *fptr;
-
-    if (argc == 0) {
-	rs = rb_rs;
-    }
-    else {
-	rb_scan_args(argc, argv, "1", &rs);
-    }
-    GetOpenFile(io, fptr);
-    rb_io_check_readable(fptr);
-    str = rb_io_getline(rs, fptr);
-
-    if (!NIL_P(str)) {
-	rb_lastline_set(str);
-    }
-    return str;
-}
-
-static VALUE
-rb_io_lineno(io)
-    VALUE io;
-{
-    OpenFile *fptr;
-
-    GetOpenFile(io, fptr);
-    rb_io_check_readable(fptr);
-    return INT2NUM(fptr->lineno);
-}
-
-static VALUE
-rb_io_set_lineno(io, lineno)
-    VALUE io, lineno;
-{
-    OpenFile *fptr;
-
-    GetOpenFile(io, fptr);
-    rb_io_check_readable(fptr);
-    fptr->lineno = NUM2INT(lineno);
-    return lineno;
-}
-
-static void
-lineno_setter(val, id, var)
-    VALUE val;
-    ID id;
-    VALUE *var;
-{
-    gets_lineno = NUM2INT(val);
-    *var = INT2FIX(gets_lineno);
-}
-
-static VALUE
-argf_set_lineno(argf, val)
-    VALUE argf, val;
-{
-    gets_lineno = NUM2INT(val);
-    lineno = INT2FIX(gets_lineno);
-    return Qnil;
-}
-
-static VALUE
-argf_lineno()
-{
-    return lineno;
-}
-
-static VALUE
-rb_io_readline(argc, argv, io)
-    int argc;
-    VALUE *argv;
-    VALUE io;
-{
-    VALUE line = rb_io_gets_m(argc, argv, io);
-
-    if (NIL_P(line)) {
-	rb_eof_error();
-    }
-    return line;
-}
-
-static VALUE
-rb_io_readlines(argc, argv, io)
-    int argc;
-    VALUE *argv;
-    VALUE io;
-{
-    VALUE line, ary;
-    VALUE rs;
-    OpenFile *fptr;
-
-    if (argc == 0) {
-	rs = rb_rs;
-    }
-    else {
-	rb_scan_args(argc, argv, "1", &rs);
-    }
-    GetOpenFile(io, fptr);
-    rb_io_check_readable(fptr);
-    ary = rb_ary_new();
-    while (!NIL_P(line = rb_io_getline(rs, fptr))) {
-	rb_ary_push(ary, line);
-    }
-    return ary;
-}
-
-static VALUE
-rb_io_each_line(argc, argv, io)
-    int argc;
-    VALUE *argv;
-    VALUE io;
-{
-    VALUE str;
-    OpenFile *fptr;
-    VALUE rs;
-
-    if (argc == 0) {
-	rs = rb_rs;
-    }
-    else {
-	rb_scan_args(argc, argv, "1", &rs);
-    }
-    GetOpenFile(io, fptr);
-    rb_io_check_readable(fptr);
-    while (!NIL_P(str = rb_io_getline(rs, fptr))) {
-	rb_yield(str);
-    }
-    return io;
-}
-
-static VALUE
-rb_io_each_byte(io)
-    VALUE io;
-{
-    OpenFile *fptr;
-    FILE *f;
-    int c;
-
-    GetOpenFile(io, fptr);
-    rb_io_check_readable(fptr);
-    f = fptr->f;
-
-    for (;;) {
-	READ_CHECK(f);
-	TRAP_BEG;
-	c = getc(f);
-	TRAP_END;
-	if (c == EOF) {
-	    if (ferror(f)) {
-		if (errno == EINTR) continue;
-		rb_sys_fail(fptr->path);
-	    }
-	    break;
-	}
-	rb_yield(INT2FIX(c & 0xff));
-    }
-    if (ferror(f)) rb_sys_fail(fptr->path);
-    return io;
-}
-
-VALUE
-rb_io_getc(io)
-    VALUE io;
-{
-    OpenFile *fptr;
-    FILE *f;
-    int c;
-
-    GetOpenFile(io, fptr);
-    rb_io_check_readable(fptr);
-    f = fptr->f;
-
-  retry:
-    READ_CHECK(f);
-    TRAP_BEG;
-    c = getc(f);
-    TRAP_END;
-
-    if (c == EOF) {
-	if (ferror(f)) {
-	    if (errno == EINTR) goto retry;
-	    rb_sys_fail(fptr->path);
-	}
-	return Qnil;
-    }
-    return INT2FIX(c & 0xff);
-}
-
-int
-rb_getc(f)
-    FILE *f;
-{
-    int c;
-
-    if (!READ_DATA_PENDING(f)) {
-	rb_thread_wait_fd(fileno(f));
-    }
-    TRAP_BEG;
-    c = getc(f);
-    TRAP_END;
-
-    return c;
-}
-
-static VALUE
-rb_io_readchar(io)
-    VALUE io;
-{
-    VALUE c = rb_io_getc(io);
-
-    if (NIL_P(c)) {
-	rb_eof_error();
-    }
-    return c;
-}
-
-VALUE
-rb_io_ungetc(io, c)
-    VALUE io, c;
-{
-    OpenFile *fptr;
-    int cc = NUM2INT(c);
-
-    GetOpenFile(io, fptr);
-    rb_io_check_readable(fptr);
-
-    if (ungetc(cc, fptr->f) == EOF && cc != EOF)
-	rb_sys_fail(fptr->path);
-    return Qnil;
-}
-
-static VALUE
-rb_io_isatty(io)
-    VALUE io;
-{
-    OpenFile *fptr;
-
-    GetOpenFile(io, fptr);
-    if (isatty(fileno(fptr->f)) == 0)
-	return Qfalse;
-    return Qtrue;
-}
-
-static void
-fptr_finalize(fptr, fin)
-    OpenFile *fptr;
-    int fin;
-{
-    int n1 = 0, n2 = 0, e = 0, f1, f2 = -1;
-
-    if (fptr->f2) {
-	f2 = fileno(fptr->f2);
-	n2 = fclose(fptr->f2);
-	fptr->f2 = 0;
-	if (n2 < 0) e = errno;
-    }
-    if (fptr->f) {
-	f1 = fileno(fptr->f);
-	n1 = fclose(fptr->f);
-	fptr->f = 0;
-	if (n1 < 0 && errno == EBADF) {
-	    if (f1 == f2 || !(fptr->mode & FMODE_WBUF)) {
-		n1 = 0;
-	    }
-	}
-    }
-    if (!fin && (n1 < 0 || n2 < 0)) {
-	if (n1 == 0) errno = e;
-	rb_sys_fail(fptr->path);
-    }
-}
-
-static void
-rb_io_fptr_cleanup(fptr, fin)
-    OpenFile *fptr;
-    int fin;
-{
-    if (fptr->finalize) {
-	(*fptr->finalize)(fptr);
-    }
-    else {
-	fptr_finalize(fptr, fin);
-    }
-
-    if (fptr->path) {
-	free(fptr->path);
-	fptr->path = 0;
-    }
-}
-
-void
-rb_io_fptr_finalize(fptr)
-    OpenFile *fptr;
-{
-    if (!fptr) return;
-    if (!fptr->f && !fptr->f2) return;
-    if (fileno(fptr->f) < 3) return;
-
-    rb_io_fptr_cleanup(fptr, Qtrue);
-}
-
-VALUE
-rb_io_close(io)
-    VALUE io;
-{
-    OpenFile *fptr;
-    int fd;
-
-    fptr = RFILE(io)->fptr;
-    if (!fptr) return Qnil;
-    if (!fptr->f && !fptr->f2) return Qnil;
-
-    fd = fileno(fptr->f);
-    rb_io_fptr_cleanup(fptr, Qfalse);
-    rb_thread_fd_close(fd);
-
-    if (fptr->pid) {
-	rb_syswait(fptr->pid);
-	fptr->pid = 0;
-    }
-
-    return Qnil;
-}
-
-static VALUE
-rb_io_close_m(io)
-    VALUE io;
-{
-    if (rb_safe_level() >= 4 && !OBJ_TAINTED(io)) {
-	rb_raise(rb_eSecurityError, "Insecure: can't close");
-    }
-    rb_io_check_closed(RFILE(io)->fptr);
-    rb_io_close(io);
-    return Qnil;
-}
-
-static VALUE
-rb_io_closed(io)
-    VALUE io;
-{
-    OpenFile *fptr;
-
-    fptr = RFILE(io)->fptr;
-    return (fptr->f || fptr->f2)?Qfalse:Qtrue;
-}
-
-static VALUE
-rb_io_close_read(io)
-    VALUE io;
-{
-    OpenFile *fptr;
-    int n;
-
-    if (rb_safe_level() >= 4 && !OBJ_TAINTED(io)) {
-	rb_raise(rb_eSecurityError, "Insecure: can't close");
-    }
-    GetOpenFile(io, fptr);
-    if (fptr->f2 == 0 && (fptr->mode & FMODE_WRITABLE)) {
-	rb_raise(rb_eIOError, "closing non-duplex IO for reading");
-    }
-    if (fptr->f2 == 0) {
-	return rb_io_close(io);
-    }
-    n = fclose(fptr->f);
-    fptr->mode &= ~FMODE_READABLE;
-    fptr->f = fptr->f2;
-    fptr->f2 = 0;
-    if (n != 0) rb_sys_fail(fptr->path);
-
-    return Qnil;
-}
-
-static VALUE
-rb_io_close_write(io)
-    VALUE io;
-{
-    OpenFile *fptr;
-    int n;
-
-    if (rb_safe_level() >= 4 && !OBJ_TAINTED(io)) {
-	rb_raise(rb_eSecurityError, "Insecure: can't close");
-    }
-    GetOpenFile(io, fptr);
-    if (fptr->f2 == 0 && (fptr->mode & FMODE_READABLE)) {
-	rb_raise(rb_eIOError, "closing non-duplex IO for writing");
-    }
-    if (fptr->f2 == 0) {
-	return rb_io_close(io);
-    }
-    n = fclose(fptr->f2);
-    fptr->f2 = 0;
-    fptr->mode &= ~FMODE_WRITABLE;
-    if (n != 0) rb_sys_fail(fptr->path);
-
-    return Qnil;
-}
-
-static VALUE
-rb_io_sysseek(argc, argv, io)
-    int argc;
-    VALUE *argv;
-    VALUE io;
-{
-    VALUE offset, ptrname;
-    int whence = SEEK_SET;
-    OpenFile *fptr;
-    off_t pos;
-
-    if (rb_scan_args(argc, argv, "11", &offset, &ptrname) == 2) {
-	whence = NUM2INT(ptrname);
-    }
-
-    GetOpenFile(io, fptr);
-    if ((fptr->mode & FMODE_READABLE) && READ_DATA_PENDING(fptr->f)) {
-	rb_raise(rb_eIOError, "sysseek for buffered IO");
-    }
-    if ((fptr->mode & FMODE_WRITABLE) && (fptr->mode & FMODE_WBUF)) {
-	rb_warn("sysseek for buffered IO");
-    }
-    pos = lseek(fileno(fptr->f), NUM2OFFT(offset), whence);
-    if (pos == -1) rb_sys_fail(fptr->path);
-    clearerr(fptr->f);
-
-    return OFFT2NUM(pos);
-}
-
-static VALUE
-rb_io_syswrite(io, str)
-    VALUE io, str;
-{
-    OpenFile *fptr;
-    FILE *f;
-    int n;
-
-    rb_secure(4);
-    if (TYPE(str) != T_STRING)
-	str = rb_obj_as_string(str);
-
-    GetOpenFile(io, fptr);
-    rb_io_check_writable(fptr);
-    f = GetWriteFile(fptr);
-
-    if (fptr->mode & FMODE_WBUF) {
-	rb_warn("syswrite for buffered IO");
-    }
-    if (!rb_thread_fd_writable(fileno(f))) {
-        rb_io_check_closed(fptr);
-    }
-    n = write(fileno(f), RSTRING(str)->ptr, RSTRING(str)->len);
-
-    if (n == -1) rb_sys_fail(fptr->path);
-
-    return INT2FIX(n);
-}
-
-static VALUE
-rb_io_sysread(io, len)
-    VALUE io, len;
-{
-    OpenFile *fptr;
-    int n, ilen;
-    VALUE str;
-
-    ilen = NUM2INT(len);
-    GetOpenFile(io, fptr);
-    rb_io_check_readable(fptr);
-
-    if (READ_DATA_PENDING(fptr->f)) {
-	rb_raise(rb_eIOError, "sysread for buffered IO");
-    }
-    str = rb_str_new(0, ilen);
-
-    n = fileno(fptr->f);
-    rb_thread_wait_fd(fileno(fptr->f));
-    TRAP_BEG;
-    n = read(fileno(fptr->f), RSTRING(str)->ptr, RSTRING(str)->len);
-    TRAP_END;
-
-    if (n == -1) rb_sys_fail(fptr->path);
-    if (n == 0 && ilen > 0) {
-	rb_eof_error();
-    }
-
-    RSTRING(str)->len = n;
-    RSTRING(str)->ptr[n] = '\0';
-    OBJ_TAINT(str);
-
-    return str;
-}
-
-VALUE
-rb_io_binmode(io)
-    VALUE io;
-{
-#if defined(NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__EMX__)
-    OpenFile *fptr;
-
-    GetOpenFile(io, fptr);
-#ifdef __human68k__
-    if (fptr->f)
-	fmode(fptr->f, _IOBIN);
-    if (fptr->f2)
-	fmode(fptr->f2, _IOBIN);
-#else
-    if (fptr->f && setmode(fileno(fptr->f), O_BINARY) == -1)
-	rb_sys_fail(fptr->path);
-    if (fptr->f2 && setmode(fileno(fptr->f2), O_BINARY) == -1)
-	rb_sys_fail(fptr->path);
-#endif
-
-    fptr->mode |= FMODE_BINMODE;
-#endif
-    return io;
-}
-
-int
-rb_io_mode_flags(mode)
-    const char *mode;
-{
-    int flags = 0;
-    const char *m = mode;
-
-    switch (*m++) {
-      case 'r':
-	flags |= FMODE_READABLE;
-	break;
-      case 'w':
-	flags |= FMODE_WRITABLE;
-	break;
-      case 'a':
-	flags |= FMODE_WRITABLE;
-	break;
-      default:
-      error:
-	rb_raise(rb_eArgError, "illegal access mode %s", mode);
-    }
-
-    while (*m) {
-        switch (*m++) {
-        case 'b':
-            flags |= FMODE_BINMODE;
-            break;
-        case '+':
-            flags |= FMODE_READWRITE;
-            break;
-        default:
-            goto error;
-        }
-    }
-
-    return flags;
-}
-
-static int
-rb_io_modenum_flags(mode)
-    int mode;
-{
-    int flags = 0;
-
-    switch (mode & (O_RDONLY|O_WRONLY|O_RDWR)) {
-      case O_RDONLY:
-	flags = FMODE_READABLE;
-	break;
-      case O_WRONLY:
-	flags = FMODE_WRITABLE;
-	break;
-      case O_RDWR:
-	flags = FMODE_WRITABLE|FMODE_READABLE;
-	break;
-    }
-
-#ifdef O_BINARY
-    if (mode & O_BINARY) {
-	flags |= FMODE_BINMODE;
-    }
-#endif
-
-    return flags;
-}
-
-static int
-rb_io_mode_modenum(mode)
-    const char *mode;
-{
-    int flags = 0;
-    const char *m = mode;
-
-    switch (*m++) {
-      case 'r':
-	flags |= O_RDONLY;
-	break;
-      case 'w':
-	flags |= O_WRONLY | O_CREAT | O_TRUNC;
-	break;
-      case 'a':
-	flags |= O_WRONLY | O_CREAT | O_APPEND;
-	break;
-      default:
-      error:
-	rb_raise(rb_eArgError, "illegal access mode %s", mode);
-    }
-
-    while (*m) {
-        switch (*m++) {
-        case 'b':
-#ifdef O_BINARY
-            flags |= O_BINARY;
-#endif
-            break;
-        case '+':
-            flags |= O_RDWR;
-            break;
-        default:
-            goto error;
-        }
-    }
-
-    return flags;
-}
-
-static char*
-rb_io_modenum_mode(flags, mode)
-    int flags;
-    char *mode;
-{
-    char *p = mode;
-
-    switch (flags & (O_RDONLY|O_WRONLY|O_RDWR)) {
-      case O_RDONLY:
-	*p++ = 'r';
-	break;
-      case O_WRONLY:
-	*p++ = 'w';
-	break;
-      case O_RDWR:
-	*p++ = 'r';
-	*p++ = '+';
-	break;
-    }
-    *p++ = '\0';
-#ifdef O_BINARY
-    if (flags & O_BINARY) {
-	if (mode[1] == '+') {
-	    mode[1] = 'b'; mode[2] = '+'; mode[3] = '\0';
-	}
-	else {
-	    mode[1] = 'b'; mode[2] = '\0';
-	}
-    }
-#endif
-    return mode;
-}
-
-static int
-rb_sysopen(fname, flags, mode)
-    char *fname;
-    int flags;
-    unsigned int mode;
-{
-    int fd;
-
-    fd = open(fname, flags, mode);
-    if (fd < 0) {
-	if (errno == EMFILE || errno == ENFILE) {
-	    rb_gc();
-	    fd = open(fname, flags, mode);
-	}
-	if (fd < 0) {
-	    rb_sys_fail(fname);
-	}
-    }
-    return fd;
-}
-
-FILE *
-rb_fopen(fname, mode)
-    const char *fname;
-    const char *mode;
-{
-    FILE *file;
-
-    file = fopen(fname, mode);
-    if (!file) {
-	if (errno == EMFILE || errno == ENFILE) {
-	    rb_gc();
-	    file = fopen(fname, mode);
-	}
-	if (!file) {
-	    rb_sys_fail(fname);
-	}
-    }
-#ifdef USE_SETVBUF
-    if (setvbuf(file, NULL, _IOFBF, 0) != 0)
-	rb_warn("setvbuf() can't be honered for %s", fname);
-#endif
-#ifdef __human68k__
-    fmode(file, _IOTEXT);
-#endif
-    return file;
-}
-
-FILE *
-rb_fdopen(fd, mode)
-    int fd;
-    const char *mode;
-{
-    FILE *file;
-
-    file = fdopen(fd, mode);
-    if (!file) {
-	if (errno == EMFILE || errno == ENFILE) {
-	    rb_gc();
-	    file = fdopen(fd, mode);
-	}
-	if (!file) {
-	    rb_sys_fail(0);
-	}
-    }
-
-#ifdef USE_SETVBUF
-    if (setvbuf(file, NULL, _IOFBF, 0) != 0)
-	rb_warn("setvbuf() can't be honered (fd=%d)", fd);
-#endif
-    return file;
-}
-
-static VALUE
-rb_file_open_internal(io, fname, mode)
-    VALUE io;
-    const char *fname, *mode;
-{
-    OpenFile *fptr;
-
-    MakeOpenFile(io, fptr);
-
-    fptr->mode = rb_io_mode_flags(mode);
-    fptr->f = rb_fopen(fname, mode);
-    fptr->path = strdup(fname);
-
-    return io;
-}
-
-VALUE
-rb_file_open(fname, mode)
-    const char *fname, *mode;
-{
-    VALUE io = rb_obj_alloc(rb_cFile);
-
-    return rb_file_open_internal(io, fname, mode);
-}
-
-static VALUE
-rb_file_sysopen_internal(io, fname, flags, mode)
-    VALUE io;
-    char *fname;
-    int flags, mode;
-{
-    OpenFile *fptr;
-    int fd;
-    char *m;
-    char mbuf[4];
-
-    MakeOpenFile(io, fptr);
-
-    fd = rb_sysopen(fname, flags, mode);
-    m = rb_io_modenum_mode(flags, mbuf);
-    fptr->mode = rb_io_modenum_flags(flags);
-    fptr->f = rb_fdopen(fd, m);
-    fptr->path = strdup(fname);
-
-    return io;
-}
-
-VALUE
-rb_file_sysopen(fname, flags, mode)
-    const char *fname;
-    int flags, mode;
-{
-    VALUE io = rb_obj_alloc(rb_cFile);
-
-    return rb_file_sysopen_internal(io, fname, flags, mode);
-}
-
-#if defined (NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__VMS)
-static struct pipe_list {
-    OpenFile *fptr;
-    struct pipe_list *next;
-} *pipe_list;
-
-static void
-pipe_add_fptr(fptr)
-    OpenFile *fptr;
-{
-    struct pipe_list *list;
-
-    list = ALLOC(struct pipe_list);
-    list->fptr = fptr;
-    list->next = pipe_list;
-    pipe_list = list;
-}
-
-static void
-pipe_del_fptr(fptr)
-    OpenFile *fptr;
-{
-    struct pipe_list *list = pipe_list;
-    struct pipe_list *tmp;
-
-    if (list->fptr == fptr) {
-	pipe_list = list->next;
-	free(list);
-	return;
-    }
-
-    while (list->next) {
-	if (list->next->fptr == fptr) {
-	    tmp = list->next;
-	    list->next = list->next->next;
-	    free(tmp);
-	    return;
-	}
-	list = list->next;
-    }
-}
-
-#if defined (NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__VMS)
-static void
-pipe_atexit _((void))
-{
-    struct pipe_list *list = pipe_list;
-    struct pipe_list *tmp;
-
-    while (list) {
-	tmp = list->next;
-	rb_io_fptr_finalize(list->fptr);
-	list = tmp;
-    }
-}
-#endif
-
-static void pipe_finalize _((OpenFile *fptr));
-
-static void
-pipe_finalize(fptr)
-    OpenFile *fptr;
-{
-#if !defined (__CYGWIN__) && !defined(NT)
-    extern VALUE rb_last_status;
-    int status;
-    if (fptr->f) {
-	status = pclose(fptr->f);
-    }
-    if (fptr->f2) {
-	status = pclose(fptr->f2);
-    }
-    fptr->f = fptr->f2 = 0;
-#if defined DJGPP
-    status <<= 8;
-#endif
-    rb_last_status = INT2FIX(status);
-#else
-    fptr_finalize(fptr, Qtrue);
-#endif
-    pipe_del_fptr(fptr);
-}
-#endif
-
-void
-rb_io_synchronized(fptr)
-    OpenFile *fptr;
-{
-    fptr->mode |= FMODE_SYNC;
-}
-
-void
-rb_io_unbuffered(fptr)
-    OpenFile *fptr;
-{
-    rb_io_synchronized(fptr);
-}
-
-static VALUE
-pipe_open(pname, mode)
-    char *pname, *mode;
-{
-    int modef = rb_io_mode_flags(mode);
-    OpenFile *fptr;
-
-#if defined(DJGPP) || defined(__human68k__) || defined(__VMS)
-    FILE *f = popen(pname, mode);
-
-    if (!f) rb_sys_fail(pname);
-    else {
-	VALUE port = rb_obj_alloc(rb_cIO);
-
-	MakeOpenFile(port, fptr);
-	fptr->finalize = pipe_finalize;
-	fptr->mode = modef;
-
-	pipe_add_fptr(fptr);
-	if (modef & FMODE_READABLE) fptr->f  = f;
-	if (modef & FMODE_WRITABLE) {
-	    if (fptr->f) fptr->f2 = f;
-	    else fptr->f = f;
-	    rb_io_synchronized(fptr);
-	}
-	return (VALUE)port;
-    }
-#else
-#if defined(NT)
-    int pid;
-    FILE *fpr, *fpw;
-
-retry:
-    pid = pipe_exec(pname, rb_io_mode_modenum(mode), &fpr, &fpw);
-    if (pid == -1) {		/* exec failed */
-	if (errno == EAGAIN) {
-	    rb_thread_sleep(1);
-	    goto retry;
-	}
-	rb_sys_fail(pname);
-    }
-    else {
-        VALUE port = rb_obj_alloc(rb_cIO);
-
-	MakeOpenFile(port, fptr);
-	fptr->mode = modef;
-	fptr->mode |= FMODE_SYNC;
-	fptr->pid = pid;
-
-	if (modef & FMODE_READABLE) {
-	    fptr->f = fpr;
-    }
-	if (modef & FMODE_WRITABLE) {
-	    if (fptr->f) fptr->f2 = fpw;
-	    else fptr->f = fpw;
-	}
-	fptr->finalize = pipe_finalize;
-	pipe_add_fptr(fptr);
-	return (VALUE)port;
-    }
-#else
-    int pid, pr[2], pw[2];
-    volatile int doexec;
-
-    if (((modef & FMODE_READABLE) && pipe(pr) == -1) ||
-	((modef & FMODE_WRITABLE) && pipe(pw) == -1))
-	rb_sys_fail(pname);
-
-    doexec = (strcmp("-", pname) != 0);
-    if (!doexec) {
-	fflush(stdin);		/* is it really needed? */
-	fflush(stdout);
-	fflush(stderr);
-    }
-
-  retry:
-    switch ((pid = fork())) {
-      case 0:			/* child */
-	if (modef & FMODE_READABLE) {
-	    close(pr[0]);
-	    if (pr[1] != 1) {
-		dup2(pr[1], 1);
-		close(pr[1]);
-	    }
-	}
-	if (modef & FMODE_WRITABLE) {
-	    close(pw[1]);
-	    if (pw[0] != 0) {
-		dup2(pw[0], 0);
-		close(pw[0]);
-	    }
-	}
-
-	if (doexec) {
-	    int fd;
-
-	    for (fd = 3; fd < NOFILE; fd++)
-		close(fd);
-	    rb_proc_exec(pname);
-	    fprintf(stderr, "%s:%d: command not found: %s\n",
-		    ruby_sourcefile, ruby_sourceline, pname);
-	    _exit(127);
-	}
-	rb_io_synchronized(RFILE(orig_stdout)->fptr);
-	rb_io_synchronized(RFILE(orig_stderr)->fptr);
-	return Qnil;
-
-      case -1:			/* fork failed */
-	if (errno == EAGAIN) {
-	    rb_thread_sleep(1);
-	    goto retry;
-	}
-	close(pr[0]); close(pw[1]);
-	rb_sys_fail(pname);
-	break;
-
-      default:			/* parent */
-	if (pid < 0) rb_sys_fail(pname);
-	else {
-	    VALUE port = rb_obj_alloc(rb_cIO);
-
-	    MakeOpenFile(port, fptr);
-	    fptr->mode = modef;
-	    fptr->mode |= FMODE_SYNC;
-	    fptr->pid = pid;
-
-	    if (modef & FMODE_READABLE) {
-		close(pr[1]);
-		fptr->f  = rb_fdopen(pr[0], "r");
-	    }
-	    if (modef & FMODE_WRITABLE) {
-		FILE *f = rb_fdopen(pw[1], "w");
-
-		close(pw[0]);
-		if (fptr->f) fptr->f2 = f;
-		else fptr->f = f;
-	    }
-#if defined (__CYGWIN__)
-	    fptr->finalize = pipe_finalize;
-	    pipe_add_fptr(fptr);
-#endif
-	    return port;
-	}
-    }
-#endif
-#endif
-}
-
-static VALUE
-rb_io_popen(str, argc, argv, klass)
-    char *str;
-    int argc;
-    VALUE *argv;
-    VALUE klass;
-{
-    char *mode;
-    VALUE pname, pmode, port;
-    char mbuf[4];
-
-    if (rb_scan_args(argc, argv, "11", &pname, &pmode) == 1) {
-	mode = "r";
-    }
-    else if (FIXNUM_P(pmode)) {
-	mode = rb_io_modenum_mode(FIX2INT(pmode), mbuf);
-    }
-    else {
-	mode = StringValuePtr(pmode);
-    }
-    SafeStringValue(pname);
-    port = pipe_open(str, mode);
-    if (NIL_P(port)) {
-	/* child */
-	if (rb_block_given_p()) {
-	    rb_yield(Qnil);
-	    fflush(stdout);
-	    fflush(stderr);
-	    _exit(0);
-	}
-	return Qnil;
-    }
-    RBASIC(port)->klass = klass;
-    if (rb_block_given_p()) {
-	return rb_ensure(rb_yield, port, rb_io_close, port);
-    }
-    return port;
-}
-
-static VALUE
-rb_io_s_popen(argc, argv, klass)
-    int argc;
-    VALUE *argv;
-    VALUE klass;
-{
-    char *str = 0;
-
-    if (argc >= 1) {
-	str = StringValuePtr(argv[0]);
-    }
-    return rb_io_popen(str, argc, argv, klass);
-}
-
-static VALUE
-rb_open_file(argc, argv, io)
-    int argc;
-    VALUE *argv;
-    VALUE io;
-{
-    VALUE fname, vmode, perm;
-    char *path, *mode;
-    int flags, fmode;
-
-    rb_scan_args(argc, argv, "12", &fname, &vmode, &perm);
-    SafeStringValue(fname);
-    path = RSTRING(fname)->ptr;
-
-    if (FIXNUM_P(vmode) || !NIL_P(perm)) {
-	flags = FIXNUM_P(vmode) ? NUM2INT(vmode) : rb_io_mode_modenum(StringValuePtr(vmode));
-	fmode = NIL_P(perm) ? 0666 :  NUM2INT(perm);
-
-	rb_file_sysopen_internal(io, path, flags, fmode);
-    }
-    else {
-	mode = NIL_P(vmode) ? "r" : StringValuePtr(vmode);
-	rb_file_open_internal(io, RSTRING(fname)->ptr, mode);
-    }
-    return io;
-}
-
-static VALUE
-rb_io_s_open(argc, argv, klass)
-    int argc;
-    VALUE *argv;
-    VALUE klass;
-{
-    VALUE io = rb_class_new_instance(argc, argv, klass);
-
-    if (rb_block_given_p()) {
-	return rb_ensure(rb_yield, io, rb_io_close, io);
-    }
-
-    return io;
-}
-
-static VALUE
-rb_io_s_sysopen(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE fname, vmode, perm;
-    int flags, fmode, fd;
-
-    rb_scan_args(argc, argv, "12", &fname, &vmode, &perm);
-    SafeStringValue(fname);
-
-    if (NIL_P(vmode)) flags = O_RDONLY;
-    else if (FIXNUM_P(vmode)) flags = NUM2INT(vmode);
-    else {
-	flags = rb_io_mode_modenum(StringValuePtr(vmode));
-    }
-    if (NIL_P(perm)) fmode = 0666;
-    else             fmode = NUM2INT(perm);
-
-    fd = rb_sysopen(RSTRING(fname)->ptr, flags, fmode);
-    return INT2NUM(fd);
-}
-
-static VALUE
-rb_f_open(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    if (argc >= 1) {
-	char *str = StringValuePtr(argv[0]);
-
-	if (str[0] == '|') {
-	    return rb_io_popen(str+1, argc, argv, rb_cIO);
-	}
-    }
-    return rb_io_s_open(argc, argv, rb_cFile);
-}
-
-static VALUE
-rb_io_open(fname, mode)
-    char *fname, *mode;
-{
-    if (fname[0] == '|') {
-	return pipe_open(fname+1, mode);
-    }
-    else {
-	return rb_file_open(fname, mode);
-    }
-}
-
-static VALUE
-rb_io_get_io(io)
-    VALUE io;
-{
-    return rb_convert_type(io, T_FILE, "IO", "to_io");
-}
-
-static char*
-rb_io_mode_string(fptr)
-    OpenFile *fptr;
-{
-    switch (fptr->mode & FMODE_READWRITE) {
-      case FMODE_READABLE:
-      default:
-	return "r";
-      case FMODE_WRITABLE:
-	return "w";
-      case FMODE_READWRITE:
-	return "r+";
-    }
-}
-
-static VALUE
-io_reopen(io, nfile)
-    VALUE io, nfile;
-{
-    OpenFile *fptr, *orig;
-    char *mode;
-    int fd;
-    off_t pos = 0;
-
-    nfile = rb_io_get_io(nfile);
-    if (rb_safe_level() >= 4 && (!OBJ_TAINTED(io) || !OBJ_TAINTED(nfile))) {
-	rb_raise(rb_eSecurityError, "Insecure: can't reopen");
-    }
-    GetOpenFile(io, fptr);
-    GetOpenFile(nfile, orig);
-
-    if (fptr == orig) return io;
-    if (orig->mode & FMODE_READABLE) {
-	pos = ftello(orig->f);
-    }
-    if (orig->f2) {
-	io_fflush(orig->f2, orig);
-    }
-    else if (orig->mode & FMODE_WRITABLE) {
-	io_fflush(orig->f, orig);
-    }
-    rb_thread_fd_close(fileno(fptr->f));
-
-    /* copy OpenFile structure */
-    fptr->mode = orig->mode;
-    fptr->pid = orig->pid;
-    fptr->lineno = orig->lineno;
-    if (fptr->path) free(fptr->path);
-    if (orig->path) fptr->path = strdup(orig->path);
-    else fptr->path = 0;
-    fptr->finalize = orig->finalize;
-
-    mode = rb_io_mode_string(fptr);
-    fd = fileno(fptr->f);
-    if (fd < 3) {
-	clearerr(fptr->f);
-	/* need to keep stdio objects */
-	if (dup2(fileno(orig->f), fd) < 0)
-	    rb_sys_fail(orig->path);
-    }
-    else {
-	fclose(fptr->f);
-	if (dup2(fileno(orig->f), fd) < 0)
-	    rb_sys_fail(orig->path);
-	fptr->f = rb_fdopen(fd, mode);
-    }
-    if ((orig->mode & FMODE_READABLE) && pos >= 0) {
-	fseeko(fptr->f, pos, SEEK_SET);
-	fseeko(orig->f, pos, SEEK_SET);
-    }
-
-    if (fptr->f2) {
-	fd = fileno(fptr->f2);
-	fclose(fptr->f2);
-	if (orig->f2) {
-	    if (dup2(fileno(orig->f2), fd) < 0)
-		rb_sys_fail(orig->path);
-	    fptr->f2 = rb_fdopen(fd, "w");
-	}
-	else {
-	    fptr->f2 = 0;
-	}
-    }
-
-    if (fptr->mode & FMODE_BINMODE) {
-	rb_io_binmode(io);
-    }
-
-    RBASIC(io)->klass = RBASIC(nfile)->klass;
-    return io;
-}
-
-static VALUE
-rb_io_reopen(argc, argv, file)
-    int argc;
-    VALUE *argv;
-    VALUE file;
-{
-    VALUE fname, nmode;
-    char *mode;
-    OpenFile *fptr;
-
-    rb_secure(4);
-    if (rb_scan_args(argc, argv, "11", &fname, &nmode) == 1) {
-	if (TYPE(fname) != T_STRING) { /* fname must be IO */
-	    return io_reopen(file, fname);
-	}
-    }
-
-    SafeStringValue(fname);
-    if (!NIL_P(nmode)) {
-	mode = StringValuePtr(nmode);
-    }
-    else {
-	mode = "r";
-    }
-
-    GetOpenFile(file, fptr);
-    if (fptr->path) {
-	free(fptr->path);
-	fptr->path = 0;
-    }
-
-    fptr->path = strdup(RSTRING(fname)->ptr);
-    fptr->mode = rb_io_mode_flags(mode);
-    if (!fptr->f) {
-	fptr->f = rb_fopen(RSTRING(fname)->ptr, mode);
-	if (fptr->f2) {
-	    fclose(fptr->f2);
-	    fptr->f2 = 0;
-	}
-
-	return file;
-    }
-
-    if (freopen(RSTRING(fname)->ptr, mode, fptr->f) == 0) {
-	rb_sys_fail(fptr->path);
-    }
-#ifdef USE_SETVBUF
-    if (setvbuf(fptr->f, NULL, _IOFBF, 0) != 0)
-	rb_warn("setvbuf() can't be honered for %s", RSTRING(fname)->ptr);
-#endif
-
-    if (fptr->f2) {
-	if (freopen(RSTRING(fname)->ptr, "w", fptr->f2) == 0) {
-	    rb_sys_fail(fptr->path);
-	}
-    }
-
-    return file;
-}
-
-static VALUE
-rb_io_clone(io)
-    VALUE io;
-{
-    OpenFile *fptr, *orig;
-    int fd;
-    char *mode;
-    VALUE clone = rb_obj_clone(io);
-
-    GetOpenFile(io, orig);
-    MakeOpenFile(clone, fptr);
-
-    if (orig->f2) {
-	io_fflush(orig->f2, orig);
-    }
-    else if (orig->mode & FMODE_WRITABLE) {
-	io_fflush(orig->f, orig);
-    }
-
-    /* copy OpenFile structure */
-    fptr->mode = orig->mode;
-    fptr->pid = orig->pid;
-    fptr->lineno = orig->lineno;
-    if (orig->path) fptr->path = strdup(orig->path);
-    fptr->finalize = orig->finalize;
-
-    switch (fptr->mode & FMODE_READWRITE) {
-      case FMODE_READABLE:
-      default:
-	mode = "r"; break;
-      case FMODE_WRITABLE:
-	mode = "w"; break;
-      case FMODE_READWRITE:
-	if (orig->f2) mode = "r";
-	else          mode = "r+";
-	break;
-    }
-    fd = ruby_dup(fileno(orig->f));
-    fptr->f = rb_fdopen(fd, mode);
-    if (orig->f2) {
-	if (fileno(orig->f) != fileno(orig->f2)) {
-	    fd = ruby_dup(fileno(orig->f2));
-	}
-	fptr->f2 = rb_fdopen(fd, "w");
-    }
-    if (fptr->mode & FMODE_BINMODE) {
-	rb_io_binmode(clone);
-    }
-
-    return clone;
-}
-
-VALUE
-rb_io_printf(argc, argv, out)
-    int argc;
-    VALUE argv[];
-    VALUE out;
-{
-    rb_io_write(out, rb_f_sprintf(argc, argv));
-    return Qnil;
-}
-
-static VALUE
-rb_f_printf(argc, argv)
-    int argc;
-    VALUE argv[];
-{
-    VALUE out;
-
-    if (argc == 0) return Qnil;
-    if (TYPE(argv[0]) == T_STRING) {
-	out = rb_defout;
-    }
-    else {
-	out = argv[0];
-	argv++;
-	argc--;
-    }
-    rb_io_write(out, rb_f_sprintf(argc, argv));
-
-    return Qnil;
-}
-
-VALUE
-rb_io_print(argc, argv, out)
-    int argc;
-    VALUE *argv;
-    VALUE out;
-{
-    int i;
-    VALUE line;
-
-    /* if no argument given, print `$_' */
-    if (argc == 0) {
-	argc = 1;
-	line = rb_lastline_get();
-	argv = &line;
-    }
-    for (i=0; i0) {
-	    rb_io_write(out, rb_output_fs);
-	}
-	switch (TYPE(argv[i])) {
-	  case T_NIL:
-	    rb_io_write(out, rb_str_new2("nil"));
-	    break;
-	  default:
-	    rb_io_write(out, argv[i]);
-	    break;
-	}
-    }
-    if (!NIL_P(rb_output_rs)) {
-	rb_io_write(out, rb_output_rs);
-    }
-
-    return Qnil;
-}
-
-static VALUE
-rb_f_print(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    rb_io_print(argc, argv, rb_defout);
-    return Qnil;
-}
-
-static VALUE
-rb_io_putc(io, ch)
-    VALUE io, ch;
-{
-    OpenFile *fptr;
-    FILE *f;
-    int c = NUM2CHR(ch);
-
-    rb_secure(4);
-    GetOpenFile(io, fptr);
-    rb_io_check_writable(fptr);
-    f = GetWriteFile(fptr);
-
-    if (fputc(c, f) == EOF)
-	rb_sys_fail(fptr->path);
-    if (fptr->mode & FMODE_SYNC) {
-	io_fflush(f, fptr);
-    }
-    else {
-	fptr->mode |= FMODE_WBUF;
-    }
-
-    return ch;
-}
-
-static VALUE
-rb_f_putc(recv, ch)
-    VALUE recv, ch;
-{
-    return rb_io_putc(rb_defout, ch);
-}
-
-static VALUE
-io_puts_ary(ary, out)
-    VALUE ary, out;
-{
-    VALUE tmp;
-    int i;
-
-    for (i=0; ilen; i++) {
-	tmp = RARRAY(ary)->ptr[i];
-	if (rb_inspecting_p(tmp)) {
-	    tmp = rb_str_new2("[...]");
-	}
-	rb_io_puts(1, &tmp, out);
-    }
-    return Qnil;
-}
-
-VALUE
-rb_io_puts(argc, argv, out)
-    int argc;
-    VALUE *argv;
-    VALUE out;
-{
-    int i;
-    VALUE line;
-
-    /* if no argument given, print newline. */
-    if (argc == 0) {
-	rb_io_write(out, rb_default_rs);
-	return Qnil;
-    }
-    for (i=0; iptr[RSTRING(line)->len-1] != '\n') {
-	    rb_io_write(out, rb_default_rs);
-	}
-    }
-
-    return Qnil;
-}
-
-static VALUE
-rb_f_puts(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    rb_io_puts(argc, argv, rb_defout);
-    return Qnil;
-}
-
-void
-rb_p(obj)			/* for debug print within C code */
-    VALUE obj;
-{
-    rb_io_write(rb_defout, rb_obj_as_string(rb_inspect(obj)));
-    rb_io_write(rb_defout, rb_default_rs);
-}
-
-static VALUE
-rb_f_p(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    int i;
-
-    for (i=0; i must have write method, %s given",
-		 rb_class2name(CLASS_OF(val)));
-    }
-    rb_defout = val;
-}
-
-static void
-set_stdin(val, id, var)
-    VALUE val;
-    ID id;
-    VALUE *var;
-{
-    OpenFile *fptr;
-
-    if (val == *var) return;
-    if (TYPE(val) != T_FILE) {
-	*var = val;
-	return;
-    }
-    if (TYPE(*var) != T_FILE) {
-	*var = orig_stdin;
-    }
-
-    GetOpenFile(val, fptr);
-    rb_io_check_readable(fptr);
-    if (fileno(fptr->f) == 0 && saved_fd[0] != 0) {
-	dup2(saved_fd[0], 0);
-	close(saved_fd[0]);
-	saved_fd[0] = 0;
-    }
-    else {
-	saved_fd[0] = dup(0);
-	dup2(fileno(fptr->f), 0);
-    }
-
-    *var = val;
-}
-
-static void
-set_outfile(val, var, orig, stdf)
-    VALUE val;
-    VALUE *var;
-    VALUE orig;
-    FILE *stdf;
-{
-    OpenFile *fptr;
-    FILE *f;
-    int fd;
-
-    if (val == *var) return;
-
-    if (TYPE(*var) == T_FILE && !rb_io_closed(*var)) {
-	rb_io_flush(*var);
-    }
-    if (TYPE(val) != T_FILE) {
-	*var = val;
-	return;
-    }
-    if (TYPE(*var) != T_FILE) {
-	*var = orig;
-    }
-
-    GetOpenFile(val, fptr);
-    rb_io_check_writable(fptr);
-    f = GetWriteFile(fptr);
-    fd = fileno(stdf);
-    if (fileno(fptr->f) == fd && saved_fd[fd] != fd) {
-	dup2(saved_fd[fd], fd);
-	close(saved_fd[fd]);
-	saved_fd[fd] = fd;
-    }
-    else {
-	saved_fd[fd] = dup(fd);
-	dup2(fileno(fptr->f), fd);
-    }
-
-    *var = val;
-}
-
-static void
-set_stdout(val, id, var)
-    VALUE val;
-    ID id;
-    VALUE *var;
-{
-    set_outfile(val, var, orig_stdout, stdout);
-}
-
-static void
-set_stderr(val, id, var)
-    VALUE val;
-    ID id;
-    VALUE *var;
-{
-    set_outfile(val, var, orig_stderr, stderr);
-}
-
-static VALUE
-prep_stdio(f, mode, klass)
-    FILE *f;
-    int mode;
-    VALUE klass;
-{
-    OpenFile *fp;
-    VALUE io = rb_obj_alloc(klass);
-
-    MakeOpenFile(io, fp);
-    fp->f = f;
-    fp->mode = mode;
-
-    return io;
-}
-
-static void
-prep_path(io, path)
-    VALUE io;
-    char *path;
-{
-    OpenFile *fptr;
-
-    GetOpenFile(io, fptr);
-    if (fptr->path) rb_bug("illegal prep_path() call");
-    fptr->path = strdup(path);
-}
-
-static VALUE
-rb_io_s_alloc(klass)
-    VALUE klass;
-{
-    NEWOBJ(io, struct RFile);
-    OBJSETUP(io, klass, T_FILE);
-
-    io->fptr = 0;
-
-    return (VALUE)io;
-}
-
-static VALUE
-rb_io_initialize(argc, argv, io)
-    int argc;
-    VALUE *argv;
-    VALUE io;
-{
-    VALUE fnum, mode;
-    OpenFile *fp;
-    int fd, flags;
-    char mbuf[4];
-
-    rb_scan_args(argc, argv, "11", &fnum, &mode);
-    fd = NUM2INT(fnum);
-    if (argc == 2) {
-	SafeStringValue(mode);
-	flags = rb_io_mode_modenum(RSTRING(mode)->ptr);
-    }
-    else {
-#if defined(HAVE_FCNTL) && defined(F_GETFL)
-	flags = fcntl(fd, F_GETFL);
-#else
-	flags = O_RDONLY;
-#endif
-    }
-    MakeOpenFile(io, fp);
-    fp->mode = rb_io_modenum_flags(flags);
-    fp->f = rb_fdopen(fd, rb_io_modenum_mode(flags, mbuf));
-
-    return io;
-}
-
-static VALUE
-rb_file_initialize(argc, argv, io)
-    int argc;
-    VALUE *argv;
-    VALUE io;
-{
-    if (RFILE(io)->fptr) {
-	rb_io_close_m(io);
-	free(RFILE(io)->fptr);
-	RFILE(io)->fptr = 0;
-    }
-    if (0 < argc && argc < 3) {
-	VALUE fd = rb_check_convert_type(argv[0], T_FIXNUM, "Fixnum", "to_int");
-
-	if (!NIL_P(fd)) {
-	    argv[0] = fd;
-	    return rb_io_initialize(argc, argv, io);
-	}
-    }
-    rb_open_file(argc, argv, io);
-
-    return io;
-}
-
-static VALUE
-rb_io_s_new(argc, argv, klass)
-    int argc;
-    VALUE *argv;
-    VALUE klass;
-{
-    if (rb_block_given_p()) {
-	char *cname = rb_class2name(klass);
-
-	rb_warn("%s::new() does not take block; use %s::open() instead",
-		cname, cname);
-    }
-    return rb_class_new_instance(argc, argv, klass);
-}
-
-static int binmode = 0;
-
-static VALUE
-argf_forward()
-{
-    return rb_funcall3(current_file, ruby_frame->last_func,
-		       ruby_frame->argc, ruby_frame->argv);
-}
-
-static int
-next_argv()
-{
-    extern VALUE rb_argv;
-    char *fn;
-
-    if (init_p == 0) {
-	if (RARRAY(rb_argv)->len > 0) {
-	    next_p = 1;
-	}
-	else {
-	    next_p = -1;
-	    current_file = rb_stdin;
-	    filename = rb_str_new2("-");
-	}
-	init_p = 1;
-	first_p = 0;
-	gets_lineno = 0;
-    }
-
-  retry:
-    if (next_p == 1) {
-	next_p = 0;
-	if (RARRAY(rb_argv)->len > 0) {
-	    filename = rb_ary_shift(rb_argv);
-	    fn = StringValuePtr(filename);
-	    if (strlen(fn) == 1 && fn[0] == '-') {
-		current_file = rb_stdin;
-		if (ruby_inplace_mode) {
-		    rb_warn("Can't do inplace edit for stdio");
-		    rb_defout = rb_stdout;
-		}
-	    }
-	    else {
-		FILE *fr = rb_fopen(fn, "r");
-
-		if (ruby_inplace_mode) {
-		    struct stat st, st2;
-		    VALUE str;
-		    FILE *fw;
-
-		    if (TYPE(rb_defout) == T_FILE && rb_defout != rb_stdout) {
-			rb_io_close(rb_defout);
-		    }
-		    fstat(fileno(fr), &st);
-		    if (*ruby_inplace_mode) {
-			str = rb_str_new2(fn);
-#ifdef NO_LONG_FNAME
-                        ruby_add_suffix(str, ruby_inplace_mode);
-#else
-			rb_str_cat2(str, ruby_inplace_mode);
-#endif
-#ifdef NO_SAFE_RENAME
-			(void)fclose(fr);
-			(void)unlink(RSTRING(str)->ptr);
-			(void)rename(fn, RSTRING(str)->ptr);
-			fr = rb_fopen(RSTRING(str)->ptr, "r");
-#else
-			if (rename(fn, RSTRING(str)->ptr) < 0) {
-			    rb_warn("Can't rename %s to %s: %s, skipping file",
-				    fn, RSTRING(str)->ptr, strerror(errno));
-			    fclose(fr);
-			    goto retry;
-			}
-#endif
-		    }
-		    else {
-#ifdef NO_SAFE_RENAME
-			rb_fatal("Can't do inplace edit without backup");
-#else
-			if (unlink(fn) < 0) {
-			    rb_warn("Can't remove %s: %s, skipping file",
-				    fn, strerror(errno));
-			    fclose(fr);
-			    goto retry;
-			}
-#endif
-		    }
-		    fw = rb_fopen(fn, "w");
-#ifndef NO_SAFE_RENAME
-		    fstat(fileno(fw), &st2);
-#ifdef HAVE_FCHMOD
-		    fchmod(fileno(fw), st.st_mode);
-#else
-		    chmod(fn, st.st_mode);
-#endif
-		    if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) {
-			fchown(fileno(fw), st.st_uid, st.st_gid);
-		    }
-#endif
-		    rb_defout = prep_stdio(fw, FMODE_WRITABLE, rb_cFile);
-		    prep_path(rb_defout, fn);
-		}
-		current_file = prep_stdio(fr, FMODE_READABLE, rb_cFile);
-		prep_path(current_file, fn);
-	    }
-	    if (binmode) rb_io_binmode(current_file);
-	}
-	else {
-	    init_p = 0;
-	    return Qfalse;
-	}
-    }
-    return Qtrue;
-}
-
-static void
-any_close(file)
-    VALUE file;
-{
-    if (TYPE(file) == T_FILE)
-	rb_io_close(file);
-    else
-	rb_funcall3(file, rb_intern("close"), 0, 0);
-}
-
-static VALUE
-argf_getline(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE line;
-
-  retry:
-    if (!next_argv()) return Qnil;
-    if (TYPE(current_file) != T_FILE) {
-	line = rb_funcall3(current_file, rb_intern("gets"), argc, argv);
-    }
-    else if (argc == 0 && rb_rs == rb_default_rs) {
-	line = rb_io_gets(current_file);
-    }
-    else {
-	VALUE rs;
-	OpenFile *fptr;
-
-	if (argc == 0) {
-	    rs = rb_rs;
-	}
-	else {
-	    rb_scan_args(argc, argv, "1", &rs);
-	}
-	GetOpenFile(current_file, fptr);
-	rb_io_check_readable(fptr);
-	line = rb_io_getline(rs, fptr);
-    }
-    if (NIL_P(line) && next_p != -1) {
-	any_close(current_file);
-	next_p = 1;
-	goto retry;
-    }
-    gets_lineno++;
-    lineno = INT2FIX(gets_lineno);
-
-    return line;
-}
-
-static VALUE
-rb_f_gets(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE line = argf_getline(argc, argv);
-
-    rb_lastline_set(line);
-    return line;
-}
-
-VALUE
-rb_gets()
-{
-    VALUE line;
-
-    if (rb_rs != rb_default_rs) {
-	return rb_f_gets(0, 0);
-    }
-
-  retry:
-    if (!next_argv()) return Qnil;
-    line = rb_io_gets(current_file);
-    if (NIL_P(line) && next_p != -1) {
-	any_close(current_file);
-	next_p = 1;
-	goto retry;
-    }
-    rb_lastline_set(line);
-    if (!NIL_P(line)) {
-	gets_lineno++;
-	lineno = INT2FIX(gets_lineno);
-    }
-
-    return line;
-}
-
-static VALUE
-rb_f_readline(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE line = rb_f_gets(argc, argv);
-
-    if (NIL_P(line)) {
-	rb_eof_error();
-    }
-
-    return line;
-}
-
-static VALUE
-rb_f_getc()
-{
-    rb_warn("getc is obsolete; use STDIN.getc instead");
-    return rb_io_getc(rb_stdin);
-}
-
-static VALUE
-rb_f_readlines(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE line, ary;
-
-    ary = rb_ary_new();
-    while (!NIL_P(line = argf_getline(argc, argv))) {
-	rb_ary_push(ary, line);
-    }
-
-    return ary;
-}
-
-static VALUE
-rb_f_backquote(obj, str)
-    VALUE obj, str;
-{
-    VALUE port, result;
-    OpenFile *fptr;
-
-    SafeStringValue(str);
-    port = pipe_open(RSTRING(str)->ptr, "r");
-    if (NIL_P(port)) return rb_str_new(0,0);
-
-    GetOpenFile(port, fptr);
-    result = read_all(fptr, remain_size(fptr));
-
-    rb_io_close(port);
-
-    if (NIL_P(result)) return rb_str_new(0,0);
-    return result;
-}
-
-#ifdef HAVE_SYS_SELECT_H
-#include 
-#endif
-
-static VALUE
-rb_f_select(argc, argv, obj)
-    int argc;
-    VALUE *argv;
-    VALUE obj;
-{
-    VALUE read, write, except, timeout, res, list;
-    fd_set rset, wset, eset, pset;
-    fd_set *rp, *wp, *ep;
-    struct timeval *tp, timerec;
-    OpenFile *fptr;
-    int i, max = 0, n;
-    int interrupt_flag = 0;
-    int pending = 0;
-
-    rb_scan_args(argc, argv, "13", &read, &write, &except, &timeout);
-    if (NIL_P(timeout)) {
-	tp = 0;
-    }
-    else {
-	timerec = rb_time_interval(timeout);
-	tp = &timerec;
-    }
-
-    FD_ZERO(&pset);
-    if (!NIL_P(read)) {
-	Check_Type(read, T_ARRAY);
-	rp = &rset;
-	FD_ZERO(rp);
-	for (i=0; ilen; i++) {
-	    GetOpenFile(rb_io_get_io(RARRAY(read)->ptr[i]), fptr);
-	    FD_SET(fileno(fptr->f), rp);
-	    if (READ_DATA_PENDING(fptr->f)) { /* check for buffered data */
-		pending++;
-		FD_SET(fileno(fptr->f), &pset);
-	    }
-	    if (max < fileno(fptr->f)) max = fileno(fptr->f);
-	}
-	if (pending) {		/* no blocking if there's buffered data */
-	    timerec.tv_sec = timerec.tv_usec = 0;
-	    tp = &timerec;
-	}
-    }
-    else
-	rp = 0;
-
-    if (!NIL_P(write)) {
-	Check_Type(write, T_ARRAY);
-	wp = &wset;
-	FD_ZERO(wp);
-	for (i=0; ilen; i++) {
-	    GetOpenFile(rb_io_get_io(RARRAY(write)->ptr[i]), fptr);
-	    FD_SET(fileno(fptr->f), wp);
-	    if (max < fileno(fptr->f)) max = fileno(fptr->f);
-	    if (fptr->f2) {
-		FD_SET(fileno(fptr->f2), wp);
-		if (max < fileno(fptr->f2)) max = fileno(fptr->f2);
-	    }
-	}
-    }
-    else
-	wp = 0;
-
-    if (!NIL_P(except)) {
-	Check_Type(except, T_ARRAY);
-	ep = &eset;
-	FD_ZERO(ep);
-	for (i=0; ilen; i++) {
-	    GetOpenFile(rb_io_get_io(RARRAY(except)->ptr[i]), fptr);
-	    FD_SET(fileno(fptr->f), ep);
-	    if (max < fileno(fptr->f)) max = fileno(fptr->f);
-	    if (fptr->f2) {
-		FD_SET(fileno(fptr->f2), ep);
-		if (max < fileno(fptr->f2)) max = fileno(fptr->f2);
-	    }
-	}
-    }
-    else {
-	ep = 0;
-    }
-
-    max++;
-
-    n = rb_thread_select(max, rp, wp, ep, tp);
-    if (n < 0) {
-	rb_sys_fail(0);
-    }
-    if (!pending && n == 0) return Qnil; /* returns nil on timeout */
-
-    res = rb_ary_new2(3);
-    rb_ary_push(res, rp?rb_ary_new():rb_ary_new2(0));
-    rb_ary_push(res, wp?rb_ary_new():rb_ary_new2(0));
-    rb_ary_push(res, ep?rb_ary_new():rb_ary_new2(0));
-
-    if (interrupt_flag == 0) {
-	if (rp) {
-	    list = RARRAY(res)->ptr[0];
-	    for (i=0; i< RARRAY(read)->len; i++) {
-		GetOpenFile(rb_io_get_io(RARRAY(read)->ptr[i]), fptr);
-		if (FD_ISSET(fileno(fptr->f), rp)
-		    || FD_ISSET(fileno(fptr->f), &pset)) {
-		    rb_ary_push(list, RARRAY(read)->ptr[i]);
-		}
-	    }
-	}
-
-	if (wp) {
-	    list = RARRAY(res)->ptr[1];
-	    for (i=0; i< RARRAY(write)->len; i++) {
-		GetOpenFile(rb_io_get_io(RARRAY(write)->ptr[i]), fptr);
-		if (FD_ISSET(fileno(fptr->f), wp)) {
-		    rb_ary_push(list, RARRAY(write)->ptr[i]);
-		}
-		else if (fptr->f2 && FD_ISSET(fileno(fptr->f2), wp)) {
-		    rb_ary_push(list, RARRAY(write)->ptr[i]);
-		}
-	    }
-	}
-
-	if (ep) {
-	    list = RARRAY(res)->ptr[2];
-	    for (i=0; i< RARRAY(except)->len; i++) {
-		GetOpenFile(rb_io_get_io(RARRAY(except)->ptr[i]), fptr);
-		if (FD_ISSET(fileno(fptr->f), ep)) {
-		    rb_ary_push(list, RARRAY(except)->ptr[i]);
-		}
-		else if (fptr->f2 && FD_ISSET(fileno(fptr->f2), ep)) {
-		    rb_ary_push(list, RARRAY(except)->ptr[i]);
-		}
-	    }
-	}
-    }
-
-    return res;			/* returns an empty array on interrupt */
-}
-
-#if !defined(MSDOS) && !defined(__human68k__)
-static int
-io_cntl(fd, cmd, narg, io_p)
-    int fd, cmd, io_p;
-    long narg;
-{
-    int retval;
-
-#ifdef HAVE_FCNTL
-    TRAP_BEG;
-# if defined(__CYGWIN__)
-    retval = io_p?ioctl(fd, cmd, (void*)narg):fcntl(fd, cmd, narg);
-# else
-    retval = io_p?ioctl(fd, cmd, narg):fcntl(fd, cmd, narg);
-# endif
-    TRAP_END;
-#else
-    if (!io_p) {
-	rb_notimplement();
-    }
-    TRAP_BEG;
-    retval = ioctl(fd, cmd, narg);
-    TRAP_END;
-#endif
-    return retval;
-}
-#endif
-
-static VALUE
-rb_io_ctl(io, req, arg, io_p)
-    VALUE io, req, arg;
-    int io_p;
-{
-#if !defined(MSDOS) && !defined(__human68k__)
-    int cmd = NUM2ULONG(req);
-    OpenFile *fptr;
-    int len = 0;
-    long narg = 0;
-    int retval;
-
-    rb_secure(2);
-    GetOpenFile(io, fptr);
-
-    if (NIL_P(arg) || arg == Qfalse) {
-	narg = 0;
-    }
-    else if (FIXNUM_P(arg)) {
-	narg = FIX2INT(arg);
-    }
-    else if (arg == Qtrue) {
-	narg = 1;
-    }
-    else if (rb_obj_is_kind_of(arg, rb_cInteger)) {
-	narg = NUM2LONG(arg);
-    }
-    else {
-	StringValue(arg);
-
-#ifdef IOCPARM_MASK
-#ifndef IOCPARM_LEN
-#define IOCPARM_LEN(x)  (((x) >> 16) & IOCPARM_MASK)
-#endif
-#endif
-#ifdef IOCPARM_LEN
-	len = IOCPARM_LEN(cmd);	/* on BSDish systems we're safe */
-#else
-	len = 256;		/* otherwise guess at what's safe */
-#endif
-	rb_str_modify(arg);
-
-	if (len <= RSTRING(arg)->len) {
-	    len = RSTRING(arg)->len;
-	}
-	if (RSTRING(arg)->len < len) {
-	    rb_str_resize(arg, len+1);
-	}
-	RSTRING(arg)->ptr[len] = 17;	/* a little sanity check here */
-	narg = (long)RSTRING(arg)->ptr;
-    }
-    retval = io_cntl(fileno(fptr->f), cmd, narg, io_p);
-    if (retval < 0) rb_sys_fail(fptr->path);
-    if (TYPE(arg) == T_STRING && RSTRING(arg)->ptr[len] != 17) {
-	rb_raise(rb_eArgError, "return value overflowed string");
-    }
-
-    if (fptr->f2 && fileno(fptr->f) != fileno(fptr->f2)) {
-	/* call on f2 too; ignore result */
-	io_cntl(fileno(fptr->f2), cmd, narg, io_p);
-    }
-
-    return INT2NUM(retval);
-#else
-    rb_notimplement();
-    return Qnil;		/* not reached */
-#endif
-}
-
-static VALUE
-rb_io_ioctl(argc, argv, io)
-    int argc;
-    VALUE *argv;
-    VALUE io;
-{
-    VALUE req, arg;
-
-    rb_scan_args(argc, argv, "11", &req, &arg);
-    return rb_io_ctl(io, req, arg, 1);
-}
-
-static VALUE
-rb_io_fcntl(argc, argv, io)
-    int argc;
-    VALUE *argv;
-    VALUE io;
-{
-#ifdef HAVE_FCNTL
-    VALUE req, arg;
-
-    rb_scan_args(argc, argv, "11", &req, &arg);
-    return rb_io_ctl(io, req, arg, 0);
-#else
-    rb_notimplement();
-    return Qnil;		/* not reached */
-#endif
-}
-
-static VALUE
-rb_f_syscall(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-#if defined(HAVE_SYSCALL) && !defined(__CHECKER__)
-#ifdef atarist
-    unsigned long arg[14]; /* yes, we really need that many ! */
-#else
-    unsigned long arg[8];
-#endif
-    int retval = -1;
-    int i = 1;
-    int items = argc - 1;
-
-    /* This probably won't work on machines where sizeof(long) != sizeof(int)
-     * or where sizeof(long) != sizeof(char*).  But such machines will
-     * not likely have syscall implemented either, so who cares?
-     */
-
-    rb_secure(2);
-    if (argc == 0)
-	rb_raise(rb_eArgError, "too few arguments for syscall");
-    arg[0] = NUM2INT(argv[0]); argv++;
-    while (items--) {
-	if (FIXNUM_P(*argv)) {
-	    arg[i] = (unsigned long)NUM2INT(*argv);
-	}
-	else {
-	    VALUE v = *argv;
-
-	    StringValue(v);
-	    rb_str_modify(v);
-	    arg[i] = (unsigned long)RSTRING(v)->ptr;
-	}
-	argv++;
-	i++;
-    }
-    TRAP_BEG;
-    switch (argc) {
-      case 1:
-	retval = syscall(arg[0]);
-	break;
-      case 2:
-	retval = syscall(arg[0],arg[1]);
-	break;
-      case 3:
-	retval = syscall(arg[0],arg[1],arg[2]);
-	break;
-      case 4:
-	retval = syscall(arg[0],arg[1],arg[2],arg[3]);
-	break;
-      case 5:
-	retval = syscall(arg[0],arg[1],arg[2],arg[3],arg[4]);
-	break;
-      case 6:
-	retval = syscall(arg[0],arg[1],arg[2],arg[3],arg[4],arg[5]);
-	break;
-      case 7:
-	retval = syscall(arg[0],arg[1],arg[2],arg[3],arg[4],arg[5],arg[6]);
-	break;
-      case 8:
-	retval = syscall(arg[0],arg[1],arg[2],arg[3],arg[4],arg[5],arg[6],
-	  arg[7]);
-	break;
-#ifdef atarist
-      case 9:
-	retval = syscall(arg[0],arg[1],arg[2],arg[3],arg[4],arg[5],arg[6],
-	  arg[7], arg[8]);
-	break;
-      case 10:
-	retval = syscall(arg[0],arg[1],arg[2],arg[3],arg[4],arg[5],arg[6],
-	  arg[7], arg[8], arg[9]);
-	break;
-      case 11:
-	retval = syscall(arg[0],arg[1],arg[2],arg[3],arg[4],arg[5],arg[6],
-	  arg[7], arg[8], arg[9], arg[10]);
-	break;
-      case 12:
-	retval = syscall(arg[0],arg[1],arg[2],arg[3],arg[4],arg[5],arg[6],
-	  arg[7], arg[8], arg[9], arg[10], arg[11]);
-	break;
-      case 13:
-	retval = syscall(arg[0],arg[1],arg[2],arg[3],arg[4],arg[5],arg[6],
-	  arg[7], arg[8], arg[9], arg[10], arg[11], arg[12]);
-	break;
-      case 14:
-	retval = syscall(arg[0],arg[1],arg[2],arg[3],arg[4],arg[5],arg[6],
-	  arg[7], arg[8], arg[9], arg[10], arg[11], arg[12], arg[13]);
-	break;
-#endif /* atarist */
-    }
-    TRAP_END;
-    if (retval < 0) rb_sys_fail(0);
-    return INT2NUM(retval);
-#else
-    rb_notimplement();
-    return Qnil;		/* not reached */
-#endif
-}
-
-static VALUE
-rb_io_s_pipe()
-{
-#ifndef __human68k__
-    int pipes[2];
-    VALUE r, w;
-
-#ifdef NT
-    if (_pipe(pipes, 1024, O_BINARY) == -1)
-#else
-    if (pipe(pipes) == -1)
-#endif
-	rb_sys_fail(0);
-
-    r = prep_stdio(rb_fdopen(pipes[0], "r"), FMODE_READABLE, rb_cIO);
-    w = prep_stdio(rb_fdopen(pipes[1], "w"), FMODE_WRITABLE|FMODE_SYNC, rb_cIO);
-
-    return rb_assoc_new(r, w);
-#else
-    rb_notimplement();
-    return Qnil;		/* not reached */
-#endif
-}
-
-struct foreach_arg {
-    int argc;
-    VALUE sep;
-    VALUE io;
-    OpenFile *fptr;
-};
-
-static VALUE
-io_s_foreach(arg)
-    struct foreach_arg *arg;
-{
-    VALUE str;
-
-    while (!NIL_P(str = rb_io_getline(arg->sep, arg->fptr))) {
-	rb_yield(str);
-    }
-    return Qnil;
-}
-
-static VALUE
-rb_io_s_foreach(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE fname, io;
-    OpenFile *fptr;
-    struct foreach_arg arg;
-
-    rb_scan_args(argc, argv, "11", &fname, &arg.sep);
-    SafeStringValue(fname);
-
-    if (argc == 1) {
-	arg.sep = rb_default_rs;
-    }
-    io = rb_io_open(RSTRING(fname)->ptr, "r");
-    if (NIL_P(io)) return Qnil;
-    GetOpenFile(io, fptr);
-    arg.fptr = fptr;
-
-    return rb_ensure(io_s_foreach, (VALUE)&arg, rb_io_close, io);
-}
-
-static VALUE
-io_s_readlines(arg)
-    struct foreach_arg *arg;
-{
-    return rb_io_readlines(arg->argc, &arg->sep, arg->io);
-}
-
-static VALUE
-rb_io_s_readlines(argc, argv, io)
-    int argc;
-    VALUE *argv;
-    VALUE io;
-{
-    VALUE fname;
-    struct foreach_arg arg;
-
-    rb_scan_args(argc, argv, "11", &fname, &arg.sep);
-    SafeStringValue(fname);
-
-    arg.argc = argc - 1;
-    arg.io = rb_io_open(RSTRING(fname)->ptr, "r");
-    if (NIL_P(arg.io)) return Qnil;
-    return rb_ensure(io_s_readlines, (VALUE)&arg, rb_io_close, arg.io);
-}
-
-static VALUE
-io_s_read(arg)
-    struct foreach_arg *arg;
-{
-    return io_read(arg->argc, &arg->sep, arg->io);
-}
-
-static VALUE
-rb_io_s_read(argc, argv, io)
-    int argc;
-    VALUE *argv;
-    VALUE io;
-{
-    VALUE fname, offset;
-    struct foreach_arg arg;
-
-    rb_scan_args(argc, argv, "12", &fname, &arg.sep, &offset);
-    SafeStringValue(fname);
-
-    arg.argc = argc ? 1 : 0;
-    arg.io = rb_io_open(RSTRING(fname)->ptr, "r");
-    if (NIL_P(arg.io)) return Qnil;
-    if (!NIL_P(offset)) {
-	rb_io_seek(arg.io, offset, SEEK_SET);
-    }
-    return rb_ensure(io_s_read, (VALUE)&arg, rb_io_close, arg.io);
-}
-
-static VALUE
-argf_tell()
-{
-    if (!next_argv()) {
-	rb_raise(rb_eArgError, "no stream to tell");
-    }
-
-    if (TYPE(current_file) != T_FILE) {
-	return argf_forward();
-    }
-    return rb_io_tell(current_file);
-}
-
-static VALUE
-argf_seek_m(argc, argv, self)
-    int argc;
-    VALUE *argv;
-    VALUE self;
-{
-    if (!next_argv()) {
-	rb_raise(rb_eArgError, "no stream to seek");
-    }
-
-    if (TYPE(current_file) != T_FILE) {
-	return argf_forward();
-    }
-    return rb_io_seek_m(argc, argv, current_file);
-}
-
-static VALUE
-argf_set_pos(self, offset)
-     VALUE self, offset;
-{
-    if (!next_argv()) {
-	rb_raise(rb_eArgError, "no stream to set position");
-    }
-
-    if (TYPE(current_file) != T_FILE) {
-	return argf_forward();
-    }
-    return rb_io_set_pos(current_file, offset);
-}
-
-static VALUE
-argf_rewind()
-{
-    if (!next_argv()) {
-	rb_raise(rb_eArgError, "no stream to rewind");
-    }
-    if (TYPE(current_file) != T_FILE) {
-	return argf_forward();
-    }
-    return rb_io_rewind(current_file);
-}
-
-static VALUE
-argf_fileno()
-{
-    if (!next_argv()) {
-	rb_raise(rb_eArgError, "no stream");
-    }
-    if (TYPE(current_file) != T_FILE) {
-	return argf_forward();
-    }
-    return rb_io_fileno(current_file);
-}
-
-static VALUE
-argf_to_io()
-{
-    return current_file;
-}
-
-static VALUE
-argf_read(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE tmp, str;
-    int len = 0;
-
-    if (argc == 1) len = NUM2INT(argv[0]);
-    str = Qnil;
-
-  retry:
-    if (!next_argv()) return str;
-    if (TYPE(current_file) != T_FILE) {
-	tmp = argf_forward();
-	StringValue(tmp);
-    }
-    else {
-	tmp = io_read(argc, argv, current_file);
-    }
-    if (NIL_P(tmp) && next_p != -1) {
-	any_close(current_file);
-	next_p = 1;
-	goto retry;
-    }
-    if (NIL_P(tmp) || RSTRING(tmp)->len == 0) return str;
-    else if (NIL_P(str)) str = tmp;
-    else rb_str_append(str, tmp);
-    if (argc == 0) {
-	goto retry;
-    }
-    if (RSTRING(tmp)->len < len) {
-	len -= RSTRING(tmp)->len;
-	argv[0] = INT2FIX(len);
-	goto retry;
-    }
-
-    return str;
-}
-
-static VALUE
-argf_getc()
-{
-    VALUE byte;
-
-  retry:
-    if (!next_argv()) return Qnil;
-    if (TYPE(current_file) != T_FILE) {
-	byte = rb_funcall3(current_file, rb_intern("getc"), 0, 0);
-    }
-    else {
-	byte = rb_io_getc(current_file);
-    }
-    if (NIL_P(byte) && next_p != -1) {
-	any_close(current_file);
-	next_p = 1;
-	goto retry;
-    }
-
-    return byte;
-}
-
-static VALUE
-argf_readchar()
-{
-    VALUE c = argf_getc();
-
-    if (NIL_P(c)) {
-	rb_eof_error();
-    }
-    return c;
-}
-
-static VALUE
-argf_eof()
-{
-    if (!next_argv()) return Qtrue;
-    if (next_p == 1) {
-	return Qtrue;
-    }
-    if (TYPE(current_file) != T_FILE) {
-	return argf_forward();
-    }
-    if (rb_io_eof(current_file)) {
-	next_p = 1;
-	return Qtrue;
-    }
-    return Qfalse;
-}
-
-static VALUE
-argf_each_line(argc, argv)
-    int argc;
-    VALUE *argv;
-{
-    VALUE str;
-
-    while (RTEST(str = argf_getline(argc, argv))) {
-	rb_yield(str);
-    }
-    return argf;
-}
-
-static VALUE
-argf_each_byte()
-{
-    VALUE byte;
-
-    while (!NIL_P(byte = argf_getc())) {
-	rb_yield(byte);
-    }
-    return Qnil;
-}
-
-static VALUE
-argf_filename()
-{
-    next_argv();
-    return filename;
-}
-
-static VALUE
-argf_file()
-{
-    next_argv();
-    return current_file;
-}
-
-static VALUE
-argf_binmode()
-{
-    binmode = 1;
-    next_argv();
-    if (TYPE(current_file) != T_FILE) {
-	argf_forward();
-    }
-    else {
-	rb_io_binmode(current_file);
-    }
-    return argf;
-}
-
-static VALUE
-argf_skip()
-{
-    if (next_p != -1) {
-	any_close(current_file);
-	next_p = 1;
-    }
-    return argf;
-}
-
-static VALUE
-argf_close()
-{
-    any_close(current_file);
-    if (next_p != -1) {
-	next_p = 1;
-    }
-    gets_lineno = 0;
-    return argf;
-}
-
-static VALUE
-argf_closed()
-{
-    if (TYPE(current_file) != T_FILE) {
-	return argf_forward();
-    }
-    return rb_io_closed(current_file);
-}
-
-static VALUE
-opt_i_get()
-{
-    if (!ruby_inplace_mode) return Qnil;
-    return rb_str_new2(ruby_inplace_mode);
-}
-
-static void
-opt_i_set(val)
-    VALUE val;
-{
-    if (!RTEST(val)) {
-	if (ruby_inplace_mode) free(ruby_inplace_mode);
-	ruby_inplace_mode = 0;
-	return;
-    }
-    StringValue(val);
-    if (ruby_inplace_mode) free(ruby_inplace_mode);
-    ruby_inplace_mode = 0;
-    ruby_inplace_mode = strdup(RSTRING(val)->ptr);
-}
-
-void
-Init_IO()
-{
-    rb_eIOError = rb_define_class("IOError", rb_eStandardError);
-    rb_eEOFError = rb_define_class("EOFError", rb_eIOError);
-
-    id_write = rb_intern("write");
-
-    rb_define_global_function("syscall", rb_f_syscall, -1);
-
-    rb_define_global_function("open", rb_f_open, -1);
-    rb_define_global_function("printf", rb_f_printf, -1);
-    rb_define_global_function("print", rb_f_print, -1);
-    rb_define_global_function("putc", rb_f_putc, 1);
-    rb_define_global_function("puts", rb_f_puts, -1);
-    rb_define_global_function("gets", rb_f_gets, -1);
-    rb_define_global_function("readline", rb_f_readline, -1);
-    rb_define_global_function("getc", rb_f_getc, 0);
-    rb_define_global_function("select", rb_f_select, -1);
-
-    rb_define_global_function("readlines", rb_f_readlines, -1);
-
-    rb_define_global_function("`", rb_f_backquote, 1);
-
-    rb_define_global_function("p", rb_f_p, -1);
-    rb_define_method(rb_mKernel, "display", rb_obj_display, -1);
-
-    rb_cIO = rb_define_class("IO", rb_cObject);
-    rb_include_module(rb_cIO, rb_mEnumerable);
-
-    rb_define_singleton_method(rb_cIO, "allocate", rb_io_s_alloc, 0);
-    rb_define_singleton_method(rb_cIO, "new", rb_io_s_new, -1);
-    rb_define_singleton_method(rb_cIO, "open",  rb_io_s_open, -1);
-    rb_define_singleton_method(rb_cIO, "sysopen",  rb_io_s_sysopen, -1);
-    rb_define_singleton_method(rb_cIO, "for_fd", rb_class_new_instance, -1);
-    rb_define_singleton_method(rb_cIO, "popen", rb_io_s_popen, -1);
-    rb_define_singleton_method(rb_cIO, "foreach", rb_io_s_foreach, -1);
-    rb_define_singleton_method(rb_cIO, "readlines", rb_io_s_readlines, -1);
-    rb_define_singleton_method(rb_cIO, "read", rb_io_s_read, -1);
-    rb_define_singleton_method(rb_cIO, "select", rb_f_select, -1);
-    rb_define_singleton_method(rb_cIO, "pipe", rb_io_s_pipe, 0);
-
-    rb_define_method(rb_cIO, "initialize", rb_io_initialize, -1);
-
-    rb_output_fs = Qnil;
-    rb_define_hooked_variable("$,", &rb_output_fs, 0, rb_str_setter);
-
-    rb_rs = rb_default_rs = rb_str_new2("\n");
-    rb_output_rs = Qnil;
-    rb_global_variable(&rb_default_rs);
-    OBJ_FREEZE(rb_default_rs);	/* avoid modifying RS_default */
-    rb_define_variable("$/", &rb_rs);
-    rb_define_variable("$-0", &rb_rs);
-    rb_define_variable("$\\", &rb_output_rs);
-
-    rb_define_hooked_variable("$.", &lineno, 0, lineno_setter);
-    rb_define_virtual_variable("$_", rb_lastline_get, rb_lastline_set);
-
-    rb_define_method(rb_cIO, "clone", rb_io_clone, 0);
-    rb_define_method(rb_cIO, "reopen", rb_io_reopen, -1);
-
-    rb_define_method(rb_cIO, "print", rb_io_print, -1);
-    rb_define_method(rb_cIO, "putc", rb_io_putc, 1);
-    rb_define_method(rb_cIO, "puts", rb_io_puts, -1);
-    rb_define_method(rb_cIO, "printf", rb_io_printf, -1);
-
-    rb_define_method(rb_cIO, "each",  rb_io_each_line, -1);
-    rb_define_method(rb_cIO, "each_line",  rb_io_each_line, -1);
-    rb_define_method(rb_cIO, "each_byte",  rb_io_each_byte, 0);
-
-    rb_define_method(rb_cIO, "syswrite", rb_io_syswrite, 1);
-    rb_define_method(rb_cIO, "sysread",  rb_io_sysread, 1);
-
-    rb_define_method(rb_cIO, "fileno", rb_io_fileno, 0);
-    rb_define_alias(rb_cIO, "to_i", "fileno");
-    rb_define_method(rb_cIO, "to_io", rb_io_to_io, 0);
-
-    rb_define_method(rb_cIO, "fsync",   rb_io_fsync, 0);
-    rb_define_method(rb_cIO, "sync",   rb_io_sync, 0);
-    rb_define_method(rb_cIO, "sync=",  rb_io_set_sync, 1);
-
-    rb_define_method(rb_cIO, "lineno",   rb_io_lineno, 0);
-    rb_define_method(rb_cIO, "lineno=",  rb_io_set_lineno, 1);
-
-    rb_define_method(rb_cIO, "readlines",  rb_io_readlines, -1);
-
-    rb_define_method(rb_cIO, "read",  io_read, -1);
-    rb_define_method(rb_cIO, "write", io_write, 1);
-    rb_define_method(rb_cIO, "gets",  rb_io_gets_m, -1);
-    rb_define_method(rb_cIO, "readline",  rb_io_readline, -1);
-    rb_define_method(rb_cIO, "getc",  rb_io_getc, 0);
-    rb_define_method(rb_cIO, "readchar",  rb_io_readchar, 0);
-    rb_define_method(rb_cIO, "ungetc",rb_io_ungetc, 1);
-    rb_define_method(rb_cIO, "<<",    rb_io_addstr, 1);
-    rb_define_method(rb_cIO, "flush", rb_io_flush, 0);
-    rb_define_method(rb_cIO, "tell", rb_io_tell, 0);
-    rb_define_method(rb_cIO, "seek", rb_io_seek_m, -1);
-    rb_define_const(rb_cIO, "SEEK_SET", INT2FIX(SEEK_SET));
-    rb_define_const(rb_cIO, "SEEK_CUR", INT2FIX(SEEK_CUR));
-    rb_define_const(rb_cIO, "SEEK_END", INT2FIX(SEEK_END));
-    rb_define_method(rb_cIO, "rewind", rb_io_rewind, 0);
-    rb_define_method(rb_cIO, "pos", rb_io_tell, 0);
-    rb_define_method(rb_cIO, "pos=", rb_io_set_pos, 1);
-    rb_define_method(rb_cIO, "eof", rb_io_eof, 0);
-    rb_define_method(rb_cIO, "eof?", rb_io_eof, 0);
-
-    rb_define_method(rb_cIO, "close", rb_io_close_m, 0);
-    rb_define_method(rb_cIO, "closed?", rb_io_closed, 0);
-    rb_define_method(rb_cIO, "close_read", rb_io_close_read, 0);
-    rb_define_method(rb_cIO, "close_write", rb_io_close_write, 0);
-
-    rb_define_method(rb_cIO, "isatty", rb_io_isatty, 0);
-    rb_define_method(rb_cIO, "tty?", rb_io_isatty, 0);
-    rb_define_method(rb_cIO, "binmode",  rb_io_binmode, 0);
-    rb_define_method(rb_cIO, "sysseek", rb_io_sysseek, -1);
-
-    rb_define_method(rb_cIO, "ioctl", rb_io_ioctl, -1);
-    rb_define_method(rb_cIO, "fcntl", rb_io_fcntl, -1);
-    rb_define_method(rb_cIO, "pid", rb_io_pid, 0);
-    rb_define_method(rb_cIO, "inspect",  rb_io_inspect, 0);
-
-    rb_stdin = orig_stdin = prep_stdio(stdin, FMODE_READABLE, rb_cIO);
-    rb_define_hooked_variable("$stdin", &rb_stdin, 0, set_stdin);
-    rb_stdout = orig_stdout = prep_stdio(stdout, FMODE_WRITABLE, rb_cIO);
-    rb_define_hooked_variable("$stdout", &rb_stdout, 0, set_stdout);
-    rb_stderr = orig_stderr = prep_stdio(stderr, FMODE_WRITABLE, rb_cIO);
-    rb_define_hooked_variable("$stderr", &rb_stderr, 0, set_stderr);
-    rb_defout = rb_stdout;
-    rb_define_hooked_variable("$>", &rb_defout, 0, rb_io_defset);
-    rb_define_hooked_variable("$defout", &rb_defout, 0, rb_io_defset);
-
-    rb_define_global_const("STDIN", rb_stdin);
-    rb_define_global_const("STDOUT", rb_stdout);
-    rb_define_global_const("STDERR", rb_stderr);
-
-    argf = rb_obj_alloc(rb_cObject);
-    rb_extend_object(argf, rb_mEnumerable);
-
-    rb_define_readonly_variable("$<", &argf);
-    rb_define_global_const("ARGF", argf);
-
-    rb_define_singleton_method(argf, "fileno", argf_fileno, 0);
-    rb_define_singleton_method(argf, "to_i", argf_fileno, 0);
-    rb_define_singleton_method(argf, "to_io", argf_to_io, 0);
-    rb_define_singleton_method(argf, "each",  argf_each_line, -1);
-    rb_define_singleton_method(argf, "each_line",  argf_each_line, -1);
-    rb_define_singleton_method(argf, "each_byte",  argf_each_byte, 0);
-
-    rb_define_singleton_method(argf, "read",  argf_read, -1);
-    rb_define_singleton_method(argf, "readlines", rb_f_readlines, -1);
-    rb_define_singleton_method(argf, "to_a", rb_f_readlines, -1);
-    rb_define_singleton_method(argf, "gets", rb_f_gets, -1);
-    rb_define_singleton_method(argf, "readline", rb_f_readline, -1);
-    rb_define_singleton_method(argf, "getc", argf_getc, 0);
-    rb_define_singleton_method(argf, "readchar", argf_readchar, 0);
-    rb_define_singleton_method(argf, "tell", argf_tell, 0);
-    rb_define_singleton_method(argf, "seek", argf_seek_m, -1);
-    rb_define_singleton_method(argf, "rewind", argf_rewind, 0);
-    rb_define_singleton_method(argf, "pos", argf_tell, 0);
-    rb_define_singleton_method(argf, "pos=", argf_set_pos, 1);
-    rb_define_singleton_method(argf, "eof", argf_eof, 0);
-    rb_define_singleton_method(argf, "eof?", argf_eof, 0);
-    rb_define_singleton_method(argf, "binmode", argf_binmode, 0);
-
-    rb_define_singleton_method(argf, "to_s", argf_filename, 0);
-    rb_define_singleton_method(argf, "filename", argf_filename, 0);
-    rb_define_singleton_method(argf, "file", argf_file, 0);
-    rb_define_singleton_method(argf, "skip", argf_skip, 0);
-    rb_define_singleton_method(argf, "close", argf_close, 0);
-    rb_define_singleton_method(argf, "closed?", argf_closed, 0);
-
-    rb_define_singleton_method(argf, "lineno",   argf_lineno, 0);
-    rb_define_singleton_method(argf, "lineno=",  argf_set_lineno, 1);
-
-    current_file = rb_stdin;
-    rb_global_variable(¤t_file);
-    filename = rb_str_new2("-");
-    rb_define_readonly_variable("$FILENAME", &filename);
-
-    rb_define_virtual_variable("$-i", opt_i_get, opt_i_set);
-
-#if defined (NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__)
-    atexit(pipe_atexit);
-#endif
-
-    Init_File();
-
-    rb_define_method(rb_cFile, "initialize",  rb_file_initialize, -1);
-
-    rb_file_const("RDONLY", INT2FIX(O_RDONLY));
-    rb_file_const("WRONLY", INT2FIX(O_WRONLY));
-    rb_file_const("RDWR", INT2FIX(O_RDWR));
-    rb_file_const("APPEND", INT2FIX(O_APPEND));
-    rb_file_const("CREAT", INT2FIX(O_CREAT));
-    rb_file_const("EXCL", INT2FIX(O_EXCL));
-#if defined(O_NDELAY) || defined(O_NONBLOCK)
-#   ifdef O_NONBLOCK
-    rb_file_const("NONBLOCK", INT2FIX(O_NONBLOCK));
-#   else
-    rb_file_const("NONBLOCK", INT2FIX(O_NDELAY));
-#   endif
-#endif
-    rb_file_const("TRUNC", INT2FIX(O_TRUNC));
-#ifdef O_NOCTTY
-    rb_file_const("NOCTTY", INT2FIX(O_NOCTTY));
-#endif
-#ifdef O_BINARY
-    rb_file_const("BINARY", INT2FIX(O_BINARY));
-#endif
-#ifdef O_SYNC
-    rb_file_const("SYNC", INT2FIX(O_SYNC));
-#endif
-}
diff --git a/keywords b/keywords
deleted file mode 100644
index 6ba1be49fd..0000000000
--- a/keywords
+++ /dev/null
@@ -1,42 +0,0 @@
-struct kwtable {char *name; int id[2]; enum lex_state state;};
-%%
-__LINE__, k__LINE__, k__LINE__, EXPR_END
-__FILE__, k__FILE__, k__FILE__, EXPR_END
-BEGIN, klBEGIN, klBEGIN, EXPR_END
-END, klEND, klEND, EXPR_END
-alias, kALIAS, kALIAS, EXPR_FNAME
-and, kAND, kAND, EXPR_BEG
-begin, kBEGIN, kBEGIN, EXPR_BEG
-break, kBREAK, kBREAK, EXPR_MID
-case, kCASE, kCASE, EXPR_BEG
-class, kCLASS, kCLASS, EXPR_CLASS
-def, kDEF, kDEF, EXPR_FNAME
-defined?, kDEFINED, kDEFINED, EXPR_ARG
-do, kDO, kDO, EXPR_BEG
-else, kELSE, kELSE, EXPR_BEG
-elsif, kELSIF, kELSIF, EXPR_BEG
-end, kEND, kEND, EXPR_END
-ensure, kENSURE, kENSURE, EXPR_BEG
-false, kFALSE, kFALSE, EXPR_END
-for, kFOR, kFOR, EXPR_BEG
-if, kIF, kIF_MOD, EXPR_BEG
-in, kIN, kIN, EXPR_BEG
-module, kMODULE, kMODULE, EXPR_BEG
-next, kNEXT, kNEXT, EXPR_MID
-nil, kNIL, kNIL, EXPR_END
-not, kNOT, kNOT, EXPR_BEG
-or, kOR, kOR, EXPR_BEG
-redo, kREDO, kREDO, EXPR_END
-rescue, kRESCUE, kRESCUE_MOD, EXPR_MID
-retry, kRETRY, kRETRY, EXPR_END
-return, kRETURN, kRETURN, EXPR_MID
-self, kSELF, kSELF, EXPR_END
-super, kSUPER, kSUPER, EXPR_ARG
-then, kTHEN, kTHEN, EXPR_BEG
-true, kTRUE, kTRUE, EXPR_END
-undef, kUNDEF, kUNDEF, EXPR_FNAME
-unless, kUNLESS, kUNLESS_MOD, EXPR_BEG
-until, kUNTIL, kUNTIL_MOD, EXPR_BEG
-when, kWHEN, kWHEN, EXPR_BEG
-while, kWHILE, kWHILE_MOD, EXPR_BEG
-yield, kYIELD, kYIELD, EXPR_ARG
diff --git a/lex.c b/lex.c
deleted file mode 100644
index 67f1337987..0000000000
--- a/lex.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/* C code produced by gperf version 2.7.2 */
-/* Command-line: gperf -p -j1 -i 1 -g -o -t -N rb_reserved_word -k'1,3,$' ./keywords  */
-struct kwtable {char *name; int id[2]; enum lex_state state;};
-
-#define TOTAL_KEYWORDS 40
-#define MIN_WORD_LENGTH 2
-#define MAX_WORD_LENGTH 8
-#define MIN_HASH_VALUE 6
-#define MAX_HASH_VALUE 55
-/* maximum key range = 50, duplicates = 0 */
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-static unsigned int
-hash (str, len)
-     register const char *str;
-     register unsigned int len;
-{
-  static unsigned char asso_values[] =
-    {
-      56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 11, 56, 56, 36, 56,  1, 37,
-      31,  1, 56, 56, 56, 56, 29, 56,  1, 56,
-      56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 56, 56,  1, 56, 32,  1,  2,
-       1,  1,  4, 23, 56, 17, 56, 20,  9,  2,
-       9, 26, 14, 56,  5,  1,  1, 16, 56, 21,
-      20,  9, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
-      56, 56, 56, 56, 56, 56
-    };
-  register int hval = len;
-
-  switch (hval)
-    {
-      default:
-      case 3:
-        hval += asso_values[(unsigned char)str[2]];
-      case 2:
-      case 1:
-        hval += asso_values[(unsigned char)str[0]];
-        break;
-    }
-  return hval + asso_values[(unsigned char)str[len - 1]];
-}
-
-#ifdef __GNUC__
-__inline
-#endif
-struct kwtable *
-rb_reserved_word (str, len)
-     register const char *str;
-     register unsigned int len;
-{
-  static struct kwtable wordlist[] =
-    {
-      {""}, {""}, {""}, {""}, {""}, {""},
-      {"end", kEND, kEND, EXPR_END},
-      {"else", kELSE, kELSE, EXPR_BEG},
-      {"case", kCASE, kCASE, EXPR_BEG},
-      {"ensure", kENSURE, kENSURE, EXPR_BEG},
-      {"module", kMODULE, kMODULE, EXPR_BEG},
-      {"elsif", kELSIF, kELSIF, EXPR_BEG},
-      {"def", kDEF, kDEF, EXPR_FNAME},
-      {"rescue", kRESCUE, kRESCUE_MOD, EXPR_MID},
-      {"not", kNOT, kNOT, EXPR_BEG},
-      {"then", kTHEN, kTHEN, EXPR_BEG},
-      {"yield", kYIELD, kYIELD, EXPR_ARG},
-      {"for", kFOR, kFOR, EXPR_BEG},
-      {"self", kSELF, kSELF, EXPR_END},
-      {"false", kFALSE, kFALSE, EXPR_END},
-      {"retry", kRETRY, kRETRY, EXPR_END},
-      {"return", kRETURN, kRETURN, EXPR_MID},
-      {"true", kTRUE, kTRUE, EXPR_END},
-      {"if", kIF, kIF_MOD, EXPR_BEG},
-      {"defined?", kDEFINED, kDEFINED, EXPR_ARG},
-      {"super", kSUPER, kSUPER, EXPR_ARG},
-      {"undef", kUNDEF, kUNDEF, EXPR_FNAME},
-      {"break", kBREAK, kBREAK, EXPR_MID},
-      {"in", kIN, kIN, EXPR_BEG},
-      {"do", kDO, kDO, EXPR_BEG},
-      {"nil", kNIL, kNIL, EXPR_END},
-      {"until", kUNTIL, kUNTIL_MOD, EXPR_BEG},
-      {"unless", kUNLESS, kUNLESS_MOD, EXPR_BEG},
-      {"or", kOR, kOR, EXPR_BEG},
-      {"next", kNEXT, kNEXT, EXPR_MID},
-      {"when", kWHEN, kWHEN, EXPR_BEG},
-      {"redo", kREDO, kREDO, EXPR_END},
-      {"and", kAND, kAND, EXPR_BEG},
-      {"begin", kBEGIN, kBEGIN, EXPR_BEG},
-      {"__LINE__", k__LINE__, k__LINE__, EXPR_END},
-      {"class", kCLASS, kCLASS, EXPR_CLASS},
-      {"__FILE__", k__FILE__, k__FILE__, EXPR_END},
-      {"END", klEND, klEND, EXPR_END},
-      {"BEGIN", klBEGIN, klBEGIN, EXPR_END},
-      {"while", kWHILE, kWHILE_MOD, EXPR_BEG},
-      {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
-      {""},
-      {"alias", kALIAS, kALIAS, EXPR_FNAME}
-    };
-
-  if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
-    {
-      register int key = hash (str, len);
-
-      if (key <= MAX_HASH_VALUE && key >= 0)
-        {
-          register const char *s = wordlist[key].name;
-
-          if (*str == *s && !strcmp (str + 1, s + 1))
-            return &wordlist[key];
-        }
-    }
-  return 0;
-}
diff --git a/lib/English.rb b/lib/English.rb
deleted file mode 100644
index 625b035270..0000000000
--- a/lib/English.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-alias $ERROR_INFO              $!
-alias $ERROR_POSITION          $@
-alias $LOADED_FEATURES         $"
-alias $FS                      $;
-alias $FIELD_SEPARATOR         $;
-alias $OFS                     $,
-alias $OUTPUT_FIELD_SEPARATOR  $,
-alias $RS                      $/
-alias $INPUT_RECORD_SEPARATOR  $/
-alias $ORS                     $\
-alias $OUTPUT_RECORD_SEPARATOR $\
-alias $INPUT_LINE_NUMBER       $.
-alias $NR                      $.
-alias $LAST_READ_LINE          $_
-alias $DEFAULT_OUTPUT          $>
-alias $DEFAULT_INPUT           $<
-alias $PID                     $$
-alias $PROCESS_ID              $$
-alias $CHILD_STATUS            $?
-alias $LAST_MATCH_INFO         $~
-alias $IGNORECASE              $=
-alias $PROGRAM_NAME            $0
-alias $ARGV                    $*
-alias $MATCH                   $&
-alias $PREMATCH                $`
-alias $POSTMATCH               $'
-alias $LAST_PAREN_MATCH        $+
diff --git a/lib/Env.rb b/lib/Env.rb
deleted file mode 100644
index 452a28659e..0000000000
--- a/lib/Env.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# Env.rb -- imports environment variables as global variables, Perlish ;(
-# Usage:
-#
-#  require 'Env'
-#  p $USER
-#  $USER = "matz"
-#  p ENV["USER"]
-
-require 'importenv'
-
-if __FILE__ == $0
-  p $TERM
-  $TERM = nil
-  p $TERM
-  p ENV["TERM"]
-  $TERM = "foo"
-  p ENV["TERM"]
-end
diff --git a/lib/README b/lib/README
deleted file mode 100644
index 0aa5e37549..0000000000
--- a/lib/README
+++ /dev/null
@@ -1,75 +0,0 @@
-English.rb	lets Perl'ish global variables have English names
-Env.rb		loads importenv.rb
-README		this file
-base64.rb	encodes/decodes base64 (obsolete)
-benchmark.rb	a benchmark utility
-cgi-lib.rb	simple CGI support library (old style)
-cgi.rb		CGI support library
-cgi/session	CGI session class
-complex.rb	complex number suppor
-date.rb		date object
-date/format.rb	date parsing and formatting
-date2.rb	date object (obsolete; use date)
-debug.rb	ruby debugger
-delegate.rb	delegates messages to other object
-e2mmap.rb	exception utilities
-eregex.rb	extended regular expression (just a proof of concept)
-fileutils.rb	file utilities
-final.rb	adds finalizer to the object (simple)
-finalize.rb	adds finalizer to the object
-find.rb		traverses directory tree
-forwardable.rb	explicit delegation library
-ftools.rb	file tools
-ftplib.rb	obsolete - use net/ftp
-getoptlong.rb	GNU getoptlong compatible
-getopts.rb	parses command line options (use getoptlong)
-importenv.rb	imports environment variables as global variables
-irb.rb		interactive ruby
-jcode.rb	Japanese text handling (replace String methods)
-mailread.rb	reads mail headers
-mathn.rb	extended math operation
-matrix.rb	matrix calculation library
-mkmf.rb		Makefile maker
-monitor.rb	exclusive region monitor for thread
-mutex_m.rb	mutex mixin
-net/ftp.rb	ftp access
-net/http.rb	HTTP access
-net/imap.rb	IMAP4 access
-net/pop.rb	POP3 access
-net/protocol.rb	abstract class for net library (DO NOT USE)
-net/smtp.rb	SMTP access
-net/telnet.rb	telnet library
-observer.rb	observer desing pattern library (provides Observable)
-open3.rb	opens subprocess connection stdin/stdout/stderr
-ostruct.rb	python style object
-parsearg.rb	argument parser using getopts
-parsedate.rb	parses date string
-ping.rb		checks whether host is up, using TCP echo.
-pp.rb		pretty print objects
-prettyprint.rb	pretty printing algorithm
-profile.rb	ruby profiler
-pstore.rb	persistent object strage using marshal
-racc/parser.rb	racc (Ruby yACC) runtime
-rational.rb	rational number support
-readbytes.rb	define IO#readbytes
-resolv.rb	DNS resolver in Ruby
-resolv-replace.rb	replace Socket DNS by resolve.rb
-shell.rb	runs commands and does pipeline operations like shell
-shellwords.rb	split into words like shell
-singleton.rb	singleton design pattern library
-sync.rb		2 phase lock
-telnet.rb	obsolete - use net/telnet
-tempfile.rb	temporary file with automatic removal
-time.rb		RFC2822, RFC2616, ISO8601 style time formatting/parsing
-thread.rb	thread support
-thwait.rb	thread syncronization class
-timeout.rb	provides timeout
-tracer.rb	execution tracer
-tsort.rb	topological sorting
-uri.rb		URI support
-uri/ftp.rb	ftp scheme support
-uri/http.rb	http scheme support
-uri/https.rb	https scheme support
-uri/ldap.rb	ldap scheme support
-uri/mailto.rb	mailto scheme support
-weakref.rb	weak reference class
diff --git a/lib/base64.rb b/lib/base64.rb
deleted file mode 100644
index d7461d82e7..0000000000
--- a/lib/base64.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-require "kconv"
-
-def decode64(str)
-  str.unpack("m")[0]
-end
-
-def decode_b(str)
-  str.gsub!(/=\?ISO-2022-JP\?B\?([!->@-~]+)\?=/i) {
-    decode64($1)
-  }
-  str = Kconv::toeuc(str)
-  str.gsub!(/=\?SHIFT_JIS\?B\?([!->@-~]+)\?=/i) {
-    decode64($1)
-  }
-  str = Kconv::toeuc(str)
-  str.gsub!(/\n/, ' ') 
-  str.gsub!(/\0/, '')
-  str
-end
-
-def encode64(bin)
-  [bin].pack("m")
-end
-
-def b64encode(bin, len = 60)
-  encode64(bin).scan(/.{1,#{len}}/o) do
-    print $&, "\n"
-  end
-end 
diff --git a/lib/benchmark.rb b/lib/benchmark.rb
deleted file mode 100644
index 8237c0f3ed..0000000000
--- a/lib/benchmark.rb
+++ /dev/null
@@ -1,652 +0,0 @@
-#
-# benchmark.rb
-#
-=begin
-  2002-04-25: bmbm(): killed unused parameter @fmtstr (gotoken)
-  2001-11-26: Time.times renamed Process.times for ruby17 (gotoken#notwork.org)
-  2001-01-12: made bmbm module func.  bmbm return Tms array. 
-  2001-01-10: added bmbm, Job and INSTALL.rb (gotoken#notwork.org)
-  2000-04-00: report() prints tag before eval block (gotoken#notwork.org)
-  2000-02-22: report(): measure -> Benchmark::measure (nakahiro#sarion.co.jp)
-  2000-01-02: bug fix, documentation (gotoken#notwork.org)
-  2000-01-01: measure can take a tag as opt. (nobu.nakada#nifty.ne.jp)
-  2000-01-01: first release (gotoken#notwork.org)
-=end
-
-=begin
-= benchmark.rb
-
-== NAME
-((*benchmark.rb*)) - a benchmark utility
-
-== SYNOPSIS
-  ----------
-       require "benchmark"
-       include Benchmark
-  ----------
-
-== DESCRIPTION 
-
-benchmark.rb provides some utilities to measure and report the
-times used and passed to execute.  
-
-== SIMPLE EXAMPLE
-
-=== EXAMPLE 0
-To (()) the times to make (({"a"*1_000_000})):
-
-  ----------
-       puts measure{ "a"*1_000_000 }
-  ----------
-
-On my machine (FreeBSD 3.2 on P5100MHz) this reported as follows:
-
-  ----------
-         1.166667   0.050000   1.216667 (  0.571355)
-  ----------
-
-The above shows user time, system time, user+system, and really passed
-time.  The unit of time is second.
-
-=== EXAMPLE 1
-To do some experiments sequentially, (()) is useful:
-
-  ----------
-       n = 50000
-       bm do |x|
-         x.report{for i in 1..n; a = "1"; end}
-         x.report{n.times do   ; a = "1"; end}
-         x.report{1.upto(n) do ; a = "1"; end}
-       end
-  ----------
-
-The result:
-  ----------
-             user     system      total        real
-         1.033333   0.016667   1.016667 (  0.492106)
-         1.483333   0.000000   1.483333 (  0.694605)
-         1.516667   0.000000   1.516667 (  0.711077)
-  ----------
-
-=== EXAMPLE 2
-To put a label in each (()):
-
-  ----------
-       n = 50000
-       bm(7) do |x|
-         x.report("for:")   {for i in 1..n; a = "1"; end}
-         x.report("times:") {n.times do   ; a = "1"; end}
-         x.report("upto:")  {1.upto(n) do ; a = "1"; end}
-       end
-  ----------
-
-The option (({7})) specifies the offset of each report accoding to the
-longest label.
-
-This reports as follows:
-
-  ----------
-                    user     system      total        real
-       for:     1.050000   0.000000   1.050000 (  0.503462)
-       times:   1.533333   0.016667   1.550000 (  0.735473)
-       upto:    1.500000   0.016667   1.516667 (  0.711239)
-  ----------
-
-=== EXAMPLE 3
-
-By the way, benchmarks might seem to depend on the order of items.  It
-is caused by the cost of memory allocation and the garbage collection.
-To prevent this boresome, Benchmark::(()) is provided, e.g., to
-compare ways for sort array of strings:
-
-  ----------
-       require "rbconfig"
-       include Config
-       def file
-         open("%s/lib/ruby/%s.%s/tk.rb" % 
-              [CONFIG['prefix'],CONFIG['MAJOR'],CONFIG['MINOR']]).read
-       end
-
-       n = 10
-       bmbm do |x|
-         x.report("destructive!"){ 
-           t = (file*n).to_a; t.each{|line| line.upcase!}; t.sort!
-         }
-         x.report("method chain"){ 
-           t = (file*n).to_a.collect{|line| line.upcase}.sort
-         }
-       end
-  ----------
-
-This reports:
-
-  ----------
-       Rehearsal ------------------------------------------------
-       destructive!   2.664062   0.070312   2.734375 (  2.783401)
-       method chain   5.257812   0.156250   5.414062 (  5.736088)
-       --------------------------------------- total: 8.148438sec
-       
-                          user     system      total        real
-       destructive!   2.359375   0.007812   2.367188 (  2.381015)
-       method chain   3.046875   0.023438   3.070312 (  3.085816)
-  ----------
-
-=== EXAMPLE 4
-To report statistics of sequential experiments with unique label,
-(()) is available:
-
-  ----------
-       n = 50000
-       benchmark(" "*7 + CAPTION, 7, FMTSTR, ">total:", ">avg:") do |x|
-         tf = x.report("for:")  {for i in 1..n; a = "1"; end}
-         tt = x.report("times:"){n.times do   ; a = "1"; end}
-         tu = x.report("upto:") {1.upto(n) do ; a = "1"; end}
-         [tf+tt+tu, (tf+tt+tu)/3]
-       end
-  ----------
-
-The result:
-
-  ----------
-                    user     system      total        real
-       for:     1.016667   0.016667   1.033333 (  0.485749)
-       times:   1.450000   0.016667   1.466667 (  0.681367)
-       upto:    1.533333   0.000000   1.533333 (  0.722166)
-       >total:  4.000000   0.033333   4.033333 (  1.889282)
-       >avg:    1.333333   0.011111   1.344444 (  0.629761)
-  ----------
-
-== Benchmark module
-
-=== CONSTANT
-:CAPTION
-  CAPTION is a caption string which is used in Benchmark::(()) and 
-  Benchmark::Report#(()). 
-:FMTSTR
-  FMTSTR is a format string which is used in Benchmark::(()) and 
-  Benchmark::Report#(()). See also Benchmark::Tms#(()). 
-:BENCHMARK_VERSION
-  BENCHMARK_VERSION is version string which statnds for the last modification
-  date (YYYY-MM-DD). 
-
-=== INNER CLASS
-* (())
-* (())
-* (())
-
-=== MODULE FUNCTION
-==== benchmark
-  ----------
-       benchmark([caption [, label_width [, fmtstr]]]) do |x| ... end
-       benchmark([caption [, label_width [, fmtstr]]]) do array_of_Tms end
-       benchmark([caption [, label_width [, fmtstr [, labels...]]]]) do 
-         ...
-         array_of_Tms
-       end
-  ----------
-
-(({benchmark})) reports the times. In the first form the block variable x is
-treated as a (()) object, which has (()) method.
-In the second form, each member of array_of_Tms is reported in the
-specified form if the member is a (()) object.  The
-last form provides combined above two forms (See (())). 
-
-The following lists the meaning of each option. 
-
-:caption
- A string ((|caption|)) is printed once before execution of the given block. 
-
-:label_width
- An integer ((|label_width|)) is used as an offset in each report. 
-
-:fmtstr
- An string ((|fmtstr|)) is used to format each measurement. 
- See (())
-
-:labels
- The rest parameters labels is used as prefix of the format to the
- value of block, that is array_of_Tms.
-
-==== bm
-  ----------
-       bm([label_width [, labels ...]) do ... end
-  ----------
-
-(({bm})) is a simpler interface of (()). 
-(({bm})) acts as same as follows:
-
-  benchmark(" "*label_width + CAPTION, label_width, FMTSTR, *labels) do 
-    ... 
-  end
-
-==== bmbm
-  ----------
-       bmbm([label_width]) do |x|
-         x.item("label1") { .... } 
-         ....
-       end
-  ----------
-
-(({bmbm})) is yet another (()).  This utility function is
-provited to prevent a kind of job order dependency, which is caused
-by memory allocation and object creation.  The usage is similar to
-(()) but has less options and does extra three things:
-
-  (1) ((*Rehearsal*)): runs all items in the job (()) to allocate
-      enough memory.
-  (2) ((*GC*)): before each (())ment, invokes (({GC.start})) to
-      prevent the influence of previous job. 
-  (3) If given ((|label_width|)) is less than the maximal width of labels
-      given as ((|item|))'s argument, the latter is used.  
-      Because (({bmbm})) is a 2-pass procedure, this is possible. 
-
-(({bmbm})) returns an array which consists of Tms correspoding to each
-(({item})). 
-==== measure 
-  ----------
-       measure([label]) do ... end
-  ----------
-
-measure returns the times used and passed to execute the given block as a
-Benchmark::Tms object. 
-
-==== realtime
-  ----------
-       realtime do ... end
-  ----------
-
-realtime returns the times passed to execute the given block. 
-
-== Benchmark::Report
-
-=== CLASS METHOD
-
-==== Benchmark::Report::new(width)
-  ----------
-       Benchmark::Report::new([width [, fmtstr]])
-  ----------
-
-Usually, one doesn't have to use this method directly, 
-(({Benchmark::Report::new})) is called by (()) or (()). 
-((|width|)) and ((|fmtstr|)) are the offset of ((|label|)) and 
-format string responsively; Both of them are used in (()). 
-
-=== METHOD
-
-==== report
-
-  ----------
-       report(fmt, *args)
-  ----------
-
-This method reports label and time formated by ((|fmt|)).  See
-(()) of Benchmark::Tms for formatting rule.
-
-== Benchmark::Tms
-
-=== CLASS METHOD
-
-== Benchmark::Job
-
-=== CLASS METHOD
-
-==== Benchmark::Job::new
-  ----------
-       Benchmark::Job::new(width)
-  ----------
-
-Usually, one doesn't have to use this method directly,
-(({Benchmark::Job::new})) is called by (()). 
-((|width|)) is a initial value for the offset ((|label|)) for formatting. 
-(()) passes its argument ((|width|)) to this constructor. 
-
-=== METHOD
-
-==== item
-  ----------
-       item(((|lable|))){ .... }
-  ----------
-
-(({item})) registers a pair of (((|label|))) and given block as job (()). 
-==== width
-
-Maximum length of labels in (()) plus one.  
-
-==== list
-
-array of array which consists of label and jop proc. 
-
-==== report
-
-alias to (()).
-
-==== Benchmark::Tms::new
-  ----------
-       Benchmark::Tms::new([u [, s [, cu [, cs [, re [, l]]]]]])
-  ----------
-
-returns new Benchmark::Tms object which has
-((|u|))  as (()), 
-((|s|))  as (()), 
-((|cu|)) as (())
-((|cs|)) as (()), 
-((|re|)) as (()) and
-((|l|))  as ((