summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-01-07 15:44:16 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-01-07 15:44:16 (GMT)
commit4afa38297142ce01a7e51a45b67a051b6244f8f7 (patch)
tree361d48666eead19f276d5901336ee8e58279f405
parent14a974e2d0b4cef691c867645ea568f9c5add82d (diff)
parent49a7184962b241204447d10cb9546f514237c344 (diff)
downloadtcl-4afa38297142ce01a7e51a45b67a051b6244f8f7.zip
tcl-4afa38297142ce01a7e51a45b67a051b6244f8f7.tar.gz
tcl-4afa38297142ce01a7e51a45b67a051b6244f8f7.tar.bz2
Merge 8.7
-rw-r--r--.travis.yml8
-rw-r--r--doc/CrtInterp.36
-rw-r--r--doc/Ensemble.34
-rw-r--r--doc/Eval.32
-rw-r--r--doc/FileSystem.310
-rw-r--r--doc/Interp.3121
-rw-r--r--doc/LinkVar.324
-rw-r--r--doc/ObjectType.32
-rw-r--r--doc/SetResult.345
-rw-r--r--doc/catch.n6
-rw-r--r--doc/chan.n10
-rw-r--r--doc/close.n4
-rw-r--r--doc/coroutine.n2
-rw-r--r--doc/dde.n6
-rw-r--r--doc/dict.n4
-rw-r--r--doc/exec.n2
-rw-r--r--doc/file.n2
-rw-r--r--doc/interp.n2
-rw-r--r--doc/lsearch.n2
-rw-r--r--doc/lsort.n2
-rw-r--r--doc/namespace.n4
-rw-r--r--doc/registry.n2
-rw-r--r--doc/return.n2
-rw-r--r--doc/tclvars.n2
-rw-r--r--generic/tcl.decls2
-rw-r--r--generic/tcl.h4
-rw-r--r--generic/tclBasic.c2
-rw-r--r--generic/tclCompile.c2
-rw-r--r--generic/tclDecls.h4
-rw-r--r--generic/tclExecute.c35
-rw-r--r--generic/tclInterp.c11
-rw-r--r--generic/tclLink.c8
-rw-r--r--generic/tclMain.c2
-rw-r--r--generic/tclOOCall.c2
-rw-r--r--generic/tclResult.c32
-rw-r--r--generic/tclStrToD.c155
-rw-r--r--generic/tclTest.c28
-rw-r--r--generic/tclUtil.c23
-rw-r--r--library/encoding/tis-620.enc2
-rw-r--r--tests/clock.test4
-rw-r--r--tests/encoding.test15
-rw-r--r--tests/expr.test66
-rw-r--r--unix/Makefile.in4
-rwxr-xr-xunix/configure4
-rw-r--r--unix/configure.ac2
-rw-r--r--unix/tcl.m42
-rw-r--r--unix/tclSelectNotfy.c3
-rw-r--r--unix/tclUnixInit.c3
-rw-r--r--unix/tclUnixPort.h11
-rw-r--r--win/Makefile.in6
-rw-r--r--win/tclWinChan.c6
-rw-r--r--win/tclWinConsole.c2
52 files changed, 368 insertions, 346 deletions
diff --git a/.travis.yml b/.travis.yml
index 7e41b3c..4c08c26 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -116,14 +116,14 @@ matrix:
- BUILD_DIR=unix
- CFGOPT="--enable-symbols"
# Testing on Mac, various styles
- - name: "macOS/Xcode 11/Shared/Unix-like"
+ - name: "macOS/Xcode 11.3/Shared/Unix-like"
os: osx
- osx_image: xcode11
+ osx_image: xcode11.3
env:
- BUILD_DIR=unix
- - name: "macOS/Xcode 11/Shared"
+ - name: "macOS/Xcode 11.3/Shared"
os: osx
- osx_image: xcode11
+ osx_image: xcode11.3
env:
- BUILD_DIR=macosx
install: []
diff --git a/doc/CrtInterp.3 b/doc/CrtInterp.3
index 1d49158..aacb868 100644
--- a/doc/CrtInterp.3
+++ b/doc/CrtInterp.3
@@ -22,10 +22,8 @@ Tcl_Interp *
int
\fBTcl_InterpDeleted\fR(\fIinterp\fR)
.sp
-.VS 8.6
int
\fBTcl_InterpActive\fR(\fIinterp\fR)
-.VE 8.6
.SH ARGUMENTS
.AS Tcl_Interp *interp
.AP Tcl_Interp *interp in
@@ -70,14 +68,12 @@ deleted and when the whole interpreter is being deleted. In the former case
the callback may recreate the data being deleted, but this would lead to an
infinite loop if the interpreter were being deleted.
.PP
-.VS 8.6
\fBTcl_InterpActive\fR is useful for determining whether there is any
execution of scripts ongoing in an interpreter, which is a useful piece of
information when Tcl is embedded in a garbage-collected environment and it
becomes necessary to determine whether the interpreter is a candidate for
deletion. The function returns a true value if the interpreter has at least
one active execution running inside it, and a false value otherwise.
-.VE 8.6
.SH "INTERPRETERS AND MEMORY MANAGEMENT"
.PP
\fBTcl_DeleteInterp\fR can be called at any time on an interpreter that may
@@ -138,12 +134,10 @@ All uses of interpreters in Tcl and Tk have already been protected.
Extension writers should ensure that their code also properly protects any
additional interpreters used, as described above.
.PP
-.VS 8.6
Note that the protection mechanisms do not work well with conventional garbage
collection systems. When in such a managed environment, \fBTcl_InterpActive\fR
should be used to determine when an interpreter is a candidate for deletion
due to inactivity.
-.VE 8.6
.SH "SEE ALSO"
Tcl_Preserve(3), Tcl_Release(3)
.SH KEYWORDS
diff --git a/doc/Ensemble.3 b/doc/Ensemble.3
index 30c1d3b..febc48f 100644
--- a/doc/Ensemble.3
+++ b/doc/Ensemble.3
@@ -36,13 +36,11 @@ int
int
\fBTcl_SetEnsembleMappingDict\fR(\fIinterp, token, dictObj\fR)
.sp
-.VS 8.6
int
\fBTcl_GetEnsembleParameterList\fR(\fIinterp, token, listObjPtr\fR)
.sp
int
\fBTcl_SetEnsembleParameterList\fR(\fIinterp, token, listObj\fR)
-.VE 8.6
.sp
int
\fBTcl_GetEnsembleSubcommandList\fR(\fIinterp, token, listObjPtr\fR)
@@ -163,7 +161,6 @@ All command names in prefixes set via \fBTcl_SetEnsembleMappingDict\fR
must be fully qualified.
.TP
\fBformal pre-subcommand parameter list\fR (read-write)
-.VS 8.6
A list of formal parameter names (the names only being used when generating
error messages) that come at invocation of the ensemble between the name of
the ensemble and the subcommand argument. NULL (the default) is equivalent to
@@ -174,7 +171,6 @@ respectively. The result of both of those functions is a Tcl result code
ensemble) and the
dictionary obtained from \fBTcl_GetEnsembleParameterList\fR should always be
treated as immutable even if it is unshared.
-.VE 8.6
.TP
\fBsubcommand list\fR (read-write)
.
diff --git a/doc/Eval.3 b/doc/Eval.3
index e241794..f7c6976 100644
--- a/doc/Eval.3
+++ b/doc/Eval.3
@@ -150,7 +150,7 @@ equivalent to using the \fBTCL_EVAL_GLOBAL\fR flag (see below).
of any length, concatenates them into a single string,
then calls \fBTcl_Eval\fR to execute that string as a Tcl command.
It returns the result of the command and also modifies
-\fIinterp->result\fR in the same way as \fBTcl_Eval\fR.
+the interpreter result in the same way as \fBTcl_Eval\fR.
The last argument to \fBTcl_VarEval\fR must be NULL to indicate the end
of arguments. \fBTcl_VarEval\fR is now deprecated.
.PP
diff --git a/doc/FileSystem.3 b/doc/FileSystem.3
index 28ee8f0..3b50232 100644
--- a/doc/FileSystem.3
+++ b/doc/FileSystem.3
@@ -63,10 +63,8 @@ int
\fBTcl_FSLoadFile\fR(\fIinterp, pathPtr, sym1, sym2, proc1Ptr, proc2Ptr,
loadHandlePtr, unloadProcPtr\fR)
.sp
-.VS 8.6
int
\fBTcl_FSUnloadFile\fR(\fIinterp, loadHandle\fR)
-.VE 8.6
.sp
int
\fBTcl_FSMatchInDirectory\fR(\fIinterp, resultPtr, pathPtr, pattern, types\fR)
@@ -146,7 +144,6 @@ Tcl_Obj *
Tcl_StatBuf *
\fBTcl_AllocStatBuf\fR()
.sp
-.VS 8.6
Tcl_WideInt
\fBTcl_GetAccessTimeFromStat\fR(\fIstatPtr\fR)
.sp
@@ -185,7 +182,6 @@ Tcl_WideUInt
.sp
int
\fBTcl_GetUserIdFromStat\fR(\fIstatPtr\fR)
-.VE 8.6
.SH ARGUMENTS
.AS Tcl_GlobTypeData **srcPathPtr out
.AP "const Tcl_Filesystem" *fsPtr in
@@ -444,20 +440,16 @@ belongs will be called. If that filesystem does not implement this
function (most virtual filesystems will not, because of OS limitations
in dynamically loading binary code), Tcl will attempt to copy the file
to a temporary directory and load that temporary file.
-.VS 8.6
\fBTcl_FSUnloadFile\fR reverses the operation, asking for the library
indicated by the \fIloadHandle\fR to be removed from the process. Note that,
unlike with the \fBunload\fR command, this does not give the library any
opportunity to clean up.
-.VE 8.6
.PP
Both the above functions return a standard Tcl completion code. If an error
occurs, an error message is left in the \fIinterp\fR's result.
.PP
-.VS 8.6
The token provided via the variable indicated by \fIloadHandlePtr\fR may be
used with \fBTcl_FindSymbol\fR.
-.VE 8.6
.PP
\fBTcl_FSMatchInDirectory\fR is used by the globbing code to search a
directory for all files which match a given pattern. The appropriate
@@ -795,7 +787,6 @@ may be deallocated by being passed to \fBckfree\fR). This allows extensions to
invoke \fBTcl_FSStat\fR and \fBTcl_FSLstat\fR without being dependent on the
size of the buffer. That in turn depends on the flags used to build Tcl.
.PP
-.VS 8.6
The portable fields of a \fITcl_StatBuf\fR may be read using the following
functions, each of which returns the value of the corresponding field listed
in the table below. Note that on some platforms there may be other fields in
@@ -819,7 +810,6 @@ for a full description of these fields.
\fBTcl_GetBlocksFromStat\fR st_blocks
\fBTcl_GetBlockSizeFromStat\fR st_blksize
.DE
-.VE 8.6
.SH "THE VIRTUAL FILESYSTEM API"
.PP
A filesystem provides a \fBTcl_Filesystem\fR structure that contains
diff --git a/doc/Interp.3 b/doc/Interp.3
index 4ccff21..c1b9803 100644
--- a/doc/Interp.3
+++ b/doc/Interp.3
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-.TH Tcl_Interp 3 7.5 Tcl "Tcl Library Procedures"
+.TH Tcl_Interp 3 8.7 Tcl "Tcl Library Procedures"
.so man.macros
.BS
.SH NAME
@@ -15,9 +15,9 @@ Tcl_Interp \- client-visible fields of interpreter structures
\fB#include <tcl.h>\fR
.sp
typedef struct {
- char *\fIresult\fR;
- Tcl_FreeProc *\fIfreeProc\fR;
- int \fIerrorLine\fR;
+ char *\fIresult\fR; /* NO LONGER AVAILABLE */
+ Tcl_FreeProc *\fIfreeProc\fR; /* NO LONGER AVAILABLE */
+ int \fIerrorLine\fR; /* NO LONGER AVAILABLE */
} \fBTcl_Interp\fR;
typedef void \fBTcl_FreeProc\fR(
@@ -25,110 +25,17 @@ typedef void \fBTcl_FreeProc\fR(
.BE
.SH DESCRIPTION
.PP
-The \fBTcl_CreateInterp\fR procedure returns a pointer to a Tcl_Interp
+The \fBTcl_CreateInterp\fR procedure returns a pointer to a \fBTcl_Interp\fR
structure. Callers of \fBTcl_CreateInterp\fR should use this pointer
as an opaque token, suitable for nothing other than passing back to
-other routines in the Tcl interface. Accessing fields directly through
-the pointer as described below is no longer supported. The supported
-public routines \fBTcl_SetResult\fR, \fBTcl_GetResult\fR,
-\fBTcl_SetErrorLine\fR, \fBTcl_GetErrorLine\fR must be used instead.
-.PP
-For legacy programs and extensions no longer being maintained, compiles
-against the Tcl 8.6 header files are only possible with the compiler
-directives
-.CS
-#define USE_INTERP_RESULT
-.CE
-and/or
-.CS
-#define USE_INTERP_ERRORLINE
-.CE
-depending on which fields of the \fBTcl_Interp\fR struct are accessed.
-These directives may be embedded in code or supplied via compiler options.
-.PP
-The \fIresult\fR and \fIfreeProc\fR fields are used to return
-results or error messages from commands.
-This information is returned by command procedures back to \fBTcl_Eval\fR,
-and by \fBTcl_Eval\fR back to its callers.
-The \fIresult\fR field points to the string that represents the
-result or error message, and the \fIfreeProc\fR field tells how
-to dispose of the storage for the string when it is not needed anymore.
-The easiest way for command procedures to manipulate these
-fields is to call procedures like \fBTcl_SetResult\fR
-or \fBTcl_AppendResult\fR; they
-will hide all the details of managing the fields.
-The description below is for those procedures that manipulate the
-fields directly.
-.PP
-Whenever a command procedure returns, it must ensure
-that the \fIresult\fR field of its interpreter points to the string
-being returned by the command.
-The \fIresult\fR field must always point to a valid string.
-If a command wishes to return no result then \fIinterp->result\fR
-should point to an empty string.
-Normally, results are assumed to be statically allocated,
-which means that the contents will not change before the next time
-\fBTcl_Eval\fR is called or some other command procedure is invoked.
-In this case, the \fIfreeProc\fR field must be zero.
-Alternatively, a command procedure may dynamically
-allocate its return value (e.g. using \fBTcl_Alloc\fR)
-and store a pointer to it in \fIinterp->result\fR.
-In this case, the command procedure must also set \fIinterp->freeProc\fR
-to the address of a procedure that can free the value, or \fBTCL_DYNAMIC\fR
-if the storage was allocated directly by Tcl or by a call to
-\fBTcl_Alloc\fR.
-If \fIinterp->freeProc\fR is non-zero, then Tcl will call \fIfreeProc\fR
-to free the space pointed to by \fIinterp->result\fR before it
-invokes the next command.
-If a client procedure overwrites \fIinterp->result\fR when
-\fIinterp->freeProc\fR is non-zero, then it is responsible for calling
-\fIfreeProc\fR to free the old \fIinterp->result\fR (the \fBTcl_FreeResult\fR
-macro should be used for this purpose).
-.PP
-\fIFreeProc\fR should have arguments and result that match the
-\fBTcl_FreeProc\fR declaration above: it receives a single
-argument which is a pointer to the result value to free.
-In most applications \fBTCL_DYNAMIC\fR is the only non-zero value ever
-used for \fIfreeProc\fR.
-However, an application may store a different procedure address
-in \fIfreeProc\fR in order to use an alternate memory allocator
-or in order to do other cleanup when the result memory is freed.
-.PP
-As part of processing each command, \fBTcl_Eval\fR initializes
-\fIinterp->result\fR
-and \fIinterp->freeProc\fR just before calling the command procedure for
-the command. The \fIfreeProc\fR field will be initialized to zero,
-and \fIinterp->result\fR will point to an empty string. Commands that
-do not return any value can simply leave the fields alone.
-Furthermore, the empty string pointed to by \fIresult\fR is actually
-part of an array of approximately 200 characters.
-If a command wishes to return a short string, it can simply copy
-it to the area pointed to by \fIinterp->result\fR. Or, it can use
-the sprintf procedure to generate a short result string at the location
-pointed to by \fIinterp->result\fR.
-.PP
-It is a general convention in Tcl-based applications that the result
-of an interpreter is normally in the initialized state described
-in the previous paragraph.
-Procedures that manipulate an interpreter's result (e.g. by
-returning an error) will generally assume that the result
-has been initialized when the procedure is called.
-If such a procedure is to be called after the result has been
-changed, then \fBTcl_ResetResult\fR should be called first to
-reset the result to its initialized state. The direct use of
-\fIinterp->result\fR is strongly deprecated (see \fBTcl_SetResult\fR).
-.PP
-The \fIerrorLine\fR
-field is valid only after \fBTcl_Eval\fR returns
-a \fBTCL_ERROR\fR return code. In this situation the \fIerrorLine\fR
-field identifies the line number of the command being executed when
-the error occurred. The line numbers are relative to the command
-being executed: 1 means the first line of the command passed to
-\fBTcl_Eval\fR, 2 means the second line, and so on.
-The \fIerrorLine\fR field is typically used in conjunction with
-\fBTcl_AddErrorInfo\fR to report information about where an error
-occurred.
-\fIErrorLine\fR should not normally be modified except by \fBTcl_Eval\fR.
+other routines in the Tcl interface from the same thread that called
+\fBTcl_CreateInterp\fR. The \fBTcl_Interp\fR struct no longer has any
+supported client-visible fields. Supported public routines such as
+\fBTcl_SetResult\fR, \fBTcl_GetResult\fR, \fBTcl_SetErrorLine\fR,
+\fBTcl_GetErrorLine\fR must be used instead.
+.PP
+Any legacy programs and extensions trying to access the fields above
+in their source code will need conversion to compile for Tcl 8.7 and later.
.SH KEYWORDS
-free, initialized, interpreter, malloc, result
+interpreter, result
diff --git a/doc/LinkVar.3 b/doc/LinkVar.3
index 1e42858..92e7d03 100644
--- a/doc/LinkVar.3
+++ b/doc/LinkVar.3
@@ -96,7 +96,7 @@ Any value written into the Tcl variable must have a proper integer
form acceptable to \fBTcl_GetIntFromObj\fR; attempts to write
non-integer values into \fIvarName\fR will be rejected with
Tcl errors. Incomplete integer representations (like the empty
-string, '+', '-' or the hex/octal/binary prefix) are accepted
+string, '+', '-' or the hex/octal/decimal/binary prefix) are accepted
as if they are valid too.
.TP
\fBTCL_LINK_UINT\fR
@@ -107,7 +107,7 @@ integer form acceptable to \fBTcl_GetWideIntFromObj\fR and in the
platform's defined range for the \fBunsigned int\fR type; attempts to
write non-integer values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors. Incomplete integer
-representations (like the empty string, '+', '-' or the hex/octal/binary
+representations (like the empty string, '+', '-' or the hex/octal/decimal/binary
prefix) are accepted as if they are valid too.
.TP
\fBTCL_LINK_CHAR\fR
@@ -118,7 +118,7 @@ form acceptable to \fBTcl_GetIntFromObj\fR and be in the range of the
\fBchar\fR datatype; attempts to write non-integer or out-of-range
values into \fIvarName\fR will be rejected with Tcl errors. Incomplete
integer representations (like the empty string, '+', '-' or the
-hex/octal/binary prefix) are accepted as if they are valid too.
+hex/octal/decimal/binary prefix) are accepted as if they are valid too.
.RS
.PP
.VS "TIP 312"
@@ -141,7 +141,7 @@ integer form acceptable to \fBTcl_GetIntFromObj\fR and in the
platform's defined range for the \fBunsigned char\fR type; attempts to
write non-integer values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors. Incomplete integer
-representations (like the empty string, '+', '-' or the hex/octal/binary
+representations (like the empty string, '+', '-' or the hex/octal/decimal/binary
prefix) are accepted as if they are valid too.
.RS
.PP
@@ -166,7 +166,7 @@ form acceptable to \fBTcl_GetIntFromObj\fR and be in the range of the
\fBshort\fR datatype; attempts to write non-integer or out-of-range
values into \fIvarName\fR will be rejected with Tcl errors. Incomplete
integer representations (like the empty string, '+', '-' or the
-hex/octal/binary prefix) are accepted as if they are valid too.
+hex/octal/decimal/binary prefix) are accepted as if they are valid too.
.TP
\fBTCL_LINK_USHORT\fR
.
@@ -176,7 +176,7 @@ integer form acceptable to \fBTcl_GetIntFromObj\fR and in the
platform's defined range for the \fBunsigned short\fR type; attempts to
write non-integer values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors. Incomplete integer
-representations (like the empty string, '+', '-' or the hex/octal/binary
+representations (like the empty string, '+', '-' or the hex/octal/decimal/binary
prefix) are accepted as if they are valid too.
.TP
\fBTCL_LINK_LONG\fR
@@ -187,7 +187,7 @@ form acceptable to \fBTcl_GetLongFromObj\fR; attempts to write
non-integer or out-of-range
values into \fIvarName\fR will be rejected with Tcl errors. Incomplete
integer representations (like the empty string, '+', '-' or the
-hex/octal/binary prefix) are accepted as if they are valid too.
+hex/octal/decimal/binary prefix) are accepted as if they are valid too.
.TP
\fBTCL_LINK_ULONG\fR
.
@@ -197,7 +197,7 @@ integer form acceptable to \fBTcl_GetWideIntFromObj\fR and in the
platform's defined range for the \fBunsigned long\fR type; attempts to
write non-integer values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors. Incomplete integer
-representations (like the empty string, '+', '-' or the hex/octal/binary
+representations (like the empty string, '+', '-' or the hex/octal/decimal/binary
prefix) are accepted as if they are valid too.
.TP
\fBTCL_LINK_DOUBLE\fR
@@ -207,7 +207,7 @@ Any value written into the Tcl variable must have a proper real
form acceptable to \fBTcl_GetDoubleFromObj\fR; attempts to write
non-real values into \fIvarName\fR will be rejected with
Tcl errors. Incomplete integer or real representations (like the
-empty string, '.', '+', '-' or the hex/octal/binary prefix) are
+empty string, '.', '+', '-' or the hex/octal/decimal/binary prefix) are
accepted as if they are valid too.
.TP
\fBTCL_LINK_FLOAT\fR
@@ -219,7 +219,7 @@ range acceptable for a \fBfloat\fR; attempts to
write non-real values (or values outside the range) into
\fIvarName\fR will be rejected with Tcl errors. Incomplete integer
or real representations (like the empty string, '.', '+', '-' or
-the hex/octal/binary prefix) are accepted as if they are valid too.
+the hex/octal/decimal/binary prefix) are accepted as if they are valid too.
.TP
\fBTCL_LINK_WIDE_INT\fR
.
@@ -230,7 +230,7 @@ Any value written into the Tcl variable must have a proper integer
form acceptable to \fBTcl_GetWideIntFromObj\fR; attempts to write
non-integer values into \fIvarName\fR will be rejected with
Tcl errors. Incomplete integer representations (like the empty
-string, '+', '-' or the hex/octal/binary prefix) are accepted
+string, '+', '-' or the hex/octal/decimal/binary prefix) are accepted
as if they are valid too.
.TP
\fBTCL_LINK_WIDE_UINT\fR
@@ -244,7 +244,7 @@ cast to unsigned);
.\" FIXME! Use bignums instead.
attempts to write non-integer values into \fIvarName\fR will be
rejected with Tcl errors. Incomplete integer representations (like
-the empty string, '+', '-' or the hex/octal/binary prefix) are accepted
+the empty string, '+', '-' or the hex/octal/decimal/binary prefix) are accepted
as if they are valid too.
.TP
\fBTCL_LINK_BOOLEAN\fR
diff --git a/doc/ObjectType.3 b/doc/ObjectType.3
index bf414ac..67f5174 100644
--- a/doc/ObjectType.3
+++ b/doc/ObjectType.3
@@ -85,14 +85,12 @@ unless \fIinterp\fR is NULL.
Otherwise, it returns \fBTCL_OK\fR.
Passing a NULL \fIinterp\fR allows this procedure to be used
as a test whether the conversion can be done (and in fact was done).
-.VS 8.5
.PP
In many cases, the \fItypePtr->setFromAnyProc\fR routine will
set \fIobjPtr->typePtr\fR to the argument value \fItypePtr\fR,
but that is no longer guaranteed. The \fIsetFromAnyProc\fR is
free to set the internal representation for \fIobjPtr\fR to make
use of another related Tcl_ObjType, if it sees fit.
-.VE 8.5
.SH "THE TCL_OBJTYPE STRUCTURE"
.PP
Extension writers can define new value types by defining four
diff --git a/doc/SetResult.3 b/doc/SetResult.3
index e5b81d7..a640956 100644
--- a/doc/SetResult.3
+++ b/doc/SetResult.3
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-.TH Tcl_SetResult 3 8.0 Tcl "Tcl Library Procedures"
+.TH Tcl_SetResult 3 8.7 Tcl "Tcl Library Procedures"
.so man.macros
.BS
.SH NAME
@@ -30,9 +30,7 @@ const char *
.sp
\fBTcl_ResetResult\fR(\fIinterp\fR)
.sp
-.VS 8.6
-\fBTcl_TransferResult\fR(\fIsourceInterp, result, targetInterp\fR)
-.VE 8.6
+\fBTcl_TransferResult\fR(\fIsourceInterp, code, targetInterp\fR)
.sp
\fBTcl_AppendElement\fR(\fIinterp, element\fR)
.sp
@@ -57,18 +55,11 @@ Address of procedure to call to release storage at
An argument list which must have been initialized using
\fBva_start\fR, and cleared using \fBva_end\fR.
.AP Tcl_Interp *sourceInterp in
-.VS 8.6
-Interpreter that the result and error information should be copied from.
-.VE 8.6
+Interpreter that the result and return options should be transferred from.
.AP Tcl_Interp *targetInterp in
-.VS 8.6
-Interpreter that the result and error information should be copied to.
-.VE 8.6
-.AP int result in
-.VS 8.6
-If \fBTCL_OK\fR, only copy the result. If \fBTCL_ERROR\fR, copy the error
-information as well.
-.VE 8.6
+Interpreter that the result and return options should be transferred to.
+.AP int code in
+Return code value that controls transfer of return options.
.BE
.SH DESCRIPTION
.PP
@@ -155,12 +146,14 @@ call; the last argument in the list must be a NULL pointer.
\fBTcl_AppendResultVA\fR is the same as \fBTcl_AppendResult\fR except that
instead of taking a variable number of arguments it takes an argument list.
.PP
-.VS 8.6
-\fBTcl_TransferResult\fR moves a result from one interpreter to another,
-optionally (dependent on the \fIresult\fR parameter) including the error
-information dictionary as well. The interpreters must be in the same thread.
-The source interpreter will have its result reset by this operation.
-.VE 8.6
+\fBTcl_TransferResult\fR transfers interpreter state from \fIsourceInterp\fR
+to \fItargetInterp\fR. The two interpreters must have been created in the
+same thread. If \fIsourceInterp\fR and \fItargetInterp\fR are the same,
+nothing is done. Otherwise, \fBTcl_TransferResult\fR moves the result
+from \fIsourceInterp\fR to \fItargetInterp\fR, and resets the result
+in \fIsourceInterp\fR. It also moves the return options dictionary as
+controlled by the return code value \fIcode\fR in the same manner
+as \fBTcl_GetReturnOptions\fR.
.SH "DEPRECATED INTERFACES"
.SS "OLD STRING PROCEDURES"
.PP
@@ -202,14 +195,9 @@ is about to replace one result value with another.
It used to be legal for programs to
directly read and write \fIinterp->result\fR
to manipulate the interpreter result. The Tcl headers no longer
-permit this access by default, and C code still doing this must
+permit this access. C code still doing this must
be updated to use supported routines \fBTcl_GetObjResult\fR,
\fBTcl_GetStringResult\fR, \fBTcl_SetObjResult\fR, and \fBTcl_SetResult\fR.
-As a migration aid, access can be restored with the compiler directive
-.CS
-#define USE_INTERP_RESULT
-.CE
-but this is meant only to offer life support to otherwise dead code.
.SH "THE TCL_FREEPROC ARGUMENT TO TCL_SETRESULT"
.PP
\fBTcl_SetResult\fR's \fIfreeProc\fR argument specifies how
@@ -250,6 +238,7 @@ typedef void \fBTcl_FreeProc\fR(
When \fIfreeProc\fR is called, its \fIblockPtr\fR will be set to
the value of \fIresult\fR passed to \fBTcl_SetResult\fR.
.SH "SEE ALSO"
-Tcl_AddErrorInfo, Tcl_CreateObjCommand, Tcl_SetErrorCode, Tcl_Interp
+Tcl_AddErrorInfo, Tcl_CreateObjCommand, Tcl_SetErrorCode, Tcl_Interp,
+Tcl_GetReturnOptions
.SH KEYWORDS
append, command, element, list, value, result, return value, interpreter
diff --git a/doc/catch.n b/doc/catch.n
index d43a7ec..8d885d4 100644
--- a/doc/catch.n
+++ b/doc/catch.n
@@ -56,9 +56,7 @@ When the return code from evaluation of \fIscript\fR is
\fBTCL_ERROR\fR, four additional entries are defined in the dictionary
of return options stored in \fIoptionsVarName\fR: \fB\-errorinfo\fR,
\fB\-errorcode\fR, \fB\-errorline\fR, and
-.VS 8.6
\fB\-errorstack\fR.
-.VE 8.6
The value of the \fB\-errorinfo\fR entry is a formatted stack trace containing
more information about the context in which the error happened. The formatted
stack trace is meant to be read by a person. The value of the
@@ -67,7 +65,6 @@ list. The \fB\-errorcode\fR value is meant to be further processed by
programs, and may not be particularly readable by people. The value of the
\fB\-errorline\fR entry is an integer indicating which line of \fIscript\fR
was being evaluated when the error occurred.
-.VS 8.6
The value of the \fB\-errorstack\fR entry is an
even-sized list made of token-parameter pairs accumulated while
unwinding the stack. The token may be
@@ -87,14 +84,11 @@ the static text of the calling sites, and
.IP [3]
it is coarser-grained, with only one element per stack frame (like procs; no
separate elements for \fBforeach\fR constructs for example).
-.VE 8.6
.PP
The values of the \fB\-errorinfo\fR and \fB\-errorcode\fR entries of
the most recent error are also available as values of the global
variables \fB::errorInfo\fR and \fB::errorCode\fR respectively.
-.VS 8.6
The value of the \fB\-errorstack\fR entry surfaces as \fBinfo errorstack\fR.
-.VE 8.6
.PP
Tcl packages may provide commands that set other entries in the
dictionary of return options, and the \fBreturn\fR command may be
diff --git a/doc/chan.n b/doc/chan.n
index 81aa9f4..962992b 100644
--- a/doc/chan.n
+++ b/doc/chan.n
@@ -35,7 +35,6 @@ turned on by default.
.
Close and destroy the channel called \fIchannelId\fR. Note that this
deletes all existing file-events registered on the channel.
-.VS 8.6
If the \fIdirection\fR argument (which must be \fBread\fR or \fBwrite\fR or
any unique abbreviation of them) is present, the channel will only be
half-closed, so that it can go from being read-write to write-only or
@@ -45,7 +44,6 @@ write-only channels. Without the \fIdirection\fR argument, the channel is
closed for both reading and writing (but only if those directions are
currently open). It is an error to close a read-only channel for writing, or a
write-only channel for reading.
-.VE 8.6
.RS
.PP
As part of closing the channel, all buffered output is flushed to the
@@ -83,12 +81,10 @@ an error occurs while flushing output. If a command in a command
pipeline created with \fBopen\fR returns an error, \fBchan close\fR
generates an error (similar to the \fBexec\fR command.)
.PP
-.VS 8.6
Note that half-closes of sockets and command pipelines can have important side
effects because they result in a shutdown() or close() of the underlying
system resource, which can change how other processes or systems respond to
the Tcl program.
-.VE 8.6
.RE
.TP
\fBchan configure \fIchannelId\fR ?\fIoptionName\fR? ?\fIvalue\fR? ?\fIoptionName value\fR?...
@@ -540,7 +536,6 @@ an extremely long line that exceeds the available memory to buffer it).
Returns -1 if the channel was not opened for the mode in question.
.TP
\fBchan pipe\fR
-.VS 8.6
Creates a standalone pipe whose read- and write-side channels are
returned as a 2-element list, the first element being the read side and
the second the write side. Can be useful e.g. to redirect
@@ -561,16 +556,13 @@ is most likely to show up when using pipelines for testing; care should be
taken to ensure that deadlocks do not occur and that potential short reads are
allowed for.
.RE
-.VE 8.6
.TP
\fBchan pop \fIchannelId\fR
-.VS 8.6
Removes the topmost transformation from the channel \fIchannelId\fR, if there
is any. If there are no transformations added to \fIchannelId\fR, this is
equivalent to \fBchan close\fR of that channel. The result is normally the
empty string, but can be an error in some situations (i.e. where the
underlying system stream is closed and that results in an error).
-.VE 8.6
.TP
\fBchan postevent \fIchannelId eventSpec\fR
.
@@ -609,7 +601,6 @@ executed in the interpreter that set them up.
.RE
.TP
\fBchan push \fIchannelId cmdPrefix\fR
-.VS 8.6
Adds a new transformation on top of the channel \fIchannelId\fR. The
\fIcmdPrefix\fR argument describes a list of one or more words which represent
a handler that will be used to implement the transformation. The command
@@ -618,7 +609,6 @@ The result of this subcommand is a handle to the transformation. Note that it
is important to make sure that the transformation is capable of supporting the
channel mode that it is used with or this can make the channel neither
readable nor writable.
-.VE 8.6
.TP
\fBchan puts\fR ?\fB\-nonewline\fR? ?\fIchannelId\fR? \fIstring\fR
.
diff --git a/doc/close.n b/doc/close.n
index 5daf3e2..3d18aea 100644
--- a/doc/close.n
+++ b/doc/close.n
@@ -49,16 +49,13 @@ When the last interpreter in which the channel is registered invokes
.PP
Channels are automatically closed when an interpreter is destroyed and
when the process exits.
-.VS 8.6
From 8.6 on (TIP#398), nonblocking channels are no longer switched to blocking mode when exiting; this guarantees a timely exit even when the peer or a communication channel is stalled. To ensure proper flushing of stalled nonblocking channels on exit, one must now either (a) actively switch them back to blocking or (b) use the environment variable TCL_FLUSH_NONBLOCKING_ON_EXIT, which when set and not equal to "0" restores the previous behavior.
-.VE 8.6
.PP
The command returns an empty string, and may generate an error if
an error occurs while flushing output. If a command in a command
pipeline created with \fBopen\fR returns an error, \fBclose\fR
generates an error (similar to the \fBexec\fR command.)
.PP
-.VS 8.6
The two-argument form is a
.QW "half-close" :
given a bidirectional channel like a
@@ -80,7 +77,6 @@ abnormal exit error.
.PP
Currently only sockets and command pipelines support half-close. A future
extension will allow reflected and stacked channels to do so.
-.VE 8.6
.SH EXAMPLE
.PP
This illustrates how you can use Tcl to ensure that files get closed
diff --git a/doc/coroutine.n b/doc/coroutine.n
index a032d2e..11f9069 100644
--- a/doc/coroutine.n
+++ b/doc/coroutine.n
@@ -9,7 +9,7 @@
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
-coroutine, yield, yieldto \- Create and produce values from coroutines
+coroutine, yield, yieldto, coroinject, coroprobe \- Create and produce values from coroutines
.SH SYNOPSIS
.nf
\fBcoroutine \fIname command\fR ?\fIarg...\fR?
diff --git a/doc/dde.n b/doc/dde.n
index ac3d8ed..cf7376e 100644
--- a/doc/dde.n
+++ b/doc/dde.n
@@ -17,11 +17,9 @@ dde \- Execute a Dynamic Data Exchange command
.sp
\fBdde servername\fR ?\fB\-force\fR? ?\fB\-handler \fIproc\fR? ?\fB\-\|\-\fR? ?\fItopic\fR?
.sp
-.VS 8.6
\fBdde execute\fR ?\fB\-async\fR? ?\fB\-binary\fR? \fIservice topic data\fR
.sp
\fBdde poke\fR ?\fB\-binary\fR? \fIservice topic item data\fR
-.VE 8.6
.sp
\fBdde request\fR ?\fB\-binary\fR? \fIservice topic item\fR
.sp
@@ -82,13 +80,11 @@ script is run in the application. The \fB\-async\fR option requests
asynchronous invocation. The command returns an error message if the
script did not run, unless the \fB\-async\fR flag was used, in which case
the command returns immediately with no error.
-.VS 8.6
Without the \fB\-binary\fR option all data will be sent in unicode. For
dde clients which don't implement the CF_UNICODE clipboard format, this
will automatically be translated to the system encoding. You can use
the \fB\-binary\fR option in combination with the result of
\fBencoding convertto\fR to send data in any other encoding.
-.VE 8.6
.TP
\fBdde poke\fR ?\fB\-binary\fR? \fIservice topic item data\fR
.
@@ -99,13 +95,11 @@ specific but can be a command to the server or the name of a file to work
on. The \fIitem\fR is also application specific and is often not used, but
it must always be non-null. The \fIdata\fR field is given to the remote
application.
-.VS 8.6
Without the \fB\-binary\fR option all data will be sent in unicode. For
dde clients which don't implement the CF_UNICODE clipboard format, this
will automatically be translated to the system encoding. You can use
the \fB\-binary\fR option in combination with the result of
\fBencoding convertto\fR to send data in any other encoding.
-.VE 8.6
.TP
\fBdde request\fR ?\fB\-binary\fR? \fIservice topic item\fR
.
diff --git a/doc/dict.n b/doc/dict.n
index 3475415..ff56b22 100644
--- a/doc/dict.n
+++ b/doc/dict.n
@@ -54,10 +54,8 @@ type (which may be abbreviated.) Supported filter types are:
.RS
.TP
\fBdict filter \fIdictionaryValue \fBkey\fR ?\fIglobPattern ...\fR?
-.VS 8.6
The key rule only matches those key/value pairs whose keys match any
of the given patterns (in the style of \fBstring match\fR.)
-.VE 8.6
.TP
\fBdict filter \fIdictionaryValue \fBscript {\fIkeyVariable valueVariable\fB} \fIscript\fR
.
@@ -74,10 +72,8 @@ result. The key/value pairs are tested in the order in which the keys
were inserted into the dictionary.
.TP
\fBdict filter \fIdictionaryValue \fBvalue \fR?\fIglobPattern ...\fR?
-.VS 8.6
The value rule only matches those key/value pairs whose values match any
of the given patterns (in the style of \fBstring match\fR.)
-.VE 8.6
.RE
.TP
\fBdict for {\fIkeyVariable valueVariable\fB} \fIdictionaryValue body\fR
diff --git a/doc/exec.n b/doc/exec.n
index 99dfdc5..855a192 100644
--- a/doc/exec.n
+++ b/doc/exec.n
@@ -338,7 +338,6 @@ if {[catch {\fBexec\fR grep foo bar.txt} results options]} {
}
}
.CE
-.VS 8.6
.PP
This is more easily written using the \fBtry\fR command, as that makes
it simpler to trap specific types of errors. This is
@@ -352,7 +351,6 @@ try {
set status [lindex [dict get $options -errorcode] 2]
}
.CE
-.VE 8.6
.SS "WORKING WITH QUOTED ARGUMENTS"
.PP
When translating a command from a Unix shell invocation, care should
diff --git a/doc/file.n b/doc/file.n
index 6f97f0b..da602fd 100644
--- a/doc/file.n
+++ b/doc/file.n
@@ -465,7 +465,6 @@ between platforms:
.TP
\fBfile tempfile\fR ?\fInameVar\fR? ?\fItemplate\fR?
'\" TIP #210
-.VS 8.6
Creates a temporary file and returns a read-write channel opened on that file.
If the \fInameVar\fR is given, it specifies a variable that the name of the
temporary file will be written into; if absent, Tcl will attempt to arrange
@@ -480,7 +479,6 @@ Note that temporary files are \fIonly\fR ever created on the native
filesystem. As such, they can be relied upon to be used with operating-system
native APIs and external programs that require a filename.
.RE
-.VE 8.6
.TP
\fBfile type \fIname\fR
.
diff --git a/doc/interp.n b/doc/interp.n
index 40ab9f9..54555e3 100644
--- a/doc/interp.n
+++ b/doc/interp.n
@@ -154,7 +154,6 @@ what to set the interpreter's background exception handler to. See the
\fBBACKGROUND EXCEPTION HANDLING\fR section for more details.
.TP
\fBinterp\fR \fBcancel \fR?\fB\-unwind\fR? ?\fB\-\|\-\fR? ?\fIpath\fR? ?\fIresult\fR?
-.VS 8.6
Cancels the script being evaluated in the interpreter identified by
\fIpath\fR. Without the \fB\-unwind\fR switch the evaluation stack for
the interpreter is unwound until an enclosing catch command is found or
@@ -167,7 +166,6 @@ switches; it may be needed if \fIpath\fR is an unusual value such
as \fB\-safe\fR. If \fIresult\fR is present, it will be used as the
error message string; otherwise, a default error message string will be
used.
-.VE 8.6
.TP
\fBinterp\fR \fBcreate \fR?\fB\-safe\fR? ?\fB\-\|\-\fR? ?\fIpath\fR?
.
diff --git a/doc/lsearch.n b/doc/lsearch.n
index 12c2786..9172d96 100644
--- a/doc/lsearch.n
+++ b/doc/lsearch.n
@@ -134,7 +134,6 @@ The list elements are sorted in increasing order. This option is only
meaningful when used with \fB\-sorted\fR.
.TP
\fB\-bisect\fR
-.VS 8.6
Inexact search when the list elements are in sorted order. For an increasing
list the last index where the element is less than or equal to the pattern
is returned. For a decreasing list the last index where the element is greater
@@ -142,7 +141,6 @@ than or equal to the pattern is returned. If the pattern is before the first
element or the list is empty, -1 is returned.
This option implies \fB\-sorted\fR and cannot be used with either \fB\-all\fR
or \fB\-not\fR.
-.VE 8.6
.SS "NESTED LIST OPTIONS"
.PP
These options are used to search lists of lists. They may be used
diff --git a/doc/lsort.n b/doc/lsort.n
index c3245b2..17a921a 100644
--- a/doc/lsort.n
+++ b/doc/lsort.n
@@ -221,7 +221,6 @@ Sorting using indices:
{e 1} {d 2} { c 3} {b 4} {a 5}
.CE
.PP
-.VS 8.6
Sorting a dictionary:
.PP
.CS
@@ -239,7 +238,6 @@ Sorting using striding and multiple indices:
{{Bob Smith} 25 Audi {Jane Doe} 40 Ford}
{{Jane Doe} 40 Ford {Bob Smith} 25 Audi}
.CE
-.VE 8.6
.PP
Stripping duplicate values using sorting:
.PP
diff --git a/doc/namespace.n b/doc/namespace.n
index b0b6e25..3196cac 100644
--- a/doc/namespace.n
+++ b/doc/namespace.n
@@ -788,12 +788,10 @@ name. Note that when this option is non-empty and the
will be exactly those words that have mappings in the dictionary.
.TP
\fB\-parameters\fR
-.VS 8.6
This option gives a list of named arguments (the names being used during
generation of error messages) that are passed by the caller of the ensemble
between the name of the ensemble and the subcommand argument. By default, it
is the empty list.
-.VE 8.6
.TP
\fB\-prefixes\fR
.
@@ -943,7 +941,6 @@ Remove all imported commands from the current namespace:
namespace forget {*}[namespace import]
.CE
.PP
-.VS 8.6
Create an ensemble for simple working with numbers, using the
\fB\-parameters\fR option to allow the operator to be put between the first
and second arguments.
@@ -959,7 +956,6 @@ and second arguments.
# In use, the ensemble works like this:
puts [do 1 plus [do 9 minus 7]]
.CE
-.VE 8.6
.SH "SEE ALSO"
interp(n), upvar(n), variable(n)
.SH KEYWORDS
diff --git a/doc/registry.n b/doc/registry.n
index ec5910c..66b2dd9 100644
--- a/doc/registry.n
+++ b/doc/registry.n
@@ -44,13 +44,11 @@ one of \fBHKEY_LOCAL_MACHINE\fR, \fBHKEY_USERS\fR,
\fBHKEY_DYN_DATA\fR. The \fIkeypath\fR can be one or more
registry key names separated by backslash (\fB\e\fR) characters.
.PP
-.VS 8.6
The optional \fI\-mode\fR argument indicates which registry to work
with; when it is \fB\-32bit\fR the 32-bit registry will be used, and
when it is \fB\-64bit\fR the 64-bit registry will be used. If this
argument is omitted, the system's default registry will be the subject
of the requested operation.
-.VE 8.6
.PP
\fIOption\fR indicates what to do with the registry key name. Any
unique abbreviation for \fIoption\fR is acceptable. The valid options
diff --git a/doc/return.n b/doc/return.n
index ea590ea..e3d7c06 100644
--- a/doc/return.n
+++ b/doc/return.n
@@ -137,7 +137,6 @@ by the \fBcatch\fR command (or from the copy of that information
stored in the global variable \fBerrorInfo\fR).
.TP
\fB\-errorstack \fIlist\fR
-.VS 8.6
The \fB\-errorstack\fR option receives special treatment only when the value
of the \fB\-code\fR option is \fBTCL_ERROR\fR. Then \fIlist\fR is the initial
error stack, recording actual argument values passed to each proc level. The error stack will
@@ -152,7 +151,6 @@ the procedure. Typically the \fIlist\fR value is supplied from
the value of \fB\-errorstack\fR in a return options dictionary captured
by the \fBcatch\fR command (or from the copy of that information from
\fBinfo errorstack\fR).
-.VE 8.6
.TP
\fB\-level \fIlevel\fR
.
diff --git a/doc/tclvars.n b/doc/tclvars.n
index adefe40..4d1413c 100644
--- a/doc/tclvars.n
+++ b/doc/tclvars.n
@@ -322,11 +322,9 @@ The version number for the operating system running on this machine.
On UNIX machines, this is the value returned by \fBuname -r\fR.
.TP
\fBpathSeparator\fR
-.VS 8.6
'\" Defined by TIP #315
The character that should be used to \fBsplit\fR PATH-like environment
variables into their corresponding list of directory names.
-.VE 8.6
.TP
\fBplatform\fR
.
diff --git a/generic/tcl.decls b/generic/tcl.decls
index 2c976b6..0587088 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -2221,7 +2221,7 @@ declare 606 {
# TIP#307 (move results between interpreters) dkf
declare 607 {
- void Tcl_TransferResult(Tcl_Interp *sourceInterp, int result,
+ void Tcl_TransferResult(Tcl_Interp *sourceInterp, int code,
Tcl_Interp *targetInterp)
}
diff --git a/generic/tcl.h b/generic/tcl.h
index 1a70ae4..de8ca43 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -2168,8 +2168,10 @@ typedef void (Tcl_LimitHandlerDeleteProc) (ClientData clientData);
* Override definitions for libtommath.
*/
-typedef struct mp_int mp_int;
+#ifndef MP_INT_DECLARED
#define MP_INT_DECLARED
+typedef struct mp_int mp_int;
+#endif
/*
*----------------------------------------------------------------------------
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index ac290b6..b216e05 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -1866,8 +1866,10 @@ DeleteInterpProc(
* could have transferred ownership of the result string to Tcl.
*/
+#ifndef TCL_NO_DEPRECATED
Tcl_FreeResult(interp);
iPtr->result = NULL;
+#endif
Tcl_DecrRefCount(iPtr->objResultPtr);
iPtr->objResultPtr = NULL;
Tcl_DecrRefCount(iPtr->ecVar);
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 9c887e4..7afbc33 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -797,7 +797,7 @@ TclSetByteCodeFromAny(
#ifdef TCL_COMPILE_DEBUG
if (!traceInitialized) {
if (Tcl_LinkVar(interp, "tcl_traceCompile",
- (char *) &tclTraceCompile, TCL_LINK_INT) != TCL_OK) {
+ &tclTraceCompile, TCL_LINK_INT) != TCL_OK) {
Tcl_Panic("SetByteCodeFromAny: unable to create link for tcl_traceCompile variable");
}
traceInitialized = 1;
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index 394532f..75b9c01 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -1800,7 +1800,7 @@ EXTERN int Tcl_GetErrorLine(Tcl_Interp *interp);
EXTERN void Tcl_SetErrorLine(Tcl_Interp *interp, int lineNum);
/* 607 */
EXTERN void Tcl_TransferResult(Tcl_Interp *sourceInterp,
- int result, Tcl_Interp *targetInterp);
+ int code, Tcl_Interp *targetInterp);
/* 608 */
EXTERN int Tcl_InterpActive(Tcl_Interp *interp);
/* 609 */
@@ -2563,7 +2563,7 @@ typedef struct TclStubs {
int (*tcl_ParseArgsObjv) (Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, int *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv); /* 604 */
int (*tcl_GetErrorLine) (Tcl_Interp *interp); /* 605 */
void (*tcl_SetErrorLine) (Tcl_Interp *interp, int lineNum); /* 606 */
- void (*tcl_TransferResult) (Tcl_Interp *sourceInterp, int result, Tcl_Interp *targetInterp); /* 607 */
+ void (*tcl_TransferResult) (Tcl_Interp *sourceInterp, int code, Tcl_Interp *targetInterp); /* 607 */
int (*tcl_InterpActive) (Tcl_Interp *interp); /* 608 */
void (*tcl_BackgroundException) (Tcl_Interp *interp, int code); /* 609 */
int (*tcl_ZlibDeflate) (Tcl_Interp *interp, int format, Tcl_Obj *data, int level, Tcl_Obj *gzipHeaderDictObj); /* 610 */
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 72b9746..84ae1d5 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -794,12 +794,14 @@ InitByteCodeExecution(
* instruction tracing. */
{
#ifdef TCL_COMPILE_DEBUG
- if (Tcl_LinkVar(interp, "tcl_traceExec", (char *) &tclTraceExec,
+ if (Tcl_LinkVar(interp, "tcl_traceExec", &tclTraceExec,
TCL_LINK_INT) != TCL_OK) {
Tcl_Panic("InitByteCodeExecution: can't create link for tcl_traceExec variable");
}
#endif
-#ifdef TCL_COMPILE_STATS
+#ifndef TCL_COMPILE_STATS
+ (void)interp;
+#else
Tcl_CreateObjCommand(interp, "evalstats", EvalStatsCmd, NULL, NULL);
#endif /* TCL_COMPILE_STATS */
}
@@ -1345,11 +1347,12 @@ Tcl_ExprObj(
static int
CopyCallback(
ClientData data[],
- Tcl_Interp *interp,
+ Tcl_Interp *dummy,
int result)
{
Tcl_Obj **resultPtrPtr = data[0];
Tcl_Obj *resultPtr = data[1];
+ (void)dummy;
if (result == TCL_OK) {
*resultPtrPtr = resultPtr;
@@ -1543,6 +1546,8 @@ DupExprCodeInternalRep(
Tcl_Obj *srcPtr,
Tcl_Obj *copyPtr)
{
+ (void)srcPtr;
+ (void)copyPtr;
return;
}
@@ -2604,6 +2609,7 @@ TEBCresume(
TRACE(("%u => OK\n", opnd));
NEXT_INST_F(5, 0, 0);
}
+ break;
case INST_STR_CONCAT1:
@@ -2727,6 +2733,7 @@ TEBCresume(
Tcl_DecrRefCount(objPtr);
NEXT_INST_F(5, 0, 0);
}
+ break;
case INST_EXPR_STK: {
ByteCode *newCodePtr;
@@ -4025,6 +4032,7 @@ TEBCresume(
}
NEXT_INST_F(5, 0, 0);
}
+ break;
/*
* End of INST_UNSET instructions.
@@ -4242,6 +4250,7 @@ TEBCresume(
TRACE_APPEND(("link made\n"));
NEXT_INST_F(5, 1, 0);
}
+ break;
/*
* End of variable linking instructions.
@@ -4315,6 +4324,7 @@ TEBCresume(
#endif
NEXT_INST_F(jmpOffset[b], 1, 0);
}
+ break;
case INST_JUMP_TABLE: {
Tcl_HashEntry *hPtr;
@@ -4340,6 +4350,7 @@ TEBCresume(
NEXT_INST_F(5, 1, 0);
}
}
+ break;
/*
* These two instructions are now redundant: the complete logic of the LOR
@@ -4384,6 +4395,7 @@ TEBCresume(
TRACE(("%.20s %.20s => %d\n", O2S(valuePtr),O2S(value2Ptr),iResult));
NEXT_INST_F(1, 2, 1);
}
+ break;
/*
* -----------------------------------------------------------------
@@ -4402,6 +4414,7 @@ TEBCresume(
TRACE_WITH_OBJ(("=> "), objResultPtr);
NEXT_INST_F(1, 0, 1);
}
+ break;
case INST_COROUTINE_NAME: {
CoroutineData *corPtr = iPtr->execEnvPtr->corPtr;
@@ -4413,6 +4426,7 @@ TEBCresume(
TRACE_WITH_OBJ(("=> "), objResultPtr);
NEXT_INST_F(1, 0, 1);
}
+ break;
case INST_INFO_LEVEL_NUM:
TclNewIntObj(objResultPtr, iPtr->varFramePtr->level);
TRACE_WITH_OBJ(("=> "), objResultPtr);
@@ -5648,6 +5662,7 @@ TEBCresume(
JUMP_PEEPHOLE_F(match, 2, 2);
}
+ break;
/*
* End of string-related instructions.
@@ -5838,6 +5853,7 @@ TEBCresume(
wResult = w1 - w2*wResult;
goto wideResultOfArithmetic;
}
+ break;
case INST_RSHIFT:
if (w2 < 0) {
@@ -5886,6 +5902,7 @@ TEBCresume(
wResult = w1 >> ((int) w2);
goto wideResultOfArithmetic;
}
+ break;
case INST_LSHIFT:
if (w2 < 0) {
@@ -6322,6 +6339,7 @@ TEBCresume(
TRACE_APPEND(("numeric, same Tcl_Obj\n"));
NEXT_INST_F(1, 0, 0);
}
+ break;
/*
* End of numeric operator instructions.
@@ -6719,6 +6737,7 @@ TEBCresume(
Tcl_ListObjAppendElement(NULL, objPtr, OBJ_AT_TOS);
NEXT_INST_F(1, 1, 0);
}
+ break;
case INST_BEGIN_CATCH4:
/*
@@ -7428,6 +7447,7 @@ TEBCresume(
TRACE_APPEND(("OK\n"));
NEXT_INST_F(5, 2, 0);
}
+ break;
/*
* End of dictionary-related instructions.
@@ -7465,6 +7485,7 @@ TEBCresume(
TRACE_WITH_OBJ(("=> "), objResultPtr);
NEXT_INST_F(2, 0, 1);
}
+ break;
default:
Tcl_Panic("TclNRExecuteByteCode: unrecognized opCode %u", *pc);
@@ -9056,12 +9077,12 @@ IllegalExprOperandType(
ClientData ptr;
int type;
const unsigned char opcode = *pc;
- const char *description, *operator = "unknown";
+ const char *description, *op = "unknown";
if (opcode == INST_EXPON) {
- operator = "**";
+ op = "**";
} else if (opcode <= INST_LNOT) {
- operator = operatorStrings[opcode - INST_LOR];
+ op = operatorStrings[opcode - INST_LOR];
}
if (GetNumberFromObj(NULL, opndPtr, &ptr, &type) != TCL_OK) {
@@ -9085,7 +9106,7 @@ IllegalExprOperandType(
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't use %s as operand of \"%s\"", description, operator));
+ "can't use %s as operand of \"%s\"", description, op));
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN", description, NULL);
}
diff --git a/generic/tclInterp.c b/generic/tclInterp.c
index bd786f3..7d1dd0d 100644
--- a/generic/tclInterp.c
+++ b/generic/tclInterp.c
@@ -525,7 +525,7 @@ TclInterpInit(
static void
InterpInfoDeleteProc(
- ClientData clientData, /* Ignored. */
+ ClientData dummy, /* Ignored. */
Tcl_Interp *interp) /* Interp being deleted. All commands for
* slave interps should already be deleted. */
{
@@ -533,6 +533,7 @@ InterpInfoDeleteProc(
Slave *slavePtr;
Master *masterPtr;
Target *targetPtr;
+ (void)dummy;
interpInfoPtr = (InterpInfo *) ((Interp *) interp)->interpInfo;
@@ -614,7 +615,7 @@ Tcl_InterpObjCmd(
static int
NRInterpCmd(
- ClientData clientData, /* Unused. */
+ ClientData dummy, /* Unused. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -638,6 +639,7 @@ NRInterpCmd(
OPT_INVOKEHID, OPT_LIMIT, OPT_MARKTRUSTED,OPT_RECLIMIT,
OPT_SLAVES, OPT_SHARE, OPT_TARGET, OPT_TRANSFER
};
+ (void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "cmd ?arg ...?");
@@ -999,6 +1001,7 @@ NRInterpCmd(
return SlaveTimeLimitCmd(interp, slaveInterp, 4, objc, objv);
}
}
+ break;
case OPT_MARKTRUSTED:
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "path");
@@ -2707,6 +2710,7 @@ NRSlaveCmd(
return SlaveTimeLimitCmd(interp, slaveInterp, 3, objc, objv);
}
}
+ break;
case OPT_MARKTRUSTED:
if (objc != 2) {
Tcl_WrongNumArgs(interp, 2, objv, NULL);
@@ -4235,10 +4239,11 @@ DeleteScriptLimitCallback(
static void
CallScriptLimitCallback(
ClientData clientData,
- Tcl_Interp *interp) /* Interpreter which failed the limit */
+ Tcl_Interp *dummy) /* Interpreter which failed the limit */
{
ScriptLimitCallback *limitCBPtr = clientData;
int code;
+ (void)dummy;
if (Tcl_InterpDeleted(limitCBPtr->interp)) {
return;
diff --git a/generic/tclLink.c b/generic/tclLink.c
index 8fbe540..ecb7aa5 100644
--- a/generic/tclLink.c
+++ b/generic/tclLink.c
@@ -261,6 +261,14 @@ Tcl_LinkArray(
linkPtr = ckalloc(sizeof(Link));
linkPtr->type = type & ~TCL_LINK_READ_ONLY;
+#if !defined(TCL_NO_DEPRECATED) && (defined(TCL_WIDE_INT_IS_LONG) \
+ || defined(_WIN32) || defined(__CYGWIN__))
+ if (linkPtr->type == 11 /* legacy TCL_LINK_LONG */) {
+ linkPtr->type = TCL_LINK_LONG;
+ } else if (linkPtr->type == 12 /* legacy TCL_LINK_ULONG */) {
+ linkPtr->type = TCL_LINK_ULONG;
+ }
+#endif
linkPtr->numElems = size;
if (type & TCL_LINK_READ_ONLY) {
linkPtr->flags = LINK_READ_ONLY;
diff --git a/generic/tclMain.c b/generic/tclMain.c
index 05d3787..0ed5de1 100644
--- a/generic/tclMain.c
+++ b/generic/tclMain.c
@@ -446,7 +446,7 @@ Tcl_MainEx(
* Get a new value for tty if anyone writes to ::tcl_interactive
*/
- Tcl_LinkVar(interp, "tcl_interactive", (char *) &is.tty, TCL_LINK_BOOLEAN);
+ Tcl_LinkVar(interp, "tcl_interactive", &is.tty, TCL_LINK_BOOLEAN);
is.input = Tcl_GetStdChannel(TCL_STDIN);
while ((is.input != NULL) && !Tcl_InterpDeleted(interp)) {
mainLoopProc = TclGetMainLoop();
diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c
index f3474b6..423a41e 100644
--- a/generic/tclOOCall.c
+++ b/generic/tclOOCall.c
@@ -1677,6 +1677,7 @@ AddPrivatesFromClassChainToCallContext(
return 1;
}
}
+ /* FALLTHRU */
case 0:
return 0;
}
@@ -1768,6 +1769,7 @@ AddSimpleClassChainToCallContext(
privateDanger |= AddSimpleClassChainToCallContext(superPtr,
methodNameObj, cbPtr, doneFilters, flags, filterDecl);
}
+ /* FALLTHRU */
case 0:
return privateDanger;
}
diff --git a/generic/tclResult.c b/generic/tclResult.c
index 3c856d3..5c2a81f 100644
--- a/generic/tclResult.c
+++ b/generic/tclResult.c
@@ -1690,22 +1690,14 @@ Tcl_SetReturnOptions(
*
* Tcl_TransferResult --
*
- * Copy the result (and error information) from one interp to another.
+ * Transfer the result (and error information) from one interp to another.
* Used when one interp has caused another interp to evaluate a script
* and then wants to transfer the results back to itself.
*
- * This routine copies the string reps of the result and error
- * information. It does not simply increment the refcounts of the result
- * and error information objects themselves. It is not legal to exchange
- * objects between interps, because an object may be kept alive by one
- * interp, but have an internal rep that is only valid while some other
- * interp is alive.
- *
* Results:
- * The target interp's result is set to a copy of the source interp's
- * result. The source's errorInfo field may be transferred to the
- * target's errorInfo field, and the source's errorCode field may be
- * transferred to the target's errorCode field.
+ * The result of targetInterp is set to the result read from sourceInterp.
+ * The return options dictionary of sourceInterp is transferred to
+ * targetInterp as appropriate for the return code value code.
*
* Side effects:
* None.
@@ -1715,14 +1707,16 @@ Tcl_SetReturnOptions(
void
Tcl_TransferResult(
- Tcl_Interp *sourceInterp, /* Interp whose result and error information
+ Tcl_Interp *sourceInterp, /* Interp whose result and return options
* should be moved to the target interp.
* After moving result, this interp's result
* is reset. */
- int result, /* TCL_OK if just the result should be copied,
- * TCL_ERROR if both the result and error
- * information should be copied. */
- Tcl_Interp *targetInterp) /* Interp where result and error information
+ int code, /* The return code value active in
+ * sourceInterp. Controls how the return options
+ * dictionary is retrieved from sourceInterp,
+ * same as in Tcl_GetReturnOptions, to then be
+ * transferred to targetInterp. */
+ Tcl_Interp *targetInterp) /* Interp where result and return options
* should be stored. If source and target are
* the same, nothing is done. */
{
@@ -1733,7 +1727,7 @@ Tcl_TransferResult(
return;
}
- if (result == TCL_OK && siPtr->returnOpts == NULL) {
+ if (code == TCL_OK && siPtr->returnOpts == NULL) {
/*
* Special optimization for the common case of normal command return
* code and no explicit return options.
@@ -1745,7 +1739,7 @@ Tcl_TransferResult(
}
} else {
Tcl_SetReturnOptions(targetInterp,
- Tcl_GetReturnOptions(sourceInterp, result));
+ Tcl_GetReturnOptions(sourceInterp, code));
tiPtr->flags &= ~(ERR_ALREADY_LOGGED);
}
Tcl_SetObjResult(targetInterp, Tcl_GetObjResult(sourceInterp));
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c
index 9e4e2c9..070a061 100644
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -18,6 +18,18 @@
#include <math.h>
/*
+ * Older MSVC has no copysign function, but it's available at least since
+ * MSVC++ 12.0 (that is Visual Studio 2013).
+ */
+
+#if (defined(_MSC_VER) && (_MSC_VER < 1800))
+inline static double
+copysign(double a, double b) {
+ return _copysign(a, b);
+}
+#endif
+
+/*
* This code supports (at least hypothetically), IBM, Cray, VAX and IEEE-754
* floating point; of these, only IEEE-754 can represent NaN. IEEE-754 can be
* uniquely determined by radix and by the widths of significand and exponent.
@@ -289,10 +301,10 @@ static const Tcl_WideUInt wuipow5[27] = {
static int AccumulateDecimalDigit(unsigned, int,
Tcl_WideUInt *, mp_int *, int);
static double MakeHighPrecisionDouble(int signum,
- mp_int *significand, int nSigDigs, int exponent);
+ mp_int *significand, int nSigDigs, long exponent);
static double MakeLowPrecisionDouble(int signum,
Tcl_WideUInt significand, int nSigDigs,
- int exponent);
+ long exponent);
#ifdef IEEE_FLOATING_POINT
static double MakeNaN(int signum, Tcl_WideUInt tag);
#endif
@@ -847,6 +859,7 @@ TclParseNumber(
acceptState = state;
acceptPoint = p;
acceptLen = len;
+ /* FALLTHRU */
case ZERO_B:
zerob:
if (c == '0') {
@@ -1337,16 +1350,45 @@ TclParseNumber(
objPtr->typePtr = &tclDoubleType;
if (exponentSignum) {
+ /*
+ * At this point exponent>=0, so the following calculation
+ * cannot underflow.
+ */
exponent = -exponent;
}
+
+ /*
+ * Adjust the exponent for the number of trailing zeros that
+ * have not been accumulated, and the number of digits after
+ * the decimal point. Pin any overflow to LONG_MAX/LONG_MIN
+ * respectively.
+ */
+
+ if (exponent >= 0) {
+ if (exponent - numDigitsAfterDp > LONG_MAX - numTrailZeros) {
+ exponent = LONG_MAX;
+ } else {
+ exponent = exponent - numDigitsAfterDp + numTrailZeros;
+ }
+ } else {
+ if (exponent + numTrailZeros < LONG_MIN + numDigitsAfterDp) {
+ exponent = LONG_MIN;
+ } else {
+ exponent = exponent + numTrailZeros - numDigitsAfterDp;
+ }
+ }
+
+ /*
+ * The desired number is now significandWide * 10**exponent
+ * or significandBig * 10**exponent, depending on whether
+ * the significand has overflowed a wide int.
+ */
if (!significandOverflow) {
objPtr->internalRep.doubleValue = MakeLowPrecisionDouble(
- signum, significandWide, numSigDigs,
- numTrailZeros + exponent - numDigitsAfterDp);
+ signum, significandWide, numSigDigs, exponent);
} else {
objPtr->internalRep.doubleValue = MakeHighPrecisionDouble(
- signum, &significandBig, numSigDigs,
- numTrailZeros + exponent - numDigitsAfterDp);
+ signum, &significandBig, numSigDigs, exponent);
}
break;
@@ -1530,9 +1572,9 @@ AccumulateDecimalDigit(
static double
MakeLowPrecisionDouble(
int signum, /* 1 if the number is negative, 0 otherwise */
- Tcl_WideUInt significand, /* Significand of the number. */
- int numSigDigs, /* Number of digits in the significand. */
- int exponent) /* Power of ten. */
+ Tcl_WideUInt significand, /* Significand of the number */
+ int numSigDigs, /* Number of digits in the significand */
+ long exponent) /* Power of ten */
{
double retval; /* Value of the number. */
mp_int significandBig; /* Significand expressed as a bignum. */
@@ -1551,6 +1593,9 @@ MakeLowPrecisionDouble(
* Test for the easy cases.
*/
+ if (significand == 0) {
+ return copysign(0.0, -signum);
+ }
if (numSigDigs <= QUICK_MAX) {
if (exponent >= 0) {
if (exponent <= mmaxpow) {
@@ -1643,10 +1688,10 @@ MakeLowPrecisionDouble(
static double
MakeHighPrecisionDouble(
- int signum, /* 1=negative, 0=nonnegative. */
- mp_int *significand, /* Exact significand of the number. */
- int numSigDigs, /* Number of significant digits. */
- int exponent) /* Power of 10 by which to multiply. */
+ int signum, /* 1=negative, 0=nonnegative */
+ mp_int *significand, /* Exact significand of the number */
+ int numSigDigs, /* Number of significant digits */
+ long exponent) /* Power of 10 by which to multiply */
{
double retval;
int machexp; /* Machine exponent of a power of 10. */
@@ -1662,15 +1707,18 @@ MakeHighPrecisionDouble(
TCL_IEEE_DOUBLE_ROUNDING;
/*
- * Quick checks for over/underflow.
+ * Quick checks for zero, and over/underflow. Be careful to avoid
+ * integer overflow when calculating with 'exponent'.
*/
- if (numSigDigs+exponent-1 > maxDigits) {
+ if (mp_iszero(significand)) {
+ return copysign(0.0, -signum);
+ }
+ if (exponent >= 0 && exponent-1 > maxDigits-numSigDigs) {
retval = HUGE_VAL;
goto returnValue;
- }
- if (numSigDigs+exponent-1 < minDigits) {
- retval = 0;
+ } else if (exponent < 0 && numSigDigs+exponent < minDigits+1) {
+ retval = 0.0;
goto returnValue;
}
@@ -1805,6 +1853,9 @@ RefineApproximation(
* "round to even" functionality */
double rteSignificand; /* Significand of the round-to-even result */
int rteExponent; /* Exponent of the round-to-even result */
+ int shift; /* Shift count for converting numerator
+ * and denominator of corrector to floating
+ * point */
Tcl_WideInt rteSigWide; /* Wide integer version of the significand
* for testing evenness */
int i;
@@ -1817,13 +1868,22 @@ RefineApproximation(
if (approxResult == HUGE_VAL) {
return approxResult;
}
+ significand = frexp(approxResult, &binExponent);
/*
- * Find a common denominator for the decimal and binary fractions. The
- * common denominator will be 2**M2 + 5**M5.
+ * We are trying to compute a corrector term that, when added to the
+ * approximate result, will yield close to the exact result.
+ * The exact result is exactSignificand * 10**exponent.
+ * The approximate result is significand * 2**binExponent
+ * If exponent<0, we need to multiply the exact value by 10**-exponent
+ * to make it an integer, plus another factor of 2 to decide on rounding.
+ * Similarly if binExponent<FP_PRECISION, we need
+ * to multiply by 2**FP_PRECISION to make the approximate value an integer.
+ *
+ * Let M = 2**M2 * 5**M5 be the least common multiple of these two
+ * multipliers.
*/
- significand = frexp(approxResult, &binExponent);
i = mantBits - binExponent;
if (i < 0) {
M2 = 0;
@@ -1840,12 +1900,9 @@ RefineApproximation(
}
/*
- * The floating point number is significand*2**binExponent. Compute the
- * large integer significand*2**(binExponent+M2+1). The 2**-1 bit of the
- * significand (the most significant) corresponds to the
- * 2**(binExponent+M2 + 1) bit of 2*M2*v. Allocate enough digits to hold
- * that quantity, then convert the significand to a large integer, scaled
- * appropriately. Then multiply by the appropriate power of 5.
+ * Compute twoMv as 2*M*v, where v is the approximate value.
+ * This is done by bit-whacking to calculate 2**(M2+1)*significand,
+ * and then multiplying by 5**M5.
*/
msb = binExponent + M2; /* 1008 */
@@ -1866,10 +1923,9 @@ RefineApproximation(
}
/*
- * Collect the decimal significand as a high precision integer. The least
- * significant bit corresponds to bit M2+exponent+1 so it will need to be
- * shifted left by that many bits after being multiplied by
- * 5**(M5+exponent).
+ * Compute twoMd as 2*M*d, where d is the exact value.
+ * This is done by multiplying by 5**(M5+exponent) and then multiplying
+ * by 2**(M5+exponent+1), which is, of couse, a left shift.
*/
mp_init_copy(&twoMd, exactSignificand);
@@ -1879,16 +1935,22 @@ RefineApproximation(
}
}
mp_mul_2d(&twoMd, M2+exponent+1, &twoMd);
+
+ /*
+ * Now let twoMd = twoMd - twoMv, the difference between the exact and
+ * approximate values.
+ */
+
mp_sub(&twoMd, &twoMv, &twoMd);
/*
* The result, 2Mv-2Md, needs to be divided by 2M to yield a correction
* term. Because 2M may well overflow a double, we need to scale the
- * denominator by a factor of 2**binExponent-mantBits.
+ * denominator by a factor of 2**binExponent-mantBits. Place that factor
+ * times 1/2 ULP into twoMd.
*/
scale = binExponent - mantBits - 1;
-
mp_set_u64(&twoMv, 1);
for (i=0; i<=8; ++i) {
if (M5 & (1 << i)) {
@@ -1902,25 +1964,36 @@ RefineApproximation(
mp_div_2d(&twoMv, -multiplier, &twoMv, NULL);
}
+ /*
+ * Will the eventual correction term be less than, equal to, or
+ * greater than 1/2 ULP?
+ */
+
switch (mp_cmp_mag(&twoMd, &twoMv)) {
case MP_LT:
/*
- * If the result is less than unity, the error is less than 1/2 unit in
- * the last place, so there's no correction to make.
+ * If the error is less than 1/2 ULP, there's no correction to make.
*/
mp_clear(&twoMd);
mp_clear(&twoMv);
return approxResult;
case MP_EQ:
/*
- * If the result is exactly unity, we need to round to even.
+ * If the error is exactly 1/2 ULP, we need to round to even.
*/
roundToEven = 1;
break;
case MP_GT:
+ /*
+ * We need to correct the result if the error exceeds 1/2 ULP.
+ */
break;
}
+ /*
+ * If we're in the 'round to even' case, and the significand is already
+ * even, we're done. Return the approximate result.
+ */
if (roundToEven) {
rteSignificand = frexp(approxResult, &rteExponent);
rteSigWide = (Tcl_WideInt) ldexp(rteSignificand, FP_PRECISION);
@@ -1932,6 +2005,16 @@ RefineApproximation(
}
/*
+ * Reduce the numerator and denominator of the corrector term so that
+ * they will fit in the floating point precision.
+ */
+ shift = mp_count_bits(&twoMv) - FP_PRECISION - 1;
+ if (shift > 0) {
+ mp_div_2d(&twoMv, shift, &twoMv, NULL);
+ mp_div_2d(&twoMd, shift, &twoMd, NULL);
+ }
+
+ /*
* Convert the numerator and denominator of the corrector term accurately
* to floating point numbers.
*/
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 403b0a9..9270727 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -2922,7 +2922,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
- if (Tcl_LinkVar(interp, "int", (char *) &intVar,
+ if (Tcl_LinkVar(interp, "int", &intVar,
TCL_LINK_INT | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -2930,7 +2930,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
- if (Tcl_LinkVar(interp, "real", (char *) &realVar,
+ if (Tcl_LinkVar(interp, "real", &realVar,
TCL_LINK_DOUBLE | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -2938,7 +2938,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
- if (Tcl_LinkVar(interp, "bool", (char *) &boolVar,
+ if (Tcl_LinkVar(interp, "bool", &boolVar,
TCL_LINK_BOOLEAN | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -2946,7 +2946,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
- if (Tcl_LinkVar(interp, "string", (char *) &stringVar,
+ if (Tcl_LinkVar(interp, "string", &stringVar,
TCL_LINK_STRING | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -2954,7 +2954,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
- if (Tcl_LinkVar(interp, "wide", (char *) &wideVar,
+ if (Tcl_LinkVar(interp, "wide", &wideVar,
TCL_LINK_WIDE_INT | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -2962,7 +2962,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
- if (Tcl_LinkVar(interp, "char", (char *) &charVar,
+ if (Tcl_LinkVar(interp, "char", &charVar,
TCL_LINK_CHAR | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -2970,7 +2970,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
- if (Tcl_LinkVar(interp, "uchar", (char *) &ucharVar,
+ if (Tcl_LinkVar(interp, "uchar", &ucharVar,
TCL_LINK_UCHAR | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -2978,7 +2978,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
- if (Tcl_LinkVar(interp, "short", (char *) &shortVar,
+ if (Tcl_LinkVar(interp, "short", &shortVar,
TCL_LINK_SHORT | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -2986,7 +2986,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
- if (Tcl_LinkVar(interp, "ushort", (char *) &ushortVar,
+ if (Tcl_LinkVar(interp, "ushort", &ushortVar,
TCL_LINK_USHORT | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -2994,7 +2994,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
- if (Tcl_LinkVar(interp, "uint", (char *) &uintVar,
+ if (Tcl_LinkVar(interp, "uint", &uintVar,
TCL_LINK_UINT | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -3002,7 +3002,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
- if (Tcl_LinkVar(interp, "long", (char *) &longVar,
+ if (Tcl_LinkVar(interp, "long", &longVar,
TCL_LINK_LONG | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -3010,7 +3010,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
- if (Tcl_LinkVar(interp, "ulong", (char *) &ulongVar,
+ if (Tcl_LinkVar(interp, "ulong", &ulongVar,
TCL_LINK_ULONG | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -3018,7 +3018,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
- if (Tcl_LinkVar(interp, "float", (char *) &floatVar,
+ if (Tcl_LinkVar(interp, "float", &floatVar,
TCL_LINK_FLOAT | flag) != TCL_OK) {
return TCL_ERROR;
}
@@ -3026,7 +3026,7 @@ TestlinkCmd(
return TCL_ERROR;
}
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
- if (Tcl_LinkVar(interp, "uwide", (char *) &uwideVar,
+ if (Tcl_LinkVar(interp, "uwide", &uwideVar,
TCL_LINK_WIDE_UINT | flag) != TCL_OK) {
return TCL_ERROR;
}
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 7154898..c9eb966 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -3616,37 +3616,24 @@ TclFormatInt(
Tcl_WideInt n) /* The integer to format. */
{
Tcl_WideUInt intVal;
- int i;
+ int i = 0;
int numFormatted, j;
static const char digits[] = "0123456789";
/*
- * Check first whether "n" is zero.
- */
-
- if (n == 0) {
- buffer[0] = '0';
- buffer[1] = 0;
- return 1;
- }
-
- /*
* Generate the characters of the result backwards in the buffer.
*/
intVal = (n < 0 ? -(Tcl_WideUInt)n : (Tcl_WideUInt)n);
- i = 0;
- buffer[0] = '\0';
do {
- i++;
- buffer[i] = digits[intVal % 10];
+ buffer[i++] = digits[intVal % 10];
intVal = intVal / 10;
} while (intVal > 0);
if (n < 0) {
- i++;
- buffer[i] = '-';
+ buffer[i++] = '-';
}
- numFormatted = i;
+ buffer[i] = '\0';
+ numFormatted = i--;
/*
* Now reverse the characters.
diff --git a/library/encoding/tis-620.enc b/library/encoding/tis-620.enc
index c233be5..2e9142a 100644
--- a/library/encoding/tis-620.enc
+++ b/library/encoding/tis-620.enc
@@ -17,4 +17,4 @@ S
0E200E210E220E230E240E250E260E270E280E290E2A0E2B0E2C0E2D0E2E0E2F
0E300E310E320E330E340E350E360E370E380E390E3A00000000000000000E3F
0E400E410E420E430E440E450E460E470E480E490E4A0E4B0E4C0E4D0E4E0E4F
-0E500E510E520E530E540E550E560E570E580E590E5A0E5B0000000000000000 \ No newline at end of file
+0E500E510E520E530E540E550E560E570E580E590E5A0E5B0000000000000000
diff --git a/tests/clock.test b/tests/clock.test
index c6dba85..55607ce 100644
--- a/tests/clock.test
+++ b/tests/clock.test
@@ -35452,7 +35452,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} {
@@ -35468,7 +35468,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} {
diff --git a/tests/encoding.test b/tests/encoding.test
index 643d493..664a041 100644
--- a/tests/encoding.test
+++ b/tests/encoding.test
@@ -717,6 +717,21 @@ test encoding-27.2 {encoding dirs basic behavior} -returnCodes error -body {
} -result "expected directory list but got \"\{not a list\""
}
+
+
+test encoding-28.0 {all encodings load} -body {
+ set string hello
+ foreach name [encoding names] {
+ incr count
+ encoding convertto $name $string
+
+ # discard the cached internal representation of Tcl_Encoding
+ # Unfortunately, without this, encoding 2-1 fails.
+ llength $name
+ }
+ return $count
+} -result [expr {[info exists ::tcl_precision] ? 86 : 85}]
+
runtests
}
diff --git a/tests/expr.test b/tests/expr.test
index bc01c03..f0b75f4 100644
--- a/tests/expr.test
+++ b/tests/expr.test
@@ -6822,6 +6822,72 @@ test expr-41.2 {exponent underflow} {
expr 1.0e-2147483630
} 0.0
+test expr-41.3 {exponent overflow} {
+ expr 1e2147483647
+} Inf
+test expr-41.4 {exponent overflow} {
+ expr 1e2147483648
+} Inf
+test expr-41.5 {exponent overflow} {
+ expr 100e2147483645
+} Inf
+test expr-41.6 {exponent overflow} {
+ expr 100e2147483646
+} Inf
+test expr-41.7 {exponent overflow} {
+ expr 1.0e2147483647
+} Inf
+test expr-41.8 {exponent overflow} {
+ expr 1.0e2147483648
+} Inf
+test expr-41.9 {exponent overflow} {
+ expr 1.2e2147483647
+} Inf
+test expr-41.10 {exponent overflow} {
+ expr 1.2e2147483648
+} Inf
+
+test expr-41.11 {exponent overflow} {
+ expr 1e-2147483648
+} 0.0
+test expr-41.12 {exponent overflow} {
+ expr 1e-2147483649
+} 0.0
+test expr-41.13 {exponent overflow} {
+ expr 100e-2147483650
+} 0.0
+test expr-41.14 {exponent overflow} {
+ expr 100e-2147483651
+} 0.0
+test expr-41.15 {exponent overflow} {
+ expr 1.0e-2147483648
+} 0.0
+test expr-41.16 {exponent overflow} {
+ expr 1.0e-2147483649
+} 0.0
+test expr-41.17 {exponent overflow} {
+ expr 1.23e-2147483646
+} 0.0
+test expr-41.18 {exponent overflow} {
+ expr 1.23e-2147483647
+} 0.0
+
+test expr-41.19 {numSigDigs == 0} {
+ expr 0e309
+} 0.0
+test expr-41.20 {numSigDigs == 0} {
+ expr 0e310
+} 0.0
+test expr-41.21 {negative zero, large exponent} {
+ expr -0e309
+} -0.0
+test expr-41.22 {negative zero, large exponent} {
+ expr -0e310
+} -0.0
+test expr-41.23 {floating point overflow on significand (Bug 1de6b0629e)} {
+ expr 123[string repeat 0 309]1e-310
+} 123.0
+
test expr-42.1 {denormals} ieeeFloatingPoint {
expr 7e-324
} 5e-324
diff --git a/unix/Makefile.in b/unix/Makefile.in
index c971ab6..3876f1f 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -277,8 +277,8 @@ VALGRINDARGS = --tool=memcheck --num-callers=24 \
# modify it and you shouldn't need to modify it either.
#--------------------------------------------------------------------------
-STUB_CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \
- -I"${BUILD_DIR}" -I${UNIX_DIR} -I${GENERIC_DIR} -I${TOMMATH_DIR} \
+STUB_CC_SWITCHES = -I"${BUILD_DIR}" -I${UNIX_DIR} -I${GENERIC_DIR} -I${TOMMATH_DIR} \
+ ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \
${AC_FLAGS} ${PROTO_FLAGS} ${ENV_FLAGS} ${EXTRA_CFLAGS} \
@EXTRA_CC_SWITCHES@
diff --git a/unix/configure b/unix/configure
index dfbd8a8..04f1dbc 100755
--- a/unix/configure
+++ b/unix/configure
@@ -4661,7 +4661,7 @@ if test "${with_system_libtommath+set}" = set; then :
withval=$with_system_libtommath; libtommath_ok=${withval}
fi
-if test x"${libtommath_ok}" == x -o x"${libtommath_ok}" != xno; then
+if test x"${libtommath_ok}" = x -o x"${libtommath_ok}" != xno; then
ac_fn_c_check_header_mongrel "$LINENO" "tommath.h" "ac_cv_header_tommath_h" "$ac_includes_default"
if test "x$ac_cv_header_tommath_h" = xyes; then :
@@ -5845,7 +5845,6 @@ fi
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- LDFLAGS=""
if test $doRpath = yes; then :
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
@@ -6049,6 +6048,7 @@ fi
$as_echo "#define MODULE_SCOPE __private_extern__" >>confdefs.h
+ tcl_cv_cc_visibility_hidden=yes
fi
CC_SEARCH_FLAGS=""
diff --git a/unix/configure.ac b/unix/configure.ac
index a5cb12b..f0ba688 100644
--- a/unix/configure.ac
+++ b/unix/configure.ac
@@ -175,7 +175,7 @@ AC_ARG_WITH(system-libtommath,
AC_HELP_STRING([--with-system-libtommath],
[use external libtommath (default: true if available, false otherwise)]),
libtommath_ok=${withval})
-if test x"${libtommath_ok}" == x -o x"${libtommath_ok}" != xno; then
+if test x"${libtommath_ok}" = x -o x"${libtommath_ok}" != xno; then
AC_CHECK_HEADER([tommath.h],[
AC_CHECK_TYPE([mp_int],[],[libtommath_ok=no],[#include <tommath.h>])],[
libtommath_ok=no])
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index a38ae92..9c88a42 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -1385,7 +1385,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- LDFLAGS=""
AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
@@ -1476,6 +1475,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
AC_DEFINE(MODULE_SCOPE, [__private_extern__],
[Compiler support for module scope symbols])
+ tcl_cv_cc_visibility_hidden=yes
])
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
diff --git a/unix/tclSelectNotfy.c b/unix/tclSelectNotfy.c
index cb8addf..585cd80 100644
--- a/unix/tclSelectNotfy.c
+++ b/unix/tclSelectNotfy.c
@@ -233,6 +233,9 @@ typedef struct {
const void *lpszClassName;
} WNDCLASSW;
+#ifdef __clang__
+#pragma clang diagnostic ignored "-Wignored-attributes"
+#endif
extern void __stdcall CloseHandle(void *);
extern void *__stdcall CreateEventW(void *, unsigned char, unsigned char,
void *);
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 13a624e..218813f 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -31,6 +31,9 @@
#endif
#ifdef __CYGWIN__
+#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 *);
diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h
index d7005db..d253101 100644
--- a/unix/tclUnixPort.h
+++ b/unix/tclUnixPort.h
@@ -96,6 +96,10 @@ typedef off_t Tcl_SeekOffset;
# define SOCKET unsigned int
# define WSAEWOULDBLOCK 10035
typedef unsigned short WCHAR;
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wignored-attributes"
+#endif
__declspec(dllimport) extern __stdcall int GetModuleHandleExW(unsigned int, const void *, void *);
__declspec(dllimport) extern __stdcall int GetModuleFileNameW(void *, const void *, int);
__declspec(dllimport) extern __stdcall int WideCharToMultiByte(int, int, const void *, int,
@@ -103,12 +107,15 @@ typedef off_t Tcl_SeekOffset;
__declspec(dllimport) extern __stdcall int MultiByteToWideChar(int, int, const char *, int,
WCHAR *, int);
__declspec(dllimport) extern __stdcall void OutputDebugStringW(const WCHAR *);
- __declspec(dllimport) extern __stdcall int IsDebuggerPresent();
- __declspec(dllimport) extern __stdcall int GetLastError();
+ __declspec(dllimport) extern __stdcall int IsDebuggerPresent(void);
+ __declspec(dllimport) extern __stdcall int GetLastError(void);
__declspec(dllimport) extern __stdcall int GetFileAttributesW(const WCHAR *);
__declspec(dllimport) extern __stdcall int SetFileAttributesW(const WCHAR *, int);
__declspec(dllimport) extern int cygwin_conv_path(int, const void *, void *, int);
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
/* On Cygwin, the environment is imported from the Cygwin DLL. */
#ifndef __x86_64__
# define environ __cygwin_environ
diff --git a/win/Makefile.in b/win/Makefile.in
index ed8c248..2243214 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -249,9 +249,9 @@ MINIZIP_OBJS = \
ZIP_INSTALL_OBJS = @ZIP_INSTALL_OBJS@
-CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${TCL_SHLIB_CFLAGS} \
--I"${GENERIC_DIR_NATIVE}" -I"${TOMMATH_DIR_NATIVE}" \
--DMP_PREC=4 -I"${ZLIB_DIR_NATIVE}" -I"${WIN_DIR_NATIVE}" \
+CC_SWITCHES = -I"${GENERIC_DIR_NATIVE}" -I"${TOMMATH_DIR_NATIVE}" \
+-I"${ZLIB_DIR_NATIVE}" -I"${WIN_DIR_NATIVE}" \
+${CFLAGS} ${CFLAGS_WARNING} ${TCL_SHLIB_CFLAGS} -DMP_PREC=4 \
${AC_FLAGS} ${COMPILE_DEBUG_FLAGS} ${NO_DEPRECATED_FLAGS}
CC_OBJNAME = @CC_OBJNAME@
diff --git a/win/tclWinChan.c b/win/tclWinChan.c
index d300269..b08db5d 100644
--- a/win/tclWinChan.c
+++ b/win/tclWinChan.c
@@ -1068,7 +1068,7 @@ Tcl_MakeFileChannel(
int mode) /* ORed combination of TCL_READABLE and
* TCL_WRITABLE to indicate file mode. */
{
-#if defined(HAVE_NO_SEH) && !defined(_WIN64)
+#if defined(HAVE_NO_SEH) && !defined(_WIN64) && !defined(__clang__)
TCLEXCEPTION_REGISTRATION registration;
#endif
char channelName[16 + TCL_INTEGER_SPACE];
@@ -1121,7 +1121,7 @@ Tcl_MakeFileChannel(
if (result == 0) {
/*
- * Unable to make a duplicate. It's definately invalid at this
+ * Unable to make a duplicate. It's definitely invalid at this
* point.
*/
@@ -1134,7 +1134,7 @@ Tcl_MakeFileChannel(
*/
result = 0;
-#if defined(HAVE_NO_SEH) && !defined(_WIN64)
+#if defined(HAVE_NO_SEH) && !defined(_WIN64) && !defined(__clang__)
/*
* Don't have SEH available, do things the hard way. Note that this
* needs to be one block of asm, to avoid stack imbalance; also, it is
diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c
index 09262c0..7de425b 100644
--- a/win/tclWinConsole.c
+++ b/win/tclWinConsole.c
@@ -1380,7 +1380,7 @@ TclWinOpenConsoleChannel(
Tcl_SetChannelOption(NULL, infoPtr->channel, "-translation", "auto");
Tcl_SetChannelOption(NULL, infoPtr->channel, "-eofchar", "\032 {}");
- Tcl_SetChannelOption(NULL, infoPtr->channel, "-encoding", "unicode");
+ Tcl_SetChannelOption(NULL, infoPtr->channel, "-encoding", "utf-16");
return infoPtr->channel;
}