Tcl Source Code

Artifact [35d54b85f6]
Login

Artifact 35d54b85f6f642505b6f5d31561e9714a9ed1922:

Attachment "1237755.patch" to ticket [1237755fff] added by dgp 2005-07-22 03:39:21.
Index: library/auto.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/library/auto.tcl,v
retrieving revision 1.12.2.8
diff -u -r1.12.2.8 auto.tcl
--- library/auto.tcl	27 Jun 2005 18:20:26 -0000	1.12.2.8
+++ library/auto.tcl	21 Jul 2005 20:32:28 -0000
@@ -33,9 +33,7 @@
 	    rename $p {}
 	}
     }
-    catch {unset auto_execs}
-    catch {unset auto_index}
-    catch {unset auto_oldpath}
+    unset -nocomplain auto_execs auto_index auto_oldpath
 }
 
 # tcl_findLibrary --
@@ -61,8 +59,7 @@
 
     # The C application may have hardwired a path, which we honor
 
-    set variableSet [info exists the_library]
-    if {$variableSet && $the_library ne ""} {
+    if {[info exists the_library] && $the_library ne ""} {
 	lappend dirs $the_library
     } else {
 
@@ -164,9 +161,7 @@
             }
         }
     }
-    if {!$variableSet} {
-	unset the_library
-    }
+    unset -nocomplain the_library
     set msg "Can't find a usable $initScript in the following directories: \n"
     append msg "    $dirs\n\n"
     append msg "$errors\n\n"
@@ -219,12 +214,12 @@
     append index "# sets an element in the auto_index array, where the\n"
     append index "# element name is the name of a command and the value is\n"
     append index "# a script that loads the command.\n\n"
