Differences From Artifact [a3240f621e]:
- File
kitsh/buildsrc/kitsh-0.0/boot.tcl
— part of check-in
[096098536d]
at
2010-09-26 04:42:20
on branch trunk
— Updated to implement "vfs::mkcl" using Readkit
Updated local Readkit implementation to not attempt to replace Mk4tcl (user: rkeene, size: 2884) [annotate] [blame] [check-ins using] 
To Artifact [fad62aecf7]:
- File
kitsh/buildsrc/kitsh-0.0/boot.tcl
— part of check-in
[66535d6924]
at
2010-09-26 04:43:48
on branch trunk
— KitCreator 0.3.0.x
Added support for using ZIP archives if MK4 fails to build Removed support for pure-Tcl MK4 (it didn't work) (user: rkeene, size: 3740) [annotate] [blame] [check-ins using] 
| 1 | 
proc tclInit {} {
 | | | | | | | | | | | | | > > > | < | | | | | | | | | | > | > > > | > > > | > > > | > > > > > > > > | > | > | > > > > > > > > | > > > | | | | | | | | | | | | | | | | | | | | < | | | | | | > | | | | | | | | > > > > > > | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | 
proc tclInit {} {
	rename tclInit {}
	global auto_path tcl_library tcl_libPath
	global tcl_version tcl_rcFileName
  
	set noe [info nameofexecutable]
	# Resolve symlinks
	set noe [file dirname [file normalize [file join $noe __dummy__]]]
	set tcl_library [file join $noe lib tcl$tcl_version]
	set tcl_libPath [list $tcl_library [file join $noe lib]]
	# get rid of a build residue
	unset -nocomplain ::tclDefaultLibrary
	# the following code only gets executed once on startup
	if {[info exists tcl_rcFileName]} {
		# lookup and emulate "source" of lib/vfs/{vfs*.tcl,mk4vfs.tcl}
		switch -- $::tclKitStorage {
			"mk4" {
				load {} vfs
				# 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]
    
				foreach x {vfsUtils vfslib mk4vfs} {
					set n [mk::select exe.dirs!$d.files name $x.tcl]
					set s [mk::get exe.dirs!$d.files!$n contents]
					catch {set s [zlib decompress $s]}
					uplevel #0 $s
				}
				# use on-the-fly decompression, if mk4vfs understands that
				set mk4vfs::zstreamed 1
				# Set VFS handler name
				set vfsHandler [list ::vfs::mk4::handler exe]
			}
			"zip" {
				set prefix "lib/vfs"
				foreach file [list vfsUtils vfslib] {
					set fullfile "${prefix}/${file}.tcl"
					::zip::stat $::tclKitStorage_fd $fullfile finfo
					seek $::tclKitStorage_fd $finfo(ino)
					zip::Data $::tclKitStorage_fd sb s
					switch -- $file {
						"vfsUtils" {
							# Preserve our working "::vfs::zip" implementation
							# so we can replace it after the stub is replaced
							# from vfsUtils
							# The correct implementation will be provided by vfslib, 
							# but only if we can read it
							rename ::vfs::zip ::vfs::zip_impl
						}
					}
					uplevel #0 $s
					switch -- $file {
						"vfsUtils" {
							# Restore preserved "::vfs:zip" implementation
							rename ::vfs::zip {}
							rename ::vfs::zip_impl ::vfs::zip
						}
					}
				}
				seek $::tclKitStorage_fd 0
				set vfsHandler [list ::vfs::zip::handler $::tclKitStorage_fd]
				unset ::tclKitStorage_fd
			}
		}
		# mount the executable, i.e. make all runtime files available
		vfs::filesystem mount $noe $vfsHandler
		# alter path to find encodings
		if {[info tclversion] eq "8.4"} {
			load {} pwb
			librarypath [info library]
		} else {
			encoding dirs [list [file join [info library] encoding]] ;# TIP 258
		}
		# fix system encoding, if it wasn't properly set up (200207.004 bug)
		if {[encoding system] eq "identity"} {
			switch $::tcl_platform(platform) {
				windows		{ encoding system cp1252 }
				macintosh	{ encoding system macRoman }
			        default		{ encoding system iso8859-1 }
			}
		}
		# now remount the executable with the correct encoding
		vfs::filesystem unmount [lindex [::vfs::filesystem info] 0]
		set noe [info nameofexecutable]
		# Resolve symlinks
		set noe [file dirname [file normalize [file join $noe __dummy__]]]
		set tcl_library [file join $noe lib tcl$tcl_version]
		set tcl_libPath [list $tcl_library [file join $noe lib]]
		vfs::filesystem mount $noe $vfsHandler
	}
  
	# load config settings file if present
	namespace eval ::vfs { variable tclkit_version 1 }
	catch { uplevel #0 [list source [file join $noe config.tcl]] }
	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 }
	# Cleanup
	unset ::tclKitStorage
	unset -nocomplain ::tclKitStorage_fd
}
 |