Compare commits

...
87 Commits
Author SHA1 Message Date
jan.nijtmans 749efa7f84 Merge-mark (for triggering another Travis build) 2020-08-21 14:22:37 +00:00
dgp 1971f6ab14 merge mark 2020-08-21 14:00:53 +00:00
dgp 591c90cd3e Suppress tests that fail starting with OSX Mojave. 2020-08-21 13:59:13 +00:00
jan.nijtmans 40b259956c Merge 8.6 2020-08-19 15:37:08 +00:00
culler 6560454489 And remove the other $ and do the test slightly differently. Inability to test locally is a challenge. 2020-08-17 16:28:28 +00:00
culler 270c9b99d6 Add the missing $. 2020-08-17 16:21:05 +00:00
culler e1968256d8 Try to make io-50.6 more robust on the Travis macOS VM 2020-08-17 15:53:04 +00:00
jan.nijtmans 840355939d Testcase event-1.1 (still) fails occasionally on macOS 2020-08-13 07:21:34 +00:00
jan.nijtmans 52549ae747 Fix [e87000d8425ab86a]: crash for "fconfigure stdout" in Win32.
Even though the crash cannot happen in Tcl 8.6, the function Tcl_BadChannelOption() was to blame, so better fix that in 8.6 too.
2020-08-12 10:25:49 +00:00
jan.nijtmans 330e4967ab Fix value of CMD_DEAD flag 2020-08-12 07:10:57 +00:00
jan.nijtmans 39db46fbe1 Merge 8.5 2020-08-12 06:38:22 +00:00
jan.nijtmans 998409ea9b Update .travis.yml: remove deprecated "sudo" and rename "matrix" to "jobs"
Fix travis build for Windows/Debug
2020-08-12 06:36:31 +00:00
jan.nijtmans c07c2bb91c Revert unintended ckalloc -> Tcl_Alloc change from previous commit 2020-08-11 13:15:37 +00:00
jan.nijtmans 30710a3cbd Code cleanup: less of use "register" keyword, and better use of typecasts 2020-08-11 12:44:21 +00:00
jan.nijtmans d73c6dbd81 Eliminate many unnecessary type-casts, mostly (size_t) when value is already size_t or int 2020-08-11 05:39:08 +00:00
pooryorick 36d06e1e0b Fix mistake in [7eed2baf73] 2020-08-10 19:33:18 +00:00
pooryorick e29e808f57 Fix for [29e8848eb976], imported alias in a deletion trace. 2020-08-10 18:05:10 +00:00
sebres 6c0be70d2b amend to [8054e19451]: clean up timeout timer event (avoid timing issues on further tests) 2020-08-10 16:54:46 +00:00
sebres 9d14ed87d0 merge point (no functional changes, 8.6 already has proper implementation of TclCreateSocketAddress) 2020-08-10 16:25:14 +00:00
sebres f397a9ac9d create server socket with AI_PASSIVE flag (used for bind) 2020-08-10 16:16:46 +00:00
sebres 3cd49200d7 windows: replace gethostbyname with getaddrinfo (gethostbyname can hang sporadically, closes [7cf7cce423]);
corresponding to MS (https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-gethostbyname):
Developers creating Windows Sockets 2 applications are urged to use the getaddrinfo function instead of gethostbyname
2020-08-10 16:16:36 +00:00
jan.nijtmans fd3f2b486c Remove use of (always enabled) "openpipe" constraint.
Add "testservicemode" constraint.
Change a single "chan close" into a "close" in a test-case
2020-08-10 14:57:19 +00:00
culler 4f513496d8 Fix [f586089a2b]: removing the call to Tcl_ServiceAll from Tcl_WaitForEvent on macOS exposed race conditions in some io, chanio and event tests. 2020-08-10 12:49:19 +00:00
culler 823d13656d More places where vwait needs to be used instead of update. 2020-08-10 01:27:37 +00:00
culler 5ed72038da use vwait in chanio tests too. 2020-08-09 14:33:43 +00:00
culler 1cadacd498 One more vwait. 2020-08-08 21:37:18 +00:00
culler 4b765a3aff Add and use testservicemode command; replace update by vwait 2020-08-08 21:27:06 +00:00
culler bb9b5e7606 Fix the expected result for chanio-50.6 2020-08-07 13:15:31 +00:00
culler f460900f9f Experiment with io-50.1 on Travis 2020-08-07 13:12:21 +00:00
culler 9557127009 Experiment with chan-io-50.6 on Travis 2020-08-06 13:09:22 +00:00
jan.nijtmans a2db4b22d0 Merge 8.6 2020-08-03 22:45:03 +00:00
jan.nijtmans 35d0992797 doc fix 2020-08-03 22:42:50 +00:00
jan.nijtmans 0f06b1b667 Merge 8.6 2020-08-03 15:46:27 +00:00
jan.nijtmans d40f0fe1b3 Merge 8.6 2020-08-03 15:43:45 +00:00
jan.nijtmans ca51d20173 Testcase cleanup: transform *io-50.* testcases to new test syntax 2020-08-03 15:23:42 +00:00
jan.nijtmans c1c4367262 Merge 8.6 2020-07-26 17:00:51 +00:00
jan.nijtmans 493182df76 Fix [cb0373bb33]: The http::geturl -keepalive option does not work as described in the man page. 2020-07-26 16:21:36 +00:00
jan.nijtmans 34aa927a14 Merge 8.6 2020-07-25 16:13:03 +00:00
jan.nijtmans e14cd07627 Fix [20dccf1200]: htons-related test fails on Mac OSX Catalina (10.15)
Also, let http-related tests check if really http 2.9 is present
2020-07-25 15:56:10 +00:00
kjnash 7c4cabaaae Fix for bug cb0373bb33. In HTTP/1.1 the response header "Connection", if absent, must default to "keep-alive". Add test http11-1.13 and bump version to 2.9.3. 2020-07-24 20:32:20 +00:00
kjnash c92e694158 Create new branch named "bug-cb0373bb33-for-8-6" 2020-07-24 18:46:38 +00:00
culler 0d231a3919 Check if reverting from os_unfair_lock to OSSpinLock has any effect. 2020-07-23 13:32:03 +00:00
jan.nijtmans 7fba80338f Convert test-cases to do proper setup/cleanup 2020-07-22 15:28:39 +00:00
jan.nijtmans 55bf49d15f Re-enable event-1.1, io-50.? and chan-io-50.? test-cases, trying to get a hand at the problem [f586089a2b] 2020-07-21 13:22:08 +00:00
jan.nijtmans 5016da417f Merge 8.6 2020-07-21 13:00:27 +00:00
jan.nijtmans f472165a3d Mark chan-io-50.? and event-1.1 as nonPortable (for now): Those sometimes fail in the Travis environment, but in practice this doesn't seem to be a real problem. 2020-07-21 12:26:05 +00:00
jan.nijtmans cab7f268d6 Merge 8.6 2020-07-21 08:19:59 +00:00
jan.nijtmans 99d517e3cb Use "Global" in stead of "Master" internally, where "Master" is not used in the Master-Slave paradigm and where this makes sense. 2020-07-20 14:25:11 +00:00
jan.nijtmans a03c2cb1c2 Merge 8.6 2020-07-20 09:02:03 +00:00
jan.nijtmans bbe2ea1d0e Merge 8.5.
Mark testcases io-50.* nonPortable: they fail too often in travis builds.
2020-07-20 08:24:16 +00:00
jan.nijtmans a15ea81906 Backport changes in tcltest package from higher Tcl versions.
Rename (internal, undocumented) tcltest::loadIntoSlaveInterpreter into tcltest::loadIntoChildInterpreter
tcltest 2.5.1 -> 2.5.3
2020-07-20 07:33:42 +00:00
culler 4bca76be3b macOS: Remove Tcl_ServiceAll from Tcl_WaitForEvent and use os_unfair_lock if it is available. 2020-07-18 16:02:55 +00:00
jan.nijtmans 56e784cb1b Doc/internal variable tweaks 2020-07-17 11:11:47 +00:00
jan.nijtmans 9598926f42 New TIP #581 implementation 2020-07-17 10:42:29 +00:00
sebres 3cb9dde39e merge 8.5 2020-07-16 15:36:08 +00:00
sebres 565b9dca95 cherry pick [df5f1e8652]: Fix [5bbd044812]: Fix index underflow. 2020-07-16 15:34:57 +00:00
jan.nijtmans 8bd505ac83 Fix [5bbd044812]: Fix index underflow. 2020-07-16 13:42:57 +00:00
jan.nijtmans 409c164695 Merge 8.6 2020-07-16 08:35:24 +00:00
sebres 439f72dad5 closes [3c6e47363e]: missing de-duplication mechanism for nested TEBC starting from scratch (e. g. nested compiled blocks enclosed in parent cycle), so reset interp's result to avoid possible duplications of large objects by first commands like lappend, append, etc 2020-07-15 20:06:07 +00:00
jan.nijtmans 1e3b6b37d1 Rename doc/CrtSlave.3 to doc/CrtAlias.3. Some more doc tweaks. 2020-07-15 09:07:00 +00:00
jan.nijtmans 02b1b013df Merge 8.6 2020-07-14 10:25:52 +00:00
jan.nijtmans 2ef9dcb65f (cherry-pick): Bugfix in library/tm.tcl - in a safe interp ::tcl::tm::UnknownHandler should always use the freshest "package ifneeded" 2020-07-14 10:16:05 +00:00
jan.nijtmans b8bffd00e3 Merge 8.6 2020-07-11 16:06:44 +00:00
jan.nijtmans 2ead563282 Fix 4 test-cases, which fail when running from the western hemisphere 2020-07-11 16:01:28 +00:00
jan.nijtmans ae39d915c8 Fix test-cases clock-34.65 and clock-34.66, they seem to be affected by summertime 2020-07-10 10:32:00 +00:00
jan.nijtmans f556243f24 Fix [5019748c73]: FreeScan resp. Oldscan does not recognize positive time zone offset 2020-07-10 10:03:53 +00:00
jan.nijtmans a25f4ac082 Fix utf-1.13 testcase for TCL_UTF_MAX>3 2020-07-10 08:52:13 +00:00
jan.nijtmans 0fab7463a3 Addendum to [60fab362ce]: "Also don't allow surrogates in \U??????". This change was only meant for builds with TCL_UTF_MAX > 3. 2020-07-10 07:26:55 +00:00
jan.nijtmans f77d355196 Proposed fix for [5019748c73]: FreeScan resp. Oldscan does not recognize positive time zone offset like "31 Jan 14 23:59:59 +0100" 2020-07-09 07:57:32 +00:00
jan.nijtmans 1dfea026b8 Fix [a1bd37b719]: clock (free)scan of ISO 8601 timestamp with literal T behaves strange 2020-07-09 07:21:10 +00:00
jan.nijtmans fd9cd061d5 Merge 8.6 2020-07-08 14:42:25 +00:00
jan.nijtmans 131eb6c30b Make sure that in tclConfig.sh for Windows ${DBGX} is expanded before exporting TCL_(SHARED|UNSHARED|EXPORT)_LIB_SUFFIX there. Otherwise extensions removing ${DBGX} from their implementation (see TIP #578) will break on Windows.
tclConfig.sh should never contain the macro ${DBGX} any more. (On UNIX this was already correct, on Windows it was forgotten)
2020-07-07 12:52:24 +00:00
jan.nijtmans 870670e4d4 In tcl_startOfPreviousWord, don't bother doing a regexp when $start <= 0. 2020-07-03 08:39:53 +00:00
sebres 932835c1eb doc/clock.n: clearer form explaininng format groups on output 2020-06-30 11:59:48 +00:00
jan.nijtmans 22d9a275de A few missing entries in .fossil-settings/ignore-glob and .gitignore 2020-06-29 12:41:08 +00:00
jan.nijtmans 1aeadf38fa Re-generate unix/tclConfig.h.in 2020-06-29 10:21:58 +00:00
jan.nijtmans 2c7d6403e8 MacOSX: add some type-casts, improving C++ compatibility. Make sure that strstr and strtoul() are not configured as invalid: Mac is more strict in exact function signatures. Backported from 8.7 2020-06-28 15:13:31 +00:00
jan.nijtmans 06f1954e8d Merge make-dist branch: Now travis checks regressions in "make dist" too 2020-06-28 14:44:57 +00:00
jan.nijtmans e3bd336bae Merge 8.6 2020-06-23 09:43:18 +00:00
jan.nijtmans 75376fc361 re-generate with bison 3.1 2020-06-23 07:13:15 +00:00
jan.nijtmans 6ed8324a38 Merge 8.6. re-generate tclParse.c 2020-06-23 06:48:22 +00:00
culler a0457efe80 Use the os_unfair_lock in place of OSSpinLock when the minimum build target is newer than OSX 10.12 2020-06-22 16:12:00 +00:00
culler 476d33d6b6 Sometimes the waitTime needs to be positive to avoid missing channel io events. 2020-06-18 20:02:01 +00:00
culler b345d9a593 Code simplification and cleanup 2020-06-07 22:15:28 +00:00
culler ad53d45452 Address macOS hangs in Tcl_WaitForEvent. 2020-06-06 21:23:50 +00:00
jan.nijtmans 2956fdc0e0 clock-iso-2.patch 2020-05-27 21:11:36 +00:00
jan.nijtmans dc1e5ec547 Proposed soution for [a1bd37b719]: clock (free)scan of ISO 8601 timestamp with literal T behaves strange
(I like it!)
2020-05-27 13:58:09 +00:00
81 changed files with 1300 additions and 863 deletions
+1
View File
@@ -1,6 +1,7 @@
*.a
*.dll
*.dylib
*.dylib.E
*.exe
*.exp
*.la
+3
View File
@@ -2,6 +2,7 @@
*.bundle
*.dll
*.dylib
*.dylib.E
*.exe
*.exp
*.lib
@@ -14,6 +15,7 @@
.fslckout
Makefile
Tcl-Info.plist
Tclsh-Info.plist
autom4te.cache
config.cache
config.log
@@ -59,4 +61,5 @@ win/*.manifest
win/pkgs/*
win/coffbase.txt
win/tcl.hpj
win/nmakehlp.out
win/nmhlp-out.txt
+10 -7
View File
@@ -1,4 +1,3 @@
sudo: false
language: c
addons:
apt:
@@ -10,11 +9,7 @@ addons:
- gcc-mingw-w64-i686
- gcc-mingw-w64-x86-64
- gcc-multilib
homebrew:
packages:
- libtommath
update: true
matrix:
jobs:
include:
# Testing on Linux with various compilers
- name: "Linux/GCC/Shared"
@@ -361,6 +356,15 @@ matrix:
- BUILD_DIR=win
- CFGOPT="--enable-symbols=mem"
before_install: *makepreinst
# "make dist" only
- name: "Linux: make dist"
os: linux
dist: bionic
compiler: gcc
env:
- BUILD_DIR=unix
script:
- make dist
before_install:
- cd ${BUILD_DIR}
install:
@@ -372,4 +376,3 @@ script:
- make all tcltest
- make test
- make install
- make dist
+1 -1
View File
@@ -36,7 +36,7 @@ mkstemp(
{
static const char alphanumerics[] =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
register char *a, *b;
char *a, *b;
int fd, count, alphanumericsLen = strlen(alphanumerics); /* == 62 */
a = template + strlen(template);
+37 -10
View File
@@ -4,11 +4,11 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.TH Tcl_CreateSlave 3 7.6 Tcl "Tcl Library Procedures"
.TH Tcl_CreateAlias 3 7.6 Tcl "Tcl Library Procedures"
.so man.macros
.BS
.SH NAME
Tcl_IsSafe, Tcl_MakeSafe, Tcl_CreateSlave, Tcl_GetSlave, Tcl_GetMaster, Tcl_GetInterpPath, Tcl_CreateAlias, Tcl_CreateAliasObj, Tcl_GetAlias, Tcl_GetAliasObj, Tcl_ExposeCommand, Tcl_HideCommand \- manage multiple Tcl interpreters, aliases and hidden commands
Tcl_IsSafe, Tcl_MakeSafe, Tcl_CreateChild, Tcl_CreateSlave, Tcl_GetChild, Tcl_GetSlave, Tcl_GetParent, Tcl_GetMaster, Tcl_GetInterpPath, Tcl_CreateAlias, Tcl_CreateAliasObj, Tcl_GetAlias, Tcl_GetAliasObj, Tcl_ExposeCommand, Tcl_HideCommand \- manage multiple Tcl interpreters, aliases and hidden commands
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
@@ -19,17 +19,32 @@ int
int
\fBTcl_MakeSafe\fR(\fIinterp\fR)
.sp
.VS "TIP 581"
Tcl_Interp *
\fBTcl_CreateSlave\fR(\fIinterp, slaveName, isSafe\fR)
\fBTcl_CreateChild\fR(\fIinterp, name, isSafe\fR)
.VE "TIP 581"
.sp
Tcl_Interp *
\fBTcl_GetSlave\fR(\fIinterp, slaveName\fR)
\fBTcl_CreateSlave\fR(\fIinterp, name, isSafe\fR)
.sp
.VS "TIP 581"
Tcl_Interp *
\fBTcl_GetChild\fR(\fIinterp, name\fR)
.VE "TIP 581"
.sp
Tcl_Interp *
\fBTcl_GetSlave\fR(\fIinterp, name\fR)
.sp
.VS "TIP 581"
Tcl_Interp *
\fBTcl_GetParent\fR(\fIinterp\fR)
.VE "TIP 581"
.sp
Tcl_Interp *
\fBTcl_GetMaster\fR(\fIinterp\fR)
.sp
int
\fBTcl_GetInterpPath\fR(\fIaskingInterp, slaveInterp\fR)
\fBTcl_GetInterpPath\fR(\fIinterp, slaveInterp\fR)
.sp
int
\fBTcl_CreateAlias\fR(\fIslaveInterp, slaveCmd, targetInterp, targetCmd,
@@ -56,7 +71,7 @@ int
.AS "const char *const" **targetInterpPtr out
.AP Tcl_Interp *interp in
Interpreter in which to execute the specified command.
.AP "const char" *slaveName in
.AP "const char" *name in
Name of slave interpreter to create or manipulate.
.AP int isSafe in
If non-zero, a
@@ -133,6 +148,10 @@ slave in which Tcl code has access only to set of Tcl commands defined as
see the manual entry for the Tcl \fBinterp\fR command for details.
If the creation of the new slave interpreter failed, \fBNULL\fR is returned.
.PP
.VS "TIP 581"
\fBTcl_CreateChild\fR is a synonym for \fBTcl_CreateSlave\fR.
.VE "TIP 581"
.PP
\fBTcl_IsSafe\fR returns \fB1\fR if \fIinterp\fR is
.QW safe
(was created with the \fBTCL_SAFE_INTERPRETER\fR flag specified),
@@ -154,16 +173,24 @@ may be a better choice, since it creates interpreters in a known-safe state.
\fIinterp\fR. The slave interpreter is identified by \fIslaveName\fR.
If no such slave interpreter exists, \fBNULL\fR is returned.
.PP
.VS "TIP 581"
\fBTcl_GetChild\fR is a synonym for \fBTcl_GetSlave\fR.
.VE "TIP 581"
.PP
\fBTcl_GetMaster\fR returns a pointer to the master interpreter of
\fIinterp\fR. If \fIinterp\fR has no master (it is a
top-level interpreter) then \fBNULL\fR is returned.
.PP
\fBTcl_GetInterpPath\fR stores in the result of \fIaskingInterp\fR
the relative path between \fIaskingInterp\fR and \fIslaveInterp\fR;
\fIslaveInterp\fR must be a slave of \fIaskingInterp\fR. If the computation
.VS "TIP 581"
\fBTcl_GetParent\fR is a synonym for \fBTcl_GetMaster\fR.
.VE "TIP 581"
.PP
\fBTcl_GetInterpPath\fR stores in the result of \fIinterp\fR
the relative path between \fIinterp\fR and \fIslaveInterp\fR;
\fIslaveInterp\fR must be a slave of \fIinterp\fR. If the computation
of the relative path succeeds, \fBTCL_OK\fR is returned, else
\fBTCL_ERROR\fR is returned and an error message is stored as the
result of \fIaskingInterp\fR.
result of \fIinterp\fR.
.PP
\fBTcl_CreateAlias\fR creates a command named \fIslaveCmd\fR in
\fIslaveInterp\fR that when invoked, will cause the command \fItargetCmd\fR
+9 -8
View File
@@ -472,36 +472,36 @@ The following format groups are recognized by the \fBclock scan\fR and
\fBclock format\fR commands.
.TP
\fB%a\fR
On output, receives an abbreviation (\fIe.g.,\fR \fBMon\fR) for the day
On output, produces an abbreviation (\fIe.g.,\fR \fBMon\fR) for the day
of the week in the given locale. On input, matches the name of the day
of the week in the given locale (in either abbreviated or full form, or
any unique prefix of either form).
.TP
\fB%A\fR
On output, receives the full name (\fIe.g.,\fR \fBMonday\fR) of the day
On output, produces the full name (\fIe.g.,\fR \fBMonday\fR) of the day
of the week in the given locale. On input, matches the name of the day
of the week in the given locale (in either abbreviated or full form, or
any unique prefix of either form).
.TP
\fB%b\fR
On output, receives an abbreviation (\fIe.g.,\fR \fBJan\fR) for the name
On output, produces an abbreviation (\fIe.g.,\fR \fBJan\fR) for the name
of the month in the given locale. On input, matches the name of the month
in the given locale (in either abbreviated or full form, or
any unique prefix of either form).
.TP
\fB%B\fR
On output, receives the full name (\fIe.g.,\fR \fBJanuary\fR)
On output, produces the full name (\fIe.g.,\fR \fBJanuary\fR)
of the month in the given locale. On input, matches the name of the month
in the given locale (in either abbreviated or full form, or
any unique prefix of either form).
.TP
\fB%c\fR
On output, receives a localized representation of date and time of day;
On output, produces a localized representation of date and time of day;
the localized representation is expected to use the Gregorian calendar.
On input, matches whatever \fB%c\fR produces.
.TP
\fB%C\fR
On output, receives the number of the century in Indo-Arabic numerals.
On output, produces the number of the century in Indo-Arabic numerals.
On input, matches one or two digits, possibly with leading whitespace,
that are expected to be the number of the century.
.TP
@@ -913,9 +913,10 @@ An ISO 8601 point-in-time specification, such as
where \fBT\fR is the literal
.QW T ,
.QW "\fICCyymmdd hhmmss\fR" ,
.QW \fICCyymmdd\fBT\fIhh:mm:ss\fR ,
or
.QW \fICCyymmdd\fBT\fIhh:mm:ss\fR .
Note that only these three formats are accepted.
.QW \fICCyy-mm-dd\fBT\fIhh:mm:ss\fR.
Note that only these four formats are accepted.
The command does \fInot\fR accept the full range of point-in-time
specifications specified in ISO8601. Other formats can be recognized by
giving an explicit \fB\-format\fR option to the \fBclock scan\fR command.
+6
View File
@@ -377,6 +377,12 @@ Returns a Tcl list of the names of all the slave interpreters associated
with the interpreter identified by \fIpath\fR. If \fIpath\fR is omitted,
the invoking interpreter is used.
.TP
.VS "TIP 581"
\fBinterp\fR \fBchildren\fR ?\fIpath\fR?
.
Synonym for . \fBinterp\fR \fBslaves\fR ?\fIpath\fR?
.VE "TIP 581"
.TP
\fBinterp\fR \fBtarget\fR \fIpath alias\fR
.
Returns a Tcl list describing the target interpreter for an alias. The
+1 -1
View File
@@ -582,7 +582,7 @@ declare 162 {
CONST84_RETURN char *Tcl_GetHostName(void)
}
declare 163 {
int Tcl_GetInterpPath(Tcl_Interp *askInterp, Tcl_Interp *slaveInterp)
int Tcl_GetInterpPath(Tcl_Interp *interp, Tcl_Interp *slaveInterp)
}
declare 164 {
Tcl_Interp *Tcl_GetMaster(Tcl_Interp *interp)
+1 -1
View File
@@ -604,7 +604,7 @@ TclpRealloc(
if (maxSize < numBytes) {
numBytes = maxSize;
}
memcpy(newPtr, oldPtr, (size_t) numBytes);
memcpy(newPtr, oldPtr, numBytes);
TclpFree(oldPtr);
return newPtr;
}
+3 -2
View File
@@ -3268,6 +3268,7 @@ Tcl_DeleteCommandFromToken(
* TclNRExecuteByteCode looks up the command in the command hashtable).
*/
cmdPtr->flags |= CMD_DEAD;
TclCleanupCommandMacro(cmdPtr);
return 0;
}
@@ -4138,7 +4139,7 @@ Tcl_CancelEval(
if (resultObjPtr != NULL) {
result = Tcl_GetStringFromObj(resultObjPtr, &cancelInfo->length);
cancelInfo->result = ckrealloc(cancelInfo->result,cancelInfo->length);
memcpy(cancelInfo->result, result, (size_t) cancelInfo->length);
memcpy(cancelInfo->result, result, cancelInfo->length);
TclDecrRefCount(resultObjPtr); /* Discard their result object. */
} else {
cancelInfo->result = NULL;
@@ -4331,7 +4332,7 @@ EvalObjvCore(
* Caller gave it to us.
*/
if (!(preCmdPtr->flags & CMD_IS_DELETED)) {
if (!(preCmdPtr->flags & CMD_DEAD)) {
/*
* So long as it exists, use it.
*/
+8 -8
View File
@@ -339,7 +339,7 @@ Tcl_SetByteArrayObj(
byteArrayPtr->allocated = length;
if ((bytes != NULL) && (length > 0)) {
memcpy(byteArrayPtr->bytes, bytes, (size_t) length);
memcpy(byteArrayPtr->bytes, bytes, length);
}
objPtr->typePtr = &tclByteArrayType;
SET_BYTEARRAY(objPtr, byteArrayPtr);
@@ -532,7 +532,7 @@ DupByteArrayInternalRep(
copyArrayPtr = ckalloc(BYTEARRAY_SIZE(length));
copyArrayPtr->used = length;
copyArrayPtr->allocated = length;
memcpy(copyArrayPtr->bytes, srcArrayPtr->bytes, (size_t) length);
memcpy(copyArrayPtr->bytes, srcArrayPtr->bytes, length);
SET_BYTEARRAY(copyPtr, copyArrayPtr);
copyPtr->typePtr = &tclByteArrayType;
@@ -593,7 +593,7 @@ UpdateStringOfByteArray(
objPtr->length = size;
if (size == length) {
memcpy(dst, src, (size_t) size);
memcpy(dst, src, size);
dst[size] = '\0';
} else {
for (i = 0; i < length; i++) {
@@ -945,7 +945,7 @@ BinaryFormatCmd(
resultPtr = Tcl_NewObj();
buffer = Tcl_SetByteArrayLength(resultPtr, length);
memset(buffer, 0, (size_t) length);
memset(buffer, 0, length);
/*
* Pack the data into the result object. Note that we can skip the error
@@ -982,10 +982,10 @@ BinaryFormatCmd(
count = 1;
}
if (length >= count) {
memcpy(cursor, bytes, (size_t) count);
memcpy(cursor, bytes, count);
} else {
memcpy(cursor, bytes, (size_t) length);
memset(cursor + length, pad, (size_t) (count - length));
memcpy(cursor, bytes, length);
memset(cursor + length, pad, count - length);
}
cursor += count;
break;
@@ -1174,7 +1174,7 @@ BinaryFormatCmd(
if (count == BINARY_NOCOUNT) {
count = 1;
}
memset(cursor, 0, (size_t) count);
memset(cursor, 0, count);
cursor += count;
break;
case 'X':
+3 -3
View File
@@ -623,7 +623,7 @@ Tcl_DbCkfree(
Tcl_MutexLock(ckallocMutexPtr);
ValidateMemory(memp, file, line, TRUE);
if (init_malloced_bodies) {
memset(ptr, GUARD_VALUE, (size_t) memp->length);
memset(ptr, GUARD_VALUE, memp->length);
}
total_frees++;
@@ -693,7 +693,7 @@ Tcl_DbCkrealloc(
copySize = memp->length;
}
newPtr = Tcl_DbCkalloc(size, file, line);
memcpy(newPtr, ptr, (size_t) copySize);
memcpy(newPtr, ptr, copySize);
Tcl_DbCkfree(ptr, file, line);
return newPtr;
}
@@ -727,7 +727,7 @@ Tcl_AttemptDbCkrealloc(
if (newPtr == NULL) {
return NULL;
}
memcpy(newPtr, ptr, (size_t) copySize);
memcpy(newPtr, ptr, copySize);
Tcl_DbCkfree(ptr, file, line);
return newPtr;
}
+2 -2
View File
@@ -2288,7 +2288,7 @@ StringReptCmd(
return TCL_ERROR;
}
for (index = 0; index < count; index++) {
memcpy(string2 + (length1 * index), string1, (size_t) length1);
memcpy(string2 + (length1 * index), string1, length1);
}
string2[length2] = '\0';
@@ -2850,7 +2850,7 @@ TclStringCmp(
* The comparison function should compare up to the minimum byte
* length only.
*/
match = memCmpFn(s1, s2, (size_t) length);
match = memCmpFn(s1, s2, length);
}
if ((match == 0) && (reqlength > length)) {
match = s1len - s2len;
+1 -1
View File
@@ -756,7 +756,7 @@ TclCompileStringMatchCmd(
}
str = tokenPtr[1].start;
length = tokenPtr[1].size;
if ((length <= 1) || strncmp(str, "-nocase", (size_t) length)) {
if ((length <= 1) || strncmp(str, "-nocase", length)) {
/*
* Fail at run time, not in compilation.
*/
+1 -1
View File
@@ -2068,7 +2068,7 @@ ParseLexeme(
} else {
char utfBytes[TCL_UTF_MAX];
memcpy(utfBytes, start, (size_t) numBytes);
memcpy(utfBytes, start, numBytes);
utfBytes[numBytes] = '\0';
scanned = TclUtfToUniChar(utfBytes, &ch);
}
+4 -4
View File
@@ -2820,7 +2820,7 @@ TclInitByteCodeObj(
p += sizeof(ByteCode);
codePtr->codeStart = p;
memcpy(p, envPtr->codeStart, (size_t) codeBytes);
memcpy(p, envPtr->codeStart, codeBytes);
p += TCL_ALIGN(codeBytes); /* align object array */
codePtr->objArrayPtr = (Tcl_Obj **) p;
@@ -2853,7 +2853,7 @@ TclInitByteCodeObj(
p += TCL_ALIGN(objArrayBytes); /* align exception range array */
if (exceptArrayBytes > 0) {
codePtr->exceptArrayPtr = (ExceptionRange *) p;
memcpy(p, envPtr->exceptArrayPtr, (size_t) exceptArrayBytes);
memcpy(p, envPtr->exceptArrayPtr, exceptArrayBytes);
} else {
codePtr->exceptArrayPtr = NULL;
}
@@ -2861,7 +2861,7 @@ TclInitByteCodeObj(
p += TCL_ALIGN(exceptArrayBytes); /* align AuxData array */
if (auxDataArrayBytes > 0) {
codePtr->auxDataArrayPtr = (AuxData *) p;
memcpy(p, envPtr->auxDataArrayPtr, (size_t) auxDataArrayBytes);
memcpy(p, envPtr->auxDataArrayPtr, auxDataArrayBytes);
} else {
codePtr->auxDataArrayPtr = NULL;
}
@@ -3028,7 +3028,7 @@ TclFindCompiledLocal(
localPtr->resolveInfo = NULL;
if (name != NULL) {
memcpy(localPtr->name, name, (size_t) nameBytes);
memcpy(localPtr->name, name, nameBytes);
}
localPtr->name[nameBytes] = '\0';
procPtr->numCompiledLocals++;
+135 -135
View File
@@ -560,7 +560,7 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 79
#define YYLAST 81
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 26
@@ -569,7 +569,7 @@ union yyalloc
/* YYNRULES -- Number of rules. */
#define YYNRULES 56
/* YYNSTATES -- Number of states. */
#define YYNSTATES 83
#define YYNSTATES 85
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */
@@ -587,7 +587,7 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 25, 22, 21, 24, 23, 2, 2,
2, 2, 2, 25, 21, 23, 24, 22, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 20, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -618,11 +618,11 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint16 yyrline[] =
{
0, 223, 223, 224, 227, 230, 233, 236, 239, 242,
245, 249, 254, 257, 263, 269, 277, 283, 294, 298,
302, 308, 312, 316, 320, 324, 330, 334, 339, 344,
349, 354, 358, 363, 367, 372, 379, 383, 389, 398,
407, 417, 431, 436, 439, 442, 445, 448, 451, 456,
459, 464, 468, 472, 478, 496, 499
245, 249, 254, 257, 263, 269, 277, 282, 287, 291,
297, 301, 305, 309, 313, 319, 323, 328, 333, 338,
343, 347, 352, 356, 361, 368, 372, 378, 388, 397,
406, 416, 430, 435, 438, 441, 444, 447, 450, 455,
458, 463, 467, 471, 477, 495, 498
};
#endif
@@ -634,7 +634,7 @@ static const char *const yytname[] =
"$end", "error", "$undefined", "tAGO", "tDAY", "tDAYZONE", "tID",
"tMERIDIAN", "tMONTH", "tMONTH_UNIT", "tSTARDATE", "tSEC_UNIT",
"tSNUMBER", "tUNUMBER", "tZONE", "tEPOCH", "tDST", "tISOBASE",
"tDAY_UNIT", "tNEXT", "':'", "'-'", "','", "'/'", "'.'", "'+'",
"tDAY_UNIT", "tNEXT", "':'", "','", "'/'", "'-'", "'.'", "'+'",
"$accept", "spec", "item", "time", "zone", "day", "date", "ordMonth",
"iso", "trek", "relspec", "relunits", "sign", "unit", "number",
"o_merid", YY_NULLPTR
@@ -648,14 +648,14 @@ static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
58, 45, 44, 47, 46, 43
58, 44, 47, 45, 46, 43
};
# endif
#define YYPACT_NINF -22
#define YYPACT_NINF -18
#define yypact_value_is_default(Yystate) \
(!!((Yystate) == (-22)))
(!!((Yystate) == (-18)))
#define YYTABLE_NINF -1
@@ -666,15 +666,15 @@ static const yytype_uint16 yytoknum[] =
STATE-NUM. */
static const yytype_int8 yypact[] =
{
-22, 2, -22, -21, -22, -4, -22, 1, -22, 22,
18, -22, 8, -22, 40, -22, -22, -22, -22, -22,
-22, -22, -22, -22, -22, -22, 32, 28, -22, -22,
-22, 24, 26, -22, -22, 42, 47, -5, 49, -22,
-22, 15, -22, -22, -22, 48, -22, -22, 43, 50,
51, -22, 17, 44, 46, 45, 52, -22, -22, -22,
-22, -22, -22, -22, -22, 56, 57, -22, 58, 60,
61, 62, -3, -22, -22, -22, -22, 59, 63, -22,
64, -22, -22
-18, 2, -18, -17, -18, -4, -18, 10, -18, 22,
8, -18, 18, -18, 39, -18, -18, -18, -18, -18,
-18, -18, -18, -18, -18, -18, 25, 21, -18, -18,
-18, 16, 14, -18, -18, 28, 36, 41, -5, -18,
-18, 5, -18, -18, -18, 47, -18, -18, 42, 46,
48, -18, -6, 40, 43, 44, 49, -18, -18, -18,
-18, -18, -18, -18, -18, 50, -18, 51, 55, 57,
58, 65, -18, -18, 59, 54, -18, 62, 63, 60,
-18, 64, 61, 66, -18
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@@ -682,29 +682,29 @@ static const yytype_int8 yypact[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
2, 0, 1, 21, 20, 0, 53, 0, 51, 54,
19, 34, 28, 52, 0, 49, 50, 3, 4, 5,
2, 0, 1, 20, 18, 0, 53, 0, 51, 54,
17, 33, 27, 52, 0, 49, 50, 3, 4, 5,
8, 6, 7, 10, 11, 9, 43, 0, 48, 12,
22, 31, 0, 23, 13, 33, 0, 0, 0, 45,
18, 0, 40, 25, 36, 0, 46, 42, 0, 0,
0, 35, 55, 0, 0, 26, 0, 38, 37, 47,
24, 44, 32, 41, 56, 0, 0, 14, 0, 0,
0, 0, 55, 15, 29, 30, 27, 0, 0, 16,
0, 17, 39
21, 30, 0, 22, 13, 32, 0, 0, 0, 45,
16, 0, 40, 24, 35, 0, 46, 42, 19, 0,
0, 34, 55, 25, 0, 0, 0, 38, 36, 47,
23, 44, 31, 41, 56, 0, 14, 0, 0, 0,
0, 55, 26, 28, 29, 0, 15, 0, 0, 0,
39, 0, 0, 0, 37
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
-22, -22, -22, -22, -22, -22, -22, -22, -22, -22,
-22, -22, -22, -9, -22, 6
-18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
-18, -18, -18, -9, -18, 7
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
-1, 1, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 67
25, 26, 27, 28, 29, 66
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@@ -712,26 +712,28 @@ static const yytype_int8 yydefgoto[] =
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_uint8 yytable[] =
{
39, 30, 2, 53, 64, 46, 3, 4, 54, 31,
5, 6, 7, 8, 32, 9, 10, 11, 78, 12,
13, 14, 41, 15, 64, 42, 33, 16, 56, 34,
35, 6, 57, 8, 40, 47, 59, 65, 66, 61,
13, 48, 36, 37, 43, 38, 49, 60, 44, 6,
50, 8, 6, 45, 8, 51, 58, 6, 13, 8,
52, 13, 55, 62, 63, 68, 13, 69, 70, 72,
73, 74, 71, 75, 76, 77, 81, 82, 79, 80
39, 64, 2, 54, 30, 46, 3, 4, 55, 31,
5, 6, 7, 8, 65, 9, 10, 11, 56, 12,
13, 14, 57, 32, 40, 15, 33, 16, 47, 34,
35, 6, 41, 8, 48, 42, 59, 49, 50, 61,
13, 51, 36, 43, 37, 38, 60, 44, 6, 52,
8, 6, 45, 8, 53, 58, 6, 13, 8, 62,
13, 63, 67, 71, 72, 13, 68, 69, 73, 70,
74, 75, 64, 77, 78, 79, 80, 82, 76, 84,
81, 83
};
static const yytype_uint8 yycheck[] =
{
9, 22, 0, 8, 7, 14, 4, 5, 13, 13,
8, 9, 10, 11, 13, 13, 14, 15, 21, 17,
18, 19, 14, 21, 7, 17, 4, 25, 13, 7,
8, 9, 17, 11, 16, 3, 45, 20, 21, 48,
18, 13, 20, 21, 4, 23, 22, 4, 8, 9,
24, 11, 9, 13, 11, 13, 8, 9, 18, 11,
13, 18, 13, 13, 13, 21, 18, 21, 23, 13,
13, 13, 20, 13, 13, 13, 13, 13, 72, 20
9, 7, 0, 8, 21, 14, 4, 5, 13, 13,
8, 9, 10, 11, 20, 13, 14, 15, 13, 17,
18, 19, 17, 13, 16, 23, 4, 25, 3, 7,
8, 9, 14, 11, 13, 17, 45, 21, 24, 48,
18, 13, 20, 4, 22, 23, 4, 8, 9, 13,
11, 9, 13, 11, 13, 8, 9, 18, 11, 13,
18, 13, 22, 13, 13, 18, 23, 23, 13, 20,
13, 13, 7, 14, 20, 13, 13, 13, 71, 13,
20, 20
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -739,23 +741,23 @@ static const yytype_uint8 yycheck[] =
static const yytype_uint8 yystos[] =
{
0, 27, 0, 4, 5, 8, 9, 10, 11, 13,
14, 15, 17, 18, 19, 21, 25, 28, 29, 30,
14, 15, 17, 18, 19, 23, 25, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
22, 13, 13, 4, 7, 8, 20, 21, 23, 39,
16, 14, 17, 4, 8, 13, 39, 3, 13, 22,
24, 13, 13, 8, 13, 13, 13, 17, 8, 39,
4, 39, 13, 13, 7, 20, 21, 41, 21, 21,
23, 20, 13, 13, 13, 13, 13, 13, 21, 41,
20, 13, 13
21, 13, 13, 4, 7, 8, 20, 22, 23, 39,
16, 14, 17, 4, 8, 13, 39, 3, 13, 21,
24, 13, 13, 13, 8, 13, 13, 17, 8, 39,
4, 39, 13, 13, 7, 20, 41, 22, 23, 23,
20, 13, 13, 13, 13, 13, 41, 14, 20, 13,
13, 20, 13, 20, 13
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
0, 26, 27, 27, 28, 28, 28, 28, 28, 28,
28, 28, 28, 29, 29, 29, 29, 29, 30, 30,
30, 31, 31, 31, 31, 31, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 33, 33, 34, 34,
28, 28, 28, 29, 29, 29, 30, 30, 30, 30,
31, 31, 31, 31, 31, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 33, 33, 34, 34, 34,
34, 35, 36, 36, 37, 37, 37, 37, 37, 38,
38, 39, 39, 39, 40, 41, 41
};
@@ -764,9 +766,9 @@ static const yytype_uint8 yyr1[] =
static const yytype_uint8 yyr2[] =
{
0, 2, 0, 2, 1, 1, 1, 1, 1, 1,
1, 1, 1, 2, 4, 5, 6, 7, 2, 1,
1, 1, 2, 2, 3, 2, 3, 5, 1, 5,
5, 2, 4, 2, 1, 3, 2, 3, 3, 7,
1, 1, 1, 2, 4, 6, 2, 1, 1, 2,
1, 2, 2, 3, 2, 3, 5, 1, 5, 5,
2, 4, 2, 1, 3, 2, 3, 11, 3, 7,
2, 4, 2, 1, 3, 2, 2, 3, 1, 1,
1, 1, 1, 1, 1, 0, 1
};
@@ -1638,19 +1640,6 @@ yyreduce:
case 15:
{
yyHour = (yyvsp[-4].Number);
yyMinutes = (yyvsp[-2].Number);
yyMeridian = MER24;
yyDSTmode = DSToff;
yyTimezone = ((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60);
++yyHaveZone;
}
break;
case 16:
{
yyHour = (yyvsp[-5].Number);
yyMinutes = (yyvsp[-3].Number);
@@ -1660,16 +1649,22 @@ yyreduce:
break;
case 16:
{
yyTimezone = (yyvsp[-1].Number);
if (yyTimezone > HOUR( 12)) yyTimezone -= HOUR(100);
yyDSTmode = DSTon;
}
break;
case 17:
{
yyHour = (yyvsp[-6].Number);
yyMinutes = (yyvsp[-4].Number);
yySeconds = (yyvsp[-2].Number);
yyMeridian = MER24;
yyTimezone = (yyvsp[0].Number);
if (yyTimezone > HOUR( 12)) yyTimezone -= HOUR(100);
yyDSTmode = DSToff;
yyTimezone = ((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60);
++yyHaveZone;
}
break;
@@ -1677,7 +1672,7 @@ yyreduce:
case 18:
{
yyTimezone = (yyvsp[-1].Number);
yyTimezone = (yyvsp[0].Number);
yyDSTmode = DSTon;
}
@@ -1686,7 +1681,7 @@ yyreduce:
case 19:
{
yyTimezone = (yyvsp[0].Number);
yyTimezone = -(yyvsp[-1].Number)*((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60);
yyDSTmode = DSToff;
}
@@ -1695,23 +1690,14 @@ yyreduce:
case 20:
{
yyTimezone = (yyvsp[0].Number);
yyDSTmode = DSTon;
yyDayOrdinal = 1;
yyDayNumber = (yyvsp[0].Number);
}
break;
case 21:
{
yyDayOrdinal = 1;
yyDayNumber = (yyvsp[0].Number);
}
break;
case 22:
{
yyDayOrdinal = 1;
yyDayNumber = (yyvsp[-1].Number);
@@ -1719,7 +1705,7 @@ yyreduce:
break;
case 23:
case 22:
{
yyDayOrdinal = (yyvsp[-1].Number);
@@ -1728,7 +1714,7 @@ yyreduce:
break;
case 24:
case 23:
{
yyDayOrdinal = (yyvsp[-2].Number) * (yyvsp[-1].Number);
@@ -1737,7 +1723,7 @@ yyreduce:
break;
case 25:
case 24:
{
yyDayOrdinal = 2;
@@ -1746,7 +1732,7 @@ yyreduce:
break;
case 26:
case 25:
{
yyMonth = (yyvsp[-2].Number);
@@ -1755,7 +1741,7 @@ yyreduce:
break;
case 27:
case 26:
{
yyMonth = (yyvsp[-4].Number);
@@ -1765,7 +1751,7 @@ yyreduce:
break;
case 28:
case 27:
{
yyYear = (yyvsp[0].Number) / 10000;
@@ -1775,7 +1761,7 @@ yyreduce:
break;
case 29:
case 28:
{
yyDay = (yyvsp[-4].Number);
@@ -1785,7 +1771,7 @@ yyreduce:
break;
case 30:
case 29:
{
yyMonth = (yyvsp[-2].Number);
@@ -1795,7 +1781,7 @@ yyreduce:
break;
case 31:
case 30:
{
yyMonth = (yyvsp[-1].Number);
@@ -1804,7 +1790,7 @@ yyreduce:
break;
case 32:
case 31:
{
yyMonth = (yyvsp[-3].Number);
@@ -1814,7 +1800,7 @@ yyreduce:
break;
case 33:
case 32:
{
yyMonth = (yyvsp[0].Number);
@@ -1823,7 +1809,7 @@ yyreduce:
break;
case 34:
case 33:
{
yyMonth = 1;
@@ -1833,7 +1819,7 @@ yyreduce:
break;
case 35:
case 34:
{
yyMonth = (yyvsp[-1].Number);
@@ -1843,7 +1829,7 @@ yyreduce:
break;
case 36:
case 35:
{
yyMonthOrdinal = 1;
@@ -1852,7 +1838,7 @@ yyreduce:
break;
case 37:
case 36:
{
yyMonthOrdinal = (yyvsp[-1].Number);
@@ -1861,10 +1847,24 @@ yyreduce:
break;
case 37:
{
if ((yyvsp[-5].Number) != HOUR( 7) + HOUR(100)) YYABORT;
yyYear = (yyvsp[-10].Number);
yyMonth = (yyvsp[-8].Number);
yyDay = (yyvsp[-6].Number);
yyHour = (yyvsp[-4].Number);
yyMinutes = (yyvsp[-2].Number);
yySeconds = (yyvsp[0].Number);
}
break;
case 38:
{
if ((yyvsp[-1].Number) != HOUR( 7)) YYABORT;
if ((yyvsp[-1].Number) != HOUR( 7) + HOUR(100)) YYABORT;
yyYear = (yyvsp[-2].Number) / 10000;
yyMonth = ((yyvsp[-2].Number) % 10000)/100;
yyDay = (yyvsp[-2].Number) % 100;
@@ -1878,7 +1878,7 @@ yyreduce:
case 39:
{
if ((yyvsp[-5].Number) != HOUR( 7)) YYABORT;
if ((yyvsp[-5].Number) != HOUR( 7) + HOUR(100)) YYABORT;
yyYear = (yyvsp[-6].Number) / 10000;
yyMonth = ((yyvsp[-6].Number) % 10000)/100;
yyDay = (yyvsp[-6].Number) % 100;
@@ -2459,31 +2459,31 @@ static const TABLE TimezoneTable[] = {
*/
static const TABLE MilitaryTable[] = {
{ "a", tZONE, -HOUR( 1) },
{ "b", tZONE, -HOUR( 2) },
{ "c", tZONE, -HOUR( 3) },
{ "d", tZONE, -HOUR( 4) },
{ "e", tZONE, -HOUR( 5) },
{ "f", tZONE, -HOUR( 6) },
{ "g", tZONE, -HOUR( 7) },
{ "h", tZONE, -HOUR( 8) },
{ "i", tZONE, -HOUR( 9) },
{ "k", tZONE, -HOUR(10) },
{ "l", tZONE, -HOUR(11) },
{ "m", tZONE, -HOUR(12) },
{ "n", tZONE, HOUR( 1) },
{ "o", tZONE, HOUR( 2) },
{ "p", tZONE, HOUR( 3) },
{ "q", tZONE, HOUR( 4) },
{ "r", tZONE, HOUR( 5) },
{ "s", tZONE, HOUR( 6) },
{ "t", tZONE, HOUR( 7) },
{ "u", tZONE, HOUR( 8) },
{ "v", tZONE, HOUR( 9) },
{ "w", tZONE, HOUR( 10) },
{ "x", tZONE, HOUR( 11) },
{ "y", tZONE, HOUR( 12) },
{ "z", tZONE, HOUR( 0) },
{ "a", tZONE, -HOUR( 1) + HOUR(100) },
{ "b", tZONE, -HOUR( 2) + HOUR(100) },
{ "c", tZONE, -HOUR( 3) + HOUR(100) },
{ "d", tZONE, -HOUR( 4) + HOUR(100) },
{ "e", tZONE, -HOUR( 5) + HOUR(100) },
{ "f", tZONE, -HOUR( 6) + HOUR(100) },
{ "g", tZONE, -HOUR( 7) + HOUR(100) },
{ "h", tZONE, -HOUR( 8) + HOUR(100) },
{ "i", tZONE, -HOUR( 9) + HOUR(100) },
{ "k", tZONE, -HOUR(10) + HOUR(100) },
{ "l", tZONE, -HOUR(11) + HOUR(100) },
{ "m", tZONE, -HOUR(12) + HOUR(100) },
{ "n", tZONE, HOUR( 1) + HOUR(100) },
{ "o", tZONE, HOUR( 2) + HOUR(100) },
{ "p", tZONE, HOUR( 3) + HOUR(100) },
{ "q", tZONE, HOUR( 4) + HOUR(100) },
{ "r", tZONE, HOUR( 5) + HOUR(100) },
{ "s", tZONE, HOUR( 6) + HOUR(100) },
{ "t", tZONE, HOUR( 7) + HOUR(100) },
{ "u", tZONE, HOUR( 8) + HOUR(100) },
{ "v", tZONE, HOUR( 9) + HOUR(100) },
{ "w", tZONE, HOUR( 10) + HOUR(100) },
{ "x", tZONE, HOUR( 11) + HOUR(100) },
{ "y", tZONE, HOUR( 12) + HOUR(100) },
{ "z", tZONE, HOUR( 0) + HOUR(100) },
{ NULL, 0, 0 }
};
+5 -2
View File
@@ -503,7 +503,7 @@ EXTERN int Tcl_GetErrno(void);
/* 162 */
EXTERN CONST84_RETURN char * Tcl_GetHostName(void);
/* 163 */
EXTERN int Tcl_GetInterpPath(Tcl_Interp *askInterp,
EXTERN int Tcl_GetInterpPath(Tcl_Interp *interp,
Tcl_Interp *slaveInterp);
/* 164 */
EXTERN Tcl_Interp * Tcl_GetMaster(Tcl_Interp *interp);
@@ -2026,7 +2026,7 @@ typedef struct TclStubs {
CONST84_RETURN char * (*tcl_GetCommandName) (Tcl_Interp *interp, Tcl_Command command); /* 160 */
int (*tcl_GetErrno) (void); /* 161 */
CONST84_RETURN char * (*tcl_GetHostName) (void); /* 162 */
int (*tcl_GetInterpPath) (Tcl_Interp *askInterp, Tcl_Interp *slaveInterp); /* 163 */
int (*tcl_GetInterpPath) (Tcl_Interp *interp, Tcl_Interp *slaveInterp); /* 163 */
Tcl_Interp * (*tcl_GetMaster) (Tcl_Interp *interp); /* 164 */
const char * (*tcl_GetNameOfExecutable) (void); /* 165 */
Tcl_Obj * (*tcl_GetObjResult) (Tcl_Interp *interp); /* 166 */
@@ -3974,5 +3974,8 @@ extern const TclStubs *tclStubsPtr;
#undef Tcl_GlobalEvalObj
#define Tcl_GlobalEvalObj(interp,objPtr) \
Tcl_EvalObjEx((interp),(objPtr),TCL_EVAL_GLOBAL)
#define Tcl_CreateChild Tcl_CreateSlave
#define Tcl_GetChild Tcl_GetSlave
#define Tcl_GetParent Tcl_GetMaster
#endif /* _TCLDECLS */
+19 -3
View File
@@ -2214,6 +2214,22 @@ TEBCresume(
if (!pc) {
/* bytecode is starting from scratch */
pc = codePtr->codeStart;
/*
* Reset the interp's result to avoid possible duplications of large
* objects [3c6e47363e], [781585], [804681], This can happen by start
* also in nested compiled blocks (enclosed in parent cycle).
* See else branch below for opposite handling by continuation/resume.
*/
objPtr = iPtr->objResultPtr;
if (objPtr->refCount > 1) {
TclDecrRefCount(objPtr);
TclNewObj(objPtr);
Tcl_IncrRefCount(objPtr);
iPtr->objResultPtr = objPtr;
}
goto cleanup0;
} else {
/* resume from invocation */
@@ -2253,7 +2269,7 @@ TEBCresume(
objc, cmdNameBuf), Tcl_GetObjResult(interp));
/*
* Reset the interp's result to avoid possible duplications of large
* Obtain and reset interp's result to avoid possible duplications of
* objects [Bug 781585]. We do not call Tcl_ResetResult to avoid any
* side effects caused by the resetting of errorInfo and errorCode
* [Bug 804681], which are not needed here. We chose instead to
@@ -2822,7 +2838,7 @@ TEBCresume(
for (; currPtr <= &OBJ_AT_TOS; currPtr++) {
bytes = TclGetStringFromObj(*currPtr, &length);
if (bytes != NULL) {
memcpy(p, bytes, (size_t) length);
memcpy(p, bytes, length);
p += length;
}
}
@@ -2857,7 +2873,7 @@ TEBCresume(
for (; currPtr <= &OBJ_AT_TOS; currPtr++) {
if ((*currPtr)->bytes != tclEmptyStringRep) {
bytes = (char *) Tcl_GetByteArrayFromObj(*currPtr,&length);
memcpy(p, bytes, (size_t) length);
memcpy(p, bytes, length);
p += length;
}
}
+3 -3
View File
@@ -598,7 +598,7 @@ Tcl_SplitPath(
for (i = 0; i < *argcPtr; i++) {
Tcl_ListObjIndex(NULL, resultPtr, i, &eltPtr);
str = Tcl_GetStringFromObj(eltPtr, &len);
memcpy(p, str, (size_t) len+1);
memcpy(p, str, len+1);
p += len+1;
}
@@ -2448,7 +2448,7 @@ DoGlob(
int len;
const char *joined = Tcl_GetStringFromObj(joinedPtr,&len);
if (strchr(separators, joined[len-1]) == NULL) {
if ((len > 0) && (strchr(separators, joined[len-1]) == NULL)) {
Tcl_AppendToObj(joinedPtr, "/", 1);
}
}
@@ -2485,7 +2485,7 @@ DoGlob(
int len;
const char *joined = Tcl_GetStringFromObj(joinedPtr,&len);
if (strchr(separators, joined[len-1]) == NULL) {
if ((len > 0) && (strchr(separators, joined[len-1]) == NULL)) {
if (Tcl_FSGetPathType(pathPtr) != TCL_PATH_VOLUME_RELATIVE) {
Tcl_AppendToObj(joinedPtr, "/", 1);
}
+44 -45
View File
@@ -266,43 +266,32 @@ time : tUNUMBER tMERIDIAN {
yySeconds = 0;
yyMeridian = $4;
}
| tUNUMBER ':' tUNUMBER '-' tUNUMBER {
yyHour = $1;
yyMinutes = $3;
yyMeridian = MER24;
yyDSTmode = DSToff;
yyTimezone = ($5 % 100 + ($5 / 100) * 60);
++yyHaveZone;
}
| tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid {
yyHour = $1;
yyMinutes = $3;
yySeconds = $5;
yyMeridian = $6;
}
| tUNUMBER ':' tUNUMBER ':' tUNUMBER '-' tUNUMBER {
yyHour = $1;
yyMinutes = $3;
yySeconds = $5;
yyMeridian = MER24;
yyDSTmode = DSToff;
yyTimezone = ($7 % 100 + ($7 / 100) * 60);
++yyHaveZone;
}
;
zone : tZONE tDST {
yyTimezone = $1;
if (yyTimezone > HOUR( 12)) yyTimezone -= HOUR(100);
yyDSTmode = DSTon;
}
| tZONE {
yyTimezone = $1;
if (yyTimezone > HOUR( 12)) yyTimezone -= HOUR(100);
yyDSTmode = DSToff;
}
| tDAYZONE {
yyTimezone = $1;
yyDSTmode = DSTon;
}
| sign tUNUMBER {
yyTimezone = -$1*($2 % 100 + ($2 / 100) * 60);
yyDSTmode = DSToff;
}
;
day : tDAY {
@@ -386,8 +375,18 @@ ordMonth: tNEXT tMONTH {
}
;
iso : tISOBASE tZONE tISOBASE {
if ($2 != HOUR( 7)) YYABORT;
iso : tUNUMBER '-' tUNUMBER '-' tUNUMBER tZONE
tUNUMBER ':' tUNUMBER ':' tUNUMBER {
if ($6 != HOUR( 7) + HOUR(100)) YYABORT;
yyYear = $1;
yyMonth = $3;
yyDay = $5;
yyHour = $7;
yyMinutes = $9;
yySeconds = $11;
}
| tISOBASE tZONE tISOBASE {
if ($2 != HOUR( 7) + HOUR(100)) YYABORT;
yyYear = $1 / 10000;
yyMonth = ($1 % 10000)/100;
yyDay = $1 % 100;
@@ -396,7 +395,7 @@ iso : tISOBASE tZONE tISOBASE {
yySeconds = $3 % 100;
}
| tISOBASE tZONE tUNUMBER ':' tUNUMBER ':' tUNUMBER {
if ($2 != HOUR( 7)) YYABORT;
if ($2 != HOUR( 7) + HOUR(100)) YYABORT;
yyYear = $1 / 10000;
yyMonth = ($1 % 10000)/100;
yyDay = $1 % 100;
@@ -675,31 +674,31 @@ static const TABLE TimezoneTable[] = {
*/
static const TABLE MilitaryTable[] = {
{ "a", tZONE, -HOUR( 1) },
{ "b", tZONE, -HOUR( 2) },
{ "c", tZONE, -HOUR( 3) },
{ "d", tZONE, -HOUR( 4) },
{ "e", tZONE, -HOUR( 5) },
{ "f", tZONE, -HOUR( 6) },
{ "g", tZONE, -HOUR( 7) },
{ "h", tZONE, -HOUR( 8) },
{ "i", tZONE, -HOUR( 9) },
{ "k", tZONE, -HOUR(10) },
{ "l", tZONE, -HOUR(11) },
{ "m", tZONE, -HOUR(12) },
{ "n", tZONE, HOUR( 1) },
{ "o", tZONE, HOUR( 2) },
{ "p", tZONE, HOUR( 3) },
{ "q", tZONE, HOUR( 4) },
{ "r", tZONE, HOUR( 5) },
{ "s", tZONE, HOUR( 6) },
{ "t", tZONE, HOUR( 7) },
{ "u", tZONE, HOUR( 8) },
{ "v", tZONE, HOUR( 9) },
{ "w", tZONE, HOUR( 10) },
{ "x", tZONE, HOUR( 11) },
{ "y", tZONE, HOUR( 12) },
{ "z", tZONE, HOUR( 0) },
{ "a", tZONE, -HOUR( 1) + HOUR(100) },
{ "b", tZONE, -HOUR( 2) + HOUR(100) },
{ "c", tZONE, -HOUR( 3) + HOUR(100) },
{ "d", tZONE, -HOUR( 4) + HOUR(100) },
{ "e", tZONE, -HOUR( 5) + HOUR(100) },
{ "f", tZONE, -HOUR( 6) + HOUR(100) },
{ "g", tZONE, -HOUR( 7) + HOUR(100) },
{ "h", tZONE, -HOUR( 8) + HOUR(100) },
{ "i", tZONE, -HOUR( 9) + HOUR(100) },
{ "k", tZONE, -HOUR(10) + HOUR(100) },
{ "l", tZONE, -HOUR(11) + HOUR(100) },
{ "m", tZONE, -HOUR(12) + HOUR(100) },
{ "n", tZONE, HOUR( 1) + HOUR(100) },
{ "o", tZONE, HOUR( 2) + HOUR(100) },
{ "p", tZONE, HOUR( 3) + HOUR(100) },
{ "q", tZONE, HOUR( 4) + HOUR(100) },
{ "r", tZONE, HOUR( 5) + HOUR(100) },
{ "s", tZONE, HOUR( 6) + HOUR(100) },
{ "t", tZONE, HOUR( 7) + HOUR(100) },
{ "u", tZONE, HOUR( 8) + HOUR(100) },
{ "v", tZONE, HOUR( 9) + HOUR(100) },
{ "w", tZONE, HOUR( 10) + HOUR(100) },
{ "x", tZONE, HOUR( 11) + HOUR(100) },
{ "y", tZONE, HOUR( 12) + HOUR(100) },
{ "z", tZONE, HOUR( 0) + HOUR(100) },
{ NULL, 0, 0 }
};
+4 -4
View File
@@ -4314,7 +4314,7 @@ Write(
* that we need to stick at the beginning of this buffer.
*/
memcpy(InsertPoint(bufPtr), safe, (size_t) saved);
memcpy(InsertPoint(bufPtr), safe, saved);
bufPtr->nextAdded += saved;
saved = 0;
}
@@ -4711,7 +4711,7 @@ Tcl_GetsObj(
gs.rawRead -= rawRead;
gs.bytesWrote--;
gs.charsWrote--;
memmove(dst, dst + 1, (size_t) (dstEnd - dst));
memmove(dst, dst + 1, dstEnd - dst);
dstEnd--;
}
}
@@ -7699,7 +7699,7 @@ Tcl_BadChannelOption(
}
Tcl_ResetResult(interp);
errObj = Tcl_ObjPrintf("bad option \"%s\": should be one of ",
optionName);
optionName ? optionName : "");
argc--;
for (i = 0; i < argc; i++) {
Tcl_AppendPrintfToObj(errObj, "-%s, ", argv[i]);
@@ -10475,7 +10475,7 @@ Tcl_IsChannelExisting(
}
if ((*chanName == *name) &&
(memcmp(name, chanName, (size_t) chanNameLen + 1) == 0)) {
(memcmp(name, chanName, chanNameLen + 1) == 0)) {
return 1;
}
}
+1 -1
View File
@@ -4209,7 +4209,7 @@ TclFSNonnativePathType(
if (pathLen < len) {
continue;
}
if (strncmp(strVol, path, (size_t) len) == 0) {
if (strncmp(strVol, path, len) == 0) {
type = TCL_PATH_ABSOLUTE;
if (filesystemPtrPtr != NULL) {
*filesystemPtrPtr = fsRecPtr->fsPtr;
+15 -14
View File
@@ -1682,6 +1682,7 @@ typedef struct Command {
#define CMD_COMPILES_EXPANDED 0x08
#define CMD_REDEF_IN_PROGRESS 0x10
#define CMD_VIA_RESOLVER 0x20
#define CMD_DEAD 0x40
/*
@@ -1804,7 +1805,7 @@ typedef struct Interp {
* of hidden commands on a per-interp
* basis. */
ClientData interpInfo; /* Information used by tclInterp.c to keep
* track of master/slave interps on a
* track of parent/child interps on a
* per-interp basis. */
union {
void (*optimizer)(void *envPtr);
@@ -2082,7 +2083,7 @@ typedef struct Interp {
* (c) are accessed very often (e.g., at each command call)
*
* Note that these are the same for all interps in the same thread. They
* just have to be initialised for the thread's master interp, slaves
* just have to be initialised for the thread's parent interp, children
* inherit the value.
*
* They are used by the macros defined below.
@@ -2600,20 +2601,20 @@ typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, int *lengthPtr,
/*
* A ProcessGlobalValue struct exists for each internal value in Tcl that is
* to be shared among several threads. Each thread sees a (Tcl_Obj) copy of
* the value, and the master is kept as a counted string, with epoch and mutex
* control. Each ProcessGlobalValue struct should be a static variable in some
* file.
* the value, and the gobal value is kept as a counted string, with epoch and
* mutex control. Each ProcessGlobalValue struct should be a static variable in
* some file.
*/
typedef struct ProcessGlobalValue {
int epoch; /* Epoch counter to detect changes in the
* master value. */
int numBytes; /* Length of the master string. */
char *value; /* The master string value. */
Tcl_Encoding encoding; /* system encoding when master string was
* global value. */
int numBytes; /* Length of the global string. */
char *value; /* The global string value. */
Tcl_Encoding encoding; /* system encoding when global string was
* initialized. */
TclInitProcessGlobalValueProc *proc;
/* A procedure to initialize the master string
/* A procedure to initialize the global string
* copy when a "get" request comes in before
* any "set" request has been received. */
Tcl_Mutex mutex; /* Enforce orderly access from multiple
@@ -3097,8 +3098,8 @@ MODULE_SCOPE void TclpInitLock(void);
MODULE_SCOPE void TclpInitPlatform(void);
MODULE_SCOPE void TclpInitUnlock(void);
MODULE_SCOPE Tcl_Obj * TclpObjListVolumes(void);
MODULE_SCOPE void TclpMasterLock(void);
MODULE_SCOPE void TclpMasterUnlock(void);
MODULE_SCOPE void TclpGlobalLock(void);
MODULE_SCOPE void TclpGlobalUnlock(void);
MODULE_SCOPE int TclpMatchFiles(Tcl_Interp *interp, char *separators,
Tcl_DString *dirPtr, char *pattern, char *tail);
MODULE_SCOPE int TclpObjNormalizePath(Tcl_Interp *interp,
@@ -3242,8 +3243,8 @@ MODULE_SCOPE Tcl_WideInt TclpGetMicroseconds(void);
MODULE_SCOPE int TclZlibInit(Tcl_Interp *interp);
MODULE_SCOPE void * TclpThreadCreateKey(void);
MODULE_SCOPE void TclpThreadDeleteKey(void *keyPtr);
MODULE_SCOPE void TclpThreadSetMasterTSD(void *tsdKeyPtr, void *ptr);
MODULE_SCOPE void * TclpThreadGetMasterTSD(void *tsdKeyPtr);
MODULE_SCOPE void TclpThreadSetGlobalTSD(void *tsdKeyPtr, void *ptr);
MODULE_SCOPE void * TclpThreadGetGlobalTSD(void *tsdKeyPtr);
MODULE_SCOPE void TclErrorStackResetIf(Tcl_Interp *interp, const char *msg, int length);
+2
View File
@@ -1422,4 +1422,6 @@ extern const TclIntStubs *tclIntStubsPtr;
#undef TclCopyChannelOld
#undef TclSockMinimumBuffersOld
#define TclSetChildCancelFlags TclSetSlaveCancelFlags
#endif /* _TCLINTDECLS */
+12 -11
View File
@@ -611,7 +611,7 @@ NRInterpCmd(
int index;
static const char *const options[] = {
"alias", "aliases", "bgerror", "cancel",
"create", "debug", "delete",
"children", "create", "debug", "delete",
"eval", "exists", "expose",
"hide", "hidden", "issafe",
"invokehidden", "limit", "marktrusted", "recursionlimit",
@@ -620,7 +620,7 @@ NRInterpCmd(
};
enum option {
OPT_ALIAS, OPT_ALIASES, OPT_BGERROR, OPT_CANCEL,
OPT_CREATE, OPT_DEBUG, OPT_DELETE,
OPT_CHILDREN, OPT_CREATE, OPT_DEBUG, OPT_DELETE,
OPT_EVAL, OPT_EXISTS, OPT_EXPOSE,
OPT_HIDE, OPT_HIDDEN, OPT_ISSAFE,
OPT_INVOKEHID, OPT_LIMIT, OPT_MARKTRUSTED,OPT_RECLIMIT,
@@ -1008,6 +1008,7 @@ NRInterpCmd(
return TCL_ERROR;
}
return SlaveRecursionLimit(interp, slaveInterp, objc - 3, objv + 3);
case OPT_CHILDREN:
case OPT_SLAVES: {
InterpInfo *iiPtr;
Tcl_Obj *resultPtr;
@@ -1813,8 +1814,8 @@ AliasNRCmd(
cmdv = &listRep->elements;
prefv = &aliasPtr->objPtr;
memcpy(cmdv, prefv, (size_t) (prefc * sizeof(Tcl_Obj *)));
memcpy(cmdv+prefc, objv+1, (size_t) ((objc-1) * sizeof(Tcl_Obj *)));
memcpy(cmdv, prefv, prefc * sizeof(Tcl_Obj *));
memcpy(cmdv+prefc, objv+1, (objc-1) * sizeof(Tcl_Obj *));
for (i=0; i<cmdc; i++) {
Tcl_IncrRefCount(cmdv[i]);
@@ -1862,8 +1863,8 @@ AliasObjCmd(
cmdv = TclStackAlloc(interp, cmdc * sizeof(Tcl_Obj *));
}
memcpy(cmdv, prefv, (size_t) (prefc * sizeof(Tcl_Obj *)));
memcpy(cmdv+prefc, objv+1, (size_t) ((objc-1) * sizeof(Tcl_Obj *)));
memcpy(cmdv, prefv, prefc * sizeof(Tcl_Obj *));
memcpy(cmdv+prefc, objv+1, (objc-1) * sizeof(Tcl_Obj *));
Tcl_ResetResult(targetInterp);
@@ -2169,23 +2170,23 @@ TclSetSlaveCancelFlags(
int
Tcl_GetInterpPath(
Tcl_Interp *askingInterp, /* Interpreter to start search from. */
Tcl_Interp *interp, /* Interpreter to start search from. */
Tcl_Interp *targetInterp) /* Interpreter to find. */
{
InterpInfo *iiPtr;
if (targetInterp == askingInterp) {
Tcl_SetObjResult(askingInterp, Tcl_NewObj());
if (targetInterp == interp) {
Tcl_SetObjResult(interp, Tcl_NewObj());
return TCL_OK;
}
if (targetInterp == NULL) {
return TCL_ERROR;
}
iiPtr = (InterpInfo *) ((Interp *) targetInterp)->interpInfo;
if (Tcl_GetInterpPath(askingInterp, iiPtr->slave.masterInterp) != TCL_OK){
if (Tcl_GetInterpPath(interp, iiPtr->slave.masterInterp) != TCL_OK){
return TCL_ERROR;
}
Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(askingInterp),
Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp),
Tcl_NewStringObj(Tcl_GetHashKey(&iiPtr->master.slaveTable,
iiPtr->slave.slaveEntryPtr), -1));
return TCL_OK;
+3 -3
View File
@@ -653,7 +653,7 @@ Tcl_ListObjAppendElement(
* Old intrep to be freed, re-use refCounts.
*/
memcpy(dst, src, (size_t) numElems * sizeof(Tcl_Obj *));
memcpy(dst, src, numElems * sizeof(Tcl_Obj *));
ckfree(listRepPtr);
}
listRepPtr = newPtr;
@@ -953,7 +953,7 @@ Tcl_ListObjReplace(
if ((numAfterLast > 0) && (shift != 0)) {
Tcl_Obj **src = elemPtrs + start;
memmove(src+shift, src, (size_t) numAfterLast * sizeof(Tcl_Obj*));
memmove(src+shift, src, numAfterLast * sizeof(Tcl_Obj*));
}
} else {
/*
@@ -1024,7 +1024,7 @@ Tcl_ListObjReplace(
*/
if (first > 0) {
memcpy(elemPtrs, oldPtrs, (size_t) first * sizeof(Tcl_Obj *));
memcpy(elemPtrs, oldPtrs, first * sizeof(Tcl_Obj *));
}
/*
+6 -6
View File
@@ -2059,25 +2059,25 @@ ParseBoolean(
/*
* Checking the 'y' is redundant, but makes the code clearer.
*/
if (strncmp(lowerCase, "yes", (size_t) length) == 0) {
if (strncmp(lowerCase, "yes", length) == 0) {
newBool = 1;
goto goodBoolean;
}
return TCL_ERROR;
case 'n':
if (strncmp(lowerCase, "no", (size_t) length) == 0) {
if (strncmp(lowerCase, "no", length) == 0) {
newBool = 0;
goto goodBoolean;
}
return TCL_ERROR;
case 't':
if (strncmp(lowerCase, "true", (size_t) length) == 0) {
if (strncmp(lowerCase, "true", length) == 0) {
newBool = 1;
goto goodBoolean;
}
return TCL_ERROR;
case 'f':
if (strncmp(lowerCase, "false", (size_t) length) == 0) {
if (strncmp(lowerCase, "false", length) == 0) {
newBool = 0;
goto goodBoolean;
}
@@ -2086,10 +2086,10 @@ ParseBoolean(
if (length < 2) {
return TCL_ERROR;
}
if (strncmp(lowerCase, "on", (size_t) length) == 0) {
if (strncmp(lowerCase, "on", length) == 0) {
newBool = 1;
goto goodBoolean;
} else if (strncmp(lowerCase, "off", (size_t) length) == 0) {
} else if (strncmp(lowerCase, "off", length) == 0) {
newBool = 0;
goto goodBoolean;
}
+2
View File
@@ -942,9 +942,11 @@ TclParseBackslash(
* No hexdigits -> This is just "U".
*/
result = 'U';
#if TCL_UTF_MAX > 3
} else if ((result & ~0x7FF) == 0xD800) {
/* Upper or lower surrogate, not allowed in this syntax. */
result = 0xFFFD;
#endif
}
break;
case '\n':
+1 -1
View File
@@ -1745,7 +1745,7 @@ Tcl_FSGetTranslatedStringPath(
const char *orig = Tcl_GetStringFromObj(transPtr, &len);
char *result = ckalloc(len+1);
memcpy(result, orig, (size_t) len+1);
memcpy(result, orig, len+1);
TclDecrRefCount(transPtr);
return result;
}
+1 -1
View File
@@ -465,7 +465,7 @@ mp_err mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen)
if (maxlen < 0) {
return MP_VAL;
}
return mp_to_radix(a, str, (size_t)maxlen, NULL, radix);
return mp_to_radix(a, str, maxlen, NULL, radix);
}
void bn_reverse(unsigned char *s, int len)
+51 -1
View File
@@ -307,7 +307,7 @@ static Tcl_FSNormalizePathProc TestReportNormalizePath;
static Tcl_FSPathInFilesystemProc TestReportInFilesystem;
static Tcl_FSFreeInternalRepProc TestReportFreeInternalRep;
static Tcl_FSDupInternalRepProc TestReportDupInternalRep;
static Tcl_CmdProc TestServiceModeCmd;
static Tcl_FSStatProc SimpleStat;
static Tcl_FSAccessProc SimpleAccess;
static Tcl_FSOpenFileChannelProc SimpleOpenFileChannel;
@@ -561,6 +561,8 @@ Tcltest_Init(
NULL, NULL);
Tcl_CreateObjCommand(interp, "testsaveresult", TestsaveresultCmd,
NULL, NULL);
Tcl_CreateCommand(interp, "testservicemode", TestServiceModeCmd,
NULL, NULL);
Tcl_CreateCommand(interp, "testsetassocdata", TestsetassocdataCmd,
NULL, NULL);
Tcl_CreateCommand(interp, "testsetnoerr", TestsetCmd,
@@ -6046,6 +6048,54 @@ TestChannelEventCmd(
return TCL_ERROR;
}
/*
*----------------------------------------------------------------------
*
* TestServiceModeCmd --
*
* This procedure implements the "testservicemode" command which gets or
* sets the current Tcl ServiceMode. There are several tests which open
* a file and assign various handlers to it. For these tests to be
* deterministic it is important that file events not be processed until
* all of the handlers are in place.
*
* Results:
* A standard Tcl result.
*
* Side effects:
* May change the ServiceMode setting.
*
*----------------------------------------------------------------------
*/
static int
TestServiceModeCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
{
int newmode, oldmode;
if (argc > 2) {
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
" ?newmode?\"", NULL);
return TCL_ERROR;
}
oldmode = (Tcl_GetServiceMode() != TCL_SERVICE_NONE);
if (argc == 2) {
if (Tcl_GetInt(interp, argv[1], &newmode) == TCL_ERROR) {
return TCL_ERROR;
}
if (newmode == 0) {
Tcl_SetServiceMode(TCL_SERVICE_NONE);
} else {
Tcl_SetServiceMode(TCL_SERVICE_ALL);
}
}
Tcl_SetObjResult(interp, Tcl_NewIntObj(oldmode));
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
+13 -13
View File
@@ -88,13 +88,13 @@ Tcl_GetThreadData(
if (result == NULL) {
result = ckalloc(size);
memset(result, 0, (size_t) size);
memset(result, 0, size);
TclThreadStorageKeySet(keyPtr, result);
}
#else /* TCL_THREADS */
if (*keyPtr == NULL) {
result = ckalloc(size);
memset(result, 0, (size_t)size);
memset(result, 0, size);
*keyPtr = result;
RememberSyncObject(keyPtr, &keyRecord);
} else {
@@ -141,7 +141,7 @@ TclThreadDataKeyGet(
* Keep a list of (mutexes/condition variable/data key) used during
* finalization.
*
* Assume master lock is held.
* Assume global lock is held.
*
* Results:
* None.
@@ -202,7 +202,7 @@ RememberSyncObject(
* ForgetSyncObject
*
* Remove a single object from the list.
* Assume master lock is held.
* Assume global lock is held.
*
* Results:
* None.
@@ -234,7 +234,7 @@ ForgetSyncObject(
* TclRememberMutex
*
* Keep a list of mutexes used during finalization.
* Assume master lock is held.
* Assume global lock is held.
*
* Results:
* None.
@@ -276,9 +276,9 @@ Tcl_MutexFinalize(
#ifdef TCL_THREADS
TclpFinalizeMutex(mutexPtr);
#endif
TclpMasterLock();
TclpGlobalLock();
ForgetSyncObject(mutexPtr, &mutexRecord);
TclpMasterUnlock();
TclpGlobalUnlock();
}
/*
@@ -287,7 +287,7 @@ Tcl_MutexFinalize(
* TclRememberCondition
*
* Keep a list of condition variables used during finalization.
* Assume master lock is held.
* Assume global lock is held.
*
* Results:
* None.
@@ -329,9 +329,9 @@ Tcl_ConditionFinalize(
#ifdef TCL_THREADS
TclpFinalizeCondition(condPtr);
#endif
TclpMasterLock();
TclpGlobalLock();
ForgetSyncObject(condPtr, &condRecord);
TclpMasterUnlock();
TclpGlobalUnlock();
}
/*
@@ -393,7 +393,7 @@ TclFinalizeSynchronization(void)
Tcl_Mutex *mutexPtr;
Tcl_Condition *condPtr;
TclpMasterLock();
TclpGlobalLock();
#endif
/*
@@ -415,7 +415,7 @@ TclFinalizeSynchronization(void)
#ifdef TCL_THREADS
/*
* Call thread storage master cleanup.
* Call thread storage global cleanup.
*/
TclFinalizeThreadStorage();
@@ -446,7 +446,7 @@ TclFinalizeSynchronization(void)
condRecord.max = 0;
condRecord.num = 0;
TclpMasterUnlock();
TclpGlobalUnlock();
#endif /* TCL_THREADS */
}
+16 -16
View File
@@ -27,11 +27,11 @@
*/
/*
* The master collection of information about TSDs. This is shared across the
* The global collection of information about TSDs. This is shared across the
* whole process, and includes the mutex used to protect it.
*/
static struct TSDMaster {
static struct {
void *key; /* Key into the system TSD structure. The
* collection of Tcl TSD values for a
* particular thread will hang off the
@@ -41,13 +41,13 @@ static struct TSDMaster {
* increasing value. */
Tcl_Mutex mutex; /* Protection for the rest of this structure,
* which holds per-process data. */
} tsdMaster = { NULL, 0, NULL };
} tsdGlobal = { NULL, 0, NULL };
/*
* The type of the data held per thread in a system TSD.
*/
typedef struct TSDTable {
typedef struct {
ClientData *tablePtr; /* The table of Tcl TSDs. */
sig_atomic_t allocated; /* The size of the table in the current
* thread. */
@@ -57,7 +57,7 @@ typedef struct TSDTable {
* The actual type of Tcl_ThreadDataKey.
*/
typedef union TSDUnion {
typedef union {
volatile sig_atomic_t offset;
/* The type is really an offset into the
* thread-local table of TSDs, which is this
@@ -189,7 +189,7 @@ void *
TclThreadStorageKeyGet(
Tcl_ThreadDataKey *dataKeyPtr)
{
TSDTable *tsdTablePtr = TclpThreadGetMasterTSD(tsdMaster.key);
TSDTable *tsdTablePtr = TclpThreadGetGlobalTSD(tsdGlobal.key);
ClientData resultPtr = NULL;
TSDUnion *keyPtr = (TSDUnion *) dataKeyPtr;
sig_atomic_t offset = keyPtr->offset;
@@ -223,12 +223,12 @@ TclThreadStorageKeySet(
Tcl_ThreadDataKey *dataKeyPtr,
void *value)
{
TSDTable *tsdTablePtr = TclpThreadGetMasterTSD(tsdMaster.key);
TSDTable *tsdTablePtr = TclpThreadGetGlobalTSD(tsdGlobal.key);
TSDUnion *keyPtr = (TSDUnion *) dataKeyPtr;
if (tsdTablePtr == NULL) {
tsdTablePtr = TSDTableCreate();
TclpThreadSetMasterTSD(tsdMaster.key, tsdTablePtr);
TclpThreadSetGlobalTSD(tsdGlobal.key, tsdTablePtr);
}
/*
@@ -240,15 +240,15 @@ TclThreadStorageKeySet(
*/
if (keyPtr->offset == 0) {
Tcl_MutexLock(&tsdMaster.mutex);
Tcl_MutexLock(&tsdGlobal.mutex);
if (keyPtr->offset == 0) {
/*
* The Tcl_ThreadDataKey hasn't been used yet. Make a new one.
*/
keyPtr->offset = ++tsdMaster.counter;
keyPtr->offset = ++tsdGlobal.counter;
}
Tcl_MutexUnlock(&tsdMaster.mutex);
Tcl_MutexUnlock(&tsdGlobal.mutex);
}
/*
@@ -288,11 +288,11 @@ TclThreadStorageKeySet(
void
TclFinalizeThreadDataThread(void)
{
TSDTable *tsdTablePtr = TclpThreadGetMasterTSD(tsdMaster.key);
TSDTable *tsdTablePtr = TclpThreadGetGlobalTSD(tsdGlobal.key);
if (tsdTablePtr != NULL) {
TSDTableDelete(tsdTablePtr);
TclpThreadSetMasterTSD(tsdMaster.key, NULL);
TclpThreadSetGlobalTSD(tsdGlobal.key, NULL);
}
}
@@ -316,7 +316,7 @@ TclFinalizeThreadDataThread(void)
void
TclInitThreadStorage(void)
{
tsdMaster.key = TclpThreadCreateKey();
tsdGlobal.key = TclpThreadCreateKey();
}
/*
@@ -339,8 +339,8 @@ TclInitThreadStorage(void)
void
TclFinalizeThreadStorage(void)
{
TclpThreadDeleteKey(tsdMaster.key);
tsdMaster.key = NULL;
TclpThreadDeleteKey(tsdGlobal.key);
tsdGlobal.key = NULL;
}
#else /* !TCL_THREADS */
+2 -2
View File
@@ -294,7 +294,7 @@ ThreadObjCmd(
script = Tcl_GetStringFromObj(objv[2], &len);
if ((len > 1) && (script[0] == '-') && (script[1] == 'j') &&
(0 == strncmp(script, "-joinable", (size_t) len))) {
(0 == strncmp(script, "-joinable", len))) {
joinable = 1;
script = "testthread wait"; /* Just enter event loop */
} else {
@@ -311,7 +311,7 @@ ThreadObjCmd(
script = Tcl_GetStringFromObj(objv[2], &len);
joinable = ((len > 1) && (script[0] == '-') && (script[1] == 'j')
&& (0 == strncmp(script, "-joinable", (size_t) len)));
&& (0 == strncmp(script, "-joinable", len)));
script = Tcl_GetString(objv[3]);
} else {
Tcl_WrongNumArgs(interp, 2, objv, "?-joinable? ?script?");
+2 -2
View File
@@ -1689,8 +1689,8 @@ CallTraceFunction(
* Copy the command characters into a new string.
*/
commandCopy = TclStackAlloc(interp, (unsigned) numChars + 1);
memcpy(commandCopy, command, (size_t) numChars);
commandCopy = TclStackAlloc(interp, numChars + 1);
memcpy(commandCopy, command, numChars);
commandCopy[numChars] = '\0';
/*
+2 -2
View File
@@ -4263,8 +4263,8 @@ TclGetProcessGlobalValue(
if (pgvPtr->encoding != current) {
/*
* The system encoding has changed since the master string value
* was saved. Convert the master value to be based on the new
* The system encoding has changed since the global string value
* was saved. Convert the global value to be based on the new
* system encoding.
*/
+28 -5
View File
@@ -11,7 +11,7 @@
package require Tcl 8.6-
# Keep this in sync with pkgIndex.tcl and with the install directories in
# Makefiles
package provide http 2.9.2
package provide http 2.9.3
namespace eval http {
# Allow resourcing to not clobber existing data
@@ -721,7 +721,7 @@ proc http::geturl {url args} {
body {}
status ""
http ""
connection close
connection keep-alive
}
set state(-keepalive) $defaultKeepalive
set state(-strict) $strict
@@ -1037,7 +1037,7 @@ proc http::geturl {url args} {
}
# Do not automatically close the connection socket.
set state(connection) {}
set state(connection) keep-alive
}
}
@@ -2688,8 +2688,31 @@ proc http::Event {sock token} {
}
proxy-connection -
connection {
set state(connection) \
[string trim [string tolower $value]]
set tmpHeader [string trim [string tolower $value]]
# RFC 7230 Section 6.1 states that a comma-separated
# list is an acceptable value. According to
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection
# any comma-separated list implies keep-alive, but I
# don't see this in the RFC so we'll play safe and
# scan any list for "close".
if {$tmpHeader in {close keep-alive}} {
# The common cases, continue.
} elseif {[string first , $tmpHeader] == -1} {
# Not a comma-separated list, not "close",
# therefore "keep-alive".
set tmpHeader keep-alive
} else {
set tmpHeader keep-alive
set tmpCsl [split $tmpHeader ,]
# Optional whitespace either side of separator.
foreach el $tmpCsl {
if {[string trim $el] eq {close}} {
set tmpHeader close
break
}
}
}
set state(connection) $tmpHeader
}
}
lappend state(meta) $key [string trim $value]
+1 -1
View File
@@ -1,2 +1,2 @@
if {![package vsatisfies [package provide Tcl] 8.6-]} {return}
package ifneeded http 2.9.2 [list tclPkgSetup $dir http 2.9.2 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}]
package ifneeded http 2.9.3 [list tclPkgSetup $dir http 2.9.3 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}]
+8 -8
View File
@@ -811,14 +811,14 @@ namespace eval tcltest {
trace add variable Option(-errfile) write \
[namespace code {errorChannel $Option(-errfile) ;#}]
proc loadIntoSlaveInterpreter {slave args} {
proc loadIntoChildInterpreter {child args} {
variable Version
interp eval $slave [package ifneeded tcltest $Version]
interp eval $slave "tcltest::configure {*}{$args}"
interp alias $slave ::tcltest::ReportToMaster \
{} ::tcltest::ReportedFromSlave
interp eval $child [package ifneeded tcltest $Version]
interp eval $child "tcltest::configure {*}{$args}"
interp alias $child ::tcltest::ReportToParent \
{} ::tcltest::ReportedFromChild
}
proc ReportedFromSlave {total passed skipped failed because newfiles} {
proc ReportedFromChild {total passed skipped failed because newfiles} {
variable numTests
variable skippedBecause
variable createdNewFiles
@@ -2462,8 +2462,8 @@ proc tcltest::cleanupTests {{calledFromAllFile 0}} {
set testFileName [file tail [info script]]
# Hook to handle reporting to a parent interpreter
if {[llength [info commands [namespace current]::ReportToMaster]]} {
ReportToMaster $numTests(Total) $numTests(Passed) $numTests(Skipped) \
if {[llength [info commands [namespace current]::ReportToParent]]} {
ReportToParent $numTests(Total) $numTests(Passed) $numTests(Skipped) \
$numTests(Failed) [array get skippedBecause] \
[array get createdNewFiles]
set testSingleFile false
+5 -1
View File
@@ -238,12 +238,16 @@ proc ::tcl::tm::UnknownHandler {original name args} {
continue
}
if {[package ifneeded $pkgname $pkgversion] ne {}} {
if {([package ifneeded $pkgname $pkgversion] ne {})
&& (![interp issafe])
} {
# There's already a provide script registered for
# this version of this package. Since all units of
# code claiming to be the same version of the same
# package ought to be identical, just stick with
# the one we already have.
# This does not apply to Safe Base interpreters because
# the token-to-directory mapping may have changed.
continue
}
+4 -2
View File
@@ -146,7 +146,9 @@ proc tcl_startOfNextWord {str start} {
proc tcl_startOfPreviousWord {str start} {
variable ::tcl::WordBreakRE
set word {-1 -1}
regexp -indices -- $WordBreakRE(previous) [string range $str 0 $start-1] \
result word
if {$start > 0} {
regexp -indices -- $WordBreakRE(previous) [string range $str 0 $start-1] \
result word
}
return [lindex $word 0]
}
+2 -2
View File
@@ -263,7 +263,7 @@
F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtInterp.3; sourceTree = "<group>"; };
F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtMathFnc.3; sourceTree = "<group>"; };
F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtObjCmd.3; sourceTree = "<group>"; };
F96D3E2208F272A5004A47F5 /* CrtSlave.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtSlave.3; sourceTree = "<group>"; };
F96D3E2208F272A5004A47F5 /* CrtAlias.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtAlias.3; sourceTree = "<group>"; };
F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTimerHdlr.3; sourceTree = "<group>"; };
F96D3E2408F272A5004A47F5 /* CrtTrace.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTrace.3; sourceTree = "<group>"; };
F96D3E2508F272A5004A47F5 /* dde.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = dde.n; sourceTree = "<group>"; };
@@ -1013,7 +1013,7 @@
F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */,
F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */,
F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */,
F96D3E2208F272A5004A47F5 /* CrtSlave.3 */,
F96D3E2208F272A5004A47F5 /* CrtAlias.3 */,
F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */,
F96D3E2408F272A5004A47F5 /* CrtTrace.3 */,
F96D3E2508F272A5004A47F5 /* dde.n */,
+2 -2
View File
@@ -263,7 +263,7 @@
F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtInterp.3; sourceTree = "<group>"; };
F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtMathFnc.3; sourceTree = "<group>"; };
F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtObjCmd.3; sourceTree = "<group>"; };
F96D3E2208F272A5004A47F5 /* CrtSlave.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtSlave.3; sourceTree = "<group>"; };
F96D3E2208F272A5004A47F5 /* CrtAlias.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtAlias.3; sourceTree = "<group>"; };
F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTimerHdlr.3; sourceTree = "<group>"; };
F96D3E2408F272A5004A47F5 /* CrtTrace.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTrace.3; sourceTree = "<group>"; };
F96D3E2508F272A5004A47F5 /* dde.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = dde.n; sourceTree = "<group>"; };
@@ -1013,7 +1013,7 @@
F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */,
F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */,
F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */,
F96D3E2208F272A5004A47F5 /* CrtSlave.3 */,
F96D3E2208F272A5004A47F5 /* CrtAlias.3 */,
F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */,
F96D3E2408F272A5004A47F5 /* CrtTrace.3 */,
F96D3E2508F272A5004A47F5 /* dde.n */,
+1 -1
View File
@@ -106,7 +106,7 @@ OpenResourceMap(
if (tclMacOSXDarwinRelease >= 8)
#endif
{
openresourcemap = dlsym(RTLD_NEXT,
openresourcemap = (short (*)(CFBundleRef))dlsym(RTLD_NEXT,
"CFBundleOpenBundleResourceMap");
#ifdef TCL_DEBUG_LOAD
if (!openresourcemap) {
+6 -6
View File
@@ -106,7 +106,7 @@ typedef struct finderinfo {
u_int32_t extendedFileInfo[4];
} __attribute__ ((__packed__)) finderinfo;
typedef struct fileinfobuf {
typedef struct {
u_int32_t info_length;
u_int32_t data[8];
} fileinfobuf;
@@ -172,7 +172,7 @@ TclMacOSXGetFileAttribute(
} else {
alist.commonattr = ATTR_CMN_FNDRINFO;
}
native = Tcl_FSGetNativePath(fileName);
native = (const char *)Tcl_FSGetNativePath(fileName);
result = getattrlist(native, &alist, &finfo, sizeof(fileinfobuf), 0);
if (result != 0) {
@@ -268,7 +268,7 @@ TclMacOSXSetFileAttribute(
} else {
alist.commonattr = ATTR_CMN_FNDRINFO;
}
native = Tcl_FSGetNativePath(fileName);
native = (const char *)Tcl_FSGetNativePath(fileName);
result = getattrlist(native, &alist, &finfo, sizeof(fileinfobuf), 0);
if (result != 0) {
@@ -347,7 +347,7 @@ TclMacOSXSetFileAttribute(
Tcl_DStringAppend(&ds, native, -1);
Tcl_DStringAppend(&ds, _PATH_RSRCFORKSPEC, -1);
result = truncate(Tcl_DStringValue(&ds), (off_t)0);
result = truncate(Tcl_DStringValue(&ds), 0);
if (result != 0) {
/*
* truncate() on a valid resource fork path may fail with a
@@ -654,7 +654,7 @@ SetOSTypeFromAny(
OSType osType;
char bytes[4] = {'\0','\0','\0','\0'};
memcpy(bytes, Tcl_DStringValue(&ds), (size_t)Tcl_DStringLength(&ds));
memcpy(bytes, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
osType = (OSType) bytes[0] << 24 |
(OSType) bytes[1] << 16 |
(OSType) bytes[2] << 8 |
@@ -689,7 +689,7 @@ SetOSTypeFromAny(
static void
UpdateStringOfOSType(
register Tcl_Obj *objPtr) /* OSType object whose string rep to
Tcl_Obj *objPtr) /* OSType object whose string rep to
* update. */
{
char string[5];
+102 -45
View File
@@ -14,6 +14,18 @@
*/
#include "tclInt.h"
/*
* In macOS 10.12 the os_unfair_lock was introduced as a replacement for the
* OSSpinLock, and the OSSpinLock was deprecated.
*/
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
#define USE_OS_UNFAIR_LOCK
#include <os/lock.h>
#undef TCL_MAC_DEBUG_NOTIFIER
#endif
#ifdef HAVE_COREFOUNDATION /* Traditional unix select-based notifier is
* in tclUnixNotfy.c */
#include <CoreFoundation/CoreFoundation.h>
@@ -21,6 +33,8 @@
/* #define TCL_MAC_DEBUG_NOTIFIER 1 */
#if !defined(USE_OS_UNFAIR_LOCK)
/*
* We use the Darwin-native spinlock API rather than pthread mutexes for
* notifier locking: this radically simplifies the implementation and lowers
@@ -31,6 +45,9 @@
*/
#if defined(HAVE_LIBKERN_OSATOMIC_H) && defined(HAVE_OSSPINLOCKLOCK)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#pragma GCC diagnostic ignored "-Wunused-function"
/*
* Use OSSpinLock API where available (Tiger or later).
*/
@@ -42,14 +59,17 @@
* Support for weakly importing spinlock API.
*/
#define WEAK_IMPORT_SPINLOCKLOCK
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
#define VOLATILE volatile
#else
#define VOLATILE
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */
#ifndef bool
#define bool int
#endif
extern void OSSpinLockLock(VOLATILE OSSpinLock *lock)
WEAK_IMPORT_ATTRIBUTE;
extern void OSSpinLockUnlock(VOLATILE OSSpinLock *lock)
@@ -101,27 +121,47 @@ extern int _spin_lock_try(OSSpinLock *lock);
#define SpinLockTry(p) _spin_lock_try(p)
#define SPINLOCK_INIT 0
#pragma GCC diagnostic pop
#endif /* HAVE_LIBKERN_OSATOMIC_H && HAVE_OSSPINLOCKLOCK */
#endif /* not using os_unfair_lock */
/*
* These spinlocks lock access to the global notifier state.
* These locks control access to the global notifier state.
*/
#if defined(USE_OS_UNFAIR_LOCK)
static os_unfair_lock notifierInitLock = OS_UNFAIR_LOCK_INIT;
static os_unfair_lock notifierLock = OS_UNFAIR_LOCK_INIT;
#else
static OSSpinLock notifierInitLock = SPINLOCK_INIT;
static OSSpinLock notifierLock = SPINLOCK_INIT;
#endif
/*
* Macros abstracting notifier locking/unlocking
* Macros that abstract notifier locking/unlocking
*/
#if defined(USE_OS_UNFAIR_LOCK)
#define LOCK_NOTIFIER_INIT os_unfair_lock_lock(&notifierInitLock)
#define UNLOCK_NOTIFIER_INIT os_unfair_lock_unlock(&notifierInitLock)
#define LOCK_NOTIFIER os_unfair_lock_lock(&notifierLock)
#define UNLOCK_NOTIFIER os_unfair_lock_unlock(&notifierLock)
#define LOCK_NOTIFIER_TSD os_unfair_lock_lock(&tsdPtr->tsdLock)
#define UNLOCK_NOTIFIER_TSD os_unfair_lock_unlock(&tsdPtr->tsdLock)
#else
#define LOCK_NOTIFIER_INIT SpinLockLock(&notifierInitLock)
#define UNLOCK_NOTIFIER_INIT SpinLockUnlock(&notifierInitLock)
#define LOCK_NOTIFIER SpinLockLock(&notifierLock)
#define UNLOCK_NOTIFIER SpinLockUnlock(&notifierLock)
#define LOCK_NOTIFIER_TSD SpinLockLock(&tsdPtr->tsdLock)
#define UNLOCK_NOTIFIER_TSD SpinLockUnlock(&tsdPtr->tsdLock)
#endif
#ifdef TCL_MAC_DEBUG_NOTIFIER
/*
* The debug version of the Notifier only works if using OSSpinLock.
*/
#if defined(TCL_MAC_DEBUG_NOTIFIER) && !defined(USE_OS_UNFAIR_LOCK)
#define TclMacOSXNotifierDbgMsg(m, ...) \
do { \
fprintf(notifierLog?notifierLog:stderr, "tclMacOSXNotify.c:%d: " \
@@ -148,7 +188,7 @@ static OSSpinLock notifierLock = SPINLOCK_INIT;
#undef LOCK_NOTIFIER
#define LOCK_NOTIFIER SpinLockLockDbg(&notifierLock)
#undef LOCK_NOTIFIER_TSD
#define LOCK_NOTIFIER_TSD SpinLockLockDbg(&tsdPtr->tsdLock)
#define LOCK_NOTIFIER_TSD SpinLockLockDbg(tsdPtr->tsdLock)
#include <asl.h>
static FILE *notifierLog = NULL;
#ifndef NOTIFIER_LOG
@@ -217,7 +257,7 @@ typedef struct FileHandler {
* handlers are ready to fire.
*/
typedef struct FileHandlerEvent {
typedef struct {
Tcl_Event header; /* Information that is standard for all
* events. */
int fd; /* File descriptor that is ready. Used to find
@@ -232,7 +272,7 @@ typedef struct FileHandlerEvent {
* writable, and exceptional conditions.
*/
typedef struct SelectMasks {
typedef struct {
fd_set readable;
fd_set writable;
fd_set exceptional;
@@ -255,8 +295,6 @@ typedef struct ThreadSpecificData {
int runLoopRunning; /* True if this thread's Tcl runLoop is
* running. */
int runLoopNestingLevel; /* Level of nested runLoop invocations. */
int runLoopServicingEvents; /* True if this thread's runLoop is servicing
* Tcl events. */
/* Must hold the notifierLock before accessing the following fields: */
/* Start notifierLock section */
@@ -269,9 +307,14 @@ typedef struct ThreadSpecificData {
* from these pointers. */
/* End notifierLock section */
#if defined(USE_OS_UNFAIR_LOCK)
os_unfair_lock tsdLock;
#else
OSSpinLock tsdLock; /* Must hold this lock before acessing the
* following fields from more than one
* thread. */
#endif
/* Start tsdLock section */
SelectMasks checkMasks; /* This structure is used to build up the
* masks to be used in the next call to
@@ -457,7 +500,6 @@ Tcl_InitNotifier(void)
/*
* Initialize support for weakly imported spinlock API.
*/
if (pthread_once(&spinLockLockInitControl, SpinLockLockInit)) {
Tcl_Panic("Tcl_InitNotifier: pthread_once failed");
}
@@ -494,7 +536,7 @@ Tcl_InitNotifier(void)
bzero(&runLoopObserverContext, sizeof(CFRunLoopObserverContext));
runLoopObserverContext.info = tsdPtr;
runLoopObserver = CFRunLoopObserverCreate(NULL,
kCFRunLoopEntry|kCFRunLoopExit|kCFRunLoopBeforeWaiting, TRUE,
kCFRunLoopEntry|kCFRunLoopExit, TRUE,
LONG_MIN, UpdateWaitingListAndServiceEvents,
&runLoopObserverContext);
if (!runLoopObserver) {
@@ -512,7 +554,7 @@ Tcl_InitNotifier(void)
*/
runLoopObserverTcl = CFRunLoopObserverCreate(NULL,
kCFRunLoopEntry|kCFRunLoopExit|kCFRunLoopBeforeWaiting, TRUE,
kCFRunLoopEntry|kCFRunLoopExit, TRUE,
LONG_MIN, UpdateWaitingListAndServiceEvents,
&runLoopObserverContext);
if (!runLoopObserverTcl) {
@@ -528,7 +570,11 @@ Tcl_InitNotifier(void)
tsdPtr->runLoopObserverTcl = runLoopObserverTcl;
tsdPtr->runLoopTimer = NULL;
tsdPtr->waitTime = CF_TIMEINTERVAL_FOREVER;
#if defined(USE_OS_UNFAIR_LOCK)
tsdPtr->tsdLock = OS_UNFAIR_LOCK_INIT;
#else
tsdPtr->tsdLock = SPINLOCK_INIT;
#endif
}
LOCK_NOTIFIER_INIT;
@@ -586,7 +632,6 @@ Tcl_InitNotifier(void)
ENABLE_ASL;
notifierCount++;
UNLOCK_NOTIFIER_INIT;
return tsdPtr;
}
@@ -686,7 +731,7 @@ StartNotifierThread(void)
void
Tcl_FinalizeNotifier(
ClientData clientData) /* Not used. */
ClientData clientData)
{
ThreadSpecificData *tsdPtr;
@@ -789,7 +834,7 @@ void
Tcl_AlertNotifier(
ClientData clientData)
{
ThreadSpecificData *tsdPtr = clientData;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)clientData;
if (tclNotifierHooks.alertNotifierProc) {
tclNotifierHooks.alertNotifierProc(clientData);
@@ -967,7 +1012,7 @@ Tcl_CreateFileHandler(
}
}
if (filePtr == NULL) {
filePtr = ckalloc(sizeof(FileHandler));
filePtr = (FileHandler *)ckalloc(sizeof(FileHandler));
filePtr->fd = fd;
filePtr->readyMask = 0;
filePtr->nextPtr = tsdPtr->firstFileHandlerPtr;
@@ -1222,6 +1267,10 @@ Tcl_WaitForEvent(
Tcl_Panic("Tcl_WaitForEvent: Notifier not initialized");
}
/*
* A NULL timePtr means wait forever.
*/
if (timePtr) {
Tcl_Time vTime = *timePtr;
@@ -1235,14 +1284,23 @@ Tcl_WaitForEvent(
tclScaleTimeProcPtr(&vTime, tclTimeClientData);
waitTime = vTime.sec + 1.0e-6 * vTime.usec;
} else {
/*
* Polling: pretend to wait for files and tell the notifier thread
* what we are doing. The notifier thread makes sure it goes
* through select with its select mask in the same state as ours
* currently is. We block until that happens.
* The max block time was set to 0.
*
* If we set the waitTime to 0, then the call to CFRunLoopInMode
* may return without processing all of its sources. The Apple
* documentation says that if the waitTime is 0 "only one pass is
* made through the run loop before returning; if multiple sources
* or timers are ready to fire immediately, only one (possibly two
* if one is a version 0 source) will be fired, regardless of the
* value of returnAfterSourceHandled." This can cause some chanio
* tests to fail. So we use a small positive waitTime unless there
* is another RunLoop running.
*/
polling = 1;
waitTime = tsdPtr->runLoopRunning ? 0 : 0.0001;
}
}
@@ -1255,18 +1313,18 @@ Tcl_WaitForEvent(
/*
* If the Tcl runloop is already running (e.g. if Tcl_WaitForEvent was
* called recursively) or is servicing events via the runloop observer,
* re-run it in a custom runloop mode containing only the source for the
* notifier thread, otherwise wakeups from other sources added to the
* common runloop modes might get lost or 3rd party event handlers might
* get called when they do not expect to be.
* called recursively) start a new runloop in a custom runloop mode
* containing only the source for the notifier thread. Otherwise wakeups
* from other sources added to the common runloop mode might get lost or
* 3rd party event handlers might get called when they do not expect to
* be.
*/
runLoopRunning = tsdPtr->runLoopRunning;
tsdPtr->runLoopRunning = 1;
runLoopStatus = CFRunLoopRunInMode(tsdPtr->runLoopServicingEvents ||
runLoopRunning ? tclEventsOnlyRunLoopMode : kCFRunLoopDefaultMode,
waitTime, TRUE);
runLoopStatus = CFRunLoopRunInMode(
runLoopRunning ? tclEventsOnlyRunLoopMode : kCFRunLoopDefaultMode,
waitTime, TRUE);
tsdPtr->runLoopRunning = runLoopRunning;
LOCK_NOTIFIER_TSD;
@@ -1311,7 +1369,7 @@ QueueFileEvents(
{
SelectMasks readyMasks;
FileHandler *filePtr;
ThreadSpecificData *tsdPtr = info;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)info;
/*
* Queue all detected file events.
@@ -1350,7 +1408,7 @@ QueueFileEvents(
*/
if (filePtr->readyMask == 0) {
FileHandlerEvent *fileEvPtr = ckalloc(sizeof(FileHandlerEvent));
FileHandlerEvent *fileEvPtr = (FileHandlerEvent *)ckalloc(sizeof(FileHandlerEvent));
fileEvPtr->header.proc = FileHandlerEventProc;
fileEvPtr->fd = filePtr->fd;
@@ -1383,8 +1441,7 @@ UpdateWaitingListAndServiceEvents(
CFRunLoopActivity activity,
void *info)
{
ThreadSpecificData *tsdPtr = info;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)info;
if (tsdPtr->sleeping) {
return;
}
@@ -1407,16 +1464,6 @@ UpdateWaitingListAndServiceEvents(
}
tsdPtr->runLoopNestingLevel--;
break;
case kCFRunLoopBeforeWaiting:
if (tsdPtr->runLoopTimer && !tsdPtr->runLoopServicingEvents &&
(tsdPtr->runLoopNestingLevel > 1
|| !tsdPtr->runLoopRunning)) {
tsdPtr->runLoopServicingEvents = 1;
/* This call seems to simply force event processing through and prevents hangups that have long been observed with Tk-Cocoa. */
Tcl_ServiceAll();
tsdPtr->runLoopServicingEvents = 0;
}
break;
default:
break;
}
@@ -1449,7 +1496,7 @@ OnOffWaitingList(
{
int changeWaitingList;
#ifdef TCL_MAC_DEBUG_NOTIFIER
#if defined(TCL_MAC_DEBUG_NOTIFIER) && !defined(USE_OS_UNFAIR_LOCK)
if (SpinLockTry(&notifierLock)) {
Tcl_Panic("OnOffWaitingList: notifierLock unlocked");
}
@@ -1980,9 +2027,19 @@ AtForkChild(void)
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
UNLOCK_NOTIFIER_TSD;
UNLOCK_NOTIFIER;
UNLOCK_NOTIFIER_INIT;
/*
* If a child process unlocks an os_unfair_lock that was created in its parent
* the child will exit with an illegal instruction error. So we reinitialize
* the lock in the child rather than attempt to unlock it.
*/
#if defined(USE_OS_UNFAIR_LOCK)
tsdPtr->tsdLock = OS_UNFAIR_LOCK_INIT;
#else
UNLOCK_NOTIFIER_TSD;
UNLOCK_NOTIFIER;
UNLOCK_NOTIFIER_INIT;
#endif
if (tsdPtr->runLoop) {
tsdPtr->runLoop = NULL;
if (!noCFafterFork) {
+136 -102
View File
@@ -39,10 +39,10 @@ namespace eval ::tcl::test::io {
testConstraint testbytestring [llength [info commands testbytestring]]
testConstraint testchannel [llength [info commands testchannel]]
testConstraint openpipe 1
testConstraint testfevent [llength [info commands testfevent]]
testConstraint testchannelevent [llength [info commands testchannelevent]]
testConstraint testmainthread [llength [info commands testmainthread]]
testConstraint testservicemode [llength [info commands testservicemode]]
testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}]
# You need a *very* special environment to do some tests. In particular,
@@ -448,7 +448,7 @@ test chan-io-6.6 {Tcl_GetsObj: loop test} -body {
} -cleanup {
chan close $f
} -result [list 256 $a]
test chan-io-6.7 {Tcl_GetsObj: error in input} -constraints {stdio openpipe} -body {
test chan-io-6.7 {Tcl_GetsObj: error in input} -constraints stdio -body {
# if (FilterInputBytes(chanPtr, &gs) != 0)
set f [openpipe w+ $path(cat)]
chan puts -nonewline $f "hi\nwould"
@@ -709,7 +709,7 @@ test chan-io-6.30 {Tcl_GetsObj: crlf mode: buffer exhausted} -constraints {testc
} -result [list 15 "123456789012345" 15]
test chan-io-6.31 {Tcl_GetsObj: crlf mode: buffer exhausted, blocked} -setup {
set x ""
} -constraints {stdio testchannel openpipe fileevent} -body {
} -constraints {stdio testchannel fileevent} -body {
# (FilterInputBytes() != 0)
set f [openpipe w+ $path(cat)]
chan configure $f -translation {crlf lf} -buffering none
@@ -849,7 +849,7 @@ test chan-io-6.42 {Tcl_GetsObj: auto mode: several chars} -setup {
} -result {4 abcd 4 efgh 4 ijkl 4 mnop -1 {}}
test chan-io-6.43 {Tcl_GetsObj: input saw cr} -setup {
set x ""
} -constraints {stdio testchannel openpipe fileevent} -body {
} -constraints {stdio testchannel fileevent} -body {
# if (chanPtr->flags & INPUT_SAW_CR)
set f [openpipe w+ $path(cat)]
chan configure $f -translation {auto lf} -buffering none
@@ -867,7 +867,7 @@ test chan-io-6.43 {Tcl_GetsObj: input saw cr} -setup {
} -result {bbbbbbbbbbbbbbb 15 123456789abcdef 1 4 abcd 0 3 efg}
test chan-io-6.44 {Tcl_GetsObj: input saw cr, not followed by cr} -setup {
set x ""
} -constraints {stdio testchannel openpipe fileevent} -body {
} -constraints {stdio testchannel fileevent} -body {
# not (*eol == '\n')
set f [openpipe w+ $path(cat)]
chan configure $f -translation {auto lf} -buffering none
@@ -885,7 +885,7 @@ test chan-io-6.44 {Tcl_GetsObj: input saw cr, not followed by cr} -setup {
} -result {bbbbbbbbbbbbbbb 15 123456789abcdef 1 4 abcd 0 3 efg}
test chan-io-6.45 {Tcl_GetsObj: input saw cr, skip right number of bytes} -setup {
set x ""
} -constraints {stdio testchannel openpipe fileevent} -body {
} -constraints {stdio testchannel fileevent} -body {
# Tcl_ExternalToUtf()
set f [openpipe w+ $path(cat)]
chan configure $f -translation {auto lf} -buffering none
@@ -903,7 +903,7 @@ test chan-io-6.45 {Tcl_GetsObj: input saw cr, skip right number of bytes} -setup
} -result {15 123456789abcdef 1 4 abcd 0}
test chan-io-6.46 {Tcl_GetsObj: input saw cr, followed by just \n should give eof} -setup {
set x ""
} -constraints {stdio testchannel openpipe fileevent} -body {
} -constraints {stdio testchannel fileevent} -body {
# memmove()
set f [openpipe w+ $path(cat)]
chan configure $f -translation {auto lf} -buffering none
@@ -1021,7 +1021,7 @@ test chan-io-6.55 {Tcl_GetsObj: overconverted} -body {
test chan-io-6.56 {Tcl_GetsObj: incomplete lines should disable file events} -setup {
update
variable x {}
} -constraints {stdio openpipe fileevent} -body {
} -constraints {stdio fileevent} -body {
set f [openpipe w+ $path(cat)]
chan configure $f -buffering none
chan puts -nonewline $f "foobar"
@@ -1088,7 +1088,7 @@ test chan-io-7.3 {FilterInputBytes: split up character at EOF} -setup {
} -result [list 15 "1234567890123\uff10\uff11" 18 0 1 -1 ""]
test chan-io-7.4 {FilterInputBytes: recover from split up character} -setup {
variable x ""
} -constraints {stdio openpipe fileevent} -body {
} -constraints {stdio fileevent} -body {
set f [openpipe w+ $path(cat)]
chan configure $f -encoding binary -buffering none
chan puts -nonewline $f "1234567890123\x82\x4f\x82\x50\x82"
@@ -1122,7 +1122,7 @@ test chan-io-8.1 {PeekAhead: only go to device if no more cached data} -constrai
} -result 7
test chan-io-8.2 {PeekAhead: only go to device if no more cached data} -setup {
variable x {}
} -constraints {stdio testchannel openpipe fileevent} -body {
} -constraints {stdio testchannel fileevent} -body {
# not (bufPtr->nextPtr == NULL)
set f [openpipe w+ $path(cat)]
chan configure $f -translation lf -encoding ascii -buffering none
@@ -1139,7 +1139,7 @@ test chan-io-8.2 {PeekAhead: only go to device if no more cached data} -setup {
} -cleanup {
chan close $f
} -result {-1 {} 42 15 123456789012345 25}
test chan-io-8.3 {PeekAhead: no cached data available} -constraints {stdio testchannel openpipe fileevent} -body {
test chan-io-8.3 {PeekAhead: no cached data available} -constraints {stdio testchannel fileevent} -body {
# (bytesLeft == 0)
set f [openpipe w+ $path(cat)]
chan configure $f -translation {auto binary}
@@ -1168,7 +1168,7 @@ test chan-io-8.4 {PeekAhead: cached data available in this buffer} -body {
chan close $f
} -result $a
unset a
test chan-io-8.5 {PeekAhead: don't peek if last read was short} -constraints {stdio testchannel openpipe fileevent} -body {
test chan-io-8.5 {PeekAhead: don't peek if last read was short} -constraints {stdio testchannel fileevent} -body {
# (bufPtr->nextAdded < bufPtr->length)
set f [openpipe w+ $path(cat)]
chan configure $f -translation {auto binary}
@@ -1179,7 +1179,7 @@ test chan-io-8.5 {PeekAhead: don't peek if last read was short} -constraints {st
} -cleanup {
chan close $f
} -result {15 abcdefghijklmno 1}
test chan-io-8.6 {PeekAhead: change to non-blocking mode} -constraints {stdio testchannel openpipe fileevent} -body {
test chan-io-8.6 {PeekAhead: change to non-blocking mode} -constraints {stdio testchannel fileevent} -body {
# ((chanPtr->flags & CHANNEL_NONBLOCKING) == 0)
set f [openpipe w+ $path(cat)]
chan configure $f -translation {auto binary} -buffersize 16
@@ -1192,7 +1192,7 @@ test chan-io-8.6 {PeekAhead: change to non-blocking mode} -constraints {stdio te
} -result {15 abcdefghijklmno 1}
test chan-io-8.7 {PeekAhead: cleanup} -setup {
set x ""
} -constraints {stdio testchannel openpipe fileevent} -body {
} -constraints {stdio testchannel fileevent} -body {
# Make sure bytes are removed from buffer.
set f [openpipe w+ $path(cat)]
chan configure $f -translation {auto binary} -buffering none
@@ -1343,7 +1343,7 @@ test chan-io-12.3 {ReadChars: allocate more space} -body {
} -result {abcdefghijklmnopqrstuvwxyz}
test chan-io-12.4 {ReadChars: split-up char} -setup {
variable x {}
} -constraints {stdio testchannel openpipe fileevent} -body {
} -constraints {stdio testchannel fileevent} -body {
# (srcRead == 0)
set f [openpipe w+ $path(cat)]
chan configure $f -encoding binary -buffering none -buffersize 16
@@ -1365,7 +1365,7 @@ test chan-io-12.4 {ReadChars: split-up char} -setup {
} -result [list "123456789012345" 1 "\u672c" 0]
test chan-io-12.5 {ReadChars: chan events on partial characters} -setup {
variable x {}
} -constraints {stdio openpipe fileevent} -body {
} -constraints {stdio fileevent} -body {
set path(test1) [makeFile {
chan configure stdout -encoding binary -buffering none
chan gets stdin; chan puts -nonewline "\xe7"
@@ -1458,7 +1458,7 @@ test chan-io-13.5 {TranslateInputEOL: crlf mode: naked lf} -body {
test chan-io-13.6 {TranslateInputEOL: auto mode: saw cr in last segment} -setup {
variable x {}
variable y {}
} -constraints {stdio testchannel openpipe fileevent} -body {
} -constraints {stdio testchannel fileevent} -body {
# (chanPtr->flags & INPUT_SAW_CR)
# This test may fail on slower machines.
set f [openpipe w+ $path(cat)]
@@ -1476,7 +1476,7 @@ test chan-io-13.6 {TranslateInputEOL: auto mode: saw cr in last segment} -setup
} -cleanup {
chan close $f
} -result [list "abcdefghj\n" 1 "01234" 0]
test chan-io-13.7 {TranslateInputEOL: auto mode: naked \r} -constraints {testchannel openpipe} -body {
test chan-io-13.7 {TranslateInputEOL: auto mode: naked \r} -constraints testchannel -body {
# (src >= srcMax)
set f [open $path(test1) w]
chan configure $f -translation lf
@@ -1577,7 +1577,7 @@ test chan-io-14.2 {Tcl_SetStdChannel and Tcl_GetStdChannel} -setup {
interp delete x
} -result {line line none}
set path(test3) [makeFile {} test3]
test chan-io-14.3 {Tcl_SetStdChannel & Tcl_GetStdChannel} -constraints {exec openpipe} -body {
test chan-io-14.3 {Tcl_SetStdChannel & Tcl_GetStdChannel} -constraints exec -body {
set f [open $path(test1) w]
chan puts -nonewline $f {
chan close stdin
@@ -1674,7 +1674,7 @@ set path(script) [makeFile {} script]
test chan-io-14.8 {reuse of stdio special channels} -setup {
file delete $path(script)
file delete $path(test1)
} -constraints {stdio openpipe} -body {
} -constraints stdio -body {
set f [open $path(script) w]
chan puts -nonewline $f {
chan close stderr
@@ -1697,7 +1697,7 @@ test chan-io-14.8 {reuse of stdio special channels} -setup {
test chan-io-14.9 {reuse of stdio special channels} -setup {
file delete $path(script)
file delete $path(test1)
} -constraints {stdio openpipe fileevent} -body {
} -constraints {stdio fileevent} -body {
set f [open $path(script) w]
chan puts $f {
array set path [lindex $argv 0]
@@ -1881,7 +1881,7 @@ test chan-io-20.3 {Tcl_CreateChannel: initial settings} -constraints {unix} -bod
} -result {{{} {}} {auto lf}}
test chan-io-20.5 {Tcl_CreateChannel: install channel in empty slot} -setup {
set path(stdout) [makeFile {} stdout]
} -constraints {stdio openpipe knownMsvcBug} -body {
} -constraints {stdio knownMsvcBug} -body {
set f [open $path(script) w]
chan puts -nonewline $f {
chan close stdout
@@ -1966,7 +1966,7 @@ test chan-io-26.1 {Tcl_GetChannelInstanceData} -body {
# Don't care what pid is (but must be a number), just want to exercise it.
set f [openpipe r << exit]
pid $f
} -constraints {stdio openpipe} -cleanup {
} -constraints stdio -cleanup {
chan close $f
} -match regexp -result {^\d+$}
@@ -2041,7 +2041,7 @@ set path(output) [makeFile {} output]
test chan-io-27.6 {FlushChannel, async flushing, async chan close} -setup {
file delete $path(pipe)
file delete $path(output)
} -constraints {stdio asyncPipeChan Close openpipe} -body {
} -constraints {stdio asyncPipeChan Close} -body {
set f [open $path(pipe) w]
chan puts $f "set f \[[list open $path(output) w]]"
chan puts $f {
@@ -2111,7 +2111,7 @@ test chan-io-28.2 {Chan CloseChannel called when all references are dropped} -se
test chan-io-28.3 {Chan CloseChannel, not called before output queue is empty} -setup {
file delete $path(pipe)
file delete $path(output)
} -constraints {stdio asyncPipeChan Close nonPortable openpipe} -body {
} -constraints {stdio asyncPipeChan Close nonPortable} -body {
set f [open $path(pipe) w]
chan puts $f {
# Need to not have eof char appended on chan close, because the other
@@ -2165,7 +2165,7 @@ test chan-io-28.4 {Tcl_Chan Close} -constraints {testchannel} -setup {
} -result ok
test chan-io-28.5 {Tcl_Chan Close vs standard handles} -setup {
file delete $path(script)
} -constraints {stdio unix testchannel openpipe} -body {
} -constraints {stdio unix testchannel} -body {
set f [open $path(script) w]
chan puts $f {
chan close stdin
@@ -2382,7 +2382,7 @@ test chan-io-29.11 {Tcl_WriteChars, no newline, implicit flush} -setup {
test chan-io-29.12 {Tcl_WriteChars on a pipe} -setup {
file delete $path(test1)
file delete $path(pipe)
} -constraints {stdio openpipe} -body {
} -constraints stdio -body {
set f1 [open $path(pipe) w]
chan puts $f1 "set f1 \[[list open $path(longfile) r]]"
chan puts $f1 {
@@ -2409,7 +2409,7 @@ test chan-io-29.12 {Tcl_WriteChars on a pipe} -setup {
test chan-io-29.13 {Tcl_WriteChars to a pipe, line buffered} -setup {
file delete $path(test1)
file delete $path(pipe)
} -constraints {stdio openpipe} -body {
} -constraints stdio -body {
set f1 [open $path(pipe) w]
chan puts $f1 {
chan puts [chan gets stdin]
@@ -2462,7 +2462,7 @@ test chan-io-29.15 {Tcl_Flush, channel not open for writing} -setup {
} -match glob -result {channel "*" wasn't opened for writing}
test chan-io-29.16 {Tcl_Flush on pipe opened only for reading} -setup {
set fd [openpipe r cat longfile]
} -constraints {stdio openpipe} -body {
} -constraints stdio -body {
chan flush $fd
} -returnCodes error -cleanup {
catch {chan close $fd}
@@ -2538,7 +2538,7 @@ test chan-io-29.20 {Implicit flush when buffer is full} -setup {
} -result {4096 12288 12600}
test chan-io-29.21 {Tcl_Flush to pipe} -setup {
file delete $path(pipe)
} -constraints {stdio openpipe} -body {
} -constraints stdio -body {
set f1 [open $path(pipe) w]
chan puts $f1 {set x [chan read stdin 6]}
chan puts $f1 {set cnt [string length $x]}
@@ -2553,7 +2553,7 @@ test chan-io-29.21 {Tcl_Flush to pipe} -setup {
} -result "read 6 characters"
test chan-io-29.22 {Tcl_Flush called at other end of pipe} -setup {
file delete $path(pipe)
} -constraints {stdio openpipe} -body {
} -constraints stdio -body {
set f1 [open $path(pipe) w]
chan puts $f1 {
chan configure stdout -buffering full
@@ -2577,7 +2577,7 @@ test chan-io-29.22 {Tcl_Flush called at other end of pipe} -setup {
} -result {hello hello bye}
test chan-io-29.23 {Tcl_Flush and line buffering at end of pipe} -setup {
file delete $path(pipe)
} -constraints {stdio openpipe} -body {
} -constraints stdio -body {
set f1 [open $path(pipe) w]
chan puts $f1 {
chan puts hello
@@ -2614,7 +2614,7 @@ test chan-io-29.24 {Tcl_WriteChars and Tcl_Flush move end of file} -setup {
} -result "{} {Line 1\nLine 2}"
test chan-io-29.25 {Implicit flush with Tcl_Flush to command pipelines} -setup {
file delete $path(test3)
} -constraints {stdio openpipe fileevent} -body {
} -constraints {stdio fileevent} -body {
set f [openpipe w $path(cat) | [interpreter] $path(cat) > $path(test3)]
chan puts $f "Line 1"
chan puts $f "Line 2"
@@ -2625,7 +2625,7 @@ test chan-io-29.25 {Implicit flush with Tcl_Flush to command pipelines} -setup {
} -cleanup {
chan close $f
} -result "Line 1\nLine 2\n"
test chan-io-29.26 {Tcl_Flush, Tcl_Write on bidirectional pipelines} -constraints {stdio unixExecs openpipe} -body {
test chan-io-29.26 {Tcl_Flush, Tcl_Write on bidirectional pipelines} -constraints {stdio unixExecs} -body {
set f [open "|[list cat -u]" r+]
chan puts $f "Line1"
chan flush $f
@@ -2638,7 +2638,7 @@ test chan-io-29.27 {Tcl_Flush on chan closed pipeline} -setup {
set f [open $path(pipe) w]
chan puts $f {exit}
chan close $f
} -constraints {stdio openpipe} -body {
} -constraints stdio -body {
set f [openpipe r+ $path(pipe)]
chan gets $f
chan puts $f output
@@ -2691,7 +2691,7 @@ test chan-io-29.30 {Tcl_WriteChars, crlf mode} -setup {
test chan-io-29.31 {Tcl_WriteChars, background flush} -setup {
file delete $path(pipe)
file delete $path(output)
} -constraints {stdio openpipe} -body {
} -constraints stdio -body {
set f [open $path(pipe) w]
chan puts $f "set f \[[list open $path(output) w]]"
chan puts $f {chan configure $f -translation lf}
@@ -2732,7 +2732,7 @@ test chan-io-29.31 {Tcl_WriteChars, background flush} -setup {
test chan-io-29.32 {Tcl_WriteChars, background flush to slow reader} -setup {
file delete $path(pipe)
file delete $path(output)
} -constraints {stdio asyncPipeChan Close openpipe} -body {
} -constraints {stdio asyncPipeChan Close} -body {
set f [open $path(pipe) w]
chan puts $f "set f \[[list open $path(output) w]]"
chan puts $f {chan configure $f -translation lf}
@@ -4005,7 +4005,7 @@ test chan-io-32.9 {Tcl_Read, read to end of file} {
} ok
test chan-io-32.10 {Tcl_Read from a pipe} -setup {
file delete $path(pipe)
} -constraints {stdio openpipe} -body {
} -constraints stdio -body {
set f1 [open $path(pipe) w]
chan puts $f1 {chan puts [chan gets stdin]}
chan close $f1
@@ -4019,7 +4019,7 @@ test chan-io-32.10 {Tcl_Read from a pipe} -setup {
test chan-io-32.11 {Tcl_Read from a pipe} -setup {
file delete $path(pipe)
set x ""
} -constraints {stdio openpipe} -body {
} -constraints stdio -body {
set f1 [open $path(pipe) w]
chan puts $f1 {chan puts [chan gets stdin]}
chan puts $f1 {chan puts [chan gets stdin]}
@@ -4131,7 +4131,7 @@ test chan-io-33.2 {Tcl_Gets into variable} {
} ok
test chan-io-33.3 {Tcl_Gets from pipe} -setup {
file delete $path(pipe)
} -constraints {stdio openpipe} -body {
} -constraints stdio -body {
set f1 [open $path(pipe) w]
chan puts $f1 {chan puts [chan gets stdin]}
chan close $f1
@@ -4341,7 +4341,7 @@ test chan-io-34.7 {Tcl_Seek to offset from end of file, then to current position
} -result {44 rstuv 49}
test chan-io-34.8 {Tcl_Seek on pipes: not supported} -setup {
set pipe [openpipe]
} -constraints {stdio openpipe} -body {
} -constraints stdio -body {
chan seek $pipe 0 current
} -returnCodes error -cleanup {
chan close $pipe
@@ -4451,13 +4451,13 @@ test chan-io-34.15 {Tcl_Tell combined with seeking} -setup {
} -cleanup {
chan close $f1
} -result {10 20}
test chan-io-34.16 {Tcl_Tell on pipe: always -1} -constraints {stdio openpipe} -body {
test chan-io-34.16 {Tcl_Tell on pipe: always -1} -constraints stdio -body {
set f1 [openpipe]
chan tell $f1
} -cleanup {
chan close $f1
} -result -1
test chan-io-34.17 {Tcl_Tell on pipe: always -1} {stdio openpipe} {
test chan-io-34.17 {Tcl_Tell on pipe: always -1} stdio {
set f1 [openpipe]
chan puts $f1 {chan puts hello}
chan flush $f1
@@ -4559,7 +4559,7 @@ test chan-io-35.1 {Tcl_Eof} -setup {
} -cleanup {
chan close $f
} -result {0 0 0 0 1 1}
test chan-io-35.2 {Tcl_Eof with pipe} -constraints {stdio openpipe} -setup {
test chan-io-35.2 {Tcl_Eof with pipe} -constraints stdio -setup {
file delete $path(pipe)
} -body {
set f1 [open $path(pipe) w]
@@ -4578,7 +4578,7 @@ test chan-io-35.2 {Tcl_Eof with pipe} -constraints {stdio openpipe} -setup {
} -cleanup {
chan close $f1
} -result {0 0 0 1}
test chan-io-35.3 {Tcl_Eof with pipe} -constraints {stdio openpipe} -setup {
test chan-io-35.3 {Tcl_Eof with pipe} -constraints stdio -setup {
file delete $path(pipe)
} -body {
set f1 [open $path(pipe) w]
@@ -4616,7 +4616,7 @@ test chan-io-35.4 {Tcl_Eof, eof detection on nonblocking file} -setup {
test chan-io-35.5 {Tcl_Eof, eof detection on nonblocking pipe} -setup {
file delete $path(pipe)
set l ""
} -constraints {stdio openpipe} -body {
} -constraints stdio -body {
set f [open $path(pipe) w]
chan puts $f {
exit
@@ -4801,7 +4801,7 @@ test chan-io-35.17 {Tcl_Eof, eof char in middle, crlf write, crlf read} -setup {
test chan-io-36.1 {Tcl_InputBlocked on nonblocking pipe} -setup {
set x ""
} -constraints {stdio openpipe} -body {
} -constraints stdio -body {
set f1 [openpipe]
chan puts $f1 {chan puts hello_from_pipe}
chan flush $f1
@@ -4821,7 +4821,7 @@ test chan-io-36.1 {Tcl_InputBlocked on nonblocking pipe} -setup {
} -result {{} 1 hello 0 {} 1}
test chan-io-36.2 {Tcl_InputBlocked on blocking pipe} -setup {
set x ""
} -constraints {stdio openpipe} -body {
} -constraints stdio -body {
set f1 [openpipe]
chan configure $f1 -buffering line
chan puts $f1 {chan puts hello_from_pipe}
@@ -5095,7 +5095,7 @@ test chan-io-39.9 {Tcl_SetChannelOption, blocking mode} -setup {
test chan-io-39.10 {Tcl_SetChannelOption, blocking mode} -setup {
file delete $path(pipe)
set x ""
} -constraints {stdio openpipe} -body {
} -constraints stdio -body {
set f1 [open $path(pipe) w]
chan puts $f1 {
chan gets stdin
@@ -5192,7 +5192,7 @@ test chan-io-39.16 {Tcl_SetChannelOption: -encoding, errors} -setup {
} -result {unknown encoding "foobar"}
test chan-io-39.17 {Tcl_SetChannelOption: -encoding, clearing CHANNEL_NEED_MORE_DATA} -setup {
variable x {}
} -constraints {stdio openpipe fileevent} -body {
} -constraints {stdio fileevent} -body {
set f [openpipe r+ $path(cat)]
chan configure $f -encoding binary
chan puts -nonewline $f "\xe7"
@@ -5552,7 +5552,7 @@ test chan-io-43.2 {Tcl_FileeventCmd: deleting when many present} -setup {
set f2 [open "|[list cat -u]" r+]
set f3 [open "|[list cat -u]" r+]
set result {}
} -constraints {stdio unixExecs fileevent openpipe} -body {
} -constraints {stdio unixExecs fileevent} -body {
lappend result [chan event $f r] [chan event $f2 r] [chan event $f3 r]
chan event $f r "chan read f"
chan event $f2 r "chan read f2"
@@ -5572,7 +5572,7 @@ test chan-io-43.2 {Tcl_FileeventCmd: deleting when many present} -setup {
test chan-io-44.1 {FileEventProc procedure: normal read event} -setup {
set f2 [open "|[list cat -u]" r+]
set f3 [open "|[list cat -u]" r+]
} -constraints {stdio unixExecs fileevent openpipe} -body {
} -constraints {stdio unixExecs fileevent} -body {
chan event $f2 readable [namespace code {
set x [chan gets $f2]; chan event $f2 readable {}
}]
@@ -5592,7 +5592,7 @@ test chan-io-44.2 {FileEventProc procedure: error in read event} -setup {
}
set handler [interp bgerror {}]
interp bgerror {} [namespace which myHandler]
} -constraints {stdio unixExecs fileevent openpipe} -body {
} -constraints {stdio unixExecs fileevent} -body {
chan event $f2 readable {error bogus}
chan puts $f2 text; chan flush $f2
variable x initial
@@ -5606,7 +5606,7 @@ test chan-io-44.2 {FileEventProc procedure: error in read event} -setup {
test chan-io-44.3 {FileEventProc procedure: normal write event} -setup {
set f2 [open "|[list cat -u]" r+]
set f3 [open "|[list cat -u]" r+]
} -constraints {stdio unixExecs fileevent openpipe} -body {
} -constraints {stdio unixExecs fileevent} -body {
chan event $f2 writable [namespace code {
lappend x "triggered"
incr count -1
@@ -5632,7 +5632,7 @@ test chan-io-44.4 {FileEventProc procedure: eror in write event} -setup {
}
set handler [interp bgerror {}]
interp bgerror {} [namespace which myHandler]
} -constraints {stdio unixExecs fileevent openpipe} -body {
} -constraints {stdio unixExecs fileevent} -body {
chan event $f2 writable {error bad-write}
variable x initial
vwait [namespace which -variable x]
@@ -5642,7 +5642,9 @@ test chan-io-44.4 {FileEventProc procedure: eror in write event} -setup {
catch {chan close $f2}
catch {chan close $f3}
} -result {bad-write {}}
test chan-io-44.5 {FileEventProc procedure: end of file} {stdio unixExecs openpipe fileevent} {
test chan-io-44.5 {FileEventProc procedure: end of file} -constraints {
stdio unixExecs fileevent
} -body {
set f4 [openpipe r $path(cat) << foo]
chan event $f4 readable [namespace code {
if {[chan gets $f4 line] < 0} {
@@ -5655,9 +5657,10 @@ test chan-io-44.5 {FileEventProc procedure: end of file} {stdio unixExecs openpi
variable x initial
vwait [namespace which -variable x]
vwait [namespace which -variable x]
chan close $f4
set x
} {initial foo eof}
} -cleanup {
chan close $f4
} -result {initial foo eof}
chan close $f
makeFile "foo bar" foo
@@ -5728,9 +5731,10 @@ test chan-io-46.1 {Tcl event loop vs multiple interpreters} {testfevent fileeven
chan event $f readable {}
}]
}
set timer [after 10 lappend x timeout]
testfevent cmd $script
after 1 ;# We must delay because Windows takes a little time to notice
update
vwait x
after cancel $timer
testfevent cmd {chan close $f}
list [testfevent cmd {set x}] [testfevent cmd {info commands after}]
} {{f triggered: foo bar} after}
@@ -5918,7 +5922,7 @@ test chan-io-48.2 {testing readability conditions} {nonBlockFiles fileevent} {
set path(my_script) [makeFile {} my_script]
test chan-io-48.3 {testing readability conditions} -setup {
set l ""
} -constraints {stdio unix nonBlockFiles openpipe fileevent} -body {
} -constraints {stdio unix nonBlockFiles fileevent} -body {
set f [open $path(bar) w]
chan puts $f abcdefg
chan puts $f abcdefg
@@ -6372,7 +6376,7 @@ test chan-io-49.5 {testing crlf reading, leftover cr disgorgment} -setup {
test chan-io-50.1 {testing handler deletion} -setup {
file delete $path(test1)
} -constraints {testchannelevent} -body {
} -constraints testchannelevent -body {
set f [open $path(test1) w]
chan close $f
set f [open $path(test1) r]
@@ -6382,7 +6386,7 @@ test chan-io-50.1 {testing handler deletion} -setup {
}]
variable z not_called
update
return $z
set z
} -cleanup {
chan close $f
} -result called
@@ -6390,16 +6394,21 @@ test chan-io-50.2 {testing handler deletion with multiple handlers} -setup {
file delete $path(test1)
chan close [open $path(test1) w]
set z ""
} -constraints {testchannelevent} -body {
set f [open $path(test1) r]
testchannelevent $f add readable [namespace code [list delhandler $f 1]]
testchannelevent $f add readable [namespace code [list delhandler $f 0]]
} -constraints {testchannelevent testservicemode} -body {
proc delhandler {f i} {
variable z
lappend z "called delhandler $f $i"
testchannelevent $f delete 0
}
update
set z ""
set timer [after 50 lappend z timeout]
testservicemode 0
set f [open $path(test1) r]
testchannelevent $f add readable [namespace code [list delhandler $f 1]]
testchannelevent $f add readable [namespace code [list delhandler $f 0]]
testservicemode 1
vwait z
after cancel $timer
string equal $z \
[list [list called delhandler $f 0] [list called delhandler $f 1]]
} -cleanup {
@@ -6408,11 +6417,7 @@ test chan-io-50.2 {testing handler deletion with multiple handlers} -setup {
test chan-io-50.3 {testing handler deletion with multiple handlers} -setup {
file delete $path(test1)
chan close [open $path(test1) w]
set z ""
} -constraints {testchannelevent} -body {
set f [open $path(test1) r]
testchannelevent $f add readable [namespace code [list notcalled $f 1]]
testchannelevent $f add readable [namespace code [list delhandler $f 0]]
} -constraints {testchannelevent testservicemode} -body {
proc notcalled {f i} {
variable z
lappend z "notcalled was called!! $f $i"
@@ -6424,7 +6429,15 @@ test chan-io-50.3 {testing handler deletion with multiple handlers} -setup {
testchannelevent $f delete 0
lappend z "delhandler $f $i deleted myself"
}
update
set z ""
set timer [after 50 lappend z timeout]
testservicemode 0
set f [open $path(test1) r]
testchannelevent $f add readable [namespace code [list notcalled $f 1]]
testchannelevent $f add readable [namespace code [list delhandler $f 0]]
testservicemode 1
vwait z
after cancel $timer
string equal $z \
[list [list delhandler $f 0 called] \
[list delhandler $f 0 deleted myself]]
@@ -6435,7 +6448,7 @@ test chan-io-50.4 {testing handler deletion vs reentrant calls} -setup {
file delete $path(test1)
set f [open $path(test1) w]
chan close $f
} -constraints {testchannelevent} -body {
} -constraints testchannelevent -body {
set f [open $path(test1) r]
testchannelevent $f add readable [namespace code {
if {$u eq "recursive"} {
@@ -6449,19 +6462,20 @@ test chan-io-50.4 {testing handler deletion vs reentrant calls} -setup {
}]
variable u toplevel
variable z ""
update
return $z
set timer [after 50 lappend z timeout]
vwait z
after cancel $timer
set z
} -cleanup {
chan close $f
update
} -result {{delrecursive calling recursive} {delrecursive deleting recursive}}
test chan-io-50.5 {testing handler deletion vs reentrant calls} -setup {
file delete $path(test1)
set f [open $path(test1) w]
chan close $f
} -constraints {testchannelevent} -body {
set f [open $path(test1) r]
testchannelevent $f add readable [namespace code [list notcalled $f]]
testchannelevent $f add readable [namespace code [list del $f]]
update
} -constraints {testchannelevent testservicemode} -body {
proc notcalled {f} {
variable z
lappend z "notcalled was called!! $f"
@@ -6477,33 +6491,46 @@ test chan-io-50.5 {testing handler deletion vs reentrant calls} -setup {
} else {
set u recursive
lappend z "del calling recursive"
update
set timer [after 50 lappend z timeout]
set mode [test servicemode 1]
vwait z
after cancel $timer
test servicemode $mode
lappend z "del after update"
}
}
set z ""
set u toplevel
update
return $z
set timer [after 50 lappend z timeout]
testservicemode 0
set f [open $path(test1) r]
testchannelevent $f add readable [namespace code [list notcalled $f]]
testchannelevent $f add readable [namespace code [list del $f]]
testservicemode 1
vwait z
after cancel $timer
set z
} -cleanup {
chan close $f
update
} -result [list {del calling recursive} {del deleted notcalled} \
{del deleted myself} {del after update}]
test chan-io-50.6 {testing handler deletion vs reentrant calls} -setup {
file delete $path(test1)
set f [open $path(test1) w]
chan close $f
} -constraints {testchannelevent} -body {
set f [open $path(test1) r]
testchannelevent $f add readable [namespace code [list second $f]]
testchannelevent $f add readable [namespace code [list first $f]]
} -constraints {testchannelevent testservicemode} -body {
proc first {f} {
variable u
variable z
if {$u eq "toplevel"} {
lappend z "first called"
set mode [testservicemode 1]
set timer [after 50 lappend z timeout]
set u first
update
vwait z
after cancel $timer
testservicemode $mode
lappend z "first after update"
} else {
lappend z "first called not toplevel"
@@ -6526,8 +6553,15 @@ test chan-io-50.6 {testing handler deletion vs reentrant calls} -setup {
}
set z ""
set u toplevel
update
return $z
set timer [after 50 lappend z timeout]
testservicemode 0
set f [open $path(test1) r]
testchannelevent $f add readable [namespace code [list second $f]]
testchannelevent $f add readable [namespace code [list first $f]]
testservicemode 1
vwait z
after cancel $timer
set z
} -cleanup {
chan close $f
} -result [list {first called} {first called not toplevel} \
@@ -6709,7 +6743,7 @@ test chan-io-52.7 {TclCopyChannel} -constraints {fcopy} -setup {
test chan-io-52.8 {TclCopyChannel} -setup {
file delete $path(test1)
file delete $path(pipe)
} -constraints {stdio openpipe fcopy} -body {
} -constraints {stdio fcopy} -body {
set f1 [open $path(pipe) w]
chan configure $f1 -translation lf
chan puts $f1 "
@@ -6830,7 +6864,7 @@ test chan-io-53.2 {CopyData} -setup {
test chan-io-53.3 {CopyData: background read underflow} -setup {
file delete $path(test1)
file delete $path(pipe)
} -constraints {stdio unix openpipe fcopy} -body {
} -constraints {stdio unix fcopy} -body {
set f1 [open $path(pipe) w]
chan puts -nonewline $f1 {
chan puts ready
@@ -6868,7 +6902,7 @@ test chan-io-53.4 {CopyData: background write overflow} -setup {
}
file delete $path(test1)
file delete $path(pipe)
} -constraints {stdio unix openpipe fileevent fcopy} -body {
} -constraints {stdio unix fileevent fcopy} -body {
set f1 [open $path(pipe) w]
chan puts $f1 {
chan puts ready
@@ -6932,7 +6966,7 @@ test chan-io-53.6 {CopyData: error during chan copy} -setup {
file delete $path(pipe)
file delete $path(test1)
catch {unset fcopyTestDone}
} -constraints {stdio openpipe fcopy} -body {
} -constraints {stdio fcopy} -body {
set f1 [open $path(pipe) w]
chan puts $f1 "exit 1"
chan close $f1
@@ -6966,7 +7000,7 @@ test chan-io-53.7 {CopyData: Flooding chan copy from pipe} -setup {
variable fcopyTestDone
file delete $path(pipe)
catch {unset fcopyTestDone}
} -constraints {stdio openpipe fcopy} -body {
} -constraints {stdio fcopy} -body {
set fcopyTestCount 0
set f1 [open $path(pipe) w]
chan puts $f1 {
@@ -7016,7 +7050,7 @@ test chan-io-53.8 {CopyData: async callback and error handling, Bug 1932639} -se
# Channels to copy between
set f [open $foo r] ; fconfigure $f -translation binary
set g [open $bar w] ; fconfigure $g -translation binary -buffering none
} -constraints {stdio openpipe fcopy} -body {
} -constraints {stdio fcopy} -body {
# Record input size, so that result is always defined
lappend ::RES [file size $bar]
# Run the copy. Should not invoke -command now.
@@ -7056,7 +7090,7 @@ test chan-io-53.8a {CopyData: async callback and error handling, Bug 1932639, at
# Channels to copy between
set f [open $foo r] ; chan configure $f -translation binary
set g [open $bar w] ; chan configure $g -translation binary -buffering none
} -constraints {stdio openpipe fcopy} -body {
} -constraints {stdio fcopy} -body {
# Initialize and force eof on the input.
chan seek $f 0 end ; chan read $f 1
set ::RES [chan eof $f]
@@ -7114,7 +7148,7 @@ test chan-io-53.9 {CopyData: -size and event interaction, Bug 780533} -setup {
}
set ::forever {}
set out [open $out w]
} -constraints {stdio openpipe fcopy} -body {
} -constraints {stdio fcopy} -body {
chan copy $pipe $out -size 6 -command ::done
set token [after 5000 {
set ::forever {fcopy hangs}
@@ -7187,7 +7221,7 @@ test chan-io-53.10 {Bug 1350564, multi-directional fcopy} -setup {
chan configure $b -translation binary -buffering none
chan event $a readable [namespace code "done $a"]
chan event $b readable [namespace code "done $b"]
} -constraints {stdio openpipe fcopy} -body {
} -constraints {stdio fcopy} -body {
# Now pass data through the server in both directions.
set ::forever {}
chan puts $a AB
@@ -7409,7 +7443,7 @@ test chan-io-57.2 {buffered data and file events, read} -setup {
chan close $server
} -result {1 readable 234567890 timer}
test chan-io-58.1 {Tcl_NotifyChannel and error when closing} {stdio unixOrWin openpipe fileevent} {
test chan-io-58.1 {Tcl_NotifyChannel and error when closing} {stdio unixOrWin fileevent} {
set out [open $path(script) w]
chan puts $out {
chan puts "normal message from pipe"
@@ -7447,7 +7481,7 @@ test chan-io-59.1 {Thread reference of channels} {testmainthread testchannel} {
string equal $result [testmainthread]
} {1}
test chan-io-60.1 {writing illegal utf sequences} {openpipe fileevent testbytestring} {
test chan-io-60.1 {writing illegal utf sequences} {fileevent testbytestring} {
# This test will hang in older revisions of the core.
set out [open $path(script) w]
chan puts $out "catch {load $::tcltestlib Tcltest}"
+66 -15
View File
@@ -254,7 +254,6 @@ proc ::testClock::registry { cmd path key } {
return [dict get $reg $path $key]
}
# Test some of the basics of [clock format]
test clock-1.0 "clock format - wrong # args" {
@@ -35474,7 +35473,7 @@ test clock-33.5 {clock clicks tests, millisecond timing test} {
# 60 msecs seems to be the max time slice under Windows 95/98
expr {
($end > $start) && (($end - $start) <= 60) ?
"ok" :
"ok" :
"test should have taken 0-60 ms, actually took [expr $end - $start]"}
} {ok}
test clock-33.5a {clock tests, millisecond timing test} {
@@ -35490,7 +35489,7 @@ test clock-33.5a {clock tests, millisecond timing test} {
# 60 msecs seems to be the max time slice under Windows 95/98
expr {
($end > $start) && (($end - $start) <= 60) ?
"ok" :
"ok" :
"test should have taken 0-60 ms, actually took [expr $end - $start]"}
} {ok}
test clock-33.6 {clock clicks, milli with too much abbreviation} {
@@ -35635,7 +35634,6 @@ test clock-34.11 {clock scan tests} {
set time [clock scan "1/1/37" -gmt true]
clock format $time -format {%b %d,%Y %H:%M GMT} -gmt true
} {Jan 01,2037 00:00 GMT}
test clock-34.12 {clock scan, relative times} {
set time [clock scan "Oct 23, 1992 -1 day"]
clock format $time -format {%b %d, %Y}
@@ -35787,7 +35785,6 @@ test clock-34.43 {last monday in november} {
}
set res
} {1991-11-25 1992-11-30 1993-11-29 1994-11-28 1995-11-27 1996-11-25}
test clock-34.44 {2nd monday in november} {
set res {}
foreach i {91 92 93 94 95 96} {
@@ -35820,38 +35817,95 @@ test clock-34.47 {ago with multiple relative units} {
set res [clock scan "2 days 2 hours ago" -base $base]
expr {$base - $res}
} 180000
test clock-34.48 {more than one ToD} {*}{
-body {clock scan {10:00 11:00}}
-returnCodes error
-result {unable to convert date-time string "10:00 11:00": more than one time of day in string}
}
test clock-34.49 {more than one date} {*}{
-body {clock scan {1/1/2001 2/2/2002}}
-returnCodes error
-result {unable to convert date-time string "1/1/2001 2/2/2002": more than one date in string}
}
test clock-34.50 {more than one time zone} {*}{
-body {clock scan {10:00 EST CST}}
-returnCodes error
-result {unable to convert date-time string "10:00 EST CST": more than one time zone in string}
}
test clock-34.51 {more than one weekday} {*}{
-body {clock scan {Monday Tuesday}}
-returnCodes error
-result {unable to convert date-time string "Monday Tuesday": more than one weekday in string}
}
test clock-34.52 {more than one ordinal month} {*}{
-body {clock scan {next January next March}}
-returnCodes error
-result {unable to convert date-time string "next January next March": more than one ordinal month in string}
}
test clock-34.53 {clock scan, ISO 8601 point in time format} {
set time [clock scan "19921023T00:00:00"]
clock format $time -format {%b %d, %Y %H:%M:%S}
} "Oct 23, 1992 00:00:00"
test clock-34.54 {clock scan, ISO 8601 point in time format} {
set time [clock scan "1992-10-23T00:00:00"]
clock format $time -format {%b %d, %Y %H:%M:%S}
} "Oct 23, 1992 00:00:00"
test clock-34.55 {clock scan, ISO 8601 invalid TZ} -body {
set time [clock scan "19921023MST000000"]
clock format $time -format {%b %d, %Y %H:%M:%S}
} -returnCodes error -match glob -result {unable to convert date-time string*}
test clock-34.56 {clock scan, ISO 8601 invalid TZ} -body {
set time [clock scan "19921023M000000"]
clock format $time -format {%b %d, %Y %H:%M:%S}
} -returnCodes error -match glob -result {unable to convert date-time string*}
test clock-34.57 {clock scan, ISO 8601 invalid TZ} -body {
set time [clock scan "1992-10-23M00:00:00"]
clock format $time -format {%b %d, %Y %H:%M:%S}
} -returnCodes error -match glob -result {unable to convert date-time string*}
test clock-34.58 {clock scan, ISO 8601 invalid TZ} -body {
set time [clock scan "1992-10-23MST00:00:00"]
clock format $time -format {%b %d, %Y %H:%M:%S}
} -returnCodes error -match glob -result {unable to convert date-time string*}
test clock-34.59 {clock scan tests (-TZ)} {
set time [clock scan "31 Jan 14 23:59:59 -0100"]
clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
} {Feb 01,2014 00:59:59 GMT}
test clock-34.60 {clock scan tests (+TZ)} {
set time [clock scan "31 Jan 14 23:59:59 +0100"]
clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
} {Jan 31,2014 22:59:59 GMT}
test clock-34.61 {clock scan tests (-TZ)} {
set time [clock scan "23:59:59 -0100" -base 0 -gmt true]
clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
} {Jan 02,1970 00:59:59 GMT}
test clock-34.62 {clock scan tests (+TZ)} {
set time [clock scan "23:59:59 +0100" -base 0 -gmt true]
clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
} {Jan 01,1970 22:59:59 GMT}
test clock-34.63 {clock scan tests (TZ)} {
set time [clock scan "Mon, 30 Jun 2014 23:59:59 CEST"]
clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
} {Jun 30,2014 21:59:59 GMT}
test clock-34.64 {clock scan tests (TZ)} {
set time [clock scan "Fri, 31 Jan 2014 23:59:59 CET"]
clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
} {Jan 31,2014 22:59:59 GMT}
test clock-34.65 {clock scan tests (relspec, day unit not TZ)} {
set time [clock scan "23:59:59 +15 day" -base 2000000 -gmt true]
clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
} {Feb 08,1970 23:59:59 GMT}
test clock-34.66 {clock scan tests (relspec, day unit not TZ)} {
set time [clock scan "23:59:59 -15 day" -base 2000000 -gmt true]
clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
} {Jan 09,1970 23:59:59 GMT}
test clock-34.67 {clock scan tests (merid and TZ)} {
set time [clock scan "10:59 pm CET" -base 2000000 -gmt true]
clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
} {Jan 24,1970 21:59:00 GMT}
test clock-34.68 {clock scan tests (merid and TZ)} {
set time [clock scan "10:59 pm +0100" -base 2000000 -gmt true]
clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
} {Jan 24,1970 21:59:00 GMT}
# clock seconds
test clock-35.1 {clock seconds tests} {
@@ -36951,12 +37005,10 @@ test clock-67.2 {Bug d19a30db57} -body {
# error, not segfault
tcl::clock::GetJulianDayFromEraYearMonthDay {} 2361222
} -returnCodes error -match glob -result *
test clock-67.3 {Bug d19a30db57} -body {
# error, not segfault
tcl::clock::GetJulianDayFromEraYearWeekDay {} 2361222
} -returnCodes error -match glob -result *
test clock-67.4 {Change format %x output on global locale change [Bug 4a0c163d24]} -setup {
package require msgcat
set current [msgcat::mclocale]
@@ -36968,7 +37020,6 @@ test clock-67.4 {Change format %x output on global locale change [Bug 4a0c163d24
} -cleanup {
msgcat::mclocale $current
} -result {1 1}
test clock-67.5 {Change scan %x output on global locale change [Bug 4a0c163d24]} -setup {
package require msgcat
set current [msgcat::mclocale]
+7 -5
View File
@@ -23,16 +23,18 @@ testConstraint testfilehandler [llength [info commands testfilehandler]]
testConstraint testexithandler [llength [info commands testexithandler]]
testConstraint testfilewait [llength [info commands testfilewait]]
testConstraint exec [llength [info commands exec]]
testConstraint notOSX [expr {$::tcl_platform(os) ne "Darwin"}]
test event-1.1 {Tcl_CreateFileHandler, reading} -setup {
testfilehandler close
set result ""
} -constraints {testfilehandler} -body {
} -constraints {testfilehandler notOSX} -body {
testfilehandler create 0 readable off
testfilehandler clear 0
testfilehandler oneevent
lappend result [testfilehandler counts 0]
testfilehandler fillpartial 0
update idletasks
testfilehandler oneevent
lappend result [testfilehandler counts 0]
testfilehandler oneevent
@@ -595,16 +597,16 @@ test event-11.7 {Bug 16828b3744} {
test event-11.8 {Bug 16828b3744} -setup {
oo::class create A {
variable continue
method start {} {
after idle [self] destroy
set continue 0
vwait [namespace current]::continue
}
destructor {
set continue 1
}
}
}
} -body {
[A new] start
+38 -1
View File
@@ -10,7 +10,7 @@
package require tcltest 2
namespace import -force ::tcltest::*
package require http 2.8
package require http 2.9
# start the server
variable httpd_output
@@ -60,6 +60,20 @@ proc meta {tok {key ""}} {
return $meta
}
proc state {tok {key ""}} {
upvar 1 $tok state
if {$key ne ""} {
if {[array names state -exact $key] ne {}} {
return $state($key)
} else {
return ""
}
}
set res [array get state]
dict set res body <elided>
return $res
}
proc check_crc {tok args} {
set crc [meta $tok x-crc32]
set data [expr {[llength $args] ? [lindex $args 0] : [http::data $tok]}]
@@ -241,6 +255,29 @@ test http11-1.12 "normal,identity,chunked" -setup {
halt_httpd
} -result {ok {HTTP/1.1 200 OK} ok {} chunked}
test http11-1.13 "normal, 1.1 and keepalive as server default, no zip" -setup {
variable httpd [create_httpd]
set zipTmp [http::config -zip]
http::config -zip 0
} -body {
set tok [http::geturl http://localhost:$httpd_port/testdoc.html?transfer= \
-protocol 1.1 -keepalive 1 -timeout 10000]
http::wait $tok
set res1 [list [http::status $tok] [http::code $tok] [check_crc $tok] \
[meta $tok connection] [meta $tok transfer-encoding] [state $tok reusing] [state $tok connection]]
set toj [http::geturl http://localhost:$httpd_port/testdoc.html?transfer= \
-protocol 1.1 -keepalive 1 -timeout 10000]
http::wait $toj
set res2 [list [http::status $toj] [http::code $toj] [check_crc $toj] \
[meta $toj connection] [meta $toj transfer-encoding] [state $toj reusing] [state $toj connection]]
concat $res1 -- $res2
} -cleanup {
http::cleanup $tok
http::cleanup $toj
halt_httpd
http::config -zip $zipTmp
} -result {ok {HTTP/1.1 200 OK} ok {} {} 0 keep-alive -- ok {HTTP/1.1 200 OK} ok {} {} 1 keep-alive}
# -------------------------------------------------------------------------
test http11-2.0 "-channel" -setup {
+1 -1
View File
@@ -11,7 +11,7 @@
package require tcltest 2
namespace import -force ::tcltest::*
package require http 2.8
package require http 2.9
set sourcedir [file normalize [file dirname [info script]]]
source [file join $sourcedir httpTest.tcl]
+5 -5
View File
@@ -19,16 +19,16 @@ if {"::tcltest" ni [namespace children]} {
catch {namespace delete {*}[namespace children :: test_ns_*]}
test init-0.1 {no error on initialization phase (init.tcl)} -setup {
interp create slave
interp create child
} -body {
slave eval {
child eval {
list [set v [info exists ::errorInfo]] \
[if {$v} {set ::errorInfo}] \
[set v [info exists ::errorCode]] \
[if {$v} {set ::errorCode}]
}
} -cleanup {
interp delete slave
interp delete child
} -result {0 {} 0 {}}
# Six cases - white box testing
@@ -59,11 +59,11 @@ test init-1.8 {auto_qualify - multiple colons 2} {
auto_qualify :::foo ::bar
} foo
# We use a sub-interp and auto_reset and double the tests because there is 2
# We use a child interp and auto_reset and double the tests because there is 2
# places where auto_loading occur (before loading the indexes files and after)
set testInterp [interp create]
tcltest::loadIntoSlaveInterpreter $testInterp {*}$argv
tcltest::loadIntoChildInterpreter $testInterp {*}$argv
interp eval $testInterp {
namespace import -force ::tcltest::*
customMatch pairwise {apply {{mode pair} {
+4 -4
View File
@@ -32,7 +32,7 @@ test interp-1.1 {options for interp command} -returnCodes error -body {
} -result {wrong # args: should be "interp cmd ?arg ...?"}
test interp-1.2 {options for interp command} -returnCodes error -body {
interp frobox
} -result {bad option "frobox": must be alias, aliases, bgerror, cancel, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, slaves, share, target, or transfer}
} -result {bad option "frobox": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, slaves, share, target, or transfer}
test interp-1.3 {options for interp command} {
interp delete
} ""
@@ -50,13 +50,13 @@ test interp-1.6 {options for interp command} -returnCodes error -body {
} -result {wrong # args: should be "interp slaves ?path?"}
test interp-1.7 {options for interp command} -returnCodes error -body {
interp hello
} -result {bad option "hello": must be alias, aliases, bgerror, cancel, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, slaves, share, target, or transfer}
} -result {bad option "hello": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, slaves, share, target, or transfer}
test interp-1.8 {options for interp command} -returnCodes error -body {
interp -froboz
} -result {bad option "-froboz": must be alias, aliases, bgerror, cancel, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, slaves, share, target, or transfer}
} -result {bad option "-froboz": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, slaves, share, target, or transfer}
test interp-1.9 {options for interp command} -returnCodes error -body {
interp -froboz -safe
} -result {bad option "-froboz": must be alias, aliases, bgerror, cancel, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, slaves, share, target, or transfer}
} -result {bad option "-froboz": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, slaves, share, target, or transfer}
test interp-1.10 {options for interp command} -returnCodes error -body {
interp target
} -result {wrong # args: should be "interp target path alias"}
+219 -173
View File
File diff suppressed because it is too large Load Diff
+43
View File
@@ -3337,6 +3337,49 @@ test namespace-56.5 {Bug 8b9854c3d8} -setup {
namespace delete namespace-56.5
} -result 1
test namespace-57.0 {
an imported alias should be usable in the deletion trace for the alias
see 29e8848eb976
} -body {
variable res {}
namespace eval ns2 {
namespace export *
proc p1 {oldname newname op} {
return success
}
interp alias {} [namespace current]::p2 {} [namespace which p1]
}
namespace eval ns3 {
namespace import ::ns2::p2
}
set ondelete [list apply [list {oldname newname op} {
variable res
catch {
ns3::p2 $oldname $newname $op
} cres
lappend res $cres
} [namespace current]]]
trace add command ::ns2::p2 delete $ondelete
rename ns2::p2 {}
return $res
} -cleanup {
unset res
namespace delete ns2
namespace delete ns3
} -result success
# cleanup
catch {rename cmd1 {}}
+5 -5
View File
@@ -17,9 +17,9 @@ if {"::tcltest" ni [namespace children]} {
namespace import -force ::tcltest::*
}
# Do all this in a slave interp to avoid garbaging the package list
# Do all this in a child interp to avoid garbaging the package list
set i [interp create]
tcltest::loadIntoSlaveInterpreter $i {*}$argv
tcltest::loadIntoChildInterpreter $i {*}$argv
interp eval $i {
namespace import -force ::tcltest::*
package forget {*}[package names]
@@ -862,15 +862,15 @@ test package-4.56 {Tcl_PackageCmd procedure, "vsatisfies" option} -body {
# No tests for FindPackage; can't think up anything detectable errors.
test package-5.1 {TclFreePackageInfo procedure} {
interp create slave
slave eval {
interp create child
child eval {
package ifneeded t 2.3 x
package ifneeded t 2.4 y
package ifneeded x 3.1 z
package provide q 4.3
package unknown "will this get freed?"
}
interp delete slave
interp delete child
} {}
test package-5.2 {TclFreePackageInfo procedure} -body {
interp create foo
+2 -2
View File
@@ -904,7 +904,7 @@ test socket_$af-5.1 {byte order problems, socket numbers, htons} -body {
return {htons problem, should be disallowed, are you running as SU?}
}
return {couldn't open socket: not owner}
} -constraints [list socket supported_$af unix notRoot] -result {couldn't open socket: not owner}
} -constraints [list socket supported_$af unix notRoot notOSX] -result {couldn't open socket: not owner}
test socket_$af-5.2 {byte order problems, socket numbers, htons} -body {
if {![catch {socket -server dodo 0x10000} msg]} {
close $msg
@@ -918,7 +918,7 @@ test socket_$af-5.3 {byte order problems, socket numbers, htons} -body {
return {htons problem, should be disallowed, are you running as SU?}
}
return {couldn't open socket: not owner}
} -constraints [list socket supported_$af unix notRoot] -result {couldn't open socket: not owner}
} -constraints [list socket supported_$af unix notRoot notOSX] -result {couldn't open socket: not owner}
test socket_$af-6.1 {accept callback error} -constraints [list socket supported_$af stdio] -setup {
proc myHandler {msg options} {
+2 -2
View File
@@ -78,8 +78,8 @@ test utf-1.11 {Tcl_UniCharToUtf: 3 byte sequence, low surrogate} testbytestring
test utf-1.12 {Tcl_UniCharToUtf: 4 byte sequence, high/low surrogate} {pairsTo4bytes testbytestring} {
expr {"\uD842\uDC42" eq [testbytestring \xF0\xA0\xA1\x82]}
} 1
test utf-1.13 {Tcl_UniCharToUtf: Invalid surrogate} {Uesc testbytestring} {
expr {"\UD842" eq [testbytestring \xEF\xBF\xBD]}
test utf-1.13 {Tcl_UniCharToUtf: Invalid surrogate} {Uesc ucs2} {
expr {"\UD842" eq "\uD842"}
} 1
test utf-2.1 {Tcl_UtfToUniChar: low ascii} {
+2 -2
View File
@@ -944,8 +944,8 @@ install-libraries: libraries
do \
$(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)/http1.0"; \
done;
@echo "Installing package http 2.9.2 as a Tcl Module";
@$(INSTALL_DATA) $(TOP_DIR)/library/http/http.tcl "$(MODULE_INSTALL_DIR)/8.6/http-2.9.2.tm";
@echo "Installing package http 2.9.3 as a Tcl Module";
@$(INSTALL_DATA) $(TOP_DIR)/library/http/http.tcl "$(MODULE_INSTALL_DIR)/8.6/http-2.9.3.tm";
@echo "Installing package opt0.4 files to $(SCRIPT_INSTALL_DIR)/opt0.4/";
@for i in $(TOP_DIR)/library/opt/*.tcl ; \
do \
-2
View File
@@ -14926,7 +14926,6 @@ cat >>conftest.$ac_ext <<_ACEOF
#include <stdlib.h>
#include <string.h>
int main() {
extern int strstr();
exit(strstr("\0test", "test") ? 1 : 0);
}
_ACEOF
@@ -15096,7 +15095,6 @@ cat >>conftest.$ac_ext <<_ACEOF
#include <stdlib.h>
#include <string.h>
int main() {
extern int strtoul();
char *term, *string = "0";
exit(strtoul(string,&term,0) != 0 || term != string+1);
}
-2
View File
@@ -342,7 +342,6 @@ AC_CHECK_FUNC(memmove, , [
#--------------------------------------------------------------------
SC_TCL_CHECK_BROKEN_FUNC(strstr, [
extern int strstr();
exit(strstr("\0test", "test") ? 1 : 0);
])
@@ -353,7 +352,6 @@ SC_TCL_CHECK_BROKEN_FUNC(strstr, [
#--------------------------------------------------------------------
SC_TCL_CHECK_BROKEN_FUNC(strtoul, [
extern int strtoul();
char *term, *string = "0";
exit(strtoul(string,&term,0) != 0 || term != string+1);
])
+20 -6
View File
@@ -4,6 +4,9 @@
#ifndef _TCLCONFIG
#define _TCLCONFIG
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
/* Is gettimeofday() actually declared in <sys/time.h>? */
#undef GETTOD_NOT_DECLARED
@@ -219,10 +222,10 @@
/* Is 'struct stat64' in <sys/stat.h>? */
#undef HAVE_STRUCT_STAT64
/* Define to 1 if `st_blksize' is member of `struct stat'. */
/* Define to 1 if `st_blksize' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BLKSIZE
/* Define to 1 if `st_blocks' is member of `struct stat'. */
/* Define to 1 if `st_blocks' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BLOCKS
/* Define to 1 if you have the <sys/filio.h> header file. */
@@ -363,6 +366,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
@@ -441,9 +447,17 @@
/* Should we use vfork() instead of fork()? */
#undef USE_VFORK
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# undef WORDS_BIGENDIAN
# endif
#endif
/* Are Darwin SUSv3 extensions available? */
#undef _DARWIN_C_SOURCE
@@ -498,7 +512,7 @@
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t
/* Define to `unsigned' if <sys/types.h> does not define. */
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* Define as int if socklen_t is not available */
+12 -12
View File
@@ -98,7 +98,7 @@ dlopen(
const char *path,
int mode)
{
register ModulePtr mp;
ModulePtr mp;
static void *mainModule;
/*
@@ -134,7 +134,7 @@ dlopen(
return NULL;
}
mp->name = malloc((unsigned) (strlen(path) + 1));
mp->name = malloc(strlen(path) + 1);
strcpy(mp->name, path);
/*
@@ -191,7 +191,7 @@ dlopen(
*/
if (mode & RTLD_GLOBAL) {
register ModulePtr mp1;
ModulePtr mp1;
for (mp1 = mp->next; mp1; mp1 = mp1->next) {
if (loadbind(0, mp1->entry, mp->entry) == -1) {
@@ -243,7 +243,7 @@ static void
caterr(
char *s)
{
register char *p = s;
char *p = s;
while (*p >= '0' && *p <= '9') {
p++;
@@ -282,9 +282,9 @@ dlsym(
void *handle,
const char *symbol)
{
register ModulePtr mp = (ModulePtr)handle;
register ExportPtr ep;
register int i;
ModulePtr mp = (ModulePtr)handle;
ExportPtr ep;
int i;
/*
* Could speed up the search, but I assume that one assigns the result to
@@ -317,9 +317,9 @@ int
dlclose(
void *handle)
{
register ModulePtr mp = (ModulePtr)handle;
ModulePtr mp = (ModulePtr)handle;
int result;
register ModulePtr mp1;
ModulePtr mp1;
if (--mp->refCnt > 0) {
return 0;
@@ -343,8 +343,8 @@ dlclose(
}
if (mp->exports) {
register ExportPtr ep;
register int i;
ExportPtr ep;
int i;
for (ep = mp->exports, i = mp->nExports; i; i--, ep++) {
if (ep->name) {
free(ep->name);
@@ -541,7 +541,7 @@ readExports(
tmpsym[SYMNMLEN] = '\0';
symname = tmpsym;
}
ep->name = malloc((unsigned) (strlen(symname) + 1));
ep->name = malloc(strlen(symname) + 1);
strcpy(ep->name, symname);
ep->addr = (void *)((unsigned long)
mp->entry + ls->l_value - shdata.s_vaddr);
+21 -19
View File
@@ -49,7 +49,7 @@
#ifdef TCL_THREADS
typedef struct ThreadSpecificData {
typedef struct {
struct passwd pwd;
#if defined(HAVE_GETPWNAM_R_5) || defined(HAVE_GETPWUID_R_5)
#define NEED_PW_CLEANER 1
@@ -118,10 +118,10 @@ static int CopyString(const char *src, char *buf, int buflen);
#endif
#ifdef NEED_PW_CLEANER
static void FreePwBuf(ClientData ignored);
static void FreePwBuf(ClientData dummy);
#endif
#ifdef NEED_GR_CLEANER
static void FreeGrBuf(ClientData ignored);
static void FreeGrBuf(ClientData dummy);
#endif
#endif /* TCL_THREADS */
@@ -201,7 +201,7 @@ TclpGetPwNam(
if (tsdPtr->pbuflen < 1) {
tsdPtr->pbuflen = 1024;
}
tsdPtr->pbuf = ckalloc(tsdPtr->pbuflen);
tsdPtr->pbuf = (char *)ckalloc(tsdPtr->pbuflen);
Tcl_CreateThreadExitHandler(FreePwBuf, NULL);
}
while (1) {
@@ -214,7 +214,7 @@ TclpGetPwNam(
return NULL;
}
tsdPtr->pbuflen *= 2;
tsdPtr->pbuf = ckrealloc(tsdPtr->pbuf, tsdPtr->pbuflen);
tsdPtr->pbuf = (char *)ckrealloc(tsdPtr->pbuf, tsdPtr->pbuflen);
}
return (pwPtr != NULL ? &tsdPtr->pwd : NULL);
@@ -281,7 +281,7 @@ TclpGetPwUid(
if (tsdPtr->pbuflen < 1) {
tsdPtr->pbuflen = 1024;
}
tsdPtr->pbuf = ckalloc(tsdPtr->pbuflen);
tsdPtr->pbuf = (char *)ckalloc(tsdPtr->pbuflen);
Tcl_CreateThreadExitHandler(FreePwBuf, NULL);
}
while (1) {
@@ -294,7 +294,7 @@ TclpGetPwUid(
return NULL;
}
tsdPtr->pbuflen *= 2;
tsdPtr->pbuf = ckrealloc(tsdPtr->pbuf, tsdPtr->pbuflen);
tsdPtr->pbuf = (char *)ckrealloc(tsdPtr->pbuf, tsdPtr->pbuflen);
}
return (pwPtr != NULL ? &tsdPtr->pwd : NULL);
@@ -336,9 +336,10 @@ TclpGetPwUid(
#ifdef NEED_PW_CLEANER
static void
FreePwBuf(
ClientData ignored)
ClientData dummy)
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
(void)dummy;
ckfree(tsdPtr->pbuf);
}
@@ -384,7 +385,7 @@ TclpGetGrNam(
if (tsdPtr->gbuflen < 1) {
tsdPtr->gbuflen = 1024;
}
tsdPtr->gbuf = ckalloc(tsdPtr->gbuflen);
tsdPtr->gbuf = (char *)ckalloc(tsdPtr->gbuflen);
Tcl_CreateThreadExitHandler(FreeGrBuf, NULL);
}
while (1) {
@@ -397,7 +398,7 @@ TclpGetGrNam(
return NULL;
}
tsdPtr->gbuflen *= 2;
tsdPtr->gbuf = ckrealloc(tsdPtr->gbuf, tsdPtr->gbuflen);
tsdPtr->gbuf = (char *)ckrealloc(tsdPtr->gbuf, tsdPtr->gbuflen);
}
return (grPtr != NULL ? &tsdPtr->grp : NULL);
@@ -464,7 +465,7 @@ TclpGetGrGid(
if (tsdPtr->gbuflen < 1) {
tsdPtr->gbuflen = 1024;
}
tsdPtr->gbuf = ckalloc(tsdPtr->gbuflen);
tsdPtr->gbuf = (char *)ckalloc(tsdPtr->gbuflen);
Tcl_CreateThreadExitHandler(FreeGrBuf, NULL);
}
while (1) {
@@ -477,7 +478,7 @@ TclpGetGrGid(
return NULL;
}
tsdPtr->gbuflen *= 2;
tsdPtr->gbuf = ckrealloc(tsdPtr->gbuf, tsdPtr->gbuflen);
tsdPtr->gbuf = (char *)ckrealloc(tsdPtr->gbuf, tsdPtr->gbuflen);
}
return (grPtr != NULL ? &tsdPtr->grp : NULL);
@@ -519,9 +520,10 @@ TclpGetGrGid(
#ifdef NEED_GR_CLEANER
static void
FreeGrBuf(
ClientData ignored)
ClientData dummy)
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
(void)dummy;
ckfree(tsdPtr->gbuf);
}
@@ -685,8 +687,8 @@ CopyGrp(
char *buf,
int buflen)
{
register char *p = buf;
register int copied, len = 0;
char *p = buf;
int copied, len = 0;
/*
* Copy username.
@@ -887,7 +889,7 @@ CopyArray(
int buflen) /* Size of buffer. */
{
int i, j, len = 0;
char *p, **new;
char *p, **newBuffer;
if (src == NULL) {
return 0;
@@ -903,7 +905,7 @@ CopyArray(
return -1;
}
new = (char **) buf;
newBuffer = (char **)buf;
p = buf + len;
for (j = 0; j < i; j++) {
@@ -914,10 +916,10 @@ CopyArray(
return -1;
}
memcpy(p, src[j], sz);
new[j] = p;
newBuffer[j] = p;
p = buf + len;
}
new[j] = NULL;
newBuffer[j] = NULL;
return len;
}
+1 -1
View File
@@ -1116,7 +1116,7 @@ TclNativeCreateNativeRep(
}
Tcl_DecrRefCount(validPathPtr);
nativePathPtr = ckalloc(len);
memcpy(nativePathPtr, Tcl_DStringValue(&ds), (size_t) len);
memcpy(nativePathPtr, Tcl_DStringValue(&ds), len);
Tcl_DStringFree(&ds);
return nativePathPtr;
+26 -17
View File
@@ -33,11 +33,20 @@
#endif
#ifdef __CYGWIN__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __clang__
#pragma clang diagnostic ignored "-Wignored-attributes"
#endif
DLLIMPORT extern __stdcall unsigned char GetVersionExW(void *);
DLLIMPORT extern __stdcall void *GetModuleHandleW(const void *);
DLLIMPORT extern __stdcall void FreeLibrary(void *);
DLLIMPORT extern __stdcall void *GetProcAddress(void *, const char *);
DLLIMPORT extern __stdcall void GetSystemInfo(void *);
#ifdef __cplusplus
}
#endif
#define NUMPROCESSORS 11
static const char *const processors[NUMPROCESSORS] = {
@@ -110,7 +119,7 @@ static char pkgPath[sizeof(TCL_PACKAGE_PATH)+200] = TCL_PACKAGE_PATH;
* first list checked for a mapping from env encoding to Tcl encoding name.
*/
typedef struct LocaleTable {
typedef struct {
const char *lang;
const char *encoding;
} LocaleTable;
@@ -546,8 +555,8 @@ TclpInitLibraryPath(
*encodingPtr = Tcl_GetEncoding(NULL, NULL);
str = Tcl_GetStringFromObj(pathPtr, lengthPtr);
*valuePtr = (char *)ckalloc((*lengthPtr) + 1);
memcpy(*valuePtr, str, (size_t)(*lengthPtr)+1);
*valuePtr = (char *)ckalloc(*lengthPtr + 1);
memcpy(*valuePtr, str, *lengthPtr + 1);
Tcl_DecrRefCount(pathPtr);
}
@@ -764,7 +773,7 @@ InitMacLocaleInfoVar(
if (!Tcl_CreateNamespace(interp, "::tcl::mac", NULL, NULL)) {
Tcl_ResetResult(interp);
}
Tcl_SetVar(interp, "::tcl::mac::locale", loc, TCL_GLOBAL_ONLY);
Tcl_SetVar2(interp, "::tcl::mac::locale", NULL, loc, TCL_GLOBAL_ONLY);
}
CFRelease(localeRef);
}
@@ -800,9 +809,9 @@ TclpSetVariables(
const char *str;
CFBundleRef bundleRef;
Tcl_SetVar(interp, "tclDefaultLibrary", tclLibPath, TCL_GLOBAL_ONLY);
Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath, TCL_GLOBAL_ONLY);
Tcl_SetVar(interp, "tcl_pkgPath", " ",
Tcl_SetVar2(interp, "tclDefaultLibrary", NULL, tclLibPath, TCL_GLOBAL_ONLY);
Tcl_SetVar2(interp, "tcl_pkgPath", NULL, tclLibPath, TCL_GLOBAL_ONLY);
Tcl_SetVar2(interp, "tcl_pkgPath", NULL, " ",
TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
str = TclGetEnv("DYLD_FRAMEWORK_PATH", &ds);
@@ -818,9 +827,9 @@ TclpSetVariables(
*p = ' ';
}
} while (*p++);
Tcl_SetVar(interp, "tcl_pkgPath", Tcl_DStringValue(&ds),
Tcl_SetVar2(interp, "tcl_pkgPath", NULL, Tcl_DStringValue(&ds),
TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
Tcl_SetVar(interp, "tcl_pkgPath", " ",
Tcl_SetVar2(interp, "tcl_pkgPath", NULL, " ",
TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
Tcl_DStringFree(&ds);
}
@@ -835,9 +844,9 @@ TclpSetVariables(
(unsigned char*) tclLibPath, MAXPATHLEN) &&
! TclOSstat(tclLibPath, &statBuf) &&
S_ISDIR(statBuf.st_mode)) {
Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath,
Tcl_SetVar2(interp, "tcl_pkgPath", NULL, tclLibPath,
TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
Tcl_SetVar(interp, "tcl_pkgPath", " ",
Tcl_SetVar2(interp, "tcl_pkgPath", NULL, " ",
TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
}
CFRelease(frameworksURL);
@@ -848,20 +857,20 @@ TclpSetVariables(
(unsigned char*) tclLibPath, MAXPATHLEN) &&
! TclOSstat(tclLibPath, &statBuf) &&
S_ISDIR(statBuf.st_mode)) {
Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath,
Tcl_SetVar2(interp, "tcl_pkgPath", NULL, tclLibPath,
TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
Tcl_SetVar(interp, "tcl_pkgPath", " ",
Tcl_SetVar2(interp, "tcl_pkgPath", NULL, " ",
TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
}
CFRelease(frameworksURL);
}
}
Tcl_SetVar(interp, "tcl_pkgPath", pkgPath,
Tcl_SetVar2(interp, "tcl_pkgPath", NULL, pkgPath,
TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
} else
#endif /* HAVE_COREFOUNDATION */
{
Tcl_SetVar(interp, "tcl_pkgPath", pkgPath, TCL_GLOBAL_ONLY);
Tcl_SetVar2(interp, "tcl_pkgPath", NULL, pkgPath, TCL_GLOBAL_ONLY);
}
#ifdef DJGPP
@@ -874,7 +883,7 @@ TclpSetVariables(
#ifdef __CYGWIN__
unameOK = 1;
if (!osInfoInitialized) {
HANDLE handle = GetModuleHandleW(L"NTDLL");
void *handle = GetModuleHandleW(L"NTDLL");
int(__stdcall *getversion)(void *) =
(int(__stdcall *)(void *))GetProcAddress(handle, "RtlGetVersion");
osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
@@ -1009,7 +1018,7 @@ TclpFindVariable(
* searches). */
{
int i, result = -1;
register const char *env, *p1, *p2;
const char *env, *p1, *p2;
Tcl_DString envString;
Tcl_DStringInit(&envString);
+1 -1
View File
@@ -277,7 +277,7 @@ InitializeHostName(
*encodingPtr = Tcl_GetEncoding(NULL, NULL);
*lengthPtr = strlen(native);
*valuePtr = ckalloc(*lengthPtr + 1);
memcpy(*valuePtr, native, (size_t)(*lengthPtr) + 1);
memcpy(*valuePtr, native, *lengthPtr + 1);
}
/*
+45 -44
View File
@@ -22,23 +22,23 @@ typedef struct ThreadSpecificData {
static Tcl_ThreadDataKey dataKey;
/*
* masterLock is used to serialize creation of mutexes, condition variables,
* globalLock is used to serialize creation of mutexes, condition variables,
* and thread local storage. This is the only place that can count on the
* ability to statically initialize the mutex.
*/
static pthread_mutex_t masterLock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t globalLock = PTHREAD_MUTEX_INITIALIZER;
/*
* initLock is used to serialize initialization and finalization of Tcl. It
* cannot use any dyamically allocated storage.
* cannot use any dynamically allocated storage.
*/
static pthread_mutex_t initLock = PTHREAD_MUTEX_INITIALIZER;
/*
* allocLock is used by Tcl's version of malloc for synchronization. For
* obvious reasons, cannot use any dyamically allocated storage.
* obvious reasons, cannot use any dynamically allocated storage.
*/
static pthread_mutex_t allocLock = PTHREAD_MUTEX_INITIALIZER;
@@ -48,8 +48,8 @@ static pthread_mutex_t *allocLockPtr = &allocLock;
* These are for the critical sections inside this file.
*/
#define MASTER_LOCK pthread_mutex_lock(&masterLock)
#define MASTER_UNLOCK pthread_mutex_unlock(&masterLock)
#define GLOBAL_LOCK pthread_mutex_lock(&globalLock)
#define GLOBAL_UNLOCK pthread_mutex_unlock(&globalLock)
#endif /* TCL_THREADS */
@@ -89,7 +89,7 @@ TclpThreadCreate(
#ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE
if (stackSize != TCL_THREAD_STACK_DEFAULT) {
pthread_attr_setstacksize(&attr, (size_t) stackSize);
pthread_attr_setstacksize(&attr, stackSize);
#ifdef TCL_THREAD_STACK_MIN
} else {
/*
@@ -114,8 +114,8 @@ TclpThreadCreate(
}
#endif /* HAVE_PTHREAD_ATTR_SETSTACKSIZE */
if (! (flags & TCL_THREAD_JOINABLE)) {
pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
if (!(flags & TCL_THREAD_JOINABLE)) {
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
}
if (pthread_create(&theThread, &attr,
@@ -252,7 +252,7 @@ TclpInitLock(void)
/*
*----------------------------------------------------------------------
*
* TclpFinalizeLock
* TclFinalizeLock
*
* This procedure is used to destroy all private resources used in this
* file.
@@ -274,7 +274,7 @@ TclFinalizeLock(void)
/*
* You do not need to destroy mutexes that were created with the
* PTHREAD_MUTEX_INITIALIZER macro. These mutexes do not need any
* destruction: masterLock, allocLock, and initLock.
* destruction: globalLock, allocLock, and initLock.
*/
pthread_mutex_unlock(&initLock);
@@ -309,7 +309,7 @@ TclpInitUnlock(void)
/*
*----------------------------------------------------------------------
*
* TclpMasterLock
* TclpGlobalLock
*
* This procedure is used to grab a lock that serializes creation and
* finalization of serialization objects. This interface is only needed
@@ -322,24 +322,23 @@ TclpInitUnlock(void)
* None.
*
* Side effects:
* Acquire the master mutex.
* Acquire the global mutex.
*
*----------------------------------------------------------------------
*/
void
TclpMasterLock(void)
TclpGlobalLock(void)
{
#ifdef TCL_THREADS
pthread_mutex_lock(&masterLock);
pthread_mutex_lock(&globalLock);
#endif
}
/*
*----------------------------------------------------------------------
*
* TclpMasterUnlock
* TclpGlobalUnlock
*
* This procedure is used to release a lock that serializes creation and
* finalization of synchronization objects.
@@ -348,16 +347,16 @@ TclpMasterLock(void)
* None.
*
* Side effects:
* Release the master mutex.
* Release the global mutex.
*
*----------------------------------------------------------------------
*/
void
TclpMasterUnlock(void)
TclpGlobalUnlock(void)
{
#ifdef TCL_THREADS
pthread_mutex_unlock(&masterLock);
pthread_mutex_unlock(&globalLock);
#endif
}
@@ -367,7 +366,7 @@ TclpMasterUnlock(void)
* Tcl_GetAllocMutex
*
* This procedure returns a pointer to a statically initialized mutex for
* use by the memory allocator. The alloctor must use this lock, because
* use by the memory allocator. The allocator must use this lock, because
* all other locks are allocated...
*
* Results:
@@ -421,18 +420,18 @@ Tcl_MutexLock(
pthread_mutex_t *pmutexPtr;
if (*mutexPtr == NULL) {
MASTER_LOCK;
GLOBAL_LOCK;
if (*mutexPtr == NULL) {
/*
* Double inside master lock check to avoid a race condition.
* Double inside global lock check to avoid a race condition.
*/
pmutexPtr = ckalloc(sizeof(pthread_mutex_t));
pmutexPtr = (pthread_mutex_t *)ckalloc(sizeof(pthread_mutex_t));
pthread_mutex_init(pmutexPtr, NULL);
*mutexPtr = (Tcl_Mutex)pmutexPtr;
TclRememberMutex(mutexPtr);
}
MASTER_UNLOCK;
GLOBAL_UNLOCK;
}
pmutexPtr = *((pthread_mutex_t **)mutexPtr);
pthread_mutex_lock(pmutexPtr);
@@ -472,7 +471,7 @@ Tcl_MutexUnlock(
* This procedure is invoked to clean up one mutex. This is only safe to
* call at the end of time.
*
* This assumes the Master Lock is held.
* This assumes the Global Lock is held.
*
* Results:
* None.
@@ -529,7 +528,7 @@ Tcl_ConditionWait(
struct timespec ptime;
if (*condPtr == NULL) {
MASTER_LOCK;
GLOBAL_LOCK;
/*
* Double check inside mutex to avoid race, then initialize condition
@@ -537,12 +536,12 @@ Tcl_ConditionWait(
*/
if (*condPtr == NULL) {
pcondPtr = ckalloc(sizeof(pthread_cond_t));
pcondPtr = (pthread_cond_t *)ckalloc(sizeof(pthread_cond_t));
pthread_cond_init(pcondPtr, NULL);
*condPtr = (Tcl_Condition) pcondPtr;
TclRememberCondition(condPtr);
}
MASTER_UNLOCK;
GLOBAL_UNLOCK;
}
pmutexPtr = *((pthread_mutex_t **)mutexPtr);
pcondPtr = *((pthread_cond_t **)condPtr);
@@ -588,11 +587,12 @@ Tcl_ConditionNotify(
Tcl_Condition *condPtr)
{
pthread_cond_t *pcondPtr = *((pthread_cond_t **)condPtr);
if (pcondPtr != NULL) {
pthread_cond_broadcast(pcondPtr);
} else {
/*
* Noone has used the condition variable, so there are no waiters.
* No-one has used the condition variable, so there are no waiters.
*/
}
}
@@ -605,7 +605,7 @@ Tcl_ConditionNotify(
* This procedure is invoked to clean up a condition variable. This is
* only safe to call at the end of time.
*
* This assumes the Master Lock is held.
* This assumes the Global Lock is held.
*
* Results:
* None.
@@ -683,18 +683,18 @@ TclpInetNtoa(
static volatile int initialized = 0;
static pthread_key_t key;
typedef struct allocMutex {
typedef struct {
Tcl_Mutex tlock;
pthread_mutex_t plock;
} allocMutex;
} AllocMutex;
Tcl_Mutex *
TclpNewAllocMutex(void)
{
struct allocMutex *lockPtr;
register pthread_mutex_t *plockPtr;
AllocMutex *lockPtr;
pthread_mutex_t *plockPtr;
lockPtr = malloc(sizeof(struct allocMutex));
lockPtr = (AllocMutex *)malloc(sizeof(AllocMutex));
if (lockPtr == NULL) {
Tcl_Panic("could not allocate lock");
}
@@ -708,7 +708,8 @@ void
TclpFreeAllocMutex(
Tcl_Mutex *mutex) /* The alloc mutex to free. */
{
allocMutex* lockPtr = (allocMutex*) mutex;
AllocMutex *lockPtr = (AllocMutex *)mutex;
if (!lockPtr) {
return;
}
@@ -767,7 +768,7 @@ TclpThreadCreateKey(void)
{
pthread_key_t *ptkeyPtr;
ptkeyPtr = TclpSysAlloc(sizeof *ptkeyPtr, 0);
ptkeyPtr = (pthread_key_t *)TclpSysAlloc(sizeof(pthread_key_t), 0);
if (NULL == ptkeyPtr) {
Tcl_Panic("unable to allocate thread key!");
}
@@ -783,7 +784,7 @@ void
TclpThreadDeleteKey(
void *keyPtr)
{
pthread_key_t *ptkeyPtr = keyPtr;
pthread_key_t *ptkeyPtr = (pthread_key_t *)keyPtr;
if (pthread_key_delete(*ptkeyPtr)) {
Tcl_Panic("unable to delete key!");
@@ -793,22 +794,22 @@ TclpThreadDeleteKey(
}
void
TclpThreadSetMasterTSD(
TclpThreadSetGlobalTSD(
void *tsdKeyPtr,
void *ptr)
{
pthread_key_t *ptkeyPtr = tsdKeyPtr;
pthread_key_t *ptkeyPtr = (pthread_key_t *)tsdKeyPtr;
if (pthread_setspecific(*ptkeyPtr, ptr)) {
Tcl_Panic("unable to set master TSD value");
Tcl_Panic("unable to set global TSD value");
}
}
void *
TclpThreadGetMasterTSD(
TclpThreadGetGlobalTSD(
void *tsdKeyPtr)
{
pthread_key_t *ptkeyPtr = tsdKeyPtr;
pthread_key_t *ptkeyPtr = (pthread_key_t *)tsdKeyPtr;
return pthread_getspecific(*ptkeyPtr);
}
+2 -2
View File
@@ -719,8 +719,8 @@ install-libraries: libraries install-tzdata install-msgs
do \
$(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/http1.0"; \
done;
@echo "Installing package http 2.9.2 as a Tcl Module";
@$(COPY) $(ROOT_DIR)/library/http/http.tcl "$(MODULE_INSTALL_DIR)/8.6/http-2.9.2.tm";
@echo "Installing package http 2.9.3 as a Tcl Module";
@$(COPY) $(ROOT_DIR)/library/http/http.tcl "$(MODULE_INSTALL_DIR)/8.6/http-2.9.3.tm";
@echo "Installing library opt0.4 directory";
@for j in $(ROOT_DIR)/library/opt/*.tcl; \
do \
+4 -5
View File
@@ -5064,10 +5064,6 @@ TCL_SHARED_BUILD=${SHARED_BUILD}
# Perform final evaluations of variables with possible substitutions.
#--------------------------------------------------------------------
TCL_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}"
TCL_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
TCL_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
eval "TCL_SRC_DIR=\"`cd $srcdir/..; $CYGPATH $(pwd)`\""
eval "TCL_DLL_FILE=tcl${VER}${DLLSUFFIX}"
@@ -5086,12 +5082,15 @@ eval "TCL_LIB_SPEC=\"-L${libdir} -ltcl${VER}${FLAGSUFFIX}\""
# Install time header dir can be set via --includedir
eval "TCL_INCLUDE_SPEC=\"-I${includedir}\""
eval "DLLSUFFIX=${DLLSUFFIX}"
eval "LIBPREFIX=${LIBPREFIX}"
eval "LIBSUFFIX=${LIBSUFFIX}"
eval "EXESUFFIX=${EXESUFFIX}"
TCL_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}"
TCL_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
TCL_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
CFG_TCL_SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}
CFG_TCL_UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}
CFG_TCL_EXPORT_FILE_SUFFIX=${TCL_EXPORT_FILE_SUFFIX}
+4 -5
View File
@@ -300,10 +300,6 @@ TCL_SHARED_BUILD=${SHARED_BUILD}
# Perform final evaluations of variables with possible substitutions.
#--------------------------------------------------------------------
TCL_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}"
TCL_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
TCL_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
eval "TCL_SRC_DIR=\"`cd $srcdir/..; $CYGPATH $(pwd)`\""
eval "TCL_DLL_FILE=tcl${VER}${DLLSUFFIX}"
@@ -322,12 +318,15 @@ eval "TCL_LIB_SPEC=\"-L${libdir} -ltcl${VER}${FLAGSUFFIX}\""
# Install time header dir can be set via --includedir
eval "TCL_INCLUDE_SPEC=\"-I${includedir}\""
eval "DLLSUFFIX=${DLLSUFFIX}"
eval "LIBPREFIX=${LIBPREFIX}"
eval "LIBSUFFIX=${LIBSUFFIX}"
eval "EXESUFFIX=${EXESUFFIX}"
TCL_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}"
TCL_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
TCL_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
CFG_TCL_SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}
CFG_TCL_UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}
CFG_TCL_EXPORT_FILE_SUFFIX=${TCL_EXPORT_FILE_SUFFIX}
+1 -1
View File
@@ -364,7 +364,7 @@ SOURCE=..\doc\CrtObjCmd.3
# End Source File
# Begin Source File
SOURCE=..\doc\CrtSlave.3
SOURCE=..\doc\CrtAlias.3
# End Source File
# Begin Source File
+3 -3
View File
@@ -672,11 +672,11 @@ ConsoleInputProc(
*/
if (bufSize < (infoPtr->bytesRead - infoPtr->offset)) {
memcpy(buf, &infoPtr->buffer[infoPtr->offset], (size_t) bufSize);
memcpy(buf, &infoPtr->buffer[infoPtr->offset], bufSize);
bytesRead = bufSize;
infoPtr->offset += bufSize;
} else {
memcpy(buf, &infoPtr->buffer[infoPtr->offset], (size_t) bufSize);
memcpy(buf, &infoPtr->buffer[infoPtr->offset], bufSize);
bytesRead = infoPtr->bytesRead - infoPtr->offset;
/*
@@ -783,7 +783,7 @@ ConsoleOutputProc(
infoPtr->writeBufLen = toWrite;
infoPtr->writeBuf = ckalloc(toWrite);
}
memcpy(infoPtr->writeBuf, buf, (size_t) toWrite);
memcpy(infoPtr->writeBuf, buf, toWrite);
infoPtr->toWrite = toWrite;
ResetEvent(threadInfo->readyEvent);
TclPipeThreadSignal(&threadInfo->TI);
+1 -1
View File
@@ -337,7 +337,7 @@ DoRenameFile(
* character is either end-of-string or a directory separator
*/
if ((strncmp(src, dst, (size_t) Tcl_DStringLength(&srcString))==0)
if ((strncmp(src, dst, Tcl_DStringLength(&srcString))==0)
&& (dst[Tcl_DStringLength(&srcString)] == '\\'
|| dst[Tcl_DStringLength(&srcString)] == '/'
|| dst[Tcl_DStringLength(&srcString)] == '\0')) {
+2 -2
View File
@@ -229,8 +229,8 @@ TclpInitLibraryPath(
*encodingPtr = NULL;
bytes = Tcl_GetStringFromObj(pathPtr, lengthPtr);
*valuePtr = (char *)ckalloc((*lengthPtr) + 1);
memcpy(*valuePtr, bytes, (size_t)(*lengthPtr)+1);
*valuePtr = (char *)ckalloc(*lengthPtr + 1);
memcpy(*valuePtr, bytes, *lengthPtr + 1);
Tcl_DecrRefCount(pathPtr);
}
+1 -1
View File
@@ -2317,7 +2317,7 @@ PipeOutputProc(
infoPtr->writeBufLen = toWrite;
infoPtr->writeBuf = ckalloc(toWrite);
}
memcpy(infoPtr->writeBuf, buf, (size_t) toWrite);
memcpy(infoPtr->writeBuf, buf, toWrite);
infoPtr->toWrite = toWrite;
ResetEvent(infoPtr->writable);
TclPipeThreadSignal(&infoPtr->writeTI);
+3 -1
View File
@@ -45,7 +45,9 @@ typedef DWORD_PTR * PDWORD_PTR;
/*
* Ask for the winsock function typedefs, also.
*/
#define INCL_WINSOCK_API_TYPEDEFS 1
#ifndef INCL_WINSOCK_API_TYPEDEFS
# define INCL_WINSOCK_API_TYPEDEFS 1
#endif
#include <winsock2.h>
#include <ws2tcpip.h>
#ifdef HAVE_WSPIAPI_H
+1 -1
View File
@@ -1038,7 +1038,7 @@ SerialOutputProc(
infoPtr->writeBufLen = toWrite;
infoPtr->writeBuf = ckalloc(toWrite);
}
memcpy(infoPtr->writeBuf, buf, (size_t) toWrite);
memcpy(infoPtr->writeBuf, buf, toWrite);
infoPtr->toWrite = toWrite;
ResetEvent(infoPtr->evWritable);
TclPipeThreadSignal(&infoPtr->writeTI);
+1 -1
View File
@@ -378,7 +378,7 @@ InitializeHostName(
*encodingPtr = Tcl_GetEncoding(NULL, "utf-8");
*lengthPtr = Tcl_DStringLength(&ds);
*valuePtr = ckalloc((*lengthPtr) + 1);
memcpy(*valuePtr, Tcl_DStringValue(&ds), (size_t)(*lengthPtr)+1);
memcpy(*valuePtr, Tcl_DStringValue(&ds), *lengthPtr + 1);
Tcl_DStringFree(&ds);
}
+32 -32
View File
@@ -24,18 +24,18 @@ _CRTIMP unsigned int __cdecl _controlfp (unsigned int unNew, unsigned int unMask
#endif
/*
* This is the master lock used to serialize access to other serialization
* This is the global lock used to serialize access to other serialization
* data structures.
*/
static CRITICAL_SECTION masterLock;
static CRITICAL_SECTION globalLock;
static int init = 0;
#define MASTER_LOCK TclpMasterLock()
#define MASTER_UNLOCK TclpMasterUnlock()
#define GLOBAL_LOCK TclpGlobalLock()
#define GLOBAL_UNLOCK TclpGlobalUnlock()
/*
* This is the master lock used to serialize initialization and finalization
* This is the global lock used to serialize initialization and finalization
* of Tcl as a whole.
*/
@@ -43,7 +43,7 @@ static CRITICAL_SECTION initLock;
/*
* allocLock is used by Tcl's version of malloc for synchronization. For
* obvious reasons, cannot use any dyamically allocated storage.
* obvious reasons, cannot use any dynamically allocated storage.
*/
#ifdef TCL_THREADS
@@ -368,7 +368,7 @@ TclpInitLock(void)
init = 1;
InitializeCriticalSection(&joinLock);
InitializeCriticalSection(&initLock);
InitializeCriticalSection(&masterLock);
InitializeCriticalSection(&globalLock);
}
EnterCriticalSection(&initLock);
}
@@ -399,7 +399,7 @@ TclpInitUnlock(void)
/*
*----------------------------------------------------------------------
*
* TclpMasterLock
* TclpGlobalLock
*
* This procedure is used to grab a lock that serializes creation of
* mutexes, condition variables, and thread local storage keys.
@@ -411,13 +411,13 @@ TclpInitUnlock(void)
* None.
*
* Side effects:
* Acquire the master mutex.
* Acquire the global mutex.
*
*----------------------------------------------------------------------
*/
void
TclpMasterLock(void)
TclpGlobalLock(void)
{
if (!init) {
/*
@@ -430,15 +430,15 @@ TclpMasterLock(void)
init = 1;
InitializeCriticalSection(&joinLock);
InitializeCriticalSection(&initLock);
InitializeCriticalSection(&masterLock);
InitializeCriticalSection(&globalLock);
}
EnterCriticalSection(&masterLock);
EnterCriticalSection(&globalLock);
}
/*
*----------------------------------------------------------------------
*
* TclpMasterUnlock
* TclpGlobalUnlock
*
* This procedure is used to release a lock that serializes creation and
* deletion of synchronization objects.
@@ -447,15 +447,15 @@ TclpMasterLock(void)
* None.
*
* Side effects:
* Release the master mutex.
* Release the global mutex.
*
*----------------------------------------------------------------------
*/
void
TclpMasterUnlock(void)
TclpGlobalUnlock(void)
{
LeaveCriticalSection(&masterLock);
LeaveCriticalSection(&globalLock);
}
/*
@@ -464,7 +464,7 @@ TclpMasterUnlock(void)
* Tcl_GetAllocMutex
*
* This procedure returns a pointer to a statically initialized mutex for
* use by the memory allocator. The alloctor must use this lock, because
* use by the memory allocator. The allocator must use this lock, because
* all other locks are allocated...
*
* Results:
@@ -512,14 +512,14 @@ Tcl_GetAllocMutex(void)
void
TclFinalizeLock(void)
{
MASTER_LOCK;
GLOBAL_LOCK;
DeleteCriticalSection(&joinLock);
/*
* Destroy the critical section that we are holding!
*/
DeleteCriticalSection(&masterLock);
DeleteCriticalSection(&globalLock);
init = 0;
#ifdef TCL_THREADS
@@ -567,10 +567,10 @@ Tcl_MutexLock(
CRITICAL_SECTION *csPtr;
if (*mutexPtr == NULL) {
MASTER_LOCK;
GLOBAL_LOCK;
/*
* Double inside master lock check to avoid a race.
* Double inside global lock check to avoid a race.
*/
if (*mutexPtr == NULL) {
@@ -579,7 +579,7 @@ Tcl_MutexLock(
*mutexPtr = (Tcl_Mutex)csPtr;
TclRememberMutex(mutexPtr);
}
MASTER_UNLOCK;
GLOBAL_UNLOCK;
}
csPtr = *((CRITICAL_SECTION **)mutexPtr);
EnterCriticalSection(csPtr);
@@ -681,7 +681,7 @@ Tcl_ConditionWait(
*/
if (tsdPtr->flags == WIN_THREAD_UNINIT) {
MASTER_LOCK;
GLOBAL_LOCK;
/*
* Create the per-thread event and queue pointers.
@@ -695,14 +695,14 @@ Tcl_ConditionWait(
tsdPtr->flags = WIN_THREAD_RUNNING;
doExit = 1;
}
MASTER_UNLOCK;
GLOBAL_UNLOCK;
if (doExit) {
/*
* Create a per-thread exit handler to clean up the condEvent. We
* must be careful to do this outside the Master Lock because
* must be careful to do this outside the Global Lock because
* Tcl_CreateThreadExitHandler uses its own ThreadSpecificData,
* and initializing that may drop back into the Master Lock.
* and initializing that may drop back into the Global Lock.
*/
Tcl_CreateThreadExitHandler(FinalizeConditionEvent, tsdPtr);
@@ -710,7 +710,7 @@ Tcl_ConditionWait(
}
if (*condPtr == NULL) {
MASTER_LOCK;
GLOBAL_LOCK;
/*
* Initialize the per-condition queue pointers and Mutex.
@@ -724,7 +724,7 @@ Tcl_ConditionWait(
*condPtr = (Tcl_Condition) winCondPtr;
TclRememberCondition(condPtr);
}
MASTER_UNLOCK;
GLOBAL_UNLOCK;
}
csPtr = *((CRITICAL_SECTION **)mutexPtr);
winCondPtr = *((WinCondition **)condPtr);
@@ -902,7 +902,7 @@ FinalizeConditionEvent(
* This procedure is invoked to clean up a condition variable. This is
* only safe to call at the end of time.
*
* This assumes the Master Lock is held.
* This assumes the Global Lock is held.
*
* Results:
* None.
@@ -1073,19 +1073,19 @@ TclpThreadDeleteKey(
}
void
TclpThreadSetMasterTSD(
TclpThreadSetGlobalTSD(
void *tsdKeyPtr,
void *ptr)
{
DWORD *key = tsdKeyPtr;
if (!TlsSetValue(*key, ptr)) {
Tcl_Panic("unable to set master TSD value");
Tcl_Panic("unable to set global TSD value");
}
}
void *
TclpThreadGetMasterTSD(
TclpThreadGetGlobalTSD(
void *tsdKeyPtr)
{
DWORD *key = tsdKeyPtr;