-    if {$args == ""} {
+    if {[llength $args] == 0} {
 	set args *.tcl
     }
 
     auto_mkindex_parser::init
-    foreach file [eval glob $args] {
+    foreach file [eval [linsert $args 0 glob --]] {
         if {[catch {auto_mkindex_parser::mkindex $file} msg] == 0} {
             append index $msg
         } else {
@@ -257,10 +252,10 @@
     append index "# sets an element in the auto_index array, where the\n"
     append index "# element name is the name of a command and the value is\n"
     append index "# a script that loads the command.\n\n"
-    if {[string equal $args ""]} {
+    if {[llength $args] == 0} {
 	set args *.tcl
     }
-    foreach file [eval glob $args] {
+    foreach file [eval [linsert $args 0 glob --]] {
 	set f ""
 	set error [catch {
 	    set f [open $file]
@@ -378,7 +373,7 @@
     # in case there were any $ in the proc name.  This will cause a problem
     # if somebody actually tries to have a \0 in their proc name.  Too bad
     # for them.
-    regsub -all {\$} $contents "\0" contents
+    set contents [string map "$ \u0000" $contents]
     
     set index ""
     set contextStack ""
@@ -456,12 +451,10 @@
 
     set ns [namespace qualifiers $name]
     set tail [namespace tail $name]
-    if {[string equal $ns ""]} {
-        set fakeName "[namespace current]::_%@fake_$tail"
+    if {$ns eq ""} {
+        set fakeName [namespace current]::_%@fake_$tail
     } else {
-        set fakeName "_%@fake_$name"
-        regsub -all {::} $fakeName "_" fakeName
-        set fakeName "[namespace current]::$fakeName"
+        set fakeName [namespace current]::[string map {:: _} _%@fake_$name]
     }
     proc $fakeName $arglist $body
 
@@ -470,7 +463,7 @@
     # we have to build procs with the fully qualified names, and
     # have the procs point to the aliases.
 
-    if {[regexp {::} $name]} {
+    if {[string match *::* $name]} {
         set exportCmd [list _%@namespace export [namespace tail $name]]
         $parser eval [list _%@namespace eval $ns $exportCmd]
  
@@ -520,7 +513,7 @@
         }
     }
 
-    if {[string equal [namespace qualifiers $name] ""]} {
+    if {[namespace qualifiers $name] eq ""} {
         set name [namespace tail $name]
     } elseif {![string match ::* $name]} {
         set name "::$name"
@@ -528,8 +521,7 @@
     
     # Earlier, mkindex replaced all $'s with \0.  Now, we have to reverse
     # that replacement.
-    regsub -all "\0" $name "\$" name
-    return $name
+    return [string map "\u0000 $" $name]
 }
 
 # Register all of the procedures for the auto_mkindex parser that
@@ -561,7 +553,7 @@
 
 auto_mkindex_parser::hook {
     if {![catch {package require tbcload}]} {
-	if {[llength [info commands tbcload::bcproc]] == 0} {
+	if {[namespace which -command tbcload::bcproc] ne ""} {
 	    auto_load tbcload::bcproc
 	}
 	load {} tbcload $auto_mkindex_parser::parser
@@ -612,7 +604,7 @@
             variable parser
             variable imports
             foreach pattern $args {
-                if {[string compare $pattern "-force"]} {
+                if {$pattern ne "-force"} {
                     lappend imports $pattern
                 }
             }
Index: library/history.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/library/history.tcl,v
retrieving revision 1.5
diff -u -r1.5 history.tcl
--- library/history.tcl	17 May 2001 08:18:56 -0000	1.5
+++ library/history.tcl	21 Jul 2005 20:32:28 -0000
@@ -168,14 +168,14 @@
     variable history
 
     # Do not add empty commands to the history
-    if {[string trim $command] == ""} {
+    if {[string trim $command] eq ""} {
 	return ""
     }
 
     set i [incr history(nextid)]
     set history($i) $command
     set j [incr history(oldest)]
-    if {[info exists history($j)]} {unset history($j)}
+    unset -nocomplain history($j)
     if {[string match e* $exec]} {
 	return [uplevel #0 $command]
     } else {
@@ -198,13 +198,13 @@
 
  proc tcl::HistKeep {{limit {}}} {
     variable history
-    if {[string length $limit] == 0} {
+    if {$limit eq ""} {
 	return $history(keep)
     } else {
 	set oldold $history(oldest)
 	set history(oldest) [expr {$history(nextid) - $limit}]
 	for {} {$oldold <= $history(oldest)} {incr oldold} {
-	    if {[info exists history($oldold)]} {unset history($oldold)}
+	    unset -nocomplain history($oldold)
 	}
 	set history(keep) $limit
     }
@@ -246,7 +246,7 @@
 
  proc tcl::HistInfo {{num {}}} {
     variable history
-    if {$num == {}} {
+    if {$num eq ""} {
 	set num [expr {$history(keep) + 1}]
     }
     set result {}
@@ -256,8 +256,7 @@
 	if {![info exists history($i)]} {
 	    continue
 	}
-	set cmd [string trimright $history($i) \ \n]
-	regsub -all \n $cmd "\n\t" cmd
+	set cmd [string map [list \n \n\t] [string trimright $history($i) \ \n]]
 	append result $newline[format "%6d  %s" $i $cmd]
 	set newline \n
     }
@@ -281,7 +280,7 @@
 
  proc tcl::HistRedo {{event -1}} {
     variable history
-    if {[string length $event] == 0} {
+    if {$event eq ""} {
 	set event -1
     }
     set i [HistIndex $event]
Index: library/init.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/library/init.tcl,v
retrieving revision 1.55.2.5
diff -u -r1.55.2.5 init.tcl
--- library/init.tcl	28 Apr 2005 05:34:40 -0000	1.55.2.5
+++ library/init.tcl	21 Jul 2005 20:32:28 -0000
@@ -48,7 +48,7 @@
 }
 namespace eval tcl {
     variable Dir
-    if {[info library] != ""} {
+    if {[info library] ne ""} {
 	foreach Dir [list [info library] [file dirname [info library]]] {
 	    if {[lsearch -exact $::auto_path $Dir] < 0} {
 		lappend ::auto_path $Dir
@@ -71,7 +71,7 @@
   
 # Windows specific end of initialization
 
-if {(![interp issafe]) && [string equal $tcl_platform(platform) "windows"]} {
+if {(![interp issafe]) && $tcl_platform(platform) eq "windows"} {
     namespace eval tcl {
 	proc EnvTraceProc {lo n1 n2 op} {
 	    set x $::env($n2)
@@ -82,23 +82,23 @@
 	    global env tcl_platform
 	    foreach p [array names env] {
 		set u [string toupper $p]
-		if {![string equal $u $p]} {
+		if {$u ne $p} {
 		    switch -- $u {
 			COMSPEC -
 			PATH {
 			    if {![info exists env($u)]} {
 				set env($u) $env($p)
 			    }
-			    trace variable env($p) w \
+			    trace add variable env($p) write \
 				    [namespace code [list EnvTraceProc $p]]
-			    trace variable env($u) w \
+			    trace add variable env($u) write \
 				    [namespace code [list EnvTraceProc $p]]
 			}
 		    }
 		}
 	    }
 	    if {![info exists env(COMSPEC)]} {
-		if {[string equal $tcl_platform(os) "Windows NT"]} {
+		if {$tcl_platform(os) eq "Windows NT"} {
 		    set env(COMSPEC) cmd.exe
 		} else {
 		    set env(COMSPEC) command.com
@@ -115,18 +115,18 @@
 
 if {![interp issafe]} {
     # setup platform specific unknown package handlers
-    if {[string equal $::tcl_platform(platform) "unix"] && \
-	    [string equal $::tcl_platform(os) "Darwin"]} {
+    if {$::tcl_platform(platform) eq "unix"
+	    && $::tcl_platform(os) eq "Darwin"} {
 	package unknown [list tcl::MacOSXPkgUnknown [package unknown]]
     }
-    if {[string equal $::tcl_platform(platform) "macintosh"]} {
+    if {$::tcl_platform(platform) eq "macintosh"} {
 	package unknown [list tcl::MacPkgUnknown [package unknown]]
     }
 }
 
 # Conditionalize for presence of exec.
 
-if {[llength [info commands exec]] == 0} {
+if {[namespace which -command exec] eq ""} {
 
     # Some machines, such as the Macintosh, do not have exec. Also, on all
     # platforms, safe interpreters do not have exec.
@@ -139,7 +139,7 @@
 # Define a log command (which can be overwitten to log errors
 # differently, specially when stderr is not available)
 
-if {[llength [info commands tclLog]] == 0} {
+if {[namespace which -command tclLog] eq ""} {
     proc tclLog {string} {
 	catch {puts stderr $string}
     }
@@ -199,7 +199,7 @@
     }
     set savedErrorCode $errorCode
     set savedErrorInfo $errorInfo
-    set name [lindex $args 0]
+    set name $cmd
     if {![info exists auto_noload]} {
 	#
 	# Make sure we're not trying to load the same proc twice.
@@ -273,15 +273,15 @@
 	}
     }
 
-    if {([info level] == 1) && [string equal [info script] ""] \
+    if {([info level] == 1) && [info script] eq "" \
 	    && [info exists tcl_interactive] && $tcl_interactive} {
 	if {![info exists auto_noexec]} {
 	    set new [auto_execok $name]
-	    if {$new != ""} {
+	    if {$new ne ""} {
 		set errorCode $savedErrorCode
 		set errorInfo $savedErrorInfo
 		set redir ""
-		if {[string equal [info commands console] ""]} {
+		if {[namespace which -command console] eq ""} {
 		    set redir ">&@stdout <@stdin"
 		}
 		return [uplevel 1 exec $redir $new [lrange $args 1 end]]
@@ -289,11 +289,11 @@
 	}
 	set errorCode $savedErrorCode
 	set errorInfo $savedErrorInfo
-	if {[string equal $name "!!"]} {
+	if {$name eq "!!"} {
 	    set newcmd [history event]
-	} elseif {[regexp {^!(.+)$} $name dummy event]} {
+	} elseif {[regexp {^!(.+)$} $name -> event]} {
 	    set newcmd [history event $event]
-	} elseif {[regexp {^\^([^^]*)\^([^^]*)\^?$} $name dummy old new]} {
+	} elseif {[regexp {^\^([^^]*)\^([^^]*)\^?$} $name -> old new]} {
 	    set newcmd [history event -1]
 	    catch {regsub -all -- $old $newcmd $new newcmd}
 	}
@@ -304,7 +304,7 @@
 	}
 
 	set ret [catch {set candidates [info commands $name*]} msg]
-	if {[string equal $name "::"]} {
+	if {$name eq "::"} {
 	    set name ""
 	}
 	if {$ret != 0} {
@@ -312,11 +312,18 @@
 		"error in unknown while checking if \"$name\" is\
 		a unique command abbreviation:\n$msg"
 	}
+	# Handle empty $name separately due to strangeness in [string first]
+	if {$name eq ""} {
+	    if {[llength $candidates] != 1} {
+		return -code error "empty command name \"\""
+	    }
+	    return [uplevel 1 [lreplace $args 0 0 [lindex $candidates 0]]]
+	}
 	# Filter out bogus matches when $name contained
 	# a glob-special char [Bug 946952]
 	set cmds [list]
 	foreach x $candidates {
-	    if {[string range $x 0 [expr [string length $name]-1]] eq $name} {
+	    if {[string first $name $x] == 0} {
 		lappend cmds $x
 	    }
 	}
@@ -324,12 +331,7 @@
 	    return [uplevel 1 [lreplace $args 0 0 [lindex $cmds 0]]]
 	}
 	if {[llength $cmds]} {
-	    if {[string equal $name ""]} {
-		return -code error "empty command name \"\""
-	    } else {
-		return -code error \
-			"ambiguous command name \"$name\": [lsort $cmds]"
-	    }
+	    return -code error "ambiguous command name \"$name\": [lsort $cmds]"
 	}
     }
     return -code error "invalid command name \"$name\""
@@ -350,7 +352,7 @@
 proc auto_load {cmd {namespace {}}} {
     global auto_index auto_oldpath auto_path
 
-    if {[string length $namespace] == 0} {
+    if {$namespace eq ""} {
 	set namespace [uplevel 1 [list ::namespace current]]
     }
     set nameList [auto_qualify $cmd $namespace]
@@ -402,8 +404,7 @@
 proc auto_load_index {} {
     global auto_index auto_oldpath auto_path errorInfo errorCode
 
-    if {[info exists auto_oldpath] && \
-	    [string equal $auto_oldpath $auto_path]} {
+    if {[info exists auto_oldpath] && $auto_oldpath eq $auto_path} {
 	return 0
     }
     set auto_oldpath $auto_path
@@ -422,12 +423,11 @@
 	} else {
 	    set error [catch {
 		set id [gets $f]
-		if {[string equal $id \
-			"# Tcl autoload index file, version 2.0"]} {
+		if {$id eq "# Tcl autoload index file, version 2.0"} {
 		    eval [read $f]
-		} elseif {[string equal $id "# Tcl autoload index file: each line identifies a Tcl"]} {
+		} elseif {$id eq "# Tcl autoload index file: each line identifies a Tcl"} {
 		    while {[gets $f line] >= 0} {
-			if {[string equal [string index $line 0] "#"] \
+			if {[string index $line 0] eq "#" 
 				|| ([llength $line] != 2)} {
 			    continue
 			}
@@ -439,7 +439,7 @@
 		    error "[file join $dir tclIndex] isn't a proper Tcl index file"
 		}
 	    } msg]
-	    if {$f != ""} {
+	    if {$f ne ""} {
 		close $f
 	    }
 	    if {$error} {
@@ -478,13 +478,13 @@
     # with the following form :
     # ( inputCmd, inputNameSpace) -> output
 
-    if {[regexp {^::(.*)$} $cmd x tail]} {
+    if {[string match ::* $cmd]} {
 	if {$n > 1} {
 	    # ( ::foo::bar , * ) -> ::foo::bar
 	    return [list $cmd]
 	} else {
 	    # ( ::global , * ) -> global
-	    return [list $tail]
+	    return [list [string range $cmd 2 end]]
 	}
     }
     
@@ -492,14 +492,14 @@
     # (if the current namespace is not the global one)
 
     if {$n == 0} {
-	if {[string equal $namespace ::]} {
+	if {$namespace eq "::"} {
 	    # ( nocolons , :: ) -> nocolons
 	    return [list $cmd]
 	} else {
 	    # ( nocolons , ::sub ) -> ::sub::nocolons nocolons
 	    return [list ${namespace}::$cmd $cmd]
 	}
-    } elseif {[string equal $namespace ::]} {
+    } elseif {$namespace eq "::"} {
 	#  ( foo::bar , :: ) -> ::foo::bar
 	return [list ::$cmd]
     } else {
@@ -554,7 +554,7 @@
 # Arguments: 
 # name -			Name of a command.
 
-if {[string equal windows $tcl_platform(platform)]} {
+if {$tcl_platform(platform) eq "windows"} {
 # Windows version.
 #
 # Note that info executable doesn't work under Windows, so we have to
@@ -572,7 +572,7 @@
 
     set shellBuiltins [list cls copy date del erase dir echo mkdir \
 	    md rename ren rmdir rd time type ver vol]
-    if {[string equal $tcl_platform(os) "Windows NT"]} {
+    if {$tcl_platform(os) eq "Windows NT"} {
 	# NT includes the 'start' built-in
 	lappend shellBuiltins "start"
     }
@@ -609,7 +609,7 @@
 	set windir $env(WINDIR) 
     }
     if {[info exists windir]} {
-	if {[string equal $tcl_platform(os) "Windows NT"]} {
+	if {$tcl_platform(os) eq "Windows NT"} {
 	    append path "$windir/system32;"
 	}
 	append path "$windir/system;$windir;"
@@ -623,7 +623,7 @@
 
     foreach dir [split $path {;}] {
 	# Skip already checked directories
-	if {[info exists checked($dir)] || [string equal {} $dir]} { continue }
+	if {[info exists checked($dir)] || $dir eq {}} { continue }
 	set checked($dir) {}
 	foreach ext $execExtensions {
 	    set file [file join $dir ${name}${ext}]
@@ -652,7 +652,7 @@
 	return $auto_execs($name)
     }
     foreach dir [split $env(PATH) :] {
-	if {[string equal $dir ""]} {
+	if {$dir eq ""} {
 	    set dir .
 	}
 	set file [file join $dir $name]
@@ -683,7 +683,7 @@
 proc tcl::CopyDirectory {action src dest} {
     set nsrc [file normalize $src]
     set ndest [file normalize $dest]
-    if {[string equal $action "renaming"]} {
+    if {$action eq "renaming"} {
 	# Can't rename volumes.  We could give a more precise
 	# error message here, but that would break the test suite.
 	if {[lsearch -exact [file volumes] $nsrc] != -1} {
@@ -693,12 +693,12 @@
 	}
     }
     if {[file exists $dest]} {
-	if {$nsrc == $ndest} {
+	if {$nsrc eq $ndest} {
 	    return -code error "error $action \"$src\" to\
 	      \"$dest\": trying to rename a volume or move a directory\
 	      into itself"
 	}
-	if {[string equal $action "copying"]} {
+	if {$action eq "copying"} {
 	    return -code error "error $action \"$src\" to\
 	      \"$dest\": file already exists"
 	} else {
@@ -707,10 +707,11 @@
 	    # can be returned in various combinations.  Anyway,
 	    # if any other file is returned, we must signal an error.
 	    set existing [glob -nocomplain -directory $dest * .*]
-	    eval [list lappend existing] \
-	      [glob -nocomplain -directory $dest -type hidden * .*]
+	    eval [linsert \
+		    [glob -nocomplain -directory $dest -type hidden * .*] 0 \
+		    lappend existing]
 	    foreach s $existing {
-		if {([file tail $s] != ".") && ([file tail $s] != "..")} {
+		if {([file tail $s] ne ".") && ([file tail $s] ne "..")} {
 		    return -code error "error $action \"$src\" to\
 		      \"$dest\": file already exists"
 		}
@@ -720,7 +721,7 @@
 	if {[string first $nsrc $ndest] != -1} {
 	    set srclen [expr {[llength [file split $nsrc]] -1}]
 	    set ndest [lindex [file split $ndest] $srclen]
-	    if {$ndest == [file tail $nsrc]} {
+	    if {$ndest eq [file tail $nsrc]} {
 		return -code error "error $action \"$src\" to\
 		  \"$dest\": trying to rename a volume or move a directory\
 		  into itself"
@@ -738,7 +739,7 @@
       [glob -nocomplain -directory $src -types hidden *]]
     
     foreach s [lsort -unique $filelist] {
-	if {([file tail $s] != ".") && ([file tail $s] != "..")} {
+	if {([file tail $s] ne ".") && ([file tail $s] ne "..")} {
 	    file copy $s [file join $dest [file tail $s]]
 	}
     }
Index: library/ldAout.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/library/ldAout.tcl,v
retrieving revision 1.5
diff -u -r1.5 ldAout.tcl
--- library/ldAout.tcl	28 Sep 2001 01:21:53 -0000	1.5
+++ library/ldAout.tcl	21 Jul 2005 20:32:28 -0000
@@ -29,11 +29,12 @@
 # and Design Engineering (MADE) Initiative through ARPA contract
 # F33615-94-C-4400.
 
+package require Tcl 8.4
 proc tclLdAout {{cc {}} {shlib_suffix {}} {shlib_cflags none}} {
     global env
     global argv
 
-    if {[string equal $cc ""]} {
+    if {$cc eq ""} {
 	set cc $env(CC)
     }
 
@@ -43,9 +44,9 @@
     # 3 parameters to the function tclLdAout. For compatibility, this
     # function now accepts both 2 and 3 parameters.
 
-    if {[string equal $shlib_suffix ""]} {
+    if {$shlib_suffix eq ""} {
 	set shlib_cflags $env(SHLIB_CFLAGS)
-    } elseif {[string equal $shlib_cflags "none"]} {
+    } elseif {$shlib_cflags eq "none"} {
 	set shlib_cflags $shlib_suffix
     }
 
@@ -85,7 +86,7 @@
 	if {$minusO} {
 	    set outputFile $a
 	    set minusO 0
-	} elseif {![string compare $a -o]} {
+	} elseif {$a eq "-o"} {
 	    set minusO 1
 	}
 	if {[regexp {^-[lL]} $a]} {
@@ -160,7 +161,7 @@
     }
     close $f
 
-    if {[string equal $entryPoints ""]} {
+    if {$entryPoints eq ""} {
 	error "No entry point found in objects"
     }
 
@@ -209,7 +210,7 @@
 
     # Now compose and execute the ld command that packages the module
 
-    if {[string equal $shlib_suffix ".a"]} {
+    if {$shlib_suffix eq ".a"} {
 	set ldCommand "ar cr $outputFile"
 	regsub { -o} $tail {} tail
     } else {
@@ -224,7 +225,7 @@
     }
     puts stderr $ldCommand
     eval exec $ldCommand
-    if {[string equal $shlib_suffix ".a"]} {
+    if {$shlib_suffix eq ".a"} {
 	exec ranlib $outputFile
     }
 
Index: library/package.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/library/package.tcl,v
retrieving revision 1.23.2.2
diff -u -r1.23.2.2 package.tcl
--- library/package.tcl	24 Jul 2003 08:23:17 -0000	1.23.2.2
+++ library/package.tcl	21 Jul 2005 20:32:29 -0000
@@ -33,8 +33,8 @@
 
 proc pkg_compareExtension { fileName {ext {}} } {
     global tcl_platform
-    if {![string length $ext]} {set ext [info sharedlibextension]}
-    if {[string equal $tcl_platform(platform) "windows"]} {
+    if {$ext eq ""} {set ext [info sharedlibextension]}
+    if {$tcl_platform(platform) eq "windows"} {
         return [string equal -nocase [file extension $fileName] $ext]
     } else {
         # Some unices add trailing numbers after the .so, so
@@ -42,7 +42,7 @@
         set root $fileName
         while {1} {
             set currExt [file extension $root]
-            if {[string equal $currExt $ext]} {
+            if {$currExt eq $ext} {
                 return 1
             } 
 
@@ -140,7 +140,7 @@
     set oldDir [pwd]
     cd $dir
 
-    if {[catch {eval glob $patternList} fileList]} {
+    if {[catch {eval [linsert $patternList 0 glob --]} fileList]} {
 	global errorCode errorInfo
 	cd $oldDir
 	return -code error -errorcode $errorCode -errorinfo $errorInfo $fileList
@@ -151,7 +151,7 @@
 	# interpreter, and get a list of the new commands and packages
 	# that are defined.
 
-	if {[string equal $file "pkgIndex.tcl"]} {
+	if {$file eq "pkgIndex.tcl"} {
 	    continue
 	}
 
@@ -165,7 +165,7 @@
 	# Load into the child any packages currently loaded in the parent
 	# interpreter that match the -load pattern.
 
-	if {[string length $loadPat]} {
+	if {$loadPat ne ""} {
 	    if {$doVerbose} {
 		tclLog "currently loaded packages: '[info loaded]'"
 		tclLog "trying to load all packages matching $loadPat"
@@ -191,7 +191,7 @@
 	    } elseif {$doVerbose} {
 		tclLog "loaded [lindex $pkg 0] [lindex $pkg 1]"
 	    }
-	    if {[string equal [lindex $pkg 1] "Tk"]} {
+	    if {[lindex $pkg 1] eq "Tk"} {
 		# Withdraw . if Tk was loaded, to avoid showing a window.
 		$c eval [list wm withdraw .]
 	    }
@@ -206,7 +206,7 @@
 	    proc package {what args} {
 		switch -- $what {
 		    require { return ; # ignore transitive requires }
-		    default { eval __package_orig {$what} $args }
+		    default { uplevel 1 [linsert $args 0 __package_orig $what] }
 		}
 	    }
 	    proc tclPkgUnknown args {}
@@ -261,7 +261,8 @@
 		proc ::tcl::GetAllNamespaces {{root ::}} {
 		    set list $root
 		    foreach ns [namespace children $root] {
-			eval lappend list [::tcl::GetAllNamespaces $ns]
+			eval [linsert [::tcl::GetAllNamespaces $ns] 0 \
+				lappend list]
 		    }
 		    return $list
 		}
@@ -272,7 +273,7 @@
 		    set ::tcl::namespaces($::tcl::x) 1
 		}
 		foreach ::tcl::x [package names] {
-		    if {[string compare [package provide $::tcl::x] ""]} {
+		    if {[package provide $::tcl::x] ne ""} {
 			set ::tcl::packages($::tcl::x) 1
 		    }
 		}
@@ -320,7 +321,7 @@
 			    set ::tcl::newCmds($::tcl::x) 1
 			}
 			foreach ::tcl::x $::tcl::origCmds {
-			    catch {unset ::tcl::newCmds($::tcl::x)}
+			    unset -nocomplain ::tcl::newCmds($::tcl::x)
 			}
 			foreach ::tcl::x [array names ::tcl::newCmds] {
 			    # determine which namespace a command comes from
@@ -333,7 +334,7 @@
 			    set ::tcl::abs \
 				    [lindex [auto_qualify $::tcl::abs ::] 0]
 			    
-			    if {[string compare $::tcl::x $::tcl::abs]} {
+			    if {$::tcl::x ne $::tcl::abs} {
 				# Name changed during qualification
 				
 				set ::tcl::newCmds($::tcl::abs) 1
@@ -347,7 +348,7 @@
 		# a version provided, then record it
 
 		foreach ::tcl::x [package names] {
-		    if {[string compare [package provide $::tcl::x] ""] \
+		    if {[package provide $::tcl::x] ne ""
 			    && ![info exists ::tcl::packages($::tcl::x)]} {
 			lappend ::tcl::newPkgs \
 			    [list $::tcl::x [package provide $::tcl::x]]
@@ -447,7 +448,7 @@
 	set f [lindex $fileInfo 0]
 	set type [lindex $fileInfo 1]
 	foreach cmd [lindex $fileInfo 2] {
-	    if {[string equal $type "load"]} {
+	    if {$type eq "load"} {
 		set auto_index($cmd) [list load [file join $dir $f] $pkg]
 	    } else {
 		set auto_index($cmd) [list source [file join $dir $f]]
@@ -595,7 +596,7 @@
 	    }
 	}
 	set use_path [lrange $use_path 0 end-1]
-	if {[string compare $old_path $auto_path]} {
+	if {$old_path ne $auto_path} {
 	    foreach dir $auto_path {
 		lappend use_path $dir
 	    }
@@ -640,7 +641,7 @@
 		    if {[file isfile $x]} {
 			set res [resource open $x]
 			foreach y [resource list TEXT $res] {
-			    if {[string equal $y "pkgIndex"]} {source -rsrc pkgIndex}
+			    if {$y eq "pkgIndex"} {source -rsrc pkgIndex}
 			}
 			catch {resource close $res}
 		    }
@@ -649,7 +650,7 @@
 	    }
 	}
 	set use_path [lrange $use_path 0 end-1]
-	if {[string compare $old_path $auto_path]} {
+	if {$old_path ne $auto_path} {
 	    foreach dir $auto_path {
 		lappend use_path $dir
 	    }
Index: library/safe.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/library/safe.tcl,v
retrieving revision 1.9.2.2
diff -u -r1.9.2.2 safe.tcl
--- library/safe.tcl	29 Jun 2004 09:39:01 -0000	1.9.2.2
+++ library/safe.tcl	21 Jul 2005 20:32:29 -0000
@@ -77,7 +77,7 @@
 	    upvar $v $v
 	}
 	set flag [::tcl::OptProcArgGiven -noStatics];
-	if {$flag && ($noStatics == $statics) 
+	if {$flag && (!!$noStatics == !!$statics) 
 	          && ([::tcl::OptProcArgGiven -statics])} {
 	    return -code error\
 		    "conflicting values given for -statics and -noStatics"
@@ -98,7 +98,7 @@
 	set flag [::tcl::OptProcArgGiven -nestedLoadOk];
 	# note that the test here is the opposite of the "InterpStatics"
 	# one (it is not -noNested... because of the wanted default value)
-	if {$flag && ($nestedLoadOk != $nested) 
+	if {$flag && (!!$nestedLoadOk != !!$nested) 
 	          && ([::tcl::OptProcArgGiven -nested])} {
 	    return -code error\
 		    "conflicting values given for -nested and -nestedLoadOk"
@@ -324,7 +324,7 @@
 	    nestedok deletehook} {
 
 	# determine and store the access path if empty
-	if {[string equal "" $access_path]} {
+	if {$access_path eq ""} {
 	    set access_path [uplevel \#0 set auto_path]
 	    # Make sure that tcl_library is in auto_path
 	    # and at the first position (needed by setAccessPath)
@@ -640,15 +640,15 @@
     }
     # set/get values
     proc Set {args} {
-	eval [list Toplevel set] $args
+	eval [linsert $args 0 Toplevel set]
     }
     # lappend on toplevel vars
     proc Lappend {args} {
-	eval [list Toplevel lappend] $args
+	eval [linsert $args 0 Toplevel lappend]
     }
     # unset a var/token (currently just an global level eval)
     proc Unset {args} {
-	eval [list Toplevel unset] $args
+	eval [linsert $args 0 Toplevel unset]
     }
     # test existance 
     proc Exists {varname} {
@@ -778,7 +778,7 @@
 	# Determine where to load. load use a relative interp path
 	# and {} means self, so we can directly and safely use passed arg.
 	set target [lindex $args 1]
-	if {[string length $target]} {
+	if {$target ne ""} {
 	    # we will try to load into a sub sub interp
 	    # check that we want to authorize that.
 	    if {![NestedOk $slave]} {
@@ -790,9 +790,9 @@
 	}
 
 	# Determine what kind of load is requested
-	if {[string length $file] == 0} {
+	if {$file eq ""} {
 	    # static package loading
-	    if {[string length $package] == 0} {
+	    if {$package eq ""} {
 		set msg "load error: empty filename and no package name"
 		Log $slave $msg
 		return -code error $msg
@@ -860,7 +860,7 @@
     proc Subset {slave command okpat args} {
 	set subcommand [lindex $args 0]
 	if {[regexp $okpat $subcommand]} {
-	    return [eval [list $command $subcommand] [lrange $args 1 end]]
+	    return [eval [linsert $args 0 $command]]
 	}
 	set msg "not allowed to invoke subcommand $subcommand of $command"
 	Log $slave $msg
@@ -895,11 +895,11 @@
 	set subcommand [lindex $args 0]
 
 	if {[regexp $okpat $subcommand]} {
-	    return [eval ::interp invokehidden $slave encoding $subcommand \
-		    [lrange $args 1 end]]
+	    return [eval [linsert $args 0 \
+		    ::interp invokehidden $slave encoding]]
 	}
 
-	if {[string match $subcommand system]} {
+	if {[string first $subcommand system] == 0} {
 	    if {$argc == 1} {
 		# passed all the tests , lets source it:
 		if {[catch {::interp invokehidden \
Index: library/word.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/library/word.tcl,v
retrieving revision 1.7
diff -u -r1.7 word.tcl
--- library/word.tcl	1 Nov 2002 00:28:51 -0000	1.7
+++ library/word.tcl	21 Jul 2005 20:32:29 -0000
@@ -15,7 +15,7 @@
 # The following variables are used to determine which characters are
 # interpreted as white space.  
 
-if {[string equal $::tcl_platform(platform) "windows"]} {
+if {$::tcl_platform(platform) eq "windows"} {
     # Windows style - any but a unicode space char
     set tcl_wordchars "\\S"
     set tcl_nonwordchars "\\s"
@@ -58,7 +58,7 @@
 
 proc tcl_wordBreakBefore {str start} {
     global tcl_nonwordchars tcl_wordchars
-    if {[string equal $start end]} {
+    if {$start eq "end"} {
 	set start [string length $str]
     }
     if {[regexp -indices "^.*($tcl_wordchars$tcl_nonwordchars|$tcl_nonwordchars$tcl_wordchars)" [string range $str 0 $start] result]} {
@@ -120,7 +120,7 @@
 
 proc tcl_startOfPreviousWord {str start} {
     global tcl_nonwordchars tcl_wordchars
-    if {[string equal $start end]} {
+    if {$start eq "end"} {
 	set start [string length $str]
     }
     if {[regexp -indices \