Skip to content

Commit

Permalink
Merge from ruby_1_8. Add files that have not been added yet.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7@16554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
knu committed May 23, 2008
1 parent 4c3ee18 commit 08df734
Show file tree
Hide file tree
Showing 191 changed files with 5,750 additions and 928 deletions.
27 changes: 27 additions & 0 deletions ChangeLog
@@ -1,3 +1,30 @@
Fri May 23 13:46:09 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>

* configure.in (cflags): commit miss.

Fri May 23 09:52:21 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>

* configure.in (MINIRUBY), common.mk (RUBYOPT): add purelib.rb.
[ruby-core:16642]

* ext/extmk.rb: load purelib.rb only when not cross compiling.

Fri May 23 04:22:19 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>

* ext/tk/tcltklib.c, ext/tk/tkutil/tkutil.c: fix memory leak.

* ext/tk/lib/tk.rb: avoid trouble when finalize TclTkIp.

* ext/tk/lib/tk.rb, ext/tk/lib/tk/*: help to fix troubles when
use Ttk widgets on old Tk scripts.

* ext/tk/sample/*: update and add demo stcipts. some of them are
introduction about new features of Tcl/Tk8.5.

Fri May 23 03:48:10 2008 Akinori MUSHA <knu@iDaemons.org>

* class.c (clone_method): Just use ruby_cref as cref.

Fri May 23 01:03:23 2008 Akinori MUSHA <knu@iDaemons.org>

* class.c (rb_singleton_class_clone): Pass Qnil, not 0.
Expand Down
3 changes: 3 additions & 0 deletions Makefile.in
Expand Up @@ -35,6 +35,9 @@ RIDATADIR = $(DESTDIR)$(datadir)/ri/$(MAJOR).$(MINOR)/system
empty =
OUTFLAG = @OUTFLAG@$(empty)
CFLAGS = @CFLAGS@ @XCFLAGS@ @ARCH_FLAG@
cflags = @cflags@
optflags = @optflags@
debugflags = @debugflags@
CPPFLAGS = -I. -I$(srcdir) @CPPFLAGS@
LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@
EXTLDFLAGS =
Expand Down
7 changes: 3 additions & 4 deletions class.c
Expand Up @@ -57,19 +57,18 @@ clone_method(mid, body, nklass)
NODE *fbody = body->nd_body;

if (fbody) {
NODE *cref = NEW_NODE(NODE_CREF, nklass, 0, 0);
VALUE nbody;

switch (nd_type(fbody)) {
case NODE_SCOPE:
fbody = rb_copy_node_scope(fbody, cref);
fbody = rb_copy_node_scope(fbody, ruby_cref);
break;
case NODE_BMETHOD:
nbody = rb_block_dup(fbody->nd_cval, nklass, (VALUE)cref);
nbody = rb_block_dup(fbody->nd_cval, nklass, (VALUE)ruby_cref);
fbody = NEW_BMETHOD(nbody);
break;
case NODE_DMETHOD:
nbody = rb_method_dup(fbody->nd_cval, nklass, (VALUE)cref);
nbody = rb_method_dup(fbody->nd_cval, nklass, (VALUE)ruby_cref);
fbody = NEW_DMETHOD(nbody);
break;
}
Expand Down
3 changes: 3 additions & 0 deletions common.mk
Expand Up @@ -113,6 +113,9 @@ install-local: pre-install-local do-install-local post-install-local
pre-install-local:: pre-install-bin pre-install-lib pre-install-man
do-install-local:
$(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=local --mantype="$(MANTYPE)"
loadpath: $(PREP)
$(MINIRUBY) -e 'p $$:'

post-install-local:: post-install-bin post-install-lib post-install-man

install-ext: pre-install-ext do-install-ext post-install-ext
Expand Down
6 changes: 6 additions & 0 deletions configure.in
Expand Up @@ -1635,6 +1635,12 @@ case "$build_os" in
esac

CPPFLAGS="$CPPFLAGS "'$(DEFS)'
test -z "$CFLAGS" || CFLAGS="$CFLAGS "; CFLAGS="$CFLAGS"'${cflags}'
test -z "$CPPFLAGS" || CPPFLAGS="$CPPFLAGS "; CPPFLAGS="$CPPFLAGS"'${cppflags}'
AC_SUBST(cppflags, [])dnl
AC_SUBST(cflags, ['${optflags} ${debugflags}'])dnl
AC_SUBST(optflags)dnl
AC_SUBST(debugflags)dnl
AC_SUBST(XCFLAGS)dnl
AC_SUBST(XLDFLAGS)dnl
AC_SUBST(LIBRUBY_LDSHARED)
Expand Down
16 changes: 10 additions & 6 deletions ext/extmk.rb
Expand Up @@ -298,7 +298,7 @@ def parse_args()
$mflags.unshift(*rest) unless rest.empty?

def $mflags.set?(flag)
grep(/\A-(?!-).*#{'%c' % flag}/i) { return true }
grep(/\A-(?!-).*#{flag.chr}/i) { return true }
false
end
def $mflags.defined?(var)
Expand Down Expand Up @@ -354,12 +354,16 @@ def $mflags.defined?(var)
else
$ruby = '$(topdir)/miniruby' + EXEEXT
end
$ruby << " -I'$(topdir)' -I'$(top_srcdir)/lib'"
$ruby << " -I'$(extout)/$(arch)' -I'$(extout)/common'" if $extout
$ruby << " -I'$(top_srcdir)/ext' -rpurelib.rb"
$ruby << " -I'$(topdir)'"
unless CROSS_COMPILING
$ruby << " -I'$(top_srcdir)/lib'"
$ruby << " -I'$(extout)/$(arch)' -I'$(extout)/common'" if $extout
$ruby << " -I./- -I'$(top_srcdir)/ext' -rpurelib.rb"
ENV["RUBYLIB"] = "-"
ENV["RUBYOPT"] = "-rpurelib.rb"
end
$config_h = '$(topdir)/config.h'
ENV["RUBYLIB"] = "-"
ENV["RUBYOPT"] = "-rpurelib.rb"
$mflags << "ruby=#$ruby"

MTIMES = [__FILE__, 'rbconfig.rb', srcdir+'/lib/mkmf.rb'].collect {|f| File.mtime(f)}

Expand Down
2 changes: 1 addition & 1 deletion ext/tk/lib/multi-tk.rb
Expand Up @@ -2431,7 +2431,7 @@ class MultiTkIp
def mainloop(check_root = true, restart_on_dead = true)
raise SecurityError, "no permission to manipulate" unless self.manipulable?

unless WITH_RUBY_VM ### Ruby 1.9 !!!!!!!!!!!
if WITH_RUBY_VM ### Ruby 1.9 !!!!!!!!!!!
return @interp_thread.value if @interp_thread
end

Expand Down
123 changes: 100 additions & 23 deletions ext/tk/lib/tk.rb
Expand Up @@ -1298,7 +1298,7 @@ def INTERP.init_ip_internal
}) << ' %W')

INTERP.add_tk_procs(TclTkLib::FINALIZE_PROC_NAME, '',
"bind all <#{WIDGET_DESTROY_HOOK}> {}")
"catch { bind all <#{WIDGET_DESTROY_HOOK}> {} }")

INTERP.add_tk_procs('rb_out', 'ns args', <<-'EOL')
if [regexp {^::} $ns] {
Expand Down Expand Up @@ -3245,11 +3245,13 @@ def font_configure(slot)
next
else
fnt = hash_kv(fnt) if fnt.kind_of?(Hash)
begin
unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
tk_call(*(__config_cmd << "-#{optkey}" << fnt))
rescue => e
unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
fail e
else
begin
tk_call(*(__config_cmd << "-#{optkey}" << fnt))
rescue
# ignore
end
end
end
Expand Down Expand Up @@ -3305,11 +3307,13 @@ def latinfont_configure(ltn, keys=nil)
fobj = fontobj # create a new TkFont object
else
ltn = hash_kv(ltn) if ltn.kind_of?(Hash)
begin
unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
tk_call(*(__config_cmd << "-#{optkey}" << ltn))
rescue => e
unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
fail e
else
begin
tk_call(*(__config_cmd << "-#{optkey}" << ltn))
rescue => e
# ignore
end
end
next
Expand Down Expand Up @@ -3363,11 +3367,13 @@ def kanjifont_configure(knj, keys=nil)
fobj = fontobj # create a new TkFont object
else
knj = hash_kv(knj) if knj.kind_of?(Hash)
begin
unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
tk_call(*(__config_cmd << "-#{optkey}" << knj))
rescue => e
unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
fail e
else
begin
tk_call(*(__config_cmd << "-#{optkey}" << knj))
rescue => e
# ignore
end
end
next
Expand Down Expand Up @@ -3499,6 +3505,11 @@ def __configinfo_struct
end
private :__configinfo_struct

def __optkey_aliases
{}
end
private :__optkey_aliases

def __numval_optkeys
[]
end
Expand Down Expand Up @@ -3613,6 +3624,11 @@ def __cget_core(slot)
fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
end

alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
if real_name
slot = real_name.to_s
end

if ( method = _symbolkey2str(__val2ruby_optkeys())[slot] )
optval = tk_call_without_enc(*(__cget_cmd << "-#{slot}"))
begin
Expand Down Expand Up @@ -3687,14 +3703,35 @@ def cget(slot)
unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
__cget_core(slot)
else
__cget_core(slot) rescue nil
begin
__cget_core(slot)
rescue => e
if current_configinfo.has_key?(slot.to_s)
# error on known option
fail e
else
# unknown option
nil
end
end
end
end
def cget_strict(slot)
# never use TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
__cget_core(slot)
end

def __configure_core(slot, value=None)
if slot.kind_of? Hash
slot = _symbolkey2str(slot)

__optkey_aliases.each{|alias_name, real_name|
alias_name = alias_name.to_s
if slot.has_key?(alias_name)
slot[real_name.to_s] = slot.delete(alias_name)
end
}

__methodcall_optkeys.each{|key, method|
value = slot.delete(key.to_s)
self.__send__(method, value) if value
Expand Down Expand Up @@ -3731,6 +3768,11 @@ def __configure_core(slot, value=None)
fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
end

alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
if real_name
slot = real_name.to_s
end

if ( conf = __keyonly_optkeys.find{|k, v| k.to_s == slot} )
defkey, undefkey = conf
if value
Expand Down Expand Up @@ -3782,7 +3824,17 @@ def configure(slot, value=None)
__configure_core(slot) unless slot.empty?
end
else
__configure_core(slot, value) rescue nil
begin
__configure_core(slot, value)
rescue => e
if current_configinfo.has_key?(slot.to_s)
# error on known option
fail e
else
# unknown option
nil
end
end
end
end
self
Expand Down Expand Up @@ -3818,6 +3870,12 @@ def __configinfo_core(slot = nil)
else
if slot
slot = slot.to_s

alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
if real_name
slot = real_name.to_s
end

case slot
when /^(#{__val2ruby_optkeys().keys.join('|')})$/
method = _symbolkey2str(__val2ruby_optkeys())[slot]
Expand Down Expand Up @@ -4191,6 +4249,12 @@ def __configinfo_core(slot = nil)
else
if slot
slot = slot.to_s

alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
if real_name
slot = real_name.to_s
end

case slot
when /^(#{__val2ruby_optkeys().keys.join('|')})$/
method = _symbolkey2str(__val2ruby_optkeys())[slot]
Expand Down Expand Up @@ -4786,6 +4850,13 @@ def initialize(parent=nil, keys=nil)
fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
}

__optkey_aliases.each{|alias_name, real_name|
alias_name = alias_name.to_s
if keys.has_key?(alias_name)
keys[real_name.to_s] = keys.delete(alias_name)
end
}

__methodcall_optkeys.each{|key|
key = key.to_s
methodkeys[key] = keys.delete(key) if keys.key?(key)
Expand Down Expand Up @@ -4823,18 +4894,24 @@ def create_self(keys)
else
begin
tk_call_without_enc(cmd, @path, *hash_kv(keys, true))
rescue
rescue => e
tk_call_without_enc(cmd, @path)
keys = __check_available_configure_options(keys)
unless keys.empty?
begin
tk_call_without_enc('destroy', @path)
rescue
# cannot destroy
# try to configure
configure(keys)
else
# re-create widget
tk_call_without_enc(cmd, @path, *hash_kv(keys, true))
rescue
# fail => includes options adaptable when creattion only?
begin
tk_call_without_enc('destroy', @path)
rescue
# cannot rescue options error
fail e
else
# re-create widget
tk_call_without_enc(cmd, @path, *hash_kv(keys, true))
end
end
end
end
Expand Down Expand Up @@ -5389,7 +5466,7 @@ def bindtags_unshift(tag)
#Tk.freeze

module Tk
RELEASE_DATE = '2008-05-16'.freeze
RELEASE_DATE = '2008-05-23'.freeze

autoload :AUTO_PATH, 'tk/variable'
autoload :TCL_PACKAGE_PATH, 'tk/variable'
Expand Down
9 changes: 9 additions & 0 deletions ext/tk/lib/tk/canvas.rb
Expand Up @@ -168,6 +168,8 @@ def canvasy(screen_y, *args)
#tk_tcl2ruby(tk_send_without_enc('canvasy', screen_y, *args))
number(tk_send_without_enc('canvasy', screen_y, *args))
end
alias canvas_x canvasx
alias canvas_y canvasy

def coords(tag, *args)
if args == []
Expand Down Expand Up @@ -642,6 +644,13 @@ def self._parse_create_args(args)
fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
}

__item_optkey_aliases(nil).each{|alias_name, real_name|
alias_name = alias_name.to_s
if keys.has_key?(alias_name)
keys[real_name.to_s] = keys.delete(alias_name)
end
}

__item_methodcall_optkeys(nil).each{|key|
key = key.to_s
methodkeys[key] = keys.delete(key) if keys.key?(key)
Expand Down
3 changes: 3 additions & 0 deletions ext/tk/lib/tk/canvastag.rb
Expand Up @@ -63,6 +63,9 @@ def bindinfo(seq=nil)
def cget(option)
@c.itemcget(@id, option)
end
def cget_strict(option)
@c.itemcget_strict(@id, option)
end

def configure(key, value=None)
@c.itemconfigure(@id, key, value)
Expand Down

0 comments on commit 08df734

Please sign in to comment.