Skip to content
This repository
Browse code

Tag for 1.8.7.

git-svn-id: http://svn.ruby-lang.org/repos/ruby/tags/v1_8_7@16730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
commit 63055294bfa69855507e71143a1820bfdee3774b 1 parent 5b792fe
Akinori MUSHA authored May 31, 2008

Showing 54 changed files with 630 additions and 315 deletions. Show diff stats Hide diff stats

  1. 111  ChangeLog
  2. 32  NEWS
  3. 4  README
  4. 5  README.EXT
  5. 6  README.EXT.ja
  6. 4  README.ja
  7. 17  array.c
  8. 4  bcc32/Makefile.sub
  9. 22  configure.in
  10. 2  dir.c
  11. 83  enum.c
  12. 13  error.c
  13. 58  eval.c
  14. 2  ext/openssl/ossl_bn.c
  15. 6  ext/openssl/ossl_pkey_dh.c
  16. 2  ext/openssl/ossl_pkey_dsa.c
  17. 16  ext/openssl/ossl_rand.c
  18. 2  ext/openssl/ossl_x509store.c
  19. 9  ext/purelib.rb
  20. 10  ext/tk/sample/demos-en/toolbar.rb
  21. 6  ext/tk/sample/demos-en/ttkprogress.rb
  22. 68  ext/tk/sample/demos-en/widget
  23. 67  ext/tk/sample/demos-jp/widget
  24. 4  ext/zlib/extconf.rb
  25. 2  file.c
  26. 6  instruby.rb
  27. 2  intern.h
  28. 29  io.c
  29. 2  keywords
  30. 2  lex.c
  31. 13  lib/mkmf.rb
  32. 62  lib/singleton.rb
  33. 4  lib/webrick/httpservlet/cgihandler.rb
  34. 33  marshal.c
  35. 2  mkconfig.rb
  36. 2  numeric.c
  37. 11  object.c
  38. 20  pack.c
  39. 10  parse.y
  40. 53  range.c
  41. 9  re.c
  42. 9  ruby.c
  43. 6  ruby.h
  44. 8  signal.c
  45. 30  string.c
  46. 8  struct.c
  47. 1  test/ruby/test_array.rb
  48. 1  test/ruby/test_enum.rb
  49. 4  time.c
  50. 2  util.c
  51. 10  variable.c
  52. 31  version.c
  53. 16  version.h
  54. 4  win32/Makefile.sub
111  ChangeLog
... ...
@@ -1,3 +1,114 @@
  1
+Sat May 31 23:53:35 2008  Akinori MUSHA  <knu@iDaemons.org>
  2
+
  3
+	* .: Release as Ruby 1.8.7.
  4
+
  5
+Sat May 31 23:33:34 2008  Akinori MUSHA  <knu@iDaemons.org>
  6
+
  7
+	* README, README.ja: Add a note about default C flags.
  8
+
  9
+Sat May 31 22:11:15 2008  Kazuhiro NISHIYAMA  <zn@mbf.nifty.com>
  10
+
  11
+	* version.c (ruby_description, ruby_copyright): backported from
  12
+	  1.9. bug#19002, [ruby-dev:34883]
  13
+
  14
+	* error.c (report_bug): uses ruby_description.
  15
+
  16
+Sat May 31 20:56:04 2008  Akinori MUSHA  <knu@iDaemons.org>
  17
+
  18
+	* array.c (rb_ary_delete_if): should return enumerator if no block
  19
+	  is given.  [ruby-dev:34901]
  20
+
  21
+Sat May 31 18:28:17 2008  Nobuyoshi Nakada  <nobu@ruby-lang.org>
  22
+
  23
+	* suppress warnings with -Wwrite-string.
  24
+
  25
+Sat May 31 15:58:08 2008  Nobuyoshi Nakada  <nobu@ruby-lang.org>
  26
+
  27
+	* Makefile.in, configure.in (warnflags): defaulted to -Wall
  28
+	  -Wno-parentheses with gcc.  [ruby-dev:34810]
  29
+
  30
+Fri May 30 05:28:18 2008  NAKAMURA Usaku  <usa@ruby-lang.org>
  31
+
  32
+	* enum.c (count_i, count_iter_i, count_all_i): add prototypes for VC.
  33
+
  34
+Fri May 30 04:32:07 2008  Akinori MUSHA  <knu@iDaemons.org>
  35
+
  36
+	* enum.c (count_i, count_iter_i): Sync with trunk.
  37
+	  enum.c (enum_count, count_all_i, Init_Enumerable),
  38
+	  array.c (rb_ary_count): Sync with trunk.  If no argument or
  39
+	  block is given, count the number of all elements.
  40
+
  41
+Fri May 30 03:12:18 2008  Akinori MUSHA  <knu@iDaemons.org>
  42
+
  43
+	* ext/openssl/ossl_bn.c (ossl_bn_s_rand, ossl_bn_s_pseudo_rand):
  44
+	  Int should be enough here.
  45
+
  46
+Fri May 30 02:35:00 2008  Akinori MUSHA  <knu@iDaemons.org>
  47
+
  48
+	* ext/openssl/ossl_bn.c (ossl_bn_s_rand, ossl_bn_s_pseudo_rand),
  49
+	  ext/openssl/ossl_pkey_dh.c (ossl_dh_s_generate)
  50
+	  (ossl_dh_initialize),
  51
+	  ext/openssl/ossl_pkey_dsa.c (ossl_dsa_s_generate),
  52
+	  ext/openssl/ossl_rand.c (ossl_rand_bytes)
  53
+	  (ossl_rand_pseudo_bytes, ossl_rand_egd_bytes),
  54
+	  ext/openssl/ossl_x509store.c (ossl_x509stctx_set_error): Do not
  55
+	  use FIX2INT() without checking the value type.  Use NUM2INT()
  56
+	  instead; found by akr in [ruby-dev:34890].
  57
+
  58
+Thu May 29 20:07:45 2008  Akinori MUSHA  <knu@iDaemons.org>
  59
+
  60
+	* configure.in, win32/Makefile.sub, mkconfig.rb, instruby.rb,
  61
+	  ruby.c, lib/mkmf.rb, README.EXT, README.EXT.ja: Backport the
  62
+	  vendor_ruby directory support.
  63
+
  64
+Thu May 29 17:52:31 2008  Nobuyoshi Nakada  <nobu@ruby-lang.org>
  65
+
  66
+	* ext/zlib/extconf.rb: search zlib1, and regard mswin32 later than VC6
  67
+	  as WIN32.  [ruby-core:16984]
  68
+
  69
+Wed May 28 17:54:29 2008  Akinori MUSHA  <knu@iDaemons.org>
  70
+
  71
+	* string.c (rb_str_start_with): Remove an unused variable.
  72
+	  (rb_str_upto_m): Fix a prototype.
  73
+
  74
+Wed May 28 17:48:28 2008  Akinori MUSHA  <knu@iDaemons.org>
  75
+
  76
+	* range.c (range_step): Fix brokenness when a non-integer numeric
  77
+	  value is specified as step. [rubyspec]
  78
+	  (range_step): Make use of String#step internally if a string (or
  79
+	  string-alike) range is given.
  80
