summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tcl.decls4
-rw-r--r--generic/tcl.h7
-rw-r--r--generic/tclDecls.h6
-rw-r--r--generic/tclIOUtil.c39
-rw-r--r--generic/tclInt.h3
-rw-r--r--generic/tclLoad.c16
6 files changed, 42 insertions, 33 deletions
diff --git a/generic/tcl.decls b/generic/tcl.decls
index 69ebc9c..6e0f5f5 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -11,7 +11,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: tcl.decls,v 1.90 2002/06/21 14:22:28 vincentdarley Exp $
+# RCS: @(#) $Id: tcl.decls,v 1.91 2002/07/22 16:51:47 vincentdarley Exp $
library tcl
@@ -1569,7 +1569,7 @@ declare 444 generic {
Tcl_Obj *pathPtr, CONST char * sym1, CONST char * sym2,
Tcl_PackageInitProc ** proc1Ptr,
Tcl_PackageInitProc ** proc2Ptr,
- ClientData * clientDataPtr,
+ Tcl_LoadHandle * handlePtr,
Tcl_FSUnloadFileProc **unloadProcPtr)
}
declare 445 generic {
diff --git a/generic/tcl.h b/generic/tcl.h
index 38219b7..4fc6592 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tcl.h,v 1.135 2002/07/18 16:26:02 vincentdarley Exp $
+ * RCS: @(#) $Id: tcl.h,v 1.136 2002/07/22 16:51:47 vincentdarley Exp $
*/
#ifndef _TCL
@@ -1618,10 +1618,7 @@ typedef Tcl_Obj* (Tcl_FSLinkProc) _ANSI_ARGS_((Tcl_Obj *pathPtr,
Tcl_Obj *toPtr, int linkType));
typedef int (Tcl_FSLoadFileProc) _ANSI_ARGS_((Tcl_Interp * interp,
Tcl_Obj *pathPtr,
- CONST char * sym1, CONST char * sym2,
- Tcl_PackageInitProc ** proc1Ptr,
- Tcl_PackageInitProc ** proc2Ptr,
- ClientData * clientDataPtr,
+ Tcl_LoadHandle *handlePtr,
Tcl_FSUnloadFileProc **unloadProcPtr));
typedef int (Tcl_FSPathInFilesystemProc) _ANSI_ARGS_((Tcl_Obj *pathPtr,
ClientData *clientDataPtr));
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index 0a4df01..19687a3 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclDecls.h,v 1.90 2002/06/22 00:06:23 dkf Exp $
+ * RCS: @(#) $Id: tclDecls.h,v 1.91 2002/07/22 16:51:48 vincentdarley Exp $
*/
#ifndef _TCLDECLS
@@ -1407,7 +1407,7 @@ EXTERN int Tcl_FSLoadFile _ANSI_ARGS_((Tcl_Interp * interp,
CONST char * sym2,
Tcl_PackageInitProc ** proc1Ptr,
Tcl_PackageInitProc ** proc2Ptr,
- ClientData * clientDataPtr,
+ Tcl_LoadHandle * handlePtr,
Tcl_FSUnloadFileProc ** unloadProcPtr));
/* 445 */
EXTERN int Tcl_FSMatchInDirectory _ANSI_ARGS_((
@@ -2059,7 +2059,7 @@ typedef struct TclStubs {
int (*tcl_FSCopyDirectory) _ANSI_ARGS_((Tcl_Obj * srcPathPtr, Tcl_Obj * destPathPtr, Tcl_Obj ** errorPtr)); /* 441 */
int (*tcl_FSCreateDirectory) _ANSI_ARGS_((Tcl_Obj * pathPtr)); /* 442 */
int (*tcl_FSDeleteFile) _ANSI_ARGS_((Tcl_Obj * pathPtr)); /* 443 */
- int (*tcl_FSLoadFile) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * pathPtr, CONST char * sym1, CONST char * sym2, Tcl_PackageInitProc ** proc1Ptr, Tcl_PackageInitProc ** proc2Ptr, ClientData * clientDataPtr, Tcl_FSUnloadFileProc ** unloadProcPtr)); /* 444 */
+ int (*tcl_FSLoadFile) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * pathPtr, CONST char * sym1, CONST char * sym2, Tcl_PackageInitProc ** proc1Ptr, Tcl_PackageInitProc ** proc2Ptr, Tcl_LoadHandle * handlePtr, Tcl_FSUnloadFileProc ** unloadProcPtr)); /* 444 */
int (*tcl_FSMatchInDirectory) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * result, Tcl_Obj * pathPtr, CONST char * pattern, Tcl_GlobTypeData * types)); /* 445 */
Tcl_Obj * (*tcl_FSLink) _ANSI_ARGS_((Tcl_Obj * pathPtr, Tcl_Obj * toPtr, int linkAction)); /* 446 */
int (*tcl_FSRemoveDirectory) _ANSI_ARGS_((Tcl_Obj * pathPtr, int recursive, Tcl_Obj ** errorPtr)); /* 447 */
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index c419727..27f32b4 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -17,7 +17,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIOUtil.c,v 1.62 2002/07/21 17:03:00 dgp Exp $
+ * RCS: @(#) $Id: tclIOUtil.c,v 1.63 2002/07/22 16:51:48 vincentdarley Exp $
*/
#include "tclInt.h"
@@ -372,8 +372,15 @@ Tcl_FSUnloadFileProc TclpUnloadFile;
Tcl_FSLinkProc TclpObjLink;
Tcl_FSListVolumesProc TclpObjListVolumes;
-/* Define the native filesystem dispatch table */
-Tcl_Filesystem tclNativeFilesystem = {
+/*
+ * Define the native filesystem dispatch table. If necessary, it
+ * is ok to make this non-static, but it should only be accessed
+ * by the functions actually listed within it (or perhaps other
+ * helper functions of them). Anything which is not part of this
+ * 'native filesystem implementation' should not be delving inside
+ * here!
+ */
+static Tcl_Filesystem tclNativeFilesystem = {
"native",
sizeof(Tcl_Filesystem),
TCL_FILESYSTEM_VERSION_1,
@@ -406,7 +413,7 @@ Tcl_Filesystem tclNativeFilesystem = {
&TclpObjRenameFile,
&TclpObjCopyDirectory,
&TclpObjLstat,
- &TclpLoadFile,
+ &TclpDlopen,
&TclpObjGetCwd,
&TclpObjChdir
};
@@ -578,7 +585,7 @@ FsReleaseIterator(void) {
* Clean up the filesystem. After this, calls to all Tcl_FS...
* functions will fail.
*
- * Note that, since 'TclFinalizedLoad' may unload extensions
+ * Note that, since 'TclFinalizeLoad' may unload extensions
* which implement other filesystems, and which may therefore
* contain a 'freeProc' for those filesystems, at this stage
* we _must_ have freed all objects of "path" type, or we may
@@ -2491,7 +2498,7 @@ Tcl_FSChdir(pathPtr)
int
Tcl_FSLoadFile(interp, pathPtr, sym1, sym2, proc1Ptr, proc2Ptr,
- clientDataPtr, unloadProcPtr)
+ handlePtr, unloadProcPtr)
Tcl_Interp *interp; /* Used for error reporting. */
Tcl_Obj *pathPtr; /* Name of the file containing the desired
* code. */
@@ -2500,7 +2507,7 @@ Tcl_FSLoadFile(interp, pathPtr, sym1, sym2, proc1Ptr, proc2Ptr,
Tcl_PackageInitProc **proc1Ptr, **proc2Ptr;
/* Where to return the addresses corresponding
* to sym1 and sym2. */
- ClientData *clientDataPtr; /* Filled with token for dynamically loaded
+ Tcl_LoadHandle *handlePtr; /* Filled with token for dynamically loaded
* file which will be passed back to
* (*unloadProcPtr)() to unload the file. */
Tcl_FSUnloadFileProc **unloadProcPtr;
@@ -2512,9 +2519,15 @@ Tcl_FSLoadFile(interp, pathPtr, sym1, sym2, proc1Ptr, proc2Ptr,
if (fsPtr != NULL) {
Tcl_FSLoadFileProc *proc = fsPtr->loadFileProc;
if (proc != NULL) {
- int retVal = (*proc)(interp, pathPtr, sym1, sym2,
- proc1Ptr, proc2Ptr, clientDataPtr,
- unloadProcPtr);
+ int retVal = (*proc)(interp, pathPtr, handlePtr, unloadProcPtr);
+ if (retVal != TCL_OK) {
+ return retVal;
+ }
+ if (*handlePtr == NULL) {
+ return TCL_ERROR;
+ }
+ *proc1Ptr = TclpFindSymbol(interp, *handlePtr, sym1);
+ *proc2Ptr = TclpFindSymbol(interp, *handlePtr, sym2);
return retVal;
} else {
Tcl_Filesystem *copyFsPtr;
@@ -2573,7 +2586,7 @@ Tcl_FSLoadFile(interp, pathPtr, sym1, sym2, proc1Ptr, proc2Ptr,
retVal = Tcl_FSLoadFile(interp, copyToPtr, sym1, sym2,
proc1Ptr, proc2Ptr,
- (ClientData*)&newLoadHandle,
+ &newLoadHandle,
&newUnloadProcPtr);
if (retVal != TCL_OK) {
/* The file didn't load successfully */
@@ -2588,7 +2601,7 @@ Tcl_FSLoadFile(interp, pathPtr, sym1, sym2, proc1Ptr, proc2Ptr,
*/
if (Tcl_FSDeleteFile(copyToPtr) == TCL_OK) {
Tcl_DecrRefCount(copyToPtr);
- (*clientDataPtr) = NULL;
+ (*handlePtr) = NULL;
(*unloadProcPtr) = NULL;
return TCL_OK;
}
@@ -2621,7 +2634,7 @@ Tcl_FSLoadFile(interp, pathPtr, sym1, sym2, proc1Ptr, proc2Ptr,
tvdlPtr->divertedFileNativeRep = Tcl_FSGetInternalRep(copyToPtr,
copyFsPtr);
copyToPtr = NULL;
- (*clientDataPtr) = (ClientData) tvdlPtr;
+ (*handlePtr) = (Tcl_LoadHandle) tvdlPtr;
(*unloadProcPtr) = &FSUnloadTempFile;
return retVal;
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 05780ed..8fad788 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclInt.h,v 1.107 2002/07/19 12:31:10 dkf Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.108 2002/07/22 16:51:48 vincentdarley Exp $
*/
#ifndef _TCLINT
@@ -1613,7 +1613,6 @@ extern char * tclDefaultEncodingDir;
extern Tcl_ChannelType tclFileChannelType;
extern char * tclMemDumpFileName;
extern TclPlatformType tclPlatform;
-extern Tcl_Filesystem tclNativeFilesystem;
/*
* Variables denoting the Tcl object types defined in the core.
diff --git a/generic/tclLoad.c b/generic/tclLoad.c
index 75dec1b..959fd7b 100644
--- a/generic/tclLoad.c
+++ b/generic/tclLoad.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclLoad.c,v 1.7 2002/01/09 19:09:28 kennykb Exp $
+ * RCS: @(#) $Id: tclLoad.c,v 1.8 2002/07/22 16:51:48 vincentdarley Exp $
*/
#include "tclInt.h"
@@ -32,7 +32,7 @@ typedef struct LoadedPackage {
* properly capitalized (first letter UC,
* others LC), no "_", as in "Net".
* Malloc-ed. */
- ClientData clientData; /* Token for the loaded file which should be
+ Tcl_LoadHandle loadHandle; /* Token for the loaded file which should be
* passed to (*unLoadProcPtr)() when the file
* is no longer needed. If fileName is NULL,
* then this field is irrelevant. */
@@ -124,7 +124,7 @@ Tcl_LoadObjCmd(dummy, interp, objc, objv)
InterpPackage *ipFirstPtr, *ipPtr;
int code, namesMatch, filesMatch;
char *p, *fullFileName, *packageName;
- ClientData clientData;
+ Tcl_LoadHandle loadHandle;
Tcl_FSUnloadFileProc *unLoadProcPtr = NULL;
Tcl_UniChar ch;
int offset;
@@ -340,7 +340,7 @@ Tcl_LoadObjCmd(dummy, interp, objc, objv)
Tcl_MutexLock(&packageMutex);
code = Tcl_FSLoadFile(interp, objv[1], Tcl_DStringValue(&initName),
Tcl_DStringValue(&safeInitName), &initProc, &safeInitProc,
- &clientData,&unLoadProcPtr);
+ &loadHandle,&unLoadProcPtr);
Tcl_MutexUnlock(&packageMutex);
if (code != TCL_OK) {
goto done;
@@ -349,7 +349,7 @@ Tcl_LoadObjCmd(dummy, interp, objc, objv)
Tcl_AppendResult(interp, "couldn't find procedure ",
Tcl_DStringValue(&initName), (char *) NULL);
if (unLoadProcPtr != NULL) {
- (*unLoadProcPtr)(clientData);
+ (*unLoadProcPtr)(loadHandle);
}
code = TCL_ERROR;
goto done;
@@ -366,7 +366,7 @@ Tcl_LoadObjCmd(dummy, interp, objc, objv)
pkgPtr->packageName = (char *) ckalloc((unsigned)
(Tcl_DStringLength(&pkgName) + 1));
strcpy(pkgPtr->packageName, Tcl_DStringValue(&pkgName));
- pkgPtr->clientData = clientData;
+ pkgPtr->loadHandle = loadHandle;
pkgPtr->unLoadProcPtr = unLoadProcPtr;
pkgPtr->initProc = initProc;
pkgPtr->safeInitProc = safeInitProc;
@@ -490,7 +490,7 @@ Tcl_StaticPackage(interp, pkgName, initProc, safeInitProc)
pkgPtr->packageName = (char *) ckalloc((unsigned)
(strlen(pkgName) + 1));
strcpy(pkgPtr->packageName, pkgName);
- pkgPtr->clientData = NULL;
+ pkgPtr->loadHandle = NULL;
pkgPtr->initProc = initProc;
pkgPtr->safeInitProc = safeInitProc;
Tcl_MutexLock(&packageMutex);
@@ -667,7 +667,7 @@ TclFinalizeLoad()
if (pkgPtr->fileName[0] != '\0') {
Tcl_FSUnloadFileProc *unLoadProcPtr = pkgPtr->unLoadProcPtr;
if (unLoadProcPtr != NULL) {
- (*unLoadProcPtr)(pkgPtr->clientData);
+ (*unLoadProcPtr)(pkgPtr->loadHandle);
}
}
#endif