Compare commits

...
Author SHA1 Message Date
tne 25358e0ba4 Updating hypnotoad branch 2014-09-03 21:10:46 +00:00
hypnotoad b6f9bc7ca8 More tweaks to makefiles 2014-09-03 20:41:12 +00:00
hypnotoad 79ccab2fd2 Merging in changes from Tcl
Reduced the code necessary to bootstrap a shell to a single C call.

Reduced the number of new stub entries to 1

Fixed a Makefile goof that was preventing kits from running properly.
2014-09-03 20:32:08 +00:00
hypnotoad 8d1d673760 Backported dkf's documentation effort to the main core_zip_vfs branch 2014-09-03 10:50:06 +00:00
dkf 6c2512bc35 Clean up of docs, import basic text from comments in code, format. 2014-09-03 10:24:53 +00:00
hypnotoad 2c1a55d314 Merging in the "official" windows hang patch 2014-09-02 22:06:21 +00:00
hypnotoad e88bbb7296 Merging with fix_windows_zip 2014-09-02 21:19:56 +00:00
hypnotoad 06547a29be Fix for the cases where a dynamic build is used 2014-09-02 21:16:20 +00:00
hypnotoad 8ca1a78b1a Revised patch (per ferrieux) 2014-09-02 20:26:50 +00:00
hypnotoad 6c59decfba Merging in changes from core_zip_vfs 2014-09-02 20:17:57 +00:00
hypnotoad 732a963e04 Added a hac^H^H^Hpatch from ferrieux to mask around the exit hang on windows until
the issues are fixed at the core level.
2014-09-02 20:16:54 +00:00
hypnotoad cd9922f497 Pared down tclZipVfs to eliminate #ifdef branches that we don't have to worry
about with a modern Tcl.

Replaced dummy calls to VFS with NULL 

Where practical, replaced string-based Tcl IO calls with their new obj-based
successors. (Tcl_FSOpenChannel, Tcl_FSStat, etc)

