RE: [tcltk-perl] radical rethink of Tk's loading ... (no C)
Brought to you by:
hobbs
From: Jeff H. <je...@ac...> - 2004-04-29 00:59:50
|
In addition to this, there is a large extra question ... This reduced Tcl::Tk to only .pm files. That means we can consider collapsing it all into the 'Tcl' distribution. Is this something we should consider? Advantages - single distro makes it easier to maintain. Disadvantages - are we going to reach a painful growth level? Will Tcl::Tk have numerous submodules eventually that we want to split out? Will there be C components for other Tk-related modules that we don't yet support, but would like to? Jeff > -----Original Message----- > From: tcl...@li... > [mailto:tcl...@li...] On Behalf Of > Jeff Hobbs > Sent: Wednesday, April 28, 2004 4:28 PM > To: tcl...@li... > Subject: [tcltk-perl] radical rethink of Tk's loading ... (no C) > > > Here is an idea I have about changing around Tcl::Tk, and > it's fairly fundamental: > > Change Tcl::Tk::new as follows: > > $i->SUPER::Init(); > - $i->Init(); > + #$i->Init(); > + $i->Eval("package require Tk 8.4"); > + $i->call('trace', 'add', 'command', '.', 'delete', > + sub { $W{'.'} = undef; }); > + $i->ResetResult(); > $Tcl::Tk::TK_VERSION = $i->GetVar("tk_version"); > > and then add the following command: > > sub MainLoop { > my $int = (ref $_[0]?shift:$tkinterp); > while (defined $W{'.'}) { > $int->DoOneEvent(0); > } > } > > The one thing this requires is the addition of Tcl_DoOneEvent > to Tcl.xs (which I did for testing this). Everything seems > to work just fine after these changes. I had to make a few > more to force the Tk module on Linux not to load the dll > (which isn't necessary in any case, but I haven't fully > excised it from the build), but the crux of the changes work. > > This means that the only C component is on the Tcl side - > there is NO Tk C component, only Tk.pm. The loading an > initialization of Tk is build into the 'package require Tk' statement. > > The disadvantage here is removing any access at the C level > to Tk stuff, but currently there is nothing there we use. > > At the same time, I have a patch which adds Tcl stubs support > to the Tcl module. That means we gain Tcl version > independence and have more control over what Tcl is used at > runtime. More on that here: > http://aspn.activestate.com/ASPN/docs/ActiveTcl/tcl/TclLib/InitStubs.htm |