summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml75
-rw-r--r--doc/Class.318
-rw-r--r--generic/tclCmdAH.c18
-rw-r--r--generic/tclIOUtil.c10
-rw-r--r--generic/tclPlatDecls.h2
-rw-r--r--generic/tclStubInit.c4
-rw-r--r--generic/tclUtf.c2
-rw-r--r--unix/tclUnixFCmd.c4
-rw-r--r--win/tclWin32Dll.c2
9 files changed, 88 insertions, 47 deletions
diff --git a/.travis.yml b/.travis.yml
index 59b52eb..92296c1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,29 +3,34 @@ language: c
matrix:
include:
- - os: linux
+ - name: "Linux/Clang/Shared"
+ os: linux
dist: xenial
compiler: clang
env:
- BUILD_DIR=unix
- - os: linux
+ - name: "Linux/Clang/Static"
+ os: linux
dist: xenial
compiler: clang
env:
- CFGOPT=--disable-shared
- BUILD_DIR=unix
- - os: linux
+ - name: "Linux/GCC/Shared"
+ os: linux
dist: xenial
compiler: gcc
env:
- BUILD_DIR=unix
- - os: linux
+ - name: "Linux/GCC/Static"
+ os: linux
dist: xenial
compiler: gcc
env:
- CFGOPT=--disable-shared
- BUILD_DIR=unix
- - os: linux
+ - name: "Linux/GCC 4.9/Shared"
+ os: linux
dist: xenial
compiler: gcc-4.9
addons:
@@ -36,7 +41,8 @@ matrix:
- g++-4.9
env:
- BUILD_DIR=unix
- - os: linux
+ - name: "Linux/GCC 5/Shared"
+ os: linux
dist: xenial
compiler: gcc-5
addons:
@@ -47,7 +53,8 @@ matrix:
- g++-5
env:
- BUILD_DIR=unix
- - os: linux
+ - name: "Linux/GCC 6/Shared"
+ os: linux
dist: xenial
compiler: gcc-6
addons:
@@ -58,7 +65,8 @@ matrix:
- g++-6
env:
- BUILD_DIR=unix
- - os: linux
+ - name: "Linux/GCC 7/Shared"
+ os: linux
dist: xenial
compiler: gcc-7
addons:
@@ -69,7 +77,8 @@ matrix:
- g++-7
env:
- BUILD_DIR=unix
- - os: linux
+ - name: "Linux/GCC 7/Shared/UTF_MAX=6"
+ os: linux
dist: xenial
compiler: gcc-7
addons:
@@ -81,7 +90,8 @@ matrix:
env:
- BUILD_DIR=unix
- CFGOPT=CFLAGS=-DTCL_UTF_MAX=6
- - os: linux
+ - name: "Linux/GCC 7/Shared/UTF_MAX=3"
+ os: linux
dist: xenial
compiler: gcc-7
addons:
@@ -93,7 +103,8 @@ matrix:
env:
- BUILD_DIR=unix
- CFGOPT=CFLAGS=-DTCL_UTF_MAX=3
- - os: linux
+ - name: "Linux/GCC 7/Shared/NO_DEPRECATED"
+ os: linux
dist: xenial
compiler: gcc-7
addons:
@@ -105,21 +116,25 @@ matrix:
env:
- BUILD_DIR=unix
- CFGOPT=CFLAGS=-DTCL_NO_DEPRECATED=1
- - os: osx
+ - name: "macOS/Xcode 8/Shared/Unix-like"
+ os: osx
osx_image: xcode8
env:
- BUILD_DIR=unix
- - os: osx
+ - name: "macOS/Xcode 8/Shared/Mac-like"
+ os: osx
osx_image: xcode8
env:
- BUILD_DIR=macosx
- NO_DIRECT_CONFIGURE=1
- - os: osx
+ - name: "macOS/Xcode 9/Shared/Mac-like"
+ os: osx
osx_image: xcode9
env:
- BUILD_DIR=macosx
- NO_DIRECT_CONFIGURE=1
- - os: osx
+ - name: "macOS/Xcode 10/Shared/Mac-like"
+ os: osx
osx_image: xcode10.2
env:
- BUILD_DIR=macosx
@@ -130,7 +145,8 @@ matrix:
# - BUILD_DIR=win
### ... so proxy with a Mingw cross-compile
# Test with mingw-w64 (32 bit)
- - os: linux
+ - name: "Linux-cross-Windows-32/GCC/Shared/no test"
+ os: linux
dist: xenial
compiler: i686-w64-mingw32-gcc
addons:
@@ -146,7 +162,8 @@ matrix:
- BUILD_DIR=win
- CFGOPT=--host=i686-w64-mingw32
- NO_DIRECT_TEST=1
- - os: linux
+ - name: "Linux-cross-Windows-32/GCC/Static/no test"
+ os: linux
dist: xenial
compiler: i686-w64-mingw32-gcc
addons:
@@ -162,7 +179,8 @@ matrix:
- BUILD_DIR=win
- CFGOPT="--host=i686-w64-mingw32 --disable-shared"
- NO_DIRECT_TEST=1
- - os: linux
+ - name: "Linux-cross-Windows-32/GCC/Shared/no test/UTF_MAX=6"
+ os: linux
dist: xenial
compiler: i686-w64-mingw32-gcc
addons:
@@ -178,7 +196,8 @@ matrix:
- BUILD_DIR=win
- CFGOPT="--host=i686-w64-mingw32 CFLAGS=-DTCL_UTF_MAX=6"
- NO_DIRECT_TEST=1
- - os: linux
+ - name: "Linux-cross-Windows-32/GCC/Shared/no test/UTF_MAX=3"
+ os: linux
dist: xenial
compiler: i686-w64-mingw32-gcc
addons:
@@ -194,7 +213,8 @@ matrix:
- BUILD_DIR=win
- CFGOPT="--host=i686-w64-mingw32 CFLAGS=-DTCL_UTF_MAX=3"
- NO_DIRECT_TEST=1
- - os: linux
+ - name: "Linux-cross-Windows-32/GCC/Shared/no test/NO_DEPRECATED"
+ os: linux
dist: xenial
compiler: i686-w64-mingw32-gcc
addons:
@@ -211,7 +231,8 @@ matrix:
- CFGOPT="--host=i686-w64-mingw32 CFLAGS=-DTCL_NO_DEPRECATED=1"
- NO_DIRECT_TEST=1
# Test with mingw-w64 (64 bit)
- - os: linux
+ - name: "Linux-cross-Windows-64/GCC/Shared/no test"
+ os: linux
dist: xenial
compiler: x86_64-w64-mingw32-gcc
addons:
@@ -226,7 +247,8 @@ matrix:
- BUILD_DIR=win
- CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit"
- NO_DIRECT_TEST=1
- - os: linux
+ - name: "Linux-cross-Windows-64/GCC/Static/no test"
+ os: linux
dist: xenial
compiler: x86_64-w64-mingw32-gcc
addons:
@@ -241,7 +263,8 @@ matrix:
- BUILD_DIR=win
- CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit --disable-shared"
- NO_DIRECT_TEST=1
- - os: linux
+ - name: "Linux-cross-Windows-64/GCC/Shared/no test/UTF_MAX=6"
+ os: linux
dist: xenial
compiler: x86_64-w64-mingw32-gcc
addons:
@@ -256,7 +279,8 @@ matrix:
- BUILD_DIR=win
- CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit CFLAGS=-DTCL_UTF_MAX=6"
- NO_DIRECT_TEST=1
- - os: linux
+ - name: "Linux-cross-Windows-64/GCC/Shared/no test/UTF_MAX=3"
+ os: linux
dist: xenial
compiler: x86_64-w64-mingw32-gcc
addons:
@@ -271,7 +295,8 @@ matrix:
- BUILD_DIR=win
- CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit CFLAGS=-DTCL_UTF_MAX=3"
- NO_DIRECT_TEST=1
- - os: linux
+ - name: "Linux-cross-Windows-64/GCC/Shared/no test/NO_DEPRECATED"
+ os: linux
dist: xenial
compiler: x86_64-w64-mingw32-gcc
addons:
diff --git a/doc/Class.3 b/doc/Class.3
index 1c3fe08..57203d5 100644
--- a/doc/Class.3
+++ b/doc/Class.3
@@ -79,7 +79,9 @@ The number of elements in the \fIobjv\fR array.
The arguments to the command to create the instance of the class.
.AP int skip in
The number of arguments at the start of the argument array, \fIobjv\fR, that
-are not arguments to any constructors.
+are not arguments to any constructors. This allows the generation of correct
+error messages even when complicated calling patterns are used (e.g., via the
+\fBnext\fR command).
.AP Tcl_ObjectMetadataType *metaTypePtr in
The type of \fImetadata\fR being set with \fBTcl_ClassSetMetadata\fR or
retrieved with \fBTcl_ClassGetMetadata\fR.
@@ -109,7 +111,9 @@ may be retrieved using the \fBTcl_GetObjectCommand\fR function, the name of
the object (and hence the name of the command) with \fBTcl_GetObjectName\fR,
and the namespace may be retrieved using the \fBTcl_GetObjectNamespace\fR
function. Note that the Tcl_Obj reference returned by \fBTcl_GetObjectName\fR
-is a shared reference.
+is a shared reference. You can also get whether the object has been marked for
+deletion with \fBTcl_ObjectDeleted\fR (it returns true if deletion of the
+object has begun); this can be useful during the processing of methods.
.PP
Instances of classes are created using \fBTcl_NewObjectInstance\fR, which
creates an object from any class (and which is internally called by both
@@ -121,6 +125,16 @@ created object, or NULL if the creation failed (when an error message will be
left in the interpreter result). In addition, objects may be copied by using
\fBTcl_CopyObjectInstance\fR which creates a copy of an object without running
any constructors.
+.PP
+Note that the lifetime management of objects is handled internally within
+TclOO, and does not use \fBTcl_Preserve\fR. \fIIt is not safe to put a
+Tcl_Object handle in a C structure with a lifespan different to the object;\fR
+you should use the object's command name (as retrieved with
+\fBTcl_GetObjectName\fR) instead. It is safe to use a Tcl_Object handle for
+the lifespan of a call of a method on that object; handles do not become
+invalid while there is an outstanding call on their object (even if the only
+operation guaranteed to be safe on them is \fBTcl_ObjectDeleted\fR; the other
+operations are only guaranteed to work on non-deleted objects).
.SH "OBJECT AND CLASS METADATA"
.PP
Every object and every class may have arbitrary amounts of metadata attached
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index dd98ef3..dff23a8 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -1139,7 +1139,7 @@ FileAttrAccessTimeCmd(
}
#if defined(_WIN32)
/* We use a value of 0 to indicate the access time not available */
- if (buf.st_atime == 0) {
+ if (Tcl_GetAccessTimeFromStat(&buf) == 0) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"could not get access time for file \"%s\"",
TclGetString(objv[1])));
@@ -1160,7 +1160,7 @@ FileAttrAccessTimeCmd(
}
tval.actime = newTime;
- tval.modtime = buf.st_mtime;
+ tval.modtime = Tcl_GetModificationTimeFromStat(&buf);
if (Tcl_FSUtime(objv[1], &tval) != 0) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -1180,7 +1180,7 @@ FileAttrAccessTimeCmd(
}
}
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj((long) buf.st_atime));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tcl_GetAccessTimeFromStat(&buf)));
return TCL_OK;
}
@@ -1221,7 +1221,7 @@ FileAttrModifyTimeCmd(
}
#if defined(_WIN32)
/* We use a value of 0 to indicate the modification time not available */
- if (buf.st_mtime == 0) {
+ if (Tcl_GetModificationTimeFromStat(&buf) == 0) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"could not get modification time for file \"%s\"",
TclGetString(objv[1])));
@@ -1240,7 +1240,7 @@ FileAttrModifyTimeCmd(
return TCL_ERROR;
}
- tval.actime = buf.st_atime;
+ tval.actime = Tcl_GetAccessTimeFromStat(&buf);
tval.modtime = newTime;
if (Tcl_FSUtime(objv[1], &tval) != 0) {
@@ -1260,7 +1260,7 @@ FileAttrModifyTimeCmd(
}
}
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj((long) buf.st_mtime));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tcl_GetModificationTimeFromStat(&buf)));
return TCL_OK;
}
@@ -2291,9 +2291,9 @@ StoreStatData(
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
STORE_ARY("blksize", Tcl_NewWideIntObj((long)statPtr->st_blksize));
#endif
- STORE_ARY("atime", Tcl_NewWideIntObj((long)statPtr->st_atime));
- STORE_ARY("mtime", Tcl_NewWideIntObj((long)statPtr->st_mtime));
- STORE_ARY("ctime", Tcl_NewWideIntObj((long)statPtr->st_ctime));
+ STORE_ARY("atime", Tcl_NewWideIntObj(Tcl_GetAccessTimeFromStat(statPtr)));
+ STORE_ARY("mtime", Tcl_NewWideIntObj(Tcl_GetModificationTimeFromStat(statPtr)));
+ STORE_ARY("ctime", Tcl_NewWideIntObj(Tcl_GetChangeTimeFromStat(statPtr)));
mode = (unsigned short) statPtr->st_mode;
STORE_ARY("mode", Tcl_NewWideIntObj(mode));
STORE_ARY("type", Tcl_NewStringObj(GetTypeFromMode(mode), -1));
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index 4b3eaa5..80cd8db 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -327,9 +327,9 @@ Tcl_Stat(
oldStyleBuf->st_uid = buf.st_uid;
oldStyleBuf->st_gid = buf.st_gid;
oldStyleBuf->st_size = (off_t) buf.st_size;
- oldStyleBuf->st_atime = buf.st_atime;
- oldStyleBuf->st_mtime = buf.st_mtime;
- oldStyleBuf->st_ctime = buf.st_ctime;
+ oldStyleBuf->st_atime = Tcl_GetAccessTimeFromStat(&buf);
+ oldStyleBuf->st_mtime = Tcl_GetModificationTimeFromStat(&buf);
+ oldStyleBuf->st_ctime = Tcl_GetChangeTimeFromStat(&buf);
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
oldStyleBuf->st_blksize = buf.st_blksize;
#endif
@@ -4422,8 +4422,8 @@ TclCrossFilesystemCopy(
*/
if (Tcl_FSLstat(source, &sourceStatBuf) == 0) {
- tval.actime = sourceStatBuf.st_atime;
- tval.modtime = sourceStatBuf.st_mtime;
+ tval.actime = Tcl_GetAccessTimeFromStat(&sourceStatBuf);
+ tval.modtime = Tcl_GetModificationTimeFromStat(&sourceStatBuf);
Tcl_FSUtime(target, &tval);
}
diff --git a/generic/tclPlatDecls.h b/generic/tclPlatDecls.h
index 0a8aff8..42478ac 100644
--- a/generic/tclPlatDecls.h
+++ b/generic/tclPlatDecls.h
@@ -118,7 +118,7 @@ extern const TclPlatStubs *tclPlatStubsPtr;
#define TCL_STORAGE_CLASS DLLIMPORT
#if defined(USE_TCL_STUBS) && (defined(_WIN32) || defined(__CYGWIN__))\
- && ((TCL_UTF_MAX > 4) || defined(TCL_NO_DEPRECATED))
+ && (defined(TCL_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8)
#undef Tcl_WinUtfToTChar
#undef Tcl_WinTCharToUtf
#ifdef _WIN32
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 7c9741a..8da0123 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -248,7 +248,7 @@ TclpGetPid(Tcl_Pid pid)
return (int) (size_t) pid;
}
-#if (TCL_UTF_MAX <= 4) && !defined(TCL_NO_DEPRECATED)
+#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
#undef Tcl_WinUtfToTChar
char *
Tcl_WinUtfToTChar(
@@ -480,7 +480,7 @@ tellOld(
}
#endif /* !TCL_NO_DEPRECATED */
-#if (TCL_UTF_MAX > 4) || defined(TCL_NO_DEPRECATED)
+#if defined(TCL_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8
#define Tcl_WinUtfToTChar 0
#define Tcl_WinTCharToUtf 0
#endif
diff --git a/generic/tclUtf.c b/generic/tclUtf.c
index 395f4ed..962a3e2 100644
--- a/generic/tclUtf.c
+++ b/generic/tclUtf.c
@@ -260,6 +260,7 @@ Tcl_UniCharToUtfDString(
return string;
}
+#undef Tcl_WCharToUtfDString
char *
Tcl_WCharToUtfDString(
const unsigned short *uniStr, /* Utf-16 string to convert to UTF-8. */
@@ -608,6 +609,7 @@ Tcl_UtfToUniCharDString(
return wString;
}
+#undef Tcl_UtfToWCharDString
unsigned short *
Tcl_UtfToWCharDString(
const char *src, /* UTF-8 string to convert to Unicode. */
diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c
index 3e1a5c2..b214627 100644
--- a/unix/tclUnixFCmd.c
+++ b/unix/tclUnixFCmd.c
@@ -1315,8 +1315,8 @@ CopyFileAtts(
}
}
- tval.actime = statBufPtr->st_atime;
- tval.modtime = statBufPtr->st_mtime;
+ tval.actime = Tcl_GetAccessTimeFromStat(statBufPtr);
+ tval.modtime = Tcl_GetModificationTimeFromStat(statBufPtr);
if (utime(dst, &tval)) { /* INTL: Native. */
return TCL_ERROR;
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index 6e52bd6..e04b281 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.c
@@ -463,7 +463,7 @@ TclWinDriveLetterForVolMountPoint(
*---------------------------------------------------------------------------
*/
-#if (TCL_UTF_MAX <= 4) && !defined(TCL_NO_DEPRECATED)
+#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
#undef Tcl_WinUtfToTChar
WCHAR *
Tcl_WinUtfToTChar(