# Relevant details:
# Subject file, rc.tcl, enhances AlphaTk environment on Windows
# with user-developed utility scripts, in namespace ::rc.
# Manual "source rc.tcl"  has been working as expected.
# 
# A log of the same script, run "before" and "after", is shown below.
# 
#--------------------------------------------------------------------
# "before" script, in which package.tcl is unchanged.

(User Packages) 2 % info patchlevel
8.4.10
(User Packages) 3 % pwd
C:/Documents and Settings/Peter Martin/Alpha-v8/User Packages
(User Packages) 4 % join [glob -types f *] \n
rc.tcl
(User Packages) 5 % set s [read [set fs [open rc.tcl r]]]; close $fs
(User Packages) 6 % regexp -inline -all -line {^.*package provide.*$} $s
{package provide rc 0.2}
(User Packages) 7 % pkg_mkIndex -verbose .
warning: error while sourcing rc.tcl: can't read "dir": no such variable
(User Packages) 8 % join [glob -types f *] \n
pkgIndex.tcl
rc.tcl
(User Packages) 9 % set s [read [set fs [open pkgIndex.tcl r]]]; close $fs; set s
# Tcl package index file, version 1.1
# This file is generated by the "pkg_mkIndex" command
# and sourced either when an application starts up or
# by a "package unknown" script.  It invokes the
# "package ifneeded" command to set up package-related
# information so that packages will be loaded automatically
# in response to "package require" commands.  When this
# script is sourced, the variable $dir must contain the
# full path name of this file's directory.


(User Packages) 10 % 

#--------------------------------------------------------------------
# "after" script, in which package.tcl was modified to add a definition
# of "dir" in the slave interpreter, $c:

(User Packages) 2 % info patchlevel
8.4.10
(User Packages) 3 % pwd
C:/Documents and Settings/Peter Martin/Alpha-v8/User Packages
(User Packages) 4 % join [glob -types f *] \n
rc.tcl
(User Packages) 5 % set s [read [set fs [open rc.tcl r]]]; close $fs
(User Packages) 6 % regexp -inline -all -line {^.*package provide.*$} $s
{package provide rc 0.2}
(User Packages) 7 % pkg_mkIndex -verbose .
successful sourcing of rc.tcl
packages provided were {rc 0.2}
processed rc.tcl
(User Packages) 8 % join [glob -types f *] \n
pkgIndex.tcl
rc.tcl
(User Packages) 9 % set s [read [set fs [open pkgIndex.tcl r]]]; close $fs; set s
# Tcl package index file, version 1.1
# This file is generated by the "pkg_mkIndex" command
# and sourced either when an application starts up or
# by a "package unknown" script.  It invokes the
# "package ifneeded" command to set up package-related
# information so that packages will be loaded automatically
# in response to "package require" commands.  When this
# script is sourced, the variable $dir must contain the
# full path name of this file's directory.

package ifneeded rc 0.2 [list source [file join $dir rc.tcl]]

(User Packages) 10 % 
