Import Tcl 8.6.11

This commit is contained in:
Steve Dower
2021-03-30 00:51:39 +01:00
parent 3bb8e3e086
commit 1aadb2455c
923 changed files with 79104 additions and 62616 deletions

View File

@@ -76,6 +76,8 @@ static void FileChannelExitHandler(ClientData clientData);
static void FileCheckProc(ClientData clientData, int flags);
static int FileCloseProc(ClientData instanceData,
Tcl_Interp *interp);
static int FileClose2Proc(ClientData instanceData,
Tcl_Interp *interp, int flags);
static int FileEventProc(Tcl_Event *evPtr, int flags);
static int FileGetHandleProc(ClientData instanceData,
int direction, ClientData *handlePtr);
@@ -111,7 +113,7 @@ static const Tcl_ChannelType fileChannelType = {
NULL, /* Get option proc. */
FileWatchProc, /* Set up the notifier to watch the channel. */
FileGetHandleProc, /* Get an OS handle from channel. */
NULL, /* close2proc. */
FileClose2Proc, /* close2proc. */
FileBlockProc, /* Set blocking or non-blocking mode.*/
NULL, /* flush proc. */
NULL, /* handler proc. */
@@ -360,7 +362,7 @@ FileBlockProc(
/*
*----------------------------------------------------------------------
*
* FileCloseProc --
* FileCloseProc/FileClose2Proc --
*
* Closes the IO channel.
*
@@ -427,6 +429,18 @@ FileCloseProc(
ckfree(fileInfoPtr);
return errorCode;
}
static int
FileClose2Proc(
ClientData instanceData, /* Pointer to FileInfo structure. */
Tcl_Interp *interp, /* Not used. */
int flags)
{
if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) == 0) {
return FileCloseProc(instanceData, interp);
}
return EINVAL;
}
/*
*----------------------------------------------------------------------
@@ -954,7 +968,7 @@ TclpOpenFileChannel(
if (handle == INVALID_HANDLE_VALUE) {
DWORD err = GetLastError();
if ((err & 0xffffL) == ERROR_OPEN_FAILED) {
if ((err & 0xFFFFL) == ERROR_OPEN_FAILED) {
err = (mode & O_CREAT) ? ERROR_FILE_EXISTS : ERROR_FILE_NOT_FOUND;
}
TclWinConvertError(err);
@@ -1052,7 +1066,7 @@ Tcl_MakeFileChannel(
int mode) /* ORed combination of TCL_READABLE and
* TCL_WRITABLE to indicate file mode. */
{
#if defined(HAVE_NO_SEH) && !defined(_WIN64)
#if defined(HAVE_NO_SEH) && !defined(_WIN64) && !defined(__clang__)
TCLEXCEPTION_REGISTRATION registration;
#endif
char channelName[16 + TCL_INTEGER_SPACE];
@@ -1105,7 +1119,7 @@ Tcl_MakeFileChannel(
if (result == 0) {
/*
* Unable to make a duplicate. It's definately invalid at this
* Unable to make a duplicate. It's definitely invalid at this
* point.
*/
@@ -1118,7 +1132,7 @@ Tcl_MakeFileChannel(
*/
result = 0;
#if defined(HAVE_NO_SEH) && !defined(_WIN64)
#if defined(HAVE_NO_SEH) && !defined(_WIN64) && !defined(__clang__)
/*
* Don't have SEH available, do things the hard way. Note that this
* needs to be one block of asm, to avoid stack imbalance; also, it is
@@ -1144,7 +1158,7 @@ Tcl_MakeFileChannel(
"leal 1f, %%eax" "\n\t"
"movl %%eax, 0x4(%%edx)" "\n\t" /* handler */
"movl %%ebp, 0x8(%%edx)" "\n\t" /* ebp */
"movl %%esp, 0xc(%%edx)" "\n\t" /* esp */
"movl %%esp, 0xC(%%edx)" "\n\t" /* esp */
"movl $0, 0x10(%%edx)" "\n\t" /* status */
/*
@@ -1184,7 +1198,7 @@ Tcl_MakeFileChannel(
*/
"2:" "\t"
"movl 0xc(%%edx), %%esp" "\n\t"
"movl 0xC(%%edx), %%esp" "\n\t"
"movl 0x8(%%edx), %%ebp" "\n\t"
"movl 0x0(%%edx), %%eax" "\n\t"
"movl %%eax, %%fs:0" "\n\t"
@@ -1363,7 +1377,7 @@ TclWinOpenFileChannel(
infoPtr->flags = appendMode;
infoPtr->handle = handle;
infoPtr->dirty = 0;
sprintf(channelName, "file%" TCL_I_MODIFIER "x", (size_t) infoPtr);
sprintf(channelName, "file%" TCL_Z_MODIFIER "x", (size_t) infoPtr);
infoPtr->channel = Tcl_CreateChannel(&fileChannelType, channelName,
infoPtr, permissions);