Comment: | 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) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | 0.3.0 |
Files: | files | file ages | folders |
SHA1: |
66535d6924ff2a81d02360d114ba6710 |
User & Date: | rkeene on 2010-09-26 04:43:48 |
Other Links: | manifest | tags |
2010-09-26
| ||
04:43 | Updated to return in failure if we fail to properly install check-in: bdcfd6df7f user: rkeene tags: trunk | |
04:43 |
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) check-in: 66535d6924 user: rkeene tags: trunk, 0.3.0 | |
04:43 | Added support for building under Win64 (MingW64) check-in: 53cdd8c9a6 user: rkeene tags: trunk | |
Modified build/makearch.info from [038ce76a42] to [d2944198db].
︙ | ︙ | |||
12 13 14 15 16 17 18 | # If set to "auto" it will be maintained in a file called .version # in the source directory and the revision will be incremented # each time a "makearch" is done. # # If @@SVNLCR@@ is used anywhere in this version number, it will be # replaced with the highest last-changed-rev from the output of # svn info -R (or 0) | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # If set to "auto" it will be maintained in a file called .version # in the source directory and the revision will be incremented # each time a "makearch" is done. # # If @@SVNLCR@@ is used anywhere in this version number, it will be # replaced with the highest last-changed-rev from the output of # svn info -R (or 0) VERS="0.3.0.@@SVNLCR@@" # Space sperated list of documents, if they exist, they will be # prefixed with the contents of the DOC_HDR file and substitution # will occur: # @@UTIL@@ becomes the utility name ${UTIL} # @@VERS@@ becomes the utility version # @@DATE@@ becomes the current date |
︙ | ︙ |
Modified build/pre.sh from [24cc7de513] to [52ef0ed788].
︙ | ︙ | |||
9 10 11 12 13 14 15 | cd "${KITSHROOTDIR}" || exit 1 autoconf; autoheader rm -rf autom4te.cache rm -f *~ ./configure || exit 1 | | > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | cd "${KITSHROOTDIR}" || exit 1 autoconf; autoheader rm -rf autom4te.cache rm -f *~ ./configure || exit 1 make boot.tcl.h make zipvfs.tcl.h make distclean ) || exit 1 find . -name '.*.sw?' -type f | xargs rm -f |
Modified kitsh/buildsrc/kitsh-0.0/Makefile.in from [4fbebeccc2] to [c486d97051].
︙ | ︙ | |||
11 12 13 14 15 16 17 | kit.res.o: kit.rc kit.ico $(RC) -o kit.res.o $(CPPFLAGS) kit.rc kit: $(OBJS) $(ARCHS) $(CC) $(CPPFLAGS) $(CFLAGS) -o kit $(OBJS) $(ARCHS) $(LDFLAGS) $(LIBS) | | | > > > | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | kit.res.o: kit.rc kit.ico $(RC) -o kit.res.o $(CPPFLAGS) kit.rc kit: $(OBJS) $(ARCHS) $(CC) $(CPPFLAGS) $(CFLAGS) -o kit $(OBJS) $(ARCHS) $(LDFLAGS) $(LIBS) boot.tcl.h: boot.tcl ./stringify.tcl boot.tcl > boot.tcl.h zipvfs.tcl.h: zipvfs.tcl ./stringify.tcl zipvfs.tcl > zipvfs.tcl.h clean: rm -f kit $(OBJS) distclean: clean rm -f config.h Makefile config.log config.status rm -rf autom4te.cache mrproper: distclean rm -f configure config.h boot.tcl.h zipvfs.tcl.h .PHONY: all clean distclean |
Modified kitsh/buildsrc/kitsh-0.0/boot.tcl from [a3240f621e] to [fad62aecf7].
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 } |
Modified kitsh/buildsrc/kitsh-0.0/installvfs.tcl from [848dac55a9] to [3a059dfee8].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #! /usr/bin/env tclsh set opt_compression 1 if {[llength $argv] < 2} { puts stderr "Usage: installvfs.tcl <kitfile> <vfsdir> \[<enable_compression>\]" exit 1 } set kitfile [lindex $argv 0] set vfsdir [lindex $argv 1] if {[lindex $argv 2] != ""} { set opt_compression [lindex $argv 2] } | > < | < | > | | > | | | | | < | | 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 | #! /usr/bin/env tclsh # Parse arguments set opt_compression 1 if {[llength $argv] < 2} { puts stderr "Usage: installvfs.tcl <kitfile> <vfsdir> \[<enable_compression>\]" exit 1 } set kitfile [lindex $argv 0] set vfsdir [lindex $argv 1] if {[lindex $argv 2] != ""} { set opt_compression [lindex $argv 2] } # Determine what storage mechanism is being used ## This logic must be duplicated from "kitInit.c" set fd [open Makefile r] set data [read $fd] close $fd if {[string match "*KIT_INCLUDES_MK4TCL*" $data]} { set tclKitStorage mk4 } else { set tclKitStorage zip } # Define procedures proc copy_file {srcfile destfile} { switch -glob -- $srcfile { "*.tcl" - "*.txt" { set ifd [open $srcfile r] set ofd [open $destfile w] set ret [fcopy $ifd $ofd] |
︙ | ︙ | |||
61 62 63 64 65 66 67 | copy_file $file $destfile } err]} { puts stderr "Failed to copy: $file: $err" } } } | > > > > > > > > > > > > > > > > > > > | | | > > > > > > > > > > > > > > > > > > > > > | 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 | copy_file $file $destfile } err]} { puts stderr "Failed to copy: $file: $err" } } } # Update the kit, based on what kind of kit this is switch -- $tclKitStorage { "mk4" { if {[catch { # Try as if a pre-existing Tclkit, or a tclsh package require vfs::mk4 }]} { # Try as if uninitialized Tclkit catch { load "" vfs load "" Mk4tcl source [file join $vfsdir lib/vfs/vfsUtils.tcl] source [file join $vfsdir lib/vfs/vfslib.tcl] source [file join $vfsdir lib/vfs/mk4vfs.tcl] } } set mk4vfs::compress $opt_compression set handle [vfs::mk4::Mount $kitfile /kit -nocommit] recursive_copy $vfsdir /kit vfs::unmount /kit } "zip" { set kitfd [open $kitfile a+] fconfigure $kitfd -translation binary cd $vfsdir set zipfd [open "|zip -r - [glob *] 2> /dev/null"] fconfigure $zipfd -translation binary fcopy $zipfd $kitfd close $kitfd if {[catch { close $zipfd } err]} { puts stderr "Error while updating executable: $err" exit 1 } } } |
Modified kitsh/buildsrc/kitsh-0.0/kitInit.c from [f0bdde86c9] to [1ea5ee25a0].
︙ | ︙ | |||
12 13 14 15 16 17 18 | * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id$ */ #ifdef KIT_INCLUDES_TK | | | | | | | | | | > > > > > > > > > > > > | | | | | | | | | | | | | > | < < < < < | | | | | | | | | | > > > > > > > > > > > > | | | | | | | | > | < | | | | | | < < | | | | | | | | < | < | | | | | | | | | | | | | | | | | | | | | > | | | > | | > | | | | | | | < | | | < | | | | > | | > | | | | | | > | | | | > | | 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 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 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id$ */ #ifdef KIT_INCLUDES_TK # include <tk.h> #else # include <tcl.h> #endif /* KIT_INCLUDES_TK */ #ifdef _WIN32 # define WIN32_LEAN_AND_MEAN # include <windows.h> # undef WIN32_LEAN_AND_MEAN #endif /* _WIN32 */ #ifndef MB_TASKMODAL # define MB_TASKMODAL 0 #endif /* MB_TASKMODAL */ #include "tclInt.h" #ifdef KIT_INCLUDES_ITCL Tcl_AppInitProc Itcl_Init; #endif #ifdef KIT_INCLUDES_MK4TCL Tcl_AppInitProc Mk4tcl_Init; #endif Tcl_AppInitProc Vfs_Init, Rechan_Init, Zlib_Init; #if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 85 Tcl_AppInitProc Pwb_Init; #endif #ifdef TCL_THREADS Tcl_AppInitProc Thread_Init; #endif #ifdef _WIN32 Tcl_AppInitProc Dde_Init, Registry_Init; #endif /* Determine which type of storage to use -- MK4 or ZIP */ #if defined(KIT_STORAGE_MK4) && defined(KIT_STORAGE_ZIP) # undef KIT_STORAGE_ZIP #endif #if !defined(KIT_STORAGE_MK4) && !defined(KIT_STORAGE_ZIP) # ifdef KIT_INCLUDES_MK4TCL # define KIT_STORAGE_MK4 1 # else # define KIT_STORAGE_ZIP 1 # endif #endif static char *tclExecutableName; /* * Attempt to load a "boot.tcl" entry from the embedded MetaKit file. * If there isn't one, try to open a regular "setup.tcl" file instead. * If that fails, this code will throw an error, using a message box. */ static char *preInitCmd = #ifdef _WIN32_WCE /* silly hack to get wince port to launch, some sort of std{in,out,err} problem */ "open /kitout.txt a; open /kitout.txt a; open /kitout.txt a\n" /* this too seems to be needed on wince - it appears to be related to the above */ "catch {rename source ::tcl::source}\n" "proc source file {\n" "set old [info script]\n" "info script $file\n" "set fid [open $file]\n" "set data [read $fid]\n" "close $fid\n" "set code [catch {uplevel 1 $data} res]\n" "info script $old\n" "if {$code == 2} { set code 0 }\n" "return -code $code $res\n" "}\n" #endif /* _WIN32_WCE */ "proc tclKitInit {} {\n" "rename tclKitInit {}\n" #ifdef KIT_STORAGE_MK4 "set ::tclKitStorage \"mk4\"\n" "catch { load {} Mk4tcl }\n" "mk::file open exe [info nameofexecutable] -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" #endif /* KIT_STORAGE_MK4 */ #ifdef KIT_STORAGE_ZIP "set ::tclKitStorage \"zip\"\n" "catch { load {} vfs }\n" # include "zipvfs.tcl.h" "set ::tclKitStorage_fd [zip::open [info nameofexecutable]]\n" "if {![catch { ::zip::stat $::tclKitStorage_fd boot.tcl sb }]} {\n" "seek $::tclKitStorage_fd $sb(ino)\n" "zip::Data $::tclKitStorage_fd sb s\n" "}\n" #endif /* KIT_STORAGE_ZIP */ "if {![info exists s]} {\n" "set f [open setup.tcl]\n" "set s [read $f]\n" "close $f\n" "}\n" "uplevel #0 $s\n" #ifdef _WIN32 "catch {load {} dde}\n" "catch {load {} registry}\n" #endif /* _WIN32 */ "return 0\n" "}\n" "tclKitInit"; static const char initScript[] = "if {[file isfile [file join [info nameofexe] main.tcl]]} {\n" "if {[info commands console] != {}} { console hide }\n" "set tcl_interactive 0\n" "incr argc\n" "set argv [linsert $argv 0 $argv0]\n" "set argv0 [file join [info nameofexe] main.tcl]\n" "} else continue\n"; /* SetExecName -- Hack to get around Tcl bug 1224888. */ void SetExecName(Tcl_Interp *interp) { if (tclExecutableName == NULL) { int len = 0; Tcl_Obj *execNameObj; Tcl_Obj *lobjv[1]; lobjv[0] = Tcl_GetVar2Ex(interp, "argv0", NULL, TCL_GLOBAL_ONLY); execNameObj = Tcl_FSJoinToPath(Tcl_FSGetCwd(interp), 1, lobjv); tclExecutableName = strdup(Tcl_GetStringFromObj(execNameObj, &len)); } } int TclKit_AppInit(Tcl_Interp *interp) { #ifdef KIT_INCLUDES_ITCL Tcl_StaticPackage(0, "Itcl", Itcl_Init, NULL); #endif #ifdef KIT_INCLUDES_MK4TCL Tcl_StaticPackage(0, "Mk4tcl", Mk4tcl_Init, NULL); #endif #if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 85 Tcl_StaticPackage(0, "pwb", Pwb_Init, NULL); #endif Tcl_StaticPackage(0, "rechan", Rechan_Init, NULL); Tcl_StaticPackage(0, "vfs", Vfs_Init, NULL); Tcl_StaticPackage(0, "zlib", Zlib_Init, NULL); #ifdef TCL_THREADS Tcl_StaticPackage(0, "Thread", Thread_Init, NULL); #endif #ifdef _WIN32 Tcl_StaticPackage(0, "dde", Dde_Init, NULL); Tcl_StaticPackage(0, "registry", Registry_Init, NULL); #endif #ifdef KIT_INCLUDES_TK Tcl_StaticPackage(0, "Tk", Tk_Init, Tk_SafeInit); #endif /* 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 /* Hack to get around Tcl bug 1224888. This must be run here and * in LibraryPathObjCmd because this information is needed both * before and after that command is run. */ SetExecName(interp); TclSetPreInitScript(preInitCmd); if (Tcl_Init(interp) == TCL_ERROR) { goto error; } #ifdef KIT_INCLUDES_TK # ifdef _WIN32 if (Tk_Init(interp) == TCL_ERROR) { goto error; } if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) { goto error; } # endif /* _WIN32 */ #endif /* KIT_INCLUDES_TK */ /* messy because TclSetStartupScriptPath is called slightly too late */ if (Tcl_Eval(interp, initScript) == TCL_OK) { Tcl_Obj* path; #ifdef HAVE_TCLSETSTARTUPSCRIPTPATH path = TclGetStartupScriptPath(); TclSetStartupScriptPath(Tcl_GetObjResult(interp)); #elif defined(HAVE_TCL_SETSTARTUPSCRIPT) path = Tcl_GetStartupScript(NULL); Tcl_SetStartupScript(Tcl_GetObjResult(interp), NULL); #endif if (path == NULL) { Tcl_Eval(interp, "incr argc -1; set argv [lrange $argv 1 end]"); } } Tcl_SetVar(interp, "errorInfo", "", TCL_GLOBAL_ONLY); Tcl_ResetResult(interp); return TCL_OK; error: #ifdef KIT_INCLUDES_TK # ifdef _WIN32 MessageBeep(MB_ICONEXCLAMATION); # ifndef _WIN32_WCE MessageBox(NULL, Tcl_GetStringResult(interp), "Error in TclKit", MB_ICONSTOP | MB_OK | MB_TASKMODAL | MB_SETFOREGROUND); ExitProcess(1); # endif /* !_WIN32_WCE */ /* we won't reach this, but we need the return */ # endif /* _WIN32 */ #endif /* KIT_INCLUDES_TK */ return TCL_ERROR; } |
Deleted kitsh/buildsrc/kitsh-0.0/mk4tcl-new.tcl version [737d3e66d5].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted kitsh/buildsrc/kitsh-0.0/mk4tcl.tcl version [320b85c042].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Modified kitsh/buildsrc/kitsh-0.0/zipvfs.tcl from [4a9165155e] to [734aa55ae1].
1 2 | # Removed provision of the backward compatible name. Moved to separate # file/package. | < | 1 2 3 4 5 6 7 8 9 | # Removed provision of the backward compatible name. Moved to separate # file/package. package require vfs # Using the vfs, memchan and Trf extensions, we ought to be able # to write a Tcl-only zip virtual filesystem. What we have below # is basically that. |
︙ | ︙ | |||
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | 128 {normal} } proc u_short {n} { return [expr { ($n+0x10000)%0x10000 }] } } proc zip::DosTime {date time} { set time [u_short $time] set date [u_short $date] # time = fedcba9876543210 # HHHHHmmmmmmSSSSS (sec/2 actually) # data = fedcba9876543210 # yyyyyyyMMMMddddd set sec [expr { ($time & 0x1F) * 2 }] set min [expr { ($time >> 5) & 0x3F }] set hour [expr { ($time >> 11) & 0x1F }] set mday [expr { $date & 0x1F }] set mon [expr { (($date >> 5) & 0xF) }] set year [expr { (($date >> 9) & 0xFF) + 1980 }] # Fix up bad date/time data, no need to fail | > > > > | | | | > | | > | > | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | 128 {normal} } proc u_short {n} { return [expr { ($n+0x10000)%0x10000 }] } } proc zip::DosTime {date time} { # The pre-VFS environment will not have access to "clock", so don't even # bother return 0 set time [u_short $time] set date [u_short $date] # time = fedcba9876543210 # HHHHHmmmmmmSSSSS (sec/2 actually) # data = fedcba9876543210 # yyyyyyyMMMMddddd set sec [expr { ($time & 0x1F) * 2 }] set min [expr { ($time >> 5) & 0x3F }] set hour [expr { ($time >> 11) & 0x1F }] set mday [expr { $date & 0x1F }] set mon [expr { (($date >> 5) & 0xF) }] set year [expr { (($date >> 9) & 0xFF) + 1980 }] # Fix up bad date/time data, no need to fail if {$sec > 59} {set sec 59} if {$min > 59} {set sec 59} if {$hour > 23} {set hour 23} if {$mday < 1} {set mday 1} if {$mday > 35} {set mday 35} if {$mon < 1} {set mon 1} if {$mon > 12} {set mon 12} set res 0 while {$mday > 1 && [catch { set dt [format {%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d} \ $year $mon $mday $hour $min $sec] set res [clock scan $dt -gmt 1] }]} { # Only mday can be wrong, at end of month incr mday -1 } return $res } proc zip::Data {fd arr {varPtr ""} {verify 0}} { upvar 1 $arr sb |
︙ | ︙ | |||
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | # Compute base for situations where ZIP file # has been appended to another media (e.g. EXE) set cb(base) [expr { $pos - $cb(csize) - $cb(coff) }] } proc zip::TOC {fd arr} { upvar 1 $arr sb set buf [read $fd 46] binary scan $buf A4ssssssiiisssssii hdr \ sb(vem) sb(ver) sb(flags) sb(method) time date \ sb(crc) sb(csize) sb(size) \ flen elen clen sb(disk) sb(attr) \ sb(atx) sb(ino) if { ![string equal "PK\01\02" $hdr] } { binary scan $hdr H* x error "bad central header: $x" } foreach v {vem ver flags method disk attr} { | > > > | 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | # Compute base for situations where ZIP file # has been appended to another media (e.g. EXE) set cb(base) [expr { $pos - $cb(csize) - $cb(coff) }] } proc zip::TOC {fd arr} { upvar #0 zip::$fd cb upvar 1 $arr sb set buf [read $fd 46] binary scan $buf A4ssssssiiisssssii hdr \ sb(vem) sb(ver) sb(flags) sb(method) time date \ sb(crc) sb(csize) sb(size) \ flen elen clen sb(disk) sb(attr) \ sb(atx) sb(ino) set sb(ino) [expr {$cb(base) + $sb(ino)}] if { ![string equal "PK\01\02" $hdr] } { binary scan $hdr H* x error "bad central header: $x" } foreach v {vem ver flags method disk attr} { |
︙ | ︙ | |||
438 439 440 441 442 443 444 | upvar #0 zip::$fd cb upvar #0 zip::$fd.toc toc fconfigure $fd -translation binary ;#-buffering none zip::EndOfArchive $fd cb | | | 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | upvar #0 zip::$fd cb upvar #0 zip::$fd.toc toc fconfigure $fd -translation binary ;#-buffering none zip::EndOfArchive $fd cb seek $fd [expr {$cb(base) + $cb(coff)}] start set toc(_) 0; unset toc(_); #MakeArray for { set i 0 } { $i < $cb(nitems) } { incr i } { zip::TOC $fd sb set sb(depth) [llength [file split $sb(name)]] |
︙ | ︙ | |||
560 561 562 563 564 565 566 | proc zip::_close {fd} { variable $fd variable $fd.toc unset $fd unset $fd.toc ::close $fd } | > > > > > > > > > > > > > > > > > > > > > > | 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | proc zip::_close {fd} { variable $fd variable $fd.toc unset $fd unset $fd.toc ::close $fd } # use zlib to define zip and crc if available if {[llength [info command vfs::zip]] == 0 && [llength [info command zlib]] || ![catch {load "" zlib}]} { proc vfs::zip {flag value args} { switch -glob -- "$flag $value" { {-mode d*} { set mode decompress } {-mode c*} { set mode compress } default { error "usage: zip -mode {compress|decompress} data" } } # kludge to allow "-nowrap 1" as second option, 5-9-2002 if {[llength $args] > 2 && [lrange $args 0 1] eq "-nowrap 1"} { if {$mode eq "compress"} { set mode deflate } else { set mode inflate } } return [zlib $mode [lindex $args end]] } } |
Added tclvfs/patches/all/tclvfs-20080503-zipvfs-clock_and_append_to_exe.diff version [b74bd5027c].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | Binary files tclvfs-20080503.orig//library/.zipvfs.tcl.swp and tclvfs-20080503-1rsk//library/.zipvfs.tcl.swp differ diff -uNr tclvfs-20080503.orig//library/zipvfs.tcl tclvfs-20080503-1rsk//library/zipvfs.tcl --- tclvfs-20080503.orig//library/zipvfs.tcl 2008-04-15 16:11:53.000000000 -0500 +++ tclvfs-20080503-1rsk//library/zipvfs.tcl 2010-09-10 06:48:25.026165002 -0500 @@ -255,21 +255,21 @@ set year [expr { (($date >> 9) & 0xFF) + 1980 }] # Fix up bad date/time data, no need to fail - while {$sec > 59} {incr sec -60} - while {$min > 59} {incr sec -60} - while {$hour > 23} {incr hour -24} - if {$mday < 1} {incr mday} - if {$mon < 1} {incr mon} - while {$mon > 12} {incr hour -12} + if {$sec > 59} {set sec 59} + if {$min > 59} {set sec 59} + if {$hour > 23} {set hour 23} + if {$mday < 1} {set mday 1} + if {$mday > 31} {set mday 31} + if {$mon < 1} {set mon 1} + if {$mon > 12} {set mon 12} - while {[catch { + set res 0 + catch { set dt [format {%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d} \ $year $mon $mday $hour $min $sec] set res [clock scan $dt -gmt 1] - }]} { - # Only mday can be wrong, at end of month - incr mday -1 } + return $res } @@ -400,6 +400,7 @@ } proc zip::TOC {fd arr} { + upvar #0 zip::$fd cb upvar 1 $arr sb set buf [read $fd 46] @@ -410,6 +411,8 @@ flen elen clen sb(disk) sb(attr) \ sb(atx) sb(ino) + set sb(ino) [expr {$cb(base) + $sb(ino)}] + if { ![string equal "PK\01\02" $hdr] } { binary scan $hdr H* x error "bad central header: $x" @@ -442,7 +445,7 @@ zip::EndOfArchive $fd cb - seek $fd $cb(coff) start + seek $fd [expr {$cb(base) + $cb(coff)}] start set toc(_) 0; unset toc(_); #MakeArray |