diff options
author | dgp <dgp@users.sourceforge.net> | 2005-04-15 15:50:30 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2005-04-15 15:50:30 (GMT) |
commit | 4b3cad67669ee24ba10a1b95e9f8c91747b1d11b (patch) | |
tree | e3981d6b87f905ae7756ea40db80ab94b983c5e0 /library | |
parent | f2ba23c5317d5946330c79c359b396664ede4bc9 (diff) | |
download | tcl-4b3cad67669ee24ba10a1b95e9f8c91747b1d11b.zip tcl-4b3cad67669ee24ba10a1b95e9f8c91747b1d11b.tar.gz tcl-4b3cad67669ee24ba10a1b95e9f8c91747b1d11b.tar.bz2 |
* library/init.tcl: Use auto-loading to bring in Tcl Module
* library/tclIndex: support as needed. This reduces startup
* library/tm.tcl: time by delaying this initialization to
a later time.
Diffstat (limited to 'library')
-rw-r--r-- | library/init.tcl | 73 | ||||
-rw-r--r-- | library/tclIndex | 6 | ||||
-rw-r--r-- | library/tm.tcl | 1 |
3 files changed, 35 insertions, 45 deletions
diff --git a/library/init.tcl b/library/init.tcl index 9fef16f..2f6e51c 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -3,7 +3,7 @@ # Default system startup file for Tcl-based applications. Defines # "unknown" procedure and auto-load facilities. # -# RCS: @(#) $Id: init.tcl,v 1.69 2004/11/30 22:19:21 dgp Exp $ +# RCS: @(#) $Id: init.tcl,v 1.70 2005/04/15 15:50:35 dgp Exp $ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. @@ -48,8 +48,8 @@ if {![info exists auto_path]} { } namespace eval tcl { variable Dir - if {[info library] != ""} { - foreach Dir [list [info library] [file dirname [info library]]] { + if {$::tcl_library != ""} { + foreach Dir [list $::tcl_library [file dirname $::tcl_library]] { if {[lsearch -exact $::auto_path $Dir] < 0} { lappend ::auto_path $Dir } @@ -119,6 +119,32 @@ if {![interp issafe]} { [string equal $::tcl_platform(os) "Darwin"]} { package unknown [list tcl::MacOSXPkgUnknown [package unknown]] } + # Set up search for Tcl Modules (TIP #189). + package unknown [list ::tcl::tm::UnknownHandler [package unknown]] + + # Set up the 'clock' ensemble + + namespace eval ::tcl::clock [list variable TclLibDir $::tcl_library] + + proc clock args { + namespace eval ::tcl::clock [list namespace ensemble create -command \ + [uplevel 1 [list namespace origin [lindex [info level 0] 0]]] \ + -subcommands { + add clicks format microseconds milliseconds scan seconds + }] + + # Auto-loading stubs for 'clock.tcl' + + foreach cmd {add format scan} { + proc ::tcl::clock::$cmd args { + variable TclLibDir + source -encoding utf-8 [file join $TclLibDir clock.tcl] + return [uplevel 1 [info level 0]] + } + } + + return [uplevel 1 [info level 0]] + } } # Conditionalize for presence of exec. @@ -739,44 +765,3 @@ proc tcl::CopyDirectory {action src dest} { } return } - -# Set up the 'clock' ensemble - -if { ![interp issafe] } { - - namespace eval ::tcl::clock \ - [list variable TclLibDir [file dirname [info script]]] - - namespace eval ::tcl::clock { - namespace ensemble create -command ::clock \ - -subcommands { - add clicks format - microseconds milliseconds - scan seconds - } - - # Auto-loading stub for 'clock.tcl' - - proc add args { - variable TclLibDir - source -encoding utf-8 [file join $TclLibDir clock.tcl] - return [uplevel 1 [info level 0]] - } - proc format args { - variable TclLibDir - source -encoding utf-8 [file join $TclLibDir clock.tcl] - return [uplevel 1 [info level 0]] - } - proc scan args { - variable TclLibDir - source -encoding utf-8 [file join $TclLibDir clock.tcl] - return [uplevel 1 [info level 0]] - } - } -} - -# Set up search for Tcl Modules (TIP #189). - -if { ![interp issafe] } { - source [file join [file dirname [info script]] tm.tcl] -} diff --git a/library/tclIndex b/library/tclIndex index 5d963a0..3a435d1 100644 --- a/library/tclIndex +++ b/library/tclIndex @@ -74,8 +74,14 @@ set auto_index(::safe::AliasLoad) [list source [file join $dir safe.tcl]] set auto_index(::safe::FileInAccessPath) [list source [file join $dir safe.tcl]] set auto_index(::safe::Subset) [list source [file join $dir safe.tcl]] set auto_index(::safe::AliasSubset) [list source [file join $dir safe.tcl]] +set auto_index(::safe::AliasEncoding) [list source [file join $dir safe.tcl]] set auto_index(tcl_wordBreakAfter) [list source [file join $dir word.tcl]] set auto_index(tcl_wordBreakBefore) [list source [file join $dir word.tcl]] set auto_index(tcl_endOfWord) [list source [file join $dir word.tcl]] set auto_index(tcl_startOfNextWord) [list source [file join $dir word.tcl]] set auto_index(tcl_startOfPreviousWord) [list source [file join $dir word.tcl]] +set auto_index(::tcl::tm::add) [list source [file join $dir tm.tcl]] +set auto_index(::tcl::tm::remove) [list source [file join $dir tm.tcl]] +set auto_index(::tcl::tm::list) [list source [file join $dir tm.tcl]] +set auto_index(::tcl::tm::UnknownHandler) [list source [file join $dir tm.tcl]] +set auto_index(::tcl::tm::roots) [list source [file join $dir tm.tcl]] diff --git a/library/tm.tcl b/library/tm.tcl index 14dab45..5c05e27 100644 --- a/library/tm.tcl +++ b/library/tm.tcl @@ -362,4 +362,3 @@ proc ::tcl::tm::roots {paths} { # handler into the chain. ::tcl::tm::Defaults -package unknown [list ::tcl::tm::UnknownHandler [package unknown]] |