From 973dca035ec861c3cbea0faf5e40ccfbcd84bb17 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 8 Mar 2002 07:03:09 +0000 Subject: * eval.c (cvar_cbase): utility function to find innermost non singleton cbase. * eval.c (is_defined): adopt new cvar behavior. * eval.c (rb_eval): ditto. * eval.c (assign): ditto. * class.c (rb_mod_clone): should not call rb_obj_clone(), since Module does not provide "allocate". * class.c (rb_singleton_class): should crate new singleton class if obj is a class or module and attached object is different, which means metaclass of singleton class is sought. * time.c (time_s_alloc): now follows allocation framework. * eval.c (rb_eval): should initialize outer class variables from methods in singleton class definitions. * eval.c (assign): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/tcltklib/tcltklib.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'ext/tcltklib') diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c index e9c2b56fc..7acbacdd9 100644 --- a/ext/tcltklib/tcltklib.c +++ b/ext/tcltklib/tcltklib.c @@ -120,6 +120,30 @@ ip_eval_rescue(failed, einfo) return Qnil; } +/* restart Tk */ +static VALUE +lib_restart(self) + VALUE self; +{ + struct tcltkip *ptr; /* tcltkip data struct */ + + /* get the data struct */ + Data_Get_Struct(self, struct tcltkip, ptr); + + /* destroy the root wdiget */ + ptr->return_value = Tcl_Eval(ptr->ip, "destroy ."); + /* ignore ERROR */ + DUMP2("(TCL_Eval result) %d", ptr->return_value); + + /* execute Tk_Init */ + DUMP1("Tk_Init"); + if (Tk_Init(ptr->ip) == TCL_ERROR) { + rb_raise(rb_eRuntimeError, "%s", ptr->ip->result); + } + + return Qnil; +} + static int #if TCL_MAJOR_VERSION >= 8 ip_ruby(clientData, interp, argc, argv) @@ -521,6 +545,7 @@ Init_tcltklib() rb_define_method(ip, "_invoke", ip_invoke, -1); rb_define_method(ip, "_return_value", ip_retval, 0); rb_define_method(ip, "mainloop", lib_mainloop, 0); + rb_define_method(ip, "restart", lib_restart, 0); main_thread = rb_thread_current(); #ifdef __MACOS__ -- cgit