From 46bf6217378e0dca4ff56446cf7233023f21778a Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 17 Jul 2003 05:23:54 +0000 Subject: [PATCH] * eval.c (ruby_init): set ruby_running to true after initialization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ eval.c | 3 +-- ext/tk/lib/tk.rb | 14 +++++--------- gc.c | 1 + lib/rexml/encodings/EUC-JP.rb | 4 ++-- lib/rexml/encodings/SHIFT_JIS.rb | 18 +++++++++++++++++- 6 files changed, 31 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 92a107768e..b2de89b813 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Jul 17 13:46:25 2003 Yukihiro Matsumoto + + * eval.c (ruby_init): set ruby_running to true after + initialization. + Thu Jul 17 13:42:53 2003 WATANABE Hirofumi * lib/ftools.rb (File::makedirs): do not handle "//" as a directory. diff --git a/eval.c b/eval.c index 820b1ca5c4..1225349fca 100644 --- a/eval.c +++ b/eval.c @@ -365,7 +365,6 @@ rb_get_method_body(klassp, idp, noexp) if (ruby_running) { /* store in cache */ - if (BUILTIN_TYPE(origin) == T_ICLASS) origin = RBASIC(origin)->klass; ent = cache + EXPR1(klass, id); ent->klass = klass; ent->noex = body->nd_noex; @@ -1200,6 +1199,7 @@ ruby_init() } POP_SCOPE(); ruby_scope = top_scope; + ruby_running = 1; } static VALUE @@ -1365,7 +1365,6 @@ ruby_exec() volatile NODE *tmp; Init_stack((void*)&tmp); - ruby_running = 1; PUSH_TAG(PROT_NONE); PUSH_ITER(ITER_NOT); /* default visibility is private at toplevel */ diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index b9280e2901..22489dc1b0 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -324,7 +324,7 @@ module TkComm return '' if cmd == '' id = _next_cmd_id Tk_CMDTBL[id] = cmd - @cmdtbl = [] unless @cmdtbl + @cmdtbl = [] unless defined? @cmdtbl @cmdtbl.push id return format("rb_out %s", id); end @@ -859,10 +859,6 @@ module TkCore tk_call 'tk_getSaveFile', *hash_kv(keys) end - def chooseDirectory(keys = nil) - tk_call 'tk_chooseDIrectory', *hash_kv(keys) - end - def chooseColor(keys = nil) tk_call 'tk_chooseColor', *hash_kv(keys) end @@ -1385,7 +1381,7 @@ if /^8\.[1-9]/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK attr_accessor :encoding def _eval(cmd) - if @encoding + if defined? @encoding _fromUTF8(__eval(_toUTF8(cmd, @encoding)), @encoding) else __eval(cmd) @@ -1393,7 +1389,7 @@ if /^8\.[1-9]/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK end def _invoke(*cmds) - if @encoding + if defined? @encoding cmds = cmds.collect{|cmd| _toUTF8(cmd, @encoding)} _fromUTF8(__invoke(*cmds), @encoding) else @@ -1505,8 +1501,6 @@ class TkBindTag } end - ALL = self.new_by_name('all') - def initialize(*args, &b) @id = Tk_BINDTAG_ID[0] Tk_BINDTAG_ID[0] = Tk_BINDTAG_ID[0].succ @@ -1514,6 +1508,8 @@ class TkBindTag bind(*args, &b) if args != [] end + ALL = self.new_by_name('all') + def name @id end diff --git a/gc.c b/gc.c index b1afbb1db7..b6ceff8d19 100644 --- a/gc.c +++ b/gc.c @@ -1109,6 +1109,7 @@ obj_free(obj) } break; case T_ICLASS: + rb_clear_cache_by_class((VALUE)obj); /* iClass shares table with the module */ break; diff --git a/lib/rexml/encodings/EUC-JP.rb b/lib/rexml/encodings/EUC-JP.rb index 1be5663be8..def760b303 100644 --- a/lib/rexml/encodings/EUC-JP.rb +++ b/lib/rexml/encodings/EUC-JP.rb @@ -18,11 +18,11 @@ rescue LoadError module REXML module Encoding def from_euc_jp(str) - return Iconv::iconv("utf-8", "euc-jp", str).join + return Iconv::iconv("utf-8", "euc-jp", str).join('') end def to_euc_jp content - return Iconv::iconv("euc-jp", "utf-8", content).join + return Iconv::iconv("euc-jp", "utf-8", content).join('') end end end diff --git a/lib/rexml/encodings/SHIFT_JIS.rb b/lib/rexml/encodings/SHIFT_JIS.rb index 8650174538..27e4569403 100644 --- a/lib/rexml/encodings/SHIFT_JIS.rb +++ b/lib/rexml/encodings/SHIFT_JIS.rb @@ -13,5 +13,21 @@ begin end end rescue LoadError - raise "uconv is required for Japanese encoding support." + begin + require 'iconv' + module REXML + module Encoding + def from_shift_jis(str) + return Iconv::iconv("utf-8", "shift_jis", str).join('') + end + + def to_shift_jis content + return Iconv::iconv("shift_jis", "utf-8", content).join('') + end + end + end + rescue LoadError + raise "uconv or iconv is required for Japanese encoding support." + end + end