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
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
10
11
12
13
14
15
16




17
18
19
20
21
22
23







-
-
-
-







	set mountpoint [file dirname [file normalize [file join $mountpoint __dummy__]]]

	set tcl_library [file join $mountpoint lib tcl$tcl_version]
	set tcl_libPath [list $tcl_library [file join $mountpoint lib]]

	# the following code only gets executed once on startup
	if {[info exists ::TCLKIT_INITVFS]} {
		catch {
			load {} vfs
		}

		# lookup and emulate "source" of lib/vfs/{vfs*.tcl,mk4vfs.tcl}
		switch -- $::tclKitStorage {
			"mk4" {
				# must use raw MetaKit calls because VFS is not yet in place
				set d [mk::select exe.dirs parent 0 name lib]
				set d [mk::select exe.dirs parent $d name vfs]
    
133
134
135
136
137
138
139





140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171

172
173
174
175
176
177
178
179
180

181
182
183
184
185
186
187
188
189
190
191
192
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152





153
154
155
156
157
158
159
160
161
162
163
164
165
166

167
168
169
170
171
172
173
174
175

176
177
178

179
180
181
182
183
184
185
186
187







+
+
+
+
+












-
-
-
-
-














-
+








-
+


-









		# Resolve symlinks
		set mountpoint [file dirname [file normalize [file join $mountpoint __dummy__]]]

		set tcl_library [file join $mountpoint lib tcl$tcl_version]
		set tcl_libPath [list $tcl_library [file join $mountpoint lib]]

		vfs::filesystem mount $mountpoint $vfsHandler

		# This loads everything needed for "clock scan" to work
		# "clock scan" is used within "vfs::zip", which may be
		# loaded before this is run causing the root VFS to break
		catch { clock scan }
	}
  
	# load config settings file if present
	namespace eval ::vfs { variable tclkit_version 1 }
	catch { uplevel #0 [list source [file join $mountpoint config.tcl]] }

	# Perform expected initialization
	uplevel #0 [list source [file join $tcl_library init.tcl]]
  
	# reset auto_path, so that init.tcl's search outside of tclkit is cancelled
	set auto_path $tcl_libPath

	# This loads everything needed for "clock scan" to work
	# "clock scan" is used within "vfs::zip", which may be
	# loaded before this is run causing the root VFS to break
	catch { clock scan }

	if {$::TCLKIT_TYPE == "kitdll"} {
		# Set a maximum seek to avoid reading the entire file looking for a
		# zip header
		catch { 
			package require vfs::zip
			set ::zip::max_header_seek 8192
		}

		# Now that the initialization is complete, mount the user VFS if needed
		## Mount the VFS from the Shared Object
		if {[info exists ::TCLKIT_INITVFS] && [info exists ::tclKitFilename]} {
			catch {
				vfs::zip::Mount $::tclKitFilename "/.KITDLL_USER"

				lappend auto_path [file normalize "/.KITDLL_USER/lib"]
				lappend auto_path "/.KITDLL_USER/lib"
			}
		}

		## Mount the VFS from executable
		if {[info exists ::TCLKIT_INITVFS]} {
			catch {
				vfs::zip::Mount [info nameofexecutable] "/.KITDLL_APP"

				lappend auto_path [file normalize "/.KITDLL_APP/lib"]
				lappend auto_path "/.KITDLL_APP/lib"
			}
		}

	}

	# Clean up
	unset -nocomplain ::zip::max_header_seek
	unset -nocomplain ::TCLKIT_TYPE ::TCLKIT_INITVFS
	unset -nocomplain ::TCLKIT_MOUNTPOINT ::TCLKIT_VFSSOURCE ::TCLKIT_MOUNTPOINT_VAR ::TCLKIT_VFSSOURCE_VAR
	unset -nocomplain ::tclKitStorage ::tclKitStorage_fd ::tclKitFilename
	unset -nocomplain ::tclkit_system_encoding
}

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

133
134
135
136
137
138
139

140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157


158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178

179
180
181
182
183
184
185
186
187
188
189
190
191

192
193
194
195
196
197
198







+


















+
+


















-













-







	"info script $old\n"
	"if {$code == 2} { set code 0 }\n"
	"return -code $code $res\n"
"}\n"
#endif /* _WIN32_WCE && !TCLKIT_DLL */
"proc tclKitInit {} {\n"
	"rename tclKitInit {}\n"
	"catch { load {} vfs }\n"
#ifdef KIT_INCLUDES_ZLIB
	"catch { load {} zlib }\n"
#endif
#ifdef KIT_INCLUDES_MK4TCL
	"catch { load {} Mk4tcl }\n"
#endif
#ifdef TCLKIT_DLL
	"load {} tclkit::init\n"
	"::tclkit::init::initInterp\n"
	"rename ::tclkit::init::initInterp {}\n"
#endif /* TCLKIT_DLL */
	"set bootfile [file join " TCLKIT_MOUNTPOINT " boot.tcl]\n"
	"if {[file exists $bootfile]} {\n"
		"catch {\n"
			"set f [open $bootfile]\n"
			"set s [read $f]\n"
			"close $f\n"
		"}\n"
	"} else {\n"
		"set ::TCLKIT_INITVFS 1\n"
	"}\n"
#ifdef KIT_STORAGE_MK4
	"set ::tclKitStorage \"mk4\"\n"
	"if {![info exists s]} {\n"
		"mk::file open exe " TCLKIT_VFSSOURCE " -readonly\n"
		"set n [mk::select exe.dirs!0.files name boot.tcl]\n"
		"if {$n != \"\"} {\n"
			"set s [mk::get exe.dirs!0.files!$n contents]\n"
			"if {![string length $s]} { error \"empty boot.tcl\" }\n"
			"catch {load {} zlib}\n"
			"if {[mk::get exe.dirs!0.files!$n size] != [string length $s]} {\n"
				"set s [zlib decompress $s]\n"
			"}\n"
		"}\n"
	"}\n"
#endif /* KIT_STORAGE_MK4 */
#ifdef KIT_STORAGE_ZIP
	"set ::tclKitStorage \"zip\"\n"
	"catch { load {} vfs }\n"
	"if {![info exists s]} {\n"
#  include "zipvfs.tcl.h"
		"catch {\n"
			"set ::tclKitStorage_fd [::zip::open " TCLKIT_VFSSOURCE "]\n"
			"::zip::stat $::tclKitStorage_fd boot.tcl sb\n"
			"seek $::tclKitStorage_fd $sb(ino)\n"
			"::zip::Data $::tclKitStorage_fd sb s\n"
		"}\n"
	"}\n"
#endif /* KIT_STORAGE_ZIP */
#ifdef KIT_STORAGE_CVFS
	"set ::tclKitStorage \"cvfs\"\n"
	"load {} rechan\n"
	"load {} vfs\n"
	"load {} cvfs_data_tcl\n"
#include "cvfs.tcl.h"
	"if {![info exists s]} {\n"
		"catch {\n"
			"set s [::vfs::cvfs::data::getData tcl boot.tcl]\n"
		"}\n"
	"}\n"
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
383
384
385
386
387
388
389

390
391
392
393
394
395
396







-







	/* the tcl_rcFileName variable only exists in the initial interpreter */
#  ifdef _WIN32
	Tcl_SetVar(interp, "tcl_rcFileName", "~/tclkitrc.tcl", TCL_GLOBAL_ONLY);
#  else
	Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclkitrc", TCL_GLOBAL_ONLY);
#  endif /* _WIN32 */
#endif /* !TCLKIT_DLL */
	Tcl_SetVar(interp, "TCLKIT_INITVFS", "1", TCL_GLOBAL_ONLY);

#ifdef TCLKIT_CAN_SET_ENCODING
	/* Set the encoding from the Environment */
	Tcl_GetEncodingNameFromEnvironment(&encodingName);
	Tcl_SetSystemEncoding(NULL, Tcl_DStringValue(&encodingName));
	Tcl_SetVar(interp, "tclkit_system_encoding", Tcl_DStringValue(&encodingName), 0);
	Tcl_DStringFree(&encodingName);