Check-in [d5ed5900eb]
Overview
Comment:Updated to only mount VFS once

Updated to always load "vfs"

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:d5ed5900ebd5d9ab7c04a318316b809cf4fd254a
User & Date: rkeene on 2011-05-28 23:53:40
Other Links: manifest | tags
Context
2011-06-03
05:37
Merged in pluggable branch check-in: 78b96b6e9c user: rkeene tags: trunk
2011-05-28
23:59
Merged trunk changes into branch check-in: ddf9f18c93 user: rkeene tags: pluggable
23:53
Updated to only mount VFS once

Updated to always load "vfs" check-in: d5ed5900eb user: rkeene tags: trunk

06:38
Updated to support finding TCLSH_NATIVE by the root kitcreator script and using that in most places where a native Tcl interpreter is needed

Updated to find date of Fossil checkin when a fossil tag or ID is specified and use that date for checkouts of other projects check-in: 0527703474 user: rkeene tags: trunk

Changes

Modified kitsh/buildsrc/kitsh-0.0/boot.tcl from [19424b6588] to [fcd5a93523].

    10     10   	set mountpoint [file dirname [file normalize [file join $mountpoint __dummy__]]]
    11     11   
    12     12   	set tcl_library [file join $mountpoint lib tcl$tcl_version]
    13     13   	set tcl_libPath [list $tcl_library [file join $mountpoint lib]]
    14     14   
    15     15   	# the following code only gets executed once on startup
    16     16   	if {[info exists ::TCLKIT_INITVFS]} {
    17         -		catch {
    18         -			load {} vfs
    19         -		}
    20         -
    21     17   		# lookup and emulate "source" of lib/vfs/{vfs*.tcl,mk4vfs.tcl}
    22     18   		switch -- $::tclKitStorage {
    23     19   			"mk4" {
    24     20   				# must use raw MetaKit calls because VFS is not yet in place
    25     21   				set d [mk::select exe.dirs parent 0 name lib]
    26     22   				set d [mk::select exe.dirs parent $d name vfs]
    27     23       
................................................................................
   133    129   		# Resolve symlinks
   134    130   		set mountpoint [file dirname [file normalize [file join $mountpoint __dummy__]]]
   135    131   
   136    132   		set tcl_library [file join $mountpoint lib tcl$tcl_version]
   137    133   		set tcl_libPath [list $tcl_library [file join $mountpoint lib]]
   138    134   
   139    135   		vfs::filesystem mount $mountpoint $vfsHandler
          136  +
          137  +		# This loads everything needed for "clock scan" to work
          138  +		# "clock scan" is used within "vfs::zip", which may be
          139  +		# loaded before this is run causing the root VFS to break
          140  +		catch { clock scan }
   140    141   	}
   141    142     
   142    143   	# load config settings file if present
   143    144   	namespace eval ::vfs { variable tclkit_version 1 }
   144    145   	catch { uplevel #0 [list source [file join $mountpoint config.tcl]] }
   145    146   
   146    147   	# Perform expected initialization
   147    148   	uplevel #0 [list source [file join $tcl_library init.tcl]]
   148    149     
   149    150   	# reset auto_path, so that init.tcl's search outside of tclkit is cancelled
   150    151   	set auto_path $tcl_libPath
   151    152   
   152         -	# This loads everything needed for "clock scan" to work
   153         -	# "clock scan" is used within "vfs::zip", which may be
   154         -	# loaded before this is run causing the root VFS to break
   155         -	catch { clock scan }
   156         -
   157    153   	if {$::TCLKIT_TYPE == "kitdll"} {
   158    154   		# Set a maximum seek to avoid reading the entire file looking for a
   159    155   		# zip header
   160    156   		catch { 
   161    157   			package require vfs::zip
   162    158   			set ::zip::max_header_seek 8192
   163    159   		}
................................................................................
   164    160   
   165    161   		# Now that the initialization is complete, mount the user VFS if needed
   166    162   		## Mount the VFS from the Shared Object
   167    163   		if {[info exists ::TCLKIT_INITVFS] && [info exists ::tclKitFilename]} {
   168    164   			catch {
   169    165   				vfs::zip::Mount $::tclKitFilename "/.KITDLL_USER"
   170    166   
   171         -				lappend auto_path [file normalize "/.KITDLL_USER/lib"]
          167  +				lappend auto_path "/.KITDLL_USER/lib"
   172    168   			}
   173    169   		}
   174    170   
   175    171   		## Mount the VFS from executable
   176    172   		if {[info exists ::TCLKIT_INITVFS]} {
   177    173   			catch {
   178    174   				vfs::zip::Mount [info nameofexecutable] "/.KITDLL_APP"
   179    175   
   180         -				lappend auto_path [file normalize "/.KITDLL_APP/lib"]
          176  +				lappend auto_path "/.KITDLL_APP/lib"
   181    177   			}
   182    178   		}
   183         -
   184    179   	}
   185    180   
   186    181   	# Clean up
   187    182   	unset -nocomplain ::zip::max_header_seek
   188    183   	unset -nocomplain ::TCLKIT_TYPE ::TCLKIT_INITVFS
   189    184   	unset -nocomplain ::TCLKIT_MOUNTPOINT ::TCLKIT_VFSSOURCE ::TCLKIT_MOUNTPOINT_VAR ::TCLKIT_VFSSOURCE_VAR
   190    185   	unset -nocomplain ::tclKitStorage ::tclKitStorage_fd ::tclKitFilename
   191    186   	unset -nocomplain ::tclkit_system_encoding
   192    187   }

Modified kitsh/buildsrc/kitsh-0.0/kitInit.c from [901380bcbe] to [50169ff8c3].

   133    133   	"info script $old\n"
   134    134   	"if {$code == 2} { set code 0 }\n"
   135    135   	"return -code $code $res\n"
   136    136   "}\n"
   137    137   #endif /* _WIN32_WCE && !TCLKIT_DLL */
   138    138   "proc tclKitInit {} {\n"
   139    139   	"rename tclKitInit {}\n"
          140  +	"catch { load {} vfs }\n"
   140    141   #ifdef KIT_INCLUDES_ZLIB
   141    142   	"catch { load {} zlib }\n"
   142    143   #endif
   143    144   #ifdef KIT_INCLUDES_MK4TCL
   144    145   	"catch { load {} Mk4tcl }\n"
   145    146   #endif
   146    147   #ifdef TCLKIT_DLL
................................................................................
   151    152   	"set bootfile [file join " TCLKIT_MOUNTPOINT " boot.tcl]\n"
   152    153   	"if {[file exists $bootfile]} {\n"
   153    154   		"catch {\n"
   154    155   			"set f [open $bootfile]\n"
   155    156   			"set s [read $f]\n"
   156    157   			"close $f\n"
   157    158   		"}\n"
          159  +	"} else {\n"
          160  +		"set ::TCLKIT_INITVFS 1\n"
   158    161   	"}\n"
   159    162   #ifdef KIT_STORAGE_MK4
   160    163   	"set ::tclKitStorage \"mk4\"\n"
   161    164   	"if {![info exists s]} {\n"
   162    165   		"mk::file open exe " TCLKIT_VFSSOURCE " -readonly\n"
   163    166   		"set n [mk::select exe.dirs!0.files name boot.tcl]\n"
   164    167   		"if {$n != \"\"} {\n"
................................................................................
   169    172   				"set s [zlib decompress $s]\n"
   170    173   			"}\n"
   171    174   		"}\n"
   172    175   	"}\n"
   173    176   #endif /* KIT_STORAGE_MK4 */
   174    177   #ifdef KIT_STORAGE_ZIP
   175    178   	"set ::tclKitStorage \"zip\"\n"
   176         -	"catch { load {} vfs }\n"
   177    179   	"if {![info exists s]} {\n"
   178    180   #  include "zipvfs.tcl.h"
   179    181   		"catch {\n"
   180    182   			"set ::tclKitStorage_fd [::zip::open " TCLKIT_VFSSOURCE "]\n"
   181    183   			"::zip::stat $::tclKitStorage_fd boot.tcl sb\n"
   182    184   			"seek $::tclKitStorage_fd $sb(ino)\n"
   183    185   			"::zip::Data $::tclKitStorage_fd sb s\n"
   184    186   		"}\n"
   185    187   	"}\n"
   186    188   #endif /* KIT_STORAGE_ZIP */
   187    189   #ifdef KIT_STORAGE_CVFS
   188    190   	"set ::tclKitStorage \"cvfs\"\n"
   189    191   	"load {} rechan\n"
   190         -	"load {} vfs\n"
   191    192   	"load {} cvfs_data_tcl\n"
   192    193   #include "cvfs.tcl.h"
   193    194   	"if {![info exists s]} {\n"
   194    195   		"catch {\n"
   195    196   			"set s [::vfs::cvfs::data::getData tcl boot.tcl]\n"
   196    197   		"}\n"
   197    198   	"}\n"
................................................................................
   382    383   	/* the tcl_rcFileName variable only exists in the initial interpreter */
   383    384   #  ifdef _WIN32
   384    385   	Tcl_SetVar(interp, "tcl_rcFileName", "~/tclkitrc.tcl", TCL_GLOBAL_ONLY);
   385    386   #  else
   386    387   	Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclkitrc", TCL_GLOBAL_ONLY);
   387    388   #  endif /* _WIN32 */
   388    389   #endif /* !TCLKIT_DLL */
   389         -	Tcl_SetVar(interp, "TCLKIT_INITVFS", "1", TCL_GLOBAL_ONLY);
   390    390   
   391    391   #ifdef TCLKIT_CAN_SET_ENCODING
   392    392   	/* Set the encoding from the Environment */
   393    393   	Tcl_GetEncodingNameFromEnvironment(&encodingName);
   394    394   	Tcl_SetSystemEncoding(NULL, Tcl_DStringValue(&encodingName));
   395    395   	Tcl_SetVar(interp, "tclkit_system_encoding", Tcl_DStringValue(&encodingName), 0);
   396    396   	Tcl_DStringFree(&encodingName);