tk.rb: incompatible change between 1.8.1 and 1.8.2

F

Ferenc Engard

Hi all,

The "can't dup Fixnum" error what I have mentioned in my previous post
is caused by a change in tk.rb.

The tk.rb in 1.8.1 has the following portion from line 657:

module TkCore
include TkComm
extend TkComm

unless self.const_defined? :INTERP
if self.const_defined? :IP_NAME
name = IP_NAME.to_s
else
name = nil
#### ^^^^^^^^^^ #####################
end
if self.const_defined? :IP_OPTS
if IP_OPTS.kind_of?(Hash)
opts = hash_kv(IP_OPTS).join(' ')
else
opts = IP_OPTS.to_s
end
else
opts = ''
end

INTERP = TclTkIp.new(name, opts)
[...]

The 1.8.2 version has this (from line 940):

module TkCore
include TkComm
extend TkComm

unless self.const_defined? :INTERP
if self.const_defined? :IP_NAME
name = IP_NAME.to_s
else
#name = nil
name = $0
#### ^^^^^^^^^^ #####################
end
if self.const_defined? :IP_OPTS
if IP_OPTS.kind_of?(Hash)
opts = hash_kv(IP_OPTS).join(' ')
else
opts = IP_OPTS.to_s
end
else
opts = ''
end

INTERP = TclTkIp.new(name, opts)

(The version numbers are from the debian packages.)

This change causes the fixnum problem in class TclTkExtIp's constructor.

I have a 1.8.0 source where TclTkIp's initialize fn (in tcltklib.c) do
not get params, so I do not know why is it for.

What to do?

Thanks,
Ferenc
 
H

Hidetoshi NAGAI

Hi,

From: Ferenc Engard <[email protected]>
Subject: tk.rb: incompatible change between 1.8.1 and 1.8.2
Date: Sat, 28 Aug 2004 22:28:23 +0900
Message-ID: said:
The "can't dup Fixnum" error what I have mentioned in my previous post
is caused by a change in tk.rb. (snip)
This change causes the fixnum problem in class TclTkExtIp's constructor.

Sorry. This changes default Tk.appname from 'tk' to
current command/script name.
I didn't observe 'tcltk-ext' library on 1.8.2.
As you point, it cannot work with 1.8.2.
Please adopt the following patch.

diff -u ../tcltk-ext051/tcltkextlib.rb ./tcltkextlib.rb
--- ../tcltk-ext051/tcltkextlib.rb 2000-09-28 15:25:56.000000000 +0900
+++ ./tcltkextlib.rb 2004-08-29 02:18:01.000000000 +0900
@@ -278,7 +278,24 @@
def initialize(*libs)
@libs = []
@namespace = []
- @ip = TclTkIp.new_orig
+
+ if TclTkIp.method:)new_orig).arity != 0
+ # libs ==> [ip_name, [ip_opts,]] libs
+ if libs.empty? || libs[0].kind_of?(Array)
+ ip_name = nil
+ ip_opts = ''
+ else
+ ip_name = libs.shift
+ if libs.empty? || libs[0].kind_of?(Array)
+ ip_opts = ''
+ else
+ ip_opts = libs.shift
+ end
+ end
+ @ip = TclTkIp.new_orig(ip_name, ip_opts)
+ else
+ @ip = TclTkIp.new_orig
+ end
setup_libs(*libs)
end
end
 
F

Ferenc Engard

The "can't dup Fixnum" error what I have mentioned in my previous post
Sorry. This changes default Tk.appname from 'tk' to
current command/script name.
I didn't observe 'tcltk-ext' library on 1.8.2.
As you point, it cannot work with 1.8.2.
Please adopt the following patch.

diff -u ../tcltk-ext051/tcltkextlib.rb ./tcltkextlib.rb
[...]

I patched it, and it works now. Thank you!

Ferenc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top