summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornijtmans <nijtmans>2010-08-14 17:13:02 (GMT)
committernijtmans <nijtmans>2010-08-14 17:13:02 (GMT)
commitbcc427ce10a994d6f852f8a4a3a47bd706317581 (patch)
tree4f5a2412e887b345c272cf9e43755763e7a3922f
parentd2976f0d8219a1841117e8e004c5bbe21c812961 (diff)
downloadtcl-bcc427ce10a994d6f852f8a4a3a47bd706317581.zip
tcl-bcc427ce10a994d6f852f8a4a3a47bd706317581.tar.gz
tcl-bcc427ce10a994d6f852f8a4a3a47bd706317581.tar.bz2
[Patch #2994165] Change signature of Tcl_FSGetNativePath and TclpDeleteFile
-rw-r--r--ChangeLog10
-rw-r--r--doc/FileSystem.319
-rw-r--r--generic/tcl.decls8
-rw-r--r--generic/tclDecls.h26
-rw-r--r--generic/tclIOUtil.c4
-rw-r--r--generic/tclInt.h4
-rw-r--r--generic/tclStubInit.c16
-rw-r--r--unix/tclUnixFCmd.c6
-rw-r--r--win/tclWinFCmd.c21
9 files changed, 74 insertions, 40 deletions
diff --git a/ChangeLog b/ChangeLog
index e2d7bb9..6dfcba1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,14 @@
2010-08-14 Jan Nijtmans <nijtmans@users.sf.net>
- * compat/unicows Remove completely, see Feature Req #2819611
+ * compat/unicows Remove completely, see Feature Req #2819611
+ * doc/FileSystem.3 [Patch #2994165] Change signature of
+ * generic/tcl.decls Tcl_FSGetNativePath and TclpDeleteFile
+ * generic/tclDecls.h
+ * generic/tclIOUtil.c
+ * generic/tclStubInit.c
+ * generic/tclInt.h
+ * unix/tclUnixFCmd.c
+ * win/tclWinFCmd.c
2010-08-11 Jeff Hobbs <jeffh@ActiveState.com>
diff --git a/doc/FileSystem.3 b/doc/FileSystem.3
index bc52214..d53fccc 100644
--- a/doc/FileSystem.3
+++ b/doc/FileSystem.3
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: FileSystem.3,v 1.71 2010/04/04 15:03:07 dkf Exp $
+'\" RCS: @(#) $Id: FileSystem.3,v 1.72 2010/08/14 17:13:02 nijtmans Exp $
'\"
.so man.macros
.TH Filesystem 3 8.4 Tcl "Tcl Library Procedures"
@@ -139,7 +139,7 @@ const char *
Tcl_Obj *
\fBTcl_FSNewNativePath\fR(\fIfsPtr, clientData\fR)
.sp
-const char *
+const void *
\fBTcl_FSGetNativePath\fR(\fIpathPtr\fR)
.sp
Tcl_Obj *
@@ -742,14 +742,13 @@ a UTF-8 string representation if that is required by some Tcl code.
\fBTcl_FSGetNativePath\fR is for use by the Win/Unix native
filesystems, so that they can easily retrieve the native (char* or
TCHAR*) representation of a path. This function is a convenience
-wrapper around \fBTcl_FSGetInternalRep\fR, and assumes the native
-representation is string-based. It may be desirable in the future to
-have non-string-based native representations (for example, on MacOSX, a
-representation using a fileSpec of FSRef structure would probably be
-more efficient). On Windows a full Unicode representation would allow
-for paths of unlimited length. Currently the representation is simply a
-character string which may contain either the relative path or a
-complete, absolute normalized path in the native encoding (complex
+wrapper around \fBTcl_FSGetInternalRep\fR. It may be desirable in the
+future to have non-string-based native representations (for example,
+on MacOSX, a representation using a fileSpec of FSRef structure would
+probably be more efficient). On Windows a full Unicode representation
+would allow for paths of unlimited length. Currently the representation
+is simply a character string which may contain either the relative path
+or a complete, absolute normalized path in the native encoding (complex
conditions dictate which of these will be provided, so neither can be
relied upon, unless the path is known to be absolute). If you need a
native path which must be absolute, then you should ask for the native
diff --git a/generic/tcl.decls b/generic/tcl.decls
index 303ac8e..0e9ef77 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -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: tcl.decls,v 1.175 2010/06/16 14:49:50 nijtmans Exp $
+# RCS: @(#) $Id: tcl.decls,v 1.176 2010/08/14 17:13:02 nijtmans Exp $
library tcl
@@ -1671,7 +1671,7 @@ declare 468 generic {
ClientData clientData)
}
declare 469 generic {
- const char *Tcl_FSGetNativePath(Tcl_Obj *pathPtr)
+ const char *TclFSGetNativePath(Tcl_Obj *pathPtr)
}
declare 470 generic {
Tcl_Obj *Tcl_FSFileSystemInfo(Tcl_Obj *pathPtr)
@@ -2319,6 +2319,10 @@ declare 629 generic {
int Tcl_FSUnloadFile(Tcl_Interp *interp, Tcl_LoadHandle handlePtr)
}
+declare 630 generic {
+ const void *Tcl_FSGetNativePath(Tcl_Obj *pathPtr)
+}
+
# ----- BASELINE -- FOR -- 8.6.0 ----- #
##############################################################################
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index 96e6a04..7043d2e 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.178 2010/07/24 06:39:52 nijtmans Exp $
+ * RCS: @(#) $Id: tclDecls.h,v 1.179 2010/08/14 17:13:02 nijtmans Exp $
*/
#ifndef _TCLDECLS
@@ -2765,10 +2765,10 @@ EXTERN Tcl_Obj * Tcl_FSNewNativePath(
const Tcl_Filesystem *fromFilesystem,
ClientData clientData);
#endif
-#ifndef Tcl_FSGetNativePath_TCL_DECLARED
-#define Tcl_FSGetNativePath_TCL_DECLARED
+#ifndef TclFSGetNativePath_TCL_DECLARED
+#define TclFSGetNativePath_TCL_DECLARED
/* 469 */
-EXTERN const char * Tcl_FSGetNativePath(Tcl_Obj *pathPtr);
+EXTERN const char * TclFSGetNativePath(Tcl_Obj *pathPtr);
#endif
#ifndef Tcl_FSFileSystemInfo_TCL_DECLARED
#define Tcl_FSFileSystemInfo_TCL_DECLARED
@@ -3703,6 +3703,11 @@ EXTERN void* Tcl_FindSymbol(Tcl_Interp *interp,
EXTERN int Tcl_FSUnloadFile(Tcl_Interp *interp,
Tcl_LoadHandle handlePtr);
#endif
+#ifndef Tcl_FSGetNativePath_TCL_DECLARED
+#define Tcl_FSGetNativePath_TCL_DECLARED
+/* 630 */
+EXTERN const void * Tcl_FSGetNativePath(Tcl_Obj *pathPtr);
+#endif
typedef struct TclStubHooks {
const struct TclPlatStubs *tclPlatStubs;
@@ -4207,7 +4212,7 @@ typedef struct TclStubs {
Tcl_Obj * (*tcl_FSGetTranslatedPath) (Tcl_Interp *interp, Tcl_Obj *pathPtr); /* 466 */
int (*tcl_FSEvalFile) (Tcl_Interp *interp, Tcl_Obj *fileName); /* 467 */
Tcl_Obj * (*tcl_FSNewNativePath) (const Tcl_Filesystem *fromFilesystem, ClientData clientData); /* 468 */
- const char * (*tcl_FSGetNativePath) (Tcl_Obj *pathPtr); /* 469 */
+ const char * (*tclFSGetNativePath) (Tcl_Obj *pathPtr); /* 469 */
Tcl_Obj * (*tcl_FSFileSystemInfo) (Tcl_Obj *pathPtr); /* 470 */
Tcl_Obj * (*tcl_FSPathSeparator) (Tcl_Obj *pathPtr); /* 471 */
Tcl_Obj * (*tcl_FSListVolumes) (void); /* 472 */
@@ -4368,6 +4373,7 @@ typedef struct TclStubs {
int (*tcl_LoadFile) (Tcl_Interp *interp, Tcl_Obj *pathPtr, const char *const symv[], int flags, void *procPtrs, Tcl_LoadHandle *handlePtr); /* 627 */
void* (*tcl_FindSymbol) (Tcl_Interp *interp, Tcl_LoadHandle handle, const char *symbol); /* 628 */
int (*tcl_FSUnloadFile) (Tcl_Interp *interp, Tcl_LoadHandle handlePtr); /* 629 */
+ const void * (*tcl_FSGetNativePath) (Tcl_Obj *pathPtr); /* 630 */
} TclStubs;
#if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS)
@@ -6274,9 +6280,9 @@ extern const TclStubs *tclStubsPtr;
#define Tcl_FSNewNativePath \
(tclStubsPtr->tcl_FSNewNativePath) /* 468 */
#endif
-#ifndef Tcl_FSGetNativePath
-#define Tcl_FSGetNativePath \
- (tclStubsPtr->tcl_FSGetNativePath) /* 469 */
+#ifndef TclFSGetNativePath
+#define TclFSGetNativePath \
+ (tclStubsPtr->tclFSGetNativePath) /* 469 */
#endif
#ifndef Tcl_FSFileSystemInfo
#define Tcl_FSFileSystemInfo \
@@ -6918,6 +6924,10 @@ extern const TclStubs *tclStubsPtr;
#define Tcl_FSUnloadFile \
(tclStubsPtr->tcl_FSUnloadFile) /* 629 */
#endif
+#ifndef Tcl_FSGetNativePath
+#define Tcl_FSGetNativePath \
+ (tclStubsPtr->tcl_FSGetNativePath) /* 630 */
+#endif
#endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index eb2eb92..234e973 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.176 2010/04/27 08:20:00 nijtmans Exp $
+ * RCS: @(#) $Id: tclIOUtil.c,v 1.177 2010/08/14 17:13:02 nijtmans Exp $
*/
#include "tclInt.h"
@@ -4564,7 +4564,7 @@ Tcl_FSGetFileSystemForPath(
*---------------------------------------------------------------------------
*/
-const char *
+const void *
Tcl_FSGetNativePath(
Tcl_Obj *pathPtr)
{
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 19bde2f..3d30581 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -15,7 +15,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.478 2010/06/16 14:49:50 nijtmans Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.479 2010/08/14 17:13:02 nijtmans Exp $
*/
#ifndef _TCLINT
@@ -2991,7 +2991,7 @@ MODULE_SCOPE Tcl_Obj * TclpTempFileName(void);
MODULE_SCOPE Tcl_Obj * TclpTempFileNameForLibrary(Tcl_Interp *interp, Tcl_Obj* pathPtr);
MODULE_SCOPE Tcl_Obj * TclNewFSPathObj(Tcl_Obj *dirPtr, const char *addStrRep,
int len);
-MODULE_SCOPE int TclpDeleteFile(const char *path);
+MODULE_SCOPE int TclpDeleteFile(const void *path);
MODULE_SCOPE void TclpFinalizeCondition(Tcl_Condition *condPtr);
MODULE_SCOPE void TclpFinalizeMutex(Tcl_Mutex *mutexPtr);
MODULE_SCOPE void TclpFinalizePipes(void);
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index d687909..ee7472d 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -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: tclStubInit.c,v 1.193 2010/07/02 22:31:50 dgp Exp $
+ * RCS: @(#) $Id: tclStubInit.c,v 1.194 2010/08/14 17:13:02 nijtmans Exp $
*/
#include "tclInt.h"
@@ -41,6 +41,17 @@
#undef Tcl_CreateHashEntry
#undef Tcl_Panic
+/* Only provided in the stub table for backwards
+ * binary compatibility.
+ */
+#define TclFSGetNativePath getnativepath
+static const char *
+getnativepath(
+ Tcl_Obj *pathPtr)
+{
+ return Tcl_FSGetNativePath(pathPtr);
+}
+
/*
* WARNING: The contents of this file is automatically generated by the
* tools/genStubs.tcl script. Any modifications to the function declarations
@@ -963,7 +974,7 @@ const TclStubs tclStubs = {
Tcl_FSGetTranslatedPath, /* 466 */
Tcl_FSEvalFile, /* 467 */
Tcl_FSNewNativePath, /* 468 */
- Tcl_FSGetNativePath, /* 469 */
+ TclFSGetNativePath, /* 469 */
Tcl_FSFileSystemInfo, /* 470 */
Tcl_FSPathSeparator, /* 471 */
Tcl_FSListVolumes, /* 472 */
@@ -1124,6 +1135,7 @@ const TclStubs tclStubs = {
Tcl_LoadFile, /* 627 */
Tcl_FindSymbol, /* 628 */
Tcl_FSUnloadFile, /* 629 */
+ Tcl_FSGetNativePath, /* 630 */
};
/* !END!: Do not edit above this line. */
diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c
index 038354f..3c9b78a 100644
--- a/unix/tclUnixFCmd.c
+++ b/unix/tclUnixFCmd.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixFCmd.c,v 1.77 2010/08/04 19:44:48 hobbs Exp $
+ * RCS: @(#) $Id: tclUnixFCmd.c,v 1.78 2010/08/14 17:13:02 nijtmans Exp $
*
* Portions of this code were derived from NetBSD source code which has the
* following copyright notice:
@@ -632,9 +632,9 @@ TclpObjDeleteFile(
int
TclpDeleteFile(
- const char *path) /* Pathname of file to be removed (native). */
+ const void *path) /* Pathname of file to be removed (native). */
{
- if (unlink(path) != 0) { /* INTL: Native. */
+ if (unlink((const char *)path) != 0) {
return TCL_ERROR;
}
return TCL_OK;
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index 89cb59f..fd5cd5d 100644
--- a/win/tclWinFCmd.c
+++ b/win/tclWinFCmd.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: tclWinFCmd.c,v 1.62 2010/04/22 11:40:32 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinFCmd.c,v 1.63 2010/08/14 17:13:02 nijtmans Exp $
*/
#include "tclWinInt.h"
@@ -766,34 +766,35 @@ TclpObjDeleteFile(
int
TclpDeleteFile(
- const TCHAR *nativePath) /* Pathname of file to be removed (native). */
+ const void *nativePath) /* Pathname of file to be removed (native). */
{
DWORD attr;
+ const TCHAR *path = nativePath;
/*
* The DeleteFile API acts differently under Win95/98 and NT WRT NULL and
* "". Avoid passing these values.
*/
- if (nativePath == NULL || nativePath[0] == '\0') {
+ if (path == NULL || path[0] == '\0') {
Tcl_SetErrno(ENOENT);
return TCL_ERROR;
}
- if (tclWinProcs->deleteFileProc(nativePath) != FALSE) {
+ if (tclWinProcs->deleteFileProc(path) != FALSE) {
return TCL_OK;
}
TclWinConvertError(GetLastError());
if (Tcl_GetErrno() == EACCES) {
- attr = tclWinProcs->getFileAttributesProc(nativePath);
+ attr = tclWinProcs->getFileAttributesProc(path);
if (attr != 0xffffffff) {
if (attr & FILE_ATTRIBUTE_DIRECTORY) {
if (attr & FILE_ATTRIBUTE_REPARSE_POINT) {
/*
* It is a symbolic link - remove it.
*/
- if (TclWinSymLinkDelete(nativePath, 0) == 0) {
+ if (TclWinSymLinkDelete(path, 0) == 0) {
return TCL_OK;
}
}
@@ -807,21 +808,21 @@ TclpDeleteFile(
Tcl_SetErrno(EISDIR);
} else if (attr & FILE_ATTRIBUTE_READONLY) {
- int res = tclWinProcs->setFileAttributesProc(nativePath,
+ int res = tclWinProcs->setFileAttributesProc(path,
attr & ~((DWORD) FILE_ATTRIBUTE_READONLY));
if ((res != 0) &&
- (tclWinProcs->deleteFileProc(nativePath) != FALSE)) {
+ (tclWinProcs->deleteFileProc(path) != FALSE)) {
return TCL_OK;
}
TclWinConvertError(GetLastError());
if (res != 0) {
- tclWinProcs->setFileAttributesProc(nativePath, attr);
+ tclWinProcs->setFileAttributesProc(path, attr);
}
}
}
} else if (Tcl_GetErrno() == ENOENT) {
- attr = tclWinProcs->getFileAttributesProc(nativePath);
+ attr = tclWinProcs->getFileAttributesProc(path);
if (attr != 0xffffffff) {
if (attr & FILE_ATTRIBUTE_DIRECTORY) {
/*