* ext/tk: merge tcltklib for Ruby/Tk installation control

* ext/tcltklib: remove


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagai 2005-01-25 14:31:45 +00:00
parent 5ff5e1c91d
commit 4116b8b0f5
27 changed files with 371 additions and 297 deletions

View File

@ -1,3 +1,9 @@
Tue Jan 25 23:10:48 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk: merge tcltklib for Ruby/Tk installation control
* ext/tcltklib: remove
Tue Jan 25 17:05:15 2005 NAKAMURA Usaku <usa@ruby-lang.org> Tue Jan 25 17:05:15 2005 NAKAMURA Usaku <usa@ruby-lang.org>
* ruby.c (proc_options): correct -T option in RUBYOPT. * ruby.c (proc_options): correct -T option in RUBYOPT.

View File

@ -1,3 +0,0 @@
Makefile
*.log
*.def

View File

@ -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

View File

@ -1,267 +0,0 @@
# extconf.rb for tcltklib
require 'mkmf'
is_win32 = (/mswin32|mingw|cygwin|bccwin32/ =~ RUBY_PLATFORM)
is_macosx = (/darwin/ =~ RUBY_PLATFORM)
mac_need_framework =
is_macosx &&
enable_config("mac-tcltk-framework", false) &&
FileTest.directory?("/Library/Frameworks/Tcl.framework/") &&
FileTest.directory?("/Library/Frameworks/Tk.framework/")
unless is_win32
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"]
if stubs
func = "Tcl_InitStubs"
lib = "tclstub"
else
func = "Tcl_FindExecutable"
lib = "tcl"
end
if tcllib
find_library(tcllib, func, *paths)
elsif find_library(lib, func, *paths)
true
else
%w[8.5 8.4 8.3 8.2 8.1 8.0 7.6].find { |ver|
find_library("#{lib}#{ver}", func, *paths) or
find_library("#{lib}#{ver.delete('.')}", func, *paths) or
find_library("tcl#{ver}", func, *paths) or
find_library("tcl#{ver.delete('.')}", func, *paths)
}
end
end
def find_tk(tklib, stubs)
paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
if stubs
func = "Tk_InitStubs"
lib = "tkstub"
else
func = "Tk_Init"
lib = "tk"
end
if tklib
find_library(tklib, func, *paths)
elsif find_library(lib, func, *paths)
true
else
%w[8.5 8.4 8.3 8.2 8.1 8.0 4.2].find { |ver|
find_library("#{lib}#{ver}", func, *paths) or
find_library("#{lib}#{ver.delete('.')}", func, *paths) or
find_library("tk#{ver}", func, *paths) or
find_library("tk#{ver.delete('.')}", func, *paths)
}
end
end
def pthread_check()
tcl_major_ver = nil
tcl_minor_ver = nil
# Is tcl-thread given by user ?
case enable_config("tcl-thread")
when true
tcl_enable_thread = true
when false
tcl_enable_thread = false
else
tcl_enable_thread = nil
end
if (tclConfig = with_config("tclConfig-file"))
if tcl_enable_thread == true
puts("Warning: --with-tclConfig-file option is ignored, because --enable-tcl-thread option is given.")
elsif tcl_enable_thread == false
puts("Warning: --with-tclConfig-file option is ignored, because --disable-tcl-thread option is given.")
else
# tcl-thread is unknown and tclConfig.sh is given
begin
open(tclConfig, "r") do |cfg|
while line = cfg.gets()
if line =~ /^\s*TCL_THREADS=(0|1)/
tcl_enable_thread = ($1 == "1")
break
end
if line =~ /^\s*TCL_MAJOR_VERSION=("|')(\d+)\1/
tcl_major_ver = $2
if tcl_major_ver =~ /^[1-7]$/
tcl_enable_thread = false
break
end
if tcl_major_ver == "8" && tcl_minor_ver == "0"
tcl_enable_thread = false
break
end
end
if line =~ /^\s*TCL_MINOR_VERSION=("|')(\d+)\1/
tcl_minor_ver = $2
if tcl_major_ver == "8" && tcl_minor_ver == "0"
tcl_enable_thread = false
break
end
end
end
end
if tcl_enable_thread == nil
# not find definition
if tcl_major_ver
puts("Warning: '#{tclConfig}' doesn't include TCL_THREADS definition.")
else
puts("Warning: '#{tclConfig}' may not be a tclConfig file.")
end
tclConfig = false
end
rescue Exception
puts("Warning: fail to read '#{tclConfig}'!! --> ignore the file")
tclConfig = false
end
end
end
if tcl_enable_thread == nil && !tclConfig
# tcl-thread is unknown and tclConfig is unavailable
begin
try_run_available = try_run("int main() { exit(0); }")
rescue Exception
# cannot try_run. Is CROSS-COMPILE environment?
puts(%Q'\
*****************************************************************************
**
** PTHREAD SUPPORT CHECK WARNING:
**
** We cannot check the consistency of pthread support between Ruby
** and Tcl/Tk library on your environment (do coss-compile?). If the
** consistency is not kept, some memory troubles (e.g. "Hang-up" or
** "Segmentation Fault") may bother you. We strongly you to check the
** consistency by your own hand.
**
*****************************************************************************
')
return true
end
end
if tcl_enable_thread == nil
# tcl-thread is unknown
if try_run(<<EOF)
#include <tcl.h>
int main() {
Tcl_Interp *ip;
ip = Tcl_CreateInterp();
exit((Tcl_Eval(ip, "set tcl_platform(threaded)") == TCL_OK)? 0: 1);
}
EOF
tcl_enable_thread = true
elsif try_run(<<EOF)
#include <tcl.h>
static Tcl_ThreadDataKey dataKey;
int main() { exit((Tcl_GetThreadData(&dataKey, 1) == dataKey)? 1: 0); }
EOF
tcl_enable_thread = true
else
tcl_enable_thread = false
end
end
# check pthread mode
if (macro_defined?('HAVE_LIBPTHREAD', '#include "ruby.h"'))
# ruby -> enable
unless tcl_enable_thread
# ruby -> enable && tcl -> disable
puts(%Q'\
*****************************************************************************
**
** PTHREAD SUPPORT MODE WARNING:
**
** Ruby is compiled with --enable-pthread, but your Tcl/Tk libraries
** seems to be compiled without "pthread support". Although You can
** create tcltklib library, this combination may cause memory trouble
** (e.g. "Hang-up" or "Segmentation Fault"). If you have no reason you
** must have to keep current pthread support status, we recommend you
** to make both or neither libraries to support pthread.
**
** If you want change the status of pthread support, please recompile
** Ruby without "--enable-pthread" configure option or recompile Tcl/Tk
** with "--enable-threads" configure option (if your Tcl/Tk is later
** than or equal to Tcl/Tk8.1).
**
*****************************************************************************
')
end
# ruby -> enable && tcl -> enable/disable
if tcl_enable_thread
$CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=1'
else
$CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=0'
end
return true
else
# ruby -> disable
if tcl_enable_thread
# ruby -> disable && tcl -> enable
puts(%Q'\
*****************************************************************************
**
** PTHREAD SUPPORT MODE ERRROR:
**
** Ruby is not compiled with --enable-pthread, but your Tcl/Tk
** libararies seems to be compiled with "pthread support". This
** combination possibly cause "Hang-up" or "Segmentation Fault"
** frequently when Ruby/Tk is working. We NEVER recommend you to
** create the library under such combination of pthread support.
**
** Please recompile Ruby with "--enable-pthread" configure option
** or recompile Tcl/Tk with "--disable-threads" configure option.
**
*****************************************************************************
')
$CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=1'
return false
else
# ruby -> disable && tcl -> disable
$CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=0'
return true
end
end
end
if mac_need_framework ||
(have_header("tcl.h") && have_header("tk.h") &&
(is_win32 || find_library("X11", "XOpenDisplay",
"/usr/X11/lib", "/usr/lib/X11", "/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
if mac_need_framework
$CPPFLAGS += ' -I/Library/Frameworks/Tcl.framework/headers -I/Library/Frameworks/Tk.framework/Headers'
$LDFLAGS += ' -framework Tk -framework Tcl'
end
create_makefile("tcltklib") if stubs or pthread_check
end

View File

@ -1,3 +1,3 @@
Makefile Makefile
mkmf.log
*.log *.log
*.def

View File

@ -1,23 +1,19 @@
If you want to use Ruby/Tk (tk.rb and so on), you must have If you want to use Ruby/Tk (tk.rb and so on), you must have tcltklib.so
tcltklib.so which is working collectry. If you fail to call which is working correctly. When you have some troubles on compiling,
'require "tcltklib"', you may not have tcltklib.so. please read README.tcltklib and README.ActiveTcl.
( see also README files of tcltklib ) Even if there is a tcltklib.so on your Ruby library directry, it will not
Even if there is a tcltklib.so on your Ruby library directry, work without Tcl/Tk libraries (e.g. libtcl8.4.so) on your environment.
it will not work without Tcl/Tk libraries (e.g. libtcl8.4.so) You must also check that your Tcl/Tk is installed properly.
on your environment. You must also check that your Tcl/Tk is
installed properly.
-------------------------------------------- --------------------------------------------
( the following is written in EUC-JP ) ( the following is written in EUC-JP )
Ruby/Tk (tk.rb など) を使いたい場合にはtcltklib.so が正しく Ruby/Tk (tk.rb など) を使いたい場合にはtcltklib.so が正しく動いていな
動いていなければなりません.もし require "tcltklib" に失敗する ければなりませんコンパイル時に何か問題が生じた場合はREADME.tcltklib
ようならtcltklib.so が存在していないのかもしれません. や README.ActiveTcl を見てください.
( tcltklib の README ファイルも見てください ) たとえ Ruby のライブラリディレクトリに tcltklib.so が存在していたとして
たとえ Ruby のライブラリディレクトリに tcltklib.so が存在して も,実行環境に Tcl/Tk ライブラリ (libtcl8.4.so など) がなければ機能しま
いたとしても,実行環境に Tcl/Tk ライブラリ (libtcl8.4.so など) せんTcl/Tk が正しくインストールされているかもチェックしてください.
がなければ機能しませんTcl/Tk が正しくインストールされているか
どうかもチェックしてください.
========================================================== ==========================================================
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

View File

@ -1 +1,3 @@
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
tkutil.o: tkutil.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h tkutil.o: tkutil.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h

View File

@ -1,4 +1,344 @@
# extconf.rb for tcltklib
require 'mkmf' require 'mkmf'
$preload = ["tcltklib"]
($INSTALLFILES||=[]) << ["lib/tkextlib/SUPPORT_STATUS", "$(RUBYLIBDIR)", "lib"] is_win32 = (/mswin32|mingw|cygwin|bccwin32/ =~ RUBY_PLATFORM)
create_makefile("tkutil") is_macosx = (/darwin/ =~ RUBY_PLATFORM)
mac_need_framework =
is_macosx &&
enable_config("mac-tcltk-framework", false) &&
FileTest.directory?("/Library/Frameworks/Tcl.framework/") &&
FileTest.directory?("/Library/Frameworks/Tk.framework/")
unless is_win32
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"]
if stubs
func = "Tcl_InitStubs"
lib = "tclstub"
else
func = "Tcl_FindExecutable"
lib = "tcl"
end
if tcllib
find_library(tcllib, func, *paths)
elsif find_library(lib, func, *paths)
true
else
%w[8.5 8.4 8.3 8.2 8.1 8.0 7.6].find { |ver|
find_library("#{lib}#{ver}", func, *paths) or
find_library("#{lib}#{ver.delete('.')}", func, *paths) or
find_library("tcl#{ver}", func, *paths) or
find_library("tcl#{ver.delete('.')}", func, *paths)
}
end
end
def find_tk(tklib, stubs)
paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
if stubs
func = "Tk_InitStubs"
lib = "tkstub"
else
func = "Tk_Init"
lib = "tk"
end
if tklib
find_library(tklib, func, *paths)
elsif find_library(lib, func, *paths)
true
else
%w[8.5 8.4 8.3 8.2 8.1 8.0 4.2].find { |ver|
find_library("#{lib}#{ver}", func, *paths) or
find_library("#{lib}#{ver.delete('.')}", func, *paths) or
find_library("tk#{ver}", func, *paths) or
find_library("tk#{ver.delete('.')}", func, *paths)
}
end
end
def pthread_check()
tcl_major_ver = nil
tcl_minor_ver = nil
# Is tcl-thread given by user ?
case enable_config("tcl-thread")
when true
$CPPFLAGS += ' -DFORCE_TCL_THREAD=1'
tcl_enable_thread = true
when false
$CPPFLAGS += ' -DFORCE_TCL_THREAD=1'
tcl_enable_thread = false
else
tcl_enable_thread = nil
end
if (tclConfig = with_config("tclConfig-file"))
if tcl_enable_thread == true
puts("Warning: --with-tclConfig-file option is ignored, because --enable-tcl-thread option is given.")
elsif tcl_enable_thread == false
puts("Warning: --with-tclConfig-file option is ignored, because --disable-tcl-thread option is given.")
else
# tcl-thread is unknown and tclConfig.sh is given
begin
open(tclConfig, "r") do |cfg|
while line = cfg.gets()
if line =~ /^\s*TCL_THREADS=(0|1)/
tcl_enable_thread = ($1 == "1")
break
end
if line =~ /^\s*TCL_MAJOR_VERSION=("|')(\d+)\1/
tcl_major_ver = $2
if tcl_major_ver =~ /^[1-7]$/
tcl_enable_thread = false
break
end
if tcl_major_ver == "8" && tcl_minor_ver == "0"
tcl_enable_thread = false
break
end
end
if line =~ /^\s*TCL_MINOR_VERSION=("|')(\d+)\1/
tcl_minor_ver = $2
if tcl_major_ver == "8" && tcl_minor_ver == "0"
tcl_enable_thread = false
break
end
end
end
end
if tcl_enable_thread == nil
# not find definition
if tcl_major_ver
puts("Warning: '#{tclConfig}' doesn't include TCL_THREADS definition.")
else
puts("Warning: '#{tclConfig}' may not be a tclConfig file.")
end
tclConfig = false
end
rescue Exception
puts("Warning: fail to read '#{tclConfig}'!! --> ignore the file")
tclConfig = false
end
end
end
if tcl_enable_thread == nil && !tclConfig
# tcl-thread is unknown and tclConfig is unavailable
begin
try_run_available = try_run("int main() { exit(0); }")
rescue Exception
# cannot try_run. Is CROSS-COMPILE environment?
puts(%Q'\
*****************************************************************************
**
** PTHREAD SUPPORT CHECK WARNING:
**
** We cannot check the consistency of pthread support between Ruby
** and Tcl/Tk library on your environment (do coss-compile?). If the
** consistency is not kept, some memory troubles (e.g. "Hang-up" or
** "Segmentation Fault") may bother you. We strongly recommend you to
** check the consistency by your own hand.
**
*****************************************************************************
')
return true
end
end
if tcl_enable_thread == nil
# tcl-thread is unknown
if try_run(<<EOF)
#include <tcl.h>
int main() {
Tcl_Interp *ip;
ip = Tcl_CreateInterp();
exit((Tcl_Eval(ip, "set tcl_platform(threaded)") == TCL_OK)? 0: 1);
}
EOF
tcl_enable_thread = true
elsif try_run(<<EOF)
#include <tcl.h>
static Tcl_ThreadDataKey dataKey;
int main() { exit((Tcl_GetThreadData(&dataKey, 1) == dataKey)? 1: 0); }
EOF
tcl_enable_thread = true
else
tcl_enable_thread = false
end
end
# check pthread mode
if (macro_defined?('HAVE_LIBPTHREAD', '#include "ruby.h"'))
# ruby -> enable
unless tcl_enable_thread
# ruby -> enable && tcl -> disable
puts(%Q'\
*****************************************************************************
**
** PTHREAD SUPPORT MODE WARNING:
**
** Ruby is compiled with --enable-pthread, but your Tcl/Tk libraries
** seems to be compiled without "pthread support". Although You can
** create tcltklib library, this combination may cause memory trouble
** (e.g. "Hang-up" or "Segmentation Fault"). If you have no reason you
** must have to keep current pthread support status, we recommend you
** to make both or neither libraries to support pthread.
**
** If you want change the status of pthread support, please recompile
** Ruby without "--enable-pthread" configure option or recompile Tcl/Tk
** with "--enable-threads" configure option (if your Tcl/Tk is later
** than or equal to Tcl/Tk8.1).
**
*****************************************************************************
')
end
# ruby -> enable && tcl -> enable/disable
if tcl_enable_thread
$CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=1'
else
$CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=0'
end
return true
else
# ruby -> disable
if tcl_enable_thread
# ruby -> disable && tcl -> enable
puts(%Q'\
*****************************************************************************
**
** PTHREAD SUPPORT MODE ERRROR:
**
** Ruby is not compiled with --enable-pthread, but your Tcl/Tk
** libararies seems to be compiled with "pthread support". This
** combination possibly cause "Hang-up" or "Segmentation Fault"
** frequently when Ruby/Tk is working. We NEVER recommend you to
** create the library under such combination of pthread support.
**
** Please recompile Ruby with "--enable-pthread" configure option
** or recompile Tcl/Tk with "--disable-threads" configure option.
**
*****************************************************************************
')
$CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=1'
return false
else
# ruby -> disable && tcl -> disable
$CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=0'
return true
end
end
end
if mac_need_framework ||
(have_header("tcl.h") && have_header("tk.h") &&
(is_win32 || find_library("X11", "XOpenDisplay",
"/usr/X11/lib", "/usr/lib/X11", "/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
if mac_need_framework
$CPPFLAGS += ' -I/Library/Frameworks/Tcl.framework/headers -I/Library/Frameworks/Tk.framework/Headers'
$LDFLAGS += ' -framework Tk -framework Tcl'
end
if stubs or pthread_check
# create Makefile
# backup
if $INSTALLFILES
installfiles_bup = $INSTALLFILES.dup
else
installfiles_bup = nil
$INSTALLFILES = []
end
cleanings_bup = CLEANINGS.dup
if $objs
objs_bup = $objs.dup
else
objs_bup = nil
$objs = []
end
# for SUPPORT_STATUS
$INSTALLFILES << ["lib/tkextlib/SUPPORT_STATUS", "$(RUBYLIBDIR)", "lib"]
# for tcltklib.so
$objs << "stubs.o" << "tcltklib.o"
# for tkutil.so
mk_tkutil = "\n\n"
mk_tkutil << "OBJS2 = tkutil.#{$OBJEXT}\n"
mk_tkutil << "TARGET2 = tkutil\n"
mk_tkutil << "DLLIB2 = $(TARGET2).#{CONFIG['DLEXT']}\n"
mk_tkutil << "STATIC_LIB2 = $(TARGET2).#{$LIBEXT}\n"
mk_tkutil << "\n"
mk_tkutil << 'CLEANLIBS2 = "$(TARGET2).{lib,exp,il?,tds,map}" $(DLLIB2)'
mk_tkutil << "\n\n"
mk_tkutil << "all: $(DLLIB2)\n"
mk_tkutil << "static: $(STATIC_LIB2)\n"
mk_tkutil << "\n"
mk_tkutil << CLEANINGS.sub(/\$\(CLEANLIBS\)/, "$(CLEANLIBS) $(CLEANLIBS2)")
mk_tkutil << "\n\n"
mk_tkutil << "$(DLLIB2): $(OBJS2)\n\t"
mk_tkutil << "@-$(RM) $@\n\t"
mk_tkutil << "@-$(RM) $(TARGET2).lib\n\t" if $mswin
LINK_SO2 = if CONFIG["DLEXT"] == $OBJEXT
"ld $(DLDFLAGS) -r -o $(DLLIB2) $(OBJS2)\n"
else
"$(LDSHARED) $(DLDFLAGS) $(LIBPATH) #{OUTFLAG}$(DLLIB2) " \
"$(OBJS2) $(LOCAL_LIBS) $(LIBS)"
end
mk_tkutil << LINK_SO2
mk_tkutil << "\n\n"
mk_tkutil << "$(STATIC_LIB2): $(OBJS2)\n\t"
mk_tkutil << "$(AR) #{config_string('ARFLAGS') || 'cru '}$@ $(OBJS2)"
if ranlib = config_string('RANLIB')
mk_tkutil << "\n\t@-#{ranlib} $(DLLIB2) 2> /dev/null || true"
end
mk_tkutil << "\n\n\n"
mk_tkutil << "install: $(RUBYARCHDIR)/$(DLLIB2)\n"
mk_tkutil << "$(RUBYARCHDIR)/$(DLLIB2): $(DLLIB2) $(RUBYARCHDIR)\n"
mk_tkutil << "\t@$(INSTALL_PROG) $(DLLIB2) $(RUBYARCHDIR)\n"
CLEANINGS.replace(mk_tkutil)
# create
create_makefile("tcltklib")
# reset
$INSTALLFILES = installfiles_bup
CLEANINGS.replace(cleanings_bup)
$objs = objs_bup
end
end

View File

Before

Width:  |  Height:  |  Size: 538 B

After

Width:  |  Height:  |  Size: 538 B

View File

Before

Width:  |  Height:  |  Size: 481 B

After

Width:  |  Height:  |  Size: 481 B

View File

@ -19,7 +19,7 @@ require "tcltk"
$ip = TclTkInterpreter.new() $ip = TclTkInterpreter.new()
$root = $ip.rootwidget() $root = $ip.rootwidget()
$button, $canvas, $checkbutton, $frame, $label, $pack, $update, $wm = $button, $canvas, $checkbutton, $frame, $label, $pack, $update, $wm =
$ip.commands().indexes( $ip.commands().values_at(
"button", "canvas", "checkbutton", "frame", "label", "pack", "update", "wm") "button", "canvas", "checkbutton", "frame", "label", "pack", "update", "wm")
class Othello class Othello
@ -196,10 +196,12 @@ class Othello
def initialize(view, row, col) def initialize(view, row, col)
@view = view @view = view
@id = @view.e("create rectangle", *view.tk_rect(view.left + col, @id = @view.e("create rectangle",
*(view.tk_rect(view.left + col,
view.top + row, view.top + row,
view.left + col + 1, view.left + col + 1,
view.top + row + 1)) view.top + row + 1) \
<< "-fill #{BACK_GROUND_COLOR}") )
@row = row @row = row
@col = col @col = col
@view.e("itemconfigure", @id, @view.e("itemconfigure", @id,