+
  81
+	* string.c (rb_str_upto_m, Init_String): Add an optional second
  82
+	  argument to specify if the last value should be included.
  83
+
  84
+Wed May 28 16:53:39 2008  Akinori MUSHA  <knu@iDaemons.org>
  85
+
  86
+	* array.c (rb_ary_slice_bang): Call rb_ary_modify_check() at the
  87
+	  beginning. [rubyspec]
  88
+
  89
+Wed May 28 16:12:44 2008  Akinori MUSHA  <knu@iDaemons.org>
  90
+
  91
+	* lib/webrick/httpservlet/cgihandler.rb (WEBrick::HTTPServlet::CGIHandler#do_GET):
  92
+	  Set the HTTP status code to 302 if a Location header field is
  93
+	  present and the status code is not valid as a client
  94
+	  redirection.  cf. RFC 3875 6.2.3, 6.2.4.
  95
+
  96
+Wed May 28 15:18:16 2008  Nobuyoshi Nakada  <nobu@ruby-lang.org>
  97
+
  98
+	* lib/singleton.rb (SingletonClassMethods): _load should be public.
  99
+
  100
+Wed May 28 12:52:41 2008  Nobuyoshi Nakada  <nobu@ruby-lang.org>
  101
+
  102
+	* marshal.c (w_object, marshal_dump, r_object0, marshal_load): search
  103
+	  private methods too.  [ruby-dev:34671]
  104
+
  105
+	* object.c (convert_type): ditto.
  106
+
  107
+Tue May 27 23:26:49 2008  Yukihiro Matsumoto  <matz@ruby-lang.org>
  108
+
  109
+	* error.c (rb_bug): description from rb_bug() should include
  110
+	  patchlevel.  [ruby-dev:34826]
  111
+
1 112
 Tue May 27 20:19:22 2008  Akinori MUSHA  <knu@iDaemons.org>
2 113
 
3 114
 	* array.c (rb_ary_slice_bang): Return an empty array instead of
32  NEWS
@@ -9,6 +9,31 @@ with all sufficient information, see the ChangeLog file.
9 9
 
10 10
 == Changes since the 1.8.6 release
11 11
 
  12
+=== Configuration changes
  13
+
  14
+* default C flags
  15
+
  16
+  Some C compiler flags may be added by default depending on your
  17
+  environment.  Specify optflags=.. and warnflags=.. as necessary to
  18
+  override them.
  19
+
  20
+* vendor_ruby directory
  21
+
  22
+  A new library directory named `vendor_ruby' is introduced in
  23
+  addition to `site_ruby'.  The idea is to separate libraries
  24
+  installed by the package system (`vendor') from manually (`site')
  25
+  installed libraries preventing the former from getting overwritten
  26
+  by the latter, while preserving the user option to override vendor
  27
+  libraries with site libraries. (`site_ruby' takes precedence over
  28
+  `vendor_ruby')
  29
+
  30
+  If you are a package maintainer, make each library package configure
  31
+  the library passing the `--vendor' option to `extconf.rb' so that
  32
+  the library files will get installed under `vendor_ruby'.
  33
+
  34
+  You can change the directory locations using configure options such
  35
+  as `--with-sitedir=DIR' and `--with-vendordir=DIR'.
  36
+
12 37
 === Library updates (outstanding ones only)
13 38
 
14 39
 * new library
@@ -241,11 +266,16 @@ with all sufficient information, see the ChangeLog file.
241 266
 
242 267
   * String#each_byte
243 268
   * String#each
244  
-  * String#each_lines
  269
+  * String#each_line
245 270
   * String#gsub(pattern)
246 271
 
247 272
     Return an enumerator if no block is given.
248 273
 
  274
+  * String#upto
  275
+
  276
+    An optional second argument is added to specify if the last value
  277
+    should be included.
  278
+
249 279
   * StopIteration
250 280
 
251 281
     New exception class that causes Kernel#loop to stop iteration when
4  README
@@ -70,6 +70,10 @@ This is what you need to do to compile and install Ruby:
70 70
 
71 71
   2. Run ./configure, which will generate config.h and Makefile.
72 72
 
  73
+     Some C compiler flags may be added by default depending on your
  74
+     environment.  Specify optflags=.. and warnflags=.. as necessary
  75
+     to override them.
  76
+
73 77
   3. Edit defines.h if you need.  Usually this step will not be needed.
74 78
 
75 79
   4. Remove comment mark(#) before the module names from ext/Setup (or
5  README.EXT
@@ -662,6 +662,11 @@ Try generating the Makefile by:
662 662
 
663 663
   ruby extconf.rb
664 664
 
  665
+If the library should be installed under vendor_ruby directory
  666
+instead of site_ruby directory, use --vendor option as follows.
  667
+
  668
+  ruby extconf.rb --vendor
  669
+
665 670
 You don't need this step if you put the extension library under the ext
666 671
 directory of the ruby source tree.  In that case, compilation of the
667 672
 interpreter will do this step for you.
6  README.EXT.ja
@@ -765,6 +765,12 @@ Makefile
765 765
 
766 766
 としてください.
767 767
 
  768
+site_ruby ディレクトリでなく、
  769
+vendor_ruby ディレクトリにインストールする場合には
  770
+以下のように --vendor オプションを加えてください.
  771
+
  772
+  ruby extconf.rb --vendor
  773
+
768 774
 ディレクトリをext以下に用意した場合にはRuby全体のmakeの時に
769 775
 自動的にMakefileが生成されますので,このステップは不要です.
770 776
 
4  README.ja
@@ -92,6 +92,10 @@ Ruby
92 92
 
93 93
   2. configureを実行してMakefileなどを生成する
94 94
 
  95
+     環境によってはデフォルトのCコンパイラ用オプションが付き
  96
+     ます.configureオプションで optflags=.. warnflags=.. 等
  97
+     で上書きできます.
  98
+
95 99
   3. (必要ならば)defines.hを編集する
96 100
 
97 101
      多分,必要無いと思います.
17  array.c
@@ -2080,6 +2080,7 @@ rb_ary_slice_bang(argc, argv, ary)
2080 2080
     VALUE arg1, arg2;
2081 2081
     long pos, len, orig_len;
2082 2082
 
  2083
+    rb_ary_modify_check(ary);
2083 2084
     if (rb_scan_args(argc, argv, "11", &arg1, &arg2) == 2) {
2084 2085
 	pos = NUM2LONG(arg1);
2085 2086
 	len = NUM2LONG(arg2);
@@ -2184,6 +2185,7 @@ static VALUE
2184 2185
 rb_ary_delete_if(ary)
2185 2186
     VALUE ary;
2186 2187
 {
  2188
+    RETURN_ENUMERATOR(ary, 0, 0);
2187 2189
     rb_ary_reject_bang(ary);
2188 2190
     return ary;
2189 2191
 }
@@ -3063,27 +3065,34 @@ rb_ary_nitems(ary)
3063 3065
 
3064 3066
 /*
3065 3067
  *  call-seq:
  3068
+ *     array.count      -> int
3066 3069
  *     array.count(obj) -> int
3067 3070
  *     array.count { |item| block }  -> int
3068 3071
  *  
3069  
- *  Returns the number of elements which equals to <i>obj</i>.
3070  
- *  If a block is given, counts tthe number of elements yielding a true value.
  3072
+ *  Returns the number of elements.  If an argument is given, counts
  3073
+ *  the number of elements which equals to <i>obj</i>.  If a block is
  3074
+ *  given, counts the number of elements yielding a true value.
3071 3075
  *
3072 3076
  *     ary = [1, 2, 4, 2]
  3077
+ *     ary.count             # => 4
3073 3078
  *     ary.count(2)          # => 2
3074 3079
  *     ary.count{|x|x%2==0}  # => 3
3075 3080
  *
3076 3081
  */
3077 3082
 
3078 3083
 static VALUE
3079  
-rb_ary_count(int argc, VALUE *argv, VALUE ary)
  3084
+rb_ary_count(argc, argv, ary)
  3085
+    int argc;
  3086
+    VALUE *argv;
  3087
+    VALUE ary;
3080 3088
 {
3081 3089
     long n = 0;
3082 3090
 
3083 3091
     if (argc == 0) {
3084 3092
 	VALUE *p, *pend;
3085 3093
 
3086  
-	RETURN_ENUMERATOR(ary, 0, 0);
  3094
+	if (!rb_block_given_p())
  3095
+	    return LONG2NUM(RARRAY_LEN(ary));
3087 3096
 
3088 3097
 	for (p = RARRAY_PTR(ary), pend = p + RARRAY_LEN(ary); p < pend; p++) {
3089 3098
 	    if (RTEST(rb_yield(*p))) n++;
4  bcc32/Makefile.sub
@@ -294,9 +294,12 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/bcc32/Makefile.sub
294 294
 \#define RUBY_LIB "/lib/ruby/$(MAJOR).$(MINOR)"
295 295
 \#define RUBY_SITE_LIB "/lib/ruby/site_ruby"
296 296
 \#define RUBY_SITE_LIB2 "/lib/ruby/site_ruby/$(MAJOR).$(MINOR)"
  297
+\#define RUBY_VENDOR_LIB "/lib/ruby/vendor_ruby"
  298
+\#define RUBY_VENDOR_LIB2 "/lib/ruby/vendor_ruby/$(MAJOR).$(MINOR)"
297 299
 \#define RUBY_PLATFORM "$(ARCH)-$(OS)"
298 300
 \#define RUBY_ARCHLIB "/lib/ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(OS)"
299 301
 \#define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(OS)"
  302
+\#define RUBY_VENDOR_ARCHLIB "/lib/ruby/vendor_ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(OS)"
300 303
 |
301 304
 	@exit > $@
302 305
 
@@ -409,6 +412,7 @@ s,@EXPORT_PREFIX@,_,;t t
409 412
 s,@arch@,$(ARCH)-$(OS),;t t
410 413
 s,@sitearch@,$(ARCH)-$(OS),;t t
411 414
 s,@sitedir@,$${prefix}/lib/ruby/site_ruby,;t t
  415
+s,@vendordir@,$${prefix}/lib/ruby/vendor_ruby,;t t
412 416
 s,@configure_args@,--enable-shared $(configure_args),;t t
413 417
 s,@configure_input@,$$configure_input,;t t
414 418
 s,@srcdir@,$(srcdir),;t t
22  configure.in
@@ -1710,9 +1710,28 @@ AC_DEFINE_UNQUOTED(RUBY_LIB, "${RUBY_LIB_PATH}")
1710 1710
 AC_DEFINE_UNQUOTED(RUBY_SITE_LIB, "${RUBY_SITE_LIB_PATH}")
1711 1711
 AC_DEFINE_UNQUOTED(RUBY_SITE_LIB2, "${RUBY_SITE_LIB_PATH2}")
1712 1712
 
  1713
+AC_ARG_WITH(vendordir,
  1714
+	    [  --with-vendordir=DIR    vendor libraries in DIR [PREFIX/lib/ruby/vendor_ruby]],
  1715
+            [vendordir=$withval],
  1716
+            [vendordir='${prefix}/lib/ruby/vendor_ruby'])
  1717
+VENDOR_DIR=`eval echo \\"${vendordir}\\"`
  1718
+case "$target_os" in
  1719
+  cygwin*|mingw*|*djgpp*|os2-emx*)
  1720
+    RUBY_VENDOR_LIB_PATH="`expr "$VENDOR_DIR" : "$prefix\(/.*\)"`" ||
  1721
+    RUBY_VENDOR_LIB_PATH="$VENDOR_DIR";;
  1722
+  *)
  1723
+    RUBY_VENDOR_LIB_PATH="$VENDOR_DIR";;
  1724
+esac
  1725
+RUBY_VENDOR_LIB_PATH2="${RUBY_VENDOR_LIB_PATH}/${MAJOR}.${MINOR}"
  1726
+
  1727
+AC_DEFINE_UNQUOTED(RUBY_LIB, "${RUBY_LIB_PATH}")
  1728
+AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB, "${RUBY_VENDOR_LIB_PATH}")
  1729
+AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB2, "${RUBY_VENDOR_LIB_PATH2}")
  1730
+
1713 1731
 AC_SUBST(arch)dnl
1714 1732
 AC_SUBST(sitearch)dnl
1715 1733
 AC_SUBST(sitedir)dnl
  1734
+AC_SUBST(vendordir)dnl
1716 1735
 
1717 1736
 configure_args=$ac_configure_args
1718 1737
 AC_SUBST(configure_args)dnl
@@ -1725,6 +1744,8 @@ if test "$fat_binary" != no ; then
1725 1744
 
1726 1745
     AC_DEFINE_UNQUOTED(RUBY_SITE_THIN_ARCHLIB,
1727 1746
                  "${RUBY_SITE_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
  1747
+    AC_DEFINE_UNQUOTED(RUBY_VENDOR_THIN_ARCHLIB,
  1748
+                 "${RUBY_VENDOR_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
1728 1749
     AC_DEFINE_UNQUOTED(RUBY_PLATFORM, __ARCHITECTURE__ "-${target_os}")
1729 1750
 else
1730 1751
     arch="${target_cpu}-${target_os}"
@@ -1738,6 +1759,7 @@ esac
1738 1759
 
1739 1760
 AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, "${RUBY_LIB_PATH}/${arch}")
1740 1761
 AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${RUBY_SITE_LIB_PATH2}/${sitearch}")
  1762
+AC_DEFINE_UNQUOTED(RUBY_VENDOR_ARCHLIB, "${RUBY_VENDOR_LIB_PATH2}/${sitearch}")
1741 1763
 
1742 1764
 AC_ARG_WITH(search-path,
1743 1765
 		[  --with-search-path=DIR specify the additional search path],
2  dir.c
@@ -475,7 +475,7 @@ dir_inspect(dir)
475 475
 
476 476
     Data_Get_Struct(dir, struct dir_data, dirp);
477 477
     if (dirp->path) {
478  
-	char *c = rb_obj_classname(dir);
  478
+	const char *c = rb_obj_classname(dir);
479 479
 	int len = strlen(c) + strlen(dirp->path) + 4;
480 480
 	VALUE s = rb_str_new(0, len);
481 481
 	snprintf(RSTRING_PTR(s), len+1, "#<%s:%s>", c, dirp->path);
83  enum.c
@@ -15,7 +15,7 @@
15 15
 #include "util.h"
16 16
 
17 17
 VALUE rb_mEnumerable;
18  
-static ID id_each, id_eqq, id_cmp;
  18
+static ID id_each, id_eqq, id_cmp, id_size;
19 19
 
20 20
 struct iter_method_arg {
21 21
     VALUE obj;
@@ -113,37 +113,57 @@ enum_grep(obj, pat)
113 113
     return ary;
114 114
 }
115 115
 
  116
+static VALUE count_i _((VALUE, VALUE));
116 117
 static VALUE
117  
-count_i(i, arg)
118  
-     VALUE i;
119  
-     VALUE *arg;
  118
+count_i(i, memop)
  119
+    VALUE i, memop;
120 120
 {
121  
-    if (rb_equal(i, arg[0])) {
122  
-	arg[1]++;
  121
+    VALUE *memo = (VALUE*)memop;
  122
+
  123
+    if (rb_equal(i, memo[1])) {
  124
+	memo[0]++;
123 125
     }
124 126
     return Qnil;
125 127
 }
126 128
 
  129
+static VALUE count_iter_i _((VALUE, VALUE));
127 130
 static VALUE
128  
-count_iter_i(i, n)
129  
-     VALUE i;
130  
-     long *n;
  131
+count_iter_i(i, memop)
  132
+    VALUE i, memop;
131 133
 {
  134
+    VALUE *memo = (VALUE*)memop;
  135
+
132 136
     if (RTEST(rb_yield(i))) {
133  
-	(*n)++;
  137
+	memo[0]++;
134 138
     }
135 139
     return Qnil;
136 140
 }
137 141
 
  142
+static VALUE count_all_i _((VALUE, VALUE));
  143
+static VALUE
  144
+count_all_i(i, memop)
  145
+    VALUE i, memop;
  146
+{
  147
+    VALUE *memo = (VALUE*)memop;
  148
+
  149
+    memo[0]++;
  150
+    return Qnil;
  151
+}
  152
+
138 153
 /*
139 154
  *  call-seq:
  155
+ *     enum.count                   => int
140 156
  *     enum.count(item)             => int
141 157
  *     enum.count {| obj | block }  => int
142 158
  *
143  
- *  Returns the number of items in <i>enum</i> for which equals to <i>item</i>.
144  
- *  If a block is given, counts the number of elements yielding a true value.
  159
+ *  Returns the number of items in <i>enum</i>, where #size is called
  160
+ *  if it responds to it, otherwise the items are counted through
  161
+ *  enumeration.  If an argument is given, counts the number of items
  162
+ *  in <i>enum</i>, for which equals to <i>item</i>.  If a block is
  163
+ *  given, counts the number of elements yielding a true value.
145 164
  *
146 165
  *     ary = [1, 2, 4, 2]
  166
+ *     ary.count             # => 4
147 167
  *     ary.count(2)          # => 2
148 168
  *     ary.count{|x|x%2==0}  # => 3
149 169
  *
@@ -155,31 +175,31 @@ enum_count(argc, argv, obj)
155 175
     VALUE *argv;
156 176
     VALUE obj;
157 177
 {
158  
-    if (argc == 1) {
159  
-	VALUE item, args[2];
  178
+    VALUE memo[2];	/* [count, condition value] */
  179
+    rb_block_call_func *func;
160 180
 
  181
+    if (argc == 0) {
161 182
 	if (rb_block_given_p()) {
162  
-	    rb_warn("given block not used");
  183
+	    func = count_iter_i;
  184
+	}
  185
+	else {
  186
+	    if (rb_respond_to(obj, id_size)) {
  187
+		return rb_funcall(obj, id_size, 0, 0);
  188
+	    }
  189
+	    func = count_all_i;
163 190
 	}
164  
-	rb_scan_args(argc, argv, "1", &item);
165  
-	args[0] = item;
166  
-	args[1] = 0;
167  
-	rb_block_call(obj, id_each, 0, 0, count_i, (VALUE)&args);
168  
-	return INT2NUM(args[1]);
169  
-    }
170  
-    else if (argc == 0) {
171  
-	long n;
172  
-
173  
-	RETURN_ENUMERATOR(obj, 0, 0);
174  
-	n = 0;
175  
-	rb_block_call(obj, id_each, 0, 0, count_iter_i, (VALUE)&n);
176  
-	return INT2NUM(n);
177 191
     }
178 192
     else {
179  
-        VALUE v;
180  
-	rb_scan_args(argc, argv, "1", &v);
181  
-        return Qnil; /* not reached */
  193
+	rb_scan_args(argc, argv, "1", &memo[1]);
  194
+	if (rb_block_given_p()) {
  195
+	    rb_warn("given block not used");
  196
+	}
  197
+        func = count_i;
182 198
     }
  199
+
  200
+    memo[0] = 0;
  201
+    rb_block_call(obj, id_each, 0, 0, func, (VALUE)&memo);
  202
+    return INT2NUM(memo[0]);
183 203
 }
184 204
 
185 205
 static VALUE
@@ -1866,5 +1886,6 @@ Init_Enumerable()
1866 1886
     id_eqq  = rb_intern("===");
1867 1887
     id_each = rb_intern("each");
1868 1888
     id_cmp  = rb_intern("<=>");
  1889
+    id_size = rb_intern("size");
1869 1890
 }
1870 1891
 
13  error.c
@@ -29,7 +29,7 @@
29 29
 #define EXIT_SUCCESS 0
30 30
 #endif
31 31
 
32  
-extern const char ruby_version[], ruby_release_date[], ruby_platform[];
  32
+extern const char *ruby_description;
33 33
 
34 34
 int ruby_nerrs;
35 35
 
@@ -208,8 +208,7 @@ rb_bug(fmt, va_alist)
208 208
 	va_init_list(args, fmt);
209 209
 	vfprintf(out, fmt, args);
210 210
 	va_end(args);
211  
-	fprintf(out, "\nruby %s (%s) [%s]\n\n",
212  
-		ruby_version, ruby_release_date, ruby_platform);
  211
+	fprintf(out, "\n%s\n\n", ruby_description);
213 212
     }
214 213
     abort();
215 214
 }
@@ -258,7 +257,7 @@ rb_check_type(x, t)
258 257
     if (TYPE(x) != t) {
259 258
 	while (type->type >= 0) {
260 259
 	    if (type->type == t) {
261  
-		char *etype;
  260
+		const char *etype;
262 261
 
263 262
 		if (NIL_P(x)) {
264 263
 		    etype = "nil";
@@ -499,7 +498,7 @@ rb_check_backtrace(bt)
499 498
     VALUE bt;
500 499
 {
501 500
     long i;
502  
-    static char *err = "backtrace must be Array of String";
  501
+    static const char err[] = "backtrace must be Array of String";
503 502
 
504 503
     if (!NIL_P(bt)) {
505 504
 	int t = TYPE(bt);
@@ -728,7 +727,7 @@ name_err_mesg_to_str(obj)
728 727
     mesg = ptr[0];
729 728
     if (NIL_P(mesg)) return Qnil;
730 729
     else {
731  
-	char *desc = 0;
  730
+	const char *desc = 0;
732 731
 	VALUE d = 0, args[3];
733 732
 
734 733
 	obj = ptr[1];
@@ -882,7 +881,7 @@ syserr_initialize(argc, argv, self)
882 881
 #if !defined(_WIN32) && !defined(__VMS)
883 882
     char *strerror();
884 883
 #endif
885  
-    char *err;
  884
+    const char *err;
886 885
     VALUE mesg, error;
887 886
     VALUE klass = rb_obj_class(self);
888 887
 
58  eval.c
@@ -1103,8 +1103,8 @@ static void scope_dup _((struct SCOPE *));
1103 1103
 } while (0)
1104 1104
 
1105 1105
 static VALUE rb_eval _((VALUE,NODE*));
1106  
-static VALUE eval _((VALUE,VALUE,VALUE,char*,int));
1107  
-static NODE *compile _((VALUE, char*, int));
  1106
+static VALUE eval _((VALUE,VALUE,VALUE,const char*,int));
  1107
+static NODE *compile _((VALUE, const char*, int));
1108 1108
 
1109 1109
 static VALUE rb_yield_0 _((VALUE, VALUE, VALUE, int, int));
1110 1110
 
@@ -1227,7 +1227,7 @@ error_print()
1227 1227
 {
1228 1228
     VALUE errat = Qnil;		/* OK */
1229 1229
     volatile VALUE eclass, e;
1230  
-    char *einfo;
  1230
+    const char *einfo;
1231 1231
     long elen;
1232 1232
 
1233 1233
     if (NIL_P(ruby_errinfo)) return;
@@ -2032,7 +2032,7 @@ void
2032 2032
 rb_frozen_class_p(klass)
2033 2033
     VALUE klass;
2034 2034
 {
2035  
-    char *desc = "something(?!)";
  2035
+    const char *desc = "something(?!)";
2036 2036
 
2037 2037
     if (OBJ_FROZEN(klass)) {
2038 2038
 	if (FL_TEST(klass, FL_SINGLETON))
@@ -2070,7 +2070,7 @@ rb_undef(klass, id)
2070 2070
     }
2071 2071
     body = search_method(klass, id, &origin);
2072 2072
     if (!body || !body->nd_body) {
2073  
-	char *s0 = " class";
  2073
+	const char *s0 = " class";
2074 2074
 	VALUE c = klass;
2075 2075
 
2076 2076
 	if (FL_TEST(c, FL_SINGLETON)) {
@@ -2322,9 +2322,9 @@ rb_copy_node_scope(node, rval)
2322 2322
 
2323 2323
 #define MATCH_DATA *rb_svar(node->nd_cnt)
2324 2324
 
2325  
-static char* is_defined _((VALUE, NODE*, char*));
  2325
+static const char* is_defined _((VALUE, NODE*, char*));
2326 2326
 
2327  
-static char*
  2327
+static const char*
2328 2328
 arg_defined(self, node, buf, type)
2329 2329
     VALUE self;
2330 2330
     NODE *node;
@@ -2351,7 +2351,7 @@ arg_defined(self, node, buf, type)
2351 2351
     return type;
2352 2352
 }
2353 2353
 
2354  
-static char*
  2354
+static const char*
2355 2355
 is_defined(self, node, buf)
2356 2356
     VALUE self;
2357 2357
     NODE *node;			/* OK */
@@ -2671,27 +2671,27 @@ set_trace_func(obj, trace)
2671 2671
     return trace;
2672 2672
 }
2673 2673
 
2674  
-static char *
  2674
+static const char *
2675 2675
 get_event_name(rb_event_t event)
2676 2676
 {
2677 2677
     switch (event) {
2678  
-    case RUBY_EVENT_LINE:
  2678
+      case RUBY_EVENT_LINE:
2679 2679
 	return "line";
2680  
-    case RUBY_EVENT_CLASS:
  2680
+      case RUBY_EVENT_CLASS:
2681 2681
 	return "class";
2682  
-    case RUBY_EVENT_END:
  2682
+      case RUBY_EVENT_END:
2683 2683
 	return "end";
2684  
-    case RUBY_EVENT_CALL:
  2684
+      case RUBY_EVENT_CALL:
2685 2685
 	return "call";
2686  
-    case RUBY_EVENT_RETURN:
  2686
+      case RUBY_EVENT_RETURN:
2687 2687
 	return "return";
2688  
-    case RUBY_EVENT_C_CALL:
  2688
+      case RUBY_EVENT_C_CALL:
2689 2689
 	return "c-call";
2690  
-    case RUBY_EVENT_C_RETURN:
  2690
+      case RUBY_EVENT_C_RETURN:
2691 2691
 	return "c-return";
2692  
-    case RUBY_EVENT_RAISE:
  2692
+      case RUBY_EVENT_RAISE:
2693 2693
 	return "raise";
2694  
-    default:
  2694
+      default:
2695 2695
 	return "unknown";
2696 2696
     }
2697 2697
 }
@@ -2708,7 +2708,7 @@ call_trace_func(event, node, self, id, klass)
2708 2708
     struct FRAME *prev;
2709 2709
     NODE *node_save;
2710 2710
     VALUE srcfile;
2711  
-    char *event_name;
  2711
+    const char *event_name;
2712 2712
 
2713 2713
     if (!trace_func) return;
2714 2714
     if (tracing) return;
@@ -4136,7 +4136,7 @@ rb_eval(self, n)
4136 4136
       case NODE_DEFINED:
4137 4137
 	{
4138 4138
 	    char buf[20];
4139  
-	    char *desc = is_defined(self, node->nd_head, buf);
  4139
+	    const char *desc = is_defined(self, node->nd_head, buf);
4140 4140
 
4141 4141
 	    if (desc) result = rb_str_new2(desc);
4142 4142
 	    else result = Qnil;
@@ -4804,7 +4804,7 @@ proc_jump_error(state, result)
4804 4804
     VALUE result;
4805 4805
 {
4806 4806
     char mesg[32];
4807  
-    char *statement;
  4807
+    const char *statement;
4808 4808
 
4809 4809
     switch (state) {
4810 4810
       case TAG_BREAK:
@@ -5638,7 +5638,7 @@ rb_method_missing(argc, argv, obj)
5638 5638
 {
5639 5639
     ID id;
5640 5640
     VALUE exc = rb_eNoMethodError;
5641  
-    char *format = 0;
  5641
+    const char *format = 0;
5642 5642
     NODE *cnode = ruby_current_node;
5643 5643
 
5644 5644
     if (argc == 0 || !SYMBOL_P(argv[0])) {
@@ -6448,7 +6448,7 @@ rb_frame_this_func()
6448 6448
 static NODE*
6449 6449
 compile(src, file, line)
6450 6450
     VALUE src;
6451  
-    char *file;
  6451
+    const char *file;
6452 6452
     int line;
6453 6453
 {
6454 6454
     NODE *node;
@@ -6468,7 +6468,7 @@ compile(src, file, line)
6468 6468
 static VALUE
6469 6469
 eval(self, src, scope, file, line)
6470 6470
     VALUE self, src, scope;
6471  
-    char *file;
  6471
+    const char *file;
6472 6472
     int line;
6473 6473
 {
6474 6474
     struct BLOCK *data = NULL;
@@ -6629,7 +6629,7 @@ rb_f_eval(argc, argv, self)
6629 6629
     VALUE self;
6630 6630
 {
6631 6631
     VALUE src, scope, vfile, vline;
6632  
-    char *file = "(eval)";
  6632
+    const char *file = "(eval)";
6633 6633
     int line = 1;
6634 6634
 
6635 6635
     rb_scan_args(argc, argv, "13", &src, &scope, &vfile, &vline);
@@ -6783,7 +6783,7 @@ specific_eval(argc, argv, klass, self)
6783 6783
 	return yield_under(klass, self, Qundef);
6784 6784
     }
6785 6785
     else {
6786  
-	char *file = "(eval)";
  6786
+	const char *file = "(eval)";
6787 6787
 	int   line = 1;
6788 6788
 
6789 6789
 	if (argc == 0) {
@@ -9014,7 +9014,7 @@ proc_to_s(self)
9014 9014
 {
9015 9015
     struct BLOCK *data;
9016 9016
     NODE *node;
9017  
-    char *cname = rb_obj_classname(self);
  9017
+    const char *cname = rb_obj_classname(self);
9018 9018
     const int w = (sizeof(VALUE) * CHAR_BIT) / 4;
9019 9019
     long len = strlen(cname)+6+w; /* 6:tags 16:addr */
9020 9020
     VALUE str;
@@ -9748,7 +9748,7 @@ method_inspect(method)
9748 9748
     struct METHOD *data;
9749 9749
     VALUE str;
9750 9750
     const char *s;
9751  
-    char *sharp = "#";
  9751
+    const char *sharp = "#";
9752 9752
 
9753 9753
     Data_Get_Struct(method, struct METHOD, data);
9754 9754
     str = rb_str_buf_new2("#<");
@@ -12923,7 +12923,7 @@ static VALUE
12923 12923
 rb_thread_inspect(thread)
12924 12924
     VALUE thread;
12925 12925
 {
12926  
-    char *cname = rb_obj_classname(thread);
  12926
+    const char *cname = rb_obj_classname(thread);
12927 12927
     rb_thread_t th = rb_thread_check(thread);
12928 12928
     const char *status = thread_status_name(th->status);
12929 12929
     VALUE str;
2  ext/openssl/ossl_bn.c
@@ -515,7 +515,7 @@ BIGNUM_SELF_SHIFT(rshift);
515 515
 	    bottom = (odd == Qtrue) ? 1 : 0;			\
516 516
 	    /* FALLTHROUGH */					\
517 517
 	case 2:							\
518  
-	    top = FIX2INT(fill);				\
  518
+	    top = NUM2INT(fill);				\
519 519
 	}							\
520 520
 	b = NUM2INT(bits);					\
521 521
 	if (!(result = BN_new())) {				\
6  ext/openssl/ossl_pkey_dh.c
@@ -116,9 +116,9 @@ ossl_dh_s_generate(int argc, VALUE *argv, VALUE klass)
116 116
     VALUE size, gen, obj;
117 117
 	
118 118
     if (rb_scan_args(argc, argv, "11", &size, &gen) == 2) {
119  
-	g = FIX2INT(gen);
  119
+	g = NUM2INT(gen);
120 120
     }
121  
-    dh = dh_generate(FIX2INT(size), g);
  121
+    dh = dh_generate(NUM2INT(size), g);
122 122
     obj = dh_instance(klass, dh);
123 123
     if (obj == Qfalse) {
124 124
 	DH_free(dh);
@@ -158,7 +158,7 @@ ossl_dh_initialize(int argc, VALUE *argv, VALUE self)
158 158
     }
159 159
     else if (FIXNUM_P(arg)) {
160 160
 	if (!NIL_P(gen)) {
161  
-	    g = FIX2INT(gen);
  161
+	    g = NUM2INT(gen);
162 162
 	}
163 163
 	if (!(dh = dh_generate(FIX2INT(arg), g))) {
164 164
 	    ossl_raise(eDHError, NULL);
2  ext/openssl/ossl_pkey_dsa.c
@@ -110,7 +110,7 @@ dsa_generate(int size)
110 110
 static VALUE
111 111
 ossl_dsa_s_generate(VALUE klass, VALUE size)
112 112
 {
113  
-    DSA *dsa = dsa_generate(FIX2INT(size)); /* err handled by dsa_instance */
  113
+    DSA *dsa = dsa_generate(NUM2INT(size)); /* err handled by dsa_instance */
114 114
     VALUE obj = dsa_instance(klass, dsa);
115 115
 
116 116
     if (obj == Qfalse) {
16  ext/openssl/ossl_rand.c
@@ -96,9 +96,10 @@ static VALUE
96 96
 ossl_rand_bytes(VALUE self, VALUE len)
97 97
 {
98 98
     VALUE str;
99  
-	
100  
-    str = rb_str_new(0, FIX2INT(len));
101  
-    if (!RAND_bytes(RSTRING_PTR(str), FIX2INT(len))) {
  99
+    int n = NUM2INT(len);
  100
+
  101
+    str = rb_str_new(0, n);
  102
+    if (!RAND_bytes(RSTRING_PTR(str), n)) {
102 103
 	ossl_raise(eRandomError, NULL);
103 104
     }
104 105
 
@@ -114,9 +115,10 @@ static VALUE
114 115
 ossl_rand_pseudo_bytes(VALUE self, VALUE len)
115 116
 {
116 117
     VALUE str;
  118
+    int n = NUM2INT(len);
117 119
 
118  
-    str = rb_str_new(0, FIX2INT(len));
119  
-    if (!RAND_pseudo_bytes(RSTRING_PTR(str), FIX2INT(len))) {
  120
+    str = rb_str_new(0, n);
  121
+    if (!RAND_pseudo_bytes(RSTRING_PTR(str), n)) {
120 122
 	ossl_raise(eRandomError, NULL);
121 123
     }
122 124
 
@@ -147,9 +149,11 @@ ossl_rand_egd(VALUE self, VALUE filename)
147 149
 static VALUE
148 150
 ossl_rand_egd_bytes(VALUE self, VALUE filename, VALUE len)
149 151
 {
  152
+    long n = NUM2INT(len);
  153
+
150 154
     SafeStringValue(filename);
151 155
 
152  
-    if (!RAND_egd_bytes(RSTRING_PTR(filename), FIX2INT(len))) {
  156
+    if (!RAND_egd_bytes(RSTRING_PTR(filename), n)) {
153 157
 	ossl_raise(eRandomError, NULL);
154 158
     }
155 159
     return Qtrue;
2  ext/openssl/ossl_x509store.c
@@ -458,7 +458,7 @@ ossl_x509stctx_set_error(VALUE self, VALUE err)
458 458
     X509_STORE_CTX *ctx;
459 459
 
460 460
     GetX509StCtx(self, ctx);
461  
-    X509_STORE_CTX_set_error(ctx, FIX2INT(err));
  461
+    X509_STORE_CTX_set_error(ctx, NUM2INT(err));
462 462
 
463 463
     return err;
464 464
 }
9  ext/purelib.rb
... ...
@@ -1,3 +1,10 @@
1  
-if nul = $:.find_index {|path| /\A(?:\.\/)*-\z/ =~ path}
  1
+nul = nil
  2
+$:.each_with_index {|path, index|
  3
+  if /\A(?:\.\/)*-\z/ =~ path
  4
+    nul = index
  5
+    break
  6
+  end
  7
+}
  8
+if nul
2 9
   $:[nul..-1] = ["."]
3 10
 end
10  ext/tk/sample/demos-en/toolbar.rb
@@ -18,11 +18,12 @@
18 18
 base_frame = Ttk::Frame.new($toolbar_demo).pack(:fill=>:both, :expand=>true)
19 19
 
20 20
 if Tk.windowingsystem != 'aqua'
21  
-  msg = Ttk::Label.new(base_frame, :wraplength=>'4i', :text=><<EOL)
  21
+  msg = Ttk::Label.new(base_frame, :wraplength=>'4i', 
  22
+                       :text=>Tk::UTF8_String.new(<<EOL))
22 23
 This is a demonstration of how to do \
23 24
 a toolbar that is styled correctly \
24 25
 and which can be torn off (this feature reqrires Tcl/Tk8.5). \
25  
-The buttons are configured to be \u201Ctoolbar style\u201D buttons by \
  26
+The buttons are configured to be \\u201Ctoolbar style\\u201D buttons by \
26 27
 telling them that they are to use the Toolbutton style. At the left \
27 28
 end of the toolbar is a simple marker that the cursor changes to a \
28 29
 movement icon over; drag that away from the toolbar to tear off the \
@@ -31,10 +32,11 @@
31 32
 and it will reattach to the window it was torn off from.
32 33
 EOL
33 34
 else
34  
-  msg = Ttk::Label.new(base_frame, :wraplength=>'4i', :text=><<EOL)
  35
+  msg = Ttk::Label.new(base_frame, :wraplength=>'4i', 
  36
+                       :text=>Tk::UTF8_String.new(<<EOL))
35 37
 This is a demonstration of how to do \
36 38
 a toolbar that is styled correctly. The buttons are configured to \
37  
-be \u201Ctoolbar style\u201D buttons by telling them that they are \
  39
+be \\u201Ctoolbar style\\u201D buttons by telling them that they are \
38 40
 to use the Toolbutton style.
39 41
 EOL
40 42
 end
6  ext/tk/sample/demos-en/ttkprogress.rb
@@ -18,11 +18,11 @@
18 18
 base_frame = TkFrame.new($ttkprogress_demo).pack(:fill=>:both, :expand=>true)
19 19
 
20 20
 Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, 
21  
-               :text=><<EOL).pack(:side=>:top, :fill=>:x)
  21
+               :text=>Tk::UTF8_String.new(<<EOL)).pack(:side=>:top, :fill=>:x)
22 22
 Below are two progress bars. \
23  
-The top one is a \u201Cdeterminate\u201D progress bar, \
  23
+The top one is a \\u201Cdeterminate\\u201D progress bar, \
24 24
 which is used for showing how far through a defined task the program has got. \
25  
-The bottom one is an \u201Cindeterminate\u201D progress bar, \
  25
+The bottom one is an \\u201Cindeterminate\\u201D progress bar, \
26 26
 which is used to show that the program is busy \
27 27
 but does not know how long for. Both are run here in self-animated mode, \
28 28
 which can be turned on and off using the buttons underneath.
68  ext/tk/sample/demos-en/widget
@@ -775,6 +775,12 @@ def showCode1(demo)
775 775
     TkLabel.new(f,'text'=>'  pos:').pack('side'=>'left')
776 776
     posnum =TkLabel.new(f,'text'=>'').pack('side'=>'left')
777 777
 
  778
+    $set_linenum = proc{|w|
  779
+      line, pos = w.index('insert').split('.')
  780
+      linenum.text = line
  781
+      posnum.text  = pos
  782
+    }
  783
+
778 784
     f.pack('side'=>'bottom', 'expand'=>'true', 'fill'=>'x')
779 785
 
780 786
     if $tk_version =~ /^4\.[01]/
@@ -820,10 +826,21 @@ def showCode1(demo)
820 826
         TkGrid.columnconfigure(f, 0, 'weight'=>1, 'minsize'=>0)
821 827
       }
822 828
     end
  829
+
  830
+    btag = TkBindTag.new
  831
+
  832
+    btag.bind('Key', $set_linenum, '%W')
  833
+    btag.bind('Button', $set_linenum, '%W')
  834
+
  835
+    btags = $code_text.bindtags
  836
+    btags.insert(btags.index($code_text.class) + 1, btag)
  837
+    $code_text.bindtags = btags
  838
+
823 839
   else
824 840
     $code_window.deiconify
825 841
     $code_window.raise
826 842
   end
  843
+
827 844
   $code_window.title("Demo code: #{file}")
828 845
   $code_window.iconname(file)
829 846
 #  fid = open(file, 'r')
@@ -835,22 +852,7 @@ def showCode1(demo)
835 852
   #$code_text.set_insert('1.0')
836 853
   TkTextMarkInsert.new($code_text,'1.0')
837 854
 
838  
-  btag = TkBindTag.new
839  
-
840  
-  set_linenum = proc{|w|
841  
-    line, pos = w.index('insert').split('.')
842  
-    linenum.text = line
843  
-    posnum.text  = pos
844  
-  }
845  
-
846  
-  btag.bind('Key', set_linenum, '%W')
847  
-  btag.bind('Button', set_linenum, '%W')
848  
-
849  
-  btags = $code_text.bindtags
850  
-  btags.insert(btags.index($code_text.class) + 1, btag)
851  
-  $code_text.bindtags = btags
852  
-
853  
-  set_linenum.call($code_text)
  855
+  $set_linenum.call($code_text)
854 856
 
855 857
   fid.close
856 858
 end
@@ -879,6 +881,12 @@ def showCode2(demo)
879 881
     TkLabel.new(lf, :text=>'  pos:').pack(:side=>:left)
880 882
     posnum =TkLabel.new(lf, :text=>'').pack(:side=>:left)
881 883
 
  884
+    $set_linenum = proc{|w|
  885
+      line, pos = w.index('insert').split('.')
  886
+      linenum.text = line
  887
+      posnum.text  = pos
  888
+    }
  889
+
882 890
     b_dis = TkButton.new(bf, :text=>'Dismiss', :default=>:active, 
883 891
                          :command=>proc{
884 892
                            $code_window.destroy
@@ -909,6 +917,17 @@ def showCode2(demo)
909 917
     $code_window.bindinfo('Return').each{|cmd, arg|
910 918
       $code_window.bind_append('Escape', cmd, arg)
911 919
     }
  920
+
  921
+    btag = TkBindTag.new
  922
+
  923
+    btag.bind('Key', $set_linenum, '%W')
  924
+    btag.bind('Button', $set_linenum, '%W')
  925
+    btag.bind('Configure', $set_linenum, '%W')
  926
+
  927
+    btags = $code_text.bindtags
  928
+    btags.insert(btags.index($code_text.class) + 1, btag)
  929
+    $code_text.bindtags = btags
  930
+
912 931
   else
913 932
     $code_window.deiconify
914 933
     $code_window.raise
@@ -921,22 +940,7 @@ def showCode2(demo)
921 940
   $code_text.insert('1.0', fid.read)
922 941
   TkTextMarkInsert.new($code_text,'1.0')
923 942
 
924  
-  btag = TkBindTag.new
925  
-
926  
-  set_linenum = proc{|w|
927  
-    line, pos = w.index('insert').split('.')
928  
-    linenum.text = line
929  
-    posnum.text  = pos
930  
-  }
931  
-
932  
-  btag.bind('Key', set_linenum, '%W')
933  
-  btag.bind('Button', set_linenum, '%W')
934  
-
935  
-  btags = $code_text.bindtags
936  
-  btags.insert(btags.index($code_text.class) + 1, btag)
937  
-  $code_text.bindtags = btags
938  
-
939  
-  set_linenum.call($code_text)
  943
+  $set_linenum.call($code_text)
940 944
 
941 945
   fid.close
942 946
 end
67  ext/tk/sample/demos-jp/widget
@@ -814,6 +814,12 @@ def showCode1(demo)
814 814
     TkLabel.new(f,'text'=>'  pos:').pack('side'=>'left')
815 815
     posnum =TkLabel.new(f,'text'=>'').pack('side'=>'left')
816 816
 
  817
+    $set_linenum = proc{|w|
  818
+      line, pos = w.index('insert').split('.')
  819
+      linenum.text = line
  820
+      posnum.text  = pos
  821
+    }
  822
+
817 823
     f.pack('side'=>'bottom', 'expand'=>'true', 'fill'=>'x')
818 824
 
819 825
     if $tk_version =~ /^4\.[01]/
@@ -858,10 +864,21 @@ def showCode1(demo)
858 864
         TkGrid.columnconfigure(f, 0, 'weight'=>1, 'minsize'=>0)
859 865
       }
860 866
     end
  867
+
  868
+    btag = TkBindTag.new
  869
+
  870
+    btag.bind('Key', $set_linenum, '%W')
  871
+    btag.bind('Button', $set_linenum, '%W')
  872
+
  873
+    btags = $code_text.bindtags
  874
+    btags.insert(btags.index($code_text.class) + 1, btag)
  875
+    $code_text.bindtags = btags
  876
+
861 877
   else
862 878
     $code_window.deiconify
863 879
     $code_window.raise
864 880
   end
  881
+
865 882
   $code_window.title("Demo code: #{file}")
866 883
   $code_window.iconname(file)
867 884
 #  fid = open(file, 'r')
@@ -873,22 +890,7 @@ def showCode1(demo)
873 890
   #$code_text.set_insert('1.0')
874 891
   TkTextMarkInsert.new($code_text,'1.0')
875 892
 
876  
-  btag = TkBindTag.new
877  
-
878  
-  set_linenum = proc{|w|
879  
-    line, pos = w.index('insert').split('.')
880  
-    linenum.text = line
881  
-    posnum.text  = pos
882  
-  }
883  
-
884  
-  btag.bind('Key', set_linenum, '%W')
885  
-  btag.bind('Button', set_linenum, '%W')
886  
-
887  
-  btags = $code_text.bindtags
888  
-  btags.insert(btags.index($code_text.class) + 1, btag)
889  
-  $code_text.bindtags = btags
890  
-
891  
-  set_linenum.call($code_text)
  893
+  $set_linenum.call($code_text)
892 894
 
893 895
   fid.close
894 896
 end
@@ -917,6 +919,12 @@ def showCode2(demo)
917 919
     TkLabel.new(lf, :text=>'  pos:').pack(:side=>:left)
918 920
     posnum =TkLabel.new(lf, :text=>'').pack(:side=>:left)
919 921
 
  922
+    $set_linenum = proc{|w|
  923
+      line, pos = w.index('insert').split('.')
  924
+      linenum.text = line
  925
+      posnum.text  = pos
  926
+    }
  927
+
920 928
     #b_dis = TkButton.new(bf, :text=>'λ²ò', :default=>:active, 
921 929
     b_dis = TkButton.new(bf, :text=>'ÊĤ¸¤ë', :default=>:active, 
922 930
                          :command=>proc{
@@ -948,6 +956,16 @@ def showCode2(demo)
948 956
     $code_window.bindinfo('Return').each{|cmd, arg|
949 957
       $code_window.bind_append('Escape', cmd, arg)
950 958
     }
  959
+
  960
+    btag = TkBindTag.new
  961
+
  962
+    btag.bind('Key', $set_linenum, '%W')
  963
+    btag.bind('Button', $set_linenum, '%W')
  964
+
  965
+    btags = $code_text.bindtags
  966
+    btags.insert(btags.index($code_text.class) + 1, btag)
  967
+    $code_text.bindtags = btags
  968
+
951 969
   else
952 970
     $code_window.deiconify
953 971
     $code_window.raise
@@ -960,22 +978,7 @@ def showCode2(demo)
960 978
   $code_text.insert('1.0', fid.read)
961 979
   TkTextMarkInsert.new($code_text,'1.0')
962 980
 
963  
-  btag = TkBindTag.new
964  
-
965  
-  set_linenum = proc{|w|
966  
-    line, pos = w.index('insert').split('.')
967  
-    linenum.text = line
968  
-    posnum.text  = pos
969  
-  }
970  
-
971  
-  btag.bind('Key', set_linenum, '%W')
972  
-  btag.bind('Button', set_linenum, '%W')
973  
-
974  
-  btags = $code_text.bindtags
975  
-  btags.insert(btags.index($code_text.class) + 1, btag)
976  
-  $code_text.bindtags = btags
977  
-
978  
-  set_linenum.call($code_text)
  981
+  $set_linenum.call($code_text)
979 982
 
980 983
   fid.close
981 984
 end
4  ext/zlib/extconf.rb
@@ -10,7 +10,7 @@
10 10
 dir_config 'zlib'
11 11
 
12 12
 
13  
-if %w'z libz zlib zdll'.find {|z| have_library(z, 'deflateReset')} and
  13
+if %w'z libz zlib1 zlib zdll'.find {|z| have_library(z, 'deflateReset')} and
14 14
     have_header('zlib.h') then
15 15
 
16 16
   defines = []
@@ -22,7 +22,7 @@
22 22
       os_code = 'AMIGA'
23 23
     when /\Aos2[\-_]emx\z/ then
24 24
       os_code = 'OS2'
25  
-    when 'mswin32', 'mingw32', 'bccwin32' then
  25
+    when /mswin|mingw|bccwin/ then
26 26
       # NOTE: cygwin should be regarded as Unix.
27 27
       os_code = 'WIN32'
28 28
     else
2  file.c
@@ -1495,7 +1495,7 @@ static VALUE
1495 1495
 rb_file_ftype(st)
1496 1496
     struct stat *st;
1497 1497
 {
1498  
-    char *t;
  1498