Compare commits

...
Author SHA1 Message Date
dgp 833543d544 merge 8.5 2014-10-17 20:38:25 +00:00
dgp 4de4ab73a2 Revert the Tcl_GetsObj portion of the last commit.
Although it fixed the bug demonstrated by the test io-33.12, it caused new
breakage in [gets] not yet understood.  Test io-33.12 left in place to
prompt further work.
2014-10-17 20:37:45 +00:00
dgp c09e8bc51f [10dc6daa37] [gets] on a non-blocking channel must take care so that 1) At least one call to the channel driver input proc gets made. Failure to do this locks up the channel - catastrophic FAIL. 2) After any driver call reports BLOCKED, don't call again. This is less serious, but FAILs to respect the non-blocking setting. Code corrections and tests included, to restore 8.6.1 compat. 2014-10-17 15:30:21 +00:00
dgp 592ab670f3 [10dc6daa37] [gets] on a non-blocking channel must take care so that
1) At least one call to the channel driver input proc gets made.
       Failure to do this locks up the channel - catastrophic FAIL. 
    2) After any driver call reports BLOCKED, don't call again.
       This is less serious, but FAILs to respect the non-blocking setting.
Code corrections and tests included, to restore 8.5.15 compat.
2014-10-17 15:20:34 +00:00
oehhar c0e8db49d5 fconfigure -peername and -sockname return empty string while async connect running. 2014-10-17 12:52:15 +00:00
oehhar d7604e5728 New tests: 14.16: -peername empty while async connect running, 14.17: -sockname 2014-10-17 12:28:55 +00:00
oehhar 8e5b3b87a5 Merge trunk 2014-10-17 10:00:39 +00:00
dgp ef89704696 Resolve test conflicts over global vars 2014-10-10 20:37:58 +00:00
dgp c132978e4b merge mark 2014-10-10 20:02:40 +00:00
dgp 59f2031ac5 backport those tests that can be 2014-10-10 20:02:00 +00:00
dgp f85490f4e1 [bf7135428c] Restore the Tcl_Write() return value logic. 2014-10-10 19:56:06 +00:00
dgp c2be2a28e0 [bf7135428c] Restore the Tcl_Write() return value logic. 2014-10-10 19:54:19 +00:00
dgp 4977df535f [ed29c4da21] Completed fix for [chan copy] handling [chan blocked]. 2014-10-10 19:44:54 +00:00
ferrieux 182bace1e3 Add Colin's test for coro floor above street level [Bug #3008307] 2014-10-10 19:36:17 +00:00
dgp 1f33c7ae12 Another test so both DoRead and MBRead are covered. 2014-10-10 19:02:37 +00:00
dgp 78c2c1cedf [ed29c4da21] Merge patch from 8.5, still not a complete fix. 2014-10-10 18:28:31 +00:00
dgp 186ecf8003 [ed29c4da21] Don't let BLOCKED state get converted into a channel error. 2014-10-10 18:24:32 +00:00
dgp 56c0b11912 New test io-53.15 for [ed29c4da21]. 2014-10-10 16:13:53 +00:00
dgp 1df1505d69 New test io-53.15 for [ed29c4da21]. 2014-10-10 15:38:15 +00:00
dgp 1a08ae6fb4 [2039178] Remove false claims about TCL_INTERP_DESTROYED flag bit in command traces. 2014-10-09 14:56:27 +00:00
dgp 891a0ade43 [2039178] Remove false claims about TCL_INTERP_DESTROYED flag bit in command traces. 2014-10-09 14:52:48 +00:00
jan.nijtmans 29d06499aa Fix [59a2e78e54d3361c33b8cd6eef55d384d8abecd7|59a2e78e54] : tclWinTime.c does not compile with MSVC14.
Eliminate use of __MINGW32__ macro everywhere, as it is deprecated.
2014-10-08 07:11:53 +00:00
jan.nijtmans ea97de415f Fix [59a2e78e54d3361c33b8cd6eef55d384d8abecd7|59a2e78e54] : tclWinTime.c does not compile with MSVC14.
Eliminate use of __MINGW32__ macro everywhare, as it is deprecated.
2014-10-08 07:02:34 +00:00
dgp b327c90dcc fix [bc1a96407a] 2014-10-03 20:20:12 +00:00
dgp cd1372b52d test cases 2014-10-03 15:47:38 +00:00
dgp 3b4cf982e3 Possible fix for testing. 2014-10-02 21:40:13 +00:00
dgp 7c4da917a7 [bc1a96407a] Partial solution should avoid crash, but may lead to wrong behavior. 2014-10-02 17:43:16 +00:00
dgp e36d384130 [bc5b790099] Improper calculation of new dstLimit value. New test io-12.7. 2014-10-02 14:46:54 +00:00
dgp 5e53c4c296 [bc5b790099] Improper calculation of new dstLimit value. New test io-12.7. 2014-10-02 14:43:10 +00:00
Miguel Sofer 78fcaa3580 Backing out commit [cddbfc3081], fix for bug [82521bfb6734f891dd]
The "optimisation" in that commit assumes that the last byte in the
generated bytecodes is an INST_TRY_CONVERT if it equals 64. This is an
invalid assumption, it could be 64 and not be an instruction.
2014-09-27 21:36:06 +00:00
ferrieux 11db57d058 Applied patch by Andreas Leitgeb so that [string cat]'s compiled bytecode optimally groups args by 255 for INSTR_STR_CONCAT1. 2014-09-27 20:28:47 +00:00
oehhar 822a2b50f7 Implemented tip-427: socket fconfigure option -connecting plus no -peername,-sockname when still connecting. 2014-09-26 12:05:30 +00:00
dgp fc21aee814 comment fix 2014-09-25 18:47:32 +00:00
dkf d06897f3ea Added a script-readable bytecode disassembler in tcl::unsupported. 2014-09-20 12:37:19 +00:00
jan.nijtmans 192fa71096 merge-mark 2014-09-17 10:47:21 +00:00
stwo 76db7c5c04 Better pic flag for OpenBSD. 2014-09-16 15:52:44 +00:00
stwo 85f3786d9c Better pic flag for OpenBSD. 2014-09-16 15:48:48 +00:00
177 changed files with 460 additions and 105 deletions
Regular → Executable
View File
Regular → Executable
View File
Executable → Regular
View File
Executable → Regular
View File
+10 -23
View File
@@ -86,11 +86,14 @@ operation is being performed on the command. The bit
\fBTCL_TRACE_DESTROYED\fR will be set in \fIflags\fR if the trace is about
to be destroyed; this information may be useful to \fIproc\fR so that
it can clean up its own internal data structures (see the section
\fBTCL_TRACE_DESTROYED\fR below for more details). Lastly, the bit
\fBTCL_INTERP_DESTROYED\fR will be set if the entire interpreter is being
destroyed. When this bit is set, \fIproc\fR must be especially
careful in the things it does (see the section \fBTCL_INTERP_DESTROYED\fR
below).
\fBTCL_TRACE_DESTROYED\fR below for more details). Because the
deletion of commands can take place as part of the deletion of the interp
that contains them, \fIproc\fR must be careful about checking what
the passed in \fIinterp\fR value can be called upon to do.
The routine \fBTcl_InterpDeleted\fR is an important tool for this.
When \fBTcl_InterpDeleted\fR returns 1, \fIproc\fR will not be able
to invoke any scripts in \fIinterp\fR. The function of \fIproc\fR
in that circumstance is limited to the cleanup of its own data structures.
.PP
\fBTcl_UntraceCommand\fR may be used to remove a trace. If the
command specified by \fIinterp\fR, \fIcmdName\fR, and \fIflags\fR has
@@ -123,7 +126,8 @@ traces for a given command that have the same \fIproc\fR.
.PP
During rename traces, the command being renamed is visible with both
names simultaneously, and the command still exists during delete
traces (if \fBTCL_INTERP_DESTROYED\fR is not set). However, there is no
traces, unless the interp that contains it is being deleted.
However, there is no
mechanism for signaling that an error occurred in a trace procedure,
so great care should be taken that errors do not get silently lost.
.SH "MULTIPLE TRACES"
@@ -142,22 +146,5 @@ rename the command, the last renaming takes precedence.
In a delete callback to \fIproc\fR, the \fBTCL_TRACE_DESTROYED\fR bit
is set in \fIflags\fR.
.\" Perhaps need some more comments here? - DKF
.SH "TCL_INTERP_DESTROYED"
.PP
When an interpreter is destroyed, unset traces are called for
all of its commands.
The \fBTCL_INTERP_DESTROYED\fR bit will be set in the \fIflags\fR
argument passed to the trace procedures.
Trace procedures must be extremely careful in what they do if
the \fBTCL_INTERP_DESTROYED\fR bit is set.
It is not safe for the procedures to invoke any Tcl procedures
on the interpreter, since its state is partially deleted.
All that trace procedures should do under these circumstances is
to clean up and free their own internal data structures.
.SH BUGS
.PP
Tcl does not do any error checking to prevent trace procedures
from misusing the interpreter during traces with \fBTCL_INTERP_DESTROYED\fR
set.
.SH KEYWORDS
clientData, trace, command
Executable → Regular
View File
+1 -1
View File
@@ -31,7 +31,7 @@
* until Tcl uses config.h properly.
*/
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__BORLANDC__)
#if defined(_MSC_VER) || defined(__MSVCRT__) || defined(__BORLANDC__)
typedef unsigned long caddr_t;
#endif
+5 -4
View File
@@ -301,7 +301,8 @@ TclCompileArraySetCmd(
* a proc, we cannot do a better compile than generic.
*/
if (envPtr->procPtr == NULL && !(isDataEven && len == 0)) {
if ((varTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) ||
(envPtr->procPtr == NULL && !(isDataEven && len == 0))) {
code = TclCompileBasic2ArgCmd(interp, parsePtr, cmdPtr, envPtr);
goto done;
}
@@ -342,8 +343,9 @@ TclCompileArraySetCmd(
* a non-local variable: upvar from a local one! This consumes the
* variable name that was left at stacktop.
*/
localIndex = AnonymousLocal(envPtr);
localIndex = TclFindCompiledLocal(varTokenPtr->start,
varTokenPtr->size, 1, envPtr);
PushStringLiteral(envPtr, "0");
TclEmitInstInt4(INST_REVERSE, 2, envPtr);
TclEmitInstInt4(INST_UPVAR, localIndex, envPtr);
@@ -2401,7 +2403,6 @@ TclCompileForCmd(
SetLineInformation(2);
TclCompileExprWords(interp, testTokenPtr, 1, envPtr);
TclClearNumConversion(envPtr);
jumpDist = CurrentOffset(envPtr) - bodyCodeOffset;
if (jumpDist > 127) {
-2
View File
@@ -281,7 +281,6 @@ TclCompileIfCmd(
SetLineInformation(wordIdx);
Tcl_ResetResult(interp);
TclCompileExprWords(interp, testTokenPtr, 1, envPtr);
TclClearNumConversion(envPtr);
if (jumpFalseFixupArray.next >= jumpFalseFixupArray.end) {
TclExpandJumpFixupArray(&jumpFalseFixupArray);
}
@@ -531,7 +530,6 @@ TclCompileIncrCmd(
} else {
SetLineInformation(2);
CompileTokens(envPtr, incrTokenPtr, interp);
TclClearNumConversion(envPtr);
}
} else { /* No incr amount given so use 1. */
haveImmValue = 1;
+2 -3
View File
@@ -322,8 +322,8 @@ TclCompileStringCatCmd(
CompileWord(envPtr, wordTokenPtr, interp, i);
numArgs ++;
if (numArgs >= 254) { /* 254 to take care of the possible +1 of "folded" above */
TclEmitInstInt1(INST_STR_CONCAT1, 254, envPtr);
numArgs -= 253; /* concat pushes 1 obj, the result */
TclEmitInstInt1(INST_STR_CONCAT1, numArgs, envPtr);
numArgs = 1; /* concat pushes 1 obj, the result */
}
}
wordTokenPtr = TokenAfter(wordTokenPtr);
@@ -3782,7 +3782,6 @@ TclCompileWhileCmd(
}
SetLineInformation(1);
TclCompileExprWords(interp, testTokenPtr, 1, envPtr);
TclClearNumConversion(envPtr);
jumpDist = CurrentOffset(envPtr) - bodyCodeOffset;
if (jumpDist > 127) {
-12
View File
@@ -1413,18 +1413,6 @@ MODULE_SCOPE int TclPushProcCallFrame(ClientData clientData,
} \
} while (0)
/*
* If the expr compiler finished with TRY_CONVERT, macro to remove it when the
* job is done by the following instruction.
*/
#define TclClearNumConversion(envPtr) \
do { \
if (*(envPtr->codeNext - 1) == INST_TRY_CVT_TO_NUMERIC) { \
envPtr->codeNext--; \
} \
} while (0)
/*
* Macros to update a (signed or unsigned) integer starting at a pointer. The
* two variants depend on the number of bytes. The ANSI C "prototypes" for
+35 -10
View File
@@ -3894,7 +3894,10 @@ Tcl_Write(
if (srcLen < 0) {
srcLen = strlen(src);
}
return WriteBytes(chanPtr, src, srcLen);
if (WriteBytes(chanPtr, src, srcLen) < 0) {
return -1;
}
return srcLen;
}
/*
@@ -4798,6 +4801,7 @@ TclGetsObjBinary(
eolChar = (statePtr->inputTranslation == TCL_TRANSLATE_LF) ? '\n' : '\r';
ResetFlag(statePtr, CHANNEL_BLOCKED);
while (1) {
/*
* Subtract the number of bytes that were removed from channel
@@ -6046,12 +6050,11 @@ ReadChars(
/*
* We read more chars than allowed. Reset limits to
* prevent that and try again. Don't forget the extra
* padding of TCL_UTF_MAX - 1 bytes demanded by the
* padding of TCL_UTF_MAX bytes demanded by the
* Tcl_ExternalToUtf() call!
*/
dstLimit = Tcl_UtfAtIndex(dst, charsToRead + 1)
+ TCL_UTF_MAX - 1 - dst;
dstLimit = Tcl_UtfAtIndex(dst, charsToRead) + TCL_UTF_MAX - dst;
statePtr->flags = savedFlags;
statePtr->inputEncodingFlags = savedIEFlags;
statePtr->inputEncodingState = savedState;
@@ -9021,7 +9024,7 @@ MBRead(
}
code = GetInput(inStatePtr->topChanPtr);
if (code == 0) {
if (code == 0 || GotFlag(inStatePtr, CHANNEL_BLOCKED)) {
return TCL_OK;
} else {
MBError(csPtr, TCL_READABLE, code);
@@ -9271,6 +9274,10 @@ CopyData(
csPtr);
}
if (size == 0) {
if (!GotFlag(inStatePtr, CHANNEL_NONBLOCKING)) {
/* We allowed a short read. Keep trying. */
continue;
}
if (bufObj != NULL) {
TclDecrRefCount(bufObj);
bufObj = NULL;
@@ -9503,21 +9510,39 @@ DoRead(
}
/*
* If there is not enough data in the buffers to possibly
* complete the read, then go get more.
* Don't read more data if we have what we need.
*/
if (bufPtr == NULL || BytesLeft(bufPtr) < bytesToRead) {
while (!bufPtr || /* We got no buffer! OR */
(!IsBufferFull(bufPtr) && /* Our buffer has room AND */
(BytesLeft(bufPtr) < bytesToRead) ) ) {
/* Not enough bytes in it
* yet to fill the dst */
int code;
moreData:
if (GetInput(chanPtr)) {
code = GetInput(chanPtr);
bufPtr = statePtr->inQueueHead;
assert (bufPtr != NULL);
if (GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED)) {
/* Further reads cannot do any more */
break;
}
if (code) {
/* Read error */
UpdateInterest(chanPtr);
TclChannelRelease((Tcl_Channel)chanPtr);
return -1;
}
bufPtr = statePtr->inQueueHead;
assert (IsBufferFull(bufPtr));
}
assert (bufPtr != NULL);
bytesRead = BytesLeft(bufPtr);
bytesWritten = bytesToRead;
+1 -1
View File
@@ -1741,7 +1741,7 @@ enum PkgPreferOptions {
* definition there.
* Some macros require knowledge of some fields in the struct in order to
* avoid hitting the TSD unnecessarily. In order to facilitate this, a pointer
* to the relevant fields is kept in the objCache field in struct Interp.
* to the relevant fields is kept in the allocCache field in struct Interp.
*----------------------------------------------------------------
*/
Executable → Regular
View File
+58
View File
@@ -0,0 +1,58 @@
/*
* tclStubLibTbl.c --
*
* Stub object that will be statically linked into extensions that want
* to access Tcl.
*
* Copyright (c) 1998-1999 by Scriptics Corporation.
* Copyright (c) 1998 Paul Duffin.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tclInt.h"
/*
*----------------------------------------------------------------------
*
* TclInitStubTable --
*
* Initialize the stub table, using the structure pointed at
* by the "version" argument.
*
* Results:
* Outputs the value of the "version" argument.
*
* Side effects:
* Sets the stub table pointers.
*
*----------------------------------------------------------------------
*/
MODULE_SCOPE const char *
TclInitStubTable(
const char *version) /* points to the version field of a
TclStubInfoType structure variable. */
{
tclStubsPtr = ((const TclStubInfoType *) version)->stubs;
if (tclStubsPtr->hooks) {
tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs;
tclIntStubsPtr = tclStubsPtr->hooks->tclIntStubs;
tclIntPlatStubsPtr = tclStubsPtr->hooks->tclIntPlatStubs;
} else {
tclPlatStubsPtr = NULL;
tclIntStubsPtr = NULL;
tclIntPlatStubsPtr = NULL;
}
return version;
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* End:
*/
+3
View File
@@ -2511,6 +2511,9 @@ TclObjCallVarTraces(
if (!part1Ptr) {
part1Ptr = localName(iPtr->varFramePtr, index);
}
if (!part1Ptr) {
Tcl_Panic("Cannot trace a variable with no name");
}
part1 = TclGetString(part1Ptr);
part2 = part2Ptr? TclGetString(part2Ptr) : NULL;
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File

Some files were not shown because too many files have changed in this diff Show More