summaryrefslogtreecommitdiffstats
path: root/library/init.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'library/init.tcl')
-rw-r--r--library/init.tcl63
1 files changed, 28 insertions, 35 deletions
diff --git a/library/init.tcl b/library/init.tcl
index 49a523c..62729e6 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -16,7 +16,7 @@
if {[info commands package] == ""} {
error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]"
}
-package require -exact Tcl 8.7a0
+package require -exact Tcl 8.5.18
# Compute the auto path to use in this interpreter.
# The values on the path come from several locations:
@@ -45,7 +45,6 @@ if {![info exists auto_path]} {
set auto_path ""
}
}
-
namespace eval tcl {
variable Dir
foreach Dir [list $::tcl_library [file dirname $::tcl_library]] {
@@ -113,8 +112,6 @@ namespace eval tcl {
}
}
-namespace eval tcl::Pkg {}
-
# Windows specific end of initialization
if {(![interp issafe]) && ($tcl_platform(platform) eq "windows")} {
@@ -145,7 +142,11 @@ if {(![interp issafe]) && ($tcl_platform(platform) eq "windows")} {
}
}
if {![info exists env(COMSPEC)]} {
- set env(COMSPEC) cmd.exe
+ if {$tcl_platform(os) eq "Windows NT"} {
+ set env(COMSPEC) cmd.exe
+ } else {
+ set env(COMSPEC) command.com
+ }
}
}
InitWinEnv
@@ -217,9 +218,11 @@ if {[namespace which -command tclLog] eq ""} {
# exist in the interpreter. It takes the following steps to make the
# command available:
#
-# 1. See if the autoload facility can locate the command in a
+# 1. See if the command has the form "namespace inscope ns cmd" and
+# if so, concatenate its arguments onto the end and evaluate it.
+# 2. See if the autoload facility can locate the command in a
# Tcl script file. If so, load it and execute it.
-# 2. If the command was invoked interactively at top-level:
+# 3. If the command was invoked interactively at top-level:
# (a) see if the command exists as an executable UNIX program.
# If so, "exec" the command.
# (b) see if the command requests csh-like history substitution
@@ -236,14 +239,22 @@ proc unknown args {
variable ::tcl::UnknownPending
global auto_noexec auto_noload env tcl_interactive errorInfo errorCode
- if {[info exists errorInfo]} {
- set savedErrorInfo $errorInfo
- }
- if {[info exists errorCode]} {
- set savedErrorCode $errorCode
+ # If the command word has the form "namespace inscope ns cmd"
+ # then concatenate its arguments onto the end and evaluate it.
+
+ set cmd [lindex $args 0]
+ if {[regexp "^:*namespace\[ \t\n\]+inscope" $cmd] && [llength $cmd] == 4} {
+ #return -code error "You need an {*}"
+ set arglist [lrange $args 1 end]
+ set ret [catch {uplevel 1 ::$cmd $arglist} result opts]
+ dict unset opts -errorinfo
+ dict incr opts -level
+ return -options $opts $result
}
- set name [lindex $args 0]
+ catch {set savedErrorInfo $errorInfo}
+ catch {set savedErrorCode $errorCode}
+ set name $cmd
if {![info exists auto_noload]} {
#
# Make sure we're not trying to load the same proc twice.
@@ -401,8 +412,7 @@ proc unknown args {
return -code error "ambiguous command name \"$name\": [lsort $cmds]"
}
}
- return -code error -errorcode [list TCL LOOKUP COMMAND $name] \
- "invalid command name \"$name\""
+ return -code error "invalid command name \"$name\""
}
# auto_load --
@@ -460,22 +470,6 @@ proc auto_load {cmd {namespace {}}} {
return 0
}
-# ::tcl::Pkg::source --
-# This procedure provides an alternative "source" command, which doesn't
-# register the file for the "package files" command. Safe interpreters
-# don't have to do anything special.
-#
-# Arguments:
-# filename
-
-proc ::tcl::Pkg::source {filename} {
- if {[interp issafe]} {
- uplevel 1 [list ::source $filename]
- } else {
- uplevel 1 [list ::source -nopkg $filename]
- }
-}
-
# auto_load_index --
# Loads the contents of tclIndex files on the auto_path directory
# list. This is usually invoked within auto_load to load the index
@@ -518,7 +512,7 @@ proc auto_load_index {} {
}
set name [lindex $line 0]
set auto_index($name) \
- "::tcl::Pkg::source [file join $dir [lindex $line 1]]"
+ "source [file join $dir [lindex $line 1]]"
}
} else {
error "[file join $dir tclIndex] isn't a proper Tcl index file"
@@ -655,9 +649,8 @@ proc auto_execok name {
}
set auto_execs($name) ""
- set shellBuiltins [list assoc cls copy date del dir echo erase ftype \
- md mkdir mklink move rd ren rename rmdir start \
- time type ver vol]
+ set shellBuiltins [list cls copy date del dir echo erase md mkdir \
+ mklink rd ren rename rmdir start time type ver vol]
if {[info exists env(PATHEXT)]} {
# Add an initial ; to have the {} extension check first.
set execExtensions [split ";$env(PATHEXT)" ";"]