diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tcl.decls | 13 | ||||
-rw-r--r-- | generic/tclDecls.h | 20 | ||||
-rw-r--r-- | generic/tclMain.c | 6 | ||||
-rw-r--r-- | generic/tclStubInit.c | 4 | ||||
-rwxr-xr-x | generic/tclZipVfs.c | 37 |
5 files changed, 43 insertions, 37 deletions
diff --git a/generic/tcl.decls b/generic/tcl.decls index 8352afa..5b0220e 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2328,20 +2328,9 @@ declare 630 { # ZipVfs declare 631 { - int Tcl_Zvfs_Init(Tcl_Interp *interp) + int Tcl_Zvfs_Boot(Tcl_Interp *interp) } -declare 632 { - int Tcl_Zvfs_Mount( - Tcl_Interp *interp, - CONST char *zArchive, - CONST char *zMountPoint - ) -} - -declare 633 { - int Tcl_Zvfs_Umount(CONST char *zArchive) -} ############################################################################## # Define the platform specific public Tcl interface. These functions are only diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 75dd554..06b46f0 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1816,13 +1816,7 @@ EXTERN void Tcl_ZlibStreamSetCompressionDictionary( Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); /* 631 */ -EXTERN int Tcl_Zvfs_Init(Tcl_Interp *interp); -/* 632 */ -EXTERN int Tcl_Zvfs_Mount(Tcl_Interp *interp, - CONST char *zArchive, - CONST char *zMountPoint); -/* 633 */ -EXTERN int Tcl_Zvfs_Umount(CONST char *zArchive); +EXTERN int Tcl_Zvfs_Boot(Tcl_Interp *interp); typedef struct { const struct TclPlatStubs *tclPlatStubs; @@ -2489,9 +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_Init) (Tcl_Interp *interp); /* 631 */ - int (*tcl_Zvfs_Mount) (Tcl_Interp *interp, CONST char *zArchive, CONST char *zMountPoint); /* 632 */ - int (*tcl_Zvfs_Umount) (CONST char *zArchive); /* 633 */ + int (*tcl_Zvfs_Boot) (Tcl_Interp *interp); /* 631 */ } TclStubs; extern const TclStubs *tclStubsPtr; @@ -3784,12 +3776,8 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tcl_FSUnloadFile) /* 629 */ #define Tcl_ZlibStreamSetCompressionDictionary \ (tclStubsPtr->tcl_ZlibStreamSetCompressionDictionary) /* 630 */ -#define Tcl_Zvfs_Init \ - (tclStubsPtr->tcl_Zvfs_Init) /* 631 */ -#define Tcl_Zvfs_Mount \ - (tclStubsPtr->tcl_Zvfs_Mount) /* 632 */ -#define Tcl_Zvfs_Umount \ - (tclStubsPtr->tcl_Zvfs_Umount) /* 633 */ +#define Tcl_Zvfs_Boot \ + (tclStubsPtr->tcl_Zvfs_Boot) /* 631 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/generic/tclMain.c b/generic/tclMain.c index 0bf2e8d..360f5e9 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.c @@ -382,12 +382,6 @@ Tcl_MainEx( */ Tcl_Preserve(interp); - - /* - * Check if this shell has an attached VFS - */ - CONST char *cp=Tcl_GetNameOfExecutable(); - if (appInitProc(interp) != TCL_OK) { chan = Tcl_GetStdChannel(TCL_STDERR); if (chan) { diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index b061ba6..ace1766 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -1412,9 +1412,7 @@ const TclStubs tclStubs = { Tcl_FindSymbol, /* 628 */ Tcl_FSUnloadFile, /* 629 */ Tcl_ZlibStreamSetCompressionDictionary, /* 630 */ - Tcl_Zvfs_Init, /* 631 */ - Tcl_Zvfs_Mount, /* 632 */ - Tcl_Zvfs_Umount, /* 633 */ + Tcl_Zvfs_Boot, /* 631 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tclZipVfs.c b/generic/tclZipVfs.c index 9b377c0..7baf469 100755 --- a/generic/tclZipVfs.c +++ b/generic/tclZipVfs.c @@ -1762,6 +1762,43 @@ Zvfs_doInit( return TCL_OK; } +/* +** Boot a shell, mount the executable's VFS, detect main.tcl +*/ +int Tcl_Zvfs_Boot(Tcl_Interp *interp) { + + CONST char *cp=Tcl_GetNameOfExecutable(); + /* We have to initialize the virtual filesystem before calling + ** Tcl_Init(). Otherwise, Tcl_Init() will not be able to find + ** its startup script files. + */ + if(Zvfs_doInit(interp, 0)) { + return TCL_ERROR; + } + if(!Tcl_Zvfs_Mount(interp, cp, "/zvfs")) { + Tcl_Obj *vfsinitscript=Tcl_NewStringObj("/zvfs/main.tcl",-1); + Tcl_Obj *vfstcllib=Tcl_NewStringObj("/zvfs/tcl8.6",-1); + Tcl_Obj *vfstklib=Tcl_NewStringObj("/zvfs/tk8.6",-1); + + Tcl_IncrRefCount(vfsinitscript); + Tcl_IncrRefCount(vfstcllib); + Tcl_IncrRefCount(vfstklib); + + if(Tcl_FSAccess(vfsinitscript,F_OK)==0) { + Tcl_SetStartupScript(vfsinitscript,NULL); + } + if(Tcl_FSAccess(vfstcllib,F_OK)==0) { + Tcl_SetVar2(interp, "env", "TCL_LIBRARY", Tcl_GetString(vfstcllib), TCL_GLOBAL_ONLY); + } + if(Tcl_FSAccess(vfstklib,F_OK)==0) { + Tcl_SetVar2(interp, "env", "TK_LIBRARY", Tcl_GetString(vfstklib), TCL_GLOBAL_ONLY); + } + Tcl_DecrRefCount(vfsinitscript); + Tcl_DecrRefCount(vfstcllib); + } + return TCL_OK; +} + int Tcl_Zvfs_Init( Tcl_Interp *interp) |