Eliminated compiler warnings under Windows
2014-09-02 18:30:23 +00:00
hypnotoad 9554b52dba Start of the "hypnotoad" branch, combining the various patches I'm testing
against.
2014-09-02 15:23:56 +00:00
hypnotoad 8c90b3ae99 Patch to make the default behavior for Tcl under Windows to embed the Zlib
sources rather than add a dependency to a dynamic zlib.dll
2014-09-02 15:21:23 +00:00
hypnotoad 811d367c49 Rather than make a special executable, tclkits are now a copy of tclsh with an attached zip file 2014-09-02 11:04:53 +00:00
hypnotoad 1d9824ec60 Tweaking the Makefile instructions for Tclkits under unix 2014-09-01 23:23:37 +00:00
dkf 5c6730bd0f Squelch most warnings. 2014-09-01 13:51:59 +00:00
dkf 78b3c04320 Bring the source more into line with Tcl style. 2014-09-01 10:45:41 +00:00
hypnotoad 0ce217e309 Merging in changes from core. 2014-09-01 10:03:54 +00:00
hypnotoad d1536b7378 Tweaks to the Windows makefile. 2014-09-01 09:41:09 +00:00
hypnotoad eb664a3d72 Tweak the Windows implementation of Tcl_AppInit() to match Unix 2014-09-01 09:36:58 +00:00
hypnotoad 96dd5baf98 Adding the ability for the Tcl core to build self-contained Zip-based executables
* Integrated a pure-C implementation of ZipVfs
* Modified Tcl_AppInit() to look for a zipvfs mounted on the executable
2014-09-01 07:15:40 +00:00
15 changed files with 2877 additions and 5 deletions
+2
View File
@@ -8452,3 +8452,5 @@ include ::oo::class (fellows)
2014-08-25 (TIP 429) New command [string cat] (leitgeb,ferrieux)
--- Released 8.6.2, August 27, 2014 --- http://core.tcl.tk/tcl/ for details
2014-08-29 (TIP TBD) Added a C Implementation of ZipVFS to provide Tcl/Wishkit building capbilities in the core (hypnotoad)
+9
View File
@@ -143,6 +143,15 @@ incomplete commands.
.SH "STANDARD CHANNELS"
.PP
See \fBTcl_StandardChannels\fR for more explanations.
.SH ZIPVFS
.PP
When a zipfile is concatenated to the end of a \fBtclsh\fR, on
startup the contents of the zip archive will be mounted as the
virtual file system /zvfs. If a top level directory tcl8.6 is
present in the zip archive, it will become the directory loaded
as env(TCL_LIBRARY). If a file named \fBmain.tcl\fR is present
in the top level directory of the zip archive, it will be sourced
instead of the shell's normal command line handing.
.SH "SEE ALSO"
auto_path(n), encoding(n), env(n), fconfigure(n)
.SH KEYWORDS
+114
View File
@@ -0,0 +1,114 @@
'\"
'\" Copyright (c) 2014 Sean Woods
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.TH zvfs n 0.1 Zvfs "Zvfs Commands"
.so man.macros
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
zvfs \- Mount and work with ZIP files within Tcl
.SH SYNOPSIS
.nf
\fBpackage require zvfs \fR?\fB0.1\fR?
.sp
\fB::zvfs::add\fR ?\fB\-fconfigure \fIoptpairs...\fR? \fIarchive file1\fR ?\fIfile2 ...\fR?
\fB::zvfs::append\fR \fIarchive\fR ?\fIsource destination\fR? ?\fIsource destination...\fR?
\fB::zvfs::dump\fR \fIzipfile\fR
\fB::zvfs::exists\fR \fIfilename\fR
\fB::zvfs::info\fR \fIfile\fR
\fB::zvfs::list\fR ?\fB\-glob\fR|\fB\-regexp\fR? ?\fIpattern\fR?
\fB::zvfs::mount ?\fIarchive\fR? ?\fImountpoint\fR?
\fB::zvfs::start\fR \fIzipfile\fR
\fB::zvfs::unmount \fIarchive\fR
.fi
.BE
.SH DESCRIPTION
.PP
The \fBzvfs\fR package provides tcl with the ability to manipulate
the contents of a zip file archive as a virtual file system.
.TP
\fB::zvfs::mount ?\fIarchive\fR? ?\fImountpoint\fR?
.
The \fB::zvfs::mount\fR procedure mounts a zipfile as a VFS.
After this command
executes, files contained in the ZIP archive, \fIarchive\fR, will appear to Tcl to be
regular files at the mount point.
.RS
.PP
With no \fImountpoint\fR, returns the mount point for \fIarchive\fR. With no \fIarchive\fR,
return all archive/mount pairs. If \fImountpoint\fR is specified as an empty
string, mount on file path.
.RE
.TP
\fB::zvfs::unmount \fIarchive\fR
.
Unmounts a previously mounted zip, \fIarchive\fR.
.TP
\fB::zvfs::append\fR \fIarchive\fR ?\fIsource destination\fR? ?\fIsource destination...\fR?
.
This command reads \fIsource\fR files and appends them (using the name
\fIdestination\fR) to the zip archive named \fIarchive\fR. A new zip archive is created
if it does not already exist. If \fIarchive\fR refers to a file which exists but
is not a zip archive, then this command turns \fIarchive\fR into a zip archive by
appending the necessary records and the table of contents. Treat all files
as binary.
.RS
.PP
Note: No duplicate checking is done, so multiple occurances of the same file is
allowed.
.RE
.TP
\fB::zvfs::add\fR ?\fB\-fconfigure \fIoptpairs...\fR? \fIarchive file1\fR ?\fIfile2 ...\fR?
.
This command is similar to \fBzvfs::append\fR in that it adds files to the zip archive
named \fIarchive\fR, however file names are relative the current directory. In
addition, \fBfconfigure\fR is used to apply option pairs to set upon opening of
each file. Otherwise, default translation is allowed for those file
extensions listed in the \fB::zvfs::auto_ext\fR variable. Binary translation will be
used for unknown extensions.
.RS
.PP
NOTE: Use
.QW "\fB\-fconfigure {}\fR"
to use auto translation for all.
.RE
.TP
\fB::zvfs::exists\fR \fIfilename\fR
.
Return TRUE if the given filename exists in the mounted ZVFS and FALSE if it does
not.
.TP
\fB::zvfs::info\fR \fIfile\fR
.
Return information about the given file in the mounted ZVFS. The information
consists of (1) the name of the ZIP archive that contains the file, (2) the
size of the file after decompressions, (3) the compressed size of the file,
and (4) the offset of the compressed data in the archive.
.RS
.PP
Note: querying the mount point gives the start of zip data offset in (4),
which can be used to truncate the zip info off an executable.
.RE
.TP
\fB::zvfs::list\fR ?\fB\-glob\fR|\fB\-regexp\fR? ?\fIpattern\fR?
.
Return a list of all files in the mounted ZVFS. The order of the names in the list
is arbitrary.
.TP
\fB::zvfs::dump\fR \fIzipfile\fR
.
Describe the contents of a zip.
.TP
\fB::zvfs::start\fR \fIzipfile\fR
.
This command strips returns the offset of zip data.
.SH "SEE ALSO"
tclsh(1), file(n), zlib(n)
.SH "KEYWORDS"
compress, filesystem, zip
'\" Local Variables:
'\" mode: nroff
'\" End:
+5
View File
@@ -2326,6 +2326,11 @@ declare 630 {
# ----- BASELINE -- FOR -- 8.6.0 ----- #
# ZipVfs
declare 631 {
int Tcl_Zvfs_Boot(Tcl_Interp *interp)
}
##############################################################################
# Define the platform specific public Tcl interface. These functions are only
+5
View File
@@ -1815,6 +1815,8 @@ EXTERN int Tcl_FSUnloadFile(Tcl_Interp *interp,
EXTERN void Tcl_ZlibStreamSetCompressionDictionary(
Tcl_ZlibStream zhandle,
Tcl_Obj *compressionDictionaryObj);
/* 631 */
EXTERN int Tcl_Zvfs_Boot(Tcl_Interp *interp);
typedef struct {
const struct TclPlatStubs *tclPlatStubs;
@@ -2481,6 +2483,7 @@ typedef struct TclStubs {
void * (*tcl_FindSymbol) (Tcl_Interp *interp, Tcl_LoadHandle handle, const char *symbol); /* 628 */
int (*tcl_FSUnloadFile) (Tcl_Interp *interp, Tcl_LoadHandle handlePtr); /* 629 */
void (*tcl_ZlibStreamSetCompressionDictionary) (Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); /* 630 */
int (*tcl_Zvfs_Boot) (Tcl_Interp *interp); /* 631 */
} TclStubs;
extern const TclStubs *tclStubsPtr;
@@ -3773,6 +3776,8 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_FSUnloadFile) /* 629 */
#define Tcl_ZlibStreamSetCompressionDictionary \
(tclStubsPtr->tcl_ZlibStreamSetCompressionDictionary) /* 630 */
#define Tcl_Zvfs_Boot \
(tclStubsPtr->tcl_Zvfs_Boot) /* 631 */
#endif /* defined(USE_TCL_STUBS) */
+1
View File
@@ -1412,6 +1412,7 @@ const TclStubs tclStubs = {
Tcl_FindSymbol, /* 628 */
Tcl_FSUnloadFile, /* 629 */
Tcl_ZlibStreamSetCompressionDictionary, /* 630 */
Tcl_Zvfs_Boot, /* 631 */
};
/* !END!: Do not edit above this line. */
+2564
View File
File diff suppressed because it is too large Load Diff
+16 -1
View File
@@ -167,6 +167,7 @@ INSTALL_DATA_DIR = ${INSTALL} -d -m 755
# Do not use SHELL_ENV for NATIVE_TCLSH unless it is the tclsh being built.
EXE_SUFFIX = @EXEEXT@
TCL_EXE = tclsh${EXE_SUFFIX}
TCLKIT_EXE = tclkit${EXE_SUFFIX}
TCLTEST_EXE = tcltest${EXE_SUFFIX}
NATIVE_TCLSH = @TCLSH_PROG@
@@ -307,7 +308,7 @@ GENERIC_OBJS = regcomp.o regexec.o regfree.o regerror.o tclAlloc.o \
tclResolve.o tclResult.o tclScan.o tclStringObj.o \
tclStrToD.o tclThread.o \
tclThreadAlloc.o tclThreadJoin.o tclThreadStorage.o tclStubInit.o \
tclTimer.o tclTrace.o tclUtf.o tclUtil.o tclVar.o tclZlib.o \
tclTimer.o tclTrace.o tclUtf.o tclUtil.o tclVar.o tclZlib.o tclZipVfs.o \
tclTomMathInterface.o
OO_OBJS = tclOO.o tclOOBasic.o tclOOCall.o tclOODefineCmds.o tclOOInfo.o \
@@ -462,6 +463,7 @@ GENERIC_SRCS = \
$(GENERIC_DIR)/tclUtil.c \
$(GENERIC_DIR)/tclVar.c \
$(GENERIC_DIR)/tclAssembly.c \
$(GENERIC_DIR)/tclZipVfs.obj \
$(GENERIC_DIR)/tclZlib.c
OO_SRCS = \
@@ -647,6 +649,16 @@ ${TCL_EXE}: ${TCLSH_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE}
@TCL_BUILD_LIB_SPEC@ ${TCL_STUB_LIB_FILE} ${LIBS} @EXTRA_TCLSH_LIBS@ \
${CC_SEARCH_FLAGS} -o ${TCL_EXE}
null.zip:
touch .empty
zip null.zip .empty
${TCLKIT_EXE}: ${TCL_EXE} null.zip
PWD=`pwd`
cp -f ${TCL_EXE} ${TCLKIT_EXE}
cat null.zip >> ${TCLKIT_EXE}
cd ${prefix}/lib ; zip -rAq ${PWD}/${TCLKIT_EXE} tcl8 tcl8.6
# Must be empty so it doesn't conflict with rule for ${TCL_EXE} above
${NATIVE_TCLSH}:
@@ -1319,6 +1331,9 @@ tclUtf.o: $(GENERIC_DIR)/tclUtf.c $(GENERIC_DIR)/tclUniData.c
tclVar.o: $(GENERIC_DIR)/tclVar.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclVar.c
tclZipVfs.o: $(GENERIC_DIR)/tclZipVfs.c
$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclZipVfs.c
tclZlib.o: $(GENERIC_DIR)/tclZlib.c
$(CC) -c $(CC_SWITCHES) $(ZLIB_INCLUDE) $(GENERIC_DIR)/tclZlib.c
+4 -2
View File
@@ -15,7 +15,7 @@
#undef BUILD_tcl
#undef STATIC_BUILD
#include "tcl.h"
#include "tclInt.h"
#ifdef TCL_TEST
extern Tcl_PackageInitProc Tcltest_Init;
extern Tcl_PackageInitProc Tcltest_SafeInit;
@@ -108,6 +108,8 @@ int
Tcl_AppInit(
Tcl_Interp *interp) /* Interpreter for application. */
{
Tcl_Zvfs_Boot(interp);
if ((Tcl_Init)(interp) == TCL_ERROR) {
return TCL_ERROR;
}
@@ -124,7 +126,7 @@ Tcl_AppInit(
}
Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init, Tcltest_SafeInit);
#endif /* TCL_TEST */
/*
* Call the init procedures for included packages. Each call should look
* like this:
+16 -2
View File
@@ -145,6 +145,7 @@ SHARED_LIBRARIES = $(TCL_DLL_FILE) @ZLIB_DLL_FILE@
STATIC_LIBRARIES = $(TCL_LIB_FILE)
TCLSH = tclsh$(VER)${EXESUFFIX}
TCLKIT = tclkit$(VER)${EXESUFFIX}
CAT32 = cat32$(EXEEXT)
MAN2TCL = man2tcl$(EXEEXT)
@@ -294,7 +295,8 @@ GENERIC_OBJS = \
tclUtf.$(OBJEXT) \
tclUtil.$(OBJEXT) \
tclVar.$(OBJEXT) \
tclZlib.$(OBJEXT)
tclZlib.$(OBJEXT) \
tclZipVfs.$(OBJEXT)
TOMMATH_OBJS = \
bncore.${OBJEXT} \
@@ -422,6 +424,18 @@ $(TCLSH): $(TCLSH_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES)
tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE)
@VC_MANIFEST_EMBED_EXE@
tclkit: $(TCLKIT)
null.zip:
touch .empty
zip null.zip .empty
$(TCLKIT): $(TCLSH) null.zip
PWD=`pwd`
cp -f $(WISH) $(TCLKIT)
cat null.zip >> $(TCLKIT)
cd ${prefix}/lib ; zip -rAq ${PWD}/$(TCLKIT) tcl8 tcl8.6
cat32.$(OBJEXT): cat.c
$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
@@ -867,6 +881,6 @@ html-tk: $(TCLSH)
.PHONY: install-doc install-private-headers test test-tcl runtest shell
.PHONY: gdb depend cleanhelp clean distclean packages install-packages
.PHONY: test-packages clean-packages distclean-packages genstubs html
.PHONY: html-tcl html-tk
.PHONY: html-tcl html-tk tclkit
# DO NOT DELETE THIS LINE -- make depend depends on it.
+1
View File
@@ -275,6 +275,7 @@ TCLOBJS = \
$(TMPDIR)\tclWinSock.obj \
$(TMPDIR)\tclWinThrd.obj \
$(TMPDIR)\tclWinTime.obj \
$(TMP_DIR)\tclZipVfs.obj \
$(TMPDIR)\tclZlib.obj
TCLSTUBOBJS = \
+4
View File
@@ -343,6 +343,7 @@ COREOBJS = \
$(TMP_DIR)\tclUtf.obj \
$(TMP_DIR)\tclUtil.obj \
$(TMP_DIR)\tclVar.obj \
$(TMP_DIR)\tclZipVfs.obj \
$(TMP_DIR)\tclZlib.obj
ZLIBOBJS = \
@@ -931,6 +932,9 @@ $(TMP_DIR)\tclTestObj.obj: $(GENERICDIR)\tclTestObj.c
$(TMP_DIR)\tclWinTest.obj: $(WINDIR)\tclWinTest.c
$(cc32) $(TCL_CFLAGS) -Fo$@ $?
$(TMP_DIR)\tclZipVfs.obj: $(GENERICDIR)\tclZipVfs.c
$(cc32) $(TCL_CFLAGS) -I$(COMPATDIR)\zlib -DBUILD_tcl -Fo$@ $?
$(TMP_DIR)\tclZlib.obj: $(GENERICDIR)\tclZlib.c
$(cc32) $(TCL_CFLAGS) -I$(COMPATDIR)\zlib -DBUILD_tcl -Fo$@ $?
+3
View File
@@ -15,6 +15,7 @@
*/
#include "tcl.h"
#include "tclInt.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
@@ -151,6 +152,8 @@ int
Tcl_AppInit(
Tcl_Interp *interp) /* Interpreter for application. */
{
Tcl_Zvfs_Boot(interp);
if ((Tcl_Init)(interp) == TCL_ERROR) {
return TCL_ERROR;
}
+51
View File
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"
xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity
version="@TCL_WIN_VERSION@"
processorArchitecture="@MACHINE@"
name="Tcl.tclsh"
type="win32"
/>
<description>Tcl self-contained executable (tclkit)</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"
/>
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
</application>
</compatibility>
<asmv3:application>
<asmv3:windowsSettings
xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="@MACHINE@"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
+82
View File
@@ -0,0 +1,82 @@
//
// Version Resource Script
//
#include <winver.h>
#include <tcl.h>
//
// build-up the name suffix that defines the type of build this is.
//
#if TCL_THREADS
#define SUFFIX_THREADS "t"
#else
#define SUFFIX_THREADS ""
#endif
#if STATIC_BUILD
#define SUFFIX_STATIC "s"
#else
#define SUFFIX_STATIC ""
#endif
#if DEBUG && !UNCHECKED
#define SUFFIX_DEBUG "g"
#else
#define SUFFIX_DEBUG ""
#endif
#define SUFFIX SUFFIX_THREADS SUFFIX_STATIC SUFFIX_DEBUG
LANGUAGE 0x9, 0x1 /* LANG_ENGLISH, SUBLANG_DEFAULT */
VS_VERSION_INFO VERSIONINFO
FILEVERSION TCL_MAJOR_VERSION,TCL_MINOR_VERSION,TCL_RELEASE_LEVEL,TCL_RELEASE_SERIAL
PRODUCTVERSION TCL_MAJOR_VERSION,TCL_MINOR_VERSION,TCL_RELEASE_LEVEL,TCL_RELEASE_SERIAL
FILEFLAGSMASK 0x3fL
#ifdef DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "Tclkit Application\0"
VALUE "OriginalFilename", "tclkit" STRINGIFY(TCL_MAJOR_VERSION) STRINGIFY(TCL_MINOR_VERSION) SUFFIX ".exe\0"
VALUE "CompanyName", "ActiveState Corporation\0"
VALUE "FileVersion", TCL_PATCH_LEVEL
VALUE "LegalCopyright", "Copyright \251 2000 by ActiveState Corporation, et al\0"
VALUE "ProductName", "Tcl " TCL_VERSION " for Windows\0"
VALUE "ProductVersion", TCL_PATCH_LEVEL
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
//
// Icon
//
tclsh ICON DISCARDABLE "tclsh.ico"
//
// This is needed for Windows 8.1 onwards.
//
#ifndef RT_MANIFEST
#define RT_MANIFEST 24
#endif
#ifndef CREATEPROCESS_MANIFEST_RESOURCE_ID
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#endif
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "tclkit.exe.manifest"